Files

Return to Package Diff Home.
Brought to you by Intrinsic.

Package Diff: typescript @ 3.4.5 .. 3.5.1

lib/lib.dom.d.ts

@@ -171,7 +171,6 @@
}
interface CacheQueryOptions {
- cacheName?: string;
ignoreMethod?: boolean;
ignoreSearch?: boolean;
ignoreVary?: boolean;
@@ -256,7 +255,7 @@
ideal?: number;
}
-interface ConstrainLongRange extends LongRange {
+interface ConstrainULongRange extends ULongRange {
exact?: number;
ideal?: number;
}
@@ -330,36 +329,41 @@
maxDelayTime?: number;
}
-interface DeviceAccelerationDict {
+interface DeviceLightEventInit extends EventInit {
+ value?: number;
+}
+
+interface DeviceMotionEventAccelerationInit {
x?: number | null;
y?: number | null;
z?: number | null;
}
-interface DeviceLightEventInit extends EventInit {
- value?: number;
-}
-
interface DeviceMotionEventInit extends EventInit {
- acceleration?: DeviceAccelerationDict | null;
- accelerationIncludingGravity?: DeviceAccelerationDict | null;
- interval?: number | null;
- rotationRate?: DeviceRotationRateDict | null;
+ acceleration?: DeviceMotionEventAccelerationInit;
+ accelerationIncludingGravity?: DeviceMotionEventAccelerationInit;
+ interval?: number;
+ rotationRate?: DeviceMotionEventRotationRateInit;
}
-interface DeviceOrientationEventInit extends EventInit {
- absolute?: boolean;
+interface DeviceMotionEventRotationRateInit {
alpha?: number | null;
beta?: number | null;
gamma?: number | null;
}
-interface DeviceRotationRateDict {
+interface DeviceOrientationEventInit extends EventInit {
+ absolute?: boolean;
alpha?: number | null;
beta?: number | null;
gamma?: number | null;
}
+interface DevicePermissionDescriptor extends PermissionDescriptor {
+ deviceId?: string;
+ name: "camera" | "microphone" | "speaker";
+}
+
interface DocumentTimelineOptions {
originTime?: number;
}
@@ -412,6 +416,10 @@
iterations?: number;
}
+interface ElementCreationOptions {
+ is?: string;
+}
+
interface ElementDefinitionOptions {
extends?: string;
}
@@ -553,11 +561,17 @@
feedforward: number[];
}
+interface ImageEncodeOptions {
+ quality?: number;
+ type?: string;
+}
+
interface IntersectionObserverEntryInit {
boundingClientRect: DOMRectInit;
+ intersectionRatio: number;
intersectionRect: DOMRectInit;
isIntersecting: boolean;
- rootBounds: DOMRectInit;
+ rootBounds: DOMRectInit | null;
target: Element;
time: number;
}
@@ -616,11 +630,6 @@
iterationComposite?: IterationCompositeOperation;
}
-interface LongRange {
- max?: number;
- min?: number;
-}
-
interface MediaElementAudioSourceOptions {
mediaElement: HTMLMediaElement;
}
@@ -678,39 +687,45 @@
}
interface MediaStreamTrackEventInit extends EventInit {
- track?: MediaStreamTrack | null;
+ track: MediaStreamTrack;
}
interface MediaTrackCapabilities {
- aspectRatio?: number | DoubleRange;
+ aspectRatio?: DoubleRange;
+ autoGainControl?: boolean[];
+ channelCount?: ULongRange;
deviceId?: string;
echoCancellation?: boolean[];
- facingMode?: string;
- frameRate?: number | DoubleRange;
+ facingMode?: string[];
+ frameRate?: DoubleRange;
groupId?: string;
- height?: number | LongRange;
- sampleRate?: number | LongRange;
- sampleSize?: number | LongRange;
- volume?: number | DoubleRange;
- width?: number | LongRange;
+ height?: ULongRange;
+ latency?: DoubleRange;
+ noiseSuppression?: boolean[];
+ resizeMode?: string[];
+ sampleRate?: ULongRange;
+ sampleSize?: ULongRange;
+ volume?: DoubleRange;
+ width?: ULongRange;
}
interface MediaTrackConstraintSet {
- aspectRatio?: number | ConstrainDoubleRange;
- channelCount?: number | ConstrainLongRange;
- deviceId?: string | string[] | ConstrainDOMStringParameters;
- displaySurface?: string | string[] | ConstrainDOMStringParameters;
- echoCancellation?: boolean | ConstrainBooleanParameters;
- facingMode?: string | string[] | ConstrainDOMStringParameters;
- frameRate?: number | ConstrainDoubleRange;
- groupId?: string | string[] | ConstrainDOMStringParameters;
- height?: number | ConstrainLongRange;
- latency?: number | ConstrainDoubleRange;
- logicalSurface?: boolean | ConstrainBooleanParameters;
- sampleRate?: number | ConstrainLongRange;
- sampleSize?: number | ConstrainLongRange;
- volume?: number | ConstrainDoubleRange;
- width?: number | ConstrainLongRange;
+ aspectRatio?: ConstrainDouble;
+ autoGainControl?: ConstrainBoolean;
+ channelCount?: ConstrainULong;
+ deviceId?: ConstrainDOMString;
+ echoCancellation?: ConstrainBoolean;
+ facingMode?: ConstrainDOMString;
+ frameRate?: ConstrainDouble;
+ groupId?: ConstrainDOMString;
+ height?: ConstrainULong;
+ latency?: ConstrainDouble;
+ noiseSuppression?: ConstrainBoolean;
+ resizeMode?: ConstrainDOMString;
+ sampleRate?: ConstrainULong;
+ sampleSize?: ConstrainULong;
+ volume?: ConstrainDouble;
+ width?: ConstrainULong;
}
interface MediaTrackConstraints extends MediaTrackConstraintSet {
@@ -719,12 +734,17 @@
interface MediaTrackSettings {
aspectRatio?: number;
+ autoGainControl?: boolean;
+ channelCount?: number;
deviceId?: string;
echoCancellation?: boolean;
facingMode?: string;
frameRate?: number;
groupId?: string;
height?: number;
+ latency?: number;
+ noiseSuppression?: boolean;
+ resizeMode?: string;
sampleRate?: number;
sampleSize?: number;
volume?: number;
@@ -733,12 +753,17 @@
interface MediaTrackSupportedConstraints {
aspectRatio?: boolean;
+ autoGainControl?: boolean;
+ channelCount?: boolean;
deviceId?: boolean;
echoCancellation?: boolean;
facingMode?: boolean;
frameRate?: boolean;
groupId?: boolean;
height?: boolean;
+ latency?: boolean;
+ noiseSuppression?: boolean;
+ resizeMode?: boolean;
sampleRate?: boolean;
sampleSize?: boolean;
volume?: boolean;
@@ -753,6 +778,11 @@
source?: MessageEventSource | null;
}
+interface MidiPermissionDescriptor extends PermissionDescriptor {
+ name: "midi";
+ sysex?: boolean;
+}
+
interface MouseEventInit extends EventModifierInit {
button?: number;
buttons?: number;
@@ -765,6 +795,10 @@
screenY?: number;
}
+interface MultiCacheQueryOptions extends CacheQueryOptions {
+ cacheName?: string;
+}
+
interface MutationObserverInit {
attributeFilter?: string[];
attributeOldValue?: boolean;
@@ -914,7 +948,8 @@
interface PerformanceObserverInit {
buffered?: boolean;
- entryTypes: string[];
+ entryTypes?: string[];
+ type?: string;
}
interface PeriodicWaveConstraints {
@@ -926,10 +961,15 @@
real?: number[] | Float32Array;
}
+interface PermissionDescriptor {
+ name: PermissionName;
+}
+
interface PipeOptions {
preventAbort?: boolean;
preventCancel?: boolean;
preventClose?: boolean;
+ signal?: AbortSignal;
}
interface PointerEventInit extends MouseEventInit {
@@ -955,6 +995,10 @@
timeout?: number;
}
+interface PostMessageOptions {
+ transfer?: any[];
+}
+
interface ProgressEventInit extends EventInit {
lengthComputable?: boolean;
loaded?: number;
@@ -973,6 +1017,11 @@
[property: string]: string | string[] | number | null | (number | null)[] | undefined;
}
+interface PushPermissionDescriptor extends PermissionDescriptor {
+ name: "push";
+ userVisibleOnly?: boolean;
+}
+
interface PushSubscriptionJSON {
endpoint?: string;
expirationTime?: number | null;
@@ -1519,6 +1568,11 @@
ignoreBOM?: boolean;
}
+interface TextEncoderEncodeIntoResult {
+ read?: number;
+ written?: number;
+}
+
interface TouchEventInit extends EventModifierInit {
changedTouches?: Touch[];
targetTouches?: Touch[];
@@ -1566,6 +1620,11 @@
view?: Window | null;
}
+interface ULongRange {
+ max?: number;
+ min?: number;
+}
+
interface UnderlyingByteSource {
autoAllocateChunkSize?: number;
cancel?: ReadableStreamErrorCallback;
@@ -1650,6 +1709,8 @@
(evt: Event): void;
}
+type XPathNSResolver = ((prefix: string | null) => string | null) | { lookupNamespaceURI(prefix: string | null): string | null; };
+
/** The ANGLE_instanced_arrays extension is part of the WebGL API and allows to draw the same object, or groups of similar objects multiple times, if they share the same vertex data, primitive count and type. */
interface ANGLE_instanced_arrays {
drawArraysInstancedANGLE(mode: GLenum, first: GLint, count: GLsizei, primcount: GLsizei): void;
@@ -1658,7 +1719,7 @@
readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: GLenum;
}
-/** The AbortController interface represents a controller object that allows you to abort one or more DOM requests as and when desired. */
+/** A controller object that allows you to abort one or more DOM requests as and when desired. */
interface AbortController {
/**
* Returns the AbortSignal object associated with this object.
@@ -1680,7 +1741,7 @@
"abort": Event;
}
-/** The AbortSignal interface represents a signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */
+/** A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */
interface AbortSignal extends EventTarget {
/**
* Returns true if this AbortSignal's AbortController has signaled to abort, and false
@@ -1732,7 +1793,7 @@
length: number;
}
-/** The AnalyserNode interface represents a node able to provide real-time frequency and time-domain analysis information. It is an AudioNode that passes the audio stream unchanged from the input to the output, but allows you to take the generated data, process it, and create audio visualizations. */
+/** A node able to provide real-time frequency and time-domain analysis information. It is an AudioNode that passes the audio stream unchanged from the input to the output, but allows you to take the generated data, process it, and create audio visualizations. */
interface AnalyserNode extends AudioNode {
fftSize: number;
readonly frequencyBinCount: number;
@@ -1801,7 +1862,7 @@
new(): AnimationEffect;
};
-/** The AnimationEvent interface represents events providing information related to animations. */
+/** Events providing information related to animations. */
interface AnimationEvent extends Event {
readonly animationName: string;
readonly elapsedTime: number;
@@ -1891,7 +1952,7 @@
readonly UPDATEREADY: number;
};
-/** This type represents a DOM element's attribute as an object. In most DOM methods, you will probably directly retrieve the attribute as a string (e.g., Element.getAttribute(), but certain functions (e.g., Element.getAttributeNode()) or means of iterating give Attr types. */
+/** A DOM element's attribute as an object. In most DOM methods, you will probably directly retrieve the attribute as a string (e.g., Element.getAttribute(), but certain functions (e.g., Element.getAttributeNode()) or means of iterating give Attr types. */
interface Attr extends Node {
readonly localName: string;
readonly name: string;
@@ -1907,7 +1968,7 @@
new(): Attr;
};
-/** Objects of these types are designed to hold small audio snippets, typically less than 45 s. For longer sounds, objects implementing the MediaElementAudioSourceNode are more suitable. The buffer contains data in the following format:  non-interleaved IEEE754 32-bit linear PCM with a nominal range between -1 and +1, that is, 32bits floating point buffer, with each samples between -1.0 and 1.0. If the AudioBuffer has multiple channels, they are stored in separate buffer. */
+/** A short audio asset residing in memory, created from an audio file using the AudioContext.decodeAudioData() method, or from raw data using AudioContext.createBuffer(). Once put into an AudioBuffer, the audio can then be played by being passed into an AudioBufferSourceNode. */
interface AudioBuffer {
readonly duration: number;
readonly length: number;
@@ -1923,7 +1984,7 @@
new(options: AudioBufferOptions): AudioBuffer;
};
-/** The AudioBufferSourceNode interface is an AudioScheduledSourceNode which represents an audio source consisting of in-memory audio data, stored in an AudioBuffer. It's especially useful for playing back audio which has particularly stringent timing accuracy requirements, such as for sounds that must match a specific rhythm and can be kept in memory rather than being played from disk or the network. */
+/** An AudioScheduledSourceNode which represents an audio source consisting of in-memory audio data, stored in an AudioBuffer. It's especially useful for playing back audio which has particularly stringent timing accuracy requirements, such as for sounds that must match a specific rhythm and can be kept in memory rather than being played from disk or the network. */
interface AudioBufferSourceNode extends AudioScheduledSourceNode {
buffer: AudioBuffer | null;
readonly detune: AudioParam;
@@ -1943,7 +2004,7 @@
new(context: BaseAudioContext, options?: AudioBufferSourceOptions): AudioBufferSourceNode;
};
-/** The AudioContext interface represents an audio-processing graph built from audio modules linked together, each represented by an AudioNode. */
+/** An audio-processing graph built from audio modules linked together, each represented by an AudioNode. */
interface AudioContext extends BaseAudioContext {
readonly baseLatency: number;
readonly outputLatency: number;
@@ -1953,6 +2014,7 @@
createMediaStreamSource(mediaStream: MediaStream): MediaStreamAudioSourceNode;
createMediaStreamTrackSource(mediaStreamTrack: MediaStreamTrack): MediaStreamTrackAudioSourceNode;
getOutputTimestamp(): AudioTimestamp;
+ resume(): Promise<void>;
suspend(): Promise<void>;
addEventListener<K extends keyof BaseAudioContextEventMap>(type: K, listener: (this: AudioContext, ev: BaseAudioContextEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
@@ -1975,7 +2037,7 @@
new(): AudioDestinationNode;
};
-/** The AudioListener interface represents the position and orientation of the unique person listening to the audio scene, and is used in audio spatialization. All PannerNodes spatialize in relation to the AudioListener stored in the BaseAudioContext.listener attribute. */
+/** The position and orientation of the unique person listening to the audio scene, and is used in audio spatialization. All PannerNodes spatialize in relation to the AudioListener stored in the BaseAudioContext.listener attribute. */
interface AudioListener {
readonly forwardX: AudioParam;
readonly forwardY: AudioParam;
@@ -1997,7 +2059,7 @@
new(): AudioListener;
};
-/** The AudioNode interface is a generic interface for representing an audio processing module. Examples include: */
+/** A generic interface for representing an audio processing module. Examples include: */
interface AudioNode extends EventTarget {
channelCount: number;
channelCountMode: ChannelCountMode;
@@ -2051,7 +2113,7 @@
new(): AudioParamMap;
};
-/** The Web Audio API AudioProcessingEvent represents events that occur when a ScriptProcessorNode input buffer is ready to be processed. */
+/** The Web Audio API events that occur when a ScriptProcessorNode input buffer is ready to be processed. */
interface AudioProcessingEvent extends Event {
readonly inputBuffer: AudioBuffer;
readonly outputBuffer: AudioBuffer;
@@ -2082,7 +2144,7 @@
new(): AudioScheduledSourceNode;
};
-/** The AudioTrack interface represents a single audio track from one of the HTML media elements, <audio> or <video>. */
+/** A single audio track from one of the HTML media elements, <audio> or <video>. */
interface AudioTrack {
enabled: boolean;
readonly id: string;
@@ -2103,7 +2165,7 @@
"removetrack": TrackEvent;
}
-/** The AudioTrackList interface is used to represent a list of the audio tracks contained within a given HTML media element, with each track represented by a separate AudioTrack object in the list. */
+/** Used to represent a list of the audio tracks contained within a given HTML media element, with each track represented by a separate AudioTrack object in the list. */
interface AudioTrackList extends EventTarget {
readonly length: number;
onaddtrack: ((this: AudioTrackList, ev: TrackEvent) => any) | null;
@@ -2190,7 +2252,6 @@
createStereoPanner(): StereoPannerNode;
createWaveShaper(): WaveShaperNode;
decodeAudioData(audioData: ArrayBuffer, successCallback?: DecodeSuccessCallback | null, errorCallback?: DecodeErrorCallback | null): Promise<AudioBuffer>;
- resume(): Promise<void>;
addEventListener<K extends keyof BaseAudioContextEventMap>(type: K, listener: (this: BaseAudioContext, ev: BaseAudioContextEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof BaseAudioContextEventMap>(type: K, listener: (this: BaseAudioContext, ev: BaseAudioContextEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
@@ -2234,7 +2295,7 @@
new(): BhxBrowser;
};
-/** The BiquadFilterNode interface represents a simple low-order filter, and is created using the AudioContext.createBiquadFilter() method. It is an AudioNode that can represent different kinds of filters, tone control devices, and graphic equalizers. */
+/** A simple low-order filter, and is created using the AudioContext.createBiquadFilter() method. It is an AudioNode that can represent different kinds of filters, tone control devices, and graphic equalizers. */
interface BiquadFilterNode extends AudioNode {
readonly Q: AudioParam;
readonly detune: AudioParam;
@@ -2249,7 +2310,7 @@
new(context: BaseAudioContext, options?: BiquadFilterOptions): BiquadFilterNode;
};
-/** A Blob object represents a file-like object of immutable, raw data. Blobs represent data that isn't necessarily in a JavaScript-native format. The File interface is based on Blob, inheriting blob functionality and expanding it to support files on the user's system. */
+/** A file-like object of immutable, raw data. Blobs represent data that isn't necessarily in a JavaScript-native format. The File interface is based on Blob, inheriting blob functionality and expanding it to support files on the user's system. */
interface Blob {
readonly size: number;
readonly type: string;
@@ -2302,12 +2363,7 @@
new(name: string): BroadcastChannel;
};
-interface BroadcastChannelEventMap {
- message: MessageEvent;
- messageerror: MessageEvent;
-}
-
-/** The ByteLengthQueuingStrategy interface of the the Streams API provides a built-in byte length queuing strategy that can be used when constructing streams. */
+/** An interface of the Streams API provides a built-in byte length queuing strategy that can be used when constructing streams. */
interface ByteLengthQueuingStrategy extends QueuingStrategy<ArrayBufferView> {
highWaterMark: number;
size(chunk: ArrayBufferView): number;
@@ -2318,7 +2374,7 @@
new(options: { highWaterMark: number }): ByteLengthQueuingStrategy;
};
-/** The CDATASection interface represents a CDATA section that can be used within XML to include extended portions of unescaped text. The symbols < and & don’t need escaping as they normally do when inside a CDATA section. */
+/** A CDATA section that can be used within XML to include extended portions of unescaped text. The symbols < and & don’t need escaping as they normally do when inside a CDATA section. */
interface CDATASection extends Text {
}
@@ -2327,14 +2383,14 @@
new(): CDATASection;
};
-/** The CSS interface holds useful CSS-related methods. No object with this interface are implemented: it contains only static methods and therefore is a utilitarian interface. */
+/** Holds useful CSS-related methods. No object with this interface are implemented: it contains only static methods and therefore is a utilitarian interface. */
interface CSS {
escape(value: string): string;
supports(property: string, value?: string): boolean;
}
declare var CSS: CSS;
-/** An object implementing the CSSConditionRule interface represents a single condition CSS at-rule, which consists of a condition and a statement block. It is a child of CSSGroupingRule. */
+/** A single condition CSS at-rule, which consists of a condition and a statement block. It is a child of CSSGroupingRule. */
interface CSSConditionRule extends CSSGroupingRule {
conditionText: string;
}
@@ -2353,7 +2409,7 @@
new(): CSSFontFaceRule;
};
-/** An object implementing the CSSGroupingRule interface represents any CSS at-rule that contains other rules nested within it. */
+/** Any CSS at-rule that contains other rules nested within it. */
interface CSSGroupingRule extends CSSRule {
readonly cssRules: CSSRuleList;
deleteRule(index: number): void;
@@ -2376,7 +2432,7 @@
new(): CSSImportRule;
};
-/** The CSSKeyframeRule interface describes an object representing a set of style for a given keyframe. It corresponds to the contains of a single keyframe of a @keyframes at-rule. It implements the CSSRule interface with a type value of 8 (CSSRule.KEYFRAME_RULE). */
+/** An object representing a set of style for a given keyframe. It corresponds to the contains of a single keyframe of a @keyframes at-rule. It implements the CSSRule interface with a type value of 8 (CSSRule.KEYFRAME_RULE). */
interface CSSKeyframeRule extends CSSRule {
keyText: string;
readonly style: CSSStyleDeclaration;
@@ -2387,7 +2443,7 @@
new(): CSSKeyframeRule;
};
-/** The CSSKeyframesRule interface describes an object representing a complete set of keyframes for a CSS animation. It corresponds to the contains of a whole @keyframes at-rule. It implements the CSSRule interface with a type value of 7 (CSSRule.KEYFRAMES_RULE). */
+/** An object representing a complete set of keyframes for a CSS animation. It corresponds to the contains of a whole @keyframes at-rule. It implements the CSSRule interface with a type value of 7 (CSSRule.KEYFRAMES_RULE). */
interface CSSKeyframesRule extends CSSRule {
readonly cssRules: CSSRuleList;
name: string;
@@ -2401,7 +2457,7 @@
new(): CSSKeyframesRule;
};
-/** The CSSMediaRule is an interface representing a single CSS @media rule. It implements the CSSConditionRule interface, and therefore the CSSGroupingRule and the CSSRule interface with a type value of 4 (CSSRule.MEDIA_RULE). */
+/** A single CSS @media rule. It implements the CSSConditionRule interface, and therefore the CSSGroupingRule and the CSSRule interface with a type value of 4 (CSSRule.MEDIA_RULE). */
interface CSSMediaRule extends CSSConditionRule {
readonly media: MediaList;
}
@@ -2411,7 +2467,7 @@
new(): CSSMediaRule;
};
-/** The CSSNamespaceRule interface describes an object representing a single CSS @namespace at-rule. It implements the CSSRule interface, with a type value of 10 (CSSRule.NAMESPACE_RULE). */
+/** An object representing a single CSS @namespace at-rule. It implements the CSSRule interface, with a type value of 10 (CSSRule.NAMESPACE_RULE). */
interface CSSNamespaceRule extends CSSRule {
readonly namespaceURI: string;
readonly prefix: string;
@@ -2435,7 +2491,7 @@
new(): CSSPageRule;
};
-/** The CSSRule interface represents a single CSS rule. There are several types of rules, listed in the Type constants section below. */
+/** A single CSS rule. There are several types of rules, listed in the Type constants section below. */
interface CSSRule {
cssText: string;
readonly parentRule: CSSRule | null;
@@ -2484,7 +2540,7 @@
new(): CSSRuleList;
};
-/** The CSSStyleDeclaration API represents an object that is a CSS declaration block, that exposes style information and various style-related methods and properties. */
+/** An object that is a CSS declaration block, and exposes style information and various style-related methods and properties. */
interface CSSStyleDeclaration {
alignContent: string | null;
alignItems: string | null;
@@ -2547,33 +2603,34 @@
borderWidth: string | null;
bottom: string | null;
boxShadow: string | null;
- boxSizing: string | null;
+ boxSizing: string;
breakAfter: string | null;
breakBefore: string | null;
breakInside: string | null;
captionSide: string | null;
+ caretColor: string;
clear: string | null;
clip: string | null;
clipPath: string | null;
clipRule: string | null;
color: string | null;
colorInterpolationFilters: string | null;
- columnCount: any;
- columnFill: string | null;
- columnGap: any;
- columnRule: string | null;
- columnRuleColor: any;
- columnRuleStyle: string | null;
- columnRuleWidth: any;
- columnSpan: string | null;
- columnWidth: any;
- columns: string | null;
+ columnCount: string;
+ columnFill: string;
+ columnGap: string;
+ columnRule: string;
+ columnRuleColor: string;
+ columnRuleStyle: string;
+ columnRuleWidth: string;
+ columnSpan: string;
+ columnWidth: string;
+ columns: string;
content: string | null;
counterIncrement: string | null;
counterReset: string | null;
cssFloat: string | null;
cssText: string;
- cursor: string | null;
+ cursor: string;
direction: string | null;
display: string | null;
dominantBaseline: string | null;
@@ -2623,6 +2680,8 @@
gridTemplateColumns: string | null;
gridTemplateRows: string | null;
height: string | null;
+ imageOrientation: string;
+ imageRendering: string;
imeMode: string | null;
justifyContent: string | null;
justifyItems: string | null;
@@ -2705,16 +2764,16 @@
msWrapFlow: string;
msWrapMargin: any;
msWrapThrough: string;
- objectFit: string | null;
- objectPosition: string | null;
+ objectFit: string;
+ objectPosition: string;
opacity: string | null;
order: string | null;
orphans: string | null;
- outline: string | null;
- outlineColor: string | null;
- outlineOffset: string | null;
- outlineStyle: string | null;
- outlineWidth: string | null;
+ outline: string;
+ outlineColor: string;
+ outlineOffset: string;
+ outlineStyle: string;
+ outlineWidth: string;
overflow: string | null;
overflowX: string | null;
overflowY: string | null;
@@ -2762,7 +2821,7 @@
textJustify: string | null;
textKashida: string | null;
textKashidaSpace: string | null;
- textOverflow: string | null;
+ textOverflow: string;
textShadow: string | null;
textTransform: string | null;
textUnderlinePosition: string | null;
@@ -2937,6 +2996,7 @@
whiteSpace: string | null;
widows: string | null;
width: string | null;
+ willChange: string;
wordBreak: string | null;
wordSpacing: string | null;
wordWrap: string | null;
@@ -2967,7 +3027,7 @@
new(): CSSStyleRule;
};
-/** The CSSStyleSheet interface represents a single CSS style sheet. It inherits properties and methods from its parent, StyleSheet. */
+/** A single CSS style sheet. It inherits properties and methods from its parent, StyleSheet. */
interface CSSStyleSheet extends StyleSheet {
readonly cssRules: CSSRuleList;
/** @deprecated */
@@ -3005,7 +3065,7 @@
new(): CSSStyleSheet;
};
-/** The CSSSupportsRule interface describes an object representing a single CSS @supports at-rule. It implements the CSSConditionRule interface, and therefore the CSSRule and CSSGroupingRule interfaces with a type value of 12 (CSSRule.SUPPORTS_RULE). */
+/** An object representing a single CSS @supports at-rule. It implements the CSSConditionRule interface, and therefore the CSSRule and CSSGroupingRule interfaces with a type value of 12 (CSSRule.SUPPORTS_RULE). */
interface CSSSupportsRule extends CSSConditionRule {
}
@@ -3014,7 +3074,7 @@
new(): CSSSupportsRule;
};
-/** The Cache interface provides a storage mechanism for Request / Response object pairs that are cached, for example as part of the ServiceWorker life cycle. Note that the Cache interface is exposed to windowed scopes as well as workers. You don't have to use it in conjunction with service workers, even though it is defined in the service worker spec. */
+/** Provides a storage mechanism for Request / Response object pairs that are cached, for example as part of the ServiceWorker life cycle. Note that the Cache interface is exposed to windowed scopes as well as workers. You don't have to use it in conjunction with service workers, even though it is defined in the service worker spec. */
interface Cache {
add(request: RequestInfo): Promise<void>;
addAll(requests: RequestInfo[]): Promise<void>;
@@ -3030,7 +3090,7 @@
new(): Cache;
};
-/** The CacheStorage interface represents the storage for Cache objects. */
+/** The storage for Cache objects. */
interface CacheStorage {
delete(cacheName: string): Promise<boolean>;
has(cacheName: string): Promise<boolean>;
@@ -3081,7 +3141,7 @@
filter: string;
}
-/** The CanvasGradient interface represents an opaque object describing a gradient. It is returned by the methods CanvasRenderingContext2D.createLinearGradient() or CanvasRenderingContext2D.createRadialGradient(). */
+/** An opaque object describing a gradient. It is returned by the methods CanvasRenderingContext2D.createLinearGradient() or CanvasRenderingContext2D.createRadialGradient(). */
interface CanvasGradient {
/**
* Adds a color stop with the given color to the gradient at the given offset. 0.0 is the offset
@@ -3133,7 +3193,7 @@
setLineDash(segments: number[]): void;
}
-/** The CanvasPattern interface represents an opaque object describing a pattern, based on an image, a canvas, or a video, created by the CanvasRenderingContext2D.createPattern() method. */
+/** An opaque object describing a pattern, based on an image, a canvas, or a video, created by the CanvasRenderingContext2D.createPattern() method. */
interface CanvasPattern {
/**
* Sets the transformation matrix that will be used when rendering the pattern during a fill or
@@ -3311,7 +3371,7 @@
new(): Clipboard;
};
-/** The ClipboardEvent interface represents events providing information related to modification of the clipboard, that is cut, copy, and paste events. */
+/** Events providing information related to modification of the clipboard, that is cut, copy, and paste events. */
interface ClipboardEvent extends Event {
readonly clipboardData: DataTransfer | null;
}
@@ -3335,7 +3395,7 @@
new(type: string, eventInitDict?: CloseEventInit): CloseEvent;
};
-/** The Comment interface represents textual notations within markup; although it is generally not visually shown, such comments are available to be read in the source view. Comments are represented in HTML and XML as content between '<!--' and '-->'. In XML, the character sequence '--' cannot be used within a comment. */
+/** Textual notations within markup; although it is generally not visually shown, such comments are available to be read in the source view. */
interface Comment extends CharacterData {
}
@@ -3365,7 +3425,7 @@
publicInfo?: Uint8Array;
}
-/** The Console object provides access to the browser's debugging console (e.g. the Web Console in Firefox). The specifics of how it works varies from browser to browser, but there is a de facto set of features that are typically provided. */
+/** Provides access to the browser's debugging console (e.g. the Web Console in Firefox). The specifics of how it works varies from browser to browser, but there is a de facto set of features that are typically provided. */
interface Console {
memory: any;
assert(condition?: boolean, message?: string, ...data: any[]): void;
@@ -3412,7 +3472,7 @@
new(context: BaseAudioContext, options?: ConstantSourceOptions): ConstantSourceNode;
};
-/** The ConvolverNode interface is 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. */
+/** 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. */
interface ConvolverNode extends AudioNode {
buffer: AudioBuffer | null;
normalize: boolean;
@@ -3423,7 +3483,7 @@
new(context: BaseAudioContext, options?: ConvolverOptions): ConvolverNode;
};
-/** The Coordinates interface represents the position and altitude of the device on Earth, as well as the accuracy with which these properties are calculated. */
+/** The position and altitude of the device on Earth, as well as the accuracy with which these properties are calculated. */
interface Coordinates {
readonly accuracy: number;
readonly altitude: number | null;
@@ -3434,7 +3494,7 @@
readonly speed: number | null;
}
-/** The CountQueuingStrategy interface of the the Streams API provides a built-in byte length queuing strategy that can be used when constructing streams. */
+/** An interface of the Streams API provides a built-in byte length queuing strategy that can be used when constructing streams. */
interface CountQueuingStrategy extends QueuingStrategy {
highWaterMark: number;
size(chunk: any): 1;
@@ -3445,7 +3505,7 @@
new(options: { highWaterMark: number }): CountQueuingStrategy;
};
-/** The Crypto interface represents basic cryptography features available in the current context. It allows access to a cryptographically strong random number generator and to cryptographic primitives. */
+/** Basic cryptography features available in the current context. It allows access to a cryptographically strong random number generator and to cryptographic primitives. */
interface Crypto {
readonly subtle: SubtleCrypto;
getRandomValues<T extends Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | null>(array: T): T;
@@ -3456,7 +3516,7 @@
new(): Crypto;
};
-/** The CryptoKey interface represents a cryptographic key derived from a specific key algorithm. */
+/** The CryptoKey dictionary of the Web Crypto API represents a cryptographic key. */
interface CryptoKey {
readonly algorithm: KeyAlgorithm;
readonly extractable: boolean;
@@ -3469,6 +3529,7 @@
new(): CryptoKey;
};
+/** The CryptoKeyPair dictionary of the Web Crypto API represents a key pair for an asymmetric cryptography algorithm, also known as a public-key algorithm. */
interface CryptoKeyPair {
privateKey: CryptoKey;
publicKey: CryptoKey;
@@ -3505,7 +3566,7 @@
new<T>(typeArg: string, eventInitDict?: CustomEventInit<T>): CustomEvent<T>;
};
-/** The DOMError interface describes an error object that contains an error name. */
+/** An error object that contains an error name. */
interface DOMError {
readonly name: string;
toString(): string;
@@ -3516,7 +3577,7 @@
new(): DOMError;
};
-/** The DOMException interface represents an abnormal event (called an exception) which occurs as a result of calling a method or accessing a property of a web API. */
+/** An abnormal event (called an exception) which occurs as a result of calling a method or accessing a property of a web API. */
interface DOMException {
readonly code: number;
readonly message: string;
@@ -3578,7 +3639,7 @@
readonly WRONG_DOCUMENT_ERR: number;
};
-/** The DOMImplementation interface represent an object providing methods which are not dependent on any particular document. Such an object is returned by the Document.implementation property. */
+/** An object providing methods which are not dependent on any particular document. Such an object is returned by the Document.implementation property. */
interface DOMImplementation {
createDocument(namespaceURI: string | null, qualifiedName: string | null, doctype: DocumentType | null): Document;
createDocumentType(qualifiedName: string, publicId: string, systemId: string): DocumentType;
@@ -3700,7 +3761,7 @@
fromMatrix(other?: DOMMatrixInit): DOMMatrixReadOnly;
};
-/** The DOMParser interface provides the ability to parse XML or HTML source code from a string into a DOM Document. */
+/** Provides the ability to parse XML or HTML source code from a string into a DOM Document. */
interface DOMParser {
parseFromString(str: string, type: SupportedType): Document;
}
@@ -3844,7 +3905,7 @@
new(): DOMStringMap;
};
-/** The DOMTokenList interface represents a set of space-separated tokens. Such a set is returned by Element.classList, HTMLLinkElement.relList, HTMLAnchorElement.relList, HTMLAreaElement.relList, HTMLIframeElement.sandbox, or HTMLOutputElement.htmlFor. It is indexed beginning with 0 as with JavaScript Array objects. DOMTokenList is always case-sensitive. */
+/** A set of space-separated tokens. Such a set is returned by Element.classList, HTMLLinkElement.relList, HTMLAnchorElement.relList, HTMLAreaElement.relList, HTMLIframeElement.sandbox, or HTMLOutputElement.htmlFor. It is indexed beginning with 0 as with JavaScript Array objects. DOMTokenList is always case-sensitive. */
interface DOMTokenList {
/**
* Returns the number of tokens.
@@ -3917,7 +3978,7 @@
new(): DataCue;
};
-/** The DataTransfer object is used to hold the data that is being dragged during a drag and drop operation. It may hold one or more data items, each of one or more data types. For more information about drag and drop, see HTML Drag and Drop API. */
+/** Used to hold the data that is being dragged during a drag and drop operation. It may hold one or more data items, each of one or more data types. For more information about drag and drop, see HTML Drag and Drop API. */
interface DataTransfer {
dropEffect: string;
effectAllowed: string;
@@ -3958,7 +4019,7 @@
new(): DataTransfer;
};
-/** The DataTransferItem object represents one drag data item. During a drag operation, each drag event has a dataTransfer property which contains a list of drag data items. Each item in the list is a DataTransferItem object. */
+/** One drag data item. During a drag operation, each drag event has a dataTransfer property which contains a list of drag data items. Each item in the list is a DataTransferItem object. */
interface DataTransferItem {
/**
* Returns the drag data item kind, one of: "string",
@@ -3986,7 +4047,7 @@
new(): DataTransferItem;
};
-/** The DataTransferItemList object is a list of DataTransferItem objects representing items being dragged. During a drag operation, each DragEvent has a dataTransfer property and that property is a DataTransferItemList. */
+/** A list of DataTransferItem objects representing items being dragged. During a drag operation, each DragEvent has a dataTransfer property and that property is a DataTransferItemList. */
interface DataTransferItemList {
/**
* Returns the number of items in the drag data store.
@@ -4029,7 +4090,7 @@
new(): DeferredPermissionRequest;
};
-/** The DelayNode interface represents a delay-line; an AudioNode audio-processing module that causes a delay between the arrival of an input data and its propagation to the output. */
+/** A delay-line; an AudioNode audio-processing module that causes a delay between the arrival of an input data and its propagation to the output. */
interface DelayNode extends AudioNode {
readonly delayTime: AudioParam;
}
@@ -4039,7 +4100,7 @@
new(context: BaseAudioContext, options?: DelayOptions): DelayNode;
};
-/** A DeviceAcceleration object provides information about the amount of acceleration the device is experiencing along all three axes. */
+/** Provides information about the amount of acceleration the device is experiencing along all three axes. */
interface DeviceAcceleration {
readonly x: number | null;
readonly y: number | null;
@@ -4063,33 +4124,43 @@
/** The DeviceMotionEvent provides web developers with information about the speed of changes for the device's position and orientation. */
interface DeviceMotionEvent extends Event {
- readonly acceleration: DeviceAcceleration | null;
- readonly accelerationIncludingGravity: DeviceAcceleration | null;
- readonly interval: number | null;
- readonly rotationRate: DeviceRotationRate | null;
- initDeviceMotionEvent(type: string, bubbles: boolean, cancelable: boolean, acceleration: DeviceAccelerationDict | null, accelerationIncludingGravity: DeviceAccelerationDict | null, rotationRate: DeviceRotationRateDict | null, interval: number | null): void;
+ readonly acceleration: DeviceMotionEventAcceleration | null;
+ readonly accelerationIncludingGravity: DeviceMotionEventAcceleration | null;
+ readonly interval: number;
+ readonly rotationRate: DeviceMotionEventRotationRate | null;
}
declare var DeviceMotionEvent: {
prototype: DeviceMotionEvent;
- new(typeArg: string, eventInitDict?: DeviceMotionEventInit): DeviceMotionEvent;
+ new(type: string, eventInitDict?: DeviceMotionEventInit): DeviceMotionEvent;
};
+interface DeviceMotionEventAcceleration {
+ readonly x: number | null;
+ readonly y: number | null;
+ readonly z: number | null;
+}
+
+interface DeviceMotionEventRotationRate {
+ readonly alpha: number | null;
+ readonly beta: number | null;
+ readonly gamma: number | null;
+}
+
/** The DeviceOrientationEvent provides web developers with information from the physical orientation of the device running the web page. */
interface DeviceOrientationEvent extends Event {
readonly absolute: boolean;
readonly alpha: number | null;
readonly beta: number | null;
readonly gamma: number | null;
- initDeviceOrientationEvent(type: string, bubbles: boolean, cancelable: boolean, alpha: number | null, beta: number | null, gamma: number | null, absolute: boolean): void;
}
declare var DeviceOrientationEvent: {
prototype: DeviceOrientationEvent;
- new(typeArg: string, eventInitDict?: DeviceOrientationEventInit): DeviceOrientationEvent;
+ new(type: string, eventInitDict?: DeviceOrientationEventInit): DeviceOrientationEvent;
};
-/** A DeviceRotationRate object provides information about the rate at which the device is rotating around all three axes. */
+/** Provides information about the rate at which the device is rotating around all three axes. */
interface DeviceRotationRate {
readonly alpha: number | null;
readonly beta: number | null;
@@ -4129,8 +4200,8 @@
"visibilitychange": Event;
}
-/** The Document interface represents any web page loaded in the browser and serves as an entry point into the web page's content, which is the DOM tree. */
-interface Document extends Node, NonElementParentNode, DocumentOrShadowRoot, ParentNode, GlobalEventHandlers, DocumentAndElementEventHandlers {
+/** Any web page loaded in the browser and serves as an entry point into the web page's content, which is the DOM tree. */
+interface Document extends Node, NonElementParentNode, DocumentOrShadowRoot, ParentNode, XPathEvaluatorBase, GlobalEventHandlers, DocumentAndElementEventHandlers {
/**
* Sets or gets the URL for the current document.
*/
@@ -4386,10 +4457,6 @@
*/
createElementNS(namespaceURI: "http://www.w3.org/1999/xhtml", qualifiedName: string): HTMLElement;
createElementNS<K extends keyof SVGElementTagNameMap>(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: K): SVGElementTagNameMap[K];
- createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "a"): SVGAElement;
- createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "script"): SVGScriptElement;
- createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "style"): SVGStyleElement;
- createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: "title"): SVGTitleElement;
createElementNS(namespaceURI: "http://www.w3.org/2000/svg", qualifiedName: string): SVGElement;
createElementNS(namespaceURI: string | null, qualifiedName: string, options?: ElementCreationOptions): Element;
createElementNS(namespace: string | null, qualifiedName: string, options?: string | ElementCreationOptions): Element;
@@ -4515,7 +4582,6 @@
*/
elementFromPoint(x: number, y: number): Element | null;
elementsFromPoint(x: number, y: number): Element[];
- evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver | ((prefix: string) => string | null) | null, type: number, result: XPathResult | null): XPathResult;
/**
* Executes a command on the current document, current selection, or the given range.
* @param commandId String that specifies the command to execute. This command can be any of the command identifiers that can be executed in script.
@@ -4728,7 +4794,7 @@
createEvent(eventInterface: string): Event;
}
-/** The DocumentFragment interface represents a minimal document object that has no parent. It is used as a lightweight version of Document that stores a segment of a document structure comprised of nodes just like a standard document. The key difference is that because the document fragment isn't part of the active document tree structure, changes made to the fragment don't affect the document, cause reflow, or incur any performance impact that can occur when changes are made. */
+/** A minimal document object that has no parent. It is used as a lightweight version of Document that stores a segment of a document structure comprised of nodes just like a standard document. The key difference is that because the document fragment isn't part of the active document tree structure, changes made to the fragment don't affect the document, cause reflow, or incur any performance impact that can occur when changes are made. */
interface DocumentFragment extends Node, NonElementParentNode, ParentNode {
getElementById(elementId: string): HTMLElement | null;
}
@@ -4762,7 +4828,7 @@
new(options?: DocumentTimelineOptions): DocumentTimeline;
};
-/** The DocumentType interface represents a Node containing a doctype. */
+/** A Node containing a doctype. */
interface DocumentType extends Node, ChildNode {
readonly name: string;
readonly publicId: string;
@@ -4774,7 +4840,7 @@
new(): DocumentType;
};
-/** The DragEvent interface is a DOM event that represents a drag and drop interaction. The user initiates a drag by placing a pointer device (such as a mouse) on the touch surface and then dragging the pointer to a new location (such as another DOM element). Applications are free to interpret a drag and drop interaction in an application-specific way. */
+/** A DOM event that represents a drag and drop interaction. The user initiates a drag by placing a pointer device (such as a mouse) on the touch surface and then dragging the pointer to a new location (such as another DOM element). Applications are free to interpret a drag and drop interaction in an application-specific way. */
interface DragEvent extends MouseEvent {
/**
* Returns the DataTransfer object for the event.
@@ -4833,7 +4899,7 @@
}
/** Element is the most general base class from which all objects in a Document inherit. It only has methods and properties common to all kinds of elements. More specific classes inherit from Element. */
-interface Element extends Node, ParentNode, NonDocumentTypeChildNode, ChildNode, Slotable, Animatable {
+interface Element extends Node, ParentNode, NonDocumentTypeChildNode, ChildNode, Slotable, InnerHTML, Animatable {
readonly assignedSlot: HTMLSlotElement | null;
readonly attributes: NamedNodeMap;
/**
@@ -4855,7 +4921,6 @@
* change it.
*/
id: string;
- innerHTML: string;
/**
* Returns the local name.
*/
@@ -5010,11 +5075,7 @@
readonly isContentEditable: boolean;
}
-interface ElementCreationOptions {
- is?: string;
-}
-
-/** The ErrorEvent interface represents events providing information related to errors in scripts or in files. */
+/** Events providing information related to errors in scripts or in files. */
interface ErrorEvent extends Event {
readonly colno: number;
readonly error: any;
@@ -5028,7 +5089,7 @@
new(type: string, eventInitDict?: ErrorEventInit): ErrorEvent;
};
-/** The Event interface represents any event which takes place in the DOM; some are user-generated (such as mouse or keyboard events), while others are generated by APIs (such as events that indicate an animation has finished running, a video has been paused, and so forth). While events are usually triggered by such "external" sources, they can also be triggered programmatically, such as by calling the HTMLElement.click() method of an element, or by defining the event, then sending it to a specified target using EventTarget.dispatchEvent(). There are many types of events, some of which use other interfaces based on the main Event interface. Event itself contains the properties and methods which are common to all events. */
+/** An event which takes place in the DOM. */
interface Event {
/**
* Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise.
@@ -5145,7 +5206,7 @@
readonly OPEN: number;
};
-/** EventTarget is an interface implemented by objects that can receive events and may have listeners for them. */
+/** EventTarget is a DOM interface implemented by objects that can receive events and may have listeners for them. */
interface EventTarget {
/**
* Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
@@ -5198,7 +5259,7 @@
IsSearchProviderInstalled(): void;
}
-/** The File interface provides information about files and allows JavaScript in a web page to access their content. */
+/** Provides information about files and allows JavaScript in a web page to access their content. */
interface File extends Blob {
readonly lastModified: number;
readonly name: string;
@@ -5230,7 +5291,7 @@
"progress": ProgressEvent;
}
-/** The FileReader object lets web applications asynchronously read the contents of files (or raw data buffers) stored on the user's computer, using File or Blob objects to specify the file or data to read. */
+/** Lets web applications asynchronously read the contents of files (or raw data buffers) stored on the user's computer, using File or Blob objects to specify the file or data to read. */
interface FileReader extends EventTarget {
readonly error: DOMException | null;
onabort: ((this: FileReader, ev: ProgressEvent) => any) | null;
@@ -5263,7 +5324,7 @@
readonly LOADING: number;
};
-/** The FocusEvent interface represents focus-related events like focus, blur, focusin, or focusout. */
+/** Focus-related events like focus, blur, focusin, or focusout. */
interface FocusEvent extends UIEvent {
readonly relatedTarget: EventTarget;
initFocusEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, detailArg: number, relatedTargetArg: EventTarget): void;
@@ -5288,7 +5349,7 @@
new(type: string, eventInitDict?: FocusNavigationEventInit): FocusNavigationEvent;
};
-/** The FormData interface provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using the XMLHttpRequest.send() method. It uses the same format a form would use if the encoding type were set to "multipart/form-data". */
+/** Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using the XMLHttpRequest.send() method. It uses the same format a form would use if the encoding type were set to "multipart/form-data". */
interface FormData {
append(name: string, value: string | Blob, fileName?: string): void;
delete(name: string): void;
@@ -5304,7 +5365,7 @@
new(form?: HTMLFormElement): FormData;
};
-/** The GainNode interface represents a change in volume. It is an AudioNode audio-processing module that causes a given gain to be applied to the input data before its propagation to the output. A GainNode always has exactly one input and one output, both with the same number of channels. */
+/** A change in volume. It is an AudioNode audio-processing module that causes a given gain to be applied to the input data before its propagation to the output. A GainNode always has exactly one input and one output, both with the same number of channels. */
interface GainNode extends AudioNode {
readonly gain: AudioParam;
}
@@ -5314,7 +5375,7 @@
new(context: BaseAudioContext, options?: GainOptions): GainNode;
};
-/** The Gamepad interface of the Gamepad API defines an individual gamepad or other controller, allowing access to information such as button presses, axis positions, and id. */
+/** An interface of the Gamepad API defines an individual gamepad or other controller, allowing access to information such as button presses, axis positions, and id. */
interface Gamepad {
readonly axes: ReadonlyArray<number>;
readonly buttons: ReadonlyArray<GamepadButton>;
@@ -5333,7 +5394,7 @@
new(): Gamepad;
};
-/** The GamepadButton interface defines 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. */
+/** 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. */
interface GamepadButton {
readonly pressed: boolean;
readonly touched: boolean;
@@ -5345,7 +5406,7 @@
new(): GamepadButton;
};
-/** The GamepadEvent interface of the Gamepad API contains references to gamepads connected to the system, which is what the gamepad events Window.gamepadconnected and Window.gamepaddisconnected are fired in response to. */
+/** An interface of the Gamepad API contains references to gamepads connected to the system, which is what the gamepad events Window.gamepadconnected and Window.gamepaddisconnected are fired in response to. */
interface GamepadEvent extends Event {
readonly gamepad: Gamepad;
}
@@ -5355,7 +5416,7 @@
new(type: string, eventInitDict: GamepadEventInit): GamepadEvent;
};
-/** The GamepadHapticActuator interface of the Gamepad API represents hardware in the controller designed to provide haptic feedback to the user (if available), most commonly vibration hardware. */
+/** An interface of the Gamepad API represents hardware in the controller designed to provide haptic feedback to the user (if available), most commonly vibration hardware. */
interface GamepadHapticActuator {
readonly type: GamepadHapticActuatorType;
pulse(value: number, duration: number): Promise<boolean>;
@@ -5366,7 +5427,7 @@
new(): GamepadHapticActuator;
};
-/** The GamepadPose interface of the Gamepad API represents the pose of a WebVR controller at a given timestamp (which includes orientation, position, velocity, and acceleration information.) */
+/** An interface of the Gamepad API represents the pose of a WebVR controller at a given timestamp (which includes orientation, position, velocity, and acceleration information.) */
interface GamepadPose {
readonly angularAcceleration: Float32Array | null;
readonly angularVelocity: Float32Array | null;
@@ -5383,7 +5444,19 @@
new(): GamepadPose;
};
-/** The Geolocation interface represents an object able to programmatically obtain the position of the device. It gives Web content access to the location of the device. This allows a Web site or app to offer customized results based on the user's location. */
+interface GenericTransformStream {
+ readonly readable: ReadableStream;
+ /**
+ * Returns a writable stream which accepts string chunks and runs them through UTF-8's encoder before making them available to readable.
+ * Typically this will be used via the pipeThrough() method on a ReadableStream source.
+ * textReadable
+ * .pipeThrough(new TextEncoderStream())
+ * .pipeTo(byteWritable);
+ */
+ readonly writable: WritableStream;
+}
+
+/** An object able to programmatically obtain the position of the device. It gives Web content access to the location of the device. This allows a Web site or app to offer customized results based on the user's location. */
interface Geolocation {
clearWatch(watchId: number): void;
getCurrentPosition(successCallback: PositionCallback, errorCallback?: PositionErrorCallback, options?: PositionOptions): void;
@@ -5396,7 +5469,7 @@
"animationend": AnimationEvent;
"animationiteration": AnimationEvent;
"animationstart": AnimationEvent;
- "auxclick": Event;
+ "auxclick": MouseEvent;
"blur": FocusEvent;
"cancel": Event;
"canplay": Event;
@@ -5489,7 +5562,7 @@
onanimationend: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
onanimationiteration: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
onanimationstart: ((this: GlobalEventHandlers, ev: AnimationEvent) => any) | null;
- onauxclick: ((this: GlobalEventHandlers, ev: Event) => any) | null;
+ onauxclick: ((this: GlobalEventHandlers, ev: MouseEvent) => any) | null;
/**
* Fires when the object loses the input focus.
* @param ev The focus event.
@@ -5777,7 +5850,7 @@
new(): HTMLAllCollection;
};
-/** The HTMLAnchorElement interface represents hyperlink elements and provides special properties and methods (beyond those of the regular HTMLElement object interface that they inherit from) for manipulating the layout and presentation of such elements. */
+/** Hyperlink elements and provides special properties and methods (beyond those of the regular HTMLElement object interface that they inherit from) for manipulating the layout and presentation of such elements. */
interface HTMLAnchorElement extends HTMLElement, HTMLHyperlinkElementUtils {
/**
* Sets or retrieves the character set used to encode the object.
@@ -5886,7 +5959,7 @@
new(): HTMLAppletElement;
};
-/** The HTMLAreaElement interface provides special properties and methods (beyond those of the regular object HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of area elements. */
+/** Provides special properties and methods (beyond those of the regular object HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of <area> elements. */
interface HTMLAreaElement extends HTMLElement, HTMLHyperlinkElementUtils {
/**
* Sets or retrieves a text alternative to the graphic.
@@ -5925,7 +5998,7 @@
new(): HTMLAreaElement;
};
-/** The HTMLAudioElement interface provides access to the properties of <audio> elements, as well as methods to manipulate them. It derives from the HTMLMediaElement interface. */
+/** Provides access to the properties of <audio> elements, as well as methods to manipulate them. It derives from the HTMLMediaElement interface. */
interface HTMLAudioElement extends HTMLMediaElement {
addEventListener<K extends keyof HTMLMediaElementEventMap>(type: K, listener: (this: HTMLAudioElement, ev: HTMLMediaElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
@@ -5938,7 +6011,7 @@
new(): HTMLAudioElement;
};
-/** The HTMLBRElement interface represents a HTML line break element (<br>). It inherits from HTMLElement. */
+/** A HTML line break element (<br>). It inherits from HTMLElement. */
interface HTMLBRElement extends HTMLElement {
/**
* Sets or retrieves the side on which floating objects are not to be positioned when any IHTMLBlockElement is inserted into the document.
@@ -5956,7 +6029,7 @@
new(): HTMLBRElement;
};
-/** The HTMLBaseElement interface contains the base URI for a document. This object inherits all of the properties and methods as described in the HTMLElement interface. */
+/** Contains the base URI for a document. This object inherits all of the properties and methods as described in the HTMLElement interface. */
interface HTMLBaseElement extends HTMLElement {
/**
* Gets or sets the baseline URL on which relative links are based.
@@ -5977,7 +6050,7 @@
new(): HTMLBaseElement;
};
-/** The HTMLBaseFontElement interface provides special properties (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating <basefont> elements. */
+/** Provides special properties (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating <basefont> elements. */
interface HTMLBaseFontElement extends HTMLElement, DOML2DeprecatedColorProperty {
/**
* Sets or retrieves the current typeface family.
@@ -6004,7 +6077,7 @@
"orientationchange": Event;
}
-/** The HTMLBodyElement interface provides special properties (beyond those of the regular HTMLElement interface they also inherit) for manipulating body elements. */
+/** Provides special properties (beyond those inherited from the regular HTMLElement interface) for manipulating <body> elements. */
interface HTMLBodyElement extends HTMLElement, WindowEventHandlers {
/** @deprecated */
aLink: string;
@@ -6034,7 +6107,7 @@
new(): HTMLBodyElement;
};
-/** The HTMLButtonElement interface provides properties and methods (beyond the <button> object interface it also has available to them by inheritance) for manipulating the layout and presentation of button elements. */
+/** Provides properties and methods (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating <button> elements. */
interface HTMLButtonElement extends HTMLElement {
/**
* Provides a way to direct a user to a specific field when a document loads. This can provide both direction and convenience for a user, reducing the need to click or tab to a field when a page opens. This attribute is true when present on an element, and false when missing.
@@ -6111,7 +6184,7 @@
new(): HTMLButtonElement;
};
-/** The HTMLCanvasElement interface provides properties and methods for manipulating the layout and presentation of <canvas> elements. The HTMLCanvasElement interface also inherits the properties and methods of the HTMLElement interface. */
+/** Provides properties and methods for manipulating the layout and presentation of <canvas> elements. The HTMLCanvasElement interface also inherits the properties and methods of the HTMLElement interface. */
interface HTMLCanvasElement extends HTMLElement {
/**
* Gets or sets the height of a canvas element on a document.
@@ -6134,6 +6207,7 @@
* @param type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image.
*/
toDataURL(type?: string, quality?: any): string;
+ transferControlToOffscreen(): OffscreenCanvas;
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLCanvasElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLCanvasElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
@@ -6145,7 +6219,7 @@
new(): HTMLCanvasElement;
};
-/** The HTMLCollection interface represents a generic collection (array-like object similar to arguments) of elements (in document order) and offers methods and properties for selecting from the list. */
+/** A generic collection (array-like object similar to arguments) of elements (in document order) and offers methods and properties for selecting from the list. */
interface HTMLCollectionBase {
/**
* Sets or retrieves the number of objects in a collection.
@@ -6176,7 +6250,7 @@
[index: number]: T;
}
-/** The HTMLDListElement interface provides special properties (beyond those of the regular HTMLElement interface it also has available to it by inheritance) for manipulating definition list elements. */
+/** Provides special properties (beyond those of the regular HTMLElement interface it also has available to it by inheritance) for manipulating definition list (<dl>) elements. */
interface HTMLDListElement extends HTMLElement {
/** @deprecated */
compact: boolean;
@@ -6191,7 +6265,7 @@
new(): HTMLDListElement;
};
-/** The HTMLDataElement interface provides special properties (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating <data> elements. */
+/** Provides special properties (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating <data> elements. */
interface HTMLDataElement extends HTMLElement {
value: string;
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLDataElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
@@ -6205,7 +6279,7 @@
new(): HTMLDataElement;
};
-/** The HTMLDataListElement interface provides special properties (beyond the HTMLElement object interface it also has available to it by inheritance) to manipulate <datalist> elements and their content. */
+/** Provides special properties (beyond the HTMLElement object interface it also has available to it by inheritance) to manipulate <datalist> elements and their content. */
interface HTMLDataListElement extends HTMLElement {
readonly options: HTMLCollectionOf<HTMLOptionElement>;
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLDataListElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
@@ -6263,7 +6337,7 @@
new(): HTMLDirectoryElement;
};
-/** The HTMLDivElement interface provides special properties (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating <div> elements. */
+/** Provides special properties (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating <div> elements. */
interface HTMLDivElement extends HTMLElement {
/**
* Sets or retrieves how the object is aligned with adjacent text.
@@ -6297,7 +6371,7 @@
interface HTMLElementEventMap extends ElementEventMap, GlobalEventHandlersEventMap, DocumentAndElementEventHandlersEventMap {
}
-/** The HTMLElement interface represents any HTML element. Some elements directly implement this interface, others implement it via an interface that inherits it. */
+/** Any HTML element. Some elements directly implement this interface, while others implement it via an interface that inherits it. */
interface HTMLElement extends Element, GlobalEventHandlers, DocumentAndElementEventHandlers, ElementContentEditable, HTMLOrSVGElement, ElementCSSInlineStyle {
accessKey: string;
readonly accessKeyLabel: string;
@@ -6327,7 +6401,7 @@
new(): HTMLElement;
};
-/** The HTMLEmbedElement interface, which provides special properties (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating <embed> elements. */
+/** Provides special properties (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating <embed> elements. */
interface HTMLEmbedElement extends HTMLElement {
/** @deprecated */
align: string;
@@ -6361,7 +6435,7 @@
new(): HTMLEmbedElement;
};
-/** The HTMLFieldSetElement interface has special properties and methods (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of field-set elements. */
+/** Provides special properties and methods (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of <fieldset> elements. */
interface HTMLFieldSetElement extends HTMLElement {
disabled: boolean;
readonly elements: HTMLCollection;
@@ -6426,7 +6500,7 @@
new(): HTMLFontElement;
};
-/** The HTMLFormControlsCollection interface represents a collection of HTML form control elements. */
+/** A collection of HTML form control elements. */
interface HTMLFormControlsCollection extends HTMLCollectionBase {
/**
* element = collection[name]
@@ -6439,7 +6513,7 @@
new(): HTMLFormControlsCollection;
};
-/** The HTMLFormElement interface represents a <form> element in the DOM; it allows access to and in some cases modification of aspects of the form, as well as access to its component elements. */
+/** A <form> element in the DOM; it allows access to and in some cases modification of aspects of the form, as well as access to its component elements. */
interface HTMLFormElement extends HTMLElement {
/**
* Sets or retrieves a list of character encodings for input data that must be accepted by the server processing the form.
@@ -6576,7 +6650,7 @@
interface HTMLFrameSetElementEventMap extends HTMLElementEventMap, WindowEventHandlersEventMap {
}
-/** The HTMLFrameSetElement interface provides special properties (beyond those of the regular HTMLElement interface they also inherit) for manipulating <frameset> elements. */
+/** Provides special properties (beyond those of the regular HTMLElement interface they also inherit) for manipulating <frameset> elements. */
interface HTMLFrameSetElement extends HTMLElement, WindowEventHandlers {
/**
* Sets or retrieves the frame widths of the object.
@@ -6599,7 +6673,7 @@
new(): HTMLFrameSetElement;
};
-/** The HTMLHRElement interface provides special properties (beyond those of the HTMLElement interface it also has available to it by inheritance) for manipulating <hr> elements. */
+/** Provides special properties (beyond those of the HTMLElement interface it also has available to it by inheritance) for manipulating <hr> elements. */
interface HTMLHRElement extends HTMLElement {
/**
* Sets or retrieves how the object is aligned with adjacent text.
@@ -6631,7 +6705,7 @@
new(): HTMLHRElement;
};
-/** The HTMLHeadElement interface contains the descriptive information, or metadata, for a document. This object inherits all of the properties and methods described in the HTMLElement interface. */
+/** Contains the descriptive information, or metadata, for a document. This object inherits all of the properties and methods described in the HTMLElement interface. */
interface HTMLHeadElement extends HTMLElement {
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLHeadElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
@@ -6644,7 +6718,7 @@
new(): HTMLHeadElement;
};
-/** The HTMLHeadingElement interface represents the different heading elements. It inherits methods and properties from the HTMLElement interface. */
+/** The different heading elements. It inherits methods and properties from the HTMLElement interface. */
interface HTMLHeadingElement extends HTMLElement {
/**
* Sets or retrieves a value that indicates the table alignment.
@@ -6662,7 +6736,7 @@
new(): HTMLHeadingElement;
};
-/** The HTMLHtmlElement interface serves as the root node for a given HTML document. This object inherits the properties and methods described in the HTMLElement interface. */
+/** Serves as the root node for a given HTML document. This object inherits the properties and methods described in the HTMLElement interface. */
interface HTMLHtmlElement extends HTMLElement {
/**
* Sets or retrieves the DTD version that governs the current document.
@@ -6694,7 +6768,7 @@
username: string;
}
-/** The HTMLIFrameElement interface provides special properties and methods (beyond those of the HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of inline frame elements. */
+/** Provides special properties and methods (beyond those of the HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of inline frame elements. */
interface HTMLIFrameElement extends HTMLElement {
/**
* Sets or retrieves how the object is aligned with adjacent text.
@@ -6771,7 +6845,7 @@
new(): HTMLIFrameElement;
};
-/** The HTMLImageElement interface provides special properties and methods  for manipulating the layout and presentation of <img> elements. */
+/** Provides special properties and methods for manipulating <img> elements. */
interface HTMLImageElement extends HTMLElement {
/**
* Sets or retrieves how the object is aligned with adjacent text.
@@ -6861,7 +6935,7 @@
new(): HTMLImageElement;
};
-/** The HTMLInputElement interface provides special properties and methods for manipulating the options, layout, and presentation of <input> elements. */
+/** Provides special properties and methods for manipulating the options, layout, and presentation of <input> elements. */
interface HTMLInputElement extends HTMLElement {
/**
* Sets or retrieves a comma-separated list of content types.
@@ -7009,7 +7083,10 @@
* Returns the value of the data at the cursor's current position.
*/
value: string;
- valueAsDate: any;
+ /**
+ * 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;
/**
* Returns the input field value as a number.
*/
@@ -7066,7 +7143,7 @@
new(): HTMLInputElement;
};
-/** The HTMLLIElement interface exposes specific properties and methods (beyond those defined by regular HTMLElement interface it also has available to it by inheritance) for manipulating list elements. */
+/** Exposes specific properties and methods (beyond those defined by regular HTMLElement interface it also has available to it by inheritance) for manipulating list elements. */
interface HTMLLIElement extends HTMLElement {
/** @deprecated */
type: string;
@@ -7085,7 +7162,7 @@
new(): HTMLLIElement;
};
-/** The HTMLLabelElement interface gives access to properties specific to <label> elements. It inherits methods and properties from the base HTMLElement interface. */
+/** Gives access to properties specific to <label> elements. It inherits methods and properties from the base HTMLElement interface. */
interface HTMLLabelElement extends HTMLElement {
readonly control: HTMLElement | null;
/**
@@ -7126,7 +7203,7 @@
new(): HTMLLegendElement;
};
-/** The HTMLLinkElement interface represents reference information for external resources and the relationship of those resources to a document and vice-versa. This object inherits all of the properties and methods of the HTMLElement interface. */
+/** Reference information for external resources and the relationship of those resources to a document and vice-versa. This object inherits all of the properties and methods of the HTMLElement interface. */
interface HTMLLinkElement extends HTMLElement, LinkStyle {
as: string;
/**
@@ -7144,6 +7221,8 @@
* Sets or retrieves the language code of the object.
*/
hreflang: string;
+ imageSizes: string;
+ imageSrcset: string;
integrity: string;
/**
* Sets or retrieves the media type.
@@ -7181,19 +7260,7 @@
new(): HTMLLinkElement;
};
-interface HTMLMainElement extends HTMLElement {
- addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLMainElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
- addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
- removeEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLMainElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
- removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
-}
-
-declare var HTMLMainElement: {
- prototype: HTMLMainElement;
- new(): HTMLMainElement;
-};
-
-/** The HTMLMapElement interface provides special properties and methods (beyond those of the regular object HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of map elements. */
+/** Provides special properties and methods (beyond those of the regular object HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of map elements. */
interface HTMLMapElement extends HTMLElement {
/**
* Retrieves a collection of the area objects defined for the given map object.
@@ -7220,7 +7287,7 @@
"start": Event;
}
-/** The HTMLMarqueeElement interface provides methods to manipulate <marquee> elements. */
+/** Provides methods to manipulate <marquee> elements. */
interface HTMLMarqueeElement extends HTMLElement {
/** @deprecated */
behavior: string;
@@ -7271,7 +7338,7 @@
"waitingforkey": Event;
}
-/** The HTMLMediaElement interface adds to HTMLElement the properties and methods needed to support basic media-related capabilities that are common to audio and video. */
+/** Adds to HTMLElement the properties and methods needed to support basic media-related capabilities that are common to audio and video. */
interface HTMLMediaElement extends HTMLElement {
/**
* Returns an AudioTrackList object with the audio tracks for a given video element.
@@ -7478,7 +7545,7 @@
new(): HTMLMenuElement;
};
-/** The HTMLMetaElement interface contains descriptive metadata about a document. It inherits all of the properties and methods described in the HTMLElement interface. */
+/** Contains descriptive metadata about a document. It inherits all of the properties and methods described in the HTMLElement interface. */
interface HTMLMetaElement extends HTMLElement {
/**
* Gets or sets meta-information to associate with httpEquiv or name.
@@ -7528,7 +7595,7 @@
new(): HTMLMeterElement;
};
-/** The HTMLModElement interface provides special properties (beyond the regular methods and properties available through the HTMLElement interface they also have available to them by inheritance) for manipulating modification elements, that is <del> and <ins>. */
+/** Provides special properties (beyond the regular methods and properties available through the HTMLElement interface they also have available to them by inheritance) for manipulating modification elements, that is <del> and <ins>. */
interface HTMLModElement extends HTMLElement {
/**
* Sets or retrieves reference information about the object.
@@ -7549,7 +7616,7 @@
new(): HTMLModElement;
};
-/** The HTMLOListElement interface provides special properties (beyond those defined on the regular HTMLElement interface it also has available to it by inheritance) for manipulating ordered list elements. */
+/** Provides special properties (beyond those defined on the regular HTMLElement interface it also has available to it by inheritance) for manipulating ordered list elements. */
interface HTMLOListElement extends HTMLElement {
/** @deprecated */
compact: boolean;
@@ -7570,7 +7637,7 @@
new(): HTMLOListElement;
};
-/** The HTMLObjectElement interface provides special properties and methods (beyond those on the HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of <object> element, representing external resources. */
+/** Provides special properties and methods (beyond those on the HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of <object> element, representing external resources. */
interface HTMLObjectElement extends HTMLElement {
/** @deprecated */
align: string;
@@ -7675,7 +7742,7 @@
new(): HTMLObjectElement;
};
-/** The HTMLOptGroupElement interface provides special properties and methods (beyond the regular HTMLElement object interface they also have available to them by inheritance) for manipulating the layout and presentation of <optgroup> elements. */
+/** Provides special properties and methods (beyond the regular HTMLElement object interface they also have available to them by inheritance) for manipulating the layout and presentation of <optgroup> elements. */
interface HTMLOptGroupElement extends HTMLElement {
disabled: boolean;
/**
@@ -7697,7 +7764,7 @@
new(): HTMLOptGroupElement;
};
-/** The HTMLOptionElement interface represents <option> elements and inherits all classes and methods of the HTMLElement interface. */
+/** <option> elements and inherits all classes and methods of the HTMLElement interface. */
interface HTMLOptionElement extends HTMLElement {
/**
* Sets or retrieves the status of an option.
@@ -7781,7 +7848,7 @@
focus(options?: FocusOptions): void;
}
-/** The HTMLOutputElement interface provides properties and methods (beyond those inherited from HTMLElement) for manipulating the layout and presentation of <output> elements. */
+/** Provides properties and methods (beyond those inherited from HTMLElement) for manipulating the layout and presentation of <output> elements. */
interface HTMLOutputElement extends HTMLElement {
defaultValue: string;
readonly form: HTMLFormElement | null;
@@ -7807,7 +7874,7 @@
new(): HTMLOutputElement;
};
-/** The HTMLParagraphElement interface provides special properties (beyond those of the regular HTMLElement object interface it inherits) for manipulating <p> elements. */
+/** Provides special properties (beyond those of the regular HTMLElement object interface it inherits) for manipulating <p> elements. */
interface HTMLParagraphElement extends HTMLElement {
/**
* Sets or retrieves how the object is aligned with adjacent text.
@@ -7825,7 +7892,7 @@
new(): HTMLParagraphElement;
};
-/** The HTMLParamElement interface provides special properties (beyond those of the regular HTMLElement object interface it inherits) for manipulating <param> elements, representing a pair of a key and a value that acts as a parameter for an <object> element. */
+/** Provides special properties (beyond those of the regular HTMLElement object interface it inherits) for manipulating <param> elements, representing a pair of a key and a value that acts as a parameter for an <object> element. */
interface HTMLParamElement extends HTMLElement {
/**
* Sets or retrieves the name of an input parameter for an element.
@@ -7856,7 +7923,7 @@
new(): HTMLParamElement;
};
-/** The HTMLPictureElement interface represents a <picture> HTML element. It doesn't implement specific properties or methods. */
+/** A <picture> HTML element. It doesn't implement specific properties or methods. */
interface HTMLPictureElement extends HTMLElement {
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLPictureElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
@@ -7869,7 +7936,7 @@
new(): HTMLPictureElement;
};
-/** The HTMLPreElement interface expose specific properties and methods (beyond those defined by regular HTMLElement interface it also has available to it by inheritance) for manipulating block of preformatted text. */
+/** Exposes specific properties and methods (beyond those of the HTMLElement interface it also has available to it by inheritance) for manipulating a block of preformatted text (<pre>). */
interface HTMLPreElement extends HTMLElement {
/**
* Sets or gets a value that you can use to implement your own width functionality for the object.
@@ -7887,7 +7954,7 @@
new(): HTMLPreElement;
};
-/** The HTMLProgressElement interface provides special properties and methods (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of <progress> elements. */
+/** Provides special properties and methods (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of <progress> elements. */
interface HTMLProgressElement extends HTMLElement {
readonly labels: NodeListOf<HTMLLabelElement>;
/**
@@ -7913,7 +7980,7 @@
new(): HTMLProgressElement;
};
-/** The HTMLQuoteElement interface provides special properties and methods (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating quoting elements, like <blockquote> and <q>, but not the <cite> element. */
+/** Provides special properties and methods (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating quoting elements, like <blockquote> and <q>, but not the <cite> element. */
interface HTMLQuoteElement extends HTMLElement {
/**
* Sets or retrieves reference information about the object.
@@ -7979,7 +8046,7 @@
new(): HTMLScriptElement;
};
-/** The HTMLSelectElement interface represents a <select> HTML Element. These elements also share all of the properties and methods of other HTML elements via the HTMLElement interface. */
+/** A <select> HTML Element. These elements also share all of the properties and methods of other HTML elements via the HTMLElement interface. */
interface HTMLSelectElement extends HTMLElement {
autocomplete: string;
/**
@@ -8098,7 +8165,7 @@
new(): HTMLSlotElement;
};
-/** The HTMLSourceElement interface provides special properties (beyond the regular HTMLElement object interface it also has available to it by inheritance) for manipulating <source> elements. */
+/** Provides special properties (beyond the regular HTMLElement object interface it also has available to it by inheritance) for manipulating <source> elements. */
interface HTMLSourceElement extends HTMLElement {
/**
* Gets or sets the intended media type of the media source.
@@ -8125,7 +8192,7 @@
new(): HTMLSourceElement;
};
-/** The HTMLSpanElement interface represents a <span> element and derives from the HTMLElement interface, but without implementing any additional properties or methods. */
+/** A <span> element and derives from the HTMLElement interface, but without implementing any additional properties or methods. */
interface HTMLSpanElement extends HTMLElement {
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLSpanElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
@@ -8138,7 +8205,7 @@
new(): HTMLSpanElement;
};
-/** The HTMLStyleElement interface represents a <style> element. It inherits properties and methods from its parent, HTMLElement, and from LinkStyle. */
+/** A <style> element. It inherits properties and methods from its parent, HTMLElement, and from LinkStyle. */
interface HTMLStyleElement extends HTMLElement, LinkStyle {
/**
* Sets or retrieves the media type.
@@ -8160,7 +8227,7 @@
new(): HTMLStyleElement;
};
-/** The HTMLTableCaptionElement interface special properties (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating table caption elements. */
+/** Special properties (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating table caption elements. */
interface HTMLTableCaptionElement extends HTMLElement {
/**
* Sets or retrieves the alignment of the caption or legend.
@@ -8178,7 +8245,7 @@
new(): HTMLTableCaptionElement;
};
-/** The HTMLTableCellElement interface provides special properties and methods (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of table cells, either header or data cells, in an HTML document. */
+/** Provides special properties and methods (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of table cells, either header or data cells, in an HTML document. */
interface HTMLTableCellElement extends HTMLElement {
/**
* Sets or retrieves abbreviated text for the object.
@@ -8248,7 +8315,7 @@
new(): HTMLTableCellElement;
};
-/** The HTMLTableColElement interface provides special properties (beyond the HTMLElement interface it also has available to it inheritance) for manipulating single or grouped table column elements. */
+/** Provides special properties (beyond the HTMLElement interface it also has available to it inheritance) for manipulating single or grouped table column elements. */
interface HTMLTableColElement extends HTMLElement {
/**
* Sets or retrieves the alignment of the object relative to the display or table.
@@ -8293,7 +8360,7 @@
new(): HTMLTableDataCellElement;
};
-/** The HTMLTableElement interface provides special properties and methods (beyond the regular HTMLElement object interface it also has available to it by inheritance) for manipulating the layout and presentation of tables in an HTML document. */
+/** Provides special properties and methods (beyond the regular HTMLElement object interface it also has available to it by inheritance) for manipulating the layout and presentation of tables in an HTML document. */
interface HTMLTableElement extends HTMLElement {
/**
* Sets or retrieves a value that indicates the table alignment.
@@ -8419,7 +8486,7 @@
new(): HTMLTableHeaderCellElement;
};
-/** The HTMLTableRowElement interface provides special properties and methods (beyond the HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of rows in an HTML table. */
+/** Provides special properties and methods (beyond the HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of rows in an HTML table. */
interface HTMLTableRowElement extends HTMLElement {
/**
* Sets or retrieves how the object is aligned with adjacent text.
@@ -8467,7 +8534,7 @@
new(): HTMLTableRowElement;
};
-/** The HTMLTableSectionElement interface provides special properties and methods (beyond the HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of sections, that is headers, footers and bodies, in an HTML table. */
+/** Provides special properties and methods (beyond the HTMLElement interface it also has available to it by inheritance) for manipulating the layout and presentation of sections, that is headers, footers and bodies, in an HTML table. */
interface HTMLTableSectionElement extends HTMLElement {
/**
* Sets or retrieves a value that indicates the table alignment.
@@ -8505,7 +8572,7 @@
new(): HTMLTableSectionElement;
};
-/** The HTMLTemplateElement interface enables access to the contents of an HTML <template> element. */
+/** Enables access to the contents of an HTML <template> element. */
interface HTMLTemplateElement extends HTMLElement {
readonly content: DocumentFragment;
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLTemplateElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
@@ -8519,7 +8586,7 @@
new(): HTMLTemplateElement;
};
-/** The HTMLTextAreaElement interface provides special properties and methods for manipulating the layout and presentation of <textarea> elements. */
+/** Provides special properties and methods for manipulating the layout and presentation of <textarea> elements. */
interface HTMLTextAreaElement extends HTMLElement {
autocomplete: string;
/**
@@ -8634,7 +8701,7 @@
new(): HTMLTextAreaElement;
};
-/** The HTMLTimeElement interface provides special properties (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating <time> elements. */
+/** Provides special properties (beyond the regular HTMLElement interface it also has available to it by inheritance) for manipulating <time> elements. */
interface HTMLTimeElement extends HTMLElement {
dateTime: string;
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLTimeElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
@@ -8648,7 +8715,7 @@
new(): HTMLTimeElement;
};
-/** The HTMLTitleElement interface contains the title for a document. This element inherits all of the properties and methods of the HTMLElement interface. */
+/** Contains the title for a document. This element inherits all of the properties and methods of the HTMLElement interface. */
interface HTMLTitleElement extends HTMLElement {
/**
* Retrieves or sets the text of the object as a string.
@@ -8693,7 +8760,7 @@
readonly NONE: number;
};
-/** The HTMLUListElement interface provides special properties (beyond those defined on the regular HTMLElement interface it also has available to it by inheritance) for manipulating unordered list elements. */
+/** Provides special properties (beyond those defined on the regular HTMLElement interface it also has available to it by inheritance) for manipulating unordered list elements. */
interface HTMLUListElement extends HTMLElement {
/** @deprecated */
compact: boolean;
@@ -8710,7 +8777,7 @@
new(): HTMLUListElement;
};
-/** The HTMLUnknownElement interface represents an invalid HTML element and derives from the HTMLElement interface, but without implementing any additional properties or methods. */
+/** An invalid HTML element and derives from the HTMLElement interface, but without implementing any additional properties or methods. */
interface HTMLUnknownElement extends HTMLElement {
addEventListener<K extends keyof HTMLElementEventMap>(type: K, listener: (this: HTMLUnknownElement, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
@@ -8729,7 +8796,7 @@
"MSVideoOptimalLayoutChanged": Event;
}
-/** The HTMLVideoElement interface provides special properties and methods for manipulating video objects. It also inherits properties and methods of HTMLMediaElement and HTMLElement. */
+/** Provides special properties and methods for manipulating video objects. It also inherits properties and methods of HTMLMediaElement and HTMLElement. */
interface HTMLVideoElement extends HTMLMediaElement {
/**
* Gets or sets the height of the video element.
@@ -8781,7 +8848,7 @@
new(): HTMLVideoElement;
};
-/** The HashChangeEvent event is fired when the fragment identifier of the URL has changed (the part of the URL that follows the # symbol, including the # symbol). */
+/** Events that fire when the fragment identifier of the URL has changed. */
interface HashChangeEvent extends Event {
readonly newURL: string;
readonly oldURL: string;
@@ -8792,7 +8859,7 @@
new(type: string, eventInitDict?: HashChangeEventInit): HashChangeEvent;
};
-/** The Headers interface of the Fetch API allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.  You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence. */
+/** An interface of the Fetch API allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.  You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence. */
interface Headers {
append(name: string, value: string): void;
delete(name: string): void;
@@ -8807,7 +8874,7 @@
new(init?: HeadersInit): Headers;
};
-/** The History interface allows manipulation of the browser session history, that is the pages visited in the tab or frame that the current page is loaded in. */
+/** Allows manipulation of the browser session history, that is the pages visited in the tab or frame that the current page is loaded in. */
interface History {
readonly length: number;
scrollRestoration: ScrollRestoration;
@@ -8833,7 +8900,7 @@
interface IDBArrayKey extends Array<IDBValidKey> {
}
-/** The IDBCursor interface of the IndexedDB API represents a cursor for traversing or iterating over multiple records in a database. */
+/** An interface of the IndexedDB API represents a cursor for traversing or iterating over multiple records in a database. */
interface IDBCursor {
/**
* Returns the direction ("next", "nextunique", "prev" or "prevunique")
@@ -8887,7 +8954,7 @@
new(): IDBCursor;
};
-/** The IDBCursorWithValue interface of the IndexedDB API represents a cursor for traversing or iterating over multiple records in a database. It is the same as the IDBCursor, except that it includes the value property. */
+/** An interface of the IndexedDB API represents a cursor for traversing or iterating over multiple records in a database. It is the same as the IDBCursor, except that it includes the value property. */
interface IDBCursorWithValue extends IDBCursor {
/**
* Returns the cursor's current value.
@@ -8907,7 +8974,7 @@
"versionchange": IDBVersionChangeEvent;
}
-/** The IDBDatabase interface of the IndexedDB API provides a connection to a database; you can use an IDBDatabase object to open a transaction on your database then create, manipulate, and delete objects (data) in that database. The interface provides the only way to get and manage versions of the database. */
+/** An interface of the IndexedDB API provides a connection to a database; you can use an IDBDatabase object to open a transaction on your database then create, manipulate, and delete objects (data) in that database. The interface provides the only way to get and manage versions of the database. */
interface IDBDatabase extends EventTarget {
/**
* Returns the name of the database.
@@ -9321,7 +9388,7 @@
new(): IDBTransaction;
};
-/** The IDBVersionChangeEvent interface of the IndexedDB API indicates that the version of the database has changed, as the result of an IDBOpenDBRequest.onupgradeneeded event handler function. */
+/** An interface of the IndexedDB API indicates that the version of the database has changed, as the result of an IDBOpenDBRequest.onupgradeneeded event handler function. */
interface IDBVersionChangeEvent extends Event {
readonly newVersion: number | null;
readonly oldVersion: number;
@@ -9391,7 +9458,7 @@
new(): ImageBitmapRenderingContext;
};
-/** The ImageData interface represents the underlying pixel data of an area of a <canvas> element. It is created using the ImageData() constructor or creator methods on the CanvasRenderingContext2D object associated with a canvas: createImageData() and getImageData(). It can also be used to set a part of the canvas by using putImageData(). */
+/** The underlying pixel data of an area of a <canvas> element. It is created using the ImageData() constructor or creator methods on the CanvasRenderingContext2D object associated with a canvas: createImageData() and getImageData(). It can also be used to set a part of the canvas by using putImageData(). */
interface ImageData {
/**
* Returns the one-dimensional array containing the data in RGBA order, as integers in the
@@ -9412,11 +9479,24 @@
new(array: Uint8ClampedArray, width: number, height: number): ImageData;
};
-/** The IntersectionObserver interface of the Intersection Observer API provides a way to asynchronously observe changes in the intersection of a target element with an ancestor element or with a top-level document's viewport. */
+interface InnerHTML {
+ innerHTML: string;
+}
+
+interface InputDeviceInfo extends MediaDeviceInfo {
+ getCapabilities(): MediaTrackCapabilities;
+}
+
+declare var InputDeviceInfo: {
+ prototype: InputDeviceInfo;
+ new(): InputDeviceInfo;
+};
+
+/** provides a way to asynchronously observe changes in the intersection of a target element with an ancestor element or with a top-level document's viewport. */
interface IntersectionObserver {
readonly root: Element | null;
readonly rootMargin: string;
- readonly thresholds: number[];
+ readonly thresholds: ReadonlyArray<number>;
disconnect(): void;
observe(target: Element): void;
takeRecords(): IntersectionObserverEntry[];
@@ -9428,13 +9508,13 @@
new(callback: IntersectionObserverCallback, options?: IntersectionObserverInit): IntersectionObserver;
};
-/** The IntersectionObserverEntry interface of the Intersection Observer API describes the intersection between the target element and its root container at a specific moment of transition. */
+/** An interface of the Intersection Observer API describes the intersection between the target element and its root container at a specific moment of transition. */
interface IntersectionObserverEntry {
readonly boundingClientRect: ClientRect | DOMRect;
readonly intersectionRatio: number;
readonly intersectionRect: ClientRect | DOMRect;
readonly isIntersecting: boolean;
- readonly rootBounds: ClientRect | DOMRect;
+ readonly rootBounds: ClientRect | DOMRect | null;
readonly target: Element;
readonly time: number;
}
@@ -9512,7 +9592,7 @@
new(): ListeningStateChangedEvent;
};
-/** The Location interface represents the location (URL) of the object it is linked to. Changes done on it are reflected on the object it relates to. Both the Document and Window interface have such a linked Location, accessible via Document.location and Window.location respectively. */
+/** The location (URL) of the object it is linked to. Changes done on it are reflected on the object it relates to. Both the Document and Window interface have such a linked Location, accessible via Document.location and Window.location respectively. */
interface Location {
/**
* Returns a DOMStringList object listing the origins of the ancestor browsing contexts, from the parent browsing
@@ -9844,6 +9924,7 @@
readonly groupId: string;
readonly kind: MediaDeviceKind;
readonly label: string;
+ toJSON(): any;
}
declare var MediaDeviceInfo: {
@@ -9855,12 +9936,12 @@
"devicechange": Event;
}
-/** The MediaDevices interface provides access to connected media input devices like cameras and microphones, as well as screen sharing. In essence, it lets you obtain access to any hardware source of media data. */
+/** Provides access to connected media input devices like cameras and microphones, as well as screen sharing. In essence, it lets you obtain access to any hardware source of media data. */
interface MediaDevices extends EventTarget {
ondevicechange: ((this: MediaDevices, ev: Event) => any) | null;
enumerateDevices(): Promise<MediaDeviceInfo[]>;
getSupportedConstraints(): MediaTrackSupportedConstraints;
- getUserMedia(constraints: MediaStreamConstraints): Promise<MediaStream>;
+ getUserMedia(constraints?: MediaStreamConstraints): Promise<MediaStream>;
addEventListener<K extends keyof MediaDevicesEventMap>(type: K, listener: (this: MediaDevices, ev: MediaDevicesEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof MediaDevicesEventMap>(type: K, listener: (this: MediaDevices, ev: MediaDevicesEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
@@ -9892,7 +9973,7 @@
new(type: string, eventInitDict?: MediaEncryptedEventInit): MediaEncryptedEvent;
};
-/** The MediaError interface represents an error which occurred while handling media in an HTML media element based on HTMLMediaElement, such as <audio> or <video>. */
+/** An error which occurred while handling media in an HTML media element based on HTMLMediaElement, such as <audio> or <video>. */
interface MediaError {
readonly code: number;
readonly message: string;
@@ -9914,7 +9995,7 @@
readonly MS_MEDIA_ERR_ENCRYPTED: number;
};
-/** The MediaKeyMessageEvent interface of the EncryptedMediaExtensions API contains the content and related data when the content decryption module generates a message for the session. */
+/** An interface of the EncryptedMediaExtensions API contains the content and related data when the content decryption module generates a message for the session. */
interface MediaKeyMessageEvent extends Event {
readonly message: ArrayBuffer;
readonly messageType: MediaKeyMessageType;
@@ -9930,7 +10011,7 @@
"message": MessageEvent;
}
-/** The MediaKeySession interface of the EncryptedMediaExtensions API represents a context for message exchange with a content decryption module (CDM). */
+/** An interface of the EncryptedMediaExtensions API represents a context for message exchange with a content decryption module (CDM). */
interface MediaKeySession extends EventTarget {
readonly closed: Promise<void>;
readonly expiration: number;
@@ -9954,7 +10035,7 @@
new(): MediaKeySession;
};
-/** The MediaKeyStatusMap interface of the EncryptedMediaExtensions API is a read-only map of media key statuses by key IDs. */
+/** An interface of the EncryptedMediaExtensions API is a read-only map of media key statuses by key IDs. */
interface MediaKeyStatusMap {
readonly size: number;
get(keyId: BufferSource): any;
@@ -9967,7 +10048,7 @@
new(): MediaKeyStatusMap;
};
-/** The MediaKeySystemAccess interface of the EncryptedMediaExtensions API provides access to a Key System for decryption and/or a content protection provider. You can request an instance of this object using the Navigator.requestMediaKeySystemAccess method. */
+/** An interface of the EncryptedMediaExtensions API provides access to a Key System for decryption and/or a content protection provider. You can request an instance of this object using the Navigator.requestMediaKeySystemAccess method. */
interface MediaKeySystemAccess {
readonly keySystem: string;
createMediaKeys(): Promise<MediaKeys>;
@@ -9979,7 +10060,7 @@
new(): MediaKeySystemAccess;
};
-/** The MediaKeys interface of EncryptedMediaExtensions API the represents a set of keys that an associated HTMLMediaElement can use for decryption of media data during playback. */
+/** An interface of the EncryptedMediaExtensions API the represents a set of keys that an associated HTMLMediaElement can use for decryption of media data during playback. */
interface MediaKeys {
createSession(sessionType?: MediaKeySessionType): MediaKeySession;
setServerCertificate(serverCertificate: BufferSource): Promise<boolean>;
@@ -10009,7 +10090,7 @@
"change": MediaQueryListEvent;
}
-/** A MediaQueryList object stores information on a media query applied to a document, and handles sending notifications to listeners when the media query state change (i.e. when the media query test starts or stops evaluating to true). */
+/** Stores information on a media query applied to a document, and handles sending notifications to listeners when the media query state change (i.e. when the media query test starts or stops evaluating to true). */
interface MediaQueryList extends EventTarget {
readonly matches: boolean;
readonly media: string;
@@ -10045,7 +10126,7 @@
"sourceopen": Event;
}
-/** The MediaSource interface of the Media Source Extensions API represents a source of media data for an HTMLMediaElement object. A MediaSource object can be attached to a HTMLMediaElement to be played in the user agent. */
+/** An interface of the Media Source Extensions API represents a source of media data for an HTMLMediaElement object. A MediaSource object can be attached to a HTMLMediaElement to be played in the user agent. */
interface MediaSource extends EventTarget {
readonly activeSourceBuffers: SourceBufferList;
duration: number;
@@ -10072,19 +10153,15 @@
};
interface MediaStreamEventMap {
- "active": Event;
"addtrack": MediaStreamTrackEvent;
- "inactive": Event;
"removetrack": MediaStreamTrackEvent;
}
-/** The MediaStream interface represents a stream of media content. A stream consists of several tracks such as video or audio tracks. Each track is specified as an instance of MediaStreamTrack. */
+/** A stream of media content. A stream consists of several tracks such as video or audio tracks. Each track is specified as an instance of MediaStreamTrack. */
interface MediaStream extends EventTarget {
readonly active: boolean;
readonly id: string;
- onactive: ((this: MediaStream, ev: Event) => any) | null;
onaddtrack: ((this: MediaStream, ev: MediaStreamTrackEvent) => any) | null;
- oninactive: ((this: MediaStream, ev: Event) => any) | null;
onremovetrack: ((this: MediaStream, ev: MediaStreamTrackEvent) => any) | null;
addTrack(track: MediaStreamTrack): void;
clone(): MediaStream;
@@ -10093,7 +10170,6 @@
getTracks(): MediaStreamTrack[];
getVideoTracks(): MediaStreamTrack[];
removeTrack(track: MediaStreamTrack): void;
- stop(): void;
addEventListener<K extends keyof MediaStreamEventMap>(type: K, listener: (this: MediaStream, ev: MediaStreamEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof MediaStreamEventMap>(type: K, listener: (this: MediaStream, ev: MediaStreamEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
@@ -10116,7 +10192,7 @@
new(context: AudioContext, options?: AudioNodeOptions): MediaStreamAudioDestinationNode;
};
-/** A MediaStreamAudioSourceNode has no inputs and exactly one output, and is created using the AudioContext.createMediaStreamSource method. The number of channels in the output equals the number of channels in AudioMediaStreamTrack. If there is no valid media stream, then the number of output channels will be one silent channel. */
+/** A type of AudioNode which operates as an audio source whose media is received from a MediaStream obtained using the WebRTC or Media Capture and Streams APIs. */
interface MediaStreamAudioSourceNode extends AudioNode {
readonly mediaStream: MediaStream;
}
@@ -10146,7 +10222,7 @@
new(typeArg: string, eventInitDict?: MediaStreamErrorEventInit): MediaStreamErrorEvent;
};
-/** The MediaStreamEvent interface represents events that occurs in relation to a MediaStream. Two events of this type can be thrown: addstream and removestream. */
+/** Events that occurs in relation to a MediaStream. Two events of this type can be thrown: addstream and removestream. */
interface MediaStreamEvent extends Event {
readonly stream: MediaStream | null;
}
@@ -10157,14 +10233,14 @@
};
interface MediaStreamTrackEventMap {
- "ended": MediaStreamErrorEvent;
+ "ended": Event;
"isolationchange": Event;
"mute": Event;
"overconstrained": MediaStreamErrorEvent;
"unmute": Event;
}
-/** The MediaStreamTrack interface represents a single media track within a stream; typically, these are audio or video tracks, but other track types may exist as well. */
+/** A single media track within a stream; typically, these are audio or video tracks, but other track types may exist as well. */
interface MediaStreamTrack extends EventTarget {
enabled: boolean;
readonly id: string;
@@ -10172,15 +10248,13 @@
readonly kind: string;
readonly label: string;
readonly muted: boolean;
- onended: ((this: MediaStreamTrack, ev: MediaStreamErrorEvent) => any) | null;
+ onended: ((this: MediaStreamTrack, ev: Event) => any) | null;
onisolationchange: ((this: MediaStreamTrack, ev: Event) => any) | null;
onmute: ((this: MediaStreamTrack, ev: Event) => any) | null;
onoverconstrained: ((this: MediaStreamTrack, ev: MediaStreamErrorEvent) => any) | null;
onunmute: ((this: MediaStreamTrack, ev: Event) => any) | null;
- readonly readonly: boolean;
readonly readyState: MediaStreamTrackState;
- readonly remote: boolean;
- applyConstraints(constraints: MediaTrackConstraints): Promise<void>;
+ applyConstraints(constraints?: MediaTrackConstraints): Promise<void>;
clone(): MediaStreamTrack;
getCapabilities(): MediaTrackCapabilities;
getConstraints(): MediaTrackConstraints;
@@ -10205,17 +10279,17 @@
new(context: AudioContext, options: MediaStreamTrackAudioSourceOptions): MediaStreamTrackAudioSourceNode;
};
-/** The MediaStreamTrackEvent interface represents events which indicate that a MediaStream has had tracks added to or removed from the stream through calls to Media Stream API methods. These events are sent to the stream when these changes occur. */
+/** Events which indicate that a MediaStream has had tracks added to or removed from the stream through calls to Media Stream API methods. These events are sent to the stream when these changes occur. */
interface MediaStreamTrackEvent extends Event {
readonly track: MediaStreamTrack;
}
declare var MediaStreamTrackEvent: {
prototype: MediaStreamTrackEvent;
- new(typeArg: string, eventInitDict?: MediaStreamTrackEventInit): MediaStreamTrackEvent;
+ new(type: string, eventInitDict: MediaStreamTrackEventInit): MediaStreamTrackEvent;
};
-/** The MessageChannel interface of the Channel Messaging API allows us to create a new message channel and send data through it via its two MessagePort properties. */
+/** An interface of the Channel Messaging API allows us to create a new message channel and send data through it via its two MessagePort properties. */
interface MessageChannel {
readonly port1: MessagePort;
readonly port2: MessagePort;
@@ -10226,7 +10300,7 @@
new(): MessageChannel;
};
-/** The MessageEvent interface represents a message received by a target object. */
+/** A message received by a target object. */
interface MessageEvent extends Event {
/**
* Returns the data of the message.
@@ -10265,7 +10339,7 @@
"messageerror": MessageEvent;
}
-/** The MessagePort interface of the Channel Messaging API represents one of the two ports of a MessageChannel, allowing messages to be sent from one port and listening out for them arriving at the other. */
+/** An interface of the Channel Messaging API represents one of the two ports of a MessageChannel, allowing messages to be sent from one port and listening out for them arriving at the other. */
interface MessagePort extends EventTarget {
onmessage: ((this: MessagePort, ev: MessageEvent) => any) | null;
onmessageerror: ((this: MessagePort, ev: MessageEvent) => any) | null;
@@ -10273,14 +10347,8 @@
* Disconnects the port, so that it is no longer active.
*/
close(): void;
- /**
- * Posts a message through the channel. Objects listed in transfer are
- * transferred, not just cloned, meaning that they are no longer usable on the sending side.
- * Throws a "DataCloneError" DOMException if
- * transfer contains duplicate objects or port, or if message
- * could not be cloned.
- */
- postMessage(message: any, transfer?: Transferable[]): void;
+ postMessage(message: any, transfer: Transferable[]): void;
+ postMessage(message: any, options?: PostMessageOptions): void;
/**
* Begins dispatching messages received on the port.
*/
@@ -10296,7 +10364,7 @@
new(): MessagePort;
};
-/** The MimeType interface provides contains information about a MIME type associated with a particular plugin. NavigatorPlugins.mimeTypes returns an array of this object. */
+/** Provides contains information about a MIME type associated with a particular plugin. NavigatorPlugins.mimeTypes returns an array of this object. */
interface MimeType {
readonly description: string;
readonly enabledPlugin: Plugin;
@@ -10309,7 +10377,7 @@
new(): MimeType;
};
-/** The MimeTypeArray interface returns an array of MimeType instances, each of which contains information about a supported browser plugins. This object is returned by NavigatorPlugins.mimeTypes. */
+/** Returns an array of MimeType instances, each of which contains information about a supported browser plugins. This object is returned by NavigatorPlugins.mimeTypes. */
interface MimeTypeArray {
readonly length: number;
item(index: number): Plugin;
@@ -10322,7 +10390,7 @@
new(): MimeTypeArray;
};
-/** The MouseEvent interface represents events that occur due to the user interacting with a pointing device (such as a mouse). Common events using this interface include click, dblclick, mouseup, mousedown. */
+/** Events that occur due to the user interacting with a pointing device (such as a mouse). Common events using this interface include click, dblclick, mouseup, mousedown. */
interface MouseEvent extends UIEvent {
readonly altKey: boolean;
readonly button: number;
@@ -10381,7 +10449,7 @@
readonly REMOVAL: number;
};
-/** The MutationObserver interface provides the ability to watch for changes being made to the DOM tree. It is designed as a replacement for the older Mutation Events feature which was part of the DOM3 Events specification. */
+/** Provides the ability to watch for changes being made to the DOM tree. It is designed as a replacement for the older Mutation Events feature which was part of the DOM3 Events specification. */
interface MutationObserver {
disconnect(): void;
/**
@@ -10472,7 +10540,7 @@
new(): MutationRecord;
};
-/** The NamedNodeMap interface represents a collection of Attr objects. Objects inside a NamedNodeMap are not in any particular order, unlike NodeList, although they may be accessed by an index as in an array. */
+/** A collection of Attr objects. Objects inside a NamedNodeMap are not in any particular order, unlike NodeList, although they may be accessed by an index as in an array. */
interface NamedNodeMap {
readonly length: number;
getNamedItem(qualifiedName: string): Attr | null;
@@ -10502,7 +10570,7 @@
new(): NavigationPreloadManager;
};
-/** The Navigator interface represents the state and the identity of the user agent. It allows scripts to query it and to register themselves to carry on some activities. */
+/** The state and the identity of the user agent. It allows scripts to query it and to register themselves to carry on some activities. */
interface Navigator extends NavigatorID, NavigatorOnLine, NavigatorContentUtils, NavigatorStorageUtils, MSNavigatorDoNotTrack, MSFileSaver, NavigatorBeacon, NavigatorConcurrentHardware, NavigatorUserMedia, NavigatorLanguage, NavigatorStorage, NavigatorAutomationInformation {
readonly activeVRDisplays: ReadonlyArray<VRDisplay>;
readonly authentication: WebAuthentication;
@@ -10512,15 +10580,18 @@
gamepadInputEmulation: GamepadInputEmulationType;
readonly geolocation: Geolocation;
readonly maxTouchPoints: number;
+ readonly mediaDevices: MediaDevices;
readonly mimeTypes: MimeTypeArray;
readonly msManipulationViewsEnabled: boolean;
readonly msMaxTouchPoints: number;
readonly msPointerEnabled: boolean;
+ readonly permissions: Permissions;
readonly plugins: PluginArray;
readonly pointerEnabled: boolean;
readonly serviceWorker: ServiceWorkerContainer;
readonly webdriver: boolean;
getGamepads(): (Gamepad | null)[];
+ getUserMedia(constraints: MediaStreamConstraints, successCallback: NavigatorUserMediaSuccessCallback, errorCallback: NavigatorUserMediaErrorCallback): void;
getVRDisplays(): Promise<VRDisplay[]>;
javaEnabled(): boolean;
msLaunchUri(uri: string, successCallback?: MSLaunchUriCallback, noHandlerCallback?: MSLaunchUriCallback): void;
@@ -10729,7 +10800,7 @@
readonly TEXT_NODE: number;
};
-/** A NodeFilter interface represents an object used to filter the nodes in a NodeIterator or TreeWalker. They don't know anything about the DOM or how to traverse nodes; they just know how to evaluate a single node against the provided filter. */
+/** An object used to filter the nodes in a NodeIterator or TreeWalker. They don't know anything about the DOM or how to traverse nodes; they just know how to evaluate a single node against the provided filter. */
interface NodeFilter {
acceptNode(node: Node): number;
}
@@ -10753,7 +10824,7 @@
readonly SHOW_TEXT: number;
};
-/** The NodeIterator interface represents an iterator over the members of a list of the nodes in a subtree of the DOM. The nodes will be returned in document order. */
+/** An iterator over the members of a list of the nodes in a subtree of the DOM. The nodes will be returned in document order. */
interface NodeIterator {
readonly filter: NodeFilter | null;
readonly pointerBeforeReferenceNode: boolean;
@@ -10806,15 +10877,6 @@
[index: number]: TNode;
}
-interface NodeSelector {
- querySelector<K extends keyof HTMLElementTagNameMap>(selectors: K): HTMLElementTagNameMap[K] | null;
- querySelector<K extends keyof SVGElementTagNameMap>(selectors: K): SVGElementTagNameMap[K] | null;
- querySelector<E extends Element = Element>(selectors: string): E | null;
- querySelectorAll<K extends keyof HTMLElementTagNameMap>(selectors: K): NodeListOf<HTMLElementTagNameMap[K]>;
- querySelectorAll<K extends keyof SVGElementTagNameMap>(selectors: K): NodeListOf<SVGElementTagNameMap[K]>;
- querySelectorAll<E extends Element = Element>(selectors: string): NodeListOf<E>;
-}
-
interface NonDocumentTypeChildNode {
/**
* Returns the first following sibling that
@@ -10842,7 +10904,7 @@
"show": Event;
}
-/** The Notification interface of the Notifications API is used to configure and display desktop notifications to the user. */
+/** An interface of the Notifications API is used to configure and display desktop notifications to the user. */
interface Notification extends EventTarget {
readonly actions: ReadonlyArray<NotificationAction>;
readonly badge: string;
@@ -10926,10 +10988,11 @@
"complete": OfflineAudioCompletionEvent;
}
-/** The OfflineAudioContext interface is an AudioContext interface representing an audio-processing graph built from linked together AudioNodes. In contrast with a standard AudioContext, an OfflineAudioContext doesn't render the audio to the device hardware; instead, it generates it, as fast as it can, and outputs the result to an AudioBuffer. */
+/** An AudioContext interface representing an audio-processing graph built from linked together AudioNodes. In contrast with a standard AudioContext, an OfflineAudioContext doesn't render the audio to the device hardware; instead, it generates it, as fast as it can, and outputs the result to an AudioBuffer. */
interface OfflineAudioContext extends BaseAudioContext {
readonly length: number;
oncomplete: ((this: OfflineAudioContext, ev: OfflineAudioCompletionEvent) => any) | null;
+ resume(): Promise<void>;
startRendering(): Promise<AudioBuffer>;
suspend(suspendTime: number): Promise<void>;
addEventListener<K extends keyof OfflineAudioContextEventMap>(type: K, listener: (this: OfflineAudioContext, ev: OfflineAudioContextEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
@@ -10944,6 +11007,62 @@
new(numberOfChannels: number, length: number, sampleRate: number): OfflineAudioContext;
};
+interface OffscreenCanvas extends EventTarget {
+ /**
+ * These attributes return the dimensions of the OffscreenCanvas object's bitmap.
+ * They can be set, to replace the bitmap with a
+ * new, transparent black bitmap of the specified dimensions (effectively resizing
+ * it).
+ */
+ height: number;
+ width: number;
+ /**
+ * Returns a promise that will fulfill with a new Blob object representing a file
+ * containing the image in the OffscreenCanvas object.
+ * The argument, if provided, is a dictionary that controls the encoding options of the image
+ * file to be created. The type
+ * field specifies the file format and has a default value of "image/png"; that type
+ * is also used if the requested type isn't supported. If the image format supports variable
+ * quality (such as "image/jpeg"), then the quality field is a number in the range 0.0
+ * to 1.0 inclusive indicating the desired quality level for the resulting image.
+ */
+ convertToBlob(options?: ImageEncodeOptions): Promise<Blob>;
+ /**
+ * Returns an object that exposes an API for drawing on the OffscreenCanvas
+ * object. contextId specifies the desired API: "2d" or "webgl". options is handled by that
+ * API.
+ * This specification defines the "2d" context below,
+ * which is similar but distinct from the "2d"
+ * context that is created from a canvas element. There is also a specification that
+ * defines a "webgl" context. [WEBGL]
+ * Returns null if the canvas has already been initialized with another context type (e.g.,
+ * trying to get a "2d" context after getting a
+ * "webgl" context).
+ */
+ getContext(contextId: OffscreenRenderingContextId, options?: any): OffscreenRenderingContext | null;
+ /**
+ * Returns a newly created ImageBitmap object with the image in the
+ * OffscreenCanvas object. The image in the OffscreenCanvas object is
+ * replaced with a new blank image.
+ */
+ transferToImageBitmap(): ImageBitmap;
+}
+
+declare var OffscreenCanvas: {
+ prototype: OffscreenCanvas;
+ new(width: number, height: number): OffscreenCanvas;
+};
+
+interface OffscreenCanvasRenderingContext2D extends CanvasState, CanvasTransform, CanvasCompositing, CanvasImageSmoothing, CanvasFillStrokeStyles, CanvasShadowStyles, CanvasFilters, CanvasRect, CanvasDrawPath, CanvasText, CanvasDrawImage, CanvasImageData, CanvasPathDrawingStyles, CanvasTextDrawingStyles, CanvasPath {
+ readonly canvas: OffscreenCanvas;
+ commit(): void;
+}
+
+declare var OffscreenCanvasRenderingContext2D: {
+ prototype: OffscreenCanvasRenderingContext2D;
+ new(): OffscreenCanvasRenderingContext2D;
+};
+
/** The OscillatorNode interface represents a periodic waveform, such as a sine wave. It is an AudioScheduledSourceNode audio-processing module that causes a specified frequency of a given wave to be created—in effect, a constant tone. */
interface OscillatorNode extends AudioScheduledSourceNode {
readonly detune: AudioParam;
@@ -10961,6 +11080,15 @@
new(context: BaseAudioContext, options?: OscillatorOptions): OscillatorNode;
};
+interface OverconstrainedError extends Error {
+ constraint: string;
+}
+
+declare var OverconstrainedError: {
+ prototype: OverconstrainedError;
+ new(): OverconstrainedError;
+};
+
interface OverflowEvent extends UIEvent {
readonly horizontalOverflow: boolean;
readonly orient: number;
@@ -11059,7 +11187,7 @@
querySelectorAll<E extends Element = Element>(selectors: string): NodeListOf<E>;
}
-/** The Path2D interface of the Canvas 2D API is used to declare a path that can then be used on a CanvasRenderingContext2D object. The path methods of the CanvasRenderingContext2D interface are also present on this interface, which gives you the convenience of being able to retain and replay your path whenever desired. */
+/** Of the Canvas 2D API is used to declare a path that can then be used on a CanvasRenderingContext2D object. The path methods of the CanvasRenderingContext2D interface are also present on this interface, which gives you the convenience of being able to retain and replay your path whenever desired. */
interface Path2D extends CanvasPath {
addPath(path: Path2D, transform?: DOMMatrix2DInit): void;
}
@@ -11069,7 +11197,7 @@
new(path?: Path2D | string): Path2D;
};
-/** The PaymentAddress interface of the Payment Request API is used to store shipping or payment address information. */
+/** An interface of the Payment Request API is used to store shipping or payment address information. */
interface PaymentAddress {
readonly addressLine: string[];
readonly city: string;
@@ -11095,7 +11223,7 @@
"shippingoptionchange": Event;
}
-/** The PaymentRequest interface of the Payment Request API is the primary access point into the API, and lets web content and apps accept payments from the end user. */
+/** An interface of the Payment Request API is the primary access point into the API , and lets web content and apps accept payments from the end user. */
interface PaymentRequest extends EventTarget {
readonly id: string;
onshippingaddresschange: ((this: PaymentRequest, ev: Event) => any) | null;
@@ -11117,7 +11245,7 @@
new(methodData: PaymentMethodData[], details: PaymentDetailsInit, options?: PaymentOptions): PaymentRequest;
};
-/** The PaymentRequestUpdateEvent interface of the the Payment Request API enables a web page to update the details of a PaymentRequest in response to a user action. */
+/** An interface of the Payment Request API enables a web page to update the details of a PaymentRequest in response to a user action. */
interface PaymentRequestUpdateEvent extends Event {
updateWith(detailsPromise: PaymentDetailsUpdate | Promise<PaymentDetailsUpdate>): void;
}
@@ -11127,7 +11255,7 @@
new(type: string, eventInitDict?: PaymentRequestUpdateEventInit): PaymentRequestUpdateEvent;
};
-/** The PaymentResponse interface of the Payment Request API is returned after a user selects a payment method and approves a payment request. */
+/** An interface of the Payment Request API is returned after a user selects a payment method and approves a payment request. */
interface PaymentResponse {
readonly details: any;
readonly methodName: string;
@@ -11179,7 +11307,7 @@
"resourcetimingbufferfull": Event;
}
-/** The Performance interface provides access to performance-related information for the current page. It's part of the High Resolution Time API, but is enhanced by the Performance Timeline API, the Navigation Timing API, the User Timing API, and the Resource Timing API. */
+/** Provides access to performance-related information for the current page. It's part of the High Resolution Time API, but is enhanced by the Performance Timeline API, the Navigation Timing API, the User Timing API, and the Resource Timing API. */
interface Performance extends EventTarget {
/** @deprecated */
readonly navigation: PerformanceNavigation;
@@ -11209,7 +11337,7 @@
new(): Performance;
};
-/** The PerformanceEntry object encapsulates a single performance metric that is part of the performance timeline. A performance entry can be directly created by making a performance mark or measure (for example by calling the mark() method) at an explicit point in an application. Performance entries are also created in indirect ways such as loading a resource (such as an image). */
+/** Encapsulates a single performance metric that is part of the performance timeline. A performance entry can be directly created by making a performance mark or measure (for example by calling the mark() method) at an explicit point in an application. Performance entries are also created in indirect ways such as loading a resource (such as an image). */
interface PerformanceEntry {
readonly duration: number;
readonly entryType: string;
@@ -11261,7 +11389,7 @@
readonly TYPE_RESERVED: number;
};
-/** The PerformanceNavigationTiming interface provides methods and properties to store and retrieve metrics regarding the browser's document navigation events. For example, this interface can be used to determine how much time it takes to load or unload a document. */
+/** Provides methods and properties to store and retrieve metrics regarding the browser's document navigation events. For example, this interface can be used to determine how much time it takes to load or unload a document. */
interface PerformanceNavigationTiming extends PerformanceResourceTiming {
readonly domComplete: number;
readonly domContentLoadedEventEnd: number;
@@ -11283,13 +11411,14 @@
interface PerformanceObserver {
disconnect(): void;
- observe(options: PerformanceObserverInit): void;
+ observe(options?: PerformanceObserverInit): void;
takeRecords(): PerformanceEntryList;
}
declare var PerformanceObserver: {
prototype: PerformanceObserver;
new(callback: PerformanceObserverCallback): PerformanceObserver;
+ readonly supportedEntryTypes: ReadonlyArray<string>;
};
interface PerformanceObserverEntryList {
@@ -11303,7 +11432,7 @@
new(): PerformanceObserverEntryList;
};
-/** The PerformanceResourceTiming interface enables retrieval and analysis of detailed network timing data regarding the loading of an application's resources. An application can use the timing metrics to determine, for example, the length of time it takes to fetch a specific resource, such as an XMLHttpRequest, <SVG>, image, or script. */
+/** Enables retrieval and analysis of detailed network timing data regarding the loading of an application's resources. An application can use the timing metrics to determine, for example, the length of time it takes to fetch a specific resource, such as an XMLHttpRequest, <SVG>, image, or script. */
interface PerformanceResourceTiming extends PerformanceEntry {
readonly connectEnd: number;
readonly connectStart: number;
@@ -11330,7 +11459,7 @@
new(): PerformanceResourceTiming;
};
-/** The PerformanceTiming interface is a legacy interface kept for backwards compatibility and contains properties that offer performance timing information for various events which occur during the loading and use of the current page. You get a PerformanceTiming object describing your page using the window.performance.timing property. */
+/** A legacy interface kept for backwards compatibility and contains properties that offer performance timing information for various events which occur during the loading and use of the current page. You get a PerformanceTiming object describing your page using the window.performance.timing property. */
interface PerformanceTiming {
readonly connectEnd: number;
readonly connectStart: number;
@@ -11389,7 +11518,34 @@
new(): PermissionRequestedEvent;
};
-/** The Plugin interface provides information about a browser plugin. */
+interface PermissionStatusEventMap {
+ "change": Event;
+}
+
+interface PermissionStatus extends EventTarget {
+ onchange: ((this: PermissionStatus, ev: Event) => any) | null;
+ readonly state: PermissionState;
+ addEventListener<K extends keyof PermissionStatusEventMap>(type: K, listener: (this: PermissionStatus, ev: PermissionStatusEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
+ removeEventListener<K extends keyof PermissionStatusEventMap>(type: K, listener: (this: PermissionStatus, ev: PermissionStatusEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
+}
+
+declare var PermissionStatus: {
+ prototype: PermissionStatus;
+ new(): PermissionStatus;
+};
+
+interface Permissions {
+ query(permissionDesc: PermissionDescriptor | DevicePermissionDescriptor | MidiPermissionDescriptor | PushPermissionDescriptor): Promise<PermissionStatus>;
+}
+
+declare var Permissions: {
+ prototype: Permissions;
+ new(): Permissions;
+};
+
+/** Provides information about a browser plugin. */
interface Plugin {
readonly description: string;
readonly filename: string;
@@ -11406,7 +11562,7 @@
new(): Plugin;
};
-/** The PluginArray interface is used to store a list of Plugin objects describing the available plugins; it's returned by the window.navigator.plugins property. The PluginArray is not a JavaScript array, but has the length property and supports accessing individual items using bracket notation (plugins[2]), as well as via item(index) and namedItem("name") methods. */
+/** Used to store a list of Plugin objects describing the available plugins; it's returned by the window.navigator.plugins property. The PluginArray is not a JavaScript array, but has the length property and supports accessing individual items using bracket notation (plugins[2]), as well as via item(index) and namedItem("name") methods. */
interface PluginArray {
readonly length: number;
item(index: number): Plugin;
@@ -11420,7 +11576,7 @@
new(): PluginArray;
};
-/** The PointerEvent interface represents the state of a DOM event produced by a pointer such as the geometry of the contact point, the device type that generated the event, the amount of pressure that was applied on the contact surface, etc. */
+/** The state of a DOM event produced by a pointer such as the geometry of the contact point, the device type that generated the event, the amount of pressure that was applied on the contact surface, etc. */
interface PointerEvent extends MouseEvent {
readonly height: number;
readonly isPrimary: boolean;
@@ -11439,7 +11595,7 @@
new(type: string, eventInitDict?: PointerEventInit): PointerEvent;
};
-/** An event handler for the popstate event on the window. */
+/** PopStateEvent is an event handler for the popstate event on the window. */
interface PopStateEvent extends Event {
readonly state: any;
}
@@ -11449,13 +11605,13 @@
new(type: string, eventInitDict?: PopStateEventInit): PopStateEvent;
};
-/** The Position interface represents the position of the concerned device at a given time. The position, represented by a Coordinates object, comprehends the 2D position of the device, on a spheroid representing the Earth, but also its altitude and its speed. */
+/** The position of the concerned device at a given time. The position, represented by a Coordinates object, comprehends the 2D position of the device, on a spheroid representing the Earth, but also its altitude and its speed. */
interface Position {
readonly coords: Coordinates;
readonly timestamp: number;
}
-/** The PositionError interface represents the reason of an error occurring when using the geolocating device. */
+/** The reason of an error occurring when using the geolocating device. */
interface PositionError {
readonly code: number;
readonly message: string;
@@ -11474,7 +11630,7 @@
new(): ProcessingInstruction;
};
-/** The ProgressEvent interface represents events measuring progress of an underlying process, like an HTTP request (for an XMLHttpRequest, or the loading of the underlying resource of an <img>, <audio>, <video>, <style> or <link>). */
+/** Events measuring progress of an underlying process, like an HTTP request (for an XMLHttpRequest, or the loading of the underlying resource of an <img>, <audio>, <video>, <style> or <link>). */
interface ProgressEvent extends Event {
readonly lengthComputable: boolean;
readonly loaded: number;
@@ -11496,7 +11652,7 @@
new(type: string, eventInitDict: PromiseRejectionEventInit): PromiseRejectionEvent;
};
-/** The PushManager interface of the Push API provides a way to receive notifications from third-party servers as well as request URLs for push notifications. */
+/** An interface of the Push API provides a way to receive notifications from third-party servers as well as request URLs for push notifications. */
interface PushManager {
getSubscription(): Promise<PushSubscription | null>;
permissionState(options?: PushSubscriptionOptionsInit): Promise<PushPermissionState>;
@@ -11509,7 +11665,7 @@
readonly supportedContentEncodings: ReadonlyArray<string>;
};
-/** The PushSubscription interface of the Push API provides a subcription's URL endpoint and allows unsubscription from a push service. */
+/** An interface of the Push API provides a subcription's URL endpoint and allows unsubscription from a push service. */
interface PushSubscription {
readonly endpoint: string;
readonly expirationTime: number | null;
@@ -11565,7 +11721,7 @@
new(): RTCDTMFSender;
};
-/** The RTCDTMFToneChangeEvent interface represents events sent to indicate that DTMF tones have started or finished playing. This interface is used by the tonechange event. */
+/** Events sent to indicate that DTMF tones have started or finished playing. This interface is used by the tonechange event. */
interface RTCDTMFToneChangeEvent extends Event {
readonly tone: string;
}
@@ -11776,7 +11932,7 @@
"statechange": Event;
}
-/** The RTCIceTransport interface provides access to information about the ICE transport layer over which the data is being sent and received. */
+/** Provides access to information about the ICE transport layer over which the data is being sent and received. */
interface RTCIceTransport extends EventTarget {
readonly component: RTCIceComponent;
readonly gatheringState: RTCIceGathererState;
@@ -11833,7 +11989,7 @@
"track": RTCTrackEvent;
}
-/** The RTCPeerConnection interface represents a WebRTC connection between the local computer and a remote peer. It provides methods to connect to a remote peer, maintain and monitor the connection, and close the connection once it's no longer needed. */
+/** A WebRTC connection between the local computer and a remote peer. It provides methods to connect to a remote peer, maintain and monitor the connection, and close the connection once it's no longer needed. */
interface RTCPeerConnection extends EventTarget {
readonly canTrickleIceCandidates: boolean | null;
readonly connectionState: RTCPeerConnectionState;
@@ -11903,7 +12059,7 @@
new(type: string, eventInitDict: RTCPeerConnectionIceErrorEventInit): RTCPeerConnectionIceErrorEvent;
};
-/** The RTCPeerConnectionIceEvent interface represents events that occurs in relation to ICE candidates with the target, usually an RTCPeerConnection. Only one event is of this type: icecandidate. */
+/** Events that occurs in relation to ICE candidates with the target, usually an RTCPeerConnection. Only one event is of this type: icecandidate. */
interface RTCPeerConnectionIceEvent extends Event {
readonly candidate: RTCIceCandidate | null;
readonly url: string | null;
@@ -11914,7 +12070,7 @@
new(type: string, eventInitDict?: RTCPeerConnectionIceEventInit): RTCPeerConnectionIceEvent;
};
-/** The RTCRtpReceiver interface of the the WebRTC API manages the reception and decoding of data for a MediaStreamTrack on an RTCPeerConnection. */
+/** An interface of the WebRTC API manages the reception and decoding of data for a MediaStreamTrack on an RTCPeerConnection. */
interface RTCRtpReceiver {
readonly rtcpTransport: RTCDtlsTransport | null;
readonly track: MediaStreamTrack;
@@ -11931,7 +12087,7 @@
getCapabilities(kind: string): RTCRtpCapabilities | null;
};
-/** The RTCRtpSender interface provides the ability to control and obtain details about how a particular MediaStreamTrack is encoded and sent to a remote peer. */
+/** Provides the ability to control and obtain details about how a particular MediaStreamTrack is encoded and sent to a remote peer. */
interface RTCRtpSender {
readonly dtmf: RTCDTMFSender | null;
readonly rtcpTransport: RTCDtlsTransport | null;
@@ -11987,7 +12143,7 @@
new(): RTCSctpTransport;
};
-/** The RTCSessionDescription interface describes one end of a connection—or potential connection—and how it's configured. Each RTCSessionDescription consists of a description type indicating which part of the offer/answer negotiation process it describes and of the SDP descriptor of the session. */
+/** One end of a connection—or potential connection—and how it's configured. Each RTCSessionDescription consists of a description type indicating which part of the offer/answer negotiation process it describes and of the SDP descriptor of the session. */
interface RTCSessionDescription {
readonly sdp: string;
readonly type: RTCSdpType;
@@ -12085,7 +12241,7 @@
new(): RandomSource;
};
-/** The Range interface represents a fragment of a document that can contain nodes and parts of text nodes. */
+/** A fragment of a document that can contain nodes and parts of text nodes. */
interface Range extends AbstractRange {
/**
* Returns the node, furthest away from
@@ -12145,7 +12301,7 @@
error(error?: any): void;
}
-/** The ReadableStream interface of the Streams API represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. */
+/** An interface of the Streams API represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. */
interface ReadableStream<R = any> {
readonly locked: boolean;
cancel(reason?: any): Promise<void>;
@@ -12169,11 +12325,6 @@
releaseLock(): void;
}
-declare var ReadableStreamBYOBReader: {
- prototype: ReadableStreamBYOBReader;
- new(stream: ReadableStream<Uint8Array>): ReadableStreamBYOBReader;
-};
-
interface ReadableStreamBYOBRequest {
readonly view: ArrayBufferView;
respond(bytesWritten: number): void;
@@ -12210,7 +12361,7 @@
new(): ReadableStreamReader;
};
-/** The Request interface of the Fetch API represents a resource request. */
+/** An interface of the Fetch API represents a resource request. */
interface Request extends Body {
/**
* Returns the cache mode associated with request, which is a string indicating
@@ -12296,7 +12447,7 @@
new(input: RequestInfo, init?: RequestInit): Request;
};
-/** The Response interface of the Fetch API represents the response to a request. */
+/** An interface of the Fetch API represents the response to a request. */
interface Response extends Body {
readonly headers: Headers;
readonly ok: boolean;
@@ -12316,7 +12467,7 @@
redirect(url: string, status?: number): Response;
};
-/** The SVGAElement interface provides access to the properties of <a> element, as well as methods to manipulate them. */
+/** Provides access to the properties of <a> element, as well as methods to manipulate them. */
interface SVGAElement extends SVGGraphicsElement, SVGURIReference {
readonly target: SVGAnimatedString;
addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGAElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
@@ -12330,7 +12481,7 @@
new(): SVGAElement;
};
-/** The SVGAngle interface is used to represent a value that can be an <angle> or <number> value. An SVGAngle reflected through the animVal attribute is always read only. */
+/** Used to represent a value that can be an <angle> or <number> value. An SVGAngle reflected through the animVal attribute is always read only. */
interface SVGAngle {
readonly unitType: number;
value: number;
@@ -12391,7 +12542,7 @@
new(): SVGAnimateTransformElement;
};
-/** The SVGAnimatedAngle interface is used for attributes of basic type <angle> which can be animated. */
+/** Used for attributes of basic type <angle> which can be animated. */
interface SVGAnimatedAngle {
readonly animVal: SVGAngle;
readonly baseVal: SVGAngle;
@@ -12402,7 +12553,7 @@
new(): SVGAnimatedAngle;
};
-/** The SVGAnimatedBoolean interface is used for attributes of type boolean which can be animated. */
+/** Used for attributes of type boolean which can be animated. */
interface SVGAnimatedBoolean {
readonly animVal: boolean;
baseVal: boolean;
@@ -12413,7 +12564,7 @@
new(): SVGAnimatedBoolean;
};
-/** The SVGAnimatedEnumeration interface is used for attributes whose value must be a constant from a particular enumeration and which can be animated. */
+/** Used for attributes whose value must be a constant from a particular enumeration and which can be animated. */
interface SVGAnimatedEnumeration {
readonly animVal: number;
baseVal: number;
@@ -12424,7 +12575,7 @@
new(): SVGAnimatedEnumeration;
};
-/** The SVGAnimatedInteger interface is used for attributes of basic type <integer> which can be animated. */
+/** Used for attributes of basic type <integer> which can be animated. */
interface SVGAnimatedInteger {
readonly animVal: number;
baseVal: number;
@@ -12435,7 +12586,7 @@
new(): SVGAnimatedInteger;
};
-/** The SVGAnimatedLength interface is used for attributes of basic type <length> which can be animated. */
+/** Used for attributes of basic type <length> which can be animated. */
interface SVGAnimatedLength {
readonly animVal: SVGLength;
readonly baseVal: SVGLength;
@@ -12446,7 +12597,7 @@
new(): SVGAnimatedLength;
};
-/** The SVGAnimatedLengthList interface is used for attributes of type SVGLengthList which can be animated. */
+/** Used for attributes of type SVGLengthList which can be animated. */
interface SVGAnimatedLengthList {
readonly animVal: SVGLengthList;
readonly baseVal: SVGLengthList;
@@ -12457,7 +12608,7 @@
new(): SVGAnimatedLengthList;
};
-/** The SVGAnimatedNumber interface is used for attributes of basic type <Number> which can be animated. */
+/** Used for attributes of basic type <Number> which can be animated. */
interface SVGAnimatedNumber {
readonly animVal: number;
baseVal: number;
@@ -12484,7 +12635,7 @@
readonly points: SVGPointList;
}
-/** The SVGAnimatedPreserveAspectRatio interface is used for attributes of type SVGPreserveAspectRatio which can be animated. */
+/** Used for attributes of type SVGPreserveAspectRatio which can be animated. */
interface SVGAnimatedPreserveAspectRatio {
readonly animVal: SVGPreserveAspectRatio;
readonly baseVal: SVGPreserveAspectRatio;
@@ -12495,7 +12646,7 @@
new(): SVGAnimatedPreserveAspectRatio;
};
-/** The SVGAnimatedRect interface is used for attributes of basic SVGRect which can be animated. */
+/** Used for attributes of basic SVGRect which can be animated. */
interface SVGAnimatedRect {
readonly animVal: DOMRectReadOnly;
readonly baseVal: DOMRect;
@@ -12517,7 +12668,7 @@
new(): SVGAnimatedString;
};
-/** The SVGAnimatedTransformList interface is used for attributes which take a list of numbers and which can be animated. */
+/** Used for attributes which take a list of numbers and which can be animated. */
interface SVGAnimatedTransformList {
readonly animVal: SVGTransformList;
readonly baseVal: SVGTransformList;
@@ -12544,8 +12695,8 @@
new(): SVGAnimationElement;
};
-/** The SVGCircleElement interface is an interface for the <circle> element. The circle element is defined by the cx and cy attributes that denote the coordinates of the centre of the circle. */
-interface SVGCircleElement extends SVGGraphicsElement {
+/** An interface for the <circle> element. The circle element is defined by the cx and cy attributes that denote the coordinates of the centre of the circle. */
+interface SVGCircleElement extends SVGGeometryElement {
readonly cx: SVGAnimatedLength;
readonly cy: SVGAnimatedLength;
readonly r: SVGAnimatedLength;
@@ -12560,7 +12711,7 @@
new(): SVGCircleElement;
};
-/** The SVGClipPathElement interface provides access to the properties of <clipPath> elements, as well as methods to manipulate them. */
+/** Provides access to the properties of <clipPath> elements, as well as methods to manipulate them. */
interface SVGClipPathElement extends SVGGraphicsElement {
readonly clipPathUnits: SVGAnimatedEnumeration;
addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGClipPathElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
@@ -12574,7 +12725,7 @@
new(): SVGClipPathElement;
};
-/** The SVGComponentTransferFunctionElement interface defines a base interface used by the component transfer function interfaces. */
+/** A base interface used by the component transfer function interfaces. */
interface SVGComponentTransferFunctionElement extends SVGElement {
readonly amplitude: SVGAnimatedNumber;
readonly exponent: SVGAnimatedNumber;
@@ -12620,7 +12771,7 @@
new(): SVGCursorElement;
};
-/** The SVGDefsElement interface corresponds to the <defs> element. */
+/** Corresponds to the <defs> element. */
interface SVGDefsElement extends SVGGraphicsElement {
addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGDefsElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
@@ -12633,7 +12784,7 @@
new(): SVGDefsElement;
};
-/** The SVGDescElement interface corresponds to the <desc> element. */
+/** Corresponds to the <desc> element. */
interface SVGDescElement extends SVGElement {
addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGDescElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
@@ -12688,8 +12839,8 @@
new(): SVGElementInstanceList;
};
-/** The SVGEllipseElement interface provides access to the properties of <ellipse> elements. */
-interface SVGEllipseElement extends SVGGraphicsElement {
+/** Provides access to the properties of <ellipse> elements. */
+interface SVGEllipseElement extends SVGGeometryElement {
readonly cx: SVGAnimatedLength;
readonly cy: SVGAnimatedLength;
readonly rx: SVGAnimatedLength;
@@ -12705,7 +12856,7 @@
new(): SVGEllipseElement;
};
-/** The SVGFEBlendElement interface corresponds to the <feBlend> element. */
+/** Corresponds to the <feBlend> element. */
interface SVGFEBlendElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {
readonly in1: SVGAnimatedString;
readonly in2: SVGAnimatedString;
@@ -12755,7 +12906,7 @@
readonly SVG_FEBLEND_MODE_UNKNOWN: number;
};
-/** The SVGFEColorMatrixElement interface corresponds to the <feColorMatrix> element. */
+/** Corresponds to the <feColorMatrix> element. */
interface SVGFEColorMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {
readonly in1: SVGAnimatedString;
readonly type: SVGAnimatedEnumeration;
@@ -12781,7 +12932,7 @@
readonly SVG_FECOLORMATRIX_TYPE_UNKNOWN: number;
};
-/** The SVGFEComponentTransferElement interface corresponds to the <feComponentTransfer> element. */
+/** Corresponds to the <feComponentTransfer> element. */
interface SVGFEComponentTransferElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {
readonly in1: SVGAnimatedString;
addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGFEComponentTransferElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
@@ -12795,7 +12946,7 @@
new(): SVGFEComponentTransferElement;
};
-/** The SVGFECompositeElement interface corresponds to the <feComposite> element. */
+/** Corresponds to the <feComposite> element. */
interface SVGFECompositeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {
readonly in1: SVGAnimatedString;
readonly in2: SVGAnimatedString;
@@ -12829,7 +12980,7 @@
readonly SVG_FECOMPOSITE_OPERATOR_XOR: number;
};
-/** The SVGFEConvolveMatrixElement interface corresponds to the <feConvolveMatrix> element. */
+/** Corresponds to the <feConvolveMatrix> element. */
interface SVGFEConvolveMatrixElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {
readonly bias: SVGAnimatedNumber;
readonly divisor: SVGAnimatedNumber;
@@ -12862,7 +13013,7 @@
readonly SVG_EDGEMODE_WRAP: number;
};
-/** The SVGFEDiffuseLightingElement interface corresponds to the <feDiffuseLighting> element. */
+/** Corresponds to the <feDiffuseLighting> element. */
interface SVGFEDiffuseLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {
readonly diffuseConstant: SVGAnimatedNumber;
readonly in1: SVGAnimatedString;
@@ -12880,7 +13031,7 @@
new(): SVGFEDiffuseLightingElement;
};
-/** The SVGFEDisplacementMapElement interface corresponds to the <feDisplacementMap> element. */
+/** Corresponds to the <feDisplacementMap> element. */
interface SVGFEDisplacementMapElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {
readonly in1: SVGAnimatedString;
readonly in2: SVGAnimatedString;
@@ -12908,7 +13059,7 @@
readonly SVG_CHANNEL_UNKNOWN: number;
};
-/** The SVGFEDistantLightElement interface corresponds to the <feDistantLight> element. */
+/** Corresponds to the <feDistantLight> element. */
interface SVGFEDistantLightElement extends SVGElement {
readonly azimuth: SVGAnimatedNumber;
readonly elevation: SVGAnimatedNumber;
@@ -12923,7 +13074,25 @@
new(): SVGFEDistantLightElement;
};
-/** The SVGFEFloodElement interface corresponds to the <feFlood> element. */
+interface SVGFEDropShadowElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {
+ readonly dx: SVGAnimatedNumber;
+ readonly dy: SVGAnimatedNumber;
+ readonly in1: SVGAnimatedString;
+ readonly stdDeviationX: SVGAnimatedNumber;
+ readonly stdDeviationY: SVGAnimatedNumber;
+ setStdDeviation(stdDeviationX: number, stdDeviationY: number): void;
+ addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGFEDropShadowElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
+ removeEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGFEDropShadowElement, ev: SVGElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
+}
+
+declare var SVGFEDropShadowElement: {
+ prototype: SVGFEDropShadowElement;
+ new(): SVGFEDropShadowElement;
+};
+
+/** Corresponds to the <feFlood> element. */
interface SVGFEFloodElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {
addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGFEFloodElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
@@ -12936,7 +13105,7 @@
new(): SVGFEFloodElement;
};
-/** The SVGFEFuncAElement interface corresponds to the <feFuncA> element. */
+/** Corresponds to the <feFuncA> element. */
interface SVGFEFuncAElement extends SVGComponentTransferFunctionElement {
addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGFEFuncAElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
@@ -12949,7 +13118,7 @@
new(): SVGFEFuncAElement;
};
-/** The SVGFEFuncBElement interface corresponds to the <feFuncB> element. */
+/** Corresponds to the <feFuncB> element. */
interface SVGFEFuncBElement extends SVGComponentTransferFunctionElement {
addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGFEFuncBElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
@@ -12962,7 +13131,7 @@
new(): SVGFEFuncBElement;
};
-/** The SVGFEFuncGElement interface corresponds to the <feFuncG> element. */
+/** Corresponds to the <feFuncG> element. */
interface SVGFEFuncGElement extends SVGComponentTransferFunctionElement {
addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGFEFuncGElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
@@ -12975,7 +13144,7 @@
new(): SVGFEFuncGElement;
};
-/** The SVGFEFuncRElement interface corresponds to the <feFuncR> element. */
+/** Corresponds to the <feFuncR> element. */
interface SVGFEFuncRElement extends SVGComponentTransferFunctionElement {
addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGFEFuncRElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
@@ -12988,7 +13157,7 @@
new(): SVGFEFuncRElement;
};
-/** The SVGFEGaussianBlurElement interface corresponds to the <feGaussianBlur> element. */
+/** Corresponds to the <feGaussianBlur> element. */
interface SVGFEGaussianBlurElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {
readonly in1: SVGAnimatedString;
readonly stdDeviationX: SVGAnimatedNumber;
@@ -13005,7 +13174,7 @@
new(): SVGFEGaussianBlurElement;
};
-/** The SVGFEImageElement interface corresponds to the <feImage> element. */
+/** Corresponds to the <feImage> element. */
interface SVGFEImageElement extends SVGElement, SVGFilterPrimitiveStandardAttributes, SVGURIReference {
readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio;
addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGFEImageElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
@@ -13019,7 +13188,7 @@
new(): SVGFEImageElement;
};
-/** The SVGFEMergeElement interface corresponds to the <feMerge> element. */
+/** Corresponds to the <feMerge> element. */
interface SVGFEMergeElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {
addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGFEMergeElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
@@ -13032,7 +13201,7 @@
new(): SVGFEMergeElement;
};
-/** The SVGFEMergeNodeElement interface corresponds to the <feMergeNode> element. */
+/** Corresponds to the <feMergeNode> element. */
interface SVGFEMergeNodeElement extends SVGElement {
readonly in1: SVGAnimatedString;
addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGFEMergeNodeElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
@@ -13046,7 +13215,7 @@
new(): SVGFEMergeNodeElement;
};
-/** The SVGFEMorphologyElement interface corresponds to the <feMorphology> element. */
+/** Corresponds to the <feMorphology> element. */
interface SVGFEMorphologyElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {
readonly in1: SVGAnimatedString;
readonly operator: SVGAnimatedEnumeration;
@@ -13069,7 +13238,7 @@
readonly SVG_MORPHOLOGY_OPERATOR_UNKNOWN: number;
};
-/** The SVGFEOffsetElement interface corresponds to the <feOffset> element. */
+/** Corresponds to the <feOffset> element. */
interface SVGFEOffsetElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {
readonly dx: SVGAnimatedNumber;
readonly dy: SVGAnimatedNumber;
@@ -13085,7 +13254,7 @@
new(): SVGFEOffsetElement;
};
-/** The SVGFEPointLightElement interface corresponds to the <fePointLight> element. */
+/** Corresponds to the <fePointLight> element. */
interface SVGFEPointLightElement extends SVGElement {
readonly x: SVGAnimatedNumber;
readonly y: SVGAnimatedNumber;
@@ -13101,7 +13270,7 @@
new(): SVGFEPointLightElement;
};
-/** The SVGFESpecularLightingElement interface corresponds to the <feSpecularLighting> element. */
+/** Corresponds to the <feSpecularLighting> element. */
interface SVGFESpecularLightingElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {
readonly in1: SVGAnimatedString;
readonly kernelUnitLengthX: SVGAnimatedNumber;
@@ -13120,7 +13289,7 @@
new(): SVGFESpecularLightingElement;
};
-/** The SVGFESpotLightElement interface corresponds to the <feSpotLight> element. */
+/** Corresponds to the <feSpotLight> element. */
interface SVGFESpotLightElement extends SVGElement {
readonly limitingConeAngle: SVGAnimatedNumber;
readonly pointsAtX: SVGAnimatedNumber;
@@ -13141,7 +13310,7 @@
new(): SVGFESpotLightElement;
};
-/** The SVGFETileElement interface corresponds to the <feTile> element. */
+/** Corresponds to the <feTile> element. */
interface SVGFETileElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {
readonly in1: SVGAnimatedString;
addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGFETileElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
@@ -13155,7 +13324,7 @@
new(): SVGFETileElement;
};
-/** The SVGFETurbulenceElement interface corresponds to the <feTurbulence> element. */
+/** Corresponds to the <feTurbulence> element. */
interface SVGFETurbulenceElement extends SVGElement, SVGFilterPrimitiveStandardAttributes {
readonly baseFrequencyX: SVGAnimatedNumber;
readonly baseFrequencyY: SVGAnimatedNumber;
@@ -13186,7 +13355,7 @@
readonly SVG_TURBULENCE_TYPE_UNKNOWN: number;
};
-/** The SVGFilterElement interface provides access to the properties of <filter> elements, as well as methods to manipulate them. */
+/** Provides access to the properties of <filter> elements, as well as methods to manipulate them. */
interface SVGFilterElement extends SVGElement, SVGURIReference {
/** @deprecated */
readonly filterResX: SVGAnimatedInteger;
@@ -13224,7 +13393,7 @@
readonly viewBox: SVGAnimatedRect;
}
-/** The SVGForeignObjectElement interface provides access to the properties of <foreignObject> elements, as well as methods to manipulate them. */
+/** Provides access to the properties of <foreignObject> elements, as well as methods to manipulate them. */
interface SVGForeignObjectElement extends SVGGraphicsElement {
readonly height: SVGAnimatedLength;
readonly width: SVGAnimatedLength;
@@ -13241,7 +13410,7 @@
new(): SVGForeignObjectElement;
};
-/** The SVGGElement interface corresponds to the <g> element. */
+/** Corresponds to the <g> element. */
interface SVGGElement extends SVGGraphicsElement {
addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGGElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
@@ -13295,7 +13464,7 @@
readonly SVG_SPREADMETHOD_UNKNOWN: number;
};
-/** The SVGGraphicsElement interface represents SVG elements whose primary purpose is to directly render graphics into a group. */
+/** SVG elements whose primary purpose is to directly render graphics into a group. */
interface SVGGraphicsElement extends SVGElement, SVGTests {
readonly transform: SVGAnimatedTransformList;
getBBox(options?: SVGBoundingBoxOptions): DOMRect;
@@ -13312,7 +13481,7 @@
new(): SVGGraphicsElement;
};
-/** The SVGImageElement interface corresponds to the <image> element. */
+/** Corresponds to the <image> element. */
interface SVGImageElement extends SVGGraphicsElement, SVGURIReference {
readonly height: SVGAnimatedLength;
readonly preserveAspectRatio: SVGAnimatedPreserveAspectRatio;
@@ -13330,7 +13499,7 @@
new(): SVGImageElement;
};
-/** The SVGLength interface correspond to the <length> basic data type. */
+/** Correspond to the <length> basic data type. */
interface SVGLength {
readonly unitType: number;
value: number;
@@ -13386,8 +13555,8 @@
new(): SVGLengthList;
};
-/** The SVGLineElement interface provides access to the properties of <line> elements, as well as methods to manipulate them. */
-interface SVGLineElement extends SVGGraphicsElement {
+/** Provides access to the properties of <line> elements, as well as methods to manipulate them. */
+interface SVGLineElement extends SVGGeometryElement {
readonly x1: SVGAnimatedLength;
readonly x2: SVGAnimatedLength;
readonly y1: SVGAnimatedLength;
@@ -13403,7 +13572,7 @@
new(): SVGLineElement;
};
-/** The SVGLinearGradientElement interface corresponds to the <linearGradient> element. */
+/** Corresponds to the <linearGradient> element. */
interface SVGLinearGradientElement extends SVGGradientElement {
readonly x1: SVGAnimatedLength;
readonly x2: SVGAnimatedLength;
@@ -13453,7 +13622,7 @@
readonly SVG_MARKER_ORIENT_UNKNOWN: number;
};
-/** The SVGMaskElement interface provides access to the properties of <mask> elements, as well as methods to manipulate them. */
+/** Provides access to the properties of <mask> elements, as well as methods to manipulate them. */
interface SVGMaskElement extends SVGElement, SVGTests {
readonly height: SVGAnimatedLength;
readonly maskContentUnits: SVGAnimatedEnumeration;
@@ -13472,7 +13641,7 @@
new(): SVGMaskElement;
};
-/** The SVGMetadataElement interface corresponds to the <metadata> element. */
+/** Corresponds to the <metadata> element. */
interface SVGMetadataElement extends SVGElement {
addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGMetadataElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
@@ -13485,7 +13654,7 @@
new(): SVGMetadataElement;
};
-/** The SVGNumber interface corresponds to the <number> basic data type. */
+/** Corresponds to the <number> basic data type. */
interface SVGNumber {
value: number;
}
@@ -13514,7 +13683,7 @@
new(): SVGNumberList;
};
-/** The SVGPathElement interface corresponds to the <path> element. */
+/** Corresponds to the <path> element. */
interface SVGPathElement extends SVGGraphicsElement {
/** @deprecated */
readonly pathSegList: SVGPathSegList;
@@ -13847,7 +14016,7 @@
new(): SVGPathSegMovetoRel;
};
-/** The SVGPatternElement interface corresponds to the <pattern> element. */
+/** Corresponds to the <pattern> element. */
interface SVGPatternElement extends SVGElement, SVGTests, SVGFitToViewBox, SVGURIReference {
readonly height: SVGAnimatedLength;
readonly patternContentUnits: SVGAnimatedEnumeration;
@@ -13868,14 +14037,16 @@
};
interface SVGPointList {
+ readonly length: number;
readonly numberOfItems: number;
- appendItem(newItem: SVGPoint): SVGPoint;
+ appendItem(newItem: DOMPoint): DOMPoint;
clear(): void;
- getItem(index: number): SVGPoint;
- initialize(newItem: SVGPoint): SVGPoint;
- insertItemBefore(newItem: SVGPoint, index: number): SVGPoint;
- removeItem(index: number): SVGPoint;
- replaceItem(newItem: SVGPoint, index: number): SVGPoint;
+ getItem(index: number): DOMPoint;
+ initialize(newItem: DOMPoint): DOMPoint;
+ insertItemBefore(newItem: DOMPoint, index: number): DOMPoint;
+ removeItem(index: number): DOMPoint;
+ replaceItem(newItem: DOMPoint, index: number): DOMPoint;
+ [index: number]: DOMPoint;
}
declare var SVGPointList: {
@@ -13883,8 +14054,8 @@
new(): SVGPointList;
};
-/** The SVGPolygonElement interface provides access to the properties of <polygon> elements, as well as methods to manipulate them. */
-interface SVGPolygonElement extends SVGGraphicsElement, SVGAnimatedPoints {
+/** Provides access to the properties of <polygon> elements, as well as methods to manipulate them. */
+interface SVGPolygonElement extends SVGGeometryElement, SVGAnimatedPoints {
addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGPolygonElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGPolygonElement, ev: SVGElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
@@ -13896,8 +14067,8 @@
new(): SVGPolygonElement;
};
-/** The SVGPolylineElement interface provides access to the properties of <polyline> elements, as well as methods to manipulate them. */
-interface SVGPolylineElement extends SVGGraphicsElement, SVGAnimatedPoints {
+/** Provides access to the properties of <polyline> elements, as well as methods to manipulate them. */
+interface SVGPolylineElement extends SVGGeometryElement, SVGAnimatedPoints {
addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGPolylineElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGPolylineElement, ev: SVGElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
@@ -13909,7 +14080,7 @@
new(): SVGPolylineElement;
};
-/** The SVGPreserveAspectRatio interface corresponds to the preserveAspectRatio attribute, which is available for some of SVG's elements. */
+/** Corresponds to the preserveAspectRatio attribute, which is available for some of SVG's elements. */
interface SVGPreserveAspectRatio {
align: number;
meetOrSlice: number;
@@ -13948,7 +14119,7 @@
readonly SVG_PRESERVEASPECTRATIO_XMINYMIN: number;
};
-/** The SVGRadialGradientElement interface corresponds to the <RadialGradient> element. */
+/** Corresponds to the <RadialGradient> element. */
interface SVGRadialGradientElement extends SVGGradientElement {
readonly cx: SVGAnimatedLength;
readonly cy: SVGAnimatedLength;
@@ -13966,8 +14137,8 @@
new(): SVGRadialGradientElement;
};
-/** The SVGRectElement interface provides access to the properties of <rect> elements, as well as methods to manipulate them. */
-interface SVGRectElement extends SVGGraphicsElement {
+/** Provides access to the properties of <rect> elements, as well as methods to manipulate them. */
+interface SVGRectElement extends SVGGeometryElement {
readonly height: SVGAnimatedLength;
readonly rx: SVGAnimatedLength;
readonly ry: SVGAnimatedLength;
@@ -13990,7 +14161,7 @@
"SVGZoom": SVGZoomEvent;
}
-/** The SVGSVGElement interface provides access to the properties of <svg> elements, as well as methods to manipulate them. This interface contains also various miscellaneous commonly-used utility methods, such as matrix operations and the ability to control the time of redraw on visual rendering devices. */
+/** Provides access to the properties of <svg> elements, as well as methods to manipulate them. This interface contains also various miscellaneous commonly-used utility methods, such as matrix operations and the ability to control the time of redraw on visual rendering devices. */
interface SVGSVGElement extends SVGGraphicsElement, DocumentEvent, SVGFitToViewBox, SVGZoomAndPan {
/** @deprecated */
contentScriptType: string;
@@ -14014,6 +14185,7 @@
readonly width: SVGAnimatedLength;
readonly x: SVGAnimatedLength;
readonly y: SVGAnimatedLength;
+ animationsPaused(): boolean;
checkEnclosure(element: SVGElement, rect: SVGRect): boolean;
checkIntersection(element: SVGElement, rect: SVGRect): boolean;
createSVGAngle(): SVGAngle;
@@ -14028,18 +14200,14 @@
/** @deprecated */
forceRedraw(): void;
getComputedStyle(elt: Element, pseudoElt?: string | null): CSSStyleDeclaration;
- /** @deprecated */
getCurrentTime(): number;
getElementById(elementId: string): Element;
getEnclosureList(rect: SVGRect, referenceElement: SVGElement): NodeListOf<SVGCircleElement | SVGEllipseElement | SVGImageElement | SVGLineElement | SVGPathElement | SVGPolygonElement | SVGPolylineElement | SVGRectElement | SVGTextElement | SVGUseElement>;
getIntersectionList(rect: SVGRect, referenceElement: SVGElement): NodeListOf<SVGCircleElement | SVGEllipseElement | SVGImageElement | SVGLineElement | SVGPathElement | SVGPolygonElement | SVGPolylineElement | SVGRectElement | SVGTextElement | SVGUseElement>;
- /** @deprecated */
pauseAnimations(): void;
- /** @deprecated */
setCurrentTime(seconds: number): void;
/** @deprecated */
suspendRedraw(maxWaitMilliseconds: number): number;
- /** @deprecated */
unpauseAnimations(): void;
/** @deprecated */
unsuspendRedraw(suspendHandleID: number): void;
@@ -14059,7 +14227,7 @@
readonly SVG_ZOOMANDPAN_UNKNOWN: number;
};
-/** The SVGScriptElement interface corresponds to the SVG <script> element. */
+/** Corresponds to the SVG <script> element. */
interface SVGScriptElement extends SVGElement, SVGURIReference {
type: string;
addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGScriptElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
@@ -14073,7 +14241,7 @@
new(): SVGScriptElement;
};
-/** The SVGStopElement interface corresponds to the <stop> element. */
+/** Corresponds to the <stop> element. */
interface SVGStopElement extends SVGElement {
readonly offset: SVGAnimatedNumber;
addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGStopElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
@@ -14106,7 +14274,7 @@
new(): SVGStringList;
};
-/** The SVGStyleElement interface corresponds to the SVG <style> element. */
+/** Corresponds to the SVG <style> element. */
interface SVGStyleElement extends SVGElement {
disabled: boolean;
media: string;
@@ -14123,7 +14291,7 @@
new(): SVGStyleElement;
};
-/** The SVGSwitchElement interface corresponds to the <switch> element. */
+/** Corresponds to the <switch> element. */
interface SVGSwitchElement extends SVGGraphicsElement {
addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGSwitchElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
@@ -14136,7 +14304,7 @@
new(): SVGSwitchElement;
};
-/** The SVGSymbolElement interface corresponds to the <symbol> element. */
+/** Corresponds to the <symbol> element. */
interface SVGSymbolElement extends SVGElement, SVGFitToViewBox {
addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGSymbolElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
@@ -14149,7 +14317,7 @@
new(): SVGSymbolElement;
};
-/** The SVGTSpanElement interface represents a <tspan> element. */
+/** A <tspan> element. */
interface SVGTSpanElement extends SVGTextPositioningElement {
addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGTSpanElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
@@ -14167,7 +14335,7 @@
readonly systemLanguage: SVGStringList;
}
-/** The SVGTextContentElement interface is implemented by elements that support rendering child text content. It is inherited by various text-related interfaces, such as SVGTextElement, SVGTSpanElement, SVGTRefElement, SVGAltGlyphElement and SVGTextPathElement. */
+/** Implemented by elements that support rendering child text content. It is inherited by various text-related interfaces, such as SVGTextElement, SVGTSpanElement, SVGTRefElement, SVGAltGlyphElement and SVGTextPathElement. */
interface SVGTextContentElement extends SVGGraphicsElement {
readonly lengthAdjust: SVGAnimatedEnumeration;
readonly textLength: SVGAnimatedLength;
@@ -14197,7 +14365,7 @@
readonly LENGTHADJUST_UNKNOWN: number;
};
-/** The SVGTextElement interface corresponds to the <text> elements. */
+/** Corresponds to the <text> elements. */
interface SVGTextElement extends SVGTextPositioningElement {
addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGTextElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
@@ -14210,7 +14378,7 @@
new(): SVGTextElement;
};
-/** The SVGTextPathElement interface corresponds to the <textPath> element. */
+/** Corresponds to the <textPath> element. */
interface SVGTextPathElement extends SVGTextContentElement, SVGURIReference {
readonly method: SVGAnimatedEnumeration;
readonly spacing: SVGAnimatedEnumeration;
@@ -14238,7 +14406,7 @@
readonly TEXTPATH_SPACINGTYPE_UNKNOWN: number;
};
-/** The SVGTextPositioningElement interface is implemented by elements that support attributes that position individual text glyphs. It is inherited by SVGTextElement, SVGTSpanElement, SVGTRefElement and SVGAltGlyphElement. */
+/** Implemented by elements that support attributes that position individual text glyphs. It is inherited by SVGTextElement, SVGTSpanElement, SVGTRefElement and SVGAltGlyphElement. */
interface SVGTextPositioningElement extends SVGTextContentElement {
readonly dx: SVGAnimatedLengthList;
readonly dy: SVGAnimatedLengthList;
@@ -14256,7 +14424,7 @@
new(): SVGTextPositioningElement;
};
-/** The SVGTitleElement interface corresponds to the <title> element. */
+/** Corresponds to the <title> element. */
interface SVGTitleElement extends SVGElement {
addEventListener<K extends keyof SVGElementEventMap>(type: K, listener: (this: SVGTitleElement, ev: SVGElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
@@ -14324,7 +14492,7 @@
readonly href: SVGAnimatedString;
}
-/** The SVGUnitTypes interface defines a commonly used set of constants used for reflecting gradientUnits, patternContentUnits and other similar attributes. */
+/** A commonly used set of constants used for reflecting gradientUnits, patternContentUnits and other similar attributes. */
interface SVGUnitTypes {
readonly SVG_UNIT_TYPE_OBJECTBOUNDINGBOX: number;
readonly SVG_UNIT_TYPE_UNKNOWN: number;
@@ -14339,7 +14507,7 @@
readonly SVG_UNIT_TYPE_USERSPACEONUSE: number;
};
-/** The SVGUseElement interface corresponds to the <use> element. */
+/** Corresponds to the <use> element. */
interface SVGUseElement extends SVGGraphicsElement, SVGURIReference {
readonly animatedInstanceRoot: SVGElementInstance | null;
readonly height: SVGAnimatedLength;
@@ -14358,7 +14526,7 @@
new(): SVGUseElement;
};
-/** The SVGViewElement interface provides access to the properties of <view> elements, as well as methods to manipulate them. */
+/** Provides access to the properties of <view> elements, as well as methods to manipulate them. */
interface SVGViewElement extends SVGElement, SVGFitToViewBox, SVGZoomAndPan {
/** @deprecated */
readonly viewTarget: SVGStringList;
@@ -14376,7 +14544,7 @@
readonly SVG_ZOOMANDPAN_UNKNOWN: number;
};
-/** The SVGZoomAndPan interface is used to reflect the zoomAndPan attribute, and is mixed in to other interfaces for elements that support this attribute. */
+/** Used to reflect the zoomAndPan attribute, and is mixed in to other interfaces for elements that support this attribute. */
interface SVGZoomAndPan {
readonly zoomAndPan: number;
}
@@ -14420,7 +14588,7 @@
new(): ScopedCredentialInfo;
};
-/** The Screen interface represents a screen, usually the one on which the current window is being rendered, and is obtained using window.screen. */
+/** A screen, usually the one on which the current window is being rendered, and is obtained using window.screen. */
interface Screen {
readonly availHeight: number;
readonly availWidth: number;
@@ -14461,7 +14629,7 @@
"audioprocess": AudioProcessingEvent;
}
-/** The ScriptProcessorNode interface allows the generation, processing, or analyzing of audio using JavaScript. */
+/** Allows the generation, processing, or analyzing of audio using JavaScript. */
interface ScriptProcessorNode extends AudioNode {
/** @deprecated */
readonly bufferSize: number;
@@ -14478,7 +14646,7 @@
new(): ScriptProcessorNode;
};
-/** The SecurityPolicyViolationEvent interface inherits from Event, and represents the event object of an event sent on a document or worker when its content security policy is violated. */
+/** Inherits from Event, and represents the event object of an event sent on a document or worker when its content security policy is violated. */
interface SecurityPolicyViolationEvent extends Event {
readonly blockedURI: string;
readonly columnNumber: number;
@@ -14537,12 +14705,13 @@
"statechange": Event;
}
-/** The ServiceWorker interface of the ServiceWorker API provides a reference to a service worker. Multiple browsing contexts (e.g. pages, workers, etc.) can be associated with the same service worker, each through a unique ServiceWorker object. */
+/** An interface of the ServiceWorker API provides a reference to a service worker. Multiple browsing contexts (e.g. pages, workers, etc.) can be associated with the same service worker, each through a unique ServiceWorker object. */
interface ServiceWorker extends EventTarget, AbstractWorker {
onstatechange: ((this: ServiceWorker, ev: Event) => any) | null;
readonly scriptURL: string;
readonly state: ServiceWorkerState;
- postMessage(message: any, transfer?: Transferable[]): void;
+ postMessage(message: any, transfer: Transferable[]): void;
+ postMessage(message: any, options?: PostMessageOptions): void;
addEventListener<K extends keyof ServiceWorkerEventMap>(type: K, listener: (this: ServiceWorker, ev: ServiceWorkerEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof ServiceWorkerEventMap>(type: K, listener: (this: ServiceWorker, ev: ServiceWorkerEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
@@ -14582,7 +14751,7 @@
new(): ServiceWorkerContainer;
};
-/** The ServiceWorkerMessageEvent interface of the ServiceWorker API contains information about an event sent to a ServiceWorkerContainer target. This extends the default message event to allow setting a ServiceWorker object as the source of a message. The event object is accessed via the handler function of a message event, when fired by a message received from a service worker. */
+/** An interface of the ServiceWorker API contains information about an event sent to a ServiceWorkerContainer target. This extends the default message event to allow setting a ServiceWorker object as the source of a message. The event object is accessed via the handler function of a message event, when fired by a message received from a service worker. */
interface ServiceWorkerMessageEvent extends Event {
readonly data: any;
readonly lastEventId: string;
@@ -14600,7 +14769,7 @@
"updatefound": Event;
}
-/** The ServiceWorkerRegistration interface of the ServiceWorker API represents the service worker registration. You register a service worker to control one or more pages that share the same origin. */
+/** An interface of the ServiceWorker API represents the service worker registration. You register a service worker to control one or more pages that share the same origin. */
interface ServiceWorkerRegistration extends EventTarget {
readonly active: ServiceWorker | null;
readonly installing: ServiceWorker | null;
@@ -14626,9 +14795,8 @@
new(): ServiceWorkerRegistration;
};
-interface ShadowRoot extends DocumentFragment, DocumentOrShadowRoot {
+interface ShadowRoot extends DocumentFragment, DocumentOrShadowRoot, InnerHTML {
readonly host: Element;
- innerHTML: string;
readonly mode: ShadowRootMode;
}
@@ -14649,7 +14817,7 @@
"updatestart": Event;
}
-/** The SourceBuffer interface represents a chunk of media to be passed into an HTMLMediaElement and played, via a MediaSource object. This can be made up of one or several media segments. */
+/** A chunk of media to be passed into an HTMLMediaElement and played, via a MediaSource object. This can be made up of one or several media segments. */
interface SourceBuffer extends EventTarget {
appendWindowEnd: number;
appendWindowStart: number;
@@ -14684,7 +14852,7 @@
"removesourcebuffer": Event;
}
-/** The SourceBufferList interface represents a simple container list for multiple SourceBuffer objects. */
+/** A simple container list for multiple SourceBuffer objects. */
interface SourceBufferList extends EventTarget {
readonly length: number;
onaddsourcebuffer: ((this: SourceBufferList, ev: Event) => any) | null;
@@ -14829,7 +14997,7 @@
"voiceschanged": Event;
}
-/** The SpeechSynthesis interface of the Web Speech API is the controller interface for the speech service; this can be used to retrieve information about the synthesis voices available on the device, start and pause speech, and other commands besides. */
+/** An interface of the Web Speech API is the controller interface for the speech service; this can be used to retrieve information about the synthesis voices available on the device, start and pause speech, and other commands besides. */
interface SpeechSynthesis extends EventTarget {
onvoiceschanged: ((this: SpeechSynthesis, ev: Event) => any) | null;
readonly paused: boolean;
@@ -14860,7 +15028,7 @@
new(): SpeechSynthesisErrorEvent;
};
-/** The SpeechSynthesisEvent interface of the Web Speech API contains information about the current state of SpeechSynthesisUtterance objects that have been processed in the speech service. */
+/** An interface of the Web Speech API contains information about the current state of SpeechSynthesisUtterance objects that have been processed in the speech service. */
interface SpeechSynthesisEvent extends Event {
readonly charIndex: number;
readonly elapsedTime: number;
@@ -14883,7 +15051,7 @@
"start": SpeechSynthesisEvent;
}
-/** The SpeechSynthesisUtterance interface of the Web Speech API represents a speech request. It contains the content the speech service should read and information about how to read it (e.g. language, pitch and volume.) */
+/** An interface of the Web Speech API represents a speech request. It contains the content the speech service should read and information about how to read it (e.g. language, pitch and volume.) */
interface SpeechSynthesisUtterance extends EventTarget {
lang: string;
onboundary: ((this: SpeechSynthesisUtterance, ev: SpeechSynthesisEvent) => any) | null;
@@ -14910,7 +15078,7 @@
new(text: string): SpeechSynthesisUtterance;
};
-/** The SpeechSynthesisVoice interface of the Web Speech API represents a voice that the system supports. Every SpeechSynthesisVoice has its own relative speech service including information about language, name and URI. */
+/** An interface of the Web Speech API represents a voice that the system supports. Every SpeechSynthesisVoice has its own relative speech service including information about language, name and URI. */
interface SpeechSynthesisVoice {
readonly default: boolean;
readonly lang: string;
@@ -14942,7 +15110,7 @@
new(context: BaseAudioContext, options?: StereoPannerOptions): StereoPannerNode;
};
-/** The Storage interface of the Web Storage API provides access to a particular domain's session or local storage. It allows, for example, the addition, modification, or deletion of stored data items. */
+/** An interface of the Web Storage API provides access to a particular domain's session or local storage. It allows, for example, the addition, modification, or deletion of stored data items. */
interface Storage {
/**
* Returns the number of key/value pairs currently present in the list associated with the
@@ -15028,7 +15196,7 @@
new(): StyleMedia;
};
-/** An object implementing the StyleSheet interface represents a single style sheet. CSS style sheets will further implement the more specialized CSSStyleSheet interface. */
+/** A single style sheet. CSS style sheets will further implement the more specialized CSSStyleSheet interface. */
interface StyleSheet {
disabled: boolean;
readonly href: string | null;
@@ -15044,7 +15212,7 @@
new(): StyleSheet;
};
-/** The StyleSheetList interface represents a list of StyleSheet. */
+/** A list of StyleSheet. */
interface StyleSheetList {
readonly length: number;
item(index: number): StyleSheet | null;
@@ -15056,7 +15224,7 @@
new(): StyleSheetList;
};
-/** The SubtleCrypto interface represents a set of cryptographic primitives. It is available via the Crypto.subtle properties available in a window context (via Window.crypto). */
+/** An interface of the Web Crypto API provides a number of low-level cryptographic functions. It is accessed via the Crypto.subtle properties available in a window context (via Window.crypto). */
interface SubtleCrypto {
decrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer): PromiseLike<ArrayBuffer>;
deriveBits(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, length: number): PromiseLike<ArrayBuffer>;
@@ -15083,7 +15251,7 @@
new(): SubtleCrypto;
};
-/** The SyncManager interface of the the ServiceWorker API provides an interface for registering and listing sync registrations. */
+/** An interface of the ServiceWorker API provides an interface for registering and listing sync registrations. */
interface SyncManager {
getTags(): Promise<string[]>;
register(tag: string): Promise<void>;
@@ -15094,7 +15262,7 @@
new(): SyncManager;
};
-/** The Text interface represents the textual content of Element or Attr.  If an element has no markup within its content, it has a single child implementing Text that contains the element's text.  However, if the element contains markup, it is parsed into information items and Text nodes that form its children. */
+/** The textual content of Element or Attr. If an element has no markup within its content, it has a single child implementing Text that contains the element's text. However, if the element contains markup, it is parsed into information items and Text nodes that form its children. */
interface Text extends CharacterData, Slotable {
readonly assignedSlot: HTMLSlotElement | null;
/**
@@ -15112,24 +15280,11 @@
new(data?: string): Text;
};
-/** The TextDecoder interface represents a decoder for a specific method, that is a specific character encoding, like utf-8, iso-8859-2, koi8, cp1261, gbk, etc. A decoder takes a stream of bytes as input and emits a stream of code points. For a more scalable, non-native library, see StringView – a C-like representation of strings based on typed arrays. */
-interface TextDecoder {
- /**
- * Returns encoding's name, lowercased.
- */
- readonly encoding: string;
- /**
- * Returns true if error mode is "fatal", and false
- * otherwise.
- */
- readonly fatal: boolean;
+/** A decoder for a specific method, that is a specific character encoding, like utf-8, iso-8859-2, koi8, cp1261, gbk, etc. A decoder takes a stream of bytes as input and emits a stream of code points. For a more scalable, non-native library, see StringView – a C-like representation of strings based on typed arrays. */
+interface TextDecoder extends TextDecoderCommon {
/**
- * Returns true if ignore BOM flag is set, and false otherwise.
- */
- readonly ignoreBOM: boolean;
- /**
- * Returns the result of running encoding's decoder. The
- * method can be invoked zero or more times with options's stream set to
+ * Returns the result of running encoding's decoder.
+ * The method can be invoked zero or more times with options's stream set to
* true, and then once without options's stream (or set to false), to process
* a fragmented stream. If the invocation without options's stream (or set to
* false) has no input, it's clearest to omit both arguments.
@@ -15148,16 +15303,30 @@
new(label?: string, options?: TextDecoderOptions): TextDecoder;
};
-/** TextEncoder takes a stream of code points as input and emits a stream of bytes. For a more scalable, non-native library, see StringView – a C-like representation of strings based on typed arrays. */
-interface TextEncoder {
- /**
- * Returns "utf-8".
- */
+interface TextDecoderCommon {
readonly encoding: string;
+ readonly fatal: boolean;
+ readonly ignoreBOM: boolean;
+}
+
+interface TextDecoderStream extends TextDecoderCommon, GenericTransformStream {
+}
+
+declare var TextDecoderStream: {
+ prototype: TextDecoderStream;
+ new(label?: string, options?: TextDecoderOptions): TextDecoderStream;
+};
+
+/** TextEncoder takes a stream of code points as input and emits a stream of bytes. For a more scalable, non-native library, see StringView – a C-like representation of strings based on typed arrays. */
+interface TextEncoder extends TextEncoderCommon {
/**
* Returns the result of running UTF-8's encoder.
*/
encode(input?: string): Uint8Array;
+ /**
+ * Runs the UTF-8 encoder on source, stores the result of that operation into destination, and returns the progress made as a dictionary whereby read is the number of converted code units of source and written is the number of bytes modified in destination.
+ */
+ encodeInto(source: string, destination: Uint8Array): TextEncoderEncodeIntoResult;
}
declare var TextEncoder: {
@@ -15165,6 +15334,18 @@
new(): TextEncoder;
};
+interface TextEncoderCommon {
+ readonly encoding: string;
+}
+
+interface TextEncoderStream extends TextEncoderCommon, GenericTransformStream {
+}
+
+declare var TextEncoderStream: {
+ prototype: TextEncoderStream;
+ new(): TextEncoderStream;
+};
+
interface TextEvent extends UIEvent {
readonly data: string;
initTextEvent(typeArg: string, canBubbleArg: boolean, cancelableArg: boolean, viewArg: Window, dataArg: string, inputMethod: number, locale: string): void;
@@ -15195,7 +15376,7 @@
readonly DOM_INPUT_METHOD_VOICE: number;
};
-/** The TextMetrics interface represents the dimension of a text in the canvas, as created by the CanvasRenderingContext2D.measureText() method. */
+/** The dimensions of a piece of text in the canvas, as created by the CanvasRenderingContext2D.measureText() method. */
interface TextMetrics {
readonly actualBoundingBoxAscent: number;
readonly actualBoundingBoxDescent: number;
@@ -15325,7 +15506,7 @@
new(): TextTrackList;
};
-/** The TimeRanges interface is used to represent a set of time ranges, primarily for the purpose of tracking which portions of media have been buffered when loading it for use by the <audio> and <video> elements. */
+/** Used to represent a set of time ranges, primarily for the purpose of tracking which portions of media have been buffered when loading it for use by the <audio> and <video> elements. */
interface TimeRanges {
readonly length: number;
end(index: number): number;
@@ -15337,7 +15518,7 @@
new(): TimeRanges;
};
-/** The Touch interface represents a single contact point on a touch-sensitive device. The contact point is commonly a finger or stylus and the device may be a touchscreen or trackpad. */
+/** A single contact point on a touch-sensitive device. The contact point is commonly a finger or stylus and the device may be a touchscreen or trackpad. */
interface Touch {
readonly altitudeAngle: number;
readonly azimuthAngle: number;
@@ -15361,7 +15542,7 @@
new(touchInitDict: TouchInit): Touch;
};
-/** The TouchEvent interface represents an event sent when the state of contacts with a touch-sensitive surface changes. This surface can be a touch screen or trackpad, for example. The event can describe one or more points of contact with the screen and includes support for detecting movement, addition and removal of contact points, and so forth. */
+/** An event sent when the state of contacts with a touch-sensitive surface changes. This surface can be a touch screen or trackpad, for example. The event can describe one or more points of contact with the screen and includes support for detecting movement, addition and removal of contact points, and so forth. */
interface TouchEvent extends UIEvent {
readonly altKey: boolean;
readonly changedTouches: TouchList;
@@ -15377,7 +15558,7 @@
new(type: string, eventInitDict?: TouchEventInit): TouchEvent;
};
-/** The TouchList interface represents a list of contact points with a touch surface; for example, if the user has three fingers on the touch surface (such as a screen or trackpad), the corresponding TouchList object would have one Touch object for each finger, for a total of three entries. */
+/** A list of contact points on a touch surface. For example, if the user has three fingers on the touch surface (such as a screen or trackpad), the corresponding TouchList object would have one Touch object for each finger, for a total of three entries. */
interface TouchList {
readonly length: number;
item(index: number): Touch | null;
@@ -15416,7 +15597,7 @@
terminate(): void;
}
-/** The TransitionEvent interface represents events providing information related to transitions. */
+/** Events providing information related to transitions. */
interface TransitionEvent extends Event {
readonly elapsedTime: number;
readonly propertyName: string;
@@ -15428,7 +15609,7 @@
new(type: string, transitionEventInitDict?: TransitionEventInit): TransitionEvent;
};
-/** The TreeWalker object represents the nodes of a document subtree and a position within them. */
+/** The nodes of a document subtree and a position within them. */
interface TreeWalker {
currentNode: Node;
readonly filter: NodeFilter | null;
@@ -15448,7 +15629,7 @@
new(): TreeWalker;
};
-/** The UIEvent interface represents simple user interface events. */
+/** Simple user interface events. */
interface UIEvent extends Event {
readonly detail: number;
readonly view: Window;
@@ -15521,7 +15702,7 @@
new(init?: string[][] | Record<string, string> | string | URLSearchParams): URLSearchParams;
};
-/** The VRDisplay interface of the WebVR API represents any VR device supported by this API. It includes generic information such as device IDs and descriptions, as well as methods for starting to present a VR scene, retrieving eye parameters and display capabilities, and other important functionality. */
+/** An interface of the WebVR API represents any VR device supported by this API . It includes generic information such as device IDs and descriptions, as well as methods for starting to present a VR scene, retrieving eye parameters and display capabilities, and other important functionality. */
interface VRDisplay extends EventTarget {
readonly capabilities: VRDisplayCapabilities;
depthFar: number;
@@ -15549,7 +15730,7 @@
new(): VRDisplay;
};
-/** The VRDisplayCapabilities interface of the WebVR API describes the capabilities of a VRDisplay — its features can be used to perform VR device capability tests, for example can it return position information. */
+/** An interface of the WebVR API describes the capabilities of a VRDisplay — its features can be used to perform VR device capability tests, for example can it return position information. */
interface VRDisplayCapabilities {
readonly canPresent: boolean;
readonly hasExternalDisplay: boolean;
@@ -15563,7 +15744,7 @@
new(): VRDisplayCapabilities;
};
-/** The VRDisplayEvent interface of the WebVR API represents represents the event object of WebVR-related events (see the list of WebVR window extensions). */
+/** An interface of the WebVR API represents represents the event object of WebVR-related events (see the list of WebVR window extensions). */
interface VRDisplayEvent extends Event {
readonly display: VRDisplay;
readonly reason: VRDisplayEventReason | null;
@@ -15574,7 +15755,7 @@
new(type: string, eventInitDict: VRDisplayEventInit): VRDisplayEvent;
};
-/** The VREyeParameters interface of the WebVR API represents all the information required to correctly render a scene for a given eye, including field of view information. */
+/** An interface of the WebVR API represents all the information required to correctly render a scene for a given eye, including field of view information. */
interface VREyeParameters {
/** @deprecated */
readonly fieldOfView: VRFieldOfView;
@@ -15588,7 +15769,7 @@
new(): VREyeParameters;
};
-/** The VRFieldOfView interface of the WebVR API represents a field of view defined by 4 different degree values describing the view from a center point. */
+/** An interface of the WebVR API represents a field of view defined by 4 different degree values describing the view from a center point. */
interface VRFieldOfView {
readonly downDegrees: number;
readonly leftDegrees: number;
@@ -15601,7 +15782,7 @@
new(): VRFieldOfView;
};
-/** The VRFrameData interface of the WebVR API represents all the information needed to render a single frame of a VR scene; constructed by VRDisplay.getFrameData(). */
+/** An interface of the WebVR API represents all the information needed to render a single frame of a VR scene; constructed by VRDisplay.getFrameData(). */
interface VRFrameData {
readonly leftProjectionMatrix: Float32Array;
readonly leftViewMatrix: Float32Array;
@@ -15616,7 +15797,7 @@
new(): VRFrameData;
};
-/** The VRPose interface of the WebVR API represents the state of a VR sensor at a given timestamp (which includes orientation, position, velocity, and acceleration information.) */
+/** An interface of the WebVR API represents the state of a VR sensor at a given timestamp (which includes orientation, position, velocity, and acceleration information.) */
interface VRPose {
readonly angularAcceleration: Float32Array | null;
readonly angularVelocity: Float32Array | null;
@@ -15671,7 +15852,7 @@
new(): VTTRegion;
};
-/** The ValidityState interface represents the validity states that an element can be in, with respect to constraint validation. Together, they help explain why an element's value fails to validate, if it's not valid. */
+/** The validity states that an element can be in, with respect to constraint validation. Together, they help explain why an element's value fails to validate, if it's not valid. */
interface ValidityState {
readonly badInput: boolean;
readonly customError: boolean;
@@ -15691,7 +15872,7 @@
new(): ValidityState;
};
-/** A VideoPlaybackQuality object is returned by the HTMLVideoElement.getVideoPlaybackQuality() method and contains metrics that can be used to determine the playback quality of a video. */
+/** Returned by the HTMLVideoElement.getVideoPlaybackQuality() method and contains metrics that can be used to determine the playback quality of a video. */
interface VideoPlaybackQuality {
readonly corruptedVideoFrames: number;
readonly creationTime: number;
@@ -15705,7 +15886,7 @@
new(): VideoPlaybackQuality;
};
-/** The VideoTrack interface represents a single video track from a <video> element. */
+/** A single video track from a <video> element. */
interface VideoTrack {
readonly id: string;
kind: string;
@@ -15726,7 +15907,7 @@
"removetrack": TrackEvent;
}
-/** The VideoTrackList interface is used to represent a list of the video tracks contained within a <video> element, with each track represented by a separate VideoTrack object in the list. */
+/** Used to represent a list of the video tracks contained within a <video> element, with each track represented by a separate VideoTrack object in the list. */
interface VideoTrackList extends EventTarget {
readonly length: number;
onaddtrack: ((this: VideoTrackList, ev: TrackEvent) => any) | null;
@@ -15891,7 +16072,7 @@
new(): WebAuthnAssertion;
};
-/** The WebGLActiveInfo interface is part of the WebGL API and represents the information returned by calling the WebGLRenderingContext.getActiveAttrib() and WebGLRenderingContext.getActiveUniform() methods. */
+/** Part of the WebGL API and represents the information returned by calling the WebGLRenderingContext.getActiveAttrib() and WebGLRenderingContext.getActiveUniform() methods. */
interface WebGLActiveInfo {
readonly name: string;
readonly size: GLint;
@@ -15903,7 +16084,7 @@
new(): WebGLActiveInfo;
};
-/** The WebGLBuffer interface is part of the WebGL API and represents an opaque buffer object storing data such as vertices or colors. */
+/** Part of the WebGL API and represents an opaque buffer object storing data such as vertices or colors. */
interface WebGLBuffer extends WebGLObject {
}
@@ -15922,7 +16103,7 @@
new(type: string, eventInit?: WebGLContextEventInit): WebGLContextEvent;
};
-/** The WebGLFramebuffer interface is part of the WebGL API and represents a collection of buffers that serve as a rendering destination. */
+/** Part of the WebGL API and represents a collection of buffers that serve as a rendering destination. */
interface WebGLFramebuffer extends WebGLObject {
}
@@ -15948,7 +16129,7 @@
new(): WebGLProgram;
};
-/** The WebGLRenderbuffer interface is part of the WebGL API and represents a buffer that can contain an image, or can be source or target of an rendering operation. */
+/** Part of the WebGL API and represents a buffer that can contain an image, or can be source or target of an rendering operation. */
interface WebGLRenderbuffer extends WebGLObject {
}
@@ -15957,7 +16138,7 @@
new(): WebGLRenderbuffer;
};
-/** The WebGLRenderingContext interface provides an interface to the OpenGL ES 2.0 graphics rendering context for the drawing surface of an HTML <canvas> element. */
+/** Provides an interface to the OpenGL ES 2.0 graphics rendering context for the drawing surface of an HTML <canvas> element. */
interface WebGLRenderingContext extends WebGLRenderingContextBase {
}
@@ -16734,7 +16915,7 @@
new(): WebGLShader;
};
-/** The WebGLShaderPrecisionFormat interface is part of the WebGL API and represents the information returned by calling the WebGLRenderingContext.getShaderPrecisionFormat() method. */
+/** Part of the WebGL API and represents the information returned by calling the WebGLRenderingContext.getShaderPrecisionFormat() method. */
interface WebGLShaderPrecisionFormat {
readonly precision: GLint;
readonly rangeMax: GLint;
@@ -16746,7 +16927,7 @@
new(): WebGLShaderPrecisionFormat;
};
-/** The WebGLTexture interface is part of the WebGL API and represents an opaque texture object providing storage and state for texturing operations. */
+/** Part of the WebGL API and represents an opaque texture object providing storage and state for texturing operations. */
interface WebGLTexture extends WebGLObject {
}
@@ -16755,7 +16936,7 @@
new(): WebGLTexture;
};
-/** The WebGLUniformLocation interface is part of the WebGL API and represents the location of a uniform variable in a shader program. */
+/** Part of the WebGL API and represents the location of a uniform variable in a shader program. */
interface WebGLUniformLocation {
}
@@ -16784,7 +16965,7 @@
"open": Event;
}
-/** The WebSocket object provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection. */
+/** Provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection. */
interface WebSocket extends EventTarget {
binaryType: BinaryType;
readonly bufferedAmount: number;
@@ -16817,7 +16998,7 @@
readonly OPEN: number;
};
-/** The WheelEvent interface represents events that occur due to the user moving a mouse wheel or similar input device. */
+/** Events that occur due to the user moving a mouse wheel or similar input device. */
interface WheelEvent extends MouseEvent {
readonly deltaMode: number;
readonly deltaX: number;
@@ -16854,6 +17035,7 @@
"devicelight": DeviceLightEvent;
"devicemotion": DeviceMotionEvent;
"deviceorientation": DeviceOrientationEvent;
+ "deviceorientationabsolute": DeviceOrientationEvent;
"drag": DragEvent;
"dragend": DragEvent;
"dragenter": DragEvent;
@@ -16937,9 +17119,11 @@
"waiting": Event;
}
-/** The Window interface represents a window containing a DOM document; the document property points to the DOM document loaded in that window. */
+/** A window containing a DOM document; the document property points to the DOM document loaded in that window. */
interface Window extends EventTarget, WindowTimers, WindowSessionStorage, WindowLocalStorage, WindowConsole, GlobalEventHandlers, IDBEnvironment, WindowBase64, GlobalFetch, WindowOrWorkerGlobalScope, WindowEventHandlers {
Blob: typeof Blob;
+ TextDecoder: typeof TextDecoder;
+ TextEncoder: typeof TextEncoder;
URL: typeof URL;
URLSearchParams: typeof URLSearchParams;
readonly applicationCache: ApplicationCache;
@@ -16974,6 +17158,7 @@
ondevicelight: ((this: Window, ev: DeviceLightEvent) => any) | null;
ondevicemotion: ((this: Window, ev: DeviceMotionEvent) => any) | null;
ondeviceorientation: ((this: Window, ev: DeviceOrientationEvent) => any) | null;
+ ondeviceorientationabsolute: ((this: Window, ev: DeviceOrientationEvent) => any) | null;
onmousewheel: ((this: Window, ev: Event) => any) | null;
onmsgesturechange: ((this: Window, ev: Event) => any) | null;
onmsgesturedoubletap: ((this: Window, ev: Event) => any) | null;
@@ -17068,6 +17253,7 @@
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof WindowEventMap>(type: K, listener: (this: Window, ev: WindowEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
+ [index: number]: Window;
}
declare var Window: {
@@ -17159,10 +17345,11 @@
"message": MessageEvent;
}
-/** The Worker interface of the Web Workers API represents a background task that can be easily created and can send messages back to its creator. Creating a worker is as simple as calling the Worker() constructor and specifying a script to be run in the worker thread. */
+/** An interface of the Web Workers API represents a background task that can be easily created and can send messages back to its creator. Creating a worker is as simple as calling the Worker() constructor and specifying a script to be run in the worker thread. */
interface Worker extends EventTarget, AbstractWorker {
onmessage: ((this: Worker, ev: MessageEvent) => any) | null;
- postMessage(message: any, transfer?: Transferable[]): void;
+ postMessage(message: any, transfer: Transferable[]): void;
+ postMessage(message: any, options?: PostMessageOptions): void;
terminate(): void;
addEventListener<K extends keyof WorkerEventMap>(type: K, listener: (this: Worker, ev: WorkerEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
@@ -17184,7 +17371,7 @@
new(): Worklet;
};
-/** The WritableStream interface of the the Streams API provides a standard abstraction for writing streaming data to a destination, known as a sink. This object comes with built-in backpressure and queuing. */
+/** An interface of the Streams API provides a standard abstraction for writing streaming data to a destination, known as a sink. This object comes with built-in backpressure and queuing. */
interface WritableStream<W = any> {
readonly locked: boolean;
abort(reason?: any): Promise<void>;
@@ -17196,12 +17383,12 @@
new<W = any>(underlyingSink?: UnderlyingSink<W>, strategy?: QueuingStrategy<W>): WritableStream<W>;
};
-/** The WritableStreamDefaultController interface of the the Streams API represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate. */
+/** An interface of the Streams API represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate. */
interface WritableStreamDefaultController {
error(error?: any): void;
}
-/** The WritableStreamDefaultWriter interface of the the Streams API is the object returned by WritableStream.getWriter() and once created locks the < writer to the WritableStream ensuring that no other streams can write to the underlying sink. */
+/** An interface of the Streams API is the object returned by WritableStream.getWriter() and once created locks the < writer to the WritableStream ensuring that no other streams can write to the underlying sink. */
interface WritableStreamDefaultWriter<W = any> {
readonly closed: Promise<void>;
readonly desiredSize: number | null;
@@ -17212,7 +17399,7 @@
write(chunk: W): Promise<void>;
}
-/** The XMLDocument interface represent an XML document. It inherits from the generic Document and does not add any specific methods or properties to it: nevertheless, several algorithms behave differently with the two types of documents. */
+/** An XML document. It inherits from the generic Document and does not add any specific methods or properties to it: nevertheless, several algorithms behave differently with the two types of documents. */
interface XMLDocument extends Document {
addEventListener<K extends keyof DocumentEventMap>(type: K, listener: (this: XMLDocument, ev: DocumentEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
@@ -17383,7 +17570,7 @@
new(): XMLHttpRequestUpload;
};
-/** The XMLSerializer interface provides the serializeToString() method to construct an XML string representing a DOM tree. */
+/** Provides the serializeToString() method to construct an XML string representing a DOM tree. */
interface XMLSerializer {
serializeToString(root: Node): string;
}
@@ -17393,10 +17580,8 @@
new(): XMLSerializer;
};
-interface XPathEvaluator {
- createExpression(expression: string, resolver: XPathNSResolver): XPathExpression;
- createNSResolver(nodeResolver?: Node): XPathNSResolver;
- evaluate(expression: string, contextNode: Node, resolver: XPathNSResolver | ((prefix: string) => string | null) | null, type: number, result: XPathResult | null): XPathResult;
+/** The XPathEvaluator interface allows to compile and evaluate XPath expressions. */
+interface XPathEvaluator extends XPathEvaluatorBase {
}
declare var XPathEvaluator: {
@@ -17404,9 +17589,15 @@
new(): XPathEvaluator;
};
-/** An XPathExpression is a compiled XPath query returned from document.createExpression(). It has a method evaluate() which can be used to execute the compiled XPath. */
+interface XPathEvaluatorBase {
+ createExpression(expression: string, resolver?: XPathNSResolver | null): XPathExpression;
+ createNSResolver(nodeResolver: Node): XPathNSResolver;
+ evaluate(expression: string, contextNode: Node, resolver?: XPathNSResolver | null, type?: number, result?: XPathResult | null): XPathResult;
+}
+
+/** This interface is a compiled XPath expression that can be evaluated on a document or specific node to return information its DOM tree. */
interface XPathExpression {
- evaluate(contextNode: Node, type: number, result: XPathResult | null): XPathResult;
+ evaluate(contextNode: Node, type?: number, result?: XPathResult | null): XPathResult;
}
declare var XPathExpression: {
@@ -17414,26 +17605,17 @@
new(): XPathExpression;
};
-interface XPathNSResolver {
- lookupNamespaceURI(prefix: string): string | null;
-}
-
-declare var XPathNSResolver: {
- prototype: XPathNSResolver;
- new(): XPathNSResolver;
-};
-
-/** The XPathResult interface represents the results generated by evaluating an XPath 1.0 expression within the context of a given node. */
+/** The results generated by evaluating an XPath expression within the context of a given node. */
interface XPathResult {
readonly booleanValue: boolean;
readonly invalidIteratorState: boolean;
readonly numberValue: number;
readonly resultType: number;
- readonly singleNodeValue: Node;
+ readonly singleNodeValue: Node | null;
readonly snapshotLength: number;
readonly stringValue: string;
- iterateNext(): Node;
- snapshotItem(index: number): Node;
+ iterateNext(): Node | null;
+ snapshotItem(index: number): Node | null;
readonly ANY_TYPE: number;
readonly ANY_UNORDERED_NODE_TYPE: number;
readonly BOOLEAN_TYPE: number;
@@ -17492,6 +17674,123 @@
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
+declare namespace WebAssembly {
+ interface CompileError {
+ }
+
+ var CompileError: {
+ prototype: CompileError;
+ new(): CompileError;
+ };
+
+ interface Global {
+ value: any;
+ valueOf(): any;
+ }
+
+ var Global: {
+ prototype: Global;
+ new(descriptor: GlobalDescriptor, value?: any): Global;
+ };
+
+ interface Instance {
+ readonly exports: any;
+ }
+
+ var Instance: {
+ prototype: Instance;
+ new(module: Module, importObject?: any): Instance;
+ };
+
+ interface LinkError {
+ }
+
+ var LinkError: {
+ prototype: LinkError;
+ new(): LinkError;
+ };
+
+ interface Memory {
+ readonly buffer: ArrayBuffer;
+ grow(delta: number): number;
+ }
+
+ var Memory: {
+ prototype: Memory;
+ new(descriptor: MemoryDescriptor): Memory;
+ };
+
+ interface Module {
+ }
+
+ var Module: {
+ prototype: Module;
+ new(bytes: BufferSource): Module;
+ customSections(module: Module, sectionName: string): ArrayBuffer[];
+ exports(module: Module): ModuleExportDescriptor[];
+ imports(module: Module): ModuleImportDescriptor[];
+ };
+
+ interface RuntimeError {
+ }
+
+ var RuntimeError: {
+ prototype: RuntimeError;
+ new(): RuntimeError;
+ };
+
+ interface Table {
+ readonly length: number;
+ get(index: number): Function | null;
+ grow(delta: number): number;
+ set(index: number, value: Function | null): void;
+ }
+
+ var Table: {
+ prototype: Table;
+ new(descriptor: TableDescriptor): Table;
+ };
+
+ interface GlobalDescriptor {
+ mutable?: boolean;
+ value: string;
+ }
+
+ interface MemoryDescriptor {
+ initial: number;
+ maximum?: number;
+ }
+
+ interface ModuleExportDescriptor {
+ kind: ImportExportKind;
+ name: string;
+ }
+
+ interface ModuleImportDescriptor {
+ kind: ImportExportKind;
+ module: string;
+ name: string;
+ }
+
+ interface TableDescriptor {
+ element: TableKind;
+ initial: number;
+ maximum?: number;
+ }
+
+ interface WebAssemblyInstantiatedSource {
+ instance: Instance;
+ module: Module;
+ }
+
+ type ImportExportKind = "function" | "table" | "memory" | "global";
+ type TableKind = "anyfunc";
+ function compile(bytes: BufferSource): Promise<Module>;
+ function instantiate(bytes: BufferSource, importObject?: any): Promise<WebAssemblyInstantiatedSource>;
+ function instantiate(moduleObject: Module, importObject?: any): Promise<Instance>;
+ function validate(bytes: BufferSource): boolean;
+}
+
interface BlobCallback {
(blob: Blob | null): void;
}
@@ -17748,6 +18047,7 @@
}
interface SVGElementTagNameMap {
+ "a": SVGAElement;
"circle": SVGCircleElement;
"clipPath": SVGClipPathElement;
"defs": SVGDefsElement;
@@ -17792,19 +18092,22 @@
"polyline": SVGPolylineElement;
"radialGradient": SVGRadialGradientElement;
"rect": SVGRectElement;
+ "script": SVGScriptElement;
"stop": SVGStopElement;
+ "style": SVGStyleElement;
"svg": SVGSVGElement;
"switch": SVGSwitchElement;
"symbol": SVGSymbolElement;
"text": SVGTextElement;
"textPath": SVGTextPathElement;
+ "title": SVGTitleElement;
"tspan": SVGTSpanElement;
"use": SVGUseElement;
"view": SVGViewElement;
}
/** @deprecated Directly use HTMLElementTagNameMap or SVGElementTagNameMap as appropriate, instead. */
-interface ElementTagNameMap extends HTMLElementTagNameMap, SVGElementTagNameMap { }
+type ElementTagNameMap = HTMLElementTagNameMap & Pick<SVGElementTagNameMap, Exclude<keyof SVGElementTagNameMap, keyof HTMLElementTagNameMap>>;
declare var Audio: {
new(src?: string): HTMLAudioElement;
@@ -17816,6 +18119,8 @@
new(text?: string, value?: string, defaultSelected?: boolean, selected?: boolean): HTMLOptionElement;
};
declare var Blob: typeof Blob;
+declare var TextDecoder: typeof TextDecoder;
+declare var TextEncoder: typeof TextEncoder;
declare var URL: typeof URL;
declare var URLSearchParams: typeof URLSearchParams;
declare var applicationCache: ApplicationCache;
@@ -17850,6 +18155,7 @@
declare var ondevicelight: ((this: Window, ev: DeviceLightEvent) => any) | null;
declare var ondevicemotion: ((this: Window, ev: DeviceMotionEvent) => any) | null;
declare var ondeviceorientation: ((this: Window, ev: DeviceOrientationEvent) => any) | null;
+declare var ondeviceorientationabsolute: ((this: Window, ev: DeviceOrientationEvent) => any) | null;
declare var onmousewheel: ((this: Window, ev: Event) => any) | null;
declare var onmsgesturechange: ((this: Window, ev: Event) => any) | null;
declare var onmsgesturedoubletap: ((this: Window, ev: Event) => any) | null;
@@ -17958,7 +18264,7 @@
declare var onanimationend: ((this: Window, ev: AnimationEvent) => any) | null;
declare var onanimationiteration: ((this: Window, ev: AnimationEvent) => any) | null;
declare var onanimationstart: ((this: Window, ev: AnimationEvent) => any) | null;
-declare var onauxclick: ((this: Window, ev: Event) => any) | null;
+declare var onauxclick: ((this: Window, ev: MouseEvent) => any) | null;
/**
* Fires when the object loses the input focus.
* @param ev The focus event.
@@ -18263,13 +18569,18 @@
type DOMHighResTimeStamp = number;
type RenderingContext = CanvasRenderingContext2D | ImageBitmapRenderingContext | WebGLRenderingContext;
type HTMLOrSVGImageElement = HTMLImageElement | SVGImageElement;
-type CanvasImageSource = HTMLOrSVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap;
+type CanvasImageSource = HTMLOrSVGImageElement | HTMLVideoElement | HTMLCanvasElement | ImageBitmap | OffscreenCanvas;
+type OffscreenRenderingContext = OffscreenCanvasRenderingContext2D | WebGLRenderingContext;
type MessageEventSource = WindowProxy | MessagePort | ServiceWorker;
type HTMLOrSVGScriptElement = HTMLScriptElement | SVGScriptElement;
type ImageBitmapSource = CanvasImageSource | Blob | ImageData;
type OnErrorEventHandler = OnErrorEventHandlerNonNull | null;
type OnBeforeUnloadEventHandler = OnBeforeUnloadEventHandlerNonNull | null;
type TimerHandler = string | Function;
+type ConstrainULong = number | ConstrainULongRange;
+type ConstrainDouble = number | ConstrainDoubleRange;
+type ConstrainBoolean = boolean | ConstrainBooleanParameters;
+type ConstrainDOMString = string | string[] | ConstrainDOMStringParameters;
type PerformanceEntryList = PerformanceEntry[];
type VibratePattern = number | number[];
type AlgorithmIdentifier = string | Algorithm;
@@ -18296,10 +18607,6 @@
type InsertPosition = "beforebegin" | "afterbegin" | "beforeend" | "afterend";
type IDBValidKey = number | string | Date | BufferSource | IDBArrayKey;
type MutationRecordType = "attributes" | "characterData" | "childList";
-type ConstrainBoolean = boolean | ConstrainBooleanParameters;
-type ConstrainDOMString = string | string[] | ConstrainDOMStringParameters;
-type ConstrainDouble = number | ConstrainDoubleRange;
-type ConstrainLong = number | ConstrainLongRange;
type IDBKeyPath = string;
type Transferable = ArrayBuffer | MessagePort | ImageBitmap;
type RTCIceGatherCandidate = RTCIceCandidateDictionary | RTCIceCandidateComplete;
@@ -18364,6 +18671,7 @@
type NavigationType = "navigate" | "reload" | "back_forward" | "prerender";
type NotificationDirection = "auto" | "ltr" | "rtl";
type NotificationPermission = "default" | "denied" | "granted";
+type OffscreenRenderingContextId = "2d" | "webgl";
type OrientationLockType = "any" | "natural" | "landscape" | "portrait" | "portrait-primary" | "portrait-secondary" | "landscape-primary" | "landscape-secondary";
type OrientationType = "portrait-primary" | "portrait-secondary" | "landscape-primary" | "landscape-secondary";
type OscillatorType = "sine" | "square" | "sawtooth" | "triangle" | "custom";
@@ -18371,6 +18679,8 @@
type PanningModelType = "equalpower" | "HRTF";
type PaymentComplete = "success" | "fail" | "unknown";
type PaymentShippingType = "shipping" | "delivery" | "pickup";
+type PermissionName = "geolocation" | "notifications" | "push" | "midi" | "camera" | "microphone" | "speaker" | "device-info" | "background-sync" | "bluetooth" | "persistent-storage" | "ambient-light-sensor" | "accelerometer" | "gyroscope" | "magnetometer" | "clipboard";
+type PermissionState = "granted" | "denied" | "prompt";
type PlaybackDirection = "normal" | "reverse" | "alternate" | "alternate-reverse";
type PositionAlignSetting = "line-left" | "center" | "line-right" | "auto";
type PushEncryptionKeyName = "p256dh" | "auth";

lib/lib.dom.iterable.d.ts

@@ -186,6 +186,10 @@
[Symbol.iterator](): IterableIterator<SVGNumber>;
}
+interface SVGPointList {
+ [Symbol.iterator](): IterableIterator<DOMPoint>;
+}
+
interface SVGStringList {
[Symbol.iterator](): IterableIterator<string>;
}

lib/lib.es2015.core.d.ts

@@ -29,7 +29,7 @@
* predicate. If it is not provided, undefined is used instead.
*/
find<S extends T>(predicate: (this: void, value: T, index: number, obj: T[]) => value is S, thisArg?: any): S | undefined;
- find(predicate: (value: T, index: number, obj: T[]) => boolean, thisArg?: any): T | undefined;
+ find(predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any): T | undefined;
/**
* Returns the index of the first element in the array where predicate is true, and -1
@@ -40,7 +40,7 @@
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
- findIndex(predicate: (value: T, index: number, obj: T[]) => boolean, thisArg?: any): number;
+ findIndex(predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any): number;
/**
* Returns the this object after filling the section identified by start and end with value
@@ -319,6 +319,12 @@
getOwnPropertySymbols(o: any): symbol[];
/**
+ * Returns the names of the enumerable string properties and methods of an object.
+ * @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
+ */
+ keys(o: {}): string[];
+
+ /**
* Returns true if the values are the same value, false otherwise.
* @param value1 The first value.
* @param value2 The second value.
@@ -344,7 +350,7 @@
* predicate. If it is not provided, undefined is used instead.
*/
find<S extends T>(predicate: (this: void, value: T, index: number, obj: ReadonlyArray<T>) => value is S, thisArg?: any): S | undefined;
- find(predicate: (value: T, index: number, obj: ReadonlyArray<T>) => boolean, thisArg?: any): T | undefined;
+ find(predicate: (value: T, index: number, obj: ReadonlyArray<T>) => unknown, thisArg?: any): T | undefined;
/**
* Returns the index of the first element in the array where predicate is true, and -1
@@ -355,7 +361,7 @@
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
- findIndex(predicate: (value: T, index: number, obj: ReadonlyArray<T>) => boolean, thisArg?: any): number;
+ findIndex(predicate: (value: T, index: number, obj: ReadonlyArray<T>) => unknown, thisArg?: any): number;
}
interface RegExp {

lib/lib.es2015.iterable.d.ts

@@ -197,7 +197,7 @@
}
interface SetConstructor {
- new <T>(iterable: Iterable<T>): Set<T>;
+ new <T>(iterable?: Iterable<T> | null): Set<T>;
}
interface WeakSet<T extends object> { }

lib/lib.es2015.promise.d.ts

@@ -118,79 +118,15 @@
* @param values An array of Promises.
* @returns A new Promise.
*/
- race<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>, T10 | PromiseLike<T10>]): Promise<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9 | T10>;
+ race<T>(values: T[]): Promise<T extends PromiseLike<infer U> ? U : T>;
/**
* Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
* or rejected.
- * @param values An array of Promises.
- * @returns A new Promise.
- */
- race<T1, T2, T3, T4, T5, T6, T7, T8, T9>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>, T9 | PromiseLike<T9>]): Promise<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8 | T9>;
-
- /**
- * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
- * or rejected.
- * @param values An array of Promises.
- * @returns A new Promise.
- */
- race<T1, T2, T3, T4, T5, T6, T7, T8>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>, T8 | PromiseLike<T8>]): Promise<T1 | T2 | T3 | T4 | T5 | T6 | T7 | T8>;
-
- /**
- * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
- * or rejected.
- * @param values An array of Promises.
- * @returns A new Promise.
- */
- race<T1, T2, T3, T4, T5, T6, T7>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>, T7 | PromiseLike<T7>]): Promise<T1 | T2 | T3 | T4 | T5 | T6 | T7>;
-
- /**
- * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
- * or rejected.
- * @param values An array of Promises.
- * @returns A new Promise.
- */
- race<T1, T2, T3, T4, T5, T6>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>, T6 | PromiseLike<T6>]): Promise<T1 | T2 | T3 | T4 | T5 | T6>;
-
- /**
- * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
- * or rejected.
- * @param values An array of Promises.
- * @returns A new Promise.
- */
- race<T1, T2, T3, T4, T5>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>, T5 | PromiseLike<T5>]): Promise<T1 | T2 | T3 | T4 | T5>;
-
- /**
- * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
- * or rejected.
- * @param values An array of Promises.
- * @returns A new Promise.
- */
- race<T1, T2, T3, T4>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>, T4 | PromiseLike<T4>]): Promise<T1 | T2 | T3 | T4>;
-
- /**
- * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
- * or rejected.
- * @param values An array of Promises.
- * @returns A new Promise.
- */
- race<T1, T2, T3>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>, T3 | PromiseLike<T3>]): Promise<T1 | T2 | T3>;
-
- /**
- * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
- * or rejected.
- * @param values An array of Promises.
- * @returns A new Promise.
- */
- race<T1, T2>(values: [T1 | PromiseLike<T1>, T2 | PromiseLike<T2>]): Promise<T1 | T2>;
-
- /**
- * Creates a Promise that is resolved or rejected when any of the provided Promises are resolved
- * or rejected.
- * @param values An array of Promises.
+ * @param values An iterable of Promises.
* @returns A new Promise.
*/
- race<T>(values: (T | PromiseLike<T>)[]): Promise<T>;
+ race<T>(values: Iterable<T>): Promise<T extends PromiseLike<infer U> ? U : T>;
/**
* Creates a new rejected promise for the provided reason.

lib/lib.es2019.d.ts

@@ -20,5 +20,6 @@
/// <reference lib="es2018" />
/// <reference lib="es2019.array" />
+/// <reference lib="es2019.object" />
/// <reference lib="es2019.string" />
/// <reference lib="es2019.symbol" />

lib/lib.es2019.object.d.ts

@@ -0,0 +1,35 @@
+/*! *****************************************************************************
+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"/>
+
+
+/// <reference lib="es2015.iterable" />
+
+interface ObjectConstructor {
+ /**
+ * Returns an object created by key-value entries for properties and methods
+ * @param entries An iterable object that contains key-value entries for properties and methods.
+ */
+ fromEntries<T = any>(entries: Iterable<readonly [PropertyKey, T]>): { [k in PropertyKey]: T };
+
+ /**
+ * Returns an object created by key-value entries for properties and methods
+ * @param entries An iterable object that contains key-value entries for properties and methods.
+ */
+ fromEntries(entries: Iterable<readonly any[]>): any;
+}

lib/lib.es2020.d.ts

@@ -0,0 +1,23 @@
+/*! *****************************************************************************
+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"/>
+
+
+/// <reference lib="es2019" />
+/// <reference lib="es2020.string" />
+/// <reference lib="es2020.symbol.wellknown" />

lib/lib.es2020.full.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"/>
+
+
+/// <reference lib="es2020" />
+/// <reference lib="dom" />
+/// <reference lib="webworker.importscripts" />
+/// <reference lib="scripthost" />
+/// <reference lib="dom.iterable" />

lib/lib.es2020.string.d.ts

@@ -0,0 +1,30 @@
+/*! *****************************************************************************
+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"/>
+
+
+/// <reference lib="es2015.iterable" />
+
+interface String {
+ /**
+ * Matches a string with a regular expression, and returns an iterable of matches
+ * containing the results of that search.
+ * @param regexp A variable name or string literal containing the regular expression pattern and flags.
+ */
+ matchAll(regexp: RegExp): IterableIterator<RegExpMatchArray>;
+}

lib/lib.es2020.symbol.wellknown.d.ts

@@ -0,0 +1,39 @@
+/*! *****************************************************************************
+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"/>
+
+
+/// <reference lib="es2015.iterable" />
+/// <reference lib="es2015.symbol" />
+
+interface SymbolConstructor {
+ /**
+ * A regular expression method that matches the regular expression against a string. Called
+ * by the String.prototype.matchAll method.
+ */
+ readonly matchAll: symbol;
+}
+
+interface RegExp {
+ /**
+ * Matches a string with this regular expression, and returns an iterable of matches
+ * containing the results of that search.
+ * @param string A string to search within.
+ */
+ [Symbol.matchAll](str: string): IterableIterator<RegExpMatchArray>;
+}

lib/lib.es5.d.ts

@@ -80,7 +80,7 @@
* Encodes a text string as a valid component of a Uniform Resource Identifier (URI).
* @param uriComponent A value representing an encoded URI component.
*/
-declare function encodeURIComponent(uriComponent: string): string;
+declare function encodeURIComponent(uriComponent: string | number | boolean): string;
/**
* Computes a new string in which certain characters have been replaced by a hexadecimal escape sequence.
@@ -255,10 +255,10 @@
isExtensible(o: any): boolean;
/**
- * Returns the names of the enumerable properties and methods of an object.
+ * Returns the names of the enumerable string properties and methods of an object.
* @param o Object that contains the properties and methods. This can be an object that you created or an existing Document Object Model (DOM) object.
*/
- keys(o: {}): string[];
+ keys(o: object): string[];
}
/**
@@ -533,7 +533,7 @@
interface BooleanConstructor {
new(value?: any): Boolean;
- (value?: any): boolean;
+ <T>(value?: T): boolean;
readonly prototype: Boolean;
}
@@ -1293,13 +1293,13 @@
* @param callbackfn A function that accepts up to three arguments. The every method calls the callbackfn function for each element in array1 until the callbackfn returns false, or until the end of the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
*/
- every(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;
+ every(callbackfn: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean;
/**
* Determines whether the specified callback function returns true for any element of an array.
* @param callbackfn A function that accepts up to three arguments. The some method calls the callbackfn function for each element in array1 until the callbackfn returns true, or until the end of the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
*/
- some(callbackfn: (value: T, index: number, array: T[]) => boolean, thisArg?: any): boolean;
+ some(callbackfn: (value: T, index: number, array: T[]) => unknown, thisArg?: any): boolean;
/**
* Performs the specified action for each element in an array.
* @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the array.
@@ -1323,7 +1323,7 @@
* @param callbackfn A function that accepts up to three arguments. The filter method calls the callbackfn function one time for each element in the array.
* @param thisArg An object to which the this keyword can refer in the callbackfn function. If thisArg is omitted, undefined is used as the this value.
*/
- filter(callbackfn: (value: T, index: number, array: T[]) => any, thisArg?: any): T[];
+ filter(callbackfn: (value: T, index: number, array: T[]) => unknown, thisArg?: any): T[];
/**
* Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function.
* @param callbackfn A function that accepts up to four arguments. The reduce method calls the callbackfn function one time for each element in the array.
@@ -1464,6 +1464,11 @@
type Extract<T, U> = T extends U ? T : never;
/**
+ * Construct a type with the properties of T except for those in type K.
+ */
+type Omit<T, K extends keyof any> = Pick<T, Exclude<keyof T, K>>;
+
+/**
* Exclude null and undefined from T
*/
type NonNullable<T> = T extends null | undefined ? never : T;

lib/lib.webworker.d.ts

@@ -64,7 +64,6 @@
}
interface CacheQueryOptions {
- cacheName?: string;
ignoreMethod?: boolean;
ignoreSearch?: boolean;
ignoreVary?: boolean;
@@ -140,6 +139,11 @@
y?: number;
}
+interface DevicePermissionDescriptor extends PermissionDescriptor {
+ deviceId?: string;
+ name: "camera" | "microphone" | "speaker";
+}
+
interface EcKeyGenParams extends Algorithm {
namedCurve: NamedCurve;
}
@@ -192,9 +196,9 @@
interface FetchEventInit extends ExtendableEventInit {
clientId?: string;
preloadResponse?: Promise<any>;
+ replacesClientId?: string;
request: Request;
resultingClientId?: string;
- targetClientId?: string;
}
interface FilePropertyBag extends BlobPropertyBag {
@@ -230,6 +234,11 @@
oldVersion?: number;
}
+interface ImageEncodeOptions {
+ quality?: number;
+ type?: string;
+}
+
interface JsonWebKey {
alg?: string;
crv?: string;
@@ -263,6 +272,15 @@
source?: MessageEventSource | null;
}
+interface MidiPermissionDescriptor extends PermissionDescriptor {
+ name: "midi";
+ sysex?: boolean;
+}
+
+interface MultiCacheQueryOptions extends CacheQueryOptions {
+ cacheName?: string;
+}
+
interface NavigationPreloadState {
enabled?: boolean;
headerValue?: string;
@@ -304,13 +322,23 @@
interface PerformanceObserverInit {
buffered?: boolean;
- entryTypes: string[];
+ entryTypes?: string[];
+ type?: string;
+}
+
+interface PermissionDescriptor {
+ name: PermissionName;
}
interface PipeOptions {
preventAbort?: boolean;
preventCancel?: boolean;
preventClose?: boolean;
+ signal?: AbortSignal;
+}
+
+interface PostMessageOptions {
+ transfer?: any[];
}
interface ProgressEventInit extends EventInit {
@@ -328,6 +356,11 @@
data?: PushMessageDataInit;
}
+interface PushPermissionDescriptor extends PermissionDescriptor {
+ name: "push";
+ userVisibleOnly?: boolean;
+}
+
interface PushSubscriptionChangeInit extends ExtendableEventInit {
newSubscription?: PushSubscription;
oldSubscription?: PushSubscription;
@@ -423,6 +456,11 @@
ignoreBOM?: boolean;
}
+interface TextEncoderEncodeIntoResult {
+ read?: number;
+ written?: number;
+}
+
interface Transformer<I = any, O = any> {
flush?: TransformStreamDefaultControllerCallback<O>;
readableType?: undefined;
@@ -487,7 +525,7 @@
readonly VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: GLenum;
}
-/** The AbortController interface represents a controller object that allows you to abort one or more DOM requests as and when desired. */
+/** A controller object that allows you to abort one or more DOM requests as and when desired. */
interface AbortController {
/**
* Returns the AbortSignal object associated with this object.
@@ -509,7 +547,7 @@
"abort": Event;
}
-/** The AbortSignal interface represents a signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */
+/** A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */
interface AbortSignal extends EventTarget {
/**
* Returns true if this AbortSignal's AbortController has signaled to abort, and false
@@ -548,7 +586,7 @@
length: number;
}
-/** A Blob object represents a file-like object of immutable, raw data. Blobs represent data that isn't necessarily in a JavaScript-native format. The File interface is based on Blob, inheriting blob functionality and expanding it to support files on the user's system. */
+/** A file-like object of immutable, raw data. Blobs represent data that isn't necessarily in a JavaScript-native format. The File interface is based on Blob, inheriting blob functionality and expanding it to support files on the user's system. */
interface Blob {
readonly size: number;
readonly type: string;
@@ -601,12 +639,7 @@
new(name: string): BroadcastChannel;
};
-interface BroadcastChannelEventMap {
- message: MessageEvent;
- messageerror: MessageEvent;
-}
-
-/** The ByteLengthQueuingStrategy interface of the the Streams API provides a built-in byte length queuing strategy that can be used when constructing streams. */
+/** An interface of the Streams API provides a built-in byte length queuing strategy that can be used when constructing streams. */
interface ByteLengthQueuingStrategy extends QueuingStrategy<ArrayBufferView> {
highWaterMark: number;
size(chunk: ArrayBufferView): number;
@@ -617,7 +650,7 @@
new(options: { highWaterMark: number }): ByteLengthQueuingStrategy;
};
-/** The Cache interface provides a storage mechanism for Request / Response object pairs that are cached, for example as part of the ServiceWorker life cycle. Note that the Cache interface is exposed to windowed scopes as well as workers. You don't have to use it in conjunction with service workers, even though it is defined in the service worker spec. */
+/** Provides a storage mechanism for Request / Response object pairs that are cached, for example as part of the ServiceWorker life cycle. Note that the Cache interface is exposed to windowed scopes as well as workers. You don't have to use it in conjunction with service workers, even though it is defined in the service worker spec. */
interface Cache {
add(request: RequestInfo): Promise<void>;
addAll(requests: RequestInfo[]): Promise<void>;
@@ -633,7 +666,7 @@
new(): Cache;
};
-/** The CacheStorage interface represents the storage for Cache objects. */
+/** The storage for Cache objects. */
interface CacheStorage {
delete(cacheName: string): Promise<boolean>;
has(cacheName: string): Promise<boolean>;
@@ -647,7 +680,44 @@
new(): CacheStorage;
};
-/** The CanvasGradient interface represents an opaque object describing a gradient. It is returned by the methods CanvasRenderingContext2D.createLinearGradient() or CanvasRenderingContext2D.createRadialGradient(). */
+interface CanvasCompositing {
+ globalAlpha: number;
+ globalCompositeOperation: string;
+}
+
+interface CanvasDrawImage {
+ drawImage(image: CanvasImageSource, dx: number, dy: number): void;
+ drawImage(image: CanvasImageSource, dx: number, dy: number, dw: number, dh: number): void;
+ drawImage(image: CanvasImageSource, sx: number, sy: number, sw: number, sh: number, dx: number, dy: number, dw: number, dh: number): void;
+}
+
+interface CanvasDrawPath {
+ beginPath(): void;
+ clip(fillRule?: CanvasFillRule): void;
+ clip(path: Path2D, fillRule?: CanvasFillRule): void;
+ fill(fillRule?: CanvasFillRule): void;
+ fill(path: Path2D, fillRule?: CanvasFillRule): void;
+ isPointInPath(x: number, y: number, fillRule?: CanvasFillRule): boolean;
+ isPointInPath(path: Path2D, x: number, y: number, fillRule?: CanvasFillRule): boolean;
+ isPointInStroke(x: number, y: number): boolean;
+ isPointInStroke(path: Path2D, x: number, y: number): boolean;
+ stroke(): void;
+ stroke(path: Path2D): void;
+}
+
+interface CanvasFillStrokeStyles {
+ fillStyle: string | CanvasGradient | CanvasPattern;
+ strokeStyle: string | CanvasGradient | CanvasPattern;
+ createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient;
+ createPattern(image: CanvasImageSource, repetition: string): CanvasPattern | null;
+ createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient;
+}
+
+interface CanvasFilters {
+ filter: string;
+}
+
+/** An opaque object describing a gradient. It is returned by the methods CanvasRenderingContext2D.createLinearGradient() or CanvasRenderingContext2D.createRadialGradient(). */
interface CanvasGradient {
/**
* Adds a color stop with the given color to the gradient at the given offset. 0.0 is the offset
@@ -664,6 +734,19 @@
new(): CanvasGradient;
};
+interface CanvasImageData {
+ createImageData(sw: number, sh: number): ImageData;
+ createImageData(imagedata: ImageData): ImageData;
+ getImageData(sx: number, sy: number, sw: number, sh: number): ImageData;
+ putImageData(imagedata: ImageData, dx: number, dy: number): void;
+ putImageData(imagedata: ImageData, dx: number, dy: number, dirtyX: number, dirtyY: number, dirtyWidth: number, dirtyHeight: number): void;
+}
+
+interface CanvasImageSmoothing {
+ imageSmoothingEnabled: boolean;
+ imageSmoothingQuality: ImageSmoothingQuality;
+}
+
interface CanvasPath {
arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, anticlockwise?: boolean): void;
arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void;
@@ -676,7 +759,17 @@
rect(x: number, y: number, w: number, h: number): void;
}
-/** The CanvasPattern interface represents an opaque object describing a pattern, based on an image, a canvas, or a video, created by the CanvasRenderingContext2D.createPattern() method. */
+interface CanvasPathDrawingStyles {
+ lineCap: CanvasLineCap;
+ lineDashOffset: number;
+ lineJoin: CanvasLineJoin;
+ lineWidth: number;
+ miterLimit: number;
+ getLineDash(): number[];
+ setLineDash(segments: number[]): void;
+}
+
+/** An opaque object describing a pattern, based on an image, a canvas, or a video, created by the CanvasRenderingContext2D.createPattern() method. */
interface CanvasPattern {
/**
* Sets the transformation matrix that will be used when rendering the pattern during a fill or
@@ -690,8 +783,51 @@
new(): CanvasPattern;
};
+interface CanvasRect {
+ clearRect(x: number, y: number, w: number, h: number): void;
+ fillRect(x: number, y: number, w: number, h: number): void;
+ strokeRect(x: number, y: number, w: number, h: number): void;
+}
+
+interface CanvasShadowStyles {
+ shadowBlur: number;
+ shadowColor: string;
+ shadowOffsetX: number;
+ shadowOffsetY: number;
+}
+
+interface CanvasState {
+ restore(): void;
+ save(): void;
+}
+
+interface CanvasText {
+ fillText(text: string, x: number, y: number, maxWidth?: number): void;
+ measureText(text: string): TextMetrics;
+ strokeText(text: string, x: number, y: number, maxWidth?: number): void;
+}
+
+interface CanvasTextDrawingStyles {
+ direction: CanvasDirection;
+ font: string;
+ textAlign: CanvasTextAlign;
+ textBaseline: CanvasTextBaseline;
+}
+
+interface CanvasTransform {
+ getTransform(): DOMMatrix;
+ resetTransform(): void;
+ rotate(angle: number): void;
+ scale(x: number, y: number): void;
+ setTransform(a: number, b: number, c: number, d: number, e: number, f: number): void;
+ setTransform(transform?: DOMMatrix2DInit): void;
+ transform(a: number, b: number, c: number, d: number, e: number, f: number): void;
+ translate(x: number, y: number): void;
+}
+
/** The Client interface represents an executable context such as a Worker, or a SharedWorker. Window clients are represented by the more-specific WindowClient. You can get Client/WindowClient objects from methods such as Clients.matchAll() and Clients.get(). */
interface Client {
+ readonly frameType: FrameType;
readonly id: string;
readonly type: ClientTypes;
readonly url: string;
@@ -703,7 +839,7 @@
new(): Client;
};
-/** The Clients interface provides access to Client objects. Access it via self.clients within a service worker. */
+/** Provides access to Client objects. Access it via self.clients within a service worker. */
interface Clients {
claim(): Promise<void>;
get(id: string): Promise<any>;
@@ -739,7 +875,7 @@
publicInfo?: Uint8Array;
}
-/** The Console object provides access to the browser's debugging console (e.g. the Web Console in Firefox). The specifics of how it works varies from browser to browser, but there is a de facto set of features that are typically provided. */
+/** Provides access to the browser's debugging console (e.g. the Web Console in Firefox). The specifics of how it works varies from browser to browser, but there is a de facto set of features that are typically provided. */
interface Console {
memory: any;
assert(condition?: boolean, message?: string, ...data: any[]): void;
@@ -773,7 +909,7 @@
new(): Console;
};
-/** The CountQueuingStrategy interface of the the Streams API provides a built-in byte length queuing strategy that can be used when constructing streams. */
+/** An interface of the Streams API provides a built-in byte length queuing strategy that can be used when constructing streams. */
interface CountQueuingStrategy extends QueuingStrategy {
highWaterMark: number;
size(chunk: any): 1;
@@ -784,7 +920,7 @@
new(options: { highWaterMark: number }): CountQueuingStrategy;
};
-/** The Crypto interface represents basic cryptography features available in the current context. It allows access to a cryptographically strong random number generator and to cryptographic primitives. */
+/** Basic cryptography features available in the current context. It allows access to a cryptographically strong random number generator and to cryptographic primitives. */
interface Crypto {
readonly subtle: SubtleCrypto;
getRandomValues<T extends Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | null>(array: T): T;
@@ -795,7 +931,7 @@
new(): Crypto;
};
-/** The CryptoKey interface represents a cryptographic key derived from a specific key algorithm. */
+/** The CryptoKey dictionary of the Web Crypto API represents a cryptographic key. */
interface CryptoKey {
readonly algorithm: KeyAlgorithm;
readonly extractable: boolean;
@@ -822,7 +958,7 @@
new<T>(typeArg: string, eventInitDict?: CustomEventInit<T>): CustomEvent<T>;
};
-/** The DOMException interface represents an abnormal event (called an exception) which occurs as a result of calling a method or accessing a property of a web API. */
+/** An abnormal event (called an exception) which occurs as a result of calling a method or accessing a property of a web API. */
interface DOMException {
readonly code: number;
readonly message: string;
@@ -1083,11 +1219,12 @@
"message": MessageEvent;
}
-/** The DedicatedWorkerGlobalScope object (the Worker global scope) is accessible through the self keyword. Some additional global functions, namespaces objects, and constructors, not typically associated with the worker global scope, but available on it, are listed in the JavaScript Reference. See also: Functions available to workers. */
+/** (the Worker global scope) is accessible through the self keyword. Some additional global functions, namespaces objects, and constructors, not typically associated with the worker global scope, but available on it, are listed in the JavaScript Reference. See also: Functions available to workers. */
interface DedicatedWorkerGlobalScope extends WorkerGlobalScope {
onmessage: ((this: DedicatedWorkerGlobalScope, ev: MessageEvent) => any) | null;
close(): void;
- postMessage(message: any, transfer?: Transferable[]): void;
+ postMessage(message: any, transfer: Transferable[]): void;
+ postMessage(message: any, options?: PostMessageOptions): void;
addEventListener<K extends keyof DedicatedWorkerGlobalScopeEventMap>(type: K, listener: (this: DedicatedWorkerGlobalScope, ev: DedicatedWorkerGlobalScopeEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof DedicatedWorkerGlobalScopeEventMap>(type: K, listener: (this: DedicatedWorkerGlobalScope, ev: DedicatedWorkerGlobalScopeEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
@@ -1143,7 +1280,7 @@
readonly TEXTURE_MAX_ANISOTROPY_EXT: GLenum;
}
-/** The ErrorEvent interface represents events providing information related to errors in scripts or in files. */
+/** Events providing information related to errors in scripts or in files. */
interface ErrorEvent extends Event {
readonly colno: number;
readonly error: any;
@@ -1157,7 +1294,7 @@
new(type: string, eventInitDict?: ErrorEventInit): ErrorEvent;
};
-/** The Event interface represents any event which takes place in the DOM; some are user-generated (such as mouse or keyboard events), while others are generated by APIs (such as events that indicate an animation has finished running, a video has been paused, and so forth). While events are usually triggered by such "external" sources, they can also be triggered programmatically, such as by calling the HTMLElement.click() method of an element, or by defining the event, then sending it to a specified target using EventTarget.dispatchEvent(). There are many types of events, some of which use other interfaces based on the main Event interface. Event itself contains the properties and methods which are common to all events. */
+/** An event which takes place in the DOM. */
interface Event {
/**
* Returns true or false depending on how event was initialized. True if event goes through its target's ancestors in reverse tree order, and false otherwise.
@@ -1274,7 +1411,7 @@
readonly OPEN: number;
};
-/** EventTarget is an interface implemented by objects that can receive events and may have listeners for them. */
+/** EventTarget is a DOM interface implemented by objects that can receive events and may have listeners for them. */
interface EventTarget {
/**
* Appends an event listener for events whose type attribute value is type. The callback argument sets the callback that will be invoked when the event is dispatched.
@@ -1303,7 +1440,7 @@
new(): EventTarget;
};
-/** The ExtendableEvent interface extends the lifetime of the install and activate events dispatched on the global scope as part of the service worker lifecycle. This ensures that any functional events (like FetchEvent) are not dispatched until it upgrades database schemas and deletes the outdated cache entries. */
+/** Extends the lifetime of the install and activate events dispatched on the global scope as part of the service worker lifecycle. This ensures that any functional events (like FetchEvent) are not dispatched until it upgrades database schemas and deletes the outdated cache entries. */
interface ExtendableEvent extends Event {
waitUntil(f: any): void;
}
@@ -1313,7 +1450,7 @@
new(type: string, eventInitDict?: ExtendableEventInit): ExtendableEvent;
};
-/** The ExtendableMessageEvent interface of the ServiceWorker API represents the event object of a message event fired on a service worker (when a channel message is received on the ServiceWorkerGlobalScope from another context) — extends the lifetime of such events. */
+/** An interface of the ServiceWorker API represents the event object of a message event fired on a service worker (when a channel message is received on the ServiceWorkerGlobalScope from another context) — extends the lifetime of such events. */
interface ExtendableMessageEvent extends ExtendableEvent {
readonly data: any;
readonly lastEventId: string;
@@ -1331,9 +1468,9 @@
interface FetchEvent extends ExtendableEvent {
readonly clientId: string;
readonly preloadResponse: Promise<any>;
+ readonly replacesClientId: string;
readonly request: Request;
readonly resultingClientId: string;
- readonly targetClientId: string;
respondWith(r: Response | Promise<Response>): void;
}
@@ -1342,7 +1479,7 @@
new(type: string, eventInitDict: FetchEventInit): FetchEvent;
};
-/** The File interface provides information about files and allows JavaScript in a web page to access their content. */
+/** Provides information about files and allows JavaScript in a web page to access their content. */
interface File extends Blob {
readonly lastModified: number;
readonly name: string;
@@ -1374,7 +1511,7 @@
"progress": ProgressEvent;
}
-/** The FileReader object lets web applications asynchronously read the contents of files (or raw data buffers) stored on the user's computer, using File or Blob objects to specify the file or data to read. */
+/** Lets web applications asynchronously read the contents of files (or raw data buffers) stored on the user's computer, using File or Blob objects to specify the file or data to read. */
interface FileReader extends EventTarget {
readonly error: DOMException | null;
onabort: ((this: FileReader, ev: ProgressEvent) => any) | null;
@@ -1407,7 +1544,7 @@
readonly LOADING: number;
};
-/** The FileReaderSync interface allows to read File or Blob objects in a synchronous way. */
+/** Allows to read File or Blob objects in a synchronous way. */
interface FileReaderSync {
readAsArrayBuffer(blob: Blob): ArrayBuffer;
readAsBinaryString(blob: Blob): string;
@@ -1420,7 +1557,7 @@
new(): FileReaderSync;
};
-/** The FormData interface provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using the XMLHttpRequest.send() method. It uses the same format a form would use if the encoding type were set to "multipart/form-data". */
+/** Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using the XMLHttpRequest.send() method. It uses the same format a form would use if the encoding type were set to "multipart/form-data". */
interface FormData {
append(name: string, value: string | Blob, fileName?: string): void;
delete(name: string): void;
@@ -1436,11 +1573,23 @@
new(): FormData;
};
+interface GenericTransformStream {
+ readonly readable: ReadableStream;
+ /**
+ * Returns a writable stream which accepts string chunks and runs them through UTF-8's encoder before making them available to readable.
+ * Typically this will be used via the pipeThrough() method on a ReadableStream source.
+ * textReadable
+ * .pipeThrough(new TextEncoderStream())
+ * .pipeTo(byteWritable);
+ */
+ readonly writable: WritableStream;
+}
+
interface GlobalFetch {
fetch(input: RequestInfo, init?: RequestInit): Promise<Response>;
}
-/** The Headers interface of the Fetch API allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.  You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence. */
+/** An interface of the Fetch API allows you to perform various actions on HTTP request and response headers. These actions include retrieving, setting, adding to, and removing. A Headers object has an associated header list, which is initially empty and consists of zero or more name and value pairs.  You can add to this using methods like append() (see Examples.) In all methods of this interface, header names are matched by case-insensitive byte sequence. */
interface Headers {
append(name: string, value: string): void;
delete(name: string): void;
@@ -1464,7 +1613,7 @@
interface IDBArrayKey extends Array<IDBValidKey> {
}
-/** The IDBCursor interface of the IndexedDB API represents a cursor for traversing or iterating over multiple records in a database. */
+/** An interface of the IndexedDB API represents a cursor for traversing or iterating over multiple records in a database. */
interface IDBCursor {
/**
* Returns the direction ("next", "nextunique", "prev" or "prevunique")
@@ -1518,7 +1667,7 @@
new(): IDBCursor;
};
-/** The IDBCursorWithValue interface of the IndexedDB API represents a cursor for traversing or iterating over multiple records in a database. It is the same as the IDBCursor, except that it includes the value property. */
+/** An interface of the IndexedDB API represents a cursor for traversing or iterating over multiple records in a database. It is the same as the IDBCursor, except that it includes the value property. */
interface IDBCursorWithValue extends IDBCursor {
/**
* Returns the cursor's current value.
@@ -1538,7 +1687,7 @@
"versionchange": IDBVersionChangeEvent;
}
-/** The IDBDatabase interface of the IndexedDB API provides a connection to a database; you can use an IDBDatabase object to open a transaction on your database then create, manipulate, and delete objects (data) in that database. The interface provides the only way to get and manage versions of the database. */
+/** An interface of the IndexedDB API provides a connection to a database; you can use an IDBDatabase object to open a transaction on your database then create, manipulate, and delete objects (data) in that database. The interface provides the only way to get and manage versions of the database. */
interface IDBDatabase extends EventTarget {
/**
* Returns the name of the database.
@@ -1948,7 +2097,7 @@
new(): IDBTransaction;
};
-/** The IDBVersionChangeEvent interface of the IndexedDB API indicates that the version of the database has changed, as the result of an IDBOpenDBRequest.onupgradeneeded event handler function. */
+/** An interface of the IndexedDB API indicates that the version of the database has changed, as the result of an IDBOpenDBRequest.onupgradeneeded event handler function. */
interface IDBVersionChangeEvent extends Event {
readonly newVersion: number | null;
readonly oldVersion: number;
@@ -1990,7 +2139,7 @@
resizeWidth?: number;
}
-/** The ImageData interface represents the underlying pixel data of an area of a <canvas> element. It is created using the ImageData() constructor or creator methods on the CanvasRenderingContext2D object associated with a canvas: createImageData() and getImageData(). It can also be used to set a part of the canvas by using putImageData(). */
+/** The underlying pixel data of an area of a <canvas> element. It is created using the ImageData() constructor or creator methods on the CanvasRenderingContext2D object associated with a canvas: createImageData() and getImageData(). It can also be used to set a part of the canvas by using putImageData(). */
interface ImageData {
/**
* Returns the one-dimensional array containing the data in RGBA order, as integers in the
@@ -2011,7 +2160,7 @@
new(array: Uint8ClampedArray, width: number, height: number): ImageData;
};
-/** The MessageChannel interface of the Channel Messaging API allows us to create a new message channel and send data through it via its two MessagePort properties. */
+/** An interface of the Channel Messaging API allows us to create a new message channel and send data through it via its two MessagePort properties. */
interface MessageChannel {
readonly port1: MessagePort;
readonly port2: MessagePort;
@@ -2022,7 +2171,7 @@
new(): MessageChannel;
};
-/** The MessageEvent interface represents a message received by a target object. */
+/** A message received by a target object. */
interface MessageEvent extends Event {
/**
* Returns the data of the message.
@@ -2061,7 +2210,7 @@
"messageerror": MessageEvent;
}
-/** The MessagePort interface of the Channel Messaging API represents one of the two ports of a MessageChannel, allowing messages to be sent from one port and listening out for them arriving at the other. */
+/** An interface of the Channel Messaging API represents one of the two ports of a MessageChannel, allowing messages to be sent from one port and listening out for them arriving at the other. */
interface MessagePort extends EventTarget {
onmessage: ((this: MessagePort, ev: MessageEvent) => any) | null;
onmessageerror: ((this: MessagePort, ev: MessageEvent) => any) | null;
@@ -2069,14 +2218,8 @@
* Disconnects the port, so that it is no longer active.
*/
close(): void;
- /**
- * Posts a message through the channel. Objects listed in transfer are
- * transferred, not just cloned, meaning that they are no longer usable on the sending side.
- * Throws a "DataCloneError" DOMException if
- * transfer contains duplicate objects or port, or if message
- * could not be cloned.
- */
- postMessage(message: any, transfer?: Transferable[]): void;
+ postMessage(message: any, transfer: Transferable[]): void;
+ postMessage(message: any, options?: PostMessageOptions): void;
/**
* Begins dispatching messages received on the port.
*/
@@ -2139,7 +2282,7 @@
"show": Event;
}
-/** The Notification interface of the Notifications API is used to configure and display desktop notifications to the user. */
+/** An interface of the Notifications API is used to configure and display desktop notifications to the user. */
interface Notification extends EventTarget {
readonly actions: ReadonlyArray<NotificationAction>;
readonly badge: string;
@@ -2219,7 +2362,63 @@
readonly VERTEX_ARRAY_BINDING_OES: GLenum;
}
-/** The Path2D interface of the Canvas 2D API is used to declare a path that can then be used on a CanvasRenderingContext2D object. The path methods of the CanvasRenderingContext2D interface are also present on this interface, which gives you the convenience of being able to retain and replay your path whenever desired. */
+interface OffscreenCanvas extends EventTarget {
+ /**
+ * These attributes return the dimensions of the OffscreenCanvas object's bitmap.
+ * They can be set, to replace the bitmap with a
+ * new, transparent black bitmap of the specified dimensions (effectively resizing
+ * it).
+ */
+ height: number;
+ width: number;
+ /**
+ * Returns a promise that will fulfill with a new Blob object representing a file
+ * containing the image in the OffscreenCanvas object.
+ * The argument, if provided, is a dictionary that controls the encoding options of the image
+ * file to be created. The type
+ * field specifies the file format and has a default value of "image/png"; that type
+ * is also used if the requested type isn't supported. If the image format supports variable
+ * quality (such as "image/jpeg"), then the quality field is a number in the range 0.0
+ * to 1.0 inclusive indicating the desired quality level for the resulting image.
+ */
+ convertToBlob(options?: ImageEncodeOptions): Promise<Blob>;
+ /**
+ * Returns an object that exposes an API for drawing on the OffscreenCanvas
+ * object. contextId specifies the desired API: "2d" or "webgl". options is handled by that
+ * API.
+ * This specification defines the "2d" context below,
+ * which is similar but distinct from the "2d"
+ * context that is created from a canvas element. There is also a specification that
+ * defines a "webgl" context. [WEBGL]
+ * Returns null if the canvas has already been initialized with another context type (e.g.,
+ * trying to get a "2d" context after getting a
+ * "webgl" context).
+ */
+ getContext(contextId: OffscreenRenderingContextId, options?: any): OffscreenRenderingContext | null;
+ /**
+ * Returns a newly created ImageBitmap object with the image in the
+ * OffscreenCanvas object. The image in the OffscreenCanvas object is
+ * replaced with a new blank image.
+ */
+ transferToImageBitmap(): ImageBitmap;
+}
+
+declare var OffscreenCanvas: {
+ prototype: OffscreenCanvas;
+ new(width: number, height: number): OffscreenCanvas;
+};
+
+interface OffscreenCanvasRenderingContext2D extends CanvasState, CanvasTransform, CanvasCompositing, CanvasImageSmoothing, CanvasFillStrokeStyles, CanvasShadowStyles, CanvasFilters, CanvasRect, CanvasDrawPath, CanvasText, CanvasDrawImage, CanvasImageData, CanvasPathDrawingStyles, CanvasTextDrawingStyles, CanvasPath {
+ readonly canvas: OffscreenCanvas;
+ commit(): void;
+}
+
+declare var OffscreenCanvasRenderingContext2D: {
+ prototype: OffscreenCanvasRenderingContext2D;
+ new(): OffscreenCanvasRenderingContext2D;
+};
+
+/** Of the Canvas 2D API is used to declare a path that can then be used on a CanvasRenderingContext2D object. The path methods of the CanvasRenderingContext2D interface are also present on this interface, which gives you the convenience of being able to retain and replay your path whenever desired. */
interface Path2D extends CanvasPath {
addPath(path: Path2D, transform?: DOMMatrix2DInit): void;
}
@@ -2233,7 +2432,7 @@
"resourcetimingbufferfull": Event;
}
-/** The Performance interface provides access to performance-related information for the current page. It's part of the High Resolution Time API, but is enhanced by the Performance Timeline API, the Navigation Timing API, the User Timing API, and the Resource Timing API. */
+/** Provides access to performance-related information for the current page. It's part of the High Resolution Time API, but is enhanced by the Performance Timeline API, the Navigation Timing API, the User Timing API, and the Resource Timing API. */
interface Performance extends EventTarget {
onresourcetimingbufferfull: ((this: Performance, ev: Event) => any) | null;
readonly timeOrigin: number;
@@ -2259,7 +2458,7 @@
new(): Performance;
};
-/** The PerformanceEntry object encapsulates a single performance metric that is part of the performance timeline. A performance entry can be directly created by making a performance mark or measure (for example by calling the mark() method) at an explicit point in an application. Performance entries are also created in indirect ways such as loading a resource (such as an image). */
+/** Encapsulates a single performance metric that is part of the performance timeline. A performance entry can be directly created by making a performance mark or measure (for example by calling the mark() method) at an explicit point in an application. Performance entries are also created in indirect ways such as loading a resource (such as an image). */
interface PerformanceEntry {
readonly duration: number;
readonly entryType: string;
@@ -2293,13 +2492,14 @@
interface PerformanceObserver {
disconnect(): void;
- observe(options: PerformanceObserverInit): void;
+ observe(options?: PerformanceObserverInit): void;
takeRecords(): PerformanceEntryList;
}
declare var PerformanceObserver: {
prototype: PerformanceObserver;
new(callback: PerformanceObserverCallback): PerformanceObserver;
+ readonly supportedEntryTypes: ReadonlyArray<string>;
};
interface PerformanceObserverEntryList {
@@ -2313,7 +2513,7 @@
new(): PerformanceObserverEntryList;
};
-/** The PerformanceResourceTiming interface enables retrieval and analysis of detailed network timing data regarding the loading of an application's resources. An application can use the timing metrics to determine, for example, the length of time it takes to fetch a specific resource, such as an XMLHttpRequest, <SVG>, image, or script. */
+/** Enables retrieval and analysis of detailed network timing data regarding the loading of an application's resources. An application can use the timing metrics to determine, for example, the length of time it takes to fetch a specific resource, such as an XMLHttpRequest, <SVG>, image, or script. */
interface PerformanceResourceTiming extends PerformanceEntry {
readonly connectEnd: number;
readonly connectStart: number;
@@ -2340,7 +2540,34 @@
new(): PerformanceResourceTiming;
};
-/** The ProgressEvent interface represents events measuring progress of an underlying process, like an HTTP request (for an XMLHttpRequest, or the loading of the underlying resource of an <img>, <audio>, <video>, <style> or <link>). */
+interface PermissionStatusEventMap {
+ "change": Event;
+}
+
+interface PermissionStatus extends EventTarget {
+ onchange: ((this: PermissionStatus, ev: Event) => any) | null;
+ readonly state: PermissionState;
+ addEventListener<K extends keyof PermissionStatusEventMap>(type: K, listener: (this: PermissionStatus, ev: PermissionStatusEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
+ addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
+ removeEventListener<K extends keyof PermissionStatusEventMap>(type: K, listener: (this: PermissionStatus, ev: PermissionStatusEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
+ removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void;
+}
+
+declare var PermissionStatus: {
+ prototype: PermissionStatus;
+ new(): PermissionStatus;
+};
+
+interface Permissions {
+ query(permissionDesc: PermissionDescriptor | DevicePermissionDescriptor | MidiPermissionDescriptor | PushPermissionDescriptor): Promise<PermissionStatus>;
+}
+
+declare var Permissions: {
+ prototype: Permissions;
+ new(): Permissions;
+};
+
+/** Events measuring progress of an underlying process, like an HTTP request (for an XMLHttpRequest, or the loading of the underlying resource of an <img>, <audio>, <video>, <style> or <link>). */
interface ProgressEvent extends Event {
readonly lengthComputable: boolean;
readonly loaded: number;
@@ -2362,7 +2589,7 @@
new(type: string, eventInitDict: PromiseRejectionEventInit): PromiseRejectionEvent;
};
-/** The PushEvent interface of the Push API represents a push message that has been received. This event is sent to the global scope of a ServiceWorker. It contains the information sent from an application server to a PushSubscription. */
+/** An interface of the Push API represents a push message that has been received. This event is sent to the global scope of a ServiceWorker. It contains the information sent from an application server to a PushSubscription. */
interface PushEvent extends ExtendableEvent {
readonly data: PushMessageData | null;
}
@@ -2372,7 +2599,7 @@
new(type: string, eventInitDict?: PushEventInit): PushEvent;
};
-/** The PushManager interface of the Push API provides a way to receive notifications from third-party servers as well as request URLs for push notifications. */
+/** An interface of the Push API provides a way to receive notifications from third-party servers as well as request URLs for push notifications. */
interface PushManager {
getSubscription(): Promise<PushSubscription | null>;
permissionState(options?: PushSubscriptionOptionsInit): Promise<PushPermissionState>;
@@ -2385,7 +2612,7 @@
readonly supportedContentEncodings: ReadonlyArray<string>;
};
-/** The PushMessageData interface of the Push API provides methods which let you retrieve the push data sent by a server in various formats. */
+/** An interface of the Push API provides methods which let you retrieve the push data sent by a server in various formats. */
interface PushMessageData {
arrayBuffer(): ArrayBuffer;
blob(): Blob;
@@ -2398,7 +2625,7 @@
new(): PushMessageData;
};
-/** The PushSubscription interface of the Push API provides a subcription's URL endpoint and allows unsubscription from a push service. */
+/** An interface of the Push API provides a subcription's URL endpoint and allows unsubscription from a push service. */
interface PushSubscription {
readonly endpoint: string;
readonly expirationTime: number | null;
@@ -2441,7 +2668,7 @@
error(error?: any): void;
}
-/** The ReadableStream interface of the Streams API represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. */
+/** An interface of the Streams API represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object. */
interface ReadableStream<R = any> {
readonly locked: boolean;
cancel(reason?: any): Promise<void>;
@@ -2465,11 +2692,6 @@
releaseLock(): void;
}
-declare var ReadableStreamBYOBReader: {
- prototype: ReadableStreamBYOBReader;
- new(stream: ReadableStream<Uint8Array>): ReadableStreamBYOBReader;
-};
-
interface ReadableStreamBYOBRequest {
readonly view: ArrayBufferView;
respond(bytesWritten: number): void;
@@ -2506,7 +2728,7 @@
new(): ReadableStreamReader;
};
-/** The Request interface of the Fetch API represents a resource request. */
+/** An interface of the Fetch API represents a resource request. */
interface Request extends Body {
/**
* Returns the cache mode associated with request, which is a string indicating
@@ -2592,7 +2814,7 @@
new(input: RequestInfo, init?: RequestInit): Request;
};
-/** The Response interface of the Fetch API represents the response to a request. */
+/** An interface of the Fetch API represents the response to a request. */
interface Response extends Body {
readonly headers: Headers;
readonly ok: boolean;
@@ -2616,12 +2838,13 @@
"statechange": Event;
}
-/** The ServiceWorker interface of the ServiceWorker API provides a reference to a service worker. Multiple browsing contexts (e.g. pages, workers, etc.) can be associated with the same service worker, each through a unique ServiceWorker object. */
+/** An interface of the ServiceWorker API provides a reference to a service worker. Multiple browsing contexts (e.g. pages, workers, etc.) can be associated with the same service worker, each through a unique ServiceWorker object. */
interface ServiceWorker extends EventTarget, AbstractWorker {
onstatechange: ((this: ServiceWorker, ev: Event) => any) | null;
readonly scriptURL: string;
readonly state: ServiceWorkerState;
- postMessage(message: any, transfer?: Transferable[]): void;
+ postMessage(message: any, transfer: Transferable[]): void;
+ postMessage(message: any, options?: PostMessageOptions): void;
addEventListener<K extends keyof ServiceWorkerEventMap>(type: K, listener: (this: ServiceWorker, ev: ServiceWorkerEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
removeEventListener<K extends keyof ServiceWorkerEventMap>(type: K, listener: (this: ServiceWorker, ev: ServiceWorkerEventMap[K]) => any, options?: boolean | EventListenerOptions): void;
@@ -2674,7 +2897,7 @@
"sync": SyncEvent;
}
-/** The ServiceWorkerGlobalScope interface of the ServiceWorker API represents the global execution context of a service worker. */
+/** An interface of the ServiceWorker API represents the global execution context of a service worker. */
interface ServiceWorkerGlobalScope extends WorkerGlobalScope {
readonly clients: Clients;
onactivate: ((this: ServiceWorkerGlobalScope, ev: ExtendableEvent) => any) | null;
@@ -2704,7 +2927,7 @@
"updatefound": Event;
}
-/** The ServiceWorkerRegistration interface of the ServiceWorker API represents the service worker registration. You register a service worker to control one or more pages that share the same origin. */
+/** An interface of the ServiceWorker API represents the service worker registration. You register a service worker to control one or more pages that share the same origin. */
interface ServiceWorkerRegistration extends EventTarget {
readonly active: ServiceWorker | null;
readonly installing: ServiceWorker | null;
@@ -2740,7 +2963,7 @@
new(): StorageManager;
};
-/** The SubtleCrypto interface represents a set of cryptographic primitives. It is available via the Crypto.subtle properties available in a window context (via Window.crypto). */
+/** An interface of the Web Crypto API provides a number of low-level cryptographic functions. It is accessed via the Crypto.subtle properties available in a window context (via Window.crypto). */
interface SubtleCrypto {
decrypt(algorithm: string | RsaOaepParams | AesCtrParams | AesCbcParams | AesCmacParams | AesGcmParams | AesCfbParams, key: CryptoKey, data: Int8Array | Int16Array | Int32Array | Uint8Array | Uint16Array | Uint32Array | Uint8ClampedArray | Float32Array | Float64Array | DataView | ArrayBuffer): PromiseLike<ArrayBuffer>;
deriveBits(algorithm: string | EcdhKeyDeriveParams | DhKeyDeriveParams | ConcatParams | HkdfCtrParams | Pbkdf2Params, baseKey: CryptoKey, length: number): PromiseLike<ArrayBuffer>;
@@ -2767,7 +2990,7 @@
new(): SubtleCrypto;
};
-/** The SyncEvent interface represents a sync action that is dispatched on the ServiceWorkerGlobalScope of a ServiceWorker.  */
+/** A sync action that is dispatched on the ServiceWorkerGlobalScope of a ServiceWorker.  */
interface SyncEvent extends ExtendableEvent {
readonly lastChance: boolean;
readonly tag: string;
@@ -2778,7 +3001,7 @@
new(type: string, init: SyncEventInit): SyncEvent;
};
-/** The SyncManager interface of the the ServiceWorker API provides an interface for registering and listing sync registrations. */
+/** An interface of the ServiceWorker API provides an interface for registering and listing sync registrations. */
interface SyncManager {
getTags(): Promise<string[]>;
register(tag: string): Promise<void>;
@@ -2789,24 +3012,11 @@
new(): SyncManager;
};
-/** The TextDecoder interface represents a decoder for a specific method, that is a specific character encoding, like utf-8, iso-8859-2, koi8, cp1261, gbk, etc. A decoder takes a stream of bytes as input and emits a stream of code points. For a more scalable, non-native library, see StringView – a C-like representation of strings based on typed arrays. */
-interface TextDecoder {
- /**
- * Returns encoding's name, lowercased.
- */
- readonly encoding: string;
- /**
- * Returns true if error mode is "fatal", and false
- * otherwise.
- */
- readonly fatal: boolean;
- /**
- * Returns true if ignore BOM flag is set, and false otherwise.
- */
- readonly ignoreBOM: boolean;
+/** A decoder for a specific method, that is a specific character encoding, like utf-8, iso-8859-2, koi8, cp1261, gbk, etc. A decoder takes a stream of bytes as input and emits a stream of code points. For a more scalable, non-native library, see StringView – a C-like representation of strings based on typed arrays. */
+interface TextDecoder extends TextDecoderCommon {
/**
- * Returns the result of running encoding's decoder. The
- * method can be invoked zero or more times with options's stream set to
+ * Returns the result of running encoding's decoder.
+ * The method can be invoked zero or more times with options's stream set to
* true, and then once without options's stream (or set to false), to process
* a fragmented stream. If the invocation without options's stream (or set to
* false) has no input, it's clearest to omit both arguments.
@@ -2825,16 +3035,30 @@
new(label?: string, options?: TextDecoderOptions): TextDecoder;
};
-/** TextEncoder takes a stream of code points as input and emits a stream of bytes. For a more scalable, non-native library, see StringView – a C-like representation of strings based on typed arrays. */
-interface TextEncoder {
- /**
- * Returns "utf-8".
- */
+interface TextDecoderCommon {
readonly encoding: string;
+ readonly fatal: boolean;
+ readonly ignoreBOM: boolean;
+}
+
+interface TextDecoderStream extends TextDecoderCommon, GenericTransformStream {
+}
+
+declare var TextDecoderStream: {
+ prototype: TextDecoderStream;
+ new(label?: string, options?: TextDecoderOptions): TextDecoderStream;
+};
+
+/** TextEncoder takes a stream of code points as input and emits a stream of bytes. For a more scalable, non-native library, see StringView – a C-like representation of strings based on typed arrays. */
+interface TextEncoder extends TextEncoderCommon {
/**
* Returns the result of running UTF-8's encoder.
*/
encode(input?: string): Uint8Array;
+ /**
+ * Runs the UTF-8 encoder on source, stores the result of that operation into destination, and returns the progress made as a dictionary whereby read is the number of converted code units of source and written is the number of bytes modified in destination.
+ */
+ encodeInto(source: string, destination: Uint8Array): TextEncoderEncodeIntoResult;
}
declare var TextEncoder: {
@@ -2842,7 +3066,19 @@
new(): TextEncoder;
};
-/** The TextMetrics interface represents the dimension of a text in the canvas, as created by the CanvasRenderingContext2D.measureText() method. */
+interface TextEncoderCommon {
+ readonly encoding: string;
+}
+
+interface TextEncoderStream extends TextEncoderCommon, GenericTransformStream {
+}
+
+declare var TextEncoderStream: {
+ prototype: TextEncoderStream;
+ new(): TextEncoderStream;
+};
+
+/** The dimensions of a piece of text in the canvas, as created by the CanvasRenderingContext2D.measureText() method. */
interface TextMetrics {
readonly actualBoundingBoxAscent: number;
readonly actualBoundingBoxDescent: number;
@@ -3052,7 +3288,7 @@
restoreContext(): void;
}
-/** The WebGLActiveInfo interface is part of the WebGL API and represents the information returned by calling the WebGLRenderingContext.getActiveAttrib() and WebGLRenderingContext.getActiveUniform() methods. */
+/** Part of the WebGL API and represents the information returned by calling the WebGLRenderingContext.getActiveAttrib() and WebGLRenderingContext.getActiveUniform() methods. */
interface WebGLActiveInfo {
readonly name: string;
readonly size: GLint;
@@ -3064,7 +3300,7 @@
new(): WebGLActiveInfo;
};
-/** The WebGLBuffer interface is part of the WebGL API and represents an opaque buffer object storing data such as vertices or colors. */
+/** Part of the WebGL API and represents an opaque buffer object storing data such as vertices or colors. */
interface WebGLBuffer extends WebGLObject {
}
@@ -3083,7 +3319,7 @@
new(type: string, eventInit?: WebGLContextEventInit): WebGLContextEvent;
};
-/** The WebGLFramebuffer interface is part of the WebGL API and represents a collection of buffers that serve as a rendering destination. */
+/** Part of the WebGL API and represents a collection of buffers that serve as a rendering destination. */
interface WebGLFramebuffer extends WebGLObject {
}
@@ -3109,7 +3345,7 @@
new(): WebGLProgram;
};
-/** The WebGLRenderbuffer interface is part of the WebGL API and represents a buffer that can contain an image, or can be source or target of an rendering operation. */
+/** Part of the WebGL API and represents a buffer that can contain an image, or can be source or target of an rendering operation. */
interface WebGLRenderbuffer extends WebGLObject {
}
@@ -3118,7 +3354,7 @@
new(): WebGLRenderbuffer;
};
-/** The WebGLRenderingContext interface provides an interface to the OpenGL ES 2.0 graphics rendering context for the drawing surface of an HTML <canvas> element. */
+/** Provides an interface to the OpenGL ES 2.0 graphics rendering context for the drawing surface of an HTML <canvas> element. */
interface WebGLRenderingContext extends WebGLRenderingContextBase {
}
@@ -3894,7 +4130,7 @@
new(): WebGLShader;
};
-/** The WebGLShaderPrecisionFormat interface is part of the WebGL API and represents the information returned by calling the WebGLRenderingContext.getShaderPrecisionFormat() method. */
+/** Part of the WebGL API and represents the information returned by calling the WebGLRenderingContext.getShaderPrecisionFormat() method. */
interface WebGLShaderPrecisionFormat {
readonly precision: GLint;
readonly rangeMax: GLint;
@@ -3906,7 +4142,7 @@
new(): WebGLShaderPrecisionFormat;
};
-/** The WebGLTexture interface is part of the WebGL API and represents an opaque texture object providing storage and state for texturing operations. */
+/** Part of the WebGL API and represents an opaque texture object providing storage and state for texturing operations. */
interface WebGLTexture extends WebGLObject {
}
@@ -3915,7 +4151,7 @@
new(): WebGLTexture;
};
-/** The WebGLUniformLocation interface is part of the WebGL API and represents the location of a uniform variable in a shader program. */
+/** Part of the WebGL API and represents the location of a uniform variable in a shader program. */
interface WebGLUniformLocation {
}
@@ -3934,7 +4170,7 @@
"open": Event;
}
-/** The WebSocket object provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection. */
+/** Provides the API for creating and managing a WebSocket connection to a server, as well as for sending and receiving data on the connection. */
interface WebSocket extends EventTarget {
binaryType: BinaryType;
readonly bufferedAmount: number;
@@ -3972,7 +4208,7 @@
btoa(rawString: string): string;
}
-/** The WindowClient interface of the ServiceWorker API represents the scope of a service worker client that is a document in a browser context, controlled by an active worker. The service worker client independently selects and uses a service worker for its own loading and sub-resources. */
+/** An interface of the ServiceWorker API represents the scope of a service worker client that is a document in a browser context, controlled by an active worker. The service worker client independently selects and uses a service worker for its own loading and sub-resources. */
interface WindowClient extends Client {
readonly ancestorOrigins: ReadonlyArray<string>;
readonly focused: boolean;
@@ -4012,10 +4248,11 @@
"message": MessageEvent;
}
-/** The Worker interface of the Web Workers API represents a background task that can be easily created and can send messages back to its creator. Creating a worker is as simple as calling the Worker() constructor and specifying a script to be run in the worker thread. */
+/** An interface of the Web Workers API represents a background task that can be easily created and can send messages back to its creator. Creating a worker is as simple as calling the Worker() constructor and specifying a script to be run in the worker thread. */
interface Worker extends EventTarget, AbstractWorker {
onmessage: ((this: Worker, ev: MessageEvent) => any) | null;
- postMessage(message: any, transfer?: Transferable[]): void;
+ postMessage(message: any, transfer: Transferable[]): void;
+ postMessage(message: any, options?: PostMessageOptions): void;
terminate(): void;
addEventListener<K extends keyof WorkerEventMap>(type: K, listener: (this: Worker, ev: WorkerEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void;
addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void;
@@ -4032,7 +4269,7 @@
"error": ErrorEvent;
}
-/** The WorkerGlobalScope interface of the Web Workers API is an interface representing the scope of any worker. Workers have no browsing context; this scope contains the information usually conveyed by Window objects — in this case event handlers, the console or the associated WorkerNavigator object. Each WorkerGlobalScope has its own event loop. */
+/** An interface of the Web Workers API is an interface representing the scope of any worker. Workers have no browsing context; this scope contains the information usually conveyed by Window objects — in this case event handlers, the console or the associated WorkerNavigator object. Each WorkerGlobalScope has its own event loop. */
interface WorkerGlobalScope extends EventTarget, WorkerUtils, WindowConsole, GlobalFetch, WindowOrWorkerGlobalScope {
readonly caches: CacheStorage;
readonly isSecureContext: boolean;
@@ -4052,7 +4289,7 @@
new(): WorkerGlobalScope;
};
-/** The WorkerLocation interface defines the absolute location of the script executed by the Worker. Such an object is initialized for each worker and is available via the WorkerGlobalScope.location property obtained by calling self.location. */
+/** The absolute location of the script executed by the Worker. Such an object is initialized for each worker and is available via the WorkerGlobalScope.location property obtained by calling self.location. */
interface WorkerLocation {
readonly hash: string;
readonly host: string;
@@ -4071,8 +4308,9 @@
new(): WorkerLocation;
};
-/** The WorkerNavigator interface represents a subset of the Navigator interface allowed to be accessed from a Worker. Such an object is initialized for each worker and is available via the WorkerGlobalScope.navigator property obtained by calling window.self.navigator. */
+/** A subset of the Navigator interface allowed to be accessed from a Worker. Such an object is initialized for each worker and is available via the WorkerGlobalScope.navigator property obtained by calling window.self.navigator. */
interface WorkerNavigator extends NavigatorID, NavigatorOnLine, NavigatorBeacon, NavigatorConcurrentHardware, NavigatorStorage {
+ readonly permissions: Permissions;
readonly serviceWorker: ServiceWorkerContainer;
}
@@ -4088,7 +4326,7 @@
importScripts(...urls: string[]): void;
}
-/** The WritableStream interface of the the Streams API provides a standard abstraction for writing streaming data to a destination, known as a sink. This object comes with built-in backpressure and queuing. */
+/** An interface of the Streams API provides a standard abstraction for writing streaming data to a destination, known as a sink. This object comes with built-in backpressure and queuing. */
interface WritableStream<W = any> {
readonly locked: boolean;
abort(reason?: any): Promise<void>;
@@ -4100,12 +4338,12 @@
new<W = any>(underlyingSink?: UnderlyingSink<W>, strategy?: QueuingStrategy<W>): WritableStream<W>;
};
-/** The WritableStreamDefaultController interface of the the Streams API represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate. */
+/** An interface of the Streams API represents a controller allowing control of a WritableStream's state. When constructing a WritableStream, the underlying sink is given a corresponding WritableStreamDefaultController instance to manipulate. */
interface WritableStreamDefaultController {
error(error?: any): void;
}
-/** The WritableStreamDefaultWriter interface of the the Streams API is the object returned by WritableStream.getWriter() and once created locks the < writer to the WritableStream ensuring that no other streams can write to the underlying sink. */
+/** An interface of the Streams API is the object returned by WritableStream.getWriter() and once created locks the < writer to the WritableStream ensuring that no other streams can write to the underlying sink. */
interface WritableStreamDefaultWriter<W = any> {
readonly closed: Promise<void>;
readonly desiredSize: number | null;
@@ -4271,6 +4509,99 @@
declare type EventListenerOrEventListenerObject = EventListener | EventListenerObject;
+declare namespace WebAssembly {
+ interface Global {
+ value: any;
+ valueOf(): any;
+ }
+
+ var Global: {
+ prototype: Global;
+ new(descriptor: GlobalDescriptor, value?: any): Global;
+ };
+
+ interface Instance {
+ readonly exports: any;
+ }
+
+ var Instance: {
+ prototype: Instance;
+ new(module: Module, importObject?: any): Instance;
+ };
+
+ interface Memory {
+ readonly buffer: ArrayBuffer;
+ grow(delta: number): number;
+ }
+
+ var Memory: {
+ prototype: Memory;
+ new(descriptor: MemoryDescriptor): Memory;
+ };
+
+ interface Module {
+ }
+
+ var Module: {
+ prototype: Module;
+ new(bytes: BufferSource): Module;
+ customSections(module: Module, sectionName: string): ArrayBuffer[];
+ exports(module: Module): ModuleExportDescriptor[];
+ imports(module: Module): ModuleImportDescriptor[];
+ };
+
+ interface Table {
+ readonly length: number;
+ get(index: number): Function | null;
+ grow(delta: number): number;
+ set(index: number, value: Function | null): void;
+ }
+
+ var Table: {
+ prototype: Table;
+ new(descriptor: TableDescriptor): Table;
+ };
+
+ interface GlobalDescriptor {
+ mutable?: boolean;
+ value: string;
+ }
+
+ interface MemoryDescriptor {
+ initial: number;
+ maximum?: number;
+ }
+
+ interface ModuleExportDescriptor {
+ kind: ImportExportKind;
+ name: string;
+ }
+
+ interface ModuleImportDescriptor {
+ kind: ImportExportKind;
+ module: string;
+ name: string;
+ }
+
+ interface TableDescriptor {
+ element: TableKind;
+ initial: number;
+ maximum?: number;
+ }
+
+ interface WebAssemblyInstantiatedSource {
+ instance: Instance;
+ module: Module;
+ }
+
+ type ImportExportKind = "function" | "table" | "memory" | "global";
+ type TableKind = "anyfunc";
+ function compile(bytes: BufferSource): Promise<Module>;
+ function instantiate(bytes: BufferSource, importObject?: any): Promise<WebAssemblyInstantiatedSource>;
+ function instantiate(moduleObject: Module, importObject?: any): Promise<Instance>;
+ function validate(bytes: BufferSource): boolean;
+}
+
interface EventHandlerNonNull {
(event: Event): any;
}
@@ -4321,7 +4652,8 @@
declare var onmessage: ((this: DedicatedWorkerGlobalScope, ev: MessageEvent) => any) | null;
declare function close(): void;
-declare function postMessage(message: any, transfer?: Transferable[]): void;
+declare function postMessage(message: any, transfer: Transferable[]): void;
+declare function postMessage(message: any, options?: PostMessageOptions): void;
/**
* Dispatches a synthetic event event to target and returns true
* if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.
@@ -4371,7 +4703,8 @@
type BodyInit = Blob | BufferSource | FormData | URLSearchParams | ReadableStream<Uint8Array> | string;
type RequestInfo = Request | string;
type DOMHighResTimeStamp = number;
-type CanvasImageSource = ImageBitmap;
+type CanvasImageSource = ImageBitmap | OffscreenCanvas;
+type OffscreenRenderingContext = OffscreenCanvasRenderingContext2D | WebGLRenderingContext;
type MessageEventSource = MessagePort | ServiceWorker;
type ImageBitmapSource = CanvasImageSource | Blob | ImageData;
type TimerHandler = string | Function;
@@ -4401,16 +4734,27 @@
type IDBValidKey = number | string | Date | BufferSource | IDBArrayKey;
type Transferable = ArrayBuffer | MessagePort | ImageBitmap;
type BinaryType = "blob" | "arraybuffer";
+type CanvasDirection = "ltr" | "rtl" | "inherit";
+type CanvasFillRule = "nonzero" | "evenodd";
+type CanvasLineCap = "butt" | "round" | "square";
+type CanvasLineJoin = "round" | "bevel" | "miter";
+type CanvasTextAlign = "start" | "end" | "left" | "right" | "center";
+type CanvasTextBaseline = "top" | "hanging" | "middle" | "alphabetic" | "ideographic" | "bottom";
type ClientTypes = "window" | "worker" | "sharedworker" | "all";
type EndingType = "transparent" | "native";
+type FrameType = "auxiliary" | "top-level" | "nested" | "none";
type IDBCursorDirection = "next" | "nextunique" | "prev" | "prevunique";
type IDBRequestReadyState = "pending" | "done";
type IDBTransactionMode = "readonly" | "readwrite" | "versionchange";
+type ImageSmoothingQuality = "low" | "medium" | "high";
type KeyFormat = "raw" | "spki" | "pkcs8" | "jwk";
type KeyType = "public" | "private" | "secret";
type KeyUsage = "encrypt" | "decrypt" | "sign" | "verify" | "deriveKey" | "deriveBits" | "wrapKey" | "unwrapKey";
type NotificationDirection = "auto" | "ltr" | "rtl";
type NotificationPermission = "default" | "denied" | "granted";
+type OffscreenRenderingContextId = "2d" | "webgl";
+type PermissionName = "geolocation" | "notifications" | "push" | "midi" | "camera" | "microphone" | "speaker" | "device-info" | "background-sync" | "bluetooth" | "persistent-storage" | "ambient-light-sensor" | "accelerometer" | "gyroscope" | "magnetometer" | "clipboard";
+type PermissionState = "granted" | "denied" | "prompt";
type PushEncryptionKeyName = "p256dh" | "auth";
type PushPermissionState = "denied" | "granted" | "prompt";
type ReferrerPolicy = "" | "no-referrer" | "no-referrer-when-downgrade" | "same-origin" | "origin" | "strict-origin" | "origin-when-cross-origin" | "strict-origin-when-cross-origin" | "unsafe-url";

lib/protocol.d.ts

@@ -63,7 +63,8 @@
GetEditsForRefactor = "getEditsForRefactor",
OrganizeImports = "organizeImports",
GetEditsForFileRename = "getEditsForFileRename",
- ConfigurePlugin = "configurePlugin"
+ ConfigurePlugin = "configurePlugin",
+ SelectionRange = "selectionRange"
}
/**
* A TypeScript Server message
@@ -1026,6 +1027,20 @@
}
interface ConfigurePluginResponse extends Response {
}
+ interface SelectionRangeRequest extends FileRequest {
+ command: CommandTypes.SelectionRange;
+ arguments: SelectionRangeRequestArgs;
+ }
+ interface SelectionRangeRequestArgs extends FileRequestArgs {
+ locations: Location[];
+ }
+ interface SelectionRangeResponse extends Response {
+ body?: SelectionRange[];
+ }
+ interface SelectionRange {
+ textSpan: TextSpan;
+ parent?: SelectionRange;
+ }
/**
* Information found in an "open" request.
*/
@@ -2411,6 +2426,9 @@
ES2015 = "ES2015",
ES2016 = "ES2016",
ES2017 = "ES2017",
+ ES2018 = "ES2018",
+ ES2019 = "ES2019",
+ ES2020 = "ES2020",
ESNext = "ESNext"
}
}

lib/tsc.js

@@ -59,8 +59,8 @@
};
var ts;
(function (ts) {
- ts.versionMajorMinor = "3.4";
- ts.version = ts.versionMajorMinor + ".5";
+ ts.versionMajorMinor = "3.5";
+ ts.version = ts.versionMajorMinor + ".1";
})(ts || (ts = {}));
(function (ts) {
ts.emptyArray = [];
@@ -251,7 +251,7 @@
ts.firstDefinedIterator = firstDefinedIterator;
function zipWith(arrayA, arrayB, callback) {
var result = [];
- Debug.assertEqual(arrayA.length, arrayB.length);
+ ts.Debug.assertEqual(arrayA.length, arrayB.length);
for (var i = 0; i < arrayA.length; i++) {
result.push(callback(arrayA[i], arrayB[i], i));
}
@@ -259,7 +259,7 @@
}
ts.zipWith = zipWith;
function zipToIterator(arrayA, arrayB) {
- Debug.assertEqual(arrayA.length, arrayB.length);
+ ts.Debug.assertEqual(arrayA.length, arrayB.length);
var i = 0;
return {
next: function () {
@@ -273,7 +273,7 @@
}
ts.zipToIterator = zipToIterator;
function zipToMap(keys, values) {
- Debug.assert(keys.length === values.length);
+ ts.Debug.assert(keys.length === values.length);
var map = createMap();
for (var i = 0; i < keys.length; ++i) {
map.set(keys[i], values[i]);
@@ -337,7 +337,7 @@
return result;
}
}
- return Debug.fail();
+ return ts.Debug.fail();
}
ts.findMap = findMap;
function contains(array, value, equalityComparer) {
@@ -745,7 +745,7 @@
case 0:
continue;
case -1:
- return Debug.fail("Array is unsorted.");
+ return ts.Debug.fail("Array is unsorted.");
}
deduplicated.push(last = next);
}
@@ -806,11 +806,11 @@
var result = [];
loopB: for (var offsetA = 0, offsetB = 0; offsetB < arrayB.length; offsetB++) {
if (offsetB > 0) {
- Debug.assertGreaterThanOrEqual(comparer(arrayB[offsetB], arrayB[offsetB - 1]), 0);
+ ts.Debug.assertGreaterThanOrEqual(comparer(arrayB[offsetB], arrayB[offsetB - 1]), 0);
}
loopA: for (var startA = offsetA; offsetA < arrayA.length; offsetA++) {
if (offsetA > startA) {
- Debug.assertGreaterThanOrEqual(comparer(arrayA[offsetA], arrayA[offsetA - 1]), 0);
+ ts.Debug.assertGreaterThanOrEqual(comparer(arrayA[offsetA], arrayA[offsetA - 1]), 0);
}
switch (comparer(arrayB[offsetB], arrayA[offsetA])) {
case -1:
@@ -948,7 +948,7 @@
}
ts.firstOrUndefined = firstOrUndefined;
function first(array) {
- Debug.assert(array.length !== 0);
+ ts.Debug.assert(array.length !== 0);
return array[0];
}
ts.first = first;
@@ -957,7 +957,7 @@
}
ts.lastOrUndefined = lastOrUndefined;
function last(array) {
- Debug.assert(array.length !== 0);
+ ts.Debug.assert(array.length !== 0);
return array[array.length - 1];
}
ts.last = last;
@@ -1231,7 +1231,7 @@
function cast(value, test) {
if (value !== undefined && test(value))
return value;
- return Debug.fail("Invalid cast. The supplied value " + value + " did not pass the test '" + Debug.getFunctionName(test) + "'.");
+ return ts.Debug.fail("Invalid cast. The supplied value " + value + " did not pass the test '" + ts.Debug.getFunctionName(test) + "'.");
}
ts.cast = cast;
function noop(_) { }
@@ -1261,38 +1261,13 @@
};
}
ts.memoize = memoize;
- function chain(a, b, c, d, e) {
+ function compose(a, b, c, d, e) {
if (e) {
var args_2 = [];
for (var i = 0; i < arguments.length; i++) {
args_2[i] = arguments[i];
}
- return function (t) { return compose.apply(void 0, map(args_2, function (f) { return f(t); })); };
- }
- else if (d) {
- return function (t) { return compose(a(t), b(t), c(t), d(t)); };
- }
- else if (c) {
- return function (t) { return compose(a(t), b(t), c(t)); };
- }
- else if (b) {
- return function (t) { return compose(a(t), b(t)); };
- }
- else if (a) {
- return function (t) { return compose(a(t)); };
- }
- else {
- return function (_) { return function (u) { return u; }; };
- }
- }
- ts.chain = chain;
- function compose(a, b, c, d, e) {
- if (e) {
- var args_3 = [];
- for (var i = 0; i < arguments.length; i++) {
- args_3[i] = arguments[i];
- }
- return function (t) { return reduceLeft(args_3, function (u, f) { return f(u); }, t); };
+ return function (t) { return reduceLeft(args_2, function (u, f) { return f(u); }, t); };
}
else if (d) {
return function (t) { return d(c(b(a(t)))); };
@@ -1311,92 +1286,6 @@
}
}
ts.compose = compose;
- var Debug;
- (function (Debug) {
- Debug.currentAssertionLevel = 0;
- Debug.isDebugging = false;
- function shouldAssert(level) {
- return Debug.currentAssertionLevel >= level;
- }
- Debug.shouldAssert = shouldAssert;
- function assert(expression, message, verboseDebugInfo, stackCrawlMark) {
- if (!expression) {
- if (verboseDebugInfo) {
- message += "\r\nVerbose Debug Information: " + (typeof verboseDebugInfo === "string" ? verboseDebugInfo : verboseDebugInfo());
- }
- fail(message ? "False expression: " + message : "False expression.", stackCrawlMark || assert);
- }
- }
- Debug.assert = assert;
- function assertEqual(a, b, msg, msg2) {
- if (a !== b) {
- var message = msg ? msg2 ? msg + " " + msg2 : msg : "";
- fail("Expected " + a + " === " + b + ". " + message);
- }
- }
- Debug.assertEqual = assertEqual;
- function assertLessThan(a, b, msg) {
- if (a >= b) {
- fail("Expected " + a + " < " + b + ". " + (msg || ""));
- }
- }
- Debug.assertLessThan = assertLessThan;
- function assertLessThanOrEqual(a, b) {
- if (a > b) {
- fail("Expected " + a + " <= " + b);
- }
- }
- Debug.assertLessThanOrEqual = assertLessThanOrEqual;
- function assertGreaterThanOrEqual(a, b) {
- if (a < b) {
- fail("Expected " + a + " >= " + b);
- }
- }
- Debug.assertGreaterThanOrEqual = assertGreaterThanOrEqual;
- function fail(message, stackCrawlMark) {
- debugger;
- var e = new Error(message ? "Debug Failure. " + message : "Debug Failure.");
- if (Error.captureStackTrace) {
- Error.captureStackTrace(e, stackCrawlMark || fail);
- }
- throw e;
- }
- Debug.fail = fail;
- function assertDefined(value, message) {
- if (value === undefined || value === null)
- return fail(message);
- return value;
- }
- Debug.assertDefined = assertDefined;
- function assertEachDefined(value, message) {
- for (var _i = 0, value_1 = value; _i < value_1.length; _i++) {
- var v = value_1[_i];
- assertDefined(v, message);
- }
- return value;
- }
- Debug.assertEachDefined = assertEachDefined;
- function assertNever(member, message, stackCrawlMark) {
- if (message === void 0) { message = "Illegal value:"; }
- var detail = typeof member === "object" && "kind" in member && "pos" in member ? "SyntaxKind: " + Debug.showSyntaxKind(member) : JSON.stringify(member);
- return fail(message + " " + detail, stackCrawlMark || assertNever);
- }
- Debug.assertNever = assertNever;
- function getFunctionName(func) {
- if (typeof func !== "function") {
- return "";
- }
- else if (func.hasOwnProperty("name")) {
- return func.name;
- }
- else {
- var text = Function.prototype.toString.call(func);
- var match = /^function\s+([\w\$]+)\s*\(/.exec(text);
- return match ? match[1] : "";
- }
- }
- Debug.getFunctionName = getFunctionName;
- })(Debug = ts.Debug || (ts.Debug = {}));
function equateValues(a, b) {
return a === b;
}
@@ -1567,7 +1456,7 @@
bestCandidate = candidate;
}
else {
- Debug.assert(distance < bestDistance);
+ ts.Debug.assert(distance < bestDistance);
bestDistance = distance;
bestCandidate = candidate;
}
@@ -1693,7 +1582,7 @@
}
ts.patternText = patternText;
function matchedText(pattern, candidate) {
- Debug.assert(isPatternMatch(pattern, candidate));
+ ts.Debug.assert(isPatternMatch(pattern, candidate));
return candidate.substring(pattern.prefix.length, candidate.length - pattern.suffix.length);
}
ts.matchedText = matchedText;
@@ -1784,6 +1673,259 @@
return result;
}
ts.fill = fill;
+ function cartesianProduct(arrays) {
+ var result = [];
+ cartesianProductWorker(arrays, result, undefined, 0);
+ return result;
+ }
+ ts.cartesianProduct = cartesianProduct;
+ function cartesianProductWorker(arrays, result, outer, index) {
+ for (var _i = 0, _a = arrays[index]; _i < _a.length; _i++) {
+ var element = _a[_i];
+ var inner = void 0;
+ if (outer) {
+ inner = outer.slice();
+ inner.push(element);
+ }
+ else {
+ inner = [element];
+ }
+ if (index === arrays.length - 1) {
+ result.push(inner);
+ }
+ else {
+ cartesianProductWorker(arrays, result, inner, index + 1);
+ }
+ }
+ }
+})(ts || (ts = {}));
+var ts;
+(function (ts) {
+ var Debug;
+ (function (Debug) {
+ Debug.currentAssertionLevel = 0;
+ Debug.isDebugging = false;
+ function shouldAssert(level) {
+ return Debug.currentAssertionLevel >= level;
+ }
+ Debug.shouldAssert = shouldAssert;
+ function assert(expression, message, verboseDebugInfo, stackCrawlMark) {
+ if (!expression) {
+ if (verboseDebugInfo) {
+ message += "\r\nVerbose Debug Information: " + (typeof verboseDebugInfo === "string" ? verboseDebugInfo : verboseDebugInfo());
+ }
+ fail(message ? "False expression: " + message : "False expression.", stackCrawlMark || assert);
+ }
+ }
+ Debug.assert = assert;
+ function assertEqual(a, b, msg, msg2) {
+ if (a !== b) {
+ var message = msg ? msg2 ? msg + " " + msg2 : msg : "";
+ fail("Expected " + a + " === " + b + ". " + message);
+ }
+ }
+ Debug.assertEqual = assertEqual;
+ function assertLessThan(a, b, msg) {
+ if (a >= b) {
+ fail("Expected " + a + " < " + b + ". " + (msg || ""));
+ }
+ }
+ Debug.assertLessThan = assertLessThan;
+ function assertLessThanOrEqual(a, b) {
+ if (a > b) {
+ fail("Expected " + a + " <= " + b);
+ }
+ }
+ Debug.assertLessThanOrEqual = assertLessThanOrEqual;
+ function assertGreaterThanOrEqual(a, b) {
+ if (a < b) {
+ fail("Expected " + a + " >= " + b);
+ }
+ }
+ Debug.assertGreaterThanOrEqual = assertGreaterThanOrEqual;
+ function fail(message, stackCrawlMark) {
+ debugger;
+ var e = new Error(message ? "Debug Failure. " + message : "Debug Failure.");
+ if (Error.captureStackTrace) {
+ Error.captureStackTrace(e, stackCrawlMark || fail);
+ }
+ throw e;
+ }
+ Debug.fail = fail;
+ function assertDefined(value, message) {
+ if (value === undefined || value === null)
+ return fail(message);
+ return value;
+ }
+ Debug.assertDefined = assertDefined;
+ function assertEachDefined(value, message) {
+ for (var _i = 0, value_1 = value; _i < value_1.length; _i++) {
+ var v = value_1[_i];
+ assertDefined(v, message);
+ }
+ return value;
+ }
+ Debug.assertEachDefined = assertEachDefined;
+ function assertNever(member, message, stackCrawlMark) {
+ if (message === void 0) { message = "Illegal value:"; }
+ var detail = typeof member === "object" && "kind" in member && "pos" in member && formatSyntaxKind ? "SyntaxKind: " + formatSyntaxKind(member.kind) : JSON.stringify(member);
+ return fail(message + " " + detail, stackCrawlMark || assertNever);
+ }
+ Debug.assertNever = assertNever;
+ function getFunctionName(func) {
+ if (typeof func !== "function") {
+ return "";
+ }
+ else if (func.hasOwnProperty("name")) {
+ return func.name;
+ }
+ else {
+ var text = Function.prototype.toString.call(func);
+ var match = /^function\s+([\w\$]+)\s*\(/.exec(text);
+ return match ? match[1] : "";
+ }
+ }
+ Debug.getFunctionName = getFunctionName;
+ function formatSymbol(symbol) {
+ return "{ name: " + ts.unescapeLeadingUnderscores(symbol.escapedName) + "; flags: " + formatSymbolFlags(symbol.flags) + "; declarations: " + ts.map(symbol.declarations, function (node) { return formatSyntaxKind(node.kind); }) + " }";
+ }
+ Debug.formatSymbol = formatSymbol;
+ function formatEnum(value, enumObject, isFlags) {
+ if (value === void 0) { value = 0; }
+ var members = getEnumMembers(enumObject);
+ if (value === 0) {
+ return members.length > 0 && members[0][0] === 0 ? members[0][1] : "0";
+ }
+ if (isFlags) {
+ var result = "";
+ var remainingFlags = value;
+ for (var i = members.length - 1; i >= 0 && remainingFlags !== 0; i--) {
+ var _a = members[i], enumValue = _a[0], enumName = _a[1];
+ if (enumValue !== 0 && (remainingFlags & enumValue) === enumValue) {
+ remainingFlags &= ~enumValue;
+ result = "" + enumName + (result ? "|" : "") + result;
+ }
+ }
+ if (remainingFlags === 0) {
+ return result;
+ }
+ }
+ else {
+ for (var _i = 0, members_1 = members; _i < members_1.length; _i++) {
+ var _b = members_1[_i], enumValue = _b[0], enumName = _b[1];
+ if (enumValue === value) {
+ return enumName;
+ }
+ }
+ }
+ return value.toString();
+ }
+ Debug.formatEnum = formatEnum;
+ function getEnumMembers(enumObject) {
+ var result = [];
+ for (var name in enumObject) {
+ var value = enumObject[name];
+ if (typeof value === "number") {
+ result.push([value, name]);
+ }
+ }
+ return ts.stableSort(result, function (x, y) { return ts.compareValues(x[0], y[0]); });
+ }
+ function formatSyntaxKind(kind) {
+ return formatEnum(kind, ts.SyntaxKind, false);
+ }
+ Debug.formatSyntaxKind = formatSyntaxKind;
+ function formatNodeFlags(flags) {
+ return formatEnum(flags, ts.NodeFlags, true);
+ }
+ Debug.formatNodeFlags = formatNodeFlags;
+ function formatModifierFlags(flags) {
+ return formatEnum(flags, ts.ModifierFlags, true);
+ }
+ Debug.formatModifierFlags = formatModifierFlags;
+ function formatTransformFlags(flags) {
+ return formatEnum(flags, ts.TransformFlags, true);
+ }
+ Debug.formatTransformFlags = formatTransformFlags;
+ function formatEmitFlags(flags) {
+ return formatEnum(flags, ts.EmitFlags, true);
+ }
+ Debug.formatEmitFlags = formatEmitFlags;
+ function formatSymbolFlags(flags) {
+ return formatEnum(flags, ts.SymbolFlags, true);
+ }
+ Debug.formatSymbolFlags = formatSymbolFlags;
+ function formatTypeFlags(flags) {
+ return formatEnum(flags, ts.TypeFlags, true);
+ }
+ Debug.formatTypeFlags = formatTypeFlags;
+ function formatObjectFlags(flags) {
+ return formatEnum(flags, ts.ObjectFlags, true);
+ }
+ Debug.formatObjectFlags = formatObjectFlags;
+ function failBadSyntaxKind(node, message) {
+ return fail((message || "Unexpected node.") + "\r\nNode " + formatSyntaxKind(node.kind) + " was unexpected.", failBadSyntaxKind);
+ }
+ Debug.failBadSyntaxKind = failBadSyntaxKind;
+ Debug.assertEachNode = shouldAssert(1)
+ ? function (nodes, test, message) { return assert(test === undefined || ts.every(nodes, test), message || "Unexpected node.", function () { return "Node array did not pass test '" + getFunctionName(test) + "'."; }, Debug.assertEachNode); }
+ : ts.noop;
+ Debug.assertNode = shouldAssert(1)
+ ? function (node, test, message) { return assert(test === undefined || test(node), message || "Unexpected node.", function () { return "Node " + formatSyntaxKind(node.kind) + " did not pass test '" + getFunctionName(test) + "'."; }, Debug.assertNode); }
+ : ts.noop;
+ Debug.assertOptionalNode = shouldAssert(1)
+ ? function (node, test, message) { return assert(test === undefined || node === undefined || test(node), message || "Unexpected node.", function () { return "Node " + formatSyntaxKind(node.kind) + " did not pass test '" + getFunctionName(test) + "'."; }, Debug.assertOptionalNode); }
+ : ts.noop;
+ Debug.assertOptionalToken = shouldAssert(1)
+ ? function (node, kind, message) { return assert(kind === undefined || node === undefined || node.kind === kind, message || "Unexpected node.", function () { return "Node " + formatSyntaxKind(node.kind) + " was not a '" + formatSyntaxKind(kind) + "' token."; }, Debug.assertOptionalToken); }
+ : ts.noop;
+ Debug.assertMissingNode = shouldAssert(1)
+ ? function (node, message) { return assert(node === undefined, message || "Unexpected node.", function () { return "Node " + formatSyntaxKind(node.kind) + " was unexpected'."; }, Debug.assertMissingNode); }
+ : ts.noop;
+ var isDebugInfoEnabled = false;
+ function enableDebugInfo() {
+ if (isDebugInfoEnabled)
+ return;
+ Object.defineProperties(ts.objectAllocator.getSymbolConstructor().prototype, {
+ __debugFlags: { get: function () { return formatSymbolFlags(this.flags); } }
+ });
+ Object.defineProperties(ts.objectAllocator.getTypeConstructor().prototype, {
+ __debugFlags: { get: function () { return formatTypeFlags(this.flags); } },
+ __debugObjectFlags: { get: function () { return this.flags & 524288 ? formatObjectFlags(this.objectFlags) : ""; } },
+ __debugTypeToString: { value: function () { return this.checker.typeToString(this); } },
+ });
+ var nodeConstructors = [
+ ts.objectAllocator.getNodeConstructor(),
+ ts.objectAllocator.getIdentifierConstructor(),
+ ts.objectAllocator.getTokenConstructor(),
+ ts.objectAllocator.getSourceFileConstructor()
+ ];
+ for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) {
+ var ctor = nodeConstructors_1[_i];
+ if (!ctor.prototype.hasOwnProperty("__debugKind")) {
+ Object.defineProperties(ctor.prototype, {
+ __debugKind: { get: function () { return formatSyntaxKind(this.kind); } },
+ __debugNodeFlags: { get: function () { return formatNodeFlags(this.flags); } },
+ __debugModifierFlags: { get: function () { return formatModifierFlags(ts.getModifierFlagsNoCache(this)); } },
+ __debugTransformFlags: { get: function () { return formatTransformFlags(this.transformFlags); } },
+ __debugIsParseTreeNode: { get: function () { return ts.isParseTreeNode(this); } },
+ __debugEmitFlags: { get: function () { return formatEmitFlags(ts.getEmitFlags(this)); } },
+ __debugGetText: {
+ value: function (includeTrivia) {
+ if (ts.nodeIsSynthesized(this))
+ return "";
+ var parseNode = ts.getParseTreeNode(this);
+ var sourceFile = parseNode && ts.getSourceFileOfNode(parseNode);
+ return sourceFile ? ts.getSourceTextOfNodeFromSourceFile(sourceFile, parseNode, includeTrivia) : "";
+ }
+ }
+ });
+ }
+ }
+ isDebugInfoEnabled = true;
+ }
+ Debug.enableDebugInfo = enableDebugInfo;
+ })(Debug = ts.Debug || (ts.Debug = {}));
})(ts || (ts = {}));
var ts;
(function (ts) {
@@ -2207,10 +2349,7 @@
ModuleKind[ModuleKind["ES2015"] = 5] = "ES2015";
ModuleKind[ModuleKind["ESNext"] = 6] = "ESNext";
})(ModuleKind = ts.ModuleKind || (ts.ModuleKind = {}));
- function _contextuallyTypePragmas(args) {
- return args;
- }
- ts.commentPragmas = _contextuallyTypePragmas({
+ ts.commentPragmas = {
"reference": {
args: [
{ name: "types", optional: true, captureSpan: true },
@@ -2238,7 +2377,7 @@
args: [{ name: "factory" }],
kind: 4
},
- });
+ };
})(ts || (ts = {}));
var ts;
(function (ts) {
@@ -3141,7 +3280,7 @@
_0_modifier_cannot_appear_on_a_data_property: diag(1043, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_data_property_1043", "'{0}' modifier cannot appear on a data property."),
_0_modifier_cannot_appear_on_a_module_or_namespace_element: diag(1044, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_module_or_namespace_element_1044", "'{0}' modifier cannot appear on a module or namespace element."),
A_0_modifier_cannot_be_used_with_an_interface_declaration: diag(1045, ts.DiagnosticCategory.Error, "A_0_modifier_cannot_be_used_with_an_interface_declaration_1045", "A '{0}' modifier cannot be used with an interface declaration."),
- A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: diag(1046, ts.DiagnosticCategory.Error, "A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file_1046", "A 'declare' modifier is required for a top level declaration in a .d.ts file."),
+ Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier: diag(1046, ts.DiagnosticCategory.Error, "Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier_1046", "Top-level declarations in .d.ts files must start with either a 'declare' or 'export' modifier."),
A_rest_parameter_cannot_be_optional: diag(1047, ts.DiagnosticCategory.Error, "A_rest_parameter_cannot_be_optional_1047", "A rest parameter cannot be optional."),
A_rest_parameter_cannot_have_an_initializer: diag(1048, ts.DiagnosticCategory.Error, "A_rest_parameter_cannot_have_an_initializer_1048", "A rest parameter cannot have an initializer."),
A_set_accessor_must_have_exactly_one_parameter: diag(1049, ts.DiagnosticCategory.Error, "A_set_accessor_must_have_exactly_one_parameter_1049", "A 'set' accessor must have exactly one parameter."),
@@ -3270,7 +3409,7 @@
Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided: diag(1205, ts.DiagnosticCategory.Error, "Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided_1205", "Cannot re-export a type when the '--isolatedModules' flag is provided."),
Decorators_are_not_valid_here: diag(1206, ts.DiagnosticCategory.Error, "Decorators_are_not_valid_here_1206", "Decorators are not valid here."),
Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: diag(1207, ts.DiagnosticCategory.Error, "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207", "Decorators cannot be applied to multiple get/set accessors of the same name."),
- Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided: diag(1208, ts.DiagnosticCategory.Error, "Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided_1208", "Cannot compile namespaces when the '--isolatedModules' flag is provided."),
+ All_files_must_be_modules_when_the_isolatedModules_flag_is_provided: diag(1208, ts.DiagnosticCategory.Error, "All_files_must_be_modules_when_the_isolatedModules_flag_is_provided_1208", "All files must be modules when the '--isolatedModules' flag is provided."),
Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: diag(1210, ts.DiagnosticCategory.Error, "Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode_1210", "Invalid use of '{0}'. Class definitions are automatically in strict mode."),
A_class_declaration_without_the_default_modifier_must_have_a_name: diag(1211, ts.DiagnosticCategory.Error, "A_class_declaration_without_the_default_modifier_must_have_a_name_1211", "A class declaration without the 'default' modifier must have a name."),
Identifier_expected_0_is_a_reserved_word_in_strict_mode: diag(1212, ts.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_in_strict_mode_1212", "Identifier expected. '{0}' is a reserved word in strict mode."),
@@ -3279,7 +3418,7 @@
Invalid_use_of_0_Modules_are_automatically_in_strict_mode: diag(1215, ts.DiagnosticCategory.Error, "Invalid_use_of_0_Modules_are_automatically_in_strict_mode_1215", "Invalid use of '{0}'. Modules are automatically in strict mode."),
Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules: diag(1216, ts.DiagnosticCategory.Error, "Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules_1216", "Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules."),
Export_assignment_is_not_supported_when_module_flag_is_system: diag(1218, ts.DiagnosticCategory.Error, "Export_assignment_is_not_supported_when_module_flag_is_system_1218", "Export assignment is not supported when '--module' flag is 'system'."),
- Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning: diag(1219, ts.DiagnosticCategory.Error, "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219", "Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning."),
+ Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning: diag(1219, ts.DiagnosticCategory.Error, "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219", "Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning."),
Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher: diag(1220, ts.DiagnosticCategory.Error, "Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher_1220", "Generators are only available when targeting ECMAScript 2015 or higher."),
Generators_are_not_allowed_in_an_ambient_context: diag(1221, ts.DiagnosticCategory.Error, "Generators_are_not_allowed_in_an_ambient_context_1221", "Generators are not allowed in an ambient context."),
An_overload_signature_cannot_be_declared_as_a_generator: diag(1222, ts.DiagnosticCategory.Error, "An_overload_signature_cannot_be_declared_as_a_generator_1222", "An overload signature cannot be declared as a generator."),
@@ -3318,6 +3457,8 @@
A_definite_assignment_assertion_is_not_permitted_in_this_context: diag(1255, ts.DiagnosticCategory.Error, "A_definite_assignment_assertion_is_not_permitted_in_this_context_1255", "A definite assignment assertion '!' is not permitted in this context."),
A_rest_element_must_be_last_in_a_tuple_type: diag(1256, ts.DiagnosticCategory.Error, "A_rest_element_must_be_last_in_a_tuple_type_1256", "A rest element must be last in a tuple type."),
A_required_element_cannot_follow_an_optional_element: diag(1257, ts.DiagnosticCategory.Error, "A_required_element_cannot_follow_an_optional_element_1257", "A required element cannot follow an optional element."),
+ Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation: diag(1258, ts.DiagnosticCategory.Error, "Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation_1258", "Definite assignment assertions can only be used along with a type annotation."),
+ Module_0_can_only_be_default_imported_using_the_1_flag: diag(1259, ts.DiagnosticCategory.Error, "Module_0_can_only_be_default_imported_using_the_1_flag_1259", "Module '{0}' can only be default-imported using the '{1}' flag"),
with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
await_expression_is_only_allowed_within_an_async_function: diag(1308, ts.DiagnosticCategory.Error, "await_expression_is_only_allowed_within_an_async_function_1308", "'await' expression is only allowed within an async function."),
can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment: diag(1312, ts.DiagnosticCategory.Error, "can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment_1312", "'=' can only be used in an object literal property inside a destructuring assignment."),
@@ -3362,7 +3503,8 @@
A_bigint_literal_cannot_use_exponential_notation: diag(1352, ts.DiagnosticCategory.Error, "A_bigint_literal_cannot_use_exponential_notation_1352", "A bigint literal cannot use exponential notation."),
A_bigint_literal_must_be_an_integer: diag(1353, ts.DiagnosticCategory.Error, "A_bigint_literal_must_be_an_integer_1353", "A bigint literal must be an integer."),
readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types: diag(1354, ts.DiagnosticCategory.Error, "readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types_1354", "'readonly' type modifier is only permitted on array and tuple literal types."),
- A_const_assertion_can_only_be_applied_to_a_string_number_boolean_array_or_object_literal: diag(1355, ts.DiagnosticCategory.Error, "A_const_assertion_can_only_be_applied_to_a_string_number_boolean_array_or_object_literal_1355", "A 'const' assertion can only be applied to a string, number, boolean, array, or object literal."),
+ A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals: diag(1355, ts.DiagnosticCategory.Error, "A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array__1355", "A 'const' assertions can only be applied to references to enum members, or string, number, boolean, array, or object literals."),
+ Did_you_mean_to_mark_this_function_as_async: diag(1356, ts.DiagnosticCategory.Error, "Did_you_mean_to_mark_this_function_as_async_1356", "Did you mean to mark this function as 'async'?"),
Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2301, ts.DiagnosticCategory.Error, "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
Static_members_cannot_reference_class_type_parameters: diag(2302, ts.DiagnosticCategory.Error, "Static_members_cannot_reference_class_type_parameters_2302", "Static members cannot reference class type parameters."),
@@ -3644,6 +3786,7 @@
Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig: diag(2591, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_types_Slashnode_and_th_2591", "Cannot find name '{0}'. Do you need to install type definitions for node? Try `npm i @types/node` and then add `node` to the types field in your tsconfig."),
Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_types_Slashjquery_and_then_add_jquery_to_the_types_field_in_your_tsconfig: diag(2592, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_types_Slashjquery_an_2592", "Cannot find name '{0}'. Do you need to install type definitions for jQuery? Try `npm i @types/jquery` and then add `jquery` to the types field in your tsconfig."),
Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_types_Slashjest_or_npm_i_types_Slashmocha_and_then_add_jest_or_mocha_to_the_types_field_in_your_tsconfig: diag(2593, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_types_Slashje_2593", "Cannot find name '{0}'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig."),
+ This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag: diag(2594, ts.DiagnosticCategory.Error, "This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594", "This module is declared with using 'export =', and can only be used with a default import when using the '{0}' flag."),
JSX_element_attributes_type_0_may_not_be_a_union_type: diag(2600, ts.DiagnosticCategory.Error, "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", "JSX element attributes type '{0}' may not be a union type."),
The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: diag(2601, ts.DiagnosticCategory.Error, "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", "The return type of a JSX element constructor must return an object type."),
JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: diag(2602, ts.DiagnosticCategory.Error, "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist."),
@@ -3756,6 +3899,7 @@
Circularity_originates_in_type_at_this_location: diag(2751, ts.DiagnosticCategory.Error, "Circularity_originates_in_type_at_this_location_2751", "Circularity originates in type at this location."),
The_first_export_default_is_here: diag(2752, ts.DiagnosticCategory.Error, "The_first_export_default_is_here_2752", "The first export default is here."),
Another_export_default_is_here: diag(2753, ts.DiagnosticCategory.Error, "Another_export_default_is_here_2753", "Another export default is here."),
+ super_may_not_use_type_arguments: diag(2754, ts.DiagnosticCategory.Error, "super_may_not_use_type_arguments_2754", "'super' may not use type arguments."),
Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -3840,6 +3984,7 @@
Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4101, ts.DiagnosticCategory.Error, "Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2_4101", "Method '{0}' of exported interface has or is using name '{1}' from private module '{2}'."),
Method_0_of_exported_interface_has_or_is_using_private_name_1: diag(4102, ts.DiagnosticCategory.Error, "Method_0_of_exported_interface_has_or_is_using_private_name_1_4102", "Method '{0}' of exported interface has or is using private name '{1}'."),
Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1: diag(4103, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1_4103", "Type parameter '{0}' of exported mapped object type is using private name '{1}'."),
+ The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1: diag(4104, ts.DiagnosticCategory.Error, "The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1_4104", "The type '{0}' is 'readonly' and cannot be assigned to the mutable type '{1}'."),
The_current_host_does_not_support_the_0_option: diag(5001, ts.DiagnosticCategory.Error, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, ts.DiagnosticCategory.Error, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, ts.DiagnosticCategory.Error, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
@@ -3873,6 +4018,8 @@
Option_resolveJsonModule_can_only_be_specified_when_module_code_generation_is_commonjs_amd_es2015_or_esNext: diag(5071, ts.DiagnosticCategory.Error, "Option_resolveJsonModule_can_only_be_specified_when_module_code_generation_is_commonjs_amd_es2015_or_5071", "Option '--resolveJsonModule' can only be specified when module code generation is 'commonjs', 'amd', 'es2015' or 'esNext'."),
Unknown_build_option_0: diag(5072, ts.DiagnosticCategory.Error, "Unknown_build_option_0_5072", "Unknown build option '{0}'."),
Build_option_0_requires_a_value_of_type_1: diag(5073, ts.DiagnosticCategory.Error, "Build_option_0_requires_a_value_of_type_1_5073", "Build option '{0}' requires a value of type {1}."),
+ Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified: diag(5074, ts.DiagnosticCategory.Error, "Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBui_5074", "Option '--incremental' can only be specified using tsconfig, emitting to single file or when option `--tsBuildInfoFile` is specified."),
+ _0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_constraint_2: diag(5075, ts.DiagnosticCategory.Error, "_0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_5075", "'{0}' is assignable to the constraint of type '{1}', but '{1}' could be instantiated with a different subtype of constraint '{2}'."),
Generates_a_sourcemap_for_each_corresponding_d_ts_file: diag(6000, ts.DiagnosticCategory.Message, "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000", "Generates a sourcemap for each corresponding '.d.ts' file."),
Concatenate_and_emit_output_to_single_file: diag(6001, ts.DiagnosticCategory.Message, "Concatenate_and_emit_output_to_single_file_6001", "Concatenate and emit output to single file."),
Generates_corresponding_d_ts_file: diag(6002, ts.DiagnosticCategory.Message, "Generates_corresponding_d_ts_file_6002", "Generates corresponding '.d.ts' file."),
@@ -4049,7 +4196,6 @@
Enable_strict_checking_of_property_initialization_in_classes: diag(6187, ts.DiagnosticCategory.Message, "Enable_strict_checking_of_property_initialization_in_classes_6187", "Enable strict checking of property initialization in classes."),
Numeric_separators_are_not_allowed_here: diag(6188, ts.DiagnosticCategory.Error, "Numeric_separators_are_not_allowed_here_6188", "Numeric separators are not allowed here."),
Multiple_consecutive_numeric_separators_are_not_permitted: diag(6189, ts.DiagnosticCategory.Error, "Multiple_consecutive_numeric_separators_are_not_permitted_6189", "Multiple consecutive numeric separators are not permitted."),
- Found_package_json_at_0_Package_ID_is_1: diag(6190, ts.DiagnosticCategory.Message, "Found_package_json_at_0_Package_ID_is_1_6190", "Found 'package.json' at '{0}'. Package ID is '{1}'."),
Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen: diag(6191, ts.DiagnosticCategory.Message, "Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen_6191", "Whether to keep outdated console output in watch mode instead of clearing the screen."),
All_imports_in_import_declaration_are_unused: diag(6192, ts.DiagnosticCategory.Error, "All_imports_in_import_declaration_are_unused_6192", "All imports in import declaration are unused.", true),
Found_1_error_Watching_for_file_changes: diag(6193, ts.DiagnosticCategory.Message, "Found_1_error_Watching_for_file_changes_6193", "Found 1 error. Watching for file changes."),
@@ -4076,6 +4222,9 @@
Using_compiler_options_of_project_reference_redirect_0: diag(6215, ts.DiagnosticCategory.Message, "Using_compiler_options_of_project_reference_redirect_0_6215", "Using compiler options of project reference redirect '{0}'."),
Found_1_error: diag(6216, ts.DiagnosticCategory.Message, "Found_1_error_6216", "Found 1 error."),
Found_0_errors: diag(6217, ts.DiagnosticCategory.Message, "Found_0_errors_6217", "Found {0} errors."),
+ Module_name_0_was_successfully_resolved_to_1_with_Package_ID_2: diag(6218, ts.DiagnosticCategory.Message, "Module_name_0_was_successfully_resolved_to_1_with_Package_ID_2_6218", "======== Module name '{0}' was successfully resolved to '{1}' with Package ID '{2}'. ========"),
+ Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3: diag(6219, ts.DiagnosticCategory.Message, "Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3_6219", "======== Type reference directive '{0}' was successfully resolved to '{1}' with Package ID '{2}', primary: {3}. ========"),
+ package_json_had_a_falsy_0_field: diag(6220, ts.DiagnosticCategory.Message, "package_json_had_a_falsy_0_field_6220", "'package.json' had a falsy '{0}' field."),
Projects_to_reference: diag(6300, ts.DiagnosticCategory.Message, "Projects_to_reference_6300", "Projects to reference"),
Enable_project_compilation: diag(6302, ts.DiagnosticCategory.Message, "Enable_project_compilation_6302", "Enable project compilation"),
Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0: diag(6202, ts.DiagnosticCategory.Error, "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202", "Project references may not form a circular graph. Cycle detected: {0}"),
@@ -4164,6 +4313,9 @@
Property_0_implicitly_has_type_any_but_a_better_type_for_its_set_accessor_may_be_inferred_from_usage: diag(7049, ts.DiagnosticCategory.Suggestion, "Property_0_implicitly_has_type_any_but_a_better_type_for_its_set_accessor_may_be_inferred_from_usage_7049", "Property '{0}' implicitly has type 'any', but a better type for its set accessor may be inferred from usage."),
_0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage: diag(7050, ts.DiagnosticCategory.Suggestion, "_0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage_7050", "'{0}' implicitly has an '{1}' return type, but a better type may be inferred from usage."),
Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1: diag(7051, ts.DiagnosticCategory.Error, "Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1_7051", "Parameter has a name but no type. Did you mean '{0}: {1}'?"),
+ Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1: diag(7052, ts.DiagnosticCategory.Error, "Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1_7052", "Element implicitly has an 'any' type because type '{0}' has no index signature. Did you mean to call '{1}' ?"),
+ Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1: diag(7053, ts.DiagnosticCategory.Error, "Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1_7053", "Element implicitly has an 'any' type because expression of type '{0}' can't be used to index type '{1}'."),
+ No_index_signature_with_a_parameter_of_type_0_was_found_on_type_1: diag(7054, ts.DiagnosticCategory.Error, "No_index_signature_with_a_parameter_of_type_0_was_found_on_type_1_7054", "No index signature with a parameter of type '{0}' was found on type '{1}'."),
You_cannot_rename_this_element: diag(8000, ts.DiagnosticCategory.Error, "You_cannot_rename_this_element_8000", "You cannot rename this element."),
You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: diag(8001, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001", "You cannot rename elements that are defined in the standard TypeScript library."),
import_can_only_be_used_in_a_ts_file: diag(8002, ts.DiagnosticCategory.Error, "import_can_only_be_used_in_a_ts_file_8002", "'import ... =' can only be used in a .ts file."),
@@ -4325,8 +4477,6 @@
Add_all_missing_imports: diag(95064, ts.DiagnosticCategory.Message, "Add_all_missing_imports_95064", "Add all missing imports"),
Convert_to_async_function: diag(95065, ts.DiagnosticCategory.Message, "Convert_to_async_function_95065", "Convert to async function"),
Convert_all_to_async_functions: diag(95066, ts.DiagnosticCategory.Message, "Convert_all_to_async_functions_95066", "Convert all to async functions"),
- Generate_types_for_0: diag(95067, ts.DiagnosticCategory.Message, "Generate_types_for_0_95067", "Generate types for '{0}'"),
- Generate_types_for_all_packages_without_types: diag(95068, ts.DiagnosticCategory.Message, "Generate_types_for_all_packages_without_types_95068", "Generate types for all packages without types"),
Add_unknown_conversion_for_non_overlapping_types: diag(95069, ts.DiagnosticCategory.Message, "Add_unknown_conversion_for_non_overlapping_types_95069", "Add 'unknown' conversion for non-overlapping types"),
Add_unknown_to_all_conversions_of_non_overlapping_types: diag(95070, ts.DiagnosticCategory.Message, "Add_unknown_to_all_conversions_of_non_overlapping_types_95070", "Add 'unknown' to all conversions of non-overlapping types"),
Add_missing_new_operator_to_call: diag(95071, ts.DiagnosticCategory.Message, "Add_missing_new_operator_to_call_95071", "Add missing 'new' operator to call"),
@@ -4334,13 +4484,20 @@
Add_names_to_all_parameters_without_names: diag(95073, ts.DiagnosticCategory.Message, "Add_names_to_all_parameters_without_names_95073", "Add names to all parameters without names"),
Enable_the_experimentalDecorators_option_in_your_configuration_file: diag(95074, ts.DiagnosticCategory.Message, "Enable_the_experimentalDecorators_option_in_your_configuration_file_95074", "Enable the 'experimentalDecorators' option in your configuration file"),
Convert_parameters_to_destructured_object: diag(95075, ts.DiagnosticCategory.Message, "Convert_parameters_to_destructured_object_95075", "Convert parameters to destructured object"),
+ Allow_accessing_UMD_globals_from_modules: diag(95076, ts.DiagnosticCategory.Message, "Allow_accessing_UMD_globals_from_modules_95076", "Allow accessing UMD globals from modules."),
+ Extract_type: diag(95077, ts.DiagnosticCategory.Message, "Extract_type_95077", "Extract type"),
+ Extract_to_type_alias: diag(95078, ts.DiagnosticCategory.Message, "Extract_to_type_alias_95078", "Extract to type alias"),
+ Extract_to_typedef: diag(95079, ts.DiagnosticCategory.Message, "Extract_to_typedef_95079", "Extract to typedef"),
+ No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, ts.DiagnosticCategory.Error, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
+ Quoted_constructors_have_previously_been_interpreted_as_methods_which_is_incorrect_In_TypeScript_3_6_they_will_be_correctly_parsed_as_constructors_In_the_meantime_consider_using_constructor_to_write_a_constructor_or_constructor_to_write_a_method: diag(18005, ts.DiagnosticCategory.Error, "Quoted_constructors_have_previously_been_interpreted_as_methods_which_is_incorrect_In_TypeScript_3_6_18005", "Quoted constructors have previously been interpreted as methods, which is incorrect. In TypeScript 3.6, they will be correctly parsed as constructors. In the meantime, consider using 'constructor()' to write a constructor, or '[\"constructor\"]()' to write a method."),
+ Classes_may_not_have_a_field_named_constructor: diag(18006, ts.DiagnosticCategory.Error, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
};
})(ts || (ts = {}));
var ts;
(function (ts) {
var _a;
function tokenIsIdentifierOrKeyword(token) {
- return token >= 72;
+ return token >= 73;
}
ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword;
function tokenIsIdentifierOrKeywordOrGreaterThan(token) {
@@ -4348,85 +4505,85 @@
}
ts.tokenIsIdentifierOrKeywordOrGreaterThan = tokenIsIdentifierOrKeywordOrGreaterThan;
var textToKeywordObj = (_a = {
- abstract: 118,
- any: 120,
- as: 119,
- bigint: 146,
- boolean: 123,
- break: 73,
- case: 74,
- catch: 75,
- class: 76,
- continue: 78,
- const: 77
- },
- _a["" + "constructor"] = 124,
- _a.debugger = 79,
- _a.declare = 125,
- _a.default = 80,
- _a.delete = 81,
- _a.do = 82,
- _a.else = 83,
- _a.enum = 84,
- _a.export = 85,
- _a.extends = 86,
- _a.false = 87,
- _a.finally = 88,
- _a.for = 89,
- _a.from = 144,
- _a.function = 90,
- _a.get = 126,
- _a.if = 91,
- _a.implements = 109,
- _a.import = 92,
- _a.in = 93,
- _a.infer = 127,
- _a.instanceof = 94,
- _a.interface = 110,
- _a.is = 128,
- _a.keyof = 129,
- _a.let = 111,
- _a.module = 130,
- _a.namespace = 131,
- _a.never = 132,
- _a.new = 95,
- _a.null = 96,
- _a.number = 135,
- _a.object = 136,
- _a.package = 112,
- _a.private = 113,
- _a.protected = 114,
- _a.public = 115,
- _a.readonly = 133,
- _a.require = 134,
- _a.global = 145,
- _a.return = 97,
- _a.set = 137,
- _a.static = 116,
- _a.string = 138,
- _a.super = 98,
- _a.switch = 99,
- _a.symbol = 139,
- _a.this = 100,
- _a.throw = 101,
- _a.true = 102,
- _a.try = 103,
- _a.type = 140,
- _a.typeof = 104,
- _a.undefined = 141,
- _a.unique = 142,
- _a.unknown = 143,
- _a.var = 105,
- _a.void = 106,
- _a.while = 107,
- _a.with = 108,
- _a.yield = 117,
- _a.async = 121,
- _a.await = 122,
- _a.of = 147,
+ abstract: 119,
+ any: 121,
+ as: 120,
+ bigint: 147,
+ boolean: 124,
+ break: 74,
+ case: 75,
+ catch: 76,
+ class: 77,
+ continue: 79,
+ const: 78
+ },
+ _a["" + "constructor"] = 125,
+ _a.debugger = 80,
+ _a.declare = 126,
+ _a.default = 81,
+ _a.delete = 82,
+ _a.do = 83,
+ _a.else = 84,
+ _a.enum = 85,
+ _a.export = 86,
+ _a.extends = 87,
+ _a.false = 88,
+ _a.finally = 89,
+ _a.for = 90,
+ _a.from = 145,
+ _a.function = 91,
+ _a.get = 127,
+ _a.if = 92,
+ _a.implements = 110,
+ _a.import = 93,
+ _a.in = 94,
+ _a.infer = 128,
+ _a.instanceof = 95,
+ _a.interface = 111,
+ _a.is = 129,
+ _a.keyof = 130,
+ _a.let = 112,
+ _a.module = 131,
+ _a.namespace = 132,
+ _a.never = 133,
+ _a.new = 96,
+ _a.null = 97,
+ _a.number = 136,
+ _a.object = 137,
+ _a.package = 113,
+ _a.private = 114,
+ _a.protected = 115,
+ _a.public = 116,
+ _a.readonly = 134,
+ _a.require = 135,
+ _a.global = 146,
+ _a.return = 98,
+ _a.set = 138,
+ _a.static = 117,
+ _a.string = 139,
+ _a.super = 99,
+ _a.switch = 100,
+ _a.symbol = 140,
+ _a.this = 101,
+ _a.throw = 102,
+ _a.true = 103,
+ _a.try = 104,
+ _a.type = 141,
+ _a.typeof = 105,
+ _a.undefined = 142,
+ _a.unique = 143,
+ _a.unknown = 144,
+ _a.var = 106,
+ _a.void = 107,
+ _a.while = 108,
+ _a.with = 109,
+ _a.yield = 118,
+ _a.async = 122,
+ _a.await = 123,
+ _a.of = 148,
_a);
var textToKeyword = ts.createMapFromTemplate(textToKeywordObj);
- var textToToken = ts.createMapFromTemplate(__assign({}, textToKeywordObj, { "{": 18, "}": 19, "(": 20, ")": 21, "[": 22, "]": 23, ".": 24, "...": 25, ";": 26, ",": 27, "<": 28, ">": 30, "<=": 31, ">=": 32, "==": 33, "!=": 34, "===": 35, "!==": 36, "=>": 37, "+": 38, "-": 39, "**": 41, "*": 40, "/": 42, "%": 43, "++": 44, "--": 45, "<<": 46, "</": 29, ">>": 47, ">>>": 48, "&": 49, "|": 50, "^": 51, "!": 52, "~": 53, "&&": 54, "||": 55, "?": 56, ":": 57, "=": 59, "+=": 60, "-=": 61, "*=": 62, "**=": 63, "/=": 64, "%=": 65, "<<=": 66, ">>=": 67, ">>>=": 68, "&=": 69, "|=": 70, "^=": 71, "@": 58 }));
+ var textToToken = ts.createMapFromTemplate(__assign({}, textToKeywordObj, { "{": 18, "}": 19, "(": 20, ")": 21, "[": 22, "]": 23, ".": 24, "...": 25, ";": 26, ",": 27, "<": 28, ">": 30, "<=": 31, ">=": 32, "==": 33, "!=": 34, "===": 35, "!==": 36, "=>": 37, "+": 38, "-": 39, "**": 41, "*": 40, "/": 42, "%": 43, "++": 44, "--": 45, "<<": 46, "</": 29, ">>": 47, ">>>": 48, "&": 49, "|": 50, "^": 51, "!": 52, "~": 53, "&&": 54, "||": 55, "?": 56, ":": 57, "=": 60, "+=": 61, "-=": 62, "*=": 63, "**=": 64, "/=": 65, "%=": 66, "<<=": 67, ">>=": 68, ">>>=": 69, "&=": 70, "|=": 71, "^=": 72, "@": 58 }));
var unicodeES3IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1610, 1649, 1747, 1749, 1749, 1765, 1766, 1786, 1788, 1808, 1808, 1810, 1836, 1920, 1957, 2309, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2784, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3294, 3294, 3296, 3297, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3424, 3425, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3805, 3840, 3840, 3904, 3911, 3913, 3946, 3976, 3979, 4096, 4129, 4131, 4135, 4137, 4138, 4176, 4181, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6067, 6176, 6263, 6272, 6312, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8319, 8319, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12346, 12353, 12436, 12445, 12446, 12449, 12538, 12540, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65138, 65140, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,];
var unicodeES3IdentifierPart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592, 685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 768, 846, 864, 866, 890, 890, 902, 902, 904, 906, 908, 908, 910, 929, 931, 974, 976, 983, 986, 1011, 1024, 1153, 1155, 1158, 1164, 1220, 1223, 1224, 1227, 1228, 1232, 1269, 1272, 1273, 1329, 1366, 1369, 1369, 1377, 1415, 1425, 1441, 1443, 1465, 1467, 1469, 1471, 1471, 1473, 1474, 1476, 1476, 1488, 1514, 1520, 1522, 1569, 1594, 1600, 1621, 1632, 1641, 1648, 1747, 1749, 1756, 1759, 1768, 1770, 1773, 1776, 1788, 1808, 1836, 1840, 1866, 1920, 1968, 2305, 2307, 2309, 2361, 2364, 2381, 2384, 2388, 2392, 2403, 2406, 2415, 2433, 2435, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2492, 2492, 2494, 2500, 2503, 2504, 2507, 2509, 2519, 2519, 2524, 2525, 2527, 2531, 2534, 2545, 2562, 2562, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2620, 2620, 2622, 2626, 2631, 2632, 2635, 2637, 2649, 2652, 2654, 2654, 2662, 2676, 2689, 2691, 2693, 2699, 2701, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2748, 2757, 2759, 2761, 2763, 2765, 2768, 2768, 2784, 2784, 2790, 2799, 2817, 2819, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2870, 2873, 2876, 2883, 2887, 2888, 2891, 2893, 2902, 2903, 2908, 2909, 2911, 2913, 2918, 2927, 2946, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 2997, 2999, 3001, 3006, 3010, 3014, 3016, 3018, 3021, 3031, 3031, 3047, 3055, 3073, 3075, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3134, 3140, 3142, 3144, 3146, 3149, 3157, 3158, 3168, 3169, 3174, 3183, 3202, 3203, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3262, 3268, 3270, 3272, 3274, 3277, 3285, 3286, 3294, 3294, 3296, 3297, 3302, 3311, 3330, 3331, 3333, 3340, 3342, 3344, 3346, 3368, 3370, 3385, 3390, 3395, 3398, 3400, 3402, 3405, 3415, 3415, 3424, 3425, 3430, 3439, 3458, 3459, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3530, 3530, 3535, 3540, 3542, 3542, 3544, 3551, 3570, 3571, 3585, 3642, 3648, 3662, 3664, 3673, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3769, 3771, 3773, 3776, 3780, 3782, 3782, 3784, 3789, 3792, 3801, 3804, 3805, 3840, 3840, 3864, 3865, 3872, 3881, 3893, 3893, 3895, 3895, 3897, 3897, 3902, 3911, 3913, 3946, 3953, 3972, 3974, 3979, 3984, 3991, 3993, 4028, 4038, 4038, 4096, 4129, 4131, 4135, 4137, 4138, 4140, 4146, 4150, 4153, 4160, 4169, 4176, 4185, 4256, 4293, 4304, 4342, 4352, 4441, 4447, 4514, 4520, 4601, 4608, 4614, 4616, 4678, 4680, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4742, 4744, 4744, 4746, 4749, 4752, 4782, 4784, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4814, 4816, 4822, 4824, 4846, 4848, 4878, 4880, 4880, 4882, 4885, 4888, 4894, 4896, 4934, 4936, 4954, 4969, 4977, 5024, 5108, 5121, 5740, 5743, 5750, 5761, 5786, 5792, 5866, 6016, 6099, 6112, 6121, 6160, 6169, 6176, 6263, 6272, 6313, 7680, 7835, 7840, 7929, 7936, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8255, 8256, 8319, 8319, 8400, 8412, 8417, 8417, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8497, 8499, 8505, 8544, 8579, 12293, 12295, 12321, 12335, 12337, 12341, 12344, 12346, 12353, 12436, 12441, 12442, 12445, 12446, 12449, 12542, 12549, 12588, 12593, 12686, 12704, 12727, 13312, 19893, 19968, 40869, 40960, 42124, 44032, 55203, 63744, 64045, 64256, 64262, 64275, 64279, 64285, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65056, 65059, 65075, 65076, 65101, 65103, 65136, 65138, 65140, 65140, 65142, 65276, 65296, 65305, 65313, 65338, 65343, 65343, 65345, 65370, 65381, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,];
var unicodeES5IdentifierStart = [170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 705, 710, 721, 736, 740, 748, 748, 750, 750, 880, 884, 886, 887, 890, 893, 902, 902, 904, 906, 908, 908, 910, 929, 931, 1013, 1015, 1153, 1162, 1319, 1329, 1366, 1369, 1369, 1377, 1415, 1488, 1514, 1520, 1522, 1568, 1610, 1646, 1647, 1649, 1747, 1749, 1749, 1765, 1766, 1774, 1775, 1786, 1788, 1791, 1791, 1808, 1808, 1810, 1839, 1869, 1957, 1969, 1969, 1994, 2026, 2036, 2037, 2042, 2042, 2048, 2069, 2074, 2074, 2084, 2084, 2088, 2088, 2112, 2136, 2208, 2208, 2210, 2220, 2308, 2361, 2365, 2365, 2384, 2384, 2392, 2401, 2417, 2423, 2425, 2431, 2437, 2444, 2447, 2448, 2451, 2472, 2474, 2480, 2482, 2482, 2486, 2489, 2493, 2493, 2510, 2510, 2524, 2525, 2527, 2529, 2544, 2545, 2565, 2570, 2575, 2576, 2579, 2600, 2602, 2608, 2610, 2611, 2613, 2614, 2616, 2617, 2649, 2652, 2654, 2654, 2674, 2676, 2693, 2701, 2703, 2705, 2707, 2728, 2730, 2736, 2738, 2739, 2741, 2745, 2749, 2749, 2768, 2768, 2784, 2785, 2821, 2828, 2831, 2832, 2835, 2856, 2858, 2864, 2866, 2867, 2869, 2873, 2877, 2877, 2908, 2909, 2911, 2913, 2929, 2929, 2947, 2947, 2949, 2954, 2958, 2960, 2962, 2965, 2969, 2970, 2972, 2972, 2974, 2975, 2979, 2980, 2984, 2986, 2990, 3001, 3024, 3024, 3077, 3084, 3086, 3088, 3090, 3112, 3114, 3123, 3125, 3129, 3133, 3133, 3160, 3161, 3168, 3169, 3205, 3212, 3214, 3216, 3218, 3240, 3242, 3251, 3253, 3257, 3261, 3261, 3294, 3294, 3296, 3297, 3313, 3314, 3333, 3340, 3342, 3344, 3346, 3386, 3389, 3389, 3406, 3406, 3424, 3425, 3450, 3455, 3461, 3478, 3482, 3505, 3507, 3515, 3517, 3517, 3520, 3526, 3585, 3632, 3634, 3635, 3648, 3654, 3713, 3714, 3716, 3716, 3719, 3720, 3722, 3722, 3725, 3725, 3732, 3735, 3737, 3743, 3745, 3747, 3749, 3749, 3751, 3751, 3754, 3755, 3757, 3760, 3762, 3763, 3773, 3773, 3776, 3780, 3782, 3782, 3804, 3807, 3840, 3840, 3904, 3911, 3913, 3948, 3976, 3980, 4096, 4138, 4159, 4159, 4176, 4181, 4186, 4189, 4193, 4193, 4197, 4198, 4206, 4208, 4213, 4225, 4238, 4238, 4256, 4293, 4295, 4295, 4301, 4301, 4304, 4346, 4348, 4680, 4682, 4685, 4688, 4694, 4696, 4696, 4698, 4701, 4704, 4744, 4746, 4749, 4752, 4784, 4786, 4789, 4792, 4798, 4800, 4800, 4802, 4805, 4808, 4822, 4824, 4880, 4882, 4885, 4888, 4954, 4992, 5007, 5024, 5108, 5121, 5740, 5743, 5759, 5761, 5786, 5792, 5866, 5870, 5872, 5888, 5900, 5902, 5905, 5920, 5937, 5952, 5969, 5984, 5996, 5998, 6000, 6016, 6067, 6103, 6103, 6108, 6108, 6176, 6263, 6272, 6312, 6314, 6314, 6320, 6389, 6400, 6428, 6480, 6509, 6512, 6516, 6528, 6571, 6593, 6599, 6656, 6678, 6688, 6740, 6823, 6823, 6917, 6963, 6981, 6987, 7043, 7072, 7086, 7087, 7098, 7141, 7168, 7203, 7245, 7247, 7258, 7293, 7401, 7404, 7406, 7409, 7413, 7414, 7424, 7615, 7680, 7957, 7960, 7965, 7968, 8005, 8008, 8013, 8016, 8023, 8025, 8025, 8027, 8027, 8029, 8029, 8031, 8061, 8064, 8116, 8118, 8124, 8126, 8126, 8130, 8132, 8134, 8140, 8144, 8147, 8150, 8155, 8160, 8172, 8178, 8180, 8182, 8188, 8305, 8305, 8319, 8319, 8336, 8348, 8450, 8450, 8455, 8455, 8458, 8467, 8469, 8469, 8473, 8477, 8484, 8484, 8486, 8486, 8488, 8488, 8490, 8493, 8495, 8505, 8508, 8511, 8517, 8521, 8526, 8526, 8544, 8584, 11264, 11310, 11312, 11358, 11360, 11492, 11499, 11502, 11506, 11507, 11520, 11557, 11559, 11559, 11565, 11565, 11568, 11623, 11631, 11631, 11648, 11670, 11680, 11686, 11688, 11694, 11696, 11702, 11704, 11710, 11712, 11718, 11720, 11726, 11728, 11734, 11736, 11742, 11823, 11823, 12293, 12295, 12321, 12329, 12337, 12341, 12344, 12348, 12353, 12438, 12445, 12447, 12449, 12538, 12540, 12543, 12549, 12589, 12593, 12686, 12704, 12730, 12784, 12799, 13312, 19893, 19968, 40908, 40960, 42124, 42192, 42237, 42240, 42508, 42512, 42527, 42538, 42539, 42560, 42606, 42623, 42647, 42656, 42735, 42775, 42783, 42786, 42888, 42891, 42894, 42896, 42899, 42912, 42922, 43000, 43009, 43011, 43013, 43015, 43018, 43020, 43042, 43072, 43123, 43138, 43187, 43250, 43255, 43259, 43259, 43274, 43301, 43312, 43334, 43360, 43388, 43396, 43442, 43471, 43471, 43520, 43560, 43584, 43586, 43588, 43595, 43616, 43638, 43642, 43642, 43648, 43695, 43697, 43697, 43701, 43702, 43705, 43709, 43712, 43712, 43714, 43714, 43739, 43741, 43744, 43754, 43762, 43764, 43777, 43782, 43785, 43790, 43793, 43798, 43808, 43814, 43816, 43822, 43968, 44002, 44032, 55203, 55216, 55238, 55243, 55291, 63744, 64109, 64112, 64217, 64256, 64262, 64275, 64279, 64285, 64285, 64287, 64296, 64298, 64310, 64312, 64316, 64318, 64318, 64320, 64321, 64323, 64324, 64326, 64433, 64467, 64829, 64848, 64911, 64914, 64967, 65008, 65019, 65136, 65140, 65142, 65276, 65313, 65338, 65345, 65370, 65382, 65470, 65474, 65479, 65482, 65487, 65490, 65495, 65498, 65500,];
@@ -4917,8 +5074,8 @@
getTokenValue: function () { return tokenValue; },
hasExtendedUnicodeEscape: function () { return (tokenFlags & 8) !== 0; },
hasPrecedingLineBreak: function () { return (tokenFlags & 1) !== 0; },
- isIdentifier: function () { return token === 72 || token > 108; },
- isReservedWord: function () { return token >= 73 && token <= 108; },
+ isIdentifier: function () { return token === 73 || token > 109; },
+ isReservedWord: function () { return token >= 74 && token <= 109; },
isUnterminated: function () { return (tokenFlags & 4) !== 0; },
getTokenFlags: function () { return tokenFlags; },
reScanGreaterToken: reScanGreaterToken,
@@ -4929,7 +5086,7 @@
reScanJsxToken: reScanJsxToken,
reScanLessThanToken: reScanLessThanToken,
scanJsxToken: scanJsxToken,
- scanJSDocToken: scanJSDocToken,
+ scanJsDocToken: scanJsDocToken,
scan: scan,
getText: getText,
setText: setText,
@@ -5339,7 +5496,7 @@
}
}
}
- return token = 72;
+ return token = 73;
}
function scanBinaryOrOctalDigits(base) {
var value = "";
@@ -5480,7 +5637,7 @@
return token = scanTemplateAndSetTokenValue();
case 37:
if (text.charCodeAt(pos + 1) === 61) {
- return pos += 2, token = 65;
+ return pos += 2, token = 66;
}
pos++;
return token = 43;
@@ -5489,7 +5646,7 @@
return pos += 2, token = 54;
}
if (text.charCodeAt(pos + 1) === 61) {
- return pos += 2, token = 69;
+ return pos += 2, token = 70;
}
pos++;
return token = 49;
@@ -5501,11 +5658,11 @@
return token = 21;
case 42:
if (text.charCodeAt(pos + 1) === 61) {
- return pos += 2, token = 62;
+ return pos += 2, token = 63;
}
if (text.charCodeAt(pos + 1) === 42) {
if (text.charCodeAt(pos + 2) === 61) {
- return pos += 3, token = 63;
+ return pos += 3, token = 64;
}
return pos += 2, token = 41;
}
@@ -5520,7 +5677,7 @@
return pos += 2, token = 44;
}
if (text.charCodeAt(pos + 1) === 61) {
- return pos += 2, token = 60;
+ return pos += 2, token = 61;
}
pos++;
return token = 38;
@@ -5532,7 +5689,7 @@
return pos += 2, token = 45;
}
if (text.charCodeAt(pos + 1) === 61) {
- return pos += 2, token = 61;
+ return pos += 2, token = 62;
}
pos++;
return token = 39;
@@ -5594,7 +5751,7 @@
}
}
if (text.charCodeAt(pos + 1) === 61) {
- return pos += 2, token = 64;
+ return pos += 2, token = 65;
}
pos++;
return token = 42;
@@ -5666,7 +5823,7 @@
}
if (text.charCodeAt(pos + 1) === 60) {
if (text.charCodeAt(pos + 2) === 61) {
- return pos += 3, token = 66;
+ return pos += 3, token = 67;
}
return pos += 2, token = 46;
}
@@ -5700,7 +5857,7 @@
return pos += 2, token = 37;
}
pos++;
- return token = 59;
+ return token = 60;
case 62:
if (isConflictMarkerTrivia(text, pos)) {
pos = scanConflictMarkerTrivia(text, pos, error);
@@ -5724,7 +5881,7 @@
return token = 23;
case 94:
if (text.charCodeAt(pos + 1) === 61) {
- return pos += 2, token = 71;
+ return pos += 2, token = 72;
}
pos++;
return token = 51;
@@ -5745,7 +5902,7 @@
return pos += 2, token = 55;
}
if (text.charCodeAt(pos + 1) === 61) {
- return pos += 2, token = 70;
+ return pos += 2, token = 71;
}
pos++;
return token = 50;
@@ -5799,12 +5956,12 @@
if (text.charCodeAt(pos) === 62) {
if (text.charCodeAt(pos + 1) === 62) {
if (text.charCodeAt(pos + 2) === 61) {
- return pos += 3, token = 68;
+ return pos += 3, token = 69;
}
return pos += 2, token = 48;
}
if (text.charCodeAt(pos + 1) === 61) {
- return pos += 2, token = 67;
+ return pos += 2, token = 68;
}
pos++;
return token = 47;
@@ -5817,7 +5974,7 @@
return token;
}
function reScanSlashToken() {
- if (token === 42 || token === 64) {
+ if (token === 42 || token === 65) {
var p = tokenPos + 1;
var inEscape = false;
var inCharacterClass = false;
@@ -5945,7 +6102,7 @@
return scan();
}
}
- function scanJSDocToken() {
+ function scanJsDocToken() {
startPos = tokenPos = pos;
tokenFlags = 0;
if (pos >= end) {
@@ -5981,21 +6138,16 @@
case 60:
return token = 28;
case 61:
- return token = 59;
+ return token = 60;
case 44:
return token = 27;
case 46:
return token = 24;
case 96:
- while (pos < end && text.charCodeAt(pos) !== 96) {
- pos++;
- }
- tokenValue = text.substring(tokenPos + 1, pos);
- pos++;
- return token = 14;
+ return token = 59;
}
- if (isIdentifierStart(ch, 7)) {
- while (isIdentifierPart(text.charCodeAt(pos), 7) && pos < end) {
+ if (isIdentifierStart(ch, 8)) {
+ while (isIdentifierPart(text.charCodeAt(pos), 8) && pos < end) {
pos++;
}
tokenValue = text.substring(tokenPos, pos);
@@ -6171,11 +6323,16 @@
}
ts.toPath = toPath;
function changesAffectModuleResolution(oldOptions, newOptions) {
- return oldOptions.configFilePath !== newOptions.configFilePath || ts.moduleResolutionOptionDeclarations.some(function (o) {
+ return oldOptions.configFilePath !== newOptions.configFilePath ||
+ optionsHaveModuleResolutionChanges(oldOptions, newOptions);
+ }
+ ts.changesAffectModuleResolution = changesAffectModuleResolution;
+ function optionsHaveModuleResolutionChanges(oldOptions, newOptions) {
+ return ts.moduleResolutionOptionDeclarations.some(function (o) {
return !ts.isJsonEqual(ts.getCompilerOptionValue(oldOptions, o), ts.getCompilerOptionValue(newOptions, o));
});
}
- ts.changesAffectModuleResolution = changesAffectModuleResolution;
+ ts.optionsHaveModuleResolutionChanges = optionsHaveModuleResolutionChanges;
function findAncestor(node, callback) {
while (node) {
var result = callback(node);
@@ -6336,7 +6493,7 @@
}
}
function getSourceFileOfNode(node) {
- while (node && node.kind !== 284) {
+ while (node && node.kind !== 285) {
node = node.parent;
}
return node;
@@ -6344,11 +6501,11 @@
ts.getSourceFileOfNode = getSourceFileOfNode;
function isStatementWithLocals(node) {
switch (node.kind) {
- case 218:
- case 246:
- case 225:
+ case 219:
+ case 247:
case 226:
case 227:
+ case 228:
return true;
}
return false;
@@ -6471,7 +6628,7 @@
if (includeJsDoc && ts.hasJSDocNodes(node)) {
return getTokenPosOfNode(node.jsDoc[0]);
}
- if (node.kind === 311 && node._children.length > 0) {
+ if (node.kind === 312 && node._children.length > 0) {
return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc);
}
return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos);
@@ -6490,7 +6647,7 @@
}
ts.getSourceTextOfNodeFromSourceFile = getSourceTextOfNodeFromSourceFile;
function isJSDocTypeExpressionOrChild(node) {
- return node.kind === 288 || (node.parent && isJSDocTypeExpressionOrChild(node.parent));
+ return node.kind === 289 || (node.parent && isJSDocTypeExpressionOrChild(node.parent));
}
function getTextOfNodeFromSourceText(sourceText, node, includeTrivia) {
if (includeTrivia === void 0) { includeTrivia = false; }
@@ -6566,7 +6723,7 @@
ts.isBlockOrCatchScoped = isBlockOrCatchScoped;
function isCatchClauseVariableDeclarationOrBindingElement(declaration) {
var node = getRootDeclaration(declaration);
- return node.kind === 237 && node.parent.kind === 274;
+ return node.kind === 238 && node.parent.kind === 275;
}
ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement;
function isAmbientModule(node) {
@@ -6590,11 +6747,11 @@
}
ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol;
function isShorthandAmbientModule(node) {
- return node && node.kind === 244 && (!node.body);
+ return node && node.kind === 245 && (!node.body);
}
function isBlockScopedContainerTopLevel(node) {
- return node.kind === 284 ||
- node.kind === 244 ||
+ return node.kind === 285 ||
+ node.kind === 245 ||
ts.isFunctionLike(node);
}
ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel;
@@ -6608,9 +6765,9 @@
ts.isExternalModuleAugmentation = isExternalModuleAugmentation;
function isModuleAugmentationExternal(node) {
switch (node.parent.kind) {
- case 284:
+ case 285:
return ts.isExternalModule(node.parent);
- case 245:
+ case 246:
return isAmbientModule(node.parent.parent) && ts.isSourceFile(node.parent.parent.parent) && !ts.isExternalModule(node.parent.parent.parent);
}
return false;
@@ -6626,22 +6783,22 @@
ts.isEffectiveExternalModule = isEffectiveExternalModule;
function isBlockScope(node, parentNode) {
switch (node.kind) {
- case 284:
- case 246:
- case 274:
- case 244:
- case 225:
+ case 285:
+ case 247:
+ case 275:
+ case 245:
case 226:
case 227:
- case 157:
- case 156:
+ case 228:
case 158:
+ case 157:
case 159:
- case 239:
- case 196:
+ case 160:
+ case 240:
case 197:
+ case 198:
return true;
- case 218:
+ case 219:
return !ts.isFunctionLike(parentNode);
}
return false;
@@ -6649,9 +6806,9 @@
ts.isBlockScope = isBlockScope;
function isDeclarationWithTypeParameters(node) {
switch (node.kind) {
- case 302:
- case 309:
- case 298:
+ case 303:
+ case 310:
+ case 299:
return true;
default:
ts.assertType(node);
@@ -6661,25 +6818,25 @@
ts.isDeclarationWithTypeParameters = isDeclarationWithTypeParameters;
function isDeclarationWithTypeParameterChildren(node) {
switch (node.kind) {
- case 160:
case 161:
- case 155:
case 162:
- case 165:
+ case 156:
+ case 163:
case 166:
- case 294:
- case 240:
- case 209:
+ case 167:
+ case 295:
case 241:
+ case 210:
case 242:
- case 308:
- case 239:
- case 156:
+ case 243:
+ case 309:
+ case 240:
case 157:
case 158:
case 159:
- case 196:
+ case 160:
case 197:
+ case 198:
return true;
default:
ts.assertType(node);
@@ -6689,8 +6846,8 @@
ts.isDeclarationWithTypeParameterChildren = isDeclarationWithTypeParameterChildren;
function isAnyImportSyntax(node) {
switch (node.kind) {
+ case 250:
case 249:
- case 248:
return true;
default:
return false;
@@ -6699,15 +6856,15 @@
ts.isAnyImportSyntax = isAnyImportSyntax;
function isLateVisibilityPaintedStatement(node) {
switch (node.kind) {
+ case 250:
case 249:
- case 248:
- case 219:
- case 240:
- case 239:
- case 244:
- case 242:
+ case 220:
case 241:
+ case 240:
+ case 245:
case 243:
+ case 242:
+ case 244:
return true;
default:
return false;
@@ -6732,13 +6889,13 @@
ts.getNameFromIndexInfo = getNameFromIndexInfo;
function getTextOfPropertyName(name) {
switch (name.kind) {
- case 72:
+ case 73:
return name.escapedText;
case 10:
case 8:
case 14:
return ts.escapeLeadingUnderscores(name.text);
- case 149:
+ case 150:
if (isStringOrNumericLiteralLike(name.expression))
return ts.escapeLeadingUnderscores(name.expression.text);
return ts.Debug.fail("Text of property name cannot be read from non-literal-valued ComputedPropertyNames");
@@ -6749,11 +6906,11 @@
ts.getTextOfPropertyName = getTextOfPropertyName;
function entityNameToString(name) {
switch (name.kind) {
- case 72:
+ case 73:
return getFullWidth(name) === 0 ? ts.idText(name) : getTextOfNode(name);
- case 148:
+ case 149:
return entityNameToString(name.left) + "." + entityNameToString(name.right);
- case 189:
+ case 190:
return entityNameToString(name.expression) + "." + entityNameToString(name.name);
default:
throw ts.Debug.assertNever(name);
@@ -6798,7 +6955,7 @@
ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition;
function getErrorSpanForArrowFunction(sourceFile, node) {
var pos = ts.skipTrivia(sourceFile.text, node.pos);
- if (node.body && node.body.kind === 218) {
+ if (node.body && node.body.kind === 219) {
var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line;
var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line;
if (startLine < endLine) {
@@ -6810,31 +6967,31 @@
function getErrorSpanForNode(sourceFile, node) {
var errorNode = node;
switch (node.kind) {
- case 284:
+ case 285:
var pos_1 = ts.skipTrivia(sourceFile.text, 0, false);
if (pos_1 === sourceFile.text.length) {
return ts.createTextSpan(0, 0);
}
return getSpanOfTokenAtPosition(sourceFile, pos_1);
- case 237:
- case 186:
- case 240:
- case 209:
+ case 238:
+ case 187:
case 241:
+ case 210:
+ case 242:
+ case 245:
case 244:
- case 243:
- case 278:
- case 239:
- case 196:
- case 156:
- case 158:
+ case 279:
+ case 240:
+ case 197:
+ case 157:
case 159:
- case 242:
+ case 160:
+ case 243:
+ case 155:
case 154:
- case 153:
errorNode = node.name;
break;
- case 197:
+ case 198:
return getErrorSpanForArrowFunction(sourceFile, node);
}
if (errorNode === undefined) {
@@ -6880,11 +7037,11 @@
}
ts.isLet = isLet;
function isSuperCall(n) {
- return n.kind === 191 && n.expression.kind === 98;
+ return n.kind === 192 && n.expression.kind === 99;
}
ts.isSuperCall = isSuperCall;
function isImportCall(n) {
- return n.kind === 191 && n.expression.kind === 92;
+ return n.kind === 192 && n.expression.kind === 93;
}
ts.isImportCall = isImportCall;
function isLiteralImportTypeNode(n) {
@@ -6892,7 +7049,7 @@
}
ts.isLiteralImportTypeNode = isLiteralImportTypeNode;
function isPrologueDirective(node) {
- return node.kind === 221
+ return node.kind === 222
&& node.expression.kind === 10;
}
ts.isPrologueDirective = isPrologueDirective;
@@ -6901,11 +7058,11 @@
}
ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode;
function getJSDocCommentRanges(node, text) {
- var commentRanges = (node.kind === 151 ||
- node.kind === 150 ||
- node.kind === 196 ||
+ var commentRanges = (node.kind === 152 ||
+ node.kind === 151 ||
node.kind === 197 ||
- node.kind === 195) ?
+ node.kind === 198 ||
+ node.kind === 196) ?
ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) :
ts.getLeadingCommentRanges(text, node.pos);
return ts.filter(commentRanges, function (comment) {
@@ -6920,79 +7077,79 @@
ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*<amd-dependency\s+path\s*=\s*)('|")(.+?)\2.*?\/>/;
var defaultLibReferenceRegEx = /^(\/\/\/\s*<reference\s+no-default-lib\s*=\s*)('|")(.+?)\2\s*\/>/;
function isPartOfTypeNode(node) {
- if (163 <= node.kind && node.kind <= 183) {
+ if (164 <= node.kind && node.kind <= 184) {
return true;
}
switch (node.kind) {
- case 120:
- case 143:
- case 135:
- case 146:
- case 138:
- case 123:
- case 139:
+ case 121:
+ case 144:
case 136:
- case 141:
- case 132:
+ case 147:
+ case 139:
+ case 124:
+ case 140:
+ case 137:
+ case 142:
+ case 133:
return true;
- case 106:
- return node.parent.kind !== 200;
- case 211:
+ case 107:
+ return node.parent.kind !== 201;
+ case 212:
return !isExpressionWithTypeArgumentsInClassExtendsClause(node);
- case 150:
- return node.parent.kind === 181 || node.parent.kind === 176;
- case 72:
- if (node.parent.kind === 148 && node.parent.right === node) {
+ case 151:
+ return node.parent.kind === 182 || node.parent.kind === 177;
+ case 73:
+ if (node.parent.kind === 149 && node.parent.right === node) {
node = node.parent;
}
- else if (node.parent.kind === 189 && node.parent.name === node) {
+ else if (node.parent.kind === 190 && node.parent.name === node) {
node = node.parent;
}
- ts.Debug.assert(node.kind === 72 || node.kind === 148 || node.kind === 189, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'.");
- case 148:
- case 189:
- case 100: {
+ ts.Debug.assert(node.kind === 73 || node.kind === 149 || node.kind === 190, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'.");
+ case 149:
+ case 190:
+ case 101: {
var parent = node.parent;
- if (parent.kind === 167) {
+ if (parent.kind === 168) {
return false;
}
- if (parent.kind === 183) {
+ if (parent.kind === 184) {
return !parent.isTypeOf;
}
- if (163 <= parent.kind && parent.kind <= 183) {
+ if (164 <= parent.kind && parent.kind <= 184) {
return true;
}
switch (parent.kind) {
- case 211:
+ case 212:
return !isExpressionWithTypeArgumentsInClassExtendsClause(parent);
- case 150:
+ case 151:
return node === parent.constraint;
- case 308:
+ case 309:
return node === parent.constraint;
+ case 155:
case 154:
- case 153:
- case 151:
- case 237:
+ case 152:
+ case 238:
return node === parent.type;
- case 239:
- case 196:
+ case 240:
case 197:
+ case 198:
+ case 158:
case 157:
case 156:
- case 155:
- case 158:
case 159:
- return node === parent.type;
case 160:
+ return node === parent.type;
case 161:
case 162:
+ case 163:
return node === parent.type;
- case 194:
+ case 195:
return node === parent.type;
- case 191:
case 192:
- return ts.contains(parent.typeArguments, node);
case 193:
+ return ts.contains(parent.typeArguments, node);
+ case 194:
return false;
}
}
@@ -7014,23 +7171,23 @@
return traverse(body);
function traverse(node) {
switch (node.kind) {
- case 230:
+ case 231:
return visitor(node);
- case 246:
- case 218:
- case 222:
+ case 247:
+ case 219:
case 223:
case 224:
case 225:
case 226:
case 227:
- case 231:
+ case 228:
case 232:
- case 271:
- case 272:
case 233:
- case 235:
- case 274:
+ case 272:
+ case 273:
+ case 234:
+ case 236:
+ case 275:
return ts.forEachChild(node, traverse);
}
}
@@ -7040,23 +7197,23 @@
return traverse(body);
function traverse(node) {
switch (node.kind) {
- case 207:
+ case 208:
visitor(node);
var operand = node.expression;
if (operand) {
traverse(operand);
}
return;
- case 243:
- case 241:
case 244:
case 242:
- case 240:
- case 209:
+ case 245:
+ case 243:
+ case 241:
+ case 210:
return;
default:
if (ts.isFunctionLike(node)) {
- if (node.name && node.name.kind === 149) {
+ if (node.name && node.name.kind === 150) {
traverse(node.name.expression);
return;
}
@@ -7069,10 +7226,10 @@
}
ts.forEachYieldExpression = forEachYieldExpression;
function getRestParameterElementType(node) {
- if (node && node.kind === 169) {
+ if (node && node.kind === 170) {
return node.elementType;
}
- else if (node && node.kind === 164) {
+ else if (node && node.kind === 165) {
return ts.singleOrUndefined(node.typeArguments);
}
else {
@@ -7082,12 +7239,12 @@
ts.getRestParameterElementType = getRestParameterElementType;
function getMembersOfDeclaration(node) {
switch (node.kind) {
+ case 242:
case 241:
- case 240:
- case 209:
- case 168:
+ case 210:
+ case 169:
return node.members;
- case 188:
+ case 189:
return node.properties;
}
}
@@ -7095,14 +7252,14 @@
function isVariableLike(node) {
if (node) {
switch (node.kind) {
- case 186:
- case 278:
- case 151:
- case 275:
- case 154:
- case 153:
+ case 187:
+ case 279:
+ case 152:
case 276:
- case 237:
+ case 155:
+ case 154:
+ case 277:
+ case 238:
return true;
}
}
@@ -7114,8 +7271,8 @@
}
ts.isVariableLikeOrAccessor = isVariableLikeOrAccessor;
function isVariableDeclarationInVariableStatement(node) {
- return node.parent.kind === 238
- && node.parent.parent.kind === 219;
+ return node.parent.kind === 239
+ && node.parent.parent.kind === 220;
}
ts.isVariableDeclarationInVariableStatement = isVariableDeclarationInVariableStatement;
function isValidESSymbolDeclaration(node) {
@@ -7126,13 +7283,13 @@
ts.isValidESSymbolDeclaration = isValidESSymbolDeclaration;
function introducesArgumentsExoticObject(node) {
switch (node.kind) {
- case 156:
- case 155:
case 157:
+ case 156:
case 158:
case 159:
- case 239:
- case 196:
+ case 160:
+ case 240:
+ case 197:
return true;
}
return false;
@@ -7143,7 +7300,7 @@
if (beforeUnwrapLabelCallback) {
beforeUnwrapLabelCallback(node);
}
- if (node.statement.kind !== 233) {
+ if (node.statement.kind !== 234) {
return node.statement;
}
node = node.statement;
@@ -7151,17 +7308,17 @@
}
ts.unwrapInnermostStatementOfLabel = unwrapInnermostStatementOfLabel;
function isFunctionBlock(node) {
- return node && node.kind === 218 && ts.isFunctionLike(node.parent);
+ return node && node.kind === 219 && ts.isFunctionLike(node.parent);
}
ts.isFunctionBlock = isFunctionBlock;
function isObjectLiteralMethod(node) {
- return node && node.kind === 156 && node.parent.kind === 188;
+ return node && node.kind === 157 && node.parent.kind === 189;
}
ts.isObjectLiteralMethod = isObjectLiteralMethod;
function isObjectLiteralOrClassExpressionMethod(node) {
- return node.kind === 156 &&
- (node.parent.kind === 188 ||
- node.parent.kind === 209);
+ return node.kind === 157 &&
+ (node.parent.kind === 189 ||
+ node.parent.kind === 210);
}
ts.isObjectLiteralOrClassExpressionMethod = isObjectLiteralOrClassExpressionMethod;
function isIdentifierTypePredicate(predicate) {
@@ -7174,7 +7331,7 @@
ts.isThisTypePredicate = isThisTypePredicate;
function getPropertyAssignment(objectLiteral, key, key2) {
return objectLiteral.properties.filter(function (property) {
- if (property.kind === 275) {
+ if (property.kind === 276) {
var propName = getTextOfPropertyName(property.name);
return key === propName || (!!key2 && key2 === propName);
}
@@ -7206,51 +7363,55 @@
return findAncestor(node.parent, ts.isFunctionLike);
}
ts.getContainingFunction = getContainingFunction;
+ function getContainingFunctionDeclaration(node) {
+ return findAncestor(node.parent, ts.isFunctionLikeDeclaration);
+ }
+ ts.getContainingFunctionDeclaration = getContainingFunctionDeclaration;
function getContainingClass(node) {
return findAncestor(node.parent, ts.isClassLike);
}
ts.getContainingClass = getContainingClass;
function getThisContainer(node, includeArrowFunctions) {
- ts.Debug.assert(node.kind !== 284);
+ ts.Debug.assert(node.kind !== 285);
while (true) {
node = node.parent;
if (!node) {
return ts.Debug.fail();
}
switch (node.kind) {
- case 149:
+ case 150:
if (ts.isClassLike(node.parent.parent)) {
return node;
}
node = node.parent;
break;
- case 152:
- if (node.parent.kind === 151 && ts.isClassElement(node.parent.parent)) {
+ case 153:
+ if (node.parent.kind === 152 && ts.isClassElement(node.parent.parent)) {
node = node.parent.parent;
}
else if (ts.isClassElement(node.parent)) {
node = node.parent;
}
break;
- case 197:
+ case 198:
if (!includeArrowFunctions) {
continue;
}
- case 239:
- case 196:
- case 244:
- case 154:
- case 153:
- case 156:
+ case 240:
+ case 197:
+ case 245:
case 155:
+ case 154:
case 157:
+ case 156:
case 158:
case 159:
case 160:
case 161:
case 162:
- case 243:
- case 284:
+ case 163:
+ case 244:
+ case 285:
return node;
}
}
@@ -7260,9 +7421,9 @@
var container = getThisContainer(node, false);
if (container) {
switch (container.kind) {
- case 157:
- case 239:
- case 196:
+ case 158:
+ case 240:
+ case 197:
return container;
}
}
@@ -7276,25 +7437,25 @@
return node;
}
switch (node.kind) {
- case 149:
+ case 150:
node = node.parent;
break;
- case 239:
- case 196:
+ case 240:
case 197:
+ case 198:
if (!stopOnFunctions) {
continue;
}
- case 154:
- case 153:
- case 156:
case 155:
+ case 154:
case 157:
+ case 156:
case 158:
case 159:
+ case 160:
return node;
- case 152:
- if (node.parent.kind === 151 && ts.isClassElement(node.parent.parent)) {
+ case 153:
+ if (node.parent.kind === 152 && ts.isClassElement(node.parent.parent)) {
node = node.parent.parent;
}
else if (ts.isClassElement(node.parent)) {
@@ -7306,46 +7467,46 @@
}
ts.getSuperContainer = getSuperContainer;
function getImmediatelyInvokedFunctionExpression(func) {
- if (func.kind === 196 || func.kind === 197) {
+ if (func.kind === 197 || func.kind === 198) {
var prev = func;
var parent = func.parent;
- while (parent.kind === 195) {
+ while (parent.kind === 196) {
prev = parent;
parent = parent.parent;
}
- if (parent.kind === 191 && parent.expression === prev) {
+ if (parent.kind === 192 && parent.expression === prev) {
return parent;
}
}
}
ts.getImmediatelyInvokedFunctionExpression = getImmediatelyInvokedFunctionExpression;
function isSuperOrSuperProperty(node) {
- return node.kind === 98
+ return node.kind === 99
|| isSuperProperty(node);
}
ts.isSuperOrSuperProperty = isSuperOrSuperProperty;
function isSuperProperty(node) {
var kind = node.kind;
- return (kind === 189 || kind === 190)
- && node.expression.kind === 98;
+ return (kind === 190 || kind === 191)
+ && node.expression.kind === 99;
}
ts.isSuperProperty = isSuperProperty;
function isThisProperty(node) {
var kind = node.kind;
- return (kind === 189 || kind === 190)
- && node.expression.kind === 100;
+ return (kind === 190 || kind === 191)
+ && node.expression.kind === 101;
}
ts.isThisProperty = isThisProperty;
function getEntityNameFromTypeNode(node) {
switch (node.kind) {
- case 164:
+ case 165:
return node.typeName;
- case 211:
+ case 212:
return isEntityNameExpression(node.expression)
? node.expression
: undefined;
- case 72:
- case 148:
+ case 73:
+ case 149:
return node;
}
return undefined;
@@ -7353,10 +7514,10 @@
ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode;
function getInvokedExpression(node) {
switch (node.kind) {
- case 193:
+ case 194:
return node.tag;
+ case 263:
case 262:
- case 261:
return node.tagName;
default:
return node.expression;
@@ -7365,21 +7526,21 @@
ts.getInvokedExpression = getInvokedExpression;
function nodeCanBeDecorated(node, parent, grandparent) {
switch (node.kind) {
- case 240:
+ case 241:
return true;
- case 154:
- return parent.kind === 240;
- case 158:
+ case 155:
+ return parent.kind === 241;
case 159:
- case 156:
+ case 160:
+ case 157:
return node.body !== undefined
- && parent.kind === 240;
- case 151:
+ && parent.kind === 241;
+ case 152:
return parent.body !== undefined
- && (parent.kind === 157
- || parent.kind === 156
- || parent.kind === 159)
- && grandparent.kind === 240;
+ && (parent.kind === 158
+ || parent.kind === 157
+ || parent.kind === 160)
+ && grandparent.kind === 241;
}
return false;
}
@@ -7395,10 +7556,10 @@
ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated;
function childIsDecorated(node, parent) {
switch (node.kind) {
- case 240:
+ case 241:
return ts.some(node.members, function (m) { return nodeOrChildIsDecorated(m, node, parent); });
- case 156:
- case 159:
+ case 157:
+ case 160:
return ts.some(node.parameters, function (p) { return nodeIsDecorated(p, node, parent); });
default:
return false;
@@ -7407,9 +7568,9 @@
ts.childIsDecorated = childIsDecorated;
function isJSXTagName(node) {
var parent = node.parent;
- if (parent.kind === 262 ||
- parent.kind === 261 ||
- parent.kind === 263) {
+ if (parent.kind === 263 ||
+ parent.kind === 262 ||
+ parent.kind === 264) {
return parent.tagName === node;
}
return false;
@@ -7417,56 +7578,56 @@
ts.isJSXTagName = isJSXTagName;
function isExpressionNode(node) {
switch (node.kind) {
- case 98:
- case 96:
- case 102:
- case 87:
+ case 99:
+ case 97:
+ case 103:
+ case 88:
case 13:
- case 187:
case 188:
case 189:
case 190:
case 191:
case 192:
case 193:
- case 212:
case 194:
case 213:
case 195:
+ case 214:
case 196:
- case 209:
case 197:
- case 200:
+ case 210:
case 198:
+ case 201:
case 199:
- case 202:
+ case 200:
case 203:
case 204:
case 205:
- case 208:
case 206:
+ case 209:
+ case 207:
case 14:
- case 210:
- case 260:
+ case 211:
case 261:
- case 264:
- case 207:
- case 201:
- case 214:
+ case 262:
+ case 265:
+ case 208:
+ case 202:
+ case 215:
return true;
- case 148:
- while (node.parent.kind === 148) {
+ case 149:
+ while (node.parent.kind === 149) {
node = node.parent;
}
- return node.parent.kind === 167 || isJSXTagName(node);
- case 72:
- if (node.parent.kind === 167 || isJSXTagName(node)) {
+ return node.parent.kind === 168 || isJSXTagName(node);
+ case 73:
+ if (node.parent.kind === 168 || isJSXTagName(node)) {
return true;
}
case 8:
case 9:
case 10:
- case 100:
+ case 101:
return isInExpressionContext(node);
default:
return false;
@@ -7476,49 +7637,49 @@
function isInExpressionContext(node) {
var parent = node.parent;
switch (parent.kind) {
- case 237:
- case 151:
+ case 238:
+ case 152:
+ case 155:
case 154:
- case 153:
- case 278:
- case 275:
- case 186:
+ case 279:
+ case 276:
+ case 187:
return parent.initializer === node;
- case 221:
case 222:
case 223:
case 224:
- case 230:
+ case 225:
case 231:
case 232:
- case 271:
- case 234:
+ case 233:
+ case 272:
+ case 235:
return parent.expression === node;
- case 225:
+ case 226:
var forStatement = parent;
- return (forStatement.initializer === node && forStatement.initializer.kind !== 238) ||
+ return (forStatement.initializer === node && forStatement.initializer.kind !== 239) ||
forStatement.condition === node ||
forStatement.incrementor === node;
- case 226:
case 227:
+ case 228:
var forInStatement = parent;
- return (forInStatement.initializer === node && forInStatement.initializer.kind !== 238) ||
+ return (forInStatement.initializer === node && forInStatement.initializer.kind !== 239) ||
forInStatement.expression === node;
- case 194:
- case 212:
+ case 195:
+ case 213:
return node === parent.expression;
- case 216:
+ case 217:
return node === parent.expression;
- case 149:
+ case 150:
return node === parent.expression;
- case 152:
+ case 153:
+ case 271:
case 270:
- case 269:
- case 277:
+ case 278:
return true;
- case 211:
+ case 212:
return parent.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent);
- case 276:
+ case 277:
return parent.objectAssignmentInitializer === node;
default:
return isExpressionNode(parent);
@@ -7526,7 +7687,7 @@
}
ts.isInExpressionContext = isInExpressionContext;
function isExternalModuleImportEqualsDeclaration(node) {
- return node.kind === 248 && node.moduleReference.kind === 259;
+ return node.kind === 249 && node.moduleReference.kind === 260;
}
ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration;
function getExternalModuleImportEqualsDeclarationExpression(node) {
@@ -7535,7 +7696,7 @@
}
ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression;
function isInternalModuleImportEqualsDeclaration(node) {
- return node.kind === 248 && node.moduleReference.kind !== 259;
+ return node.kind === 249 && node.moduleReference.kind !== 260;
}
ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration;
function isSourceFileJS(file) {
@@ -7563,15 +7724,15 @@
ts.isIdentifier(node.typeName) &&
node.typeName.escapedText === "Object" &&
node.typeArguments && node.typeArguments.length === 2 &&
- (node.typeArguments[0].kind === 138 || node.typeArguments[0].kind === 135);
+ (node.typeArguments[0].kind === 139 || node.typeArguments[0].kind === 136);
}
ts.isJSDocIndexSignature = isJSDocIndexSignature;
function isRequireCall(callExpression, checkArgumentIsStringLiteralLike) {
- if (callExpression.kind !== 191) {
+ if (callExpression.kind !== 192) {
return false;
}
var _a = callExpression, expression = _a.expression, args = _a.arguments;
- if (expression.kind !== 72 || expression.escapedText !== "require") {
+ if (expression.kind !== 73 || expression.escapedText !== "require") {
return false;
}
if (args.length !== 1) {
@@ -7602,7 +7763,7 @@
name = node.parent.name;
decl = node.parent;
}
- else if (ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 59 && node.parent.right === node) {
+ else if (ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 60 && node.parent.right === node) {
name = node.parent.left;
decl = name;
}
@@ -7611,7 +7772,7 @@
name = node.parent.parent.name;
decl = node.parent.parent;
}
- else if (ts.isBinaryExpression(node.parent.parent) && node.parent.parent.operatorToken.kind === 59 && node.parent.parent.right === node.parent) {
+ else if (ts.isBinaryExpression(node.parent.parent) && node.parent.parent.operatorToken.kind === 60 && node.parent.parent.right === node.parent) {
name = node.parent.parent.left;
decl = name;
}
@@ -7647,7 +7808,7 @@
return ts.forEach(node.properties, function (p) { return ts.isPropertyAssignment(p) && ts.isIdentifier(p.name) && p.name.escapedText === "value" && p.initializer && getExpandoInitializer(p.initializer, isPrototypeAssignment); });
}
function getAssignedExpandoInitializer(node) {
- if (node && node.parent && ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 59) {
+ if (node && node.parent && ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 60) {
var isPrototypeAssignment = isPrototypeAccess(node.parent.left);
return getExpandoInitializer(node.parent.right, isPrototypeAssignment) ||
getDefaultedExpandoInitializer(node.parent.left, node.parent.right, isPrototypeAssignment);
@@ -7663,11 +7824,11 @@
function getExpandoInitializer(initializer, isPrototypeAssignment) {
if (ts.isCallExpression(initializer)) {
var e = skipParentheses(initializer.expression);
- return e.kind === 196 || e.kind === 197 ? initializer : undefined;
+ return e.kind === 197 || e.kind === 198 ? initializer : undefined;
}
- if (initializer.kind === 196 ||
- initializer.kind === 209 ||
- initializer.kind === 197) {
+ if (initializer.kind === 197 ||
+ initializer.kind === 210 ||
+ initializer.kind === 198) {
return initializer;
}
if (ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || isPrototypeAssignment)) {
@@ -7683,7 +7844,7 @@
}
function isDefaultedExpandoInitializer(node) {
var name = ts.isVariableDeclaration(node.parent) ? node.parent.name :
- ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 59 ? node.parent.left :
+ ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 60 ? node.parent.left :
undefined;
return name && getExpandoInitializer(node.right, isPrototypeAccess(name)) && isEntityNameExpression(name) && isSameEntityName(name, node.left);
}
@@ -7691,7 +7852,7 @@
function getNameOfExpando(node) {
if (ts.isBinaryExpression(node.parent)) {
var parent = (node.parent.operatorToken.kind === 55 && ts.isBinaryExpression(node.parent.parent)) ? node.parent.parent : node.parent;
- if (parent.operatorToken.kind === 59 && ts.isIdentifier(parent.left)) {
+ if (parent.operatorToken.kind === 60 && ts.isIdentifier(parent.left)) {
return parent.left;
}
}
@@ -7705,7 +7866,7 @@
return name.escapedText === initializer.escapedText;
}
if (ts.isIdentifier(name) && ts.isPropertyAccessExpression(initializer)) {
- return (initializer.expression.kind === 100 ||
+ return (initializer.expression.kind === 101 ||
ts.isIdentifier(initializer.expression) &&
(initializer.expression.escapedText === "window" ||
initializer.expression.escapedText === "self" ||
@@ -7761,7 +7922,7 @@
}
return 7;
}
- if (expr.operatorToken.kind !== 59 ||
+ if (expr.operatorToken.kind !== 60 ||
!ts.isPropertyAccessExpression(expr.left)) {
return 0;
}
@@ -7772,7 +7933,7 @@
return getAssignmentDeclarationPropertyAccessKind(lhs);
}
function getAssignmentDeclarationPropertyAccessKind(lhs) {
- if (lhs.expression.kind === 100) {
+ if (lhs.expression.kind === 101) {
return 4;
}
else if (isModuleExportsPropertyAccessExpression(lhs)) {
@@ -7810,7 +7971,7 @@
ts.isPrototypePropertyAssignment = isPrototypePropertyAssignment;
function isSpecialPropertyDeclaration(expr) {
return isInJSFile(expr) &&
- expr.parent && expr.parent.kind === 221 &&
+ expr.parent && expr.parent.kind === 222 &&
!!ts.getJSDocTypeTag(expr.parent);
}
ts.isSpecialPropertyDeclaration = isSpecialPropertyDeclaration;
@@ -7819,23 +7980,23 @@
return false;
}
var decl = symbol.valueDeclaration;
- return decl.kind === 239 || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer);
+ return decl.kind === 240 || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer);
}
ts.isFunctionSymbol = isFunctionSymbol;
function importFromModuleSpecifier(node) {
- return tryGetImportFromModuleSpecifier(node) || ts.Debug.fail(ts.Debug.showSyntaxKind(node.parent));
+ return tryGetImportFromModuleSpecifier(node) || ts.Debug.failBadSyntaxKind(node.parent);
}
ts.importFromModuleSpecifier = importFromModuleSpecifier;
function tryGetImportFromModuleSpecifier(node) {
switch (node.parent.kind) {
- case 249:
- case 255:
+ case 250:
+ case 256:
return node.parent;
- case 259:
+ case 260:
return node.parent.parent;
- case 191:
+ case 192:
return isImportCall(node.parent) || isRequireCall(node.parent, false) ? node.parent : undefined;
- case 182:
+ case 183:
ts.Debug.assert(ts.isStringLiteral(node));
return ts.tryCast(node.parent.parent, ts.isImportTypeNode);
default:
@@ -7845,12 +8006,12 @@
ts.tryGetImportFromModuleSpecifier = tryGetImportFromModuleSpecifier;
function getExternalModuleName(node) {
switch (node.kind) {
- case 249:
- case 255:
+ case 250:
+ case 256:
return node.moduleSpecifier;
- case 248:
- return node.moduleReference.kind === 259 ? node.moduleReference.expression : undefined;
- case 183:
+ case 249:
+ return node.moduleReference.kind === 260 ? node.moduleReference.expression : undefined;
+ case 184:
return isLiteralImportTypeNode(node) ? node.argument.literal : undefined;
default:
return ts.Debug.assertNever(node);
@@ -7859,11 +8020,11 @@
ts.getExternalModuleName = getExternalModuleName;
function getNamespaceDeclarationNode(node) {
switch (node.kind) {
- case 249:
+ case 250:
return node.importClause && ts.tryCast(node.importClause.namedBindings, ts.isNamespaceImport);
- case 248:
+ case 249:
return node;
- case 255:
+ case 256:
return undefined;
default:
return ts.Debug.assertNever(node);
@@ -7871,19 +8032,19 @@
}
ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode;
function isDefaultImport(node) {
- return node.kind === 249 && !!node.importClause && !!node.importClause.name;
+ return node.kind === 250 && !!node.importClause && !!node.importClause.name;
}
ts.isDefaultImport = isDefaultImport;
function hasQuestionToken(node) {
if (node) {
switch (node.kind) {
- case 151:
+ case 152:
+ case 157:
case 156:
- case 155:
+ case 277:
case 276:
- case 275:
+ case 155:
case 154:
- case 153:
return node.questionToken !== undefined;
}
}
@@ -7897,7 +8058,7 @@
}
ts.isJSDocConstructSignature = isJSDocConstructSignature;
function isJSDocTypeAlias(node) {
- return node.kind === 309 || node.kind === 302;
+ return node.kind === 310 || node.kind === 303;
}
ts.isJSDocTypeAlias = isJSDocTypeAlias;
function isTypeAlias(node) {
@@ -7907,7 +8068,7 @@
function getSourceOfAssignment(node) {
return ts.isExpressionStatement(node) &&
node.expression && ts.isBinaryExpression(node.expression) &&
- node.expression.operatorToken.kind === 59
+ node.expression.operatorToken.kind === 60
? node.expression.right
: undefined;
}
@@ -7922,12 +8083,12 @@
}
function getSingleInitializerOfVariableStatementOrPropertyDeclaration(node) {
switch (node.kind) {
- case 219:
+ case 220:
var v = getSingleVariableOfVariableStatement(node);
return v && v.initializer;
- case 154:
+ case 155:
return node.initializer;
- case 275:
+ case 276:
return node.initializer;
}
}
@@ -7938,7 +8099,7 @@
function getNestedModuleDeclaration(node) {
return ts.isModuleDeclaration(node) &&
node.body &&
- node.body.kind === 244
+ node.body.kind === 245
? node.body
: undefined;
}
@@ -7952,11 +8113,11 @@
if (ts.hasJSDocNodes(node)) {
result = ts.addRange(result, node.jsDoc);
}
- if (node.kind === 151) {
+ if (node.kind === 152) {
result = ts.addRange(result, ts.getJSDocParameterTags(node));
break;
}
- if (node.kind === 150) {
+ if (node.kind === 151) {
result = ts.addRange(result, ts.getJSDocTypeParameterTags(node));
break;
}
@@ -7967,16 +8128,17 @@
ts.getJSDocCommentsAndTags = getJSDocCommentsAndTags;
function getNextJSDocCommentLocation(node) {
var parent = node.parent;
- if (parent.kind === 275 ||
- parent.kind === 154 ||
- parent.kind === 221 && node.kind === 189 ||
+ if (parent.kind === 276 ||
+ parent.kind === 255 ||
+ parent.kind === 155 ||
+ parent.kind === 222 && node.kind === 190 ||
getNestedModuleDeclaration(parent) ||
- ts.isBinaryExpression(node) && node.operatorToken.kind === 59) {
+ ts.isBinaryExpression(node) && node.operatorToken.kind === 60) {
return parent;
}
else if (parent.parent &&
(getSingleVariableOfVariableStatement(parent.parent) === node ||
- ts.isBinaryExpression(parent) && parent.operatorToken.kind === 59)) {
+ ts.isBinaryExpression(parent) && parent.operatorToken.kind === 60)) {
return parent.parent;
}
else if (parent.parent && parent.parent.parent &&
@@ -7998,7 +8160,7 @@
if (!decl) {
return undefined;
}
- var parameter = ts.find(decl.parameters, function (p) { return p.name.kind === 72 && p.name.escapedText === name; });
+ var parameter = ts.find(decl.parameters, function (p) { return p.name.kind === 73 && p.name.escapedText === name; });
return parameter && parameter.symbol;
}
ts.getParameterSymbolFromJSDoc = getParameterSymbolFromJSDoc;
@@ -8033,38 +8195,38 @@
ts.hasRestParameter = hasRestParameter;
function isRestParameter(node) {
var type = ts.isJSDocParameterTag(node) ? (node.typeExpression && node.typeExpression.type) : node.type;
- return node.dotDotDotToken !== undefined || !!type && type.kind === 295;
+ return node.dotDotDotToken !== undefined || !!type && type.kind === 296;
}
ts.isRestParameter = isRestParameter;
function getAssignmentTargetKind(node) {
var parent = node.parent;
while (true) {
switch (parent.kind) {
- case 204:
+ case 205:
var binaryOperator = parent.operatorToken.kind;
return isAssignmentOperator(binaryOperator) && parent.left === node ?
- binaryOperator === 59 ? 1 : 2 :
+ binaryOperator === 60 ? 1 : 2 :
0;
- case 202:
case 203:
+ case 204:
var unaryOperator = parent.operator;
return unaryOperator === 44 || unaryOperator === 45 ? 2 : 0;
- case 226:
case 227:
+ case 228:
return parent.initializer === node ? 1 : 0;
- case 195:
- case 187:
- case 208:
- case 213:
+ case 196:
+ case 188:
+ case 209:
+ case 214:
node = parent;
break;
- case 276:
+ case 277:
if (parent.name !== node) {
return 0;
}
node = parent.parent;
break;
- case 275:
+ case 276:
if (parent.name === node) {
return 0;
}
@@ -8083,22 +8245,22 @@
ts.isAssignmentTarget = isAssignmentTarget;
function isNodeWithPossibleHoistedDeclaration(node) {
switch (node.kind) {
- case 218:
case 219:
- case 231:
- case 222:
+ case 220:
case 232:
- case 246:
- case 271:
- case 272:
+ case 223:
case 233:
- case 225:
+ case 247:
+ case 272:
+ case 273:
+ case 234:
case 226:
case 227:
- case 223:
+ case 228:
case 224:
- case 235:
- case 274:
+ case 225:
+ case 236:
+ case 275:
return true;
}
return false;
@@ -8115,32 +8277,32 @@
return node;
}
function walkUpParenthesizedTypes(node) {
- return walkUp(node, 177);
+ return walkUp(node, 178);
}
ts.walkUpParenthesizedTypes = walkUpParenthesizedTypes;
function walkUpParenthesizedExpressions(node) {
- return walkUp(node, 195);
+ return walkUp(node, 196);
}
ts.walkUpParenthesizedExpressions = walkUpParenthesizedExpressions;
function skipParentheses(node) {
- while (node.kind === 195) {
+ while (node.kind === 196) {
node = node.expression;
}
return node;
}
ts.skipParentheses = skipParentheses;
function skipParenthesesUp(node) {
- while (node.kind === 195) {
+ while (node.kind === 196) {
node = node.parent;
}
return node;
}
function isDeleteTarget(node) {
- if (node.kind !== 189 && node.kind !== 190) {
+ if (node.kind !== 190 && node.kind !== 191) {
return false;
}
node = walkUpParenthesizedExpressions(node.parent);
- return node && node.kind === 198;
+ return node && node.kind === 199;
}
ts.isDeleteTarget = isDeleteTarget;
function isNodeDescendantOf(node, ancestor) {
@@ -8163,7 +8325,7 @@
case 8:
if (ts.isComputedPropertyName(parent))
return parent.parent;
- case 72:
+ case 73:
if (ts.isDeclaration(parent)) {
return parent.name === name ? parent : undefined;
}
@@ -8187,49 +8349,49 @@
ts.getDeclarationFromName = getDeclarationFromName;
function isLiteralComputedPropertyDeclarationName(node) {
return (node.kind === 10 || node.kind === 8) &&
- node.parent.kind === 149 &&
+ node.parent.kind === 150 &&
ts.isDeclaration(node.parent.parent);
}
ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName;
function isIdentifierName(node) {
var parent = node.parent;
switch (parent.kind) {
+ case 155:
case 154:
- case 153:
+ case 157:
case 156:
- case 155:
- case 158:
case 159:
- case 278:
- case 275:
- case 189:
+ case 160:
+ case 279:
+ case 276:
+ case 190:
return parent.name === node;
- case 148:
+ case 149:
if (parent.right === node) {
- while (parent.kind === 148) {
+ while (parent.kind === 149) {
parent = parent.parent;
}
- return parent.kind === 167 || parent.kind === 164;
+ return parent.kind === 168 || parent.kind === 165;
}
return false;
- case 186:
- case 253:
+ case 187:
+ case 254:
return parent.propertyName === node;
- case 257:
- case 267:
+ case 258:
+ case 268:
return true;
}
return false;
}
ts.isIdentifierName = isIdentifierName;
function isAliasSymbolDeclaration(node) {
- return node.kind === 248 ||
- node.kind === 247 ||
- node.kind === 250 && !!node.name ||
- node.kind === 251 ||
- node.kind === 253 ||
- node.kind === 257 ||
- node.kind === 254 && exportAssignmentIsAlias(node) ||
+ return node.kind === 249 ||
+ node.kind === 248 ||
+ node.kind === 251 && !!node.name ||
+ node.kind === 252 ||
+ node.kind === 254 ||
+ node.kind === 258 ||
+ node.kind === 255 && exportAssignmentIsAlias(node) ||
ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 && exportAssignmentIsAlias(node);
}
ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration;
@@ -8250,12 +8412,12 @@
}
ts.getEffectiveBaseTypeNode = getEffectiveBaseTypeNode;
function getClassExtendsHeritageElement(node) {
- var heritageClause = getHeritageClause(node.heritageClauses, 86);
+ var heritageClause = getHeritageClause(node.heritageClauses, 87);
return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined;
}
ts.getClassExtendsHeritageElement = getClassExtendsHeritageElement;
function getClassImplementsHeritageClauseElements(node) {
- var heritageClause = getHeritageClause(node.heritageClauses, 109);
+ var heritageClause = getHeritageClause(node.heritageClauses, 110);
return heritageClause ? heritageClause.types : undefined;
}
ts.getClassImplementsHeritageClauseElements = getClassImplementsHeritageClauseElements;
@@ -8266,7 +8428,7 @@
}
ts.getAllSuperTypeNodes = getAllSuperTypeNodes;
function getInterfaceBaseTypeNodes(node) {
- var heritageClause = getHeritageClause(node.heritageClauses, 86);
+ var heritageClause = getHeritageClause(node.heritageClauses, 87);
return heritageClause ? heritageClause.types : undefined;
}
ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes;
@@ -8300,11 +8462,11 @@
}
ts.getAncestor = getAncestor;
function isKeyword(token) {
- return 73 <= token && token <= 147;
+ return 74 <= token && token <= 148;
}
ts.isKeyword = isKeyword;
function isContextualKeyword(token) {
- return 118 <= token && token <= 147;
+ return 119 <= token && token <= 148;
}
ts.isContextualKeyword = isContextualKeyword;
function isNonContextualKeyword(token) {
@@ -8331,13 +8493,13 @@
}
var flags = 0;
switch (node.kind) {
- case 239:
- case 196:
- case 156:
+ case 240:
+ case 197:
+ case 157:
if (node.asteriskToken) {
flags |= 1;
}
- case 197:
+ case 198:
if (hasModifier(node, 256)) {
flags |= 2;
}
@@ -8351,10 +8513,10 @@
ts.getFunctionFlags = getFunctionFlags;
function isAsyncFunction(node) {
switch (node.kind) {
- case 239:
- case 196:
+ case 240:
case 197:
- case 156:
+ case 198:
+ case 157:
return node.body !== undefined
&& node.asteriskToken === undefined
&& hasModifier(node, 256);
@@ -8372,7 +8534,7 @@
}
ts.hasDynamicName = hasDynamicName;
function isDynamicName(name) {
- return name.kind === 149 &&
+ return name.kind === 150 &&
!isStringOrNumericLiteralLike(name.expression) &&
!isWellKnownSymbolSyntactically(name.expression);
}
@@ -8383,12 +8545,12 @@
ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically;
function getPropertyNameForPropertyNameNode(name) {
switch (name.kind) {
- case 72:
+ case 73:
return name.escapedText;
case 10:
case 8:
return ts.escapeLeadingUnderscores(name.text);
- case 149:
+ case 150:
var nameExpression = name.expression;
if (isWellKnownSymbolSyntactically(nameExpression)) {
return getPropertyNameForKnownSymbolName(ts.idText(nameExpression.name));
@@ -8404,7 +8566,7 @@
ts.getPropertyNameForPropertyNameNode = getPropertyNameForPropertyNameNode;
function isPropertyNameLiteral(node) {
switch (node.kind) {
- case 72:
+ case 73:
case 10:
case 14:
case 8:
@@ -8415,11 +8577,11 @@
}
ts.isPropertyNameLiteral = isPropertyNameLiteral;
function getTextOfIdentifierOrLiteral(node) {
- return node.kind === 72 ? ts.idText(node) : node.text;
+ return node.kind === 73 ? ts.idText(node) : node.text;
}
ts.getTextOfIdentifierOrLiteral = getTextOfIdentifierOrLiteral;
function getEscapedTextOfIdentifierOrLiteral(node) {
- return node.kind === 72 ? node.escapedText : ts.escapeLeadingUnderscores(node.text);
+ return node.kind === 73 ? node.escapedText : ts.escapeLeadingUnderscores(node.text);
}
ts.getEscapedTextOfIdentifierOrLiteral = getEscapedTextOfIdentifierOrLiteral;
function getPropertyNameForKnownSymbolName(symbolName) {
@@ -8431,7 +8593,7 @@
}
ts.isKnownSymbol = isKnownSymbol;
function isESSymbolIdentifier(node) {
- return node.kind === 72 && node.escapedText === "Symbol";
+ return node.kind === 73 && node.escapedText === "Symbol";
}
ts.isESSymbolIdentifier = isESSymbolIdentifier;
function isPushOrUnshiftIdentifier(node) {
@@ -8440,11 +8602,11 @@
ts.isPushOrUnshiftIdentifier = isPushOrUnshiftIdentifier;
function isParameterDeclaration(node) {
var root = getRootDeclaration(node);
- return root.kind === 151;
+ return root.kind === 152;
}
ts.isParameterDeclaration = isParameterDeclaration;
function getRootDeclaration(node) {
- while (node.kind === 186) {
+ while (node.kind === 187) {
node = node.parent.parent;
}
return node;
@@ -8452,15 +8614,15 @@
ts.getRootDeclaration = getRootDeclaration;
function nodeStartsNewLexicalEnvironment(node) {
var kind = node.kind;
- return kind === 157
- || kind === 196
- || kind === 239
+ return kind === 158
|| kind === 197
- || kind === 156
- || kind === 158
+ || kind === 240
+ || kind === 198
+ || kind === 157
|| kind === 159
- || kind === 244
- || kind === 284;
+ || kind === 160
+ || kind === 245
+ || kind === 285;
}
ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment;
function nodeIsSynthesized(range) {
@@ -8474,38 +8636,38 @@
ts.getOriginalSourceFile = getOriginalSourceFile;
function getExpressionAssociativity(expression) {
var operator = getOperator(expression);
- var hasArguments = expression.kind === 192 && expression.arguments !== undefined;
+ var hasArguments = expression.kind === 193 && expression.arguments !== undefined;
return getOperatorAssociativity(expression.kind, operator, hasArguments);
}
ts.getExpressionAssociativity = getExpressionAssociativity;
function getOperatorAssociativity(kind, operator, hasArguments) {
switch (kind) {
- case 192:
+ case 193:
return hasArguments ? 0 : 1;
- case 202:
- case 199:
+ case 203:
case 200:
- case 198:
case 201:
- case 205:
- case 207:
+ case 199:
+ case 202:
+ case 206:
+ case 208:
return 1;
- case 204:
+ case 205:
switch (operator) {
case 41:
- case 59:
case 60:
case 61:
- case 63:
case 62:
case 64:
+ case 63:
case 65:
case 66:
case 67:
case 68:
case 69:
- case 71:
case 70:
+ case 72:
+ case 71:
return 1;
}
}
@@ -8514,15 +8676,15 @@
ts.getOperatorAssociativity = getOperatorAssociativity;
function getExpressionPrecedence(expression) {
var operator = getOperator(expression);
- var hasArguments = expression.kind === 192 && expression.arguments !== undefined;
+ var hasArguments = expression.kind === 193 && expression.arguments !== undefined;
return getOperatorPrecedence(expression.kind, operator, hasArguments);
}
ts.getExpressionPrecedence = getExpressionPrecedence;
function getOperator(expression) {
- if (expression.kind === 204) {
+ if (expression.kind === 205) {
return expression.operatorToken.kind;
}
- else if (expression.kind === 202 || expression.kind === 203) {
+ else if (expression.kind === 203 || expression.kind === 204) {
return expression.operator;
}
else {
@@ -8532,73 +8694,73 @@
ts.getOperator = getOperator;
function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
switch (nodeKind) {
- case 314:
+ case 315:
return 0;
- case 208:
+ case 209:
return 1;
- case 207:
+ case 208:
return 2;
- case 205:
+ case 206:
return 4;
- case 204:
+ case 205:
switch (operatorKind) {
case 27:
return 0;
- case 59:
case 60:
case 61:
- case 63:
case 62:
case 64:
+ case 63:
case 65:
case 66:
case 67:
case 68:
case 69:
- case 71:
case 70:
+ case 72:
+ case 71:
return 3;
default:
return getBinaryOperatorPrecedence(operatorKind);
}
- case 202:
- case 199:
+ case 203:
case 200:
- case 198:
case 201:
+ case 199:
+ case 202:
return 16;
- case 203:
+ case 204:
return 17;
- case 191:
- return 18;
case 192:
- return hasArguments ? 19 : 18;
+ return 18;
case 193:
- case 189:
+ return hasArguments ? 19 : 18;
+ case 194:
case 190:
+ case 191:
return 19;
- case 100:
- case 98:
- case 72:
- case 96:
- case 102:
- case 87:
+ case 101:
+ case 99:
+ case 73:
+ case 97:
+ case 103:
+ case 88:
case 8:
case 9:
case 10:
- case 187:
case 188:
- case 196:
+ case 189:
case 197:
- case 209:
- case 260:
+ case 198:
+ case 210:
case 261:
- case 264:
+ case 262:
+ case 265:
case 13:
case 14:
- case 206:
- case 195:
- case 210:
+ case 207:
+ case 196:
+ case 211:
return 20;
default:
return -1;
@@ -8626,9 +8788,9 @@
case 30:
case 31:
case 32:
+ case 95:
case 94:
- case 93:
- case 119:
+ case 120:
return 11;
case 46:
case 47:
@@ -9057,11 +9219,11 @@
}
ts.parameterIsThisKeyword = parameterIsThisKeyword;
function isThisIdentifier(node) {
- return !!node && node.kind === 72 && identifierIsThisKeyword(node);
+ return !!node && node.kind === 73 && identifierIsThisKeyword(node);
}
ts.isThisIdentifier = isThisIdentifier;
function identifierIsThisKeyword(id) {
- return id.originalKeywordKind === 100;
+ return id.originalKeywordKind === 101;
}
ts.identifierIsThisKeyword = identifierIsThisKeyword;
function getAllAccessorDeclarations(declarations, accessor) {
@@ -9071,10 +9233,10 @@
var setAccessor;
if (hasDynamicName(accessor)) {
firstAccessor = accessor;
- if (accessor.kind === 158) {
+ if (accessor.kind === 159) {
getAccessor = accessor;
}
- else if (accessor.kind === 159) {
+ else if (accessor.kind === 160) {
setAccessor = accessor;
}
else {
@@ -9094,10 +9256,10 @@
else if (!secondAccessor) {
secondAccessor = member;
}
- if (member.kind === 158 && !getAccessor) {
+ if (member.kind === 159 && !getAccessor) {
getAccessor = member;
}
- if (member.kind === 159 && !setAccessor) {
+ if (member.kind === 160 && !setAccessor) {
setAccessor = member;
}
}
@@ -9134,7 +9296,7 @@
}
ts.getJSDocTypeParameterDeclarations = getJSDocTypeParameterDeclarations;
function isNonTypeAliasTemplate(tag) {
- return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 296 && tag.parent.tags.some(isJSDocTypeAlias));
+ return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 297 && tag.parent.tags.some(isJSDocTypeAlias));
}
function getEffectiveSetAccessorTypeAnnotationNode(node) {
var parameter = getSetAccessorValueParameter(node);
@@ -9326,7 +9488,7 @@
flags |= modifierToFlag(modifier.kind);
}
}
- if (node.flags & 4 || (node.kind === 72 && node.isInJSDocNamespace)) {
+ if (node.flags & 4 || (node.kind === 73 && node.isInJSDocNamespace)) {
flags |= 1;
}
return flags;
@@ -9334,17 +9496,17 @@
ts.getModifierFlagsNoCache = getModifierFlagsNoCache;
function modifierToFlag(token) {
switch (token) {
- case 116: return 32;
- case 115: return 4;
- case 114: return 16;
- case 113: return 8;
- case 118: return 128;
- case 85: return 1;
- case 125: return 2;
- case 77: return 2048;
- case 80: return 512;
- case 121: return 256;
- case 133: return 64;
+ case 117: return 32;
+ case 116: return 4;
+ case 115: return 16;
+ case 114: return 8;
+ case 119: return 128;
+ case 86: return 1;
+ case 126: return 2;
+ case 78: return 2048;
+ case 81: return 512;
+ case 122: return 256;
+ case 134: return 64;
}
return 0;
}
@@ -9356,7 +9518,7 @@
}
ts.isLogicalOperator = isLogicalOperator;
function isAssignmentOperator(token) {
- return token >= 59 && token <= 71;
+ return token >= 60 && token <= 72;
}
ts.isAssignmentOperator = isAssignmentOperator;
function tryGetClassExtendingExpressionWithTypeArguments(node) {
@@ -9368,14 +9530,14 @@
return ts.isExpressionWithTypeArguments(node)
&& ts.isHeritageClause(node.parent)
&& ts.isClassLike(node.parent.parent)
- ? { class: node.parent.parent, isImplements: node.parent.token === 109 }
+ ? { class: node.parent.parent, isImplements: node.parent.token === 110 }
: undefined;
}
ts.tryGetClassImplementingOrExtendingExpressionWithTypeArguments = tryGetClassImplementingOrExtendingExpressionWithTypeArguments;
function isAssignmentExpression(node, excludeCompoundAssignment) {
return ts.isBinaryExpression(node)
&& (excludeCompoundAssignment
- ? node.operatorToken.kind === 59
+ ? node.operatorToken.kind === 60
: isAssignmentOperator(node.operatorToken.kind))
&& ts.isLeftHandSideExpression(node.left);
}
@@ -9383,8 +9545,8 @@
function isDestructuringAssignment(node) {
if (isAssignmentExpression(node, true)) {
var kind = node.left.kind;
- return kind === 188
- || kind === 187;
+ return kind === 189
+ || kind === 188;
}
return false;
}
@@ -9394,29 +9556,39 @@
}
ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause;
function isEntityNameExpression(node) {
- return node.kind === 72 || isPropertyAccessEntityNameExpression(node);
+ return node.kind === 73 || isPropertyAccessEntityNameExpression(node);
}
ts.isEntityNameExpression = isEntityNameExpression;
function isPropertyAccessEntityNameExpression(node) {
return ts.isPropertyAccessExpression(node) && isEntityNameExpression(node.expression);
}
ts.isPropertyAccessEntityNameExpression = isPropertyAccessEntityNameExpression;
+ function tryGetPropertyAccessOrIdentifierToString(expr) {
+ if (ts.isPropertyAccessExpression(expr)) {
+ return tryGetPropertyAccessOrIdentifierToString(expr.expression) + "." + expr.name;
+ }
+ if (ts.isIdentifier(expr)) {
+ return ts.unescapeLeadingUnderscores(expr.escapedText);
+ }
+ return undefined;
+ }
+ ts.tryGetPropertyAccessOrIdentifierToString = tryGetPropertyAccessOrIdentifierToString;
function isPrototypeAccess(node) {
return ts.isPropertyAccessExpression(node) && node.name.escapedText === "prototype";
}
ts.isPrototypeAccess = isPrototypeAccess;
function isRightSideOfQualifiedNameOrPropertyAccess(node) {
- return (node.parent.kind === 148 && node.parent.right === node) ||
- (node.parent.kind === 189 && node.parent.name === node);
+ return (node.parent.kind === 149 && node.parent.right === node) ||
+ (node.parent.kind === 190 && node.parent.name === node);
}
ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess;
function isEmptyObjectLiteral(expression) {
- return expression.kind === 188 &&
+ return expression.kind === 189 &&
expression.properties.length === 0;
}
ts.isEmptyObjectLiteral = isEmptyObjectLiteral;
function isEmptyArrayLiteral(expression) {
- return expression.kind === 187 &&
+ return expression.kind === 188 &&
expression.elements.length === 0;
}
ts.isEmptyArrayLiteral = isEmptyArrayLiteral;
@@ -9583,74 +9755,6 @@
return getNewLine ? getNewLine() : ts.sys ? ts.sys.newLine : carriageReturnLineFeed;
}
ts.getNewLineCharacter = getNewLineCharacter;
- function formatEnum(value, enumObject, isFlags) {
- if (value === void 0) { value = 0; }
- var members = getEnumMembers(enumObject);
- if (value === 0) {
- return members.length > 0 && members[0][0] === 0 ? members[0][1] : "0";
- }
- if (isFlags) {
- var result = "";
- var remainingFlags = value;
- for (var i = members.length - 1; i >= 0 && remainingFlags !== 0; i--) {
- var _a = members[i], enumValue = _a[0], enumName = _a[1];
- if (enumValue !== 0 && (remainingFlags & enumValue) === enumValue) {
- remainingFlags &= ~enumValue;
- result = "" + enumName + (result ? ", " : "") + result;
- }
- }
- if (remainingFlags === 0) {
- return result;
- }
- }
- else {
- for (var _i = 0, members_1 = members; _i < members_1.length; _i++) {
- var _b = members_1[_i], enumValue = _b[0], enumName = _b[1];
- if (enumValue === value) {
- return enumName;
- }
- }
- }
- return value.toString();
- }
- function getEnumMembers(enumObject) {
- var result = [];
- for (var name in enumObject) {
- var value = enumObject[name];
- if (typeof value === "number") {
- result.push([value, name]);
- }
- }
- return ts.stableSort(result, function (x, y) { return ts.compareValues(x[0], y[0]); });
- }
- function formatSyntaxKind(kind) {
- return formatEnum(kind, ts.SyntaxKind, false);
- }
- ts.formatSyntaxKind = formatSyntaxKind;
- function formatModifierFlags(flags) {
- return formatEnum(flags, ts.ModifierFlags, true);
- }
- ts.formatModifierFlags = formatModifierFlags;
- function formatTransformFlags(flags) {
- return formatEnum(flags, ts.TransformFlags, true);
- }
- ts.formatTransformFlags = formatTransformFlags;
- function formatEmitFlags(flags) {
- return formatEnum(flags, ts.EmitFlags, true);
- }
- ts.formatEmitFlags = formatEmitFlags;
- function formatSymbolFlags(flags) {
- return formatEnum(flags, ts.SymbolFlags, true);
- }
- ts.formatSymbolFlags = formatSymbolFlags;
- function formatTypeFlags(flags) {
- return formatEnum(flags, ts.TypeFlags, true);
- }
- ts.formatTypeFlags = formatTypeFlags;
- function formatObjectFlags(flags) {
- return formatEnum(flags, ts.ObjectFlags, true);
- }
- ts.formatObjectFlags = formatObjectFlags;
function createRange(pos, end) {
if (end === void 0) { end = pos; }
ts.Debug.assert(end >= pos || end === -1);
@@ -9705,6 +9809,10 @@
return positionsAreOnSameLine(range1.end, getStartPositionOfRange(range2, sourceFile), sourceFile);
}
ts.rangeEndIsOnSameLineAsRangeStart = rangeEndIsOnSameLineAsRangeStart;
+ function isNodeArrayMultiLine(list, sourceFile) {
+ return !positionsAreOnSameLine(list.pos, list.end, sourceFile);
+ }
+ ts.isNodeArrayMultiLine = isNodeArrayMultiLine;
function positionsAreOnSameLine(pos1, pos2, sourceFile) {
return pos1 === pos2 ||
getLineOfLocalPosition(sourceFile, pos1) === getLineOfLocalPosition(sourceFile, pos2);
@@ -9718,8 +9826,8 @@
var parseNode = ts.getParseTreeNode(node);
if (parseNode) {
switch (parseNode.parent.kind) {
- case 243:
case 244:
+ case 245:
return parseNode === parseNode.parent.name;
}
}
@@ -9752,10 +9860,10 @@
}
if (getCheckFlags(s) & 6) {
var checkFlags = s.checkFlags;
- var accessModifier = checkFlags & 512 ? 8 :
- checkFlags & 128 ? 4 :
+ var accessModifier = checkFlags & 1024 ? 8 :
+ checkFlags & 256 ? 4 :
16;
- var staticModifier = checkFlags & 1024 ? 32 : 0;
+ var staticModifier = checkFlags & 2048 ? 32 : 0;
return accessModifier | staticModifier;
}
if (s.flags & 4194304) {
@@ -9785,32 +9893,32 @@
if (!parent)
return 0;
switch (parent.kind) {
- case 195:
+ case 196:
return accessKind(parent);
+ case 204:
case 203:
- case 202:
var operator = parent.operator;
return operator === 44 || operator === 45 ? writeOrReadWrite() : 0;
- case 204:
+ case 205:
var _a = parent, left = _a.left, operatorToken = _a.operatorToken;
return left === node && isAssignmentOperator(operatorToken.kind) ?
- operatorToken.kind === 59 ? 1 : writeOrReadWrite()
+ operatorToken.kind === 60 ? 1 : writeOrReadWrite()
: 0;
- case 189:
+ case 190:
return parent.name !== node ? 0 : accessKind(parent);
- case 275: {
+ case 276: {
var parentAccess = accessKind(parent.parent);
return node === parent.name ? reverseAccessKind(parentAccess) : parentAccess;
}
- case 276:
+ case 277:
return node === parent.objectAssignmentInitializer ? 0 : accessKind(parent.parent);
- case 187:
+ case 188:
return accessKind(parent);
default:
return 0;
}
function writeOrReadWrite() {
- return parent.parent && skipParenthesesUp(parent.parent).kind === 221 ? 1 : 2;
+ return parent.parent && skipParenthesesUp(parent.parent).kind === 222 ? 1 : 2;
}
}
function reverseAccessKind(a) {
@@ -9950,32 +10058,32 @@
}
ts.isObjectTypeDeclaration = isObjectTypeDeclaration;
function isTypeNodeKind(kind) {
- return (kind >= 163 && kind <= 183)
- || kind === 120
- || kind === 143
- || kind === 135
- || kind === 146
+ return (kind >= 164 && kind <= 184)
+ || kind === 121
+ || kind === 144
|| kind === 136
- || kind === 123
- || kind === 138
+ || kind === 147
+ || kind === 137
+ || kind === 124
|| kind === 139
- || kind === 100
- || kind === 106
- || kind === 141
- || kind === 96
- || kind === 132
- || kind === 211
- || kind === 289
+ || kind === 140
+ || kind === 101
+ || kind === 107
+ || kind === 142
+ || kind === 97
+ || kind === 133
+ || kind === 212
|| kind === 290
|| kind === 291
|| kind === 292
|| kind === 293
|| kind === 294
- || kind === 295;
+ || kind === 295
+ || kind === 296;
}
ts.isTypeNodeKind = isTypeNodeKind;
function isAccessExpression(node) {
- return node.kind === 189 || node.kind === 190;
+ return node.kind === 190 || node.kind === 191;
}
ts.isAccessExpression = isAccessExpression;
function isBundleFileTextLike(section) {
@@ -9992,8 +10100,10 @@
(function (ts) {
function getDefaultLibFileName(options) {
switch (options.target) {
- case 7:
+ case 8:
return "lib.esnext.full.d.ts";
+ case 7:
+ return "lib.es2020.full.d.ts";
case 6:
return "lib.es2019.full.d.ts";
case 5:
@@ -10119,9 +10229,9 @@
}
ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions;
function getTypeParameterOwner(d) {
- if (d && d.kind === 150) {
+ if (d && d.kind === 151) {
for (var current = d; current; current = current.parent) {
- if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 241) {
+ if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 242) {
return current;
}
}
@@ -10129,7 +10239,7 @@
}
ts.getTypeParameterOwner = getTypeParameterOwner;
function isParameterPropertyDeclaration(node) {
- return ts.hasModifier(node, 92) && node.parent.kind === 157;
+ return ts.hasModifier(node, 92) && node.parent.kind === 158;
}
ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration;
function isEmptyBindingPattern(node) {
@@ -10159,14 +10269,14 @@
node = walkUpBindingElementsAndPatterns(node);
}
var flags = getFlags(node);
- if (node.kind === 237) {
+ if (node.kind === 238) {
node = node.parent;
}
- if (node && node.kind === 238) {
+ if (node && node.kind === 239) {
flags |= getFlags(node);
node = node.parent;
}
- if (node && node.kind === 219) {
+ if (node && node.kind === 220) {
flags |= getFlags(node);
}
return flags;
@@ -10277,27 +10387,27 @@
return getDeclarationIdentifier(hostNode);
}
switch (hostNode.kind) {
- case 219:
+ case 220:
if (hostNode.declarationList && hostNode.declarationList.declarations[0]) {
return getDeclarationIdentifier(hostNode.declarationList.declarations[0]);
}
break;
- case 221:
+ case 222:
var expr = hostNode.expression;
switch (expr.kind) {
- case 189:
- return expr.name;
case 190:
+ return expr.name;
+ case 191:
var arg = expr.argumentExpression;
if (ts.isIdentifier(arg)) {
return arg;
}
}
break;
- case 195: {
+ case 196: {
return getDeclarationIdentifier(hostNode.expression);
}
- case 233: {
+ case 234: {
if (ts.isDeclaration(hostNode.statement) || ts.isExpression(hostNode.statement)) {
return getDeclarationIdentifier(hostNode.statement);
}
@@ -10319,18 +10429,18 @@
ts.isNamedDeclaration = isNamedDeclaration;
function getNonAssignedNameOfDeclaration(declaration) {
switch (declaration.kind) {
- case 72:
+ case 73:
return declaration;
- case 310:
- case 304: {
+ case 311:
+ case 305: {
var name = declaration.name;
- if (name.kind === 148) {
+ if (name.kind === 149) {
return name.right;
}
break;
}
- case 191:
- case 204: {
+ case 192:
+ case 205: {
var expr = declaration;
switch (ts.getAssignmentDeclarationKind(expr)) {
case 1:
@@ -10346,9 +10456,9 @@
return undefined;
}
}
- case 309:
+ case 310:
return getNameOfJSDocTypedef(declaration);
- case 254: {
+ case 255: {
var expression = declaration.expression;
return ts.isIdentifier(expression) ? expression : undefined;
}
@@ -10488,7 +10598,7 @@
return ts.emptyArray;
}
if (ts.isJSDocTypeAlias(node)) {
- ts.Debug.assert(node.parent.kind === 296);
+ ts.Debug.assert(node.parent.kind === 297);
return ts.flatMap(node.parent.tags, function (tag) { return ts.isJSDocTemplateTag(tag) ? tag.typeParameters : undefined; });
}
if (node.typeParameters) {
@@ -10553,191 +10663,191 @@
}
ts.isTemplateTail = isTemplateTail;
function isIdentifier(node) {
- return node.kind === 72;
+ return node.kind === 73;
}
ts.isIdentifier = isIdentifier;
function isQualifiedName(node) {
- return node.kind === 148;
+ return node.kind === 149;
}
ts.isQualifiedName = isQualifiedName;
function isComputedPropertyName(node) {
- return node.kind === 149;
+ return node.kind === 150;
}
ts.isComputedPropertyName = isComputedPropertyName;
function isTypeParameterDeclaration(node) {
- return node.kind === 150;
+ return node.kind === 151;
}
ts.isTypeParameterDeclaration = isTypeParameterDeclaration;
function isParameter(node) {
- return node.kind === 151;
+ return node.kind === 152;
}
ts.isParameter = isParameter;
function isDecorator(node) {
- return node.kind === 152;
+ return node.kind === 153;
}
ts.isDecorator = isDecorator;
function isPropertySignature(node) {
- return node.kind === 153;
+ return node.kind === 154;
}
ts.isPropertySignature = isPropertySignature;
function isPropertyDeclaration(node) {
- return node.kind === 154;
+ return node.kind === 155;
}
ts.isPropertyDeclaration = isPropertyDeclaration;
function isMethodSignature(node) {
- return node.kind === 155;
+ return node.kind === 156;
}
ts.isMethodSignature = isMethodSignature;
function isMethodDeclaration(node) {
- return node.kind === 156;
+ return node.kind === 157;
}
ts.isMethodDeclaration = isMethodDeclaration;
function isConstructorDeclaration(node) {
- return node.kind === 157;
+ return node.kind === 158;
}
ts.isConstructorDeclaration = isConstructorDeclaration;
function isGetAccessorDeclaration(node) {
- return node.kind === 158;
+ return node.kind === 159;
}
ts.isGetAccessorDeclaration = isGetAccessorDeclaration;
function isSetAccessorDeclaration(node) {
- return node.kind === 159;
+ return node.kind === 160;
}
ts.isSetAccessorDeclaration = isSetAccessorDeclaration;
function isCallSignatureDeclaration(node) {
- return node.kind === 160;
+ return node.kind === 161;
}
ts.isCallSignatureDeclaration = isCallSignatureDeclaration;
function isConstructSignatureDeclaration(node) {
- return node.kind === 161;
+ return node.kind === 162;
}
ts.isConstructSignatureDeclaration = isConstructSignatureDeclaration;
function isIndexSignatureDeclaration(node) {
- return node.kind === 162;
+ return node.kind === 163;
}
ts.isIndexSignatureDeclaration = isIndexSignatureDeclaration;
function isGetOrSetAccessorDeclaration(node) {
- return node.kind === 159 || node.kind === 158;
+ return node.kind === 160 || node.kind === 159;
}
ts.isGetOrSetAccessorDeclaration = isGetOrSetAccessorDeclaration;
function isTypePredicateNode(node) {
- return node.kind === 163;
+ return node.kind === 164;
}
ts.isTypePredicateNode = isTypePredicateNode;
function isTypeReferenceNode(node) {
- return node.kind === 164;
+ return node.kind === 165;
}
ts.isTypeReferenceNode = isTypeReferenceNode;
function isFunctionTypeNode(node) {
- return node.kind === 165;
+ return node.kind === 166;
}
ts.isFunctionTypeNode = isFunctionTypeNode;
function isConstructorTypeNode(node) {
- return node.kind === 166;
+ return node.kind === 167;
}
ts.isConstructorTypeNode = isConstructorTypeNode;
function isTypeQueryNode(node) {
- return node.kind === 167;
+ return node.kind === 168;
}
ts.isTypeQueryNode = isTypeQueryNode;
function isTypeLiteralNode(node) {
- return node.kind === 168;
+ return node.kind === 169;
}
ts.isTypeLiteralNode = isTypeLiteralNode;
function isArrayTypeNode(node) {
- return node.kind === 169;
+ return node.kind === 170;
}
ts.isArrayTypeNode = isArrayTypeNode;
function isTupleTypeNode(node) {
- return node.kind === 170;
+ return node.kind === 171;
}
ts.isTupleTypeNode = isTupleTypeNode;
function isUnionTypeNode(node) {
- return node.kind === 173;
+ return node.kind === 174;
}
ts.isUnionTypeNode = isUnionTypeNode;
function isIntersectionTypeNode(node) {
- return node.kind === 174;
+ return node.kind === 175;
}
ts.isIntersectionTypeNode = isIntersectionTypeNode;
function isConditionalTypeNode(node) {
- return node.kind === 175;
+ return node.kind === 176;
}
ts.isConditionalTypeNode = isConditionalTypeNode;
function isInferTypeNode(node) {
- return node.kind === 176;
+ return node.kind === 177;
}
ts.isInferTypeNode = isInferTypeNode;
function isParenthesizedTypeNode(node) {
- return node.kind === 177;
+ return node.kind === 178;
}
ts.isParenthesizedTypeNode = isParenthesizedTypeNode;
function isThisTypeNode(node) {
- return node.kind === 178;
+ return node.kind === 179;
}
ts.isThisTypeNode = isThisTypeNode;
function isTypeOperatorNode(node) {
- return node.kind === 179;
+ return node.kind === 180;
}
ts.isTypeOperatorNode = isTypeOperatorNode;
function isIndexedAccessTypeNode(node) {
- return node.kind === 180;
+ return node.kind === 181;
}
ts.isIndexedAccessTypeNode = isIndexedAccessTypeNode;
function isMappedTypeNode(node) {
- return node.kind === 181;
+ return node.kind === 182;
}
ts.isMappedTypeNode = isMappedTypeNode;
function isLiteralTypeNode(node) {
- return node.kind === 182;
+ return node.kind === 183;
}
ts.isLiteralTypeNode = isLiteralTypeNode;
function isImportTypeNode(node) {
- return node.kind === 183;
+ return node.kind === 184;
}
ts.isImportTypeNode = isImportTypeNode;
function isObjectBindingPattern(node) {
- return node.kind === 184;
+ return node.kind === 185;
}
ts.isObjectBindingPattern = isObjectBindingPattern;
function isArrayBindingPattern(node) {
- return node.kind === 185;
+ return node.kind === 186;
}
ts.isArrayBindingPattern = isArrayBindingPattern;
function isBindingElement(node) {
- return node.kind === 186;
+ return node.kind === 187;
}
ts.isBindingElement = isBindingElement;
function isArrayLiteralExpression(node) {
- return node.kind === 187;
+ return node.kind === 188;
}
ts.isArrayLiteralExpression = isArrayLiteralExpression;
function isObjectLiteralExpression(node) {
- return node.kind === 188;
+ return node.kind === 189;
}
ts.isObjectLiteralExpression = isObjectLiteralExpression;
function isPropertyAccessExpression(node) {
- return node.kind === 189;
+ return node.kind === 190;
}
ts.isPropertyAccessExpression = isPropertyAccessExpression;
function isElementAccessExpression(node) {
- return node.kind === 190;
+ return node.kind === 191;
}
ts.isElementAccessExpression = isElementAccessExpression;
function isCallExpression(node) {
- return node.kind === 191;
+ return node.kind === 192;
}
ts.isCallExpression = isCallExpression;
function isNewExpression(node) {
- return node.kind === 192;
+ return node.kind === 193;
}
ts.isNewExpression = isNewExpression;
function isTaggedTemplateExpression(node) {
- return node.kind === 193;
+ return node.kind === 194;
}
ts.isTaggedTemplateExpression = isTaggedTemplateExpression;
function isTypeAssertion(node) {
- return node.kind === 194;
+ return node.kind === 195;
}
ts.isTypeAssertion = isTypeAssertion;
function isConstTypeReference(node) {
@@ -10746,368 +10856,368 @@
}
ts.isConstTypeReference = isConstTypeReference;
function isParenthesizedExpression(node) {
- return node.kind === 195;
+ return node.kind === 196;
}
ts.isParenthesizedExpression = isParenthesizedExpression;
function skipPartiallyEmittedExpressions(node) {
- while (node.kind === 313) {
+ while (node.kind === 314) {
node = node.expression;
}
return node;
}
ts.skipPartiallyEmittedExpressions = skipPartiallyEmittedExpressions;
function isFunctionExpression(node) {
- return node.kind === 196;
+ return node.kind === 197;
}
ts.isFunctionExpression = isFunctionExpression;
function isArrowFunction(node) {
- return node.kind === 197;
+ return node.kind === 198;
}
ts.isArrowFunction = isArrowFunction;
function isDeleteExpression(node) {
- return node.kind === 198;
+ return node.kind === 199;
}
ts.isDeleteExpression = isDeleteExpression;
function isTypeOfExpression(node) {
- return node.kind === 199;
+ return node.kind === 200;
}
ts.isTypeOfExpression = isTypeOfExpression;
function isVoidExpression(node) {
- return node.kind === 200;
+ return node.kind === 201;
}
ts.isVoidExpression = isVoidExpression;
function isAwaitExpression(node) {
- return node.kind === 201;
+ return node.kind === 202;
}
ts.isAwaitExpression = isAwaitExpression;
function isPrefixUnaryExpression(node) {
- return node.kind === 202;
+ return node.kind === 203;
}
ts.isPrefixUnaryExpression = isPrefixUnaryExpression;
function isPostfixUnaryExpression(node) {
- return node.kind === 203;
+ return node.kind === 204;
}
ts.isPostfixUnaryExpression = isPostfixUnaryExpression;
function isBinaryExpression(node) {
- return node.kind === 204;
+ return node.kind === 205;
}
ts.isBinaryExpression = isBinaryExpression;
function isConditionalExpression(node) {
- return node.kind === 205;
+ return node.kind === 206;
}
ts.isConditionalExpression = isConditionalExpression;
function isTemplateExpression(node) {
- return node.kind === 206;
+ return node.kind === 207;
}
ts.isTemplateExpression = isTemplateExpression;
function isYieldExpression(node) {
- return node.kind === 207;
+ return node.kind === 208;
}
ts.isYieldExpression = isYieldExpression;
function isSpreadElement(node) {
- return node.kind === 208;
+ return node.kind === 209;
}
ts.isSpreadElement = isSpreadElement;
function isClassExpression(node) {
- return node.kind === 209;
+ return node.kind === 210;
}
ts.isClassExpression = isClassExpression;
function isOmittedExpression(node) {
- return node.kind === 210;
+ return node.kind === 211;
}
ts.isOmittedExpression = isOmittedExpression;
function isExpressionWithTypeArguments(node) {
- return node.kind === 211;
+ return node.kind === 212;
}
ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments;
function isAsExpression(node) {
- return node.kind === 212;
+ return node.kind === 213;
}
ts.isAsExpression = isAsExpression;
function isNonNullExpression(node) {
- return node.kind === 213;
+ return node.kind === 214;
}
ts.isNonNullExpression = isNonNullExpression;
function isMetaProperty(node) {
- return node.kind === 214;
+ return node.kind === 215;
}
ts.isMetaProperty = isMetaProperty;
function isTemplateSpan(node) {
- return node.kind === 216;
+ return node.kind === 217;
}
ts.isTemplateSpan = isTemplateSpan;
function isSemicolonClassElement(node) {
- return node.kind === 217;
+ return node.kind === 218;
}
ts.isSemicolonClassElement = isSemicolonClassElement;
function isBlock(node) {
- return node.kind === 218;
+ return node.kind === 219;
}
ts.isBlock = isBlock;
function isVariableStatement(node) {
- return node.kind === 219;
+ return node.kind === 220;
}
ts.isVariableStatement = isVariableStatement;
function isEmptyStatement(node) {
- return node.kind === 220;
+ return node.kind === 221;
}
ts.isEmptyStatement = isEmptyStatement;
function isExpressionStatement(node) {
- return node.kind === 221;
+ return node.kind === 222;
}
ts.isExpressionStatement = isExpressionStatement;
function isIfStatement(node) {
- return node.kind === 222;
+ return node.kind === 223;
}
ts.isIfStatement = isIfStatement;
function isDoStatement(node) {
- return node.kind === 223;
+ return node.kind === 224;
}
ts.isDoStatement = isDoStatement;
function isWhileStatement(node) {
- return node.kind === 224;
+ return node.kind === 225;
}
ts.isWhileStatement = isWhileStatement;
function isForStatement(node) {
- return node.kind === 225;
+ return node.kind === 226;
}
ts.isForStatement = isForStatement;
function isForInStatement(node) {
- return node.kind === 226;
+ return node.kind === 227;
}
ts.isForInStatement = isForInStatement;
function isForOfStatement(node) {
- return node.kind === 227;
+ return node.kind === 228;
}
ts.isForOfStatement = isForOfStatement;
function isContinueStatement(node) {
- return node.kind === 228;
+ return node.kind === 229;
}
ts.isContinueStatement = isContinueStatement;
function isBreakStatement(node) {
- return node.kind === 229;
+ return node.kind === 230;
}
ts.isBreakStatement = isBreakStatement;
function isBreakOrContinueStatement(node) {
- return node.kind === 229 || node.kind === 228;
+ return node.kind === 230 || node.kind === 229;
}
ts.isBreakOrContinueStatement = isBreakOrContinueStatement;
function isReturnStatement(node) {
- return node.kind === 230;
+ return node.kind === 231;
}
ts.isReturnStatement = isReturnStatement;
function isWithStatement(node) {
- return node.kind === 231;
+ return node.kind === 232;
}
ts.isWithStatement = isWithStatement;
function isSwitchStatement(node) {
- return node.kind === 232;
+ return node.kind === 233;
}
ts.isSwitchStatement = isSwitchStatement;
function isLabeledStatement(node) {
- return node.kind === 233;
+ return node.kind === 234;
}
ts.isLabeledStatement = isLabeledStatement;
function isThrowStatement(node) {
- return node.kind === 234;
+ return node.kind === 235;
}
ts.isThrowStatement = isThrowStatement;
function isTryStatement(node) {
- return node.kind === 235;
+ return node.kind === 236;
}
ts.isTryStatement = isTryStatement;
function isDebuggerStatement(node) {
- return node.kind === 236;
+ return node.kind === 237;
}
ts.isDebuggerStatement = isDebuggerStatement;
function isVariableDeclaration(node) {
- return node.kind === 237;
+ return node.kind === 238;
}
ts.isVariableDeclaration = isVariableDeclaration;
function isVariableDeclarationList(node) {
- return node.kind === 238;
+ return node.kind === 239;
}
ts.isVariableDeclarationList = isVariableDeclarationList;
function isFunctionDeclaration(node) {
- return node.kind === 239;
+ return node.kind === 240;
}
ts.isFunctionDeclaration = isFunctionDeclaration;
function isClassDeclaration(node) {
- return node.kind === 240;
+ return node.kind === 241;
}
ts.isClassDeclaration = isClassDeclaration;
function isInterfaceDeclaration(node) {
- return node.kind === 241;
+ return node.kind === 242;
}
ts.isInterfaceDeclaration = isInterfaceDeclaration;
function isTypeAliasDeclaration(node) {
- return node.kind === 242;
+ return node.kind === 243;
}
ts.isTypeAliasDeclaration = isTypeAliasDeclaration;
function isEnumDeclaration(node) {
- return node.kind === 243;
+ return node.kind === 244;
}
ts.isEnumDeclaration = isEnumDeclaration;
function isModuleDeclaration(node) {
- return node.kind === 244;
+ return node.kind === 245;
}
ts.isModuleDeclaration = isModuleDeclaration;
function isModuleBlock(node) {
- return node.kind === 245;
+ return node.kind === 246;
}
ts.isModuleBlock = isModuleBlock;
function isCaseBlock(node) {
- return node.kind === 246;
+ return node.kind === 247;
}
ts.isCaseBlock = isCaseBlock;
function isNamespaceExportDeclaration(node) {
- return node.kind === 247;
+ return node.kind === 248;
}
ts.isNamespaceExportDeclaration = isNamespaceExportDeclaration;
function isImportEqualsDeclaration(node) {
- return node.kind === 248;
+ return node.kind === 249;
}
ts.isImportEqualsDeclaration = isImportEqualsDeclaration;
function isImportDeclaration(node) {
- return node.kind === 249;
+ return node.kind === 250;
}
ts.isImportDeclaration = isImportDeclaration;
function isImportClause(node) {
- return node.kind === 250;
+ return node.kind === 251;
}
ts.isImportClause = isImportClause;
function isNamespaceImport(node) {
- return node.kind === 251;
+ return node.kind === 252;
}
ts.isNamespaceImport = isNamespaceImport;
function isNamedImports(node) {
- return node.kind === 252;
+ return node.kind === 253;
}
ts.isNamedImports = isNamedImports;
function isImportSpecifier(node) {
- return node.kind === 253;
+ return node.kind === 254;
}
ts.isImportSpecifier = isImportSpecifier;
function isExportAssignment(node) {
- return node.kind === 254;
+ return node.kind === 255;
}
ts.isExportAssignment = isExportAssignment;
function isExportDeclaration(node) {
- return node.kind === 255;
+ return node.kind === 256;
}
ts.isExportDeclaration = isExportDeclaration;
function isNamedExports(node) {
- return node.kind === 256;
+ return node.kind === 257;
}
ts.isNamedExports = isNamedExports;
function isExportSpecifier(node) {
- return node.kind === 257;
+ return node.kind === 258;
}
ts.isExportSpecifier = isExportSpecifier;
function isMissingDeclaration(node) {
- return node.kind === 258;
+ return node.kind === 259;
}
ts.isMissingDeclaration = isMissingDeclaration;
function isExternalModuleReference(node) {
- return node.kind === 259;
+ return node.kind === 260;
}
ts.isExternalModuleReference = isExternalModuleReference;
function isJsxElement(node) {
- return node.kind === 260;
+ return node.kind === 261;
}
ts.isJsxElement = isJsxElement;
function isJsxSelfClosingElement(node) {
- return node.kind === 261;
+ return node.kind === 262;
}
ts.isJsxSelfClosingElement = isJsxSelfClosingElement;
function isJsxOpeningElement(node) {
- return node.kind === 262;
+ return node.kind === 263;
}
ts.isJsxOpeningElement = isJsxOpeningElement;
function isJsxClosingElement(node) {
- return node.kind === 263;
+ return node.kind === 264;
}
ts.isJsxClosingElement = isJsxClosingElement;
function isJsxFragment(node) {
- return node.kind === 264;
+ return node.kind === 265;
}
ts.isJsxFragment = isJsxFragment;
function isJsxOpeningFragment(node) {
- return node.kind === 265;
+ return node.kind === 266;
}
ts.isJsxOpeningFragment = isJsxOpeningFragment;
function isJsxClosingFragment(node) {
- return node.kind === 266;
+ return node.kind === 267;
}
ts.isJsxClosingFragment = isJsxClosingFragment;
function isJsxAttribute(node) {
- return node.kind === 267;
+ return node.kind === 268;
}
ts.isJsxAttribute = isJsxAttribute;
function isJsxAttributes(node) {
- return node.kind === 268;
+ return node.kind === 269;
}
ts.isJsxAttributes = isJsxAttributes;
function isJsxSpreadAttribute(node) {
- return node.kind === 269;
+ return node.kind === 270;
}
ts.isJsxSpreadAttribute = isJsxSpreadAttribute;
function isJsxExpression(node) {
- return node.kind === 270;
+ return node.kind === 271;
}
ts.isJsxExpression = isJsxExpression;
function isCaseClause(node) {
- return node.kind === 271;
+ return node.kind === 272;
}
ts.isCaseClause = isCaseClause;
function isDefaultClause(node) {
- return node.kind === 272;
+ return node.kind === 273;
}
ts.isDefaultClause = isDefaultClause;
function isHeritageClause(node) {
- return node.kind === 273;
+ return node.kind === 274;
}
ts.isHeritageClause = isHeritageClause;
function isCatchClause(node) {
- return node.kind === 274;
+ return node.kind === 275;
}
ts.isCatchClause = isCatchClause;
function isPropertyAssignment(node) {
- return node.kind === 275;
+ return node.kind === 276;
}
ts.isPropertyAssignment = isPropertyAssignment;
function isShorthandPropertyAssignment(node) {
- return node.kind === 276;
+ return node.kind === 277;
}
ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment;
function isSpreadAssignment(node) {
- return node.kind === 277;
+ return node.kind === 278;
}
ts.isSpreadAssignment = isSpreadAssignment;
function isEnumMember(node) {
- return node.kind === 278;
+ return node.kind === 279;
}
ts.isEnumMember = isEnumMember;
function isSourceFile(node) {
- return node.kind === 284;
+ return node.kind === 285;
}
ts.isSourceFile = isSourceFile;
function isBundle(node) {
- return node.kind === 285;
+ return node.kind === 286;
}
ts.isBundle = isBundle;
function isUnparsedSource(node) {
- return node.kind === 286;
+ return node.kind === 287;
}
ts.isUnparsedSource = isUnparsedSource;
function isUnparsedPrepend(node) {
- return node.kind === 280;
+ return node.kind === 281;
}
ts.isUnparsedPrepend = isUnparsedPrepend;
function isUnparsedTextLike(node) {
switch (node.kind) {
- case 281:
case 282:
+ case 283:
return true;
default:
return false;
@@ -11116,106 +11226,106 @@
ts.isUnparsedTextLike = isUnparsedTextLike;
function isUnparsedNode(node) {
return isUnparsedTextLike(node) ||
- node.kind === 279 ||
- node.kind === 283;
+ node.kind === 280 ||
+ node.kind === 284;
}
ts.isUnparsedNode = isUnparsedNode;
function isJSDocTypeExpression(node) {
- return node.kind === 288;
+ return node.kind === 289;
}
ts.isJSDocTypeExpression = isJSDocTypeExpression;
function isJSDocAllType(node) {
- return node.kind === 289;
+ return node.kind === 290;
}
ts.isJSDocAllType = isJSDocAllType;
function isJSDocUnknownType(node) {
- return node.kind === 290;
+ return node.kind === 291;
}
ts.isJSDocUnknownType = isJSDocUnknownType;
function isJSDocNullableType(node) {
- return node.kind === 291;
+ return node.kind === 292;
}
ts.isJSDocNullableType = isJSDocNullableType;
function isJSDocNonNullableType(node) {
- return node.kind === 292;
+ return node.kind === 293;
}
ts.isJSDocNonNullableType = isJSDocNonNullableType;
function isJSDocOptionalType(node) {
- return node.kind === 293;
+ return node.kind === 294;
}
ts.isJSDocOptionalType = isJSDocOptionalType;
function isJSDocFunctionType(node) {
- return node.kind === 294;
+ return node.kind === 295;
}
ts.isJSDocFunctionType = isJSDocFunctionType;
function isJSDocVariadicType(node) {
- return node.kind === 295;
+ return node.kind === 296;
}
ts.isJSDocVariadicType = isJSDocVariadicType;
function isJSDoc(node) {
- return node.kind === 296;
+ return node.kind === 297;
}
ts.isJSDoc = isJSDoc;
function isJSDocAugmentsTag(node) {
- return node.kind === 300;
+ return node.kind === 301;
}
ts.isJSDocAugmentsTag = isJSDocAugmentsTag;
function isJSDocClassTag(node) {
- return node.kind === 301;
+ return node.kind === 302;
}
ts.isJSDocClassTag = isJSDocClassTag;
function isJSDocEnumTag(node) {
- return node.kind === 303;
+ return node.kind === 304;
}
ts.isJSDocEnumTag = isJSDocEnumTag;
function isJSDocThisTag(node) {
- return node.kind === 306;
+ return node.kind === 307;
}
ts.isJSDocThisTag = isJSDocThisTag;
function isJSDocParameterTag(node) {
- return node.kind === 304;
+ return node.kind === 305;
}
ts.isJSDocParameterTag = isJSDocParameterTag;
function isJSDocReturnTag(node) {
- return node.kind === 305;
+ return node.kind === 306;
}
ts.isJSDocReturnTag = isJSDocReturnTag;
function isJSDocTypeTag(node) {
- return node.kind === 307;
+ return node.kind === 308;
}
ts.isJSDocTypeTag = isJSDocTypeTag;
function isJSDocTemplateTag(node) {
- return node.kind === 308;
+ return node.kind === 309;
}
ts.isJSDocTemplateTag = isJSDocTemplateTag;
function isJSDocTypedefTag(node) {
- return node.kind === 309;
+ return node.kind === 310;
}
ts.isJSDocTypedefTag = isJSDocTypedefTag;
function isJSDocPropertyTag(node) {
- return node.kind === 310;
+ return node.kind === 311;
}
ts.isJSDocPropertyTag = isJSDocPropertyTag;
function isJSDocPropertyLikeTag(node) {
- return node.kind === 310 || node.kind === 304;
+ return node.kind === 311 || node.kind === 305;
}
ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag;
function isJSDocTypeLiteral(node) {
- return node.kind === 297;
+ return node.kind === 298;
}
ts.isJSDocTypeLiteral = isJSDocTypeLiteral;
function isJSDocCallbackTag(node) {
- return node.kind === 302;
+ return node.kind === 303;
}
ts.isJSDocCallbackTag = isJSDocCallbackTag;
function isJSDocSignature(node) {
- return node.kind === 298;
+ return node.kind === 299;
}
ts.isJSDocSignature = isJSDocSignature;
})(ts || (ts = {}));
(function (ts) {
function isSyntaxList(n) {
- return n.kind === 311;
+ return n.kind === 312;
}
ts.isSyntaxList = isSyntaxList;
function isNode(node) {
@@ -11223,11 +11333,11 @@
}
ts.isNode = isNode;
function isNodeKind(kind) {
- return kind >= 148;
+ return kind >= 149;
}
ts.isNodeKind = isNodeKind;
function isToken(n) {
- return n.kind >= 0 && n.kind <= 147;
+ return n.kind >= 0 && n.kind <= 148;
}
ts.isToken = isToken;
function isNodeArray(array) {
@@ -11270,17 +11380,17 @@
ts.isGeneratedIdentifier = isGeneratedIdentifier;
function isModifierKind(token) {
switch (token) {
- case 118:
- case 121:
- case 77:
- case 125:
- case 80:
- case 85:
- case 115:
- case 113:
- case 114:
- case 133:
+ case 119:
+ case 122:
+ case 78:
+ case 126:
+ case 81:
+ case 86:
case 116:
+ case 114:
+ case 115:
+ case 134:
+ case 117:
return true;
}
return false;
@@ -11291,7 +11401,7 @@
}
ts.isParameterPropertyModifier = isParameterPropertyModifier;
function isClassMemberModifier(idToken) {
- return isParameterPropertyModifier(idToken) || idToken === 116;
+ return isParameterPropertyModifier(idToken) || idToken === 117;
}
ts.isClassMemberModifier = isClassMemberModifier;
function isModifier(node) {
@@ -11300,23 +11410,23 @@
ts.isModifier = isModifier;
function isEntityName(node) {
var kind = node.kind;
- return kind === 148
- || kind === 72;
+ return kind === 149
+ || kind === 73;
}
ts.isEntityName = isEntityName;
function isPropertyName(node) {
var kind = node.kind;
- return kind === 72
+ return kind === 73
|| kind === 10
|| kind === 8
- || kind === 149;
+ || kind === 150;
}
ts.isPropertyName = isPropertyName;
function isBindingName(node) {
var kind = node.kind;
- return kind === 72
- || kind === 184
- || kind === 185;
+ return kind === 73
+ || kind === 185
+ || kind === 186;
}
ts.isBindingName = isBindingName;
function isFunctionLike(node) {
@@ -11329,13 +11439,13 @@
ts.isFunctionLikeDeclaration = isFunctionLikeDeclaration;
function isFunctionLikeDeclarationKind(kind) {
switch (kind) {
- case 239:
- case 156:
+ case 240:
case 157:
case 158:
case 159:
- case 196:
+ case 160:
case 197:
+ case 198:
return true;
default:
return false;
@@ -11343,14 +11453,14 @@
}
function isFunctionLikeKind(kind) {
switch (kind) {
- case 155:
- case 160:
- case 298:
+ case 156:
case 161:
+ case 299:
case 162:
- case 165:
- case 294:
+ case 163:
case 166:
+ case 295:
+ case 167:
return true;
default:
return isFunctionLikeDeclarationKind(kind);
@@ -11363,28 +11473,28 @@
ts.isFunctionOrModuleBlock = isFunctionOrModuleBlock;
function isClassElement(node) {
var kind = node.kind;
- return kind === 157
- || kind === 154
- || kind === 156
- || kind === 158
+ return kind === 158
+ || kind === 155
+ || kind === 157
|| kind === 159
- || kind === 162
- || kind === 217;
+ || kind === 160
+ || kind === 163
+ || kind === 218;
}
ts.isClassElement = isClassElement;
function isClassLike(node) {
- return node && (node.kind === 240 || node.kind === 209);
+ return node && (node.kind === 241 || node.kind === 210);
}
ts.isClassLike = isClassLike;
function isAccessor(node) {
- return node && (node.kind === 158 || node.kind === 159);
+ return node && (node.kind === 159 || node.kind === 160);
}
ts.isAccessor = isAccessor;
function isMethodOrAccessor(node) {
switch (node.kind) {
- case 156:
- case 158:
+ case 157:
case 159:
+ case 160:
return true;
default:
return false;
@@ -11393,11 +11503,11 @@
ts.isMethodOrAccessor = isMethodOrAccessor;
function isTypeElement(node) {
var kind = node.kind;
- return kind === 161
- || kind === 160
- || kind === 153
- || kind === 155
- || kind === 162;
+ return kind === 162
+ || kind === 161
+ || kind === 154
+ || kind === 156
+ || kind === 163;
}
ts.isTypeElement = isTypeElement;
function isClassOrTypeElement(node) {
@@ -11406,12 +11516,12 @@
ts.isClassOrTypeElement = isClassOrTypeElement;
function isObjectLiteralElementLike(node) {
var kind = node.kind;
- return kind === 275
- || kind === 276
+ return kind === 276
|| kind === 277
- || kind === 156
- || kind === 158
- || kind === 159;
+ || kind === 278
+ || kind === 157
+ || kind === 159
+ || kind === 160;
}
ts.isObjectLiteralElementLike = isObjectLiteralElementLike;
function isTypeNode(node) {
@@ -11420,8 +11530,8 @@
ts.isTypeNode = isTypeNode;
function isFunctionOrConstructorTypeNode(node) {
switch (node.kind) {
- case 165:
case 166:
+ case 167:
return true;
}
return false;
@@ -11430,29 +11540,29 @@
function isBindingPattern(node) {
if (node) {
var kind = node.kind;
- return kind === 185
- || kind === 184;
+ return kind === 186
+ || kind === 185;
}
return false;
}
ts.isBindingPattern = isBindingPattern;
function isAssignmentPattern(node) {
var kind = node.kind;
- return kind === 187
- || kind === 188;
+ return kind === 188
+ || kind === 189;
}
ts.isAssignmentPattern = isAssignmentPattern;
function isArrayBindingElement(node) {
var kind = node.kind;
- return kind === 186
- || kind === 210;
+ return kind === 187
+ || kind === 211;
}
ts.isArrayBindingElement = isArrayBindingElement;
function isDeclarationBindingElement(bindingElement) {
switch (bindingElement.kind) {
- case 237:
- case 151:
- case 186:
+ case 238:
+ case 152:
+ case 187:
return true;
}
return false;
@@ -11465,8 +11575,8 @@
ts.isBindingOrAssignmentPattern = isBindingOrAssignmentPattern;
function isObjectBindingOrAssignmentPattern(node) {
switch (node.kind) {
- case 184:
- case 188:
+ case 185:
+ case 189:
return true;
}
return false;
@@ -11474,8 +11584,8 @@
ts.isObjectBindingOrAssignmentPattern = isObjectBindingOrAssignmentPattern;
function isArrayBindingOrAssignmentPattern(node) {
switch (node.kind) {
- case 185:
- case 187:
+ case 186:
+ case 188:
return true;
}
return false;
@@ -11483,25 +11593,25 @@
ts.isArrayBindingOrAssignmentPattern = isArrayBindingOrAssignmentPattern;
function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) {
var kind = node.kind;
- return kind === 189
- || kind === 148
- || kind === 183;
+ return kind === 190
+ || kind === 149
+ || kind === 184;
}
ts.isPropertyAccessOrQualifiedNameOrImportTypeNode = isPropertyAccessOrQualifiedNameOrImportTypeNode;
function isPropertyAccessOrQualifiedName(node) {
var kind = node.kind;
- return kind === 189
- || kind === 148;
+ return kind === 190
+ || kind === 149;
}
ts.isPropertyAccessOrQualifiedName = isPropertyAccessOrQualifiedName;
function isCallLikeExpression(node) {
switch (node.kind) {
+ case 263:
case 262:
- case 261:
- case 191:
case 192:
case 193:
- case 152:
+ case 194:
+ case 153:
return true;
default:
return false;
@@ -11509,12 +11619,12 @@
}
ts.isCallLikeExpression = isCallLikeExpression;
function isCallOrNewExpression(node) {
- return node.kind === 191 || node.kind === 192;
+ return node.kind === 192 || node.kind === 193;
}
ts.isCallOrNewExpression = isCallOrNewExpression;
function isTemplateLiteral(node) {
var kind = node.kind;
- return kind === 206
+ return kind === 207
|| kind === 14;
}
ts.isTemplateLiteral = isTemplateLiteral;
@@ -11524,34 +11634,34 @@
ts.isLeftHandSideExpression = isLeftHandSideExpression;
function isLeftHandSideExpressionKind(kind) {
switch (kind) {
- case 189:
case 190:
- case 192:
case 191:
- case 260:
- case 261:
- case 264:
case 193:
- case 187:
- case 195:
+ case 192:
+ case 261:
+ case 262:
+ case 265:
+ case 194:
case 188:
- case 209:
case 196:
- case 72:
+ case 189:
+ case 210:
+ case 197:
+ case 73:
case 13:
case 8:
case 9:
case 10:
case 14:
- case 206:
- case 87:
- case 96:
- case 100:
- case 102:
- case 98:
- case 213:
+ case 207:
+ case 88:
+ case 97:
+ case 101:
+ case 103:
+ case 99:
case 214:
- case 92:
+ case 215:
+ case 93:
return true;
default:
return false;
@@ -11563,13 +11673,13 @@
ts.isUnaryExpression = isUnaryExpression;
function isUnaryExpressionKind(kind) {
switch (kind) {
- case 202:
case 203:
- case 198:
+ case 204:
case 199:
case 200:
case 201:
- case 194:
+ case 202:
+ case 195:
return true;
default:
return isLeftHandSideExpressionKind(kind);
@@ -11577,9 +11687,9 @@
}
function isUnaryExpressionWithWrite(expr) {
switch (expr.kind) {
- case 203:
+ case 204:
return true;
- case 202:
+ case 203:
return expr.operator === 44 ||
expr.operator === 45;
default:
@@ -11593,15 +11703,15 @@
ts.isExpression = isExpression;
function isExpressionKind(kind) {
switch (kind) {
- case 205:
- case 207:
- case 197:
- case 204:
+ case 206:
case 208:
- case 212:
- case 210:
+ case 198:
+ case 205:
+ case 209:
+ case 213:
+ case 211:
+ case 315:
case 314:
- case 313:
return true;
default:
return isUnaryExpressionKind(kind);
@@ -11609,16 +11719,16 @@
}
function isAssertionExpression(node) {
var kind = node.kind;
- return kind === 194
- || kind === 212;
+ return kind === 195
+ || kind === 213;
}
ts.isAssertionExpression = isAssertionExpression;
function isPartiallyEmittedExpression(node) {
- return node.kind === 313;
+ return node.kind === 314;
}
ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression;
function isNotEmittedStatement(node) {
- return node.kind === 312;
+ return node.kind === 313;
}
ts.isNotEmittedStatement = isNotEmittedStatement;
function isNotEmittedOrPartiallyEmittedNode(node) {
@@ -11628,20 +11738,20 @@
ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode;
function isIterationStatement(node, lookInLabeledStatements) {
switch (node.kind) {
- case 225:
case 226:
case 227:
- case 223:
+ case 228:
case 224:
+ case 225:
return true;
- case 233:
+ case 234:
return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements);
}
return false;
}
ts.isIterationStatement = isIterationStatement;
function isForInOrOfStatement(node) {
- return node.kind === 226 || node.kind === 227;
+ return node.kind === 227 || node.kind === 228;
}
ts.isForInOrOfStatement = isForInOrOfStatement;
function isConciseBody(node) {
@@ -11660,108 +11770,108 @@
ts.isForInitializer = isForInitializer;
function isModuleBody(node) {
var kind = node.kind;
- return kind === 245
- || kind === 244
- || kind === 72;
+ return kind === 246
+ || kind === 245
+ || kind === 73;
}
ts.isModuleBody = isModuleBody;
function isNamespaceBody(node) {
var kind = node.kind;
- return kind === 245
- || kind === 244;
+ return kind === 246
+ || kind === 245;
}
ts.isNamespaceBody = isNamespaceBody;
function isJSDocNamespaceBody(node) {
var kind = node.kind;
- return kind === 72
- || kind === 244;
+ return kind === 73
+ || kind === 245;
}
ts.isJSDocNamespaceBody = isJSDocNamespaceBody;
function isNamedImportBindings(node) {
var kind = node.kind;
- return kind === 252
- || kind === 251;
+ return kind === 253
+ || kind === 252;
}
ts.isNamedImportBindings = isNamedImportBindings;
function isModuleOrEnumDeclaration(node) {
- return node.kind === 244 || node.kind === 243;
+ return node.kind === 245 || node.kind === 244;
}
ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration;
function isDeclarationKind(kind) {
- return kind === 197
- || kind === 186
+ return kind === 198
+ || kind === 187
+ || kind === 241
+ || kind === 210
+ || kind === 158
+ || kind === 244
+ || kind === 279
+ || kind === 258
|| kind === 240
- || kind === 209
+ || kind === 197
+ || kind === 159
+ || kind === 251
+ || kind === 249
+ || kind === 254
+ || kind === 242
+ || kind === 268
|| kind === 157
- || kind === 243
- || kind === 278
- || kind === 257
- || kind === 239
- || kind === 196
- || kind === 158
- || kind === 250
- || kind === 248
- || kind === 253
- || kind === 241
- || kind === 267
|| kind === 156
+ || kind === 245
+ || kind === 248
+ || kind === 252
+ || kind === 152
+ || kind === 276
|| kind === 155
- || kind === 244
- || kind === 247
- || kind === 251
- || kind === 151
- || kind === 275
|| kind === 154
- || kind === 153
- || kind === 159
- || kind === 276
- || kind === 242
- || kind === 150
- || kind === 237
- || kind === 309
- || kind === 302
- || kind === 310;
+ || kind === 160
+ || kind === 277
+ || kind === 243
+ || kind === 151
+ || kind === 238
+ || kind === 310
+ || kind === 303
+ || kind === 311;
}
function isDeclarationStatementKind(kind) {
- return kind === 239
- || kind === 258
- || kind === 240
+ return kind === 240
+ || kind === 259
|| kind === 241
|| kind === 242
|| kind === 243
|| kind === 244
+ || kind === 245
+ || kind === 250
|| kind === 249
- || kind === 248
+ || kind === 256
|| kind === 255
- || kind === 254
- || kind === 247;
+ || kind === 248;
}
function isStatementKindButNotDeclarationKind(kind) {
- return kind === 229
+ return kind === 230
+ || kind === 229
+ || kind === 237
+ || kind === 224
+ || kind === 222
+ || kind === 221
+ || kind === 227
|| kind === 228
- || kind === 236
+ || kind === 226
|| kind === 223
- || kind === 221
+ || kind === 234
+ || kind === 231
+ || kind === 233
+ || kind === 235
+ || kind === 236
|| kind === 220
- || kind === 226
- || kind === 227
|| kind === 225
- || kind === 222
- || kind === 233
- || kind === 230
|| kind === 232
- || kind === 234
- || kind === 235
- || kind === 219
- || kind === 224
- || kind === 231
- || kind === 312
- || kind === 316
- || kind === 315;
+ || kind === 313
+ || kind === 317
+ || kind === 316;
}
function isDeclaration(node) {
- if (node.kind === 150) {
- return (node.parent && node.parent.kind !== 308) || ts.isInJSFile(node);
+ if (node.kind === 151) {
+ return (node.parent && node.parent.kind !== 309) || ts.isInJSFile(node);
}
return isDeclarationKind(node.kind);
}
@@ -11782,10 +11892,10 @@
}
ts.isStatement = isStatement;
function isBlockStatement(node) {
- if (node.kind !== 218)
+ if (node.kind !== 219)
return false;
if (node.parent !== undefined) {
- if (node.parent.kind === 235 || node.parent.kind === 274) {
+ if (node.parent.kind === 236 || node.parent.kind === 275) {
return false;
}
}
@@ -11793,69 +11903,69 @@
}
function isModuleReference(node) {
var kind = node.kind;
- return kind === 259
- || kind === 148
- || kind === 72;
+ return kind === 260
+ || kind === 149
+ || kind === 73;
}
ts.isModuleReference = isModuleReference;
function isJsxTagNameExpression(node) {
var kind = node.kind;
- return kind === 100
- || kind === 72
- || kind === 189;
+ return kind === 101
+ || kind === 73
+ || kind === 190;
}
ts.isJsxTagNameExpression = isJsxTagNameExpression;
function isJsxChild(node) {
var kind = node.kind;
- return kind === 260
- || kind === 270
- || kind === 261
+ return kind === 261
+ || kind === 271
+ || kind === 262
|| kind === 11
- || kind === 264;
+ || kind === 265;
}
ts.isJsxChild = isJsxChild;
function isJsxAttributeLike(node) {
var kind = node.kind;
- return kind === 267
- || kind === 269;
+ return kind === 268
+ || kind === 270;
}
ts.isJsxAttributeLike = isJsxAttributeLike;
function isStringLiteralOrJsxExpression(node) {
var kind = node.kind;
return kind === 10
- || kind === 270;
+ || kind === 271;
}
ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression;
function isJsxOpeningLikeElement(node) {
var kind = node.kind;
- return kind === 262
- || kind === 261;
+ return kind === 263
+ || kind === 262;
}
ts.isJsxOpeningLikeElement = isJsxOpeningLikeElement;
function isCaseOrDefaultClause(node) {
var kind = node.kind;
- return kind === 271
- || kind === 272;
+ return kind === 272
+ || kind === 273;
}
ts.isCaseOrDefaultClause = isCaseOrDefaultClause;
function isJSDocNode(node) {
- return node.kind >= 288 && node.kind <= 310;
+ return node.kind >= 289 && node.kind <= 311;
}
ts.isJSDocNode = isJSDocNode;
function isJSDocCommentContainingNode(node) {
- return node.kind === 296 || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) || ts.isJSDocSignature(node);
+ return node.kind === 297 || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) || ts.isJSDocSignature(node);
}
ts.isJSDocCommentContainingNode = isJSDocCommentContainingNode;
function isJSDocTag(node) {
- return node.kind >= 299 && node.kind <= 310;
+ return node.kind >= 300 && node.kind <= 311;
}
ts.isJSDocTag = isJSDocTag;
function isSetAccessor(node) {
- return node.kind === 159;
+ return node.kind === 160;
}
ts.isSetAccessor = isSetAccessor;
function isGetAccessor(node) {
- return node.kind === 158;
+ return node.kind === 159;
}
ts.isGetAccessor = isGetAccessor;
function hasJSDocNodes(node) {
@@ -11876,11 +11986,11 @@
}
ts.hasOnlyExpressionInitializer = hasOnlyExpressionInitializer;
function isObjectLiteralElement(node) {
- return node.kind === 267 || node.kind === 269 || isObjectLiteralElementLike(node);
+ return node.kind === 268 || node.kind === 270 || isObjectLiteralElementLike(node);
}
ts.isObjectLiteralElement = isObjectLiteralElement;
function isTypeReferenceType(node) {
- return node.kind === 164 || node.kind === 211;
+ return node.kind === 165 || node.kind === 212;
}
ts.isTypeReferenceType = isTypeReferenceType;
var MAX_SMI_X86 = 1073741823;
@@ -11914,7 +12024,7 @@
})(ts || (ts = {}));
(function (ts) {
function isNamedImportsOrExports(node) {
- return node.kind === 252 || node.kind === 256;
+ return node.kind === 253 || node.kind === 257;
}
ts.isNamedImportsOrExports = isNamedImportsOrExports;
function Symbol(flags, name) {
@@ -12162,6 +12272,11 @@
ts.semanticDiagnosticsOptionDeclarations.some(function (option) { return !ts.isJsonEqual(getCompilerOptionValue(oldOptions, option), getCompilerOptionValue(newOptions, option)); });
}
ts.compilerOptionsAffectSemanticDiagnostics = compilerOptionsAffectSemanticDiagnostics;
+ function compilerOptionsAffectEmit(newOptions, oldOptions) {
+ return oldOptions !== newOptions &&
+ ts.affectsEmitOptionDeclarations.some(function (option) { return !ts.isJsonEqual(getCompilerOptionValue(oldOptions, option), getCompilerOptionValue(newOptions, option)); });
+ }
+ ts.compilerOptionsAffectEmit = compilerOptionsAffectEmit;
function getCompilerOptionValue(options, option) {
return option.strictFlag ? getStrictOptionValue(options, option.name) : options[option.name];
}
@@ -12361,6 +12476,15 @@
return root + pathComponents.slice(1).join(ts.directorySeparator);
}
ts.getPathFromPathComponents = getPathFromPathComponents;
+ function getNormalizedAbsolutePathWithoutRoot(fileName, currentDirectory) {
+ return getPathWithoutRoot(getNormalizedPathComponents(fileName, currentDirectory));
+ }
+ ts.getNormalizedAbsolutePathWithoutRoot = getNormalizedAbsolutePathWithoutRoot;
+ function getPathWithoutRoot(pathComponents) {
+ if (pathComponents.length === 0)
+ return "";
+ return pathComponents.slice(1).join(ts.directorySeparator);
+ }
})(ts || (ts = {}));
(function (ts) {
function getPathComponentsRelativeTo(from, to, stringEqualityComparer, getCanonicalFileName) {
@@ -12390,7 +12514,7 @@
}
ts.getRelativePathFromFile = getRelativePathFromFile;
function getRelativePathFromDirectory(fromDirectory, to, getCanonicalFileNameOrIgnoreCase) {
- Debug.assert((ts.getRootLength(fromDirectory) > 0) === (ts.getRootLength(to) > 0), "Paths must either both be absolute or both be relative");
+ ts.Debug.assert((ts.getRootLength(fromDirectory) > 0) === (ts.getRootLength(to) > 0), "Paths must either both be absolute or both be relative");
var getCanonicalFileName = typeof getCanonicalFileNameOrIgnoreCase === "function" ? getCanonicalFileNameOrIgnoreCase : ts.identity;
var ignoreCase = typeof getCanonicalFileNameOrIgnoreCase === "boolean" ? getCanonicalFileNameOrIgnoreCase : false;
var pathComponents = getPathComponentsRelativeTo(fromDirectory, to, ignoreCase ? ts.equateStringsCaseInsensitive : ts.equateStringsCaseSensitive, getCanonicalFileName);
@@ -12925,31 +13049,8 @@
return pathext ? path.slice(0, path.length - pathext.length) + (ts.startsWith(ext, ".") ? ext : "." + ext) : path;
}
ts.changeAnyExtension = changeAnyExtension;
- var Debug;
- (function (Debug) {
- function showSymbol(symbol) {
- var symbolFlags = ts.SymbolFlags;
- return "{ flags: " + (symbolFlags ? showFlags(symbol.flags, symbolFlags) : symbol.flags) + "; declarations: " + ts.map(symbol.declarations, showSyntaxKind) + " }";
- }
- Debug.showSymbol = showSymbol;
- function showFlags(flags, flagsEnum) {
- var out = [];
- for (var pow = 0; pow <= 30; pow++) {
- var n = 1 << pow;
- if (flags & n) {
- out.push(flagsEnum[n]);
- }
- }
- return out.join("|");
- }
- function showSyntaxKind(node) {
- var syntaxKind = ts.SyntaxKind;
- return syntaxKind ? syntaxKind[node.kind] : node.kind.toString();
- }
- Debug.showSyntaxKind = showSyntaxKind;
- })(Debug = ts.Debug || (ts.Debug = {}));
function tryParsePattern(pattern) {
- Debug.assert(ts.hasZeroOrOneAsteriskCharacter(pattern));
+ ts.Debug.assert(ts.hasZeroOrOneAsteriskCharacter(pattern));
var indexOfStar = pattern.indexOf("*");
return indexOfStar === -1 ? undefined : {
prefix: pattern.substr(0, indexOfStar),
@@ -12971,7 +13072,7 @@
ts.resolutionExtensionIsTSOrJson = resolutionExtensionIsTSOrJson;
function extensionFromPath(path) {
var ext = tryGetExtensionFromPath(path);
- return ext !== undefined ? ext : Debug.fail("File " + path + " has unknown extension.");
+ return ext !== undefined ? ext : ts.Debug.fail("File " + path + " has unknown extension.");
}
ts.extensionFromPath = extensionFromPath;
function isAnySupportedFileExtension(path) {
@@ -13035,7 +13136,7 @@
ts.matchPatternOrExact = matchPatternOrExact;
function sliceAfter(arr, value) {
var index = arr.indexOf(value);
- Debug.assert(index !== -1);
+ ts.Debug.assert(index !== -1);
return arr.slice(index);
}
ts.sliceAfter = sliceAfter;
@@ -13053,7 +13154,7 @@
}
ts.addRelatedInfo = addRelatedInfo;
function minAndMax(arr, getValue) {
- Debug.assert(arr.length !== 0);
+ ts.Debug.assert(arr.length !== 0);
var min = getValue(arr[0]);
var max = min;
for (var i = 1; i < arr.length; i++) {
@@ -13225,10 +13326,10 @@
var IdentifierConstructor;
var SourceFileConstructor;
function createNode(kind, pos, end) {
- if (kind === 284) {
+ if (kind === 285) {
return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end);
}
- else if (kind === 72) {
+ else if (kind === 73) {
return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, pos, end);
}
else if (!ts.isNodeKind(kind)) {
@@ -13263,19 +13364,19 @@
}
ts.isJSDocLikeText = isJSDocLikeText;
function forEachChild(node, cbNode, cbNodes) {
- if (!node || node.kind <= 147) {
+ if (!node || node.kind <= 148) {
return;
}
switch (node.kind) {
- case 148:
+ case 149:
return visitNode(cbNode, node.left) ||
visitNode(cbNode, node.right);
- case 150:
+ case 151:
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.constraint) ||
visitNode(cbNode, node.default) ||
visitNode(cbNode, node.expression);
- case 276:
+ case 277:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
@@ -13283,9 +13384,9 @@
visitNode(cbNode, node.exclamationToken) ||
visitNode(cbNode, node.equalsToken) ||
visitNode(cbNode, node.objectAssignmentInitializer);
- case 277:
+ case 278:
return visitNode(cbNode, node.expression);
- case 151:
+ case 152:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.dotDotDotToken) ||
@@ -13293,7 +13394,7 @@
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.initializer);
- case 154:
+ case 155:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
@@ -13301,51 +13402,51 @@
visitNode(cbNode, node.exclamationToken) ||
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.initializer);
- case 153:
+ case 154:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.initializer);
- case 275:
+ case 276:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.initializer);
- case 237:
+ case 238:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.exclamationToken) ||
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.initializer);
- case 186:
+ case 187:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.dotDotDotToken) ||
visitNode(cbNode, node.propertyName) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.initializer);
- case 165:
case 166:
- case 160:
+ case 167:
case 161:
case 162:
+ case 163:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNodes(cbNode, cbNodes, node.typeParameters) ||
visitNodes(cbNode, cbNodes, node.parameters) ||
visitNode(cbNode, node.type);
- case 156:
- case 155:
case 157:
+ case 156:
case 158:
case 159:
- case 196:
- case 239:
+ case 160:
case 197:
+ case 240:
+ case 198:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.asteriskToken) ||
@@ -13357,343 +13458,343 @@
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.equalsGreaterThanToken) ||
visitNode(cbNode, node.body);
- case 164:
+ case 165:
return visitNode(cbNode, node.typeName) ||
visitNodes(cbNode, cbNodes, node.typeArguments);
- case 163:
+ case 164:
return visitNode(cbNode, node.parameterName) ||
visitNode(cbNode, node.type);
- case 167:
- return visitNode(cbNode, node.exprName);
case 168:
- return visitNodes(cbNode, cbNodes, node.members);
+ return visitNode(cbNode, node.exprName);
case 169:
- return visitNode(cbNode, node.elementType);
+ return visitNodes(cbNode, cbNodes, node.members);
case 170:
+ return visitNode(cbNode, node.elementType);
+ case 171:
return visitNodes(cbNode, cbNodes, node.elementTypes);
- case 173:
case 174:
- return visitNodes(cbNode, cbNodes, node.types);
case 175:
+ return visitNodes(cbNode, cbNodes, node.types);
+ case 176:
return visitNode(cbNode, node.checkType) ||
visitNode(cbNode, node.extendsType) ||
visitNode(cbNode, node.trueType) ||
visitNode(cbNode, node.falseType);
- case 176:
+ case 177:
return visitNode(cbNode, node.typeParameter);
- case 183:
+ case 184:
return visitNode(cbNode, node.argument) ||
visitNode(cbNode, node.qualifier) ||
visitNodes(cbNode, cbNodes, node.typeArguments);
- case 177:
- case 179:
- return visitNode(cbNode, node.type);
+ case 178:
case 180:
+ return visitNode(cbNode, node.type);
+ case 181:
return visitNode(cbNode, node.objectType) ||
visitNode(cbNode, node.indexType);
- case 181:
+ case 182:
return visitNode(cbNode, node.readonlyToken) ||
visitNode(cbNode, node.typeParameter) ||
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.type);
- case 182:
+ case 183:
return visitNode(cbNode, node.literal);
- case 184:
case 185:
- return visitNodes(cbNode, cbNodes, node.elements);
- case 187:
+ case 186:
return visitNodes(cbNode, cbNodes, node.elements);
case 188:
- return visitNodes(cbNode, cbNodes, node.properties);
+ return visitNodes(cbNode, cbNodes, node.elements);
case 189:
+ return visitNodes(cbNode, cbNodes, node.properties);
+ case 190:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.name);
- case 190:
+ case 191:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.argumentExpression);
- case 191:
case 192:
+ case 193:
return visitNode(cbNode, node.expression) ||
visitNodes(cbNode, cbNodes, node.typeArguments) ||
visitNodes(cbNode, cbNodes, node.arguments);
- case 193:
+ case 194:
return visitNode(cbNode, node.tag) ||
visitNodes(cbNode, cbNodes, node.typeArguments) ||
visitNode(cbNode, node.template);
- case 194:
+ case 195:
return visitNode(cbNode, node.type) ||
visitNode(cbNode, node.expression);
- case 195:
- return visitNode(cbNode, node.expression);
- case 198:
+ case 196:
return visitNode(cbNode, node.expression);
case 199:
return visitNode(cbNode, node.expression);
case 200:
return visitNode(cbNode, node.expression);
- case 202:
- return visitNode(cbNode, node.operand);
- case 207:
- return visitNode(cbNode, node.asteriskToken) ||
- visitNode(cbNode, node.expression);
case 201:
return visitNode(cbNode, node.expression);
case 203:
return visitNode(cbNode, node.operand);
+ case 208:
+ return visitNode(cbNode, node.asteriskToken) ||
+ visitNode(cbNode, node.expression);
+ case 202:
+ return visitNode(cbNode, node.expression);
case 204:
+ return visitNode(cbNode, node.operand);
+ case 205:
return visitNode(cbNode, node.left) ||
visitNode(cbNode, node.operatorToken) ||
visitNode(cbNode, node.right);
- case 212:
+ case 213:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.type);
- case 213:
- return visitNode(cbNode, node.expression);
case 214:
+ return visitNode(cbNode, node.expression);
+ case 215:
return visitNode(cbNode, node.name);
- case 205:
+ case 206:
return visitNode(cbNode, node.condition) ||
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.whenTrue) ||
visitNode(cbNode, node.colonToken) ||
visitNode(cbNode, node.whenFalse);
- case 208:
+ case 209:
return visitNode(cbNode, node.expression);
- case 218:
- case 245:
+ case 219:
+ case 246:
return visitNodes(cbNode, cbNodes, node.statements);
- case 284:
+ case 285:
return visitNodes(cbNode, cbNodes, node.statements) ||
visitNode(cbNode, node.endOfFileToken);
- case 219:
+ case 220:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.declarationList);
- case 238:
+ case 239:
return visitNodes(cbNode, cbNodes, node.declarations);
- case 221:
- return visitNode(cbNode, node.expression);
case 222:
+ return visitNode(cbNode, node.expression);
+ case 223:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.thenStatement) ||
visitNode(cbNode, node.elseStatement);
- case 223:
+ case 224:
return visitNode(cbNode, node.statement) ||
visitNode(cbNode, node.expression);
- case 224:
+ case 225:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.statement);
- case 225:
+ case 226:
return visitNode(cbNode, node.initializer) ||
visitNode(cbNode, node.condition) ||
visitNode(cbNode, node.incrementor) ||
visitNode(cbNode, node.statement);
- case 226:
+ case 227:
return visitNode(cbNode, node.initializer) ||
visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.statement);
- case 227:
+ case 228:
return visitNode(cbNode, node.awaitModifier) ||
visitNode(cbNode, node.initializer) ||
visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.statement);
- case 228:
case 229:
- return visitNode(cbNode, node.label);
case 230:
- return visitNode(cbNode, node.expression);
+ return visitNode(cbNode, node.label);
case 231:
+ return visitNode(cbNode, node.expression);
+ case 232:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.statement);
- case 232:
+ case 233:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.caseBlock);
- case 246:
+ case 247:
return visitNodes(cbNode, cbNodes, node.clauses);
- case 271:
+ case 272:
return visitNode(cbNode, node.expression) ||
visitNodes(cbNode, cbNodes, node.statements);
- case 272:
+ case 273:
return visitNodes(cbNode, cbNodes, node.statements);
- case 233:
+ case 234:
return visitNode(cbNode, node.label) ||
visitNode(cbNode, node.statement);
- case 234:
- return visitNode(cbNode, node.expression);
case 235:
+ return visitNode(cbNode, node.expression);
+ case 236:
return visitNode(cbNode, node.tryBlock) ||
visitNode(cbNode, node.catchClause) ||
visitNode(cbNode, node.finallyBlock);
- case 274:
+ case 275:
return visitNode(cbNode, node.variableDeclaration) ||
visitNode(cbNode, node.block);
- case 152:
+ case 153:
return visitNode(cbNode, node.expression);
- case 240:
- case 209:
+ case 241:
+ case 210:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNodes(cbNode, cbNodes, node.typeParameters) ||
visitNodes(cbNode, cbNodes, node.heritageClauses) ||
visitNodes(cbNode, cbNodes, node.members);
- case 241:
+ case 242:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNodes(cbNode, cbNodes, node.typeParameters) ||
visitNodes(cbNode, cbNodes, node.heritageClauses) ||
visitNodes(cbNode, cbNodes, node.members);
- case 242:
+ case 243:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNodes(cbNode, cbNodes, node.typeParameters) ||
visitNode(cbNode, node.type);
- case 243:
+ case 244:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNodes(cbNode, cbNodes, node.members);
- case 278:
+ case 279:
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.initializer);
- case 244:
+ case 245:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.body);
- case 248:
+ case 249:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.moduleReference);
- case 249:
+ case 250:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.importClause) ||
visitNode(cbNode, node.moduleSpecifier);
- case 250:
+ case 251:
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.namedBindings);
- case 247:
- return visitNode(cbNode, node.name);
- case 251:
+ case 248:
return visitNode(cbNode, node.name);
case 252:
- case 256:
+ return visitNode(cbNode, node.name);
+ case 253:
+ case 257:
return visitNodes(cbNode, cbNodes, node.elements);
- case 255:
+ case 256:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.exportClause) ||
visitNode(cbNode, node.moduleSpecifier);
- case 253:
- case 257:
+ case 254:
+ case 258:
return visitNode(cbNode, node.propertyName) ||
visitNode(cbNode, node.name);
- case 254:
+ case 255:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.expression);
- case 206:
+ case 207:
return visitNode(cbNode, node.head) || visitNodes(cbNode, cbNodes, node.templateSpans);
- case 216:
+ case 217:
return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal);
- case 149:
+ case 150:
return visitNode(cbNode, node.expression);
- case 273:
+ case 274:
return visitNodes(cbNode, cbNodes, node.types);
- case 211:
+ case 212:
return visitNode(cbNode, node.expression) ||
visitNodes(cbNode, cbNodes, node.typeArguments);
- case 259:
+ case 260:
return visitNode(cbNode, node.expression);
- case 258:
+ case 259:
return visitNodes(cbNode, cbNodes, node.decorators);
- case 314:
+ case 315:
return visitNodes(cbNode, cbNodes, node.elements);
- case 260:
+ case 261:
return visitNode(cbNode, node.openingElement) ||
visitNodes(cbNode, cbNodes, node.children) ||
visitNode(cbNode, node.closingElement);
- case 264:
+ case 265:
return visitNode(cbNode, node.openingFragment) ||
visitNodes(cbNode, cbNodes, node.children) ||
visitNode(cbNode, node.closingFragment);
- case 261:
case 262:
+ case 263:
return visitNode(cbNode, node.tagName) ||
visitNodes(cbNode, cbNodes, node.typeArguments) ||
visitNode(cbNode, node.attributes);
- case 268:
+ case 269:
return visitNodes(cbNode, cbNodes, node.properties);
- case 267:
+ case 268:
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.initializer);
- case 269:
- return visitNode(cbNode, node.expression);
case 270:
+ return visitNode(cbNode, node.expression);
+ case 271:
return visitNode(cbNode, node.dotDotDotToken) ||
visitNode(cbNode, node.expression);
- case 263:
+ case 264:
return visitNode(cbNode, node.tagName);
- case 171:
case 172:
- case 288:
- case 292:
- case 291:
+ case 173:
+ case 289:
case 293:
- case 295:
- return visitNode(cbNode, node.type);
+ case 292:
case 294:
+ case 296:
+ return visitNode(cbNode, node.type);
+ case 295:
return visitNodes(cbNode, cbNodes, node.parameters) ||
visitNode(cbNode, node.type);
- case 296:
+ case 297:
return visitNodes(cbNode, cbNodes, node.tags);
- case 304:
- case 310:
+ case 305:
+ case 311:
return visitNode(cbNode, node.tagName) ||
(node.isNameFirst
? visitNode(cbNode, node.name) ||
visitNode(cbNode, node.typeExpression)
: visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.name));
- case 300:
+ case 301:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.class);
- case 308:
+ case 309:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.constraint) ||
visitNodes(cbNode, cbNodes, node.typeParameters);
- case 309:
+ case 310:
return visitNode(cbNode, node.tagName) ||
(node.typeExpression &&
- node.typeExpression.kind === 288
+ node.typeExpression.kind === 289
? visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.fullName)
: visitNode(cbNode, node.fullName) ||
visitNode(cbNode, node.typeExpression));
- case 302:
+ case 303:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.fullName) ||
visitNode(cbNode, node.typeExpression);
- case 305:
- case 307:
case 306:
- case 303:
+ case 308:
+ case 307:
+ case 304:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.typeExpression);
- case 298:
+ case 299:
return ts.forEach(node.typeParameters, cbNode) ||
ts.forEach(node.parameters, cbNode) ||
visitNode(cbNode, node.type);
- case 297:
+ case 298:
return ts.forEach(node.jsDocPropertyTags, cbNode);
- case 299:
- case 301:
+ case 300:
+ case 302:
return visitNode(cbNode, node.tagName);
- case 313:
+ case 314:
return visitNode(cbNode, node.expression);
}
}
@@ -13746,7 +13847,7 @@
ts.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests;
var Parser;
(function (Parser) {
- var scanner = ts.createScanner(7, true);
+ var scanner = ts.createScanner(8, true);
var disallowInAndDecoratorContext = 2048 | 8192;
var NodeConstructor;
var TokenConstructor;
@@ -13804,14 +13905,14 @@
sourceFile.endOfFileToken = parseTokenNode();
}
else {
- var statement = createNode(221);
+ var statement = createNode(222);
switch (token()) {
case 22:
statement.expression = parseArrayLiteralExpression();
break;
- case 102:
- case 87:
- case 96:
+ case 103:
+ case 88:
+ case 97:
statement.expression = parseTokenNode();
break;
case 39:
@@ -13944,7 +14045,7 @@
}
Parser.fixupParentReferences = fixupParentReferences;
function createSourceFile(fileName, languageVersion, scriptKind, isDeclarationFile) {
- var sourceFile = new SourceFileConstructor(284, 0, sourceText.length);
+ var sourceFile = new SourceFileConstructor(285, 0, sourceText.length);
nodeCount++;
sourceFile.text = sourceText;
sourceFile.bindDiagnostics = [];
@@ -14060,6 +14161,9 @@
function nextToken() {
return currentToken = scanner.scan();
}
+ function nextTokenJSDoc() {
+ return currentToken = scanner.scanJsDocToken();
+ }
function reScanGreaterToken() {
return currentToken = scanner.reScanGreaterToken();
}
@@ -14104,16 +14208,16 @@
return speculationHelper(callback, false);
}
function isIdentifier() {
- if (token() === 72) {
+ if (token() === 73) {
return true;
}
- if (token() === 117 && inYieldContext()) {
+ if (token() === 118 && inYieldContext()) {
return false;
}
- if (token() === 122 && inAwaitContext()) {
+ if (token() === 123 && inAwaitContext()) {
return false;
}
- return token() > 108;
+ return token() > 109;
}
function parseExpected(kind, diagnosticMessage, shouldAdvance) {
if (shouldAdvance === void 0) { shouldAdvance = true; }
@@ -14131,6 +14235,14 @@
}
return false;
}
+ function parseExpectedJSDoc(kind) {
+ if (token() === kind) {
+ nextTokenJSDoc();
+ return true;
+ }
+ parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind));
+ return false;
+ }
function parseOptional(t) {
if (token() === t) {
nextToken();
@@ -14144,15 +14256,30 @@
}
return undefined;
}
+ function parseOptionalTokenJSDoc(t) {
+ if (token() === t) {
+ return parseTokenNodeJSDoc();
+ }
+ return undefined;
+ }
function parseExpectedToken(t, diagnosticMessage, arg0) {
return parseOptionalToken(t) ||
createMissingNode(t, false, diagnosticMessage || ts.Diagnostics._0_expected, arg0 || ts.tokenToString(t));
}
+ function parseExpectedTokenJSDoc(t) {
+ return parseOptionalTokenJSDoc(t) ||
+ createMissingNode(t, false, ts.Diagnostics._0_expected, ts.tokenToString(t));
+ }
function parseTokenNode() {
var node = createNode(token());
nextToken();
return finishNode(node);
}
+ function parseTokenNodeJSDoc() {
+ var node = createNode(token());
+ nextTokenJSDoc();
+ return finishNode(node);
+ }
function canParseSemicolon() {
if (token() === 26) {
return true;
@@ -14174,7 +14301,7 @@
nodeCount++;
var p = pos >= 0 ? pos : scanner.getStartPos();
return ts.isNodeKind(kind) || kind === 0 ? new NodeConstructor(kind, p, p) :
- kind === 72 ? new IdentifierConstructor(kind, p, p) :
+ kind === 73 ? new IdentifierConstructor(kind, p, p) :
new TokenConstructor(kind, p, p);
}
function createNodeWithJSDoc(kind, pos) {
@@ -14210,7 +14337,7 @@
parseErrorAtCurrentToken(diagnosticMessage, arg0);
}
var result = createNode(kind);
- if (kind === 72) {
+ if (kind === 73) {
result.escapedText = "";
}
else if (ts.isLiteralKind(kind) || ts.isTemplateLiteralKind(kind)) {
@@ -14228,8 +14355,8 @@
function createIdentifier(isIdentifier, diagnosticMessage) {
identifierCount++;
if (isIdentifier) {
- var node = createNode(72);
- if (token() !== 72) {
+ var node = createNode(73);
+ if (token() !== 73) {
node.originalKeywordKind = token();
}
node.escapedText = ts.escapeLeadingUnderscores(internIdentifier(scanner.getTokenValue()));
@@ -14237,7 +14364,7 @@
return finishNode(node);
}
var reportAtCurrentPosition = token() === 1;
- return createMissingNode(72, reportAtCurrentPosition, diagnosticMessage || ts.Diagnostics.Identifier_expected);
+ return createMissingNode(73, reportAtCurrentPosition, diagnosticMessage || ts.Diagnostics.Identifier_expected);
}
function parseIdentifier(diagnosticMessage) {
return createIdentifier(isIdentifier(), diagnosticMessage);
@@ -14265,7 +14392,7 @@
return parsePropertyNameWorker(true);
}
function parseComputedPropertyName() {
- var node = createNode(149);
+ var node = createNode(150);
parseExpected(22);
node.expression = allowInAnd(parseExpression);
parseExpected(23);
@@ -14283,19 +14410,19 @@
}
function nextTokenCanFollowModifier() {
switch (token()) {
- case 77:
- return nextToken() === 84;
- case 85:
+ case 78:
+ return nextToken() === 85;
+ case 86:
nextToken();
- if (token() === 80) {
+ if (token() === 81) {
return lookAhead(nextTokenCanFollowDefaultKeyword);
}
- return token() !== 40 && token() !== 119 && token() !== 18 && canFollowModifier();
- case 80:
+ return token() !== 40 && token() !== 120 && token() !== 18 && canFollowModifier();
+ case 81:
return nextTokenCanFollowDefaultKeyword();
- case 116:
- case 126:
- case 137:
+ case 117:
+ case 127:
+ case 138:
nextToken();
return canFollowModifier();
default:
@@ -14314,10 +14441,10 @@
}
function nextTokenCanFollowDefaultKeyword() {
nextToken();
- return token() === 76 || token() === 90 ||
- token() === 110 ||
- (token() === 118 && lookAhead(nextTokenIsClassKeywordOnSameLine)) ||
- (token() === 121 && lookAhead(nextTokenIsFunctionKeywordOnSameLine));
+ return token() === 77 || token() === 91 ||
+ token() === 111 ||
+ (token() === 119 && lookAhead(nextTokenIsClassKeywordOnSameLine)) ||
+ (token() === 122 && lookAhead(nextTokenIsFunctionKeywordOnSameLine));
}
function isListElement(parsingContext, inErrorRecovery) {
var node = currentNode(parsingContext);
@@ -14330,7 +14457,7 @@
case 3:
return !(token() === 26 && inErrorRecovery) && isStartOfStatement();
case 2:
- return token() === 74 || token() === 80;
+ return token() === 75 || token() === 81;
case 4:
return lookAhead(isTypeMemberStart);
case 5:
@@ -14397,7 +14524,7 @@
ts.Debug.assert(token() === 18);
if (nextToken() === 19) {
var next = nextToken();
- return next === 27 || next === 18 || next === 86 || next === 109;
+ return next === 27 || next === 18 || next === 87 || next === 110;
}
return true;
}
@@ -14414,8 +14541,8 @@
return ts.tokenIsIdentifierOrKeywordOrGreaterThan(token());
}
function isHeritageClauseExtendsOrImplementsKeyword() {
- if (token() === 109 ||
- token() === 86) {
+ if (token() === 110 ||
+ token() === 87) {
return lookAhead(nextTokenIsStartOfExpression);
}
return false;
@@ -14443,13 +14570,13 @@
case 23:
return token() === 19;
case 3:
- return token() === 19 || token() === 74 || token() === 80;
+ return token() === 19 || token() === 75 || token() === 81;
case 7:
- return token() === 18 || token() === 86 || token() === 109;
+ return token() === 18 || token() === 87 || token() === 110;
case 8:
return isVariableDeclaratorListTerminator();
case 19:
- return token() === 30 || token() === 20 || token() === 18 || token() === 86 || token() === 109;
+ return token() === 30 || token() === 20 || token() === 18 || token() === 87 || token() === 110;
case 11:
return token() === 21 || token() === 26;
case 15:
@@ -14585,17 +14712,17 @@
function isReusableClassMember(node) {
if (node) {
switch (node.kind) {
- case 157:
- case 162:
case 158:
+ case 163:
case 159:
- case 154:
- case 217:
+ case 160:
+ case 155:
+ case 218:
return true;
- case 156:
+ case 157:
var methodDeclaration = node;
- var nameIsConstructor = methodDeclaration.name.kind === 72 &&
- methodDeclaration.name.originalKeywordKind === 124;
+ var nameIsConstructor = methodDeclaration.name.kind === 73 &&
+ methodDeclaration.name.originalKeywordKind === 125;
return !nameIsConstructor;
}
}
@@ -14604,8 +14731,8 @@
function isReusableSwitchClause(node) {
if (node) {
switch (node.kind) {
- case 271:
case 272:
+ case 273:
return true;
}
}
@@ -14614,65 +14741,65 @@
function isReusableStatement(node) {
if (node) {
switch (node.kind) {
- case 239:
+ case 240:
+ case 220:
case 219:
- case 218:
+ case 223:
case 222:
- case 221:
- case 234:
+ case 235:
+ case 231:
+ case 233:
case 230:
- case 232:
case 229:
+ case 227:
case 228:
case 226:
- case 227:
case 225:
- case 224:
- case 231:
- case 220:
- case 235:
- case 233:
- case 223:
+ case 232:
+ case 221:
case 236:
+ case 234:
+ case 224:
+ case 237:
+ case 250:
case 249:
- case 248:
+ case 256:
case 255:
- case 254:
- case 244:
- case 240:
+ case 245:
case 241:
- case 243:
case 242:
+ case 244:
+ case 243:
return true;
}
}
return false;
}
function isReusableEnumMember(node) {
- return node.kind === 278;
+ return node.kind === 279;
}
function isReusableTypeMember(node) {
if (node) {
switch (node.kind) {
- case 161:
- case 155:
case 162:
- case 153:
- case 160:
+ case 156:
+ case 163:
+ case 154:
+ case 161:
return true;
}
}
return false;
}
function isReusableVariableDeclaration(node) {
- if (node.kind !== 237) {
+ if (node.kind !== 238) {
return false;
}
var variableDeclarator = node;
return variableDeclarator.initializer === undefined;
}
function isReusableParameter(node) {
- if (node.kind !== 151) {
+ if (node.kind !== 152) {
return false;
}
var parameter = node;
@@ -14786,7 +14913,7 @@
return entity;
}
function createQualifiedName(entity, name) {
- var node = createNode(148, entity.pos);
+ var node = createNode(149, entity.pos);
node.left = entity;
node.right = name;
return finishNode(node);
@@ -14795,13 +14922,13 @@
if (scanner.hasPrecedingLineBreak() && ts.tokenIsIdentifierOrKeyword(token())) {
var matchesPattern = lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine);
if (matchesPattern) {
- return createMissingNode(72, true, ts.Diagnostics.Identifier_expected);
+ return createMissingNode(73, true, ts.Diagnostics.Identifier_expected);
}
}
return allowIdentifierNames ? parseIdentifierName() : parseIdentifier();
}
function parseTemplateExpression() {
- var template = createNode(206);
+ var template = createNode(207);
template.head = parseTemplateHead();
ts.Debug.assert(template.head.kind === 15, "Template head has wrong token kind");
var list = [];
@@ -14813,7 +14940,7 @@
return finishNode(template);
}
function parseTemplateSpan() {
- var span = createNode(216);
+ var span = createNode(217);
span.expression = allowInAnd(parseExpression);
var literal;
if (token() === 19) {
@@ -14856,7 +14983,7 @@
return node;
}
function parseTypeReference() {
- var node = createNode(164);
+ var node = createNode(165);
node.typeName = parseEntityName(true, ts.Diagnostics.Type_expected);
if (!scanner.hasPrecedingLineBreak() && reScanLessThanToken() === 28) {
node.typeArguments = parseBracketedList(20, parseType, 28, 30);
@@ -14865,14 +14992,14 @@
}
function typeHasArrowFunctionBlockingParseError(node) {
switch (node.kind) {
- case 164:
- return ts.nodeIsMissing(node.typeName);
case 165:
- case 166: {
+ return ts.nodeIsMissing(node.typeName);
+ case 166:
+ case 167: {
var _a = node, parameters = _a.parameters, type = _a.type;
return isMissingList(parameters) || typeHasArrowFunctionBlockingParseError(type);
}
- case 177:
+ case 178:
return typeHasArrowFunctionBlockingParseError(node.type);
default:
return false;
@@ -14880,20 +15007,20 @@
}
function parseThisTypePredicate(lhs) {
nextToken();
- var node = createNode(163, lhs.pos);
+ var node = createNode(164, lhs.pos);
node.parameterName = lhs;
node.type = parseType();
return finishNode(node);
}
function parseThisTypeNode() {
- var node = createNode(178);
+ var node = createNode(179);
nextToken();
return finishNode(node);
}
function parseJSDocAllType(postFixEquals) {
- var result = createNode(289);
+ var result = createNode(290);
if (postFixEquals) {
- return createPostfixType(293, result);
+ return createPostfixType(294, result);
}
else {
nextToken();
@@ -14901,7 +15028,7 @@
return finishNode(result);
}
function parseJSDocNonNullableType() {
- var result = createNode(292);
+ var result = createNode(293);
nextToken();
result.type = parseNonArrayType();
return finishNode(result);
@@ -14913,31 +15040,31 @@
token() === 19 ||
token() === 21 ||
token() === 30 ||
- token() === 59 ||
+ token() === 60 ||
token() === 50) {
- var result = createNode(290, pos);
+ var result = createNode(291, pos);
return finishNode(result);
}
else {
- var result = createNode(291, pos);
+ var result = createNode(292, pos);
result.type = parseType();
return finishNode(result);
}
}
function parseJSDocFunctionType() {
if (lookAhead(nextTokenIsOpenParen)) {
- var result = createNodeWithJSDoc(294);
+ var result = createNodeWithJSDoc(295);
nextToken();
fillSignature(57, 4 | 32, result);
return finishNode(result);
}
- var node = createNode(164);
+ var node = createNode(165);
node.typeName = parseIdentifierName();
return finishNode(node);
}
function parseJSDocParameter() {
- var parameter = createNode(151);
- if (token() === 100 || token() === 95) {
+ var parameter = createNode(152);
+ if (token() === 101 || token() === 96) {
parameter.name = parseIdentifierName();
parseExpected(57);
}
@@ -14950,25 +15077,25 @@
var type = parseTypeOrTypePredicate();
scanner.setInJSDocType(false);
if (dotdotdot) {
- var variadic = createNode(295, dotdotdot.pos);
+ var variadic = createNode(296, dotdotdot.pos);
variadic.type = type;
type = finishNode(variadic);
}
- if (token() === 59) {
- return createPostfixType(293, type);
+ if (token() === 60) {
+ return createPostfixType(294, type);
}
return type;
}
function parseTypeQuery() {
- var node = createNode(167);
- parseExpected(104);
+ var node = createNode(168);
+ parseExpected(105);
node.exprName = parseEntityName(true);
return finishNode(node);
}
function parseTypeParameter() {
- var node = createNode(150);
+ var node = createNode(151);
node.name = parseIdentifier();
- if (parseOptional(86)) {
+ if (parseOptional(87)) {
if (isStartOfType() || !isStartOfExpression()) {
node.constraint = parseType();
}
@@ -14976,7 +15103,7 @@
node.expression = parseUnaryExpressionOrHigher();
}
}
- if (parseOptional(59)) {
+ if (parseOptional(60)) {
node.default = parseType();
}
return finishNode(node);
@@ -15000,8 +15127,8 @@
isStartOfType(!isJSDocParameter);
}
function parseParameter() {
- var node = createNodeWithJSDoc(151);
- if (token() === 100) {
+ var node = createNodeWithJSDoc(152);
+ if (token() === 101) {
node.name = createIdentifier(true);
node.type = parseParameterType();
return finishNode(node);
@@ -15069,8 +15196,8 @@
}
function parseSignatureMember(kind) {
var node = createNodeWithJSDoc(kind);
- if (kind === 161) {
- parseExpected(95);
+ if (kind === 162) {
+ parseExpected(96);
}
fillSignature(57, 4, node);
parseTypeMemberSemicolon();
@@ -15106,7 +15233,7 @@
return token() === 57 || token() === 27 || token() === 23;
}
function parseIndexSignatureDeclaration(node) {
- node.kind = 162;
+ node.kind = 163;
node.parameters = parseBracketedList(16, parseParameter, 22, 23);
node.type = parseTypeAnnotation();
parseTypeMemberSemicolon();
@@ -15116,13 +15243,13 @@
node.name = parsePropertyName();
node.questionToken = parseOptionalToken(56);
if (token() === 20 || token() === 28) {
- node.kind = 155;
+ node.kind = 156;
fillSignature(57, 4, node);
}
else {
- node.kind = 153;
+ node.kind = 154;
node.type = parseTypeAnnotation();
- if (token() === 59) {
+ if (token() === 60) {
node.initializer = parseInitializer();
}
}
@@ -15157,11 +15284,11 @@
}
function parseTypeMember() {
if (token() === 20 || token() === 28) {
- return parseSignatureMember(160);
- }
- if (token() === 95 && lookAhead(nextTokenIsOpenParenOrLessThan)) {
return parseSignatureMember(161);
}
+ if (token() === 96 && lookAhead(nextTokenIsOpenParenOrLessThan)) {
+ return parseSignatureMember(162);
+ }
var node = createNodeWithJSDoc(0);
node.modifiers = parseModifiers();
if (isIndexSignature()) {
@@ -15186,7 +15313,7 @@
return false;
}
function parseTypeLiteral() {
- var node = createNode(168);
+ var node = createNode(169);
node.members = parseObjectTypeMembers();
return finishNode(node);
}
@@ -15204,27 +15331,27 @@
function isStartOfMappedType() {
nextToken();
if (token() === 38 || token() === 39) {
- return nextToken() === 133;
+ return nextToken() === 134;
}
- if (token() === 133) {
+ if (token() === 134) {
nextToken();
}
- return token() === 22 && nextTokenIsIdentifier() && nextToken() === 93;
+ return token() === 22 && nextTokenIsIdentifier() && nextToken() === 94;
}
function parseMappedTypeParameter() {
- var node = createNode(150);
+ var node = createNode(151);
node.name = parseIdentifier();
- parseExpected(93);
+ parseExpected(94);
node.constraint = parseType();
return finishNode(node);
}
function parseMappedType() {
- var node = createNode(181);
+ var node = createNode(182);
parseExpected(18);
- if (token() === 133 || token() === 38 || token() === 39) {
+ if (token() === 134 || token() === 38 || token() === 39) {
node.readonlyToken = parseTokenNode();
- if (node.readonlyToken.kind !== 133) {
- parseExpectedToken(133);
+ if (node.readonlyToken.kind !== 134) {
+ parseExpectedToken(134);
}
}
parseExpected(22);
@@ -15244,23 +15371,23 @@
function parseTupleElementType() {
var pos = getNodePos();
if (parseOptional(25)) {
- var node = createNode(172, pos);
+ var node = createNode(173, pos);
node.type = parseType();
return finishNode(node);
}
var type = parseType();
- if (!(contextFlags & 2097152) && type.kind === 291 && type.pos === type.type.pos) {
- type.kind = 171;
+ if (!(contextFlags & 2097152) && type.kind === 292 && type.pos === type.type.pos) {
+ type.kind = 172;
}
return type;
}
function parseTupleType() {
- var node = createNode(170);
+ var node = createNode(171);
node.elementTypes = parseBracketedList(21, parseTupleElementType, 22, 23);
return finishNode(node);
}
function parseParenthesizedType() {
- var node = createNode(177);
+ var node = createNode(178);
parseExpected(20);
node.type = parseType();
parseExpected(21);
@@ -15268,7 +15395,7 @@
}
function parseFunctionOrConstructorType() {
var pos = getNodePos();
- var kind = parseOptional(95) ? 166 : 165;
+ var kind = parseOptional(96) ? 167 : 166;
var node = createNodeWithJSDoc(kind, pos);
fillSignature(37, 4, node);
return finishNode(node);
@@ -15278,14 +15405,14 @@
return token() === 24 ? undefined : node;
}
function parseLiteralTypeNode(negative) {
- var node = createNode(182);
+ var node = createNode(183);
var unaryMinusExpression;
if (negative) {
- unaryMinusExpression = createNode(202);
+ unaryMinusExpression = createNode(203);
unaryMinusExpression.operator = 39;
nextToken();
}
- var expression = token() === 102 || token() === 87
+ var expression = token() === 103 || token() === 88
? parseTokenNode()
: parseLiteralLikeNode(token());
if (negative) {
@@ -15298,22 +15425,24 @@
}
function isStartOfTypeOfImportType() {
nextToken();
- return token() === 92;
+ return token() === 93;
}
function parseImportType() {
sourceFile.flags |= 524288;
- var node = createNode(183);
- if (parseOptional(104)) {
+ var node = createNode(184);
+ if (parseOptional(105)) {
node.isTypeOf = true;
}
- parseExpected(92);
+ parseExpected(93);
parseExpected(20);
node.argument = parseType();
parseExpected(21);
if (parseOptional(24)) {
node.qualifier = parseEntityName(true, ts.Diagnostics.Type_expected);
}
- node.typeArguments = tryParseTypeArguments();
+ if (!scanner.hasPrecedingLineBreak() && reScanLessThanToken() === 28) {
+ node.typeArguments = parseBracketedList(20, parseType, 28, 30);
+ }
return finishNode(node);
}
function nextTokenIsNumericOrBigIntLiteral() {
@@ -15322,24 +15451,24 @@
}
function parseNonArrayType() {
switch (token()) {
- case 120:
- case 143:
- case 138:
- case 135:
- case 146:
+ case 121:
+ case 144:
case 139:
- case 123:
- case 141:
- case 132:
case 136:
+ case 147:
+ case 140:
+ case 124:
+ case 142:
+ case 133:
+ case 137:
return tryParse(parseKeywordAndNoDot) || parseTypeReference();
case 40:
return parseJSDocAllType(false);
- case 62:
+ case 63:
return parseJSDocAllType(true);
case 56:
return parseJSDocUnknownOrNullableType();
- case 90:
+ case 91:
return parseJSDocFunctionType();
case 52:
return parseJSDocNonNullableType();
@@ -15347,24 +15476,24 @@
case 10:
case 8:
case 9:
- case 102:
- case 87:
+ case 103:
+ case 88:
return parseLiteralTypeNode();
case 39:
return lookAhead(nextTokenIsNumericOrBigIntLiteral) ? parseLiteralTypeNode(true) : parseTypeReference();
- case 106:
- case 96:
+ case 107:
+ case 97:
return parseTokenNode();
- case 100: {
+ case 101: {
var thisKeyword = parseThisTypeNode();
- if (token() === 128 && !scanner.hasPrecedingLineBreak()) {
+ if (token() === 129 && !scanner.hasPrecedingLineBreak()) {
return parseThisTypePredicate(thisKeyword);
}
else {
return thisKeyword;
}
}
- case 104:
+ case 105:
return lookAhead(isStartOfTypeOfImportType) ? parseImportType() : parseTypeQuery();
case 18:
return lookAhead(isStartOfMappedType) ? parseMappedType() : parseTypeLiteral();
@@ -15372,7 +15501,7 @@
return parseTupleType();
case 20:
return parseParenthesizedType();
- case 92:
+ case 93:
return parseImportType();
default:
return parseTypeReference();
@@ -15380,41 +15509,41 @@
}
function isStartOfType(inStartOfParameter) {
switch (token()) {
- case 120:
- case 143:
- case 138:
- case 135:
- case 146:
- case 123:
- case 133:
+ case 121:
+ case 144:
case 139:
+ case 136:
+ case 147:
+ case 124:
+ case 134:
+ case 140:
+ case 143:
+ case 107:
case 142:
- case 106:
- case 141:
- case 96:
- case 100:
- case 104:
- case 132:
+ case 97:
+ case 101:
+ case 105:
+ case 133:
case 18:
case 22:
case 28:
case 50:
case 49:
- case 95:
+ case 96:
case 10:
case 8:
case 9:
- case 102:
- case 87:
- case 136:
+ case 103:
+ case 88:
+ case 137:
case 40:
case 56:
case 52:
case 25:
- case 127:
- case 92:
+ case 128:
+ case 93:
return true;
- case 90:
+ case 91:
return !inStartOfParameter;
case 39:
return !inStartOfParameter && lookAhead(nextTokenIsNumericOrBigIntLiteral);
@@ -15433,25 +15562,25 @@
while (!scanner.hasPrecedingLineBreak()) {
switch (token()) {
case 52:
- type = createPostfixType(292, type);
+ type = createPostfixType(293, type);
break;
case 56:
if (!(contextFlags & 2097152) && lookAhead(nextTokenIsStartOfType)) {
return type;
}
- type = createPostfixType(291, type);
+ type = createPostfixType(292, type);
break;
case 22:
parseExpected(22);
if (isStartOfType()) {
- var node = createNode(180, type.pos);
+ var node = createNode(181, type.pos);
node.objectType = type;
node.indexType = parseType();
parseExpected(23);
type = finishNode(node);
}
else {
- var node = createNode(169, type.pos);
+ var node = createNode(170, type.pos);
node.elementType = type;
parseExpected(23);
type = finishNode(node);
@@ -15470,16 +15599,16 @@
return finishNode(postfix);
}
function parseTypeOperator(operator) {
- var node = createNode(179);
+ var node = createNode(180);
parseExpected(operator);
node.operator = operator;
node.type = parseTypeOperatorOrHigher();
return finishNode(node);
}
function parseInferType() {
- var node = createNode(176);
- parseExpected(127);
- var typeParameter = createNode(150);
+ var node = createNode(177);
+ parseExpected(128);
+ var typeParameter = createNode(151);
typeParameter.name = parseIdentifier();
node.typeParameter = finishNode(typeParameter);
return finishNode(node);
@@ -15487,34 +15616,35 @@
function parseTypeOperatorOrHigher() {
var operator = token();
switch (operator) {
- case 129:
- case 142:
- case 133:
+ case 130:
+ case 143:
+ case 134:
return parseTypeOperator(operator);
- case 127:
+ case 128:
return parseInferType();
}
return parsePostfixTypeOrHigher();
}
function parseUnionOrIntersectionType(kind, parseConstituentType, operator) {
- parseOptional(operator);
+ var start = scanner.getStartPos();
+ var hasLeadingOperator = parseOptional(operator);
var type = parseConstituentType();
- if (token() === operator) {
+ if (token() === operator || hasLeadingOperator) {
var types = [type];
while (parseOptional(operator)) {
types.push(parseConstituentType());
}
- var node = createNode(kind, type.pos);
- node.types = createNodeArray(types, type.pos);
+ var node = createNode(kind, start);
+ node.types = createNodeArray(types, start);
type = finishNode(node);
}
return type;
}
function parseIntersectionTypeOrHigher() {
- return parseUnionOrIntersectionType(174, parseTypeOperatorOrHigher, 49);
+ return parseUnionOrIntersectionType(175, parseTypeOperatorOrHigher, 49);
}
function parseUnionTypeOrHigher() {
- return parseUnionOrIntersectionType(173, parseIntersectionTypeOrHigher, 50);
+ return parseUnionOrIntersectionType(174, parseIntersectionTypeOrHigher, 50);
}
function isStartOfFunctionType() {
if (token() === 28) {
@@ -15526,7 +15656,7 @@
if (ts.isModifierKind(token())) {
parseModifiers();
}
- if (isIdentifier() || token() === 100) {
+ if (isIdentifier() || token() === 101) {
nextToken();
return true;
}
@@ -15544,7 +15674,7 @@
}
if (skipParameterStart()) {
if (token() === 57 || token() === 27 ||
- token() === 56 || token() === 59) {
+ token() === 56 || token() === 60) {
return true;
}
if (token() === 21) {
@@ -15560,7 +15690,7 @@
var typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix);
var type = parseType();
if (typePredicateVariable) {
- var node = createNode(163, typePredicateVariable.pos);
+ var node = createNode(164, typePredicateVariable.pos);
node.parameterName = typePredicateVariable;
node.type = type;
return finishNode(node);
@@ -15571,7 +15701,7 @@
}
function parseTypePredicatePrefix() {
var id = parseIdentifier();
- if (token() === 128 && !scanner.hasPrecedingLineBreak()) {
+ if (token() === 129 && !scanner.hasPrecedingLineBreak()) {
nextToken();
return id;
}
@@ -15580,12 +15710,12 @@
return doOutsideOfContext(20480, parseTypeWorker);
}
function parseTypeWorker(noConditionalTypes) {
- if (isStartOfFunctionType() || token() === 95) {
+ if (isStartOfFunctionType() || token() === 96) {
return parseFunctionOrConstructorType();
}
var type = parseUnionTypeOrHigher();
- if (!noConditionalTypes && !scanner.hasPrecedingLineBreak() && parseOptional(86)) {
- var node = createNode(175, type.pos);
+ if (!noConditionalTypes && !scanner.hasPrecedingLineBreak() && parseOptional(87)) {
+ var node = createNode(176, type.pos);
node.checkType = type;
node.extendsType = parseTypeWorker(true);
parseExpected(56);
@@ -15601,11 +15731,11 @@
}
function isStartOfLeftHandSideExpression() {
switch (token()) {
- case 100:
- case 98:
- case 96:
- case 102:
- case 87:
+ case 101:
+ case 99:
+ case 97:
+ case 103:
+ case 88:
case 8:
case 9:
case 10:
@@ -15614,14 +15744,14 @@
case 20:
case 22:
case 18:
- case 90:
- case 76:
- case 95:
+ case 91:
+ case 77:
+ case 96:
case 42:
- case 64:
- case 72:
+ case 65:
+ case 73:
return true;
- case 92:
+ case 93:
return lookAhead(nextTokenIsOpenParenOrLessThanOrDot);
default:
return isIdentifier();
@@ -15636,14 +15766,14 @@
case 39:
case 53:
case 52:
- case 81:
- case 104:
- case 106:
+ case 82:
+ case 105:
+ case 107:
case 44:
case 45:
case 28:
- case 122:
- case 117:
+ case 123:
+ case 118:
return true;
default:
if (isBinaryOperator()) {
@@ -15654,8 +15784,8 @@
}
function isStartOfExpressionStatement() {
return token() !== 18 &&
- token() !== 90 &&
- token() !== 76 &&
+ token() !== 91 &&
+ token() !== 77 &&
token() !== 58 &&
isStartOfExpression();
}
@@ -15675,7 +15805,7 @@
return expr;
}
function parseInitializer() {
- return parseOptional(59) ? parseAssignmentExpressionOrHigher() : undefined;
+ return parseOptional(60) ? parseAssignmentExpressionOrHigher() : undefined;
}
function parseAssignmentExpressionOrHigher() {
if (isYieldExpression()) {
@@ -15686,7 +15816,7 @@
return arrowExpression;
}
var expr = parseBinaryExpressionOrHigher(0);
- if (expr.kind === 72 && token() === 37) {
+ if (expr.kind === 73 && token() === 37) {
return parseSimpleArrowFunctionExpression(expr);
}
if (ts.isLeftHandSideExpression(expr) && ts.isAssignmentOperator(reScanGreaterToken())) {
@@ -15695,7 +15825,7 @@
return parseConditionalExpressionRest(expr);
}
function isYieldExpression() {
- if (token() === 117) {
+ if (token() === 118) {
if (inYieldContext()) {
return true;
}
@@ -15708,7 +15838,7 @@
return !scanner.hasPrecedingLineBreak() && isIdentifier();
}
function parseYieldExpression() {
- var node = createNode(207);
+ var node = createNode(208);
nextToken();
if (!scanner.hasPrecedingLineBreak() &&
(token() === 40 || isStartOfExpression())) {
@@ -15724,13 +15854,13 @@
ts.Debug.assert(token() === 37, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
var node;
if (asyncModifier) {
- node = createNode(197, asyncModifier.pos);
+ node = createNode(198, asyncModifier.pos);
node.modifiers = asyncModifier;
}
else {
- node = createNode(197, identifier.pos);
+ node = createNode(198, identifier.pos);
}
- var parameter = createNode(151, identifier.pos);
+ var parameter = createNode(152, identifier.pos);
parameter.name = identifier;
finishNode(parameter);
node.parameters = createNodeArray([parameter], parameter.pos, parameter.end);
@@ -15758,7 +15888,7 @@
return finishNode(arrowFunction);
}
function isParenthesizedArrowFunctionExpression() {
- if (token() === 20 || token() === 28 || token() === 121) {
+ if (token() === 20 || token() === 28 || token() === 122) {
return lookAhead(isParenthesizedArrowFunctionExpressionWorker);
}
if (token() === 37) {
@@ -15767,7 +15897,7 @@
return 0;
}
function isParenthesizedArrowFunctionExpressionWorker() {
- if (token() === 121) {
+ if (token() === 122) {
nextToken();
if (scanner.hasPrecedingLineBreak()) {
return 0;
@@ -15796,10 +15926,10 @@
if (second === 25) {
return 1;
}
- if (ts.isModifierKind(second) && second !== 121 && lookAhead(nextTokenIsIdentifier)) {
+ if (ts.isModifierKind(second) && second !== 122 && lookAhead(nextTokenIsIdentifier)) {
return 1;
}
- if (!isIdentifier() && second !== 100) {
+ if (!isIdentifier() && second !== 101) {
return 0;
}
switch (nextToken()) {
@@ -15807,12 +15937,12 @@
return 1;
case 56:
nextToken();
- if (token() === 57 || token() === 27 || token() === 59 || token() === 21) {
+ if (token() === 57 || token() === 27 || token() === 60 || token() === 21) {
return 1;
}
return 0;
case 27:
- case 59:
+ case 60:
case 21:
return 2;
}
@@ -15826,10 +15956,10 @@
if (sourceFile.languageVariant === 1) {
var isArrowFunctionInJsx = lookAhead(function () {
var third = nextToken();
- if (third === 86) {
+ if (third === 87) {
var fourth = nextToken();
switch (fourth) {
- case 59:
+ case 60:
case 30:
return false;
default:
@@ -15853,7 +15983,7 @@
return parseParenthesizedArrowFunctionExpressionHead(false);
}
function tryParseAsyncSimpleArrowFunctionExpression() {
- if (token() === 121) {
+ if (token() === 122) {
if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1) {
var asyncModifier = parseModifiersForArrowFunction();
var expr = parseBinaryExpressionOrHigher(0);
@@ -15863,26 +15993,27 @@
return undefined;
}
function isUnParenthesizedAsyncArrowFunctionWorker() {
- if (token() === 121) {
+ if (token() === 122) {
nextToken();
if (scanner.hasPrecedingLineBreak() || token() === 37) {
return 0;
}
var expr = parseBinaryExpressionOrHigher(0);
- if (!scanner.hasPrecedingLineBreak() && expr.kind === 72 && token() === 37) {
+ if (!scanner.hasPrecedingLineBreak() && expr.kind === 73 && token() === 37) {
return 1;
}
}
return 0;
}
function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) {
- var node = createNodeWithJSDoc(197);
+ var node = createNodeWithJSDoc(198);
node.modifiers = parseModifiersForArrowFunction();
var isAsync = ts.hasModifier(node, 256) ? 2 : 0;
if (!fillSignature(57, isAsync, node) && !allowAmbiguity) {
return undefined;
}
- if (!allowAmbiguity && token() !== 37 && token() !== 18) {
+ var hasJSDocFunctionType = node.type && ts.isJSDocFunctionType(node.type);
+ if (!allowAmbiguity && token() !== 37 && (hasJSDocFunctionType || token() !== 18)) {
return undefined;
}
return node;
@@ -15892,8 +16023,8 @@
return parseFunctionBlock(isAsync ? 2 : 0);
}
if (token() !== 26 &&
- token() !== 90 &&
- token() !== 76 &&
+ token() !== 91 &&
+ token() !== 77 &&
isStartOfStatement() &&
!isStartOfExpressionStatement()) {
return parseFunctionBlock(16 | (isAsync ? 2 : 0));
@@ -15907,14 +16038,14 @@
if (!questionToken) {
return leftOperand;
}
- var node = createNode(205, leftOperand.pos);
+ var node = createNode(206, leftOperand.pos);
node.condition = leftOperand;
node.questionToken = questionToken;
node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher);
node.colonToken = parseExpectedToken(57);
node.whenFalse = ts.nodeIsPresent(node.colonToken)
? parseAssignmentExpressionOrHigher()
- : createMissingNode(72, false, ts.Diagnostics._0_expected, ts.tokenToString(57));
+ : createMissingNode(73, false, ts.Diagnostics._0_expected, ts.tokenToString(57));
return finishNode(node);
}
function parseBinaryExpressionOrHigher(precedence) {
@@ -15922,7 +16053,7 @@
return parseBinaryExpressionRest(precedence, leftOperand);
}
function isInOrOfKeyword(t) {
- return t === 93 || t === 147;
+ return t === 94 || t === 148;
}
function parseBinaryExpressionRest(precedence, leftOperand) {
while (true) {
@@ -15934,10 +16065,10 @@
if (!consumeCurrentOperator) {
break;
}
- if (token() === 93 && inDisallowInContext()) {
+ if (token() === 94 && inDisallowInContext()) {
break;
}
- if (token() === 119) {
+ if (token() === 120) {
if (scanner.hasPrecedingLineBreak()) {
break;
}
@@ -15953,51 +16084,51 @@
return leftOperand;
}
function isBinaryOperator() {
- if (inDisallowInContext() && token() === 93) {
+ if (inDisallowInContext() && token() === 94) {
return false;
}
return ts.getBinaryOperatorPrecedence(token()) > 0;
}
function makeBinaryExpression(left, operatorToken, right) {
- var node = createNode(204, left.pos);
+ var node = createNode(205, left.pos);
node.left = left;
node.operatorToken = operatorToken;
node.right = right;
return finishNode(node);
}
function makeAsExpression(left, right) {
- var node = createNode(212, left.pos);
+ var node = createNode(213, left.pos);
node.expression = left;
node.type = right;
return finishNode(node);
}
function parsePrefixUnaryExpression() {
- var node = createNode(202);
+ var node = createNode(203);
node.operator = token();
nextToken();
node.operand = parseSimpleUnaryExpression();
return finishNode(node);
}
function parseDeleteExpression() {
- var node = createNode(198);
+ var node = createNode(199);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
}
function parseTypeOfExpression() {
- var node = createNode(199);
+ var node = createNode(200);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
}
function parseVoidExpression() {
- var node = createNode(200);
+ var node = createNode(201);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
}
function isAwaitExpression() {
- if (token() === 122) {
+ if (token() === 123) {
if (inAwaitContext()) {
return true;
}
@@ -16006,7 +16137,7 @@
return false;
}
function parseAwaitExpression() {
- var node = createNode(201);
+ var node = createNode(202);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
@@ -16023,7 +16154,7 @@
if (token() === 41) {
var pos = ts.skipTrivia(sourceText, simpleUnaryExpression.pos);
var end = simpleUnaryExpression.end;
- if (simpleUnaryExpression.kind === 194) {
+ if (simpleUnaryExpression.kind === 195) {
parseErrorAt(pos, end, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses);
}
else {
@@ -16039,15 +16170,15 @@
case 53:
case 52:
return parsePrefixUnaryExpression();
- case 81:
+ case 82:
return parseDeleteExpression();
- case 104:
+ case 105:
return parseTypeOfExpression();
- case 106:
+ case 107:
return parseVoidExpression();
case 28:
return parseTypeAssertion();
- case 122:
+ case 123:
if (isAwaitExpression()) {
return parseAwaitExpression();
}
@@ -16061,10 +16192,10 @@
case 39:
case 53:
case 52:
- case 81:
- case 104:
- case 106:
- case 122:
+ case 82:
+ case 105:
+ case 107:
+ case 123:
return false;
case 28:
if (sourceFile.languageVariant !== 1) {
@@ -16076,7 +16207,7 @@
}
function parseUpdateExpression() {
if (token() === 44 || token() === 45) {
- var node = createNode(202);
+ var node = createNode(203);
node.operator = token();
nextToken();
node.operand = parseLeftHandSideExpressionOrHigher();
@@ -16088,7 +16219,7 @@
var expression = parseLeftHandSideExpressionOrHigher();
ts.Debug.assert(ts.isLeftHandSideExpression(expression));
if ((token() === 44 || token() === 45) && !scanner.hasPrecedingLineBreak()) {
- var node = createNode(203, expression.pos);
+ var node = createNode(204, expression.pos);
node.operand = expression;
node.operator = token();
nextToken();
@@ -16098,7 +16229,7 @@
}
function parseLeftHandSideExpressionOrHigher() {
var expression;
- if (token() === 92) {
+ if (token() === 93) {
if (lookAhead(nextTokenIsOpenParenOrLessThan)) {
sourceFile.flags |= 524288;
expression = parseTokenNode();
@@ -16107,8 +16238,8 @@
var fullStart = scanner.getStartPos();
nextToken();
nextToken();
- var node = createNode(214, fullStart);
- node.keywordToken = 92;
+ var node = createNode(215, fullStart);
+ node.keywordToken = 93;
node.name = parseIdentifierName();
expression = finishNode(node);
sourceFile.flags |= 1048576;
@@ -16118,7 +16249,7 @@
}
}
else {
- expression = token() === 98 ? parseSuperExpression() : parseMemberExpressionOrHigher();
+ expression = token() === 99 ? parseSuperExpression() : parseMemberExpressionOrHigher();
}
return parseCallExpressionRest(expression);
}
@@ -16128,10 +16259,17 @@
}
function parseSuperExpression() {
var expression = parseTokenNode();
+ if (token() === 28) {
+ var startPos = getNodePos();
+ var typeArguments = tryParse(parseTypeArgumentsInExpression);
+ if (typeArguments !== undefined) {
+ parseErrorAt(startPos, getNodePos(), ts.Diagnostics.super_may_not_use_type_arguments);
+ }
+ }
if (token() === 20 || token() === 24 || token() === 22) {
return expression;
}
- var node = createNode(189, expression.pos);
+ var node = createNode(190, expression.pos);
node.expression = expression;
parseExpectedToken(24, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access);
node.name = parseRightSideOfDot(true);
@@ -16140,8 +16278,8 @@
function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext) {
var opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext);
var result;
- if (opening.kind === 262) {
- var node = createNode(260, opening.pos);
+ if (opening.kind === 263) {
+ var node = createNode(261, opening.pos);
node.openingElement = opening;
node.children = parseJsxChildren(node.openingElement);
node.closingElement = parseJsxClosingElement(inExpressionContext);
@@ -16150,26 +16288,26 @@
}
result = finishNode(node);
}
- else if (opening.kind === 265) {
- var node = createNode(264, opening.pos);
+ else if (opening.kind === 266) {
+ var node = createNode(265, opening.pos);
node.openingFragment = opening;
node.children = parseJsxChildren(node.openingFragment);
node.closingFragment = parseJsxClosingFragment(inExpressionContext);
result = finishNode(node);
}
else {
- ts.Debug.assert(opening.kind === 261);
+ ts.Debug.assert(opening.kind === 262);
result = opening;
}
if (inExpressionContext && token() === 28) {
var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElementOrFragment(true); });
if (invalidElement) {
parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element);
- var badNode = createNode(204, result.pos);
+ var badNode = createNode(205, result.pos);
badNode.end = invalidElement.end;
badNode.left = result;
badNode.right = invalidElement;
- badNode.operatorToken = createMissingNode(27, false, undefined);
+ badNode.operatorToken = createMissingNode(27, false);
badNode.operatorToken.pos = badNode.operatorToken.end = badNode.right.pos;
return badNode;
}
@@ -16222,7 +16360,7 @@
return createNodeArray(list, listPos);
}
function parseJsxAttributes() {
- var jsxAttributes = createNode(268);
+ var jsxAttributes = createNode(269);
jsxAttributes.properties = parseList(13, parseJsxAttribute);
return finishNode(jsxAttributes);
}
@@ -16230,7 +16368,7 @@
var fullStart = scanner.getStartPos();
parseExpected(28);
if (token() === 30) {
- var node_1 = createNode(265, fullStart);
+ var node_1 = createNode(266, fullStart);
scanJsxText();
return finishNode(node_1);
}
@@ -16239,7 +16377,7 @@
var attributes = parseJsxAttributes();
var node;
if (token() === 30) {
- node = createNode(262, fullStart);
+ node = createNode(263, fullStart);
scanJsxText();
}
else {
@@ -16251,7 +16389,7 @@
parseExpected(30, undefined, false);
scanJsxText();
}
- node = createNode(261, fullStart);
+ node = createNode(262, fullStart);
}
node.tagName = tagName;
node.typeArguments = typeArguments;
@@ -16260,10 +16398,10 @@
}
function parseJsxElementName() {
scanJsxIdentifier();
- var expression = token() === 100 ?
+ var expression = token() === 101 ?
parseTokenNode() : parseIdentifierName();
while (parseOptional(24)) {
- var propertyAccess = createNode(189, expression.pos);
+ var propertyAccess = createNode(190, expression.pos);
propertyAccess.expression = expression;
propertyAccess.name = parseRightSideOfDot(true);
expression = finishNode(propertyAccess);
@@ -16271,7 +16409,7 @@
return expression;
}
function parseJsxExpression(inExpressionContext) {
- var node = createNode(270);
+ var node = createNode(271);
if (!parseExpected(18)) {
return undefined;
}
@@ -16293,9 +16431,9 @@
return parseJsxSpreadAttribute();
}
scanJsxIdentifier();
- var node = createNode(267);
+ var node = createNode(268);
node.name = parseIdentifierName();
- if (token() === 59) {
+ if (token() === 60) {
switch (scanJsxAttributeValue()) {
case 10:
node.initializer = parseLiteralNode();
@@ -16308,7 +16446,7 @@
return finishNode(node);
}
function parseJsxSpreadAttribute() {
- var node = createNode(269);
+ var node = createNode(270);
parseExpected(18);
parseExpected(25);
node.expression = parseExpression();
@@ -16316,7 +16454,7 @@
return finishNode(node);
}
function parseJsxClosingElement(inExpressionContext) {
- var node = createNode(263);
+ var node = createNode(264);
parseExpected(29);
node.tagName = parseJsxElementName();
if (inExpressionContext) {
@@ -16329,7 +16467,7 @@
return finishNode(node);
}
function parseJsxClosingFragment(inExpressionContext) {
- var node = createNode(266);
+ var node = createNode(267);
parseExpected(29);
if (ts.tokenIsIdentifierOrKeyword(token())) {
parseErrorAtRange(parseJsxElementName(), ts.Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment);
@@ -16344,7 +16482,7 @@
return finishNode(node);
}
function parseTypeAssertion() {
- var node = createNode(194);
+ var node = createNode(195);
parseExpected(28);
node.type = parseType();
parseExpected(30);
@@ -16355,7 +16493,7 @@
while (true) {
var dotToken = parseOptionalToken(24);
if (dotToken) {
- var propertyAccess = createNode(189, expression.pos);
+ var propertyAccess = createNode(190, expression.pos);
propertyAccess.expression = expression;
propertyAccess.name = parseRightSideOfDot(true);
expression = finishNode(propertyAccess);
@@ -16363,16 +16501,16 @@
}
if (token() === 52 && !scanner.hasPrecedingLineBreak()) {
nextToken();
- var nonNullExpression = createNode(213, expression.pos);
+ var nonNullExpression = createNode(214, expression.pos);
nonNullExpression.expression = expression;
expression = finishNode(nonNullExpression);
continue;
}
if (!inDecoratorContext() && parseOptional(22)) {
- var indexedAccess = createNode(190, expression.pos);
+ var indexedAccess = createNode(191, expression.pos);
indexedAccess.expression = expression;
if (token() === 23) {
- indexedAccess.argumentExpression = createMissingNode(72, true, ts.Diagnostics.An_element_access_expression_should_take_an_argument);
+ indexedAccess.argumentExpression = createMissingNode(73, true, ts.Diagnostics.An_element_access_expression_should_take_an_argument);
}
else {
var argument = allowInAnd(parseExpression);
@@ -16396,7 +16534,7 @@
return token() === 14 || token() === 15;
}
function parseTaggedTemplateRest(tag, typeArguments) {
- var tagExpression = createNode(193, tag.pos);
+ var tagExpression = createNode(194, tag.pos);
tagExpression.tag = tag;
tagExpression.typeArguments = typeArguments;
tagExpression.template = token() === 14
@@ -16416,7 +16554,7 @@
expression = parseTaggedTemplateRest(expression, typeArguments);
continue;
}
- var callExpr = createNode(191, expression.pos);
+ var callExpr = createNode(192, expression.pos);
callExpr.expression = expression;
callExpr.typeArguments = typeArguments;
callExpr.arguments = parseArgumentList();
@@ -16424,7 +16562,7 @@
continue;
}
else if (token() === 20) {
- var callExpr = createNode(191, expression.pos);
+ var callExpr = createNode(192, expression.pos);
callExpr.expression = expression;
callExpr.arguments = parseArgumentList();
expression = finishNode(callExpr);
@@ -16488,11 +16626,11 @@
case 10:
case 14:
return parseLiteralNode();
- case 100:
- case 98:
- case 96:
- case 102:
- case 87:
+ case 101:
+ case 99:
+ case 97:
+ case 103:
+ case 88:
return parseTokenNode();
case 20:
return parseParenthesizedExpression();
@@ -16500,19 +16638,19 @@
return parseArrayLiteralExpression();
case 18:
return parseObjectLiteralExpression();
- case 121:
+ case 122:
if (!lookAhead(nextTokenIsFunctionKeywordOnSameLine)) {
break;
}
return parseFunctionExpression();
- case 76:
+ case 77:
return parseClassExpression();
- case 90:
+ case 91:
return parseFunctionExpression();
- case 95:
+ case 96:
return parseNewExpressionOrNewDotTarget();
case 42:
- case 64:
+ case 65:
if (reScanSlashToken() === 13) {
return parseLiteralNode();
}
@@ -16523,28 +16661,28 @@
return parseIdentifier(ts.Diagnostics.Expression_expected);
}
function parseParenthesizedExpression() {
- var node = createNodeWithJSDoc(195);
+ var node = createNodeWithJSDoc(196);
parseExpected(20);
node.expression = allowInAnd(parseExpression);
parseExpected(21);
return finishNode(node);
}
function parseSpreadElement() {
- var node = createNode(208);
+ var node = createNode(209);
parseExpected(25);
node.expression = parseAssignmentExpressionOrHigher();
return finishNode(node);
}
function parseArgumentOrArrayLiteralElement() {
return token() === 25 ? parseSpreadElement() :
- token() === 27 ? createNode(210) :
+ token() === 27 ? createNode(211) :
parseAssignmentExpressionOrHigher();
}
function parseArgumentExpression() {
return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement);
}
function parseArrayLiteralExpression() {
- var node = createNode(187);
+ var node = createNode(188);
parseExpected(22);
if (scanner.hasPrecedingLineBreak()) {
node.multiLine = true;
@@ -16556,18 +16694,18 @@
function parseObjectLiteralElement() {
var node = createNodeWithJSDoc(0);
if (parseOptionalToken(25)) {
- node.kind = 277;
+ node.kind = 278;
node.expression = parseAssignmentExpressionOrHigher();
return finishNode(node);
}
node.decorators = parseDecorators();
node.modifiers = parseModifiers();
- if (parseContextualModifier(126)) {
- return parseAccessorDeclaration(node, 158);
- }
- if (parseContextualModifier(137)) {
+ if (parseContextualModifier(127)) {
return parseAccessorDeclaration(node, 159);
}
+ if (parseContextualModifier(138)) {
+ return parseAccessorDeclaration(node, 160);
+ }
var asteriskToken = parseOptionalToken(40);
var tokenIsIdentifier = isIdentifier();
node.name = parsePropertyName();
@@ -16578,22 +16716,22 @@
}
var isShorthandPropertyAssignment = tokenIsIdentifier && (token() !== 57);
if (isShorthandPropertyAssignment) {
- node.kind = 276;
- var equalsToken = parseOptionalToken(59);
+ node.kind = 277;
+ var equalsToken = parseOptionalToken(60);
if (equalsToken) {
node.equalsToken = equalsToken;
node.objectAssignmentInitializer = allowInAnd(parseAssignmentExpressionOrHigher);
}
}
else {
- node.kind = 275;
+ node.kind = 276;
parseExpected(57);
node.initializer = allowInAnd(parseAssignmentExpressionOrHigher);
}
return finishNode(node);
}
function parseObjectLiteralExpression() {
- var node = createNode(188);
+ var node = createNode(189);
parseExpected(18);
if (scanner.hasPrecedingLineBreak()) {
node.multiLine = true;
@@ -16607,9 +16745,9 @@
if (saveDecoratorContext) {
setDecoratorContext(false);
}
- var node = createNodeWithJSDoc(196);
+ var node = createNodeWithJSDoc(197);
node.modifiers = parseModifiers();
- parseExpected(90);
+ parseExpected(91);
node.asteriskToken = parseOptionalToken(40);
var isGenerator = node.asteriskToken ? 1 : 0;
var isAsync = ts.hasModifier(node, 256) ? 2 : 0;
@@ -16630,10 +16768,10 @@
}
function parseNewExpressionOrNewDotTarget() {
var fullStart = scanner.getStartPos();
- parseExpected(95);
+ parseExpected(96);
if (parseOptional(24)) {
- var node_2 = createNode(214, fullStart);
- node_2.keywordToken = 95;
+ var node_2 = createNode(215, fullStart);
+ node_2.keywordToken = 96;
node_2.name = parseIdentifierName();
return finishNode(node_2);
}
@@ -16649,7 +16787,7 @@
}
break;
}
- var node = createNode(192, fullStart);
+ var node = createNode(193, fullStart);
node.expression = expression;
node.typeArguments = typeArguments;
if (node.typeArguments || token() === 20) {
@@ -16658,7 +16796,7 @@
return finishNode(node);
}
function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) {
- var node = createNode(218);
+ var node = createNode(219);
if (parseExpected(18, diagnosticMessage) || ignoreMissingOpenBrace) {
if (scanner.hasPrecedingLineBreak()) {
node.multiLine = true;
@@ -16689,25 +16827,25 @@
return block;
}
function parseEmptyStatement() {
- var node = createNode(220);
+ var node = createNode(221);
parseExpected(26);
return finishNode(node);
}
function parseIfStatement() {
- var node = createNode(222);
- parseExpected(91);
+ var node = createNode(223);
+ parseExpected(92);
parseExpected(20);
node.expression = allowInAnd(parseExpression);
parseExpected(21);
node.thenStatement = parseStatement();
- node.elseStatement = parseOptional(83) ? parseStatement() : undefined;
+ node.elseStatement = parseOptional(84) ? parseStatement() : undefined;
return finishNode(node);
}
function parseDoStatement() {
- var node = createNode(223);
- parseExpected(82);
+ var node = createNode(224);
+ parseExpected(83);
node.statement = parseStatement();
- parseExpected(107);
+ parseExpected(108);
parseExpected(20);
node.expression = allowInAnd(parseExpression);
parseExpected(21);
@@ -16715,8 +16853,8 @@
return finishNode(node);
}
function parseWhileStatement() {
- var node = createNode(224);
- parseExpected(107);
+ var node = createNode(225);
+ parseExpected(108);
parseExpected(20);
node.expression = allowInAnd(parseExpression);
parseExpected(21);
@@ -16725,12 +16863,12 @@
}
function parseForOrForInOrForOfStatement() {
var pos = getNodePos();
- parseExpected(89);
- var awaitToken = parseOptionalToken(122);
+ parseExpected(90);
+ var awaitToken = parseOptionalToken(123);
parseExpected(20);
var initializer;
if (token() !== 26) {
- if (token() === 105 || token() === 111 || token() === 77) {
+ if (token() === 106 || token() === 112 || token() === 78) {
initializer = parseVariableDeclarationList(true);
}
else {
@@ -16738,23 +16876,23 @@
}
}
var forOrForInOrForOfStatement;
- if (awaitToken ? parseExpected(147) : parseOptional(147)) {
- var forOfStatement = createNode(227, pos);
+ if (awaitToken ? parseExpected(148) : parseOptional(148)) {
+ var forOfStatement = createNode(228, pos);
forOfStatement.awaitModifier = awaitToken;
forOfStatement.initializer = initializer;
forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher);
parseExpected(21);
forOrForInOrForOfStatement = forOfStatement;
}
- else if (parseOptional(93)) {
- var forInStatement = createNode(226, pos);
+ else if (parseOptional(94)) {
+ var forInStatement = createNode(227, pos);
forInStatement.initializer = initializer;
forInStatement.expression = allowInAnd(parseExpression);
parseExpected(21);
forOrForInOrForOfStatement = forInStatement;
}
else {
- var forStatement = createNode(225, pos);
+ var forStatement = createNode(226, pos);
forStatement.initializer = initializer;
parseExpected(26);
if (token() !== 26 && token() !== 21) {
@@ -16772,7 +16910,7 @@
}
function parseBreakOrContinueStatement(kind) {
var node = createNode(kind);
- parseExpected(kind === 229 ? 73 : 78);
+ parseExpected(kind === 230 ? 74 : 79);
if (!canParseSemicolon()) {
node.label = parseIdentifier();
}
@@ -16780,8 +16918,8 @@
return finishNode(node);
}
function parseReturnStatement() {
- var node = createNode(230);
- parseExpected(97);
+ var node = createNode(231);
+ parseExpected(98);
if (!canParseSemicolon()) {
node.expression = allowInAnd(parseExpression);
}
@@ -16789,8 +16927,8 @@
return finishNode(node);
}
function parseWithStatement() {
- var node = createNode(231);
- parseExpected(108);
+ var node = createNode(232);
+ parseExpected(109);
parseExpected(20);
node.expression = allowInAnd(parseExpression);
parseExpected(21);
@@ -16798,30 +16936,30 @@
return finishNode(node);
}
function parseCaseClause() {
- var node = createNode(271);
- parseExpected(74);
+ var node = createNode(272);
+ parseExpected(75);
node.expression = allowInAnd(parseExpression);
parseExpected(57);
node.statements = parseList(3, parseStatement);
return finishNode(node);
}
function parseDefaultClause() {
- var node = createNode(272);
- parseExpected(80);
+ var node = createNode(273);
+ parseExpected(81);
parseExpected(57);
node.statements = parseList(3, parseStatement);
return finishNode(node);
}
function parseCaseOrDefaultClause() {
- return token() === 74 ? parseCaseClause() : parseDefaultClause();
+ return token() === 75 ? parseCaseClause() : parseDefaultClause();
}
function parseSwitchStatement() {
- var node = createNode(232);
- parseExpected(99);
+ var node = createNode(233);
+ parseExpected(100);
parseExpected(20);
node.expression = allowInAnd(parseExpression);
parseExpected(21);
- var caseBlock = createNode(246);
+ var caseBlock = createNode(247);
parseExpected(18);
caseBlock.clauses = parseList(2, parseCaseOrDefaultClause);
parseExpected(19);
@@ -16829,26 +16967,26 @@
return finishNode(node);
}
function parseThrowStatement() {
- var node = createNode(234);
- parseExpected(101);
+ var node = createNode(235);
+ parseExpected(102);
node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression);
parseSemicolon();
return finishNode(node);
}
function parseTryStatement() {
- var node = createNode(235);
- parseExpected(103);
+ var node = createNode(236);
+ parseExpected(104);
node.tryBlock = parseBlock(false);
- node.catchClause = token() === 75 ? parseCatchClause() : undefined;
- if (!node.catchClause || token() === 88) {
- parseExpected(88);
+ node.catchClause = token() === 76 ? parseCatchClause() : undefined;
+ if (!node.catchClause || token() === 89) {
+ parseExpected(89);
node.finallyBlock = parseBlock(false);
}
return finishNode(node);
}
function parseCatchClause() {
- var result = createNode(274);
- parseExpected(75);
+ var result = createNode(275);
+ parseExpected(76);
if (parseOptional(20)) {
result.variableDeclaration = parseVariableDeclaration();
parseExpected(21);
@@ -16860,21 +16998,21 @@
return finishNode(result);
}
function parseDebuggerStatement() {
- var node = createNode(236);
- parseExpected(79);
+ var node = createNode(237);
+ parseExpected(80);
parseSemicolon();
return finishNode(node);
}
function parseExpressionOrLabeledStatement() {
var node = createNodeWithJSDoc(0);
var expression = allowInAnd(parseExpression);
- if (expression.kind === 72 && parseOptional(57)) {
- node.kind = 233;
+ if (expression.kind === 73 && parseOptional(57)) {
+ node.kind = 234;
node.label = expression;
node.statement = parseStatement();
}
else {
- node.kind = 221;
+ node.kind = 222;
node.expression = expression;
parseSemicolon();
}
@@ -16886,11 +17024,11 @@
}
function nextTokenIsClassKeywordOnSameLine() {
nextToken();
- return token() === 76 && !scanner.hasPrecedingLineBreak();
+ return token() === 77 && !scanner.hasPrecedingLineBreak();
}
function nextTokenIsFunctionKeywordOnSameLine() {
nextToken();
- return token() === 90 && !scanner.hasPrecedingLineBreak();
+ return token() === 91 && !scanner.hasPrecedingLineBreak();
}
function nextTokenIsIdentifierOrKeywordOrLiteralOnSameLine() {
nextToken();
@@ -16899,47 +17037,47 @@
function isDeclaration() {
while (true) {
switch (token()) {
- case 105:
- case 111:
+ case 106:
+ case 112:
+ case 78:
+ case 91:
case 77:
- case 90:
- case 76:
- case 84:
+ case 85:
return true;
- case 110:
- case 140:
+ case 111:
+ case 141:
return nextTokenIsIdentifierOnSameLine();
- case 130:
case 131:
+ case 132:
return nextTokenIsIdentifierOrStringLiteralOnSameLine();
- case 118:
- case 121:
- case 125:
- case 113:
+ case 119:
+ case 122:
+ case 126:
case 114:
case 115:
- case 133:
+ case 116:
+ case 134:
nextToken();
if (scanner.hasPrecedingLineBreak()) {
return false;
}
continue;
- case 145:
+ case 146:
nextToken();
- return token() === 18 || token() === 72 || token() === 85;
- case 92:
+ return token() === 18 || token() === 73 || token() === 86;
+ case 93:
nextToken();
return token() === 10 || token() === 40 ||
token() === 18 || ts.tokenIsIdentifierOrKeyword(token());
- case 85:
+ case 86:
nextToken();
- if (token() === 59 || token() === 40 ||
- token() === 18 || token() === 80 ||
- token() === 119) {
+ if (token() === 60 || token() === 40 ||
+ token() === 18 || token() === 81 ||
+ token() === 120) {
return true;
}
continue;
- case 116:
+ case 117:
nextToken();
continue;
default:
@@ -16955,44 +17093,44 @@
case 58:
case 26:
case 18:
- case 105:
- case 111:
- case 90:
- case 76:
- case 84:
+ case 106:
+ case 112:
case 91:
- case 82:
- case 107:
- case 89:
- case 78:
- case 73:
- case 97:
+ case 77:
+ case 85:
+ case 92:
+ case 83:
case 108:
- case 99:
- case 101:
- case 103:
+ case 90:
case 79:
- case 75:
- case 88:
+ case 74:
+ case 98:
+ case 109:
+ case 100:
+ case 102:
+ case 104:
+ case 80:
+ case 76:
+ case 89:
return true;
- case 92:
+ case 93:
return isStartOfDeclaration() || lookAhead(nextTokenIsOpenParenOrLessThanOrDot);
- case 77:
- case 85:
+ case 78:
+ case 86:
return isStartOfDeclaration();
- case 121:
- case 125:
- case 110:
- case 130:
+ case 122:
+ case 126:
+ case 111:
case 131:
- case 140:
- case 145:
+ case 132:
+ case 141:
+ case 146:
return true;
- case 115:
- case 113:
- case 114:
case 116:
- case 133:
+ case 114:
+ case 115:
+ case 117:
+ case 134:
return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine);
default:
return isStartOfExpression();
@@ -17011,62 +17149,62 @@
return parseEmptyStatement();
case 18:
return parseBlock(false);
- case 105:
- return parseVariableStatement(createNodeWithJSDoc(237));
- case 111:
+ case 106:
+ return parseVariableStatement(createNodeWithJSDoc(238));
+ case 112:
if (isLetDeclaration()) {
- return parseVariableStatement(createNodeWithJSDoc(237));
+ return parseVariableStatement(createNodeWithJSDoc(238));
}
break;
- case 90:
- return parseFunctionDeclaration(createNodeWithJSDoc(239));
- case 76:
- return parseClassDeclaration(createNodeWithJSDoc(240));
case 91:
+ return parseFunctionDeclaration(createNodeWithJSDoc(240));
+ case 77:
+ return parseClassDeclaration(createNodeWithJSDoc(241));
+ case 92:
return parseIfStatement();
- case 82:
+ case 83:
return parseDoStatement();
- case 107:
+ case 108:
return parseWhileStatement();
- case 89:
+ case 90:
return parseForOrForInOrForOfStatement();
- case 78:
- return parseBreakOrContinueStatement(228);
- case 73:
+ case 79:
return parseBreakOrContinueStatement(229);
- case 97:
+ case 74:
+ return parseBreakOrContinueStatement(230);
+ case 98:
return parseReturnStatement();
- case 108:
+ case 109:
return parseWithStatement();
- case 99:
+ case 100:
return parseSwitchStatement();
- case 101:
+ case 102:
return parseThrowStatement();
- case 103:
- case 75:
- case 88:
+ case 104:
+ case 76:
+ case 89:
return parseTryStatement();
- case 79:
+ case 80:
return parseDebuggerStatement();
case 58:
return parseDeclaration();
- case 121:
- case 110:
- case 140:
- case 130:
+ case 122:
+ case 111:
+ case 141:
case 131:
- case 125:
- case 77:
- case 84:
+ case 132:
+ case 126:
+ case 78:
case 85:
- case 92:
- case 113:
+ case 86:
+ case 93:
case 114:
case 115:
- case 118:
case 116:
- case 133:
- case 145:
+ case 119:
+ case 117:
+ case 134:
+ case 146:
if (isStartOfDeclaration()) {
return parseDeclaration();
}
@@ -17075,7 +17213,7 @@
return parseExpressionOrLabeledStatement();
}
function isDeclareModifier(modifier) {
- return modifier.kind === 125;
+ return modifier.kind === 126;
}
function parseDeclaration() {
var node = createNodeWithJSDoc(0);
@@ -17094,40 +17232,40 @@
}
function parseDeclarationWorker(node) {
switch (token()) {
- case 105:
- case 111:
- case 77:
+ case 106:
+ case 112:
+ case 78:
return parseVariableStatement(node);
- case 90:
+ case 91:
return parseFunctionDeclaration(node);
- case 76:
+ case 77:
return parseClassDeclaration(node);
- case 110:
+ case 111:
return parseInterfaceDeclaration(node);
- case 140:
+ case 141:
return parseTypeAliasDeclaration(node);
- case 84:
+ case 85:
return parseEnumDeclaration(node);
- case 145:
- case 130:
+ case 146:
case 131:
+ case 132:
return parseModuleDeclaration(node);
- case 92:
+ case 93:
return parseImportDeclarationOrImportEqualsDeclaration(node);
- case 85:
+ case 86:
nextToken();
switch (token()) {
- case 80:
- case 59:
+ case 81:
+ case 60:
return parseExportAssignment(node);
- case 119:
+ case 120:
return parseNamespaceExportDeclaration(node);
default:
return parseExportDeclaration(node);
}
default:
if (node.decorators || node.modifiers) {
- var missing = createMissingNode(258, true, ts.Diagnostics.Declaration_expected);
+ var missing = createMissingNode(259, true, ts.Diagnostics.Declaration_expected);
missing.pos = node.pos;
missing.decorators = node.decorators;
missing.modifiers = node.modifiers;
@@ -17149,16 +17287,16 @@
}
function parseArrayBindingElement() {
if (token() === 27) {
- return createNode(210);
+ return createNode(211);
}
- var node = createNode(186);
+ var node = createNode(187);
node.dotDotDotToken = parseOptionalToken(25);
node.name = parseIdentifierOrPattern();
node.initializer = parseInitializer();
return finishNode(node);
}
function parseObjectBindingElement() {
- var node = createNode(186);
+ var node = createNode(187);
node.dotDotDotToken = parseOptionalToken(25);
var tokenIsIdentifier = isIdentifier();
var propertyName = parsePropertyName();
@@ -17174,14 +17312,14 @@
return finishNode(node);
}
function parseObjectBindingPattern() {
- var node = createNode(184);
+ var node = createNode(185);
parseExpected(18);
node.elements = parseDelimitedList(9, parseObjectBindingElement);
parseExpected(19);
return finishNode(node);
}
function parseArrayBindingPattern() {
- var node = createNode(185);
+ var node = createNode(186);
parseExpected(22);
node.elements = parseDelimitedList(10, parseArrayBindingElement);
parseExpected(23);
@@ -17203,9 +17341,9 @@
return parseVariableDeclaration(true);
}
function parseVariableDeclaration(allowExclamation) {
- var node = createNode(237);
+ var node = createNode(238);
node.name = parseIdentifierOrPattern();
- if (allowExclamation && node.name.kind === 72 &&
+ if (allowExclamation && node.name.kind === 73 &&
token() === 52 && !scanner.hasPrecedingLineBreak()) {
node.exclamationToken = parseTokenNode();
}
@@ -17216,21 +17354,21 @@
return finishNode(node);
}
function parseVariableDeclarationList(inForStatementInitializer) {
- var node = createNode(238);
+ var node = createNode(239);
switch (token()) {
- case 105:
+ case 106:
break;
- case 111:
+ case 112:
node.flags |= 1;
break;
- case 77:
+ case 78:
node.flags |= 2;
break;
default:
ts.Debug.fail();
}
nextToken();
- if (token() === 147 && lookAhead(canFollowContextualOfKeyword)) {
+ if (token() === 148 && lookAhead(canFollowContextualOfKeyword)) {
node.declarations = createMissingList();
}
else {
@@ -17245,14 +17383,14 @@
return nextTokenIsIdentifier() && nextToken() === 21;
}
function parseVariableStatement(node) {
- node.kind = 219;
+ node.kind = 220;
node.declarationList = parseVariableDeclarationList(false);
parseSemicolon();
return finishNode(node);
}
function parseFunctionDeclaration(node) {
- node.kind = 239;
- parseExpected(90);
+ node.kind = 240;
+ parseExpected(91);
node.asteriskToken = parseOptionalToken(40);
node.name = ts.hasModifier(node, 512) ? parseOptionalIdentifier() : parseIdentifier();
var isGenerator = node.asteriskToken ? 1 : 0;
@@ -17262,14 +17400,14 @@
return finishNode(node);
}
function parseConstructorDeclaration(node) {
- node.kind = 157;
- parseExpected(124);
+ node.kind = 158;
+ parseExpected(125);
fillSignature(57, 0, node);
node.body = parseFunctionBlockOrSemicolon(0, ts.Diagnostics.or_expected);
return finishNode(node);
}
function parseMethodDeclaration(node, asteriskToken, diagnosticMessage) {
- node.kind = 156;
+ node.kind = 157;
node.asteriskToken = asteriskToken;
var isGenerator = asteriskToken ? 1 : 0;
var isAsync = ts.hasModifier(node, 256) ? 2 : 0;
@@ -17278,7 +17416,7 @@
return finishNode(node);
}
function parsePropertyDeclaration(node) {
- node.kind = 154;
+ node.kind = 155;
if (!node.questionToken && token() === 52 && !scanner.hasPrecedingLineBreak()) {
node.exclamationToken = parseTokenNode();
}
@@ -17328,7 +17466,7 @@
return true;
}
if (idToken !== undefined) {
- if (!ts.isKeyword(idToken) || idToken === 137 || idToken === 126) {
+ if (!ts.isKeyword(idToken) || idToken === 138 || idToken === 127) {
return true;
}
switch (token()) {
@@ -17336,7 +17474,7 @@
case 28:
case 52:
case 57:
- case 59:
+ case 60:
case 56:
return true;
default:
@@ -17353,7 +17491,7 @@
if (!parseOptional(58)) {
break;
}
- var decorator = createNode(152, decoratorStart);
+ var decorator = createNode(153, decoratorStart);
decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher);
finishNode(decorator);
(list || (list = [])).push(decorator);
@@ -17366,7 +17504,7 @@
while (true) {
var modifierStart = scanner.getStartPos();
var modifierKind = token();
- if (token() === 77 && permitInvalidConstAsModifier) {
+ if (token() === 78 && permitInvalidConstAsModifier) {
if (!tryParse(nextTokenIsOnSameLineAndCanFollowModifier)) {
break;
}
@@ -17383,7 +17521,7 @@
}
function parseModifiersForArrowFunction() {
var modifiers;
- if (token() === 121) {
+ if (token() === 122) {
var modifierStart = scanner.getStartPos();
var modifierKind = token();
nextToken();
@@ -17394,20 +17532,20 @@
}
function parseClassElement() {
if (token() === 26) {
- var result = createNode(217);
+ var result = createNode(218);
nextToken();
return finishNode(result);
}
var node = createNodeWithJSDoc(0);
node.decorators = parseDecorators();
node.modifiers = parseModifiers(true);
- if (parseContextualModifier(126)) {
- return parseAccessorDeclaration(node, 158);
- }
- if (parseContextualModifier(137)) {
+ if (parseContextualModifier(127)) {
return parseAccessorDeclaration(node, 159);
}
- if (token() === 124) {
+ if (parseContextualModifier(138)) {
+ return parseAccessorDeclaration(node, 160);
+ }
+ if (token() === 125) {
return parseConstructorDeclaration(node);
}
if (isIndexSignature()) {
@@ -17421,20 +17559,20 @@
return parsePropertyOrMethodDeclaration(node);
}
if (node.decorators || node.modifiers) {
- node.name = createMissingNode(72, true, ts.Diagnostics.Declaration_expected);
+ node.name = createMissingNode(73, true, ts.Diagnostics.Declaration_expected);
return parsePropertyDeclaration(node);
}
return ts.Debug.fail("Should not have attempted to parse class member declaration.");
}
function parseClassExpression() {
- return parseClassDeclarationOrExpression(createNodeWithJSDoc(0), 209);
+ return parseClassDeclarationOrExpression(createNodeWithJSDoc(0), 210);
}
function parseClassDeclaration(node) {
- return parseClassDeclarationOrExpression(node, 240);
+ return parseClassDeclarationOrExpression(node, 241);
}
function parseClassDeclarationOrExpression(node, kind) {
node.kind = kind;
- parseExpected(76);
+ parseExpected(77);
node.name = parseNameOfClassDeclarationOrExpression();
node.typeParameters = parseTypeParameters();
node.heritageClauses = parseHeritageClauses();
@@ -17453,7 +17591,7 @@
: undefined;
}
function isImplementsClause() {
- return token() === 109 && lookAhead(nextTokenIsIdentifierOrKeyword);
+ return token() === 110 && lookAhead(nextTokenIsIdentifierOrKeyword);
}
function parseHeritageClauses() {
if (isHeritageClause()) {
@@ -17463,15 +17601,15 @@
}
function parseHeritageClause() {
var tok = token();
- ts.Debug.assert(tok === 86 || tok === 109);
- var node = createNode(273);
+ ts.Debug.assert(tok === 87 || tok === 110);
+ var node = createNode(274);
node.token = tok;
nextToken();
node.types = parseDelimitedList(7, parseExpressionWithTypeArguments);
return finishNode(node);
}
function parseExpressionWithTypeArguments() {
- var node = createNode(211);
+ var node = createNode(212);
node.expression = parseLeftHandSideExpressionOrHigher();
node.typeArguments = tryParseTypeArguments();
return finishNode(node);
@@ -17482,14 +17620,14 @@
: undefined;
}
function isHeritageClause() {
- return token() === 86 || token() === 109;
+ return token() === 87 || token() === 110;
}
function parseClassMembers() {
return parseList(5, parseClassElement);
}
function parseInterfaceDeclaration(node) {
- node.kind = 241;
- parseExpected(110);
+ node.kind = 242;
+ parseExpected(111);
node.name = parseIdentifier();
node.typeParameters = parseTypeParameters();
node.heritageClauses = parseHeritageClauses();
@@ -17497,24 +17635,24 @@
return finishNode(node);
}
function parseTypeAliasDeclaration(node) {
- node.kind = 242;
- parseExpected(140);
+ node.kind = 243;
+ parseExpected(141);
node.name = parseIdentifier();
node.typeParameters = parseTypeParameters();
- parseExpected(59);
+ parseExpected(60);
node.type = parseType();
parseSemicolon();
return finishNode(node);
}
function parseEnumMember() {
- var node = createNodeWithJSDoc(278);
+ var node = createNodeWithJSDoc(279);
node.name = parsePropertyName();
node.initializer = allowInAnd(parseInitializer);
return finishNode(node);
}
function parseEnumDeclaration(node) {
- node.kind = 243;
- parseExpected(84);
+ node.kind = 244;
+ parseExpected(85);
node.name = parseIdentifier();
if (parseExpected(18)) {
node.members = parseDelimitedList(6, parseEnumMember);
@@ -17526,7 +17664,7 @@
return finishNode(node);
}
function parseModuleBlock() {
- var node = createNode(245);
+ var node = createNode(246);
if (parseExpected(18)) {
node.statements = parseList(1, parseStatement);
parseExpected(19);
@@ -17537,7 +17675,7 @@
return finishNode(node);
}
function parseModuleOrNamespaceDeclaration(node, flags) {
- node.kind = 244;
+ node.kind = 245;
var namespaceFlag = flags & 16;
node.flags |= flags;
node.name = parseIdentifier();
@@ -17547,8 +17685,8 @@
return finishNode(node);
}
function parseAmbientExternalModuleDeclaration(node) {
- node.kind = 244;
- if (token() === 145) {
+ node.kind = 245;
+ if (token() === 146) {
node.name = parseIdentifier();
node.flags |= 512;
}
@@ -17566,14 +17704,14 @@
}
function parseModuleDeclaration(node) {
var flags = 0;
- if (token() === 145) {
+ if (token() === 146) {
return parseAmbientExternalModuleDeclaration(node);
}
- else if (parseOptional(131)) {
+ else if (parseOptional(132)) {
flags |= 16;
}
else {
- parseExpected(130);
+ parseExpected(131);
if (token() === 10) {
return parseAmbientExternalModuleDeclaration(node);
}
@@ -17581,7 +17719,7 @@
return parseModuleOrNamespaceDeclaration(node, flags);
}
function isExternalModuleReference() {
- return token() === 134 &&
+ return token() === 135 &&
lookAhead(nextTokenIsOpenParen);
}
function nextTokenIsOpenParen() {
@@ -17591,50 +17729,50 @@
return nextToken() === 42;
}
function parseNamespaceExportDeclaration(node) {
- node.kind = 247;
- parseExpected(119);
- parseExpected(131);
+ node.kind = 248;
+ parseExpected(120);
+ parseExpected(132);
node.name = parseIdentifier();
parseSemicolon();
return finishNode(node);
}
function parseImportDeclarationOrImportEqualsDeclaration(node) {
- parseExpected(92);
+ parseExpected(93);
var afterImportPos = scanner.getStartPos();
var identifier;
if (isIdentifier()) {
identifier = parseIdentifier();
- if (token() !== 27 && token() !== 144) {
+ if (token() !== 27 && token() !== 145) {
return parseImportEqualsDeclaration(node, identifier);
}
}
- node.kind = 249;
+ node.kind = 250;
if (identifier ||
token() === 40 ||
token() === 18) {
node.importClause = parseImportClause(identifier, afterImportPos);
- parseExpected(144);
+ parseExpected(145);
}
node.moduleSpecifier = parseModuleSpecifier();
parseSemicolon();
return finishNode(node);
}
function parseImportEqualsDeclaration(node, identifier) {
- node.kind = 248;
+ node.kind = 249;
node.name = identifier;
- parseExpected(59);
+ parseExpected(60);
node.moduleReference = parseModuleReference();
parseSemicolon();
return finishNode(node);
}
function parseImportClause(identifier, fullStart) {
- var importClause = createNode(250, fullStart);
+ var importClause = createNode(251, fullStart);
if (identifier) {
importClause.name = identifier;
}
if (!importClause.name ||
parseOptional(27)) {
- importClause.namedBindings = token() === 40 ? parseNamespaceImport() : parseNamedImportsOrExports(252);
+ importClause.namedBindings = token() === 40 ? parseNamespaceImport() : parseNamedImportsOrExports(253);
}
return finishNode(importClause);
}
@@ -17644,8 +17782,8 @@
: parseEntityName(false);
}
function parseExternalModuleReference() {
- var node = createNode(259);
- parseExpected(134);
+ var node = createNode(260);
+ parseExpected(135);
parseExpected(20);
node.expression = parseModuleSpecifier();
parseExpected(21);
@@ -17662,22 +17800,22 @@
}
}
function parseNamespaceImport() {
- var namespaceImport = createNode(251);
+ var namespaceImport = createNode(252);
parseExpected(40);
- parseExpected(119);
+ parseExpected(120);
namespaceImport.name = parseIdentifier();
return finishNode(namespaceImport);
}
function parseNamedImportsOrExports(kind) {
var node = createNode(kind);
- node.elements = parseBracketedList(23, kind === 252 ? parseImportSpecifier : parseExportSpecifier, 18, 19);
+ node.elements = parseBracketedList(23, kind === 253 ? parseImportSpecifier : parseExportSpecifier, 18, 19);
return finishNode(node);
}
function parseExportSpecifier() {
- return parseImportOrExportSpecifier(257);
+ return parseImportOrExportSpecifier(258);
}
function parseImportSpecifier() {
- return parseImportOrExportSpecifier(253);
+ return parseImportOrExportSpecifier(254);
}
function parseImportOrExportSpecifier(kind) {
var node = createNode(kind);
@@ -17685,9 +17823,9 @@
var checkIdentifierStart = scanner.getTokenPos();
var checkIdentifierEnd = scanner.getTextPos();
var identifierName = parseIdentifierName();
- if (token() === 119) {
+ if (token() === 120) {
node.propertyName = identifierName;
- parseExpected(119);
+ parseExpected(120);
checkIdentifierIsKeyword = ts.isKeyword(token()) && !isIdentifier();
checkIdentifierStart = scanner.getTokenPos();
checkIdentifierEnd = scanner.getTextPos();
@@ -17696,21 +17834,21 @@
else {
node.name = identifierName;
}
- if (kind === 253 && checkIdentifierIsKeyword) {
+ if (kind === 254 && checkIdentifierIsKeyword) {
parseErrorAt(checkIdentifierStart, checkIdentifierEnd, ts.Diagnostics.Identifier_expected);
}
return finishNode(node);
}
function parseExportDeclaration(node) {
- node.kind = 255;
+ node.kind = 256;
if (parseOptional(40)) {
- parseExpected(144);
+ parseExpected(145);
node.moduleSpecifier = parseModuleSpecifier();
}
else {
- node.exportClause = parseNamedImportsOrExports(256);
- if (token() === 144 || (token() === 10 && !scanner.hasPrecedingLineBreak())) {
- parseExpected(144);
+ node.exportClause = parseNamedImportsOrExports(257);
+ if (token() === 145 || (token() === 10 && !scanner.hasPrecedingLineBreak())) {
+ parseExpected(145);
node.moduleSpecifier = parseModuleSpecifier();
}
}
@@ -17718,12 +17856,12 @@
return finishNode(node);
}
function parseExportAssignment(node) {
- node.kind = 254;
- if (parseOptional(59)) {
+ node.kind = 255;
+ if (parseOptional(60)) {
node.isExportEquals = true;
}
else {
- parseExpected(80);
+ parseExpected(81);
}
node.expression = parseAssignmentExpressionOrHigher();
parseSemicolon();
@@ -17736,10 +17874,10 @@
}
function isAnExternalModuleIndicatorNode(node) {
return ts.hasModifier(node, 1)
- || node.kind === 248 && node.moduleReference.kind === 259
- || node.kind === 249
- || node.kind === 254
+ || node.kind === 249 && node.moduleReference.kind === 260
+ || node.kind === 250
|| node.kind === 255
+ || node.kind === 256
? node
: undefined;
}
@@ -17752,13 +17890,13 @@
return isImportMeta(node) ? node : forEachChild(node, walkTreeForExternalModuleIndicators);
}
function isImportMeta(node) {
- return ts.isMetaProperty(node) && node.keywordToken === 92 && node.name.escapedText === "meta";
+ return ts.isMetaProperty(node) && node.keywordToken === 93 && node.name.escapedText === "meta";
}
var JSDocParser;
(function (JSDocParser) {
function parseJSDocTypeExpressionForTests(content, start, length) {
- initializeState(content, 7, undefined, 1);
- sourceFile = createSourceFile("file.js", 7, 1, false);
+ initializeState(content, 8, undefined, 1);
+ sourceFile = createSourceFile("file.js", 8, 1, false);
scanner.setText(content, start, length);
currentToken = scanner.scan();
var jsDocTypeExpression = parseJSDocTypeExpression();
@@ -17768,18 +17906,18 @@
}
JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests;
function parseJSDocTypeExpression(mayOmitBraces) {
- var result = createNode(288);
+ var result = createNode(289);
var hasBrace = (mayOmitBraces ? parseOptional : parseExpected)(18);
result.type = doInsideOfContext(2097152, parseJSDocType);
if (!mayOmitBraces || hasBrace) {
- parseExpected(19);
+ parseExpectedJSDoc(19);
}
fixupParentReferences(result);
return finishNode(result);
}
JSDocParser.parseJSDocTypeExpression = parseJSDocTypeExpression;
function parseIsolatedJSDocComment(content, start, length) {
- initializeState(content, 7, undefined, 1);
+ initializeState(content, 8, undefined, 1);
sourceFile = { languageVariant: 0, text: content };
var jsDoc = parseJSDocCommentWorker(start, length);
var diagnostics = parseDiagnostics;
@@ -17834,7 +17972,7 @@
comments.push(text);
indent += text.length;
}
- nextJSDocToken();
+ nextTokenJSDoc();
while (parseOptionalJsdoc(5))
;
if (parseOptionalJsdoc(4)) {
@@ -17849,7 +17987,6 @@
addTag(parseTag(indent));
state = 0;
margin = undefined;
- indent++;
}
else {
pushComment(scanner.getTokenText());
@@ -17888,7 +18025,7 @@
pushComment(scanner.getTokenText());
break;
}
- nextJSDocToken();
+ nextTokenJSDoc();
}
removeLeadingNewlines(comments);
removeTrailingWhitespace(comments);
@@ -17905,14 +18042,14 @@
}
}
function createJSDocComment() {
- var result = createNode(296, start);
+ var result = createNode(297, start);
result.tags = tags && createNodeArray(tags, tagsPos, tagsEnd);
result.comment = comments.length ? comments.join("") : undefined;
return finishNode(result, end);
}
function isNextNonwhitespaceTokenEndOfFile() {
while (true) {
- nextJSDocToken();
+ nextTokenJSDoc();
if (token() === 1) {
return true;
}
@@ -17928,32 +18065,38 @@
}
}
while (token() === 5 || token() === 4) {
- nextJSDocToken();
+ nextTokenJSDoc();
}
}
function skipWhitespaceOrAsterisk() {
if (token() === 5 || token() === 4) {
if (lookAhead(isNextNonwhitespaceTokenEndOfFile)) {
- return;
+ return "";
}
}
var precedingLineBreak = scanner.hasPrecedingLineBreak();
+ var seenLineBreak = false;
+ var indentText = "";
while ((precedingLineBreak && token() === 40) || token() === 5 || token() === 4) {
+ indentText += scanner.getTokenText();
if (token() === 4) {
precedingLineBreak = true;
+ seenLineBreak = true;
+ indentText = "";
}
else if (token() === 40) {
precedingLineBreak = false;
}
- nextJSDocToken();
+ nextTokenJSDoc();
}
+ return seenLineBreak ? indentText : "";
}
- function parseTag(indent) {
+ function parseTag(margin) {
ts.Debug.assert(token() === 58);
var start = scanner.getTokenPos();
- nextJSDocToken();
+ nextTokenJSDoc();
var tagName = parseJSDocIdentifierName(undefined);
- skipWhitespaceOrAsterisk();
+ var indentText = skipWhitespaceOrAsterisk();
var tag;
switch (tagName.escapedText) {
case "augments":
@@ -17973,7 +18116,7 @@
case "arg":
case "argument":
case "param":
- return parseParameterOrPropertyTag(start, tagName, 2, indent);
+ return parseParameterOrPropertyTag(start, tagName, 2, margin);
case "return":
case "returns":
tag = parseReturnTag(start, tagName);
@@ -17985,21 +18128,24 @@
tag = parseTypeTag(start, tagName);
break;
case "typedef":
- tag = parseTypedefTag(start, tagName, indent);
+ tag = parseTypedefTag(start, tagName, margin);
break;
case "callback":
- tag = parseCallbackTag(start, tagName, indent);
+ tag = parseCallbackTag(start, tagName, margin);
break;
default:
tag = parseUnknownTag(start, tagName);
break;
}
if (!tag.comment) {
- tag.comment = parseTagComments(indent + tag.end - tag.pos);
+ if (!indentText) {
+ margin += tag.end - tag.pos;
+ }
+ tag.comment = parseTagComments(margin, indentText.slice(margin));
}
return tag;
}
- function parseTagComments(indent) {
+ function parseTagComments(indent, initialMargin) {
var comments = [];
var state = 0;
var margin;
@@ -18010,6 +18156,10 @@
comments.push(text);
indent += text.length;
}
+ if (initialMargin) {
+ pushComment(initialMargin);
+ state = 2;
+ }
var tok = token();
loop: while (true) {
switch (tok) {
@@ -18031,18 +18181,18 @@
else {
var whitespace = scanner.getTokenText();
if (margin !== undefined && indent + whitespace.length > margin) {
- comments.push(whitespace.slice(margin - indent - 1));
+ comments.push(whitespace.slice(margin - indent));
}
indent += whitespace.length;
}
break;
case 18:
state = 2;
- if (lookAhead(function () { return nextJSDocToken() === 58 && ts.tokenIsIdentifierOrKeyword(nextJSDocToken()) && scanner.getTokenText() === "link"; })) {
+ if (lookAhead(function () { return nextTokenJSDoc() === 58 && ts.tokenIsIdentifierOrKeyword(nextTokenJSDoc()) && scanner.getTokenText() === "link"; })) {
pushComment(scanner.getTokenText());
- nextJSDocToken();
+ nextTokenJSDoc();
pushComment(scanner.getTokenText());
- nextJSDocToken();
+ nextTokenJSDoc();
}
pushComment(scanner.getTokenText());
break;
@@ -18057,14 +18207,14 @@
pushComment(scanner.getTokenText());
break;
}
- tok = nextJSDocToken();
+ tok = nextTokenJSDoc();
}
removeLeadingNewlines(comments);
removeTrailingWhitespace(comments);
return comments.length === 0 ? undefined : comments.join("");
}
function parseUnknownTag(start, tagName) {
- var result = createNode(299, start);
+ var result = createNode(300, start);
result.tagName = tagName;
return finishNode(result);
}
@@ -18086,14 +18236,18 @@
return token() === 18 ? parseJSDocTypeExpression() : undefined;
}
function parseBracketNameInPropertyAndParamTag() {
- if (token() === 14) {
- return { name: createIdentifier(true), isBracketed: false };
+ var isBracketed = parseOptionalJsdoc(22);
+ if (isBracketed) {
+ skipWhitespace();
}
- var isBracketed = parseOptional(22);
+ var isBackquoted = parseOptionalJsdoc(59);
var name = parseJSDocEntityName();
+ if (isBackquoted) {
+ parseExpectedTokenJSDoc(59);
+ }
if (isBracketed) {
skipWhitespace();
- if (parseOptionalToken(59)) {
+ if (parseOptionalToken(60)) {
parseExpression();
}
parseExpected(23);
@@ -18102,9 +18256,9 @@
}
function isObjectOrObjectArrayTypeReference(node) {
switch (node.kind) {
- case 136:
+ case 137:
return true;
- case 169:
+ case 170:
return isObjectOrObjectArrayTypeReference(node.elementType);
default:
return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText === "Object";
@@ -18120,8 +18274,8 @@
typeExpression = tryParseTypeExpression();
}
var result = target === 1 ?
- createNode(310, start) :
- createNode(304, start);
+ createNode(311, start) :
+ createNode(305, start);
var comment = parseTagComments(indent + scanner.getStartPos() - start);
var nestedTypeLiteral = target !== 4 && parseNestedTypeLiteral(typeExpression, name, target, indent);
if (nestedTypeLiteral) {
@@ -18138,20 +18292,20 @@
}
function parseNestedTypeLiteral(typeExpression, name, target, indent) {
if (typeExpression && isObjectOrObjectArrayTypeReference(typeExpression.type)) {
- var typeLiteralExpression = createNode(288, scanner.getTokenPos());
+ var typeLiteralExpression = createNode(289, scanner.getTokenPos());
var child = void 0;
var jsdocTypeLiteral = void 0;
var start_2 = scanner.getStartPos();
var children = void 0;
while (child = tryParse(function () { return parseChildParameterOrPropertyTag(target, indent, name); })) {
- if (child.kind === 304 || child.kind === 310) {
+ if (child.kind === 305 || child.kind === 311) {
children = ts.append(children, child);
}
}
if (children) {
- jsdocTypeLiteral = createNode(297, start_2);
+ jsdocTypeLiteral = createNode(298, start_2);
jsdocTypeLiteral.jsDocPropertyTags = children;
- if (typeExpression.type.kind === 169) {
+ if (typeExpression.type.kind === 170) {
jsdocTypeLiteral.isArrayType = true;
}
typeLiteralExpression.type = finishNode(jsdocTypeLiteral);
@@ -18160,32 +18314,32 @@
}
}
function parseReturnTag(start, tagName) {
- if (ts.forEach(tags, function (t) { return t.kind === 305; })) {
+ if (ts.some(tags, ts.isJSDocReturnTag)) {
parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText);
}
- var result = createNode(305, start);
+ var result = createNode(306, start);
result.tagName = tagName;
result.typeExpression = tryParseTypeExpression();
return finishNode(result);
}
function parseTypeTag(start, tagName) {
- if (ts.forEach(tags, function (t) { return t.kind === 307; })) {
+ if (ts.some(tags, ts.isJSDocTypeTag)) {
parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText);
}
- var result = createNode(307, start);
+ var result = createNode(308, start);
result.tagName = tagName;
result.typeExpression = parseJSDocTypeExpression(true);
return finishNode(result);
}
function parseAugmentsTag(start, tagName) {
- var result = createNode(300, start);
+ var result = createNode(301, start);
result.tagName = tagName;
result.class = parseExpressionWithTypeArgumentsForAugments();
return finishNode(result);
}
function parseExpressionWithTypeArgumentsForAugments() {
var usedBrace = parseOptional(18);
- var node = createNode(211);
+ var node = createNode(212);
node.expression = parsePropertyAccessEntityNameExpression();
node.typeArguments = tryParseTypeArguments();
var res = finishNode(node);
@@ -18197,7 +18351,7 @@
function parsePropertyAccessEntityNameExpression() {
var node = parseJSDocIdentifierName();
while (parseOptional(24)) {
- var prop = createNode(189, node.pos);
+ var prop = createNode(190, node.pos);
prop.expression = node;
prop.name = parseJSDocIdentifierName();
node = finishNode(prop);
@@ -18205,19 +18359,19 @@
return node;
}
function parseClassTag(start, tagName) {
- var tag = createNode(301, start);
+ var tag = createNode(302, start);
tag.tagName = tagName;
return finishNode(tag);
}
function parseThisTag(start, tagName) {
- var tag = createNode(306, start);
+ var tag = createNode(307, start);
tag.tagName = tagName;
tag.typeExpression = parseJSDocTypeExpression(true);
skipWhitespace();
return finishNode(tag);
}
function parseEnumTag(start, tagName) {
- var tag = createNode(303, start);
+ var tag = createNode(304, start);
tag.tagName = tagName;
tag.typeExpression = parseJSDocTypeExpression(true);
skipWhitespace();
@@ -18226,7 +18380,7 @@
function parseTypedefTag(start, tagName, indent) {
var typeExpression = tryParseTypeExpression();
skipWhitespaceOrAsterisk();
- var typedefTag = createNode(309, start);
+ var typedefTag = createNode(310, start);
typedefTag.tagName = tagName;
typedefTag.fullName = parseJSDocTypeNameWithNamespace();
typedefTag.name = getJSDocTypeAliasName(typedefTag.fullName);
@@ -18240,9 +18394,9 @@
var childTypeTag = void 0;
while (child = tryParse(function () { return parseChildPropertyTag(indent); })) {
if (!jsdocTypeLiteral) {
- jsdocTypeLiteral = createNode(297, start);
+ jsdocTypeLiteral = createNode(298, start);
}
- if (child.kind === 307) {
+ if (child.kind === 308) {
if (childTypeTag) {
break;
}
@@ -18255,7 +18409,7 @@
}
}
if (jsdocTypeLiteral) {
- if (typeExpression && typeExpression.type.kind === 169) {
+ if (typeExpression && typeExpression.type.kind === 170) {
jsdocTypeLiteral.isArrayType = true;
}
typedefTag.typeExpression = childTypeTag && childTypeTag.typeExpression && !isObjectOrObjectArrayTypeReference(childTypeTag.typeExpression.type) ?
@@ -18273,7 +18427,7 @@
}
var typeNameOrNamespaceName = parseJSDocIdentifierName();
if (parseOptional(24)) {
- var jsDocNamespaceNode = createNode(244, pos);
+ var jsDocNamespaceNode = createNode(245, pos);
if (nested) {
jsDocNamespaceNode.flags |= 4;
}
@@ -18287,14 +18441,14 @@
return typeNameOrNamespaceName;
}
function parseCallbackTag(start, tagName, indent) {
- var callbackTag = createNode(302, start);
+ var callbackTag = createNode(303, start);
callbackTag.tagName = tagName;
callbackTag.fullName = parseJSDocTypeNameWithNamespace();
callbackTag.name = getJSDocTypeAliasName(callbackTag.fullName);
skipWhitespace();
callbackTag.comment = parseTagComments(indent);
var child;
- var jsdocSignature = createNode(298, start);
+ var jsdocSignature = createNode(299, start);
jsdocSignature.parameters = [];
while (child = tryParse(function () { return parseChildParameterOrPropertyTag(4, indent); })) {
jsdocSignature.parameters = ts.append(jsdocSignature.parameters, child);
@@ -18302,7 +18456,7 @@
var returnTag = tryParse(function () {
if (parseOptionalJsdoc(58)) {
var tag = parseTag(indent);
- if (tag && tag.kind === 305) {
+ if (tag && tag.kind === 306) {
return tag;
}
}
@@ -18343,11 +18497,11 @@
var canParseTag = true;
var seenAsterisk = false;
while (true) {
- switch (nextJSDocToken()) {
+ switch (nextTokenJSDoc()) {
case 58:
if (canParseTag) {
var child = tryParseChildTag(target, indent);
- if (child && (child.kind === 304 || child.kind === 310) &&
+ if (child && (child.kind === 305 || child.kind === 311) &&
target !== 4 &&
name && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) {
return false;
@@ -18366,7 +18520,7 @@
}
seenAsterisk = true;
break;
- case 72:
+ case 73:
canParseTag = false;
break;
case 1:
@@ -18377,7 +18531,7 @@
function tryParseChildTag(target, indent) {
ts.Debug.assert(token() === 58);
var start = scanner.getStartPos();
- nextJSDocToken();
+ nextTokenJSDoc();
var tagName = parseJSDocIdentifierName();
skipWhitespace();
var t;
@@ -18410,25 +18564,22 @@
var typeParametersPos = getNodePos();
do {
skipWhitespace();
- var typeParameter = createNode(150);
+ var typeParameter = createNode(151);
typeParameter.name = parseJSDocIdentifierName(ts.Diagnostics.Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces);
finishNode(typeParameter);
skipWhitespace();
typeParameters.push(typeParameter);
} while (parseOptionalJsdoc(27));
- var result = createNode(308, start);
+ var result = createNode(309, start);
result.tagName = tagName;
result.constraint = constraint;
result.typeParameters = createNodeArray(typeParameters, typeParametersPos);
finishNode(result);
return result;
}
- function nextJSDocToken() {
- return currentToken = scanner.scanJSDocToken();
- }
function parseOptionalJsdoc(t) {
if (token() === t) {
- nextJSDocToken();
+ nextTokenJSDoc();
return true;
}
return false;
@@ -18449,14 +18600,14 @@
}
function parseJSDocIdentifierName(message) {
if (!ts.tokenIsIdentifierOrKeyword(token())) {
- return createMissingNode(72, !message, message || ts.Diagnostics.Identifier_expected);
+ return createMissingNode(73, !message, message || ts.Diagnostics.Identifier_expected);
}
var pos = scanner.getTokenPos();
var end = scanner.getTextPos();
- var result = createNode(72, pos);
+ var result = createNode(73, pos);
result.escapedText = ts.escapeLeadingUnderscores(scanner.getTokenText());
finishNode(result, end);
- nextJSDocToken();
+ nextTokenJSDoc();
return result;
}
}
@@ -18534,7 +18685,7 @@
switch (node.kind) {
case 10:
case 8:
- case 72:
+ case 73:
return true;
}
return false;
@@ -18756,24 +18907,15 @@
}
ts.isDeclarationFileName = isDeclarationFileName;
function processCommentPragmas(context, sourceText) {
- var triviaScanner = ts.createScanner(context.languageVersion, false, 0, sourceText);
var pragmas = [];
- while (true) {
- var kind = triviaScanner.scan();
- if (!ts.isTrivia(kind)) {
- break;
- }
- var range = {
- kind: triviaScanner.getToken(),
- pos: triviaScanner.getTokenPos(),
- end: triviaScanner.getTextPos(),
- };
+ for (var _i = 0, _a = ts.getLeadingCommentRanges(sourceText, 0) || ts.emptyArray; _i < _a.length; _i++) {
+ var range = _a[_i];
var comment = sourceText.substring(range.pos, range.end);
extractPragmas(pragmas, range, comment);
}
context.pragmas = ts.createMap();
- for (var _i = 0, pragmas_1 = pragmas; _i < pragmas_1.length; _i++) {
- var pragma = pragmas_1[_i];
+ for (var _b = 0, pragmas_1 = pragmas; _b < pragmas_1.length; _b++) {
+ var pragma = pragmas_1[_b];
if (context.pragmas.has(pragma.name)) {
var currentValue = context.pragmas.get(pragma.name);
if (currentValue instanceof Array) {
@@ -18958,10 +19100,10 @@
if (lhs.kind !== rhs.kind) {
return false;
}
- if (lhs.kind === 72) {
+ if (lhs.kind === 73) {
return lhs.escapedText === rhs.escapedText;
}
- if (lhs.kind === 100) {
+ if (lhs.kind === 101) {
return true;
}
return lhs.name.escapedText === rhs.name.escapedText &&
@@ -18981,6 +19123,7 @@
["es2017", "lib.es2017.d.ts"],
["es2018", "lib.es2018.d.ts"],
["es2019", "lib.es2019.d.ts"],
+ ["es2020", "lib.es2020.d.ts"],
["esnext", "lib.esnext.d.ts"],
["dom", "lib.dom.d.ts"],
["dom.iterable", "lib.dom.iterable.d.ts"],
@@ -19007,8 +19150,11 @@
["es2018.promise", "lib.es2018.promise.d.ts"],
["es2018.regexp", "lib.es2018.regexp.d.ts"],
["es2019.array", "lib.es2019.array.d.ts"],
+ ["es2019.object", "lib.es2019.object.d.ts"],
["es2019.string", "lib.es2019.string.d.ts"],
["es2019.symbol", "lib.es2019.symbol.d.ts"],
+ ["es2020.string", "lib.es2020.string.d.ts"],
+ ["es2020.symbol.wellknown", "lib.es2020.symbol.wellknown.d.ts"],
["esnext.array", "lib.es2019.array.d.ts"],
["esnext.symbol", "lib.es2019.symbol.d.ts"],
["esnext.asynciterable", "lib.es2018.asynciterable.d.ts"],
@@ -19083,6 +19229,13 @@
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Show_verbose_diagnostic_information
},
+ {
+ name: "incremental",
+ shortName: "i",
+ type: "boolean",
+ category: ts.Diagnostics.Basic_Options,
+ description: ts.Diagnostics.Enable_incremental_compilation,
+ },
];
ts.optionDeclarations = ts.commonOptionsWithBuild.concat([
{
@@ -19144,10 +19297,12 @@
es2017: 4,
es2018: 5,
es2019: 6,
- esnext: 7,
+ es2020: 7,
+ esnext: 8,
}),
affectsSourceFile: true,
affectsModuleResolution: true,
+ affectsEmit: true,
paramType: ts.Diagnostics.VERSION,
showInSimplifiedHelpView: true,
category: ts.Diagnostics.Basic_Options,
@@ -19215,6 +19370,7 @@
name: "declaration",
shortName: "d",
type: "boolean",
+ affectsEmit: true,
showInSimplifiedHelpView: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Generates_corresponding_d_ts_file,
@@ -19222,6 +19378,7 @@
{
name: "declarationMap",
type: "boolean",
+ affectsEmit: true,
showInSimplifiedHelpView: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Generates_a_sourcemap_for_each_corresponding_d_ts_file,
@@ -19229,12 +19386,14 @@
{
name: "emitDeclarationOnly",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Only_emit_d_ts_declaration_files,
},
{
name: "sourceMap",
type: "boolean",
+ affectsEmit: true,
showInSimplifiedHelpView: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Generates_corresponding_map_file,
@@ -19242,6 +19401,7 @@
{
name: "outFile",
type: "string",
+ affectsEmit: true,
isFilePath: true,
paramType: ts.Diagnostics.FILE,
showInSimplifiedHelpView: true,
@@ -19251,6 +19411,7 @@
{
name: "outDir",
type: "string",
+ affectsEmit: true,
isFilePath: true,
paramType: ts.Diagnostics.DIRECTORY,
showInSimplifiedHelpView: true,
@@ -19260,6 +19421,7 @@
{
name: "rootDir",
type: "string",
+ affectsEmit: true,
isFilePath: true,
paramType: ts.Diagnostics.LOCATION,
category: ts.Diagnostics.Basic_Options,
@@ -19268,29 +19430,24 @@
{
name: "composite",
type: "boolean",
+ affectsEmit: true,
isTSConfigOnly: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Enable_project_compilation,
},
{
- name: "incremental",
- type: "boolean",
- isTSConfigOnly: true,
- category: ts.Diagnostics.Basic_Options,
- description: ts.Diagnostics.Enable_incremental_compilation,
- },
- {
name: "tsBuildInfoFile",
type: "string",
+ affectsEmit: true,
isFilePath: true,
paramType: ts.Diagnostics.FILE,
- isTSConfigOnly: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Specify_file_to_store_incremental_compilation_information,
},
{
name: "removeComments",
type: "boolean",
+ affectsEmit: true,
showInSimplifiedHelpView: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Do_not_emit_comments_to_output,
@@ -19298,6 +19455,7 @@
{
name: "noEmit",
type: "boolean",
+ affectsEmit: true,
showInSimplifiedHelpView: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Do_not_emit_outputs,
@@ -19305,12 +19463,14 @@
{
name: "importHelpers",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Import_emit_helpers_from_tslib
},
{
name: "downlevelIteration",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3
},
@@ -19508,8 +19668,16 @@
description: ts.Diagnostics.Do_not_resolve_the_real_path_of_symlinks,
},
{
+ name: "allowUmdGlobalAccess",
+ type: "boolean",
+ affectsSemanticDiagnostics: true,
+ category: ts.Diagnostics.Module_Resolution_Options,
+ description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
+ },
+ {
name: "sourceRoot",
type: "string",
+ affectsEmit: true,
paramType: ts.Diagnostics.LOCATION,
category: ts.Diagnostics.Source_Map_Options,
description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations,
@@ -19517,6 +19685,7 @@
{
name: "mapRoot",
type: "string",
+ affectsEmit: true,
paramType: ts.Diagnostics.LOCATION,
category: ts.Diagnostics.Source_Map_Options,
description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
@@ -19524,12 +19693,14 @@
{
name: "inlineSourceMap",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Source_Map_Options,
description: ts.Diagnostics.Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file
},
{
name: "inlineSources",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Source_Map_Options,
description: ts.Diagnostics.Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap_to_be_set
},
@@ -19560,6 +19731,7 @@
{
name: "out",
type: "string",
+ affectsEmit: true,
isFilePath: false,
category: ts.Diagnostics.Advanced_Options,
paramType: ts.Diagnostics.FILE,
@@ -19568,6 +19740,7 @@
{
name: "reactNamespace",
type: "string",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react_JSX_emit
},
@@ -19586,6 +19759,7 @@
{
name: "emitBOM",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files
},
@@ -19601,6 +19775,7 @@
crlf: 0,
lf: 1
}),
+ affectsEmit: true,
paramType: ts.Diagnostics.NEWLINE,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix,
@@ -19628,6 +19803,7 @@
{
name: "stripInternal",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation,
},
@@ -19648,24 +19824,28 @@
{
name: "noEmitHelpers",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Do_not_generate_custom_helper_functions_like_extends_in_compiled_output
},
{
name: "noEmitOnError",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported,
},
{
name: "preserveConstEnums",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code
},
{
name: "declarationDir",
type: "string",
+ affectsEmit: true,
isFilePath: true,
paramType: ts.Diagnostics.DIRECTORY,
category: ts.Diagnostics.Advanced_Options,
@@ -19745,6 +19925,7 @@
}
]);
ts.semanticDiagnosticsOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsSemanticDiagnostics; });
+ ts.affectsEmitOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsEmit; });
ts.moduleResolutionOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsModuleResolution; });
ts.sourceFileAffectingCompilerOptions = ts.optionDeclarations.filter(function (option) {
return !!option.affectsSourceFile || !!option.affectsModuleResolution || !!option.affectsBindDiagnostics;
@@ -20115,7 +20296,7 @@
}
}
ts.printHelp = printHelp;
- function getParsedCommandLineOfConfigFile(configFileName, optionsToExtend, host) {
+ function getParsedCommandLineOfConfigFile(configFileName, optionsToExtend, host, extendedConfigCache) {
var configFileText;
try {
configFileText = host.readFile(configFileName);
@@ -20135,7 +20316,7 @@
result.path = ts.toPath(configFileName, cwd, ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames));
result.resolvedPath = result.path;
result.originalFileName = result.fileName;
- return parseJsonSourceFileConfigFileContent(result, host, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), cwd), optionsToExtend, ts.getNormalizedAbsolutePath(configFileName, cwd));
+ return parseJsonSourceFileConfigFileContent(result, host, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), cwd), optionsToExtend, ts.getNormalizedAbsolutePath(configFileName, cwd), undefined, undefined, extendedConfigCache);
}
ts.getParsedCommandLineOfConfigFile = getParsedCommandLineOfConfigFile;
function readConfigFile(fileName, readFile) {
@@ -20252,7 +20433,7 @@
var result = returnValue ? {} : undefined;
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var element = _a[_i];
- if (element.kind !== 275) {
+ if (element.kind !== 276) {
errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected));
continue;
}
@@ -20302,13 +20483,13 @@
}
function convertPropertyValueToJson(valueExpression, option) {
switch (valueExpression.kind) {
- case 102:
+ case 103:
reportInvalidOptionValue(option && option.type !== "boolean");
return true;
- case 87:
+ case 88:
reportInvalidOptionValue(option && option.type !== "boolean");
return false;
- case 96:
+ case 97:
reportInvalidOptionValue(option && option.name === "extends");
return null;
case 10:
@@ -20327,13 +20508,13 @@
case 8:
reportInvalidOptionValue(option && option.type !== "number");
return Number(valueExpression.text);
- case 202:
+ case 203:
if (valueExpression.operator !== 39 || valueExpression.operand.kind !== 8) {
break;
}
reportInvalidOptionValue(option && option.type !== "number");
return -Number(valueExpression.operand.text);
- case 188:
+ case 189:
reportInvalidOptionValue(option && option.type !== "object");
var objectLiteralExpression = valueExpression;
if (option) {
@@ -20343,7 +20524,7 @@
else {
return convertObjectLiteralExpressionToJson(objectLiteralExpression, undefined, undefined, undefined);
}
- case 187:
+ case 188:
reportInvalidOptionValue(option && option.type !== "list");
return convertArrayLiteralExpressionToJson(valueExpression.elements, option && option.element);
}
@@ -20565,12 +20746,12 @@
}
}
ts.generateTSConfig = generateTSConfig;
- function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) {
- return parseJsonConfigFileContentWorker(json, undefined, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions);
+ function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache) {
+ return parseJsonConfigFileContentWorker(json, undefined, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache);
}
ts.parseJsonConfigFileContent = parseJsonConfigFileContent;
- function parseJsonSourceFileConfigFileContent(sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) {
- return parseJsonConfigFileContentWorker(undefined, sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions);
+ function parseJsonSourceFileConfigFileContent(sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache) {
+ return parseJsonConfigFileContentWorker(undefined, sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache);
}
ts.parseJsonSourceFileConfigFileContent = parseJsonSourceFileConfigFileContent;
function setConfigFileInOptions(options, configFile) {
@@ -20585,13 +20766,13 @@
function directoryOfCombinedPath(fileName, basePath) {
return ts.getDirectoryPath(ts.getNormalizedAbsolutePath(fileName, basePath));
}
- function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) {
+ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache) {
if (existingOptions === void 0) { existingOptions = {}; }
if (resolutionStack === void 0) { resolutionStack = []; }
if (extraFileExtensions === void 0) { extraFileExtensions = []; }
ts.Debug.assert((json === undefined && sourceFile !== undefined) || (json !== undefined && sourceFile === undefined));
var errors = [];
- var parsedConfig = parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors);
+ var parsedConfig = parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors, extendedConfigCache);
var raw = parsedConfig.raw;
var options = ts.extend(existingOptions, parsedConfig.options || {});
options.configFilePath = configFileName && ts.normalizeSlashes(configFileName);
@@ -20725,7 +20906,7 @@
function isSuccessfulParsedTsconfig(value) {
return !!value.options;
}
- function parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors) {
+ function parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors, extendedConfigCache) {
basePath = ts.normalizeSlashes(basePath);
var resolvedPath = ts.getNormalizedAbsolutePath(configFileName || "", basePath);
if (resolutionStack.indexOf(resolvedPath) >= 0) {
@@ -20737,7 +20918,7 @@
parseOwnConfigOfJsonSourceFile(sourceFile, host, basePath, configFileName, errors);
if (ownConfig.extendedConfigPath) {
resolutionStack = resolutionStack.concat([resolvedPath]);
- var extendedConfig = getExtendedConfig(sourceFile, ownConfig.extendedConfigPath, host, basePath, resolutionStack, errors);
+ var extendedConfig = getExtendedConfig(sourceFile, ownConfig.extendedConfigPath, host, basePath, resolutionStack, errors, extendedConfigCache);
if (extendedConfig && isSuccessfulParsedTsconfig(extendedConfig)) {
var baseRaw_1 = extendedConfig.raw;
var raw_1 = ownConfig.raw;
@@ -20831,7 +21012,7 @@
if (!host.fileExists(extendedConfigPath) && !ts.endsWith(extendedConfigPath, ".json")) {
extendedConfigPath = extendedConfigPath + ".json";
if (!host.fileExists(extendedConfigPath)) {
- errors.push(createDiagnostic(ts.Diagnostics.File_0_does_not_exist, extendedConfig));
+ errors.push(createDiagnostic(ts.Diagnostics.File_0_not_found, extendedConfig));
return undefined;
}
}
@@ -20841,24 +21022,23 @@
if (resolved.resolvedModule) {
return resolved.resolvedModule.resolvedFileName;
}
- errors.push(createDiagnostic(ts.Diagnostics.File_0_does_not_exist, extendedConfig));
+ errors.push(createDiagnostic(ts.Diagnostics.File_0_not_found, extendedConfig));
return undefined;
}
- function getExtendedConfig(sourceFile, extendedConfigPath, host, basePath, resolutionStack, errors) {
+ function getExtendedConfig(sourceFile, extendedConfigPath, host, basePath, resolutionStack, errors, extendedConfigCache) {
var _a;
- var extendedResult = readJsonConfigFile(extendedConfigPath, function (path) { return host.readFile(path); });
- if (sourceFile) {
- sourceFile.extendedSourceFiles = [extendedResult.fileName];
- }
- if (extendedResult.parseDiagnostics.length) {
- errors.push.apply(errors, extendedResult.parseDiagnostics);
- return undefined;
+ var path = host.useCaseSensitiveFileNames ? extendedConfigPath : ts.toLowerCase(extendedConfigPath);
+ var value;
+ var extendedResult;
+ var extendedConfig;
+ if (extendedConfigCache && (value = extendedConfigCache.get(path))) {
+ (extendedResult = value.extendedResult, extendedConfig = value.extendedConfig);
}
+ else {
+ extendedResult = readJsonConfigFile(extendedConfigPath, function (path) { return host.readFile(path); });
+ if (!extendedResult.parseDiagnostics.length) {
var extendedDirname = ts.getDirectoryPath(extendedConfigPath);
- var extendedConfig = parseConfig(undefined, extendedResult, host, extendedDirname, ts.getBaseFileName(extendedConfigPath), resolutionStack, errors);
- if (sourceFile && extendedResult.extendedSourceFiles) {
- (_a = sourceFile.extendedSourceFiles).push.apply(_a, extendedResult.extendedSourceFiles);
- }
+ extendedConfig = parseConfig(undefined, extendedResult, host, extendedDirname, ts.getBaseFileName(extendedConfigPath), resolutionStack, errors, extendedConfigCache);
if (isSuccessfulParsedTsconfig(extendedConfig)) {
var relativeDifference_1 = ts.convertToRelativePath(extendedDirname, basePath, ts.identity);
var updatePath_1 = function (path) { return ts.isRootedDiskPath(path) ? path : ts.combinePaths(relativeDifference_1, path); };
@@ -20872,6 +21052,21 @@
mapPropertiesInRawIfNotUndefined("exclude");
mapPropertiesInRawIfNotUndefined("files");
}
+ }
+ if (extendedConfigCache) {
+ extendedConfigCache.set(path, { extendedResult: extendedResult, extendedConfig: extendedConfig });
+ }
+ }
+ if (sourceFile) {
+ sourceFile.extendedSourceFiles = [extendedResult.fileName];
+ if (extendedResult.extendedSourceFiles) {
+ (_a = sourceFile.extendedSourceFiles).push.apply(_a, extendedResult.extendedSourceFiles);
+ }
+ }
+ if (extendedResult.parseDiagnostics.length) {
+ errors.push.apply(errors, extendedResult.parseDiagnostics);
+ return undefined;
+ }
return extendedConfig;
}
function convertCompileOnSaveOptionFromJson(jsonOption, basePath, errors) {
@@ -21202,7 +21397,18 @@
return !!compilerOptions.traceResolution && host.trace !== undefined;
}
ts.isTraceEnabled = isTraceEnabled;
- function withPackageId(packageId, r) {
+ function withPackageId(packageInfo, r) {
+ var packageId;
+ if (r && packageInfo) {
+ var packageJsonContent = packageInfo.packageJsonContent;
+ if (typeof packageJsonContent.name === "string" && typeof packageJsonContent.version === "string") {
+ packageId = {
+ name: packageJsonContent.name,
+ subModuleName: r.path.slice(packageInfo.packageDirectory.length + ts.directorySeparator.length),
+ version: packageJsonContent.version
+ };
+ }
+ }
return r && { path: r.path, extension: r.ext, packageId: packageId };
}
function noPackageId(r) {
@@ -21253,8 +21459,15 @@
}
function readPackageJsonPathField(jsonContent, fieldName, baseDirectory, state) {
var fileName = readPackageJsonField(jsonContent, fieldName, "string", state);
- if (fileName === undefined)
+ if (fileName === undefined) {
return;
+ }
+ if (!fileName) {
+ if (state.traceEnabled) {
+ trace(state.host, ts.Diagnostics.package_json_had_a_falsy_0_field, fieldName);
+ }
+ return;
+ }
var path = ts.normalizePath(ts.combinePaths(baseDirectory, fileName));
if (state.traceEnabled) {
trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, fileName, path);
@@ -21395,8 +21608,13 @@
var fileName = resolved.fileName, packageId = resolved.packageId;
var resolvedFileName = options.preserveSymlinks ? fileName : realPath(fileName, host, traceEnabled);
if (traceEnabled) {
+ if (packageId) {
+ trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3, typeReferenceDirectiveName, resolvedFileName, ts.packageIdToString(packageId), primary);
+ }
+ else {
trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolvedFileName, primary);
}
+ }
resolvedTypeReferenceDirective = { primary: primary, resolvedFileName: resolvedFileName, packageId: packageId, isExternalLibraryImport: pathContainsNodeModules(fileName) };
}
return { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations };
@@ -21480,19 +21698,27 @@
return result;
}
ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames;
- function createModuleResolutionCache(currentDirectory, getCanonicalFileName) {
- return createModuleResolutionCacheWithMaps(createCacheWithRedirects(), createCacheWithRedirects(), currentDirectory, getCanonicalFileName);
+ function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options) {
+ return createModuleResolutionCacheWithMaps(createCacheWithRedirects(options), createCacheWithRedirects(options), currentDirectory, getCanonicalFileName);
}
ts.createModuleResolutionCache = createModuleResolutionCache;
- function createCacheWithRedirects() {
+ function createCacheWithRedirects(options) {
var ownMap = ts.createMap();
var redirectsMap = ts.createMap();
return {
ownMap: ownMap,
redirectsMap: redirectsMap,
getOrCreateMapOfCacheRedirects: getOrCreateMapOfCacheRedirects,
- clear: clear
+ clear: clear,
+ setOwnOptions: setOwnOptions,
+ setOwnMap: setOwnMap
};
+ function setOwnOptions(newOptions) {
+ options = newOptions;
+ }
+ function setOwnMap(newOwnMap) {
+ ownMap = newOwnMap;
+ }
function getOrCreateMapOfCacheRedirects(redirectedReference) {
if (!redirectedReference) {
return ownMap;
@@ -21500,7 +21726,7 @@
var path = redirectedReference.sourceFile.path;
var redirects = redirectsMap.get(path);
if (!redirects) {
- redirects = ts.createMap();
+ redirects = !options || ts.optionsHaveModuleResolutionChanges(options, redirectedReference.commandLine.options) ? ts.createMap() : ownMap;
redirectsMap.set(path, redirects);
}
return redirects;
@@ -21512,7 +21738,7 @@
}
ts.createCacheWithRedirects = createCacheWithRedirects;
function createModuleResolutionCacheWithMaps(directoryToModuleNameMap, moduleNameToDirectoryMap, currentDirectory, getCanonicalFileName) {
- return { getOrCreateCacheForDirectory: getOrCreateCacheForDirectory, getOrCreateCacheForModuleName: getOrCreateCacheForModuleName };
+ return { getOrCreateCacheForDirectory: getOrCreateCacheForDirectory, getOrCreateCacheForModuleName: getOrCreateCacheForModuleName, directoryToModuleNameMap: directoryToModuleNameMap, moduleNameToDirectoryMap: moduleNameToDirectoryMap };
function getOrCreateCacheForDirectory(directoryName, redirectedReference) {
var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName);
return getOrCreateCache(directoryToModuleNameMap, redirectedReference, path, ts.createMap);
@@ -21635,8 +21861,13 @@
}
if (traceEnabled) {
if (result.resolvedModule) {
+ if (result.resolvedModule.packageId) {
+ trace(host, ts.Diagnostics.Module_name_0_was_successfully_resolved_to_1_with_Package_ID_2, moduleName, result.resolvedModule.resolvedFileName, ts.packageIdToString(result.resolvedModule.packageId));
+ }
+ else {
trace(host, ts.Diagnostics.Module_name_0_was_successfully_resolved_to_1, moduleName, result.resolvedModule.resolvedFileName);
}
+ }
else {
trace(host, ts.Diagnostics.Module_name_0_was_not_resolved, moduleName);
}
@@ -21830,10 +22061,9 @@
}
var resolvedFromFile = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state);
if (resolvedFromFile) {
- var nm = considerPackageJson ? parseNodeModuleFromPath(resolvedFromFile) : undefined;
- var packageInfo = nm && getPackageJsonInfo(nm.packageDirectory, nm.subModuleName, false, state);
- var packageId = packageInfo && packageInfo.packageId;
- return withPackageId(packageId, resolvedFromFile);
+ var packageDirectory = considerPackageJson ? parseNodeModuleFromPath(resolvedFromFile) : undefined;
+ var packageInfo = packageDirectory ? getPackageJsonInfo(packageDirectory, false, state) : undefined;
+ return withPackageId(packageInfo, resolvedFromFile);
}
}
if (!onlyRecordFailures) {
@@ -21863,26 +22093,12 @@
if (path.charCodeAt(indexAfterNodeModules) === 64) {
indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterPackageName);
}
- var packageDirectory = path.slice(0, indexAfterPackageName);
- var subModuleName = ts.removeExtension(path.slice(indexAfterPackageName + 1), resolved.ext) + ".d.ts";
- return { packageDirectory: packageDirectory, subModuleName: subModuleName };
+ return path.slice(0, indexAfterPackageName);
}
function moveToNextDirectorySeparatorIfAvailable(path, prevSeparatorIndex) {
var nextSeparatorIndex = path.indexOf(ts.directorySeparator, prevSeparatorIndex + 1);
return nextSeparatorIndex === -1 ? prevSeparatorIndex : nextSeparatorIndex;
}
- function addExtensionAndIndex(path) {
- if (path === "") {
- return "index.d.ts";
- }
- if (ts.endsWith(path, ".d.ts")) {
- return path;
- }
- if (path === "index" || ts.endsWith(path, "/index")) {
- return path + ".d.ts";
- }
- return path + "/index.d.ts";
- }
function loadModuleFromFileNoPackageId(extensions, candidate, onlyRecordFailures, state) {
return noPackageId(loadModuleFromFile(extensions, candidate, onlyRecordFailures, state));
}
@@ -21946,52 +22162,22 @@
}
function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson) {
if (considerPackageJson === void 0) { considerPackageJson = true; }
- var packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, "", onlyRecordFailures, state) : undefined;
- var packageId = packageInfo && packageInfo.packageId;
+ var packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, onlyRecordFailures, state) : undefined;
var packageJsonContent = packageInfo && packageInfo.packageJsonContent;
- var versionPaths = packageJsonContent && readPackageJsonTypesVersionPaths(packageJsonContent, state);
- return withPackageId(packageId, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths));
+ var versionPaths = packageInfo && packageInfo.versionPaths;
+ return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths));
}
- function getPackageJsonInfo(packageDirectory, subModuleName, onlyRecordFailures, state) {
+ function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
var host = state.host, traceEnabled = state.traceEnabled;
var directoryExists = !onlyRecordFailures && ts.directoryProbablyExists(packageDirectory, host);
var packageJsonPath = ts.combinePaths(packageDirectory, "package.json");
if (directoryExists && host.fileExists(packageJsonPath)) {
var packageJsonContent = ts.readJson(packageJsonPath, host);
- if (subModuleName === "") {
- var path = readPackageJsonTypesFields(packageJsonContent, packageDirectory, state);
- if (typeof path === "string") {
- subModuleName = addExtensionAndIndex(path.substring(packageDirectory.length + 1));
- }
- else {
- var jsPath = readPackageJsonMainField(packageJsonContent, packageDirectory, state);
- if (typeof jsPath === "string" && jsPath.length > packageDirectory.length) {
- var potentialSubModule_1 = jsPath.substring(packageDirectory.length + 1);
- subModuleName = (ts.forEach(ts.supportedJSExtensions, function (extension) {
- return ts.tryRemoveExtension(potentialSubModule_1, extension);
- }) || potentialSubModule_1) + ".d.ts";
- }
- else {
- subModuleName = "index.d.ts";
- }
- }
- }
- if (!ts.endsWith(subModuleName, ".d.ts")) {
- subModuleName = addExtensionAndIndex(subModuleName);
- }
- var versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state);
- var packageId = typeof packageJsonContent.name === "string" && typeof packageJsonContent.version === "string"
- ? { name: packageJsonContent.name, subModuleName: subModuleName, version: packageJsonContent.version }
- : undefined;
if (traceEnabled) {
- if (packageId) {
- trace(host, ts.Diagnostics.Found_package_json_at_0_Package_ID_is_1, packageJsonPath, ts.packageIdToString(packageId));
- }
- else {
trace(host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath);
}
- }
- return { packageJsonContent: packageJsonContent, packageId: packageId, versionPaths: versionPaths };
+ var versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state);
+ return { packageDirectory: packageDirectory, packageJsonContent: packageJsonContent, versionPaths: versionPaths };
}
else {
if (directoryExists && traceEnabled) {
@@ -22120,36 +22306,30 @@
}
function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state) {
var candidate = ts.normalizePath(ts.combinePaths(nodeModulesDirectory, moduleName));
- var packageJsonContent;
- var packageId;
- var versionPaths;
- var packageInfo = getPackageJsonInfo(candidate, "", !nodeModulesDirectoryExists, state);
+ var packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state);
if (packageInfo) {
- (packageJsonContent = packageInfo.packageJsonContent, packageId = packageInfo.packageId, versionPaths = packageInfo.versionPaths);
var fromFile = loadModuleFromFile(extensions, candidate, !nodeModulesDirectoryExists, state);
if (fromFile) {
return noPackageId(fromFile);
}
- var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageJsonContent, versionPaths);
- return withPackageId(packageId, fromDirectory);
+ var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageInfo.packageJsonContent, packageInfo.versionPaths);
+ return withPackageId(packageInfo, fromDirectory);
}
var loader = function (extensions, candidate, onlyRecordFailures, state) {
var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) ||
- loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths);
- return withPackageId(packageId, pathAndExtension);
+ loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.packageJsonContent, packageInfo && packageInfo.versionPaths);
+ return withPackageId(packageInfo, pathAndExtension);
};
var _a = parsePackageName(moduleName), packageName = _a.packageName, rest = _a.rest;
if (rest !== "") {
var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName);
- var packageInfo_1 = getPackageJsonInfo(packageDirectory, rest, !nodeModulesDirectoryExists, state);
- if (packageInfo_1)
- (packageId = packageInfo_1.packageId, versionPaths = packageInfo_1.versionPaths);
- if (versionPaths) {
+ packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state);
+ if (packageInfo && packageInfo.versionPaths) {
if (state.traceEnabled) {
- trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, versionPaths.version, ts.version, rest);
+ trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.versionPaths.version, ts.version, rest);
}
var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host);
- var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, versionPaths.paths, loader, !packageDirectoryExists, state);
+ var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.versionPaths.paths, loader, !packageDirectoryExists, state);
if (fromPaths) {
return fromPaths.value;
}
@@ -22289,21 +22469,21 @@
ts.getModuleInstanceState = getModuleInstanceState;
function getModuleInstanceStateWorker(node) {
switch (node.kind) {
- case 241:
case 242:
- return 0;
case 243:
+ return 0;
+ case 244:
if (ts.isEnumConst(node)) {
return 2;
}
break;
+ case 250:
case 249:
- case 248:
if (!(ts.hasModifier(node, 1))) {
return 0;
}
break;
- case 245: {
+ case 246: {
var state_1 = 0;
ts.forEachChild(node, function (n) {
var childState = getModuleInstanceStateWorker(n);
@@ -22322,9 +22502,9 @@
});
return state_1;
}
- case 244:
+ case 245:
return getModuleInstanceState(node);
- case 72:
+ case 73:
if (node.isInJSDocNamespace) {
return 0;
}
@@ -22447,7 +22627,7 @@
}
}
function getDeclarationName(node) {
- if (node.kind === 254) {
+ if (node.kind === 255) {
return node.isExportEquals ? "export=" : "default";
}
var name = ts.getNameOfDeclaration(node);
@@ -22456,7 +22636,7 @@
var moduleName = ts.getTextOfIdentifierOrLiteral(name);
return (ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + moduleName + "\"");
}
- if (name.kind === 149) {
+ if (name.kind === 150) {
var nameExpression = name.expression;
if (ts.isStringOrNumericLiteralLike(nameExpression)) {
return ts.escapeLeadingUnderscores(nameExpression.text);
@@ -22467,31 +22647,31 @@
return ts.isPropertyNameLiteral(name) ? ts.getEscapedTextOfIdentifierOrLiteral(name) : undefined;
}
switch (node.kind) {
- case 157:
+ case 158:
return "__constructor";
- case 165:
- case 160:
- case 298:
- return "__call";
case 166:
case 161:
- return "__new";
+ case 299:
+ return "__call";
+ case 167:
case 162:
+ return "__new";
+ case 163:
return "__index";
- case 255:
+ case 256:
return "__export";
- case 284:
+ case 285:
return "export=";
- case 204:
+ case 205:
if (ts.getAssignmentDeclarationKind(node) === 2) {
return "export=";
}
ts.Debug.fail("Unknown binary declaration kind");
break;
- case 294:
+ case 295:
return (ts.isJSDocConstructSignature(node) ? "__new" : "__call");
- case 151:
- ts.Debug.assert(node.parent.kind === 294, "Impossible parameter parent kind", function () { return "parent is: " + (ts.SyntaxKind ? ts.SyntaxKind[node.parent.kind] : node.parent.kind) + ", expected JSDocFunctionType"; });
+ case 152:
+ ts.Debug.assert(node.parent.kind === 295, "Impossible parameter parent kind", function () { return "parent is: " + (ts.SyntaxKind ? ts.SyntaxKind[node.parent.kind] : node.parent.kind) + ", expected JSDocFunctionType"; });
var functionType = node.parent;
var index = functionType.parameters.indexOf(node);
return "arg" + index;
@@ -22546,7 +22726,7 @@
}
else {
if (symbol.declarations && symbol.declarations.length &&
- (node.kind === 254 && !node.isExportEquals)) {
+ (node.kind === 255 && !node.isExportEquals)) {
message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports;
messageNeedsName_1 = false;
multipleDefaultExports_1 = true;
@@ -22581,7 +22761,7 @@
function declareModuleMember(node, symbolFlags, symbolExcludes) {
var hasExportModifier = ts.getCombinedModifierFlags(node) & 1;
if (symbolFlags & 2097152) {
- if (node.kind === 257 || (node.kind === 248 && hasExportModifier)) {
+ if (node.kind === 258 || (node.kind === 249 && hasExportModifier)) {
return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
}
else {
@@ -22611,7 +22791,7 @@
var saveThisParentContainer = thisParentContainer;
var savedBlockScopeContainer = blockScopeContainer;
if (containerFlags & 1) {
- if (node.kind !== 197) {
+ if (node.kind !== 198) {
thisParentContainer = container;
}
container = blockScopeContainer = node;
@@ -22640,7 +22820,7 @@
currentFlow.container = node;
}
}
- currentReturnTarget = isIIFE || node.kind === 157 ? createBranchLabel() : undefined;
+ currentReturnTarget = isIIFE || node.kind === 158 ? createBranchLabel() : undefined;
currentBreakTarget = undefined;
currentContinueTarget = undefined;
activeLabels = undefined;
@@ -22653,13 +22833,13 @@
if (hasExplicitReturn)
node.flags |= 256;
}
- if (node.kind === 284) {
+ if (node.kind === 285) {
node.flags |= emitFlags;
}
if (currentReturnTarget) {
addAntecedent(currentReturnTarget, currentFlow);
currentFlow = finishFlowLabel(currentReturnTarget);
- if (node.kind === 157) {
+ if (node.kind === 158) {
node.returnFlowNode = currentFlow;
}
}
@@ -22703,8 +22883,8 @@
}
}
function bindEachFunctionsFirst(nodes) {
- bindEach(nodes, function (n) { return n.kind === 239 ? bind(n) : undefined; });
- bindEach(nodes, function (n) { return n.kind !== 239 ? bind(n) : undefined; });
+ bindEach(nodes, function (n) { return n.kind === 240 ? bind(n) : undefined; });
+ bindEach(nodes, function (n) { return n.kind !== 240 ? bind(n) : undefined; });
}
function bindEach(nodes, bindFunction) {
if (bindFunction === void 0) { bindFunction = bind; }
@@ -22737,77 +22917,77 @@
return;
}
switch (node.kind) {
- case 224:
+ case 225:
bindWhileStatement(node);
break;
- case 223:
+ case 224:
bindDoStatement(node);
break;
- case 225:
+ case 226:
bindForStatement(node);
break;
- case 226:
case 227:
+ case 228:
bindForInOrForOfStatement(node);
break;
- case 222:
+ case 223:
bindIfStatement(node);
break;
- case 230:
- case 234:
+ case 231:
+ case 235:
bindReturnOrThrow(node);
break;
+ case 230:
case 229:
- case 228:
bindBreakOrContinueStatement(node);
break;
- case 235:
+ case 236:
bindTryStatement(node);
break;
- case 232:
+ case 233:
bindSwitchStatement(node);
break;
- case 246:
+ case 247:
bindCaseBlock(node);
break;
- case 271:
+ case 272:
bindCaseClause(node);
break;
- case 233:
+ case 234:
bindLabeledStatement(node);
break;
- case 202:
+ case 203:
bindPrefixUnaryExpressionFlow(node);
break;
- case 203:
+ case 204:
bindPostfixUnaryExpressionFlow(node);
break;
- case 204:
+ case 205:
bindBinaryExpressionFlow(node);
break;
- case 198:
+ case 199:
bindDeleteExpressionFlow(node);
break;
- case 205:
+ case 206:
bindConditionalExpressionFlow(node);
break;
- case 237:
+ case 238:
bindVariableDeclarationFlow(node);
break;
- case 191:
+ case 192:
bindCallExpressionFlow(node);
break;
- case 309:
- case 302:
+ case 310:
+ case 303:
bindJSDocTypeAlias(node);
break;
- case 284: {
+ case 285: {
bindEachFunctionsFirst(node.statements);
bind(node.endOfFileToken);
break;
}
- case 218:
- case 245:
+ case 219:
+ case 246:
bindEachFunctionsFirst(node.statements);
break;
default:
@@ -22818,26 +22998,26 @@
}
function isNarrowingExpression(expr) {
switch (expr.kind) {
- case 72:
- case 100:
- case 189:
+ case 73:
+ case 101:
case 190:
- return isNarrowableReference(expr);
case 191:
+ return isNarrowableReference(expr);
+ case 192:
return hasNarrowableArgument(expr);
- case 195:
+ case 196:
return isNarrowingExpression(expr.expression);
- case 204:
+ case 205:
return isNarrowingBinaryExpression(expr);
- case 202:
+ case 203:
return expr.operator === 52 && isNarrowingExpression(expr.operand);
- case 199:
+ case 200:
return isNarrowingExpression(expr.expression);
}
return false;
}
function isNarrowableReference(expr) {
- return expr.kind === 72 || expr.kind === 100 || expr.kind === 98 ||
+ return expr.kind === 73 || expr.kind === 101 || expr.kind === 99 ||
(ts.isPropertyAccessExpression(expr) || ts.isNonNullExpression(expr) || ts.isParenthesizedExpression(expr)) && isNarrowableReference(expr.expression) ||
ts.isElementAccessExpression(expr) && expr.argumentExpression &&
(ts.isStringLiteral(expr.argumentExpression) || ts.isNumericLiteral(expr.argumentExpression)) &&
@@ -22852,7 +23032,7 @@
}
}
}
- if (expr.expression.kind === 189 &&
+ if (expr.expression.kind === 190 &&
isNarrowableReference(expr.expression.expression)) {
return true;
}
@@ -22866,7 +23046,7 @@
}
function isNarrowingBinaryExpression(expr) {
switch (expr.operatorToken.kind) {
- case 59:
+ case 60:
return isNarrowableReference(expr.left);
case 33:
case 34:
@@ -22874,9 +23054,9 @@
case 36:
return isNarrowableOperand(expr.left) || isNarrowableOperand(expr.right) ||
isNarrowingTypeofOperands(expr.right, expr.left) || isNarrowingTypeofOperands(expr.left, expr.right);
- case 94:
+ case 95:
return isNarrowableOperand(expr.left);
- case 93:
+ case 94:
return isNarrowableInOperands(expr.left, expr.right);
case 27:
return isNarrowingExpression(expr.right);
@@ -22885,11 +23065,11 @@
}
function isNarrowableOperand(expr) {
switch (expr.kind) {
- case 195:
+ case 196:
return isNarrowableOperand(expr.expression);
- case 204:
+ case 205:
switch (expr.operatorToken.kind) {
- case 59:
+ case 60:
return isNarrowableOperand(expr.left);
case 27:
return isNarrowableOperand(expr.right);
@@ -22925,8 +23105,8 @@
if (!expression) {
return flags & 32 ? antecedent : unreachableFlow;
}
- if (expression.kind === 102 && flags & 64 ||
- expression.kind === 87 && flags & 32) {
+ if (expression.kind === 103 && flags & 64 ||
+ expression.kind === 88 && flags & 32) {
return unreachableFlow;
}
if (!isNarrowingExpression(expression)) {
@@ -22964,33 +23144,33 @@
function isStatementCondition(node) {
var parent = node.parent;
switch (parent.kind) {
- case 222:
- case 224:
case 223:
- return parent.expression === node;
case 225:
- case 205:
+ case 224:
+ return parent.expression === node;
+ case 226:
+ case 206:
return parent.condition === node;
}
return false;
}
function isLogicalExpression(node) {
while (true) {
- if (node.kind === 195) {
+ if (node.kind === 196) {
node = node.expression;
}
- else if (node.kind === 202 && node.operator === 52) {
+ else if (node.kind === 203 && node.operator === 52) {
node = node.operand;
}
else {
- return node.kind === 204 && (node.operatorToken.kind === 54 ||
+ return node.kind === 205 && (node.operatorToken.kind === 54 ||
node.operatorToken.kind === 55);
}
}
}
function isTopLevelLogicalExpression(node) {
- while (node.parent.kind === 195 ||
- node.parent.kind === 202 &&
+ while (node.parent.kind === 196 ||
+ node.parent.kind === 203 &&
node.parent.operator === 52) {
node = node.parent;
}
@@ -23032,7 +23212,7 @@
}
function bindDoStatement(node) {
var preDoLabel = createLoopLabel();
- var enclosingLabeledStatement = node.parent.kind === 233
+ var enclosingLabeledStatement = node.parent.kind === 234
? ts.lastOrUndefined(activeLabels)
: undefined;
var preConditionLabel = enclosingLabeledStatement ? enclosingLabeledStatement.continueTarget : createBranchLabel();
@@ -23064,13 +23244,13 @@
var postLoopLabel = createBranchLabel();
addAntecedent(preLoopLabel, currentFlow);
currentFlow = preLoopLabel;
- if (node.kind === 227) {
+ if (node.kind === 228) {
bind(node.awaitModifier);
}
bind(node.expression);
addAntecedent(postLoopLabel, currentFlow);
bind(node.initializer);
- if (node.initializer.kind !== 238) {
+ if (node.initializer.kind !== 239) {
bindAssignmentTargetFlow(node.initializer);
}
bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel);
@@ -23092,7 +23272,7 @@
}
function bindReturnOrThrow(node) {
bind(node.expression);
- if (node.kind === 230) {
+ if (node.kind === 231) {
hasExplicitReturn = true;
if (currentReturnTarget) {
addAntecedent(currentReturnTarget, currentFlow);
@@ -23112,7 +23292,7 @@
return undefined;
}
function bindBreakOrContinueFlow(node, breakTarget, continueTarget) {
- var flowLabel = node.kind === 229 ? breakTarget : continueTarget;
+ var flowLabel = node.kind === 230 ? breakTarget : continueTarget;
if (flowLabel) {
addAntecedent(flowLabel, currentFlow);
currentFlow = unreachableFlow;
@@ -23202,7 +23382,7 @@
preSwitchCaseFlow = currentFlow;
bind(node.caseBlock);
addAntecedent(postSwitchLabel, currentFlow);
- var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 272; });
+ var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 273; });
node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents;
if (!hasDefault) {
addAntecedent(postSwitchLabel, createFlowSwitchClause(preSwitchCaseFlow, node, 0, 0));
@@ -23267,13 +23447,13 @@
if (!activeLabel.referenced && !options.allowUnusedLabels) {
errorOrSuggestionOnNode(ts.unusedLabelIsError(options), node.label, ts.Diagnostics.Unused_label);
}
- if (!node.statement || node.statement.kind !== 223) {
+ if (!node.statement || node.statement.kind !== 224) {
addAntecedent(postStatementLabel, currentFlow);
currentFlow = finishFlowLabel(postStatementLabel);
}
}
function bindDestructuringTargetFlow(node) {
- if (node.kind === 204 && node.operatorToken.kind === 59) {
+ if (node.kind === 205 && node.operatorToken.kind === 60) {
bindAssignmentTargetFlow(node.left);
}
else {
@@ -23284,10 +23464,10 @@
if (isNarrowableReference(node)) {
currentFlow = createFlowAssignment(currentFlow, node);
}
- else if (node.kind === 187) {
+ else if (node.kind === 188) {
for (var _i = 0, _a = node.elements; _i < _a.length; _i++) {
var e = _a[_i];
- if (e.kind === 208) {
+ if (e.kind === 209) {
bindAssignmentTargetFlow(e.expression);
}
else {
@@ -23295,16 +23475,16 @@
}
}
}
- else if (node.kind === 188) {
+ else if (node.kind === 189) {
for (var _b = 0, _c = node.properties; _b < _c.length; _b++) {
var p = _c[_b];
- if (p.kind === 275) {
+ if (p.kind === 276) {
bindDestructuringTargetFlow(p.initializer);
}
- else if (p.kind === 276) {
+ else if (p.kind === 277) {
bindAssignmentTargetFlow(p.name);
}
- else if (p.kind === 277) {
+ else if (p.kind === 278) {
bindAssignmentTargetFlow(p.expression);
}
}
@@ -23360,7 +23540,7 @@
bindEachChild(node);
if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) {
bindAssignmentTargetFlow(node.left);
- if (operator === 59 && node.left.kind === 190) {
+ if (operator === 60 && node.left.kind === 191) {
var elementAccess = node.left;
if (isNarrowableOperand(elementAccess.expression)) {
currentFlow = createFlowArrayMutation(currentFlow, node);
@@ -23371,7 +23551,7 @@
}
function bindDeleteExpressionFlow(node) {
bindEachChild(node);
- if (node.expression.kind === 189) {
+ if (node.expression.kind === 190) {
bindAssignmentTargetFlow(node.expression);
}
}
@@ -23416,10 +23596,10 @@
}
function bindCallExpressionFlow(node) {
var expr = node.expression;
- while (expr.kind === 195) {
+ while (expr.kind === 196) {
expr = expr.expression;
}
- if (expr.kind === 196 || expr.kind === 197) {
+ if (expr.kind === 197 || expr.kind === 198) {
bindEach(node.typeArguments);
bindEach(node.arguments);
bind(node.expression);
@@ -23427,7 +23607,7 @@
else {
bindEachChild(node);
}
- if (node.expression.kind === 189) {
+ if (node.expression.kind === 190) {
var propertyAccess = node.expression;
if (isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) {
currentFlow = createFlowArrayMutation(currentFlow, node);
@@ -23436,53 +23616,53 @@
}
function getContainerFlags(node) {
switch (node.kind) {
- case 209:
- case 240:
- case 243:
- case 188:
- case 168:
- case 297:
- case 268:
- return 1;
+ case 210:
case 241:
- return 1 | 64;
case 244:
+ case 189:
+ case 169:
+ case 298:
+ case 269:
+ return 1;
case 242:
- case 181:
+ return 1 | 64;
+ case 245:
+ case 243:
+ case 182:
return 1 | 32;
- case 284:
+ case 285:
return 1 | 4 | 32;
- case 156:
+ case 157:
if (ts.isObjectLiteralOrClassExpressionMethod(node)) {
return 1 | 4 | 32 | 8 | 128;
}
- case 157:
- case 239:
- case 155:
case 158:
+ case 240:
+ case 156:
case 159:
case 160:
- case 298:
- case 294:
- case 165:
case 161:
- case 162:
+ case 299:
+ case 295:
case 166:
+ case 162:
+ case 163:
+ case 167:
return 1 | 4 | 32 | 8;
- case 196:
case 197:
+ case 198:
return 1 | 4 | 32 | 8 | 16;
- case 245:
+ case 246:
return 4;
- case 154:
+ case 155:
return node.initializer ? 4 : 0;
- case 274:
- case 225:
+ case 275:
case 226:
case 227:
- case 246:
+ case 228:
+ case 247:
return 2;
- case 218:
+ case 219:
return ts.isFunctionLike(node.parent) ? 0 : 2;
}
return 0;
@@ -23495,40 +23675,40 @@
}
function declareSymbolAndAddToSymbolTable(node, symbolFlags, symbolExcludes) {
switch (container.kind) {
- case 244:
+ case 245:
return declareModuleMember(node, symbolFlags, symbolExcludes);
- case 284:
+ case 285:
return declareSourceFileMember(node, symbolFlags, symbolExcludes);
- case 209:
- case 240:
+ case 210:
+ case 241:
return declareClassMember(node, symbolFlags, symbolExcludes);
- case 243:
+ case 244:
return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
- case 168:
- case 297:
- case 188:
- case 241:
- case 268:
+ case 169:
+ case 298:
+ case 189:
+ case 242:
+ case 269:
return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes);
- case 165:
case 166:
- case 160:
+ case 167:
case 161:
- case 298:
case 162:
- case 156:
- case 155:
+ case 299:
+ case 163:
case 157:
+ case 156:
case 158:
case 159:
- case 239:
- case 196:
+ case 160:
+ case 240:
case 197:
- case 294:
- case 309:
- case 302:
- case 242:
- case 181:
+ case 198:
+ case 295:
+ case 310:
+ case 303:
+ case 243:
+ case 182:
return declareSymbol(container.locals, undefined, node, symbolFlags, symbolExcludes);
}
}
@@ -23543,16 +23723,8 @@
: declareSymbol(file.locals, undefined, node, symbolFlags, symbolExcludes);
}
function hasExportDeclarations(node) {
- var body = node.kind === 284 ? node : node.body;
- if (body && (body.kind === 284 || body.kind === 245)) {
- for (var _i = 0, _a = body.statements; _i < _a.length; _i++) {
- var stat = _a[_i];
- if (stat.kind === 255 || stat.kind === 254) {
- return true;
- }
- }
- }
- return false;
+ var body = ts.isSourceFile(node) ? node : ts.tryCast(node.body, ts.isModuleBlock);
+ return !!body && body.statements.some(function (s) { return ts.isExportDeclaration(s) || ts.isExportAssignment(s); });
}
function setExportContextFlag(node) {
if (node.flags & 4194304 && !hasExportDeclarations(node)) {
@@ -23615,11 +23787,11 @@
var seen = ts.createUnderscoreEscapedMap();
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var prop = _a[_i];
- if (prop.kind === 277 || prop.name.kind !== 72) {
+ if (prop.kind === 278 || prop.name.kind !== 73) {
continue;
}
var identifier = prop.name;
- var currentKind = prop.kind === 275 || prop.kind === 276 || prop.kind === 156
+ var currentKind = prop.kind === 276 || prop.kind === 277 || prop.kind === 157
? 1
: 2;
var existingKind = seen.get(identifier.escapedText);
@@ -23651,10 +23823,10 @@
}
function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) {
switch (blockScopeContainer.kind) {
- case 244:
+ case 245:
declareModuleMember(node, symbolFlags, symbolExcludes);
break;
- case 284:
+ case 285:
if (ts.isExternalOrCommonJsModule(container)) {
declareModuleMember(node, symbolFlags, symbolExcludes);
break;
@@ -23684,7 +23856,7 @@
currentFlow = { flags: 2 };
parent = typeAlias;
bind(typeAlias.typeExpression);
- if (!typeAlias.fullName || typeAlias.fullName.kind === 72) {
+ if (!typeAlias.fullName || typeAlias.fullName.kind === 73) {
parent = typeAlias.parent;
bindBlockScopedDeclaration(typeAlias, 524288, 67897832);
}
@@ -23700,8 +23872,8 @@
}
function checkStrictModeIdentifier(node) {
if (inStrictMode &&
- node.originalKeywordKind >= 109 &&
- node.originalKeywordKind <= 117 &&
+ node.originalKeywordKind >= 110 &&
+ node.originalKeywordKind <= 118 &&
!ts.isIdentifierName(node) &&
!(node.flags & 4194304)) {
if (!file.parseDiagnostics.length) {
@@ -23729,7 +23901,7 @@
}
}
function checkStrictModeDeleteExpression(node) {
- if (inStrictMode && node.expression.kind === 72) {
+ if (inStrictMode && node.expression.kind === 73) {
var span = ts.getErrorSpanForNode(file, node.expression);
file.bindDiagnostics.push(ts.createFileDiagnostic(file, span.start, span.length, ts.Diagnostics.delete_cannot_be_called_on_an_identifier_in_strict_mode));
}
@@ -23738,7 +23910,7 @@
return ts.isIdentifier(node) && (node.escapedText === "eval" || node.escapedText === "arguments");
}
function checkStrictModeEvalOrArguments(contextNode, name) {
- if (name && name.kind === 72) {
+ if (name && name.kind === 73) {
var identifier = name;
if (isEvalOrArgumentsIdentifier(identifier)) {
var span = ts.getErrorSpanForNode(file, name);
@@ -23771,8 +23943,8 @@
}
function checkStrictModeFunctionDeclaration(node) {
if (languageVersion < 2) {
- if (blockScopeContainer.kind !== 284 &&
- blockScopeContainer.kind !== 244 &&
+ if (blockScopeContainer.kind !== 285 &&
+ blockScopeContainer.kind !== 245 &&
!ts.isFunctionLike(blockScopeContainer)) {
var errorSpan = ts.getErrorSpanForNode(file, node);
file.bindDiagnostics.push(ts.createFileDiagnostic(file, errorSpan.start, errorSpan.length, getStrictModeBlockScopeFunctionDeclarationMessage(node)));
@@ -23834,7 +24006,7 @@
node.parent = parent;
var saveInStrictMode = inStrictMode;
bindWorker(node);
- if (node.kind > 147) {
+ if (node.kind > 148) {
var saveParent = parent;
parent = node;
var containerFlags = getContainerFlags(node);
@@ -23892,7 +24064,7 @@
}
function bindWorker(node) {
switch (node.kind) {
- case 72:
+ case 73:
if (node.isInJSDocNamespace) {
var parentNode = node.parent;
while (parentNode && !ts.isJSDocTypeAlias(parentNode)) {
@@ -23901,13 +24073,13 @@
bindBlockScopedDeclaration(parentNode, 524288, 67897832);
break;
}
- case 100:
- if (currentFlow && (ts.isExpression(node) || parent.kind === 276)) {
+ case 101:
+ if (currentFlow && (ts.isExpression(node) || parent.kind === 277)) {
node.flowNode = currentFlow;
}
return checkStrictModeIdentifier(node);
- case 189:
case 190:
+ case 191:
if (currentFlow && isNarrowableReference(node)) {
node.flowNode = currentFlow;
}
@@ -23921,7 +24093,7 @@
declareSymbol(file.locals, undefined, node.expression, 1 | 134217728, 67220414);
}
break;
- case 204:
+ case 205:
var specialKind = ts.getAssignmentDeclarationKind(node);
switch (specialKind) {
case 1:
@@ -23948,72 +24120,72 @@
ts.Debug.fail("Unknown binary expression special property assignment kind");
}
return checkStrictModeBinaryExpression(node);
- case 274:
+ case 275:
return checkStrictModeCatchClause(node);
- case 198:
+ case 199:
return checkStrictModeDeleteExpression(node);
case 8:
return checkStrictModeNumericLiteral(node);
- case 203:
+ case 204:
return checkStrictModePostfixUnaryExpression(node);
- case 202:
+ case 203:
return checkStrictModePrefixUnaryExpression(node);
- case 231:
+ case 232:
return checkStrictModeWithStatement(node);
- case 233:
+ case 234:
return checkStrictModeLabeledStatement(node);
- case 178:
+ case 179:
seenThisKeyword = true;
return;
- case 163:
+ case 164:
break;
- case 150:
- return bindTypeParameter(node);
case 151:
+ return bindTypeParameter(node);
+ case 152:
return bindParameter(node);
- case 237:
+ case 238:
return bindVariableDeclarationOrBindingElement(node);
- case 186:
+ case 187:
node.flowNode = currentFlow;
return bindVariableDeclarationOrBindingElement(node);
+ case 155:
case 154:
- case 153:
return bindPropertyWorker(node);
- case 275:
case 276:
+ case 277:
return bindPropertyOrMethodOrAccessor(node, 4, 0);
- case 278:
+ case 279:
return bindPropertyOrMethodOrAccessor(node, 8, 68008959);
- case 160:
case 161:
case 162:
+ case 163:
return declareSymbolAndAddToSymbolTable(node, 131072, 0);
+ case 157:
case 156:
- case 155:
return bindPropertyOrMethodOrAccessor(node, 8192 | (node.questionToken ? 16777216 : 0), ts.isObjectLiteralMethod(node) ? 0 : 67212223);
- case 239:
+ case 240:
return bindFunctionDeclaration(node);
- case 157:
- return declareSymbolAndAddToSymbolTable(node, 16384, 0);
case 158:
- return bindPropertyOrMethodOrAccessor(node, 32768, 67154879);
+ return declareSymbolAndAddToSymbolTable(node, 16384, 0);
case 159:
+ return bindPropertyOrMethodOrAccessor(node, 32768, 67154879);
+ case 160:
return bindPropertyOrMethodOrAccessor(node, 65536, 67187647);
- case 165:
- case 294:
- case 298:
case 166:
+ case 295:
+ case 299:
+ case 167:
return bindFunctionOrConstructorType(node);
- case 168:
- case 297:
- case 181:
+ case 169:
+ case 298:
+ case 182:
return bindAnonymousTypeWorker(node);
- case 188:
+ case 189:
return bindObjectLiteralExpression(node);
- case 196:
case 197:
+ case 198:
return bindFunctionExpression(node);
- case 191:
+ case 192:
var assignmentKind = ts.getAssignmentDeclarationKind(node);
switch (assignmentKind) {
case 7:
@@ -24031,59 +24203,59 @@
bindCallExpression(node);
}
break;
- case 209:
- case 240:
+ case 210:
+ case 241:
inStrictMode = true;
return bindClassLikeDeclaration(node);
- case 241:
- return bindBlockScopedDeclaration(node, 64, 67897736);
case 242:
- return bindBlockScopedDeclaration(node, 524288, 67897832);
+ return bindBlockScopedDeclaration(node, 64, 67897736);
case 243:
- return bindEnumDeclaration(node);
+ return bindBlockScopedDeclaration(node, 524288, 67897832);
case 244:
+ return bindEnumDeclaration(node);
+ case 245:
return bindModuleDeclaration(node);
- case 268:
+ case 269:
return bindJsxAttributes(node);
- case 267:
+ case 268:
return bindJsxAttribute(node, 4, 0);
- case 248:
- case 251:
- case 253:
- case 257:
+ case 249:
+ case 252:
+ case 254:
+ case 258:
return declareSymbolAndAddToSymbolTable(node, 2097152, 2097152);
- case 247:
+ case 248:
return bindNamespaceExportDeclaration(node);
- case 250:
+ case 251:
return bindImportClause(node);
- case 255:
+ case 256:
return bindExportDeclaration(node);
- case 254:
+ case 255:
return bindExportAssignment(node);
- case 284:
+ case 285:
updateStrictModeStatementList(node.statements);
return bindSourceFileIfExternalModule();
- case 218:
+ case 219:
if (!ts.isFunctionLike(node.parent)) {
return;
}
- case 245:
+ case 246:
return updateStrictModeStatementList(node.statements);
- case 304:
- if (node.parent.kind === 298) {
+ case 305:
+ if (node.parent.kind === 299) {
return bindParameter(node);
}
- if (node.parent.kind !== 297) {
+ if (node.parent.kind !== 298) {
break;
}
- case 310:
+ case 311:
var propTag = node;
- var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 293 ?
+ var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 294 ?
4 | 16777216 :
4;
return declareSymbolAndAddToSymbolTable(propTag, flags, 0);
- case 309:
- case 302:
+ case 310:
+ case 303:
return (delayedTypeAliases || (delayedTypeAliases = [])).push(node);
}
}
@@ -24211,10 +24383,10 @@
ts.Debug.assert(ts.isInJSFile(node));
var thisContainer = ts.getThisContainer(node, false);
switch (thisContainer.kind) {
- case 239:
- case 196:
+ case 240:
+ case 197:
var constructorSymbol = thisContainer.symbol;
- if (ts.isBinaryExpression(thisContainer.parent) && thisContainer.parent.operatorToken.kind === 59) {
+ if (ts.isBinaryExpression(thisContainer.parent) && thisContainer.parent.operatorToken.kind === 60) {
var l = thisContainer.parent.left;
if (ts.isPropertyAccessEntityNameExpression(l) && ts.isPrototypeAccess(l.expression)) {
constructorSymbol = lookupSymbolForPropertyAccess(l.expression.expression, thisParentContainer);
@@ -24225,16 +24397,16 @@
declareSymbol(constructorSymbol.members, constructorSymbol, node, 4, 0 & ~4);
}
break;
- case 157:
- case 154:
- case 156:
case 158:
+ case 155:
+ case 157:
case 159:
+ case 160:
var containingClass = thisContainer.parent;
var symbolTable = ts.hasModifier(thisContainer, 32) ? containingClass.symbol.exports : containingClass.symbol.members;
declareSymbol(symbolTable, containingClass.symbol, node, 4, 0, true);
break;
- case 284:
+ case 285:
if (thisContainer.commonJsModuleIndicator) {
declareSymbol(thisContainer.symbol.exports, thisContainer.symbol, node, 4 | 1048576, 0);
}
@@ -24243,14 +24415,14 @@
}
break;
default:
- ts.Debug.fail(ts.Debug.showSyntaxKind(thisContainer));
+ ts.Debug.failBadSyntaxKind(thisContainer);
}
}
function bindSpecialPropertyDeclaration(node) {
- if (node.expression.kind === 100) {
+ if (node.expression.kind === 101) {
bindThisPropertyAssignment(node);
}
- else if (ts.isPropertyAccessEntityNameExpression(node) && node.parent.parent.kind === 284) {
+ else if (ts.isPropertyAccessEntityNameExpression(node) && node.parent.parent.kind === 285) {
if (ts.isPrototypeAccess(node.expression)) {
bindPrototypePropertyAssignment(node, node.parent);
}
@@ -24279,7 +24451,7 @@
}
function bindObjectDefinePropertyAssignment(node) {
var namespaceSymbol = lookupSymbolForPropertyAccess(node.arguments[0]);
- var isToplevel = node.parent.parent.kind === 284;
+ var isToplevel = node.parent.parent.kind === 285;
namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, node.arguments[0], isToplevel, false);
bindPotentiallyNewExpandoMemberToNamespace(node, namespaceSymbol, false);
}
@@ -24291,7 +24463,7 @@
}
node.left.parent = node;
node.right.parent = node;
- if (ts.isIdentifier(lhs.expression) && container === file && isNameOfExportsOrModuleExportsAliasDeclaration(file, lhs.expression)) {
+ if (ts.isIdentifier(lhs.expression) && container === file && isExportsOrModuleExportsOrAlias(file, lhs.expression)) {
bindExportsPropertyAssignment(node);
}
else {
@@ -24335,8 +24507,8 @@
function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty) {
var namespaceSymbol = lookupSymbolForPropertyAccess(name);
var isToplevel = ts.isBinaryExpression(propertyAccess.parent)
- ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 284
- : propertyAccess.parent.parent.kind === 284;
+ ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 285
+ : propertyAccess.parent.parent.kind === 285;
namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, propertyAccess.expression, isToplevel, isPrototypeProperty);
bindPotentiallyNewExpandoMemberToNamespace(propertyAccess, namespaceSymbol, isPrototypeProperty);
}
@@ -24385,9 +24557,7 @@
}
else {
var s = forEachIdentifierInEntityName(e.expression, parent, action);
- if (!s || !s.exports)
- return ts.Debug.fail();
- return action(e.name, s.exports.get(e.name.escapedText), s);
+ return action(e.name, s && s.exports && s.exports.get(e.name.escapedText), s);
}
}
function bindCallExpression(node) {
@@ -24396,7 +24566,7 @@
}
}
function bindClassLikeDeclaration(node) {
- if (node.kind === 240) {
+ if (node.kind === 241) {
bindBlockScopedDeclaration(node, 32, 68008383);
}
else {
@@ -24443,7 +24613,7 @@
}
}
function bindParameter(node) {
- if (node.kind === 304 && container.kind !== 298) {
+ if (node.kind === 305 && container.kind !== 299) {
return;
}
if (inStrictMode && !(node.flags & 4194304)) {
@@ -24516,7 +24686,7 @@
declareSymbolAndAddToSymbolTable(node, 262144, 67635688);
}
}
- else if (node.parent.kind === 176) {
+ else if (node.parent.kind === 177) {
var container_2 = getInferTypeContainer(node.parent);
if (container_2) {
if (!container_2.locals) {
@@ -24541,9 +24711,9 @@
return false;
}
if (currentFlow === unreachableFlow) {
- var reportError = (ts.isStatementButNotDeclaration(node) && node.kind !== 220) ||
- node.kind === 240 ||
- (node.kind === 244 && shouldReportErrorOnModuleDeclaration(node));
+ var reportError = (ts.isStatementButNotDeclaration(node) && node.kind !== 221) ||
+ node.kind === 241 ||
+ (node.kind === 245 && shouldReportErrorOnModuleDeclaration(node));
if (reportError) {
currentFlow = reportedUnreachableFlow;
if (!options.allowUnreachableCode) {
@@ -24575,32 +24745,41 @@
}
function isPurelyTypeDeclaration(s) {
switch (s.kind) {
- case 241:
case 242:
+ case 243:
return true;
- case 244:
+ case 245:
return getModuleInstanceState(s) !== 1;
- case 243:
+ case 244:
return ts.hasModifier(s, 2048);
default:
return false;
}
}
function isExportsOrModuleExportsOrAlias(sourceFile, node) {
- return ts.isExportsIdentifier(node) ||
- ts.isModuleExportsPropertyAccessExpression(node) ||
- ts.isIdentifier(node) && isNameOfExportsOrModuleExportsAliasDeclaration(sourceFile, node);
+ var i = 0;
+ var q = [node];
+ while (q.length && i < 100) {
+ i++;
+ node = q.shift();
+ if (ts.isExportsIdentifier(node) || ts.isModuleExportsPropertyAccessExpression(node)) {
+ return true;
}
- ts.isExportsOrModuleExportsOrAlias = isExportsOrModuleExportsOrAlias;
- function isNameOfExportsOrModuleExportsAliasDeclaration(sourceFile, node) {
+ else if (ts.isIdentifier(node)) {
var symbol = lookupSymbolForNameWorker(sourceFile, node.escapedText);
- return !!symbol && !!symbol.valueDeclaration && ts.isVariableDeclaration(symbol.valueDeclaration) &&
- !!symbol.valueDeclaration.initializer && isExportsOrModuleExportsOrAliasOrAssignment(sourceFile, symbol.valueDeclaration.initializer);
+ if (!!symbol && !!symbol.valueDeclaration && ts.isVariableDeclaration(symbol.valueDeclaration) && !!symbol.valueDeclaration.initializer) {
+ var init = symbol.valueDeclaration.initializer;
+ q.push(init);
+ if (ts.isAssignmentExpression(init, true)) {
+ q.push(init.left);
+ q.push(init.right);
+ }
+ }
+ }
}
- function isExportsOrModuleExportsOrAliasOrAssignment(sourceFile, node) {
- return isExportsOrModuleExportsOrAlias(sourceFile, node) ||
- (ts.isAssignmentExpression(node, true) && (isExportsOrModuleExportsOrAliasOrAssignment(sourceFile, node.left) || isExportsOrModuleExportsOrAliasOrAssignment(sourceFile, node.right)));
+ return false;
}
+ ts.isExportsOrModuleExportsOrAlias = isExportsOrModuleExportsOrAlias;
function lookupSymbolForNameWorker(container, name) {
var local = container.locals && container.locals.get(name);
if (local) {
@@ -24614,58 +24793,58 @@
function computeTransformFlagsForNode(node, subtreeFlags) {
var kind = node.kind;
switch (kind) {
- case 191:
- return computeCallExpression(node, subtreeFlags);
case 192:
+ return computeCallExpression(node, subtreeFlags);
+ case 193:
return computeNewExpression(node, subtreeFlags);
- case 244:
+ case 245:
return computeModuleDeclaration(node, subtreeFlags);
- case 195:
+ case 196:
return computeParenthesizedExpression(node, subtreeFlags);
- case 204:
+ case 205:
return computeBinaryExpression(node, subtreeFlags);
- case 221:
+ case 222:
return computeExpressionStatement(node, subtreeFlags);
- case 151:
+ case 152:
return computeParameter(node, subtreeFlags);
- case 197:
+ case 198:
return computeArrowFunction(node, subtreeFlags);
- case 196:
+ case 197:
return computeFunctionExpression(node, subtreeFlags);
- case 239:
+ case 240:
return computeFunctionDeclaration(node, subtreeFlags);
- case 237:
- return computeVariableDeclaration(node, subtreeFlags);
case 238:
+ return computeVariableDeclaration(node, subtreeFlags);
+ case 239:
return computeVariableDeclarationList(node, subtreeFlags);
- case 219:
+ case 220:
return computeVariableStatement(node, subtreeFlags);
- case 233:
+ case 234:
return computeLabeledStatement(node, subtreeFlags);
- case 240:
+ case 241:
return computeClassDeclaration(node, subtreeFlags);
- case 209:
+ case 210:
return computeClassExpression(node, subtreeFlags);
- case 273:
- return computeHeritageClause(node, subtreeFlags);
case 274:
+ return computeHeritageClause(node, subtreeFlags);
+ case 275:
return computeCatchClause(node, subtreeFlags);
- case 211:
+ case 212:
return computeExpressionWithTypeArguments(node, subtreeFlags);
- case 157:
+ case 158:
return computeConstructor(node, subtreeFlags);
- case 154:
+ case 155:
return computePropertyDeclaration(node, subtreeFlags);
- case 156:
+ case 157:
return computeMethod(node, subtreeFlags);
- case 158:
case 159:
+ case 160:
return computeAccessor(node, subtreeFlags);
- case 248:
+ case 249:
return computeImportEquals(node, subtreeFlags);
- case 189:
- return computePropertyAccess(node, subtreeFlags);
case 190:
+ return computePropertyAccess(node, subtreeFlags);
+ case 191:
return computeElementAccess(node, subtreeFlags);
default:
return computeOther(node, kind, subtreeFlags);
@@ -24685,7 +24864,7 @@
transformFlags |= 2048;
}
}
- if (expression.kind === 92) {
+ if (expression.kind === 93) {
transformFlags |= 524288;
}
node.transformFlags = transformFlags | 536870912;
@@ -24706,14 +24885,14 @@
var transformFlags = subtreeFlags;
var operatorTokenKind = node.operatorToken.kind;
var leftKind = node.left.kind;
- if (operatorTokenKind === 59 && leftKind === 188) {
+ if (operatorTokenKind === 60 && leftKind === 189) {
transformFlags |= 16 | 128 | 512;
}
- else if (operatorTokenKind === 59 && leftKind === 187) {
+ else if (operatorTokenKind === 60 && leftKind === 188) {
transformFlags |= 128 | 512;
}
else if (operatorTokenKind === 41
- || operatorTokenKind === 63) {
+ || operatorTokenKind === 64) {
transformFlags |= 64;
}
node.transformFlags = transformFlags | 536870912;
@@ -24746,8 +24925,8 @@
var transformFlags = subtreeFlags;
var expression = node.expression;
var expressionKind = expression.kind;
- if (expressionKind === 212
- || expressionKind === 194) {
+ if (expressionKind === 213
+ || expressionKind === 195) {
transformFlags |= 1;
}
node.transformFlags = transformFlags | 536870912;
@@ -24780,10 +24959,10 @@
function computeHeritageClause(node, subtreeFlags) {
var transformFlags = subtreeFlags;
switch (node.token) {
- case 86:
+ case 87:
transformFlags |= 128;
break;
- case 109:
+ case 110:
transformFlags |= 1;
break;
default:
@@ -24933,7 +25112,7 @@
}
function computePropertyAccess(node, subtreeFlags) {
var transformFlags = subtreeFlags;
- if (node.expression.kind === 98) {
+ if (node.expression.kind === 99) {
transformFlags |= 32 | 16;
}
node.transformFlags = transformFlags | 536870912;
@@ -24941,7 +25120,7 @@
}
function computeElementAccess(node, subtreeFlags) {
var transformFlags = subtreeFlags;
- if (node.expression.kind === 98) {
+ if (node.expression.kind === 99) {
transformFlags |= 32 | 16;
}
node.transformFlags = transformFlags | 536870912;
@@ -25020,33 +25199,32 @@
var transformFlags = subtreeFlags;
var excludeFlags = 536870912;
switch (kind) {
- case 121:
- case 201:
+ case 122:
+ case 202:
transformFlags |= 16 | 32;
break;
- case 194:
- case 212:
- case 313:
+ case 195:
+ case 213:
+ case 314:
transformFlags |= 1;
excludeFlags = 536870912;
break;
- case 115:
- case 113:
+ case 116:
case 114:
- case 118:
- case 125:
- case 77:
- case 243:
- case 278:
- case 213:
- case 133:
+ case 115:
+ case 119:
+ case 126:
+ case 78:
+ case 244:
+ case 279:
+ case 214:
+ case 134:
transformFlags |= 1;
break;
- case 260:
case 261:
case 262:
- case 11:
case 263:
+ case 11:
case 264:
case 265:
case 266:
@@ -25054,17 +25232,18 @@
case 268:
case 269:
case 270:
+ case 271:
transformFlags |= 2;
break;
case 14:
case 15:
case 16:
case 17:
- case 206:
- case 193:
- case 276:
- case 116:
- case 214:
+ case 207:
+ case 194:
+ case 277:
+ case 117:
+ case 215:
transformFlags |= 128;
break;
case 10:
@@ -25080,28 +25259,27 @@
case 9:
transformFlags |= 4;
break;
- case 227:
+ case 228:
if (node.awaitModifier) {
transformFlags |= 16;
}
transformFlags |= 128;
break;
- case 207:
+ case 208:
transformFlags |= 16 | 128 | 131072;
break;
- case 120:
- case 135:
- case 146:
- case 132:
+ case 121:
case 136:
- case 138:
- case 123:
+ case 147:
+ case 133:
+ case 137:
case 139:
- case 106:
- case 150:
- case 153:
- case 155:
- case 160:
+ case 124:
+ case 140:
+ case 107:
+ case 151:
+ case 154:
+ case 156:
case 161:
case 162:
case 163:
@@ -25119,54 +25297,55 @@
case 175:
case 176:
case 177:
- case 241:
- case 242:
case 178:
+ case 242:
+ case 243:
case 179:
case 180:
case 181:
case 182:
- case 247:
+ case 183:
+ case 248:
transformFlags = 1;
excludeFlags = -2;
break;
- case 149:
+ case 150:
transformFlags |= 16384;
break;
- case 208:
+ case 209:
transformFlags |= 128 | 4096;
break;
- case 277:
+ case 278:
transformFlags |= 16 | 8192;
break;
- case 98:
+ case 99:
transformFlags |= 128;
excludeFlags = 536870912;
break;
- case 100:
+ case 101:
transformFlags |= 2048;
break;
- case 184:
+ case 185:
transformFlags |= 128 | 65536;
if (subtreeFlags & 4096) {
transformFlags |= 16 | 8192;
}
excludeFlags = 536875008;
break;
- case 185:
+ case 186:
transformFlags |= 128 | 65536;
excludeFlags = 536875008;
break;
- case 186:
+ case 187:
transformFlags |= 128;
if (node.dotDotDotToken) {
transformFlags |= 4096;
}
break;
- case 152:
+ case 153:
transformFlags |= 1 | 1024;
break;
- case 188:
+ case 189:
excludeFlags = 536896512;
if (subtreeFlags & 16384) {
transformFlags |= 128;
@@ -25175,24 +25354,24 @@
transformFlags |= 16;
}
break;
- case 187:
+ case 188:
excludeFlags = 536875008;
break;
- case 223:
case 224:
case 225:
case 226:
+ case 227:
if (subtreeFlags & 32768) {
transformFlags |= 128;
}
break;
- case 284:
+ case 285:
break;
- case 230:
+ case 231:
transformFlags |= 262144 | 16;
break;
- case 228:
case 229:
+ case 230:
transformFlags |= 262144;
break;
}
@@ -25203,67 +25382,67 @@
return transformFlags | (node.transformFlags & 2048);
}
function getTransformFlagsSubtreeExclusions(kind) {
- if (kind >= 163 && kind <= 183) {
+ if (kind >= 164 && kind <= 184) {
return -2;
}
switch (kind) {
- case 191:
case 192:
- case 187:
+ case 193:
+ case 188:
return 536875008;
- case 244:
+ case 245:
return 537168896;
- case 151:
+ case 152:
return 536870912;
- case 197:
+ case 198:
return 537371648;
- case 196:
- case 239:
+ case 197:
+ case 240:
return 537373696;
- case 238:
+ case 239:
return 536944640;
- case 240:
- case 209:
+ case 241:
+ case 210:
return 536888320;
- case 157:
- return 537372672;
- case 156:
case 158:
+ return 537372672;
+ case 157:
case 159:
+ case 160:
return 537372672;
- case 120:
- case 135:
- case 146:
- case 132:
- case 138:
+ case 121:
case 136:
- case 123:
+ case 147:
+ case 133:
case 139:
- case 106:
- case 150:
- case 153:
- case 155:
- case 160:
+ case 137:
+ case 124:
+ case 140:
+ case 107:
+ case 151:
+ case 154:
+ case 156:
case 161:
case 162:
- case 241:
+ case 163:
case 242:
+ case 243:
return -2;
- case 188:
+ case 189:
return 536896512;
- case 274:
+ case 275:
return 536879104;
- case 184:
case 185:
+ case 186:
return 536875008;
- case 194:
- case 212:
- case 313:
case 195:
- case 98:
+ case 213:
+ case 314:
+ case 196:
+ case 99:
return 536870912;
- case 189:
case 190:
+ case 191:
return 536870912;
default:
return 536870912;
@@ -25425,7 +25604,7 @@
symbol.exports.forEach(visitSymbol);
}
ts.forEach(symbol.declarations, function (d) {
- if (d.type && d.type.kind === 167) {
+ if (d.type && d.type.kind === 168) {
var query = d.type;
var entity = getResolvedSymbol(getFirstIdentifier(query.exprName));
visitSymbol(entity);
@@ -25512,8 +25691,6 @@
undefinedSymbol.declarations = [];
var globalThisSymbol = createSymbol(1536, "globalThis", 8);
globalThisSymbol.exports = globals;
- globalThisSymbol.valueDeclaration = ts.createNode(72);
- globalThisSymbol.valueDeclaration.escapedText = "globalThis";
globals.set(globalThisSymbol.escapedName, globalThisSymbol);
var argumentsSymbol = createSymbol(4, "arguments");
var requireSymbol = createSymbol(4, "require");
@@ -25523,6 +25700,11 @@
getIdentifierCount: function () { return ts.sum(host.getSourceFiles(), "identifierCount"); },
getSymbolCount: function () { return ts.sum(host.getSourceFiles(), "symbolCount") + symbolCount; },
getTypeCount: function () { return typeCount; },
+ getRelationCacheSizes: function () { return ({
+ assignable: assignableRelation.size,
+ identity: identityRelation.size,
+ subtype: subtypeRelation.size,
+ }); },
isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; },
isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; },
isUnknownSymbol: function (symbol) { return symbol === unknownSymbol; },
@@ -25589,6 +25771,10 @@
node = ts.getParseTreeNode(node);
return node ? getTypeOfNode(node) : errorType;
},
+ getTypeOfAssignmentPattern: function (nodeIn) {
+ var node = ts.getParseTreeNode(nodeIn, ts.isAssignmentPattern);
+ return node && getTypeOfAssignmentPattern(node) || errorType;
+ },
getPropertySymbolOfDestructuringAssignment: function (locationIn) {
var location = ts.getParseTreeNode(locationIn, ts.isIdentifier);
return location ? getPropertySymbolOfDestructuringAssignment(location) : undefined;
@@ -25637,11 +25823,11 @@
},
isContextSensitive: isContextSensitive,
getFullyQualifiedName: getFullyQualifiedName,
- getResolvedSignature: function (node, candidatesOutArray, agumentCount) {
- return getResolvedSignatureWorker(node, candidatesOutArray, agumentCount, 0);
+ getResolvedSignature: function (node, candidatesOutArray, argumentCount) {
+ return getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0);
},
- getResolvedSignatureForSignatureHelp: function (node, candidatesOutArray, agumentCount) {
- return getResolvedSignatureWorker(node, candidatesOutArray, agumentCount, 16);
+ getResolvedSignatureForSignatureHelp: function (node, candidatesOutArray, argumentCount) {
+ return getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16);
},
getExpandedParameters: getExpandedParameters,
hasEffectiveRestParameter: hasEffectiveRestParameter,
@@ -25778,7 +25964,7 @@
var intersectionTypes = ts.createMap();
var literalTypes = ts.createMap();
var indexedAccessTypes = ts.createMap();
- var conditionalTypes = ts.createMap();
+ var substitutionTypes = ts.createMap();
var evolvingArrayTypes = [];
var undefinedProperties = ts.createMap();
var unknownSymbol = createSymbol(4, "unknown");
@@ -25848,6 +26034,7 @@
var reverseMappedCache = ts.createMap();
var ambientModulesCache;
var patternAmbientModules;
+ var patternAmbientModuleAugmentations;
var globalObjectType;
var globalFunctionType;
var globalCallableFunctionType;
@@ -25879,8 +26066,7 @@
var deferredGlobalTemplateStringsArrayType;
var deferredGlobalImportMetaType;
var deferredGlobalExtractSymbol;
- var deferredGlobalExcludeSymbol;
- var deferredGlobalPickSymbol;
+ var deferredGlobalOmitSymbol;
var deferredGlobalBigIntType;
var allPotentiallyUnusedIdentifiers = ts.createMap();
var flowLoopStart = 0;
@@ -25899,6 +26085,8 @@
var symbolLinks = [];
var nodeLinks = [];
var flowLoopCaches = [];
+ var flowAssignmentKeys = [];
+ var flowAssignmentTypes = [];
var flowLoopNodes = [];
var flowLoopKeys = [];
var flowLoopTypes = [];
@@ -25940,6 +26128,7 @@
var typeofType = createTypeofType();
var _jsxNamespace;
var _jsxFactoryEntity;
+ var outofbandVarianceMarkerHandler;
var subtypeRelation = ts.createMap();
var assignableRelation = ts.createMap();
var comparableRelation = ts.createMap();
@@ -26083,7 +26272,8 @@
recordMergedSymbol(result, symbol);
return result;
}
- function mergeSymbol(target, source) {
+ function mergeSymbol(target, source, unidirectional) {
+ if (unidirectional === void 0) { unidirectional = false; }
if (!(target.flags & getExcludedSymbolFlags(source.flags)) ||
(source.flags | target.flags) & 67108864) {
ts.Debug.assert(source !== target);
@@ -26108,18 +26298,22 @@
if (source.members) {
if (!target.members)
target.members = ts.createSymbolTable();
- mergeSymbolTable(target.members, source.members);
+ mergeSymbolTable(target.members, source.members, unidirectional);
}
if (source.exports) {
if (!target.exports)
target.exports = ts.createSymbolTable();
- mergeSymbolTable(target.exports, source.exports);
+ mergeSymbolTable(target.exports, source.exports, unidirectional);
}
+ if (!unidirectional) {
recordMergedSymbol(target, source);
}
+ }
else if (target.flags & 1024) {
+ if (target !== globalThisSymbol) {
error(ts.getNameOfDeclaration(source.declarations[0]), ts.Diagnostics.Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity, symbolToString(target));
}
+ }
else {
var isEitherEnum = !!(target.flags & 384 || source.flags & 384);
var isEitherBlockScoped_1 = !!(target.flags & 2 || source.flags & 2);
@@ -26182,10 +26376,11 @@
mergeSymbolTable(combined, second);
return combined;
}
- function mergeSymbolTable(target, source) {
+ function mergeSymbolTable(target, source, unidirectional) {
+ if (unidirectional === void 0) { unidirectional = false; }
source.forEach(function (sourceSymbol, id) {
var targetSymbol = target.get(id);
- target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol) : sourceSymbol);
+ target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : sourceSymbol);
});
}
function mergeModuleAugmentation(moduleName) {
@@ -26201,13 +26396,22 @@
var moduleNotFoundError = !(moduleName.parent.parent.flags & 4194304)
? ts.Diagnostics.Invalid_module_name_in_augmentation_module_0_cannot_be_found
: undefined;
- var mainModule = resolveExternalModuleNameWorker(moduleName, moduleName, moduleNotFoundError, true);
- if (!mainModule) {
+ var mainModule_1 = resolveExternalModuleNameWorker(moduleName, moduleName, moduleNotFoundError, true);
+ if (!mainModule_1) {
return;
}
- mainModule = resolveExternalModuleSymbol(mainModule);
- if (mainModule.flags & 1920) {
- mainModule = mergeSymbol(mainModule, moduleAugmentation.symbol);
+ mainModule_1 = resolveExternalModuleSymbol(mainModule_1);
+ if (mainModule_1.flags & 1920) {
+ if (ts.some(patternAmbientModules, function (module) { return mainModule_1 === module.symbol; })) {
+ var merged = mergeSymbol(moduleAugmentation.symbol, mainModule_1, true);
+ if (!patternAmbientModuleAugmentations) {
+ patternAmbientModuleAugmentations = ts.createMap();
+ }
+ patternAmbientModuleAugmentations.set(moduleName.text, merged);
+ }
+ else {
+ mergeSymbol(mainModule_1, moduleAugmentation.symbol);
+ }
}
else {
error(moduleName, ts.Diagnostics.Cannot_augment_module_0_because_it_resolves_to_a_non_module_entity, moduleName.text);
@@ -26239,7 +26443,7 @@
return nodeLinks[nodeId] || (nodeLinks[nodeId] = { flags: 0 });
}
function isGlobalSourceFile(node) {
- return node.kind === 284 && !ts.isExternalOrCommonJsModule(node);
+ return node.kind === 285 && !ts.isExternalOrCommonJsModule(node);
}
function getSymbol(symbols, name, meaning) {
if (meaning) {
@@ -26285,26 +26489,29 @@
return sourceFiles.indexOf(declarationFile) <= sourceFiles.indexOf(useFile);
}
if (declaration.pos <= usage.pos) {
- if (declaration.kind === 186) {
- var errorBindingElement = ts.getAncestor(usage, 186);
+ if (declaration.kind === 187) {
+ var errorBindingElement = ts.getAncestor(usage, 187);
if (errorBindingElement) {
return ts.findAncestor(errorBindingElement, ts.isBindingElement) !== ts.findAncestor(declaration, ts.isBindingElement) ||
declaration.pos < errorBindingElement.pos;
}
- return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 237), usage);
+ return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 238), usage);
}
- else if (declaration.kind === 237) {
+ else if (declaration.kind === 238) {
return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage);
}
else if (ts.isClassDeclaration(declaration)) {
return !ts.findAncestor(usage, function (n) { return ts.isComputedPropertyName(n) && n.parent.parent === declaration; });
}
+ else if (ts.isPropertyDeclaration(declaration)) {
+ return !isPropertyImmediatelyReferencedWithinDeclaration(declaration, usage);
+ }
return true;
}
- if (usage.parent.kind === 257 || (usage.parent.kind === 254 && usage.parent.isExportEquals)) {
+ if (usage.parent.kind === 258 || (usage.parent.kind === 255 && usage.parent.isExportEquals)) {
return true;
}
- if (usage.kind === 254 && usage.isExportEquals) {
+ if (usage.kind === 255 && usage.isExportEquals) {
return true;
}
var container = ts.getEnclosingBlockScopeContainer(declaration);
@@ -26312,9 +26519,9 @@
function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) {
var container = ts.getEnclosingBlockScopeContainer(declaration);
switch (declaration.parent.parent.kind) {
- case 219:
- case 225:
- case 227:
+ case 220:
+ case 226:
+ case 228:
if (isSameScopeDescendentOf(usage, declaration, container)) {
return true;
}
@@ -26332,16 +26539,16 @@
return true;
}
var initializerOfProperty = current.parent &&
- current.parent.kind === 154 &&
+ current.parent.kind === 155 &&
current.parent.initializer === current;
if (initializerOfProperty) {
if (ts.hasModifier(current.parent, 32)) {
- if (declaration.kind === 156) {
+ if (declaration.kind === 157) {
return true;
}
}
else {
- var isDeclarationInstanceProperty = declaration.kind === 154 && !ts.hasModifier(declaration, 32);
+ var isDeclarationInstanceProperty = declaration.kind === 155 && !ts.hasModifier(declaration, 32);
if (!isDeclarationInstanceProperty || ts.getContainingClass(usage) !== ts.getContainingClass(declaration)) {
return true;
}
@@ -26350,6 +26557,33 @@
return false;
});
}
+ function isPropertyImmediatelyReferencedWithinDeclaration(declaration, usage) {
+ if (usage.end > declaration.end) {
+ return false;
+ }
+ var ancestorChangingReferenceScope = ts.findAncestor(usage, function (node) {
+ if (node === declaration) {
+ return "quit";
+ }
+ switch (node.kind) {
+ case 198:
+ case 155:
+ return true;
+ case 219:
+ switch (node.parent.kind) {
+ case 159:
+ case 157:
+ case 160:
+ return true;
+ default:
+ return false;
+ }
+ default:
+ return false;
+ }
+ });
+ return ancestorChangingReferenceScope === undefined;
+ }
}
function resolveName(location, name, meaning, nameNotFoundMessage, nameArg, isUse, excludeGlobals, suggestedNameNotFoundMessage) {
if (excludeGlobals === void 0) { excludeGlobals = false; }
@@ -26361,6 +26595,8 @@
var lastLocation;
var lastSelfReferenceLocation;
var propertyWithInvalidInitializer;
+ var associatedDeclarationForContainingInitializer;
+ var withinDeferredContext = false;
var errorLocation = location;
var grandparent;
var isInExternalModule = false;
@@ -26369,11 +26605,11 @@
if (result = lookup(location.locals, name, meaning)) {
var useResult = true;
if (ts.isFunctionLike(location) && lastLocation && lastLocation !== location.body) {
- if (meaning & result.flags & 67897832 && lastLocation.kind !== 296) {
+ if (meaning & result.flags & 67897832 && lastLocation.kind !== 297) {
useResult = result.flags & 262144
? lastLocation === location.type ||
- lastLocation.kind === 151 ||
- lastLocation.kind === 150
+ lastLocation.kind === 152 ||
+ lastLocation.kind === 151
: false;
}
if (meaning & result.flags & 3) {
@@ -26384,13 +26620,13 @@
}
else if (result.flags & 1) {
useResult =
- lastLocation.kind === 151 ||
+ lastLocation.kind === 152 ||
(lastLocation === location.type &&
!!ts.findAncestor(result.valueDeclaration, ts.isParameter));
}
}
}
- else if (location.kind === 175) {
+ else if (location.kind === 176) {
useResult = lastLocation === location.trueType;
}
if (useResult) {
@@ -26401,14 +26637,15 @@
}
}
}
+ withinDeferredContext = withinDeferredContext || getIsDeferredContext(location, lastLocation);
switch (location.kind) {
- case 284:
+ case 285:
if (!ts.isExternalOrCommonJsModule(location))
break;
isInExternalModule = true;
- case 244:
+ case 245:
var moduleExports = getSymbolOfNode(location).exports;
- if (location.kind === 284 || ts.isAmbientModule(location)) {
+ if (location.kind === 285 || ts.isAmbientModule(location)) {
if (result = moduleExports.get("default")) {
var localSymbol = ts.getLocalSymbolForExportDefault(result);
if (localSymbol && (result.flags & meaning) && localSymbol.escapedName === name) {
@@ -26419,7 +26656,7 @@
var moduleExport = moduleExports.get(name);
if (moduleExport &&
moduleExport.flags === 2097152 &&
- ts.getDeclarationOfKind(moduleExport, 257)) {
+ ts.getDeclarationOfKind(moduleExport, 258)) {
break;
}
}
@@ -26432,14 +26669,13 @@
}
}
break;
- case 243:
+ case 244:
if (result = lookup(getSymbolOfNode(location).exports, name, meaning & 8)) {
break loop;
}
break;
- case 154:
- case 153:
- if (ts.isClassLike(location.parent) && !ts.hasModifier(location, 32)) {
+ case 155:
+ if (!ts.hasModifier(location, 32)) {
var ctor = findConstructorDeclaration(location.parent);
if (ctor && ctor.locals) {
if (lookup(ctor.locals, name, meaning & 67220415)) {
@@ -26448,9 +26684,9 @@
}
}
break;
- case 240:
- case 209:
case 241:
+ case 210:
+ case 242:
if (result = lookup(getSymbolOfNode(location).members || emptySymbols, name, meaning & 67897832)) {
if (!isTypeParameterSymbolDeclaredInContainer(result, location)) {
result = undefined;
@@ -26462,7 +26698,7 @@
}
break loop;
}
- if (location.kind === 209 && meaning & 32) {
+ if (location.kind === 210 && meaning & 32) {
var className = location.name;
if (className && name === className.escapedText) {
result = location.symbol;
@@ -26470,8 +26706,8 @@
}
}
break;
- case 211:
- if (lastLocation === location.expression && location.parent.token === 86) {
+ case 212:
+ if (lastLocation === location.expression && location.parent.token === 87) {
var container = location.parent.parent;
if (ts.isClassLike(container) && (result = lookup(getSymbolOfNode(container).members, name, meaning & 67897832))) {
if (nameNotFoundMessage) {
@@ -26481,30 +26717,30 @@
}
}
break;
- case 149:
+ case 150:
grandparent = location.parent.parent;
- if (ts.isClassLike(grandparent) || grandparent.kind === 241) {
+ if (ts.isClassLike(grandparent) || grandparent.kind === 242) {
if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 67897832)) {
error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
return undefined;
}
}
break;
- case 197:
+ case 198:
if (compilerOptions.target >= 2) {
break;
}
- case 156:
case 157:
case 158:
case 159:
- case 239:
+ case 160:
+ case 240:
if (meaning & 3 && name === "arguments") {
result = argumentsSymbol;
break loop;
}
break;
- case 196:
+ case 197:
if (meaning & 3 && name === "arguments") {
result = argumentsSymbol;
break loop;
@@ -26517,18 +26753,31 @@
}
}
break;
- case 152:
- if (location.parent && location.parent.kind === 151) {
+ case 153:
+ if (location.parent && location.parent.kind === 152) {
location = location.parent;
}
- if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 240)) {
+ if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 241)) {
location = location.parent;
}
break;
- case 309:
- case 302:
+ case 310:
+ case 303:
location = ts.getJSDocHost(location);
break;
+ case 152:
+ if (lastLocation && lastLocation === location.initializer) {
+ associatedDeclarationForContainingInitializer = location;
+ }
+ break;
+ case 187:
+ if (lastLocation && lastLocation === location.initializer) {
+ var root = ts.getRootDeclaration(location);
+ if (root.kind === 152) {
+ associatedDeclarationForContainingInitializer = location;
+ }
+ }
+ break;
}
if (isSelfReferenceLocation(location)) {
lastSelfReferenceLocation = location;
@@ -26541,7 +26790,7 @@
}
if (!result) {
if (lastLocation) {
- ts.Debug.assert(lastLocation.kind === 284);
+ ts.Debug.assert(lastLocation.kind === 285);
if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) {
return lastLocation.symbol;
}
@@ -26602,20 +26851,43 @@
if (result && isInExternalModule && (meaning & 67220415) === 67220415 && !(originalLocation.flags & 2097152)) {
var merged = getMergedSymbol(result);
if (ts.length(merged.declarations) && ts.every(merged.declarations, function (d) { return ts.isNamespaceExportDeclaration(d) || ts.isSourceFile(d) && !!d.symbol.globalExports; })) {
- error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, ts.unescapeLeadingUnderscores(name));
+ errorOrSuggestion(!compilerOptions.allowUmdGlobalAccess, errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, ts.unescapeLeadingUnderscores(name));
+ }
+ }
+ if (result && associatedDeclarationForContainingInitializer && !withinDeferredContext && (meaning & 67220415) === 67220415) {
+ var candidate = getMergedSymbol(getLateBoundSymbol(result));
+ var root = ts.getRootDeclaration(associatedDeclarationForContainingInitializer);
+ if (candidate === getSymbolOfNode(associatedDeclarationForContainingInitializer)) {
+ error(errorLocation, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(associatedDeclarationForContainingInitializer.name));
+ }
+ else if (candidate.valueDeclaration && candidate.valueDeclaration.pos > associatedDeclarationForContainingInitializer.pos && root.parent.locals && lookup(root.parent.locals, candidate.escapedName, meaning) === candidate) {
+ error(errorLocation, ts.Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(associatedDeclarationForContainingInitializer.name), ts.declarationNameToString(errorLocation));
}
}
}
return result;
}
+ function getIsDeferredContext(location, lastLocation) {
+ if (location.kind !== 198 && location.kind !== 197) {
+ return ts.isTypeQueryNode(location) || ((ts.isFunctionLikeDeclaration(location) ||
+ (location.kind === 155 && !ts.hasModifier(location, 32))) && (!lastLocation || lastLocation !== location.name));
+ }
+ if (lastLocation && lastLocation === location.name) {
+ return false;
+ }
+ if (location.asteriskToken || ts.hasModifier(location, 256)) {
+ return true;
+ }
+ return !ts.getImmediatelyInvokedFunctionExpression(location);
+ }
function isSelfReferenceLocation(node) {
switch (node.kind) {
- case 239:
case 240:
case 241:
- case 243:
case 242:
case 244:
+ case 243:
+ case 245:
return true;
default:
return false;
@@ -26627,7 +26899,7 @@
function isTypeParameterSymbolDeclaredInContainer(symbol, container) {
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var decl = _a[_i];
- if (decl.kind === 150) {
+ if (decl.kind === 151) {
var parent = ts.isJSDocTemplateTag(decl.parent) ? ts.getJSDocHost(decl.parent) : decl.parent;
if (parent === container) {
return !(ts.isJSDocTemplateTag(decl.parent) && ts.find(decl.parent.parent.tags, ts.isJSDocTypeAlias));
@@ -26675,10 +26947,10 @@
}
function getEntityNameForExtendingInterface(node) {
switch (node.kind) {
- case 72:
- case 189:
+ case 73:
+ case 190:
return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined;
- case 211:
+ case 212:
if (ts.isEntityNameExpression(node.expression)) {
return node.expression;
}
@@ -26765,7 +27037,7 @@
}
function checkResolvedBlockScopedVariable(result, errorLocation) {
ts.Debug.assert(!!(result.flags & 2 || result.flags & 32 || result.flags & 384));
- var declaration = ts.find(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 243) || ts.isInJSFile(d) && !!ts.getJSDocEnumTag(d); });
+ var declaration = ts.find(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 244) || ts.isInJSFile(d) && !!ts.getJSDocEnumTag(d); });
if (declaration === undefined)
return ts.Debug.fail("Declaration to checkResolvedBlockScopedVariable is undefined");
if (!(declaration.flags & 4194304) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) {
@@ -26796,13 +27068,13 @@
}
function getAnyImportSyntax(node) {
switch (node.kind) {
- case 248:
+ case 249:
return node;
- case 250:
- return node.parent;
case 251:
+ return node.parent;
+ case 252:
return node.parent.parent;
- case 253:
+ case 254:
return node.parent.parent.parent;
default:
return undefined;
@@ -26812,7 +27084,7 @@
return ts.find(symbol.declarations, ts.isAliasSymbolDeclaration);
}
function getTargetOfImportEqualsDeclaration(node, dontResolveAlias) {
- if (node.moduleReference.kind === 259) {
+ if (node.moduleReference.kind === 260) {
return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node)));
}
return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, dontResolveAlias);
@@ -26858,8 +27130,17 @@
var file = ts.find(moduleSymbol.declarations, ts.isSourceFile);
var hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias);
if (!exportDefaultSymbol && !hasSyntheticDefault) {
+ if (hasExportAssignmentSymbol(moduleSymbol)) {
+ var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop";
+ var exportEqualsSymbol = moduleSymbol.exports.get("export=");
+ var exportAssignment = exportEqualsSymbol.valueDeclaration;
+ var err = error(node.name, ts.Diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag, symbolToString(moduleSymbol), compilerOptionName);
+ ts.addRelatedInfo(err, ts.createDiagnosticForNode(exportAssignment, ts.Diagnostics.This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag, compilerOptionName));
+ }
+ else {
error(node.name, ts.Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol));
}
+ }
else if (hasSyntheticDefault) {
return resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
}
@@ -26971,20 +27252,20 @@
function getTargetOfAliasDeclaration(node, dontRecursivelyResolve) {
if (dontRecursivelyResolve === void 0) { dontRecursivelyResolve = false; }
switch (node.kind) {
- case 248:
+ case 249:
return getTargetOfImportEqualsDeclaration(node, dontRecursivelyResolve);
- case 250:
- return getTargetOfImportClause(node, dontRecursivelyResolve);
case 251:
+ return getTargetOfImportClause(node, dontRecursivelyResolve);
+ case 252:
return getTargetOfNamespaceImport(node, dontRecursivelyResolve);
- case 253:
+ case 254:
return getTargetOfImportSpecifier(node, dontRecursivelyResolve);
- case 257:
+ case 258:
return getTargetOfExportSpecifier(node, 67220415 | 67897832 | 1920, dontRecursivelyResolve);
- case 254:
- case 204:
+ case 255:
+ case 205:
return getTargetOfExportAssignment(node, dontRecursivelyResolve);
- case 247:
+ case 248:
return getTargetOfNamespaceExportDeclaration(node, dontRecursivelyResolve);
default:
return ts.Debug.fail();
@@ -27038,10 +27319,10 @@
var node = getDeclarationOfAliasSymbol(symbol);
if (!node)
return ts.Debug.fail();
- if (node.kind === 254) {
+ if (node.kind === 255) {
checkExpressionCached(node.expression);
}
- else if (node.kind === 257) {
+ else if (node.kind === 258) {
checkExpressionCached(node.propertyName || node.name);
}
else if (ts.isInternalModuleImportEqualsDeclaration(node)) {
@@ -27050,14 +27331,14 @@
}
}
function getSymbolOfPartOfRightHandSideOfImportEquals(entityName, dontResolveAlias) {
- if (entityName.kind === 72 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {
+ if (entityName.kind === 73 && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {
entityName = entityName.parent;
}
- if (entityName.kind === 72 || entityName.parent.kind === 148) {
+ if (entityName.kind === 73 || entityName.parent.kind === 149) {
return resolveEntityName(entityName, 1920, false, dontResolveAlias);
}
else {
- ts.Debug.assert(entityName.parent.kind === 248);
+ ts.Debug.assert(entityName.parent.kind === 249);
return resolveEntityName(entityName, 67220415 | 67897832 | 1920, false, dontResolveAlias);
}
}
@@ -27070,17 +27351,17 @@
}
var namespaceMeaning = 1920 | (ts.isInJSFile(name) ? meaning & 67220415 : 0);
var symbol;
- if (name.kind === 72) {
- var message = meaning === namespaceMeaning ? ts.Diagnostics.Cannot_find_namespace_0 : getCannotFindNameDiagnosticForName(getFirstIdentifier(name).escapedText);
+ if (name.kind === 73) {
+ var message = meaning === namespaceMeaning ? ts.Diagnostics.Cannot_find_namespace_0 : getCannotFindNameDiagnosticForName(getFirstIdentifier(name));
var symbolFromJSPrototype = ts.isInJSFile(name) ? resolveEntityNameFromAssignmentDeclaration(name, meaning) : undefined;
symbol = resolveName(location || name, name.escapedText, meaning, ignoreErrors || symbolFromJSPrototype ? undefined : message, name, true);
if (!symbol) {
return symbolFromJSPrototype;
}
}
- else if (name.kind === 148 || name.kind === 189) {
- var left = name.kind === 148 ? name.left : name.expression;
- var right = name.kind === 148 ? name.right : name.name;
+ else if (name.kind === 149 || name.kind === 190) {
+ var left = name.kind === 149 ? name.left : name.expression;
+ var right = name.kind === 149 ? name.right : name.name;
var namespace = resolveEntityName(left, namespaceMeaning, ignoreErrors, false, location);
if (!namespace || ts.nodeIsMissing(right)) {
return undefined;
@@ -27205,6 +27486,10 @@
if (patternAmbientModules) {
var pattern = ts.findBestPatternMatch(patternAmbientModules, function (_) { return _.pattern; }, moduleReference);
if (pattern) {
+ var augmentation = patternAmbientModuleAugmentations && patternAmbientModuleAugmentations.get(moduleReference);
+ if (augmentation) {
+ return getMergedSymbol(augmentation);
+ }
return getMergedSymbol(pattern.symbol);
}
}
@@ -27287,7 +27572,7 @@
function resolveESModuleSymbol(moduleSymbol, referencingLocation, dontResolveAlias) {
var symbol = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias);
if (!dontResolveAlias && symbol) {
- if (!(symbol.flags & (1536 | 3)) && !ts.getDeclarationOfKind(symbol, 284)) {
+ if (!(symbol.flags & (1536 | 3)) && !ts.getDeclarationOfKind(symbol, 285)) {
var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015
? "allowSyntheticDefaultImports"
: "esModuleInterop";
@@ -27532,7 +27817,7 @@
var members = node.members;
for (var _i = 0, members_2 = members; _i < members_2.length; _i++) {
var member = members_2[_i];
- if (member.kind === 157 && ts.nodeIsPresent(member.body)) {
+ if (member.kind === 158 && ts.nodeIsPresent(member.body)) {
return member;
}
}
@@ -27613,11 +27898,11 @@
}
}
switch (location.kind) {
- case 284:
+ case 285:
if (!ts.isExternalOrCommonJsModule(location)) {
break;
}
- case 244:
+ case 245:
if (result = callback(getSymbolOfNode(location).exports)) {
return result;
}
@@ -27667,7 +27952,7 @@
&& symbolFromSymbolTable.escapedName !== "default"
&& !(ts.isUMDExportSymbol(symbolFromSymbolTable) && enclosingDeclaration && ts.isExternalModule(ts.getSourceFileOfNode(enclosingDeclaration)))
&& (!useOnlyExternalAliasing || ts.some(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration))
- && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 257))) {
+ && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 258))) {
var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable);
if (isAccessible(symbolFromSymbolTable, resolvedImportedSymbol, ignoreQualification)) {
return [symbolFromSymbolTable];
@@ -27696,7 +27981,7 @@
if (symbolFromSymbolTable === symbol) {
return true;
}
- symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 257)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable;
+ symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 && !ts.getDeclarationOfKind(symbolFromSymbolTable, 258)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable;
if (symbolFromSymbolTable.flags & meaning) {
qualify = true;
return true;
@@ -27710,10 +27995,10 @@
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
switch (declaration.kind) {
- case 154:
- case 156:
- case 158:
+ case 155:
+ case 157:
case 159:
+ case 160:
continue;
default:
return false;
@@ -27801,10 +28086,10 @@
return node && getSymbolOfNode(node);
}
function hasExternalModuleSymbol(declaration) {
- return ts.isAmbientModule(declaration) || (declaration.kind === 284 && ts.isExternalOrCommonJsModule(declaration));
+ return ts.isAmbientModule(declaration) || (declaration.kind === 285 && ts.isExternalOrCommonJsModule(declaration));
}
function hasNonGlobalAugmentationExternalModuleSymbol(declaration) {
- return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 284 && ts.isExternalOrCommonJsModule(declaration));
+ return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 285 && ts.isExternalOrCommonJsModule(declaration));
}
function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) {
var aliasesToMakeVisible;
@@ -27844,13 +28129,13 @@
}
function isEntityNameVisible(entityName, enclosingDeclaration) {
var meaning;
- if (entityName.parent.kind === 167 ||
+ if (entityName.parent.kind === 168 ||
ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent) ||
- entityName.parent.kind === 149) {
+ entityName.parent.kind === 150) {
meaning = 67220415 | 1048576;
}
- else if (entityName.kind === 148 || entityName.kind === 189 ||
- entityName.parent.kind === 248) {
+ else if (entityName.kind === 149 || entityName.kind === 190 ||
+ entityName.parent.kind === 249) {
meaning = 1920;
}
else {
@@ -27895,10 +28180,10 @@
function signatureToStringWorker(writer) {
var sigOutput;
if (flags & 262144) {
- sigOutput = kind === 1 ? 166 : 165;
+ sigOutput = kind === 1 ? 167 : 166;
}
else {
- sigOutput = kind === 1 ? 161 : 160;
+ sigOutput = kind === 1 ? 162 : 161;
}
var sig = nodeBuilder.signatureToSignatureDeclaration(signature, sigOutput, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 | 512);
var printer = ts.createPrinter({ removeComments: true, omitTrailingSemicolon: true });
@@ -27925,6 +28210,15 @@
}
return result;
}
+ function getTypeNamesForErrorDisplay(left, right) {
+ var leftStr = typeToString(left);
+ var rightStr = typeToString(right);
+ if (leftStr === rightStr) {
+ leftStr = typeToString(left, undefined, 64);
+ rightStr = typeToString(right, undefined, 64);
+ }
+ return [leftStr, rightStr];
+ }
function toNodeBuilderFlags(flags) {
if (flags === void 0) { flags = 0; }
return flags & 9469291;
@@ -27992,26 +28286,26 @@
}
if (type.flags & 1) {
context.approximateLength += 3;
- return ts.createKeywordTypeNode(120);
+ return ts.createKeywordTypeNode(121);
}
if (type.flags & 2) {
- return ts.createKeywordTypeNode(143);
+ return ts.createKeywordTypeNode(144);
}
if (type.flags & 4) {
context.approximateLength += 6;
- return ts.createKeywordTypeNode(138);
+ return ts.createKeywordTypeNode(139);
}
if (type.flags & 8) {
context.approximateLength += 6;
- return ts.createKeywordTypeNode(135);
+ return ts.createKeywordTypeNode(136);
}
if (type.flags & 64) {
context.approximateLength += 6;
- return ts.createKeywordTypeNode(146);
+ return ts.createKeywordTypeNode(147);
}
if (type.flags & 16) {
context.approximateLength += 7;
- return ts.createKeywordTypeNode(123);
+ return ts.createKeywordTypeNode(124);
}
if (type.flags & 1024 && !(type.flags & 1048576)) {
var parentSymbol = getParentOfSymbol(type.symbol);
@@ -28029,8 +28323,9 @@
return ts.createLiteralTypeNode(ts.setEmitFlags(ts.createLiteral(type.value), 16777216));
}
if (type.flags & 256) {
- context.approximateLength += (("" + type.value).length);
- return ts.createLiteralTypeNode((ts.createLiteral(type.value)));
+ var value = type.value;
+ context.approximateLength += ("" + value).length;
+ return ts.createLiteralTypeNode(value < 0 ? ts.createPrefix(39, ts.createLiteral(-value)) : ts.createLiteral(value));
}
if (type.flags & 2048) {
context.approximateLength += (ts.pseudoBigIntToString(type.value).length) + 1;
@@ -28051,33 +28346,33 @@
}
}
context.approximateLength += 13;
- return ts.createTypeOperatorNode(142, ts.createKeywordTypeNode(139));
+ return ts.createTypeOperatorNode(143, ts.createKeywordTypeNode(140));
}
if (type.flags & 16384) {
context.approximateLength += 4;
- return ts.createKeywordTypeNode(106);
+ return ts.createKeywordTypeNode(107);
}
if (type.flags & 32768) {
context.approximateLength += 9;
- return ts.createKeywordTypeNode(141);
+ return ts.createKeywordTypeNode(142);
}
if (type.flags & 65536) {
context.approximateLength += 4;
- return ts.createKeywordTypeNode(96);
+ return ts.createKeywordTypeNode(97);
}
if (type.flags & 131072) {
context.approximateLength += 5;
- return ts.createKeywordTypeNode(132);
+ return ts.createKeywordTypeNode(133);
}
if (type.flags & 4096) {
context.approximateLength += 6;
- return ts.createKeywordTypeNode(139);
+ return ts.createKeywordTypeNode(140);
}
if (type.flags & 67108864) {
context.approximateLength += 6;
- return ts.createKeywordTypeNode(136);
+ return ts.createKeywordTypeNode(137);
}
- if (type.flags & 262144 && type.isThisType) {
+ if (isThisTypeParameter(type)) {
if (context.flags & 4194304) {
if (!context.encounteredError && !(context.flags & 32768)) {
context.encounteredError = true;
@@ -28126,7 +28421,7 @@
}
var typeNodes = mapToTypeNodes(types, context, true);
if (typeNodes && typeNodes.length > 0) {
- var unionOrIntersectionTypeNode = ts.createUnionOrIntersectionTypeNode(type.flags & 1048576 ? 173 : 174, typeNodes);
+ var unionOrIntersectionTypeNode = ts.createUnionOrIntersectionTypeNode(type.flags & 1048576 ? 174 : 175, typeNodes);
return unionOrIntersectionTypeNode;
}
else {
@@ -28158,8 +28453,8 @@
context.inferTypeParameters = type.root.inferTypeParameters;
var extendsTypeNode = typeToTypeNodeHelper(type.extendsType, context);
context.inferTypeParameters = saveInferTypeParameters;
- var trueTypeNode = typeToTypeNodeHelper(type.trueType, context);
- var falseTypeNode = typeToTypeNodeHelper(type.falseType, context);
+ var trueTypeNode = typeToTypeNodeHelper(getTrueTypeFromConditionalType(type), context);
+ var falseTypeNode = typeToTypeNodeHelper(getFalseTypeFromConditionalType(type), context);
context.approximateLength += 15;
return ts.createConditionalTypeNode(checkTypeNode, extendsTypeNode, trueTypeNode, falseTypeNode);
}
@@ -28195,7 +28490,7 @@
var isInstanceType = type === getInferredClassType(symbol) ? 67897832 : 67220415;
return symbolToTypeNode(symbol, context, isInstanceType);
}
- else if (symbol.flags & 32 && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration.kind === 209 && context.flags & 2048) ||
+ else if (symbol.flags & 32 && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration.kind === 210 && context.flags & 2048) ||
symbol.flags & (384 | 512) ||
shouldWriteTypeOfFunctionSymbol()) {
return symbolToTypeNode(symbol, context, 67220415);
@@ -28237,7 +28532,7 @@
var isNonLocalFunctionSymbol = !!(symbol.flags & 16) &&
(symbol.parent ||
ts.forEach(symbol.declarations, function (declaration) {
- return declaration.parent.kind === 284 || declaration.parent.kind === 245;
+ return declaration.parent.kind === 285 || declaration.parent.kind === 246;
}));
if (isStaticMethodSymbol || isNonLocalFunctionSymbol) {
return (!!(context.flags & 4096) || (context.visitedTypes && context.visitedTypes.has(typeId))) &&
@@ -28257,12 +28552,12 @@
}
if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) {
var signature = resolved.callSignatures[0];
- var signatureNode = signatureToSignatureDeclarationHelper(signature, 165, context);
+ var signatureNode = signatureToSignatureDeclarationHelper(signature, 166, context);
return signatureNode;
}
if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) {
var signature = resolved.constructSignatures[0];
- var signatureNode = signatureToSignatureDeclarationHelper(signature, 166, context);
+ var signatureNode = signatureToSignatureDeclarationHelper(signature, 167, context);
return signatureNode;
}
}
@@ -28283,7 +28578,7 @@
}
var elementType = typeToTypeNodeHelper(typeArguments[0], context);
var arrayType = ts.createArrayTypeNode(elementType);
- return type.target === globalArrayType ? arrayType : ts.createTypeOperatorNode(133, arrayType);
+ return type.target === globalArrayType ? arrayType : ts.createTypeOperatorNode(134, arrayType);
}
else if (type.target.objectFlags & 8) {
if (typeArguments.length > 0) {
@@ -28297,12 +28592,12 @@
ts.createOptionalTypeNode(tupleConstituentNodes[i]);
}
var tupleTypeNode = ts.createTupleTypeNode(tupleConstituentNodes);
- return type.target.readonly ? ts.createTypeOperatorNode(133, tupleTypeNode) : tupleTypeNode;
+ return type.target.readonly ? ts.createTypeOperatorNode(134, tupleTypeNode) : tupleTypeNode;
}
}
if (context.encounteredError || (context.flags & 524288)) {
var tupleTypeNode = ts.createTupleTypeNode([]);
- return type.target.readonly ? ts.createTypeOperatorNode(133, tupleTypeNode) : tupleTypeNode;
+ return type.target.readonly ? ts.createTypeOperatorNode(134, tupleTypeNode) : tupleTypeNode;
}
context.encounteredError = true;
return undefined;
@@ -28390,11 +28685,11 @@
var typeElements = [];
for (var _i = 0, _a = resolvedType.callSignatures; _i < _a.length; _i++) {
var signature = _a[_i];
- typeElements.push(signatureToSignatureDeclarationHelper(signature, 160, context));
+ typeElements.push(signatureToSignatureDeclarationHelper(signature, 161, context));
}
for (var _b = 0, _c = resolvedType.constructSignatures; _b < _c.length; _b++) {
var signature = _c[_b];
- typeElements.push(signatureToSignatureDeclarationHelper(signature, 161, context));
+ typeElements.push(signatureToSignatureDeclarationHelper(signature, 162, context));
}
if (resolvedType.stringIndexInfo) {
var indexSignature = void 0;
@@ -28441,15 +28736,15 @@
if (!(context.flags & 1)) {
return ts.createTypeReferenceNode(ts.createIdentifier("..."), undefined);
}
- return ts.createKeywordTypeNode(120);
+ return ts.createKeywordTypeNode(121);
}
function addPropertyToElementList(propertySymbol, context, typeElements) {
- var propertyIsReverseMapped = !!(ts.getCheckFlags(propertySymbol) & 4096);
+ var propertyIsReverseMapped = !!(ts.getCheckFlags(propertySymbol) & 8192);
var propertyType = propertyIsReverseMapped && context.flags & 33554432 ?
anyType : getTypeOfSymbol(propertySymbol);
var saveEnclosingDeclaration = context.enclosingDeclaration;
context.enclosingDeclaration = undefined;
- if (context.tracker.trackSymbol && ts.getCheckFlags(propertySymbol) & 2048) {
+ if (context.tracker.trackSymbol && ts.getCheckFlags(propertySymbol) & 4096) {
var decl = ts.first(propertySymbol.declarations);
if (hasLateBindableName(decl)) {
trackComputedName(decl.name, saveEnclosingDeclaration, context);
@@ -28463,7 +28758,7 @@
var signatures = getSignaturesOfType(propertyType, 0);
for (var _i = 0, signatures_1 = signatures; _i < signatures_1.length; _i++) {
var signature = signatures_1[_i];
- var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 155, context);
+ var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 156, context);
methodDeclaration.name = propertyName;
methodDeclaration.questionToken = optionalToken;
if (propertySymbol.valueDeclaration) {
@@ -28480,10 +28775,10 @@
propertyTypeNode = createElidedInformationPlaceholder(context);
}
else {
- propertyTypeNode = propertyType ? typeToTypeNodeHelper(propertyType, context) : ts.createKeywordTypeNode(120);
+ propertyTypeNode = propertyType ? typeToTypeNodeHelper(propertyType, context) : ts.createKeywordTypeNode(121);
}
context.flags = savedFlags;
- var modifiers = isReadonlySymbol(propertySymbol) ? [ts.createToken(133)] : undefined;
+ var modifiers = isReadonlySymbol(propertySymbol) ? [ts.createToken(134)] : undefined;
if (modifiers) {
context.approximateLength += 9;
}
@@ -28532,14 +28827,14 @@
}
function indexInfoToIndexSignatureDeclarationHelper(indexInfo, kind, context) {
var name = ts.getNameFromIndexInfo(indexInfo) || "x";
- var indexerTypeNode = ts.createKeywordTypeNode(kind === 0 ? 138 : 135);
+ var indexerTypeNode = ts.createKeywordTypeNode(kind === 0 ? 139 : 136);
var indexingParameter = ts.createParameter(undefined, undefined, undefined, name, undefined, indexerTypeNode, undefined);
var typeNode = typeToTypeNodeHelper(indexInfo.type || anyType, context);
if (!indexInfo.type && !(context.flags & 2097152)) {
context.encounteredError = true;
}
context.approximateLength += (name.length + 4);
- return ts.createIndexSignature(undefined, indexInfo.isReadonly ? [ts.createToken(133)] : undefined, [indexingParameter], typeNode);
+ return ts.createIndexSignature(undefined, indexInfo.isReadonly ? [ts.createToken(134)] : undefined, [indexingParameter], typeNode);
}
function signatureToSignatureDeclarationHelper(signature, kind, context) {
var typeParameters;
@@ -28550,7 +28845,7 @@
else {
typeParameters = signature.typeParameters && signature.typeParameters.map(function (parameter) { return typeParameterToDeclaration(parameter, context); });
}
- var parameters = getExpandedParameters(signature).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 157); });
+ var parameters = getExpandedParameters(signature).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 158); });
if (signature.thisParameter) {
var thisParameter = symbolToParameterDeclaration(signature.thisParameter, context);
parameters.unshift(thisParameter);
@@ -28569,12 +28864,12 @@
returnTypeNode = returnType && typeToTypeNodeHelper(returnType, context);
}
if (context.flags & 256) {
- if (returnTypeNode && returnTypeNode.kind === 120) {
+ if (returnTypeNode && returnTypeNode.kind === 121) {
returnTypeNode = undefined;
}
}
else if (!returnTypeNode) {
- returnTypeNode = ts.createKeywordTypeNode(120);
+ returnTypeNode = ts.createKeywordTypeNode(121);
}
context.approximateLength += 3;
return ts.createSignatureDeclaration(kind, typeParameters, parameters, returnTypeNode, typeArguments);
@@ -28603,9 +28898,9 @@
return typeParameterToDeclarationWithConstraint(type, context, constraintNode);
}
function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags) {
- var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 151);
+ var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 152);
if (!parameterDeclaration && !isTransientSymbol(parameterSymbol)) {
- parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 304);
+ parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 305);
}
var parameterType = getTypeOfSymbol(parameterSymbol);
if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) {
@@ -28613,16 +28908,16 @@
}
var parameterTypeNode = typeToTypeNodeHelper(parameterType, context);
var modifiers = !(context.flags & 8192) && preserveModifierFlags && parameterDeclaration && parameterDeclaration.modifiers ? parameterDeclaration.modifiers.map(ts.getSynthesizedClone) : undefined;
- var isRest = parameterDeclaration && ts.isRestParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 16384;
+ var isRest = parameterDeclaration && ts.isRestParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 32768;
var dotDotDotToken = isRest ? ts.createToken(25) : undefined;
var name = parameterDeclaration
? parameterDeclaration.name ?
- parameterDeclaration.name.kind === 72 ? ts.setEmitFlags(ts.getSynthesizedClone(parameterDeclaration.name), 16777216) :
- parameterDeclaration.name.kind === 148 ? ts.setEmitFlags(ts.getSynthesizedClone(parameterDeclaration.name.right), 16777216) :
+ parameterDeclaration.name.kind === 73 ? ts.setEmitFlags(ts.getSynthesizedClone(parameterDeclaration.name), 16777216) :
+ parameterDeclaration.name.kind === 149 ? ts.setEmitFlags(ts.getSynthesizedClone(parameterDeclaration.name.right), 16777216) :
cloneBindingName(parameterDeclaration.name) :
ts.symbolName(parameterSymbol)
: ts.symbolName(parameterSymbol);
- var isOptional = parameterDeclaration && isOptionalParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 8192;
+ var isOptional = parameterDeclaration && isOptionalParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 16384;
var questionToken = isOptional ? ts.createToken(56) : undefined;
var parameterNode = ts.createParameter(undefined, modifiers, dotDotDotToken, name, questionToken, parameterTypeNode, undefined);
context.approximateLength += ts.symbolName(parameterSymbol).length + 3;
@@ -28635,7 +28930,7 @@
}
var visited = ts.visitEachChild(node, elideInitializerAndSetEmitFlags, ts.nullTransformationContext, undefined, elideInitializerAndSetEmitFlags);
var clone = ts.nodeIsSynthesized(visited) ? visited : ts.getSynthesizedClone(visited);
- if (clone.kind === 186) {
+ if (clone.kind === 187) {
clone.initializer = undefined;
}
return ts.setEmitFlags(clone, 1 | 16777216);
@@ -28726,6 +29021,11 @@
function lookupTypeParameterNodes(chain, index, context) {
ts.Debug.assert(chain && 0 <= index && index < chain.length);
var symbol = chain[index];
+ var symbolId = "" + getSymbolId(symbol);
+ if (context.typeParameterSymbolList && context.typeParameterSymbolList.get(symbolId)) {
+ return undefined;
+ }
+ (context.typeParameterSymbolList || (context.typeParameterSymbolList = ts.createMap())).set(symbolId, true);
var typeParameterNodes;
if (context.flags & 512 && index < (chain.length - 1)) {
var parentSymbol = symbol;
@@ -28747,7 +29047,7 @@
return top;
}
function getSpecifierForModuleSymbol(symbol, context) {
- var file = ts.getDeclarationOfKind(symbol, 284);
+ var file = ts.getDeclarationOfKind(symbol, 285);
if (file && file.moduleName !== undefined) {
return file.moduleName;
}
@@ -28977,8 +29277,8 @@
}
function getTypeAliasForTypeLiteral(type) {
if (type.symbol && type.symbol.flags & 2048) {
- var node = ts.findAncestor(type.symbol.declarations[0].parent, function (n) { return n.kind !== 177; });
- if (node.kind === 242) {
+ var node = ts.findAncestor(type.symbol.declarations[0].parent, function (n) { return n.kind !== 178; });
+ if (node.kind === 243) {
return getSymbolOfNode(node);
}
}
@@ -28986,11 +29286,11 @@
}
function isTopLevelInExternalModuleAugmentation(node) {
return node && node.parent &&
- node.parent.kind === 245 &&
+ node.parent.kind === 246 &&
ts.isExternalModuleAugmentation(node.parent.parent);
}
function isDefaultBindingContext(location) {
- return location.kind === 284 || ts.isAmbientModule(location);
+ return location.kind === 285 || ts.isAmbientModule(location);
}
function getNameOfSymbolFromNameType(symbol, context) {
var nameType = symbol.nameType;
@@ -29021,7 +29321,7 @@
if (ts.isCallExpression(declaration) && ts.isBindableObjectDefinePropertyCall(declaration)) {
return ts.symbolName(symbol);
}
- if (ts.isComputedPropertyName(name_2) && !(ts.getCheckFlags(symbol) & 2048) && symbol.nameType && symbol.nameType.flags & 384) {
+ if (ts.isComputedPropertyName(name_2) && !(ts.getCheckFlags(symbol) & 4096) && symbol.nameType && symbol.nameType.flags & 384) {
var result = getNameOfSymbolFromNameType(symbol, context);
if (result !== undefined) {
return result;
@@ -29029,17 +29329,17 @@
}
return ts.declarationNameToString(name_2);
}
- if (declaration.parent && declaration.parent.kind === 237) {
+ if (declaration.parent && declaration.parent.kind === 238) {
return ts.declarationNameToString(declaration.parent.name);
}
switch (declaration.kind) {
- case 209:
- case 196:
+ case 210:
case 197:
+ case 198:
if (context && !context.encounteredError && !(context.flags & 131072)) {
context.encounteredError = true;
}
- return declaration.kind === 209 ? "(Anonymous class)" : "(Anonymous function)";
+ return declaration.kind === 210 ? "(Anonymous class)" : "(Anonymous function)";
}
}
var name = getNameOfSymbolFromNameType(symbol, context);
@@ -29056,66 +29356,66 @@
return false;
function determineIfDeclarationIsVisible() {
switch (node.kind) {
- case 302:
- case 309:
+ case 303:
+ case 310:
return !!(node.parent && node.parent.parent && node.parent.parent.parent && ts.isSourceFile(node.parent.parent.parent));
- case 186:
+ case 187:
return isDeclarationVisible(node.parent.parent);
- case 237:
+ case 238:
if (ts.isBindingPattern(node.name) &&
!node.name.elements.length) {
return false;
}
- case 244:
- case 240:
+ case 245:
case 241:
case 242:
- case 239:
case 243:
- case 248:
+ case 240:
+ case 244:
+ case 249:
if (ts.isExternalModuleAugmentation(node)) {
return true;
}
var parent = getDeclarationContainer(node);
if (!(ts.getCombinedModifierFlags(node) & 1) &&
- !(node.kind !== 248 && parent.kind !== 284 && parent.flags & 4194304)) {
+ !(node.kind !== 249 && parent.kind !== 285 && parent.flags & 4194304)) {
return isGlobalSourceFile(parent);
}
return isDeclarationVisible(parent);
+ case 155:
case 154:
- case 153:
- case 158:
case 159:
+ case 160:
+ case 157:
case 156:
- case 155:
if (ts.hasModifier(node, 8 | 16)) {
return false;
}
- case 157:
- case 161:
- case 160:
+ case 158:
case 162:
- case 151:
- case 245:
- case 165:
+ case 161:
+ case 163:
+ case 152:
+ case 246:
case 166:
- case 168:
- case 164:
+ case 167:
case 169:
+ case 165:
case 170:
- case 173:
+ case 171:
case 174:
- case 177:
+ case 175:
+ case 178:
return isDeclarationVisible(node.parent);
- case 250:
case 251:
- case 253:
+ case 252:
+ case 254:
return false;
- case 150:
- case 284:
- case 247:
+ case 151:
+ case 285:
+ case 248:
return true;
- case 254:
+ case 255:
return false;
default:
return false;
@@ -29124,10 +29424,10 @@
}
function collectLinkedAliases(node, setVisibility) {
var exportSymbol;
- if (node.parent && node.parent.kind === 254) {
+ if (node.parent && node.parent.kind === 255) {
exportSymbol = resolveName(node, node.escapedText, 67220415 | 67897832 | 1920 | 2097152, undefined, node, false);
}
- else if (node.parent.kind === 257) {
+ else if (node.parent.kind === 258) {
exportSymbol = getTargetOfExportSpecifier(node.parent, 67220415 | 67897832 | 1920 | 2097152);
}
var result;
@@ -29208,12 +29508,12 @@
function getDeclarationContainer(node) {
return ts.findAncestor(ts.getRootDeclaration(node), function (node) {
switch (node.kind) {
- case 237:
case 238:
+ case 239:
+ case 254:
case 253:
case 252:
case 251:
- case 250:
return false;
default:
return true;
@@ -29239,7 +29539,7 @@
return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, false);
}
function isComputedNonLiteralName(name) {
- return name.kind === 149 && !ts.isStringOrNumericLiteralLike(name.expression);
+ return name.kind === 150 && !ts.isStringOrNumericLiteralLike(name.expression);
}
function getRestType(source, properties, symbol) {
source = filterType(source, function (t) { return !(t.flags & 98304); });
@@ -29254,13 +29554,11 @@
if (omitKeyType.flags & 131072) {
return source;
}
- var pickTypeAlias = getGlobalPickSymbol();
- var excludeTypeAlias = getGlobalExcludeSymbol();
- if (!pickTypeAlias || !excludeTypeAlias) {
+ var omitTypeAlias = getGlobalOmitSymbol();
+ if (!omitTypeAlias) {
return errorType;
}
- var pickKeys = getTypeAliasInstantiation(excludeTypeAlias, [getIndexType(source), omitKeyType]);
- return getTypeAliasInstantiation(pickTypeAlias, [source, pickKeys]);
+ return getTypeAliasInstantiation(omitTypeAlias, [source, omitKeyType]);
}
var members = ts.createSymbolTable();
for (var _i = 0, _a = getPropertiesOfType(source); _i < _a.length; _i++) {
@@ -29284,7 +29582,7 @@
if (parentAccess && parentAccess.flowNode) {
var propName = getDestructuringPropertyName(node);
if (propName) {
- var result = ts.createNode(190, node.pos, node.end);
+ var result = ts.createNode(191, node.pos, node.end);
result.parent = node;
result.expression = parentAccess;
var literal = ts.createNode(10, node.pos, node.end);
@@ -29299,23 +29597,23 @@
function getParentElementAccess(node) {
var ancestor = node.parent.parent;
switch (ancestor.kind) {
- case 186:
- case 275:
- return getSyntheticElementAccess(ancestor);
case 187:
+ case 276:
+ return getSyntheticElementAccess(ancestor);
+ case 188:
return getSyntheticElementAccess(node.parent);
- case 237:
+ case 238:
return ancestor.initializer;
- case 204:
+ case 205:
return ancestor.right;
}
}
function getDestructuringPropertyName(node) {
var parent = node.parent;
- if (node.kind === 186 && parent.kind === 184) {
+ if (node.kind === 187 && parent.kind === 185) {
return getLiteralPropertyNameText(node.propertyName || node.name);
}
- if (node.kind === 275 || node.kind === 276) {
+ if (node.kind === 276 || node.kind === 277) {
return getLiteralPropertyNameText(node.name);
}
return "" + parent.elements.indexOf(node);
@@ -29334,7 +29632,7 @@
parentType = getNonNullableType(parentType);
}
var type;
- if (pattern.kind === 184) {
+ if (pattern.kind === 185) {
if (declaration.dotDotDotToken) {
if (parentType.flags & 2 || !isValidSpreadType(parentType)) {
error(declaration, ts.Diagnostics.Rest_types_may_only_be_created_from_object_types);
@@ -29389,27 +29687,27 @@
}
function isNullOrUndefined(node) {
var expr = ts.skipParentheses(node);
- return expr.kind === 96 || expr.kind === 72 && getResolvedSymbol(expr) === undefinedSymbol;
+ return expr.kind === 97 || expr.kind === 73 && getResolvedSymbol(expr) === undefinedSymbol;
}
function isEmptyArrayLiteral(node) {
var expr = ts.skipParentheses(node);
- return expr.kind === 187 && expr.elements.length === 0;
+ return expr.kind === 188 && expr.elements.length === 0;
}
function addOptionality(type, optional) {
if (optional === void 0) { optional = true; }
return strictNullChecks && optional ? getOptionalType(type) : type;
}
function isParameterOfContextuallyTypedFunction(node) {
- return node.kind === 151 &&
- (node.parent.kind === 196 || node.parent.kind === 197) &&
+ return node.kind === 152 &&
+ (node.parent.kind === 197 || node.parent.kind === 198) &&
!!getContextualType(node.parent);
}
function getTypeForVariableLikeDeclaration(declaration, includeOptionality) {
- if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 226) {
+ if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 227) {
var indexType = getIndexType(getNonNullableTypeIfNeeded(checkExpression(declaration.parent.parent.expression)));
return indexType.flags & (262144 | 4194304) ? getExtractStringType(indexType) : stringType;
}
- if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 227) {
+ if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 228) {
var forOfStatement = declaration.parent.parent;
return checkRightHandSideOfForOf(forOfStatement.expression, forOfStatement.awaitModifier) || anyType;
}
@@ -29423,7 +29721,7 @@
return addOptionality(declaredType, isOptional);
}
if ((noImplicitAny || ts.isInJSFile(declaration)) &&
- declaration.kind === 237 && !ts.isBindingPattern(declaration.name) &&
+ declaration.kind === 238 && !ts.isBindingPattern(declaration.name) &&
!(ts.getCombinedModifierFlags(declaration) & 1) && !(declaration.flags & 4194304)) {
if (!(ts.getCombinedNodeFlags(declaration) & 2) && (!declaration.initializer || isNullOrUndefined(declaration.initializer))) {
return autoType;
@@ -29432,10 +29730,10 @@
return autoArrayType;
}
}
- if (declaration.kind === 151) {
+ if (declaration.kind === 152) {
var func = declaration.parent;
- if (func.kind === 159 && !hasNonBindableDynamicName(func)) {
- var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 158);
+ if (func.kind === 160 && !hasNonBindableDynamicName(func)) {
+ var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 159);
if (getter) {
var getterSignature = getSignatureFromDeclaration(getter);
var thisParameter = getAccessorThisParameter(func);
@@ -29561,7 +29859,7 @@
return type;
}
else if (declaredType !== errorType && type !== errorType && !isTypeIdenticalTo(declaredType, type)) {
- errorNextVariableOrPropertyDeclarationMustHaveSameType(declaredType, declaration, type);
+ errorNextVariableOrPropertyDeclarationMustHaveSameType(undefined, declaredType, declaration, type);
}
}
return declaredType;
@@ -29625,9 +29923,9 @@
}
function isDeclarationInConstructor(expression) {
var thisContainer = ts.getThisContainer(expression, false);
- return thisContainer.kind === 157 ||
- thisContainer.kind === 239 ||
- (thisContainer.kind === 196 && !ts.isPrototypePropertyAssignment(thisContainer.parent));
+ return thisContainer.kind === 158 ||
+ thisContainer.kind === 240 ||
+ (thisContainer.kind === 197 && !ts.isPrototypePropertyAssignment(thisContainer.parent));
}
function getConstructorDefinedThisAssignmentTypes(types, declarations) {
ts.Debug.assert(types.length === declarations.length);
@@ -29695,7 +29993,7 @@
function getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors) {
var elements = pattern.elements;
var lastElement = ts.lastOrUndefined(elements);
- var hasRestElement = !!(lastElement && lastElement.kind === 186 && lastElement.dotDotDotToken);
+ var hasRestElement = !!(lastElement && lastElement.kind === 187 && lastElement.dotDotDotToken);
if (elements.length === 0 || elements.length === 1 && hasRestElement) {
return languageVersion >= 2 ? createIterableType(anyType) : anyArrayType;
}
@@ -29711,7 +30009,7 @@
function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) {
if (includePatternInType === void 0) { includePatternInType = false; }
if (reportErrors === void 0) { reportErrors = false; }
- return pattern.kind === 184
+ return pattern.kind === 185
? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors)
: getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors);
}
@@ -29738,7 +30036,7 @@
}
function declarationBelongsToPrivateAmbientMember(declaration) {
var root = ts.getRootDeclaration(declaration);
- var memberDeclaration = root.kind === 151 ? root.parent : root;
+ var memberDeclaration = root.kind === 152 ? root.parent : root;
return isPrivateWithinAmbient(memberDeclaration);
}
function tryGetTypeFromEffectiveTypeNode(declaration) {
@@ -29791,7 +30089,7 @@
return reportCircularityError(symbol);
}
var type;
- if (declaration.kind === 254) {
+ if (declaration.kind === 255) {
type = widenTypeForVariableLikeDeclaration(checkExpressionCached(declaration.expression), declaration);
}
else if (ts.isInJSFile(declaration) &&
@@ -29839,7 +30137,7 @@
type = getTypeOfEnumMember(symbol);
}
else {
- return ts.Debug.fail("Unhandled declaration kind! " + ts.Debug.showSyntaxKind(declaration) + " for " + ts.Debug.showSymbol(symbol));
+ return ts.Debug.fail("Unhandled declaration kind! " + ts.Debug.formatSyntaxKind(declaration.kind) + " for " + ts.Debug.formatSymbol(symbol));
}
if (!popTypeResolution()) {
if (symbol.flags & 512) {
@@ -29851,7 +30149,7 @@
}
function getAnnotatedAccessorTypeNode(accessor) {
if (accessor) {
- if (accessor.kind === 158) {
+ if (accessor.kind === 159) {
var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor);
return getterTypeAnnotation;
}
@@ -29878,8 +30176,8 @@
return links.type || (links.type = getTypeOfAccessorsWorker(symbol));
}
function getTypeOfAccessorsWorker(symbol) {
- var getter = ts.getDeclarationOfKind(symbol, 158);
- var setter = ts.getDeclarationOfKind(symbol, 159);
+ var getter = ts.getDeclarationOfKind(symbol, 159);
+ var setter = ts.getDeclarationOfKind(symbol, 160);
if (getter && ts.isInJSFile(getter)) {
var jsDocType = getTypeForDeclarationFromJSDocComment(getter);
if (jsDocType) {
@@ -29918,7 +30216,7 @@
if (!popTypeResolution()) {
type = anyType;
if (noImplicitAny) {
- var getter_1 = ts.getDeclarationOfKind(symbol, 158);
+ var getter_1 = ts.getDeclarationOfKind(symbol, 159);
error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
}
}
@@ -29957,8 +30255,8 @@
if (symbol.flags & 1536 && ts.isShorthandAmbientModuleSymbol(symbol)) {
return anyType;
}
- else if (declaration.kind === 204 ||
- declaration.kind === 189 && declaration.parent.kind === 204) {
+ else if (declaration.kind === 205 ||
+ declaration.kind === 190 && declaration.parent.kind === 205) {
return getWidenedTypeFromAssignmentDeclaration(symbol);
}
else if (symbol.flags & 512 && declaration && ts.isSourceFile(declaration) && declaration.commonJsModuleIndicator) {
@@ -30018,16 +30316,28 @@
error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
return errorType;
}
- if (noImplicitAny && (declaration.kind !== 151 || declaration.initializer)) {
+ if (noImplicitAny && (declaration.kind !== 152 || declaration.initializer)) {
error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol));
}
return anyType;
}
+ function getTypeOfSymbolWithDeferredType(symbol) {
+ var links = getSymbolLinks(symbol);
+ if (!links.type) {
+ ts.Debug.assertDefined(links.deferralParent);
+ ts.Debug.assertDefined(links.deferralConstituents);
+ links.type = links.deferralParent.flags & 1048576 ? getUnionType(links.deferralConstituents) : getIntersectionType(links.deferralConstituents);
+ }
+ return links.type;
+ }
function getTypeOfSymbol(symbol) {
+ if (ts.getCheckFlags(symbol) & 65536) {
+ return getTypeOfSymbolWithDeferredType(symbol);
+ }
if (ts.getCheckFlags(symbol) & 1) {
return getTypeOfInstantiatedSymbol(symbol);
}
- if (ts.getCheckFlags(symbol) & 4096) {
+ if (ts.getCheckFlags(symbol) & 8192) {
return getTypeOfReverseMappedSymbol(symbol);
}
if (symbol.flags & (3 | 4)) {
@@ -30083,51 +30393,51 @@
return undefined;
}
switch (node.kind) {
- case 240:
- case 209:
case 241:
- case 160:
+ case 210:
+ case 242:
case 161:
- case 155:
- case 165:
- case 166:
- case 294:
- case 239:
+ case 162:
case 156:
- case 196:
+ case 166:
+ case 167:
+ case 295:
+ case 240:
+ case 157:
case 197:
- case 242:
- case 308:
+ case 198:
+ case 243:
case 309:
- case 302:
- case 181:
- case 175:
+ case 310:
+ case 303:
+ case 182:
+ case 176:
var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes);
- if (node.kind === 181) {
+ if (node.kind === 182) {
return ts.append(outerTypeParameters, getDeclaredTypeOfTypeParameter(getSymbolOfNode(node.typeParameter)));
}
- else if (node.kind === 175) {
+ else if (node.kind === 176) {
return ts.concatenate(outerTypeParameters, getInferTypeParameters(node));
}
var outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, ts.getEffectiveTypeParameterDeclarations(node));
var thisType = includeThisTypes &&
- (node.kind === 240 || node.kind === 209 || node.kind === 241) &&
+ (node.kind === 241 || node.kind === 210 || node.kind === 242) &&
getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType;
return thisType ? ts.append(outerAndOwnTypeParameters, thisType) : outerAndOwnTypeParameters;
}
}
}
function getOuterTypeParametersOfClassOrInterface(symbol) {
- var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 241);
+ var declaration = symbol.flags & 32 ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 242);
return getOuterTypeParameters(declaration);
}
function getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol) {
var result;
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var node = _a[_i];
- if (node.kind === 241 ||
- node.kind === 240 ||
- node.kind === 209 ||
+ if (node.kind === 242 ||
+ node.kind === 241 ||
+ node.kind === 210 ||
ts.isTypeAlias(node)) {
var declaration = node;
result = appendTypeParameters(result, ts.getEffectiveTypeParameterDeclarations(declaration));
@@ -30293,7 +30603,7 @@
type.resolvedBaseTypes = type.resolvedBaseTypes || ts.emptyArray;
for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 241 && ts.getInterfaceBaseTypeNodes(declaration)) {
+ if (declaration.kind === 242 && ts.getInterfaceBaseTypeNodes(declaration)) {
for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) {
var node = _c[_b];
var baseType = getTypeFromTypeNode(node);
@@ -30322,7 +30632,7 @@
function isThislessInterface(symbol) {
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 241) {
+ if (declaration.kind === 242) {
if (declaration.flags & 64) {
return false;
}
@@ -30372,7 +30682,7 @@
return errorType;
}
var declaration = ts.find(symbol.declarations, function (d) {
- return ts.isJSDocTypeAlias(d) || d.kind === 242;
+ return ts.isJSDocTypeAlias(d) || d.kind === 243;
});
var typeNode = ts.isJSDocTypeAlias(declaration) ? declaration.typeExpression : declaration.type;
var type = typeNode ? getTypeFromTypeNode(typeNode) : errorType;
@@ -30396,7 +30706,7 @@
if (expr.kind === 10) {
return true;
}
- else if (expr.kind === 204) {
+ else if (expr.kind === 205) {
return isStringConcatExpression(expr.left) && isStringConcatExpression(expr.right);
}
return false;
@@ -30410,12 +30720,12 @@
case 10:
case 8:
return true;
- case 202:
+ case 203:
return expr.operator === 39 &&
expr.operand.kind === 8;
- case 72:
+ case 73:
return ts.nodeIsMissing(expr) || !!getSymbolOfNode(member.parent).exports.get(expr.escapedText);
- case 204:
+ case 205:
return isStringConcatExpression(expr);
default:
return false;
@@ -30429,7 +30739,7 @@
var hasNonLiteralMember = false;
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 243) {
+ if (declaration.kind === 244) {
for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) {
var member = _c[_b];
if (member.initializer && member.initializer.kind === 10) {
@@ -30456,7 +30766,7 @@
var memberTypeList = [];
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 243) {
+ if (declaration.kind === 244) {
for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) {
var member = _c[_b];
var memberType = getFreshTypeOfLiteralType(getLiteralType(getEnumMemberValue(member), enumCount, getSymbolOfNode(member)));
@@ -30522,23 +30832,23 @@
}
function isThislessType(node) {
switch (node.kind) {
- case 120:
- case 143:
- case 138:
- case 135:
- case 146:
- case 123:
+ case 121:
+ case 144:
case 139:
case 136:
- case 106:
- case 141:
- case 96:
- case 132:
- case 182:
+ case 147:
+ case 124:
+ case 140:
+ case 137:
+ case 107:
+ case 142:
+ case 97:
+ case 133:
+ case 183:
return true;
- case 169:
+ case 170:
return isThislessType(node.elementType);
- case 164:
+ case 165:
return !node.typeArguments || node.typeArguments.every(isThislessType);
}
return false;
@@ -30554,7 +30864,7 @@
function isThislessFunctionLikeDeclaration(node) {
var returnType = ts.getEffectiveReturnTypeNode(node);
var typeParameters = ts.getEffectiveTypeParameterDeclarations(node);
- return (node.kind === 157 || (!!returnType && isThislessType(returnType))) &&
+ return (node.kind === 158 || (!!returnType && isThislessType(returnType))) &&
node.parameters.every(isThislessVariableLikeDeclaration) &&
typeParameters.every(isThislessTypeParameter);
}
@@ -30563,14 +30873,14 @@
var declaration = symbol.declarations[0];
if (declaration) {
switch (declaration.kind) {
+ case 155:
case 154:
- case 153:
return isThislessVariableLikeDeclaration(declaration);
- case 156:
- case 155:
case 157:
+ case 156:
case 158:
case 159:
+ case 160:
return isThislessFunctionLikeDeclaration(declaration);
}
}
@@ -30640,7 +30950,7 @@
return ts.Debug.fail();
}
function addDeclarationToLateBoundSymbol(symbol, member, symbolFlags) {
- ts.Debug.assert(!!(ts.getCheckFlags(symbol) & 2048), "Expected a late-bound symbol.");
+ ts.Debug.assert(!!(ts.getCheckFlags(symbol) & 4096), "Expected a late-bound symbol.");
symbol.flags |= symbolFlags;
getSymbolLinks(member.symbol).lateSymbol = symbol;
if (!symbol.declarations) {
@@ -30666,14 +30976,14 @@
var symbolFlags = decl.symbol.flags;
var lateSymbol = lateSymbols.get(memberName);
if (!lateSymbol)
- lateSymbols.set(memberName, lateSymbol = createSymbol(0, memberName, 2048));
+ lateSymbols.set(memberName, lateSymbol = createSymbol(0, memberName, 4096));
var earlySymbol = earlySymbols && earlySymbols.get(memberName);
if (lateSymbol.flags & getExcludedSymbolFlags(symbolFlags) || earlySymbol) {
var declarations = earlySymbol ? ts.concatenate(earlySymbol.declarations, lateSymbol.declarations) : lateSymbol.declarations;
var name_3 = !(type.flags & 8192) && ts.unescapeLeadingUnderscores(memberName) || ts.declarationNameToString(decl.name);
ts.forEach(declarations, function (declaration) { return error(ts.getNameOfDeclaration(declaration) || declaration, ts.Diagnostics.Property_0_was_also_declared_here, name_3); });
error(decl.name || decl, ts.Diagnostics.Duplicate_property_0, name_3);
- lateSymbol = createSymbol(0, memberName, 2048);
+ lateSymbol = createSymbol(0, memberName, 4096);
}
lateSymbol.nameType = type;
addDeclarationToLateBoundSymbol(lateSymbol, decl, symbolFlags);
@@ -30722,11 +31032,12 @@
if (symbol.flags & 106500 && symbol.escapedName === "__computed") {
var links = getSymbolLinks(symbol);
if (!links.lateSymbol && ts.some(symbol.declarations, hasLateBindableName)) {
+ var parent = getMergedSymbol(symbol.parent);
if (ts.some(symbol.declarations, ts.hasStaticModifier)) {
- getExportsOfSymbol(symbol.parent);
+ getExportsOfSymbol(parent);
}
else {
- getMembersOfSymbol(symbol.parent);
+ getMembersOfSymbol(parent);
}
}
return links.lateSymbol || (links.lateSymbol = symbol);
@@ -30842,8 +31153,8 @@
var tupleRestIndex_1 = restType.target.hasRestElement ? elementTypes.length - 1 : -1;
var restParams = ts.map(elementTypes, function (t, i) {
var name = getParameterNameAtPosition(sig, restIndex_1 + i);
- var checkFlags = i === tupleRestIndex_1 ? 16384 :
- i >= minLength_1 ? 8192 : 0;
+ var checkFlags = i === tupleRestIndex_1 ? 32768 :
+ i >= minLength_1 ? 16384 : 0;
var symbol = createSymbol(1, name, checkFlags);
symbol.type = i === tupleRestIndex_1 ? createArrayType(t) : t;
return symbol;
@@ -30924,9 +31235,10 @@
var s = signature;
if (unionSignatures.length > 1) {
var thisParameter = signature.thisParameter;
- if (ts.forEach(unionSignatures, function (sig) { return sig.thisParameter; })) {
+ var firstThisParameterOfUnionSignatures = ts.forEach(unionSignatures, function (sig) { return sig.thisParameter; });
+ if (firstThisParameterOfUnionSignatures) {
var thisType = getUnionType(ts.map(unionSignatures, function (sig) { return sig.thisParameter ? getTypeOfSymbol(sig.thisParameter) : anyType; }), 2);
- thisParameter = createSymbolWithType(signature.thisParameter, thisType);
+ thisParameter = createSymbolWithType(firstThisParameterOfUnionSignatures, thisType);
}
s = createUnionSignature(signature, unionSignatures);
s.thisParameter = thisParameter;
@@ -31156,7 +31468,7 @@
var members = ts.createSymbolTable();
for (var _i = 0, _a = getPropertiesOfType(type.source); _i < _a.length; _i++) {
var prop = _a[_i];
- var checkFlags = 4096 | (readonlyMask && isReadonlySymbol(prop) ? 8 : 0);
+ var checkFlags = 8192 | (readonlyMask && isReadonlySymbol(prop) ? 8 : 0);
var inferredProp = createSymbol(4 | prop.flags & optionalMask, prop.escapedName, checkFlags);
inferredProp.declarations = prop.declarations;
inferredProp.nameType = prop.nameType;
@@ -31175,7 +31487,15 @@
return getIndexType(getApparentType(type.type));
}
if (type.flags & 16777216) {
- return getLowerBoundOfConditionalType(type);
+ if (type.root.isDistributive) {
+ var checkType = type.checkType;
+ var constraint = getLowerBoundOfKeyType(checkType);
+ if (constraint !== checkType) {
+ var mapper = makeUnaryTypeMapper(type.root.checkType, constraint);
+ return getConditionalTypeInstantiation(type, combineTypeMappers(mapper, type.mapper));
+ }
+ }
+ return type;
}
if (type.flags & 1048576) {
return getUnionType(ts.sameMap(type.types, getLowerBoundOfKeyType));
@@ -31185,16 +31505,6 @@
}
return neverType;
}
- function getLowerBoundOfConditionalType(type) {
- if (type.root.isDistributive) {
- var constraint = getLowerBoundOfKeyType(type.checkType);
- if (constraint !== type.checkType) {
- var mapper = makeUnaryTypeMapper(type.root.checkType, constraint);
- return getConditionalTypeInstantiation(type, combineTypeMappers(mapper, type.mapper));
- }
- }
- return type;
- }
function resolveMappedTypeMembers(type) {
var members = ts.createSymbolTable();
var stringIndexInfo;
@@ -31270,8 +31580,8 @@
}
function isMappedTypeWithKeyofConstraintDeclaration(type) {
var constraintDeclaration = getConstraintDeclarationForMappedType(type);
- return constraintDeclaration.kind === 179 &&
- constraintDeclaration.operator === 129;
+ return constraintDeclaration.kind === 180 &&
+ constraintDeclaration.operator === 130;
}
function getModifiersTypeFromMappedType(type) {
if (!type.modifiersType) {
@@ -31282,7 +31592,7 @@
var declaredType = getTypeFromMappedTypeNode(type.declaration);
var constraint = getConstraintTypeFromMappedType(declaredType);
var extendedConstraint = constraint && constraint.flags & 262144 ? getConstraintOfTypeParameter(constraint) : constraint;
- type.modifiersType = extendedConstraint && extendedConstraint.flags & 4194304 ? instantiateType(extendedConstraint.type, type.mapper || identityMapper) : emptyObjectType;
+ type.modifiersType = extendedConstraint && extendedConstraint.flags & 4194304 ? instantiateType(extendedConstraint.type, type.mapper || identityMapper) : unknownType;
}
}
return type.modifiersType;
@@ -31372,6 +31682,25 @@
}
return type.resolvedProperties;
}
+ function getPossiblePropertiesOfUnionType(type) {
+ if (type.possiblePropertyCache) {
+ return type.possiblePropertyCache.size ? ts.arrayFrom(type.possiblePropertyCache.values()) : ts.emptyArray;
+ }
+ type.possiblePropertyCache = ts.createSymbolTable();
+ for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
+ var t = _a[_i];
+ for (var _b = 0, _c = getPropertiesOfType(t); _b < _c.length; _b++) {
+ var p = _c[_b];
+ if (!type.possiblePropertyCache.has(p.escapedName)) {
+ var prop = getUnionOrIntersectionProperty(type, p.escapedName);
+ if (prop) {
+ type.possiblePropertyCache.set(p.escapedName, prop);
+ }
+ }
+ }
+ }
+ return type.possiblePropertyCache.size ? ts.arrayFrom(type.possiblePropertyCache.values()) : ts.emptyArray;
+ }
function getPropertiesOfType(type) {
type = getApparentType(type);
return type.flags & 3145728 ?
@@ -31418,28 +31747,35 @@
function getConstraintOfIndexedAccess(type) {
return hasNonCircularBaseConstraint(type) ? getConstraintFromIndexedAccess(type) : undefined;
}
+ function getSimplifiedTypeOrConstraint(type) {
+ var simplified = getSimplifiedType(type, false);
+ return simplified !== type ? simplified : getConstraintOfType(type);
+ }
function getConstraintFromIndexedAccess(type) {
- var objectType = getConstraintOfType(type.objectType) || type.objectType;
- if (objectType !== type.objectType) {
- var constraint = getIndexedAccessType(objectType, type.indexType, undefined, errorType);
- if (constraint && constraint !== errorType) {
- return constraint;
+ var indexConstraint = getSimplifiedTypeOrConstraint(type.indexType);
+ if (indexConstraint && indexConstraint !== type.indexType) {
+ var indexedAccess = getIndexedAccessTypeOrUndefined(type.objectType, indexConstraint);
+ if (indexedAccess) {
+ return indexedAccess;
}
}
- var baseConstraint = getBaseConstraintOfType(type);
- return baseConstraint && baseConstraint !== type ? baseConstraint : undefined;
+ var objectConstraint = getSimplifiedTypeOrConstraint(type.objectType);
+ if (objectConstraint && objectConstraint !== type.objectType) {
+ return getIndexedAccessTypeOrUndefined(objectConstraint, type.indexType);
+ }
+ return undefined;
}
function getDefaultConstraintOfConditionalType(type) {
if (!type.resolvedDefaultConstraint) {
var trueConstraint = getInferredTrueTypeFromConditionalType(type);
- var falseConstraint = type.falseType;
+ var falseConstraint = getFalseTypeFromConditionalType(type);
type.resolvedDefaultConstraint = isTypeAny(trueConstraint) ? falseConstraint : isTypeAny(falseConstraint) ? trueConstraint : getUnionType([trueConstraint, falseConstraint]);
}
return type.resolvedDefaultConstraint;
}
function getConstraintOfDistributiveConditionalType(type) {
if (type.root.isDistributive && type.restrictiveInstantiation !== type) {
- var simplified = getSimplifiedType(type.checkType);
+ var simplified = getSimplifiedType(type.checkType, false);
var constraint = simplified === type.checkType ? getConstraintOfType(simplified) : simplified;
if (constraint && constraint !== type.checkType) {
var mapper = makeUnaryTypeMapper(type.root.checkType, constraint);
@@ -31468,9 +31804,6 @@
constraint = getConstraintOfType(constraint);
}
if (constraint) {
- if (!(constraint.flags & 1048576)) {
- return undefined;
- }
constraints = ts.append(constraints, constraint);
}
}
@@ -31519,7 +31852,7 @@
return t.immediateBaseConstraint = noConstraintType;
}
constraintDepth++;
- var result = computeBaseConstraint(getSimplifiedType(t));
+ var result = computeBaseConstraint(getSimplifiedType(t, false));
constraintDepth--;
if (!popTypeResolution()) {
if (t.flags & 262144) {
@@ -31571,8 +31904,8 @@
if (t.flags & 8388608) {
var baseObjectType = getBaseConstraint(t.objectType);
var baseIndexType = getBaseConstraint(t.indexType);
- var baseIndexedAccess = baseObjectType && baseIndexType ? getIndexedAccessType(baseObjectType, baseIndexType, undefined, errorType) : undefined;
- return baseIndexedAccess && baseIndexedAccess !== errorType ? getBaseConstraint(baseIndexedAccess) : undefined;
+ var baseIndexedAccess = baseObjectType && baseIndexType && getIndexedAccessTypeOrUndefined(baseObjectType, baseIndexType);
+ return baseIndexedAccess && getBaseConstraint(baseIndexedAccess);
}
if (t.flags & 16777216) {
var constraint = getConstraintFromConditionalType(t);
@@ -31635,16 +31968,17 @@
return type;
}
function getApparentType(type) {
- var t = type.flags & 63176704 ? getBaseConstraintOfType(type) || emptyObjectType : type;
+ var t = type.flags & 63176704 ? getBaseConstraintOfType(type) || unknownType : type;
return ts.getObjectFlags(t) & 32 ? getApparentTypeOfMappedType(t) :
t.flags & 2097152 ? getApparentTypeOfIntersectionType(t) :
t.flags & 132 ? globalStringType :
t.flags & 296 ? globalNumberType :
- t.flags & 2112 ? getGlobalBigIntType(languageVersion >= 7) :
+ t.flags & 2112 ? getGlobalBigIntType(languageVersion >= 8) :
t.flags & 528 ? globalBooleanType :
t.flags & 12288 ? getGlobalESSymbolType(languageVersion >= 2) :
t.flags & 67108864 ? emptyObjectType :
t.flags & 4194304 ? keyofConstraintType :
+ t.flags & 2 && !strictNullChecks ? emptyObjectType :
t;
}
function createUnionOrIntersectionProperty(containingType, name) {
@@ -31652,7 +31986,7 @@
var indexTypes;
var isUnion = containingType.flags & 1048576;
var excludeModifiers = isUnion ? 24 : 0;
- var commonFlags = isUnion ? 0 : 16777216;
+ var optionalFlag = isUnion ? 0 : 16777216;
var syntheticFlag = 4;
var checkFlags = 0;
for (var _i = 0, _a = containingType.types; _i < _a.length; _i++) {
@@ -31662,16 +31996,21 @@
var prop = getPropertyOfType(type, name);
var modifiers = prop ? ts.getDeclarationModifierFlagsFromSymbol(prop) : 0;
if (prop && !(modifiers & excludeModifiers)) {
- commonFlags &= prop.flags;
+ if (isUnion) {
+ optionalFlag |= (prop.flags & 16777216);
+ }
+ else {
+ optionalFlag &= prop.flags;
+ }
var id = "" + getSymbolId(prop);
if (!propSet.has(id)) {
propSet.set(id, prop);
}
checkFlags |= (isReadonlySymbol(prop) ? 8 : 0) |
- (!(modifiers & 24) ? 128 : 0) |
- (modifiers & 16 ? 256 : 0) |
- (modifiers & 8 ? 512 : 0) |
- (modifiers & 32 ? 1024 : 0);
+ (!(modifiers & 24) ? 256 : 0) |
+ (modifiers & 16 ? 512 : 0) |
+ (modifiers & 8 ? 1024 : 0) |
+ (modifiers & 32 ? 2048 : 0);
if (!isPrototypeProperty(prop)) {
syntheticFlag = 2;
}
@@ -31680,6 +32019,7 @@
var indexInfo = !isLateBoundName(name) && (isNumericLiteralName(name) && getIndexInfoOfType(type, 1) || getIndexInfoOfType(type, 0));
if (indexInfo) {
checkFlags |= indexInfo.isReadonly ? 8 : 0;
+ checkFlags |= 32;
indexTypes = ts.append(indexTypes, isTupleType(type) ? getRestTypeOfTupleType(type) || undefinedType : indexInfo.type);
}
else {
@@ -31716,15 +32056,15 @@
nameType = prop.nameType;
}
else if (type !== firstType) {
- checkFlags |= 32;
+ checkFlags |= 64;
}
if (isLiteralType(type)) {
- checkFlags |= 64;
+ checkFlags |= 128;
}
propTypes.push(type);
}
ts.addRange(propTypes, indexTypes);
- var result = createSymbol(4 | commonFlags, name, syntheticFlag | checkFlags);
+ var result = createSymbol(4 | optionalFlag, name, syntheticFlag | checkFlags);
result.containingType = containingType;
if (!hasNonUniformValueDeclaration && firstValueDeclaration) {
result.valueDeclaration = firstValueDeclaration;
@@ -31734,7 +32074,14 @@
}
result.declarations = declarations;
result.nameType = nameType;
+ if (propTypes.length > 2) {
+ result.checkFlags |= 65536;
+ result.deferralParent = containingType;
+ result.deferralConstituents = propTypes;
+ }
+ else {
result.type = isUnion ? getUnionType(propTypes) : getIntersectionType(propTypes);
+ }
return result;
}
function getUnionOrIntersectionProperty(type, name) {
@@ -31836,10 +32183,10 @@
return result;
}
function isJSDocOptionalParameter(node) {
- return ts.isInJSFile(node) && (node.type && node.type.kind === 293
+ return ts.isInJSFile(node) && (node.type && node.type.kind === 294
|| ts.getJSDocParameterTags(node).some(function (_a) {
var isBracketed = _a.isBracketed, typeExpression = _a.typeExpression;
- return isBracketed || !!typeExpression && typeExpression.type.kind === 293;
+ return isBracketed || !!typeExpression && typeExpression.type.kind === 294;
}));
}
function tryFindAmbientModule(moduleName, withAugmentations) {
@@ -31872,7 +32219,7 @@
return false;
}
var isBracketed = node.isBracketed, typeExpression = node.typeExpression;
- return isBracketed || !!typeExpression && typeExpression.type.kind === 293;
+ return isBracketed || !!typeExpression && typeExpression.type.kind === 294;
}
function createIdentifierTypePredicate(parameterName, parameterIndex, type) {
return { kind: 1, parameterName: parameterName, parameterIndex: parameterIndex, type: type };
@@ -31905,7 +32252,7 @@
var baseDefaultType = getDefaultTypeArgumentType(isJavaScriptImplicitAny);
for (var i = numTypeArguments; i < numTypeParameters; i++) {
var defaultType = getDefaultFromTypeParameter(typeParameters[i]);
- if (isJavaScriptImplicitAny && defaultType && isTypeIdenticalTo(defaultType, emptyObjectType)) {
+ if (isJavaScriptImplicitAny && defaultType && (isTypeIdenticalTo(defaultType, unknownType) || isTypeIdenticalTo(defaultType, emptyObjectType))) {
defaultType = anyType;
}
result[i] = defaultType ? instantiateType(defaultType, createTypeMapper(typeParameters, result)) : baseDefaultType;
@@ -31945,7 +32292,7 @@
else {
parameters.push(paramSymbol);
}
- if (type && type.kind === 182) {
+ if (type && type.kind === 183) {
hasLiteralTypes = true;
}
var isOptionalParameter_1 = isOptionalJSDocParameterTag(param) ||
@@ -31957,16 +32304,16 @@
minArgumentCount = parameters.length;
}
}
- if ((declaration.kind === 158 || declaration.kind === 159) &&
+ if ((declaration.kind === 159 || declaration.kind === 160) &&
!hasNonBindableDynamicName(declaration) &&
(!hasThisParameter || !thisParameter)) {
- var otherKind = declaration.kind === 158 ? 159 : 158;
+ var otherKind = declaration.kind === 159 ? 160 : 159;
var other = ts.getDeclarationOfKind(getSymbolOfNode(declaration), otherKind);
if (other) {
thisParameter = getAnnotatedAccessorThisParameter(other);
}
}
- var classType = declaration.kind === 157 ?
+ var classType = declaration.kind === 158 ?
getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol))
: undefined;
var typeParameters = classType ? classType.localTypeParameters : getTypeParametersFromDeclaration(declaration);
@@ -31984,7 +32331,7 @@
var lastParamVariadicType = ts.firstDefined(lastParamTags, function (p) {
return p.typeExpression && ts.isJSDocVariadicType(p.typeExpression.type) ? p.typeExpression.type : undefined;
});
- var syntheticArgsSymbol = createSymbol(3, "args", 16384);
+ var syntheticArgsSymbol = createSymbol(3, "args", 32768);
syntheticArgsSymbol.type = lastParamVariadicType ? createArrayType(getTypeFromTypeNode(lastParamVariadicType.type)) : anyArrayType;
if (lastParamVariadicType) {
parameters.pop();
@@ -32016,13 +32363,13 @@
if (!node)
return false;
switch (node.kind) {
- case 72:
+ case 73:
return node.escapedText === "arguments" && ts.isExpressionNode(node);
- case 154:
- case 156:
- case 158:
+ case 155:
+ case 157:
case 159:
- return node.name.kind === 149
+ case 160:
+ return node.name.kind === 150
&& traverse(node.name);
default:
return !ts.nodeStartsNewLexicalEnvironment(node) && !ts.isPartOfTypeNode(node) && !!ts.forEachChild(node, traverse);
@@ -32094,7 +32441,7 @@
function createTypePredicateFromTypePredicateNode(node, signature) {
var parameterName = node.parameterName;
var type = getTypeFromTypeNode(node.type);
- if (parameterName.kind === 72) {
+ if (parameterName.kind === 73) {
return createIdentifierTypePredicate(parameterName.escapedText, ts.findIndex(signature.parameters, function (p) { return p.escapedName === parameterName.escapedText; }), type);
}
else {
@@ -32135,7 +32482,7 @@
return signature.resolvedReturnType;
}
function getReturnTypeFromAnnotation(declaration) {
- if (declaration.kind === 157) {
+ if (declaration.kind === 158) {
return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol));
}
if (ts.isJSDocConstructSignature(declaration)) {
@@ -32145,12 +32492,12 @@
if (typeNode) {
return getTypeFromTypeNode(typeNode);
}
- if (declaration.kind === 158 && !hasNonBindableDynamicName(declaration)) {
+ if (declaration.kind === 159 && !hasNonBindableDynamicName(declaration)) {
var jsDocType = ts.isInJSFile(declaration) && getTypeForDeclarationFromJSDocComment(declaration);
if (jsDocType) {
return jsDocType;
}
- var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 159);
+ var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 160);
var setterType = getAnnotatedAccessorType(setter);
if (setterType) {
return setterType;
@@ -32175,7 +32522,7 @@
function getSignatureInstantiation(signature, typeArguments, isJavascript, inferredTypeParameters) {
var instantiatedSignature = getSignatureInstantiationWithoutFillingInTypeArguments(signature, fillMissingTypeArguments(typeArguments, signature.typeParameters, getMinTypeArgumentCount(signature.typeParameters), isJavascript));
if (inferredTypeParameters) {
- var returnSignature = getSingleCallSignature(getReturnTypeOfSignature(instantiatedSignature));
+ var returnSignature = getSingleCallOrConstructSignature(getReturnTypeOfSignature(instantiatedSignature));
if (returnSignature) {
var newReturnSignature = cloneSignature(returnSignature);
newReturnSignature.typeParameters = inferredTypeParameters;
@@ -32221,14 +32568,15 @@
var typeParameters = signature.typeParameters;
if (typeParameters) {
var typeEraser_1 = createTypeEraser(typeParameters);
- var baseConstraints = ts.map(typeParameters, function (tp) { return instantiateType(getBaseConstraintOfType(tp), typeEraser_1) || emptyObjectType; });
+ var baseConstraints = ts.map(typeParameters, function (tp) { return instantiateType(getBaseConstraintOfType(tp), typeEraser_1) || unknownType; });
return instantiateSignature(signature, createTypeMapper(typeParameters, baseConstraints), true);
}
return signature;
}
function getOrCreateTypeFromSignature(signature) {
if (!signature.isolatedSignatureType) {
- var isConstructor = signature.declaration.kind === 157 || signature.declaration.kind === 161;
+ var kind = signature.declaration ? signature.declaration.kind : 0;
+ var isConstructor = kind === 158 || kind === 162 || kind === 167;
var type = createObjectType(16);
type.members = emptySymbols;
type.properties = ts.emptyArray;
@@ -32242,7 +32590,7 @@
return symbol.members.get("__index");
}
function getIndexDeclarationOfSymbol(symbol, kind) {
- var syntaxKind = kind === 1 ? 135 : 138;
+ var syntaxKind = kind === 1 ? 136 : 139;
var indexSymbol = getIndexSymbol(symbol);
if (indexSymbol) {
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
@@ -32269,7 +32617,7 @@
return undefined;
}
function getConstraintDeclaration(type) {
- var decl = type.symbol && ts.getDeclarationOfKind(type.symbol, 150);
+ var decl = type.symbol && ts.getDeclarationOfKind(type.symbol, 151);
return decl && ts.getEffectiveConstraintOfTypeParameter(decl);
}
function getInferredTypeParameterConstraint(typeParameter) {
@@ -32277,9 +32625,9 @@
if (typeParameter.symbol) {
for (var _i = 0, _a = typeParameter.symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.parent.kind === 176) {
+ if (declaration.parent.kind === 177) {
var grandParent = declaration.parent.parent;
- if (grandParent.kind === 164) {
+ if (grandParent.kind === 165) {
var typeReference = grandParent;
var typeParameters = getTypeParametersForTypeReference(typeReference);
if (typeParameters) {
@@ -32296,7 +32644,7 @@
}
}
}
- else if (grandParent.kind === 151 && grandParent.dotDotDotToken) {
+ else if (grandParent.kind === 152 && grandParent.dotDotDotToken) {
inferences = ts.append(inferences, createArrayType(unknownType));
}
}
@@ -32319,7 +32667,7 @@
return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint;
}
function getParentSymbolOfTypeParameter(typeParameter) {
- var tp = ts.getDeclarationOfKind(typeParameter.symbol, 150);
+ var tp = ts.getDeclarationOfKind(typeParameter.symbol, 151);
var host = ts.isJSDocTemplateTag(tp.parent) ? ts.getHostSignatureFromJSDoc(tp.parent) : tp.parent;
return host && getSymbolOfNode(host);
}
@@ -32436,9 +32784,9 @@
}
function getTypeReferenceName(node) {
switch (node.kind) {
- case 164:
+ case 165:
return node.typeName;
- case 211:
+ case 212:
var expr = node.expression;
if (ts.isEntityNameExpression(expr)) {
return expr;
@@ -32522,16 +32870,22 @@
}
}
function getSubstitutionType(typeVariable, substitute) {
- if (substitute.flags & 3) {
+ if (substitute.flags & 3 || substitute === typeVariable) {
return typeVariable;
}
+ var id = getTypeId(typeVariable) + ">" + getTypeId(substitute);
+ var cached = substitutionTypes.get(id);
+ if (cached) {
+ return cached;
+ }
var result = createType(33554432);
result.typeVariable = typeVariable;
result.substitute = substitute;
+ substitutionTypes.set(id, result);
return result;
}
function isUnaryTupleTypeNode(node) {
- return node.kind === 170 && node.elementTypes.length === 1;
+ return node.kind === 171 && node.elementTypes.length === 1;
}
function getImpliedConstraint(typeVariable, checkNode, extendsNode) {
return isUnaryTupleTypeNode(checkNode) && isUnaryTupleTypeNode(extendsNode) ? getImpliedConstraint(typeVariable, checkNode.elementTypes[0], extendsNode.elementTypes[0]) :
@@ -32540,9 +32894,9 @@
}
function getConstrainedTypeVariable(typeVariable, node) {
var constraints;
- while (node && !ts.isStatement(node) && node.kind !== 296) {
+ while (node && !ts.isStatement(node) && node.kind !== 297) {
var parent = node.parent;
- if (parent.kind === 175 && node === parent.trueType) {
+ if (parent.kind === 176 && node === parent.trueType) {
var constraint = getImpliedConstraint(typeVariable, parent.checkType, parent.extendsType);
if (constraint) {
constraints = ts.append(constraints, constraint);
@@ -32553,7 +32907,7 @@
return constraints ? getSubstitutionType(typeVariable, getIntersectionType(ts.append(constraints, typeVariable))) : typeVariable;
}
function isJSDocTypeReference(node) {
- return !!(node.flags & 2097152) && (node.kind === 164 || node.kind === 183);
+ return !!(node.flags & 2097152) && (node.kind === 165 || node.kind === 184);
}
function checkNoTypeArguments(node, symbol) {
if (node.typeArguments) {
@@ -32648,9 +33002,9 @@
for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) {
var declaration = declarations_3[_i];
switch (declaration.kind) {
- case 240:
case 241:
- case 243:
+ case 242:
+ case 244:
return declaration;
}
}
@@ -32735,11 +33089,8 @@
function getGlobalExtractSymbol() {
return deferredGlobalExtractSymbol || (deferredGlobalExtractSymbol = getGlobalSymbol("Extract", 524288, ts.Diagnostics.Cannot_find_global_type_0));
}
- function getGlobalExcludeSymbol() {
- return deferredGlobalExcludeSymbol || (deferredGlobalExcludeSymbol = getGlobalSymbol("Exclude", 524288, ts.Diagnostics.Cannot_find_global_type_0));
- }
- function getGlobalPickSymbol() {
- return deferredGlobalPickSymbol || (deferredGlobalPickSymbol = getGlobalSymbol("Pick", 524288, ts.Diagnostics.Cannot_find_global_type_0));
+ function getGlobalOmitSymbol() {
+ return deferredGlobalOmitSymbol || (deferredGlobalOmitSymbol = getGlobalSymbol("Omit", 524288, ts.Diagnostics.Cannot_find_global_type_0));
}
function getGlobalBigIntType(reportErrors) {
return deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", 0, reportErrors)) || emptyObjectType;
@@ -32773,7 +33124,7 @@
return links.resolvedType;
}
function isReadonlyTypeOperator(node) {
- return ts.isTypeOperatorNode(node) && node.operator === 133;
+ return ts.isTypeOperatorNode(node) && node.operator === 134;
}
function createTupleTypeOfArity(arity, minLength, hasRestElement, readonly, associatedNames) {
var typeParameters;
@@ -32841,8 +33192,8 @@
var links = getNodeLinks(node);
if (!links.resolvedType) {
var lastElement = ts.lastOrUndefined(node.elementTypes);
- var restElement_1 = lastElement && lastElement.kind === 172 ? lastElement : undefined;
- var minLength = ts.findLastIndex(node.elementTypes, function (n) { return n.kind !== 171 && n !== restElement_1; }) + 1;
+ var restElement_1 = lastElement && lastElement.kind === 173 ? lastElement : undefined;
+ var minLength = ts.findLastIndex(node.elementTypes, function (n) { return n.kind !== 172 && n !== restElement_1; }) + 1;
var elementTypes = ts.map(node.elementTypes, function (n) {
var type = getTypeFromTypeNode(n);
return n === restElement_1 && getIndexTypeOfType(type, 1) || type;
@@ -33178,6 +33529,14 @@
types[index] = getUnionTypeFromSortedList(result, 65536);
return true;
}
+ function createIntersectionType(types, aliasSymbol, aliasTypeArguments) {
+ var result = createType(2097152);
+ result.objectFlags = getPropagatingFlagsOfTypes(types, 98304);
+ result.types = types;
+ result.aliasSymbol = aliasSymbol;
+ result.aliasTypeArguments = aliasTypeArguments;
+ return result;
+ }
function getIntersectionType(types, aliasSymbol, aliasTypeArguments) {
var typeSet = [];
var includes = addTypesToIntersection(typeSet, 0, types);
@@ -33205,25 +33564,30 @@
if (typeSet.length === 1) {
return typeSet[0];
}
+ var id = getTypeListId(typeSet);
+ var result = intersectionTypes.get(id);
+ if (!result) {
if (includes & 1048576) {
if (intersectUnionsOfPrimitiveTypes(typeSet)) {
- return getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
+ result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
+ }
+ else {
+ var size = ts.reduceLeft(typeSet, function (n, t) { return n * (t.flags & 1048576 ? t.types.length : 1); }, 1);
+ if (size >= 100000) {
+ error(currentNode, ts.Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
+ return errorType;
}
var unionIndex_1 = ts.findIndex(typeSet, function (t) { return (t.flags & 1048576) !== 0; });
var unionType = typeSet[unionIndex_1];
- return getUnionType(ts.map(unionType.types, function (t) { return getIntersectionType(ts.replaceElement(typeSet, unionIndex_1, t)); }), 1, aliasSymbol, aliasTypeArguments);
+ result = getUnionType(ts.map(unionType.types, function (t) { return getIntersectionType(ts.replaceElement(typeSet, unionIndex_1, t)); }), 1, aliasSymbol, aliasTypeArguments);
}
- var id = getTypeListId(typeSet);
- var type = intersectionTypes.get(id);
- if (!type) {
- type = createType(2097152);
- intersectionTypes.set(id, type);
- type.objectFlags = getPropagatingFlagsOfTypes(typeSet, 98304);
- type.types = typeSet;
- type.aliasSymbol = aliasSymbol;
- type.aliasTypeArguments = aliasTypeArguments;
}
- return type;
+ else {
+ result = createIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
+ }
+ intersectionTypes.set(id, result);
+ }
+ return result;
}
function getTypeFromIntersectionTypeNode(node) {
var links = getNodeLinks(node);
@@ -33279,16 +33643,17 @@
var numberIndexInfo = getIndexInfoOfType(type, 1);
return numberIndexInfo !== enumNumberIndexInfo ? numberIndexInfo : undefined;
}
- function getIndexType(type, stringsOnly) {
+ function getIndexType(type, stringsOnly, noIndexSignatures) {
if (stringsOnly === void 0) { stringsOnly = keyofStringsOnly; }
- return type.flags & 1048576 ? getIntersectionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly); })) :
- type.flags & 2097152 ? getUnionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly); })) :
+ return type.flags & 1048576 ? getIntersectionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
+ type.flags & 2097152 ? getUnionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
maybeTypeOfKind(type, 58982400) ? getIndexTypeForGenericType(type, stringsOnly) :
- ts.getObjectFlags(type) & 32 ? getConstraintTypeFromMappedType(type) :
+ ts.getObjectFlags(type) & 32 ? filterType(getConstraintTypeFromMappedType(type), function (t) { return !(noIndexSignatures && t.flags & (1 | 4)); }) :
type === wildcardType ? wildcardType :
- type.flags & 1 ? keyofConstraintType :
- stringsOnly ? getIndexInfoOfType(type, 0) ? stringType : getLiteralTypeFromProperties(type, 128) :
- getIndexInfoOfType(type, 0) ? getUnionType([stringType, numberType, getLiteralTypeFromProperties(type, 8192)]) :
+ type.flags & 2 ? neverType :
+ type.flags & (1 | 131072) ? keyofConstraintType :
+ stringsOnly ? !noIndexSignatures && getIndexInfoOfType(type, 0) ? stringType : getLiteralTypeFromProperties(type, 128) :
+ !noIndexSignatures && getIndexInfoOfType(type, 0) ? getUnionType([stringType, numberType, getLiteralTypeFromProperties(type, 8192)]) :
getNonEnumNumberIndexInfo(type) ? getUnionType([numberType, getLiteralTypeFromProperties(type, 128 | 8192)]) :
getLiteralTypeFromProperties(type, 8576);
}
@@ -33307,15 +33672,15 @@
var links = getNodeLinks(node);
if (!links.resolvedType) {
switch (node.operator) {
- case 129:
+ case 130:
links.resolvedType = getIndexType(getTypeFromTypeNode(node.type));
break;
- case 142:
- links.resolvedType = node.type.kind === 139
+ case 143:
+ links.resolvedType = node.type.kind === 140
? getESSymbolLikeTypeForNode(ts.walkUpParenthesizedTypes(node.parent))
: errorType;
break;
- case 133:
+ case 134:
links.resolvedType = getTypeFromTypeNode(node.type);
break;
}
@@ -33346,8 +33711,8 @@
}
return false;
}
- function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol, missingType) {
- var accessExpression = accessNode && accessNode.kind === 190 ? accessNode : undefined;
+ function getPropertyTypeForIndexType(originalObjectType, objectType, indexType, fullIndexType, suppressNoImplicitAnyError, accessNode, accessFlags) {
+ var accessExpression = accessNode && accessNode.kind === 191 ? accessNode : undefined;
var propName = isTypeUsableAsPropertyName(indexType) ?
getPropertyNameFromType(indexType) :
accessExpression && checkThatExpressionIsProperSymbolReference(accessExpression.argumentExpression, indexType, false) ?
@@ -33359,12 +33724,12 @@
var prop = getPropertyOfType(objectType, propName);
if (prop) {
if (accessExpression) {
- markPropertyAsReferenced(prop, accessExpression, accessExpression.expression.kind === 100);
+ markPropertyAsReferenced(prop, accessExpression, accessExpression.expression.kind === 101);
if (ts.isAssignmentTarget(accessExpression) && (isReferenceToReadonlyEntity(accessExpression, prop) || isReferenceThroughNamespaceImport(accessExpression))) {
error(accessExpression.argumentExpression, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, symbolToString(prop));
- return missingType;
+ return undefined;
}
- if (cacheSymbol) {
+ if (accessFlags & 4) {
getNodeLinks(accessNode).resolvedSymbol = prop;
}
}
@@ -33383,6 +33748,7 @@
error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.unescapeLeadingUnderscores(propName), typeToString(objectType));
}
}
+ errorIfWritingToReadonlyIndex(getIndexInfoOfType(objectType, 1));
return mapType(objectType, function (t) { return getRestTypeOfTupleType(t) || undefinedType; });
}
}
@@ -33390,17 +33756,21 @@
if (objectType.flags & (1 | 131072)) {
return objectType;
}
- var indexInfo = isTypeAssignableToKind(indexType, 296) && getIndexInfoOfType(objectType, 1) ||
- getIndexInfoOfType(objectType, 0) ||
- undefined;
+ var stringIndexInfo = getIndexInfoOfType(objectType, 0);
+ var indexInfo = isTypeAssignableToKind(indexType, 296) && getIndexInfoOfType(objectType, 1) || stringIndexInfo;
if (indexInfo) {
+ if (accessFlags & 1 && indexInfo === stringIndexInfo) {
+ if (accessExpression) {
+ error(accessExpression, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(originalObjectType));
+ }
+ return undefined;
+ }
if (accessNode && !isTypeAssignableToKind(indexType, 4 | 8)) {
var indexNode = getIndexNodeForAccessExpression(accessNode);
error(indexNode, ts.Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType));
+ return indexInfo.type;
}
- else if (accessExpression && indexInfo.isReadonly && (ts.isAssignmentTarget(accessExpression) || ts.isDeleteTarget(accessExpression))) {
- error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
- }
+ errorIfWritingToReadonlyIndex(indexInfo);
return indexInfo.type;
}
if (indexType.flags & 131072) {
@@ -33413,7 +33783,7 @@
if (objectType.symbol === globalThisSymbol && propName !== undefined && globalThisSymbol.exports.has(propName) && (globalThisSymbol.exports.get(propName).flags & 418)) {
error(accessExpression, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.unescapeLeadingUnderscores(propName), typeToString(objectType));
}
- else if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors) {
+ else if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors && !suppressNoImplicitAnyError) {
if (propName !== undefined && typeHasStaticProperty(propName, objectType)) {
error(accessExpression, ts.Diagnostics.Property_0_is_a_static_member_of_type_1, propName, typeToString(objectType));
}
@@ -33428,11 +33798,35 @@
}
}
else {
- error(accessExpression, ts.Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature, typeToString(objectType));
+ var suggestion_1 = getSuggestionForNonexistentIndexSignature(objectType, accessExpression);
+ if (suggestion_1 !== undefined) {
+ error(accessExpression, ts.Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1, typeToString(objectType), suggestion_1);
}
+ else {
+ var errorInfo = void 0;
+ if (indexType.flags & 1024) {
+ errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Property_0_does_not_exist_on_type_1, "[" + typeToString(indexType) + "]", typeToString(objectType));
+ }
+ else if (indexType.flags & 8192) {
+ var symbolName_2 = getFullyQualifiedName(indexType.symbol, accessExpression);
+ errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Property_0_does_not_exist_on_type_1, "[" + symbolName_2 + "]", typeToString(objectType));
+ }
+ else if (indexType.flags & 128) {
+ errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Property_0_does_not_exist_on_type_1, indexType.value, typeToString(objectType));
+ }
+ else if (indexType.flags & 256) {
+ errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Property_0_does_not_exist_on_type_1, indexType.value, typeToString(objectType));
}
+ else if (indexType.flags & (8 | 4)) {
+ errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.No_index_signature_with_a_parameter_of_type_0_was_found_on_type_1, typeToString(indexType), typeToString(objectType));
}
- return missingType;
+ errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1, typeToString(fullIndexType), typeToString(objectType));
+ diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(accessExpression, errorInfo));
+ }
+ }
+ }
+ }
+ return undefined;
}
}
if (isJSLiteralType(objectType)) {
@@ -33453,14 +33847,19 @@
if (isTypeAny(indexType)) {
return indexType;
}
- return missingType;
+ return undefined;
+ function errorIfWritingToReadonlyIndex(indexInfo) {
+ if (indexInfo && indexInfo.isReadonly && accessExpression && (ts.isAssignmentTarget(accessExpression) || ts.isDeleteTarget(accessExpression))) {
+ error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
+ }
+ }
}
function getIndexNodeForAccessExpression(accessNode) {
- return accessNode.kind === 190
+ return accessNode.kind === 191
? accessNode.argumentExpression
- : accessNode.kind === 180
+ : accessNode.kind === 181
? accessNode.indexType
- : accessNode.kind === 149
+ : accessNode.kind === 150
? accessNode.expression
: accessNode;
}
@@ -33470,49 +33869,92 @@
function isGenericIndexType(type) {
return maybeTypeOfKind(type, 58982400 | 4194304);
}
- function getSimplifiedType(type) {
- return type.flags & 8388608 ? getSimplifiedIndexedAccessType(type) : type;
- }
- function distributeIndexOverObjectType(objectType, indexType) {
- if (objectType.flags & 1048576) {
- return mapType(objectType, function (t) { return getSimplifiedType(getIndexedAccessType(t, indexType)); });
+ function isThisTypeParameter(type) {
+ return !!(type.flags & 262144 && type.isThisType);
}
- if (objectType.flags & 2097152) {
- return getIntersectionType(ts.map(objectType.types, function (t) { return getSimplifiedType(getIndexedAccessType(t, indexType)); }));
+ function getSimplifiedType(type, writing) {
+ return type.flags & 8388608 ? getSimplifiedIndexedAccessType(type, writing) :
+ type.flags & 16777216 ? getSimplifiedConditionalType(type, writing) :
+ type;
}
+ function distributeIndexOverObjectType(objectType, indexType, writing) {
+ if (objectType.flags & 3145728) {
+ var types = ts.map(objectType.types, function (t) { return getSimplifiedType(getIndexedAccessType(t, indexType), writing); });
+ return objectType.flags & 2097152 || writing ? getIntersectionType(types) : getUnionType(types);
}
- function getSimplifiedIndexedAccessType(type) {
- if (type.simplified) {
- return type.simplified === circularConstraintType ? type : type.simplified;
}
- type.simplified = circularConstraintType;
- var objectType = getSimplifiedType(type.objectType);
- var indexType = getSimplifiedType(type.indexType);
+ function distributeObjectOverIndexType(objectType, indexType, writing) {
if (indexType.flags & 1048576) {
- return type.simplified = mapType(indexType, function (t) { return getSimplifiedType(getIndexedAccessType(objectType, t)); });
+ var types = ts.map(indexType.types, function (t) { return getSimplifiedType(getIndexedAccessType(objectType, t), writing); });
+ return writing ? getIntersectionType(types) : getUnionType(types);
+ }
+ }
+ function getSimplifiedIndexedAccessType(type, writing) {
+ var cache = writing ? "simplifiedForWriting" : "simplifiedForReading";
+ if (type[cache]) {
+ return type[cache] === circularConstraintType ? type : type[cache];
+ }
+ type[cache] = circularConstraintType;
+ var objectType = getSimplifiedType(type.objectType, writing);
+ var indexType = getSimplifiedType(type.indexType, writing);
+ var distributedOverIndex = distributeObjectOverIndexType(objectType, indexType, writing);
+ if (distributedOverIndex) {
+ return type[cache] = distributedOverIndex;
}
if (!(indexType.flags & 63176704)) {
- var simplified = distributeIndexOverObjectType(objectType, indexType);
- if (simplified) {
- return type.simplified = simplified;
+ var distributedOverObject = distributeIndexOverObjectType(objectType, indexType, writing);
+ if (distributedOverObject) {
+ return type[cache] = distributedOverObject;
}
}
if (isGenericMappedType(objectType)) {
- return type.simplified = mapType(substituteIndexedMappedType(objectType, type.indexType), getSimplifiedType);
+ return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), function (t) { return getSimplifiedType(t, writing); });
+ }
+ return type[cache] = type;
+ }
+ function getSimplifiedConditionalType(type, writing) {
+ var checkType = type.checkType;
+ var extendsType = type.extendsType;
+ var trueType = getTrueTypeFromConditionalType(type);
+ var falseType = getFalseTypeFromConditionalType(type);
+ if (falseType.flags & 131072 && getActualTypeVariable(trueType) === getActualTypeVariable(checkType)) {
+ if (checkType.flags & 1 || isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) {
+ return getSimplifiedType(trueType, writing);
}
- return type.simplified = type;
+ else if (isIntersectionEmpty(checkType, extendsType)) {
+ return neverType;
+ }
+ }
+ else if (trueType.flags & 131072 && getActualTypeVariable(falseType) === getActualTypeVariable(checkType)) {
+ if (!(checkType.flags & 1) && isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) {
+ return neverType;
+ }
+ else if (checkType.flags & 1 || isIntersectionEmpty(checkType, extendsType)) {
+ return getSimplifiedType(falseType, writing);
+ }
+ }
+ return type;
+ }
+ function isIntersectionEmpty(type1, type2) {
+ return !!(getUnionType([intersectTypes(type1, type2), neverType]).flags & 131072);
}
function substituteIndexedMappedType(objectType, index) {
var mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [index]);
var templateMapper = combineTypeMappers(objectType.mapper, mapper);
return instantiateType(getTemplateTypeFromMappedType(objectType), templateMapper);
}
- function getIndexedAccessType(objectType, indexType, accessNode, missingType) {
- if (missingType === void 0) { missingType = accessNode ? errorType : unknownType; }
+ function getIndexedAccessType(objectType, indexType, accessNode) {
+ return getIndexedAccessTypeOrUndefined(objectType, indexType, accessNode, 0) || (accessNode ? errorType : unknownType);
+ }
+ function getIndexedAccessTypeOrUndefined(objectType, indexType, accessNode, accessFlags) {
+ if (accessFlags === void 0) { accessFlags = 0; }
if (objectType === wildcardType || indexType === wildcardType) {
return wildcardType;
}
- if (isGenericIndexType(indexType) || !(accessNode && accessNode.kind !== 180) && isGenericObjectType(objectType)) {
+ if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 98304) && isTypeAssignableToKind(indexType, 4 | 8)) {
+ indexType = stringType;
+ }
+ if (isGenericIndexType(indexType) || !(accessNode && accessNode.kind !== 181) && isGenericObjectType(objectType)) {
if (objectType.flags & 3) {
return objectType;
}
@@ -33529,23 +33971,23 @@
var wasMissingProp = false;
for (var _i = 0, _a = indexType.types; _i < _a.length; _i++) {
var t = _a[_i];
- var propType = getPropertyTypeForIndexType(apparentObjectType, t, accessNode, false, missingType);
- if (propType === missingType) {
- if (!accessNode) {
- return missingType;
+ var propType = getPropertyTypeForIndexType(objectType, apparentObjectType, t, indexType, wasMissingProp, accessNode, accessFlags);
+ if (propType) {
+ propTypes.push(propType);
+ }
+ else if (!accessNode) {
+ return undefined;
}
else {
wasMissingProp = true;
}
}
- propTypes.push(propType);
- }
if (wasMissingProp) {
- return missingType;
+ return undefined;
}
- return getUnionType(propTypes);
+ return accessFlags & 2 ? getIntersectionType(propTypes) : getUnionType(propTypes);
}
- return getPropertyTypeForIndexType(apparentObjectType, indexType, accessNode, true, missingType);
+ return getPropertyTypeForIndexType(objectType, apparentObjectType, indexType, indexType, false, accessNode, accessFlags | 4);
}
function getTypeFromIndexedAccessTypeNode(node) {
var links = getNodeLinks(node);
@@ -33573,10 +34015,14 @@
return links.resolvedType;
}
function getActualTypeVariable(type) {
- return type.flags & 33554432 ? type.typeVariable : type;
+ if (type.flags & 33554432) {
+ return type.typeVariable;
}
- function isIntersectionEmpty(type1, type2) {
- return !!(getUnionType([intersectTypes(type1, type2), neverType]).flags & 131072);
+ if (type.flags & 8388608 && (type.objectType.flags & 33554432 ||
+ type.indexType.flags & 33554432)) {
+ return getIndexedAccessType(getActualTypeVariable(type.objectType), getActualTypeVariable(type.indexType));
+ }
+ return type;
}
function getConditionalType(root, mapper) {
var checkType = instantiateType(root.checkType, mapper);
@@ -33584,61 +34030,30 @@
if (checkType === wildcardType || extendsType === wildcardType) {
return wildcardType;
}
- var trueType = instantiateType(root.trueType, mapper);
- var falseType = instantiateType(root.falseType, mapper);
- var instantiationId = "" + (root.isDistributive ? "d" : "") + getTypeId(checkType) + ">" + getTypeId(extendsType) + "?" + getTypeId(trueType) + ":" + getTypeId(falseType);
- var result = conditionalTypes.get(instantiationId);
- if (result) {
- return result;
- }
- var newResult = getConditionalTypeWorker(root, mapper, checkType, extendsType, trueType, falseType);
- conditionalTypes.set(instantiationId, newResult);
- return newResult;
- }
- function getConditionalTypeWorker(root, mapper, checkType, extendsType, trueType, falseType) {
- if (falseType.flags & 131072 && getActualTypeVariable(trueType) === getActualTypeVariable(checkType)) {
- if (checkType.flags & 1 || isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) {
- return trueType;
- }
- else if (isIntersectionEmpty(checkType, extendsType)) {
- return neverType;
- }
- }
- else if (trueType.flags & 131072 && getActualTypeVariable(falseType) === getActualTypeVariable(checkType)) {
- if (!(checkType.flags & 1) && isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) {
- return neverType;
- }
- else if (checkType.flags & 1 || isIntersectionEmpty(checkType, extendsType)) {
- return falseType;
- }
- }
var checkTypeInstantiable = maybeTypeOfKind(checkType, 63176704 | 131072);
var combinedMapper;
if (root.inferTypeParameters) {
var context = createInferenceContext(root.inferTypeParameters, undefined, 0);
if (!checkTypeInstantiable) {
- inferTypes(context.inferences, checkType, extendsType, 32 | 64);
+ inferTypes(context.inferences, checkType, extendsType, 64 | 128);
}
combinedMapper = combineTypeMappers(mapper, context.mapper);
}
var inferredExtendsType = combinedMapper ? instantiateType(root.extendsType, combinedMapper) : extendsType;
if (!checkTypeInstantiable && !maybeTypeOfKind(inferredExtendsType, 63176704 | 131072)) {
if (inferredExtendsType.flags & 3) {
- return trueType;
+ return instantiateType(root.trueType, combinedMapper || mapper);
}
if (checkType.flags & 1) {
- return getUnionType([instantiateType(root.trueType, combinedMapper || mapper), falseType]);
+ return getUnionType([instantiateType(root.trueType, combinedMapper || mapper), instantiateType(root.falseType, mapper)]);
}
if (!isTypeAssignableTo(getPermissiveInstantiation(checkType), getPermissiveInstantiation(inferredExtendsType))) {
- return falseType;
+ return instantiateType(root.falseType, mapper);
}
if (isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(inferredExtendsType))) {
return instantiateType(root.trueType, combinedMapper || mapper);
}
}
- return getDeferredConditionalType(root, mapper, combinedMapper, checkType, extendsType, trueType, falseType);
- }
- function getDeferredConditionalType(root, mapper, combinedMapper, checkType, extendsType, trueType, falseType) {
var erasedCheckType = getActualTypeVariable(checkType);
var result = createType(16777216);
result.root = root;
@@ -33646,14 +34061,18 @@
result.extendsType = extendsType;
result.mapper = mapper;
result.combinedMapper = combinedMapper;
- result.trueType = trueType;
- result.falseType = falseType;
result.aliasSymbol = root.aliasSymbol;
result.aliasTypeArguments = instantiateTypes(root.aliasTypeArguments, mapper);
return result;
}
+ function getTrueTypeFromConditionalType(type) {
+ return type.resolvedTrueType || (type.resolvedTrueType = instantiateType(type.root.trueType, type.mapper));
+ }
+ function getFalseTypeFromConditionalType(type) {
+ return type.resolvedFalseType || (type.resolvedFalseType = instantiateType(type.root.falseType, type.mapper));
+ }
function getInferredTrueTypeFromConditionalType(type) {
- return type.resolvedInferredTrueType || (type.resolvedInferredTrueType = instantiateType(type.root.trueType, type.combinedMapper || type.mapper));
+ return type.resolvedInferredTrueType || (type.resolvedInferredTrueType = type.combinedMapper ? instantiateType(type.root.trueType, type.combinedMapper) : getTrueTypeFromConditionalType(type));
}
function getInferTypeParameters(node) {
var result;
@@ -33666,20 +34085,6 @@
}
return result;
}
- function isPossiblyReferencedInConditionalType(tp, node) {
- if (isTypeParameterPossiblyReferenced(tp, node)) {
- return true;
- }
- while (node) {
- if (node.kind === 175) {
- if (isTypeParameterPossiblyReferenced(tp, node.extendsType)) {
- return true;
- }
- }
- node = node.parent;
- }
- return false;
- }
function getTypeFromConditionalTypeNode(node) {
var links = getNodeLinks(node);
if (!links.resolvedType) {
@@ -33687,7 +34092,7 @@
var aliasSymbol = getAliasSymbolForTypeNode(node);
var aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol);
var allOuterTypeParameters = getOuterTypeParameters(node, true);
- var outerTypeParameters = aliasTypeArguments ? allOuterTypeParameters : ts.filter(allOuterTypeParameters, function (tp) { return isPossiblyReferencedInConditionalType(tp, node); });
+ var outerTypeParameters = aliasTypeArguments ? allOuterTypeParameters : ts.filter(allOuterTypeParameters, function (tp) { return isTypeParameterPossiblyReferenced(tp, node); });
var root = {
node: node,
checkType: checkType,
@@ -33982,9 +34387,9 @@
function getThisType(node) {
var container = ts.getThisContainer(node, false);
var parent = container && container.parent;
- if (parent && (ts.isClassLike(parent) || parent.kind === 241)) {
+ if (parent && (ts.isClassLike(parent) || parent.kind === 242)) {
if (!ts.hasModifier(container, 32) &&
- (container.kind !== 157 || ts.isNodeDescendantOf(node, container.body))) {
+ (container.kind !== 158 || ts.isNodeDescendantOf(node, container.body))) {
return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType;
}
}
@@ -34000,87 +34405,87 @@
}
function getTypeFromTypeNode(node) {
switch (node.kind) {
- case 120:
- case 289:
+ case 121:
case 290:
+ case 291:
return anyType;
- case 143:
+ case 144:
return unknownType;
- case 138:
+ case 139:
return stringType;
- case 135:
+ case 136:
return numberType;
- case 146:
+ case 147:
return bigintType;
- case 123:
+ case 124:
return booleanType;
- case 139:
+ case 140:
return esSymbolType;
- case 106:
+ case 107:
return voidType;
- case 141:
+ case 142:
return undefinedType;
- case 96:
+ case 97:
return nullType;
- case 132:
+ case 133:
return neverType;
- case 136:
+ case 137:
return node.flags & 65536 ? anyType : nonPrimitiveType;
- case 178:
- case 100:
+ case 179:
+ case 101:
return getTypeFromThisTypeNode(node);
- case 182:
+ case 183:
return getTypeFromLiteralTypeNode(node);
- case 164:
+ case 165:
return getTypeFromTypeReference(node);
- case 163:
+ case 164:
return booleanType;
- case 211:
+ case 212:
return getTypeFromTypeReference(node);
- case 167:
+ case 168:
return getTypeFromTypeQueryNode(node);
- case 169:
- return getTypeFromArrayTypeNode(node);
case 170:
- return getTypeFromTupleTypeNode(node);
+ return getTypeFromArrayTypeNode(node);
case 171:
+ return getTypeFromTupleTypeNode(node);
+ case 172:
return getTypeFromOptionalTypeNode(node);
- case 173:
- return getTypeFromUnionTypeNode(node);
case 174:
+ return getTypeFromUnionTypeNode(node);
+ case 175:
return getTypeFromIntersectionTypeNode(node);
- case 291:
+ case 292:
return getTypeFromJSDocNullableTypeNode(node);
- case 293:
+ case 294:
return addOptionality(getTypeFromTypeNode(node.type));
- case 177:
- case 172:
- case 292:
- case 288:
+ case 178:
+ case 173:
+ case 293:
+ case 289:
return getTypeFromTypeNode(node.type);
- case 295:
+ case 296:
return getTypeFromJSDocVariadicType(node);
- case 165:
case 166:
- case 168:
- case 297:
- case 294:
+ case 167:
+ case 169:
case 298:
+ case 295:
+ case 299:
return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node);
- case 179:
- return getTypeFromTypeOperatorNode(node);
case 180:
- return getTypeFromIndexedAccessTypeNode(node);
+ return getTypeFromTypeOperatorNode(node);
case 181:
+ return getTypeFromIndexedAccessTypeNode(node);
+ case 182:
return getTypeFromMappedTypeNode(node);
- case 175:
- return getTypeFromConditionalTypeNode(node);
case 176:
+ return getTypeFromConditionalTypeNode(node);
+ case 177:
return getTypeFromInferTypeNode(node);
- case 183:
+ case 184:
return getTypeFromImportTypeNode(node);
- case 72:
- case 148:
+ case 73:
+ case 149:
var symbol = getSymbolAtLocation(node);
return symbol ? getDeclaredTypeOfSymbol(symbol) : errorType;
default:
@@ -34136,7 +34541,7 @@
return createTypeMapper(sources, undefined);
}
function createBackreferenceMapper(context, index) {
- return function (t) { return ts.findIndex(context.inferences, function (info) { return info.typeParameter === t; }) >= index ? emptyObjectType : t; };
+ return function (t) { return ts.findIndex(context.inferences, function (info) { return info.typeParameter === t; }) >= index ? unknownType : t; };
}
function combineTypeMappers(mapper1, mapper2) {
if (!mapper1)
@@ -34204,7 +34609,7 @@
symbol = links.target;
mapper = combineTypeMappers(links.mapper, mapper);
}
- var result = createSymbol(symbol.flags, symbol.escapedName, 1 | ts.getCheckFlags(symbol) & (8 | 2048 | 8192 | 16384));
+ var result = createSymbol(symbol.flags, symbol.escapedName, 1 | ts.getCheckFlags(symbol) & (8 | 4096 | 16384 | 32768));
result.declarations = symbol.declarations;
result.parent = symbol.parent;
result.target = symbol;
@@ -34263,25 +34668,28 @@
return type;
}
function maybeTypeParameterReference(node) {
- return !(node.kind === 148 ||
- node.parent.kind === 164 && node.parent.typeArguments && node === node.parent.typeName);
+ return !(node.kind === 149 ||
+ node.parent.kind === 165 && node.parent.typeArguments && node === node.parent.typeName);
}
function isTypeParameterPossiblyReferenced(tp, node) {
if (tp.symbol && tp.symbol.declarations && tp.symbol.declarations.length === 1) {
- var container_3 = tp.symbol.declarations[0].parent;
- if (ts.findAncestor(node, function (n) { return n.kind === 218 ? "quit" : n === container_3; })) {
- return !!ts.forEachChild(node, containsReference);
+ var container = tp.symbol.declarations[0].parent;
+ for (var n = node; n !== container; n = n.parent) {
+ if (!n || n.kind === 219 || n.kind === 176 && ts.forEachChild(n.extendsType, containsReference)) {
+ return true;
}
}
+ return !!ts.forEachChild(node, containsReference);
+ }
return true;
function containsReference(node) {
switch (node.kind) {
- case 178:
+ case 179:
return !!tp.isThisType;
- case 72:
+ case 73:
return !tp.isThisType && ts.isPartOfTypeNode(node) && maybeTypeParameterReference(node) &&
getTypeFromTypeNode(node) === tp;
- case 167:
+ case 168:
return true;
}
return !!ts.forEachChild(node, containsReference);
@@ -34406,7 +34814,7 @@
if (flags & 524288) {
var objectFlags = type.objectFlags;
if (objectFlags & 16) {
- return type.symbol && type.symbol.flags & (16 | 8192 | 32 | 2048 | 4096) && type.symbol.declarations ?
+ return couldContainTypeVariables(type) ?
getAnonymousTypeInstantiation(type, mapper) : type;
}
if (objectFlags & 32) {
@@ -34445,7 +34853,7 @@
}
else {
var sub = instantiateType(type.substitute, mapper);
- if (sub.flags & 3 || isTypeSubtypeOf(getRestrictiveInstantiation(maybeVariable), getRestrictiveInstantiation(sub))) {
+ if (sub.flags & 3 || isTypeAssignableTo(getRestrictiveInstantiation(maybeVariable), getRestrictiveInstantiation(sub))) {
return maybeVariable;
}
return sub;
@@ -34472,33 +34880,33 @@
return info && createIndexInfo(instantiateType(info.type, mapper), info.isReadonly, info.declaration);
}
function isContextSensitive(node) {
- ts.Debug.assert(node.kind !== 156 || ts.isObjectLiteralMethod(node));
+ ts.Debug.assert(node.kind !== 157 || ts.isObjectLiteralMethod(node));
switch (node.kind) {
- case 196:
case 197:
- case 156:
+ case 198:
+ case 157:
return isContextSensitiveFunctionLikeDeclaration(node);
- case 188:
+ case 189:
return ts.some(node.properties, isContextSensitive);
- case 187:
+ case 188:
return ts.some(node.elements, isContextSensitive);
- case 205:
+ case 206:
return isContextSensitive(node.whenTrue) ||
isContextSensitive(node.whenFalse);
- case 204:
+ case 205:
return node.operatorToken.kind === 55 &&
(isContextSensitive(node.left) || isContextSensitive(node.right));
- case 275:
+ case 276:
return isContextSensitive(node.initializer);
- case 195:
+ case 196:
return isContextSensitive(node.expression);
- case 268:
+ case 269:
return ts.some(node.properties, isContextSensitive) || ts.isJsxOpeningElement(node.parent) && ts.some(node.parent.parent.children, isContextSensitive);
- case 267: {
+ case 268: {
var initializer = node.initializer;
return !!initializer && isContextSensitive(initializer);
}
- case 270: {
+ case 271: {
var expression = node.expression;
return !!expression && isContextSensitive(expression);
}
@@ -34512,7 +34920,7 @@
if (ts.some(node.parameters, function (p) { return !ts.getEffectiveTypeAnnotationNode(p); })) {
return true;
}
- if (node.kind !== 197) {
+ if (node.kind !== 198) {
var parameter = ts.firstOrUndefined(node.parameters);
if (!(parameter && ts.parameterIsThisKeyword(parameter))) {
return true;
@@ -34521,7 +34929,7 @@
return hasContextSensitiveReturnExpression(node);
}
function hasContextSensitiveReturnExpression(node) {
- return !!node.body && node.body.kind !== 218 && isContextSensitive(node.body);
+ return !!node.body && node.body.kind !== 219 && isContextSensitive(node.body);
}
function isContextSensitiveFunctionOrObjectLiteralMethod(func) {
return (ts.isInJSFile(func) && ts.isFunctionDeclaration(func) || isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) &&
@@ -34565,7 +34973,7 @@
function isTypeDerivedFrom(source, target) {
return source.flags & 1048576 ? ts.every(source.types, function (t) { return isTypeDerivedFrom(t, target); }) :
target.flags & 1048576 ? ts.some(target.types, function (t) { return isTypeDerivedFrom(source, t); }) :
- source.flags & 58982400 ? isTypeDerivedFrom(getBaseConstraintOfType(source) || emptyObjectType, target) :
+ source.flags & 58982400 ? isTypeDerivedFrom(getBaseConstraintOfType(source) || unknownType, target) :
target === globalObjectType ? !!(source.flags & (524288 | 67108864)) :
target === globalFunctionType ? !!(source.flags & 524288) && isFunctionObjectType(source) :
hasBaseType(source, getTargetType(target));
@@ -34600,23 +35008,23 @@
return true;
}
switch (node.kind) {
- case 270:
- case 195:
+ case 271:
+ case 196:
return elaborateError(node.expression, source, target, relation, headMessage);
- case 204:
+ case 205:
switch (node.operatorToken.kind) {
- case 59:
+ case 60:
case 27:
return elaborateError(node.right, source, target, relation, headMessage);
}
break;
- case 188:
+ case 189:
return elaborateObjectLiteral(node, source, target, relation);
- case 187:
+ case 188:
return elaborateArrayLiteral(node, source, target, relation);
- case 268:
+ case 269:
return elaborateJsxComponents(node, source, target, relation);
- case 197:
+ case 198:
return elaborateArrowFunction(node, source, target, relation);
}
return false;
@@ -34677,11 +35085,11 @@
var reportedError = false;
for (var status = iterator.next(); !status.done; status = iterator.next()) {
var _a = status.value, prop = _a.errorNode, next = _a.innerExpression, nameType = _a.nameType, errorMessage = _a.errorMessage;
- var targetPropType = getIndexedAccessType(target, nameType, undefined, errorType);
- if (targetPropType === errorType || targetPropType.flags & 8388608)
+ var targetPropType = getIndexedAccessTypeOrUndefined(target, nameType);
+ if (!targetPropType || targetPropType.flags & 8388608)
continue;
- var sourcePropType = getIndexedAccessType(source, nameType, undefined, errorType);
- if (sourcePropType !== errorType && targetPropType !== errorType && !checkTypeRelatedTo(sourcePropType, targetPropType, relation, undefined)) {
+ var sourcePropType = getIndexedAccessTypeOrUndefined(source, nameType);
+ if (sourcePropType && !checkTypeRelatedTo(sourcePropType, targetPropType, relation, undefined)) {
var elaborated = next && elaborateError(next, sourcePropType, targetPropType, relation, undefined);
if (elaborated) {
reportedError = true;
@@ -34777,21 +35185,24 @@
}
function getElaborationElementForJsxChild(child, nameType, getInvalidTextDiagnostic) {
switch (child.kind) {
- case 270:
+ case 271:
return { errorNode: child, innerExpression: child.expression, nameType: nameType };
case 11:
if (child.containsOnlyTriviaWhiteSpaces) {
break;
}
return { errorNode: child, innerExpression: undefined, nameType: nameType, errorMessage: getInvalidTextDiagnostic() };
- case 260:
case 261:
- case 264:
+ case 262:
+ case 265:
return { errorNode: child, innerExpression: child, nameType: nameType };
default:
return ts.Debug.assertNever(child, "Found invalid jsx child");
}
}
+ function getSemanticJsxChildren(children) {
+ return ts.filter(children, function (i) { return !ts.isJsxText(i) || !i.containsOnlyTriviaWhiteSpaces; });
+ }
function elaborateJsxComponents(node, source, target, relation) {
var result = elaborateElementwise(generateJsxAttributes(node), source, target, relation);
var invalidTextDiagnostic;
@@ -34801,7 +35212,7 @@
var childrenPropName = childPropName === undefined ? "children" : ts.unescapeLeadingUnderscores(childPropName);
var childrenNameType = getLiteralType(childrenPropName);
var childrenTargetType = getIndexedAccessType(target, childrenNameType);
- var validChildren = ts.filter(containingElement.children, function (i) { return !ts.isJsxText(i) || !i.containsOnlyTriviaWhiteSpaces; });
+ var validChildren = getSemanticJsxChildren(containingElement.children);
if (!ts.length(validChildren)) {
return result;
}
@@ -34882,6 +35293,8 @@
});
}
function elaborateArrayLiteral(node, source, target, relation) {
+ if (target.flags & 131068)
+ return false;
if (isTupleLikeType(source)) {
return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation);
}
@@ -34911,11 +35324,11 @@
}
_b = prop.kind;
switch (_b) {
+ case 160: return [3, 2];
case 159: return [3, 2];
- case 158: return [3, 2];
- case 156: return [3, 2];
- case 276: return [3, 2];
- case 275: return [3, 4];
+ case 157: return [3, 2];
+ case 277: return [3, 2];
+ case 276: return [3, 4];
}
return [3, 6];
case 2: return [4, { errorNode: prop.name, innerExpression: undefined, nameType: type }];
@@ -34937,6 +35350,8 @@
});
}
function elaborateObjectLiteral(node, source, target, relation) {
+ if (target.flags & 131068)
+ return false;
return elaborateElementwise(generateObjectLiteralElements(node), source, target, relation);
}
function checkTypeComparableTo(source, target, errorNode, headMessage, containingMessageChain) {
@@ -34972,8 +35387,8 @@
return 0;
}
var kind = target.declaration ? target.declaration.kind : 0;
- var strictVariance = !callbackCheck && strictFunctionTypes && kind !== 156 &&
- kind !== 155 && kind !== 157;
+ var strictVariance = !callbackCheck && strictFunctionTypes && kind !== 157 &&
+ kind !== 156 && kind !== 158;
var result = -1;
var sourceThisType = getThisTypeOfSignature(source);
if (sourceThisType && sourceThisType !== voidType) {
@@ -35011,12 +35426,12 @@
result &= related;
}
if (!ignoreReturnTypes) {
- var targetReturnType = (target.declaration && isJSConstructor(target.declaration)) ?
+ var targetReturnType = isResolvingReturnTypeOfSignature(target) ? anyType : (target.declaration && isJSConstructor(target.declaration)) ?
getJSClassType(target.declaration.symbol) : getReturnTypeOfSignature(target);
if (targetReturnType === voidType) {
return result;
}
- var sourceReturnType = (source.declaration && isJSConstructor(source.declaration)) ?
+ var sourceReturnType = isResolvingReturnTypeOfSignature(source) ? anyType : (source.declaration && isJSConstructor(source.declaration)) ?
getJSClassType(source.declaration.symbol) : getReturnTypeOfSignature(source);
var targetTypePredicate = getTypePredicateOfSignature(target);
if (targetTypePredicate) {
@@ -35090,6 +35505,11 @@
function isEmptyAnonymousObjectType(type) {
return !!(ts.getObjectFlags(type) & 16) && isEmptyObjectType(type);
}
+ function isStringIndexSignatureOnlyType(type) {
+ return type.flags & 524288 && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfoOfType(type, 0) && !getIndexInfoOfType(type, 1) ||
+ type.flags & 3145728 && ts.every(type.types, isStringIndexSignatureOnlyType) ||
+ false;
+ }
function isEnumTypeRelatedTo(sourceSymbol, targetSymbol, errorReporter) {
if (sourceSymbol === targetSymbol) {
return true;
@@ -35195,8 +35615,8 @@
}
return false;
}
- function isIgnoredJsxProperty(source, sourceProp, targetMemberType) {
- return ts.getObjectFlags(source) & 4096 && !(isUnhyphenatedJsxName(sourceProp.escapedName) || targetMemberType);
+ function isIgnoredJsxProperty(source, sourceProp) {
+ return ts.getObjectFlags(source) & 4096 && !isUnhyphenatedJsxName(sourceProp.escapedName);
}
function checkTypeRelatedTo(source, target, relation, errorNode, headMessage, containingMessageChain, errorOutputContainer) {
var errorInfo;
@@ -35208,7 +35628,7 @@
var depth = 0;
var expandingFlags = 0;
var overflow = false;
- var suppressNextError = false;
+ var overrideNextErrorInfo;
ts.Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
var result = isRelatedTo(source, target, !!errorNode, headMessage);
if (overflow) {
@@ -35216,9 +35636,9 @@
}
else if (errorInfo) {
if (containingMessageChain) {
- var chain_1 = containingMessageChain();
- if (chain_1) {
- errorInfo = ts.concatenateDiagnosticMessageChains(chain_1, errorInfo);
+ var chain = containingMessageChain();
+ if (chain) {
+ errorInfo = ts.concatenateDiagnosticMessageChains(chain, errorInfo);
}
}
var relatedInformation = void 0;
@@ -35256,11 +35676,9 @@
}
}
function reportRelationError(message, source, target) {
- var sourceType = typeToString(source);
- var targetType = typeToString(target);
- if (sourceType === targetType) {
- sourceType = typeToString(source, undefined, 64);
- targetType = typeToString(target, undefined, 64);
+ var _a = getTypeNamesForErrorDisplay(source, target), sourceType = _a[0], targetType = _a[1];
+ if (target.flags & 262144 && target.immediateBaseConstraint !== undefined && isTypeAssignableTo(source, target.immediateBaseConstraint)) {
+ reportError(ts.Diagnostics._0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_constraint_2, sourceType, targetType, typeToString(target.immediateBaseConstraint));
}
if (!message) {
if (relation === comparableRelation) {
@@ -35285,23 +35703,29 @@
reportError(ts.Diagnostics._0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible, targetType, sourceType);
}
}
- function isUnionOrIntersectionTypeWithoutNullableConstituents(type) {
- if (!(type.flags & 3145728)) {
+ function tryElaborateArrayLikeErrors(source, target, reportErrors) {
+ if (isTupleLikeType(source)) {
+ var sourceTuple = source.target;
+ if (sourceTuple && sourceTuple.readonly && isArrayOrTupleLikeType(target) &&
+ (!isReadonlyArrayType(target) || isTupleType(target) && !target.target.readonly)) {
+ if (reportErrors) {
+ reportError(ts.Diagnostics.The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1, typeToString(source), typeToString(target));
+ }
return false;
}
- var seenNonNullable = false;
- for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
- var t = _a[_i];
- if (t.flags & 98304) {
- continue;
+ return isArrayLikeType(target);
}
- if (seenNonNullable) {
- return true;
+ if (isTupleLikeType(target)) {
+ return isArrayLikeType(source);
}
- seenNonNullable = true;
+ if (isReadonlyArrayType(source) && isArrayType(target) && !isReadonlyArrayType(target)) {
+ if (reportErrors) {
+ reportError(ts.Diagnostics.The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1, typeToString(source), typeToString(target));
}
return false;
}
+ return true;
+ }
function isRelatedTo(source, target, reportErrors, headMessage, isApparentIntersectionConstituent) {
if (reportErrors === void 0) { reportErrors = false; }
if (isFreshLiteralType(source)) {
@@ -35316,11 +35740,11 @@
if (target.flags & 33554432) {
target = target.typeVariable;
}
- if (source.flags & 8388608) {
- source = getSimplifiedType(source);
+ if (source.flags & 25165824) {
+ source = getSimplifiedType(source, false);
}
- if (target.flags & 8388608) {
- target = getSimplifiedType(target);
+ if (target.flags & 25165824) {
+ target = getSimplifiedType(target, true);
}
if (target.flags & 1048576 && source.flags & 524288 &&
target.types.length <= 3 && maybeTypeOfKind(target, 98304)) {
@@ -35338,7 +35762,8 @@
isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : undefined))
return -1;
var isComparingJsxAttributes = !!(ts.getObjectFlags(source) & 4096);
- if (isObjectLiteralType(source) && ts.getObjectFlags(source) & 32768) {
+ var isPerformingExcessPropertyChecks = (isObjectLiteralType(source) && ts.getObjectFlags(source) & 32768);
+ if (isPerformingExcessPropertyChecks) {
var discriminantType = target.flags & 1048576 ? findMatchingDiscriminantType(source, target) : undefined;
if (hasExcessProperties(source, target, discriminantType, reportErrors)) {
if (reportErrors) {
@@ -35346,9 +35771,6 @@
}
return 0;
}
- if (isUnionOrIntersectionTypeWithoutNullableConstituents(target) && !discriminantType) {
- source = getRegularTypeOfObjectLiteral(source);
- }
}
if (relation !== comparableRelation && !isApparentIntersectionConstituent &&
source.flags & (131068 | 524288 | 2097152) && source !== globalObjectType &&
@@ -35378,11 +35800,22 @@
}
else {
if (target.flags & 1048576) {
- result = typeRelatedToSomeType(source, target, reportErrors && !(source.flags & 131068) && !(target.flags & 131068));
+ result = typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source), target, reportErrors && !(source.flags & 131068) && !(target.flags & 131068));
+ if (result && isPerformingExcessPropertyChecks) {
+ var discriminantType = target.flags & 1048576 ? findMatchingDiscriminantType(source, target) : undefined;
+ if (!propertiesRelatedTo(source, discriminantType || target, reportErrors, undefined)) {
+ return 0;
+ }
+ }
}
else if (target.flags & 2097152) {
isIntersectionConstituent = true;
- result = typeRelatedToEachType(source, target, reportErrors);
+ result = typeRelatedToEachType(getRegularTypeOfObjectLiteral(source), target, reportErrors);
+ if (result && isPerformingExcessPropertyChecks) {
+ if (!propertiesRelatedTo(source, target, reportErrors, undefined)) {
+ return 0;
+ }
+ }
}
else if (source.flags & 2097152) {
result = someTypeRelatedToType(source, target, false);
@@ -35402,8 +35835,15 @@
}
}
if (!result && reportErrors) {
- var maybeSuppress = suppressNextError;
- suppressNextError = false;
+ var maybeSuppress = overrideNextErrorInfo;
+ overrideNextErrorInfo = undefined;
+ if (source.flags & 524288 && target.flags & 524288) {
+ var currentError = errorInfo;
+ tryElaborateArrayLikeErrors(source, target, reportErrors);
+ if (errorInfo !== currentError) {
+ maybeSuppress = errorInfo;
+ }
+ }
if (source.flags & 524288 && target.flags & 131068) {
tryElaborateErrorsForPrimitivesAndObjects(source, target);
}
@@ -35486,7 +35926,7 @@
return { value: true };
}
};
- for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) {
+ for (var _i = 0, _a = getPropertiesOfType(source); _i < _a.length; _i++) {
var prop = _a[_i];
var state_3 = _loop_7(prop);
if (typeof state_3 === "object")
@@ -35588,8 +36028,8 @@
return bestMatch;
}
function findMatchingDiscriminantType(source, target) {
- if (target.flags & 1048576) {
- var sourceProperties = getPropertiesOfObjectType(source);
+ if (target.flags & 1048576 && source.flags & (2097152 | 524288)) {
+ var sourceProperties = getPropertiesOfType(source);
if (sourceProperties) {
var sourcePropertiesFiltered = findDiscriminantProperties(sourceProperties, target);
if (sourcePropertiesFiltered) {
@@ -35649,12 +36089,16 @@
var length = sources.length <= targets.length ? sources.length : targets.length;
var result = -1;
for (var i = 0; i < length; i++) {
- var variance = i < variances.length ? variances[i] : 1;
+ var varianceFlags = i < variances.length ? variances[i] : 1;
+ var variance = varianceFlags & 7;
if (variance !== 4) {
var s = sources[i];
var t = targets[i];
var related = -1;
- if (variance === 1) {
+ if (varianceFlags & 8) {
+ related = relation === identityRelation ? isRelatedTo(s, t, false) : compareTypesIdentical(s, t);
+ }
+ else if (variance === 1) {
related = isRelatedTo(s, t, reportErrors);
}
else if (variance === 2) {
@@ -35755,8 +36199,8 @@
if (source.root.isDistributive === target.root.isDistributive) {
if (result_3 = isRelatedTo(source.checkType, target.checkType, false)) {
if (result_3 &= isRelatedTo(source.extendsType, target.extendsType, false)) {
- if (result_3 &= isRelatedTo(source.trueType, target.trueType, false)) {
- if (result_3 &= isRelatedTo(source.falseType, target.falseType, false)) {
+ if (result_3 &= isRelatedTo(getTrueTypeFromConditionalType(source), getTrueTypeFromConditionalType(target), false)) {
+ if (result_3 &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), false)) {
return result_3;
}
}
@@ -35799,8 +36243,7 @@
return result;
}
}
- var simplified = getSimplifiedType(target.type);
- var constraint = simplified !== target.type ? simplified : getConstraintOfType(target.type);
+ var constraint = getSimplifiedTypeOrConstraint(target.type);
if (constraint) {
if (isRelatedTo(source, getIndexType(constraint, target.stringsOnly), reportErrors) === -1) {
return -1;
@@ -35808,11 +36251,15 @@
}
}
else if (target.flags & 8388608) {
- if (relation !== identityRelation &&
- !(isGenericObjectType(target.objectType) && isGenericIndexType(target.indexType))) {
- var constraint = getBaseConstraintOfType(target);
- if (constraint && constraint !== target) {
- if (result = isRelatedTo(source, constraint, reportErrors)) {
+ if (relation !== identityRelation) {
+ var objectType = target.objectType;
+ var indexType = target.indexType;
+ var baseObjectType = getBaseConstraintOfType(objectType) || objectType;
+ var baseIndexType = getBaseConstraintOfType(indexType) || indexType;
+ if (!isGenericObjectType(baseObjectType) && !isGenericIndexType(baseIndexType)) {
+ var accessFlags = 2 | (baseObjectType !== objectType ? 1 : 0);
+ var constraint = getIndexedAccessTypeOrUndefined(baseObjectType, baseIndexType, undefined, accessFlags);
+ if (constraint && (result = isRelatedTo(source, constraint, reportErrors))) {
return result;
}
}
@@ -35828,7 +36275,7 @@
}
if (!isGenericMappedType(source)) {
var targetConstraint = getConstraintTypeFromMappedType(target);
- var sourceKeys_1 = getIndexType(source);
+ var sourceKeys_1 = getIndexType(source, undefined, true);
var hasOptionalUnionKeys = modifiers & 4 && targetConstraint.flags & 1048576;
var filteredByApplicability = hasOptionalUnionKeys ? filterType(targetConstraint, function (t) { return !!isRelatedTo(t, sourceKeys_1); }) : undefined;
if (hasOptionalUnionKeys
@@ -35856,6 +36303,7 @@
return result;
}
}
+ else {
var constraint = getConstraintOfType(source);
if (!constraint || (source.flags & 262144 && constraint.flags & 1)) {
if (result = isRelatedTo(emptyObjectType, extractTypesOfKind(target, ~67108864))) {
@@ -35872,6 +36320,7 @@
return result;
}
}
+ }
else if (source.flags & 4194304) {
if (result = isRelatedTo(keyofConstraintType, target, reportErrors)) {
errorInfo = saveErrorInfo;
@@ -35882,8 +36331,8 @@
if (target.flags & 16777216) {
if (isTypeIdenticalTo(source.extendsType, target.extendsType) &&
(isRelatedTo(source.checkType, target.checkType) || isRelatedTo(target.checkType, source.checkType))) {
- if (result = isRelatedTo(source.trueType, target.trueType, reportErrors)) {
- result &= isRelatedTo(source.falseType, target.falseType, reportErrors);
+ if (result = isRelatedTo(getTrueTypeFromConditionalType(source), getTrueTypeFromConditionalType(target), reportErrors)) {
+ result &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), reportErrors);
}
if (result) {
errorInfo = saveErrorInfo;
@@ -35941,7 +36390,7 @@
}
if (source.flags & (524288 | 2097152) && target.flags & 524288) {
var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !sourceIsPrimitive;
- result = propertiesRelatedTo(source, target, reportStructuralErrors);
+ result = propertiesRelatedTo(source, target, reportStructuralErrors, undefined);
if (result) {
result &= signaturesRelatedTo(source, target, 0, reportStructuralErrors);
if (result) {
@@ -35961,22 +36410,30 @@
return result;
}
}
+ if (source.flags & (524288 | 2097152) && target.flags & 1048576) {
+ var objectOnlyTarget = extractTypesOfKind(target, 524288);
+ if (objectOnlyTarget.flags & 1048576) {
+ var result_4 = typeRelatedToDiscriminatedType(source, objectOnlyTarget);
+ if (result_4) {
+ return result_4;
}
- return 0;
- function isNonGeneric(type) {
- if (relation === identityRelation) {
- return isRelatedTo(type, getPermissiveInstantiation(type)) === -1;
}
- return isTypeIdenticalTo(type, getPermissiveInstantiation(type));
}
+ }
+ return 0;
function relateVariances(sourceTypeArguments, targetTypeArguments, variances) {
if (result = typeArgumentsRelatedTo(sourceTypeArguments, targetTypeArguments, variances, reportErrors)) {
return result;
}
- var allowStructuralFallback = (targetTypeArguments && hasCovariantVoidArgument(targetTypeArguments, variances)) || isNonGeneric(source) || isNonGeneric(target);
+ if (ts.some(variances, function (v) { return !!(v & 24); })) {
+ originalErrorInfo = undefined;
+ errorInfo = saveErrorInfo;
+ return undefined;
+ }
+ var allowStructuralFallback = targetTypeArguments && hasCovariantVoidArgument(targetTypeArguments, variances);
varianceCheckFailed = !allowStructuralFallback;
if (variances !== ts.emptyArray && !allowStructuralFallback) {
- if (varianceCheckFailed && !(reportErrors && ts.some(variances, function (v) { return v === 0; }))) {
+ if (varianceCheckFailed && !(reportErrors && ts.some(variances, function (v) { return (v & 7) === 0; }))) {
return 0;
}
originalErrorInfo = errorInfo;
@@ -35984,49 +36441,259 @@
}
}
}
+ function reportUnmeasurableMarkers(p) {
+ if (outofbandVarianceMarkerHandler && (p === markerSuperType || p === markerSubType || p === markerOtherType)) {
+ outofbandVarianceMarkerHandler(false);
+ }
+ return p;
+ }
+ function reportUnreliableMarkers(p) {
+ if (outofbandVarianceMarkerHandler && (p === markerSuperType || p === markerSubType || p === markerOtherType)) {
+ outofbandVarianceMarkerHandler(true);
+ }
+ return p;
+ }
function mappedTypeRelatedTo(source, target, reportErrors) {
var modifiersRelated = relation === comparableRelation || (relation === identityRelation ? getMappedTypeModifiers(source) === getMappedTypeModifiers(target) :
getCombinedMappedTypeOptionality(source) <= getCombinedMappedTypeOptionality(target));
if (modifiersRelated) {
- var result_4;
- if (result_4 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) {
+ var result_5;
+ var targetConstraint = getConstraintTypeFromMappedType(target);
+ var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source), getCombinedMappedTypeOptionality(source) < 0 ? reportUnmeasurableMarkers : reportUnreliableMarkers);
+ if (result_5 = isRelatedTo(targetConstraint, sourceConstraint, reportErrors)) {
var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]);
- return result_4 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), reportErrors);
+ return result_5 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), reportErrors);
+ }
}
+ return 0;
}
+ function typeRelatedToDiscriminatedType(source, target) {
+ var sourceProperties = getPropertiesOfObjectType(source);
+ var sourcePropertiesFiltered = findDiscriminantProperties(sourceProperties, target);
+ if (!sourcePropertiesFiltered)
+ return 0;
+ var numCombinations = 1;
+ for (var _i = 0, sourcePropertiesFiltered_1 = sourcePropertiesFiltered; _i < sourcePropertiesFiltered_1.length; _i++) {
+ var sourceProperty = sourcePropertiesFiltered_1[_i];
+ numCombinations *= countTypes(getTypeOfSymbol(sourceProperty));
+ if (numCombinations > 25) {
return 0;
}
- function propertiesRelatedTo(source, target, reportErrors) {
+ }
+ var sourceDiscriminantTypes = new Array(sourcePropertiesFiltered.length);
+ var excludedProperties = ts.createUnderscoreEscapedMap();
+ for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
+ var sourceProperty = sourcePropertiesFiltered[i];
+ var sourcePropertyType = getTypeOfSymbol(sourceProperty);
+ sourceDiscriminantTypes[i] = sourcePropertyType.flags & 1048576
+ ? sourcePropertyType.types
+ : [sourcePropertyType];
+ excludedProperties.set(sourceProperty.escapedName, true);
+ }
+ var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
+ var matchingTypes = [];
+ var _loop_8 = function (combination) {
+ var hasMatch = false;
+ outer: for (var _i = 0, _a = target.types; _i < _a.length; _i++) {
+ var type = _a[_i];
+ var _loop_9 = function (i) {
+ var sourceProperty = sourcePropertiesFiltered[i];
+ var targetProperty = getPropertyOfObjectType(type, sourceProperty.escapedName);
+ if (!targetProperty)
+ return "continue-outer";
+ if (sourceProperty === targetProperty)
+ return "continue";
+ var related = propertyRelatedTo(source, target, sourceProperty, targetProperty, function (_) { return combination[i]; }, false);
+ if (!related) {
+ return "continue-outer";
+ }
+ };
+ for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
+ var state_5 = _loop_9(i);
+ switch (state_5) {
+ case "continue-outer": continue outer;
+ }
+ }
+ ts.pushIfUnique(matchingTypes, type, ts.equateValues);
+ hasMatch = true;
+ }
+ if (!hasMatch) {
+ return { value: 0 };
+ }
+ };
+ for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
+ var combination = discriminantCombinations_1[_a];
+ var state_4 = _loop_8(combination);
+ if (typeof state_4 === "object")
+ return state_4.value;
+ }
+ var result = -1;
+ for (var _b = 0, matchingTypes_1 = matchingTypes; _b < matchingTypes_1.length; _b++) {
+ var type = matchingTypes_1[_b];
+ result &= propertiesRelatedTo(source, type, false, excludedProperties);
+ if (result) {
+ result &= signaturesRelatedTo(source, type, 0, false);
+ if (result) {
+ result &= signaturesRelatedTo(source, type, 1, false);
+ if (result) {
+ result &= indexTypesRelatedTo(source, type, 0, false, false);
+ if (result) {
+ result &= indexTypesRelatedTo(source, type, 1, false, false);
+ }
+ }
+ }
+ }
+ if (!result) {
+ return result;
+ }
+ }
+ return result;
+ }
+ function excludeProperties(properties, excludedProperties) {
+ if (!excludedProperties || properties.length === 0)
+ return properties;
+ var result;
+ for (var i = 0; i < properties.length; i++) {
+ if (!excludedProperties.has(properties[i].escapedName)) {
+ if (result) {
+ result.push(properties[i]);
+ }
+ }
+ else if (!result) {
+ result = properties.slice(0, i);
+ }
+ }
+ return result || properties;
+ }
+ function isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors) {
+ var targetIsOptional = strictNullChecks && !!(ts.getCheckFlags(targetProp) & 48);
+ var source = getTypeOfSourceProperty(sourceProp);
+ if (ts.getCheckFlags(targetProp) & 65536 && !getSymbolLinks(targetProp).type) {
+ var links = getSymbolLinks(targetProp);
+ ts.Debug.assertDefined(links.deferralParent);
+ ts.Debug.assertDefined(links.deferralConstituents);
+ var unionParent = !!(links.deferralParent.flags & 1048576);
+ var result_6 = unionParent ? 0 : -1;
+ var targetTypes = links.deferralConstituents;
+ for (var _i = 0, targetTypes_3 = targetTypes; _i < targetTypes_3.length; _i++) {
+ var targetType = targetTypes_3[_i];
+ var related = isRelatedTo(source, targetType, false, undefined, !unionParent);
+ if (!unionParent) {
+ if (!related) {
+ return isRelatedTo(source, addOptionality(getTypeOfSymbol(targetProp), targetIsOptional), reportErrors);
+ }
+ result_6 &= related;
+ }
+ else {
+ if (related) {
+ return related;
+ }
+ }
+ }
+ if (unionParent && !result_6 && targetIsOptional) {
+ result_6 = isRelatedTo(source, undefinedType);
+ }
+ if (unionParent && !result_6 && reportErrors) {
+ return isRelatedTo(source, addOptionality(getTypeOfSymbol(targetProp), targetIsOptional), reportErrors);
+ }
+ return result_6;
+ }
+ else {
+ return isRelatedTo(source, addOptionality(getTypeOfSymbol(targetProp), targetIsOptional), reportErrors);
+ }
+ }
+ function propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSourceProperty, reportErrors) {
+ var sourcePropFlags = ts.getDeclarationModifierFlagsFromSymbol(sourceProp);
+ var targetPropFlags = ts.getDeclarationModifierFlagsFromSymbol(targetProp);
+ if (sourcePropFlags & 8 || targetPropFlags & 8) {
+ var hasDifferingDeclarations = sourceProp.valueDeclaration !== targetProp.valueDeclaration;
+ if (ts.getCheckFlags(sourceProp) & 1024 && hasDifferingDeclarations) {
+ if (reportErrors) {
+ reportError(ts.Diagnostics.Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1, symbolToString(sourceProp), typeToString(source));
+ }
+ return 0;
+ }
+ if (hasDifferingDeclarations) {
+ if (reportErrors) {
+ if (sourcePropFlags & 8 && targetPropFlags & 8) {
+ reportError(ts.Diagnostics.Types_have_separate_declarations_of_a_private_property_0, symbolToString(targetProp));
+ }
+ else {
+ reportError(ts.Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), typeToString(sourcePropFlags & 8 ? source : target), typeToString(sourcePropFlags & 8 ? target : source));
+ }
+ }
+ return 0;
+ }
+ }
+ else if (targetPropFlags & 16) {
+ if (!isValidOverrideOf(sourceProp, targetProp)) {
+ if (reportErrors) {
+ reportError(ts.Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, symbolToString(targetProp), typeToString(getDeclaringClass(sourceProp) || source), typeToString(getDeclaringClass(targetProp) || target));
+ }
+ return 0;
+ }
+ }
+ else if (sourcePropFlags & 16) {
+ if (reportErrors) {
+ reportError(ts.Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target));
+ }
+ return 0;
+ }
+ var related = isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors);
+ if (!related) {
+ if (reportErrors) {
+ reportError(ts.Diagnostics.Types_of_property_0_are_incompatible, symbolToString(targetProp));
+ }
+ return 0;
+ }
+ if (relation !== comparableRelation && sourceProp.flags & 16777216 && !(targetProp.flags & 16777216)) {
+ if (reportErrors) {
+ reportError(ts.Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target));
+ }
+ return 0;
+ }
+ return related;
+ }
+ function propertiesRelatedTo(source, target, reportErrors, excludedProperties) {
if (relation === identityRelation) {
- return propertiesIdenticalTo(source, target);
+ return propertiesIdenticalTo(source, target, excludedProperties);
}
var requireOptionalProperties = relation === subtypeRelation && !isObjectLiteralType(source) && !isEmptyArrayLiteralType(source) && !isTupleType(source);
var unmatchedProperty = getUnmatchedProperty(source, target, requireOptionalProperties, false);
if (unmatchedProperty) {
if (reportErrors) {
var props = ts.arrayFrom(getUnmatchedProperties(source, target, requireOptionalProperties, false));
+ var shouldSkipElaboration = false;
if (!headMessage || (headMessage.code !== ts.Diagnostics.Class_0_incorrectly_implements_interface_1.code &&
headMessage.code !== ts.Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass.code)) {
- suppressNextError = true;
+ shouldSkipElaboration = true;
}
if (props.length === 1) {
var propName = symbolToString(unmatchedProperty);
- reportError(ts.Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2, propName, typeToString(source), typeToString(target));
+ reportError.apply(void 0, [ts.Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2, propName].concat(getTypeNamesForErrorDisplay(source, target)));
if (ts.length(unmatchedProperty.declarations)) {
associateRelatedInfo(ts.createDiagnosticForNode(unmatchedProperty.declarations[0], ts.Diagnostics._0_is_declared_here, propName));
}
+ if (shouldSkipElaboration) {
+ overrideNextErrorInfo = errorInfo;
+ }
}
- else if (props.length > 5) {
+ else if (tryElaborateArrayLikeErrors(source, target, false)) {
+ if (props.length > 5) {
reportError(ts.Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2_and_3_more, typeToString(source), typeToString(target), ts.map(props.slice(0, 4), function (p) { return symbolToString(p); }).join(", "), props.length - 4);
}
else {
reportError(ts.Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2, typeToString(source), typeToString(target), ts.map(props, function (p) { return symbolToString(p); }).join(", "));
}
+ if (shouldSkipElaboration) {
+ overrideNextErrorInfo = errorInfo;
+ }
+ }
}
return 0;
}
if (isObjectLiteralType(target)) {
- for (var _i = 0, _a = getPropertiesOfType(source); _i < _a.length; _i++) {
+ for (var _i = 0, _a = excludeProperties(getPropertiesOfType(source), excludedProperties); _i < _a.length; _i++) {
var sourceProp = _a[_i];
if (!getPropertyOfObjectType(target, sourceProp.escapedName)) {
var sourceType = getTypeOfSymbol(sourceProp);
@@ -36067,76 +36734,28 @@
}
}
}
- var properties = getPropertiesOfObjectType(target);
- for (var _b = 0, properties_2 = properties; _b < properties_2.length; _b++) {
- var targetProp = properties_2[_b];
+ var properties = target.flags & 1048576 ? getPossiblePropertiesOfUnionType(target) : getPropertiesOfType(target);
+ for (var _b = 0, _c = excludeProperties(properties, excludedProperties); _b < _c.length; _b++) {
+ var targetProp = _c[_b];
if (!(targetProp.flags & 4194304)) {
var sourceProp = getPropertyOfType(source, targetProp.escapedName);
if (sourceProp && sourceProp !== targetProp) {
- if (isIgnoredJsxProperty(source, sourceProp, getTypeOfSymbol(targetProp))) {
- continue;
- }
- var sourcePropFlags = ts.getDeclarationModifierFlagsFromSymbol(sourceProp);
- var targetPropFlags = ts.getDeclarationModifierFlagsFromSymbol(targetProp);
- if (sourcePropFlags & 8 || targetPropFlags & 8) {
- var hasDifferingDeclarations = sourceProp.valueDeclaration !== targetProp.valueDeclaration;
- if (ts.getCheckFlags(sourceProp) & 512 && hasDifferingDeclarations) {
- if (reportErrors) {
- reportError(ts.Diagnostics.Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1, symbolToString(sourceProp), typeToString(source));
- }
- return 0;
- }
- if (hasDifferingDeclarations) {
- if (reportErrors) {
- if (sourcePropFlags & 8 && targetPropFlags & 8) {
- reportError(ts.Diagnostics.Types_have_separate_declarations_of_a_private_property_0, symbolToString(targetProp));
- }
- else {
- reportError(ts.Diagnostics.Property_0_is_private_in_type_1_but_not_in_type_2, symbolToString(targetProp), typeToString(sourcePropFlags & 8 ? source : target), typeToString(sourcePropFlags & 8 ? target : source));
- }
- }
- return 0;
- }
- }
- else if (targetPropFlags & 16) {
- if (!isValidOverrideOf(sourceProp, targetProp)) {
- if (reportErrors) {
- reportError(ts.Diagnostics.Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2, symbolToString(targetProp), typeToString(getDeclaringClass(sourceProp) || source), typeToString(getDeclaringClass(targetProp) || target));
- }
- return 0;
- }
- }
- else if (sourcePropFlags & 16) {
- if (reportErrors) {
- reportError(ts.Diagnostics.Property_0_is_protected_in_type_1_but_public_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target));
- }
- return 0;
- }
- var related = isRelatedTo(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors);
+ var related = propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSymbol, reportErrors);
if (!related) {
- if (reportErrors) {
- reportError(ts.Diagnostics.Types_of_property_0_are_incompatible, symbolToString(targetProp));
- }
return 0;
}
result &= related;
- if (relation !== comparableRelation && sourceProp.flags & 16777216 && !(targetProp.flags & 16777216)) {
- if (reportErrors) {
- reportError(ts.Diagnostics.Property_0_is_optional_in_type_1_but_required_in_type_2, symbolToString(targetProp), typeToString(source), typeToString(target));
- }
- return 0;
- }
}
}
}
return result;
}
- function propertiesIdenticalTo(source, target) {
+ function propertiesIdenticalTo(source, target, excludedProperties) {
if (!(source.flags & 524288 && target.flags & 524288)) {
return 0;
}
- var sourceProperties = getPropertiesOfObjectType(source);
- var targetProperties = getPropertiesOfObjectType(target);
+ var sourceProperties = excludeProperties(getPropertiesOfObjectType(source), excludedProperties);
+ var targetProperties = excludeProperties(getPropertiesOfObjectType(target), excludedProperties);
if (sourceProperties.length !== targetProperties.length) {
return 0;
}
@@ -36239,7 +36858,7 @@
var result = -1;
for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) {
var prop = _a[_i];
- if (isIgnoredJsxProperty(source, prop, undefined)) {
+ if (isIgnoredJsxProperty(source, prop)) {
continue;
}
if (prop.nameType && prop.nameType.flags & 8192) {
@@ -36270,7 +36889,7 @@
return indexTypesIdenticalTo(source, target, kind);
}
var targetInfo = getIndexInfoOfType(target, kind);
- if (!targetInfo || targetInfo.type.flags & 3 && !sourceIsPrimitive) {
+ if (!targetInfo || targetInfo.type.flags & 1 && !sourceIsPrimitive) {
return -1;
}
var sourceInfo = getIndexInfoOfType(source, kind) ||
@@ -36391,8 +37010,11 @@
if (!variances) {
cache.variances = ts.emptyArray;
variances = [];
- for (var _i = 0, typeParameters_1 = typeParameters; _i < typeParameters_1.length; _i++) {
- var tp = typeParameters_1[_i];
+ var _loop_10 = function (tp) {
+ var unmeasurable = false;
+ var unreliable = false;
+ var oldHandler = outofbandVarianceMarkerHandler;
+ outofbandVarianceMarkerHandler = function (onlyUnreliable) { return onlyUnreliable ? unreliable = true : unmeasurable = true; };
var typeWithSuper = createMarkerType(cache, tp, markerSuperType);
var typeWithSub = createMarkerType(cache, tp, markerSubType);
var variance = (isTypeAssignableTo(typeWithSub, typeWithSuper) ? 1 : 0) |
@@ -36400,7 +37022,24 @@
if (variance === 3 && isTypeAssignableTo(createMarkerType(cache, tp, markerOtherType), typeWithSuper)) {
variance = 4;
}
+ outofbandVarianceMarkerHandler = oldHandler;
+ if (unmeasurable || unreliable) {
+ if (unmeasurable) {
+ variance |= 8;
+ }
+ if (unreliable) {
+ variance |= 16;
+ }
+ var covariantID = getRelationKey(typeWithSub, typeWithSuper, assignableRelation);
+ var contravariantID = getRelationKey(typeWithSuper, typeWithSub, assignableRelation);
+ assignableRelation.delete(covariantID);
+ assignableRelation.delete(contravariantID);
+ }
variances.push(variance);
+ };
+ for (var _i = 0, typeParameters_1 = typeParameters; _i < typeParameters_1.length; _i++) {
+ var tp = typeParameters_1[_i];
+ _loop_10(tp);
}
cache.variances = variances;
}
@@ -36414,7 +37053,7 @@
}
function hasCovariantVoidArgument(typeArguments, variances) {
for (var i = 0; i < variances.length; i++) {
- if (variances[i] === 1 && typeArguments[i].flags & 16384) {
+ if ((variances[i] & 7) === 1 && typeArguments[i].flags & 16384) {
return true;
}
}
@@ -36779,6 +37418,10 @@
function getNonNullableType(type) {
return strictNullChecks ? getGlobalNonNullableTypeInstantiation(type) : type;
}
+ function isCoercibleUnderDoubleEquals(source, target) {
+ return ((source.flags & (8 | 4 | 512)) !== 0)
+ && ((target.flags & (8 | 4 | 16)) !== 0);
+ }
function isObjectTypeWithInferableIndex(type) {
return type.symbol && (type.symbol.flags & (4096 | 2048 | 512)) !== 0 &&
!typeHasCallOrConstructSignatures(type);
@@ -36904,23 +37547,31 @@
}
function getWidenedTypeWithContext(type, context) {
if (ts.getObjectFlags(type) & 393216) {
+ if (context === undefined && type.widened) {
+ return type.widened;
+ }
+ var result = void 0;
if (type.flags & 98304) {
- return anyType;
+ result = anyType;
}
- if (isObjectLiteralType(type)) {
- return getWidenedTypeOfObjectLiteral(type, context);
+ else if (isObjectLiteralType(type)) {
+ result = getWidenedTypeOfObjectLiteral(type, context);
}
- if (type.flags & 1048576) {
+ else if (type.flags & 1048576) {
var unionContext_1 = context || createWideningContext(undefined, undefined, type.types);
var widenedTypes = ts.sameMap(type.types, function (t) { return t.flags & 98304 ? t : getWidenedTypeWithContext(t, unionContext_1); });
- return getUnionType(widenedTypes, ts.some(widenedTypes, isEmptyObjectType) ? 2 : 1);
+ result = getUnionType(widenedTypes, ts.some(widenedTypes, isEmptyObjectType) ? 2 : 1);
}
- if (type.flags & 2097152) {
- return getIntersectionType(ts.sameMap(type.types, getWidenedType));
+ else if (type.flags & 2097152) {
+ result = getIntersectionType(ts.sameMap(type.types, getWidenedType));
}
- if (isArrayType(type) || isTupleType(type)) {
- return createTypeReference(type.target, ts.sameMap(type.typeArguments, getWidenedType));
+ else if (isArrayType(type) || isTupleType(type)) {
+ result = createTypeReference(type.target, ts.sameMap(type.typeArguments, getWidenedType));
+ }
+ if (result && context === undefined) {
+ type.widened = result;
}
+ return result || type;
}
return type;
}
@@ -36970,12 +37621,12 @@
}
var diagnostic;
switch (declaration.kind) {
- case 204:
+ case 205:
+ case 155:
case 154:
- case 153:
diagnostic = noImplicitAny ? ts.Diagnostics.Member_0_implicitly_has_an_1_type : ts.Diagnostics.Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage;
break;
- case 151:
+ case 152:
var param = declaration;
if (ts.isIdentifier(param.name) &&
(ts.isCallSignatureDeclaration(param.parent) || ts.isMethodSignature(param.parent) || ts.isFunctionTypeNode(param.parent)) &&
@@ -36990,29 +37641,29 @@
noImplicitAny ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage :
noImplicitAny ? ts.Diagnostics.Parameter_0_implicitly_has_an_1_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage;
break;
- case 186:
+ case 187:
diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type;
if (!noImplicitAny) {
return;
}
break;
- case 294:
+ case 295:
error(declaration, ts.Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);
return;
- case 239:
+ case 240:
+ case 157:
case 156:
- case 155:
- case 158:
case 159:
- case 196:
+ case 160:
case 197:
+ case 198:
if (noImplicitAny && !declaration.name) {
error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);
return;
}
diagnostic = noImplicitAny ? ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type : ts.Diagnostics._0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage;
break;
- case 181:
+ case 182:
if (noImplicitAny) {
error(declaration, ts.Diagnostics.Mapped_object_type_implicitly_has_an_any_template_type);
}
@@ -37128,7 +37779,7 @@
var objectFlags = ts.getObjectFlags(type);
return !!(type.flags & 63176704 ||
objectFlags & 4 && ts.forEach(type.typeArguments, couldContainTypeVariables) ||
- objectFlags & 16 && type.symbol && type.symbol.flags & (16 | 8192 | 2048 | 32) ||
+ objectFlags & 16 && type.symbol && type.symbol.flags & (16 | 8192 | 32 | 2048 | 4096) && type.symbol.declarations ||
objectFlags & 32 ||
type.flags & 3145728 && couldUnionOrIntersectionContainTypeVariables(type));
}
@@ -37169,8 +37820,12 @@
reverseMappedCache.set(key, type);
return type;
}
+ function isPartiallyInferableType(type) {
+ return !(ts.getObjectFlags(type) & 524288) ||
+ isObjectLiteralType(type) && ts.some(getPropertiesOfType(type), function (prop) { return isPartiallyInferableType(getTypeOfSymbol(prop)); });
+ }
function createReverseMappedType(source, target, constraint) {
- if (ts.getObjectFlags(source) & 524288 || getPropertiesOfType(source).length === 0 && !getIndexInfoOfType(source, 0)) {
+ if (!(getIndexInfoOfType(source, 0) || getPropertiesOfType(source).length !== 0 && isPartiallyInferableType(source))) {
return undefined;
}
if (isArrayType(source)) {
@@ -37196,20 +37851,20 @@
var templateType = getTemplateTypeFromMappedType(target);
var inference = createInferenceInfo(typeParameter);
inferTypes([inference], sourceType, templateType);
- return getTypeFromInference(inference);
+ return getTypeFromInference(inference) || unknownType;
}
function getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties) {
- var properties, _i, properties_3, targetProp, sourceProp, targetType, sourceType;
+ var properties, _i, properties_2, targetProp, sourceProp, targetType, sourceType;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
- properties = target.flags & 2097152 ? getPropertiesOfUnionOrIntersectionType(target) : getPropertiesOfObjectType(target);
- _i = 0, properties_3 = properties;
+ properties = target.flags & 1048576 ? getPossiblePropertiesOfUnionType(target) : getPropertiesOfType(target);
+ _i = 0, properties_2 = properties;
_a.label = 1;
case 1:
- if (!(_i < properties_3.length)) return [3, 6];
- targetProp = properties_3[_i];
- if (!(requireOptionalProperties || !(targetProp.flags & 16777216))) return [3, 5];
+ if (!(_i < properties_2.length)) return [3, 6];
+ targetProp = properties_2[_i];
+ if (!(requireOptionalProperties || !(targetProp.flags & 16777216 || ts.getCheckFlags(targetProp) & 48))) return [3, 5];
sourceProp = getPropertyOfType(source, targetProp.escapedName);
if (!!sourceProp) return [3, 3];
return [4, targetProp];
@@ -37248,7 +37903,7 @@
function getTypeFromInference(inference) {
return inference.candidates ? getUnionType(inference.candidates, 2) :
inference.contraCandidates ? getIntersectionType(inference.contraCandidates) :
- emptyObjectType;
+ undefined;
}
function inferTypes(inferences, originalSource, originalTarget, priority, contravariant) {
if (priority === void 0) { priority = 0; }
@@ -37306,8 +37961,11 @@
target = removeTypesFromUnionOrIntersection(target, matchingTypes);
}
}
+ else if (target.flags & (8388608 | 33554432)) {
+ target = getActualTypeVariable(target);
+ }
if (target.flags & 8650752) {
- if (ts.getObjectFlags(source) & 524288 || source === silentNeverType || (priority & 8 && (source === autoType || source === autoArrayType))) {
+ if (ts.getObjectFlags(source) & 524288 || source === silentNeverType || (priority & 16 && (source === autoType || source === autoArrayType))) {
return;
}
var inference = getInferenceInfoForType(target);
@@ -37332,7 +37990,7 @@
inference.inferredType = undefined;
}
}
- if (!(priority & 8) && target.flags & 262144 && inference.topLevel && !isTypeParameterAtTopLevel(originalTarget, target)) {
+ if (!(priority & 16) && target.flags & 262144 && inference.topLevel && !isTypeParameterAtTopLevel(originalTarget, target)) {
inference.topLevel = false;
inference.inferredType = undefined;
}
@@ -37340,14 +37998,14 @@
return;
}
else {
- var simplified = getSimplifiedType(target);
+ var simplified = getSimplifiedType(target, false);
if (simplified !== target) {
inferFromTypesOnce(source, simplified);
}
else if (target.flags & 8388608) {
- var indexType = getSimplifiedType(target.indexType);
+ var indexType = getSimplifiedType(target.indexType, false);
if (indexType.flags & 63176704) {
- var simplified_1 = distributeIndexOverObjectType(getSimplifiedType(target.objectType), indexType);
+ var simplified_1 = distributeIndexOverObjectType(getSimplifiedType(target.objectType, false), indexType, false);
if (simplified_1 && simplified_1 !== target) {
inferFromTypesOnce(source, simplified_1);
}
@@ -37355,16 +38013,13 @@
}
}
}
- else if (target.flags & 33554432) {
- inferFromTypes(source, target.typeVariable);
- }
if (ts.getObjectFlags(source) & 4 && ts.getObjectFlags(target) & 4 && source.target === target.target) {
var sourceTypes = source.typeArguments || ts.emptyArray;
var targetTypes = target.typeArguments || ts.emptyArray;
var count = sourceTypes.length < targetTypes.length ? sourceTypes.length : targetTypes.length;
var variances = getVariances(source.target);
for (var i = 0; i < count; i++) {
- if (i < variances.length && variances[i] === 2) {
+ if (i < variances.length && (variances[i] & 7) === 2) {
inferFromContravariantTypes(sourceTypes[i], targetTypes[i]);
}
else {
@@ -37381,7 +38036,7 @@
var empty = createEmptyObjectTypeFromStringLiteral(source);
contravariant = !contravariant;
var savePriority = priority;
- priority |= 16;
+ priority |= 32;
inferFromTypes(empty, target.type);
priority = savePriority;
contravariant = !contravariant;
@@ -37393,12 +38048,12 @@
else if (source.flags & 16777216 && target.flags & 16777216) {
inferFromTypes(source.checkType, target.checkType);
inferFromTypes(source.extendsType, target.extendsType);
- inferFromTypes(source.trueType, target.trueType);
- inferFromTypes(source.falseType, target.falseType);
+ inferFromTypes(getTrueTypeFromConditionalType(source), getTrueTypeFromConditionalType(target));
+ inferFromTypes(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target));
}
else if (target.flags & 16777216 && !contravariant) {
- inferFromTypes(source, target.trueType);
- inferFromTypes(source, target.falseType);
+ inferFromTypes(source, getTrueTypeFromConditionalType(target));
+ inferFromTypes(source, getFalseTypeFromConditionalType(target));
}
else if (target.flags & 3145728) {
var typeVariableCount = 0;
@@ -37431,7 +38086,7 @@
}
}
else {
- if (!(priority & 32 && source.flags & (2097152 | 63176704))) {
+ if (!(priority & 64 && source.flags & (2097152 | 63176704))) {
var apparentSource = getApparentType(source);
if (apparentSource !== source && allowComplexConstraintInference && !(apparentSource.flags & (524288 | 2097152))) {
allowComplexConstraintInference = false;
@@ -37470,7 +38125,7 @@
}
}
function inferFromContravariantTypes(source, target) {
- if (strictFunctionTypes || priority & 64) {
+ if (strictFunctionTypes || priority & 128) {
contravariant = !contravariant;
inferFromTypes(source, target);
contravariant = !contravariant;
@@ -37505,7 +38160,8 @@
var inferredType = inferTypeForHomomorphicMappedType(source, target, constraintType);
if (inferredType) {
var savePriority = priority;
- priority |= 2;
+ priority |= ts.getObjectFlags(source) & 524288 ?
+ 4 : 2;
inferFromTypes(inferredType, inference.typeParameter);
priority = savePriority;
}
@@ -37514,18 +38170,18 @@
}
if (constraintType.flags & 262144) {
var savePriority = priority;
- priority |= 4;
+ priority |= 8;
inferFromTypes(getIndexType(source), constraintType);
priority = savePriority;
var extendedConstraint = getConstraintOfType(constraintType);
if (extendedConstraint && inferToMappedType(source, target, extendedConstraint)) {
return true;
}
- var valueTypes = ts.compact([
- getIndexTypeOfType(source, 0),
- getIndexTypeOfType(source, 1)
- ].concat(ts.map(getPropertiesOfType(source), getTypeOfSymbol)));
- inferFromTypes(getUnionType(valueTypes), getTemplateTypeFromMappedType(target));
+ var propTypes = ts.map(getPropertiesOfType(source), getTypeOfSymbol);
+ var stringIndexType = getIndexTypeOfType(source, 0);
+ var numberIndexInfo = getNonEnumNumberIndexInfo(source);
+ var numberIndexType = numberIndexInfo && numberIndexInfo.type;
+ inferFromTypes(getUnionType(ts.append(ts.append(propTypes, stringIndexType), numberIndexType)), getTemplateTypeFromMappedType(target));
return true;
}
return false;
@@ -37576,8 +38232,8 @@
}
}
var properties = getPropertiesOfObjectType(target);
- for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) {
- var targetProp = properties_4[_i];
+ for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) {
+ var targetProp = properties_3[_i];
var sourceProp = getPropertyOfType(source, targetProp.escapedName);
if (sourceProp) {
inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp));
@@ -37599,7 +38255,7 @@
if (!skipParameters) {
var saveBivariant = bivariant;
var kind = target.declaration ? target.declaration.kind : 0;
- bivariant = bivariant || kind === 156 || kind === 155 || kind === 157;
+ bivariant = bivariant || kind === 157 || kind === 156 || kind === 158;
applyToParameterTypes(source, target, inferFromContravariantTypes);
bivariant = saveBivariant;
}
@@ -37662,7 +38318,7 @@
return candidates;
}
function getContravariantInference(inference) {
- return inference.priority & 28 ? getIntersectionType(inference.contraCandidates) : getCommonSubtype(inference.contraCandidates);
+ return inference.priority & 56 ? getIntersectionType(inference.contraCandidates) : getCommonSubtype(inference.contraCandidates);
}
function getCovariantInference(inference, signature) {
var candidates = widenObjectLiteralCandidates(inference.candidates);
@@ -37672,15 +38328,15 @@
var baseCandidates = primitiveConstraint ? ts.sameMap(candidates, getRegularTypeOfLiteralType) :
widenLiteralTypes ? ts.sameMap(candidates, getWidenedLiteralType) :
candidates;
- var unwidenedType = inference.priority & 28 ?
+ var unwidenedType = inference.priority & 56 ?
getUnionType(baseCandidates, 2) :
getCommonSupertype(baseCandidates);
return getWidenedType(unwidenedType);
}
function getInferredType(context, index) {
var inference = context.inferences[index];
- var inferredType = inference.inferredType;
- if (!inferredType) {
+ if (!inference.inferredType) {
+ var inferredType = void 0;
var signature = context.signature;
if (signature) {
var inferredCovariantType = inference.candidates ? getCovariantInference(inference, signature) : undefined;
@@ -37701,27 +38357,24 @@
if (defaultType) {
inferredType = instantiateType(defaultType, combineTypeMappers(createBackreferenceMapper(context, index), context.nonFixingMapper));
}
- else {
- inferredType = getDefaultTypeArgumentType(!!(context.flags & 2));
- }
}
}
else {
inferredType = getTypeFromInference(inference);
}
- inference.inferredType = inferredType;
+ inference.inferredType = inferredType || getDefaultTypeArgumentType(!!(context.flags & 2));
var constraint = getConstraintOfTypeParameter(inference.typeParameter);
if (constraint) {
var instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
- if (!context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
+ if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
inference.inferredType = inferredType = instantiatedConstraint;
}
}
}
- return inferredType;
+ return inference.inferredType;
}
function getDefaultTypeArgumentType(isInJavaScriptFile) {
- return isInJavaScriptFile ? anyType : emptyObjectType;
+ return isInJavaScriptFile ? anyType : unknownType;
}
function getInferredTypes(context) {
var result = [];
@@ -37730,8 +38383,8 @@
}
return result;
}
- function getCannotFindNameDiagnosticForName(name) {
- switch (name) {
+ function getCannotFindNameDiagnosticForName(node) {
+ switch (node.escapedText) {
case "document":
case "console":
return ts.Diagnostics.Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_include_dom;
@@ -37762,35 +38415,41 @@
case "Iterator":
case "AsyncIterator":
return ts.Diagnostics.Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later;
- default: return ts.Diagnostics.Cannot_find_name_0;
+ default:
+ if (node.parent.kind === 277) {
+ return ts.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer;
+ }
+ else {
+ return ts.Diagnostics.Cannot_find_name_0;
+ }
}
}
function getResolvedSymbol(node) {
var links = getNodeLinks(node);
if (!links.resolvedSymbol) {
links.resolvedSymbol = !ts.nodeIsMissing(node) &&
- resolveName(node, node.escapedText, 67220415 | 1048576, getCannotFindNameDiagnosticForName(node.escapedText), node, !ts.isWriteOnlyAccess(node), false, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_1) || unknownSymbol;
+ resolveName(node, node.escapedText, 67220415 | 1048576, getCannotFindNameDiagnosticForName(node), node, !ts.isWriteOnlyAccess(node), false, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_1) || unknownSymbol;
}
return links.resolvedSymbol;
}
function isInTypeQuery(node) {
- return !!ts.findAncestor(node, function (n) { return n.kind === 167 ? true : n.kind === 72 || n.kind === 148 ? false : "quit"; });
+ return !!ts.findAncestor(node, function (n) { return n.kind === 168 ? true : n.kind === 73 || n.kind === 149 ? false : "quit"; });
}
- function getFlowCacheKey(node) {
+ function getFlowCacheKey(node, declaredType, initialType, flowContainer) {
switch (node.kind) {
- case 72:
+ case 73:
var symbol = getResolvedSymbol(node);
- return symbol !== unknownSymbol ? (isConstraintPosition(node) ? "@" : "") + getSymbolId(symbol) : undefined;
- case 100:
+ return symbol !== unknownSymbol ? (flowContainer ? getNodeId(flowContainer) : "-1") + "|" + getTypeId(declaredType) + "|" + getTypeId(initialType) + "|" + (isConstraintPosition(node) ? "@" : "") + getSymbolId(symbol) : undefined;
+ case 101:
return "0";
- case 213:
- case 195:
- return getFlowCacheKey(node.expression);
- case 189:
+ case 214:
+ case 196:
+ return getFlowCacheKey(node.expression, declaredType, initialType, flowContainer);
case 190:
+ case 191:
var propName = getAccessedPropertyName(node);
if (propName !== undefined) {
- var key = getFlowCacheKey(node.expression);
+ var key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer);
return key && key + "." + propName;
}
}
@@ -37798,24 +38457,24 @@
}
function isMatchingReference(source, target) {
switch (target.kind) {
- case 195:
- case 213:
+ case 196:
+ case 214:
return isMatchingReference(source, target.expression);
}
switch (source.kind) {
- case 72:
- return target.kind === 72 && getResolvedSymbol(source) === getResolvedSymbol(target) ||
- (target.kind === 237 || target.kind === 186) &&
+ case 73:
+ return target.kind === 73 && getResolvedSymbol(source) === getResolvedSymbol(target) ||
+ (target.kind === 238 || target.kind === 187) &&
getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target);
- case 100:
- return target.kind === 100;
- case 98:
- return target.kind === 98;
- case 213:
- case 195:
+ case 101:
+ return target.kind === 101;
+ case 99:
+ return target.kind === 99;
+ case 214:
+ case 196:
return isMatchingReference(source.expression, target);
- case 189:
case 190:
+ case 191:
return ts.isAccessExpression(target) &&
getAccessedPropertyName(source) === getAccessedPropertyName(target) &&
isMatchingReference(source.expression, target.expression);
@@ -37823,7 +38482,7 @@
return false;
}
function getAccessedPropertyName(access) {
- return access.kind === 189 ? access.name.escapedText :
+ return access.kind === 190 ? access.name.escapedText :
ts.isStringLiteral(access.argumentExpression) || ts.isNumericLiteral(access.argumentExpression) ? ts.escapeLeadingUnderscores(access.argumentExpression.text) :
undefined;
}
@@ -37844,7 +38503,7 @@
isDiscriminantProperty(getDeclaredTypeOfReference(target.expression), name);
}
function getDeclaredTypeOfReference(expr) {
- if (expr.kind === 72) {
+ if (expr.kind === 73) {
return getTypeOfSymbol(getResolvedSymbol(expr));
}
if (ts.isAccessExpression(expr)) {
@@ -37866,7 +38525,7 @@
if (prop && ts.getCheckFlags(prop) & 2) {
if (prop.isDiscriminantProperty === undefined) {
prop.isDiscriminantProperty =
- (prop.checkFlags & 96) === 96 &&
+ (prop.checkFlags & 192) === 192 &&
isDiscriminantType(getTypeOfSymbol(prop));
}
return !!prop.isDiscriminantProperty;
@@ -37875,7 +38534,7 @@
return false;
}
function isSyntheticThisPropertyAccess(expr) {
- return ts.isAccessExpression(expr) && expr.expression.kind === 100 && !!(expr.expression.flags & 8);
+ return ts.isAccessExpression(expr) && expr.expression.kind === 101 && !!(expr.expression.flags & 8);
}
function findDiscriminantProperties(sourceProperties, target) {
var result;
@@ -37903,7 +38562,7 @@
}
}
}
- if (callExpression.expression.kind === 189 &&
+ if (callExpression.expression.kind === 190 &&
isOrContainsMatchingReference(reference, callExpression.expression.expression)) {
return true;
}
@@ -38013,7 +38672,7 @@
return strictNullChecks ? 7888800 : 16736160;
}
if (flags & 63176704) {
- return getTypeFacts(getBaseConstraintOfType(type) || emptyObjectType);
+ return getTypeFacts(getBaseConstraintOfType(type) || unknownType);
}
if (flags & 3145728) {
return getTypeFactsOfTypes(type.types);
@@ -38049,15 +38708,15 @@
return createArrayType(checkIteratedTypeOrElementType(type, undefined, false, false) || errorType);
}
function getAssignedTypeOfBinaryExpression(node) {
- var isDestructuringDefaultAssignment = node.parent.kind === 187 && isDestructuringAssignmentTarget(node.parent) ||
- node.parent.kind === 275 && isDestructuringAssignmentTarget(node.parent.parent);
+ var isDestructuringDefaultAssignment = node.parent.kind === 188 && isDestructuringAssignmentTarget(node.parent) ||
+ node.parent.kind === 276 && isDestructuringAssignmentTarget(node.parent.parent);
return isDestructuringDefaultAssignment ?
getTypeWithDefault(getAssignedType(node), node.right) :
getTypeOfExpression(node.right);
}
function isDestructuringAssignmentTarget(parent) {
- return parent.parent.kind === 204 && parent.parent.left === parent ||
- parent.parent.kind === 227 && parent.parent.initializer === parent;
+ return parent.parent.kind === 205 && parent.parent.left === parent ||
+ parent.parent.kind === 228 && parent.parent.initializer === parent;
}
function getAssignedTypeOfArrayLiteralElement(node, element) {
return getTypeOfDestructuredArrayElement(getAssignedType(node), node.elements.indexOf(element));
@@ -38074,21 +38733,21 @@
function getAssignedType(node) {
var parent = node.parent;
switch (parent.kind) {
- case 226:
- return stringType;
case 227:
+ return stringType;
+ case 228:
return checkRightHandSideOfForOf(parent.expression, parent.awaitModifier) || errorType;
- case 204:
+ case 205:
return getAssignedTypeOfBinaryExpression(parent);
- case 198:
+ case 199:
return undefinedType;
- case 187:
+ case 188:
return getAssignedTypeOfArrayLiteralElement(parent, node);
- case 208:
+ case 209:
return getAssignedTypeOfSpreadExpression(parent);
- case 275:
- return getAssignedTypeOfPropertyAssignment(parent);
case 276:
+ return getAssignedTypeOfPropertyAssignment(parent);
+ case 277:
return getAssignedTypeOfShorthandPropertyAssignment(parent);
}
return errorType;
@@ -38096,7 +38755,7 @@
function getInitialTypeOfBindingElement(node) {
var pattern = node.parent;
var parentType = getInitialType(pattern.parent);
- var type = pattern.kind === 184 ?
+ var type = pattern.kind === 185 ?
getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) :
!node.dotDotDotToken ?
getTypeOfDestructuredArrayElement(parentType, pattern.elements.indexOf(node)) :
@@ -38111,37 +38770,37 @@
if (node.initializer) {
return getTypeOfInitializer(node.initializer);
}
- if (node.parent.parent.kind === 226) {
+ if (node.parent.parent.kind === 227) {
return stringType;
}
- if (node.parent.parent.kind === 227) {
+ if (node.parent.parent.kind === 228) {
return checkRightHandSideOfForOf(node.parent.parent.expression, node.parent.parent.awaitModifier) || errorType;
}
return errorType;
}
function getInitialType(node) {
- return node.kind === 237 ?
+ return node.kind === 238 ?
getInitialTypeOfVariableDeclaration(node) :
getInitialTypeOfBindingElement(node);
}
function getInitialOrAssignedType(node, reference) {
- return getConstraintForLocation(node.kind === 237 || node.kind === 186 ?
+ return getConstraintForLocation(node.kind === 238 || node.kind === 187 ?
getInitialType(node) :
getAssignedType(node), reference);
}
function isEmptyArrayAssignment(node) {
- return node.kind === 237 && node.initializer &&
+ return node.kind === 238 && node.initializer &&
isEmptyArrayLiteral(node.initializer) ||
- node.kind !== 186 && node.parent.kind === 204 &&
+ node.kind !== 187 && node.parent.kind === 205 &&
isEmptyArrayLiteral(node.parent.right);
}
function getReferenceCandidate(node) {
switch (node.kind) {
- case 195:
+ case 196:
return getReferenceCandidate(node.expression);
- case 204:
+ case 205:
switch (node.operatorToken.kind) {
- case 59:
+ case 60:
return getReferenceCandidate(node.left);
case 27:
return getReferenceCandidate(node.right);
@@ -38151,13 +38810,13 @@
}
function getReferenceRoot(node) {
var parent = node.parent;
- return parent.kind === 195 ||
- parent.kind === 204 && parent.operatorToken.kind === 59 && parent.left === node ||
- parent.kind === 204 && parent.operatorToken.kind === 27 && parent.right === node ?
+ return parent.kind === 196 ||
+ parent.kind === 205 && parent.operatorToken.kind === 60 && parent.left === node ||
+ parent.kind === 205 && parent.operatorToken.kind === 27 && parent.right === node ?
getReferenceRoot(parent) : node;
}
function getTypeOfSwitchClause(clause) {
- if (clause.kind === 271) {
+ if (clause.kind === 272) {
return getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression));
}
return neverType;
@@ -38177,7 +38836,7 @@
var witnesses = [];
for (var _i = 0, _a = switchStatement.caseBlock.clauses; _i < _a.length; _i++) {
var clause = _a[_i];
- if (clause.kind === 271) {
+ if (clause.kind === 272) {
if (clause.expression.kind === 10) {
witnesses.push(clause.expression.text);
continue;
@@ -38223,6 +38882,9 @@
}
return f(type) ? type : neverType;
}
+ function countTypes(type) {
+ return type.flags & 1048576 ? type.types.length : 1;
+ }
function mapType(type, mapper, noReductions) {
if (type.flags & 131072) {
return type;
@@ -38230,25 +38892,20 @@
if (!(type.flags & 1048576)) {
return mapper(type);
}
- var types = type.types;
- var mappedType;
var mappedTypes;
- for (var _i = 0, types_13 = types; _i < types_13.length; _i++) {
- var current = types_13[_i];
- var t = mapper(current);
- if (t) {
- if (!mappedType) {
- mappedType = t;
- }
- else if (!mappedTypes) {
- mappedTypes = [mappedType, t];
+ for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
+ var t = _a[_i];
+ var mapped = mapper(t);
+ if (mapped) {
+ if (!mappedTypes) {
+ mappedTypes = [mapped];
}
else {
- mappedTypes.push(t);
+ mappedTypes.push(mapped);
}
}
}
- return mappedTypes ? getUnionType(mappedTypes, noReductions ? 0 : 1) : mappedType;
+ return mappedTypes && getUnionType(mappedTypes, noReductions ? 0 : 1);
}
function extractTypesOfKind(type, kind) {
return filterType(type, function (t) { return (t.flags & kind) !== 0; });
@@ -38305,8 +38962,8 @@
}
function isEvolvingArrayTypeList(types) {
var hasEvolvingArrayType = false;
- for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
- var t = types_14[_i];
+ for (var _i = 0, types_13 = types; _i < types_13.length; _i++) {
+ var t = types_13[_i];
if (!(t.flags & 131072)) {
if (!(ts.getObjectFlags(t) & 256)) {
return false;
@@ -38324,12 +38981,12 @@
function isEvolvingArrayOperationTarget(node) {
var root = getReferenceRoot(node);
var parent = root.parent;
- var isLengthPushOrUnshift = parent.kind === 189 && (parent.name.escapedText === "length" ||
- parent.parent.kind === 191 && ts.isPushOrUnshiftIdentifier(parent.name));
- var isElementAssignment = parent.kind === 190 &&
+ var isLengthPushOrUnshift = parent.kind === 190 && (parent.name.escapedText === "length" ||
+ parent.parent.kind === 192 && ts.isPushOrUnshiftIdentifier(parent.name));
+ var isElementAssignment = parent.kind === 191 &&
parent.expression === root &&
- parent.parent.kind === 204 &&
- parent.parent.operatorToken.kind === 59 &&
+ parent.parent.kind === 205 &&
+ parent.parent.operatorToken.kind === 60 &&
parent.parent.left === parent &&
!ts.isAssignmentTarget(parent.parent) &&
isTypeAssignableToKind(getTypeOfExpression(parent.argumentExpression), 296);
@@ -38343,7 +39000,7 @@
return links.maybeTypePredicate;
}
function getMaybeTypePredicate(node) {
- if (node.expression.kind !== 98) {
+ if (node.expression.kind !== 99) {
var funcType = checkNonNullExpression(node.expression);
if (funcType !== silentNeverType) {
var apparentType = getApparentType(funcType);
@@ -38361,6 +39018,7 @@
function getFlowTypeOfReference(reference, declaredType, initialType, flowContainer, couldBeUninitialized) {
if (initialType === void 0) { initialType = declaredType; }
var key;
+ var keySet = false;
var flowDepth = 0;
if (flowAnalysisDisabled) {
return errorType;
@@ -38372,10 +39030,17 @@
var evolvedType = getTypeFromFlowType(getTypeAtFlowNode(reference.flowNode));
sharedFlowCount = sharedFlowStart;
var resultType = ts.getObjectFlags(evolvedType) & 256 && isEvolvingArrayOperationTarget(reference) ? autoArrayType : finalizeEvolvingArrayType(evolvedType);
- if (reference.parent && reference.parent.kind === 213 && getTypeWithFacts(resultType, 2097152).flags & 131072) {
+ if (reference.parent && reference.parent.kind === 214 && getTypeWithFacts(resultType, 2097152).flags & 131072) {
return declaredType;
}
return resultType;
+ function getOrSetCacheKey() {
+ if (keySet) {
+ return key;
+ }
+ keySet = true;
+ return key = getFlowCacheKey(reference, declaredType, initialType, flowContainer);
+ }
function getTypeAtFlowNode(flow) {
if (flowDepth === 2000) {
flowAnalysisDisabled = true;
@@ -38385,6 +39050,15 @@
flowDepth++;
while (true) {
var flags = flow.flags;
+ if (flags & 8192) {
+ var key_2 = getOrSetCacheKey();
+ if (key_2) {
+ var id = getFlowNodeId(flow);
+ if (flowAssignmentKeys[id] === key_2) {
+ return flowAssignmentTypes[id];
+ }
+ }
+ }
if (flags & 1024) {
for (var i = sharedFlowStart; i < sharedFlowCount; i++) {
if (sharedFlowNodes[i] === flow) {
@@ -38409,6 +39083,15 @@
flow = flow.antecedent;
continue;
}
+ else if (flowLoopCount === flowLoopStart) {
+ var key_3 = getOrSetCacheKey();
+ if (key_3 && !isIncomplete(type)) {
+ flow.flags |= 8192;
+ var id = getFlowNodeId(flow);
+ flowAssignmentKeys[id] = key_3;
+ flowAssignmentTypes[id] = type;
+ }
+ }
}
else if (flags & 96) {
type = getTypeAtFlowCondition(flow);
@@ -38435,9 +39118,9 @@
else if (flags & 2) {
var container = flow.container;
if (container && container !== flowContainer &&
- reference.kind !== 189 &&
reference.kind !== 190 &&
- reference.kind !== 100) {
+ reference.kind !== 191 &&
+ reference.kind !== 101) {
flow = container.flowNode;
continue;
}
@@ -38477,13 +39160,13 @@
if (containsMatchingReference(reference, node)) {
if (ts.isVariableDeclaration(node) && (ts.isInJSFile(node) || ts.isVarConst(node))) {
var init = ts.getDeclaredExpandoInitializer(node);
- if (init && (init.kind === 196 || init.kind === 197)) {
+ if (init && (init.kind === 197 || init.kind === 198)) {
return getTypeAtFlowNode(flow.antecedent);
}
}
return declaredType;
}
- if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 226 && isMatchingReference(reference, node.parent.parent.expression)) {
+ if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 227 && isMatchingReference(reference, node.parent.parent.expression)) {
return getNonNullableTypeIfNeeded(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent)));
}
return undefined;
@@ -38491,7 +39174,7 @@
function getTypeAtFlowArrayMutation(flow) {
if (declaredType === autoType || declaredType === autoArrayType) {
var node = flow.node;
- var expr = node.kind === 191 ?
+ var expr = node.kind === 192 ?
node.expression.expression :
node.left.expression;
if (isMatchingReference(reference, getReferenceCandidate(expr))) {
@@ -38499,7 +39182,7 @@
var type = getTypeFromFlowType(flowType);
if (ts.getObjectFlags(type) & 256) {
var evolvedType_1 = type;
- if (node.kind === 191) {
+ if (node.kind === 192) {
for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) {
var arg = _a[_i];
evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg);
@@ -38544,7 +39227,7 @@
else if (isMatchingReferenceDiscriminant(expr, type)) {
type = narrowTypeByDiscriminant(type, expr, function (t) { return narrowTypeBySwitchOnDiscriminant(t, flow.switchStatement, flow.clauseStart, flow.clauseEnd); });
}
- else if (expr.kind === 199 && isMatchingReference(reference, expr.expression)) {
+ else if (expr.kind === 200 && isMatchingReference(reference, expr.expression)) {
type = narrowBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
}
else if (containsMatchingReferenceDiscriminant(reference, expr)) {
@@ -38579,12 +39262,10 @@
function getTypeAtFlowLoopLabel(flow) {
var id = getFlowNodeId(flow);
var cache = flowLoopCaches[id] || (flowLoopCaches[id] = ts.createMap());
- if (!key) {
- key = getFlowCacheKey(reference);
+ var key = getOrSetCacheKey();
if (!key) {
return declaredType;
}
- }
var cached = cache.get(key);
if (cached) {
return cached;
@@ -38670,7 +39351,7 @@
return !assumeTrue;
}
function narrowByInKeyword(type, literal, assumeTrue) {
- if ((type.flags & (1048576 | 524288)) || (type.flags & 262144 && type.isThisType)) {
+ if (type.flags & (1048576 | 524288) || isThisTypeParameter(type)) {
var propName_1 = ts.escapeLeadingUnderscores(literal.text);
return filterType(type, function (t) { return isTypePresencePossible(t, propName_1, assumeTrue); });
}
@@ -38678,8 +39359,8 @@
}
function narrowTypeByBinaryExpression(type, expr, assumeTrue) {
switch (expr.operatorToken.kind) {
- case 59:
- return narrowTypeByTruthiness(type, expr.left, assumeTrue);
+ case 60:
+ return narrowTypeByTruthiness(narrowType(type, expr.right, assumeTrue), expr.left, assumeTrue);
case 33:
case 34:
case 35:
@@ -38687,10 +39368,10 @@
var operator_1 = expr.operatorToken.kind;
var left_1 = getReferenceCandidate(expr.left);
var right_1 = getReferenceCandidate(expr.right);
- if (left_1.kind === 199 && ts.isStringLiteralLike(right_1)) {
+ if (left_1.kind === 200 && ts.isStringLiteralLike(right_1)) {
return narrowTypeByTypeof(type, left_1, operator_1, right_1, assumeTrue);
}
- if (right_1.kind === 199 && ts.isStringLiteralLike(left_1)) {
+ if (right_1.kind === 200 && ts.isStringLiteralLike(left_1)) {
return narrowTypeByTypeof(type, right_1, operator_1, left_1, assumeTrue);
}
if (isMatchingReference(reference, left_1)) {
@@ -38709,9 +39390,9 @@
return declaredType;
}
break;
- case 94:
+ case 95:
return narrowTypeByInstanceof(type, expr, assumeTrue);
- case 93:
+ case 94:
var target = getReferenceCandidate(expr.right);
if (ts.isStringLiteralLike(expr.left) && isMatchingReference(reference, target)) {
return narrowByInKeyword(type, expr.left, assumeTrue);
@@ -38755,7 +39436,10 @@
return type;
}
if (assumeTrue) {
- var narrowedType = filterType(type, function (t) { return areTypesComparable(t, valueType); });
+ var filterFn = operator === 33 ?
+ (function (t) { return areTypesComparable(t, valueType) || isCoercibleUnderDoubleEquals(t, valueType); }) :
+ function (t) { return areTypesComparable(t, valueType); };
+ var narrowedType = filterType(type, filterFn);
return narrowedType.flags & 131072 ? type : replacePrimitivesWithLiterals(narrowedType, valueType);
}
if (isUnitType(valueType)) {
@@ -38979,19 +39663,19 @@
}
function narrowType(type, expr, assumeTrue) {
switch (expr.kind) {
- case 72:
- case 100:
- case 98:
- case 189:
+ case 73:
+ case 101:
+ case 99:
case 190:
- return narrowTypeByTruthiness(type, expr, assumeTrue);
case 191:
+ return narrowTypeByTruthiness(type, expr, assumeTrue);
+ case 192:
return narrowTypeByTypePredicate(type, expr, assumeTrue);
- case 195:
+ case 196:
return narrowType(type, expr.expression, assumeTrue);
- case 204:
+ case 205:
return narrowTypeByBinaryExpression(type, expr, assumeTrue);
- case 202:
+ case 203:
if (expr.operator === 52) {
return narrowType(type, expr.operand, !assumeTrue);
}
@@ -39002,7 +39686,7 @@
}
function getTypeOfSymbolAtLocation(symbol, location) {
symbol = symbol.exportSymbol || symbol;
- if (location.kind === 72) {
+ if (location.kind === 73) {
if (ts.isRightSideOfQualifiedNameOrPropertyAccess(location)) {
location = location.parent;
}
@@ -39018,9 +39702,9 @@
function getControlFlowContainer(node) {
return ts.findAncestor(node.parent, function (node) {
return ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) ||
- node.kind === 245 ||
- node.kind === 284 ||
- node.kind === 154;
+ node.kind === 246 ||
+ node.kind === 285 ||
+ node.kind === 155;
});
}
function isParameterAssigned(symbol) {
@@ -39038,10 +39722,10 @@
return !!ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !!(getNodeLinks(node).flags & 8388608); });
}
function markParameterAssignments(node) {
- if (node.kind === 72) {
+ if (node.kind === 73) {
if (ts.isAssignmentTarget(node)) {
var symbol = getResolvedSymbol(node);
- if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 151) {
+ if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 152) {
symbol.isAssigned = true;
}
}
@@ -39055,7 +39739,7 @@
}
function removeOptionalityFromDeclaredType(declaredType, declaration) {
var annotationIncludesUndefined = strictNullChecks &&
- declaration.kind === 151 &&
+ declaration.kind === 152 &&
declaration.initializer &&
getFalsyFlags(declaredType) & 32768 &&
!(getFalsyFlags(checkExpression(declaration.initializer)) & 32768);
@@ -39063,13 +39747,13 @@
}
function isConstraintPosition(node) {
var parent = node.parent;
- return parent.kind === 189 ||
+ return parent.kind === 190 ||
+ parent.kind === 192 && parent.expression === node ||
parent.kind === 191 && parent.expression === node ||
- parent.kind === 190 && parent.expression === node ||
- parent.kind === 186 && parent.name === node && !!parent.initializer;
+ parent.kind === 187 && parent.name === node && !!parent.initializer;
}
function typeHasNullableConstraint(type) {
- return type.flags & 58982400 && maybeTypeOfKind(getBaseConstraintOfType(type) || emptyObjectType, 98304);
+ return type.flags & 58982400 && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 98304);
}
function getConstraintForLocation(type, node) {
if (type && isConstraintPosition(node) && forEachType(type, typeHasNullableConstraint)) {
@@ -39090,7 +39774,7 @@
if (symbol === argumentsSymbol) {
var container = ts.getContainingFunction(node);
if (languageVersion < 2) {
- if (container.kind === 197) {
+ if (container.kind === 198) {
error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression);
}
else if (ts.hasModifier(container, 256)) {
@@ -39106,7 +39790,7 @@
var localOrExportSymbol = getExportSymbolOfValueSymbolIfExported(symbol);
var declaration = localOrExportSymbol.valueDeclaration;
if (localOrExportSymbol.flags & 32) {
- if (declaration.kind === 240
+ if (declaration.kind === 241
&& ts.nodeIsDecorated(declaration)) {
var container = ts.getContainingClass(node);
while (container !== undefined) {
@@ -39118,11 +39802,11 @@
container = ts.getContainingClass(container);
}
}
- else if (declaration.kind === 209) {
+ else if (declaration.kind === 210) {
var container = ts.getThisContainer(node, false);
- while (container.kind !== 284) {
+ while (container.kind !== 285) {
if (container.parent === declaration) {
- if (container.kind === 154 && ts.hasModifier(container, 32)) {
+ if (container.kind === 155 && ts.hasModifier(container, 32)) {
getNodeLinks(declaration).flags |= 16777216;
getNodeLinks(node).flags |= 33554432;
}
@@ -39166,22 +39850,22 @@
if (!declaration) {
return type;
}
- var isParameter = ts.getRootDeclaration(declaration).kind === 151;
+ var isParameter = ts.getRootDeclaration(declaration).kind === 152;
var declarationContainer = getControlFlowContainer(declaration);
var flowContainer = getControlFlowContainer(node);
var isOuterVariable = flowContainer !== declarationContainer;
var isSpreadDestructuringAssignmentTarget = node.parent && node.parent.parent && ts.isSpreadAssignment(node.parent) && isDestructuringAssignmentTarget(node.parent.parent);
var isModuleExports = symbol.flags & 134217728;
- while (flowContainer !== declarationContainer && (flowContainer.kind === 196 ||
- flowContainer.kind === 197 || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) &&
+ while (flowContainer !== declarationContainer && (flowContainer.kind === 197 ||
+ flowContainer.kind === 198 || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) &&
(isConstVariable(localOrExportSymbol) || isParameter && !isParameterAssigned(localOrExportSymbol))) {
flowContainer = getControlFlowContainer(flowContainer);
}
- var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports ||
+ var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || ts.isBindingElement(declaration) ||
type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 3) !== 0 ||
- isInTypeQuery(node) || node.parent.kind === 257) ||
- node.parent.kind === 213 ||
- declaration.kind === 237 && declaration.exclamationToken ||
+ isInTypeQuery(node) || node.parent.kind === 258) ||
+ node.parent.kind === 214 ||
+ declaration.kind === 238 && declaration.exclamationToken ||
declaration.flags & 4194304;
var initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, declaration) : type) :
type === autoType || type === autoArrayType ? undefinedType :
@@ -39212,7 +39896,7 @@
if (languageVersion >= 2 ||
(symbol.flags & (2 | 32)) === 0 ||
ts.isSourceFile(symbol.valueDeclaration) ||
- symbol.valueDeclaration.parent.kind === 274) {
+ symbol.valueDeclaration.parent.kind === 275) {
return;
}
var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration);
@@ -39230,7 +39914,7 @@
if (usedInFunction) {
var capturesBlockScopeBindingInLoopBody = true;
if (ts.isForStatement(container) &&
- ts.getAncestor(symbol.valueDeclaration, 238).parent === container) {
+ ts.getAncestor(symbol.valueDeclaration, 239).parent === container) {
var part = getPartOfForStatementContainingNode(node.parent, container);
if (part) {
var links = getNodeLinks(part);
@@ -39246,8 +39930,8 @@
getNodeLinks(current).flags |= 65536;
}
}
- if (container.kind === 225 &&
- ts.getAncestor(symbol.valueDeclaration, 238).parent === container &&
+ if (container.kind === 226 &&
+ ts.getAncestor(symbol.valueDeclaration, 239).parent === container &&
isAssignedInBodyOfForStatement(node, container)) {
getNodeLinks(symbol.valueDeclaration).flags |= 4194304;
}
@@ -39263,14 +39947,14 @@
}
function isAssignedInBodyOfForStatement(node, container) {
var current = node;
- while (current.parent.kind === 195) {
+ while (current.parent.kind === 196) {
current = current.parent;
}
var isAssigned = false;
if (ts.isAssignmentTarget(current)) {
isAssigned = true;
}
- else if ((current.parent.kind === 202 || current.parent.kind === 203)) {
+ else if ((current.parent.kind === 203 || current.parent.kind === 204)) {
var expr = current.parent;
isAssigned = expr.operator === 44 || expr.operator === 45;
}
@@ -39281,7 +39965,7 @@
}
function captureLexicalThis(node, container) {
getNodeLinks(node).flags |= 2;
- if (container.kind === 154 || container.kind === 157) {
+ if (container.kind === 155 || container.kind === 158) {
var classNode = container.parent;
getNodeLinks(classNode).flags |= 4;
}
@@ -39325,32 +40009,32 @@
function checkThisExpression(node) {
var container = ts.getThisContainer(node, true);
var capturedByArrowFunction = false;
- if (container.kind === 157) {
+ if (container.kind === 158) {
checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class);
}
- if (container.kind === 197) {
+ if (container.kind === 198) {
container = ts.getThisContainer(container, false);
capturedByArrowFunction = true;
}
switch (container.kind) {
- case 244:
+ case 245:
error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body);
break;
- case 243:
+ case 244:
error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location);
break;
- case 157:
+ case 158:
if (isInConstructorArgumentInitializer(node, container)) {
error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments);
}
break;
+ case 155:
case 154:
- case 153:
if (ts.hasModifier(container, 32)) {
error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer);
}
break;
- case 149:
+ case 150:
error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name);
break;
}
@@ -39392,7 +40076,7 @@
}
}
else if (isInJS &&
- (container.kind === 196 || container.kind === 239) &&
+ (container.kind === 197 || container.kind === 240) &&
ts.getJSDocClassTag(container)) {
var classType = getJSClassType(getMergedSymbol(container.symbol));
if (classType) {
@@ -39426,7 +40110,7 @@
}
}
function getClassNameFromPrototypeMethod(container) {
- if (container.kind === 196 &&
+ if (container.kind === 197 &&
ts.isBinaryExpression(container.parent) &&
ts.getAssignmentDeclarationKind(container.parent) === 3) {
return container.parent
@@ -39434,20 +40118,20 @@
.expression
.expression;
}
- else if (container.kind === 156 &&
- container.parent.kind === 188 &&
+ else if (container.kind === 157 &&
+ container.parent.kind === 189 &&
ts.isBinaryExpression(container.parent.parent) &&
ts.getAssignmentDeclarationKind(container.parent.parent) === 6) {
return container.parent.parent.left.expression;
}
- else if (container.kind === 196 &&
- container.parent.kind === 275 &&
- container.parent.parent.kind === 188 &&
+ else if (container.kind === 197 &&
+ container.parent.kind === 276 &&
+ container.parent.parent.kind === 189 &&
ts.isBinaryExpression(container.parent.parent.parent) &&
ts.getAssignmentDeclarationKind(container.parent.parent.parent) === 6) {
return container.parent.parent.parent.left.expression;
}
- else if (container.kind === 196 &&
+ else if (container.kind === 197 &&
ts.isPropertyAssignment(container.parent) &&
ts.isIdentifier(container.parent.name) &&
(container.parent.name.escapedText === "value" || container.parent.name.escapedText === "get" || container.parent.name.escapedText === "set") &&
@@ -39469,7 +40153,7 @@
}
function getTypeForThisExpressionFromJSDoc(node) {
var jsdocType = ts.getJSDocType(node);
- if (jsdocType && jsdocType.kind === 294) {
+ if (jsdocType && jsdocType.kind === 295) {
var jsDocFunctionType = jsdocType;
if (jsDocFunctionType.parameters.length > 0 &&
jsDocFunctionType.parameters[0].name &&
@@ -39483,14 +40167,14 @@
}
}
function isInConstructorArgumentInitializer(node, constructorDecl) {
- return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 151 && n.parent === constructorDecl; });
+ return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 152 && n.parent === constructorDecl; });
}
function checkSuperExpression(node) {
- var isCallExpression = node.parent.kind === 191 && node.parent.expression === node;
+ var isCallExpression = node.parent.kind === 192 && node.parent.expression === node;
var container = ts.getSuperContainer(node, true);
var needToCaptureLexicalThis = false;
if (!isCallExpression) {
- while (container && container.kind === 197) {
+ while (container && container.kind === 198) {
container = ts.getSuperContainer(container, true);
needToCaptureLexicalThis = languageVersion < 2;
}
@@ -39498,14 +40182,14 @@
var canUseSuperExpression = isLegalUsageOfSuperExpression(container);
var nodeCheckFlag = 0;
if (!canUseSuperExpression) {
- var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 149; });
- if (current && current.kind === 149) {
+ var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 150; });
+ if (current && current.kind === 150) {
error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name);
}
else if (isCallExpression) {
error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors);
}
- else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 188)) {
+ else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 189)) {
error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions);
}
else {
@@ -39513,7 +40197,7 @@
}
return errorType;
}
- if (!isCallExpression && container.kind === 157) {
+ if (!isCallExpression && container.kind === 158) {
checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class);
}
if (ts.hasModifier(container, 32) || isCallExpression) {
@@ -39523,7 +40207,7 @@
nodeCheckFlag = 256;
}
getNodeLinks(node).flags |= nodeCheckFlag;
- if (container.kind === 156 && ts.hasModifier(container, 256)) {
+ if (container.kind === 157 && ts.hasModifier(container, 256)) {
if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) {
getNodeLinks(container).flags |= 4096;
}
@@ -39534,7 +40218,7 @@
if (needToCaptureLexicalThis) {
captureLexicalThis(node.parent, container);
}
- if (container.parent.kind === 188) {
+ if (container.parent.kind === 189) {
if (languageVersion < 2) {
error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher);
return errorType;
@@ -39553,7 +40237,7 @@
if (!baseClassType) {
return errorType;
}
- if (container.kind === 157 && isInConstructorArgumentInitializer(node, container)) {
+ if (container.kind === 158 && isInConstructorArgumentInitializer(node, container)) {
error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments);
return errorType;
}
@@ -39565,24 +40249,24 @@
return false;
}
if (isCallExpression) {
- return container.kind === 157;
+ return container.kind === 158;
}
else {
- if (ts.isClassLike(container.parent) || container.parent.kind === 188) {
+ if (ts.isClassLike(container.parent) || container.parent.kind === 189) {
if (ts.hasModifier(container, 32)) {
- return container.kind === 156 ||
- container.kind === 155 ||
- container.kind === 158 ||
- container.kind === 159;
+ return container.kind === 157 ||
+ container.kind === 156 ||
+ container.kind === 159 ||
+ container.kind === 160;
}
else {
- return container.kind === 156 ||
- container.kind === 155 ||
- container.kind === 158 ||
+ return container.kind === 157 ||
+ container.kind === 156 ||
container.kind === 159 ||
+ container.kind === 160 ||
+ container.kind === 155 ||
container.kind === 154 ||
- container.kind === 153 ||
- container.kind === 157;
+ container.kind === 158;
}
}
}
@@ -39590,10 +40274,10 @@
}
}
function getContainingObjectLiteral(func) {
- return (func.kind === 156 ||
- func.kind === 158 ||
- func.kind === 159) && func.parent.kind === 188 ? func.parent :
- func.kind === 196 && func.parent.kind === 275 ? func.parent.parent :
+ return (func.kind === 157 ||
+ func.kind === 159 ||
+ func.kind === 160) && func.parent.kind === 189 ? func.parent :
+ func.kind === 197 && func.parent.kind === 276 ? func.parent.parent :
undefined;
}
function getThisTypeArgument(type) {
@@ -39605,7 +40289,7 @@
});
}
function getContextualThisParameterType(func) {
- if (func.kind === 197) {
+ if (func.kind === 198) {
return undefined;
}
if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) {
@@ -39629,7 +40313,7 @@
if (thisType) {
return instantiateType(thisType, getMapperFromContext(getInferenceContext(containingLiteral)));
}
- if (literal.parent.kind !== 275) {
+ if (literal.parent.kind !== 276) {
break;
}
literal = literal.parent.parent;
@@ -39638,9 +40322,9 @@
return contextualType ? getNonNullableType(contextualType) : checkExpressionCached(containingLiteral);
}
var parent = func.parent;
- if (parent.kind === 204 && parent.operatorToken.kind === 59) {
+ if (parent.kind === 205 && parent.operatorToken.kind === 60) {
var target = parent.left;
- if (target.kind === 189 || target.kind === 190) {
+ if (target.kind === 190 || target.kind === 191) {
var expression = target.expression;
if (inJs && ts.isIdentifier(expression)) {
var sourceFile = ts.getSourceFileOfNode(parent);
@@ -39689,9 +40373,9 @@
return getTypeFromTypeNode(typeNode);
}
switch (declaration.kind) {
- case 151:
+ case 152:
return getContextuallyTypedParameterType(declaration);
- case 186:
+ case 187:
return getContextualTypeForBindingElement(declaration);
}
}
@@ -39796,16 +40480,16 @@
return getTypeAtPosition(signature, argIndex);
}
function getContextualTypeForSubstitutionExpression(template, substitutionExpression) {
- if (template.parent.kind === 193) {
+ if (template.parent.kind === 194) {
return getContextualTypeForArgument(template.parent, substitutionExpression);
}
return undefined;
}
- function getContextualTypeForBinaryOperand(node) {
+ function getContextualTypeForBinaryOperand(node, contextFlags) {
var binaryExpression = node.parent;
var left = binaryExpression.left, operatorToken = binaryExpression.operatorToken, right = binaryExpression.right;
switch (operatorToken.kind) {
- case 59:
+ case 60:
if (node !== right) {
return undefined;
}
@@ -39815,12 +40499,12 @@
}
return contextSensitive === true ? getTypeOfExpression(left) : contextSensitive;
case 55:
- var type = getContextualType(binaryExpression);
+ var type = getContextualType(binaryExpression, contextFlags);
return !type && node === right && !ts.isDefaultedExpandoInitializer(binaryExpression) ?
getTypeOfExpression(left) : type;
case 54:
case 27:
- return node === right ? getContextualType(binaryExpression) : undefined;
+ return node === right ? getContextualType(binaryExpression, contextFlags) : undefined;
default:
return undefined;
}
@@ -39920,20 +40604,20 @@
function getIndexTypeOfContextualType(type, kind) {
return mapType(type, function (t) { return getIndexTypeOfStructuredType(t, kind); }, true);
}
- function getContextualTypeForObjectLiteralMethod(node) {
+ function getContextualTypeForObjectLiteralMethod(node, contextFlags) {
ts.Debug.assert(ts.isObjectLiteralMethod(node));
if (node.flags & 8388608) {
return undefined;
}
- return getContextualTypeForObjectLiteralElement(node);
+ return getContextualTypeForObjectLiteralElement(node, contextFlags);
}
- function getContextualTypeForObjectLiteralElement(element) {
+ function getContextualTypeForObjectLiteralElement(element, contextFlags) {
var objectLiteral = element.parent;
- var type = getApparentTypeOfContextualType(objectLiteral);
+ var type = getApparentTypeOfContextualType(objectLiteral, contextFlags);
if (type) {
if (!hasNonBindableDynamicName(element)) {
- var symbolName_2 = getSymbolOfNode(element).escapedName;
- var propertyType = getTypeOfPropertyOfContextualType(type, symbolName_2);
+ var symbolName_3 = getSymbolOfNode(element).escapedName;
+ var propertyType = getTypeOfPropertyOfContextualType(type, symbolName_3);
if (propertyType) {
return propertyType;
}
@@ -39947,9 +40631,9 @@
return arrayContextualType && (getTypeOfPropertyOfContextualType(arrayContextualType, "" + index)
|| getIteratedTypeOrElementType(arrayContextualType, undefined, false, false, false));
}
- function getContextualTypeForConditionalOperand(node) {
+ function getContextualTypeForConditionalOperand(node, contextFlags) {
var conditional = node.parent;
- return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional) : undefined;
+ return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional, contextFlags) : undefined;
}
function getContextualTypeForChildJsxExpression(node, child) {
var attributesType = getApparentTypeOfContextualType(node.openingElement.tagName);
@@ -39957,16 +40641,17 @@
if (!(attributesType && !isTypeAny(attributesType) && jsxChildrenPropertyName && jsxChildrenPropertyName !== "")) {
return undefined;
}
- var childIndex = node.children.indexOf(child);
+ var realChildren = getSemanticJsxChildren(node.children);
+ var childIndex = realChildren.indexOf(child);
var childFieldType = getTypeOfPropertyOfContextualType(attributesType, jsxChildrenPropertyName);
- return childFieldType && mapType(childFieldType, function (t) {
+ return childFieldType && (realChildren.length === 1 ? childFieldType : mapType(childFieldType, function (t) {
if (isArrayLikeType(t)) {
return getIndexedAccessType(t, getLiteralType(childIndex));
}
else {
return t;
}
- }, true);
+ }, true));
}
function getContextualTypeForJsxExpression(node) {
var exprParent = node.parent;
@@ -39994,28 +40679,28 @@
case 8:
case 9:
case 14:
- case 102:
- case 87:
- case 96:
- case 72:
- case 141:
+ case 103:
+ case 88:
+ case 97:
+ case 73:
+ case 142:
return true;
- case 189:
- case 195:
+ case 190:
+ case 196:
return isPossiblyDiscriminantValue(node.expression);
- case 270:
+ case 271:
return !node.expression || isPossiblyDiscriminantValue(node.expression);
}
return false;
}
function discriminateContextualTypeByObjectMembers(node, contextualType) {
- return discriminateTypeByDiscriminableItems(contextualType, ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 275 && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return checkExpression(prop.initializer); }, prop.symbol.escapedName]; }), isTypeAssignableTo, contextualType);
+ return discriminateTypeByDiscriminableItems(contextualType, ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 276 && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return checkExpression(prop.initializer); }, prop.symbol.escapedName]; }), isTypeAssignableTo, contextualType);
}
function discriminateContextualTypeByJSXAttributes(node, contextualType) {
- return discriminateTypeByDiscriminableItems(contextualType, ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 267 && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return checkExpression(prop.initializer); }), prop.symbol.escapedName]; }), isTypeAssignableTo, contextualType);
+ return discriminateTypeByDiscriminableItems(contextualType, ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 268 && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return checkExpression(prop.initializer); }), prop.symbol.escapedName]; }), isTypeAssignableTo, contextualType);
}
- function getApparentTypeOfContextualType(node) {
- var contextualType = instantiateContextualType(getContextualType(node), node);
+ function getApparentTypeOfContextualType(node, contextFlags) {
+ var contextualType = instantiateContextualType(getContextualType(node, contextFlags), node, contextFlags);
if (contextualType) {
var apparentType = mapType(contextualType, getApparentType, true);
if (apparentType.flags & 1048576) {
@@ -40029,13 +40714,18 @@
return apparentType;
}
}
- function instantiateContextualType(contextualType, node) {
+ function instantiateContextualType(contextualType, node, contextFlags) {
if (contextualType && maybeTypeOfKind(contextualType, 63176704)) {
var inferenceContext = getInferenceContext(node);
- if (inferenceContext && inferenceContext.returnMapper) {
+ if (inferenceContext && ts.some(inferenceContext.inferences, hasInferenceCandidates)) {
+ if (contextFlags && contextFlags & 1) {
+ return instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper);
+ }
+ if (inferenceContext.returnMapper) {
return instantiateInstantiableTypes(contextualType, inferenceContext.returnMapper);
}
}
+ }
return contextualType;
}
function instantiateInstantiableTypes(type, mapper) {
@@ -40050,7 +40740,7 @@
}
return type;
}
- function getContextualType(node) {
+ function getContextualType(node, contextFlags) {
if (node.flags & 8388608) {
return undefined;
}
@@ -40059,53 +40749,53 @@
}
var parent = node.parent;
switch (parent.kind) {
- case 237:
- case 151:
+ case 238:
+ case 152:
+ case 155:
case 154:
- case 153:
- case 186:
+ case 187:
return getContextualTypeForInitializerExpression(node);
- case 197:
- case 230:
+ case 198:
+ case 231:
return getContextualTypeForReturnExpression(node);
- case 207:
+ case 208:
return getContextualTypeForYieldOperand(parent);
- case 201:
+ case 202:
return getContextualTypeForAwaitOperand(parent);
- case 191:
case 192:
+ case 193:
return getContextualTypeForArgument(parent, node);
- case 194:
- case 212:
+ case 195:
+ case 213:
return ts.isConstTypeReference(parent.type) ? undefined : getTypeFromTypeNode(parent.type);
- case 204:
- return getContextualTypeForBinaryOperand(node);
- case 275:
+ case 205:
+ return getContextualTypeForBinaryOperand(node, contextFlags);
case 276:
- return getContextualTypeForObjectLiteralElement(parent);
case 277:
- return getApparentTypeOfContextualType(parent.parent);
- case 187: {
+ return getContextualTypeForObjectLiteralElement(parent, contextFlags);
+ case 278:
+ return getApparentTypeOfContextualType(parent.parent, contextFlags);
+ case 188: {
var arrayLiteral = parent;
- var type = getApparentTypeOfContextualType(arrayLiteral);
+ var type = getApparentTypeOfContextualType(arrayLiteral, contextFlags);
return getContextualTypeForElementExpression(type, ts.indexOfNode(arrayLiteral.elements, node));
}
- case 205:
- return getContextualTypeForConditionalOperand(node);
- case 216:
- ts.Debug.assert(parent.parent.kind === 206);
+ case 206:
+ return getContextualTypeForConditionalOperand(node, contextFlags);
+ case 217:
+ ts.Debug.assert(parent.parent.kind === 207);
return getContextualTypeForSubstitutionExpression(parent.parent, node);
- case 195: {
+ case 196: {
var tag = ts.isInJSFile(parent) ? ts.getJSDocTypeTag(parent) : undefined;
- return tag ? getTypeFromTypeNode(tag.typeExpression.type) : getContextualType(parent);
+ return tag ? getTypeFromTypeNode(tag.typeExpression.type) : getContextualType(parent, contextFlags);
}
- case 270:
+ case 271:
return getContextualTypeForJsxExpression(parent);
- case 267:
- case 269:
+ case 268:
+ case 270:
return getContextualTypeForJsxAttribute(parent);
+ case 263:
case 262:
- case 261:
return getContextualJsxElementAttributesType(parent);
}
return undefined;
@@ -40124,7 +40814,7 @@
return getJsxReferenceKind(node) !== 0 ? getJsxPropsTypeFromCallSignature(signature, node) : getJsxPropsTypeFromClassType(signature, node);
}
function getJsxPropsTypeFromCallSignature(sig, context) {
- var propsType = getTypeOfFirstParameterOfSignatureWithFallback(sig, emptyObjectType);
+ var propsType = getTypeOfFirstParameterOfSignatureWithFallback(sig, unknownType);
propsType = getJsxManagedAttributesFromLocatedAttributes(context, getJsxNamespaceAt(context), propsType);
var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context);
if (intrinsicAttribs !== errorType) {
@@ -40189,7 +40879,7 @@
var ns = getJsxNamespaceAt(context);
var forcedLookupLocation = getJsxElementPropertiesName(ns);
var attributesType = forcedLookupLocation === undefined
- ? getTypeOfFirstParameterOfSignatureWithFallback(sig, emptyObjectType)
+ ? getTypeOfFirstParameterOfSignatureWithFallback(sig, unknownType)
: forcedLookupLocation === ""
? getReturnTypeOfSignature(sig)
: getJsxPropsTypeForSignatureFromMember(sig, forcedLookupLocation);
@@ -40197,7 +40887,7 @@
if (!!forcedLookupLocation && !!ts.length(context.attributes.properties)) {
error(context, ts.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, ts.unescapeLeadingUnderscores(forcedLookupLocation));
}
- return emptyObjectType;
+ return unknownType;
}
attributesType = getJsxManagedAttributesFromLocatedAttributes(context, ns, attributesType);
if (isTypeAny(attributesType)) {
@@ -40243,25 +40933,22 @@
return !hasEffectiveRestParameter(signature) && getParameterCount(signature) < targetParameterCount;
}
function isFunctionExpressionOrArrowFunction(node) {
- return node.kind === 196 || node.kind === 197;
+ return node.kind === 197 || node.kind === 198;
}
function getContextualSignatureForFunctionLikeDeclaration(node) {
return isFunctionExpressionOrArrowFunction(node) || ts.isObjectLiteralMethod(node)
? getContextualSignature(node)
: undefined;
}
- function getContextualTypeForFunctionLikeDeclaration(node) {
- return ts.isObjectLiteralMethod(node) ?
- getContextualTypeForObjectLiteralMethod(node) :
- getApparentTypeOfContextualType(node);
- }
function getContextualSignature(node) {
- ts.Debug.assert(node.kind !== 156 || ts.isObjectLiteralMethod(node));
+ ts.Debug.assert(node.kind !== 157 || ts.isObjectLiteralMethod(node));
var typeTagSignature = getSignatureOfTypeTag(node);
if (typeTagSignature) {
return typeTagSignature;
}
- var type = getContextualTypeForFunctionLikeDeclaration(node);
+ var type = ts.isObjectLiteralMethod(node) ?
+ getContextualTypeForObjectLiteralMethod(node, 1) :
+ getApparentTypeOfContextualType(node, 1);
if (!type) {
return undefined;
}
@@ -40270,8 +40957,8 @@
}
var signatureList;
var types = type.types;
- for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
- var current = types_15[_i];
+ for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
+ var current = types_14[_i];
var signature = getContextualCallSignature(current, node);
if (signature) {
if (!signatureList) {
@@ -40295,8 +40982,8 @@
return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, false, false);
}
function hasDefaultValue(node) {
- return (node.kind === 186 && !!node.initializer) ||
- (node.kind === 204 && node.operatorToken.kind === 59);
+ return (node.kind === 187 && !!node.initializer) ||
+ (node.kind === 205 && node.operatorToken.kind === 60);
}
function checkArrayLiteral(node, checkMode, forceTuple) {
var elements = node.elements;
@@ -40308,7 +40995,7 @@
var inConstContext = isConstContext(node);
for (var index = 0; index < elementCount; index++) {
var e = elements[index];
- if (inDestructuringPattern && e.kind === 208) {
+ if (inDestructuringPattern && e.kind === 209) {
var restArrayType = checkExpression(e.expression, checkMode, forceTuple);
var restElementType = getIndexTypeOfType(restArrayType, 1) ||
getIteratedTypeOrElementType(restArrayType, undefined, false, false, false);
@@ -40321,12 +41008,12 @@
var type = checkExpressionForMutableLocation(e, checkMode, elementContextualType, forceTuple);
elementTypes.push(type);
}
- if (index < elementCount - 1 && e.kind === 208) {
+ if (index < elementCount - 1 && e.kind === 209) {
hasNonEndingSpreadElement = true;
}
}
if (!hasNonEndingSpreadElement) {
- var hasRestElement = elementCount > 0 && elements[elementCount - 1].kind === 208;
+ var hasRestElement = elementCount > 0 && elements[elementCount - 1].kind === 209;
var minLength = elementCount - (hasRestElement ? 1 : 0);
var tupleResult = void 0;
if (inDestructuringPattern && minLength > 0) {
@@ -40351,15 +41038,15 @@
if (readonly || (contextualType && forEachType(contextualType, isTupleLikeType))) {
var minLength = elementCount - (hasRestElement ? 1 : 0);
var pattern = contextualType && contextualType.pattern;
- if (!hasRestElement && pattern && (pattern.kind === 185 || pattern.kind === 187)) {
+ if (!hasRestElement && pattern && (pattern.kind === 186 || pattern.kind === 188)) {
var patternElements = pattern.elements;
for (var i = elementCount; i < patternElements.length; i++) {
var e = patternElements[i];
if (hasDefaultValue(e)) {
elementTypes.push(contextualType.typeArguments[i]);
}
- else if (i < patternElements.length - 1 || !(e.kind === 186 && e.dotDotDotToken || e.kind === 208)) {
- if (e.kind !== 210) {
+ else if (i < patternElements.length - 1 || !(e.kind === 187 && e.dotDotDotToken || e.kind === 209)) {
+ if (e.kind !== 211) {
error(e, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value);
}
elementTypes.push(strictNullChecks ? implicitNeverType : undefinedWideningType);
@@ -40371,9 +41058,9 @@
}
function isNumericName(name) {
switch (name.kind) {
- case 149:
+ case 150:
return isNumericComputedName(name);
- case 72:
+ case 73:
return isNumericLiteralName(name.escapedText);
case 8:
case 10:
@@ -40435,7 +41122,7 @@
var spread = emptyObjectType;
var contextualType = getApparentTypeOfContextualType(node);
var contextualTypeHasPattern = contextualType && contextualType.pattern &&
- (contextualType.pattern.kind === 184 || contextualType.pattern.kind === 188);
+ (contextualType.pattern.kind === 185 || contextualType.pattern.kind === 189);
var inConstContext = isConstContext(node);
var checkFlags = inConstContext ? 8 : 0;
var isInJavascript = ts.isInJSFile(node) && !ts.isInJsonFile(node);
@@ -40450,13 +41137,13 @@
for (var i = 0; i < node.properties.length; i++) {
var memberDecl = node.properties[i];
var member = getSymbolOfNode(memberDecl);
- var computedNameType = memberDecl.name && memberDecl.name.kind === 149 && !ts.isWellKnownSymbolSyntactically(memberDecl.name.expression) ?
+ var computedNameType = memberDecl.name && memberDecl.name.kind === 150 && !ts.isWellKnownSymbolSyntactically(memberDecl.name.expression) ?
checkComputedPropertyName(memberDecl.name) : undefined;
- if (memberDecl.kind === 275 ||
- memberDecl.kind === 276 ||
+ if (memberDecl.kind === 276 ||
+ memberDecl.kind === 277 ||
ts.isObjectLiteralMethod(memberDecl)) {
- var type = memberDecl.kind === 275 ? checkPropertyAssignment(memberDecl, checkMode) :
- memberDecl.kind === 276 ? checkExpressionForMutableLocation(memberDecl.name, checkMode) :
+ var type = memberDecl.kind === 276 ? checkPropertyAssignment(memberDecl, checkMode) :
+ memberDecl.kind === 277 ? checkExpressionForMutableLocation(memberDecl.name, checkMode) :
checkObjectLiteralMethod(memberDecl, checkMode);
if (isInJavascript) {
var jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl);
@@ -40471,14 +41158,14 @@
objectFlags |= ts.getObjectFlags(type) & 917504;
var nameType = computedNameType && isTypeUsableAsPropertyName(computedNameType) ? computedNameType : undefined;
var prop = nameType ?
- createSymbol(4 | member.flags, getPropertyNameFromType(nameType), checkFlags | 2048) :
+ createSymbol(4 | member.flags, getPropertyNameFromType(nameType), checkFlags | 4096) :
createSymbol(4 | member.flags, member.escapedName, checkFlags);
if (nameType) {
prop.nameType = nameType;
}
if (inDestructuringPattern) {
- var isOptional = (memberDecl.kind === 275 && hasDefaultValue(memberDecl.initializer)) ||
- (memberDecl.kind === 276 && memberDecl.objectAssignmentInitializer);
+ var isOptional = (memberDecl.kind === 276 && hasDefaultValue(memberDecl.initializer)) ||
+ (memberDecl.kind === 277 && memberDecl.objectAssignmentInitializer);
if (isOptional) {
prop.flags |= 16777216;
}
@@ -40501,7 +41188,7 @@
prop.target = member;
member = prop;
}
- else if (memberDecl.kind === 277) {
+ else if (memberDecl.kind === 278) {
if (languageVersion < 2) {
checkExternalEmitHelpers(memberDecl, 2);
}
@@ -40522,7 +41209,7 @@
continue;
}
else {
- ts.Debug.assert(memberDecl.kind === 158 || memberDecl.kind === 159);
+ ts.Debug.assert(memberDecl.kind === 159 || memberDecl.kind === 160);
checkNodeDeferred(memberDecl);
}
if (computedNameType && !(computedNameType.flags & 8576)) {
@@ -40619,7 +41306,7 @@
return !ts.stringContains(name, "-");
}
function isJsxIntrinsicIdentifier(tagName) {
- return tagName.kind === 72 && ts.isIntrinsicJsxName(tagName.escapedText);
+ return tagName.kind === 73 && ts.isIntrinsicJsxName(tagName.escapedText);
}
function checkJsxAttribute(node, checkMode) {
return node.initializer
@@ -40655,7 +41342,7 @@
}
}
else {
- ts.Debug.assert(attributeDecl.kind === 269);
+ ts.Debug.assert(attributeDecl.kind === 270);
if (attributesTable.size > 0) {
spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, objectFlags, false);
attributesTable = ts.createSymbolTable();
@@ -40677,7 +41364,7 @@
spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, objectFlags, false);
}
}
- var parent = openingLikeElement.parent.kind === 260 ? openingLikeElement.parent : undefined;
+ var parent = openingLikeElement.parent.kind === 261 ? openingLikeElement.parent : undefined;
if (parent && parent.openingElement === openingLikeElement && parent.children.length > 0) {
var childrenTypes = checkJsxChildren(parent, checkMode);
if (!hasSpreadAnyType && jsxChildrenPropertyName && jsxChildrenPropertyName !== "") {
@@ -40998,8 +41685,8 @@
}
function checkPropertyAccessibility(node, isSuper, type, prop) {
var flags = ts.getDeclarationModifierFlagsFromSymbol(prop);
- var errorNode = node.kind === 148 ? node.right : node.kind === 183 ? node : node.name;
- if (ts.getCheckFlags(prop) & 512) {
+ var errorNode = node.kind === 149 ? node.right : node.kind === 184 ? node : node.name;
+ if (ts.getCheckFlags(prop) & 1024) {
error(errorNode, ts.Diagnostics.Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1, symbolToString(prop), typeToString(type));
return false;
}
@@ -41079,7 +41766,7 @@
return type;
}
function checkNonNullType(type, node, nullDiagnostic, undefinedDiagnostic, nullOrUndefinedDiagnostic) {
- if (type.flags & 2) {
+ if (strictNullChecks && type.flags & 2) {
error(node, ts.Diagnostics.Object_is_of_type_unknown);
return errorType;
}
@@ -41094,6 +41781,13 @@
}
return type;
}
+ function checkNonNullNonVoidType(type, node) {
+ var nonNullType = checkNonNullType(type, node);
+ if (nonNullType !== errorType && nonNullType.flags & 16384) {
+ error(node, ts.Diagnostics.Object_is_possibly_undefined);
+ }
+ return nonNullType;
+ }
function checkPropertyAccessExpression(node) {
return checkPropertyAccessExpressionOrQualifiedName(node, node.expression, node.name);
}
@@ -41117,7 +41811,7 @@
markAliasReferenced(parentSymbol, node);
}
if (!prop) {
- var indexInfo = getIndexInfoOfType(apparentType, 0);
+ var indexInfo = assignmentKind === 0 || !isGenericObjectType(leftType) ? getIndexInfoOfType(apparentType, 0) : undefined;
if (!(indexInfo && indexInfo.type)) {
if (isJSLiteralType(leftType)) {
return anyType;
@@ -41132,7 +41826,7 @@
return anyType;
}
if (right.escapedText && !checkAndReportErrorForExtendingInterface(node)) {
- reportNonexistentProperty(right, leftType.flags & 262144 && leftType.isThisType ? apparentType : leftType);
+ reportNonexistentProperty(right, isThisTypeParameter(leftType) ? apparentType : leftType);
}
return errorType;
}
@@ -41143,9 +41837,9 @@
}
else {
checkPropertyNotUsedBeforeDeclaration(prop, node, right);
- markPropertyAsReferenced(prop, node, left.kind === 100);
+ markPropertyAsReferenced(prop, node, left.kind === 101);
getNodeLinks(node).resolvedSymbol = prop;
- checkPropertyAccessibility(node, left.kind === 98, apparentType, prop);
+ checkPropertyAccessibility(node, left.kind === 99, apparentType, prop);
if (assignmentKind) {
if (isReferenceToReadonlyEntity(node, prop) || isReferenceThroughNamespaceImport(node)) {
error(right, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, ts.idText(right));
@@ -41154,17 +41848,17 @@
}
propType = getConstraintForLocation(getTypeOfSymbol(prop), node);
}
- if (node.kind !== 189 ||
+ if (node.kind !== 190 ||
assignmentKind === 1 ||
prop && !(prop.flags & (3 | 4 | 98304)) && !(prop.flags & 8192 && propType.flags & 1048576)) {
return propType;
}
var assumeUninitialized = false;
- if (strictNullChecks && strictPropertyInitialization && left.kind === 100) {
+ if (strictNullChecks && strictPropertyInitialization && left.kind === 101) {
var declaration = prop && prop.valueDeclaration;
if (declaration && isInstancePropertyWithoutInitializer(declaration)) {
var flowContainer = getControlFlowContainer(node);
- if (flowContainer.kind === 157 && flowContainer.parent === declaration.parent) {
+ if (flowContainer.kind === 158 && flowContainer.parent === declaration.parent) {
assumeUninitialized = true;
}
}
@@ -41194,8 +41888,8 @@
&& !isPropertyDeclaredInAncestorClass(prop)) {
diagnosticMessage = error(right, ts.Diagnostics.Property_0_is_used_before_its_initialization, declarationName);
}
- else if (valueDeclaration.kind === 240 &&
- node.parent.kind !== 164 &&
+ else if (valueDeclaration.kind === 241 &&
+ node.parent.kind !== 165 &&
!(valueDeclaration.flags & 4194304) &&
!isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) {
diagnosticMessage = error(right, ts.Diagnostics.Class_0_used_before_its_declaration, declarationName);
@@ -41207,22 +41901,22 @@
function isInPropertyInitializer(node) {
return !!ts.findAncestor(node, function (node) {
switch (node.kind) {
- case 154:
+ case 155:
return true;
- case 275:
- case 156:
- case 158:
+ case 276:
+ case 157:
case 159:
- case 277:
- case 149:
- case 216:
- case 270:
- case 267:
+ case 160:
+ case 278:
+ case 150:
+ case 217:
+ case 271:
case 268:
case 269:
- case 262:
- case 211:
- case 273:
+ case 270:
+ case 263:
+ case 212:
+ case 274:
return false;
default:
return ts.isExpressionNode(node) ? false : "quit";
@@ -41321,6 +42015,31 @@
var suggestion = getSuggestedSymbolForNonexistentModule(name, targetModule);
return suggestion && ts.symbolName(suggestion);
}
+ function getSuggestionForNonexistentIndexSignature(objectType, expr) {
+ var hasProp = function (name, argCount) {
+ if (argCount === void 0) { argCount = 1; }
+ var prop = getPropertyOfObjectType(objectType, name);
+ if (prop) {
+ var s = getSingleCallSignature(getTypeOfSymbol(prop));
+ if (s && getMinArgumentCount(s) === argCount && typeToString(getTypeAtPosition(s, 0)) === "string") {
+ return true;
+ }
+ }
+ return false;
+ };
+ var suggestedMethod = ts.isAssignmentTarget(expr) ? "set" : "get";
+ if (!hasProp(suggestedMethod)) {
+ return undefined;
+ }
+ var suggestion = ts.tryGetPropertyAccessOrIdentifierToString(expr);
+ if (suggestion === undefined) {
+ suggestion = suggestedMethod;
+ }
+ else {
+ suggestion += "." + suggestedMethod;
+ }
+ return suggestion;
+ }
function getSpellingSuggestionForName(name, symbols, meaning) {
return ts.getSpellingSuggestion(name, symbols, getCandidateName);
function getCandidateName(candidate) {
@@ -41345,34 +42064,16 @@
}
function isValidPropertyAccess(node, propertyName) {
switch (node.kind) {
- case 189:
- return isValidPropertyAccessWithType(node, node.expression.kind === 98, propertyName, getWidenedType(checkExpression(node.expression)));
- case 148:
+ case 190:
+ return isValidPropertyAccessWithType(node, node.expression.kind === 99, propertyName, getWidenedType(checkExpression(node.expression)));
+ case 149:
return isValidPropertyAccessWithType(node, false, propertyName, getWidenedType(checkExpression(node.left)));
- case 183:
+ case 184:
return isValidPropertyAccessWithType(node, false, propertyName, getTypeFromTypeNode(node));
}
}
function isValidPropertyAccessForCompletions(node, type, property) {
- return isValidPropertyAccessWithType(node, node.kind === 189 && node.expression.kind === 98, property.escapedName, type)
- && (!(property.flags & 8192) || isValidMethodAccess(property, type));
- }
- function isValidMethodAccess(method, actualThisType) {
- var propType = getTypeOfPropertyOfType(actualThisType, method.escapedName);
- var signatures = getSignaturesOfType(getNonNullableType(propType), 0);
- ts.Debug.assert(signatures.length !== 0);
- return signatures.some(function (sig) {
- var signatureThisType = getThisTypeOfSignature(sig);
- return !signatureThisType || isTypeAssignableTo(actualThisType, getInstantiatedSignatureThisType(sig, signatureThisType, actualThisType));
- });
- }
- function getInstantiatedSignatureThisType(sig, signatureThisType, actualThisType) {
- if (!sig.typeParameters) {
- return signatureThisType;
- }
- var context = createInferenceContext(sig.typeParameters, sig, 0);
- inferTypes(context.inferences, actualThisType, signatureThisType);
- return instantiateType(signatureThisType, createSignatureTypeMapper(sig, getInferredTypes(context)));
+ return isValidPropertyAccessWithType(node, node.kind === 190 && node.expression.kind === 99, property.escapedName, type);
}
function isValidPropertyAccessWithType(node, isSuper, propertyName, type) {
if (type === errorType || isTypeAny(type)) {
@@ -41384,13 +42085,13 @@
}
function getForInVariableSymbol(node) {
var initializer = node.initializer;
- if (initializer.kind === 238) {
+ if (initializer.kind === 239) {
var variable = initializer.declarations[0];
if (variable && !ts.isBindingPattern(variable.name)) {
return getSymbolOfNode(variable);
}
}
- else if (initializer.kind === 72) {
+ else if (initializer.kind === 73) {
return getResolvedSymbol(initializer);
}
return undefined;
@@ -41400,13 +42101,13 @@
}
function isForInVariableForNumericPropertyNames(expr) {
var e = ts.skipParentheses(expr);
- if (e.kind === 72) {
+ if (e.kind === 73) {
var symbol = getResolvedSymbol(e);
if (symbol.flags & 3) {
var child = expr;
var node = expr.parent;
while (node) {
- if (node.kind === 226 &&
+ if (node.kind === 227 &&
child === node.statement &&
getForInVariableSymbol(node) === symbol &&
hasNumericPropertyNames(getTypeOfExpression(node.expression))) {
@@ -41424,7 +42125,7 @@
var indexExpression = node.argumentExpression;
if (!indexExpression) {
var sourceFile = ts.getSourceFileOfNode(node);
- if (node.parent.kind === 192 && node.parent.expression === node) {
+ if (node.parent.kind === 193 && node.parent.expression === node) {
var start = ts.skipTrivia(sourceFile.text, node.expression.end);
var end = node.end;
grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead);
@@ -41444,7 +42145,12 @@
error(indexExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal);
return errorType;
}
- return checkIndexedAccessIndexType(getIndexedAccessType(objectType, isForInVariableForNumericPropertyNames(indexExpression) ? numberType : indexType, node), node);
+ var effectiveIndexType = isForInVariableForNumericPropertyNames(indexExpression) ? numberType : indexType;
+ var accessFlags = ts.isAssignmentTarget(node) ?
+ 2 | (isGenericObjectType(objectType) && !isThisTypeParameter(objectType) ? 1 : 0) :
+ 0;
+ var indexedAccessType = getIndexedAccessTypeOrUndefined(objectType, effectiveIndexType, node, accessFlags) || errorType;
+ return checkIndexedAccessIndexType(indexedAccessType, node);
}
function checkThatExpressionIsProperSymbolReference(expression, expressionType, reportError) {
if (expressionType === errorType) {
@@ -41483,13 +42189,13 @@
if (callLikeExpressionMayHaveTypeArguments(node)) {
ts.forEach(node.typeArguments, checkSourceElement);
}
- if (node.kind === 193) {
+ if (node.kind === 194) {
checkExpression(node.template);
}
else if (ts.isJsxOpeningLikeElement(node)) {
checkExpression(node.attributes);
}
- else if (node.kind !== 152) {
+ else if (node.kind !== 153) {
ts.forEach(node.arguments, function (argument) {
checkExpression(argument);
});
@@ -41538,7 +42244,7 @@
}
}
function isSpreadArgument(arg) {
- return !!arg && (arg.kind === 208 || arg.kind === 215 && arg.isSpread);
+ return !!arg && (arg.kind === 209 || arg.kind === 216 && arg.isSpread);
}
function getSpreadArgumentIndex(args) {
return ts.findIndex(args, isSpreadArgument);
@@ -41552,9 +42258,9 @@
var callIsIncomplete = false;
var effectiveParameterCount = getParameterCount(signature);
var effectiveMinimumArguments = getMinArgumentCount(signature);
- if (node.kind === 193) {
+ if (node.kind === 194) {
argCount = args.length;
- if (node.template.kind === 206) {
+ if (node.template.kind === 207) {
var lastSpan = ts.last(node.template.templateSpans);
callIsIncomplete = ts.nodeIsMissing(lastSpan.literal) || !!lastSpan.literal.isUnterminated;
}
@@ -41564,7 +42270,7 @@
callIsIncomplete = !!templateLiteral.isUnterminated;
}
}
- else if (node.kind === 152) {
+ else if (node.kind === 153) {
argCount = getDecoratorArgumentCount(node, signature);
}
else if (ts.isJsxOpeningLikeElement(node)) {
@@ -41578,7 +42284,7 @@
}
else {
if (!node.arguments) {
- ts.Debug.assert(node.kind === 192);
+ ts.Debug.assert(node.kind === 193);
return getMinArgumentCount(signature) === 0;
}
argCount = signatureHelpTrailingComma ? args.length + 1 : args.length;
@@ -41609,12 +42315,23 @@
(typeArguments.length >= minTypeArgumentCount && typeArguments.length <= numTypeParameters);
}
function getSingleCallSignature(type) {
+ return getSingleSignature(type, 0, false);
+ }
+ function getSingleCallOrConstructSignature(type) {
+ return getSingleSignature(type, 0, false) ||
+ getSingleSignature(type, 1, false);
+ }
+ function getSingleSignature(type, kind, allowMembers) {
if (type.flags & 524288) {
var resolved = resolveStructuredTypeMembers(type);
- if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 &&
- resolved.properties.length === 0 && !resolved.stringIndexInfo && !resolved.numberIndexInfo) {
+ if (allowMembers || resolved.properties.length === 0 && !resolved.stringIndexInfo && !resolved.numberIndexInfo) {
+ if (kind === 0 && resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0) {
return resolved.callSignatures[0];
}
+ if (kind === 1 && resolved.constructSignatures.length === 1 && resolved.callSignatures.length === 0) {
+ return resolved.constructSignatures[0];
+ }
+ }
}
return undefined;
}
@@ -41628,7 +42345,7 @@
});
if (!inferenceContext) {
applyToReturnTypes(contextualSignature, signature, function (source, target) {
- inferTypes(context.inferences, source, target, 8);
+ inferTypes(context.inferences, source, target, 16);
});
}
return getSignatureInstantiation(signature, getInferredTypes(context), ts.isInJSFile(contextualSignature.declaration));
@@ -41643,7 +42360,7 @@
if (ts.isJsxOpeningLikeElement(node)) {
return inferJsxTypeArguments(node, signature, checkMode, context);
}
- if (node.kind !== 152) {
+ if (node.kind !== 153) {
var contextualType = getContextualType(node);
if (contextualType) {
var outerMapper = getMapperFromContext(cloneInferenceContext(getInferenceContext(node), 1));
@@ -41653,7 +42370,7 @@
getOrCreateTypeFromSignature(getSignatureInstantiationWithoutFillingInTypeArguments(contextualSignature, contextualSignature.typeParameters)) :
instantiatedType;
var inferenceTargetType = getReturnTypeOfSignature(signature);
- inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 8);
+ inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 16);
context.returnMapper = getMapperFromContext(cloneInferredPartOfContext(context));
}
}
@@ -41667,7 +42384,7 @@
var argCount = restType ? Math.min(getParameterCount(signature) - 1, args.length) : args.length;
for (var i = 0; i < argCount; i++) {
var arg = args[i];
- if (arg.kind !== 210) {
+ if (arg.kind !== 211) {
var paramType = getTypeAtPosition(signature, i);
var argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
inferTypes(context.inferences, argType, paramType);
@@ -41681,7 +42398,7 @@
}
function getArrayifiedType(type) {
if (forEachType(type, function (t) { return !(t.flags & (1 | 63176704) || isArrayType(t) || isTupleType(t)); })) {
- return createArrayType(getIndexTypeOfType(type, 1) || errorType);
+ return createArrayType(getIndexedAccessType(type, numberType));
}
return type;
}
@@ -41689,20 +42406,20 @@
if (index >= argCount - 1) {
var arg = args[argCount - 1];
if (isSpreadArgument(arg)) {
- return arg.kind === 215 ?
+ return arg.kind === 216 ?
createArrayType(arg.type) :
getArrayifiedType(checkExpressionWithContextualType(arg.expression, restType, context, 0));
}
}
- var contextualType = getIndexTypeOfType(restType, 1) || anyType;
- var hasPrimitiveContextualType = maybeTypeOfKind(contextualType, 131068 | 4194304);
var types = [];
var spreadIndex = -1;
for (var i = index; i < argCount; i++) {
+ var contextualType = getIndexedAccessType(restType, getLiteralType(i - index));
var argType = checkExpressionWithContextualType(args[i], contextualType, context, 0);
if (spreadIndex < 0 && isSpreadArgument(args[i])) {
spreadIndex = i - index;
}
+ var hasPrimitiveContextualType = maybeTypeOfKind(contextualType, 131068 | 4194304);
types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType));
}
return spreadIndex < 0 ?
@@ -41754,7 +42471,7 @@
return checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation, checkMode, reportErrors);
}
var thisType = getThisTypeOfSignature(signature);
- if (thisType && thisType !== voidType && node.kind !== 192) {
+ if (thisType && thisType !== voidType && node.kind !== 193) {
var thisArgumentNode = getThisArgumentOfCall(node);
var thisArgumentType = thisArgumentNode ? checkExpression(thisArgumentNode) : voidType;
var errorNode = reportErrors ? (thisArgumentNode || node) : undefined;
@@ -41768,7 +42485,7 @@
var argCount = restType ? Math.min(getParameterCount(signature) - 1, args.length) : args.length;
for (var i = 0; i < argCount; i++) {
var arg = args[i];
- if (arg.kind !== 210) {
+ if (arg.kind !== 211) {
var paramType = getTypeAtPosition(signature, i);
var argType = checkExpressionWithContextualType(arg, paramType, undefined, checkMode);
var checkArgType = checkMode & 4 ? getRegularTypeOfObjectLiteral(argType) : argType;
@@ -41785,32 +42502,32 @@
return true;
}
function getThisArgumentOfCall(node) {
- if (node.kind === 191) {
+ if (node.kind === 192) {
var callee = ts.skipOuterExpressions(node.expression);
- if (callee.kind === 189 || callee.kind === 190) {
+ if (callee.kind === 190 || callee.kind === 191) {
return callee.expression;
}
}
}
function createSyntheticExpression(parent, type, isSpread) {
- var result = ts.createNode(215, parent.pos, parent.end);
+ var result = ts.createNode(216, parent.pos, parent.end);
result.parent = parent;
result.type = type;
result.isSpread = isSpread || false;
return result;
}
function getEffectiveCallArguments(node) {
- if (node.kind === 193) {
+ if (node.kind === 194) {
var template = node.template;
- var args_4 = [createSyntheticExpression(template, getGlobalTemplateStringsArrayType())];
- if (template.kind === 206) {
+ var args_3 = [createSyntheticExpression(template, getGlobalTemplateStringsArrayType())];
+ if (template.kind === 207) {
ts.forEach(template.templateSpans, function (span) {
- args_4.push(span.expression);
+ args_3.push(span.expression);
});
}
- return args_4;
+ return args_3;
}
- if (node.kind === 152) {
+ if (node.kind === 153) {
return getEffectiveDecoratorArguments(node);
}
if (ts.isJsxOpeningLikeElement(node)) {
@@ -41820,7 +42537,7 @@
var length = args.length;
if (length && isSpreadArgument(args[length - 1]) && getSpreadArgumentIndex(args) === length - 1) {
var spreadArgument_1 = args[length - 1];
- var type = checkExpressionCached(spreadArgument_1.expression);
+ var type = flowLoopCount ? checkExpression(spreadArgument_1.expression) : checkExpressionCached(spreadArgument_1.expression);
if (isTupleType(type)) {
var typeArguments = type.typeArguments || ts.emptyArray;
var restIndex_2 = type.target.hasRestElement ? typeArguments.length - 1 : -1;
@@ -41834,23 +42551,23 @@
var parent = node.parent;
var expr = node.expression;
switch (parent.kind) {
- case 240:
- case 209:
+ case 241:
+ case 210:
return [
createSyntheticExpression(expr, getTypeOfSymbol(getSymbolOfNode(parent)))
];
- case 151:
+ case 152:
var func = parent.parent;
return [
- createSyntheticExpression(expr, parent.parent.kind === 157 ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType),
+ createSyntheticExpression(expr, parent.parent.kind === 158 ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType),
createSyntheticExpression(expr, anyType),
createSyntheticExpression(expr, numberType)
];
- case 154:
- case 156:
- case 158:
+ case 155:
+ case 157:
case 159:
- var hasPropDesc = parent.kind !== 154 && languageVersion !== 0;
+ case 160:
+ var hasPropDesc = parent.kind !== 155 && languageVersion !== 0;
return [
createSyntheticExpression(expr, getParentTypeOfClassElement(parent)),
createSyntheticExpression(expr, getClassElementPropertyKeyType(parent)),
@@ -41861,16 +42578,16 @@
}
function getDecoratorArgumentCount(node, signature) {
switch (node.parent.kind) {
- case 240:
- case 209:
+ case 241:
+ case 210:
return 1;
- case 154:
+ case 155:
return 2;
- case 156:
- case 158:
+ case 157:
case 159:
+ case 160:
return languageVersion === 0 || signature.parameters.length <= 2 ? 2 : 3;
- case 151:
+ case 152:
return 3;
default:
return ts.Debug.fail();
@@ -41968,14 +42685,14 @@
return ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), typeArguments, ts.Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount);
}
function resolveCall(node, signatures, candidatesOutArray, checkMode, fallbackError) {
- var isTaggedTemplate = node.kind === 193;
- var isDecorator = node.kind === 152;
+ var isTaggedTemplate = node.kind === 194;
+ var isDecorator = node.kind === 153;
var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node);
var reportErrors = !candidatesOutArray;
var typeArguments;
if (!isDecorator) {
typeArguments = node.typeArguments;
- if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 98) {
+ if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 99) {
ts.forEach(typeArguments, checkSourceElement);
}
}
@@ -41994,7 +42711,7 @@
var candidateForArgumentArityError;
var candidateForTypeArgumentError;
var result;
- var signatureHelpTrailingComma = !!(checkMode & 16) && node.kind === 191 && node.arguments.hasTrailingComma;
+ var signatureHelpTrailingComma = !!(checkMode & 16) && node.kind === 192 && node.arguments.hasTrailingComma;
if (candidates.length > 1) {
result = chooseOverload(candidates, subtypeRelation, signatureHelpTrailingComma);
}
@@ -42117,7 +42834,7 @@
}
var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
var parameters = [];
- var _loop_8 = function (i) {
+ var _loop_11 = function (i) {
var symbols = ts.mapDefined(candidates, function (_a) {
var parameters = _a.parameters, hasRestParameter = _a.hasRestParameter;
return hasRestParameter ?
@@ -42128,7 +42845,7 @@
parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
};
for (var i = 0; i < maxNonRestParam; i++) {
- _loop_8(i);
+ _loop_11(i);
}
var restParameterSymbols = ts.mapDefined(candidates, function (c) { return c.hasRestParameter ? ts.last(c.parameters) : undefined; });
var hasRestParameter = restParameterSymbols.length !== 0;
@@ -42194,7 +42911,7 @@
return maxParamsIndex;
}
function resolveCallExpression(node, candidatesOutArray, checkMode) {
- if (node.expression.kind === 98) {
+ if (node.expression.kind === 99) {
var superType = checkSuperExpression(node.expression);
if (isTypeAny(superType)) {
for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) {
@@ -42407,16 +43124,16 @@
}
function getDiagnosticHeadMessageForDecoratorResolution(node) {
switch (node.parent.kind) {
- case 240:
- case 209:
+ case 241:
+ case 210:
return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression;
- case 151:
+ case 152:
return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression;
- case 154:
+ case 155:
return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression;
- case 156:
- case 158:
+ case 157:
case 159:
+ case 160:
return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression;
default:
return ts.Debug.fail();
@@ -42454,7 +43171,7 @@
var exports = namespace && getExportsOfSymbol(namespace);
var typeSymbol = exports && getSymbol(exports, JsxNames.Element, 67897832);
var returnNode = typeSymbol && nodeBuilder.symbolToEntityName(typeSymbol, 67897832, node);
- var declaration = ts.createFunctionTypeNode(undefined, [ts.createParameter(undefined, undefined, undefined, "props", undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.createTypeReferenceNode(returnNode, undefined) : ts.createKeywordTypeNode(120));
+ var declaration = ts.createFunctionTypeNode(undefined, [ts.createParameter(undefined, undefined, undefined, "props", undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.createTypeReferenceNode(returnNode, undefined) : ts.createKeywordTypeNode(121));
var parameterSymbol = createSymbol(1, "props");
parameterSymbol.type = result;
return createSignature(declaration, undefined, undefined, [parameterSymbol], typeSymbol ? getDeclaredTypeOfSymbol(typeSymbol) : errorType, undefined, 1, false, false);
@@ -42490,16 +43207,16 @@
}
function resolveSignature(node, candidatesOutArray, checkMode) {
switch (node.kind) {
- case 191:
- return resolveCallExpression(node, candidatesOutArray, checkMode);
case 192:
- return resolveNewExpression(node, candidatesOutArray, checkMode);
+ return resolveCallExpression(node, candidatesOutArray, checkMode);
case 193:
+ return resolveNewExpression(node, candidatesOutArray, checkMode);
+ case 194:
return resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode);
- case 152:
+ case 153:
return resolveDecorator(node, candidatesOutArray, checkMode);
+ case 263:
case 262:
- case 261:
return resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode);
}
throw ts.Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable.");
@@ -42564,10 +43281,10 @@
return false;
}
var parent = node.parent;
- while (parent && parent.kind === 189) {
+ while (parent && parent.kind === 190) {
parent = parent.parent;
}
- if (parent && ts.isBinaryExpression(parent) && ts.isPrototypeAccess(parent.left) && parent.operatorToken.kind === 59) {
+ if (parent && ts.isBinaryExpression(parent) && ts.isPrototypeAccess(parent.left) && parent.operatorToken.kind === 60) {
var right = ts.getInitializerOfBinaryExpression(parent);
return ts.isObjectLiteralExpression(right) && right;
}
@@ -42586,15 +43303,15 @@
if (signature === resolvingSignature) {
return nonInferrableType;
}
- if (node.expression.kind === 98) {
+ if (node.expression.kind === 99) {
return voidType;
}
- if (node.kind === 192) {
+ if (node.kind === 193) {
var declaration = signature.declaration;
if (declaration &&
- declaration.kind !== 157 &&
- declaration.kind !== 161 &&
- declaration.kind !== 166 &&
+ declaration.kind !== 158 &&
+ declaration.kind !== 162 &&
+ declaration.kind !== 167 &&
!ts.isJSDocConstructSignature(declaration) &&
!isJSConstructor(declaration)) {
if (noImplicitAny) {
@@ -42701,9 +43418,9 @@
return false;
}
var targetDeclarationKind = resolvedRequire.flags & 16
- ? 239
+ ? 240
: resolvedRequire.flags & 3
- ? 237
+ ? 238
: 0;
if (targetDeclarationKind !== 0) {
var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind);
@@ -42727,18 +43444,25 @@
case 14:
case 8:
case 9:
- case 102:
- case 87:
- case 187:
+ case 103:
+ case 88:
case 188:
+ case 189:
return true;
- case 195:
+ case 196:
return isValidConstAssertionArgument(node.expression);
- case 202:
+ case 203:
var op = node.operator;
var arg = node.operand;
return op === 39 && (arg.kind === 8 || arg.kind === 9) ||
op === 38 && arg.kind === 8;
+ case 190:
+ case 191:
+ var expr = node.expression;
+ if (ts.isIdentifier(expr)) {
+ var symbol = getSymbolAtLocation(expr);
+ return !!(symbol && (symbol.flags & 384) && getEnumKind(symbol) === 1);
+ }
}
return false;
}
@@ -42746,7 +43470,7 @@
var exprType = checkExpression(expression, checkMode);
if (ts.isConstTypeReference(type)) {
if (!isValidConstAssertionArgument(expression)) {
- error(expression, ts.Diagnostics.A_const_assertion_can_only_be_applied_to_a_string_number_boolean_array_or_object_literal);
+ error(expression, ts.Diagnostics.A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals);
}
return getRegularTypeOfLiteralType(exprType);
}
@@ -42766,10 +43490,10 @@
}
function checkMetaProperty(node) {
checkGrammarMetaProperty(node);
- if (node.keywordToken === 95) {
+ if (node.keywordToken === 96) {
return checkNewTargetMetaProperty(node);
}
- if (node.keywordToken === 92) {
+ if (node.keywordToken === 93) {
return checkImportMetaProperty(node);
}
return ts.Debug.assertNever(node.keywordToken);
@@ -42780,7 +43504,7 @@
error(node, ts.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target");
return errorType;
}
- else if (container.kind === 157) {
+ else if (container.kind === 158) {
var symbol = getSymbolOfNode(container.parent);
return getTypeOfSymbol(symbol);
}
@@ -42790,7 +43514,7 @@
}
}
function checkImportMetaProperty(node) {
- if (languageVersion < 7 || moduleKind < ts.ModuleKind.ESNext) {
+ if (languageVersion < 8 || moduleKind < ts.ModuleKind.ESNext) {
error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_using_ESNext_for_the_target_and_module_compiler_options);
}
var file = ts.getSourceFileOfNode(node);
@@ -42956,7 +43680,7 @@
for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) {
var element = _a[_i];
if (!ts.isOmittedExpression(element)) {
- if (element.name.kind === 72) {
+ if (element.name.kind === 73) {
getSymbolLinks(getSymbolOfNode(element)).type = getTypeForBindingElement(element);
}
else {
@@ -42970,8 +43694,8 @@
if (!links.type) {
links.type = contextualType;
var decl = parameter.valueDeclaration;
- if (decl.name.kind !== 72) {
- if (links.type === emptyObjectType) {
+ if (decl.name.kind !== 73) {
+ if (links.type === unknownType) {
links.type = getTypeFromBindingPattern(decl.name);
}
assignBindingElementTypes(decl.name);
@@ -42981,22 +43705,22 @@
function createPromiseType(promisedType) {
var globalPromiseType = getGlobalPromiseType(true);
if (globalPromiseType !== emptyGenericType) {
- promisedType = getAwaitedType(promisedType) || emptyObjectType;
+ promisedType = getAwaitedType(promisedType) || unknownType;
return createTypeReference(globalPromiseType, [promisedType]);
}
- return emptyObjectType;
+ return unknownType;
}
function createPromiseLikeType(promisedType) {
var globalPromiseLikeType = getGlobalPromiseLikeType(true);
if (globalPromiseLikeType !== emptyGenericType) {
- promisedType = getAwaitedType(promisedType) || emptyObjectType;
+ promisedType = getAwaitedType(promisedType) || unknownType;
return createTypeReference(globalPromiseLikeType, [promisedType]);
}
- return emptyObjectType;
+ return unknownType;
}
function createPromiseReturnType(func, promisedType) {
var promiseType = createPromiseType(promisedType);
- if (promiseType === emptyObjectType) {
+ if (promiseType === unknownType) {
error(func, ts.isImportCall(func) ?
ts.Diagnostics.A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option :
ts.Diagnostics.An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option);
@@ -43015,7 +43739,7 @@
}
var functionFlags = ts.getFunctionFlags(func);
var type;
- if (func.body.kind !== 218) {
+ if (func.body.kind !== 219) {
type = checkExpressionCached(func.body, checkMode && checkMode & ~8);
if (functionFlags & 2) {
type = checkAwaitedType(type, func, ts.Diagnostics.The_return_type_of_an_async_function_must_either_be_a_valid_promise_or_must_not_contain_a_callable_then_member);
@@ -43127,7 +43851,7 @@
if (!node.possiblyExhaustive) {
return false;
}
- if (node.expression.kind === 199) {
+ if (node.expression.kind === 200) {
var operandType = getTypeOfExpression(node.expression.expression);
var witnesses = getSwitchClauseTypeOfWitnesses(node);
var notEqualFacts_1 = getFactsFromTypeofSwitch(0, 0, witnesses, true);
@@ -43148,7 +43872,7 @@
if (!(func.flags & 128)) {
return false;
}
- if (ts.some(func.body.statements, function (statement) { return statement.kind === 232 && isExhaustiveSwitchStatement(statement); })) {
+ if (ts.some(func.body.statements, function (statement) { return statement.kind === 233 && isExhaustiveSwitchStatement(statement); })) {
return false;
}
return true;
@@ -43185,11 +43909,11 @@
}
function mayReturnNever(func) {
switch (func.kind) {
- case 196:
case 197:
+ case 198:
return true;
- case 156:
- return func.parent.kind === 188;
+ case 157:
+ return func.parent.kind === 189;
default:
return false;
}
@@ -43201,7 +43925,7 @@
if (returnType && maybeTypeOfKind(returnType, 1 | 16384)) {
return;
}
- if (func.kind === 155 || ts.nodeIsMissing(func.body) || func.body.kind !== 218 || !functionHasImplicitReturn(func)) {
+ if (func.kind === 156 || ts.nodeIsMissing(func.body) || func.body.kind !== 219 || !functionHasImplicitReturn(func)) {
return;
}
var hasExplicitReturn = func.flags & 256;
@@ -43228,7 +43952,7 @@
}
}
function checkFunctionExpressionOrObjectLiteralMethod(node, checkMode) {
- ts.Debug.assert(node.kind !== 156 || ts.isObjectLiteralMethod(node));
+ ts.Debug.assert(node.kind !== 157 || ts.isObjectLiteralMethod(node));
checkNodeDeferred(node);
if (checkMode && checkMode & 4 && isContextSensitive(node)) {
if (!ts.getEffectiveReturnTypeNode(node) && hasContextSensitiveReturnExpression(node)) {
@@ -43245,7 +43969,7 @@
return anyFunctionType;
}
var hasGrammarError = checkGrammarFunctionLikeDeclaration(node);
- if (!hasGrammarError && node.kind === 196) {
+ if (!hasGrammarError && node.kind === 197) {
checkGrammarForGenerator(node);
}
var links = getNodeLinks(node);
@@ -43286,7 +44010,7 @@
getAwaitedType(type) || errorType : type;
}
function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) {
- ts.Debug.assert(node.kind !== 156 || ts.isObjectLiteralMethod(node));
+ ts.Debug.assert(node.kind !== 157 || ts.isObjectLiteralMethod(node));
var functionFlags = ts.getFunctionFlags(node);
var returnOrPromisedType = getReturnOrPromisedType(node, functionFlags);
if ((functionFlags & 1) === 0) {
@@ -43296,7 +44020,7 @@
if (!ts.getEffectiveReturnTypeNode(node)) {
getReturnTypeOfSignature(getSignatureFromDeclaration(node));
}
- if (node.body.kind === 218) {
+ if (node.body.kind === 219) {
checkSourceElement(node.body);
}
else {
@@ -43358,10 +44082,10 @@
function isReferenceToReadonlyEntity(expr, symbol) {
if (isReadonlySymbol(symbol)) {
if (symbol.flags & 4 &&
- (expr.kind === 189 || expr.kind === 190) &&
- expr.expression.kind === 100) {
+ (expr.kind === 190 || expr.kind === 191) &&
+ expr.expression.kind === 101) {
var func = ts.getContainingFunction(expr);
- if (!(func && func.kind === 157)) {
+ if (!(func && func.kind === 158)) {
return true;
}
return !symbol.valueDeclaration || !(func.parent === symbol.valueDeclaration.parent || func === symbol.valueDeclaration.parent);
@@ -43371,13 +44095,13 @@
return false;
}
function isReferenceThroughNamespaceImport(expr) {
- if (expr.kind === 189 || expr.kind === 190) {
+ if (expr.kind === 190 || expr.kind === 191) {
var node = ts.skipParentheses(expr.expression);
- if (node.kind === 72) {
+ if (node.kind === 73) {
var symbol = getNodeLinks(node).resolvedSymbol;
if (symbol.flags & 2097152) {
var declaration = getDeclarationOfAliasSymbol(symbol);
- return !!declaration && declaration.kind === 251;
+ return !!declaration && declaration.kind === 252;
}
}
}
@@ -43385,7 +44109,7 @@
}
function checkReferenceExpression(expr, invalidReferenceMessage) {
var node = ts.skipOuterExpressions(expr, 2 | 1);
- if (node.kind !== 72 && node.kind !== 189 && node.kind !== 190) {
+ if (node.kind !== 73 && node.kind !== 190 && node.kind !== 191) {
error(expr, invalidReferenceMessage);
return false;
}
@@ -43394,7 +44118,7 @@
function checkDeleteExpression(node) {
checkExpression(node.expression);
var expr = ts.skipParentheses(node.expression);
- if (expr.kind !== 189 && expr.kind !== 190) {
+ if (expr.kind !== 190 && expr.kind !== 191) {
error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference);
return booleanType;
}
@@ -43416,7 +44140,18 @@
function checkAwaitExpression(node) {
if (produceDiagnostics) {
if (!(node.flags & 16384)) {
- grammarErrorOnFirstToken(node, ts.Diagnostics.await_expression_is_only_allowed_within_an_async_function);
+ var sourceFile = ts.getSourceFileOfNode(node);
+ if (!hasParseDiagnostics(sourceFile)) {
+ var span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);
+ var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.await_expression_is_only_allowed_within_an_async_function);
+ var func = ts.getContainingFunction(node);
+ if (func && func.kind !== 158) {
+ ts.Debug.assert((ts.getFunctionFlags(func) & 2) === 0, "Enclosing function should never be an async function.");
+ var relatedInfo = ts.createDiagnosticForNode(func, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async);
+ ts.addRelatedInfo(diagnostic, relatedInfo);
+ }
+ diagnostics.add(diagnostic);
+ }
}
if (isInParameterInitializerBeforeContainingFunction(node)) {
error(node, ts.Diagnostics.await_expressions_cannot_be_used_in_a_parameter_initializer);
@@ -43503,8 +44238,8 @@
}
if (type.flags & 3145728) {
var types = type.types;
- for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
- var t = types_16[_i];
+ for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
+ var t = types_15[_i];
if (maybeTypeOfKind(t, kind)) {
return true;
}
@@ -43573,15 +44308,16 @@
if (strictNullChecks && properties.length === 0) {
return checkNonNullType(sourceType, node);
}
- for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) {
- var p = properties_5[_i];
- checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, properties, rightIsThis);
+ for (var i = 0; i < properties.length; i++) {
+ checkObjectLiteralDestructuringPropertyAssignment(node, sourceType, i, properties, rightIsThis);
}
return sourceType;
}
- function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties, rightIsThis) {
+ function checkObjectLiteralDestructuringPropertyAssignment(node, objectLiteralType, propertyIndex, allProperties, rightIsThis) {
if (rightIsThis === void 0) { rightIsThis = false; }
- if (property.kind === 275 || property.kind === 276) {
+ var properties = node.properties;
+ var property = properties[propertyIndex];
+ if (property.kind === 276 || property.kind === 277) {
var name = property.name;
var exprType = getLiteralTypeFromPropertyName(name);
if (isTypeUsableAsPropertyName(exprType)) {
@@ -43594,22 +44330,30 @@
}
var elementType = getIndexedAccessType(objectLiteralType, exprType, name);
var type = getFlowTypeOfDestructuring(property, elementType);
- return checkDestructuringAssignment(property.kind === 276 ? property : property.initializer, type);
+ return checkDestructuringAssignment(property.kind === 277 ? property : property.initializer, type);
+ }
+ else if (property.kind === 278) {
+ if (propertyIndex < properties.length - 1) {
+ error(property, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);
}
- else if (property.kind === 277) {
- if (languageVersion < 7) {
+ else {
+ if (languageVersion < 8) {
checkExternalEmitHelpers(property, 4);
}
var nonRestNames = [];
if (allProperties) {
- for (var i = 0; i < allProperties.length - 1; i++) {
- nonRestNames.push(allProperties[i].name);
+ for (var _i = 0, allProperties_1 = allProperties; _i < allProperties_1.length; _i++) {
+ var otherProperty = allProperties_1[_i];
+ if (!ts.isSpreadAssignment(otherProperty)) {
+ nonRestNames.push(otherProperty.name);
+ }
}
}
var type = getRestType(objectLiteralType, nonRestNames, objectLiteralType.symbol);
checkGrammarForDisallowedTrailingComma(allProperties, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma);
return checkDestructuringAssignment(property.expression, type);
}
+ }
else {
error(property, ts.Diagnostics.Property_assignment_expected);
}
@@ -43628,8 +44372,8 @@
function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, checkMode) {
var elements = node.elements;
var element = elements[elementIndex];
- if (element.kind !== 210) {
- if (element.kind !== 208) {
+ if (element.kind !== 211) {
+ if (element.kind !== 209) {
var indexType = getLiteralType(elementIndex);
if (isArrayLikeType(sourceType)) {
var elementType_2 = getIndexedAccessType(sourceType, indexType, createSyntheticExpression(element, indexType));
@@ -43643,7 +44387,7 @@
}
else {
var restExpression = element.expression;
- if (restExpression.kind === 204 && restExpression.operatorToken.kind === 59) {
+ if (restExpression.kind === 205 && restExpression.operatorToken.kind === 60) {
error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer);
}
else {
@@ -43659,7 +44403,7 @@
}
function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode, rightIsThis) {
var target;
- if (exprOrAssignment.kind === 276) {
+ if (exprOrAssignment.kind === 277) {
var prop = exprOrAssignment;
if (prop.objectAssignmentInitializer) {
if (strictNullChecks &&
@@ -43673,21 +44417,21 @@
else {
target = exprOrAssignment;
}
- if (target.kind === 204 && target.operatorToken.kind === 59) {
+ if (target.kind === 205 && target.operatorToken.kind === 60) {
checkBinaryExpression(target, checkMode);
target = target.left;
}
- if (target.kind === 188) {
+ if (target.kind === 189) {
return checkObjectLiteralAssignment(target, sourceType, rightIsThis);
}
- if (target.kind === 187) {
+ if (target.kind === 188) {
return checkArrayLiteralAssignment(target, sourceType, checkMode);
}
return checkReferenceAssignment(target, sourceType, checkMode);
}
function checkReferenceAssignment(target, sourceType, checkMode) {
var targetType = checkExpression(target, checkMode);
- var error = target.parent.kind === 277 ?
+ var error = target.parent.kind === 278 ?
ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access :
ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access;
if (checkReferenceExpression(target, error)) {
@@ -43698,39 +44442,39 @@
function isSideEffectFree(node) {
node = ts.skipParentheses(node);
switch (node.kind) {
- case 72:
+ case 73:
case 10:
case 13:
- case 193:
- case 206:
+ case 194:
+ case 207:
case 14:
case 8:
case 9:
- case 102:
- case 87:
- case 96:
- case 141:
- case 196:
- case 209:
+ case 103:
+ case 88:
+ case 97:
+ case 142:
case 197:
- case 187:
+ case 210:
+ case 198:
case 188:
- case 199:
- case 213:
+ case 189:
+ case 200:
+ case 214:
+ case 262:
case 261:
- case 260:
return true;
- case 205:
+ case 206:
return isSideEffectFree(node.whenTrue) &&
isSideEffectFree(node.whenFalse);
- case 204:
+ case 205:
if (ts.isAssignmentOperator(node.operatorToken.kind)) {
return false;
}
return isSideEffectFree(node.left) &&
isSideEffectFree(node.right);
- case 202:
case 203:
+ case 204:
switch (node.operator) {
case 52:
case 38:
@@ -43739,9 +44483,9 @@
return true;
}
return false;
- case 200:
- case 194:
- case 212:
+ case 201:
+ case 195:
+ case 213:
default:
return false;
}
@@ -43757,8 +44501,8 @@
}
function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) {
var operator = operatorToken.kind;
- if (operator === 59 && (left.kind === 188 || left.kind === 187)) {
- return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode, right.kind === 100);
+ if (operator === 60 && (left.kind === 189 || left.kind === 188)) {
+ return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode, right.kind === 101);
}
var leftType;
if (operator === 54 || operator === 55) {
@@ -43771,26 +44515,26 @@
switch (operator) {
case 40:
case 41:
- case 62:
case 63:
- case 42:
case 64:
- case 43:
+ case 42:
case 65:
+ case 43:
+ case 66:
case 39:
- case 61:
+ case 62:
case 46:
- case 66:
- case 47:
case 67:
- case 48:
+ case 47:
case 68:
+ case 48:
+ case 69:
case 50:
- case 70:
- case 51:
case 71:
+ case 51:
+ case 72:
case 49:
- case 69:
+ case 70:
if (leftType === silentNeverType || rightType === silentNeverType) {
return silentNeverType;
}
@@ -43814,7 +44558,7 @@
else if (isTypeAssignableToKind(leftType, 2112) && isTypeAssignableToKind(rightType, 2112)) {
switch (operator) {
case 48:
- case 68:
+ case 69:
reportOperatorError();
}
resultType_1 = bigintType;
@@ -43829,7 +44573,7 @@
return resultType_1;
}
case 38:
- case 60:
+ case 61:
if (leftType === silentNeverType || rightType === silentNeverType) {
return silentNeverType;
}
@@ -43857,7 +44601,7 @@
reportOperatorError();
return anyType;
}
- if (operator === 60) {
+ if (operator === 61) {
checkAssignmentOperator(resultType);
}
return resultType;
@@ -43878,19 +44622,13 @@
case 34:
case 35:
case 36:
- var leftIsLiteral = isLiteralType(leftType);
- var rightIsLiteral = isLiteralType(rightType);
- if (!leftIsLiteral || !rightIsLiteral) {
- leftType = leftIsLiteral ? getBaseTypeOfLiteralType(leftType) : leftType;
- rightType = rightIsLiteral ? getBaseTypeOfLiteralType(rightType) : rightType;
- }
if (!isTypeEqualityComparableTo(leftType, rightType) && !isTypeEqualityComparableTo(rightType, leftType)) {
reportOperatorError();
}
return booleanType;
- case 94:
+ case 95:
return checkInstanceOfExpression(left, right, leftType, rightType);
- case 93:
+ case 94:
return checkInExpression(left, right, leftType, rightType);
case 54:
return getTypeFacts(leftType) & 4194304 ?
@@ -43900,7 +44638,7 @@
return getTypeFacts(leftType) & 8388608 ?
getUnionType([removeDefinitelyFalsyTypes(leftType), rightType], 2) :
leftType;
- case 59:
+ case 60:
var declKind = ts.isBinaryExpression(left.parent) ? ts.getAssignmentDeclarationKind(left.parent) : 0;
checkAssignmentDeclaration(declKind, rightType);
if (isAssignmentDeclaration(declKind)) {
@@ -43943,7 +44681,7 @@
}
}
function isEvalNode(node) {
- return node.kind === 72 && node.escapedText === "eval";
+ return node.kind === 73 && node.escapedText === "eval";
}
function checkForDisallowedESSymbolOperand(operator) {
var offendingSymbolOperand = maybeTypeOfKind(leftType, 12288) ? left :
@@ -43958,13 +44696,13 @@
function getSuggestedBooleanOperator(operator) {
switch (operator) {
case 50:
- case 70:
+ case 71:
return 55;
case 51:
- case 71:
+ case 72:
return 36;
case 49:
- case 69:
+ case 70:
return 54;
default:
return undefined;
@@ -43996,8 +44734,7 @@
}
}
function reportOperatorError() {
- var leftStr = typeToString(leftType);
- var rightStr = typeToString(rightType);
+ var _a = getTypeNamesForErrorDisplay(leftType, rightType), leftStr = _a[0], rightStr = _a[1];
var errNode = errorNode || operatorToken;
if (!tryGiveBetterPrimaryError(errNode, leftStr, rightStr)) {
error(errNode, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, ts.tokenToString(operatorToken.kind), leftStr, rightStr);
@@ -44048,7 +44785,7 @@
}
if (node.asteriskToken) {
if ((functionFlags & 3) === 3 &&
- languageVersion < 7) {
+ languageVersion < 8) {
checkExternalEmitHelpers(node, 26624);
}
if ((functionFlags & 3) === 1 &&
@@ -44080,7 +44817,7 @@
return stringType;
}
function getContextNode(node) {
- if (node.kind === 268 && !ts.isJsxSelfClosingElement(node.parent)) {
+ if (node.kind === 269 && !ts.isJsxSelfClosingElement(node.parent)) {
return node.parent.parent;
}
return node;
@@ -44113,7 +44850,7 @@
}
function isTypeAssertion(node) {
node = ts.skipParentheses(node);
- return node.kind === 194 || node.kind === 212;
+ return node.kind === 195 || node.kind === 213;
}
function checkDeclarationInitializer(declaration) {
var initializer = ts.getEffectiveInitializer(declaration);
@@ -44141,7 +44878,7 @@
return ts.some(types, function (t) { return isLiteralOfContextualType(candidateType, t); });
}
if (contextualType.flags & 58982400) {
- var constraint = getBaseConstraintOfType(contextualType) || emptyObjectType;
+ var constraint = getBaseConstraintOfType(contextualType) || unknownType;
return maybeTypeOfKind(constraint, 4) && maybeTypeOfKind(candidateType, 128) ||
maybeTypeOfKind(constraint, 8) && maybeTypeOfKind(candidateType, 256) ||
maybeTypeOfKind(constraint, 64) && maybeTypeOfKind(candidateType, 2048) ||
@@ -44169,14 +44906,14 @@
getWidenedLiteralLikeTypeForContextualType(type, instantiateContextualType(arguments.length === 2 ? getContextualType(node) : contextualType, node));
}
function checkPropertyAssignment(node, checkMode) {
- if (node.name.kind === 149) {
+ if (node.name.kind === 150) {
checkComputedPropertyName(node.name);
}
return checkExpressionForMutableLocation(node.initializer, checkMode);
}
function checkObjectLiteralMethod(node, checkMode) {
checkGrammarMethod(node);
- if (node.name.kind === 149) {
+ if (node.name.kind === 150) {
checkComputedPropertyName(node.name);
}
var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, checkMode);
@@ -44184,18 +44921,21 @@
}
function instantiateTypeWithSingleGenericCallSignature(node, type, checkMode) {
if (checkMode && checkMode & (2 | 8)) {
- var signature = getSingleCallSignature(type);
+ var callSignature = getSingleSignature(type, 0, true);
+ var constructSignature = getSingleSignature(type, 1, true);
+ var signature = callSignature || constructSignature;
if (signature && signature.typeParameters) {
+ var contextualType = getApparentTypeOfContextualType(node);
+ if (contextualType && !isMixinConstructorType(contextualType)) {
+ var contextualSignature = getSingleSignature(getNonNullableType(contextualType), callSignature ? 0 : 1, false);
+ if (contextualSignature && !contextualSignature.typeParameters) {
if (checkMode & 8) {
skippedGenericFunction(node, checkMode);
return anyFunctionType;
}
- var contextualType = getApparentTypeOfContextualType(node);
- if (contextualType) {
- var contextualSignature = getSingleCallSignature(getNonNullableType(contextualType));
- if (contextualSignature && !contextualSignature.typeParameters) {
var context = getInferenceContext(node);
- var returnSignature = context.signature && getSingleCallSignature(getReturnTypeOfSignature(context.signature));
+ var returnType = context.signature && getReturnTypeOfSignature(context.signature);
+ var returnSignature = returnType && getSingleCallOrConstructSignature(returnType);
if (returnSignature && !returnSignature.typeParameters && !ts.every(context.inferences, hasInferenceCandidates)) {
var uniqueTypeParameters = getUniqueTypeParameters(context, signature.typeParameters);
var instantiatedSignature = getSignatureInstantiationWithoutFillingInTypeArguments(signature, uniqueTypeParameters);
@@ -44291,7 +45031,7 @@
}
function getTypeOfExpression(node, cache) {
var expr = ts.skipParentheses(node);
- if (expr.kind === 191 && expr.expression.kind !== 98 && !ts.isRequireCall(expr, true) && !isSymbolOrSymbolForCall(expr)) {
+ if (expr.kind === 192 && expr.expression.kind !== 99 && !ts.isRequireCall(expr, true) && !isSymbolOrSymbolForCall(expr)) {
var funcType = checkNonNullExpression(expr.expression);
var signature = getSingleCallSignature(funcType);
if (signature && !signature.typeParameters) {
@@ -44326,10 +45066,10 @@
return type;
}
function checkConstEnumAccess(node, type) {
- var ok = (node.parent.kind === 189 && node.parent.expression === node) ||
- (node.parent.kind === 190 && node.parent.expression === node) ||
- ((node.kind === 72 || node.kind === 148) && isInRightSideOfImportOrExportAssignment(node) ||
- (node.parent.kind === 167 && node.parent.exprName === node));
+ var ok = (node.parent.kind === 190 && node.parent.expression === node) ||
+ (node.parent.kind === 191 && node.parent.expression === node) ||
+ ((node.kind === 73 || node.kind === 149) && isInRightSideOfImportOrExportAssignment(node) ||
+ (node.parent.kind === 168 && node.parent.exprName === node));
if (!ok) {
error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query);
}
@@ -44350,13 +45090,13 @@
}
function checkExpressionWorker(node, checkMode, forceTuple) {
switch (node.kind) {
- case 72:
+ case 73:
return checkIdentifier(node);
- case 100:
+ case 101:
return checkThisExpression(node);
- case 98:
+ case 99:
return checkSuperExpression(node);
- case 96:
+ case 97:
return nullWideningType;
case 14:
case 10:
@@ -44367,81 +45107,81 @@
case 9:
checkGrammarBigIntLiteral(node);
return getFreshTypeOfLiteralType(getBigIntLiteralType(node));
- case 102:
+ case 103:
return trueType;
- case 87:
+ case 88:
return falseType;
- case 206:
+ case 207:
return checkTemplateExpression(node);
case 13:
return globalRegExpType;
- case 187:
- return checkArrayLiteral(node, checkMode, forceTuple);
case 188:
- return checkObjectLiteral(node, checkMode);
+ return checkArrayLiteral(node, checkMode, forceTuple);
case 189:
+ return checkObjectLiteral(node, checkMode);
+ case 190:
return checkPropertyAccessExpression(node);
- case 148:
+ case 149:
return checkQualifiedName(node);
- case 190:
- return checkIndexedAccess(node);
case 191:
- if (node.expression.kind === 92) {
+ return checkIndexedAccess(node);
+ case 192:
+ if (node.expression.kind === 93) {
return checkImportCallExpression(node);
}
- case 192:
- return checkCallExpression(node, checkMode);
case 193:
+ return checkCallExpression(node, checkMode);
+ case 194:
return checkTaggedTemplateExpression(node);
- case 195:
+ case 196:
return checkParenthesizedExpression(node, checkMode);
- case 209:
+ case 210:
return checkClassExpression(node);
- case 196:
case 197:
+ case 198:
return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode);
- case 199:
+ case 200:
return checkTypeOfExpression(node);
- case 194:
- case 212:
- return checkAssertion(node);
+ case 195:
case 213:
- return checkNonNullAssertion(node);
+ return checkAssertion(node);
case 214:
+ return checkNonNullAssertion(node);
+ case 215:
return checkMetaProperty(node);
- case 198:
+ case 199:
return checkDeleteExpression(node);
- case 200:
- return checkVoidExpression(node);
case 201:
- return checkAwaitExpression(node);
+ return checkVoidExpression(node);
case 202:
- return checkPrefixUnaryExpression(node);
+ return checkAwaitExpression(node);
case 203:
- return checkPostfixUnaryExpression(node);
+ return checkPrefixUnaryExpression(node);
case 204:
- return checkBinaryExpression(node, checkMode);
+ return checkPostfixUnaryExpression(node);
case 205:
+ return checkBinaryExpression(node, checkMode);
+ case 206:
return checkConditionalExpression(node, checkMode);
- case 208:
+ case 209:
return checkSpreadExpression(node, checkMode);
- case 210:
+ case 211:
return undefinedWideningType;
- case 207:
+ case 208:
return checkYieldExpression(node);
- case 215:
+ case 216:
return node.type;
- case 270:
+ case 271:
return checkJsxExpression(node, checkMode);
- case 260:
- return checkJsxElement(node, checkMode);
case 261:
+ return checkJsxElement(node, checkMode);
+ case 262:
return checkJsxSelfClosingElement(node, checkMode);
- case 264:
+ case 265:
return checkJsxFragment(node);
- case 268:
+ case 269:
return checkJsxAttributes(node, checkMode);
- case 262:
+ case 263:
ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement");
}
return errorType;
@@ -44460,7 +45200,7 @@
var constraintType = getConstraintOfTypeParameter(typeParameter);
var defaultType = getDefaultFromTypeParameter(typeParameter);
if (constraintType && defaultType) {
- checkTypeAssignableTo(defaultType, getTypeWithThisArgument(constraintType, defaultType), node.default, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1);
+ checkTypeAssignableTo(defaultType, getTypeWithThisArgument(instantiateType(constraintType, makeUnaryTypeMapper(typeParameter, defaultType)), defaultType), node.default, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1);
}
if (produceDiagnostics) {
checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0);
@@ -44471,7 +45211,7 @@
checkVariableLikeDeclaration(node);
var func = ts.getContainingFunction(node);
if (ts.hasModifier(node, 92)) {
- if (!(func.kind === 157 && ts.nodeIsPresent(func.body))) {
+ if (!(func.kind === 158 && ts.nodeIsPresent(func.body))) {
error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation);
}
}
@@ -44482,10 +45222,10 @@
if (func.parameters.indexOf(node) !== 0) {
error(node, ts.Diagnostics.A_0_parameter_must_be_the_first_parameter, node.name.escapedText);
}
- if (func.kind === 157 || func.kind === 161 || func.kind === 166) {
+ if (func.kind === 158 || func.kind === 162 || func.kind === 167) {
error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter);
}
- if (func.kind === 197) {
+ if (func.kind === 198) {
error(node, ts.Diagnostics.An_arrow_function_cannot_have_a_this_parameter);
}
}
@@ -44537,13 +45277,13 @@
}
function getTypePredicateParent(node) {
switch (node.parent.kind) {
+ case 198:
+ case 161:
+ case 240:
case 197:
- case 160:
- case 239:
- case 196:
- case 165:
+ case 166:
+ case 157:
case 156:
- case 155:
var parent = node.parent;
if (node === parent.type) {
return parent;
@@ -44557,11 +45297,11 @@
continue;
}
var name = element.name;
- if (name.kind === 72 && name.escapedText === predicateVariableName) {
+ if (name.kind === 73 && name.escapedText === predicateVariableName) {
error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName);
return true;
}
- else if (name.kind === 185 || name.kind === 184) {
+ else if (name.kind === 186 || name.kind === 185) {
if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) {
return true;
}
@@ -44569,17 +45309,17 @@
}
}
function checkSignatureDeclaration(node) {
- if (node.kind === 162) {
+ if (node.kind === 163) {
checkGrammarIndexSignature(node);
}
- else if (node.kind === 165 || node.kind === 239 || node.kind === 166 ||
- node.kind === 160 || node.kind === 157 ||
- node.kind === 161) {
+ else if (node.kind === 166 || node.kind === 240 || node.kind === 167 ||
+ node.kind === 161 || node.kind === 158 ||
+ node.kind === 162) {
checkGrammarFunctionLikeDeclaration(node);
}
var functionFlags = ts.getFunctionFlags(node);
if (!(functionFlags & 4)) {
- if ((functionFlags & 3) === 3 && languageVersion < 7) {
+ if ((functionFlags & 3) === 3 && languageVersion < 8) {
checkExternalEmitHelpers(node, 6144);
}
if ((functionFlags & 3) === 2 && languageVersion < 4) {
@@ -44599,10 +45339,10 @@
var returnTypeNode = ts.getEffectiveReturnTypeNode(node);
if (noImplicitAny && !returnTypeNode) {
switch (node.kind) {
- case 161:
+ case 162:
error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);
break;
- case 160:
+ case 161:
error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);
break;
}
@@ -44626,7 +45366,7 @@
checkAsyncFunctionReturnType(node, returnTypeNode);
}
}
- if (node.kind !== 162 && node.kind !== 294) {
+ if (node.kind !== 163 && node.kind !== 295) {
registerForUnusedIdentifiersCheck(node);
}
}
@@ -44636,7 +45376,7 @@
var staticNames = ts.createUnderscoreEscapedMap();
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
- if (member.kind === 157) {
+ if (member.kind === 158) {
for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) {
var param = _c[_b];
if (ts.isParameterPropertyDeclaration(param) && !ts.isBindingPattern(param.name)) {
@@ -44651,16 +45391,16 @@
var memberName = name && ts.getPropertyNameForPropertyNameNode(name);
if (name && memberName) {
switch (member.kind) {
- case 158:
+ case 159:
addName(names, name, memberName, 1);
break;
- case 159:
+ case 160:
addName(names, name, memberName, 2);
break;
- case 154:
+ case 155:
addName(names, name, memberName, 3);
break;
- case 156:
+ case 157:
addName(names, name, memberName, 4);
break;
}
@@ -44712,7 +45452,7 @@
var names = ts.createMap();
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
- if (member.kind === 153) {
+ if (member.kind === 154) {
var memberName = void 0;
var name = member.name;
switch (name.kind) {
@@ -44720,7 +45460,7 @@
case 8:
memberName = name.text;
break;
- case 72:
+ case 73:
memberName = ts.idText(name);
break;
default:
@@ -44737,7 +45477,7 @@
}
}
function checkTypeForDuplicateIndexSignatures(node) {
- if (node.kind === 241) {
+ if (node.kind === 242) {
var nodeSymbol = getSymbolOfNode(node);
if (nodeSymbol.declarations.length > 0 && nodeSymbol.declarations[0] !== node) {
return;
@@ -44752,7 +45492,7 @@
var declaration = decl;
if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
switch (declaration.parameters[0].type.kind) {
- case 138:
+ case 139:
if (!seenStringIndexer) {
seenStringIndexer = true;
}
@@ -44760,7 +45500,7 @@
error(declaration, ts.Diagnostics.Duplicate_string_index_signature);
}
break;
- case 135:
+ case 136:
if (!seenNumericIndexer) {
seenNumericIndexer = true;
}
@@ -44782,7 +45522,7 @@
if (!checkGrammarMethod(node))
checkGrammarComputedPropertyName(node.name);
checkFunctionOrMethodDeclaration(node);
- if (ts.hasModifier(node, 128) && node.kind === 156 && node.body) {
+ if (ts.hasModifier(node, 128) && node.kind === 157 && node.body) {
error(node, ts.Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, ts.declarationNameToString(node.name));
}
}
@@ -44803,7 +45543,7 @@
return;
}
function isInstancePropertyWithInitializer(n) {
- return n.kind === 154 &&
+ return n.kind === 155 &&
!ts.hasModifier(n, 32) &&
!!n.initializer;
}
@@ -44823,7 +45563,7 @@
var superCallStatement = void 0;
for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) {
var statement = statements_2[_i];
- if (statement.kind === 221 && ts.isSuperCall(statement.expression)) {
+ if (statement.kind === 222 && ts.isSuperCall(statement.expression)) {
superCallStatement = statement;
break;
}
@@ -44847,18 +45587,18 @@
checkGrammarComputedPropertyName(node.name);
checkDecorators(node);
checkSignatureDeclaration(node);
- if (node.kind === 158) {
+ if (node.kind === 159) {
if (!(node.flags & 4194304) && ts.nodeIsPresent(node.body) && (node.flags & 128)) {
if (!(node.flags & 256)) {
error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value);
}
}
}
- if (node.name.kind === 149) {
+ if (node.name.kind === 150) {
checkComputedPropertyName(node.name);
}
if (!hasNonBindableDynamicName(node)) {
- var otherKind = node.kind === 158 ? 159 : 158;
+ var otherKind = node.kind === 159 ? 160 : 159;
var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(node), otherKind);
if (otherAccessor) {
var nodeFlags = ts.getModifierFlags(node);
@@ -44874,7 +45614,7 @@
}
}
var returnType = getTypeOfAccessors(getSymbolOfNode(node));
- if (node.kind === 158) {
+ if (node.kind === 159) {
checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType);
}
}
@@ -44922,7 +45662,7 @@
}
function checkTypeReferenceNode(node) {
checkGrammarTypeArguments(node, node.typeArguments);
- if (node.kind === 164 && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) {
+ if (node.kind === 165 && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) {
grammarErrorAtPos(node, node.typeName.jsdocDotPos, 1, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments);
}
var type = getTypeFromTypeReference(node);
@@ -44969,7 +45709,7 @@
var seenOptionalElement = false;
for (var i = 0; i < elementTypes.length; i++) {
var e = elementTypes[i];
- if (e.kind === 172) {
+ if (e.kind === 173) {
if (i !== elementTypes.length - 1) {
grammarErrorOnNode(e, ts.Diagnostics.A_rest_element_must_be_last_in_a_tuple_type);
break;
@@ -44978,7 +45718,7 @@
error(e, ts.Diagnostics.A_rest_element_type_must_be_an_array_type);
}
}
- else if (e.kind === 171) {
+ else if (e.kind === 172) {
seenOptionalElement = true;
}
else if (seenOptionalElement) {
@@ -44998,7 +45738,7 @@
var objectType = type.objectType;
var indexType = type.indexType;
if (isTypeAssignableTo(indexType, getIndexType(objectType, false))) {
- if (accessNode.kind === 190 && ts.isAssignmentTarget(accessNode) &&
+ if (accessNode.kind === 191 && ts.isAssignmentTarget(accessNode) &&
ts.getObjectFlags(objectType) & 32 && getMappedTypeModifiers(objectType) & 1) {
error(accessNode, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
}
@@ -45008,7 +45748,7 @@
return type;
}
error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType));
- return type;
+ return errorType;
}
function checkIndexedAccessType(node) {
checkSourceElement(node.objectType);
@@ -45036,7 +45776,7 @@
ts.forEachChild(node, checkSourceElement);
}
function checkInferType(node) {
- if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 175 && n.parent.extendsType === n; })) {
+ if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 176 && n.parent.extendsType === n; })) {
grammarErrorOnNode(node, ts.Diagnostics.infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type);
}
checkSourceElement(node.typeParameter);
@@ -45051,9 +45791,9 @@
}
function getEffectiveDeclarationFlags(n, flagsToCheck) {
var flags = ts.getCombinedModifierFlags(n);
- if (n.parent.kind !== 241 &&
- n.parent.kind !== 240 &&
- n.parent.kind !== 209 &&
+ if (n.parent.kind !== 242 &&
+ n.parent.kind !== 241 &&
+ n.parent.kind !== 210 &&
n.flags & 4194304) {
if (!(flags & 2) && !(ts.isModuleBlock(n.parent) && ts.isModuleDeclaration(n.parent.parent) && ts.isGlobalScopeAugmentation(n.parent.parent))) {
flags |= 1;
@@ -45133,7 +45873,7 @@
if (node.name && subsequentName &&
(ts.isComputedPropertyName(node.name) && ts.isComputedPropertyName(subsequentName) ||
!ts.isComputedPropertyName(node.name) && !ts.isComputedPropertyName(subsequentName) && ts.getEscapedTextOfIdentifierOrLiteral(node.name) === ts.getEscapedTextOfIdentifierOrLiteral(subsequentName))) {
- var reportError = (node.kind === 156 || node.kind === 155) &&
+ var reportError = (node.kind === 157 || node.kind === 156) &&
ts.hasModifier(node, 32) !== ts.hasModifier(subsequentNode, 32);
if (reportError) {
var diagnostic = ts.hasModifier(node, 32) ? ts.Diagnostics.Function_overload_must_be_static : ts.Diagnostics.Function_overload_must_not_be_static;
@@ -45166,11 +45906,11 @@
var current = declarations_4[_i];
var node = current;
var inAmbientContext = node.flags & 4194304;
- var inAmbientContextOrInterface = node.parent.kind === 241 || node.parent.kind === 168 || inAmbientContext;
+ var inAmbientContextOrInterface = node.parent.kind === 242 || node.parent.kind === 169 || inAmbientContext;
if (inAmbientContextOrInterface) {
previousDeclaration = undefined;
}
- if (node.kind === 239 || node.kind === 156 || node.kind === 155 || node.kind === 157) {
+ if (node.kind === 240 || node.kind === 157 || node.kind === 156 || node.kind === 158) {
var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck);
someNodeFlags |= currentNodeFlags;
allNodeFlags &= currentNodeFlags;
@@ -45283,39 +46023,39 @@
function getDeclarationSpaces(decl) {
var d = decl;
switch (d.kind) {
- case 241:
case 242:
- case 309:
- case 302:
+ case 243:
+ case 310:
+ case 303:
return 2;
- case 244:
+ case 245:
return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0
? 4 | 1
: 4;
- case 240:
- case 243:
+ case 241:
+ case 244:
return 2 | 1;
- case 284:
+ case 285:
return 2 | 1 | 4;
- case 254:
+ case 255:
if (!ts.isEntityNameExpression(d.expression)) {
return 1;
}
d = d.expression;
- case 248:
+ case 249:
+ case 252:
case 251:
- case 250:
- var result_5 = 0;
+ var result_7 = 0;
var target = resolveAlias(getSymbolOfNode(d));
- ts.forEach(target.declarations, function (d) { result_5 |= getDeclarationSpaces(d); });
- return result_5;
- case 237:
- case 186:
- case 239:
- case 253:
+ ts.forEach(target.declarations, function (d) { result_7 |= getDeclarationSpaces(d); });
+ return result_7;
+ case 238:
+ case 187:
+ case 240:
+ case 254:
return 1;
default:
- return ts.Debug.fail(ts.Debug.showSyntaxKind(d));
+ return ts.Debug.failBadSyntaxKind(d);
}
}
}
@@ -45432,7 +46172,7 @@
var promiseConstructorSymbol = resolveEntityName(promiseConstructorName, 67220415, true);
var promiseConstructorType = promiseConstructorSymbol ? getTypeOfSymbol(promiseConstructorSymbol) : errorType;
if (promiseConstructorType === errorType) {
- if (promiseConstructorName.kind === 72 && promiseConstructorName.escapedText === "Promise" && getTargetType(returnType) === getGlobalPromiseType(false)) {
+ if (promiseConstructorName.kind === 73 && promiseConstructorName.escapedText === "Promise" && getTargetType(returnType) === getGlobalPromiseType(false)) {
error(returnTypeNode, ts.Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option);
}
else {
@@ -45467,22 +46207,22 @@
var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node);
var errorInfo;
switch (node.parent.kind) {
- case 240:
+ case 241:
var classSymbol = getSymbolOfNode(node.parent);
var classConstructorType = getTypeOfSymbol(classSymbol);
expectedReturnType = getUnionType([classConstructorType, voidType]);
break;
- case 151:
+ case 152:
expectedReturnType = voidType;
errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any);
break;
- case 154:
+ case 155:
expectedReturnType = voidType;
errorInfo = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any);
break;
- case 156:
- case 158:
+ case 157:
case 159:
+ case 160:
var methodType = getTypeOfNode(node.parent);
var descriptorType = createTypedPropertyDescriptorType(methodType);
expectedReturnType = getUnionType([descriptorType, voidType]);
@@ -45499,7 +46239,7 @@
if (!typeName)
return;
var rootName = getFirstIdentifier(typeName);
- var meaning = (typeName.kind === 72 ? 67897832 : 1920) | 2097152;
+ var meaning = (typeName.kind === 73 ? 67897832 : 1920) | 2097152;
var rootSymbol = resolveName(rootName, rootName.escapedText, meaning, undefined, undefined, true);
if (rootSymbol
&& rootSymbol.flags & 2097152
@@ -45517,29 +46257,29 @@
function getEntityNameForDecoratorMetadata(node) {
if (node) {
switch (node.kind) {
+ case 175:
case 174:
- case 173:
return getEntityNameForDecoratorMetadataFromTypeList(node.types);
- case 175:
+ case 176:
return getEntityNameForDecoratorMetadataFromTypeList([node.trueType, node.falseType]);
- case 177:
+ case 178:
return getEntityNameForDecoratorMetadata(node.type);
- case 164:
+ case 165:
return node.typeName;
}
}
}
function getEntityNameForDecoratorMetadataFromTypeList(types) {
var commonEntityName;
- for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
- var typeNode = types_17[_i];
- while (typeNode.kind === 177) {
+ for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
+ var typeNode = types_16[_i];
+ while (typeNode.kind === 178) {
typeNode = typeNode.type;
}
- if (typeNode.kind === 132) {
+ if (typeNode.kind === 133) {
continue;
}
- if (!strictNullChecks && (typeNode.kind === 96 || typeNode.kind === 141)) {
+ if (!strictNullChecks && (typeNode.kind === 97 || typeNode.kind === 142)) {
continue;
}
var individualEntityName = getEntityNameForDecoratorMetadata(typeNode);
@@ -45571,17 +46311,17 @@
return;
}
if (!compilerOptions.experimentalDecorators) {
- error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning);
+ error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning);
}
var firstDecorator = node.decorators[0];
checkExternalEmitHelpers(firstDecorator, 8);
- if (node.kind === 151) {
+ if (node.kind === 152) {
checkExternalEmitHelpers(firstDecorator, 32);
}
if (compilerOptions.emitDecoratorMetadata) {
checkExternalEmitHelpers(firstDecorator, 16);
switch (node.kind) {
- case 240:
+ case 241:
var constructor = ts.getFirstConstructorWithBody(node);
if (constructor) {
for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) {
@@ -45590,23 +46330,23 @@
}
}
break;
- case 158:
case 159:
- var otherKind = node.kind === 158 ? 159 : 158;
+ case 160:
+ var otherKind = node.kind === 159 ? 160 : 159;
var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(node), otherKind);
markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor));
break;
- case 156:
+ case 157:
for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) {
var parameter = _c[_b];
markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
}
markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveReturnTypeNode(node));
break;
- case 154:
+ case 155:
markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveTypeAnnotationNode(node));
break;
- case 151:
+ case 152:
markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node));
var containingSignature = node.parent;
for (var _d = 0, _e = containingSignature.parameters; _d < _e.length; _d++) {
@@ -45665,7 +46405,7 @@
else if (ts.findLast(ts.getJSDocTags(decl), ts.isJSDocParameterTag) === node &&
node.typeExpression && node.typeExpression.type &&
!isArrayType(getTypeFromTypeNode(node.typeExpression.type))) {
- error(node.name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_had_an_array_type, ts.idText(node.name.kind === 148 ? node.name.right : node.name));
+ error(node.name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_had_an_array_type, ts.idText(node.name.kind === 149 ? node.name.right : node.name));
}
}
}
@@ -45698,9 +46438,9 @@
}
function getIdentifierFromEntityNameExpression(node) {
switch (node.kind) {
- case 72:
+ case 73:
return node;
- case 189:
+ case 190:
return node.name;
default:
return undefined;
@@ -45710,7 +46450,7 @@
checkDecorators(node);
checkSignatureDeclaration(node);
var functionFlags = ts.getFunctionFlags(node);
- if (node.name && node.name.kind === 149) {
+ if (node.name && node.name.kind === 150) {
checkComputedPropertyName(node.name);
}
if (!hasNonBindableDynamicName(node)) {
@@ -45726,7 +46466,7 @@
}
}
}
- var body = node.kind === 155 ? undefined : node.body;
+ var body = node.kind === 156 ? undefined : node.body;
checkSourceElement(body);
if ((functionFlags & 1) === 0) {
var returnOrPromisedType = getReturnOrPromisedType(node, functionFlags);
@@ -45762,42 +46502,42 @@
for (var _i = 0, potentiallyUnusedIdentifiers_1 = potentiallyUnusedIdentifiers; _i < potentiallyUnusedIdentifiers_1.length; _i++) {
var node = potentiallyUnusedIdentifiers_1[_i];
switch (node.kind) {
- case 240:
- case 209:
+ case 241:
+ case 210:
checkUnusedClassMembers(node, addDiagnostic);
checkUnusedTypeParameters(node, addDiagnostic);
break;
- case 284:
- case 244:
- case 218:
- case 246:
- case 225:
+ case 285:
+ case 245:
+ case 219:
+ case 247:
case 226:
case 227:
+ case 228:
checkUnusedLocalsAndParameters(node, addDiagnostic);
break;
- case 157:
- case 196:
- case 239:
- case 197:
- case 156:
case 158:
+ case 197:
+ case 240:
+ case 198:
+ case 157:
case 159:
+ case 160:
if (node.body) {
checkUnusedLocalsAndParameters(node, addDiagnostic);
}
checkUnusedTypeParameters(node, addDiagnostic);
break;
- case 155:
- case 160:
+ case 156:
case 161:
- case 165:
+ case 162:
case 166:
+ case 167:
+ case 243:
case 242:
- case 241:
checkUnusedTypeParameters(node, addDiagnostic);
break;
- case 176:
+ case 177:
checkUnusedInferTypeParameter(node, addDiagnostic);
break;
default:
@@ -45817,11 +46557,11 @@
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
switch (member.kind) {
- case 156:
- case 154:
- case 158:
+ case 157:
+ case 155:
case 159:
- if (member.kind === 159 && member.symbol.flags & 32768) {
+ case 160:
+ if (member.kind === 160 && member.symbol.flags & 32768) {
break;
}
var symbol = getSymbolOfNode(member);
@@ -45829,7 +46569,7 @@
addDiagnostic(member, 0, ts.createDiagnosticForNode(member.name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, symbolToString(symbol)));
}
break;
- case 157:
+ case 158:
for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) {
var parameter = _c[_b];
if (!parameter.symbol.isReferenced && ts.hasModifier(parameter, 8)) {
@@ -45837,8 +46577,8 @@
}
}
break;
- case 162:
- case 217:
+ case 163:
+ case 218:
break;
default:
ts.Debug.fail();
@@ -45862,7 +46602,7 @@
continue;
var name = ts.idText(typeParameter.name);
var parent = typeParameter.parent;
- if (parent.kind !== 176 && parent.typeParameters.every(isTypeParameterUnused)) {
+ if (parent.kind !== 177 && parent.typeParameters.every(isTypeParameterUnused)) {
if (seenParentsWithEveryUnused.tryAdd(parent)) {
var range = ts.isJSDocTemplateTag(parent)
? ts.rangeOfNode(parent)
@@ -45941,7 +46681,7 @@
var importDecl = importClause.parent;
var nDeclarations = (importClause.name ? 1 : 0) +
(importClause.namedBindings ?
- (importClause.namedBindings.kind === 251 ? 1 : importClause.namedBindings.elements.length)
+ (importClause.namedBindings.kind === 252 ? 1 : importClause.namedBindings.elements.length)
: 0);
if (nDeclarations === unuseds.length) {
addDiagnostic(importDecl, 0, unuseds.length === 1
@@ -45959,7 +46699,7 @@
var bindingPattern = _a[0], bindingElements = _a[1];
var kind = tryGetRootParameterDeclaration(bindingPattern.parent) ? 1 : 0;
if (bindingPattern.elements.length === bindingElements.length) {
- if (bindingElements.length === 1 && bindingPattern.parent.kind === 237 && bindingPattern.parent.parent.kind === 238) {
+ if (bindingElements.length === 1 && bindingPattern.parent.kind === 238 && bindingPattern.parent.parent.kind === 239) {
addToGroup(unusedVariables, bindingPattern.parent.parent, bindingPattern.parent, getNodeId);
}
else {
@@ -45980,7 +46720,7 @@
if (declarationList.declarations.length === declarations.length) {
addDiagnostic(declarationList, 0, declarations.length === 1
? ts.createDiagnosticForNode(ts.first(declarations).name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(ts.first(declarations).name))
- : ts.createDiagnosticForNode(declarationList.parent.kind === 219 ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused));
+ : ts.createDiagnosticForNode(declarationList.parent.kind === 220 ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused));
}
else {
for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) {
@@ -45992,23 +46732,23 @@
}
function bindingNameText(name) {
switch (name.kind) {
- case 72:
+ case 73:
return ts.idText(name);
+ case 186:
case 185:
- case 184:
return bindingNameText(ts.cast(ts.first(name.elements), ts.isBindingElement).name);
default:
return ts.Debug.assertNever(name);
}
}
function isImportedDeclaration(node) {
- return node.kind === 250 || node.kind === 253 || node.kind === 251;
+ return node.kind === 251 || node.kind === 254 || node.kind === 252;
}
function importClauseFromImported(decl) {
- return decl.kind === 250 ? decl : decl.kind === 251 ? decl.parent : decl.parent.parent;
+ return decl.kind === 251 ? decl : decl.kind === 252 ? decl.parent : decl.parent.parent;
}
function checkBlock(node) {
- if (node.kind === 218) {
+ if (node.kind === 219) {
checkGrammarStatementInAmbientContext(node);
}
if (ts.isFunctionOrModuleBlock(node)) {
@@ -46037,19 +46777,19 @@
if (!(identifier && identifier.escapedText === name)) {
return false;
}
- if (node.kind === 154 ||
- node.kind === 153 ||
+ if (node.kind === 155 ||
+ node.kind === 154 ||
+ node.kind === 157 ||
node.kind === 156 ||
- node.kind === 155 ||
- node.kind === 158 ||
- node.kind === 159) {
+ node.kind === 159 ||
+ node.kind === 160) {
return false;
}
if (node.flags & 4194304) {
return false;
}
var root = ts.getRootDeclaration(node);
- if (root.kind === 151 && ts.nodeIsMissing(root.parent.body)) {
+ if (root.kind === 152 && ts.nodeIsMissing(root.parent.body)) {
return false;
}
return true;
@@ -46057,7 +46797,7 @@
function checkIfThisIsCapturedInEnclosingScope(node) {
ts.findAncestor(node, function (current) {
if (getNodeCheckFlags(current) & 4) {
- var isDeclaration_1 = node.kind !== 72;
+ var isDeclaration_1 = node.kind !== 73;
if (isDeclaration_1) {
error(ts.getNameOfDeclaration(node), ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference);
}
@@ -46072,7 +46812,7 @@
function checkIfNewTargetIsCapturedInEnclosingScope(node) {
ts.findAncestor(node, function (current) {
if (getNodeCheckFlags(current) & 8) {
- var isDeclaration_2 = node.kind !== 72;
+ var isDeclaration_2 = node.kind !== 73;
if (isDeclaration_2) {
error(ts.getNameOfDeclaration(node), ts.Diagnostics.Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference);
}
@@ -46095,7 +46835,7 @@
return;
}
var parent = getDeclarationContainer(node);
- if (parent.kind === 284 && ts.isExternalOrCommonJsModule(parent)) {
+ if (parent.kind === 285 && ts.isExternalOrCommonJsModule(parent)) {
error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name));
}
}
@@ -46107,7 +46847,7 @@
return;
}
var parent = getDeclarationContainer(node);
- if (parent.kind === 284 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024) {
+ if (parent.kind === 285 && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024) {
error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name));
}
}
@@ -46115,7 +46855,7 @@
if ((ts.getCombinedNodeFlags(node) & 3) !== 0 || ts.isParameterDeclaration(node)) {
return;
}
- if (node.kind === 237 && !node.initializer) {
+ if (node.kind === 238 && !node.initializer) {
return;
}
var symbol = getSymbolOfNode(node);
@@ -46127,15 +46867,15 @@
localDeclarationSymbol !== symbol &&
localDeclarationSymbol.flags & 2) {
if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3) {
- var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 238);
- var container = varDeclList.parent.kind === 219 && varDeclList.parent.parent
+ var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 239);
+ var container = varDeclList.parent.kind === 220 && varDeclList.parent.parent
? varDeclList.parent.parent
: undefined;
var namesShareScope = container &&
- (container.kind === 218 && ts.isFunctionLike(container.parent) ||
+ (container.kind === 219 && ts.isFunctionLike(container.parent) ||
+ container.kind === 246 ||
container.kind === 245 ||
- container.kind === 244 ||
- container.kind === 284);
+ container.kind === 285);
if (!namesShareScope) {
var name = symbolToString(localDeclarationSymbol);
error(node, ts.Diagnostics.Cannot_initialize_outer_scoped_variable_0_in_the_same_scope_as_block_scoped_declaration_1, name, name);
@@ -46144,55 +46884,6 @@
}
}
}
- function checkParameterInitializer(node) {
- if (ts.getRootDeclaration(node).kind !== 151) {
- return;
- }
- var func = ts.getContainingFunction(node);
- visit(node.initializer);
- function visit(n) {
- if (ts.isTypeNode(n) || ts.isDeclarationName(n)) {
- return;
- }
- if (n.kind === 189) {
- return visit(n.expression);
- }
- else if (n.kind === 72) {
- var symbol = resolveName(n, n.escapedText, 67220415 | 2097152, undefined, undefined, false);
- if (!symbol || symbol === unknownSymbol || !symbol.valueDeclaration) {
- return;
- }
- if (symbol.valueDeclaration === node) {
- error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name));
- return;
- }
- var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration);
- if (enclosingContainer === func) {
- if (symbol.valueDeclaration.kind === 151 ||
- symbol.valueDeclaration.kind === 186) {
- if (symbol.valueDeclaration.pos < node.pos) {
- return;
- }
- if (ts.findAncestor(n, function (current) {
- if (current === node.initializer) {
- return "quit";
- }
- return ts.isFunctionLike(current.parent) ||
- (current.parent.kind === 154 &&
- !(ts.hasModifier(current.parent, 32)) &&
- ts.isClassLike(current.parent.parent));
- })) {
- return;
- }
- }
- error(n, ts.Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(node.name), ts.declarationNameToString(n));
- }
- }
- else {
- return ts.forEachChild(n, visit);
- }
- }
- }
function convertAutoToAny(type) {
return type === autoType ? anyType : type === autoArrayType ? anyArrayType : type;
}
@@ -46204,17 +46895,17 @@
if (!node.name) {
return;
}
- if (node.name.kind === 149) {
+ if (node.name.kind === 150) {
checkComputedPropertyName(node.name);
if (node.initializer) {
checkExpressionCached(node.initializer);
}
}
- if (node.kind === 186) {
- if (node.parent.kind === 184 && languageVersion < 7) {
+ if (node.kind === 187) {
+ if (node.parent.kind === 185 && languageVersion < 8) {
checkExternalEmitHelpers(node, 4);
}
- if (node.propertyName && node.propertyName.kind === 149) {
+ if (node.propertyName && node.propertyName.kind === 150) {
checkComputedPropertyName(node.propertyName);
}
var parent = node.parent.parent;
@@ -46227,31 +46918,43 @@
var property = getPropertyOfType(parentType, nameText);
if (property) {
markPropertyAsReferenced(property, undefined, false);
- checkPropertyAccessibility(parent, !!parent.initializer && parent.initializer.kind === 98, parentType, property);
+ checkPropertyAccessibility(parent, !!parent.initializer && parent.initializer.kind === 99, parentType, property);
}
}
}
}
if (ts.isBindingPattern(node.name)) {
- if (node.name.kind === 185 && languageVersion < 2 && compilerOptions.downlevelIteration) {
+ if (node.name.kind === 186 && languageVersion < 2 && compilerOptions.downlevelIteration) {
checkExternalEmitHelpers(node, 512);
}
ts.forEach(node.name.elements, checkSourceElement);
}
- if (node.initializer && ts.getRootDeclaration(node).kind === 151 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) {
+ if (node.initializer && ts.getRootDeclaration(node).kind === 152 && ts.nodeIsMissing(ts.getContainingFunction(node).body)) {
error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation);
return;
}
if (ts.isBindingPattern(node.name)) {
- if (node.initializer && node.parent.parent.kind !== 226) {
+ var needCheckInitializer = node.initializer && node.parent.parent.kind !== 227;
+ var needCheckWidenedType = node.name.elements.length === 0;
+ if (needCheckInitializer || needCheckWidenedType) {
+ var widenedType = getWidenedTypeForVariableLikeDeclaration(node);
+ if (needCheckInitializer) {
var initializerType = checkExpressionCached(node.initializer);
- if (strictNullChecks && node.name.elements.length === 0) {
- checkNonNullType(initializerType, node);
+ if (strictNullChecks && needCheckWidenedType) {
+ checkNonNullNonVoidType(initializerType, node);
}
else {
checkTypeAssignableToAndOptionallyElaborate(initializerType, getWidenedTypeForVariableLikeDeclaration(node), node, node.initializer);
}
- checkParameterInitializer(node);
+ }
+ if (needCheckWidenedType) {
+ if (ts.isArrayBindingPattern(node.name)) {
+ checkIteratedTypeOrElementType(widenedType, node, false, false);
+ }
+ else if (strictNullChecks) {
+ checkNonNullNonVoidType(widenedType, node);
+ }
+ }
}
return;
}
@@ -46264,9 +46967,8 @@
ts.isObjectLiteralExpression(initializer) &&
(initializer.properties.length === 0 || ts.isPrototypeAccess(node.name)) &&
ts.hasEntries(symbol.exports);
- if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 226) {
+ if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 227) {
checkTypeAssignableToAndOptionallyElaborate(checkExpressionCached(initializer), type, node, initializer, undefined);
- checkParameterInitializer(node);
}
}
if (symbol.declarations.length > 1) {
@@ -46280,7 +46982,7 @@
if (type !== errorType && declarationType !== errorType &&
!isTypeIdenticalTo(type, declarationType) &&
!(symbol.flags & 67108864)) {
- errorNextVariableOrPropertyDeclarationMustHaveSameType(type, node, declarationType);
+ errorNextVariableOrPropertyDeclarationMustHaveSameType(symbol.valueDeclaration, type, node, declarationType);
}
if (node.initializer) {
checkTypeAssignableToAndOptionallyElaborate(checkExpressionCached(node.initializer), declarationType, node, node.initializer, undefined);
@@ -46289,25 +46991,29 @@
error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name));
}
}
- if (node.kind !== 154 && node.kind !== 153) {
+ if (node.kind !== 155 && node.kind !== 154) {
checkExportsOnMergedDeclarations(node);
- if (node.kind === 237 || node.kind === 186) {
+ if (node.kind === 238 || node.kind === 187) {
checkVarDeclaredNamesNotShadowed(node);
}
checkCollisionWithRequireExportsInGeneratedCode(node, node.name);
checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name);
}
}
- function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstType, nextDeclaration, nextType) {
+ function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstDeclaration, firstType, nextDeclaration, nextType) {
var nextDeclarationName = ts.getNameOfDeclaration(nextDeclaration);
- var message = nextDeclaration.kind === 154 || nextDeclaration.kind === 153
+ var message = nextDeclaration.kind === 155 || nextDeclaration.kind === 154
? ts.Diagnostics.Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2
: ts.Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2;
- error(nextDeclarationName, message, ts.declarationNameToString(nextDeclarationName), typeToString(firstType), typeToString(nextType));
+ var declName = ts.declarationNameToString(nextDeclarationName);
+ var err = error(nextDeclarationName, message, declName, typeToString(firstType), typeToString(nextType));
+ if (firstDeclaration) {
+ ts.addRelatedInfo(err, ts.createDiagnosticForNode(firstDeclaration, ts.Diagnostics._0_was_also_declared_here, declName));
+ }
}
function areDeclarationFlagsIdentical(left, right) {
- if ((left.kind === 151 && right.kind === 237) ||
- (left.kind === 237 && right.kind === 151)) {
+ if ((left.kind === 152 && right.kind === 238) ||
+ (left.kind === 238 && right.kind === 152)) {
return true;
}
if (ts.hasQuestionToken(left) !== ts.hasQuestionToken(right)) {
@@ -46342,7 +47048,7 @@
checkGrammarStatementInAmbientContext(node);
checkTruthinessExpression(node.expression);
checkSourceElement(node.thenStatement);
- if (node.thenStatement.kind === 220) {
+ if (node.thenStatement.kind === 221) {
error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement);
}
checkSourceElement(node.elseStatement);
@@ -46366,12 +47072,12 @@
}
function checkForStatement(node) {
if (!checkGrammarStatementInAmbientContext(node)) {
- if (node.initializer && node.initializer.kind === 238) {
+ if (node.initializer && node.initializer.kind === 239) {
checkGrammarVariableDeclarationList(node.initializer);
}
}
if (node.initializer) {
- if (node.initializer.kind === 238) {
+ if (node.initializer.kind === 239) {
ts.forEach(node.initializer.declarations, checkVariableDeclaration);
}
else {
@@ -46391,20 +47097,20 @@
checkGrammarForInOrForOfStatement(node);
if (node.awaitModifier) {
var functionFlags = ts.getFunctionFlags(ts.getContainingFunction(node));
- if ((functionFlags & (4 | 2)) === 2 && languageVersion < 7) {
+ if ((functionFlags & (4 | 2)) === 2 && languageVersion < 8) {
checkExternalEmitHelpers(node, 16384);
}
}
else if (compilerOptions.downlevelIteration && languageVersion < 2) {
checkExternalEmitHelpers(node, 256);
}
- if (node.initializer.kind === 238) {
+ if (node.initializer.kind === 239) {
checkForInOrForOfVariableDeclaration(node);
}
else {
var varExpr = node.initializer;
var iteratedType = checkRightHandSideOfForOf(node.expression, node.awaitModifier);
- if (varExpr.kind === 187 || varExpr.kind === 188) {
+ if (varExpr.kind === 188 || varExpr.kind === 189) {
checkDestructuringAssignment(varExpr, iteratedType || errorType);
}
else {
@@ -46423,7 +47129,7 @@
function checkForInStatement(node) {
checkGrammarForInOrForOfStatement(node);
var rightType = getNonNullableTypeIfNeeded(checkExpression(node.expression));
- if (node.initializer.kind === 238) {
+ if (node.initializer.kind === 239) {
var variable = node.initializer.declarations[0];
if (variable && ts.isBindingPattern(variable.name)) {
error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);
@@ -46433,7 +47139,7 @@
else {
var varExpr = node.initializer;
var leftType = checkExpression(varExpr);
- if (varExpr.kind === 187 || varExpr.kind === 188) {
+ if (varExpr.kind === 188 || varExpr.kind === 189) {
error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);
}
else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) {
@@ -46681,12 +47387,12 @@
if (isGenerator) {
return;
}
- else if (func.kind === 159) {
+ else if (func.kind === 160) {
if (node.expression) {
error(node, ts.Diagnostics.Setters_cannot_return_a_value);
}
}
- else if (func.kind === 157) {
+ else if (func.kind === 158) {
if (node.expression && !checkTypeAssignableToAndOptionallyElaborate(exprType, returnType, node, node.expression)) {
error(node, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class);
}
@@ -46704,7 +47410,7 @@
}
}
}
- else if (func.kind !== 157 && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType) && !isGenerator) {
+ else if (func.kind !== 158 && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType) && !isGenerator) {
error(node, ts.Diagnostics.Not_all_code_paths_return_a_value);
}
}
@@ -46729,7 +47435,7 @@
var expressionType = checkExpression(node.expression);
var expressionIsLiteral = isLiteralType(expressionType);
ts.forEach(node.caseBlock.clauses, function (clause) {
- if (clause.kind === 272 && !hasDuplicateDefaultClause) {
+ if (clause.kind === 273 && !hasDuplicateDefaultClause) {
if (firstDefaultClause === undefined) {
firstDefaultClause = clause;
}
@@ -46741,7 +47447,7 @@
hasDuplicateDefaultClause = true;
}
}
- if (produceDiagnostics && clause.kind === 271) {
+ if (produceDiagnostics && clause.kind === 272) {
var caseType = checkExpression(clause.expression);
var caseIsLiteral = isLiteralType(caseType);
var comparedExpressionType = expressionType;
@@ -46765,7 +47471,7 @@
if (ts.isFunctionLike(current)) {
return "quit";
}
- if (current.kind === 233 && current.label.escapedText === node.label.escapedText) {
+ if (current.kind === 234 && current.label.escapedText === node.label.escapedText) {
grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNode(node.label));
return true;
}
@@ -46860,8 +47566,8 @@
}
var errorNode;
if (propDeclaration && name &&
- (propDeclaration.kind === 204 ||
- name.kind === 149 ||
+ (propDeclaration.kind === 205 ||
+ name.kind === 150 ||
prop.parent === containingType.symbol)) {
errorNode = propDeclaration;
}
@@ -46926,7 +47632,7 @@
function checkTypeParametersNotReferenced(root, typeParameters, index) {
visit(root);
function visit(node) {
- if (node.kind === 164) {
+ if (node.kind === 165) {
var type = getTypeFromTypeReference(node);
if (type.flags & 262144) {
for (var i = index; i < typeParameters.length; i++) {
@@ -47037,6 +47743,10 @@
if (languageVersion < 2) {
checkExternalEmitHelpers(baseTypeNode.parent, 1);
}
+ var extendsNode = ts.getClassExtendsHeritageElement(node);
+ if (extendsNode && extendsNode !== baseTypeNode) {
+ checkExpression(extendsNode.expression);
+ }
var baseTypes = getBaseTypes(type);
if (baseTypes.length && produceDiagnostics) {
var baseType_1 = baseTypes[0];
@@ -47044,10 +47754,6 @@
var staticBaseType = getApparentType(baseConstructorType);
checkBaseTypeAccessibility(staticBaseType, baseTypeNode);
checkSourceElement(baseTypeNode.expression);
- var extendsNode = ts.getClassExtendsHeritageElement(node);
- if (extendsNode && extendsNode !== baseTypeNode) {
- checkExpression(extendsNode.expression);
- }
if (ts.some(baseTypeNode.typeArguments)) {
ts.forEach(baseTypeNode.typeArguments, checkSourceElement);
for (var _i = 0, _a = getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode); _i < _a.length; _i++) {
@@ -47111,7 +47817,7 @@
}
function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
var issuedMemberError = false;
- var _loop_9 = function (member) {
+ var _loop_12 = function (member) {
if (ts.hasStaticModifier(member)) {
return "continue";
}
@@ -47129,7 +47835,7 @@
};
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
- _loop_9(member);
+ _loop_12(member);
}
if (!issuedMemberError) {
checkTypeAssignableTo(typeWithThis, baseWithThis, node.name || node, broadDiag);
@@ -47152,7 +47858,7 @@
}
function getClassOrInterfaceDeclarationsOfSymbol(symbol) {
return ts.filter(symbol.declarations, function (d) {
- return d.kind === 240 || d.kind === 241;
+ return d.kind === 241 || d.kind === 242;
});
}
function checkKindsOfPropertyMemberOverrides(type, baseType) {
@@ -47170,7 +47876,7 @@
if (derived === base) {
var derivedClassDecl = ts.getClassLikeDeclarationOfSymbol(type.symbol);
if (baseDeclarationFlags & 128 && (!derivedClassDecl || !ts.hasModifier(derivedClassDecl, 128))) {
- if (derivedClassDecl.kind === 209) {
+ if (derivedClassDecl.kind === 210) {
error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType));
}
else {
@@ -47217,8 +47923,8 @@
for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) {
var base = baseTypes_2[_i];
var properties = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType));
- for (var _a = 0, properties_6 = properties; _a < properties_6.length; _a++) {
- var prop = properties_6[_a];
+ for (var _a = 0, properties_4 = properties; _a < properties_4.length; _a++) {
+ var prop = properties_4[_a];
var existing = seen.get(prop.escapedName);
if (!existing) {
seen.set(prop.escapedName, { prop: prop, containingType: base });
@@ -47259,7 +47965,7 @@
}
}
function isInstancePropertyWithoutInitializer(node) {
- return node.kind === 154 &&
+ return node.kind === 155 &&
!ts.hasModifier(node, 32 | 128) &&
!node.exclamationToken &&
!node.initializer;
@@ -47281,7 +47987,7 @@
checkExportsOnMergedDeclarations(node);
var symbol = getSymbolOfNode(node);
checkTypeParameterListsIdentical(symbol);
- var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 241);
+ var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 242);
if (node === firstInterfaceDecl) {
var type = getDeclaredTypeOfSymbol(symbol);
var typeWithThis = getTypeWithThisArgument(type);
@@ -47377,7 +48083,7 @@
return value;
function evaluate(expr) {
switch (expr.kind) {
- case 202:
+ case 203:
var value_2 = evaluate(expr.operand);
if (typeof value_2 === "number") {
switch (expr.operator) {
@@ -47387,7 +48093,7 @@
}
}
break;
- case 204:
+ case 205:
var left = evaluate(expr.left);
var right = evaluate(expr.right);
if (typeof left === "number" && typeof right === "number") {
@@ -47415,22 +48121,22 @@
case 8:
checkGrammarNumericLiteral(expr);
return +expr.text;
- case 195:
+ case 196:
return evaluate(expr.expression);
- case 72:
+ case 73:
var identifier = expr;
if (isInfinityOrNaNString(identifier.escapedText)) {
return +(identifier.escapedText);
}
return ts.nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), identifier.escapedText);
+ case 191:
case 190:
- case 189:
var ex = expr;
if (isConstantMemberAccess(ex)) {
var type = getTypeOfExpression(ex.expression);
if (type.symbol && type.symbol.flags & 384) {
var name = void 0;
- if (ex.kind === 189) {
+ if (ex.kind === 190) {
name = ex.name.escapedText;
}
else {
@@ -47461,9 +48167,9 @@
}
}
function isConstantMemberAccess(node) {
- return node.kind === 72 ||
- node.kind === 189 && isConstantMemberAccess(node.expression) ||
- node.kind === 190 && isConstantMemberAccess(node.expression) &&
+ return node.kind === 73 ||
+ node.kind === 190 && isConstantMemberAccess(node.expression) ||
+ node.kind === 191 && isConstantMemberAccess(node.expression) &&
node.argumentExpression.kind === 10;
}
function checkEnumDeclaration(node) {
@@ -47489,7 +48195,7 @@
}
var seenEnumMissingInitialInitializer_1 = false;
ts.forEach(enumSymbol.declarations, function (declaration) {
- if (declaration.kind !== 243) {
+ if (declaration.kind !== 244) {
return false;
}
var enumDeclaration = declaration;
@@ -47512,8 +48218,8 @@
var declarations = symbol.declarations;
for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) {
var declaration = declarations_8[_i];
- if ((declaration.kind === 240 ||
- (declaration.kind === 239 && ts.nodeIsPresent(declaration.body))) &&
+ if ((declaration.kind === 241 ||
+ (declaration.kind === 240 && ts.nodeIsPresent(declaration.body))) &&
!(declaration.flags & 4194304)) {
return declaration;
}
@@ -47571,7 +48277,7 @@
error(node.name, ts.Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged);
}
}
- var mergedClass = ts.getDeclarationOfKind(symbol, 240);
+ var mergedClass = ts.getDeclarationOfKind(symbol, 241);
if (mergedClass &&
inSameLexicalScope(node, mergedClass)) {
getNodeLinks(node).flags |= 32768;
@@ -47614,22 +48320,22 @@
}
function checkModuleAugmentationElement(node, isGlobalAugmentation) {
switch (node.kind) {
- case 219:
+ case 220:
for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {
var decl = _a[_i];
checkModuleAugmentationElement(decl, isGlobalAugmentation);
}
break;
- case 254:
case 255:
+ case 256:
grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations);
break;
- case 248:
case 249:
+ case 250:
grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module);
break;
- case 186:
- case 237:
+ case 187:
+ case 238:
var name = node.name;
if (ts.isBindingPattern(name)) {
for (var _b = 0, _c = name.elements; _b < _c.length; _b++) {
@@ -47638,12 +48344,12 @@
}
break;
}
- case 240:
- case 243:
- case 239:
case 241:
case 244:
+ case 240:
case 242:
+ case 245:
+ case 243:
if (isGlobalAugmentation) {
return;
}
@@ -47659,17 +48365,17 @@
}
function getFirstIdentifier(node) {
switch (node.kind) {
- case 72:
+ case 73:
return node;
- case 148:
+ case 149:
do {
node = node.left;
- } while (node.kind !== 72);
+ } while (node.kind !== 73);
return node;
- case 189:
+ case 190:
do {
node = node.expression;
- } while (node.kind !== 72);
+ } while (node.kind !== 73);
return node;
}
}
@@ -47682,9 +48388,9 @@
error(moduleName, ts.Diagnostics.String_literal_expected);
return false;
}
- var inAmbientExternalModule = node.parent.kind === 245 && ts.isAmbientModule(node.parent.parent);
- if (node.parent.kind !== 284 && !inAmbientExternalModule) {
- error(moduleName, node.kind === 255 ?
+ var inAmbientExternalModule = node.parent.kind === 246 && ts.isAmbientModule(node.parent.parent);
+ if (node.parent.kind !== 285 && !inAmbientExternalModule) {
+ error(moduleName, node.kind === 256 ?
ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace :
ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module);
return false;
@@ -47705,13 +48411,13 @@
(symbol.flags & 67897832 ? 67897832 : 0) |
(symbol.flags & 1920 ? 1920 : 0);
if (target.flags & excludedMeanings) {
- var message = node.kind === 257 ?
+ var message = node.kind === 258 ?
ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 :
ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0;
error(node, message, symbolToString(symbol));
}
if (compilerOptions.isolatedModules
- && node.kind === 257
+ && node.kind === 258
&& !(target.flags & 67220415)
&& !(node.flags & 4194304)) {
error(node, ts.Diagnostics.Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided);
@@ -47737,7 +48443,7 @@
checkImportBinding(importClause);
}
if (importClause.namedBindings) {
- if (importClause.namedBindings.kind === 251) {
+ if (importClause.namedBindings.kind === 252) {
checkImportBinding(importClause.namedBindings);
}
else {
@@ -47760,7 +48466,7 @@
if (ts.hasModifier(node, 1)) {
markExportAsReferenced(node);
}
- if (node.moduleReference.kind !== 259) {
+ if (node.moduleReference.kind !== 260) {
var target = resolveAlias(getSymbolOfNode(node));
if (target !== unknownSymbol) {
if (target.flags & 67220415) {
@@ -47791,10 +48497,10 @@
if (!node.moduleSpecifier || checkExternalImportOrExportDeclaration(node)) {
if (node.exportClause) {
ts.forEach(node.exportClause.elements, checkExportSpecifier);
- var inAmbientExternalModule = node.parent.kind === 245 && ts.isAmbientModule(node.parent.parent);
- var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 245 &&
+ var inAmbientExternalModule = node.parent.kind === 246 && ts.isAmbientModule(node.parent.parent);
+ var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 246 &&
!node.moduleSpecifier && node.flags & 4194304;
- if (node.parent.kind !== 284 && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) {
+ if (node.parent.kind !== 285 && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) {
error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace);
}
}
@@ -47810,7 +48516,7 @@
}
}
function checkGrammarModuleElementContext(node, errorMessage) {
- var isInAppropriateContext = node.parent.kind === 284 || node.parent.kind === 245 || node.parent.kind === 244;
+ var isInAppropriateContext = node.parent.kind === 285 || node.parent.kind === 246 || node.parent.kind === 245;
if (!isInAppropriateContext) {
grammarErrorOnFirstToken(node, errorMessage);
}
@@ -47836,8 +48542,8 @@
if (checkGrammarModuleElementContext(node, ts.Diagnostics.An_export_assignment_can_only_be_used_in_a_module)) {
return;
}
- var container = node.parent.kind === 284 ? node.parent : node.parent.parent;
- if (container.kind === 244 && !ts.isAmbientModule(container)) {
+ var container = node.parent.kind === 285 ? node.parent : node.parent.parent;
+ if (container.kind === 245 && !ts.isAmbientModule(container)) {
if (node.isExportEquals) {
error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace);
}
@@ -47849,7 +48555,7 @@
if (!checkGrammarDecoratorsAndModifiers(node) && ts.hasModifiers(node)) {
grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers);
}
- if (node.expression.kind === 72) {
+ if (node.expression.kind === 73) {
markExportAsReferenced(node);
if (ts.getEmitDeclarations(compilerOptions)) {
collectLinkedAliases(node.expression, true);
@@ -47916,7 +48622,7 @@
return !ts.isAccessor(declaration);
}
function isNotOverload(declaration) {
- return (declaration.kind !== 239 && declaration.kind !== 156) ||
+ return (declaration.kind !== 240 && declaration.kind !== 157) ||
!!declaration.body;
}
function checkSourceElement(node) {
@@ -47937,157 +48643,157 @@
var kind = node.kind;
if (cancellationToken) {
switch (kind) {
- case 244:
- case 240:
+ case 245:
case 241:
- case 239:
+ case 242:
+ case 240:
cancellationToken.throwIfCancellationRequested();
}
}
switch (kind) {
- case 150:
- return checkTypeParameter(node);
case 151:
+ return checkTypeParameter(node);
+ case 152:
return checkParameter(node);
+ case 155:
case 154:
- case 153:
return checkPropertyDeclaration(node);
- case 165:
case 166:
- case 160:
+ case 167:
case 161:
case 162:
+ case 163:
return checkSignatureDeclaration(node);
+ case 157:
case 156:
- case 155:
return checkMethodDeclaration(node);
- case 157:
- return checkConstructorDeclaration(node);
case 158:
+ return checkConstructorDeclaration(node);
case 159:
+ case 160:
return checkAccessorDeclaration(node);
- case 164:
+ case 165:
return checkTypeReferenceNode(node);
- case 163:
+ case 164:
return checkTypePredicate(node);
- case 167:
- return checkTypeQuery(node);
case 168:
- return checkTypeLiteral(node);
+ return checkTypeQuery(node);
case 169:
- return checkArrayType(node);
+ return checkTypeLiteral(node);
case 170:
+ return checkArrayType(node);
+ case 171:
return checkTupleType(node);
- case 173:
case 174:
+ case 175:
return checkUnionOrIntersectionType(node);
- case 177:
- case 171:
+ case 178:
case 172:
+ case 173:
return checkSourceElement(node.type);
- case 178:
- return checkThisType(node);
case 179:
+ return checkThisType(node);
+ case 180:
return checkTypeOperator(node);
- case 175:
- return checkConditionalType(node);
case 176:
+ return checkConditionalType(node);
+ case 177:
return checkInferType(node);
- case 183:
+ case 184:
return checkImportType(node);
- case 300:
+ case 301:
return checkJSDocAugmentsTag(node);
- case 309:
- case 302:
+ case 310:
+ case 303:
return checkJSDocTypeAliasTag(node);
- case 308:
+ case 309:
return checkJSDocTemplateTag(node);
- case 307:
+ case 308:
return checkJSDocTypeTag(node);
- case 304:
+ case 305:
return checkJSDocParameterTag(node);
- case 294:
+ case 295:
checkJSDocFunctionType(node);
+ case 293:
case 292:
- case 291:
- case 289:
case 290:
- case 297:
+ case 291:
+ case 298:
checkJSDocTypeIsInJsFile(node);
ts.forEachChild(node, checkSourceElement);
return;
- case 295:
+ case 296:
checkJSDocVariadicType(node);
return;
- case 288:
+ case 289:
return checkSourceElement(node.type);
- case 180:
- return checkIndexedAccessType(node);
case 181:
+ return checkIndexedAccessType(node);
+ case 182:
return checkMappedType(node);
- case 239:
+ case 240:
return checkFunctionDeclaration(node);
- case 218:
- case 245:
- return checkBlock(node);
case 219:
+ case 246:
+ return checkBlock(node);
+ case 220:
return checkVariableStatement(node);
- case 221:
- return checkExpressionStatement(node);
case 222:
- return checkIfStatement(node);
+ return checkExpressionStatement(node);
case 223:
- return checkDoStatement(node);
+ return checkIfStatement(node);
case 224:
- return checkWhileStatement(node);
+ return checkDoStatement(node);
case 225:
- return checkForStatement(node);
+ return checkWhileStatement(node);
case 226:
- return checkForInStatement(node);
+ return checkForStatement(node);
case 227:
- return checkForOfStatement(node);
+ return checkForInStatement(node);
case 228:
+ return checkForOfStatement(node);
case 229:
- return checkBreakOrContinueStatement(node);
case 230:
- return checkReturnStatement(node);
+ return checkBreakOrContinueStatement(node);
case 231:
- return checkWithStatement(node);
+ return checkReturnStatement(node);
case 232:
- return checkSwitchStatement(node);
+ return checkWithStatement(node);
case 233:
- return checkLabeledStatement(node);
+ return checkSwitchStatement(node);
case 234:
- return checkThrowStatement(node);
+ return checkLabeledStatement(node);
case 235:
+ return checkThrowStatement(node);
+ case 236:
return checkTryStatement(node);
- case 237:
+ case 238:
return checkVariableDeclaration(node);
- case 186:
+ case 187:
return checkBindingElement(node);
- case 240:
- return checkClassDeclaration(node);
case 241:
- return checkInterfaceDeclaration(node);
+ return checkClassDeclaration(node);
case 242:
- return checkTypeAliasDeclaration(node);
+ return checkInterfaceDeclaration(node);
case 243:
- return checkEnumDeclaration(node);
+ return checkTypeAliasDeclaration(node);
case 244:
+ return checkEnumDeclaration(node);
+ case 245:
return checkModuleDeclaration(node);
- case 249:
+ case 250:
return checkImportDeclaration(node);
- case 248:
+ case 249:
return checkImportEqualsDeclaration(node);
- case 255:
+ case 256:
return checkExportDeclaration(node);
- case 254:
+ case 255:
return checkExportAssignment(node);
- case 220:
- case 236:
+ case 221:
+ case 237:
checkGrammarStatementInAmbientContext(node);
return;
- case 258:
+ case 259:
return checkMissingDeclaration(node);
}
}
@@ -48162,23 +48868,23 @@
var saveCurrentNode = currentNode;
currentNode = node;
switch (node.kind) {
- case 196:
case 197:
+ case 198:
+ case 157:
case 156:
- case 155:
checkFunctionExpressionOrObjectLiteralMethodDeferred(node);
break;
- case 158:
case 159:
+ case 160:
checkAccessorDeclaration(node);
break;
- case 209:
+ case 210:
checkClassExpressionDeferred(node);
break;
- case 261:
+ case 262:
checkJsxSelfClosingElementDeferred(node);
break;
- case 260:
+ case 261:
checkJsxElementDeferred(node);
break;
}
@@ -48292,27 +48998,27 @@
copySymbols(location.locals, meaning);
}
switch (location.kind) {
- case 284:
+ case 285:
if (!ts.isExternalOrCommonJsModule(location))
break;
- case 244:
+ case 245:
copySymbols(getSymbolOfNode(location).exports, meaning & 2623475);
break;
- case 243:
+ case 244:
copySymbols(getSymbolOfNode(location).exports, meaning & 8);
break;
- case 209:
+ case 210:
var className = location.name;
if (className) {
copySymbol(location.symbol, meaning);
}
- case 240:
case 241:
+ case 242:
if (!isStatic) {
copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & 67897832);
}
break;
- case 196:
+ case 197:
var funcName = location.name;
if (funcName) {
copySymbol(location.symbol, meaning);
@@ -48344,33 +49050,33 @@
}
}
function isTypeDeclarationName(name) {
- return name.kind === 72 &&
+ return name.kind === 73 &&
isTypeDeclaration(name.parent) &&
name.parent.name === name;
}
function isTypeDeclaration(node) {
switch (node.kind) {
- case 150:
- case 240:
+ case 151:
case 241:
case 242:
case 243:
+ case 244:
return true;
default:
return false;
}
}
function isTypeReferenceIdentifier(node) {
- while (node.parent.kind === 148) {
+ while (node.parent.kind === 149) {
node = node.parent;
}
- return node.parent.kind === 164;
+ return node.parent.kind === 165;
}
function isHeritageClauseElementIdentifier(node) {
- while (node.parent.kind === 189) {
+ while (node.parent.kind === 190) {
node = node.parent;
}
- return node.parent.kind === 211;
+ return node.parent.kind === 212;
}
function forEachEnclosingClass(node, callback) {
var result;
@@ -48398,13 +49104,13 @@
return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; });
}
function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) {
- while (nodeOnRightSide.parent.kind === 148) {
+ while (nodeOnRightSide.parent.kind === 149) {
nodeOnRightSide = nodeOnRightSide.parent;
}
- if (nodeOnRightSide.parent.kind === 248) {
+ if (nodeOnRightSide.parent.kind === 249) {
return nodeOnRightSide.parent.moduleReference === nodeOnRightSide ? nodeOnRightSide.parent : undefined;
}
- if (nodeOnRightSide.parent.kind === 254) {
+ if (nodeOnRightSide.parent.kind === 255) {
return nodeOnRightSide.parent.expression === nodeOnRightSide ? nodeOnRightSide.parent : undefined;
}
return undefined;
@@ -48430,7 +49136,7 @@
node = parent;
parent = parent.parent;
}
- if (parent && parent.kind === 183 && parent.qualifier === node) {
+ if (parent && parent.kind === 184 && parent.qualifier === node) {
return parent;
}
return undefined;
@@ -48440,21 +49146,21 @@
return getSymbolOfNode(entityName.parent);
}
if (ts.isInJSFile(entityName) &&
- entityName.parent.kind === 189 &&
+ entityName.parent.kind === 190 &&
entityName.parent === entityName.parent.parent.left) {
var specialPropertyAssignmentSymbol = getSpecialPropertyAssignmentSymbolFromEntityName(entityName);
if (specialPropertyAssignmentSymbol) {
return specialPropertyAssignmentSymbol;
}
}
- if (entityName.parent.kind === 254 && ts.isEntityNameExpression(entityName)) {
+ if (entityName.parent.kind === 255 && ts.isEntityNameExpression(entityName)) {
var success = resolveEntityName(entityName, 67220415 | 67897832 | 1920 | 2097152, true);
if (success && success !== unknownSymbol) {
return success;
}
}
else if (!ts.isPropertyAccessExpression(entityName) && isInRightSideOfImportOrExportAssignment(entityName)) {
- var importEqualsDeclaration = ts.getAncestor(entityName, 248);
+ var importEqualsDeclaration = ts.getAncestor(entityName, 249);
ts.Debug.assert(importEqualsDeclaration !== undefined);
return getSymbolOfPartOfRightHandSideOfImportEquals(entityName, true);
}
@@ -48471,7 +49177,7 @@
}
if (isHeritageClauseElementIdentifier(entityName)) {
var meaning = 0;
- if (entityName.parent.kind === 211) {
+ if (entityName.parent.kind === 212) {
meaning = 67897832;
if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) {
meaning |= 67220415;
@@ -48486,10 +49192,10 @@
return entityNameSymbol;
}
}
- if (entityName.parent.kind === 304) {
+ if (entityName.parent.kind === 305) {
return ts.getParameterSymbolFromJSDoc(entityName.parent);
}
- if (entityName.parent.kind === 150 && entityName.parent.parent.kind === 308) {
+ if (entityName.parent.kind === 151 && entityName.parent.parent.kind === 309) {
ts.Debug.assert(!ts.isInJSFile(entityName));
var typeParameter = ts.getTypeParameterFromJsDoc(entityName.parent);
return typeParameter && typeParameter.symbol;
@@ -48498,19 +49204,19 @@
if (ts.nodeIsMissing(entityName)) {
return undefined;
}
- if (entityName.kind === 72) {
+ if (entityName.kind === 73) {
if (ts.isJSXTagName(entityName) && isJsxIntrinsicIdentifier(entityName)) {
var symbol = getIntrinsicTagSymbol(entityName.parent);
return symbol === unknownSymbol ? undefined : symbol;
}
return resolveEntityName(entityName, 67220415, false, true);
}
- else if (entityName.kind === 189 || entityName.kind === 148) {
+ else if (entityName.kind === 190 || entityName.kind === 149) {
var links = getNodeLinks(entityName);
if (links.resolvedSymbol) {
return links.resolvedSymbol;
}
- if (entityName.kind === 189) {
+ if (entityName.kind === 190) {
checkPropertyAccessExpression(entityName);
}
else {
@@ -48520,16 +49226,16 @@
}
}
else if (isTypeReferenceIdentifier(entityName)) {
- var meaning = entityName.parent.kind === 164 ? 67897832 : 1920;
+ var meaning = entityName.parent.kind === 165 ? 67897832 : 1920;
return resolveEntityName(entityName, meaning, false, true);
}
- if (entityName.parent.kind === 163) {
+ if (entityName.parent.kind === 164) {
return resolveEntityName(entityName, 1);
}
return undefined;
}
function getSymbolAtLocation(node) {
- if (node.kind === 284) {
+ if (node.kind === 285) {
return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined;
}
var parent = node.parent;
@@ -48546,12 +49252,12 @@
else if (ts.isLiteralComputedPropertyDeclarationName(node)) {
return getSymbolOfNode(parent.parent);
}
- if (node.kind === 72) {
+ if (node.kind === 73) {
if (isInRightSideOfImportOrExportAssignment(node)) {
return getSymbolOfEntityNameOrPropertyAccessExpression(node);
}
- else if (parent.kind === 186 &&
- grandParent.kind === 184 &&
+ else if (parent.kind === 187 &&
+ grandParent.kind === 185 &&
node === parent.propertyName) {
var typeOfPattern = getTypeOfNode(grandParent);
var propertyDeclaration = getPropertyOfType(typeOfPattern, node.escapedText);
@@ -48561,11 +49267,11 @@
}
}
switch (node.kind) {
- case 72:
- case 189:
- case 148:
+ case 73:
+ case 190:
+ case 149:
return getSymbolOfEntityNameOrPropertyAccessExpression(node);
- case 100:
+ case 101:
var container = ts.getThisContainer(node, false);
if (ts.isFunctionLike(container)) {
var sig = getSignatureFromDeclaration(container);
@@ -48576,20 +49282,20 @@
if (ts.isInExpressionContext(node)) {
return checkExpression(node).symbol;
}
- case 178:
+ case 179:
return getTypeFromThisTypeNode(node).symbol;
- case 98:
+ case 99:
return checkExpression(node).symbol;
- case 124:
+ case 125:
var constructorDeclaration = node.parent;
- if (constructorDeclaration && constructorDeclaration.kind === 157) {
+ if (constructorDeclaration && constructorDeclaration.kind === 158) {
return constructorDeclaration.parent.symbol;
}
return undefined;
case 10:
case 14:
if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) ||
- ((node.parent.kind === 249 || node.parent.kind === 255) && node.parent.moduleSpecifier === node) ||
+ ((node.parent.kind === 250 || node.parent.kind === 256) && node.parent.moduleSpecifier === node) ||
((ts.isInJSFile(node) && ts.isRequireCall(node.parent, false)) || ts.isImportCall(node.parent)) ||
(ts.isLiteralTypeNode(node.parent) && ts.isLiteralImportTypeNode(node.parent.parent) && node.parent.parent.argument === node.parent)) {
return resolveExternalModuleName(node, node);
@@ -48604,21 +49310,21 @@
? getTypeFromTypeNode(grandParent.objectType)
: undefined;
return objectType && getPropertyOfType(objectType, ts.escapeLeadingUnderscores(node.text));
- case 80:
- case 90:
+ case 81:
+ case 91:
case 37:
- case 76:
+ case 77:
return getSymbolOfNode(node.parent);
- case 183:
+ case 184:
return ts.isLiteralImportTypeNode(node) ? getSymbolAtLocation(node.argument.literal) : undefined;
- case 85:
+ case 86:
return ts.isExportAssignment(node.parent) ? ts.Debug.assertDefined(node.parent.symbol) : undefined;
default:
return undefined;
}
}
function getShorthandAssignmentValueSymbol(location) {
- if (location && location.kind === 276) {
+ if (location && location.kind === 277) {
return resolveEntityName(location.name, 67220415 | 2097152);
}
return undefined;
@@ -48673,27 +49379,29 @@
}
return errorType;
}
- function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr) {
- ts.Debug.assert(expr.kind === 188 || expr.kind === 187);
- if (expr.parent.kind === 227) {
+ function getTypeOfAssignmentPattern(expr) {
+ ts.Debug.assert(expr.kind === 189 || expr.kind === 188);
+ if (expr.parent.kind === 228) {
var iteratedType = checkRightHandSideOfForOf(expr.parent.expression, expr.parent.awaitModifier);
return checkDestructuringAssignment(expr, iteratedType || errorType);
}
- if (expr.parent.kind === 204) {
+ if (expr.parent.kind === 205) {
var iteratedType = getTypeOfExpression(expr.parent.right);
return checkDestructuringAssignment(expr, iteratedType || errorType);
}
- if (expr.parent.kind === 275) {
- var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent);
- return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || errorType, expr.parent);
- }
- ts.Debug.assert(expr.parent.kind === 187);
- var typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent);
- var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || errorType, expr.parent, false, false) || errorType;
- return checkArrayLiteralDestructuringElementAssignment(expr.parent, typeOfArrayLiteral, expr.parent.elements.indexOf(expr), elementType || errorType);
+ if (expr.parent.kind === 276) {
+ var node_3 = ts.cast(expr.parent.parent, ts.isObjectLiteralExpression);
+ var typeOfParentObjectLiteral = getTypeOfAssignmentPattern(node_3) || errorType;
+ var propertyIndex = ts.indexOfNode(node_3.properties, expr.parent);
+ return checkObjectLiteralDestructuringPropertyAssignment(node_3, typeOfParentObjectLiteral, propertyIndex);
+ }
+ var node = ts.cast(expr.parent, ts.isArrayLiteralExpression);
+ var typeOfArrayLiteral = getTypeOfAssignmentPattern(node) || errorType;
+ var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral, expr.parent, false, false) || errorType;
+ return checkArrayLiteralDestructuringElementAssignment(node, typeOfArrayLiteral, node.elements.indexOf(expr), elementType);
}
function getPropertySymbolOfDestructuringAssignment(location) {
- var typeOfObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(location.parent.parent);
+ var typeOfObjectLiteral = getTypeOfAssignmentPattern(ts.cast(location.parent.parent, ts.isAssignmentPattern));
return typeOfObjectLiteral && getPropertyOfType(typeOfObjectLiteral, location.escapedText);
}
function getRegularTypeOfExpression(expr) {
@@ -48711,12 +49419,12 @@
function getClassElementPropertyKeyType(element) {
var name = element.name;
switch (name.kind) {
- case 72:
+ case 73:
return getLiteralType(ts.idText(name));
case 8:
case 10:
return getLiteralType(name.text);
- case 149:
+ case 150:
var nameType = checkComputedPropertyName(name);
return isTypeAssignableToKind(nameType, 12288) ? nameType : stringType;
default:
@@ -48770,7 +49478,7 @@
if (!ts.isGeneratedIdentifier(nodeIn)) {
var node = ts.getParseTreeNode(nodeIn, ts.isIdentifier);
if (node) {
- var isPropertyName_1 = node.parent.kind === 189 && node.parent.name === node;
+ var isPropertyName_1 = node.parent.kind === 190 && node.parent.name === node;
return !isPropertyName_1 && getReferencedValueSymbol(node) === argumentsSymbol;
}
}
@@ -48812,7 +49520,7 @@
}
var parentSymbol_1 = getParentOfSymbol(symbol);
if (parentSymbol_1) {
- if (parentSymbol_1.flags & 512 && parentSymbol_1.valueDeclaration.kind === 284) {
+ if (parentSymbol_1.flags & 512 && parentSymbol_1.valueDeclaration.kind === 285) {
var symbolFile = parentSymbol_1.valueDeclaration;
var referenceFile = ts.getSourceFileOfNode(node);
var symbolIsUmdExport = symbolFile !== referenceFile;
@@ -48833,12 +49541,16 @@
}
return undefined;
}
+ function isSymbolOfDestructuredElementOfCatchBinding(symbol) {
+ return ts.isBindingElement(symbol.valueDeclaration)
+ && ts.walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 275;
+ }
function isSymbolOfDeclarationWithCollidingName(symbol) {
if (symbol.flags & 418 && !ts.isSourceFile(symbol.valueDeclaration)) {
var links = getSymbolLinks(symbol);
if (links.isDeclarationWithCollidingName === undefined) {
var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration);
- if (ts.isStatementWithLocals(container)) {
+ if (ts.isStatementWithLocals(container) || isSymbolOfDestructuredElementOfCatchBinding(symbol)) {
var nodeLinks_1 = getNodeLinks(symbol.valueDeclaration);
if (resolveName(container.parent, symbol.escapedName, 67220415, undefined, undefined, false)) {
links.isDeclarationWithCollidingName = true;
@@ -48846,7 +49558,7 @@
else if (nodeLinks_1.flags & 262144) {
var isDeclaredInLoop = nodeLinks_1.flags & 524288;
var inLoopInitializer = ts.isIterationStatement(container, false);
- var inLoopBodyBlock = container.kind === 218 && ts.isIterationStatement(container.parent, false);
+ var inLoopBodyBlock = container.kind === 219 && ts.isIterationStatement(container.parent, false);
links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock));
}
else {
@@ -48882,18 +49594,18 @@
}
function isValueAliasDeclaration(node) {
switch (node.kind) {
- case 248:
- case 250:
+ case 249:
case 251:
- case 253:
- case 257:
+ case 252:
+ case 254:
+ case 258:
return isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol);
- case 255:
+ case 256:
var exportClause = node.exportClause;
return !!exportClause && ts.some(exportClause.elements, isValueAliasDeclaration);
- case 254:
+ case 255:
return node.expression
- && node.expression.kind === 72
+ && node.expression.kind === 73
? isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol)
: true;
}
@@ -48901,7 +49613,7 @@
}
function isTopLevelValueImportEqualsWithEntityName(nodeIn) {
var node = ts.getParseTreeNode(nodeIn, ts.isImportEqualsDeclaration);
- if (node === undefined || node.parent.kind !== 284 || !ts.isInternalModuleImportEqualsDeclaration(node)) {
+ if (node === undefined || node.parent.kind !== 285 || !ts.isInternalModuleImportEqualsDeclaration(node)) {
return false;
}
var isValue = isAliasResolvedToValue(getSymbolOfNode(node));
@@ -48987,15 +49699,15 @@
}
function canHaveConstantValue(node) {
switch (node.kind) {
- case 278:
- case 189:
+ case 279:
case 190:
+ case 191:
return true;
}
return false;
}
function getConstantValue(node) {
- if (node.kind === 278) {
+ if (node.kind === 279) {
return getEnumMemberValue(node);
}
var symbol = getNodeLinks(node).resolvedSymbol;
@@ -49075,7 +49787,7 @@
function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, tracker, addUndefined) {
var declaration = ts.getParseTreeNode(declarationIn, ts.isVariableLikeOrAccessor);
if (!declaration) {
- return ts.createToken(120);
+ return ts.createToken(121);
}
var symbol = getSymbolOfNode(declaration);
var type = symbol && !(symbol.flags & (2048 | 131072))
@@ -49093,7 +49805,7 @@
function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, tracker) {
var signatureDeclaration = ts.getParseTreeNode(signatureDeclarationIn, ts.isFunctionLike);
if (!signatureDeclaration) {
- return ts.createToken(120);
+ return ts.createToken(121);
}
var signature = getSignatureFromDeclaration(signatureDeclaration);
return nodeBuilder.typeToTypeNode(getReturnTypeOfSignature(signature), enclosingDeclaration, flags | 1024, tracker);
@@ -49101,7 +49813,7 @@
function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) {
var expr = ts.getParseTreeNode(exprIn, ts.isExpression);
if (!expr) {
- return ts.createToken(120);
+ return ts.createToken(121);
}
var type = getWidenedType(getRegularTypeOfExpression(expr));
return nodeBuilder.typeToTypeNode(type, enclosingDeclaration, flags | 1024, tracker);
@@ -49211,17 +49923,17 @@
isLateBound: function (nodeIn) {
var node = ts.getParseTreeNode(nodeIn, ts.isDeclaration);
var symbol = node && getSymbolOfNode(node);
- return !!(symbol && ts.getCheckFlags(symbol) & 2048);
+ return !!(symbol && ts.getCheckFlags(symbol) & 4096);
},
getJsxFactoryEntity: function (location) { return location ? (getJsxNamespace(location), (ts.getSourceFileOfNode(location).localJsxFactory || _jsxFactoryEntity)) : _jsxFactoryEntity; },
getAllAccessorDeclarations: function (accessor) {
accessor = ts.getParseTreeNode(accessor, ts.isGetOrSetAccessorDeclaration);
- var otherKind = accessor.kind === 159 ? 158 : 159;
+ var otherKind = accessor.kind === 160 ? 159 : 160;
var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(accessor), otherKind);
var firstAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? otherAccessor : accessor;
var secondAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? accessor : otherAccessor;
- var setAccessor = accessor.kind === 159 ? accessor : otherAccessor;
- var getAccessor = accessor.kind === 158 ? accessor : otherAccessor;
+ var setAccessor = accessor.kind === 160 ? accessor : otherAccessor;
+ var getAccessor = accessor.kind === 159 ? accessor : otherAccessor;
return {
firstAccessor: firstAccessor,
secondAccessor: secondAccessor,
@@ -49237,14 +49949,14 @@
}
};
function isInHeritageClause(node) {
- return node.parent && node.parent.kind === 211 && node.parent.parent && node.parent.parent.kind === 273;
+ return node.parent && node.parent.kind === 212 && node.parent.parent && node.parent.parent.kind === 274;
}
function getTypeReferenceDirectivesForEntityName(node) {
if (!fileToDirective) {
return undefined;
}
var meaning = 67897832 | 1920;
- if ((node.kind === 72 && isInTypeQuery(node)) || (node.kind === 189 && !isInHeritageClause(node))) {
+ if ((node.kind === 73 && isInTypeQuery(node)) || (node.kind === 190 && !isInHeritageClause(node))) {
meaning = 67220415 | 1048576;
}
var symbol = resolveEntityName(node, meaning, true);
@@ -49287,7 +49999,7 @@
break;
}
}
- if (current.valueDeclaration && current.valueDeclaration.kind === 284 && current.flags & 512) {
+ if (current.valueDeclaration && current.valueDeclaration.kind === 285 && current.flags & 512) {
return false;
}
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
@@ -49314,12 +50026,12 @@
}
}
function getExternalModuleFileFromDeclaration(declaration) {
- var specifier = declaration.kind === 244 ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration);
+ var specifier = declaration.kind === 245 ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration);
var moduleSymbol = resolveExternalModuleNameWorker(specifier, specifier, undefined);
if (!moduleSymbol) {
return undefined;
}
- return ts.getDeclarationOfKind(moduleSymbol, 284);
+ return ts.getDeclarationOfKind(moduleSymbol, 285);
}
function initializeTypeChecker() {
for (var _i = 0, _a = host.getSourceFiles(); _i < _a.length; _i++) {
@@ -49334,6 +50046,13 @@
continue;
}
if (!ts.isExternalOrCommonJsModule(file)) {
+ var fileGlobalThisSymbol = file.locals.get("globalThis");
+ if (fileGlobalThisSymbol) {
+ for (var _d = 0, _e = fileGlobalThisSymbol.declarations; _d < _e.length; _d++) {
+ var declaration = _e[_d];
+ diagnostics.add(ts.createDiagnosticForNode(declaration, ts.Diagnostics.Declaration_name_conflicts_with_built_in_global_identifier_0, "globalThis"));
+ }
+ }
mergeSymbolTable(globals, file.locals);
}
if (file.jsGlobalAugmentations) {
@@ -49355,10 +50074,10 @@
}
}
if (augmentations) {
- for (var _d = 0, augmentations_1 = augmentations; _d < augmentations_1.length; _d++) {
- var list = augmentations_1[_d];
- for (var _e = 0, list_1 = list; _e < list_1.length; _e++) {
- var augmentation = list_1[_e];
+ for (var _f = 0, augmentations_1 = augmentations; _f < augmentations_1.length; _f++) {
+ var list = augmentations_1[_f];
+ for (var _g = 0, list_1 = list; _g < list_1.length; _g++) {
+ var augmentation = list_1[_g];
if (!ts.isGlobalScopeAugmentation(augmentation.parent))
continue;
mergeModuleAugmentation(augmentation);
@@ -49369,6 +50088,7 @@
getSymbolLinks(undefinedSymbol).type = undefinedWideningType;
getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments", 0, true);
getSymbolLinks(unknownSymbol).type = errorType;
+ getSymbolLinks(globalThisSymbol).type = createObjectType(16, globalThisSymbol);
globalArrayType = getGlobalType("Array", 1, true);
globalObjectType = getGlobalType("Object", 0, true);
globalFunctionType = getGlobalType("Function", 0, true);
@@ -49387,10 +50107,10 @@
anyReadonlyArrayType = globalReadonlyArrayType ? createTypeFromGenericGlobalType(globalReadonlyArrayType, [anyType]) : anyArrayType;
globalThisType = getGlobalTypeOrUndefined("ThisType", 1);
if (augmentations) {
- for (var _f = 0, augmentations_2 = augmentations; _f < augmentations_2.length; _f++) {
- var list = augmentations_2[_f];
- for (var _g = 0, list_2 = list; _g < list_2.length; _g++) {
- var augmentation = list_2[_g];
+ for (var _h = 0, augmentations_2 = augmentations; _h < augmentations_2.length; _h++) {
+ var list = augmentations_2[_h];
+ for (var _j = 0, list_2 = list; _j < list_2.length; _j++) {
+ var augmentation = list_2[_j];
if (ts.isGlobalScopeAugmentation(augmentation.parent))
continue;
mergeModuleAugmentation(augmentation);
@@ -49478,14 +50198,14 @@
return false;
}
if (!ts.nodeCanBeDecorated(node, node.parent, node.parent.parent)) {
- if (node.kind === 156 && !ts.nodeIsPresent(node.body)) {
+ if (node.kind === 157 && !ts.nodeIsPresent(node.body)) {
return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload);
}
else {
return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here);
}
}
- else if (node.kind === 158 || node.kind === 159) {
+ else if (node.kind === 159 || node.kind === 160) {
var accessors = ts.getAllAccessorDeclarations(node.parent.members, node);
if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) {
return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name);
@@ -49502,23 +50222,23 @@
var flags = 0;
for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) {
var modifier = _a[_i];
- if (modifier.kind !== 133) {
- if (node.kind === 153 || node.kind === 155) {
+ if (modifier.kind !== 134) {
+ if (node.kind === 154 || node.kind === 156) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind));
}
- if (node.kind === 162) {
+ if (node.kind === 163) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind));
}
}
switch (modifier.kind) {
- case 77:
- if (node.kind !== 243) {
- return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(77));
+ case 78:
+ if (node.kind !== 244) {
+ return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(78));
}
break;
+ case 116:
case 115:
case 114:
- case 113:
var text = visibilityToString(ts.modifierToFlag(modifier.kind));
if (flags & 28) {
return grammarErrorOnNode(modifier, ts.Diagnostics.Accessibility_modifier_already_seen);
@@ -49532,11 +50252,11 @@
else if (flags & 256) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async");
}
- else if (node.parent.kind === 245 || node.parent.kind === 284) {
+ else if (node.parent.kind === 246 || node.parent.kind === 285) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text);
}
else if (flags & 128) {
- if (modifier.kind === 113) {
+ if (modifier.kind === 114) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract");
}
else {
@@ -49545,7 +50265,7 @@
}
flags |= ts.modifierToFlag(modifier.kind);
break;
- case 116:
+ case 117:
if (flags & 32) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static");
}
@@ -49555,10 +50275,10 @@
else if (flags & 256) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async");
}
- else if (node.parent.kind === 245 || node.parent.kind === 284) {
+ else if (node.parent.kind === 246 || node.parent.kind === 285) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static");
}
- else if (node.kind === 151) {
+ else if (node.kind === 152) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static");
}
else if (flags & 128) {
@@ -49567,17 +50287,17 @@
flags |= 32;
lastStatic = modifier;
break;
- case 133:
+ case 134:
if (flags & 64) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly");
}
- else if (node.kind !== 154 && node.kind !== 153 && node.kind !== 162 && node.kind !== 151) {
+ else if (node.kind !== 155 && node.kind !== 154 && node.kind !== 163 && node.kind !== 152) {
return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature);
}
flags |= 64;
lastReadonly = modifier;
break;
- case 85:
+ case 86:
if (flags & 1) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "export");
}
@@ -49590,52 +50310,52 @@
else if (flags & 256) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async");
}
- else if (node.parent.kind === 240) {
+ else if (node.parent.kind === 241) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export");
}
- else if (node.kind === 151) {
+ else if (node.kind === 152) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export");
}
flags |= 1;
break;
- case 80:
- var container = node.parent.kind === 284 ? node.parent : node.parent.parent;
- if (container.kind === 244 && !ts.isAmbientModule(container)) {
+ case 81:
+ var container = node.parent.kind === 285 ? node.parent : node.parent.parent;
+ if (container.kind === 245 && !ts.isAmbientModule(container)) {
return grammarErrorOnNode(modifier, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module);
}
flags |= 512;
break;
- case 125:
+ case 126:
if (flags & 2) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare");
}
else if (flags & 256) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async");
}
- else if (node.parent.kind === 240) {
+ else if (node.parent.kind === 241) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare");
}
- else if (node.kind === 151) {
+ else if (node.kind === 152) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare");
}
- else if ((node.parent.flags & 4194304) && node.parent.kind === 245) {
+ else if ((node.parent.flags & 4194304) && node.parent.kind === 246) {
return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context);
}
flags |= 2;
lastDeclare = modifier;
break;
- case 118:
+ case 119:
if (flags & 128) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract");
}
- if (node.kind !== 240) {
- if (node.kind !== 156 &&
- node.kind !== 154 &&
- node.kind !== 158 &&
- node.kind !== 159) {
+ if (node.kind !== 241) {
+ if (node.kind !== 157 &&
+ node.kind !== 155 &&
+ node.kind !== 159 &&
+ node.kind !== 160) {
return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration);
}
- if (!(node.parent.kind === 240 && ts.hasModifier(node.parent, 128))) {
+ if (!(node.parent.kind === 241 && ts.hasModifier(node.parent, 128))) {
return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class);
}
if (flags & 32) {
@@ -49647,14 +50367,14 @@
}
flags |= 128;
break;
- case 121:
+ case 122:
if (flags & 256) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async");
}
else if (flags & 2 || node.parent.flags & 4194304) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async");
}
- else if (node.kind === 151) {
+ else if (node.kind === 152) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async");
}
flags |= 256;
@@ -49662,7 +50382,7 @@
break;
}
}
- if (node.kind === 157) {
+ if (node.kind === 158) {
if (flags & 32) {
return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static");
}
@@ -49677,13 +50397,13 @@
}
return false;
}
- else if ((node.kind === 249 || node.kind === 248) && flags & 2) {
+ else if ((node.kind === 250 || node.kind === 249) && flags & 2) {
return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare");
}
- else if (node.kind === 151 && (flags & 92) && ts.isBindingPattern(node.name)) {
+ else if (node.kind === 152 && (flags & 92) && ts.isBindingPattern(node.name)) {
return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern);
}
- else if (node.kind === 151 && (flags & 92) && node.dotDotDotToken) {
+ else if (node.kind === 152 && (flags & 92) && node.dotDotDotToken) {
return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter);
}
if (flags & 256) {
@@ -49700,38 +50420,38 @@
}
function shouldReportBadModifier(node) {
switch (node.kind) {
- case 158:
case 159:
- case 157:
+ case 160:
+ case 158:
+ case 155:
case 154:
- case 153:
+ case 157:
case 156:
- case 155:
- case 162:
- case 244:
+ case 163:
+ case 245:
+ case 250:
case 249:
- case 248:
+ case 256:
case 255:
- case 254:
- case 196:
case 197:
- case 151:
+ case 198:
+ case 152:
return false;
default:
- if (node.parent.kind === 245 || node.parent.kind === 284) {
+ if (node.parent.kind === 246 || node.parent.kind === 285) {
return false;
}
switch (node.kind) {
- case 239:
- return nodeHasAnyModifiersExcept(node, 121);
case 240:
- return nodeHasAnyModifiersExcept(node, 118);
+ return nodeHasAnyModifiersExcept(node, 122);
case 241:
- case 219:
+ return nodeHasAnyModifiersExcept(node, 119);
case 242:
- return true;
+ case 220:
case 243:
- return nodeHasAnyModifiersExcept(node, 77);
+ return true;
+ case 244:
+ return nodeHasAnyModifiersExcept(node, 78);
default:
ts.Debug.fail();
return false;
@@ -49743,10 +50463,10 @@
}
function checkGrammarAsyncModifier(node, asyncModifier) {
switch (node.kind) {
- case 156:
- case 239:
- case 196:
+ case 157:
+ case 240:
case 197:
+ case 198:
return false;
}
return grammarErrorOnNode(asyncModifier, ts.Diagnostics._0_modifier_cannot_be_used_here, "async");
@@ -49860,10 +50580,10 @@
if (!parameter.type) {
return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation);
}
- if (parameter.type.kind !== 138 && parameter.type.kind !== 135) {
+ if (parameter.type.kind !== 139 && parameter.type.kind !== 136) {
var type = getTypeFromTypeNode(parameter.type);
if (type.flags & 4 || type.flags & 8) {
- return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_cannot_be_a_type_alias_Consider_writing_0_Colon_1_Colon_2_instead, ts.getTextOfNode(parameter.name), typeToString(type), typeToString(getTypeFromTypeNode(node.type)));
+ return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_cannot_be_a_type_alias_Consider_writing_0_Colon_1_Colon_2_instead, ts.getTextOfNode(parameter.name), typeToString(type), typeToString(node.type ? getTypeFromTypeNode(node.type) : anyType));
}
if (type.flags & 1048576 && allTypesAssignableToKind(type, 128, true)) {
return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_cannot_be_a_union_type_Consider_using_a_mapped_object_type_instead);
@@ -49893,9 +50613,9 @@
}
function checkGrammarForOmittedArgument(args) {
if (args) {
- for (var _i = 0, args_5 = args; _i < args_5.length; _i++) {
- var arg = args_5[_i];
- if (arg.kind === 210) {
+ for (var _i = 0, args_4 = args; _i < args_4.length; _i++) {
+ var arg = args_4[_i];
+ if (arg.kind === 211) {
return grammarErrorAtPos(arg, arg.pos, 0, ts.Diagnostics.Argument_expression_expected);
}
}
@@ -49925,7 +50645,7 @@
if (!checkGrammarDecoratorsAndModifiers(node) && node.heritageClauses) {
for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) {
var heritageClause = _a[_i];
- if (heritageClause.token === 86) {
+ if (heritageClause.token === 87) {
if (seenExtendsClause) {
return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen);
}
@@ -49938,7 +50658,7 @@
seenExtendsClause = true;
}
else {
- ts.Debug.assert(heritageClause.token === 109);
+ ts.Debug.assert(heritageClause.token === 110);
if (seenImplementsClause) {
return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.implements_clause_already_seen);
}
@@ -49953,14 +50673,14 @@
if (node.heritageClauses) {
for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) {
var heritageClause = _a[_i];
- if (heritageClause.token === 86) {
+ if (heritageClause.token === 87) {
if (seenExtendsClause) {
return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen);
}
seenExtendsClause = true;
}
else {
- ts.Debug.assert(heritageClause.token === 109);
+ ts.Debug.assert(heritageClause.token === 110);
return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.Interface_declaration_cannot_have_implements_clause);
}
checkGrammarHeritageClause(heritageClause);
@@ -49969,20 +50689,20 @@
return false;
}
function checkGrammarComputedPropertyName(node) {
- if (node.kind !== 149) {
+ if (node.kind !== 150) {
return false;
}
var computedPropertyName = node;
- if (computedPropertyName.expression.kind === 204 && computedPropertyName.expression.operatorToken.kind === 27) {
+ if (computedPropertyName.expression.kind === 205 && computedPropertyName.expression.operatorToken.kind === 27) {
return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name);
}
return false;
}
function checkGrammarForGenerator(node) {
if (node.asteriskToken) {
- ts.Debug.assert(node.kind === 239 ||
- node.kind === 196 ||
- node.kind === 156);
+ ts.Debug.assert(node.kind === 240 ||
+ node.kind === 197 ||
+ node.kind === 157);
if (node.flags & 4194304) {
return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context);
}
@@ -50001,40 +50721,46 @@
var seen = ts.createUnderscoreEscapedMap();
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var prop = _a[_i];
- if (prop.kind === 277) {
+ if (prop.kind === 278) {
+ if (inDestructuring) {
+ var expression = ts.skipParentheses(prop.expression);
+ if (ts.isArrayLiteralExpression(expression) || ts.isObjectLiteralExpression(expression)) {
+ return grammarErrorOnNode(prop.expression, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern);
+ }
+ }
continue;
}
var name = prop.name;
- if (name.kind === 149) {
+ if (name.kind === 150) {
checkGrammarComputedPropertyName(name);
}
- if (prop.kind === 276 && !inDestructuring && prop.objectAssignmentInitializer) {
+ if (prop.kind === 277 && !inDestructuring && prop.objectAssignmentInitializer) {
return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment);
}
if (prop.modifiers) {
for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) {
var mod = _c[_b];
- if (mod.kind !== 121 || prop.kind !== 156) {
+ if (mod.kind !== 122 || prop.kind !== 157) {
grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod));
}
}
}
var currentKind = void 0;
switch (prop.kind) {
- case 276:
+ case 277:
checkGrammarForInvalidExclamationToken(prop.exclamationToken, ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context);
- case 275:
+ case 276:
checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional);
if (name.kind === 8) {
checkGrammarNumericLiteral(name);
}
- case 156:
+ case 157:
currentKind = 1;
break;
- case 158:
+ case 159:
currentKind = 2;
break;
- case 159:
+ case 160:
currentKind = 4;
break;
default:
@@ -50071,7 +50797,7 @@
var seen = ts.createUnderscoreEscapedMap();
for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) {
var attr = _a[_i];
- if (attr.kind === 269) {
+ if (attr.kind === 270) {
continue;
}
var name = attr.name, initializer = attr.initializer;
@@ -50081,7 +50807,7 @@
else {
return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name);
}
- if (initializer && initializer.kind === 270 && !initializer.expression) {
+ if (initializer && initializer.kind === 271 && !initializer.expression) {
return grammarErrorOnNode(initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression);
}
}
@@ -50090,12 +50816,24 @@
if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) {
return true;
}
- if (forInOrOfStatement.kind === 227 && forInOrOfStatement.awaitModifier) {
+ if (forInOrOfStatement.kind === 228 && forInOrOfStatement.awaitModifier) {
if ((forInOrOfStatement.flags & 16384) === 0) {
- return grammarErrorOnNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator);
+ var sourceFile = ts.getSourceFileOfNode(forInOrOfStatement);
+ if (!hasParseDiagnostics(sourceFile)) {
+ var diagnostic = ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator);
+ var func = ts.getContainingFunction(forInOrOfStatement);
+ if (func && func.kind !== 158) {
+ ts.Debug.assert((ts.getFunctionFlags(func) & 2) === 0, "Enclosing function should never be an async function.");
+ var relatedInfo = ts.createDiagnosticForNode(func, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async);
+ ts.addRelatedInfo(diagnostic, relatedInfo);
+ }
+ diagnostics.add(diagnostic);
+ return true;
+ }
+ return false;
}
}
- if (forInOrOfStatement.initializer.kind === 238) {
+ if (forInOrOfStatement.initializer.kind === 239) {
var variableList = forInOrOfStatement.initializer;
if (!checkGrammarVariableDeclarationList(variableList)) {
var declarations = variableList.declarations;
@@ -50103,20 +50841,20 @@
return false;
}
if (declarations.length > 1) {
- var diagnostic = forInOrOfStatement.kind === 226
+ var diagnostic = forInOrOfStatement.kind === 227
? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement
: ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement;
return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic);
}
var firstDeclaration = declarations[0];
if (firstDeclaration.initializer) {
- var diagnostic = forInOrOfStatement.kind === 226
+ var diagnostic = forInOrOfStatement.kind === 227
? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer
: ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer;
return grammarErrorOnNode(firstDeclaration.name, diagnostic);
}
if (firstDeclaration.type) {
- var diagnostic = forInOrOfStatement.kind === 226
+ var diagnostic = forInOrOfStatement.kind === 227
? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation
: ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation;
return grammarErrorOnNode(firstDeclaration, diagnostic);
@@ -50143,11 +50881,11 @@
return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters);
}
else if (!doesAccessorHaveCorrectParameterCount(accessor)) {
- return grammarErrorOnNode(accessor.name, kind === 158 ?
+ return grammarErrorOnNode(accessor.name, kind === 159 ?
ts.Diagnostics.A_get_accessor_cannot_have_parameters :
ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter);
}
- else if (kind === 159) {
+ else if (kind === 160) {
if (accessor.type) {
return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation);
}
@@ -50167,23 +50905,23 @@
return false;
}
function doesAccessorHaveCorrectParameterCount(accessor) {
- return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 158 ? 0 : 1);
+ return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 159 ? 0 : 1);
}
function getAccessorThisParameter(accessor) {
- if (accessor.parameters.length === (accessor.kind === 158 ? 1 : 2)) {
+ if (accessor.parameters.length === (accessor.kind === 159 ? 1 : 2)) {
return ts.getThisParameter(accessor);
}
}
function checkGrammarTypeOperatorNode(node) {
- if (node.operator === 142) {
- if (node.type.kind !== 139) {
- return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(139));
+ if (node.operator === 143) {
+ if (node.type.kind !== 140) {
+ return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(140));
}
var parent = ts.walkUpParenthesizedTypes(node.parent);
switch (parent.kind) {
- case 237:
+ case 238:
var decl = parent;
- if (decl.name.kind !== 72) {
+ if (decl.name.kind !== 73) {
return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name);
}
if (!ts.isVariableDeclarationInVariableStatement(decl)) {
@@ -50193,13 +50931,13 @@
return grammarErrorOnNode(parent.name, ts.Diagnostics.A_variable_whose_type_is_a_unique_symbol_type_must_be_const);
}
break;
- case 154:
+ case 155:
if (!ts.hasModifier(parent, 32) ||
!ts.hasModifier(parent, 64)) {
return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly);
}
break;
- case 153:
+ case 154:
if (!ts.hasModifier(parent, 64)) {
return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly);
}
@@ -50208,9 +50946,9 @@
return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_are_not_allowed_here);
}
}
- else if (node.operator === 133) {
- if (node.type.kind !== 169 && node.type.kind !== 170) {
- return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(139));
+ else if (node.operator === 134) {
+ if (node.type.kind !== 170 && node.type.kind !== 171) {
+ return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(140));
}
}
}
@@ -50223,9 +50961,9 @@
if (checkGrammarFunctionLikeDeclaration(node)) {
return true;
}
- if (node.kind === 156) {
- if (node.parent.kind === 188) {
- if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 121)) {
+ if (node.kind === 157) {
+ if (node.parent.kind === 189) {
+ if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 122)) {
return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here);
}
else if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) {
@@ -50238,6 +50976,9 @@
return grammarErrorAtPos(node, node.end - 1, ";".length, ts.Diagnostics._0_expected, "{");
}
}
+ else if (ts.isClassLike(node.parent) && ts.isStringLiteral(node.name) && node.name.text === "constructor" && (!compilerOptions.target || compilerOptions.target < 1)) {
+ return grammarErrorOnNode(node.name, ts.Diagnostics.Quoted_constructors_have_previously_been_interpreted_as_methods_which_is_incorrect_In_TypeScript_3_6_they_will_be_correctly_parsed_as_constructors_In_the_meantime_consider_using_constructor_to_write_a_constructor_or_constructor_to_write_a_method);
+ }
if (checkGrammarForGenerator(node)) {
return true;
}
@@ -50246,14 +50987,14 @@
if (node.flags & 4194304) {
return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type);
}
- else if (node.kind === 156 && !node.body) {
+ else if (node.kind === 157 && !node.body) {
return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type);
}
}
- else if (node.parent.kind === 241) {
+ else if (node.parent.kind === 242) {
return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type);
}
- else if (node.parent.kind === 168) {
+ else if (node.parent.kind === 169) {
return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type);
}
}
@@ -50264,9 +51005,9 @@
return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary);
}
switch (current.kind) {
- case 233:
+ case 234:
if (node.label && current.label.escapedText === node.label.escapedText) {
- var isMisplacedContinueLabel = node.kind === 228
+ var isMisplacedContinueLabel = node.kind === 229
&& !ts.isIterationStatement(current.statement, true);
if (isMisplacedContinueLabel) {
return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement);
@@ -50274,8 +51015,8 @@
return false;
}
break;
- case 232:
- if (node.kind === 229 && !node.label) {
+ case 233:
+ if (node.kind === 230 && !node.label) {
return false;
}
break;
@@ -50288,13 +51029,13 @@
current = current.parent;
}
if (node.label) {
- var message = node.kind === 229
+ var message = node.kind === 230
? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement
: ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement;
return grammarErrorOnNode(node, message);
}
else {
- var message = node.kind === 229
+ var message = node.kind === 230
? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement
: ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement;
return grammarErrorOnNode(node, message);
@@ -50317,12 +51058,12 @@
}
function isStringOrNumberLiteralExpression(expr) {
return expr.kind === 10 || expr.kind === 8 ||
- expr.kind === 202 && expr.operator === 39 &&
+ expr.kind === 203 && expr.operator === 39 &&
expr.operand.kind === 8;
}
function isBigIntLiteralExpression(expr) {
return expr.kind === 9 ||
- expr.kind === 202 && expr.operator === 39 &&
+ expr.kind === 203 && expr.operator === 39 &&
expr.operand.kind === 9;
}
function isSimpleLiteralEnumReference(expr) {
@@ -50335,7 +51076,7 @@
if (initializer) {
var isInvalidInitializer = !(isStringOrNumberLiteralExpression(initializer) ||
isSimpleLiteralEnumReference(initializer) ||
- initializer.kind === 102 || initializer.kind === 87 ||
+ initializer.kind === 103 || initializer.kind === 88 ||
isBigIntLiteralExpression(initializer));
var isConstOrReadonly = ts.isDeclarationReadonly(node) || ts.isVariableDeclaration(node) && ts.isVarConst(node);
if (isConstOrReadonly && !node.type) {
@@ -50352,7 +51093,7 @@
}
}
function checkGrammarVariableDeclaration(node) {
- if (node.parent.parent.kind !== 226 && node.parent.parent.kind !== 227) {
+ if (node.parent.parent.kind !== 227 && node.parent.parent.kind !== 228) {
if (node.flags & 4194304) {
checkAmbientInitializer(node);
}
@@ -50365,8 +51106,8 @@
}
}
}
- if (node.exclamationToken && (node.parent.parent.kind !== 219 || !node.type || node.initializer || node.flags & 4194304)) {
- return grammarErrorOnNode(node.exclamationToken, ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context);
+ if (node.exclamationToken && (node.parent.parent.kind !== 220 || !node.type || node.initializer || node.flags & 4194304)) {
+ return grammarErrorOnNode(node.exclamationToken, ts.Diagnostics.Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation);
}
if (compilerOptions.module !== ts.ModuleKind.ES2015 && compilerOptions.module !== ts.ModuleKind.ESNext && compilerOptions.module !== ts.ModuleKind.System && !compilerOptions.noEmit &&
!(node.parent.parent.flags & 4194304) && ts.hasModifier(node.parent.parent, 1)) {
@@ -50376,7 +51117,7 @@
return checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name);
}
function checkESModuleMarker(name) {
- if (name.kind === 72) {
+ if (name.kind === 73) {
if (ts.idText(name) === "__esModule") {
return grammarErrorOnNode(name, ts.Diagnostics.Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules);
}
@@ -50393,8 +51134,8 @@
return false;
}
function checkGrammarNameInLetOrConstDeclarations(name) {
- if (name.kind === 72) {
- if (name.originalKeywordKind === 111) {
+ if (name.kind === 73) {
+ if (name.originalKeywordKind === 112) {
return grammarErrorOnNode(name, ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations);
}
}
@@ -50421,15 +51162,15 @@
}
function allowLetAndConstDeclarations(parent) {
switch (parent.kind) {
- case 222:
case 223:
case 224:
- case 231:
case 225:
+ case 232:
case 226:
case 227:
+ case 228:
return false;
- case 233:
+ case 234:
return allowLetAndConstDeclarations(parent.parent);
}
return true;
@@ -50447,12 +51188,12 @@
function checkGrammarMetaProperty(node) {
var escapedText = node.name.escapedText;
switch (node.keywordToken) {
- case 95:
+ case 96:
if (escapedText !== "target") {
return grammarErrorOnNode(node.name, ts.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.escapedText, ts.tokenToString(node.keywordToken), "target");
}
break;
- case 92:
+ case 93:
if (escapedText !== "meta") {
return grammarErrorOnNode(node.name, ts.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.escapedText, ts.tokenToString(node.keywordToken), "meta");
}
@@ -50503,11 +51244,14 @@
}
function checkGrammarProperty(node) {
if (ts.isClassLike(node.parent)) {
+ if (ts.isStringLiteral(node.name) && node.name.text === "constructor") {
+ return grammarErrorOnNode(node.name, ts.Diagnostics.Classes_may_not_have_a_field_named_constructor);
+ }
if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) {
return true;
}
}
- else if (node.parent.kind === 241) {
+ else if (node.parent.kind === 242) {
if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) {
return true;
}
@@ -50515,7 +51259,7 @@
return grammarErrorOnNode(node.initializer, ts.Diagnostics.An_interface_property_cannot_have_an_initializer);
}
}
- else if (node.parent.kind === 168) {
+ else if (node.parent.kind === 169) {
if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) {
return true;
}
@@ -50532,22 +51276,22 @@
}
}
function checkGrammarTopLevelElementForRequiredDeclareModifier(node) {
- if (node.kind === 241 ||
- node.kind === 242 ||
+ if (node.kind === 242 ||
+ node.kind === 243 ||
+ node.kind === 250 ||
node.kind === 249 ||
- node.kind === 248 ||
+ node.kind === 256 ||
node.kind === 255 ||
- node.kind === 254 ||
- node.kind === 247 ||
+ node.kind === 248 ||
ts.hasModifier(node, 2 | 1 | 512)) {
return false;
}
- return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file);
+ return grammarErrorOnFirstToken(node, ts.Diagnostics.Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier);
}
function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) {
for (var _i = 0, _a = file.statements; _i < _a.length; _i++) {
var decl = _a[_i];
- if (ts.isDeclaration(decl) || decl.kind === 219) {
+ if (ts.isDeclaration(decl) || decl.kind === 220) {
if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) {
return true;
}
@@ -50567,7 +51311,7 @@
if (!links.hasReportedStatementInAmbientContext && ts.isFunctionLike(node.parent)) {
return getNodeLinks(node).hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.An_implementation_cannot_be_declared_in_ambient_contexts);
}
- if (node.parent.kind === 218 || node.parent.kind === 245 || node.parent.kind === 284) {
+ if (node.parent.kind === 219 || node.parent.kind === 246 || node.parent.kind === 285) {
var links_2 = getNodeLinks(node.parent);
if (!links_2.hasReportedStatementInAmbientContext) {
return links_2.hasReportedStatementInAmbientContext = grammarErrorOnFirstToken(node, ts.Diagnostics.Statements_are_not_allowed_in_ambient_contexts);
@@ -50584,10 +51328,10 @@
if (languageVersion >= 1) {
diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0;
}
- else if (ts.isChildOfNodeWithKind(node, 182)) {
+ else if (ts.isChildOfNodeWithKind(node, 183)) {
diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0;
}
- else if (ts.isChildOfNodeWithKind(node, 278)) {
+ else if (ts.isChildOfNodeWithKind(node, 279)) {
diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0;
}
if (diagnosticMessage) {
@@ -50602,7 +51346,7 @@
var literalType = ts.isLiteralTypeNode(node.parent) ||
ts.isPrefixUnaryExpression(node.parent) && ts.isLiteralTypeNode(node.parent.parent);
if (!literalType) {
- if (languageVersion < 7) {
+ if (languageVersion < 8) {
if (grammarErrorOnNode(node, ts.Diagnostics.BigInt_literals_are_not_available_when_targeting_lower_than_ESNext)) {
return true;
}
@@ -50651,8 +51395,8 @@
ts.createTypeChecker = createTypeChecker;
function isDeclarationNameOrImportPropertyName(name) {
switch (name.parent.kind) {
- case 253:
- case 257:
+ case 254:
+ case 258:
return ts.isIdentifier(name);
default:
return ts.isDeclarationName(name);
@@ -50660,13 +51404,13 @@
}
function isSomeImportDeclaration(decl) {
switch (decl.kind) {
- case 250:
- case 248:
case 251:
- case 253:
+ case 249:
+ case 252:
+ case 254:
return true;
- case 72:
- return decl.parent.kind === 253;
+ case 73:
+ return decl.parent.kind === 254;
default:
return false;
}
@@ -50781,7 +51525,7 @@
return node;
}
function createIdentifier(text, typeArguments) {
- var node = createSynthesizedNode(72);
+ var node = createSynthesizedNode(73);
node.escapedText = ts.escapeLeadingUnderscores(text);
node.originalKeywordKind = text ? ts.stringToToken(text) : 0;
node.autoGenerateFlags = 0;
@@ -50857,23 +51601,23 @@
}
ts.createToken = createToken;
function createSuper() {
- return createSynthesizedNode(98);
+ return createSynthesizedNode(99);
}
ts.createSuper = createSuper;
function createThis() {
- return createSynthesizedNode(100);
+ return createSynthesizedNode(101);
}
ts.createThis = createThis;
function createNull() {
- return createSynthesizedNode(96);
+ return createSynthesizedNode(97);
}
ts.createNull = createNull;
function createTrue() {
- return createSynthesizedNode(102);
+ return createSynthesizedNode(103);
}
ts.createTrue = createTrue;
function createFalse() {
- return createSynthesizedNode(87);
+ return createSynthesizedNode(88);
}
ts.createFalse = createFalse;
function createModifier(kind) {
@@ -50883,43 +51627,43 @@
function createModifiersFromModifierFlags(flags) {
var result = [];
if (flags & 1) {
- result.push(createModifier(85));
+ result.push(createModifier(86));
}
if (flags & 2) {
- result.push(createModifier(125));
+ result.push(createModifier(126));
}
if (flags & 512) {
- result.push(createModifier(80));
+ result.push(createModifier(81));
}
if (flags & 2048) {
- result.push(createModifier(77));
+ result.push(createModifier(78));
}
if (flags & 4) {
- result.push(createModifier(115));
+ result.push(createModifier(116));
}
if (flags & 8) {
- result.push(createModifier(113));
+ result.push(createModifier(114));
}
if (flags & 16) {
- result.push(createModifier(114));
+ result.push(createModifier(115));
}
if (flags & 128) {
- result.push(createModifier(118));
+ result.push(createModifier(119));
}
if (flags & 32) {
- result.push(createModifier(116));
+ result.push(createModifier(117));
}
if (flags & 64) {
- result.push(createModifier(133));
+ result.push(createModifier(134));
}
if (flags & 256) {
- result.push(createModifier(121));
+ result.push(createModifier(122));
}
return result;
}
ts.createModifiersFromModifierFlags = createModifiersFromModifierFlags;
function createQualifiedName(left, right) {
- var node = createSynthesizedNode(148);
+ var node = createSynthesizedNode(149);
node.left = left;
node.right = asName(right);
return node;
@@ -50938,7 +51682,7 @@
: expression;
}
function createComputedPropertyName(expression) {
- var node = createSynthesizedNode(149);
+ var node = createSynthesizedNode(150);
node.expression = parenthesizeForComputedName(expression);
return node;
}
@@ -50950,7 +51694,7 @@
}
ts.updateComputedPropertyName = updateComputedPropertyName;
function createTypeParameterDeclaration(name, constraint, defaultType) {
- var node = createSynthesizedNode(150);
+ var node = createSynthesizedNode(151);
node.name = asName(name);
node.constraint = constraint;
node.default = defaultType;
@@ -50966,7 +51710,7 @@
}
ts.updateTypeParameterDeclaration = updateTypeParameterDeclaration;
function createParameter(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer) {
- var node = createSynthesizedNode(151);
+ var node = createSynthesizedNode(152);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.dotDotDotToken = dotDotDotToken;
@@ -50990,7 +51734,7 @@
}
ts.updateParameter = updateParameter;
function createDecorator(expression) {
- var node = createSynthesizedNode(152);
+ var node = createSynthesizedNode(153);
node.expression = ts.parenthesizeForAccess(expression);
return node;
}
@@ -51002,7 +51746,7 @@
}
ts.updateDecorator = updateDecorator;
function createPropertySignature(modifiers, name, questionToken, type, initializer) {
- var node = createSynthesizedNode(153);
+ var node = createSynthesizedNode(154);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
node.questionToken = questionToken;
@@ -51022,7 +51766,7 @@
}
ts.updatePropertySignature = updatePropertySignature;
function createProperty(decorators, modifiers, name, questionOrExclamationToken, type, initializer) {
- var node = createSynthesizedNode(154);
+ var node = createSynthesizedNode(155);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -51046,7 +51790,7 @@
}
ts.updateProperty = updateProperty;
function createMethodSignature(typeParameters, parameters, type, name, questionToken) {
- var node = createSignatureDeclaration(155, typeParameters, parameters, type);
+ var node = createSignatureDeclaration(156, typeParameters, parameters, type);
node.name = asName(name);
node.questionToken = questionToken;
return node;
@@ -51063,7 +51807,7 @@
}
ts.updateMethodSignature = updateMethodSignature;
function createMethod(decorators, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) {
- var node = createSynthesizedNode(156);
+ var node = createSynthesizedNode(157);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.asteriskToken = asteriskToken;
@@ -51091,7 +51835,7 @@
}
ts.updateMethod = updateMethod;
function createConstructor(decorators, modifiers, parameters, body) {
- var node = createSynthesizedNode(157);
+ var node = createSynthesizedNode(158);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.typeParameters = undefined;
@@ -51111,7 +51855,7 @@
}
ts.updateConstructor = updateConstructor;
function createGetAccessor(decorators, modifiers, name, parameters, type, body) {
- var node = createSynthesizedNode(158);
+ var node = createSynthesizedNode(159);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -51134,7 +51878,7 @@
}
ts.updateGetAccessor = updateGetAccessor;
function createSetAccessor(decorators, modifiers, name, parameters, body) {
- var node = createSynthesizedNode(159);
+ var node = createSynthesizedNode(160);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -51155,7 +51899,7 @@
}
ts.updateSetAccessor = updateSetAccessor;
function createCallSignature(typeParameters, parameters, type) {
- return createSignatureDeclaration(160, typeParameters, parameters, type);
+ return createSignatureDeclaration(161, typeParameters, parameters, type);
}
ts.createCallSignature = createCallSignature;
function updateCallSignature(node, typeParameters, parameters, type) {
@@ -51163,7 +51907,7 @@
}
ts.updateCallSignature = updateCallSignature;
function createConstructSignature(typeParameters, parameters, type) {
- return createSignatureDeclaration(161, typeParameters, parameters, type);
+ return createSignatureDeclaration(162, typeParameters, parameters, type);
}
ts.createConstructSignature = createConstructSignature;
function updateConstructSignature(node, typeParameters, parameters, type) {
@@ -51171,7 +51915,7 @@
}
ts.updateConstructSignature = updateConstructSignature;
function createIndexSignature(decorators, modifiers, parameters, type) {
- var node = createSynthesizedNode(162);
+ var node = createSynthesizedNode(163);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.parameters = createNodeArray(parameters);
@@ -51209,7 +51953,7 @@
}
ts.createKeywordTypeNode = createKeywordTypeNode;
function createTypePredicateNode(parameterName, type) {
- var node = createSynthesizedNode(163);
+ var node = createSynthesizedNode(164);
node.parameterName = asName(parameterName);
node.type = type;
return node;
@@ -51223,7 +51967,7 @@
}
ts.updateTypePredicateNode = updateTypePredicateNode;
function createTypeReferenceNode(typeName, typeArguments) {
- var node = createSynthesizedNode(164);
+ var node = createSynthesizedNode(165);
node.typeName = asName(typeName);
node.typeArguments = typeArguments && ts.parenthesizeTypeParameters(typeArguments);
return node;
@@ -51237,7 +51981,7 @@
}
ts.updateTypeReferenceNode = updateTypeReferenceNode;
function createFunctionTypeNode(typeParameters, parameters, type) {
- return createSignatureDeclaration(165, typeParameters, parameters, type);
+ return createSignatureDeclaration(166, typeParameters, parameters, type);
}
ts.createFunctionTypeNode = createFunctionTypeNode;
function updateFunctionTypeNode(node, typeParameters, parameters, type) {
@@ -51245,7 +51989,7 @@
}
ts.updateFunctionTypeNode = updateFunctionTypeNode;
function createConstructorTypeNode(typeParameters, parameters, type) {
- return createSignatureDeclaration(166, typeParameters, parameters, type);
+ return createSignatureDeclaration(167, typeParameters, parameters, type);
}
ts.createConstructorTypeNode = createConstructorTypeNode;
function updateConstructorTypeNode(node, typeParameters, parameters, type) {
@@ -51253,7 +51997,7 @@
}
ts.updateConstructorTypeNode = updateConstructorTypeNode;
function createTypeQueryNode(exprName) {
- var node = createSynthesizedNode(167);
+ var node = createSynthesizedNode(168);
node.exprName = exprName;
return node;
}
@@ -51265,7 +52009,7 @@
}
ts.updateTypeQueryNode = updateTypeQueryNode;
function createTypeLiteralNode(members) {
- var node = createSynthesizedNode(168);
+ var node = createSynthesizedNode(169);
node.members = createNodeArray(members);
return node;
}
@@ -51277,7 +52021,7 @@
}
ts.updateTypeLiteralNode = updateTypeLiteralNode;
function createArrayTypeNode(elementType) {
- var node = createSynthesizedNode(169);
+ var node = createSynthesizedNode(170);
node.elementType = ts.parenthesizeArrayTypeMember(elementType);
return node;
}
@@ -51289,7 +52033,7 @@
}
ts.updateArrayTypeNode = updateArrayTypeNode;
function createTupleTypeNode(elementTypes) {
- var node = createSynthesizedNode(170);
+ var node = createSynthesizedNode(171);
node.elementTypes = createNodeArray(elementTypes);
return node;
}
@@ -51301,7 +52045,7 @@
}
ts.updateTupleTypeNode = updateTupleTypeNode;
function createOptionalTypeNode(type) {
- var node = createSynthesizedNode(171);
+ var node = createSynthesizedNode(172);
node.type = ts.parenthesizeArrayTypeMember(type);
return node;
}
@@ -51313,7 +52057,7 @@
}
ts.updateOptionalTypeNode = updateOptionalTypeNode;
function createRestTypeNode(type) {
- var node = createSynthesizedNode(172);
+ var node = createSynthesizedNode(173);
node.type = type;
return node;
}
@@ -51325,7 +52069,7 @@
}
ts.updateRestTypeNode = updateRestTypeNode;
function createUnionTypeNode(types) {
- return createUnionOrIntersectionTypeNode(173, types);
+ return createUnionOrIntersectionTypeNode(174, types);
}
ts.createUnionTypeNode = createUnionTypeNode;
function updateUnionTypeNode(node, types) {
@@ -51333,7 +52077,7 @@
}
ts.updateUnionTypeNode = updateUnionTypeNode;
function createIntersectionTypeNode(types) {
- return createUnionOrIntersectionTypeNode(174, types);
+ return createUnionOrIntersectionTypeNode(175, types);
}
ts.createIntersectionTypeNode = createIntersectionTypeNode;
function updateIntersectionTypeNode(node, types) {
@@ -51352,7 +52096,7 @@
: node;
}
function createConditionalTypeNode(checkType, extendsType, trueType, falseType) {
- var node = createSynthesizedNode(175);
+ var node = createSynthesizedNode(176);
node.checkType = ts.parenthesizeConditionalTypeMember(checkType);
node.extendsType = ts.parenthesizeConditionalTypeMember(extendsType);
node.trueType = trueType;
@@ -51370,7 +52114,7 @@
}
ts.updateConditionalTypeNode = updateConditionalTypeNode;
function createInferTypeNode(typeParameter) {
- var node = createSynthesizedNode(176);
+ var node = createSynthesizedNode(177);
node.typeParameter = typeParameter;
return node;
}
@@ -51382,10 +52126,10 @@
}
ts.updateInferTypeNode = updateInferTypeNode;
function createImportTypeNode(argument, qualifier, typeArguments, isTypeOf) {
- var node = createSynthesizedNode(183);
+ var node = createSynthesizedNode(184);
node.argument = argument;
node.qualifier = qualifier;
- node.typeArguments = asNodeArray(typeArguments);
+ node.typeArguments = ts.parenthesizeTypeParameters(typeArguments);
node.isTypeOf = isTypeOf;
return node;
}
@@ -51400,7 +52144,7 @@
}
ts.updateImportTypeNode = updateImportTypeNode;
function createParenthesizedType(type) {
- var node = createSynthesizedNode(177);
+ var node = createSynthesizedNode(178);
node.type = type;
return node;
}
@@ -51412,12 +52156,12 @@
}
ts.updateParenthesizedType = updateParenthesizedType;
function createThisTypeNode() {
- return createSynthesizedNode(178);
+ return createSynthesizedNode(179);
}
ts.createThisTypeNode = createThisTypeNode;
function createTypeOperatorNode(operatorOrType, type) {
- var node = createSynthesizedNode(179);
- node.operator = typeof operatorOrType === "number" ? operatorOrType : 129;
+ var node = createSynthesizedNode(180);
+ node.operator = typeof operatorOrType === "number" ? operatorOrType : 130;
node.type = ts.parenthesizeElementTypeMember(typeof operatorOrType === "number" ? type : operatorOrType);
return node;
}
@@ -51427,7 +52171,7 @@
}
ts.updateTypeOperatorNode = updateTypeOperatorNode;
function createIndexedAccessTypeNode(objectType, indexType) {
- var node = createSynthesizedNode(180);
+ var node = createSynthesizedNode(181);
node.objectType = ts.parenthesizeElementTypeMember(objectType);
node.indexType = indexType;
return node;
@@ -51441,7 +52185,7 @@
}
ts.updateIndexedAccessTypeNode = updateIndexedAccessTypeNode;
function createMappedTypeNode(readonlyToken, typeParameter, questionToken, type) {
- var node = createSynthesizedNode(181);
+ var node = createSynthesizedNode(182);
node.readonlyToken = readonlyToken;
node.typeParameter = typeParameter;
node.questionToken = questionToken;
@@ -51459,7 +52203,7 @@
}
ts.updateMappedTypeNode = updateMappedTypeNode;
function createLiteralTypeNode(literal) {
- var node = createSynthesizedNode(182);
+ var node = createSynthesizedNode(183);
node.literal = literal;
return node;
}
@@ -51471,7 +52215,7 @@
}
ts.updateLiteralTypeNode = updateLiteralTypeNode;
function createObjectBindingPattern(elements) {
- var node = createSynthesizedNode(184);
+ var node = createSynthesizedNode(185);
node.elements = createNodeArray(elements);
return node;
}
@@ -51483,7 +52227,7 @@
}
ts.updateObjectBindingPattern = updateObjectBindingPattern;
function createArrayBindingPattern(elements) {
- var node = createSynthesizedNode(185);
+ var node = createSynthesizedNode(186);
node.elements = createNodeArray(elements);
return node;
}
@@ -51495,7 +52239,7 @@
}
ts.updateArrayBindingPattern = updateArrayBindingPattern;
function createBindingElement(dotDotDotToken, propertyName, name, initializer) {
- var node = createSynthesizedNode(186);
+ var node = createSynthesizedNode(187);
node.dotDotDotToken = dotDotDotToken;
node.propertyName = asName(propertyName);
node.name = asName(name);
@@ -51513,7 +52257,7 @@
}
ts.updateBindingElement = updateBindingElement;
function createArrayLiteral(elements, multiLine) {
- var node = createSynthesizedNode(187);
+ var node = createSynthesizedNode(188);
node.elements = ts.parenthesizeListElements(createNodeArray(elements));
if (multiLine)
node.multiLine = true;
@@ -51527,7 +52271,7 @@
}
ts.updateArrayLiteral = updateArrayLiteral;
function createObjectLiteral(properties, multiLine) {
- var node = createSynthesizedNode(188);
+ var node = createSynthesizedNode(189);
node.properties = createNodeArray(properties);
if (multiLine)
node.multiLine = true;
@@ -51541,7 +52285,7 @@
}
ts.updateObjectLiteral = updateObjectLiteral;
function createPropertyAccess(expression, name) {
- var node = createSynthesizedNode(189);
+ var node = createSynthesizedNode(190);
node.expression = ts.parenthesizeForAccess(expression);
node.name = asName(name);
setEmitFlags(node, 131072);
@@ -51556,7 +52300,7 @@
}
ts.updatePropertyAccess = updatePropertyAccess;
function createElementAccess(expression, index) {
- var node = createSynthesizedNode(190);
+ var node = createSynthesizedNode(191);
node.expression = ts.parenthesizeForAccess(expression);
node.argumentExpression = asExpression(index);
return node;
@@ -51570,7 +52314,7 @@
}
ts.updateElementAccess = updateElementAccess;
function createCall(expression, typeArguments, argumentsArray) {
- var node = createSynthesizedNode(191);
+ var node = createSynthesizedNode(192);
node.expression = ts.parenthesizeForAccess(expression);
node.typeArguments = asNodeArray(typeArguments);
node.arguments = ts.parenthesizeListElements(createNodeArray(argumentsArray));
@@ -51586,7 +52330,7 @@
}
ts.updateCall = updateCall;
function createNew(expression, typeArguments, argumentsArray) {
- var node = createSynthesizedNode(192);
+ var node = createSynthesizedNode(193);
node.expression = ts.parenthesizeForNew(expression);
node.typeArguments = asNodeArray(typeArguments);
node.arguments = argumentsArray ? ts.parenthesizeListElements(createNodeArray(argumentsArray)) : undefined;
@@ -51602,7 +52346,7 @@
}
ts.updateNew = updateNew;
function createTaggedTemplate(tag, typeArgumentsOrTemplate, template) {
- var node = createSynthesizedNode(193);
+ var node = createSynthesizedNode(194);
node.tag = ts.parenthesizeForAccess(tag);
if (template) {
node.typeArguments = asNodeArray(typeArgumentsOrTemplate);
@@ -51625,7 +52369,7 @@
}
ts.updateTaggedTemplate = updateTaggedTemplate;
function createTypeAssertion(type, expression) {
- var node = createSynthesizedNode(194);
+ var node = createSynthesizedNode(195);
node.type = type;
node.expression = ts.parenthesizePrefixOperand(expression);
return node;
@@ -51639,7 +52383,7 @@
}
ts.updateTypeAssertion = updateTypeAssertion;
function createParen(expression) {
- var node = createSynthesizedNode(195);
+ var node = createSynthesizedNode(196);
node.expression = expression;
return node;
}
@@ -51651,7 +52395,7 @@
}
ts.updateParen = updateParen;
function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body) {
- var node = createSynthesizedNode(196);
+ var node = createSynthesizedNode(197);
node.modifiers = asNodeArray(modifiers);
node.asteriskToken = asteriskToken;
node.name = asName(name);
@@ -51675,7 +52419,7 @@
}
ts.updateFunctionExpression = updateFunctionExpression;
function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) {
- var node = createSynthesizedNode(197);
+ var node = createSynthesizedNode(198);
node.modifiers = asNodeArray(modifiers);
node.typeParameters = asNodeArray(typeParameters);
node.parameters = createNodeArray(parameters);
@@ -51697,7 +52441,7 @@
}
ts.updateArrowFunction = updateArrowFunction;
function createDelete(expression) {
- var node = createSynthesizedNode(198);
+ var node = createSynthesizedNode(199);
node.expression = ts.parenthesizePrefixOperand(expression);
return node;
}
@@ -51709,7 +52453,7 @@
}
ts.updateDelete = updateDelete;
function createTypeOf(expression) {
- var node = createSynthesizedNode(199);
+ var node = createSynthesizedNode(200);
node.expression = ts.parenthesizePrefixOperand(expression);
return node;
}
@@ -51721,7 +52465,7 @@
}
ts.updateTypeOf = updateTypeOf;
function createVoid(expression) {
- var node = createSynthesizedNode(200);
+ var node = createSynthesizedNode(201);
node.expression = ts.parenthesizePrefixOperand(expression);
return node;
}
@@ -51733,7 +52477,7 @@
}
ts.updateVoid = updateVoid;
function createAwait(expression) {
- var node = createSynthesizedNode(201);
+ var node = createSynthesizedNode(202);
node.expression = ts.parenthesizePrefixOperand(expression);
return node;
}
@@ -51745,7 +52489,7 @@
}
ts.updateAwait = updateAwait;
function createPrefix(operator, operand) {
- var node = createSynthesizedNode(202);
+ var node = createSynthesizedNode(203);
node.operator = operator;
node.operand = ts.parenthesizePrefixOperand(operand);
return node;
@@ -51758,7 +52502,7 @@
}
ts.updatePrefix = updatePrefix;
function createPostfix(operand, operator) {
- var node = createSynthesizedNode(203);
+ var node = createSynthesizedNode(204);
node.operand = ts.parenthesizePostfixOperand(operand);
node.operator = operator;
return node;
@@ -51771,7 +52515,7 @@
}
ts.updatePostfix = updatePostfix;
function createBinary(left, operator, right) {
- var node = createSynthesizedNode(204);
+ var node = createSynthesizedNode(205);
var operatorToken = asToken(operator);
var operatorKind = operatorToken.kind;
node.left = ts.parenthesizeBinaryOperand(operatorKind, left, true, undefined);
@@ -51788,7 +52532,7 @@
}
ts.updateBinary = updateBinary;
function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonToken, whenFalse) {
- var node = createSynthesizedNode(205);
+ var node = createSynthesizedNode(206);
node.condition = ts.parenthesizeForConditionalHead(condition);
node.questionToken = whenFalse ? questionTokenOrWhenTrue : createToken(56);
node.whenTrue = ts.parenthesizeSubexpressionOfConditionalExpression(whenFalse ? whenTrueOrWhenFalse : questionTokenOrWhenTrue);
@@ -51808,7 +52552,7 @@
}
ts.updateConditional = updateConditional;
function createTemplateExpression(head, templateSpans) {
- var node = createSynthesizedNode(206);
+ var node = createSynthesizedNode(207);
node.head = head;
node.templateSpans = createNodeArray(templateSpans);
return node;
@@ -51846,7 +52590,7 @@
}
ts.createNoSubstitutionTemplateLiteral = createNoSubstitutionTemplateLiteral;
function createYield(asteriskTokenOrExpression, expression) {
- var node = createSynthesizedNode(207);
+ var node = createSynthesizedNode(208);
node.asteriskToken = asteriskTokenOrExpression && asteriskTokenOrExpression.kind === 40 ? asteriskTokenOrExpression : undefined;
node.expression = asteriskTokenOrExpression && asteriskTokenOrExpression.kind !== 40 ? asteriskTokenOrExpression : expression;
return node;
@@ -51860,7 +52604,7 @@
}
ts.updateYield = updateYield;
function createSpread(expression) {
- var node = createSynthesizedNode(208);
+ var node = createSynthesizedNode(209);
node.expression = ts.parenthesizeExpressionForList(expression);
return node;
}
@@ -51872,7 +52616,7 @@
}
ts.updateSpread = updateSpread;
function createClassExpression(modifiers, name, typeParameters, heritageClauses, members) {
- var node = createSynthesizedNode(209);
+ var node = createSynthesizedNode(210);
node.decorators = undefined;
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -51893,11 +52637,11 @@
}
ts.updateClassExpression = updateClassExpression;
function createOmittedExpression() {
- return createSynthesizedNode(210);
+ return createSynthesizedNode(211);
}
ts.createOmittedExpression = createOmittedExpression;
function createExpressionWithTypeArguments(typeArguments, expression) {
- var node = createSynthesizedNode(211);
+ var node = createSynthesizedNode(212);
node.expression = ts.parenthesizeForAccess(expression);
node.typeArguments = asNodeArray(typeArguments);
return node;
@@ -51911,7 +52655,7 @@
}
ts.updateExpressionWithTypeArguments = updateExpressionWithTypeArguments;
function createAsExpression(expression, type) {
- var node = createSynthesizedNode(212);
+ var node = createSynthesizedNode(213);
node.expression = expression;
node.type = type;
return node;
@@ -51925,7 +52669,7 @@
}
ts.updateAsExpression = updateAsExpression;
function createNonNullExpression(expression) {
- var node = createSynthesizedNode(213);
+ var node = createSynthesizedNode(214);
node.expression = ts.parenthesizeForAccess(expression);
return node;
}
@@ -51937,7 +52681,7 @@
}
ts.updateNonNullExpression = updateNonNullExpression;
function createMetaProperty(keywordToken, name) {
- var node = createSynthesizedNode(214);
+ var node = createSynthesizedNode(215);
node.keywordToken = keywordToken;
node.name = name;
return node;
@@ -51950,7 +52694,7 @@
}
ts.updateMetaProperty = updateMetaProperty;
function createTemplateSpan(expression, literal) {
- var node = createSynthesizedNode(216);
+ var node = createSynthesizedNode(217);
node.expression = expression;
node.literal = literal;
return node;
@@ -51964,11 +52708,11 @@
}
ts.updateTemplateSpan = updateTemplateSpan;
function createSemicolonClassElement() {
- return createSynthesizedNode(217);
+ return createSynthesizedNode(218);
}
ts.createSemicolonClassElement = createSemicolonClassElement;
function createBlock(statements, multiLine) {
- var block = createSynthesizedNode(218);
+ var block = createSynthesizedNode(219);
block.statements = createNodeArray(statements);
if (multiLine)
block.multiLine = multiLine;
@@ -51982,7 +52726,7 @@
}
ts.updateBlock = updateBlock;
function createVariableStatement(modifiers, declarationList) {
- var node = createSynthesizedNode(219);
+ var node = createSynthesizedNode(220);
node.decorators = undefined;
node.modifiers = asNodeArray(modifiers);
node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList;
@@ -51997,11 +52741,11 @@
}
ts.updateVariableStatement = updateVariableStatement;
function createEmptyStatement() {
- return createSynthesizedNode(220);
+ return createSynthesizedNode(221);
}
ts.createEmptyStatement = createEmptyStatement;
function createExpressionStatement(expression) {
- var node = createSynthesizedNode(221);
+ var node = createSynthesizedNode(222);
node.expression = ts.parenthesizeExpressionForExpressionStatement(expression);
return node;
}
@@ -52015,7 +52759,7 @@
ts.createStatement = createExpressionStatement;
ts.updateStatement = updateExpressionStatement;
function createIf(expression, thenStatement, elseStatement) {
- var node = createSynthesizedNode(222);
+ var node = createSynthesizedNode(223);
node.expression = expression;
node.thenStatement = thenStatement;
node.elseStatement = elseStatement;
@@ -52031,7 +52775,7 @@
}
ts.updateIf = updateIf;
function createDo(statement, expression) {
- var node = createSynthesizedNode(223);
+ var node = createSynthesizedNode(224);
node.statement = statement;
node.expression = expression;
return node;
@@ -52045,7 +52789,7 @@
}
ts.updateDo = updateDo;
function createWhile(expression, statement) {
- var node = createSynthesizedNode(224);
+ var node = createSynthesizedNode(225);
node.expression = expression;
node.statement = statement;
return node;
@@ -52059,7 +52803,7 @@
}
ts.updateWhile = updateWhile;
function createFor(initializer, condition, incrementor, statement) {
- var node = createSynthesizedNode(225);
+ var node = createSynthesizedNode(226);
node.initializer = initializer;
node.condition = condition;
node.incrementor = incrementor;
@@ -52077,7 +52821,7 @@
}
ts.updateFor = updateFor;
function createForIn(initializer, expression, statement) {
- var node = createSynthesizedNode(226);
+ var node = createSynthesizedNode(227);
node.initializer = initializer;
node.expression = expression;
node.statement = statement;
@@ -52093,7 +52837,7 @@
}
ts.updateForIn = updateForIn;
function createForOf(awaitModifier, initializer, expression, statement) {
- var node = createSynthesizedNode(227);
+ var node = createSynthesizedNode(228);
node.awaitModifier = awaitModifier;
node.initializer = initializer;
node.expression = expression;
@@ -52111,7 +52855,7 @@
}
ts.updateForOf = updateForOf;
function createContinue(label) {
- var node = createSynthesizedNode(228);
+ var node = createSynthesizedNode(229);
node.label = asName(label);
return node;
}
@@ -52123,7 +52867,7 @@
}
ts.updateContinue = updateContinue;
function createBreak(label) {
- var node = createSynthesizedNode(229);
+ var node = createSynthesizedNode(230);
node.label = asName(label);
return node;
}
@@ -52135,7 +52879,7 @@
}
ts.updateBreak = updateBreak;
function createReturn(expression) {
- var node = createSynthesizedNode(230);
+ var node = createSynthesizedNode(231);
node.expression = expression;
return node;
}
@@ -52147,7 +52891,7 @@
}
ts.updateReturn = updateReturn;
function createWith(expression, statement) {
- var node = createSynthesizedNode(231);
+ var node = createSynthesizedNode(232);
node.expression = expression;
node.statement = statement;
return node;
@@ -52161,7 +52905,7 @@
}
ts.updateWith = updateWith;
function createSwitch(expression, caseBlock) {
- var node = createSynthesizedNode(232);
+ var node = createSynthesizedNode(233);
node.expression = ts.parenthesizeExpressionForList(expression);
node.caseBlock = caseBlock;
return node;
@@ -52175,7 +52919,7 @@
}
ts.updateSwitch = updateSwitch;
function createLabel(label, statement) {
- var node = createSynthesizedNode(233);
+ var node = createSynthesizedNode(234);
node.label = asName(label);
node.statement = statement;
return node;
@@ -52189,7 +52933,7 @@
}
ts.updateLabel = updateLabel;
function createThrow(expression) {
- var node = createSynthesizedNode(234);
+ var node = createSynthesizedNode(235);
node.expression = expression;
return node;
}
@@ -52201,7 +52945,7 @@
}
ts.updateThrow = updateThrow;
function createTry(tryBlock, catchClause, finallyBlock) {
- var node = createSynthesizedNode(235);
+ var node = createSynthesizedNode(236);
node.tryBlock = tryBlock;
node.catchClause = catchClause;
node.finallyBlock = finallyBlock;
@@ -52217,11 +52961,11 @@
}
ts.updateTry = updateTry;
function createDebuggerStatement() {
- return createSynthesizedNode(236);
+ return createSynthesizedNode(237);
}
ts.createDebuggerStatement = createDebuggerStatement;
function createVariableDeclaration(name, type, initializer) {
- var node = createSynthesizedNode(237);
+ var node = createSynthesizedNode(238);
node.name = asName(name);
node.type = type;
node.initializer = initializer !== undefined ? ts.parenthesizeExpressionForList(initializer) : undefined;
@@ -52238,7 +52982,7 @@
ts.updateVariableDeclaration = updateVariableDeclaration;
function createVariableDeclarationList(declarations, flags) {
if (flags === void 0) { flags = 0; }
- var node = createSynthesizedNode(238);
+ var node = createSynthesizedNode(239);
node.flags |= flags & 3;
node.declarations = createNodeArray(declarations);
return node;
@@ -52251,7 +52995,7 @@
}
ts.updateVariableDeclarationList = updateVariableDeclarationList;
function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body) {
- var node = createSynthesizedNode(239);
+ var node = createSynthesizedNode(240);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.asteriskToken = asteriskToken;
@@ -52277,7 +53021,7 @@
}
ts.updateFunctionDeclaration = updateFunctionDeclaration;
function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members) {
- var node = createSynthesizedNode(240);
+ var node = createSynthesizedNode(241);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -52299,7 +53043,7 @@
}
ts.updateClassDeclaration = updateClassDeclaration;
function createInterfaceDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members) {
- var node = createSynthesizedNode(241);
+ var node = createSynthesizedNode(242);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -52321,7 +53065,7 @@
}
ts.updateInterfaceDeclaration = updateInterfaceDeclaration;
function createTypeAliasDeclaration(decorators, modifiers, name, typeParameters, type) {
- var node = createSynthesizedNode(242);
+ var node = createSynthesizedNode(243);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -52341,7 +53085,7 @@
}
ts.updateTypeAliasDeclaration = updateTypeAliasDeclaration;
function createEnumDeclaration(decorators, modifiers, name, members) {
- var node = createSynthesizedNode(243);
+ var node = createSynthesizedNode(244);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -52360,7 +53104,7 @@
ts.updateEnumDeclaration = updateEnumDeclaration;
function createModuleDeclaration(decorators, modifiers, name, body, flags) {
if (flags === void 0) { flags = 0; }
- var node = createSynthesizedNode(244);
+ var node = createSynthesizedNode(245);
node.flags |= flags & (16 | 4 | 512);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
@@ -52379,7 +53123,7 @@
}
ts.updateModuleDeclaration = updateModuleDeclaration;
function createModuleBlock(statements) {
- var node = createSynthesizedNode(245);
+ var node = createSynthesizedNode(246);
node.statements = createNodeArray(statements);
return node;
}
@@ -52391,7 +53135,7 @@
}
ts.updateModuleBlock = updateModuleBlock;
function createCaseBlock(clauses) {
- var node = createSynthesizedNode(246);
+ var node = createSynthesizedNode(247);
node.clauses = createNodeArray(clauses);
return node;
}
@@ -52403,7 +53147,7 @@
}
ts.updateCaseBlock = updateCaseBlock;
function createNamespaceExportDeclaration(name) {
- var node = createSynthesizedNode(247);
+ var node = createSynthesizedNode(248);
node.name = asName(name);
return node;
}
@@ -52415,7 +53159,7 @@
}
ts.updateNamespaceExportDeclaration = updateNamespaceExportDeclaration;
function createImportEqualsDeclaration(decorators, modifiers, name, moduleReference) {
- var node = createSynthesizedNode(248);
+ var node = createSynthesizedNode(249);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -52433,7 +53177,7 @@
}
ts.updateImportEqualsDeclaration = updateImportEqualsDeclaration;
function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier) {
- var node = createSynthesizedNode(249);
+ var node = createSynthesizedNode(250);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.importClause = importClause;
@@ -52451,7 +53195,7 @@
}
ts.updateImportDeclaration = updateImportDeclaration;
function createImportClause(name, namedBindings) {
- var node = createSynthesizedNode(250);
+ var node = createSynthesizedNode(251);
node.name = name;
node.namedBindings = namedBindings;
return node;
@@ -52465,7 +53209,7 @@
}
ts.updateImportClause = updateImportClause;
function createNamespaceImport(name) {
- var node = createSynthesizedNode(251);
+ var node = createSynthesizedNode(252);
node.name = name;
return node;
}
@@ -52477,7 +53221,7 @@
}
ts.updateNamespaceImport = updateNamespaceImport;
function createNamedImports(elements) {
- var node = createSynthesizedNode(252);
+ var node = createSynthesizedNode(253);
node.elements = createNodeArray(elements);
return node;
}
@@ -52489,7 +53233,7 @@
}
ts.updateNamedImports = updateNamedImports;
function createImportSpecifier(propertyName, name) {
- var node = createSynthesizedNode(253);
+ var node = createSynthesizedNode(254);
node.propertyName = propertyName;
node.name = name;
return node;
@@ -52503,11 +53247,11 @@
}
ts.updateImportSpecifier = updateImportSpecifier;
function createExportAssignment(decorators, modifiers, isExportEquals, expression) {
- var node = createSynthesizedNode(254);
+ var node = createSynthesizedNode(255);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.isExportEquals = isExportEquals;
- node.expression = isExportEquals ? ts.parenthesizeBinaryOperand(59, expression, false, undefined) : ts.parenthesizeDefaultExpression(expression);
+ node.expression = isExportEquals ? ts.parenthesizeBinaryOperand(60, expression, false, undefined) : ts.parenthesizeDefaultExpression(expression);
return node;
}
ts.createExportAssignment = createExportAssignment;
@@ -52520,7 +53264,7 @@
}
ts.updateExportAssignment = updateExportAssignment;
function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier) {
- var node = createSynthesizedNode(255);
+ var node = createSynthesizedNode(256);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.exportClause = exportClause;
@@ -52538,7 +53282,7 @@
}
ts.updateExportDeclaration = updateExportDeclaration;
function createNamedExports(elements) {
- var node = createSynthesizedNode(256);
+ var node = createSynthesizedNode(257);
node.elements = createNodeArray(elements);
return node;
}
@@ -52550,7 +53294,7 @@
}
ts.updateNamedExports = updateNamedExports;
function createExportSpecifier(propertyName, name) {
- var node = createSynthesizedNode(257);
+ var node = createSynthesizedNode(258);
node.propertyName = asName(propertyName);
node.name = asName(name);
return node;
@@ -52564,7 +53308,7 @@
}
ts.updateExportSpecifier = updateExportSpecifier;
function createExternalModuleReference(expression) {
- var node = createSynthesizedNode(259);
+ var node = createSynthesizedNode(260);
node.expression = expression;
return node;
}
@@ -52576,27 +53320,27 @@
}
ts.updateExternalModuleReference = updateExternalModuleReference;
function createJSDocTypeExpression(type) {
- var node = createSynthesizedNode(288);
+ var node = createSynthesizedNode(289);
node.type = type;
return node;
}
ts.createJSDocTypeExpression = createJSDocTypeExpression;
function createJSDocTypeTag(typeExpression, comment) {
- var tag = createJSDocTag(307, "type");
+ var tag = createJSDocTag(308, "type");
tag.typeExpression = typeExpression;
tag.comment = comment;
return tag;
}
ts.createJSDocTypeTag = createJSDocTypeTag;
function createJSDocReturnTag(typeExpression, comment) {
- var tag = createJSDocTag(305, "returns");
+ var tag = createJSDocTag(306, "returns");
tag.typeExpression = typeExpression;
tag.comment = comment;
return tag;
}
ts.createJSDocReturnTag = createJSDocReturnTag;
function createJSDocParamTag(name, isBracketed, typeExpression, comment) {
- var tag = createJSDocTag(304, "param");
+ var tag = createJSDocTag(305, "param");
tag.typeExpression = typeExpression;
tag.name = name;
tag.isBracketed = isBracketed;
@@ -52605,7 +53349,7 @@
}
ts.createJSDocParamTag = createJSDocParamTag;
function createJSDocComment(comment, tags) {
- var node = createSynthesizedNode(296);
+ var node = createSynthesizedNode(297);
node.comment = comment;
node.tags = tags;
return node;
@@ -52617,7 +53361,7 @@
return node;
}
function createJsxElement(openingElement, children, closingElement) {
- var node = createSynthesizedNode(260);
+ var node = createSynthesizedNode(261);
node.openingElement = openingElement;
node.children = createNodeArray(children);
node.closingElement = closingElement;
@@ -52633,7 +53377,7 @@
}
ts.updateJsxElement = updateJsxElement;
function createJsxSelfClosingElement(tagName, typeArguments, attributes) {
- var node = createSynthesizedNode(261);
+ var node = createSynthesizedNode(262);
node.tagName = tagName;
node.typeArguments = asNodeArray(typeArguments);
node.attributes = attributes;
@@ -52649,7 +53393,7 @@
}
ts.updateJsxSelfClosingElement = updateJsxSelfClosingElement;
function createJsxOpeningElement(tagName, typeArguments, attributes) {
- var node = createSynthesizedNode(262);
+ var node = createSynthesizedNode(263);
node.tagName = tagName;
node.typeArguments = asNodeArray(typeArguments);
node.attributes = attributes;
@@ -52665,7 +53409,7 @@
}
ts.updateJsxOpeningElement = updateJsxOpeningElement;
function createJsxClosingElement(tagName) {
- var node = createSynthesizedNode(263);
+ var node = createSynthesizedNode(264);
node.tagName = tagName;
return node;
}
@@ -52677,7 +53421,7 @@
}
ts.updateJsxClosingElement = updateJsxClosingElement;
function createJsxFragment(openingFragment, children, closingFragment) {
- var node = createSynthesizedNode(264);
+ var node = createSynthesizedNode(265);
node.openingFragment = openingFragment;
node.children = createNodeArray(children);
node.closingFragment = closingFragment;
@@ -52699,11 +53443,11 @@
}
ts.updateJsxText = updateJsxText;
function createJsxOpeningFragment() {
- return createSynthesizedNode(265);
+ return createSynthesizedNode(266);
}
ts.createJsxOpeningFragment = createJsxOpeningFragment;
function createJsxJsxClosingFragment() {
- return createSynthesizedNode(266);
+ return createSynthesizedNode(267);
}
ts.createJsxJsxClosingFragment = createJsxJsxClosingFragment;
function updateJsxFragment(node, openingFragment, children, closingFragment) {
@@ -52715,7 +53459,7 @@
}
ts.updateJsxFragment = updateJsxFragment;
function createJsxAttribute(name, initializer) {
- var node = createSynthesizedNode(267);
+ var node = createSynthesizedNode(268);
node.name = name;
node.initializer = initializer;
return node;
@@ -52729,7 +53473,7 @@
}
ts.updateJsxAttribute = updateJsxAttribute;
function createJsxAttributes(properties) {
- var node = createSynthesizedNode(268);
+ var node = createSynthesizedNode(269);
node.properties = createNodeArray(properties);
return node;
}
@@ -52741,7 +53485,7 @@
}
ts.updateJsxAttributes = updateJsxAttributes;
function createJsxSpreadAttribute(expression) {
- var node = createSynthesizedNode(269);
+ var node = createSynthesizedNode(270);
node.expression = expression;
return node;
}
@@ -52753,7 +53497,7 @@
}
ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute;
function createJsxExpression(dotDotDotToken, expression) {
- var node = createSynthesizedNode(270);
+ var node = createSynthesizedNode(271);
node.dotDotDotToken = dotDotDotToken;
node.expression = expression;
return node;
@@ -52766,7 +53510,7 @@
}
ts.updateJsxExpression = updateJsxExpression;
function createCaseClause(expression, statements) {
- var node = createSynthesizedNode(271);
+ var node = createSynthesizedNode(272);
node.expression = ts.parenthesizeExpressionForList(expression);
node.statements = createNodeArray(statements);
return node;
@@ -52780,7 +53524,7 @@
}
ts.updateCaseClause = updateCaseClause;
function createDefaultClause(statements) {
- var node = createSynthesizedNode(272);
+ var node = createSynthesizedNode(273);
node.statements = createNodeArray(statements);
return node;
}
@@ -52792,7 +53536,7 @@
}
ts.updateDefaultClause = updateDefaultClause;
function createHeritageClause(token, types) {
- var node = createSynthesizedNode(273);
+ var node = createSynthesizedNode(274);
node.token = token;
node.types = createNodeArray(types);
return node;
@@ -52805,7 +53549,7 @@
}
ts.updateHeritageClause = updateHeritageClause;
function createCatchClause(variableDeclaration, block) {
- var node = createSynthesizedNode(274);
+ var node = createSynthesizedNode(275);
node.variableDeclaration = ts.isString(variableDeclaration) ? createVariableDeclaration(variableDeclaration) : variableDeclaration;
node.block = block;
return node;
@@ -52819,7 +53563,7 @@
}
ts.updateCatchClause = updateCatchClause;
function createPropertyAssignment(name, initializer) {
- var node = createSynthesizedNode(275);
+ var node = createSynthesizedNode(276);
node.name = asName(name);
node.questionToken = undefined;
node.initializer = ts.parenthesizeExpressionForList(initializer);
@@ -52834,7 +53578,7 @@
}
ts.updatePropertyAssignment = updatePropertyAssignment;
function createShorthandPropertyAssignment(name, objectAssignmentInitializer) {
- var node = createSynthesizedNode(276);
+ var node = createSynthesizedNode(277);
node.name = asName(name);
node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? ts.parenthesizeExpressionForList(objectAssignmentInitializer) : undefined;
return node;
@@ -52848,8 +53592,8 @@
}
ts.updateShorthandPropertyAssignment = updateShorthandPropertyAssignment;
function createSpreadAssignment(expression) {
- var node = createSynthesizedNode(277);
- node.expression = expression !== undefined ? ts.parenthesizeExpressionForList(expression) : undefined;
+ var node = createSynthesizedNode(278);
+ node.expression = ts.parenthesizeExpressionForList(expression);
return node;
}
ts.createSpreadAssignment = createSpreadAssignment;
@@ -52860,7 +53604,7 @@
}
ts.updateSpreadAssignment = updateSpreadAssignment;
function createEnumMember(name, initializer) {
- var node = createSynthesizedNode(278);
+ var node = createSynthesizedNode(279);
node.name = asName(name);
node.initializer = initializer && ts.parenthesizeExpressionForList(initializer);
return node;
@@ -52880,7 +53624,7 @@
(typeReferences !== undefined && node.typeReferenceDirectives !== typeReferences) ||
(libReferences !== undefined && node.libReferenceDirectives !== libReferences) ||
(hasNoDefaultLib !== undefined && node.hasNoDefaultLib !== hasNoDefaultLib)) {
- var updated = createSynthesizedNode(284);
+ var updated = createSynthesizedNode(285);
updated.flags |= node.flags;
updated.statements = createNodeArray(statements);
updated.endOfFileToken = node.endOfFileToken;
@@ -52954,28 +53698,28 @@
}
ts.getMutableClone = getMutableClone;
function createNotEmittedStatement(original) {
- var node = createSynthesizedNode(312);
+ var node = createSynthesizedNode(313);
node.original = original;
setTextRange(node, original);
return node;
}
ts.createNotEmittedStatement = createNotEmittedStatement;
function createEndOfDeclarationMarker(original) {
- var node = createSynthesizedNode(316);
+ var node = createSynthesizedNode(317);
node.emitNode = {};
node.original = original;
return node;
}
ts.createEndOfDeclarationMarker = createEndOfDeclarationMarker;
function createMergeDeclarationMarker(original) {
- var node = createSynthesizedNode(315);
+ var node = createSynthesizedNode(316);
node.emitNode = {};
node.original = original;
return node;
}
ts.createMergeDeclarationMarker = createMergeDeclarationMarker;
function createPartiallyEmittedExpression(expression, original) {
- var node = createSynthesizedNode(313);
+ var node = createSynthesizedNode(314);
node.expression = expression;
node.original = original;
setTextRange(node, original);
@@ -52991,7 +53735,7 @@
ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression;
function flattenCommaElements(node) {
if (ts.nodeIsSynthesized(node) && !ts.isParseTreeNode(node) && !node.original && !node.emitNode && !node.id) {
- if (node.kind === 314) {
+ if (node.kind === 315) {
return node.elements;
}
if (ts.isBinaryExpression(node) && node.operatorToken.kind === 27) {
@@ -53001,7 +53745,7 @@
return node;
}
function createCommaList(elements) {
- var node = createSynthesizedNode(314);
+ var node = createSynthesizedNode(315);
node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements));
return node;
}
@@ -53014,7 +53758,7 @@
ts.updateCommaList = updateCommaList;
function createBundle(sourceFiles, prepends) {
if (prepends === void 0) { prepends = ts.emptyArray; }
- var node = ts.createNode(285);
+ var node = ts.createNode(286);
node.prepends = prepends;
node.sourceFiles = sourceFiles;
return node;
@@ -53044,7 +53788,7 @@
], function (helper) { return helper.name; }));
}
function createUnparsedSource() {
- var node = ts.createNode(286);
+ var node = ts.createNode(287);
node.prologues = ts.emptyArray;
node.referencedFiles = ts.emptyArray;
node.libReferenceDirectives = ts.emptyArray;
@@ -53174,10 +53918,10 @@
}
function mapBundleFileSectionKindToSyntaxKind(kind) {
switch (kind) {
- case "prologue": return 279;
- case "prepend": return 280;
- case "internal": return 282;
- case "text": return 281;
+ case "prologue": return 280;
+ case "prepend": return 281;
+ case "internal": return 283;
+ case "text": return 282;
case "emitHelpers":
case "no-default-lib":
case "reference":
@@ -53195,14 +53939,14 @@
return node;
}
function createUnparsedSyntheticReference(section, parent) {
- var node = ts.createNode(283, section.pos, section.end);
+ var node = ts.createNode(284, section.pos, section.end);
node.parent = parent;
node.data = section.data;
node.section = section;
return node;
}
function createInputFiles(javascriptTextOrReadFileText, declarationTextOrJavascriptPath, javascriptMapPath, javascriptMapTextOrDeclarationPath, declarationMapPath, declarationMapTextOrBuildInfoPath, javascriptPath, declarationPath, buildInfoPath, buildInfo, oldFileOfCurrentEmit) {
- var node = ts.createNode(287);
+ var node = ts.createNode(288);
if (!ts.isString(javascriptTextOrReadFileText)) {
var cache_1 = ts.createMap();
var textGetter_1 = function (path) {
@@ -53281,7 +54025,7 @@
}
ts.createLessThan = createLessThan;
function createAssignment(left, right) {
- return createBinary(left, 59, right);
+ return createBinary(left, 60, right);
}
ts.createAssignment = createAssignment;
function createStrictEquality(left, right) {
@@ -53355,7 +54099,7 @@
function getOrCreateEmitNode(node) {
if (!node.emitNode) {
if (ts.isParseTreeNode(node)) {
- if (node.kind === 284) {
+ if (node.kind === 285) {
return node.emitNode = { annotatedNodes: [node] };
}
var sourceFile = ts.getSourceFileOfNode(ts.getParseTreeNode(ts.getSourceFileOfNode(node)));
@@ -53786,7 +54530,7 @@
if (!outermostLabeledStatement) {
return node;
}
- var updated = ts.updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 233
+ var updated = ts.updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 234
? restoreEnclosingLabel(node, outermostLabeledStatement.statement)
: node);
if (afterRestoreLabelCallback) {
@@ -53798,20 +54542,20 @@
function shouldBeCapturedInTempVariable(node, cacheIdentifiers) {
var target = ts.skipParentheses(node);
switch (target.kind) {
- case 72:
+ case 73:
return cacheIdentifiers;
- case 100:
+ case 101:
case 8:
case 9:
case 10:
return false;
- case 187:
+ case 188:
var elements = target.elements;
if (elements.length === 0) {
return false;
}
return true;
- case 188:
+ case 189:
return target.properties.length > 0;
default:
return true;
@@ -53826,7 +54570,7 @@
thisArg = ts.createThis();
target = callee;
}
- else if (callee.kind === 98) {
+ else if (callee.kind === 99) {
thisArg = ts.createThis();
target = languageVersion < 2
? ts.setTextRange(ts.createIdentifier("_super"), callee)
@@ -53838,7 +54582,7 @@
}
else {
switch (callee.kind) {
- case 189: {
+ case 190: {
if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) {
thisArg = ts.createTempVariable(recordTempVariable);
target = ts.createPropertyAccess(ts.setTextRange(ts.createAssignment(thisArg, callee.expression), callee.expression), callee.name);
@@ -53850,7 +54594,7 @@
}
break;
}
- case 190: {
+ case 191: {
if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) {
thisArg = ts.createTempVariable(recordTempVariable);
target = ts.createElementAccess(ts.setTextRange(ts.createAssignment(thisArg, callee.expression), callee.expression), callee.argumentExpression);
@@ -53903,14 +54647,14 @@
ts.createExpressionForPropertyName = createExpressionForPropertyName;
function createExpressionForObjectLiteralElementLike(node, property, receiver) {
switch (property.kind) {
- case 158:
case 159:
+ case 160:
return createExpressionForAccessorDeclaration(node.properties, property, receiver, !!node.multiLine);
- case 275:
- return createExpressionForPropertyAssignment(property, receiver);
case 276:
+ return createExpressionForPropertyAssignment(property, receiver);
+ case 277:
return createExpressionForShorthandPropertyAssignment(property, receiver);
- case 156:
+ case 157:
return createExpressionForMethodDeclaration(property, receiver);
}
}
@@ -53918,27 +54662,27 @@
function createExpressionForAccessorDeclaration(properties, property, receiver, multiLine) {
var _a = ts.getAllAccessorDeclarations(properties, property), firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor;
if (property === firstAccessor) {
- var properties_7 = [];
+ var properties_5 = [];
if (getAccessor) {
var getterFunction = ts.createFunctionExpression(getAccessor.modifiers, undefined, undefined, undefined, getAccessor.parameters, undefined, getAccessor.body);
ts.setTextRange(getterFunction, getAccessor);
ts.setOriginalNode(getterFunction, getAccessor);
var getter = ts.createPropertyAssignment("get", getterFunction);
- properties_7.push(getter);
+ properties_5.push(getter);
}
if (setAccessor) {
var setterFunction = ts.createFunctionExpression(setAccessor.modifiers, undefined, undefined, undefined, setAccessor.parameters, undefined, setAccessor.body);
ts.setTextRange(setterFunction, setAccessor);
ts.setOriginalNode(setterFunction, setAccessor);
var setter = ts.createPropertyAssignment("set", setterFunction);
- properties_7.push(setter);
+ properties_5.push(setter);
}
- properties_7.push(ts.createPropertyAssignment("enumerable", ts.createTrue()));
- properties_7.push(ts.createPropertyAssignment("configurable", ts.createTrue()));
+ properties_5.push(ts.createPropertyAssignment("enumerable", ts.createTrue()));
+ properties_5.push(ts.createPropertyAssignment("configurable", ts.createTrue()));
var expression = ts.setTextRange(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"), undefined, [
receiver,
createExpressionForPropertyName(property.name),
- ts.createObjectLiteral(properties_7, multiLine)
+ ts.createObjectLiteral(properties_5, multiLine)
]), firstAccessor);
return ts.aggregateTransformFlags(expression);
}
@@ -54115,7 +54859,7 @@
ts.ensureUseStrict = ensureUseStrict;
function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) {
var skipped = ts.skipPartiallyEmittedExpressions(operand);
- if (skipped.kind === 195) {
+ if (skipped.kind === 196) {
return operand;
}
return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand)
@@ -54124,10 +54868,10 @@
}
ts.parenthesizeBinaryOperand = parenthesizeBinaryOperand;
function binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand) {
- var binaryOperatorPrecedence = ts.getOperatorPrecedence(204, binaryOperator);
- var binaryOperatorAssociativity = ts.getOperatorAssociativity(204, binaryOperator);
+ var binaryOperatorPrecedence = ts.getOperatorPrecedence(205, binaryOperator);
+ var binaryOperatorAssociativity = ts.getOperatorAssociativity(205, binaryOperator);
var emittedOperand = ts.skipPartiallyEmittedExpressions(operand);
- if (!isLeftSideOfBinary && operand.kind === 197 && binaryOperatorPrecedence > 4) {
+ if (!isLeftSideOfBinary && operand.kind === 198 && binaryOperatorPrecedence > 4) {
return true;
}
var operandPrecedence = ts.getExpressionPrecedence(emittedOperand);
@@ -54135,7 +54879,7 @@
case -1:
if (!isLeftSideOfBinary
&& binaryOperatorAssociativity === 1
- && operand.kind === 207) {
+ && operand.kind === 208) {
return false;
}
return true;
@@ -54174,7 +54918,7 @@
if (ts.isLiteralKind(node.kind)) {
return node.kind;
}
- if (node.kind === 204 && node.operatorToken.kind === 38) {
+ if (node.kind === 205 && node.operatorToken.kind === 38) {
if (node.cachedLiteralKind !== undefined) {
return node.cachedLiteralKind;
}
@@ -54189,7 +54933,7 @@
return 0;
}
function parenthesizeForConditionalHead(condition) {
- var conditionalPrecedence = ts.getOperatorPrecedence(205, 56);
+ var conditionalPrecedence = ts.getOperatorPrecedence(206, 56);
var emittedCondition = ts.skipPartiallyEmittedExpressions(condition);
var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition);
if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1) {
@@ -54210,8 +54954,8 @@
var needsParens = isCommaSequence(check);
if (!needsParens) {
switch (getLeftmostExpression(check, false).kind) {
- case 209:
- case 196:
+ case 210:
+ case 197:
needsParens = true;
}
}
@@ -54221,9 +54965,9 @@
function parenthesizeForNew(expression) {
var leftmostExpr = getLeftmostExpression(expression, true);
switch (leftmostExpr.kind) {
- case 191:
- return ts.createParen(expression);
case 192:
+ return ts.createParen(expression);
+ case 193:
return !leftmostExpr.arguments
? ts.createParen(expression)
: expression;
@@ -54234,7 +54978,7 @@
function parenthesizeForAccess(expression) {
var emittedExpression = ts.skipPartiallyEmittedExpressions(expression);
if (ts.isLeftHandSideExpression(emittedExpression)
- && (emittedExpression.kind !== 192 || emittedExpression.arguments)) {
+ && (emittedExpression.kind !== 193 || emittedExpression.arguments)) {
return expression;
}
return ts.setTextRange(ts.createParen(expression), expression);
@@ -54272,7 +55016,7 @@
function parenthesizeExpressionForList(expression) {
var emittedExpression = ts.skipPartiallyEmittedExpressions(expression);
var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression);
- var commaPrecedence = ts.getOperatorPrecedence(204, 27);
+ var commaPrecedence = ts.getOperatorPrecedence(205, 27);
return expressionPrecedence > commaPrecedence
? expression
: ts.setTextRange(ts.createParen(expression), expression);
@@ -54283,29 +55027,29 @@
if (ts.isCallExpression(emittedExpression)) {
var callee = emittedExpression.expression;
var kind = ts.skipPartiallyEmittedExpressions(callee).kind;
- if (kind === 196 || kind === 197) {
+ if (kind === 197 || kind === 198) {
var mutableCall = ts.getMutableClone(emittedExpression);
mutableCall.expression = ts.setTextRange(ts.createParen(callee), callee);
return recreateOuterExpressions(expression, mutableCall, 4);
}
}
var leftmostExpressionKind = getLeftmostExpression(emittedExpression, false).kind;
- if (leftmostExpressionKind === 188 || leftmostExpressionKind === 196) {
+ if (leftmostExpressionKind === 189 || leftmostExpressionKind === 197) {
return ts.setTextRange(ts.createParen(expression), expression);
}
return expression;
}
ts.parenthesizeExpressionForExpressionStatement = parenthesizeExpressionForExpressionStatement;
function parenthesizeConditionalTypeMember(member) {
- return member.kind === 175 ? ts.createParenthesizedType(member) : member;
+ return member.kind === 176 ? ts.createParenthesizedType(member) : member;
}
ts.parenthesizeConditionalTypeMember = parenthesizeConditionalTypeMember;
function parenthesizeElementTypeMember(member) {
switch (member.kind) {
- case 173:
case 174:
- case 165:
+ case 175:
case 166:
+ case 167:
return ts.createParenthesizedType(member);
}
return parenthesizeConditionalTypeMember(member);
@@ -54313,9 +55057,9 @@
ts.parenthesizeElementTypeMember = parenthesizeElementTypeMember;
function parenthesizeArrayTypeMember(member) {
switch (member.kind) {
- case 167:
- case 179:
- case 176:
+ case 168:
+ case 180:
+ case 177:
return ts.createParenthesizedType(member);
}
return parenthesizeElementTypeMember(member);
@@ -54341,27 +55085,27 @@
function getLeftmostExpression(node, stopAtCallExpressions) {
while (true) {
switch (node.kind) {
- case 203:
+ case 204:
node = node.operand;
continue;
- case 204:
+ case 205:
node = node.left;
continue;
- case 205:
+ case 206:
node = node.condition;
continue;
- case 193:
+ case 194:
node = node.tag;
continue;
- case 191:
+ case 192:
if (stopAtCallExpressions) {
return node;
}
- case 212:
- case 190:
- case 189:
case 213:
- case 313:
+ case 191:
+ case 190:
+ case 214:
+ case 314:
node = node.expression;
continue;
}
@@ -54369,27 +55113,27 @@
}
}
function parenthesizeConciseBody(body) {
- if (!ts.isBlock(body) && (isCommaSequence(body) || getLeftmostExpression(body, false).kind === 188)) {
+ if (!ts.isBlock(body) && (isCommaSequence(body) || getLeftmostExpression(body, false).kind === 189)) {
return ts.setTextRange(ts.createParen(body), body);
}
return body;
}
ts.parenthesizeConciseBody = parenthesizeConciseBody;
function isCommaSequence(node) {
- return node.kind === 204 && node.operatorToken.kind === 27 ||
- node.kind === 314;
+ return node.kind === 205 && node.operatorToken.kind === 27 ||
+ node.kind === 315;
}
ts.isCommaSequence = isCommaSequence;
function isOuterExpression(node, kinds) {
if (kinds === void 0) { kinds = 7; }
switch (node.kind) {
- case 195:
+ case 196:
return (kinds & 1) !== 0;
- case 194:
- case 212:
+ case 195:
case 213:
+ case 214:
return (kinds & 2) !== 0;
- case 313:
+ case 314:
return (kinds & 4) !== 0;
}
return false;
@@ -54414,7 +55158,7 @@
}
ts.skipOuterExpressions = skipOuterExpressions;
function skipAssertions(node) {
- while (ts.isAssertionExpression(node) || node.kind === 213) {
+ while (ts.isAssertionExpression(node) || node.kind === 214) {
node = node.expression;
}
return node;
@@ -54422,15 +55166,15 @@
ts.skipAssertions = skipAssertions;
function updateOuterExpression(outerExpression, expression) {
switch (outerExpression.kind) {
- case 195: return ts.updateParen(outerExpression, expression);
- case 194: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression);
- case 212: return ts.updateAsExpression(outerExpression, expression, outerExpression.type);
- case 213: return ts.updateNonNullExpression(outerExpression, expression);
- case 313: return ts.updatePartiallyEmittedExpression(outerExpression, expression);
+ case 196: return ts.updateParen(outerExpression, expression);
+ case 195: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression);
+ case 213: return ts.updateAsExpression(outerExpression, expression, outerExpression.type);
+ case 214: return ts.updateNonNullExpression(outerExpression, expression);
+ case 314: return ts.updatePartiallyEmittedExpression(outerExpression, expression);
}
}
function isIgnorableParen(node) {
- return node.kind === 195
+ return node.kind === 196
&& ts.nodeIsSynthesized(node)
&& ts.nodeIsSynthesized(ts.getSourceMapRange(node))
&& ts.nodeIsSynthesized(ts.getCommentRange(node))
@@ -54492,10 +55236,10 @@
var name = namespaceDeclaration.name;
return ts.isGeneratedIdentifier(name) ? name : ts.createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, name) || ts.idText(name));
}
- if (node.kind === 249 && node.importClause) {
+ if (node.kind === 250 && node.importClause) {
return ts.getGeneratedNameForNode(node);
}
- if (node.kind === 255 && node.moduleSpecifier) {
+ if (node.kind === 256 && node.moduleSpecifier) {
return ts.getGeneratedNameForNode(node);
}
return undefined;
@@ -54558,11 +55302,11 @@
}
if (ts.isObjectLiteralElementLike(bindingElement)) {
switch (bindingElement.kind) {
- case 275:
- return getTargetOfBindingOrAssignmentElement(bindingElement.initializer);
case 276:
- return bindingElement.name;
+ return getTargetOfBindingOrAssignmentElement(bindingElement.initializer);
case 277:
+ return bindingElement.name;
+ case 278:
return getTargetOfBindingOrAssignmentElement(bindingElement.expression);
}
return undefined;
@@ -54578,11 +55322,11 @@
ts.getTargetOfBindingOrAssignmentElement = getTargetOfBindingOrAssignmentElement;
function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) {
switch (bindingElement.kind) {
- case 151:
- case 186:
+ case 152:
+ case 187:
return bindingElement.dotDotDotToken;
- case 208:
- case 277:
+ case 209:
+ case 278:
return bindingElement;
}
return undefined;
@@ -54590,7 +55334,7 @@
ts.getRestIndicatorOfBindingOrAssignmentElement = getRestIndicatorOfBindingOrAssignmentElement;
function getPropertyNameOfBindingOrAssignmentElement(bindingElement) {
switch (bindingElement.kind) {
- case 186:
+ case 187:
if (bindingElement.propertyName) {
var propertyName = bindingElement.propertyName;
return ts.isComputedPropertyName(propertyName) && isStringOrNumericLiteral(propertyName.expression)
@@ -54598,7 +55342,7 @@
: propertyName;
}
break;
- case 275:
+ case 276:
if (bindingElement.name) {
var propertyName = bindingElement.name;
return ts.isComputedPropertyName(propertyName) && isStringOrNumericLiteral(propertyName.expression)
@@ -54606,7 +55350,7 @@
: propertyName;
}
break;
- case 277:
+ case 278:
return bindingElement.name;
}
var target = getTargetOfBindingOrAssignmentElement(bindingElement);
@@ -54625,11 +55369,11 @@
}
function getElementsOfBindingOrAssignmentPattern(name) {
switch (name.kind) {
- case 184:
case 185:
- case 187:
- return name.elements;
+ case 186:
case 188:
+ return name.elements;
+ case 189:
return name.properties;
}
}
@@ -54668,11 +55412,11 @@
ts.convertToObjectAssignmentElement = convertToObjectAssignmentElement;
function convertToAssignmentPattern(node) {
switch (node.kind) {
- case 185:
- case 187:
- return convertToArrayAssignmentPattern(node);
- case 184:
+ case 186:
case 188:
+ return convertToArrayAssignmentPattern(node);
+ case 185:
+ case 189:
return convertToObjectAssignmentPattern(node);
}
}
@@ -54809,261 +55553,261 @@
return undefined;
}
var kind = node.kind;
- if ((kind > 0 && kind <= 147) || kind === 178) {
+ if ((kind > 0 && kind <= 148) || kind === 179) {
return node;
}
switch (kind) {
- case 72:
+ case 73:
return ts.updateIdentifier(node, nodesVisitor(node.typeArguments, visitor, isTypeNodeOrTypeParameterDeclaration));
- case 148:
- return ts.updateQualifiedName(node, visitNode(node.left, visitor, ts.isEntityName), visitNode(node.right, visitor, ts.isIdentifier));
case 149:
- return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression));
+ return ts.updateQualifiedName(node, visitNode(node.left, visitor, ts.isEntityName), visitNode(node.right, visitor, ts.isIdentifier));
case 150:
- return ts.updateTypeParameterDeclaration(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.constraint, visitor, ts.isTypeNode), visitNode(node.default, visitor, ts.isTypeNode));
+ return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression));
case 151:
- return ts.updateParameter(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.dotDotDotToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression));
+ return ts.updateTypeParameterDeclaration(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.constraint, visitor, ts.isTypeNode), visitNode(node.default, visitor, ts.isTypeNode));
case 152:
- return ts.updateDecorator(node, visitNode(node.expression, visitor, ts.isExpression));
+ return ts.updateParameter(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.dotDotDotToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression));
case 153:
- return ts.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isToken), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression));
+ return ts.updateDecorator(node, visitNode(node.expression, visitor, ts.isExpression));
case 154:
- return ts.updateProperty(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression));
+ return ts.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isToken), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression));
case 155:
- return ts.updateMethodSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken));
+ return ts.updateProperty(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken || node.exclamationToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression));
case 156:
- return ts.updateMethod(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context));
+ return ts.updateMethodSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken));
case 157:
- return ts.updateConstructor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context));
+ return ts.updateMethod(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context));
case 158:
- return ts.updateGetAccessor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context));
+ return ts.updateConstructor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context));
case 159:
- return ts.updateSetAccessor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context));
+ return ts.updateGetAccessor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context));
case 160:
- return ts.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
+ return ts.updateSetAccessor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context));
case 161:
- return ts.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
+ return ts.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
case 162:
- return ts.updateIndexSignature(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
+ return ts.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
case 163:
- return ts.updateTypePredicateNode(node, visitNode(node.parameterName, visitor), visitNode(node.type, visitor, ts.isTypeNode));
+ return ts.updateIndexSignature(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
case 164:
- return ts.updateTypeReferenceNode(node, visitNode(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode));
+ return ts.updateTypePredicateNode(node, visitNode(node.parameterName, visitor), visitNode(node.type, visitor, ts.isTypeNode));
case 165:
- return ts.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
+ return ts.updateTypeReferenceNode(node, visitNode(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode));
case 166:
- return ts.updateConstructorTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
+ return ts.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
case 167:
- return ts.updateTypeQueryNode(node, visitNode(node.exprName, visitor, ts.isEntityName));
+ return ts.updateConstructorTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
case 168:
- return ts.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement));
+ return ts.updateTypeQueryNode(node, visitNode(node.exprName, visitor, ts.isEntityName));
case 169:
- return ts.updateArrayTypeNode(node, visitNode(node.elementType, visitor, ts.isTypeNode));
+ return ts.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement));
case 170:
- return ts.updateTupleTypeNode(node, nodesVisitor(node.elementTypes, visitor, ts.isTypeNode));
+ return ts.updateArrayTypeNode(node, visitNode(node.elementType, visitor, ts.isTypeNode));
case 171:
- return ts.updateOptionalTypeNode(node, visitNode(node.type, visitor, ts.isTypeNode));
+ return ts.updateTupleTypeNode(node, nodesVisitor(node.elementTypes, visitor, ts.isTypeNode));
case 172:
- return ts.updateRestTypeNode(node, visitNode(node.type, visitor, ts.isTypeNode));
+ return ts.updateOptionalTypeNode(node, visitNode(node.type, visitor, ts.isTypeNode));
case 173:
- return ts.updateUnionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode));
+ return ts.updateRestTypeNode(node, visitNode(node.type, visitor, ts.isTypeNode));
case 174:
- return ts.updateIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode));
+ return ts.updateUnionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode));
case 175:
- return ts.updateConditionalTypeNode(node, visitNode(node.checkType, visitor, ts.isTypeNode), visitNode(node.extendsType, visitor, ts.isTypeNode), visitNode(node.trueType, visitor, ts.isTypeNode), visitNode(node.falseType, visitor, ts.isTypeNode));
+ return ts.updateIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode));
case 176:
+ return ts.updateConditionalTypeNode(node, visitNode(node.checkType, visitor, ts.isTypeNode), visitNode(node.extendsType, visitor, ts.isTypeNode), visitNode(node.trueType, visitor, ts.isTypeNode), visitNode(node.falseType, visitor, ts.isTypeNode));
+ case 177:
return ts.updateInferTypeNode(node, visitNode(node.typeParameter, visitor, ts.isTypeParameterDeclaration));
- case 183:
+ case 184:
return ts.updateImportTypeNode(node, visitNode(node.argument, visitor, ts.isTypeNode), visitNode(node.qualifier, visitor, ts.isEntityName), visitNodes(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf);
- case 177:
+ case 178:
return ts.updateParenthesizedType(node, visitNode(node.type, visitor, ts.isTypeNode));
- case 179:
- return ts.updateTypeOperatorNode(node, visitNode(node.type, visitor, ts.isTypeNode));
case 180:
- return ts.updateIndexedAccessTypeNode(node, visitNode(node.objectType, visitor, ts.isTypeNode), visitNode(node.indexType, visitor, ts.isTypeNode));
+ return ts.updateTypeOperatorNode(node, visitNode(node.type, visitor, ts.isTypeNode));
case 181:
- return ts.updateMappedTypeNode(node, visitNode(node.readonlyToken, tokenVisitor, ts.isToken), visitNode(node.typeParameter, visitor, ts.isTypeParameterDeclaration), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode));
+ return ts.updateIndexedAccessTypeNode(node, visitNode(node.objectType, visitor, ts.isTypeNode), visitNode(node.indexType, visitor, ts.isTypeNode));
case 182:
+ return ts.updateMappedTypeNode(node, visitNode(node.readonlyToken, tokenVisitor, ts.isToken), visitNode(node.typeParameter, visitor, ts.isTypeParameterDeclaration), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode));
+ case 183:
return ts.updateLiteralTypeNode(node, visitNode(node.literal, visitor, ts.isExpression));
- case 184:
- return ts.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement));
case 185:
- return ts.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement));
+ return ts.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement));
case 186:
- return ts.updateBindingElement(node, visitNode(node.dotDotDotToken, tokenVisitor, ts.isToken), visitNode(node.propertyName, visitor, ts.isPropertyName), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression));
+ return ts.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement));
case 187:
- return ts.updateArrayLiteral(node, nodesVisitor(node.elements, visitor, ts.isExpression));
+ return ts.updateBindingElement(node, visitNode(node.dotDotDotToken, tokenVisitor, ts.isToken), visitNode(node.propertyName, visitor, ts.isPropertyName), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression));
case 188:
- return ts.updateObjectLiteral(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike));
+ return ts.updateArrayLiteral(node, nodesVisitor(node.elements, visitor, ts.isExpression));
case 189:
- return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier));
+ return ts.updateObjectLiteral(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike));
case 190:
- return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression));
+ return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier));
case 191:
- return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression));
+ return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression));
case 192:
- return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression));
+ return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression));
case 193:
- return ts.updateTaggedTemplate(node, visitNode(node.tag, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isExpression), visitNode(node.template, visitor, ts.isTemplateLiteral));
+ return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression));
case 194:
- return ts.updateTypeAssertion(node, visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression));
+ return ts.updateTaggedTemplate(node, visitNode(node.tag, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isExpression), visitNode(node.template, visitor, ts.isTemplateLiteral));
case 195:
- return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression));
+ return ts.updateTypeAssertion(node, visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression));
case 196:
- return ts.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context));
+ return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression));
case 197:
- return ts.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.equalsGreaterThanToken, visitor, ts.isToken), visitFunctionBody(node.body, visitor, context));
+ return ts.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context));
case 198:
- return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression));
+ return ts.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.equalsGreaterThanToken, visitor, ts.isToken), visitFunctionBody(node.body, visitor, context));
case 199:
- return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression));
+ return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression));
case 200:
- return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression));
+ return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression));
case 201:
- return ts.updateAwait(node, visitNode(node.expression, visitor, ts.isExpression));
+ return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression));
case 202:
- return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression));
+ return ts.updateAwait(node, visitNode(node.expression, visitor, ts.isExpression));
case 203:
- return ts.updatePostfix(node, visitNode(node.operand, visitor, ts.isExpression));
+ return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression));
case 204:
- return ts.updateBinary(node, visitNode(node.left, visitor, ts.isExpression), visitNode(node.right, visitor, ts.isExpression), visitNode(node.operatorToken, visitor, ts.isToken));
+ return ts.updatePostfix(node, visitNode(node.operand, visitor, ts.isExpression));
case 205:
- return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.questionToken, visitor, ts.isToken), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.colonToken, visitor, ts.isToken), visitNode(node.whenFalse, visitor, ts.isExpression));
+ return ts.updateBinary(node, visitNode(node.left, visitor, ts.isExpression), visitNode(node.right, visitor, ts.isExpression), visitNode(node.operatorToken, visitor, ts.isToken));
case 206:
- return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan));
+ return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.questionToken, visitor, ts.isToken), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.colonToken, visitor, ts.isToken), visitNode(node.whenFalse, visitor, ts.isExpression));
case 207:
- return ts.updateYield(node, visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.expression, visitor, ts.isExpression));
+ return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan));
case 208:
- return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression));
+ return ts.updateYield(node, visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.expression, visitor, ts.isExpression));
case 209:
+ return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression));
+ case 210:
return ts.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement));
- case 211:
- return ts.updateExpressionWithTypeArguments(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression));
case 212:
- return ts.updateAsExpression(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.type, visitor, ts.isTypeNode));
+ return ts.updateExpressionWithTypeArguments(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression));
case 213:
- return ts.updateNonNullExpression(node, visitNode(node.expression, visitor, ts.isExpression));
+ return ts.updateAsExpression(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.type, visitor, ts.isTypeNode));
case 214:
+ return ts.updateNonNullExpression(node, visitNode(node.expression, visitor, ts.isExpression));
+ case 215:
return ts.updateMetaProperty(node, visitNode(node.name, visitor, ts.isIdentifier));
- case 216:
+ case 217:
return ts.updateTemplateSpan(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail));
- case 218:
- return ts.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement));
case 219:
+ return ts.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement));
+ case 220:
return ts.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList));
- case 221:
- return ts.updateExpressionStatement(node, visitNode(node.expression, visitor, ts.isExpression));
case 222:
- return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, ts.liftToBlock));
+ return ts.updateExpressionStatement(node, visitNode(node.expression, visitor, ts.isExpression));
case 223:
- return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.expression, visitor, ts.isExpression));
+ return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, ts.liftToBlock));
case 224:
- return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
+ return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.expression, visitor, ts.isExpression));
case 225:
- return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
+ return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
case 226:
- return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
+ return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
case 227:
- return ts.updateForOf(node, visitNode(node.awaitModifier, visitor, ts.isToken), visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
+ return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
case 228:
- return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier));
+ return ts.updateForOf(node, visitNode(node.awaitModifier, visitor, ts.isToken), visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
case 229:
- return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier));
+ return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier));
case 230:
- return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression));
+ return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier));
case 231:
- return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
+ return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression));
case 232:
- return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock));
+ return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
case 233:
- return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
+ return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock));
case 234:
- return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression));
+ return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
case 235:
+ return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression));
+ case 236:
return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause), visitNode(node.finallyBlock, visitor, ts.isBlock));
- case 237:
- return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression));
case 238:
- return ts.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration));
+ return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression));
case 239:
- return ts.updateFunctionDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context));
+ return ts.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration));
case 240:
- return ts.updateClassDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement));
+ return ts.updateFunctionDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context));
case 241:
- return ts.updateInterfaceDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement));
+ return ts.updateClassDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement));
case 242:
- return ts.updateTypeAliasDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
+ return ts.updateInterfaceDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement));
case 243:
- return ts.updateEnumDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember));
+ return ts.updateTypeAliasDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
case 244:
- return ts.updateModuleDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.body, visitor, ts.isModuleBody));
+ return ts.updateEnumDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember));
case 245:
- return ts.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement));
+ return ts.updateModuleDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.body, visitor, ts.isModuleBody));
case 246:
- return ts.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause));
+ return ts.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement));
case 247:
- return ts.updateNamespaceExportDeclaration(node, visitNode(node.name, visitor, ts.isIdentifier));
+ return ts.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause));
case 248:
- return ts.updateImportEqualsDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.moduleReference, visitor, ts.isModuleReference));
+ return ts.updateNamespaceExportDeclaration(node, visitNode(node.name, visitor, ts.isIdentifier));
case 249:
- return ts.updateImportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause), visitNode(node.moduleSpecifier, visitor, ts.isExpression));
+ return ts.updateImportEqualsDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.moduleReference, visitor, ts.isModuleReference));
case 250:
- return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings));
+ return ts.updateImportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause), visitNode(node.moduleSpecifier, visitor, ts.isExpression));
case 251:
- return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier));
+ return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings));
case 252:
- return ts.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier));
+ return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier));
case 253:
- return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier));
+ return ts.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier));
case 254:
- return ts.updateExportAssignment(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression));
+ return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier));
case 255:
- return ts.updateExportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports), visitNode(node.moduleSpecifier, visitor, ts.isExpression));
+ return ts.updateExportAssignment(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression));
case 256:
- return ts.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier));
+ return ts.updateExportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports), visitNode(node.moduleSpecifier, visitor, ts.isExpression));
case 257:
+ return ts.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier));
+ case 258:
return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier));
- case 259:
- return ts.updateExternalModuleReference(node, visitNode(node.expression, visitor, ts.isExpression));
case 260:
- return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement));
+ return ts.updateExternalModuleReference(node, visitNode(node.expression, visitor, ts.isExpression));
case 261:
- return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.attributes, visitor, ts.isJsxAttributes));
+ return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement));
case 262:
- return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.attributes, visitor, ts.isJsxAttributes));
+ return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.attributes, visitor, ts.isJsxAttributes));
case 263:
- return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression));
+ return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.attributes, visitor, ts.isJsxAttributes));
case 264:
+ return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression));
+ case 265:
return ts.updateJsxFragment(node, visitNode(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingFragment, visitor, ts.isJsxClosingFragment));
- case 267:
- return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression));
case 268:
- return ts.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike));
+ return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression));
case 269:
- return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression));
+ return ts.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike));
case 270:
- return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression));
+ return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression));
case 271:
- return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement));
+ return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression));
case 272:
- return ts.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement));
+ return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement));
case 273:
- return ts.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments));
+ return ts.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement));
case 274:
- return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock));
+ return ts.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments));
case 275:
- return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression));
+ return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock));
case 276:
- return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression));
+ return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression));
case 277:
- return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression));
+ return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression));
case 278:
+ return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression));
+ case 279:
return ts.updateEnumMember(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression));
- case 284:
+ case 285:
return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context));
- case 313:
- return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression));
case 314:
+ return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression));
+ case 315:
return ts.updateCommaList(node, nodesVisitor(node.elements, visitor, ts.isExpression));
default:
return node;
@@ -55089,52 +55833,52 @@
var reduceNodes = cbNodeArray ? reduceNodeArray : ts.reduceLeft;
var cbNodes = cbNodeArray || cbNode;
var kind = node.kind;
- if ((kind > 0 && kind <= 147)) {
+ if ((kind > 0 && kind <= 148)) {
return initial;
}
- if ((kind >= 163 && kind <= 182)) {
+ if ((kind >= 164 && kind <= 183)) {
return initial;
}
var result = initial;
switch (node.kind) {
- case 217:
- case 220:
- case 210:
- case 236:
- case 312:
+ case 218:
+ case 221:
+ case 211:
+ case 237:
+ case 313:
break;
- case 148:
+ case 149:
result = reduceNode(node.left, cbNode, result);
result = reduceNode(node.right, cbNode, result);
break;
- case 149:
+ case 150:
result = reduceNode(node.expression, cbNode, result);
break;
- case 151:
+ case 152:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
- case 152:
+ case 153:
result = reduceNode(node.expression, cbNode, result);
break;
- case 153:
+ case 154:
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.questionToken, cbNode, result);
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
- case 154:
+ case 155:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
- case 156:
+ case 157:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
@@ -55143,12 +55887,12 @@
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 157:
+ case 158:
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNodes(node.parameters, cbNodes, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 158:
+ case 159:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
@@ -55156,56 +55900,56 @@
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 159:
+ case 160:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNodes(node.parameters, cbNodes, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 184:
case 185:
+ case 186:
result = reduceNodes(node.elements, cbNodes, result);
break;
- case 186:
+ case 187:
result = reduceNode(node.propertyName, cbNode, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
- case 187:
+ case 188:
result = reduceNodes(node.elements, cbNodes, result);
break;
- case 188:
+ case 189:
result = reduceNodes(node.properties, cbNodes, result);
break;
- case 189:
+ case 190:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.name, cbNode, result);
break;
- case 190:
+ case 191:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.argumentExpression, cbNode, result);
break;
- case 191:
+ case 192:
result = reduceNode(node.expression, cbNode, result);
result = reduceNodes(node.typeArguments, cbNodes, result);
result = reduceNodes(node.arguments, cbNodes, result);
break;
- case 192:
+ case 193:
result = reduceNode(node.expression, cbNode, result);
result = reduceNodes(node.typeArguments, cbNodes, result);
result = reduceNodes(node.arguments, cbNodes, result);
break;
- case 193:
+ case 194:
result = reduceNode(node.tag, cbNode, result);
result = reduceNodes(node.typeArguments, cbNodes, result);
result = reduceNode(node.template, cbNode, result);
break;
- case 194:
+ case 195:
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.expression, cbNode, result);
break;
- case 196:
+ case 197:
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNodes(node.typeParameters, cbNodes, result);
@@ -55213,121 +55957,121 @@
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 197:
+ case 198:
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNodes(node.typeParameters, cbNodes, result);
result = reduceNodes(node.parameters, cbNodes, result);
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 195:
- case 198:
+ case 196:
case 199:
case 200:
case 201:
- case 207:
+ case 202:
case 208:
- case 213:
+ case 209:
+ case 214:
result = reduceNode(node.expression, cbNode, result);
break;
- case 202:
case 203:
+ case 204:
result = reduceNode(node.operand, cbNode, result);
break;
- case 204:
+ case 205:
result = reduceNode(node.left, cbNode, result);
result = reduceNode(node.right, cbNode, result);
break;
- case 205:
+ case 206:
result = reduceNode(node.condition, cbNode, result);
result = reduceNode(node.whenTrue, cbNode, result);
result = reduceNode(node.whenFalse, cbNode, result);
break;
- case 206:
+ case 207:
result = reduceNode(node.head, cbNode, result);
result = reduceNodes(node.templateSpans, cbNodes, result);
break;
- case 209:
+ case 210:
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNodes(node.typeParameters, cbNodes, result);
result = reduceNodes(node.heritageClauses, cbNodes, result);
result = reduceNodes(node.members, cbNodes, result);
break;
- case 211:
+ case 212:
result = reduceNode(node.expression, cbNode, result);
result = reduceNodes(node.typeArguments, cbNodes, result);
break;
- case 212:
+ case 213:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.type, cbNode, result);
break;
- case 216:
+ case 217:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.literal, cbNode, result);
break;
- case 218:
+ case 219:
result = reduceNodes(node.statements, cbNodes, result);
break;
- case 219:
+ case 220:
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.declarationList, cbNode, result);
break;
- case 221:
+ case 222:
result = reduceNode(node.expression, cbNode, result);
break;
- case 222:
+ case 223:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.thenStatement, cbNode, result);
result = reduceNode(node.elseStatement, cbNode, result);
break;
- case 223:
+ case 224:
result = reduceNode(node.statement, cbNode, result);
result = reduceNode(node.expression, cbNode, result);
break;
- case 224:
- case 231:
+ case 225:
+ case 232:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.statement, cbNode, result);
break;
- case 225:
+ case 226:
result = reduceNode(node.initializer, cbNode, result);
result = reduceNode(node.condition, cbNode, result);
result = reduceNode(node.incrementor, cbNode, result);
result = reduceNode(node.statement, cbNode, result);
break;
- case 226:
case 227:
+ case 228:
result = reduceNode(node.initializer, cbNode, result);
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.statement, cbNode, result);
break;
- case 230:
- case 234:
+ case 231:
+ case 235:
result = reduceNode(node.expression, cbNode, result);
break;
- case 232:
+ case 233:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.caseBlock, cbNode, result);
break;
- case 233:
+ case 234:
result = reduceNode(node.label, cbNode, result);
result = reduceNode(node.statement, cbNode, result);
break;
- case 235:
+ case 236:
result = reduceNode(node.tryBlock, cbNode, result);
result = reduceNode(node.catchClause, cbNode, result);
result = reduceNode(node.finallyBlock, cbNode, result);
break;
- case 237:
+ case 238:
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
- case 238:
+ case 239:
result = reduceNodes(node.declarations, cbNodes, result);
break;
- case 239:
+ case 240:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
@@ -55336,7 +56080,7 @@
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 240:
+ case 241:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
@@ -55344,132 +56088,132 @@
result = reduceNodes(node.heritageClauses, cbNodes, result);
result = reduceNodes(node.members, cbNodes, result);
break;
- case 243:
+ case 244:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNodes(node.members, cbNodes, result);
break;
- case 244:
+ case 245:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 245:
+ case 246:
result = reduceNodes(node.statements, cbNodes, result);
break;
- case 246:
+ case 247:
result = reduceNodes(node.clauses, cbNodes, result);
break;
- case 248:
+ case 249:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.moduleReference, cbNode, result);
break;
- case 249:
+ case 250:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.importClause, cbNode, result);
result = reduceNode(node.moduleSpecifier, cbNode, result);
break;
- case 250:
- result = reduceNode(node.name, cbNode, result);
- result = reduceNode(node.namedBindings, cbNode, result);
- break;
case 251:
result = reduceNode(node.name, cbNode, result);
+ result = reduceNode(node.namedBindings, cbNode, result);
break;
case 252:
- case 256:
- result = reduceNodes(node.elements, cbNodes, result);
+ result = reduceNode(node.name, cbNode, result);
break;
case 253:
case 257:
+ result = reduceNodes(node.elements, cbNodes, result);
+ break;
+ case 254:
+ case 258:
result = reduceNode(node.propertyName, cbNode, result);
result = reduceNode(node.name, cbNode, result);
break;
- case 254:
+ case 255:
result = ts.reduceLeft(node.decorators, cbNode, result);
result = ts.reduceLeft(node.modifiers, cbNode, result);
result = reduceNode(node.expression, cbNode, result);
break;
- case 255:
+ case 256:
result = ts.reduceLeft(node.decorators, cbNode, result);
result = ts.reduceLeft(node.modifiers, cbNode, result);
result = reduceNode(node.exportClause, cbNode, result);
result = reduceNode(node.moduleSpecifier, cbNode, result);
break;
- case 259:
+ case 260:
result = reduceNode(node.expression, cbNode, result);
break;
- case 260:
+ case 261:
result = reduceNode(node.openingElement, cbNode, result);
result = ts.reduceLeft(node.children, cbNode, result);
result = reduceNode(node.closingElement, cbNode, result);
break;
- case 264:
+ case 265:
result = reduceNode(node.openingFragment, cbNode, result);
result = ts.reduceLeft(node.children, cbNode, result);
result = reduceNode(node.closingFragment, cbNode, result);
break;
- case 261:
case 262:
+ case 263:
result = reduceNode(node.tagName, cbNode, result);
result = reduceNodes(node.typeArguments, cbNode, result);
result = reduceNode(node.attributes, cbNode, result);
break;
- case 268:
+ case 269:
result = reduceNodes(node.properties, cbNodes, result);
break;
- case 263:
+ case 264:
result = reduceNode(node.tagName, cbNode, result);
break;
- case 267:
+ case 268:
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
- case 269:
- result = reduceNode(node.expression, cbNode, result);
- break;
case 270:
result = reduceNode(node.expression, cbNode, result);
break;
case 271:
result = reduceNode(node.expression, cbNode, result);
+ break;
case 272:
+ result = reduceNode(node.expression, cbNode, result);
+ case 273:
result = reduceNodes(node.statements, cbNodes, result);
break;
- case 273:
+ case 274:
result = reduceNodes(node.types, cbNodes, result);
break;
- case 274:
+ case 275:
result = reduceNode(node.variableDeclaration, cbNode, result);
result = reduceNode(node.block, cbNode, result);
break;
- case 275:
+ case 276:
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
- case 276:
+ case 277:
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.objectAssignmentInitializer, cbNode, result);
break;
- case 277:
+ case 278:
result = reduceNode(node.expression, cbNode, result);
break;
- case 278:
+ case 279:
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
- case 284:
+ case 285:
result = reduceNodes(node.statements, cbNodes, result);
break;
- case 313:
+ case 314:
result = reduceNode(node.expression, cbNode, result);
break;
- case 314:
+ case 315:
result = reduceNodes(node.elements, cbNodes, result);
break;
default:
@@ -55488,7 +56232,7 @@
}
ts.mergeLexicalEnvironment = mergeLexicalEnvironment;
function liftToBlock(nodes) {
- Debug.assert(ts.every(nodes, ts.isStatement), "Cannot lift nodes to a Block.");
+ ts.Debug.assert(ts.every(nodes, ts.isStatement), "Cannot lift nodes to a Block.");
return ts.singleOrUndefined(nodes) || ts.createBlock(nodes);
}
ts.liftToBlock = liftToBlock;
@@ -55522,7 +56266,7 @@
return subtreeFlags;
}
function aggregateTransformFlagsForSubtree(node) {
- if (ts.hasModifier(node, 2) || (ts.isTypeNode(node) && node.kind !== 211)) {
+ if (ts.hasModifier(node, 2) || (ts.isTypeNode(node) && node.kind !== 212)) {
return 0;
}
return reduceEachChild(node, 0, aggregateTransformFlagsForChildNode, aggregateTransformFlagsForChildNodes);
@@ -55533,69 +56277,6 @@
function aggregateTransformFlagsForChildNodes(transformFlags, nodes) {
return transformFlags | aggregateTransformFlagsForNodeArray(nodes);
}
- var Debug;
- (function (Debug) {
- var isDebugInfoEnabled = false;
- function failBadSyntaxKind(node, message) {
- return Debug.fail((message || "Unexpected node.") + "\r\nNode " + ts.formatSyntaxKind(node.kind) + " was unexpected.", failBadSyntaxKind);
- }
- Debug.failBadSyntaxKind = failBadSyntaxKind;
- Debug.assertEachNode = Debug.shouldAssert(1)
- ? function (nodes, test, message) { return Debug.assert(test === undefined || ts.every(nodes, test), message || "Unexpected node.", function () { return "Node array did not pass test '" + Debug.getFunctionName(test) + "'."; }, Debug.assertEachNode); }
- : ts.noop;
- Debug.assertNode = Debug.shouldAssert(1)
- ? function (node, test, message) { return Debug.assert(test === undefined || test(node), message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " did not pass test '" + Debug.getFunctionName(test) + "'."; }, Debug.assertNode); }
- : ts.noop;
- Debug.assertOptionalNode = Debug.shouldAssert(1)
- ? function (node, test, message) { return Debug.assert(test === undefined || node === undefined || test(node), message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " did not pass test '" + Debug.getFunctionName(test) + "'."; }, Debug.assertOptionalNode); }
- : ts.noop;
- Debug.assertOptionalToken = Debug.shouldAssert(1)
- ? function (node, kind, message) { return Debug.assert(kind === undefined || node === undefined || node.kind === kind, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was not a '" + ts.formatSyntaxKind(kind) + "' token."; }, Debug.assertOptionalToken); }
- : ts.noop;
- Debug.assertMissingNode = Debug.shouldAssert(1)
- ? function (node, message) { return Debug.assert(node === undefined, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was unexpected'."; }, Debug.assertMissingNode); }
- : ts.noop;
- function enableDebugInfo() {
- if (isDebugInfoEnabled)
- return;
- Object.defineProperties(ts.objectAllocator.getSymbolConstructor().prototype, {
- __debugFlags: { get: function () { return ts.formatSymbolFlags(this.flags); } }
- });
- Object.defineProperties(ts.objectAllocator.getTypeConstructor().prototype, {
- __debugFlags: { get: function () { return ts.formatTypeFlags(this.flags); } },
- __debugObjectFlags: { get: function () { return this.flags & 524288 ? ts.formatObjectFlags(this.objectFlags) : ""; } },
- __debugTypeToString: { value: function () { return this.checker.typeToString(this); } },
- });
- var nodeConstructors = [
- ts.objectAllocator.getNodeConstructor(),
- ts.objectAllocator.getIdentifierConstructor(),
- ts.objectAllocator.getTokenConstructor(),
- ts.objectAllocator.getSourceFileConstructor()
- ];
- for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) {
- var ctor = nodeConstructors_1[_i];
- if (!ctor.prototype.hasOwnProperty("__debugKind")) {
- Object.defineProperties(ctor.prototype, {
- __debugKind: { get: function () { return ts.formatSyntaxKind(this.kind); } },
- __debugModifierFlags: { get: function () { return ts.formatModifierFlags(ts.getModifierFlagsNoCache(this)); } },
- __debugTransformFlags: { get: function () { return ts.formatTransformFlags(this.transformFlags); } },
- __debugEmitFlags: { get: function () { return ts.formatEmitFlags(ts.getEmitFlags(this)); } },
- __debugGetText: {
- value: function (includeTrivia) {
- if (ts.nodeIsSynthesized(this))
- return "";
- var parseNode = ts.getParseTreeNode(this);
- var sourceFile = parseNode && ts.getSourceFileOfNode(parseNode);
- return sourceFile ? ts.getSourceTextOfNodeFromSourceFile(sourceFile, parseNode, includeTrivia) : "";
- }
- }
- });
- }
- }
- isDebugInfoEnabled = true;
- }
- Debug.enableDebugInfo = enableDebugInfo;
- })(Debug = ts.Debug || (ts.Debug = {}));
})(ts || (ts = {}));
var ts;
(function (ts) {
@@ -56208,7 +56889,7 @@
function chainBundle(transformSourceFile) {
return transformSourceFileOrBundle;
function transformSourceFileOrBundle(node) {
- return node.kind === 284 ? transformSourceFile(node) : transformBundle(node);
+ return node.kind === 285 ? transformSourceFile(node) : transformBundle(node);
}
function transformBundle(node) {
return ts.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends);
@@ -56252,16 +56933,16 @@
for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {
var node = _a[_i];
switch (node.kind) {
- case 249:
+ case 250:
externalImports.push(node);
hasImportStarOrImportDefault = hasImportStarOrImportDefault || getImportNeedsImportStarHelper(node) || getImportNeedsImportDefaultHelper(node);
break;
- case 248:
- if (node.moduleReference.kind === 259) {
+ case 249:
+ if (node.moduleReference.kind === 260) {
externalImports.push(node);
}
break;
- case 255:
+ case 256:
if (node.moduleSpecifier) {
if (!node.exportClause) {
externalImports.push(node);
@@ -56288,12 +56969,12 @@
}
}
break;
- case 254:
+ case 255:
if (node.isExportEquals && !exportEquals) {
exportEquals = node;
}
break;
- case 219:
+ case 220:
if (ts.hasModifier(node, 1)) {
for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) {
var decl = _e[_d];
@@ -56301,7 +56982,7 @@
}
}
break;
- case 239:
+ case 240:
if (ts.hasModifier(node, 1)) {
if (ts.hasModifier(node, 512)) {
if (!hasExportDefault) {
@@ -56319,7 +57000,7 @@
}
}
break;
- case 240:
+ case 241:
if (ts.hasModifier(node, 1)) {
if (ts.hasModifier(node, 512)) {
if (!hasExportDefault) {
@@ -56725,7 +57406,7 @@
ts.restHelper = {
name: "typescript:rest",
scoped: false,
- text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\n t[p[i]] = s[p[i]];\n return t;\n };"
+ text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n };"
};
function createRestCall(context, value, elements, computedTempVariables, location) {
context.requestEmitHelper(ts.restHelper);
@@ -56764,8 +57445,8 @@
var previousOnSubstituteNode = context.onSubstituteNode;
context.onEmitNode = onEmitNode;
context.onSubstituteNode = onSubstituteNode;
- context.enableSubstitution(189);
context.enableSubstitution(190);
+ context.enableSubstitution(191);
var currentSourceFile;
var currentNamespace;
var currentNamespaceContainerName;
@@ -56778,14 +57459,14 @@
var pendingExpressions;
return transformSourceFileOrBundle;
function transformSourceFileOrBundle(node) {
- if (node.kind === 285) {
+ if (node.kind === 286) {
return transformBundle(node);
}
return transformSourceFile(node);
}
function transformBundle(node) {
return ts.createBundle(node.sourceFiles.map(transformSourceFile), ts.mapDefined(node.prepends, function (prepend) {
- if (prepend.kind === 287) {
+ if (prepend.kind === 288) {
return ts.createUnparsedSourceFile(prepend, "js");
}
return prepend;
@@ -56816,16 +57497,16 @@
}
function onBeforeVisitNode(node) {
switch (node.kind) {
- case 284:
+ case 285:
+ case 247:
case 246:
- case 245:
- case 218:
+ case 219:
currentLexicalScope = node;
currentNameScope = undefined;
currentScopeFirstDeclarationsOfName = undefined;
break;
+ case 241:
case 240:
- case 239:
if (ts.hasModifier(node, 2)) {
break;
}
@@ -56833,7 +57514,7 @@
recordEmittedDeclarationInScope(node);
}
else {
- ts.Debug.assert(node.kind === 240 || ts.hasModifier(node, 512));
+ ts.Debug.assert(node.kind === 241 || ts.hasModifier(node, 512));
}
if (ts.isClassDeclaration(node)) {
currentNameScope = node;
@@ -56855,10 +57536,10 @@
}
function sourceElementVisitorWorker(node) {
switch (node.kind) {
+ case 250:
case 249:
- case 248:
- case 254:
case 255:
+ case 256:
return visitEllidableStatement(node);
default:
return visitorWorker(node);
@@ -56873,13 +57554,13 @@
return node;
}
switch (node.kind) {
- case 249:
+ case 250:
return visitImportDeclaration(node);
- case 248:
+ case 249:
return visitImportEqualsDeclaration(node);
- case 254:
- return visitExportAssignment(node);
case 255:
+ return visitExportAssignment(node);
+ case 256:
return visitExportDeclaration(node);
default:
ts.Debug.fail("Unhandled ellided statement");
@@ -56889,11 +57570,11 @@
return saveStateAndInvoke(node, namespaceElementVisitorWorker);
}
function namespaceElementVisitorWorker(node) {
- if (node.kind === 255 ||
- node.kind === 249 ||
+ if (node.kind === 256 ||
node.kind === 250 ||
- (node.kind === 248 &&
- node.moduleReference.kind === 259)) {
+ node.kind === 251 ||
+ (node.kind === 249 &&
+ node.moduleReference.kind === 260)) {
return undefined;
}
else if (node.transformFlags & 1 || ts.hasModifier(node, 1)) {
@@ -56906,15 +57587,15 @@
}
function classElementVisitorWorker(node) {
switch (node.kind) {
- case 157:
- return undefined;
- case 154:
- case 162:
case 158:
+ return undefined;
+ case 155:
+ case 163:
case 159:
- case 156:
+ case 160:
+ case 157:
return visitorWorker(node);
- case 217:
+ case 218:
return node;
default:
return ts.Debug.failBadSyntaxKind(node);
@@ -56924,7 +57605,7 @@
if (ts.modifierToFlag(node.kind) & 2270) {
return undefined;
}
- else if (currentNamespace && node.kind === 85) {
+ else if (currentNamespace && node.kind === 86) {
return undefined;
}
return node;
@@ -56934,100 +57615,100 @@
return ts.createNotEmittedStatement(node);
}
switch (node.kind) {
- case 85:
- case 80:
+ case 86:
+ case 81:
return currentNamespace ? undefined : node;
- case 115:
- case 113:
+ case 116:
case 114:
- case 118:
- case 77:
- case 125:
- case 133:
- case 169:
+ case 115:
+ case 119:
+ case 78:
+ case 126:
+ case 134:
case 170:
case 171:
case 172:
- case 168:
- case 163:
- case 150:
- case 120:
- case 143:
- case 123:
- case 138:
- case 135:
- case 132:
- case 106:
+ case 173:
+ case 169:
+ case 164:
+ case 151:
+ case 121:
+ case 144:
+ case 124:
case 139:
+ case 136:
+ case 133:
+ case 107:
+ case 140:
+ case 167:
case 166:
+ case 168:
case 165:
- case 167:
- case 164:
- case 173:
case 174:
case 175:
- case 177:
+ case 176:
case 178:
case 179:
case 180:
case 181:
case 182:
- case 162:
- case 152:
- case 242:
+ case 183:
+ case 163:
+ case 153:
+ case 243:
return undefined;
- case 154:
+ case 155:
return visitPropertyDeclaration(node);
- case 247:
+ case 248:
return undefined;
- case 157:
+ case 158:
return visitConstructor(node);
- case 241:
+ case 242:
return ts.createNotEmittedStatement(node);
- case 240:
+ case 241:
return visitClassDeclaration(node);
- case 209:
+ case 210:
return visitClassExpression(node);
- case 273:
+ case 274:
return visitHeritageClause(node);
- case 211:
+ case 212:
return visitExpressionWithTypeArguments(node);
- case 156:
+ case 157:
return visitMethodDeclaration(node);
- case 158:
- return visitGetAccessor(node);
case 159:
+ return visitGetAccessor(node);
+ case 160:
return visitSetAccessor(node);
- case 239:
+ case 240:
return visitFunctionDeclaration(node);
- case 196:
- return visitFunctionExpression(node);
case 197:
+ return visitFunctionExpression(node);
+ case 198:
return visitArrowFunction(node);
- case 151:
+ case 152:
return visitParameter(node);
- case 195:
+ case 196:
return visitParenthesizedExpression(node);
- case 194:
- case 212:
+ case 195:
+ case 213:
return visitAssertionExpression(node);
- case 191:
- return visitCallExpression(node);
case 192:
- return visitNewExpression(node);
+ return visitCallExpression(node);
case 193:
+ return visitNewExpression(node);
+ case 194:
return visitTaggedTemplateExpression(node);
- case 213:
+ case 214:
return visitNonNullExpression(node);
- case 243:
+ case 244:
return visitEnumDeclaration(node);
- case 219:
+ case 220:
return visitVariableStatement(node);
- case 237:
+ case 238:
return visitVariableDeclaration(node);
- case 244:
+ case 245:
return visitModuleDeclaration(node);
- case 248:
+ case 249:
return visitImportEqualsDeclaration(node);
default:
return ts.visitEachChild(node, visitor, context);
@@ -57057,7 +57738,7 @@
if (ts.some(staticProperties))
facts |= 1;
var extendsClauseElement = ts.getEffectiveBaseTypeNode(node);
- if (extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 96)
+ if (extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 97)
facts |= 64;
if (shouldEmitDecorateCallForClass(node))
facts |= 2;
@@ -57186,7 +57867,7 @@
pendingExpressions = undefined;
var staticProperties = getInitializedProperties(node, true);
var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause);
- var members = transformClassMembers(node, ts.some(heritageClauses, function (c) { return c.token === 86; }));
+ var members = transformClassMembers(node, ts.some(heritageClauses, function (c) { return c.token === 87; }));
var classExpression = ts.createClassExpression(undefined, node.name, undefined, heritageClauses, members);
ts.setOriginalNode(classExpression, node);
ts.setTextRange(classExpression, node);
@@ -57265,7 +57946,7 @@
return index;
}
var statement = statements[index];
- if (statement.kind === 221 && ts.isSuperCall(statement.expression)) {
+ if (statement.kind === 222 && ts.isSuperCall(statement.expression)) {
result.push(ts.visitNode(statement, visitor, ts.isStatement));
return index + 1;
}
@@ -57299,13 +57980,13 @@
return isInitializedProperty(member, false);
}
function isInitializedProperty(member, isStatic) {
- return member.kind === 154
+ return member.kind === 155
&& isStatic === ts.hasModifier(member, 32)
&& member.initializer !== undefined;
}
function addInitializedPropertyStatements(statements, properties, receiver) {
- for (var _i = 0, properties_8 = properties; _i < properties_8.length; _i++) {
- var property = properties_8[_i];
+ for (var _i = 0, properties_6 = properties; _i < properties_6.length; _i++) {
+ var property = properties_6[_i];
var statement = ts.createExpressionStatement(transformInitializedProperty(property, receiver));
ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property));
ts.setCommentRange(statement, property);
@@ -57315,8 +57996,8 @@
}
function generateInitializedPropertyExpressions(properties, receiver) {
var expressions = [];
- for (var _i = 0, properties_9 = properties; _i < properties_9.length; _i++) {
- var property = properties_9[_i];
+ for (var _i = 0, properties_7 = properties; _i < properties_7.length; _i++) {
+ var property = properties_7[_i];
var expression = transformInitializedProperty(property, receiver);
ts.startOnNewLine(expression);
ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property));
@@ -57379,12 +58060,12 @@
}
function getAllDecoratorsOfClassElement(node, member) {
switch (member.kind) {
- case 158:
case 159:
+ case 160:
return getAllDecoratorsOfAccessors(node, member);
- case 156:
+ case 157:
return getAllDecoratorsOfMethod(member);
- case 154:
+ case 155:
return getAllDecoratorsOfProperty(member);
default:
return undefined;
@@ -57463,7 +58144,7 @@
var prefix = getClassMemberPrefix(node, member);
var memberName = getExpressionForPropertyName(member, true);
var descriptor = languageVersion > 0
- ? member.kind === 154
+ ? member.kind === 155
? ts.createVoidZero()
: ts.createNull()
: undefined;
@@ -57547,22 +58228,22 @@
}
function shouldAddTypeMetadata(node) {
var kind = node.kind;
- return kind === 156
- || kind === 158
+ return kind === 157
|| kind === 159
- || kind === 154;
+ || kind === 160
+ || kind === 155;
}
function shouldAddReturnTypeMetadata(node) {
- return node.kind === 156;
+ return node.kind === 157;
}
function shouldAddParamTypesMetadata(node) {
switch (node.kind) {
- case 240:
- case 209:
+ case 241:
+ case 210:
return ts.getFirstConstructorWithBody(node) !== undefined;
- case 156:
- case 158:
+ case 157:
case 159:
+ case 160:
return true;
}
return false;
@@ -57574,15 +58255,15 @@
}
function serializeTypeOfNode(node) {
switch (node.kind) {
- case 154:
- case 151:
+ case 155:
+ case 152:
return serializeTypeNode(node.type);
+ case 160:
case 159:
- case 158:
return serializeTypeNode(getAccessorTypeNode(node));
- case 240:
- case 209:
- case 156:
+ case 241:
+ case 210:
+ case 157:
return ts.createIdentifier("Function");
default:
return ts.createVoidZero();
@@ -57614,7 +58295,7 @@
return ts.createArrayLiteral(expressions);
}
function getParametersOfDecoratedDeclaration(node, container) {
- if (container && node.kind === 158) {
+ if (container && node.kind === 159) {
var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor;
if (setAccessor) {
return setAccessor.parameters;
@@ -57636,69 +58317,69 @@
return ts.createIdentifier("Object");
}
switch (node.kind) {
- case 106:
- case 141:
- case 96:
- case 132:
+ case 107:
+ case 142:
+ case 97:
+ case 133:
return ts.createVoidZero();
- case 177:
+ case 178:
return serializeTypeNode(node.type);
- case 165:
case 166:
+ case 167:
return ts.createIdentifier("Function");
- case 169:
case 170:
+ case 171:
return ts.createIdentifier("Array");
- case 163:
- case 123:
+ case 164:
+ case 124:
return ts.createIdentifier("Boolean");
- case 138:
+ case 139:
return ts.createIdentifier("String");
- case 136:
+ case 137:
return ts.createIdentifier("Object");
- case 182:
+ case 183:
switch (node.literal.kind) {
case 10:
return ts.createIdentifier("String");
- case 202:
+ case 203:
case 8:
return ts.createIdentifier("Number");
case 9:
return getGlobalBigIntNameWithFallback();
- case 102:
- case 87:
+ case 103:
+ case 88:
return ts.createIdentifier("Boolean");
default:
return ts.Debug.failBadSyntaxKind(node.literal);
}
- case 135:
+ case 136:
return ts.createIdentifier("Number");
- case 146:
+ case 147:
return getGlobalBigIntNameWithFallback();
- case 139:
+ case 140:
return languageVersion < 2
? getGlobalSymbolNameWithFallback()
: ts.createIdentifier("Symbol");
- case 164:
+ case 165:
return serializeTypeReferenceNode(node);
+ case 175:
case 174:
- case 173:
return serializeTypeList(node.types);
- case 175:
+ case 176:
return serializeTypeList([node.trueType, node.falseType]);
- case 179:
- if (node.operator === 133) {
+ case 180:
+ if (node.operator === 134) {
return serializeTypeNode(node.type);
}
break;
- case 167:
- case 180:
- case 181:
case 168:
- case 120:
- case 143:
- case 178:
- case 183:
+ case 181:
+ case 182:
+ case 169:
+ case 121:
+ case 144:
+ case 179:
+ case 184:
break;
default:
return ts.Debug.failBadSyntaxKind(node);
@@ -57707,15 +58388,15 @@
}
function serializeTypeList(types) {
var serializedUnion;
- for (var _i = 0, types_18 = types; _i < types_18.length; _i++) {
- var typeNode = types_18[_i];
- while (typeNode.kind === 177) {
+ for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
+ var typeNode = types_17[_i];
+ while (typeNode.kind === 178) {
typeNode = typeNode.type;
}
- if (typeNode.kind === 132) {
+ if (typeNode.kind === 133) {
continue;
}
- if (!strictNullChecks && (typeNode.kind === 96 || typeNode.kind === 141)) {
+ if (!strictNullChecks && (typeNode.kind === 97 || typeNode.kind === 142)) {
continue;
}
var serializedIndividual = serializeTypeNode(typeNode);
@@ -57777,11 +58458,11 @@
return ts.createLogicalAnd(ts.createStrictInequality(ts.createTypeOf(left), ts.createLiteral("undefined")), right);
}
function serializeEntityNameAsExpressionFallback(node) {
- if (node.kind === 72) {
+ if (node.kind === 73) {
var copied = serializeEntityNameAsExpression(node);
return createCheckedValue(copied, copied);
}
- if (node.left.kind === 72) {
+ if (node.left.kind === 73) {
return createCheckedValue(serializeEntityNameAsExpression(node.left), serializeEntityNameAsExpression(node));
}
var left = serializeEntityNameAsExpressionFallback(node.left);
@@ -57790,13 +58471,13 @@
}
function serializeEntityNameAsExpression(node) {
switch (node.kind) {
- case 72:
+ case 73:
var name = ts.getMutableClone(node);
name.flags &= ~8;
name.original = undefined;
name.parent = ts.getParseTreeNode(currentLexicalScope);
return name;
- case 148:
+ case 149:
return serializeQualifiedNameAsExpression(node);
}
}
@@ -57807,7 +58488,7 @@
return ts.createConditional(ts.createTypeCheck(ts.createIdentifier("Symbol"), "function"), ts.createIdentifier("Symbol"), ts.createIdentifier("Object"));
}
function getGlobalBigIntNameWithFallback() {
- return languageVersion < 7
+ return languageVersion < 8
? ts.createConditional(ts.createTypeCheck(ts.createIdentifier("BigInt"), "function"), ts.createIdentifier("BigInt"), ts.createIdentifier("Object"))
: ts.createIdentifier("BigInt");
}
@@ -57857,7 +58538,7 @@
}
}
function visitHeritageClause(node) {
- if (node.token === 109) {
+ if (node.token === 110) {
return undefined;
}
return ts.visitEachChild(node, visitor, context);
@@ -58012,7 +58693,7 @@
}
function visitEnumDeclaration(node) {
if (!shouldEmitEnumDeclaration(node)) {
- return undefined;
+ return ts.createNotEmittedStatement(node);
}
var statements = [];
var emitFlags = 2;
@@ -58112,11 +58793,11 @@
function addVarForEnumOrModuleDeclaration(statements, node) {
var statement = ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([
ts.createVariableDeclaration(ts.getLocalName(node, false, true))
- ], currentLexicalScope.kind === 284 ? 0 : 1));
+ ], currentLexicalScope.kind === 285 ? 0 : 1));
ts.setOriginalNode(statement, node);
recordEmittedDeclarationInScope(node);
if (isFirstEmittedDeclarationInScope(node)) {
- if (node.kind === 243) {
+ if (node.kind === 244) {
ts.setSourceMapRange(statement.declarationList, node);
}
else {
@@ -58182,7 +58863,7 @@
var statementsLocation;
var blockLocation;
var body = node.body;
- if (body.kind === 245) {
+ if (body.kind === 246) {
saveStateAndInvoke(body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); });
statementsLocation = body.statements;
blockLocation = body;
@@ -58206,13 +58887,13 @@
currentScopeFirstDeclarationsOfName = savedCurrentScopeFirstDeclarationsOfName;
var block = ts.createBlock(ts.setTextRange(ts.createNodeArray(statements), statementsLocation), true);
ts.setTextRange(block, blockLocation);
- if (body.kind !== 245) {
+ if (body.kind !== 246) {
ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536);
}
return block;
}
function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) {
- if (moduleDeclaration.body.kind === 244) {
+ if (moduleDeclaration.body.kind === 245) {
var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body);
return recursiveInnerModule || moduleDeclaration.body;
}
@@ -58232,7 +58913,7 @@
return (name || namedBindings) ? ts.updateImportClause(node, name, namedBindings) : undefined;
}
function visitNamedImportBindings(node) {
- if (node.kind === 251) {
+ if (node.kind === 252) {
return resolver.isReferencedAliasDeclaration(node) ? node : undefined;
}
else {
@@ -58353,29 +59034,29 @@
function enableSubstitutionForNonQualifiedEnumMembers() {
if ((enabledSubstitutions & 8) === 0) {
enabledSubstitutions |= 8;
- context.enableSubstitution(72);
+ context.enableSubstitution(73);
}
}
function enableSubstitutionForClassAliases() {
if ((enabledSubstitutions & 1) === 0) {
enabledSubstitutions |= 1;
- context.enableSubstitution(72);
+ context.enableSubstitution(73);
classAliases = [];
}
}
function enableSubstitutionForNamespaceExports() {
if ((enabledSubstitutions & 2) === 0) {
enabledSubstitutions |= 2;
- context.enableSubstitution(72);
- context.enableSubstitution(276);
- context.enableEmitNotification(244);
+ context.enableSubstitution(73);
+ context.enableSubstitution(277);
+ context.enableEmitNotification(245);
}
}
function isTransformedModuleDeclaration(node) {
- return ts.getOriginalNode(node).kind === 244;
+ return ts.getOriginalNode(node).kind === 245;
}
function isTransformedEnumDeclaration(node) {
- return ts.getOriginalNode(node).kind === 243;
+ return ts.getOriginalNode(node).kind === 244;
}
function onEmitNode(hint, node, emitCallback) {
var savedApplicableSubstitutions = applicableSubstitutions;
@@ -58419,11 +59100,11 @@
}
function substituteExpression(node) {
switch (node.kind) {
- case 72:
+ case 73:
return substituteExpressionIdentifier(node);
- case 189:
- return substitutePropertyAccessExpression(node);
case 190:
+ return substitutePropertyAccessExpression(node);
+ case 191:
return substituteElementAccessExpression(node);
}
return node;
@@ -58453,9 +59134,9 @@
function trySubstituteNamespaceExportedName(node) {
if (enabledSubstitutions & applicableSubstitutions && !ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) {
var container = resolver.getReferencedExportContainer(node, false);
- if (container && container.kind !== 284) {
- var substitute = (applicableSubstitutions & 2 && container.kind === 244) ||
- (applicableSubstitutions & 8 && container.kind === 243);
+ if (container && container.kind !== 285) {
+ var substitute = (applicableSubstitutions & 2 && container.kind === 245) ||
+ (applicableSubstitutions & 8 && container.kind === 244);
if (substitute) {
return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node), node);
}
@@ -58569,25 +59250,25 @@
return node;
}
switch (node.kind) {
- case 121:
+ case 122:
return undefined;
- case 201:
+ case 202:
return visitAwaitExpression(node);
- case 156:
+ case 157:
return visitMethodDeclaration(node);
- case 239:
+ case 240:
return visitFunctionDeclaration(node);
- case 196:
- return visitFunctionExpression(node);
case 197:
+ return visitFunctionExpression(node);
+ case 198:
return visitArrowFunction(node);
- case 189:
- if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 98) {
+ case 190:
+ if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 99) {
capturedSuperProperties.set(node.name.escapedText, true);
}
return ts.visitEachChild(node, visitor, context);
- case 190:
- if (capturedSuperProperties && node.expression.kind === 98) {
+ case 191:
+ if (capturedSuperProperties && node.expression.kind === 99) {
hasSuperElementAccess = true;
}
return ts.visitEachChild(node, visitor, context);
@@ -58598,27 +59279,27 @@
function asyncBodyVisitor(node) {
if (ts.isNodeWithPossibleHoistedDeclaration(node)) {
switch (node.kind) {
- case 219:
+ case 220:
return visitVariableStatementInAsyncBody(node);
- case 225:
- return visitForStatementInAsyncBody(node);
case 226:
- return visitForInStatementInAsyncBody(node);
+ return visitForStatementInAsyncBody(node);
case 227:
+ return visitForInStatementInAsyncBody(node);
+ case 228:
return visitForOfStatementInAsyncBody(node);
- case 274:
+ case 275:
return visitCatchClauseInAsyncBody(node);
- case 218:
- case 232:
- case 246:
- case 271:
+ case 219:
+ case 233:
+ case 247:
case 272:
- case 235:
- case 223:
+ case 273:
+ case 236:
case 224:
- case 222:
- case 231:
- case 233:
+ case 225:
+ case 223:
+ case 232:
+ case 234:
return ts.visitEachChild(node, asyncBodyVisitor, context);
default:
return ts.Debug.assertNever(node, "Unhandled node.");
@@ -58767,7 +59448,7 @@
var original = ts.getOriginalNode(node, ts.isFunctionLike);
var nodeType = original.type;
var promiseConstructor = languageVersion < 2 ? getPromiseConstructor(nodeType) : undefined;
- var isArrowFunction = node.kind === 197;
+ var isArrowFunction = node.kind === 198;
var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192) !== 0;
var savedEnclosingFunctionParameterNames = enclosingFunctionParameterNames;
enclosingFunctionParameterNames = ts.createUnderscoreEscapedMap();
@@ -58848,15 +59529,15 @@
function enableSubstitutionForAsyncMethodsWithSuper() {
if ((enabledSubstitutions & 1) === 0) {
enabledSubstitutions |= 1;
- context.enableSubstitution(191);
- context.enableSubstitution(189);
+ context.enableSubstitution(192);
context.enableSubstitution(190);
- context.enableEmitNotification(240);
- context.enableEmitNotification(156);
- context.enableEmitNotification(158);
- context.enableEmitNotification(159);
+ context.enableSubstitution(191);
+ context.enableEmitNotification(241);
context.enableEmitNotification(157);
- context.enableEmitNotification(219);
+ context.enableEmitNotification(159);
+ context.enableEmitNotification(160);
+ context.enableEmitNotification(158);
+ context.enableEmitNotification(220);
}
}
function onEmitNode(hint, node, emitCallback) {
@@ -58888,23 +59569,23 @@
}
function substituteExpression(node) {
switch (node.kind) {
- case 189:
- return substitutePropertyAccessExpression(node);
case 190:
- return substituteElementAccessExpression(node);
+ return substitutePropertyAccessExpression(node);
case 191:
+ return substituteElementAccessExpression(node);
+ case 192:
return substituteCallExpression(node);
}
return node;
}
function substitutePropertyAccessExpression(node) {
- if (node.expression.kind === 98) {
+ if (node.expression.kind === 99) {
return ts.setTextRange(ts.createPropertyAccess(ts.createFileLevelUniqueName("_super"), node.name), node);
}
return node;
}
function substituteElementAccessExpression(node) {
- if (node.expression.kind === 98) {
+ if (node.expression.kind === 99) {
return createSuperElementAccessInAsyncMethod(node.argumentExpression, node);
}
return node;
@@ -58923,11 +59604,11 @@
}
function isSuperContainer(node) {
var kind = node.kind;
- return kind === 240
- || kind === 157
- || kind === 156
+ return kind === 241
|| kind === 158
- || kind === 159;
+ || kind === 157
+ || kind === 159
+ || kind === 160;
}
function createSuperElementAccessInAsyncMethod(argumentExpression, location) {
if (enclosingSuperContainerFlags & 4096) {
@@ -59022,7 +59703,7 @@
return visitorWorker(node, true);
}
function visitorNoAsyncModifier(node) {
- if (node.kind === 121) {
+ if (node.kind === 122) {
return undefined;
}
return node;
@@ -59032,53 +59713,55 @@
return node;
}
switch (node.kind) {
- case 201:
+ case 202:
return visitAwaitExpression(node);
- case 207:
+ case 208:
return visitYieldExpression(node);
- case 230:
+ case 231:
return visitReturnStatement(node);
- case 233:
+ case 234:
return visitLabeledStatement(node);
- case 188:
+ case 189:
return visitObjectLiteralExpression(node);
- case 204:
+ case 205:
return visitBinaryExpression(node, noDestructuringValue);
- case 237:
+ case 275:
+ return visitCatchClause(node);
+ case 238:
return visitVariableDeclaration(node);
- case 227:
+ case 228:
return visitForOfStatement(node, undefined);
- case 225:
+ case 226:
return visitForStatement(node);
- case 200:
+ case 201:
return visitVoidExpression(node);
- case 157:
+ case 158:
return visitConstructorDeclaration(node);
- case 156:
+ case 157:
return visitMethodDeclaration(node);
- case 158:
- return visitGetAccessorDeclaration(node);
case 159:
+ return visitGetAccessorDeclaration(node);
+ case 160:
return visitSetAccessorDeclaration(node);
- case 239:
+ case 240:
return visitFunctionDeclaration(node);
- case 196:
- return visitFunctionExpression(node);
case 197:
+ return visitFunctionExpression(node);
+ case 198:
return visitArrowFunction(node);
- case 151:
+ case 152:
return visitParameter(node);
- case 221:
+ case 222:
return visitExpressionStatement(node);
- case 195:
+ case 196:
return visitParenthesizedExpression(node, noDestructuringValue);
- case 189:
- if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 98) {
+ case 190:
+ if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 99) {
capturedSuperProperties.set(node.name.escapedText, true);
}
return ts.visitEachChild(node, visitor, context);
- case 190:
- if (capturedSuperProperties && node.expression.kind === 98) {
+ case 191:
+ if (capturedSuperProperties && node.expression.kind === 99) {
hasSuperElementAccess = true;
}
return ts.visitEachChild(node, visitor, context);
@@ -59113,7 +59796,7 @@
function visitLabeledStatement(node) {
if (enclosingFunctionFlags & 2) {
var statement = ts.unwrapInnermostStatementOfLabel(node);
- if (statement.kind === 227 && statement.awaitModifier) {
+ if (statement.kind === 228 && statement.awaitModifier) {
return visitForOfStatement(statement, node);
}
return ts.restoreEnclosingLabel(ts.visitEachChild(statement, visitor, context), node);
@@ -59125,7 +59808,7 @@
var objects = [];
for (var _i = 0, elements_4 = elements; _i < elements_4.length; _i++) {
var e = elements_4[_i];
- if (e.kind === 277) {
+ if (e.kind === 278) {
if (chunkObject) {
objects.push(ts.createObjectLiteral(chunkObject));
chunkObject = undefined;
@@ -59134,7 +59817,7 @@
objects.push(ts.visitNode(target, visitor, ts.isExpression));
}
else {
- chunkObject = ts.append(chunkObject, e.kind === 275
+ chunkObject = ts.append(chunkObject, e.kind === 276
? ts.createPropertyAssignment(e.name, ts.visitNode(e.initializer, visitor, ts.isExpression))
: ts.visitNode(e, visitor, ts.isObjectLiteralElementLike));
}
@@ -59147,7 +59830,7 @@
function visitObjectLiteralExpression(node) {
if (node.transformFlags & 8192) {
var objects = chunkObjectLiteralElements(node.properties);
- if (objects.length && objects[0].kind !== 188) {
+ if (objects.length && objects[0].kind !== 189) {
objects.unshift(ts.createObjectLiteral());
}
return createAssignHelper(context, objects);
@@ -59169,6 +59852,23 @@
}
return ts.visitEachChild(node, visitor, context);
}
+ function visitCatchClause(node) {
+ if (node.variableDeclaration &&
+ ts.isBindingPattern(node.variableDeclaration.name) &&
+ node.variableDeclaration.name.transformFlags & 8192) {
+ var name = ts.getGeneratedNameForNode(node.variableDeclaration.name);
+ var updatedDecl = ts.updateVariableDeclaration(node.variableDeclaration, node.variableDeclaration.name, undefined, name);
+ var visitedBindings = ts.flattenDestructuringBinding(updatedDecl, visitor, context, 1);
+ var block = ts.visitNode(node.block, visitor, ts.isBlock);
+ if (ts.some(visitedBindings)) {
+ block = ts.updateBlock(block, [
+ ts.createVariableStatement(undefined, visitedBindings)
+ ].concat(block.statements));
+ }
+ return ts.updateCatchClause(node, ts.updateVariableDeclaration(node.variableDeclaration, name, undefined, undefined), block);
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
function visitVariableDeclaration(node) {
if (ts.isBindingPattern(node.name) && node.name.transformFlags & 8192) {
return ts.flattenDestructuringBinding(node, visitor, context, 1);
@@ -59409,15 +60109,15 @@
function enableSubstitutionForAsyncMethodsWithSuper() {
if ((enabledSubstitutions & 1) === 0) {
enabledSubstitutions |= 1;
- context.enableSubstitution(191);
- context.enableSubstitution(189);
+ context.enableSubstitution(192);
context.enableSubstitution(190);
- context.enableEmitNotification(240);
- context.enableEmitNotification(156);
- context.enableEmitNotification(158);
- context.enableEmitNotification(159);
+ context.enableSubstitution(191);
+ context.enableEmitNotification(241);
context.enableEmitNotification(157);
- context.enableEmitNotification(219);
+ context.enableEmitNotification(159);
+ context.enableEmitNotification(160);
+ context.enableEmitNotification(158);
+ context.enableEmitNotification(220);
}
}
function onEmitNode(hint, node, emitCallback) {
@@ -59449,23 +60149,23 @@
}
function substituteExpression(node) {
switch (node.kind) {
- case 189:
- return substitutePropertyAccessExpression(node);
case 190:
- return substituteElementAccessExpression(node);
+ return substitutePropertyAccessExpression(node);
case 191:
+ return substituteElementAccessExpression(node);
+ case 192:
return substituteCallExpression(node);
}
return node;
}
function substitutePropertyAccessExpression(node) {
- if (node.expression.kind === 98) {
+ if (node.expression.kind === 99) {
return ts.setTextRange(ts.createPropertyAccess(ts.createFileLevelUniqueName("_super"), node.name), node);
}
return node;
}
function substituteElementAccessExpression(node) {
- if (node.expression.kind === 98) {
+ if (node.expression.kind === 99) {
return createSuperElementAccessInAsyncMethod(node.argumentExpression, node);
}
return node;
@@ -59484,11 +60184,11 @@
}
function isSuperContainer(node) {
var kind = node.kind;
- return kind === 240
- || kind === 157
- || kind === 156
+ return kind === 241
|| kind === 158
- || kind === 159;
+ || kind === 157
+ || kind === 159
+ || kind === 160;
}
function createSuperElementAccessInAsyncMethod(argumentExpression, location) {
if (enclosingSuperContainerFlags & 4096) {
@@ -59573,7 +60273,7 @@
return node;
}
switch (node.kind) {
- case 274:
+ case 275:
return visitCatchClause(node);
default:
return ts.visitEachChild(node, visitor, context);
@@ -59635,13 +60335,13 @@
}
function visitorWorker(node) {
switch (node.kind) {
- case 260:
- return visitJsxElement(node, false);
case 261:
+ return visitJsxElement(node, false);
+ case 262:
return visitJsxSelfClosingElement(node, false);
- case 264:
+ case 265:
return visitJsxFragment(node, false);
- case 270:
+ case 271:
return visitJsxExpression(node);
default:
return ts.visitEachChild(node, visitor, context);
@@ -59651,13 +60351,13 @@
switch (node.kind) {
case 11:
return visitJsxText(node);
- case 270:
+ case 271:
return visitJsxExpression(node);
- case 260:
- return visitJsxElement(node, true);
case 261:
+ return visitJsxElement(node, true);
+ case 262:
return visitJsxSelfClosingElement(node, true);
- case 264:
+ case 265:
return visitJsxFragment(node, true);
default:
return ts.Debug.failBadSyntaxKind(node);
@@ -59721,7 +60421,7 @@
literal.singleQuote = node.singleQuote !== undefined ? node.singleQuote : !ts.isStringDoubleQuoted(node, currentSourceFile);
return ts.setTextRange(literal, node);
}
- else if (node.kind === 270) {
+ else if (node.kind === 271) {
if (node.expression === undefined) {
return ts.createTrue();
}
@@ -59781,7 +60481,7 @@
return decoded === text ? undefined : decoded;
}
function getTagName(node) {
- if (node.kind === 260) {
+ if (node.kind === 261) {
return getTagName(node.openingElement);
}
else {
@@ -60081,7 +60781,7 @@
return node;
}
switch (node.kind) {
- case 204:
+ case 205:
return visitBinaryExpression(node);
default:
return ts.visitEachChild(node, visitor, context);
@@ -60089,7 +60789,7 @@
}
function visitBinaryExpression(node) {
switch (node.operatorToken.kind) {
- case 63:
+ case 64:
return visitExponentiationAssignmentExpression(node);
case 41:
return visitExponentiationExpression(node);
@@ -60163,21 +60863,21 @@
}
function enterSubtree(excludeFacts, includeFacts) {
var ancestorFacts = hierarchyFacts;
- hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & 8191;
+ hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & 16383;
return ancestorFacts;
}
function exitSubtree(ancestorFacts, excludeFacts, includeFacts) {
- hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & -8192 | ancestorFacts;
+ hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & -16384 | ancestorFacts;
}
function isReturnVoidStatementInConstructorWithCapturedSuper(node) {
- return (hierarchyFacts & 4096) !== 0
- && node.kind === 230
+ return (hierarchyFacts & 8192) !== 0
+ && node.kind === 231
&& !node.expression;
}
function shouldVisitNode(node) {
return (node.transformFlags & 128) !== 0
|| convertedLoopState !== undefined
- || (hierarchyFacts & 4096 && (ts.isStatement(node) || (node.kind === 218)))
+ || (hierarchyFacts & 8192 && (ts.isStatement(node) || (node.kind === 219)))
|| (ts.isIterationStatement(node, false) && shouldConvertIterationStatement(node))
|| (ts.getEmitFlags(node) & 33554432) !== 0;
}
@@ -60190,72 +60890,72 @@
}
}
function callExpressionVisitor(node) {
- if (node.kind === 98) {
+ if (node.kind === 99) {
return visitSuperKeyword(true);
}
return visitor(node);
}
function visitJavaScript(node) {
switch (node.kind) {
- case 116:
+ case 117:
return undefined;
- case 240:
+ case 241:
return visitClassDeclaration(node);
- case 209:
+ case 210:
return visitClassExpression(node);
- case 151:
+ case 152:
return visitParameter(node);
- case 239:
+ case 240:
return visitFunctionDeclaration(node);
- case 197:
+ case 198:
return visitArrowFunction(node);
- case 196:
+ case 197:
return visitFunctionExpression(node);
- case 237:
+ case 238:
return visitVariableDeclaration(node);
- case 72:
+ case 73:
return visitIdentifier(node);
- case 238:
+ case 239:
return visitVariableDeclarationList(node);
- case 232:
+ case 233:
return visitSwitchStatement(node);
- case 246:
+ case 247:
return visitCaseBlock(node);
- case 218:
+ case 219:
return visitBlock(node, false);
+ case 230:
case 229:
- case 228:
return visitBreakOrContinueStatement(node);
- case 233:
+ case 234:
return visitLabeledStatement(node);
- case 223:
case 224:
- return visitDoOrWhileStatement(node, undefined);
case 225:
- return visitForStatement(node, undefined);
+ return visitDoOrWhileStatement(node, undefined);
case 226:
- return visitForInStatement(node, undefined);
+ return visitForStatement(node, undefined);
case 227:
+ return visitForInStatement(node, undefined);
+ case 228:
return visitForOfStatement(node, undefined);
- case 221:
+ case 222:
return visitExpressionStatement(node);
- case 188:
+ case 189:
return visitObjectLiteralExpression(node);
- case 274:
+ case 275:
return visitCatchClause(node);
- case 276:
+ case 277:
return visitShorthandPropertyAssignment(node);
- case 149:
+ case 150:
return visitComputedPropertyName(node);
- case 187:
+ case 188:
return visitArrayLiteralExpression(node);
- case 191:
- return visitCallExpression(node);
case 192:
+ return visitCallExpression(node);
+ case 193:
return visitNewExpression(node);
- case 195:
+ case 196:
return visitParenthesizedExpression(node, true);
- case 204:
+ case 205:
return visitBinaryExpression(node, true);
case 14:
case 15:
@@ -60266,35 +60966,35 @@
return visitStringLiteral(node);
case 8:
return visitNumericLiteral(node);
- case 193:
+ case 194:
return visitTaggedTemplateExpression(node);
- case 206:
- return visitTemplateExpression(node);
case 207:
- return visitYieldExpression(node);
+ return visitTemplateExpression(node);
case 208:
+ return visitYieldExpression(node);
+ case 209:
return visitSpreadElement(node);
- case 98:
+ case 99:
return visitSuperKeyword(false);
- case 100:
+ case 101:
return visitThisKeyword(node);
- case 214:
+ case 215:
return visitMetaProperty(node);
- case 156:
+ case 157:
return visitMethodDeclaration(node);
- case 158:
case 159:
+ case 160:
return visitAccessorDeclaration(node);
- case 219:
+ case 220:
return visitVariableStatement(node);
- case 230:
+ case 231:
return visitReturnStatement(node);
default:
return ts.visitEachChild(node, visitor, context);
}
}
function visitSourceFile(node) {
- var ancestorFacts = enterSubtree(3968, 64);
+ var ancestorFacts = enterSubtree(8064, 64);
var prologue = [];
var statements = [];
startLexicalEnvironment();
@@ -60320,7 +61020,7 @@
return ts.visitEachChild(node, visitor, context);
}
function visitCaseBlock(node) {
- var ancestorFacts = enterSubtree(4032, 0);
+ var ancestorFacts = enterSubtree(7104, 0);
var updated = ts.visitEachChild(node, visitor, context);
exitSubtree(ancestorFacts, 0, 0);
return updated;
@@ -60347,7 +61047,7 @@
}
function visitThisKeyword(node) {
if (hierarchyFacts & 2) {
- hierarchyFacts |= 16384;
+ hierarchyFacts |= 32768;
}
if (convertedLoopState) {
if (hierarchyFacts & 2) {
@@ -60372,14 +61072,14 @@
}
function visitBreakOrContinueStatement(node) {
if (convertedLoopState) {
- var jump = node.kind === 229 ? 2 : 4;
+ var jump = node.kind === 230 ? 2 : 4;
var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels.get(ts.idText(node.label))) ||
(!node.label && (convertedLoopState.allowedNonLabeledJumps & jump));
if (!canUseBreakOrContinue) {
var labelMarker = void 0;
var label = node.label;
if (!label) {
- if (node.kind === 229) {
+ if (node.kind === 230) {
convertedLoopState.nonLocalJumps |= 2;
labelMarker = "break";
}
@@ -60389,7 +61089,7 @@
}
}
else {
- if (node.kind === 229) {
+ if (node.kind === 230) {
labelMarker = "break-" + label.escapedText;
setLabeledJump(convertedLoopState, true, ts.idText(label), labelMarker);
}
@@ -60491,7 +61191,7 @@
function addConstructor(statements, node, extendsClauseElement) {
var savedConvertedLoopState = convertedLoopState;
convertedLoopState = undefined;
- var ancestorFacts = enterSubtree(8086, 73);
+ var ancestorFacts = enterSubtree(16278, 73);
var constructor = ts.getFirstConstructorWithBody(node);
var hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== undefined);
var constructorFunction = ts.createFunctionDeclaration(undefined, undefined, undefined, ts.getInternalName(node), undefined, transformConstructorParameters(constructor, hasSynthesizedSuper), undefined, transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper));
@@ -60500,7 +61200,7 @@
ts.setEmitFlags(constructorFunction, 8);
}
statements.push(constructorFunction);
- exitSubtree(ancestorFacts, 24576, 0);
+ exitSubtree(ancestorFacts, 49152, 0);
convertedLoopState = savedConvertedLoopState;
}
function transformConstructorParameters(constructor, hasSynthesizedSuper) {
@@ -60522,7 +61222,7 @@
return block;
}
function transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper) {
- var isDerivedClass = !!extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 96;
+ var isDerivedClass = !!extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 97;
if (!constructor)
return createDefaultConstructorBody(node, isDerivedClass);
var prologue = [];
@@ -60546,7 +61246,7 @@
}
}
if (superCallExpression) {
- hierarchyFacts |= 4096;
+ hierarchyFacts |= 8192;
statementOffset++;
}
ts.addRange(statements, ts.visitNodes(constructor.body.statements, visitor, ts.isStatement, statementOffset));
@@ -60575,17 +61275,17 @@
return block;
}
function isSufficientlyCoveredByReturnStatements(statement) {
- if (statement.kind === 230) {
+ if (statement.kind === 231) {
return true;
}
- else if (statement.kind === 222) {
+ else if (statement.kind === 223) {
var ifStatement = statement;
if (ifStatement.elseStatement) {
return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) &&
isSufficientlyCoveredByReturnStatements(ifStatement.elseStatement);
}
}
- else if (statement.kind === 218) {
+ else if (statement.kind === 219) {
var lastStatement = ts.lastOrUndefined(statement.statements);
if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) {
return true;
@@ -60668,9 +61368,9 @@
if (!shouldAddRestParameter(parameter, inConstructorWithSynthesizedSuper)) {
return false;
}
- var declarationName = parameter.name.kind === 72 ? ts.getMutableClone(parameter.name) : ts.createTempVariable(undefined);
+ var declarationName = parameter.name.kind === 73 ? ts.getMutableClone(parameter.name) : ts.createTempVariable(undefined);
ts.setEmitFlags(declarationName, 48);
- var expressionName = parameter.name.kind === 72 ? ts.getSynthesizedClone(parameter.name) : declarationName;
+ var expressionName = parameter.name.kind === 73 ? ts.getSynthesizedClone(parameter.name) : declarationName;
var restIndex = node.parameters.length - 1;
var temp = ts.createLoopVariable();
prologueStatements.push(ts.setEmitFlags(ts.setTextRange(ts.createVariableStatement(undefined, ts.createVariableDeclarationList([
@@ -60686,14 +61386,14 @@
ts.setEmitFlags(forStatement, 1048576);
ts.startOnNewLine(forStatement);
prologueStatements.push(forStatement);
- if (parameter.name.kind !== 72) {
+ if (parameter.name.kind !== 73) {
prologueStatements.push(ts.setEmitFlags(ts.setTextRange(ts.createVariableStatement(undefined, ts.createVariableDeclarationList(ts.flattenDestructuringBinding(parameter, visitor, context, 0, expressionName))), parameter), 1048576));
}
ts.insertStatementsAfterCustomPrologue(statements, prologueStatements);
return true;
}
function insertCaptureThisForNodeIfNeeded(statements, node) {
- if (hierarchyFacts & 16384 && node.kind !== 197) {
+ if (hierarchyFacts & 32768 && node.kind !== 198) {
insertCaptureThisForNode(statements, node, ts.createThis());
return true;
}
@@ -60709,22 +61409,22 @@
ts.insertStatementAfterCustomPrologue(statements, captureThisStatement);
}
function insertCaptureNewTargetIfNeeded(statements, node, copyOnWrite) {
- if (hierarchyFacts & 8192) {
+ if (hierarchyFacts & 16384) {
var newTarget = void 0;
switch (node.kind) {
- case 197:
+ case 198:
return statements;
- case 156:
- case 158:
+ case 157:
case 159:
+ case 160:
newTarget = ts.createVoidZero();
break;
- case 157:
+ case 158:
newTarget = ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4), "constructor");
break;
- case 239:
- case 196:
- newTarget = ts.createConditional(ts.createLogicalAnd(ts.setEmitFlags(ts.createThis(), 4), ts.createBinary(ts.setEmitFlags(ts.createThis(), 4), 94, ts.getLocalName(node))), ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4), "constructor"), ts.createVoidZero());
+ case 240:
+ case 197:
+ newTarget = ts.createConditional(ts.createLogicalAnd(ts.setEmitFlags(ts.createThis(), 4), ts.createBinary(ts.setEmitFlags(ts.createThis(), 4), 95, ts.getLocalName(node))), ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4), "constructor"), ts.createVoidZero());
break;
default:
return ts.Debug.failBadSyntaxKind(node);
@@ -60744,20 +61444,20 @@
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
switch (member.kind) {
- case 217:
+ case 218:
statements.push(transformSemicolonClassElementToStatement(member));
break;
- case 156:
+ case 157:
statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node));
break;
- case 158:
case 159:
+ case 160:
var accessors = ts.getAllAccessorDeclarations(node.members, member);
if (member === accessors.firstAccessor) {
statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node));
}
break;
- case 157:
+ case 158:
break;
default:
ts.Debug.failBadSyntaxKind(node);
@@ -60825,16 +61525,16 @@
}
function visitArrowFunction(node) {
if (node.transformFlags & 2048) {
- hierarchyFacts |= 16384;
+ hierarchyFacts |= 32768;
}
var savedConvertedLoopState = convertedLoopState;
convertedLoopState = undefined;
- var ancestorFacts = enterSubtree(8064, 66);
+ var ancestorFacts = enterSubtree(15232, 66);
var func = ts.createFunctionExpression(undefined, undefined, undefined, undefined, ts.visitParameterList(node.parameters, visitor, context), undefined, transformFunctionBody(node));
ts.setTextRange(func, node);
ts.setOriginalNode(func, node);
ts.setEmitFlags(func, 8);
- if (hierarchyFacts & 16384) {
+ if (hierarchyFacts & 32768) {
enableSubstitutionsForCapturedThis();
}
exitSubtree(ancestorFacts, 0, 0);
@@ -60843,29 +61543,29 @@
}
function visitFunctionExpression(node) {
var ancestorFacts = ts.getEmitFlags(node) & 262144
- ? enterSubtree(8086, 69)
- : enterSubtree(8094, 65);
+ ? enterSubtree(16278, 69)
+ : enterSubtree(16286, 65);
var savedConvertedLoopState = convertedLoopState;
convertedLoopState = undefined;
var parameters = ts.visitParameterList(node.parameters, visitor, context);
var body = transformFunctionBody(node);
- var name = hierarchyFacts & 8192
+ var name = hierarchyFacts & 16384
? ts.getLocalName(node)
: node.name;
- exitSubtree(ancestorFacts, 24576, 0);
+ exitSubtree(ancestorFacts, 49152, 0);
convertedLoopState = savedConvertedLoopState;
return ts.updateFunctionExpression(node, undefined, node.asteriskToken, name, undefined, parameters, undefined, body);
}
function visitFunctionDeclaration(node) {
var savedConvertedLoopState = convertedLoopState;
convertedLoopState = undefined;
- var ancestorFacts = enterSubtree(8094, 65);
+ var ancestorFacts = enterSubtree(16286, 65);
var parameters = ts.visitParameterList(node.parameters, visitor, context);
var body = transformFunctionBody(node);
- var name = hierarchyFacts & 8192
+ var name = hierarchyFacts & 16384
? ts.getLocalName(node)
: node.name;
- exitSubtree(ancestorFacts, 24576, 0);
+ exitSubtree(ancestorFacts, 49152, 0);
convertedLoopState = savedConvertedLoopState;
return ts.updateFunctionDeclaration(node, undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, name, undefined, parameters, undefined, body);
}
@@ -60873,14 +61573,14 @@
var savedConvertedLoopState = convertedLoopState;
convertedLoopState = undefined;
var ancestorFacts = container && ts.isClassLike(container) && !ts.hasModifier(node, 32)
- ? enterSubtree(8094, 65 | 8)
- : enterSubtree(8094, 65);
+ ? enterSubtree(16286, 65 | 8)
+ : enterSubtree(16286, 65);
var parameters = ts.visitParameterList(node.parameters, visitor, context);
var body = transformFunctionBody(node);
- if (hierarchyFacts & 8192 && !name && (node.kind === 239 || node.kind === 196)) {
+ if (hierarchyFacts & 16384 && !name && (node.kind === 240 || node.kind === 197)) {
name = ts.getGeneratedNameForNode(node);
}
- exitSubtree(ancestorFacts, 24576, 0);
+ exitSubtree(ancestorFacts, 49152, 0);
convertedLoopState = savedConvertedLoopState;
return ts.setOriginalNode(ts.setTextRange(ts.createFunctionExpression(undefined, node.asteriskToken, name, undefined, parameters, undefined, body), location), node);
}
@@ -60908,7 +61608,7 @@
}
}
else {
- ts.Debug.assert(node.kind === 197);
+ ts.Debug.assert(node.kind === 198);
statementsLocation = ts.moveRangeEnd(body, -1);
var equalsGreaterThanToken = node.equalsGreaterThanToken;
if (!ts.nodeIsSynthesized(equalsGreaterThanToken) && !ts.nodeIsSynthesized(body)) {
@@ -60953,17 +61653,17 @@
return ts.visitEachChild(node, visitor, context);
}
var ancestorFacts = hierarchyFacts & 256
- ? enterSubtree(4032, 512)
- : enterSubtree(3904, 128);
+ ? enterSubtree(7104, 512)
+ : enterSubtree(6976, 128);
var updated = ts.visitEachChild(node, visitor, context);
exitSubtree(ancestorFacts, 0, 0);
return updated;
}
function visitExpressionStatement(node) {
switch (node.expression.kind) {
- case 195:
+ case 196:
return ts.updateExpressionStatement(node, visitParenthesizedExpression(node.expression, false));
- case 204:
+ case 205:
return ts.updateExpressionStatement(node, visitBinaryExpression(node.expression, false));
}
return ts.visitEachChild(node, visitor, context);
@@ -60971,9 +61671,9 @@
function visitParenthesizedExpression(node, needsDestructuringValue) {
if (!needsDestructuringValue) {
switch (node.expression.kind) {
- case 195:
+ case 196:
return ts.updateParen(node, visitParenthesizedExpression(node.expression, false));
- case 204:
+ case 205:
return ts.updateParen(node, visitBinaryExpression(node.expression, false));
}
}
@@ -60999,7 +61699,7 @@
assignment = ts.flattenDestructuringAssignment(decl, visitor, context, 0);
}
else {
- assignment = ts.createBinary(decl.name, 59, ts.visitNode(decl.initializer, visitor, ts.isExpression));
+ assignment = ts.createBinary(decl.name, 60, ts.visitNode(decl.initializer, visitor, ts.isExpression));
ts.setTextRange(assignment, decl);
}
assignments = ts.append(assignments, assignment);
@@ -61056,11 +61756,11 @@
&& isDeclaredInLoop
&& (hierarchyFacts & 512) !== 0);
var emitExplicitInitializer = !emittedAsTopLevel
- && (hierarchyFacts & 2048) === 0
+ && (hierarchyFacts & 4096) === 0
&& (!resolver.isDeclarationWithCollidingName(node)
|| (isDeclaredInLoop
&& !isCapturedInFunction
- && (hierarchyFacts & (1024 | 2048)) === 0));
+ && (hierarchyFacts & (2048 | 4096)) === 0));
return emitExplicitInitializer;
}
function visitVariableDeclarationInLetDeclarationList(node) {
@@ -61104,34 +61804,34 @@
}
function visitIterationStatement(node, outermostLabeledStatement) {
switch (node.kind) {
- case 223:
case 224:
- return visitDoOrWhileStatement(node, outermostLabeledStatement);
case 225:
- return visitForStatement(node, outermostLabeledStatement);
+ return visitDoOrWhileStatement(node, outermostLabeledStatement);
case 226:
- return visitForInStatement(node, outermostLabeledStatement);
+ return visitForStatement(node, outermostLabeledStatement);
case 227:
+ return visitForInStatement(node, outermostLabeledStatement);
+ case 228:
return visitForOfStatement(node, outermostLabeledStatement);
}
}
function visitIterationStatementWithFacts(excludeFacts, includeFacts, node, outermostLabeledStatement, convert) {
var ancestorFacts = enterSubtree(excludeFacts, includeFacts);
- var updated = convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert);
+ var updated = convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, ancestorFacts, convert);
exitSubtree(ancestorFacts, 0, 0);
return updated;
}
function visitDoOrWhileStatement(node, outermostLabeledStatement) {
- return visitIterationStatementWithFacts(0, 256, node, outermostLabeledStatement);
+ return visitIterationStatementWithFacts(0, 1280, node, outermostLabeledStatement);
}
function visitForStatement(node, outermostLabeledStatement) {
- return visitIterationStatementWithFacts(3008, 1280, node, outermostLabeledStatement);
+ return visitIterationStatementWithFacts(5056, 3328, node, outermostLabeledStatement);
}
function visitForInStatement(node, outermostLabeledStatement) {
- return visitIterationStatementWithFacts(1984, 2304, node, outermostLabeledStatement);
+ return visitIterationStatementWithFacts(3008, 5376, node, outermostLabeledStatement);
}
function visitForOfStatement(node, outermostLabeledStatement) {
- return visitIterationStatementWithFacts(1984, 2304, node, outermostLabeledStatement, compilerOptions.downlevelIteration ? convertForOfStatementForIterable : convertForOfStatementForArray);
+ return visitIterationStatementWithFacts(3008, 5376, node, outermostLabeledStatement, compilerOptions.downlevelIteration ? convertForOfStatementForIterable : convertForOfStatementForArray);
}
function convertForOfStatementHead(node, boundValue, convertedLoopBodyStatements) {
var statements = [];
@@ -61195,7 +61895,7 @@
ts.setTextRange(forStatement, node);
return ts.restoreEnclosingLabel(forStatement, outermostLabeledStatement, convertedLoopState && resetLabel);
}
- function convertForOfStatementForIterable(node, outermostLabeledStatement, convertedLoopBodyStatements) {
+ function convertForOfStatementForIterable(node, outermostLabeledStatement, convertedLoopBodyStatements, ancestorFacts) {
var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
var iterator = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(expression) : ts.createTempVariable(undefined);
var result = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(iterator) : ts.createTempVariable(undefined);
@@ -61206,8 +61906,11 @@
var next = ts.createCall(ts.createPropertyAccess(iterator, "next"), undefined, []);
hoistVariableDeclaration(errorRecord);
hoistVariableDeclaration(returnMethod);
+ var initializer = ancestorFacts & 1024
+ ? ts.inlineExpressions([ts.createAssignment(errorRecord, ts.createVoidZero()), values])
+ : values;
var forStatement = ts.setEmitFlags(ts.setTextRange(ts.createFor(ts.setEmitFlags(ts.setTextRange(ts.createVariableDeclarationList([
- ts.setTextRange(ts.createVariableDeclaration(iterator, undefined, values), node.expression),
+ ts.setTextRange(ts.createVariableDeclaration(iterator, undefined, initializer), node.expression),
ts.createVariableDeclaration(result, undefined, next)
]), node.expression), 2097152), ts.createLogicalNot(ts.createPropertyAccess(result, "done")), ts.createAssignment(result, next), convertForOfStatementHead(node, ts.createPropertyAccess(result, "value"), convertedLoopBodyStatements)), node), 256);
return ts.createTry(ts.createBlock([
@@ -61235,7 +61938,7 @@
&& i < numInitialPropertiesWithoutYield) {
numInitialPropertiesWithoutYield = i;
}
- if (property.name.kind === 149) {
+ if (property.name.kind === 150) {
numInitialProperties = i;
break;
}
@@ -61282,7 +61985,7 @@
}
visit(node.name);
function visit(node) {
- if (node.kind === 72) {
+ if (node.kind === 73) {
state.hoistedLocalVariables.push(node);
}
else {
@@ -61295,7 +61998,7 @@
}
}
}
- function convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert) {
+ function convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, ancestorFacts, convert) {
if (!shouldConvertIterationStatement(node)) {
var saveAllowedNonLabeledJumps = void 0;
if (convertedLoopState) {
@@ -61303,7 +62006,7 @@
convertedLoopState.allowedNonLabeledJumps = 2 | 4;
}
var result = convert
- ? convert(node, outermostLabeledStatement, undefined)
+ ? convert(node, outermostLabeledStatement, undefined, ancestorFacts)
: ts.restoreEnclosingLabel(ts.visitEachChild(node, visitor, context), outermostLabeledStatement, convertedLoopState && resetLabel);
if (convertedLoopState) {
convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps;
@@ -61328,7 +62031,7 @@
var loop;
if (bodyFunction) {
if (convert) {
- loop = convert(node, outermostLabeledStatement, bodyFunction.part);
+ loop = convert(node, outermostLabeledStatement, bodyFunction.part, ancestorFacts);
}
else {
var clone_3 = convertIterationStatementCore(node, initializerFunction, ts.createBlock(bodyFunction.part, true));
@@ -61346,11 +62049,11 @@
}
function convertIterationStatementCore(node, initializerFunction, convertedLoopBody) {
switch (node.kind) {
- case 225: return convertForStatement(node, initializerFunction, convertedLoopBody);
- case 226: return convertForInStatement(node, convertedLoopBody);
- case 227: return convertForOfStatement(node, convertedLoopBody);
- case 223: return convertDoStatement(node, convertedLoopBody);
- case 224: return convertWhileStatement(node, convertedLoopBody);
+ case 226: return convertForStatement(node, initializerFunction, convertedLoopBody);
+ case 227: return convertForInStatement(node, convertedLoopBody);
+ case 228: return convertForOfStatement(node, convertedLoopBody);
+ case 224: return convertDoStatement(node, convertedLoopBody);
+ case 225: return convertWhileStatement(node, convertedLoopBody);
default: return ts.Debug.failBadSyntaxKind(node, "IterationStatement expected");
}
}
@@ -61374,11 +62077,11 @@
function createConvertedLoopState(node) {
var loopInitializer;
switch (node.kind) {
- case 225:
case 226:
case 227:
+ case 228:
var initializer = node.initializer;
- if (initializer && initializer.kind === 238) {
+ if (initializer && initializer.kind === 239) {
loopInitializer = initializer;
}
break;
@@ -61516,7 +62219,7 @@
function copyOutParameter(outParam, copyDirection) {
var source = copyDirection === 0 ? outParam.outParamName : outParam.originalName;
var target = copyDirection === 0 ? outParam.originalName : outParam.outParamName;
- return ts.createBinary(target, 59, source);
+ return ts.createBinary(target, 60, source);
}
function copyOutParameters(outParams, partFlags, copyDirection, statements) {
for (var _i = 0, outParams_1 = outParams; _i < outParams_1.length; _i++) {
@@ -61637,20 +62340,20 @@
for (var i = start; i < numProperties; i++) {
var property = properties[i];
switch (property.kind) {
- case 158:
case 159:
+ case 160:
var accessors = ts.getAllAccessorDeclarations(node.properties, property);
if (property === accessors.firstAccessor) {
expressions.push(transformAccessorsToExpression(receiver, accessors, node, !!node.multiLine));
}
break;
- case 156:
+ case 157:
expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine));
break;
- case 275:
+ case 276:
expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine));
break;
- case 276:
+ case 277:
expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine));
break;
default:
@@ -61684,7 +62387,7 @@
return expression;
}
function visitCatchClause(node) {
- var ancestorFacts = enterSubtree(4032, 0);
+ var ancestorFacts = enterSubtree(7104, 0);
var updated;
ts.Debug.assert(!!node.variableDeclaration, "Catch clause variable should always be present when downleveling ES2015.");
if (ts.isBindingPattern(node.variableDeclaration.name)) {
@@ -61717,17 +62420,17 @@
ts.Debug.assert(!ts.isComputedPropertyName(node.name));
var savedConvertedLoopState = convertedLoopState;
convertedLoopState = undefined;
- var ancestorFacts = enterSubtree(8094, 65);
+ var ancestorFacts = enterSubtree(16286, 65);
var updated;
var parameters = ts.visitParameterList(node.parameters, visitor, context);
var body = transformFunctionBody(node);
- if (node.kind === 158) {
+ if (node.kind === 159) {
updated = ts.updateGetAccessor(node, node.decorators, node.modifiers, node.name, parameters, node.type, body);
}
else {
updated = ts.updateSetAccessor(node, node.decorators, node.modifiers, node.name, parameters, body);
}
- exitSubtree(ancestorFacts, 24576, 0);
+ exitSubtree(ancestorFacts, 49152, 0);
convertedLoopState = savedConvertedLoopState;
return updated;
}
@@ -61751,7 +62454,7 @@
return visitTypeScriptClassWrapper(node);
}
var expression = ts.skipOuterExpressions(node.expression);
- if (expression.kind === 98 ||
+ if (expression.kind === 99 ||
ts.isSuperProperty(expression) ||
ts.some(node.arguments, ts.isSpreadElement)) {
return visitCallExpressionWithPotentialCapturedThisAssignment(node, true);
@@ -61800,20 +62503,20 @@
}
function visitCallExpressionWithPotentialCapturedThisAssignment(node, assignToCapturedThis) {
if (node.transformFlags & 4096 ||
- node.expression.kind === 98 ||
+ node.expression.kind === 99 ||
ts.isSuperProperty(ts.skipOuterExpressions(node.expression))) {
var _a = ts.createCallBinding(node.expression, hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;
- if (node.expression.kind === 98) {
+ if (node.expression.kind === 99) {
ts.setEmitFlags(thisArg, 4);
}
var resultingCall = void 0;
if (node.transformFlags & 4096) {
- resultingCall = ts.createFunctionApply(ts.visitNode(target, callExpressionVisitor, ts.isExpression), node.expression.kind === 98 ? thisArg : ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, false, false, false));
+ resultingCall = ts.createFunctionApply(ts.visitNode(target, callExpressionVisitor, ts.isExpression), node.expression.kind === 99 ? thisArg : ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, false, false, false));
}
else {
- resultingCall = ts.createFunctionCall(ts.visitNode(target, callExpressionVisitor, ts.isExpression), node.expression.kind === 98 ? thisArg : ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression), node);
+ resultingCall = ts.createFunctionCall(ts.visitNode(target, callExpressionVisitor, ts.isExpression), node.expression.kind === 99 ? thisArg : ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression), node);
}
- if (node.expression.kind === 98) {
+ if (node.expression.kind === 99) {
var initializer = ts.createLogicalOr(resultingCall, createActualThis());
resultingCall = assignToCapturedThis
? ts.createAssignment(ts.createFileLevelUniqueName("_this"), initializer)
@@ -61850,7 +62553,7 @@
else {
if (segments.length === 1) {
var firstElement = elements[0];
- return needsUniqueCopy && ts.isSpreadElement(firstElement) && firstElement.expression.kind !== 187
+ return needsUniqueCopy && ts.isSpreadElement(firstElement) && firstElement.expression.kind !== 188
? ts.createArraySlice(segments[0])
: segments[0];
}
@@ -61964,15 +62667,15 @@
: ts.createFileLevelUniqueName("_super");
}
function visitMetaProperty(node) {
- if (node.keywordToken === 95 && node.name.escapedText === "target") {
- hierarchyFacts |= 8192;
+ if (node.keywordToken === 96 && node.name.escapedText === "target") {
+ hierarchyFacts |= 16384;
return ts.createFileLevelUniqueName("_newTarget");
}
return node;
}
function onEmitNode(hint, node, emitCallback) {
if (enabledSubstitutions & 1 && ts.isFunctionLike(node)) {
- var ancestorFacts = enterSubtree(8094, ts.getEmitFlags(node) & 8
+ var ancestorFacts = enterSubtree(16286, ts.getEmitFlags(node) & 8
? 65 | 16
: 65);
previousOnEmitNode(hint, node, emitCallback);
@@ -61984,20 +62687,20 @@
function enableSubstitutionsForBlockScopedBindings() {
if ((enabledSubstitutions & 2) === 0) {
enabledSubstitutions |= 2;
- context.enableSubstitution(72);
+ context.enableSubstitution(73);
}
}
function enableSubstitutionsForCapturedThis() {
if ((enabledSubstitutions & 1) === 0) {
enabledSubstitutions |= 1;
- context.enableSubstitution(100);
- context.enableEmitNotification(157);
- context.enableEmitNotification(156);
+ context.enableSubstitution(101);
context.enableEmitNotification(158);
+ context.enableEmitNotification(157);
context.enableEmitNotification(159);
+ context.enableEmitNotification(160);
+ context.enableEmitNotification(198);
context.enableEmitNotification(197);
- context.enableEmitNotification(196);
- context.enableEmitNotification(239);
+ context.enableEmitNotification(240);
}
}
function onSubstituteNode(hint, node) {
@@ -62021,10 +62724,10 @@
}
function isNameOfDeclarationWithCollidingName(node) {
switch (node.parent.kind) {
- case 186:
- case 240:
- case 243:
- case 237:
+ case 187:
+ case 241:
+ case 244:
+ case 238:
return node.parent.name === node
&& resolver.isDeclarationWithCollidingName(node.parent);
}
@@ -62032,9 +62735,9 @@
}
function substituteExpression(node) {
switch (node.kind) {
- case 72:
+ case 73:
return substituteExpressionIdentifier(node);
- case 100:
+ case 101:
return substituteThisKeyword(node);
}
return node;
@@ -62085,19 +62788,19 @@
return false;
}
var statement = ts.firstOrUndefined(constructor.body.statements);
- if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 221) {
+ if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 222) {
return false;
}
var statementExpression = statement.expression;
- if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 191) {
+ if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 192) {
return false;
}
var callTarget = statementExpression.expression;
- if (!ts.nodeIsSynthesized(callTarget) || callTarget.kind !== 98) {
+ if (!ts.nodeIsSynthesized(callTarget) || callTarget.kind !== 99) {
return false;
}
var callArgument = ts.singleOrUndefined(statementExpression.arguments);
- if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 208) {
+ if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 209) {
return false;
}
var expression = callArgument.expression;
@@ -62141,24 +62844,24 @@
if (compilerOptions.jsx === 1 || compilerOptions.jsx === 3) {
previousOnEmitNode = context.onEmitNode;
context.onEmitNode = onEmitNode;
- context.enableEmitNotification(262);
context.enableEmitNotification(263);
- context.enableEmitNotification(261);
+ context.enableEmitNotification(264);
+ context.enableEmitNotification(262);
noSubstitution = [];
}
var previousOnSubstituteNode = context.onSubstituteNode;
context.onSubstituteNode = onSubstituteNode;
- context.enableSubstitution(189);
- context.enableSubstitution(275);
+ context.enableSubstitution(190);
+ context.enableSubstitution(276);
return ts.chainBundle(transformSourceFile);
function transformSourceFile(node) {
return node;
}
function onEmitNode(hint, node, emitCallback) {
switch (node.kind) {
- case 262:
case 263:
- case 261:
+ case 264:
+ case 262:
var tagName = node.tagName;
noSubstitution[ts.getOriginalNodeId(tagName)] = true;
break;
@@ -62194,7 +62897,7 @@
}
function trySubstituteReservedName(name) {
var token = name.originalKeywordKind || (ts.nodeIsSynthesized(name) ? ts.stringToToken(ts.idText(name)) : undefined);
- if (token !== undefined && token >= 73 && token <= 108) {
+ if (token !== undefined && token >= 74 && token <= 109) {
return ts.setTextRange(ts.createLiteral(name), name);
}
return undefined;
@@ -62275,13 +62978,13 @@
}
function visitJavaScriptInStatementContainingYield(node) {
switch (node.kind) {
- case 223:
- return visitDoStatement(node);
case 224:
+ return visitDoStatement(node);
+ case 225:
return visitWhileStatement(node);
- case 232:
- return visitSwitchStatement(node);
case 233:
+ return visitSwitchStatement(node);
+ case 234:
return visitLabeledStatement(node);
default:
return visitJavaScriptInGeneratorFunctionBody(node);
@@ -62289,24 +62992,24 @@
}
function visitJavaScriptInGeneratorFunctionBody(node) {
switch (node.kind) {
- case 239:
+ case 240:
return visitFunctionDeclaration(node);
- case 196:
+ case 197:
return visitFunctionExpression(node);
- case 158:
case 159:
+ case 160:
return visitAccessorDeclaration(node);
- case 219:
+ case 220:
return visitVariableStatement(node);
- case 225:
- return visitForStatement(node);
case 226:
+ return visitForStatement(node);
+ case 227:
return visitForInStatement(node);
- case 229:
+ case 230:
return visitBreakStatement(node);
- case 228:
+ case 229:
return visitContinueStatement(node);
- case 230:
+ case 231:
return visitReturnStatement(node);
default:
if (node.transformFlags & 131072) {
@@ -62322,21 +63025,21 @@
}
function visitJavaScriptContainingYield(node) {
switch (node.kind) {
- case 204:
- return visitBinaryExpression(node);
case 205:
+ return visitBinaryExpression(node);
+ case 206:
return visitConditionalExpression(node);
- case 207:
+ case 208:
return visitYieldExpression(node);
- case 187:
- return visitArrayLiteralExpression(node);
case 188:
+ return visitArrayLiteralExpression(node);
+ case 189:
return visitObjectLiteralExpression(node);
- case 190:
- return visitElementAccessExpression(node);
case 191:
- return visitCallExpression(node);
+ return visitElementAccessExpression(node);
case 192:
+ return visitCallExpression(node);
+ case 193:
return visitNewExpression(node);
default:
return ts.visitEachChild(node, visitor, context);
@@ -62344,9 +63047,9 @@
}
function visitGenerator(node) {
switch (node.kind) {
- case 239:
+ case 240:
return visitFunctionDeclaration(node);
- case 196:
+ case 197:
return visitFunctionExpression(node);
default:
return ts.Debug.failBadSyntaxKind(node);
@@ -62479,23 +63182,23 @@
}
}
function isCompoundAssignment(kind) {
- return kind >= 60
- && kind <= 71;
+ return kind >= 61
+ && kind <= 72;
}
function getOperatorForCompoundAssignment(kind) {
switch (kind) {
- case 60: return 38;
- case 61: return 39;
- case 62: return 40;
- case 63: return 41;
- case 64: return 42;
- case 65: return 43;
- case 66: return 46;
- case 67: return 47;
- case 68: return 48;
- case 69: return 49;
- case 70: return 50;
- case 71: return 51;
+ case 61: return 38;
+ case 62: return 39;
+ case 63: return 40;
+ case 64: return 41;
+ case 65: return 42;
+ case 66: return 43;
+ case 67: return 46;
+ case 68: return 47;
+ case 69: return 48;
+ case 70: return 49;
+ case 71: return 50;
+ case 72: return 51;
}
}
function visitRightAssociativeBinaryExpression(node) {
@@ -62503,10 +63206,10 @@
if (containsYield(right)) {
var target = void 0;
switch (left.kind) {
- case 189:
+ case 190:
target = ts.updatePropertyAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name);
break;
- case 190:
+ case 191:
target = ts.updateElementAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), cacheExpression(ts.visitNode(left.argumentExpression, visitor, ts.isExpression)));
break;
default:
@@ -62707,35 +63410,35 @@
}
function transformAndEmitStatementWorker(node) {
switch (node.kind) {
- case 218:
+ case 219:
return transformAndEmitBlock(node);
- case 221:
- return transformAndEmitExpressionStatement(node);
case 222:
- return transformAndEmitIfStatement(node);
+ return transformAndEmitExpressionStatement(node);
case 223:
- return transformAndEmitDoStatement(node);
+ return transformAndEmitIfStatement(node);
case 224:
- return transformAndEmitWhileStatement(node);
+ return transformAndEmitDoStatement(node);
case 225:
- return transformAndEmitForStatement(node);
+ return transformAndEmitWhileStatement(node);
case 226:
+ return transformAndEmitForStatement(node);
+ case 227:
return transformAndEmitForInStatement(node);
- case 228:
- return transformAndEmitContinueStatement(node);
case 229:
- return transformAndEmitBreakStatement(node);
+ return transformAndEmitContinueStatement(node);
case 230:
- return transformAndEmitReturnStatement(node);
+ return transformAndEmitBreakStatement(node);
case 231:
- return transformAndEmitWithStatement(node);
+ return transformAndEmitReturnStatement(node);
case 232:
- return transformAndEmitSwitchStatement(node);
+ return transformAndEmitWithStatement(node);
case 233:
- return transformAndEmitLabeledStatement(node);
+ return transformAndEmitSwitchStatement(node);
case 234:
- return transformAndEmitThrowStatement(node);
+ return transformAndEmitLabeledStatement(node);
case 235:
+ return transformAndEmitThrowStatement(node);
+ case 236:
return transformAndEmitTryStatement(node);
default:
return emitStatement(ts.visitNode(node, visitor, ts.isStatement));
@@ -63029,7 +63732,7 @@
for (var i = 0; i < numClauses; i++) {
var clause = caseBlock.clauses[i];
clauseLabels.push(defineLabel());
- if (clause.kind === 272 && defaultClauseIndex === -1) {
+ if (clause.kind === 273 && defaultClauseIndex === -1) {
defaultClauseIndex = i;
}
}
@@ -63039,7 +63742,7 @@
var defaultClausesSkipped = 0;
for (var i = clausesWritten; i < numClauses; i++) {
var clause = caseBlock.clauses[i];
- if (clause.kind === 271) {
+ if (clause.kind === 272) {
if (containsYield(clause.expression) && pendingClauses.length > 0) {
break;
}
@@ -63274,7 +63977,7 @@
if (!renamedCatchVariables) {
renamedCatchVariables = ts.createMap();
renamedCatchVariableDeclarations = [];
- context.enableSubstitution(72);
+ context.enableSubstitution(73);
}
renamedCatchVariables.set(text, true);
renamedCatchVariableDeclarations[ts.getOriginalNodeId(variable)] = name;
@@ -63854,12 +64557,12 @@
var previousOnEmitNode = context.onEmitNode;
context.onSubstituteNode = onSubstituteNode;
context.onEmitNode = onEmitNode;
- context.enableSubstitution(72);
- context.enableSubstitution(204);
- context.enableSubstitution(202);
+ context.enableSubstitution(73);
+ context.enableSubstitution(205);
context.enableSubstitution(203);
- context.enableSubstitution(276);
- context.enableEmitNotification(284);
+ context.enableSubstitution(204);
+ context.enableSubstitution(277);
+ context.enableEmitNotification(285);
var moduleInfoMap = [];
var deferredExports = [];
var currentSourceFile;
@@ -64050,23 +64753,23 @@
}
function sourceElementVisitor(node) {
switch (node.kind) {
- case 249:
+ case 250:
return visitImportDeclaration(node);
- case 248:
+ case 249:
return visitImportEqualsDeclaration(node);
- case 255:
+ case 256:
return visitExportDeclaration(node);
- case 254:
+ case 255:
return visitExportAssignment(node);
- case 219:
+ case 220:
return visitVariableStatement(node);
- case 239:
- return visitFunctionDeclaration(node);
case 240:
+ return visitFunctionDeclaration(node);
+ case 241:
return visitClassDeclaration(node);
- case 315:
- return visitMergeDeclarationMarker(node);
case 316:
+ return visitMergeDeclarationMarker(node);
+ case 317:
return visitEndOfDeclarationMarker(node);
default:
return ts.visitEachChild(node, moduleExpressionElementVisitor, context);
@@ -64091,24 +64794,24 @@
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var elem = _a[_i];
switch (elem.kind) {
- case 275:
+ case 276:
if (destructuringNeedsFlattening(elem.initializer)) {
return true;
}
break;
- case 276:
+ case 277:
if (destructuringNeedsFlattening(elem.name)) {
return true;
}
break;
- case 277:
+ case 278:
if (destructuringNeedsFlattening(elem.expression)) {
return true;
}
break;
- case 156:
- case 158:
+ case 157:
case 159:
+ case 160:
return false;
default: ts.Debug.assertNever(elem, "Unhandled object member kind");
}
@@ -64423,7 +65126,7 @@
}
}
function visitMergeDeclarationMarker(node) {
- if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 219) {
+ if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 220) {
var id = ts.getOriginalNodeId(node);
deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original);
}
@@ -64455,10 +65158,10 @@
var namedBindings = importClause.namedBindings;
if (namedBindings) {
switch (namedBindings.kind) {
- case 251:
+ case 252:
statements = appendExportsOfDeclaration(statements, namedBindings);
break;
- case 252:
+ case 253:
for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) {
var importBinding = _a[_i];
statements = appendExportsOfDeclaration(statements, importBinding);
@@ -64559,14 +65262,14 @@
}
function modifierVisitor(node) {
switch (node.kind) {
- case 85:
- case 80:
+ case 86:
+ case 81:
return undefined;
}
return node;
}
function onEmitNode(hint, node, emitCallback) {
- if (node.kind === 284) {
+ if (node.kind === 285) {
currentSourceFile = node;
currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)];
noSubstitution = [];
@@ -64606,12 +65309,12 @@
}
function substituteExpression(node) {
switch (node.kind) {
- case 72:
+ case 73:
return substituteExpressionIdentifier(node);
- case 204:
+ case 205:
return substituteBinaryExpression(node);
+ case 204:
case 203:
- case 202:
return substituteUnaryExpression(node);
}
return node;
@@ -64626,7 +65329,7 @@
}
if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) {
var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node));
- if (exportContainer && exportContainer.kind === 284) {
+ if (exportContainer && exportContainer.kind === 285) {
return ts.setTextRange(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node)), node);
}
var importDeclaration = resolver.getReferencedImportDeclaration(node);
@@ -64669,8 +65372,8 @@
&& !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) {
var exportedNames = getExports(node.operand);
if (exportedNames) {
- var expression = node.kind === 203
- ? ts.setTextRange(ts.createBinary(node.operand, ts.createToken(node.operator === 44 ? 60 : 61), ts.createLiteral(1)), node)
+ var expression = node.kind === 204
+ ? ts.setTextRange(ts.createBinary(node.operand, ts.createToken(node.operator === 44 ? 61 : 62), ts.createLiteral(1)), node)
: node;
for (var _i = 0, exportedNames_3 = exportedNames; _i < exportedNames_3.length; _i++) {
var exportName = exportedNames_3[_i];
@@ -64732,12 +65435,12 @@
var previousOnEmitNode = context.onEmitNode;
context.onSubstituteNode = onSubstituteNode;
context.onEmitNode = onEmitNode;
- context.enableSubstitution(72);
- context.enableSubstitution(276);
- context.enableSubstitution(204);
- context.enableSubstitution(202);
+ context.enableSubstitution(73);
+ context.enableSubstitution(277);
+ context.enableSubstitution(205);
context.enableSubstitution(203);
- context.enableEmitNotification(284);
+ context.enableSubstitution(204);
+ context.enableEmitNotification(285);
var moduleInfoMap = [];
var deferredExports = [];
var exportFunctionsMap = [];
@@ -64841,7 +65544,7 @@
var hasExportDeclarationWithExportClause = false;
for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) {
var externalImport = _a[_i];
- if (externalImport.kind === 255 && externalImport.exportClause) {
+ if (externalImport.kind === 256 && externalImport.exportClause) {
hasExportDeclarationWithExportClause = true;
break;
}
@@ -64864,7 +65567,7 @@
}
for (var _d = 0, _e = moduleInfo.externalImports; _d < _e.length; _d++) {
var externalImport = _e[_d];
- if (externalImport.kind !== 255) {
+ if (externalImport.kind !== 256) {
continue;
}
if (!externalImport.exportClause) {
@@ -64915,15 +65618,15 @@
var entry = _b[_a];
var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile);
switch (entry.kind) {
- case 249:
+ case 250:
if (!entry.importClause) {
break;
}
- case 248:
+ case 249:
ts.Debug.assert(importVariableName !== undefined);
statements.push(ts.createExpressionStatement(ts.createAssignment(importVariableName, parameterName)));
break;
- case 255:
+ case 256:
ts.Debug.assert(importVariableName !== undefined);
if (entry.exportClause) {
var properties = [];
@@ -64945,13 +65648,13 @@
}
function sourceElementVisitor(node) {
switch (node.kind) {
- case 249:
+ case 250:
return visitImportDeclaration(node);
- case 248:
+ case 249:
return visitImportEqualsDeclaration(node);
- case 255:
+ case 256:
return undefined;
- case 254:
+ case 255:
return visitExportAssignment(node);
default:
return nestedElementVisitor(node);
@@ -65072,7 +65775,7 @@
}
function shouldHoistVariableDeclarationList(node) {
return (ts.getEmitFlags(node) & 2097152) === 0
- && (enclosingBlockScopedContainer.kind === 284
+ && (enclosingBlockScopedContainer.kind === 285
|| (ts.getOriginalNode(node).flags & 3) === 0);
}
function transformInitializedVariable(node, isExportedDeclaration) {
@@ -65094,7 +65797,7 @@
: preventSubstitution(ts.setTextRange(ts.createAssignment(name, value), location));
}
function visitMergeDeclarationMarker(node) {
- if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 219) {
+ if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 220) {
var id = ts.getOriginalNodeId(node);
var isExportedDeclaration = ts.hasModifier(node.original, 1);
deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration);
@@ -65133,10 +65836,10 @@
var namedBindings = importClause.namedBindings;
if (namedBindings) {
switch (namedBindings.kind) {
- case 251:
+ case 252:
statements = appendExportsOfDeclaration(statements, namedBindings);
break;
- case 252:
+ case 253:
for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) {
var importBinding = _a[_i];
statements = appendExportsOfDeclaration(statements, importBinding);
@@ -65236,43 +65939,43 @@
}
function nestedElementVisitor(node) {
switch (node.kind) {
- case 219:
+ case 220:
return visitVariableStatement(node);
- case 239:
- return visitFunctionDeclaration(node);
case 240:
+ return visitFunctionDeclaration(node);
+ case 241:
return visitClassDeclaration(node);
- case 225:
- return visitForStatement(node);
case 226:
- return visitForInStatement(node);
+ return visitForStatement(node);
case 227:
+ return visitForInStatement(node);
+ case 228:
return visitForOfStatement(node);
- case 223:
- return visitDoStatement(node);
case 224:
+ return visitDoStatement(node);
+ case 225:
return visitWhileStatement(node);
- case 233:
+ case 234:
return visitLabeledStatement(node);
- case 231:
- return visitWithStatement(node);
case 232:
+ return visitWithStatement(node);
+ case 233:
return visitSwitchStatement(node);
- case 246:
+ case 247:
return visitCaseBlock(node);
- case 271:
- return visitCaseClause(node);
case 272:
+ return visitCaseClause(node);
+ case 273:
return visitDefaultClause(node);
- case 235:
+ case 236:
return visitTryStatement(node);
- case 274:
+ case 275:
return visitCatchClause(node);
- case 218:
+ case 219:
return visitBlock(node);
- case 315:
- return visitMergeDeclarationMarker(node);
case 316:
+ return visitMergeDeclarationMarker(node);
+ case 317:
return visitEndOfDeclarationMarker(node);
default:
return destructuringAndImportCallVisitor(node);
@@ -65408,7 +66111,7 @@
}
else if (ts.isIdentifier(node)) {
var container = resolver.getReferencedExportContainer(node);
- return container !== undefined && container.kind === 284;
+ return container !== undefined && container.kind === 285;
}
else {
return false;
@@ -65416,14 +66119,14 @@
}
function modifierVisitor(node) {
switch (node.kind) {
- case 85:
- case 80:
+ case 86:
+ case 81:
return undefined;
}
return node;
}
function onEmitNode(hint, node, emitCallback) {
- if (node.kind === 284) {
+ if (node.kind === 285) {
var id = ts.getOriginalNodeId(node);
currentSourceFile = node;
moduleInfo = moduleInfoMap[id];
@@ -65457,7 +66160,7 @@
}
function substituteUnspecified(node) {
switch (node.kind) {
- case 276:
+ case 277:
return substituteShorthandPropertyAssignment(node);
}
return node;
@@ -65479,12 +66182,12 @@
}
function substituteExpression(node) {
switch (node.kind) {
- case 72:
+ case 73:
return substituteExpressionIdentifier(node);
- case 204:
+ case 205:
return substituteBinaryExpression(node);
- case 202:
case 203:
+ case 204:
return substituteUnaryExpression(node);
}
return node;
@@ -65536,14 +66239,14 @@
&& !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) {
var exportedNames = getExports(node.operand);
if (exportedNames) {
- var expression = node.kind === 203
+ var expression = node.kind === 204
? ts.setTextRange(ts.createPrefix(node.operator, node.operand), node)
: node;
for (var _i = 0, exportedNames_5 = exportedNames; _i < exportedNames_5.length; _i++) {
var exportName = exportedNames_5[_i];
expression = createExportExpression(exportName, preventSubstitution(expression));
}
- if (node.kind === 203) {
+ if (node.kind === 204) {
expression = node.operator === 44
? ts.createSubtract(preventSubstitution(expression), ts.createLiteral(1))
: ts.createAdd(preventSubstitution(expression), ts.createLiteral(1));
@@ -65560,7 +66263,7 @@
|| resolver.getReferencedValueDeclaration(name);
if (valueDeclaration) {
var exportContainer = resolver.getReferencedExportContainer(name, false);
- if (exportContainer && exportContainer.kind === 284) {
+ if (exportContainer && exportContainer.kind === 285) {
exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration));
}
exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]);
@@ -65588,8 +66291,8 @@
var previousOnSubstituteNode = context.onSubstituteNode;
context.onEmitNode = onEmitNode;
context.onSubstituteNode = onSubstituteNode;
- context.enableEmitNotification(284);
- context.enableSubstitution(72);
+ context.enableEmitNotification(285);
+ context.enableSubstitution(73);
var currentSourceFile;
return ts.chainBundle(transformSourceFile);
function transformSourceFile(node) {
@@ -65615,9 +66318,9 @@
}
function visitor(node) {
switch (node.kind) {
- case 248:
+ case 249:
return undefined;
- case 254:
+ case 255:
return visitExportAssignment(node);
}
return node;
@@ -65704,7 +66407,7 @@
ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1;
}
- else if (node.parent.kind === 240) {
+ else if (node.parent.kind === 241) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 ?
ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -65733,7 +66436,7 @@
ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_private_name_1;
}
- else if (node.parent.kind === 240) {
+ else if (node.parent.kind === 241) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 ?
ts.Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -65780,15 +66483,15 @@
return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: " + ts.SyntaxKind[node.kind]);
}
function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
- if (node.kind === 237 || node.kind === 186) {
+ if (node.kind === 238 || node.kind === 187) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 ?
ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Exported_variable_0_has_or_is_using_private_name_1;
}
- else if (node.kind === 154 || node.kind === 189 || node.kind === 153 ||
- (node.kind === 151 && ts.hasModifier(node.parent, 8))) {
+ else if (node.kind === 155 || node.kind === 190 || node.kind === 154 ||
+ (node.kind === 152 && ts.hasModifier(node.parent, 8))) {
if (ts.hasModifier(node, 32)) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 ?
@@ -65796,7 +66499,7 @@
ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1;
}
- else if (node.parent.kind === 240 || node.kind === 151) {
+ else if (node.parent.kind === 241 || node.kind === 152) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 ?
ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -65820,7 +66523,7 @@
}
function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) {
var diagnosticMessage;
- if (node.kind === 159) {
+ if (node.kind === 160) {
if (ts.hasModifier(node, 32)) {
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Parameter_type_of_public_static_setter_0_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
@@ -65857,23 +66560,23 @@
function getReturnTypeVisibilityError(symbolAccessibilityResult) {
var diagnosticMessage;
switch (node.kind) {
- case 161:
+ case 162:
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0;
break;
- case 160:
+ case 161:
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0;
break;
- case 162:
+ case 163:
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0;
break;
+ case 157:
case 156:
- case 155:
if (ts.hasModifier(node, 32)) {
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 ?
@@ -65881,7 +66584,7 @@
ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 :
ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0;
}
- else if (node.parent.kind === 240) {
+ else if (node.parent.kind === 241) {
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 ?
ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
@@ -65894,7 +66597,7 @@
ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0;
}
break;
- case 239:
+ case 240:
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 ?
ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
@@ -65919,27 +66622,27 @@
}
function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
switch (node.parent.kind) {
- case 157:
+ case 158:
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 ?
ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1;
- case 161:
- case 166:
+ case 162:
+ case 167:
return symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;
- case 160:
+ case 161:
return symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;
- case 162:
+ case 163:
return symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1;
+ case 157:
case 156:
- case 155:
if (ts.hasModifier(node.parent, 32)) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 ?
@@ -65947,7 +66650,7 @@
ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1;
}
- else if (node.parent.parent.kind === 240) {
+ else if (node.parent.parent.kind === 241) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 ?
ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -65959,8 +66662,8 @@
ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1;
}
- case 239:
- case 165:
+ case 240:
+ case 166:
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 ?
ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -65973,39 +66676,39 @@
function getTypeParameterConstraintVisibilityError() {
var diagnosticMessage;
switch (node.parent.kind) {
- case 240:
+ case 241:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1;
break;
- case 241:
+ case 242:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1;
break;
- case 181:
+ case 182:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1;
break;
- case 166:
- case 161:
+ case 167:
+ case 162:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;
break;
- case 160:
+ case 161:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;
break;
+ case 157:
case 156:
- case 155:
if (ts.hasModifier(node.parent, 32)) {
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1;
}
- else if (node.parent.parent.kind === 240) {
+ else if (node.parent.parent.kind === 241) {
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1;
}
else {
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1;
}
break;
- case 165:
- case 239:
+ case 166:
+ case 240:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1;
break;
- case 242:
+ case 243:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1;
break;
default:
@@ -66019,8 +66722,8 @@
}
function getHeritageClauseVisibilityError() {
var diagnosticMessage;
- if (node.parent.parent.kind === 240) {
- diagnosticMessage = ts.isHeritageClause(node.parent) && node.parent.token === 109 ?
+ if (node.parent.parent.kind === 241) {
+ diagnosticMessage = ts.isHeritageClause(node.parent) && node.parent.token === 110 ?
ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 :
ts.Diagnostics.extends_clause_of_exported_class_0_has_or_is_using_private_name_1;
}
@@ -66067,7 +66770,7 @@
}
function isInternalDeclaration(node, currentSourceFile) {
var parseTreeNode = ts.getParseTreeNode(node);
- if (parseTreeNode && parseTreeNode.kind === 151) {
+ if (parseTreeNode && parseTreeNode.kind === 152) {
var paramIdx = parseTreeNode.parent.parameters.indexOf(parseTreeNode);
var previousSibling = paramIdx > 0 ? parseTreeNode.parent.parameters[paramIdx - 1] : undefined;
var text = currentSourceFile.text;
@@ -66199,10 +66902,10 @@
}
}
function transformRoot(node) {
- if (node.kind === 284 && (node.isDeclarationFile || ts.isSourceFileJS(node))) {
+ if (node.kind === 285 && (node.isDeclarationFile || ts.isSourceFileJS(node))) {
return node;
}
- if (node.kind === 285) {
+ if (node.kind === 286) {
isBundledEmit = true;
refs = ts.createMap();
libs = ts.createMap();
@@ -66225,14 +66928,14 @@
resultHasExternalModuleIndicator = false;
needsDeclare = false;
var statements_4 = ts.visitNodes(sourceFile.statements, visitDeclarationStatements);
- var newFile = ts.updateSourceFileNode(sourceFile, [ts.createModuleDeclaration([], [ts.createModifier(125)], ts.createLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), ts.createModuleBlock(ts.setTextRange(ts.createNodeArray(transformAndReplaceLatePaintedStatements(statements_4)), sourceFile.statements)))], true, [], [], false, []);
+ var newFile = ts.updateSourceFileNode(sourceFile, [ts.createModuleDeclaration([], [ts.createModifier(126)], ts.createLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), ts.createModuleBlock(ts.setTextRange(ts.createNodeArray(transformAndReplaceLatePaintedStatements(statements_4)), sourceFile.statements)))], true, [], [], false, []);
return newFile;
}
needsDeclare = true;
var updated = ts.visitNodes(sourceFile.statements, visitDeclarationStatements);
return ts.updateSourceFileNode(sourceFile, transformAndReplaceLatePaintedStatements(updated), true, [], [], false, []);
}), ts.mapDefined(node.prepends, function (prepend) {
- if (prepend.kind === 287) {
+ if (prepend.kind === 288) {
var sourceFile = ts.createUnparsedSourceFile(prepend, "dts", stripInternal);
hasNoDefaultLib_1 = hasNoDefaultLib_1 || !!sourceFile.hasNoDefaultLib;
collectReferences(sourceFile, refs);
@@ -66347,11 +67050,11 @@
return ret;
}
function filterBindingPatternInitializers(name) {
- if (name.kind === 72) {
+ if (name.kind === 73) {
return name;
}
else {
- if (name.kind === 185) {
+ if (name.kind === 186) {
return ts.updateArrayBindingPattern(name, ts.visitNodes(name.elements, visitBindingElement));
}
else {
@@ -66359,7 +67062,7 @@
}
}
function visitBindingElement(elem) {
- if (elem.kind === 210) {
+ if (elem.kind === 211) {
return elem;
}
return ts.updateBindingElement(elem, elem.dotDotDotToken, elem.propertyName, filterBindingPatternInitializers(elem.name), shouldPrintWithInitializer(elem) ? elem.initializer : undefined);
@@ -66393,17 +67096,17 @@
if (shouldPrintWithInitializer(node)) {
return;
}
- var shouldUseResolverType = node.kind === 151 &&
+ var shouldUseResolverType = node.kind === 152 &&
(resolver.isRequiredInitializedParameter(node) ||
resolver.isOptionalUninitializedParameterProperty(node));
if (type && !shouldUseResolverType) {
return ts.visitNode(type, visitDeclarationSubtree);
}
if (!ts.getParseTreeNode(node)) {
- return type ? ts.visitNode(type, visitDeclarationSubtree) : ts.createKeywordTypeNode(120);
+ return type ? ts.visitNode(type, visitDeclarationSubtree) : ts.createKeywordTypeNode(121);
}
- if (node.kind === 159) {
- return ts.createKeywordTypeNode(120);
+ if (node.kind === 160) {
+ return ts.createKeywordTypeNode(121);
}
errorNameNode = node.name;
var oldDiag;
@@ -66411,12 +67114,12 @@
oldDiag = getSymbolAccessibilityDiagnostic;
getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(node);
}
- if (node.kind === 237 || node.kind === 186) {
+ if (node.kind === 238 || node.kind === 187) {
return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker));
}
- if (node.kind === 151
- || node.kind === 154
- || node.kind === 153) {
+ if (node.kind === 152
+ || node.kind === 155
+ || node.kind === 154) {
if (!node.initializer)
return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType));
return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType) || resolver.createTypeOfExpression(node.initializer, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker));
@@ -66427,25 +67130,25 @@
if (!suppressNewDiagnosticContexts) {
getSymbolAccessibilityDiagnostic = oldDiag;
}
- return returnValue || ts.createKeywordTypeNode(120);
+ return returnValue || ts.createKeywordTypeNode(121);
}
}
function isDeclarationAndNotVisible(node) {
node = ts.getParseTreeNode(node);
switch (node.kind) {
- case 239:
- case 244:
- case 241:
case 240:
+ case 245:
case 242:
+ case 241:
case 243:
+ case 244:
return !resolver.isDeclarationVisible(node);
- case 237:
+ case 238:
return !getBindingNameVisible(node);
- case 248:
case 249:
+ case 250:
+ case 256:
case 255:
- case 254:
return false;
}
return false;
@@ -66498,7 +67201,7 @@
function rewriteModuleSpecifier(parent, input) {
if (!input)
return undefined;
- resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 244 && parent.kind !== 183);
+ resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 245 && parent.kind !== 184);
if (ts.isStringLiteralLike(input)) {
if (isBundledEmit) {
var newName = ts.getExternalModuleNameFromDeclaration(context.getEmitHost(), resolver, parent);
@@ -66518,7 +67221,7 @@
function transformImportEqualsDeclaration(decl) {
if (!resolver.isDeclarationVisible(decl))
return;
- if (decl.moduleReference.kind === 259) {
+ if (decl.moduleReference.kind === 260) {
var specifier = ts.getExternalModuleImportEqualsDeclarationExpression(decl);
return ts.updateImportEqualsDeclaration(decl, undefined, decl.modifiers, decl.name, ts.updateExternalModuleReference(decl.moduleReference, rewriteModuleSpecifier(decl, specifier)));
}
@@ -66538,7 +67241,7 @@
if (!decl.importClause.namedBindings) {
return visibleDefaultBinding && ts.updateImportDeclaration(decl, undefined, decl.modifiers, ts.updateImportClause(decl.importClause, visibleDefaultBinding, undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier));
}
- if (decl.importClause.namedBindings.kind === 251) {
+ if (decl.importClause.namedBindings.kind === 252) {
var namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : undefined;
return visibleDefaultBinding || namedBindings ? ts.updateImportDeclaration(decl, undefined, decl.modifiers, ts.updateImportClause(decl.importClause, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier)) : undefined;
}
@@ -66621,61 +67324,61 @@
checkEntityNameVisibility(input.exprName, enclosingDeclaration);
}
var oldWithinObjectLiteralType = suppressNewDiagnosticContexts;
- var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 168 || input.kind === 181) && input.parent.kind !== 242);
+ var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 169 || input.kind === 182) && input.parent.kind !== 243);
if (shouldEnterSuppressNewDiagnosticsContextContext) {
suppressNewDiagnosticContexts = true;
}
if (isProcessedComponent(input)) {
switch (input.kind) {
- case 211: {
+ case 212: {
if ((ts.isEntityName(input.expression) || ts.isEntityNameExpression(input.expression))) {
checkEntityNameVisibility(input.expression, enclosingDeclaration);
}
var node = ts.visitEachChild(input, visitDeclarationSubtree, context);
return cleanup(ts.updateExpressionWithTypeArguments(node, ts.parenthesizeTypeParameters(node.typeArguments), node.expression));
}
- case 164: {
+ case 165: {
checkEntityNameVisibility(input.typeName, enclosingDeclaration);
var node = ts.visitEachChild(input, visitDeclarationSubtree, context);
return cleanup(ts.updateTypeReferenceNode(node, node.typeName, ts.parenthesizeTypeParameters(node.typeArguments)));
}
- case 161:
+ case 162:
return cleanup(ts.updateConstructSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type)));
- case 157: {
+ case 158: {
var isPrivate = ts.hasModifier(input, 8);
- var ctor = ts.createSignatureDeclaration(157, isPrivate ? undefined : ensureTypeParams(input, input.typeParameters), isPrivate ? undefined : updateParamsList(input, input.parameters, 0), undefined);
+ var ctor = ts.createSignatureDeclaration(158, isPrivate ? undefined : ensureTypeParams(input, input.typeParameters), isPrivate ? undefined : updateParamsList(input, input.parameters, 0), undefined);
ctor.modifiers = ts.createNodeArray(ensureModifiers(input));
return cleanup(ctor);
}
- case 156: {
- var sig = ts.createSignatureDeclaration(155, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type));
+ case 157: {
+ var sig = ts.createSignatureDeclaration(156, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type));
sig.name = input.name;
sig.modifiers = ts.createNodeArray(ensureModifiers(input));
sig.questionToken = input.questionToken;
return cleanup(sig);
}
- case 158: {
+ case 159: {
var newNode = ensureAccessor(input);
return cleanup(newNode);
}
- case 159: {
+ case 160: {
var newNode = ensureAccessor(input);
return cleanup(newNode);
}
- case 154:
+ case 155:
return cleanup(ts.updateProperty(input, undefined, ensureModifiers(input), input.name, input.questionToken, !ts.hasModifier(input, 8) ? ensureType(input, input.type) : undefined, ensureNoInitializer(input)));
- case 153:
+ case 154:
return cleanup(ts.updatePropertySignature(input, ensureModifiers(input), input.name, input.questionToken, !ts.hasModifier(input, 8) ? ensureType(input, input.type) : undefined, ensureNoInitializer(input)));
- case 155: {
+ case 156: {
return cleanup(ts.updateMethodSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type), input.name, input.questionToken));
}
- case 160: {
+ case 161: {
return cleanup(ts.updateCallSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type)));
}
- case 162: {
- return cleanup(ts.updateIndexSignature(input, undefined, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || ts.createKeywordTypeNode(120)));
+ case 163: {
+ return cleanup(ts.updateIndexSignature(input, undefined, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || ts.createKeywordTypeNode(121)));
}
- case 237: {
+ case 238: {
if (ts.isBindingPattern(input.name)) {
return recreateBindingPattern(input.name);
}
@@ -66683,13 +67386,13 @@
suppressNewDiagnosticContexts = true;
return cleanup(ts.updateVariableDeclaration(input, input.name, ensureType(input, input.type), ensureNoInitializer(input)));
}
- case 150: {
+ case 151: {
if (isPrivateMethodTypeParameter(input) && (input.default || input.constraint)) {
return cleanup(ts.updateTypeParameterDeclaration(input, input.name, undefined, undefined));
}
return cleanup(ts.visitEachChild(input, visitDeclarationSubtree, context));
}
- case 175: {
+ case 176: {
var checkType = ts.visitNode(input.checkType, visitDeclarationSubtree);
var extendsType = ts.visitNode(input.extendsType, visitDeclarationSubtree);
var oldEnclosingDecl = enclosingDeclaration;
@@ -66699,13 +67402,13 @@
var falseType = ts.visitNode(input.falseType, visitDeclarationSubtree);
return cleanup(ts.updateConditionalTypeNode(input, checkType, extendsType, trueType, falseType));
}
- case 165: {
+ case 166: {
return cleanup(ts.updateFunctionTypeNode(input, ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree)));
}
- case 166: {
+ case 167: {
return cleanup(ts.updateConstructorTypeNode(input, ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree)));
}
- case 183: {
+ case 184: {
if (!ts.isLiteralImportTypeNode(input))
return cleanup(input);
return cleanup(ts.updateImportTypeNode(input, ts.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)), input.qualifier, ts.visitNodes(input.typeArguments, visitDeclarationSubtree, ts.isTypeNode), input.isTypeOf));
@@ -66734,7 +67437,7 @@
}
}
function isPrivateMethodTypeParameter(node) {
- return node.parent.kind === 156 && ts.hasModifier(node.parent, 8);
+ return node.parent.kind === 157 && ts.hasModifier(node.parent, 8);
}
function visitDeclarationStatements(input) {
if (!isPreservedDeclarationStatement(input)) {
@@ -66743,19 +67446,19 @@
if (shouldStripInternal(input))
return;
switch (input.kind) {
- case 255: {
+ case 256: {
if (ts.isSourceFile(input.parent)) {
resultHasExternalModuleIndicator = true;
resultHasScopeMarker = true;
}
return ts.updateExportDeclaration(input, undefined, input.modifiers, input.exportClause, rewriteModuleSpecifier(input, input.moduleSpecifier));
}
- case 254: {
+ case 255: {
if (ts.isSourceFile(input.parent)) {
resultHasExternalModuleIndicator = true;
resultHasScopeMarker = true;
}
- if (input.expression.kind === 72) {
+ if (input.expression.kind === 73) {
return input;
}
else {
@@ -66765,7 +67468,7 @@
errorNode: input
}); };
var varDecl = ts.createVariableDeclaration(newId, resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), undefined);
- var statement = ts.createVariableStatement(needsDeclare ? [ts.createModifier(125)] : [], ts.createVariableDeclarationList([varDecl], 2));
+ var statement = ts.createVariableStatement(needsDeclare ? [ts.createModifier(126)] : [], ts.createVariableDeclarationList([varDecl], 2));
return [statement, ts.updateExportAssignment(input, input.decorators, input.modifiers, newId)];
}
}
@@ -66778,10 +67481,10 @@
if (shouldStripInternal(input))
return;
switch (input.kind) {
- case 248: {
+ case 249: {
return transformImportEqualsDeclaration(input);
}
- case 249: {
+ case 250: {
return transformImportDeclaration(input);
}
}
@@ -66801,12 +67504,12 @@
}
var previousNeedsDeclare = needsDeclare;
switch (input.kind) {
- case 242:
+ case 243:
return cleanup(ts.updateTypeAliasDeclaration(input, undefined, ensureModifiers(input, isPrivate), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode)));
- case 241: {
+ case 242: {
return cleanup(ts.updateInterfaceDeclaration(input, undefined, ensureModifiers(input, isPrivate), input.name, ensureTypeParams(input, input.typeParameters), transformHeritageClauses(input.heritageClauses), ts.visitNodes(input.members, visitDeclarationSubtree)));
}
- case 239: {
+ case 240: {
var clean = cleanup(ts.updateFunctionDeclaration(input, undefined, ensureModifiers(input, isPrivate), undefined, input.name, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type), undefined));
if (clean && resolver.isExpandoFunctionDeclaration(input)) {
var declarations = ts.mapDefined(resolver.getPropertiesOfContainerFunction(input), function (p) {
@@ -66820,16 +67523,25 @@
return ts.createVariableStatement(undefined, ts.createVariableDeclarationList([varDecl]));
});
var namespaceDecl = ts.createModuleDeclaration(undefined, ensureModifiers(input, isPrivate), input.name, ts.createModuleBlock(declarations), 16);
+ if (!ts.hasModifier(clean, 513)) {
return [clean, namespaceDecl];
}
+ var modifiers = ts.createModifiersFromModifierFlags((ts.getModifierFlags(clean) & ~513) | 2);
+ var cleanDeclaration = ts.updateFunctionDeclaration(clean, undefined, modifiers, undefined, clean.name, clean.typeParameters, clean.parameters, clean.type, undefined);
+ var namespaceDeclaration = ts.updateModuleDeclaration(namespaceDecl, undefined, modifiers, namespaceDecl.name, namespaceDecl.body);
+ var exportDefaultDeclaration = ts.createExportAssignment(undefined, undefined, false, namespaceDecl.name);
+ resultHasExternalModuleIndicator = true;
+ resultHasScopeMarker = true;
+ return [cleanDeclaration, namespaceDeclaration, exportDefaultDeclaration];
+ }
else {
return clean;
}
}
- case 244: {
+ case 245: {
needsDeclare = false;
var inner = input.body;
- if (inner && inner.kind === 245) {
+ if (inner && inner.kind === 246) {
var statements = ts.visitNodes(inner.statements, visitDeclarationStatements);
var body = ts.updateModuleBlock(inner, transformAndReplaceLatePaintedStatements(statements));
needsDeclare = previousNeedsDeclare;
@@ -66847,7 +67559,7 @@
return cleanup(ts.updateModuleDeclaration(input, undefined, mods, input.name, body));
}
}
- case 240: {
+ case 241: {
var modifiers = ts.createNodeArray(ensureModifiers(input, isPrivate));
var typeParameters = ensureTypeParams(input, input.typeParameters);
var ctor = ts.getFirstConstructorWithBody(input);
@@ -66858,7 +67570,7 @@
if (!ts.hasModifier(param, 92) || shouldStripInternal(param))
return;
getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(param);
- if (param.name.kind === 72) {
+ if (param.name.kind === 73) {
return preserveJsDoc(ts.createProperty(undefined, ensureModifiers(param), param.name, param.questionToken, ensureType(param, param.type), ensureNoInitializer(param)), param);
}
else {
@@ -66883,7 +67595,7 @@
}
var members = ts.createNodeArray(ts.concatenate(parameterProperties, ts.visitNodes(input.members, visitDeclarationSubtree)));
var extendsClause_1 = ts.getEffectiveBaseTypeNode(input);
- if (extendsClause_1 && !ts.isEntityNameExpression(extendsClause_1.expression) && extendsClause_1.expression.kind !== 96) {
+ if (extendsClause_1 && !ts.isEntityNameExpression(extendsClause_1.expression) && extendsClause_1.expression.kind !== 97) {
var oldId = input.name ? ts.unescapeLeadingUnderscores(input.name.escapedText) : "default";
var newId_1 = ts.createOptimisticUniqueName(oldId + "_base");
getSymbolAccessibilityDiagnostic = function () { return ({
@@ -66892,16 +67604,16 @@
typeName: input.name
}); };
var varDecl = ts.createVariableDeclaration(newId_1, resolver.createTypeOfExpression(extendsClause_1.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), undefined);
- var statement = ts.createVariableStatement(needsDeclare ? [ts.createModifier(125)] : [], ts.createVariableDeclarationList([varDecl], 2));
+ var statement = ts.createVariableStatement(needsDeclare ? [ts.createModifier(126)] : [], ts.createVariableDeclarationList([varDecl], 2));
var heritageClauses = ts.createNodeArray(ts.map(input.heritageClauses, function (clause) {
- if (clause.token === 86) {
+ if (clause.token === 87) {
var oldDiag_2 = getSymbolAccessibilityDiagnostic;
getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(clause.types[0]);
var newClause = ts.updateHeritageClause(clause, ts.map(clause.types, function (t) { return ts.updateExpressionWithTypeArguments(t, ts.visitNodes(t.typeArguments, visitDeclarationSubtree), newId_1); }));
getSymbolAccessibilityDiagnostic = oldDiag_2;
return newClause;
}
- return ts.updateHeritageClause(clause, ts.visitNodes(ts.createNodeArray(ts.filter(clause.types, function (t) { return ts.isEntityNameExpression(t.expression) || t.expression.kind === 96; })), visitDeclarationSubtree));
+ return ts.updateHeritageClause(clause, ts.visitNodes(ts.createNodeArray(ts.filter(clause.types, function (t) { return ts.isEntityNameExpression(t.expression) || t.expression.kind === 97; })), visitDeclarationSubtree));
}));
return [statement, cleanup(ts.updateClassDeclaration(input, undefined, modifiers, input.name, typeParameters, heritageClauses, members))];
}
@@ -66910,10 +67622,10 @@
return cleanup(ts.updateClassDeclaration(input, undefined, modifiers, input.name, typeParameters, heritageClauses, members));
}
}
- case 219: {
+ case 220: {
return cleanup(transformVariableStatement(input, isPrivate));
}
- case 243: {
+ case 244: {
return cleanup(ts.updateEnumDeclaration(input, undefined, ts.createNodeArray(ensureModifiers(input, isPrivate)), input.name, ts.createNodeArray(ts.mapDefined(input.members, function (m) {
if (shouldStripInternal(m))
return;
@@ -66930,7 +67642,7 @@
if (canProdiceDiagnostic) {
getSymbolAccessibilityDiagnostic = oldDiag;
}
- if (input.kind === 244) {
+ if (input.kind === 245) {
needsDeclare = previousNeedsDeclare;
}
if (node === input) {
@@ -66951,7 +67663,7 @@
return ts.flatten(ts.mapDefined(d.elements, function (e) { return recreateBindingElement(e); }));
}
function recreateBindingElement(e) {
- if (e.kind === 210) {
+ if (e.kind === 211) {
return;
}
if (e.name) {
@@ -67004,7 +67716,7 @@
function ensureModifierFlags(node, privateDeclaration) {
var mask = 3071 ^ (4 | 256);
var additions = (needsDeclare && !isAlwaysType(node)) ? 2 : 0;
- var parentIsFile = node.parent.kind === 284;
+ var parentIsFile = node.parent.kind === 285;
if (!parentIsFile || (isBundledEmit && parentIsFile && ts.isExternalModule(node.parent))) {
mask ^= ((privateDeclaration || (isBundledEmit && parentIsFile) || hasScopeMarker(node.parent) ? 0 : 1) | 2);
additions = 0;
@@ -67024,7 +67736,7 @@
var prop = ts.createProperty(undefined, maskModifiers(node, undefined, (!accessors.setAccessor) ? 64 : 0), node.name, node.questionToken, ensureType(node, accessorType), undefined);
var leadingsSyntheticCommentRanges = accessors.secondAccessor && ts.getLeadingCommentRangesOfNode(accessors.secondAccessor, currentSourceFile);
if (leadingsSyntheticCommentRanges) {
- var _loop_10 = function (range) {
+ var _loop_13 = function (range) {
if (range.kind === 3) {
var text = currentSourceFile.text.slice(range.pos + 2, range.end - 2);
var lines = text.split(/\r\n?|\n/g);
@@ -67038,20 +67750,20 @@
};
for (var _i = 0, leadingsSyntheticCommentRanges_1 = leadingsSyntheticCommentRanges; _i < leadingsSyntheticCommentRanges_1.length; _i++) {
var range = leadingsSyntheticCommentRanges_1[_i];
- _loop_10(range);
+ _loop_13(range);
}
}
return prop;
}
function transformHeritageClauses(nodes) {
return ts.createNodeArray(ts.filter(ts.map(nodes, function (clause) { return ts.updateHeritageClause(clause, ts.visitNodes(ts.createNodeArray(ts.filter(clause.types, function (t) {
- return ts.isEntityNameExpression(t.expression) || (clause.token === 86 && t.expression.kind === 96);
+ return ts.isEntityNameExpression(t.expression) || (clause.token === 87 && t.expression.kind === 97);
})), visitDeclarationSubtree)); }), function (clause) { return clause.types && !!clause.types.length; }));
}
}
ts.transformDeclarations = transformDeclarations;
function isAlwaysType(node) {
- if (node.kind === 241) {
+ if (node.kind === 242) {
return true;
}
return false;
@@ -67073,7 +67785,7 @@
}
function getTypeAnnotationFromAccessor(accessor) {
if (accessor) {
- return accessor.kind === 158
+ return accessor.kind === 159
? accessor.type
: accessor.parameters.length > 0
? accessor.parameters[0].type
@@ -67082,52 +67794,52 @@
}
function canHaveLiteralInitializer(node) {
switch (node.kind) {
+ case 155:
case 154:
- case 153:
return !ts.hasModifier(node, 8);
- case 151:
- case 237:
+ case 152:
+ case 238:
return true;
}
return false;
}
function isPreservedDeclarationStatement(node) {
switch (node.kind) {
- case 239:
- case 244:
- case 248:
- case 241:
case 240:
+ case 245:
+ case 249:
case 242:
+ case 241:
case 243:
- case 219:
- case 249:
+ case 244:
+ case 220:
+ case 250:
+ case 256:
case 255:
- case 254:
return true;
}
return false;
}
function isProcessedComponent(node) {
switch (node.kind) {
- case 161:
- case 157:
- case 156:
+ case 162:
case 158:
+ case 157:
case 159:
- case 154:
- case 153:
- case 155:
case 160:
- case 162:
- case 237:
- case 150:
- case 211:
- case 164:
- case 175:
+ case 155:
+ case 154:
+ case 156:
+ case 161:
+ case 163:
+ case 238:
+ case 151:
+ case 212:
case 165:
+ case 176:
case 166:
- case 183:
+ case 167:
+ case 184:
return true;
}
return false;
@@ -67146,17 +67858,27 @@
return ts.transformModule;
}
}
- function getTransformers(compilerOptions, customTransformers) {
+ ts.noTransformers = { scriptTransformers: ts.emptyArray, declarationTransformers: ts.emptyArray };
+ function getTransformers(compilerOptions, customTransformers, emitOnlyDtsFiles) {
+ return {
+ scriptTransformers: getScriptTransformers(compilerOptions, customTransformers, emitOnlyDtsFiles),
+ declarationTransformers: getDeclarationTransformers(customTransformers),
+ };
+ }
+ ts.getTransformers = getTransformers;
+ function getScriptTransformers(compilerOptions, customTransformers, emitOnlyDtsFiles) {
+ if (emitOnlyDtsFiles)
+ return ts.emptyArray;
var jsx = compilerOptions.jsx;
var languageVersion = ts.getEmitScriptTarget(compilerOptions);
var moduleKind = ts.getEmitModuleKind(compilerOptions);
var transformers = [];
- ts.addRange(transformers, customTransformers && customTransformers.before);
+ ts.addRange(transformers, customTransformers && ts.map(customTransformers.before, wrapScriptTransformerFactory));
transformers.push(ts.transformTypeScript);
if (jsx === 2) {
transformers.push(ts.transformJsx);
}
- if (languageVersion < 7) {
+ if (languageVersion < 8) {
transformers.push(ts.transformESNext);
}
if (languageVersion < 6) {
@@ -67179,10 +67901,32 @@
if (languageVersion < 1) {
transformers.push(ts.transformES5);
}
- ts.addRange(transformers, customTransformers && customTransformers.after);
+ ts.addRange(transformers, customTransformers && ts.map(customTransformers.after, wrapScriptTransformerFactory));
return transformers;
}
- ts.getTransformers = getTransformers;
+ function getDeclarationTransformers(customTransformers) {
+ var transformers = [];
+ transformers.push(ts.transformDeclarations);
+ ts.addRange(transformers, customTransformers && ts.map(customTransformers.afterDeclarations, wrapDeclarationTransformerFactory));
+ return transformers;
+ }
+ function wrapCustomTransformer(transformer) {
+ return function (node) { return ts.isBundle(node) ? transformer.transformBundle(node) : transformer.transformSourceFile(node); };
+ }
+ function wrapCustomTransformerFactory(transformer, handleDefault) {
+ return function (context) {
+ var customTransformer = transformer(context);
+ return typeof customTransformer === "function"
+ ? handleDefault(customTransformer)
+ : wrapCustomTransformer(customTransformer);
+ };
+ }
+ function wrapScriptTransformerFactory(transformer) {
+ return wrapCustomTransformerFactory(transformer, ts.chainBundle);
+ }
+ function wrapDeclarationTransformerFactory(transformer) {
+ return wrapCustomTransformerFactory(transformer, ts.identity);
+ }
function noEmitSubstitution(_hint, node) {
return node;
}
@@ -67192,7 +67936,7 @@
}
ts.noEmitNotification = noEmitNotification;
function transformNodes(resolver, host, options, nodes, transformers, allowDtsFiles) {
- var enabledSyntaxKindFeatures = new Array(317);
+ var enabledSyntaxKindFeatures = new Array(318);
var lexicalEnvironmentVariableDeclarations;
var lexicalEnvironmentFunctionDeclarations;
var lexicalEnvironmentVariableDeclarationsStack = [];
@@ -67241,7 +67985,14 @@
ts.disposeEmitNodes(ts.getSourceFileOfNode(ts.getParseTreeNode(node)));
}
ts.performance.mark("beforeTransform");
- var transformation = ts.chain.apply(void 0, transformers)(context);
+ var transformersWithContext = transformers.map(function (t) { return t(context); });
+ var transformation = function (node) {
+ for (var _i = 0, transformersWithContext_1 = transformersWithContext; _i < transformersWithContext_1.length; _i++) {
+ var transform = transformersWithContext_1[_i];
+ node = transform(node);
+ }
+ return node;
+ };
state = 1;
var transformed = ts.map(nodes, allowDtsFiles ? transformation : transformRoot);
state = 2;
@@ -67342,6 +68093,7 @@
}
if (lexicalEnvironmentVariableDeclarations) {
var statement = ts.createVariableStatement(undefined, ts.createVariableDeclarationList(lexicalEnvironmentVariableDeclarations));
+ ts.setEmitFlags(statement, 1048576);
if (!statements) {
statements = [statement];
}
@@ -67433,7 +68185,7 @@
ts.forEachEmittedFile = forEachEmittedFile;
function getOutputPathForBuildInfo(options) {
var configFile = options.configFilePath;
- if (!configFile || !ts.isIncrementalCompilation(options))
+ if (!ts.isIncrementalCompilation(options))
return undefined;
if (options.tsBuildInfoFile)
return options.tsBuildInfoFile;
@@ -67443,6 +68195,8 @@
buildInfoExtensionLess = ts.removeFileExtension(outPath);
}
else {
+ if (!configFile)
+ return undefined;
var configFileExtensionLess = ts.removeFileExtension(configFile);
buildInfoExtensionLess = options.outDir ?
options.rootDir ?
@@ -67465,7 +68219,7 @@
ts.getOutputPathsForBundle = getOutputPathsForBundle;
function getOutputPathsFor(sourceFile, host, forceDtsPaths) {
var options = host.getCompilerOptions();
- if (sourceFile.kind === 285) {
+ if (sourceFile.kind === 286) {
return getOutputPathsForBundle(options, forceDtsPaths);
}
else {
@@ -67580,14 +68334,15 @@
return ts.Debug.fail("project " + configFile.options.configFilePath + " expected to have at least one output");
}
ts.getFirstProjectOutput = getFirstProjectOutput;
- function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles, transformers, declarationTransformers, onlyBuildInfo) {
+ function emitFiles(resolver, host, targetSourceFile, _a, emitOnlyDtsFiles, onlyBuildInfo) {
+ var scriptTransformers = _a.scriptTransformers, declarationTransformers = _a.declarationTransformers;
var compilerOptions = host.getCompilerOptions();
var sourceMapDataList = (compilerOptions.sourceMap || compilerOptions.inlineSourceMap || ts.getAreDeclarationMapsEnabled(compilerOptions)) ? [] : undefined;
var emittedFilesList = compilerOptions.listEmittedFiles ? [] : undefined;
var emitterDiagnostics = ts.createDiagnosticCollection();
var newLine = ts.getNewLineCharacter(compilerOptions, function () { return host.getNewLine(); });
var writer = ts.createTextWriter(newLine);
- var _a = ts.performance.createTimer("printTime", "beforePrint", "afterPrint"), enter = _a.enter, exit = _a.exit;
+ var _b = ts.performance.createTimer("printTime", "beforePrint", "afterPrint"), enter = _b.enter, exit = _b.exit;
var bundleBuildInfo;
var emitSkipped = false;
var exportedModulesFromDeclarationEmit;
@@ -67652,7 +68407,7 @@
emitSkipped = true;
return;
}
- var transform = ts.transformNodes(resolver, host, compilerOptions, [sourceFileOrBundle], transformers, false);
+ var transform = ts.transformNodes(resolver, host, compilerOptions, [sourceFileOrBundle], scriptTransformers, false);
var printerOptions = {
removeComments: compilerOptions.removeComments,
newLine: compilerOptions.newLine,
@@ -67686,7 +68441,7 @@
if (emitOnlyDtsFiles && !ts.getEmitDeclarations(compilerOptions)) {
nonJsFiles.forEach(collectLinkedAliases);
}
- var declarationTransform = ts.transformNodes(resolver, host, compilerOptions, inputListOrBundle, ts.concatenate([ts.transformDeclarations], declarationTransformers), false);
+ var declarationTransform = ts.transformNodes(resolver, host, compilerOptions, inputListOrBundle, declarationTransformers, false);
if (ts.length(declarationTransform.diagnostics)) {
for (var _a = 0, _b = declarationTransform.diagnostics; _a < _b.length; _a++) {
var diagnostic = _b[_a];
@@ -67721,7 +68476,7 @@
mapRoot: compilerOptions.mapRoot,
extendedDiagnostics: compilerOptions.extendedDiagnostics,
});
- if (emitOnlyDtsFiles && declarationTransform.transformed[0].kind === 284) {
+ if (emitOnlyDtsFiles && declarationTransform.transformed[0].kind === 285) {
var sourceFile = declarationTransform.transformed[0];
exportedModulesFromDeclarationEmit = sourceFile.exportedModulesFromDeclarationEmit;
}
@@ -67732,7 +68487,7 @@
}
function collectLinkedAliases(node) {
if (ts.isExportAssignment(node)) {
- if (node.expression.kind === 72) {
+ if (node.expression.kind === 73) {
resolver.collectLinkedAliases(node.expression, true);
}
return;
@@ -67744,8 +68499,8 @@
ts.forEachChild(node, collectLinkedAliases);
}
function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, sourceFileOrBundle, printer, mapOptions) {
- var bundle = sourceFileOrBundle.kind === 285 ? sourceFileOrBundle : undefined;
- var sourceFile = sourceFileOrBundle.kind === 284 ? sourceFileOrBundle : undefined;
+ var bundle = sourceFileOrBundle.kind === 286 ? sourceFileOrBundle : undefined;
+ var sourceFile = sourceFileOrBundle.kind === 285 ? sourceFileOrBundle : undefined;
var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile];
var sourceMapGenerator;
if (shouldEmitSourceMaps(mapOptions, sourceFileOrBundle)) {
@@ -67783,7 +68538,7 @@
}
function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) {
return (mapOptions.sourceMap || mapOptions.inlineSourceMap)
- && (sourceFileOrBundle.kind !== 284 || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json"));
+ && (sourceFileOrBundle.kind !== 285 || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json"));
}
function getSourceRoot(mapOptions) {
var sourceRoot = ts.normalizeSlashes(mapOptions.sourceRoot || "");
@@ -67877,7 +68632,7 @@
};
function createSourceFilesFromBundleBuildInfo(bundle) {
var sourceFiles = bundle.sourceFiles.map(function (fileName) {
- var sourceFile = ts.createNode(284, 0, 0);
+ var sourceFile = ts.createNode(285, 0, 0);
sourceFile.fileName = fileName;
sourceFile.text = "";
sourceFile.statements = ts.createNodeArray();
@@ -67889,7 +68644,7 @@
sourceFile.text = prologueInfo.text;
sourceFile.end = prologueInfo.text.length;
sourceFile.statements = ts.createNodeArray(prologueInfo.directives.map(function (directive) {
- var statement = ts.createNode(221, directive.pos, directive.end);
+ var statement = ts.createNode(222, directive.pos, directive.end);
statement.expression = ts.createNode(10, directive.expression.pos, directive.expression.end);
statement.expression.text = directive.expression.text;
return statement;
@@ -67975,7 +68730,7 @@
useCaseSensitiveFileNames: function () { return host.useCaseSensitiveFileNames(); },
getProgramBuildInfo: ts.returnUndefined
};
- emitFiles(ts.notImplementedResolver, emitHost, undefined, false, ts.getTransformers(config.options));
+ emitFiles(ts.notImplementedResolver, emitHost, undefined, ts.getTransformers(config.options), false);
return outputFiles;
}
ts.emitUsingBuildInfo = emitUsingBuildInfo;
@@ -68040,9 +68795,9 @@
break;
}
switch (node.kind) {
- case 284: return printFile(node);
- case 285: return printBundle(node);
- case 286: return printUnparsedSource(node);
+ case 285: return printFile(node);
+ case 286: return printBundle(node);
+ case 287: return printUnparsedSource(node);
}
writeNode(hint, node, sourceFile, beginPrint());
return endPrint();
@@ -68268,11 +69023,11 @@
return pipelineEmitWithSubstitution;
}
case 2:
- if (!commentsDisabled && node.kind !== 284) {
+ if (!commentsDisabled && node.kind !== 285) {
return pipelineEmitWithComments;
}
case 3:
- if (!sourceMapsDisabled && node.kind !== 284 && !ts.isInJsonFile(node)) {
+ if (!sourceMapsDisabled && node.kind !== 285 && !ts.isInJsonFile(node)) {
return pipelineEmitWithSourceMap;
}
case 4:
@@ -68307,256 +69062,256 @@
case 16:
case 17:
return emitLiteral(node);
- case 286:
- case 280:
+ case 287:
+ case 281:
return emitUnparsedSourceOrPrepend(node);
- case 279:
+ case 280:
return writeUnparsedNode(node);
- case 281:
case 282:
- return emitUnparsedTextLike(node);
case 283:
+ return emitUnparsedTextLike(node);
+ case 284:
return emitUnparsedSyntheticReference(node);
- case 72:
+ case 73:
return emitIdentifier(node);
- case 148:
- return emitQualifiedName(node);
case 149:
- return emitComputedPropertyName(node);
+ return emitQualifiedName(node);
case 150:
- return emitTypeParameter(node);
+ return emitComputedPropertyName(node);
case 151:
- return emitParameter(node);
+ return emitTypeParameter(node);
case 152:
- return emitDecorator(node);
+ return emitParameter(node);
case 153:
- return emitPropertySignature(node);
+ return emitDecorator(node);
case 154:
- return emitPropertyDeclaration(node);
+ return emitPropertySignature(node);
case 155:
- return emitMethodSignature(node);
+ return emitPropertyDeclaration(node);
case 156:
- return emitMethodDeclaration(node);
+ return emitMethodSignature(node);
case 157:
- return emitConstructor(node);
+ return emitMethodDeclaration(node);
case 158:
+ return emitConstructor(node);
case 159:
- return emitAccessorDeclaration(node);
case 160:
- return emitCallSignature(node);
+ return emitAccessorDeclaration(node);
case 161:
- return emitConstructSignature(node);
+ return emitCallSignature(node);
case 162:
- return emitIndexSignature(node);
+ return emitConstructSignature(node);
case 163:
- return emitTypePredicate(node);
+ return emitIndexSignature(node);
case 164:
- return emitTypeReference(node);
+ return emitTypePredicate(node);
case 165:
+ return emitTypeReference(node);
+ case 166:
return emitFunctionType(node);
- case 294:
+ case 295:
return emitJSDocFunctionType(node);
- case 166:
- return emitConstructorType(node);
case 167:
- return emitTypeQuery(node);
+ return emitConstructorType(node);
case 168:
- return emitTypeLiteral(node);
+ return emitTypeQuery(node);
case 169:
- return emitArrayType(node);
+ return emitTypeLiteral(node);
case 170:
- return emitTupleType(node);
+ return emitArrayType(node);
case 171:
+ return emitTupleType(node);
+ case 172:
return emitOptionalType(node);
- case 173:
- return emitUnionType(node);
case 174:
- return emitIntersectionType(node);
+ return emitUnionType(node);
case 175:
- return emitConditionalType(node);
+ return emitIntersectionType(node);
case 176:
- return emitInferType(node);
+ return emitConditionalType(node);
case 177:
+ return emitInferType(node);
+ case 178:
return emitParenthesizedType(node);
- case 211:
+ case 212:
return emitExpressionWithTypeArguments(node);
- case 178:
- return emitThisType();
case 179:
- return emitTypeOperator(node);
+ return emitThisType();
case 180:
- return emitIndexedAccessType(node);
+ return emitTypeOperator(node);
case 181:
- return emitMappedType(node);
+ return emitIndexedAccessType(node);
case 182:
- return emitLiteralType(node);
+ return emitMappedType(node);
case 183:
+ return emitLiteralType(node);
+ case 184:
return emitImportTypeNode(node);
- case 289:
+ case 290:
writePunctuation("*");
return;
- case 290:
+ case 291:
writePunctuation("?");
return;
- case 291:
- return emitJSDocNullableType(node);
case 292:
- return emitJSDocNonNullableType(node);
+ return emitJSDocNullableType(node);
case 293:
+ return emitJSDocNonNullableType(node);
+ case 294:
return emitJSDocOptionalType(node);
- case 172:
- case 295:
+ case 173:
+ case 296:
return emitRestOrJSDocVariadicType(node);
- case 184:
- return emitObjectBindingPattern(node);
case 185:
- return emitArrayBindingPattern(node);
+ return emitObjectBindingPattern(node);
case 186:
+ return emitArrayBindingPattern(node);
+ case 187:
return emitBindingElement(node);
- case 216:
- return emitTemplateSpan(node);
case 217:
- return emitSemicolonClassElement();
+ return emitTemplateSpan(node);
case 218:
- return emitBlock(node);
+ return emitSemicolonClassElement();
case 219:
- return emitVariableStatement(node);
+ return emitBlock(node);
case 220:
- return emitEmptyStatement(false);
+ return emitVariableStatement(node);
case 221:
- return emitExpressionStatement(node);
+ return emitEmptyStatement(false);
case 222:
- return emitIfStatement(node);
+ return emitExpressionStatement(node);
case 223:
- return emitDoStatement(node);
+ return emitIfStatement(node);
case 224:
- return emitWhileStatement(node);
+ return emitDoStatement(node);
case 225:
- return emitForStatement(node);
+ return emitWhileStatement(node);
case 226:
- return emitForInStatement(node);
+ return emitForStatement(node);
case 227:
- return emitForOfStatement(node);
+ return emitForInStatement(node);
case 228:
- return emitContinueStatement(node);
+ return emitForOfStatement(node);
case 229:
- return emitBreakStatement(node);
+ return emitContinueStatement(node);
case 230:
- return emitReturnStatement(node);
+ return emitBreakStatement(node);
case 231:
- return emitWithStatement(node);
+ return emitReturnStatement(node);
case 232:
- return emitSwitchStatement(node);
+ return emitWithStatement(node);
case 233:
- return emitLabeledStatement(node);
+ return emitSwitchStatement(node);
case 234:
- return emitThrowStatement(node);
+ return emitLabeledStatement(node);
case 235:
- return emitTryStatement(node);
+ return emitThrowStatement(node);
case 236:
- return emitDebuggerStatement(node);
+ return emitTryStatement(node);
case 237:
- return emitVariableDeclaration(node);
+ return emitDebuggerStatement(node);
case 238:
- return emitVariableDeclarationList(node);
+ return emitVariableDeclaration(node);
case 239:
- return emitFunctionDeclaration(node);
+ return emitVariableDeclarationList(node);
case 240:
- return emitClassDeclaration(node);
+ return emitFunctionDeclaration(node);
case 241:
- return emitInterfaceDeclaration(node);
+ return emitClassDeclaration(node);
case 242:
- return emitTypeAliasDeclaration(node);
+ return emitInterfaceDeclaration(node);
case 243:
- return emitEnumDeclaration(node);
+ return emitTypeAliasDeclaration(node);
case 244:
- return emitModuleDeclaration(node);
+ return emitEnumDeclaration(node);
case 245:
- return emitModuleBlock(node);
+ return emitModuleDeclaration(node);
case 246:
- return emitCaseBlock(node);
+ return emitModuleBlock(node);
case 247:
- return emitNamespaceExportDeclaration(node);
+ return emitCaseBlock(node);
case 248:
- return emitImportEqualsDeclaration(node);
+ return emitNamespaceExportDeclaration(node);
case 249:
- return emitImportDeclaration(node);
+ return emitImportEqualsDeclaration(node);
case 250:
- return emitImportClause(node);
+ return emitImportDeclaration(node);
case 251:
- return emitNamespaceImport(node);
+ return emitImportClause(node);
case 252:
- return emitNamedImports(node);
+ return emitNamespaceImport(node);
case 253:
- return emitImportSpecifier(node);
+ return emitNamedImports(node);
case 254:
- return emitExportAssignment(node);
+ return emitImportSpecifier(node);
case 255:
- return emitExportDeclaration(node);
+ return emitExportAssignment(node);
case 256:
- return emitNamedExports(node);
+ return emitExportDeclaration(node);
case 257:
- return emitExportSpecifier(node);
+ return emitNamedExports(node);
case 258:
- return;
+ return emitExportSpecifier(node);
case 259:
+ return;
+ case 260:
return emitExternalModuleReference(node);
case 11:
return emitJsxText(node);
- case 262:
- case 265:
- return emitJsxOpeningElementOrFragment(node);
case 263:
case 266:
- return emitJsxClosingElementOrFragment(node);
+ return emitJsxOpeningElementOrFragment(node);
+ case 264:
case 267:
- return emitJsxAttribute(node);
+ return emitJsxClosingElementOrFragment(node);
case 268:
- return emitJsxAttributes(node);
+ return emitJsxAttribute(node);
case 269:
- return emitJsxSpreadAttribute(node);
+ return emitJsxAttributes(node);
case 270:
- return emitJsxExpression(node);
+ return emitJsxSpreadAttribute(node);
case 271:
- return emitCaseClause(node);
+ return emitJsxExpression(node);
case 272:
- return emitDefaultClause(node);
+ return emitCaseClause(node);
case 273:
- return emitHeritageClause(node);
+ return emitDefaultClause(node);
case 274:
- return emitCatchClause(node);
+ return emitHeritageClause(node);
case 275:
- return emitPropertyAssignment(node);
+ return emitCatchClause(node);
case 276:
- return emitShorthandPropertyAssignment(node);
+ return emitPropertyAssignment(node);
case 277:
- return emitSpreadAssignment(node);
+ return emitShorthandPropertyAssignment(node);
case 278:
+ return emitSpreadAssignment(node);
+ case 279:
return emitEnumMember(node);
- case 304:
- case 310:
- return emitJSDocPropertyLikeTag(node);
case 305:
- case 307:
+ case 311:
+ return emitJSDocPropertyLikeTag(node);
case 306:
- case 303:
+ case 308:
+ case 307:
+ case 304:
return emitJSDocSimpleTypedTag(node);
- case 300:
+ case 301:
return emitJSDocAugmentsTag(node);
- case 308:
- return emitJSDocTemplateTag(node);
case 309:
+ return emitJSDocTemplateTag(node);
+ case 310:
return emitJSDocTypedefTag(node);
- case 302:
+ case 303:
return emitJSDocCallbackTag(node);
- case 298:
+ case 299:
return emitJSDocSignature(node);
- case 297:
+ case 298:
return emitJSDocTypeLiteral(node);
- case 301:
- case 299:
+ case 302:
+ case 300:
return emitJSDocSimpleTag(node);
- case 296:
+ case 297:
return emitJSDoc(node);
}
if (ts.isExpression(node)) {
@@ -68578,79 +69333,79 @@
case 13:
case 14:
return emitLiteral(node);
- case 72:
+ case 73:
return emitIdentifier(node);
- case 87:
- case 96:
- case 98:
- case 102:
- case 100:
- case 92:
+ case 88:
+ case 97:
+ case 99:
+ case 103:
+ case 101:
+ case 93:
writeTokenNode(node, writeKeyword);
return;
- case 187:
- return emitArrayLiteralExpression(node);
case 188:
- return emitObjectLiteralExpression(node);
+ return emitArrayLiteralExpression(node);
case 189:
- return emitPropertyAccessExpression(node);
+ return emitObjectLiteralExpression(node);
case 190:
- return emitElementAccessExpression(node);
+ return emitPropertyAccessExpression(node);
case 191:
- return emitCallExpression(node);
+ return emitElementAccessExpression(node);
case 192:
- return emitNewExpression(node);
+ return emitCallExpression(node);
case 193:
- return emitTaggedTemplateExpression(node);
+ return emitNewExpression(node);
case 194:
- return emitTypeAssertionExpression(node);
+ return emitTaggedTemplateExpression(node);
case 195:
- return emitParenthesizedExpression(node);
+ return emitTypeAssertionExpression(node);
case 196:
- return emitFunctionExpression(node);
+ return emitParenthesizedExpression(node);
case 197:
- return emitArrowFunction(node);
+ return emitFunctionExpression(node);
case 198:
- return emitDeleteExpression(node);
+ return emitArrowFunction(node);
case 199:
- return emitTypeOfExpression(node);
+ return emitDeleteExpression(node);
case 200:
- return emitVoidExpression(node);
+ return emitTypeOfExpression(node);
case 201:
- return emitAwaitExpression(node);
+ return emitVoidExpression(node);
case 202:
- return emitPrefixUnaryExpression(node);
+ return emitAwaitExpression(node);
case 203:
- return emitPostfixUnaryExpression(node);
+ return emitPrefixUnaryExpression(node);
case 204:
- return emitBinaryExpression(node);
+ return emitPostfixUnaryExpression(node);
case 205:
- return emitConditionalExpression(node);
+ return emitBinaryExpression(node);
case 206:
- return emitTemplateExpression(node);
+ return emitConditionalExpression(node);
case 207:
- return emitYieldExpression(node);
+ return emitTemplateExpression(node);
case 208:
- return emitSpreadExpression(node);
+ return emitYieldExpression(node);
case 209:
- return emitClassExpression(node);
+ return emitSpreadExpression(node);
case 210:
+ return emitClassExpression(node);
+ case 211:
return;
- case 212:
- return emitAsExpression(node);
case 213:
- return emitNonNullExpression(node);
+ return emitAsExpression(node);
case 214:
+ return emitNonNullExpression(node);
+ case 215:
return emitMetaProperty(node);
- case 260:
- return emitJsxElement(node);
case 261:
+ return emitJsxElement(node);
+ case 262:
return emitJsxSelfClosingElement(node);
- case 264:
+ case 265:
return emitJsxFragment(node);
- case 313:
- return emitPartiallyEmittedExpression(node);
case 314:
+ return emitPartiallyEmittedExpression(node);
+ case 315:
return emitCommaList(node);
}
}
@@ -68690,7 +69445,7 @@
}
function emitHelpers(node) {
var helpersEmitted = false;
- var bundle = node.kind === 285 ? node : undefined;
+ var bundle = node.kind === 286 ? node : undefined;
if (bundle && moduleKind === ts.ModuleKind.None) {
return;
}
@@ -68764,7 +69519,7 @@
var pos = getTextPosWithWriteLine();
writeUnparsedNode(unparsed);
if (bundleFileInfo) {
- updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 281 ?
+ updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 282 ?
"text" :
"internal");
}
@@ -68790,7 +69545,7 @@
emit(node.right);
}
function emitEntityName(node) {
- if (node.kind === 72) {
+ if (node.kind === 73) {
emitExpression(node);
}
else {
@@ -68823,7 +69578,7 @@
emit(node.dotDotDotToken);
emitNodeWithWriter(node.name, writeParameter);
emit(node.questionToken);
- if (node.parent && node.parent.kind === 294 && !node.name) {
+ if (node.parent && node.parent.kind === 295 && !node.name) {
emit(node.type);
}
else {
@@ -68881,7 +69636,7 @@
function emitAccessorDeclaration(node) {
emitDecorators(node, node.decorators);
emitModifiers(node, node.modifiers);
- writeKeyword(node.kind === 158 ? "get" : "set");
+ writeKeyword(node.kind === 159 ? "get" : "set");
writeSpace();
emit(node.name);
emitSignatureAndBody(node, emitSignatureHead);
@@ -69055,7 +69810,7 @@
}
if (node.readonlyToken) {
emit(node.readonlyToken);
- if (node.readonlyToken.kind !== 133) {
+ if (node.readonlyToken.kind !== 134) {
writeKeyword("readonly");
}
writeSpace();
@@ -69190,7 +69945,7 @@
emitExpressionList(node, node.arguments, 2576);
}
function emitNewExpression(node) {
- emitTokenWithComment(95, node.pos, writeKeyword, node);
+ emitTokenWithComment(96, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
emitTypeArguments(node, node.typeArguments);
@@ -69230,22 +69985,22 @@
emit(node.equalsGreaterThanToken);
}
function emitDeleteExpression(node) {
- emitTokenWithComment(81, node.pos, writeKeyword, node);
+ emitTokenWithComment(82, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
}
function emitTypeOfExpression(node) {
- emitTokenWithComment(104, node.pos, writeKeyword, node);
+ emitTokenWithComment(105, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
}
function emitVoidExpression(node) {
- emitTokenWithComment(106, node.pos, writeKeyword, node);
+ emitTokenWithComment(107, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
}
function emitAwaitExpression(node) {
- emitTokenWithComment(122, node.pos, writeKeyword, node);
+ emitTokenWithComment(123, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
}
@@ -69258,7 +70013,7 @@
}
function shouldEmitWhitespaceBeforeOperand(node) {
var operand = node.operand;
- return operand.kind === 202
+ return operand.kind === 203
&& ((node.operator === 38 && (operand.operator === 38 || operand.operator === 44))
|| (node.operator === 39 && (operand.operator === 39 || operand.operator === 45)));
}
@@ -69273,7 +70028,7 @@
emitExpression(node.left);
increaseIndentIf(indentBeforeOperator, isCommaOperator);
emitLeadingCommentsOfPosition(node.operatorToken.pos);
- writeTokenNode(node.operatorToken, node.operatorToken.kind === 93 ? writeKeyword : writeOperator);
+ writeTokenNode(node.operatorToken, node.operatorToken.kind === 94 ? writeKeyword : writeOperator);
emitTrailingCommentsOfPosition(node.operatorToken.end, true);
increaseIndentIf(indentAfterOperator, true);
emitExpression(node.right);
@@ -69301,7 +70056,7 @@
emitList(node, node.templateSpans, 262144);
}
function emitYieldExpression(node) {
- emitTokenWithComment(117, node.pos, writeKeyword, node);
+ emitTokenWithComment(118, node.pos, writeKeyword, node);
emit(node.asteriskToken);
emitExpressionWithLeadingSpace(node.expression);
}
@@ -69368,7 +70123,7 @@
}
}
function emitIfStatement(node) {
- var openParenPos = emitTokenWithComment(91, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(92, node.pos, writeKeyword, node);
writeSpace();
emitTokenWithComment(20, openParenPos, writePunctuation, node);
emitExpression(node.expression);
@@ -69376,8 +70131,8 @@
emitEmbeddedStatement(node, node.thenStatement);
if (node.elseStatement) {
writeLineOrSpace(node);
- emitTokenWithComment(83, node.thenStatement.end, writeKeyword, node);
- if (node.elseStatement.kind === 222) {
+ emitTokenWithComment(84, node.thenStatement.end, writeKeyword, node);
+ if (node.elseStatement.kind === 223) {
writeSpace();
emit(node.elseStatement);
}
@@ -69387,14 +70142,14 @@
}
}
function emitWhileClause(node, startPos) {
- var openParenPos = emitTokenWithComment(107, startPos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(108, startPos, writeKeyword, node);
writeSpace();
emitTokenWithComment(20, openParenPos, writePunctuation, node);
emitExpression(node.expression);
emitTokenWithComment(21, node.expression.end, writePunctuation, node);
}
function emitDoStatement(node) {
- emitTokenWithComment(82, node.pos, writeKeyword, node);
+ emitTokenWithComment(83, node.pos, writeKeyword, node);
emitEmbeddedStatement(node, node.statement);
if (ts.isBlock(node.statement)) {
writeSpace();
@@ -69410,7 +70165,7 @@
emitEmbeddedStatement(node, node.statement);
}
function emitForStatement(node) {
- var openParenPos = emitTokenWithComment(89, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(90, node.pos, writeKeyword, node);
writeSpace();
var pos = emitTokenWithComment(20, openParenPos, writePunctuation, node);
emitForBinding(node.initializer);
@@ -69422,25 +70177,25 @@
emitEmbeddedStatement(node, node.statement);
}
function emitForInStatement(node) {
- var openParenPos = emitTokenWithComment(89, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(90, node.pos, writeKeyword, node);
writeSpace();
emitTokenWithComment(20, openParenPos, writePunctuation, node);
emitForBinding(node.initializer);
writeSpace();
- emitTokenWithComment(93, node.initializer.end, writeKeyword, node);
+ emitTokenWithComment(94, node.initializer.end, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
emitTokenWithComment(21, node.expression.end, writePunctuation, node);
emitEmbeddedStatement(node, node.statement);
}
function emitForOfStatement(node) {
- var openParenPos = emitTokenWithComment(89, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(90, node.pos, writeKeyword, node);
writeSpace();
emitWithTrailingSpace(node.awaitModifier);
emitTokenWithComment(20, openParenPos, writePunctuation, node);
emitForBinding(node.initializer);
writeSpace();
- emitTokenWithComment(147, node.initializer.end, writeKeyword, node);
+ emitTokenWithComment(148, node.initializer.end, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
emitTokenWithComment(21, node.expression.end, writePunctuation, node);
@@ -69448,7 +70203,7 @@
}
function emitForBinding(node) {
if (node !== undefined) {
- if (node.kind === 238) {
+ if (node.kind === 239) {
emit(node);
}
else {
@@ -69457,12 +70212,12 @@
}
}
function emitContinueStatement(node) {
- emitTokenWithComment(78, node.pos, writeKeyword, node);
+ emitTokenWithComment(79, node.pos, writeKeyword, node);
emitWithLeadingSpace(node.label);
writeTrailingSemicolon();
}
function emitBreakStatement(node) {
- emitTokenWithComment(73, node.pos, writeKeyword, node);
+ emitTokenWithComment(74, node.pos, writeKeyword, node);
emitWithLeadingSpace(node.label);
writeTrailingSemicolon();
}
@@ -69490,12 +70245,12 @@
return pos;
}
function emitReturnStatement(node) {
- emitTokenWithComment(97, node.pos, writeKeyword, node);
+ emitTokenWithComment(98, node.pos, writeKeyword, node);
emitExpressionWithLeadingSpace(node.expression);
writeTrailingSemicolon();
}
function emitWithStatement(node) {
- var openParenPos = emitTokenWithComment(108, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(109, node.pos, writeKeyword, node);
writeSpace();
emitTokenWithComment(20, openParenPos, writePunctuation, node);
emitExpression(node.expression);
@@ -69503,7 +70258,7 @@
emitEmbeddedStatement(node, node.statement);
}
function emitSwitchStatement(node) {
- var openParenPos = emitTokenWithComment(99, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(100, node.pos, writeKeyword, node);
writeSpace();
emitTokenWithComment(20, openParenPos, writePunctuation, node);
emitExpression(node.expression);
@@ -69518,12 +70273,12 @@
emit(node.statement);
}
function emitThrowStatement(node) {
- emitTokenWithComment(101, node.pos, writeKeyword, node);
+ emitTokenWithComment(102, node.pos, writeKeyword, node);
emitExpressionWithLeadingSpace(node.expression);
writeTrailingSemicolon();
}
function emitTryStatement(node) {
- emitTokenWithComment(103, node.pos, writeKeyword, node);
+ emitTokenWithComment(104, node.pos, writeKeyword, node);
writeSpace();
emit(node.tryBlock);
if (node.catchClause) {
@@ -69532,13 +70287,13 @@
}
if (node.finallyBlock) {
writeLineOrSpace(node);
- emitTokenWithComment(88, (node.catchClause || node.tryBlock).end, writeKeyword, node);
+ emitTokenWithComment(89, (node.catchClause || node.tryBlock).end, writeKeyword, node);
writeSpace();
emit(node.finallyBlock);
}
}
function emitDebuggerStatement(node) {
- writeToken(79, node.pos, writeKeyword);
+ writeToken(80, node.pos, writeKeyword);
writeTrailingSemicolon();
}
function emitVariableDeclaration(node) {
@@ -69733,7 +70488,7 @@
var body = node.body;
if (!body)
return writeTrailingSemicolon();
- while (body.kind === 244) {
+ while (body.kind === 245) {
writePunctuation(".");
emit(body.name);
body = body.body;
@@ -69754,17 +70509,17 @@
}
function emitImportEqualsDeclaration(node) {
emitModifiers(node, node.modifiers);
- emitTokenWithComment(92, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node);
+ emitTokenWithComment(93, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node);
writeSpace();
emit(node.name);
writeSpace();
- emitTokenWithComment(59, node.name.end, writePunctuation, node);
+ emitTokenWithComment(60, node.name.end, writePunctuation, node);
writeSpace();
emitModuleReference(node.moduleReference);
writeTrailingSemicolon();
}
function emitModuleReference(node) {
- if (node.kind === 72) {
+ if (node.kind === 73) {
emitExpression(node);
}
else {
@@ -69773,12 +70528,12 @@
}
function emitImportDeclaration(node) {
emitModifiers(node, node.modifiers);
- emitTokenWithComment(92, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node);
+ emitTokenWithComment(93, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node);
writeSpace();
if (node.importClause) {
emit(node.importClause);
writeSpace();
- emitTokenWithComment(144, node.importClause.end, writeKeyword, node);
+ emitTokenWithComment(145, node.importClause.end, writeKeyword, node);
writeSpace();
}
emitExpression(node.moduleSpecifier);
@@ -69795,7 +70550,7 @@
function emitNamespaceImport(node) {
var asPos = emitTokenWithComment(40, node.pos, writePunctuation, node);
writeSpace();
- emitTokenWithComment(119, asPos, writeKeyword, node);
+ emitTokenWithComment(120, asPos, writeKeyword, node);
writeSpace();
emit(node.name);
}
@@ -69806,20 +70561,20 @@
emitImportOrExportSpecifier(node);
}
function emitExportAssignment(node) {
- var nextPos = emitTokenWithComment(85, node.pos, writeKeyword, node);
+ var nextPos = emitTokenWithComment(86, node.pos, writeKeyword, node);
writeSpace();
if (node.isExportEquals) {
- emitTokenWithComment(59, nextPos, writeOperator, node);
+ emitTokenWithComment(60, nextPos, writeOperator, node);
}
else {
- emitTokenWithComment(80, nextPos, writeKeyword, node);
+ emitTokenWithComment(81, nextPos, writeKeyword, node);
}
writeSpace();
emitExpression(node.expression);
writeTrailingSemicolon();
}
function emitExportDeclaration(node) {
- var nextPos = emitTokenWithComment(85, node.pos, writeKeyword, node);
+ var nextPos = emitTokenWithComment(86, node.pos, writeKeyword, node);
writeSpace();
if (node.exportClause) {
emit(node.exportClause);
@@ -69830,18 +70585,18 @@
if (node.moduleSpecifier) {
writeSpace();
var fromPos = node.exportClause ? node.exportClause.end : nextPos;
- emitTokenWithComment(144, fromPos, writeKeyword, node);
+ emitTokenWithComment(145, fromPos, writeKeyword, node);
writeSpace();
emitExpression(node.moduleSpecifier);
}
writeTrailingSemicolon();
}
function emitNamespaceExportDeclaration(node) {
- var nextPos = emitTokenWithComment(85, node.pos, writeKeyword, node);
+ var nextPos = emitTokenWithComment(86, node.pos, writeKeyword, node);
writeSpace();
- nextPos = emitTokenWithComment(119, nextPos, writeKeyword, node);
+ nextPos = emitTokenWithComment(120, nextPos, writeKeyword, node);
writeSpace();
- nextPos = emitTokenWithComment(131, nextPos, writeKeyword, node);
+ nextPos = emitTokenWithComment(132, nextPos, writeKeyword, node);
writeSpace();
emit(node.name);
writeTrailingSemicolon();
@@ -69861,7 +70616,7 @@
if (node.propertyName) {
emit(node.propertyName);
writeSpace();
- emitTokenWithComment(119, node.propertyName.end, writeKeyword, node);
+ emitTokenWithComment(120, node.propertyName.end, writeKeyword, node);
writeSpace();
}
emit(node.name);
@@ -69933,7 +70688,7 @@
}
}
function emitJsxTagName(node) {
- if (node.kind === 72) {
+ if (node.kind === 73) {
emitExpression(node);
}
else {
@@ -69941,13 +70696,13 @@
}
}
function emitCaseClause(node) {
- emitTokenWithComment(74, node.pos, writeKeyword, node);
+ emitTokenWithComment(75, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
emitCaseOrDefaultClauseRest(node, node.statements, node.expression.end);
}
function emitDefaultClause(node) {
- var pos = emitTokenWithComment(80, node.pos, writeKeyword, node);
+ var pos = emitTokenWithComment(81, node.pos, writeKeyword, node);
emitCaseOrDefaultClauseRest(node, node.statements, pos);
}
function emitCaseOrDefaultClauseRest(parentNode, statements, colonPos) {
@@ -69973,7 +70728,7 @@
emitList(node, node.types, 528);
}
function emitCatchClause(node) {
- var openParenPos = emitTokenWithComment(75, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(76, node.pos, writeKeyword, node);
writeSpace();
if (node.variableDeclaration) {
emitTokenWithComment(20, openParenPos, writePunctuation, node);
@@ -70027,7 +70782,7 @@
}
}
if (node.tags) {
- if (node.tags.length === 1 && node.tags[0].kind === 307 && !node.comment) {
+ if (node.tags.length === 1 && node.tags[0].kind === 308 && !node.comment) {
writeSpace();
emit(node.tags[0]);
}
@@ -70061,7 +70816,7 @@
function emitJSDocTypedefTag(tag) {
emitJSDocTagName(tag.tagName);
if (tag.typeExpression) {
- if (tag.typeExpression.kind === 288) {
+ if (tag.typeExpression.kind === 289) {
emitJSDocTypeExpression(tag.typeExpression);
}
else {
@@ -70080,7 +70835,7 @@
emit(tag.fullName);
}
emitJSDocComment(tag.comment);
- if (tag.typeExpression && tag.typeExpression.kind === 297) {
+ if (tag.typeExpression && tag.typeExpression.kind === 298) {
emitJSDocTypeLiteral(tag.typeExpression);
}
}
@@ -70209,8 +70964,8 @@
bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "reference", data: directive.fileName });
writeLine();
}
- for (var _d = 0, types_19 = types; _d < types_19.length; _d++) {
- var directive = types_19[_d];
+ for (var _d = 0, types_18 = types; _d < types_18.length; _d++) {
+ var directive = types_18[_d];
var pos = writer.getTextPos();
writeComment("/// <reference types=\"" + directive.fileName + "\" />");
if (bundleFileInfo)
@@ -70380,7 +71135,7 @@
function emitInitializer(node, equalCommentStartPos, container) {
if (node) {
writeSpace();
- emitTokenWithComment(59, equalCommentStartPos, writeOperator, container);
+ emitTokenWithComment(60, equalCommentStartPos, writeOperator, container);
writeSpace();
emitExpression(node);
}
@@ -70810,7 +71565,7 @@
&& ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile);
}
function skipSynthesizedParentheses(node) {
- while (node.kind === 195 && ts.nodeIsSynthesized(node)) {
+ while (node.kind === 196 && ts.nodeIsSynthesized(node)) {
node = node.expression;
}
return node;
@@ -70869,81 +71624,81 @@
if (!node)
return;
switch (node.kind) {
- case 218:
+ case 219:
ts.forEach(node.statements, generateNames);
break;
- case 233:
- case 231:
- case 223:
+ case 234:
+ case 232:
case 224:
+ case 225:
generateNames(node.statement);
break;
- case 222:
+ case 223:
generateNames(node.thenStatement);
generateNames(node.elseStatement);
break;
- case 225:
- case 227:
case 226:
+ case 228:
+ case 227:
generateNames(node.initializer);
generateNames(node.statement);
break;
- case 232:
+ case 233:
generateNames(node.caseBlock);
break;
- case 246:
+ case 247:
ts.forEach(node.clauses, generateNames);
break;
- case 271:
case 272:
+ case 273:
ts.forEach(node.statements, generateNames);
break;
- case 235:
+ case 236:
generateNames(node.tryBlock);
generateNames(node.catchClause);
generateNames(node.finallyBlock);
break;
- case 274:
+ case 275:
generateNames(node.variableDeclaration);
generateNames(node.block);
break;
- case 219:
+ case 220:
generateNames(node.declarationList);
break;
- case 238:
+ case 239:
ts.forEach(node.declarations, generateNames);
break;
- case 237:
- case 151:
- case 186:
- case 240:
+ case 238:
+ case 152:
+ case 187:
+ case 241:
generateNameIfNeeded(node.name);
break;
- case 239:
+ case 240:
generateNameIfNeeded(node.name);
if (ts.getEmitFlags(node) & 524288) {
ts.forEach(node.parameters, generateNames);
generateNames(node.body);
}
break;
- case 184:
case 185:
+ case 186:
ts.forEach(node.elements, generateNames);
break;
- case 249:
+ case 250:
generateNames(node.importClause);
break;
- case 250:
+ case 251:
generateNameIfNeeded(node.name);
generateNames(node.namedBindings);
break;
- case 251:
+ case 252:
generateNameIfNeeded(node.name);
break;
- case 252:
+ case 253:
ts.forEach(node.elements, generateNames);
break;
- case 253:
+ case 254:
generateNameIfNeeded(node.propertyName || node.name);
break;
}
@@ -70952,12 +71707,12 @@
if (!node)
return;
switch (node.kind) {
- case 275:
case 276:
- case 154:
- case 156:
- case 158:
+ case 277:
+ case 155:
+ case 157:
case 159:
+ case 160:
generateNameIfNeeded(node.name);
break;
}
@@ -71089,24 +71844,26 @@
}
function generateNameForNode(node, flags) {
switch (node.kind) {
- case 72:
+ case 73:
return makeUniqueName(getTextOfNode(node), isUniqueName, !!(flags & 16), !!(flags & 8));
+ case 245:
case 244:
- case 243:
return generateNameForModuleOrEnum(node);
- case 249:
- case 255:
+ case 250:
+ case 256:
return generateNameForImportOrExportDeclaration(node);
- case 239:
case 240:
- case 254:
+ case 241:
+ case 255:
return generateNameForExportDefault();
- case 209:
+ case 210:
return generateNameForClassExpression();
- case 156:
- case 158:
+ case 157:
case 159:
+ case 160:
return generateNameForMethodOrAccessor(node);
+ case 150:
+ return makeTempVariableName(0, true);
default:
return makeTempVariableName(0);
}
@@ -71142,7 +71899,7 @@
hasWrittenComment = false;
var emitFlags = ts.getEmitFlags(node);
var _a = ts.getCommentRange(node), pos = _a.pos, end = _a.end;
- var isEmittedNode = node.kind !== 312;
+ var isEmittedNode = node.kind !== 313;
var skipLeadingComments = pos < 0 || (emitFlags & 512) !== 0 || node.kind === 11;
var skipTrailingComments = end < 0 || (emitFlags & 1024) !== 0 || node.kind === 11;
var savedContainerPos = containerPos;
@@ -71157,7 +71914,7 @@
}
if (!skipTrailingComments || (end >= 0 && (emitFlags & 1024) !== 0)) {
containerEnd = end;
- if (node.kind === 238) {
+ if (node.kind === 239) {
declarationListContainerEnd = end;
}
}
@@ -71391,7 +72148,7 @@
else {
var _a = ts.getSourceMapRange(node), pos = _a.pos, end = _a.end, _b = _a.source, source = _b === void 0 ? sourceMapSource : _b;
var emitFlags = ts.getEmitFlags(node);
- if (node.kind !== 312
+ if (node.kind !== 313
&& (emitFlags & 16) === 0
&& pos >= 0) {
emitSourcePos(source, skipSourceTrivia(source, pos));
@@ -71404,7 +72161,7 @@
else {
pipelinePhase(hint, node);
}
- if (node.kind !== 312
+ if (node.kind !== 313
&& (emitFlags & 32) === 0
&& end >= 0) {
emitSourcePos(source, end);
@@ -71948,7 +72705,8 @@
getDirectories: function (path) { return system.getDirectories(path); },
realpath: realpath,
readDirectory: function (path, extensions, include, exclude, depth) { return system.readDirectory(path, extensions, include, exclude, depth); },
- createDirectory: function (d) { return system.createDirectory(d); }
+ createDirectory: function (d) { return system.createDirectory(d); },
+ createHash: ts.maybeBind(system, system.createHash)
};
return compilerHost;
}
@@ -72239,6 +72997,7 @@
}
return resolutions;
}
+ ts.loadWithLocalCache = loadWithLocalCache;
function isProgramUptoDate(program, rootFileNames, newOptions, getSourceVersion, fileExists, hasInvalidatedResolution, hasChangedAutomaticTypeDirectiveNames, projectReferences) {
if (!program || hasChangedAutomaticTypeDirectiveNames) {
return false;
@@ -72363,7 +73122,7 @@
}); };
}
else {
- moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, function (x) { return host.getCanonicalFileName(x); });
+ moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, function (x) { return host.getCanonicalFileName(x); }, options);
var loader_1 = function (moduleName, containingFile, redirectedReference) { return ts.resolveModuleName(moduleName, containingFile, options, host, moduleResolutionCache, redirectedReference).resolvedModule; };
resolveModuleNamesWorker = function (moduleNames, containingFile, _reusedNames, redirectedReference) { return loadWithLocalCache(ts.Debug.assertEachDefined(moduleNames), containingFile, redirectedReference, loader_1); };
}
@@ -72483,6 +73242,7 @@
getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); },
getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); },
getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); },
+ getRelationCacheSizes: function () { return getDiagnosticsProducingTypeChecker().getRelationCacheSizes(); },
getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; },
getResolvedTypeReferenceDirectives: function () { return resolvedTypeReferenceDirectives; },
isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary,
@@ -72564,13 +73324,13 @@
}
var oldSourceFile = oldProgram && oldProgram.getSourceFile(containingFile);
if (oldSourceFile !== file && file.resolvedModules) {
- var result_6 = [];
+ var result_8 = [];
for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) {
var moduleName = moduleNames_1[_i];
var resolvedModule = file.resolvedModules.get(moduleName);
- result_6.push(resolvedModule);
+ result_8.push(resolvedModule);
}
- return result_6;
+ return result_8;
}
var unknownModuleNames;
var result;
@@ -72630,7 +73390,7 @@
function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName) {
var resolutionToFile = ts.getResolvedModule(oldSourceFile, moduleName);
var resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
- if (resolutionToFile && resolvedFile && !resolvedFile.externalModuleIndicator) {
+ if (resolutionToFile && resolvedFile) {
return false;
}
var unmodifiedFile = ambientModuleNameToUnmodifiedFileName.get(moduleName);
@@ -72840,7 +73600,7 @@
function emitBuildInfo(writeFileCallback) {
ts.Debug.assert(!options.out && !options.outFile);
ts.performance.mark("beforeEmit");
- var emitResult = ts.emitFiles(ts.notImplementedResolver, getEmitHost(writeFileCallback), undefined, false, undefined, undefined, true);
+ var emitResult = ts.emitFiles(ts.notImplementedResolver, getEmitHost(writeFileCallback), undefined, ts.noTransformers, false, true);
ts.performance.mark("afterEmit");
ts.performance.measure("Emit", "beforeEmit", "afterEmit");
return emitResult;
@@ -72914,8 +73674,7 @@
}
var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver((options.outFile || options.out) ? undefined : sourceFile, cancellationToken);
ts.performance.mark("beforeEmit");
- var transformers = emitOnlyDtsFiles ? [] : ts.getTransformers(options, customTransformers);
- var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile, emitOnlyDtsFiles, transformers, customTransformers && customTransformers.afterDeclarations);
+ var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile, ts.getTransformers(options, customTransformers, emitOnlyDtsFiles), emitOnlyDtsFiles);
ts.performance.mark("afterEmit");
ts.performance.measure("Emit", "beforeEmit", "afterEmit");
return emitResult;
@@ -73037,62 +73796,62 @@
return diagnostics;
function walk(node) {
switch (parent.kind) {
- case 151:
- case 154:
+ case 152:
+ case 155:
if (parent.questionToken === node) {
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, "?"));
return;
}
- case 156:
- case 155:
case 157:
+ case 156:
case 158:
case 159:
- case 196:
- case 239:
+ case 160:
case 197:
- case 237:
+ case 240:
+ case 198:
+ case 238:
if (parent.type === node) {
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.types_can_only_be_used_in_a_ts_file));
return;
}
}
switch (node.kind) {
- case 248:
+ case 249:
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file));
return;
- case 254:
+ case 255:
if (node.isExportEquals) {
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file));
return;
}
break;
- case 273:
+ case 274:
var heritageClause = node;
- if (heritageClause.token === 109) {
+ if (heritageClause.token === 110) {
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file));
return;
}
break;
- case 241:
+ case 242:
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file));
return;
- case 244:
+ case 245:
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file));
return;
- case 242:
+ case 243:
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file));
return;
- case 243:
+ case 244:
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file));
return;
- case 213:
+ case 214:
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.non_null_assertions_can_only_be_used_in_a_ts_file));
return;
- case 212:
+ case 213:
diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file));
return;
- case 194:
+ case 195:
ts.Debug.fail();
}
var prevParent = parent;
@@ -73102,49 +73861,49 @@
}
function walkArray(nodes) {
if (parent.decorators === nodes && !options.experimentalDecorators) {
- diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning));
+ diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning));
}
switch (parent.kind) {
- case 240:
- case 156:
- case 155:
+ case 241:
case 157:
+ case 156:
case 158:
case 159:
- case 196:
- case 239:
+ case 160:
case 197:
+ case 240:
+ case 198:
if (nodes === parent.typeParameters) {
diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file));
return;
}
- case 219:
+ case 220:
if (nodes === parent.modifiers) {
- return checkModifiers(nodes, parent.kind === 219);
+ return checkModifiers(nodes, parent.kind === 220);
}
break;
- case 154:
+ case 155:
if (nodes === parent.modifiers) {
for (var _i = 0, _a = nodes; _i < _a.length; _i++) {
var modifier = _a[_i];
- if (modifier.kind !== 116) {
+ if (modifier.kind !== 117) {
diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind)));
}
}
return;
}
break;
- case 151:
+ case 152:
if (nodes === parent.modifiers) {
diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file));
return;
}
break;
- case 191:
case 192:
- case 211:
- case 261:
+ case 193:
+ case 212:
case 262:
+ case 263:
if (nodes === parent.typeArguments) {
diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file));
return;
@@ -73160,21 +73919,21 @@
for (var _i = 0, modifiers_1 = modifiers; _i < modifiers_1.length; _i++) {
var modifier = modifiers_1[_i];
switch (modifier.kind) {
- case 77:
+ case 78:
if (isConstValid) {
continue;
}
- case 115:
- case 113:
+ case 116:
case 114:
- case 133:
- case 125:
- case 118:
+ case 115:
+ case 134:
+ case 126:
+ case 119:
diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind)));
break;
- case 116:
- case 85:
- case 80:
+ case 117:
+ case 86:
+ case 81:
}
}
}
@@ -73246,8 +74005,8 @@
return a.fileName === b.fileName;
}
function moduleNameIsEqualTo(a, b) {
- return a.kind === 72
- ? b.kind === 72 && a.escapedText === b.escapedText
+ return a.kind === 73
+ ? b.kind === 73 && a.escapedText === b.escapedText
: b.kind === 10 && a.text === b.text;
}
function collectExternalModuleReferences(file) {
@@ -73436,7 +74195,9 @@
if (isRedirect) {
inputName = getProjectReferenceRedirect(fileName) || fileName;
}
- if (ts.getNormalizedAbsolutePath(checkedName, currentDirectory) !== ts.getNormalizedAbsolutePath(inputName, currentDirectory)) {
+ var checkedAbsolutePath = ts.getNormalizedAbsolutePathWithoutRoot(checkedName, currentDirectory);
+ var inputAbsolutePath = ts.getNormalizedAbsolutePathWithoutRoot(inputName, currentDirectory);
+ if (checkedAbsolutePath !== inputAbsolutePath) {
reportFileNamesDifferOnlyInCasingError(inputName, checkedName, refFile, refPos, refEnd);
}
}
@@ -73462,8 +74223,12 @@
}
var redirectedPath;
if (refFile) {
- var redirect = getProjectReferenceRedirect(fileName);
- if (redirect) {
+ var redirectProject = getProjectReferenceRedirectProject(fileName);
+ if (redirectProject) {
+ if (redirectProject.commandLine.options.outFile || redirectProject.commandLine.options.out) {
+ return undefined;
+ }
+ var redirect = getProjectReferenceOutputName(redirectProject, fileName);
fileName = redirect;
redirectedPath = toPath(redirect);
}
@@ -73536,13 +74301,16 @@
}
}
function getProjectReferenceRedirect(fileName) {
+ var referencedProject = getProjectReferenceRedirectProject(fileName);
+ return referencedProject && getProjectReferenceOutputName(referencedProject, fileName);
+ }
+ function getProjectReferenceRedirectProject(fileName) {
if (!resolvedProjectReferences || !resolvedProjectReferences.length || ts.fileExtensionIs(fileName, ".d.ts") || !ts.fileExtensionIsOneOf(fileName, ts.supportedTSExtensions)) {
return undefined;
}
- var referencedProject = getResolvedProjectReferenceToRedirect(fileName);
- if (!referencedProject) {
- return undefined;
+ return getResolvedProjectReferenceToRedirect(fileName);
}
+ function getProjectReferenceOutputName(referencedProject, fileName) {
var out = referencedProject.commandLine.options.outFile || referencedProject.commandLine.options.out;
return out ?
ts.changeExtension(out, ".d.ts") :
@@ -73760,17 +74528,32 @@
if (fromCache !== undefined) {
return fromCache || undefined;
}
+ var commandLine;
+ var sourceFile;
+ if (host.getParsedCommandLine) {
+ commandLine = host.getParsedCommandLine(refPath);
+ if (!commandLine) {
+ addFileToFilesByName(undefined, sourceFilePath, undefined);
+ projectReferenceRedirects.set(sourceFilePath, false);
+ return undefined;
+ }
+ sourceFile = ts.Debug.assertDefined(commandLine.options.configFile);
+ ts.Debug.assert(!sourceFile.path || sourceFile.path === sourceFilePath);
+ addFileToFilesByName(sourceFile, sourceFilePath, undefined);
+ }
+ else {
var basePath = ts.getNormalizedAbsolutePath(ts.getDirectoryPath(refPath), host.getCurrentDirectory());
- var sourceFile = host.getSourceFile(refPath, 100);
+ sourceFile = host.getSourceFile(refPath, 100);
addFileToFilesByName(sourceFile, sourceFilePath, undefined);
if (sourceFile === undefined) {
projectReferenceRedirects.set(sourceFilePath, false);
return undefined;
}
+ commandLine = ts.parseJsonSourceFileConfigFileContent(sourceFile, configParsingHost, basePath, undefined, refPath);
+ }
sourceFile.path = sourceFilePath;
sourceFile.resolvedPath = sourceFilePath;
sourceFile.originalFileName = refPath;
- var commandLine = ts.parseJsonSourceFileConfigFileContent(sourceFile, configParsingHost, basePath, undefined, refPath);
var resolvedRef = { commandLine: commandLine, sourceFile: sourceFile };
projectReferenceRedirects.set(sourceFilePath, resolvedRef);
if (commandLine.projectReferences) {
@@ -73786,9 +74569,6 @@
if (ts.getEmitDeclarations(options)) {
createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, getEmitDeclarationOptionName(options), "isolatedModules");
}
- if (options.noEmitOnError) {
- createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules");
- }
if (options.out) {
createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules");
}
@@ -73820,14 +74600,15 @@
createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "tsBuildInfoFile", "incremental", "composite");
}
}
+ else if (options.incremental && !options.outFile && !options.out && !options.configFilePath) {
+ programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified));
+ }
verifyProjectReferences();
if (options.composite) {
var rootPaths = rootNames.map(toPath);
for (var _i = 0, files_3 = files; _i < files_3.length; _i++) {
var file = files_3[_i];
- if (file.isDeclarationFile)
- continue;
- if (ts.isJsonSourceFile(file) && getResolvedProjectReferenceToRedirect(file.fileName))
+ if (!ts.sourceFileMayBeEmitted(file, options, isSourceFileFromExternalLibrary, getResolvedProjectReferenceToRedirect))
continue;
if (rootPaths.indexOf(file.path) === -1) {
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_is_not_in_project_file_list_Projects_must_list_all_files_or_use_an_include_pattern, file.fileName));
@@ -73903,10 +74684,10 @@
if (options.module === ts.ModuleKind.None && languageVersion < 2) {
createDiagnosticForOptionName(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher, "isolatedModules", "target");
}
- var firstNonExternalModuleSourceFile = ts.find(files, function (f) { return !ts.isExternalModule(f) && !f.isDeclarationFile && f.scriptKind !== 6; });
+ var firstNonExternalModuleSourceFile = ts.find(files, function (f) { return !ts.isExternalModule(f) && !ts.isSourceFileJS(f) && !f.isDeclarationFile && f.scriptKind !== 6; });
if (firstNonExternalModuleSourceFile) {
var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile);
- programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided));
+ programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.All_files_must_be_modules_when_the_isolatedModules_flag_is_provided));
}
}
else if (firstNonAmbientExternalModuleSourceFile && languageVersion < 2 && options.module === ts.ModuleKind.None) {
@@ -73981,12 +74762,12 @@
if (emitFileName) {
var emitFilePath = toPath(emitFileName);
if (filesByName.has(emitFilePath)) {
- var chain_2;
+ var chain = void 0;
if (!options.configFilePath) {
- chain_2 = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig);
+ chain = ts.chainDiagnosticMessages(undefined, ts.Diagnostics.Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig);
}
- chain_2 = ts.chainDiagnosticMessages(chain_2, ts.Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file, emitFileName);
- blockEmittingOfFile(emitFileName, ts.createCompilerDiagnosticFromMessageChain(chain_2));
+ chain = ts.chainDiagnosticMessages(chain, ts.Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file, emitFileName);
+ blockEmittingOfFile(emitFileName, ts.createCompilerDiagnosticFromMessageChain(chain));
}
var emitFileKey = !host.useCaseSensitiveFileNames() ? emitFilePath.toLocaleLowerCase() : emitFilePath;
if (emitFilesSeen.has(emitFileKey)) {
@@ -74447,6 +75228,7 @@
cacheToUpdateSignature.set(sourceFile.path, latestSignature);
return !prevSignature || latestSignature !== prevSignature;
}
+ BuilderState.updateShapeSignature = updateShapeSignature;
function updateExportedModules(sourceFile, exportedModulesFromDeclarationEmit, exportedModulesMapCache) {
if (!exportedModulesFromDeclarationEmit) {
exportedModulesMapCache.set(sourceFile.path, false);
@@ -74656,14 +75438,8 @@
}
}
});
- if (oldCompilerOptions &&
- (oldCompilerOptions.outDir !== compilerOptions.outDir ||
- oldCompilerOptions.declarationDir !== compilerOptions.declarationDir ||
- (oldCompilerOptions.outFile || oldCompilerOptions.out) !== (compilerOptions.outFile || compilerOptions.out))) {
- state.affectedFilesPendingEmit = ts.concatenate(state.affectedFilesPendingEmit, newProgram.getSourceFiles().map(function (f) { return f.path; }));
- if (state.affectedFilesPendingEmitIndex === undefined) {
- state.affectedFilesPendingEmitIndex = 0;
- }
+ if (oldCompilerOptions && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
+ addToAffectedFilesPendingEmit(state, newProgram.getSourceFiles().map(function (f) { return f.path; }));
ts.Debug.assert(state.seenAffectedFiles === undefined);
state.seenAffectedFiles = ts.createMap();
}
@@ -74731,7 +75507,7 @@
var affectedFile = affectedFiles[affectedFilesIndex];
if (!seenAffectedFiles.has(affectedFile.path)) {
state.affectedFilesIndex = affectedFilesIndex;
- cleanSemanticDiagnosticsOfAffectedFile(state, affectedFile);
+ handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash);
return affectedFile;
}
seenAffectedFiles.set(affectedFile.path, true);
@@ -74780,22 +75556,46 @@
}
return undefined;
}
- function cleanSemanticDiagnosticsOfAffectedFile(state, affectedFile) {
- if (removeSemanticDiagnosticsOf(state, affectedFile.path)) {
- return;
- }
- if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles && !state.cleanedDiagnosticsOfLibFiles) {
+ function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash) {
+ removeSemanticDiagnosticsOf(state, affectedFile.path);
+ if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
+ if (!state.cleanedDiagnosticsOfLibFiles) {
state.cleanedDiagnosticsOfLibFiles = true;
var program_1 = ts.Debug.assertDefined(state.program);
var options_2 = program_1.getCompilerOptions();
- if (ts.forEach(program_1.getSourceFiles(), function (f) {
+ ts.forEach(program_1.getSourceFiles(), function (f) {
return program_1.isSourceFileDefaultLibrary(f) &&
!ts.skipTypeChecking(f, options_2) &&
removeSemanticDiagnosticsOf(state, f.path);
- })) {
+ });
+ }
return;
}
+ forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, function (state, path) { return handleDtsMayChangeOf(state, path, cancellationToken, computeHash); });
+ }
+ function handleDtsMayChangeOf(state, path, cancellationToken, computeHash) {
+ removeSemanticDiagnosticsOf(state, path);
+ if (!state.changedFilesSet.has(path)) {
+ var program = ts.Debug.assertDefined(state.program);
+ var sourceFile = program.getSourceFileByPath(path);
+ if (sourceFile) {
+ ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.assertDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
+ if (ts.getEmitDeclarations(state.compilerOptions)) {
+ addToAffectedFilesPendingEmit(state, [path]);
}
+ }
+ }
+ return false;
+ }
+ function removeSemanticDiagnosticsOf(state, path) {
+ if (!state.semanticDiagnosticsFromOldState) {
+ return true;
+ }
+ state.semanticDiagnosticsFromOldState.delete(path);
+ state.semanticDiagnosticsPerFile.delete(path);
+ return !state.semanticDiagnosticsFromOldState.size;
+ }
+ function forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, fn) {
if (!state.exportedModulesMap || state.affectedFiles.length === 1 || !state.changedFilesSet.has(affectedFile.path)) {
return;
}
@@ -74804,57 +75604,49 @@
if (ts.forEachEntry(state.currentAffectedFilesExportedModulesMap, function (exportedModules, exportedFromPath) {
return exportedModules &&
exportedModules.has(affectedFile.path) &&
- removeSemanticDiagnosticsOfFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile);
+ forEachFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile, fn);
})) {
return;
}
ts.forEachEntry(state.exportedModulesMap, function (exportedModules, exportedFromPath) {
return !state.currentAffectedFilesExportedModulesMap.has(exportedFromPath) &&
exportedModules.has(affectedFile.path) &&
- removeSemanticDiagnosticsOfFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile);
+ forEachFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile, fn);
});
}
- function removeSemanticDiagnosticsOfFilesReferencingPath(state, referencedPath, seenFileAndExportsOfFile) {
+ function forEachFilesReferencingPath(state, referencedPath, seenFileAndExportsOfFile, fn) {
return ts.forEachEntry(state.referencedMap, function (referencesInFile, filePath) {
- return referencesInFile.has(referencedPath) && removeSemanticDiagnosticsOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile);
+ return referencesInFile.has(referencedPath) && forEachFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, fn);
});
}
- function removeSemanticDiagnosticsOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile) {
+ function forEachFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, fn) {
if (!ts.addToSeen(seenFileAndExportsOfFile, filePath)) {
return false;
}
- if (removeSemanticDiagnosticsOf(state, filePath)) {
+ if (fn(state, filePath)) {
return true;
}
ts.Debug.assert(!!state.currentAffectedFilesExportedModulesMap);
if (ts.forEachEntry(state.currentAffectedFilesExportedModulesMap, function (exportedModules, exportedFromPath) {
return exportedModules &&
exportedModules.has(filePath) &&
- removeSemanticDiagnosticsOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile);
+ forEachFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, fn);
})) {
return true;
}
if (ts.forEachEntry(state.exportedModulesMap, function (exportedModules, exportedFromPath) {
return !state.currentAffectedFilesExportedModulesMap.has(exportedFromPath) &&
exportedModules.has(filePath) &&
- removeSemanticDiagnosticsOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile);
+ forEachFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, fn);
})) {
return true;
}
return !!ts.forEachEntry(state.referencedMap, function (referencesInFile, referencingFilePath) {
return referencesInFile.has(filePath) &&
!seenFileAndExportsOfFile.has(referencingFilePath) &&
- removeSemanticDiagnosticsOf(state, referencingFilePath);
+ fn(state, referencingFilePath);
});
}
- function removeSemanticDiagnosticsOf(state, path) {
- if (!state.semanticDiagnosticsFromOldState) {
- return true;
- }
- state.semanticDiagnosticsFromOldState.delete(path);
- state.semanticDiagnosticsPerFile.delete(path);
- return !state.semanticDiagnosticsFromOldState.size;
- }
function doneWithAffectedFile(state, affected, isPendingEmit, isBuildInfoEmit) {
if (isBuildInfoEmit) {
state.emittedBuildInfo = true;
@@ -75047,7 +75839,7 @@
return undefined;
}
var affected_1 = ts.Debug.assertDefined(state.program);
- return toAffectedFileResult(state, affected_1.emitBuildInfo(writeFile || host.writeFile, cancellationToken), affected_1, false, true);
+ return toAffectedFileResult(state, affected_1.emitBuildInfo(writeFile || ts.maybeBind(host, host.writeFile), cancellationToken), affected_1, false, true);
}
isPendingEmitFile = true;
}
@@ -75060,10 +75852,7 @@
affected = program;
}
}
- if (state.affectedFilesPendingEmit && state.program !== affected) {
- (state.seenEmittedFiles || (state.seenEmittedFiles = ts.createMap())).set(affected.path, true);
- }
- return toAffectedFileResult(state, ts.Debug.assertDefined(state.program).emit(affected === state.program ? undefined : affected, writeFile || host.writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers), affected, isPendingEmitFile);
+ return toAffectedFileResult(state, ts.Debug.assertDefined(state.program).emit(affected === state.program ? undefined : affected, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers), affected, isPendingEmitFile);
}
function emit(targetSourceFile, writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers) {
if (kind === BuilderProgramKind.EmitAndSemanticDiagnosticsBuilderProgram) {
@@ -75088,7 +75877,7 @@
};
}
}
- return ts.Debug.assertDefined(state.program).emit(targetSourceFile, writeFile || host.writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers);
+ return ts.Debug.assertDefined(state.program).emit(targetSourceFile, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
}
function getSemanticDiagnosticsOfNextAffectedFile(cancellationToken, ignoreSourceFile) {
while (true) {
@@ -75125,10 +75914,7 @@
doneWithAffectedFile(state, affected);
}
if (affectedFilesPendingEmit) {
- state.affectedFilesPendingEmit = ts.concatenate(state.affectedFilesPendingEmit, affectedFilesPendingEmit);
- if (state.affectedFilesPendingEmitIndex === undefined) {
- state.affectedFilesPendingEmitIndex = 0;
- }
+ addToAffectedFilesPendingEmit(state, affectedFilesPendingEmit);
}
var diagnostics;
for (var _i = 0, _a = ts.Debug.assertDefined(state.program).getSourceFiles(); _i < _a.length; _i++) {
@@ -75139,6 +75925,12 @@
}
}
ts.createBuilderProgram = createBuilderProgram;
+ function addToAffectedFilesPendingEmit(state, affectedFilesPendingEmit) {
+ state.affectedFilesPendingEmit = ts.concatenate(state.affectedFilesPendingEmit, affectedFilesPendingEmit);
+ if (state.affectedFilesPendingEmitIndex === undefined) {
+ state.affectedFilesPendingEmitIndex = 0;
+ }
+ }
function getMapOfReferencedSet(mapLike) {
if (!mapLike)
return undefined;
@@ -75887,11 +76679,11 @@
}
function discoverProbableSymlinks(files, getCanonicalFileName, cwd) {
var result = ts.createMap();
- var symlinks = ts.mapDefined(files, function (sf) {
- return sf.resolvedModules && ts.firstDefinedIterator(sf.resolvedModules.values(), function (res) {
+ var symlinks = ts.flatten(ts.mapDefined(files, function (sf) {
+ return sf.resolvedModules && ts.compact(ts.arrayFrom(ts.mapIterator(sf.resolvedModules.values(), function (res) {
return res && res.originalPath && res.resolvedFileName !== res.originalPath ? [res.resolvedFileName, res.originalPath] : undefined;
- });
- });
+ })));
+ }));
for (var _i = 0, symlinks_1 = symlinks; _i < symlinks_1.length; _i++) {
var _a = symlinks_1[_i], resolvedPath = _a[0], originalPath = _a[1];
var _b = guessDirectorySymlink(resolvedPath, originalPath, cwd, getCanonicalFileName), commonResolved = _b[0], commonOriginal = _b[1];
@@ -76198,6 +76990,14 @@
return "" + newLine + ts.flattenDiagnosticMessageText(d.messageText, newLine) + newLine + newLine;
}
ts.getErrorSummaryText = getErrorSummaryText;
+ function listFiles(program, writeFileName) {
+ if (program.getCompilerOptions().listFiles) {
+ ts.forEach(program.getSourceFiles(), function (file) {
+ writeFileName(file.fileName);
+ });
+ }
+ }
+ ts.listFiles = listFiles;
function emitFilesAndReportErrors(program, reportDiagnostic, writeFileName, reportSummary, writeFile) {
var diagnostics = program.getConfigFileParsingDiagnostics().slice();
var configFileParsingDiagnosticsLength = diagnostics.length;
@@ -76218,11 +77018,7 @@
var filepath = ts.getNormalizedAbsolutePath(file, currentDir_1);
writeFileName("TSFILE: " + filepath);
});
- if (program.getCompilerOptions().listFiles) {
- ts.forEach(program.getSourceFiles(), function (file) {
- writeFileName(file.fileName);
- });
- }
+ listFiles(program, writeFileName);
}
if (reportSummary) {
reportSummary(getErrorCountForSummary(diagnostics));
@@ -76941,6 +77737,7 @@
function getCompilerOptionsOfBuildOptions(buildOptions) {
var result = {};
ts.commonOptionsWithBuild.forEach(function (option) {
+ if (ts.hasProperty(buildOptions, option.name))
result[option.name] = buildOptions[option.name];
});
return result;
@@ -76957,12 +77754,18 @@
var projectStatus = createFileMap(toPath);
var missingRoots = ts.createMap();
var globalDependencyGraph;
- var writeFileName = function (s) { return host.trace && host.trace(s); };
+ var writeFileName = host.trace ? function (s) { return host.trace(s); } : undefined;
var readFileWithCache = function (f) { return host.readFile(f); };
var projectCompilerOptions = baseCompilerOptions;
var compilerHost = ts.createCompilerHostFromProgramHost(host, function () { return projectCompilerOptions; });
ts.setGetSourceFileAsHashVersioned(compilerHost, host);
+ compilerHost.getParsedCommandLine = parseConfigFile;
+ compilerHost.resolveModuleNames = ts.maybeBind(host, host.resolveModuleNames);
+ compilerHost.resolveTypeReferenceDirectives = ts.maybeBind(host, host.resolveTypeReferenceDirectives);
+ var moduleResolutionCache = !compilerHost.resolveModuleNames ? ts.createModuleResolutionCache(currentDirectory, getCanonicalFileName) : undefined;
+ var cacheState;
var buildInfoChecked = createFileMap(toPath);
+ var extendedConfigCache = ts.createMap();
var builderPrograms = createFileMap(toPath);
var diagnostics = createFileMap(toPath);
var projectPendingBuild = createFileMap(toPath);
@@ -77024,7 +77827,7 @@
}
var diagnostic;
parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = function (d) { return diagnostic = d; };
- var parsed = ts.getParsedCommandLineOfConfigFile(configFilePath, baseCompilerOptions, parseConfigFileHost);
+ var parsed = ts.getParsedCommandLineOfConfigFile(configFilePath, baseCompilerOptions, parseConfigFileHost, extendedConfigCache);
parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = ts.noop;
configFileCache.setValue(configFilePath, parsed || diagnostic);
return parsed;
@@ -77314,6 +78117,7 @@
projectStatus.removeKey(resolved);
diagnostics.removeKey(resolved);
addProjToQueue(resolved, reloadLevel);
+ enableCache();
}
function addProjToQueue(proj, reloadLevel) {
var value = projectPendingBuild.getValue(proj);
@@ -77366,6 +78170,7 @@
}
}
else {
+ disableCache();
reportErrorSummary();
}
}
@@ -77514,6 +78319,25 @@
return BuildResultFlags.None;
}
projectCompilerOptions = configFile.options;
+ if (moduleResolutionCache) {
+ var projPath = toPath(proj);
+ if (moduleResolutionCache.directoryToModuleNameMap.redirectsMap.size === 0) {
+ ts.Debug.assert(moduleResolutionCache.moduleNameToDirectoryMap.redirectsMap.size === 0);
+ moduleResolutionCache.directoryToModuleNameMap.redirectsMap.set(projPath, moduleResolutionCache.directoryToModuleNameMap.ownMap);
+ moduleResolutionCache.moduleNameToDirectoryMap.redirectsMap.set(projPath, moduleResolutionCache.moduleNameToDirectoryMap.ownMap);
+ }
+ else {
+ ts.Debug.assert(moduleResolutionCache.moduleNameToDirectoryMap.redirectsMap.size > 0);
+ var ref = {
+ sourceFile: projectCompilerOptions.configFile,
+ commandLine: configFile
+ };
+ moduleResolutionCache.directoryToModuleNameMap.setOwnMap(moduleResolutionCache.directoryToModuleNameMap.getOrCreateMapOfCacheRedirects(ref));
+ moduleResolutionCache.moduleNameToDirectoryMap.setOwnMap(moduleResolutionCache.moduleNameToDirectoryMap.getOrCreateMapOfCacheRedirects(ref));
+ }
+ moduleResolutionCache.directoryToModuleNameMap.setOwnOptions(projectCompilerOptions);
+ moduleResolutionCache.moduleNameToDirectoryMap.setOwnOptions(projectCompilerOptions);
+ }
var program = host.createProgram(configFile.fileNames, configFile.options, compilerHost, getOldProgram(proj, configFile), configFile.errors, configFile.projectReferences);
var syntaxDiagnostics = program.getConfigFileParsingDiagnostics().concat(program.getOptionsDiagnostics(), program.getGlobalDiagnostics(), program.getSyntacticDiagnostics());
if (syntaxDiagnostics.length) {
@@ -77529,7 +78353,7 @@
var declDiagnostics;
var reportDeclarationDiagnostics = function (d) { return (declDiagnostics || (declDiagnostics = [])).push(d); };
var outputFiles = [];
- ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics, writeFileName, undefined, function (name, text, writeByteOrderMark) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); });
+ ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics, undefined, undefined, function (name, text, writeByteOrderMark) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); });
if (declDiagnostics) {
program.restoreState();
return buildErrors(declDiagnostics, BuildResultFlags.DeclarationEmitErrors, "Declaration file");
@@ -77548,7 +78372,7 @@
anyDtsChanged = true;
}
}
- emittedOutputs.setValue(name, true);
+ emittedOutputs.setValue(name, name);
ts.writeFile(compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
if (priorChangeTime !== undefined) {
newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime);
@@ -77559,6 +78383,10 @@
if (emitDiagnostics.length) {
return buildErrors(emitDiagnostics, BuildResultFlags.EmitErrors, "Emit");
}
+ if (writeFileName) {
+ emittedOutputs.forEach(function (name) { return listEmittedFile(configFile, name); });
+ ts.listFiles(program, writeFileName);
+ }
newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(configFile, newestDeclarationFileContentChangedTime, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
var status = {
type: UpToDateStatusType.UpToDate,
@@ -77573,12 +78401,19 @@
function buildErrors(diagnostics, errorFlags, errorType) {
resultFlags |= errorFlags;
reportAndStoreErrors(proj, diagnostics);
+ if (writeFileName)
+ ts.listFiles(program, writeFileName);
projectStatus.setValue(proj, { type: UpToDateStatusType.Unbuildable, reason: errorType + " errors" });
afterProgramCreate(proj, program);
projectCompilerOptions = baseCompilerOptions;
return resultFlags;
}
}
+ function listEmittedFile(proj, file) {
+ if (writeFileName && proj.options.listEmittedFiles) {
+ writeFileName("TSFILE: " + file);
+ }
+ }
function afterProgramCreate(proj, program) {
if (host.afterProgramEmitAndDiagnostics) {
host.afterProgramEmitAndDiagnostics(program);
@@ -77615,7 +78450,7 @@
var emittedOutputs = createFileMap(toPath);
outputFiles.forEach(function (_a) {
var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
- emittedOutputs.setValue(name, true);
+ emittedOutputs.setValue(name, name);
ts.writeFile(compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
});
var emitDiagnostics = emitterDiagnostics.getDiagnostics();
@@ -77625,6 +78460,9 @@
projectCompilerOptions = baseCompilerOptions;
return BuildResultFlags.DeclarationOutputUnchanged | BuildResultFlags.EmitErrors;
}
+ if (writeFileName) {
+ emittedOutputs.forEach(function (name) { return listEmittedFile(config, name); });
+ }
var newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(config, minimumDate, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
var status = {
type: UpToDateStatusType.UpToDate,
@@ -77664,9 +78502,7 @@
priorNewestUpdateTime = newer(priorNewestUpdateTime, host.getModifiedTime(file) || ts.missingFileModifiedTime);
}
host.setModifiedTime(file, now);
- if (proj.options.listEmittedFiles) {
- writeFileName("TSFILE: " + file);
- }
+ listEmittedFile(proj, file);
}
}
return priorNewestUpdateTime;
@@ -77709,26 +78545,67 @@
function resolveProjectNames(configFileNames) {
return configFileNames.map(resolveProjectName);
}
- function buildAllProjects() {
- if (options.watch) {
- reportWatchStatus(ts.Diagnostics.Starting_compilation_in_watch_mode);
+ function enableCache() {
+ if (cacheState) {
+ disableCache();
}
- var savedReadFileWithCache = readFileWithCache;
- var savedGetSourceFile = compilerHost.getSourceFile;
+ var originalReadFileWithCache = readFileWithCache;
+ var originalGetSourceFile = compilerHost.getSourceFile;
var _a = ts.changeCompilerHostLikeToUseCache(host, toPath, function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
- return savedGetSourceFile.call.apply(savedGetSourceFile, [compilerHost].concat(args));
+ return originalGetSourceFile.call.apply(originalGetSourceFile, [compilerHost].concat(args));
}), originalReadFile = _a.originalReadFile, originalFileExists = _a.originalFileExists, originalDirectoryExists = _a.originalDirectoryExists, originalCreateDirectory = _a.originalCreateDirectory, originalWriteFile = _a.originalWriteFile, getSourceFileWithCache = _a.getSourceFileWithCache, newReadFileWithCache = _a.readFileWithCache;
readFileWithCache = newReadFileWithCache;
compilerHost.getSourceFile = getSourceFileWithCache;
+ var originalResolveModuleNames = compilerHost.resolveModuleNames;
+ if (!compilerHost.resolveModuleNames) {
+ var loader_3 = function (moduleName, containingFile, redirectedReference) { return ts.resolveModuleName(moduleName, containingFile, projectCompilerOptions, compilerHost, moduleResolutionCache, redirectedReference).resolvedModule; };
+ compilerHost.resolveModuleNames = function (moduleNames, containingFile, _reusedNames, redirectedReference) {
+ return ts.loadWithLocalCache(ts.Debug.assertEachDefined(moduleNames), containingFile, redirectedReference, loader_3);
+ };
+ }
+ cacheState = {
+ originalReadFile: originalReadFile,
+ originalFileExists: originalFileExists,
+ originalDirectoryExists: originalDirectoryExists,
+ originalCreateDirectory: originalCreateDirectory,
+ originalWriteFile: originalWriteFile,
+ originalReadFileWithCache: originalReadFileWithCache,
+ originalGetSourceFile: originalGetSourceFile,
+ originalResolveModuleNames: originalResolveModuleNames
+ };
+ }
+ function disableCache() {
+ if (!cacheState)
+ return;
+ host.readFile = cacheState.originalReadFile;
+ host.fileExists = cacheState.originalFileExists;
+ host.directoryExists = cacheState.originalDirectoryExists;
+ host.createDirectory = cacheState.originalCreateDirectory;
+ host.writeFile = cacheState.originalWriteFile;
+ compilerHost.getSourceFile = cacheState.originalGetSourceFile;
+ readFileWithCache = cacheState.originalReadFileWithCache;
+ compilerHost.resolveModuleNames = cacheState.originalResolveModuleNames;
+ extendedConfigCache.clear();
+ if (moduleResolutionCache) {
+ moduleResolutionCache.directoryToModuleNameMap.clear();
+ moduleResolutionCache.moduleNameToDirectoryMap.clear();
+ }
+ cacheState = undefined;
+ }
+ function buildAllProjects() {
+ if (options.watch) {
+ reportWatchStatus(ts.Diagnostics.Starting_compilation_in_watch_mode);
+ }
+ enableCache();
var graph = getGlobalDependencyGraph();
reportBuildQueue(graph);
var anyFailed = false;
- for (var _i = 0, _b = graph.buildQueue; _i < _b.length; _i++) {
- var next = _b[_i];
+ for (var _i = 0, _a = graph.buildQueue; _i < _a.length; _i++) {
+ var next = _a[_i];
var proj = parseConfigFile(next);
if (proj === undefined) {
reportParseConfigFileDiagnostic(next);
@@ -77767,13 +78644,7 @@
anyFailed = anyFailed || !!(buildResult & BuildResultFlags.AnyErrors);
}
reportErrorSummary();
- host.readFile = originalReadFile;
- host.fileExists = originalFileExists;
- host.directoryExists = originalDirectoryExists;
- host.createDirectory = originalCreateDirectory;
- host.writeFile = originalWriteFile;
- compilerHost.getSourceFile = savedGetSourceFile;
- readFileWithCache = savedReadFileWithCache;
+ disableCache();
return anyFailed ? ts.ExitStatus.DiagnosticsPresent_OutputsSkipped : ts.ExitStatus.Success;
}
function needsBuild(status, configFile) {
@@ -77854,133 +78725,6 @@
})(ts || (ts = {}));
var ts;
(function (ts) {
- function inspectModule(fileNameToRequire) {
- return inspectValue(ts.removeFileExtension(ts.getBaseFileName(fileNameToRequire)), tryRequire(fileNameToRequire));
- }
- ts.inspectModule = inspectModule;
- function inspectValue(name, value) {
- return getValueInfo(name, value, getRecurser());
- }
- ts.inspectValue = inspectValue;
- function getRecurser() {
- var seen = [];
- var nameStack = [];
- return function (obj, name, cbOk, cbFail) {
- if (seen.indexOf(obj) !== -1 || nameStack.length > 4) {
- return cbFail(seen.indexOf(obj) !== -1, nameStack);
- }
- seen.push(obj);
- nameStack.push(name);
- var res = cbOk();
- nameStack.pop();
- seen.pop();
- return res;
- };
- }
- function getValueInfo(name, value, recurser) {
- return recurser(value, name, function () {
- if (typeof value === "function")
- return getFunctionOrClassInfo(value, name, recurser);
- if (typeof value === "object") {
- var builtin = getBuiltinType(name, value, recurser);
- if (builtin !== undefined)
- return builtin;
- var entries = getEntriesOfObject(value);
- var hasNontrivialPrototype = Object.getPrototypeOf(value) !== Object.prototype;
- var members = ts.flatMap(entries, function (_a) {
- var key = _a.key, value = _a.value;
- return getValueInfo(key, value, recurser);
- });
- return { kind: 3, name: name, hasNontrivialPrototype: hasNontrivialPrototype, members: members };
- }
- return { kind: 0, name: name, typeName: isNullOrUndefined(value) ? "any" : typeof value };
- }, function (isCircularReference, keyStack) { return anyValue(name, " " + (isCircularReference ? "Circular reference" : "Too-deep object hierarchy") + " from " + keyStack.join(".")); });
- }
- function getFunctionOrClassInfo(fn, name, recurser) {
- var prototypeMembers = getPrototypeMembers(fn, recurser);
- var namespaceMembers = ts.flatMap(getEntriesOfObject(fn), function (_a) {
- var key = _a.key, value = _a.value;
- return getValueInfo(key, value, recurser);
- });
- var toString = ts.cast(Function.prototype.toString.call(fn), ts.isString);
- var source = ts.stringContains(toString, "{ [native code] }") ? getFunctionLength(fn) : toString;
- return { kind: 2, name: name, source: source, namespaceMembers: namespaceMembers, prototypeMembers: prototypeMembers };
- }
- var builtins = ts.memoize(function () {
- var map = ts.createMap();
- for (var _i = 0, _a = getEntriesOfObject(global); _i < _a.length; _i++) {
- var _b = _a[_i], key = _b.key, value = _b.value;
- if (typeof value === "function" && typeof value.prototype === "object" && value !== Object) {
- map.set(key, value);
- }
- }
- return map;
- });
- function getBuiltinType(name, value, recurser) {
- return ts.isArray(value)
- ? { name: name, kind: 1, inner: value.length && getValueInfo("element", ts.first(value), recurser) || anyValue(name) }
- : ts.forEachEntry(builtins(), function (builtin, builtinName) {
- return value instanceof builtin ? { kind: 0, name: name, typeName: builtinName } : undefined;
- });
- }
- function getPrototypeMembers(fn, recurser) {
- var prototype = fn.prototype;
- return typeof prototype !== "object" || prototype === null ? ts.emptyArray : ts.mapDefined(getEntriesOfObject(prototype), function (_a) {
- var key = _a.key, value = _a.value;
- return key === "constructor" ? undefined : getValueInfo(key, value, recurser);
- });
- }
- var ignoredProperties = ["arguments", "caller", "constructor", "eval", "super_"];
- var reservedFunctionProperties = Object.getOwnPropertyNames(ts.noop);
- function getEntriesOfObject(obj) {
- var seen = ts.createMap();
- var entries = [];
- var chain = obj;
- while (!isNullOrUndefined(chain) && chain !== Object.prototype && chain !== Function.prototype) {
- for (var _i = 0, _a = Object.getOwnPropertyNames(chain); _i < _a.length; _i++) {
- var key = _a[_i];
- if (!isJsPrivate(key) &&
- ignoredProperties.indexOf(key) === -1 &&
- (typeof obj !== "function" || reservedFunctionProperties.indexOf(key) === -1) &&
- ts.addToSeen(seen, key)) {
- var value = safeGetPropertyOfObject(chain, key);
- if (!(key === "toString" && typeof value === "function" && value.length === 0)) {
- entries.push({ key: key, value: value });
- }
- }
- }
- chain = Object.getPrototypeOf(chain);
- }
- return entries.sort(function (e1, e2) { return ts.compareStringsCaseSensitive(e1.key, e2.key); });
- }
- function getFunctionLength(fn) {
- return ts.tryCast(safeGetPropertyOfObject(fn, "length"), ts.isNumber) || 0;
- }
- function safeGetPropertyOfObject(obj, key) {
- var desc = Object.getOwnPropertyDescriptor(obj, key);
- return desc && desc.value;
- }
- function isNullOrUndefined(value) {
- return value == null;
- }
- function anyValue(name, comment) {
- return { kind: 0, name: name, typeName: "any", comment: comment };
- }
- function isJsPrivate(name) {
- return ts.startsWith(name, "_");
- }
- ts.isJsPrivate = isJsPrivate;
- function tryRequire(fileNameToRequire) {
- try {
- return require(fileNameToRequire);
- }
- catch (_a) {
- return undefined;
- }
- }
-})(ts || (ts = {}));
-var ts;
-(function (ts) {
function countLines(program) {
var count = 0;
ts.forEach(program.getSourceFiles(), function (file) {
@@ -78123,6 +78867,9 @@
reportWatchModeWithoutSysSupport();
createWatchOfFilesAndCompilerOptions(commandLine.fileNames, commandLineOptions);
}
+ else if (ts.isIncrementalCompilation(commandLineOptions)) {
+ performIncrementalCompilation(commandLine);
+ }
else {
performCompilation(commandLine.fileNames, /*references*/ undefined, commandLineOptions);
}
@@ -78269,6 +79016,10 @@
var checkTime = ts.performance.getDuration("Check");
var emitTime = ts.performance.getDuration("Emit");
if (compilerOptions.extendedDiagnostics) {
+ var caches = program.getRelationCacheSizes();
+ reportCountStatistic("Assignability cache size", caches.assignable);
+ reportCountStatistic("Identity cache size", caches.identity);
+ reportCountStatistic("Subtype cache size", caches.subtype);
ts.performance.forEachMeasure(function (name, duration) { return reportTimeStatistic(name + " time", duration); });
}
else {

lib/tsserver.js

@@ -75,17 +75,19 @@
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
+ }
return t;
};
var ts;
(function (ts) {
// WARNING: The script `configureNightly.ts` uses a regexp to parse out these values.
// If changing the text in this section, be sure to test `configureNightly` too.
- ts.versionMajorMinor = "3.4";
+ ts.versionMajorMinor = "3.5";
/** The version of the TypeScript compiler release */
- ts.version = ts.versionMajorMinor + ".5";
+ ts.version = ts.versionMajorMinor + ".1";
})(ts || (ts = {}));
(function (ts) {
/* @internal */
@@ -215,7 +217,7 @@
entry.nextEntry.previousEntry = previousEntry;
}
// When the deleted entry was the last one, we need to
- // adust the lastEntry reference.
+ // adjust the lastEntry reference.
if (this.lastEntry === entry) {
this.lastEntry = previousEntry;
}
@@ -325,7 +327,7 @@
ts.firstDefinedIterator = firstDefinedIterator;
function zipWith(arrayA, arrayB, callback) {
var result = [];
- Debug.assertEqual(arrayA.length, arrayB.length);
+ ts.Debug.assertEqual(arrayA.length, arrayB.length);
for (var i = 0; i < arrayA.length; i++) {
result.push(callback(arrayA[i], arrayB[i], i));
}
@@ -333,7 +335,7 @@
}
ts.zipWith = zipWith;
function zipToIterator(arrayA, arrayB) {
- Debug.assertEqual(arrayA.length, arrayB.length);
+ ts.Debug.assertEqual(arrayA.length, arrayB.length);
var i = 0;
return {
next: function () {
@@ -347,7 +349,7 @@
}
ts.zipToIterator = zipToIterator;
function zipToMap(keys, values) {
- Debug.assert(keys.length === values.length);
+ ts.Debug.assert(keys.length === values.length);
var map = createMap();
for (var i = 0; i < keys.length; ++i) {
map.set(keys[i], values[i]);
@@ -421,7 +423,7 @@
return result;
}
}
- return Debug.fail();
+ return ts.Debug.fail();
}
ts.findMap = findMap;
function contains(array, value, equalityComparer) {
@@ -851,7 +853,7 @@
continue;
case -1 /* LessThan */:
// If `array` is sorted, `next` should **never** be less than `last`.
- return Debug.fail("Array is unsorted.");
+ return ts.Debug.fail("Array is unsorted.");
}
deduplicated.push(last = next);
}
@@ -918,13 +920,13 @@
loopB: for (var offsetA = 0, offsetB = 0; offsetB < arrayB.length; offsetB++) {
if (offsetB > 0) {
// Ensure `arrayB` is properly sorted.
- Debug.assertGreaterThanOrEqual(comparer(arrayB[offsetB], arrayB[offsetB - 1]), 0 /* EqualTo */);
+ ts.Debug.assertGreaterThanOrEqual(comparer(arrayB[offsetB], arrayB[offsetB - 1]), 0 /* EqualTo */);
}
loopA: for (var startA = offsetA; offsetA < arrayA.length; offsetA++) {
if (offsetA > startA) {
// Ensure `arrayA` is properly sorted. We only need to perform this check if
// `offsetA` has changed since we entered the loop.
- Debug.assertGreaterThanOrEqual(comparer(arrayA[offsetA], arrayA[offsetA - 1]), 0 /* EqualTo */);
+ ts.Debug.assertGreaterThanOrEqual(comparer(arrayA[offsetA], arrayA[offsetA - 1]), 0 /* EqualTo */);
}
switch (comparer(arrayB[offsetB], arrayA[offsetA])) {
case -1 /* LessThan */:
@@ -1094,7 +1096,7 @@
}
ts.firstOrUndefined = firstOrUndefined;
function first(array) {
- Debug.assert(array.length !== 0);
+ ts.Debug.assert(array.length !== 0);
return array[0];
}
ts.first = first;
@@ -1106,7 +1108,7 @@
}
ts.lastOrUndefined = lastOrUndefined;
function last(array) {
- Debug.assert(array.length !== 0);
+ ts.Debug.assert(array.length !== 0);
return array[array.length - 1];
}
ts.last = last;
@@ -1431,7 +1433,7 @@
function cast(value, test) {
if (value !== undefined && test(value))
return value;
- return Debug.fail("Invalid cast. The supplied value " + value + " did not pass the test '" + Debug.getFunctionName(test) + "'.");
+ return ts.Debug.fail("Invalid cast. The supplied value " + value + " did not pass the test '" + ts.Debug.getFunctionName(test) + "'.");
}
ts.cast = cast;
/** Does nothing. */
@@ -1468,38 +1470,13 @@
};
}
ts.memoize = memoize;
- function chain(a, b, c, d, e) {
+ function compose(a, b, c, d, e) {
if (e) {
var args_2 = [];
for (var i = 0; i < arguments.length; i++) {
args_2[i] = arguments[i];
}
- return function (t) { return compose.apply(void 0, map(args_2, function (f) { return f(t); })); };
- }
- else if (d) {
- return function (t) { return compose(a(t), b(t), c(t), d(t)); };
- }
- else if (c) {
- return function (t) { return compose(a(t), b(t), c(t)); };
- }
- else if (b) {
- return function (t) { return compose(a(t), b(t)); };
- }
- else if (a) {
- return function (t) { return compose(a(t)); };
- }
- else {
- return function (_) { return function (u) { return u; }; };
- }
- }
- ts.chain = chain;
- function compose(a, b, c, d, e) {
- if (e) {
- var args_3 = [];
- for (var i = 0; i < arguments.length; i++) {
- args_3[i] = arguments[i];
- }
- return function (t) { return reduceLeft(args_3, function (u, f) { return f(u); }, t); };
+ return function (t) { return reduceLeft(args_2, function (u, f) { return f(u); }, t); };
}
else if (d) {
return function (t) { return d(c(b(a(t)))); };
@@ -1525,92 +1502,6 @@
AssertionLevel[AssertionLevel["Aggressive"] = 2] = "Aggressive";
AssertionLevel[AssertionLevel["VeryAggressive"] = 3] = "VeryAggressive";
})(AssertionLevel = ts.AssertionLevel || (ts.AssertionLevel = {}));
- var Debug;
- (function (Debug) {
- Debug.currentAssertionLevel = 0 /* None */;
- Debug.isDebugging = false;
- function shouldAssert(level) {
- return Debug.currentAssertionLevel >= level;
- }
- Debug.shouldAssert = shouldAssert;
- function assert(expression, message, verboseDebugInfo, stackCrawlMark) {
- if (!expression) {
- if (verboseDebugInfo) {
- message += "\r\nVerbose Debug Information: " + (typeof verboseDebugInfo === "string" ? verboseDebugInfo : verboseDebugInfo());
- }
- fail(message ? "False expression: " + message : "False expression.", stackCrawlMark || assert);
- }
- }
- Debug.assert = assert;
- function assertEqual(a, b, msg, msg2) {
- if (a !== b) {
- var message = msg ? msg2 ? msg + " " + msg2 : msg : "";
- fail("Expected " + a + " === " + b + ". " + message);
- }
- }
- Debug.assertEqual = assertEqual;
- function assertLessThan(a, b, msg) {
- if (a >= b) {
- fail("Expected " + a + " < " + b + ". " + (msg || ""));
- }
- }
- Debug.assertLessThan = assertLessThan;
- function assertLessThanOrEqual(a, b) {
- if (a > b) {
- fail("Expected " + a + " <= " + b);
- }
- }
- Debug.assertLessThanOrEqual = assertLessThanOrEqual;
- function assertGreaterThanOrEqual(a, b) {
- if (a < b) {
- fail("Expected " + a + " >= " + b);
- }
- }
- Debug.assertGreaterThanOrEqual = assertGreaterThanOrEqual;
- function fail(message, stackCrawlMark) {
- debugger;
- var e = new Error(message ? "Debug Failure. " + message : "Debug Failure.");
- if (Error.captureStackTrace) {
- Error.captureStackTrace(e, stackCrawlMark || fail);
- }
- throw e;
- }
- Debug.fail = fail;
- function assertDefined(value, message) {
- if (value === undefined || value === null)
- return fail(message);
- return value;
- }
- Debug.assertDefined = assertDefined;
- function assertEachDefined(value, message) {
- for (var _i = 0, value_1 = value; _i < value_1.length; _i++) {
- var v = value_1[_i];
- assertDefined(v, message);
- }
- return value;
- }
- Debug.assertEachDefined = assertEachDefined;
- function assertNever(member, message, stackCrawlMark) {
- if (message === void 0) { message = "Illegal value:"; }
- var detail = typeof member === "object" && "kind" in member && "pos" in member ? "SyntaxKind: " + Debug.showSyntaxKind(member) : JSON.stringify(member);
- return fail(message + " " + detail, stackCrawlMark || assertNever);
- }
- Debug.assertNever = assertNever;
- function getFunctionName(func) {
- if (typeof func !== "function") {
- return "";
- }
- else if (func.hasOwnProperty("name")) {
- return func.name;
- }
- else {
- var text = Function.prototype.toString.call(func);
- var match = /^function\s+([\w\$]+)\s*\(/.exec(text);
- return match ? match[1] : "";
- }
- }
- Debug.getFunctionName = getFunctionName;
- })(Debug = ts.Debug || (ts.Debug = {}));
function equateValues(a, b) {
return a === b;
}
@@ -1867,7 +1758,7 @@
bestCandidate = candidate;
}
else {
- Debug.assert(distance < bestDistance); // Else `levenshteinWithMax` should return undefined
+ ts.Debug.assert(distance < bestDistance); // Else `levenshteinWithMax` should return undefined
bestDistance = distance;
bestCandidate = candidate;
}
@@ -2011,7 +1902,7 @@
* E.g.: matchedText(tryParsePattern("foo*baz"), "foobarbaz") === "bar"
*/
function matchedText(pattern, candidate) {
- Debug.assert(isPatternMatch(pattern, candidate));
+ ts.Debug.assert(isPatternMatch(pattern, candidate));
return candidate.substring(pattern.prefix.length, candidate.length - pattern.suffix.length);
}
ts.matchedText = matchedText;
@@ -2104,6 +1995,267 @@
return result;
}
ts.fill = fill;
+ function cartesianProduct(arrays) {
+ var result = [];
+ cartesianProductWorker(arrays, result, /*outer*/ undefined, 0);
+ return result;
+ }
+ ts.cartesianProduct = cartesianProduct;
+ function cartesianProductWorker(arrays, result, outer, index) {
+ for (var _i = 0, _a = arrays[index]; _i < _a.length; _i++) {
+ var element = _a[_i];
+ var inner = void 0;
+ if (outer) {
+ inner = outer.slice();
+ inner.push(element);
+ }
+ else {
+ inner = [element];
+ }
+ if (index === arrays.length - 1) {
+ result.push(inner);
+ }
+ else {
+ cartesianProductWorker(arrays, result, inner, index + 1);
+ }
+ }
+ }
+})(ts || (ts = {}));
+/* @internal */
+var ts;
+(function (ts) {
+ var Debug;
+ (function (Debug) {
+ Debug.currentAssertionLevel = 0 /* None */;
+ Debug.isDebugging = false;
+ function shouldAssert(level) {
+ return Debug.currentAssertionLevel >= level;
+ }
+ Debug.shouldAssert = shouldAssert;
+ function assert(expression, message, verboseDebugInfo, stackCrawlMark) {
+ if (!expression) {
+ if (verboseDebugInfo) {
+ message += "\r\nVerbose Debug Information: " + (typeof verboseDebugInfo === "string" ? verboseDebugInfo : verboseDebugInfo());
+ }
+ fail(message ? "False expression: " + message : "False expression.", stackCrawlMark || assert);
+ }
+ }
+ Debug.assert = assert;
+ function assertEqual(a, b, msg, msg2) {
+ if (a !== b) {
+ var message = msg ? msg2 ? msg + " " + msg2 : msg : "";
+ fail("Expected " + a + " === " + b + ". " + message);
+ }
+ }
+ Debug.assertEqual = assertEqual;
+ function assertLessThan(a, b, msg) {
+ if (a >= b) {
+ fail("Expected " + a + " < " + b + ". " + (msg || ""));
+ }
+ }
+ Debug.assertLessThan = assertLessThan;
+ function assertLessThanOrEqual(a, b) {
+ if (a > b) {
+ fail("Expected " + a + " <= " + b);
+ }
+ }
+ Debug.assertLessThanOrEqual = assertLessThanOrEqual;
+ function assertGreaterThanOrEqual(a, b) {
+ if (a < b) {
+ fail("Expected " + a + " >= " + b);
+ }
+ }
+ Debug.assertGreaterThanOrEqual = assertGreaterThanOrEqual;
+ function fail(message, stackCrawlMark) {
+ debugger;
+ var e = new Error(message ? "Debug Failure. " + message : "Debug Failure.");
+ if (Error.captureStackTrace) {
+ Error.captureStackTrace(e, stackCrawlMark || fail);
+ }
+ throw e;
+ }
+ Debug.fail = fail;
+ function assertDefined(value, message) {
+ if (value === undefined || value === null)
+ return fail(message);
+ return value;
+ }
+ Debug.assertDefined = assertDefined;
+ function assertEachDefined(value, message) {
+ for (var _i = 0, value_1 = value; _i < value_1.length; _i++) {
+ var v = value_1[_i];
+ assertDefined(v, message);
+ }
+ return value;
+ }
+ Debug.assertEachDefined = assertEachDefined;
+ function assertNever(member, message, stackCrawlMark) {
+ if (message === void 0) { message = "Illegal value:"; }
+ var detail = typeof member === "object" && "kind" in member && "pos" in member && formatSyntaxKind ? "SyntaxKind: " + formatSyntaxKind(member.kind) : JSON.stringify(member);
+ return fail(message + " " + detail, stackCrawlMark || assertNever);
+ }
+ Debug.assertNever = assertNever;
+ function getFunctionName(func) {
+ if (typeof func !== "function") {
+ return "";
+ }
+ else if (func.hasOwnProperty("name")) {
+ return func.name;
+ }
+ else {
+ var text = Function.prototype.toString.call(func);
+ var match = /^function\s+([\w\$]+)\s*\(/.exec(text);
+ return match ? match[1] : "";
+ }
+ }
+ Debug.getFunctionName = getFunctionName;
+ function formatSymbol(symbol) {
+ return "{ name: " + ts.unescapeLeadingUnderscores(symbol.escapedName) + "; flags: " + formatSymbolFlags(symbol.flags) + "; declarations: " + ts.map(symbol.declarations, function (node) { return formatSyntaxKind(node.kind); }) + " }";
+ }
+ Debug.formatSymbol = formatSymbol;
+ /**
+ * Formats an enum value as a string for debugging and debug assertions.
+ */
+ function formatEnum(value, enumObject, isFlags) {
+ if (value === void 0) { value = 0; }
+ var members = getEnumMembers(enumObject);
+ if (value === 0) {
+ return members.length > 0 && members[0][0] === 0 ? members[0][1] : "0";
+ }
+ if (isFlags) {
+ var result = "";
+ var remainingFlags = value;
+ for (var i = members.length - 1; i >= 0 && remainingFlags !== 0; i--) {
+ var _a = members[i], enumValue = _a[0], enumName = _a[1];
+ if (enumValue !== 0 && (remainingFlags & enumValue) === enumValue) {
+ remainingFlags &= ~enumValue;
+ result = "" + enumName + (result ? "|" : "") + result;
+ }
+ }
+ if (remainingFlags === 0) {
+ return result;
+ }
+ }
+ else {
+ for (var _i = 0, members_1 = members; _i < members_1.length; _i++) {
+ var _b = members_1[_i], enumValue = _b[0], enumName = _b[1];
+ if (enumValue === value) {
+ return enumName;
+ }
+ }
+ }
+ return value.toString();
+ }
+ Debug.formatEnum = formatEnum;
+ function getEnumMembers(enumObject) {
+ var result = [];
+ for (var name in enumObject) {
+ var value = enumObject[name];
+ if (typeof value === "number") {
+ result.push([value, name]);
+ }
+ }
+ return ts.stableSort(result, function (x, y) { return ts.compareValues(x[0], y[0]); });
+ }
+ function formatSyntaxKind(kind) {
+ return formatEnum(kind, ts.SyntaxKind, /*isFlags*/ false);
+ }
+ Debug.formatSyntaxKind = formatSyntaxKind;
+ function formatNodeFlags(flags) {
+ return formatEnum(flags, ts.NodeFlags, /*isFlags*/ true);
+ }
+ Debug.formatNodeFlags = formatNodeFlags;
+ function formatModifierFlags(flags) {
+ return formatEnum(flags, ts.ModifierFlags, /*isFlags*/ true);
+ }
+ Debug.formatModifierFlags = formatModifierFlags;
+ function formatTransformFlags(flags) {
+ return formatEnum(flags, ts.TransformFlags, /*isFlags*/ true);
+ }
+ Debug.formatTransformFlags = formatTransformFlags;
+ function formatEmitFlags(flags) {
+ return formatEnum(flags, ts.EmitFlags, /*isFlags*/ true);
+ }
+ Debug.formatEmitFlags = formatEmitFlags;
+ function formatSymbolFlags(flags) {
+ return formatEnum(flags, ts.SymbolFlags, /*isFlags*/ true);
+ }
+ Debug.formatSymbolFlags = formatSymbolFlags;
+ function formatTypeFlags(flags) {
+ return formatEnum(flags, ts.TypeFlags, /*isFlags*/ true);
+ }
+ Debug.formatTypeFlags = formatTypeFlags;
+ function formatObjectFlags(flags) {
+ return formatEnum(flags, ts.ObjectFlags, /*isFlags*/ true);
+ }
+ Debug.formatObjectFlags = formatObjectFlags;
+ function failBadSyntaxKind(node, message) {
+ return fail((message || "Unexpected node.") + "\r\nNode " + formatSyntaxKind(node.kind) + " was unexpected.", failBadSyntaxKind);
+ }
+ Debug.failBadSyntaxKind = failBadSyntaxKind;
+ Debug.assertEachNode = shouldAssert(1 /* Normal */)
+ ? function (nodes, test, message) { return assert(test === undefined || ts.every(nodes, test), message || "Unexpected node.", function () { return "Node array did not pass test '" + getFunctionName(test) + "'."; }, Debug.assertEachNode); }
+ : ts.noop;
+ Debug.assertNode = shouldAssert(1 /* Normal */)
+ ? function (node, test, message) { return assert(test === undefined || test(node), message || "Unexpected node.", function () { return "Node " + formatSyntaxKind(node.kind) + " did not pass test '" + getFunctionName(test) + "'."; }, Debug.assertNode); }
+ : ts.noop;
+ Debug.assertOptionalNode = shouldAssert(1 /* Normal */)
+ ? function (node, test, message) { return assert(test === undefined || node === undefined || test(node), message || "Unexpected node.", function () { return "Node " + formatSyntaxKind(node.kind) + " did not pass test '" + getFunctionName(test) + "'."; }, Debug.assertOptionalNode); }
+ : ts.noop;
+ Debug.assertOptionalToken = shouldAssert(1 /* Normal */)
+ ? function (node, kind, message) { return assert(kind === undefined || node === undefined || node.kind === kind, message || "Unexpected node.", function () { return "Node " + formatSyntaxKind(node.kind) + " was not a '" + formatSyntaxKind(kind) + "' token."; }, Debug.assertOptionalToken); }
+ : ts.noop;
+ Debug.assertMissingNode = shouldAssert(1 /* Normal */)
+ ? function (node, message) { return assert(node === undefined, message || "Unexpected node.", function () { return "Node " + formatSyntaxKind(node.kind) + " was unexpected'."; }, Debug.assertMissingNode); }
+ : ts.noop;
+ var isDebugInfoEnabled = false;
+ /**
+ * Injects debug information into frequently used types.
+ */
+ function enableDebugInfo() {
+ if (isDebugInfoEnabled)
+ return;
+ // Add additional properties in debug mode to assist with debugging.
+ Object.defineProperties(ts.objectAllocator.getSymbolConstructor().prototype, {
+ __debugFlags: { get: function () { return formatSymbolFlags(this.flags); } }
+ });
+ Object.defineProperties(ts.objectAllocator.getTypeConstructor().prototype, {
+ __debugFlags: { get: function () { return formatTypeFlags(this.flags); } },
+ __debugObjectFlags: { get: function () { return this.flags & 524288 /* Object */ ? formatObjectFlags(this.objectFlags) : ""; } },
+ __debugTypeToString: { value: function () { return this.checker.typeToString(this); } },
+ });
+ var nodeConstructors = [
+ ts.objectAllocator.getNodeConstructor(),
+ ts.objectAllocator.getIdentifierConstructor(),
+ ts.objectAllocator.getTokenConstructor(),
+ ts.objectAllocator.getSourceFileConstructor()
+ ];
+ for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) {
+ var ctor = nodeConstructors_1[_i];
+ if (!ctor.prototype.hasOwnProperty("__debugKind")) {
+ Object.defineProperties(ctor.prototype, {
+ __debugKind: { get: function () { return formatSyntaxKind(this.kind); } },
+ __debugNodeFlags: { get: function () { return formatNodeFlags(this.flags); } },
+ __debugModifierFlags: { get: function () { return formatModifierFlags(ts.getModifierFlagsNoCache(this)); } },
+ __debugTransformFlags: { get: function () { return formatTransformFlags(this.transformFlags); } },
+ __debugIsParseTreeNode: { get: function () { return ts.isParseTreeNode(this); } },
+ __debugEmitFlags: { get: function () { return formatEmitFlags(ts.getEmitFlags(this)); } },
+ __debugGetText: {
+ value: function (includeTrivia) {
+ if (ts.nodeIsSynthesized(this))
+ return "";
+ var parseNode = ts.getParseTreeNode(this);
+ var sourceFile = parseNode && ts.getSourceFileOfNode(parseNode);
+ return sourceFile ? ts.getSourceTextOfNodeFromSourceFile(sourceFile, parseNode, includeTrivia) : "";
+ }
+ }
+ });
+ }
+ }
+ isDebugInfoEnabled = true;
+ }
+ Debug.enableDebugInfo = enableDebugInfo;
+ })(Debug = ts.Debug || (ts.Debug = {}));
})(ts || (ts = {}));
/*@internal*/
var ts;
@@ -2656,309 +2808,311 @@
SyntaxKind[SyntaxKind["QuestionToken"] = 56] = "QuestionToken";
SyntaxKind[SyntaxKind["ColonToken"] = 57] = "ColonToken";
SyntaxKind[SyntaxKind["AtToken"] = 58] = "AtToken";
+ /** Only the JSDoc scanner produces BacktickToken. The normal scanner produces NoSubstitutionTemplateLiteral and related kinds. */
+ SyntaxKind[SyntaxKind["BacktickToken"] = 59] = "BacktickToken";
// Assignments
- SyntaxKind[SyntaxKind["EqualsToken"] = 59] = "EqualsToken";
- SyntaxKind[SyntaxKind["PlusEqualsToken"] = 60] = "PlusEqualsToken";
- SyntaxKind[SyntaxKind["MinusEqualsToken"] = 61] = "MinusEqualsToken";
- SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 62] = "AsteriskEqualsToken";
- SyntaxKind[SyntaxKind["AsteriskAsteriskEqualsToken"] = 63] = "AsteriskAsteriskEqualsToken";
- SyntaxKind[SyntaxKind["SlashEqualsToken"] = 64] = "SlashEqualsToken";
- SyntaxKind[SyntaxKind["PercentEqualsToken"] = 65] = "PercentEqualsToken";
- SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 66] = "LessThanLessThanEqualsToken";
- SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 67] = "GreaterThanGreaterThanEqualsToken";
- SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 68] = "GreaterThanGreaterThanGreaterThanEqualsToken";
- SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 69] = "AmpersandEqualsToken";
- SyntaxKind[SyntaxKind["BarEqualsToken"] = 70] = "BarEqualsToken";
- SyntaxKind[SyntaxKind["CaretEqualsToken"] = 71] = "CaretEqualsToken";
+ SyntaxKind[SyntaxKind["EqualsToken"] = 60] = "EqualsToken";
+ SyntaxKind[SyntaxKind["PlusEqualsToken"] = 61] = "PlusEqualsToken";
+ SyntaxKind[SyntaxKind["MinusEqualsToken"] = 62] = "MinusEqualsToken";
+ SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 63] = "AsteriskEqualsToken";
+ SyntaxKind[SyntaxKind["AsteriskAsteriskEqualsToken"] = 64] = "AsteriskAsteriskEqualsToken";
+ SyntaxKind[SyntaxKind["SlashEqualsToken"] = 65] = "SlashEqualsToken";
+ SyntaxKind[SyntaxKind["PercentEqualsToken"] = 66] = "PercentEqualsToken";
+ SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 67] = "LessThanLessThanEqualsToken";
+ SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 68] = "GreaterThanGreaterThanEqualsToken";
+ SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 69] = "GreaterThanGreaterThanGreaterThanEqualsToken";
+ SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 70] = "AmpersandEqualsToken";
+ SyntaxKind[SyntaxKind["BarEqualsToken"] = 71] = "BarEqualsToken";
+ SyntaxKind[SyntaxKind["CaretEqualsToken"] = 72] = "CaretEqualsToken";
// Identifiers
- SyntaxKind[SyntaxKind["Identifier"] = 72] = "Identifier";
+ SyntaxKind[SyntaxKind["Identifier"] = 73] = "Identifier";
// Reserved words
- SyntaxKind[SyntaxKind["BreakKeyword"] = 73] = "BreakKeyword";
- SyntaxKind[SyntaxKind["CaseKeyword"] = 74] = "CaseKeyword";
- SyntaxKind[SyntaxKind["CatchKeyword"] = 75] = "CatchKeyword";
- SyntaxKind[SyntaxKind["ClassKeyword"] = 76] = "ClassKeyword";
- SyntaxKind[SyntaxKind["ConstKeyword"] = 77] = "ConstKeyword";
- SyntaxKind[SyntaxKind["ContinueKeyword"] = 78] = "ContinueKeyword";
- SyntaxKind[SyntaxKind["DebuggerKeyword"] = 79] = "DebuggerKeyword";
- SyntaxKind[SyntaxKind["DefaultKeyword"] = 80] = "DefaultKeyword";
- SyntaxKind[SyntaxKind["DeleteKeyword"] = 81] = "DeleteKeyword";
- SyntaxKind[SyntaxKind["DoKeyword"] = 82] = "DoKeyword";
- SyntaxKind[SyntaxKind["ElseKeyword"] = 83] = "ElseKeyword";
- SyntaxKind[SyntaxKind["EnumKeyword"] = 84] = "EnumKeyword";
- SyntaxKind[SyntaxKind["ExportKeyword"] = 85] = "ExportKeyword";
- SyntaxKind[SyntaxKind["ExtendsKeyword"] = 86] = "ExtendsKeyword";
- SyntaxKind[SyntaxKind["FalseKeyword"] = 87] = "FalseKeyword";
- SyntaxKind[SyntaxKind["FinallyKeyword"] = 88] = "FinallyKeyword";
- SyntaxKind[SyntaxKind["ForKeyword"] = 89] = "ForKeyword";
- SyntaxKind[SyntaxKind["FunctionKeyword"] = 90] = "FunctionKeyword";
- SyntaxKind[SyntaxKind["IfKeyword"] = 91] = "IfKeyword";
- SyntaxKind[SyntaxKind["ImportKeyword"] = 92] = "ImportKeyword";
- SyntaxKind[SyntaxKind["InKeyword"] = 93] = "InKeyword";
- SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 94] = "InstanceOfKeyword";
- SyntaxKind[SyntaxKind["NewKeyword"] = 95] = "NewKeyword";
- SyntaxKind[SyntaxKind["NullKeyword"] = 96] = "NullKeyword";
- SyntaxKind[SyntaxKind["ReturnKeyword"] = 97] = "ReturnKeyword";
- SyntaxKind[SyntaxKind["SuperKeyword"] = 98] = "SuperKeyword";
- SyntaxKind[SyntaxKind["SwitchKeyword"] = 99] = "SwitchKeyword";
- SyntaxKind[SyntaxKind["ThisKeyword"] = 100] = "ThisKeyword";
- SyntaxKind[SyntaxKind["ThrowKeyword"] = 101] = "ThrowKeyword";
- SyntaxKind[SyntaxKind["TrueKeyword"] = 102] = "TrueKeyword";
- SyntaxKind[SyntaxKind["TryKeyword"] = 103] = "TryKeyword";
- SyntaxKind[SyntaxKind["TypeOfKeyword"] = 104] = "TypeOfKeyword";
- SyntaxKind[SyntaxKind["VarKeyword"] = 105] = "VarKeyword";
- SyntaxKind[SyntaxKind["VoidKeyword"] = 106] = "VoidKeyword";
- SyntaxKind[SyntaxKind["WhileKeyword"] = 107] = "WhileKeyword";
- SyntaxKind[SyntaxKind["WithKeyword"] = 108] = "WithKeyword";
+ SyntaxKind[SyntaxKind["BreakKeyword"] = 74] = "BreakKeyword";
+ SyntaxKind[SyntaxKind["CaseKeyword"] = 75] = "CaseKeyword";
+ SyntaxKind[SyntaxKind["CatchKeyword"] = 76] = "CatchKeyword";
+ SyntaxKind[SyntaxKind["ClassKeyword"] = 77] = "ClassKeyword";
+ SyntaxKind[SyntaxKind["ConstKeyword"] = 78] = "ConstKeyword";
+ SyntaxKind[SyntaxKind["ContinueKeyword"] = 79] = "ContinueKeyword";
+ SyntaxKind[SyntaxKind["DebuggerKeyword"] = 80] = "DebuggerKeyword";
+ SyntaxKind[SyntaxKind["DefaultKeyword"] = 81] = "DefaultKeyword";
+ SyntaxKind[SyntaxKind["DeleteKeyword"] = 82] = "DeleteKeyword";
+ SyntaxKind[SyntaxKind["DoKeyword"] = 83] = "DoKeyword";
+ SyntaxKind[SyntaxKind["ElseKeyword"] = 84] = "ElseKeyword";
+ SyntaxKind[SyntaxKind["EnumKeyword"] = 85] = "EnumKeyword";
+ SyntaxKind[SyntaxKind["ExportKeyword"] = 86] = "ExportKeyword";
+ SyntaxKind[SyntaxKind["ExtendsKeyword"] = 87] = "ExtendsKeyword";
+ SyntaxKind[SyntaxKind["FalseKeyword"] = 88] = "FalseKeyword";
+ SyntaxKind[SyntaxKind["FinallyKeyword"] = 89] = "FinallyKeyword";
+ SyntaxKind[SyntaxKind["ForKeyword"] = 90] = "ForKeyword";
+ SyntaxKind[SyntaxKind["FunctionKeyword"] = 91] = "FunctionKeyword";
+ SyntaxKind[SyntaxKind["IfKeyword"] = 92] = "IfKeyword";
+ SyntaxKind[SyntaxKind["ImportKeyword"] = 93] = "ImportKeyword";
+ SyntaxKind[SyntaxKind["InKeyword"] = 94] = "InKeyword";
+ SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 95] = "InstanceOfKeyword";
+ SyntaxKind[SyntaxKind["NewKeyword"] = 96] = "NewKeyword";
+ SyntaxKind[SyntaxKind["NullKeyword"] = 97] = "NullKeyword";
+ SyntaxKind[SyntaxKind["ReturnKeyword"] = 98] = "ReturnKeyword";
+ SyntaxKind[SyntaxKind["SuperKeyword"] = 99] = "SuperKeyword";
+ SyntaxKind[SyntaxKind["SwitchKeyword"] = 100] = "SwitchKeyword";
+ SyntaxKind[SyntaxKind["ThisKeyword"] = 101] = "ThisKeyword";
+ SyntaxKind[SyntaxKind["ThrowKeyword"] = 102] = "ThrowKeyword";
+ SyntaxKind[SyntaxKind["TrueKeyword"] = 103] = "TrueKeyword";
+ SyntaxKind[SyntaxKind["TryKeyword"] = 104] = "TryKeyword";
+ SyntaxKind[SyntaxKind["TypeOfKeyword"] = 105] = "TypeOfKeyword";
+ SyntaxKind[SyntaxKind["VarKeyword"] = 106] = "VarKeyword";
+ SyntaxKind[SyntaxKind["VoidKeyword"] = 107] = "VoidKeyword";
+ SyntaxKind[SyntaxKind["WhileKeyword"] = 108] = "WhileKeyword";
+ SyntaxKind[SyntaxKind["WithKeyword"] = 109] = "WithKeyword";
// Strict mode reserved words
- SyntaxKind[SyntaxKind["ImplementsKeyword"] = 109] = "ImplementsKeyword";
- SyntaxKind[SyntaxKind["InterfaceKeyword"] = 110] = "InterfaceKeyword";
- SyntaxKind[SyntaxKind["LetKeyword"] = 111] = "LetKeyword";
- SyntaxKind[SyntaxKind["PackageKeyword"] = 112] = "PackageKeyword";
- SyntaxKind[SyntaxKind["PrivateKeyword"] = 113] = "PrivateKeyword";
- SyntaxKind[SyntaxKind["ProtectedKeyword"] = 114] = "ProtectedKeyword";
- SyntaxKind[SyntaxKind["PublicKeyword"] = 115] = "PublicKeyword";
- SyntaxKind[SyntaxKind["StaticKeyword"] = 116] = "StaticKeyword";
- SyntaxKind[SyntaxKind["YieldKeyword"] = 117] = "YieldKeyword";
+ SyntaxKind[SyntaxKind["ImplementsKeyword"] = 110] = "ImplementsKeyword";
+ SyntaxKind[SyntaxKind["InterfaceKeyword"] = 111] = "InterfaceKeyword";
+ SyntaxKind[SyntaxKind["LetKeyword"] = 112] = "LetKeyword";
+ SyntaxKind[SyntaxKind["PackageKeyword"] = 113] = "PackageKeyword";
+ SyntaxKind[SyntaxKind["PrivateKeyword"] = 114] = "PrivateKeyword";
+ SyntaxKind[SyntaxKind["ProtectedKeyword"] = 115] = "ProtectedKeyword";
+ SyntaxKind[SyntaxKind["PublicKeyword"] = 116] = "PublicKeyword";
+ SyntaxKind[SyntaxKind["StaticKeyword"] = 117] = "StaticKeyword";
+ SyntaxKind[SyntaxKind["YieldKeyword"] = 118] = "YieldKeyword";
// Contextual keywords
- SyntaxKind[SyntaxKind["AbstractKeyword"] = 118] = "AbstractKeyword";
- SyntaxKind[SyntaxKind["AsKeyword"] = 119] = "AsKeyword";
- SyntaxKind[SyntaxKind["AnyKeyword"] = 120] = "AnyKeyword";
- SyntaxKind[SyntaxKind["AsyncKeyword"] = 121] = "AsyncKeyword";
- SyntaxKind[SyntaxKind["AwaitKeyword"] = 122] = "AwaitKeyword";
- SyntaxKind[SyntaxKind["BooleanKeyword"] = 123] = "BooleanKeyword";
- SyntaxKind[SyntaxKind["ConstructorKeyword"] = 124] = "ConstructorKeyword";
- SyntaxKind[SyntaxKind["DeclareKeyword"] = 125] = "DeclareKeyword";
- SyntaxKind[SyntaxKind["GetKeyword"] = 126] = "GetKeyword";
- SyntaxKind[SyntaxKind["InferKeyword"] = 127] = "InferKeyword";
- SyntaxKind[SyntaxKind["IsKeyword"] = 128] = "IsKeyword";
- SyntaxKind[SyntaxKind["KeyOfKeyword"] = 129] = "KeyOfKeyword";
- SyntaxKind[SyntaxKind["ModuleKeyword"] = 130] = "ModuleKeyword";
- SyntaxKind[SyntaxKind["NamespaceKeyword"] = 131] = "NamespaceKeyword";
- SyntaxKind[SyntaxKind["NeverKeyword"] = 132] = "NeverKeyword";
- SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 133] = "ReadonlyKeyword";
- SyntaxKind[SyntaxKind["RequireKeyword"] = 134] = "RequireKeyword";
- SyntaxKind[SyntaxKind["NumberKeyword"] = 135] = "NumberKeyword";
- SyntaxKind[SyntaxKind["ObjectKeyword"] = 136] = "ObjectKeyword";
- SyntaxKind[SyntaxKind["SetKeyword"] = 137] = "SetKeyword";
- SyntaxKind[SyntaxKind["StringKeyword"] = 138] = "StringKeyword";
- SyntaxKind[SyntaxKind["SymbolKeyword"] = 139] = "SymbolKeyword";
- SyntaxKind[SyntaxKind["TypeKeyword"] = 140] = "TypeKeyword";
- SyntaxKind[SyntaxKind["UndefinedKeyword"] = 141] = "UndefinedKeyword";
- SyntaxKind[SyntaxKind["UniqueKeyword"] = 142] = "UniqueKeyword";
- SyntaxKind[SyntaxKind["UnknownKeyword"] = 143] = "UnknownKeyword";
- SyntaxKind[SyntaxKind["FromKeyword"] = 144] = "FromKeyword";
- SyntaxKind[SyntaxKind["GlobalKeyword"] = 145] = "GlobalKeyword";
- SyntaxKind[SyntaxKind["BigIntKeyword"] = 146] = "BigIntKeyword";
- SyntaxKind[SyntaxKind["OfKeyword"] = 147] = "OfKeyword";
+ SyntaxKind[SyntaxKind["AbstractKeyword"] = 119] = "AbstractKeyword";
+ SyntaxKind[SyntaxKind["AsKeyword"] = 120] = "AsKeyword";
+ SyntaxKind[SyntaxKind["AnyKeyword"] = 121] = "AnyKeyword";
+ SyntaxKind[SyntaxKind["AsyncKeyword"] = 122] = "AsyncKeyword";
+ SyntaxKind[SyntaxKind["AwaitKeyword"] = 123] = "AwaitKeyword";
+ SyntaxKind[SyntaxKind["BooleanKeyword"] = 124] = "BooleanKeyword";
+ SyntaxKind[SyntaxKind["ConstructorKeyword"] = 125] = "ConstructorKeyword";
+ SyntaxKind[SyntaxKind["DeclareKeyword"] = 126] = "DeclareKeyword";
+ SyntaxKind[SyntaxKind["GetKeyword"] = 127] = "GetKeyword";
+ SyntaxKind[SyntaxKind["InferKeyword"] = 128] = "InferKeyword";
+ SyntaxKind[SyntaxKind["IsKeyword"] = 129] = "IsKeyword";
+ SyntaxKind[SyntaxKind["KeyOfKeyword"] = 130] = "KeyOfKeyword";
+ SyntaxKind[SyntaxKind["ModuleKeyword"] = 131] = "ModuleKeyword";
+ SyntaxKind[SyntaxKind["NamespaceKeyword"] = 132] = "NamespaceKeyword";
+ SyntaxKind[SyntaxKind["NeverKeyword"] = 133] = "NeverKeyword";
+ SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 134] = "ReadonlyKeyword";
+ SyntaxKind[SyntaxKind["RequireKeyword"] = 135] = "RequireKeyword";
+ SyntaxKind[SyntaxKind["NumberKeyword"] = 136] = "NumberKeyword";
+ SyntaxKind[SyntaxKind["ObjectKeyword"] = 137] = "ObjectKeyword";
+ SyntaxKind[SyntaxKind["SetKeyword"] = 138] = "SetKeyword";
+ SyntaxKind[SyntaxKind["StringKeyword"] = 139] = "StringKeyword";
+ SyntaxKind[SyntaxKind["SymbolKeyword"] = 140] = "SymbolKeyword";
+ SyntaxKind[SyntaxKind["TypeKeyword"] = 141] = "TypeKeyword";
+ SyntaxKind[SyntaxKind["UndefinedKeyword"] = 142] = "UndefinedKeyword";
+ SyntaxKind[SyntaxKind["UniqueKeyword"] = 143] = "UniqueKeyword";
+ SyntaxKind[SyntaxKind["UnknownKeyword"] = 144] = "UnknownKeyword";
+ SyntaxKind[SyntaxKind["FromKeyword"] = 145] = "FromKeyword";
+ SyntaxKind[SyntaxKind["GlobalKeyword"] = 146] = "GlobalKeyword";
+ SyntaxKind[SyntaxKind["BigIntKeyword"] = 147] = "BigIntKeyword";
+ SyntaxKind[SyntaxKind["OfKeyword"] = 148] = "OfKeyword";
// Parse tree nodes
// Names
- SyntaxKind[SyntaxKind["QualifiedName"] = 148] = "QualifiedName";
- SyntaxKind[SyntaxKind["ComputedPropertyName"] = 149] = "ComputedPropertyName";
+ SyntaxKind[SyntaxKind["QualifiedName"] = 149] = "QualifiedName";
+ SyntaxKind[SyntaxKind["ComputedPropertyName"] = 150] = "ComputedPropertyName";
// Signature elements
- SyntaxKind[SyntaxKind["TypeParameter"] = 150] = "TypeParameter";
- SyntaxKind[SyntaxKind["Parameter"] = 151] = "Parameter";
- SyntaxKind[SyntaxKind["Decorator"] = 152] = "Decorator";
+ SyntaxKind[SyntaxKind["TypeParameter"] = 151] = "TypeParameter";
+ SyntaxKind[SyntaxKind["Parameter"] = 152] = "Parameter";
+ SyntaxKind[SyntaxKind["Decorator"] = 153] = "Decorator";
// TypeMember
- SyntaxKind[SyntaxKind["PropertySignature"] = 153] = "PropertySignature";
- SyntaxKind[SyntaxKind["PropertyDeclaration"] = 154] = "PropertyDeclaration";
- SyntaxKind[SyntaxKind["MethodSignature"] = 155] = "MethodSignature";
- SyntaxKind[SyntaxKind["MethodDeclaration"] = 156] = "MethodDeclaration";
- SyntaxKind[SyntaxKind["Constructor"] = 157] = "Constructor";
- SyntaxKind[SyntaxKind["GetAccessor"] = 158] = "GetAccessor";
- SyntaxKind[SyntaxKind["SetAccessor"] = 159] = "SetAccessor";
- SyntaxKind[SyntaxKind["CallSignature"] = 160] = "CallSignature";
- SyntaxKind[SyntaxKind["ConstructSignature"] = 161] = "ConstructSignature";
- SyntaxKind[SyntaxKind["IndexSignature"] = 162] = "IndexSignature";
+ SyntaxKind[SyntaxKind["PropertySignature"] = 154] = "PropertySignature";
+ SyntaxKind[SyntaxKind["PropertyDeclaration"] = 155] = "PropertyDeclaration";
+ SyntaxKind[SyntaxKind["MethodSignature"] = 156] = "MethodSignature";
+ SyntaxKind[SyntaxKind["MethodDeclaration"] = 157] = "MethodDeclaration";
+ SyntaxKind[SyntaxKind["Constructor"] = 158] = "Constructor";
+ SyntaxKind[SyntaxKind["GetAccessor"] = 159] = "GetAccessor";
+ SyntaxKind[SyntaxKind["SetAccessor"] = 160] = "SetAccessor";
+ SyntaxKind[SyntaxKind["CallSignature"] = 161] = "CallSignature";
+ SyntaxKind[SyntaxKind["ConstructSignature"] = 162] = "ConstructSignature";
+ SyntaxKind[SyntaxKind["IndexSignature"] = 163] = "IndexSignature";
// Type
- SyntaxKind[SyntaxKind["TypePredicate"] = 163] = "TypePredicate";
- SyntaxKind[SyntaxKind["TypeReference"] = 164] = "TypeReference";
- SyntaxKind[SyntaxKind["FunctionType"] = 165] = "FunctionType";
- SyntaxKind[SyntaxKind["ConstructorType"] = 166] = "ConstructorType";
- SyntaxKind[SyntaxKind["TypeQuery"] = 167] = "TypeQuery";
- SyntaxKind[SyntaxKind["TypeLiteral"] = 168] = "TypeLiteral";
- SyntaxKind[SyntaxKind["ArrayType"] = 169] = "ArrayType";
- SyntaxKind[SyntaxKind["TupleType"] = 170] = "TupleType";
- SyntaxKind[SyntaxKind["OptionalType"] = 171] = "OptionalType";
- SyntaxKind[SyntaxKind["RestType"] = 172] = "RestType";
- SyntaxKind[SyntaxKind["UnionType"] = 173] = "UnionType";
- SyntaxKind[SyntaxKind["IntersectionType"] = 174] = "IntersectionType";
- SyntaxKind[SyntaxKind["ConditionalType"] = 175] = "ConditionalType";
- SyntaxKind[SyntaxKind["InferType"] = 176] = "InferType";
- SyntaxKind[SyntaxKind["ParenthesizedType"] = 177] = "ParenthesizedType";
- SyntaxKind[SyntaxKind["ThisType"] = 178] = "ThisType";
- SyntaxKind[SyntaxKind["TypeOperator"] = 179] = "TypeOperator";
- SyntaxKind[SyntaxKind["IndexedAccessType"] = 180] = "IndexedAccessType";
- SyntaxKind[SyntaxKind["MappedType"] = 181] = "MappedType";
- SyntaxKind[SyntaxKind["LiteralType"] = 182] = "LiteralType";
- SyntaxKind[SyntaxKind["ImportType"] = 183] = "ImportType";
+ SyntaxKind[SyntaxKind["TypePredicate"] = 164] = "TypePredicate";
+ SyntaxKind[SyntaxKind["TypeReference"] = 165] = "TypeReference";
+ SyntaxKind[SyntaxKind["FunctionType"] = 166] = "FunctionType";
+ SyntaxKind[SyntaxKind["ConstructorType"] = 167] = "ConstructorType";
+ SyntaxKind[SyntaxKind["TypeQuery"] = 168] = "TypeQuery";
+ SyntaxKind[SyntaxKind["TypeLiteral"] = 169] = "TypeLiteral";
+ SyntaxKind[SyntaxKind["ArrayType"] = 170] = "ArrayType";
+ SyntaxKind[SyntaxKind["TupleType"] = 171] = "TupleType";
+ SyntaxKind[SyntaxKind["OptionalType"] = 172] = "OptionalType";
+ SyntaxKind[SyntaxKind["RestType"] = 173] = "RestType";
+ SyntaxKind[SyntaxKind["UnionType"] = 174] = "UnionType";
+ SyntaxKind[SyntaxKind["IntersectionType"] = 175] = "IntersectionType";
+ SyntaxKind[SyntaxKind["ConditionalType"] = 176] = "ConditionalType";
+ SyntaxKind[SyntaxKind["InferType"] = 177] = "InferType";
+ SyntaxKind[SyntaxKind["ParenthesizedType"] = 178] = "ParenthesizedType";
+ SyntaxKind[SyntaxKind["ThisType"] = 179] = "ThisType";
+ SyntaxKind[SyntaxKind["TypeOperator"] = 180] = "TypeOperator";
+ SyntaxKind[SyntaxKind["IndexedAccessType"] = 181] = "IndexedAccessType";
+ SyntaxKind[SyntaxKind["MappedType"] = 182] = "MappedType";
+ SyntaxKind[SyntaxKind["LiteralType"] = 183] = "LiteralType";
+ SyntaxKind[SyntaxKind["ImportType"] = 184] = "ImportType";
// Binding patterns
- SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 184] = "ObjectBindingPattern";
- SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 185] = "ArrayBindingPattern";
- SyntaxKind[SyntaxKind["BindingElement"] = 186] = "BindingElement";
+ SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 185] = "ObjectBindingPattern";
+ SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 186] = "ArrayBindingPattern";
+ SyntaxKind[SyntaxKind["BindingElement"] = 187] = "BindingElement";
// Expression
- SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 187] = "ArrayLiteralExpression";
- SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 188] = "ObjectLiteralExpression";
- SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 189] = "PropertyAccessExpression";
- SyntaxKind[SyntaxKind["ElementAccessExpression"] = 190] = "ElementAccessExpression";
- SyntaxKind[SyntaxKind["CallExpression"] = 191] = "CallExpression";
- SyntaxKind[SyntaxKind["NewExpression"] = 192] = "NewExpression";
- SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 193] = "TaggedTemplateExpression";
- SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 194] = "TypeAssertionExpression";
- SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 195] = "ParenthesizedExpression";
- SyntaxKind[SyntaxKind["FunctionExpression"] = 196] = "FunctionExpression";
- SyntaxKind[SyntaxKind["ArrowFunction"] = 197] = "ArrowFunction";
- SyntaxKind[SyntaxKind["DeleteExpression"] = 198] = "DeleteExpression";
- SyntaxKind[SyntaxKind["TypeOfExpression"] = 199] = "TypeOfExpression";
- SyntaxKind[SyntaxKind["VoidExpression"] = 200] = "VoidExpression";
- SyntaxKind[SyntaxKind["AwaitExpression"] = 201] = "AwaitExpression";
- SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 202] = "PrefixUnaryExpression";
- SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 203] = "PostfixUnaryExpression";
- SyntaxKind[SyntaxKind["BinaryExpression"] = 204] = "BinaryExpression";
- SyntaxKind[SyntaxKind["ConditionalExpression"] = 205] = "ConditionalExpression";
- SyntaxKind[SyntaxKind["TemplateExpression"] = 206] = "TemplateExpression";
- SyntaxKind[SyntaxKind["YieldExpression"] = 207] = "YieldExpression";
- SyntaxKind[SyntaxKind["SpreadElement"] = 208] = "SpreadElement";
- SyntaxKind[SyntaxKind["ClassExpression"] = 209] = "ClassExpression";
- SyntaxKind[SyntaxKind["OmittedExpression"] = 210] = "OmittedExpression";
- SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 211] = "ExpressionWithTypeArguments";
- SyntaxKind[SyntaxKind["AsExpression"] = 212] = "AsExpression";
- SyntaxKind[SyntaxKind["NonNullExpression"] = 213] = "NonNullExpression";
- SyntaxKind[SyntaxKind["MetaProperty"] = 214] = "MetaProperty";
- SyntaxKind[SyntaxKind["SyntheticExpression"] = 215] = "SyntheticExpression";
+ SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 188] = "ArrayLiteralExpression";
+ SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 189] = "ObjectLiteralExpression";
+ SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 190] = "PropertyAccessExpression";
+ SyntaxKind[SyntaxKind["ElementAccessExpression"] = 191] = "ElementAccessExpression";
+ SyntaxKind[SyntaxKind["CallExpression"] = 192] = "CallExpression";
+ SyntaxKind[SyntaxKind["NewExpression"] = 193] = "NewExpression";
+ SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 194] = "TaggedTemplateExpression";
+ SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 195] = "TypeAssertionExpression";
+ SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 196] = "ParenthesizedExpression";
+ SyntaxKind[SyntaxKind["FunctionExpression"] = 197] = "FunctionExpression";
+ SyntaxKind[SyntaxKind["ArrowFunction"] = 198] = "ArrowFunction";
+ SyntaxKind[SyntaxKind["DeleteExpression"] = 199] = "DeleteExpression";
+ SyntaxKind[SyntaxKind["TypeOfExpression"] = 200] = "TypeOfExpression";
+ SyntaxKind[SyntaxKind["VoidExpression"] = 201] = "VoidExpression";
+ SyntaxKind[SyntaxKind["AwaitExpression"] = 202] = "AwaitExpression";
+ SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 203] = "PrefixUnaryExpression";
+ SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 204] = "PostfixUnaryExpression";
+ SyntaxKind[SyntaxKind["BinaryExpression"] = 205] = "BinaryExpression";
+ SyntaxKind[SyntaxKind["ConditionalExpression"] = 206] = "ConditionalExpression";
+ SyntaxKind[SyntaxKind["TemplateExpression"] = 207] = "TemplateExpression";
+ SyntaxKind[SyntaxKind["YieldExpression"] = 208] = "YieldExpression";
+ SyntaxKind[SyntaxKind["SpreadElement"] = 209] = "SpreadElement";
+ SyntaxKind[SyntaxKind["ClassExpression"] = 210] = "ClassExpression";
+ SyntaxKind[SyntaxKind["OmittedExpression"] = 211] = "OmittedExpression";
+ SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 212] = "ExpressionWithTypeArguments";
+ SyntaxKind[SyntaxKind["AsExpression"] = 213] = "AsExpression";
+ SyntaxKind[SyntaxKind["NonNullExpression"] = 214] = "NonNullExpression";
+ SyntaxKind[SyntaxKind["MetaProperty"] = 215] = "MetaProperty";
+ SyntaxKind[SyntaxKind["SyntheticExpression"] = 216] = "SyntheticExpression";
// Misc
- SyntaxKind[SyntaxKind["TemplateSpan"] = 216] = "TemplateSpan";
- SyntaxKind[SyntaxKind["SemicolonClassElement"] = 217] = "SemicolonClassElement";
+ SyntaxKind[SyntaxKind["TemplateSpan"] = 217] = "TemplateSpan";
+ SyntaxKind[SyntaxKind["SemicolonClassElement"] = 218] = "SemicolonClassElement";
// Element
- SyntaxKind[SyntaxKind["Block"] = 218] = "Block";
- SyntaxKind[SyntaxKind["VariableStatement"] = 219] = "VariableStatement";
- SyntaxKind[SyntaxKind["EmptyStatement"] = 220] = "EmptyStatement";
- SyntaxKind[SyntaxKind["ExpressionStatement"] = 221] = "ExpressionStatement";
- SyntaxKind[SyntaxKind["IfStatement"] = 222] = "IfStatement";
- SyntaxKind[SyntaxKind["DoStatement"] = 223] = "DoStatement";
- SyntaxKind[SyntaxKind["WhileStatement"] = 224] = "WhileStatement";
- SyntaxKind[SyntaxKind["ForStatement"] = 225] = "ForStatement";
- SyntaxKind[SyntaxKind["ForInStatement"] = 226] = "ForInStatement";
- SyntaxKind[SyntaxKind["ForOfStatement"] = 227] = "ForOfStatement";
- SyntaxKind[SyntaxKind["ContinueStatement"] = 228] = "ContinueStatement";
- SyntaxKind[SyntaxKind["BreakStatement"] = 229] = "BreakStatement";
- SyntaxKind[SyntaxKind["ReturnStatement"] = 230] = "ReturnStatement";
- SyntaxKind[SyntaxKind["WithStatement"] = 231] = "WithStatement";
- SyntaxKind[SyntaxKind["SwitchStatement"] = 232] = "SwitchStatement";
- SyntaxKind[SyntaxKind["LabeledStatement"] = 233] = "LabeledStatement";
- SyntaxKind[SyntaxKind["ThrowStatement"] = 234] = "ThrowStatement";
- SyntaxKind[SyntaxKind["TryStatement"] = 235] = "TryStatement";
- SyntaxKind[SyntaxKind["DebuggerStatement"] = 236] = "DebuggerStatement";
- SyntaxKind[SyntaxKind["VariableDeclaration"] = 237] = "VariableDeclaration";
- SyntaxKind[SyntaxKind["VariableDeclarationList"] = 238] = "VariableDeclarationList";
- SyntaxKind[SyntaxKind["FunctionDeclaration"] = 239] = "FunctionDeclaration";
- SyntaxKind[SyntaxKind["ClassDeclaration"] = 240] = "ClassDeclaration";
- SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 241] = "InterfaceDeclaration";
- SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 242] = "TypeAliasDeclaration";
- SyntaxKind[SyntaxKind["EnumDeclaration"] = 243] = "EnumDeclaration";
- SyntaxKind[SyntaxKind["ModuleDeclaration"] = 244] = "ModuleDeclaration";
- SyntaxKind[SyntaxKind["ModuleBlock"] = 245] = "ModuleBlock";
- SyntaxKind[SyntaxKind["CaseBlock"] = 246] = "CaseBlock";
- SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 247] = "NamespaceExportDeclaration";
- SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 248] = "ImportEqualsDeclaration";
- SyntaxKind[SyntaxKind["ImportDeclaration"] = 249] = "ImportDeclaration";
- SyntaxKind[SyntaxKind["ImportClause"] = 250] = "ImportClause";
- SyntaxKind[SyntaxKind["NamespaceImport"] = 251] = "NamespaceImport";
- SyntaxKind[SyntaxKind["NamedImports"] = 252] = "NamedImports";
- SyntaxKind[SyntaxKind["ImportSpecifier"] = 253] = "ImportSpecifier";
- SyntaxKind[SyntaxKind["ExportAssignment"] = 254] = "ExportAssignment";
- SyntaxKind[SyntaxKind["ExportDeclaration"] = 255] = "ExportDeclaration";
- SyntaxKind[SyntaxKind["NamedExports"] = 256] = "NamedExports";
- SyntaxKind[SyntaxKind["ExportSpecifier"] = 257] = "ExportSpecifier";
- SyntaxKind[SyntaxKind["MissingDeclaration"] = 258] = "MissingDeclaration";
+ SyntaxKind[SyntaxKind["Block"] = 219] = "Block";
+ SyntaxKind[SyntaxKind["VariableStatement"] = 220] = "VariableStatement";
+ SyntaxKind[SyntaxKind["EmptyStatement"] = 221] = "EmptyStatement";
+ SyntaxKind[SyntaxKind["ExpressionStatement"] = 222] = "ExpressionStatement";
+ SyntaxKind[SyntaxKind["IfStatement"] = 223] = "IfStatement";
+ SyntaxKind[SyntaxKind["DoStatement"] = 224] = "DoStatement";
+ SyntaxKind[SyntaxKind["WhileStatement"] = 225] = "WhileStatement";
+ SyntaxKind[SyntaxKind["ForStatement"] = 226] = "ForStatement";
+ SyntaxKind[SyntaxKind["ForInStatement"] = 227] = "ForInStatement";
+ SyntaxKind[SyntaxKind["ForOfStatement"] = 228] = "ForOfStatement";
+ SyntaxKind[SyntaxKind["ContinueStatement"] = 229] = "ContinueStatement";
+ SyntaxKind[SyntaxKind["BreakStatement"] = 230] = "BreakStatement";
+ SyntaxKind[SyntaxKind["ReturnStatement"] = 231] = "ReturnStatement";
+ SyntaxKind[SyntaxKind["WithStatement"] = 232] = "WithStatement";
+ SyntaxKind[SyntaxKind["SwitchStatement"] = 233] = "SwitchStatement";
+ SyntaxKind[SyntaxKind["LabeledStatement"] = 234] = "LabeledStatement";
+ SyntaxKind[SyntaxKind["ThrowStatement"] = 235] = "ThrowStatement";
+ SyntaxKind[SyntaxKind["TryStatement"] = 236] = "TryStatement";
+ SyntaxKind[SyntaxKind["DebuggerStatement"] = 237] = "DebuggerStatement";
+ SyntaxKind[SyntaxKind["VariableDeclaration"] = 238] = "VariableDeclaration";
+ SyntaxKind[SyntaxKind["VariableDeclarationList"] = 239] = "VariableDeclarationList";
+ SyntaxKind[SyntaxKind["FunctionDeclaration"] = 240] = "FunctionDeclaration";
+ SyntaxKind[SyntaxKind["ClassDeclaration"] = 241] = "ClassDeclaration";
+ SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 242] = "InterfaceDeclaration";
+ SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 243] = "TypeAliasDeclaration";
+ SyntaxKind[SyntaxKind["EnumDeclaration"] = 244] = "EnumDeclaration";
+ SyntaxKind[SyntaxKind["ModuleDeclaration"] = 245] = "ModuleDeclaration";
+ SyntaxKind[SyntaxKind["ModuleBlock"] = 246] = "ModuleBlock";
+ SyntaxKind[SyntaxKind["CaseBlock"] = 247] = "CaseBlock";
+ SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 248] = "NamespaceExportDeclaration";
+ SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 249] = "ImportEqualsDeclaration";
+ SyntaxKind[SyntaxKind["ImportDeclaration"] = 250] = "ImportDeclaration";
+ SyntaxKind[SyntaxKind["ImportClause"] = 251] = "ImportClause";
+ SyntaxKind[SyntaxKind["NamespaceImport"] = 252] = "NamespaceImport";
+ SyntaxKind[SyntaxKind["NamedImports"] = 253] = "NamedImports";
+ SyntaxKind[SyntaxKind["ImportSpecifier"] = 254] = "ImportSpecifier";
+ SyntaxKind[SyntaxKind["ExportAssignment"] = 255] = "ExportAssignment";
+ SyntaxKind[SyntaxKind["ExportDeclaration"] = 256] = "ExportDeclaration";
+ SyntaxKind[SyntaxKind["NamedExports"] = 257] = "NamedExports";
+ SyntaxKind[SyntaxKind["ExportSpecifier"] = 258] = "ExportSpecifier";
+ SyntaxKind[SyntaxKind["MissingDeclaration"] = 259] = "MissingDeclaration";
// Module references
- SyntaxKind[SyntaxKind["ExternalModuleReference"] = 259] = "ExternalModuleReference";
+ SyntaxKind[SyntaxKind["ExternalModuleReference"] = 260] = "ExternalModuleReference";
// JSX
- SyntaxKind[SyntaxKind["JsxElement"] = 260] = "JsxElement";
- SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 261] = "JsxSelfClosingElement";
- SyntaxKind[SyntaxKind["JsxOpeningElement"] = 262] = "JsxOpeningElement";
- SyntaxKind[SyntaxKind["JsxClosingElement"] = 263] = "JsxClosingElement";
- SyntaxKind[SyntaxKind["JsxFragment"] = 264] = "JsxFragment";
- SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 265] = "JsxOpeningFragment";
- SyntaxKind[SyntaxKind["JsxClosingFragment"] = 266] = "JsxClosingFragment";
- SyntaxKind[SyntaxKind["JsxAttribute"] = 267] = "JsxAttribute";
- SyntaxKind[SyntaxKind["JsxAttributes"] = 268] = "JsxAttributes";
- SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 269] = "JsxSpreadAttribute";
- SyntaxKind[SyntaxKind["JsxExpression"] = 270] = "JsxExpression";
+ SyntaxKind[SyntaxKind["JsxElement"] = 261] = "JsxElement";
+ SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 262] = "JsxSelfClosingElement";
+ SyntaxKind[SyntaxKind["JsxOpeningElement"] = 263] = "JsxOpeningElement";
+ SyntaxKind[SyntaxKind["JsxClosingElement"] = 264] = "JsxClosingElement";
+ SyntaxKind[SyntaxKind["JsxFragment"] = 265] = "JsxFragment";
+ SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 266] = "JsxOpeningFragment";
+ SyntaxKind[SyntaxKind["JsxClosingFragment"] = 267] = "JsxClosingFragment";
+ SyntaxKind[SyntaxKind["JsxAttribute"] = 268] = "JsxAttribute";
+ SyntaxKind[SyntaxKind["JsxAttributes"] = 269] = "JsxAttributes";
+ SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 270] = "JsxSpreadAttribute";
+ SyntaxKind[SyntaxKind["JsxExpression"] = 271] = "JsxExpression";
// Clauses
- SyntaxKind[SyntaxKind["CaseClause"] = 271] = "CaseClause";
- SyntaxKind[SyntaxKind["DefaultClause"] = 272] = "DefaultClause";
- SyntaxKind[SyntaxKind["HeritageClause"] = 273] = "HeritageClause";
- SyntaxKind[SyntaxKind["CatchClause"] = 274] = "CatchClause";
+ SyntaxKind[SyntaxKind["CaseClause"] = 272] = "CaseClause";
+ SyntaxKind[SyntaxKind["DefaultClause"] = 273] = "DefaultClause";
+ SyntaxKind[SyntaxKind["HeritageClause"] = 274] = "HeritageClause";
+ SyntaxKind[SyntaxKind["CatchClause"] = 275] = "CatchClause";
// Property assignments
- SyntaxKind[SyntaxKind["PropertyAssignment"] = 275] = "PropertyAssignment";
- SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 276] = "ShorthandPropertyAssignment";
- SyntaxKind[SyntaxKind["SpreadAssignment"] = 277] = "SpreadAssignment";
+ SyntaxKind[SyntaxKind["PropertyAssignment"] = 276] = "PropertyAssignment";
+ SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 277] = "ShorthandPropertyAssignment";
+ SyntaxKind[SyntaxKind["SpreadAssignment"] = 278] = "SpreadAssignment";
// Enum
- SyntaxKind[SyntaxKind["EnumMember"] = 278] = "EnumMember";
+ SyntaxKind[SyntaxKind["EnumMember"] = 279] = "EnumMember";
// Unparsed
- SyntaxKind[SyntaxKind["UnparsedPrologue"] = 279] = "UnparsedPrologue";
- SyntaxKind[SyntaxKind["UnparsedPrepend"] = 280] = "UnparsedPrepend";
- SyntaxKind[SyntaxKind["UnparsedText"] = 281] = "UnparsedText";
- SyntaxKind[SyntaxKind["UnparsedInternalText"] = 282] = "UnparsedInternalText";
- SyntaxKind[SyntaxKind["UnparsedSyntheticReference"] = 283] = "UnparsedSyntheticReference";
+ SyntaxKind[SyntaxKind["UnparsedPrologue"] = 280] = "UnparsedPrologue";
+ SyntaxKind[SyntaxKind["UnparsedPrepend"] = 281] = "UnparsedPrepend";
+ SyntaxKind[SyntaxKind["UnparsedText"] = 282] = "UnparsedText";
+ SyntaxKind[SyntaxKind["UnparsedInternalText"] = 283] = "UnparsedInternalText";
+ SyntaxKind[SyntaxKind["UnparsedSyntheticReference"] = 284] = "UnparsedSyntheticReference";
// Top-level nodes
- SyntaxKind[SyntaxKind["SourceFile"] = 284] = "SourceFile";
- SyntaxKind[SyntaxKind["Bundle"] = 285] = "Bundle";
- SyntaxKind[SyntaxKind["UnparsedSource"] = 286] = "UnparsedSource";
- SyntaxKind[SyntaxKind["InputFiles"] = 287] = "InputFiles";
+ SyntaxKind[SyntaxKind["SourceFile"] = 285] = "SourceFile";
+ SyntaxKind[SyntaxKind["Bundle"] = 286] = "Bundle";
+ SyntaxKind[SyntaxKind["UnparsedSource"] = 287] = "UnparsedSource";
+ SyntaxKind[SyntaxKind["InputFiles"] = 288] = "InputFiles";
// JSDoc nodes
- SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 288] = "JSDocTypeExpression";
+ SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 289] = "JSDocTypeExpression";
// The * type
- SyntaxKind[SyntaxKind["JSDocAllType"] = 289] = "JSDocAllType";
+ SyntaxKind[SyntaxKind["JSDocAllType"] = 290] = "JSDocAllType";
// The ? type
- SyntaxKind[SyntaxKind["JSDocUnknownType"] = 290] = "JSDocUnknownType";
- SyntaxKind[SyntaxKind["JSDocNullableType"] = 291] = "JSDocNullableType";
- SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 292] = "JSDocNonNullableType";
- SyntaxKind[SyntaxKind["JSDocOptionalType"] = 293] = "JSDocOptionalType";
- SyntaxKind[SyntaxKind["JSDocFunctionType"] = 294] = "JSDocFunctionType";
- SyntaxKind[SyntaxKind["JSDocVariadicType"] = 295] = "JSDocVariadicType";
- SyntaxKind[SyntaxKind["JSDocComment"] = 296] = "JSDocComment";
- SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 297] = "JSDocTypeLiteral";
- SyntaxKind[SyntaxKind["JSDocSignature"] = 298] = "JSDocSignature";
- SyntaxKind[SyntaxKind["JSDocTag"] = 299] = "JSDocTag";
- SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 300] = "JSDocAugmentsTag";
- SyntaxKind[SyntaxKind["JSDocClassTag"] = 301] = "JSDocClassTag";
- SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 302] = "JSDocCallbackTag";
- SyntaxKind[SyntaxKind["JSDocEnumTag"] = 303] = "JSDocEnumTag";
- SyntaxKind[SyntaxKind["JSDocParameterTag"] = 304] = "JSDocParameterTag";
- SyntaxKind[SyntaxKind["JSDocReturnTag"] = 305] = "JSDocReturnTag";
- SyntaxKind[SyntaxKind["JSDocThisTag"] = 306] = "JSDocThisTag";
- SyntaxKind[SyntaxKind["JSDocTypeTag"] = 307] = "JSDocTypeTag";
- SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 308] = "JSDocTemplateTag";
- SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 309] = "JSDocTypedefTag";
- SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 310] = "JSDocPropertyTag";
+ SyntaxKind[SyntaxKind["JSDocUnknownType"] = 291] = "JSDocUnknownType";
+ SyntaxKind[SyntaxKind["JSDocNullableType"] = 292] = "JSDocNullableType";
+ SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 293] = "JSDocNonNullableType";
+ SyntaxKind[SyntaxKind["JSDocOptionalType"] = 294] = "JSDocOptionalType";
+ SyntaxKind[SyntaxKind["JSDocFunctionType"] = 295] = "JSDocFunctionType";
+ SyntaxKind[SyntaxKind["JSDocVariadicType"] = 296] = "JSDocVariadicType";
+ SyntaxKind[SyntaxKind["JSDocComment"] = 297] = "JSDocComment";
+ SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 298] = "JSDocTypeLiteral";
+ SyntaxKind[SyntaxKind["JSDocSignature"] = 299] = "JSDocSignature";
+ SyntaxKind[SyntaxKind["JSDocTag"] = 300] = "JSDocTag";
+ SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 301] = "JSDocAugmentsTag";
+ SyntaxKind[SyntaxKind["JSDocClassTag"] = 302] = "JSDocClassTag";
+ SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 303] = "JSDocCallbackTag";
+ SyntaxKind[SyntaxKind["JSDocEnumTag"] = 304] = "JSDocEnumTag";
+ SyntaxKind[SyntaxKind["JSDocParameterTag"] = 305] = "JSDocParameterTag";
+ SyntaxKind[SyntaxKind["JSDocReturnTag"] = 306] = "JSDocReturnTag";
+ SyntaxKind[SyntaxKind["JSDocThisTag"] = 307] = "JSDocThisTag";
+ SyntaxKind[SyntaxKind["JSDocTypeTag"] = 308] = "JSDocTypeTag";
+ SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 309] = "JSDocTemplateTag";
+ SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 310] = "JSDocTypedefTag";
+ SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 311] = "JSDocPropertyTag";
// Synthesized list
- SyntaxKind[SyntaxKind["SyntaxList"] = 311] = "SyntaxList";
+ SyntaxKind[SyntaxKind["SyntaxList"] = 312] = "SyntaxList";
// Transformation nodes
- SyntaxKind[SyntaxKind["NotEmittedStatement"] = 312] = "NotEmittedStatement";
- SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 313] = "PartiallyEmittedExpression";
- SyntaxKind[SyntaxKind["CommaListExpression"] = 314] = "CommaListExpression";
- SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 315] = "MergeDeclarationMarker";
- SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 316] = "EndOfDeclarationMarker";
+ SyntaxKind[SyntaxKind["NotEmittedStatement"] = 313] = "NotEmittedStatement";
+ SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 314] = "PartiallyEmittedExpression";
+ SyntaxKind[SyntaxKind["CommaListExpression"] = 315] = "CommaListExpression";
+ SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 316] = "MergeDeclarationMarker";
+ SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 317] = "EndOfDeclarationMarker";
// Enum value count
- SyntaxKind[SyntaxKind["Count"] = 317] = "Count";
+ SyntaxKind[SyntaxKind["Count"] = 318] = "Count";
// Markers
- SyntaxKind[SyntaxKind["FirstAssignment"] = 59] = "FirstAssignment";
- SyntaxKind[SyntaxKind["LastAssignment"] = 71] = "LastAssignment";
- SyntaxKind[SyntaxKind["FirstCompoundAssignment"] = 60] = "FirstCompoundAssignment";
- SyntaxKind[SyntaxKind["LastCompoundAssignment"] = 71] = "LastCompoundAssignment";
- SyntaxKind[SyntaxKind["FirstReservedWord"] = 73] = "FirstReservedWord";
- SyntaxKind[SyntaxKind["LastReservedWord"] = 108] = "LastReservedWord";
- SyntaxKind[SyntaxKind["FirstKeyword"] = 73] = "FirstKeyword";
- SyntaxKind[SyntaxKind["LastKeyword"] = 147] = "LastKeyword";
- SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 109] = "FirstFutureReservedWord";
- SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 117] = "LastFutureReservedWord";
- SyntaxKind[SyntaxKind["FirstTypeNode"] = 163] = "FirstTypeNode";
- SyntaxKind[SyntaxKind["LastTypeNode"] = 183] = "LastTypeNode";
+ SyntaxKind[SyntaxKind["FirstAssignment"] = 60] = "FirstAssignment";
+ SyntaxKind[SyntaxKind["LastAssignment"] = 72] = "LastAssignment";
+ SyntaxKind[SyntaxKind["FirstCompoundAssignment"] = 61] = "FirstCompoundAssignment";
+ SyntaxKind[SyntaxKind["LastCompoundAssignment"] = 72] = "LastCompoundAssignment";
+ SyntaxKind[SyntaxKind["FirstReservedWord"] = 74] = "FirstReservedWord";
+ SyntaxKind[SyntaxKind["LastReservedWord"] = 109] = "LastReservedWord";
+ SyntaxKind[SyntaxKind["FirstKeyword"] = 74] = "FirstKeyword";
+ SyntaxKind[SyntaxKind["LastKeyword"] = 148] = "LastKeyword";
+ SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 110] = "FirstFutureReservedWord";
+ SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 118] = "LastFutureReservedWord";
+ SyntaxKind[SyntaxKind["FirstTypeNode"] = 164] = "FirstTypeNode";
+ SyntaxKind[SyntaxKind["LastTypeNode"] = 184] = "LastTypeNode";
SyntaxKind[SyntaxKind["FirstPunctuation"] = 18] = "FirstPunctuation";
- SyntaxKind[SyntaxKind["LastPunctuation"] = 71] = "LastPunctuation";
+ SyntaxKind[SyntaxKind["LastPunctuation"] = 72] = "LastPunctuation";
SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken";
- SyntaxKind[SyntaxKind["LastToken"] = 147] = "LastToken";
+ SyntaxKind[SyntaxKind["LastToken"] = 148] = "LastToken";
SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken";
SyntaxKind[SyntaxKind["LastTriviaToken"] = 7] = "LastTriviaToken";
SyntaxKind[SyntaxKind["FirstLiteralToken"] = 8] = "FirstLiteralToken";
@@ -2966,14 +3120,14 @@
SyntaxKind[SyntaxKind["FirstTemplateToken"] = 14] = "FirstTemplateToken";
SyntaxKind[SyntaxKind["LastTemplateToken"] = 17] = "LastTemplateToken";
SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 28] = "FirstBinaryOperator";
- SyntaxKind[SyntaxKind["LastBinaryOperator"] = 71] = "LastBinaryOperator";
- SyntaxKind[SyntaxKind["FirstNode"] = 148] = "FirstNode";
- SyntaxKind[SyntaxKind["FirstJSDocNode"] = 288] = "FirstJSDocNode";
- SyntaxKind[SyntaxKind["LastJSDocNode"] = 310] = "LastJSDocNode";
- SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 299] = "FirstJSDocTagNode";
- SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 310] = "LastJSDocTagNode";
- /* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 118] = "FirstContextualKeyword";
- /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 147] = "LastContextualKeyword";
+ SyntaxKind[SyntaxKind["LastBinaryOperator"] = 72] = "LastBinaryOperator";
+ SyntaxKind[SyntaxKind["FirstNode"] = 149] = "FirstNode";
+ SyntaxKind[SyntaxKind["FirstJSDocNode"] = 289] = "FirstJSDocNode";
+ SyntaxKind[SyntaxKind["LastJSDocNode"] = 311] = "LastJSDocNode";
+ SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 300] = "FirstJSDocTagNode";
+ SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 311] = "LastJSDocTagNode";
+ /* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 119] = "FirstContextualKeyword";
+ /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 148] = "LastContextualKeyword";
})(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {}));
var NodeFlags;
(function (NodeFlags) {
@@ -3116,6 +3270,8 @@
FlowFlags[FlowFlags["Shared"] = 1024] = "Shared";
FlowFlags[FlowFlags["PreFinally"] = 2048] = "PreFinally";
FlowFlags[FlowFlags["AfterFinally"] = 4096] = "AfterFinally";
+ /** @internal */
+ FlowFlags[FlowFlags["Cached"] = 8192] = "Cached";
FlowFlags[FlowFlags["Label"] = 12] = "Label";
FlowFlags[FlowFlags["Condition"] = 96] = "Condition";
})(FlowFlags = ts.FlowFlags || (ts.FlowFlags = {}));
@@ -3368,19 +3524,22 @@
CheckFlags[CheckFlags["SyntheticProperty"] = 2] = "SyntheticProperty";
CheckFlags[CheckFlags["SyntheticMethod"] = 4] = "SyntheticMethod";
CheckFlags[CheckFlags["Readonly"] = 8] = "Readonly";
- CheckFlags[CheckFlags["Partial"] = 16] = "Partial";
- CheckFlags[CheckFlags["HasNonUniformType"] = 32] = "HasNonUniformType";
- CheckFlags[CheckFlags["HasLiteralType"] = 64] = "HasLiteralType";
- CheckFlags[CheckFlags["ContainsPublic"] = 128] = "ContainsPublic";
- CheckFlags[CheckFlags["ContainsProtected"] = 256] = "ContainsProtected";
- CheckFlags[CheckFlags["ContainsPrivate"] = 512] = "ContainsPrivate";
- CheckFlags[CheckFlags["ContainsStatic"] = 1024] = "ContainsStatic";
- CheckFlags[CheckFlags["Late"] = 2048] = "Late";
- CheckFlags[CheckFlags["ReverseMapped"] = 4096] = "ReverseMapped";
- CheckFlags[CheckFlags["OptionalParameter"] = 8192] = "OptionalParameter";
- CheckFlags[CheckFlags["RestParameter"] = 16384] = "RestParameter";
+ CheckFlags[CheckFlags["ReadPartial"] = 16] = "ReadPartial";
+ CheckFlags[CheckFlags["WritePartial"] = 32] = "WritePartial";
+ CheckFlags[CheckFlags["HasNonUniformType"] = 64] = "HasNonUniformType";
+ CheckFlags[CheckFlags["HasLiteralType"] = 128] = "HasLiteralType";
+ CheckFlags[CheckFlags["ContainsPublic"] = 256] = "ContainsPublic";
+ CheckFlags[CheckFlags["ContainsProtected"] = 512] = "ContainsProtected";
+ CheckFlags[CheckFlags["ContainsPrivate"] = 1024] = "ContainsPrivate";
+ CheckFlags[CheckFlags["ContainsStatic"] = 2048] = "ContainsStatic";
+ CheckFlags[CheckFlags["Late"] = 4096] = "Late";
+ CheckFlags[CheckFlags["ReverseMapped"] = 8192] = "ReverseMapped";
+ CheckFlags[CheckFlags["OptionalParameter"] = 16384] = "OptionalParameter";
+ CheckFlags[CheckFlags["RestParameter"] = 32768] = "RestParameter";
+ CheckFlags[CheckFlags["DeferredType"] = 65536] = "DeferredType";
CheckFlags[CheckFlags["Synthetic"] = 6] = "Synthetic";
- CheckFlags[CheckFlags["Discriminant"] = 96] = "Discriminant";
+ CheckFlags[CheckFlags["Discriminant"] = 192] = "Discriminant";
+ CheckFlags[CheckFlags["Partial"] = 48] = "Partial";
})(CheckFlags = ts.CheckFlags || (ts.CheckFlags = {}));
var InternalSymbolName;
(function (InternalSymbolName) {
@@ -3491,6 +3650,8 @@
TypeFlags[TypeFlags["StructuredOrInstantiable"] = 66846720] = "StructuredOrInstantiable";
/* @internal */
TypeFlags[TypeFlags["ObjectFlagsType"] = 3899392] = "ObjectFlagsType";
+ /* @internal */
+ TypeFlags[TypeFlags["Simplifiable"] = 25165824] = "Simplifiable";
// 'Narrowable' types are types where narrowing actually narrows.
// This *should* be every type other than null, undefined, void, and never
TypeFlags[TypeFlags["Narrowable"] = 133970943] = "Narrowable";
@@ -3546,14 +3707,18 @@
ObjectFlags[ObjectFlags["PropagatingFlags"] = 917504] = "PropagatingFlags";
})(ObjectFlags = ts.ObjectFlags || (ts.ObjectFlags = {}));
/* @internal */
- var Variance;
- (function (Variance) {
- Variance[Variance["Invariant"] = 0] = "Invariant";
- Variance[Variance["Covariant"] = 1] = "Covariant";
- Variance[Variance["Contravariant"] = 2] = "Contravariant";
- Variance[Variance["Bivariant"] = 3] = "Bivariant";
- Variance[Variance["Independent"] = 4] = "Independent";
- })(Variance = ts.Variance || (ts.Variance = {}));
+ var VarianceFlags;
+ (function (VarianceFlags) {
+ VarianceFlags[VarianceFlags["Invariant"] = 0] = "Invariant";
+ VarianceFlags[VarianceFlags["Covariant"] = 1] = "Covariant";
+ VarianceFlags[VarianceFlags["Contravariant"] = 2] = "Contravariant";
+ VarianceFlags[VarianceFlags["Bivariant"] = 3] = "Bivariant";
+ VarianceFlags[VarianceFlags["Independent"] = 4] = "Independent";
+ VarianceFlags[VarianceFlags["VarianceMask"] = 7] = "VarianceMask";
+ VarianceFlags[VarianceFlags["Unmeasurable"] = 8] = "Unmeasurable";
+ VarianceFlags[VarianceFlags["Unreliable"] = 16] = "Unreliable";
+ VarianceFlags[VarianceFlags["AllowsStructuralFallback"] = 24] = "AllowsStructuralFallback";
+ })(VarianceFlags = ts.VarianceFlags || (ts.VarianceFlags = {}));
/* @internal */
var JsxReferenceKind;
(function (JsxReferenceKind) {
@@ -3575,12 +3740,13 @@
(function (InferencePriority) {
InferencePriority[InferencePriority["NakedTypeVariable"] = 1] = "NakedTypeVariable";
InferencePriority[InferencePriority["HomomorphicMappedType"] = 2] = "HomomorphicMappedType";
- InferencePriority[InferencePriority["MappedTypeConstraint"] = 4] = "MappedTypeConstraint";
- InferencePriority[InferencePriority["ReturnType"] = 8] = "ReturnType";
- InferencePriority[InferencePriority["LiteralKeyof"] = 16] = "LiteralKeyof";
- InferencePriority[InferencePriority["NoConstraints"] = 32] = "NoConstraints";
- InferencePriority[InferencePriority["AlwaysStrict"] = 64] = "AlwaysStrict";
- InferencePriority[InferencePriority["PriorityImpliesCombination"] = 28] = "PriorityImpliesCombination";
+ InferencePriority[InferencePriority["PartialHomomorphicMappedType"] = 4] = "PartialHomomorphicMappedType";
+ InferencePriority[InferencePriority["MappedTypeConstraint"] = 8] = "MappedTypeConstraint";
+ InferencePriority[InferencePriority["ReturnType"] = 16] = "ReturnType";
+ InferencePriority[InferencePriority["LiteralKeyof"] = 32] = "LiteralKeyof";
+ InferencePriority[InferencePriority["NoConstraints"] = 64] = "NoConstraints";
+ InferencePriority[InferencePriority["AlwaysStrict"] = 128] = "AlwaysStrict";
+ InferencePriority[InferencePriority["PriorityImpliesCombination"] = 56] = "PriorityImpliesCombination";
})(InferencePriority = ts.InferencePriority || (ts.InferencePriority = {}));
/* @internal */
var InferenceFlags;
@@ -3697,9 +3863,10 @@
ScriptTarget[ScriptTarget["ES2017"] = 4] = "ES2017";
ScriptTarget[ScriptTarget["ES2018"] = 5] = "ES2018";
ScriptTarget[ScriptTarget["ES2019"] = 6] = "ES2019";
- ScriptTarget[ScriptTarget["ESNext"] = 7] = "ESNext";
+ ScriptTarget[ScriptTarget["ES2020"] = 7] = "ES2020";
+ ScriptTarget[ScriptTarget["ESNext"] = 8] = "ESNext";
ScriptTarget[ScriptTarget["JSON"] = 100] = "JSON";
- ScriptTarget[ScriptTarget["Latest"] = 7] = "Latest";
+ ScriptTarget[ScriptTarget["Latest"] = 8] = "Latest";
})(ScriptTarget = ts.ScriptTarget || (ts.ScriptTarget = {}));
var LanguageVariant;
(function (LanguageVariant) {
@@ -4112,17 +4279,10 @@
PragmaKindFlags[PragmaKindFlags["All"] = 7] = "All";
PragmaKindFlags[PragmaKindFlags["Default"] = 7] = "Default";
})(PragmaKindFlags = ts.PragmaKindFlags || (ts.PragmaKindFlags = {}));
- /**
- * This function only exists to cause exact types to be inferred for all the literals within `commentPragmas`
- */
- /* @internal */
- function _contextuallyTypePragmas(args) {
- return args;
- }
// While not strictly a type, this is here because `PragmaMap` needs to be here to be used with `SourceFile`, and we don't
// fancy effectively defining it twice, once in value-space and once in type-space
/* @internal */
- ts.commentPragmas = _contextuallyTypePragmas({
+ ts.commentPragmas = {
"reference": {
args: [
{ name: "types", optional: true, captureSpan: true },
@@ -4150,7 +4310,7 @@
args: [{ name: "factory" }],
kind: 4 /* MultiLine */
},
- });
+ };
})(ts || (ts = {}));
var ts;
(function (ts) {
@@ -5197,7 +5357,7 @@
_0_modifier_cannot_appear_on_a_data_property: diag(1043, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_data_property_1043", "'{0}' modifier cannot appear on a data property."),
_0_modifier_cannot_appear_on_a_module_or_namespace_element: diag(1044, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_module_or_namespace_element_1044", "'{0}' modifier cannot appear on a module or namespace element."),
A_0_modifier_cannot_be_used_with_an_interface_declaration: diag(1045, ts.DiagnosticCategory.Error, "A_0_modifier_cannot_be_used_with_an_interface_declaration_1045", "A '{0}' modifier cannot be used with an interface declaration."),
- A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: diag(1046, ts.DiagnosticCategory.Error, "A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file_1046", "A 'declare' modifier is required for a top level declaration in a .d.ts file."),
+ Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier: diag(1046, ts.DiagnosticCategory.Error, "Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier_1046", "Top-level declarations in .d.ts files must start with either a 'declare' or 'export' modifier."),
A_rest_parameter_cannot_be_optional: diag(1047, ts.DiagnosticCategory.Error, "A_rest_parameter_cannot_be_optional_1047", "A rest parameter cannot be optional."),
A_rest_parameter_cannot_have_an_initializer: diag(1048, ts.DiagnosticCategory.Error, "A_rest_parameter_cannot_have_an_initializer_1048", "A rest parameter cannot have an initializer."),
A_set_accessor_must_have_exactly_one_parameter: diag(1049, ts.DiagnosticCategory.Error, "A_set_accessor_must_have_exactly_one_parameter_1049", "A 'set' accessor must have exactly one parameter."),
@@ -5326,7 +5486,7 @@
Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided: diag(1205, ts.DiagnosticCategory.Error, "Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided_1205", "Cannot re-export a type when the '--isolatedModules' flag is provided."),
Decorators_are_not_valid_here: diag(1206, ts.DiagnosticCategory.Error, "Decorators_are_not_valid_here_1206", "Decorators are not valid here."),
Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: diag(1207, ts.DiagnosticCategory.Error, "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207", "Decorators cannot be applied to multiple get/set accessors of the same name."),
- Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided: diag(1208, ts.DiagnosticCategory.Error, "Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided_1208", "Cannot compile namespaces when the '--isolatedModules' flag is provided."),
+ All_files_must_be_modules_when_the_isolatedModules_flag_is_provided: diag(1208, ts.DiagnosticCategory.Error, "All_files_must_be_modules_when_the_isolatedModules_flag_is_provided_1208", "All files must be modules when the '--isolatedModules' flag is provided."),
Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: diag(1210, ts.DiagnosticCategory.Error, "Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode_1210", "Invalid use of '{0}'. Class definitions are automatically in strict mode."),
A_class_declaration_without_the_default_modifier_must_have_a_name: diag(1211, ts.DiagnosticCategory.Error, "A_class_declaration_without_the_default_modifier_must_have_a_name_1211", "A class declaration without the 'default' modifier must have a name."),
Identifier_expected_0_is_a_reserved_word_in_strict_mode: diag(1212, ts.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_in_strict_mode_1212", "Identifier expected. '{0}' is a reserved word in strict mode."),
@@ -5335,7 +5495,7 @@
Invalid_use_of_0_Modules_are_automatically_in_strict_mode: diag(1215, ts.DiagnosticCategory.Error, "Invalid_use_of_0_Modules_are_automatically_in_strict_mode_1215", "Invalid use of '{0}'. Modules are automatically in strict mode."),
Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules: diag(1216, ts.DiagnosticCategory.Error, "Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules_1216", "Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules."),
Export_assignment_is_not_supported_when_module_flag_is_system: diag(1218, ts.DiagnosticCategory.Error, "Export_assignment_is_not_supported_when_module_flag_is_system_1218", "Export assignment is not supported when '--module' flag is 'system'."),
- Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning: diag(1219, ts.DiagnosticCategory.Error, "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219", "Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning."),
+ Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning: diag(1219, ts.DiagnosticCategory.Error, "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219", "Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning."),
Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher: diag(1220, ts.DiagnosticCategory.Error, "Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher_1220", "Generators are only available when targeting ECMAScript 2015 or higher."),
Generators_are_not_allowed_in_an_ambient_context: diag(1221, ts.DiagnosticCategory.Error, "Generators_are_not_allowed_in_an_ambient_context_1221", "Generators are not allowed in an ambient context."),
An_overload_signature_cannot_be_declared_as_a_generator: diag(1222, ts.DiagnosticCategory.Error, "An_overload_signature_cannot_be_declared_as_a_generator_1222", "An overload signature cannot be declared as a generator."),
@@ -5374,6 +5534,8 @@
A_definite_assignment_assertion_is_not_permitted_in_this_context: diag(1255, ts.DiagnosticCategory.Error, "A_definite_assignment_assertion_is_not_permitted_in_this_context_1255", "A definite assignment assertion '!' is not permitted in this context."),
A_rest_element_must_be_last_in_a_tuple_type: diag(1256, ts.DiagnosticCategory.Error, "A_rest_element_must_be_last_in_a_tuple_type_1256", "A rest element must be last in a tuple type."),
A_required_element_cannot_follow_an_optional_element: diag(1257, ts.DiagnosticCategory.Error, "A_required_element_cannot_follow_an_optional_element_1257", "A required element cannot follow an optional element."),
+ Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation: diag(1258, ts.DiagnosticCategory.Error, "Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation_1258", "Definite assignment assertions can only be used along with a type annotation."),
+ Module_0_can_only_be_default_imported_using_the_1_flag: diag(1259, ts.DiagnosticCategory.Error, "Module_0_can_only_be_default_imported_using_the_1_flag_1259", "Module '{0}' can only be default-imported using the '{1}' flag"),
with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
await_expression_is_only_allowed_within_an_async_function: diag(1308, ts.DiagnosticCategory.Error, "await_expression_is_only_allowed_within_an_async_function_1308", "'await' expression is only allowed within an async function."),
can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment: diag(1312, ts.DiagnosticCategory.Error, "can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment_1312", "'=' can only be used in an object literal property inside a destructuring assignment."),
@@ -5418,7 +5580,8 @@
A_bigint_literal_cannot_use_exponential_notation: diag(1352, ts.DiagnosticCategory.Error, "A_bigint_literal_cannot_use_exponential_notation_1352", "A bigint literal cannot use exponential notation."),
A_bigint_literal_must_be_an_integer: diag(1353, ts.DiagnosticCategory.Error, "A_bigint_literal_must_be_an_integer_1353", "A bigint literal must be an integer."),
readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types: diag(1354, ts.DiagnosticCategory.Error, "readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types_1354", "'readonly' type modifier is only permitted on array and tuple literal types."),
- A_const_assertion_can_only_be_applied_to_a_string_number_boolean_array_or_object_literal: diag(1355, ts.DiagnosticCategory.Error, "A_const_assertion_can_only_be_applied_to_a_string_number_boolean_array_or_object_literal_1355", "A 'const' assertion can only be applied to a string, number, boolean, array, or object literal."),
+ A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals: diag(1355, ts.DiagnosticCategory.Error, "A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array__1355", "A 'const' assertions can only be applied to references to enum members, or string, number, boolean, array, or object literals."),
+ Did_you_mean_to_mark_this_function_as_async: diag(1356, ts.DiagnosticCategory.Error, "Did_you_mean_to_mark_this_function_as_async_1356", "Did you mean to mark this function as 'async'?"),
Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2301, ts.DiagnosticCategory.Error, "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
Static_members_cannot_reference_class_type_parameters: diag(2302, ts.DiagnosticCategory.Error, "Static_members_cannot_reference_class_type_parameters_2302", "Static members cannot reference class type parameters."),
@@ -5700,6 +5863,7 @@
Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig: diag(2591, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_types_Slashnode_and_th_2591", "Cannot find name '{0}'. Do you need to install type definitions for node? Try `npm i @types/node` and then add `node` to the types field in your tsconfig."),
Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_types_Slashjquery_and_then_add_jquery_to_the_types_field_in_your_tsconfig: diag(2592, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_types_Slashjquery_an_2592", "Cannot find name '{0}'. Do you need to install type definitions for jQuery? Try `npm i @types/jquery` and then add `jquery` to the types field in your tsconfig."),
Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_types_Slashjest_or_npm_i_types_Slashmocha_and_then_add_jest_or_mocha_to_the_types_field_in_your_tsconfig: diag(2593, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_types_Slashje_2593", "Cannot find name '{0}'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig."),
+ This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag: diag(2594, ts.DiagnosticCategory.Error, "This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594", "This module is declared with using 'export =', and can only be used with a default import when using the '{0}' flag."),
JSX_element_attributes_type_0_may_not_be_a_union_type: diag(2600, ts.DiagnosticCategory.Error, "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", "JSX element attributes type '{0}' may not be a union type."),
The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: diag(2601, ts.DiagnosticCategory.Error, "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", "The return type of a JSX element constructor must return an object type."),
JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: diag(2602, ts.DiagnosticCategory.Error, "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist."),
@@ -5812,6 +5976,7 @@
Circularity_originates_in_type_at_this_location: diag(2751, ts.DiagnosticCategory.Error, "Circularity_originates_in_type_at_this_location_2751", "Circularity originates in type at this location."),
The_first_export_default_is_here: diag(2752, ts.DiagnosticCategory.Error, "The_first_export_default_is_here_2752", "The first export default is here."),
Another_export_default_is_here: diag(2753, ts.DiagnosticCategory.Error, "Another_export_default_is_here_2753", "Another export default is here."),
+ super_may_not_use_type_arguments: diag(2754, ts.DiagnosticCategory.Error, "super_may_not_use_type_arguments_2754", "'super' may not use type arguments."),
Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -5896,6 +6061,7 @@
Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4101, ts.DiagnosticCategory.Error, "Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2_4101", "Method '{0}' of exported interface has or is using name '{1}' from private module '{2}'."),
Method_0_of_exported_interface_has_or_is_using_private_name_1: diag(4102, ts.DiagnosticCategory.Error, "Method_0_of_exported_interface_has_or_is_using_private_name_1_4102", "Method '{0}' of exported interface has or is using private name '{1}'."),
Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1: diag(4103, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1_4103", "Type parameter '{0}' of exported mapped object type is using private name '{1}'."),
+ The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1: diag(4104, ts.DiagnosticCategory.Error, "The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1_4104", "The type '{0}' is 'readonly' and cannot be assigned to the mutable type '{1}'."),
The_current_host_does_not_support_the_0_option: diag(5001, ts.DiagnosticCategory.Error, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, ts.DiagnosticCategory.Error, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, ts.DiagnosticCategory.Error, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
@@ -5929,6 +6095,8 @@
Option_resolveJsonModule_can_only_be_specified_when_module_code_generation_is_commonjs_amd_es2015_or_esNext: diag(5071, ts.DiagnosticCategory.Error, "Option_resolveJsonModule_can_only_be_specified_when_module_code_generation_is_commonjs_amd_es2015_or_5071", "Option '--resolveJsonModule' can only be specified when module code generation is 'commonjs', 'amd', 'es2015' or 'esNext'."),
Unknown_build_option_0: diag(5072, ts.DiagnosticCategory.Error, "Unknown_build_option_0_5072", "Unknown build option '{0}'."),
Build_option_0_requires_a_value_of_type_1: diag(5073, ts.DiagnosticCategory.Error, "Build_option_0_requires_a_value_of_type_1_5073", "Build option '{0}' requires a value of type {1}."),
+ Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified: diag(5074, ts.DiagnosticCategory.Error, "Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBui_5074", "Option '--incremental' can only be specified using tsconfig, emitting to single file or when option `--tsBuildInfoFile` is specified."),
+ _0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_constraint_2: diag(5075, ts.DiagnosticCategory.Error, "_0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_5075", "'{0}' is assignable to the constraint of type '{1}', but '{1}' could be instantiated with a different subtype of constraint '{2}'."),
Generates_a_sourcemap_for_each_corresponding_d_ts_file: diag(6000, ts.DiagnosticCategory.Message, "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000", "Generates a sourcemap for each corresponding '.d.ts' file."),
Concatenate_and_emit_output_to_single_file: diag(6001, ts.DiagnosticCategory.Message, "Concatenate_and_emit_output_to_single_file_6001", "Concatenate and emit output to single file."),
Generates_corresponding_d_ts_file: diag(6002, ts.DiagnosticCategory.Message, "Generates_corresponding_d_ts_file_6002", "Generates corresponding '.d.ts' file."),
@@ -6105,7 +6273,6 @@
Enable_strict_checking_of_property_initialization_in_classes: diag(6187, ts.DiagnosticCategory.Message, "Enable_strict_checking_of_property_initialization_in_classes_6187", "Enable strict checking of property initialization in classes."),
Numeric_separators_are_not_allowed_here: diag(6188, ts.DiagnosticCategory.Error, "Numeric_separators_are_not_allowed_here_6188", "Numeric separators are not allowed here."),
Multiple_consecutive_numeric_separators_are_not_permitted: diag(6189, ts.DiagnosticCategory.Error, "Multiple_consecutive_numeric_separators_are_not_permitted_6189", "Multiple consecutive numeric separators are not permitted."),
- Found_package_json_at_0_Package_ID_is_1: diag(6190, ts.DiagnosticCategory.Message, "Found_package_json_at_0_Package_ID_is_1_6190", "Found 'package.json' at '{0}'. Package ID is '{1}'."),
Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen: diag(6191, ts.DiagnosticCategory.Message, "Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen_6191", "Whether to keep outdated console output in watch mode instead of clearing the screen."),
All_imports_in_import_declaration_are_unused: diag(6192, ts.DiagnosticCategory.Error, "All_imports_in_import_declaration_are_unused_6192", "All imports in import declaration are unused.", /*reportsUnnecessary*/ true),
Found_1_error_Watching_for_file_changes: diag(6193, ts.DiagnosticCategory.Message, "Found_1_error_Watching_for_file_changes_6193", "Found 1 error. Watching for file changes."),
@@ -6132,6 +6299,9 @@
Using_compiler_options_of_project_reference_redirect_0: diag(6215, ts.DiagnosticCategory.Message, "Using_compiler_options_of_project_reference_redirect_0_6215", "Using compiler options of project reference redirect '{0}'."),
Found_1_error: diag(6216, ts.DiagnosticCategory.Message, "Found_1_error_6216", "Found 1 error."),
Found_0_errors: diag(6217, ts.DiagnosticCategory.Message, "Found_0_errors_6217", "Found {0} errors."),
+ Module_name_0_was_successfully_resolved_to_1_with_Package_ID_2: diag(6218, ts.DiagnosticCategory.Message, "Module_name_0_was_successfully_resolved_to_1_with_Package_ID_2_6218", "======== Module name '{0}' was successfully resolved to '{1}' with Package ID '{2}'. ========"),
+ Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3: diag(6219, ts.DiagnosticCategory.Message, "Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3_6219", "======== Type reference directive '{0}' was successfully resolved to '{1}' with Package ID '{2}', primary: {3}. ========"),
+ package_json_had_a_falsy_0_field: diag(6220, ts.DiagnosticCategory.Message, "package_json_had_a_falsy_0_field_6220", "'package.json' had a falsy '{0}' field."),
Projects_to_reference: diag(6300, ts.DiagnosticCategory.Message, "Projects_to_reference_6300", "Projects to reference"),
Enable_project_compilation: diag(6302, ts.DiagnosticCategory.Message, "Enable_project_compilation_6302", "Enable project compilation"),
Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0: diag(6202, ts.DiagnosticCategory.Error, "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202", "Project references may not form a circular graph. Cycle detected: {0}"),
@@ -6220,6 +6390,9 @@
Property_0_implicitly_has_type_any_but_a_better_type_for_its_set_accessor_may_be_inferred_from_usage: diag(7049, ts.DiagnosticCategory.Suggestion, "Property_0_implicitly_has_type_any_but_a_better_type_for_its_set_accessor_may_be_inferred_from_usage_7049", "Property '{0}' implicitly has type 'any', but a better type for its set accessor may be inferred from usage."),
_0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage: diag(7050, ts.DiagnosticCategory.Suggestion, "_0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage_7050", "'{0}' implicitly has an '{1}' return type, but a better type may be inferred from usage."),
Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1: diag(7051, ts.DiagnosticCategory.Error, "Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1_7051", "Parameter has a name but no type. Did you mean '{0}: {1}'?"),
+ Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1: diag(7052, ts.DiagnosticCategory.Error, "Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1_7052", "Element implicitly has an 'any' type because type '{0}' has no index signature. Did you mean to call '{1}' ?"),
+ Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1: diag(7053, ts.DiagnosticCategory.Error, "Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1_7053", "Element implicitly has an 'any' type because expression of type '{0}' can't be used to index type '{1}'."),
+ No_index_signature_with_a_parameter_of_type_0_was_found_on_type_1: diag(7054, ts.DiagnosticCategory.Error, "No_index_signature_with_a_parameter_of_type_0_was_found_on_type_1_7054", "No index signature with a parameter of type '{0}' was found on type '{1}'."),
You_cannot_rename_this_element: diag(8000, ts.DiagnosticCategory.Error, "You_cannot_rename_this_element_8000", "You cannot rename this element."),
You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: diag(8001, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001", "You cannot rename elements that are defined in the standard TypeScript library."),
import_can_only_be_used_in_a_ts_file: diag(8002, ts.DiagnosticCategory.Error, "import_can_only_be_used_in_a_ts_file_8002", "'import ... =' can only be used in a .ts file."),
@@ -6381,8 +6554,6 @@
Add_all_missing_imports: diag(95064, ts.DiagnosticCategory.Message, "Add_all_missing_imports_95064", "Add all missing imports"),
Convert_to_async_function: diag(95065, ts.DiagnosticCategory.Message, "Convert_to_async_function_95065", "Convert to async function"),
Convert_all_to_async_functions: diag(95066, ts.DiagnosticCategory.Message, "Convert_all_to_async_functions_95066", "Convert all to async functions"),
- Generate_types_for_0: diag(95067, ts.DiagnosticCategory.Message, "Generate_types_for_0_95067", "Generate types for '{0}'"),
- Generate_types_for_all_packages_without_types: diag(95068, ts.DiagnosticCategory.Message, "Generate_types_for_all_packages_without_types_95068", "Generate types for all packages without types"),
Add_unknown_conversion_for_non_overlapping_types: diag(95069, ts.DiagnosticCategory.Message, "Add_unknown_conversion_for_non_overlapping_types_95069", "Add 'unknown' conversion for non-overlapping types"),
Add_unknown_to_all_conversions_of_non_overlapping_types: diag(95070, ts.DiagnosticCategory.Message, "Add_unknown_to_all_conversions_of_non_overlapping_types_95070", "Add 'unknown' to all conversions of non-overlapping types"),
Add_missing_new_operator_to_call: diag(95071, ts.DiagnosticCategory.Message, "Add_missing_new_operator_to_call_95071", "Add missing 'new' operator to call"),
@@ -6390,6 +6561,13 @@
Add_names_to_all_parameters_without_names: diag(95073, ts.DiagnosticCategory.Message, "Add_names_to_all_parameters_without_names_95073", "Add names to all parameters without names"),
Enable_the_experimentalDecorators_option_in_your_configuration_file: diag(95074, ts.DiagnosticCategory.Message, "Enable_the_experimentalDecorators_option_in_your_configuration_file_95074", "Enable the 'experimentalDecorators' option in your configuration file"),
Convert_parameters_to_destructured_object: diag(95075, ts.DiagnosticCategory.Message, "Convert_parameters_to_destructured_object_95075", "Convert parameters to destructured object"),
+ Allow_accessing_UMD_globals_from_modules: diag(95076, ts.DiagnosticCategory.Message, "Allow_accessing_UMD_globals_from_modules_95076", "Allow accessing UMD globals from modules."),
+ Extract_type: diag(95077, ts.DiagnosticCategory.Message, "Extract_type_95077", "Extract type"),
+ Extract_to_type_alias: diag(95078, ts.DiagnosticCategory.Message, "Extract_to_type_alias_95078", "Extract to type alias"),
+ Extract_to_typedef: diag(95079, ts.DiagnosticCategory.Message, "Extract_to_typedef_95079", "Extract to typedef"),
+ No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, ts.DiagnosticCategory.Error, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
+ Quoted_constructors_have_previously_been_interpreted_as_methods_which_is_incorrect_In_TypeScript_3_6_they_will_be_correctly_parsed_as_constructors_In_the_meantime_consider_using_constructor_to_write_a_constructor_or_constructor_to_write_a_method: diag(18005, ts.DiagnosticCategory.Error, "Quoted_constructors_have_previously_been_interpreted_as_methods_which_is_incorrect_In_TypeScript_3_6_18005", "Quoted constructors have previously been interpreted as methods, which is incorrect. In TypeScript 3.6, they will be correctly parsed as constructors. In the meantime, consider using 'constructor()' to write a constructor, or '[\"constructor\"]()' to write a method."),
+ Classes_may_not_have_a_field_named_constructor: diag(18006, ts.DiagnosticCategory.Error, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
};
})(ts || (ts = {}));
var ts;
@@ -6397,7 +6575,7 @@
var _a;
/* @internal */
function tokenIsIdentifierOrKeyword(token) {
- return token >= 72 /* Identifier */;
+ return token >= 73 /* Identifier */;
}
ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword;
/* @internal */
@@ -6406,85 +6584,85 @@
}
ts.tokenIsIdentifierOrKeywordOrGreaterThan = tokenIsIdentifierOrKeywordOrGreaterThan;
var textToKeywordObj = (_a = {
- abstract: 118 /* AbstractKeyword */,
- any: 120 /* AnyKeyword */,
- as: 119 /* AsKeyword */,
- bigint: 146 /* BigIntKeyword */,
- boolean: 123 /* BooleanKeyword */,
- break: 73 /* BreakKeyword */,
- case: 74 /* CaseKeyword */,
- catch: 75 /* CatchKeyword */,
- class: 76 /* ClassKeyword */,
- continue: 78 /* ContinueKeyword */,
- const: 77 /* ConstKeyword */
- },
- _a["" + "constructor"] = 124 /* ConstructorKeyword */,
- _a.debugger = 79 /* DebuggerKeyword */,
- _a.declare = 125 /* DeclareKeyword */,
- _a.default = 80 /* DefaultKeyword */,
- _a.delete = 81 /* DeleteKeyword */,
- _a.do = 82 /* DoKeyword */,
- _a.else = 83 /* ElseKeyword */,
- _a.enum = 84 /* EnumKeyword */,
- _a.export = 85 /* ExportKeyword */,
- _a.extends = 86 /* ExtendsKeyword */,
- _a.false = 87 /* FalseKeyword */,
- _a.finally = 88 /* FinallyKeyword */,
- _a.for = 89 /* ForKeyword */,
- _a.from = 144 /* FromKeyword */,
- _a.function = 90 /* FunctionKeyword */,
- _a.get = 126 /* GetKeyword */,
- _a.if = 91 /* IfKeyword */,
- _a.implements = 109 /* ImplementsKeyword */,
- _a.import = 92 /* ImportKeyword */,
- _a.in = 93 /* InKeyword */,
- _a.infer = 127 /* InferKeyword */,
- _a.instanceof = 94 /* InstanceOfKeyword */,
- _a.interface = 110 /* InterfaceKeyword */,
- _a.is = 128 /* IsKeyword */,
- _a.keyof = 129 /* KeyOfKeyword */,
- _a.let = 111 /* LetKeyword */,
- _a.module = 130 /* ModuleKeyword */,
- _a.namespace = 131 /* NamespaceKeyword */,
- _a.never = 132 /* NeverKeyword */,
- _a.new = 95 /* NewKeyword */,
- _a.null = 96 /* NullKeyword */,
- _a.number = 135 /* NumberKeyword */,
- _a.object = 136 /* ObjectKeyword */,
- _a.package = 112 /* PackageKeyword */,
- _a.private = 113 /* PrivateKeyword */,
- _a.protected = 114 /* ProtectedKeyword */,
- _a.public = 115 /* PublicKeyword */,
- _a.readonly = 133 /* ReadonlyKeyword */,
- _a.require = 134 /* RequireKeyword */,
- _a.global = 145 /* GlobalKeyword */,
- _a.return = 97 /* ReturnKeyword */,
- _a.set = 137 /* SetKeyword */,
- _a.static = 116 /* StaticKeyword */,
- _a.string = 138 /* StringKeyword */,
- _a.super = 98 /* SuperKeyword */,
- _a.switch = 99 /* SwitchKeyword */,
- _a.symbol = 139 /* SymbolKeyword */,
- _a.this = 100 /* ThisKeyword */,
- _a.throw = 101 /* ThrowKeyword */,
- _a.true = 102 /* TrueKeyword */,
- _a.try = 103 /* TryKeyword */,
- _a.type = 140 /* TypeKeyword */,
- _a.typeof = 104 /* TypeOfKeyword */,
- _a.undefined = 141 /* UndefinedKeyword */,
- _a.unique = 142 /* UniqueKeyword */,
- _a.unknown = 143 /* UnknownKeyword */,
- _a.var = 105 /* VarKeyword */,
- _a.void = 106 /* VoidKeyword */,
- _a.while = 107 /* WhileKeyword */,
- _a.with = 108 /* WithKeyword */,
- _a.yield = 117 /* YieldKeyword */,
- _a.async = 121 /* AsyncKeyword */,
- _a.await = 122 /* AwaitKeyword */,
- _a.of = 147 /* OfKeyword */,
+ abstract: 119 /* AbstractKeyword */,
+ any: 121 /* AnyKeyword */,
+ as: 120 /* AsKeyword */,
+ bigint: 147 /* BigIntKeyword */,
+ boolean: 124 /* BooleanKeyword */,
+ break: 74 /* BreakKeyword */,
+ case: 75 /* CaseKeyword */,
+ catch: 76 /* CatchKeyword */,
+ class: 77 /* ClassKeyword */,
+ continue: 79 /* ContinueKeyword */,
+ const: 78 /* ConstKeyword */
+ },
+ _a["" + "constructor"] = 125 /* ConstructorKeyword */,
+ _a.debugger = 80 /* DebuggerKeyword */,
+ _a.declare = 126 /* DeclareKeyword */,
+ _a.default = 81 /* DefaultKeyword */,
+ _a.delete = 82 /* DeleteKeyword */,
+ _a.do = 83 /* DoKeyword */,
+ _a.else = 84 /* ElseKeyword */,
+ _a.enum = 85 /* EnumKeyword */,
+ _a.export = 86 /* ExportKeyword */,
+ _a.extends = 87 /* ExtendsKeyword */,
+ _a.false = 88 /* FalseKeyword */,
+ _a.finally = 89 /* FinallyKeyword */,
+ _a.for = 90 /* ForKeyword */,
+ _a.from = 145 /* FromKeyword */,
+ _a.function = 91 /* FunctionKeyword */,
+ _a.get = 127 /* GetKeyword */,
+ _a.if = 92 /* IfKeyword */,
+ _a.implements = 110 /* ImplementsKeyword */,
+ _a.import = 93 /* ImportKeyword */,
+ _a.in = 94 /* InKeyword */,
+ _a.infer = 128 /* InferKeyword */,
+ _a.instanceof = 95 /* InstanceOfKeyword */,
+ _a.interface = 111 /* InterfaceKeyword */,
+ _a.is = 129 /* IsKeyword */,
+ _a.keyof = 130 /* KeyOfKeyword */,
+ _a.let = 112 /* LetKeyword */,
+ _a.module = 131 /* ModuleKeyword */,
+ _a.namespace = 132 /* NamespaceKeyword */,
+ _a.never = 133 /* NeverKeyword */,
+ _a.new = 96 /* NewKeyword */,
+ _a.null = 97 /* NullKeyword */,
+ _a.number = 136 /* NumberKeyword */,
+ _a.object = 137 /* ObjectKeyword */,
+ _a.package = 113 /* PackageKeyword */,
+ _a.private = 114 /* PrivateKeyword */,
+ _a.protected = 115 /* ProtectedKeyword */,
+ _a.public = 116 /* PublicKeyword */,
+ _a.readonly = 134 /* ReadonlyKeyword */,
+ _a.require = 135 /* RequireKeyword */,
+ _a.global = 146 /* GlobalKeyword */,
+ _a.return = 98 /* ReturnKeyword */,
+ _a.set = 138 /* SetKeyword */,
+ _a.static = 117 /* StaticKeyword */,
+ _a.string = 139 /* StringKeyword */,
+ _a.super = 99 /* SuperKeyword */,
+ _a.switch = 100 /* SwitchKeyword */,
+ _a.symbol = 140 /* SymbolKeyword */,
+ _a.this = 101 /* ThisKeyword */,
+ _a.throw = 102 /* ThrowKeyword */,
+ _a.true = 103 /* TrueKeyword */,
+ _a.try = 104 /* TryKeyword */,
+ _a.type = 141 /* TypeKeyword */,
+ _a.typeof = 105 /* TypeOfKeyword */,
+ _a.undefined = 142 /* UndefinedKeyword */,
+ _a.unique = 143 /* UniqueKeyword */,
+ _a.unknown = 144 /* UnknownKeyword */,
+ _a.var = 106 /* VarKeyword */,
+ _a.void = 107 /* VoidKeyword */,
+ _a.while = 108 /* WhileKeyword */,
+ _a.with = 109 /* WithKeyword */,
+ _a.yield = 118 /* YieldKeyword */,
+ _a.async = 122 /* AsyncKeyword */,
+ _a.await = 123 /* AwaitKeyword */,
+ _a.of = 148 /* OfKeyword */,
_a);
var textToKeyword = ts.createMapFromTemplate(textToKeywordObj);
- var textToToken = ts.createMapFromTemplate(__assign({}, textToKeywordObj, { "{": 18 /* OpenBraceToken */, "}": 19 /* CloseBraceToken */, "(": 20 /* OpenParenToken */, ")": 21 /* CloseParenToken */, "[": 22 /* OpenBracketToken */, "]": 23 /* CloseBracketToken */, ".": 24 /* DotToken */, "...": 25 /* DotDotDotToken */, ";": 26 /* SemicolonToken */, ",": 27 /* CommaToken */, "<": 28 /* LessThanToken */, ">": 30 /* GreaterThanToken */, "<=": 31 /* LessThanEqualsToken */, ">=": 32 /* GreaterThanEqualsToken */, "==": 33 /* EqualsEqualsToken */, "!=": 34 /* ExclamationEqualsToken */, "===": 35 /* EqualsEqualsEqualsToken */, "!==": 36 /* ExclamationEqualsEqualsToken */, "=>": 37 /* EqualsGreaterThanToken */, "+": 38 /* PlusToken */, "-": 39 /* MinusToken */, "**": 41 /* AsteriskAsteriskToken */, "*": 40 /* AsteriskToken */, "/": 42 /* SlashToken */, "%": 43 /* PercentToken */, "++": 44 /* PlusPlusToken */, "--": 45 /* MinusMinusToken */, "<<": 46 /* LessThanLessThanToken */, "</": 29 /* LessThanSlashToken */, ">>": 47 /* GreaterThanGreaterThanToken */, ">>>": 48 /* GreaterThanGreaterThanGreaterThanToken */, "&": 49 /* AmpersandToken */, "|": 50 /* BarToken */, "^": 51 /* CaretToken */, "!": 52 /* ExclamationToken */, "~": 53 /* TildeToken */, "&&": 54 /* AmpersandAmpersandToken */, "||": 55 /* BarBarToken */, "?": 56 /* QuestionToken */, ":": 57 /* ColonToken */, "=": 59 /* EqualsToken */, "+=": 60 /* PlusEqualsToken */, "-=": 61 /* MinusEqualsToken */, "*=": 62 /* AsteriskEqualsToken */, "**=": 63 /* AsteriskAsteriskEqualsToken */, "/=": 64 /* SlashEqualsToken */, "%=": 65 /* PercentEqualsToken */, "<<=": 66 /* LessThanLessThanEqualsToken */, ">>=": 67 /* GreaterThanGreaterThanEqualsToken */, ">>>=": 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */, "&=": 69 /* AmpersandEqualsToken */, "|=": 70 /* BarEqualsToken */, "^=": 71 /* CaretEqualsToken */, "@": 58 /* AtToken */ }));
+ var textToToken = ts.createMapFromTemplate(__assign({}, textToKeywordObj, { "{": 18 /* OpenBraceToken */, "}": 19 /* CloseBraceToken */, "(": 20 /* OpenParenToken */, ")": 21 /* CloseParenToken */, "[": 22 /* OpenBracketToken */, "]": 23 /* CloseBracketToken */, ".": 24 /* DotToken */, "...": 25 /* DotDotDotToken */, ";": 26 /* SemicolonToken */, ",": 27 /* CommaToken */, "<": 28 /* LessThanToken */, ">": 30 /* GreaterThanToken */, "<=": 31 /* LessThanEqualsToken */, ">=": 32 /* GreaterThanEqualsToken */, "==": 33 /* EqualsEqualsToken */, "!=": 34 /* ExclamationEqualsToken */, "===": 35 /* EqualsEqualsEqualsToken */, "!==": 36 /* ExclamationEqualsEqualsToken */, "=>": 37 /* EqualsGreaterThanToken */, "+": 38 /* PlusToken */, "-": 39 /* MinusToken */, "**": 41 /* AsteriskAsteriskToken */, "*": 40 /* AsteriskToken */, "/": 42 /* SlashToken */, "%": 43 /* PercentToken */, "++": 44 /* PlusPlusToken */, "--": 45 /* MinusMinusToken */, "<<": 46 /* LessThanLessThanToken */, "</": 29 /* LessThanSlashToken */, ">>": 47 /* GreaterThanGreaterThanToken */, ">>>": 48 /* GreaterThanGreaterThanGreaterThanToken */, "&": 49 /* AmpersandToken */, "|": 50 /* BarToken */, "^": 51 /* CaretToken */, "!": 52 /* ExclamationToken */, "~": 53 /* TildeToken */, "&&": 54 /* AmpersandAmpersandToken */, "||": 55 /* BarBarToken */, "?": 56 /* QuestionToken */, ":": 57 /* ColonToken */, "=": 60 /* EqualsToken */, "+=": 61 /* PlusEqualsToken */, "-=": 62 /* MinusEqualsToken */, "*=": 63 /* AsteriskEqualsToken */, "**=": 64 /* AsteriskAsteriskEqualsToken */, "/=": 65 /* SlashEqualsToken */, "%=": 66 /* PercentEqualsToken */, "<<=": 67 /* LessThanLessThanEqualsToken */, ">>=": 68 /* GreaterThanGreaterThanEqualsToken */, ">>>=": 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */, "&=": 70 /* AmpersandEqualsToken */, "|=": 71 /* BarEqualsToken */, "^=": 72 /* CaretEqualsToken */, "@": 58 /* AtToken */ }));
/*
As per ECMAScript Language Specification 3th Edition, Section 7.6: Identifiers
IdentifierStart ::
@@ -7098,8 +7276,8 @@
getTokenValue: function () { return tokenValue; },
hasExtendedUnicodeEscape: function () { return (tokenFlags & 8 /* ExtendedUnicodeEscape */) !== 0; },
hasPrecedingLineBreak: function () { return (tokenFlags & 1 /* PrecedingLineBreak */) !== 0; },
- isIdentifier: function () { return token === 72 /* Identifier */ || token > 108 /* LastReservedWord */; },
- isReservedWord: function () { return token >= 73 /* FirstReservedWord */ && token <= 108 /* LastReservedWord */; },
+ isIdentifier: function () { return token === 73 /* Identifier */ || token > 109 /* LastReservedWord */; },
+ isReservedWord: function () { return token >= 74 /* FirstReservedWord */ && token <= 109 /* LastReservedWord */; },
isUnterminated: function () { return (tokenFlags & 4 /* Unterminated */) !== 0; },
getTokenFlags: function () { return tokenFlags; },
reScanGreaterToken: reScanGreaterToken,
@@ -7110,7 +7288,7 @@
reScanJsxToken: reScanJsxToken,
reScanLessThanToken: reScanLessThanToken,
scanJsxToken: scanJsxToken,
- scanJSDocToken: scanJSDocToken,
+ scanJsDocToken: scanJsDocToken,
scan: scan,
getText: getText,
setText: setText,
@@ -7550,7 +7728,7 @@
}
}
}
- return token = 72 /* Identifier */;
+ return token = 73 /* Identifier */;
}
function scanBinaryOrOctalDigits(base) {
var value = "";
@@ -7699,7 +7877,7 @@
return token = scanTemplateAndSetTokenValue();
case 37 /* percent */:
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 65 /* PercentEqualsToken */;
+ return pos += 2, token = 66 /* PercentEqualsToken */;
}
pos++;
return token = 43 /* PercentToken */;
@@ -7708,7 +7886,7 @@
return pos += 2, token = 54 /* AmpersandAmpersandToken */;
}
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 69 /* AmpersandEqualsToken */;
+ return pos += 2, token = 70 /* AmpersandEqualsToken */;
}
pos++;
return token = 49 /* AmpersandToken */;
@@ -7720,11 +7898,11 @@
return token = 21 /* CloseParenToken */;
case 42 /* asterisk */:
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 62 /* AsteriskEqualsToken */;
+ return pos += 2, token = 63 /* AsteriskEqualsToken */;
}
if (text.charCodeAt(pos + 1) === 42 /* asterisk */) {
if (text.charCodeAt(pos + 2) === 61 /* equals */) {
- return pos += 3, token = 63 /* AsteriskAsteriskEqualsToken */;
+ return pos += 3, token = 64 /* AsteriskAsteriskEqualsToken */;
}
return pos += 2, token = 41 /* AsteriskAsteriskToken */;
}
@@ -7740,7 +7918,7 @@
return pos += 2, token = 44 /* PlusPlusToken */;
}
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 60 /* PlusEqualsToken */;
+ return pos += 2, token = 61 /* PlusEqualsToken */;
}
pos++;
return token = 38 /* PlusToken */;
@@ -7752,7 +7930,7 @@
return pos += 2, token = 45 /* MinusMinusToken */;
}
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 61 /* MinusEqualsToken */;
+ return pos += 2, token = 62 /* MinusEqualsToken */;
}
pos++;
return token = 39 /* MinusToken */;
@@ -7816,7 +7994,7 @@
}
}
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 64 /* SlashEqualsToken */;
+ return pos += 2, token = 65 /* SlashEqualsToken */;
}
pos++;
return token = 42 /* SlashToken */;
@@ -7893,7 +8071,7 @@
}
if (text.charCodeAt(pos + 1) === 60 /* lessThan */) {
if (text.charCodeAt(pos + 2) === 61 /* equals */) {
- return pos += 3, token = 66 /* LessThanLessThanEqualsToken */;
+ return pos += 3, token = 67 /* LessThanLessThanEqualsToken */;
}
return pos += 2, token = 46 /* LessThanLessThanToken */;
}
@@ -7927,7 +8105,7 @@
return pos += 2, token = 37 /* EqualsGreaterThanToken */;
}
pos++;
- return token = 59 /* EqualsToken */;
+ return token = 60 /* EqualsToken */;
case 62 /* greaterThan */:
if (isConflictMarkerTrivia(text, pos)) {
pos = scanConflictMarkerTrivia(text, pos, error);
@@ -7951,7 +8129,7 @@
return token = 23 /* CloseBracketToken */;
case 94 /* caret */:
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 71 /* CaretEqualsToken */;
+ return pos += 2, token = 72 /* CaretEqualsToken */;
}
pos++;
return token = 51 /* CaretToken */;
@@ -7972,7 +8150,7 @@
return pos += 2, token = 55 /* BarBarToken */;
}
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 70 /* BarEqualsToken */;
+ return pos += 2, token = 71 /* BarEqualsToken */;
}
pos++;
return token = 50 /* BarToken */;
@@ -8026,12 +8204,12 @@
if (text.charCodeAt(pos) === 62 /* greaterThan */) {
if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) {
if (text.charCodeAt(pos + 2) === 61 /* equals */) {
- return pos += 3, token = 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */;
+ return pos += 3, token = 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */;
}
return pos += 2, token = 48 /* GreaterThanGreaterThanGreaterThanToken */;
}
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 67 /* GreaterThanGreaterThanEqualsToken */;
+ return pos += 2, token = 68 /* GreaterThanGreaterThanEqualsToken */;
}
pos++;
return token = 47 /* GreaterThanGreaterThanToken */;
@@ -8044,7 +8222,7 @@
return token;
}
function reScanSlashToken() {
- if (token === 42 /* SlashToken */ || token === 64 /* SlashEqualsToken */) {
+ if (token === 42 /* SlashToken */ || token === 65 /* SlashEqualsToken */) {
var p = tokenPos + 1;
var inEscape = false;
var inCharacterClass = false;
@@ -8193,7 +8371,7 @@
return scan();
}
}
- function scanJSDocToken() {
+ function scanJsDocToken() {
startPos = tokenPos = pos;
tokenFlags = 0;
if (pos >= end) {
@@ -8229,21 +8407,16 @@
case 60 /* lessThan */:
return token = 28 /* LessThanToken */;
case 61 /* equals */:
- return token = 59 /* EqualsToken */;
+ return token = 60 /* EqualsToken */;
case 44 /* comma */:
return token = 27 /* CommaToken */;
case 46 /* dot */:
return token = 24 /* DotToken */;
case 96 /* backtick */:
- while (pos < end && text.charCodeAt(pos) !== 96 /* backtick */) {
- pos++;
- }
- tokenValue = text.substring(tokenPos + 1, pos);
- pos++;
- return token = 14 /* NoSubstitutionTemplateLiteral */;
+ return token = 59 /* BacktickToken */;
}
- if (isIdentifierStart(ch, 7 /* Latest */)) {
- while (isIdentifierPart(text.charCodeAt(pos), 7 /* Latest */) && pos < end) {
+ if (isIdentifierStart(ch, 8 /* Latest */)) {
+ while (isIdentifierPart(text.charCodeAt(pos), 8 /* Latest */) && pos < end) {
pos++;
}
tokenValue = text.substring(tokenPos, pos);
@@ -8428,11 +8601,16 @@
}
ts.toPath = toPath;
function changesAffectModuleResolution(oldOptions, newOptions) {
- return oldOptions.configFilePath !== newOptions.configFilePath || ts.moduleResolutionOptionDeclarations.some(function (o) {
+ return oldOptions.configFilePath !== newOptions.configFilePath ||
+ optionsHaveModuleResolutionChanges(oldOptions, newOptions);
+ }
+ ts.changesAffectModuleResolution = changesAffectModuleResolution;
+ function optionsHaveModuleResolutionChanges(oldOptions, newOptions) {
+ return ts.moduleResolutionOptionDeclarations.some(function (o) {
return !ts.isJsonEqual(ts.getCompilerOptionValue(oldOptions, o), ts.getCompilerOptionValue(newOptions, o));
});
}
- ts.changesAffectModuleResolution = changesAffectModuleResolution;
+ ts.optionsHaveModuleResolutionChanges = optionsHaveModuleResolutionChanges;
function findAncestor(node, callback) {
while (node) {
var result = callback(node);
@@ -8601,7 +8779,7 @@
}
}
function getSourceFileOfNode(node) {
- while (node && node.kind !== 284 /* SourceFile */) {
+ while (node && node.kind !== 285 /* SourceFile */) {
node = node.parent;
}
return node;
@@ -8609,11 +8787,11 @@
ts.getSourceFileOfNode = getSourceFileOfNode;
function isStatementWithLocals(node) {
switch (node.kind) {
- case 218 /* Block */:
- case 246 /* CaseBlock */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 219 /* Block */:
+ case 247 /* CaseBlock */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
return true;
}
return false;
@@ -8781,7 +8959,7 @@
// the syntax list itself considers them as normal trivia. Therefore if we simply skip
// trivia for the list, we may have skipped the JSDocComment as well. So we should process its
// first child to determine the actual position of its first token.
- if (node.kind === 311 /* SyntaxList */ && node._children.length > 0) {
+ if (node.kind === 312 /* SyntaxList */ && node._children.length > 0) {
return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc);
}
return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos);
@@ -8800,7 +8978,7 @@
}
ts.getSourceTextOfNodeFromSourceFile = getSourceTextOfNodeFromSourceFile;
function isJSDocTypeExpressionOrChild(node) {
- return node.kind === 288 /* JSDocTypeExpression */ || (node.parent && isJSDocTypeExpressionOrChild(node.parent));
+ return node.kind === 289 /* JSDocTypeExpression */ || (node.parent && isJSDocTypeExpressionOrChild(node.parent));
}
function getTextOfNodeFromSourceText(sourceText, node, includeTrivia) {
if (includeTrivia === void 0) { includeTrivia = false; }
@@ -8892,7 +9070,7 @@
ts.isBlockOrCatchScoped = isBlockOrCatchScoped;
function isCatchClauseVariableDeclarationOrBindingElement(declaration) {
var node = getRootDeclaration(declaration);
- return node.kind === 237 /* VariableDeclaration */ && node.parent.kind === 274 /* CatchClause */;
+ return node.kind === 238 /* VariableDeclaration */ && node.parent.kind === 275 /* CatchClause */;
}
ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement;
function isAmbientModule(node) {
@@ -8924,11 +9102,11 @@
ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol;
function isShorthandAmbientModule(node) {
// The only kind of module that can be missing a body is a shorthand ambient module.
- return node && node.kind === 244 /* ModuleDeclaration */ && (!node.body);
+ return node && node.kind === 245 /* ModuleDeclaration */ && (!node.body);
}
function isBlockScopedContainerTopLevel(node) {
- return node.kind === 284 /* SourceFile */ ||
- node.kind === 244 /* ModuleDeclaration */ ||
+ return node.kind === 285 /* SourceFile */ ||
+ node.kind === 245 /* ModuleDeclaration */ ||
ts.isFunctionLike(node);
}
ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel;
@@ -8945,9 +9123,9 @@
// - defined in the top level scope and source file is an external module
// - defined inside ambient module declaration located in the top level scope and source file not an external module
switch (node.parent.kind) {
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return ts.isExternalModule(node.parent);
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
return isAmbientModule(node.parent.parent) && ts.isSourceFile(node.parent.parent.parent) && !ts.isExternalModule(node.parent.parent.parent);
}
return false;
@@ -8963,22 +9141,22 @@
ts.isEffectiveExternalModule = isEffectiveExternalModule;
function isBlockScope(node, parentNode) {
switch (node.kind) {
- case 284 /* SourceFile */:
- case 246 /* CaseBlock */:
- case 274 /* CatchClause */:
- case 244 /* ModuleDeclaration */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 157 /* Constructor */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 285 /* SourceFile */:
+ case 247 /* CaseBlock */:
+ case 275 /* CatchClause */:
+ case 245 /* ModuleDeclaration */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 158 /* Constructor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return true;
- case 218 /* Block */:
+ case 219 /* Block */:
// function block is not considered block-scope container
// see comment in binder.ts: bind(...), case for SyntaxKind.Block
return !ts.isFunctionLike(parentNode);
@@ -8988,9 +9166,9 @@
ts.isBlockScope = isBlockScope;
function isDeclarationWithTypeParameters(node) {
switch (node.kind) {
- case 302 /* JSDocCallbackTag */:
- case 309 /* JSDocTypedefTag */:
- case 298 /* JSDocSignature */:
+ case 303 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 299 /* JSDocSignature */:
return true;
default:
ts.assertType(node);
@@ -9000,25 +9178,25 @@
ts.isDeclarationWithTypeParameters = isDeclarationWithTypeParameters;
function isDeclarationWithTypeParameterChildren(node) {
switch (node.kind) {
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 155 /* MethodSignature */:
- case 162 /* IndexSignature */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 294 /* JSDocFunctionType */:
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 308 /* JSDocTemplateTag */:
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 156 /* MethodSignature */:
+ case 163 /* IndexSignature */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 295 /* JSDocFunctionType */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 309 /* JSDocTemplateTag */:
+ case 240 /* FunctionDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return true;
default:
ts.assertType(node);
@@ -9028,8 +9206,8 @@
ts.isDeclarationWithTypeParameterChildren = isDeclarationWithTypeParameterChildren;
function isAnyImportSyntax(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return true;
default:
return false;
@@ -9038,15 +9216,15 @@
ts.isAnyImportSyntax = isAnyImportSyntax;
function isLateVisibilityPaintedStatement(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
- case 219 /* VariableStatement */:
- case 240 /* ClassDeclaration */:
- case 239 /* FunctionDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 220 /* VariableStatement */:
+ case 241 /* ClassDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
return true;
default:
return false;
@@ -9076,13 +9254,13 @@
ts.getNameFromIndexInfo = getNameFromIndexInfo;
function getTextOfPropertyName(name) {
switch (name.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return name.escapedText;
case 10 /* StringLiteral */:
case 8 /* NumericLiteral */:
case 14 /* NoSubstitutionTemplateLiteral */:
return ts.escapeLeadingUnderscores(name.text);
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
if (isStringOrNumericLiteralLike(name.expression))
return ts.escapeLeadingUnderscores(name.expression.text);
return ts.Debug.fail("Text of property name cannot be read from non-literal-valued ComputedPropertyNames");
@@ -9093,11 +9271,11 @@
ts.getTextOfPropertyName = getTextOfPropertyName;
function entityNameToString(name) {
switch (name.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return getFullWidth(name) === 0 ? ts.idText(name) : getTextOfNode(name);
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
return entityNameToString(name.left) + "." + entityNameToString(name.right);
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return entityNameToString(name.expression) + "." + entityNameToString(name.name);
default:
throw ts.Debug.assertNever(name);
@@ -9142,7 +9320,7 @@
ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition;
function getErrorSpanForArrowFunction(sourceFile, node) {
var pos = ts.skipTrivia(sourceFile.text, node.pos);
- if (node.body && node.body.kind === 218 /* Block */) {
+ if (node.body && node.body.kind === 219 /* Block */) {
var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line;
var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line;
if (startLine < endLine) {
@@ -9156,7 +9334,7 @@
function getErrorSpanForNode(sourceFile, node) {
var errorNode = node;
switch (node.kind) {
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
var pos_1 = ts.skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false);
if (pos_1 === sourceFile.text.length) {
// file is empty - return span for the beginning of the file
@@ -9165,25 +9343,25 @@
return getSpanOfTokenAtPosition(sourceFile, pos_1);
// This list is a work in progress. Add missing node kinds to improve their error
// spans.
- case 237 /* VariableDeclaration */:
- case 186 /* BindingElement */:
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 243 /* EnumDeclaration */:
- case 278 /* EnumMember */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 242 /* TypeAliasDeclaration */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 238 /* VariableDeclaration */:
+ case 187 /* BindingElement */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 279 /* EnumMember */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 243 /* TypeAliasDeclaration */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
errorNode = node.name;
break;
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return getErrorSpanForArrowFunction(sourceFile, node);
}
if (errorNode === undefined) {
@@ -9232,11 +9410,11 @@
}
ts.isLet = isLet;
function isSuperCall(n) {
- return n.kind === 191 /* CallExpression */ && n.expression.kind === 98 /* SuperKeyword */;
+ return n.kind === 192 /* CallExpression */ && n.expression.kind === 99 /* SuperKeyword */;
}
ts.isSuperCall = isSuperCall;
function isImportCall(n) {
- return n.kind === 191 /* CallExpression */ && n.expression.kind === 92 /* ImportKeyword */;
+ return n.kind === 192 /* CallExpression */ && n.expression.kind === 93 /* ImportKeyword */;
}
ts.isImportCall = isImportCall;
function isLiteralImportTypeNode(n) {
@@ -9244,7 +9422,7 @@
}
ts.isLiteralImportTypeNode = isLiteralImportTypeNode;
function isPrologueDirective(node) {
- return node.kind === 221 /* ExpressionStatement */
+ return node.kind === 222 /* ExpressionStatement */
&& node.expression.kind === 10 /* StringLiteral */;
}
ts.isPrologueDirective = isPrologueDirective;
@@ -9253,11 +9431,11 @@
}
ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode;
function getJSDocCommentRanges(node, text) {
- var commentRanges = (node.kind === 151 /* Parameter */ ||
- node.kind === 150 /* TypeParameter */ ||
- node.kind === 196 /* FunctionExpression */ ||
- node.kind === 197 /* ArrowFunction */ ||
- node.kind === 195 /* ParenthesizedExpression */) ?
+ var commentRanges = (node.kind === 152 /* Parameter */ ||
+ node.kind === 151 /* TypeParameter */ ||
+ node.kind === 197 /* FunctionExpression */ ||
+ node.kind === 198 /* ArrowFunction */ ||
+ node.kind === 196 /* ParenthesizedExpression */) ?
ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) :
ts.getLeadingCommentRanges(text, node.pos);
// True if the comment starts with '/**' but not if it is '/**/'
@@ -9273,48 +9451,48 @@
ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*<amd-dependency\s+path\s*=\s*)('|")(.+?)\2.*?\/>/;
var defaultLibReferenceRegEx = /^(\/\/\/\s*<reference\s+no-default-lib\s*=\s*)('|")(.+?)\2\s*\/>/;
function isPartOfTypeNode(node) {
- if (163 /* FirstTypeNode */ <= node.kind && node.kind <= 183 /* LastTypeNode */) {
+ if (164 /* FirstTypeNode */ <= node.kind && node.kind <= 184 /* LastTypeNode */) {
return true;
}
switch (node.kind) {
- case 120 /* AnyKeyword */:
- case 143 /* UnknownKeyword */:
- case 135 /* NumberKeyword */:
- case 146 /* BigIntKeyword */:
- case 138 /* StringKeyword */:
- case 123 /* BooleanKeyword */:
- case 139 /* SymbolKeyword */:
- case 136 /* ObjectKeyword */:
- case 141 /* UndefinedKeyword */:
- case 132 /* NeverKeyword */:
- return true;
- case 106 /* VoidKeyword */:
- return node.parent.kind !== 200 /* VoidExpression */;
- case 211 /* ExpressionWithTypeArguments */:
+ case 121 /* AnyKeyword */:
+ case 144 /* UnknownKeyword */:
+ case 136 /* NumberKeyword */:
+ case 147 /* BigIntKeyword */:
+ case 139 /* StringKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 137 /* ObjectKeyword */:
+ case 142 /* UndefinedKeyword */:
+ case 133 /* NeverKeyword */:
+ return true;
+ case 107 /* VoidKeyword */:
+ return node.parent.kind !== 201 /* VoidExpression */;
+ case 212 /* ExpressionWithTypeArguments */:
return !isExpressionWithTypeArgumentsInClassExtendsClause(node);
- case 150 /* TypeParameter */:
- return node.parent.kind === 181 /* MappedType */ || node.parent.kind === 176 /* InferType */;
+ case 151 /* TypeParameter */:
+ return node.parent.kind === 182 /* MappedType */ || node.parent.kind === 177 /* InferType */;
// Identifiers and qualified names may be type nodes, depending on their context. Climb
// above them to find the lowest container
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
// If the identifier is the RHS of a qualified name, then it's a type iff its parent is.
- if (node.parent.kind === 148 /* QualifiedName */ && node.parent.right === node) {
+ if (node.parent.kind === 149 /* QualifiedName */ && node.parent.right === node) {
node = node.parent;
}
- else if (node.parent.kind === 189 /* PropertyAccessExpression */ && node.parent.name === node) {
+ else if (node.parent.kind === 190 /* PropertyAccessExpression */ && node.parent.name === node) {
node = node.parent;
}
// At this point, node is either a qualified name or an identifier
- ts.Debug.assert(node.kind === 72 /* Identifier */ || node.kind === 148 /* QualifiedName */ || node.kind === 189 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'.");
+ ts.Debug.assert(node.kind === 73 /* Identifier */ || node.kind === 149 /* QualifiedName */ || node.kind === 190 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'.");
// falls through
- case 148 /* QualifiedName */:
- case 189 /* PropertyAccessExpression */:
- case 100 /* ThisKeyword */: {
+ case 149 /* QualifiedName */:
+ case 190 /* PropertyAccessExpression */:
+ case 101 /* ThisKeyword */: {
var parent = node.parent;
- if (parent.kind === 167 /* TypeQuery */) {
+ if (parent.kind === 168 /* TypeQuery */) {
return false;
}
- if (parent.kind === 183 /* ImportType */) {
+ if (parent.kind === 184 /* ImportType */) {
return !parent.isTypeOf;
}
// Do not recursively call isPartOfTypeNode on the parent. In the example:
@@ -9323,40 +9501,40 @@
//
// Calling isPartOfTypeNode would consider the qualified name A.B a type node.
// Only C and A.B.C are type nodes.
- if (163 /* FirstTypeNode */ <= parent.kind && parent.kind <= 183 /* LastTypeNode */) {
+ if (164 /* FirstTypeNode */ <= parent.kind && parent.kind <= 184 /* LastTypeNode */) {
return true;
}
switch (parent.kind) {
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return !isExpressionWithTypeArgumentsInClassExtendsClause(parent);
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
return node === parent.constraint;
- case 308 /* JSDocTemplateTag */:
+ case 309 /* JSDocTemplateTag */:
return node === parent.constraint;
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 151 /* Parameter */:
- case 237 /* VariableDeclaration */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 152 /* Parameter */:
+ case 238 /* VariableDeclaration */:
return node === parent.type;
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 157 /* Constructor */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 158 /* Constructor */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return node === parent.type;
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
return node === parent.type;
- case 194 /* TypeAssertionExpression */:
+ case 195 /* TypeAssertionExpression */:
return node === parent.type;
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
return ts.contains(parent.typeArguments, node);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
// TODO (drosen): TaggedTemplateExpressions may eventually support type arguments.
return false;
}
@@ -9381,23 +9559,23 @@
return traverse(body);
function traverse(node) {
switch (node.kind) {
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return visitor(node);
- case 246 /* CaseBlock */:
- case 218 /* Block */:
- case 222 /* IfStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 231 /* WithStatement */:
- case 232 /* SwitchStatement */:
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
- case 233 /* LabeledStatement */:
- case 235 /* TryStatement */:
- case 274 /* CatchClause */:
+ case 247 /* CaseBlock */:
+ case 219 /* Block */:
+ case 223 /* IfStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 232 /* WithStatement */:
+ case 233 /* SwitchStatement */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
+ case 234 /* LabeledStatement */:
+ case 236 /* TryStatement */:
+ case 275 /* CatchClause */:
return ts.forEachChild(node, traverse);
}
}
@@ -9407,26 +9585,26 @@
return traverse(body);
function traverse(node) {
switch (node.kind) {
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
visitor(node);
var operand = node.expression;
if (operand) {
traverse(operand);
}
return;
- case 243 /* EnumDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 244 /* EnumDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
// These are not allowed inside a generator now, but eventually they may be allowed
// as local types. Regardless, any yield statements contained within them should be
// skipped in this traversal.
return;
default:
if (ts.isFunctionLike(node)) {
- if (node.name && node.name.kind === 149 /* ComputedPropertyName */) {
+ if (node.name && node.name.kind === 150 /* ComputedPropertyName */) {
// Note that we will not include methods/accessors of a class because they would require
// first descending into the class. This is by design.
traverse(node.name.expression);
@@ -9449,10 +9627,10 @@
* @param node The type node.
*/
function getRestParameterElementType(node) {
- if (node && node.kind === 169 /* ArrayType */) {
+ if (node && node.kind === 170 /* ArrayType */) {
return node.elementType;
}
- else if (node && node.kind === 164 /* TypeReference */) {
+ else if (node && node.kind === 165 /* TypeReference */) {
return ts.singleOrUndefined(node.typeArguments);
}
else {
@@ -9462,12 +9640,12 @@
ts.getRestParameterElementType = getRestParameterElementType;
function getMembersOfDeclaration(node) {
switch (node.kind) {
- case 241 /* InterfaceDeclaration */:
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 168 /* TypeLiteral */:
+ case 242 /* InterfaceDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 169 /* TypeLiteral */:
return node.members;
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return node.properties;
}
}
@@ -9475,14 +9653,14 @@
function isVariableLike(node) {
if (node) {
switch (node.kind) {
- case 186 /* BindingElement */:
- case 278 /* EnumMember */:
- case 151 /* Parameter */:
- case 275 /* PropertyAssignment */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 276 /* ShorthandPropertyAssignment */:
- case 237 /* VariableDeclaration */:
+ case 187 /* BindingElement */:
+ case 279 /* EnumMember */:
+ case 152 /* Parameter */:
+ case 276 /* PropertyAssignment */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 277 /* ShorthandPropertyAssignment */:
+ case 238 /* VariableDeclaration */:
return true;
}
}
@@ -9494,8 +9672,8 @@
}
ts.isVariableLikeOrAccessor = isVariableLikeOrAccessor;
function isVariableDeclarationInVariableStatement(node) {
- return node.parent.kind === 238 /* VariableDeclarationList */
- && node.parent.parent.kind === 219 /* VariableStatement */;
+ return node.parent.kind === 239 /* VariableDeclarationList */
+ && node.parent.parent.kind === 220 /* VariableStatement */;
}
ts.isVariableDeclarationInVariableStatement = isVariableDeclarationInVariableStatement;
function isValidESSymbolDeclaration(node) {
@@ -9506,13 +9684,13 @@
ts.isValidESSymbolDeclaration = isValidESSymbolDeclaration;
function introducesArgumentsExoticObject(node) {
switch (node.kind) {
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
return true;
}
return false;
@@ -9523,7 +9701,7 @@
if (beforeUnwrapLabelCallback) {
beforeUnwrapLabelCallback(node);
}
- if (node.statement.kind !== 233 /* LabeledStatement */) {
+ if (node.statement.kind !== 234 /* LabeledStatement */) {
return node.statement;
}
node = node.statement;
@@ -9531,17 +9709,17 @@
}
ts.unwrapInnermostStatementOfLabel = unwrapInnermostStatementOfLabel;
function isFunctionBlock(node) {
- return node && node.kind === 218 /* Block */ && ts.isFunctionLike(node.parent);
+ return node && node.kind === 219 /* Block */ && ts.isFunctionLike(node.parent);
}
ts.isFunctionBlock = isFunctionBlock;
function isObjectLiteralMethod(node) {
- return node && node.kind === 156 /* MethodDeclaration */ && node.parent.kind === 188 /* ObjectLiteralExpression */;
+ return node && node.kind === 157 /* MethodDeclaration */ && node.parent.kind === 189 /* ObjectLiteralExpression */;
}
ts.isObjectLiteralMethod = isObjectLiteralMethod;
function isObjectLiteralOrClassExpressionMethod(node) {
- return node.kind === 156 /* MethodDeclaration */ &&
- (node.parent.kind === 188 /* ObjectLiteralExpression */ ||
- node.parent.kind === 209 /* ClassExpression */);
+ return node.kind === 157 /* MethodDeclaration */ &&
+ (node.parent.kind === 189 /* ObjectLiteralExpression */ ||
+ node.parent.kind === 210 /* ClassExpression */);
}
ts.isObjectLiteralOrClassExpressionMethod = isObjectLiteralOrClassExpressionMethod;
function isIdentifierTypePredicate(predicate) {
@@ -9554,7 +9732,7 @@
ts.isThisTypePredicate = isThisTypePredicate;
function getPropertyAssignment(objectLiteral, key, key2) {
return objectLiteral.properties.filter(function (property) {
- if (property.kind === 275 /* PropertyAssignment */) {
+ if (property.kind === 276 /* PropertyAssignment */) {
var propName = getTextOfPropertyName(property.name);
return key === propName || (!!key2 && key2 === propName);
}
@@ -9586,19 +9764,23 @@
return findAncestor(node.parent, ts.isFunctionLike);
}
ts.getContainingFunction = getContainingFunction;
+ function getContainingFunctionDeclaration(node) {
+ return findAncestor(node.parent, ts.isFunctionLikeDeclaration);
+ }
+ ts.getContainingFunctionDeclaration = getContainingFunctionDeclaration;
function getContainingClass(node) {
return findAncestor(node.parent, ts.isClassLike);
}
ts.getContainingClass = getContainingClass;
function getThisContainer(node, includeArrowFunctions) {
- ts.Debug.assert(node.kind !== 284 /* SourceFile */);
+ ts.Debug.assert(node.kind !== 285 /* SourceFile */);
while (true) {
node = node.parent;
if (!node) {
return ts.Debug.fail(); // If we never pass in a SourceFile, this should be unreachable, since we'll stop when we reach that.
}
switch (node.kind) {
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
// If the grandparent node is an object literal (as opposed to a class),
// then the computed property is not a 'this' container.
// A computed property name in a class needs to be a this container
@@ -9613,9 +9795,9 @@
// the *body* of the container.
node = node.parent;
break;
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
// Decorators are always applied outside of the body of a class or method.
- if (node.parent.kind === 151 /* Parameter */ && ts.isClassElement(node.parent.parent)) {
+ if (node.parent.kind === 152 /* Parameter */ && ts.isClassElement(node.parent.parent)) {
// If the decorator's parent is a Parameter, we resolve the this container from
// the grandparent class declaration.
node = node.parent.parent;
@@ -9626,26 +9808,26 @@
node = node.parent;
}
break;
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
if (!includeArrowFunctions) {
continue;
}
// falls through
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 244 /* ModuleDeclaration */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
- case 243 /* EnumDeclaration */:
- case 284 /* SourceFile */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 245 /* ModuleDeclaration */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
+ case 244 /* EnumDeclaration */:
+ case 285 /* SourceFile */:
return node;
}
}
@@ -9655,9 +9837,9 @@
var container = getThisContainer(node, /*includeArrowFunctions*/ false);
if (container) {
switch (container.kind) {
- case 157 /* Constructor */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
+ case 158 /* Constructor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
return container;
}
}
@@ -9679,27 +9861,27 @@
return node;
}
switch (node.kind) {
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
node = node.parent;
break;
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
if (!stopOnFunctions) {
continue;
}
// falls through
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return node;
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
// Decorators are always applied outside of the body of a class or method.
- if (node.parent.kind === 151 /* Parameter */ && ts.isClassElement(node.parent.parent)) {
+ if (node.parent.kind === 152 /* Parameter */ && ts.isClassElement(node.parent.parent)) {
// If the decorator's parent is a Parameter, we resolve the this container from
// the grandparent class declaration.
node = node.parent.parent;
@@ -9715,21 +9897,21 @@
}
ts.getSuperContainer = getSuperContainer;
function getImmediatelyInvokedFunctionExpression(func) {
- if (func.kind === 196 /* FunctionExpression */ || func.kind === 197 /* ArrowFunction */) {
+ if (func.kind === 197 /* FunctionExpression */ || func.kind === 198 /* ArrowFunction */) {
var prev = func;
var parent = func.parent;
- while (parent.kind === 195 /* ParenthesizedExpression */) {
+ while (parent.kind === 196 /* ParenthesizedExpression */) {
prev = parent;
parent = parent.parent;
}
- if (parent.kind === 191 /* CallExpression */ && parent.expression === prev) {
+ if (parent.kind === 192 /* CallExpression */ && parent.expression === prev) {
return parent;
}
}
}
ts.getImmediatelyInvokedFunctionExpression = getImmediatelyInvokedFunctionExpression;
function isSuperOrSuperProperty(node) {
- return node.kind === 98 /* SuperKeyword */
+ return node.kind === 99 /* SuperKeyword */
|| isSuperProperty(node);
}
ts.isSuperOrSuperProperty = isSuperOrSuperProperty;
@@ -9738,8 +9920,8 @@
*/
function isSuperProperty(node) {
var kind = node.kind;
- return (kind === 189 /* PropertyAccessExpression */ || kind === 190 /* ElementAccessExpression */)
- && node.expression.kind === 98 /* SuperKeyword */;
+ return (kind === 190 /* PropertyAccessExpression */ || kind === 191 /* ElementAccessExpression */)
+ && node.expression.kind === 99 /* SuperKeyword */;
}
ts.isSuperProperty = isSuperProperty;
/**
@@ -9747,20 +9929,20 @@
*/
function isThisProperty(node) {
var kind = node.kind;
- return (kind === 189 /* PropertyAccessExpression */ || kind === 190 /* ElementAccessExpression */)
- && node.expression.kind === 100 /* ThisKeyword */;
+ return (kind === 190 /* PropertyAccessExpression */ || kind === 191 /* ElementAccessExpression */)
+ && node.expression.kind === 101 /* ThisKeyword */;
}
ts.isThisProperty = isThisProperty;
function getEntityNameFromTypeNode(node) {
switch (node.kind) {
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return node.typeName;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return isEntityNameExpression(node.expression)
? node.expression
: undefined;
- case 72 /* Identifier */:
- case 148 /* QualifiedName */:
+ case 73 /* Identifier */:
+ case 149 /* QualifiedName */:
return node;
}
return undefined;
@@ -9768,10 +9950,10 @@
ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode;
function getInvokedExpression(node) {
switch (node.kind) {
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return node.tag;
- case 262 /* JsxOpeningElement */:
- case 261 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
+ case 262 /* JsxSelfClosingElement */:
return node.tagName;
default:
return node.expression;
@@ -9780,25 +9962,25 @@
ts.getInvokedExpression = getInvokedExpression;
function nodeCanBeDecorated(node, parent, grandparent) {
switch (node.kind) {
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
// classes are valid targets
return true;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
// property declarations are valid if their parent is a class declaration.
- return parent.kind === 240 /* ClassDeclaration */;
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 156 /* MethodDeclaration */:
+ return parent.kind === 241 /* ClassDeclaration */;
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
// if this method has a body and its parent is a class declaration, this is a valid target.
return node.body !== undefined
- && parent.kind === 240 /* ClassDeclaration */;
- case 151 /* Parameter */:
+ && parent.kind === 241 /* ClassDeclaration */;
+ case 152 /* Parameter */:
// if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target;
return parent.body !== undefined
- && (parent.kind === 157 /* Constructor */
- || parent.kind === 156 /* MethodDeclaration */
- || parent.kind === 159 /* SetAccessor */)
- && grandparent.kind === 240 /* ClassDeclaration */;
+ && (parent.kind === 158 /* Constructor */
+ || parent.kind === 157 /* MethodDeclaration */
+ || parent.kind === 160 /* SetAccessor */)
+ && grandparent.kind === 241 /* ClassDeclaration */;
}
return false;
}
@@ -9814,10 +9996,10 @@
ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated;
function childIsDecorated(node, parent) {
switch (node.kind) {
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return ts.some(node.members, function (m) { return nodeOrChildIsDecorated(m, node, parent); }); // TODO: GH#18217
- case 156 /* MethodDeclaration */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 160 /* SetAccessor */:
return ts.some(node.parameters, function (p) { return nodeIsDecorated(p, node, parent); }); // TODO: GH#18217
default:
return false;
@@ -9826,9 +10008,9 @@
ts.childIsDecorated = childIsDecorated;
function isJSXTagName(node) {
var parent = node.parent;
- if (parent.kind === 262 /* JsxOpeningElement */ ||
- parent.kind === 261 /* JsxSelfClosingElement */ ||
- parent.kind === 263 /* JsxClosingElement */) {
+ if (parent.kind === 263 /* JsxOpeningElement */ ||
+ parent.kind === 262 /* JsxSelfClosingElement */ ||
+ parent.kind === 264 /* JsxClosingElement */) {
return parent.tagName === node;
}
return false;
@@ -9836,57 +10018,57 @@
ts.isJSXTagName = isJSXTagName;
function isExpressionNode(node) {
switch (node.kind) {
- case 98 /* SuperKeyword */:
- case 96 /* NullKeyword */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
+ case 99 /* SuperKeyword */:
+ case 97 /* NullKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
case 13 /* RegularExpressionLiteral */:
- case 187 /* ArrayLiteralExpression */:
- case 188 /* ObjectLiteralExpression */:
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
- case 193 /* TaggedTemplateExpression */:
- case 212 /* AsExpression */:
- case 194 /* TypeAssertionExpression */:
- case 213 /* NonNullExpression */:
- case 195 /* ParenthesizedExpression */:
- case 196 /* FunctionExpression */:
- case 209 /* ClassExpression */:
- case 197 /* ArrowFunction */:
- case 200 /* VoidExpression */:
- case 198 /* DeleteExpression */:
- case 199 /* TypeOfExpression */:
- case 202 /* PrefixUnaryExpression */:
- case 203 /* PostfixUnaryExpression */:
- case 204 /* BinaryExpression */:
- case 205 /* ConditionalExpression */:
- case 208 /* SpreadElement */:
- case 206 /* TemplateExpression */:
+ case 188 /* ArrayLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
+ case 194 /* TaggedTemplateExpression */:
+ case 213 /* AsExpression */:
+ case 195 /* TypeAssertionExpression */:
+ case 214 /* NonNullExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 197 /* FunctionExpression */:
+ case 210 /* ClassExpression */:
+ case 198 /* ArrowFunction */:
+ case 201 /* VoidExpression */:
+ case 199 /* DeleteExpression */:
+ case 200 /* TypeOfExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
+ case 205 /* BinaryExpression */:
+ case 206 /* ConditionalExpression */:
+ case 209 /* SpreadElement */:
+ case 207 /* TemplateExpression */:
case 14 /* NoSubstitutionTemplateLiteral */:
- case 210 /* OmittedExpression */:
- case 260 /* JsxElement */:
- case 261 /* JsxSelfClosingElement */:
- case 264 /* JsxFragment */:
- case 207 /* YieldExpression */:
- case 201 /* AwaitExpression */:
- case 214 /* MetaProperty */:
+ case 211 /* OmittedExpression */:
+ case 261 /* JsxElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 265 /* JsxFragment */:
+ case 208 /* YieldExpression */:
+ case 202 /* AwaitExpression */:
+ case 215 /* MetaProperty */:
return true;
- case 148 /* QualifiedName */:
- while (node.parent.kind === 148 /* QualifiedName */) {
+ case 149 /* QualifiedName */:
+ while (node.parent.kind === 149 /* QualifiedName */) {
node = node.parent;
}
- return node.parent.kind === 167 /* TypeQuery */ || isJSXTagName(node);
- case 72 /* Identifier */:
- if (node.parent.kind === 167 /* TypeQuery */ || isJSXTagName(node)) {
+ return node.parent.kind === 168 /* TypeQuery */ || isJSXTagName(node);
+ case 73 /* Identifier */:
+ if (node.parent.kind === 168 /* TypeQuery */ || isJSXTagName(node)) {
return true;
}
// falls through
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
case 10 /* StringLiteral */:
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
return isInExpressionContext(node);
default:
return false;
@@ -9896,49 +10078,49 @@
function isInExpressionContext(node) {
var parent = node.parent;
switch (parent.kind) {
- case 237 /* VariableDeclaration */:
- case 151 /* Parameter */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 278 /* EnumMember */:
- case 275 /* PropertyAssignment */:
- case 186 /* BindingElement */:
+ case 238 /* VariableDeclaration */:
+ case 152 /* Parameter */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 279 /* EnumMember */:
+ case 276 /* PropertyAssignment */:
+ case 187 /* BindingElement */:
return parent.initializer === node;
- case 221 /* ExpressionStatement */:
- case 222 /* IfStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
- case 230 /* ReturnStatement */:
- case 231 /* WithStatement */:
- case 232 /* SwitchStatement */:
- case 271 /* CaseClause */:
- case 234 /* ThrowStatement */:
+ case 222 /* ExpressionStatement */:
+ case 223 /* IfStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
+ case 231 /* ReturnStatement */:
+ case 232 /* WithStatement */:
+ case 233 /* SwitchStatement */:
+ case 272 /* CaseClause */:
+ case 235 /* ThrowStatement */:
return parent.expression === node;
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
var forStatement = parent;
- return (forStatement.initializer === node && forStatement.initializer.kind !== 238 /* VariableDeclarationList */) ||
+ return (forStatement.initializer === node && forStatement.initializer.kind !== 239 /* VariableDeclarationList */) ||
forStatement.condition === node ||
forStatement.incrementor === node;
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
var forInStatement = parent;
- return (forInStatement.initializer === node && forInStatement.initializer.kind !== 238 /* VariableDeclarationList */) ||
+ return (forInStatement.initializer === node && forInStatement.initializer.kind !== 239 /* VariableDeclarationList */) ||
forInStatement.expression === node;
- case 194 /* TypeAssertionExpression */:
- case 212 /* AsExpression */:
+ case 195 /* TypeAssertionExpression */:
+ case 213 /* AsExpression */:
return node === parent.expression;
- case 216 /* TemplateSpan */:
+ case 217 /* TemplateSpan */:
return node === parent.expression;
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
return node === parent.expression;
- case 152 /* Decorator */:
- case 270 /* JsxExpression */:
- case 269 /* JsxSpreadAttribute */:
- case 277 /* SpreadAssignment */:
+ case 153 /* Decorator */:
+ case 271 /* JsxExpression */:
+ case 270 /* JsxSpreadAttribute */:
+ case 278 /* SpreadAssignment */:
return true;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return parent.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent);
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return parent.objectAssignmentInitializer === node;
default:
return isExpressionNode(parent);
@@ -9946,7 +10128,7 @@
}
ts.isInExpressionContext = isInExpressionContext;
function isExternalModuleImportEqualsDeclaration(node) {
- return node.kind === 248 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 259 /* ExternalModuleReference */;
+ return node.kind === 249 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 260 /* ExternalModuleReference */;
}
ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration;
function getExternalModuleImportEqualsDeclarationExpression(node) {
@@ -9955,7 +10137,7 @@
}
ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression;
function isInternalModuleImportEqualsDeclaration(node) {
- return node.kind === 248 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 259 /* ExternalModuleReference */;
+ return node.kind === 249 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 260 /* ExternalModuleReference */;
}
ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration;
function isSourceFileJS(file) {
@@ -9983,15 +10165,15 @@
ts.isIdentifier(node.typeName) &&
node.typeName.escapedText === "Object" &&
node.typeArguments && node.typeArguments.length === 2 &&
- (node.typeArguments[0].kind === 138 /* StringKeyword */ || node.typeArguments[0].kind === 135 /* NumberKeyword */);
+ (node.typeArguments[0].kind === 139 /* StringKeyword */ || node.typeArguments[0].kind === 136 /* NumberKeyword */);
}
ts.isJSDocIndexSignature = isJSDocIndexSignature;
function isRequireCall(callExpression, checkArgumentIsStringLiteralLike) {
- if (callExpression.kind !== 191 /* CallExpression */) {
+ if (callExpression.kind !== 192 /* CallExpression */) {
return false;
}
var _a = callExpression, expression = _a.expression, args = _a.arguments;
- if (expression.kind !== 72 /* Identifier */ || expression.escapedText !== "require") {
+ if (expression.kind !== 73 /* Identifier */ || expression.escapedText !== "require") {
return false;
}
if (args.length !== 1) {
@@ -10022,7 +10204,7 @@
name = node.parent.name;
decl = node.parent;
}
- else if (ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 59 /* EqualsToken */ && node.parent.right === node) {
+ else if (ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 60 /* EqualsToken */ && node.parent.right === node) {
name = node.parent.left;
decl = name;
}
@@ -10031,7 +10213,7 @@
name = node.parent.parent.name;
decl = node.parent.parent;
}
- else if (ts.isBinaryExpression(node.parent.parent) && node.parent.parent.operatorToken.kind === 59 /* EqualsToken */ && node.parent.parent.right === node.parent) {
+ else if (ts.isBinaryExpression(node.parent.parent) && node.parent.parent.operatorToken.kind === 60 /* EqualsToken */ && node.parent.parent.right === node.parent) {
name = node.parent.parent.left;
decl = name;
}
@@ -10073,7 +10255,7 @@
* We treat the right hand side of assignments with container-like initalizers as declarations.
*/
function getAssignedExpandoInitializer(node) {
- if (node && node.parent && ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 59 /* EqualsToken */) {
+ if (node && node.parent && ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 60 /* EqualsToken */) {
var isPrototypeAssignment = isPrototypeAccess(node.parent.left);
return getExpandoInitializer(node.parent.right, isPrototypeAssignment) ||
getDefaultedExpandoInitializer(node.parent.left, node.parent.right, isPrototypeAssignment);
@@ -10099,11 +10281,11 @@
function getExpandoInitializer(initializer, isPrototypeAssignment) {
if (ts.isCallExpression(initializer)) {
var e = skipParentheses(initializer.expression);
- return e.kind === 196 /* FunctionExpression */ || e.kind === 197 /* ArrowFunction */ ? initializer : undefined;
+ return e.kind === 197 /* FunctionExpression */ || e.kind === 198 /* ArrowFunction */ ? initializer : undefined;
}
- if (initializer.kind === 196 /* FunctionExpression */ ||
- initializer.kind === 209 /* ClassExpression */ ||
- initializer.kind === 197 /* ArrowFunction */) {
+ if (initializer.kind === 197 /* FunctionExpression */ ||
+ initializer.kind === 210 /* ClassExpression */ ||
+ initializer.kind === 198 /* ArrowFunction */) {
return initializer;
}
if (ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || isPrototypeAssignment)) {
@@ -10127,7 +10309,7 @@
}
function isDefaultedExpandoInitializer(node) {
var name = ts.isVariableDeclaration(node.parent) ? node.parent.name :
- ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 59 /* EqualsToken */ ? node.parent.left :
+ ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 60 /* EqualsToken */ ? node.parent.left :
undefined;
return name && getExpandoInitializer(node.right, isPrototypeAccess(name)) && isEntityNameExpression(name) && isSameEntityName(name, node.left);
}
@@ -10136,7 +10318,7 @@
function getNameOfExpando(node) {
if (ts.isBinaryExpression(node.parent)) {
var parent = (node.parent.operatorToken.kind === 55 /* BarBarToken */ && ts.isBinaryExpression(node.parent.parent)) ? node.parent.parent : node.parent;
- if (parent.operatorToken.kind === 59 /* EqualsToken */ && ts.isIdentifier(parent.left)) {
+ if (parent.operatorToken.kind === 60 /* EqualsToken */ && ts.isIdentifier(parent.left)) {
return parent.left;
}
}
@@ -10159,7 +10341,7 @@
return name.escapedText === initializer.escapedText;
}
if (ts.isIdentifier(name) && ts.isPropertyAccessExpression(initializer)) {
- return (initializer.expression.kind === 100 /* ThisKeyword */ ||
+ return (initializer.expression.kind === 101 /* ThisKeyword */ ||
ts.isIdentifier(initializer.expression) &&
(initializer.expression.escapedText === "window" ||
initializer.expression.escapedText === "self" ||
@@ -10217,7 +10399,7 @@
}
return 7 /* ObjectDefinePropertyValue */;
}
- if (expr.operatorToken.kind !== 59 /* EqualsToken */ ||
+ if (expr.operatorToken.kind !== 60 /* EqualsToken */ ||
!ts.isPropertyAccessExpression(expr.left)) {
return 0 /* None */;
}
@@ -10229,7 +10411,7 @@
return getAssignmentDeclarationPropertyAccessKind(lhs);
}
function getAssignmentDeclarationPropertyAccessKind(lhs) {
- if (lhs.expression.kind === 100 /* ThisKeyword */) {
+ if (lhs.expression.kind === 101 /* ThisKeyword */) {
return 4 /* ThisProperty */;
}
else if (isModuleExportsPropertyAccessExpression(lhs)) {
@@ -10271,7 +10453,7 @@
ts.isPrototypePropertyAssignment = isPrototypePropertyAssignment;
function isSpecialPropertyDeclaration(expr) {
return isInJSFile(expr) &&
- expr.parent && expr.parent.kind === 221 /* ExpressionStatement */ &&
+ expr.parent && expr.parent.kind === 222 /* ExpressionStatement */ &&
!!ts.getJSDocTypeTag(expr.parent);
}
ts.isSpecialPropertyDeclaration = isSpecialPropertyDeclaration;
@@ -10280,23 +10462,23 @@
return false;
}
var decl = symbol.valueDeclaration;
- return decl.kind === 239 /* FunctionDeclaration */ || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer);
+ return decl.kind === 240 /* FunctionDeclaration */ || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer);
}
ts.isFunctionSymbol = isFunctionSymbol;
function importFromModuleSpecifier(node) {
- return tryGetImportFromModuleSpecifier(node) || ts.Debug.fail(ts.Debug.showSyntaxKind(node.parent));
+ return tryGetImportFromModuleSpecifier(node) || ts.Debug.failBadSyntaxKind(node.parent);
}
ts.importFromModuleSpecifier = importFromModuleSpecifier;
function tryGetImportFromModuleSpecifier(node) {
switch (node.parent.kind) {
- case 249 /* ImportDeclaration */:
- case 255 /* ExportDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 256 /* ExportDeclaration */:
return node.parent;
- case 259 /* ExternalModuleReference */:
+ case 260 /* ExternalModuleReference */:
return node.parent.parent;
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return isImportCall(node.parent) || isRequireCall(node.parent, /*checkArg*/ false) ? node.parent : undefined;
- case 182 /* LiteralType */:
+ case 183 /* LiteralType */:
ts.Debug.assert(ts.isStringLiteral(node));
return ts.tryCast(node.parent.parent, ts.isImportTypeNode);
default:
@@ -10306,12 +10488,12 @@
ts.tryGetImportFromModuleSpecifier = tryGetImportFromModuleSpecifier;
function getExternalModuleName(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
- case 255 /* ExportDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 256 /* ExportDeclaration */:
return node.moduleSpecifier;
- case 248 /* ImportEqualsDeclaration */:
- return node.moduleReference.kind === 259 /* ExternalModuleReference */ ? node.moduleReference.expression : undefined;
- case 183 /* ImportType */:
+ case 249 /* ImportEqualsDeclaration */:
+ return node.moduleReference.kind === 260 /* ExternalModuleReference */ ? node.moduleReference.expression : undefined;
+ case 184 /* ImportType */:
return isLiteralImportTypeNode(node) ? node.argument.literal : undefined;
default:
return ts.Debug.assertNever(node);
@@ -10320,11 +10502,11 @@
ts.getExternalModuleName = getExternalModuleName;
function getNamespaceDeclarationNode(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return node.importClause && ts.tryCast(node.importClause.namedBindings, ts.isNamespaceImport);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return node;
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return undefined;
default:
return ts.Debug.assertNever(node);
@@ -10332,19 +10514,19 @@
}
ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode;
function isDefaultImport(node) {
- return node.kind === 249 /* ImportDeclaration */ && !!node.importClause && !!node.importClause.name;
+ return node.kind === 250 /* ImportDeclaration */ && !!node.importClause && !!node.importClause.name;
}
ts.isDefaultImport = isDefaultImport;
function hasQuestionToken(node) {
if (node) {
switch (node.kind) {
- case 151 /* Parameter */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 276 /* ShorthandPropertyAssignment */:
- case 275 /* PropertyAssignment */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 152 /* Parameter */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 277 /* ShorthandPropertyAssignment */:
+ case 276 /* PropertyAssignment */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
return node.questionToken !== undefined;
}
}
@@ -10358,7 +10540,7 @@
}
ts.isJSDocConstructSignature = isJSDocConstructSignature;
function isJSDocTypeAlias(node) {
- return node.kind === 309 /* JSDocTypedefTag */ || node.kind === 302 /* JSDocCallbackTag */;
+ return node.kind === 310 /* JSDocTypedefTag */ || node.kind === 303 /* JSDocCallbackTag */;
}
ts.isJSDocTypeAlias = isJSDocTypeAlias;
function isTypeAlias(node) {
@@ -10368,7 +10550,7 @@
function getSourceOfAssignment(node) {
return ts.isExpressionStatement(node) &&
node.expression && ts.isBinaryExpression(node.expression) &&
- node.expression.operatorToken.kind === 59 /* EqualsToken */
+ node.expression.operatorToken.kind === 60 /* EqualsToken */
? node.expression.right
: undefined;
}
@@ -10383,12 +10565,12 @@
}
function getSingleInitializerOfVariableStatementOrPropertyDeclaration(node) {
switch (node.kind) {
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
var v = getSingleVariableOfVariableStatement(node);
return v && v.initializer;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return node.initializer;
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return node.initializer;
}
}
@@ -10399,7 +10581,7 @@
function getNestedModuleDeclaration(node) {
return ts.isModuleDeclaration(node) &&
node.body &&
- node.body.kind === 244 /* ModuleDeclaration */
+ node.body.kind === 245 /* ModuleDeclaration */
? node.body
: undefined;
}
@@ -10414,11 +10596,11 @@
if (ts.hasJSDocNodes(node)) {
result = ts.addRange(result, node.jsDoc);
}
- if (node.kind === 151 /* Parameter */) {
+ if (node.kind === 152 /* Parameter */) {
result = ts.addRange(result, ts.getJSDocParameterTags(node));
break;
}
- if (node.kind === 150 /* TypeParameter */) {
+ if (node.kind === 151 /* TypeParameter */) {
result = ts.addRange(result, ts.getJSDocTypeParameterTags(node));
break;
}
@@ -10429,11 +10611,12 @@
ts.getJSDocCommentsAndTags = getJSDocCommentsAndTags;
function getNextJSDocCommentLocation(node) {
var parent = node.parent;
- if (parent.kind === 275 /* PropertyAssignment */ ||
- parent.kind === 154 /* PropertyDeclaration */ ||
- parent.kind === 221 /* ExpressionStatement */ && node.kind === 189 /* PropertyAccessExpression */ ||
+ if (parent.kind === 276 /* PropertyAssignment */ ||
+ parent.kind === 255 /* ExportAssignment */ ||
+ parent.kind === 155 /* PropertyDeclaration */ ||
+ parent.kind === 222 /* ExpressionStatement */ && node.kind === 190 /* PropertyAccessExpression */ ||
getNestedModuleDeclaration(parent) ||
- ts.isBinaryExpression(node) && node.operatorToken.kind === 59 /* EqualsToken */) {
+ ts.isBinaryExpression(node) && node.operatorToken.kind === 60 /* EqualsToken */) {
return parent;
}
// Try to recognize this pattern when node is initializer of variable declaration and JSDoc comments are on containing variable statement.
@@ -10444,7 +10627,7 @@
// var x = function(name) { return name.length; }
else if (parent.parent &&
(getSingleVariableOfVariableStatement(parent.parent) === node ||
- ts.isBinaryExpression(parent) && parent.operatorToken.kind === 59 /* EqualsToken */)) {
+ ts.isBinaryExpression(parent) && parent.operatorToken.kind === 60 /* EqualsToken */)) {
return parent.parent;
}
else if (parent.parent && parent.parent.parent &&
@@ -10467,7 +10650,7 @@
if (!decl) {
return undefined;
}
- var parameter = ts.find(decl.parameters, function (p) { return p.name.kind === 72 /* Identifier */ && p.name.escapedText === name; });
+ var parameter = ts.find(decl.parameters, function (p) { return p.name.kind === 73 /* Identifier */ && p.name.escapedText === name; });
return parameter && parameter.symbol;
}
ts.getParameterSymbolFromJSDoc = getParameterSymbolFromJSDoc;
@@ -10502,7 +10685,7 @@
ts.hasRestParameter = hasRestParameter;
function isRestParameter(node) {
var type = ts.isJSDocParameterTag(node) ? (node.typeExpression && node.typeExpression.type) : node.type;
- return node.dotDotDotToken !== undefined || !!type && type.kind === 295 /* JSDocVariadicType */;
+ return node.dotDotDotToken !== undefined || !!type && type.kind === 296 /* JSDocVariadicType */;
}
ts.isRestParameter = isRestParameter;
var AssignmentKind;
@@ -10515,31 +10698,31 @@
var parent = node.parent;
while (true) {
switch (parent.kind) {
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
var binaryOperator = parent.operatorToken.kind;
return isAssignmentOperator(binaryOperator) && parent.left === node ?
- binaryOperator === 59 /* EqualsToken */ ? 1 /* Definite */ : 2 /* Compound */ :
+ binaryOperator === 60 /* EqualsToken */ ? 1 /* Definite */ : 2 /* Compound */ :
0 /* None */;
- case 202 /* PrefixUnaryExpression */:
- case 203 /* PostfixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
var unaryOperator = parent.operator;
return unaryOperator === 44 /* PlusPlusToken */ || unaryOperator === 45 /* MinusMinusToken */ ? 2 /* Compound */ : 0 /* None */;
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
return parent.initializer === node ? 1 /* Definite */ : 0 /* None */;
- case 195 /* ParenthesizedExpression */:
- case 187 /* ArrayLiteralExpression */:
- case 208 /* SpreadElement */:
- case 213 /* NonNullExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 188 /* ArrayLiteralExpression */:
+ case 209 /* SpreadElement */:
+ case 214 /* NonNullExpression */:
node = parent;
break;
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
if (parent.name !== node) {
return 0 /* None */;
}
node = parent.parent;
break;
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
if (parent.name === node) {
return 0 /* None */;
}
@@ -10566,22 +10749,22 @@
*/
function isNodeWithPossibleHoistedDeclaration(node) {
switch (node.kind) {
- case 218 /* Block */:
- case 219 /* VariableStatement */:
- case 231 /* WithStatement */:
- case 222 /* IfStatement */:
- case 232 /* SwitchStatement */:
- case 246 /* CaseBlock */:
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
- case 233 /* LabeledStatement */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
- case 235 /* TryStatement */:
- case 274 /* CatchClause */:
+ case 219 /* Block */:
+ case 220 /* VariableStatement */:
+ case 232 /* WithStatement */:
+ case 223 /* IfStatement */:
+ case 233 /* SwitchStatement */:
+ case 247 /* CaseBlock */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
+ case 234 /* LabeledStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
+ case 236 /* TryStatement */:
+ case 275 /* CatchClause */:
return true;
}
return false;
@@ -10598,33 +10781,33 @@
return node;
}
function walkUpParenthesizedTypes(node) {
- return walkUp(node, 177 /* ParenthesizedType */);
+ return walkUp(node, 178 /* ParenthesizedType */);
}
ts.walkUpParenthesizedTypes = walkUpParenthesizedTypes;
function walkUpParenthesizedExpressions(node) {
- return walkUp(node, 195 /* ParenthesizedExpression */);
+ return walkUp(node, 196 /* ParenthesizedExpression */);
}
ts.walkUpParenthesizedExpressions = walkUpParenthesizedExpressions;
function skipParentheses(node) {
- while (node.kind === 195 /* ParenthesizedExpression */) {
+ while (node.kind === 196 /* ParenthesizedExpression */) {
node = node.expression;
}
return node;
}
ts.skipParentheses = skipParentheses;
function skipParenthesesUp(node) {
- while (node.kind === 195 /* ParenthesizedExpression */) {
+ while (node.kind === 196 /* ParenthesizedExpression */) {
node = node.parent;
}
return node;
}
// a node is delete target iff. it is PropertyAccessExpression/ElementAccessExpression with parentheses skipped
function isDeleteTarget(node) {
- if (node.kind !== 189 /* PropertyAccessExpression */ && node.kind !== 190 /* ElementAccessExpression */) {
+ if (node.kind !== 190 /* PropertyAccessExpression */ && node.kind !== 191 /* ElementAccessExpression */) {
return false;
}
node = walkUpParenthesizedExpressions(node.parent);
- return node && node.kind === 198 /* DeleteExpression */;
+ return node && node.kind === 199 /* DeleteExpression */;
}
ts.isDeleteTarget = isDeleteTarget;
function isNodeDescendantOf(node, ancestor) {
@@ -10650,7 +10833,7 @@
if (ts.isComputedPropertyName(parent))
return parent.parent;
// falls through
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
if (ts.isDeclaration(parent)) {
return parent.name === name ? parent : undefined;
}
@@ -10674,7 +10857,7 @@
ts.getDeclarationFromName = getDeclarationFromName;
function isLiteralComputedPropertyDeclarationName(node) {
return (node.kind === 10 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) &&
- node.parent.kind === 149 /* ComputedPropertyName */ &&
+ node.parent.kind === 150 /* ComputedPropertyName */ &&
ts.isDeclaration(node.parent.parent);
}
ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName;
@@ -10682,32 +10865,32 @@
function isIdentifierName(node) {
var parent = node.parent;
switch (parent.kind) {
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 278 /* EnumMember */:
- case 275 /* PropertyAssignment */:
- case 189 /* PropertyAccessExpression */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 279 /* EnumMember */:
+ case 276 /* PropertyAssignment */:
+ case 190 /* PropertyAccessExpression */:
// Name in member declaration or property name in property access
return parent.name === node;
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
// Name on right hand side of dot in a type query or type reference
if (parent.right === node) {
- while (parent.kind === 148 /* QualifiedName */) {
+ while (parent.kind === 149 /* QualifiedName */) {
parent = parent.parent;
}
- return parent.kind === 167 /* TypeQuery */ || parent.kind === 164 /* TypeReference */;
+ return parent.kind === 168 /* TypeQuery */ || parent.kind === 165 /* TypeReference */;
}
return false;
- case 186 /* BindingElement */:
- case 253 /* ImportSpecifier */:
+ case 187 /* BindingElement */:
+ case 254 /* ImportSpecifier */:
// Property name in binding element or import specifier
return parent.propertyName === node;
- case 257 /* ExportSpecifier */:
- case 267 /* JsxAttribute */:
+ case 258 /* ExportSpecifier */:
+ case 268 /* JsxAttribute */:
// Any name in an export specifier or JSX Attribute
return true;
}
@@ -10724,13 +10907,13 @@
// export default <EntityNameExpression>
// module.exports = <EntityNameExpression>
function isAliasSymbolDeclaration(node) {
- return node.kind === 248 /* ImportEqualsDeclaration */ ||
- node.kind === 247 /* NamespaceExportDeclaration */ ||
- node.kind === 250 /* ImportClause */ && !!node.name ||
- node.kind === 251 /* NamespaceImport */ ||
- node.kind === 253 /* ImportSpecifier */ ||
- node.kind === 257 /* ExportSpecifier */ ||
- node.kind === 254 /* ExportAssignment */ && exportAssignmentIsAlias(node) ||
+ return node.kind === 249 /* ImportEqualsDeclaration */ ||
+ node.kind === 248 /* NamespaceExportDeclaration */ ||
+ node.kind === 251 /* ImportClause */ && !!node.name ||
+ node.kind === 252 /* NamespaceImport */ ||
+ node.kind === 254 /* ImportSpecifier */ ||
+ node.kind === 258 /* ExportSpecifier */ ||
+ node.kind === 255 /* ExportAssignment */ && exportAssignmentIsAlias(node) ||
ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* ModuleExports */ && exportAssignmentIsAlias(node);
}
ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration;
@@ -10752,12 +10935,12 @@
}
ts.getEffectiveBaseTypeNode = getEffectiveBaseTypeNode;
function getClassExtendsHeritageElement(node) {
- var heritageClause = getHeritageClause(node.heritageClauses, 86 /* ExtendsKeyword */);
+ var heritageClause = getHeritageClause(node.heritageClauses, 87 /* ExtendsKeyword */);
return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined;
}
ts.getClassExtendsHeritageElement = getClassExtendsHeritageElement;
function getClassImplementsHeritageClauseElements(node) {
- var heritageClause = getHeritageClause(node.heritageClauses, 109 /* ImplementsKeyword */);
+ var heritageClause = getHeritageClause(node.heritageClauses, 110 /* ImplementsKeyword */);
return heritageClause ? heritageClause.types : undefined;
}
ts.getClassImplementsHeritageClauseElements = getClassImplementsHeritageClauseElements;
@@ -10769,7 +10952,7 @@
}
ts.getAllSuperTypeNodes = getAllSuperTypeNodes;
function getInterfaceBaseTypeNodes(node) {
- var heritageClause = getHeritageClause(node.heritageClauses, 86 /* ExtendsKeyword */);
+ var heritageClause = getHeritageClause(node.heritageClauses, 87 /* ExtendsKeyword */);
return heritageClause ? heritageClause.types : undefined;
}
ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes;
@@ -10803,11 +10986,11 @@
}
ts.getAncestor = getAncestor;
function isKeyword(token) {
- return 73 /* FirstKeyword */ <= token && token <= 147 /* LastKeyword */;
+ return 74 /* FirstKeyword */ <= token && token <= 148 /* LastKeyword */;
}
ts.isKeyword = isKeyword;
function isContextualKeyword(token) {
- return 118 /* FirstContextualKeyword */ <= token && token <= 147 /* LastContextualKeyword */;
+ return 119 /* FirstContextualKeyword */ <= token && token <= 148 /* LastContextualKeyword */;
}
ts.isContextualKeyword = isContextualKeyword;
function isNonContextualKeyword(token) {
@@ -10842,14 +11025,14 @@
}
var flags = 0 /* Normal */;
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 156 /* MethodDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 157 /* MethodDeclaration */:
if (node.asteriskToken) {
flags |= 1 /* Generator */;
}
// falls through
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
if (hasModifier(node, 256 /* Async */)) {
flags |= 2 /* Async */;
}
@@ -10863,10 +11046,10 @@
ts.getFunctionFlags = getFunctionFlags;
function isAsyncFunction(node) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 156 /* MethodDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
return node.body !== undefined
&& node.asteriskToken === undefined
&& hasModifier(node, 256 /* Async */);
@@ -10891,7 +11074,7 @@
}
ts.hasDynamicName = hasDynamicName;
function isDynamicName(name) {
- return name.kind === 149 /* ComputedPropertyName */ &&
+ return name.kind === 150 /* ComputedPropertyName */ &&
!isStringOrNumericLiteralLike(name.expression) &&
!isWellKnownSymbolSyntactically(name.expression);
}
@@ -10907,12 +11090,12 @@
ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically;
function getPropertyNameForPropertyNameNode(name) {
switch (name.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return name.escapedText;
case 10 /* StringLiteral */:
case 8 /* NumericLiteral */:
return ts.escapeLeadingUnderscores(name.text);
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
var nameExpression = name.expression;
if (isWellKnownSymbolSyntactically(nameExpression)) {
return getPropertyNameForKnownSymbolName(ts.idText(nameExpression.name));
@@ -10928,7 +11111,7 @@
ts.getPropertyNameForPropertyNameNode = getPropertyNameForPropertyNameNode;
function isPropertyNameLiteral(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
case 10 /* StringLiteral */:
case 14 /* NoSubstitutionTemplateLiteral */:
case 8 /* NumericLiteral */:
@@ -10939,11 +11122,11 @@
}
ts.isPropertyNameLiteral = isPropertyNameLiteral;
function getTextOfIdentifierOrLiteral(node) {
- return node.kind === 72 /* Identifier */ ? ts.idText(node) : node.text;
+ return node.kind === 73 /* Identifier */ ? ts.idText(node) : node.text;
}
ts.getTextOfIdentifierOrLiteral = getTextOfIdentifierOrLiteral;
function getEscapedTextOfIdentifierOrLiteral(node) {
- return node.kind === 72 /* Identifier */ ? node.escapedText : ts.escapeLeadingUnderscores(node.text);
+ return node.kind === 73 /* Identifier */ ? node.escapedText : ts.escapeLeadingUnderscores(node.text);
}
ts.getEscapedTextOfIdentifierOrLiteral = getEscapedTextOfIdentifierOrLiteral;
function getPropertyNameForKnownSymbolName(symbolName) {
@@ -10958,7 +11141,7 @@
* Includes the word "Symbol" with unicode escapes
*/
function isESSymbolIdentifier(node) {
- return node.kind === 72 /* Identifier */ && node.escapedText === "Symbol";
+ return node.kind === 73 /* Identifier */ && node.escapedText === "Symbol";
}
ts.isESSymbolIdentifier = isESSymbolIdentifier;
function isPushOrUnshiftIdentifier(node) {
@@ -10967,11 +11150,11 @@
ts.isPushOrUnshiftIdentifier = isPushOrUnshiftIdentifier;
function isParameterDeclaration(node) {
var root = getRootDeclaration(node);
- return root.kind === 151 /* Parameter */;
+ return root.kind === 152 /* Parameter */;
}
ts.isParameterDeclaration = isParameterDeclaration;
function getRootDeclaration(node) {
- while (node.kind === 186 /* BindingElement */) {
+ while (node.kind === 187 /* BindingElement */) {
node = node.parent.parent;
}
return node;
@@ -10979,15 +11162,15 @@
ts.getRootDeclaration = getRootDeclaration;
function nodeStartsNewLexicalEnvironment(node) {
var kind = node.kind;
- return kind === 157 /* Constructor */
- || kind === 196 /* FunctionExpression */
- || kind === 239 /* FunctionDeclaration */
- || kind === 197 /* ArrowFunction */
- || kind === 156 /* MethodDeclaration */
- || kind === 158 /* GetAccessor */
- || kind === 159 /* SetAccessor */
- || kind === 244 /* ModuleDeclaration */
- || kind === 284 /* SourceFile */;
+ return kind === 158 /* Constructor */
+ || kind === 197 /* FunctionExpression */
+ || kind === 240 /* FunctionDeclaration */
+ || kind === 198 /* ArrowFunction */
+ || kind === 157 /* MethodDeclaration */
+ || kind === 159 /* GetAccessor */
+ || kind === 160 /* SetAccessor */
+ || kind === 245 /* ModuleDeclaration */
+ || kind === 285 /* SourceFile */;
}
ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment;
function nodeIsSynthesized(range) {
@@ -11006,38 +11189,38 @@
})(Associativity = ts.Associativity || (ts.Associativity = {}));
function getExpressionAssociativity(expression) {
var operator = getOperator(expression);
- var hasArguments = expression.kind === 192 /* NewExpression */ && expression.arguments !== undefined;
+ var hasArguments = expression.kind === 193 /* NewExpression */ && expression.arguments !== undefined;
return getOperatorAssociativity(expression.kind, operator, hasArguments);
}
ts.getExpressionAssociativity = getExpressionAssociativity;
function getOperatorAssociativity(kind, operator, hasArguments) {
switch (kind) {
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return hasArguments ? 0 /* Left */ : 1 /* Right */;
- case 202 /* PrefixUnaryExpression */:
- case 199 /* TypeOfExpression */:
- case 200 /* VoidExpression */:
- case 198 /* DeleteExpression */:
- case 201 /* AwaitExpression */:
- case 205 /* ConditionalExpression */:
- case 207 /* YieldExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 200 /* TypeOfExpression */:
+ case 201 /* VoidExpression */:
+ case 199 /* DeleteExpression */:
+ case 202 /* AwaitExpression */:
+ case 206 /* ConditionalExpression */:
+ case 208 /* YieldExpression */:
return 1 /* Right */;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
switch (operator) {
case 41 /* AsteriskAsteriskToken */:
- case 59 /* EqualsToken */:
- case 60 /* PlusEqualsToken */:
- case 61 /* MinusEqualsToken */:
- case 63 /* AsteriskAsteriskEqualsToken */:
- case 62 /* AsteriskEqualsToken */:
- case 64 /* SlashEqualsToken */:
- case 65 /* PercentEqualsToken */:
- case 66 /* LessThanLessThanEqualsToken */:
- case 67 /* GreaterThanGreaterThanEqualsToken */:
- case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
- case 69 /* AmpersandEqualsToken */:
- case 71 /* CaretEqualsToken */:
- case 70 /* BarEqualsToken */:
+ case 60 /* EqualsToken */:
+ case 61 /* PlusEqualsToken */:
+ case 62 /* MinusEqualsToken */:
+ case 64 /* AsteriskAsteriskEqualsToken */:
+ case 63 /* AsteriskEqualsToken */:
+ case 65 /* SlashEqualsToken */:
+ case 66 /* PercentEqualsToken */:
+ case 67 /* LessThanLessThanEqualsToken */:
+ case 68 /* GreaterThanGreaterThanEqualsToken */:
+ case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
+ case 70 /* AmpersandEqualsToken */:
+ case 72 /* CaretEqualsToken */:
+ case 71 /* BarEqualsToken */:
return 1 /* Right */;
}
}
@@ -11046,15 +11229,15 @@
ts.getOperatorAssociativity = getOperatorAssociativity;
function getExpressionPrecedence(expression) {
var operator = getOperator(expression);
- var hasArguments = expression.kind === 192 /* NewExpression */ && expression.arguments !== undefined;
+ var hasArguments = expression.kind === 193 /* NewExpression */ && expression.arguments !== undefined;
return getOperatorPrecedence(expression.kind, operator, hasArguments);
}
ts.getExpressionPrecedence = getExpressionPrecedence;
function getOperator(expression) {
- if (expression.kind === 204 /* BinaryExpression */) {
+ if (expression.kind === 205 /* BinaryExpression */) {
return expression.operatorToken.kind;
}
- else if (expression.kind === 202 /* PrefixUnaryExpression */ || expression.kind === 203 /* PostfixUnaryExpression */) {
+ else if (expression.kind === 203 /* PrefixUnaryExpression */ || expression.kind === 204 /* PostfixUnaryExpression */) {
return expression.operator;
}
else {
@@ -11064,73 +11247,73 @@
ts.getOperator = getOperator;
function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
switch (nodeKind) {
- case 314 /* CommaListExpression */:
+ case 315 /* CommaListExpression */:
return 0;
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
return 1;
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return 2;
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return 4;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
switch (operatorKind) {
case 27 /* CommaToken */:
return 0;
- case 59 /* EqualsToken */:
- case 60 /* PlusEqualsToken */:
- case 61 /* MinusEqualsToken */:
- case 63 /* AsteriskAsteriskEqualsToken */:
- case 62 /* AsteriskEqualsToken */:
- case 64 /* SlashEqualsToken */:
- case 65 /* PercentEqualsToken */:
- case 66 /* LessThanLessThanEqualsToken */:
- case 67 /* GreaterThanGreaterThanEqualsToken */:
- case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
- case 69 /* AmpersandEqualsToken */:
- case 71 /* CaretEqualsToken */:
- case 70 /* BarEqualsToken */:
+ case 60 /* EqualsToken */:
+ case 61 /* PlusEqualsToken */:
+ case 62 /* MinusEqualsToken */:
+ case 64 /* AsteriskAsteriskEqualsToken */:
+ case 63 /* AsteriskEqualsToken */:
+ case 65 /* SlashEqualsToken */:
+ case 66 /* PercentEqualsToken */:
+ case 67 /* LessThanLessThanEqualsToken */:
+ case 68 /* GreaterThanGreaterThanEqualsToken */:
+ case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
+ case 70 /* AmpersandEqualsToken */:
+ case 72 /* CaretEqualsToken */:
+ case 71 /* BarEqualsToken */:
return 3;
default:
return getBinaryOperatorPrecedence(operatorKind);
}
- case 202 /* PrefixUnaryExpression */:
- case 199 /* TypeOfExpression */:
- case 200 /* VoidExpression */:
- case 198 /* DeleteExpression */:
- case 201 /* AwaitExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 200 /* TypeOfExpression */:
+ case 201 /* VoidExpression */:
+ case 199 /* DeleteExpression */:
+ case 202 /* AwaitExpression */:
return 16;
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return 17;
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return 18;
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return hasArguments ? 19 : 18;
- case 193 /* TaggedTemplateExpression */:
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 194 /* TaggedTemplateExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return 19;
- case 100 /* ThisKeyword */:
- case 98 /* SuperKeyword */:
- case 72 /* Identifier */:
- case 96 /* NullKeyword */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
+ case 101 /* ThisKeyword */:
+ case 99 /* SuperKeyword */:
+ case 73 /* Identifier */:
+ case 97 /* NullKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
case 10 /* StringLiteral */:
- case 187 /* ArrayLiteralExpression */:
- case 188 /* ObjectLiteralExpression */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 209 /* ClassExpression */:
- case 260 /* JsxElement */:
- case 261 /* JsxSelfClosingElement */:
- case 264 /* JsxFragment */:
+ case 188 /* ArrayLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 210 /* ClassExpression */:
+ case 261 /* JsxElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 265 /* JsxFragment */:
case 13 /* RegularExpressionLiteral */:
case 14 /* NoSubstitutionTemplateLiteral */:
- case 206 /* TemplateExpression */:
- case 195 /* ParenthesizedExpression */:
- case 210 /* OmittedExpression */:
+ case 207 /* TemplateExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 211 /* OmittedExpression */:
return 20;
default:
return -1;
@@ -11158,9 +11341,9 @@
case 30 /* GreaterThanToken */:
case 31 /* LessThanEqualsToken */:
case 32 /* GreaterThanEqualsToken */:
- case 94 /* InstanceOfKeyword */:
- case 93 /* InKeyword */:
- case 119 /* AsKeyword */:
+ case 95 /* InstanceOfKeyword */:
+ case 94 /* InKeyword */:
+ case 120 /* AsKeyword */:
return 11;
case 46 /* LessThanLessThanToken */:
case 47 /* GreaterThanGreaterThanToken */:
@@ -11622,11 +11805,11 @@
}
ts.parameterIsThisKeyword = parameterIsThisKeyword;
function isThisIdentifier(node) {
- return !!node && node.kind === 72 /* Identifier */ && identifierIsThisKeyword(node);
+ return !!node && node.kind === 73 /* Identifier */ && identifierIsThisKeyword(node);
}
ts.isThisIdentifier = isThisIdentifier;
function identifierIsThisKeyword(id) {
- return id.originalKeywordKind === 100 /* ThisKeyword */;
+ return id.originalKeywordKind === 101 /* ThisKeyword */;
}
ts.identifierIsThisKeyword = identifierIsThisKeyword;
function getAllAccessorDeclarations(declarations, accessor) {
@@ -11637,10 +11820,10 @@
var setAccessor;
if (hasDynamicName(accessor)) {
firstAccessor = accessor;
- if (accessor.kind === 158 /* GetAccessor */) {
+ if (accessor.kind === 159 /* GetAccessor */) {
getAccessor = accessor;
}
- else if (accessor.kind === 159 /* SetAccessor */) {
+ else if (accessor.kind === 160 /* SetAccessor */) {
setAccessor = accessor;
}
else {
@@ -11660,10 +11843,10 @@
else if (!secondAccessor) {
secondAccessor = member;
}
- if (member.kind === 158 /* GetAccessor */ && !getAccessor) {
+ if (member.kind === 159 /* GetAccessor */ && !getAccessor) {
getAccessor = member;
}
- if (member.kind === 159 /* SetAccessor */ && !setAccessor) {
+ if (member.kind === 160 /* SetAccessor */ && !setAccessor) {
setAccessor = member;
}
}
@@ -11709,7 +11892,7 @@
ts.getJSDocTypeParameterDeclarations = getJSDocTypeParameterDeclarations;
/** template tags are only available when a typedef isn't already using them */
function isNonTypeAliasTemplate(tag) {
- return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 296 /* JSDocComment */ && tag.parent.tags.some(isJSDocTypeAlias));
+ return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 297 /* JSDocComment */ && tag.parent.tags.some(isJSDocTypeAlias));
}
/**
* Gets the effective type annotation of the value parameter of a set accessor. If the node
@@ -11949,7 +12132,7 @@
flags |= modifierToFlag(modifier.kind);
}
}
- if (node.flags & 4 /* NestedNamespace */ || (node.kind === 72 /* Identifier */ && node.isInJSDocNamespace)) {
+ if (node.flags & 4 /* NestedNamespace */ || (node.kind === 73 /* Identifier */ && node.isInJSDocNamespace)) {
flags |= 1 /* Export */;
}
return flags;
@@ -11957,17 +12140,17 @@
ts.getModifierFlagsNoCache = getModifierFlagsNoCache;
function modifierToFlag(token) {
switch (token) {
- case 116 /* StaticKeyword */: return 32 /* Static */;
- case 115 /* PublicKeyword */: return 4 /* Public */;
- case 114 /* ProtectedKeyword */: return 16 /* Protected */;
- case 113 /* PrivateKeyword */: return 8 /* Private */;
- case 118 /* AbstractKeyword */: return 128 /* Abstract */;
- case 85 /* ExportKeyword */: return 1 /* Export */;
- case 125 /* DeclareKeyword */: return 2 /* Ambient */;
- case 77 /* ConstKeyword */: return 2048 /* Const */;
- case 80 /* DefaultKeyword */: return 512 /* Default */;
- case 121 /* AsyncKeyword */: return 256 /* Async */;
- case 133 /* ReadonlyKeyword */: return 64 /* Readonly */;
+ case 117 /* StaticKeyword */: return 32 /* Static */;
+ case 116 /* PublicKeyword */: return 4 /* Public */;
+ case 115 /* ProtectedKeyword */: return 16 /* Protected */;
+ case 114 /* PrivateKeyword */: return 8 /* Private */;
+ case 119 /* AbstractKeyword */: return 128 /* Abstract */;
+ case 86 /* ExportKeyword */: return 1 /* Export */;
+ case 126 /* DeclareKeyword */: return 2 /* Ambient */;
+ case 78 /* ConstKeyword */: return 2048 /* Const */;
+ case 81 /* DefaultKeyword */: return 512 /* Default */;
+ case 122 /* AsyncKeyword */: return 256 /* Async */;
+ case 134 /* ReadonlyKeyword */: return 64 /* Readonly */;
}
return 0 /* None */;
}
@@ -11979,7 +12162,7 @@
}
ts.isLogicalOperator = isLogicalOperator;
function isAssignmentOperator(token) {
- return token >= 59 /* FirstAssignment */ && token <= 71 /* LastAssignment */;
+ return token >= 60 /* FirstAssignment */ && token <= 72 /* LastAssignment */;
}
ts.isAssignmentOperator = isAssignmentOperator;
/** Get `C` given `N` if `N` is in the position `class C extends N` where `N` is an ExpressionWithTypeArguments. */
@@ -11992,14 +12175,14 @@
return ts.isExpressionWithTypeArguments(node)
&& ts.isHeritageClause(node.parent)
&& ts.isClassLike(node.parent.parent)
- ? { class: node.parent.parent, isImplements: node.parent.token === 109 /* ImplementsKeyword */ }
+ ? { class: node.parent.parent, isImplements: node.parent.token === 110 /* ImplementsKeyword */ }
: undefined;
}
ts.tryGetClassImplementingOrExtendingExpressionWithTypeArguments = tryGetClassImplementingOrExtendingExpressionWithTypeArguments;
function isAssignmentExpression(node, excludeCompoundAssignment) {
return ts.isBinaryExpression(node)
&& (excludeCompoundAssignment
- ? node.operatorToken.kind === 59 /* EqualsToken */
+ ? node.operatorToken.kind === 60 /* EqualsToken */
: isAssignmentOperator(node.operatorToken.kind))
&& ts.isLeftHandSideExpression(node.left);
}
@@ -12007,8 +12190,8 @@
function isDestructuringAssignment(node) {
if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) {
var kind = node.left.kind;
- return kind === 188 /* ObjectLiteralExpression */
- || kind === 187 /* ArrayLiteralExpression */;
+ return kind === 189 /* ObjectLiteralExpression */
+ || kind === 188 /* ArrayLiteralExpression */;
}
return false;
}
@@ -12018,29 +12201,39 @@
}
ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause;
function isEntityNameExpression(node) {
- return node.kind === 72 /* Identifier */ || isPropertyAccessEntityNameExpression(node);
+ return node.kind === 73 /* Identifier */ || isPropertyAccessEntityNameExpression(node);
}
ts.isEntityNameExpression = isEntityNameExpression;
function isPropertyAccessEntityNameExpression(node) {
return ts.isPropertyAccessExpression(node) && isEntityNameExpression(node.expression);
}
ts.isPropertyAccessEntityNameExpression = isPropertyAccessEntityNameExpression;
+ function tryGetPropertyAccessOrIdentifierToString(expr) {
+ if (ts.isPropertyAccessExpression(expr)) {
+ return tryGetPropertyAccessOrIdentifierToString(expr.expression) + "." + expr.name;
+ }
+ if (ts.isIdentifier(expr)) {
+ return ts.unescapeLeadingUnderscores(expr.escapedText);
+ }
+ return undefined;
+ }
+ ts.tryGetPropertyAccessOrIdentifierToString = tryGetPropertyAccessOrIdentifierToString;
function isPrototypeAccess(node) {
return ts.isPropertyAccessExpression(node) && node.name.escapedText === "prototype";
}
ts.isPrototypeAccess = isPrototypeAccess;
function isRightSideOfQualifiedNameOrPropertyAccess(node) {
- return (node.parent.kind === 148 /* QualifiedName */ && node.parent.right === node) ||
- (node.parent.kind === 189 /* PropertyAccessExpression */ && node.parent.name === node);
+ return (node.parent.kind === 149 /* QualifiedName */ && node.parent.right === node) ||
+ (node.parent.kind === 190 /* PropertyAccessExpression */ && node.parent.name === node);
}
ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess;
function isEmptyObjectLiteral(expression) {
- return expression.kind === 188 /* ObjectLiteralExpression */ &&
+ return expression.kind === 189 /* ObjectLiteralExpression */ &&
expression.properties.length === 0;
}
ts.isEmptyObjectLiteral = isEmptyObjectLiteral;
function isEmptyArrayLiteral(expression) {
- return expression.kind === 187 /* ArrayLiteralExpression */ &&
+ return expression.kind === 188 /* ArrayLiteralExpression */ &&
expression.elements.length === 0;
}
ts.isEmptyArrayLiteral = isEmptyArrayLiteral;
@@ -12229,77 +12422,6 @@
}
ts.getNewLineCharacter = getNewLineCharacter;
/**
- * Formats an enum value as a string for debugging and debug assertions.
- */
- function formatEnum(value, enumObject, isFlags) {
- if (value === void 0) { value = 0; }
- var members = getEnumMembers(enumObject);
- if (value === 0) {
- return members.length > 0 && members[0][0] === 0 ? members[0][1] : "0";
- }
- if (isFlags) {
- var result = "";
- var remainingFlags = value;
- for (var i = members.length - 1; i >= 0 && remainingFlags !== 0; i--) {
- var _a = members[i], enumValue = _a[0], enumName = _a[1];
- if (enumValue !== 0 && (remainingFlags & enumValue) === enumValue) {
- remainingFlags &= ~enumValue;
- result = "" + enumName + (result ? ", " : "") + result;
- }
- }
- if (remainingFlags === 0) {
- return result;
- }
- }
- else {
- for (var _i = 0, members_1 = members; _i < members_1.length; _i++) {
- var _b = members_1[_i], enumValue = _b[0], enumName = _b[1];
- if (enumValue === value) {
- return enumName;
- }
- }
- }
- return value.toString();
- }
- function getEnumMembers(enumObject) {
- var result = [];
- for (var name in enumObject) {
- var value = enumObject[name];
- if (typeof value === "number") {
- result.push([value, name]);
- }
- }
- return ts.stableSort(result, function (x, y) { return ts.compareValues(x[0], y[0]); });
- }
- function formatSyntaxKind(kind) {
- return formatEnum(kind, ts.SyntaxKind, /*isFlags*/ false);
- }
- ts.formatSyntaxKind = formatSyntaxKind;
- function formatModifierFlags(flags) {
- return formatEnum(flags, ts.ModifierFlags, /*isFlags*/ true);
- }
- ts.formatModifierFlags = formatModifierFlags;
- function formatTransformFlags(flags) {
- return formatEnum(flags, ts.TransformFlags, /*isFlags*/ true);
- }
- ts.formatTransformFlags = formatTransformFlags;
- function formatEmitFlags(flags) {
- return formatEnum(flags, ts.EmitFlags, /*isFlags*/ true);
- }
- ts.formatEmitFlags = formatEmitFlags;
- function formatSymbolFlags(flags) {
- return formatEnum(flags, ts.SymbolFlags, /*isFlags*/ true);
- }
- ts.formatSymbolFlags = formatSymbolFlags;
- function formatTypeFlags(flags) {
- return formatEnum(flags, ts.TypeFlags, /*isFlags*/ true);
- }
- ts.formatTypeFlags = formatTypeFlags;
- function formatObjectFlags(flags) {
- return formatEnum(flags, ts.ObjectFlags, /*isFlags*/ true);
- }
- ts.formatObjectFlags = formatObjectFlags;
- /**
* Creates a new TextRange from the provided pos and end.
*
* @param pos The start position.
@@ -12388,6 +12510,10 @@
return positionsAreOnSameLine(range1.end, getStartPositionOfRange(range2, sourceFile), sourceFile);
}
ts.rangeEndIsOnSameLineAsRangeStart = rangeEndIsOnSameLineAsRangeStart;
+ function isNodeArrayMultiLine(list, sourceFile) {
+ return !positionsAreOnSameLine(list.pos, list.end, sourceFile);
+ }
+ ts.isNodeArrayMultiLine = isNodeArrayMultiLine;
function positionsAreOnSameLine(pos1, pos2, sourceFile) {
return pos1 === pos2 ||
getLineOfLocalPosition(sourceFile, pos1) === getLineOfLocalPosition(sourceFile, pos2);
@@ -12405,8 +12531,8 @@
var parseNode = ts.getParseTreeNode(node);
if (parseNode) {
switch (parseNode.parent.kind) {
- case 243 /* EnumDeclaration */:
- case 244 /* ModuleDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 245 /* ModuleDeclaration */:
return parseNode === parseNode.parent.name;
}
}
@@ -12440,10 +12566,10 @@
}
if (getCheckFlags(s) & 6 /* Synthetic */) {
var checkFlags = s.checkFlags;
- var accessModifier = checkFlags & 512 /* ContainsPrivate */ ? 8 /* Private */ :
- checkFlags & 128 /* ContainsPublic */ ? 4 /* Public */ :
+ var accessModifier = checkFlags & 1024 /* ContainsPrivate */ ? 8 /* Private */ :
+ checkFlags & 256 /* ContainsPublic */ ? 4 /* Public */ :
16 /* Protected */;
- var staticModifier = checkFlags & 1024 /* ContainsStatic */ ? 32 /* Static */ : 0;
+ var staticModifier = checkFlags & 2048 /* ContainsStatic */ ? 32 /* Static */ : 0;
return accessModifier | staticModifier;
}
if (s.flags & 4194304 /* Prototype */) {
@@ -12483,35 +12609,35 @@
if (!parent)
return 0 /* Read */;
switch (parent.kind) {
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return accessKind(parent);
- case 203 /* PostfixUnaryExpression */:
- case 202 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
var operator = parent.operator;
return operator === 44 /* PlusPlusToken */ || operator === 45 /* MinusMinusToken */ ? writeOrReadWrite() : 0 /* Read */;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
var _a = parent, left = _a.left, operatorToken = _a.operatorToken;
return left === node && isAssignmentOperator(operatorToken.kind) ?
- operatorToken.kind === 59 /* EqualsToken */ ? 1 /* Write */ : writeOrReadWrite()
+ operatorToken.kind === 60 /* EqualsToken */ ? 1 /* Write */ : writeOrReadWrite()
: 0 /* Read */;
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return parent.name !== node ? 0 /* Read */ : accessKind(parent);
- case 275 /* PropertyAssignment */: {
+ case 276 /* PropertyAssignment */: {
var parentAccess = accessKind(parent.parent);
// In `({ x: varname }) = { x: 1 }`, the left `x` is a read, the right `x` is a write.
return node === parent.name ? reverseAccessKind(parentAccess) : parentAccess;
}
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
// Assume it's the local variable being accessed, since we don't check public properties for --noUnusedLocals.
return node === parent.objectAssignmentInitializer ? 0 /* Read */ : accessKind(parent.parent);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return accessKind(parent);
default:
return 0 /* Read */;
}
function writeOrReadWrite() {
// If grandparent is not an ExpressionStatement, this is used as an expression in addition to having a side effect.
- return parent.parent && skipParenthesesUp(parent.parent).kind === 221 /* ExpressionStatement */ ? 1 /* Write */ : 2 /* ReadWrite */;
+ return parent.parent && skipParenthesesUp(parent.parent).kind === 222 /* ExpressionStatement */ ? 1 /* Write */ : 2 /* ReadWrite */;
}
}
function reverseAccessKind(a) {
@@ -12666,32 +12792,32 @@
}
ts.isObjectTypeDeclaration = isObjectTypeDeclaration;
function isTypeNodeKind(kind) {
- return (kind >= 163 /* FirstTypeNode */ && kind <= 183 /* LastTypeNode */)
- || kind === 120 /* AnyKeyword */
- || kind === 143 /* UnknownKeyword */
- || kind === 135 /* NumberKeyword */
- || kind === 146 /* BigIntKeyword */
- || kind === 136 /* ObjectKeyword */
- || kind === 123 /* BooleanKeyword */
- || kind === 138 /* StringKeyword */
- || kind === 139 /* SymbolKeyword */
- || kind === 100 /* ThisKeyword */
- || kind === 106 /* VoidKeyword */
- || kind === 141 /* UndefinedKeyword */
- || kind === 96 /* NullKeyword */
- || kind === 132 /* NeverKeyword */
- || kind === 211 /* ExpressionWithTypeArguments */
- || kind === 289 /* JSDocAllType */
- || kind === 290 /* JSDocUnknownType */
- || kind === 291 /* JSDocNullableType */
- || kind === 292 /* JSDocNonNullableType */
- || kind === 293 /* JSDocOptionalType */
- || kind === 294 /* JSDocFunctionType */
- || kind === 295 /* JSDocVariadicType */;
+ return (kind >= 164 /* FirstTypeNode */ && kind <= 184 /* LastTypeNode */)
+ || kind === 121 /* AnyKeyword */
+ || kind === 144 /* UnknownKeyword */
+ || kind === 136 /* NumberKeyword */
+ || kind === 147 /* BigIntKeyword */
+ || kind === 137 /* ObjectKeyword */
+ || kind === 124 /* BooleanKeyword */
+ || kind === 139 /* StringKeyword */
+ || kind === 140 /* SymbolKeyword */
+ || kind === 101 /* ThisKeyword */
+ || kind === 107 /* VoidKeyword */
+ || kind === 142 /* UndefinedKeyword */
+ || kind === 97 /* NullKeyword */
+ || kind === 133 /* NeverKeyword */
+ || kind === 212 /* ExpressionWithTypeArguments */
+ || kind === 290 /* JSDocAllType */
+ || kind === 291 /* JSDocUnknownType */
+ || kind === 292 /* JSDocNullableType */
+ || kind === 293 /* JSDocNonNullableType */
+ || kind === 294 /* JSDocOptionalType */
+ || kind === 295 /* JSDocFunctionType */
+ || kind === 296 /* JSDocVariadicType */;
}
ts.isTypeNodeKind = isTypeNodeKind;
function isAccessExpression(node) {
- return node.kind === 189 /* PropertyAccessExpression */ || node.kind === 190 /* ElementAccessExpression */;
+ return node.kind === 190 /* PropertyAccessExpression */ || node.kind === 191 /* ElementAccessExpression */;
}
ts.isAccessExpression = isAccessExpression;
function isBundleFileTextLike(section) {
@@ -12708,8 +12834,10 @@
(function (ts) {
function getDefaultLibFileName(options) {
switch (options.target) {
- case 7 /* ESNext */:
+ case 8 /* ESNext */:
return "lib.esnext.full.d.ts";
+ case 7 /* ES2020 */:
+ return "lib.es2020.full.d.ts";
case 6 /* ES2019 */:
return "lib.es2019.full.d.ts";
case 5 /* ES2018 */:
@@ -12926,9 +13054,9 @@
}
ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions;
function getTypeParameterOwner(d) {
- if (d && d.kind === 150 /* TypeParameter */) {
+ if (d && d.kind === 151 /* TypeParameter */) {
for (var current = d; current; current = current.parent) {
- if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 241 /* InterfaceDeclaration */) {
+ if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 242 /* InterfaceDeclaration */) {
return current;
}
}
@@ -12936,7 +13064,7 @@
}
ts.getTypeParameterOwner = getTypeParameterOwner;
function isParameterPropertyDeclaration(node) {
- return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) && node.parent.kind === 157 /* Constructor */;
+ return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) && node.parent.kind === 158 /* Constructor */;
}
ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration;
function isEmptyBindingPattern(node) {
@@ -12966,14 +13094,14 @@
node = walkUpBindingElementsAndPatterns(node);
}
var flags = getFlags(node);
- if (node.kind === 237 /* VariableDeclaration */) {
+ if (node.kind === 238 /* VariableDeclaration */) {
node = node.parent;
}
- if (node && node.kind === 238 /* VariableDeclarationList */) {
+ if (node && node.kind === 239 /* VariableDeclarationList */) {
flags |= getFlags(node);
node = node.parent;
}
- if (node && node.kind === 219 /* VariableStatement */) {
+ if (node && node.kind === 220 /* VariableStatement */) {
flags |= getFlags(node);
}
return flags;
@@ -13119,27 +13247,27 @@
}
// Covers remaining cases (returning undefined if none match).
switch (hostNode.kind) {
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
if (hostNode.declarationList && hostNode.declarationList.declarations[0]) {
return getDeclarationIdentifier(hostNode.declarationList.declarations[0]);
}
break;
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
var expr = hostNode.expression;
switch (expr.kind) {
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return expr.name;
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
var arg = expr.argumentExpression;
if (ts.isIdentifier(arg)) {
return arg;
}
}
break;
- case 195 /* ParenthesizedExpression */: {
+ case 196 /* ParenthesizedExpression */: {
return getDeclarationIdentifier(hostNode.expression);
}
- case 233 /* LabeledStatement */: {
+ case 234 /* LabeledStatement */: {
if (ts.isDeclaration(hostNode.statement) || ts.isExpression(hostNode.statement)) {
return getDeclarationIdentifier(hostNode.statement);
}
@@ -13163,18 +13291,18 @@
/** @internal */
function getNonAssignedNameOfDeclaration(declaration) {
switch (declaration.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return declaration;
- case 310 /* JSDocPropertyTag */:
- case 304 /* JSDocParameterTag */: {
+ case 311 /* JSDocPropertyTag */:
+ case 305 /* JSDocParameterTag */: {
var name = declaration.name;
- if (name.kind === 148 /* QualifiedName */) {
+ if (name.kind === 149 /* QualifiedName */) {
return name.right;
}
break;
}
- case 191 /* CallExpression */:
- case 204 /* BinaryExpression */: {
+ case 192 /* CallExpression */:
+ case 205 /* BinaryExpression */: {
var expr = declaration;
switch (ts.getAssignmentDeclarationKind(expr)) {
case 1 /* ExportsProperty */:
@@ -13190,9 +13318,9 @@
return undefined;
}
}
- case 309 /* JSDocTypedefTag */:
+ case 310 /* JSDocTypedefTag */:
return getNameOfJSDocTypedef(declaration);
- case 254 /* ExportAssignment */: {
+ case 255 /* ExportAssignment */: {
var expression = declaration.expression;
return ts.isIdentifier(expression) ? expression : undefined;
}
@@ -13394,7 +13522,7 @@
return ts.emptyArray;
}
if (ts.isJSDocTypeAlias(node)) {
- ts.Debug.assert(node.parent.kind === 296 /* JSDocComment */);
+ ts.Debug.assert(node.parent.kind === 297 /* JSDocComment */);
return ts.flatMap(node.parent.tags, function (tag) { return ts.isJSDocTemplateTag(tag) ? tag.typeParameters : undefined; });
}
if (node.typeParameters) {
@@ -13462,198 +13590,198 @@
}
ts.isTemplateTail = isTemplateTail;
function isIdentifier(node) {
- return node.kind === 72 /* Identifier */;
+ return node.kind === 73 /* Identifier */;
}
ts.isIdentifier = isIdentifier;
// Names
function isQualifiedName(node) {
- return node.kind === 148 /* QualifiedName */;
+ return node.kind === 149 /* QualifiedName */;
}
ts.isQualifiedName = isQualifiedName;
function isComputedPropertyName(node) {
- return node.kind === 149 /* ComputedPropertyName */;
+ return node.kind === 150 /* ComputedPropertyName */;
}
ts.isComputedPropertyName = isComputedPropertyName;
// Signature elements
function isTypeParameterDeclaration(node) {
- return node.kind === 150 /* TypeParameter */;
+ return node.kind === 151 /* TypeParameter */;
}
ts.isTypeParameterDeclaration = isTypeParameterDeclaration;
function isParameter(node) {
- return node.kind === 151 /* Parameter */;
+ return node.kind === 152 /* Parameter */;
}
ts.isParameter = isParameter;
function isDecorator(node) {
- return node.kind === 152 /* Decorator */;
+ return node.kind === 153 /* Decorator */;
}
ts.isDecorator = isDecorator;
// TypeMember
function isPropertySignature(node) {
- return node.kind === 153 /* PropertySignature */;
+ return node.kind === 154 /* PropertySignature */;
}
ts.isPropertySignature = isPropertySignature;
function isPropertyDeclaration(node) {
- return node.kind === 154 /* PropertyDeclaration */;
+ return node.kind === 155 /* PropertyDeclaration */;
}
ts.isPropertyDeclaration = isPropertyDeclaration;
function isMethodSignature(node) {
- return node.kind === 155 /* MethodSignature */;
+ return node.kind === 156 /* MethodSignature */;
}
ts.isMethodSignature = isMethodSignature;
function isMethodDeclaration(node) {
- return node.kind === 156 /* MethodDeclaration */;
+ return node.kind === 157 /* MethodDeclaration */;
}
ts.isMethodDeclaration = isMethodDeclaration;
function isConstructorDeclaration(node) {
- return node.kind === 157 /* Constructor */;
+ return node.kind === 158 /* Constructor */;
}
ts.isConstructorDeclaration = isConstructorDeclaration;
function isGetAccessorDeclaration(node) {
- return node.kind === 158 /* GetAccessor */;
+ return node.kind === 159 /* GetAccessor */;
}
ts.isGetAccessorDeclaration = isGetAccessorDeclaration;
function isSetAccessorDeclaration(node) {
- return node.kind === 159 /* SetAccessor */;
+ return node.kind === 160 /* SetAccessor */;
}
ts.isSetAccessorDeclaration = isSetAccessorDeclaration;
function isCallSignatureDeclaration(node) {
- return node.kind === 160 /* CallSignature */;
+ return node.kind === 161 /* CallSignature */;
}
ts.isCallSignatureDeclaration = isCallSignatureDeclaration;
function isConstructSignatureDeclaration(node) {
- return node.kind === 161 /* ConstructSignature */;
+ return node.kind === 162 /* ConstructSignature */;
}
ts.isConstructSignatureDeclaration = isConstructSignatureDeclaration;
function isIndexSignatureDeclaration(node) {
- return node.kind === 162 /* IndexSignature */;
+ return node.kind === 163 /* IndexSignature */;
}
ts.isIndexSignatureDeclaration = isIndexSignatureDeclaration;
/* @internal */
function isGetOrSetAccessorDeclaration(node) {
- return node.kind === 159 /* SetAccessor */ || node.kind === 158 /* GetAccessor */;
+ return node.kind === 160 /* SetAccessor */ || node.kind === 159 /* GetAccessor */;
}
ts.isGetOrSetAccessorDeclaration = isGetOrSetAccessorDeclaration;
// Type
function isTypePredicateNode(node) {
- return node.kind === 163 /* TypePredicate */;
+ return node.kind === 164 /* TypePredicate */;
}
ts.isTypePredicateNode = isTypePredicateNode;
function isTypeReferenceNode(node) {
- return node.kind === 164 /* TypeReference */;
+ return node.kind === 165 /* TypeReference */;
}
ts.isTypeReferenceNode = isTypeReferenceNode;
function isFunctionTypeNode(node) {
- return node.kind === 165 /* FunctionType */;
+ return node.kind === 166 /* FunctionType */;
}
ts.isFunctionTypeNode = isFunctionTypeNode;
function isConstructorTypeNode(node) {
- return node.kind === 166 /* ConstructorType */;
+ return node.kind === 167 /* ConstructorType */;
}
ts.isConstructorTypeNode = isConstructorTypeNode;
function isTypeQueryNode(node) {
- return node.kind === 167 /* TypeQuery */;
+ return node.kind === 168 /* TypeQuery */;
}
ts.isTypeQueryNode = isTypeQueryNode;
function isTypeLiteralNode(node) {
- return node.kind === 168 /* TypeLiteral */;
+ return node.kind === 169 /* TypeLiteral */;
}
ts.isTypeLiteralNode = isTypeLiteralNode;
function isArrayTypeNode(node) {
- return node.kind === 169 /* ArrayType */;
+ return node.kind === 170 /* ArrayType */;
}
ts.isArrayTypeNode = isArrayTypeNode;
function isTupleTypeNode(node) {
- return node.kind === 170 /* TupleType */;
+ return node.kind === 171 /* TupleType */;
}
ts.isTupleTypeNode = isTupleTypeNode;
function isUnionTypeNode(node) {
- return node.kind === 173 /* UnionType */;
+ return node.kind === 174 /* UnionType */;
}
ts.isUnionTypeNode = isUnionTypeNode;
function isIntersectionTypeNode(node) {
- return node.kind === 174 /* IntersectionType */;
+ return node.kind === 175 /* IntersectionType */;
}
ts.isIntersectionTypeNode = isIntersectionTypeNode;
function isConditionalTypeNode(node) {
- return node.kind === 175 /* ConditionalType */;
+ return node.kind === 176 /* ConditionalType */;
}
ts.isConditionalTypeNode = isConditionalTypeNode;
function isInferTypeNode(node) {
- return node.kind === 176 /* InferType */;
+ return node.kind === 177 /* InferType */;
}
ts.isInferTypeNode = isInferTypeNode;
function isParenthesizedTypeNode(node) {
- return node.kind === 177 /* ParenthesizedType */;
+ return node.kind === 178 /* ParenthesizedType */;
}
ts.isParenthesizedTypeNode = isParenthesizedTypeNode;
function isThisTypeNode(node) {
- return node.kind === 178 /* ThisType */;
+ return node.kind === 179 /* ThisType */;
}
ts.isThisTypeNode = isThisTypeNode;
function isTypeOperatorNode(node) {
- return node.kind === 179 /* TypeOperator */;
+ return node.kind === 180 /* TypeOperator */;
}
ts.isTypeOperatorNode = isTypeOperatorNode;
function isIndexedAccessTypeNode(node) {
- return node.kind === 180 /* IndexedAccessType */;
+ return node.kind === 181 /* IndexedAccessType */;
}
ts.isIndexedAccessTypeNode = isIndexedAccessTypeNode;
function isMappedTypeNode(node) {
- return node.kind === 181 /* MappedType */;
+ return node.kind === 182 /* MappedType */;
}
ts.isMappedTypeNode = isMappedTypeNode;
function isLiteralTypeNode(node) {
- return node.kind === 182 /* LiteralType */;
+ return node.kind === 183 /* LiteralType */;
}
ts.isLiteralTypeNode = isLiteralTypeNode;
function isImportTypeNode(node) {
- return node.kind === 183 /* ImportType */;
+ return node.kind === 184 /* ImportType */;
}
ts.isImportTypeNode = isImportTypeNode;
// Binding patterns
function isObjectBindingPattern(node) {
- return node.kind === 184 /* ObjectBindingPattern */;
+ return node.kind === 185 /* ObjectBindingPattern */;
}
ts.isObjectBindingPattern = isObjectBindingPattern;
function isArrayBindingPattern(node) {
- return node.kind === 185 /* ArrayBindingPattern */;
+ return node.kind === 186 /* ArrayBindingPattern */;
}
ts.isArrayBindingPattern = isArrayBindingPattern;
function isBindingElement(node) {
- return node.kind === 186 /* BindingElement */;
+ return node.kind === 187 /* BindingElement */;
}
ts.isBindingElement = isBindingElement;
// Expression
function isArrayLiteralExpression(node) {
- return node.kind === 187 /* ArrayLiteralExpression */;
+ return node.kind === 188 /* ArrayLiteralExpression */;
}
ts.isArrayLiteralExpression = isArrayLiteralExpression;
function isObjectLiteralExpression(node) {
- return node.kind === 188 /* ObjectLiteralExpression */;
+ return node.kind === 189 /* ObjectLiteralExpression */;
}
ts.isObjectLiteralExpression = isObjectLiteralExpression;
function isPropertyAccessExpression(node) {
- return node.kind === 189 /* PropertyAccessExpression */;
+ return node.kind === 190 /* PropertyAccessExpression */;
}
ts.isPropertyAccessExpression = isPropertyAccessExpression;
function isElementAccessExpression(node) {
- return node.kind === 190 /* ElementAccessExpression */;
+ return node.kind === 191 /* ElementAccessExpression */;
}
ts.isElementAccessExpression = isElementAccessExpression;
function isCallExpression(node) {
- return node.kind === 191 /* CallExpression */;
+ return node.kind === 192 /* CallExpression */;
}
ts.isCallExpression = isCallExpression;
function isNewExpression(node) {
- return node.kind === 192 /* NewExpression */;
+ return node.kind === 193 /* NewExpression */;
}
ts.isNewExpression = isNewExpression;
function isTaggedTemplateExpression(node) {
- return node.kind === 193 /* TaggedTemplateExpression */;
+ return node.kind === 194 /* TaggedTemplateExpression */;
}
ts.isTaggedTemplateExpression = isTaggedTemplateExpression;
function isTypeAssertion(node) {
- return node.kind === 194 /* TypeAssertionExpression */;
+ return node.kind === 195 /* TypeAssertionExpression */;
}
ts.isTypeAssertion = isTypeAssertion;
function isConstTypeReference(node) {
@@ -13662,376 +13790,376 @@
}
ts.isConstTypeReference = isConstTypeReference;
function isParenthesizedExpression(node) {
- return node.kind === 195 /* ParenthesizedExpression */;
+ return node.kind === 196 /* ParenthesizedExpression */;
}
ts.isParenthesizedExpression = isParenthesizedExpression;
function skipPartiallyEmittedExpressions(node) {
- while (node.kind === 313 /* PartiallyEmittedExpression */) {
+ while (node.kind === 314 /* PartiallyEmittedExpression */) {
node = node.expression;
}
return node;
}
ts.skipPartiallyEmittedExpressions = skipPartiallyEmittedExpressions;
function isFunctionExpression(node) {
- return node.kind === 196 /* FunctionExpression */;
+ return node.kind === 197 /* FunctionExpression */;
}
ts.isFunctionExpression = isFunctionExpression;
function isArrowFunction(node) {
- return node.kind === 197 /* ArrowFunction */;
+ return node.kind === 198 /* ArrowFunction */;
}
ts.isArrowFunction = isArrowFunction;
function isDeleteExpression(node) {
- return node.kind === 198 /* DeleteExpression */;
+ return node.kind === 199 /* DeleteExpression */;
}
ts.isDeleteExpression = isDeleteExpression;
function isTypeOfExpression(node) {
- return node.kind === 199 /* TypeOfExpression */;
+ return node.kind === 200 /* TypeOfExpression */;
}
ts.isTypeOfExpression = isTypeOfExpression;
function isVoidExpression(node) {
- return node.kind === 200 /* VoidExpression */;
+ return node.kind === 201 /* VoidExpression */;
}
ts.isVoidExpression = isVoidExpression;
function isAwaitExpression(node) {
- return node.kind === 201 /* AwaitExpression */;
+ return node.kind === 202 /* AwaitExpression */;
}
ts.isAwaitExpression = isAwaitExpression;
function isPrefixUnaryExpression(node) {
- return node.kind === 202 /* PrefixUnaryExpression */;
+ return node.kind === 203 /* PrefixUnaryExpression */;
}
ts.isPrefixUnaryExpression = isPrefixUnaryExpression;
function isPostfixUnaryExpression(node) {
- return node.kind === 203 /* PostfixUnaryExpression */;
+ return node.kind === 204 /* PostfixUnaryExpression */;
}
ts.isPostfixUnaryExpression = isPostfixUnaryExpression;
function isBinaryExpression(node) {
- return node.kind === 204 /* BinaryExpression */;
+ return node.kind === 205 /* BinaryExpression */;
}
ts.isBinaryExpression = isBinaryExpression;
function isConditionalExpression(node) {
- return node.kind === 205 /* ConditionalExpression */;
+ return node.kind === 206 /* ConditionalExpression */;
}
ts.isConditionalExpression = isConditionalExpression;
function isTemplateExpression(node) {
- return node.kind === 206 /* TemplateExpression */;
+ return node.kind === 207 /* TemplateExpression */;
}
ts.isTemplateExpression = isTemplateExpression;
function isYieldExpression(node) {
- return node.kind === 207 /* YieldExpression */;
+ return node.kind === 208 /* YieldExpression */;
}
ts.isYieldExpression = isYieldExpression;
function isSpreadElement(node) {
- return node.kind === 208 /* SpreadElement */;
+ return node.kind === 209 /* SpreadElement */;
}
ts.isSpreadElement = isSpreadElement;
function isClassExpression(node) {
- return node.kind === 209 /* ClassExpression */;
+ return node.kind === 210 /* ClassExpression */;
}
ts.isClassExpression = isClassExpression;
function isOmittedExpression(node) {
- return node.kind === 210 /* OmittedExpression */;
+ return node.kind === 211 /* OmittedExpression */;
}
ts.isOmittedExpression = isOmittedExpression;
function isExpressionWithTypeArguments(node) {
- return node.kind === 211 /* ExpressionWithTypeArguments */;
+ return node.kind === 212 /* ExpressionWithTypeArguments */;
}
ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments;
function isAsExpression(node) {
- return node.kind === 212 /* AsExpression */;
+ return node.kind === 213 /* AsExpression */;
}
ts.isAsExpression = isAsExpression;
function isNonNullExpression(node) {
- return node.kind === 213 /* NonNullExpression */;
+ return node.kind === 214 /* NonNullExpression */;
}
ts.isNonNullExpression = isNonNullExpression;
function isMetaProperty(node) {
- return node.kind === 214 /* MetaProperty */;
+ return node.kind === 215 /* MetaProperty */;
}
ts.isMetaProperty = isMetaProperty;
// Misc
function isTemplateSpan(node) {
- return node.kind === 216 /* TemplateSpan */;
+ return node.kind === 217 /* TemplateSpan */;
}
ts.isTemplateSpan = isTemplateSpan;
function isSemicolonClassElement(node) {
- return node.kind === 217 /* SemicolonClassElement */;
+ return node.kind === 218 /* SemicolonClassElement */;
}
ts.isSemicolonClassElement = isSemicolonClassElement;
// Block
function isBlock(node) {
- return node.kind === 218 /* Block */;
+ return node.kind === 219 /* Block */;
}
ts.isBlock = isBlock;
function isVariableStatement(node) {
- return node.kind === 219 /* VariableStatement */;
+ return node.kind === 220 /* VariableStatement */;
}
ts.isVariableStatement = isVariableStatement;
function isEmptyStatement(node) {
- return node.kind === 220 /* EmptyStatement */;
+ return node.kind === 221 /* EmptyStatement */;
}
ts.isEmptyStatement = isEmptyStatement;
function isExpressionStatement(node) {
- return node.kind === 221 /* ExpressionStatement */;
+ return node.kind === 222 /* ExpressionStatement */;
}
ts.isExpressionStatement = isExpressionStatement;
function isIfStatement(node) {
- return node.kind === 222 /* IfStatement */;
+ return node.kind === 223 /* IfStatement */;
}
ts.isIfStatement = isIfStatement;
function isDoStatement(node) {
- return node.kind === 223 /* DoStatement */;
+ return node.kind === 224 /* DoStatement */;
}
ts.isDoStatement = isDoStatement;
function isWhileStatement(node) {
- return node.kind === 224 /* WhileStatement */;
+ return node.kind === 225 /* WhileStatement */;
}
ts.isWhileStatement = isWhileStatement;
function isForStatement(node) {
- return node.kind === 225 /* ForStatement */;
+ return node.kind === 226 /* ForStatement */;
}
ts.isForStatement = isForStatement;
function isForInStatement(node) {
- return node.kind === 226 /* ForInStatement */;
+ return node.kind === 227 /* ForInStatement */;
}
ts.isForInStatement = isForInStatement;
function isForOfStatement(node) {
- return node.kind === 227 /* ForOfStatement */;
+ return node.kind === 228 /* ForOfStatement */;
}
ts.isForOfStatement = isForOfStatement;
function isContinueStatement(node) {
- return node.kind === 228 /* ContinueStatement */;
+ return node.kind === 229 /* ContinueStatement */;
}
ts.isContinueStatement = isContinueStatement;
function isBreakStatement(node) {
- return node.kind === 229 /* BreakStatement */;
+ return node.kind === 230 /* BreakStatement */;
}
ts.isBreakStatement = isBreakStatement;
function isBreakOrContinueStatement(node) {
- return node.kind === 229 /* BreakStatement */ || node.kind === 228 /* ContinueStatement */;
+ return node.kind === 230 /* BreakStatement */ || node.kind === 229 /* ContinueStatement */;
}
ts.isBreakOrContinueStatement = isBreakOrContinueStatement;
function isReturnStatement(node) {
- return node.kind === 230 /* ReturnStatement */;
+ return node.kind === 231 /* ReturnStatement */;
}
ts.isReturnStatement = isReturnStatement;
function isWithStatement(node) {
- return node.kind === 231 /* WithStatement */;
+ return node.kind === 232 /* WithStatement */;
}
ts.isWithStatement = isWithStatement;
function isSwitchStatement(node) {
- return node.kind === 232 /* SwitchStatement */;
+ return node.kind === 233 /* SwitchStatement */;
}
ts.isSwitchStatement = isSwitchStatement;
function isLabeledStatement(node) {
- return node.kind === 233 /* LabeledStatement */;
+ return node.kind === 234 /* LabeledStatement */;
}
ts.isLabeledStatement = isLabeledStatement;
function isThrowStatement(node) {
- return node.kind === 234 /* ThrowStatement */;
+ return node.kind === 235 /* ThrowStatement */;
}
ts.isThrowStatement = isThrowStatement;
function isTryStatement(node) {
- return node.kind === 235 /* TryStatement */;
+ return node.kind === 236 /* TryStatement */;
}
ts.isTryStatement = isTryStatement;
function isDebuggerStatement(node) {
- return node.kind === 236 /* DebuggerStatement */;
+ return node.kind === 237 /* DebuggerStatement */;
}
ts.isDebuggerStatement = isDebuggerStatement;
function isVariableDeclaration(node) {
- return node.kind === 237 /* VariableDeclaration */;
+ return node.kind === 238 /* VariableDeclaration */;
}
ts.isVariableDeclaration = isVariableDeclaration;
function isVariableDeclarationList(node) {
- return node.kind === 238 /* VariableDeclarationList */;
+ return node.kind === 239 /* VariableDeclarationList */;
}
ts.isVariableDeclarationList = isVariableDeclarationList;
function isFunctionDeclaration(node) {
- return node.kind === 239 /* FunctionDeclaration */;
+ return node.kind === 240 /* FunctionDeclaration */;
}
ts.isFunctionDeclaration = isFunctionDeclaration;
function isClassDeclaration(node) {
- return node.kind === 240 /* ClassDeclaration */;
+ return node.kind === 241 /* ClassDeclaration */;
}
ts.isClassDeclaration = isClassDeclaration;
function isInterfaceDeclaration(node) {
- return node.kind === 241 /* InterfaceDeclaration */;
+ return node.kind === 242 /* InterfaceDeclaration */;
}
ts.isInterfaceDeclaration = isInterfaceDeclaration;
function isTypeAliasDeclaration(node) {
- return node.kind === 242 /* TypeAliasDeclaration */;
+ return node.kind === 243 /* TypeAliasDeclaration */;
}
ts.isTypeAliasDeclaration = isTypeAliasDeclaration;
function isEnumDeclaration(node) {
- return node.kind === 243 /* EnumDeclaration */;
+ return node.kind === 244 /* EnumDeclaration */;
}
ts.isEnumDeclaration = isEnumDeclaration;
function isModuleDeclaration(node) {
- return node.kind === 244 /* ModuleDeclaration */;
+ return node.kind === 245 /* ModuleDeclaration */;
}
ts.isModuleDeclaration = isModuleDeclaration;
function isModuleBlock(node) {
- return node.kind === 245 /* ModuleBlock */;
+ return node.kind === 246 /* ModuleBlock */;
}
ts.isModuleBlock = isModuleBlock;
function isCaseBlock(node) {
- return node.kind === 246 /* CaseBlock */;
+ return node.kind === 247 /* CaseBlock */;
}
ts.isCaseBlock = isCaseBlock;
function isNamespaceExportDeclaration(node) {
- return node.kind === 247 /* NamespaceExportDeclaration */;
+ return node.kind === 248 /* NamespaceExportDeclaration */;
}
ts.isNamespaceExportDeclaration = isNamespaceExportDeclaration;
function isImportEqualsDeclaration(node) {
- return node.kind === 248 /* ImportEqualsDeclaration */;
+ return node.kind === 249 /* ImportEqualsDeclaration */;
}
ts.isImportEqualsDeclaration = isImportEqualsDeclaration;
function isImportDeclaration(node) {
- return node.kind === 249 /* ImportDeclaration */;
+ return node.kind === 250 /* ImportDeclaration */;
}
ts.isImportDeclaration = isImportDeclaration;
function isImportClause(node) {
- return node.kind === 250 /* ImportClause */;
+ return node.kind === 251 /* ImportClause */;
}
ts.isImportClause = isImportClause;
function isNamespaceImport(node) {
- return node.kind === 251 /* NamespaceImport */;
+ return node.kind === 252 /* NamespaceImport */;
}
ts.isNamespaceImport = isNamespaceImport;
function isNamedImports(node) {
- return node.kind === 252 /* NamedImports */;
+ return node.kind === 253 /* NamedImports */;
}
ts.isNamedImports = isNamedImports;
function isImportSpecifier(node) {
- return node.kind === 253 /* ImportSpecifier */;
+ return node.kind === 254 /* ImportSpecifier */;
}
ts.isImportSpecifier = isImportSpecifier;
function isExportAssignment(node) {
- return node.kind === 254 /* ExportAssignment */;
+ return node.kind === 255 /* ExportAssignment */;
}
ts.isExportAssignment = isExportAssignment;
function isExportDeclaration(node) {
- return node.kind === 255 /* ExportDeclaration */;
+ return node.kind === 256 /* ExportDeclaration */;
}
ts.isExportDeclaration = isExportDeclaration;
function isNamedExports(node) {
- return node.kind === 256 /* NamedExports */;
+ return node.kind === 257 /* NamedExports */;
}
ts.isNamedExports = isNamedExports;
function isExportSpecifier(node) {
- return node.kind === 257 /* ExportSpecifier */;
+ return node.kind === 258 /* ExportSpecifier */;
}
ts.isExportSpecifier = isExportSpecifier;
function isMissingDeclaration(node) {
- return node.kind === 258 /* MissingDeclaration */;
+ return node.kind === 259 /* MissingDeclaration */;
}
ts.isMissingDeclaration = isMissingDeclaration;
// Module References
function isExternalModuleReference(node) {
- return node.kind === 259 /* ExternalModuleReference */;
+ return node.kind === 260 /* ExternalModuleReference */;
}
ts.isExternalModuleReference = isExternalModuleReference;
// JSX
function isJsxElement(node) {
- return node.kind === 260 /* JsxElement */;
+ return node.kind === 261 /* JsxElement */;
}
ts.isJsxElement = isJsxElement;
function isJsxSelfClosingElement(node) {
- return node.kind === 261 /* JsxSelfClosingElement */;
+ return node.kind === 262 /* JsxSelfClosingElement */;
}
ts.isJsxSelfClosingElement = isJsxSelfClosingElement;
function isJsxOpeningElement(node) {
- return node.kind === 262 /* JsxOpeningElement */;
+ return node.kind === 263 /* JsxOpeningElement */;
}
ts.isJsxOpeningElement = isJsxOpeningElement;
function isJsxClosingElement(node) {
- return node.kind === 263 /* JsxClosingElement */;
+ return node.kind === 264 /* JsxClosingElement */;
}
ts.isJsxClosingElement = isJsxClosingElement;
function isJsxFragment(node) {
- return node.kind === 264 /* JsxFragment */;
+ return node.kind === 265 /* JsxFragment */;
}
ts.isJsxFragment = isJsxFragment;
function isJsxOpeningFragment(node) {
- return node.kind === 265 /* JsxOpeningFragment */;
+ return node.kind === 266 /* JsxOpeningFragment */;
}
ts.isJsxOpeningFragment = isJsxOpeningFragment;
function isJsxClosingFragment(node) {
- return node.kind === 266 /* JsxClosingFragment */;
+ return node.kind === 267 /* JsxClosingFragment */;
}
ts.isJsxClosingFragment = isJsxClosingFragment;
function isJsxAttribute(node) {
- return node.kind === 267 /* JsxAttribute */;
+ return node.kind === 268 /* JsxAttribute */;
}
ts.isJsxAttribute = isJsxAttribute;
function isJsxAttributes(node) {
- return node.kind === 268 /* JsxAttributes */;
+ return node.kind === 269 /* JsxAttributes */;
}
ts.isJsxAttributes = isJsxAttributes;
function isJsxSpreadAttribute(node) {
- return node.kind === 269 /* JsxSpreadAttribute */;
+ return node.kind === 270 /* JsxSpreadAttribute */;
}
ts.isJsxSpreadAttribute = isJsxSpreadAttribute;
function isJsxExpression(node) {
- return node.kind === 270 /* JsxExpression */;
+ return node.kind === 271 /* JsxExpression */;
}
ts.isJsxExpression = isJsxExpression;
// Clauses
function isCaseClause(node) {
- return node.kind === 271 /* CaseClause */;
+ return node.kind === 272 /* CaseClause */;
}
ts.isCaseClause = isCaseClause;
function isDefaultClause(node) {
- return node.kind === 272 /* DefaultClause */;
+ return node.kind === 273 /* DefaultClause */;
}
ts.isDefaultClause = isDefaultClause;
function isHeritageClause(node) {
- return node.kind === 273 /* HeritageClause */;
+ return node.kind === 274 /* HeritageClause */;
}
ts.isHeritageClause = isHeritageClause;
function isCatchClause(node) {
- return node.kind === 274 /* CatchClause */;
+ return node.kind === 275 /* CatchClause */;
}
ts.isCatchClause = isCatchClause;
// Property assignments
function isPropertyAssignment(node) {
- return node.kind === 275 /* PropertyAssignment */;
+ return node.kind === 276 /* PropertyAssignment */;
}
ts.isPropertyAssignment = isPropertyAssignment;
function isShorthandPropertyAssignment(node) {
- return node.kind === 276 /* ShorthandPropertyAssignment */;
+ return node.kind === 277 /* ShorthandPropertyAssignment */;
}
ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment;
function isSpreadAssignment(node) {
- return node.kind === 277 /* SpreadAssignment */;
+ return node.kind === 278 /* SpreadAssignment */;
}
ts.isSpreadAssignment = isSpreadAssignment;
// Enum
function isEnumMember(node) {
- return node.kind === 278 /* EnumMember */;
+ return node.kind === 279 /* EnumMember */;
}
ts.isEnumMember = isEnumMember;
// Top-level nodes
function isSourceFile(node) {
- return node.kind === 284 /* SourceFile */;
+ return node.kind === 285 /* SourceFile */;
}
ts.isSourceFile = isSourceFile;
function isBundle(node) {
- return node.kind === 285 /* Bundle */;
+ return node.kind === 286 /* Bundle */;
}
ts.isBundle = isBundle;
function isUnparsedSource(node) {
- return node.kind === 286 /* UnparsedSource */;
+ return node.kind === 287 /* UnparsedSource */;
}
ts.isUnparsedSource = isUnparsedSource;
function isUnparsedPrepend(node) {
- return node.kind === 280 /* UnparsedPrepend */;
+ return node.kind === 281 /* UnparsedPrepend */;
}
ts.isUnparsedPrepend = isUnparsedPrepend;
function isUnparsedTextLike(node) {
switch (node.kind) {
- case 281 /* UnparsedText */:
- case 282 /* UnparsedInternalText */:
+ case 282 /* UnparsedText */:
+ case 283 /* UnparsedInternalText */:
return true;
default:
return false;
@@ -14040,101 +14168,101 @@
ts.isUnparsedTextLike = isUnparsedTextLike;
function isUnparsedNode(node) {
return isUnparsedTextLike(node) ||
- node.kind === 279 /* UnparsedPrologue */ ||
- node.kind === 283 /* UnparsedSyntheticReference */;
+ node.kind === 280 /* UnparsedPrologue */ ||
+ node.kind === 284 /* UnparsedSyntheticReference */;
}
ts.isUnparsedNode = isUnparsedNode;
// JSDoc
function isJSDocTypeExpression(node) {
- return node.kind === 288 /* JSDocTypeExpression */;
+ return node.kind === 289 /* JSDocTypeExpression */;
}
ts.isJSDocTypeExpression = isJSDocTypeExpression;
function isJSDocAllType(node) {
- return node.kind === 289 /* JSDocAllType */;
+ return node.kind === 290 /* JSDocAllType */;
}
ts.isJSDocAllType = isJSDocAllType;
function isJSDocUnknownType(node) {
- return node.kind === 290 /* JSDocUnknownType */;
+ return node.kind === 291 /* JSDocUnknownType */;
}
ts.isJSDocUnknownType = isJSDocUnknownType;
function isJSDocNullableType(node) {
- return node.kind === 291 /* JSDocNullableType */;
+ return node.kind === 292 /* JSDocNullableType */;
}
ts.isJSDocNullableType = isJSDocNullableType;
function isJSDocNonNullableType(node) {
- return node.kind === 292 /* JSDocNonNullableType */;
+ return node.kind === 293 /* JSDocNonNullableType */;
}
ts.isJSDocNonNullableType = isJSDocNonNullableType;
function isJSDocOptionalType(node) {
- return node.kind === 293 /* JSDocOptionalType */;
+ return node.kind === 294 /* JSDocOptionalType */;
}
ts.isJSDocOptionalType = isJSDocOptionalType;
function isJSDocFunctionType(node) {
- return node.kind === 294 /* JSDocFunctionType */;
+ return node.kind === 295 /* JSDocFunctionType */;
}
ts.isJSDocFunctionType = isJSDocFunctionType;
function isJSDocVariadicType(node) {
- return node.kind === 295 /* JSDocVariadicType */;
+ return node.kind === 296 /* JSDocVariadicType */;
}
ts.isJSDocVariadicType = isJSDocVariadicType;
function isJSDoc(node) {
- return node.kind === 296 /* JSDocComment */;
+ return node.kind === 297 /* JSDocComment */;
}
ts.isJSDoc = isJSDoc;
function isJSDocAugmentsTag(node) {
- return node.kind === 300 /* JSDocAugmentsTag */;
+ return node.kind === 301 /* JSDocAugmentsTag */;
}
ts.isJSDocAugmentsTag = isJSDocAugmentsTag;
function isJSDocClassTag(node) {
- return node.kind === 301 /* JSDocClassTag */;
+ return node.kind === 302 /* JSDocClassTag */;
}
ts.isJSDocClassTag = isJSDocClassTag;
function isJSDocEnumTag(node) {
- return node.kind === 303 /* JSDocEnumTag */;
+ return node.kind === 304 /* JSDocEnumTag */;
}
ts.isJSDocEnumTag = isJSDocEnumTag;
function isJSDocThisTag(node) {
- return node.kind === 306 /* JSDocThisTag */;
+ return node.kind === 307 /* JSDocThisTag */;
}
ts.isJSDocThisTag = isJSDocThisTag;
function isJSDocParameterTag(node) {
- return node.kind === 304 /* JSDocParameterTag */;
+ return node.kind === 305 /* JSDocParameterTag */;
}
ts.isJSDocParameterTag = isJSDocParameterTag;
function isJSDocReturnTag(node) {
- return node.kind === 305 /* JSDocReturnTag */;
+ return node.kind === 306 /* JSDocReturnTag */;
}
ts.isJSDocReturnTag = isJSDocReturnTag;
function isJSDocTypeTag(node) {
- return node.kind === 307 /* JSDocTypeTag */;
+ return node.kind === 308 /* JSDocTypeTag */;
}
ts.isJSDocTypeTag = isJSDocTypeTag;
function isJSDocTemplateTag(node) {
- return node.kind === 308 /* JSDocTemplateTag */;
+ return node.kind === 309 /* JSDocTemplateTag */;
}
ts.isJSDocTemplateTag = isJSDocTemplateTag;
function isJSDocTypedefTag(node) {
- return node.kind === 309 /* JSDocTypedefTag */;
+ return node.kind === 310 /* JSDocTypedefTag */;
}
ts.isJSDocTypedefTag = isJSDocTypedefTag;
function isJSDocPropertyTag(node) {
- return node.kind === 310 /* JSDocPropertyTag */;
+ return node.kind === 311 /* JSDocPropertyTag */;
}
ts.isJSDocPropertyTag = isJSDocPropertyTag;
function isJSDocPropertyLikeTag(node) {
- return node.kind === 310 /* JSDocPropertyTag */ || node.kind === 304 /* JSDocParameterTag */;
+ return node.kind === 311 /* JSDocPropertyTag */ || node.kind === 305 /* JSDocParameterTag */;
}
ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag;
function isJSDocTypeLiteral(node) {
- return node.kind === 297 /* JSDocTypeLiteral */;
+ return node.kind === 298 /* JSDocTypeLiteral */;
}
ts.isJSDocTypeLiteral = isJSDocTypeLiteral;
function isJSDocCallbackTag(node) {
- return node.kind === 302 /* JSDocCallbackTag */;
+ return node.kind === 303 /* JSDocCallbackTag */;
}
ts.isJSDocCallbackTag = isJSDocCallbackTag;
function isJSDocSignature(node) {
- return node.kind === 298 /* JSDocSignature */;
+ return node.kind === 299 /* JSDocSignature */;
}
ts.isJSDocSignature = isJSDocSignature;
})(ts || (ts = {}));
@@ -14145,7 +14273,7 @@
(function (ts) {
/* @internal */
function isSyntaxList(n) {
- return n.kind === 311 /* SyntaxList */;
+ return n.kind === 312 /* SyntaxList */;
}
ts.isSyntaxList = isSyntaxList;
/* @internal */
@@ -14155,7 +14283,7 @@
ts.isNode = isNode;
/* @internal */
function isNodeKind(kind) {
- return kind >= 148 /* FirstNode */;
+ return kind >= 149 /* FirstNode */;
}
ts.isNodeKind = isNodeKind;
/**
@@ -14164,7 +14292,7 @@
* Literals are considered tokens, except TemplateLiteral, but does include TemplateHead/Middle/Tail.
*/
function isToken(n) {
- return n.kind >= 0 /* FirstToken */ && n.kind <= 147 /* LastToken */;
+ return n.kind >= 0 /* FirstToken */ && n.kind <= 148 /* LastToken */;
}
ts.isToken = isToken;
// Node Arrays
@@ -14217,17 +14345,17 @@
/* @internal */
function isModifierKind(token) {
switch (token) {
- case 118 /* AbstractKeyword */:
- case 121 /* AsyncKeyword */:
- case 77 /* ConstKeyword */:
- case 125 /* DeclareKeyword */:
- case 80 /* DefaultKeyword */:
- case 85 /* ExportKeyword */:
- case 115 /* PublicKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 133 /* ReadonlyKeyword */:
- case 116 /* StaticKeyword */:
+ case 119 /* AbstractKeyword */:
+ case 122 /* AsyncKeyword */:
+ case 78 /* ConstKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 81 /* DefaultKeyword */:
+ case 86 /* ExportKeyword */:
+ case 116 /* PublicKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 134 /* ReadonlyKeyword */:
+ case 117 /* StaticKeyword */:
return true;
}
return false;
@@ -14240,7 +14368,7 @@
ts.isParameterPropertyModifier = isParameterPropertyModifier;
/* @internal */
function isClassMemberModifier(idToken) {
- return isParameterPropertyModifier(idToken) || idToken === 116 /* StaticKeyword */;
+ return isParameterPropertyModifier(idToken) || idToken === 117 /* StaticKeyword */;
}
ts.isClassMemberModifier = isClassMemberModifier;
function isModifier(node) {
@@ -14249,23 +14377,23 @@
ts.isModifier = isModifier;
function isEntityName(node) {
var kind = node.kind;
- return kind === 148 /* QualifiedName */
- || kind === 72 /* Identifier */;
+ return kind === 149 /* QualifiedName */
+ || kind === 73 /* Identifier */;
}
ts.isEntityName = isEntityName;
function isPropertyName(node) {
var kind = node.kind;
- return kind === 72 /* Identifier */
+ return kind === 73 /* Identifier */
|| kind === 10 /* StringLiteral */
|| kind === 8 /* NumericLiteral */
- || kind === 149 /* ComputedPropertyName */;
+ || kind === 150 /* ComputedPropertyName */;
}
ts.isPropertyName = isPropertyName;
function isBindingName(node) {
var kind = node.kind;
- return kind === 72 /* Identifier */
- || kind === 184 /* ObjectBindingPattern */
- || kind === 185 /* ArrayBindingPattern */;
+ return kind === 73 /* Identifier */
+ || kind === 185 /* ObjectBindingPattern */
+ || kind === 186 /* ArrayBindingPattern */;
}
ts.isBindingName = isBindingName;
// Functions
@@ -14280,13 +14408,13 @@
ts.isFunctionLikeDeclaration = isFunctionLikeDeclaration;
function isFunctionLikeDeclarationKind(kind) {
switch (kind) {
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return true;
default:
return false;
@@ -14295,14 +14423,14 @@
/* @internal */
function isFunctionLikeKind(kind) {
switch (kind) {
- case 155 /* MethodSignature */:
- case 160 /* CallSignature */:
- case 298 /* JSDocSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
- case 165 /* FunctionType */:
- case 294 /* JSDocFunctionType */:
- case 166 /* ConstructorType */:
+ case 156 /* MethodSignature */:
+ case 161 /* CallSignature */:
+ case 299 /* JSDocSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
+ case 166 /* FunctionType */:
+ case 295 /* JSDocFunctionType */:
+ case 167 /* ConstructorType */:
return true;
default:
return isFunctionLikeDeclarationKind(kind);
@@ -14317,29 +14445,29 @@
// Classes
function isClassElement(node) {
var kind = node.kind;
- return kind === 157 /* Constructor */
- || kind === 154 /* PropertyDeclaration */
- || kind === 156 /* MethodDeclaration */
- || kind === 158 /* GetAccessor */
- || kind === 159 /* SetAccessor */
- || kind === 162 /* IndexSignature */
- || kind === 217 /* SemicolonClassElement */;
+ return kind === 158 /* Constructor */
+ || kind === 155 /* PropertyDeclaration */
+ || kind === 157 /* MethodDeclaration */
+ || kind === 159 /* GetAccessor */
+ || kind === 160 /* SetAccessor */
+ || kind === 163 /* IndexSignature */
+ || kind === 218 /* SemicolonClassElement */;
}
ts.isClassElement = isClassElement;
function isClassLike(node) {
- return node && (node.kind === 240 /* ClassDeclaration */ || node.kind === 209 /* ClassExpression */);
+ return node && (node.kind === 241 /* ClassDeclaration */ || node.kind === 210 /* ClassExpression */);
}
ts.isClassLike = isClassLike;
function isAccessor(node) {
- return node && (node.kind === 158 /* GetAccessor */ || node.kind === 159 /* SetAccessor */);
+ return node && (node.kind === 159 /* GetAccessor */ || node.kind === 160 /* SetAccessor */);
}
ts.isAccessor = isAccessor;
/* @internal */
function isMethodOrAccessor(node) {
switch (node.kind) {
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return true;
default:
return false;
@@ -14349,11 +14477,11 @@
// Type members
function isTypeElement(node) {
var kind = node.kind;
- return kind === 161 /* ConstructSignature */
- || kind === 160 /* CallSignature */
- || kind === 153 /* PropertySignature */
- || kind === 155 /* MethodSignature */
- || kind === 162 /* IndexSignature */;
+ return kind === 162 /* ConstructSignature */
+ || kind === 161 /* CallSignature */
+ || kind === 154 /* PropertySignature */
+ || kind === 156 /* MethodSignature */
+ || kind === 163 /* IndexSignature */;
}
ts.isTypeElement = isTypeElement;
function isClassOrTypeElement(node) {
@@ -14362,12 +14490,12 @@
ts.isClassOrTypeElement = isClassOrTypeElement;
function isObjectLiteralElementLike(node) {
var kind = node.kind;
- return kind === 275 /* PropertyAssignment */
- || kind === 276 /* ShorthandPropertyAssignment */
- || kind === 277 /* SpreadAssignment */
- || kind === 156 /* MethodDeclaration */
- || kind === 158 /* GetAccessor */
- || kind === 159 /* SetAccessor */;
+ return kind === 276 /* PropertyAssignment */
+ || kind === 277 /* ShorthandPropertyAssignment */
+ || kind === 278 /* SpreadAssignment */
+ || kind === 157 /* MethodDeclaration */
+ || kind === 159 /* GetAccessor */
+ || kind === 160 /* SetAccessor */;
}
ts.isObjectLiteralElementLike = isObjectLiteralElementLike;
// Type
@@ -14382,8 +14510,8 @@
ts.isTypeNode = isTypeNode;
function isFunctionOrConstructorTypeNode(node) {
switch (node.kind) {
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
return true;
}
return false;
@@ -14394,8 +14522,8 @@
function isBindingPattern(node) {
if (node) {
var kind = node.kind;
- return kind === 185 /* ArrayBindingPattern */
- || kind === 184 /* ObjectBindingPattern */;
+ return kind === 186 /* ArrayBindingPattern */
+ || kind === 185 /* ObjectBindingPattern */;
}
return false;
}
@@ -14403,15 +14531,15 @@
/* @internal */
function isAssignmentPattern(node) {
var kind = node.kind;
- return kind === 187 /* ArrayLiteralExpression */
- || kind === 188 /* ObjectLiteralExpression */;
+ return kind === 188 /* ArrayLiteralExpression */
+ || kind === 189 /* ObjectLiteralExpression */;
}
ts.isAssignmentPattern = isAssignmentPattern;
/* @internal */
function isArrayBindingElement(node) {
var kind = node.kind;
- return kind === 186 /* BindingElement */
- || kind === 210 /* OmittedExpression */;
+ return kind === 187 /* BindingElement */
+ || kind === 211 /* OmittedExpression */;
}
ts.isArrayBindingElement = isArrayBindingElement;
/**
@@ -14420,9 +14548,9 @@
/* @internal */
function isDeclarationBindingElement(bindingElement) {
switch (bindingElement.kind) {
- case 237 /* VariableDeclaration */:
- case 151 /* Parameter */:
- case 186 /* BindingElement */:
+ case 238 /* VariableDeclaration */:
+ case 152 /* Parameter */:
+ case 187 /* BindingElement */:
return true;
}
return false;
@@ -14443,8 +14571,8 @@
/* @internal */
function isObjectBindingOrAssignmentPattern(node) {
switch (node.kind) {
- case 184 /* ObjectBindingPattern */:
- case 188 /* ObjectLiteralExpression */:
+ case 185 /* ObjectBindingPattern */:
+ case 189 /* ObjectLiteralExpression */:
return true;
}
return false;
@@ -14456,8 +14584,8 @@
/* @internal */
function isArrayBindingOrAssignmentPattern(node) {
switch (node.kind) {
- case 185 /* ArrayBindingPattern */:
- case 187 /* ArrayLiteralExpression */:
+ case 186 /* ArrayBindingPattern */:
+ case 188 /* ArrayLiteralExpression */:
return true;
}
return false;
@@ -14466,26 +14594,26 @@
/* @internal */
function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) {
var kind = node.kind;
- return kind === 189 /* PropertyAccessExpression */
- || kind === 148 /* QualifiedName */
- || kind === 183 /* ImportType */;
+ return kind === 190 /* PropertyAccessExpression */
+ || kind === 149 /* QualifiedName */
+ || kind === 184 /* ImportType */;
}
ts.isPropertyAccessOrQualifiedNameOrImportTypeNode = isPropertyAccessOrQualifiedNameOrImportTypeNode;
// Expression
function isPropertyAccessOrQualifiedName(node) {
var kind = node.kind;
- return kind === 189 /* PropertyAccessExpression */
- || kind === 148 /* QualifiedName */;
+ return kind === 190 /* PropertyAccessExpression */
+ || kind === 149 /* QualifiedName */;
}
ts.isPropertyAccessOrQualifiedName = isPropertyAccessOrQualifiedName;
function isCallLikeExpression(node) {
switch (node.kind) {
- case 262 /* JsxOpeningElement */:
- case 261 /* JsxSelfClosingElement */:
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
- case 193 /* TaggedTemplateExpression */:
- case 152 /* Decorator */:
+ case 263 /* JsxOpeningElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
+ case 194 /* TaggedTemplateExpression */:
+ case 153 /* Decorator */:
return true;
default:
return false;
@@ -14493,12 +14621,12 @@
}
ts.isCallLikeExpression = isCallLikeExpression;
function isCallOrNewExpression(node) {
- return node.kind === 191 /* CallExpression */ || node.kind === 192 /* NewExpression */;
+ return node.kind === 192 /* CallExpression */ || node.kind === 193 /* NewExpression */;
}
ts.isCallOrNewExpression = isCallOrNewExpression;
function isTemplateLiteral(node) {
var kind = node.kind;
- return kind === 206 /* TemplateExpression */
+ return kind === 207 /* TemplateExpression */
|| kind === 14 /* NoSubstitutionTemplateLiteral */;
}
ts.isTemplateLiteral = isTemplateLiteral;
@@ -14509,34 +14637,34 @@
ts.isLeftHandSideExpression = isLeftHandSideExpression;
function isLeftHandSideExpressionKind(kind) {
switch (kind) {
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
- case 192 /* NewExpression */:
- case 191 /* CallExpression */:
- case 260 /* JsxElement */:
- case 261 /* JsxSelfClosingElement */:
- case 264 /* JsxFragment */:
- case 193 /* TaggedTemplateExpression */:
- case 187 /* ArrayLiteralExpression */:
- case 195 /* ParenthesizedExpression */:
- case 188 /* ObjectLiteralExpression */:
- case 209 /* ClassExpression */:
- case 196 /* FunctionExpression */:
- case 72 /* Identifier */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
+ case 193 /* NewExpression */:
+ case 192 /* CallExpression */:
+ case 261 /* JsxElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 265 /* JsxFragment */:
+ case 194 /* TaggedTemplateExpression */:
+ case 188 /* ArrayLiteralExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 189 /* ObjectLiteralExpression */:
+ case 210 /* ClassExpression */:
+ case 197 /* FunctionExpression */:
+ case 73 /* Identifier */:
case 13 /* RegularExpressionLiteral */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
case 10 /* StringLiteral */:
case 14 /* NoSubstitutionTemplateLiteral */:
- case 206 /* TemplateExpression */:
- case 87 /* FalseKeyword */:
- case 96 /* NullKeyword */:
- case 100 /* ThisKeyword */:
- case 102 /* TrueKeyword */:
- case 98 /* SuperKeyword */:
- case 213 /* NonNullExpression */:
- case 214 /* MetaProperty */:
- case 92 /* ImportKeyword */: // technically this is only an Expression if it's in a CallExpression
+ case 207 /* TemplateExpression */:
+ case 88 /* FalseKeyword */:
+ case 97 /* NullKeyword */:
+ case 101 /* ThisKeyword */:
+ case 103 /* TrueKeyword */:
+ case 99 /* SuperKeyword */:
+ case 214 /* NonNullExpression */:
+ case 215 /* MetaProperty */:
+ case 93 /* ImportKeyword */: // technically this is only an Expression if it's in a CallExpression
return true;
default:
return false;
@@ -14549,13 +14677,13 @@
ts.isUnaryExpression = isUnaryExpression;
function isUnaryExpressionKind(kind) {
switch (kind) {
- case 202 /* PrefixUnaryExpression */:
- case 203 /* PostfixUnaryExpression */:
- case 198 /* DeleteExpression */:
- case 199 /* TypeOfExpression */:
- case 200 /* VoidExpression */:
- case 201 /* AwaitExpression */:
- case 194 /* TypeAssertionExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
+ case 199 /* DeleteExpression */:
+ case 200 /* TypeOfExpression */:
+ case 201 /* VoidExpression */:
+ case 202 /* AwaitExpression */:
+ case 195 /* TypeAssertionExpression */:
return true;
default:
return isLeftHandSideExpressionKind(kind);
@@ -14564,9 +14692,9 @@
/* @internal */
function isUnaryExpressionWithWrite(expr) {
switch (expr.kind) {
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return true;
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return expr.operator === 44 /* PlusPlusToken */ ||
expr.operator === 45 /* MinusMinusToken */;
default:
@@ -14585,15 +14713,15 @@
ts.isExpression = isExpression;
function isExpressionKind(kind) {
switch (kind) {
- case 205 /* ConditionalExpression */:
- case 207 /* YieldExpression */:
- case 197 /* ArrowFunction */:
- case 204 /* BinaryExpression */:
- case 208 /* SpreadElement */:
- case 212 /* AsExpression */:
- case 210 /* OmittedExpression */:
- case 314 /* CommaListExpression */:
- case 313 /* PartiallyEmittedExpression */:
+ case 206 /* ConditionalExpression */:
+ case 208 /* YieldExpression */:
+ case 198 /* ArrowFunction */:
+ case 205 /* BinaryExpression */:
+ case 209 /* SpreadElement */:
+ case 213 /* AsExpression */:
+ case 211 /* OmittedExpression */:
+ case 315 /* CommaListExpression */:
+ case 314 /* PartiallyEmittedExpression */:
return true;
default:
return isUnaryExpressionKind(kind);
@@ -14601,18 +14729,18 @@
}
function isAssertionExpression(node) {
var kind = node.kind;
- return kind === 194 /* TypeAssertionExpression */
- || kind === 212 /* AsExpression */;
+ return kind === 195 /* TypeAssertionExpression */
+ || kind === 213 /* AsExpression */;
}
ts.isAssertionExpression = isAssertionExpression;
/* @internal */
function isPartiallyEmittedExpression(node) {
- return node.kind === 313 /* PartiallyEmittedExpression */;
+ return node.kind === 314 /* PartiallyEmittedExpression */;
}
ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression;
/* @internal */
function isNotEmittedStatement(node) {
- return node.kind === 312 /* NotEmittedStatement */;
+ return node.kind === 313 /* NotEmittedStatement */;
}
ts.isNotEmittedStatement = isNotEmittedStatement;
/* @internal */
@@ -14623,13 +14751,13 @@
ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode;
function isIterationStatement(node, lookInLabeledStatements) {
switch (node.kind) {
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
return true;
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements);
}
return false;
@@ -14637,7 +14765,7 @@
ts.isIterationStatement = isIterationStatement;
/* @internal */
function isForInOrOfStatement(node) {
- return node.kind === 226 /* ForInStatement */ || node.kind === 227 /* ForOfStatement */;
+ return node.kind === 227 /* ForInStatement */ || node.kind === 228 /* ForOfStatement */;
}
ts.isForInOrOfStatement = isForInOrOfStatement;
// Element
@@ -14661,113 +14789,113 @@
/* @internal */
function isModuleBody(node) {
var kind = node.kind;
- return kind === 245 /* ModuleBlock */
- || kind === 244 /* ModuleDeclaration */
- || kind === 72 /* Identifier */;
+ return kind === 246 /* ModuleBlock */
+ || kind === 245 /* ModuleDeclaration */
+ || kind === 73 /* Identifier */;
}
ts.isModuleBody = isModuleBody;
/* @internal */
function isNamespaceBody(node) {
var kind = node.kind;
- return kind === 245 /* ModuleBlock */
- || kind === 244 /* ModuleDeclaration */;
+ return kind === 246 /* ModuleBlock */
+ || kind === 245 /* ModuleDeclaration */;
}
ts.isNamespaceBody = isNamespaceBody;
/* @internal */
function isJSDocNamespaceBody(node) {
var kind = node.kind;
- return kind === 72 /* Identifier */
- || kind === 244 /* ModuleDeclaration */;
+ return kind === 73 /* Identifier */
+ || kind === 245 /* ModuleDeclaration */;
}
ts.isJSDocNamespaceBody = isJSDocNamespaceBody;
/* @internal */
function isNamedImportBindings(node) {
var kind = node.kind;
- return kind === 252 /* NamedImports */
- || kind === 251 /* NamespaceImport */;
+ return kind === 253 /* NamedImports */
+ || kind === 252 /* NamespaceImport */;
}
ts.isNamedImportBindings = isNamedImportBindings;
/* @internal */
function isModuleOrEnumDeclaration(node) {
- return node.kind === 244 /* ModuleDeclaration */ || node.kind === 243 /* EnumDeclaration */;
+ return node.kind === 245 /* ModuleDeclaration */ || node.kind === 244 /* EnumDeclaration */;
}
ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration;
function isDeclarationKind(kind) {
- return kind === 197 /* ArrowFunction */
- || kind === 186 /* BindingElement */
- || kind === 240 /* ClassDeclaration */
- || kind === 209 /* ClassExpression */
- || kind === 157 /* Constructor */
- || kind === 243 /* EnumDeclaration */
- || kind === 278 /* EnumMember */
- || kind === 257 /* ExportSpecifier */
- || kind === 239 /* FunctionDeclaration */
- || kind === 196 /* FunctionExpression */
- || kind === 158 /* GetAccessor */
- || kind === 250 /* ImportClause */
- || kind === 248 /* ImportEqualsDeclaration */
- || kind === 253 /* ImportSpecifier */
- || kind === 241 /* InterfaceDeclaration */
- || kind === 267 /* JsxAttribute */
- || kind === 156 /* MethodDeclaration */
- || kind === 155 /* MethodSignature */
- || kind === 244 /* ModuleDeclaration */
- || kind === 247 /* NamespaceExportDeclaration */
- || kind === 251 /* NamespaceImport */
- || kind === 151 /* Parameter */
- || kind === 275 /* PropertyAssignment */
- || kind === 154 /* PropertyDeclaration */
- || kind === 153 /* PropertySignature */
- || kind === 159 /* SetAccessor */
- || kind === 276 /* ShorthandPropertyAssignment */
- || kind === 242 /* TypeAliasDeclaration */
- || kind === 150 /* TypeParameter */
- || kind === 237 /* VariableDeclaration */
- || kind === 309 /* JSDocTypedefTag */
- || kind === 302 /* JSDocCallbackTag */
- || kind === 310 /* JSDocPropertyTag */;
+ return kind === 198 /* ArrowFunction */
+ || kind === 187 /* BindingElement */
+ || kind === 241 /* ClassDeclaration */
+ || kind === 210 /* ClassExpression */
+ || kind === 158 /* Constructor */
+ || kind === 244 /* EnumDeclaration */
+ || kind === 279 /* EnumMember */
+ || kind === 258 /* ExportSpecifier */
+ || kind === 240 /* FunctionDeclaration */
+ || kind === 197 /* FunctionExpression */
+ || kind === 159 /* GetAccessor */
+ || kind === 251 /* ImportClause */
+ || kind === 249 /* ImportEqualsDeclaration */
+ || kind === 254 /* ImportSpecifier */
+ || kind === 242 /* InterfaceDeclaration */
+ || kind === 268 /* JsxAttribute */
+ || kind === 157 /* MethodDeclaration */
+ || kind === 156 /* MethodSignature */
+ || kind === 245 /* ModuleDeclaration */
+ || kind === 248 /* NamespaceExportDeclaration */
+ || kind === 252 /* NamespaceImport */
+ || kind === 152 /* Parameter */
+ || kind === 276 /* PropertyAssignment */
+ || kind === 155 /* PropertyDeclaration */
+ || kind === 154 /* PropertySignature */
+ || kind === 160 /* SetAccessor */
+ || kind === 277 /* ShorthandPropertyAssignment */
+ || kind === 243 /* TypeAliasDeclaration */
+ || kind === 151 /* TypeParameter */
+ || kind === 238 /* VariableDeclaration */
+ || kind === 310 /* JSDocTypedefTag */
+ || kind === 303 /* JSDocCallbackTag */
+ || kind === 311 /* JSDocPropertyTag */;
}
function isDeclarationStatementKind(kind) {
- return kind === 239 /* FunctionDeclaration */
- || kind === 258 /* MissingDeclaration */
- || kind === 240 /* ClassDeclaration */
- || kind === 241 /* InterfaceDeclaration */
- || kind === 242 /* TypeAliasDeclaration */
- || kind === 243 /* EnumDeclaration */
- || kind === 244 /* ModuleDeclaration */
- || kind === 249 /* ImportDeclaration */
- || kind === 248 /* ImportEqualsDeclaration */
- || kind === 255 /* ExportDeclaration */
- || kind === 254 /* ExportAssignment */
- || kind === 247 /* NamespaceExportDeclaration */;
+ return kind === 240 /* FunctionDeclaration */
+ || kind === 259 /* MissingDeclaration */
+ || kind === 241 /* ClassDeclaration */
+ || kind === 242 /* InterfaceDeclaration */
+ || kind === 243 /* TypeAliasDeclaration */
+ || kind === 244 /* EnumDeclaration */
+ || kind === 245 /* ModuleDeclaration */
+ || kind === 250 /* ImportDeclaration */
+ || kind === 249 /* ImportEqualsDeclaration */
+ || kind === 256 /* ExportDeclaration */
+ || kind === 255 /* ExportAssignment */
+ || kind === 248 /* NamespaceExportDeclaration */;
}
function isStatementKindButNotDeclarationKind(kind) {
- return kind === 229 /* BreakStatement */
- || kind === 228 /* ContinueStatement */
- || kind === 236 /* DebuggerStatement */
- || kind === 223 /* DoStatement */
- || kind === 221 /* ExpressionStatement */
- || kind === 220 /* EmptyStatement */
- || kind === 226 /* ForInStatement */
- || kind === 227 /* ForOfStatement */
- || kind === 225 /* ForStatement */
- || kind === 222 /* IfStatement */
- || kind === 233 /* LabeledStatement */
- || kind === 230 /* ReturnStatement */
- || kind === 232 /* SwitchStatement */
- || kind === 234 /* ThrowStatement */
- || kind === 235 /* TryStatement */
- || kind === 219 /* VariableStatement */
- || kind === 224 /* WhileStatement */
- || kind === 231 /* WithStatement */
- || kind === 312 /* NotEmittedStatement */
- || kind === 316 /* EndOfDeclarationMarker */
- || kind === 315 /* MergeDeclarationMarker */;
+ return kind === 230 /* BreakStatement */
+ || kind === 229 /* ContinueStatement */
+ || kind === 237 /* DebuggerStatement */
+ || kind === 224 /* DoStatement */
+ || kind === 222 /* ExpressionStatement */
+ || kind === 221 /* EmptyStatement */
+ || kind === 227 /* ForInStatement */
+ || kind === 228 /* ForOfStatement */
+ || kind === 226 /* ForStatement */
+ || kind === 223 /* IfStatement */
+ || kind === 234 /* LabeledStatement */
+ || kind === 231 /* ReturnStatement */
+ || kind === 233 /* SwitchStatement */
+ || kind === 235 /* ThrowStatement */
+ || kind === 236 /* TryStatement */
+ || kind === 220 /* VariableStatement */
+ || kind === 225 /* WhileStatement */
+ || kind === 232 /* WithStatement */
+ || kind === 313 /* NotEmittedStatement */
+ || kind === 317 /* EndOfDeclarationMarker */
+ || kind === 316 /* MergeDeclarationMarker */;
}
/* @internal */
function isDeclaration(node) {
- if (node.kind === 150 /* TypeParameter */) {
- return (node.parent && node.parent.kind !== 308 /* JSDocTemplateTag */) || ts.isInJSFile(node);
+ if (node.kind === 151 /* TypeParameter */) {
+ return (node.parent && node.parent.kind !== 309 /* JSDocTemplateTag */) || ts.isInJSFile(node);
}
return isDeclarationKind(node.kind);
}
@@ -14794,10 +14922,10 @@
}
ts.isStatement = isStatement;
function isBlockStatement(node) {
- if (node.kind !== 218 /* Block */)
+ if (node.kind !== 219 /* Block */)
return false;
if (node.parent !== undefined) {
- if (node.parent.kind === 235 /* TryStatement */ || node.parent.kind === 274 /* CatchClause */) {
+ if (node.parent.kind === 236 /* TryStatement */ || node.parent.kind === 275 /* CatchClause */) {
return false;
}
}
@@ -14807,81 +14935,81 @@
/* @internal */
function isModuleReference(node) {
var kind = node.kind;
- return kind === 259 /* ExternalModuleReference */
- || kind === 148 /* QualifiedName */
- || kind === 72 /* Identifier */;
+ return kind === 260 /* ExternalModuleReference */
+ || kind === 149 /* QualifiedName */
+ || kind === 73 /* Identifier */;
}
ts.isModuleReference = isModuleReference;
// JSX
/* @internal */
function isJsxTagNameExpression(node) {
var kind = node.kind;
- return kind === 100 /* ThisKeyword */
- || kind === 72 /* Identifier */
- || kind === 189 /* PropertyAccessExpression */;
+ return kind === 101 /* ThisKeyword */
+ || kind === 73 /* Identifier */
+ || kind === 190 /* PropertyAccessExpression */;
}
ts.isJsxTagNameExpression = isJsxTagNameExpression;
/* @internal */
function isJsxChild(node) {
var kind = node.kind;
- return kind === 260 /* JsxElement */
- || kind === 270 /* JsxExpression */
- || kind === 261 /* JsxSelfClosingElement */
+ return kind === 261 /* JsxElement */
+ || kind === 271 /* JsxExpression */
+ || kind === 262 /* JsxSelfClosingElement */
|| kind === 11 /* JsxText */
- || kind === 264 /* JsxFragment */;
+ || kind === 265 /* JsxFragment */;
}
ts.isJsxChild = isJsxChild;
/* @internal */
function isJsxAttributeLike(node) {
var kind = node.kind;
- return kind === 267 /* JsxAttribute */
- || kind === 269 /* JsxSpreadAttribute */;
+ return kind === 268 /* JsxAttribute */
+ || kind === 270 /* JsxSpreadAttribute */;
}
ts.isJsxAttributeLike = isJsxAttributeLike;
/* @internal */
function isStringLiteralOrJsxExpression(node) {
var kind = node.kind;
return kind === 10 /* StringLiteral */
- || kind === 270 /* JsxExpression */;
+ || kind === 271 /* JsxExpression */;
}
ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression;
function isJsxOpeningLikeElement(node) {
var kind = node.kind;
- return kind === 262 /* JsxOpeningElement */
- || kind === 261 /* JsxSelfClosingElement */;
+ return kind === 263 /* JsxOpeningElement */
+ || kind === 262 /* JsxSelfClosingElement */;
}
ts.isJsxOpeningLikeElement = isJsxOpeningLikeElement;
// Clauses
function isCaseOrDefaultClause(node) {
var kind = node.kind;
- return kind === 271 /* CaseClause */
- || kind === 272 /* DefaultClause */;
+ return kind === 272 /* CaseClause */
+ || kind === 273 /* DefaultClause */;
}
ts.isCaseOrDefaultClause = isCaseOrDefaultClause;
// JSDoc
/** True if node is of some JSDoc syntax kind. */
/* @internal */
function isJSDocNode(node) {
- return node.kind >= 288 /* FirstJSDocNode */ && node.kind <= 310 /* LastJSDocNode */;
+ return node.kind >= 289 /* FirstJSDocNode */ && node.kind <= 311 /* LastJSDocNode */;
}
ts.isJSDocNode = isJSDocNode;
/** True if node is of a kind that may contain comment text. */
function isJSDocCommentContainingNode(node) {
- return node.kind === 296 /* JSDocComment */ || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) || ts.isJSDocSignature(node);
+ return node.kind === 297 /* JSDocComment */ || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) || ts.isJSDocSignature(node);
}
ts.isJSDocCommentContainingNode = isJSDocCommentContainingNode;
// TODO: determine what this does before making it public.
/* @internal */
function isJSDocTag(node) {
- return node.kind >= 299 /* FirstJSDocTagNode */ && node.kind <= 310 /* LastJSDocTagNode */;
+ return node.kind >= 300 /* FirstJSDocTagNode */ && node.kind <= 311 /* LastJSDocTagNode */;
}
ts.isJSDocTag = isJSDocTag;
function isSetAccessor(node) {
- return node.kind === 159 /* SetAccessor */;
+ return node.kind === 160 /* SetAccessor */;
}
ts.isSetAccessor = isSetAccessor;
function isGetAccessor(node) {
- return node.kind === 158 /* GetAccessor */;
+ return node.kind === 159 /* GetAccessor */;
}
ts.isGetAccessor = isGetAccessor;
/** True if has jsdoc nodes attached to it. */
@@ -14911,12 +15039,12 @@
}
ts.hasOnlyExpressionInitializer = hasOnlyExpressionInitializer;
function isObjectLiteralElement(node) {
- return node.kind === 267 /* JsxAttribute */ || node.kind === 269 /* JsxSpreadAttribute */ || isObjectLiteralElementLike(node);
+ return node.kind === 268 /* JsxAttribute */ || node.kind === 270 /* JsxSpreadAttribute */ || isObjectLiteralElementLike(node);
}
ts.isObjectLiteralElement = isObjectLiteralElement;
/* @internal */
function isTypeReferenceType(node) {
- return node.kind === 164 /* TypeReference */ || node.kind === 211 /* ExpressionWithTypeArguments */;
+ return node.kind === 165 /* TypeReference */ || node.kind === 212 /* ExpressionWithTypeArguments */;
}
ts.isTypeReferenceType = isTypeReferenceType;
var MAX_SMI_X86 = 1073741823;
@@ -14952,7 +15080,7 @@
/* @internal */
(function (ts) {
function isNamedImportsOrExports(node) {
- return node.kind === 252 /* NamedImports */ || node.kind === 256 /* NamedExports */;
+ return node.kind === 253 /* NamedImports */ || node.kind === 257 /* NamedExports */;
}
ts.isNamedImportsOrExports = isNamedImportsOrExports;
function Symbol(flags, name) {
@@ -15203,6 +15331,11 @@
ts.semanticDiagnosticsOptionDeclarations.some(function (option) { return !ts.isJsonEqual(getCompilerOptionValue(oldOptions, option), getCompilerOptionValue(newOptions, option)); });
}
ts.compilerOptionsAffectSemanticDiagnostics = compilerOptionsAffectSemanticDiagnostics;
+ function compilerOptionsAffectEmit(newOptions, oldOptions) {
+ return oldOptions !== newOptions &&
+ ts.affectsEmitOptionDeclarations.some(function (option) { return !ts.isJsonEqual(getCompilerOptionValue(oldOptions, option), getCompilerOptionValue(newOptions, option)); });
+ }
+ ts.compilerOptionsAffectEmit = compilerOptionsAffectEmit;
function getCompilerOptionValue(options, option) {
return option.strictFlag ? getStrictOptionValue(options, option.name) : options[option.name];
}
@@ -15481,6 +15614,15 @@
return root + pathComponents.slice(1).join(ts.directorySeparator);
}
ts.getPathFromPathComponents = getPathFromPathComponents;
+ function getNormalizedAbsolutePathWithoutRoot(fileName, currentDirectory) {
+ return getPathWithoutRoot(getNormalizedPathComponents(fileName, currentDirectory));
+ }
+ ts.getNormalizedAbsolutePathWithoutRoot = getNormalizedAbsolutePathWithoutRoot;
+ function getPathWithoutRoot(pathComponents) {
+ if (pathComponents.length === 0)
+ return "";
+ return pathComponents.slice(1).join(ts.directorySeparator);
+ }
})(ts || (ts = {}));
/* @internal */
(function (ts) {
@@ -15511,7 +15653,7 @@
}
ts.getRelativePathFromFile = getRelativePathFromFile;
function getRelativePathFromDirectory(fromDirectory, to, getCanonicalFileNameOrIgnoreCase) {
- Debug.assert((ts.getRootLength(fromDirectory) > 0) === (ts.getRootLength(to) > 0), "Paths must either both be absolute or both be relative");
+ ts.Debug.assert((ts.getRootLength(fromDirectory) > 0) === (ts.getRootLength(to) > 0), "Paths must either both be absolute or both be relative");
var getCanonicalFileName = typeof getCanonicalFileNameOrIgnoreCase === "function" ? getCanonicalFileNameOrIgnoreCase : ts.identity;
var ignoreCase = typeof getCanonicalFileNameOrIgnoreCase === "boolean" ? getCanonicalFileNameOrIgnoreCase : false;
var pathComponents = getPathComponentsRelativeTo(fromDirectory, to, ignoreCase ? ts.equateStringsCaseInsensitive : ts.equateStringsCaseSensitive, getCanonicalFileName);
@@ -16155,32 +16297,9 @@
return pathext ? path.slice(0, path.length - pathext.length) + (ts.startsWith(ext, ".") ? ext : "." + ext) : path;
}
ts.changeAnyExtension = changeAnyExtension;
- var Debug;
- (function (Debug) {
- function showSymbol(symbol) {
- var symbolFlags = ts.SymbolFlags;
- return "{ flags: " + (symbolFlags ? showFlags(symbol.flags, symbolFlags) : symbol.flags) + "; declarations: " + ts.map(symbol.declarations, showSyntaxKind) + " }";
- }
- Debug.showSymbol = showSymbol;
- function showFlags(flags, flagsEnum) {
- var out = [];
- for (var pow = 0; pow <= 30; pow++) {
- var n = 1 << pow;
- if (flags & n) {
- out.push(flagsEnum[n]);
- }
- }
- return out.join("|");
- }
- function showSyntaxKind(node) {
- var syntaxKind = ts.SyntaxKind;
- return syntaxKind ? syntaxKind[node.kind] : node.kind.toString();
- }
- Debug.showSyntaxKind = showSyntaxKind;
- })(Debug = ts.Debug || (ts.Debug = {}));
function tryParsePattern(pattern) {
// This should be verified outside of here and a proper error thrown.
- Debug.assert(ts.hasZeroOrOneAsteriskCharacter(pattern));
+ ts.Debug.assert(ts.hasZeroOrOneAsteriskCharacter(pattern));
var indexOfStar = pattern.indexOf("*");
return indexOfStar === -1 ? undefined : {
prefix: pattern.substr(0, indexOfStar),
@@ -16209,7 +16328,7 @@
*/
function extensionFromPath(path) {
var ext = tryGetExtensionFromPath(path);
- return ext !== undefined ? ext : Debug.fail("File " + path + " has unknown extension.");
+ return ext !== undefined ? ext : ts.Debug.fail("File " + path + " has unknown extension.");
}
ts.extensionFromPath = extensionFromPath;
function isAnySupportedFileExtension(path) {
@@ -16281,7 +16400,7 @@
ts.matchPatternOrExact = matchPatternOrExact;
function sliceAfter(arr, value) {
var index = arr.indexOf(value);
- Debug.assert(index !== -1);
+ ts.Debug.assert(index !== -1);
return arr.slice(index);
}
ts.sliceAfter = sliceAfter;
@@ -16299,7 +16418,7 @@
}
ts.addRelatedInfo = addRelatedInfo;
function minAndMax(arr, getValue) {
- Debug.assert(arr.length !== 0);
+ ts.Debug.assert(arr.length !== 0);
var min = getValue(arr[0]);
var max = min;
for (var i = 1; i < arr.length; i++) {
@@ -16497,10 +16616,10 @@
var SourceFileConstructor;
// tslint:enable variable-name
function createNode(kind, pos, end) {
- if (kind === 284 /* SourceFile */) {
+ if (kind === 285 /* SourceFile */) {
return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end);
}
- else if (kind === 72 /* Identifier */) {
+ else if (kind === 73 /* Identifier */) {
return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, pos, end);
}
else if (!ts.isNodeKind(kind)) {
@@ -16549,19 +16668,19 @@
* that they appear in the source code. The language service depends on this property to locate nodes by position.
*/
function forEachChild(node, cbNode, cbNodes) {
- if (!node || node.kind <= 147 /* LastToken */) {
+ if (!node || node.kind <= 148 /* LastToken */) {
return;
}
switch (node.kind) {
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
return visitNode(cbNode, node.left) ||
visitNode(cbNode, node.right);
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.constraint) ||
visitNode(cbNode, node.default) ||
visitNode(cbNode, node.expression);
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
@@ -16569,9 +16688,9 @@
visitNode(cbNode, node.exclamationToken) ||
visitNode(cbNode, node.equalsToken) ||
visitNode(cbNode, node.objectAssignmentInitializer);
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
return visitNode(cbNode, node.expression);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.dotDotDotToken) ||
@@ -16579,7 +16698,7 @@
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.initializer);
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
@@ -16587,51 +16706,51 @@
visitNode(cbNode, node.exclamationToken) ||
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.initializer);
- case 153 /* PropertySignature */:
+ case 154 /* PropertySignature */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.initializer);
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.initializer);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.exclamationToken) ||
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.initializer);
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.dotDotDotToken) ||
visitNode(cbNode, node.propertyName) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.initializer);
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNodes(cbNode, cbNodes, node.typeParameters) ||
visitNodes(cbNode, cbNodes, node.parameters) ||
visitNode(cbNode, node.type);
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 196 /* FunctionExpression */:
- case 239 /* FunctionDeclaration */:
- case 197 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 197 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
+ case 198 /* ArrowFunction */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.asteriskToken) ||
@@ -16643,343 +16762,343 @@
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.equalsGreaterThanToken) ||
visitNode(cbNode, node.body);
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return visitNode(cbNode, node.typeName) ||
visitNodes(cbNode, cbNodes, node.typeArguments);
- case 163 /* TypePredicate */:
+ case 164 /* TypePredicate */:
return visitNode(cbNode, node.parameterName) ||
visitNode(cbNode, node.type);
- case 167 /* TypeQuery */:
+ case 168 /* TypeQuery */:
return visitNode(cbNode, node.exprName);
- case 168 /* TypeLiteral */:
+ case 169 /* TypeLiteral */:
return visitNodes(cbNode, cbNodes, node.members);
- case 169 /* ArrayType */:
+ case 170 /* ArrayType */:
return visitNode(cbNode, node.elementType);
- case 170 /* TupleType */:
+ case 171 /* TupleType */:
return visitNodes(cbNode, cbNodes, node.elementTypes);
- case 173 /* UnionType */:
- case 174 /* IntersectionType */:
+ case 174 /* UnionType */:
+ case 175 /* IntersectionType */:
return visitNodes(cbNode, cbNodes, node.types);
- case 175 /* ConditionalType */:
+ case 176 /* ConditionalType */:
return visitNode(cbNode, node.checkType) ||
visitNode(cbNode, node.extendsType) ||
visitNode(cbNode, node.trueType) ||
visitNode(cbNode, node.falseType);
- case 176 /* InferType */:
+ case 177 /* InferType */:
return visitNode(cbNode, node.typeParameter);
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return visitNode(cbNode, node.argument) ||
visitNode(cbNode, node.qualifier) ||
visitNodes(cbNode, cbNodes, node.typeArguments);
- case 177 /* ParenthesizedType */:
- case 179 /* TypeOperator */:
+ case 178 /* ParenthesizedType */:
+ case 180 /* TypeOperator */:
return visitNode(cbNode, node.type);
- case 180 /* IndexedAccessType */:
+ case 181 /* IndexedAccessType */:
return visitNode(cbNode, node.objectType) ||
visitNode(cbNode, node.indexType);
- case 181 /* MappedType */:
+ case 182 /* MappedType */:
return visitNode(cbNode, node.readonlyToken) ||
visitNode(cbNode, node.typeParameter) ||
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.type);
- case 182 /* LiteralType */:
+ case 183 /* LiteralType */:
return visitNode(cbNode, node.literal);
- case 184 /* ObjectBindingPattern */:
- case 185 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
return visitNodes(cbNode, cbNodes, node.elements);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return visitNodes(cbNode, cbNodes, node.elements);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return visitNodes(cbNode, cbNodes, node.properties);
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.name);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.argumentExpression);
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
return visitNode(cbNode, node.expression) ||
visitNodes(cbNode, cbNodes, node.typeArguments) ||
visitNodes(cbNode, cbNodes, node.arguments);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return visitNode(cbNode, node.tag) ||
visitNodes(cbNode, cbNodes, node.typeArguments) ||
visitNode(cbNode, node.template);
- case 194 /* TypeAssertionExpression */:
+ case 195 /* TypeAssertionExpression */:
return visitNode(cbNode, node.type) ||
visitNode(cbNode, node.expression);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return visitNode(cbNode, node.expression);
- case 198 /* DeleteExpression */:
+ case 199 /* DeleteExpression */:
return visitNode(cbNode, node.expression);
- case 199 /* TypeOfExpression */:
+ case 200 /* TypeOfExpression */:
return visitNode(cbNode, node.expression);
- case 200 /* VoidExpression */:
+ case 201 /* VoidExpression */:
return visitNode(cbNode, node.expression);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return visitNode(cbNode, node.operand);
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return visitNode(cbNode, node.asteriskToken) ||
visitNode(cbNode, node.expression);
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
return visitNode(cbNode, node.expression);
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return visitNode(cbNode, node.operand);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return visitNode(cbNode, node.left) ||
visitNode(cbNode, node.operatorToken) ||
visitNode(cbNode, node.right);
- case 212 /* AsExpression */:
+ case 213 /* AsExpression */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.type);
- case 213 /* NonNullExpression */:
+ case 214 /* NonNullExpression */:
return visitNode(cbNode, node.expression);
- case 214 /* MetaProperty */:
+ case 215 /* MetaProperty */:
return visitNode(cbNode, node.name);
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return visitNode(cbNode, node.condition) ||
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.whenTrue) ||
visitNode(cbNode, node.colonToken) ||
visitNode(cbNode, node.whenFalse);
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
return visitNode(cbNode, node.expression);
- case 218 /* Block */:
- case 245 /* ModuleBlock */:
+ case 219 /* Block */:
+ case 246 /* ModuleBlock */:
return visitNodes(cbNode, cbNodes, node.statements);
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return visitNodes(cbNode, cbNodes, node.statements) ||
visitNode(cbNode, node.endOfFileToken);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.declarationList);
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
return visitNodes(cbNode, cbNodes, node.declarations);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return visitNode(cbNode, node.expression);
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.thenStatement) ||
visitNode(cbNode, node.elseStatement);
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
return visitNode(cbNode, node.statement) ||
visitNode(cbNode, node.expression);
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.statement);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return visitNode(cbNode, node.initializer) ||
visitNode(cbNode, node.condition) ||
visitNode(cbNode, node.incrementor) ||
visitNode(cbNode, node.statement);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return visitNode(cbNode, node.initializer) ||
visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.statement);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return visitNode(cbNode, node.awaitModifier) ||
visitNode(cbNode, node.initializer) ||
visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.statement);
- case 228 /* ContinueStatement */:
- case 229 /* BreakStatement */:
+ case 229 /* ContinueStatement */:
+ case 230 /* BreakStatement */:
return visitNode(cbNode, node.label);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return visitNode(cbNode, node.expression);
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.statement);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.caseBlock);
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
return visitNodes(cbNode, cbNodes, node.clauses);
- case 271 /* CaseClause */:
+ case 272 /* CaseClause */:
return visitNode(cbNode, node.expression) ||
visitNodes(cbNode, cbNodes, node.statements);
- case 272 /* DefaultClause */:
+ case 273 /* DefaultClause */:
return visitNodes(cbNode, cbNodes, node.statements);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return visitNode(cbNode, node.label) ||
visitNode(cbNode, node.statement);
- case 234 /* ThrowStatement */:
+ case 235 /* ThrowStatement */:
return visitNode(cbNode, node.expression);
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
return visitNode(cbNode, node.tryBlock) ||
visitNode(cbNode, node.catchClause) ||
visitNode(cbNode, node.finallyBlock);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return visitNode(cbNode, node.variableDeclaration) ||
visitNode(cbNode, node.block);
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
return visitNode(cbNode, node.expression);
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNodes(cbNode, cbNodes, node.typeParameters) ||
visitNodes(cbNode, cbNodes, node.heritageClauses) ||
visitNodes(cbNode, cbNodes, node.members);
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNodes(cbNode, cbNodes, node.typeParameters) ||
visitNodes(cbNode, cbNodes, node.heritageClauses) ||
visitNodes(cbNode, cbNodes, node.members);
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNodes(cbNode, cbNodes, node.typeParameters) ||
visitNode(cbNode, node.type);
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNodes(cbNode, cbNodes, node.members);
- case 278 /* EnumMember */:
+ case 279 /* EnumMember */:
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.initializer);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.body);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.moduleReference);
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.importClause) ||
visitNode(cbNode, node.moduleSpecifier);
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.namedBindings);
- case 247 /* NamespaceExportDeclaration */:
+ case 248 /* NamespaceExportDeclaration */:
return visitNode(cbNode, node.name);
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
return visitNode(cbNode, node.name);
- case 252 /* NamedImports */:
- case 256 /* NamedExports */:
+ case 253 /* NamedImports */:
+ case 257 /* NamedExports */:
return visitNodes(cbNode, cbNodes, node.elements);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.exportClause) ||
visitNode(cbNode, node.moduleSpecifier);
- case 253 /* ImportSpecifier */:
- case 257 /* ExportSpecifier */:
+ case 254 /* ImportSpecifier */:
+ case 258 /* ExportSpecifier */:
return visitNode(cbNode, node.propertyName) ||
visitNode(cbNode, node.name);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.expression);
- case 206 /* TemplateExpression */:
+ case 207 /* TemplateExpression */:
return visitNode(cbNode, node.head) || visitNodes(cbNode, cbNodes, node.templateSpans);
- case 216 /* TemplateSpan */:
+ case 217 /* TemplateSpan */:
return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal);
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
return visitNode(cbNode, node.expression);
- case 273 /* HeritageClause */:
+ case 274 /* HeritageClause */:
return visitNodes(cbNode, cbNodes, node.types);
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return visitNode(cbNode, node.expression) ||
visitNodes(cbNode, cbNodes, node.typeArguments);
- case 259 /* ExternalModuleReference */:
+ case 260 /* ExternalModuleReference */:
return visitNode(cbNode, node.expression);
- case 258 /* MissingDeclaration */:
+ case 259 /* MissingDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators);
- case 314 /* CommaListExpression */:
+ case 315 /* CommaListExpression */:
return visitNodes(cbNode, cbNodes, node.elements);
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
return visitNode(cbNode, node.openingElement) ||
visitNodes(cbNode, cbNodes, node.children) ||
visitNode(cbNode, node.closingElement);
- case 264 /* JsxFragment */:
+ case 265 /* JsxFragment */:
return visitNode(cbNode, node.openingFragment) ||
visitNodes(cbNode, cbNodes, node.children) ||
visitNode(cbNode, node.closingFragment);
- case 261 /* JsxSelfClosingElement */:
- case 262 /* JsxOpeningElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
return visitNode(cbNode, node.tagName) ||
visitNodes(cbNode, cbNodes, node.typeArguments) ||
visitNode(cbNode, node.attributes);
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
return visitNodes(cbNode, cbNodes, node.properties);
- case 267 /* JsxAttribute */:
+ case 268 /* JsxAttribute */:
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.initializer);
- case 269 /* JsxSpreadAttribute */:
+ case 270 /* JsxSpreadAttribute */:
return visitNode(cbNode, node.expression);
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return visitNode(cbNode, node.dotDotDotToken) ||
visitNode(cbNode, node.expression);
- case 263 /* JsxClosingElement */:
+ case 264 /* JsxClosingElement */:
return visitNode(cbNode, node.tagName);
- case 171 /* OptionalType */:
- case 172 /* RestType */:
- case 288 /* JSDocTypeExpression */:
- case 292 /* JSDocNonNullableType */:
- case 291 /* JSDocNullableType */:
- case 293 /* JSDocOptionalType */:
- case 295 /* JSDocVariadicType */:
+ case 172 /* OptionalType */:
+ case 173 /* RestType */:
+ case 289 /* JSDocTypeExpression */:
+ case 293 /* JSDocNonNullableType */:
+ case 292 /* JSDocNullableType */:
+ case 294 /* JSDocOptionalType */:
+ case 296 /* JSDocVariadicType */:
return visitNode(cbNode, node.type);
- case 294 /* JSDocFunctionType */:
+ case 295 /* JSDocFunctionType */:
return visitNodes(cbNode, cbNodes, node.parameters) ||
visitNode(cbNode, node.type);
- case 296 /* JSDocComment */:
+ case 297 /* JSDocComment */:
return visitNodes(cbNode, cbNodes, node.tags);
- case 304 /* JSDocParameterTag */:
- case 310 /* JSDocPropertyTag */:
+ case 305 /* JSDocParameterTag */:
+ case 311 /* JSDocPropertyTag */:
return visitNode(cbNode, node.tagName) ||
(node.isNameFirst
? visitNode(cbNode, node.name) ||
visitNode(cbNode, node.typeExpression)
: visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.name));
- case 300 /* JSDocAugmentsTag */:
+ case 301 /* JSDocAugmentsTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.class);
- case 308 /* JSDocTemplateTag */:
+ case 309 /* JSDocTemplateTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.constraint) ||
visitNodes(cbNode, cbNodes, node.typeParameters);
- case 309 /* JSDocTypedefTag */:
+ case 310 /* JSDocTypedefTag */:
return visitNode(cbNode, node.tagName) ||
(node.typeExpression &&
- node.typeExpression.kind === 288 /* JSDocTypeExpression */
+ node.typeExpression.kind === 289 /* JSDocTypeExpression */
? visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.fullName)
: visitNode(cbNode, node.fullName) ||
visitNode(cbNode, node.typeExpression));
- case 302 /* JSDocCallbackTag */:
+ case 303 /* JSDocCallbackTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.fullName) ||
visitNode(cbNode, node.typeExpression);
- case 305 /* JSDocReturnTag */:
- case 307 /* JSDocTypeTag */:
- case 306 /* JSDocThisTag */:
- case 303 /* JSDocEnumTag */:
+ case 306 /* JSDocReturnTag */:
+ case 308 /* JSDocTypeTag */:
+ case 307 /* JSDocThisTag */:
+ case 304 /* JSDocEnumTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.typeExpression);
- case 298 /* JSDocSignature */:
+ case 299 /* JSDocSignature */:
return ts.forEach(node.typeParameters, cbNode) ||
ts.forEach(node.parameters, cbNode) ||
visitNode(cbNode, node.type);
- case 297 /* JSDocTypeLiteral */:
+ case 298 /* JSDocTypeLiteral */:
return ts.forEach(node.jsDocPropertyTags, cbNode);
- case 299 /* JSDocTag */:
- case 301 /* JSDocClassTag */:
+ case 300 /* JSDocTag */:
+ case 302 /* JSDocClassTag */:
return visitNode(cbNode, node.tagName);
- case 313 /* PartiallyEmittedExpression */:
+ case 314 /* PartiallyEmittedExpression */:
return visitNode(cbNode, node.expression);
}
}
@@ -17059,7 +17178,7 @@
(function (Parser) {
// Share a single scanner across all calls to parse a source file. This helps speed things
// up by avoiding the cost of creating/compiling scanners over and over again.
- var scanner = ts.createScanner(7 /* Latest */, /*skipTrivia*/ true);
+ var scanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ true);
var disallowInAndDecoratorContext = 2048 /* DisallowInContext */ | 8192 /* DecoratorContext */;
// capture constructors in 'initializeState' to avoid null checks
// tslint:disable variable-name
@@ -17197,14 +17316,14 @@
sourceFile.endOfFileToken = parseTokenNode();
}
else {
- var statement = createNode(221 /* ExpressionStatement */);
+ var statement = createNode(222 /* ExpressionStatement */);
switch (token()) {
case 22 /* OpenBracketToken */:
statement.expression = parseArrayLiteralExpression();
break;
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
- case 96 /* NullKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
+ case 97 /* NullKeyword */:
statement.expression = parseTokenNode();
break;
case 39 /* MinusToken */:
@@ -17353,7 +17472,7 @@
function createSourceFile(fileName, languageVersion, scriptKind, isDeclarationFile) {
// code from createNode is inlined here so createNode won't have to deal with special case of creating source files
// this is quite rare comparing to other nodes and createNode should be as fast as possible
- var sourceFile = new SourceFileConstructor(284 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length);
+ var sourceFile = new SourceFileConstructor(285 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length);
nodeCount++;
sourceFile.text = sourceText;
sourceFile.bindDiagnostics = [];
@@ -17496,6 +17615,9 @@
function nextToken() {
return currentToken = scanner.scan();
}
+ function nextTokenJSDoc() {
+ return currentToken = scanner.scanJsDocToken();
+ }
function reScanGreaterToken() {
return currentToken = scanner.reScanGreaterToken();
}
@@ -17561,20 +17683,20 @@
}
// Ignore strict mode flag because we will report an error in type checker instead.
function isIdentifier() {
- if (token() === 72 /* Identifier */) {
+ if (token() === 73 /* Identifier */) {
return true;
}
// If we have a 'yield' keyword, and we're in the [yield] context, then 'yield' is
// considered a keyword and is not an identifier.
- if (token() === 117 /* YieldKeyword */ && inYieldContext()) {
+ if (token() === 118 /* YieldKeyword */ && inYieldContext()) {
return false;
}
// If we have a 'await' keyword, and we're in the [Await] context, then 'await' is
// considered a keyword and is not an identifier.
- if (token() === 122 /* AwaitKeyword */ && inAwaitContext()) {
+ if (token() === 123 /* AwaitKeyword */ && inAwaitContext()) {
return false;
}
- return token() > 108 /* LastReservedWord */;
+ return token() > 109 /* LastReservedWord */;
}
function parseExpected(kind, diagnosticMessage, shouldAdvance) {
if (shouldAdvance === void 0) { shouldAdvance = true; }
@@ -17593,6 +17715,14 @@
}
return false;
}
+ function parseExpectedJSDoc(kind) {
+ if (token() === kind) {
+ nextTokenJSDoc();
+ return true;
+ }
+ parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind));
+ return false;
+ }
function parseOptional(t) {
if (token() === t) {
nextToken();
@@ -17606,15 +17736,30 @@
}
return undefined;
}
+ function parseOptionalTokenJSDoc(t) {
+ if (token() === t) {
+ return parseTokenNodeJSDoc();
+ }
+ return undefined;
+ }
function parseExpectedToken(t, diagnosticMessage, arg0) {
return parseOptionalToken(t) ||
createMissingNode(t, /*reportAtCurrentPosition*/ false, diagnosticMessage || ts.Diagnostics._0_expected, arg0 || ts.tokenToString(t));
}
+ function parseExpectedTokenJSDoc(t) {
+ return parseOptionalTokenJSDoc(t) ||
+ createMissingNode(t, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(t));
+ }
function parseTokenNode() {
var node = createNode(token());
nextToken();
return finishNode(node);
}
+ function parseTokenNodeJSDoc() {
+ var node = createNode(token());
+ nextTokenJSDoc();
+ return finishNode(node);
+ }
function canParseSemicolon() {
// If there's a real semicolon, then we can always parse it out.
if (token() === 26 /* SemicolonToken */) {
@@ -17639,7 +17784,7 @@
nodeCount++;
var p = pos >= 0 ? pos : scanner.getStartPos();
return ts.isNodeKind(kind) || kind === 0 /* Unknown */ ? new NodeConstructor(kind, p, p) :
- kind === 72 /* Identifier */ ? new IdentifierConstructor(kind, p, p) :
+ kind === 73 /* Identifier */ ? new IdentifierConstructor(kind, p, p) :
new TokenConstructor(kind, p, p);
}
function createNodeWithJSDoc(kind, pos) {
@@ -17681,7 +17826,7 @@
parseErrorAtCurrentToken(diagnosticMessage, arg0);
}
var result = createNode(kind);
- if (kind === 72 /* Identifier */) {
+ if (kind === 73 /* Identifier */) {
result.escapedText = "";
}
else if (ts.isLiteralKind(kind) || ts.isTemplateLiteralKind(kind)) {
@@ -17702,9 +17847,9 @@
function createIdentifier(isIdentifier, diagnosticMessage) {
identifierCount++;
if (isIdentifier) {
- var node = createNode(72 /* Identifier */);
+ var node = createNode(73 /* Identifier */);
// Store original token kind if it is not just an Identifier so we can report appropriate error later in type checker
- if (token() !== 72 /* Identifier */) {
+ if (token() !== 73 /* Identifier */) {
node.originalKeywordKind = token();
}
node.escapedText = ts.escapeLeadingUnderscores(internIdentifier(scanner.getTokenValue()));
@@ -17713,7 +17858,7 @@
}
// Only for end of file because the error gets reported incorrectly on embedded script tags.
var reportAtCurrentPosition = token() === 1 /* EndOfFileToken */;
- return createMissingNode(72 /* Identifier */, reportAtCurrentPosition, diagnosticMessage || ts.Diagnostics.Identifier_expected);
+ return createMissingNode(73 /* Identifier */, reportAtCurrentPosition, diagnosticMessage || ts.Diagnostics.Identifier_expected);
}
function parseIdentifier(diagnosticMessage) {
return createIdentifier(isIdentifier(), diagnosticMessage);
@@ -17744,7 +17889,7 @@
// PropertyName [Yield]:
// LiteralPropertyName
// ComputedPropertyName[?Yield]
- var node = createNode(149 /* ComputedPropertyName */);
+ var node = createNode(150 /* ComputedPropertyName */);
parseExpected(22 /* OpenBracketToken */);
// We parse any expression (including a comma expression). But the grammar
// says that only an assignment expression is allowed, so the grammar checker
@@ -17765,20 +17910,20 @@
}
function nextTokenCanFollowModifier() {
switch (token()) {
- case 77 /* ConstKeyword */:
+ case 78 /* ConstKeyword */:
// 'const' is only a modifier if followed by 'enum'.
- return nextToken() === 84 /* EnumKeyword */;
- case 85 /* ExportKeyword */:
+ return nextToken() === 85 /* EnumKeyword */;
+ case 86 /* ExportKeyword */:
nextToken();
- if (token() === 80 /* DefaultKeyword */) {
+ if (token() === 81 /* DefaultKeyword */) {
return lookAhead(nextTokenCanFollowDefaultKeyword);
}
- return token() !== 40 /* AsteriskToken */ && token() !== 119 /* AsKeyword */ && token() !== 18 /* OpenBraceToken */ && canFollowModifier();
- case 80 /* DefaultKeyword */:
+ return token() !== 40 /* AsteriskToken */ && token() !== 120 /* AsKeyword */ && token() !== 18 /* OpenBraceToken */ && canFollowModifier();
+ case 81 /* DefaultKeyword */:
return nextTokenCanFollowDefaultKeyword();
- case 116 /* StaticKeyword */:
- case 126 /* GetKeyword */:
- case 137 /* SetKeyword */:
+ case 117 /* StaticKeyword */:
+ case 127 /* GetKeyword */:
+ case 138 /* SetKeyword */:
nextToken();
return canFollowModifier();
default:
@@ -17797,10 +17942,10 @@
}
function nextTokenCanFollowDefaultKeyword() {
nextToken();
- return token() === 76 /* ClassKeyword */ || token() === 90 /* FunctionKeyword */ ||
- token() === 110 /* InterfaceKeyword */ ||
- (token() === 118 /* AbstractKeyword */ && lookAhead(nextTokenIsClassKeywordOnSameLine)) ||
- (token() === 121 /* AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine));
+ return token() === 77 /* ClassKeyword */ || token() === 91 /* FunctionKeyword */ ||
+ token() === 111 /* InterfaceKeyword */ ||
+ (token() === 119 /* AbstractKeyword */ && lookAhead(nextTokenIsClassKeywordOnSameLine)) ||
+ (token() === 122 /* AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine));
}
// True if positioned at the start of a list element
function isListElement(parsingContext, inErrorRecovery) {
@@ -17820,7 +17965,7 @@
// outer module. We just want to consume and move on.
return !(token() === 26 /* SemicolonToken */ && inErrorRecovery) && isStartOfStatement();
case 2 /* SwitchClauses */:
- return token() === 74 /* CaseKeyword */ || token() === 80 /* DefaultKeyword */;
+ return token() === 75 /* CaseKeyword */ || token() === 81 /* DefaultKeyword */;
case 4 /* TypeMembers */:
return lookAhead(isTypeMemberStart);
case 5 /* ClassMembers */:
@@ -17906,7 +18051,7 @@
// extends {} extends
// extends {} implements
var next = nextToken();
- return next === 27 /* CommaToken */ || next === 18 /* OpenBraceToken */ || next === 86 /* ExtendsKeyword */ || next === 109 /* ImplementsKeyword */;
+ return next === 27 /* CommaToken */ || next === 18 /* OpenBraceToken */ || next === 87 /* ExtendsKeyword */ || next === 110 /* ImplementsKeyword */;
}
return true;
}
@@ -17923,8 +18068,8 @@
return ts.tokenIsIdentifierOrKeywordOrGreaterThan(token());
}
function isHeritageClauseExtendsOrImplementsKeyword() {
- if (token() === 109 /* ImplementsKeyword */ ||
- token() === 86 /* ExtendsKeyword */) {
+ if (token() === 110 /* ImplementsKeyword */ ||
+ token() === 87 /* ExtendsKeyword */) {
return lookAhead(nextTokenIsStartOfExpression);
}
return false;
@@ -17954,14 +18099,14 @@
case 23 /* ImportOrExportSpecifiers */:
return token() === 19 /* CloseBraceToken */;
case 3 /* SwitchClauseStatements */:
- return token() === 19 /* CloseBraceToken */ || token() === 74 /* CaseKeyword */ || token() === 80 /* DefaultKeyword */;
+ return token() === 19 /* CloseBraceToken */ || token() === 75 /* CaseKeyword */ || token() === 81 /* DefaultKeyword */;
case 7 /* HeritageClauseElement */:
- return token() === 18 /* OpenBraceToken */ || token() === 86 /* ExtendsKeyword */ || token() === 109 /* ImplementsKeyword */;
+ return token() === 18 /* OpenBraceToken */ || token() === 87 /* ExtendsKeyword */ || token() === 110 /* ImplementsKeyword */;
case 8 /* VariableDeclarations */:
return isVariableDeclaratorListTerminator();
case 19 /* TypeParameters */:
// Tokens other than '>' are here for better error recovery
- return token() === 30 /* GreaterThanToken */ || token() === 20 /* OpenParenToken */ || token() === 18 /* OpenBraceToken */ || token() === 86 /* ExtendsKeyword */ || token() === 109 /* ImplementsKeyword */;
+ return token() === 30 /* GreaterThanToken */ || token() === 20 /* OpenParenToken */ || token() === 18 /* OpenBraceToken */ || token() === 87 /* ExtendsKeyword */ || token() === 110 /* ImplementsKeyword */;
case 11 /* ArgumentExpressions */:
// Tokens other than ')' are here for better error recovery
return token() === 21 /* CloseParenToken */ || token() === 26 /* SemicolonToken */;
@@ -18178,20 +18323,20 @@
function isReusableClassMember(node) {
if (node) {
switch (node.kind) {
- case 157 /* Constructor */:
- case 162 /* IndexSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 154 /* PropertyDeclaration */:
- case 217 /* SemicolonClassElement */:
+ case 158 /* Constructor */:
+ case 163 /* IndexSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 155 /* PropertyDeclaration */:
+ case 218 /* SemicolonClassElement */:
return true;
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
// Method declarations are not necessarily reusable. An object-literal
// may have a method calls "constructor(...)" and we must reparse that
// into an actual .ConstructorDeclaration.
var methodDeclaration = node;
- var nameIsConstructor = methodDeclaration.name.kind === 72 /* Identifier */ &&
- methodDeclaration.name.originalKeywordKind === 124 /* ConstructorKeyword */;
+ var nameIsConstructor = methodDeclaration.name.kind === 73 /* Identifier */ &&
+ methodDeclaration.name.originalKeywordKind === 125 /* ConstructorKeyword */;
return !nameIsConstructor;
}
}
@@ -18200,8 +18345,8 @@
function isReusableSwitchClause(node) {
if (node) {
switch (node.kind) {
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
return true;
}
}
@@ -18210,58 +18355,58 @@
function isReusableStatement(node) {
if (node) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 219 /* VariableStatement */:
- case 218 /* Block */:
- case 222 /* IfStatement */:
- case 221 /* ExpressionStatement */:
- case 234 /* ThrowStatement */:
- case 230 /* ReturnStatement */:
- case 232 /* SwitchStatement */:
- case 229 /* BreakStatement */:
- case 228 /* ContinueStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 225 /* ForStatement */:
- case 224 /* WhileStatement */:
- case 231 /* WithStatement */:
- case 220 /* EmptyStatement */:
- case 235 /* TryStatement */:
- case 233 /* LabeledStatement */:
- case 223 /* DoStatement */:
- case 236 /* DebuggerStatement */:
- case 249 /* ImportDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
- case 255 /* ExportDeclaration */:
- case 254 /* ExportAssignment */:
- case 244 /* ModuleDeclaration */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
- case 242 /* TypeAliasDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 220 /* VariableStatement */:
+ case 219 /* Block */:
+ case 223 /* IfStatement */:
+ case 222 /* ExpressionStatement */:
+ case 235 /* ThrowStatement */:
+ case 231 /* ReturnStatement */:
+ case 233 /* SwitchStatement */:
+ case 230 /* BreakStatement */:
+ case 229 /* ContinueStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 226 /* ForStatement */:
+ case 225 /* WhileStatement */:
+ case 232 /* WithStatement */:
+ case 221 /* EmptyStatement */:
+ case 236 /* TryStatement */:
+ case 234 /* LabeledStatement */:
+ case 224 /* DoStatement */:
+ case 237 /* DebuggerStatement */:
+ case 250 /* ImportDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 256 /* ExportDeclaration */:
+ case 255 /* ExportAssignment */:
+ case 245 /* ModuleDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return true;
}
}
return false;
}
function isReusableEnumMember(node) {
- return node.kind === 278 /* EnumMember */;
+ return node.kind === 279 /* EnumMember */;
}
function isReusableTypeMember(node) {
if (node) {
switch (node.kind) {
- case 161 /* ConstructSignature */:
- case 155 /* MethodSignature */:
- case 162 /* IndexSignature */:
- case 153 /* PropertySignature */:
- case 160 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 156 /* MethodSignature */:
+ case 163 /* IndexSignature */:
+ case 154 /* PropertySignature */:
+ case 161 /* CallSignature */:
return true;
}
}
return false;
}
function isReusableVariableDeclaration(node) {
- if (node.kind !== 237 /* VariableDeclaration */) {
+ if (node.kind !== 238 /* VariableDeclaration */) {
return false;
}
// Very subtle incremental parsing bug. Consider the following code:
@@ -18282,7 +18427,7 @@
return variableDeclarator.initializer === undefined;
}
function isReusableParameter(node) {
- if (node.kind !== 151 /* Parameter */) {
+ if (node.kind !== 152 /* Parameter */) {
return false;
}
// See the comment in isReusableVariableDeclaration for why we do this.
@@ -18418,7 +18563,7 @@
return entity;
}
function createQualifiedName(entity, name) {
- var node = createNode(148 /* QualifiedName */, entity.pos);
+ var node = createNode(149 /* QualifiedName */, entity.pos);
node.left = entity;
node.right = name;
return finishNode(node);
@@ -18449,13 +18594,13 @@
// Report that we need an identifier. However, report it right after the dot,
// and not on the next token. This is because the next token might actually
// be an identifier and the error would be quite confusing.
- return createMissingNode(72 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Identifier_expected);
+ return createMissingNode(73 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Identifier_expected);
}
}
return allowIdentifierNames ? parseIdentifierName() : parseIdentifier();
}
function parseTemplateExpression() {
- var template = createNode(206 /* TemplateExpression */);
+ var template = createNode(207 /* TemplateExpression */);
template.head = parseTemplateHead();
ts.Debug.assert(template.head.kind === 15 /* TemplateHead */, "Template head has wrong token kind");
var list = [];
@@ -18467,7 +18612,7 @@
return finishNode(template);
}
function parseTemplateSpan() {
- var span = createNode(216 /* TemplateSpan */);
+ var span = createNode(217 /* TemplateSpan */);
span.expression = allowInAnd(parseExpression);
var literal;
if (token() === 19 /* CloseBraceToken */) {
@@ -18517,7 +18662,7 @@
}
// TYPES
function parseTypeReference() {
- var node = createNode(164 /* TypeReference */);
+ var node = createNode(165 /* TypeReference */);
node.typeName = parseEntityName(/*allowReservedWords*/ true, ts.Diagnostics.Type_expected);
if (!scanner.hasPrecedingLineBreak() && reScanLessThanToken() === 28 /* LessThanToken */) {
node.typeArguments = parseBracketedList(20 /* TypeArguments */, parseType, 28 /* LessThanToken */, 30 /* GreaterThanToken */);
@@ -18527,14 +18672,14 @@
// If true, we should abort parsing an error function.
function typeHasArrowFunctionBlockingParseError(node) {
switch (node.kind) {
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return ts.nodeIsMissing(node.typeName);
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */: {
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */: {
var _a = node, parameters = _a.parameters, type = _a.type;
return isMissingList(parameters) || typeHasArrowFunctionBlockingParseError(type);
}
- case 177 /* ParenthesizedType */:
+ case 178 /* ParenthesizedType */:
return typeHasArrowFunctionBlockingParseError(node.type);
default:
return false;
@@ -18542,20 +18687,20 @@
}
function parseThisTypePredicate(lhs) {
nextToken();
- var node = createNode(163 /* TypePredicate */, lhs.pos);
+ var node = createNode(164 /* TypePredicate */, lhs.pos);
node.parameterName = lhs;
node.type = parseType();
return finishNode(node);
}
function parseThisTypeNode() {
- var node = createNode(178 /* ThisType */);
+ var node = createNode(179 /* ThisType */);
nextToken();
return finishNode(node);
}
function parseJSDocAllType(postFixEquals) {
- var result = createNode(289 /* JSDocAllType */);
+ var result = createNode(290 /* JSDocAllType */);
if (postFixEquals) {
- return createPostfixType(293 /* JSDocOptionalType */, result);
+ return createPostfixType(294 /* JSDocOptionalType */, result);
}
else {
nextToken();
@@ -18563,7 +18708,7 @@
return finishNode(result);
}
function parseJSDocNonNullableType() {
- var result = createNode(292 /* JSDocNonNullableType */);
+ var result = createNode(293 /* JSDocNonNullableType */);
nextToken();
result.type = parseNonArrayType();
return finishNode(result);
@@ -18585,31 +18730,31 @@
token() === 19 /* CloseBraceToken */ ||
token() === 21 /* CloseParenToken */ ||
token() === 30 /* GreaterThanToken */ ||
- token() === 59 /* EqualsToken */ ||
+ token() === 60 /* EqualsToken */ ||
token() === 50 /* BarToken */) {
- var result = createNode(290 /* JSDocUnknownType */, pos);
+ var result = createNode(291 /* JSDocUnknownType */, pos);
return finishNode(result);
}
else {
- var result = createNode(291 /* JSDocNullableType */, pos);
+ var result = createNode(292 /* JSDocNullableType */, pos);
result.type = parseType();
return finishNode(result);
}
}
function parseJSDocFunctionType() {
if (lookAhead(nextTokenIsOpenParen)) {
- var result = createNodeWithJSDoc(294 /* JSDocFunctionType */);
+ var result = createNodeWithJSDoc(295 /* JSDocFunctionType */);
nextToken();
fillSignature(57 /* ColonToken */, 4 /* Type */ | 32 /* JSDoc */, result);
return finishNode(result);
}
- var node = createNode(164 /* TypeReference */);
+ var node = createNode(165 /* TypeReference */);
node.typeName = parseIdentifierName();
return finishNode(node);
}
function parseJSDocParameter() {
- var parameter = createNode(151 /* Parameter */);
- if (token() === 100 /* ThisKeyword */ || token() === 95 /* NewKeyword */) {
+ var parameter = createNode(152 /* Parameter */);
+ if (token() === 101 /* ThisKeyword */ || token() === 96 /* NewKeyword */) {
parameter.name = parseIdentifierName();
parseExpected(57 /* ColonToken */);
}
@@ -18622,25 +18767,25 @@
var type = parseTypeOrTypePredicate();
scanner.setInJSDocType(false);
if (dotdotdot) {
- var variadic = createNode(295 /* JSDocVariadicType */, dotdotdot.pos);
+ var variadic = createNode(296 /* JSDocVariadicType */, dotdotdot.pos);
variadic.type = type;
type = finishNode(variadic);
}
- if (token() === 59 /* EqualsToken */) {
- return createPostfixType(293 /* JSDocOptionalType */, type);
+ if (token() === 60 /* EqualsToken */) {
+ return createPostfixType(294 /* JSDocOptionalType */, type);
}
return type;
}
function parseTypeQuery() {
- var node = createNode(167 /* TypeQuery */);
- parseExpected(104 /* TypeOfKeyword */);
+ var node = createNode(168 /* TypeQuery */);
+ parseExpected(105 /* TypeOfKeyword */);
node.exprName = parseEntityName(/*allowReservedWords*/ true);
return finishNode(node);
}
function parseTypeParameter() {
- var node = createNode(150 /* TypeParameter */);
+ var node = createNode(151 /* TypeParameter */);
node.name = parseIdentifier();
- if (parseOptional(86 /* ExtendsKeyword */)) {
+ if (parseOptional(87 /* ExtendsKeyword */)) {
// It's not uncommon for people to write improper constraints to a generic. If the
// user writes a constraint that is an expression and not an actual type, then parse
// it out as an expression (so we can recover well), but report that a type is needed
@@ -18659,7 +18804,7 @@
node.expression = parseUnaryExpressionOrHigher();
}
}
- if (parseOptional(59 /* EqualsToken */)) {
+ if (parseOptional(60 /* EqualsToken */)) {
node.default = parseType();
}
return finishNode(node);
@@ -18683,8 +18828,8 @@
isStartOfType(/*inStartOfParameter*/ !isJSDocParameter);
}
function parseParameter() {
- var node = createNodeWithJSDoc(151 /* Parameter */);
- if (token() === 100 /* ThisKeyword */) {
+ var node = createNodeWithJSDoc(152 /* Parameter */);
+ if (token() === 101 /* ThisKeyword */) {
node.name = createIdentifier(/*isIdentifier*/ true);
node.type = parseParameterType();
return finishNode(node);
@@ -18784,8 +18929,8 @@
}
function parseSignatureMember(kind) {
var node = createNodeWithJSDoc(kind);
- if (kind === 161 /* ConstructSignature */) {
- parseExpected(95 /* NewKeyword */);
+ if (kind === 162 /* ConstructSignature */) {
+ parseExpected(96 /* NewKeyword */);
}
fillSignature(57 /* ColonToken */, 4 /* Type */, node);
parseTypeMemberSemicolon();
@@ -18845,7 +18990,7 @@
return token() === 57 /* ColonToken */ || token() === 27 /* CommaToken */ || token() === 23 /* CloseBracketToken */;
}
function parseIndexSignatureDeclaration(node) {
- node.kind = 162 /* IndexSignature */;
+ node.kind = 163 /* IndexSignature */;
node.parameters = parseBracketedList(16 /* Parameters */, parseParameter, 22 /* OpenBracketToken */, 23 /* CloseBracketToken */);
node.type = parseTypeAnnotation();
parseTypeMemberSemicolon();
@@ -18855,15 +19000,15 @@
node.name = parsePropertyName();
node.questionToken = parseOptionalToken(56 /* QuestionToken */);
if (token() === 20 /* OpenParenToken */ || token() === 28 /* LessThanToken */) {
- node.kind = 155 /* MethodSignature */;
+ node.kind = 156 /* MethodSignature */;
// Method signatures don't exist in expression contexts. So they have neither
// [Yield] nor [Await]
fillSignature(57 /* ColonToken */, 4 /* Type */, node);
}
else {
- node.kind = 153 /* PropertySignature */;
+ node.kind = 154 /* PropertySignature */;
node.type = parseTypeAnnotation();
- if (token() === 59 /* EqualsToken */) {
+ if (token() === 60 /* EqualsToken */) {
// Although type literal properties cannot not have initializers, we attempt
// to parse an initializer so we can report in the checker that an interface
// property or type literal property cannot have an initializer.
@@ -18907,10 +19052,10 @@
}
function parseTypeMember() {
if (token() === 20 /* OpenParenToken */ || token() === 28 /* LessThanToken */) {
- return parseSignatureMember(160 /* CallSignature */);
+ return parseSignatureMember(161 /* CallSignature */);
}
- if (token() === 95 /* NewKeyword */ && lookAhead(nextTokenIsOpenParenOrLessThan)) {
- return parseSignatureMember(161 /* ConstructSignature */);
+ if (token() === 96 /* NewKeyword */ && lookAhead(nextTokenIsOpenParenOrLessThan)) {
+ return parseSignatureMember(162 /* ConstructSignature */);
}
var node = createNodeWithJSDoc(0 /* Unknown */);
node.modifiers = parseModifiers();
@@ -18936,7 +19081,7 @@
return false;
}
function parseTypeLiteral() {
- var node = createNode(168 /* TypeLiteral */);
+ var node = createNode(169 /* TypeLiteral */);
node.members = parseObjectTypeMembers();
return finishNode(node);
}
@@ -18954,27 +19099,27 @@
function isStartOfMappedType() {
nextToken();
if (token() === 38 /* PlusToken */ || token() === 39 /* MinusToken */) {
- return nextToken() === 133 /* ReadonlyKeyword */;
+ return nextToken() === 134 /* ReadonlyKeyword */;
}
- if (token() === 133 /* ReadonlyKeyword */) {
+ if (token() === 134 /* ReadonlyKeyword */) {
nextToken();
}
- return token() === 22 /* OpenBracketToken */ && nextTokenIsIdentifier() && nextToken() === 93 /* InKeyword */;
+ return token() === 22 /* OpenBracketToken */ && nextTokenIsIdentifier() && nextToken() === 94 /* InKeyword */;
}
function parseMappedTypeParameter() {
- var node = createNode(150 /* TypeParameter */);
+ var node = createNode(151 /* TypeParameter */);
node.name = parseIdentifier();
- parseExpected(93 /* InKeyword */);
+ parseExpected(94 /* InKeyword */);
node.constraint = parseType();
return finishNode(node);
}
function parseMappedType() {
- var node = createNode(181 /* MappedType */);
+ var node = createNode(182 /* MappedType */);
parseExpected(18 /* OpenBraceToken */);
- if (token() === 133 /* ReadonlyKeyword */ || token() === 38 /* PlusToken */ || token() === 39 /* MinusToken */) {
+ if (token() === 134 /* ReadonlyKeyword */ || token() === 38 /* PlusToken */ || token() === 39 /* MinusToken */) {
node.readonlyToken = parseTokenNode();
- if (node.readonlyToken.kind !== 133 /* ReadonlyKeyword */) {
- parseExpectedToken(133 /* ReadonlyKeyword */);
+ if (node.readonlyToken.kind !== 134 /* ReadonlyKeyword */) {
+ parseExpectedToken(134 /* ReadonlyKeyword */);
}
}
parseExpected(22 /* OpenBracketToken */);
@@ -18994,23 +19139,23 @@
function parseTupleElementType() {
var pos = getNodePos();
if (parseOptional(25 /* DotDotDotToken */)) {
- var node = createNode(172 /* RestType */, pos);
+ var node = createNode(173 /* RestType */, pos);
node.type = parseType();
return finishNode(node);
}
var type = parseType();
- if (!(contextFlags & 2097152 /* JSDoc */) && type.kind === 291 /* JSDocNullableType */ && type.pos === type.type.pos) {
- type.kind = 171 /* OptionalType */;
+ if (!(contextFlags & 2097152 /* JSDoc */) && type.kind === 292 /* JSDocNullableType */ && type.pos === type.type.pos) {
+ type.kind = 172 /* OptionalType */;
}
return type;
}
function parseTupleType() {
- var node = createNode(170 /* TupleType */);
+ var node = createNode(171 /* TupleType */);
node.elementTypes = parseBracketedList(21 /* TupleElementTypes */, parseTupleElementType, 22 /* OpenBracketToken */, 23 /* CloseBracketToken */);
return finishNode(node);
}
function parseParenthesizedType() {
- var node = createNode(177 /* ParenthesizedType */);
+ var node = createNode(178 /* ParenthesizedType */);
parseExpected(20 /* OpenParenToken */);
node.type = parseType();
parseExpected(21 /* CloseParenToken */);
@@ -19018,7 +19163,7 @@
}
function parseFunctionOrConstructorType() {
var pos = getNodePos();
- var kind = parseOptional(95 /* NewKeyword */) ? 166 /* ConstructorType */ : 165 /* FunctionType */;
+ var kind = parseOptional(96 /* NewKeyword */) ? 167 /* ConstructorType */ : 166 /* FunctionType */;
var node = createNodeWithJSDoc(kind, pos);
fillSignature(37 /* EqualsGreaterThanToken */, 4 /* Type */, node);
return finishNode(node);
@@ -19028,14 +19173,14 @@
return token() === 24 /* DotToken */ ? undefined : node;
}
function parseLiteralTypeNode(negative) {
- var node = createNode(182 /* LiteralType */);
+ var node = createNode(183 /* LiteralType */);
var unaryMinusExpression;
if (negative) {
- unaryMinusExpression = createNode(202 /* PrefixUnaryExpression */);
+ unaryMinusExpression = createNode(203 /* PrefixUnaryExpression */);
unaryMinusExpression.operator = 39 /* MinusToken */;
nextToken();
}
- var expression = token() === 102 /* TrueKeyword */ || token() === 87 /* FalseKeyword */
+ var expression = token() === 103 /* TrueKeyword */ || token() === 88 /* FalseKeyword */
? parseTokenNode()
: parseLiteralLikeNode(token());
if (negative) {
@@ -19048,22 +19193,24 @@
}
function isStartOfTypeOfImportType() {
nextToken();
- return token() === 92 /* ImportKeyword */;
+ return token() === 93 /* ImportKeyword */;
}
function parseImportType() {
sourceFile.flags |= 524288 /* PossiblyContainsDynamicImport */;
- var node = createNode(183 /* ImportType */);
- if (parseOptional(104 /* TypeOfKeyword */)) {
+ var node = createNode(184 /* ImportType */);
+ if (parseOptional(105 /* TypeOfKeyword */)) {
node.isTypeOf = true;
}
- parseExpected(92 /* ImportKeyword */);
+ parseExpected(93 /* ImportKeyword */);
parseExpected(20 /* OpenParenToken */);
node.argument = parseType();
parseExpected(21 /* CloseParenToken */);
if (parseOptional(24 /* DotToken */)) {
node.qualifier = parseEntityName(/*allowReservedWords*/ true, ts.Diagnostics.Type_expected);
}
- node.typeArguments = tryParseTypeArguments();
+ if (!scanner.hasPrecedingLineBreak() && reScanLessThanToken() === 28 /* LessThanToken */) {
+ node.typeArguments = parseBracketedList(20 /* TypeArguments */, parseType, 28 /* LessThanToken */, 30 /* GreaterThanToken */);
+ }
return finishNode(node);
}
function nextTokenIsNumericOrBigIntLiteral() {
@@ -19072,25 +19219,25 @@
}
function parseNonArrayType() {
switch (token()) {
- case 120 /* AnyKeyword */:
- case 143 /* UnknownKeyword */:
- case 138 /* StringKeyword */:
- case 135 /* NumberKeyword */:
- case 146 /* BigIntKeyword */:
- case 139 /* SymbolKeyword */:
- case 123 /* BooleanKeyword */:
- case 141 /* UndefinedKeyword */:
- case 132 /* NeverKeyword */:
- case 136 /* ObjectKeyword */:
+ case 121 /* AnyKeyword */:
+ case 144 /* UnknownKeyword */:
+ case 139 /* StringKeyword */:
+ case 136 /* NumberKeyword */:
+ case 147 /* BigIntKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 142 /* UndefinedKeyword */:
+ case 133 /* NeverKeyword */:
+ case 137 /* ObjectKeyword */:
// If these are followed by a dot, then parse these out as a dotted type reference instead.
return tryParse(parseKeywordAndNoDot) || parseTypeReference();
case 40 /* AsteriskToken */:
return parseJSDocAllType(/*postfixEquals*/ false);
- case 62 /* AsteriskEqualsToken */:
+ case 63 /* AsteriskEqualsToken */:
return parseJSDocAllType(/*postfixEquals*/ true);
case 56 /* QuestionToken */:
return parseJSDocUnknownOrNullableType();
- case 90 /* FunctionKeyword */:
+ case 91 /* FunctionKeyword */:
return parseJSDocFunctionType();
case 52 /* ExclamationToken */:
return parseJSDocNonNullableType();
@@ -19098,24 +19245,24 @@
case 10 /* StringLiteral */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
return parseLiteralTypeNode();
case 39 /* MinusToken */:
return lookAhead(nextTokenIsNumericOrBigIntLiteral) ? parseLiteralTypeNode(/*negative*/ true) : parseTypeReference();
- case 106 /* VoidKeyword */:
- case 96 /* NullKeyword */:
+ case 107 /* VoidKeyword */:
+ case 97 /* NullKeyword */:
return parseTokenNode();
- case 100 /* ThisKeyword */: {
+ case 101 /* ThisKeyword */: {
var thisKeyword = parseThisTypeNode();
- if (token() === 128 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) {
+ if (token() === 129 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) {
return parseThisTypePredicate(thisKeyword);
}
else {
return thisKeyword;
}
}
- case 104 /* TypeOfKeyword */:
+ case 105 /* TypeOfKeyword */:
return lookAhead(isStartOfTypeOfImportType) ? parseImportType() : parseTypeQuery();
case 18 /* OpenBraceToken */:
return lookAhead(isStartOfMappedType) ? parseMappedType() : parseTypeLiteral();
@@ -19123,7 +19270,7 @@
return parseTupleType();
case 20 /* OpenParenToken */:
return parseParenthesizedType();
- case 92 /* ImportKeyword */:
+ case 93 /* ImportKeyword */:
return parseImportType();
default:
return parseTypeReference();
@@ -19131,41 +19278,41 @@
}
function isStartOfType(inStartOfParameter) {
switch (token()) {
- case 120 /* AnyKeyword */:
- case 143 /* UnknownKeyword */:
- case 138 /* StringKeyword */:
- case 135 /* NumberKeyword */:
- case 146 /* BigIntKeyword */:
- case 123 /* BooleanKeyword */:
- case 133 /* ReadonlyKeyword */:
- case 139 /* SymbolKeyword */:
- case 142 /* UniqueKeyword */:
- case 106 /* VoidKeyword */:
- case 141 /* UndefinedKeyword */:
- case 96 /* NullKeyword */:
- case 100 /* ThisKeyword */:
- case 104 /* TypeOfKeyword */:
- case 132 /* NeverKeyword */:
+ case 121 /* AnyKeyword */:
+ case 144 /* UnknownKeyword */:
+ case 139 /* StringKeyword */:
+ case 136 /* NumberKeyword */:
+ case 147 /* BigIntKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 134 /* ReadonlyKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 143 /* UniqueKeyword */:
+ case 107 /* VoidKeyword */:
+ case 142 /* UndefinedKeyword */:
+ case 97 /* NullKeyword */:
+ case 101 /* ThisKeyword */:
+ case 105 /* TypeOfKeyword */:
+ case 133 /* NeverKeyword */:
case 18 /* OpenBraceToken */:
case 22 /* OpenBracketToken */:
case 28 /* LessThanToken */:
case 50 /* BarToken */:
case 49 /* AmpersandToken */:
- case 95 /* NewKeyword */:
+ case 96 /* NewKeyword */:
case 10 /* StringLiteral */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
- case 136 /* ObjectKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
+ case 137 /* ObjectKeyword */:
case 40 /* AsteriskToken */:
case 56 /* QuestionToken */:
case 52 /* ExclamationToken */:
case 25 /* DotDotDotToken */:
- case 127 /* InferKeyword */:
- case 92 /* ImportKeyword */:
+ case 128 /* InferKeyword */:
+ case 93 /* ImportKeyword */:
return true;
- case 90 /* FunctionKeyword */:
+ case 91 /* FunctionKeyword */:
return !inStartOfParameter;
case 39 /* MinusToken */:
return !inStartOfParameter && lookAhead(nextTokenIsNumericOrBigIntLiteral);
@@ -19186,26 +19333,26 @@
while (!scanner.hasPrecedingLineBreak()) {
switch (token()) {
case 52 /* ExclamationToken */:
- type = createPostfixType(292 /* JSDocNonNullableType */, type);
+ type = createPostfixType(293 /* JSDocNonNullableType */, type);
break;
case 56 /* QuestionToken */:
// If not in JSDoc and next token is start of a type we have a conditional type
if (!(contextFlags & 2097152 /* JSDoc */) && lookAhead(nextTokenIsStartOfType)) {
return type;
}
- type = createPostfixType(291 /* JSDocNullableType */, type);
+ type = createPostfixType(292 /* JSDocNullableType */, type);
break;
case 22 /* OpenBracketToken */:
parseExpected(22 /* OpenBracketToken */);
if (isStartOfType()) {
- var node = createNode(180 /* IndexedAccessType */, type.pos);
+ var node = createNode(181 /* IndexedAccessType */, type.pos);
node.objectType = type;
node.indexType = parseType();
parseExpected(23 /* CloseBracketToken */);
type = finishNode(node);
}
else {
- var node = createNode(169 /* ArrayType */, type.pos);
+ var node = createNode(170 /* ArrayType */, type.pos);
node.elementType = type;
parseExpected(23 /* CloseBracketToken */);
type = finishNode(node);
@@ -19224,16 +19371,16 @@
return finishNode(postfix);
}
function parseTypeOperator(operator) {
- var node = createNode(179 /* TypeOperator */);
+ var node = createNode(180 /* TypeOperator */);
parseExpected(operator);
node.operator = operator;
node.type = parseTypeOperatorOrHigher();
return finishNode(node);
}
function parseInferType() {
- var node = createNode(176 /* InferType */);
- parseExpected(127 /* InferKeyword */);
- var typeParameter = createNode(150 /* TypeParameter */);
+ var node = createNode(177 /* InferType */);
+ parseExpected(128 /* InferKeyword */);
+ var typeParameter = createNode(151 /* TypeParameter */);
typeParameter.name = parseIdentifier();
node.typeParameter = finishNode(typeParameter);
return finishNode(node);
@@ -19241,34 +19388,35 @@
function parseTypeOperatorOrHigher() {
var operator = token();
switch (operator) {
- case 129 /* KeyOfKeyword */:
- case 142 /* UniqueKeyword */:
- case 133 /* ReadonlyKeyword */:
+ case 130 /* KeyOfKeyword */:
+ case 143 /* UniqueKeyword */:
+ case 134 /* ReadonlyKeyword */:
return parseTypeOperator(operator);
- case 127 /* InferKeyword */:
+ case 128 /* InferKeyword */:
return parseInferType();
}
return parsePostfixTypeOrHigher();
}
function parseUnionOrIntersectionType(kind, parseConstituentType, operator) {
- parseOptional(operator);
+ var start = scanner.getStartPos();
+ var hasLeadingOperator = parseOptional(operator);
var type = parseConstituentType();
- if (token() === operator) {
+ if (token() === operator || hasLeadingOperator) {
var types = [type];
while (parseOptional(operator)) {
types.push(parseConstituentType());
}
- var node = createNode(kind, type.pos);
- node.types = createNodeArray(types, type.pos);
+ var node = createNode(kind, start);
+ node.types = createNodeArray(types, start);
type = finishNode(node);
}
return type;
}
function parseIntersectionTypeOrHigher() {
- return parseUnionOrIntersectionType(174 /* IntersectionType */, parseTypeOperatorOrHigher, 49 /* AmpersandToken */);
+ return parseUnionOrIntersectionType(175 /* IntersectionType */, parseTypeOperatorOrHigher, 49 /* AmpersandToken */);
}
function parseUnionTypeOrHigher() {
- return parseUnionOrIntersectionType(173 /* UnionType */, parseIntersectionTypeOrHigher, 50 /* BarToken */);
+ return parseUnionOrIntersectionType(174 /* UnionType */, parseIntersectionTypeOrHigher, 50 /* BarToken */);
}
function isStartOfFunctionType() {
if (token() === 28 /* LessThanToken */) {
@@ -19281,7 +19429,7 @@
// Skip modifiers
parseModifiers();
}
- if (isIdentifier() || token() === 100 /* ThisKeyword */) {
+ if (isIdentifier() || token() === 101 /* ThisKeyword */) {
nextToken();
return true;
}
@@ -19304,7 +19452,7 @@
// We successfully skipped modifiers (if any) and an identifier or binding pattern,
// now see if we have something that indicates a parameter declaration
if (token() === 57 /* ColonToken */ || token() === 27 /* CommaToken */ ||
- token() === 56 /* QuestionToken */ || token() === 59 /* EqualsToken */) {
+ token() === 56 /* QuestionToken */ || token() === 60 /* EqualsToken */) {
// ( xxx :
// ( xxx ,
// ( xxx ?
@@ -19325,7 +19473,7 @@
var typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix);
var type = parseType();
if (typePredicateVariable) {
- var node = createNode(163 /* TypePredicate */, typePredicateVariable.pos);
+ var node = createNode(164 /* TypePredicate */, typePredicateVariable.pos);
node.parameterName = typePredicateVariable;
node.type = type;
return finishNode(node);
@@ -19336,7 +19484,7 @@
}
function parseTypePredicatePrefix() {
var id = parseIdentifier();
- if (token() === 128 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) {
+ if (token() === 129 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) {
nextToken();
return id;
}
@@ -19347,12 +19495,12 @@
return doOutsideOfContext(20480 /* TypeExcludesFlags */, parseTypeWorker);
}
function parseTypeWorker(noConditionalTypes) {
- if (isStartOfFunctionType() || token() === 95 /* NewKeyword */) {
+ if (isStartOfFunctionType() || token() === 96 /* NewKeyword */) {
return parseFunctionOrConstructorType();
}
var type = parseUnionTypeOrHigher();
- if (!noConditionalTypes && !scanner.hasPrecedingLineBreak() && parseOptional(86 /* ExtendsKeyword */)) {
- var node = createNode(175 /* ConditionalType */, type.pos);
+ if (!noConditionalTypes && !scanner.hasPrecedingLineBreak() && parseOptional(87 /* ExtendsKeyword */)) {
+ var node = createNode(176 /* ConditionalType */, type.pos);
node.checkType = type;
// The type following 'extends' is not permitted to be another conditional type
node.extendsType = parseTypeWorker(/*noConditionalTypes*/ true);
@@ -19370,11 +19518,11 @@
// EXPRESSIONS
function isStartOfLeftHandSideExpression() {
switch (token()) {
- case 100 /* ThisKeyword */:
- case 98 /* SuperKeyword */:
- case 96 /* NullKeyword */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
+ case 101 /* ThisKeyword */:
+ case 99 /* SuperKeyword */:
+ case 97 /* NullKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
case 10 /* StringLiteral */:
@@ -19383,14 +19531,14 @@
case 20 /* OpenParenToken */:
case 22 /* OpenBracketToken */:
case 18 /* OpenBraceToken */:
- case 90 /* FunctionKeyword */:
- case 76 /* ClassKeyword */:
- case 95 /* NewKeyword */:
+ case 91 /* FunctionKeyword */:
+ case 77 /* ClassKeyword */:
+ case 96 /* NewKeyword */:
case 42 /* SlashToken */:
- case 64 /* SlashEqualsToken */:
- case 72 /* Identifier */:
+ case 65 /* SlashEqualsToken */:
+ case 73 /* Identifier */:
return true;
- case 92 /* ImportKeyword */:
+ case 93 /* ImportKeyword */:
return lookAhead(nextTokenIsOpenParenOrLessThanOrDot);
default:
return isIdentifier();
@@ -19405,14 +19553,14 @@
case 39 /* MinusToken */:
case 53 /* TildeToken */:
case 52 /* ExclamationToken */:
- case 81 /* DeleteKeyword */:
- case 104 /* TypeOfKeyword */:
- case 106 /* VoidKeyword */:
+ case 82 /* DeleteKeyword */:
+ case 105 /* TypeOfKeyword */:
+ case 107 /* VoidKeyword */:
case 44 /* PlusPlusToken */:
case 45 /* MinusMinusToken */:
case 28 /* LessThanToken */:
- case 122 /* AwaitKeyword */:
- case 117 /* YieldKeyword */:
+ case 123 /* AwaitKeyword */:
+ case 118 /* YieldKeyword */:
// Yield/await always starts an expression. Either it is an identifier (in which case
// it is definitely an expression). Or it's a keyword (either because we're in
// a generator or async function, or in strict mode (or both)) and it started a yield or await expression.
@@ -19431,8 +19579,8 @@
function isStartOfExpressionStatement() {
// As per the grammar, none of '{' or 'function' or 'class' can start an expression statement.
return token() !== 18 /* OpenBraceToken */ &&
- token() !== 90 /* FunctionKeyword */ &&
- token() !== 76 /* ClassKeyword */ &&
+ token() !== 91 /* FunctionKeyword */ &&
+ token() !== 77 /* ClassKeyword */ &&
token() !== 58 /* AtToken */ &&
isStartOfExpression();
}
@@ -19456,7 +19604,7 @@
return expr;
}
function parseInitializer() {
- return parseOptional(59 /* EqualsToken */) ? parseAssignmentExpressionOrHigher() : undefined;
+ return parseOptional(60 /* EqualsToken */) ? parseAssignmentExpressionOrHigher() : undefined;
}
function parseAssignmentExpressionOrHigher() {
// AssignmentExpression[in,yield]:
@@ -19501,7 +19649,7 @@
// To avoid a look-ahead, we did not handle the case of an arrow function with a single un-parenthesized
// parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single
// identifier and the current token is an arrow.
- if (expr.kind === 72 /* Identifier */ && token() === 37 /* EqualsGreaterThanToken */) {
+ if (expr.kind === 73 /* Identifier */ && token() === 37 /* EqualsGreaterThanToken */) {
return parseSimpleArrowFunctionExpression(expr);
}
// Now see if we might be in cases '2' or '3'.
@@ -19517,7 +19665,7 @@
return parseConditionalExpressionRest(expr);
}
function isYieldExpression() {
- if (token() === 117 /* YieldKeyword */) {
+ if (token() === 118 /* YieldKeyword */) {
// If we have a 'yield' keyword, and this is a context where yield expressions are
// allowed, then definitely parse out a yield expression.
if (inYieldContext()) {
@@ -19546,7 +19694,7 @@
return !scanner.hasPrecedingLineBreak() && isIdentifier();
}
function parseYieldExpression() {
- var node = createNode(207 /* YieldExpression */);
+ var node = createNode(208 /* YieldExpression */);
// YieldExpression[In] :
// yield
// yield [no LineTerminator here] [Lexical goal InputElementRegExp]AssignmentExpression[?In, Yield]
@@ -19568,13 +19716,13 @@
ts.Debug.assert(token() === 37 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
var node;
if (asyncModifier) {
- node = createNode(197 /* ArrowFunction */, asyncModifier.pos);
+ node = createNode(198 /* ArrowFunction */, asyncModifier.pos);
node.modifiers = asyncModifier;
}
else {
- node = createNode(197 /* ArrowFunction */, identifier.pos);
+ node = createNode(198 /* ArrowFunction */, identifier.pos);
}
- var parameter = createNode(151 /* Parameter */, identifier.pos);
+ var parameter = createNode(152 /* Parameter */, identifier.pos);
parameter.name = identifier;
finishNode(parameter);
node.parameters = createNodeArray([parameter], parameter.pos, parameter.end);
@@ -19614,7 +19762,7 @@
// Unknown -> There *might* be a parenthesized arrow function here.
// Speculatively look ahead to be sure, and rollback if not.
function isParenthesizedArrowFunctionExpression() {
- if (token() === 20 /* OpenParenToken */ || token() === 28 /* LessThanToken */ || token() === 121 /* AsyncKeyword */) {
+ if (token() === 20 /* OpenParenToken */ || token() === 28 /* LessThanToken */ || token() === 122 /* AsyncKeyword */) {
return lookAhead(isParenthesizedArrowFunctionExpressionWorker);
}
if (token() === 37 /* EqualsGreaterThanToken */) {
@@ -19627,7 +19775,7 @@
return 0 /* False */;
}
function isParenthesizedArrowFunctionExpressionWorker() {
- if (token() === 121 /* AsyncKeyword */) {
+ if (token() === 122 /* AsyncKeyword */) {
nextToken();
if (scanner.hasPrecedingLineBreak()) {
return 0 /* False */;
@@ -19671,13 +19819,13 @@
// Check for "(xxx yyy", where xxx is a modifier and yyy is an identifier. This
// isn't actually allowed, but we want to treat it as a lambda so we can provide
// a good error message.
- if (ts.isModifierKind(second) && second !== 121 /* AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) {
+ if (ts.isModifierKind(second) && second !== 122 /* AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) {
return 1 /* True */;
}
// If we had "(" followed by something that's not an identifier,
// then this definitely doesn't look like a lambda. "this" is not
// valid, but we want to parse it and then give a semantic error.
- if (!isIdentifier() && second !== 100 /* ThisKeyword */) {
+ if (!isIdentifier() && second !== 101 /* ThisKeyword */) {
return 0 /* False */;
}
switch (nextToken()) {
@@ -19688,13 +19836,13 @@
case 56 /* QuestionToken */:
nextToken();
// If we have "(a?:" or "(a?," or "(a?=" or "(a?)" then it is definitely a lambda.
- if (token() === 57 /* ColonToken */ || token() === 27 /* CommaToken */ || token() === 59 /* EqualsToken */ || token() === 21 /* CloseParenToken */) {
+ if (token() === 57 /* ColonToken */ || token() === 27 /* CommaToken */ || token() === 60 /* EqualsToken */ || token() === 21 /* CloseParenToken */) {
return 1 /* True */;
}
// Otherwise it is definitely not a lambda.
return 0 /* False */;
case 27 /* CommaToken */:
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
case 21 /* CloseParenToken */:
// If we have "(a," or "(a=" or "(a)" this *could* be an arrow function
return 2 /* Unknown */;
@@ -19713,10 +19861,10 @@
if (sourceFile.languageVariant === 1 /* JSX */) {
var isArrowFunctionInJsx = lookAhead(function () {
var third = nextToken();
- if (third === 86 /* ExtendsKeyword */) {
+ if (third === 87 /* ExtendsKeyword */) {
var fourth = nextToken();
switch (fourth) {
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
case 30 /* GreaterThanToken */:
return false;
default:
@@ -19742,7 +19890,7 @@
}
function tryParseAsyncSimpleArrowFunctionExpression() {
// We do a check here so that we won't be doing unnecessarily call to "lookAhead"
- if (token() === 121 /* AsyncKeyword */) {
+ if (token() === 122 /* AsyncKeyword */) {
if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) {
var asyncModifier = parseModifiersForArrowFunction();
var expr = parseBinaryExpressionOrHigher(/*precedence*/ 0);
@@ -19755,7 +19903,7 @@
// AsyncArrowFunctionExpression:
// 1) async[no LineTerminator here]AsyncArrowBindingIdentifier[?Yield][no LineTerminator here]=>AsyncConciseBody[?In]
// 2) CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await][no LineTerminator here]=>AsyncConciseBody[?In]
- if (token() === 121 /* AsyncKeyword */) {
+ if (token() === 122 /* AsyncKeyword */) {
nextToken();
// If the "async" is followed by "=>" token then it is not a beginning of an async arrow-function
// but instead a simple arrow-function which will be parsed inside "parseAssignmentExpressionOrHigher"
@@ -19764,14 +19912,14 @@
}
// Check for un-parenthesized AsyncArrowFunction
var expr = parseBinaryExpressionOrHigher(/*precedence*/ 0);
- if (!scanner.hasPrecedingLineBreak() && expr.kind === 72 /* Identifier */ && token() === 37 /* EqualsGreaterThanToken */) {
+ if (!scanner.hasPrecedingLineBreak() && expr.kind === 73 /* Identifier */ && token() === 37 /* EqualsGreaterThanToken */) {
return 1 /* True */;
}
}
return 0 /* False */;
}
function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) {
- var node = createNodeWithJSDoc(197 /* ArrowFunction */);
+ var node = createNodeWithJSDoc(198 /* ArrowFunction */);
node.modifiers = parseModifiersForArrowFunction();
var isAsync = ts.hasModifier(node, 256 /* Async */) ? 2 /* Await */ : 0 /* None */;
// Arrow functions are never generators.
@@ -19790,9 +19938,11 @@
// - "(x = 10)" is an assignment expression parsed as a signature with a default parameter value.
// - "(x,y)" is a comma expression parsed as a signature with two parameters.
// - "a ? (b): c" will have "(b):" parsed as a signature with a return type annotation.
+ // - "a ? (b): function() {}" will too, since function() is a valid JSDoc function type.
//
// So we need just a bit of lookahead to ensure that it can only be a signature.
- if (!allowAmbiguity && token() !== 37 /* EqualsGreaterThanToken */ && token() !== 18 /* OpenBraceToken */) {
+ var hasJSDocFunctionType = node.type && ts.isJSDocFunctionType(node.type);
+ if (!allowAmbiguity && token() !== 37 /* EqualsGreaterThanToken */ && (hasJSDocFunctionType || token() !== 18 /* OpenBraceToken */)) {
// Returning undefined here will cause our caller to rewind to where we started from.
return undefined;
}
@@ -19803,8 +19953,8 @@
return parseFunctionBlock(isAsync ? 2 /* Await */ : 0 /* None */);
}
if (token() !== 26 /* SemicolonToken */ &&
- token() !== 90 /* FunctionKeyword */ &&
- token() !== 76 /* ClassKeyword */ &&
+ token() !== 91 /* FunctionKeyword */ &&
+ token() !== 77 /* ClassKeyword */ &&
isStartOfStatement() &&
!isStartOfExpressionStatement()) {
// Check if we got a plain statement (i.e. no expression-statements, no function/class expressions/declarations)
@@ -19835,14 +19985,14 @@
}
// Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and
// we do not that for the 'whenFalse' part.
- var node = createNode(205 /* ConditionalExpression */, leftOperand.pos);
+ var node = createNode(206 /* ConditionalExpression */, leftOperand.pos);
node.condition = leftOperand;
node.questionToken = questionToken;
node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher);
node.colonToken = parseExpectedToken(57 /* ColonToken */);
node.whenFalse = ts.nodeIsPresent(node.colonToken)
? parseAssignmentExpressionOrHigher()
- : createMissingNode(72 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(57 /* ColonToken */));
+ : createMissingNode(73 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(57 /* ColonToken */));
return finishNode(node);
}
function parseBinaryExpressionOrHigher(precedence) {
@@ -19850,7 +20000,7 @@
return parseBinaryExpressionRest(precedence, leftOperand);
}
function isInOrOfKeyword(t) {
- return t === 93 /* InKeyword */ || t === 147 /* OfKeyword */;
+ return t === 94 /* InKeyword */ || t === 148 /* OfKeyword */;
}
function parseBinaryExpressionRest(precedence, leftOperand) {
while (true) {
@@ -19885,10 +20035,10 @@
if (!consumeCurrentOperator) {
break;
}
- if (token() === 93 /* InKeyword */ && inDisallowInContext()) {
+ if (token() === 94 /* InKeyword */ && inDisallowInContext()) {
break;
}
- if (token() === 119 /* AsKeyword */) {
+ if (token() === 120 /* AsKeyword */) {
// Make sure we *do* perform ASI for constructs like this:
// var x = foo
// as (Bar)
@@ -19909,51 +20059,51 @@
return leftOperand;
}
function isBinaryOperator() {
- if (inDisallowInContext() && token() === 93 /* InKeyword */) {
+ if (inDisallowInContext() && token() === 94 /* InKeyword */) {
return false;
}
return ts.getBinaryOperatorPrecedence(token()) > 0;
}
function makeBinaryExpression(left, operatorToken, right) {
- var node = createNode(204 /* BinaryExpression */, left.pos);
+ var node = createNode(205 /* BinaryExpression */, left.pos);
node.left = left;
node.operatorToken = operatorToken;
node.right = right;
return finishNode(node);
}
function makeAsExpression(left, right) {
- var node = createNode(212 /* AsExpression */, left.pos);
+ var node = createNode(213 /* AsExpression */, left.pos);
node.expression = left;
node.type = right;
return finishNode(node);
}
function parsePrefixUnaryExpression() {
- var node = createNode(202 /* PrefixUnaryExpression */);
+ var node = createNode(203 /* PrefixUnaryExpression */);
node.operator = token();
nextToken();
node.operand = parseSimpleUnaryExpression();
return finishNode(node);
}
function parseDeleteExpression() {
- var node = createNode(198 /* DeleteExpression */);
+ var node = createNode(199 /* DeleteExpression */);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
}
function parseTypeOfExpression() {
- var node = createNode(199 /* TypeOfExpression */);
+ var node = createNode(200 /* TypeOfExpression */);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
}
function parseVoidExpression() {
- var node = createNode(200 /* VoidExpression */);
+ var node = createNode(201 /* VoidExpression */);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
}
function isAwaitExpression() {
- if (token() === 122 /* AwaitKeyword */) {
+ if (token() === 123 /* AwaitKeyword */) {
if (inAwaitContext()) {
return true;
}
@@ -19963,7 +20113,7 @@
return false;
}
function parseAwaitExpression() {
- var node = createNode(201 /* AwaitExpression */);
+ var node = createNode(202 /* AwaitExpression */);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
@@ -20007,7 +20157,7 @@
if (token() === 41 /* AsteriskAsteriskToken */) {
var pos = ts.skipTrivia(sourceText, simpleUnaryExpression.pos);
var end = simpleUnaryExpression.end;
- if (simpleUnaryExpression.kind === 194 /* TypeAssertionExpression */) {
+ if (simpleUnaryExpression.kind === 195 /* TypeAssertionExpression */) {
parseErrorAt(pos, end, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses);
}
else {
@@ -20037,18 +20187,18 @@
case 53 /* TildeToken */:
case 52 /* ExclamationToken */:
return parsePrefixUnaryExpression();
- case 81 /* DeleteKeyword */:
+ case 82 /* DeleteKeyword */:
return parseDeleteExpression();
- case 104 /* TypeOfKeyword */:
+ case 105 /* TypeOfKeyword */:
return parseTypeOfExpression();
- case 106 /* VoidKeyword */:
+ case 107 /* VoidKeyword */:
return parseVoidExpression();
case 28 /* LessThanToken */:
// This is modified UnaryExpression grammar in TypeScript
// UnaryExpression (modified):
// < type > UnaryExpression
return parseTypeAssertion();
- case 122 /* AwaitKeyword */:
+ case 123 /* AwaitKeyword */:
if (isAwaitExpression()) {
return parseAwaitExpression();
}
@@ -20075,10 +20225,10 @@
case 39 /* MinusToken */:
case 53 /* TildeToken */:
case 52 /* ExclamationToken */:
- case 81 /* DeleteKeyword */:
- case 104 /* TypeOfKeyword */:
- case 106 /* VoidKeyword */:
- case 122 /* AwaitKeyword */:
+ case 82 /* DeleteKeyword */:
+ case 105 /* TypeOfKeyword */:
+ case 107 /* VoidKeyword */:
+ case 123 /* AwaitKeyword */:
return false;
case 28 /* LessThanToken */:
// If we are not in JSX context, we are parsing TypeAssertion which is an UnaryExpression
@@ -20104,7 +20254,7 @@
*/
function parseUpdateExpression() {
if (token() === 44 /* PlusPlusToken */ || token() === 45 /* MinusMinusToken */) {
- var node = createNode(202 /* PrefixUnaryExpression */);
+ var node = createNode(203 /* PrefixUnaryExpression */);
node.operator = token();
nextToken();
node.operand = parseLeftHandSideExpressionOrHigher();
@@ -20117,7 +20267,7 @@
var expression = parseLeftHandSideExpressionOrHigher();
ts.Debug.assert(ts.isLeftHandSideExpression(expression));
if ((token() === 44 /* PlusPlusToken */ || token() === 45 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) {
- var node = createNode(203 /* PostfixUnaryExpression */, expression.pos);
+ var node = createNode(204 /* PostfixUnaryExpression */, expression.pos);
node.operand = expression;
node.operator = token();
nextToken();
@@ -20158,7 +20308,7 @@
// 3)we have a MemberExpression which either completes the LeftHandSideExpression,
// or starts the beginning of the first four CallExpression productions.
var expression;
- if (token() === 92 /* ImportKeyword */) {
+ if (token() === 93 /* ImportKeyword */) {
if (lookAhead(nextTokenIsOpenParenOrLessThan)) {
// We don't want to eagerly consume all import keyword as import call expression so we look ahead to find "("
// For example:
@@ -20173,8 +20323,8 @@
var fullStart = scanner.getStartPos();
nextToken(); // advance past the 'import'
nextToken(); // advance past the dot
- var node = createNode(214 /* MetaProperty */, fullStart);
- node.keywordToken = 92 /* ImportKeyword */;
+ var node = createNode(215 /* MetaProperty */, fullStart);
+ node.keywordToken = 93 /* ImportKeyword */;
node.name = parseIdentifierName();
expression = finishNode(node);
sourceFile.flags |= 1048576 /* PossiblyContainsImportMeta */;
@@ -20184,7 +20334,7 @@
}
}
else {
- expression = token() === 98 /* SuperKeyword */ ? parseSuperExpression() : parseMemberExpressionOrHigher();
+ expression = token() === 99 /* SuperKeyword */ ? parseSuperExpression() : parseMemberExpressionOrHigher();
}
// Now, we *may* be complete. However, we might have consumed the start of a
// CallExpression. As such, we need to consume the rest of it here to be complete.
@@ -20243,12 +20393,19 @@
}
function parseSuperExpression() {
var expression = parseTokenNode();
+ if (token() === 28 /* LessThanToken */) {
+ var startPos = getNodePos();
+ var typeArguments = tryParse(parseTypeArgumentsInExpression);
+ if (typeArguments !== undefined) {
+ parseErrorAt(startPos, getNodePos(), ts.Diagnostics.super_may_not_use_type_arguments);
+ }
+ }
if (token() === 20 /* OpenParenToken */ || token() === 24 /* DotToken */ || token() === 22 /* OpenBracketToken */) {
return expression;
}
// If we have seen "super" it must be followed by '(' or '.'.
// If it wasn't then just try to parse out a '.' and report an error.
- var node = createNode(189 /* PropertyAccessExpression */, expression.pos);
+ var node = createNode(190 /* PropertyAccessExpression */, expression.pos);
node.expression = expression;
parseExpectedToken(24 /* DotToken */, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access);
node.name = parseRightSideOfDot(/*allowIdentifierNames*/ true);
@@ -20257,8 +20414,8 @@
function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext) {
var opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext);
var result;
- if (opening.kind === 262 /* JsxOpeningElement */) {
- var node = createNode(260 /* JsxElement */, opening.pos);
+ if (opening.kind === 263 /* JsxOpeningElement */) {
+ var node = createNode(261 /* JsxElement */, opening.pos);
node.openingElement = opening;
node.children = parseJsxChildren(node.openingElement);
node.closingElement = parseJsxClosingElement(inExpressionContext);
@@ -20267,15 +20424,15 @@
}
result = finishNode(node);
}
- else if (opening.kind === 265 /* JsxOpeningFragment */) {
- var node = createNode(264 /* JsxFragment */, opening.pos);
+ else if (opening.kind === 266 /* JsxOpeningFragment */) {
+ var node = createNode(265 /* JsxFragment */, opening.pos);
node.openingFragment = opening;
node.children = parseJsxChildren(node.openingFragment);
node.closingFragment = parseJsxClosingFragment(inExpressionContext);
result = finishNode(node);
}
else {
- ts.Debug.assert(opening.kind === 261 /* JsxSelfClosingElement */);
+ ts.Debug.assert(opening.kind === 262 /* JsxSelfClosingElement */);
// Nothing else to do for self-closing elements
result = opening;
}
@@ -20290,11 +20447,11 @@
var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElementOrFragment(/*inExpressionContext*/ true); });
if (invalidElement) {
parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element);
- var badNode = createNode(204 /* BinaryExpression */, result.pos);
+ var badNode = createNode(205 /* BinaryExpression */, result.pos);
badNode.end = invalidElement.end;
badNode.left = result;
badNode.right = invalidElement;
- badNode.operatorToken = createMissingNode(27 /* CommaToken */, /*reportAtCurrentPosition*/ false, /*diagnosticMessage*/ undefined); // TODO: GH#18217
+ badNode.operatorToken = createMissingNode(27 /* CommaToken */, /*reportAtCurrentPosition*/ false);
badNode.operatorToken.pos = badNode.operatorToken.end = badNode.right.pos;
return badNode;
}
@@ -20349,7 +20506,7 @@
return createNodeArray(list, listPos);
}
function parseJsxAttributes() {
- var jsxAttributes = createNode(268 /* JsxAttributes */);
+ var jsxAttributes = createNode(269 /* JsxAttributes */);
jsxAttributes.properties = parseList(13 /* JsxAttributes */, parseJsxAttribute);
return finishNode(jsxAttributes);
}
@@ -20358,7 +20515,7 @@
parseExpected(28 /* LessThanToken */);
if (token() === 30 /* GreaterThanToken */) {
// See below for explanation of scanJsxText
- var node_1 = createNode(265 /* JsxOpeningFragment */, fullStart);
+ var node_1 = createNode(266 /* JsxOpeningFragment */, fullStart);
scanJsxText();
return finishNode(node_1);
}
@@ -20370,7 +20527,7 @@
// Closing tag, so scan the immediately-following text with the JSX scanning instead
// of regular scanning to avoid treating illegal characters (e.g. '#') as immediate
// scanning errors
- node = createNode(262 /* JsxOpeningElement */, fullStart);
+ node = createNode(263 /* JsxOpeningElement */, fullStart);
scanJsxText();
}
else {
@@ -20382,7 +20539,7 @@
parseExpected(30 /* GreaterThanToken */, /*diagnostic*/ undefined, /*shouldAdvance*/ false);
scanJsxText();
}
- node = createNode(261 /* JsxSelfClosingElement */, fullStart);
+ node = createNode(262 /* JsxSelfClosingElement */, fullStart);
}
node.tagName = tagName;
node.typeArguments = typeArguments;
@@ -20396,10 +20553,10 @@
// primaryExpression in the form of an identifier and "this" keyword
// We can't just simply use parseLeftHandSideExpressionOrHigher because then we will start consider class,function etc as a keyword
// We only want to consider "this" as a primaryExpression
- var expression = token() === 100 /* ThisKeyword */ ?
+ var expression = token() === 101 /* ThisKeyword */ ?
parseTokenNode() : parseIdentifierName();
while (parseOptional(24 /* DotToken */)) {
- var propertyAccess = createNode(189 /* PropertyAccessExpression */, expression.pos);
+ var propertyAccess = createNode(190 /* PropertyAccessExpression */, expression.pos);
propertyAccess.expression = expression;
propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true);
expression = finishNode(propertyAccess);
@@ -20407,7 +20564,7 @@
return expression;
}
function parseJsxExpression(inExpressionContext) {
- var node = createNode(270 /* JsxExpression */);
+ var node = createNode(271 /* JsxExpression */);
if (!parseExpected(18 /* OpenBraceToken */)) {
return undefined;
}
@@ -20429,9 +20586,9 @@
return parseJsxSpreadAttribute();
}
scanJsxIdentifier();
- var node = createNode(267 /* JsxAttribute */);
+ var node = createNode(268 /* JsxAttribute */);
node.name = parseIdentifierName();
- if (token() === 59 /* EqualsToken */) {
+ if (token() === 60 /* EqualsToken */) {
switch (scanJsxAttributeValue()) {
case 10 /* StringLiteral */:
node.initializer = parseLiteralNode();
@@ -20444,7 +20601,7 @@
return finishNode(node);
}
function parseJsxSpreadAttribute() {
- var node = createNode(269 /* JsxSpreadAttribute */);
+ var node = createNode(270 /* JsxSpreadAttribute */);
parseExpected(18 /* OpenBraceToken */);
parseExpected(25 /* DotDotDotToken */);
node.expression = parseExpression();
@@ -20452,7 +20609,7 @@
return finishNode(node);
}
function parseJsxClosingElement(inExpressionContext) {
- var node = createNode(263 /* JsxClosingElement */);
+ var node = createNode(264 /* JsxClosingElement */);
parseExpected(29 /* LessThanSlashToken */);
node.tagName = parseJsxElementName();
if (inExpressionContext) {
@@ -20465,7 +20622,7 @@
return finishNode(node);
}
function parseJsxClosingFragment(inExpressionContext) {
- var node = createNode(266 /* JsxClosingFragment */);
+ var node = createNode(267 /* JsxClosingFragment */);
parseExpected(29 /* LessThanSlashToken */);
if (ts.tokenIsIdentifierOrKeyword(token())) {
parseErrorAtRange(parseJsxElementName(), ts.Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment);
@@ -20480,7 +20637,7 @@
return finishNode(node);
}
function parseTypeAssertion() {
- var node = createNode(194 /* TypeAssertionExpression */);
+ var node = createNode(195 /* TypeAssertionExpression */);
parseExpected(28 /* LessThanToken */);
node.type = parseType();
parseExpected(30 /* GreaterThanToken */);
@@ -20491,7 +20648,7 @@
while (true) {
var dotToken = parseOptionalToken(24 /* DotToken */);
if (dotToken) {
- var propertyAccess = createNode(189 /* PropertyAccessExpression */, expression.pos);
+ var propertyAccess = createNode(190 /* PropertyAccessExpression */, expression.pos);
propertyAccess.expression = expression;
propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true);
expression = finishNode(propertyAccess);
@@ -20499,17 +20656,17 @@
}
if (token() === 52 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) {
nextToken();
- var nonNullExpression = createNode(213 /* NonNullExpression */, expression.pos);
+ var nonNullExpression = createNode(214 /* NonNullExpression */, expression.pos);
nonNullExpression.expression = expression;
expression = finishNode(nonNullExpression);
continue;
}
// when in the [Decorator] context, we do not parse ElementAccess as it could be part of a ComputedPropertyName
if (!inDecoratorContext() && parseOptional(22 /* OpenBracketToken */)) {
- var indexedAccess = createNode(190 /* ElementAccessExpression */, expression.pos);
+ var indexedAccess = createNode(191 /* ElementAccessExpression */, expression.pos);
indexedAccess.expression = expression;
if (token() === 23 /* CloseBracketToken */) {
- indexedAccess.argumentExpression = createMissingNode(72 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.An_element_access_expression_should_take_an_argument);
+ indexedAccess.argumentExpression = createMissingNode(73 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.An_element_access_expression_should_take_an_argument);
}
else {
var argument = allowInAnd(parseExpression);
@@ -20533,7 +20690,7 @@
return token() === 14 /* NoSubstitutionTemplateLiteral */ || token() === 15 /* TemplateHead */;
}
function parseTaggedTemplateRest(tag, typeArguments) {
- var tagExpression = createNode(193 /* TaggedTemplateExpression */, tag.pos);
+ var tagExpression = createNode(194 /* TaggedTemplateExpression */, tag.pos);
tagExpression.tag = tag;
tagExpression.typeArguments = typeArguments;
tagExpression.template = token() === 14 /* NoSubstitutionTemplateLiteral */
@@ -20558,7 +20715,7 @@
expression = parseTaggedTemplateRest(expression, typeArguments);
continue;
}
- var callExpr = createNode(191 /* CallExpression */, expression.pos);
+ var callExpr = createNode(192 /* CallExpression */, expression.pos);
callExpr.expression = expression;
callExpr.typeArguments = typeArguments;
callExpr.arguments = parseArgumentList();
@@ -20566,7 +20723,7 @@
continue;
}
else if (token() === 20 /* OpenParenToken */) {
- var callExpr = createNode(191 /* CallExpression */, expression.pos);
+ var callExpr = createNode(192 /* CallExpression */, expression.pos);
callExpr.expression = expression;
callExpr.arguments = parseArgumentList();
expression = finishNode(callExpr);
@@ -20642,11 +20799,11 @@
case 10 /* StringLiteral */:
case 14 /* NoSubstitutionTemplateLiteral */:
return parseLiteralNode();
- case 100 /* ThisKeyword */:
- case 98 /* SuperKeyword */:
- case 96 /* NullKeyword */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
+ case 101 /* ThisKeyword */:
+ case 99 /* SuperKeyword */:
+ case 97 /* NullKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
return parseTokenNode();
case 20 /* OpenParenToken */:
return parseParenthesizedExpression();
@@ -20654,7 +20811,7 @@
return parseArrayLiteralExpression();
case 18 /* OpenBraceToken */:
return parseObjectLiteralExpression();
- case 121 /* AsyncKeyword */:
+ case 122 /* AsyncKeyword */:
// Async arrow functions are parsed earlier in parseAssignmentExpressionOrHigher.
// If we encounter `async [no LineTerminator here] function` then this is an async
// function; otherwise, its an identifier.
@@ -20662,14 +20819,14 @@
break;
}
return parseFunctionExpression();
- case 76 /* ClassKeyword */:
+ case 77 /* ClassKeyword */:
return parseClassExpression();
- case 90 /* FunctionKeyword */:
+ case 91 /* FunctionKeyword */:
return parseFunctionExpression();
- case 95 /* NewKeyword */:
+ case 96 /* NewKeyword */:
return parseNewExpressionOrNewDotTarget();
case 42 /* SlashToken */:
- case 64 /* SlashEqualsToken */:
+ case 65 /* SlashEqualsToken */:
if (reScanSlashToken() === 13 /* RegularExpressionLiteral */) {
return parseLiteralNode();
}
@@ -20680,28 +20837,28 @@
return parseIdentifier(ts.Diagnostics.Expression_expected);
}
function parseParenthesizedExpression() {
- var node = createNodeWithJSDoc(195 /* ParenthesizedExpression */);
+ var node = createNodeWithJSDoc(196 /* ParenthesizedExpression */);
parseExpected(20 /* OpenParenToken */);
node.expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
return finishNode(node);
}
function parseSpreadElement() {
- var node = createNode(208 /* SpreadElement */);
+ var node = createNode(209 /* SpreadElement */);
parseExpected(25 /* DotDotDotToken */);
node.expression = parseAssignmentExpressionOrHigher();
return finishNode(node);
}
function parseArgumentOrArrayLiteralElement() {
return token() === 25 /* DotDotDotToken */ ? parseSpreadElement() :
- token() === 27 /* CommaToken */ ? createNode(210 /* OmittedExpression */) :
+ token() === 27 /* CommaToken */ ? createNode(211 /* OmittedExpression */) :
parseAssignmentExpressionOrHigher();
}
function parseArgumentExpression() {
return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement);
}
function parseArrayLiteralExpression() {
- var node = createNode(187 /* ArrayLiteralExpression */);
+ var node = createNode(188 /* ArrayLiteralExpression */);
parseExpected(22 /* OpenBracketToken */);
if (scanner.hasPrecedingLineBreak()) {
node.multiLine = true;
@@ -20713,17 +20870,17 @@
function parseObjectLiteralElement() {
var node = createNodeWithJSDoc(0 /* Unknown */);
if (parseOptionalToken(25 /* DotDotDotToken */)) {
- node.kind = 277 /* SpreadAssignment */;
+ node.kind = 278 /* SpreadAssignment */;
node.expression = parseAssignmentExpressionOrHigher();
return finishNode(node);
}
node.decorators = parseDecorators();
node.modifiers = parseModifiers();
- if (parseContextualModifier(126 /* GetKeyword */)) {
- return parseAccessorDeclaration(node, 158 /* GetAccessor */);
+ if (parseContextualModifier(127 /* GetKeyword */)) {
+ return parseAccessorDeclaration(node, 159 /* GetAccessor */);
}
- if (parseContextualModifier(137 /* SetKeyword */)) {
- return parseAccessorDeclaration(node, 159 /* SetAccessor */);
+ if (parseContextualModifier(138 /* SetKeyword */)) {
+ return parseAccessorDeclaration(node, 160 /* SetAccessor */);
}
var asteriskToken = parseOptionalToken(40 /* AsteriskToken */);
var tokenIsIdentifier = isIdentifier();
@@ -20741,22 +20898,22 @@
// this is necessary because ObjectLiteral productions are also used to cover grammar for ObjectAssignmentPattern
var isShorthandPropertyAssignment = tokenIsIdentifier && (token() !== 57 /* ColonToken */);
if (isShorthandPropertyAssignment) {
- node.kind = 276 /* ShorthandPropertyAssignment */;
- var equalsToken = parseOptionalToken(59 /* EqualsToken */);
+ node.kind = 277 /* ShorthandPropertyAssignment */;
+ var equalsToken = parseOptionalToken(60 /* EqualsToken */);
if (equalsToken) {
node.equalsToken = equalsToken;
node.objectAssignmentInitializer = allowInAnd(parseAssignmentExpressionOrHigher);
}
}
else {
- node.kind = 275 /* PropertyAssignment */;
+ node.kind = 276 /* PropertyAssignment */;
parseExpected(57 /* ColonToken */);
node.initializer = allowInAnd(parseAssignmentExpressionOrHigher);
}
return finishNode(node);
}
function parseObjectLiteralExpression() {
- var node = createNode(188 /* ObjectLiteralExpression */);
+ var node = createNode(189 /* ObjectLiteralExpression */);
parseExpected(18 /* OpenBraceToken */);
if (scanner.hasPrecedingLineBreak()) {
node.multiLine = true;
@@ -20775,9 +20932,9 @@
if (saveDecoratorContext) {
setDecoratorContext(/*val*/ false);
}
- var node = createNodeWithJSDoc(196 /* FunctionExpression */);
+ var node = createNodeWithJSDoc(197 /* FunctionExpression */);
node.modifiers = parseModifiers();
- parseExpected(90 /* FunctionKeyword */);
+ parseExpected(91 /* FunctionKeyword */);
node.asteriskToken = parseOptionalToken(40 /* AsteriskToken */);
var isGenerator = node.asteriskToken ? 1 /* Yield */ : 0 /* None */;
var isAsync = ts.hasModifier(node, 256 /* Async */) ? 2 /* Await */ : 0 /* None */;
@@ -20798,10 +20955,10 @@
}
function parseNewExpressionOrNewDotTarget() {
var fullStart = scanner.getStartPos();
- parseExpected(95 /* NewKeyword */);
+ parseExpected(96 /* NewKeyword */);
if (parseOptional(24 /* DotToken */)) {
- var node_2 = createNode(214 /* MetaProperty */, fullStart);
- node_2.keywordToken = 95 /* NewKeyword */;
+ var node_2 = createNode(215 /* MetaProperty */, fullStart);
+ node_2.keywordToken = 96 /* NewKeyword */;
node_2.name = parseIdentifierName();
return finishNode(node_2);
}
@@ -20817,7 +20974,7 @@
}
break;
}
- var node = createNode(192 /* NewExpression */, fullStart);
+ var node = createNode(193 /* NewExpression */, fullStart);
node.expression = expression;
node.typeArguments = typeArguments;
if (node.typeArguments || token() === 20 /* OpenParenToken */) {
@@ -20827,7 +20984,7 @@
}
// STATEMENTS
function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) {
- var node = createNode(218 /* Block */);
+ var node = createNode(219 /* Block */);
if (parseExpected(18 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) {
if (scanner.hasPrecedingLineBreak()) {
node.multiLine = true;
@@ -20860,25 +21017,25 @@
return block;
}
function parseEmptyStatement() {
- var node = createNode(220 /* EmptyStatement */);
+ var node = createNode(221 /* EmptyStatement */);
parseExpected(26 /* SemicolonToken */);
return finishNode(node);
}
function parseIfStatement() {
- var node = createNode(222 /* IfStatement */);
- parseExpected(91 /* IfKeyword */);
+ var node = createNode(223 /* IfStatement */);
+ parseExpected(92 /* IfKeyword */);
parseExpected(20 /* OpenParenToken */);
node.expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
node.thenStatement = parseStatement();
- node.elseStatement = parseOptional(83 /* ElseKeyword */) ? parseStatement() : undefined;
+ node.elseStatement = parseOptional(84 /* ElseKeyword */) ? parseStatement() : undefined;
return finishNode(node);
}
function parseDoStatement() {
- var node = createNode(223 /* DoStatement */);
- parseExpected(82 /* DoKeyword */);
+ var node = createNode(224 /* DoStatement */);
+ parseExpected(83 /* DoKeyword */);
node.statement = parseStatement();
- parseExpected(107 /* WhileKeyword */);
+ parseExpected(108 /* WhileKeyword */);
parseExpected(20 /* OpenParenToken */);
node.expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
@@ -20890,8 +21047,8 @@
return finishNode(node);
}
function parseWhileStatement() {
- var node = createNode(224 /* WhileStatement */);
- parseExpected(107 /* WhileKeyword */);
+ var node = createNode(225 /* WhileStatement */);
+ parseExpected(108 /* WhileKeyword */);
parseExpected(20 /* OpenParenToken */);
node.expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
@@ -20900,12 +21057,12 @@
}
function parseForOrForInOrForOfStatement() {
var pos = getNodePos();
- parseExpected(89 /* ForKeyword */);
- var awaitToken = parseOptionalToken(122 /* AwaitKeyword */);
+ parseExpected(90 /* ForKeyword */);
+ var awaitToken = parseOptionalToken(123 /* AwaitKeyword */);
parseExpected(20 /* OpenParenToken */);
var initializer;
if (token() !== 26 /* SemicolonToken */) {
- if (token() === 105 /* VarKeyword */ || token() === 111 /* LetKeyword */ || token() === 77 /* ConstKeyword */) {
+ if (token() === 106 /* VarKeyword */ || token() === 112 /* LetKeyword */ || token() === 78 /* ConstKeyword */) {
initializer = parseVariableDeclarationList(/*inForStatementInitializer*/ true);
}
else {
@@ -20913,23 +21070,23 @@
}
}
var forOrForInOrForOfStatement;
- if (awaitToken ? parseExpected(147 /* OfKeyword */) : parseOptional(147 /* OfKeyword */)) {
- var forOfStatement = createNode(227 /* ForOfStatement */, pos);
+ if (awaitToken ? parseExpected(148 /* OfKeyword */) : parseOptional(148 /* OfKeyword */)) {
+ var forOfStatement = createNode(228 /* ForOfStatement */, pos);
forOfStatement.awaitModifier = awaitToken;
forOfStatement.initializer = initializer;
forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher);
parseExpected(21 /* CloseParenToken */);
forOrForInOrForOfStatement = forOfStatement;
}
- else if (parseOptional(93 /* InKeyword */)) {
- var forInStatement = createNode(226 /* ForInStatement */, pos);
+ else if (parseOptional(94 /* InKeyword */)) {
+ var forInStatement = createNode(227 /* ForInStatement */, pos);
forInStatement.initializer = initializer;
forInStatement.expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
forOrForInOrForOfStatement = forInStatement;
}
else {
- var forStatement = createNode(225 /* ForStatement */, pos);
+ var forStatement = createNode(226 /* ForStatement */, pos);
forStatement.initializer = initializer;
parseExpected(26 /* SemicolonToken */);
if (token() !== 26 /* SemicolonToken */ && token() !== 21 /* CloseParenToken */) {
@@ -20947,7 +21104,7 @@
}
function parseBreakOrContinueStatement(kind) {
var node = createNode(kind);
- parseExpected(kind === 229 /* BreakStatement */ ? 73 /* BreakKeyword */ : 78 /* ContinueKeyword */);
+ parseExpected(kind === 230 /* BreakStatement */ ? 74 /* BreakKeyword */ : 79 /* ContinueKeyword */);
if (!canParseSemicolon()) {
node.label = parseIdentifier();
}
@@ -20955,8 +21112,8 @@
return finishNode(node);
}
function parseReturnStatement() {
- var node = createNode(230 /* ReturnStatement */);
- parseExpected(97 /* ReturnKeyword */);
+ var node = createNode(231 /* ReturnStatement */);
+ parseExpected(98 /* ReturnKeyword */);
if (!canParseSemicolon()) {
node.expression = allowInAnd(parseExpression);
}
@@ -20964,8 +21121,8 @@
return finishNode(node);
}
function parseWithStatement() {
- var node = createNode(231 /* WithStatement */);
- parseExpected(108 /* WithKeyword */);
+ var node = createNode(232 /* WithStatement */);
+ parseExpected(109 /* WithKeyword */);
parseExpected(20 /* OpenParenToken */);
node.expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
@@ -20973,30 +21130,30 @@
return finishNode(node);
}
function parseCaseClause() {
- var node = createNode(271 /* CaseClause */);
- parseExpected(74 /* CaseKeyword */);
+ var node = createNode(272 /* CaseClause */);
+ parseExpected(75 /* CaseKeyword */);
node.expression = allowInAnd(parseExpression);
parseExpected(57 /* ColonToken */);
node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement);
return finishNode(node);
}
function parseDefaultClause() {
- var node = createNode(272 /* DefaultClause */);
- parseExpected(80 /* DefaultKeyword */);
+ var node = createNode(273 /* DefaultClause */);
+ parseExpected(81 /* DefaultKeyword */);
parseExpected(57 /* ColonToken */);
node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement);
return finishNode(node);
}
function parseCaseOrDefaultClause() {
- return token() === 74 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause();
+ return token() === 75 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause();
}
function parseSwitchStatement() {
- var node = createNode(232 /* SwitchStatement */);
- parseExpected(99 /* SwitchKeyword */);
+ var node = createNode(233 /* SwitchStatement */);
+ parseExpected(100 /* SwitchKeyword */);
parseExpected(20 /* OpenParenToken */);
node.expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
- var caseBlock = createNode(246 /* CaseBlock */);
+ var caseBlock = createNode(247 /* CaseBlock */);
parseExpected(18 /* OpenBraceToken */);
caseBlock.clauses = parseList(2 /* SwitchClauses */, parseCaseOrDefaultClause);
parseExpected(19 /* CloseBraceToken */);
@@ -21011,29 +21168,29 @@
// directly as that might consume an expression on the following line.
// We just return 'undefined' in that case. The actual error will be reported in the
// grammar walker.
- var node = createNode(234 /* ThrowStatement */);
- parseExpected(101 /* ThrowKeyword */);
+ var node = createNode(235 /* ThrowStatement */);
+ parseExpected(102 /* ThrowKeyword */);
node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression);
parseSemicolon();
return finishNode(node);
}
// TODO: Review for error recovery
function parseTryStatement() {
- var node = createNode(235 /* TryStatement */);
- parseExpected(103 /* TryKeyword */);
+ var node = createNode(236 /* TryStatement */);
+ parseExpected(104 /* TryKeyword */);
node.tryBlock = parseBlock(/*ignoreMissingOpenBrace*/ false);
- node.catchClause = token() === 75 /* CatchKeyword */ ? parseCatchClause() : undefined;
+ node.catchClause = token() === 76 /* CatchKeyword */ ? parseCatchClause() : undefined;
// If we don't have a catch clause, then we must have a finally clause. Try to parse
// one out no matter what.
- if (!node.catchClause || token() === 88 /* FinallyKeyword */) {
- parseExpected(88 /* FinallyKeyword */);
+ if (!node.catchClause || token() === 89 /* FinallyKeyword */) {
+ parseExpected(89 /* FinallyKeyword */);
node.finallyBlock = parseBlock(/*ignoreMissingOpenBrace*/ false);
}
return finishNode(node);
}
function parseCatchClause() {
- var result = createNode(274 /* CatchClause */);
- parseExpected(75 /* CatchKeyword */);
+ var result = createNode(275 /* CatchClause */);
+ parseExpected(76 /* CatchKeyword */);
if (parseOptional(20 /* OpenParenToken */)) {
result.variableDeclaration = parseVariableDeclaration();
parseExpected(21 /* CloseParenToken */);
@@ -21046,8 +21203,8 @@
return finishNode(result);
}
function parseDebuggerStatement() {
- var node = createNode(236 /* DebuggerStatement */);
- parseExpected(79 /* DebuggerKeyword */);
+ var node = createNode(237 /* DebuggerStatement */);
+ parseExpected(80 /* DebuggerKeyword */);
parseSemicolon();
return finishNode(node);
}
@@ -21057,13 +21214,13 @@
// a colon.
var node = createNodeWithJSDoc(0 /* Unknown */);
var expression = allowInAnd(parseExpression);
- if (expression.kind === 72 /* Identifier */ && parseOptional(57 /* ColonToken */)) {
- node.kind = 233 /* LabeledStatement */;
+ if (expression.kind === 73 /* Identifier */ && parseOptional(57 /* ColonToken */)) {
+ node.kind = 234 /* LabeledStatement */;
node.label = expression;
node.statement = parseStatement();
}
else {
- node.kind = 221 /* ExpressionStatement */;
+ node.kind = 222 /* ExpressionStatement */;
node.expression = expression;
parseSemicolon();
}
@@ -21075,11 +21232,11 @@
}
function nextTokenIsClassKeywordOnSameLine() {
nextToken();
- return token() === 76 /* ClassKeyword */ && !scanner.hasPrecedingLineBreak();
+ return token() === 77 /* ClassKeyword */ && !scanner.hasPrecedingLineBreak();
}
function nextTokenIsFunctionKeywordOnSameLine() {
nextToken();
- return token() === 90 /* FunctionKeyword */ && !scanner.hasPrecedingLineBreak();
+ return token() === 91 /* FunctionKeyword */ && !scanner.hasPrecedingLineBreak();
}
function nextTokenIsIdentifierOrKeywordOrLiteralOnSameLine() {
nextToken();
@@ -21088,12 +21245,12 @@
function isDeclaration() {
while (true) {
switch (token()) {
- case 105 /* VarKeyword */:
- case 111 /* LetKeyword */:
- case 77 /* ConstKeyword */:
- case 90 /* FunctionKeyword */:
- case 76 /* ClassKeyword */:
- case 84 /* EnumKeyword */:
+ case 106 /* VarKeyword */:
+ case 112 /* LetKeyword */:
+ case 78 /* ConstKeyword */:
+ case 91 /* FunctionKeyword */:
+ case 77 /* ClassKeyword */:
+ case 85 /* EnumKeyword */:
return true;
// 'declare', 'module', 'namespace', 'interface'* and 'type' are all legal JavaScript identifiers;
// however, an identifier cannot be followed by another identifier on the same line. This is what we
@@ -21116,41 +21273,41 @@
// I {}
//
// could be legal, it would add complexity for very little gain.
- case 110 /* InterfaceKeyword */:
- case 140 /* TypeKeyword */:
+ case 111 /* InterfaceKeyword */:
+ case 141 /* TypeKeyword */:
return nextTokenIsIdentifierOnSameLine();
- case 130 /* ModuleKeyword */:
- case 131 /* NamespaceKeyword */:
+ case 131 /* ModuleKeyword */:
+ case 132 /* NamespaceKeyword */:
return nextTokenIsIdentifierOrStringLiteralOnSameLine();
- case 118 /* AbstractKeyword */:
- case 121 /* AsyncKeyword */:
- case 125 /* DeclareKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 115 /* PublicKeyword */:
- case 133 /* ReadonlyKeyword */:
+ case 119 /* AbstractKeyword */:
+ case 122 /* AsyncKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 116 /* PublicKeyword */:
+ case 134 /* ReadonlyKeyword */:
nextToken();
// ASI takes effect for this modifier.
if (scanner.hasPrecedingLineBreak()) {
return false;
}
continue;
- case 145 /* GlobalKeyword */:
+ case 146 /* GlobalKeyword */:
nextToken();
- return token() === 18 /* OpenBraceToken */ || token() === 72 /* Identifier */ || token() === 85 /* ExportKeyword */;
- case 92 /* ImportKeyword */:
+ return token() === 18 /* OpenBraceToken */ || token() === 73 /* Identifier */ || token() === 86 /* ExportKeyword */;
+ case 93 /* ImportKeyword */:
nextToken();
return token() === 10 /* StringLiteral */ || token() === 40 /* AsteriskToken */ ||
token() === 18 /* OpenBraceToken */ || ts.tokenIsIdentifierOrKeyword(token());
- case 85 /* ExportKeyword */:
+ case 86 /* ExportKeyword */:
nextToken();
- if (token() === 59 /* EqualsToken */ || token() === 40 /* AsteriskToken */ ||
- token() === 18 /* OpenBraceToken */ || token() === 80 /* DefaultKeyword */ ||
- token() === 119 /* AsKeyword */) {
+ if (token() === 60 /* EqualsToken */ || token() === 40 /* AsteriskToken */ ||
+ token() === 18 /* OpenBraceToken */ || token() === 81 /* DefaultKeyword */ ||
+ token() === 120 /* AsKeyword */) {
return true;
}
continue;
- case 116 /* StaticKeyword */:
+ case 117 /* StaticKeyword */:
nextToken();
continue;
default:
@@ -21166,47 +21323,47 @@
case 58 /* AtToken */:
case 26 /* SemicolonToken */:
case 18 /* OpenBraceToken */:
- case 105 /* VarKeyword */:
- case 111 /* LetKeyword */:
- case 90 /* FunctionKeyword */:
- case 76 /* ClassKeyword */:
- case 84 /* EnumKeyword */:
- case 91 /* IfKeyword */:
- case 82 /* DoKeyword */:
- case 107 /* WhileKeyword */:
- case 89 /* ForKeyword */:
- case 78 /* ContinueKeyword */:
- case 73 /* BreakKeyword */:
- case 97 /* ReturnKeyword */:
- case 108 /* WithKeyword */:
- case 99 /* SwitchKeyword */:
- case 101 /* ThrowKeyword */:
- case 103 /* TryKeyword */:
- case 79 /* DebuggerKeyword */:
+ case 106 /* VarKeyword */:
+ case 112 /* LetKeyword */:
+ case 91 /* FunctionKeyword */:
+ case 77 /* ClassKeyword */:
+ case 85 /* EnumKeyword */:
+ case 92 /* IfKeyword */:
+ case 83 /* DoKeyword */:
+ case 108 /* WhileKeyword */:
+ case 90 /* ForKeyword */:
+ case 79 /* ContinueKeyword */:
+ case 74 /* BreakKeyword */:
+ case 98 /* ReturnKeyword */:
+ case 109 /* WithKeyword */:
+ case 100 /* SwitchKeyword */:
+ case 102 /* ThrowKeyword */:
+ case 104 /* TryKeyword */:
+ case 80 /* DebuggerKeyword */:
// 'catch' and 'finally' do not actually indicate that the code is part of a statement,
// however, we say they are here so that we may gracefully parse them and error later.
- case 75 /* CatchKeyword */:
- case 88 /* FinallyKeyword */:
+ case 76 /* CatchKeyword */:
+ case 89 /* FinallyKeyword */:
return true;
- case 92 /* ImportKeyword */:
+ case 93 /* ImportKeyword */:
return isStartOfDeclaration() || lookAhead(nextTokenIsOpenParenOrLessThanOrDot);
- case 77 /* ConstKeyword */:
- case 85 /* ExportKeyword */:
+ case 78 /* ConstKeyword */:
+ case 86 /* ExportKeyword */:
return isStartOfDeclaration();
- case 121 /* AsyncKeyword */:
- case 125 /* DeclareKeyword */:
- case 110 /* InterfaceKeyword */:
- case 130 /* ModuleKeyword */:
- case 131 /* NamespaceKeyword */:
- case 140 /* TypeKeyword */:
- case 145 /* GlobalKeyword */:
+ case 122 /* AsyncKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 111 /* InterfaceKeyword */:
+ case 131 /* ModuleKeyword */:
+ case 132 /* NamespaceKeyword */:
+ case 141 /* TypeKeyword */:
+ case 146 /* GlobalKeyword */:
// When these don't start a declaration, they're an identifier in an expression statement
return true;
- case 115 /* PublicKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 116 /* StaticKeyword */:
- case 133 /* ReadonlyKeyword */:
+ case 116 /* PublicKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 117 /* StaticKeyword */:
+ case 134 /* ReadonlyKeyword */:
// When these don't start a declaration, they may be the start of a class member if an identifier
// immediately follows. Otherwise they're an identifier in an expression statement.
return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine);
@@ -21229,63 +21386,63 @@
return parseEmptyStatement();
case 18 /* OpenBraceToken */:
return parseBlock(/*ignoreMissingOpenBrace*/ false);
- case 105 /* VarKeyword */:
- return parseVariableStatement(createNodeWithJSDoc(237 /* VariableDeclaration */));
- case 111 /* LetKeyword */:
+ case 106 /* VarKeyword */:
+ return parseVariableStatement(createNodeWithJSDoc(238 /* VariableDeclaration */));
+ case 112 /* LetKeyword */:
if (isLetDeclaration()) {
- return parseVariableStatement(createNodeWithJSDoc(237 /* VariableDeclaration */));
+ return parseVariableStatement(createNodeWithJSDoc(238 /* VariableDeclaration */));
}
break;
- case 90 /* FunctionKeyword */:
- return parseFunctionDeclaration(createNodeWithJSDoc(239 /* FunctionDeclaration */));
- case 76 /* ClassKeyword */:
- return parseClassDeclaration(createNodeWithJSDoc(240 /* ClassDeclaration */));
- case 91 /* IfKeyword */:
+ case 91 /* FunctionKeyword */:
+ return parseFunctionDeclaration(createNodeWithJSDoc(240 /* FunctionDeclaration */));
+ case 77 /* ClassKeyword */:
+ return parseClassDeclaration(createNodeWithJSDoc(241 /* ClassDeclaration */));
+ case 92 /* IfKeyword */:
return parseIfStatement();
- case 82 /* DoKeyword */:
+ case 83 /* DoKeyword */:
return parseDoStatement();
- case 107 /* WhileKeyword */:
+ case 108 /* WhileKeyword */:
return parseWhileStatement();
- case 89 /* ForKeyword */:
+ case 90 /* ForKeyword */:
return parseForOrForInOrForOfStatement();
- case 78 /* ContinueKeyword */:
- return parseBreakOrContinueStatement(228 /* ContinueStatement */);
- case 73 /* BreakKeyword */:
- return parseBreakOrContinueStatement(229 /* BreakStatement */);
- case 97 /* ReturnKeyword */:
+ case 79 /* ContinueKeyword */:
+ return parseBreakOrContinueStatement(229 /* ContinueStatement */);
+ case 74 /* BreakKeyword */:
+ return parseBreakOrContinueStatement(230 /* BreakStatement */);
+ case 98 /* ReturnKeyword */:
return parseReturnStatement();
- case 108 /* WithKeyword */:
+ case 109 /* WithKeyword */:
return parseWithStatement();
- case 99 /* SwitchKeyword */:
+ case 100 /* SwitchKeyword */:
return parseSwitchStatement();
- case 101 /* ThrowKeyword */:
+ case 102 /* ThrowKeyword */:
return parseThrowStatement();
- case 103 /* TryKeyword */:
+ case 104 /* TryKeyword */:
// Include 'catch' and 'finally' for error recovery.
- case 75 /* CatchKeyword */:
- case 88 /* FinallyKeyword */:
+ case 76 /* CatchKeyword */:
+ case 89 /* FinallyKeyword */:
return parseTryStatement();
- case 79 /* DebuggerKeyword */:
+ case 80 /* DebuggerKeyword */:
return parseDebuggerStatement();
case 58 /* AtToken */:
return parseDeclaration();
- case 121 /* AsyncKeyword */:
- case 110 /* InterfaceKeyword */:
- case 140 /* TypeKeyword */:
- case 130 /* ModuleKeyword */:
- case 131 /* NamespaceKeyword */:
- case 125 /* DeclareKeyword */:
- case 77 /* ConstKeyword */:
- case 84 /* EnumKeyword */:
- case 85 /* ExportKeyword */:
- case 92 /* ImportKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 115 /* PublicKeyword */:
- case 118 /* AbstractKeyword */:
- case 116 /* StaticKeyword */:
- case 133 /* ReadonlyKeyword */:
- case 145 /* GlobalKeyword */:
+ case 122 /* AsyncKeyword */:
+ case 111 /* InterfaceKeyword */:
+ case 141 /* TypeKeyword */:
+ case 131 /* ModuleKeyword */:
+ case 132 /* NamespaceKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 78 /* ConstKeyword */:
+ case 85 /* EnumKeyword */:
+ case 86 /* ExportKeyword */:
+ case 93 /* ImportKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 116 /* PublicKeyword */:
+ case 119 /* AbstractKeyword */:
+ case 117 /* StaticKeyword */:
+ case 134 /* ReadonlyKeyword */:
+ case 146 /* GlobalKeyword */:
if (isStartOfDeclaration()) {
return parseDeclaration();
}
@@ -21294,7 +21451,7 @@
return parseExpressionOrLabeledStatement();
}
function isDeclareModifier(modifier) {
- return modifier.kind === 125 /* DeclareKeyword */;
+ return modifier.kind === 126 /* DeclareKeyword */;
}
function parseDeclaration() {
var node = createNodeWithJSDoc(0 /* Unknown */);
@@ -21313,33 +21470,33 @@
}
function parseDeclarationWorker(node) {
switch (token()) {
- case 105 /* VarKeyword */:
- case 111 /* LetKeyword */:
- case 77 /* ConstKeyword */:
+ case 106 /* VarKeyword */:
+ case 112 /* LetKeyword */:
+ case 78 /* ConstKeyword */:
return parseVariableStatement(node);
- case 90 /* FunctionKeyword */:
+ case 91 /* FunctionKeyword */:
return parseFunctionDeclaration(node);
- case 76 /* ClassKeyword */:
+ case 77 /* ClassKeyword */:
return parseClassDeclaration(node);
- case 110 /* InterfaceKeyword */:
+ case 111 /* InterfaceKeyword */:
return parseInterfaceDeclaration(node);
- case 140 /* TypeKeyword */:
+ case 141 /* TypeKeyword */:
return parseTypeAliasDeclaration(node);
- case 84 /* EnumKeyword */:
+ case 85 /* EnumKeyword */:
return parseEnumDeclaration(node);
- case 145 /* GlobalKeyword */:
- case 130 /* ModuleKeyword */:
- case 131 /* NamespaceKeyword */:
+ case 146 /* GlobalKeyword */:
+ case 131 /* ModuleKeyword */:
+ case 132 /* NamespaceKeyword */:
return parseModuleDeclaration(node);
- case 92 /* ImportKeyword */:
+ case 93 /* ImportKeyword */:
return parseImportDeclarationOrImportEqualsDeclaration(node);
- case 85 /* ExportKeyword */:
+ case 86 /* ExportKeyword */:
nextToken();
switch (token()) {
- case 80 /* DefaultKeyword */:
- case 59 /* EqualsToken */:
+ case 81 /* DefaultKeyword */:
+ case 60 /* EqualsToken */:
return parseExportAssignment(node);
- case 119 /* AsKeyword */:
+ case 120 /* AsKeyword */:
return parseNamespaceExportDeclaration(node);
default:
return parseExportDeclaration(node);
@@ -21348,7 +21505,7 @@
if (node.decorators || node.modifiers) {
// We reached this point because we encountered decorators and/or modifiers and assumed a declaration
// would follow. For recovery and error reporting purposes, return an incomplete declaration.
- var missing = createMissingNode(258 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected);
+ var missing = createMissingNode(259 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected);
missing.pos = node.pos;
missing.decorators = node.decorators;
missing.modifiers = node.modifiers;
@@ -21371,16 +21528,16 @@
// DECLARATIONS
function parseArrayBindingElement() {
if (token() === 27 /* CommaToken */) {
- return createNode(210 /* OmittedExpression */);
+ return createNode(211 /* OmittedExpression */);
}
- var node = createNode(186 /* BindingElement */);
+ var node = createNode(187 /* BindingElement */);
node.dotDotDotToken = parseOptionalToken(25 /* DotDotDotToken */);
node.name = parseIdentifierOrPattern();
node.initializer = parseInitializer();
return finishNode(node);
}
function parseObjectBindingElement() {
- var node = createNode(186 /* BindingElement */);
+ var node = createNode(187 /* BindingElement */);
node.dotDotDotToken = parseOptionalToken(25 /* DotDotDotToken */);
var tokenIsIdentifier = isIdentifier();
var propertyName = parsePropertyName();
@@ -21396,14 +21553,14 @@
return finishNode(node);
}
function parseObjectBindingPattern() {
- var node = createNode(184 /* ObjectBindingPattern */);
+ var node = createNode(185 /* ObjectBindingPattern */);
parseExpected(18 /* OpenBraceToken */);
node.elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement);
parseExpected(19 /* CloseBraceToken */);
return finishNode(node);
}
function parseArrayBindingPattern() {
- var node = createNode(185 /* ArrayBindingPattern */);
+ var node = createNode(186 /* ArrayBindingPattern */);
parseExpected(22 /* OpenBracketToken */);
node.elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement);
parseExpected(23 /* CloseBracketToken */);
@@ -21425,9 +21582,9 @@
return parseVariableDeclaration(/*allowExclamation*/ true);
}
function parseVariableDeclaration(allowExclamation) {
- var node = createNode(237 /* VariableDeclaration */);
+ var node = createNode(238 /* VariableDeclaration */);
node.name = parseIdentifierOrPattern();
- if (allowExclamation && node.name.kind === 72 /* Identifier */ &&
+ if (allowExclamation && node.name.kind === 73 /* Identifier */ &&
token() === 52 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) {
node.exclamationToken = parseTokenNode();
}
@@ -21438,14 +21595,14 @@
return finishNode(node);
}
function parseVariableDeclarationList(inForStatementInitializer) {
- var node = createNode(238 /* VariableDeclarationList */);
+ var node = createNode(239 /* VariableDeclarationList */);
switch (token()) {
- case 105 /* VarKeyword */:
+ case 106 /* VarKeyword */:
break;
- case 111 /* LetKeyword */:
+ case 112 /* LetKeyword */:
node.flags |= 1 /* Let */;
break;
- case 77 /* ConstKeyword */:
+ case 78 /* ConstKeyword */:
node.flags |= 2 /* Const */;
break;
default:
@@ -21461,7 +21618,7 @@
// So we need to look ahead to determine if 'of' should be treated as a keyword in
// this context.
// The checker will then give an error that there is an empty declaration list.
- if (token() === 147 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) {
+ if (token() === 148 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) {
node.declarations = createMissingList();
}
else {
@@ -21476,14 +21633,14 @@
return nextTokenIsIdentifier() && nextToken() === 21 /* CloseParenToken */;
}
function parseVariableStatement(node) {
- node.kind = 219 /* VariableStatement */;
+ node.kind = 220 /* VariableStatement */;
node.declarationList = parseVariableDeclarationList(/*inForStatementInitializer*/ false);
parseSemicolon();
return finishNode(node);
}
function parseFunctionDeclaration(node) {
- node.kind = 239 /* FunctionDeclaration */;
- parseExpected(90 /* FunctionKeyword */);
+ node.kind = 240 /* FunctionDeclaration */;
+ parseExpected(91 /* FunctionKeyword */);
node.asteriskToken = parseOptionalToken(40 /* AsteriskToken */);
node.name = ts.hasModifier(node, 512 /* Default */) ? parseOptionalIdentifier() : parseIdentifier();
var isGenerator = node.asteriskToken ? 1 /* Yield */ : 0 /* None */;
@@ -21493,14 +21650,14 @@
return finishNode(node);
}
function parseConstructorDeclaration(node) {
- node.kind = 157 /* Constructor */;
- parseExpected(124 /* ConstructorKeyword */);
+ node.kind = 158 /* Constructor */;
+ parseExpected(125 /* ConstructorKeyword */);
fillSignature(57 /* ColonToken */, 0 /* None */, node);
node.body = parseFunctionBlockOrSemicolon(0 /* None */, ts.Diagnostics.or_expected);
return finishNode(node);
}
function parseMethodDeclaration(node, asteriskToken, diagnosticMessage) {
- node.kind = 156 /* MethodDeclaration */;
+ node.kind = 157 /* MethodDeclaration */;
node.asteriskToken = asteriskToken;
var isGenerator = asteriskToken ? 1 /* Yield */ : 0 /* None */;
var isAsync = ts.hasModifier(node, 256 /* Async */) ? 2 /* Await */ : 0 /* None */;
@@ -21509,7 +21666,7 @@
return finishNode(node);
}
function parsePropertyDeclaration(node) {
- node.kind = 154 /* PropertyDeclaration */;
+ node.kind = 155 /* PropertyDeclaration */;
if (!node.questionToken && token() === 52 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) {
node.exclamationToken = parseTokenNode();
}
@@ -21582,7 +21739,7 @@
// If we were able to get any potential identifier...
if (idToken !== undefined) {
// If we have a non-keyword identifier, or if we have an accessor, then it's safe to parse.
- if (!ts.isKeyword(idToken) || idToken === 137 /* SetKeyword */ || idToken === 126 /* GetKeyword */) {
+ if (!ts.isKeyword(idToken) || idToken === 138 /* SetKeyword */ || idToken === 127 /* GetKeyword */) {
return true;
}
// If it *is* a keyword, but not an accessor, check a little farther along
@@ -21592,7 +21749,7 @@
case 28 /* LessThanToken */: // Generic Method declaration
case 52 /* ExclamationToken */: // Non-null assertion on property name
case 57 /* ColonToken */: // Type Annotation for declaration
- case 59 /* EqualsToken */: // Initializer for declaration
+ case 60 /* EqualsToken */: // Initializer for declaration
case 56 /* QuestionToken */: // Not valid, but permitted so that it gets caught later on.
return true;
default:
@@ -21614,7 +21771,7 @@
if (!parseOptional(58 /* AtToken */)) {
break;
}
- var decorator = createNode(152 /* Decorator */, decoratorStart);
+ var decorator = createNode(153 /* Decorator */, decoratorStart);
decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher);
finishNode(decorator);
(list || (list = [])).push(decorator);
@@ -21634,7 +21791,7 @@
while (true) {
var modifierStart = scanner.getStartPos();
var modifierKind = token();
- if (token() === 77 /* ConstKeyword */ && permitInvalidConstAsModifier) {
+ if (token() === 78 /* ConstKeyword */ && permitInvalidConstAsModifier) {
// We need to ensure that any subsequent modifiers appear on the same line
// so that when 'const' is a standalone declaration, we don't issue an error.
if (!tryParse(nextTokenIsOnSameLineAndCanFollowModifier)) {
@@ -21653,7 +21810,7 @@
}
function parseModifiersForArrowFunction() {
var modifiers;
- if (token() === 121 /* AsyncKeyword */) {
+ if (token() === 122 /* AsyncKeyword */) {
var modifierStart = scanner.getStartPos();
var modifierKind = token();
nextToken();
@@ -21664,20 +21821,20 @@
}
function parseClassElement() {
if (token() === 26 /* SemicolonToken */) {
- var result = createNode(217 /* SemicolonClassElement */);
+ var result = createNode(218 /* SemicolonClassElement */);
nextToken();
return finishNode(result);
}
var node = createNodeWithJSDoc(0 /* Unknown */);
node.decorators = parseDecorators();
node.modifiers = parseModifiers(/*permitInvalidConstAsModifier*/ true);
- if (parseContextualModifier(126 /* GetKeyword */)) {
- return parseAccessorDeclaration(node, 158 /* GetAccessor */);
+ if (parseContextualModifier(127 /* GetKeyword */)) {
+ return parseAccessorDeclaration(node, 159 /* GetAccessor */);
}
- if (parseContextualModifier(137 /* SetKeyword */)) {
- return parseAccessorDeclaration(node, 159 /* SetAccessor */);
+ if (parseContextualModifier(138 /* SetKeyword */)) {
+ return parseAccessorDeclaration(node, 160 /* SetAccessor */);
}
- if (token() === 124 /* ConstructorKeyword */) {
+ if (token() === 125 /* ConstructorKeyword */) {
return parseConstructorDeclaration(node);
}
if (isIndexSignature()) {
@@ -21694,21 +21851,21 @@
}
if (node.decorators || node.modifiers) {
// treat this as a property declaration with a missing name.
- node.name = createMissingNode(72 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected);
+ node.name = createMissingNode(73 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected);
return parsePropertyDeclaration(node);
}
// 'isClassMemberStart' should have hinted not to attempt parsing.
return ts.Debug.fail("Should not have attempted to parse class member declaration.");
}
function parseClassExpression() {
- return parseClassDeclarationOrExpression(createNodeWithJSDoc(0 /* Unknown */), 209 /* ClassExpression */);
+ return parseClassDeclarationOrExpression(createNodeWithJSDoc(0 /* Unknown */), 210 /* ClassExpression */);
}
function parseClassDeclaration(node) {
- return parseClassDeclarationOrExpression(node, 240 /* ClassDeclaration */);
+ return parseClassDeclarationOrExpression(node, 241 /* ClassDeclaration */);
}
function parseClassDeclarationOrExpression(node, kind) {
node.kind = kind;
- parseExpected(76 /* ClassKeyword */);
+ parseExpected(77 /* ClassKeyword */);
node.name = parseNameOfClassDeclarationOrExpression();
node.typeParameters = parseTypeParameters();
node.heritageClauses = parseHeritageClauses();
@@ -21734,7 +21891,7 @@
: undefined;
}
function isImplementsClause() {
- return token() === 109 /* ImplementsKeyword */ && lookAhead(nextTokenIsIdentifierOrKeyword);
+ return token() === 110 /* ImplementsKeyword */ && lookAhead(nextTokenIsIdentifierOrKeyword);
}
function parseHeritageClauses() {
// ClassTail[Yield,Await] : (Modified) See 14.5
@@ -21746,15 +21903,15 @@
}
function parseHeritageClause() {
var tok = token();
- ts.Debug.assert(tok === 86 /* ExtendsKeyword */ || tok === 109 /* ImplementsKeyword */); // isListElement() should ensure this.
- var node = createNode(273 /* HeritageClause */);
+ ts.Debug.assert(tok === 87 /* ExtendsKeyword */ || tok === 110 /* ImplementsKeyword */); // isListElement() should ensure this.
+ var node = createNode(274 /* HeritageClause */);
node.token = tok;
nextToken();
node.types = parseDelimitedList(7 /* HeritageClauseElement */, parseExpressionWithTypeArguments);
return finishNode(node);
}
function parseExpressionWithTypeArguments() {
- var node = createNode(211 /* ExpressionWithTypeArguments */);
+ var node = createNode(212 /* ExpressionWithTypeArguments */);
node.expression = parseLeftHandSideExpressionOrHigher();
node.typeArguments = tryParseTypeArguments();
return finishNode(node);
@@ -21765,14 +21922,14 @@
: undefined;
}
function isHeritageClause() {
- return token() === 86 /* ExtendsKeyword */ || token() === 109 /* ImplementsKeyword */;
+ return token() === 87 /* ExtendsKeyword */ || token() === 110 /* ImplementsKeyword */;
}
function parseClassMembers() {
return parseList(5 /* ClassMembers */, parseClassElement);
}
function parseInterfaceDeclaration(node) {
- node.kind = 241 /* InterfaceDeclaration */;
- parseExpected(110 /* InterfaceKeyword */);
+ node.kind = 242 /* InterfaceDeclaration */;
+ parseExpected(111 /* InterfaceKeyword */);
node.name = parseIdentifier();
node.typeParameters = parseTypeParameters();
node.heritageClauses = parseHeritageClauses();
@@ -21780,11 +21937,11 @@
return finishNode(node);
}
function parseTypeAliasDeclaration(node) {
- node.kind = 242 /* TypeAliasDeclaration */;
- parseExpected(140 /* TypeKeyword */);
+ node.kind = 243 /* TypeAliasDeclaration */;
+ parseExpected(141 /* TypeKeyword */);
node.name = parseIdentifier();
node.typeParameters = parseTypeParameters();
- parseExpected(59 /* EqualsToken */);
+ parseExpected(60 /* EqualsToken */);
node.type = parseType();
parseSemicolon();
return finishNode(node);
@@ -21794,14 +21951,14 @@
// ConstantEnumMemberSection, which starts at the beginning of an enum declaration
// or any time an integer literal initializer is encountered.
function parseEnumMember() {
- var node = createNodeWithJSDoc(278 /* EnumMember */);
+ var node = createNodeWithJSDoc(279 /* EnumMember */);
node.name = parsePropertyName();
node.initializer = allowInAnd(parseInitializer);
return finishNode(node);
}
function parseEnumDeclaration(node) {
- node.kind = 243 /* EnumDeclaration */;
- parseExpected(84 /* EnumKeyword */);
+ node.kind = 244 /* EnumDeclaration */;
+ parseExpected(85 /* EnumKeyword */);
node.name = parseIdentifier();
if (parseExpected(18 /* OpenBraceToken */)) {
node.members = parseDelimitedList(6 /* EnumMembers */, parseEnumMember);
@@ -21813,7 +21970,7 @@
return finishNode(node);
}
function parseModuleBlock() {
- var node = createNode(245 /* ModuleBlock */);
+ var node = createNode(246 /* ModuleBlock */);
if (parseExpected(18 /* OpenBraceToken */)) {
node.statements = parseList(1 /* BlockStatements */, parseStatement);
parseExpected(19 /* CloseBraceToken */);
@@ -21824,7 +21981,7 @@
return finishNode(node);
}
function parseModuleOrNamespaceDeclaration(node, flags) {
- node.kind = 244 /* ModuleDeclaration */;
+ node.kind = 245 /* ModuleDeclaration */;
// If we are parsing a dotted namespace name, we want to
// propagate the 'Namespace' flag across the names if set.
var namespaceFlag = flags & 16 /* Namespace */;
@@ -21836,8 +21993,8 @@
return finishNode(node);
}
function parseAmbientExternalModuleDeclaration(node) {
- node.kind = 244 /* ModuleDeclaration */;
- if (token() === 145 /* GlobalKeyword */) {
+ node.kind = 245 /* ModuleDeclaration */;
+ if (token() === 146 /* GlobalKeyword */) {
// parse 'global' as name of global scope augmentation
node.name = parseIdentifier();
node.flags |= 512 /* GlobalAugmentation */;
@@ -21856,15 +22013,15 @@
}
function parseModuleDeclaration(node) {
var flags = 0;
- if (token() === 145 /* GlobalKeyword */) {
+ if (token() === 146 /* GlobalKeyword */) {
// global augmentation
return parseAmbientExternalModuleDeclaration(node);
}
- else if (parseOptional(131 /* NamespaceKeyword */)) {
+ else if (parseOptional(132 /* NamespaceKeyword */)) {
flags |= 16 /* Namespace */;
}
else {
- parseExpected(130 /* ModuleKeyword */);
+ parseExpected(131 /* ModuleKeyword */);
if (token() === 10 /* StringLiteral */) {
return parseAmbientExternalModuleDeclaration(node);
}
@@ -21872,7 +22029,7 @@
return parseModuleOrNamespaceDeclaration(node, flags);
}
function isExternalModuleReference() {
- return token() === 134 /* RequireKeyword */ &&
+ return token() === 135 /* RequireKeyword */ &&
lookAhead(nextTokenIsOpenParen);
}
function nextTokenIsOpenParen() {
@@ -21882,25 +22039,25 @@
return nextToken() === 42 /* SlashToken */;
}
function parseNamespaceExportDeclaration(node) {
- node.kind = 247 /* NamespaceExportDeclaration */;
- parseExpected(119 /* AsKeyword */);
- parseExpected(131 /* NamespaceKeyword */);
+ node.kind = 248 /* NamespaceExportDeclaration */;
+ parseExpected(120 /* AsKeyword */);
+ parseExpected(132 /* NamespaceKeyword */);
node.name = parseIdentifier();
parseSemicolon();
return finishNode(node);
}
function parseImportDeclarationOrImportEqualsDeclaration(node) {
- parseExpected(92 /* ImportKeyword */);
+ parseExpected(93 /* ImportKeyword */);
var afterImportPos = scanner.getStartPos();
var identifier;
if (isIdentifier()) {
identifier = parseIdentifier();
- if (token() !== 27 /* CommaToken */ && token() !== 144 /* FromKeyword */) {
+ if (token() !== 27 /* CommaToken */ && token() !== 145 /* FromKeyword */) {
return parseImportEqualsDeclaration(node, identifier);
}
}
// Import statement
- node.kind = 249 /* ImportDeclaration */;
+ node.kind = 250 /* ImportDeclaration */;
// ImportDeclaration:
// import ImportClause from ModuleSpecifier ;
// import ModuleSpecifier;
@@ -21908,16 +22065,16 @@
token() === 40 /* AsteriskToken */ || // import *
token() === 18 /* OpenBraceToken */) { // import {
node.importClause = parseImportClause(identifier, afterImportPos);
- parseExpected(144 /* FromKeyword */);
+ parseExpected(145 /* FromKeyword */);
}
node.moduleSpecifier = parseModuleSpecifier();
parseSemicolon();
return finishNode(node);
}
function parseImportEqualsDeclaration(node, identifier) {
- node.kind = 248 /* ImportEqualsDeclaration */;
+ node.kind = 249 /* ImportEqualsDeclaration */;
node.name = identifier;
- parseExpected(59 /* EqualsToken */);
+ parseExpected(60 /* EqualsToken */);
node.moduleReference = parseModuleReference();
parseSemicolon();
return finishNode(node);
@@ -21929,7 +22086,7 @@
// NamedImports
// ImportedDefaultBinding, NameSpaceImport
// ImportedDefaultBinding, NamedImports
- var importClause = createNode(250 /* ImportClause */, fullStart);
+ var importClause = createNode(251 /* ImportClause */, fullStart);
if (identifier) {
// ImportedDefaultBinding:
// ImportedBinding
@@ -21939,7 +22096,7 @@
// parse namespace or named imports
if (!importClause.name ||
parseOptional(27 /* CommaToken */)) {
- importClause.namedBindings = token() === 40 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(252 /* NamedImports */);
+ importClause.namedBindings = token() === 40 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(253 /* NamedImports */);
}
return finishNode(importClause);
}
@@ -21949,8 +22106,8 @@
: parseEntityName(/*allowReservedWords*/ false);
}
function parseExternalModuleReference() {
- var node = createNode(259 /* ExternalModuleReference */);
- parseExpected(134 /* RequireKeyword */);
+ var node = createNode(260 /* ExternalModuleReference */);
+ parseExpected(135 /* RequireKeyword */);
parseExpected(20 /* OpenParenToken */);
node.expression = parseModuleSpecifier();
parseExpected(21 /* CloseParenToken */);
@@ -21972,9 +22129,9 @@
function parseNamespaceImport() {
// NameSpaceImport:
// * as ImportedBinding
- var namespaceImport = createNode(251 /* NamespaceImport */);
+ var namespaceImport = createNode(252 /* NamespaceImport */);
parseExpected(40 /* AsteriskToken */);
- parseExpected(119 /* AsKeyword */);
+ parseExpected(120 /* AsKeyword */);
namespaceImport.name = parseIdentifier();
return finishNode(namespaceImport);
}
@@ -21987,14 +22144,14 @@
// ImportsList:
// ImportSpecifier
// ImportsList, ImportSpecifier
- node.elements = parseBracketedList(23 /* ImportOrExportSpecifiers */, kind === 252 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 18 /* OpenBraceToken */, 19 /* CloseBraceToken */);
+ node.elements = parseBracketedList(23 /* ImportOrExportSpecifiers */, kind === 253 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 18 /* OpenBraceToken */, 19 /* CloseBraceToken */);
return finishNode(node);
}
function parseExportSpecifier() {
- return parseImportOrExportSpecifier(257 /* ExportSpecifier */);
+ return parseImportOrExportSpecifier(258 /* ExportSpecifier */);
}
function parseImportSpecifier() {
- return parseImportOrExportSpecifier(253 /* ImportSpecifier */);
+ return parseImportOrExportSpecifier(254 /* ImportSpecifier */);
}
function parseImportOrExportSpecifier(kind) {
var node = createNode(kind);
@@ -22008,9 +22165,9 @@
var checkIdentifierStart = scanner.getTokenPos();
var checkIdentifierEnd = scanner.getTextPos();
var identifierName = parseIdentifierName();
- if (token() === 119 /* AsKeyword */) {
+ if (token() === 120 /* AsKeyword */) {
node.propertyName = identifierName;
- parseExpected(119 /* AsKeyword */);
+ parseExpected(120 /* AsKeyword */);
checkIdentifierIsKeyword = ts.isKeyword(token()) && !isIdentifier();
checkIdentifierStart = scanner.getTokenPos();
checkIdentifierEnd = scanner.getTextPos();
@@ -22019,24 +22176,24 @@
else {
node.name = identifierName;
}
- if (kind === 253 /* ImportSpecifier */ && checkIdentifierIsKeyword) {
+ if (kind === 254 /* ImportSpecifier */ && checkIdentifierIsKeyword) {
parseErrorAt(checkIdentifierStart, checkIdentifierEnd, ts.Diagnostics.Identifier_expected);
}
return finishNode(node);
}
function parseExportDeclaration(node) {
- node.kind = 255 /* ExportDeclaration */;
+ node.kind = 256 /* ExportDeclaration */;
if (parseOptional(40 /* AsteriskToken */)) {
- parseExpected(144 /* FromKeyword */);
+ parseExpected(145 /* FromKeyword */);
node.moduleSpecifier = parseModuleSpecifier();
}
else {
- node.exportClause = parseNamedImportsOrExports(256 /* NamedExports */);
+ node.exportClause = parseNamedImportsOrExports(257 /* NamedExports */);
// It is not uncommon to accidentally omit the 'from' keyword. Additionally, in editing scenarios,
// the 'from' keyword can be parsed as a named export when the export clause is unterminated (i.e. `export { from "moduleName";`)
// If we don't have a 'from' keyword, see if we have a string literal such that ASI won't take effect.
- if (token() === 144 /* FromKeyword */ || (token() === 10 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) {
- parseExpected(144 /* FromKeyword */);
+ if (token() === 145 /* FromKeyword */ || (token() === 10 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) {
+ parseExpected(145 /* FromKeyword */);
node.moduleSpecifier = parseModuleSpecifier();
}
}
@@ -22044,12 +22201,12 @@
return finishNode(node);
}
function parseExportAssignment(node) {
- node.kind = 254 /* ExportAssignment */;
- if (parseOptional(59 /* EqualsToken */)) {
+ node.kind = 255 /* ExportAssignment */;
+ if (parseOptional(60 /* EqualsToken */)) {
node.isExportEquals = true;
}
else {
- parseExpected(80 /* DefaultKeyword */);
+ parseExpected(81 /* DefaultKeyword */);
}
node.expression = parseAssignmentExpressionOrHigher();
parseSemicolon();
@@ -22064,10 +22221,10 @@
}
function isAnExternalModuleIndicatorNode(node) {
return ts.hasModifier(node, 1 /* Export */)
- || node.kind === 248 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 259 /* ExternalModuleReference */
- || node.kind === 249 /* ImportDeclaration */
- || node.kind === 254 /* ExportAssignment */
- || node.kind === 255 /* ExportDeclaration */
+ || node.kind === 249 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 260 /* ExternalModuleReference */
+ || node.kind === 250 /* ImportDeclaration */
+ || node.kind === 255 /* ExportAssignment */
+ || node.kind === 256 /* ExportDeclaration */
? node
: undefined;
}
@@ -22080,7 +22237,7 @@
return isImportMeta(node) ? node : forEachChild(node, walkTreeForExternalModuleIndicators);
}
function isImportMeta(node) {
- return ts.isMetaProperty(node) && node.keywordToken === 92 /* ImportKeyword */ && node.name.escapedText === "meta";
+ return ts.isMetaProperty(node) && node.keywordToken === 93 /* ImportKeyword */ && node.name.escapedText === "meta";
}
var ParsingContext;
(function (ParsingContext) {
@@ -22119,8 +22276,8 @@
var JSDocParser;
(function (JSDocParser) {
function parseJSDocTypeExpressionForTests(content, start, length) {
- initializeState(content, 7 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
- sourceFile = createSourceFile("file.js", 7 /* Latest */, 1 /* JS */, /*isDeclarationFile*/ false);
+ initializeState(content, 8 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
+ sourceFile = createSourceFile("file.js", 8 /* Latest */, 1 /* JS */, /*isDeclarationFile*/ false);
scanner.setText(content, start, length);
currentToken = scanner.scan();
var jsDocTypeExpression = parseJSDocTypeExpression();
@@ -22131,18 +22288,18 @@
JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests;
// Parses out a JSDoc type expression.
function parseJSDocTypeExpression(mayOmitBraces) {
- var result = createNode(288 /* JSDocTypeExpression */);
+ var result = createNode(289 /* JSDocTypeExpression */);
var hasBrace = (mayOmitBraces ? parseOptional : parseExpected)(18 /* OpenBraceToken */);
result.type = doInsideOfContext(2097152 /* JSDoc */, parseJSDocType);
if (!mayOmitBraces || hasBrace) {
- parseExpected(19 /* CloseBraceToken */);
+ parseExpectedJSDoc(19 /* CloseBraceToken */);
}
fixupParentReferences(result);
return finishNode(result);
}
JSDocParser.parseJSDocTypeExpression = parseJSDocTypeExpression;
function parseIsolatedJSDocComment(content, start, length) {
- initializeState(content, 7 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
+ initializeState(content, 8 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
sourceFile = { languageVariant: 0 /* Standard */, text: content }; // tslint:disable-line no-object-literal-type-assertion
var jsDoc = parseJSDocCommentWorker(start, length);
var diagnostics = parseDiagnostics;
@@ -22214,7 +22371,7 @@
comments.push(text);
indent += text.length;
}
- nextJSDocToken();
+ nextTokenJSDoc();
while (parseOptionalJsdoc(5 /* WhitespaceTrivia */))
;
if (parseOptionalJsdoc(4 /* NewLineTrivia */)) {
@@ -22232,7 +22389,6 @@
// for malformed examples like `/** @param {string} x @returns {number} the length */`
state = 0 /* BeginningOfLine */;
margin = undefined;
- indent++;
}
else {
pushComment(scanner.getTokenText());
@@ -22277,7 +22433,7 @@
pushComment(scanner.getTokenText());
break;
}
- nextJSDocToken();
+ nextTokenJSDoc();
}
removeLeadingNewlines(comments);
removeTrailingWhitespace(comments);
@@ -22294,7 +22450,7 @@
}
}
function createJSDocComment() {
- var result = createNode(296 /* JSDocComment */, start);
+ var result = createNode(297 /* JSDocComment */, start);
result.tags = tags && createNodeArray(tags, tagsPos, tagsEnd);
result.comment = comments.length ? comments.join("") : undefined;
return finishNode(result, end);
@@ -22302,7 +22458,7 @@
function isNextNonwhitespaceTokenEndOfFile() {
// We must use infinite lookahead, as there could be any number of newlines :(
while (true) {
- nextJSDocToken();
+ nextTokenJSDoc();
if (token() === 1 /* EndOfFileToken */) {
return true;
}
@@ -22318,32 +22474,38 @@
}
}
while (token() === 5 /* WhitespaceTrivia */ || token() === 4 /* NewLineTrivia */) {
- nextJSDocToken();
+ nextTokenJSDoc();
}
}
function skipWhitespaceOrAsterisk() {
if (token() === 5 /* WhitespaceTrivia */ || token() === 4 /* NewLineTrivia */) {
if (lookAhead(isNextNonwhitespaceTokenEndOfFile)) {
- return; // Don't skip whitespace prior to EoF (or end of comment) - that shouldn't be included in any node's range
+ return ""; // Don't skip whitespace prior to EoF (or end of comment) - that shouldn't be included in any node's range
}
}
var precedingLineBreak = scanner.hasPrecedingLineBreak();
+ var seenLineBreak = false;
+ var indentText = "";
while ((precedingLineBreak && token() === 40 /* AsteriskToken */) || token() === 5 /* WhitespaceTrivia */ || token() === 4 /* NewLineTrivia */) {
+ indentText += scanner.getTokenText();
if (token() === 4 /* NewLineTrivia */) {
precedingLineBreak = true;
+ seenLineBreak = true;
+ indentText = "";
}
else if (token() === 40 /* AsteriskToken */) {
precedingLineBreak = false;
}
- nextJSDocToken();
+ nextTokenJSDoc();
}
+ return seenLineBreak ? indentText : "";
}
- function parseTag(indent) {
+ function parseTag(margin) {
ts.Debug.assert(token() === 58 /* AtToken */);
var start = scanner.getTokenPos();
- nextJSDocToken();
+ nextTokenJSDoc();
var tagName = parseJSDocIdentifierName(/*message*/ undefined);
- skipWhitespaceOrAsterisk();
+ var indentText = skipWhitespaceOrAsterisk();
var tag;
switch (tagName.escapedText) {
case "augments":
@@ -22363,7 +22525,7 @@
case "arg":
case "argument":
case "param":
- return parseParameterOrPropertyTag(start, tagName, 2 /* Parameter */, indent);
+ return parseParameterOrPropertyTag(start, tagName, 2 /* Parameter */, margin);
case "return":
case "returns":
tag = parseReturnTag(start, tagName);
@@ -22375,10 +22537,10 @@
tag = parseTypeTag(start, tagName);
break;
case "typedef":
- tag = parseTypedefTag(start, tagName, indent);
+ tag = parseTypedefTag(start, tagName, margin);
break;
case "callback":
- tag = parseCallbackTag(start, tagName, indent);
+ tag = parseCallbackTag(start, tagName, margin);
break;
default:
tag = parseUnknownTag(start, tagName);
@@ -22386,11 +22548,14 @@
}
if (!tag.comment) {
// some tags, like typedef and callback, have already parsed their comments earlier
- tag.comment = parseTagComments(indent + tag.end - tag.pos);
+ if (!indentText) {
+ margin += tag.end - tag.pos;
+ }
+ tag.comment = parseTagComments(margin, indentText.slice(margin));
}
return tag;
}
- function parseTagComments(indent) {
+ function parseTagComments(indent, initialMargin) {
var comments = [];
var state = 0 /* BeginningOfLine */;
var margin;
@@ -22401,6 +22566,11 @@
comments.push(text);
indent += text.length;
}
+ if (initialMargin) {
+ // jump straight to saving comments if there is some initial indentation
+ pushComment(initialMargin);
+ state = 2 /* SavingComments */;
+ }
var tok = token();
loop: while (true) {
switch (tok) {
@@ -22425,18 +22595,18 @@
var whitespace = scanner.getTokenText();
// if the whitespace crosses the margin, take only the whitespace that passes the margin
if (margin !== undefined && indent + whitespace.length > margin) {
- comments.push(whitespace.slice(margin - indent - 1));
+ comments.push(whitespace.slice(margin - indent));
}
indent += whitespace.length;
}
break;
case 18 /* OpenBraceToken */:
state = 2 /* SavingComments */;
- if (lookAhead(function () { return nextJSDocToken() === 58 /* AtToken */ && ts.tokenIsIdentifierOrKeyword(nextJSDocToken()) && scanner.getTokenText() === "link"; })) {
+ if (lookAhead(function () { return nextTokenJSDoc() === 58 /* AtToken */ && ts.tokenIsIdentifierOrKeyword(nextTokenJSDoc()) && scanner.getTokenText() === "link"; })) {
pushComment(scanner.getTokenText());
- nextJSDocToken();
+ nextTokenJSDoc();
pushComment(scanner.getTokenText());
- nextJSDocToken();
+ nextTokenJSDoc();
}
pushComment(scanner.getTokenText());
break;
@@ -22454,14 +22624,14 @@
pushComment(scanner.getTokenText());
break;
}
- tok = nextJSDocToken();
+ tok = nextTokenJSDoc();
}
removeLeadingNewlines(comments);
removeTrailingWhitespace(comments);
return comments.length === 0 ? undefined : comments.join("");
}
function parseUnknownTag(start, tagName) {
- var result = createNode(299 /* JSDocTag */, start);
+ var result = createNode(300 /* JSDocTag */, start);
result.tagName = tagName;
return finishNode(result);
}
@@ -22483,17 +22653,21 @@
return token() === 18 /* OpenBraceToken */ ? parseJSDocTypeExpression() : undefined;
}
function parseBracketNameInPropertyAndParamTag() {
- if (token() === 14 /* NoSubstitutionTemplateLiteral */) {
- // a markdown-quoted name: `arg` is not legal jsdoc, but occurs in the wild
- return { name: createIdentifier(/*isIdentifier*/ true), isBracketed: false };
- }
// Looking for something like '[foo]', 'foo', '[foo.bar]' or 'foo.bar'
- var isBracketed = parseOptional(22 /* OpenBracketToken */);
+ var isBracketed = parseOptionalJsdoc(22 /* OpenBracketToken */);
+ if (isBracketed) {
+ skipWhitespace();
+ }
+ // a markdown-quoted name: `arg` is not legal jsdoc, but occurs in the wild
+ var isBackquoted = parseOptionalJsdoc(59 /* BacktickToken */);
var name = parseJSDocEntityName();
+ if (isBackquoted) {
+ parseExpectedTokenJSDoc(59 /* BacktickToken */);
+ }
if (isBracketed) {
skipWhitespace();
// May have an optional default, e.g. '[foo = 42]'
- if (parseOptionalToken(59 /* EqualsToken */)) {
+ if (parseOptionalToken(60 /* EqualsToken */)) {
parseExpression();
}
parseExpected(23 /* CloseBracketToken */);
@@ -22502,9 +22676,9 @@
}
function isObjectOrObjectArrayTypeReference(node) {
switch (node.kind) {
- case 136 /* ObjectKeyword */:
+ case 137 /* ObjectKeyword */:
return true;
- case 169 /* ArrayType */:
+ case 170 /* ArrayType */:
return isObjectOrObjectArrayTypeReference(node.elementType);
default:
return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText === "Object";
@@ -22520,8 +22694,8 @@
typeExpression = tryParseTypeExpression();
}
var result = target === 1 /* Property */ ?
- createNode(310 /* JSDocPropertyTag */, start) :
- createNode(304 /* JSDocParameterTag */, start);
+ createNode(311 /* JSDocPropertyTag */, start) :
+ createNode(305 /* JSDocParameterTag */, start);
var comment = parseTagComments(indent + scanner.getStartPos() - start);
var nestedTypeLiteral = target !== 4 /* CallbackParameter */ && parseNestedTypeLiteral(typeExpression, name, target, indent);
if (nestedTypeLiteral) {
@@ -22538,20 +22712,20 @@
}
function parseNestedTypeLiteral(typeExpression, name, target, indent) {
if (typeExpression && isObjectOrObjectArrayTypeReference(typeExpression.type)) {
- var typeLiteralExpression = createNode(288 /* JSDocTypeExpression */, scanner.getTokenPos());
+ var typeLiteralExpression = createNode(289 /* JSDocTypeExpression */, scanner.getTokenPos());
var child = void 0;
var jsdocTypeLiteral = void 0;
var start_2 = scanner.getStartPos();
var children = void 0;
while (child = tryParse(function () { return parseChildParameterOrPropertyTag(target, indent, name); })) {
- if (child.kind === 304 /* JSDocParameterTag */ || child.kind === 310 /* JSDocPropertyTag */) {
+ if (child.kind === 305 /* JSDocParameterTag */ || child.kind === 311 /* JSDocPropertyTag */) {
children = ts.append(children, child);
}
}
if (children) {
- jsdocTypeLiteral = createNode(297 /* JSDocTypeLiteral */, start_2);
+ jsdocTypeLiteral = createNode(298 /* JSDocTypeLiteral */, start_2);
jsdocTypeLiteral.jsDocPropertyTags = children;
- if (typeExpression.type.kind === 169 /* ArrayType */) {
+ if (typeExpression.type.kind === 170 /* ArrayType */) {
jsdocTypeLiteral.isArrayType = true;
}
typeLiteralExpression.type = finishNode(jsdocTypeLiteral);
@@ -22560,32 +22734,32 @@
}
}
function parseReturnTag(start, tagName) {
- if (ts.forEach(tags, function (t) { return t.kind === 305 /* JSDocReturnTag */; })) {
+ if (ts.some(tags, ts.isJSDocReturnTag)) {
parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText);
}
- var result = createNode(305 /* JSDocReturnTag */, start);
+ var result = createNode(306 /* JSDocReturnTag */, start);
result.tagName = tagName;
result.typeExpression = tryParseTypeExpression();
return finishNode(result);
}
function parseTypeTag(start, tagName) {
- if (ts.forEach(tags, function (t) { return t.kind === 307 /* JSDocTypeTag */; })) {
+ if (ts.some(tags, ts.isJSDocTypeTag)) {
parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText);
}
- var result = createNode(307 /* JSDocTypeTag */, start);
+ var result = createNode(308 /* JSDocTypeTag */, start);
result.tagName = tagName;
result.typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true);
return finishNode(result);
}
function parseAugmentsTag(start, tagName) {
- var result = createNode(300 /* JSDocAugmentsTag */, start);
+ var result = createNode(301 /* JSDocAugmentsTag */, start);
result.tagName = tagName;
result.class = parseExpressionWithTypeArgumentsForAugments();
return finishNode(result);
}
function parseExpressionWithTypeArgumentsForAugments() {
var usedBrace = parseOptional(18 /* OpenBraceToken */);
- var node = createNode(211 /* ExpressionWithTypeArguments */);
+ var node = createNode(212 /* ExpressionWithTypeArguments */);
node.expression = parsePropertyAccessEntityNameExpression();
node.typeArguments = tryParseTypeArguments();
var res = finishNode(node);
@@ -22597,7 +22771,7 @@
function parsePropertyAccessEntityNameExpression() {
var node = parseJSDocIdentifierName();
while (parseOptional(24 /* DotToken */)) {
- var prop = createNode(189 /* PropertyAccessExpression */, node.pos);
+ var prop = createNode(190 /* PropertyAccessExpression */, node.pos);
prop.expression = node;
prop.name = parseJSDocIdentifierName();
node = finishNode(prop);
@@ -22605,19 +22779,19 @@
return node;
}
function parseClassTag(start, tagName) {
- var tag = createNode(301 /* JSDocClassTag */, start);
+ var tag = createNode(302 /* JSDocClassTag */, start);
tag.tagName = tagName;
return finishNode(tag);
}
function parseThisTag(start, tagName) {
- var tag = createNode(306 /* JSDocThisTag */, start);
+ var tag = createNode(307 /* JSDocThisTag */, start);
tag.tagName = tagName;
tag.typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true);
skipWhitespace();
return finishNode(tag);
}
function parseEnumTag(start, tagName) {
- var tag = createNode(303 /* JSDocEnumTag */, start);
+ var tag = createNode(304 /* JSDocEnumTag */, start);
tag.tagName = tagName;
tag.typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true);
skipWhitespace();
@@ -22626,7 +22800,7 @@
function parseTypedefTag(start, tagName, indent) {
var typeExpression = tryParseTypeExpression();
skipWhitespaceOrAsterisk();
- var typedefTag = createNode(309 /* JSDocTypedefTag */, start);
+ var typedefTag = createNode(310 /* JSDocTypedefTag */, start);
typedefTag.tagName = tagName;
typedefTag.fullName = parseJSDocTypeNameWithNamespace();
typedefTag.name = getJSDocTypeAliasName(typedefTag.fullName);
@@ -22640,9 +22814,9 @@
var childTypeTag = void 0;
while (child = tryParse(function () { return parseChildPropertyTag(indent); })) {
if (!jsdocTypeLiteral) {
- jsdocTypeLiteral = createNode(297 /* JSDocTypeLiteral */, start);
+ jsdocTypeLiteral = createNode(298 /* JSDocTypeLiteral */, start);
}
- if (child.kind === 307 /* JSDocTypeTag */) {
+ if (child.kind === 308 /* JSDocTypeTag */) {
if (childTypeTag) {
break;
}
@@ -22655,7 +22829,7 @@
}
}
if (jsdocTypeLiteral) {
- if (typeExpression && typeExpression.type.kind === 169 /* ArrayType */) {
+ if (typeExpression && typeExpression.type.kind === 170 /* ArrayType */) {
jsdocTypeLiteral.isArrayType = true;
}
typedefTag.typeExpression = childTypeTag && childTypeTag.typeExpression && !isObjectOrObjectArrayTypeReference(childTypeTag.typeExpression.type) ?
@@ -22674,7 +22848,7 @@
}
var typeNameOrNamespaceName = parseJSDocIdentifierName();
if (parseOptional(24 /* DotToken */)) {
- var jsDocNamespaceNode = createNode(244 /* ModuleDeclaration */, pos);
+ var jsDocNamespaceNode = createNode(245 /* ModuleDeclaration */, pos);
if (nested) {
jsDocNamespaceNode.flags |= 4 /* NestedNamespace */;
}
@@ -22688,14 +22862,14 @@
return typeNameOrNamespaceName;
}
function parseCallbackTag(start, tagName, indent) {
- var callbackTag = createNode(302 /* JSDocCallbackTag */, start);
+ var callbackTag = createNode(303 /* JSDocCallbackTag */, start);
callbackTag.tagName = tagName;
callbackTag.fullName = parseJSDocTypeNameWithNamespace();
callbackTag.name = getJSDocTypeAliasName(callbackTag.fullName);
skipWhitespace();
callbackTag.comment = parseTagComments(indent);
var child;
- var jsdocSignature = createNode(298 /* JSDocSignature */, start);
+ var jsdocSignature = createNode(299 /* JSDocSignature */, start);
jsdocSignature.parameters = [];
while (child = tryParse(function () { return parseChildParameterOrPropertyTag(4 /* CallbackParameter */, indent); })) {
jsdocSignature.parameters = ts.append(jsdocSignature.parameters, child);
@@ -22703,7 +22877,7 @@
var returnTag = tryParse(function () {
if (parseOptionalJsdoc(58 /* AtToken */)) {
var tag = parseTag(indent);
- if (tag && tag.kind === 305 /* JSDocReturnTag */) {
+ if (tag && tag.kind === 306 /* JSDocReturnTag */) {
return tag;
}
}
@@ -22744,11 +22918,11 @@
var canParseTag = true;
var seenAsterisk = false;
while (true) {
- switch (nextJSDocToken()) {
+ switch (nextTokenJSDoc()) {
case 58 /* AtToken */:
if (canParseTag) {
var child = tryParseChildTag(target, indent);
- if (child && (child.kind === 304 /* JSDocParameterTag */ || child.kind === 310 /* JSDocPropertyTag */) &&
+ if (child && (child.kind === 305 /* JSDocParameterTag */ || child.kind === 311 /* JSDocPropertyTag */) &&
target !== 4 /* CallbackParameter */ &&
name && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) {
return false;
@@ -22767,7 +22941,7 @@
}
seenAsterisk = true;
break;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
canParseTag = false;
break;
case 1 /* EndOfFileToken */:
@@ -22778,7 +22952,7 @@
function tryParseChildTag(target, indent) {
ts.Debug.assert(token() === 58 /* AtToken */);
var start = scanner.getStartPos();
- nextJSDocToken();
+ nextTokenJSDoc();
var tagName = parseJSDocIdentifierName();
skipWhitespace();
var t;
@@ -22812,25 +22986,22 @@
var typeParametersPos = getNodePos();
do {
skipWhitespace();
- var typeParameter = createNode(150 /* TypeParameter */);
+ var typeParameter = createNode(151 /* TypeParameter */);
typeParameter.name = parseJSDocIdentifierName(ts.Diagnostics.Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces);
finishNode(typeParameter);
skipWhitespace();
typeParameters.push(typeParameter);
} while (parseOptionalJsdoc(27 /* CommaToken */));
- var result = createNode(308 /* JSDocTemplateTag */, start);
+ var result = createNode(309 /* JSDocTemplateTag */, start);
result.tagName = tagName;
result.constraint = constraint;
result.typeParameters = createNodeArray(typeParameters, typeParametersPos);
finishNode(result);
return result;
}
- function nextJSDocToken() {
- return currentToken = scanner.scanJSDocToken();
- }
function parseOptionalJsdoc(t) {
if (token() === t) {
- nextJSDocToken();
+ nextTokenJSDoc();
return true;
}
return false;
@@ -22854,14 +23025,14 @@
}
function parseJSDocIdentifierName(message) {
if (!ts.tokenIsIdentifierOrKeyword(token())) {
- return createMissingNode(72 /* Identifier */, /*reportAtCurrentPosition*/ !message, message || ts.Diagnostics.Identifier_expected);
+ return createMissingNode(73 /* Identifier */, /*reportAtCurrentPosition*/ !message, message || ts.Diagnostics.Identifier_expected);
}
var pos = scanner.getTokenPos();
var end = scanner.getTextPos();
- var result = createNode(72 /* Identifier */, pos);
+ var result = createNode(73 /* Identifier */, pos);
result.escapedText = ts.escapeLeadingUnderscores(scanner.getTokenText());
finishNode(result, end);
- nextJSDocToken();
+ nextTokenJSDoc();
return result;
}
}
@@ -22986,7 +23157,7 @@
switch (node.kind) {
case 10 /* StringLiteral */:
case 8 /* NumericLiteral */:
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return true;
}
return false;
@@ -23353,28 +23524,16 @@
ts.isDeclarationFileName = isDeclarationFileName;
/*@internal*/
function processCommentPragmas(context, sourceText) {
- var triviaScanner = ts.createScanner(context.languageVersion, /*skipTrivia*/ false, 0 /* Standard */, sourceText);
var pragmas = [];
- // Keep scanning all the leading trivia in the file until we get to something that
- // isn't trivia. Any single line comment will be analyzed to see if it is a
- // reference comment.
- while (true) {
- var kind = triviaScanner.scan();
- if (!ts.isTrivia(kind)) {
- break;
- }
- var range = {
- kind: triviaScanner.getToken(),
- pos: triviaScanner.getTokenPos(),
- end: triviaScanner.getTextPos(),
- };
+ for (var _i = 0, _a = ts.getLeadingCommentRanges(sourceText, 0) || ts.emptyArray; _i < _a.length; _i++) {
+ var range = _a[_i];
var comment = sourceText.substring(range.pos, range.end);
extractPragmas(pragmas, range, comment);
}
context.pragmas = ts.createMap();
- for (var _i = 0, pragmas_1 = pragmas; _i < pragmas_1.length; _i++) {
- var pragma = pragmas_1[_i];
- if (context.pragmas.has(pragma.name)) { // TODO: GH#18217
+ for (var _b = 0, pragmas_1 = pragmas; _b < pragmas_1.length; _b++) {
+ var pragma = pragmas_1[_b];
+ if (context.pragmas.has(pragma.name)) {
var currentValue = context.pragmas.get(pragma.name);
if (currentValue instanceof Array) {
currentValue.push(pragma.args);
@@ -23405,7 +23564,6 @@
var typeReferenceDirectives_1 = context.typeReferenceDirectives;
var libReferenceDirectives_1 = context.libReferenceDirectives;
ts.forEach(ts.toArray(entryOrList), function (arg) {
- // TODO: GH#18217
var _a = arg.arguments, types = _a.types, lib = _a.lib, path = _a.path;
if (arg.arguments["no-default-lib"]) {
context.hasNoDefaultLib = true;
@@ -23426,7 +23584,7 @@
break;
}
case "amd-dependency": {
- context.amdDependencies = ts.map(ts.toArray(entryOrList), function (x) { return ({ name: x.arguments.name, path: x.arguments.path }); }); // TODO: GH#18217
+ context.amdDependencies = ts.map(ts.toArray(entryOrList), function (x) { return ({ name: x.arguments.name, path: x.arguments.path }); });
break;
}
case "amd-module": {
@@ -23449,7 +23607,7 @@
case "ts-check": {
// _last_ of either nocheck or check in a file is the "winner"
ts.forEach(ts.toArray(entryOrList), function (entry) {
- if (!context.checkJsDirective || entry.range.pos > context.checkJsDirective.pos) { // TODO: GH#18217
+ if (!context.checkJsDirective || entry.range.pos > context.checkJsDirective.pos) {
context.checkJsDirective = {
enabled: key === "ts-check",
end: entry.range.end,
@@ -23565,10 +23723,10 @@
if (lhs.kind !== rhs.kind) {
return false;
}
- if (lhs.kind === 72 /* Identifier */) {
+ if (lhs.kind === 73 /* Identifier */) {
return lhs.escapedText === rhs.escapedText;
}
- if (lhs.kind === 100 /* ThisKeyword */) {
+ if (lhs.kind === 101 /* ThisKeyword */) {
return true;
}
// If we are at this statement then we must have PropertyAccessExpression and because tag name in Jsx element can only
@@ -23597,6 +23755,7 @@
["es2017", "lib.es2017.d.ts"],
["es2018", "lib.es2018.d.ts"],
["es2019", "lib.es2019.d.ts"],
+ ["es2020", "lib.es2020.d.ts"],
["esnext", "lib.esnext.d.ts"],
// Host only
["dom", "lib.dom.d.ts"],
@@ -23625,8 +23784,11 @@
["es2018.promise", "lib.es2018.promise.d.ts"],
["es2018.regexp", "lib.es2018.regexp.d.ts"],
["es2019.array", "lib.es2019.array.d.ts"],
+ ["es2019.object", "lib.es2019.object.d.ts"],
["es2019.string", "lib.es2019.string.d.ts"],
["es2019.symbol", "lib.es2019.symbol.d.ts"],
+ ["es2020.string", "lib.es2020.string.d.ts"],
+ ["es2020.symbol.wellknown", "lib.es2020.symbol.wellknown.d.ts"],
["esnext.array", "lib.es2019.array.d.ts"],
["esnext.symbol", "lib.es2019.symbol.d.ts"],
["esnext.asynciterable", "lib.es2018.asynciterable.d.ts"],
@@ -23713,6 +23875,13 @@
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Show_verbose_diagnostic_information
},
+ {
+ name: "incremental",
+ shortName: "i",
+ type: "boolean",
+ category: ts.Diagnostics.Basic_Options,
+ description: ts.Diagnostics.Enable_incremental_compilation,
+ },
];
/* @internal */
ts.optionDeclarations = ts.commonOptionsWithBuild.concat([
@@ -23776,10 +23945,12 @@
es2017: 4 /* ES2017 */,
es2018: 5 /* ES2018 */,
es2019: 6 /* ES2019 */,
- esnext: 7 /* ESNext */,
+ es2020: 7 /* ES2020 */,
+ esnext: 8 /* ESNext */,
}),
affectsSourceFile: true,
affectsModuleResolution: true,
+ affectsEmit: true,
paramType: ts.Diagnostics.VERSION,
showInSimplifiedHelpView: true,
category: ts.Diagnostics.Basic_Options,
@@ -23847,6 +24018,7 @@
name: "declaration",
shortName: "d",
type: "boolean",
+ affectsEmit: true,
showInSimplifiedHelpView: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Generates_corresponding_d_ts_file,
@@ -23854,6 +24026,7 @@
{
name: "declarationMap",
type: "boolean",
+ affectsEmit: true,
showInSimplifiedHelpView: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Generates_a_sourcemap_for_each_corresponding_d_ts_file,
@@ -23861,12 +24034,14 @@
{
name: "emitDeclarationOnly",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Only_emit_d_ts_declaration_files,
},
{
name: "sourceMap",
type: "boolean",
+ affectsEmit: true,
showInSimplifiedHelpView: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Generates_corresponding_map_file,
@@ -23874,6 +24049,7 @@
{
name: "outFile",
type: "string",
+ affectsEmit: true,
isFilePath: true,
paramType: ts.Diagnostics.FILE,
showInSimplifiedHelpView: true,
@@ -23883,6 +24059,7 @@
{
name: "outDir",
type: "string",
+ affectsEmit: true,
isFilePath: true,
paramType: ts.Diagnostics.DIRECTORY,
showInSimplifiedHelpView: true,
@@ -23892,6 +24069,7 @@
{
name: "rootDir",
type: "string",
+ affectsEmit: true,
isFilePath: true,
paramType: ts.Diagnostics.LOCATION,
category: ts.Diagnostics.Basic_Options,
@@ -23900,29 +24078,24 @@
{
name: "composite",
type: "boolean",
+ affectsEmit: true,
isTSConfigOnly: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Enable_project_compilation,
},
{
- name: "incremental",
- type: "boolean",
- isTSConfigOnly: true,
- category: ts.Diagnostics.Basic_Options,
- description: ts.Diagnostics.Enable_incremental_compilation,
- },
- {
name: "tsBuildInfoFile",
type: "string",
+ affectsEmit: true,
isFilePath: true,
paramType: ts.Diagnostics.FILE,
- isTSConfigOnly: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Specify_file_to_store_incremental_compilation_information,
},
{
name: "removeComments",
type: "boolean",
+ affectsEmit: true,
showInSimplifiedHelpView: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Do_not_emit_comments_to_output,
@@ -23930,6 +24103,7 @@
{
name: "noEmit",
type: "boolean",
+ affectsEmit: true,
showInSimplifiedHelpView: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Do_not_emit_outputs,
@@ -23937,12 +24111,14 @@
{
name: "importHelpers",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Import_emit_helpers_from_tslib
},
{
name: "downlevelIteration",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3
},
@@ -24146,10 +24322,18 @@
category: ts.Diagnostics.Module_Resolution_Options,
description: ts.Diagnostics.Do_not_resolve_the_real_path_of_symlinks,
},
+ {
+ name: "allowUmdGlobalAccess",
+ type: "boolean",
+ affectsSemanticDiagnostics: true,
+ category: ts.Diagnostics.Module_Resolution_Options,
+ description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
+ },
// Source Maps
{
name: "sourceRoot",
type: "string",
+ affectsEmit: true,
paramType: ts.Diagnostics.LOCATION,
category: ts.Diagnostics.Source_Map_Options,
description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations,
@@ -24157,6 +24341,7 @@
{
name: "mapRoot",
type: "string",
+ affectsEmit: true,
paramType: ts.Diagnostics.LOCATION,
category: ts.Diagnostics.Source_Map_Options,
description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
@@ -24164,12 +24349,14 @@
{
name: "inlineSourceMap",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Source_Map_Options,
description: ts.Diagnostics.Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file
},
{
name: "inlineSources",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Source_Map_Options,
description: ts.Diagnostics.Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap_to_be_set
},
@@ -24202,6 +24389,7 @@
{
name: "out",
type: "string",
+ affectsEmit: true,
isFilePath: false,
// for correct behaviour, please use outFile
category: ts.Diagnostics.Advanced_Options,
@@ -24211,6 +24399,7 @@
{
name: "reactNamespace",
type: "string",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react_JSX_emit
},
@@ -24229,6 +24418,7 @@
{
name: "emitBOM",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files
},
@@ -24244,6 +24434,7 @@
crlf: 0 /* CarriageReturnLineFeed */,
lf: 1 /* LineFeed */
}),
+ affectsEmit: true,
paramType: ts.Diagnostics.NEWLINE,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix,
@@ -24271,6 +24462,7 @@
{
name: "stripInternal",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation,
},
@@ -24291,24 +24483,28 @@
{
name: "noEmitHelpers",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Do_not_generate_custom_helper_functions_like_extends_in_compiled_output
},
{
name: "noEmitOnError",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported,
},
{
name: "preserveConstEnums",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code
},
{
name: "declarationDir",
type: "string",
+ affectsEmit: true,
isFilePath: true,
paramType: ts.Diagnostics.DIRECTORY,
category: ts.Diagnostics.Advanced_Options,
@@ -24391,6 +24587,8 @@
/* @internal */
ts.semanticDiagnosticsOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsSemanticDiagnostics; });
/* @internal */
+ ts.affectsEmitOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsEmit; });
+ /* @internal */
ts.moduleResolutionOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsModuleResolution; });
/* @internal */
ts.sourceFileAffectingCompilerOptions = ts.optionDeclarations.filter(function (option) {
@@ -24798,7 +24996,7 @@
/**
* Reads the config file, reports errors if any and exits if the config file cannot be found
*/
- function getParsedCommandLineOfConfigFile(configFileName, optionsToExtend, host) {
+ function getParsedCommandLineOfConfigFile(configFileName, optionsToExtend, host, extendedConfigCache) {
var configFileText;
try {
configFileText = host.readFile(configFileName);
@@ -24818,7 +25016,9 @@
result.path = ts.toPath(configFileName, cwd, ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames));
result.resolvedPath = result.path;
result.originalFileName = result.fileName;
- return parseJsonSourceFileConfigFileContent(result, host, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), cwd), optionsToExtend, ts.getNormalizedAbsolutePath(configFileName, cwd));
+ return parseJsonSourceFileConfigFileContent(result, host, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), cwd), optionsToExtend, ts.getNormalizedAbsolutePath(configFileName, cwd),
+ /*resolutionStack*/ undefined,
+ /*extraFileExtension*/ undefined, extendedConfigCache);
}
ts.getParsedCommandLineOfConfigFile = getParsedCommandLineOfConfigFile;
/**
@@ -24957,7 +25157,7 @@
var result = returnValue ? {} : undefined;
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var element = _a[_i];
- if (element.kind !== 275 /* PropertyAssignment */) {
+ if (element.kind !== 276 /* PropertyAssignment */) {
errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected));
continue;
}
@@ -25013,13 +25213,13 @@
}
function convertPropertyValueToJson(valueExpression, option) {
switch (valueExpression.kind) {
- case 102 /* TrueKeyword */:
+ case 103 /* TrueKeyword */:
reportInvalidOptionValue(option && option.type !== "boolean");
return true;
- case 87 /* FalseKeyword */:
+ case 88 /* FalseKeyword */:
reportInvalidOptionValue(option && option.type !== "boolean");
return false;
- case 96 /* NullKeyword */:
+ case 97 /* NullKeyword */:
reportInvalidOptionValue(option && option.name === "extends"); // "extends" is the only option we don't allow null/undefined for
return null; // tslint:disable-line:no-null-keyword
case 10 /* StringLiteral */:
@@ -25039,13 +25239,13 @@
case 8 /* NumericLiteral */:
reportInvalidOptionValue(option && option.type !== "number");
return Number(valueExpression.text);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
if (valueExpression.operator !== 39 /* MinusToken */ || valueExpression.operand.kind !== 8 /* NumericLiteral */) {
break; // not valid JSON syntax
}
reportInvalidOptionValue(option && option.type !== "number");
return -Number(valueExpression.operand.text);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
reportInvalidOptionValue(option && option.type !== "object");
var objectLiteralExpression = valueExpression;
// Currently having element option declaration in the tsconfig with type "object"
@@ -25062,7 +25262,7 @@
return convertObjectLiteralExpressionToJson(objectLiteralExpression, /* knownOptions*/ undefined,
/*extraKeyDiagnosticMessage */ undefined, /*parentOption*/ undefined);
}
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
reportInvalidOptionValue(option && option.type !== "list");
return convertArrayLiteralExpressionToJson(valueExpression.elements, option && option.element);
}
@@ -25318,8 +25518,8 @@
* @param basePath A root directory to resolve relative path entries in the config
* file to. e.g. outDir
*/
- function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) {
- return parseJsonConfigFileContentWorker(json, /*sourceFile*/ undefined, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions);
+ function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache) {
+ return parseJsonConfigFileContentWorker(json, /*sourceFile*/ undefined, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache);
}
ts.parseJsonConfigFileContent = parseJsonConfigFileContent;
/**
@@ -25329,8 +25529,8 @@
* @param basePath A root directory to resolve relative path entries in the config
* file to. e.g. outDir
*/
- function parseJsonSourceFileConfigFileContent(sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) {
- return parseJsonConfigFileContentWorker(/*json*/ undefined, sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions);
+ function parseJsonSourceFileConfigFileContent(sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache) {
+ return parseJsonConfigFileContentWorker(/*json*/ undefined, sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache);
}
ts.parseJsonSourceFileConfigFileContent = parseJsonSourceFileConfigFileContent;
/*@internal*/
@@ -25358,13 +25558,13 @@
* file to. e.g. outDir
* @param resolutionStack Only present for backwards-compatibility. Should be empty.
*/
- function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) {
+ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache) {
if (existingOptions === void 0) { existingOptions = {}; }
if (resolutionStack === void 0) { resolutionStack = []; }
if (extraFileExtensions === void 0) { extraFileExtensions = []; }
ts.Debug.assert((json === undefined && sourceFile !== undefined) || (json !== undefined && sourceFile === undefined));
var errors = [];
- var parsedConfig = parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors);
+ var parsedConfig = parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors, extendedConfigCache);
var raw = parsedConfig.raw;
var options = ts.extend(existingOptions, parsedConfig.options || {});
options.configFilePath = configFileName && ts.normalizeSlashes(configFileName);
@@ -25504,7 +25704,7 @@
* This *just* extracts options/include/exclude/files out of a config file.
* It does *not* resolve the included files.
*/
- function parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors) {
+ function parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors, extendedConfigCache) {
basePath = ts.normalizeSlashes(basePath);
var resolvedPath = ts.getNormalizedAbsolutePath(configFileName || "", basePath);
if (resolutionStack.indexOf(resolvedPath) >= 0) {
@@ -25517,7 +25717,7 @@
if (ownConfig.extendedConfigPath) {
// copy the resolution stack so it is never reused between branches in potential diamond-problem scenarios.
resolutionStack = resolutionStack.concat([resolvedPath]);
- var extendedConfig = getExtendedConfig(sourceFile, ownConfig.extendedConfigPath, host, basePath, resolutionStack, errors);
+ var extendedConfig = getExtendedConfig(sourceFile, ownConfig.extendedConfigPath, host, basePath, resolutionStack, errors, extendedConfigCache);
if (extendedConfig && isSuccessfulParsedTsconfig(extendedConfig)) {
var baseRaw_1 = extendedConfig.raw;
var raw_1 = ownConfig.raw;
@@ -25614,7 +25814,7 @@
if (!host.fileExists(extendedConfigPath) && !ts.endsWith(extendedConfigPath, ".json" /* Json */)) {
extendedConfigPath = extendedConfigPath + ".json";
if (!host.fileExists(extendedConfigPath)) {
- errors.push(createDiagnostic(ts.Diagnostics.File_0_does_not_exist, extendedConfig));
+ errors.push(createDiagnostic(ts.Diagnostics.File_0_not_found, extendedConfig));
return undefined;
}
}
@@ -25625,24 +25825,23 @@
if (resolved.resolvedModule) {
return resolved.resolvedModule.resolvedFileName;
}
- errors.push(createDiagnostic(ts.Diagnostics.File_0_does_not_exist, extendedConfig));
+ errors.push(createDiagnostic(ts.Diagnostics.File_0_not_found, extendedConfig));
return undefined;
}
- function getExtendedConfig(sourceFile, extendedConfigPath, host, basePath, resolutionStack, errors) {
+ function getExtendedConfig(sourceFile, extendedConfigPath, host, basePath, resolutionStack, errors, extendedConfigCache) {
var _a;
- var extendedResult = readJsonConfigFile(extendedConfigPath, function (path) { return host.readFile(path); });
- if (sourceFile) {
- sourceFile.extendedSourceFiles = [extendedResult.fileName];
- }
- if (extendedResult.parseDiagnostics.length) {
- errors.push.apply(errors, extendedResult.parseDiagnostics);
- return undefined;
+ var path = host.useCaseSensitiveFileNames ? extendedConfigPath : ts.toLowerCase(extendedConfigPath);
+ var value;
+ var extendedResult;
+ var extendedConfig;
+ if (extendedConfigCache && (value = extendedConfigCache.get(path))) {
+ (extendedResult = value.extendedResult, extendedConfig = value.extendedConfig);
}
+ else {
+ extendedResult = readJsonConfigFile(extendedConfigPath, function (path) { return host.readFile(path); });
+ if (!extendedResult.parseDiagnostics.length) {
var extendedDirname = ts.getDirectoryPath(extendedConfigPath);
- var extendedConfig = parseConfig(/*json*/ undefined, extendedResult, host, extendedDirname, ts.getBaseFileName(extendedConfigPath), resolutionStack, errors);
- if (sourceFile && extendedResult.extendedSourceFiles) {
- (_a = sourceFile.extendedSourceFiles).push.apply(_a, extendedResult.extendedSourceFiles);
- }
+ extendedConfig = parseConfig(/*json*/ undefined, extendedResult, host, extendedDirname, ts.getBaseFileName(extendedConfigPath), resolutionStack, errors, extendedConfigCache);
if (isSuccessfulParsedTsconfig(extendedConfig)) {
// Update the paths to reflect base path
var relativeDifference_1 = ts.convertToRelativePath(extendedDirname, basePath, ts.identity);
@@ -25657,6 +25856,21 @@
mapPropertiesInRawIfNotUndefined("exclude");
mapPropertiesInRawIfNotUndefined("files");
}
+ }
+ if (extendedConfigCache) {
+ extendedConfigCache.set(path, { extendedResult: extendedResult, extendedConfig: extendedConfig });
+ }
+ }
+ if (sourceFile) {
+ sourceFile.extendedSourceFiles = [extendedResult.fileName];
+ if (extendedResult.extendedSourceFiles) {
+ (_a = sourceFile.extendedSourceFiles).push.apply(_a, extendedResult.extendedSourceFiles);
+ }
+ }
+ if (extendedResult.parseDiagnostics.length) {
+ errors.push.apply(errors, extendedResult.parseDiagnostics);
+ return undefined;
+ }
return extendedConfig;
}
function convertCompileOnSaveOptionFromJson(jsonOption, basePath, errors) {
@@ -26126,11 +26340,22 @@
return !!compilerOptions.traceResolution && host.trace !== undefined;
}
ts.isTraceEnabled = isTraceEnabled;
- function withPackageId(packageId, r) {
+ function withPackageId(packageInfo, r) {
+ var packageId;
+ if (r && packageInfo) {
+ var packageJsonContent = packageInfo.packageJsonContent;
+ if (typeof packageJsonContent.name === "string" && typeof packageJsonContent.version === "string") {
+ packageId = {
+ name: packageJsonContent.name,
+ subModuleName: r.path.slice(packageInfo.packageDirectory.length + ts.directorySeparator.length),
+ version: packageJsonContent.version
+ };
+ }
+ }
return r && { path: r.path, extension: r.ext, packageId: packageId };
}
function noPackageId(r) {
- return withPackageId(/*packageId*/ undefined, r);
+ return withPackageId(/*packageInfo*/ undefined, r);
}
function removeIgnoredPackageId(r) {
if (r) {
@@ -26182,8 +26407,15 @@
}
function readPackageJsonPathField(jsonContent, fieldName, baseDirectory, state) {
var fileName = readPackageJsonField(jsonContent, fieldName, "string", state);
- if (fileName === undefined)
+ if (fileName === undefined) {
return;
+ }
+ if (!fileName) {
+ if (state.traceEnabled) {
+ trace(state.host, ts.Diagnostics.package_json_had_a_falsy_0_field, fieldName);
+ }
+ return;
+ }
var path = ts.normalizePath(ts.combinePaths(baseDirectory, fileName));
if (state.traceEnabled) {
trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, fileName, path);
@@ -26336,8 +26568,13 @@
var fileName = resolved.fileName, packageId = resolved.packageId;
var resolvedFileName = options.preserveSymlinks ? fileName : realPath(fileName, host, traceEnabled);
if (traceEnabled) {
+ if (packageId) {
+ trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3, typeReferenceDirectiveName, resolvedFileName, ts.packageIdToString(packageId), primary);
+ }
+ else {
trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolvedFileName, primary);
}
+ }
resolvedTypeReferenceDirective = { primary: primary, resolvedFileName: resolvedFileName, packageId: packageId, isExternalLibraryImport: pathContainsNodeModules(fileName) };
}
return { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations };
@@ -26438,20 +26675,28 @@
return result;
}
ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames;
- function createModuleResolutionCache(currentDirectory, getCanonicalFileName) {
- return createModuleResolutionCacheWithMaps(createCacheWithRedirects(), createCacheWithRedirects(), currentDirectory, getCanonicalFileName);
+ function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options) {
+ return createModuleResolutionCacheWithMaps(createCacheWithRedirects(options), createCacheWithRedirects(options), currentDirectory, getCanonicalFileName);
}
ts.createModuleResolutionCache = createModuleResolutionCache;
/*@internal*/
- function createCacheWithRedirects() {
+ function createCacheWithRedirects(options) {
var ownMap = ts.createMap();
var redirectsMap = ts.createMap();
return {
ownMap: ownMap,
redirectsMap: redirectsMap,
getOrCreateMapOfCacheRedirects: getOrCreateMapOfCacheRedirects,
- clear: clear
+ clear: clear,
+ setOwnOptions: setOwnOptions,
+ setOwnMap: setOwnMap
};
+ function setOwnOptions(newOptions) {
+ options = newOptions;
+ }
+ function setOwnMap(newOwnMap) {
+ ownMap = newOwnMap;
+ }
function getOrCreateMapOfCacheRedirects(redirectedReference) {
if (!redirectedReference) {
return ownMap;
@@ -26459,7 +26704,8 @@
var path = redirectedReference.sourceFile.path;
var redirects = redirectsMap.get(path);
if (!redirects) {
- redirects = ts.createMap();
+ // Reuse map if redirected reference map uses same resolution
+ redirects = !options || ts.optionsHaveModuleResolutionChanges(options, redirectedReference.commandLine.options) ? ts.createMap() : ownMap;
redirectsMap.set(path, redirects);
}
return redirects;
@@ -26472,7 +26718,7 @@
ts.createCacheWithRedirects = createCacheWithRedirects;
/*@internal*/
function createModuleResolutionCacheWithMaps(directoryToModuleNameMap, moduleNameToDirectoryMap, currentDirectory, getCanonicalFileName) {
- return { getOrCreateCacheForDirectory: getOrCreateCacheForDirectory, getOrCreateCacheForModuleName: getOrCreateCacheForModuleName };
+ return { getOrCreateCacheForDirectory: getOrCreateCacheForDirectory, getOrCreateCacheForModuleName: getOrCreateCacheForModuleName, directoryToModuleNameMap: directoryToModuleNameMap, moduleNameToDirectoryMap: moduleNameToDirectoryMap };
function getOrCreateCacheForDirectory(directoryName, redirectedReference) {
var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName);
return getOrCreateCache(directoryToModuleNameMap, redirectedReference, path, ts.createMap);
@@ -26615,8 +26861,13 @@
}
if (traceEnabled) {
if (result.resolvedModule) {
+ if (result.resolvedModule.packageId) {
+ trace(host, ts.Diagnostics.Module_name_0_was_successfully_resolved_to_1_with_Package_ID_2, moduleName, result.resolvedModule.resolvedFileName, ts.packageIdToString(result.resolvedModule.packageId));
+ }
+ else {
trace(host, ts.Diagnostics.Module_name_0_was_successfully_resolved_to_1, moduleName, result.resolvedModule.resolvedFileName);
}
+ }
else {
trace(host, ts.Diagnostics.Module_name_0_was_not_resolved, moduleName);
}
@@ -26885,10 +27136,9 @@
}
var resolvedFromFile = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state);
if (resolvedFromFile) {
- var nm = considerPackageJson ? parseNodeModuleFromPath(resolvedFromFile) : undefined;
- var packageInfo = nm && getPackageJsonInfo(nm.packageDirectory, nm.subModuleName, /*onlyRecordFailures*/ false, state);
- var packageId = packageInfo && packageInfo.packageId;
- return withPackageId(packageId, resolvedFromFile);
+ var packageDirectory = considerPackageJson ? parseNodeModuleFromPath(resolvedFromFile) : undefined;
+ var packageInfo = packageDirectory ? getPackageJsonInfo(packageDirectory, /*onlyRecordFailures*/ false, state) : undefined;
+ return withPackageId(packageInfo, resolvedFromFile);
}
}
if (!onlyRecordFailures) {
@@ -26914,11 +27164,10 @@
* (Not neeeded for `loadModuleFromNodeModules` as that looks up the `package.json` as part of resolution.)
*
* packageDirectory is the directory of the package itself.
- * subModuleName is the path within the package.
- * For `blah/node_modules/foo/index.d.ts` this is { packageDirectory: "foo", subModuleName: "index.d.ts" }. (Part before "/node_modules/" is ignored.)
- * For `/node_modules/foo/bar.d.ts` this is { packageDirectory: "foo", subModuleName": "bar/index.d.ts" }.
- * For `/node_modules/@types/foo/bar/index.d.ts` this is { packageDirectory: "@types/foo", subModuleName: "bar/index.d.ts" }.
- * For `/node_modules/foo/bar/index.d.ts` this is { packageDirectory: "foo", subModuleName": "bar/index.d.ts" }.
+ * For `blah/node_modules/foo/index.d.ts` this is packageDirectory: "foo"
+ * For `/node_modules/foo/bar.d.ts` this is packageDirectory: "foo"
+ * For `/node_modules/@types/foo/bar/index.d.ts` this is packageDirectory: "@types/foo"
+ * For `/node_modules/foo/bar/index.d.ts` this is packageDirectory: "foo"
*/
function parseNodeModuleFromPath(resolved) {
var path = ts.normalizePath(resolved.path);
@@ -26931,26 +27180,12 @@
if (path.charCodeAt(indexAfterNodeModules) === 64 /* at */) {
indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterPackageName);
}
- var packageDirectory = path.slice(0, indexAfterPackageName);
- var subModuleName = ts.removeExtension(path.slice(indexAfterPackageName + 1), resolved.ext) + ".d.ts" /* Dts */;
- return { packageDirectory: packageDirectory, subModuleName: subModuleName };
+ return path.slice(0, indexAfterPackageName);
}
function moveToNextDirectorySeparatorIfAvailable(path, prevSeparatorIndex) {
var nextSeparatorIndex = path.indexOf(ts.directorySeparator, prevSeparatorIndex + 1);
return nextSeparatorIndex === -1 ? prevSeparatorIndex : nextSeparatorIndex;
}
- function addExtensionAndIndex(path) {
- if (path === "") {
- return "index.d.ts";
- }
- if (ts.endsWith(path, ".d.ts")) {
- return path;
- }
- if (path === "index" || ts.endsWith(path, "/index")) {
- return path + ".d.ts";
- }
- return path + "/index.d.ts";
- }
function loadModuleFromFileNoPackageId(extensions, candidate, onlyRecordFailures, state) {
return noPackageId(loadModuleFromFile(extensions, candidate, onlyRecordFailures, state));
}
@@ -27024,52 +27259,22 @@
}
function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson) {
if (considerPackageJson === void 0) { considerPackageJson = true; }
- var packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, "", onlyRecordFailures, state) : undefined;
- var packageId = packageInfo && packageInfo.packageId;
+ var packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, onlyRecordFailures, state) : undefined;
var packageJsonContent = packageInfo && packageInfo.packageJsonContent;
- var versionPaths = packageJsonContent && readPackageJsonTypesVersionPaths(packageJsonContent, state);
- return withPackageId(packageId, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths));
+ var versionPaths = packageInfo && packageInfo.versionPaths;
+ return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths));
}
- function getPackageJsonInfo(packageDirectory, subModuleName, onlyRecordFailures, state) {
+ function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
var host = state.host, traceEnabled = state.traceEnabled;
var directoryExists = !onlyRecordFailures && ts.directoryProbablyExists(packageDirectory, host);
var packageJsonPath = ts.combinePaths(packageDirectory, "package.json");
if (directoryExists && host.fileExists(packageJsonPath)) {
var packageJsonContent = ts.readJson(packageJsonPath, host);
- if (subModuleName === "") { // looking up the root - need to handle types/typings/main redirects for subModuleName
- var path = readPackageJsonTypesFields(packageJsonContent, packageDirectory, state);
- if (typeof path === "string") {
- subModuleName = addExtensionAndIndex(path.substring(packageDirectory.length + 1));
- }
- else {
- var jsPath = readPackageJsonMainField(packageJsonContent, packageDirectory, state);
- if (typeof jsPath === "string" && jsPath.length > packageDirectory.length) {
- var potentialSubModule_1 = jsPath.substring(packageDirectory.length + 1);
- subModuleName = (ts.forEach(ts.supportedJSExtensions, function (extension) {
- return ts.tryRemoveExtension(potentialSubModule_1, extension);
- }) || potentialSubModule_1) + ".d.ts" /* Dts */;
- }
- else {
- subModuleName = "index.d.ts";
- }
- }
- }
- if (!ts.endsWith(subModuleName, ".d.ts" /* Dts */)) {
- subModuleName = addExtensionAndIndex(subModuleName);
- }
- var versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state);
- var packageId = typeof packageJsonContent.name === "string" && typeof packageJsonContent.version === "string"
- ? { name: packageJsonContent.name, subModuleName: subModuleName, version: packageJsonContent.version }
- : undefined;
if (traceEnabled) {
- if (packageId) {
- trace(host, ts.Diagnostics.Found_package_json_at_0_Package_ID_is_1, packageJsonPath, ts.packageIdToString(packageId));
- }
- else {
trace(host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath);
}
- }
- return { packageJsonContent: packageJsonContent, packageId: packageId, versionPaths: versionPaths };
+ var versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state);
+ return { packageDirectory: packageDirectory, packageJsonContent: packageJsonContent, versionPaths: versionPaths };
}
else {
if (directoryExists && traceEnabled) {
@@ -27208,37 +27413,31 @@
function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state) {
var candidate = ts.normalizePath(ts.combinePaths(nodeModulesDirectory, moduleName));
// First look for a nested package.json, as in `node_modules/foo/bar/package.json`.
- var packageJsonContent;
- var packageId;
- var versionPaths;
- var packageInfo = getPackageJsonInfo(candidate, "", !nodeModulesDirectoryExists, state);
+ var packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state);
if (packageInfo) {
- (packageJsonContent = packageInfo.packageJsonContent, packageId = packageInfo.packageId, versionPaths = packageInfo.versionPaths);
var fromFile = loadModuleFromFile(extensions, candidate, !nodeModulesDirectoryExists, state);
if (fromFile) {
return noPackageId(fromFile);
}
- var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageJsonContent, versionPaths);
- return withPackageId(packageId, fromDirectory);
+ var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageInfo.packageJsonContent, packageInfo.versionPaths);
+ return withPackageId(packageInfo, fromDirectory);
}
var loader = function (extensions, candidate, onlyRecordFailures, state) {
var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) ||
- loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths);
- return withPackageId(packageId, pathAndExtension);
+ loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.packageJsonContent, packageInfo && packageInfo.versionPaths);
+ return withPackageId(packageInfo, pathAndExtension);
};
var _a = parsePackageName(moduleName), packageName = _a.packageName, rest = _a.rest;
if (rest !== "") { // If "rest" is empty, we just did this search above.
var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName);
// Don't use a "types" or "main" from here because we're not loading the root, but a subdirectory -- just here for the packageId and path mappings.
- var packageInfo_1 = getPackageJsonInfo(packageDirectory, rest, !nodeModulesDirectoryExists, state);
- if (packageInfo_1)
- (packageId = packageInfo_1.packageId, versionPaths = packageInfo_1.versionPaths);
- if (versionPaths) {
+ packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state);
+ if (packageInfo && packageInfo.versionPaths) {
if (state.traceEnabled) {
- trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, versionPaths.version, ts.version, rest);
+ trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.versionPaths.version, ts.version, rest);
}
var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host);
- var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, versionPaths.paths, loader, !packageDirectoryExists, state);
+ var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.versionPaths.paths, loader, !packageDirectoryExists, state);
if (fromPaths) {
return fromPaths.value;
}
@@ -27406,24 +27605,24 @@
// A module is uninstantiated if it contains only
switch (node.kind) {
// 1. interface declarations, type alias declarations
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return 0 /* NonInstantiated */;
// 2. const enum declarations
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
if (ts.isEnumConst(node)) {
return 2 /* ConstEnumOnly */;
}
break;
// 3. non-exported import declarations
- case 249 /* ImportDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
if (!(ts.hasModifier(node, 1 /* Export */))) {
return 0 /* NonInstantiated */;
}
break;
// 4. other uninstantiated module declarations.
- case 245 /* ModuleBlock */: {
+ case 246 /* ModuleBlock */: {
var state_1 = 0 /* NonInstantiated */;
ts.forEachChild(node, function (n) {
var childState = getModuleInstanceStateWorker(n);
@@ -27445,9 +27644,9 @@
});
return state_1;
}
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return getModuleInstanceState(node);
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
// Only jsdoc typedef definition can exist in jsdoc namespace, and it should
// be considered the same as type alias
if (node.isInJSDocNamespace) {
@@ -27613,7 +27812,7 @@
// Should not be called on a declaration with a computed property name,
// unless it is a well known Symbol.
function getDeclarationName(node) {
- if (node.kind === 254 /* ExportAssignment */) {
+ if (node.kind === 255 /* ExportAssignment */) {
return node.isExportEquals ? "export=" /* ExportEquals */ : "default" /* Default */;
}
var name = ts.getNameOfDeclaration(node);
@@ -27622,7 +27821,7 @@
var moduleName = ts.getTextOfIdentifierOrLiteral(name);
return (ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + moduleName + "\"");
}
- if (name.kind === 149 /* ComputedPropertyName */) {
+ if (name.kind === 150 /* ComputedPropertyName */) {
var nameExpression = name.expression;
// treat computed property names where expression is string/numeric literal as just string/numeric literal
if (ts.isStringOrNumericLiteralLike(nameExpression)) {
@@ -27634,36 +27833,36 @@
return ts.isPropertyNameLiteral(name) ? ts.getEscapedTextOfIdentifierOrLiteral(name) : undefined;
}
switch (node.kind) {
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return "__constructor" /* Constructor */;
- case 165 /* FunctionType */:
- case 160 /* CallSignature */:
- case 298 /* JSDocSignature */:
+ case 166 /* FunctionType */:
+ case 161 /* CallSignature */:
+ case 299 /* JSDocSignature */:
return "__call" /* Call */;
- case 166 /* ConstructorType */:
- case 161 /* ConstructSignature */:
+ case 167 /* ConstructorType */:
+ case 162 /* ConstructSignature */:
return "__new" /* New */;
- case 162 /* IndexSignature */:
+ case 163 /* IndexSignature */:
return "__index" /* Index */;
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return "__export" /* ExportStar */;
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
// json file should behave as
// module.exports = ...
return "export=" /* ExportEquals */;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
if (ts.getAssignmentDeclarationKind(node) === 2 /* ModuleExports */) {
// module.exports = ...
return "export=" /* ExportEquals */;
}
ts.Debug.fail("Unknown binary declaration kind");
break;
- case 294 /* JSDocFunctionType */:
+ case 295 /* JSDocFunctionType */:
return (ts.isJSDocConstructSignature(node) ? "__new" /* New */ : "__call" /* Call */);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
// Parameters with names are handled at the top of this function. Parameters
// without names can only come from JSDocFunctionTypes.
- ts.Debug.assert(node.parent.kind === 294 /* JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: " + (ts.SyntaxKind ? ts.SyntaxKind[node.parent.kind] : node.parent.kind) + ", expected JSDocFunctionType"; });
+ ts.Debug.assert(node.parent.kind === 295 /* JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: " + (ts.SyntaxKind ? ts.SyntaxKind[node.parent.kind] : node.parent.kind) + ", expected JSDocFunctionType"; });
var functionType = node.parent;
var index = functionType.parameters.indexOf(node);
return "arg" + index;
@@ -27763,7 +27962,7 @@
// 1. multiple export default of class declaration or function declaration by checking NodeFlags.Default
// 2. multiple export default of export assignment. This one doesn't have NodeFlags.Default on (as export default doesn't considered as modifiers)
if (symbol.declarations && symbol.declarations.length &&
- (node.kind === 254 /* ExportAssignment */ && !node.isExportEquals)) {
+ (node.kind === 255 /* ExportAssignment */ && !node.isExportEquals)) {
message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports;
messageNeedsName_1 = false;
multipleDefaultExports_1 = true;
@@ -27798,7 +27997,7 @@
function declareModuleMember(node, symbolFlags, symbolExcludes) {
var hasExportModifier = ts.getCombinedModifierFlags(node) & 1 /* Export */;
if (symbolFlags & 2097152 /* Alias */) {
- if (node.kind === 257 /* ExportSpecifier */ || (node.kind === 248 /* ImportEqualsDeclaration */ && hasExportModifier)) {
+ if (node.kind === 258 /* ExportSpecifier */ || (node.kind === 249 /* ImportEqualsDeclaration */ && hasExportModifier)) {
return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
}
else {
@@ -27865,7 +28064,7 @@
// for it. We must clear this so we don't accidentally move any stale data forward from
// a previous compilation.
if (containerFlags & 1 /* IsContainer */) {
- if (node.kind !== 197 /* ArrowFunction */) {
+ if (node.kind !== 198 /* ArrowFunction */) {
thisParentContainer = container;
}
container = blockScopeContainer = node;
@@ -27898,7 +28097,7 @@
}
// We create a return control flow graph for IIFEs and constructors. For constructors
// we use the return control flow graph in strict property initialization checks.
- currentReturnTarget = isIIFE || node.kind === 157 /* Constructor */ ? createBranchLabel() : undefined;
+ currentReturnTarget = isIIFE || node.kind === 158 /* Constructor */ ? createBranchLabel() : undefined;
currentBreakTarget = undefined;
currentContinueTarget = undefined;
activeLabels = undefined;
@@ -27912,13 +28111,13 @@
if (hasExplicitReturn)
node.flags |= 256 /* HasExplicitReturn */;
}
- if (node.kind === 284 /* SourceFile */) {
+ if (node.kind === 285 /* SourceFile */) {
node.flags |= emitFlags;
}
if (currentReturnTarget) {
addAntecedent(currentReturnTarget, currentFlow);
currentFlow = finishFlowLabel(currentReturnTarget);
- if (node.kind === 157 /* Constructor */) {
+ if (node.kind === 158 /* Constructor */) {
node.returnFlowNode = currentFlow;
}
}
@@ -27962,8 +28161,8 @@
}
}
function bindEachFunctionsFirst(nodes) {
- bindEach(nodes, function (n) { return n.kind === 239 /* FunctionDeclaration */ ? bind(n) : undefined; });
- bindEach(nodes, function (n) { return n.kind !== 239 /* FunctionDeclaration */ ? bind(n) : undefined; });
+ bindEach(nodes, function (n) { return n.kind === 240 /* FunctionDeclaration */ ? bind(n) : undefined; });
+ bindEach(nodes, function (n) { return n.kind !== 240 /* FunctionDeclaration */ ? bind(n) : undefined; });
}
function bindEach(nodes, bindFunction) {
if (bindFunction === void 0) { bindFunction = bind; }
@@ -27996,78 +28195,78 @@
return;
}
switch (node.kind) {
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
bindWhileStatement(node);
break;
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
bindDoStatement(node);
break;
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
bindForStatement(node);
break;
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
bindForInOrForOfStatement(node);
break;
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
bindIfStatement(node);
break;
- case 230 /* ReturnStatement */:
- case 234 /* ThrowStatement */:
+ case 231 /* ReturnStatement */:
+ case 235 /* ThrowStatement */:
bindReturnOrThrow(node);
break;
- case 229 /* BreakStatement */:
- case 228 /* ContinueStatement */:
+ case 230 /* BreakStatement */:
+ case 229 /* ContinueStatement */:
bindBreakOrContinueStatement(node);
break;
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
bindTryStatement(node);
break;
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
bindSwitchStatement(node);
break;
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
bindCaseBlock(node);
break;
- case 271 /* CaseClause */:
+ case 272 /* CaseClause */:
bindCaseClause(node);
break;
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
bindLabeledStatement(node);
break;
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
bindPrefixUnaryExpressionFlow(node);
break;
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
bindPostfixUnaryExpressionFlow(node);
break;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
bindBinaryExpressionFlow(node);
break;
- case 198 /* DeleteExpression */:
+ case 199 /* DeleteExpression */:
bindDeleteExpressionFlow(node);
break;
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
bindConditionalExpressionFlow(node);
break;
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
bindVariableDeclarationFlow(node);
break;
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
bindCallExpressionFlow(node);
break;
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
bindJSDocTypeAlias(node);
break;
// In source files and blocks, bind functions first to match hoisting that occurs at runtime
- case 284 /* SourceFile */: {
+ case 285 /* SourceFile */: {
bindEachFunctionsFirst(node.statements);
bind(node.endOfFileToken);
break;
}
- case 218 /* Block */:
- case 245 /* ModuleBlock */:
+ case 219 /* Block */:
+ case 246 /* ModuleBlock */:
bindEachFunctionsFirst(node.statements);
break;
default:
@@ -28078,26 +28277,26 @@
}
function isNarrowingExpression(expr) {
switch (expr.kind) {
- case 72 /* Identifier */:
- case 100 /* ThisKeyword */:
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 73 /* Identifier */:
+ case 101 /* ThisKeyword */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return isNarrowableReference(expr);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return hasNarrowableArgument(expr);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return isNarrowingExpression(expr.expression);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return isNarrowingBinaryExpression(expr);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return expr.operator === 52 /* ExclamationToken */ && isNarrowingExpression(expr.operand);
- case 199 /* TypeOfExpression */:
+ case 200 /* TypeOfExpression */:
return isNarrowingExpression(expr.expression);
}
return false;
}
function isNarrowableReference(expr) {
- return expr.kind === 72 /* Identifier */ || expr.kind === 100 /* ThisKeyword */ || expr.kind === 98 /* SuperKeyword */ ||
+ return expr.kind === 73 /* Identifier */ || expr.kind === 101 /* ThisKeyword */ || expr.kind === 99 /* SuperKeyword */ ||
(ts.isPropertyAccessExpression(expr) || ts.isNonNullExpression(expr) || ts.isParenthesizedExpression(expr)) && isNarrowableReference(expr.expression) ||
ts.isElementAccessExpression(expr) && expr.argumentExpression &&
(ts.isStringLiteral(expr.argumentExpression) || ts.isNumericLiteral(expr.argumentExpression)) &&
@@ -28112,7 +28311,7 @@
}
}
}
- if (expr.expression.kind === 189 /* PropertyAccessExpression */ &&
+ if (expr.expression.kind === 190 /* PropertyAccessExpression */ &&
isNarrowableReference(expr.expression.expression)) {
return true;
}
@@ -28126,7 +28325,7 @@
}
function isNarrowingBinaryExpression(expr) {
switch (expr.operatorToken.kind) {
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
return isNarrowableReference(expr.left);
case 33 /* EqualsEqualsToken */:
case 34 /* ExclamationEqualsToken */:
@@ -28134,9 +28333,9 @@
case 36 /* ExclamationEqualsEqualsToken */:
return isNarrowableOperand(expr.left) || isNarrowableOperand(expr.right) ||
isNarrowingTypeofOperands(expr.right, expr.left) || isNarrowingTypeofOperands(expr.left, expr.right);
- case 94 /* InstanceOfKeyword */:
+ case 95 /* InstanceOfKeyword */:
return isNarrowableOperand(expr.left);
- case 93 /* InKeyword */:
+ case 94 /* InKeyword */:
return isNarrowableInOperands(expr.left, expr.right);
case 27 /* CommaToken */:
return isNarrowingExpression(expr.right);
@@ -28145,11 +28344,11 @@
}
function isNarrowableOperand(expr) {
switch (expr.kind) {
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return isNarrowableOperand(expr.expression);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
switch (expr.operatorToken.kind) {
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
return isNarrowableOperand(expr.left);
case 27 /* CommaToken */:
return isNarrowableOperand(expr.right);
@@ -28186,8 +28385,8 @@
if (!expression) {
return flags & 32 /* TrueCondition */ ? antecedent : unreachableFlow;
}
- if (expression.kind === 102 /* TrueKeyword */ && flags & 64 /* FalseCondition */ ||
- expression.kind === 87 /* FalseKeyword */ && flags & 32 /* TrueCondition */) {
+ if (expression.kind === 103 /* TrueKeyword */ && flags & 64 /* FalseCondition */ ||
+ expression.kind === 88 /* FalseKeyword */ && flags & 32 /* TrueCondition */) {
return unreachableFlow;
}
if (!isNarrowingExpression(expression)) {
@@ -28225,33 +28424,33 @@
function isStatementCondition(node) {
var parent = node.parent;
switch (parent.kind) {
- case 222 /* IfStatement */:
- case 224 /* WhileStatement */:
- case 223 /* DoStatement */:
+ case 223 /* IfStatement */:
+ case 225 /* WhileStatement */:
+ case 224 /* DoStatement */:
return parent.expression === node;
- case 225 /* ForStatement */:
- case 205 /* ConditionalExpression */:
+ case 226 /* ForStatement */:
+ case 206 /* ConditionalExpression */:
return parent.condition === node;
}
return false;
}
function isLogicalExpression(node) {
while (true) {
- if (node.kind === 195 /* ParenthesizedExpression */) {
+ if (node.kind === 196 /* ParenthesizedExpression */) {
node = node.expression;
}
- else if (node.kind === 202 /* PrefixUnaryExpression */ && node.operator === 52 /* ExclamationToken */) {
+ else if (node.kind === 203 /* PrefixUnaryExpression */ && node.operator === 52 /* ExclamationToken */) {
node = node.operand;
}
else {
- return node.kind === 204 /* BinaryExpression */ && (node.operatorToken.kind === 54 /* AmpersandAmpersandToken */ ||
+ return node.kind === 205 /* BinaryExpression */ && (node.operatorToken.kind === 54 /* AmpersandAmpersandToken */ ||
node.operatorToken.kind === 55 /* BarBarToken */);
}
}
}
function isTopLevelLogicalExpression(node) {
- while (node.parent.kind === 195 /* ParenthesizedExpression */ ||
- node.parent.kind === 202 /* PrefixUnaryExpression */ &&
+ while (node.parent.kind === 196 /* ParenthesizedExpression */ ||
+ node.parent.kind === 203 /* PrefixUnaryExpression */ &&
node.parent.operator === 52 /* ExclamationToken */) {
node = node.parent;
}
@@ -28293,7 +28492,7 @@
}
function bindDoStatement(node) {
var preDoLabel = createLoopLabel();
- var enclosingLabeledStatement = node.parent.kind === 233 /* LabeledStatement */
+ var enclosingLabeledStatement = node.parent.kind === 234 /* LabeledStatement */
? ts.lastOrUndefined(activeLabels)
: undefined;
// if do statement is wrapped in labeled statement then target labels for break/continue with or without
@@ -28327,13 +28526,13 @@
var postLoopLabel = createBranchLabel();
addAntecedent(preLoopLabel, currentFlow);
currentFlow = preLoopLabel;
- if (node.kind === 227 /* ForOfStatement */) {
+ if (node.kind === 228 /* ForOfStatement */) {
bind(node.awaitModifier);
}
bind(node.expression);
addAntecedent(postLoopLabel, currentFlow);
bind(node.initializer);
- if (node.initializer.kind !== 238 /* VariableDeclarationList */) {
+ if (node.initializer.kind !== 239 /* VariableDeclarationList */) {
bindAssignmentTargetFlow(node.initializer);
}
bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel);
@@ -28355,7 +28554,7 @@
}
function bindReturnOrThrow(node) {
bind(node.expression);
- if (node.kind === 230 /* ReturnStatement */) {
+ if (node.kind === 231 /* ReturnStatement */) {
hasExplicitReturn = true;
if (currentReturnTarget) {
addAntecedent(currentReturnTarget, currentFlow);
@@ -28375,7 +28574,7 @@
return undefined;
}
function bindBreakOrContinueFlow(node, breakTarget, continueTarget) {
- var flowLabel = node.kind === 229 /* BreakStatement */ ? breakTarget : continueTarget;
+ var flowLabel = node.kind === 230 /* BreakStatement */ ? breakTarget : continueTarget;
if (flowLabel) {
addAntecedent(flowLabel, currentFlow);
currentFlow = unreachableFlow;
@@ -28503,7 +28702,7 @@
preSwitchCaseFlow = currentFlow;
bind(node.caseBlock);
addAntecedent(postSwitchLabel, currentFlow);
- var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 272 /* DefaultClause */; });
+ var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 273 /* DefaultClause */; });
// We mark a switch statement as possibly exhaustive if it has no default clause and if all
// case clauses have unreachable end points (e.g. they all return).
node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents;
@@ -28570,14 +28769,14 @@
if (!activeLabel.referenced && !options.allowUnusedLabels) {
errorOrSuggestionOnNode(ts.unusedLabelIsError(options), node.label, ts.Diagnostics.Unused_label);
}
- if (!node.statement || node.statement.kind !== 223 /* DoStatement */) {
+ if (!node.statement || node.statement.kind !== 224 /* DoStatement */) {
// do statement sets current flow inside bindDoStatement
addAntecedent(postStatementLabel, currentFlow);
currentFlow = finishFlowLabel(postStatementLabel);
}
}
function bindDestructuringTargetFlow(node) {
- if (node.kind === 204 /* BinaryExpression */ && node.operatorToken.kind === 59 /* EqualsToken */) {
+ if (node.kind === 205 /* BinaryExpression */ && node.operatorToken.kind === 60 /* EqualsToken */) {
bindAssignmentTargetFlow(node.left);
}
else {
@@ -28588,10 +28787,10 @@
if (isNarrowableReference(node)) {
currentFlow = createFlowAssignment(currentFlow, node);
}
- else if (node.kind === 187 /* ArrayLiteralExpression */) {
+ else if (node.kind === 188 /* ArrayLiteralExpression */) {
for (var _i = 0, _a = node.elements; _i < _a.length; _i++) {
var e = _a[_i];
- if (e.kind === 208 /* SpreadElement */) {
+ if (e.kind === 209 /* SpreadElement */) {
bindAssignmentTargetFlow(e.expression);
}
else {
@@ -28599,16 +28798,16 @@
}
}
}
- else if (node.kind === 188 /* ObjectLiteralExpression */) {
+ else if (node.kind === 189 /* ObjectLiteralExpression */) {
for (var _b = 0, _c = node.properties; _b < _c.length; _b++) {
var p = _c[_b];
- if (p.kind === 275 /* PropertyAssignment */) {
+ if (p.kind === 276 /* PropertyAssignment */) {
bindDestructuringTargetFlow(p.initializer);
}
- else if (p.kind === 276 /* ShorthandPropertyAssignment */) {
+ else if (p.kind === 277 /* ShorthandPropertyAssignment */) {
bindAssignmentTargetFlow(p.name);
}
- else if (p.kind === 277 /* SpreadAssignment */) {
+ else if (p.kind === 278 /* SpreadAssignment */) {
bindAssignmentTargetFlow(p.expression);
}
}
@@ -28664,7 +28863,7 @@
bindEachChild(node);
if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) {
bindAssignmentTargetFlow(node.left);
- if (operator === 59 /* EqualsToken */ && node.left.kind === 190 /* ElementAccessExpression */) {
+ if (operator === 60 /* EqualsToken */ && node.left.kind === 191 /* ElementAccessExpression */) {
var elementAccess = node.left;
if (isNarrowableOperand(elementAccess.expression)) {
currentFlow = createFlowArrayMutation(currentFlow, node);
@@ -28675,7 +28874,7 @@
}
function bindDeleteExpressionFlow(node) {
bindEachChild(node);
- if (node.expression.kind === 189 /* PropertyAccessExpression */) {
+ if (node.expression.kind === 190 /* PropertyAccessExpression */) {
bindAssignmentTargetFlow(node.expression);
}
}
@@ -28723,10 +28922,10 @@
// an immediately invoked function expression (IIFE). Initialize the flowNode property to
// the current control flow (which includes evaluation of the IIFE arguments).
var expr = node.expression;
- while (expr.kind === 195 /* ParenthesizedExpression */) {
+ while (expr.kind === 196 /* ParenthesizedExpression */) {
expr = expr.expression;
}
- if (expr.kind === 196 /* FunctionExpression */ || expr.kind === 197 /* ArrowFunction */) {
+ if (expr.kind === 197 /* FunctionExpression */ || expr.kind === 198 /* ArrowFunction */) {
bindEach(node.typeArguments);
bindEach(node.arguments);
bind(node.expression);
@@ -28734,7 +28933,7 @@
else {
bindEachChild(node);
}
- if (node.expression.kind === 189 /* PropertyAccessExpression */) {
+ if (node.expression.kind === 190 /* PropertyAccessExpression */) {
var propertyAccess = node.expression;
if (isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) {
currentFlow = createFlowArrayMutation(currentFlow, node);
@@ -28743,54 +28942,54 @@
}
function getContainerFlags(node) {
switch (node.kind) {
- case 209 /* ClassExpression */:
- case 240 /* ClassDeclaration */:
- case 243 /* EnumDeclaration */:
- case 188 /* ObjectLiteralExpression */:
- case 168 /* TypeLiteral */:
- case 297 /* JSDocTypeLiteral */:
- case 268 /* JsxAttributes */:
+ case 210 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 189 /* ObjectLiteralExpression */:
+ case 169 /* TypeLiteral */:
+ case 298 /* JSDocTypeLiteral */:
+ case 269 /* JsxAttributes */:
return 1 /* IsContainer */;
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
return 1 /* IsContainer */ | 64 /* IsInterface */;
- case 244 /* ModuleDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 181 /* MappedType */:
+ case 245 /* ModuleDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 182 /* MappedType */:
return 1 /* IsContainer */ | 32 /* HasLocals */;
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */;
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
if (ts.isObjectLiteralOrClassExpressionMethod(node)) {
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 128 /* IsObjectLiteralOrClassExpressionMethod */;
}
// falls through
- case 157 /* Constructor */:
- case 239 /* FunctionDeclaration */:
- case 155 /* MethodSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 160 /* CallSignature */:
- case 298 /* JSDocSignature */:
- case 294 /* JSDocFunctionType */:
- case 165 /* FunctionType */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
- case 166 /* ConstructorType */:
+ case 158 /* Constructor */:
+ case 240 /* FunctionDeclaration */:
+ case 156 /* MethodSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 161 /* CallSignature */:
+ case 299 /* JSDocSignature */:
+ case 295 /* JSDocFunctionType */:
+ case 166 /* FunctionType */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
+ case 167 /* ConstructorType */:
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */;
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 16 /* IsFunctionExpression */;
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
return 4 /* IsControlFlowContainer */;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return node.initializer ? 4 /* IsControlFlowContainer */ : 0;
- case 274 /* CatchClause */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 246 /* CaseBlock */:
+ case 275 /* CatchClause */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 247 /* CaseBlock */:
return 2 /* IsBlockScopedContainer */;
- case 218 /* Block */:
+ case 219 /* Block */:
// do not treat blocks directly inside a function as a block-scoped-container.
// Locals that reside in this block should go to the function locals. Otherwise 'x'
// would not appear to be a redeclaration of a block scoped local in the following
@@ -28823,45 +29022,45 @@
// members are declared (for example, a member of a class will go into a specific
// symbol table depending on if it is static or not). We defer to specialized
// handlers to take care of declaring these child members.
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return declareModuleMember(node, symbolFlags, symbolExcludes);
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return declareSourceFileMember(node, symbolFlags, symbolExcludes);
- case 209 /* ClassExpression */:
- case 240 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
return declareClassMember(node, symbolFlags, symbolExcludes);
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
- case 168 /* TypeLiteral */:
- case 297 /* JSDocTypeLiteral */:
- case 188 /* ObjectLiteralExpression */:
- case 241 /* InterfaceDeclaration */:
- case 268 /* JsxAttributes */:
+ case 169 /* TypeLiteral */:
+ case 298 /* JSDocTypeLiteral */:
+ case 189 /* ObjectLiteralExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 269 /* JsxAttributes */:
// Interface/Object-types always have their children added to the 'members' of
// their container. They are only accessible through an instance of their
// container, and are never in scope otherwise (even inside the body of the
// object / type / interface declaring them). An exception is type parameters,
// which are in scope without qualification (similar to 'locals').
return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes);
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 298 /* JSDocSignature */:
- case 162 /* IndexSignature */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 294 /* JSDocFunctionType */:
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
- case 242 /* TypeAliasDeclaration */:
- case 181 /* MappedType */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 299 /* JSDocSignature */:
+ case 163 /* IndexSignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 295 /* JSDocFunctionType */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
+ case 243 /* TypeAliasDeclaration */:
+ case 182 /* MappedType */:
// All the children of these container types are never visible through another
// symbol (i.e. through another symbol's 'exports' or 'members'). Instead,
// they're only accessed 'lexically' (i.e. from code that exists underneath
@@ -28882,16 +29081,8 @@
: declareSymbol(file.locals, /*parent*/ undefined, node, symbolFlags, symbolExcludes);
}
function hasExportDeclarations(node) {
- var body = node.kind === 284 /* SourceFile */ ? node : node.body;
- if (body && (body.kind === 284 /* SourceFile */ || body.kind === 245 /* ModuleBlock */)) {
- for (var _i = 0, _a = body.statements; _i < _a.length; _i++) {
- var stat = _a[_i];
- if (stat.kind === 255 /* ExportDeclaration */ || stat.kind === 254 /* ExportAssignment */) {
- return true;
- }
- }
- }
- return false;
+ var body = ts.isSourceFile(node) ? node : ts.tryCast(node.body, ts.isModuleBlock);
+ return !!body && body.statements.some(function (s) { return ts.isExportDeclaration(s) || ts.isExportAssignment(s); });
}
function setExportContextFlag(node) {
// A declaration source file or ambient module declaration that contains no export declarations (but possibly regular
@@ -28970,7 +29161,7 @@
var seen = ts.createUnderscoreEscapedMap();
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var prop = _a[_i];
- if (prop.kind === 277 /* SpreadAssignment */ || prop.name.kind !== 72 /* Identifier */) {
+ if (prop.kind === 278 /* SpreadAssignment */ || prop.name.kind !== 73 /* Identifier */) {
continue;
}
var identifier = prop.name;
@@ -28982,7 +29173,7 @@
// c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true.
// d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true
// and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields
- var currentKind = prop.kind === 275 /* PropertyAssignment */ || prop.kind === 276 /* ShorthandPropertyAssignment */ || prop.kind === 156 /* MethodDeclaration */
+ var currentKind = prop.kind === 276 /* PropertyAssignment */ || prop.kind === 277 /* ShorthandPropertyAssignment */ || prop.kind === 157 /* MethodDeclaration */
? 1 /* Property */
: 2 /* Accessor */;
var existingKind = seen.get(identifier.escapedText);
@@ -29014,10 +29205,10 @@
}
function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) {
switch (blockScopeContainer.kind) {
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
declareModuleMember(node, symbolFlags, symbolExcludes);
break;
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
if (ts.isExternalOrCommonJsModule(container)) {
declareModuleMember(node, symbolFlags, symbolExcludes);
break;
@@ -29048,7 +29239,7 @@
currentFlow = { flags: 2 /* Start */ };
parent = typeAlias;
bind(typeAlias.typeExpression);
- if (!typeAlias.fullName || typeAlias.fullName.kind === 72 /* Identifier */) {
+ if (!typeAlias.fullName || typeAlias.fullName.kind === 73 /* Identifier */) {
parent = typeAlias.parent;
bindBlockScopedDeclaration(typeAlias, 524288 /* TypeAlias */, 67897832 /* TypeAliasExcludes */);
}
@@ -29066,8 +29257,8 @@
// check for reserved words used as identifiers in strict mode code.
function checkStrictModeIdentifier(node) {
if (inStrictMode &&
- node.originalKeywordKind >= 109 /* FirstFutureReservedWord */ &&
- node.originalKeywordKind <= 117 /* LastFutureReservedWord */ &&
+ node.originalKeywordKind >= 110 /* FirstFutureReservedWord */ &&
+ node.originalKeywordKind <= 118 /* LastFutureReservedWord */ &&
!ts.isIdentifierName(node) &&
!(node.flags & 4194304 /* Ambient */)) {
// Report error only if there are no parse errors in file
@@ -29103,7 +29294,7 @@
}
function checkStrictModeDeleteExpression(node) {
// Grammar checking
- if (inStrictMode && node.expression.kind === 72 /* Identifier */) {
+ if (inStrictMode && node.expression.kind === 73 /* Identifier */) {
// When a delete operator occurs within strict mode code, a SyntaxError is thrown if its
// UnaryExpression is a direct reference to a variable, function argument, or function name
var span = ts.getErrorSpanForNode(file, node.expression);
@@ -29114,7 +29305,7 @@
return ts.isIdentifier(node) && (node.escapedText === "eval" || node.escapedText === "arguments");
}
function checkStrictModeEvalOrArguments(contextNode, name) {
- if (name && name.kind === 72 /* Identifier */) {
+ if (name && name.kind === 73 /* Identifier */) {
var identifier = name;
if (isEvalOrArgumentsIdentifier(identifier)) {
// We check first if the name is inside class declaration or class expression; if so give explicit message
@@ -29155,8 +29346,8 @@
function checkStrictModeFunctionDeclaration(node) {
if (languageVersion < 2 /* ES2015 */) {
// Report error if function is not top level function declaration
- if (blockScopeContainer.kind !== 284 /* SourceFile */ &&
- blockScopeContainer.kind !== 244 /* ModuleDeclaration */ &&
+ if (blockScopeContainer.kind !== 285 /* SourceFile */ &&
+ blockScopeContainer.kind !== 245 /* ModuleDeclaration */ &&
!ts.isFunctionLike(blockScopeContainer)) {
// We check first if the name is inside class declaration or class expression; if so give explicit message
// otherwise report generic error message.
@@ -29251,7 +29442,7 @@
// the current 'container' node when it changes. This helps us know which symbol table
// a local should go into for example. Since terminal nodes are known not to have
// children, as an optimization we don't process those.
- if (node.kind > 147 /* LastToken */) {
+ if (node.kind > 148 /* LastToken */) {
var saveParent = parent;
parent = node;
var containerFlags = getContainerFlags(node);
@@ -29313,7 +29504,7 @@
function bindWorker(node) {
switch (node.kind) {
/* Strict mode checks */
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
// for typedef type names with namespaces, bind the new jsdoc type symbol here
// because it requires all containing namespaces to be in effect, namely the
// current "blockScopeContainer" needs to be set to its immediate namespace parent.
@@ -29326,13 +29517,13 @@
break;
}
// falls through
- case 100 /* ThisKeyword */:
- if (currentFlow && (ts.isExpression(node) || parent.kind === 276 /* ShorthandPropertyAssignment */)) {
+ case 101 /* ThisKeyword */:
+ if (currentFlow && (ts.isExpression(node) || parent.kind === 277 /* ShorthandPropertyAssignment */)) {
node.flowNode = currentFlow;
}
return checkStrictModeIdentifier(node);
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
if (currentFlow && isNarrowableReference(node)) {
node.flowNode = currentFlow;
}
@@ -29346,7 +29537,7 @@
declareSymbol(file.locals, /*parent*/ undefined, node.expression, 1 /* FunctionScopedVariable */ | 134217728 /* ModuleExports */, 67220414 /* FunctionScopedVariableExcludes */);
}
break;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
var specialKind = ts.getAssignmentDeclarationKind(node);
switch (specialKind) {
case 1 /* ExportsProperty */:
@@ -29374,76 +29565,76 @@
ts.Debug.fail("Unknown binary expression special property assignment kind");
}
return checkStrictModeBinaryExpression(node);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return checkStrictModeCatchClause(node);
- case 198 /* DeleteExpression */:
+ case 199 /* DeleteExpression */:
return checkStrictModeDeleteExpression(node);
case 8 /* NumericLiteral */:
return checkStrictModeNumericLiteral(node);
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return checkStrictModePostfixUnaryExpression(node);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return checkStrictModePrefixUnaryExpression(node);
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
return checkStrictModeWithStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return checkStrictModeLabeledStatement(node);
- case 178 /* ThisType */:
+ case 179 /* ThisType */:
seenThisKeyword = true;
return;
- case 163 /* TypePredicate */:
+ case 164 /* TypePredicate */:
break; // Binding the children will handle everything
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
return bindTypeParameter(node);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return bindParameter(node);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return bindVariableDeclarationOrBindingElement(node);
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
node.flowNode = currentFlow;
return bindVariableDeclarationOrBindingElement(node);
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
return bindPropertyWorker(node);
- case 275 /* PropertyAssignment */:
- case 276 /* ShorthandPropertyAssignment */:
+ case 276 /* PropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 0 /* PropertyExcludes */);
- case 278 /* EnumMember */:
+ case 279 /* EnumMember */:
return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 68008959 /* EnumMemberExcludes */);
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
return declareSymbolAndAddToSymbolTable(node, 131072 /* Signature */, 0 /* None */);
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
// If this is an ObjectLiteralExpression method, then it sits in the same space
// as other properties in the object literal. So we use SymbolFlags.PropertyExcludes
// so that it will conflict with any other object literal members with the same
// name.
return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 16777216 /* Optional */ : 0 /* None */), ts.isObjectLiteralMethod(node) ? 0 /* PropertyExcludes */ : 67212223 /* MethodExcludes */);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return bindFunctionDeclaration(node);
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */);
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 67154879 /* GetAccessorExcludes */);
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 67187647 /* SetAccessorExcludes */);
- case 165 /* FunctionType */:
- case 294 /* JSDocFunctionType */:
- case 298 /* JSDocSignature */:
- case 166 /* ConstructorType */:
+ case 166 /* FunctionType */:
+ case 295 /* JSDocFunctionType */:
+ case 299 /* JSDocSignature */:
+ case 167 /* ConstructorType */:
return bindFunctionOrConstructorType(node);
- case 168 /* TypeLiteral */:
- case 297 /* JSDocTypeLiteral */:
- case 181 /* MappedType */:
+ case 169 /* TypeLiteral */:
+ case 298 /* JSDocTypeLiteral */:
+ case 182 /* MappedType */:
return bindAnonymousTypeWorker(node);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return bindObjectLiteralExpression(node);
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return bindFunctionExpression(node);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
var assignmentKind = ts.getAssignmentDeclarationKind(node);
switch (assignmentKind) {
case 7 /* ObjectDefinePropertyValue */:
@@ -29462,64 +29653,64 @@
}
break;
// Members of classes, interfaces, and modules
- case 209 /* ClassExpression */:
- case 240 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
// All classes are automatically in strict mode in ES6.
inStrictMode = true;
return bindClassLikeDeclaration(node);
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
return bindBlockScopedDeclaration(node, 64 /* Interface */, 67897736 /* InterfaceExcludes */);
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 67897832 /* TypeAliasExcludes */);
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return bindEnumDeclaration(node);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return bindModuleDeclaration(node);
// Jsx-attributes
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
return bindJsxAttributes(node);
- case 267 /* JsxAttribute */:
+ case 268 /* JsxAttribute */:
return bindJsxAttribute(node, 4 /* Property */, 0 /* PropertyExcludes */);
// Imports and exports
- case 248 /* ImportEqualsDeclaration */:
- case 251 /* NamespaceImport */:
- case 253 /* ImportSpecifier */:
- case 257 /* ExportSpecifier */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 252 /* NamespaceImport */:
+ case 254 /* ImportSpecifier */:
+ case 258 /* ExportSpecifier */:
return declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */);
- case 247 /* NamespaceExportDeclaration */:
+ case 248 /* NamespaceExportDeclaration */:
return bindNamespaceExportDeclaration(node);
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
return bindImportClause(node);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return bindExportDeclaration(node);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return bindExportAssignment(node);
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
updateStrictModeStatementList(node.statements);
return bindSourceFileIfExternalModule();
- case 218 /* Block */:
+ case 219 /* Block */:
if (!ts.isFunctionLike(node.parent)) {
return;
}
// falls through
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
return updateStrictModeStatementList(node.statements);
- case 304 /* JSDocParameterTag */:
- if (node.parent.kind === 298 /* JSDocSignature */) {
+ case 305 /* JSDocParameterTag */:
+ if (node.parent.kind === 299 /* JSDocSignature */) {
return bindParameter(node);
}
- if (node.parent.kind !== 297 /* JSDocTypeLiteral */) {
+ if (node.parent.kind !== 298 /* JSDocTypeLiteral */) {
break;
}
// falls through
- case 310 /* JSDocPropertyTag */:
+ case 311 /* JSDocPropertyTag */:
var propTag = node;
- var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 293 /* JSDocOptionalType */ ?
+ var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 294 /* JSDocOptionalType */ ?
4 /* Property */ | 16777216 /* Optional */ :
4 /* Property */;
return declareSymbolAndAddToSymbolTable(propTag, flags, 0 /* PropertyExcludes */);
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
return (delayedTypeAliases || (delayedTypeAliases = [])).push(node);
}
}
@@ -29663,11 +29854,11 @@
ts.Debug.assert(ts.isInJSFile(node));
var thisContainer = ts.getThisContainer(node, /*includeArrowFunctions*/ false);
switch (thisContainer.kind) {
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
var constructorSymbol = thisContainer.symbol;
// For `f.prototype.m = function() { this.x = 0; }`, `this.x = 0` should modify `f`'s members, not the function expression.
- if (ts.isBinaryExpression(thisContainer.parent) && thisContainer.parent.operatorToken.kind === 59 /* EqualsToken */) {
+ if (ts.isBinaryExpression(thisContainer.parent) && thisContainer.parent.operatorToken.kind === 60 /* EqualsToken */) {
var l = thisContainer.parent.left;
if (ts.isPropertyAccessEntityNameExpression(l) && ts.isPrototypeAccess(l.expression)) {
constructorSymbol = lookupSymbolForPropertyAccess(l.expression.expression, thisParentContainer);
@@ -29680,18 +29871,18 @@
declareSymbol(constructorSymbol.members, constructorSymbol, node, 4 /* Property */, 0 /* PropertyExcludes */ & ~4 /* Property */);
}
break;
- case 157 /* Constructor */:
- case 154 /* PropertyDeclaration */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 158 /* Constructor */:
+ case 155 /* PropertyDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
// this.foo assignment in a JavaScript class
// Bind this property to the containing class
var containingClass = thisContainer.parent;
var symbolTable = ts.hasModifier(thisContainer, 32 /* Static */) ? containingClass.symbol.exports : containingClass.symbol.members;
declareSymbol(symbolTable, containingClass.symbol, node, 4 /* Property */, 0 /* None */, /*isReplaceableByMethod*/ true);
break;
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
// this.property = assignment in a source file -- declare symbol in exports for a module, in locals for a script
if (thisContainer.commonJsModuleIndicator) {
declareSymbol(thisContainer.symbol.exports, thisContainer.symbol, node, 4 /* Property */ | 1048576 /* ExportValue */, 0 /* None */);
@@ -29701,14 +29892,14 @@
}
break;
default:
- ts.Debug.fail(ts.Debug.showSyntaxKind(thisContainer));
+ ts.Debug.failBadSyntaxKind(thisContainer);
}
}
function bindSpecialPropertyDeclaration(node) {
- if (node.expression.kind === 100 /* ThisKeyword */) {
+ if (node.expression.kind === 101 /* ThisKeyword */) {
bindThisPropertyAssignment(node);
}
- else if (ts.isPropertyAccessEntityNameExpression(node) && node.parent.parent.kind === 284 /* SourceFile */) {
+ else if (ts.isPropertyAccessEntityNameExpression(node) && node.parent.parent.kind === 285 /* SourceFile */) {
if (ts.isPrototypeAccess(node.expression)) {
bindPrototypePropertyAssignment(node, node.parent);
}
@@ -29745,7 +29936,7 @@
}
function bindObjectDefinePropertyAssignment(node) {
var namespaceSymbol = lookupSymbolForPropertyAccess(node.arguments[0]);
- var isToplevel = node.parent.parent.kind === 284 /* SourceFile */;
+ var isToplevel = node.parent.parent.kind === 285 /* SourceFile */;
namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, node.arguments[0], isToplevel, /*isPrototypeProperty*/ false);
bindPotentiallyNewExpandoMemberToNamespace(node, namespaceSymbol, /*isPrototypeProperty*/ false);
}
@@ -29759,7 +29950,7 @@
// Fix up parent pointers since we're going to use these nodes before we bind into them
node.left.parent = node;
node.right.parent = node;
- if (ts.isIdentifier(lhs.expression) && container === file && isNameOfExportsOrModuleExportsAliasDeclaration(file, lhs.expression)) {
+ if (ts.isIdentifier(lhs.expression) && container === file && isExportsOrModuleExportsOrAlias(file, lhs.expression)) {
// This can be an alias for the 'exports' or 'module.exports' names, e.g.
// var util = module.exports;
// util.property = function ...
@@ -29812,8 +30003,8 @@
function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty) {
var namespaceSymbol = lookupSymbolForPropertyAccess(name);
var isToplevel = ts.isBinaryExpression(propertyAccess.parent)
- ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 284 /* SourceFile */
- : propertyAccess.parent.parent.kind === 284 /* SourceFile */;
+ ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 285 /* SourceFile */
+ : propertyAccess.parent.parent.kind === 285 /* SourceFile */;
namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, propertyAccess.expression, isToplevel, isPrototypeProperty);
bindPotentiallyNewExpandoMemberToNamespace(propertyAccess, namespaceSymbol, isPrototypeProperty);
}
@@ -29872,9 +30063,7 @@
}
else {
var s = forEachIdentifierInEntityName(e.expression, parent, action);
- if (!s || !s.exports)
- return ts.Debug.fail();
- return action(e.name, s.exports.get(e.name.escapedText), s);
+ return action(e.name, s && s.exports && s.exports.get(e.name.escapedText), s);
}
}
function bindCallExpression(node) {
@@ -29885,7 +30074,7 @@
}
}
function bindClassLikeDeclaration(node) {
- if (node.kind === 240 /* ClassDeclaration */) {
+ if (node.kind === 241 /* ClassDeclaration */) {
bindBlockScopedDeclaration(node, 32 /* Class */, 68008383 /* ClassExcludes */);
}
else {
@@ -29951,7 +30140,7 @@
}
}
function bindParameter(node) {
- if (node.kind === 304 /* JSDocParameterTag */ && container.kind !== 298 /* JSDocSignature */) {
+ if (node.kind === 305 /* JSDocParameterTag */ && container.kind !== 299 /* JSDocSignature */) {
return;
}
if (inStrictMode && !(node.flags & 4194304 /* Ambient */)) {
@@ -30028,7 +30217,7 @@
declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 67635688 /* TypeParameterExcludes */);
}
}
- else if (node.parent.kind === 176 /* InferType */) {
+ else if (node.parent.kind === 177 /* InferType */) {
var container_2 = getInferTypeContainer(node.parent);
if (container_2) {
if (!container_2.locals) {
@@ -30056,11 +30245,11 @@
if (currentFlow === unreachableFlow) {
var reportError =
// report error on all statements except empty ones
- (ts.isStatementButNotDeclaration(node) && node.kind !== 220 /* EmptyStatement */) ||
+ (ts.isStatementButNotDeclaration(node) && node.kind !== 221 /* EmptyStatement */) ||
// report error on class declarations
- node.kind === 240 /* ClassDeclaration */ ||
+ node.kind === 241 /* ClassDeclaration */ ||
// report error on instantiated modules or const-enums only modules if preserveConstEnums is set
- (node.kind === 244 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node));
+ (node.kind === 245 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node));
if (reportError) {
currentFlow = reportedUnreachableFlow;
if (!options.allowUnreachableCode) {
@@ -30104,32 +30293,41 @@
}
function isPurelyTypeDeclaration(s) {
switch (s.kind) {
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return true;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return getModuleInstanceState(s) !== 1 /* Instantiated */;
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return ts.hasModifier(s, 2048 /* Const */);
default:
return false;
}
}
function isExportsOrModuleExportsOrAlias(sourceFile, node) {
- return ts.isExportsIdentifier(node) ||
- ts.isModuleExportsPropertyAccessExpression(node) ||
- ts.isIdentifier(node) && isNameOfExportsOrModuleExportsAliasDeclaration(sourceFile, node);
+ var i = 0;
+ var q = [node];
+ while (q.length && i < 100) {
+ i++;
+ node = q.shift();
+ if (ts.isExportsIdentifier(node) || ts.isModuleExportsPropertyAccessExpression(node)) {
+ return true;
}
- ts.isExportsOrModuleExportsOrAlias = isExportsOrModuleExportsOrAlias;
- function isNameOfExportsOrModuleExportsAliasDeclaration(sourceFile, node) {
+ else if (ts.isIdentifier(node)) {
var symbol = lookupSymbolForNameWorker(sourceFile, node.escapedText);
- return !!symbol && !!symbol.valueDeclaration && ts.isVariableDeclaration(symbol.valueDeclaration) &&
- !!symbol.valueDeclaration.initializer && isExportsOrModuleExportsOrAliasOrAssignment(sourceFile, symbol.valueDeclaration.initializer);
+ if (!!symbol && !!symbol.valueDeclaration && ts.isVariableDeclaration(symbol.valueDeclaration) && !!symbol.valueDeclaration.initializer) {
+ var init = symbol.valueDeclaration.initializer;
+ q.push(init);
+ if (ts.isAssignmentExpression(init, /*excludeCompoundAssignment*/ true)) {
+ q.push(init.left);
+ q.push(init.right);
+ }
+ }
}
- function isExportsOrModuleExportsOrAliasOrAssignment(sourceFile, node) {
- return isExportsOrModuleExportsOrAlias(sourceFile, node) ||
- (ts.isAssignmentExpression(node, /*excludeCompoundAssignment*/ true) && (isExportsOrModuleExportsOrAliasOrAssignment(sourceFile, node.left) || isExportsOrModuleExportsOrAliasOrAssignment(sourceFile, node.right)));
}
+ return false;
+ }
+ ts.isExportsOrModuleExportsOrAlias = isExportsOrModuleExportsOrAlias;
function lookupSymbolForNameWorker(container, name) {
var local = container.locals && container.locals.get(name);
if (local) {
@@ -30149,58 +30347,58 @@
function computeTransformFlagsForNode(node, subtreeFlags) {
var kind = node.kind;
switch (kind) {
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return computeCallExpression(node, subtreeFlags);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return computeNewExpression(node, subtreeFlags);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return computeModuleDeclaration(node, subtreeFlags);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return computeParenthesizedExpression(node, subtreeFlags);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return computeBinaryExpression(node, subtreeFlags);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return computeExpressionStatement(node, subtreeFlags);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return computeParameter(node, subtreeFlags);
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return computeArrowFunction(node, subtreeFlags);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return computeFunctionExpression(node, subtreeFlags);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return computeFunctionDeclaration(node, subtreeFlags);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return computeVariableDeclaration(node, subtreeFlags);
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
return computeVariableDeclarationList(node, subtreeFlags);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return computeVariableStatement(node, subtreeFlags);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return computeLabeledStatement(node, subtreeFlags);
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return computeClassDeclaration(node, subtreeFlags);
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
return computeClassExpression(node, subtreeFlags);
- case 273 /* HeritageClause */:
+ case 274 /* HeritageClause */:
return computeHeritageClause(node, subtreeFlags);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return computeCatchClause(node, subtreeFlags);
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return computeExpressionWithTypeArguments(node, subtreeFlags);
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return computeConstructor(node, subtreeFlags);
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return computePropertyDeclaration(node, subtreeFlags);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return computeMethod(node, subtreeFlags);
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return computeAccessor(node, subtreeFlags);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return computeImportEquals(node, subtreeFlags);
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return computePropertyAccess(node, subtreeFlags);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return computeElementAccess(node, subtreeFlags);
default:
return computeOther(node, kind, subtreeFlags);
@@ -30222,7 +30420,7 @@
transformFlags |= 2048 /* ContainsLexicalThis */;
}
}
- if (expression.kind === 92 /* ImportKeyword */) {
+ if (expression.kind === 93 /* ImportKeyword */) {
transformFlags |= 524288 /* ContainsDynamicImport */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
@@ -30245,17 +30443,17 @@
var transformFlags = subtreeFlags;
var operatorTokenKind = node.operatorToken.kind;
var leftKind = node.left.kind;
- if (operatorTokenKind === 59 /* EqualsToken */ && leftKind === 188 /* ObjectLiteralExpression */) {
+ if (operatorTokenKind === 60 /* EqualsToken */ && leftKind === 189 /* ObjectLiteralExpression */) {
// Destructuring object assignments with are ES2015 syntax
// and possibly ES2018 if they contain rest
transformFlags |= 16 /* AssertES2018 */ | 128 /* AssertES2015 */ | 512 /* AssertDestructuringAssignment */;
}
- else if (operatorTokenKind === 59 /* EqualsToken */ && leftKind === 187 /* ArrayLiteralExpression */) {
+ else if (operatorTokenKind === 60 /* EqualsToken */ && leftKind === 188 /* ArrayLiteralExpression */) {
// Destructuring assignments are ES2015 syntax.
transformFlags |= 128 /* AssertES2015 */ | 512 /* AssertDestructuringAssignment */;
}
else if (operatorTokenKind === 41 /* AsteriskAsteriskToken */
- || operatorTokenKind === 63 /* AsteriskAsteriskEqualsToken */) {
+ || operatorTokenKind === 64 /* AsteriskAsteriskEqualsToken */) {
// Exponentiation is ES2016 syntax.
transformFlags |= 64 /* AssertES2016 */;
}
@@ -30298,8 +30496,8 @@
// If the node is synthesized, it means the emitter put the parentheses there,
// not the user. If we didn't want them, the emitter would not have put them
// there.
- if (expressionKind === 212 /* AsExpression */
- || expressionKind === 194 /* TypeAssertionExpression */) {
+ if (expressionKind === 213 /* AsExpression */
+ || expressionKind === 195 /* TypeAssertionExpression */) {
transformFlags |= 1 /* AssertTypeScript */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
@@ -30341,11 +30539,11 @@
function computeHeritageClause(node, subtreeFlags) {
var transformFlags = subtreeFlags;
switch (node.token) {
- case 86 /* ExtendsKeyword */:
+ case 87 /* ExtendsKeyword */:
// An `extends` HeritageClause is ES6 syntax.
transformFlags |= 128 /* AssertES2015 */;
break;
- case 109 /* ImplementsKeyword */:
+ case 110 /* ImplementsKeyword */:
// An `implements` HeritageClause is TypeScript syntax.
transformFlags |= 1 /* AssertTypeScript */;
break;
@@ -30538,7 +30736,7 @@
var transformFlags = subtreeFlags;
// If a PropertyAccessExpression starts with a super keyword, then it is
// ES6 syntax, and requires a lexical `this` binding.
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
// super inside of an async function requires hoisting the super access (ES2017).
// same for super inside of an async generator, which is ES2018.
transformFlags |= 32 /* ContainsES2017 */ | 16 /* ContainsES2018 */;
@@ -30550,7 +30748,7 @@
var transformFlags = subtreeFlags;
// If an ElementAccessExpression starts with a super keyword, then it is
// ES6 syntax, and requires a lexical `this` binding.
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
// super inside of an async function requires hoisting the super access (ES2017).
// same for super inside of an async generator, which is ES2018.
transformFlags |= 32 /* ContainsES2017 */ | 16 /* ContainsES2018 */;
@@ -30638,43 +30836,43 @@
var transformFlags = subtreeFlags;
var excludeFlags = 536870912 /* NodeExcludes */;
switch (kind) {
- case 121 /* AsyncKeyword */:
- case 201 /* AwaitExpression */:
+ case 122 /* AsyncKeyword */:
+ case 202 /* AwaitExpression */:
// async/await is ES2017 syntax, but may be ES2018 syntax (for async generators)
transformFlags |= 16 /* AssertES2018 */ | 32 /* AssertES2017 */;
break;
- case 194 /* TypeAssertionExpression */:
- case 212 /* AsExpression */:
- case 313 /* PartiallyEmittedExpression */:
+ case 195 /* TypeAssertionExpression */:
+ case 213 /* AsExpression */:
+ case 314 /* PartiallyEmittedExpression */:
// These nodes are TypeScript syntax.
transformFlags |= 1 /* AssertTypeScript */;
excludeFlags = 536870912 /* OuterExpressionExcludes */;
break;
- case 115 /* PublicKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 118 /* AbstractKeyword */:
- case 125 /* DeclareKeyword */:
- case 77 /* ConstKeyword */:
- case 243 /* EnumDeclaration */:
- case 278 /* EnumMember */:
- case 213 /* NonNullExpression */:
- case 133 /* ReadonlyKeyword */:
+ case 116 /* PublicKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 119 /* AbstractKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 78 /* ConstKeyword */:
+ case 244 /* EnumDeclaration */:
+ case 279 /* EnumMember */:
+ case 214 /* NonNullExpression */:
+ case 134 /* ReadonlyKeyword */:
// These nodes are TypeScript syntax.
transformFlags |= 1 /* AssertTypeScript */;
break;
- case 260 /* JsxElement */:
- case 261 /* JsxSelfClosingElement */:
- case 262 /* JsxOpeningElement */:
+ case 261 /* JsxElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
case 11 /* JsxText */:
- case 263 /* JsxClosingElement */:
- case 264 /* JsxFragment */:
- case 265 /* JsxOpeningFragment */:
- case 266 /* JsxClosingFragment */:
- case 267 /* JsxAttribute */:
- case 268 /* JsxAttributes */:
- case 269 /* JsxSpreadAttribute */:
- case 270 /* JsxExpression */:
+ case 264 /* JsxClosingElement */:
+ case 265 /* JsxFragment */:
+ case 266 /* JsxOpeningFragment */:
+ case 267 /* JsxClosingFragment */:
+ case 268 /* JsxAttribute */:
+ case 269 /* JsxAttributes */:
+ case 270 /* JsxSpreadAttribute */:
+ case 271 /* JsxExpression */:
// These nodes are Jsx syntax.
transformFlags |= 2 /* AssertJsx */;
break;
@@ -30682,11 +30880,11 @@
case 15 /* TemplateHead */:
case 16 /* TemplateMiddle */:
case 17 /* TemplateTail */:
- case 206 /* TemplateExpression */:
- case 193 /* TaggedTemplateExpression */:
- case 276 /* ShorthandPropertyAssignment */:
- case 116 /* StaticKeyword */:
- case 214 /* MetaProperty */:
+ case 207 /* TemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
+ case 277 /* ShorthandPropertyAssignment */:
+ case 117 /* StaticKeyword */:
+ case 215 /* MetaProperty */:
// These nodes are ES6 syntax.
transformFlags |= 128 /* AssertES2015 */;
break;
@@ -30703,103 +30901,103 @@
case 9 /* BigIntLiteral */:
transformFlags |= 4 /* AssertESNext */;
break;
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
// This node is either ES2015 syntax or ES2017 syntax (if it is a for-await-of).
if (node.awaitModifier) {
transformFlags |= 16 /* AssertES2018 */;
}
transformFlags |= 128 /* AssertES2015 */;
break;
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
// This node is either ES2015 syntax (in a generator) or ES2017 syntax (in an async
// generator).
transformFlags |= 16 /* AssertES2018 */ | 128 /* AssertES2015 */ | 131072 /* ContainsYield */;
break;
- case 120 /* AnyKeyword */:
- case 135 /* NumberKeyword */:
- case 146 /* BigIntKeyword */:
- case 132 /* NeverKeyword */:
- case 136 /* ObjectKeyword */:
- case 138 /* StringKeyword */:
- case 123 /* BooleanKeyword */:
- case 139 /* SymbolKeyword */:
- case 106 /* VoidKeyword */:
- case 150 /* TypeParameter */:
- case 153 /* PropertySignature */:
- case 155 /* MethodSignature */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
- case 163 /* TypePredicate */:
- case 164 /* TypeReference */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 167 /* TypeQuery */:
- case 168 /* TypeLiteral */:
- case 169 /* ArrayType */:
- case 170 /* TupleType */:
- case 171 /* OptionalType */:
- case 172 /* RestType */:
- case 173 /* UnionType */:
- case 174 /* IntersectionType */:
- case 175 /* ConditionalType */:
- case 176 /* InferType */:
- case 177 /* ParenthesizedType */:
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 178 /* ThisType */:
- case 179 /* TypeOperator */:
- case 180 /* IndexedAccessType */:
- case 181 /* MappedType */:
- case 182 /* LiteralType */:
- case 247 /* NamespaceExportDeclaration */:
+ case 121 /* AnyKeyword */:
+ case 136 /* NumberKeyword */:
+ case 147 /* BigIntKeyword */:
+ case 133 /* NeverKeyword */:
+ case 137 /* ObjectKeyword */:
+ case 139 /* StringKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 107 /* VoidKeyword */:
+ case 151 /* TypeParameter */:
+ case 154 /* PropertySignature */:
+ case 156 /* MethodSignature */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
+ case 164 /* TypePredicate */:
+ case 165 /* TypeReference */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 168 /* TypeQuery */:
+ case 169 /* TypeLiteral */:
+ case 170 /* ArrayType */:
+ case 171 /* TupleType */:
+ case 172 /* OptionalType */:
+ case 173 /* RestType */:
+ case 174 /* UnionType */:
+ case 175 /* IntersectionType */:
+ case 176 /* ConditionalType */:
+ case 177 /* InferType */:
+ case 178 /* ParenthesizedType */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 179 /* ThisType */:
+ case 180 /* TypeOperator */:
+ case 181 /* IndexedAccessType */:
+ case 182 /* MappedType */:
+ case 183 /* LiteralType */:
+ case 248 /* NamespaceExportDeclaration */:
// Types and signatures are TypeScript syntax, and exclude all other facts.
transformFlags = 1 /* AssertTypeScript */;
excludeFlags = -2 /* TypeExcludes */;
break;
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
// Even though computed property names are ES6, we don't treat them as such.
// This is so that they can flow through PropertyName transforms unaffected.
// Instead, we mark the container as ES6, so that it can properly handle the transform.
transformFlags |= 16384 /* ContainsComputedPropertyName */;
break;
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
transformFlags |= 128 /* AssertES2015 */ | 4096 /* ContainsRestOrSpread */;
break;
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
transformFlags |= 16 /* AssertES2018 */ | 8192 /* ContainsObjectRestOrSpread */;
break;
- case 98 /* SuperKeyword */:
+ case 99 /* SuperKeyword */:
// This node is ES6 syntax.
transformFlags |= 128 /* AssertES2015 */;
excludeFlags = 536870912 /* OuterExpressionExcludes */; // must be set to persist `Super`
break;
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
// Mark this node and its ancestors as containing a lexical `this` keyword.
transformFlags |= 2048 /* ContainsLexicalThis */;
break;
- case 184 /* ObjectBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
transformFlags |= 128 /* AssertES2015 */ | 65536 /* ContainsBindingPattern */;
if (subtreeFlags & 4096 /* ContainsRestOrSpread */) {
transformFlags |= 16 /* AssertES2018 */ | 8192 /* ContainsObjectRestOrSpread */;
}
excludeFlags = 536875008 /* BindingPatternExcludes */;
break;
- case 185 /* ArrayBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
transformFlags |= 128 /* AssertES2015 */ | 65536 /* ContainsBindingPattern */;
excludeFlags = 536875008 /* BindingPatternExcludes */;
break;
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
transformFlags |= 128 /* AssertES2015 */;
if (node.dotDotDotToken) {
transformFlags |= 4096 /* ContainsRestOrSpread */;
}
break;
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
// This node is TypeScript syntax, and marks its container as also being TypeScript syntax.
transformFlags |= 1 /* AssertTypeScript */ | 1024 /* ContainsTypeScriptClassSyntax */;
break;
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
excludeFlags = 536896512 /* ObjectLiteralExcludes */;
if (subtreeFlags & 16384 /* ContainsComputedPropertyName */) {
// If an ObjectLiteralExpression contains a ComputedPropertyName, then it
@@ -30812,26 +31010,26 @@
transformFlags |= 16 /* AssertES2018 */;
}
break;
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
excludeFlags = 536875008 /* ArrayLiteralOrCallOrNewExcludes */;
break;
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
// A loop containing a block scoped binding *may* need to be transformed from ES6.
if (subtreeFlags & 32768 /* ContainsBlockScopedBinding */) {
transformFlags |= 128 /* AssertES2015 */;
}
break;
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
break;
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
// Return statements may require an `await` in ES2018.
transformFlags |= 262144 /* ContainsHoistedDeclarationOrCompletion */ | 16 /* AssertES2018 */;
break;
- case 228 /* ContinueStatement */:
- case 229 /* BreakStatement */:
+ case 229 /* ContinueStatement */:
+ case 230 /* BreakStatement */:
transformFlags |= 262144 /* ContainsHoistedDeclarationOrCompletion */;
break;
}
@@ -30849,67 +31047,67 @@
* than calling this function.
*/
function getTransformFlagsSubtreeExclusions(kind) {
- if (kind >= 163 /* FirstTypeNode */ && kind <= 183 /* LastTypeNode */) {
+ if (kind >= 164 /* FirstTypeNode */ && kind <= 184 /* LastTypeNode */) {
return -2 /* TypeExcludes */;
}
switch (kind) {
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
- case 187 /* ArrayLiteralExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
+ case 188 /* ArrayLiteralExpression */:
return 536875008 /* ArrayLiteralOrCallOrNewExcludes */;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return 537168896 /* ModuleExcludes */;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return 536870912 /* ParameterExcludes */;
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return 537371648 /* ArrowFunctionExcludes */;
- case 196 /* FunctionExpression */:
- case 239 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
return 537373696 /* FunctionExcludes */;
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
return 536944640 /* VariableDeclarationListExcludes */;
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
return 536888320 /* ClassExcludes */;
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return 537372672 /* ConstructorExcludes */;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return 537372672 /* MethodOrAccessorExcludes */;
- case 120 /* AnyKeyword */:
- case 135 /* NumberKeyword */:
- case 146 /* BigIntKeyword */:
- case 132 /* NeverKeyword */:
- case 138 /* StringKeyword */:
- case 136 /* ObjectKeyword */:
- case 123 /* BooleanKeyword */:
- case 139 /* SymbolKeyword */:
- case 106 /* VoidKeyword */:
- case 150 /* TypeParameter */:
- case 153 /* PropertySignature */:
- case 155 /* MethodSignature */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
+ case 121 /* AnyKeyword */:
+ case 136 /* NumberKeyword */:
+ case 147 /* BigIntKeyword */:
+ case 133 /* NeverKeyword */:
+ case 139 /* StringKeyword */:
+ case 137 /* ObjectKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 107 /* VoidKeyword */:
+ case 151 /* TypeParameter */:
+ case 154 /* PropertySignature */:
+ case 156 /* MethodSignature */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return -2 /* TypeExcludes */;
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return 536896512 /* ObjectLiteralExcludes */;
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return 536879104 /* CatchClauseExcludes */;
- case 184 /* ObjectBindingPattern */:
- case 185 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
return 536875008 /* BindingPatternExcludes */;
- case 194 /* TypeAssertionExpression */:
- case 212 /* AsExpression */:
- case 313 /* PartiallyEmittedExpression */:
- case 195 /* ParenthesizedExpression */:
- case 98 /* SuperKeyword */:
+ case 195 /* TypeAssertionExpression */:
+ case 213 /* AsExpression */:
+ case 314 /* PartiallyEmittedExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 99 /* SuperKeyword */:
return 536870912 /* OuterExpressionExcludes */;
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return 536870912 /* PropertyAccessExcludes */;
default:
return 536870912 /* NodeExcludes */;
@@ -31084,7 +31282,7 @@
// (their type resolved directly to the member deeply referenced)
// So to get the intervening symbols, we need to check if there's a type
// query node on any of the symbol's declarations and get symbols there
- if (d.type && d.type.kind === 167 /* TypeQuery */) {
+ if (d.type && d.type.kind === 168 /* TypeQuery */) {
var query = d.type;
var entity = getResolvedSymbol(getFirstIdentifier(query.exprName));
visitSymbol(entity);
@@ -31183,8 +31381,6 @@
undefinedSymbol.declarations = [];
var globalThisSymbol = createSymbol(1536 /* Module */, "globalThis", 8 /* Readonly */);
globalThisSymbol.exports = globals;
- globalThisSymbol.valueDeclaration = ts.createNode(72 /* Identifier */);
- globalThisSymbol.valueDeclaration.escapedText = "globalThis";
globals.set(globalThisSymbol.escapedName, globalThisSymbol);
var argumentsSymbol = createSymbol(4 /* Property */, "arguments");
var requireSymbol = createSymbol(4 /* Property */, "require");
@@ -31200,6 +31396,11 @@
getIdentifierCount: function () { return ts.sum(host.getSourceFiles(), "identifierCount"); },
getSymbolCount: function () { return ts.sum(host.getSourceFiles(), "symbolCount") + symbolCount; },
getTypeCount: function () { return typeCount; },
+ getRelationCacheSizes: function () { return ({
+ assignable: assignableRelation.size,
+ identity: identityRelation.size,
+ subtype: subtypeRelation.size,
+ }); },
isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; },
isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; },
isUnknownSymbol: function (symbol) { return symbol === unknownSymbol; },
@@ -31266,6 +31467,10 @@
node = ts.getParseTreeNode(node);
return node ? getTypeOfNode(node) : errorType;
},
+ getTypeOfAssignmentPattern: function (nodeIn) {
+ var node = ts.getParseTreeNode(nodeIn, ts.isAssignmentPattern);
+ return node && getTypeOfAssignmentPattern(node) || errorType;
+ },
getPropertySymbolOfDestructuringAssignment: function (locationIn) {
var location = ts.getParseTreeNode(locationIn, ts.isIdentifier);
return location ? getPropertySymbolOfDestructuringAssignment(location) : undefined;
@@ -31314,11 +31519,11 @@
},
isContextSensitive: isContextSensitive,
getFullyQualifiedName: getFullyQualifiedName,
- getResolvedSignature: function (node, candidatesOutArray, agumentCount) {
- return getResolvedSignatureWorker(node, candidatesOutArray, agumentCount, 0 /* Normal */);
+ getResolvedSignature: function (node, candidatesOutArray, argumentCount) {
+ return getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0 /* Normal */);
},
- getResolvedSignatureForSignatureHelp: function (node, candidatesOutArray, agumentCount) {
- return getResolvedSignatureWorker(node, candidatesOutArray, agumentCount, 16 /* IsForSignatureHelp */);
+ getResolvedSignatureForSignatureHelp: function (node, candidatesOutArray, argumentCount) {
+ return getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */);
},
getExpandedParameters: getExpandedParameters,
hasEffectiveRestParameter: hasEffectiveRestParameter,
@@ -31461,7 +31666,7 @@
var intersectionTypes = ts.createMap();
var literalTypes = ts.createMap();
var indexedAccessTypes = ts.createMap();
- var conditionalTypes = ts.createMap();
+ var substitutionTypes = ts.createMap();
var evolvingArrayTypes = [];
var undefinedProperties = ts.createMap();
var unknownSymbol = createSymbol(4 /* Property */, "unknown");
@@ -31541,6 +31746,7 @@
* This is only used if there is no exact match.
*/
var patternAmbientModules;
+ var patternAmbientModuleAugmentations;
var globalObjectType;
var globalFunctionType;
var globalCallableFunctionType;
@@ -31575,8 +31781,7 @@
var deferredGlobalTemplateStringsArrayType;
var deferredGlobalImportMetaType;
var deferredGlobalExtractSymbol;
- var deferredGlobalExcludeSymbol;
- var deferredGlobalPickSymbol;
+ var deferredGlobalOmitSymbol;
var deferredGlobalBigIntType;
var allPotentiallyUnusedIdentifiers = ts.createMap(); // key is file name
var flowLoopStart = 0;
@@ -31595,6 +31800,8 @@
var symbolLinks = [];
var nodeLinks = [];
var flowLoopCaches = [];
+ var flowAssignmentKeys = [];
+ var flowAssignmentTypes = [];
var flowLoopNodes = [];
var flowLoopKeys = [];
var flowLoopTypes = [];
@@ -31711,6 +31918,7 @@
var typeofType = createTypeofType();
var _jsxNamespace;
var _jsxFactoryEntity;
+ var outofbandVarianceMarkerHandler;
var subtypeRelation = ts.createMap();
var assignableRelation = ts.createMap();
var comparableRelation = ts.createMap();
@@ -31735,6 +31943,18 @@
CheckMode[CheckMode["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
CheckMode[CheckMode["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
})(CheckMode || (CheckMode = {}));
+ var ContextFlags;
+ (function (ContextFlags) {
+ ContextFlags[ContextFlags["None"] = 0] = "None";
+ ContextFlags[ContextFlags["Signature"] = 1] = "Signature";
+ })(ContextFlags || (ContextFlags = {}));
+ var AccessFlags;
+ (function (AccessFlags) {
+ AccessFlags[AccessFlags["None"] = 0] = "None";
+ AccessFlags[AccessFlags["NoIndexSignatures"] = 1] = "NoIndexSignatures";
+ AccessFlags[AccessFlags["Writing"] = 2] = "Writing";
+ AccessFlags[AccessFlags["CacheSymbol"] = 4] = "CacheSymbol";
+ })(AccessFlags || (AccessFlags = {}));
var CallbackCheck;
(function (CallbackCheck) {
CallbackCheck[CallbackCheck["None"] = 0] = "None";
@@ -31909,7 +32129,8 @@
* Note: if target is transient, then it is mutable, and mergeSymbol with both mutate and return it.
* If target is not transient, mergeSymbol will produce a transient clone, mutate that and return it.
*/
- function mergeSymbol(target, source) {
+ function mergeSymbol(target, source, unidirectional) {
+ if (unidirectional === void 0) { unidirectional = false; }
if (!(target.flags & getExcludedSymbolFlags(source.flags)) ||
(source.flags | target.flags) & 67108864 /* Assignment */) {
ts.Debug.assert(source !== target);
@@ -31937,18 +32158,25 @@
if (source.members) {
if (!target.members)
target.members = ts.createSymbolTable();
- mergeSymbolTable(target.members, source.members);
+ mergeSymbolTable(target.members, source.members, unidirectional);
}
if (source.exports) {
if (!target.exports)
target.exports = ts.createSymbolTable();
- mergeSymbolTable(target.exports, source.exports);
+ mergeSymbolTable(target.exports, source.exports, unidirectional);
}
+ if (!unidirectional) {
recordMergedSymbol(target, source);
}
+ }
else if (target.flags & 1024 /* NamespaceModule */) {
+ // Do not report an error when merging `var globalThis` with the built-in `globalThis`,
+ // as we will already report a "Declaration name conflicts..." error, and this error
+ // won't make much sense.
+ if (target !== globalThisSymbol) {
error(ts.getNameOfDeclaration(source.declarations[0]), ts.Diagnostics.Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity, symbolToString(target));
}
+ }
else { // error
var isEitherEnum = !!(target.flags & 384 /* Enum */ || source.flags & 384 /* Enum */);
var isEitherBlockScoped_1 = !!(target.flags & 2 /* BlockScopedVariable */ || source.flags & 2 /* BlockScopedVariable */);
@@ -32012,10 +32240,11 @@
mergeSymbolTable(combined, second);
return combined;
}
- function mergeSymbolTable(target, source) {
+ function mergeSymbolTable(target, source, unidirectional) {
+ if (unidirectional === void 0) { unidirectional = false; }
source.forEach(function (sourceSymbol, id) {
var targetSymbol = target.get(id);
- target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol) : sourceSymbol);
+ target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : sourceSymbol);
});
}
function mergeModuleAugmentation(moduleName) {
@@ -32036,14 +32265,29 @@
var moduleNotFoundError = !(moduleName.parent.parent.flags & 4194304 /* Ambient */)
? ts.Diagnostics.Invalid_module_name_in_augmentation_module_0_cannot_be_found
: undefined;
- var mainModule = resolveExternalModuleNameWorker(moduleName, moduleName, moduleNotFoundError, /*isForAugmentation*/ true);
- if (!mainModule) {
+ var mainModule_1 = resolveExternalModuleNameWorker(moduleName, moduleName, moduleNotFoundError, /*isForAugmentation*/ true);
+ if (!mainModule_1) {
return;
}
// obtain item referenced by 'export='
- mainModule = resolveExternalModuleSymbol(mainModule);
- if (mainModule.flags & 1920 /* Namespace */) {
- mainModule = mergeSymbol(mainModule, moduleAugmentation.symbol);
+ mainModule_1 = resolveExternalModuleSymbol(mainModule_1);
+ if (mainModule_1.flags & 1920 /* Namespace */) {
+ // If we’re merging an augmentation to a pattern ambient module, we want to
+ // perform the merge unidirectionally from the augmentation ('a.foo') to
+ // the pattern ('*.foo'), so that 'getMergedSymbol()' on a.foo gives you
+ // all the exports both from the pattern and from the augmentation, but
+ // 'getMergedSymbol()' on *.foo only gives you exports from *.foo.
+ if (ts.some(patternAmbientModules, function (module) { return mainModule_1 === module.symbol; })) {
+ var merged = mergeSymbol(moduleAugmentation.symbol, mainModule_1, /*unidirectional*/ true);
+ if (!patternAmbientModuleAugmentations) {
+ patternAmbientModuleAugmentations = ts.createMap();
+ }
+ // moduleName will be a StringLiteral since this is not `declare global`.
+ patternAmbientModuleAugmentations.set(moduleName.text, merged);
+ }
+ else {
+ mergeSymbol(mainModule_1, moduleAugmentation.symbol);
+ }
}
else {
// moduleName will be a StringLiteral since this is not `declare global`.
@@ -32077,7 +32321,7 @@
return nodeLinks[nodeId] || (nodeLinks[nodeId] = { flags: 0 });
}
function isGlobalSourceFile(node) {
- return node.kind === 284 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node);
+ return node.kind === 285 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node);
}
function getSymbol(symbols, name, meaning) {
if (meaning) {
@@ -32135,17 +32379,17 @@
}
if (declaration.pos <= usage.pos) {
// declaration is before usage
- if (declaration.kind === 186 /* BindingElement */) {
+ if (declaration.kind === 187 /* BindingElement */) {
// still might be illegal if declaration and usage are both binding elements (eg var [a = b, b = b] = [1, 2])
- var errorBindingElement = ts.getAncestor(usage, 186 /* BindingElement */);
+ var errorBindingElement = ts.getAncestor(usage, 187 /* BindingElement */);
if (errorBindingElement) {
return ts.findAncestor(errorBindingElement, ts.isBindingElement) !== ts.findAncestor(declaration, ts.isBindingElement) ||
declaration.pos < errorBindingElement.pos;
}
// or it might be illegal if usage happens before parent variable is declared (eg var [a] = a)
- return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 237 /* VariableDeclaration */), usage);
+ return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 238 /* VariableDeclaration */), usage);
}
- else if (declaration.kind === 237 /* VariableDeclaration */) {
+ else if (declaration.kind === 238 /* VariableDeclaration */) {
// still might be illegal if usage is in the initializer of the variable declaration (eg var a = a)
return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage);
}
@@ -32153,6 +32397,10 @@
// still might be illegal if the usage is within a computed property name in the class (eg class A { static p = "a"; [A.p]() {} })
return !ts.findAncestor(usage, function (n) { return ts.isComputedPropertyName(n) && n.parent.parent === declaration; });
}
+ else if (ts.isPropertyDeclaration(declaration)) {
+ // still might be illegal if a self-referencing property initializer (eg private x = this.x)
+ return !isPropertyImmediatelyReferencedWithinDeclaration(declaration, usage);
+ }
return true;
}
// declaration is after usage, but it can still be legal if usage is deferred:
@@ -32164,12 +32412,12 @@
// or if usage is in a type context:
// 1. inside a type query (typeof in type position)
// 2. inside a jsdoc comment
- if (usage.parent.kind === 257 /* ExportSpecifier */ || (usage.parent.kind === 254 /* ExportAssignment */ && usage.parent.isExportEquals)) {
+ if (usage.parent.kind === 258 /* ExportSpecifier */ || (usage.parent.kind === 255 /* ExportAssignment */ && usage.parent.isExportEquals)) {
// export specifiers do not use the variable, they only make it available for use
return true;
}
// When resolving symbols for exports, the `usage` location passed in can be the export site directly
- if (usage.kind === 254 /* ExportAssignment */ && usage.isExportEquals) {
+ if (usage.kind === 255 /* ExportAssignment */ && usage.isExportEquals) {
return true;
}
var container = ts.getEnclosingBlockScopeContainer(declaration);
@@ -32177,9 +32425,9 @@
function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) {
var container = ts.getEnclosingBlockScopeContainer(declaration);
switch (declaration.parent.parent.kind) {
- case 219 /* VariableStatement */:
- case 225 /* ForStatement */:
- case 227 /* ForOfStatement */:
+ case 220 /* VariableStatement */:
+ case 226 /* ForStatement */:
+ case 228 /* ForOfStatement */:
// variable statement/for/for-of statement case,
// use site should not be inside variable declaration (initializer of declaration or binding element)
if (isSameScopeDescendentOf(usage, declaration, container)) {
@@ -32200,16 +32448,16 @@
return true;
}
var initializerOfProperty = current.parent &&
- current.parent.kind === 154 /* PropertyDeclaration */ &&
+ current.parent.kind === 155 /* PropertyDeclaration */ &&
current.parent.initializer === current;
if (initializerOfProperty) {
if (ts.hasModifier(current.parent, 32 /* Static */)) {
- if (declaration.kind === 156 /* MethodDeclaration */) {
+ if (declaration.kind === 157 /* MethodDeclaration */) {
return true;
}
}
else {
- var isDeclarationInstanceProperty = declaration.kind === 154 /* PropertyDeclaration */ && !ts.hasModifier(declaration, 32 /* Static */);
+ var isDeclarationInstanceProperty = declaration.kind === 155 /* PropertyDeclaration */ && !ts.hasModifier(declaration, 32 /* Static */);
if (!isDeclarationInstanceProperty || ts.getContainingClass(usage) !== ts.getContainingClass(declaration)) {
return true;
}
@@ -32218,6 +32466,36 @@
return false;
});
}
+ function isPropertyImmediatelyReferencedWithinDeclaration(declaration, usage) {
+ // always legal if usage is after declaration
+ if (usage.end > declaration.end) {
+ return false;
+ }
+ // still might be legal if usage is deferred (e.g. x: any = () => this.x)
+ // otherwise illegal if immediately referenced within the declaration (e.g. x: any = this.x)
+ var ancestorChangingReferenceScope = ts.findAncestor(usage, function (node) {
+ if (node === declaration) {
+ return "quit";
+ }
+ switch (node.kind) {
+ case 198 /* ArrowFunction */:
+ case 155 /* PropertyDeclaration */:
+ return true;
+ case 219 /* Block */:
+ switch (node.parent.kind) {
+ case 159 /* GetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 160 /* SetAccessor */:
+ return true;
+ default:
+ return false;
+ }
+ default:
+ return false;
+ }
+ });
+ return ancestorChangingReferenceScope === undefined;
+ }
}
/**
* Resolve a given name for a given meaning at a given location. An error is reported if the name was not found and
@@ -32236,6 +32514,8 @@
var lastLocation;
var lastSelfReferenceLocation;
var propertyWithInvalidInitializer;
+ var associatedDeclarationForContainingInitializer;
+ var withinDeferredContext = false;
var errorLocation = location;
var grandparent;
var isInExternalModule = false;
@@ -32251,12 +32531,12 @@
// - parameters are only in the scope of function body
// This restriction does not apply to JSDoc comment types because they are parented
// at a higher level than type parameters would normally be
- if (meaning & result.flags & 67897832 /* Type */ && lastLocation.kind !== 296 /* JSDocComment */) {
+ if (meaning & result.flags & 67897832 /* Type */ && lastLocation.kind !== 297 /* JSDocComment */) {
useResult = result.flags & 262144 /* TypeParameter */
// type parameters are visible in parameter list, return type and type parameter list
? lastLocation === location.type ||
- lastLocation.kind === 151 /* Parameter */ ||
- lastLocation.kind === 150 /* TypeParameter */
+ lastLocation.kind === 152 /* Parameter */ ||
+ lastLocation.kind === 151 /* TypeParameter */
// local types not visible outside the function body
: false;
}
@@ -32273,13 +32553,13 @@
// however it is detected separately when checking initializers of parameters
// to make sure that they reference no variables declared after them.
useResult =
- lastLocation.kind === 151 /* Parameter */ ||
+ lastLocation.kind === 152 /* Parameter */ ||
(lastLocation === location.type &&
!!ts.findAncestor(result.valueDeclaration, ts.isParameter));
}
}
}
- else if (location.kind === 175 /* ConditionalType */) {
+ else if (location.kind === 176 /* ConditionalType */) {
// A type parameter declared using 'infer T' in a conditional type is visible only in
// the true branch of the conditional type.
useResult = lastLocation === location.trueType;
@@ -32292,15 +32572,16 @@
}
}
}
+ withinDeferredContext = withinDeferredContext || getIsDeferredContext(location, lastLocation);
switch (location.kind) {
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
if (!ts.isExternalOrCommonJsModule(location))
break;
isInExternalModule = true;
// falls through
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
var moduleExports = getSymbolOfNode(location).exports;
- if (location.kind === 284 /* SourceFile */ || ts.isAmbientModule(location)) {
+ if (location.kind === 285 /* SourceFile */ || ts.isAmbientModule(location)) {
// It's an external module. First see if the module has an export default and if the local
// name of that export default matches.
if (result = moduleExports.get("default" /* Default */)) {
@@ -32324,7 +32605,7 @@
var moduleExport = moduleExports.get(name);
if (moduleExport &&
moduleExport.flags === 2097152 /* Alias */ &&
- ts.getDeclarationOfKind(moduleExport, 257 /* ExportSpecifier */)) {
+ ts.getDeclarationOfKind(moduleExport, 258 /* ExportSpecifier */)) {
break;
}
}
@@ -32338,20 +32619,19 @@
}
}
break;
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
if (result = lookup(getSymbolOfNode(location).exports, name, meaning & 8 /* EnumMember */)) {
break loop;
}
break;
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
// TypeScript 1.0 spec (April 2014): 8.4.1
// Initializer expressions for instance member variables are evaluated in the scope
// of the class constructor body but are not permitted to reference parameters or
// local variables of the constructor. This effectively means that entities from outer scopes
// by the same name as a constructor parameter or local variable are inaccessible
// in initializer expressions for instance member variables.
- if (ts.isClassLike(location.parent) && !ts.hasModifier(location, 32 /* Static */)) {
+ if (!ts.hasModifier(location, 32 /* Static */)) {
var ctor = findConstructorDeclaration(location.parent);
if (ctor && ctor.locals) {
if (lookup(ctor.locals, name, meaning & 67220415 /* Value */)) {
@@ -32361,9 +32641,9 @@
}
}
break;
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
// The below is used to lookup type parameters within a class or interface, as they are added to the class/interface locals
// These can never be latebound, so the symbol's raw members are sufficient. `getMembersOfNode` cannot be used, as it would
// trigger resolving late-bound names, which we may already be in the process of doing while we're here!
@@ -32382,7 +32662,7 @@
}
break loop;
}
- if (location.kind === 209 /* ClassExpression */ && meaning & 32 /* Class */) {
+ if (location.kind === 210 /* ClassExpression */ && meaning & 32 /* Class */) {
var className = location.name;
if (className && name === className.escapedText) {
result = location.symbol;
@@ -32390,9 +32670,9 @@
}
}
break;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
// The type parameters of a class are not in scope in the base class expression.
- if (lastLocation === location.expression && location.parent.token === 86 /* ExtendsKeyword */) {
+ if (lastLocation === location.expression && location.parent.token === 87 /* ExtendsKeyword */) {
var container = location.parent.parent;
if (ts.isClassLike(container) && (result = lookup(getSymbolOfNode(container).members, name, meaning & 67897832 /* Type */))) {
if (nameNotFoundMessage) {
@@ -32410,9 +32690,9 @@
// [foo<T>()]() { } // <-- Reference to T from class's own computed property
// }
//
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
grandparent = location.parent.parent;
- if (ts.isClassLike(grandparent) || grandparent.kind === 241 /* InterfaceDeclaration */) {
+ if (ts.isClassLike(grandparent) || grandparent.kind === 242 /* InterfaceDeclaration */) {
// A reference to this grandparent's type parameters would be an error
if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 67897832 /* Type */)) {
error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
@@ -32420,24 +32700,24 @@
}
}
break;
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
// when targeting ES6 or higher there is no 'arguments' in an arrow function
// for lower compile targets the resolved symbol is used to emit an error
if (compilerOptions.target >= 2 /* ES2015 */) {
break;
}
// falls through
- case 156 /* MethodDeclaration */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 239 /* FunctionDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 240 /* FunctionDeclaration */:
if (meaning & 3 /* Variable */ && name === "arguments") {
result = argumentsSymbol;
break loop;
}
break;
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
if (meaning & 3 /* Variable */ && name === "arguments") {
result = argumentsSymbol;
break loop;
@@ -32450,7 +32730,7 @@
}
}
break;
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
// Decorators are resolved at the class declaration. Resolving at the parameter
// or member would result in looking up locals in the method.
//
@@ -32459,7 +32739,7 @@
// method(@y x, y) {} // <-- decorator y should be resolved at the class declaration, not the parameter.
// }
//
- if (location.parent && location.parent.kind === 151 /* Parameter */) {
+ if (location.parent && location.parent.kind === 152 /* Parameter */) {
location = location.parent;
}
//
@@ -32474,15 +32754,28 @@
// declare function y(x: T): any;
// @param(1 as T) // <-- T should resolve to the type alias outside of class C
// class C<T> {}
- if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 240 /* ClassDeclaration */)) {
+ if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 241 /* ClassDeclaration */)) {
location = location.parent;
}
break;
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
// js type aliases do not resolve names from their host, so skip past it
location = ts.getJSDocHost(location);
break;
+ case 152 /* Parameter */:
+ if (lastLocation && lastLocation === location.initializer) {
+ associatedDeclarationForContainingInitializer = location;
+ }
+ break;
+ case 187 /* BindingElement */:
+ if (lastLocation && lastLocation === location.initializer) {
+ var root = ts.getRootDeclaration(location);
+ if (root.kind === 152 /* Parameter */) {
+ associatedDeclarationForContainingInitializer = location;
+ }
+ }
+ break;
}
if (isSelfReferenceLocation(location)) {
lastSelfReferenceLocation = location;
@@ -32498,7 +32791,7 @@
}
if (!result) {
if (lastLocation) {
- ts.Debug.assert(lastLocation.kind === 284 /* SourceFile */);
+ ts.Debug.assert(lastLocation.kind === 285 /* SourceFile */);
if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) {
return lastLocation.symbol;
}
@@ -32574,20 +32867,48 @@
if (result && isInExternalModule && (meaning & 67220415 /* Value */) === 67220415 /* Value */ && !(originalLocation.flags & 2097152 /* JSDoc */)) {
var merged = getMergedSymbol(result);
if (ts.length(merged.declarations) && ts.every(merged.declarations, function (d) { return ts.isNamespaceExportDeclaration(d) || ts.isSourceFile(d) && !!d.symbol.globalExports; })) {
- error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, ts.unescapeLeadingUnderscores(name)); // TODO: GH#18217
+ errorOrSuggestion(!compilerOptions.allowUmdGlobalAccess, errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, ts.unescapeLeadingUnderscores(name));
+ }
+ }
+ // If we're in a parameter initializer, we can't reference the values of the parameter whose initializer we're within or parameters to the right
+ if (result && associatedDeclarationForContainingInitializer && !withinDeferredContext && (meaning & 67220415 /* Value */) === 67220415 /* Value */) {
+ var candidate = getMergedSymbol(getLateBoundSymbol(result));
+ var root = ts.getRootDeclaration(associatedDeclarationForContainingInitializer);
+ // A parameter initializer or binding pattern initializer within a parameter cannot refer to itself
+ if (candidate === getSymbolOfNode(associatedDeclarationForContainingInitializer)) {
+ error(errorLocation, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(associatedDeclarationForContainingInitializer.name));
+ }
+ // And it cannot refer to any declarations which come after it
+ else if (candidate.valueDeclaration && candidate.valueDeclaration.pos > associatedDeclarationForContainingInitializer.pos && root.parent.locals && lookup(root.parent.locals, candidate.escapedName, meaning) === candidate) {
+ error(errorLocation, ts.Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(associatedDeclarationForContainingInitializer.name), ts.declarationNameToString(errorLocation));
}
}
}
return result;
}
+ function getIsDeferredContext(location, lastLocation) {
+ if (location.kind !== 198 /* ArrowFunction */ && location.kind !== 197 /* FunctionExpression */) {
+ // initializers in instance property declaration of class like entities are executed in constructor and thus deferred
+ return ts.isTypeQueryNode(location) || ((ts.isFunctionLikeDeclaration(location) ||
+ (location.kind === 155 /* PropertyDeclaration */ && !ts.hasModifier(location, 32 /* Static */))) && (!lastLocation || lastLocation !== location.name)); // A name is evaluated within the enclosing scope - so it shouldn't count as deferred
+ }
+ if (lastLocation && lastLocation === location.name) {
+ return false;
+ }
+ // generator functions and async functions are not inlined in control flow when immediately invoked
+ if (location.asteriskToken || ts.hasModifier(location, 256 /* Async */)) {
+ return true;
+ }
+ return !ts.getImmediatelyInvokedFunctionExpression(location);
+ }
function isSelfReferenceLocation(node) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 244 /* ModuleDeclaration */: // For `namespace N { N; }`
+ case 240 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 245 /* ModuleDeclaration */: // For `namespace N { N; }`
return true;
default:
return false;
@@ -32599,7 +32920,7 @@
function isTypeParameterSymbolDeclaredInContainer(symbol, container) {
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var decl = _a[_i];
- if (decl.kind === 150 /* TypeParameter */) {
+ if (decl.kind === 151 /* TypeParameter */) {
var parent = ts.isJSDocTemplateTag(decl.parent) ? ts.getJSDocHost(decl.parent) : decl.parent;
if (parent === container) {
return !(ts.isJSDocTemplateTag(decl.parent) && ts.find(decl.parent.parent.tags, ts.isJSDocTypeAlias)); // TODO: GH#18217
@@ -32654,10 +32975,10 @@
*/
function getEntityNameForExtendingInterface(node) {
switch (node.kind) {
- case 72 /* Identifier */:
- case 189 /* PropertyAccessExpression */:
+ case 73 /* Identifier */:
+ case 190 /* PropertyAccessExpression */:
return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
if (ts.isEntityNameExpression(node.expression)) {
return node.expression;
}
@@ -32746,7 +33067,7 @@
function checkResolvedBlockScopedVariable(result, errorLocation) {
ts.Debug.assert(!!(result.flags & 2 /* BlockScopedVariable */ || result.flags & 32 /* Class */ || result.flags & 384 /* Enum */));
// Block-scoped variables cannot be used before their definition
- var declaration = ts.find(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 243 /* EnumDeclaration */) || ts.isInJSFile(d) && !!ts.getJSDocEnumTag(d); });
+ var declaration = ts.find(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 244 /* EnumDeclaration */) || ts.isInJSFile(d) && !!ts.getJSDocEnumTag(d); });
if (declaration === undefined)
return ts.Debug.fail("Declaration to checkResolvedBlockScopedVariable is undefined");
if (!(declaration.flags & 4194304 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) {
@@ -32781,13 +33102,13 @@
}
function getAnyImportSyntax(node) {
switch (node.kind) {
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return node;
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
return node.parent;
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
return node.parent.parent;
- case 253 /* ImportSpecifier */:
+ case 254 /* ImportSpecifier */:
return node.parent.parent.parent;
default:
return undefined;
@@ -32797,7 +33118,7 @@
return ts.find(symbol.declarations, ts.isAliasSymbolDeclaration);
}
function getTargetOfImportEqualsDeclaration(node, dontResolveAlias) {
- if (node.moduleReference.kind === 259 /* ExternalModuleReference */) {
+ if (node.moduleReference.kind === 260 /* ExternalModuleReference */) {
return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node)));
}
return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, dontResolveAlias);
@@ -32854,8 +33175,17 @@
var file = ts.find(moduleSymbol.declarations, ts.isSourceFile);
var hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias);
if (!exportDefaultSymbol && !hasSyntheticDefault) {
+ if (hasExportAssignmentSymbol(moduleSymbol)) {
+ var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop";
+ var exportEqualsSymbol = moduleSymbol.exports.get("export=" /* ExportEquals */);
+ var exportAssignment = exportEqualsSymbol.valueDeclaration;
+ var err = error(node.name, ts.Diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag, symbolToString(moduleSymbol), compilerOptionName);
+ ts.addRelatedInfo(err, ts.createDiagnosticForNode(exportAssignment, ts.Diagnostics.This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag, compilerOptionName));
+ }
+ else {
error(node.name, ts.Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol));
}
+ }
else if (hasSyntheticDefault) {
// per emit behavior, a synthetic default overrides a "real" .default member if `__esModule` is not present
return resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
@@ -32989,20 +33319,20 @@
function getTargetOfAliasDeclaration(node, dontRecursivelyResolve) {
if (dontRecursivelyResolve === void 0) { dontRecursivelyResolve = false; }
switch (node.kind) {
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return getTargetOfImportEqualsDeclaration(node, dontRecursivelyResolve);
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
return getTargetOfImportClause(node, dontRecursivelyResolve);
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
return getTargetOfNamespaceImport(node, dontRecursivelyResolve);
- case 253 /* ImportSpecifier */:
+ case 254 /* ImportSpecifier */:
return getTargetOfImportSpecifier(node, dontRecursivelyResolve);
- case 257 /* ExportSpecifier */:
+ case 258 /* ExportSpecifier */:
return getTargetOfExportSpecifier(node, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */, dontRecursivelyResolve);
- case 254 /* ExportAssignment */:
- case 204 /* BinaryExpression */:
+ case 255 /* ExportAssignment */:
+ case 205 /* BinaryExpression */:
return getTargetOfExportAssignment(node, dontRecursivelyResolve);
- case 247 /* NamespaceExportDeclaration */:
+ case 248 /* NamespaceExportDeclaration */:
return getTargetOfNamespaceExportDeclaration(node, dontRecursivelyResolve);
default:
return ts.Debug.fail();
@@ -33063,11 +33393,11 @@
var node = getDeclarationOfAliasSymbol(symbol);
if (!node)
return ts.Debug.fail();
- if (node.kind === 254 /* ExportAssignment */) {
+ if (node.kind === 255 /* ExportAssignment */) {
// export default <symbol>
checkExpressionCached(node.expression);
}
- else if (node.kind === 257 /* ExportSpecifier */) {
+ else if (node.kind === 258 /* ExportSpecifier */) {
// export { <symbol> } or export { <symbol> as foo }
checkExpressionCached(node.propertyName || node.name);
}
@@ -33085,17 +33415,17 @@
// import a = |b|; // Namespace
// import a = |b.c|; // Value, type, namespace
// import a = |b.c|.d; // Namespace
- if (entityName.kind === 72 /* Identifier */ && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {
+ if (entityName.kind === 73 /* Identifier */ && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {
entityName = entityName.parent;
}
// Check for case 1 and 3 in the above example
- if (entityName.kind === 72 /* Identifier */ || entityName.parent.kind === 148 /* QualifiedName */) {
+ if (entityName.kind === 73 /* Identifier */ || entityName.parent.kind === 149 /* QualifiedName */) {
return resolveEntityName(entityName, 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias);
}
else {
// Case 2 in above example
// entityName.kind could be a QualifiedName or a Missing identifier
- ts.Debug.assert(entityName.parent.kind === 248 /* ImportEqualsDeclaration */);
+ ts.Debug.assert(entityName.parent.kind === 249 /* ImportEqualsDeclaration */);
return resolveEntityName(entityName, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias);
}
}
@@ -33111,17 +33441,17 @@
}
var namespaceMeaning = 1920 /* Namespace */ | (ts.isInJSFile(name) ? meaning & 67220415 /* Value */ : 0);
var symbol;
- if (name.kind === 72 /* Identifier */) {
- var message = meaning === namespaceMeaning ? ts.Diagnostics.Cannot_find_namespace_0 : getCannotFindNameDiagnosticForName(getFirstIdentifier(name).escapedText);
+ if (name.kind === 73 /* Identifier */) {
+ var message = meaning === namespaceMeaning ? ts.Diagnostics.Cannot_find_namespace_0 : getCannotFindNameDiagnosticForName(getFirstIdentifier(name));
var symbolFromJSPrototype = ts.isInJSFile(name) ? resolveEntityNameFromAssignmentDeclaration(name, meaning) : undefined;
symbol = resolveName(location || name, name.escapedText, meaning, ignoreErrors || symbolFromJSPrototype ? undefined : message, name, /*isUse*/ true);
if (!symbol) {
return symbolFromJSPrototype;
}
}
- else if (name.kind === 148 /* QualifiedName */ || name.kind === 189 /* PropertyAccessExpression */) {
- var left = name.kind === 148 /* QualifiedName */ ? name.left : name.expression;
- var right = name.kind === 148 /* QualifiedName */ ? name.right : name.name;
+ else if (name.kind === 149 /* QualifiedName */ || name.kind === 190 /* PropertyAccessExpression */) {
+ var left = name.kind === 149 /* QualifiedName */ ? name.left : name.expression;
+ var right = name.kind === 149 /* QualifiedName */ ? name.right : name.name;
var namespace = resolveEntityName(left, namespaceMeaning, ignoreErrors, /*dontResolveAlias*/ false, location);
if (!namespace || ts.nodeIsMissing(right)) {
return undefined;
@@ -33256,6 +33586,14 @@
if (patternAmbientModules) {
var pattern = ts.findBestPatternMatch(patternAmbientModules, function (_) { return _.pattern; }, moduleReference);
if (pattern) {
+ // If the module reference matched a pattern ambient module ('*.foo') but there’s also a
+ // module augmentation by the specific name requested ('a.foo'), we store the merged symbol
+ // by the augmentation name ('a.foo'), because asking for *.foo should not give you exports
+ // from a.foo.
+ var augmentation = patternAmbientModuleAugmentations && patternAmbientModuleAugmentations.get(moduleReference);
+ if (augmentation) {
+ return getMergedSymbol(augmentation);
+ }
return getMergedSymbol(pattern.symbol);
}
}
@@ -33346,7 +33684,7 @@
function resolveESModuleSymbol(moduleSymbol, referencingLocation, dontResolveAlias) {
var symbol = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias);
if (!dontResolveAlias && symbol) {
- if (!(symbol.flags & (1536 /* Module */ | 3 /* Variable */)) && !ts.getDeclarationOfKind(symbol, 284 /* SourceFile */)) {
+ if (!(symbol.flags & (1536 /* Module */ | 3 /* Variable */)) && !ts.getDeclarationOfKind(symbol, 285 /* SourceFile */)) {
var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015
? "allowSyntheticDefaultImports"
: "esModuleInterop";
@@ -33608,7 +33946,7 @@
var members = node.members;
for (var _i = 0, members_2 = members; _i < members_2.length; _i++) {
var member = members_2[_i];
- if (member.kind === 157 /* Constructor */ && ts.nodeIsPresent(member.body)) {
+ if (member.kind === 158 /* Constructor */ && ts.nodeIsPresent(member.body)) {
return member;
}
}
@@ -33654,7 +33992,7 @@
return type;
}
// A reserved member name starts with two underscores, but the third character cannot be an underscore
- // or the @ symbol. A third underscore indicates an escaped form of an identifer that started
+ // or the @ symbol. A third underscore indicates an escaped form of an identifier that started
// with at least two underscores. The @ character indicates that the name is denoted by a well known ES
// Symbol instance.
function isReservedMemberName(name) {
@@ -33694,12 +34032,12 @@
}
}
switch (location.kind) {
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
if (!ts.isExternalOrCommonJsModule(location)) {
break;
}
// falls through
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
if (result = callback(getSymbolOfNode(location).exports)) {
return result;
}
@@ -33763,7 +34101,7 @@
&& (!useOnlyExternalAliasing || ts.some(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration))
// While exports are generally considered to be in scope, export-specifier declared symbols are _not_
// See similar comment in `resolveName` for details
- && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 257 /* ExportSpecifier */))) {
+ && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 258 /* ExportSpecifier */))) {
var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable);
if (isAccessible(symbolFromSymbolTable, resolvedImportedSymbol, ignoreQualification)) {
return [symbolFromSymbolTable];
@@ -33799,7 +34137,7 @@
return true;
}
// Qualify if the symbol from symbol table has same meaning as expected
- symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 257 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable;
+ symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 258 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable;
if (symbolFromSymbolTable.flags & meaning) {
qualify = true;
return true;
@@ -33814,10 +34152,10 @@
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
switch (declaration.kind) {
- case 154 /* PropertyDeclaration */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 155 /* PropertyDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
continue;
default:
return false;
@@ -33873,7 +34211,7 @@
var containers = getContainersOfSymbol(symbol, enclosingDeclaration);
// If we're trying to reference some object literal in, eg `var a = { x: 1 }`, the symbol for the literal, `__object`, is distinct
// from the symbol of the declaration it is being assigned to. Since we can use the declaration to refer to the literal, however,
- // we'd like to make that connection here - potentially causing us to paint the declararation's visibiility, and therefore the literal.
+ // we'd like to make that connection here - potentially causing us to paint the declaration's visibility, and therefore the literal.
var firstDecl = ts.first(symbol.declarations);
if (!ts.length(containers) && meaning & 67220415 /* Value */ && firstDecl && ts.isObjectLiteralExpression(firstDecl)) {
if (firstDecl.parent && ts.isVariableDeclaration(firstDecl.parent) && firstDecl === firstDecl.parent.initializer) {
@@ -33934,10 +34272,10 @@
return node && getSymbolOfNode(node);
}
function hasExternalModuleSymbol(declaration) {
- return ts.isAmbientModule(declaration) || (declaration.kind === 284 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration));
+ return ts.isAmbientModule(declaration) || (declaration.kind === 285 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration));
}
function hasNonGlobalAugmentationExternalModuleSymbol(declaration) {
- return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 284 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration));
+ return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 285 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration));
}
function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) {
var aliasesToMakeVisible;
@@ -33984,14 +34322,14 @@
function isEntityNameVisible(entityName, enclosingDeclaration) {
// get symbol of the first identifier of the entityName
var meaning;
- if (entityName.parent.kind === 167 /* TypeQuery */ ||
+ if (entityName.parent.kind === 168 /* TypeQuery */ ||
ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent) ||
- entityName.parent.kind === 149 /* ComputedPropertyName */) {
+ entityName.parent.kind === 150 /* ComputedPropertyName */) {
// Typeof value
meaning = 67220415 /* Value */ | 1048576 /* ExportValue */;
}
- else if (entityName.kind === 148 /* QualifiedName */ || entityName.kind === 189 /* PropertyAccessExpression */ ||
- entityName.parent.kind === 248 /* ImportEqualsDeclaration */) {
+ else if (entityName.kind === 149 /* QualifiedName */ || entityName.kind === 190 /* PropertyAccessExpression */ ||
+ entityName.parent.kind === 249 /* ImportEqualsDeclaration */) {
// Left identifier from type reference or TypeAlias
// Entity name of the import declaration
meaning = 1920 /* Namespace */;
@@ -34040,10 +34378,10 @@
function signatureToStringWorker(writer) {
var sigOutput;
if (flags & 262144 /* WriteArrowStyleSignature */) {
- sigOutput = kind === 1 /* Construct */ ? 166 /* ConstructorType */ : 165 /* FunctionType */;
+ sigOutput = kind === 1 /* Construct */ ? 167 /* ConstructorType */ : 166 /* FunctionType */;
}
else {
- sigOutput = kind === 1 /* Construct */ ? 161 /* ConstructSignature */ : 160 /* CallSignature */;
+ sigOutput = kind === 1 /* Construct */ ? 162 /* ConstructSignature */ : 161 /* CallSignature */;
}
var sig = nodeBuilder.signatureToSignatureDeclaration(signature, sigOutput, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | 512 /* WriteTypeParametersInQualifiedName */);
var printer = ts.createPrinter({ removeComments: true, omitTrailingSemicolon: true });
@@ -34070,6 +34408,15 @@
}
return result;
}
+ function getTypeNamesForErrorDisplay(left, right) {
+ var leftStr = typeToString(left);
+ var rightStr = typeToString(right);
+ if (leftStr === rightStr) {
+ leftStr = typeToString(left, /*enclosingDeclaration*/ undefined, 64 /* UseFullyQualifiedType */);
+ rightStr = typeToString(right, /*enclosingDeclaration*/ undefined, 64 /* UseFullyQualifiedType */);
+ }
+ return [leftStr, rightStr];
+ }
function toNodeBuilderFlags(flags) {
if (flags === void 0) { flags = 0 /* None */; }
return flags & 9469291 /* NodeBuilderFlagsMask */;
@@ -34138,26 +34485,26 @@
}
if (type.flags & 1 /* Any */) {
context.approximateLength += 3;
- return ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ return ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
if (type.flags & 2 /* Unknown */) {
- return ts.createKeywordTypeNode(143 /* UnknownKeyword */);
+ return ts.createKeywordTypeNode(144 /* UnknownKeyword */);
}
if (type.flags & 4 /* String */) {
context.approximateLength += 6;
- return ts.createKeywordTypeNode(138 /* StringKeyword */);
+ return ts.createKeywordTypeNode(139 /* StringKeyword */);
}
if (type.flags & 8 /* Number */) {
context.approximateLength += 6;
- return ts.createKeywordTypeNode(135 /* NumberKeyword */);
+ return ts.createKeywordTypeNode(136 /* NumberKeyword */);
}
if (type.flags & 64 /* BigInt */) {
context.approximateLength += 6;
- return ts.createKeywordTypeNode(146 /* BigIntKeyword */);
+ return ts.createKeywordTypeNode(147 /* BigIntKeyword */);
}
if (type.flags & 16 /* Boolean */) {
context.approximateLength += 7;
- return ts.createKeywordTypeNode(123 /* BooleanKeyword */);
+ return ts.createKeywordTypeNode(124 /* BooleanKeyword */);
}
if (type.flags & 1024 /* EnumLiteral */ && !(type.flags & 1048576 /* Union */)) {
var parentSymbol = getParentOfSymbol(type.symbol);
@@ -34175,8 +34522,9 @@
return ts.createLiteralTypeNode(ts.setEmitFlags(ts.createLiteral(type.value), 16777216 /* NoAsciiEscaping */));
}
if (type.flags & 256 /* NumberLiteral */) {
- context.approximateLength += (("" + type.value).length);
- return ts.createLiteralTypeNode((ts.createLiteral(type.value)));
+ var value = type.value;
+ context.approximateLength += ("" + value).length;
+ return ts.createLiteralTypeNode(value < 0 ? ts.createPrefix(39 /* MinusToken */, ts.createLiteral(-value)) : ts.createLiteral(value));
}
if (type.flags & 2048 /* BigIntLiteral */) {
context.approximateLength += (ts.pseudoBigIntToString(type.value).length) + 1;
@@ -34197,33 +34545,33 @@
}
}
context.approximateLength += 13;
- return ts.createTypeOperatorNode(142 /* UniqueKeyword */, ts.createKeywordTypeNode(139 /* SymbolKeyword */));
+ return ts.createTypeOperatorNode(143 /* UniqueKeyword */, ts.createKeywordTypeNode(140 /* SymbolKeyword */));
}
if (type.flags & 16384 /* Void */) {
context.approximateLength += 4;
- return ts.createKeywordTypeNode(106 /* VoidKeyword */);
+ return ts.createKeywordTypeNode(107 /* VoidKeyword */);
}
if (type.flags & 32768 /* Undefined */) {
context.approximateLength += 9;
- return ts.createKeywordTypeNode(141 /* UndefinedKeyword */);
+ return ts.createKeywordTypeNode(142 /* UndefinedKeyword */);
}
if (type.flags & 65536 /* Null */) {
context.approximateLength += 4;
- return ts.createKeywordTypeNode(96 /* NullKeyword */);
+ return ts.createKeywordTypeNode(97 /* NullKeyword */);
}
if (type.flags & 131072 /* Never */) {
context.approximateLength += 5;
- return ts.createKeywordTypeNode(132 /* NeverKeyword */);
+ return ts.createKeywordTypeNode(133 /* NeverKeyword */);
}
if (type.flags & 4096 /* ESSymbol */) {
context.approximateLength += 6;
- return ts.createKeywordTypeNode(139 /* SymbolKeyword */);
+ return ts.createKeywordTypeNode(140 /* SymbolKeyword */);
}
if (type.flags & 67108864 /* NonPrimitive */) {
context.approximateLength += 6;
- return ts.createKeywordTypeNode(136 /* ObjectKeyword */);
+ return ts.createKeywordTypeNode(137 /* ObjectKeyword */);
}
- if (type.flags & 262144 /* TypeParameter */ && type.isThisType) {
+ if (isThisTypeParameter(type)) {
if (context.flags & 4194304 /* InObjectTypeLiteral */) {
if (!context.encounteredError && !(context.flags & 32768 /* AllowThisInObjectLiteral */)) {
context.encounteredError = true;
@@ -34273,7 +34621,7 @@
}
var typeNodes = mapToTypeNodes(types, context, /*isBareList*/ true);
if (typeNodes && typeNodes.length > 0) {
- var unionOrIntersectionTypeNode = ts.createUnionOrIntersectionTypeNode(type.flags & 1048576 /* Union */ ? 173 /* UnionType */ : 174 /* IntersectionType */, typeNodes);
+ var unionOrIntersectionTypeNode = ts.createUnionOrIntersectionTypeNode(type.flags & 1048576 /* Union */ ? 174 /* UnionType */ : 175 /* IntersectionType */, typeNodes);
return unionOrIntersectionTypeNode;
}
else {
@@ -34306,8 +34654,8 @@
context.inferTypeParameters = type.root.inferTypeParameters;
var extendsTypeNode = typeToTypeNodeHelper(type.extendsType, context);
context.inferTypeParameters = saveInferTypeParameters;
- var trueTypeNode = typeToTypeNodeHelper(type.trueType, context);
- var falseTypeNode = typeToTypeNodeHelper(type.falseType, context);
+ var trueTypeNode = typeToTypeNodeHelper(getTrueTypeFromConditionalType(type), context);
+ var falseTypeNode = typeToTypeNodeHelper(getFalseTypeFromConditionalType(type), context);
context.approximateLength += 15;
return ts.createConditionalTypeNode(checkTypeNode, extendsTypeNode, trueTypeNode, falseTypeNode);
}
@@ -34347,7 +34695,7 @@
return symbolToTypeNode(symbol, context, isInstanceType);
}
// Always use 'typeof T' for type of class, enum, and module objects
- else if (symbol.flags & 32 /* Class */ && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration.kind === 209 /* ClassExpression */ && context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */) ||
+ else if (symbol.flags & 32 /* Class */ && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration.kind === 210 /* ClassExpression */ && context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */) ||
symbol.flags & (384 /* Enum */ | 512 /* ValueModule */) ||
shouldWriteTypeOfFunctionSymbol()) {
return symbolToTypeNode(symbol, context, 67220415 /* Value */);
@@ -34394,7 +34742,7 @@
var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) &&
(symbol.parent || // is exported function symbol
ts.forEach(symbol.declarations, function (declaration) {
- return declaration.parent.kind === 284 /* SourceFile */ || declaration.parent.kind === 245 /* ModuleBlock */;
+ return declaration.parent.kind === 285 /* SourceFile */ || declaration.parent.kind === 246 /* ModuleBlock */;
}));
if (isStaticMethodSymbol || isNonLocalFunctionSymbol) {
// typeof is allowed only for static/non local functions
@@ -34415,12 +34763,12 @@
}
if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) {
var signature = resolved.callSignatures[0];
- var signatureNode = signatureToSignatureDeclarationHelper(signature, 165 /* FunctionType */, context);
+ var signatureNode = signatureToSignatureDeclarationHelper(signature, 166 /* FunctionType */, context);
return signatureNode;
}
if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) {
var signature = resolved.constructSignatures[0];
- var signatureNode = signatureToSignatureDeclarationHelper(signature, 166 /* ConstructorType */, context);
+ var signatureNode = signatureToSignatureDeclarationHelper(signature, 167 /* ConstructorType */, context);
return signatureNode;
}
}
@@ -34441,7 +34789,7 @@
}
var elementType = typeToTypeNodeHelper(typeArguments[0], context);
var arrayType = ts.createArrayTypeNode(elementType);
- return type.target === globalArrayType ? arrayType : ts.createTypeOperatorNode(133 /* ReadonlyKeyword */, arrayType);
+ return type.target === globalArrayType ? arrayType : ts.createTypeOperatorNode(134 /* ReadonlyKeyword */, arrayType);
}
else if (type.target.objectFlags & 8 /* Tuple */) {
if (typeArguments.length > 0) {
@@ -34455,12 +34803,12 @@
ts.createOptionalTypeNode(tupleConstituentNodes[i]);
}
var tupleTypeNode = ts.createTupleTypeNode(tupleConstituentNodes);
- return type.target.readonly ? ts.createTypeOperatorNode(133 /* ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode;
+ return type.target.readonly ? ts.createTypeOperatorNode(134 /* ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode;
}
}
if (context.encounteredError || (context.flags & 524288 /* AllowEmptyTuple */)) {
var tupleTypeNode = ts.createTupleTypeNode([]);
- return type.target.readonly ? ts.createTypeOperatorNode(133 /* ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode;
+ return type.target.readonly ? ts.createTypeOperatorNode(134 /* ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode;
}
context.encounteredError = true;
return undefined; // TODO: GH#18217
@@ -34555,11 +34903,11 @@
var typeElements = [];
for (var _i = 0, _a = resolvedType.callSignatures; _i < _a.length; _i++) {
var signature = _a[_i];
- typeElements.push(signatureToSignatureDeclarationHelper(signature, 160 /* CallSignature */, context));
+ typeElements.push(signatureToSignatureDeclarationHelper(signature, 161 /* CallSignature */, context));
}
for (var _b = 0, _c = resolvedType.constructSignatures; _b < _c.length; _b++) {
var signature = _c[_b];
- typeElements.push(signatureToSignatureDeclarationHelper(signature, 161 /* ConstructSignature */, context));
+ typeElements.push(signatureToSignatureDeclarationHelper(signature, 162 /* ConstructSignature */, context));
}
if (resolvedType.stringIndexInfo) {
var indexSignature = void 0;
@@ -34606,15 +34954,15 @@
if (!(context.flags & 1 /* NoTruncation */)) {
return ts.createTypeReferenceNode(ts.createIdentifier("..."), /*typeArguments*/ undefined);
}
- return ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ return ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
function addPropertyToElementList(propertySymbol, context, typeElements) {
- var propertyIsReverseMapped = !!(ts.getCheckFlags(propertySymbol) & 4096 /* ReverseMapped */);
+ var propertyIsReverseMapped = !!(ts.getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */);
var propertyType = propertyIsReverseMapped && context.flags & 33554432 /* InReverseMappedType */ ?
anyType : getTypeOfSymbol(propertySymbol);
var saveEnclosingDeclaration = context.enclosingDeclaration;
context.enclosingDeclaration = undefined;
- if (context.tracker.trackSymbol && ts.getCheckFlags(propertySymbol) & 2048 /* Late */) {
+ if (context.tracker.trackSymbol && ts.getCheckFlags(propertySymbol) & 4096 /* Late */) {
var decl = ts.first(propertySymbol.declarations);
if (hasLateBindableName(decl)) {
trackComputedName(decl.name, saveEnclosingDeclaration, context);
@@ -34628,7 +34976,7 @@
var signatures = getSignaturesOfType(propertyType, 0 /* Call */);
for (var _i = 0, signatures_1 = signatures; _i < signatures_1.length; _i++) {
var signature = signatures_1[_i];
- var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 155 /* MethodSignature */, context);
+ var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 156 /* MethodSignature */, context);
methodDeclaration.name = propertyName;
methodDeclaration.questionToken = optionalToken;
if (propertySymbol.valueDeclaration) {
@@ -34646,10 +34994,10 @@
propertyTypeNode = createElidedInformationPlaceholder(context);
}
else {
- propertyTypeNode = propertyType ? typeToTypeNodeHelper(propertyType, context) : ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ propertyTypeNode = propertyType ? typeToTypeNodeHelper(propertyType, context) : ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
context.flags = savedFlags;
- var modifiers = isReadonlySymbol(propertySymbol) ? [ts.createToken(133 /* ReadonlyKeyword */)] : undefined;
+ var modifiers = isReadonlySymbol(propertySymbol) ? [ts.createToken(134 /* ReadonlyKeyword */)] : undefined;
if (modifiers) {
context.approximateLength += 9;
}
@@ -34700,7 +35048,7 @@
}
function indexInfoToIndexSignatureDeclarationHelper(indexInfo, kind, context) {
var name = ts.getNameFromIndexInfo(indexInfo) || "x";
- var indexerTypeNode = ts.createKeywordTypeNode(kind === 0 /* String */ ? 138 /* StringKeyword */ : 135 /* NumberKeyword */);
+ var indexerTypeNode = ts.createKeywordTypeNode(kind === 0 /* String */ ? 139 /* StringKeyword */ : 136 /* NumberKeyword */);
var indexingParameter = ts.createParameter(
/*decorators*/ undefined,
/*modifiers*/ undefined,
@@ -34713,7 +35061,7 @@
}
context.approximateLength += (name.length + 4);
return ts.createIndexSignature(
- /*decorators*/ undefined, indexInfo.isReadonly ? [ts.createToken(133 /* ReadonlyKeyword */)] : undefined, [indexingParameter], typeNode);
+ /*decorators*/ undefined, indexInfo.isReadonly ? [ts.createToken(134 /* ReadonlyKeyword */)] : undefined, [indexingParameter], typeNode);
}
function signatureToSignatureDeclarationHelper(signature, kind, context) {
var typeParameters;
@@ -34724,7 +35072,7 @@
else {
typeParameters = signature.typeParameters && signature.typeParameters.map(function (parameter) { return typeParameterToDeclaration(parameter, context); });
}
- var parameters = getExpandedParameters(signature).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 157 /* Constructor */); });
+ var parameters = getExpandedParameters(signature).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 158 /* Constructor */); });
if (signature.thisParameter) {
var thisParameter = symbolToParameterDeclaration(signature.thisParameter, context);
parameters.unshift(thisParameter);
@@ -34743,12 +35091,12 @@
returnTypeNode = returnType && typeToTypeNodeHelper(returnType, context);
}
if (context.flags & 256 /* SuppressAnyReturnType */) {
- if (returnTypeNode && returnTypeNode.kind === 120 /* AnyKeyword */) {
+ if (returnTypeNode && returnTypeNode.kind === 121 /* AnyKeyword */) {
returnTypeNode = undefined;
}
}
else if (!returnTypeNode) {
- returnTypeNode = ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ returnTypeNode = ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
context.approximateLength += 3; // Usually a signature contributes a few more characters than this, but 3 is the minimum
return ts.createSignatureDeclaration(kind, typeParameters, parameters, returnTypeNode, typeArguments);
@@ -34777,9 +35125,9 @@
return typeParameterToDeclarationWithConstraint(type, context, constraintNode);
}
function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags) {
- var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 151 /* Parameter */);
+ var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 152 /* Parameter */);
if (!parameterDeclaration && !isTransientSymbol(parameterSymbol)) {
- parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 304 /* JSDocParameterTag */);
+ parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 305 /* JSDocParameterTag */);
}
var parameterType = getTypeOfSymbol(parameterSymbol);
if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) {
@@ -34787,16 +35135,16 @@
}
var parameterTypeNode = typeToTypeNodeHelper(parameterType, context);
var modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && preserveModifierFlags && parameterDeclaration && parameterDeclaration.modifiers ? parameterDeclaration.modifiers.map(ts.getSynthesizedClone) : undefined;
- var isRest = parameterDeclaration && ts.isRestParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 16384 /* RestParameter */;
+ var isRest = parameterDeclaration && ts.isRestParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 32768 /* RestParameter */;
var dotDotDotToken = isRest ? ts.createToken(25 /* DotDotDotToken */) : undefined;
var name = parameterDeclaration
? parameterDeclaration.name ?
- parameterDeclaration.name.kind === 72 /* Identifier */ ? ts.setEmitFlags(ts.getSynthesizedClone(parameterDeclaration.name), 16777216 /* NoAsciiEscaping */) :
- parameterDeclaration.name.kind === 148 /* QualifiedName */ ? ts.setEmitFlags(ts.getSynthesizedClone(parameterDeclaration.name.right), 16777216 /* NoAsciiEscaping */) :
+ parameterDeclaration.name.kind === 73 /* Identifier */ ? ts.setEmitFlags(ts.getSynthesizedClone(parameterDeclaration.name), 16777216 /* NoAsciiEscaping */) :
+ parameterDeclaration.name.kind === 149 /* QualifiedName */ ? ts.setEmitFlags(ts.getSynthesizedClone(parameterDeclaration.name.right), 16777216 /* NoAsciiEscaping */) :
cloneBindingName(parameterDeclaration.name) :
ts.symbolName(parameterSymbol)
: ts.symbolName(parameterSymbol);
- var isOptional = parameterDeclaration && isOptionalParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 8192 /* OptionalParameter */;
+ var isOptional = parameterDeclaration && isOptionalParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 16384 /* OptionalParameter */;
var questionToken = isOptional ? ts.createToken(56 /* QuestionToken */) : undefined;
var parameterNode = ts.createParameter(
/*decorators*/ undefined, modifiers, dotDotDotToken, name, questionToken, parameterTypeNode,
@@ -34811,7 +35159,7 @@
}
var visited = ts.visitEachChild(node, elideInitializerAndSetEmitFlags, ts.nullTransformationContext, /*nodesVisitor*/ undefined, elideInitializerAndSetEmitFlags);
var clone = ts.nodeIsSynthesized(visited) ? visited : ts.getSynthesizedClone(visited);
- if (clone.kind === 186 /* BindingElement */) {
+ if (clone.kind === 187 /* BindingElement */) {
clone.initializer = undefined;
}
return ts.setEmitFlags(clone, 1 /* SingleLine */ | 16777216 /* NoAsciiEscaping */);
@@ -34913,6 +35261,11 @@
function lookupTypeParameterNodes(chain, index, context) {
ts.Debug.assert(chain && 0 <= index && index < chain.length);
var symbol = chain[index];
+ var symbolId = "" + getSymbolId(symbol);
+ if (context.typeParameterSymbolList && context.typeParameterSymbolList.get(symbolId)) {
+ return undefined;
+ }
+ (context.typeParameterSymbolList || (context.typeParameterSymbolList = ts.createMap())).set(symbolId, true);
var typeParameterNodes;
if (context.flags & 512 /* WriteTypeParametersInQualifiedName */ && index < (chain.length - 1)) {
var parentSymbol = symbol;
@@ -34937,7 +35290,7 @@
return top;
}
function getSpecifierForModuleSymbol(symbol, context) {
- var file = ts.getDeclarationOfKind(symbol, 284 /* SourceFile */);
+ var file = ts.getDeclarationOfKind(symbol, 285 /* SourceFile */);
if (file && file.moduleName !== undefined) {
// Use the amd name if it is available
return file.moduleName;
@@ -35177,8 +35530,8 @@
}
function getTypeAliasForTypeLiteral(type) {
if (type.symbol && type.symbol.flags & 2048 /* TypeLiteral */) {
- var node = ts.findAncestor(type.symbol.declarations[0].parent, function (n) { return n.kind !== 177 /* ParenthesizedType */; });
- if (node.kind === 242 /* TypeAliasDeclaration */) {
+ var node = ts.findAncestor(type.symbol.declarations[0].parent, function (n) { return n.kind !== 178 /* ParenthesizedType */; });
+ if (node.kind === 243 /* TypeAliasDeclaration */) {
return getSymbolOfNode(node);
}
}
@@ -35186,11 +35539,11 @@
}
function isTopLevelInExternalModuleAugmentation(node) {
return node && node.parent &&
- node.parent.kind === 245 /* ModuleBlock */ &&
+ node.parent.kind === 246 /* ModuleBlock */ &&
ts.isExternalModuleAugmentation(node.parent.parent);
}
function isDefaultBindingContext(location) {
- return location.kind === 284 /* SourceFile */ || ts.isAmbientModule(location);
+ return location.kind === 285 /* SourceFile */ || ts.isAmbientModule(location);
}
function getNameOfSymbolFromNameType(symbol, context) {
var nameType = symbol.nameType;
@@ -35231,7 +35584,7 @@
if (ts.isCallExpression(declaration) && ts.isBindableObjectDefinePropertyCall(declaration)) {
return ts.symbolName(symbol);
}
- if (ts.isComputedPropertyName(name_2) && !(ts.getCheckFlags(symbol) & 2048 /* Late */) && symbol.nameType && symbol.nameType.flags & 384 /* StringOrNumberLiteral */) {
+ if (ts.isComputedPropertyName(name_2) && !(ts.getCheckFlags(symbol) & 4096 /* Late */) && symbol.nameType && symbol.nameType.flags & 384 /* StringOrNumberLiteral */) {
// Computed property name isn't late bound, but has a well-known name type - use name type to generate a symbol name
var result = getNameOfSymbolFromNameType(symbol, context);
if (result !== undefined) {
@@ -35240,17 +35593,17 @@
}
return ts.declarationNameToString(name_2);
}
- if (declaration.parent && declaration.parent.kind === 237 /* VariableDeclaration */) {
+ if (declaration.parent && declaration.parent.kind === 238 /* VariableDeclaration */) {
return ts.declarationNameToString(declaration.parent.name);
}
switch (declaration.kind) {
- case 209 /* ClassExpression */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 210 /* ClassExpression */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
if (context && !context.encounteredError && !(context.flags & 131072 /* AllowAnonymousIdentifier */)) {
context.encounteredError = true;
}
- return declaration.kind === 209 /* ClassExpression */ ? "(Anonymous class)" : "(Anonymous function)";
+ return declaration.kind === 210 /* ClassExpression */ ? "(Anonymous class)" : "(Anonymous function)";
}
}
var name = getNameOfSymbolFromNameType(symbol, context);
@@ -35267,27 +35620,27 @@
return false;
function determineIfDeclarationIsVisible() {
switch (node.kind) {
- case 302 /* JSDocCallbackTag */:
- case 309 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
// Top-level jsdoc type aliases are considered exported
// First parent is comment node, second is hosting declaration or token; we only care about those tokens or declarations whose parent is a source file
return !!(node.parent && node.parent.parent && node.parent.parent.parent && ts.isSourceFile(node.parent.parent.parent));
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return isDeclarationVisible(node.parent.parent);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
if (ts.isBindingPattern(node.name) &&
!node.name.elements.length) {
// If the binding pattern is empty, this variable declaration is not visible
return false;
}
// falls through
- case 244 /* ModuleDeclaration */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 239 /* FunctionDeclaration */:
- case 243 /* EnumDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
// external module augmentation is always visible
if (ts.isExternalModuleAugmentation(node)) {
return true;
@@ -35295,53 +35648,53 @@
var parent = getDeclarationContainer(node);
// If the node is not exported or it is not ambient module element (except import declaration)
if (!(ts.getCombinedModifierFlags(node) & 1 /* Export */) &&
- !(node.kind !== 248 /* ImportEqualsDeclaration */ && parent.kind !== 284 /* SourceFile */ && parent.flags & 4194304 /* Ambient */)) {
+ !(node.kind !== 249 /* ImportEqualsDeclaration */ && parent.kind !== 285 /* SourceFile */ && parent.flags & 4194304 /* Ambient */)) {
return isGlobalSourceFile(parent);
}
// Exported members/ambient module elements (exception import declaration) are visible if parent is visible
return isDeclarationVisible(parent);
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
if (ts.hasModifier(node, 8 /* Private */ | 16 /* Protected */)) {
// Private/protected properties/methods are not visible
return false;
}
// Public properties/methods are visible if its parents are visible, so:
// falls through
- case 157 /* Constructor */:
- case 161 /* ConstructSignature */:
- case 160 /* CallSignature */:
- case 162 /* IndexSignature */:
- case 151 /* Parameter */:
- case 245 /* ModuleBlock */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 168 /* TypeLiteral */:
- case 164 /* TypeReference */:
- case 169 /* ArrayType */:
- case 170 /* TupleType */:
- case 173 /* UnionType */:
- case 174 /* IntersectionType */:
- case 177 /* ParenthesizedType */:
+ case 158 /* Constructor */:
+ case 162 /* ConstructSignature */:
+ case 161 /* CallSignature */:
+ case 163 /* IndexSignature */:
+ case 152 /* Parameter */:
+ case 246 /* ModuleBlock */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 169 /* TypeLiteral */:
+ case 165 /* TypeReference */:
+ case 170 /* ArrayType */:
+ case 171 /* TupleType */:
+ case 174 /* UnionType */:
+ case 175 /* IntersectionType */:
+ case 178 /* ParenthesizedType */:
return isDeclarationVisible(node.parent);
// Default binding, import specifier and namespace import is visible
// only on demand so by default it is not visible
- case 250 /* ImportClause */:
- case 251 /* NamespaceImport */:
- case 253 /* ImportSpecifier */:
+ case 251 /* ImportClause */:
+ case 252 /* NamespaceImport */:
+ case 254 /* ImportSpecifier */:
return false;
// Type parameters are always visible
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
// Source file and namespace export are always visible
- case 284 /* SourceFile */:
- case 247 /* NamespaceExportDeclaration */:
+ case 285 /* SourceFile */:
+ case 248 /* NamespaceExportDeclaration */:
return true;
// Export assignments do not create name bindings outside the module
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return false;
default:
return false;
@@ -35350,10 +35703,10 @@
}
function collectLinkedAliases(node, setVisibility) {
var exportSymbol;
- if (node.parent && node.parent.kind === 254 /* ExportAssignment */) {
+ if (node.parent && node.parent.kind === 255 /* ExportAssignment */) {
exportSymbol = resolveName(node, node.escapedText, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */, /*nameNotFoundMessage*/ undefined, node, /*isUse*/ false);
}
- else if (node.parent.kind === 257 /* ExportSpecifier */) {
+ else if (node.parent.kind === 258 /* ExportSpecifier */) {
exportSymbol = getTargetOfExportSpecifier(node.parent, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */);
}
var result;
@@ -35449,12 +35802,12 @@
function getDeclarationContainer(node) {
return ts.findAncestor(ts.getRootDeclaration(node), function (node) {
switch (node.kind) {
- case 237 /* VariableDeclaration */:
- case 238 /* VariableDeclarationList */:
- case 253 /* ImportSpecifier */:
- case 252 /* NamedImports */:
- case 251 /* NamespaceImport */:
- case 250 /* ImportClause */:
+ case 238 /* VariableDeclaration */:
+ case 239 /* VariableDeclarationList */:
+ case 254 /* ImportSpecifier */:
+ case 253 /* NamedImports */:
+ case 252 /* NamespaceImport */:
+ case 251 /* ImportClause */:
return false;
default:
return true;
@@ -35487,7 +35840,7 @@
return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, /*includeOptionality*/ false);
}
function isComputedNonLiteralName(name) {
- return name.kind === 149 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteralLike(name.expression);
+ return name.kind === 150 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteralLike(name.expression);
}
function getRestType(source, properties, symbol) {
source = filterType(source, function (t) { return !(t.flags & 98304 /* Nullable */); });
@@ -35502,13 +35855,11 @@
if (omitKeyType.flags & 131072 /* Never */) {
return source;
}
- var pickTypeAlias = getGlobalPickSymbol();
- var excludeTypeAlias = getGlobalExcludeSymbol();
- if (!pickTypeAlias || !excludeTypeAlias) {
+ var omitTypeAlias = getGlobalOmitSymbol();
+ if (!omitTypeAlias) {
return errorType;
}
- var pickKeys = getTypeAliasInstantiation(excludeTypeAlias, [getIndexType(source), omitKeyType]);
- return getTypeAliasInstantiation(pickTypeAlias, [source, pickKeys]);
+ return getTypeAliasInstantiation(omitTypeAlias, [source, omitKeyType]);
}
var members = ts.createSymbolTable();
for (var _i = 0, _a = getPropertiesOfType(source); _i < _a.length; _i++) {
@@ -35541,7 +35892,7 @@
if (parentAccess && parentAccess.flowNode) {
var propName = getDestructuringPropertyName(node);
if (propName) {
- var result = ts.createNode(190 /* ElementAccessExpression */, node.pos, node.end);
+ var result = ts.createNode(191 /* ElementAccessExpression */, node.pos, node.end);
result.parent = node;
result.expression = parentAccess;
var literal = ts.createNode(10 /* StringLiteral */, node.pos, node.end);
@@ -35556,23 +35907,23 @@
function getParentElementAccess(node) {
var ancestor = node.parent.parent;
switch (ancestor.kind) {
- case 186 /* BindingElement */:
- case 275 /* PropertyAssignment */:
+ case 187 /* BindingElement */:
+ case 276 /* PropertyAssignment */:
return getSyntheticElementAccess(ancestor);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return getSyntheticElementAccess(node.parent);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return ancestor.initializer;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return ancestor.right;
}
}
function getDestructuringPropertyName(node) {
var parent = node.parent;
- if (node.kind === 186 /* BindingElement */ && parent.kind === 184 /* ObjectBindingPattern */) {
+ if (node.kind === 187 /* BindingElement */ && parent.kind === 185 /* ObjectBindingPattern */) {
return getLiteralPropertyNameText(node.propertyName || node.name);
}
- if (node.kind === 275 /* PropertyAssignment */ || node.kind === 276 /* ShorthandPropertyAssignment */) {
+ if (node.kind === 276 /* PropertyAssignment */ || node.kind === 277 /* ShorthandPropertyAssignment */) {
return getLiteralPropertyNameText(node.name);
}
return "" + parent.elements.indexOf(node);
@@ -35594,7 +35945,7 @@
parentType = getNonNullableType(parentType);
}
var type;
- if (pattern.kind === 184 /* ObjectBindingPattern */) {
+ if (pattern.kind === 185 /* ObjectBindingPattern */) {
if (declaration.dotDotDotToken) {
if (parentType.flags & 2 /* Unknown */ || !isValidSpreadType(parentType)) {
error(declaration, ts.Diagnostics.Rest_types_may_only_be_created_from_object_types);
@@ -35658,30 +36009,30 @@
}
function isNullOrUndefined(node) {
var expr = ts.skipParentheses(node);
- return expr.kind === 96 /* NullKeyword */ || expr.kind === 72 /* Identifier */ && getResolvedSymbol(expr) === undefinedSymbol;
+ return expr.kind === 97 /* NullKeyword */ || expr.kind === 73 /* Identifier */ && getResolvedSymbol(expr) === undefinedSymbol;
}
function isEmptyArrayLiteral(node) {
var expr = ts.skipParentheses(node);
- return expr.kind === 187 /* ArrayLiteralExpression */ && expr.elements.length === 0;
+ return expr.kind === 188 /* ArrayLiteralExpression */ && expr.elements.length === 0;
}
function addOptionality(type, optional) {
if (optional === void 0) { optional = true; }
return strictNullChecks && optional ? getOptionalType(type) : type;
}
function isParameterOfContextuallyTypedFunction(node) {
- return node.kind === 151 /* Parameter */ &&
- (node.parent.kind === 196 /* FunctionExpression */ || node.parent.kind === 197 /* ArrowFunction */) &&
+ return node.kind === 152 /* Parameter */ &&
+ (node.parent.kind === 197 /* FunctionExpression */ || node.parent.kind === 198 /* ArrowFunction */) &&
!!getContextualType(node.parent);
}
// Return the inferred type for a variable, parameter, or property declaration
function getTypeForVariableLikeDeclaration(declaration, includeOptionality) {
// A variable declared in a for..in statement is of type string, or of type keyof T when the
// right hand expression is of a type parameter type.
- if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 226 /* ForInStatement */) {
+ if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 227 /* ForInStatement */) {
var indexType = getIndexType(getNonNullableTypeIfNeeded(checkExpression(declaration.parent.parent.expression)));
return indexType.flags & (262144 /* TypeParameter */ | 4194304 /* Index */) ? getExtractStringType(indexType) : stringType;
}
- if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 227 /* ForOfStatement */) {
+ if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 228 /* ForOfStatement */) {
// checkRightHandSideOfForOf will return undefined if the for-of expression type was
// missing properties/signatures required to get its iteratedType (like
// [Symbol.iterator] or next). This may be because we accessed properties from anyType,
@@ -35700,7 +36051,7 @@
return addOptionality(declaredType, isOptional);
}
if ((noImplicitAny || ts.isInJSFile(declaration)) &&
- declaration.kind === 237 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) &&
+ declaration.kind === 238 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) &&
!(ts.getCombinedModifierFlags(declaration) & 1 /* Export */) && !(declaration.flags & 4194304 /* Ambient */)) {
// If --noImplicitAny is on or the declaration is in a Javascript file,
// use control flow tracked 'any' type for non-ambient, non-exported var or let variables with no
@@ -35714,11 +36065,11 @@
return autoArrayType;
}
}
- if (declaration.kind === 151 /* Parameter */) {
+ if (declaration.kind === 152 /* Parameter */) {
var func = declaration.parent;
// For a parameter of a set accessor, use the type of the get accessor if one is present
- if (func.kind === 159 /* SetAccessor */ && !hasNonBindableDynamicName(func)) {
- var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 158 /* GetAccessor */);
+ if (func.kind === 160 /* SetAccessor */ && !hasNonBindableDynamicName(func)) {
+ var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 159 /* GetAccessor */);
if (getter) {
var getterSignature = getSignatureFromDeclaration(getter);
var thisParameter = getAccessorThisParameter(func);
@@ -35855,7 +36206,7 @@
return type;
}
else if (declaredType !== errorType && type !== errorType && !isTypeIdenticalTo(declaredType, type)) {
- errorNextVariableOrPropertyDeclarationMustHaveSameType(declaredType, declaration, type);
+ errorNextVariableOrPropertyDeclarationMustHaveSameType(/*firstDeclaration*/ undefined, declaredType, declaration, type);
}
}
return declaredType;
@@ -35922,9 +36273,9 @@
var thisContainer = ts.getThisContainer(expression, /*includeArrowFunctions*/ false);
// Properties defined in a constructor (or base constructor, or javascript constructor function) don't get undefined added.
// Function expressions that are assigned to the prototype count as methods.
- return thisContainer.kind === 157 /* Constructor */ ||
- thisContainer.kind === 239 /* FunctionDeclaration */ ||
- (thisContainer.kind === 196 /* FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent));
+ return thisContainer.kind === 158 /* Constructor */ ||
+ thisContainer.kind === 240 /* FunctionDeclaration */ ||
+ (thisContainer.kind === 197 /* FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent));
}
function getConstructorDefinedThisAssignmentTypes(types, declarations) {
ts.Debug.assert(types.length === declarations.length);
@@ -35999,7 +36350,7 @@
function getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors) {
var elements = pattern.elements;
var lastElement = ts.lastOrUndefined(elements);
- var hasRestElement = !!(lastElement && lastElement.kind === 186 /* BindingElement */ && lastElement.dotDotDotToken);
+ var hasRestElement = !!(lastElement && lastElement.kind === 187 /* BindingElement */ && lastElement.dotDotDotToken);
if (elements.length === 0 || elements.length === 1 && hasRestElement) {
return languageVersion >= 2 /* ES2015 */ ? createIterableType(anyType) : anyArrayType;
}
@@ -36022,7 +36373,7 @@
function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) {
if (includePatternInType === void 0) { includePatternInType = false; }
if (reportErrors === void 0) { reportErrors = false; }
- return pattern.kind === 184 /* ObjectBindingPattern */
+ return pattern.kind === 185 /* ObjectBindingPattern */
? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors)
: getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors);
}
@@ -36061,7 +36412,7 @@
}
function declarationBelongsToPrivateAmbientMember(declaration) {
var root = ts.getRootDeclaration(declaration);
- var memberDeclaration = root.kind === 151 /* Parameter */ ? root.parent : root;
+ var memberDeclaration = root.kind === 152 /* Parameter */ ? root.parent : root;
return isPrivateWithinAmbient(memberDeclaration);
}
function tryGetTypeFromEffectiveTypeNode(declaration) {
@@ -36123,7 +36474,7 @@
return reportCircularityError(symbol);
}
var type;
- if (declaration.kind === 254 /* ExportAssignment */) {
+ if (declaration.kind === 255 /* ExportAssignment */) {
type = widenTypeForVariableLikeDeclaration(checkExpressionCached(declaration.expression), declaration);
}
else if (ts.isInJSFile(declaration) &&
@@ -36174,7 +36525,7 @@
type = getTypeOfEnumMember(symbol);
}
else {
- return ts.Debug.fail("Unhandled declaration kind! " + ts.Debug.showSyntaxKind(declaration) + " for " + ts.Debug.showSymbol(symbol));
+ return ts.Debug.fail("Unhandled declaration kind! " + ts.Debug.formatSyntaxKind(declaration.kind) + " for " + ts.Debug.formatSymbol(symbol));
}
if (!popTypeResolution()) {
// Symbol is property of some kind that is merged with something - should use `getTypeOfFuncClassEnumModule` and not `getTypeOfVariableOrParameterOrProperty`
@@ -36187,7 +36538,7 @@
}
function getAnnotatedAccessorTypeNode(accessor) {
if (accessor) {
- if (accessor.kind === 158 /* GetAccessor */) {
+ if (accessor.kind === 159 /* GetAccessor */) {
var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor);
return getterTypeAnnotation;
}
@@ -36214,8 +36565,8 @@
return links.type || (links.type = getTypeOfAccessorsWorker(symbol));
}
function getTypeOfAccessorsWorker(symbol) {
- var getter = ts.getDeclarationOfKind(symbol, 158 /* GetAccessor */);
- var setter = ts.getDeclarationOfKind(symbol, 159 /* SetAccessor */);
+ var getter = ts.getDeclarationOfKind(symbol, 159 /* GetAccessor */);
+ var setter = ts.getDeclarationOfKind(symbol, 160 /* SetAccessor */);
if (getter && ts.isInJSFile(getter)) {
var jsDocType = getTypeForDeclarationFromJSDocComment(getter);
if (jsDocType) {
@@ -36258,7 +36609,7 @@
if (!popTypeResolution()) {
type = anyType;
if (noImplicitAny) {
- var getter_1 = ts.getDeclarationOfKind(symbol, 158 /* GetAccessor */);
+ var getter_1 = ts.getDeclarationOfKind(symbol, 159 /* GetAccessor */);
error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
}
}
@@ -36298,8 +36649,8 @@
if (symbol.flags & 1536 /* Module */ && ts.isShorthandAmbientModuleSymbol(symbol)) {
return anyType;
}
- else if (declaration.kind === 204 /* BinaryExpression */ ||
- declaration.kind === 189 /* PropertyAccessExpression */ && declaration.parent.kind === 204 /* BinaryExpression */) {
+ else if (declaration.kind === 205 /* BinaryExpression */ ||
+ declaration.kind === 190 /* PropertyAccessExpression */ && declaration.parent.kind === 205 /* BinaryExpression */) {
return getWidenedTypeFromAssignmentDeclaration(symbol);
}
else if (symbol.flags & 512 /* ValueModule */ && declaration && ts.isSourceFile(declaration) && declaration.commonJsModuleIndicator) {
@@ -36366,7 +36717,7 @@
return errorType;
}
// Check if variable has initializer that circularly references the variable itself
- if (noImplicitAny && (declaration.kind !== 151 /* Parameter */ || declaration.initializer)) {
+ if (noImplicitAny && (declaration.kind !== 152 /* Parameter */ || declaration.initializer)) {
error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol));
}
// Circularities could also result from parameters in function expressions that end up
@@ -36374,11 +36725,23 @@
// we have already reported an implicit any error so we don't report anything here.
return anyType;
}
+ function getTypeOfSymbolWithDeferredType(symbol) {
+ var links = getSymbolLinks(symbol);
+ if (!links.type) {
+ ts.Debug.assertDefined(links.deferralParent);
+ ts.Debug.assertDefined(links.deferralConstituents);
+ links.type = links.deferralParent.flags & 1048576 /* Union */ ? getUnionType(links.deferralConstituents) : getIntersectionType(links.deferralConstituents);
+ }
+ return links.type;
+ }
function getTypeOfSymbol(symbol) {
+ if (ts.getCheckFlags(symbol) & 65536 /* DeferredType */) {
+ return getTypeOfSymbolWithDeferredType(symbol);
+ }
if (ts.getCheckFlags(symbol) & 1 /* Instantiated */) {
return getTypeOfInstantiatedSymbol(symbol);
}
- if (ts.getCheckFlags(symbol) & 4096 /* ReverseMapped */) {
+ if (ts.getCheckFlags(symbol) & 8192 /* ReverseMapped */) {
return getTypeOfReverseMappedSymbol(symbol);
}
if (symbol.flags & (3 /* Variable */ | 4 /* Property */)) {
@@ -36439,35 +36802,35 @@
return undefined;
}
switch (node.kind) {
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 155 /* MethodSignature */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 294 /* JSDocFunctionType */:
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 242 /* TypeAliasDeclaration */:
- case 308 /* JSDocTemplateTag */:
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
- case 181 /* MappedType */:
- case 175 /* ConditionalType */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 156 /* MethodSignature */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 295 /* JSDocFunctionType */:
+ case 240 /* FunctionDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 243 /* TypeAliasDeclaration */:
+ case 309 /* JSDocTemplateTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
+ case 182 /* MappedType */:
+ case 176 /* ConditionalType */:
var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes);
- if (node.kind === 181 /* MappedType */) {
+ if (node.kind === 182 /* MappedType */) {
return ts.append(outerTypeParameters, getDeclaredTypeOfTypeParameter(getSymbolOfNode(node.typeParameter)));
}
- else if (node.kind === 175 /* ConditionalType */) {
+ else if (node.kind === 176 /* ConditionalType */) {
return ts.concatenate(outerTypeParameters, getInferTypeParameters(node));
}
var outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, ts.getEffectiveTypeParameterDeclarations(node));
var thisType = includeThisTypes &&
- (node.kind === 240 /* ClassDeclaration */ || node.kind === 209 /* ClassExpression */ || node.kind === 241 /* InterfaceDeclaration */) &&
+ (node.kind === 241 /* ClassDeclaration */ || node.kind === 210 /* ClassExpression */ || node.kind === 242 /* InterfaceDeclaration */) &&
getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType;
return thisType ? ts.append(outerAndOwnTypeParameters, thisType) : outerAndOwnTypeParameters;
}
@@ -36475,7 +36838,7 @@
}
// The outer type parameters are those defined by enclosing generic classes, methods, or functions.
function getOuterTypeParametersOfClassOrInterface(symbol) {
- var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 241 /* InterfaceDeclaration */);
+ var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 242 /* InterfaceDeclaration */);
return getOuterTypeParameters(declaration);
}
// The local type parameters are the combined set of type parameters from all declarations of the class,
@@ -36484,9 +36847,9 @@
var result;
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var node = _a[_i];
- if (node.kind === 241 /* InterfaceDeclaration */ ||
- node.kind === 240 /* ClassDeclaration */ ||
- node.kind === 209 /* ClassExpression */ ||
+ if (node.kind === 242 /* InterfaceDeclaration */ ||
+ node.kind === 241 /* ClassDeclaration */ ||
+ node.kind === 210 /* ClassExpression */ ||
ts.isTypeAlias(node)) {
var declaration = node;
result = appendTypeParameters(result, ts.getEffectiveTypeParameterDeclarations(declaration));
@@ -36680,7 +37043,7 @@
type.resolvedBaseTypes = type.resolvedBaseTypes || ts.emptyArray;
for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 241 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) {
+ if (declaration.kind === 242 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) {
for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) {
var node = _c[_b];
var baseType = getTypeFromTypeNode(node);
@@ -36716,7 +37079,7 @@
function isThislessInterface(symbol) {
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 241 /* InterfaceDeclaration */) {
+ if (declaration.kind === 242 /* InterfaceDeclaration */) {
if (declaration.flags & 64 /* ContainsThis */) {
return false;
}
@@ -36773,7 +37136,7 @@
return errorType;
}
var declaration = ts.find(symbol.declarations, function (d) {
- return ts.isJSDocTypeAlias(d) || d.kind === 242 /* TypeAliasDeclaration */;
+ return ts.isJSDocTypeAlias(d) || d.kind === 243 /* TypeAliasDeclaration */;
});
var typeNode = ts.isJSDocTypeAlias(declaration) ? declaration.typeExpression : declaration.type;
// If typeNode is missing, we will error in checkJSDocTypedefTag.
@@ -36800,7 +37163,7 @@
if (expr.kind === 10 /* StringLiteral */) {
return true;
}
- else if (expr.kind === 204 /* BinaryExpression */) {
+ else if (expr.kind === 205 /* BinaryExpression */) {
return isStringConcatExpression(expr.left) && isStringConcatExpression(expr.right);
}
return false;
@@ -36814,12 +37177,12 @@
case 10 /* StringLiteral */:
case 8 /* NumericLiteral */:
return true;
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return expr.operator === 39 /* MinusToken */ &&
expr.operand.kind === 8 /* NumericLiteral */;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return ts.nodeIsMissing(expr) || !!getSymbolOfNode(member.parent).exports.get(expr.escapedText);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return isStringConcatExpression(expr);
default:
return false;
@@ -36833,7 +37196,7 @@
var hasNonLiteralMember = false;
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 243 /* EnumDeclaration */) {
+ if (declaration.kind === 244 /* EnumDeclaration */) {
for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) {
var member = _c[_b];
if (member.initializer && member.initializer.kind === 10 /* StringLiteral */) {
@@ -36860,7 +37223,7 @@
var memberTypeList = [];
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 243 /* EnumDeclaration */) {
+ if (declaration.kind === 244 /* EnumDeclaration */) {
for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) {
var member = _c[_b];
var memberType = getFreshTypeOfLiteralType(getLiteralType(getEnumMemberValue(member), enumCount, getSymbolOfNode(member))); // TODO: GH#18217
@@ -36931,23 +37294,23 @@
*/
function isThislessType(node) {
switch (node.kind) {
- case 120 /* AnyKeyword */:
- case 143 /* UnknownKeyword */:
- case 138 /* StringKeyword */:
- case 135 /* NumberKeyword */:
- case 146 /* BigIntKeyword */:
- case 123 /* BooleanKeyword */:
- case 139 /* SymbolKeyword */:
- case 136 /* ObjectKeyword */:
- case 106 /* VoidKeyword */:
- case 141 /* UndefinedKeyword */:
- case 96 /* NullKeyword */:
- case 132 /* NeverKeyword */:
- case 182 /* LiteralType */:
+ case 121 /* AnyKeyword */:
+ case 144 /* UnknownKeyword */:
+ case 139 /* StringKeyword */:
+ case 136 /* NumberKeyword */:
+ case 147 /* BigIntKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 137 /* ObjectKeyword */:
+ case 107 /* VoidKeyword */:
+ case 142 /* UndefinedKeyword */:
+ case 97 /* NullKeyword */:
+ case 133 /* NeverKeyword */:
+ case 183 /* LiteralType */:
return true;
- case 169 /* ArrayType */:
+ case 170 /* ArrayType */:
return isThislessType(node.elementType);
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return !node.typeArguments || node.typeArguments.every(isThislessType);
}
return false;
@@ -36973,7 +37336,7 @@
function isThislessFunctionLikeDeclaration(node) {
var returnType = ts.getEffectiveReturnTypeNode(node);
var typeParameters = ts.getEffectiveTypeParameterDeclarations(node);
- return (node.kind === 157 /* Constructor */ || (!!returnType && isThislessType(returnType))) &&
+ return (node.kind === 158 /* Constructor */ || (!!returnType && isThislessType(returnType))) &&
node.parameters.every(isThislessVariableLikeDeclaration) &&
typeParameters.every(isThislessTypeParameter);
}
@@ -36989,14 +37352,14 @@
var declaration = symbol.declarations[0];
if (declaration) {
switch (declaration.kind) {
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
return isThislessVariableLikeDeclaration(declaration);
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return isThislessFunctionLikeDeclaration(declaration);
}
}
@@ -37097,7 +37460,7 @@
* members.
*/
function addDeclarationToLateBoundSymbol(symbol, member, symbolFlags) {
- ts.Debug.assert(!!(ts.getCheckFlags(symbol) & 2048 /* Late */), "Expected a late-bound symbol.");
+ ts.Debug.assert(!!(ts.getCheckFlags(symbol) & 4096 /* Late */), "Expected a late-bound symbol.");
symbol.flags |= symbolFlags;
getSymbolLinks(member.symbol).lateSymbol = symbol;
if (!symbol.declarations) {
@@ -37154,7 +37517,7 @@
// Get or add a late-bound symbol for the member. This allows us to merge late-bound accessor declarations.
var lateSymbol = lateSymbols.get(memberName);
if (!lateSymbol)
- lateSymbols.set(memberName, lateSymbol = createSymbol(0 /* None */, memberName, 2048 /* Late */));
+ lateSymbols.set(memberName, lateSymbol = createSymbol(0 /* None */, memberName, 4096 /* Late */));
// Report an error if a late-bound member has the same name as an early-bound member,
// or if we have another early-bound symbol declaration with the same name and
// conflicting flags.
@@ -37166,7 +37529,7 @@
var name_3 = !(type.flags & 8192 /* UniqueESSymbol */) && ts.unescapeLeadingUnderscores(memberName) || ts.declarationNameToString(decl.name);
ts.forEach(declarations, function (declaration) { return error(ts.getNameOfDeclaration(declaration) || declaration, ts.Diagnostics.Property_0_was_also_declared_here, name_3); });
error(decl.name || decl, ts.Diagnostics.Duplicate_property_0, name_3);
- lateSymbol = createSymbol(0 /* None */, memberName, 2048 /* Late */);
+ lateSymbol = createSymbol(0 /* None */, memberName, 4096 /* Late */);
}
lateSymbol.nameType = type;
addDeclarationToLateBoundSymbol(lateSymbol, decl, symbolFlags);
@@ -37231,11 +37594,12 @@
var links = getSymbolLinks(symbol);
if (!links.lateSymbol && ts.some(symbol.declarations, hasLateBindableName)) {
// force late binding of members/exports. This will set the late-bound symbol
+ var parent = getMergedSymbol(symbol.parent);
if (ts.some(symbol.declarations, ts.hasStaticModifier)) {
- getExportsOfSymbol(symbol.parent);
+ getExportsOfSymbol(parent);
}
else {
- getMembersOfSymbol(symbol.parent);
+ getMembersOfSymbol(parent);
}
}
return links.lateSymbol || (links.lateSymbol = symbol);
@@ -37352,8 +37716,8 @@
var tupleRestIndex_1 = restType.target.hasRestElement ? elementTypes.length - 1 : -1;
var restParams = ts.map(elementTypes, function (t, i) {
var name = getParameterNameAtPosition(sig, restIndex_1 + i);
- var checkFlags = i === tupleRestIndex_1 ? 16384 /* RestParameter */ :
- i >= minLength_1 ? 8192 /* OptionalParameter */ : 0;
+ var checkFlags = i === tupleRestIndex_1 ? 32768 /* RestParameter */ :
+ i >= minLength_1 ? 16384 /* OptionalParameter */ : 0;
var symbol = createSymbol(1 /* FunctionScopedVariable */, name, checkFlags);
symbol.type = i === tupleRestIndex_1 ? createArrayType(t) : t;
return symbol;
@@ -37443,10 +37807,10 @@
// Union the result types when more than one signature matches
if (unionSignatures.length > 1) {
var thisParameter = signature.thisParameter;
- if (ts.forEach(unionSignatures, function (sig) { return sig.thisParameter; })) {
- // TODO: GH#18217 We tested that *some* has thisParameter and now act as if *all* do
+ var firstThisParameterOfUnionSignatures = ts.forEach(unionSignatures, function (sig) { return sig.thisParameter; });
+ if (firstThisParameterOfUnionSignatures) {
var thisType = getUnionType(ts.map(unionSignatures, function (sig) { return sig.thisParameter ? getTypeOfSymbol(sig.thisParameter) : anyType; }), 2 /* Subtype */);
- thisParameter = createSymbolWithType(signature.thisParameter, thisType);
+ thisParameter = createSymbolWithType(firstThisParameterOfUnionSignatures, thisType);
}
s = createUnionSignature(signature, unionSignatures);
s.thisParameter = thisParameter;
@@ -37703,7 +38067,7 @@
var members = ts.createSymbolTable();
for (var _i = 0, _a = getPropertiesOfType(type.source); _i < _a.length; _i++) {
var prop = _a[_i];
- var checkFlags = 4096 /* ReverseMapped */ | (readonlyMask && isReadonlySymbol(prop) ? 8 /* Readonly */ : 0);
+ var checkFlags = 8192 /* ReverseMapped */ | (readonlyMask && isReadonlySymbol(prop) ? 8 /* Readonly */ : 0);
var inferredProp = createSymbol(4 /* Property */ | prop.flags & optionalMask, prop.escapedName, checkFlags);
inferredProp.declarations = prop.declarations;
inferredProp.nameType = prop.nameType;
@@ -37725,7 +38089,15 @@
return getIndexType(getApparentType(type.type));
}
if (type.flags & 16777216 /* Conditional */) {
- return getLowerBoundOfConditionalType(type);
+ if (type.root.isDistributive) {
+ var checkType = type.checkType;
+ var constraint = getLowerBoundOfKeyType(checkType);
+ if (constraint !== checkType) {
+ var mapper = makeUnaryTypeMapper(type.root.checkType, constraint);
+ return getConditionalTypeInstantiation(type, combineTypeMappers(mapper, type.mapper));
+ }
+ }
+ return type;
}
if (type.flags & 1048576 /* Union */) {
return getUnionType(ts.sameMap(type.types, getLowerBoundOfKeyType));
@@ -37735,16 +38107,6 @@
}
return neverType;
}
- function getLowerBoundOfConditionalType(type) {
- if (type.root.isDistributive) {
- var constraint = getLowerBoundOfKeyType(type.checkType);
- if (constraint !== type.checkType) {
- var mapper = makeUnaryTypeMapper(type.root.checkType, constraint);
- return getConditionalTypeInstantiation(type, combineTypeMappers(mapper, type.mapper));
- }
- }
- return type;
- }
/** Resolve the members of a mapped type { [P in K]: T } */
function resolveMappedTypeMembers(type) {
var members = ts.createSymbolTable();
@@ -37833,8 +38195,8 @@
}
function isMappedTypeWithKeyofConstraintDeclaration(type) {
var constraintDeclaration = getConstraintDeclarationForMappedType(type); // TODO: GH#18217
- return constraintDeclaration.kind === 179 /* TypeOperator */ &&
- constraintDeclaration.operator === 129 /* KeyOfKeyword */;
+ return constraintDeclaration.kind === 180 /* TypeOperator */ &&
+ constraintDeclaration.operator === 130 /* KeyOfKeyword */;
}
function getModifiersTypeFromMappedType(type) {
if (!type.modifiersType) {
@@ -37851,7 +38213,7 @@
var declaredType = getTypeFromMappedTypeNode(type.declaration);
var constraint = getConstraintTypeFromMappedType(declaredType);
var extendedConstraint = constraint && constraint.flags & 262144 /* TypeParameter */ ? getConstraintOfTypeParameter(constraint) : constraint;
- type.modifiersType = extendedConstraint && extendedConstraint.flags & 4194304 /* Index */ ? instantiateType(extendedConstraint.type, type.mapper || identityMapper) : emptyObjectType;
+ type.modifiersType = extendedConstraint && extendedConstraint.flags & 4194304 /* Index */ ? instantiateType(extendedConstraint.type, type.mapper || identityMapper) : unknownType;
}
}
return type.modifiersType;
@@ -37947,6 +38309,26 @@
}
return type.resolvedProperties;
}
+ function getPossiblePropertiesOfUnionType(type) {
+ if (type.possiblePropertyCache) {
+ return type.possiblePropertyCache.size ? ts.arrayFrom(type.possiblePropertyCache.values()) : ts.emptyArray;
+ }
+ type.possiblePropertyCache = ts.createSymbolTable();
+ for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
+ var t = _a[_i];
+ for (var _b = 0, _c = getPropertiesOfType(t); _b < _c.length; _b++) {
+ var p = _c[_b];
+ if (!type.possiblePropertyCache.has(p.escapedName)) {
+ var prop = getUnionOrIntersectionProperty(type, p.escapedName);
+ if (prop) {
+ type.possiblePropertyCache.set(p.escapedName, prop);
+ }
+ }
+ }
+ }
+ // We can't simply use the normal property cache here, since that will contain cached apparent type members :(
+ return type.possiblePropertyCache.size ? ts.arrayFrom(type.possiblePropertyCache.values()) : ts.emptyArray;
+ }
function getPropertiesOfType(type) {
type = getApparentType(type);
return type.flags & 3145728 /* UnionOrIntersection */ ?
@@ -37994,16 +38376,23 @@
function getConstraintOfIndexedAccess(type) {
return hasNonCircularBaseConstraint(type) ? getConstraintFromIndexedAccess(type) : undefined;
}
+ function getSimplifiedTypeOrConstraint(type) {
+ var simplified = getSimplifiedType(type, /*writing*/ false);
+ return simplified !== type ? simplified : getConstraintOfType(type);
+ }
function getConstraintFromIndexedAccess(type) {
- var objectType = getConstraintOfType(type.objectType) || type.objectType;
- if (objectType !== type.objectType) {
- var constraint = getIndexedAccessType(objectType, type.indexType, /*accessNode*/ undefined, errorType);
- if (constraint && constraint !== errorType) {
- return constraint;
+ var indexConstraint = getSimplifiedTypeOrConstraint(type.indexType);
+ if (indexConstraint && indexConstraint !== type.indexType) {
+ var indexedAccess = getIndexedAccessTypeOrUndefined(type.objectType, indexConstraint);
+ if (indexedAccess) {
+ return indexedAccess;
}
}
- var baseConstraint = getBaseConstraintOfType(type);
- return baseConstraint && baseConstraint !== type ? baseConstraint : undefined;
+ var objectConstraint = getSimplifiedTypeOrConstraint(type.objectType);
+ if (objectConstraint && objectConstraint !== type.objectType) {
+ return getIndexedAccessTypeOrUndefined(objectConstraint, type.indexType);
+ }
+ return undefined;
}
function getDefaultConstraintOfConditionalType(type) {
if (!type.resolvedDefaultConstraint) {
@@ -38012,7 +38401,7 @@
// just `any`. This result is _usually_ unwanted - so instead here we elide an `any` branch from the constraint type,
// in effect treating `any` like `never` rather than `unknown` in this location.
var trueConstraint = getInferredTrueTypeFromConditionalType(type);
- var falseConstraint = type.falseType;
+ var falseConstraint = getFalseTypeFromConditionalType(type);
type.resolvedDefaultConstraint = isTypeAny(trueConstraint) ? falseConstraint : isTypeAny(falseConstraint) ? trueConstraint : getUnionType([trueConstraint, falseConstraint]);
}
return type.resolvedDefaultConstraint;
@@ -38030,7 +38419,7 @@
// a union - once negated types exist and are applied to the conditional false branch, this "constraint"
// likely doesn't need to exist.
if (type.root.isDistributive && type.restrictiveInstantiation !== type) {
- var simplified = getSimplifiedType(type.checkType);
+ var simplified = getSimplifiedType(type.checkType, /*writing*/ false);
var constraint = simplified === type.checkType ? getConstraintOfType(simplified) : simplified;
if (constraint && constraint !== type.checkType) {
var mapper = makeUnaryTypeMapper(type.root.checkType, constraint);
@@ -38061,11 +38450,6 @@
constraint = getConstraintOfType(constraint);
}
if (constraint) {
- // A constraint that isn't a union type implies that the final type would be a non-union
- // type as well. Since non-union constraints are of no interest, we can exit here.
- if (!(constraint.flags & 1048576 /* Union */)) {
- return undefined;
- }
constraints = ts.append(constraints, constraint);
}
}
@@ -38074,10 +38458,10 @@
}
}
// If the target is a union type or if we are intersecting with types belonging to one of the
- // disjoint domans, we may end up producing a constraint that hasn't been examined before.
+ // disjoint domains, we may end up producing a constraint that hasn't been examined before.
if (constraints && (targetIsUnion || hasDisjointDomainType)) {
if (hasDisjointDomainType) {
- // We add any types belong to one of the disjoint domans because they might cause the final
+ // We add any types belong to one of the disjoint domains because they might cause the final
// intersection operation to reduce the union constraints.
for (var _b = 0, _c = type.types; _b < _c.length; _b++) {
var t = _c[_b];
@@ -38123,7 +38507,7 @@
}
if (constraintDepth >= 50) {
// We have reached 50 recursive invocations of getImmediateBaseConstraint and there is a
- // very high likelyhood we're dealing with an infinite generic type that perpetually generates
+ // very high likelihood we're dealing with an infinite generic type that perpetually generates
// new type identities as we descend into it. We stop the recursion here and mark this type
// and the outer types as having circular constraints.
error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
@@ -38131,7 +38515,7 @@
return t.immediateBaseConstraint = noConstraintType;
}
constraintDepth++;
- var result = computeBaseConstraint(getSimplifiedType(t));
+ var result = computeBaseConstraint(getSimplifiedType(t, /*writing*/ false));
constraintDepth--;
if (!popTypeResolution()) {
if (t.flags & 262144 /* TypeParameter */) {
@@ -38183,8 +38567,8 @@
if (t.flags & 8388608 /* IndexedAccess */) {
var baseObjectType = getBaseConstraint(t.objectType);
var baseIndexType = getBaseConstraint(t.indexType);
- var baseIndexedAccess = baseObjectType && baseIndexType ? getIndexedAccessType(baseObjectType, baseIndexType, /*accessNode*/ undefined, errorType) : undefined;
- return baseIndexedAccess && baseIndexedAccess !== errorType ? getBaseConstraint(baseIndexedAccess) : undefined;
+ var baseIndexedAccess = baseObjectType && baseIndexType && getIndexedAccessTypeOrUndefined(baseObjectType, baseIndexType);
+ return baseIndexedAccess && getBaseConstraint(baseIndexedAccess);
}
if (t.flags & 16777216 /* Conditional */) {
var constraint = getConstraintFromConditionalType(t);
@@ -38265,16 +38649,17 @@
* type itself. Note that the apparent type of a union type is the union type itself.
*/
function getApparentType(type) {
- var t = type.flags & 63176704 /* Instantiable */ ? getBaseConstraintOfType(type) || emptyObjectType : type;
+ var t = type.flags & 63176704 /* Instantiable */ ? getBaseConstraintOfType(type) || unknownType : type;
return ts.getObjectFlags(t) & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) :
t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t) :
t.flags & 132 /* StringLike */ ? globalStringType :
t.flags & 296 /* NumberLike */ ? globalNumberType :
- t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType(/*reportErrors*/ languageVersion >= 7 /* ESNext */) :
+ t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType(/*reportErrors*/ languageVersion >= 8 /* ESNext */) :
t.flags & 528 /* BooleanLike */ ? globalBooleanType :
t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType(/*reportErrors*/ languageVersion >= 2 /* ES2015 */) :
t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType :
t.flags & 4194304 /* Index */ ? keyofConstraintType :
+ t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType :
t;
}
function createUnionOrIntersectionProperty(containingType, name) {
@@ -38283,7 +38668,7 @@
var isUnion = containingType.flags & 1048576 /* Union */;
var excludeModifiers = isUnion ? 24 /* NonPublicAccessibilityModifier */ : 0;
// Flags we want to propagate to the result if they exist in all source symbols
- var commonFlags = isUnion ? 0 /* None */ : 16777216 /* Optional */;
+ var optionalFlag = isUnion ? 0 /* None */ : 16777216 /* Optional */;
var syntheticFlag = 4 /* SyntheticMethod */;
var checkFlags = 0;
for (var _i = 0, _a = containingType.types; _i < _a.length; _i++) {
@@ -38293,16 +38678,21 @@
var prop = getPropertyOfType(type, name);
var modifiers = prop ? ts.getDeclarationModifierFlagsFromSymbol(prop) : 0;
if (prop && !(modifiers & excludeModifiers)) {
- commonFlags &= prop.flags;
+ if (isUnion) {
+ optionalFlag |= (prop.flags & 16777216 /* Optional */);
+ }
+ else {
+ optionalFlag &= prop.flags;
+ }
var id = "" + getSymbolId(prop);
if (!propSet.has(id)) {
propSet.set(id, prop);
}
checkFlags |= (isReadonlySymbol(prop) ? 8 /* Readonly */ : 0) |
- (!(modifiers & 24 /* NonPublicAccessibilityModifier */) ? 128 /* ContainsPublic */ : 0) |
- (modifiers & 16 /* Protected */ ? 256 /* ContainsProtected */ : 0) |
- (modifiers & 8 /* Private */ ? 512 /* ContainsPrivate */ : 0) |
- (modifiers & 32 /* Static */ ? 1024 /* ContainsStatic */ : 0);
+ (!(modifiers & 24 /* NonPublicAccessibilityModifier */) ? 256 /* ContainsPublic */ : 0) |
+ (modifiers & 16 /* Protected */ ? 512 /* ContainsProtected */ : 0) |
+ (modifiers & 8 /* Private */ ? 1024 /* ContainsPrivate */ : 0) |
+ (modifiers & 32 /* Static */ ? 2048 /* ContainsStatic */ : 0);
if (!isPrototypeProperty(prop)) {
syntheticFlag = 2 /* SyntheticProperty */;
}
@@ -38311,10 +38701,11 @@
var indexInfo = !isLateBoundName(name) && (isNumericLiteralName(name) && getIndexInfoOfType(type, 1 /* Number */) || getIndexInfoOfType(type, 0 /* String */));
if (indexInfo) {
checkFlags |= indexInfo.isReadonly ? 8 /* Readonly */ : 0;
+ checkFlags |= 32 /* WritePartial */;
indexTypes = ts.append(indexTypes, isTupleType(type) ? getRestTypeOfTupleType(type) || undefinedType : indexInfo.type);
}
else {
- checkFlags |= 16 /* Partial */;
+ checkFlags |= 16 /* ReadPartial */;
}
}
}
@@ -38323,7 +38714,7 @@
return undefined;
}
var props = ts.arrayFrom(propSet.values());
- if (props.length === 1 && !(checkFlags & 16 /* Partial */) && !indexTypes) {
+ if (props.length === 1 && !(checkFlags & 16 /* ReadPartial */) && !indexTypes) {
return props[0];
}
var declarations;
@@ -38347,15 +38738,15 @@
nameType = prop.nameType;
}
else if (type !== firstType) {
- checkFlags |= 32 /* HasNonUniformType */;
+ checkFlags |= 64 /* HasNonUniformType */;
}
if (isLiteralType(type)) {
- checkFlags |= 64 /* HasLiteralType */;
+ checkFlags |= 128 /* HasLiteralType */;
}
propTypes.push(type);
}
ts.addRange(propTypes, indexTypes);
- var result = createSymbol(4 /* Property */ | commonFlags, name, syntheticFlag | checkFlags);
+ var result = createSymbol(4 /* Property */ | optionalFlag, name, syntheticFlag | checkFlags);
result.containingType = containingType;
if (!hasNonUniformValueDeclaration && firstValueDeclaration) {
result.valueDeclaration = firstValueDeclaration;
@@ -38366,7 +38757,15 @@
}
result.declarations = declarations;
result.nameType = nameType;
+ if (propTypes.length > 2) {
+ // When `propTypes` has the potential to explode in size when normalized, defer normalization until absolutely needed
+ result.checkFlags |= 65536 /* DeferredType */;
+ result.deferralParent = containingType;
+ result.deferralConstituents = propTypes;
+ }
+ else {
result.type = isUnion ? getUnionType(propTypes) : getIntersectionType(propTypes);
+ }
return result;
}
// Return the symbol for a given property in a union or intersection type, or undefined if the property
@@ -38388,7 +38787,7 @@
function getPropertyOfUnionOrIntersectionType(type, name) {
var property = getUnionOrIntersectionProperty(type, name);
// We need to filter out partial properties in union types
- return property && !(ts.getCheckFlags(property) & 16 /* Partial */) ? property : undefined;
+ return property && !(ts.getCheckFlags(property) & 16 /* ReadPartial */) ? property : undefined;
}
/**
* Return the symbol for the property with the given name in the given type. Creates synthetic union properties when
@@ -38494,10 +38893,10 @@
function isJSDocOptionalParameter(node) {
return ts.isInJSFile(node) && (
// node.type should only be a JSDocOptionalType when node is a parameter of a JSDocFunctionType
- node.type && node.type.kind === 293 /* JSDocOptionalType */
+ node.type && node.type.kind === 294 /* JSDocOptionalType */
|| ts.getJSDocParameterTags(node).some(function (_a) {
var isBracketed = _a.isBracketed, typeExpression = _a.typeExpression;
- return isBracketed || !!typeExpression && typeExpression.type.kind === 293 /* JSDocOptionalType */;
+ return isBracketed || !!typeExpression && typeExpression.type.kind === 294 /* JSDocOptionalType */;
}));
}
function tryFindAmbientModule(moduleName, withAugmentations) {
@@ -38531,7 +38930,7 @@
return false;
}
var isBracketed = node.isBracketed, typeExpression = node.typeExpression;
- return isBracketed || !!typeExpression && typeExpression.type.kind === 293 /* JSDocOptionalType */;
+ return isBracketed || !!typeExpression && typeExpression.type.kind === 294 /* JSDocOptionalType */;
}
function createIdentifierTypePredicate(parameterName, parameterIndex, type) {
return { kind: 1 /* Identifier */, parameterName: parameterName, parameterIndex: parameterIndex, type: type };
@@ -38569,7 +38968,7 @@
var baseDefaultType = getDefaultTypeArgumentType(isJavaScriptImplicitAny);
for (var i = numTypeArguments; i < numTypeParameters; i++) {
var defaultType = getDefaultFromTypeParameter(typeParameters[i]);
- if (isJavaScriptImplicitAny && defaultType && isTypeIdenticalTo(defaultType, emptyObjectType)) {
+ if (isJavaScriptImplicitAny && defaultType && (isTypeIdenticalTo(defaultType, unknownType) || isTypeIdenticalTo(defaultType, emptyObjectType))) {
defaultType = anyType;
}
result[i] = defaultType ? instantiateType(defaultType, createTypeMapper(typeParameters, result)) : baseDefaultType;
@@ -38613,7 +39012,7 @@
else {
parameters.push(paramSymbol);
}
- if (type && type.kind === 182 /* LiteralType */) {
+ if (type && type.kind === 183 /* LiteralType */) {
hasLiteralTypes = true;
}
// Record a new minimum argument count if this is not an optional parameter
@@ -38627,16 +39026,16 @@
}
}
// If only one accessor includes a this-type annotation, the other behaves as if it had the same type annotation
- if ((declaration.kind === 158 /* GetAccessor */ || declaration.kind === 159 /* SetAccessor */) &&
+ if ((declaration.kind === 159 /* GetAccessor */ || declaration.kind === 160 /* SetAccessor */) &&
!hasNonBindableDynamicName(declaration) &&
(!hasThisParameter || !thisParameter)) {
- var otherKind = declaration.kind === 158 /* GetAccessor */ ? 159 /* SetAccessor */ : 158 /* GetAccessor */;
+ var otherKind = declaration.kind === 159 /* GetAccessor */ ? 160 /* SetAccessor */ : 159 /* GetAccessor */;
var other = ts.getDeclarationOfKind(getSymbolOfNode(declaration), otherKind);
if (other) {
thisParameter = getAnnotatedAccessorThisParameter(other);
}
}
- var classType = declaration.kind === 157 /* Constructor */ ?
+ var classType = declaration.kind === 158 /* Constructor */ ?
getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol))
: undefined;
var typeParameters = classType ? classType.localTypeParameters : getTypeParametersFromDeclaration(declaration);
@@ -38661,7 +39060,7 @@
var lastParamVariadicType = ts.firstDefined(lastParamTags, function (p) {
return p.typeExpression && ts.isJSDocVariadicType(p.typeExpression.type) ? p.typeExpression.type : undefined;
});
- var syntheticArgsSymbol = createSymbol(3 /* Variable */, "args", 16384 /* RestParameter */);
+ var syntheticArgsSymbol = createSymbol(3 /* Variable */, "args", 32768 /* RestParameter */);
syntheticArgsSymbol.type = lastParamVariadicType ? createArrayType(getTypeFromTypeNode(lastParamVariadicType.type)) : anyArrayType;
if (lastParamVariadicType) {
// Replace the last parameter with a rest parameter.
@@ -38694,13 +39093,13 @@
if (!node)
return false;
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return node.escapedText === "arguments" && ts.isExpressionNode(node);
- case 154 /* PropertyDeclaration */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- return node.name.kind === 149 /* ComputedPropertyName */
+ case 155 /* PropertyDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ return node.name.kind === 150 /* ComputedPropertyName */
&& traverse(node.name);
default:
return !ts.nodeStartsNewLexicalEnvironment(node) && !ts.isPartOfTypeNode(node) && !!ts.forEachChild(node, traverse);
@@ -38775,7 +39174,7 @@
function createTypePredicateFromTypePredicateNode(node, signature) {
var parameterName = node.parameterName;
var type = getTypeFromTypeNode(node.type);
- if (parameterName.kind === 72 /* Identifier */) {
+ if (parameterName.kind === 73 /* Identifier */) {
return createIdentifierTypePredicate(parameterName.escapedText, ts.findIndex(signature.parameters, function (p) { return p.escapedName === parameterName.escapedText; }), type);
}
else {
@@ -38816,7 +39215,7 @@
return signature.resolvedReturnType;
}
function getReturnTypeFromAnnotation(declaration) {
- if (declaration.kind === 157 /* Constructor */) {
+ if (declaration.kind === 158 /* Constructor */) {
return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol));
}
if (ts.isJSDocConstructSignature(declaration)) {
@@ -38826,12 +39225,12 @@
if (typeNode) {
return getTypeFromTypeNode(typeNode);
}
- if (declaration.kind === 158 /* GetAccessor */ && !hasNonBindableDynamicName(declaration)) {
+ if (declaration.kind === 159 /* GetAccessor */ && !hasNonBindableDynamicName(declaration)) {
var jsDocType = ts.isInJSFile(declaration) && getTypeForDeclarationFromJSDocComment(declaration);
if (jsDocType) {
return jsDocType;
}
- var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 159 /* SetAccessor */);
+ var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 160 /* SetAccessor */);
var setterType = getAnnotatedAccessorType(setter);
if (setterType) {
return setterType;
@@ -38856,7 +39255,7 @@
function getSignatureInstantiation(signature, typeArguments, isJavascript, inferredTypeParameters) {
var instantiatedSignature = getSignatureInstantiationWithoutFillingInTypeArguments(signature, fillMissingTypeArguments(typeArguments, signature.typeParameters, getMinTypeArgumentCount(signature.typeParameters), isJavascript));
if (inferredTypeParameters) {
- var returnSignature = getSingleCallSignature(getReturnTypeOfSignature(instantiatedSignature));
+ var returnSignature = getSingleCallOrConstructSignature(getReturnTypeOfSignature(instantiatedSignature));
if (returnSignature) {
var newReturnSignature = cloneSignature(returnSignature);
newReturnSignature.typeParameters = inferredTypeParameters;
@@ -38909,7 +39308,7 @@
var typeParameters = signature.typeParameters;
if (typeParameters) {
var typeEraser_1 = createTypeEraser(typeParameters);
- var baseConstraints = ts.map(typeParameters, function (tp) { return instantiateType(getBaseConstraintOfType(tp), typeEraser_1) || emptyObjectType; });
+ var baseConstraints = ts.map(typeParameters, function (tp) { return instantiateType(getBaseConstraintOfType(tp), typeEraser_1) || unknownType; });
return instantiateSignature(signature, createTypeMapper(typeParameters, baseConstraints), /*eraseTypeParameters*/ true);
}
return signature;
@@ -38920,7 +39319,8 @@
// object type literal or interface (using the new keyword). Each way of declaring a constructor
// will result in a different declaration kind.
if (!signature.isolatedSignatureType) {
- var isConstructor = signature.declaration.kind === 157 /* Constructor */ || signature.declaration.kind === 161 /* ConstructSignature */; // TODO: GH#18217
+ var kind = signature.declaration ? signature.declaration.kind : 0 /* Unknown */;
+ var isConstructor = kind === 158 /* Constructor */ || kind === 162 /* ConstructSignature */ || kind === 167 /* ConstructorType */;
var type = createObjectType(16 /* Anonymous */);
type.members = emptySymbols;
type.properties = ts.emptyArray;
@@ -38934,7 +39334,7 @@
return symbol.members.get("__index" /* Index */);
}
function getIndexDeclarationOfSymbol(symbol, kind) {
- var syntaxKind = kind === 1 /* Number */ ? 135 /* NumberKeyword */ : 138 /* StringKeyword */;
+ var syntaxKind = kind === 1 /* Number */ ? 136 /* NumberKeyword */ : 139 /* StringKeyword */;
var indexSymbol = getIndexSymbol(symbol);
if (indexSymbol) {
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
@@ -38961,7 +39361,7 @@
return undefined;
}
function getConstraintDeclaration(type) {
- var decl = type.symbol && ts.getDeclarationOfKind(type.symbol, 150 /* TypeParameter */);
+ var decl = type.symbol && ts.getDeclarationOfKind(type.symbol, 151 /* TypeParameter */);
return decl && ts.getEffectiveConstraintOfTypeParameter(decl);
}
function getInferredTypeParameterConstraint(typeParameter) {
@@ -38969,13 +39369,13 @@
if (typeParameter.symbol) {
for (var _i = 0, _a = typeParameter.symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.parent.kind === 176 /* InferType */) {
+ if (declaration.parent.kind === 177 /* InferType */) {
// When an 'infer T' declaration is immediately contained in a type reference node
// (such as 'Foo<infer T>'), T's constraint is inferred from the constraint of the
// corresponding type parameter in 'Foo'. When multiple 'infer T' declarations are
// present, we form an intersection of the inferred constraint types.
var grandParent = declaration.parent.parent;
- if (grandParent.kind === 164 /* TypeReference */) {
+ if (grandParent.kind === 165 /* TypeReference */) {
var typeReference = grandParent;
var typeParameters = getTypeParametersForTypeReference(typeReference);
if (typeParameters) {
@@ -39000,7 +39400,7 @@
}
// When an 'infer T' declaration is immediately contained in a rest parameter
// declaration, we infer an 'unknown[]' constraint.
- else if (grandParent.kind === 151 /* Parameter */ && grandParent.dotDotDotToken) {
+ else if (grandParent.kind === 152 /* Parameter */ && grandParent.dotDotDotToken) {
inferences = ts.append(inferences, createArrayType(unknownType));
}
}
@@ -39024,7 +39424,7 @@
return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint;
}
function getParentSymbolOfTypeParameter(typeParameter) {
- var tp = ts.getDeclarationOfKind(typeParameter.symbol, 150 /* TypeParameter */);
+ var tp = ts.getDeclarationOfKind(typeParameter.symbol, 151 /* TypeParameter */);
var host = ts.isJSDocTemplateTag(tp.parent) ? ts.getHostSignatureFromJSDoc(tp.parent) : tp.parent;
return host && getSymbolOfNode(host);
}
@@ -39157,9 +39557,9 @@
}
function getTypeReferenceName(node) {
switch (node.kind) {
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return node.typeName;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
// We only support expressions that are simple qualified names. For other
// expressions this produces undefined.
var expr = node.expression;
@@ -39258,16 +39658,22 @@
}
}
function getSubstitutionType(typeVariable, substitute) {
- if (substitute.flags & 3 /* AnyOrUnknown */) {
+ if (substitute.flags & 3 /* AnyOrUnknown */ || substitute === typeVariable) {
return typeVariable;
}
+ var id = getTypeId(typeVariable) + ">" + getTypeId(substitute);
+ var cached = substitutionTypes.get(id);
+ if (cached) {
+ return cached;
+ }
var result = createType(33554432 /* Substitution */);
result.typeVariable = typeVariable;
result.substitute = substitute;
+ substitutionTypes.set(id, result);
return result;
}
function isUnaryTupleTypeNode(node) {
- return node.kind === 170 /* TupleType */ && node.elementTypes.length === 1;
+ return node.kind === 171 /* TupleType */ && node.elementTypes.length === 1;
}
function getImpliedConstraint(typeVariable, checkNode, extendsNode) {
return isUnaryTupleTypeNode(checkNode) && isUnaryTupleTypeNode(extendsNode) ? getImpliedConstraint(typeVariable, checkNode.elementTypes[0], extendsNode.elementTypes[0]) :
@@ -39276,9 +39682,9 @@
}
function getConstrainedTypeVariable(typeVariable, node) {
var constraints;
- while (node && !ts.isStatement(node) && node.kind !== 296 /* JSDocComment */) {
+ while (node && !ts.isStatement(node) && node.kind !== 297 /* JSDocComment */) {
var parent = node.parent;
- if (parent.kind === 175 /* ConditionalType */ && node === parent.trueType) {
+ if (parent.kind === 176 /* ConditionalType */ && node === parent.trueType) {
var constraint = getImpliedConstraint(typeVariable, parent.checkType, parent.extendsType);
if (constraint) {
constraints = ts.append(constraints, constraint);
@@ -39289,7 +39695,7 @@
return constraints ? getSubstitutionType(typeVariable, getIntersectionType(ts.append(constraints, typeVariable))) : typeVariable;
}
function isJSDocTypeReference(node) {
- return !!(node.flags & 2097152 /* JSDoc */) && (node.kind === 164 /* TypeReference */ || node.kind === 183 /* ImportType */);
+ return !!(node.flags & 2097152 /* JSDoc */) && (node.kind === 165 /* TypeReference */ || node.kind === 184 /* ImportType */);
}
function checkNoTypeArguments(node, symbol) {
if (node.typeArguments) {
@@ -39390,9 +39796,9 @@
for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) {
var declaration = declarations_3[_i];
switch (declaration.kind) {
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
return declaration;
}
}
@@ -39478,11 +39884,8 @@
function getGlobalExtractSymbol() {
return deferredGlobalExtractSymbol || (deferredGlobalExtractSymbol = getGlobalSymbol("Extract", 524288 /* TypeAlias */, ts.Diagnostics.Cannot_find_global_type_0)); // TODO: GH#18217
}
- function getGlobalExcludeSymbol() {
- return deferredGlobalExcludeSymbol || (deferredGlobalExcludeSymbol = getGlobalSymbol("Exclude", 524288 /* TypeAlias */, ts.Diagnostics.Cannot_find_global_type_0)); // TODO: GH#18217
- }
- function getGlobalPickSymbol() {
- return deferredGlobalPickSymbol || (deferredGlobalPickSymbol = getGlobalSymbol("Pick", 524288 /* TypeAlias */, ts.Diagnostics.Cannot_find_global_type_0)); // TODO: GH#18217
+ function getGlobalOmitSymbol() {
+ return deferredGlobalOmitSymbol || (deferredGlobalOmitSymbol = getGlobalSymbol("Omit", 524288 /* TypeAlias */, ts.Diagnostics.Cannot_find_global_type_0)); // TODO: GH#18217
}
function getGlobalBigIntType(reportErrors) {
return deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, reportErrors)) || emptyObjectType;
@@ -39519,7 +39922,7 @@
return links.resolvedType;
}
function isReadonlyTypeOperator(node) {
- return ts.isTypeOperatorNode(node) && node.operator === 133 /* ReadonlyKeyword */;
+ return ts.isTypeOperatorNode(node) && node.operator === 134 /* ReadonlyKeyword */;
}
// We represent tuple types as type references to synthesized generic interface types created by
// this function. The types are of the form:
@@ -39594,8 +39997,8 @@
var links = getNodeLinks(node);
if (!links.resolvedType) {
var lastElement = ts.lastOrUndefined(node.elementTypes);
- var restElement_1 = lastElement && lastElement.kind === 172 /* RestType */ ? lastElement : undefined;
- var minLength = ts.findLastIndex(node.elementTypes, function (n) { return n.kind !== 171 /* OptionalType */ && n !== restElement_1; }) + 1;
+ var restElement_1 = lastElement && lastElement.kind === 173 /* RestType */ ? lastElement : undefined;
+ var minLength = ts.findLastIndex(node.elementTypes, function (n) { return n.kind !== 172 /* OptionalType */ && n !== restElement_1; }) + 1;
var elementTypes = ts.map(node.elementTypes, function (n) {
var type = getTypeFromTypeNode(n);
return n === restElement_1 && getIndexTypeOfType(type, 1 /* Number */) || type;
@@ -39982,6 +40385,14 @@
types[index] = getUnionTypeFromSortedList(result, 65536 /* PrimitiveUnion */);
return true;
}
+ function createIntersectionType(types, aliasSymbol, aliasTypeArguments) {
+ var result = createType(2097152 /* Intersection */);
+ result.objectFlags = getPropagatingFlagsOfTypes(types, /*excludeKinds*/ 98304 /* Nullable */);
+ result.types = types;
+ result.aliasSymbol = aliasSymbol; // See comment in `getUnionTypeFromSortedList`.
+ result.aliasTypeArguments = aliasTypeArguments;
+ return result;
+ }
// We normalize combinations of intersection and union types based on the distributive property of the '&'
// operator. Specifically, because X & (A | B) is equivalent to X & A | X & B, we can transform intersection
// types with union type constituents into equivalent union types with intersection type constituents and
@@ -40019,30 +40430,36 @@
if (typeSet.length === 1) {
return typeSet[0];
}
+ var id = getTypeListId(typeSet);
+ var result = intersectionTypes.get(id);
+ if (!result) {
if (includes & 1048576 /* Union */) {
if (intersectUnionsOfPrimitiveTypes(typeSet)) {
// When the intersection creates a reduced set (which might mean that *all* union types have
// disappeared), we restart the operation to get a new set of combined flags. Once we have
// reduced we'll never reduce again, so this occurs at most once.
- return getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
+ result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
}
+ else {
// We are attempting to construct a type of the form X & (A | B) & Y. Transform this into a type of
// the form X & A & Y | X & B & Y and recursively reduce until no union type constituents remain.
+ // If the estimated size of the resulting union type exceeds 100000 constituents, report an error.
+ var size = ts.reduceLeft(typeSet, function (n, t) { return n * (t.flags & 1048576 /* Union */ ? t.types.length : 1); }, 1);
+ if (size >= 100000) {
+ error(currentNode, ts.Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
+ return errorType;
+ }
var unionIndex_1 = ts.findIndex(typeSet, function (t) { return (t.flags & 1048576 /* Union */) !== 0; });
var unionType = typeSet[unionIndex_1];
- return getUnionType(ts.map(unionType.types, function (t) { return getIntersectionType(ts.replaceElement(typeSet, unionIndex_1, t)); }), 1 /* Literal */, aliasSymbol, aliasTypeArguments);
+ result = getUnionType(ts.map(unionType.types, function (t) { return getIntersectionType(ts.replaceElement(typeSet, unionIndex_1, t)); }), 1 /* Literal */, aliasSymbol, aliasTypeArguments);
}
- var id = getTypeListId(typeSet);
- var type = intersectionTypes.get(id);
- if (!type) {
- type = createType(2097152 /* Intersection */);
- intersectionTypes.set(id, type);
- type.objectFlags = getPropagatingFlagsOfTypes(typeSet, /*excludeKinds*/ 98304 /* Nullable */);
- type.types = typeSet;
- type.aliasSymbol = aliasSymbol; // See comment in `getUnionTypeFromSortedList`.
- type.aliasTypeArguments = aliasTypeArguments;
}
- return type;
+ else {
+ result = createIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
+ }
+ intersectionTypes.set(id, result);
+ }
+ return result;
}
function getTypeFromIntersectionTypeNode(node) {
var links = getNodeLinks(node);
@@ -40098,16 +40515,17 @@
var numberIndexInfo = getIndexInfoOfType(type, 1 /* Number */);
return numberIndexInfo !== enumNumberIndexInfo ? numberIndexInfo : undefined;
}
- function getIndexType(type, stringsOnly) {
+ function getIndexType(type, stringsOnly, noIndexSignatures) {
if (stringsOnly === void 0) { stringsOnly = keyofStringsOnly; }
- return type.flags & 1048576 /* Union */ ? getIntersectionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly); })) :
- type.flags & 2097152 /* Intersection */ ? getUnionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly); })) :
+ return type.flags & 1048576 /* Union */ ? getIntersectionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
+ type.flags & 2097152 /* Intersection */ ? getUnionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
maybeTypeOfKind(type, 58982400 /* InstantiableNonPrimitive */) ? getIndexTypeForGenericType(type, stringsOnly) :
- ts.getObjectFlags(type) & 32 /* Mapped */ ? getConstraintTypeFromMappedType(type) :
+ ts.getObjectFlags(type) & 32 /* Mapped */ ? filterType(getConstraintTypeFromMappedType(type), function (t) { return !(noIndexSignatures && t.flags & (1 /* Any */ | 4 /* String */)); }) :
type === wildcardType ? wildcardType :
- type.flags & 1 /* Any */ ? keyofConstraintType :
- stringsOnly ? getIndexInfoOfType(type, 0 /* String */) ? stringType : getLiteralTypeFromProperties(type, 128 /* StringLiteral */) :
- getIndexInfoOfType(type, 0 /* String */) ? getUnionType([stringType, numberType, getLiteralTypeFromProperties(type, 8192 /* UniqueESSymbol */)]) :
+ type.flags & 2 /* Unknown */ ? neverType :
+ type.flags & (1 /* Any */ | 131072 /* Never */) ? keyofConstraintType :
+ stringsOnly ? !noIndexSignatures && getIndexInfoOfType(type, 0 /* String */) ? stringType : getLiteralTypeFromProperties(type, 128 /* StringLiteral */) :
+ !noIndexSignatures && getIndexInfoOfType(type, 0 /* String */) ? getUnionType([stringType, numberType, getLiteralTypeFromProperties(type, 8192 /* UniqueESSymbol */)]) :
getNonEnumNumberIndexInfo(type) ? getUnionType([numberType, getLiteralTypeFromProperties(type, 128 /* StringLiteral */ | 8192 /* UniqueESSymbol */)]) :
getLiteralTypeFromProperties(type, 8576 /* StringOrNumberLiteralOrUnique */);
}
@@ -40126,15 +40544,15 @@
var links = getNodeLinks(node);
if (!links.resolvedType) {
switch (node.operator) {
- case 129 /* KeyOfKeyword */:
+ case 130 /* KeyOfKeyword */:
links.resolvedType = getIndexType(getTypeFromTypeNode(node.type));
break;
- case 142 /* UniqueKeyword */:
- links.resolvedType = node.type.kind === 139 /* SymbolKeyword */
+ case 143 /* UniqueKeyword */:
+ links.resolvedType = node.type.kind === 140 /* SymbolKeyword */
? getESSymbolLikeTypeForNode(ts.walkUpParenthesizedTypes(node.parent))
: errorType;
break;
- case 133 /* ReadonlyKeyword */:
+ case 134 /* ReadonlyKeyword */:
links.resolvedType = getTypeFromTypeNode(node.type);
break;
}
@@ -40174,8 +40592,8 @@
}
return false;
}
- function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol, missingType) {
- var accessExpression = accessNode && accessNode.kind === 190 /* ElementAccessExpression */ ? accessNode : undefined;
+ function getPropertyTypeForIndexType(originalObjectType, objectType, indexType, fullIndexType, suppressNoImplicitAnyError, accessNode, accessFlags) {
+ var accessExpression = accessNode && accessNode.kind === 191 /* ElementAccessExpression */ ? accessNode : undefined;
var propName = isTypeUsableAsPropertyName(indexType) ?
getPropertyNameFromType(indexType) :
accessExpression && checkThatExpressionIsProperSymbolReference(accessExpression.argumentExpression, indexType, /*reportError*/ false) ?
@@ -40188,12 +40606,12 @@
var prop = getPropertyOfType(objectType, propName);
if (prop) {
if (accessExpression) {
- markPropertyAsReferenced(prop, accessExpression, /*isThisAccess*/ accessExpression.expression.kind === 100 /* ThisKeyword */);
+ markPropertyAsReferenced(prop, accessExpression, /*isThisAccess*/ accessExpression.expression.kind === 101 /* ThisKeyword */);
if (ts.isAssignmentTarget(accessExpression) && (isReferenceToReadonlyEntity(accessExpression, prop) || isReferenceThroughNamespaceImport(accessExpression))) {
error(accessExpression.argumentExpression, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, symbolToString(prop));
- return missingType;
+ return undefined;
}
- if (cacheSymbol) {
+ if (accessFlags & 4 /* CacheSymbol */) {
getNodeLinks(accessNode).resolvedSymbol = prop;
}
}
@@ -40212,6 +40630,7 @@
error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.unescapeLeadingUnderscores(propName), typeToString(objectType));
}
}
+ errorIfWritingToReadonlyIndex(getIndexInfoOfType(objectType, 1 /* Number */));
return mapType(objectType, function (t) { return getRestTypeOfTupleType(t) || undefinedType; });
}
}
@@ -40219,17 +40638,21 @@
if (objectType.flags & (1 /* Any */ | 131072 /* Never */)) {
return objectType;
}
- var indexInfo = isTypeAssignableToKind(indexType, 296 /* NumberLike */) && getIndexInfoOfType(objectType, 1 /* Number */) ||
- getIndexInfoOfType(objectType, 0 /* String */) ||
- undefined;
+ var stringIndexInfo = getIndexInfoOfType(objectType, 0 /* String */);
+ var indexInfo = isTypeAssignableToKind(indexType, 296 /* NumberLike */) && getIndexInfoOfType(objectType, 1 /* Number */) || stringIndexInfo;
if (indexInfo) {
+ if (accessFlags & 1 /* NoIndexSignatures */ && indexInfo === stringIndexInfo) {
+ if (accessExpression) {
+ error(accessExpression, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(originalObjectType));
+ }
+ return undefined;
+ }
if (accessNode && !isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
var indexNode = getIndexNodeForAccessExpression(accessNode);
error(indexNode, ts.Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType));
+ return indexInfo.type;
}
- else if (accessExpression && indexInfo.isReadonly && (ts.isAssignmentTarget(accessExpression) || ts.isDeleteTarget(accessExpression))) {
- error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
- }
+ errorIfWritingToReadonlyIndex(indexInfo);
return indexInfo.type;
}
if (indexType.flags & 131072 /* Never */) {
@@ -40242,7 +40665,7 @@
if (objectType.symbol === globalThisSymbol && propName !== undefined && globalThisSymbol.exports.has(propName) && (globalThisSymbol.exports.get(propName).flags & 418 /* BlockScoped */)) {
error(accessExpression, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.unescapeLeadingUnderscores(propName), typeToString(objectType));
}
- else if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors) {
+ else if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors && !suppressNoImplicitAnyError) {
if (propName !== undefined && typeHasStaticProperty(propName, objectType)) {
error(accessExpression, ts.Diagnostics.Property_0_is_a_static_member_of_type_1, propName, typeToString(objectType));
}
@@ -40257,11 +40680,35 @@
}
}
else {
- error(accessExpression, ts.Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature, typeToString(objectType));
+ var suggestion_1 = getSuggestionForNonexistentIndexSignature(objectType, accessExpression);
+ if (suggestion_1 !== undefined) {
+ error(accessExpression, ts.Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1, typeToString(objectType), suggestion_1);
+ }
+ else {
+ var errorInfo = void 0;
+ if (indexType.flags & 1024 /* EnumLiteral */) {
+ errorInfo = ts.chainDiagnosticMessages(/* details */ undefined, ts.Diagnostics.Property_0_does_not_exist_on_type_1, "[" + typeToString(indexType) + "]", typeToString(objectType));
}
+ else if (indexType.flags & 8192 /* UniqueESSymbol */) {
+ var symbolName_2 = getFullyQualifiedName(indexType.symbol, accessExpression);
+ errorInfo = ts.chainDiagnosticMessages(/* details */ undefined, ts.Diagnostics.Property_0_does_not_exist_on_type_1, "[" + symbolName_2 + "]", typeToString(objectType));
}
+ else if (indexType.flags & 128 /* StringLiteral */) {
+ errorInfo = ts.chainDiagnosticMessages(/* details */ undefined, ts.Diagnostics.Property_0_does_not_exist_on_type_1, indexType.value, typeToString(objectType));
}
- return missingType;
+ else if (indexType.flags & 256 /* NumberLiteral */) {
+ errorInfo = ts.chainDiagnosticMessages(/* details */ undefined, ts.Diagnostics.Property_0_does_not_exist_on_type_1, indexType.value, typeToString(objectType));
+ }
+ else if (indexType.flags & (8 /* Number */ | 4 /* String */)) {
+ errorInfo = ts.chainDiagnosticMessages(/* details */ undefined, ts.Diagnostics.No_index_signature_with_a_parameter_of_type_0_was_found_on_type_1, typeToString(indexType), typeToString(objectType));
+ }
+ errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1, typeToString(fullIndexType), typeToString(objectType));
+ diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(accessExpression, errorInfo));
+ }
+ }
+ }
+ }
+ return undefined;
}
}
if (isJSLiteralType(objectType)) {
@@ -40282,14 +40729,19 @@
if (isTypeAny(indexType)) {
return indexType;
}
- return missingType;
+ return undefined;
+ function errorIfWritingToReadonlyIndex(indexInfo) {
+ if (indexInfo && indexInfo.isReadonly && accessExpression && (ts.isAssignmentTarget(accessExpression) || ts.isDeleteTarget(accessExpression))) {
+ error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
+ }
+ }
}
function getIndexNodeForAccessExpression(accessNode) {
- return accessNode.kind === 190 /* ElementAccessExpression */
+ return accessNode.kind === 191 /* ElementAccessExpression */
? accessNode.argumentExpression
- : accessNode.kind === 180 /* IndexedAccessType */
+ : accessNode.kind === 181 /* IndexedAccessType */
? accessNode.indexType
- : accessNode.kind === 149 /* ComputedPropertyName */
+ : accessNode.kind === 150 /* ComputedPropertyName */
? accessNode.expression
: accessNode;
}
@@ -40299,67 +40751,124 @@
function isGenericIndexType(type) {
return maybeTypeOfKind(type, 58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */);
}
- function getSimplifiedType(type) {
- return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type) : type;
+ function isThisTypeParameter(type) {
+ return !!(type.flags & 262144 /* TypeParameter */ && type.isThisType);
}
- function distributeIndexOverObjectType(objectType, indexType) {
- // (T | U)[K] -> T[K] | U[K]
- if (objectType.flags & 1048576 /* Union */) {
- return mapType(objectType, function (t) { return getSimplifiedType(getIndexedAccessType(t, indexType)); });
+ function getSimplifiedType(type, writing) {
+ return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) :
+ type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) :
+ type;
}
+ function distributeIndexOverObjectType(objectType, indexType, writing) {
+ // (T | U)[K] -> T[K] | U[K] (reading)
+ // (T | U)[K] -> T[K] & U[K] (writing)
// (T & U)[K] -> T[K] & U[K]
- if (objectType.flags & 2097152 /* Intersection */) {
- return getIntersectionType(ts.map(objectType.types, function (t) { return getSimplifiedType(getIndexedAccessType(t, indexType)); }));
+ if (objectType.flags & 3145728 /* UnionOrIntersection */) {
+ var types = ts.map(objectType.types, function (t) { return getSimplifiedType(getIndexedAccessType(t, indexType), writing); });
+ return objectType.flags & 2097152 /* Intersection */ || writing ? getIntersectionType(types) : getUnionType(types);
+ }
+ }
+ function distributeObjectOverIndexType(objectType, indexType, writing) {
+ // T[A | B] -> T[A] | T[B] (reading)
+ // T[A | B] -> T[A] & T[B] (writing)
+ if (indexType.flags & 1048576 /* Union */) {
+ var types = ts.map(indexType.types, function (t) { return getSimplifiedType(getIndexedAccessType(objectType, t), writing); });
+ return writing ? getIntersectionType(types) : getUnionType(types);
}
}
// Transform an indexed access to a simpler form, if possible. Return the simpler form, or return
- // the type itself if no transformation is possible.
- function getSimplifiedIndexedAccessType(type) {
- if (type.simplified) {
- return type.simplified === circularConstraintType ? type : type.simplified;
+ // the type itself if no transformation is possible. The writing flag indicates that the type is
+ // the target of an assignment.
+ function getSimplifiedIndexedAccessType(type, writing) {
+ var cache = writing ? "simplifiedForWriting" : "simplifiedForReading";
+ if (type[cache]) {
+ return type[cache] === circularConstraintType ? type : type[cache];
}
- type.simplified = circularConstraintType;
+ type[cache] = circularConstraintType;
// We recursively simplify the object type as it may in turn be an indexed access type. For example, with
// '{ [P in T]: { [Q in U]: number } }[T][U]' we want to first simplify the inner indexed access type.
- var objectType = getSimplifiedType(type.objectType);
- var indexType = getSimplifiedType(type.indexType);
- // T[A | B] -> T[A] | T[B]
- if (indexType.flags & 1048576 /* Union */) {
- return type.simplified = mapType(indexType, function (t) { return getSimplifiedType(getIndexedAccessType(objectType, t)); });
+ var objectType = getSimplifiedType(type.objectType, writing);
+ var indexType = getSimplifiedType(type.indexType, writing);
+ // T[A | B] -> T[A] | T[B] (reading)
+ // T[A | B] -> T[A] & T[B] (writing)
+ var distributedOverIndex = distributeObjectOverIndexType(objectType, indexType, writing);
+ if (distributedOverIndex) {
+ return type[cache] = distributedOverIndex;
}
// Only do the inner distributions if the index can no longer be instantiated to cause index distribution again
if (!(indexType.flags & 63176704 /* Instantiable */)) {
- var simplified = distributeIndexOverObjectType(objectType, indexType);
- if (simplified) {
- return type.simplified = simplified;
+ // (T | U)[K] -> T[K] | U[K] (reading)
+ // (T | U)[K] -> T[K] & U[K] (writing)
+ // (T & U)[K] -> T[K] & U[K]
+ var distributedOverObject = distributeIndexOverObjectType(objectType, indexType, writing);
+ if (distributedOverObject) {
+ return type[cache] = distributedOverObject;
}
}
- // So ultimately:
+ // So ultimately (reading):
// ((A & B) | C)[K1 | K2] -> ((A & B) | C)[K1] | ((A & B) | C)[K2] -> (A & B)[K1] | C[K1] | (A & B)[K2] | C[K2] -> (A[K1] & B[K1]) | C[K1] | (A[K2] & B[K2]) | C[K2]
// If the object type is a mapped type { [P in K]: E }, where K is generic, instantiate E using a mapper
// that substitutes the index type for P. For example, for an index access { [P in K]: Box<T[P]> }[X], we
// construct the type Box<T[X]>.
if (isGenericMappedType(objectType)) {
- return type.simplified = mapType(substituteIndexedMappedType(objectType, type.indexType), getSimplifiedType);
+ return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), function (t) { return getSimplifiedType(t, writing); });
+ }
+ return type[cache] = type;
+ }
+ function getSimplifiedConditionalType(type, writing) {
+ var checkType = type.checkType;
+ var extendsType = type.extendsType;
+ var trueType = getTrueTypeFromConditionalType(type);
+ var falseType = getFalseTypeFromConditionalType(type);
+ // Simplifications for types of the form `T extends U ? T : never` and `T extends U ? never : T`.
+ if (falseType.flags & 131072 /* Never */ && getActualTypeVariable(trueType) === getActualTypeVariable(checkType)) {
+ if (checkType.flags & 1 /* Any */ || isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { // Always true
+ return getSimplifiedType(trueType, writing);
+ }
+ else if (isIntersectionEmpty(checkType, extendsType)) { // Always false
+ return neverType;
+ }
+ }
+ else if (trueType.flags & 131072 /* Never */ && getActualTypeVariable(falseType) === getActualTypeVariable(checkType)) {
+ if (!(checkType.flags & 1 /* Any */) && isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { // Always true
+ return neverType;
}
- return type.simplified = type;
+ else if (checkType.flags & 1 /* Any */ || isIntersectionEmpty(checkType, extendsType)) { // Always false
+ return getSimplifiedType(falseType, writing);
+ }
+ }
+ return type;
+ }
+ /**
+ * Invokes union simplification logic to determine if an intersection is considered empty as a union constituent
+ */
+ function isIntersectionEmpty(type1, type2) {
+ return !!(getUnionType([intersectTypes(type1, type2), neverType]).flags & 131072 /* Never */);
}
function substituteIndexedMappedType(objectType, index) {
var mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [index]);
var templateMapper = combineTypeMappers(objectType.mapper, mapper);
return instantiateType(getTemplateTypeFromMappedType(objectType), templateMapper);
}
- function getIndexedAccessType(objectType, indexType, accessNode, missingType) {
- if (missingType === void 0) { missingType = accessNode ? errorType : unknownType; }
+ function getIndexedAccessType(objectType, indexType, accessNode) {
+ return getIndexedAccessTypeOrUndefined(objectType, indexType, accessNode, 0 /* None */) || (accessNode ? errorType : unknownType);
+ }
+ function getIndexedAccessTypeOrUndefined(objectType, indexType, accessNode, accessFlags) {
+ if (accessFlags === void 0) { accessFlags = 0 /* None */; }
if (objectType === wildcardType || indexType === wildcardType) {
return wildcardType;
}
+ // If the object type has a string index signature and no other members we know that the result will
+ // always be the type of that index signature and we can simplify accordingly.
+ if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
+ indexType = stringType;
+ }
// If the index type is generic, or if the object type is generic and doesn't originate in an expression,
// we are performing a higher-order index access where we cannot meaningfully access the properties of the
// object type. Note that for a generic T and a non-generic K, we eagerly resolve T[K] if it originates in
// an expression. This is to preserve backwards compatibility. For example, an element access 'this["foo"]'
// has always been resolved eagerly using the constraint type of 'this' at the given location.
- if (isGenericIndexType(indexType) || !(accessNode && accessNode.kind !== 180 /* IndexedAccessType */) && isGenericObjectType(objectType)) {
+ if (isGenericIndexType(indexType) || !(accessNode && accessNode.kind !== 181 /* IndexedAccessType */) && isGenericObjectType(objectType)) {
if (objectType.flags & 3 /* AnyOrUnknown */) {
return objectType;
}
@@ -40380,25 +40889,25 @@
var wasMissingProp = false;
for (var _i = 0, _a = indexType.types; _i < _a.length; _i++) {
var t = _a[_i];
- var propType = getPropertyTypeForIndexType(apparentObjectType, t, accessNode, /*cacheSymbol*/ false, missingType);
- if (propType === missingType) {
- if (!accessNode) {
+ var propType = getPropertyTypeForIndexType(objectType, apparentObjectType, t, indexType, wasMissingProp, accessNode, accessFlags);
+ if (propType) {
+ propTypes.push(propType);
+ }
+ else if (!accessNode) {
// If there's no error node, we can immeditely stop, since error reporting is off
- return missingType;
+ return undefined;
}
else {
// Otherwise we set a flag and return at the end of the loop so we still mark all errors
wasMissingProp = true;
}
}
- propTypes.push(propType);
- }
if (wasMissingProp) {
- return missingType;
+ return undefined;
}
- return getUnionType(propTypes);
+ return accessFlags & 2 /* Writing */ ? getIntersectionType(propTypes) : getUnionType(propTypes);
}
- return getPropertyTypeForIndexType(apparentObjectType, indexType, accessNode, /*cacheSymbol*/ true, missingType);
+ return getPropertyTypeForIndexType(objectType, apparentObjectType, indexType, indexType, /* supressNoImplicitAnyError */ false, accessNode, accessFlags | 4 /* CacheSymbol */);
}
function getTypeFromIndexedAccessTypeNode(node) {
var links = getNodeLinks(node);
@@ -40428,13 +40937,14 @@
return links.resolvedType;
}
function getActualTypeVariable(type) {
- return type.flags & 33554432 /* Substitution */ ? type.typeVariable : type;
+ if (type.flags & 33554432 /* Substitution */) {
+ return type.typeVariable;
}
- /**
- * Invokes union simplification logic to determine if an intersection is considered empty as a union constituent
- */
- function isIntersectionEmpty(type1, type2) {
- return !!(getUnionType([intersectTypes(type1, type2), neverType]).flags & 131072 /* Never */);
+ if (type.flags & 8388608 /* IndexedAccess */ && (type.objectType.flags & 33554432 /* Substitution */ ||
+ type.indexType.flags & 33554432 /* Substitution */)) {
+ return getIndexedAccessType(getActualTypeVariable(type.objectType), getActualTypeVariable(type.indexType));
+ }
+ return type;
}
function getConditionalType(root, mapper) {
var checkType = instantiateType(root.checkType, mapper);
@@ -40442,35 +40952,6 @@
if (checkType === wildcardType || extendsType === wildcardType) {
return wildcardType;
}
- var trueType = instantiateType(root.trueType, mapper);
- var falseType = instantiateType(root.falseType, mapper);
- var instantiationId = "" + (root.isDistributive ? "d" : "") + getTypeId(checkType) + ">" + getTypeId(extendsType) + "?" + getTypeId(trueType) + ":" + getTypeId(falseType);
- var result = conditionalTypes.get(instantiationId);
- if (result) {
- return result;
- }
- var newResult = getConditionalTypeWorker(root, mapper, checkType, extendsType, trueType, falseType);
- conditionalTypes.set(instantiationId, newResult);
- return newResult;
- }
- function getConditionalTypeWorker(root, mapper, checkType, extendsType, trueType, falseType) {
- // Simplifications for types of the form `T extends U ? T : never` and `T extends U ? never : T`.
- if (falseType.flags & 131072 /* Never */ && getActualTypeVariable(trueType) === getActualTypeVariable(checkType)) {
- if (checkType.flags & 1 /* Any */ || isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { // Always true
- return trueType;
- }
- else if (isIntersectionEmpty(checkType, extendsType)) { // Always false
- return neverType;
- }
- }
- else if (trueType.flags & 131072 /* Never */ && getActualTypeVariable(falseType) === getActualTypeVariable(checkType)) {
- if (!(checkType.flags & 1 /* Any */) && isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { // Always true
- return neverType;
- }
- else if (checkType.flags & 1 /* Any */ || isIntersectionEmpty(checkType, extendsType)) { // Always false
- return falseType;
- }
- }
var checkTypeInstantiable = maybeTypeOfKind(checkType, 63176704 /* Instantiable */ | 131072 /* GenericMappedType */);
var combinedMapper;
if (root.inferTypeParameters) {
@@ -40479,7 +40960,7 @@
// We don't want inferences from constraints as they may cause us to eagerly resolve the
// conditional type instead of deferring resolution. Also, we always want strict function
// types rules (i.e. proper contravariance) for inferences.
- inferTypes(context.inferences, checkType, extendsType, 32 /* NoConstraints */ | 64 /* AlwaysStrict */);
+ inferTypes(context.inferences, checkType, extendsType, 64 /* NoConstraints */ | 128 /* AlwaysStrict */);
}
combinedMapper = combineTypeMappers(mapper, context.mapper);
}
@@ -40488,18 +40969,18 @@
// We attempt to resolve the conditional type only when the check and extends types are non-generic
if (!checkTypeInstantiable && !maybeTypeOfKind(inferredExtendsType, 63176704 /* Instantiable */ | 131072 /* GenericMappedType */)) {
if (inferredExtendsType.flags & 3 /* AnyOrUnknown */) {
- return trueType;
+ return instantiateType(root.trueType, combinedMapper || mapper);
}
// Return union of trueType and falseType for 'any' since it matches anything
if (checkType.flags & 1 /* Any */) {
- return getUnionType([instantiateType(root.trueType, combinedMapper || mapper), falseType]);
+ return getUnionType([instantiateType(root.trueType, combinedMapper || mapper), instantiateType(root.falseType, mapper)]);
}
// Return falseType for a definitely false extends check. We check an instantiations of the two
// types with type parameters mapped to the wildcard type, the most permissive instantiations
// possible (the wildcard type is assignable to and from all types). If those are not related,
// then no instantiations will be and we can just return the false branch type.
if (!isTypeAssignableTo(getPermissiveInstantiation(checkType), getPermissiveInstantiation(inferredExtendsType))) {
- return falseType;
+ return instantiateType(root.falseType, mapper);
}
// Return trueType for a definitely true extends check. We check instantiations of the two
// types with type parameters mapped to their restrictive form, i.e. a form of the type parameter
@@ -40511,9 +40992,6 @@
}
}
// Return a deferred type for a check that is neither definitely true nor definitely false
- return getDeferredConditionalType(root, mapper, combinedMapper, checkType, extendsType, trueType, falseType);
- }
- function getDeferredConditionalType(root, mapper, combinedMapper, checkType, extendsType, trueType, falseType) {
var erasedCheckType = getActualTypeVariable(checkType);
var result = createType(16777216 /* Conditional */);
result.root = root;
@@ -40521,14 +40999,18 @@
result.extendsType = extendsType;
result.mapper = mapper;
result.combinedMapper = combinedMapper;
- result.trueType = trueType;
- result.falseType = falseType;
result.aliasSymbol = root.aliasSymbol;
result.aliasTypeArguments = instantiateTypes(root.aliasTypeArguments, mapper); // TODO: GH#18217
return result;
}
+ function getTrueTypeFromConditionalType(type) {
+ return type.resolvedTrueType || (type.resolvedTrueType = instantiateType(type.root.trueType, type.mapper));
+ }
+ function getFalseTypeFromConditionalType(type) {
+ return type.resolvedFalseType || (type.resolvedFalseType = instantiateType(type.root.falseType, type.mapper));
+ }
function getInferredTrueTypeFromConditionalType(type) {
- return type.resolvedInferredTrueType || (type.resolvedInferredTrueType = instantiateType(type.root.trueType, type.combinedMapper || type.mapper));
+ return type.resolvedInferredTrueType || (type.resolvedInferredTrueType = type.combinedMapper ? instantiateType(type.root.trueType, type.combinedMapper) : getTrueTypeFromConditionalType(type));
}
function getInferTypeParameters(node) {
var result;
@@ -40541,20 +41023,6 @@
}
return result;
}
- function isPossiblyReferencedInConditionalType(tp, node) {
- if (isTypeParameterPossiblyReferenced(tp, node)) {
- return true;
- }
- while (node) {
- if (node.kind === 175 /* ConditionalType */) {
- if (isTypeParameterPossiblyReferenced(tp, node.extendsType)) {
- return true;
- }
- }
- node = node.parent;
- }
- return false;
- }
function getTypeFromConditionalTypeNode(node) {
var links = getNodeLinks(node);
if (!links.resolvedType) {
@@ -40562,7 +41030,7 @@
var aliasSymbol = getAliasSymbolForTypeNode(node);
var aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol);
var allOuterTypeParameters = getOuterTypeParameters(node, /*includeThisTypes*/ true);
- var outerTypeParameters = aliasTypeArguments ? allOuterTypeParameters : ts.filter(allOuterTypeParameters, function (tp) { return isPossiblyReferencedInConditionalType(tp, node); });
+ var outerTypeParameters = aliasTypeArguments ? allOuterTypeParameters : ts.filter(allOuterTypeParameters, function (tp) { return isTypeParameterPossiblyReferenced(tp, node); });
var root = {
node: node,
checkType: checkType,
@@ -40873,9 +41341,9 @@
function getThisType(node) {
var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false);
var parent = container && container.parent;
- if (parent && (ts.isClassLike(parent) || parent.kind === 241 /* InterfaceDeclaration */)) {
+ if (parent && (ts.isClassLike(parent) || parent.kind === 242 /* InterfaceDeclaration */)) {
if (!ts.hasModifier(container, 32 /* Static */) &&
- (container.kind !== 157 /* Constructor */ || ts.isNodeDescendantOf(node, container.body))) {
+ (container.kind !== 158 /* Constructor */ || ts.isNodeDescendantOf(node, container.body))) {
return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType;
}
}
@@ -40891,89 +41359,89 @@
}
function getTypeFromTypeNode(node) {
switch (node.kind) {
- case 120 /* AnyKeyword */:
- case 289 /* JSDocAllType */:
- case 290 /* JSDocUnknownType */:
+ case 121 /* AnyKeyword */:
+ case 290 /* JSDocAllType */:
+ case 291 /* JSDocUnknownType */:
return anyType;
- case 143 /* UnknownKeyword */:
+ case 144 /* UnknownKeyword */:
return unknownType;
- case 138 /* StringKeyword */:
+ case 139 /* StringKeyword */:
return stringType;
- case 135 /* NumberKeyword */:
+ case 136 /* NumberKeyword */:
return numberType;
- case 146 /* BigIntKeyword */:
+ case 147 /* BigIntKeyword */:
return bigintType;
- case 123 /* BooleanKeyword */:
+ case 124 /* BooleanKeyword */:
return booleanType;
- case 139 /* SymbolKeyword */:
+ case 140 /* SymbolKeyword */:
return esSymbolType;
- case 106 /* VoidKeyword */:
+ case 107 /* VoidKeyword */:
return voidType;
- case 141 /* UndefinedKeyword */:
+ case 142 /* UndefinedKeyword */:
return undefinedType;
- case 96 /* NullKeyword */:
+ case 97 /* NullKeyword */:
return nullType;
- case 132 /* NeverKeyword */:
+ case 133 /* NeverKeyword */:
return neverType;
- case 136 /* ObjectKeyword */:
+ case 137 /* ObjectKeyword */:
return node.flags & 65536 /* JavaScriptFile */ ? anyType : nonPrimitiveType;
- case 178 /* ThisType */:
- case 100 /* ThisKeyword */:
+ case 179 /* ThisType */:
+ case 101 /* ThisKeyword */:
return getTypeFromThisTypeNode(node);
- case 182 /* LiteralType */:
+ case 183 /* LiteralType */:
return getTypeFromLiteralTypeNode(node);
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return getTypeFromTypeReference(node);
- case 163 /* TypePredicate */:
+ case 164 /* TypePredicate */:
return booleanType;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return getTypeFromTypeReference(node);
- case 167 /* TypeQuery */:
+ case 168 /* TypeQuery */:
return getTypeFromTypeQueryNode(node);
- case 169 /* ArrayType */:
+ case 170 /* ArrayType */:
return getTypeFromArrayTypeNode(node);
- case 170 /* TupleType */:
+ case 171 /* TupleType */:
return getTypeFromTupleTypeNode(node);
- case 171 /* OptionalType */:
+ case 172 /* OptionalType */:
return getTypeFromOptionalTypeNode(node);
- case 173 /* UnionType */:
+ case 174 /* UnionType */:
return getTypeFromUnionTypeNode(node);
- case 174 /* IntersectionType */:
+ case 175 /* IntersectionType */:
return getTypeFromIntersectionTypeNode(node);
- case 291 /* JSDocNullableType */:
+ case 292 /* JSDocNullableType */:
return getTypeFromJSDocNullableTypeNode(node);
- case 293 /* JSDocOptionalType */:
+ case 294 /* JSDocOptionalType */:
return addOptionality(getTypeFromTypeNode(node.type));
- case 177 /* ParenthesizedType */:
- case 172 /* RestType */:
- case 292 /* JSDocNonNullableType */:
- case 288 /* JSDocTypeExpression */:
+ case 178 /* ParenthesizedType */:
+ case 173 /* RestType */:
+ case 293 /* JSDocNonNullableType */:
+ case 289 /* JSDocTypeExpression */:
return getTypeFromTypeNode(node.type);
- case 295 /* JSDocVariadicType */:
+ case 296 /* JSDocVariadicType */:
return getTypeFromJSDocVariadicType(node);
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 168 /* TypeLiteral */:
- case 297 /* JSDocTypeLiteral */:
- case 294 /* JSDocFunctionType */:
- case 298 /* JSDocSignature */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 169 /* TypeLiteral */:
+ case 298 /* JSDocTypeLiteral */:
+ case 295 /* JSDocFunctionType */:
+ case 299 /* JSDocSignature */:
return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node);
- case 179 /* TypeOperator */:
+ case 180 /* TypeOperator */:
return getTypeFromTypeOperatorNode(node);
- case 180 /* IndexedAccessType */:
+ case 181 /* IndexedAccessType */:
return getTypeFromIndexedAccessTypeNode(node);
- case 181 /* MappedType */:
+ case 182 /* MappedType */:
return getTypeFromMappedTypeNode(node);
- case 175 /* ConditionalType */:
+ case 176 /* ConditionalType */:
return getTypeFromConditionalTypeNode(node);
- case 176 /* InferType */:
+ case 177 /* InferType */:
return getTypeFromInferTypeNode(node);
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return getTypeFromImportTypeNode(node);
// This function assumes that an identifier or qualified name is a type expression
// Callers should first ensure this by calling isTypeNode
- case 72 /* Identifier */:
- case 148 /* QualifiedName */:
+ case 73 /* Identifier */:
+ case 149 /* QualifiedName */:
var symbol = getSymbolAtLocation(node);
return symbol ? getDeclaredTypeOfSymbol(symbol) : errorType;
default:
@@ -41033,7 +41501,7 @@
* This is used during inference when instantiating type parameter defaults.
*/
function createBackreferenceMapper(context, index) {
- return function (t) { return ts.findIndex(context.inferences, function (info) { return info.typeParameter === t; }) >= index ? emptyObjectType : t; };
+ return function (t) { return ts.findIndex(context.inferences, function (info) { return info.typeParameter === t; }) >= index ? unknownType : t; };
}
function combineTypeMappers(mapper1, mapper2) {
if (!mapper1)
@@ -41116,7 +41584,7 @@
}
// Keep the flags from the symbol we're instantiating. Mark that is instantiated, and
// also transient so that we can just store data on it directly.
- var result = createSymbol(symbol.flags, symbol.escapedName, 1 /* Instantiated */ | ts.getCheckFlags(symbol) & (8 /* Readonly */ | 2048 /* Late */ | 8192 /* OptionalParameter */ | 16384 /* RestParameter */));
+ var result = createSymbol(symbol.flags, symbol.escapedName, 1 /* Instantiated */ | ts.getCheckFlags(symbol) & (8 /* Readonly */ | 4096 /* Late */ | 16384 /* OptionalParameter */ | 32768 /* RestParameter */));
result.declarations = symbol.declarations;
result.parent = symbol.parent;
result.target = symbol;
@@ -41182,28 +41650,31 @@
return type;
}
function maybeTypeParameterReference(node) {
- return !(node.kind === 148 /* QualifiedName */ ||
- node.parent.kind === 164 /* TypeReference */ && node.parent.typeArguments && node === node.parent.typeName);
+ return !(node.kind === 149 /* QualifiedName */ ||
+ node.parent.kind === 165 /* TypeReference */ && node.parent.typeArguments && node === node.parent.typeName);
}
function isTypeParameterPossiblyReferenced(tp, node) {
// If the type parameter doesn't have exactly one declaration, if there are invening statement blocks
// between the node and the type parameter declaration, if the node contains actual references to the
// type parameter, or if the node contains type queries, we consider the type parameter possibly referenced.
if (tp.symbol && tp.symbol.declarations && tp.symbol.declarations.length === 1) {
- var container_3 = tp.symbol.declarations[0].parent;
- if (ts.findAncestor(node, function (n) { return n.kind === 218 /* Block */ ? "quit" : n === container_3; })) {
- return !!ts.forEachChild(node, containsReference);
+ var container = tp.symbol.declarations[0].parent;
+ for (var n = node; n !== container; n = n.parent) {
+ if (!n || n.kind === 219 /* Block */ || n.kind === 176 /* ConditionalType */ && ts.forEachChild(n.extendsType, containsReference)) {
+ return true;
+ }
}
+ return !!ts.forEachChild(node, containsReference);
}
return true;
function containsReference(node) {
switch (node.kind) {
- case 178 /* ThisType */:
+ case 179 /* ThisType */:
return !!tp.isThisType;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return !tp.isThisType && ts.isPartOfTypeNode(node) && maybeTypeParameterReference(node) &&
getTypeFromTypeNode(node) === tp;
- case 167 /* TypeQuery */:
+ case 168 /* TypeQuery */:
return true;
}
return !!ts.forEachChild(node, containsReference);
@@ -41351,7 +41822,7 @@
// If the anonymous type originates in a declaration of a function, method, class, or
// interface, in an object type literal, or in an object literal expression, we may need
// to instantiate the type because it might reference a type parameter.
- return type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations ?
+ return couldContainTypeVariables(type) ?
getAnonymousTypeInstantiation(type, mapper) : type;
}
if (objectFlags & 32 /* Mapped */) {
@@ -41390,7 +41861,7 @@
}
else {
var sub = instantiateType(type.substitute, mapper);
- if (sub.flags & 3 /* AnyOrUnknown */ || isTypeSubtypeOf(getRestrictiveInstantiation(maybeVariable), getRestrictiveInstantiation(sub))) {
+ if (sub.flags & 3 /* AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(maybeVariable), getRestrictiveInstantiation(sub))) {
return maybeVariable;
}
return sub;
@@ -41424,34 +41895,34 @@
// Returns true if the given expression contains (at any level of nesting) a function or arrow expression
// that is subject to contextual typing.
function isContextSensitive(node) {
- ts.Debug.assert(node.kind !== 156 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
+ ts.Debug.assert(node.kind !== 157 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
switch (node.kind) {
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 156 /* MethodDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
return isContextSensitiveFunctionLikeDeclaration(node);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return ts.some(node.properties, isContextSensitive);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return ts.some(node.elements, isContextSensitive);
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return isContextSensitive(node.whenTrue) ||
isContextSensitive(node.whenFalse);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return node.operatorToken.kind === 55 /* BarBarToken */ &&
(isContextSensitive(node.left) || isContextSensitive(node.right));
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return isContextSensitive(node.initializer);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return isContextSensitive(node.expression);
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
return ts.some(node.properties, isContextSensitive) || ts.isJsxOpeningElement(node.parent) && ts.some(node.parent.parent.children, isContextSensitive);
- case 267 /* JsxAttribute */: {
+ case 268 /* JsxAttribute */: {
// If there is no initializer, JSX attribute has a boolean value of true which is not context sensitive.
var initializer = node.initializer;
return !!initializer && isContextSensitive(initializer);
}
- case 270 /* JsxExpression */: {
+ case 271 /* JsxExpression */: {
// It is possible to that node.expression is undefined (e.g <div x={} />)
var expression = node.expression;
return !!expression && isContextSensitive(expression);
@@ -41468,7 +41939,7 @@
if (ts.some(node.parameters, function (p) { return !ts.getEffectiveTypeAnnotationNode(p); })) {
return true;
}
- if (node.kind !== 197 /* ArrowFunction */) {
+ if (node.kind !== 198 /* ArrowFunction */) {
// If the first parameter is not an explicit 'this' parameter, then the function has
// an implicit 'this' parameter which is subject to contextual typing.
var parameter = ts.firstOrUndefined(node.parameters);
@@ -41480,7 +41951,7 @@
}
function hasContextSensitiveReturnExpression(node) {
// TODO(anhans): A block should be context-sensitive if it has a context-sensitive return value.
- return !!node.body && node.body.kind !== 218 /* Block */ && isContextSensitive(node.body);
+ return !!node.body && node.body.kind !== 219 /* Block */ && isContextSensitive(node.body);
}
function isContextSensitiveFunctionOrObjectLiteralMethod(func) {
return (ts.isInJSFile(func) && ts.isFunctionDeclaration(func) || isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) &&
@@ -41533,7 +42004,7 @@
function isTypeDerivedFrom(source, target) {
return source.flags & 1048576 /* Union */ ? ts.every(source.types, function (t) { return isTypeDerivedFrom(t, target); }) :
target.flags & 1048576 /* Union */ ? ts.some(target.types, function (t) { return isTypeDerivedFrom(source, t); }) :
- source.flags & 58982400 /* InstantiableNonPrimitive */ ? isTypeDerivedFrom(getBaseConstraintOfType(source) || emptyObjectType, target) :
+ source.flags & 58982400 /* InstantiableNonPrimitive */ ? isTypeDerivedFrom(getBaseConstraintOfType(source) || unknownType, target) :
target === globalObjectType ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) :
target === globalFunctionType ? !!(source.flags & 524288 /* Object */) && isFunctionObjectType(source) :
hasBaseType(source, getTargetType(target));
@@ -41582,23 +42053,23 @@
return true;
}
switch (node.kind) {
- case 270 /* JsxExpression */:
- case 195 /* ParenthesizedExpression */:
+ case 271 /* JsxExpression */:
+ case 196 /* ParenthesizedExpression */:
return elaborateError(node.expression, source, target, relation, headMessage);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
switch (node.operatorToken.kind) {
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
case 27 /* CommaToken */:
return elaborateError(node.right, source, target, relation, headMessage);
}
break;
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return elaborateObjectLiteral(node, source, target, relation);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return elaborateArrayLiteral(node, source, target, relation);
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
return elaborateJsxComponents(node, source, target, relation);
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return elaborateArrowFunction(node, source, target, relation);
}
return false;
@@ -41667,11 +42138,11 @@
var reportedError = false;
for (var status = iterator.next(); !status.done; status = iterator.next()) {
var _a = status.value, prop = _a.errorNode, next = _a.innerExpression, nameType = _a.nameType, errorMessage = _a.errorMessage;
- var targetPropType = getIndexedAccessType(target, nameType, /*accessNode*/ undefined, errorType);
- if (targetPropType === errorType || targetPropType.flags & 8388608 /* IndexedAccess */)
+ var targetPropType = getIndexedAccessTypeOrUndefined(target, nameType);
+ if (!targetPropType || targetPropType.flags & 8388608 /* IndexedAccess */)
continue; // Don't elaborate on indexes on generic variables
- var sourcePropType = getIndexedAccessType(source, nameType, /*accessNode*/ undefined, errorType);
- if (sourcePropType !== errorType && targetPropType !== errorType && !checkTypeRelatedTo(sourcePropType, targetPropType, relation, /*errorNode*/ undefined)) {
+ var sourcePropType = getIndexedAccessTypeOrUndefined(source, nameType);
+ if (sourcePropType && !checkTypeRelatedTo(sourcePropType, targetPropType, relation, /*errorNode*/ undefined)) {
var elaborated = next && elaborateError(next, sourcePropType, targetPropType, relation, /*headMessage*/ undefined);
if (elaborated) {
reportedError = true;
@@ -41770,7 +42241,7 @@
}
function getElaborationElementForJsxChild(child, nameType, getInvalidTextDiagnostic) {
switch (child.kind) {
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
// child is of the type of the expression
return { errorNode: child, innerExpression: child.expression, nameType: nameType };
case 11 /* JsxText */:
@@ -41779,15 +42250,18 @@
}
// child is a string
return { errorNode: child, innerExpression: undefined, nameType: nameType, errorMessage: getInvalidTextDiagnostic() };
- case 260 /* JsxElement */:
- case 261 /* JsxSelfClosingElement */:
- case 264 /* JsxFragment */:
+ case 261 /* JsxElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 265 /* JsxFragment */:
// child is of type JSX.Element
return { errorNode: child, innerExpression: child, nameType: nameType };
default:
return ts.Debug.assertNever(child, "Found invalid jsx child");
}
}
+ function getSemanticJsxChildren(children) {
+ return ts.filter(children, function (i) { return !ts.isJsxText(i) || !i.containsOnlyTriviaWhiteSpaces; });
+ }
function elaborateJsxComponents(node, source, target, relation) {
var result = elaborateElementwise(generateJsxAttributes(node), source, target, relation);
var invalidTextDiagnostic;
@@ -41797,7 +42271,7 @@
var childrenPropName = childPropName === undefined ? "children" : ts.unescapeLeadingUnderscores(childPropName);
var childrenNameType = getLiteralType(childrenPropName);
var childrenTargetType = getIndexedAccessType(target, childrenNameType);
- var validChildren = ts.filter(containingElement.children, function (i) { return !ts.isJsxText(i) || !i.containsOnlyTriviaWhiteSpaces; });
+ var validChildren = getSemanticJsxChildren(containingElement.children);
if (!ts.length(validChildren)) {
return result;
}
@@ -41881,6 +42355,8 @@
});
}
function elaborateArrayLiteral(node, source, target, relation) {
+ if (target.flags & 131068 /* Primitive */)
+ return false;
if (isTupleLikeType(source)) {
return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation);
}
@@ -41911,11 +42387,11 @@
}
_b = prop.kind;
switch (_b) {
- case 159 /* SetAccessor */: return [3 /*break*/, 2];
- case 158 /* GetAccessor */: return [3 /*break*/, 2];
- case 156 /* MethodDeclaration */: return [3 /*break*/, 2];
- case 276 /* ShorthandPropertyAssignment */: return [3 /*break*/, 2];
- case 275 /* PropertyAssignment */: return [3 /*break*/, 4];
+ case 160 /* SetAccessor */: return [3 /*break*/, 2];
+ case 159 /* GetAccessor */: return [3 /*break*/, 2];
+ case 157 /* MethodDeclaration */: return [3 /*break*/, 2];
+ case 277 /* ShorthandPropertyAssignment */: return [3 /*break*/, 2];
+ case 276 /* PropertyAssignment */: return [3 /*break*/, 4];
}
return [3 /*break*/, 6];
case 2: return [4 /*yield*/, { errorNode: prop.name, innerExpression: undefined, nameType: type }];
@@ -41937,6 +42413,8 @@
});
}
function elaborateObjectLiteral(node, source, target, relation) {
+ if (target.flags & 131068 /* Primitive */)
+ return false;
return elaborateElementwise(generateObjectLiteralElements(node), source, target, relation);
}
/**
@@ -41985,8 +42463,8 @@
return 0 /* False */;
}
var kind = target.declaration ? target.declaration.kind : 0 /* Unknown */;
- var strictVariance = !callbackCheck && strictFunctionTypes && kind !== 156 /* MethodDeclaration */ &&
- kind !== 155 /* MethodSignature */ && kind !== 157 /* Constructor */;
+ var strictVariance = !callbackCheck && strictFunctionTypes && kind !== 157 /* MethodDeclaration */ &&
+ kind !== 156 /* MethodSignature */ && kind !== 158 /* Constructor */;
var result = -1 /* True */;
var sourceThisType = getThisTypeOfSignature(source);
if (sourceThisType && sourceThisType !== voidType) {
@@ -42034,12 +42512,14 @@
result &= related;
}
if (!ignoreReturnTypes) {
- var targetReturnType = (target.declaration && isJSConstructor(target.declaration)) ?
+ // If a signature reolution is already in-flight, skip issuing a circularity error
+ // here and just use the `any` type directly
+ var targetReturnType = isResolvingReturnTypeOfSignature(target) ? anyType : (target.declaration && isJSConstructor(target.declaration)) ?
getJSClassType(target.declaration.symbol) : getReturnTypeOfSignature(target);
if (targetReturnType === voidType) {
return result;
}
- var sourceReturnType = (source.declaration && isJSConstructor(source.declaration)) ?
+ var sourceReturnType = isResolvingReturnTypeOfSignature(source) ? anyType : (source.declaration && isJSConstructor(source.declaration)) ?
getJSClassType(source.declaration.symbol) : getReturnTypeOfSignature(source);
// The following block preserves behavior forbidding boolean returning functions from being assignable to type guard returning functions
var targetTypePredicate = getTypePredicateOfSignature(target);
@@ -42118,6 +42598,11 @@
function isEmptyAnonymousObjectType(type) {
return !!(ts.getObjectFlags(type) & 16 /* Anonymous */) && isEmptyObjectType(type);
}
+ function isStringIndexSignatureOnlyType(type) {
+ return type.flags & 524288 /* Object */ && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfoOfType(type, 0 /* String */) && !getIndexInfoOfType(type, 1 /* Number */) ||
+ type.flags & 3145728 /* UnionOrIntersection */ && ts.every(type.types, isStringIndexSignatureOnlyType) ||
+ false;
+ }
function isEnumTypeRelatedTo(sourceSymbol, targetSymbol, errorReporter) {
if (sourceSymbol === targetSymbol) {
return true;
@@ -42226,8 +42711,8 @@
}
return false;
}
- function isIgnoredJsxProperty(source, sourceProp, targetMemberType) {
- return ts.getObjectFlags(source) & 4096 /* JsxAttributes */ && !(isUnhyphenatedJsxName(sourceProp.escapedName) || targetMemberType);
+ function isIgnoredJsxProperty(source, sourceProp) {
+ return ts.getObjectFlags(source) & 4096 /* JsxAttributes */ && !isUnhyphenatedJsxName(sourceProp.escapedName);
}
/**
* Checks if 'source' is related to 'target' (e.g.: is a assignable to).
@@ -42249,7 +42734,7 @@
var depth = 0;
var expandingFlags = 0 /* None */;
var overflow = false;
- var suppressNextError = false;
+ var overrideNextErrorInfo;
ts.Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
var result = isRelatedTo(source, target, /*reportErrors*/ !!errorNode, headMessage);
if (overflow) {
@@ -42257,9 +42742,9 @@
}
else if (errorInfo) {
if (containingMessageChain) {
- var chain_1 = containingMessageChain();
- if (chain_1) {
- errorInfo = ts.concatenateDiagnosticMessageChains(chain_1, errorInfo);
+ var chain = containingMessageChain();
+ if (chain) {
+ errorInfo = ts.concatenateDiagnosticMessageChains(chain, errorInfo);
}
}
var relatedInformation = void 0;
@@ -42299,11 +42784,9 @@
}
}
function reportRelationError(message, source, target) {
- var sourceType = typeToString(source);
- var targetType = typeToString(target);
- if (sourceType === targetType) {
- sourceType = typeToString(source, /*enclosingDeclaration*/ undefined, 64 /* UseFullyQualifiedType */);
- targetType = typeToString(target, /*enclosingDeclaration*/ undefined, 64 /* UseFullyQualifiedType */);
+ var _a = getTypeNamesForErrorDisplay(source, target), sourceType = _a[0], targetType = _a[1];
+ if (target.flags & 262144 /* TypeParameter */ && target.immediateBaseConstraint !== undefined && isTypeAssignableTo(source, target.immediateBaseConstraint)) {
+ reportError(ts.Diagnostics._0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_constraint_2, sourceType, targetType, typeToString(target.immediateBaseConstraint));
}
if (!message) {
if (relation === comparableRelation) {
@@ -42328,25 +42811,39 @@
reportError(ts.Diagnostics._0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible, targetType, sourceType);
}
}
- function isUnionOrIntersectionTypeWithoutNullableConstituents(type) {
- if (!(type.flags & 3145728 /* UnionOrIntersection */)) {
+ /**
+ * Try and elaborate array and tuple errors. Returns false
+ * if we have found an elaboration, or we should ignore
+ * any other elaborations when relating the `source` and
+ * `target` types.
+ *
+ * @param source
+ * @param target
+ * @param reportErrors
+ */
+ function tryElaborateArrayLikeErrors(source, target, reportErrors) {
+ if (isTupleLikeType(source)) {
+ var sourceTuple = source.target;
+ if (sourceTuple && sourceTuple.readonly && isArrayOrTupleLikeType(target) &&
+ (!isReadonlyArrayType(target) || isTupleType(target) && !target.target.readonly)) {
+ if (reportErrors) {
+ reportError(ts.Diagnostics.The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1, typeToString(source), typeToString(target));
+ }
return false;
}
- // at this point we know that this is union or intersection type possibly with nullable constituents.
- // check if we still will have compound type if we ignore nullable components.
- var seenNonNullable = false;
- for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
- var t = _a[_i];
- if (t.flags & 98304 /* Nullable */) {
- continue;
+ return isArrayLikeType(target);
}
- if (seenNonNullable) {
- return true;
+ if (isTupleLikeType(target)) {
+ return isArrayLikeType(source);
}
- seenNonNullable = true;
+ if (isReadonlyArrayType(source) && isArrayType(target) && !isReadonlyArrayType(target)) {
+ if (reportErrors) {
+ reportError(ts.Diagnostics.The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1, typeToString(source), typeToString(target));
}
return false;
}
+ return true;
+ }
/**
* Compare two types and return
* * Ternary.True if they are related with no assumptions,
@@ -42367,11 +42864,11 @@
if (target.flags & 33554432 /* Substitution */) {
target = target.typeVariable;
}
- if (source.flags & 8388608 /* IndexedAccess */) {
- source = getSimplifiedType(source);
+ if (source.flags & 25165824 /* Simplifiable */) {
+ source = getSimplifiedType(source, /*writing*/ false);
}
- if (target.flags & 8388608 /* IndexedAccess */) {
- target = getSimplifiedType(target);
+ if (target.flags & 25165824 /* Simplifiable */) {
+ target = getSimplifiedType(target, /*writing*/ true);
}
// Try to see if we're relating something like `Foo` -> `Bar | null | undefined`.
// If so, reporting the `null` and `undefined` in the type is hardly useful.
@@ -42399,7 +42896,8 @@
isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : undefined))
return -1 /* True */;
var isComparingJsxAttributes = !!(ts.getObjectFlags(source) & 4096 /* JsxAttributes */);
- if (isObjectLiteralType(source) && ts.getObjectFlags(source) & 32768 /* FreshLiteral */) {
+ var isPerformingExcessPropertyChecks = (isObjectLiteralType(source) && ts.getObjectFlags(source) & 32768 /* FreshLiteral */);
+ if (isPerformingExcessPropertyChecks) {
var discriminantType = target.flags & 1048576 /* Union */ ? findMatchingDiscriminantType(source, target) : undefined;
if (hasExcessProperties(source, target, discriminantType, reportErrors)) {
if (reportErrors) {
@@ -42407,13 +42905,6 @@
}
return 0 /* False */;
}
- // Above we check for excess properties with respect to the entire target type. When union
- // and intersection types are further deconstructed on the target side, we don't want to
- // make the check again (as it might fail for a partial target type). Therefore we obtain
- // the regular source type and proceed with that.
- if (isUnionOrIntersectionTypeWithoutNullableConstituents(target) && !discriminantType) {
- source = getRegularTypeOfObjectLiteral(source);
- }
}
if (relation !== comparableRelation && !isApparentIntersectionConstituent &&
source.flags & (131068 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source !== globalObjectType &&
@@ -42446,11 +42937,24 @@
}
else {
if (target.flags & 1048576 /* Union */) {
- result = typeRelatedToSomeType(source, target, reportErrors && !(source.flags & 131068 /* Primitive */) && !(target.flags & 131068 /* Primitive */));
+ result = typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source), target, reportErrors && !(source.flags & 131068 /* Primitive */) && !(target.flags & 131068 /* Primitive */));
+ if (result && isPerformingExcessPropertyChecks) {
+ // Validate against excess props using the original `source`
+ var discriminantType = target.flags & 1048576 /* Union */ ? findMatchingDiscriminantType(source, target) : undefined;
+ if (!propertiesRelatedTo(source, discriminantType || target, reportErrors, /*excludedProperties*/ undefined)) {
+ return 0 /* False */;
+ }
+ }
}
else if (target.flags & 2097152 /* Intersection */) {
isIntersectionConstituent = true; // set here to affect the following trio of checks
- result = typeRelatedToEachType(source, target, reportErrors);
+ result = typeRelatedToEachType(getRegularTypeOfObjectLiteral(source), target, reportErrors);
+ if (result && isPerformingExcessPropertyChecks) {
+ // Validate against excess props using the original `source`
+ if (!propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined)) {
+ return 0 /* False */;
+ }
+ }
}
else if (source.flags & 2097152 /* Intersection */) {
// Check to see if any constituents of the intersection are immediately related to the target.
@@ -42492,8 +42996,15 @@
}
}
if (!result && reportErrors) {
- var maybeSuppress = suppressNextError;
- suppressNextError = false;
+ var maybeSuppress = overrideNextErrorInfo;
+ overrideNextErrorInfo = undefined;
+ if (source.flags & 524288 /* Object */ && target.flags & 524288 /* Object */) {
+ var currentError = errorInfo;
+ tryElaborateArrayLikeErrors(source, target, reportErrors);
+ if (errorInfo !== currentError) {
+ maybeSuppress = errorInfo;
+ }
+ }
if (source.flags & 524288 /* Object */ && target.flags & 131068 /* Primitive */) {
tryElaborateErrorsForPrimitivesAndObjects(source, target);
}
@@ -42588,7 +43099,7 @@
return { value: true };
}
};
- for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) {
+ for (var _i = 0, _a = getPropertiesOfType(source); _i < _a.length; _i++) {
var prop = _a[_i];
var state_3 = _loop_7(prop);
if (typeof state_3 === "object")
@@ -42695,8 +43206,8 @@
}
// Keep this up-to-date with the same logic within `getApparentTypeOfContextualType`, since they should behave similarly
function findMatchingDiscriminantType(source, target) {
- if (target.flags & 1048576 /* Union */) {
- var sourceProperties = getPropertiesOfObjectType(source);
+ if (target.flags & 1048576 /* Union */ && source.flags & (2097152 /* Intersection */ | 524288 /* Object */)) {
+ var sourceProperties = getPropertiesOfType(source);
if (sourceProperties) {
var sourcePropertiesFiltered = findDiscriminantProperties(sourceProperties, target);
if (sourcePropertiesFiltered) {
@@ -42759,13 +43270,20 @@
// When variance information isn't available we default to covariance. This happens
// in the process of computing variance information for recursive types and when
// comparing 'this' type arguments.
- var variance = i < variances.length ? variances[i] : 1 /* Covariant */;
+ var varianceFlags = i < variances.length ? variances[i] : 1 /* Covariant */;
+ var variance = varianceFlags & 7 /* VarianceMask */;
// We ignore arguments for independent type parameters (because they're never witnessed).
if (variance !== 4 /* Independent */) {
var s = sources[i];
var t = targets[i];
var related = -1 /* True */;
- if (variance === 1 /* Covariant */) {
+ if (varianceFlags & 8 /* Unmeasurable */) {
+ // Even an `Unmeasurable` variance works out without a structural check if the source and target are _identical_.
+ // We can't simply assume invariance, because `Unmeasurable` marks nonlinear relations, for example, a relation tained by
+ // the `-?` modifier in a mapped type (where, no matter how the inputs are related, the outputs still might not be)
+ related = relation === identityRelation ? isRelatedTo(s, t, /*reportErrors*/ false) : compareTypesIdentical(s, t);
+ }
+ else if (variance === 1 /* Covariant */) {
related = isRelatedTo(s, t, reportErrors);
}
else if (variance === 2 /* Contravariant */) {
@@ -42884,8 +43402,8 @@
if (source.root.isDistributive === target.root.isDistributive) {
if (result_3 = isRelatedTo(source.checkType, target.checkType, /*reportErrors*/ false)) {
if (result_3 &= isRelatedTo(source.extendsType, target.extendsType, /*reportErrors*/ false)) {
- if (result_3 &= isRelatedTo(source.trueType, target.trueType, /*reportErrors*/ false)) {
- if (result_3 &= isRelatedTo(source.falseType, target.falseType, /*reportErrors*/ false)) {
+ if (result_3 &= isRelatedTo(getTrueTypeFromConditionalType(source), getTrueTypeFromConditionalType(target), /*reportErrors*/ false)) {
+ if (result_3 &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), /*reportErrors*/ false)) {
return result_3;
}
}
@@ -42935,8 +43453,7 @@
}
// A type S is assignable to keyof T if S is assignable to keyof C, where C is the
// simplified form of T or, if T doesn't simplify, the constraint of T.
- var simplified = getSimplifiedType(target.type);
- var constraint = simplified !== target.type ? simplified : getConstraintOfType(target.type);
+ var constraint = getSimplifiedTypeOrConstraint(target.type);
if (constraint) {
// We require Ternary.True here such that circular constraints don't cause
// false positives. For example, given 'T extends { [K in keyof T]: string }',
@@ -42948,13 +43465,17 @@
}
}
else if (target.flags & 8388608 /* IndexedAccess */) {
- // A type S is related to a type T[K], where T and K aren't both type variables, if S is related to C,
- // where C is the base constraint of T[K]
- if (relation !== identityRelation &&
- !(isGenericObjectType(target.objectType) && isGenericIndexType(target.indexType))) {
- var constraint = getBaseConstraintOfType(target);
- if (constraint && constraint !== target) {
- if (result = isRelatedTo(source, constraint, reportErrors)) {
+ // A type S is related to a type T[K] if S is related to C, where C is the base
+ // constraint of T[K] for writing.
+ if (relation !== identityRelation) {
+ var objectType = target.objectType;
+ var indexType = target.indexType;
+ var baseObjectType = getBaseConstraintOfType(objectType) || objectType;
+ var baseIndexType = getBaseConstraintOfType(indexType) || indexType;
+ if (!isGenericObjectType(baseObjectType) && !isGenericIndexType(baseIndexType)) {
+ var accessFlags = 2 /* Writing */ | (baseObjectType !== objectType ? 1 /* NoIndexSignatures */ : 0);
+ var constraint = getIndexedAccessTypeOrUndefined(baseObjectType, baseIndexType, /*accessNode*/ undefined, accessFlags);
+ if (constraint && (result = isRelatedTo(source, constraint, reportErrors))) {
return result;
}
}
@@ -42971,7 +43492,7 @@
}
if (!isGenericMappedType(source)) {
var targetConstraint = getConstraintTypeFromMappedType(target);
- var sourceKeys_1 = getIndexType(source);
+ var sourceKeys_1 = getIndexType(source, /*stringsOnly*/ undefined, /*noIndexSignatures*/ true);
var hasOptionalUnionKeys = modifiers & 4 /* IncludeOptional */ && targetConstraint.flags & 1048576 /* Union */;
var filteredByApplicability = hasOptionalUnionKeys ? filterType(targetConstraint, function (t) { return !!isRelatedTo(t, sourceKeys_1); }) : undefined;
// A source type T is related to a target type { [P in Q]: X } if Q is related to keyof T and T[Q] is related to X.
@@ -43002,6 +43523,7 @@
return result;
}
}
+ else {
var constraint = getConstraintOfType(source);
if (!constraint || (source.flags & 262144 /* TypeParameter */ && constraint.flags & 1 /* Any */)) {
// A type variable with no constraint is not related to the non-primitive object type.
@@ -43021,6 +43543,7 @@
return result;
}
}
+ }
else if (source.flags & 4194304 /* Index */) {
if (result = isRelatedTo(keyofConstraintType, target, reportErrors)) {
errorInfo = saveErrorInfo;
@@ -43034,8 +43557,8 @@
// and Y1 is related to Y2.
if (isTypeIdenticalTo(source.extendsType, target.extendsType) &&
(isRelatedTo(source.checkType, target.checkType) || isRelatedTo(target.checkType, source.checkType))) {
- if (result = isRelatedTo(source.trueType, target.trueType, reportErrors)) {
- result &= isRelatedTo(source.falseType, target.falseType, reportErrors);
+ if (result = isRelatedTo(getTrueTypeFromConditionalType(source), getTrueTypeFromConditionalType(target), reportErrors)) {
+ result &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), reportErrors);
}
if (result) {
errorInfo = saveErrorInfo;
@@ -43105,7 +43628,7 @@
if (source.flags & (524288 /* Object */ | 2097152 /* Intersection */) && target.flags & 524288 /* Object */) {
// Report structural errors only if we haven't reported any errors yet
var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !sourceIsPrimitive;
- result = propertiesRelatedTo(source, target, reportStructuralErrors);
+ result = propertiesRelatedTo(source, target, reportStructuralErrors, /*excludedProperties*/ undefined);
if (result) {
result &= signaturesRelatedTo(source, target, 0 /* Call */, reportStructuralErrors);
if (result) {
@@ -43125,22 +43648,35 @@
return result;
}
}
+ // If S is an object type and T is a discriminated union, S may be related to T if
+ // there exists a constituent of T for every combination of the discriminants of S
+ // with respect to T. We do not report errors here, as we will use the existing
+ // error result from checking each constituent of the union.
+ if (source.flags & (524288 /* Object */ | 2097152 /* Intersection */) && target.flags & 1048576 /* Union */) {
+ var objectOnlyTarget = extractTypesOfKind(target, 524288 /* Object */);
+ if (objectOnlyTarget.flags & 1048576 /* Union */) {
+ var result_4 = typeRelatedToDiscriminatedType(source, objectOnlyTarget);
+ if (result_4) {
+ return result_4;
+ }
}
- return 0 /* False */;
- function isNonGeneric(type) {
- // If we're already in identity relationship checking, we should use `isRelatedTo`
- // to catch the `Maybe` from an excessively deep type (which we then assume means
- // that the type could possibly contain a generic)
- if (relation === identityRelation) {
- return isRelatedTo(type, getPermissiveInstantiation(type)) === -1 /* True */;
}
- return isTypeIdenticalTo(type, getPermissiveInstantiation(type));
}
+ return 0 /* False */;
function relateVariances(sourceTypeArguments, targetTypeArguments, variances) {
if (result = typeArgumentsRelatedTo(sourceTypeArguments, targetTypeArguments, variances, reportErrors)) {
return result;
}
- var allowStructuralFallback = (targetTypeArguments && hasCovariantVoidArgument(targetTypeArguments, variances)) || isNonGeneric(source) || isNonGeneric(target);
+ if (ts.some(variances, function (v) { return !!(v & 24 /* AllowsStructuralFallback */); })) {
+ // If some type parameter was `Unmeasurable` or `Unreliable`, and we couldn't pass by assuming it was identical, then we
+ // have to allow a structural fallback check
+ // We elide the variance-based error elaborations, since those might not be too helpful, since we'll potentially
+ // be assuming identity of the type parameter.
+ originalErrorInfo = undefined;
+ errorInfo = saveErrorInfo;
+ return undefined;
+ }
+ var allowStructuralFallback = targetTypeArguments && hasCovariantVoidArgument(targetTypeArguments, variances);
varianceCheckFailed = !allowStructuralFallback;
// The type arguments did not relate appropriately, but it may be because we have no variance
// information (in which case typeArgumentsRelatedTo defaulted to covariance for all type
@@ -43158,7 +43694,7 @@
// reveal the reason).
// We can switch on `reportErrors` here, since varianceCheckFailed guarantees we return `False`,
// we can return `False` early here to skip calculating the structural error message we don't need.
- if (varianceCheckFailed && !(reportErrors && ts.some(variances, function (v) { return v === 0 /* Invariant */; }))) {
+ if (varianceCheckFailed && !(reportErrors && ts.some(variances, function (v) { return (v & 7 /* VarianceMask */) === 0 /* Invariant */; }))) {
return 0 /* False */;
}
// We remember the original error information so we can restore it in case the structural
@@ -43169,6 +43705,18 @@
}
}
}
+ function reportUnmeasurableMarkers(p) {
+ if (outofbandVarianceMarkerHandler && (p === markerSuperType || p === markerSubType || p === markerOtherType)) {
+ outofbandVarianceMarkerHandler(/*onlyUnreliable*/ false);
+ }
+ return p;
+ }
+ function reportUnreliableMarkers(p) {
+ if (outofbandVarianceMarkerHandler && (p === markerSuperType || p === markerSubType || p === markerOtherType)) {
+ outofbandVarianceMarkerHandler(/*onlyUnreliable*/ true);
+ }
+ return p;
+ }
// A type [P in S]: X is related to a type [Q in T]: Y if T is related to S and X' is
// related to Y, where X' is an instantiation of X in which P is replaced with Q. Notice
// that S and T are contra-variant whereas X and Y are co-variant.
@@ -43176,99 +43724,185 @@
var modifiersRelated = relation === comparableRelation || (relation === identityRelation ? getMappedTypeModifiers(source) === getMappedTypeModifiers(target) :
getCombinedMappedTypeOptionality(source) <= getCombinedMappedTypeOptionality(target));
if (modifiersRelated) {
- var result_4;
- if (result_4 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) {
+ var result_5;
+ var targetConstraint = getConstraintTypeFromMappedType(target);
+ var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source), getCombinedMappedTypeOptionality(source) < 0 ? reportUnmeasurableMarkers : reportUnreliableMarkers);
+ if (result_5 = isRelatedTo(targetConstraint, sourceConstraint, reportErrors)) {
var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]);
- return result_4 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), reportErrors);
+ return result_5 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), reportErrors);
}
}
return 0 /* False */;
}
- function propertiesRelatedTo(source, target, reportErrors) {
- if (relation === identityRelation) {
- return propertiesIdenticalTo(source, target);
+ function typeRelatedToDiscriminatedType(source, target) {
+ // 1. Generate the combinations of discriminant properties & types 'source' can satisfy.
+ // a. If the number of combinations is above a set limit, the comparison is too complex.
+ // 2. Filter 'target' to the subset of types whose discriminants exist in the matrix.
+ // a. If 'target' does not satisfy all discriminants in the matrix, 'source' is not related.
+ // 3. For each type in the filtered 'target', determine if all non-discriminant properties of
+ // 'target' are related to a property in 'source'.
+ //
+ // NOTE: See ~/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithDiscriminatedUnion.ts
+ // for examples.
+ var sourceProperties = getPropertiesOfObjectType(source);
+ var sourcePropertiesFiltered = findDiscriminantProperties(sourceProperties, target);
+ if (!sourcePropertiesFiltered)
+ return 0 /* False */;
+ // Though we could compute the number of combinations as we generate
+ // the matrix, this would incur additional memory overhead due to
+ // array allocations. To reduce this overhead, we first compute
+ // the number of combinations to ensure we will not surpass our
+ // fixed limit before incurring the cost of any allocations:
+ var numCombinations = 1;
+ for (var _i = 0, sourcePropertiesFiltered_1 = sourcePropertiesFiltered; _i < sourcePropertiesFiltered_1.length; _i++) {
+ var sourceProperty = sourcePropertiesFiltered_1[_i];
+ numCombinations *= countTypes(getTypeOfSymbol(sourceProperty));
+ if (numCombinations > 25) {
+ // We've reached the complexity limit.
+ return 0 /* False */;
}
- var requireOptionalProperties = relation === subtypeRelation && !isObjectLiteralType(source) && !isEmptyArrayLiteralType(source) && !isTupleType(source);
- var unmatchedProperty = getUnmatchedProperty(source, target, requireOptionalProperties, /*matchDiscriminantProperties*/ false);
- if (unmatchedProperty) {
- if (reportErrors) {
- var props = ts.arrayFrom(getUnmatchedProperties(source, target, requireOptionalProperties, /*matchDiscriminantProperties*/ false));
- if (!headMessage || (headMessage.code !== ts.Diagnostics.Class_0_incorrectly_implements_interface_1.code &&
- headMessage.code !== ts.Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass.code)) {
- suppressNextError = true; // Retain top-level error for interface implementing issues, otherwise omit it
}
- if (props.length === 1) {
- var propName = symbolToString(unmatchedProperty);
- reportError(ts.Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2, propName, typeToString(source), typeToString(target));
- if (ts.length(unmatchedProperty.declarations)) {
- associateRelatedInfo(ts.createDiagnosticForNode(unmatchedProperty.declarations[0], ts.Diagnostics._0_is_declared_here, propName));
+ // Compute the set of types for each discriminant property.
+ var sourceDiscriminantTypes = new Array(sourcePropertiesFiltered.length);
+ var excludedProperties = ts.createUnderscoreEscapedMap();
+ for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
+ var sourceProperty = sourcePropertiesFiltered[i];
+ var sourcePropertyType = getTypeOfSymbol(sourceProperty);
+ sourceDiscriminantTypes[i] = sourcePropertyType.flags & 1048576 /* Union */
+ ? sourcePropertyType.types
+ : [sourcePropertyType];
+ excludedProperties.set(sourceProperty.escapedName, true);
+ }
+ // Match each combination of the cartesian product of discriminant properties to one or more
+ // constituents of 'target'. If any combination does not have a match then 'source' is not relatable.
+ var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
+ var matchingTypes = [];
+ var _loop_8 = function (combination) {
+ var hasMatch = false;
+ outer: for (var _i = 0, _a = target.types; _i < _a.length; _i++) {
+ var type = _a[_i];
+ var _loop_9 = function (i) {
+ var sourceProperty = sourcePropertiesFiltered[i];
+ var targetProperty = getPropertyOfObjectType(type, sourceProperty.escapedName);
+ if (!targetProperty)
+ return "continue-outer";
+ if (sourceProperty === targetProperty)
+ return "continue";
+ // We compare the source property to the target in the context of a single discriminant type.
+ var related = propertyRelatedTo(source, target, sourceProperty, targetProperty, function (_) { return combination[i]; }, /*reportErrors*/ false);
+ // If the target property could not be found, or if the properties were not related,
+ // then this constituent is not a match.
+ if (!related) {
+ return "continue-outer";
}
+ };
+ for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
+ var state_5 = _loop_9(i);
+ switch (state_5) {
+ case "continue-outer": continue outer;
}
- else if (props.length > 5) { // arbitrary cutoff for too-long list form
- reportError(ts.Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2_and_3_more, typeToString(source), typeToString(target), ts.map(props.slice(0, 4), function (p) { return symbolToString(p); }).join(", "), props.length - 4);
}
- else {
- reportError(ts.Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2, typeToString(source), typeToString(target), ts.map(props, function (p) { return symbolToString(p); }).join(", "));
+ ts.pushIfUnique(matchingTypes, type, ts.equateValues);
+ hasMatch = true;
}
+ if (!hasMatch) {
+ return { value: 0 /* False */ };
}
- return 0 /* False */;
+ };
+ for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
+ var combination = discriminantCombinations_1[_a];
+ var state_4 = _loop_8(combination);
+ if (typeof state_4 === "object")
+ return state_4.value;
}
- if (isObjectLiteralType(target)) {
- for (var _i = 0, _a = getPropertiesOfType(source); _i < _a.length; _i++) {
- var sourceProp = _a[_i];
- if (!getPropertyOfObjectType(target, sourceProp.escapedName)) {
- var sourceType = getTypeOfSymbol(sourceProp);
- if (!(sourceType === undefinedType || sourceType === undefinedWideningType)) {
- if (reportErrors) {
- reportError(ts.Diagnostics.Property_0_does_not_exist_on_type_1, symbolToString(sourceProp), typeToString(target));
+ // Compare the remaining non-discriminant properties of each match.
+ var result = -1 /* True */;
+ for (var _b = 0, matchingTypes_1 = matchingTypes; _b < matchingTypes_1.length; _b++) {
+ var type = matchingTypes_1[_b];
+ result &= propertiesRelatedTo(source, type, /*reportErrors*/ false, excludedProperties);
+ if (result) {
+ result &= signaturesRelatedTo(source, type, 0 /* Call */, /*reportStructuralErrors*/ false);
+ if (result) {
+ result &= signaturesRelatedTo(source, type, 1 /* Construct */, /*reportStructuralErrors*/ false);
+ if (result) {
+ result &= indexTypesRelatedTo(source, type, 0 /* String */, /*sourceIsPrimitive*/ false, /*reportStructuralErrors*/ false);
+ if (result) {
+ result &= indexTypesRelatedTo(source, type, 1 /* Number */, /*sourceIsPrimitive*/ false, /*reportStructuralErrors*/ false);
}
- return 0 /* False */;
}
}
}
+ if (!result) {
+ return result;
}
- var result = -1 /* True */;
- if (isTupleType(target)) {
- var targetRestType = getRestTypeOfTupleType(target);
- if (targetRestType) {
- if (!isTupleType(source)) {
- return 0 /* False */;
}
- var sourceRestType = getRestTypeOfTupleType(source);
- if (sourceRestType && !isRelatedTo(sourceRestType, targetRestType, reportErrors)) {
- if (reportErrors) {
- reportError(ts.Diagnostics.Rest_signatures_are_incompatible);
+ return result;
}
- return 0 /* False */;
+ function excludeProperties(properties, excludedProperties) {
+ if (!excludedProperties || properties.length === 0)
+ return properties;
+ var result;
+ for (var i = 0; i < properties.length; i++) {
+ if (!excludedProperties.has(properties[i].escapedName)) {
+ if (result) {
+ result.push(properties[i]);
}
- var targetCount = getTypeReferenceArity(target) - 1;
- var sourceCount = getTypeReferenceArity(source) - (sourceRestType ? 1 : 0);
- for (var i = targetCount; i < sourceCount; i++) {
- var related = isRelatedTo(source.typeArguments[i], targetRestType, reportErrors);
+ }
+ else if (!result) {
+ result = properties.slice(0, i);
+ }
+ }
+ return result || properties;
+ }
+ function isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors) {
+ var targetIsOptional = strictNullChecks && !!(ts.getCheckFlags(targetProp) & 48 /* Partial */);
+ var source = getTypeOfSourceProperty(sourceProp);
+ if (ts.getCheckFlags(targetProp) & 65536 /* DeferredType */ && !getSymbolLinks(targetProp).type) {
+ // Rather than resolving (and normalizing) the type, relate constituent-by-constituent without performing normalization or seconadary passes
+ var links = getSymbolLinks(targetProp);
+ ts.Debug.assertDefined(links.deferralParent);
+ ts.Debug.assertDefined(links.deferralConstituents);
+ var unionParent = !!(links.deferralParent.flags & 1048576 /* Union */);
+ var result_6 = unionParent ? 0 /* False */ : -1 /* True */;
+ var targetTypes = links.deferralConstituents;
+ for (var _i = 0, targetTypes_3 = targetTypes; _i < targetTypes_3.length; _i++) {
+ var targetType = targetTypes_3[_i];
+ var related = isRelatedTo(source, targetType, /*reportErrors*/ false, /*headMessage*/ undefined, /*isIntersectionConstituent*/ !unionParent);
+ if (!unionParent) {
if (!related) {
- if (reportErrors) {
- reportError(ts.Diagnostics.Property_0_is_incompatible_with_rest_element_type, "" + i);
+ // Can't assign to a target individually - have to fallback to assigning to the _whole_ intersection (which forces normalization)
+ return isRelatedTo(source, addOptionality(getTypeOfSymbol(targetProp), targetIsOptional), reportErrors);
}
- return 0 /* False */;
+ result_6 &= related;
}
- result &= related;
+ else {
+ if (related) {
+ return related;
}
}
}
- var properties = getPropertiesOfObjectType(target);
- for (var _b = 0, properties_2 = properties; _b < properties_2.length; _b++) {
- var targetProp = properties_2[_b];
- if (!(targetProp.flags & 4194304 /* Prototype */)) {
- var sourceProp = getPropertyOfType(source, targetProp.escapedName);
- if (sourceProp && sourceProp !== targetProp) {
- if (isIgnoredJsxProperty(source, sourceProp, getTypeOfSymbol(targetProp))) {
- continue;
+ if (unionParent && !result_6 && targetIsOptional) {
+ result_6 = isRelatedTo(source, undefinedType);
+ }
+ if (unionParent && !result_6 && reportErrors) {
+ // The easiest way to get the right errors here is to un-defer (which may be costly)
+ // If it turns out this is too costly too often, we can replicate the error handling logic within
+ // typeRelatedToSomeType without the discriminatable type branch (as that requires a manifest union
+ // type on which to hand discriminable properties, which we are expressly trying to avoid here)
+ return isRelatedTo(source, addOptionality(getTypeOfSymbol(targetProp), targetIsOptional), reportErrors);
}
+ return result_6;
+ }
+ else {
+ return isRelatedTo(source, addOptionality(getTypeOfSymbol(targetProp), targetIsOptional), reportErrors);
+ }
+ }
+ function propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSourceProperty, reportErrors) {
var sourcePropFlags = ts.getDeclarationModifierFlagsFromSymbol(sourceProp);
var targetPropFlags = ts.getDeclarationModifierFlagsFromSymbol(targetProp);
if (sourcePropFlags & 8 /* Private */ || targetPropFlags & 8 /* Private */) {
var hasDifferingDeclarations = sourceProp.valueDeclaration !== targetProp.valueDeclaration;
- if (ts.getCheckFlags(sourceProp) & 512 /* ContainsPrivate */ && hasDifferingDeclarations) {
+ if (ts.getCheckFlags(sourceProp) & 1024 /* ContainsPrivate */ && hasDifferingDeclarations) {
if (reportErrors) {
reportError(ts.Diagnostics.Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1, symbolToString(sourceProp), typeToString(source));
}
@@ -43300,14 +43934,14 @@
}
return 0 /* False */;
}
- var related = isRelatedTo(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors);
+ // If the target comes from a partial union prop, allow `undefined` in the target type
+ var related = isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors);
if (!related) {
if (reportErrors) {
reportError(ts.Diagnostics.Types_of_property_0_are_incompatible, symbolToString(targetProp));
}
return 0 /* False */;
}
- result &= related;
// When checking for comparability, be more lenient with optional properties.
if (relation !== comparableRelation && sourceProp.flags & 16777216 /* Optional */ && !(targetProp.flags & 16777216 /* Optional */)) {
// TypeScript 1.0 spec (April 2014): 3.8.3
@@ -43322,17 +43956,113 @@
}
return 0 /* False */;
}
+ return related;
+ }
+ function propertiesRelatedTo(source, target, reportErrors, excludedProperties) {
+ if (relation === identityRelation) {
+ return propertiesIdenticalTo(source, target, excludedProperties);
+ }
+ var requireOptionalProperties = relation === subtypeRelation && !isObjectLiteralType(source) && !isEmptyArrayLiteralType(source) && !isTupleType(source);
+ var unmatchedProperty = getUnmatchedProperty(source, target, requireOptionalProperties, /*matchDiscriminantProperties*/ false);
+ if (unmatchedProperty) {
+ if (reportErrors) {
+ var props = ts.arrayFrom(getUnmatchedProperties(source, target, requireOptionalProperties, /*matchDiscriminantProperties*/ false));
+ var shouldSkipElaboration = false;
+ if (!headMessage || (headMessage.code !== ts.Diagnostics.Class_0_incorrectly_implements_interface_1.code &&
+ headMessage.code !== ts.Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass.code)) {
+ shouldSkipElaboration = true; // Retain top-level error for interface implementing issues, otherwise omit it
+ }
+ if (props.length === 1) {
+ var propName = symbolToString(unmatchedProperty);
+ reportError.apply(void 0, [ts.Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2, propName].concat(getTypeNamesForErrorDisplay(source, target)));
+ if (ts.length(unmatchedProperty.declarations)) {
+ associateRelatedInfo(ts.createDiagnosticForNode(unmatchedProperty.declarations[0], ts.Diagnostics._0_is_declared_here, propName));
+ }
+ if (shouldSkipElaboration) {
+ overrideNextErrorInfo = errorInfo;
+ }
+ }
+ else if (tryElaborateArrayLikeErrors(source, target, /*reportErrors*/ false)) {
+ if (props.length > 5) { // arbitrary cutoff for too-long list form
+ reportError(ts.Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2_and_3_more, typeToString(source), typeToString(target), ts.map(props.slice(0, 4), function (p) { return symbolToString(p); }).join(", "), props.length - 4);
+ }
+ else {
+ reportError(ts.Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2, typeToString(source), typeToString(target), ts.map(props, function (p) { return symbolToString(p); }).join(", "));
+ }
+ if (shouldSkipElaboration) {
+ overrideNextErrorInfo = errorInfo;
+ }
+ }
+ // ELSE: No array like or unmatched property error - just issue top level error (errorInfo = undefined)
+ }
+ return 0 /* False */;
+ }
+ if (isObjectLiteralType(target)) {
+ for (var _i = 0, _a = excludeProperties(getPropertiesOfType(source), excludedProperties); _i < _a.length; _i++) {
+ var sourceProp = _a[_i];
+ if (!getPropertyOfObjectType(target, sourceProp.escapedName)) {
+ var sourceType = getTypeOfSymbol(sourceProp);
+ if (!(sourceType === undefinedType || sourceType === undefinedWideningType)) {
+ if (reportErrors) {
+ reportError(ts.Diagnostics.Property_0_does_not_exist_on_type_1, symbolToString(sourceProp), typeToString(target));
+ }
+ return 0 /* False */;
+ }
+ }
+ }
+ }
+ var result = -1 /* True */;
+ if (isTupleType(target)) {
+ var targetRestType = getRestTypeOfTupleType(target);
+ if (targetRestType) {
+ if (!isTupleType(source)) {
+ return 0 /* False */;
+ }
+ var sourceRestType = getRestTypeOfTupleType(source);
+ if (sourceRestType && !isRelatedTo(sourceRestType, targetRestType, reportErrors)) {
+ if (reportErrors) {
+ reportError(ts.Diagnostics.Rest_signatures_are_incompatible);
+ }
+ return 0 /* False */;
+ }
+ var targetCount = getTypeReferenceArity(target) - 1;
+ var sourceCount = getTypeReferenceArity(source) - (sourceRestType ? 1 : 0);
+ for (var i = targetCount; i < sourceCount; i++) {
+ var related = isRelatedTo(source.typeArguments[i], targetRestType, reportErrors);
+ if (!related) {
+ if (reportErrors) {
+ reportError(ts.Diagnostics.Property_0_is_incompatible_with_rest_element_type, "" + i);
+ }
+ return 0 /* False */;
+ }
+ result &= related;
+ }
+ }
+ }
+ // We only call this for union target types when we're attempting to do excess property checking - in those cases, we want to get _all possible props_
+ // from the target union, across all members
+ var properties = target.flags & 1048576 /* Union */ ? getPossiblePropertiesOfUnionType(target) : getPropertiesOfType(target);
+ for (var _b = 0, _c = excludeProperties(properties, excludedProperties); _b < _c.length; _b++) {
+ var targetProp = _c[_b];
+ if (!(targetProp.flags & 4194304 /* Prototype */)) {
+ var sourceProp = getPropertyOfType(source, targetProp.escapedName);
+ if (sourceProp && sourceProp !== targetProp) {
+ var related = propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSymbol, reportErrors);
+ if (!related) {
+ return 0 /* False */;
+ }
+ result &= related;
}
}
}
return result;
}
- function propertiesIdenticalTo(source, target) {
+ function propertiesIdenticalTo(source, target, excludedProperties) {
if (!(source.flags & 524288 /* Object */ && target.flags & 524288 /* Object */)) {
return 0 /* False */;
}
- var sourceProperties = getPropertiesOfObjectType(source);
- var targetProperties = getPropertiesOfObjectType(target);
+ var sourceProperties = excludeProperties(getPropertiesOfObjectType(source), excludedProperties);
+ var targetProperties = excludeProperties(getPropertiesOfObjectType(target), excludedProperties);
if (sourceProperties.length !== targetProperties.length) {
return 0 /* False */;
}
@@ -43452,7 +44182,7 @@
var result = -1 /* True */;
for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) {
var prop = _a[_i];
- if (isIgnoredJsxProperty(source, prop, /*targetMemberType*/ undefined)) {
+ if (isIgnoredJsxProperty(source, prop)) {
continue;
}
// Skip over symbol-named members
@@ -43484,7 +44214,7 @@
return indexTypesIdenticalTo(source, target, kind);
}
var targetInfo = getIndexInfoOfType(target, kind);
- if (!targetInfo || targetInfo.type.flags & 3 /* AnyOrUnknown */ && !sourceIsPrimitive) {
+ if (!targetInfo || targetInfo.type.flags & 1 /* Any */ && !sourceIsPrimitive) {
// Index signature of type any permits assignment from everything but primitives
return -1 /* True */;
}
@@ -43624,8 +44354,11 @@
// The emptyArray singleton is used to signal a recursive invocation.
cache.variances = ts.emptyArray;
variances = [];
- for (var _i = 0, typeParameters_1 = typeParameters; _i < typeParameters_1.length; _i++) {
- var tp = typeParameters_1[_i];
+ var _loop_10 = function (tp) {
+ var unmeasurable = false;
+ var unreliable = false;
+ var oldHandler = outofbandVarianceMarkerHandler;
+ outofbandVarianceMarkerHandler = function (onlyUnreliable) { return onlyUnreliable ? unreliable = true : unmeasurable = true; };
// We first compare instantiations where the type parameter is replaced with
// marker types that have a known subtype relationship. From this we can infer
// invariance, covariance, contravariance or bivariance.
@@ -43640,7 +44373,26 @@
if (variance === 3 /* Bivariant */ && isTypeAssignableTo(createMarkerType(cache, tp, markerOtherType), typeWithSuper)) {
variance = 4 /* Independent */;
}
+ outofbandVarianceMarkerHandler = oldHandler;
+ if (unmeasurable || unreliable) {
+ if (unmeasurable) {
+ variance |= 8 /* Unmeasurable */;
+ }
+ if (unreliable) {
+ variance |= 16 /* Unreliable */;
+ }
+ var covariantID = getRelationKey(typeWithSub, typeWithSuper, assignableRelation);
+ var contravariantID = getRelationKey(typeWithSuper, typeWithSub, assignableRelation);
+ // We delete the results of these checks, as we want them to actually be run, see the `Unmeasurable` variance we cache,
+ // And then fall back to a structural result.
+ assignableRelation.delete(covariantID);
+ assignableRelation.delete(contravariantID);
+ }
variances.push(variance);
+ };
+ for (var _i = 0, typeParameters_1 = typeParameters; _i < typeParameters_1.length; _i++) {
+ var tp = typeParameters_1[_i];
+ _loop_10(tp);
}
cache.variances = variances;
}
@@ -43657,7 +44409,7 @@
// See comment at call in recursiveTypeRelatedTo for when this case matters.
function hasCovariantVoidArgument(typeArguments, variances) {
for (var i = 0; i < variances.length; i++) {
- if (variances[i] === 1 /* Covariant */ && typeArguments[i].flags & 16384 /* Void */) {
+ if ((variances[i] & 7 /* VarianceMask */) === 1 /* Covariant */ && typeArguments[i].flags & 16384 /* Void */) {
return true;
}
}
@@ -44083,6 +44835,30 @@
return strictNullChecks ? getGlobalNonNullableTypeInstantiation(type) : type;
}
/**
+ * Is source potentially coercible to target type under `==`.
+ * Assumes that `source` is a constituent of a union, hence
+ * the boolean literal flag on the LHS, but not on the RHS.
+ *
+ * This does not fully replicate the semantics of `==`. The
+ * intention is to catch cases that are clearly not right.
+ *
+ * Comparing (string | number) to number should not remove the
+ * string element.
+ *
+ * Comparing (string | number) to 1 will remove the string
+ * element, though this is not sound. This is a pragmatic
+ * choice.
+ *
+ * @see narrowTypeByEquality
+ *
+ * @param source
+ * @param target
+ */
+ function isCoercibleUnderDoubleEquals(source, target) {
+ return ((source.flags & (8 /* Number */ | 4 /* String */ | 512 /* BooleanLiteral */)) !== 0)
+ && ((target.flags & (8 /* Number */ | 4 /* String */ | 16 /* Boolean */)) !== 0);
+ }
+ /**
* Return true if type was inferred from an object literal, written as an object type literal, or is the shape of a module
* with no call or construct signatures.
*/
@@ -44218,26 +44994,34 @@
}
function getWidenedTypeWithContext(type, context) {
if (ts.getObjectFlags(type) & 393216 /* RequiresWidening */) {
+ if (context === undefined && type.widened) {
+ return type.widened;
+ }
+ var result = void 0;
if (type.flags & 98304 /* Nullable */) {
- return anyType;
+ result = anyType;
}
- if (isObjectLiteralType(type)) {
- return getWidenedTypeOfObjectLiteral(type, context);
+ else if (isObjectLiteralType(type)) {
+ result = getWidenedTypeOfObjectLiteral(type, context);
}
- if (type.flags & 1048576 /* Union */) {
+ else if (type.flags & 1048576 /* Union */) {
var unionContext_1 = context || createWideningContext(/*parent*/ undefined, /*propertyName*/ undefined, type.types);
var widenedTypes = ts.sameMap(type.types, function (t) { return t.flags & 98304 /* Nullable */ ? t : getWidenedTypeWithContext(t, unionContext_1); });
// Widening an empty object literal transitions from a highly restrictive type to
// a highly inclusive one. For that reason we perform subtype reduction here if the
// union includes empty object types (e.g. reducing {} | string to just {}).
- return getUnionType(widenedTypes, ts.some(widenedTypes, isEmptyObjectType) ? 2 /* Subtype */ : 1 /* Literal */);
+ result = getUnionType(widenedTypes, ts.some(widenedTypes, isEmptyObjectType) ? 2 /* Subtype */ : 1 /* Literal */);
}
- if (type.flags & 2097152 /* Intersection */) {
- return getIntersectionType(ts.sameMap(type.types, getWidenedType));
+ else if (type.flags & 2097152 /* Intersection */) {
+ result = getIntersectionType(ts.sameMap(type.types, getWidenedType));
}
- if (isArrayType(type) || isTupleType(type)) {
- return createTypeReference(type.target, ts.sameMap(type.typeArguments, getWidenedType));
+ else if (isArrayType(type) || isTupleType(type)) {
+ result = createTypeReference(type.target, ts.sameMap(type.typeArguments, getWidenedType));
+ }
+ if (result && context === undefined) {
+ type.widened = result;
}
+ return result || type;
}
return type;
}
@@ -44299,12 +45083,12 @@
}
var diagnostic;
switch (declaration.kind) {
- case 204 /* BinaryExpression */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 205 /* BinaryExpression */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
diagnostic = noImplicitAny ? ts.Diagnostics.Member_0_implicitly_has_an_1_type : ts.Diagnostics.Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage;
break;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
var param = declaration;
if (ts.isIdentifier(param.name) &&
(ts.isCallSignatureDeclaration(param.parent) || ts.isMethodSignature(param.parent) || ts.isFunctionTypeNode(param.parent)) &&
@@ -44319,30 +45103,30 @@
noImplicitAny ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage :
noImplicitAny ? ts.Diagnostics.Parameter_0_implicitly_has_an_1_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage;
break;
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type;
if (!noImplicitAny) {
// Don't issue a suggestion for binding elements since the codefix doesn't yet support them.
return;
}
break;
- case 294 /* JSDocFunctionType */:
+ case 295 /* JSDocFunctionType */:
error(declaration, ts.Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);
return;
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
if (noImplicitAny && !declaration.name) {
error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);
return;
}
diagnostic = noImplicitAny ? ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type : ts.Diagnostics._0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage;
break;
- case 181 /* MappedType */:
+ case 182 /* MappedType */:
if (noImplicitAny) {
error(declaration, ts.Diagnostics.Mapped_object_type_implicitly_has_an_any_template_type);
}
@@ -44462,7 +45246,7 @@
var objectFlags = ts.getObjectFlags(type);
return !!(type.flags & 63176704 /* Instantiable */ ||
objectFlags & 4 /* Reference */ && ts.forEach(type.typeArguments, couldContainTypeVariables) ||
- objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 2048 /* TypeLiteral */ | 32 /* Class */) ||
+ objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations ||
objectFlags & 32 /* Mapped */ ||
type.flags & 3145728 /* UnionOrIntersection */ && couldUnionOrIntersectionContainTypeVariables(type));
}
@@ -44510,10 +45294,18 @@
reverseMappedCache.set(key, type);
return type;
}
+ // We consider a type to be partially inferable if it isn't marked non-inferable or if it is
+ // an object literal type with at least one property of an inferable type. For example, an object
+ // literal { a: 123, b: x => true } is marked non-inferable because it contains a context sensitive
+ // arrow function, but is considered partially inferable because property 'a' has an inferable type.
+ function isPartiallyInferableType(type) {
+ return !(ts.getObjectFlags(type) & 524288 /* NonInferrableType */) ||
+ isObjectLiteralType(type) && ts.some(getPropertiesOfType(type), function (prop) { return isPartiallyInferableType(getTypeOfSymbol(prop)); });
+ }
function createReverseMappedType(source, target, constraint) {
- // If any property contains context sensitive functions that have been skipped, the source type
- // is incomplete and we can't infer a meaningful input type.
- if (ts.getObjectFlags(source) & 524288 /* NonInferrableType */ || getPropertiesOfType(source).length === 0 && !getIndexInfoOfType(source, 0 /* String */)) {
+ // We consider a source type reverse mappable if it has a string index signature or if
+ // it has one or more properties and is of a partially inferable type.
+ if (!(getIndexInfoOfType(source, 0 /* String */) || getPropertiesOfType(source).length !== 0 && isPartiallyInferableType(source))) {
return undefined;
}
// For arrays and tuples we infer new arrays and tuples where the reverse mapping has been
@@ -44543,20 +45335,20 @@
var templateType = getTemplateTypeFromMappedType(target);
var inference = createInferenceInfo(typeParameter);
inferTypes([inference], sourceType, templateType);
- return getTypeFromInference(inference);
+ return getTypeFromInference(inference) || unknownType;
}
function getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties) {
- var properties, _i, properties_3, targetProp, sourceProp, targetType, sourceType;
+ var properties, _i, properties_2, targetProp, sourceProp, targetType, sourceType;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
- properties = target.flags & 2097152 /* Intersection */ ? getPropertiesOfUnionOrIntersectionType(target) : getPropertiesOfObjectType(target);
- _i = 0, properties_3 = properties;
+ properties = target.flags & 1048576 /* Union */ ? getPossiblePropertiesOfUnionType(target) : getPropertiesOfType(target);
+ _i = 0, properties_2 = properties;
_a.label = 1;
case 1:
- if (!(_i < properties_3.length)) return [3 /*break*/, 6];
- targetProp = properties_3[_i];
- if (!(requireOptionalProperties || !(targetProp.flags & 16777216 /* Optional */))) return [3 /*break*/, 5];
+ if (!(_i < properties_2.length)) return [3 /*break*/, 6];
+ targetProp = properties_2[_i];
+ if (!(requireOptionalProperties || !(targetProp.flags & 16777216 /* Optional */ || ts.getCheckFlags(targetProp) & 48 /* Partial */))) return [3 /*break*/, 5];
sourceProp = getPropertyOfType(source, targetProp.escapedName);
if (!!sourceProp) return [3 /*break*/, 3];
return [4 /*yield*/, targetProp];
@@ -44597,7 +45389,7 @@
function getTypeFromInference(inference) {
return inference.candidates ? getUnionType(inference.candidates, 2 /* Subtype */) :
inference.contraCandidates ? getIntersectionType(inference.contraCandidates) :
- emptyObjectType;
+ undefined;
}
function inferTypes(inferences, originalSource, originalTarget, priority, contravariant) {
if (priority === void 0) { priority = 0; }
@@ -44671,6 +45463,9 @@
target = removeTypesFromUnionOrIntersection(target, matchingTypes);
}
}
+ else if (target.flags & (8388608 /* IndexedAccess */ | 33554432 /* Substitution */)) {
+ target = getActualTypeVariable(target);
+ }
if (target.flags & 8650752 /* TypeVariable */) {
// If target is a type parameter, make an inference, unless the source type contains
// the anyFunctionType (the wildcard type that's used to avoid contextually typing functions).
@@ -44679,7 +45474,7 @@
// not contain anyFunctionType when we come back to this argument for its second round
// of inference. Also, we exclude inferences for silentNeverType (which is used as a wildcard
// when constructing types from type parameters that had no inference candidates).
- if (ts.getObjectFlags(source) & 524288 /* NonInferrableType */ || source === silentNeverType || (priority & 8 /* ReturnType */ && (source === autoType || source === autoArrayType))) {
+ if (ts.getObjectFlags(source) & 524288 /* NonInferrableType */ || source === silentNeverType || (priority & 16 /* ReturnType */ && (source === autoType || source === autoArrayType))) {
return;
}
var inference = getInferenceInfoForType(target);
@@ -44706,7 +45501,7 @@
inference.inferredType = undefined;
}
}
- if (!(priority & 8 /* ReturnType */) && target.flags & 262144 /* TypeParameter */ && inference.topLevel && !isTypeParameterAtTopLevel(originalTarget, target)) {
+ if (!(priority & 16 /* ReturnType */) && target.flags & 262144 /* TypeParameter */ && inference.topLevel && !isTypeParameterAtTopLevel(originalTarget, target)) {
inference.topLevel = false;
inference.inferredType = undefined;
}
@@ -44715,16 +45510,16 @@
}
else {
// Infer to the simplified version of an indexed access, if possible, to (hopefully) expose more bare type parameters to the inference engine
- var simplified = getSimplifiedType(target);
+ var simplified = getSimplifiedType(target, /*writing*/ false);
if (simplified !== target) {
inferFromTypesOnce(source, simplified);
}
else if (target.flags & 8388608 /* IndexedAccess */) {
- var indexType = getSimplifiedType(target.indexType);
+ var indexType = getSimplifiedType(target.indexType, /*writing*/ false);
// Generally simplifications of instantiable indexes are avoided to keep relationship checking correct, however if our target is an access, we can consider
// that key of that access to be "instantiated", since we're looking to find the infernce goal in any way we can.
if (indexType.flags & 63176704 /* Instantiable */) {
- var simplified_1 = distributeIndexOverObjectType(getSimplifiedType(target.objectType), indexType);
+ var simplified_1 = distributeIndexOverObjectType(getSimplifiedType(target.objectType, /*writing*/ false), indexType, /*writing*/ false);
if (simplified_1 && simplified_1 !== target) {
inferFromTypesOnce(source, simplified_1);
}
@@ -44732,9 +45527,6 @@
}
}
}
- else if (target.flags & 33554432 /* Substitution */) {
- inferFromTypes(source, target.typeVariable);
- }
if (ts.getObjectFlags(source) & 4 /* Reference */ && ts.getObjectFlags(target) & 4 /* Reference */ && source.target === target.target) {
// If source and target are references to the same generic type, infer from type arguments
var sourceTypes = source.typeArguments || ts.emptyArray;
@@ -44742,7 +45534,7 @@
var count = sourceTypes.length < targetTypes.length ? sourceTypes.length : targetTypes.length;
var variances = getVariances(source.target);
for (var i = 0; i < count; i++) {
- if (i < variances.length && variances[i] === 2 /* Contravariant */) {
+ if (i < variances.length && (variances[i] & 7 /* VarianceMask */) === 2 /* Contravariant */) {
inferFromContravariantTypes(sourceTypes[i], targetTypes[i]);
}
else {
@@ -44759,7 +45551,7 @@
var empty = createEmptyObjectTypeFromStringLiteral(source);
contravariant = !contravariant;
var savePriority = priority;
- priority |= 16 /* LiteralKeyof */;
+ priority |= 32 /* LiteralKeyof */;
inferFromTypes(empty, target.type);
priority = savePriority;
contravariant = !contravariant;
@@ -44771,12 +45563,12 @@
else if (source.flags & 16777216 /* Conditional */ && target.flags & 16777216 /* Conditional */) {
inferFromTypes(source.checkType, target.checkType);
inferFromTypes(source.extendsType, target.extendsType);
- inferFromTypes(source.trueType, target.trueType);
- inferFromTypes(source.falseType, target.falseType);
+ inferFromTypes(getTrueTypeFromConditionalType(source), getTrueTypeFromConditionalType(target));
+ inferFromTypes(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target));
}
else if (target.flags & 16777216 /* Conditional */ && !contravariant) {
- inferFromTypes(source, target.trueType);
- inferFromTypes(source, target.falseType);
+ inferFromTypes(source, getTrueTypeFromConditionalType(target));
+ inferFromTypes(source, getFalseTypeFromConditionalType(target));
}
else if (target.flags & 3145728 /* UnionOrIntersection */) {
// We infer from types that are not naked type variables first so that inferences we
@@ -44817,7 +45609,7 @@
}
}
else {
- if (!(priority & 32 /* NoConstraints */ && source.flags & (2097152 /* Intersection */ | 63176704 /* Instantiable */))) {
+ if (!(priority & 64 /* NoConstraints */ && source.flags & (2097152 /* Intersection */ | 63176704 /* Instantiable */))) {
var apparentSource = getApparentType(source);
// getApparentType can return _any_ type, since an indexed access or conditional may simplify to any other type.
// If that occurs and it doesn't simplify to an object or intersection, we'll need to restart `inferFromTypes`
@@ -44870,7 +45662,7 @@
}
}
function inferFromContravariantTypes(source, target) {
- if (strictFunctionTypes || priority & 64 /* AlwaysStrict */) {
+ if (strictFunctionTypes || priority & 128 /* AlwaysStrict */) {
contravariant = !contravariant;
inferFromTypes(source, target);
contravariant = !contravariant;
@@ -44909,7 +45701,11 @@
var inferredType = inferTypeForHomomorphicMappedType(source, target, constraintType);
if (inferredType) {
var savePriority = priority;
- priority |= 2 /* HomomorphicMappedType */;
+ // We assign a lower priority to inferences made from types containing non-inferrable
+ // types because we may only have a partial result (i.e. we may have failed to make
+ // reverse inferences for some properties).
+ priority |= ts.getObjectFlags(source) & 524288 /* NonInferrableType */ ?
+ 4 /* PartialHomomorphicMappedType */ : 2 /* HomomorphicMappedType */;
inferFromTypes(inferredType, inference.typeParameter);
priority = savePriority;
}
@@ -44920,7 +45716,7 @@
// We're inferring from some source type S to a mapped type { [P in K]: X }, where K is a type
// parameter. First infer from 'keyof S' to K.
var savePriority = priority;
- priority |= 4 /* MappedTypeConstraint */;
+ priority |= 8 /* MappedTypeConstraint */;
inferFromTypes(getIndexType(source), constraintType);
priority = savePriority;
// If K is constrained to a type C, also infer to C. Thus, for a mapped type { [P in K]: X },
@@ -44933,11 +45729,11 @@
}
// If no inferences can be made to K's constraint, infer from a union of the property types
// in the source to the template type X.
- var valueTypes = ts.compact([
- getIndexTypeOfType(source, 0 /* String */),
- getIndexTypeOfType(source, 1 /* Number */)
- ].concat(ts.map(getPropertiesOfType(source), getTypeOfSymbol)));
- inferFromTypes(getUnionType(valueTypes), getTemplateTypeFromMappedType(target));
+ var propTypes = ts.map(getPropertiesOfType(source), getTypeOfSymbol);
+ var stringIndexType = getIndexTypeOfType(source, 0 /* String */);
+ var numberIndexInfo = getNonEnumNumberIndexInfo(source);
+ var numberIndexType = numberIndexInfo && numberIndexInfo.type;
+ inferFromTypes(getUnionType(ts.append(ts.append(propTypes, stringIndexType), numberIndexType)), getTemplateTypeFromMappedType(target));
return true;
}
return false;
@@ -44991,8 +45787,8 @@
}
}
var properties = getPropertiesOfObjectType(target);
- for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) {
- var targetProp = properties_4[_i];
+ for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) {
+ var targetProp = properties_3[_i];
var sourceProp = getPropertyOfType(source, targetProp.escapedName);
if (sourceProp) {
inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp));
@@ -45015,7 +45811,7 @@
var saveBivariant = bivariant;
var kind = target.declaration ? target.declaration.kind : 0 /* Unknown */;
// Once we descend into a bivariant signature we remain bivariant for all nested inferences
- bivariant = bivariant || kind === 156 /* MethodDeclaration */ || kind === 155 /* MethodSignature */ || kind === 157 /* Constructor */;
+ bivariant = bivariant || kind === 157 /* MethodDeclaration */ || kind === 156 /* MethodSignature */ || kind === 158 /* Constructor */;
applyToParameterTypes(source, target, inferFromContravariantTypes);
bivariant = saveBivariant;
}
@@ -45082,7 +45878,7 @@
return candidates;
}
function getContravariantInference(inference) {
- return inference.priority & 28 /* PriorityImpliesCombination */ ? getIntersectionType(inference.contraCandidates) : getCommonSubtype(inference.contraCandidates);
+ return inference.priority & 56 /* PriorityImpliesCombination */ ? getIntersectionType(inference.contraCandidates) : getCommonSubtype(inference.contraCandidates);
}
function getCovariantInference(inference, signature) {
// Extract all object literal types and replace them with a single widened and normalized type.
@@ -45099,15 +45895,15 @@
candidates;
// If all inferences were made from a position that implies a combined result, infer a union type.
// Otherwise, infer a common supertype.
- var unwidenedType = inference.priority & 28 /* PriorityImpliesCombination */ ?
+ var unwidenedType = inference.priority & 56 /* PriorityImpliesCombination */ ?
getUnionType(baseCandidates, 2 /* Subtype */) :
getCommonSupertype(baseCandidates);
return getWidenedType(unwidenedType);
}
function getInferredType(context, index) {
var inference = context.inferences[index];
- var inferredType = inference.inferredType;
- if (!inferredType) {
+ if (!inference.inferredType) {
+ var inferredType = void 0;
var signature = context.signature;
if (signature) {
var inferredCovariantType = inference.candidates ? getCovariantInference(inference, signature) : undefined;
@@ -45138,27 +45934,24 @@
// parameter should be instantiated to the empty object type.
inferredType = instantiateType(defaultType, combineTypeMappers(createBackreferenceMapper(context, index), context.nonFixingMapper));
}
- else {
- inferredType = getDefaultTypeArgumentType(!!(context.flags & 2 /* AnyDefault */));
- }
}
}
else {
inferredType = getTypeFromInference(inference);
}
- inference.inferredType = inferredType;
+ inference.inferredType = inferredType || getDefaultTypeArgumentType(!!(context.flags & 2 /* AnyDefault */));
var constraint = getConstraintOfTypeParameter(inference.typeParameter);
if (constraint) {
var instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
- if (!context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
+ if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
inference.inferredType = inferredType = instantiatedConstraint;
}
}
}
- return inferredType;
+ return inference.inferredType;
}
function getDefaultTypeArgumentType(isInJavaScriptFile) {
- return isInJavaScriptFile ? anyType : emptyObjectType;
+ return isInJavaScriptFile ? anyType : unknownType;
}
function getInferredTypes(context) {
var result = [];
@@ -45168,8 +45961,8 @@
return result;
}
// EXPRESSION TYPE CHECKING
- function getCannotFindNameDiagnosticForName(name) {
- switch (name) {
+ function getCannotFindNameDiagnosticForName(node) {
+ switch (node.escapedText) {
case "document":
case "console":
return ts.Diagnostics.Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_include_dom;
@@ -45200,14 +45993,20 @@
case "Iterator":
case "AsyncIterator":
return ts.Diagnostics.Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later;
- default: return ts.Diagnostics.Cannot_find_name_0;
+ default:
+ if (node.parent.kind === 277 /* ShorthandPropertyAssignment */) {
+ return ts.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer;
+ }
+ else {
+ return ts.Diagnostics.Cannot_find_name_0;
+ }
}
}
function getResolvedSymbol(node) {
var links = getNodeLinks(node);
if (!links.resolvedSymbol) {
links.resolvedSymbol = !ts.nodeIsMissing(node) &&
- resolveName(node, node.escapedText, 67220415 /* Value */ | 1048576 /* ExportValue */, getCannotFindNameDiagnosticForName(node.escapedText), node, !ts.isWriteOnlyAccess(node),
+ resolveName(node, node.escapedText, 67220415 /* Value */ | 1048576 /* ExportValue */, getCannotFindNameDiagnosticForName(node), node, !ts.isWriteOnlyAccess(node),
/*excludeGlobals*/ false, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_1) || unknownSymbol;
}
return links.resolvedSymbol;
@@ -45216,7 +46015,7 @@
// TypeScript 1.0 spec (April 2014): 3.6.3
// A type query consists of the keyword typeof followed by an expression.
// The expression is restricted to a single identifier or a sequence of identifiers separated by periods
- return !!ts.findAncestor(node, function (n) { return n.kind === 167 /* TypeQuery */ ? true : n.kind === 72 /* Identifier */ || n.kind === 148 /* QualifiedName */ ? false : "quit"; });
+ return !!ts.findAncestor(node, function (n) { return n.kind === 168 /* TypeQuery */ ? true : n.kind === 73 /* Identifier */ || n.kind === 149 /* QualifiedName */ ? false : "quit"; });
}
// Return the flow cache key for a "dotted name" (i.e. a sequence of identifiers
// separated by dots). The key consists of the id of the symbol referenced by the
@@ -45224,21 +46023,21 @@
// The result is undefined if the reference isn't a dotted name. We prefix nodes
// occurring in an apparent type position with '@' because the control flow type
// of such nodes may be based on the apparent type instead of the declared type.
- function getFlowCacheKey(node) {
+ function getFlowCacheKey(node, declaredType, initialType, flowContainer) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
var symbol = getResolvedSymbol(node);
- return symbol !== unknownSymbol ? (isConstraintPosition(node) ? "@" : "") + getSymbolId(symbol) : undefined;
- case 100 /* ThisKeyword */:
+ return symbol !== unknownSymbol ? (flowContainer ? getNodeId(flowContainer) : "-1") + "|" + getTypeId(declaredType) + "|" + getTypeId(initialType) + "|" + (isConstraintPosition(node) ? "@" : "") + getSymbolId(symbol) : undefined;
+ case 101 /* ThisKeyword */:
return "0";
- case 213 /* NonNullExpression */:
- case 195 /* ParenthesizedExpression */:
- return getFlowCacheKey(node.expression);
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 214 /* NonNullExpression */:
+ case 196 /* ParenthesizedExpression */:
+ return getFlowCacheKey(node.expression, declaredType, initialType, flowContainer);
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
var propName = getAccessedPropertyName(node);
if (propName !== undefined) {
- var key = getFlowCacheKey(node.expression);
+ var key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer);
return key && key + "." + propName;
}
}
@@ -45246,24 +46045,24 @@
}
function isMatchingReference(source, target) {
switch (target.kind) {
- case 195 /* ParenthesizedExpression */:
- case 213 /* NonNullExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 214 /* NonNullExpression */:
return isMatchingReference(source, target.expression);
}
switch (source.kind) {
- case 72 /* Identifier */:
- return target.kind === 72 /* Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) ||
- (target.kind === 237 /* VariableDeclaration */ || target.kind === 186 /* BindingElement */) &&
+ case 73 /* Identifier */:
+ return target.kind === 73 /* Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) ||
+ (target.kind === 238 /* VariableDeclaration */ || target.kind === 187 /* BindingElement */) &&
getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target);
- case 100 /* ThisKeyword */:
- return target.kind === 100 /* ThisKeyword */;
- case 98 /* SuperKeyword */:
- return target.kind === 98 /* SuperKeyword */;
- case 213 /* NonNullExpression */:
- case 195 /* ParenthesizedExpression */:
+ case 101 /* ThisKeyword */:
+ return target.kind === 101 /* ThisKeyword */;
+ case 99 /* SuperKeyword */:
+ return target.kind === 99 /* SuperKeyword */;
+ case 214 /* NonNullExpression */:
+ case 196 /* ParenthesizedExpression */:
return isMatchingReference(source.expression, target);
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return ts.isAccessExpression(target) &&
getAccessedPropertyName(source) === getAccessedPropertyName(target) &&
isMatchingReference(source.expression, target.expression);
@@ -45271,7 +46070,7 @@
return false;
}
function getAccessedPropertyName(access) {
- return access.kind === 189 /* PropertyAccessExpression */ ? access.name.escapedText :
+ return access.kind === 190 /* PropertyAccessExpression */ ? access.name.escapedText :
ts.isStringLiteral(access.argumentExpression) || ts.isNumericLiteral(access.argumentExpression) ? ts.escapeLeadingUnderscores(access.argumentExpression.text) :
undefined;
}
@@ -45296,7 +46095,7 @@
isDiscriminantProperty(getDeclaredTypeOfReference(target.expression), name);
}
function getDeclaredTypeOfReference(expr) {
- if (expr.kind === 72 /* Identifier */) {
+ if (expr.kind === 73 /* Identifier */) {
return getTypeOfSymbol(getResolvedSymbol(expr));
}
if (ts.isAccessExpression(expr)) {
@@ -45318,7 +46117,7 @@
if (prop && ts.getCheckFlags(prop) & 2 /* SyntheticProperty */) {
if (prop.isDiscriminantProperty === undefined) {
prop.isDiscriminantProperty =
- (prop.checkFlags & 96 /* Discriminant */) === 96 /* Discriminant */ &&
+ (prop.checkFlags & 192 /* Discriminant */) === 192 /* Discriminant */ &&
isDiscriminantType(getTypeOfSymbol(prop));
}
return !!prop.isDiscriminantProperty;
@@ -45327,7 +46126,7 @@
return false;
}
function isSyntheticThisPropertyAccess(expr) {
- return ts.isAccessExpression(expr) && expr.expression.kind === 100 /* ThisKeyword */ && !!(expr.expression.flags & 8 /* Synthesized */);
+ return ts.isAccessExpression(expr) && expr.expression.kind === 101 /* ThisKeyword */ && !!(expr.expression.flags & 8 /* Synthesized */);
}
function findDiscriminantProperties(sourceProperties, target) {
var result;
@@ -45355,7 +46154,7 @@
}
}
}
- if (callExpression.expression.kind === 189 /* PropertyAccessExpression */ &&
+ if (callExpression.expression.kind === 190 /* PropertyAccessExpression */ &&
isOrContainsMatchingReference(reference, callExpression.expression.expression)) {
return true;
}
@@ -45474,7 +46273,7 @@
return strictNullChecks ? 7888800 /* ObjectStrictFacts */ : 16736160 /* ObjectFacts */;
}
if (flags & 63176704 /* Instantiable */) {
- return getTypeFacts(getBaseConstraintOfType(type) || emptyObjectType);
+ return getTypeFacts(getBaseConstraintOfType(type) || unknownType);
}
if (flags & 3145728 /* UnionOrIntersection */) {
return getTypeFactsOfTypes(type.types);
@@ -45510,15 +46309,15 @@
return createArrayType(checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false, /*allowAsyncIterables*/ false) || errorType);
}
function getAssignedTypeOfBinaryExpression(node) {
- var isDestructuringDefaultAssignment = node.parent.kind === 187 /* ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) ||
- node.parent.kind === 275 /* PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent);
+ var isDestructuringDefaultAssignment = node.parent.kind === 188 /* ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) ||
+ node.parent.kind === 276 /* PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent);
return isDestructuringDefaultAssignment ?
getTypeWithDefault(getAssignedType(node), node.right) :
getTypeOfExpression(node.right);
}
function isDestructuringAssignmentTarget(parent) {
- return parent.parent.kind === 204 /* BinaryExpression */ && parent.parent.left === parent ||
- parent.parent.kind === 227 /* ForOfStatement */ && parent.parent.initializer === parent;
+ return parent.parent.kind === 205 /* BinaryExpression */ && parent.parent.left === parent ||
+ parent.parent.kind === 228 /* ForOfStatement */ && parent.parent.initializer === parent;
}
function getAssignedTypeOfArrayLiteralElement(node, element) {
return getTypeOfDestructuredArrayElement(getAssignedType(node), node.elements.indexOf(element));
@@ -45535,21 +46334,21 @@
function getAssignedType(node) {
var parent = node.parent;
switch (parent.kind) {
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return stringType;
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return checkRightHandSideOfForOf(parent.expression, parent.awaitModifier) || errorType;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return getAssignedTypeOfBinaryExpression(parent);
- case 198 /* DeleteExpression */:
+ case 199 /* DeleteExpression */:
return undefinedType;
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return getAssignedTypeOfArrayLiteralElement(parent, node);
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
return getAssignedTypeOfSpreadExpression(parent);
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return getAssignedTypeOfPropertyAssignment(parent);
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return getAssignedTypeOfShorthandPropertyAssignment(parent);
}
return errorType;
@@ -45557,7 +46356,7 @@
function getInitialTypeOfBindingElement(node) {
var pattern = node.parent;
var parentType = getInitialType(pattern.parent);
- var type = pattern.kind === 184 /* ObjectBindingPattern */ ?
+ var type = pattern.kind === 185 /* ObjectBindingPattern */ ?
getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) :
!node.dotDotDotToken ?
getTypeOfDestructuredArrayElement(parentType, pattern.elements.indexOf(node)) :
@@ -45575,37 +46374,37 @@
if (node.initializer) {
return getTypeOfInitializer(node.initializer);
}
- if (node.parent.parent.kind === 226 /* ForInStatement */) {
+ if (node.parent.parent.kind === 227 /* ForInStatement */) {
return stringType;
}
- if (node.parent.parent.kind === 227 /* ForOfStatement */) {
+ if (node.parent.parent.kind === 228 /* ForOfStatement */) {
return checkRightHandSideOfForOf(node.parent.parent.expression, node.parent.parent.awaitModifier) || errorType;
}
return errorType;
}
function getInitialType(node) {
- return node.kind === 237 /* VariableDeclaration */ ?
+ return node.kind === 238 /* VariableDeclaration */ ?
getInitialTypeOfVariableDeclaration(node) :
getInitialTypeOfBindingElement(node);
}
function getInitialOrAssignedType(node, reference) {
- return getConstraintForLocation(node.kind === 237 /* VariableDeclaration */ || node.kind === 186 /* BindingElement */ ?
+ return getConstraintForLocation(node.kind === 238 /* VariableDeclaration */ || node.kind === 187 /* BindingElement */ ?
getInitialType(node) :
getAssignedType(node), reference);
}
function isEmptyArrayAssignment(node) {
- return node.kind === 237 /* VariableDeclaration */ && node.initializer &&
+ return node.kind === 238 /* VariableDeclaration */ && node.initializer &&
isEmptyArrayLiteral(node.initializer) ||
- node.kind !== 186 /* BindingElement */ && node.parent.kind === 204 /* BinaryExpression */ &&
+ node.kind !== 187 /* BindingElement */ && node.parent.kind === 205 /* BinaryExpression */ &&
isEmptyArrayLiteral(node.parent.right);
}
function getReferenceCandidate(node) {
switch (node.kind) {
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return getReferenceCandidate(node.expression);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
switch (node.operatorToken.kind) {
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
return getReferenceCandidate(node.left);
case 27 /* CommaToken */:
return getReferenceCandidate(node.right);
@@ -45615,13 +46414,13 @@
}
function getReferenceRoot(node) {
var parent = node.parent;
- return parent.kind === 195 /* ParenthesizedExpression */ ||
- parent.kind === 204 /* BinaryExpression */ && parent.operatorToken.kind === 59 /* EqualsToken */ && parent.left === node ||
- parent.kind === 204 /* BinaryExpression */ && parent.operatorToken.kind === 27 /* CommaToken */ && parent.right === node ?
+ return parent.kind === 196 /* ParenthesizedExpression */ ||
+ parent.kind === 205 /* BinaryExpression */ && parent.operatorToken.kind === 60 /* EqualsToken */ && parent.left === node ||
+ parent.kind === 205 /* BinaryExpression */ && parent.operatorToken.kind === 27 /* CommaToken */ && parent.right === node ?
getReferenceRoot(parent) : node;
}
function getTypeOfSwitchClause(clause) {
- if (clause.kind === 271 /* CaseClause */) {
+ if (clause.kind === 272 /* CaseClause */) {
return getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression));
}
return neverType;
@@ -45643,7 +46442,7 @@
var witnesses = [];
for (var _i = 0, _a = switchStatement.caseBlock.clauses; _i < _a.length; _i++) {
var clause = _a[_i];
- if (clause.kind === 271 /* CaseClause */) {
+ if (clause.kind === 272 /* CaseClause */) {
if (clause.expression.kind === 10 /* StringLiteral */) {
witnesses.push(clause.expression.text);
continue;
@@ -45689,6 +46488,9 @@
}
return f(type) ? type : neverType;
}
+ function countTypes(type) {
+ return type.flags & 1048576 /* Union */ ? type.types.length : 1;
+ }
function mapType(type, mapper, noReductions) {
if (type.flags & 131072 /* Never */) {
return type;
@@ -45696,25 +46498,20 @@
if (!(type.flags & 1048576 /* Union */)) {
return mapper(type);
}
- var types = type.types;
- var mappedType;
var mappedTypes;
- for (var _i = 0, types_13 = types; _i < types_13.length; _i++) {
- var current = types_13[_i];
- var t = mapper(current);
- if (t) {
- if (!mappedType) {
- mappedType = t;
- }
- else if (!mappedTypes) {
- mappedTypes = [mappedType, t];
+ for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
+ var t = _a[_i];
+ var mapped = mapper(t);
+ if (mapped) {
+ if (!mappedTypes) {
+ mappedTypes = [mapped];
}
else {
- mappedTypes.push(t);
+ mappedTypes.push(mapped);
}
}
}
- return mappedTypes ? getUnionType(mappedTypes, noReductions ? 0 /* None */ : 1 /* Literal */) : mappedType;
+ return mappedTypes && getUnionType(mappedTypes, noReductions ? 0 /* None */ : 1 /* Literal */);
}
function extractTypesOfKind(type, kind) {
return filterType(type, function (t) { return (t.flags & kind) !== 0; });
@@ -45782,8 +46579,8 @@
}
function isEvolvingArrayTypeList(types) {
var hasEvolvingArrayType = false;
- for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
- var t = types_14[_i];
+ for (var _i = 0, types_13 = types; _i < types_13.length; _i++) {
+ var t = types_13[_i];
if (!(t.flags & 131072 /* Never */)) {
if (!(ts.getObjectFlags(t) & 256 /* EvolvingArray */)) {
return false;
@@ -45806,12 +46603,12 @@
function isEvolvingArrayOperationTarget(node) {
var root = getReferenceRoot(node);
var parent = root.parent;
- var isLengthPushOrUnshift = parent.kind === 189 /* PropertyAccessExpression */ && (parent.name.escapedText === "length" ||
- parent.parent.kind === 191 /* CallExpression */ && ts.isPushOrUnshiftIdentifier(parent.name));
- var isElementAssignment = parent.kind === 190 /* ElementAccessExpression */ &&
+ var isLengthPushOrUnshift = parent.kind === 190 /* PropertyAccessExpression */ && (parent.name.escapedText === "length" ||
+ parent.parent.kind === 192 /* CallExpression */ && ts.isPushOrUnshiftIdentifier(parent.name));
+ var isElementAssignment = parent.kind === 191 /* ElementAccessExpression */ &&
parent.expression === root &&
- parent.parent.kind === 204 /* BinaryExpression */ &&
- parent.parent.operatorToken.kind === 59 /* EqualsToken */ &&
+ parent.parent.kind === 205 /* BinaryExpression */ &&
+ parent.parent.operatorToken.kind === 60 /* EqualsToken */ &&
parent.parent.left === parent &&
!ts.isAssignmentTarget(parent.parent) &&
isTypeAssignableToKind(getTypeOfExpression(parent.argumentExpression), 296 /* NumberLike */);
@@ -45825,7 +46622,7 @@
return links.maybeTypePredicate;
}
function getMaybeTypePredicate(node) {
- if (node.expression.kind !== 98 /* SuperKeyword */) {
+ if (node.expression.kind !== 99 /* SuperKeyword */) {
var funcType = checkNonNullExpression(node.expression);
if (funcType !== silentNeverType) {
var apparentType = getApparentType(funcType);
@@ -45843,6 +46640,7 @@
function getFlowTypeOfReference(reference, declaredType, initialType, flowContainer, couldBeUninitialized) {
if (initialType === void 0) { initialType = declaredType; }
var key;
+ var keySet = false;
var flowDepth = 0;
if (flowAnalysisDisabled) {
return errorType;
@@ -45858,10 +46656,17 @@
// on empty arrays are possible without implicit any errors and new element types can be inferred without
// type mismatch errors.
var resultType = ts.getObjectFlags(evolvedType) & 256 /* EvolvingArray */ && isEvolvingArrayOperationTarget(reference) ? autoArrayType : finalizeEvolvingArrayType(evolvedType);
- if (reference.parent && reference.parent.kind === 213 /* NonNullExpression */ && getTypeWithFacts(resultType, 2097152 /* NEUndefinedOrNull */).flags & 131072 /* Never */) {
+ if (reference.parent && reference.parent.kind === 214 /* NonNullExpression */ && getTypeWithFacts(resultType, 2097152 /* NEUndefinedOrNull */).flags & 131072 /* Never */) {
return declaredType;
}
return resultType;
+ function getOrSetCacheKey() {
+ if (keySet) {
+ return key;
+ }
+ keySet = true;
+ return key = getFlowCacheKey(reference, declaredType, initialType, flowContainer);
+ }
function getTypeAtFlowNode(flow) {
if (flowDepth === 2000) {
// We have made 2000 recursive invocations. To avoid overflowing the call stack we report an error
@@ -45873,6 +46678,15 @@
flowDepth++;
while (true) {
var flags = flow.flags;
+ if (flags & 8192 /* Cached */) {
+ var key_2 = getOrSetCacheKey();
+ if (key_2) {
+ var id = getFlowNodeId(flow);
+ if (flowAssignmentKeys[id] === key_2) {
+ return flowAssignmentTypes[id];
+ }
+ }
+ }
if (flags & 1024 /* Shared */) {
// We cache results of flow type resolution for shared nodes that were previously visited in
// the same getFlowTypeOfReference invocation. A node is considered shared when it is the
@@ -45903,6 +46717,15 @@
flow = flow.antecedent;
continue;
}
+ else if (flowLoopCount === flowLoopStart) { // Only cache assignments when not within loop analysis
+ var key_3 = getOrSetCacheKey();
+ if (key_3 && !isIncomplete(type)) {
+ flow.flags |= 8192 /* Cached */;
+ var id = getFlowNodeId(flow);
+ flowAssignmentKeys[id] = key_3;
+ flowAssignmentTypes[id] = type;
+ }
+ }
}
else if (flags & 96 /* Condition */) {
type = getTypeAtFlowCondition(flow);
@@ -45930,9 +46753,9 @@
// Check if we should continue with the control flow of the containing function.
var container = flow.container;
if (container && container !== flowContainer &&
- reference.kind !== 189 /* PropertyAccessExpression */ &&
- reference.kind !== 190 /* ElementAccessExpression */ &&
- reference.kind !== 100 /* ThisKeyword */) {
+ reference.kind !== 190 /* PropertyAccessExpression */ &&
+ reference.kind !== 191 /* ElementAccessExpression */ &&
+ reference.kind !== 101 /* ThisKeyword */) {
flow = container.flowNode;
continue;
}
@@ -45984,14 +46807,14 @@
// in which case we continue control flow analysis back to the function's declaration
if (ts.isVariableDeclaration(node) && (ts.isInJSFile(node) || ts.isVarConst(node))) {
var init = ts.getDeclaredExpandoInitializer(node);
- if (init && (init.kind === 196 /* FunctionExpression */ || init.kind === 197 /* ArrowFunction */)) {
+ if (init && (init.kind === 197 /* FunctionExpression */ || init.kind === 198 /* ArrowFunction */)) {
return getTypeAtFlowNode(flow.antecedent);
}
}
return declaredType;
}
// for (const _ in ref) acts as a nonnull on ref
- if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 226 /* ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) {
+ if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 227 /* ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) {
return getNonNullableTypeIfNeeded(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent)));
}
// Assignment doesn't affect reference
@@ -46000,7 +46823,7 @@
function getTypeAtFlowArrayMutation(flow) {
if (declaredType === autoType || declaredType === autoArrayType) {
var node = flow.node;
- var expr = node.kind === 191 /* CallExpression */ ?
+ var expr = node.kind === 192 /* CallExpression */ ?
node.expression.expression :
node.left.expression;
if (isMatchingReference(reference, getReferenceCandidate(expr))) {
@@ -46008,7 +46831,7 @@
var type = getTypeFromFlowType(flowType);
if (ts.getObjectFlags(type) & 256 /* EvolvingArray */) {
var evolvedType_1 = type;
- if (node.kind === 191 /* CallExpression */) {
+ if (node.kind === 192 /* CallExpression */) {
for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) {
var arg = _a[_i];
evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg);
@@ -46061,7 +46884,7 @@
else if (isMatchingReferenceDiscriminant(expr, type)) {
type = narrowTypeByDiscriminant(type, expr, function (t) { return narrowTypeBySwitchOnDiscriminant(t, flow.switchStatement, flow.clauseStart, flow.clauseEnd); });
}
- else if (expr.kind === 199 /* TypeOfExpression */ && isMatchingReference(reference, expr.expression)) {
+ else if (expr.kind === 200 /* TypeOfExpression */ && isMatchingReference(reference, expr.expression)) {
type = narrowBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
}
else if (containsMatchingReferenceDiscriminant(reference, expr)) {
@@ -46108,13 +46931,11 @@
// this flow loop junction, return the cached type.
var id = getFlowNodeId(flow);
var cache = flowLoopCaches[id] || (flowLoopCaches[id] = ts.createMap());
+ var key = getOrSetCacheKey();
if (!key) {
- key = getFlowCacheKey(reference);
// No cache key is generated when binding patterns are in unnarrowable situations
- if (!key) {
return declaredType;
}
- }
var cached = cache.get(key);
if (cached) {
return cached;
@@ -46221,7 +47042,7 @@
return !assumeTrue;
}
function narrowByInKeyword(type, literal, assumeTrue) {
- if ((type.flags & (1048576 /* Union */ | 524288 /* Object */)) || (type.flags & 262144 /* TypeParameter */ && type.isThisType)) {
+ if (type.flags & (1048576 /* Union */ | 524288 /* Object */) || isThisTypeParameter(type)) {
var propName_1 = ts.escapeLeadingUnderscores(literal.text);
return filterType(type, function (t) { return isTypePresencePossible(t, propName_1, assumeTrue); });
}
@@ -46229,8 +47050,8 @@
}
function narrowTypeByBinaryExpression(type, expr, assumeTrue) {
switch (expr.operatorToken.kind) {
- case 59 /* EqualsToken */:
- return narrowTypeByTruthiness(type, expr.left, assumeTrue);
+ case 60 /* EqualsToken */:
+ return narrowTypeByTruthiness(narrowType(type, expr.right, assumeTrue), expr.left, assumeTrue);
case 33 /* EqualsEqualsToken */:
case 34 /* ExclamationEqualsToken */:
case 35 /* EqualsEqualsEqualsToken */:
@@ -46238,10 +47059,10 @@
var operator_1 = expr.operatorToken.kind;
var left_1 = getReferenceCandidate(expr.left);
var right_1 = getReferenceCandidate(expr.right);
- if (left_1.kind === 199 /* TypeOfExpression */ && ts.isStringLiteralLike(right_1)) {
+ if (left_1.kind === 200 /* TypeOfExpression */ && ts.isStringLiteralLike(right_1)) {
return narrowTypeByTypeof(type, left_1, operator_1, right_1, assumeTrue);
}
- if (right_1.kind === 199 /* TypeOfExpression */ && ts.isStringLiteralLike(left_1)) {
+ if (right_1.kind === 200 /* TypeOfExpression */ && ts.isStringLiteralLike(left_1)) {
return narrowTypeByTypeof(type, right_1, operator_1, left_1, assumeTrue);
}
if (isMatchingReference(reference, left_1)) {
@@ -46260,9 +47081,9 @@
return declaredType;
}
break;
- case 94 /* InstanceOfKeyword */:
+ case 95 /* InstanceOfKeyword */:
return narrowTypeByInstanceof(type, expr, assumeTrue);
- case 93 /* InKeyword */:
+ case 94 /* InKeyword */:
var target = getReferenceCandidate(expr.right);
if (ts.isStringLiteralLike(expr.left) && isMatchingReference(reference, target)) {
return narrowByInKeyword(type, expr.left, assumeTrue);
@@ -46306,7 +47127,10 @@
return type;
}
if (assumeTrue) {
- var narrowedType = filterType(type, function (t) { return areTypesComparable(t, valueType); });
+ var filterFn = operator === 33 /* EqualsEqualsToken */ ?
+ (function (t) { return areTypesComparable(t, valueType) || isCoercibleUnderDoubleEquals(t, valueType); }) :
+ function (t) { return areTypesComparable(t, valueType); };
+ var narrowedType = filterType(type, filterFn);
return narrowedType.flags & 131072 /* Never */ ? type : replacePrimitivesWithLiterals(narrowedType, valueType);
}
if (isUnitType(valueType)) {
@@ -46595,19 +47419,19 @@
// will be a subtype or the same type as the argument.
function narrowType(type, expr, assumeTrue) {
switch (expr.kind) {
- case 72 /* Identifier */:
- case 100 /* ThisKeyword */:
- case 98 /* SuperKeyword */:
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 73 /* Identifier */:
+ case 101 /* ThisKeyword */:
+ case 99 /* SuperKeyword */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return narrowTypeByTruthiness(type, expr, assumeTrue);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return narrowTypeByTypePredicate(type, expr, assumeTrue);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return narrowType(type, expr.expression, assumeTrue);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return narrowTypeByBinaryExpression(type, expr, assumeTrue);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
if (expr.operator === 52 /* ExclamationToken */) {
return narrowType(type, expr.operand, !assumeTrue);
}
@@ -46622,7 +47446,7 @@
// an dotted name expression, and if the location is not an assignment target, obtain the type
// of the expression (which will reflect control flow analysis). If the expression indeed
// resolved to the given symbol, return the narrowed type.
- if (location.kind === 72 /* Identifier */) {
+ if (location.kind === 73 /* Identifier */) {
if (ts.isRightSideOfQualifiedNameOrPropertyAccess(location)) {
location = location.parent;
}
@@ -46643,9 +47467,9 @@
function getControlFlowContainer(node) {
return ts.findAncestor(node.parent, function (node) {
return ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) ||
- node.kind === 245 /* ModuleBlock */ ||
- node.kind === 284 /* SourceFile */ ||
- node.kind === 154 /* PropertyDeclaration */;
+ node.kind === 246 /* ModuleBlock */ ||
+ node.kind === 285 /* SourceFile */ ||
+ node.kind === 155 /* PropertyDeclaration */;
});
}
// Check if a parameter is assigned anywhere within its declaring function.
@@ -46664,10 +47488,10 @@
return !!ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !!(getNodeLinks(node).flags & 8388608 /* AssignmentsMarked */); });
}
function markParameterAssignments(node) {
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
if (ts.isAssignmentTarget(node)) {
var symbol = getResolvedSymbol(node);
- if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 151 /* Parameter */) {
+ if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 152 /* Parameter */) {
symbol.isAssigned = true;
}
}
@@ -46682,7 +47506,7 @@
/** remove undefined from the annotated type of a parameter when there is an initializer (that doesn't include undefined) */
function removeOptionalityFromDeclaredType(declaredType, declaration) {
var annotationIncludesUndefined = strictNullChecks &&
- declaration.kind === 151 /* Parameter */ &&
+ declaration.kind === 152 /* Parameter */ &&
declaration.initializer &&
getFalsyFlags(declaredType) & 32768 /* Undefined */ &&
!(getFalsyFlags(checkExpression(declaration.initializer)) & 32768 /* Undefined */);
@@ -46690,13 +47514,13 @@
}
function isConstraintPosition(node) {
var parent = node.parent;
- return parent.kind === 189 /* PropertyAccessExpression */ ||
- parent.kind === 191 /* CallExpression */ && parent.expression === node ||
- parent.kind === 190 /* ElementAccessExpression */ && parent.expression === node ||
- parent.kind === 186 /* BindingElement */ && parent.name === node && !!parent.initializer;
+ return parent.kind === 190 /* PropertyAccessExpression */ ||
+ parent.kind === 192 /* CallExpression */ && parent.expression === node ||
+ parent.kind === 191 /* ElementAccessExpression */ && parent.expression === node ||
+ parent.kind === 187 /* BindingElement */ && parent.name === node && !!parent.initializer;
}
function typeHasNullableConstraint(type) {
- return type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || emptyObjectType, 98304 /* Nullable */);
+ return type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 98304 /* Nullable */);
}
function getConstraintForLocation(type, node) {
// When a node is the left hand expression of a property access, element access, or call expression,
@@ -46727,7 +47551,7 @@
if (symbol === argumentsSymbol) {
var container = ts.getContainingFunction(node);
if (languageVersion < 2 /* ES2015 */) {
- if (container.kind === 197 /* ArrowFunction */) {
+ if (container.kind === 198 /* ArrowFunction */) {
error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression);
}
else if (ts.hasModifier(container, 256 /* Async */)) {
@@ -46748,7 +47572,7 @@
// Due to the emit for class decorators, any reference to the class from inside of the class body
// must instead be rewritten to point to a temporary variable to avoid issues with the double-bind
// behavior of class names in ES6.
- if (declaration.kind === 240 /* ClassDeclaration */
+ if (declaration.kind === 241 /* ClassDeclaration */
&& ts.nodeIsDecorated(declaration)) {
var container = ts.getContainingClass(node);
while (container !== undefined) {
@@ -46760,14 +47584,14 @@
container = ts.getContainingClass(container);
}
}
- else if (declaration.kind === 209 /* ClassExpression */) {
+ else if (declaration.kind === 210 /* ClassExpression */) {
// When we emit a class expression with static members that contain a reference
// to the constructor in the initializer, we will need to substitute that
// binding with an alias as the class name is not in scope.
var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false);
- while (container.kind !== 284 /* SourceFile */) {
+ while (container.kind !== 285 /* SourceFile */) {
if (container.parent === declaration) {
- if (container.kind === 154 /* PropertyDeclaration */ && ts.hasModifier(container, 32 /* Static */)) {
+ if (container.kind === 155 /* PropertyDeclaration */ && ts.hasModifier(container, 32 /* Static */)) {
getNodeLinks(declaration).flags |= 16777216 /* ClassWithConstructorReference */;
getNodeLinks(node).flags |= 33554432 /* ConstructorReferenceInClass */;
}
@@ -46816,7 +47640,7 @@
// The declaration container is the innermost function that encloses the declaration of the variable
// or parameter. The flow container is the innermost function starting with which we analyze the control
// flow graph to determine the control flow based type.
- var isParameter = ts.getRootDeclaration(declaration).kind === 151 /* Parameter */;
+ var isParameter = ts.getRootDeclaration(declaration).kind === 152 /* Parameter */;
var declarationContainer = getControlFlowContainer(declaration);
var flowContainer = getControlFlowContainer(node);
var isOuterVariable = flowContainer !== declarationContainer;
@@ -46825,19 +47649,19 @@
// When the control flow originates in a function expression or arrow function and we are referencing
// a const variable or parameter from an outer function, we extend the origin of the control flow
// analysis to include the immediately enclosing function.
- while (flowContainer !== declarationContainer && (flowContainer.kind === 196 /* FunctionExpression */ ||
- flowContainer.kind === 197 /* ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) &&
+ while (flowContainer !== declarationContainer && (flowContainer.kind === 197 /* FunctionExpression */ ||
+ flowContainer.kind === 198 /* ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) &&
(isConstVariable(localOrExportSymbol) || isParameter && !isParameterAssigned(localOrExportSymbol))) {
flowContainer = getControlFlowContainer(flowContainer);
}
// We only look for uninitialized variables in strict null checking mode, and only when we can analyze
// the entire control flow graph from the variable's declaration (i.e. when the flow container and
// declaration container are the same).
- var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports ||
+ var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || ts.isBindingElement(declaration) ||
type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 3 /* AnyOrUnknown */) !== 0 ||
- isInTypeQuery(node) || node.parent.kind === 257 /* ExportSpecifier */) ||
- node.parent.kind === 213 /* NonNullExpression */ ||
- declaration.kind === 237 /* VariableDeclaration */ && declaration.exclamationToken ||
+ isInTypeQuery(node) || node.parent.kind === 258 /* ExportSpecifier */) ||
+ node.parent.kind === 214 /* NonNullExpression */ ||
+ declaration.kind === 238 /* VariableDeclaration */ && declaration.exclamationToken ||
declaration.flags & 4194304 /* Ambient */;
var initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, declaration) : type) :
type === autoType || type === autoArrayType ? undefinedType :
@@ -46872,7 +47696,7 @@
if (languageVersion >= 2 /* ES2015 */ ||
(symbol.flags & (2 /* BlockScopedVariable */ | 32 /* Class */)) === 0 ||
ts.isSourceFile(symbol.valueDeclaration) ||
- symbol.valueDeclaration.parent.kind === 274 /* CatchClause */) {
+ symbol.valueDeclaration.parent.kind === 275 /* CatchClause */) {
return;
}
// 1. walk from the use site up to the declaration and check
@@ -46895,7 +47719,7 @@
// mark iteration statement as containing block-scoped binding captured in some function
var capturesBlockScopeBindingInLoopBody = true;
if (ts.isForStatement(container) &&
- ts.getAncestor(symbol.valueDeclaration, 238 /* VariableDeclarationList */).parent === container) {
+ ts.getAncestor(symbol.valueDeclaration, 239 /* VariableDeclarationList */).parent === container) {
var part = getPartOfForStatementContainingNode(node.parent, container);
if (part) {
var links = getNodeLinks(part);
@@ -46913,8 +47737,8 @@
}
// mark variables that are declared in loop initializer and reassigned inside the body of ForStatement.
// if body of ForStatement will be converted to function then we'll need a extra machinery to propagate reassigned values back.
- if (container.kind === 225 /* ForStatement */ &&
- ts.getAncestor(symbol.valueDeclaration, 238 /* VariableDeclarationList */).parent === container &&
+ if (container.kind === 226 /* ForStatement */ &&
+ ts.getAncestor(symbol.valueDeclaration, 239 /* VariableDeclarationList */).parent === container &&
isAssignedInBodyOfForStatement(node, container)) {
getNodeLinks(symbol.valueDeclaration).flags |= 4194304 /* NeedsLoopOutParameter */;
}
@@ -46932,7 +47756,7 @@
function isAssignedInBodyOfForStatement(node, container) {
// skip parenthesized nodes
var current = node;
- while (current.parent.kind === 195 /* ParenthesizedExpression */) {
+ while (current.parent.kind === 196 /* ParenthesizedExpression */) {
current = current.parent;
}
// check if node is used as LHS in some assignment expression
@@ -46940,7 +47764,7 @@
if (ts.isAssignmentTarget(current)) {
isAssigned = true;
}
- else if ((current.parent.kind === 202 /* PrefixUnaryExpression */ || current.parent.kind === 203 /* PostfixUnaryExpression */)) {
+ else if ((current.parent.kind === 203 /* PrefixUnaryExpression */ || current.parent.kind === 204 /* PostfixUnaryExpression */)) {
var expr = current.parent;
isAssigned = expr.operator === 44 /* PlusPlusToken */ || expr.operator === 45 /* MinusMinusToken */;
}
@@ -46953,7 +47777,7 @@
}
function captureLexicalThis(node, container) {
getNodeLinks(node).flags |= 2 /* LexicalThis */;
- if (container.kind === 154 /* PropertyDeclaration */ || container.kind === 157 /* Constructor */) {
+ if (container.kind === 155 /* PropertyDeclaration */ || container.kind === 158 /* Constructor */) {
var classNode = container.parent;
getNodeLinks(classNode).flags |= 4 /* CaptureThis */;
}
@@ -47021,37 +47845,37 @@
// tell whether 'this' needs to be captured.
var container = ts.getThisContainer(node, /* includeArrowFunctions */ true);
var capturedByArrowFunction = false;
- if (container.kind === 157 /* Constructor */) {
+ if (container.kind === 158 /* Constructor */) {
checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class);
}
// Now skip arrow functions to get the "real" owner of 'this'.
- if (container.kind === 197 /* ArrowFunction */) {
+ if (container.kind === 198 /* ArrowFunction */) {
container = ts.getThisContainer(container, /* includeArrowFunctions */ false);
capturedByArrowFunction = true;
}
switch (container.kind) {
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body);
// do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks
break;
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location);
// do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks
break;
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
if (isInConstructorArgumentInitializer(node, container)) {
error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments);
// do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks
}
break;
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
if (ts.hasModifier(container, 32 /* Static */)) {
error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer);
// do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks
}
break;
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name);
break;
}
@@ -47101,7 +47925,7 @@
// * /** @constructor */ function [name]() { ... }
// * /** @constructor */ var x = function() { ... }
else if (isInJS &&
- (container.kind === 196 /* FunctionExpression */ || container.kind === 239 /* FunctionDeclaration */) &&
+ (container.kind === 197 /* FunctionExpression */ || container.kind === 240 /* FunctionDeclaration */) &&
ts.getJSDocClassTag(container)) {
var classType = getJSClassType(getMergedSymbol(container.symbol));
if (classType) {
@@ -47137,7 +47961,7 @@
}
function getClassNameFromPrototypeMethod(container) {
// Check if it's the RHS of a x.prototype.y = function [name]() { .... }
- if (container.kind === 196 /* FunctionExpression */ &&
+ if (container.kind === 197 /* FunctionExpression */ &&
ts.isBinaryExpression(container.parent) &&
ts.getAssignmentDeclarationKind(container.parent) === 3 /* PrototypeProperty */) {
// Get the 'x' of 'x.prototype.y = container'
@@ -47147,16 +47971,16 @@
.expression; // x
}
// x.prototype = { method() { } }
- else if (container.kind === 156 /* MethodDeclaration */ &&
- container.parent.kind === 188 /* ObjectLiteralExpression */ &&
+ else if (container.kind === 157 /* MethodDeclaration */ &&
+ container.parent.kind === 189 /* ObjectLiteralExpression */ &&
ts.isBinaryExpression(container.parent.parent) &&
ts.getAssignmentDeclarationKind(container.parent.parent) === 6 /* Prototype */) {
return container.parent.parent.left.expression;
}
// x.prototype = { method: function() { } }
- else if (container.kind === 196 /* FunctionExpression */ &&
- container.parent.kind === 275 /* PropertyAssignment */ &&
- container.parent.parent.kind === 188 /* ObjectLiteralExpression */ &&
+ else if (container.kind === 197 /* FunctionExpression */ &&
+ container.parent.kind === 276 /* PropertyAssignment */ &&
+ container.parent.parent.kind === 189 /* ObjectLiteralExpression */ &&
ts.isBinaryExpression(container.parent.parent.parent) &&
ts.getAssignmentDeclarationKind(container.parent.parent.parent) === 6 /* Prototype */) {
return container.parent.parent.parent.left.expression;
@@ -47164,7 +47988,7 @@
// Object.defineProperty(x, "method", { value: function() { } });
// Object.defineProperty(x, "method", { set: (x: () => void) => void });
// Object.defineProperty(x, "method", { get: () => function() { }) });
- else if (container.kind === 196 /* FunctionExpression */ &&
+ else if (container.kind === 197 /* FunctionExpression */ &&
ts.isPropertyAssignment(container.parent) &&
ts.isIdentifier(container.parent.name) &&
(container.parent.name.escapedText === "value" || container.parent.name.escapedText === "get" || container.parent.name.escapedText === "set") &&
@@ -47189,7 +48013,7 @@
}
function getTypeForThisExpressionFromJSDoc(node) {
var jsdocType = ts.getJSDocType(node);
- if (jsdocType && jsdocType.kind === 294 /* JSDocFunctionType */) {
+ if (jsdocType && jsdocType.kind === 295 /* JSDocFunctionType */) {
var jsDocFunctionType = jsdocType;
if (jsDocFunctionType.parameters.length > 0 &&
jsDocFunctionType.parameters[0].name &&
@@ -47203,15 +48027,15 @@
}
}
function isInConstructorArgumentInitializer(node, constructorDecl) {
- return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 151 /* Parameter */ && n.parent === constructorDecl; });
+ return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 152 /* Parameter */ && n.parent === constructorDecl; });
}
function checkSuperExpression(node) {
- var isCallExpression = node.parent.kind === 191 /* CallExpression */ && node.parent.expression === node;
+ var isCallExpression = node.parent.kind === 192 /* CallExpression */ && node.parent.expression === node;
var container = ts.getSuperContainer(node, /*stopOnFunctions*/ true);
var needToCaptureLexicalThis = false;
// adjust the container reference in case if super is used inside arrow functions with arbitrarily deep nesting
if (!isCallExpression) {
- while (container && container.kind === 197 /* ArrowFunction */) {
+ while (container && container.kind === 198 /* ArrowFunction */) {
container = ts.getSuperContainer(container, /*stopOnFunctions*/ true);
needToCaptureLexicalThis = languageVersion < 2 /* ES2015 */;
}
@@ -47224,14 +48048,14 @@
// class B {
// [super.foo()]() {}
// }
- var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 149 /* ComputedPropertyName */; });
- if (current && current.kind === 149 /* ComputedPropertyName */) {
+ var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 150 /* ComputedPropertyName */; });
+ if (current && current.kind === 150 /* ComputedPropertyName */) {
error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name);
}
else if (isCallExpression) {
error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors);
}
- else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 188 /* ObjectLiteralExpression */)) {
+ else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 189 /* ObjectLiteralExpression */)) {
error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions);
}
else {
@@ -47239,7 +48063,7 @@
}
return errorType;
}
- if (!isCallExpression && container.kind === 157 /* Constructor */) {
+ if (!isCallExpression && container.kind === 158 /* Constructor */) {
checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class);
}
if (ts.hasModifier(container, 32 /* Static */) || isCallExpression) {
@@ -47308,7 +48132,7 @@
// as a call expression cannot be used as the target of a destructuring assignment while a property access can.
//
// For element access expressions (`super[x]`), we emit a generic helper that forwards the element access in both situations.
- if (container.kind === 156 /* MethodDeclaration */ && ts.hasModifier(container, 256 /* Async */)) {
+ if (container.kind === 157 /* MethodDeclaration */ && ts.hasModifier(container, 256 /* Async */)) {
if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) {
getNodeLinks(container).flags |= 4096 /* AsyncMethodWithSuperBinding */;
}
@@ -47322,7 +48146,7 @@
// in this case they should also use correct lexical this
captureLexicalThis(node.parent, container);
}
- if (container.parent.kind === 188 /* ObjectLiteralExpression */) {
+ if (container.parent.kind === 189 /* ObjectLiteralExpression */) {
if (languageVersion < 2 /* ES2015 */) {
error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher);
return errorType;
@@ -47343,7 +48167,7 @@
if (!baseClassType) {
return errorType;
}
- if (container.kind === 157 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) {
+ if (container.kind === 158 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) {
// issue custom error message for super property access in constructor arguments (to be aligned with old compiler)
error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments);
return errorType;
@@ -47358,7 +48182,7 @@
if (isCallExpression) {
// TS 1.0 SPEC (April 2014): 4.8.1
// Super calls are only permitted in constructors of derived classes
- return container.kind === 157 /* Constructor */;
+ return container.kind === 158 /* Constructor */;
}
else {
// TS 1.0 SPEC (April 2014)
@@ -47366,21 +48190,21 @@
// - In a constructor, instance member function, instance member accessor, or instance member variable initializer where this references a derived class instance
// - In a static member function or static member accessor
// topmost container must be something that is directly nested in the class declaration\object literal expression
- if (ts.isClassLike(container.parent) || container.parent.kind === 188 /* ObjectLiteralExpression */) {
+ if (ts.isClassLike(container.parent) || container.parent.kind === 189 /* ObjectLiteralExpression */) {
if (ts.hasModifier(container, 32 /* Static */)) {
- return container.kind === 156 /* MethodDeclaration */ ||
- container.kind === 155 /* MethodSignature */ ||
- container.kind === 158 /* GetAccessor */ ||
- container.kind === 159 /* SetAccessor */;
+ return container.kind === 157 /* MethodDeclaration */ ||
+ container.kind === 156 /* MethodSignature */ ||
+ container.kind === 159 /* GetAccessor */ ||
+ container.kind === 160 /* SetAccessor */;
}
else {
- return container.kind === 156 /* MethodDeclaration */ ||
- container.kind === 155 /* MethodSignature */ ||
- container.kind === 158 /* GetAccessor */ ||
- container.kind === 159 /* SetAccessor */ ||
- container.kind === 154 /* PropertyDeclaration */ ||
- container.kind === 153 /* PropertySignature */ ||
- container.kind === 157 /* Constructor */;
+ return container.kind === 157 /* MethodDeclaration */ ||
+ container.kind === 156 /* MethodSignature */ ||
+ container.kind === 159 /* GetAccessor */ ||
+ container.kind === 160 /* SetAccessor */ ||
+ container.kind === 155 /* PropertyDeclaration */ ||
+ container.kind === 154 /* PropertySignature */ ||
+ container.kind === 158 /* Constructor */;
}
}
}
@@ -47388,10 +48212,10 @@
}
}
function getContainingObjectLiteral(func) {
- return (func.kind === 156 /* MethodDeclaration */ ||
- func.kind === 158 /* GetAccessor */ ||
- func.kind === 159 /* SetAccessor */) && func.parent.kind === 188 /* ObjectLiteralExpression */ ? func.parent :
- func.kind === 196 /* FunctionExpression */ && func.parent.kind === 275 /* PropertyAssignment */ ? func.parent.parent :
+ return (func.kind === 157 /* MethodDeclaration */ ||
+ func.kind === 159 /* GetAccessor */ ||
+ func.kind === 160 /* SetAccessor */) && func.parent.kind === 189 /* ObjectLiteralExpression */ ? func.parent :
+ func.kind === 197 /* FunctionExpression */ && func.parent.kind === 276 /* PropertyAssignment */ ? func.parent.parent :
undefined;
}
function getThisTypeArgument(type) {
@@ -47403,7 +48227,7 @@
});
}
function getContextualThisParameterType(func) {
- if (func.kind === 197 /* ArrowFunction */) {
+ if (func.kind === 198 /* ArrowFunction */) {
return undefined;
}
if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) {
@@ -47430,7 +48254,7 @@
if (thisType) {
return instantiateType(thisType, getMapperFromContext(getInferenceContext(containingLiteral)));
}
- if (literal.parent.kind !== 275 /* PropertyAssignment */) {
+ if (literal.parent.kind !== 276 /* PropertyAssignment */) {
break;
}
literal = literal.parent.parent;
@@ -47444,9 +48268,9 @@
// In an assignment of the form 'obj.xxx = function(...)' or 'obj[xxx] = function(...)', the
// contextual type for 'this' is 'obj'.
var parent = func.parent;
- if (parent.kind === 204 /* BinaryExpression */ && parent.operatorToken.kind === 59 /* EqualsToken */) {
+ if (parent.kind === 205 /* BinaryExpression */ && parent.operatorToken.kind === 60 /* EqualsToken */) {
var target = parent.left;
- if (target.kind === 189 /* PropertyAccessExpression */ || target.kind === 190 /* ElementAccessExpression */) {
+ if (target.kind === 190 /* PropertyAccessExpression */ || target.kind === 191 /* ElementAccessExpression */) {
var expression = target.expression;
// Don't contextually type `this` as `exports` in `exports.Point = function(x, y) { this.x = x; this.y = y; }`
if (inJs && ts.isIdentifier(expression)) {
@@ -47497,9 +48321,9 @@
return getTypeFromTypeNode(typeNode);
}
switch (declaration.kind) {
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return getContextuallyTypedParameterType(declaration);
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return getContextualTypeForBindingElement(declaration);
// By default, do nothing and return undefined - only parameters and binding elements have context implied by a parent
}
@@ -47620,16 +48444,16 @@
return getTypeAtPosition(signature, argIndex);
}
function getContextualTypeForSubstitutionExpression(template, substitutionExpression) {
- if (template.parent.kind === 193 /* TaggedTemplateExpression */) {
+ if (template.parent.kind === 194 /* TaggedTemplateExpression */) {
return getContextualTypeForArgument(template.parent, substitutionExpression);
}
return undefined;
}
- function getContextualTypeForBinaryOperand(node) {
+ function getContextualTypeForBinaryOperand(node, contextFlags) {
var binaryExpression = node.parent;
var left = binaryExpression.left, operatorToken = binaryExpression.operatorToken, right = binaryExpression.right;
switch (operatorToken.kind) {
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
if (node !== right) {
return undefined;
}
@@ -47642,12 +48466,12 @@
// When an || expression has a contextual type, the operands are contextually typed by that type. When an ||
// expression has no contextual type, the right operand is contextually typed by the type of the left operand,
// except for the special case of Javascript declarations of the form `namespace.prop = namespace.prop || {}`
- var type = getContextualType(binaryExpression);
+ var type = getContextualType(binaryExpression, contextFlags);
return !type && node === right && !ts.isDefaultedExpandoInitializer(binaryExpression) ?
getTypeOfExpression(left) : type;
case 54 /* AmpersandAmpersandToken */:
case 27 /* CommaToken */:
- return node === right ? getContextualType(binaryExpression) : undefined;
+ return node === right ? getContextualType(binaryExpression, contextFlags) : undefined;
default:
return undefined;
}
@@ -47754,24 +48578,24 @@
// In an object literal contextually typed by a type T, the contextual type of a property assignment is the type of
// the matching property in T, if one exists. Otherwise, it is the type of the numeric index signature in T, if one
// exists. Otherwise, it is the type of the string index signature in T, if one exists.
- function getContextualTypeForObjectLiteralMethod(node) {
+ function getContextualTypeForObjectLiteralMethod(node, contextFlags) {
ts.Debug.assert(ts.isObjectLiteralMethod(node));
if (node.flags & 8388608 /* InWithStatement */) {
// We cannot answer semantic questions within a with block, do not proceed any further
return undefined;
}
- return getContextualTypeForObjectLiteralElement(node);
+ return getContextualTypeForObjectLiteralElement(node, contextFlags);
}
- function getContextualTypeForObjectLiteralElement(element) {
+ function getContextualTypeForObjectLiteralElement(element, contextFlags) {
var objectLiteral = element.parent;
- var type = getApparentTypeOfContextualType(objectLiteral);
+ var type = getApparentTypeOfContextualType(objectLiteral, contextFlags);
if (type) {
if (!hasNonBindableDynamicName(element)) {
// For a (non-symbol) computed property, there is no reason to look up the name
// in the type. It will just be "__computed", which does not appear in any
// SymbolTable.
- var symbolName_2 = getSymbolOfNode(element).escapedName;
- var propertyType = getTypeOfPropertyOfContextualType(type, symbolName_2);
+ var symbolName_3 = getSymbolOfNode(element).escapedName;
+ var propertyType = getTypeOfPropertyOfContextualType(type, symbolName_3);
if (propertyType) {
return propertyType;
}
@@ -47790,9 +48614,9 @@
|| getIteratedTypeOrElementType(arrayContextualType, /*errorNode*/ undefined, /*allowStringInput*/ false, /*allowAsyncIterables*/ false, /*checkAssignability*/ false));
}
// In a contextually typed conditional expression, the true/false expressions are contextually typed by the same type.
- function getContextualTypeForConditionalOperand(node) {
+ function getContextualTypeForConditionalOperand(node, contextFlags) {
var conditional = node.parent;
- return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional) : undefined;
+ return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional, contextFlags) : undefined;
}
function getContextualTypeForChildJsxExpression(node, child) {
var attributesType = getApparentTypeOfContextualType(node.openingElement.tagName);
@@ -47801,16 +48625,17 @@
if (!(attributesType && !isTypeAny(attributesType) && jsxChildrenPropertyName && jsxChildrenPropertyName !== "")) {
return undefined;
}
- var childIndex = node.children.indexOf(child);
+ var realChildren = getSemanticJsxChildren(node.children);
+ var childIndex = realChildren.indexOf(child);
var childFieldType = getTypeOfPropertyOfContextualType(attributesType, jsxChildrenPropertyName);
- return childFieldType && mapType(childFieldType, function (t) {
+ return childFieldType && (realChildren.length === 1 ? childFieldType : mapType(childFieldType, function (t) {
if (isArrayLikeType(t)) {
return getIndexedAccessType(t, getLiteralType(childIndex));
}
else {
return t;
}
- }, /*noReductions*/ true);
+ }, /*noReductions*/ true));
}
function getContextualTypeForJsxExpression(node) {
var exprParent = node.parent;
@@ -47844,30 +48669,30 @@
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
case 14 /* NoSubstitutionTemplateLiteral */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
- case 96 /* NullKeyword */:
- case 72 /* Identifier */:
- case 141 /* UndefinedKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
+ case 97 /* NullKeyword */:
+ case 73 /* Identifier */:
+ case 142 /* UndefinedKeyword */:
return true;
- case 189 /* PropertyAccessExpression */:
- case 195 /* ParenthesizedExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 196 /* ParenthesizedExpression */:
return isPossiblyDiscriminantValue(node.expression);
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return !node.expression || isPossiblyDiscriminantValue(node.expression);
}
return false;
}
function discriminateContextualTypeByObjectMembers(node, contextualType) {
- return discriminateTypeByDiscriminableItems(contextualType, ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 275 /* PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return checkExpression(prop.initializer); }, prop.symbol.escapedName]; }), isTypeAssignableTo, contextualType);
+ return discriminateTypeByDiscriminableItems(contextualType, ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 276 /* PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return checkExpression(prop.initializer); }, prop.symbol.escapedName]; }), isTypeAssignableTo, contextualType);
}
function discriminateContextualTypeByJSXAttributes(node, contextualType) {
- return discriminateTypeByDiscriminableItems(contextualType, ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 267 /* JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return checkExpression(prop.initializer); }), prop.symbol.escapedName]; }), isTypeAssignableTo, contextualType);
+ return discriminateTypeByDiscriminableItems(contextualType, ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 268 /* JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return checkExpression(prop.initializer); }), prop.symbol.escapedName]; }), isTypeAssignableTo, contextualType);
}
// Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily
// be "pushed" onto a node using the contextualType property.
- function getApparentTypeOfContextualType(node) {
- var contextualType = instantiateContextualType(getContextualType(node), node);
+ function getApparentTypeOfContextualType(node, contextFlags) {
+ var contextualType = instantiateContextualType(getContextualType(node, contextFlags), node, contextFlags);
if (contextualType) {
var apparentType = mapType(contextualType, getApparentType, /*noReductions*/ true);
if (apparentType.flags & 1048576 /* Union */) {
@@ -47883,13 +48708,24 @@
}
// If the given contextual type contains instantiable types and if a mapper representing
// return type inferences is available, instantiate those types using that mapper.
- function instantiateContextualType(contextualType, node) {
+ function instantiateContextualType(contextualType, node, contextFlags) {
if (contextualType && maybeTypeOfKind(contextualType, 63176704 /* Instantiable */)) {
var inferenceContext = getInferenceContext(node);
- if (inferenceContext && inferenceContext.returnMapper) {
+ // If no inferences have been made, nothing is gained from instantiating as type parameters
+ // would just be replaced with their defaults similar to the apparent type.
+ if (inferenceContext && ts.some(inferenceContext.inferences, hasInferenceCandidates)) {
+ // For contextual signatures we incorporate all inferences made so far, e.g. from return
+ // types as well as arguments to the left in a function call.
+ if (contextFlags && contextFlags & 1 /* Signature */) {
+ return instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper);
+ }
+ // For other purposes (e.g. determining whether to produce literal types) we only
+ // incorporate inferences made from the return type in a function call.
+ if (inferenceContext.returnMapper) {
return instantiateInstantiableTypes(contextualType, inferenceContext.returnMapper);
}
}
+ }
return contextualType;
}
// This function is similar to instantiateType, except that (a) it only instantiates types that
@@ -47924,7 +48760,7 @@
* @param node the expression whose contextual type will be returned.
* @returns the contextual type of an expression.
*/
- function getContextualType(node) {
+ function getContextualType(node, contextFlags) {
if (node.flags & 8388608 /* InWithStatement */) {
// We cannot answer semantic questions within a with block, do not proceed any further
return undefined;
@@ -47934,54 +48770,54 @@
}
var parent = node.parent;
switch (parent.kind) {
- case 237 /* VariableDeclaration */:
- case 151 /* Parameter */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 186 /* BindingElement */:
+ case 238 /* VariableDeclaration */:
+ case 152 /* Parameter */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 187 /* BindingElement */:
return getContextualTypeForInitializerExpression(node);
- case 197 /* ArrowFunction */:
- case 230 /* ReturnStatement */:
+ case 198 /* ArrowFunction */:
+ case 231 /* ReturnStatement */:
return getContextualTypeForReturnExpression(node);
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return getContextualTypeForYieldOperand(parent);
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
return getContextualTypeForAwaitOperand(parent);
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
return getContextualTypeForArgument(parent, node);
- case 194 /* TypeAssertionExpression */:
- case 212 /* AsExpression */:
+ case 195 /* TypeAssertionExpression */:
+ case 213 /* AsExpression */:
return ts.isConstTypeReference(parent.type) ? undefined : getTypeFromTypeNode(parent.type);
- case 204 /* BinaryExpression */:
- return getContextualTypeForBinaryOperand(node);
- case 275 /* PropertyAssignment */:
- case 276 /* ShorthandPropertyAssignment */:
- return getContextualTypeForObjectLiteralElement(parent);
- case 277 /* SpreadAssignment */:
- return getApparentTypeOfContextualType(parent.parent);
- case 187 /* ArrayLiteralExpression */: {
+ case 205 /* BinaryExpression */:
+ return getContextualTypeForBinaryOperand(node, contextFlags);
+ case 276 /* PropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
+ return getContextualTypeForObjectLiteralElement(parent, contextFlags);
+ case 278 /* SpreadAssignment */:
+ return getApparentTypeOfContextualType(parent.parent, contextFlags);
+ case 188 /* ArrayLiteralExpression */: {
var arrayLiteral = parent;
- var type = getApparentTypeOfContextualType(arrayLiteral);
+ var type = getApparentTypeOfContextualType(arrayLiteral, contextFlags);
return getContextualTypeForElementExpression(type, ts.indexOfNode(arrayLiteral.elements, node));
}
- case 205 /* ConditionalExpression */:
- return getContextualTypeForConditionalOperand(node);
- case 216 /* TemplateSpan */:
- ts.Debug.assert(parent.parent.kind === 206 /* TemplateExpression */);
+ case 206 /* ConditionalExpression */:
+ return getContextualTypeForConditionalOperand(node, contextFlags);
+ case 217 /* TemplateSpan */:
+ ts.Debug.assert(parent.parent.kind === 207 /* TemplateExpression */);
return getContextualTypeForSubstitutionExpression(parent.parent, node);
- case 195 /* ParenthesizedExpression */: {
+ case 196 /* ParenthesizedExpression */: {
// Like in `checkParenthesizedExpression`, an `/** @type {xyz} */` comment before a parenthesized expression acts as a type cast.
var tag = ts.isInJSFile(parent) ? ts.getJSDocTypeTag(parent) : undefined;
- return tag ? getTypeFromTypeNode(tag.typeExpression.type) : getContextualType(parent);
+ return tag ? getTypeFromTypeNode(tag.typeExpression.type) : getContextualType(parent, contextFlags);
}
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return getContextualTypeForJsxExpression(parent);
- case 267 /* JsxAttribute */:
- case 269 /* JsxSpreadAttribute */:
+ case 268 /* JsxAttribute */:
+ case 270 /* JsxSpreadAttribute */:
return getContextualTypeForJsxAttribute(parent);
- case 262 /* JsxOpeningElement */:
- case 261 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
+ case 262 /* JsxSelfClosingElement */:
return getContextualJsxElementAttributesType(parent);
}
return undefined;
@@ -48003,7 +48839,7 @@
return getJsxReferenceKind(node) !== 0 /* Component */ ? getJsxPropsTypeFromCallSignature(signature, node) : getJsxPropsTypeFromClassType(signature, node);
}
function getJsxPropsTypeFromCallSignature(sig, context) {
- var propsType = getTypeOfFirstParameterOfSignatureWithFallback(sig, emptyObjectType);
+ var propsType = getTypeOfFirstParameterOfSignatureWithFallback(sig, unknownType);
propsType = getJsxManagedAttributesFromLocatedAttributes(context, getJsxNamespaceAt(context), propsType);
var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context);
if (intrinsicAttribs !== errorType) {
@@ -48074,7 +48910,7 @@
var forcedLookupLocation = getJsxElementPropertiesName(ns);
var attributesType = forcedLookupLocation === undefined
// If there is no type ElementAttributesProperty, return the type of the first parameter of the signature, which should be the props type
- ? getTypeOfFirstParameterOfSignatureWithFallback(sig, emptyObjectType)
+ ? getTypeOfFirstParameterOfSignatureWithFallback(sig, unknownType)
: forcedLookupLocation === ""
// If there is no e.g. 'props' member in ElementAttributesProperty, use the element class type instead
? getReturnTypeOfSignature(sig)
@@ -48085,7 +48921,7 @@
if (!!forcedLookupLocation && !!ts.length(context.attributes.properties)) {
error(context, ts.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, ts.unescapeLeadingUnderscores(forcedLookupLocation));
}
- return emptyObjectType;
+ return unknownType;
}
attributesType = getJsxManagedAttributesFromLocatedAttributes(context, ns, attributesType);
if (isTypeAny(attributesType)) {
@@ -48136,7 +48972,7 @@
return !hasEffectiveRestParameter(signature) && getParameterCount(signature) < targetParameterCount;
}
function isFunctionExpressionOrArrowFunction(node) {
- return node.kind === 196 /* FunctionExpression */ || node.kind === 197 /* ArrowFunction */;
+ return node.kind === 197 /* FunctionExpression */ || node.kind === 198 /* ArrowFunction */;
}
function getContextualSignatureForFunctionLikeDeclaration(node) {
// Only function expressions, arrow functions, and object literal methods are contextually typed.
@@ -48144,23 +48980,20 @@
? getContextualSignature(node)
: undefined;
}
- function getContextualTypeForFunctionLikeDeclaration(node) {
- return ts.isObjectLiteralMethod(node) ?
- getContextualTypeForObjectLiteralMethod(node) :
- getApparentTypeOfContextualType(node);
- }
// Return the contextual signature for a given expression node. A contextual type provides a
// contextual signature if it has a single call signature and if that call signature is non-generic.
// If the contextual type is a union type, get the signature from each type possible and if they are
// all identical ignoring their return type, the result is same signature but with return type as
// union type of return types from these signatures
function getContextualSignature(node) {
- ts.Debug.assert(node.kind !== 156 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
+ ts.Debug.assert(node.kind !== 157 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
var typeTagSignature = getSignatureOfTypeTag(node);
if (typeTagSignature) {
return typeTagSignature;
}
- var type = getContextualTypeForFunctionLikeDeclaration(node);
+ var type = ts.isObjectLiteralMethod(node) ?
+ getContextualTypeForObjectLiteralMethod(node, 1 /* Signature */) :
+ getApparentTypeOfContextualType(node, 1 /* Signature */);
if (!type) {
return undefined;
}
@@ -48169,8 +49002,8 @@
}
var signatureList;
var types = type.types;
- for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
- var current = types_15[_i];
+ for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
+ var current = types_14[_i];
var signature = getContextualCallSignature(current, node);
if (signature) {
if (!signatureList) {
@@ -48198,8 +49031,8 @@
return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false, /*allowAsyncIterables*/ false);
}
function hasDefaultValue(node) {
- return (node.kind === 186 /* BindingElement */ && !!node.initializer) ||
- (node.kind === 204 /* BinaryExpression */ && node.operatorToken.kind === 59 /* EqualsToken */);
+ return (node.kind === 187 /* BindingElement */ && !!node.initializer) ||
+ (node.kind === 205 /* BinaryExpression */ && node.operatorToken.kind === 60 /* EqualsToken */);
}
function checkArrayLiteral(node, checkMode, forceTuple) {
var elements = node.elements;
@@ -48211,7 +49044,7 @@
var inConstContext = isConstContext(node);
for (var index = 0; index < elementCount; index++) {
var e = elements[index];
- if (inDestructuringPattern && e.kind === 208 /* SpreadElement */) {
+ if (inDestructuringPattern && e.kind === 209 /* SpreadElement */) {
// Given the following situation:
// var c: {};
// [...c] = ["", 0];
@@ -48236,12 +49069,12 @@
var type = checkExpressionForMutableLocation(e, checkMode, elementContextualType, forceTuple);
elementTypes.push(type);
}
- if (index < elementCount - 1 && e.kind === 208 /* SpreadElement */) {
+ if (index < elementCount - 1 && e.kind === 209 /* SpreadElement */) {
hasNonEndingSpreadElement = true;
}
}
if (!hasNonEndingSpreadElement) {
- var hasRestElement = elementCount > 0 && elements[elementCount - 1].kind === 208 /* SpreadElement */;
+ var hasRestElement = elementCount > 0 && elements[elementCount - 1].kind === 209 /* SpreadElement */;
var minLength = elementCount - (hasRestElement ? 1 : 0);
// If array literal is actually a destructuring pattern, mark it as an implied type. We do this such
// that we get the same behavior for "var [x, y] = []" and "[x, y] = []".
@@ -48271,15 +49104,15 @@
var pattern = contextualType && contextualType.pattern;
// If array literal is contextually typed by a binding pattern or an assignment pattern, pad the resulting
// tuple type with the corresponding binding or assignment element types to make the lengths equal.
- if (!hasRestElement && pattern && (pattern.kind === 185 /* ArrayBindingPattern */ || pattern.kind === 187 /* ArrayLiteralExpression */)) {
+ if (!hasRestElement && pattern && (pattern.kind === 186 /* ArrayBindingPattern */ || pattern.kind === 188 /* ArrayLiteralExpression */)) {
var patternElements = pattern.elements;
for (var i = elementCount; i < patternElements.length; i++) {
var e = patternElements[i];
if (hasDefaultValue(e)) {
elementTypes.push(contextualType.typeArguments[i]);
}
- else if (i < patternElements.length - 1 || !(e.kind === 186 /* BindingElement */ && e.dotDotDotToken || e.kind === 208 /* SpreadElement */)) {
- if (e.kind !== 210 /* OmittedExpression */) {
+ else if (i < patternElements.length - 1 || !(e.kind === 187 /* BindingElement */ && e.dotDotDotToken || e.kind === 209 /* SpreadElement */)) {
+ if (e.kind !== 211 /* OmittedExpression */) {
error(e, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value);
}
elementTypes.push(strictNullChecks ? implicitNeverType : undefinedWideningType);
@@ -48291,9 +49124,9 @@
}
function isNumericName(name) {
switch (name.kind) {
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
return isNumericComputedName(name);
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return isNumericLiteralName(name.escapedText);
case 8 /* NumericLiteral */:
case 10 /* StringLiteral */:
@@ -48381,7 +49214,7 @@
var spread = emptyObjectType;
var contextualType = getApparentTypeOfContextualType(node);
var contextualTypeHasPattern = contextualType && contextualType.pattern &&
- (contextualType.pattern.kind === 184 /* ObjectBindingPattern */ || contextualType.pattern.kind === 188 /* ObjectLiteralExpression */);
+ (contextualType.pattern.kind === 185 /* ObjectBindingPattern */ || contextualType.pattern.kind === 189 /* ObjectLiteralExpression */);
var inConstContext = isConstContext(node);
var checkFlags = inConstContext ? 8 /* Readonly */ : 0;
var isInJavascript = ts.isInJSFile(node) && !ts.isInJsonFile(node);
@@ -48396,13 +49229,13 @@
for (var i = 0; i < node.properties.length; i++) {
var memberDecl = node.properties[i];
var member = getSymbolOfNode(memberDecl);
- var computedNameType = memberDecl.name && memberDecl.name.kind === 149 /* ComputedPropertyName */ && !ts.isWellKnownSymbolSyntactically(memberDecl.name.expression) ?
+ var computedNameType = memberDecl.name && memberDecl.name.kind === 150 /* ComputedPropertyName */ && !ts.isWellKnownSymbolSyntactically(memberDecl.name.expression) ?
checkComputedPropertyName(memberDecl.name) : undefined;
- if (memberDecl.kind === 275 /* PropertyAssignment */ ||
- memberDecl.kind === 276 /* ShorthandPropertyAssignment */ ||
+ if (memberDecl.kind === 276 /* PropertyAssignment */ ||
+ memberDecl.kind === 277 /* ShorthandPropertyAssignment */ ||
ts.isObjectLiteralMethod(memberDecl)) {
- var type = memberDecl.kind === 275 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) :
- memberDecl.kind === 276 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(memberDecl.name, checkMode) :
+ var type = memberDecl.kind === 276 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) :
+ memberDecl.kind === 277 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(memberDecl.name, checkMode) :
checkObjectLiteralMethod(memberDecl, checkMode);
if (isInJavascript) {
var jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl);
@@ -48417,7 +49250,7 @@
objectFlags |= ts.getObjectFlags(type) & 917504 /* PropagatingFlags */;
var nameType = computedNameType && isTypeUsableAsPropertyName(computedNameType) ? computedNameType : undefined;
var prop = nameType ?
- createSymbol(4 /* Property */ | member.flags, getPropertyNameFromType(nameType), checkFlags | 2048 /* Late */) :
+ createSymbol(4 /* Property */ | member.flags, getPropertyNameFromType(nameType), checkFlags | 4096 /* Late */) :
createSymbol(4 /* Property */ | member.flags, member.escapedName, checkFlags);
if (nameType) {
prop.nameType = nameType;
@@ -48425,8 +49258,8 @@
if (inDestructuringPattern) {
// If object literal is an assignment pattern and if the assignment pattern specifies a default value
// for the property, make the property optional.
- var isOptional = (memberDecl.kind === 275 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) ||
- (memberDecl.kind === 276 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer);
+ var isOptional = (memberDecl.kind === 276 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) ||
+ (memberDecl.kind === 277 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer);
if (isOptional) {
prop.flags |= 16777216 /* Optional */;
}
@@ -48451,7 +49284,7 @@
prop.target = member;
member = prop;
}
- else if (memberDecl.kind === 277 /* SpreadAssignment */) {
+ else if (memberDecl.kind === 278 /* SpreadAssignment */) {
if (languageVersion < 2 /* ES2015 */) {
checkExternalEmitHelpers(memberDecl, 2 /* Assign */);
}
@@ -48477,7 +49310,7 @@
// an ordinary function declaration(section 6.1) with no parameters.
// A set accessor declaration is processed in the same manner
// as an ordinary function declaration with a single parameter and a Void return type.
- ts.Debug.assert(memberDecl.kind === 158 /* GetAccessor */ || memberDecl.kind === 159 /* SetAccessor */);
+ ts.Debug.assert(memberDecl.kind === 159 /* GetAccessor */ || memberDecl.kind === 160 /* SetAccessor */);
checkNodeDeferred(memberDecl);
}
if (computedNameType && !(computedNameType.flags & 8576 /* StringOrNumberLiteralOrUnique */)) {
@@ -48585,7 +49418,7 @@
* Returns true iff React would emit this tag name as a string rather than an identifier or qualified name
*/
function isJsxIntrinsicIdentifier(tagName) {
- return tagName.kind === 72 /* Identifier */ && ts.isIntrinsicJsxName(tagName.escapedText);
+ return tagName.kind === 73 /* Identifier */ && ts.isIntrinsicJsxName(tagName.escapedText);
}
function checkJsxAttribute(node, checkMode) {
return node.initializer
@@ -48630,7 +49463,7 @@
}
}
else {
- ts.Debug.assert(attributeDecl.kind === 269 /* JsxSpreadAttribute */);
+ ts.Debug.assert(attributeDecl.kind === 270 /* JsxSpreadAttribute */);
if (attributesTable.size > 0) {
spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, objectFlags, /*readonly*/ false);
attributesTable = ts.createSymbolTable();
@@ -48653,7 +49486,7 @@
}
}
// Handle children attribute
- var parent = openingLikeElement.parent.kind === 260 /* JsxElement */ ? openingLikeElement.parent : undefined;
+ var parent = openingLikeElement.parent.kind === 261 /* JsxElement */ ? openingLikeElement.parent : undefined;
// We have to check that openingElement of the parent is the one we are visiting as this may not be true for selfClosingElement
if (parent && parent.openingElement === openingLikeElement && parent.children.length > 0) {
var childrenTypes = checkJsxChildren(parent, checkMode);
@@ -49071,8 +49904,8 @@
*/
function checkPropertyAccessibility(node, isSuper, type, prop) {
var flags = ts.getDeclarationModifierFlagsFromSymbol(prop);
- var errorNode = node.kind === 148 /* QualifiedName */ ? node.right : node.kind === 183 /* ImportType */ ? node : node.name;
- if (ts.getCheckFlags(prop) & 512 /* ContainsPrivate */) {
+ var errorNode = node.kind === 149 /* QualifiedName */ ? node.right : node.kind === 184 /* ImportType */ ? node : node.name;
+ if (ts.getCheckFlags(prop) & 1024 /* ContainsPrivate */) {
// Synthetic property with private constituent property
error(errorNode, ts.Diagnostics.Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1, symbolToString(prop), typeToString(type));
return false;
@@ -49177,7 +50010,7 @@
return type;
}
function checkNonNullType(type, node, nullDiagnostic, undefinedDiagnostic, nullOrUndefinedDiagnostic) {
- if (type.flags & 2 /* Unknown */) {
+ if (strictNullChecks && type.flags & 2 /* Unknown */) {
error(node, ts.Diagnostics.Object_is_of_type_unknown);
return errorType;
}
@@ -49192,6 +50025,13 @@
}
return type;
}
+ function checkNonNullNonVoidType(type, node) {
+ var nonNullType = checkNonNullType(type, node);
+ if (nonNullType !== errorType && nonNullType.flags & 16384 /* Void */) {
+ error(node, ts.Diagnostics.Object_is_possibly_undefined);
+ }
+ return nonNullType;
+ }
function checkPropertyAccessExpression(node) {
return checkPropertyAccessExpressionOrQualifiedName(node, node.expression, node.name);
}
@@ -49215,7 +50055,7 @@
markAliasReferenced(parentSymbol, node);
}
if (!prop) {
- var indexInfo = getIndexInfoOfType(apparentType, 0 /* String */);
+ var indexInfo = assignmentKind === 0 /* None */ || !isGenericObjectType(leftType) ? getIndexInfoOfType(apparentType, 0 /* String */) : undefined;
if (!(indexInfo && indexInfo.type)) {
if (isJSLiteralType(leftType)) {
return anyType;
@@ -49230,7 +50070,7 @@
return anyType;
}
if (right.escapedText && !checkAndReportErrorForExtendingInterface(node)) {
- reportNonexistentProperty(right, leftType.flags & 262144 /* TypeParameter */ && leftType.isThisType ? apparentType : leftType);
+ reportNonexistentProperty(right, isThisTypeParameter(leftType) ? apparentType : leftType);
}
return errorType;
}
@@ -49241,9 +50081,9 @@
}
else {
checkPropertyNotUsedBeforeDeclaration(prop, node, right);
- markPropertyAsReferenced(prop, node, left.kind === 100 /* ThisKeyword */);
+ markPropertyAsReferenced(prop, node, left.kind === 101 /* ThisKeyword */);
getNodeLinks(node).resolvedSymbol = prop;
- checkPropertyAccessibility(node, left.kind === 98 /* SuperKeyword */, apparentType, prop);
+ checkPropertyAccessibility(node, left.kind === 99 /* SuperKeyword */, apparentType, prop);
if (assignmentKind) {
if (isReferenceToReadonlyEntity(node, prop) || isReferenceThroughNamespaceImport(node)) {
error(right, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, ts.idText(right));
@@ -49255,7 +50095,7 @@
// Only compute control flow type if this is a property access expression that isn't an
// assignment target, and the referenced property was declared as a variable, property,
// accessor, or optional method.
- if (node.kind !== 189 /* PropertyAccessExpression */ ||
+ if (node.kind !== 190 /* PropertyAccessExpression */ ||
assignmentKind === 1 /* Definite */ ||
prop && !(prop.flags & (3 /* Variable */ | 4 /* Property */ | 98304 /* Accessor */)) && !(prop.flags & 8192 /* Method */ && propType.flags & 1048576 /* Union */)) {
return propType;
@@ -49265,11 +50105,11 @@
// and if we are in a constructor of the same class as the property declaration, assume that
// the property is uninitialized at the top of the control flow.
var assumeUninitialized = false;
- if (strictNullChecks && strictPropertyInitialization && left.kind === 100 /* ThisKeyword */) {
+ if (strictNullChecks && strictPropertyInitialization && left.kind === 101 /* ThisKeyword */) {
var declaration = prop && prop.valueDeclaration;
if (declaration && isInstancePropertyWithoutInitializer(declaration)) {
var flowContainer = getControlFlowContainer(node);
- if (flowContainer.kind === 157 /* Constructor */ && flowContainer.parent === declaration.parent) {
+ if (flowContainer.kind === 158 /* Constructor */ && flowContainer.parent === declaration.parent) {
assumeUninitialized = true;
}
}
@@ -49300,8 +50140,8 @@
&& !isPropertyDeclaredInAncestorClass(prop)) {
diagnosticMessage = error(right, ts.Diagnostics.Property_0_is_used_before_its_initialization, declarationName);
}
- else if (valueDeclaration.kind === 240 /* ClassDeclaration */ &&
- node.parent.kind !== 164 /* TypeReference */ &&
+ else if (valueDeclaration.kind === 241 /* ClassDeclaration */ &&
+ node.parent.kind !== 165 /* TypeReference */ &&
!(valueDeclaration.flags & 4194304 /* Ambient */) &&
!isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) {
diagnosticMessage = error(right, ts.Diagnostics.Class_0_used_before_its_declaration, declarationName);
@@ -49313,22 +50153,22 @@
function isInPropertyInitializer(node) {
return !!ts.findAncestor(node, function (node) {
switch (node.kind) {
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return true;
- case 275 /* PropertyAssignment */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 277 /* SpreadAssignment */:
- case 149 /* ComputedPropertyName */:
- case 216 /* TemplateSpan */:
- case 270 /* JsxExpression */:
- case 267 /* JsxAttribute */:
- case 268 /* JsxAttributes */:
- case 269 /* JsxSpreadAttribute */:
- case 262 /* JsxOpeningElement */:
- case 211 /* ExpressionWithTypeArguments */:
- case 273 /* HeritageClause */:
+ case 276 /* PropertyAssignment */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 278 /* SpreadAssignment */:
+ case 150 /* ComputedPropertyName */:
+ case 217 /* TemplateSpan */:
+ case 271 /* JsxExpression */:
+ case 268 /* JsxAttribute */:
+ case 269 /* JsxAttributes */:
+ case 270 /* JsxSpreadAttribute */:
+ case 263 /* JsxOpeningElement */:
+ case 212 /* ExpressionWithTypeArguments */:
+ case 274 /* HeritageClause */:
return false;
default:
return ts.isExpressionNode(node) ? false : "quit";
@@ -49434,6 +50274,32 @@
var suggestion = getSuggestedSymbolForNonexistentModule(name, targetModule);
return suggestion && ts.symbolName(suggestion);
}
+ function getSuggestionForNonexistentIndexSignature(objectType, expr) {
+ // check if object type has setter or getter
+ var hasProp = function (name, argCount) {
+ if (argCount === void 0) { argCount = 1; }
+ var prop = getPropertyOfObjectType(objectType, name);
+ if (prop) {
+ var s = getSingleCallSignature(getTypeOfSymbol(prop));
+ if (s && getMinArgumentCount(s) === argCount && typeToString(getTypeAtPosition(s, 0)) === "string") {
+ return true;
+ }
+ }
+ return false;
+ };
+ var suggestedMethod = ts.isAssignmentTarget(expr) ? "set" : "get";
+ if (!hasProp(suggestedMethod)) {
+ return undefined;
+ }
+ var suggestion = ts.tryGetPropertyAccessOrIdentifierToString(expr);
+ if (suggestion === undefined) {
+ suggestion = suggestedMethod;
+ }
+ else {
+ suggestion += "." + suggestedMethod;
+ }
+ return suggestion;
+ }
/**
* Given a name and a list of symbols whose names are *not* equal to the name, return a spelling suggestion if there is one that is close enough.
* Names less than length 3 only check for case-insensitive equality, not levenshtein distance.
@@ -49474,34 +50340,17 @@
}
function isValidPropertyAccess(node, propertyName) {
switch (node.kind) {
- case 189 /* PropertyAccessExpression */:
- return isValidPropertyAccessWithType(node, node.expression.kind === 98 /* SuperKeyword */, propertyName, getWidenedType(checkExpression(node.expression)));
- case 148 /* QualifiedName */:
+ case 190 /* PropertyAccessExpression */:
+ return isValidPropertyAccessWithType(node, node.expression.kind === 99 /* SuperKeyword */, propertyName, getWidenedType(checkExpression(node.expression)));
+ case 149 /* QualifiedName */:
return isValidPropertyAccessWithType(node, /*isSuper*/ false, propertyName, getWidenedType(checkExpression(node.left)));
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return isValidPropertyAccessWithType(node, /*isSuper*/ false, propertyName, getTypeFromTypeNode(node));
}
}
function isValidPropertyAccessForCompletions(node, type, property) {
- return isValidPropertyAccessWithType(node, node.kind === 189 /* PropertyAccessExpression */ && node.expression.kind === 98 /* SuperKeyword */, property.escapedName, type)
- && (!(property.flags & 8192 /* Method */) || isValidMethodAccess(property, type));
- }
- function isValidMethodAccess(method, actualThisType) {
- var propType = getTypeOfPropertyOfType(actualThisType, method.escapedName);
- var signatures = getSignaturesOfType(getNonNullableType(propType), 0 /* Call */);
- ts.Debug.assert(signatures.length !== 0);
- return signatures.some(function (sig) {
- var signatureThisType = getThisTypeOfSignature(sig);
- return !signatureThisType || isTypeAssignableTo(actualThisType, getInstantiatedSignatureThisType(sig, signatureThisType, actualThisType));
- });
- }
- function getInstantiatedSignatureThisType(sig, signatureThisType, actualThisType) {
- if (!sig.typeParameters) {
- return signatureThisType;
- }
- var context = createInferenceContext(sig.typeParameters, sig, 0 /* None */);
- inferTypes(context.inferences, actualThisType, signatureThisType);
- return instantiateType(signatureThisType, createSignatureTypeMapper(sig, getInferredTypes(context)));
+ return isValidPropertyAccessWithType(node, node.kind === 190 /* PropertyAccessExpression */ && node.expression.kind === 99 /* SuperKeyword */, property.escapedName, type);
+ // Previously we validated the 'this' type of methods but this adversely affected performance. See #31377 for more context.
}
function isValidPropertyAccessWithType(node, isSuper, propertyName, type) {
if (type === errorType || isTypeAny(type)) {
@@ -49517,13 +50366,13 @@
*/
function getForInVariableSymbol(node) {
var initializer = node.initializer;
- if (initializer.kind === 238 /* VariableDeclarationList */) {
+ if (initializer.kind === 239 /* VariableDeclarationList */) {
var variable = initializer.declarations[0];
if (variable && !ts.isBindingPattern(variable.name)) {
return getSymbolOfNode(variable);
}
}
- else if (initializer.kind === 72 /* Identifier */) {
+ else if (initializer.kind === 73 /* Identifier */) {
return getResolvedSymbol(initializer);
}
return undefined;
@@ -49540,13 +50389,13 @@
*/
function isForInVariableForNumericPropertyNames(expr) {
var e = ts.skipParentheses(expr);
- if (e.kind === 72 /* Identifier */) {
+ if (e.kind === 73 /* Identifier */) {
var symbol = getResolvedSymbol(e);
if (symbol.flags & 3 /* Variable */) {
var child = expr;
var node = expr.parent;
while (node) {
- if (node.kind === 226 /* ForInStatement */ &&
+ if (node.kind === 227 /* ForInStatement */ &&
child === node.statement &&
getForInVariableSymbol(node) === symbol &&
hasNumericPropertyNames(getTypeOfExpression(node.expression))) {
@@ -49564,7 +50413,7 @@
var indexExpression = node.argumentExpression;
if (!indexExpression) {
var sourceFile = ts.getSourceFileOfNode(node);
- if (node.parent.kind === 192 /* NewExpression */ && node.parent.expression === node) {
+ if (node.parent.kind === 193 /* NewExpression */ && node.parent.expression === node) {
var start = ts.skipTrivia(sourceFile.text, node.expression.end);
var end = node.end;
grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead);
@@ -49584,7 +50433,12 @@
error(indexExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal);
return errorType;
}
- return checkIndexedAccessIndexType(getIndexedAccessType(objectType, isForInVariableForNumericPropertyNames(indexExpression) ? numberType : indexType, node), node);
+ var effectiveIndexType = isForInVariableForNumericPropertyNames(indexExpression) ? numberType : indexType;
+ var accessFlags = ts.isAssignmentTarget(node) ?
+ 2 /* Writing */ | (isGenericObjectType(objectType) && !isThisTypeParameter(objectType) ? 1 /* NoIndexSignatures */ : 0) :
+ 0 /* None */;
+ var indexedAccessType = getIndexedAccessTypeOrUndefined(objectType, effectiveIndexType, node, accessFlags) || errorType;
+ return checkIndexedAccessIndexType(indexedAccessType, node);
}
function checkThatExpressionIsProperSymbolReference(expression, expressionType, reportError) {
if (expressionType === errorType) {
@@ -49630,13 +50484,13 @@
// This gets us diagnostics for the type arguments and marks them as referenced.
ts.forEach(node.typeArguments, checkSourceElement);
}
- if (node.kind === 193 /* TaggedTemplateExpression */) {
+ if (node.kind === 194 /* TaggedTemplateExpression */) {
checkExpression(node.template);
}
else if (ts.isJsxOpeningLikeElement(node)) {
checkExpression(node.attributes);
}
- else if (node.kind !== 152 /* Decorator */) {
+ else if (node.kind !== 153 /* Decorator */) {
ts.forEach(node.arguments, function (argument) {
checkExpression(argument);
});
@@ -49700,7 +50554,7 @@
}
}
function isSpreadArgument(arg) {
- return !!arg && (arg.kind === 208 /* SpreadElement */ || arg.kind === 215 /* SyntheticExpression */ && arg.isSpread);
+ return !!arg && (arg.kind === 209 /* SpreadElement */ || arg.kind === 216 /* SyntheticExpression */ && arg.isSpread);
}
function getSpreadArgumentIndex(args) {
return ts.findIndex(args, isSpreadArgument);
@@ -49714,9 +50568,9 @@
var callIsIncomplete = false; // In incomplete call we want to be lenient when we have too few arguments
var effectiveParameterCount = getParameterCount(signature);
var effectiveMinimumArguments = getMinArgumentCount(signature);
- if (node.kind === 193 /* TaggedTemplateExpression */) {
+ if (node.kind === 194 /* TaggedTemplateExpression */) {
argCount = args.length;
- if (node.template.kind === 206 /* TemplateExpression */) {
+ if (node.template.kind === 207 /* TemplateExpression */) {
// If a tagged template expression lacks a tail literal, the call is incomplete.
// Specifically, a template only can end in a TemplateTail or a Missing literal.
var lastSpan = ts.last(node.template.templateSpans); // we should always have at least one span.
@@ -49731,7 +50585,7 @@
callIsIncomplete = !!templateLiteral.isUnterminated;
}
}
- else if (node.kind === 152 /* Decorator */) {
+ else if (node.kind === 153 /* Decorator */) {
argCount = getDecoratorArgumentCount(node, signature);
}
else if (ts.isJsxOpeningLikeElement(node)) {
@@ -49746,7 +50600,7 @@
else {
if (!node.arguments) {
// This only happens when we have something of the form: 'new C'
- ts.Debug.assert(node.kind === 192 /* NewExpression */);
+ ts.Debug.assert(node.kind === 193 /* NewExpression */);
return getMinArgumentCount(signature) === 0;
}
argCount = signatureHelpTrailingComma ? args.length + 1 : args.length;
@@ -49785,12 +50639,23 @@
}
// If type has a single call signature and no other members, return that signature. Otherwise, return undefined.
function getSingleCallSignature(type) {
+ return getSingleSignature(type, 0 /* Call */, /*allowMembers*/ false);
+ }
+ function getSingleCallOrConstructSignature(type) {
+ return getSingleSignature(type, 0 /* Call */, /*allowMembers*/ false) ||
+ getSingleSignature(type, 1 /* Construct */, /*allowMembers*/ false);
+ }
+ function getSingleSignature(type, kind, allowMembers) {
if (type.flags & 524288 /* Object */) {
var resolved = resolveStructuredTypeMembers(type);
- if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 &&
- resolved.properties.length === 0 && !resolved.stringIndexInfo && !resolved.numberIndexInfo) {
+ if (allowMembers || resolved.properties.length === 0 && !resolved.stringIndexInfo && !resolved.numberIndexInfo) {
+ if (kind === 0 /* Call */ && resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0) {
return resolved.callSignatures[0];
}
+ if (kind === 1 /* Construct */ && resolved.constructSignatures.length === 1 && resolved.callSignatures.length === 0) {
+ return resolved.constructSignatures[0];
+ }
+ }
}
return undefined;
}
@@ -49809,7 +50674,7 @@
});
if (!inferenceContext) {
applyToReturnTypes(contextualSignature, signature, function (source, target) {
- inferTypes(context.inferences, source, target, 8 /* ReturnType */);
+ inferTypes(context.inferences, source, target, 16 /* ReturnType */);
});
}
return getSignatureInstantiation(signature, getInferredTypes(context), ts.isInJSFile(contextualSignature.declaration));
@@ -49828,7 +50693,7 @@
// example, given a 'function wrap<T, U>(cb: (x: T) => U): (x: T) => U' and a call expression
// 'let f: (x: string) => number = wrap(s => s.length)', we infer from the declared type of 'f' to the
// return type of 'wrap'.
- if (node.kind !== 152 /* Decorator */) {
+ if (node.kind !== 153 /* Decorator */) {
var contextualType = getContextualType(node);
if (contextualType) {
// We clone the inference context to avoid disturbing a resolution in progress for an
@@ -49849,7 +50714,7 @@
instantiatedType;
var inferenceTargetType = getReturnTypeOfSignature(signature);
// Inferences made from return types have lower priority than all other inferences.
- inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 8 /* ReturnType */);
+ inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 16 /* ReturnType */);
// Create a type mapper for instantiating generic contextual types using the inferences made
// from the return type.
context.returnMapper = getMapperFromContext(cloneInferredPartOfContext(context));
@@ -49865,7 +50730,7 @@
var argCount = restType ? Math.min(getParameterCount(signature) - 1, args.length) : args.length;
for (var i = 0; i < argCount; i++) {
var arg = args[i];
- if (arg.kind !== 210 /* OmittedExpression */) {
+ if (arg.kind !== 211 /* OmittedExpression */) {
var paramType = getTypeAtPosition(signature, i);
var argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
inferTypes(context.inferences, argType, paramType);
@@ -49879,7 +50744,7 @@
}
function getArrayifiedType(type) {
if (forEachType(type, function (t) { return !(t.flags & (1 /* Any */ | 63176704 /* Instantiable */) || isArrayType(t) || isTupleType(t)); })) {
- return createArrayType(getIndexTypeOfType(type, 1 /* Number */) || errorType);
+ return createArrayType(getIndexedAccessType(type, numberType));
}
return type;
}
@@ -49889,20 +50754,20 @@
if (isSpreadArgument(arg)) {
// We are inferring from a spread expression in the last argument position, i.e. both the parameter
// and the argument are ...x forms.
- return arg.kind === 215 /* SyntheticExpression */ ?
+ return arg.kind === 216 /* SyntheticExpression */ ?
createArrayType(arg.type) :
getArrayifiedType(checkExpressionWithContextualType(arg.expression, restType, context, 0 /* Normal */));
}
}
- var contextualType = getIndexTypeOfType(restType, 1 /* Number */) || anyType;
- var hasPrimitiveContextualType = maybeTypeOfKind(contextualType, 131068 /* Primitive */ | 4194304 /* Index */);
var types = [];
var spreadIndex = -1;
for (var i = index; i < argCount; i++) {
+ var contextualType = getIndexedAccessType(restType, getLiteralType(i - index));
var argType = checkExpressionWithContextualType(args[i], contextualType, context, 0 /* Normal */);
if (spreadIndex < 0 && isSpreadArgument(args[i])) {
spreadIndex = i - index;
}
+ var hasPrimitiveContextualType = maybeTypeOfKind(contextualType, 131068 /* Primitive */ | 4194304 /* Index */);
types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType));
}
return spreadIndex < 0 ?
@@ -49963,7 +50828,7 @@
return checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation, checkMode, reportErrors);
}
var thisType = getThisTypeOfSignature(signature);
- if (thisType && thisType !== voidType && node.kind !== 192 /* NewExpression */) {
+ if (thisType && thisType !== voidType && node.kind !== 193 /* NewExpression */) {
// If the called expression is not of the form `x.f` or `x["f"]`, then sourceType = voidType
// If the signature's 'this' type is voidType, then the check is skipped -- anything is compatible.
// If the expression is a new expression, then the check is skipped.
@@ -49980,7 +50845,7 @@
var argCount = restType ? Math.min(getParameterCount(signature) - 1, args.length) : args.length;
for (var i = 0; i < argCount; i++) {
var arg = args[i];
- if (arg.kind !== 210 /* OmittedExpression */) {
+ if (arg.kind !== 211 /* OmittedExpression */) {
var paramType = getTypeAtPosition(signature, i);
var argType = checkExpressionWithContextualType(arg, paramType, /*inferenceContext*/ undefined, checkMode);
// If one or more arguments are still excluded (as indicated by CheckMode.SkipContextSensitive),
@@ -50003,15 +50868,15 @@
* Returns the this argument in calls like x.f(...) and x[f](...). Undefined otherwise.
*/
function getThisArgumentOfCall(node) {
- if (node.kind === 191 /* CallExpression */) {
+ if (node.kind === 192 /* CallExpression */) {
var callee = ts.skipOuterExpressions(node.expression);
- if (callee.kind === 189 /* PropertyAccessExpression */ || callee.kind === 190 /* ElementAccessExpression */) {
+ if (callee.kind === 190 /* PropertyAccessExpression */ || callee.kind === 191 /* ElementAccessExpression */) {
return callee.expression;
}
}
}
function createSyntheticExpression(parent, type, isSpread) {
- var result = ts.createNode(215 /* SyntheticExpression */, parent.pos, parent.end);
+ var result = ts.createNode(216 /* SyntheticExpression */, parent.pos, parent.end);
result.parent = parent;
result.type = type;
result.isSpread = isSpread || false;
@@ -50021,17 +50886,17 @@
* Returns the effective arguments for an expression that works like a function invocation.
*/
function getEffectiveCallArguments(node) {
- if (node.kind === 193 /* TaggedTemplateExpression */) {
+ if (node.kind === 194 /* TaggedTemplateExpression */) {
var template = node.template;
- var args_4 = [createSyntheticExpression(template, getGlobalTemplateStringsArrayType())];
- if (template.kind === 206 /* TemplateExpression */) {
+ var args_3 = [createSyntheticExpression(template, getGlobalTemplateStringsArrayType())];
+ if (template.kind === 207 /* TemplateExpression */) {
ts.forEach(template.templateSpans, function (span) {
- args_4.push(span.expression);
+ args_3.push(span.expression);
});
}
- return args_4;
+ return args_3;
}
- if (node.kind === 152 /* Decorator */) {
+ if (node.kind === 153 /* Decorator */) {
return getEffectiveDecoratorArguments(node);
}
if (ts.isJsxOpeningLikeElement(node)) {
@@ -50044,7 +50909,7 @@
// of the argument is a tuple type, spread the tuple elements into the argument list. We can
// call checkExpressionCached because spread expressions never have a contextual type.
var spreadArgument_1 = args[length - 1];
- var type = checkExpressionCached(spreadArgument_1.expression);
+ var type = flowLoopCount ? checkExpression(spreadArgument_1.expression) : checkExpressionCached(spreadArgument_1.expression);
if (isTupleType(type)) {
var typeArguments = type.typeArguments || ts.emptyArray;
var restIndex_2 = type.target.hasRestElement ? typeArguments.length - 1 : -1;
@@ -50061,30 +50926,30 @@
var parent = node.parent;
var expr = node.expression;
switch (parent.kind) {
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
// For a class decorator, the `target` is the type of the class (e.g. the
// "static" or "constructor" side of the class).
return [
createSyntheticExpression(expr, getTypeOfSymbol(getSymbolOfNode(parent)))
];
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
// A parameter declaration decorator will have three arguments (see
// `ParameterDecorator` in core.d.ts).
var func = parent.parent;
return [
- createSyntheticExpression(expr, parent.parent.kind === 157 /* Constructor */ ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType),
+ createSyntheticExpression(expr, parent.parent.kind === 158 /* Constructor */ ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType),
createSyntheticExpression(expr, anyType),
createSyntheticExpression(expr, numberType)
];
- case 154 /* PropertyDeclaration */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 155 /* PropertyDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
// A method or accessor declaration decorator will have two or three arguments (see
// `PropertyDecorator` and `MethodDecorator` in core.d.ts). If we are emitting decorators
// for ES3, we will only pass two arguments.
- var hasPropDesc = parent.kind !== 154 /* PropertyDeclaration */ && languageVersion !== 0 /* ES3 */;
+ var hasPropDesc = parent.kind !== 155 /* PropertyDeclaration */ && languageVersion !== 0 /* ES3 */;
return [
createSyntheticExpression(expr, getParentTypeOfClassElement(parent)),
createSyntheticExpression(expr, getClassElementPropertyKeyType(parent)),
@@ -50098,17 +50963,17 @@
*/
function getDecoratorArgumentCount(node, signature) {
switch (node.parent.kind) {
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
return 1;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return 2;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
// For ES3 or decorators with only two parameters we supply only two arguments
return languageVersion === 0 /* ES3 */ || signature.parameters.length <= 2 ? 2 : 3;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return 3;
default:
return ts.Debug.fail();
@@ -50208,15 +51073,15 @@
return ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), typeArguments, ts.Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount);
}
function resolveCall(node, signatures, candidatesOutArray, checkMode, fallbackError) {
- var isTaggedTemplate = node.kind === 193 /* TaggedTemplateExpression */;
- var isDecorator = node.kind === 152 /* Decorator */;
+ var isTaggedTemplate = node.kind === 194 /* TaggedTemplateExpression */;
+ var isDecorator = node.kind === 153 /* Decorator */;
var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node);
var reportErrors = !candidatesOutArray;
var typeArguments;
if (!isDecorator) {
typeArguments = node.typeArguments;
// We already perform checking on the type arguments on the class declaration itself.
- if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 98 /* SuperKeyword */) {
+ if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 99 /* SuperKeyword */) {
ts.forEach(typeArguments, checkSourceElement);
}
}
@@ -50271,7 +51136,7 @@
var result;
// If we are in signature help, a trailing comma indicates that we intend to provide another argument,
// so we will only accept overloads with arity at least 1 higher than the current number of provided arguments.
- var signatureHelpTrailingComma = !!(checkMode & 16 /* IsForSignatureHelp */) && node.kind === 191 /* CallExpression */ && node.arguments.hasTrailingComma;
+ var signatureHelpTrailingComma = !!(checkMode & 16 /* IsForSignatureHelp */) && node.kind === 192 /* CallExpression */ && node.arguments.hasTrailingComma;
// Section 4.12.1:
// if the candidate list contains one or more signatures for which the type of each argument
// expression is a subtype of each corresponding parameter type, the return type of the first
@@ -50422,7 +51287,7 @@
}
var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
var parameters = [];
- var _loop_8 = function (i) {
+ var _loop_11 = function (i) {
var symbols = ts.mapDefined(candidates, function (_a) {
var parameters = _a.parameters, hasRestParameter = _a.hasRestParameter;
return hasRestParameter ?
@@ -50433,7 +51298,7 @@
parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
};
for (var i = 0; i < maxNonRestParam; i++) {
- _loop_8(i);
+ _loop_11(i);
}
var restParameterSymbols = ts.mapDefined(candidates, function (c) { return c.hasRestParameter ? ts.last(c.parameters) : undefined; });
var hasRestParameter = restParameterSymbols.length !== 0;
@@ -50511,7 +51376,7 @@
return maxParamsIndex;
}
function resolveCallExpression(node, candidatesOutArray, checkMode) {
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
var superType = checkSuperExpression(node.expression);
if (isTypeAny(superType)) {
for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) {
@@ -50788,16 +51653,16 @@
*/
function getDiagnosticHeadMessageForDecoratorResolution(node) {
switch (node.parent.kind) {
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression;
default:
return ts.Debug.fail();
@@ -50840,7 +51705,7 @@
// file would probably be preferable.
var typeSymbol = exports && getSymbol(exports, JsxNames.Element, 67897832 /* Type */);
var returnNode = typeSymbol && nodeBuilder.symbolToEntityName(typeSymbol, 67897832 /* Type */, node);
- var declaration = ts.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.createKeywordTypeNode(120 /* AnyKeyword */));
+ var declaration = ts.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.createKeywordTypeNode(121 /* AnyKeyword */));
var parameterSymbol = createSymbol(1 /* FunctionScopedVariable */, "props");
parameterSymbol.type = result;
return createSignature(declaration,
@@ -50887,16 +51752,16 @@
}
function resolveSignature(node, candidatesOutArray, checkMode) {
switch (node.kind) {
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return resolveCallExpression(node, candidatesOutArray, checkMode);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return resolveNewExpression(node, candidatesOutArray, checkMode);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode);
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
return resolveDecorator(node, candidatesOutArray, checkMode);
- case 262 /* JsxOpeningElement */:
- case 261 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
+ case 262 /* JsxSelfClosingElement */:
return resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode);
}
throw ts.Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable.");
@@ -50983,10 +51848,10 @@
return false;
}
var parent = node.parent;
- while (parent && parent.kind === 189 /* PropertyAccessExpression */) {
+ while (parent && parent.kind === 190 /* PropertyAccessExpression */) {
parent = parent.parent;
}
- if (parent && ts.isBinaryExpression(parent) && ts.isPrototypeAccess(parent.left) && parent.operatorToken.kind === 59 /* EqualsToken */) {
+ if (parent && ts.isBinaryExpression(parent) && ts.isPrototypeAccess(parent.left) && parent.operatorToken.kind === 60 /* EqualsToken */) {
var right = ts.getInitializerOfBinaryExpression(parent);
return ts.isObjectLiteralExpression(right) && right;
}
@@ -51012,15 +51877,15 @@
// returns a function type. We defer checking and return nonInferrableType.
return nonInferrableType;
}
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
return voidType;
}
- if (node.kind === 192 /* NewExpression */) {
+ if (node.kind === 193 /* NewExpression */) {
var declaration = signature.declaration;
if (declaration &&
- declaration.kind !== 157 /* Constructor */ &&
- declaration.kind !== 161 /* ConstructSignature */ &&
- declaration.kind !== 166 /* ConstructorType */ &&
+ declaration.kind !== 158 /* Constructor */ &&
+ declaration.kind !== 162 /* ConstructSignature */ &&
+ declaration.kind !== 167 /* ConstructorType */ &&
!ts.isJSDocConstructSignature(declaration) &&
!isJSConstructor(declaration)) {
// When resolved signature is a call signature (and not a construct signature) the result type is any
@@ -51137,9 +52002,9 @@
return false;
}
var targetDeclarationKind = resolvedRequire.flags & 16 /* Function */
- ? 239 /* FunctionDeclaration */
+ ? 240 /* FunctionDeclaration */
: resolvedRequire.flags & 3 /* Variable */
- ? 237 /* VariableDeclaration */
+ ? 238 /* VariableDeclaration */
: 0 /* Unknown */;
if (targetDeclarationKind !== 0 /* Unknown */) {
var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind);
@@ -51164,18 +52029,25 @@
case 14 /* NoSubstitutionTemplateLiteral */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
- case 187 /* ArrayLiteralExpression */:
- case 188 /* ObjectLiteralExpression */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
+ case 188 /* ArrayLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return true;
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return isValidConstAssertionArgument(node.expression);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
var op = node.operator;
var arg = node.operand;
return op === 39 /* MinusToken */ && (arg.kind === 8 /* NumericLiteral */ || arg.kind === 9 /* BigIntLiteral */) ||
op === 38 /* PlusToken */ && arg.kind === 8 /* NumericLiteral */;
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
+ var expr = node.expression;
+ if (ts.isIdentifier(expr)) {
+ var symbol = getSymbolAtLocation(expr);
+ return !!(symbol && (symbol.flags & 384 /* Enum */) && getEnumKind(symbol) === 1 /* Literal */);
+ }
}
return false;
}
@@ -51183,7 +52055,7 @@
var exprType = checkExpression(expression, checkMode);
if (ts.isConstTypeReference(type)) {
if (!isValidConstAssertionArgument(expression)) {
- error(expression, ts.Diagnostics.A_const_assertion_can_only_be_applied_to_a_string_number_boolean_array_or_object_literal);
+ error(expression, ts.Diagnostics.A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals);
}
return getRegularTypeOfLiteralType(exprType);
}
@@ -51203,10 +52075,10 @@
}
function checkMetaProperty(node) {
checkGrammarMetaProperty(node);
- if (node.keywordToken === 95 /* NewKeyword */) {
+ if (node.keywordToken === 96 /* NewKeyword */) {
return checkNewTargetMetaProperty(node);
}
- if (node.keywordToken === 92 /* ImportKeyword */) {
+ if (node.keywordToken === 93 /* ImportKeyword */) {
return checkImportMetaProperty(node);
}
return ts.Debug.assertNever(node.keywordToken);
@@ -51217,7 +52089,7 @@
error(node, ts.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target");
return errorType;
}
- else if (container.kind === 157 /* Constructor */) {
+ else if (container.kind === 158 /* Constructor */) {
var symbol = getSymbolOfNode(container.parent);
return getTypeOfSymbol(symbol);
}
@@ -51227,7 +52099,7 @@
}
}
function checkImportMetaProperty(node) {
- if (languageVersion < 7 /* ESNext */ || moduleKind < ts.ModuleKind.ESNext) {
+ if (languageVersion < 8 /* ESNext */ || moduleKind < ts.ModuleKind.ESNext) {
error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_using_ESNext_for_the_target_and_module_compiler_options);
}
var file = ts.getSourceFileOfNode(node);
@@ -51403,7 +52275,7 @@
for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) {
var element = _a[_i];
if (!ts.isOmittedExpression(element)) {
- if (element.name.kind === 72 /* Identifier */) {
+ if (element.name.kind === 73 /* Identifier */) {
getSymbolLinks(getSymbolOfNode(element)).type = getTypeForBindingElement(element);
}
else {
@@ -51417,9 +52289,9 @@
if (!links.type) {
links.type = contextualType;
var decl = parameter.valueDeclaration;
- if (decl.name.kind !== 72 /* Identifier */) {
+ if (decl.name.kind !== 73 /* Identifier */) {
// if inference didn't come up with anything but {}, fall back to the binding pattern if present.
- if (links.type === emptyObjectType) {
+ if (links.type === unknownType) {
links.type = getTypeFromBindingPattern(decl.name);
}
assignBindingElementTypes(decl.name);
@@ -51431,24 +52303,24 @@
var globalPromiseType = getGlobalPromiseType(/*reportErrors*/ true);
if (globalPromiseType !== emptyGenericType) {
// if the promised type is itself a promise, get the underlying type; otherwise, fallback to the promised type
- promisedType = getAwaitedType(promisedType) || emptyObjectType;
+ promisedType = getAwaitedType(promisedType) || unknownType;
return createTypeReference(globalPromiseType, [promisedType]);
}
- return emptyObjectType;
+ return unknownType;
}
function createPromiseLikeType(promisedType) {
// creates a `PromiseLike<T>` type where `T` is the promisedType argument
var globalPromiseLikeType = getGlobalPromiseLikeType(/*reportErrors*/ true);
if (globalPromiseLikeType !== emptyGenericType) {
// if the promised type is itself a promise, get the underlying type; otherwise, fallback to the promised type
- promisedType = getAwaitedType(promisedType) || emptyObjectType;
+ promisedType = getAwaitedType(promisedType) || unknownType;
return createTypeReference(globalPromiseLikeType, [promisedType]);
}
- return emptyObjectType;
+ return unknownType;
}
function createPromiseReturnType(func, promisedType) {
var promiseType = createPromiseType(promisedType);
- if (promiseType === emptyObjectType) {
+ if (promiseType === unknownType) {
error(func, ts.isImportCall(func) ?
ts.Diagnostics.A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option :
ts.Diagnostics.An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option);
@@ -51467,7 +52339,7 @@
}
var functionFlags = ts.getFunctionFlags(func);
var type;
- if (func.body.kind !== 218 /* Block */) {
+ if (func.body.kind !== 219 /* Block */) {
type = checkExpressionCached(func.body, checkMode && checkMode & ~8 /* SkipGenericFunctions */);
if (functionFlags & 2 /* Async */) {
// From within an async function you can return either a non-promise value or a promise. Any
@@ -51609,7 +52481,7 @@
if (!node.possiblyExhaustive) {
return false;
}
- if (node.expression.kind === 199 /* TypeOfExpression */) {
+ if (node.expression.kind === 200 /* TypeOfExpression */) {
var operandType = getTypeOfExpression(node.expression.expression);
// This cast is safe because the switch is possibly exhaustive and does not contain a default case, so there can be no undefined.
var witnesses = getSwitchClauseTypeOfWitnesses(node);
@@ -51632,7 +52504,7 @@
if (!(func.flags & 128 /* HasImplicitReturn */)) {
return false;
}
- if (ts.some(func.body.statements, function (statement) { return statement.kind === 232 /* SwitchStatement */ && isExhaustiveSwitchStatement(statement); })) {
+ if (ts.some(func.body.statements, function (statement) { return statement.kind === 233 /* SwitchStatement */ && isExhaustiveSwitchStatement(statement); })) {
return false;
}
return true;
@@ -51675,11 +52547,11 @@
}
function mayReturnNever(func) {
switch (func.kind) {
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return true;
- case 156 /* MethodDeclaration */:
- return func.parent.kind === 188 /* ObjectLiteralExpression */;
+ case 157 /* MethodDeclaration */:
+ return func.parent.kind === 189 /* ObjectLiteralExpression */;
default:
return false;
}
@@ -51703,7 +52575,7 @@
}
// If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check.
// also if HasImplicitReturn flag is not set this means that all codepaths in function body end with return or throw
- if (func.kind === 155 /* MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 218 /* Block */ || !functionHasImplicitReturn(func)) {
+ if (func.kind === 156 /* MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 219 /* Block */ || !functionHasImplicitReturn(func)) {
return;
}
var hasExplicitReturn = func.flags & 256 /* HasExplicitReturn */;
@@ -51736,7 +52608,7 @@
}
}
function checkFunctionExpressionOrObjectLiteralMethod(node, checkMode) {
- ts.Debug.assert(node.kind !== 156 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
+ ts.Debug.assert(node.kind !== 157 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
checkNodeDeferred(node);
// The identityMapper object is used to indicate that function expressions are wildcards
if (checkMode && checkMode & 4 /* SkipContextSensitive */ && isContextSensitive(node)) {
@@ -51756,7 +52628,7 @@
}
// Grammar checking
var hasGrammarError = checkGrammarFunctionLikeDeclaration(node);
- if (!hasGrammarError && node.kind === 196 /* FunctionExpression */) {
+ if (!hasGrammarError && node.kind === 197 /* FunctionExpression */) {
checkGrammarForGenerator(node);
}
var links = getNodeLinks(node);
@@ -51801,7 +52673,7 @@
getAwaitedType(type) || errorType : type;
}
function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) {
- ts.Debug.assert(node.kind !== 156 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
+ ts.Debug.assert(node.kind !== 157 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
var functionFlags = ts.getFunctionFlags(node);
var returnOrPromisedType = getReturnOrPromisedType(node, functionFlags);
if ((functionFlags & 1 /* Generator */) === 0) { // Async function or normal function
@@ -51817,7 +52689,7 @@
// checkFunctionExpressionBodies). So it must be done now.
getReturnTypeOfSignature(getSignatureFromDeclaration(node));
}
- if (node.body.kind === 218 /* Block */) {
+ if (node.body.kind === 219 /* Block */) {
checkSourceElement(node.body);
}
else {
@@ -51895,11 +52767,11 @@
if (isReadonlySymbol(symbol)) {
// Allow assignments to readonly properties within constructors of the same class declaration.
if (symbol.flags & 4 /* Property */ &&
- (expr.kind === 189 /* PropertyAccessExpression */ || expr.kind === 190 /* ElementAccessExpression */) &&
- expr.expression.kind === 100 /* ThisKeyword */) {
+ (expr.kind === 190 /* PropertyAccessExpression */ || expr.kind === 191 /* ElementAccessExpression */) &&
+ expr.expression.kind === 101 /* ThisKeyword */) {
// Look for if this is the constructor for the class that `symbol` is a property of.
var func = ts.getContainingFunction(expr);
- if (!(func && func.kind === 157 /* Constructor */)) {
+ if (!(func && func.kind === 158 /* Constructor */)) {
return true;
}
// If func.parent is a class and symbol is a (readonly) property of that class, or
@@ -51912,13 +52784,13 @@
return false;
}
function isReferenceThroughNamespaceImport(expr) {
- if (expr.kind === 189 /* PropertyAccessExpression */ || expr.kind === 190 /* ElementAccessExpression */) {
+ if (expr.kind === 190 /* PropertyAccessExpression */ || expr.kind === 191 /* ElementAccessExpression */) {
var node = ts.skipParentheses(expr.expression);
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
var symbol = getNodeLinks(node).resolvedSymbol;
if (symbol.flags & 2097152 /* Alias */) {
var declaration = getDeclarationOfAliasSymbol(symbol);
- return !!declaration && declaration.kind === 251 /* NamespaceImport */;
+ return !!declaration && declaration.kind === 252 /* NamespaceImport */;
}
}
}
@@ -51927,7 +52799,7 @@
function checkReferenceExpression(expr, invalidReferenceMessage) {
// References are combinations of identifiers, parentheses, and property accesses.
var node = ts.skipOuterExpressions(expr, 2 /* Assertions */ | 1 /* Parentheses */);
- if (node.kind !== 72 /* Identifier */ && node.kind !== 189 /* PropertyAccessExpression */ && node.kind !== 190 /* ElementAccessExpression */) {
+ if (node.kind !== 73 /* Identifier */ && node.kind !== 190 /* PropertyAccessExpression */ && node.kind !== 191 /* ElementAccessExpression */) {
error(expr, invalidReferenceMessage);
return false;
}
@@ -51936,7 +52808,7 @@
function checkDeleteExpression(node) {
checkExpression(node.expression);
var expr = ts.skipParentheses(node.expression);
- if (expr.kind !== 189 /* PropertyAccessExpression */ && expr.kind !== 190 /* ElementAccessExpression */) {
+ if (expr.kind !== 190 /* PropertyAccessExpression */ && expr.kind !== 191 /* ElementAccessExpression */) {
error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference);
return booleanType;
}
@@ -51959,7 +52831,19 @@
// Grammar checking
if (produceDiagnostics) {
if (!(node.flags & 16384 /* AwaitContext */)) {
- grammarErrorOnFirstToken(node, ts.Diagnostics.await_expression_is_only_allowed_within_an_async_function);
+ // use of 'await' in non-async function
+ var sourceFile = ts.getSourceFileOfNode(node);
+ if (!hasParseDiagnostics(sourceFile)) {
+ var span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);
+ var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.await_expression_is_only_allowed_within_an_async_function);
+ var func = ts.getContainingFunction(node);
+ if (func && func.kind !== 158 /* Constructor */) {
+ ts.Debug.assert((ts.getFunctionFlags(func) & 2 /* Async */) === 0, "Enclosing function should never be an async function.");
+ var relatedInfo = ts.createDiagnosticForNode(func, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async);
+ ts.addRelatedInfo(diagnostic, relatedInfo);
+ }
+ diagnostics.add(diagnostic);
+ }
}
if (isInParameterInitializerBeforeContainingFunction(node)) {
error(node, ts.Diagnostics.await_expressions_cannot_be_used_in_a_parameter_initializer);
@@ -52051,8 +52935,8 @@
}
if (type.flags & 3145728 /* UnionOrIntersection */) {
var types = type.types;
- for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
- var t = types_16[_i];
+ for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
+ var t = types_15[_i];
if (maybeTypeOfKind(t, kind)) {
return true;
}
@@ -52131,16 +53015,17 @@
if (strictNullChecks && properties.length === 0) {
return checkNonNullType(sourceType, node);
}
- for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) {
- var p = properties_5[_i];
- checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, properties, rightIsThis);
+ for (var i = 0; i < properties.length; i++) {
+ checkObjectLiteralDestructuringPropertyAssignment(node, sourceType, i, properties, rightIsThis);
}
return sourceType;
}
/** Note: If property cannot be a SpreadAssignment, then allProperties does not need to be provided */
- function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties, rightIsThis) {
+ function checkObjectLiteralDestructuringPropertyAssignment(node, objectLiteralType, propertyIndex, allProperties, rightIsThis) {
if (rightIsThis === void 0) { rightIsThis = false; }
- if (property.kind === 275 /* PropertyAssignment */ || property.kind === 276 /* ShorthandPropertyAssignment */) {
+ var properties = node.properties;
+ var property = properties[propertyIndex];
+ if (property.kind === 276 /* PropertyAssignment */ || property.kind === 277 /* ShorthandPropertyAssignment */) {
var name = property.name;
var exprType = getLiteralTypeFromPropertyName(name);
if (isTypeUsableAsPropertyName(exprType)) {
@@ -52153,22 +53038,30 @@
}
var elementType = getIndexedAccessType(objectLiteralType, exprType, name);
var type = getFlowTypeOfDestructuring(property, elementType);
- return checkDestructuringAssignment(property.kind === 276 /* ShorthandPropertyAssignment */ ? property : property.initializer, type);
+ return checkDestructuringAssignment(property.kind === 277 /* ShorthandPropertyAssignment */ ? property : property.initializer, type);
+ }
+ else if (property.kind === 278 /* SpreadAssignment */) {
+ if (propertyIndex < properties.length - 1) {
+ error(property, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);
}
- else if (property.kind === 277 /* SpreadAssignment */) {
- if (languageVersion < 7 /* ESNext */) {
+ else {
+ if (languageVersion < 8 /* ESNext */) {
checkExternalEmitHelpers(property, 4 /* Rest */);
}
var nonRestNames = [];
if (allProperties) {
- for (var i = 0; i < allProperties.length - 1; i++) {
- nonRestNames.push(allProperties[i].name);
+ for (var _i = 0, allProperties_1 = allProperties; _i < allProperties_1.length; _i++) {
+ var otherProperty = allProperties_1[_i];
+ if (!ts.isSpreadAssignment(otherProperty)) {
+ nonRestNames.push(otherProperty.name);
+ }
}
}
var type = getRestType(objectLiteralType, nonRestNames, objectLiteralType.symbol);
checkGrammarForDisallowedTrailingComma(allProperties, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma);
return checkDestructuringAssignment(property.expression, type);
}
+ }
else {
error(property, ts.Diagnostics.Property_assignment_expected);
}
@@ -52190,8 +53083,8 @@
function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, checkMode) {
var elements = node.elements;
var element = elements[elementIndex];
- if (element.kind !== 210 /* OmittedExpression */) {
- if (element.kind !== 208 /* SpreadElement */) {
+ if (element.kind !== 211 /* OmittedExpression */) {
+ if (element.kind !== 209 /* SpreadElement */) {
var indexType = getLiteralType(elementIndex);
if (isArrayLikeType(sourceType)) {
// We create a synthetic expression so that getIndexedAccessType doesn't get confused
@@ -52207,7 +53100,7 @@
}
else {
var restExpression = element.expression;
- if (restExpression.kind === 204 /* BinaryExpression */ && restExpression.operatorToken.kind === 59 /* EqualsToken */) {
+ if (restExpression.kind === 205 /* BinaryExpression */ && restExpression.operatorToken.kind === 60 /* EqualsToken */) {
error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer);
}
else {
@@ -52223,7 +53116,7 @@
}
function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode, rightIsThis) {
var target;
- if (exprOrAssignment.kind === 276 /* ShorthandPropertyAssignment */) {
+ if (exprOrAssignment.kind === 277 /* ShorthandPropertyAssignment */) {
var prop = exprOrAssignment;
if (prop.objectAssignmentInitializer) {
// In strict null checking mode, if a default value of a non-undefined type is specified, remove
@@ -52239,21 +53132,21 @@
else {
target = exprOrAssignment;
}
- if (target.kind === 204 /* BinaryExpression */ && target.operatorToken.kind === 59 /* EqualsToken */) {
+ if (target.kind === 205 /* BinaryExpression */ && target.operatorToken.kind === 60 /* EqualsToken */) {
checkBinaryExpression(target, checkMode);
target = target.left;
}
- if (target.kind === 188 /* ObjectLiteralExpression */) {
+ if (target.kind === 189 /* ObjectLiteralExpression */) {
return checkObjectLiteralAssignment(target, sourceType, rightIsThis);
}
- if (target.kind === 187 /* ArrayLiteralExpression */) {
+ if (target.kind === 188 /* ArrayLiteralExpression */) {
return checkArrayLiteralAssignment(target, sourceType, checkMode);
}
return checkReferenceAssignment(target, sourceType, checkMode);
}
function checkReferenceAssignment(target, sourceType, checkMode) {
var targetType = checkExpression(target, checkMode);
- var error = target.parent.kind === 277 /* SpreadAssignment */ ?
+ var error = target.parent.kind === 278 /* SpreadAssignment */ ?
ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access :
ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access;
if (checkReferenceExpression(target, error)) {
@@ -52272,39 +53165,39 @@
function isSideEffectFree(node) {
node = ts.skipParentheses(node);
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
case 10 /* StringLiteral */:
case 13 /* RegularExpressionLiteral */:
- case 193 /* TaggedTemplateExpression */:
- case 206 /* TemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
+ case 207 /* TemplateExpression */:
case 14 /* NoSubstitutionTemplateLiteral */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
- case 96 /* NullKeyword */:
- case 141 /* UndefinedKeyword */:
- case 196 /* FunctionExpression */:
- case 209 /* ClassExpression */:
- case 197 /* ArrowFunction */:
- case 187 /* ArrayLiteralExpression */:
- case 188 /* ObjectLiteralExpression */:
- case 199 /* TypeOfExpression */:
- case 213 /* NonNullExpression */:
- case 261 /* JsxSelfClosingElement */:
- case 260 /* JsxElement */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
+ case 97 /* NullKeyword */:
+ case 142 /* UndefinedKeyword */:
+ case 197 /* FunctionExpression */:
+ case 210 /* ClassExpression */:
+ case 198 /* ArrowFunction */:
+ case 188 /* ArrayLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
+ case 200 /* TypeOfExpression */:
+ case 214 /* NonNullExpression */:
+ case 262 /* JsxSelfClosingElement */:
+ case 261 /* JsxElement */:
return true;
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return isSideEffectFree(node.whenTrue) &&
isSideEffectFree(node.whenFalse);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
if (ts.isAssignmentOperator(node.operatorToken.kind)) {
return false;
}
return isSideEffectFree(node.left) &&
isSideEffectFree(node.right);
- case 202 /* PrefixUnaryExpression */:
- case 203 /* PostfixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
// Unary operators ~, !, +, and - have no side effects.
// The rest do.
switch (node.operator) {
@@ -52316,9 +53209,9 @@
}
return false;
// Some forms listed here for clarity
- case 200 /* VoidExpression */: // Explicit opt-out
- case 194 /* TypeAssertionExpression */: // Not SEF, but can produce useful type warnings
- case 212 /* AsExpression */: // Not SEF, but can produce useful type warnings
+ case 201 /* VoidExpression */: // Explicit opt-out
+ case 195 /* TypeAssertionExpression */: // Not SEF, but can produce useful type warnings
+ case 213 /* AsExpression */: // Not SEF, but can produce useful type warnings
default:
return false;
}
@@ -52334,8 +53227,8 @@
}
function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) {
var operator = operatorToken.kind;
- if (operator === 59 /* EqualsToken */ && (left.kind === 188 /* ObjectLiteralExpression */ || left.kind === 187 /* ArrayLiteralExpression */)) {
- return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode, right.kind === 100 /* ThisKeyword */);
+ if (operator === 60 /* EqualsToken */ && (left.kind === 189 /* ObjectLiteralExpression */ || left.kind === 188 /* ArrayLiteralExpression */)) {
+ return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode, right.kind === 101 /* ThisKeyword */);
}
var leftType;
if (operator === 54 /* AmpersandAmpersandToken */ || operator === 55 /* BarBarToken */) {
@@ -52348,26 +53241,26 @@
switch (operator) {
case 40 /* AsteriskToken */:
case 41 /* AsteriskAsteriskToken */:
- case 62 /* AsteriskEqualsToken */:
- case 63 /* AsteriskAsteriskEqualsToken */:
+ case 63 /* AsteriskEqualsToken */:
+ case 64 /* AsteriskAsteriskEqualsToken */:
case 42 /* SlashToken */:
- case 64 /* SlashEqualsToken */:
+ case 65 /* SlashEqualsToken */:
case 43 /* PercentToken */:
- case 65 /* PercentEqualsToken */:
+ case 66 /* PercentEqualsToken */:
case 39 /* MinusToken */:
- case 61 /* MinusEqualsToken */:
+ case 62 /* MinusEqualsToken */:
case 46 /* LessThanLessThanToken */:
- case 66 /* LessThanLessThanEqualsToken */:
+ case 67 /* LessThanLessThanEqualsToken */:
case 47 /* GreaterThanGreaterThanToken */:
- case 67 /* GreaterThanGreaterThanEqualsToken */:
+ case 68 /* GreaterThanGreaterThanEqualsToken */:
case 48 /* GreaterThanGreaterThanGreaterThanToken */:
- case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
+ case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
case 50 /* BarToken */:
- case 70 /* BarEqualsToken */:
+ case 71 /* BarEqualsToken */:
case 51 /* CaretToken */:
- case 71 /* CaretEqualsToken */:
+ case 72 /* CaretEqualsToken */:
case 49 /* AmpersandToken */:
- case 69 /* AmpersandEqualsToken */:
+ case 70 /* AmpersandEqualsToken */:
if (leftType === silentNeverType || rightType === silentNeverType) {
return silentNeverType;
}
@@ -52397,7 +53290,7 @@
else if (isTypeAssignableToKind(leftType, 2112 /* BigIntLike */) && isTypeAssignableToKind(rightType, 2112 /* BigIntLike */)) {
switch (operator) {
case 48 /* GreaterThanGreaterThanGreaterThanToken */:
- case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
+ case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
reportOperatorError();
}
resultType_1 = bigintType;
@@ -52412,7 +53305,7 @@
return resultType_1;
}
case 38 /* PlusToken */:
- case 60 /* PlusEqualsToken */:
+ case 61 /* PlusEqualsToken */:
if (leftType === silentNeverType || rightType === silentNeverType) {
return silentNeverType;
}
@@ -52447,7 +53340,7 @@
reportOperatorError();
return anyType;
}
- if (operator === 60 /* PlusEqualsToken */) {
+ if (operator === 61 /* PlusEqualsToken */) {
checkAssignmentOperator(resultType);
}
return resultType;
@@ -52468,19 +53361,13 @@
case 34 /* ExclamationEqualsToken */:
case 35 /* EqualsEqualsEqualsToken */:
case 36 /* ExclamationEqualsEqualsToken */:
- var leftIsLiteral = isLiteralType(leftType);
- var rightIsLiteral = isLiteralType(rightType);
- if (!leftIsLiteral || !rightIsLiteral) {
- leftType = leftIsLiteral ? getBaseTypeOfLiteralType(leftType) : leftType;
- rightType = rightIsLiteral ? getBaseTypeOfLiteralType(rightType) : rightType;
- }
if (!isTypeEqualityComparableTo(leftType, rightType) && !isTypeEqualityComparableTo(rightType, leftType)) {
reportOperatorError();
}
return booleanType;
- case 94 /* InstanceOfKeyword */:
+ case 95 /* InstanceOfKeyword */:
return checkInstanceOfExpression(left, right, leftType, rightType);
- case 93 /* InKeyword */:
+ case 94 /* InKeyword */:
return checkInExpression(left, right, leftType, rightType);
case 54 /* AmpersandAmpersandToken */:
return getTypeFacts(leftType) & 4194304 /* Truthy */ ?
@@ -52490,7 +53377,7 @@
return getTypeFacts(leftType) & 8388608 /* Falsy */ ?
getUnionType([removeDefinitelyFalsyTypes(leftType), rightType], 2 /* Subtype */) :
leftType;
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
var declKind = ts.isBinaryExpression(left.parent) ? ts.getAssignmentDeclarationKind(left.parent) : 0 /* None */;
checkAssignmentDeclaration(declKind, rightType);
if (isAssignmentDeclaration(declKind)) {
@@ -52534,7 +53421,7 @@
}
}
function isEvalNode(node) {
- return node.kind === 72 /* Identifier */ && node.escapedText === "eval";
+ return node.kind === 73 /* Identifier */ && node.escapedText === "eval";
}
// Return true if there was no error, false if there was an error.
function checkForDisallowedESSymbolOperand(operator) {
@@ -52550,13 +53437,13 @@
function getSuggestedBooleanOperator(operator) {
switch (operator) {
case 50 /* BarToken */:
- case 70 /* BarEqualsToken */:
+ case 71 /* BarEqualsToken */:
return 55 /* BarBarToken */;
case 51 /* CaretToken */:
- case 71 /* CaretEqualsToken */:
+ case 72 /* CaretEqualsToken */:
return 36 /* ExclamationEqualsEqualsToken */;
case 49 /* AmpersandToken */:
- case 69 /* AmpersandEqualsToken */:
+ case 70 /* AmpersandEqualsToken */:
return 54 /* AmpersandAmpersandToken */;
default:
return undefined;
@@ -52595,8 +53482,7 @@
}
}
function reportOperatorError() {
- var leftStr = typeToString(leftType);
- var rightStr = typeToString(rightType);
+ var _a = getTypeNamesForErrorDisplay(leftType, rightType), leftStr = _a[0], rightStr = _a[1];
var errNode = errorNode || operatorToken;
if (!tryGiveBetterPrimaryError(errNode, leftStr, rightStr)) {
error(errNode, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, ts.tokenToString(operatorToken.kind), leftStr, rightStr);
@@ -52651,7 +53537,7 @@
// Async generator functions prior to ESNext require the __await, __asyncDelegator,
// and __asyncValues helpers
if ((functionFlags & 3 /* AsyncGenerator */) === 3 /* AsyncGenerator */ &&
- languageVersion < 7 /* ESNext */) {
+ languageVersion < 8 /* ESNext */) {
checkExternalEmitHelpers(node, 26624 /* AsyncDelegatorIncludes */);
}
// Generator functions prior to ES2015 require the __values helper
@@ -52693,7 +53579,7 @@
return stringType;
}
function getContextNode(node) {
- if (node.kind === 268 /* JsxAttributes */ && !ts.isJsxSelfClosingElement(node.parent)) {
+ if (node.kind === 269 /* JsxAttributes */ && !ts.isJsxSelfClosingElement(node.parent)) {
return node.parent.parent; // Needs to be the root JsxElement, so it encompasses the attributes _and_ the children (which are essentially part of the attributes)
}
return node;
@@ -52732,7 +53618,7 @@
}
function isTypeAssertion(node) {
node = ts.skipParentheses(node);
- return node.kind === 194 /* TypeAssertionExpression */ || node.kind === 212 /* AsExpression */;
+ return node.kind === 195 /* TypeAssertionExpression */ || node.kind === 213 /* AsExpression */;
}
function checkDeclarationInitializer(declaration) {
var initializer = ts.getEffectiveInitializer(declaration);
@@ -52763,7 +53649,7 @@
// If the contextual type is a type variable constrained to a primitive type, consider
// this a literal context for literals of that primitive type. For example, given a
// type parameter 'T extends string', infer string literal types for T.
- var constraint = getBaseConstraintOfType(contextualType) || emptyObjectType;
+ var constraint = getBaseConstraintOfType(contextualType) || unknownType;
return maybeTypeOfKind(constraint, 4 /* String */) && maybeTypeOfKind(candidateType, 128 /* StringLiteral */) ||
maybeTypeOfKind(constraint, 8 /* Number */) && maybeTypeOfKind(candidateType, 256 /* NumberLiteral */) ||
maybeTypeOfKind(constraint, 64 /* BigInt */) && maybeTypeOfKind(candidateType, 2048 /* BigIntLiteral */) ||
@@ -52796,7 +53682,7 @@
// Do not use hasDynamicName here, because that returns false for well known symbols.
// We want to perform checkComputedPropertyName for all computed properties, including
// well known symbols.
- if (node.name.kind === 149 /* ComputedPropertyName */) {
+ if (node.name.kind === 150 /* ComputedPropertyName */) {
checkComputedPropertyName(node.name);
}
return checkExpressionForMutableLocation(node.initializer, checkMode);
@@ -52807,7 +53693,7 @@
// Do not use hasDynamicName here, because that returns false for well known symbols.
// We want to perform checkComputedPropertyName for all computed properties, including
// well known symbols.
- if (node.name.kind === 149 /* ComputedPropertyName */) {
+ if (node.name.kind === 150 /* ComputedPropertyName */) {
checkComputedPropertyName(node.name);
}
var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, checkMode);
@@ -52815,16 +53701,18 @@
}
function instantiateTypeWithSingleGenericCallSignature(node, type, checkMode) {
if (checkMode && checkMode & (2 /* Inferential */ | 8 /* SkipGenericFunctions */)) {
- var signature = getSingleCallSignature(type);
+ var callSignature = getSingleSignature(type, 0 /* Call */, /*allowMembers*/ true);
+ var constructSignature = getSingleSignature(type, 1 /* Construct */, /*allowMembers*/ true);
+ var signature = callSignature || constructSignature;
if (signature && signature.typeParameters) {
+ var contextualType = getApparentTypeOfContextualType(node);
+ if (contextualType && !isMixinConstructorType(contextualType)) {
+ var contextualSignature = getSingleSignature(getNonNullableType(contextualType), callSignature ? 0 /* Call */ : 1 /* Construct */, /*allowMembers*/ false);
+ if (contextualSignature && !contextualSignature.typeParameters) {
if (checkMode & 8 /* SkipGenericFunctions */) {
skippedGenericFunction(node, checkMode);
return anyFunctionType;
}
- var contextualType = getApparentTypeOfContextualType(node);
- if (contextualType) {
- var contextualSignature = getSingleCallSignature(getNonNullableType(contextualType));
- if (contextualSignature && !contextualSignature.typeParameters) {
var context = getInferenceContext(node);
// We have an expression that is an argument of a generic function for which we are performing
// type argument inference. The expression is of a function type with a single generic call
@@ -52832,7 +53720,8 @@
// if the outer function returns a function type with a single non-generic call signature and
// if some of the outer function type parameters have no inferences so far. If so, we can
// potentially add inferred type parameters to the outer function return type.
- var returnSignature = context.signature && getSingleCallSignature(getReturnTypeOfSignature(context.signature));
+ var returnType = context.signature && getReturnTypeOfSignature(context.signature);
+ var returnSignature = returnType && getSingleCallOrConstructSignature(returnType);
if (returnSignature && !returnSignature.typeParameters && !ts.every(context.inferences, hasInferenceCandidates)) {
// Instantiate the signature with its own type parameters as type arguments, possibly
// renaming the type parameters to ensure they have unique names.
@@ -52947,7 +53836,7 @@
var expr = ts.skipParentheses(node);
// Optimize for the common case of a call to a function with a single non-generic call
// signature where we can just fetch the return type without checking the arguments.
- if (expr.kind === 191 /* CallExpression */ && expr.expression.kind !== 98 /* SuperKeyword */ && !ts.isRequireCall(expr, /*checkArgumentIsStringLiteralLike*/ true) && !isSymbolOrSymbolForCall(expr)) {
+ if (expr.kind === 192 /* CallExpression */ && expr.expression.kind !== 99 /* SuperKeyword */ && !ts.isRequireCall(expr, /*checkArgumentIsStringLiteralLike*/ true) && !isSymbolOrSymbolForCall(expr)) {
var funcType = checkNonNullExpression(expr.expression);
var signature = getSingleCallSignature(funcType);
if (signature && !signature.typeParameters) {
@@ -52996,10 +53885,10 @@
// - 'left' in property access
// - 'object' in indexed access
// - target in rhs of import statement
- var ok = (node.parent.kind === 189 /* PropertyAccessExpression */ && node.parent.expression === node) ||
- (node.parent.kind === 190 /* ElementAccessExpression */ && node.parent.expression === node) ||
- ((node.kind === 72 /* Identifier */ || node.kind === 148 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) ||
- (node.parent.kind === 167 /* TypeQuery */ && node.parent.exprName === node));
+ var ok = (node.parent.kind === 190 /* PropertyAccessExpression */ && node.parent.expression === node) ||
+ (node.parent.kind === 191 /* ElementAccessExpression */ && node.parent.expression === node) ||
+ ((node.kind === 73 /* Identifier */ || node.kind === 149 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) ||
+ (node.parent.kind === 168 /* TypeQuery */ && node.parent.exprName === node));
if (!ok) {
error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query);
}
@@ -53020,13 +53909,13 @@
}
function checkExpressionWorker(node, checkMode, forceTuple) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return checkIdentifier(node);
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
return checkThisExpression(node);
- case 98 /* SuperKeyword */:
+ case 99 /* SuperKeyword */:
return checkSuperExpression(node);
- case 96 /* NullKeyword */:
+ case 97 /* NullKeyword */:
return nullWideningType;
case 14 /* NoSubstitutionTemplateLiteral */:
case 10 /* StringLiteral */:
@@ -53037,82 +53926,82 @@
case 9 /* BigIntLiteral */:
checkGrammarBigIntLiteral(node);
return getFreshTypeOfLiteralType(getBigIntLiteralType(node));
- case 102 /* TrueKeyword */:
+ case 103 /* TrueKeyword */:
return trueType;
- case 87 /* FalseKeyword */:
+ case 88 /* FalseKeyword */:
return falseType;
- case 206 /* TemplateExpression */:
+ case 207 /* TemplateExpression */:
return checkTemplateExpression(node);
case 13 /* RegularExpressionLiteral */:
return globalRegExpType;
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return checkArrayLiteral(node, checkMode, forceTuple);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return checkObjectLiteral(node, checkMode);
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return checkPropertyAccessExpression(node);
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
return checkQualifiedName(node);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return checkIndexedAccess(node);
- case 191 /* CallExpression */:
- if (node.expression.kind === 92 /* ImportKeyword */) {
+ case 192 /* CallExpression */:
+ if (node.expression.kind === 93 /* ImportKeyword */) {
return checkImportCallExpression(node);
}
/* falls through */
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return checkCallExpression(node, checkMode);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return checkTaggedTemplateExpression(node);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return checkParenthesizedExpression(node, checkMode);
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
return checkClassExpression(node);
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode);
- case 199 /* TypeOfExpression */:
+ case 200 /* TypeOfExpression */:
return checkTypeOfExpression(node);
- case 194 /* TypeAssertionExpression */:
- case 212 /* AsExpression */:
+ case 195 /* TypeAssertionExpression */:
+ case 213 /* AsExpression */:
return checkAssertion(node);
- case 213 /* NonNullExpression */:
+ case 214 /* NonNullExpression */:
return checkNonNullAssertion(node);
- case 214 /* MetaProperty */:
+ case 215 /* MetaProperty */:
return checkMetaProperty(node);
- case 198 /* DeleteExpression */:
+ case 199 /* DeleteExpression */:
return checkDeleteExpression(node);
- case 200 /* VoidExpression */:
+ case 201 /* VoidExpression */:
return checkVoidExpression(node);
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
return checkAwaitExpression(node);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return checkPrefixUnaryExpression(node);
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return checkPostfixUnaryExpression(node);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return checkBinaryExpression(node, checkMode);
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return checkConditionalExpression(node, checkMode);
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
return checkSpreadExpression(node, checkMode);
- case 210 /* OmittedExpression */:
+ case 211 /* OmittedExpression */:
return undefinedWideningType;
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return checkYieldExpression(node);
- case 215 /* SyntheticExpression */:
+ case 216 /* SyntheticExpression */:
return node.type;
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return checkJsxExpression(node, checkMode);
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
return checkJsxElement(node, checkMode);
- case 261 /* JsxSelfClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
return checkJsxSelfClosingElement(node, checkMode);
- case 264 /* JsxFragment */:
+ case 265 /* JsxFragment */:
return checkJsxFragment(node);
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
return checkJsxAttributes(node, checkMode);
- case 262 /* JsxOpeningElement */:
+ case 263 /* JsxOpeningElement */:
ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement");
}
return errorType;
@@ -53134,7 +54023,7 @@
var constraintType = getConstraintOfTypeParameter(typeParameter);
var defaultType = getDefaultFromTypeParameter(typeParameter);
if (constraintType && defaultType) {
- checkTypeAssignableTo(defaultType, getTypeWithThisArgument(constraintType, defaultType), node.default, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1);
+ checkTypeAssignableTo(defaultType, getTypeWithThisArgument(instantiateType(constraintType, makeUnaryTypeMapper(typeParameter, defaultType)), defaultType), node.default, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1);
}
if (produceDiagnostics) {
checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0);
@@ -53149,7 +54038,7 @@
checkVariableLikeDeclaration(node);
var func = ts.getContainingFunction(node);
if (ts.hasModifier(node, 92 /* ParameterPropertyModifier */)) {
- if (!(func.kind === 157 /* Constructor */ && ts.nodeIsPresent(func.body))) {
+ if (!(func.kind === 158 /* Constructor */ && ts.nodeIsPresent(func.body))) {
error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation);
}
}
@@ -53160,10 +54049,10 @@
if (func.parameters.indexOf(node) !== 0) {
error(node, ts.Diagnostics.A_0_parameter_must_be_the_first_parameter, node.name.escapedText);
}
- if (func.kind === 157 /* Constructor */ || func.kind === 161 /* ConstructSignature */ || func.kind === 166 /* ConstructorType */) {
+ if (func.kind === 158 /* Constructor */ || func.kind === 162 /* ConstructSignature */ || func.kind === 167 /* ConstructorType */) {
error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter);
}
- if (func.kind === 197 /* ArrowFunction */) {
+ if (func.kind === 198 /* ArrowFunction */) {
error(node, ts.Diagnostics.An_arrow_function_cannot_have_a_this_parameter);
}
}
@@ -53219,13 +54108,13 @@
}
function getTypePredicateParent(node) {
switch (node.parent.kind) {
- case 197 /* ArrowFunction */:
- case 160 /* CallSignature */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 165 /* FunctionType */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 198 /* ArrowFunction */:
+ case 161 /* CallSignature */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 166 /* FunctionType */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
var parent = node.parent;
if (node === parent.type) {
return parent;
@@ -53239,11 +54128,11 @@
continue;
}
var name = element.name;
- if (name.kind === 72 /* Identifier */ && name.escapedText === predicateVariableName) {
+ if (name.kind === 73 /* Identifier */ && name.escapedText === predicateVariableName) {
error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName);
return true;
}
- else if (name.kind === 185 /* ArrayBindingPattern */ || name.kind === 184 /* ObjectBindingPattern */) {
+ else if (name.kind === 186 /* ArrayBindingPattern */ || name.kind === 185 /* ObjectBindingPattern */) {
if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) {
return true;
}
@@ -53252,19 +54141,19 @@
}
function checkSignatureDeclaration(node) {
// Grammar checking
- if (node.kind === 162 /* IndexSignature */) {
+ if (node.kind === 163 /* IndexSignature */) {
checkGrammarIndexSignature(node);
}
// TODO (yuisu): Remove this check in else-if when SyntaxKind.Construct is moved and ambient context is handled
- else if (node.kind === 165 /* FunctionType */ || node.kind === 239 /* FunctionDeclaration */ || node.kind === 166 /* ConstructorType */ ||
- node.kind === 160 /* CallSignature */ || node.kind === 157 /* Constructor */ ||
- node.kind === 161 /* ConstructSignature */) {
+ else if (node.kind === 166 /* FunctionType */ || node.kind === 240 /* FunctionDeclaration */ || node.kind === 167 /* ConstructorType */ ||
+ node.kind === 161 /* CallSignature */ || node.kind === 158 /* Constructor */ ||
+ node.kind === 162 /* ConstructSignature */) {
checkGrammarFunctionLikeDeclaration(node);
}
var functionFlags = ts.getFunctionFlags(node);
if (!(functionFlags & 4 /* Invalid */)) {
// Async generators prior to ESNext require the __await and __asyncGenerator helpers
- if ((functionFlags & 3 /* AsyncGenerator */) === 3 /* AsyncGenerator */ && languageVersion < 7 /* ESNext */) {
+ if ((functionFlags & 3 /* AsyncGenerator */) === 3 /* AsyncGenerator */ && languageVersion < 8 /* ESNext */) {
checkExternalEmitHelpers(node, 6144 /* AsyncGeneratorIncludes */);
}
// Async functions prior to ES2017 require the __awaiter helper
@@ -53288,10 +54177,10 @@
var returnTypeNode = ts.getEffectiveReturnTypeNode(node);
if (noImplicitAny && !returnTypeNode) {
switch (node.kind) {
- case 161 /* ConstructSignature */:
+ case 162 /* ConstructSignature */:
error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);
break;
- case 160 /* CallSignature */:
+ case 161 /* CallSignature */:
error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);
break;
}
@@ -53321,7 +54210,7 @@
checkAsyncFunctionReturnType(node, returnTypeNode);
}
}
- if (node.kind !== 162 /* IndexSignature */ && node.kind !== 294 /* JSDocFunctionType */) {
+ if (node.kind !== 163 /* IndexSignature */ && node.kind !== 295 /* JSDocFunctionType */) {
registerForUnusedIdentifiersCheck(node);
}
}
@@ -53338,7 +54227,7 @@
var staticNames = ts.createUnderscoreEscapedMap();
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
- if (member.kind === 157 /* Constructor */) {
+ if (member.kind === 158 /* Constructor */) {
for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) {
var param = _c[_b];
if (ts.isParameterPropertyDeclaration(param) && !ts.isBindingPattern(param.name)) {
@@ -53353,16 +54242,16 @@
var memberName = name && ts.getPropertyNameForPropertyNameNode(name);
if (name && memberName) {
switch (member.kind) {
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
addName(names, name, memberName, 1 /* Getter */);
break;
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
addName(names, name, memberName, 2 /* Setter */);
break;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
addName(names, name, memberName, 3 /* Property */);
break;
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
addName(names, name, memberName, 4 /* Method */);
break;
}
@@ -53425,7 +54314,7 @@
var names = ts.createMap();
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
- if (member.kind === 153 /* PropertySignature */) {
+ if (member.kind === 154 /* PropertySignature */) {
var memberName = void 0;
var name = member.name;
switch (name.kind) {
@@ -53433,7 +54322,7 @@
case 8 /* NumericLiteral */:
memberName = name.text;
break;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
memberName = ts.idText(name);
break;
default:
@@ -53450,7 +54339,7 @@
}
}
function checkTypeForDuplicateIndexSignatures(node) {
- if (node.kind === 241 /* InterfaceDeclaration */) {
+ if (node.kind === 242 /* InterfaceDeclaration */) {
var nodeSymbol = getSymbolOfNode(node);
// in case of merging interface declaration it is possible that we'll enter this check procedure several times for every declaration
// to prevent this run check only for the first declaration of a given kind
@@ -53470,7 +54359,7 @@
var declaration = decl;
if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
switch (declaration.parameters[0].type.kind) {
- case 138 /* StringKeyword */:
+ case 139 /* StringKeyword */:
if (!seenStringIndexer) {
seenStringIndexer = true;
}
@@ -53478,7 +54367,7 @@
error(declaration, ts.Diagnostics.Duplicate_string_index_signature);
}
break;
- case 135 /* NumberKeyword */:
+ case 136 /* NumberKeyword */:
if (!seenNumericIndexer) {
seenNumericIndexer = true;
}
@@ -53505,7 +54394,7 @@
checkFunctionOrMethodDeclaration(node);
// Abstract methods cannot have an implementation.
// Extra checks are to avoid reporting multiple errors relating to the "abstractness" of the node.
- if (ts.hasModifier(node, 128 /* Abstract */) && node.kind === 156 /* MethodDeclaration */ && node.body) {
+ if (ts.hasModifier(node, 128 /* Abstract */) && node.kind === 157 /* MethodDeclaration */ && node.body) {
error(node, ts.Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, ts.declarationNameToString(node.name));
}
}
@@ -53530,7 +54419,7 @@
return;
}
function isInstancePropertyWithInitializer(n) {
- return n.kind === 154 /* PropertyDeclaration */ &&
+ return n.kind === 155 /* PropertyDeclaration */ &&
!ts.hasModifier(n, 32 /* Static */) &&
!!n.initializer;
}
@@ -53560,7 +54449,7 @@
var superCallStatement = void 0;
for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) {
var statement = statements_2[_i];
- if (statement.kind === 221 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) {
+ if (statement.kind === 222 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) {
superCallStatement = statement;
break;
}
@@ -53585,7 +54474,7 @@
checkGrammarComputedPropertyName(node.name);
checkDecorators(node);
checkSignatureDeclaration(node);
- if (node.kind === 158 /* GetAccessor */) {
+ if (node.kind === 159 /* GetAccessor */) {
if (!(node.flags & 4194304 /* Ambient */) && ts.nodeIsPresent(node.body) && (node.flags & 128 /* HasImplicitReturn */)) {
if (!(node.flags & 256 /* HasExplicitReturn */)) {
error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value);
@@ -53595,13 +54484,13 @@
// Do not use hasDynamicName here, because that returns false for well known symbols.
// We want to perform checkComputedPropertyName for all computed properties, including
// well known symbols.
- if (node.name.kind === 149 /* ComputedPropertyName */) {
+ if (node.name.kind === 150 /* ComputedPropertyName */) {
checkComputedPropertyName(node.name);
}
if (!hasNonBindableDynamicName(node)) {
// TypeScript 1.0 spec (April 2014): 8.4.3
// Accessors for the same member name must specify the same accessibility.
- var otherKind = node.kind === 158 /* GetAccessor */ ? 159 /* SetAccessor */ : 158 /* GetAccessor */;
+ var otherKind = node.kind === 159 /* GetAccessor */ ? 160 /* SetAccessor */ : 159 /* GetAccessor */;
var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(node), otherKind);
if (otherAccessor) {
var nodeFlags = ts.getModifierFlags(node);
@@ -53619,7 +54508,7 @@
}
}
var returnType = getTypeOfAccessors(getSymbolOfNode(node));
- if (node.kind === 158 /* GetAccessor */) {
+ if (node.kind === 159 /* GetAccessor */) {
checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType);
}
}
@@ -53667,7 +54556,7 @@
}
function checkTypeReferenceNode(node) {
checkGrammarTypeArguments(node, node.typeArguments);
- if (node.kind === 164 /* TypeReference */ && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) {
+ if (node.kind === 165 /* TypeReference */ && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) {
grammarErrorAtPos(node, node.typeName.jsdocDotPos, 1, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments);
}
var type = getTypeFromTypeReference(node);
@@ -53715,7 +54604,7 @@
var seenOptionalElement = false;
for (var i = 0; i < elementTypes.length; i++) {
var e = elementTypes[i];
- if (e.kind === 172 /* RestType */) {
+ if (e.kind === 173 /* RestType */) {
if (i !== elementTypes.length - 1) {
grammarErrorOnNode(e, ts.Diagnostics.A_rest_element_must_be_last_in_a_tuple_type);
break;
@@ -53724,7 +54613,7 @@
error(e, ts.Diagnostics.A_rest_element_type_must_be_an_array_type);
}
}
- else if (e.kind === 171 /* OptionalType */) {
+ else if (e.kind === 172 /* OptionalType */) {
seenOptionalElement = true;
}
else if (seenOptionalElement) {
@@ -53745,7 +54634,7 @@
var objectType = type.objectType;
var indexType = type.indexType;
if (isTypeAssignableTo(indexType, getIndexType(objectType, /*stringsOnly*/ false))) {
- if (accessNode.kind === 190 /* ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) &&
+ if (accessNode.kind === 191 /* ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) &&
ts.getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) {
error(accessNode, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
}
@@ -53757,7 +54646,7 @@
return type;
}
error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType));
- return type;
+ return errorType;
}
function checkIndexedAccessType(node) {
checkSourceElement(node.objectType);
@@ -53785,7 +54674,7 @@
ts.forEachChild(node, checkSourceElement);
}
function checkInferType(node) {
- if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 175 /* ConditionalType */ && n.parent.extendsType === n; })) {
+ if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 176 /* ConditionalType */ && n.parent.extendsType === n; })) {
grammarErrorOnNode(node, ts.Diagnostics.infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type);
}
checkSourceElement(node.typeParameter);
@@ -53802,9 +54691,9 @@
var flags = ts.getCombinedModifierFlags(n);
// children of classes (even ambient classes) should not be marked as ambient or export
// because those flags have no useful semantics there.
- if (n.parent.kind !== 241 /* InterfaceDeclaration */ &&
- n.parent.kind !== 240 /* ClassDeclaration */ &&
- n.parent.kind !== 209 /* ClassExpression */ &&
+ if (n.parent.kind !== 242 /* InterfaceDeclaration */ &&
+ n.parent.kind !== 241 /* ClassDeclaration */ &&
+ n.parent.kind !== 210 /* ClassExpression */ &&
n.flags & 4194304 /* Ambient */) {
if (!(flags & 2 /* Ambient */) && !(ts.isModuleBlock(n.parent) && ts.isModuleDeclaration(n.parent.parent) && ts.isGlobalScopeAugmentation(n.parent.parent))) {
// It is nested in an ambient context, which means it is automatically exported
@@ -53895,7 +54784,7 @@
if (node.name && subsequentName &&
(ts.isComputedPropertyName(node.name) && ts.isComputedPropertyName(subsequentName) ||
!ts.isComputedPropertyName(node.name) && !ts.isComputedPropertyName(subsequentName) && ts.getEscapedTextOfIdentifierOrLiteral(node.name) === ts.getEscapedTextOfIdentifierOrLiteral(subsequentName))) {
- var reportError = (node.kind === 156 /* MethodDeclaration */ || node.kind === 155 /* MethodSignature */) &&
+ var reportError = (node.kind === 157 /* MethodDeclaration */ || node.kind === 156 /* MethodSignature */) &&
ts.hasModifier(node, 32 /* Static */) !== ts.hasModifier(subsequentNode, 32 /* Static */);
// we can get here in two cases
// 1. mixed static and instance class members
@@ -53934,7 +54823,7 @@
var current = declarations_4[_i];
var node = current;
var inAmbientContext = node.flags & 4194304 /* Ambient */;
- var inAmbientContextOrInterface = node.parent.kind === 241 /* InterfaceDeclaration */ || node.parent.kind === 168 /* TypeLiteral */ || inAmbientContext;
+ var inAmbientContextOrInterface = node.parent.kind === 242 /* InterfaceDeclaration */ || node.parent.kind === 169 /* TypeLiteral */ || inAmbientContext;
if (inAmbientContextOrInterface) {
// check if declarations are consecutive only if they are non-ambient
// 1. ambient declarations can be interleaved
@@ -53945,7 +54834,7 @@
// 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one
previousDeclaration = undefined;
}
- if (node.kind === 239 /* FunctionDeclaration */ || node.kind === 156 /* MethodDeclaration */ || node.kind === 155 /* MethodSignature */ || node.kind === 157 /* Constructor */) {
+ if (node.kind === 240 /* FunctionDeclaration */ || node.kind === 157 /* MethodDeclaration */ || node.kind === 156 /* MethodSignature */ || node.kind === 158 /* Constructor */) {
var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck);
someNodeFlags |= currentNodeFlags;
allNodeFlags &= currentNodeFlags;
@@ -54074,22 +54963,22 @@
function getDeclarationSpaces(decl) {
var d = decl;
switch (d.kind) {
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
// A jsdoc typedef and callback are, by definition, type aliases
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
return 2 /* ExportType */;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */
? 4 /* ExportNamespace */ | 1 /* ExportValue */
: 4 /* ExportNamespace */;
- case 240 /* ClassDeclaration */:
- case 243 /* EnumDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 244 /* EnumDeclaration */:
return 2 /* ExportType */ | 1 /* ExportValue */;
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return 2 /* ExportType */ | 1 /* ExportValue */ | 4 /* ExportNamespace */;
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
// Export assigned entity name expressions act as aliases and should fall through, otherwise they export values
if (!ts.isEntityNameExpression(d.expression)) {
return 1 /* ExportValue */;
@@ -54097,20 +54986,20 @@
d = d.expression;
/* falls through */
// The below options all declare an Alias, which is allowed to merge with other values within the importing module
- case 248 /* ImportEqualsDeclaration */:
- case 251 /* NamespaceImport */:
- case 250 /* ImportClause */:
- var result_5 = 0 /* None */;
+ case 249 /* ImportEqualsDeclaration */:
+ case 252 /* NamespaceImport */:
+ case 251 /* ImportClause */:
+ var result_7 = 0 /* None */;
var target = resolveAlias(getSymbolOfNode(d));
- ts.forEach(target.declarations, function (d) { result_5 |= getDeclarationSpaces(d); });
- return result_5;
- case 237 /* VariableDeclaration */:
- case 186 /* BindingElement */:
- case 239 /* FunctionDeclaration */:
- case 253 /* ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591
+ ts.forEach(target.declarations, function (d) { result_7 |= getDeclarationSpaces(d); });
+ return result_7;
+ case 238 /* VariableDeclaration */:
+ case 187 /* BindingElement */:
+ case 240 /* FunctionDeclaration */:
+ case 254 /* ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591
return 1 /* ExportValue */;
default:
- return ts.Debug.fail(ts.Debug.showSyntaxKind(d));
+ return ts.Debug.failBadSyntaxKind(d);
}
}
}
@@ -54336,7 +55225,7 @@
var promiseConstructorSymbol = resolveEntityName(promiseConstructorName, 67220415 /* Value */, /*ignoreErrors*/ true);
var promiseConstructorType = promiseConstructorSymbol ? getTypeOfSymbol(promiseConstructorSymbol) : errorType;
if (promiseConstructorType === errorType) {
- if (promiseConstructorName.kind === 72 /* Identifier */ && promiseConstructorName.escapedText === "Promise" && getTargetType(returnType) === getGlobalPromiseType(/*reportErrors*/ false)) {
+ if (promiseConstructorName.kind === 73 /* Identifier */ && promiseConstructorName.escapedText === "Promise" && getTargetType(returnType) === getGlobalPromiseType(/*reportErrors*/ false)) {
error(returnTypeNode, ts.Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option);
}
else {
@@ -54375,24 +55264,24 @@
var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node);
var errorInfo;
switch (node.parent.kind) {
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
var classSymbol = getSymbolOfNode(node.parent);
var classConstructorType = getTypeOfSymbol(classSymbol);
expectedReturnType = getUnionType([classConstructorType, voidType]);
break;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
expectedReturnType = voidType;
errorInfo = ts.chainDiagnosticMessages(
/*details*/ undefined, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any);
break;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
expectedReturnType = voidType;
errorInfo = ts.chainDiagnosticMessages(
/*details*/ undefined, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any);
break;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
var methodType = getTypeOfNode(node.parent);
var descriptorType = createTypedPropertyDescriptorType(methodType);
expectedReturnType = getUnionType([descriptorType, voidType]);
@@ -54413,7 +55302,7 @@
if (!typeName)
return;
var rootName = getFirstIdentifier(typeName);
- var meaning = (typeName.kind === 72 /* Identifier */ ? 67897832 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */;
+ var meaning = (typeName.kind === 73 /* Identifier */ ? 67897832 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */;
var rootSymbol = resolveName(rootName, rootName.escapedText, meaning, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isRefernce*/ true);
if (rootSymbol
&& rootSymbol.flags & 2097152 /* Alias */
@@ -54438,29 +55327,29 @@
function getEntityNameForDecoratorMetadata(node) {
if (node) {
switch (node.kind) {
- case 174 /* IntersectionType */:
- case 173 /* UnionType */:
+ case 175 /* IntersectionType */:
+ case 174 /* UnionType */:
return getEntityNameForDecoratorMetadataFromTypeList(node.types);
- case 175 /* ConditionalType */:
+ case 176 /* ConditionalType */:
return getEntityNameForDecoratorMetadataFromTypeList([node.trueType, node.falseType]);
- case 177 /* ParenthesizedType */:
+ case 178 /* ParenthesizedType */:
return getEntityNameForDecoratorMetadata(node.type);
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return node.typeName;
}
}
}
function getEntityNameForDecoratorMetadataFromTypeList(types) {
var commonEntityName;
- for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
- var typeNode = types_17[_i];
- while (typeNode.kind === 177 /* ParenthesizedType */) {
+ for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
+ var typeNode = types_16[_i];
+ while (typeNode.kind === 178 /* ParenthesizedType */) {
typeNode = typeNode.type; // Skip parens if need be
}
- if (typeNode.kind === 132 /* NeverKeyword */) {
+ if (typeNode.kind === 133 /* NeverKeyword */) {
continue; // Always elide `never` from the union/intersection if possible
}
- if (!strictNullChecks && (typeNode.kind === 96 /* NullKeyword */ || typeNode.kind === 141 /* UndefinedKeyword */)) {
+ if (!strictNullChecks && (typeNode.kind === 97 /* NullKeyword */ || typeNode.kind === 142 /* UndefinedKeyword */)) {
continue; // Elide null and undefined from unions for metadata, just like what we did prior to the implementation of strict null checks
}
var individualEntityName = getEntityNameForDecoratorMetadata(typeNode);
@@ -54502,18 +55391,18 @@
return;
}
if (!compilerOptions.experimentalDecorators) {
- error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning);
+ error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning);
}
var firstDecorator = node.decorators[0];
checkExternalEmitHelpers(firstDecorator, 8 /* Decorate */);
- if (node.kind === 151 /* Parameter */) {
+ if (node.kind === 152 /* Parameter */) {
checkExternalEmitHelpers(firstDecorator, 32 /* Param */);
}
if (compilerOptions.emitDecoratorMetadata) {
checkExternalEmitHelpers(firstDecorator, 16 /* Metadata */);
// we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator.
switch (node.kind) {
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
var constructor = ts.getFirstConstructorWithBody(node);
if (constructor) {
for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) {
@@ -54522,23 +55411,23 @@
}
}
break;
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- var otherKind = node.kind === 158 /* GetAccessor */ ? 159 /* SetAccessor */ : 158 /* GetAccessor */;
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ var otherKind = node.kind === 159 /* GetAccessor */ ? 160 /* SetAccessor */ : 159 /* GetAccessor */;
var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(node), otherKind);
markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor));
break;
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) {
var parameter = _c[_b];
markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
}
markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveReturnTypeNode(node));
break;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveTypeAnnotationNode(node));
break;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node));
var containingSignature = node.parent;
for (var _d = 0, _e = containingSignature.parameters; _d < _e.length; _d++) {
@@ -54601,7 +55490,7 @@
else if (ts.findLast(ts.getJSDocTags(decl), ts.isJSDocParameterTag) === node &&
node.typeExpression && node.typeExpression.type &&
!isArrayType(getTypeFromTypeNode(node.typeExpression.type))) {
- error(node.name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_had_an_array_type, ts.idText(node.name.kind === 148 /* QualifiedName */ ? node.name.right : node.name));
+ error(node.name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_had_an_array_type, ts.idText(node.name.kind === 149 /* QualifiedName */ ? node.name.right : node.name));
}
}
}
@@ -54634,9 +55523,9 @@
}
function getIdentifierFromEntityNameExpression(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return node;
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return node.name;
default:
return undefined;
@@ -54649,7 +55538,7 @@
// Do not use hasDynamicName here, because that returns false for well known symbols.
// We want to perform checkComputedPropertyName for all computed properties, including
// well known symbols.
- if (node.name && node.name.kind === 149 /* ComputedPropertyName */) {
+ if (node.name && node.name.kind === 150 /* ComputedPropertyName */) {
// This check will account for methods in class/interface declarations,
// as well as accessors in classes/object literals
checkComputedPropertyName(node.name);
@@ -54678,7 +55567,7 @@
}
}
}
- var body = node.kind === 155 /* MethodSignature */ ? undefined : node.body;
+ var body = node.kind === 156 /* MethodSignature */ ? undefined : node.body;
checkSourceElement(body);
if ((functionFlags & 1 /* Generator */) === 0) { // Async function or normal function
var returnOrPromisedType = getReturnOrPromisedType(node, functionFlags);
@@ -54723,42 +55612,42 @@
for (var _i = 0, potentiallyUnusedIdentifiers_1 = potentiallyUnusedIdentifiers; _i < potentiallyUnusedIdentifiers_1.length; _i++) {
var node = potentiallyUnusedIdentifiers_1[_i];
switch (node.kind) {
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
checkUnusedClassMembers(node, addDiagnostic);
checkUnusedTypeParameters(node, addDiagnostic);
break;
- case 284 /* SourceFile */:
- case 244 /* ModuleDeclaration */:
- case 218 /* Block */:
- case 246 /* CaseBlock */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 285 /* SourceFile */:
+ case 245 /* ModuleDeclaration */:
+ case 219 /* Block */:
+ case 247 /* CaseBlock */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
checkUnusedLocalsAndParameters(node, addDiagnostic);
break;
- case 157 /* Constructor */:
- case 196 /* FunctionExpression */:
- case 239 /* FunctionDeclaration */:
- case 197 /* ArrowFunction */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 158 /* Constructor */:
+ case 197 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
+ case 198 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
if (node.body) { // Don't report unused parameters in overloads
checkUnusedLocalsAndParameters(node, addDiagnostic);
}
checkUnusedTypeParameters(node, addDiagnostic);
break;
- case 155 /* MethodSignature */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 242 /* TypeAliasDeclaration */:
- case 241 /* InterfaceDeclaration */:
+ case 156 /* MethodSignature */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 243 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
checkUnusedTypeParameters(node, addDiagnostic);
break;
- case 176 /* InferType */:
+ case 177 /* InferType */:
checkUnusedInferTypeParameter(node, addDiagnostic);
break;
default:
@@ -54778,11 +55667,11 @@
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
switch (member.kind) {
- case 156 /* MethodDeclaration */:
- case 154 /* PropertyDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- if (member.kind === 159 /* SetAccessor */ && member.symbol.flags & 32768 /* GetAccessor */) {
+ case 157 /* MethodDeclaration */:
+ case 155 /* PropertyDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ if (member.kind === 160 /* SetAccessor */ && member.symbol.flags & 32768 /* GetAccessor */) {
// Already would have reported an error on the getter.
break;
}
@@ -54791,7 +55680,7 @@
addDiagnostic(member, 0 /* Local */, ts.createDiagnosticForNode(member.name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, symbolToString(symbol)));
}
break;
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) {
var parameter = _c[_b];
if (!parameter.symbol.isReferenced && ts.hasModifier(parameter, 8 /* Private */)) {
@@ -54799,8 +55688,8 @@
}
}
break;
- case 162 /* IndexSignature */:
- case 217 /* SemicolonClassElement */:
+ case 163 /* IndexSignature */:
+ case 218 /* SemicolonClassElement */:
// Can't be private
break;
default:
@@ -54827,7 +55716,7 @@
continue;
var name = ts.idText(typeParameter.name);
var parent = typeParameter.parent;
- if (parent.kind !== 176 /* InferType */ && parent.typeParameters.every(isTypeParameterUnused)) {
+ if (parent.kind !== 177 /* InferType */ && parent.typeParameters.every(isTypeParameterUnused)) {
if (seenParentsWithEveryUnused.tryAdd(parent)) {
var range = ts.isJSDocTemplateTag(parent)
// Whole @template tag
@@ -54912,7 +55801,7 @@
var importDecl = importClause.parent;
var nDeclarations = (importClause.name ? 1 : 0) +
(importClause.namedBindings ?
- (importClause.namedBindings.kind === 251 /* NamespaceImport */ ? 1 : importClause.namedBindings.elements.length)
+ (importClause.namedBindings.kind === 252 /* NamespaceImport */ ? 1 : importClause.namedBindings.elements.length)
: 0);
if (nDeclarations === unuseds.length) {
addDiagnostic(importDecl, 0 /* Local */, unuseds.length === 1
@@ -54930,7 +55819,7 @@
var bindingPattern = _a[0], bindingElements = _a[1];
var kind = tryGetRootParameterDeclaration(bindingPattern.parent) ? 1 /* Parameter */ : 0 /* Local */;
if (bindingPattern.elements.length === bindingElements.length) {
- if (bindingElements.length === 1 && bindingPattern.parent.kind === 237 /* VariableDeclaration */ && bindingPattern.parent.parent.kind === 238 /* VariableDeclarationList */) {
+ if (bindingElements.length === 1 && bindingPattern.parent.kind === 238 /* VariableDeclaration */ && bindingPattern.parent.parent.kind === 239 /* VariableDeclarationList */) {
addToGroup(unusedVariables, bindingPattern.parent.parent, bindingPattern.parent, getNodeId);
}
else {
@@ -54951,7 +55840,7 @@
if (declarationList.declarations.length === declarations.length) {
addDiagnostic(declarationList, 0 /* Local */, declarations.length === 1
? ts.createDiagnosticForNode(ts.first(declarations).name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(ts.first(declarations).name))
- : ts.createDiagnosticForNode(declarationList.parent.kind === 219 /* VariableStatement */ ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused));
+ : ts.createDiagnosticForNode(declarationList.parent.kind === 220 /* VariableStatement */ ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused));
}
else {
for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) {
@@ -54963,24 +55852,24 @@
}
function bindingNameText(name) {
switch (name.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return ts.idText(name);
- case 185 /* ArrayBindingPattern */:
- case 184 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
return bindingNameText(ts.cast(ts.first(name.elements), ts.isBindingElement).name);
default:
return ts.Debug.assertNever(name);
}
}
function isImportedDeclaration(node) {
- return node.kind === 250 /* ImportClause */ || node.kind === 253 /* ImportSpecifier */ || node.kind === 251 /* NamespaceImport */;
+ return node.kind === 251 /* ImportClause */ || node.kind === 254 /* ImportSpecifier */ || node.kind === 252 /* NamespaceImport */;
}
function importClauseFromImported(decl) {
- return decl.kind === 250 /* ImportClause */ ? decl : decl.kind === 251 /* NamespaceImport */ ? decl.parent : decl.parent.parent;
+ return decl.kind === 251 /* ImportClause */ ? decl : decl.kind === 252 /* NamespaceImport */ ? decl.parent : decl.parent.parent;
}
function checkBlock(node) {
// Grammar checking for SyntaxKind.Block
- if (node.kind === 218 /* Block */) {
+ if (node.kind === 219 /* Block */) {
checkGrammarStatementInAmbientContext(node);
}
if (ts.isFunctionOrModuleBlock(node)) {
@@ -55010,12 +55899,12 @@
if (!(identifier && identifier.escapedText === name)) {
return false;
}
- if (node.kind === 154 /* PropertyDeclaration */ ||
- node.kind === 153 /* PropertySignature */ ||
- node.kind === 156 /* MethodDeclaration */ ||
- node.kind === 155 /* MethodSignature */ ||
- node.kind === 158 /* GetAccessor */ ||
- node.kind === 159 /* SetAccessor */) {
+ if (node.kind === 155 /* PropertyDeclaration */ ||
+ node.kind === 154 /* PropertySignature */ ||
+ node.kind === 157 /* MethodDeclaration */ ||
+ node.kind === 156 /* MethodSignature */ ||
+ node.kind === 159 /* GetAccessor */ ||
+ node.kind === 160 /* SetAccessor */) {
// it is ok to have member named '_super' or '_this' - member access is always qualified
return false;
}
@@ -55024,7 +55913,7 @@
return false;
}
var root = ts.getRootDeclaration(node);
- if (root.kind === 151 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) {
+ if (root.kind === 152 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) {
// just an overload - no codegen impact
return false;
}
@@ -55034,7 +55923,7 @@
function checkIfThisIsCapturedInEnclosingScope(node) {
ts.findAncestor(node, function (current) {
if (getNodeCheckFlags(current) & 4 /* CaptureThis */) {
- var isDeclaration_1 = node.kind !== 72 /* Identifier */;
+ var isDeclaration_1 = node.kind !== 73 /* Identifier */;
if (isDeclaration_1) {
error(ts.getNameOfDeclaration(node), ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference);
}
@@ -55049,7 +55938,7 @@
function checkIfNewTargetIsCapturedInEnclosingScope(node) {
ts.findAncestor(node, function (current) {
if (getNodeCheckFlags(current) & 8 /* CaptureNewTarget */) {
- var isDeclaration_2 = node.kind !== 72 /* Identifier */;
+ var isDeclaration_2 = node.kind !== 73 /* Identifier */;
if (isDeclaration_2) {
error(ts.getNameOfDeclaration(node), ts.Diagnostics.Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference);
}
@@ -55075,7 +55964,7 @@
}
// In case of variable declaration, node.parent is variable statement so look at the variable statement's parent
var parent = getDeclarationContainer(node);
- if (parent.kind === 284 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) {
+ if (parent.kind === 285 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) {
// If the declaration happens to be in external module, report error that require and exports are reserved keywords
error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name));
}
@@ -55090,7 +55979,7 @@
}
// In case of variable declaration, node.parent is variable statement so look at the variable statement's parent
var parent = getDeclarationContainer(node);
- if (parent.kind === 284 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024 /* HasAsyncFunctions */) {
+ if (parent.kind === 285 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024 /* HasAsyncFunctions */) {
// If the declaration happens to be in external module, report error that Promise is a reserved identifier.
error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name));
}
@@ -55125,7 +56014,7 @@
// skip variable declarations that don't have initializers
// NOTE: in ES6 spec initializer is required in variable declarations where name is binding pattern
// so we'll always treat binding elements as initialized
- if (node.kind === 237 /* VariableDeclaration */ && !node.initializer) {
+ if (node.kind === 238 /* VariableDeclaration */ && !node.initializer) {
return;
}
var symbol = getSymbolOfNode(node);
@@ -55137,17 +56026,17 @@
localDeclarationSymbol !== symbol &&
localDeclarationSymbol.flags & 2 /* BlockScopedVariable */) {
if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3 /* BlockScoped */) {
- var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 238 /* VariableDeclarationList */);
- var container = varDeclList.parent.kind === 219 /* VariableStatement */ && varDeclList.parent.parent
+ var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 239 /* VariableDeclarationList */);
+ var container = varDeclList.parent.kind === 220 /* VariableStatement */ && varDeclList.parent.parent
? varDeclList.parent.parent
: undefined;
// names of block-scoped and function scoped variables can collide only
// if block scoped variable is defined in the function\module\source file scope (because of variable hoisting)
var namesShareScope = container &&
- (container.kind === 218 /* Block */ && ts.isFunctionLike(container.parent) ||
- container.kind === 245 /* ModuleBlock */ ||
- container.kind === 244 /* ModuleDeclaration */ ||
- container.kind === 284 /* SourceFile */);
+ (container.kind === 219 /* Block */ && ts.isFunctionLike(container.parent) ||
+ container.kind === 246 /* ModuleBlock */ ||
+ container.kind === 245 /* ModuleDeclaration */ ||
+ container.kind === 285 /* SourceFile */);
// here we know that function scoped variable is shadowed by block scoped one
// if they are defined in the same scope - binder has already reported redeclaration error
// otherwise if variable has an initializer - show error that initialization will fail
@@ -55160,69 +56049,6 @@
}
}
}
- // Check that a parameter initializer contains no references to parameters declared to the right of itself
- function checkParameterInitializer(node) {
- if (ts.getRootDeclaration(node).kind !== 151 /* Parameter */) {
- return;
- }
- var func = ts.getContainingFunction(node);
- visit(node.initializer);
- function visit(n) {
- if (ts.isTypeNode(n) || ts.isDeclarationName(n)) {
- // do not dive in types
- // skip declaration names (i.e. in object literal expressions)
- return;
- }
- if (n.kind === 189 /* PropertyAccessExpression */) {
- // skip property names in property access expression
- return visit(n.expression);
- }
- else if (n.kind === 72 /* Identifier */) {
- // check FunctionLikeDeclaration.locals (stores parameters\function local variable)
- // if it contains entry with a specified name
- var symbol = resolveName(n, n.escapedText, 67220415 /* Value */ | 2097152 /* Alias */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false);
- if (!symbol || symbol === unknownSymbol || !symbol.valueDeclaration) {
- return;
- }
- if (symbol.valueDeclaration === node) {
- error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name));
- return;
- }
- // locals map for function contain both parameters and function locals
- // so we need to do a bit of extra work to check if reference is legal
- var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration);
- if (enclosingContainer === func) {
- if (symbol.valueDeclaration.kind === 151 /* Parameter */ ||
- symbol.valueDeclaration.kind === 186 /* BindingElement */) {
- // it is ok to reference parameter in initializer if either
- // - parameter is located strictly on the left of current parameter declaration
- if (symbol.valueDeclaration.pos < node.pos) {
- return;
- }
- // - parameter is wrapped in function-like entity
- if (ts.findAncestor(n, function (current) {
- if (current === node.initializer) {
- return "quit";
- }
- return ts.isFunctionLike(current.parent) ||
- // computed property names/initializers in instance property declaration of class like entities
- // are executed in constructor and thus deferred
- (current.parent.kind === 154 /* PropertyDeclaration */ &&
- !(ts.hasModifier(current.parent, 32 /* Static */)) &&
- ts.isClassLike(current.parent.parent));
- })) {
- return;
- }
- // fall through to report error
- }
- error(n, ts.Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(node.name), ts.declarationNameToString(n));
- }
- }
- else {
- return ts.forEachChild(n, visit);
- }
- }
- }
function convertAutoToAny(type) {
return type === autoType ? anyType : type === autoArrayType ? anyArrayType : type;
}
@@ -55240,18 +56066,18 @@
// Do not use hasDynamicName here, because that returns false for well known symbols.
// We want to perform checkComputedPropertyName for all computed properties, including
// well known symbols.
- if (node.name.kind === 149 /* ComputedPropertyName */) {
+ if (node.name.kind === 150 /* ComputedPropertyName */) {
checkComputedPropertyName(node.name);
if (node.initializer) {
checkExpressionCached(node.initializer);
}
}
- if (node.kind === 186 /* BindingElement */) {
- if (node.parent.kind === 184 /* ObjectBindingPattern */ && languageVersion < 7 /* ESNext */) {
+ if (node.kind === 187 /* BindingElement */) {
+ if (node.parent.kind === 185 /* ObjectBindingPattern */ && languageVersion < 8 /* ESNext */) {
checkExternalEmitHelpers(node, 4 /* Rest */);
}
// check computed properties inside property names of binding elements
- if (node.propertyName && node.propertyName.kind === 149 /* ComputedPropertyName */) {
+ if (node.propertyName && node.propertyName.kind === 150 /* ComputedPropertyName */) {
checkComputedPropertyName(node.propertyName);
}
// check private/protected variable access
@@ -55265,35 +56091,48 @@
var property = getPropertyOfType(parentType, nameText);
if (property) {
markPropertyAsReferenced(property, /*nodeForCheckWriteOnly*/ undefined, /*isThisAccess*/ false); // A destructuring is never a write-only reference.
- checkPropertyAccessibility(parent, !!parent.initializer && parent.initializer.kind === 98 /* SuperKeyword */, parentType, property);
+ checkPropertyAccessibility(parent, !!parent.initializer && parent.initializer.kind === 99 /* SuperKeyword */, parentType, property);
}
}
}
}
// For a binding pattern, check contained binding elements
if (ts.isBindingPattern(node.name)) {
- if (node.name.kind === 185 /* ArrayBindingPattern */ && languageVersion < 2 /* ES2015 */ && compilerOptions.downlevelIteration) {
+ if (node.name.kind === 186 /* ArrayBindingPattern */ && languageVersion < 2 /* ES2015 */ && compilerOptions.downlevelIteration) {
checkExternalEmitHelpers(node, 512 /* Read */);
}
ts.forEach(node.name.elements, checkSourceElement);
}
// For a parameter declaration with an initializer, error and exit if the containing function doesn't have a body
- if (node.initializer && ts.getRootDeclaration(node).kind === 151 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) {
+ if (node.initializer && ts.getRootDeclaration(node).kind === 152 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) {
error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation);
return;
}
// For a binding pattern, validate the initializer and exit
if (ts.isBindingPattern(node.name)) {
+ var needCheckInitializer = node.initializer && node.parent.parent.kind !== 227 /* ForInStatement */;
+ var needCheckWidenedType = node.name.elements.length === 0;
+ if (needCheckInitializer || needCheckWidenedType) {
// Don't validate for-in initializer as it is already an error
- if (node.initializer && node.parent.parent.kind !== 226 /* ForInStatement */) {
+ var widenedType = getWidenedTypeForVariableLikeDeclaration(node);
+ if (needCheckInitializer) {
var initializerType = checkExpressionCached(node.initializer);
- if (strictNullChecks && node.name.elements.length === 0) {
- checkNonNullType(initializerType, node);
+ if (strictNullChecks && needCheckWidenedType) {
+ checkNonNullNonVoidType(initializerType, node);
}
else {
checkTypeAssignableToAndOptionallyElaborate(initializerType, getWidenedTypeForVariableLikeDeclaration(node), node, node.initializer);
}
- checkParameterInitializer(node);
+ }
+ // check the binding pattern with empty elements
+ if (needCheckWidenedType) {
+ if (ts.isArrayBindingPattern(node.name)) {
+ checkIteratedTypeOrElementType(widenedType, node, /* allowStringInput */ false, /* allowAsyncIterables */ false);
+ }
+ else if (strictNullChecks) {
+ checkNonNullNonVoidType(widenedType, node);
+ }
+ }
}
return;
}
@@ -55308,9 +56147,8 @@
ts.isObjectLiteralExpression(initializer) &&
(initializer.properties.length === 0 || ts.isPrototypeAccess(node.name)) &&
ts.hasEntries(symbol.exports);
- if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 226 /* ForInStatement */) {
+ if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 227 /* ForInStatement */) {
checkTypeAssignableToAndOptionallyElaborate(checkExpressionCached(initializer), type, node, initializer, /*headMessage*/ undefined);
- checkParameterInitializer(node);
}
}
if (symbol.declarations.length > 1) {
@@ -55326,7 +56164,7 @@
if (type !== errorType && declarationType !== errorType &&
!isTypeIdenticalTo(type, declarationType) &&
!(symbol.flags & 67108864 /* Assignment */)) {
- errorNextVariableOrPropertyDeclarationMustHaveSameType(type, node, declarationType);
+ errorNextVariableOrPropertyDeclarationMustHaveSameType(symbol.valueDeclaration, type, node, declarationType);
}
if (node.initializer) {
checkTypeAssignableToAndOptionallyElaborate(checkExpressionCached(node.initializer), declarationType, node, node.initializer, /*headMessage*/ undefined);
@@ -55335,26 +56173,30 @@
error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name));
}
}
- if (node.kind !== 154 /* PropertyDeclaration */ && node.kind !== 153 /* PropertySignature */) {
+ if (node.kind !== 155 /* PropertyDeclaration */ && node.kind !== 154 /* PropertySignature */) {
// We know we don't have a binding pattern or computed name here
checkExportsOnMergedDeclarations(node);
- if (node.kind === 237 /* VariableDeclaration */ || node.kind === 186 /* BindingElement */) {
+ if (node.kind === 238 /* VariableDeclaration */ || node.kind === 187 /* BindingElement */) {
checkVarDeclaredNamesNotShadowed(node);
}
checkCollisionWithRequireExportsInGeneratedCode(node, node.name);
checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name);
}
}
- function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstType, nextDeclaration, nextType) {
+ function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstDeclaration, firstType, nextDeclaration, nextType) {
var nextDeclarationName = ts.getNameOfDeclaration(nextDeclaration);
- var message = nextDeclaration.kind === 154 /* PropertyDeclaration */ || nextDeclaration.kind === 153 /* PropertySignature */
+ var message = nextDeclaration.kind === 155 /* PropertyDeclaration */ || nextDeclaration.kind === 154 /* PropertySignature */
? ts.Diagnostics.Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2
: ts.Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2;
- error(nextDeclarationName, message, ts.declarationNameToString(nextDeclarationName), typeToString(firstType), typeToString(nextType));
+ var declName = ts.declarationNameToString(nextDeclarationName);
+ var err = error(nextDeclarationName, message, declName, typeToString(firstType), typeToString(nextType));
+ if (firstDeclaration) {
+ ts.addRelatedInfo(err, ts.createDiagnosticForNode(firstDeclaration, ts.Diagnostics._0_was_also_declared_here, declName));
+ }
}
function areDeclarationFlagsIdentical(left, right) {
- if ((left.kind === 151 /* Parameter */ && right.kind === 237 /* VariableDeclaration */) ||
- (left.kind === 237 /* VariableDeclaration */ && right.kind === 151 /* Parameter */)) {
+ if ((left.kind === 152 /* Parameter */ && right.kind === 238 /* VariableDeclaration */) ||
+ (left.kind === 238 /* VariableDeclaration */ && right.kind === 152 /* Parameter */)) {
// Differences in optionality between parameters and variables are allowed.
return true;
}
@@ -55393,7 +56235,7 @@
checkGrammarStatementInAmbientContext(node);
checkTruthinessExpression(node.expression);
checkSourceElement(node.thenStatement);
- if (node.thenStatement.kind === 220 /* EmptyStatement */) {
+ if (node.thenStatement.kind === 221 /* EmptyStatement */) {
error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement);
}
checkSourceElement(node.elseStatement);
@@ -55420,12 +56262,12 @@
function checkForStatement(node) {
// Grammar checking
if (!checkGrammarStatementInAmbientContext(node)) {
- if (node.initializer && node.initializer.kind === 238 /* VariableDeclarationList */) {
+ if (node.initializer && node.initializer.kind === 239 /* VariableDeclarationList */) {
checkGrammarVariableDeclarationList(node.initializer);
}
}
if (node.initializer) {
- if (node.initializer.kind === 238 /* VariableDeclarationList */) {
+ if (node.initializer.kind === 239 /* VariableDeclarationList */) {
ts.forEach(node.initializer.declarations, checkVariableDeclaration);
}
else {
@@ -55445,7 +56287,7 @@
checkGrammarForInOrForOfStatement(node);
if (node.awaitModifier) {
var functionFlags = ts.getFunctionFlags(ts.getContainingFunction(node));
- if ((functionFlags & (4 /* Invalid */ | 2 /* Async */)) === 2 /* Async */ && languageVersion < 7 /* ESNext */) {
+ if ((functionFlags & (4 /* Invalid */ | 2 /* Async */)) === 2 /* Async */ && languageVersion < 8 /* ESNext */) {
// for..await..of in an async function or async generator function prior to ESNext requires the __asyncValues helper
checkExternalEmitHelpers(node, 16384 /* ForAwaitOfIncludes */);
}
@@ -55459,14 +56301,14 @@
// via checkRightHandSideOfForOf.
// If the LHS is an expression, check the LHS, as a destructuring assignment or as a reference.
// Then check that the RHS is assignable to it.
- if (node.initializer.kind === 238 /* VariableDeclarationList */) {
+ if (node.initializer.kind === 239 /* VariableDeclarationList */) {
checkForInOrForOfVariableDeclaration(node);
}
else {
var varExpr = node.initializer;
var iteratedType = checkRightHandSideOfForOf(node.expression, node.awaitModifier);
// There may be a destructuring assignment on the left side
- if (varExpr.kind === 187 /* ArrayLiteralExpression */ || varExpr.kind === 188 /* ObjectLiteralExpression */) {
+ if (varExpr.kind === 188 /* ArrayLiteralExpression */ || varExpr.kind === 189 /* ObjectLiteralExpression */) {
// iteratedType may be undefined. In this case, we still want to check the structure of
// varExpr, in particular making sure it's a valid LeftHandSideExpression. But we'd like
// to short circuit the type relation checking as much as possible, so we pass the unknownType.
@@ -55498,7 +56340,7 @@
// for (let VarDecl in Expr) Statement
// VarDecl must be a variable declaration without a type annotation that declares a variable of type Any,
// and Expr must be an expression of type Any, an object type, or a type parameter type.
- if (node.initializer.kind === 238 /* VariableDeclarationList */) {
+ if (node.initializer.kind === 239 /* VariableDeclarationList */) {
var variable = node.initializer.declarations[0];
if (variable && ts.isBindingPattern(variable.name)) {
error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);
@@ -55512,7 +56354,7 @@
// and Expr must be an expression of type Any, an object type, or a type parameter type.
var varExpr = node.initializer;
var leftType = checkExpression(varExpr);
- if (varExpr.kind === 187 /* ArrayLiteralExpression */ || varExpr.kind === 188 /* ObjectLiteralExpression */) {
+ if (varExpr.kind === 188 /* ArrayLiteralExpression */ || varExpr.kind === 189 /* ObjectLiteralExpression */) {
error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);
}
else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) {
@@ -55872,12 +56714,12 @@
// for generators.
return;
}
- else if (func.kind === 159 /* SetAccessor */) {
+ else if (func.kind === 160 /* SetAccessor */) {
if (node.expression) {
error(node, ts.Diagnostics.Setters_cannot_return_a_value);
}
}
- else if (func.kind === 157 /* Constructor */) {
+ else if (func.kind === 158 /* Constructor */) {
if (node.expression && !checkTypeAssignableToAndOptionallyElaborate(exprType, returnType, node, node.expression)) {
error(node, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class);
}
@@ -55898,7 +56740,7 @@
}
}
}
- else if (func.kind !== 157 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType) && !isGenerator) {
+ else if (func.kind !== 158 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType) && !isGenerator) {
// The function has a return type, but the return statement doesn't have an expression.
error(node, ts.Diagnostics.Not_all_code_paths_return_a_value);
}
@@ -55927,7 +56769,7 @@
var expressionIsLiteral = isLiteralType(expressionType);
ts.forEach(node.caseBlock.clauses, function (clause) {
// Grammar check for duplicate default clauses, skip if we already report duplicate default clause
- if (clause.kind === 272 /* DefaultClause */ && !hasDuplicateDefaultClause) {
+ if (clause.kind === 273 /* DefaultClause */ && !hasDuplicateDefaultClause) {
if (firstDefaultClause === undefined) {
firstDefaultClause = clause;
}
@@ -55939,7 +56781,7 @@
hasDuplicateDefaultClause = true;
}
}
- if (produceDiagnostics && clause.kind === 271 /* CaseClause */) {
+ if (produceDiagnostics && clause.kind === 272 /* CaseClause */) {
// TypeScript 1.0 spec (April 2014): 5.9
// In a 'switch' statement, each 'case' expression must be of a type that is comparable
// to or from the type of the 'switch' expression.
@@ -55968,7 +56810,7 @@
if (ts.isFunctionLike(current)) {
return "quit";
}
- if (current.kind === 233 /* LabeledStatement */ && current.label.escapedText === node.label.escapedText) {
+ if (current.kind === 234 /* LabeledStatement */ && current.label.escapedText === node.label.escapedText) {
grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNode(node.label));
return true;
}
@@ -56075,8 +56917,8 @@
// this allows us to rule out cases when both property and indexer are inherited from the base class
var errorNode;
if (propDeclaration && name &&
- (propDeclaration.kind === 204 /* BinaryExpression */ ||
- name.kind === 149 /* ComputedPropertyName */ ||
+ (propDeclaration.kind === 205 /* BinaryExpression */ ||
+ name.kind === 150 /* ComputedPropertyName */ ||
prop.parent === containingType.symbol)) {
errorNode = propDeclaration;
}
@@ -56153,7 +56995,7 @@
function checkTypeParametersNotReferenced(root, typeParameters, index) {
visit(root);
function visit(node) {
- if (node.kind === 164 /* TypeReference */) {
+ if (node.kind === 165 /* TypeReference */) {
var type = getTypeFromTypeReference(node);
if (type.flags & 262144 /* TypeParameter */) {
for (var i = index; i < typeParameters.length; i++) {
@@ -56275,6 +57117,11 @@
if (languageVersion < 2 /* ES2015 */) {
checkExternalEmitHelpers(baseTypeNode.parent, 1 /* Extends */);
}
+ // check both @extends and extends if both are specified.
+ var extendsNode = ts.getClassExtendsHeritageElement(node);
+ if (extendsNode && extendsNode !== baseTypeNode) {
+ checkExpression(extendsNode.expression);
+ }
var baseTypes = getBaseTypes(type);
if (baseTypes.length && produceDiagnostics) {
var baseType_1 = baseTypes[0];
@@ -56282,10 +57129,6 @@
var staticBaseType = getApparentType(baseConstructorType);
checkBaseTypeAccessibility(staticBaseType, baseTypeNode);
checkSourceElement(baseTypeNode.expression);
- var extendsNode = ts.getClassExtendsHeritageElement(node);
- if (extendsNode && extendsNode !== baseTypeNode) {
- checkExpression(extendsNode.expression);
- }
if (ts.some(baseTypeNode.typeArguments)) {
ts.forEach(baseTypeNode.typeArguments, checkSourceElement);
for (var _i = 0, _a = getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode); _i < _a.length; _i++) {
@@ -56356,7 +57199,7 @@
function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
// iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
var issuedMemberError = false;
- var _loop_9 = function (member) {
+ var _loop_12 = function (member) {
if (ts.hasStaticModifier(member)) {
return "continue";
}
@@ -56375,7 +57218,7 @@
};
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
- _loop_9(member);
+ _loop_12(member);
}
if (!issuedMemberError) {
// check again with diagnostics to generate a less-specific error
@@ -56401,7 +57244,7 @@
}
function getClassOrInterfaceDeclarationsOfSymbol(symbol) {
return ts.filter(symbol.declarations, function (d) {
- return d.kind === 240 /* ClassDeclaration */ || d.kind === 241 /* InterfaceDeclaration */;
+ return d.kind === 241 /* ClassDeclaration */ || d.kind === 242 /* InterfaceDeclaration */;
});
}
function checkKindsOfPropertyMemberOverrides(type, baseType) {
@@ -56440,7 +57283,7 @@
// If there is no declaration for the derived class (as in the case of class expressions),
// then the class cannot be declared abstract.
if (baseDeclarationFlags & 128 /* Abstract */ && (!derivedClassDecl || !ts.hasModifier(derivedClassDecl, 128 /* Abstract */))) {
- if (derivedClassDecl.kind === 209 /* ClassExpression */) {
+ if (derivedClassDecl.kind === 210 /* ClassExpression */) {
error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType));
}
else {
@@ -56490,8 +57333,8 @@
for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) {
var base = baseTypes_2[_i];
var properties = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType));
- for (var _a = 0, properties_6 = properties; _a < properties_6.length; _a++) {
- var prop = properties_6[_a];
+ for (var _a = 0, properties_4 = properties; _a < properties_4.length; _a++) {
+ var prop = properties_4[_a];
var existing = seen.get(prop.escapedName);
if (!existing) {
seen.set(prop.escapedName, { prop: prop, containingType: base });
@@ -56532,7 +57375,7 @@
}
}
function isInstancePropertyWithoutInitializer(node) {
- return node.kind === 154 /* PropertyDeclaration */ &&
+ return node.kind === 155 /* PropertyDeclaration */ &&
!ts.hasModifier(node, 32 /* Static */ | 128 /* Abstract */) &&
!node.exclamationToken &&
!node.initializer;
@@ -56556,7 +57399,7 @@
var symbol = getSymbolOfNode(node);
checkTypeParameterListsIdentical(symbol);
// Only check this symbol once
- var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 241 /* InterfaceDeclaration */);
+ var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 242 /* InterfaceDeclaration */);
if (node === firstInterfaceDecl) {
var type = getDeclaredTypeOfSymbol(symbol);
var typeWithThis = getTypeWithThisArgument(type);
@@ -56661,7 +57504,7 @@
return value;
function evaluate(expr) {
switch (expr.kind) {
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
var value_2 = evaluate(expr.operand);
if (typeof value_2 === "number") {
switch (expr.operator) {
@@ -56671,7 +57514,7 @@
}
}
break;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
var left = evaluate(expr.left);
var right = evaluate(expr.right);
if (typeof left === "number" && typeof right === "number") {
@@ -56699,22 +57542,22 @@
case 8 /* NumericLiteral */:
checkGrammarNumericLiteral(expr);
return +expr.text;
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return evaluate(expr.expression);
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
var identifier = expr;
if (isInfinityOrNaNString(identifier.escapedText)) {
return +(identifier.escapedText);
}
return ts.nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), identifier.escapedText);
- case 190 /* ElementAccessExpression */:
- case 189 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
var ex = expr;
if (isConstantMemberAccess(ex)) {
var type = getTypeOfExpression(ex.expression);
if (type.symbol && type.symbol.flags & 384 /* Enum */) {
var name = void 0;
- if (ex.kind === 189 /* PropertyAccessExpression */) {
+ if (ex.kind === 190 /* PropertyAccessExpression */) {
name = ex.name.escapedText;
}
else {
@@ -56745,9 +57588,9 @@
}
}
function isConstantMemberAccess(node) {
- return node.kind === 72 /* Identifier */ ||
- node.kind === 189 /* PropertyAccessExpression */ && isConstantMemberAccess(node.expression) ||
- node.kind === 190 /* ElementAccessExpression */ && isConstantMemberAccess(node.expression) &&
+ return node.kind === 73 /* Identifier */ ||
+ node.kind === 190 /* PropertyAccessExpression */ && isConstantMemberAccess(node.expression) ||
+ node.kind === 191 /* ElementAccessExpression */ && isConstantMemberAccess(node.expression) &&
node.argumentExpression.kind === 10 /* StringLiteral */;
}
function checkEnumDeclaration(node) {
@@ -56782,7 +57625,7 @@
var seenEnumMissingInitialInitializer_1 = false;
ts.forEach(enumSymbol.declarations, function (declaration) {
// return true if we hit a violation of the rule, false otherwise
- if (declaration.kind !== 243 /* EnumDeclaration */) {
+ if (declaration.kind !== 244 /* EnumDeclaration */) {
return false;
}
var enumDeclaration = declaration;
@@ -56805,8 +57648,8 @@
var declarations = symbol.declarations;
for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) {
var declaration = declarations_8[_i];
- if ((declaration.kind === 240 /* ClassDeclaration */ ||
- (declaration.kind === 239 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) &&
+ if ((declaration.kind === 241 /* ClassDeclaration */ ||
+ (declaration.kind === 240 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) &&
!(declaration.flags & 4194304 /* Ambient */)) {
return declaration;
}
@@ -56869,7 +57712,7 @@
}
// if the module merges with a class declaration in the same lexical scope,
// we need to track this to ensure the correct emit.
- var mergedClass = ts.getDeclarationOfKind(symbol, 240 /* ClassDeclaration */);
+ var mergedClass = ts.getDeclarationOfKind(symbol, 241 /* ClassDeclaration */);
if (mergedClass &&
inSameLexicalScope(node, mergedClass)) {
getNodeLinks(node).flags |= 32768 /* LexicalModuleMergesWithClass */;
@@ -56919,23 +57762,23 @@
}
function checkModuleAugmentationElement(node, isGlobalAugmentation) {
switch (node.kind) {
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
// error each individual name in variable statement instead of marking the entire variable statement
for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {
var decl = _a[_i];
checkModuleAugmentationElement(decl, isGlobalAugmentation);
}
break;
- case 254 /* ExportAssignment */:
- case 255 /* ExportDeclaration */:
+ case 255 /* ExportAssignment */:
+ case 256 /* ExportDeclaration */:
grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations);
break;
- case 248 /* ImportEqualsDeclaration */:
- case 249 /* ImportDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 250 /* ImportDeclaration */:
grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module);
break;
- case 186 /* BindingElement */:
- case 237 /* VariableDeclaration */:
+ case 187 /* BindingElement */:
+ case 238 /* VariableDeclaration */:
var name = node.name;
if (ts.isBindingPattern(name)) {
for (var _b = 0, _c = name.elements; _b < _c.length; _b++) {
@@ -56946,12 +57789,12 @@
break;
}
// falls through
- case 240 /* ClassDeclaration */:
- case 243 /* EnumDeclaration */:
- case 239 /* FunctionDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 242 /* TypeAliasDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
if (isGlobalAugmentation) {
return;
}
@@ -56972,17 +57815,17 @@
}
function getFirstIdentifier(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return node;
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
do {
node = node.left;
- } while (node.kind !== 72 /* Identifier */);
+ } while (node.kind !== 73 /* Identifier */);
return node;
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
do {
node = node.expression;
- } while (node.kind !== 72 /* Identifier */);
+ } while (node.kind !== 73 /* Identifier */);
return node;
}
}
@@ -56996,9 +57839,9 @@
error(moduleName, ts.Diagnostics.String_literal_expected);
return false;
}
- var inAmbientExternalModule = node.parent.kind === 245 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent);
- if (node.parent.kind !== 284 /* SourceFile */ && !inAmbientExternalModule) {
- error(moduleName, node.kind === 255 /* ExportDeclaration */ ?
+ var inAmbientExternalModule = node.parent.kind === 246 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent);
+ if (node.parent.kind !== 285 /* SourceFile */ && !inAmbientExternalModule) {
+ error(moduleName, node.kind === 256 /* ExportDeclaration */ ?
ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace :
ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module);
return false;
@@ -57031,14 +57874,14 @@
(symbol.flags & 67897832 /* Type */ ? 67897832 /* Type */ : 0) |
(symbol.flags & 1920 /* Namespace */ ? 1920 /* Namespace */ : 0);
if (target.flags & excludedMeanings) {
- var message = node.kind === 257 /* ExportSpecifier */ ?
+ var message = node.kind === 258 /* ExportSpecifier */ ?
ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 :
ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0;
error(node, message, symbolToString(symbol));
}
// Don't allow to re-export something with no value side when `--isolatedModules` is set.
if (compilerOptions.isolatedModules
- && node.kind === 257 /* ExportSpecifier */
+ && node.kind === 258 /* ExportSpecifier */
&& !(target.flags & 67220415 /* Value */)
&& !(node.flags & 4194304 /* Ambient */)) {
error(node, ts.Diagnostics.Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided);
@@ -57065,7 +57908,7 @@
checkImportBinding(importClause);
}
if (importClause.namedBindings) {
- if (importClause.namedBindings.kind === 251 /* NamespaceImport */) {
+ if (importClause.namedBindings.kind === 252 /* NamespaceImport */) {
checkImportBinding(importClause.namedBindings);
}
else {
@@ -57089,7 +57932,7 @@
if (ts.hasModifier(node, 1 /* Export */)) {
markExportAsReferenced(node);
}
- if (node.moduleReference.kind !== 259 /* ExternalModuleReference */) {
+ if (node.moduleReference.kind !== 260 /* ExternalModuleReference */) {
var target = resolveAlias(getSymbolOfNode(node));
if (target !== unknownSymbol) {
if (target.flags & 67220415 /* Value */) {
@@ -57125,10 +57968,10 @@
// export { x, y }
// export { x, y } from "foo"
ts.forEach(node.exportClause.elements, checkExportSpecifier);
- var inAmbientExternalModule = node.parent.kind === 245 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent);
- var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 245 /* ModuleBlock */ &&
+ var inAmbientExternalModule = node.parent.kind === 246 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent);
+ var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 246 /* ModuleBlock */ &&
!node.moduleSpecifier && node.flags & 4194304 /* Ambient */;
- if (node.parent.kind !== 284 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) {
+ if (node.parent.kind !== 285 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) {
error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace);
}
}
@@ -57145,7 +57988,7 @@
}
}
function checkGrammarModuleElementContext(node, errorMessage) {
- var isInAppropriateContext = node.parent.kind === 284 /* SourceFile */ || node.parent.kind === 245 /* ModuleBlock */ || node.parent.kind === 244 /* ModuleDeclaration */;
+ var isInAppropriateContext = node.parent.kind === 285 /* SourceFile */ || node.parent.kind === 246 /* ModuleBlock */ || node.parent.kind === 245 /* ModuleDeclaration */;
if (!isInAppropriateContext) {
grammarErrorOnFirstToken(node, errorMessage);
}
@@ -57174,8 +58017,8 @@
// If we hit an export assignment in an illegal context, just bail out to avoid cascading errors.
return;
}
- var container = node.parent.kind === 284 /* SourceFile */ ? node.parent : node.parent.parent;
- if (container.kind === 244 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) {
+ var container = node.parent.kind === 285 /* SourceFile */ ? node.parent : node.parent.parent;
+ if (container.kind === 245 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) {
if (node.isExportEquals) {
error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace);
}
@@ -57188,7 +58031,7 @@
if (!checkGrammarDecoratorsAndModifiers(node) && ts.hasModifiers(node)) {
grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers);
}
- if (node.expression.kind === 72 /* Identifier */) {
+ if (node.expression.kind === 73 /* Identifier */) {
markExportAsReferenced(node);
if (ts.getEmitDeclarations(compilerOptions)) {
collectLinkedAliases(node.expression, /*setVisibility*/ true);
@@ -57263,7 +58106,7 @@
return !ts.isAccessor(declaration);
}
function isNotOverload(declaration) {
- return (declaration.kind !== 239 /* FunctionDeclaration */ && declaration.kind !== 156 /* MethodDeclaration */) ||
+ return (declaration.kind !== 240 /* FunctionDeclaration */ && declaration.kind !== 157 /* MethodDeclaration */) ||
!!declaration.body;
}
function checkSourceElement(node) {
@@ -57286,158 +58129,158 @@
// Only bother checking on a few construct kinds. We don't want to be excessively
// hitting the cancellation token on every node we check.
switch (kind) {
- case 244 /* ModuleDeclaration */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 239 /* FunctionDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 240 /* FunctionDeclaration */:
cancellationToken.throwIfCancellationRequested();
}
}
switch (kind) {
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
return checkTypeParameter(node);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return checkParameter(node);
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
return checkPropertyDeclaration(node);
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
return checkSignatureDeclaration(node);
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
return checkMethodDeclaration(node);
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return checkConstructorDeclaration(node);
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return checkAccessorDeclaration(node);
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return checkTypeReferenceNode(node);
- case 163 /* TypePredicate */:
+ case 164 /* TypePredicate */:
return checkTypePredicate(node);
- case 167 /* TypeQuery */:
+ case 168 /* TypeQuery */:
return checkTypeQuery(node);
- case 168 /* TypeLiteral */:
+ case 169 /* TypeLiteral */:
return checkTypeLiteral(node);
- case 169 /* ArrayType */:
+ case 170 /* ArrayType */:
return checkArrayType(node);
- case 170 /* TupleType */:
+ case 171 /* TupleType */:
return checkTupleType(node);
- case 173 /* UnionType */:
- case 174 /* IntersectionType */:
+ case 174 /* UnionType */:
+ case 175 /* IntersectionType */:
return checkUnionOrIntersectionType(node);
- case 177 /* ParenthesizedType */:
- case 171 /* OptionalType */:
- case 172 /* RestType */:
+ case 178 /* ParenthesizedType */:
+ case 172 /* OptionalType */:
+ case 173 /* RestType */:
return checkSourceElement(node.type);
- case 178 /* ThisType */:
+ case 179 /* ThisType */:
return checkThisType(node);
- case 179 /* TypeOperator */:
+ case 180 /* TypeOperator */:
return checkTypeOperator(node);
- case 175 /* ConditionalType */:
+ case 176 /* ConditionalType */:
return checkConditionalType(node);
- case 176 /* InferType */:
+ case 177 /* InferType */:
return checkInferType(node);
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return checkImportType(node);
- case 300 /* JSDocAugmentsTag */:
+ case 301 /* JSDocAugmentsTag */:
return checkJSDocAugmentsTag(node);
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
return checkJSDocTypeAliasTag(node);
- case 308 /* JSDocTemplateTag */:
+ case 309 /* JSDocTemplateTag */:
return checkJSDocTemplateTag(node);
- case 307 /* JSDocTypeTag */:
+ case 308 /* JSDocTypeTag */:
return checkJSDocTypeTag(node);
- case 304 /* JSDocParameterTag */:
+ case 305 /* JSDocParameterTag */:
return checkJSDocParameterTag(node);
- case 294 /* JSDocFunctionType */:
+ case 295 /* JSDocFunctionType */:
checkJSDocFunctionType(node);
// falls through
- case 292 /* JSDocNonNullableType */:
- case 291 /* JSDocNullableType */:
- case 289 /* JSDocAllType */:
- case 290 /* JSDocUnknownType */:
- case 297 /* JSDocTypeLiteral */:
+ case 293 /* JSDocNonNullableType */:
+ case 292 /* JSDocNullableType */:
+ case 290 /* JSDocAllType */:
+ case 291 /* JSDocUnknownType */:
+ case 298 /* JSDocTypeLiteral */:
checkJSDocTypeIsInJsFile(node);
ts.forEachChild(node, checkSourceElement);
return;
- case 295 /* JSDocVariadicType */:
+ case 296 /* JSDocVariadicType */:
checkJSDocVariadicType(node);
return;
- case 288 /* JSDocTypeExpression */:
+ case 289 /* JSDocTypeExpression */:
return checkSourceElement(node.type);
- case 180 /* IndexedAccessType */:
+ case 181 /* IndexedAccessType */:
return checkIndexedAccessType(node);
- case 181 /* MappedType */:
+ case 182 /* MappedType */:
return checkMappedType(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return checkFunctionDeclaration(node);
- case 218 /* Block */:
- case 245 /* ModuleBlock */:
+ case 219 /* Block */:
+ case 246 /* ModuleBlock */:
return checkBlock(node);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return checkVariableStatement(node);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return checkExpressionStatement(node);
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
return checkIfStatement(node);
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
return checkDoStatement(node);
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
return checkWhileStatement(node);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return checkForStatement(node);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return checkForInStatement(node);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return checkForOfStatement(node);
- case 228 /* ContinueStatement */:
- case 229 /* BreakStatement */:
+ case 229 /* ContinueStatement */:
+ case 230 /* BreakStatement */:
return checkBreakOrContinueStatement(node);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return checkReturnStatement(node);
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
return checkWithStatement(node);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return checkSwitchStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return checkLabeledStatement(node);
- case 234 /* ThrowStatement */:
+ case 235 /* ThrowStatement */:
return checkThrowStatement(node);
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
return checkTryStatement(node);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return checkVariableDeclaration(node);
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return checkBindingElement(node);
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return checkClassDeclaration(node);
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
return checkInterfaceDeclaration(node);
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return checkTypeAliasDeclaration(node);
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return checkEnumDeclaration(node);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return checkModuleDeclaration(node);
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return checkImportDeclaration(node);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return checkImportEqualsDeclaration(node);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return checkExportDeclaration(node);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return checkExportAssignment(node);
- case 220 /* EmptyStatement */:
- case 236 /* DebuggerStatement */:
+ case 221 /* EmptyStatement */:
+ case 237 /* DebuggerStatement */:
checkGrammarStatementInAmbientContext(node);
return;
- case 258 /* MissingDeclaration */:
+ case 259 /* MissingDeclaration */:
return checkMissingDeclaration(node);
}
}
@@ -57531,23 +58374,23 @@
var saveCurrentNode = currentNode;
currentNode = node;
switch (node.kind) {
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
checkFunctionExpressionOrObjectLiteralMethodDeferred(node);
break;
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
checkAccessorDeclaration(node);
break;
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
checkClassExpressionDeferred(node);
break;
- case 261 /* JsxSelfClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
checkJsxSelfClosingElementDeferred(node);
break;
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
checkJsxElementDeferred(node);
break;
}
@@ -57677,17 +58520,17 @@
copySymbols(location.locals, meaning);
}
switch (location.kind) {
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
if (!ts.isExternalOrCommonJsModule(location))
break;
// falls through
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
copySymbols(getSymbolOfNode(location).exports, meaning & 2623475 /* ModuleMember */);
break;
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* EnumMember */);
break;
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
var className = location.name;
if (className) {
copySymbol(location.symbol, meaning);
@@ -57695,8 +58538,8 @@
// falls through
// this fall-through is necessary because we would like to handle
// type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
// If we didn't come from static member of class or interface,
// add the type parameters into the symbol table
// (type parameters of classDeclaration/classExpression and interface are in member property of the symbol.
@@ -57705,7 +58548,7 @@
copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & 67897832 /* Type */);
}
break;
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
var funcName = location.name;
if (funcName) {
copySymbol(location.symbol, meaning);
@@ -57747,17 +58590,17 @@
}
}
function isTypeDeclarationName(name) {
- return name.kind === 72 /* Identifier */ &&
+ return name.kind === 73 /* Identifier */ &&
isTypeDeclaration(name.parent) &&
name.parent.name === name;
}
function isTypeDeclaration(node) {
switch (node.kind) {
- case 150 /* TypeParameter */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 243 /* EnumDeclaration */:
+ case 151 /* TypeParameter */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 244 /* EnumDeclaration */:
return true;
default:
return false;
@@ -57765,16 +58608,16 @@
}
// True if the given identifier is part of a type reference
function isTypeReferenceIdentifier(node) {
- while (node.parent.kind === 148 /* QualifiedName */) {
+ while (node.parent.kind === 149 /* QualifiedName */) {
node = node.parent;
}
- return node.parent.kind === 164 /* TypeReference */;
+ return node.parent.kind === 165 /* TypeReference */;
}
function isHeritageClauseElementIdentifier(node) {
- while (node.parent.kind === 189 /* PropertyAccessExpression */) {
+ while (node.parent.kind === 190 /* PropertyAccessExpression */) {
node = node.parent;
}
- return node.parent.kind === 211 /* ExpressionWithTypeArguments */;
+ return node.parent.kind === 212 /* ExpressionWithTypeArguments */;
}
function forEachEnclosingClass(node, callback) {
var result;
@@ -57802,13 +58645,13 @@
return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; });
}
function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) {
- while (nodeOnRightSide.parent.kind === 148 /* QualifiedName */) {
+ while (nodeOnRightSide.parent.kind === 149 /* QualifiedName */) {
nodeOnRightSide = nodeOnRightSide.parent;
}
- if (nodeOnRightSide.parent.kind === 248 /* ImportEqualsDeclaration */) {
+ if (nodeOnRightSide.parent.kind === 249 /* ImportEqualsDeclaration */) {
return nodeOnRightSide.parent.moduleReference === nodeOnRightSide ? nodeOnRightSide.parent : undefined;
}
- if (nodeOnRightSide.parent.kind === 254 /* ExportAssignment */) {
+ if (nodeOnRightSide.parent.kind === 255 /* ExportAssignment */) {
return nodeOnRightSide.parent.expression === nodeOnRightSide ? nodeOnRightSide.parent : undefined;
}
return undefined;
@@ -57834,7 +58677,7 @@
node = parent;
parent = parent.parent;
}
- if (parent && parent.kind === 183 /* ImportType */ && parent.qualifier === node) {
+ if (parent && parent.kind === 184 /* ImportType */ && parent.qualifier === node) {
return parent;
}
return undefined;
@@ -57844,7 +58687,7 @@
return getSymbolOfNode(entityName.parent);
}
if (ts.isInJSFile(entityName) &&
- entityName.parent.kind === 189 /* PropertyAccessExpression */ &&
+ entityName.parent.kind === 190 /* PropertyAccessExpression */ &&
entityName.parent === entityName.parent.parent.left) {
// Check if this is a special property assignment
var specialPropertyAssignmentSymbol = getSpecialPropertyAssignmentSymbolFromEntityName(entityName);
@@ -57852,7 +58695,7 @@
return specialPropertyAssignmentSymbol;
}
}
- if (entityName.parent.kind === 254 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) {
+ if (entityName.parent.kind === 255 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) {
// Even an entity name expression that doesn't resolve as an entityname may still typecheck as a property access expression
var success = resolveEntityName(entityName,
/*all meanings*/ 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */, /*ignoreErrors*/ true);
@@ -57862,7 +58705,7 @@
}
else if (!ts.isPropertyAccessExpression(entityName) && isInRightSideOfImportOrExportAssignment(entityName)) {
// Since we already checked for ExportAssignment, this really could only be an Import
- var importEqualsDeclaration = ts.getAncestor(entityName, 248 /* ImportEqualsDeclaration */);
+ var importEqualsDeclaration = ts.getAncestor(entityName, 249 /* ImportEqualsDeclaration */);
ts.Debug.assert(importEqualsDeclaration !== undefined);
return getSymbolOfPartOfRightHandSideOfImportEquals(entityName, /*dontResolveAlias*/ true);
}
@@ -57880,7 +58723,7 @@
if (isHeritageClauseElementIdentifier(entityName)) {
var meaning = 0 /* None */;
// In an interface or class, we're definitely interested in a type.
- if (entityName.parent.kind === 211 /* ExpressionWithTypeArguments */) {
+ if (entityName.parent.kind === 212 /* ExpressionWithTypeArguments */) {
meaning = 67897832 /* Type */;
// In a class 'extends' clause we are also looking for a value.
if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) {
@@ -57896,10 +58739,10 @@
return entityNameSymbol;
}
}
- if (entityName.parent.kind === 304 /* JSDocParameterTag */) {
+ if (entityName.parent.kind === 305 /* JSDocParameterTag */) {
return ts.getParameterSymbolFromJSDoc(entityName.parent);
}
- if (entityName.parent.kind === 150 /* TypeParameter */ && entityName.parent.parent.kind === 308 /* JSDocTemplateTag */) {
+ if (entityName.parent.kind === 151 /* TypeParameter */ && entityName.parent.parent.kind === 309 /* JSDocTemplateTag */) {
ts.Debug.assert(!ts.isInJSFile(entityName)); // Otherwise `isDeclarationName` would have been true.
var typeParameter = ts.getTypeParameterFromJsDoc(entityName.parent);
return typeParameter && typeParameter.symbol;
@@ -57909,19 +58752,19 @@
// Missing entity name.
return undefined;
}
- if (entityName.kind === 72 /* Identifier */) {
+ if (entityName.kind === 73 /* Identifier */) {
if (ts.isJSXTagName(entityName) && isJsxIntrinsicIdentifier(entityName)) {
var symbol = getIntrinsicTagSymbol(entityName.parent);
return symbol === unknownSymbol ? undefined : symbol;
}
return resolveEntityName(entityName, 67220415 /* Value */, /*ignoreErrors*/ false, /*dontResolveAlias*/ true);
}
- else if (entityName.kind === 189 /* PropertyAccessExpression */ || entityName.kind === 148 /* QualifiedName */) {
+ else if (entityName.kind === 190 /* PropertyAccessExpression */ || entityName.kind === 149 /* QualifiedName */) {
var links = getNodeLinks(entityName);
if (links.resolvedSymbol) {
return links.resolvedSymbol;
}
- if (entityName.kind === 189 /* PropertyAccessExpression */) {
+ if (entityName.kind === 190 /* PropertyAccessExpression */) {
checkPropertyAccessExpression(entityName);
}
else {
@@ -57931,17 +58774,17 @@
}
}
else if (isTypeReferenceIdentifier(entityName)) {
- var meaning = entityName.parent.kind === 164 /* TypeReference */ ? 67897832 /* Type */ : 1920 /* Namespace */;
+ var meaning = entityName.parent.kind === 165 /* TypeReference */ ? 67897832 /* Type */ : 1920 /* Namespace */;
return resolveEntityName(entityName, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true);
}
- if (entityName.parent.kind === 163 /* TypePredicate */) {
+ if (entityName.parent.kind === 164 /* TypePredicate */) {
return resolveEntityName(entityName, /*meaning*/ 1 /* FunctionScopedVariable */);
}
// Do we want to return undefined here?
return undefined;
}
function getSymbolAtLocation(node) {
- if (node.kind === 284 /* SourceFile */) {
+ if (node.kind === 285 /* SourceFile */) {
return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined;
}
var parent = node.parent;
@@ -57960,12 +58803,12 @@
else if (ts.isLiteralComputedPropertyDeclarationName(node)) {
return getSymbolOfNode(parent.parent);
}
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
if (isInRightSideOfImportOrExportAssignment(node)) {
return getSymbolOfEntityNameOrPropertyAccessExpression(node);
}
- else if (parent.kind === 186 /* BindingElement */ &&
- grandParent.kind === 184 /* ObjectBindingPattern */ &&
+ else if (parent.kind === 187 /* BindingElement */ &&
+ grandParent.kind === 185 /* ObjectBindingPattern */ &&
node === parent.propertyName) {
var typeOfPattern = getTypeOfNode(grandParent);
var propertyDeclaration = getPropertyOfType(typeOfPattern, node.escapedText);
@@ -57975,11 +58818,11 @@
}
}
switch (node.kind) {
- case 72 /* Identifier */:
- case 189 /* PropertyAccessExpression */:
- case 148 /* QualifiedName */:
+ case 73 /* Identifier */:
+ case 190 /* PropertyAccessExpression */:
+ case 149 /* QualifiedName */:
return getSymbolOfEntityNameOrPropertyAccessExpression(node);
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false);
if (ts.isFunctionLike(container)) {
var sig = getSignatureFromDeclaration(container);
@@ -57991,14 +58834,14 @@
return checkExpression(node).symbol;
}
// falls through
- case 178 /* ThisType */:
+ case 179 /* ThisType */:
return getTypeFromThisTypeNode(node).symbol;
- case 98 /* SuperKeyword */:
+ case 99 /* SuperKeyword */:
return checkExpression(node).symbol;
- case 124 /* ConstructorKeyword */:
+ case 125 /* ConstructorKeyword */:
// constructor keyword for an overload, should take us to the definition if it exist
var constructorDeclaration = node.parent;
- if (constructorDeclaration && constructorDeclaration.kind === 157 /* Constructor */) {
+ if (constructorDeclaration && constructorDeclaration.kind === 158 /* Constructor */) {
return constructorDeclaration.parent.symbol;
}
return undefined;
@@ -58009,7 +58852,7 @@
// 3). Dynamic import call or require in javascript
// 4). type A = import("./f/*gotToDefinitionHere*/oo")
if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) ||
- ((node.parent.kind === 249 /* ImportDeclaration */ || node.parent.kind === 255 /* ExportDeclaration */) && node.parent.moduleSpecifier === node) ||
+ ((node.parent.kind === 250 /* ImportDeclaration */ || node.parent.kind === 256 /* ExportDeclaration */) && node.parent.moduleSpecifier === node) ||
((ts.isInJSFile(node) && ts.isRequireCall(node.parent, /*checkArgumentIsStringLiteralLike*/ false)) || ts.isImportCall(node.parent)) ||
(ts.isLiteralTypeNode(node.parent) && ts.isLiteralImportTypeNode(node.parent.parent) && node.parent.parent.argument === node.parent)) {
return resolveExternalModuleName(node, node);
@@ -58026,21 +58869,21 @@
? getTypeFromTypeNode(grandParent.objectType)
: undefined;
return objectType && getPropertyOfType(objectType, ts.escapeLeadingUnderscores(node.text));
- case 80 /* DefaultKeyword */:
- case 90 /* FunctionKeyword */:
+ case 81 /* DefaultKeyword */:
+ case 91 /* FunctionKeyword */:
case 37 /* EqualsGreaterThanToken */:
- case 76 /* ClassKeyword */:
+ case 77 /* ClassKeyword */:
return getSymbolOfNode(node.parent);
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return ts.isLiteralImportTypeNode(node) ? getSymbolAtLocation(node.argument.literal) : undefined;
- case 85 /* ExportKeyword */:
+ case 86 /* ExportKeyword */:
return ts.isExportAssignment(node.parent) ? ts.Debug.assertDefined(node.parent.symbol) : undefined;
default:
return undefined;
}
}
function getShorthandAssignmentValueSymbol(location) {
- if (location && location.kind === 276 /* ShorthandPropertyAssignment */) {
+ if (location && location.kind === 277 /* ShorthandPropertyAssignment */) {
return resolveEntityName(location.name, 67220415 /* Value */ | 2097152 /* Alias */);
}
return undefined;
@@ -58107,33 +58950,35 @@
// }
// [ a ] from
// [a] = [ some array ...]
- function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr) {
- ts.Debug.assert(expr.kind === 188 /* ObjectLiteralExpression */ || expr.kind === 187 /* ArrayLiteralExpression */);
+ function getTypeOfAssignmentPattern(expr) {
+ ts.Debug.assert(expr.kind === 189 /* ObjectLiteralExpression */ || expr.kind === 188 /* ArrayLiteralExpression */);
// If this is from "for of"
// for ( { a } of elems) {
// }
- if (expr.parent.kind === 227 /* ForOfStatement */) {
+ if (expr.parent.kind === 228 /* ForOfStatement */) {
var iteratedType = checkRightHandSideOfForOf(expr.parent.expression, expr.parent.awaitModifier);
return checkDestructuringAssignment(expr, iteratedType || errorType);
}
// If this is from "for" initializer
// for ({a } = elems[0];.....) { }
- if (expr.parent.kind === 204 /* BinaryExpression */) {
+ if (expr.parent.kind === 205 /* BinaryExpression */) {
var iteratedType = getTypeOfExpression(expr.parent.right);
return checkDestructuringAssignment(expr, iteratedType || errorType);
}
// If this is from nested object binding pattern
// for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) {
- if (expr.parent.kind === 275 /* PropertyAssignment */) {
- var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent);
- return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || errorType, expr.parent); // TODO: GH#18217
+ if (expr.parent.kind === 276 /* PropertyAssignment */) {
+ var node_3 = ts.cast(expr.parent.parent, ts.isObjectLiteralExpression);
+ var typeOfParentObjectLiteral = getTypeOfAssignmentPattern(node_3) || errorType;
+ var propertyIndex = ts.indexOfNode(node_3.properties, expr.parent);
+ return checkObjectLiteralDestructuringPropertyAssignment(node_3, typeOfParentObjectLiteral, propertyIndex);
}
// Array literal assignment - array destructuring pattern
- ts.Debug.assert(expr.parent.kind === 187 /* ArrayLiteralExpression */);
+ var node = ts.cast(expr.parent, ts.isArrayLiteralExpression);
// [{ property1: p1, property2 }] = elems;
- var typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent);
- var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || errorType, expr.parent, /*allowStringInput*/ false, /*allowAsyncIterables*/ false) || errorType;
- return checkArrayLiteralDestructuringElementAssignment(expr.parent, typeOfArrayLiteral, expr.parent.elements.indexOf(expr), elementType || errorType); // TODO: GH#18217
+ var typeOfArrayLiteral = getTypeOfAssignmentPattern(node) || errorType;
+ var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral, expr.parent, /*allowStringInput*/ false, /*allowAsyncIterables*/ false) || errorType;
+ return checkArrayLiteralDestructuringElementAssignment(node, typeOfArrayLiteral, node.elements.indexOf(expr), elementType);
}
// Gets the property symbol corresponding to the property in destructuring assignment
// 'property1' from
@@ -58143,7 +58988,7 @@
// [a] = [ property1, property2 ]
function getPropertySymbolOfDestructuringAssignment(location) {
// Get the type of the object or array literal and then look for property of given name in the type
- var typeOfObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(location.parent.parent);
+ var typeOfObjectLiteral = getTypeOfAssignmentPattern(ts.cast(location.parent.parent, ts.isAssignmentPattern));
return typeOfObjectLiteral && getPropertyOfType(typeOfObjectLiteral, location.escapedText);
}
function getRegularTypeOfExpression(expr) {
@@ -58165,12 +59010,12 @@
function getClassElementPropertyKeyType(element) {
var name = element.name;
switch (name.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return getLiteralType(ts.idText(name));
case 8 /* NumericLiteral */:
case 10 /* StringLiteral */:
return getLiteralType(name.text);
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
var nameType = checkComputedPropertyName(name);
return isTypeAssignableToKind(nameType, 12288 /* ESSymbolLike */) ? nameType : stringType;
default:
@@ -58227,7 +59072,7 @@
if (!ts.isGeneratedIdentifier(nodeIn)) {
var node = ts.getParseTreeNode(nodeIn, ts.isIdentifier);
if (node) {
- var isPropertyName_1 = node.parent.kind === 189 /* PropertyAccessExpression */ && node.parent.name === node;
+ var isPropertyName_1 = node.parent.kind === 190 /* PropertyAccessExpression */ && node.parent.name === node;
return !isPropertyName_1 && getReferencedValueSymbol(node) === argumentsSymbol;
}
}
@@ -58283,7 +59128,7 @@
}
var parentSymbol_1 = getParentOfSymbol(symbol);
if (parentSymbol_1) {
- if (parentSymbol_1.flags & 512 /* ValueModule */ && parentSymbol_1.valueDeclaration.kind === 284 /* SourceFile */) {
+ if (parentSymbol_1.flags & 512 /* ValueModule */ && parentSymbol_1.valueDeclaration.kind === 285 /* SourceFile */) {
var symbolFile = parentSymbol_1.valueDeclaration;
var referenceFile = ts.getSourceFileOfNode(node);
// If `node` accesses an export and that export isn't in the same file, then symbol is a namespace export, so return undefined.
@@ -58309,12 +59154,16 @@
}
return undefined;
}
+ function isSymbolOfDestructuredElementOfCatchBinding(symbol) {
+ return ts.isBindingElement(symbol.valueDeclaration)
+ && ts.walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 275 /* CatchClause */;
+ }
function isSymbolOfDeclarationWithCollidingName(symbol) {
if (symbol.flags & 418 /* BlockScoped */ && !ts.isSourceFile(symbol.valueDeclaration)) {
var links = getSymbolLinks(symbol);
if (links.isDeclarationWithCollidingName === undefined) {
var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration);
- if (ts.isStatementWithLocals(container)) {
+ if (ts.isStatementWithLocals(container) || isSymbolOfDestructuredElementOfCatchBinding(symbol)) {
var nodeLinks_1 = getNodeLinks(symbol.valueDeclaration);
if (resolveName(container.parent, symbol.escapedName, 67220415 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)) {
// redeclaration - always should be renamed
@@ -58338,7 +59187,7 @@
// they will not collide with anything
var isDeclaredInLoop = nodeLinks_1.flags & 524288 /* BlockScopedBindingInLoop */;
var inLoopInitializer = ts.isIterationStatement(container, /*lookInLabeledStatements*/ false);
- var inLoopBodyBlock = container.kind === 218 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false);
+ var inLoopBodyBlock = container.kind === 219 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false);
links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock));
}
else {
@@ -58379,18 +59228,18 @@
}
function isValueAliasDeclaration(node) {
switch (node.kind) {
- case 248 /* ImportEqualsDeclaration */:
- case 250 /* ImportClause */:
- case 251 /* NamespaceImport */:
- case 253 /* ImportSpecifier */:
- case 257 /* ExportSpecifier */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 251 /* ImportClause */:
+ case 252 /* NamespaceImport */:
+ case 254 /* ImportSpecifier */:
+ case 258 /* ExportSpecifier */:
return isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
var exportClause = node.exportClause;
return !!exportClause && ts.some(exportClause.elements, isValueAliasDeclaration);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return node.expression
- && node.expression.kind === 72 /* Identifier */
+ && node.expression.kind === 73 /* Identifier */
? isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol)
: true;
}
@@ -58398,7 +59247,7 @@
}
function isTopLevelValueImportEqualsWithEntityName(nodeIn) {
var node = ts.getParseTreeNode(nodeIn, ts.isImportEqualsDeclaration);
- if (node === undefined || node.parent.kind !== 284 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) {
+ if (node === undefined || node.parent.kind !== 285 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) {
// parent is not source file or it is not reference to internal module
return false;
}
@@ -58499,15 +59348,15 @@
}
function canHaveConstantValue(node) {
switch (node.kind) {
- case 278 /* EnumMember */:
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 279 /* EnumMember */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return true;
}
return false;
}
function getConstantValue(node) {
- if (node.kind === 278 /* EnumMember */) {
+ if (node.kind === 279 /* EnumMember */) {
return getEnumMemberValue(node);
}
var symbol = getNodeLinks(node).resolvedSymbol;
@@ -58592,7 +59441,7 @@
function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, tracker, addUndefined) {
var declaration = ts.getParseTreeNode(declarationIn, ts.isVariableLikeOrAccessor);
if (!declaration) {
- return ts.createToken(120 /* AnyKeyword */);
+ return ts.createToken(121 /* AnyKeyword */);
}
// Get type of the symbol if this is the valid symbol otherwise get type at location
var symbol = getSymbolOfNode(declaration);
@@ -58611,7 +59460,7 @@
function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, tracker) {
var signatureDeclaration = ts.getParseTreeNode(signatureDeclarationIn, ts.isFunctionLike);
if (!signatureDeclaration) {
- return ts.createToken(120 /* AnyKeyword */);
+ return ts.createToken(121 /* AnyKeyword */);
}
var signature = getSignatureFromDeclaration(signatureDeclaration);
return nodeBuilder.typeToTypeNode(getReturnTypeOfSignature(signature), enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
@@ -58619,7 +59468,7 @@
function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) {
var expr = ts.getParseTreeNode(exprIn, ts.isExpression);
if (!expr) {
- return ts.createToken(120 /* AnyKeyword */);
+ return ts.createToken(121 /* AnyKeyword */);
}
var type = getWidenedType(getRegularTypeOfExpression(expr));
return nodeBuilder.typeToTypeNode(type, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
@@ -58738,17 +59587,17 @@
isLateBound: function (nodeIn) {
var node = ts.getParseTreeNode(nodeIn, ts.isDeclaration);
var symbol = node && getSymbolOfNode(node);
- return !!(symbol && ts.getCheckFlags(symbol) & 2048 /* Late */);
+ return !!(symbol && ts.getCheckFlags(symbol) & 4096 /* Late */);
},
getJsxFactoryEntity: function (location) { return location ? (getJsxNamespace(location), (ts.getSourceFileOfNode(location).localJsxFactory || _jsxFactoryEntity)) : _jsxFactoryEntity; },
getAllAccessorDeclarations: function (accessor) {
accessor = ts.getParseTreeNode(accessor, ts.isGetOrSetAccessorDeclaration); // TODO: GH#18217
- var otherKind = accessor.kind === 159 /* SetAccessor */ ? 158 /* GetAccessor */ : 159 /* SetAccessor */;
+ var otherKind = accessor.kind === 160 /* SetAccessor */ ? 159 /* GetAccessor */ : 160 /* SetAccessor */;
var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(accessor), otherKind);
var firstAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? otherAccessor : accessor;
var secondAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? accessor : otherAccessor;
- var setAccessor = accessor.kind === 159 /* SetAccessor */ ? accessor : otherAccessor;
- var getAccessor = accessor.kind === 158 /* GetAccessor */ ? accessor : otherAccessor;
+ var setAccessor = accessor.kind === 160 /* SetAccessor */ ? accessor : otherAccessor;
+ var getAccessor = accessor.kind === 159 /* GetAccessor */ ? accessor : otherAccessor;
return {
firstAccessor: firstAccessor,
secondAccessor: secondAccessor,
@@ -58764,7 +59613,7 @@
}
};
function isInHeritageClause(node) {
- return node.parent && node.parent.kind === 211 /* ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 273 /* HeritageClause */;
+ return node.parent && node.parent.kind === 212 /* ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 274 /* HeritageClause */;
}
// defined here to avoid outer scope pollution
function getTypeReferenceDirectivesForEntityName(node) {
@@ -58776,7 +59625,7 @@
// qualified names can only be used as types\namespaces
// identifiers are treated as values only if they appear in type queries
var meaning = 67897832 /* Type */ | 1920 /* Namespace */;
- if ((node.kind === 72 /* Identifier */ && isInTypeQuery(node)) || (node.kind === 189 /* PropertyAccessExpression */ && !isInHeritageClause(node))) {
+ if ((node.kind === 73 /* Identifier */ && isInTypeQuery(node)) || (node.kind === 190 /* PropertyAccessExpression */ && !isInHeritageClause(node))) {
meaning = 67220415 /* Value */ | 1048576 /* ExportValue */;
}
var symbol = resolveEntityName(node, meaning, /*ignoreErrors*/ true);
@@ -58827,7 +59676,7 @@
break;
}
}
- if (current.valueDeclaration && current.valueDeclaration.kind === 284 /* SourceFile */ && current.flags & 512 /* ValueModule */) {
+ if (current.valueDeclaration && current.valueDeclaration.kind === 285 /* SourceFile */ && current.flags & 512 /* ValueModule */) {
return false;
}
// check that at least one declaration of top level symbol originates from type declaration file
@@ -58855,12 +59704,12 @@
}
}
function getExternalModuleFileFromDeclaration(declaration) {
- var specifier = declaration.kind === 244 /* ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration);
+ var specifier = declaration.kind === 245 /* ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration);
var moduleSymbol = resolveExternalModuleNameWorker(specifier, specifier, /*moduleNotFoundError*/ undefined); // TODO: GH#18217
if (!moduleSymbol) {
return undefined;
}
- return ts.getDeclarationOfKind(moduleSymbol, 284 /* SourceFile */);
+ return ts.getDeclarationOfKind(moduleSymbol, 285 /* SourceFile */);
}
function initializeTypeChecker() {
// Bind all source files and propagate errors
@@ -58877,6 +59726,15 @@
continue;
}
if (!ts.isExternalOrCommonJsModule(file)) {
+ // It is an error for a non-external-module (i.e. script) to declare its own `globalThis`.
+ // We can't use `builtinGlobals` for this due to synthetic expando-namespace generation in JS files.
+ var fileGlobalThisSymbol = file.locals.get("globalThis");
+ if (fileGlobalThisSymbol) {
+ for (var _d = 0, _e = fileGlobalThisSymbol.declarations; _d < _e.length; _d++) {
+ var declaration = _e[_d];
+ diagnostics.add(ts.createDiagnosticForNode(declaration, ts.Diagnostics.Declaration_name_conflicts_with_built_in_global_identifier_0, "globalThis"));
+ }
+ }
mergeSymbolTable(globals, file.locals);
}
if (file.jsGlobalAugmentations) {
@@ -58907,10 +59765,10 @@
if (augmentations) {
// merge _global_ module augmentations.
// this needs to be done after global symbol table is initialized to make sure that all ambient modules are indexed
- for (var _d = 0, augmentations_1 = augmentations; _d < augmentations_1.length; _d++) {
- var list = augmentations_1[_d];
- for (var _e = 0, list_1 = list; _e < list_1.length; _e++) {
- var augmentation = list_1[_e];
+ for (var _f = 0, augmentations_1 = augmentations; _f < augmentations_1.length; _f++) {
+ var list = augmentations_1[_f];
+ for (var _g = 0, list_1 = list; _g < list_1.length; _g++) {
+ var augmentation = list_1[_g];
if (!ts.isGlobalScopeAugmentation(augmentation.parent))
continue;
mergeModuleAugmentation(augmentation);
@@ -58922,6 +59780,7 @@
getSymbolLinks(undefinedSymbol).type = undefinedWideningType;
getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments", /*arity*/ 0, /*reportErrors*/ true);
getSymbolLinks(unknownSymbol).type = errorType;
+ getSymbolLinks(globalThisSymbol).type = createObjectType(16 /* Anonymous */, globalThisSymbol);
// Initialize special types
globalArrayType = getGlobalType("Array", /*arity*/ 1, /*reportErrors*/ true);
globalObjectType = getGlobalType("Object", /*arity*/ 0, /*reportErrors*/ true);
@@ -58944,10 +59803,10 @@
if (augmentations) {
// merge _nonglobal_ module augmentations.
// this needs to be done after global symbol table is initialized to make sure that all ambient modules are indexed
- for (var _f = 0, augmentations_2 = augmentations; _f < augmentations_2.length; _f++) {
- var list = augmentations_2[_f];
- for (var _g = 0, list_2 = list; _g < list_2.length; _g++) {
- var augmentation = list_2[_g];
+ for (var _h = 0, augmentations_2 = augmentations; _h < augmentations_2.length; _h++) {
+ var list = augmentations_2[_h];
+ for (var _j = 0, list_2 = list; _j < list_2.length; _j++) {
+ var augmentation = list_2[_j];
if (ts.isGlobalScopeAugmentation(augmentation.parent))
continue;
mergeModuleAugmentation(augmentation);
@@ -59038,14 +59897,14 @@
return false;
}
if (!ts.nodeCanBeDecorated(node, node.parent, node.parent.parent)) {
- if (node.kind === 156 /* MethodDeclaration */ && !ts.nodeIsPresent(node.body)) {
+ if (node.kind === 157 /* MethodDeclaration */ && !ts.nodeIsPresent(node.body)) {
return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload);
}
else {
return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here);
}
}
- else if (node.kind === 158 /* GetAccessor */ || node.kind === 159 /* SetAccessor */) {
+ else if (node.kind === 159 /* GetAccessor */ || node.kind === 160 /* SetAccessor */) {
var accessors = ts.getAllAccessorDeclarations(node.parent.members, node);
if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) {
return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name);
@@ -59062,23 +59921,23 @@
var flags = 0 /* None */;
for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) {
var modifier = _a[_i];
- if (modifier.kind !== 133 /* ReadonlyKeyword */) {
- if (node.kind === 153 /* PropertySignature */ || node.kind === 155 /* MethodSignature */) {
+ if (modifier.kind !== 134 /* ReadonlyKeyword */) {
+ if (node.kind === 154 /* PropertySignature */ || node.kind === 156 /* MethodSignature */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind));
}
- if (node.kind === 162 /* IndexSignature */) {
+ if (node.kind === 163 /* IndexSignature */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind));
}
}
switch (modifier.kind) {
- case 77 /* ConstKeyword */:
- if (node.kind !== 243 /* EnumDeclaration */) {
- return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(77 /* ConstKeyword */));
+ case 78 /* ConstKeyword */:
+ if (node.kind !== 244 /* EnumDeclaration */) {
+ return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(78 /* ConstKeyword */));
}
break;
- case 115 /* PublicKeyword */:
- case 114 /* ProtectedKeyword */:
- case 113 /* PrivateKeyword */:
+ case 116 /* PublicKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 114 /* PrivateKeyword */:
var text = visibilityToString(ts.modifierToFlag(modifier.kind));
if (flags & 28 /* AccessibilityModifier */) {
return grammarErrorOnNode(modifier, ts.Diagnostics.Accessibility_modifier_already_seen);
@@ -59092,11 +59951,11 @@
else if (flags & 256 /* Async */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async");
}
- else if (node.parent.kind === 245 /* ModuleBlock */ || node.parent.kind === 284 /* SourceFile */) {
+ else if (node.parent.kind === 246 /* ModuleBlock */ || node.parent.kind === 285 /* SourceFile */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text);
}
else if (flags & 128 /* Abstract */) {
- if (modifier.kind === 113 /* PrivateKeyword */) {
+ if (modifier.kind === 114 /* PrivateKeyword */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract");
}
else {
@@ -59105,7 +59964,7 @@
}
flags |= ts.modifierToFlag(modifier.kind);
break;
- case 116 /* StaticKeyword */:
+ case 117 /* StaticKeyword */:
if (flags & 32 /* Static */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static");
}
@@ -59115,10 +59974,10 @@
else if (flags & 256 /* Async */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async");
}
- else if (node.parent.kind === 245 /* ModuleBlock */ || node.parent.kind === 284 /* SourceFile */) {
+ else if (node.parent.kind === 246 /* ModuleBlock */ || node.parent.kind === 285 /* SourceFile */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static");
}
- else if (node.kind === 151 /* Parameter */) {
+ else if (node.kind === 152 /* Parameter */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static");
}
else if (flags & 128 /* Abstract */) {
@@ -59127,18 +59986,18 @@
flags |= 32 /* Static */;
lastStatic = modifier;
break;
- case 133 /* ReadonlyKeyword */:
+ case 134 /* ReadonlyKeyword */:
if (flags & 64 /* Readonly */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly");
}
- else if (node.kind !== 154 /* PropertyDeclaration */ && node.kind !== 153 /* PropertySignature */ && node.kind !== 162 /* IndexSignature */ && node.kind !== 151 /* Parameter */) {
+ else if (node.kind !== 155 /* PropertyDeclaration */ && node.kind !== 154 /* PropertySignature */ && node.kind !== 163 /* IndexSignature */ && node.kind !== 152 /* Parameter */) {
// If node.kind === SyntaxKind.Parameter, checkParameter report an error if it's not a parameter property.
return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature);
}
flags |= 64 /* Readonly */;
lastReadonly = modifier;
break;
- case 85 /* ExportKeyword */:
+ case 86 /* ExportKeyword */:
if (flags & 1 /* Export */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "export");
}
@@ -59151,52 +60010,52 @@
else if (flags & 256 /* Async */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async");
}
- else if (node.parent.kind === 240 /* ClassDeclaration */) {
+ else if (node.parent.kind === 241 /* ClassDeclaration */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export");
}
- else if (node.kind === 151 /* Parameter */) {
+ else if (node.kind === 152 /* Parameter */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export");
}
flags |= 1 /* Export */;
break;
- case 80 /* DefaultKeyword */:
- var container = node.parent.kind === 284 /* SourceFile */ ? node.parent : node.parent.parent;
- if (container.kind === 244 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) {
+ case 81 /* DefaultKeyword */:
+ var container = node.parent.kind === 285 /* SourceFile */ ? node.parent : node.parent.parent;
+ if (container.kind === 245 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) {
return grammarErrorOnNode(modifier, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module);
}
flags |= 512 /* Default */;
break;
- case 125 /* DeclareKeyword */:
+ case 126 /* DeclareKeyword */:
if (flags & 2 /* Ambient */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare");
}
else if (flags & 256 /* Async */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async");
}
- else if (node.parent.kind === 240 /* ClassDeclaration */) {
+ else if (node.parent.kind === 241 /* ClassDeclaration */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare");
}
- else if (node.kind === 151 /* Parameter */) {
+ else if (node.kind === 152 /* Parameter */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare");
}
- else if ((node.parent.flags & 4194304 /* Ambient */) && node.parent.kind === 245 /* ModuleBlock */) {
+ else if ((node.parent.flags & 4194304 /* Ambient */) && node.parent.kind === 246 /* ModuleBlock */) {
return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context);
}
flags |= 2 /* Ambient */;
lastDeclare = modifier;
break;
- case 118 /* AbstractKeyword */:
+ case 119 /* AbstractKeyword */:
if (flags & 128 /* Abstract */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract");
}
- if (node.kind !== 240 /* ClassDeclaration */) {
- if (node.kind !== 156 /* MethodDeclaration */ &&
- node.kind !== 154 /* PropertyDeclaration */ &&
- node.kind !== 158 /* GetAccessor */ &&
- node.kind !== 159 /* SetAccessor */) {
+ if (node.kind !== 241 /* ClassDeclaration */) {
+ if (node.kind !== 157 /* MethodDeclaration */ &&
+ node.kind !== 155 /* PropertyDeclaration */ &&
+ node.kind !== 159 /* GetAccessor */ &&
+ node.kind !== 160 /* SetAccessor */) {
return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration);
}
- if (!(node.parent.kind === 240 /* ClassDeclaration */ && ts.hasModifier(node.parent, 128 /* Abstract */))) {
+ if (!(node.parent.kind === 241 /* ClassDeclaration */ && ts.hasModifier(node.parent, 128 /* Abstract */))) {
return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class);
}
if (flags & 32 /* Static */) {
@@ -59208,14 +60067,14 @@
}
flags |= 128 /* Abstract */;
break;
- case 121 /* AsyncKeyword */:
+ case 122 /* AsyncKeyword */:
if (flags & 256 /* Async */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async");
}
else if (flags & 2 /* Ambient */ || node.parent.flags & 4194304 /* Ambient */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async");
}
- else if (node.kind === 151 /* Parameter */) {
+ else if (node.kind === 152 /* Parameter */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async");
}
flags |= 256 /* Async */;
@@ -59223,7 +60082,7 @@
break;
}
}
- if (node.kind === 157 /* Constructor */) {
+ if (node.kind === 158 /* Constructor */) {
if (flags & 32 /* Static */) {
return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static");
}
@@ -59238,13 +60097,13 @@
}
return false;
}
- else if ((node.kind === 249 /* ImportDeclaration */ || node.kind === 248 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) {
+ else if ((node.kind === 250 /* ImportDeclaration */ || node.kind === 249 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) {
return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare");
}
- else if (node.kind === 151 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) {
+ else if (node.kind === 152 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) {
return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern);
}
- else if (node.kind === 151 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && node.dotDotDotToken) {
+ else if (node.kind === 152 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && node.dotDotDotToken) {
return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter);
}
if (flags & 256 /* Async */) {
@@ -59265,38 +60124,38 @@
}
function shouldReportBadModifier(node) {
switch (node.kind) {
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 157 /* Constructor */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 162 /* IndexSignature */:
- case 244 /* ModuleDeclaration */:
- case 249 /* ImportDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
- case 255 /* ExportDeclaration */:
- case 254 /* ExportAssignment */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 151 /* Parameter */:
- return false;
- default:
- if (node.parent.kind === 245 /* ModuleBlock */ || node.parent.kind === 284 /* SourceFile */) {
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 158 /* Constructor */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 163 /* IndexSignature */:
+ case 245 /* ModuleDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 256 /* ExportDeclaration */:
+ case 255 /* ExportAssignment */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 152 /* Parameter */:
+ return false;
+ default:
+ if (node.parent.kind === 246 /* ModuleBlock */ || node.parent.kind === 285 /* SourceFile */) {
return false;
}
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- return nodeHasAnyModifiersExcept(node, 121 /* AsyncKeyword */);
- case 240 /* ClassDeclaration */:
- return nodeHasAnyModifiersExcept(node, 118 /* AbstractKeyword */);
- case 241 /* InterfaceDeclaration */:
- case 219 /* VariableStatement */:
- case 242 /* TypeAliasDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ return nodeHasAnyModifiersExcept(node, 122 /* AsyncKeyword */);
+ case 241 /* ClassDeclaration */:
+ return nodeHasAnyModifiersExcept(node, 119 /* AbstractKeyword */);
+ case 242 /* InterfaceDeclaration */:
+ case 220 /* VariableStatement */:
+ case 243 /* TypeAliasDeclaration */:
return true;
- case 243 /* EnumDeclaration */:
- return nodeHasAnyModifiersExcept(node, 77 /* ConstKeyword */);
+ case 244 /* EnumDeclaration */:
+ return nodeHasAnyModifiersExcept(node, 78 /* ConstKeyword */);
default:
ts.Debug.fail();
return false;
@@ -59308,10 +60167,10 @@
}
function checkGrammarAsyncModifier(node, asyncModifier) {
switch (node.kind) {
- case 156 /* MethodDeclaration */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return false;
}
return grammarErrorOnNode(asyncModifier, ts.Diagnostics._0_modifier_cannot_be_used_here, "async");
@@ -59426,10 +60285,10 @@
if (!parameter.type) {
return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation);
}
- if (parameter.type.kind !== 138 /* StringKeyword */ && parameter.type.kind !== 135 /* NumberKeyword */) {
+ if (parameter.type.kind !== 139 /* StringKeyword */ && parameter.type.kind !== 136 /* NumberKeyword */) {
var type = getTypeFromTypeNode(parameter.type);
if (type.flags & 4 /* String */ || type.flags & 8 /* Number */) {
- return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_cannot_be_a_type_alias_Consider_writing_0_Colon_1_Colon_2_instead, ts.getTextOfNode(parameter.name), typeToString(type), typeToString(getTypeFromTypeNode(node.type)));
+ return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_cannot_be_a_type_alias_Consider_writing_0_Colon_1_Colon_2_instead, ts.getTextOfNode(parameter.name), typeToString(type), typeToString(node.type ? getTypeFromTypeNode(node.type) : anyType));
}
if (type.flags & 1048576 /* Union */ && allTypesAssignableToKind(type, 128 /* StringLiteral */, /*strict*/ true)) {
return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_cannot_be_a_union_type_Consider_using_a_mapped_object_type_instead);
@@ -59460,9 +60319,9 @@
}
function checkGrammarForOmittedArgument(args) {
if (args) {
- for (var _i = 0, args_5 = args; _i < args_5.length; _i++) {
- var arg = args_5[_i];
- if (arg.kind === 210 /* OmittedExpression */) {
+ for (var _i = 0, args_4 = args; _i < args_4.length; _i++) {
+ var arg = args_4[_i];
+ if (arg.kind === 211 /* OmittedExpression */) {
return grammarErrorAtPos(arg, arg.pos, 0, ts.Diagnostics.Argument_expression_expected);
}
}
@@ -59492,7 +60351,7 @@
if (!checkGrammarDecoratorsAndModifiers(node) && node.heritageClauses) {
for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) {
var heritageClause = _a[_i];
- if (heritageClause.token === 86 /* ExtendsKeyword */) {
+ if (heritageClause.token === 87 /* ExtendsKeyword */) {
if (seenExtendsClause) {
return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen);
}
@@ -59505,7 +60364,7 @@
seenExtendsClause = true;
}
else {
- ts.Debug.assert(heritageClause.token === 109 /* ImplementsKeyword */);
+ ts.Debug.assert(heritageClause.token === 110 /* ImplementsKeyword */);
if (seenImplementsClause) {
return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.implements_clause_already_seen);
}
@@ -59521,14 +60380,14 @@
if (node.heritageClauses) {
for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) {
var heritageClause = _a[_i];
- if (heritageClause.token === 86 /* ExtendsKeyword */) {
+ if (heritageClause.token === 87 /* ExtendsKeyword */) {
if (seenExtendsClause) {
return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen);
}
seenExtendsClause = true;
}
else {
- ts.Debug.assert(heritageClause.token === 109 /* ImplementsKeyword */);
+ ts.Debug.assert(heritageClause.token === 110 /* ImplementsKeyword */);
return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.Interface_declaration_cannot_have_implements_clause);
}
// Grammar checking heritageClause inside class declaration
@@ -59539,20 +60398,20 @@
}
function checkGrammarComputedPropertyName(node) {
// If node is not a computedPropertyName, just skip the grammar checking
- if (node.kind !== 149 /* ComputedPropertyName */) {
+ if (node.kind !== 150 /* ComputedPropertyName */) {
return false;
}
var computedPropertyName = node;
- if (computedPropertyName.expression.kind === 204 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 27 /* CommaToken */) {
+ if (computedPropertyName.expression.kind === 205 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 27 /* CommaToken */) {
return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name);
}
return false;
}
function checkGrammarForGenerator(node) {
if (node.asteriskToken) {
- ts.Debug.assert(node.kind === 239 /* FunctionDeclaration */ ||
- node.kind === 196 /* FunctionExpression */ ||
- node.kind === 156 /* MethodDeclaration */);
+ ts.Debug.assert(node.kind === 240 /* FunctionDeclaration */ ||
+ node.kind === 197 /* FunctionExpression */ ||
+ node.kind === 157 /* MethodDeclaration */);
if (node.flags & 4194304 /* Ambient */) {
return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context);
}
@@ -59578,15 +60437,22 @@
var seen = ts.createUnderscoreEscapedMap();
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var prop = _a[_i];
- if (prop.kind === 277 /* SpreadAssignment */) {
+ if (prop.kind === 278 /* SpreadAssignment */) {
+ if (inDestructuring) {
+ // a rest property cannot be destructured any further
+ var expression = ts.skipParentheses(prop.expression);
+ if (ts.isArrayLiteralExpression(expression) || ts.isObjectLiteralExpression(expression)) {
+ return grammarErrorOnNode(prop.expression, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern);
+ }
+ }
continue;
}
var name = prop.name;
- if (name.kind === 149 /* ComputedPropertyName */) {
+ if (name.kind === 150 /* ComputedPropertyName */) {
// If the name is not a ComputedPropertyName, the grammar checking will skip it
checkGrammarComputedPropertyName(name);
}
- if (prop.kind === 276 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) {
+ if (prop.kind === 277 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) {
// having objectAssignmentInitializer is only valid in ObjectAssignmentPattern
// outside of destructuring it is a syntax error
return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment);
@@ -59595,7 +60461,7 @@
if (prop.modifiers) {
for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) { // TODO: GH#19955
var mod = _c[_b];
- if (mod.kind !== 121 /* AsyncKeyword */ || prop.kind !== 156 /* MethodDeclaration */) {
+ if (mod.kind !== 122 /* AsyncKeyword */ || prop.kind !== 157 /* MethodDeclaration */) {
grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod));
}
}
@@ -59610,23 +60476,23 @@
// and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields
var currentKind = void 0;
switch (prop.kind) {
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
checkGrammarForInvalidExclamationToken(prop.exclamationToken, ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context);
/* tslint:disable:no-switch-case-fall-through */
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
// Grammar checking for computedPropertyName and shorthandPropertyAssignment
checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional);
if (name.kind === 8 /* NumericLiteral */) {
checkGrammarNumericLiteral(name);
}
// falls through
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
currentKind = 1 /* Property */;
break;
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
currentKind = 2 /* GetAccessor */;
break;
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
currentKind = 4 /* SetAccessor */;
break;
default:
@@ -59663,7 +60529,7 @@
var seen = ts.createUnderscoreEscapedMap();
for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) {
var attr = _a[_i];
- if (attr.kind === 269 /* JsxSpreadAttribute */) {
+ if (attr.kind === 270 /* JsxSpreadAttribute */) {
continue;
}
var name = attr.name, initializer = attr.initializer;
@@ -59673,7 +60539,7 @@
else {
return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name);
}
- if (initializer && initializer.kind === 270 /* JsxExpression */ && !initializer.expression) {
+ if (initializer && initializer.kind === 271 /* JsxExpression */ && !initializer.expression) {
return grammarErrorOnNode(initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression);
}
}
@@ -59682,12 +60548,25 @@
if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) {
return true;
}
- if (forInOrOfStatement.kind === 227 /* ForOfStatement */ && forInOrOfStatement.awaitModifier) {
+ if (forInOrOfStatement.kind === 228 /* ForOfStatement */ && forInOrOfStatement.awaitModifier) {
if ((forInOrOfStatement.flags & 16384 /* AwaitContext */) === 0 /* None */) {
- return grammarErrorOnNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator);
+ // use of 'for-await-of' in non-async function
+ var sourceFile = ts.getSourceFileOfNode(forInOrOfStatement);
+ if (!hasParseDiagnostics(sourceFile)) {
+ var diagnostic = ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator);
+ var func = ts.getContainingFunction(forInOrOfStatement);
+ if (func && func.kind !== 158 /* Constructor */) {
+ ts.Debug.assert((ts.getFunctionFlags(func) & 2 /* Async */) === 0, "Enclosing function should never be an async function.");
+ var relatedInfo = ts.createDiagnosticForNode(func, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async);
+ ts.addRelatedInfo(diagnostic, relatedInfo);
}
+ diagnostics.add(diagnostic);
+ return true;
+ }
+ return false;
}
- if (forInOrOfStatement.initializer.kind === 238 /* VariableDeclarationList */) {
+ }
+ if (forInOrOfStatement.initializer.kind === 239 /* VariableDeclarationList */) {
var variableList = forInOrOfStatement.initializer;
if (!checkGrammarVariableDeclarationList(variableList)) {
var declarations = variableList.declarations;
@@ -59702,20 +60581,20 @@
return false;
}
if (declarations.length > 1) {
- var diagnostic = forInOrOfStatement.kind === 226 /* ForInStatement */
+ var diagnostic = forInOrOfStatement.kind === 227 /* ForInStatement */
? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement
: ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement;
return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic);
}
var firstDeclaration = declarations[0];
if (firstDeclaration.initializer) {
- var diagnostic = forInOrOfStatement.kind === 226 /* ForInStatement */
+ var diagnostic = forInOrOfStatement.kind === 227 /* ForInStatement */
? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer
: ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer;
return grammarErrorOnNode(firstDeclaration.name, diagnostic);
}
if (firstDeclaration.type) {
- var diagnostic = forInOrOfStatement.kind === 226 /* ForInStatement */
+ var diagnostic = forInOrOfStatement.kind === 227 /* ForInStatement */
? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation
: ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation;
return grammarErrorOnNode(firstDeclaration, diagnostic);
@@ -59742,11 +60621,11 @@
return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters);
}
else if (!doesAccessorHaveCorrectParameterCount(accessor)) {
- return grammarErrorOnNode(accessor.name, kind === 158 /* GetAccessor */ ?
+ return grammarErrorOnNode(accessor.name, kind === 159 /* GetAccessor */ ?
ts.Diagnostics.A_get_accessor_cannot_have_parameters :
ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter);
}
- else if (kind === 159 /* SetAccessor */) {
+ else if (kind === 160 /* SetAccessor */) {
if (accessor.type) {
return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation);
}
@@ -59770,23 +60649,23 @@
* A set accessor has one parameter or a `this` parameter and one more parameter.
*/
function doesAccessorHaveCorrectParameterCount(accessor) {
- return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 158 /* GetAccessor */ ? 0 : 1);
+ return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 159 /* GetAccessor */ ? 0 : 1);
}
function getAccessorThisParameter(accessor) {
- if (accessor.parameters.length === (accessor.kind === 158 /* GetAccessor */ ? 1 : 2)) {
+ if (accessor.parameters.length === (accessor.kind === 159 /* GetAccessor */ ? 1 : 2)) {
return ts.getThisParameter(accessor);
}
}
function checkGrammarTypeOperatorNode(node) {
- if (node.operator === 142 /* UniqueKeyword */) {
- if (node.type.kind !== 139 /* SymbolKeyword */) {
- return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(139 /* SymbolKeyword */));
+ if (node.operator === 143 /* UniqueKeyword */) {
+ if (node.type.kind !== 140 /* SymbolKeyword */) {
+ return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(140 /* SymbolKeyword */));
}
var parent = ts.walkUpParenthesizedTypes(node.parent);
switch (parent.kind) {
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
var decl = parent;
- if (decl.name.kind !== 72 /* Identifier */) {
+ if (decl.name.kind !== 73 /* Identifier */) {
return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name);
}
if (!ts.isVariableDeclarationInVariableStatement(decl)) {
@@ -59796,13 +60675,13 @@
return grammarErrorOnNode(parent.name, ts.Diagnostics.A_variable_whose_type_is_a_unique_symbol_type_must_be_const);
}
break;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
if (!ts.hasModifier(parent, 32 /* Static */) ||
!ts.hasModifier(parent, 64 /* Readonly */)) {
return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly);
}
break;
- case 153 /* PropertySignature */:
+ case 154 /* PropertySignature */:
if (!ts.hasModifier(parent, 64 /* Readonly */)) {
return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly);
}
@@ -59811,9 +60690,9 @@
return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_are_not_allowed_here);
}
}
- else if (node.operator === 133 /* ReadonlyKeyword */) {
- if (node.type.kind !== 169 /* ArrayType */ && node.type.kind !== 170 /* TupleType */) {
- return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(139 /* SymbolKeyword */));
+ else if (node.operator === 134 /* ReadonlyKeyword */) {
+ if (node.type.kind !== 170 /* ArrayType */ && node.type.kind !== 171 /* TupleType */) {
+ return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(140 /* SymbolKeyword */));
}
}
}
@@ -59826,10 +60705,10 @@
if (checkGrammarFunctionLikeDeclaration(node)) {
return true;
}
- if (node.kind === 156 /* MethodDeclaration */) {
- if (node.parent.kind === 188 /* ObjectLiteralExpression */) {
+ if (node.kind === 157 /* MethodDeclaration */) {
+ if (node.parent.kind === 189 /* ObjectLiteralExpression */) {
// We only disallow modifier on a method declaration if it is a property of object-literal-expression
- if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 121 /* AsyncKeyword */)) {
+ if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 122 /* AsyncKeyword */)) {
return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here);
}
else if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) {
@@ -59842,6 +60721,9 @@
return grammarErrorAtPos(node, node.end - 1, ";".length, ts.Diagnostics._0_expected, "{");
}
}
+ else if (ts.isClassLike(node.parent) && ts.isStringLiteral(node.name) && node.name.text === "constructor" && (!compilerOptions.target || compilerOptions.target < 1 /* ES5 */)) {
+ return grammarErrorOnNode(node.name, ts.Diagnostics.Quoted_constructors_have_previously_been_interpreted_as_methods_which_is_incorrect_In_TypeScript_3_6_they_will_be_correctly_parsed_as_constructors_In_the_meantime_consider_using_constructor_to_write_a_constructor_or_constructor_to_write_a_method);
+ }
if (checkGrammarForGenerator(node)) {
return true;
}
@@ -59855,14 +60737,14 @@
if (node.flags & 4194304 /* Ambient */) {
return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type);
}
- else if (node.kind === 156 /* MethodDeclaration */ && !node.body) {
+ else if (node.kind === 157 /* MethodDeclaration */ && !node.body) {
return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type);
}
}
- else if (node.parent.kind === 241 /* InterfaceDeclaration */) {
+ else if (node.parent.kind === 242 /* InterfaceDeclaration */) {
return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type);
}
- else if (node.parent.kind === 168 /* TypeLiteral */) {
+ else if (node.parent.kind === 169 /* TypeLiteral */) {
return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type);
}
}
@@ -59873,11 +60755,11 @@
return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary);
}
switch (current.kind) {
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
if (node.label && current.label.escapedText === node.label.escapedText) {
// found matching label - verify that label usage is correct
// continue can only target labels that are on iteration statements
- var isMisplacedContinueLabel = node.kind === 228 /* ContinueStatement */
+ var isMisplacedContinueLabel = node.kind === 229 /* ContinueStatement */
&& !ts.isIterationStatement(current.statement, /*lookInLabeledStatement*/ true);
if (isMisplacedContinueLabel) {
return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement);
@@ -59885,8 +60767,8 @@
return false;
}
break;
- case 232 /* SwitchStatement */:
- if (node.kind === 229 /* BreakStatement */ && !node.label) {
+ case 233 /* SwitchStatement */:
+ if (node.kind === 230 /* BreakStatement */ && !node.label) {
// unlabeled break within switch statement - ok
return false;
}
@@ -59901,13 +60783,13 @@
current = current.parent;
}
if (node.label) {
- var message = node.kind === 229 /* BreakStatement */
+ var message = node.kind === 230 /* BreakStatement */
? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement
: ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement;
return grammarErrorOnNode(node, message);
}
else {
- var message = node.kind === 229 /* BreakStatement */
+ var message = node.kind === 230 /* BreakStatement */
? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement
: ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement;
return grammarErrorOnNode(node, message);
@@ -59931,12 +60813,12 @@
}
function isStringOrNumberLiteralExpression(expr) {
return expr.kind === 10 /* StringLiteral */ || expr.kind === 8 /* NumericLiteral */ ||
- expr.kind === 202 /* PrefixUnaryExpression */ && expr.operator === 39 /* MinusToken */ &&
+ expr.kind === 203 /* PrefixUnaryExpression */ && expr.operator === 39 /* MinusToken */ &&
expr.operand.kind === 8 /* NumericLiteral */;
}
function isBigIntLiteralExpression(expr) {
return expr.kind === 9 /* BigIntLiteral */ ||
- expr.kind === 202 /* PrefixUnaryExpression */ && expr.operator === 39 /* MinusToken */ &&
+ expr.kind === 203 /* PrefixUnaryExpression */ && expr.operator === 39 /* MinusToken */ &&
expr.operand.kind === 9 /* BigIntLiteral */;
}
function isSimpleLiteralEnumReference(expr) {
@@ -59949,7 +60831,7 @@
if (initializer) {
var isInvalidInitializer = !(isStringOrNumberLiteralExpression(initializer) ||
isSimpleLiteralEnumReference(initializer) ||
- initializer.kind === 102 /* TrueKeyword */ || initializer.kind === 87 /* FalseKeyword */ ||
+ initializer.kind === 103 /* TrueKeyword */ || initializer.kind === 88 /* FalseKeyword */ ||
isBigIntLiteralExpression(initializer));
var isConstOrReadonly = ts.isDeclarationReadonly(node) || ts.isVariableDeclaration(node) && ts.isVarConst(node);
if (isConstOrReadonly && !node.type) {
@@ -59966,7 +60848,7 @@
}
}
function checkGrammarVariableDeclaration(node) {
- if (node.parent.parent.kind !== 226 /* ForInStatement */ && node.parent.parent.kind !== 227 /* ForOfStatement */) {
+ if (node.parent.parent.kind !== 227 /* ForInStatement */ && node.parent.parent.kind !== 228 /* ForOfStatement */) {
if (node.flags & 4194304 /* Ambient */) {
checkAmbientInitializer(node);
}
@@ -59979,8 +60861,8 @@
}
}
}
- if (node.exclamationToken && (node.parent.parent.kind !== 219 /* VariableStatement */ || !node.type || node.initializer || node.flags & 4194304 /* Ambient */)) {
- return grammarErrorOnNode(node.exclamationToken, ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context);
+ if (node.exclamationToken && (node.parent.parent.kind !== 220 /* VariableStatement */ || !node.type || node.initializer || node.flags & 4194304 /* Ambient */)) {
+ return grammarErrorOnNode(node.exclamationToken, ts.Diagnostics.Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation);
}
if (compilerOptions.module !== ts.ModuleKind.ES2015 && compilerOptions.module !== ts.ModuleKind.ESNext && compilerOptions.module !== ts.ModuleKind.System && !compilerOptions.noEmit &&
!(node.parent.parent.flags & 4194304 /* Ambient */) && ts.hasModifier(node.parent.parent, 1 /* Export */)) {
@@ -59996,7 +60878,7 @@
return checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name);
}
function checkESModuleMarker(name) {
- if (name.kind === 72 /* Identifier */) {
+ if (name.kind === 73 /* Identifier */) {
if (ts.idText(name) === "__esModule") {
return grammarErrorOnNode(name, ts.Diagnostics.Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules);
}
@@ -60013,8 +60895,8 @@
return false;
}
function checkGrammarNameInLetOrConstDeclarations(name) {
- if (name.kind === 72 /* Identifier */) {
- if (name.originalKeywordKind === 111 /* LetKeyword */) {
+ if (name.kind === 73 /* Identifier */) {
+ if (name.originalKeywordKind === 112 /* LetKeyword */) {
return grammarErrorOnNode(name, ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations);
}
}
@@ -60041,15 +60923,15 @@
}
function allowLetAndConstDeclarations(parent) {
switch (parent.kind) {
- case 222 /* IfStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
- case 231 /* WithStatement */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 223 /* IfStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
+ case 232 /* WithStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
return false;
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return allowLetAndConstDeclarations(parent.parent);
}
return true;
@@ -60067,12 +60949,12 @@
function checkGrammarMetaProperty(node) {
var escapedText = node.name.escapedText;
switch (node.keywordToken) {
- case 95 /* NewKeyword */:
+ case 96 /* NewKeyword */:
if (escapedText !== "target") {
return grammarErrorOnNode(node.name, ts.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.escapedText, ts.tokenToString(node.keywordToken), "target");
}
break;
- case 92 /* ImportKeyword */:
+ case 93 /* ImportKeyword */:
if (escapedText !== "meta") {
return grammarErrorOnNode(node.name, ts.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.escapedText, ts.tokenToString(node.keywordToken), "meta");
}
@@ -60123,11 +61005,14 @@
}
function checkGrammarProperty(node) {
if (ts.isClassLike(node.parent)) {
+ if (ts.isStringLiteral(node.name) && node.name.text === "constructor") {
+ return grammarErrorOnNode(node.name, ts.Diagnostics.Classes_may_not_have_a_field_named_constructor);
+ }
if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) {
return true;
}
}
- else if (node.parent.kind === 241 /* InterfaceDeclaration */) {
+ else if (node.parent.kind === 242 /* InterfaceDeclaration */) {
if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) {
return true;
}
@@ -60135,7 +61020,7 @@
return grammarErrorOnNode(node.initializer, ts.Diagnostics.An_interface_property_cannot_have_an_initializer);
}
}
- else if (node.parent.kind === 168 /* TypeLiteral */) {
+ else if (node.parent.kind === 169 /* TypeLiteral */) {
if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) {
return true;
}
@@ -60164,22 +61049,22 @@
// export_opt AmbientDeclaration
//
// TODO: The spec needs to be amended to reflect this grammar.
- if (node.kind === 241 /* InterfaceDeclaration */ ||
- node.kind === 242 /* TypeAliasDeclaration */ ||
- node.kind === 249 /* ImportDeclaration */ ||
- node.kind === 248 /* ImportEqualsDeclaration */ ||
- node.kind === 255 /* ExportDeclaration */ ||
- node.kind === 254 /* ExportAssignment */ ||
- node.kind === 247 /* NamespaceExportDeclaration */ ||
+ if (node.kind === 242 /* InterfaceDeclaration */ ||
+ node.kind === 243 /* TypeAliasDeclaration */ ||
+ node.kind === 250 /* ImportDeclaration */ ||
+ node.kind === 249 /* ImportEqualsDeclaration */ ||
+ node.kind === 256 /* ExportDeclaration */ ||
+ node.kind === 255 /* ExportAssignment */ ||
+ node.kind === 248 /* NamespaceExportDeclaration */ ||
ts.hasModifier(node, 2 /* Ambient */ | 1 /* Export */ | 512 /* Default */)) {
return false;
}
- return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file);
+ return grammarErrorOnFirstToken(node, ts.Diagnostics.Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier);
}
function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) {
for (var _i = 0, _a = file.statements; _i < _a.length; _i++) {
var decl = _a[_i];
- if (ts.isDeclaration(decl) || decl.kind === 219 /* VariableStatement */) {
+ if (ts.isDeclaration(decl) || decl.kind === 220 /* VariableStatement */) {
if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) {
return true;
}
@@ -60206,7 +61091,7 @@
// to prevent noisiness. So use a bit on the block to indicate if
// this has already been reported, and don't report if it has.
//
- if (node.parent.kind === 218 /* Block */ || node.parent.kind === 245 /* ModuleBlock */ || node.parent.kind === 284 /* SourceFile */) {
+ if (node.parent.kind === 219 /* Block */ || node.parent.kind === 246 /* ModuleBlock */ || node.parent.kind === 285 /* SourceFile */) {
var links_2 = getNodeLinks(node.parent);
// Check if the containing block ever report this error
if (!links_2.hasReportedStatementInAmbientContext) {
@@ -60228,10 +61113,10 @@
if (languageVersion >= 1 /* ES5 */) {
diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0;
}
- else if (ts.isChildOfNodeWithKind(node, 182 /* LiteralType */)) {
+ else if (ts.isChildOfNodeWithKind(node, 183 /* LiteralType */)) {
diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0;
}
- else if (ts.isChildOfNodeWithKind(node, 278 /* EnumMember */)) {
+ else if (ts.isChildOfNodeWithKind(node, 279 /* EnumMember */)) {
diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0;
}
if (diagnosticMessage) {
@@ -60246,7 +61131,7 @@
var literalType = ts.isLiteralTypeNode(node.parent) ||
ts.isPrefixUnaryExpression(node.parent) && ts.isLiteralTypeNode(node.parent.parent);
if (!literalType) {
- if (languageVersion < 7 /* ESNext */) {
+ if (languageVersion < 8 /* ESNext */) {
if (grammarErrorOnNode(node, ts.Diagnostics.BigInt_literals_are_not_available_when_targeting_lower_than_ESNext)) {
return true;
}
@@ -60299,8 +61184,8 @@
/** Like 'isDeclarationName', but returns true for LHS of `import { x as y }` or `export { x as y }`. */
function isDeclarationNameOrImportPropertyName(name) {
switch (name.parent.kind) {
- case 253 /* ImportSpecifier */:
- case 257 /* ExportSpecifier */:
+ case 254 /* ImportSpecifier */:
+ case 258 /* ExportSpecifier */:
return ts.isIdentifier(name);
default:
return ts.isDeclarationName(name);
@@ -60308,14 +61193,14 @@
}
function isSomeImportDeclaration(decl) {
switch (decl.kind) {
- case 250 /* ImportClause */: // For default import
- case 248 /* ImportEqualsDeclaration */:
- case 251 /* NamespaceImport */:
- case 253 /* ImportSpecifier */: // For rename import `x as y`
+ case 251 /* ImportClause */: // For default import
+ case 249 /* ImportEqualsDeclaration */:
+ case 252 /* NamespaceImport */:
+ case 254 /* ImportSpecifier */: // For rename import `x as y`
return true;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
// For regular import, `decl` is an Identifier under the ImportSpecifier.
- return decl.parent.kind === 253 /* ImportSpecifier */;
+ return decl.parent.kind === 254 /* ImportSpecifier */;
default:
return false;
}
@@ -60443,7 +61328,7 @@
return node;
}
function createIdentifier(text, typeArguments) {
- var node = createSynthesizedNode(72 /* Identifier */);
+ var node = createSynthesizedNode(73 /* Identifier */);
node.escapedText = ts.escapeLeadingUnderscores(text);
node.originalKeywordKind = text ? ts.stringToToken(text) : 0 /* Unknown */;
node.autoGenerateFlags = 0 /* None */;
@@ -60524,23 +61409,23 @@
ts.createToken = createToken;
// Reserved words
function createSuper() {
- return createSynthesizedNode(98 /* SuperKeyword */);
+ return createSynthesizedNode(99 /* SuperKeyword */);
}
ts.createSuper = createSuper;
function createThis() {
- return createSynthesizedNode(100 /* ThisKeyword */);
+ return createSynthesizedNode(101 /* ThisKeyword */);
}
ts.createThis = createThis;
function createNull() {
- return createSynthesizedNode(96 /* NullKeyword */);
+ return createSynthesizedNode(97 /* NullKeyword */);
}
ts.createNull = createNull;
function createTrue() {
- return createSynthesizedNode(102 /* TrueKeyword */);
+ return createSynthesizedNode(103 /* TrueKeyword */);
}
ts.createTrue = createTrue;
function createFalse() {
- return createSynthesizedNode(87 /* FalseKeyword */);
+ return createSynthesizedNode(88 /* FalseKeyword */);
}
ts.createFalse = createFalse;
// Modifiers
@@ -60551,44 +61436,44 @@
function createModifiersFromModifierFlags(flags) {
var result = [];
if (flags & 1 /* Export */) {
- result.push(createModifier(85 /* ExportKeyword */));
+ result.push(createModifier(86 /* ExportKeyword */));
}
if (flags & 2 /* Ambient */) {
- result.push(createModifier(125 /* DeclareKeyword */));
+ result.push(createModifier(126 /* DeclareKeyword */));
}
if (flags & 512 /* Default */) {
- result.push(createModifier(80 /* DefaultKeyword */));
+ result.push(createModifier(81 /* DefaultKeyword */));
}
if (flags & 2048 /* Const */) {
- result.push(createModifier(77 /* ConstKeyword */));
+ result.push(createModifier(78 /* ConstKeyword */));
}
if (flags & 4 /* Public */) {
- result.push(createModifier(115 /* PublicKeyword */));
+ result.push(createModifier(116 /* PublicKeyword */));
}
if (flags & 8 /* Private */) {
- result.push(createModifier(113 /* PrivateKeyword */));
+ result.push(createModifier(114 /* PrivateKeyword */));
}
if (flags & 16 /* Protected */) {
- result.push(createModifier(114 /* ProtectedKeyword */));
+ result.push(createModifier(115 /* ProtectedKeyword */));
}
if (flags & 128 /* Abstract */) {
- result.push(createModifier(118 /* AbstractKeyword */));
+ result.push(createModifier(119 /* AbstractKeyword */));
}
if (flags & 32 /* Static */) {
- result.push(createModifier(116 /* StaticKeyword */));
+ result.push(createModifier(117 /* StaticKeyword */));
}
if (flags & 64 /* Readonly */) {
- result.push(createModifier(133 /* ReadonlyKeyword */));
+ result.push(createModifier(134 /* ReadonlyKeyword */));
}
if (flags & 256 /* Async */) {
- result.push(createModifier(121 /* AsyncKeyword */));
+ result.push(createModifier(122 /* AsyncKeyword */));
}
return result;
}
ts.createModifiersFromModifierFlags = createModifiersFromModifierFlags;
// Names
function createQualifiedName(left, right) {
- var node = createSynthesizedNode(148 /* QualifiedName */);
+ var node = createSynthesizedNode(149 /* QualifiedName */);
node.left = left;
node.right = asName(right);
return node;
@@ -60607,7 +61492,7 @@
: expression;
}
function createComputedPropertyName(expression) {
- var node = createSynthesizedNode(149 /* ComputedPropertyName */);
+ var node = createSynthesizedNode(150 /* ComputedPropertyName */);
node.expression = parenthesizeForComputedName(expression);
return node;
}
@@ -60620,7 +61505,7 @@
ts.updateComputedPropertyName = updateComputedPropertyName;
// Signature elements
function createTypeParameterDeclaration(name, constraint, defaultType) {
- var node = createSynthesizedNode(150 /* TypeParameter */);
+ var node = createSynthesizedNode(151 /* TypeParameter */);
node.name = asName(name);
node.constraint = constraint;
node.default = defaultType;
@@ -60636,7 +61521,7 @@
}
ts.updateTypeParameterDeclaration = updateTypeParameterDeclaration;
function createParameter(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer) {
- var node = createSynthesizedNode(151 /* Parameter */);
+ var node = createSynthesizedNode(152 /* Parameter */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.dotDotDotToken = dotDotDotToken;
@@ -60660,7 +61545,7 @@
}
ts.updateParameter = updateParameter;
function createDecorator(expression) {
- var node = createSynthesizedNode(152 /* Decorator */);
+ var node = createSynthesizedNode(153 /* Decorator */);
node.expression = ts.parenthesizeForAccess(expression);
return node;
}
@@ -60673,7 +61558,7 @@
ts.updateDecorator = updateDecorator;
// Type Elements
function createPropertySignature(modifiers, name, questionToken, type, initializer) {
- var node = createSynthesizedNode(153 /* PropertySignature */);
+ var node = createSynthesizedNode(154 /* PropertySignature */);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
node.questionToken = questionToken;
@@ -60693,7 +61578,7 @@
}
ts.updatePropertySignature = updatePropertySignature;
function createProperty(decorators, modifiers, name, questionOrExclamationToken, type, initializer) {
- var node = createSynthesizedNode(154 /* PropertyDeclaration */);
+ var node = createSynthesizedNode(155 /* PropertyDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -60717,7 +61602,7 @@
}
ts.updateProperty = updateProperty;
function createMethodSignature(typeParameters, parameters, type, name, questionToken) {
- var node = createSignatureDeclaration(155 /* MethodSignature */, typeParameters, parameters, type);
+ var node = createSignatureDeclaration(156 /* MethodSignature */, typeParameters, parameters, type);
node.name = asName(name);
node.questionToken = questionToken;
return node;
@@ -60734,7 +61619,7 @@
}
ts.updateMethodSignature = updateMethodSignature;
function createMethod(decorators, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) {
- var node = createSynthesizedNode(156 /* MethodDeclaration */);
+ var node = createSynthesizedNode(157 /* MethodDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.asteriskToken = asteriskToken;
@@ -60762,7 +61647,7 @@
}
ts.updateMethod = updateMethod;
function createConstructor(decorators, modifiers, parameters, body) {
- var node = createSynthesizedNode(157 /* Constructor */);
+ var node = createSynthesizedNode(158 /* Constructor */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.typeParameters = undefined;
@@ -60782,7 +61667,7 @@
}
ts.updateConstructor = updateConstructor;
function createGetAccessor(decorators, modifiers, name, parameters, type, body) {
- var node = createSynthesizedNode(158 /* GetAccessor */);
+ var node = createSynthesizedNode(159 /* GetAccessor */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -60805,7 +61690,7 @@
}
ts.updateGetAccessor = updateGetAccessor;
function createSetAccessor(decorators, modifiers, name, parameters, body) {
- var node = createSynthesizedNode(159 /* SetAccessor */);
+ var node = createSynthesizedNode(160 /* SetAccessor */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -60826,7 +61711,7 @@
}
ts.updateSetAccessor = updateSetAccessor;
function createCallSignature(typeParameters, parameters, type) {
- return createSignatureDeclaration(160 /* CallSignature */, typeParameters, parameters, type);
+ return createSignatureDeclaration(161 /* CallSignature */, typeParameters, parameters, type);
}
ts.createCallSignature = createCallSignature;
function updateCallSignature(node, typeParameters, parameters, type) {
@@ -60834,7 +61719,7 @@
}
ts.updateCallSignature = updateCallSignature;
function createConstructSignature(typeParameters, parameters, type) {
- return createSignatureDeclaration(161 /* ConstructSignature */, typeParameters, parameters, type);
+ return createSignatureDeclaration(162 /* ConstructSignature */, typeParameters, parameters, type);
}
ts.createConstructSignature = createConstructSignature;
function updateConstructSignature(node, typeParameters, parameters, type) {
@@ -60842,7 +61727,7 @@
}
ts.updateConstructSignature = updateConstructSignature;
function createIndexSignature(decorators, modifiers, parameters, type) {
- var node = createSynthesizedNode(162 /* IndexSignature */);
+ var node = createSynthesizedNode(163 /* IndexSignature */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.parameters = createNodeArray(parameters);
@@ -60882,7 +61767,7 @@
}
ts.createKeywordTypeNode = createKeywordTypeNode;
function createTypePredicateNode(parameterName, type) {
- var node = createSynthesizedNode(163 /* TypePredicate */);
+ var node = createSynthesizedNode(164 /* TypePredicate */);
node.parameterName = asName(parameterName);
node.type = type;
return node;
@@ -60896,7 +61781,7 @@
}
ts.updateTypePredicateNode = updateTypePredicateNode;
function createTypeReferenceNode(typeName, typeArguments) {
- var node = createSynthesizedNode(164 /* TypeReference */);
+ var node = createSynthesizedNode(165 /* TypeReference */);
node.typeName = asName(typeName);
node.typeArguments = typeArguments && ts.parenthesizeTypeParameters(typeArguments);
return node;
@@ -60910,7 +61795,7 @@
}
ts.updateTypeReferenceNode = updateTypeReferenceNode;
function createFunctionTypeNode(typeParameters, parameters, type) {
- return createSignatureDeclaration(165 /* FunctionType */, typeParameters, parameters, type);
+ return createSignatureDeclaration(166 /* FunctionType */, typeParameters, parameters, type);
}
ts.createFunctionTypeNode = createFunctionTypeNode;
function updateFunctionTypeNode(node, typeParameters, parameters, type) {
@@ -60918,7 +61803,7 @@
}
ts.updateFunctionTypeNode = updateFunctionTypeNode;
function createConstructorTypeNode(typeParameters, parameters, type) {
- return createSignatureDeclaration(166 /* ConstructorType */, typeParameters, parameters, type);
+ return createSignatureDeclaration(167 /* ConstructorType */, typeParameters, parameters, type);
}
ts.createConstructorTypeNode = createConstructorTypeNode;
function updateConstructorTypeNode(node, typeParameters, parameters, type) {
@@ -60926,7 +61811,7 @@
}
ts.updateConstructorTypeNode = updateConstructorTypeNode;
function createTypeQueryNode(exprName) {
- var node = createSynthesizedNode(167 /* TypeQuery */);
+ var node = createSynthesizedNode(168 /* TypeQuery */);
node.exprName = exprName;
return node;
}
@@ -60938,7 +61823,7 @@
}
ts.updateTypeQueryNode = updateTypeQueryNode;
function createTypeLiteralNode(members) {
- var node = createSynthesizedNode(168 /* TypeLiteral */);
+ var node = createSynthesizedNode(169 /* TypeLiteral */);
node.members = createNodeArray(members);
return node;
}
@@ -60950,7 +61835,7 @@
}
ts.updateTypeLiteralNode = updateTypeLiteralNode;
function createArrayTypeNode(elementType) {
- var node = createSynthesizedNode(169 /* ArrayType */);
+ var node = createSynthesizedNode(170 /* ArrayType */);
node.elementType = ts.parenthesizeArrayTypeMember(elementType);
return node;
}
@@ -60962,7 +61847,7 @@
}
ts.updateArrayTypeNode = updateArrayTypeNode;
function createTupleTypeNode(elementTypes) {
- var node = createSynthesizedNode(170 /* TupleType */);
+ var node = createSynthesizedNode(171 /* TupleType */);
node.elementTypes = createNodeArray(elementTypes);
return node;
}
@@ -60974,7 +61859,7 @@
}
ts.updateTupleTypeNode = updateTupleTypeNode;
function createOptionalTypeNode(type) {
- var node = createSynthesizedNode(171 /* OptionalType */);
+ var node = createSynthesizedNode(172 /* OptionalType */);
node.type = ts.parenthesizeArrayTypeMember(type);
return node;
}
@@ -60986,7 +61871,7 @@
}
ts.updateOptionalTypeNode = updateOptionalTypeNode;
function createRestTypeNode(type) {
- var node = createSynthesizedNode(172 /* RestType */);
+ var node = createSynthesizedNode(173 /* RestType */);
node.type = type;
return node;
}
@@ -60998,7 +61883,7 @@
}
ts.updateRestTypeNode = updateRestTypeNode;
function createUnionTypeNode(types) {
- return createUnionOrIntersectionTypeNode(173 /* UnionType */, types);
+ return createUnionOrIntersectionTypeNode(174 /* UnionType */, types);
}
ts.createUnionTypeNode = createUnionTypeNode;
function updateUnionTypeNode(node, types) {
@@ -61006,7 +61891,7 @@
}
ts.updateUnionTypeNode = updateUnionTypeNode;
function createIntersectionTypeNode(types) {
- return createUnionOrIntersectionTypeNode(174 /* IntersectionType */, types);
+ return createUnionOrIntersectionTypeNode(175 /* IntersectionType */, types);
}
ts.createIntersectionTypeNode = createIntersectionTypeNode;
function updateIntersectionTypeNode(node, types) {
@@ -61025,7 +61910,7 @@
: node;
}
function createConditionalTypeNode(checkType, extendsType, trueType, falseType) {
- var node = createSynthesizedNode(175 /* ConditionalType */);
+ var node = createSynthesizedNode(176 /* ConditionalType */);
node.checkType = ts.parenthesizeConditionalTypeMember(checkType);
node.extendsType = ts.parenthesizeConditionalTypeMember(extendsType);
node.trueType = trueType;
@@ -61043,7 +61928,7 @@
}
ts.updateConditionalTypeNode = updateConditionalTypeNode;
function createInferTypeNode(typeParameter) {
- var node = createSynthesizedNode(176 /* InferType */);
+ var node = createSynthesizedNode(177 /* InferType */);
node.typeParameter = typeParameter;
return node;
}
@@ -61055,10 +61940,10 @@
}
ts.updateInferTypeNode = updateInferTypeNode;
function createImportTypeNode(argument, qualifier, typeArguments, isTypeOf) {
- var node = createSynthesizedNode(183 /* ImportType */);
+ var node = createSynthesizedNode(184 /* ImportType */);
node.argument = argument;
node.qualifier = qualifier;
- node.typeArguments = asNodeArray(typeArguments);
+ node.typeArguments = ts.parenthesizeTypeParameters(typeArguments);
node.isTypeOf = isTypeOf;
return node;
}
@@ -61073,7 +61958,7 @@
}
ts.updateImportTypeNode = updateImportTypeNode;
function createParenthesizedType(type) {
- var node = createSynthesizedNode(177 /* ParenthesizedType */);
+ var node = createSynthesizedNode(178 /* ParenthesizedType */);
node.type = type;
return node;
}
@@ -61085,12 +61970,12 @@
}
ts.updateParenthesizedType = updateParenthesizedType;
function createThisTypeNode() {
- return createSynthesizedNode(178 /* ThisType */);
+ return createSynthesizedNode(179 /* ThisType */);
}
ts.createThisTypeNode = createThisTypeNode;
function createTypeOperatorNode(operatorOrType, type) {
- var node = createSynthesizedNode(179 /* TypeOperator */);
- node.operator = typeof operatorOrType === "number" ? operatorOrType : 129 /* KeyOfKeyword */;
+ var node = createSynthesizedNode(180 /* TypeOperator */);
+ node.operator = typeof operatorOrType === "number" ? operatorOrType : 130 /* KeyOfKeyword */;
node.type = ts.parenthesizeElementTypeMember(typeof operatorOrType === "number" ? type : operatorOrType);
return node;
}
@@ -61100,7 +61985,7 @@
}
ts.updateTypeOperatorNode = updateTypeOperatorNode;
function createIndexedAccessTypeNode(objectType, indexType) {
- var node = createSynthesizedNode(180 /* IndexedAccessType */);
+ var node = createSynthesizedNode(181 /* IndexedAccessType */);
node.objectType = ts.parenthesizeElementTypeMember(objectType);
node.indexType = indexType;
return node;
@@ -61114,7 +61999,7 @@
}
ts.updateIndexedAccessTypeNode = updateIndexedAccessTypeNode;
function createMappedTypeNode(readonlyToken, typeParameter, questionToken, type) {
- var node = createSynthesizedNode(181 /* MappedType */);
+ var node = createSynthesizedNode(182 /* MappedType */);
node.readonlyToken = readonlyToken;
node.typeParameter = typeParameter;
node.questionToken = questionToken;
@@ -61132,7 +62017,7 @@
}
ts.updateMappedTypeNode = updateMappedTypeNode;
function createLiteralTypeNode(literal) {
- var node = createSynthesizedNode(182 /* LiteralType */);
+ var node = createSynthesizedNode(183 /* LiteralType */);
node.literal = literal;
return node;
}
@@ -61145,7 +62030,7 @@
ts.updateLiteralTypeNode = updateLiteralTypeNode;
// Binding Patterns
function createObjectBindingPattern(elements) {
- var node = createSynthesizedNode(184 /* ObjectBindingPattern */);
+ var node = createSynthesizedNode(185 /* ObjectBindingPattern */);
node.elements = createNodeArray(elements);
return node;
}
@@ -61157,7 +62042,7 @@
}
ts.updateObjectBindingPattern = updateObjectBindingPattern;
function createArrayBindingPattern(elements) {
- var node = createSynthesizedNode(185 /* ArrayBindingPattern */);
+ var node = createSynthesizedNode(186 /* ArrayBindingPattern */);
node.elements = createNodeArray(elements);
return node;
}
@@ -61169,7 +62054,7 @@
}
ts.updateArrayBindingPattern = updateArrayBindingPattern;
function createBindingElement(dotDotDotToken, propertyName, name, initializer) {
- var node = createSynthesizedNode(186 /* BindingElement */);
+ var node = createSynthesizedNode(187 /* BindingElement */);
node.dotDotDotToken = dotDotDotToken;
node.propertyName = asName(propertyName);
node.name = asName(name);
@@ -61188,7 +62073,7 @@
ts.updateBindingElement = updateBindingElement;
// Expression
function createArrayLiteral(elements, multiLine) {
- var node = createSynthesizedNode(187 /* ArrayLiteralExpression */);
+ var node = createSynthesizedNode(188 /* ArrayLiteralExpression */);
node.elements = ts.parenthesizeListElements(createNodeArray(elements));
if (multiLine)
node.multiLine = true;
@@ -61202,7 +62087,7 @@
}
ts.updateArrayLiteral = updateArrayLiteral;
function createObjectLiteral(properties, multiLine) {
- var node = createSynthesizedNode(188 /* ObjectLiteralExpression */);
+ var node = createSynthesizedNode(189 /* ObjectLiteralExpression */);
node.properties = createNodeArray(properties);
if (multiLine)
node.multiLine = true;
@@ -61216,9 +62101,9 @@
}
ts.updateObjectLiteral = updateObjectLiteral;
function createPropertyAccess(expression, name) {
- var node = createSynthesizedNode(189 /* PropertyAccessExpression */);
+ var node = createSynthesizedNode(190 /* PropertyAccessExpression */);
node.expression = ts.parenthesizeForAccess(expression);
- node.name = asName(name); // TODO: GH#18217
+ node.name = asName(name);
setEmitFlags(node, 131072 /* NoIndentation */);
return node;
}
@@ -61233,7 +62118,7 @@
}
ts.updatePropertyAccess = updatePropertyAccess;
function createElementAccess(expression, index) {
- var node = createSynthesizedNode(190 /* ElementAccessExpression */);
+ var node = createSynthesizedNode(191 /* ElementAccessExpression */);
node.expression = ts.parenthesizeForAccess(expression);
node.argumentExpression = asExpression(index);
return node;
@@ -61247,7 +62132,7 @@
}
ts.updateElementAccess = updateElementAccess;
function createCall(expression, typeArguments, argumentsArray) {
- var node = createSynthesizedNode(191 /* CallExpression */);
+ var node = createSynthesizedNode(192 /* CallExpression */);
node.expression = ts.parenthesizeForAccess(expression);
node.typeArguments = asNodeArray(typeArguments);
node.arguments = ts.parenthesizeListElements(createNodeArray(argumentsArray));
@@ -61263,7 +62148,7 @@
}
ts.updateCall = updateCall;
function createNew(expression, typeArguments, argumentsArray) {
- var node = createSynthesizedNode(192 /* NewExpression */);
+ var node = createSynthesizedNode(193 /* NewExpression */);
node.expression = ts.parenthesizeForNew(expression);
node.typeArguments = asNodeArray(typeArguments);
node.arguments = argumentsArray ? ts.parenthesizeListElements(createNodeArray(argumentsArray)) : undefined;
@@ -61279,7 +62164,7 @@
}
ts.updateNew = updateNew;
function createTaggedTemplate(tag, typeArgumentsOrTemplate, template) {
- var node = createSynthesizedNode(193 /* TaggedTemplateExpression */);
+ var node = createSynthesizedNode(194 /* TaggedTemplateExpression */);
node.tag = ts.parenthesizeForAccess(tag);
if (template) {
node.typeArguments = asNodeArray(typeArgumentsOrTemplate);
@@ -61302,7 +62187,7 @@
}
ts.updateTaggedTemplate = updateTaggedTemplate;
function createTypeAssertion(type, expression) {
- var node = createSynthesizedNode(194 /* TypeAssertionExpression */);
+ var node = createSynthesizedNode(195 /* TypeAssertionExpression */);
node.type = type;
node.expression = ts.parenthesizePrefixOperand(expression);
return node;
@@ -61316,7 +62201,7 @@
}
ts.updateTypeAssertion = updateTypeAssertion;
function createParen(expression) {
- var node = createSynthesizedNode(195 /* ParenthesizedExpression */);
+ var node = createSynthesizedNode(196 /* ParenthesizedExpression */);
node.expression = expression;
return node;
}
@@ -61328,7 +62213,7 @@
}
ts.updateParen = updateParen;
function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body) {
- var node = createSynthesizedNode(196 /* FunctionExpression */);
+ var node = createSynthesizedNode(197 /* FunctionExpression */);
node.modifiers = asNodeArray(modifiers);
node.asteriskToken = asteriskToken;
node.name = asName(name);
@@ -61352,7 +62237,7 @@
}
ts.updateFunctionExpression = updateFunctionExpression;
function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) {
- var node = createSynthesizedNode(197 /* ArrowFunction */);
+ var node = createSynthesizedNode(198 /* ArrowFunction */);
node.modifiers = asNodeArray(modifiers);
node.typeParameters = asNodeArray(typeParameters);
node.parameters = createNodeArray(parameters);
@@ -61374,7 +62259,7 @@
}
ts.updateArrowFunction = updateArrowFunction;
function createDelete(expression) {
- var node = createSynthesizedNode(198 /* DeleteExpression */);
+ var node = createSynthesizedNode(199 /* DeleteExpression */);
node.expression = ts.parenthesizePrefixOperand(expression);
return node;
}
@@ -61386,7 +62271,7 @@
}
ts.updateDelete = updateDelete;
function createTypeOf(expression) {
- var node = createSynthesizedNode(199 /* TypeOfExpression */);
+ var node = createSynthesizedNode(200 /* TypeOfExpression */);
node.expression = ts.parenthesizePrefixOperand(expression);
return node;
}
@@ -61398,7 +62283,7 @@
}
ts.updateTypeOf = updateTypeOf;
function createVoid(expression) {
- var node = createSynthesizedNode(200 /* VoidExpression */);
+ var node = createSynthesizedNode(201 /* VoidExpression */);
node.expression = ts.parenthesizePrefixOperand(expression);
return node;
}
@@ -61410,7 +62295,7 @@
}
ts.updateVoid = updateVoid;
function createAwait(expression) {
- var node = createSynthesizedNode(201 /* AwaitExpression */);
+ var node = createSynthesizedNode(202 /* AwaitExpression */);
node.expression = ts.parenthesizePrefixOperand(expression);
return node;
}
@@ -61422,7 +62307,7 @@
}
ts.updateAwait = updateAwait;
function createPrefix(operator, operand) {
- var node = createSynthesizedNode(202 /* PrefixUnaryExpression */);
+ var node = createSynthesizedNode(203 /* PrefixUnaryExpression */);
node.operator = operator;
node.operand = ts.parenthesizePrefixOperand(operand);
return node;
@@ -61435,7 +62320,7 @@
}
ts.updatePrefix = updatePrefix;
function createPostfix(operand, operator) {
- var node = createSynthesizedNode(203 /* PostfixUnaryExpression */);
+ var node = createSynthesizedNode(204 /* PostfixUnaryExpression */);
node.operand = ts.parenthesizePostfixOperand(operand);
node.operator = operator;
return node;
@@ -61448,7 +62333,7 @@
}
ts.updatePostfix = updatePostfix;
function createBinary(left, operator, right) {
- var node = createSynthesizedNode(204 /* BinaryExpression */);
+ var node = createSynthesizedNode(205 /* BinaryExpression */);
var operatorToken = asToken(operator);
var operatorKind = operatorToken.kind;
node.left = ts.parenthesizeBinaryOperand(operatorKind, left, /*isLeftSideOfBinary*/ true, /*leftOperand*/ undefined);
@@ -61465,7 +62350,7 @@
}
ts.updateBinary = updateBinary;
function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonToken, whenFalse) {
- var node = createSynthesizedNode(205 /* ConditionalExpression */);
+ var node = createSynthesizedNode(206 /* ConditionalExpression */);
node.condition = ts.parenthesizeForConditionalHead(condition);
node.questionToken = whenFalse ? questionTokenOrWhenTrue : createToken(56 /* QuestionToken */);
node.whenTrue = ts.parenthesizeSubexpressionOfConditionalExpression(whenFalse ? whenTrueOrWhenFalse : questionTokenOrWhenTrue);
@@ -61485,7 +62370,7 @@
}
ts.updateConditional = updateConditional;
function createTemplateExpression(head, templateSpans) {
- var node = createSynthesizedNode(206 /* TemplateExpression */);
+ var node = createSynthesizedNode(207 /* TemplateExpression */);
node.head = head;
node.templateSpans = createNodeArray(templateSpans);
return node;
@@ -61523,7 +62408,7 @@
}
ts.createNoSubstitutionTemplateLiteral = createNoSubstitutionTemplateLiteral;
function createYield(asteriskTokenOrExpression, expression) {
- var node = createSynthesizedNode(207 /* YieldExpression */);
+ var node = createSynthesizedNode(208 /* YieldExpression */);
node.asteriskToken = asteriskTokenOrExpression && asteriskTokenOrExpression.kind === 40 /* AsteriskToken */ ? asteriskTokenOrExpression : undefined;
node.expression = asteriskTokenOrExpression && asteriskTokenOrExpression.kind !== 40 /* AsteriskToken */ ? asteriskTokenOrExpression : expression;
return node;
@@ -61537,7 +62422,7 @@
}
ts.updateYield = updateYield;
function createSpread(expression) {
- var node = createSynthesizedNode(208 /* SpreadElement */);
+ var node = createSynthesizedNode(209 /* SpreadElement */);
node.expression = ts.parenthesizeExpressionForList(expression);
return node;
}
@@ -61549,7 +62434,7 @@
}
ts.updateSpread = updateSpread;
function createClassExpression(modifiers, name, typeParameters, heritageClauses, members) {
- var node = createSynthesizedNode(209 /* ClassExpression */);
+ var node = createSynthesizedNode(210 /* ClassExpression */);
node.decorators = undefined;
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -61570,11 +62455,11 @@
}
ts.updateClassExpression = updateClassExpression;
function createOmittedExpression() {
- return createSynthesizedNode(210 /* OmittedExpression */);
+ return createSynthesizedNode(211 /* OmittedExpression */);
}
ts.createOmittedExpression = createOmittedExpression;
function createExpressionWithTypeArguments(typeArguments, expression) {
- var node = createSynthesizedNode(211 /* ExpressionWithTypeArguments */);
+ var node = createSynthesizedNode(212 /* ExpressionWithTypeArguments */);
node.expression = ts.parenthesizeForAccess(expression);
node.typeArguments = asNodeArray(typeArguments);
return node;
@@ -61588,7 +62473,7 @@
}
ts.updateExpressionWithTypeArguments = updateExpressionWithTypeArguments;
function createAsExpression(expression, type) {
- var node = createSynthesizedNode(212 /* AsExpression */);
+ var node = createSynthesizedNode(213 /* AsExpression */);
node.expression = expression;
node.type = type;
return node;
@@ -61602,7 +62487,7 @@
}
ts.updateAsExpression = updateAsExpression;
function createNonNullExpression(expression) {
- var node = createSynthesizedNode(213 /* NonNullExpression */);
+ var node = createSynthesizedNode(214 /* NonNullExpression */);
node.expression = ts.parenthesizeForAccess(expression);
return node;
}
@@ -61614,7 +62499,7 @@
}
ts.updateNonNullExpression = updateNonNullExpression;
function createMetaProperty(keywordToken, name) {
- var node = createSynthesizedNode(214 /* MetaProperty */);
+ var node = createSynthesizedNode(215 /* MetaProperty */);
node.keywordToken = keywordToken;
node.name = name;
return node;
@@ -61628,7 +62513,7 @@
ts.updateMetaProperty = updateMetaProperty;
// Misc
function createTemplateSpan(expression, literal) {
- var node = createSynthesizedNode(216 /* TemplateSpan */);
+ var node = createSynthesizedNode(217 /* TemplateSpan */);
node.expression = expression;
node.literal = literal;
return node;
@@ -61642,12 +62527,12 @@
}
ts.updateTemplateSpan = updateTemplateSpan;
function createSemicolonClassElement() {
- return createSynthesizedNode(217 /* SemicolonClassElement */);
+ return createSynthesizedNode(218 /* SemicolonClassElement */);
}
ts.createSemicolonClassElement = createSemicolonClassElement;
// Element
function createBlock(statements, multiLine) {
- var block = createSynthesizedNode(218 /* Block */);
+ var block = createSynthesizedNode(219 /* Block */);
block.statements = createNodeArray(statements);
if (multiLine)
block.multiLine = multiLine;
@@ -61661,7 +62546,7 @@
}
ts.updateBlock = updateBlock;
function createVariableStatement(modifiers, declarationList) {
- var node = createSynthesizedNode(219 /* VariableStatement */);
+ var node = createSynthesizedNode(220 /* VariableStatement */);
node.decorators = undefined;
node.modifiers = asNodeArray(modifiers);
node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList;
@@ -61676,11 +62561,11 @@
}
ts.updateVariableStatement = updateVariableStatement;
function createEmptyStatement() {
- return createSynthesizedNode(220 /* EmptyStatement */);
+ return createSynthesizedNode(221 /* EmptyStatement */);
}
ts.createEmptyStatement = createEmptyStatement;
function createExpressionStatement(expression) {
- var node = createSynthesizedNode(221 /* ExpressionStatement */);
+ var node = createSynthesizedNode(222 /* ExpressionStatement */);
node.expression = ts.parenthesizeExpressionForExpressionStatement(expression);
return node;
}
@@ -61696,7 +62581,7 @@
/** @deprecated Use `updateExpressionStatement` instead. */
ts.updateStatement = updateExpressionStatement;
function createIf(expression, thenStatement, elseStatement) {
- var node = createSynthesizedNode(222 /* IfStatement */);
+ var node = createSynthesizedNode(223 /* IfStatement */);
node.expression = expression;
node.thenStatement = thenStatement;
node.elseStatement = elseStatement;
@@ -61712,7 +62597,7 @@
}
ts.updateIf = updateIf;
function createDo(statement, expression) {
- var node = createSynthesizedNode(223 /* DoStatement */);
+ var node = createSynthesizedNode(224 /* DoStatement */);
node.statement = statement;
node.expression = expression;
return node;
@@ -61726,7 +62611,7 @@
}
ts.updateDo = updateDo;
function createWhile(expression, statement) {
- var node = createSynthesizedNode(224 /* WhileStatement */);
+ var node = createSynthesizedNode(225 /* WhileStatement */);
node.expression = expression;
node.statement = statement;
return node;
@@ -61740,7 +62625,7 @@
}
ts.updateWhile = updateWhile;
function createFor(initializer, condition, incrementor, statement) {
- var node = createSynthesizedNode(225 /* ForStatement */);
+ var node = createSynthesizedNode(226 /* ForStatement */);
node.initializer = initializer;
node.condition = condition;
node.incrementor = incrementor;
@@ -61758,7 +62643,7 @@
}
ts.updateFor = updateFor;
function createForIn(initializer, expression, statement) {
- var node = createSynthesizedNode(226 /* ForInStatement */);
+ var node = createSynthesizedNode(227 /* ForInStatement */);
node.initializer = initializer;
node.expression = expression;
node.statement = statement;
@@ -61774,7 +62659,7 @@
}
ts.updateForIn = updateForIn;
function createForOf(awaitModifier, initializer, expression, statement) {
- var node = createSynthesizedNode(227 /* ForOfStatement */);
+ var node = createSynthesizedNode(228 /* ForOfStatement */);
node.awaitModifier = awaitModifier;
node.initializer = initializer;
node.expression = expression;
@@ -61792,7 +62677,7 @@
}
ts.updateForOf = updateForOf;
function createContinue(label) {
- var node = createSynthesizedNode(228 /* ContinueStatement */);
+ var node = createSynthesizedNode(229 /* ContinueStatement */);
node.label = asName(label);
return node;
}
@@ -61804,7 +62689,7 @@
}
ts.updateContinue = updateContinue;
function createBreak(label) {
- var node = createSynthesizedNode(229 /* BreakStatement */);
+ var node = createSynthesizedNode(230 /* BreakStatement */);
node.label = asName(label);
return node;
}
@@ -61816,7 +62701,7 @@
}
ts.updateBreak = updateBreak;
function createReturn(expression) {
- var node = createSynthesizedNode(230 /* ReturnStatement */);
+ var node = createSynthesizedNode(231 /* ReturnStatement */);
node.expression = expression;
return node;
}
@@ -61828,7 +62713,7 @@
}
ts.updateReturn = updateReturn;
function createWith(expression, statement) {
- var node = createSynthesizedNode(231 /* WithStatement */);
+ var node = createSynthesizedNode(232 /* WithStatement */);
node.expression = expression;
node.statement = statement;
return node;
@@ -61842,7 +62727,7 @@
}
ts.updateWith = updateWith;
function createSwitch(expression, caseBlock) {
- var node = createSynthesizedNode(232 /* SwitchStatement */);
+ var node = createSynthesizedNode(233 /* SwitchStatement */);
node.expression = ts.parenthesizeExpressionForList(expression);
node.caseBlock = caseBlock;
return node;
@@ -61856,7 +62741,7 @@
}
ts.updateSwitch = updateSwitch;
function createLabel(label, statement) {
- var node = createSynthesizedNode(233 /* LabeledStatement */);
+ var node = createSynthesizedNode(234 /* LabeledStatement */);
node.label = asName(label);
node.statement = statement;
return node;
@@ -61870,7 +62755,7 @@
}
ts.updateLabel = updateLabel;
function createThrow(expression) {
- var node = createSynthesizedNode(234 /* ThrowStatement */);
+ var node = createSynthesizedNode(235 /* ThrowStatement */);
node.expression = expression;
return node;
}
@@ -61882,7 +62767,7 @@
}
ts.updateThrow = updateThrow;
function createTry(tryBlock, catchClause, finallyBlock) {
- var node = createSynthesizedNode(235 /* TryStatement */);
+ var node = createSynthesizedNode(236 /* TryStatement */);
node.tryBlock = tryBlock;
node.catchClause = catchClause;
node.finallyBlock = finallyBlock;
@@ -61898,11 +62783,11 @@
}
ts.updateTry = updateTry;
function createDebuggerStatement() {
- return createSynthesizedNode(236 /* DebuggerStatement */);
+ return createSynthesizedNode(237 /* DebuggerStatement */);
}
ts.createDebuggerStatement = createDebuggerStatement;
function createVariableDeclaration(name, type, initializer) {
- var node = createSynthesizedNode(237 /* VariableDeclaration */);
+ var node = createSynthesizedNode(238 /* VariableDeclaration */);
node.name = asName(name);
node.type = type;
node.initializer = initializer !== undefined ? ts.parenthesizeExpressionForList(initializer) : undefined;
@@ -61919,7 +62804,7 @@
ts.updateVariableDeclaration = updateVariableDeclaration;
function createVariableDeclarationList(declarations, flags) {
if (flags === void 0) { flags = 0 /* None */; }
- var node = createSynthesizedNode(238 /* VariableDeclarationList */);
+ var node = createSynthesizedNode(239 /* VariableDeclarationList */);
node.flags |= flags & 3 /* BlockScoped */;
node.declarations = createNodeArray(declarations);
return node;
@@ -61932,7 +62817,7 @@
}
ts.updateVariableDeclarationList = updateVariableDeclarationList;
function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body) {
- var node = createSynthesizedNode(239 /* FunctionDeclaration */);
+ var node = createSynthesizedNode(240 /* FunctionDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.asteriskToken = asteriskToken;
@@ -61958,7 +62843,7 @@
}
ts.updateFunctionDeclaration = updateFunctionDeclaration;
function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members) {
- var node = createSynthesizedNode(240 /* ClassDeclaration */);
+ var node = createSynthesizedNode(241 /* ClassDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -61980,7 +62865,7 @@
}
ts.updateClassDeclaration = updateClassDeclaration;
function createInterfaceDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members) {
- var node = createSynthesizedNode(241 /* InterfaceDeclaration */);
+ var node = createSynthesizedNode(242 /* InterfaceDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -62002,7 +62887,7 @@
}
ts.updateInterfaceDeclaration = updateInterfaceDeclaration;
function createTypeAliasDeclaration(decorators, modifiers, name, typeParameters, type) {
- var node = createSynthesizedNode(242 /* TypeAliasDeclaration */);
+ var node = createSynthesizedNode(243 /* TypeAliasDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -62022,7 +62907,7 @@
}
ts.updateTypeAliasDeclaration = updateTypeAliasDeclaration;
function createEnumDeclaration(decorators, modifiers, name, members) {
- var node = createSynthesizedNode(243 /* EnumDeclaration */);
+ var node = createSynthesizedNode(244 /* EnumDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -62041,7 +62926,7 @@
ts.updateEnumDeclaration = updateEnumDeclaration;
function createModuleDeclaration(decorators, modifiers, name, body, flags) {
if (flags === void 0) { flags = 0 /* None */; }
- var node = createSynthesizedNode(244 /* ModuleDeclaration */);
+ var node = createSynthesizedNode(245 /* ModuleDeclaration */);
node.flags |= flags & (16 /* Namespace */ | 4 /* NestedNamespace */ | 512 /* GlobalAugmentation */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
@@ -62060,7 +62945,7 @@
}
ts.updateModuleDeclaration = updateModuleDeclaration;
function createModuleBlock(statements) {
- var node = createSynthesizedNode(245 /* ModuleBlock */);
+ var node = createSynthesizedNode(246 /* ModuleBlock */);
node.statements = createNodeArray(statements);
return node;
}
@@ -62072,7 +62957,7 @@
}
ts.updateModuleBlock = updateModuleBlock;
function createCaseBlock(clauses) {
- var node = createSynthesizedNode(246 /* CaseBlock */);
+ var node = createSynthesizedNode(247 /* CaseBlock */);
node.clauses = createNodeArray(clauses);
return node;
}
@@ -62084,7 +62969,7 @@
}
ts.updateCaseBlock = updateCaseBlock;
function createNamespaceExportDeclaration(name) {
- var node = createSynthesizedNode(247 /* NamespaceExportDeclaration */);
+ var node = createSynthesizedNode(248 /* NamespaceExportDeclaration */);
node.name = asName(name);
return node;
}
@@ -62096,7 +62981,7 @@
}
ts.updateNamespaceExportDeclaration = updateNamespaceExportDeclaration;
function createImportEqualsDeclaration(decorators, modifiers, name, moduleReference) {
- var node = createSynthesizedNode(248 /* ImportEqualsDeclaration */);
+ var node = createSynthesizedNode(249 /* ImportEqualsDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -62114,7 +62999,7 @@
}
ts.updateImportEqualsDeclaration = updateImportEqualsDeclaration;
function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier) {
- var node = createSynthesizedNode(249 /* ImportDeclaration */);
+ var node = createSynthesizedNode(250 /* ImportDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.importClause = importClause;
@@ -62132,7 +63017,7 @@
}
ts.updateImportDeclaration = updateImportDeclaration;
function createImportClause(name, namedBindings) {
- var node = createSynthesizedNode(250 /* ImportClause */);
+ var node = createSynthesizedNode(251 /* ImportClause */);
node.name = name;
node.namedBindings = namedBindings;
return node;
@@ -62146,7 +63031,7 @@
}
ts.updateImportClause = updateImportClause;
function createNamespaceImport(name) {
- var node = createSynthesizedNode(251 /* NamespaceImport */);
+ var node = createSynthesizedNode(252 /* NamespaceImport */);
node.name = name;
return node;
}
@@ -62158,7 +63043,7 @@
}
ts.updateNamespaceImport = updateNamespaceImport;
function createNamedImports(elements) {
- var node = createSynthesizedNode(252 /* NamedImports */);
+ var node = createSynthesizedNode(253 /* NamedImports */);
node.elements = createNodeArray(elements);
return node;
}
@@ -62170,7 +63055,7 @@
}
ts.updateNamedImports = updateNamedImports;
function createImportSpecifier(propertyName, name) {
- var node = createSynthesizedNode(253 /* ImportSpecifier */);
+ var node = createSynthesizedNode(254 /* ImportSpecifier */);
node.propertyName = propertyName;
node.name = name;
return node;
@@ -62184,11 +63069,11 @@
}
ts.updateImportSpecifier = updateImportSpecifier;
function createExportAssignment(decorators, modifiers, isExportEquals, expression) {
- var node = createSynthesizedNode(254 /* ExportAssignment */);
+ var node = createSynthesizedNode(255 /* ExportAssignment */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.isExportEquals = isExportEquals;
- node.expression = isExportEquals ? ts.parenthesizeBinaryOperand(59 /* EqualsToken */, expression, /*isLeftSideOfBinary*/ false, /*leftOperand*/ undefined) : ts.parenthesizeDefaultExpression(expression);
+ node.expression = isExportEquals ? ts.parenthesizeBinaryOperand(60 /* EqualsToken */, expression, /*isLeftSideOfBinary*/ false, /*leftOperand*/ undefined) : ts.parenthesizeDefaultExpression(expression);
return node;
}
ts.createExportAssignment = createExportAssignment;
@@ -62201,7 +63086,7 @@
}
ts.updateExportAssignment = updateExportAssignment;
function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier) {
- var node = createSynthesizedNode(255 /* ExportDeclaration */);
+ var node = createSynthesizedNode(256 /* ExportDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.exportClause = exportClause;
@@ -62219,7 +63104,7 @@
}
ts.updateExportDeclaration = updateExportDeclaration;
function createNamedExports(elements) {
- var node = createSynthesizedNode(256 /* NamedExports */);
+ var node = createSynthesizedNode(257 /* NamedExports */);
node.elements = createNodeArray(elements);
return node;
}
@@ -62231,7 +63116,7 @@
}
ts.updateNamedExports = updateNamedExports;
function createExportSpecifier(propertyName, name) {
- var node = createSynthesizedNode(257 /* ExportSpecifier */);
+ var node = createSynthesizedNode(258 /* ExportSpecifier */);
node.propertyName = asName(propertyName);
node.name = asName(name);
return node;
@@ -62246,7 +63131,7 @@
ts.updateExportSpecifier = updateExportSpecifier;
// Module references
function createExternalModuleReference(expression) {
- var node = createSynthesizedNode(259 /* ExternalModuleReference */);
+ var node = createSynthesizedNode(260 /* ExternalModuleReference */);
node.expression = expression;
return node;
}
@@ -62260,14 +63145,14 @@
// JSDoc
/* @internal */
function createJSDocTypeExpression(type) {
- var node = createSynthesizedNode(288 /* JSDocTypeExpression */);
+ var node = createSynthesizedNode(289 /* JSDocTypeExpression */);
node.type = type;
return node;
}
ts.createJSDocTypeExpression = createJSDocTypeExpression;
/* @internal */
function createJSDocTypeTag(typeExpression, comment) {
- var tag = createJSDocTag(307 /* JSDocTypeTag */, "type");
+ var tag = createJSDocTag(308 /* JSDocTypeTag */, "type");
tag.typeExpression = typeExpression;
tag.comment = comment;
return tag;
@@ -62275,7 +63160,7 @@
ts.createJSDocTypeTag = createJSDocTypeTag;
/* @internal */
function createJSDocReturnTag(typeExpression, comment) {
- var tag = createJSDocTag(305 /* JSDocReturnTag */, "returns");
+ var tag = createJSDocTag(306 /* JSDocReturnTag */, "returns");
tag.typeExpression = typeExpression;
tag.comment = comment;
return tag;
@@ -62283,7 +63168,7 @@
ts.createJSDocReturnTag = createJSDocReturnTag;
/* @internal */
function createJSDocParamTag(name, isBracketed, typeExpression, comment) {
- var tag = createJSDocTag(304 /* JSDocParameterTag */, "param");
+ var tag = createJSDocTag(305 /* JSDocParameterTag */, "param");
tag.typeExpression = typeExpression;
tag.name = name;
tag.isBracketed = isBracketed;
@@ -62293,7 +63178,7 @@
ts.createJSDocParamTag = createJSDocParamTag;
/* @internal */
function createJSDocComment(comment, tags) {
- var node = createSynthesizedNode(296 /* JSDocComment */);
+ var node = createSynthesizedNode(297 /* JSDocComment */);
node.comment = comment;
node.tags = tags;
return node;
@@ -62307,7 +63192,7 @@
}
// JSX
function createJsxElement(openingElement, children, closingElement) {
- var node = createSynthesizedNode(260 /* JsxElement */);
+ var node = createSynthesizedNode(261 /* JsxElement */);
node.openingElement = openingElement;
node.children = createNodeArray(children);
node.closingElement = closingElement;
@@ -62323,7 +63208,7 @@
}
ts.updateJsxElement = updateJsxElement;
function createJsxSelfClosingElement(tagName, typeArguments, attributes) {
- var node = createSynthesizedNode(261 /* JsxSelfClosingElement */);
+ var node = createSynthesizedNode(262 /* JsxSelfClosingElement */);
node.tagName = tagName;
node.typeArguments = asNodeArray(typeArguments);
node.attributes = attributes;
@@ -62339,7 +63224,7 @@
}
ts.updateJsxSelfClosingElement = updateJsxSelfClosingElement;
function createJsxOpeningElement(tagName, typeArguments, attributes) {
- var node = createSynthesizedNode(262 /* JsxOpeningElement */);
+ var node = createSynthesizedNode(263 /* JsxOpeningElement */);
node.tagName = tagName;
node.typeArguments = asNodeArray(typeArguments);
node.attributes = attributes;
@@ -62355,7 +63240,7 @@
}
ts.updateJsxOpeningElement = updateJsxOpeningElement;
function createJsxClosingElement(tagName) {
- var node = createSynthesizedNode(263 /* JsxClosingElement */);
+ var node = createSynthesizedNode(264 /* JsxClosingElement */);
node.tagName = tagName;
return node;
}
@@ -62367,7 +63252,7 @@
}
ts.updateJsxClosingElement = updateJsxClosingElement;
function createJsxFragment(openingFragment, children, closingFragment) {
- var node = createSynthesizedNode(264 /* JsxFragment */);
+ var node = createSynthesizedNode(265 /* JsxFragment */);
node.openingFragment = openingFragment;
node.children = createNodeArray(children);
node.closingFragment = closingFragment;
@@ -62389,11 +63274,11 @@
}
ts.updateJsxText = updateJsxText;
function createJsxOpeningFragment() {
- return createSynthesizedNode(265 /* JsxOpeningFragment */);
+ return createSynthesizedNode(266 /* JsxOpeningFragment */);
}
ts.createJsxOpeningFragment = createJsxOpeningFragment;
function createJsxJsxClosingFragment() {
- return createSynthesizedNode(266 /* JsxClosingFragment */);
+ return createSynthesizedNode(267 /* JsxClosingFragment */);
}
ts.createJsxJsxClosingFragment = createJsxJsxClosingFragment;
function updateJsxFragment(node, openingFragment, children, closingFragment) {
@@ -62405,7 +63290,7 @@
}
ts.updateJsxFragment = updateJsxFragment;
function createJsxAttribute(name, initializer) {
- var node = createSynthesizedNode(267 /* JsxAttribute */);
+ var node = createSynthesizedNode(268 /* JsxAttribute */);
node.name = name;
node.initializer = initializer;
return node;
@@ -62419,7 +63304,7 @@
}
ts.updateJsxAttribute = updateJsxAttribute;
function createJsxAttributes(properties) {
- var node = createSynthesizedNode(268 /* JsxAttributes */);
+ var node = createSynthesizedNode(269 /* JsxAttributes */);
node.properties = createNodeArray(properties);
return node;
}
@@ -62431,7 +63316,7 @@
}
ts.updateJsxAttributes = updateJsxAttributes;
function createJsxSpreadAttribute(expression) {
- var node = createSynthesizedNode(269 /* JsxSpreadAttribute */);
+ var node = createSynthesizedNode(270 /* JsxSpreadAttribute */);
node.expression = expression;
return node;
}
@@ -62443,7 +63328,7 @@
}
ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute;
function createJsxExpression(dotDotDotToken, expression) {
- var node = createSynthesizedNode(270 /* JsxExpression */);
+ var node = createSynthesizedNode(271 /* JsxExpression */);
node.dotDotDotToken = dotDotDotToken;
node.expression = expression;
return node;
@@ -62457,7 +63342,7 @@
ts.updateJsxExpression = updateJsxExpression;
// Clauses
function createCaseClause(expression, statements) {
- var node = createSynthesizedNode(271 /* CaseClause */);
+ var node = createSynthesizedNode(272 /* CaseClause */);
node.expression = ts.parenthesizeExpressionForList(expression);
node.statements = createNodeArray(statements);
return node;
@@ -62471,7 +63356,7 @@
}
ts.updateCaseClause = updateCaseClause;
function createDefaultClause(statements) {
- var node = createSynthesizedNode(272 /* DefaultClause */);
+ var node = createSynthesizedNode(273 /* DefaultClause */);
node.statements = createNodeArray(statements);
return node;
}
@@ -62483,7 +63368,7 @@
}
ts.updateDefaultClause = updateDefaultClause;
function createHeritageClause(token, types) {
- var node = createSynthesizedNode(273 /* HeritageClause */);
+ var node = createSynthesizedNode(274 /* HeritageClause */);
node.token = token;
node.types = createNodeArray(types);
return node;
@@ -62496,7 +63381,7 @@
}
ts.updateHeritageClause = updateHeritageClause;
function createCatchClause(variableDeclaration, block) {
- var node = createSynthesizedNode(274 /* CatchClause */);
+ var node = createSynthesizedNode(275 /* CatchClause */);
node.variableDeclaration = ts.isString(variableDeclaration) ? createVariableDeclaration(variableDeclaration) : variableDeclaration;
node.block = block;
return node;
@@ -62511,7 +63396,7 @@
ts.updateCatchClause = updateCatchClause;
// Property assignments
function createPropertyAssignment(name, initializer) {
- var node = createSynthesizedNode(275 /* PropertyAssignment */);
+ var node = createSynthesizedNode(276 /* PropertyAssignment */);
node.name = asName(name);
node.questionToken = undefined;
node.initializer = ts.parenthesizeExpressionForList(initializer);
@@ -62526,7 +63411,7 @@
}
ts.updatePropertyAssignment = updatePropertyAssignment;
function createShorthandPropertyAssignment(name, objectAssignmentInitializer) {
- var node = createSynthesizedNode(276 /* ShorthandPropertyAssignment */);
+ var node = createSynthesizedNode(277 /* ShorthandPropertyAssignment */);
node.name = asName(name);
node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? ts.parenthesizeExpressionForList(objectAssignmentInitializer) : undefined;
return node;
@@ -62540,8 +63425,8 @@
}
ts.updateShorthandPropertyAssignment = updateShorthandPropertyAssignment;
function createSpreadAssignment(expression) {
- var node = createSynthesizedNode(277 /* SpreadAssignment */);
- node.expression = expression !== undefined ? ts.parenthesizeExpressionForList(expression) : undefined; // TODO: GH#18217
+ var node = createSynthesizedNode(278 /* SpreadAssignment */);
+ node.expression = ts.parenthesizeExpressionForList(expression);
return node;
}
ts.createSpreadAssignment = createSpreadAssignment;
@@ -62553,7 +63438,7 @@
ts.updateSpreadAssignment = updateSpreadAssignment;
// Enum
function createEnumMember(name, initializer) {
- var node = createSynthesizedNode(278 /* EnumMember */);
+ var node = createSynthesizedNode(279 /* EnumMember */);
node.name = asName(name);
node.initializer = initializer && ts.parenthesizeExpressionForList(initializer);
return node;
@@ -62574,7 +63459,7 @@
(typeReferences !== undefined && node.typeReferenceDirectives !== typeReferences) ||
(libReferences !== undefined && node.libReferenceDirectives !== libReferences) ||
(hasNoDefaultLib !== undefined && node.hasNoDefaultLib !== hasNoDefaultLib)) {
- var updated = createSynthesizedNode(284 /* SourceFile */);
+ var updated = createSynthesizedNode(285 /* SourceFile */);
updated.flags |= node.flags;
updated.statements = createNodeArray(statements);
updated.endOfFileToken = node.endOfFileToken;
@@ -62658,7 +63543,7 @@
* @param original The original statement.
*/
function createNotEmittedStatement(original) {
- var node = createSynthesizedNode(312 /* NotEmittedStatement */);
+ var node = createSynthesizedNode(313 /* NotEmittedStatement */);
node.original = original;
setTextRange(node, original);
return node;
@@ -62670,7 +63555,7 @@
*/
/* @internal */
function createEndOfDeclarationMarker(original) {
- var node = createSynthesizedNode(316 /* EndOfDeclarationMarker */);
+ var node = createSynthesizedNode(317 /* EndOfDeclarationMarker */);
node.emitNode = {};
node.original = original;
return node;
@@ -62682,7 +63567,7 @@
*/
/* @internal */
function createMergeDeclarationMarker(original) {
- var node = createSynthesizedNode(315 /* MergeDeclarationMarker */);
+ var node = createSynthesizedNode(316 /* MergeDeclarationMarker */);
node.emitNode = {};
node.original = original;
return node;
@@ -62697,7 +63582,7 @@
* @param location The location for the expression. Defaults to the positions from "original" if provided.
*/
function createPartiallyEmittedExpression(expression, original) {
- var node = createSynthesizedNode(313 /* PartiallyEmittedExpression */);
+ var node = createSynthesizedNode(314 /* PartiallyEmittedExpression */);
node.expression = expression;
node.original = original;
setTextRange(node, original);
@@ -62713,7 +63598,7 @@
ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression;
function flattenCommaElements(node) {
if (ts.nodeIsSynthesized(node) && !ts.isParseTreeNode(node) && !node.original && !node.emitNode && !node.id) {
- if (node.kind === 314 /* CommaListExpression */) {
+ if (node.kind === 315 /* CommaListExpression */) {
return node.elements;
}
if (ts.isBinaryExpression(node) && node.operatorToken.kind === 27 /* CommaToken */) {
@@ -62723,7 +63608,7 @@
return node;
}
function createCommaList(elements) {
- var node = createSynthesizedNode(314 /* CommaListExpression */);
+ var node = createSynthesizedNode(315 /* CommaListExpression */);
node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements));
return node;
}
@@ -62736,7 +63621,7 @@
ts.updateCommaList = updateCommaList;
function createBundle(sourceFiles, prepends) {
if (prepends === void 0) { prepends = ts.emptyArray; }
- var node = ts.createNode(285 /* Bundle */);
+ var node = ts.createNode(286 /* Bundle */);
node.prepends = prepends;
node.sourceFiles = sourceFiles;
return node;
@@ -62766,7 +63651,7 @@
], function (helper) { return helper.name; }));
}
function createUnparsedSource() {
- var node = ts.createNode(286 /* UnparsedSource */);
+ var node = ts.createNode(287 /* UnparsedSource */);
node.prologues = ts.emptyArray;
node.referencedFiles = ts.emptyArray;
node.libReferenceDirectives = ts.emptyArray;
@@ -62898,10 +63783,10 @@
}
function mapBundleFileSectionKindToSyntaxKind(kind) {
switch (kind) {
- case "prologue" /* Prologue */: return 279 /* UnparsedPrologue */;
- case "prepend" /* Prepend */: return 280 /* UnparsedPrepend */;
- case "internal" /* Internal */: return 282 /* UnparsedInternalText */;
- case "text" /* Text */: return 281 /* UnparsedText */;
+ case "prologue" /* Prologue */: return 280 /* UnparsedPrologue */;
+ case "prepend" /* Prepend */: return 281 /* UnparsedPrepend */;
+ case "internal" /* Internal */: return 283 /* UnparsedInternalText */;
+ case "text" /* Text */: return 282 /* UnparsedText */;
case "emitHelpers" /* EmitHelpers */:
case "no-default-lib" /* NoDefaultLib */:
case "reference" /* Reference */:
@@ -62919,14 +63804,14 @@
return node;
}
function createUnparsedSyntheticReference(section, parent) {
- var node = ts.createNode(283 /* UnparsedSyntheticReference */, section.pos, section.end);
+ var node = ts.createNode(284 /* UnparsedSyntheticReference */, section.pos, section.end);
node.parent = parent;
node.data = section.data;
node.section = section;
return node;
}
function createInputFiles(javascriptTextOrReadFileText, declarationTextOrJavascriptPath, javascriptMapPath, javascriptMapTextOrDeclarationPath, declarationMapPath, declarationMapTextOrBuildInfoPath, javascriptPath, declarationPath, buildInfoPath, buildInfo, oldFileOfCurrentEmit) {
- var node = ts.createNode(287 /* InputFiles */);
+ var node = ts.createNode(288 /* InputFiles */);
if (!ts.isString(javascriptTextOrReadFileText)) {
var cache_1 = ts.createMap();
var textGetter_1 = function (path) {
@@ -63020,7 +63905,7 @@
}
ts.createLessThan = createLessThan;
function createAssignment(left, right) {
- return createBinary(left, 59 /* EqualsToken */, right);
+ return createBinary(left, 60 /* EqualsToken */, right);
}
ts.createAssignment = createAssignment;
function createStrictEquality(left, right) {
@@ -63113,7 +63998,7 @@
// To avoid holding onto transformation artifacts, we keep track of any
// parse tree node we are annotating. This allows us to clean them up after
// all transformations have completed.
- if (node.kind === 284 /* SourceFile */) {
+ if (node.kind === 285 /* SourceFile */) {
return node.emitNode = { annotatedNodes: [node] };
}
var sourceFile = ts.getSourceFileOfNode(ts.getParseTreeNode(ts.getSourceFileOfNode(node)));
@@ -63624,7 +64509,7 @@
if (!outermostLabeledStatement) {
return node;
}
- var updated = ts.updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 233 /* LabeledStatement */
+ var updated = ts.updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 234 /* LabeledStatement */
? restoreEnclosingLabel(node, outermostLabeledStatement.statement)
: node);
if (afterRestoreLabelCallback) {
@@ -63636,20 +64521,20 @@
function shouldBeCapturedInTempVariable(node, cacheIdentifiers) {
var target = ts.skipParentheses(node);
switch (target.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return cacheIdentifiers;
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
case 10 /* StringLiteral */:
return false;
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
var elements = target.elements;
if (elements.length === 0) {
return false;
}
return true;
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return target.properties.length > 0;
default:
return true;
@@ -63664,7 +64549,7 @@
thisArg = ts.createThis();
target = callee;
}
- else if (callee.kind === 98 /* SuperKeyword */) {
+ else if (callee.kind === 99 /* SuperKeyword */) {
thisArg = ts.createThis();
target = languageVersion < 2 /* ES2015 */
? ts.setTextRange(ts.createIdentifier("_super"), callee)
@@ -63676,7 +64561,7 @@
}
else {
switch (callee.kind) {
- case 189 /* PropertyAccessExpression */: {
+ case 190 /* PropertyAccessExpression */: {
if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) {
// for `a.b()` target is `(_a = a).b` and thisArg is `_a`
thisArg = ts.createTempVariable(recordTempVariable);
@@ -63689,7 +64574,7 @@
}
break;
}
- case 190 /* ElementAccessExpression */: {
+ case 191 /* ElementAccessExpression */: {
if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) {
// for `a[b]()` target is `(_a = a)[b]` and thisArg is `_a`
thisArg = ts.createTempVariable(recordTempVariable);
@@ -63746,14 +64631,14 @@
ts.createExpressionForPropertyName = createExpressionForPropertyName;
function createExpressionForObjectLiteralElementLike(node, property, receiver) {
switch (property.kind) {
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return createExpressionForAccessorDeclaration(node.properties, property, receiver, !!node.multiLine);
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return createExpressionForPropertyAssignment(property, receiver);
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return createExpressionForShorthandPropertyAssignment(property, receiver);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return createExpressionForMethodDeclaration(property, receiver);
}
}
@@ -63761,7 +64646,7 @@
function createExpressionForAccessorDeclaration(properties, property, receiver, multiLine) {
var _a = ts.getAllAccessorDeclarations(properties, property), firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor;
if (property === firstAccessor) {
- var properties_7 = [];
+ var properties_5 = [];
if (getAccessor) {
var getterFunction = ts.createFunctionExpression(getAccessor.modifiers,
/*asteriskToken*/ undefined,
@@ -63772,7 +64657,7 @@
ts.setTextRange(getterFunction, getAccessor);
ts.setOriginalNode(getterFunction, getAccessor);
var getter = ts.createPropertyAssignment("get", getterFunction);
- properties_7.push(getter);
+ properties_5.push(getter);
}
if (setAccessor) {
var setterFunction = ts.createFunctionExpression(setAccessor.modifiers,
@@ -63784,15 +64669,15 @@
ts.setTextRange(setterFunction, setAccessor);
ts.setOriginalNode(setterFunction, setAccessor);
var setter = ts.createPropertyAssignment("set", setterFunction);
- properties_7.push(setter);
+ properties_5.push(setter);
}
- properties_7.push(ts.createPropertyAssignment("enumerable", ts.createTrue()));
- properties_7.push(ts.createPropertyAssignment("configurable", ts.createTrue()));
+ properties_5.push(ts.createPropertyAssignment("enumerable", ts.createTrue()));
+ properties_5.push(ts.createPropertyAssignment("configurable", ts.createTrue()));
var expression = ts.setTextRange(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"),
/*typeArguments*/ undefined, [
receiver,
createExpressionForPropertyName(property.name),
- ts.createObjectLiteral(properties_7, multiLine)
+ ts.createObjectLiteral(properties_5, multiLine)
]),
/*location*/ firstAccessor);
return ts.aggregateTransformFlags(expression);
@@ -64079,7 +64964,7 @@
function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) {
var skipped = ts.skipPartiallyEmittedExpressions(operand);
// If the resulting expression is already parenthesized, we do not need to do any further processing.
- if (skipped.kind === 195 /* ParenthesizedExpression */) {
+ if (skipped.kind === 196 /* ParenthesizedExpression */) {
return operand;
}
return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand)
@@ -64113,10 +64998,10 @@
//
// If `a ** d` is on the left of operator `**`, we need to parenthesize to preserve
// the intended order of operations: `(a ** b) ** c`
- var binaryOperatorPrecedence = ts.getOperatorPrecedence(204 /* BinaryExpression */, binaryOperator);
- var binaryOperatorAssociativity = ts.getOperatorAssociativity(204 /* BinaryExpression */, binaryOperator);
+ var binaryOperatorPrecedence = ts.getOperatorPrecedence(205 /* BinaryExpression */, binaryOperator);
+ var binaryOperatorAssociativity = ts.getOperatorAssociativity(205 /* BinaryExpression */, binaryOperator);
var emittedOperand = ts.skipPartiallyEmittedExpressions(operand);
- if (!isLeftSideOfBinary && operand.kind === 197 /* ArrowFunction */ && binaryOperatorPrecedence > 4) {
+ if (!isLeftSideOfBinary && operand.kind === 198 /* ArrowFunction */ && binaryOperatorPrecedence > 4) {
// We need to parenthesize arrow functions on the right side to avoid it being
// parsed as parenthesized expression: `a && (() => {})`
return true;
@@ -64128,7 +65013,7 @@
// and is a yield expression, then we do not need parentheses.
if (!isLeftSideOfBinary
&& binaryOperatorAssociativity === 1 /* Right */
- && operand.kind === 207 /* YieldExpression */) {
+ && operand.kind === 208 /* YieldExpression */) {
return false;
}
return true;
@@ -64216,7 +65101,7 @@
if (ts.isLiteralKind(node.kind)) {
return node.kind;
}
- if (node.kind === 204 /* BinaryExpression */ && node.operatorToken.kind === 38 /* PlusToken */) {
+ if (node.kind === 205 /* BinaryExpression */ && node.operatorToken.kind === 38 /* PlusToken */) {
if (node.cachedLiteralKind !== undefined) {
return node.cachedLiteralKind;
}
@@ -64231,7 +65116,7 @@
return 0 /* Unknown */;
}
function parenthesizeForConditionalHead(condition) {
- var conditionalPrecedence = ts.getOperatorPrecedence(205 /* ConditionalExpression */, 56 /* QuestionToken */);
+ var conditionalPrecedence = ts.getOperatorPrecedence(206 /* ConditionalExpression */, 56 /* QuestionToken */);
var emittedCondition = ts.skipPartiallyEmittedExpressions(condition);
var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition);
if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1 /* LessThan */) {
@@ -64266,8 +65151,8 @@
var needsParens = isCommaSequence(check);
if (!needsParens) {
switch (getLeftmostExpression(check, /*stopAtCallExpression*/ false).kind) {
- case 209 /* ClassExpression */:
- case 196 /* FunctionExpression */:
+ case 210 /* ClassExpression */:
+ case 197 /* FunctionExpression */:
needsParens = true;
}
}
@@ -64283,9 +65168,9 @@
function parenthesizeForNew(expression) {
var leftmostExpr = getLeftmostExpression(expression, /*stopAtCallExpressions*/ true);
switch (leftmostExpr.kind) {
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return ts.createParen(expression);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return !leftmostExpr.arguments
? ts.createParen(expression)
: expression;
@@ -64308,7 +65193,7 @@
//
var emittedExpression = ts.skipPartiallyEmittedExpressions(expression);
if (ts.isLeftHandSideExpression(emittedExpression)
- && (emittedExpression.kind !== 192 /* NewExpression */ || emittedExpression.arguments)) {
+ && (emittedExpression.kind !== 193 /* NewExpression */ || emittedExpression.arguments)) {
return expression;
}
return ts.setTextRange(ts.createParen(expression), expression);
@@ -64346,7 +65231,7 @@
function parenthesizeExpressionForList(expression) {
var emittedExpression = ts.skipPartiallyEmittedExpressions(expression);
var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression);
- var commaPrecedence = ts.getOperatorPrecedence(204 /* BinaryExpression */, 27 /* CommaToken */);
+ var commaPrecedence = ts.getOperatorPrecedence(205 /* BinaryExpression */, 27 /* CommaToken */);
return expressionPrecedence > commaPrecedence
? expression
: ts.setTextRange(ts.createParen(expression), expression);
@@ -64357,29 +65242,29 @@
if (ts.isCallExpression(emittedExpression)) {
var callee = emittedExpression.expression;
var kind = ts.skipPartiallyEmittedExpressions(callee).kind;
- if (kind === 196 /* FunctionExpression */ || kind === 197 /* ArrowFunction */) {
+ if (kind === 197 /* FunctionExpression */ || kind === 198 /* ArrowFunction */) {
var mutableCall = ts.getMutableClone(emittedExpression);
mutableCall.expression = ts.setTextRange(ts.createParen(callee), callee);
return recreateOuterExpressions(expression, mutableCall, 4 /* PartiallyEmittedExpressions */);
}
}
var leftmostExpressionKind = getLeftmostExpression(emittedExpression, /*stopAtCallExpressions*/ false).kind;
- if (leftmostExpressionKind === 188 /* ObjectLiteralExpression */ || leftmostExpressionKind === 196 /* FunctionExpression */) {
+ if (leftmostExpressionKind === 189 /* ObjectLiteralExpression */ || leftmostExpressionKind === 197 /* FunctionExpression */) {
return ts.setTextRange(ts.createParen(expression), expression);
}
return expression;
}
ts.parenthesizeExpressionForExpressionStatement = parenthesizeExpressionForExpressionStatement;
function parenthesizeConditionalTypeMember(member) {
- return member.kind === 175 /* ConditionalType */ ? ts.createParenthesizedType(member) : member;
+ return member.kind === 176 /* ConditionalType */ ? ts.createParenthesizedType(member) : member;
}
ts.parenthesizeConditionalTypeMember = parenthesizeConditionalTypeMember;
function parenthesizeElementTypeMember(member) {
switch (member.kind) {
- case 173 /* UnionType */:
- case 174 /* IntersectionType */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
+ case 174 /* UnionType */:
+ case 175 /* IntersectionType */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
return ts.createParenthesizedType(member);
}
return parenthesizeConditionalTypeMember(member);
@@ -64387,9 +65272,9 @@
ts.parenthesizeElementTypeMember = parenthesizeElementTypeMember;
function parenthesizeArrayTypeMember(member) {
switch (member.kind) {
- case 167 /* TypeQuery */:
- case 179 /* TypeOperator */:
- case 176 /* InferType */:
+ case 168 /* TypeQuery */:
+ case 180 /* TypeOperator */:
+ case 177 /* InferType */:
return ts.createParenthesizedType(member);
}
return parenthesizeElementTypeMember(member);
@@ -64415,28 +65300,28 @@
function getLeftmostExpression(node, stopAtCallExpressions) {
while (true) {
switch (node.kind) {
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
node = node.operand;
continue;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
node = node.left;
continue;
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
node = node.condition;
continue;
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
node = node.tag;
continue;
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
if (stopAtCallExpressions) {
return node;
}
// falls through
- case 212 /* AsExpression */:
- case 190 /* ElementAccessExpression */:
- case 189 /* PropertyAccessExpression */:
- case 213 /* NonNullExpression */:
- case 313 /* PartiallyEmittedExpression */:
+ case 213 /* AsExpression */:
+ case 191 /* ElementAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 214 /* NonNullExpression */:
+ case 314 /* PartiallyEmittedExpression */:
node = node.expression;
continue;
}
@@ -64444,15 +65329,15 @@
}
}
function parenthesizeConciseBody(body) {
- if (!ts.isBlock(body) && (isCommaSequence(body) || getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 188 /* ObjectLiteralExpression */)) {
+ if (!ts.isBlock(body) && (isCommaSequence(body) || getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 189 /* ObjectLiteralExpression */)) {
return ts.setTextRange(ts.createParen(body), body);
}
return body;
}
ts.parenthesizeConciseBody = parenthesizeConciseBody;
function isCommaSequence(node) {
- return node.kind === 204 /* BinaryExpression */ && node.operatorToken.kind === 27 /* CommaToken */ ||
- node.kind === 314 /* CommaListExpression */;
+ return node.kind === 205 /* BinaryExpression */ && node.operatorToken.kind === 27 /* CommaToken */ ||
+ node.kind === 315 /* CommaListExpression */;
}
ts.isCommaSequence = isCommaSequence;
var OuterExpressionKinds;
@@ -64465,13 +65350,13 @@
function isOuterExpression(node, kinds) {
if (kinds === void 0) { kinds = 7 /* All */; }
switch (node.kind) {
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return (kinds & 1 /* Parentheses */) !== 0;
- case 194 /* TypeAssertionExpression */:
- case 212 /* AsExpression */:
- case 213 /* NonNullExpression */:
+ case 195 /* TypeAssertionExpression */:
+ case 213 /* AsExpression */:
+ case 214 /* NonNullExpression */:
return (kinds & 2 /* Assertions */) !== 0;
- case 313 /* PartiallyEmittedExpression */:
+ case 314 /* PartiallyEmittedExpression */:
return (kinds & 4 /* PartiallyEmittedExpressions */) !== 0;
}
return false;
@@ -64496,7 +65381,7 @@
}
ts.skipOuterExpressions = skipOuterExpressions;
function skipAssertions(node) {
- while (ts.isAssertionExpression(node) || node.kind === 213 /* NonNullExpression */) {
+ while (ts.isAssertionExpression(node) || node.kind === 214 /* NonNullExpression */) {
node = node.expression;
}
return node;
@@ -64504,11 +65389,11 @@
ts.skipAssertions = skipAssertions;
function updateOuterExpression(outerExpression, expression) {
switch (outerExpression.kind) {
- case 195 /* ParenthesizedExpression */: return ts.updateParen(outerExpression, expression);
- case 194 /* TypeAssertionExpression */: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression);
- case 212 /* AsExpression */: return ts.updateAsExpression(outerExpression, expression, outerExpression.type);
- case 213 /* NonNullExpression */: return ts.updateNonNullExpression(outerExpression, expression);
- case 313 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(outerExpression, expression);
+ case 196 /* ParenthesizedExpression */: return ts.updateParen(outerExpression, expression);
+ case 195 /* TypeAssertionExpression */: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression);
+ case 213 /* AsExpression */: return ts.updateAsExpression(outerExpression, expression, outerExpression.type);
+ case 214 /* NonNullExpression */: return ts.updateNonNullExpression(outerExpression, expression);
+ case 314 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(outerExpression, expression);
}
}
/**
@@ -64526,7 +65411,7 @@
* the containing expression is created/updated.
*/
function isIgnorableParen(node) {
- return node.kind === 195 /* ParenthesizedExpression */
+ return node.kind === 196 /* ParenthesizedExpression */
&& ts.nodeIsSynthesized(node)
&& ts.nodeIsSynthesized(ts.getSourceMapRange(node))
&& ts.nodeIsSynthesized(ts.getCommentRange(node))
@@ -64591,10 +65476,10 @@
var name = namespaceDeclaration.name;
return ts.isGeneratedIdentifier(name) ? name : ts.createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, name) || ts.idText(name));
}
- if (node.kind === 249 /* ImportDeclaration */ && node.importClause) {
+ if (node.kind === 250 /* ImportDeclaration */ && node.importClause) {
return ts.getGeneratedNameForNode(node);
}
- if (node.kind === 255 /* ExportDeclaration */ && node.moduleSpecifier) {
+ if (node.kind === 256 /* ExportDeclaration */ && node.moduleSpecifier) {
return ts.getGeneratedNameForNode(node);
}
return undefined;
@@ -64713,7 +65598,7 @@
}
if (ts.isObjectLiteralElementLike(bindingElement)) {
switch (bindingElement.kind) {
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
// `b` in `({ a: b } = ...)`
// `b` in `({ a: b = 1 } = ...)`
// `{b}` in `({ a: {b} } = ...)`
@@ -64725,11 +65610,11 @@
// `b[0]` in `({ a: b[0] } = ...)`
// `b[0]` in `({ a: b[0] = 1 } = ...)`
return getTargetOfBindingOrAssignmentElement(bindingElement.initializer);
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
// `a` in `({ a } = ...)`
// `a` in `({ a = 1 } = ...)`
return bindingElement.name;
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
// `a` in `({ ...a } = ...)`
return getTargetOfBindingOrAssignmentElement(bindingElement.expression);
}
@@ -64761,12 +65646,12 @@
*/
function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) {
switch (bindingElement.kind) {
- case 151 /* Parameter */:
- case 186 /* BindingElement */:
+ case 152 /* Parameter */:
+ case 187 /* BindingElement */:
// `...` in `let [...a] = ...`
return bindingElement.dotDotDotToken;
- case 208 /* SpreadElement */:
- case 277 /* SpreadAssignment */:
+ case 209 /* SpreadElement */:
+ case 278 /* SpreadAssignment */:
// `...` in `[...a] = ...`
return bindingElement;
}
@@ -64778,7 +65663,7 @@
*/
function getPropertyNameOfBindingOrAssignmentElement(bindingElement) {
switch (bindingElement.kind) {
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
// `a` in `let { a: b } = ...`
// `[a]` in `let { [a]: b } = ...`
// `"a"` in `let { "a": b } = ...`
@@ -64790,7 +65675,7 @@
: propertyName;
}
break;
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
// `a` in `({ a: b } = ...)`
// `[a]` in `({ [a]: b } = ...)`
// `"a"` in `({ "a": b } = ...)`
@@ -64802,7 +65687,7 @@
: propertyName;
}
break;
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
// `a` in `({ ...a } = ...)`
return bindingElement.name;
}
@@ -64825,13 +65710,13 @@
*/
function getElementsOfBindingOrAssignmentPattern(name) {
switch (name.kind) {
- case 184 /* ObjectBindingPattern */:
- case 185 /* ArrayBindingPattern */:
- case 187 /* ArrayLiteralExpression */:
+ case 185 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
+ case 188 /* ArrayLiteralExpression */:
// `a` in `{a}`
// `a` in `[a]`
return name.elements;
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
// `a` in `{a}`
return name.properties;
}
@@ -64871,11 +65756,11 @@
ts.convertToObjectAssignmentElement = convertToObjectAssignmentElement;
function convertToAssignmentPattern(node) {
switch (node.kind) {
- case 185 /* ArrayBindingPattern */:
- case 187 /* ArrayLiteralExpression */:
+ case 186 /* ArrayBindingPattern */:
+ case 188 /* ArrayLiteralExpression */:
return convertToArrayAssignmentPattern(node);
- case 184 /* ObjectBindingPattern */:
- case 188 /* ObjectLiteralExpression */:
+ case 185 /* ObjectBindingPattern */:
+ case 189 /* ObjectLiteralExpression */:
return convertToObjectAssignmentPattern(node);
}
}
@@ -65036,276 +65921,278 @@
}
var kind = node.kind;
// No need to visit nodes with no children.
- if ((kind > 0 /* FirstToken */ && kind <= 147 /* LastToken */) || kind === 178 /* ThisType */) {
+ if ((kind > 0 /* FirstToken */ && kind <= 148 /* LastToken */) || kind === 179 /* ThisType */) {
return node;
}
switch (kind) {
// Names
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return ts.updateIdentifier(node, nodesVisitor(node.typeArguments, visitor, isTypeNodeOrTypeParameterDeclaration));
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
return ts.updateQualifiedName(node, visitNode(node.left, visitor, ts.isEntityName), visitNode(node.right, visitor, ts.isIdentifier));
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression));
// Signature elements
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
return ts.updateTypeParameterDeclaration(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.constraint, visitor, ts.isTypeNode), visitNode(node.default, visitor, ts.isTypeNode));
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return ts.updateParameter(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.dotDotDotToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression));
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
return ts.updateDecorator(node, visitNode(node.expression, visitor, ts.isExpression));
// Type elements
- case 153 /* PropertySignature */:
+ case 154 /* PropertySignature */:
return ts.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isToken), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression));
- case 154 /* PropertyDeclaration */:
- return ts.updateProperty(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression));
- case 155 /* MethodSignature */:
+ case 155 /* PropertyDeclaration */:
+ return ts.updateProperty(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName),
+ // QuestionToken and ExclamationToken is uniqued in Property Declaration and the signature of 'updateProperty' is that too
+ visitNode(node.questionToken || node.exclamationToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression));
+ case 156 /* MethodSignature */:
return ts.updateMethodSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken));
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return ts.updateMethod(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context));
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return ts.updateConstructor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context));
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
return ts.updateGetAccessor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context));
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
return ts.updateSetAccessor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context));
- case 160 /* CallSignature */:
+ case 161 /* CallSignature */:
return ts.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
- case 161 /* ConstructSignature */:
+ case 162 /* ConstructSignature */:
return ts.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
- case 162 /* IndexSignature */:
+ case 163 /* IndexSignature */:
return ts.updateIndexSignature(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
// Types
- case 163 /* TypePredicate */:
+ case 164 /* TypePredicate */:
return ts.updateTypePredicateNode(node, visitNode(node.parameterName, visitor), visitNode(node.type, visitor, ts.isTypeNode));
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return ts.updateTypeReferenceNode(node, visitNode(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode));
- case 165 /* FunctionType */:
+ case 166 /* FunctionType */:
return ts.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
- case 166 /* ConstructorType */:
+ case 167 /* ConstructorType */:
return ts.updateConstructorTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
- case 167 /* TypeQuery */:
+ case 168 /* TypeQuery */:
return ts.updateTypeQueryNode(node, visitNode(node.exprName, visitor, ts.isEntityName));
- case 168 /* TypeLiteral */:
+ case 169 /* TypeLiteral */:
return ts.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement));
- case 169 /* ArrayType */:
+ case 170 /* ArrayType */:
return ts.updateArrayTypeNode(node, visitNode(node.elementType, visitor, ts.isTypeNode));
- case 170 /* TupleType */:
+ case 171 /* TupleType */:
return ts.updateTupleTypeNode(node, nodesVisitor(node.elementTypes, visitor, ts.isTypeNode));
- case 171 /* OptionalType */:
+ case 172 /* OptionalType */:
return ts.updateOptionalTypeNode(node, visitNode(node.type, visitor, ts.isTypeNode));
- case 172 /* RestType */:
+ case 173 /* RestType */:
return ts.updateRestTypeNode(node, visitNode(node.type, visitor, ts.isTypeNode));
- case 173 /* UnionType */:
+ case 174 /* UnionType */:
return ts.updateUnionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode));
- case 174 /* IntersectionType */:
+ case 175 /* IntersectionType */:
return ts.updateIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode));
- case 175 /* ConditionalType */:
+ case 176 /* ConditionalType */:
return ts.updateConditionalTypeNode(node, visitNode(node.checkType, visitor, ts.isTypeNode), visitNode(node.extendsType, visitor, ts.isTypeNode), visitNode(node.trueType, visitor, ts.isTypeNode), visitNode(node.falseType, visitor, ts.isTypeNode));
- case 176 /* InferType */:
+ case 177 /* InferType */:
return ts.updateInferTypeNode(node, visitNode(node.typeParameter, visitor, ts.isTypeParameterDeclaration));
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return ts.updateImportTypeNode(node, visitNode(node.argument, visitor, ts.isTypeNode), visitNode(node.qualifier, visitor, ts.isEntityName), visitNodes(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf);
- case 177 /* ParenthesizedType */:
+ case 178 /* ParenthesizedType */:
return ts.updateParenthesizedType(node, visitNode(node.type, visitor, ts.isTypeNode));
- case 179 /* TypeOperator */:
+ case 180 /* TypeOperator */:
return ts.updateTypeOperatorNode(node, visitNode(node.type, visitor, ts.isTypeNode));
- case 180 /* IndexedAccessType */:
+ case 181 /* IndexedAccessType */:
return ts.updateIndexedAccessTypeNode(node, visitNode(node.objectType, visitor, ts.isTypeNode), visitNode(node.indexType, visitor, ts.isTypeNode));
- case 181 /* MappedType */:
+ case 182 /* MappedType */:
return ts.updateMappedTypeNode(node, visitNode(node.readonlyToken, tokenVisitor, ts.isToken), visitNode(node.typeParameter, visitor, ts.isTypeParameterDeclaration), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode));
- case 182 /* LiteralType */:
+ case 183 /* LiteralType */:
return ts.updateLiteralTypeNode(node, visitNode(node.literal, visitor, ts.isExpression));
// Binding patterns
- case 184 /* ObjectBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
return ts.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement));
- case 185 /* ArrayBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
return ts.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement));
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return ts.updateBindingElement(node, visitNode(node.dotDotDotToken, tokenVisitor, ts.isToken), visitNode(node.propertyName, visitor, ts.isPropertyName), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression));
// Expression
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return ts.updateArrayLiteral(node, nodesVisitor(node.elements, visitor, ts.isExpression));
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return ts.updateObjectLiteral(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike));
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier));
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression));
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression));
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression));
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return ts.updateTaggedTemplate(node, visitNode(node.tag, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isExpression), visitNode(node.template, visitor, ts.isTemplateLiteral));
- case 194 /* TypeAssertionExpression */:
+ case 195 /* TypeAssertionExpression */:
return ts.updateTypeAssertion(node, visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression));
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression));
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return ts.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context));
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return ts.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.equalsGreaterThanToken, visitor, ts.isToken), visitFunctionBody(node.body, visitor, context));
- case 198 /* DeleteExpression */:
+ case 199 /* DeleteExpression */:
return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression));
- case 199 /* TypeOfExpression */:
+ case 200 /* TypeOfExpression */:
return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression));
- case 200 /* VoidExpression */:
+ case 201 /* VoidExpression */:
return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression));
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
return ts.updateAwait(node, visitNode(node.expression, visitor, ts.isExpression));
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression));
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return ts.updatePostfix(node, visitNode(node.operand, visitor, ts.isExpression));
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return ts.updateBinary(node, visitNode(node.left, visitor, ts.isExpression), visitNode(node.right, visitor, ts.isExpression), visitNode(node.operatorToken, visitor, ts.isToken));
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.questionToken, visitor, ts.isToken), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.colonToken, visitor, ts.isToken), visitNode(node.whenFalse, visitor, ts.isExpression));
- case 206 /* TemplateExpression */:
+ case 207 /* TemplateExpression */:
return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan));
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return ts.updateYield(node, visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.expression, visitor, ts.isExpression));
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression));
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
return ts.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement));
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return ts.updateExpressionWithTypeArguments(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression));
- case 212 /* AsExpression */:
+ case 213 /* AsExpression */:
return ts.updateAsExpression(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.type, visitor, ts.isTypeNode));
- case 213 /* NonNullExpression */:
+ case 214 /* NonNullExpression */:
return ts.updateNonNullExpression(node, visitNode(node.expression, visitor, ts.isExpression));
- case 214 /* MetaProperty */:
+ case 215 /* MetaProperty */:
return ts.updateMetaProperty(node, visitNode(node.name, visitor, ts.isIdentifier));
// Misc
- case 216 /* TemplateSpan */:
+ case 217 /* TemplateSpan */:
return ts.updateTemplateSpan(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail));
// Element
- case 218 /* Block */:
+ case 219 /* Block */:
return ts.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement));
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return ts.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList));
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return ts.updateExpressionStatement(node, visitNode(node.expression, visitor, ts.isExpression));
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, ts.liftToBlock));
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.expression, visitor, ts.isExpression));
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return ts.updateForOf(node, visitNode(node.awaitModifier, visitor, ts.isToken), visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
- case 228 /* ContinueStatement */:
+ case 229 /* ContinueStatement */:
return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier));
- case 229 /* BreakStatement */:
+ case 230 /* BreakStatement */:
return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier));
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression));
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock));
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
- case 234 /* ThrowStatement */:
+ case 235 /* ThrowStatement */:
return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression));
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause), visitNode(node.finallyBlock, visitor, ts.isBlock));
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression));
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
return ts.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration));
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return ts.updateFunctionDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context));
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return ts.updateClassDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement));
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
return ts.updateInterfaceDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement));
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return ts.updateTypeAliasDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return ts.updateEnumDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember));
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return ts.updateModuleDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.body, visitor, ts.isModuleBody));
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
return ts.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement));
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
return ts.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause));
- case 247 /* NamespaceExportDeclaration */:
+ case 248 /* NamespaceExportDeclaration */:
return ts.updateNamespaceExportDeclaration(node, visitNode(node.name, visitor, ts.isIdentifier));
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return ts.updateImportEqualsDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.moduleReference, visitor, ts.isModuleReference));
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return ts.updateImportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause), visitNode(node.moduleSpecifier, visitor, ts.isExpression));
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings));
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier));
- case 252 /* NamedImports */:
+ case 253 /* NamedImports */:
return ts.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier));
- case 253 /* ImportSpecifier */:
+ case 254 /* ImportSpecifier */:
return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier));
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return ts.updateExportAssignment(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression));
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return ts.updateExportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports), visitNode(node.moduleSpecifier, visitor, ts.isExpression));
- case 256 /* NamedExports */:
+ case 257 /* NamedExports */:
return ts.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier));
- case 257 /* ExportSpecifier */:
+ case 258 /* ExportSpecifier */:
return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier));
// Module references
- case 259 /* ExternalModuleReference */:
+ case 260 /* ExternalModuleReference */:
return ts.updateExternalModuleReference(node, visitNode(node.expression, visitor, ts.isExpression));
// JSX
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement));
- case 261 /* JsxSelfClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.attributes, visitor, ts.isJsxAttributes));
- case 262 /* JsxOpeningElement */:
+ case 263 /* JsxOpeningElement */:
return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.attributes, visitor, ts.isJsxAttributes));
- case 263 /* JsxClosingElement */:
+ case 264 /* JsxClosingElement */:
return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression));
- case 264 /* JsxFragment */:
+ case 265 /* JsxFragment */:
return ts.updateJsxFragment(node, visitNode(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingFragment, visitor, ts.isJsxClosingFragment));
- case 267 /* JsxAttribute */:
+ case 268 /* JsxAttribute */:
return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression));
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
return ts.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike));
- case 269 /* JsxSpreadAttribute */:
+ case 270 /* JsxSpreadAttribute */:
return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression));
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression));
// Clauses
- case 271 /* CaseClause */:
+ case 272 /* CaseClause */:
return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement));
- case 272 /* DefaultClause */:
+ case 273 /* DefaultClause */:
return ts.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement));
- case 273 /* HeritageClause */:
+ case 274 /* HeritageClause */:
return ts.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments));
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock));
// Property assignments
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression));
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression));
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression));
// Enum
- case 278 /* EnumMember */:
+ case 279 /* EnumMember */:
return ts.updateEnumMember(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression));
// Top-level nodes
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context));
// Transformation nodes
- case 313 /* PartiallyEmittedExpression */:
+ case 314 /* PartiallyEmittedExpression */:
return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression));
- case 314 /* CommaListExpression */:
+ case 315 /* CommaListExpression */:
return ts.updateCommaList(node, nodesVisitor(node.elements, visitor, ts.isExpression));
default:
// No need to visit nodes with no children.
@@ -65347,58 +66234,58 @@
var cbNodes = cbNodeArray || cbNode;
var kind = node.kind;
// No need to visit nodes with no children.
- if ((kind > 0 /* FirstToken */ && kind <= 147 /* LastToken */)) {
+ if ((kind > 0 /* FirstToken */ && kind <= 148 /* LastToken */)) {
return initial;
}
// We do not yet support types.
- if ((kind >= 163 /* TypePredicate */ && kind <= 182 /* LiteralType */)) {
+ if ((kind >= 164 /* TypePredicate */ && kind <= 183 /* LiteralType */)) {
return initial;
}
var result = initial;
switch (node.kind) {
// Leaf nodes
- case 217 /* SemicolonClassElement */:
- case 220 /* EmptyStatement */:
- case 210 /* OmittedExpression */:
- case 236 /* DebuggerStatement */:
- case 312 /* NotEmittedStatement */:
+ case 218 /* SemicolonClassElement */:
+ case 221 /* EmptyStatement */:
+ case 211 /* OmittedExpression */:
+ case 237 /* DebuggerStatement */:
+ case 313 /* NotEmittedStatement */:
// No need to visit nodes with no children.
break;
// Names
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
result = reduceNode(node.left, cbNode, result);
result = reduceNode(node.right, cbNode, result);
break;
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
result = reduceNode(node.expression, cbNode, result);
break;
// Signature elements
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
result = reduceNode(node.expression, cbNode, result);
break;
// Type member
- case 153 /* PropertySignature */:
+ case 154 /* PropertySignature */:
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.questionToken, cbNode, result);
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
@@ -65407,12 +66294,12 @@
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNodes(node.parameters, cbNodes, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
@@ -65420,7 +66307,7 @@
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
@@ -65428,50 +66315,50 @@
result = reduceNode(node.body, cbNode, result);
break;
// Binding patterns
- case 184 /* ObjectBindingPattern */:
- case 185 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
result = reduceNodes(node.elements, cbNodes, result);
break;
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
result = reduceNode(node.propertyName, cbNode, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
// Expression
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
result = reduceNodes(node.elements, cbNodes, result);
break;
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
result = reduceNodes(node.properties, cbNodes, result);
break;
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.name, cbNode, result);
break;
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.argumentExpression, cbNode, result);
break;
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNodes(node.typeArguments, cbNodes, result);
result = reduceNodes(node.arguments, cbNodes, result);
break;
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNodes(node.typeArguments, cbNodes, result);
result = reduceNodes(node.arguments, cbNodes, result);
break;
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
result = reduceNode(node.tag, cbNode, result);
result = reduceNodes(node.typeArguments, cbNodes, result);
result = reduceNode(node.template, cbNode, result);
break;
- case 194 /* TypeAssertionExpression */:
+ case 195 /* TypeAssertionExpression */:
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.expression, cbNode, result);
break;
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNodes(node.typeParameters, cbNodes, result);
@@ -65479,123 +66366,123 @@
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNodes(node.typeParameters, cbNodes, result);
result = reduceNodes(node.parameters, cbNodes, result);
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 195 /* ParenthesizedExpression */:
- case 198 /* DeleteExpression */:
- case 199 /* TypeOfExpression */:
- case 200 /* VoidExpression */:
- case 201 /* AwaitExpression */:
- case 207 /* YieldExpression */:
- case 208 /* SpreadElement */:
- case 213 /* NonNullExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 199 /* DeleteExpression */:
+ case 200 /* TypeOfExpression */:
+ case 201 /* VoidExpression */:
+ case 202 /* AwaitExpression */:
+ case 208 /* YieldExpression */:
+ case 209 /* SpreadElement */:
+ case 214 /* NonNullExpression */:
result = reduceNode(node.expression, cbNode, result);
break;
- case 202 /* PrefixUnaryExpression */:
- case 203 /* PostfixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
result = reduceNode(node.operand, cbNode, result);
break;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
result = reduceNode(node.left, cbNode, result);
result = reduceNode(node.right, cbNode, result);
break;
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
result = reduceNode(node.condition, cbNode, result);
result = reduceNode(node.whenTrue, cbNode, result);
result = reduceNode(node.whenFalse, cbNode, result);
break;
- case 206 /* TemplateExpression */:
+ case 207 /* TemplateExpression */:
result = reduceNode(node.head, cbNode, result);
result = reduceNodes(node.templateSpans, cbNodes, result);
break;
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNodes(node.typeParameters, cbNodes, result);
result = reduceNodes(node.heritageClauses, cbNodes, result);
result = reduceNodes(node.members, cbNodes, result);
break;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNodes(node.typeArguments, cbNodes, result);
break;
- case 212 /* AsExpression */:
+ case 213 /* AsExpression */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.type, cbNode, result);
break;
// Misc
- case 216 /* TemplateSpan */:
+ case 217 /* TemplateSpan */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.literal, cbNode, result);
break;
// Element
- case 218 /* Block */:
+ case 219 /* Block */:
result = reduceNodes(node.statements, cbNodes, result);
break;
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.declarationList, cbNode, result);
break;
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
result = reduceNode(node.expression, cbNode, result);
break;
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.thenStatement, cbNode, result);
result = reduceNode(node.elseStatement, cbNode, result);
break;
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
result = reduceNode(node.statement, cbNode, result);
result = reduceNode(node.expression, cbNode, result);
break;
- case 224 /* WhileStatement */:
- case 231 /* WithStatement */:
+ case 225 /* WhileStatement */:
+ case 232 /* WithStatement */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.statement, cbNode, result);
break;
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
result = reduceNode(node.initializer, cbNode, result);
result = reduceNode(node.condition, cbNode, result);
result = reduceNode(node.incrementor, cbNode, result);
result = reduceNode(node.statement, cbNode, result);
break;
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
result = reduceNode(node.initializer, cbNode, result);
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.statement, cbNode, result);
break;
- case 230 /* ReturnStatement */:
- case 234 /* ThrowStatement */:
+ case 231 /* ReturnStatement */:
+ case 235 /* ThrowStatement */:
result = reduceNode(node.expression, cbNode, result);
break;
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.caseBlock, cbNode, result);
break;
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
result = reduceNode(node.label, cbNode, result);
result = reduceNode(node.statement, cbNode, result);
break;
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
result = reduceNode(node.tryBlock, cbNode, result);
result = reduceNode(node.catchClause, cbNode, result);
result = reduceNode(node.finallyBlock, cbNode, result);
break;
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
result = reduceNodes(node.declarations, cbNodes, result);
break;
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
@@ -65604,7 +66491,7 @@
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
@@ -65612,140 +66499,140 @@
result = reduceNodes(node.heritageClauses, cbNodes, result);
result = reduceNodes(node.members, cbNodes, result);
break;
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNodes(node.members, cbNodes, result);
break;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
result = reduceNodes(node.statements, cbNodes, result);
break;
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
result = reduceNodes(node.clauses, cbNodes, result);
break;
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.moduleReference, cbNode, result);
break;
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.importClause, cbNode, result);
result = reduceNode(node.moduleSpecifier, cbNode, result);
break;
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.namedBindings, cbNode, result);
break;
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
result = reduceNode(node.name, cbNode, result);
break;
- case 252 /* NamedImports */:
- case 256 /* NamedExports */:
+ case 253 /* NamedImports */:
+ case 257 /* NamedExports */:
result = reduceNodes(node.elements, cbNodes, result);
break;
- case 253 /* ImportSpecifier */:
- case 257 /* ExportSpecifier */:
+ case 254 /* ImportSpecifier */:
+ case 258 /* ExportSpecifier */:
result = reduceNode(node.propertyName, cbNode, result);
result = reduceNode(node.name, cbNode, result);
break;
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
result = ts.reduceLeft(node.decorators, cbNode, result);
result = ts.reduceLeft(node.modifiers, cbNode, result);
result = reduceNode(node.expression, cbNode, result);
break;
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
result = ts.reduceLeft(node.decorators, cbNode, result);
result = ts.reduceLeft(node.modifiers, cbNode, result);
result = reduceNode(node.exportClause, cbNode, result);
result = reduceNode(node.moduleSpecifier, cbNode, result);
break;
// Module references
- case 259 /* ExternalModuleReference */:
+ case 260 /* ExternalModuleReference */:
result = reduceNode(node.expression, cbNode, result);
break;
// JSX
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
result = reduceNode(node.openingElement, cbNode, result);
result = ts.reduceLeft(node.children, cbNode, result);
result = reduceNode(node.closingElement, cbNode, result);
break;
- case 264 /* JsxFragment */:
+ case 265 /* JsxFragment */:
result = reduceNode(node.openingFragment, cbNode, result);
result = ts.reduceLeft(node.children, cbNode, result);
result = reduceNode(node.closingFragment, cbNode, result);
break;
- case 261 /* JsxSelfClosingElement */:
- case 262 /* JsxOpeningElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
result = reduceNode(node.tagName, cbNode, result);
result = reduceNodes(node.typeArguments, cbNode, result);
result = reduceNode(node.attributes, cbNode, result);
break;
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
result = reduceNodes(node.properties, cbNodes, result);
break;
- case 263 /* JsxClosingElement */:
+ case 264 /* JsxClosingElement */:
result = reduceNode(node.tagName, cbNode, result);
break;
- case 267 /* JsxAttribute */:
+ case 268 /* JsxAttribute */:
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
- case 269 /* JsxSpreadAttribute */:
+ case 270 /* JsxSpreadAttribute */:
result = reduceNode(node.expression, cbNode, result);
break;
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
result = reduceNode(node.expression, cbNode, result);
break;
// Clauses
- case 271 /* CaseClause */:
+ case 272 /* CaseClause */:
result = reduceNode(node.expression, cbNode, result);
// falls through
- case 272 /* DefaultClause */:
+ case 273 /* DefaultClause */:
result = reduceNodes(node.statements, cbNodes, result);
break;
- case 273 /* HeritageClause */:
+ case 274 /* HeritageClause */:
result = reduceNodes(node.types, cbNodes, result);
break;
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
result = reduceNode(node.variableDeclaration, cbNode, result);
result = reduceNode(node.block, cbNode, result);
break;
// Property assignments
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.objectAssignmentInitializer, cbNode, result);
break;
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
result = reduceNode(node.expression, cbNode, result);
break;
// Enum
- case 278 /* EnumMember */:
+ case 279 /* EnumMember */:
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
// Top-level nodes
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
result = reduceNodes(node.statements, cbNodes, result);
break;
// Transformation nodes
- case 313 /* PartiallyEmittedExpression */:
+ case 314 /* PartiallyEmittedExpression */:
result = reduceNode(node.expression, cbNode, result);
break;
- case 314 /* CommaListExpression */:
+ case 315 /* CommaListExpression */:
result = reduceNodes(node.elements, cbNodes, result);
break;
default:
@@ -65769,7 +66656,7 @@
* @param nodes The NodeArray.
*/
function liftToBlock(nodes) {
- Debug.assert(ts.every(nodes, ts.isStatement), "Cannot lift nodes to a Block.");
+ ts.Debug.assert(ts.every(nodes, ts.isStatement), "Cannot lift nodes to a Block.");
return ts.singleOrUndefined(nodes) || ts.createBlock(nodes);
}
ts.liftToBlock = liftToBlock;
@@ -65818,7 +66705,7 @@
function aggregateTransformFlagsForSubtree(node) {
// We do not transform ambient declarations or types, so there is no need to
// recursively aggregate transform flags.
- if (ts.hasModifier(node, 2 /* Ambient */) || (ts.isTypeNode(node) && node.kind !== 211 /* ExpressionWithTypeArguments */)) {
+ if (ts.hasModifier(node, 2 /* Ambient */) || (ts.isTypeNode(node) && node.kind !== 212 /* ExpressionWithTypeArguments */)) {
return 0 /* None */;
}
// Aggregate the transform flags of each child.
@@ -65834,73 +66721,6 @@
function aggregateTransformFlagsForChildNodes(transformFlags, nodes) {
return transformFlags | aggregateTransformFlagsForNodeArray(nodes);
}
- var Debug;
- (function (Debug) {
- var isDebugInfoEnabled = false;
- function failBadSyntaxKind(node, message) {
- return Debug.fail((message || "Unexpected node.") + "\r\nNode " + ts.formatSyntaxKind(node.kind) + " was unexpected.", failBadSyntaxKind);
- }
- Debug.failBadSyntaxKind = failBadSyntaxKind;
- Debug.assertEachNode = Debug.shouldAssert(1 /* Normal */)
- ? function (nodes, test, message) { return Debug.assert(test === undefined || ts.every(nodes, test), message || "Unexpected node.", function () { return "Node array did not pass test '" + Debug.getFunctionName(test) + "'."; }, Debug.assertEachNode); }
- : ts.noop;
- Debug.assertNode = Debug.shouldAssert(1 /* Normal */)
- ? function (node, test, message) { return Debug.assert(test === undefined || test(node), message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " did not pass test '" + Debug.getFunctionName(test) + "'."; }, Debug.assertNode); }
- : ts.noop;
- Debug.assertOptionalNode = Debug.shouldAssert(1 /* Normal */)
- ? function (node, test, message) { return Debug.assert(test === undefined || node === undefined || test(node), message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " did not pass test '" + Debug.getFunctionName(test) + "'."; }, Debug.assertOptionalNode); }
- : ts.noop;
- Debug.assertOptionalToken = Debug.shouldAssert(1 /* Normal */)
- ? function (node, kind, message) { return Debug.assert(kind === undefined || node === undefined || node.kind === kind, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was not a '" + ts.formatSyntaxKind(kind) + "' token."; }, Debug.assertOptionalToken); }
- : ts.noop;
- Debug.assertMissingNode = Debug.shouldAssert(1 /* Normal */)
- ? function (node, message) { return Debug.assert(node === undefined, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was unexpected'."; }, Debug.assertMissingNode); }
- : ts.noop;
- /**
- * Injects debug information into frequently used types.
- */
- function enableDebugInfo() {
- if (isDebugInfoEnabled)
- return;
- // Add additional properties in debug mode to assist with debugging.
- Object.defineProperties(ts.objectAllocator.getSymbolConstructor().prototype, {
- __debugFlags: { get: function () { return ts.formatSymbolFlags(this.flags); } }
- });
- Object.defineProperties(ts.objectAllocator.getTypeConstructor().prototype, {
- __debugFlags: { get: function () { return ts.formatTypeFlags(this.flags); } },
- __debugObjectFlags: { get: function () { return this.flags & 524288 /* Object */ ? ts.formatObjectFlags(this.objectFlags) : ""; } },
- __debugTypeToString: { value: function () { return this.checker.typeToString(this); } },
- });
- var nodeConstructors = [
- ts.objectAllocator.getNodeConstructor(),
- ts.objectAllocator.getIdentifierConstructor(),
- ts.objectAllocator.getTokenConstructor(),
- ts.objectAllocator.getSourceFileConstructor()
- ];
- for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) {
- var ctor = nodeConstructors_1[_i];
- if (!ctor.prototype.hasOwnProperty("__debugKind")) {
- Object.defineProperties(ctor.prototype, {
- __debugKind: { get: function () { return ts.formatSyntaxKind(this.kind); } },
- __debugModifierFlags: { get: function () { return ts.formatModifierFlags(ts.getModifierFlagsNoCache(this)); } },
- __debugTransformFlags: { get: function () { return ts.formatTransformFlags(this.transformFlags); } },
- __debugEmitFlags: { get: function () { return ts.formatEmitFlags(ts.getEmitFlags(this)); } },
- __debugGetText: {
- value: function (includeTrivia) {
- if (ts.nodeIsSynthesized(this))
- return "";
- var parseNode = ts.getParseTreeNode(this);
- var sourceFile = parseNode && ts.getSourceFileOfNode(parseNode);
- return sourceFile ? ts.getSourceTextOfNodeFromSourceFile(sourceFile, parseNode, includeTrivia) : "";
- }
- }
- });
- }
- }
- isDebugInfoEnabled = true;
- }
- Debug.enableDebugInfo = enableDebugInfo;
- })(Debug = ts.Debug || (ts.Debug = {}));
})(ts || (ts = {}));
/* @internal */
var ts;
@@ -66558,7 +67378,7 @@
function chainBundle(transformSourceFile) {
return transformSourceFileOrBundle;
function transformSourceFileOrBundle(node) {
- return node.kind === 284 /* SourceFile */ ? transformSourceFile(node) : transformBundle(node);
+ return node.kind === 285 /* SourceFile */ ? transformSourceFile(node) : transformBundle(node);
}
function transformBundle(node) {
return ts.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends);
@@ -66604,7 +67424,7 @@
for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {
var node = _a[_i];
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
// import "mod"
// import x from "mod"
// import * as x from "mod"
@@ -66612,13 +67432,13 @@
externalImports.push(node);
hasImportStarOrImportDefault = hasImportStarOrImportDefault || getImportNeedsImportStarHelper(node) || getImportNeedsImportDefaultHelper(node);
break;
- case 248 /* ImportEqualsDeclaration */:
- if (node.moduleReference.kind === 259 /* ExternalModuleReference */) {
+ case 249 /* ImportEqualsDeclaration */:
+ if (node.moduleReference.kind === 260 /* ExternalModuleReference */) {
// import x = require("mod")
externalImports.push(node);
}
break;
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
if (node.moduleSpecifier) {
if (!node.exportClause) {
// export * from "mod"
@@ -66648,13 +67468,13 @@
}
}
break;
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
if (node.isExportEquals && !exportEquals) {
// export = x
exportEquals = node;
}
break;
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
if (ts.hasModifier(node, 1 /* Export */)) {
for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) {
var decl = _e[_d];
@@ -66662,7 +67482,7 @@
}
}
break;
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
if (ts.hasModifier(node, 1 /* Export */)) {
if (ts.hasModifier(node, 512 /* Default */)) {
// export default function() { }
@@ -66682,7 +67502,7 @@
}
}
break;
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
if (ts.hasModifier(node, 1 /* Export */)) {
if (ts.hasModifier(node, 512 /* Default */)) {
// export default class { }
@@ -67222,7 +68042,7 @@
ts.restHelper = {
name: "typescript:rest",
scoped: false,
- text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\n t[p[i]] = s[p[i]];\n return t;\n };"
+ text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n };"
};
/** Given value: o, propName: p, pattern: { a, b, ...p } from the original statement
* `{ a, b, ...p } = o`, create `p = __rest(o, ["a", "b"]);`
@@ -67298,8 +68118,8 @@
context.onEmitNode = onEmitNode;
context.onSubstituteNode = onSubstituteNode;
// Enable substitution for property/element access to emit const enum values.
- context.enableSubstitution(189 /* PropertyAccessExpression */);
- context.enableSubstitution(190 /* ElementAccessExpression */);
+ context.enableSubstitution(190 /* PropertyAccessExpression */);
+ context.enableSubstitution(191 /* ElementAccessExpression */);
// These variables contain state that changes as we descend into the tree.
var currentSourceFile;
var currentNamespace;
@@ -67329,14 +68149,14 @@
var pendingExpressions;
return transformSourceFileOrBundle;
function transformSourceFileOrBundle(node) {
- if (node.kind === 285 /* Bundle */) {
+ if (node.kind === 286 /* Bundle */) {
return transformBundle(node);
}
return transformSourceFile(node);
}
function transformBundle(node) {
return ts.createBundle(node.sourceFiles.map(transformSourceFile), ts.mapDefined(node.prepends, function (prepend) {
- if (prepend.kind === 287 /* InputFiles */) {
+ if (prepend.kind === 288 /* InputFiles */) {
return ts.createUnparsedSourceFile(prepend, "js");
}
return prepend;
@@ -67385,16 +68205,16 @@
*/
function onBeforeVisitNode(node) {
switch (node.kind) {
- case 284 /* SourceFile */:
- case 246 /* CaseBlock */:
- case 245 /* ModuleBlock */:
- case 218 /* Block */:
+ case 285 /* SourceFile */:
+ case 247 /* CaseBlock */:
+ case 246 /* ModuleBlock */:
+ case 219 /* Block */:
currentLexicalScope = node;
currentNameScope = undefined;
currentScopeFirstDeclarationsOfName = undefined;
break;
- case 240 /* ClassDeclaration */:
- case 239 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 240 /* FunctionDeclaration */:
if (ts.hasModifier(node, 2 /* Ambient */)) {
break;
}
@@ -67406,7 +68226,7 @@
// These nodes should always have names unless they are default-exports;
// however, class declaration parsing allows for undefined names, so syntactically invalid
// programs may also have an undefined name.
- ts.Debug.assert(node.kind === 240 /* ClassDeclaration */ || ts.hasModifier(node, 512 /* Default */));
+ ts.Debug.assert(node.kind === 241 /* ClassDeclaration */ || ts.hasModifier(node, 512 /* Default */));
}
if (ts.isClassDeclaration(node)) {
// XXX: should probably also cover interfaces and type aliases that can have type variables?
@@ -67449,10 +68269,10 @@
*/
function sourceElementVisitorWorker(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
- case 254 /* ExportAssignment */:
- case 255 /* ExportDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 255 /* ExportAssignment */:
+ case 256 /* ExportDeclaration */:
return visitEllidableStatement(node);
default:
return visitorWorker(node);
@@ -67473,13 +68293,13 @@
return node;
}
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return visitImportDeclaration(node);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return visitImportEqualsDeclaration(node);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return visitExportAssignment(node);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return visitExportDeclaration(node);
default:
ts.Debug.fail("Unhandled ellided statement");
@@ -67499,11 +68319,11 @@
* @param node The node to visit.
*/
function namespaceElementVisitorWorker(node) {
- if (node.kind === 255 /* ExportDeclaration */ ||
- node.kind === 249 /* ImportDeclaration */ ||
- node.kind === 250 /* ImportClause */ ||
- (node.kind === 248 /* ImportEqualsDeclaration */ &&
- node.moduleReference.kind === 259 /* ExternalModuleReference */)) {
+ if (node.kind === 256 /* ExportDeclaration */ ||
+ node.kind === 250 /* ImportDeclaration */ ||
+ node.kind === 251 /* ImportClause */ ||
+ (node.kind === 249 /* ImportEqualsDeclaration */ &&
+ node.moduleReference.kind === 260 /* ExternalModuleReference */)) {
// do not emit ES6 imports and exports since they are illegal inside a namespace
return undefined;
}
@@ -67527,19 +68347,19 @@
*/
function classElementVisitorWorker(node) {
switch (node.kind) {
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
// TypeScript constructors are transformed in `visitClassDeclaration`.
// We elide them here as `visitorWorker` checks transform flags, which could
// erronously include an ES6 constructor without TypeScript syntax.
return undefined;
- case 154 /* PropertyDeclaration */:
- case 162 /* IndexSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 156 /* MethodDeclaration */:
+ case 155 /* PropertyDeclaration */:
+ case 163 /* IndexSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
// Fallback to the default visit behavior.
return visitorWorker(node);
- case 217 /* SemicolonClassElement */:
+ case 218 /* SemicolonClassElement */:
return node;
default:
return ts.Debug.failBadSyntaxKind(node);
@@ -67549,7 +68369,7 @@
if (ts.modifierToFlag(node.kind) & 2270 /* TypeScriptModifier */) {
return undefined;
}
- else if (currentNamespace && node.kind === 85 /* ExportKeyword */) {
+ else if (currentNamespace && node.kind === 86 /* ExportKeyword */) {
return undefined;
}
return node;
@@ -67566,67 +68386,67 @@
return ts.createNotEmittedStatement(node);
}
switch (node.kind) {
- case 85 /* ExportKeyword */:
- case 80 /* DefaultKeyword */:
+ case 86 /* ExportKeyword */:
+ case 81 /* DefaultKeyword */:
// ES6 export and default modifiers are elided when inside a namespace.
return currentNamespace ? undefined : node;
- case 115 /* PublicKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 118 /* AbstractKeyword */:
- case 77 /* ConstKeyword */:
- case 125 /* DeclareKeyword */:
- case 133 /* ReadonlyKeyword */:
+ case 116 /* PublicKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 119 /* AbstractKeyword */:
+ case 78 /* ConstKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 134 /* ReadonlyKeyword */:
// TypeScript accessibility and readonly modifiers are elided.
- case 169 /* ArrayType */:
- case 170 /* TupleType */:
- case 171 /* OptionalType */:
- case 172 /* RestType */:
- case 168 /* TypeLiteral */:
- case 163 /* TypePredicate */:
- case 150 /* TypeParameter */:
- case 120 /* AnyKeyword */:
- case 143 /* UnknownKeyword */:
- case 123 /* BooleanKeyword */:
- case 138 /* StringKeyword */:
- case 135 /* NumberKeyword */:
- case 132 /* NeverKeyword */:
- case 106 /* VoidKeyword */:
- case 139 /* SymbolKeyword */:
- case 166 /* ConstructorType */:
- case 165 /* FunctionType */:
- case 167 /* TypeQuery */:
- case 164 /* TypeReference */:
- case 173 /* UnionType */:
- case 174 /* IntersectionType */:
- case 175 /* ConditionalType */:
- case 177 /* ParenthesizedType */:
- case 178 /* ThisType */:
- case 179 /* TypeOperator */:
- case 180 /* IndexedAccessType */:
- case 181 /* MappedType */:
- case 182 /* LiteralType */:
+ case 170 /* ArrayType */:
+ case 171 /* TupleType */:
+ case 172 /* OptionalType */:
+ case 173 /* RestType */:
+ case 169 /* TypeLiteral */:
+ case 164 /* TypePredicate */:
+ case 151 /* TypeParameter */:
+ case 121 /* AnyKeyword */:
+ case 144 /* UnknownKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 139 /* StringKeyword */:
+ case 136 /* NumberKeyword */:
+ case 133 /* NeverKeyword */:
+ case 107 /* VoidKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 167 /* ConstructorType */:
+ case 166 /* FunctionType */:
+ case 168 /* TypeQuery */:
+ case 165 /* TypeReference */:
+ case 174 /* UnionType */:
+ case 175 /* IntersectionType */:
+ case 176 /* ConditionalType */:
+ case 178 /* ParenthesizedType */:
+ case 179 /* ThisType */:
+ case 180 /* TypeOperator */:
+ case 181 /* IndexedAccessType */:
+ case 182 /* MappedType */:
+ case 183 /* LiteralType */:
// TypeScript type nodes are elided.
- case 162 /* IndexSignature */:
+ case 163 /* IndexSignature */:
// TypeScript index signatures are elided.
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
// TypeScript decorators are elided. They will be emitted as part of visitClassDeclaration.
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
// TypeScript type-only declarations are elided.
return undefined;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
// TypeScript property declarations are elided. However their names are still visited, and can potentially be retained if they could have sideeffects
return visitPropertyDeclaration(node);
- case 247 /* NamespaceExportDeclaration */:
+ case 248 /* NamespaceExportDeclaration */:
// TypeScript namespace export declarations are elided.
return undefined;
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return visitConstructor(node);
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
// TypeScript interfaces are elided, but some comments may be preserved.
// See the implementation of `getLeadingComments` in comments.ts for more details.
return ts.createNotEmittedStatement(node);
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
// This may be a class declaration with TypeScript syntax extensions.
//
// TypeScript class syntax extensions include:
@@ -67637,7 +68457,7 @@
// - index signatures
// - method overload signatures
return visitClassDeclaration(node);
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
// This may be a class expression with TypeScript syntax extensions.
//
// TypeScript class syntax extensions include:
@@ -67648,35 +68468,35 @@
// - index signatures
// - method overload signatures
return visitClassExpression(node);
- case 273 /* HeritageClause */:
+ case 274 /* HeritageClause */:
// This may be a heritage clause with TypeScript syntax extensions.
//
// TypeScript heritage clause extensions include:
// - `implements` clause
return visitHeritageClause(node);
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
// TypeScript supports type arguments on an expression in an `extends` heritage clause.
return visitExpressionWithTypeArguments(node);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
// TypeScript method declarations may have decorators, modifiers
// or type annotations.
return visitMethodDeclaration(node);
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
// Get Accessors can have TypeScript modifiers, decorators, and type annotations.
return visitGetAccessor(node);
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
// Set Accessors can have TypeScript modifiers and type annotations.
return visitSetAccessor(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
// Typescript function declarations can have modifiers, decorators, and type annotations.
return visitFunctionDeclaration(node);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
// TypeScript function expressions can have modifiers and type annotations.
return visitFunctionExpression(node);
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
// TypeScript arrow functions can have modifiers and type annotations.
return visitArrowFunction(node);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
// This may be a parameter declaration with TypeScript syntax extensions.
//
// TypeScript parameter declaration syntax extensions include:
@@ -67686,35 +68506,35 @@
// - type annotations
// - this parameters
return visitParameter(node);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
// ParenthesizedExpressions are TypeScript if their expression is a
// TypeAssertion or AsExpression
return visitParenthesizedExpression(node);
- case 194 /* TypeAssertionExpression */:
- case 212 /* AsExpression */:
+ case 195 /* TypeAssertionExpression */:
+ case 213 /* AsExpression */:
// TypeScript type assertions are removed, but their subtrees are preserved.
return visitAssertionExpression(node);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return visitCallExpression(node);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return visitNewExpression(node);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return visitTaggedTemplateExpression(node);
- case 213 /* NonNullExpression */:
+ case 214 /* NonNullExpression */:
// TypeScript non-null expressions are removed, but their subtrees are preserved.
return visitNonNullExpression(node);
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
// TypeScript enum declarations do not exist in ES6 and must be rewritten.
return visitEnumDeclaration(node);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
// TypeScript namespace exports for variable statements must be transformed.
return visitVariableStatement(node);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return visitVariableDeclaration(node);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
// TypeScript namespace declarations must be transformed.
return visitModuleDeclaration(node);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
// TypeScript namespace or external module import.
return visitImportEqualsDeclaration(node);
default:
@@ -67752,7 +68572,7 @@
if (ts.some(staticProperties))
facts |= 1 /* HasStaticInitializedProperties */;
var extendsClauseElement = ts.getEffectiveBaseTypeNode(node);
- if (extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 96 /* NullKeyword */)
+ if (extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 97 /* NullKeyword */)
facts |= 64 /* IsDerivedClass */;
if (shouldEmitDecorateCallForClass(node))
facts |= 2 /* HasConstructorDecorators */;
@@ -68018,7 +68838,7 @@
pendingExpressions = undefined;
var staticProperties = getInitializedProperties(node, /*isStatic*/ true);
var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause);
- var members = transformClassMembers(node, ts.some(heritageClauses, function (c) { return c.token === 86 /* ExtendsKeyword */; }));
+ var members = transformClassMembers(node, ts.some(heritageClauses, function (c) { return c.token === 87 /* ExtendsKeyword */; }));
var classExpression = ts.createClassExpression(
/*modifiers*/ undefined, node.name,
/*typeParameters*/ undefined, heritageClauses, members);
@@ -68194,7 +69014,7 @@
return index;
}
var statement = statements[index];
- if (statement.kind === 221 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) {
+ if (statement.kind === 222 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) {
result.push(ts.visitNode(statement, visitor, ts.isStatement));
return index + 1;
}
@@ -68265,7 +69085,7 @@
* @param isStatic A value indicating whether the member should be a static or instance member.
*/
function isInitializedProperty(member, isStatic) {
- return member.kind === 154 /* PropertyDeclaration */
+ return member.kind === 155 /* PropertyDeclaration */
&& isStatic === ts.hasModifier(member, 32 /* Static */)
&& member.initializer !== undefined;
}
@@ -68276,8 +69096,8 @@
* @param receiver The receiver on which each property should be assigned.
*/
function addInitializedPropertyStatements(statements, properties, receiver) {
- for (var _i = 0, properties_8 = properties; _i < properties_8.length; _i++) {
- var property = properties_8[_i];
+ for (var _i = 0, properties_6 = properties; _i < properties_6.length; _i++) {
+ var property = properties_6[_i];
var statement = ts.createExpressionStatement(transformInitializedProperty(property, receiver));
ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property));
ts.setCommentRange(statement, property);
@@ -68293,8 +69113,8 @@
*/
function generateInitializedPropertyExpressions(properties, receiver) {
var expressions = [];
- for (var _i = 0, properties_9 = properties; _i < properties_9.length; _i++) {
- var property = properties_9[_i];
+ for (var _i = 0, properties_7 = properties; _i < properties_7.length; _i++) {
+ var property = properties_7[_i];
var expression = transformInitializedProperty(property, receiver);
ts.startOnNewLine(expression);
ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property));
@@ -68408,12 +69228,12 @@
*/
function getAllDecoratorsOfClassElement(node, member) {
switch (member.kind) {
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return getAllDecoratorsOfAccessors(node, member);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return getAllDecoratorsOfMethod(member);
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return getAllDecoratorsOfProperty(member);
default:
return undefined;
@@ -68566,7 +69386,7 @@
var prefix = getClassMemberPrefix(node, member);
var memberName = getExpressionForPropertyName(member, /*generateNameForComputedPropertyName*/ true);
var descriptor = languageVersion > 0 /* ES3 */
- ? member.kind === 154 /* PropertyDeclaration */
+ ? member.kind === 155 /* PropertyDeclaration */
// We emit `void 0` here to indicate to `__decorate` that it can invoke `Object.defineProperty` directly, but that it
// should not invoke `Object.getOwnPropertyDescriptor`.
? ts.createVoidZero()
@@ -68689,10 +69509,10 @@
*/
function shouldAddTypeMetadata(node) {
var kind = node.kind;
- return kind === 156 /* MethodDeclaration */
- || kind === 158 /* GetAccessor */
- || kind === 159 /* SetAccessor */
- || kind === 154 /* PropertyDeclaration */;
+ return kind === 157 /* MethodDeclaration */
+ || kind === 159 /* GetAccessor */
+ || kind === 160 /* SetAccessor */
+ || kind === 155 /* PropertyDeclaration */;
}
/**
* Determines whether to emit the "design:returntype" metadata based on the node's kind.
@@ -68702,7 +69522,7 @@
* @param node The node to test.
*/
function shouldAddReturnTypeMetadata(node) {
- return node.kind === 156 /* MethodDeclaration */;
+ return node.kind === 157 /* MethodDeclaration */;
}
/**
* Determines whether to emit the "design:paramtypes" metadata based on the node's kind.
@@ -68713,12 +69533,12 @@
*/
function shouldAddParamTypesMetadata(node) {
switch (node.kind) {
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
return ts.getFirstConstructorWithBody(node) !== undefined;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return true;
}
return false;
@@ -68735,15 +69555,15 @@
*/
function serializeTypeOfNode(node) {
switch (node.kind) {
- case 154 /* PropertyDeclaration */:
- case 151 /* Parameter */:
+ case 155 /* PropertyDeclaration */:
+ case 152 /* Parameter */:
return serializeTypeNode(node.type);
- case 159 /* SetAccessor */:
- case 158 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 159 /* GetAccessor */:
return serializeTypeNode(getAccessorTypeNode(node));
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 156 /* MethodDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 157 /* MethodDeclaration */:
return ts.createIdentifier("Function");
default:
return ts.createVoidZero();
@@ -68780,7 +69600,7 @@
return ts.createArrayLiteral(expressions);
}
function getParametersOfDecoratedDeclaration(node, container) {
- if (container && node.kind === 158 /* GetAccessor */) {
+ if (container && node.kind === 159 /* GetAccessor */) {
var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor;
if (setAccessor) {
return setAccessor.parameters;
@@ -68825,69 +69645,69 @@
return ts.createIdentifier("Object");
}
switch (node.kind) {
- case 106 /* VoidKeyword */:
- case 141 /* UndefinedKeyword */:
- case 96 /* NullKeyword */:
- case 132 /* NeverKeyword */:
+ case 107 /* VoidKeyword */:
+ case 142 /* UndefinedKeyword */:
+ case 97 /* NullKeyword */:
+ case 133 /* NeverKeyword */:
return ts.createVoidZero();
- case 177 /* ParenthesizedType */:
+ case 178 /* ParenthesizedType */:
return serializeTypeNode(node.type);
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
return ts.createIdentifier("Function");
- case 169 /* ArrayType */:
- case 170 /* TupleType */:
+ case 170 /* ArrayType */:
+ case 171 /* TupleType */:
return ts.createIdentifier("Array");
- case 163 /* TypePredicate */:
- case 123 /* BooleanKeyword */:
+ case 164 /* TypePredicate */:
+ case 124 /* BooleanKeyword */:
return ts.createIdentifier("Boolean");
- case 138 /* StringKeyword */:
+ case 139 /* StringKeyword */:
return ts.createIdentifier("String");
- case 136 /* ObjectKeyword */:
+ case 137 /* ObjectKeyword */:
return ts.createIdentifier("Object");
- case 182 /* LiteralType */:
+ case 183 /* LiteralType */:
switch (node.literal.kind) {
case 10 /* StringLiteral */:
return ts.createIdentifier("String");
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
case 8 /* NumericLiteral */:
return ts.createIdentifier("Number");
case 9 /* BigIntLiteral */:
return getGlobalBigIntNameWithFallback();
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
return ts.createIdentifier("Boolean");
default:
return ts.Debug.failBadSyntaxKind(node.literal);
}
- case 135 /* NumberKeyword */:
+ case 136 /* NumberKeyword */:
return ts.createIdentifier("Number");
- case 146 /* BigIntKeyword */:
+ case 147 /* BigIntKeyword */:
return getGlobalBigIntNameWithFallback();
- case 139 /* SymbolKeyword */:
+ case 140 /* SymbolKeyword */:
return languageVersion < 2 /* ES2015 */
? getGlobalSymbolNameWithFallback()
: ts.createIdentifier("Symbol");
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return serializeTypeReferenceNode(node);
- case 174 /* IntersectionType */:
- case 173 /* UnionType */:
+ case 175 /* IntersectionType */:
+ case 174 /* UnionType */:
return serializeTypeList(node.types);
- case 175 /* ConditionalType */:
+ case 176 /* ConditionalType */:
return serializeTypeList([node.trueType, node.falseType]);
- case 179 /* TypeOperator */:
- if (node.operator === 133 /* ReadonlyKeyword */) {
+ case 180 /* TypeOperator */:
+ if (node.operator === 134 /* ReadonlyKeyword */) {
return serializeTypeNode(node.type);
}
break;
- case 167 /* TypeQuery */:
- case 180 /* IndexedAccessType */:
- case 181 /* MappedType */:
- case 168 /* TypeLiteral */:
- case 120 /* AnyKeyword */:
- case 143 /* UnknownKeyword */:
- case 178 /* ThisType */:
- case 183 /* ImportType */:
+ case 168 /* TypeQuery */:
+ case 181 /* IndexedAccessType */:
+ case 182 /* MappedType */:
+ case 169 /* TypeLiteral */:
+ case 121 /* AnyKeyword */:
+ case 144 /* UnknownKeyword */:
+ case 179 /* ThisType */:
+ case 184 /* ImportType */:
break;
default:
return ts.Debug.failBadSyntaxKind(node);
@@ -68898,15 +69718,15 @@
// Note when updating logic here also update getEntityNameForDecoratorMetadata
// so that aliases can be marked as referenced
var serializedUnion;
- for (var _i = 0, types_18 = types; _i < types_18.length; _i++) {
- var typeNode = types_18[_i];
- while (typeNode.kind === 177 /* ParenthesizedType */) {
+ for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
+ var typeNode = types_17[_i];
+ while (typeNode.kind === 178 /* ParenthesizedType */) {
typeNode = typeNode.type; // Skip parens if need be
}
- if (typeNode.kind === 132 /* NeverKeyword */) {
+ if (typeNode.kind === 133 /* NeverKeyword */) {
continue; // Always elide `never` from the union/intersection if possible
}
- if (!strictNullChecks && (typeNode.kind === 96 /* NullKeyword */ || typeNode.kind === 141 /* UndefinedKeyword */)) {
+ if (!strictNullChecks && (typeNode.kind === 97 /* NullKeyword */ || typeNode.kind === 142 /* UndefinedKeyword */)) {
continue; // Elide null and undefined from unions for metadata, just like what we did prior to the implementation of strict null checks
}
var serializedIndividual = serializeTypeNode(typeNode);
@@ -68986,12 +69806,12 @@
* @param node The entity name to serialize.
*/
function serializeEntityNameAsExpressionFallback(node) {
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
// A -> typeof A !== undefined && A
var copied = serializeEntityNameAsExpression(node);
return createCheckedValue(copied, copied);
}
- if (node.left.kind === 72 /* Identifier */) {
+ if (node.left.kind === 73 /* Identifier */) {
// A.B -> typeof A !== undefined && A.B
return createCheckedValue(serializeEntityNameAsExpression(node.left), serializeEntityNameAsExpression(node));
}
@@ -69007,7 +69827,7 @@
*/
function serializeEntityNameAsExpression(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
// Create a clone of the name with a new parent, and treat it as if it were
// a source tree node for the purposes of the checker.
var name = ts.getMutableClone(node);
@@ -69015,7 +69835,7 @@
name.original = undefined;
name.parent = ts.getParseTreeNode(currentLexicalScope); // ensure the parent is set to a parse tree node.
return name;
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
return serializeQualifiedNameAsExpression(node);
}
}
@@ -69041,7 +69861,7 @@
* available.
*/
function getGlobalBigIntNameWithFallback() {
- return languageVersion < 7 /* ESNext */
+ return languageVersion < 8 /* ESNext */
? ts.createConditional(ts.createTypeCheck(ts.createIdentifier("BigInt"), "function"), ts.createIdentifier("BigInt"), ts.createIdentifier("Object"))
: ts.createIdentifier("BigInt");
}
@@ -69125,7 +69945,7 @@
* @param node The HeritageClause to transform.
*/
function visitHeritageClause(node) {
- if (node.token === 109 /* ImplementsKeyword */) {
+ if (node.token === 110 /* ImplementsKeyword */) {
// implements clauses are elided
return undefined;
}
@@ -69364,7 +70184,7 @@
*/
function visitEnumDeclaration(node) {
if (!shouldEmitEnumDeclaration(node)) {
- return undefined;
+ return ts.createNotEmittedStatement(node);
}
var statements = [];
// We request to be advised when the printer is about to print this node. This allows
@@ -69532,12 +70352,12 @@
// enums in any other scope are emitted as a `let` declaration.
var statement = ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([
ts.createVariableDeclaration(ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true))
- ], currentLexicalScope.kind === 284 /* SourceFile */ ? 0 /* None */ : 1 /* Let */));
+ ], currentLexicalScope.kind === 285 /* SourceFile */ ? 0 /* None */ : 1 /* Let */));
ts.setOriginalNode(statement, node);
recordEmittedDeclarationInScope(node);
if (isFirstEmittedDeclarationInScope(node)) {
// Adjust the source map emit to match the old emitter.
- if (node.kind === 243 /* EnumDeclaration */) {
+ if (node.kind === 244 /* EnumDeclaration */) {
ts.setSourceMapRange(statement.declarationList, node);
}
else {
@@ -69662,7 +70482,7 @@
var statementsLocation;
var blockLocation;
var body = node.body;
- if (body.kind === 245 /* ModuleBlock */) {
+ if (body.kind === 246 /* ModuleBlock */) {
saveStateAndInvoke(body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); });
statementsLocation = body.statements;
blockLocation = body;
@@ -69708,13 +70528,13 @@
// })(hi = hello.hi || (hello.hi = {}));
// })(hello || (hello = {}));
// We only want to emit comment on the namespace which contains block body itself, not the containing namespaces.
- if (body.kind !== 245 /* ModuleBlock */) {
+ if (body.kind !== 246 /* ModuleBlock */) {
ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536 /* NoComments */);
}
return block;
}
function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) {
- if (moduleDeclaration.body.kind === 244 /* ModuleDeclaration */) {
+ if (moduleDeclaration.body.kind === 245 /* ModuleDeclaration */) {
var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body);
return recursiveInnerModule || moduleDeclaration.body;
}
@@ -69755,7 +70575,7 @@
* @param node The named import bindings node.
*/
function visitNamedImportBindings(node) {
- if (node.kind === 251 /* NamespaceImport */) {
+ if (node.kind === 252 /* NamespaceImport */) {
// Elide a namespace import if it is not referenced.
return resolver.isReferencedAliasDeclaration(node) ? node : undefined;
}
@@ -69968,7 +70788,7 @@
function enableSubstitutionForNonQualifiedEnumMembers() {
if ((enabledSubstitutions & 8 /* NonQualifiedEnumMembers */) === 0) {
enabledSubstitutions |= 8 /* NonQualifiedEnumMembers */;
- context.enableSubstitution(72 /* Identifier */);
+ context.enableSubstitution(73 /* Identifier */);
}
}
function enableSubstitutionForClassAliases() {
@@ -69976,7 +70796,7 @@
enabledSubstitutions |= 1 /* ClassAliases */;
// We need to enable substitutions for identifiers. This allows us to
// substitute class names inside of a class declaration.
- context.enableSubstitution(72 /* Identifier */);
+ context.enableSubstitution(73 /* Identifier */);
// Keep track of class aliases.
classAliases = [];
}
@@ -69986,17 +70806,17 @@
enabledSubstitutions |= 2 /* NamespaceExports */;
// We need to enable substitutions for identifiers and shorthand property assignments. This allows us to
// substitute the names of exported members of a namespace.
- context.enableSubstitution(72 /* Identifier */);
- context.enableSubstitution(276 /* ShorthandPropertyAssignment */);
+ context.enableSubstitution(73 /* Identifier */);
+ context.enableSubstitution(277 /* ShorthandPropertyAssignment */);
// We need to be notified when entering and exiting namespaces.
- context.enableEmitNotification(244 /* ModuleDeclaration */);
+ context.enableEmitNotification(245 /* ModuleDeclaration */);
}
}
function isTransformedModuleDeclaration(node) {
- return ts.getOriginalNode(node).kind === 244 /* ModuleDeclaration */;
+ return ts.getOriginalNode(node).kind === 245 /* ModuleDeclaration */;
}
function isTransformedEnumDeclaration(node) {
- return ts.getOriginalNode(node).kind === 243 /* EnumDeclaration */;
+ return ts.getOriginalNode(node).kind === 244 /* EnumDeclaration */;
}
/**
* Hook for node emit.
@@ -70055,11 +70875,11 @@
}
function substituteExpression(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return substituteExpressionIdentifier(node);
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return substitutePropertyAccessExpression(node);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return substituteElementAccessExpression(node);
}
return node;
@@ -70097,9 +70917,9 @@
// If we are nested within a namespace declaration, we may need to qualifiy
// an identifier that is exported from a merged namespace.
var container = resolver.getReferencedExportContainer(node, /*prefixLocals*/ false);
- if (container && container.kind !== 284 /* SourceFile */) {
- var substitute = (applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 244 /* ModuleDeclaration */) ||
- (applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 243 /* EnumDeclaration */);
+ if (container && container.kind !== 285 /* SourceFile */) {
+ var substitute = (applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 245 /* ModuleDeclaration */) ||
+ (applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 244 /* EnumDeclaration */);
if (substitute) {
return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node),
/*location*/ node);
@@ -70239,26 +71059,26 @@
return node;
}
switch (node.kind) {
- case 121 /* AsyncKeyword */:
+ case 122 /* AsyncKeyword */:
// ES2017 async modifier should be elided for targets < ES2017
return undefined;
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
return visitAwaitExpression(node);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return visitMethodDeclaration(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return visitFunctionDeclaration(node);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return visitFunctionExpression(node);
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return visitArrowFunction(node);
- case 189 /* PropertyAccessExpression */:
- if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 98 /* SuperKeyword */) {
+ case 190 /* PropertyAccessExpression */:
+ if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 99 /* SuperKeyword */) {
capturedSuperProperties.set(node.name.escapedText, true);
}
return ts.visitEachChild(node, visitor, context);
- case 190 /* ElementAccessExpression */:
- if (capturedSuperProperties && node.expression.kind === 98 /* SuperKeyword */) {
+ case 191 /* ElementAccessExpression */:
+ if (capturedSuperProperties && node.expression.kind === 99 /* SuperKeyword */) {
hasSuperElementAccess = true;
}
return ts.visitEachChild(node, visitor, context);
@@ -70269,27 +71089,27 @@
function asyncBodyVisitor(node) {
if (ts.isNodeWithPossibleHoistedDeclaration(node)) {
switch (node.kind) {
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return visitVariableStatementInAsyncBody(node);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return visitForStatementInAsyncBody(node);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return visitForInStatementInAsyncBody(node);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return visitForOfStatementInAsyncBody(node);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return visitCatchClauseInAsyncBody(node);
- case 218 /* Block */:
- case 232 /* SwitchStatement */:
- case 246 /* CaseBlock */:
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
- case 235 /* TryStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
- case 222 /* IfStatement */:
- case 231 /* WithStatement */:
- case 233 /* LabeledStatement */:
+ case 219 /* Block */:
+ case 233 /* SwitchStatement */:
+ case 247 /* CaseBlock */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
+ case 236 /* TryStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
+ case 223 /* IfStatement */:
+ case 232 /* WithStatement */:
+ case 234 /* LabeledStatement */:
return ts.visitEachChild(node, asyncBodyVisitor, context);
default:
return ts.Debug.assertNever(node, "Unhandled node.");
@@ -70490,7 +71310,7 @@
var original = ts.getOriginalNode(node, ts.isFunctionLike);
var nodeType = original.type;
var promiseConstructor = languageVersion < 2 /* ES2015 */ ? getPromiseConstructor(nodeType) : undefined;
- var isArrowFunction = node.kind === 197 /* ArrowFunction */;
+ var isArrowFunction = node.kind === 198 /* ArrowFunction */;
var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192 /* CaptureArguments */) !== 0;
// An async function is emit as an outer function that calls an inner
// generator function. To preserve lexical bindings, we pass the current
@@ -70581,17 +71401,17 @@
enabledSubstitutions |= 1 /* AsyncMethodsWithSuper */;
// We need to enable substitutions for call, property access, and element access
// if we need to rewrite super calls.
- context.enableSubstitution(191 /* CallExpression */);
- context.enableSubstitution(189 /* PropertyAccessExpression */);
- context.enableSubstitution(190 /* ElementAccessExpression */);
+ context.enableSubstitution(192 /* CallExpression */);
+ context.enableSubstitution(190 /* PropertyAccessExpression */);
+ context.enableSubstitution(191 /* ElementAccessExpression */);
// We need to be notified when entering and exiting declarations that bind super.
- context.enableEmitNotification(240 /* ClassDeclaration */);
- context.enableEmitNotification(156 /* MethodDeclaration */);
- context.enableEmitNotification(158 /* GetAccessor */);
- context.enableEmitNotification(159 /* SetAccessor */);
- context.enableEmitNotification(157 /* Constructor */);
+ context.enableEmitNotification(241 /* ClassDeclaration */);
+ context.enableEmitNotification(157 /* MethodDeclaration */);
+ context.enableEmitNotification(159 /* GetAccessor */);
+ context.enableEmitNotification(160 /* SetAccessor */);
+ context.enableEmitNotification(158 /* Constructor */);
// We need to be notified when entering the generated accessor arrow functions.
- context.enableEmitNotification(219 /* VariableStatement */);
+ context.enableEmitNotification(220 /* VariableStatement */);
}
}
/**
@@ -70639,23 +71459,23 @@
}
function substituteExpression(node) {
switch (node.kind) {
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return substitutePropertyAccessExpression(node);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return substituteElementAccessExpression(node);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return substituteCallExpression(node);
}
return node;
}
function substitutePropertyAccessExpression(node) {
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
return ts.setTextRange(ts.createPropertyAccess(ts.createFileLevelUniqueName("_super"), node.name), node);
}
return node;
}
function substituteElementAccessExpression(node) {
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
return createSuperElementAccessInAsyncMethod(node.argumentExpression, node);
}
return node;
@@ -70675,11 +71495,11 @@
}
function isSuperContainer(node) {
var kind = node.kind;
- return kind === 240 /* ClassDeclaration */
- || kind === 157 /* Constructor */
- || kind === 156 /* MethodDeclaration */
- || kind === 158 /* GetAccessor */
- || kind === 159 /* SetAccessor */;
+ return kind === 241 /* ClassDeclaration */
+ || kind === 158 /* Constructor */
+ || kind === 157 /* MethodDeclaration */
+ || kind === 159 /* GetAccessor */
+ || kind === 160 /* SetAccessor */;
}
function createSuperElementAccessInAsyncMethod(argumentExpression, location) {
if (enclosingSuperContainerFlags & 4096 /* AsyncMethodWithSuperBinding */) {
@@ -70814,7 +71634,7 @@
return visitorWorker(node, /*noDestructuringValue*/ true);
}
function visitorNoAsyncModifier(node) {
- if (node.kind === 121 /* AsyncKeyword */) {
+ if (node.kind === 122 /* AsyncKeyword */) {
return undefined;
}
return node;
@@ -70824,53 +71644,55 @@
return node;
}
switch (node.kind) {
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
return visitAwaitExpression(node);
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return visitYieldExpression(node);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return visitReturnStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return visitLabeledStatement(node);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return visitObjectLiteralExpression(node);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return visitBinaryExpression(node, noDestructuringValue);
- case 237 /* VariableDeclaration */:
+ case 275 /* CatchClause */:
+ return visitCatchClause(node);
+ case 238 /* VariableDeclaration */:
return visitVariableDeclaration(node);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return visitForStatement(node);
- case 200 /* VoidExpression */:
+ case 201 /* VoidExpression */:
return visitVoidExpression(node);
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return visitConstructorDeclaration(node);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return visitMethodDeclaration(node);
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
return visitGetAccessorDeclaration(node);
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
return visitSetAccessorDeclaration(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return visitFunctionDeclaration(node);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return visitFunctionExpression(node);
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return visitArrowFunction(node);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return visitParameter(node);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return visitExpressionStatement(node);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return visitParenthesizedExpression(node, noDestructuringValue);
- case 189 /* PropertyAccessExpression */:
- if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 98 /* SuperKeyword */) {
+ case 190 /* PropertyAccessExpression */:
+ if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 99 /* SuperKeyword */) {
capturedSuperProperties.set(node.name.escapedText, true);
}
return ts.visitEachChild(node, visitor, context);
- case 190 /* ElementAccessExpression */:
- if (capturedSuperProperties && node.expression.kind === 98 /* SuperKeyword */) {
+ case 191 /* ElementAccessExpression */:
+ if (capturedSuperProperties && node.expression.kind === 99 /* SuperKeyword */) {
hasSuperElementAccess = true;
}
return ts.visitEachChild(node, visitor, context);
@@ -70906,7 +71728,7 @@
function visitLabeledStatement(node) {
if (enclosingFunctionFlags & 2 /* Async */) {
var statement = ts.unwrapInnermostStatementOfLabel(node);
- if (statement.kind === 227 /* ForOfStatement */ && statement.awaitModifier) {
+ if (statement.kind === 228 /* ForOfStatement */ && statement.awaitModifier) {
return visitForOfStatement(statement, node);
}
return ts.restoreEnclosingLabel(ts.visitEachChild(statement, visitor, context), node);
@@ -70918,7 +71740,7 @@
var objects = [];
for (var _i = 0, elements_4 = elements; _i < elements_4.length; _i++) {
var e = elements_4[_i];
- if (e.kind === 277 /* SpreadAssignment */) {
+ if (e.kind === 278 /* SpreadAssignment */) {
if (chunkObject) {
objects.push(ts.createObjectLiteral(chunkObject));
chunkObject = undefined;
@@ -70927,7 +71749,7 @@
objects.push(ts.visitNode(target, visitor, ts.isExpression));
}
else {
- chunkObject = ts.append(chunkObject, e.kind === 275 /* PropertyAssignment */
+ chunkObject = ts.append(chunkObject, e.kind === 276 /* PropertyAssignment */
? ts.createPropertyAssignment(e.name, ts.visitNode(e.initializer, visitor, ts.isExpression))
: ts.visitNode(e, visitor, ts.isObjectLiteralElementLike));
}
@@ -70945,7 +71767,7 @@
// If the first element is a spread element, then the first argument to __assign is {}:
// { ...o, a, b, ...o2 } => __assign({}, o, {a, b}, o2)
var objects = chunkObjectLiteralElements(node.properties);
- if (objects.length && objects[0].kind !== 188 /* ObjectLiteralExpression */) {
+ if (objects.length && objects[0].kind !== 189 /* ObjectLiteralExpression */) {
objects.unshift(ts.createObjectLiteral());
}
return createAssignHelper(context, objects);
@@ -70972,6 +71794,23 @@
}
return ts.visitEachChild(node, visitor, context);
}
+ function visitCatchClause(node) {
+ if (node.variableDeclaration &&
+ ts.isBindingPattern(node.variableDeclaration.name) &&
+ node.variableDeclaration.name.transformFlags & 8192 /* ContainsObjectRestOrSpread */) {
+ var name = ts.getGeneratedNameForNode(node.variableDeclaration.name);
+ var updatedDecl = ts.updateVariableDeclaration(node.variableDeclaration, node.variableDeclaration.name, /*type*/ undefined, name);
+ var visitedBindings = ts.flattenDestructuringBinding(updatedDecl, visitor, context, 1 /* ObjectRest */);
+ var block = ts.visitNode(node.block, visitor, ts.isBlock);
+ if (ts.some(visitedBindings)) {
+ block = ts.updateBlock(block, [
+ ts.createVariableStatement(/*modifiers*/ undefined, visitedBindings)
+ ].concat(block.statements));
+ }
+ return ts.updateCatchClause(node, ts.updateVariableDeclaration(node.variableDeclaration, name, /*type*/ undefined, /*initializer*/ undefined), block);
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
/**
* Visits a VariableDeclaration node with a binding pattern.
*
@@ -71264,17 +72103,17 @@
enabledSubstitutions |= 1 /* AsyncMethodsWithSuper */;
// We need to enable substitutions for call, property access, and element access
// if we need to rewrite super calls.
- context.enableSubstitution(191 /* CallExpression */);
- context.enableSubstitution(189 /* PropertyAccessExpression */);
- context.enableSubstitution(190 /* ElementAccessExpression */);
+ context.enableSubstitution(192 /* CallExpression */);
+ context.enableSubstitution(190 /* PropertyAccessExpression */);
+ context.enableSubstitution(191 /* ElementAccessExpression */);
// We need to be notified when entering and exiting declarations that bind super.
- context.enableEmitNotification(240 /* ClassDeclaration */);
- context.enableEmitNotification(156 /* MethodDeclaration */);
- context.enableEmitNotification(158 /* GetAccessor */);
- context.enableEmitNotification(159 /* SetAccessor */);
- context.enableEmitNotification(157 /* Constructor */);
+ context.enableEmitNotification(241 /* ClassDeclaration */);
+ context.enableEmitNotification(157 /* MethodDeclaration */);
+ context.enableEmitNotification(159 /* GetAccessor */);
+ context.enableEmitNotification(160 /* SetAccessor */);
+ context.enableEmitNotification(158 /* Constructor */);
// We need to be notified when entering the generated accessor arrow functions.
- context.enableEmitNotification(219 /* VariableStatement */);
+ context.enableEmitNotification(220 /* VariableStatement */);
}
}
/**
@@ -71322,23 +72161,23 @@
}
function substituteExpression(node) {
switch (node.kind) {
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return substitutePropertyAccessExpression(node);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return substituteElementAccessExpression(node);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return substituteCallExpression(node);
}
return node;
}
function substitutePropertyAccessExpression(node) {
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
return ts.setTextRange(ts.createPropertyAccess(ts.createFileLevelUniqueName("_super"), node.name), node);
}
return node;
}
function substituteElementAccessExpression(node) {
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
return createSuperElementAccessInAsyncMethod(node.argumentExpression, node);
}
return node;
@@ -71358,11 +72197,11 @@
}
function isSuperContainer(node) {
var kind = node.kind;
- return kind === 240 /* ClassDeclaration */
- || kind === 157 /* Constructor */
- || kind === 156 /* MethodDeclaration */
- || kind === 158 /* GetAccessor */
- || kind === 159 /* SetAccessor */;
+ return kind === 241 /* ClassDeclaration */
+ || kind === 158 /* Constructor */
+ || kind === 157 /* MethodDeclaration */
+ || kind === 159 /* GetAccessor */
+ || kind === 160 /* SetAccessor */;
}
function createSuperElementAccessInAsyncMethod(argumentExpression, location) {
if (enclosingSuperContainerFlags & 4096 /* AsyncMethodWithSuperBinding */) {
@@ -71456,7 +72295,7 @@
return node;
}
switch (node.kind) {
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return visitCatchClause(node);
default:
return ts.visitEachChild(node, visitor, context);
@@ -71525,13 +72364,13 @@
}
function visitorWorker(node) {
switch (node.kind) {
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
return visitJsxElement(node, /*isChild*/ false);
- case 261 /* JsxSelfClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
return visitJsxSelfClosingElement(node, /*isChild*/ false);
- case 264 /* JsxFragment */:
+ case 265 /* JsxFragment */:
return visitJsxFragment(node, /*isChild*/ false);
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return visitJsxExpression(node);
default:
return ts.visitEachChild(node, visitor, context);
@@ -71541,13 +72380,13 @@
switch (node.kind) {
case 11 /* JsxText */:
return visitJsxText(node);
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return visitJsxExpression(node);
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
return visitJsxElement(node, /*isChild*/ true);
- case 261 /* JsxSelfClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
return visitJsxSelfClosingElement(node, /*isChild*/ true);
- case 264 /* JsxFragment */:
+ case 265 /* JsxFragment */:
return visitJsxFragment(node, /*isChild*/ true);
default:
return ts.Debug.failBadSyntaxKind(node);
@@ -71622,7 +72461,7 @@
literal.singleQuote = node.singleQuote !== undefined ? node.singleQuote : !ts.isStringDoubleQuoted(node, currentSourceFile);
return ts.setTextRange(literal, node);
}
- else if (node.kind === 270 /* JsxExpression */) {
+ else if (node.kind === 271 /* JsxExpression */) {
if (node.expression === undefined) {
return ts.createTrue();
}
@@ -71716,7 +72555,7 @@
return decoded === text ? undefined : decoded;
}
function getTagName(node) {
- if (node.kind === 260 /* JsxElement */) {
+ if (node.kind === 261 /* JsxElement */) {
return getTagName(node.openingElement);
}
else {
@@ -72022,7 +72861,7 @@
return node;
}
switch (node.kind) {
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return visitBinaryExpression(node);
default:
return ts.visitEachChild(node, visitor, context);
@@ -72030,7 +72869,7 @@
}
function visitBinaryExpression(node) {
switch (node.operatorToken.kind) {
- case 63 /* AsteriskAsteriskEqualsToken */:
+ case 64 /* AsteriskAsteriskEqualsToken */:
return visitExponentiationAssignmentExpression(node);
case 41 /* AsteriskAsteriskToken */:
return visitExponentiationExpression(node);
@@ -72115,62 +72954,63 @@
HierarchyFacts[HierarchyFacts["Block"] = 128] = "Block";
HierarchyFacts[HierarchyFacts["IterationStatement"] = 256] = "IterationStatement";
HierarchyFacts[HierarchyFacts["IterationStatementBlock"] = 512] = "IterationStatementBlock";
- HierarchyFacts[HierarchyFacts["ForStatement"] = 1024] = "ForStatement";
- HierarchyFacts[HierarchyFacts["ForInOrForOfStatement"] = 2048] = "ForInOrForOfStatement";
- HierarchyFacts[HierarchyFacts["ConstructorWithCapturedSuper"] = 4096] = "ConstructorWithCapturedSuper";
+ HierarchyFacts[HierarchyFacts["IterationContainer"] = 1024] = "IterationContainer";
+ HierarchyFacts[HierarchyFacts["ForStatement"] = 2048] = "ForStatement";
+ HierarchyFacts[HierarchyFacts["ForInOrForOfStatement"] = 4096] = "ForInOrForOfStatement";
+ HierarchyFacts[HierarchyFacts["ConstructorWithCapturedSuper"] = 8192] = "ConstructorWithCapturedSuper";
// NOTE: do not add more ancestor flags without also updating AncestorFactsMask below.
// NOTE: when adding a new ancestor flag, be sure to update the subtree flags below.
//
// Ancestor masks
//
- HierarchyFacts[HierarchyFacts["AncestorFactsMask"] = 8191] = "AncestorFactsMask";
+ HierarchyFacts[HierarchyFacts["AncestorFactsMask"] = 16383] = "AncestorFactsMask";
// We are always in *some* kind of block scope, but only specific block-scope containers are
// top-level or Blocks.
HierarchyFacts[HierarchyFacts["BlockScopeIncludes"] = 0] = "BlockScopeIncludes";
- HierarchyFacts[HierarchyFacts["BlockScopeExcludes"] = 4032] = "BlockScopeExcludes";
+ HierarchyFacts[HierarchyFacts["BlockScopeExcludes"] = 7104] = "BlockScopeExcludes";
// A source file is a top-level block scope.
HierarchyFacts[HierarchyFacts["SourceFileIncludes"] = 64] = "SourceFileIncludes";
- HierarchyFacts[HierarchyFacts["SourceFileExcludes"] = 3968] = "SourceFileExcludes";
+ HierarchyFacts[HierarchyFacts["SourceFileExcludes"] = 8064] = "SourceFileExcludes";
// Functions, methods, and accessors are both new lexical scopes and new block scopes.
HierarchyFacts[HierarchyFacts["FunctionIncludes"] = 65] = "FunctionIncludes";
- HierarchyFacts[HierarchyFacts["FunctionExcludes"] = 8094] = "FunctionExcludes";
+ HierarchyFacts[HierarchyFacts["FunctionExcludes"] = 16286] = "FunctionExcludes";
HierarchyFacts[HierarchyFacts["AsyncFunctionBodyIncludes"] = 69] = "AsyncFunctionBodyIncludes";
- HierarchyFacts[HierarchyFacts["AsyncFunctionBodyExcludes"] = 8086] = "AsyncFunctionBodyExcludes";
+ HierarchyFacts[HierarchyFacts["AsyncFunctionBodyExcludes"] = 16278] = "AsyncFunctionBodyExcludes";
// Arrow functions are lexically scoped to their container, but are new block scopes.
HierarchyFacts[HierarchyFacts["ArrowFunctionIncludes"] = 66] = "ArrowFunctionIncludes";
- HierarchyFacts[HierarchyFacts["ArrowFunctionExcludes"] = 8064] = "ArrowFunctionExcludes";
+ HierarchyFacts[HierarchyFacts["ArrowFunctionExcludes"] = 15232] = "ArrowFunctionExcludes";
// Constructors are both new lexical scopes and new block scopes. Constructors are also
// always considered non-static members of a class.
HierarchyFacts[HierarchyFacts["ConstructorIncludes"] = 73] = "ConstructorIncludes";
- HierarchyFacts[HierarchyFacts["ConstructorExcludes"] = 8086] = "ConstructorExcludes";
+ HierarchyFacts[HierarchyFacts["ConstructorExcludes"] = 16278] = "ConstructorExcludes";
// 'do' and 'while' statements are not block scopes. We track that the subtree is contained
// within an IterationStatement to indicate whether the embedded statement is an
// IterationStatementBlock.
- HierarchyFacts[HierarchyFacts["DoOrWhileStatementIncludes"] = 256] = "DoOrWhileStatementIncludes";
+ HierarchyFacts[HierarchyFacts["DoOrWhileStatementIncludes"] = 1280] = "DoOrWhileStatementIncludes";
HierarchyFacts[HierarchyFacts["DoOrWhileStatementExcludes"] = 0] = "DoOrWhileStatementExcludes";
// 'for' statements are new block scopes and have special handling for 'let' declarations.
- HierarchyFacts[HierarchyFacts["ForStatementIncludes"] = 1280] = "ForStatementIncludes";
- HierarchyFacts[HierarchyFacts["ForStatementExcludes"] = 3008] = "ForStatementExcludes";
+ HierarchyFacts[HierarchyFacts["ForStatementIncludes"] = 3328] = "ForStatementIncludes";
+ HierarchyFacts[HierarchyFacts["ForStatementExcludes"] = 5056] = "ForStatementExcludes";
// 'for-in' and 'for-of' statements are new block scopes and have special handling for
// 'let' declarations.
- HierarchyFacts[HierarchyFacts["ForInOrForOfStatementIncludes"] = 2304] = "ForInOrForOfStatementIncludes";
- HierarchyFacts[HierarchyFacts["ForInOrForOfStatementExcludes"] = 1984] = "ForInOrForOfStatementExcludes";
+ HierarchyFacts[HierarchyFacts["ForInOrForOfStatementIncludes"] = 5376] = "ForInOrForOfStatementIncludes";
+ HierarchyFacts[HierarchyFacts["ForInOrForOfStatementExcludes"] = 3008] = "ForInOrForOfStatementExcludes";
// Blocks (other than function bodies) are new block scopes.
HierarchyFacts[HierarchyFacts["BlockIncludes"] = 128] = "BlockIncludes";
- HierarchyFacts[HierarchyFacts["BlockExcludes"] = 3904] = "BlockExcludes";
+ HierarchyFacts[HierarchyFacts["BlockExcludes"] = 6976] = "BlockExcludes";
HierarchyFacts[HierarchyFacts["IterationStatementBlockIncludes"] = 512] = "IterationStatementBlockIncludes";
- HierarchyFacts[HierarchyFacts["IterationStatementBlockExcludes"] = 4032] = "IterationStatementBlockExcludes";
+ HierarchyFacts[HierarchyFacts["IterationStatementBlockExcludes"] = 7104] = "IterationStatementBlockExcludes";
//
// Subtree facts
//
- HierarchyFacts[HierarchyFacts["NewTarget"] = 8192] = "NewTarget";
- HierarchyFacts[HierarchyFacts["CapturedLexicalThis"] = 16384] = "CapturedLexicalThis";
+ HierarchyFacts[HierarchyFacts["NewTarget"] = 16384] = "NewTarget";
+ HierarchyFacts[HierarchyFacts["CapturedLexicalThis"] = 32768] = "CapturedLexicalThis";
//
// Subtree masks
//
- HierarchyFacts[HierarchyFacts["SubtreeFactsMask"] = -8192] = "SubtreeFactsMask";
+ HierarchyFacts[HierarchyFacts["SubtreeFactsMask"] = -16384] = "SubtreeFactsMask";
HierarchyFacts[HierarchyFacts["ArrowFunctionSubtreeExcludes"] = 0] = "ArrowFunctionSubtreeExcludes";
- HierarchyFacts[HierarchyFacts["FunctionSubtreeExcludes"] = 24576] = "FunctionSubtreeExcludes";
+ HierarchyFacts[HierarchyFacts["FunctionSubtreeExcludes"] = 49152] = "FunctionSubtreeExcludes";
})(HierarchyFacts || (HierarchyFacts = {}));
function transformES2015(context) {
var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
@@ -72219,7 +73059,7 @@
*/
function enterSubtree(excludeFacts, includeFacts) {
var ancestorFacts = hierarchyFacts;
- hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & 8191 /* AncestorFactsMask */;
+ hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & 16383 /* AncestorFactsMask */;
return ancestorFacts;
}
/**
@@ -72230,17 +73070,17 @@
* @param includeFacts The new `HierarchyFacts` of the subtree that should be propagated.
*/
function exitSubtree(ancestorFacts, excludeFacts, includeFacts) {
- hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & -8192 /* SubtreeFactsMask */ | ancestorFacts;
+ hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & -16384 /* SubtreeFactsMask */ | ancestorFacts;
}
function isReturnVoidStatementInConstructorWithCapturedSuper(node) {
- return (hierarchyFacts & 4096 /* ConstructorWithCapturedSuper */) !== 0
- && node.kind === 230 /* ReturnStatement */
+ return (hierarchyFacts & 8192 /* ConstructorWithCapturedSuper */) !== 0
+ && node.kind === 231 /* ReturnStatement */
&& !node.expression;
}
function shouldVisitNode(node) {
return (node.transformFlags & 128 /* ContainsES2015 */) !== 0
|| convertedLoopState !== undefined
- || (hierarchyFacts & 4096 /* ConstructorWithCapturedSuper */ && (ts.isStatement(node) || (node.kind === 218 /* Block */)))
+ || (hierarchyFacts & 8192 /* ConstructorWithCapturedSuper */ && (ts.isStatement(node) || (node.kind === 219 /* Block */)))
|| (ts.isIterationStatement(node, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatement(node))
|| (ts.getEmitFlags(node) & 33554432 /* TypeScriptClassWrapper */) !== 0;
}
@@ -72253,72 +73093,72 @@
}
}
function callExpressionVisitor(node) {
- if (node.kind === 98 /* SuperKeyword */) {
+ if (node.kind === 99 /* SuperKeyword */) {
return visitSuperKeyword(/*isExpressionOfCall*/ true);
}
return visitor(node);
}
function visitJavaScript(node) {
switch (node.kind) {
- case 116 /* StaticKeyword */:
+ case 117 /* StaticKeyword */:
return undefined; // elide static keyword
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return visitClassDeclaration(node);
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
return visitClassExpression(node);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return visitParameter(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return visitFunctionDeclaration(node);
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return visitArrowFunction(node);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return visitFunctionExpression(node);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return visitVariableDeclaration(node);
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return visitIdentifier(node);
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
return visitVariableDeclarationList(node);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return visitSwitchStatement(node);
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
return visitCaseBlock(node);
- case 218 /* Block */:
+ case 219 /* Block */:
return visitBlock(node, /*isFunctionBody*/ false);
- case 229 /* BreakStatement */:
- case 228 /* ContinueStatement */:
+ case 230 /* BreakStatement */:
+ case 229 /* ContinueStatement */:
return visitBreakOrContinueStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return visitLabeledStatement(node);
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
return visitDoOrWhileStatement(node, /*outermostLabeledStatement*/ undefined);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return visitForStatement(node, /*outermostLabeledStatement*/ undefined);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return visitForInStatement(node, /*outermostLabeledStatement*/ undefined);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return visitExpressionStatement(node);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return visitObjectLiteralExpression(node);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return visitCatchClause(node);
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return visitShorthandPropertyAssignment(node);
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
return visitComputedPropertyName(node);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return visitArrayLiteralExpression(node);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return visitCallExpression(node);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return visitNewExpression(node);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return visitParenthesizedExpression(node, /*needsDestructuringValue*/ true);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return visitBinaryExpression(node, /*needsDestructuringValue*/ true);
case 14 /* NoSubstitutionTemplateLiteral */:
case 15 /* TemplateHead */:
@@ -72329,35 +73169,35 @@
return visitStringLiteral(node);
case 8 /* NumericLiteral */:
return visitNumericLiteral(node);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return visitTaggedTemplateExpression(node);
- case 206 /* TemplateExpression */:
+ case 207 /* TemplateExpression */:
return visitTemplateExpression(node);
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return visitYieldExpression(node);
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
return visitSpreadElement(node);
- case 98 /* SuperKeyword */:
+ case 99 /* SuperKeyword */:
return visitSuperKeyword(/*isExpressionOfCall*/ false);
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
return visitThisKeyword(node);
- case 214 /* MetaProperty */:
+ case 215 /* MetaProperty */:
return visitMetaProperty(node);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return visitMethodDeclaration(node);
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return visitAccessorDeclaration(node);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return visitVariableStatement(node);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return visitReturnStatement(node);
default:
return ts.visitEachChild(node, visitor, context);
}
}
function visitSourceFile(node) {
- var ancestorFacts = enterSubtree(3968 /* SourceFileExcludes */, 64 /* SourceFileIncludes */);
+ var ancestorFacts = enterSubtree(8064 /* SourceFileExcludes */, 64 /* SourceFileIncludes */);
var prologue = [];
var statements = [];
startLexicalEnvironment();
@@ -72384,7 +73224,7 @@
return ts.visitEachChild(node, visitor, context);
}
function visitCaseBlock(node) {
- var ancestorFacts = enterSubtree(4032 /* BlockScopeExcludes */, 0 /* BlockScopeIncludes */);
+ var ancestorFacts = enterSubtree(7104 /* BlockScopeExcludes */, 0 /* BlockScopeIncludes */);
var updated = ts.visitEachChild(node, visitor, context);
exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */);
return updated;
@@ -72411,7 +73251,7 @@
}
function visitThisKeyword(node) {
if (hierarchyFacts & 2 /* ArrowFunction */) {
- hierarchyFacts |= 16384 /* CapturedLexicalThis */;
+ hierarchyFacts |= 32768 /* CapturedLexicalThis */;
}
if (convertedLoopState) {
if (hierarchyFacts & 2 /* ArrowFunction */) {
@@ -72441,14 +73281,14 @@
// it is possible if either
// - break/continue is labeled and label is located inside the converted loop
// - break/continue is non-labeled and located in non-converted loop/switch statement
- var jump = node.kind === 229 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */;
+ var jump = node.kind === 230 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */;
var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels.get(ts.idText(node.label))) ||
(!node.label && (convertedLoopState.allowedNonLabeledJumps & jump));
if (!canUseBreakOrContinue) {
var labelMarker = void 0;
var label = node.label;
if (!label) {
- if (node.kind === 229 /* BreakStatement */) {
+ if (node.kind === 230 /* BreakStatement */) {
convertedLoopState.nonLocalJumps |= 2 /* Break */;
labelMarker = "break";
}
@@ -72459,7 +73299,7 @@
}
}
else {
- if (node.kind === 229 /* BreakStatement */) {
+ if (node.kind === 230 /* BreakStatement */) {
labelMarker = "break-" + label.escapedText;
setLabeledJump(convertedLoopState, /*isBreak*/ true, ts.idText(label), labelMarker);
}
@@ -72654,7 +73494,7 @@
function addConstructor(statements, node, extendsClauseElement) {
var savedConvertedLoopState = convertedLoopState;
convertedLoopState = undefined;
- var ancestorFacts = enterSubtree(8086 /* ConstructorExcludes */, 73 /* ConstructorIncludes */);
+ var ancestorFacts = enterSubtree(16278 /* ConstructorExcludes */, 73 /* ConstructorIncludes */);
var constructor = ts.getFirstConstructorWithBody(node);
var hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== undefined);
var constructorFunction = ts.createFunctionDeclaration(
@@ -72668,7 +73508,7 @@
ts.setEmitFlags(constructorFunction, 8 /* CapturesThis */);
}
statements.push(constructorFunction);
- exitSubtree(ancestorFacts, 24576 /* FunctionSubtreeExcludes */, 0 /* None */);
+ exitSubtree(ancestorFacts, 49152 /* FunctionSubtreeExcludes */, 0 /* None */);
convertedLoopState = savedConvertedLoopState;
}
/**
@@ -72717,7 +73557,7 @@
function transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper) {
// determine whether the class is known syntactically to be a derived class (e.g. a
// class that extends a value that is not syntactically known to be `null`).
- var isDerivedClass = !!extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 96 /* NullKeyword */;
+ var isDerivedClass = !!extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 97 /* NullKeyword */;
// When the subclass does not have a constructor, we synthesize a *default* constructor using the following
// representation:
//
@@ -72761,7 +73601,7 @@
}
}
if (superCallExpression) {
- hierarchyFacts |= 4096 /* ConstructorWithCapturedSuper */;
+ hierarchyFacts |= 8192 /* ConstructorWithCapturedSuper */;
statementOffset++; // skip this statement, we will add it after visiting the rest of the body.
}
// visit the remaining statements
@@ -72855,11 +73695,11 @@
*/
function isSufficientlyCoveredByReturnStatements(statement) {
// A return statement is considered covered.
- if (statement.kind === 230 /* ReturnStatement */) {
+ if (statement.kind === 231 /* ReturnStatement */) {
return true;
}
// An if-statement with two covered branches is covered.
- else if (statement.kind === 222 /* IfStatement */) {
+ else if (statement.kind === 223 /* IfStatement */) {
var ifStatement = statement;
if (ifStatement.elseStatement) {
return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) &&
@@ -72867,7 +73707,7 @@
}
}
// A block is covered if it has a last statement which is covered.
- else if (statement.kind === 218 /* Block */) {
+ else if (statement.kind === 219 /* Block */) {
var lastStatement = ts.lastOrUndefined(statement.statements);
if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) {
return true;
@@ -73022,10 +73862,10 @@
return false;
}
// `declarationName` is the name of the local declaration for the parameter.
- var declarationName = parameter.name.kind === 72 /* Identifier */ ? ts.getMutableClone(parameter.name) : ts.createTempVariable(/*recordTempVariable*/ undefined);
+ var declarationName = parameter.name.kind === 73 /* Identifier */ ? ts.getMutableClone(parameter.name) : ts.createTempVariable(/*recordTempVariable*/ undefined);
ts.setEmitFlags(declarationName, 48 /* NoSourceMap */);
// `expressionName` is the name of the parameter used in expressions.
- var expressionName = parameter.name.kind === 72 /* Identifier */ ? ts.getSynthesizedClone(parameter.name) : declarationName;
+ var expressionName = parameter.name.kind === 73 /* Identifier */ ? ts.getSynthesizedClone(parameter.name) : declarationName;
var restIndex = node.parameters.length - 1;
var temp = ts.createLoopVariable();
// var param = [];
@@ -73049,7 +73889,7 @@
ts.setEmitFlags(forStatement, 1048576 /* CustomPrologue */);
ts.startOnNewLine(forStatement);
prologueStatements.push(forStatement);
- if (parameter.name.kind !== 72 /* Identifier */) {
+ if (parameter.name.kind !== 73 /* Identifier */) {
// do the actual destructuring of the rest parameter if necessary
prologueStatements.push(ts.setEmitFlags(ts.setTextRange(ts.createVariableStatement(
/*modifiers*/ undefined, ts.createVariableDeclarationList(ts.flattenDestructuringBinding(parameter, visitor, context, 0 /* All */, expressionName))), parameter), 1048576 /* CustomPrologue */));
@@ -73065,7 +73905,7 @@
* @param node A node.
*/
function insertCaptureThisForNodeIfNeeded(statements, node) {
- if (hierarchyFacts & 16384 /* CapturedLexicalThis */ && node.kind !== 197 /* ArrowFunction */) {
+ if (hierarchyFacts & 32768 /* CapturedLexicalThis */ && node.kind !== 198 /* ArrowFunction */) {
insertCaptureThisForNode(statements, node, ts.createThis());
return true;
}
@@ -73083,28 +73923,28 @@
ts.insertStatementAfterCustomPrologue(statements, captureThisStatement);
}
function insertCaptureNewTargetIfNeeded(statements, node, copyOnWrite) {
- if (hierarchyFacts & 8192 /* NewTarget */) {
+ if (hierarchyFacts & 16384 /* NewTarget */) {
var newTarget = void 0;
switch (node.kind) {
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return statements;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
// Methods and accessors cannot be constructors, so 'new.target' will
// always return 'undefined'.
newTarget = ts.createVoidZero();
break;
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
// Class constructors can only be called with `new`, so `this.constructor`
// should be relatively safe to use.
newTarget = ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), "constructor");
break;
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
// Functions can be called or constructed, and may have a `this` due to
// being a member or when calling an imported function via `other_1.f()`.
- newTarget = ts.createConditional(ts.createLogicalAnd(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), ts.createBinary(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), 94 /* InstanceOfKeyword */, ts.getLocalName(node))), ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), "constructor"), ts.createVoidZero());
+ newTarget = ts.createConditional(ts.createLogicalAnd(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), ts.createBinary(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), 95 /* InstanceOfKeyword */, ts.getLocalName(node))), ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), "constructor"), ts.createVoidZero());
break;
default:
return ts.Debug.failBadSyntaxKind(node);
@@ -73133,20 +73973,20 @@
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
switch (member.kind) {
- case 217 /* SemicolonClassElement */:
+ case 218 /* SemicolonClassElement */:
statements.push(transformSemicolonClassElementToStatement(member));
break;
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node));
break;
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
var accessors = ts.getAllAccessorDeclarations(node.members, member);
if (member === accessors.firstAccessor) {
statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node));
}
break;
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
// Constructors are handled in visitClassExpression/visitClassDeclaration
break;
default:
@@ -73213,7 +74053,7 @@
// arguments are both mapped contiguously to the accessor name.
var target = ts.getMutableClone(receiver);
ts.setEmitFlags(target, 1536 /* NoComments */ | 32 /* NoTrailingSourceMap */);
- ts.setSourceMapRange(target, firstAccessor.name); // TODO: GH#18217
+ ts.setSourceMapRange(target, firstAccessor.name);
var propertyName = ts.createExpressionForPropertyName(ts.visitNode(firstAccessor.name, visitor, ts.isPropertyName));
ts.setEmitFlags(propertyName, 1536 /* NoComments */ | 16 /* NoLeadingSourceMap */);
ts.setSourceMapRange(propertyName, firstAccessor.name);
@@ -73253,11 +74093,11 @@
*/
function visitArrowFunction(node) {
if (node.transformFlags & 2048 /* ContainsLexicalThis */) {
- hierarchyFacts |= 16384 /* CapturedLexicalThis */;
+ hierarchyFacts |= 32768 /* CapturedLexicalThis */;
}
var savedConvertedLoopState = convertedLoopState;
convertedLoopState = undefined;
- var ancestorFacts = enterSubtree(8064 /* ArrowFunctionExcludes */, 66 /* ArrowFunctionIncludes */);
+ var ancestorFacts = enterSubtree(15232 /* ArrowFunctionExcludes */, 66 /* ArrowFunctionIncludes */);
var func = ts.createFunctionExpression(
/*modifiers*/ undefined,
/*asteriskToken*/ undefined,
@@ -73267,7 +74107,7 @@
ts.setTextRange(func, node);
ts.setOriginalNode(func, node);
ts.setEmitFlags(func, 8 /* CapturesThis */);
- if (hierarchyFacts & 16384 /* CapturedLexicalThis */) {
+ if (hierarchyFacts & 32768 /* CapturedLexicalThis */) {
enableSubstitutionsForCapturedThis();
}
// If an arrow function contains
@@ -73282,16 +74122,16 @@
*/
function visitFunctionExpression(node) {
var ancestorFacts = ts.getEmitFlags(node) & 262144 /* AsyncFunctionBody */
- ? enterSubtree(8086 /* AsyncFunctionBodyExcludes */, 69 /* AsyncFunctionBodyIncludes */)
- : enterSubtree(8094 /* FunctionExcludes */, 65 /* FunctionIncludes */);
+ ? enterSubtree(16278 /* AsyncFunctionBodyExcludes */, 69 /* AsyncFunctionBodyIncludes */)
+ : enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */);
var savedConvertedLoopState = convertedLoopState;
convertedLoopState = undefined;
var parameters = ts.visitParameterList(node.parameters, visitor, context);
var body = transformFunctionBody(node);
- var name = hierarchyFacts & 8192 /* NewTarget */
+ var name = hierarchyFacts & 16384 /* NewTarget */
? ts.getLocalName(node)
: node.name;
- exitSubtree(ancestorFacts, 24576 /* FunctionSubtreeExcludes */, 0 /* None */);
+ exitSubtree(ancestorFacts, 49152 /* FunctionSubtreeExcludes */, 0 /* None */);
convertedLoopState = savedConvertedLoopState;
return ts.updateFunctionExpression(node,
/*modifiers*/ undefined, node.asteriskToken, name,
@@ -73306,13 +74146,13 @@
function visitFunctionDeclaration(node) {
var savedConvertedLoopState = convertedLoopState;
convertedLoopState = undefined;
- var ancestorFacts = enterSubtree(8094 /* FunctionExcludes */, 65 /* FunctionIncludes */);
+ var ancestorFacts = enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */);
var parameters = ts.visitParameterList(node.parameters, visitor, context);
var body = transformFunctionBody(node);
- var name = hierarchyFacts & 8192 /* NewTarget */
+ var name = hierarchyFacts & 16384 /* NewTarget */
? ts.getLocalName(node)
: node.name;
- exitSubtree(ancestorFacts, 24576 /* FunctionSubtreeExcludes */, 0 /* None */);
+ exitSubtree(ancestorFacts, 49152 /* FunctionSubtreeExcludes */, 0 /* None */);
convertedLoopState = savedConvertedLoopState;
return ts.updateFunctionDeclaration(node,
/*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, name,
@@ -73330,14 +74170,14 @@
var savedConvertedLoopState = convertedLoopState;
convertedLoopState = undefined;
var ancestorFacts = container && ts.isClassLike(container) && !ts.hasModifier(node, 32 /* Static */)
- ? enterSubtree(8094 /* FunctionExcludes */, 65 /* FunctionIncludes */ | 8 /* NonStaticClassElement */)
- : enterSubtree(8094 /* FunctionExcludes */, 65 /* FunctionIncludes */);
+ ? enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */ | 8 /* NonStaticClassElement */)
+ : enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */);
var parameters = ts.visitParameterList(node.parameters, visitor, context);
var body = transformFunctionBody(node);
- if (hierarchyFacts & 8192 /* NewTarget */ && !name && (node.kind === 239 /* FunctionDeclaration */ || node.kind === 196 /* FunctionExpression */)) {
+ if (hierarchyFacts & 16384 /* NewTarget */ && !name && (node.kind === 240 /* FunctionDeclaration */ || node.kind === 197 /* FunctionExpression */)) {
name = ts.getGeneratedNameForNode(node);
}
- exitSubtree(ancestorFacts, 24576 /* FunctionSubtreeExcludes */, 0 /* None */);
+ exitSubtree(ancestorFacts, 49152 /* FunctionSubtreeExcludes */, 0 /* None */);
convertedLoopState = savedConvertedLoopState;
return ts.setOriginalNode(ts.setTextRange(ts.createFunctionExpression(
/*modifiers*/ undefined, node.asteriskToken, name,
@@ -73378,7 +74218,7 @@
}
}
else {
- ts.Debug.assert(node.kind === 197 /* ArrowFunction */);
+ ts.Debug.assert(node.kind === 198 /* ArrowFunction */);
// To align with the old emitter, we use a synthetic end position on the location
// for the statement list we synthesize when we down-level an arrow function with
// an expression function body. This prevents both comments and source maps from
@@ -73432,8 +74272,8 @@
return ts.visitEachChild(node, visitor, context);
}
var ancestorFacts = hierarchyFacts & 256 /* IterationStatement */
- ? enterSubtree(4032 /* IterationStatementBlockExcludes */, 512 /* IterationStatementBlockIncludes */)
- : enterSubtree(3904 /* BlockExcludes */, 128 /* BlockIncludes */);
+ ? enterSubtree(7104 /* IterationStatementBlockExcludes */, 512 /* IterationStatementBlockIncludes */)
+ : enterSubtree(6976 /* BlockExcludes */, 128 /* BlockIncludes */);
var updated = ts.visitEachChild(node, visitor, context);
exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */);
return updated;
@@ -73446,9 +74286,9 @@
function visitExpressionStatement(node) {
// If we are here it is most likely because our expression is a destructuring assignment.
switch (node.expression.kind) {
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return ts.updateExpressionStatement(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false));
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return ts.updateExpressionStatement(node, visitBinaryExpression(node.expression, /*needsDestructuringValue*/ false));
}
return ts.visitEachChild(node, visitor, context);
@@ -73467,9 +74307,9 @@
// expression. If we are in a state where we do not need the destructuring value,
// we pass that information along to the children that care about it.
switch (node.expression.kind) {
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return ts.updateParen(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false));
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return ts.updateParen(node, visitBinaryExpression(node.expression, /*needsDestructuringValue*/ false));
}
}
@@ -73504,7 +74344,7 @@
assignment = ts.flattenDestructuringAssignment(decl, visitor, context, 0 /* All */);
}
else {
- assignment = ts.createBinary(decl.name, 59 /* EqualsToken */, ts.visitNode(decl.initializer, visitor, ts.isExpression));
+ assignment = ts.createBinary(decl.name, 60 /* EqualsToken */, ts.visitNode(decl.initializer, visitor, ts.isExpression));
ts.setTextRange(assignment, decl);
}
assignments = ts.append(assignments, assignment);
@@ -73616,11 +74456,11 @@
&& isDeclaredInLoop
&& (hierarchyFacts & 512 /* IterationStatementBlock */) !== 0);
var emitExplicitInitializer = !emittedAsTopLevel
- && (hierarchyFacts & 2048 /* ForInOrForOfStatement */) === 0
+ && (hierarchyFacts & 4096 /* ForInOrForOfStatement */) === 0
&& (!resolver.isDeclarationWithCollidingName(node)
|| (isDeclaredInLoop
&& !isCapturedInFunction
- && (hierarchyFacts & (1024 /* ForStatement */ | 2048 /* ForInOrForOfStatement */)) === 0));
+ && (hierarchyFacts & (2048 /* ForStatement */ | 4096 /* ForInOrForOfStatement */)) === 0));
return emitExplicitInitializer;
}
/**
@@ -73678,34 +74518,34 @@
}
function visitIterationStatement(node, outermostLabeledStatement) {
switch (node.kind) {
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
return visitDoOrWhileStatement(node, outermostLabeledStatement);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return visitForStatement(node, outermostLabeledStatement);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return visitForInStatement(node, outermostLabeledStatement);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return visitForOfStatement(node, outermostLabeledStatement);
}
}
function visitIterationStatementWithFacts(excludeFacts, includeFacts, node, outermostLabeledStatement, convert) {
var ancestorFacts = enterSubtree(excludeFacts, includeFacts);
- var updated = convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert);
+ var updated = convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, ancestorFacts, convert);
exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */);
return updated;
}
function visitDoOrWhileStatement(node, outermostLabeledStatement) {
- return visitIterationStatementWithFacts(0 /* DoOrWhileStatementExcludes */, 256 /* DoOrWhileStatementIncludes */, node, outermostLabeledStatement);
+ return visitIterationStatementWithFacts(0 /* DoOrWhileStatementExcludes */, 1280 /* DoOrWhileStatementIncludes */, node, outermostLabeledStatement);
}
function visitForStatement(node, outermostLabeledStatement) {
- return visitIterationStatementWithFacts(3008 /* ForStatementExcludes */, 1280 /* ForStatementIncludes */, node, outermostLabeledStatement);
+ return visitIterationStatementWithFacts(5056 /* ForStatementExcludes */, 3328 /* ForStatementIncludes */, node, outermostLabeledStatement);
}
function visitForInStatement(node, outermostLabeledStatement) {
- return visitIterationStatementWithFacts(1984 /* ForInOrForOfStatementExcludes */, 2304 /* ForInOrForOfStatementIncludes */, node, outermostLabeledStatement);
+ return visitIterationStatementWithFacts(3008 /* ForInOrForOfStatementExcludes */, 5376 /* ForInOrForOfStatementIncludes */, node, outermostLabeledStatement);
}
function visitForOfStatement(node, outermostLabeledStatement) {
- return visitIterationStatementWithFacts(1984 /* ForInOrForOfStatementExcludes */, 2304 /* ForInOrForOfStatementIncludes */, node, outermostLabeledStatement, compilerOptions.downlevelIteration ? convertForOfStatementForIterable : convertForOfStatementForArray);
+ return visitIterationStatementWithFacts(3008 /* ForInOrForOfStatementExcludes */, 5376 /* ForInOrForOfStatementIncludes */, node, outermostLabeledStatement, compilerOptions.downlevelIteration ? convertForOfStatementForIterable : convertForOfStatementForArray);
}
function convertForOfStatementHead(node, boundValue, convertedLoopBodyStatements) {
var statements = [];
@@ -73813,7 +74653,7 @@
ts.setTextRange(forStatement, node);
return ts.restoreEnclosingLabel(forStatement, outermostLabeledStatement, convertedLoopState && resetLabel);
}
- function convertForOfStatementForIterable(node, outermostLabeledStatement, convertedLoopBodyStatements) {
+ function convertForOfStatementForIterable(node, outermostLabeledStatement, convertedLoopBodyStatements, ancestorFacts) {
var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
var iterator = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(expression) : ts.createTempVariable(/*recordTempVariable*/ undefined);
var result = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(iterator) : ts.createTempVariable(/*recordTempVariable*/ undefined);
@@ -73824,9 +74664,13 @@
var next = ts.createCall(ts.createPropertyAccess(iterator, "next"), /*typeArguments*/ undefined, []);
hoistVariableDeclaration(errorRecord);
hoistVariableDeclaration(returnMethod);
+ // if we are enclosed in an outer loop ensure we reset 'errorRecord' per each iteration
+ var initializer = ancestorFacts & 1024 /* IterationContainer */
+ ? ts.inlineExpressions([ts.createAssignment(errorRecord, ts.createVoidZero()), values])
+ : values;
var forStatement = ts.setEmitFlags(ts.setTextRange(ts.createFor(
/*initializer*/ ts.setEmitFlags(ts.setTextRange(ts.createVariableDeclarationList([
- ts.setTextRange(ts.createVariableDeclaration(iterator, /*type*/ undefined, values), node.expression),
+ ts.setTextRange(ts.createVariableDeclaration(iterator, /*type*/ undefined, initializer), node.expression),
ts.createVariableDeclaration(result, /*type*/ undefined, next)
]), node.expression), 2097152 /* NoHoisting */),
/*condition*/ ts.createLogicalNot(ts.createPropertyAccess(result, "done")),
@@ -73869,7 +74713,7 @@
&& i < numInitialPropertiesWithoutYield) {
numInitialPropertiesWithoutYield = i;
}
- if (property.name.kind === 149 /* ComputedPropertyName */) {
+ if (property.name.kind === 150 /* ComputedPropertyName */) {
numInitialProperties = i;
break;
}
@@ -73924,7 +74768,7 @@
}
visit(node.name);
function visit(node) {
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
state.hoistedLocalVariables.push(node);
}
else {
@@ -73937,7 +74781,7 @@
}
}
}
- function convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert) {
+ function convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, ancestorFacts, convert) {
if (!shouldConvertIterationStatement(node)) {
var saveAllowedNonLabeledJumps = void 0;
if (convertedLoopState) {
@@ -73947,7 +74791,7 @@
convertedLoopState.allowedNonLabeledJumps = 2 /* Break */ | 4 /* Continue */;
}
var result = convert
- ? convert(node, outermostLabeledStatement, /*convertedLoopBodyStatements*/ undefined)
+ ? convert(node, outermostLabeledStatement, /*convertedLoopBodyStatements*/ undefined, ancestorFacts)
: ts.restoreEnclosingLabel(ts.visitEachChild(node, visitor, context), outermostLabeledStatement, convertedLoopState && resetLabel);
if (convertedLoopState) {
convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps;
@@ -73972,7 +74816,7 @@
var loop;
if (bodyFunction) {
if (convert) {
- loop = convert(node, outermostLabeledStatement, bodyFunction.part);
+ loop = convert(node, outermostLabeledStatement, bodyFunction.part, ancestorFacts);
}
else {
var clone_3 = convertIterationStatementCore(node, initializerFunction, ts.createBlock(bodyFunction.part, /*multiLine*/ true));
@@ -73990,11 +74834,11 @@
}
function convertIterationStatementCore(node, initializerFunction, convertedLoopBody) {
switch (node.kind) {
- case 225 /* ForStatement */: return convertForStatement(node, initializerFunction, convertedLoopBody);
- case 226 /* ForInStatement */: return convertForInStatement(node, convertedLoopBody);
- case 227 /* ForOfStatement */: return convertForOfStatement(node, convertedLoopBody);
- case 223 /* DoStatement */: return convertDoStatement(node, convertedLoopBody);
- case 224 /* WhileStatement */: return convertWhileStatement(node, convertedLoopBody);
+ case 226 /* ForStatement */: return convertForStatement(node, initializerFunction, convertedLoopBody);
+ case 227 /* ForInStatement */: return convertForInStatement(node, convertedLoopBody);
+ case 228 /* ForOfStatement */: return convertForOfStatement(node, convertedLoopBody);
+ case 224 /* DoStatement */: return convertDoStatement(node, convertedLoopBody);
+ case 225 /* WhileStatement */: return convertWhileStatement(node, convertedLoopBody);
default: return ts.Debug.failBadSyntaxKind(node, "IterationStatement expected");
}
}
@@ -74019,11 +74863,11 @@
function createConvertedLoopState(node) {
var loopInitializer;
switch (node.kind) {
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
var initializer = node.initializer;
- if (initializer && initializer.kind === 238 /* VariableDeclarationList */) {
+ if (initializer && initializer.kind === 239 /* VariableDeclarationList */) {
loopInitializer = initializer;
}
break;
@@ -74285,7 +75129,7 @@
function copyOutParameter(outParam, copyDirection) {
var source = copyDirection === 0 /* ToOriginal */ ? outParam.outParamName : outParam.originalName;
var target = copyDirection === 0 /* ToOriginal */ ? outParam.originalName : outParam.outParamName;
- return ts.createBinary(target, 59 /* EqualsToken */, source);
+ return ts.createBinary(target, 60 /* EqualsToken */, source);
}
function copyOutParameters(outParams, partFlags, copyDirection, statements) {
for (var _i = 0, outParams_1 = outParams; _i < outParams_1.length; _i++) {
@@ -74422,20 +75266,20 @@
for (var i = start; i < numProperties; i++) {
var property = properties[i];
switch (property.kind) {
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
var accessors = ts.getAllAccessorDeclarations(node.properties, property);
if (property === accessors.firstAccessor) {
expressions.push(transformAccessorsToExpression(receiver, accessors, node, !!node.multiLine));
}
break;
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine));
break;
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine));
break;
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine));
break;
default:
@@ -74490,7 +75334,7 @@
return expression;
}
function visitCatchClause(node) {
- var ancestorFacts = enterSubtree(4032 /* BlockScopeExcludes */, 0 /* BlockScopeIncludes */);
+ var ancestorFacts = enterSubtree(7104 /* BlockScopeExcludes */, 0 /* BlockScopeIncludes */);
var updated;
ts.Debug.assert(!!node.variableDeclaration, "Catch clause variable should always be present when downleveling ES2015.");
if (ts.isBindingPattern(node.variableDeclaration.name)) {
@@ -74538,17 +75382,17 @@
ts.Debug.assert(!ts.isComputedPropertyName(node.name));
var savedConvertedLoopState = convertedLoopState;
convertedLoopState = undefined;
- var ancestorFacts = enterSubtree(8094 /* FunctionExcludes */, 65 /* FunctionIncludes */);
+ var ancestorFacts = enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */);
var updated;
var parameters = ts.visitParameterList(node.parameters, visitor, context);
var body = transformFunctionBody(node);
- if (node.kind === 158 /* GetAccessor */) {
+ if (node.kind === 159 /* GetAccessor */) {
updated = ts.updateGetAccessor(node, node.decorators, node.modifiers, node.name, parameters, node.type, body);
}
else {
updated = ts.updateSetAccessor(node, node.decorators, node.modifiers, node.name, parameters, body);
}
- exitSubtree(ancestorFacts, 24576 /* FunctionSubtreeExcludes */, 0 /* None */);
+ exitSubtree(ancestorFacts, 49152 /* FunctionSubtreeExcludes */, 0 /* None */);
convertedLoopState = savedConvertedLoopState;
return updated;
}
@@ -74595,7 +75439,7 @@
return visitTypeScriptClassWrapper(node);
}
var expression = ts.skipOuterExpressions(node.expression);
- if (expression.kind === 98 /* SuperKeyword */ ||
+ if (expression.kind === 99 /* SuperKeyword */ ||
ts.isSuperProperty(expression) ||
ts.some(node.arguments, ts.isSpreadElement)) {
return visitCallExpressionWithPotentialCapturedThisAssignment(node, /*assignToCapturedThis*/ true);
@@ -74719,10 +75563,10 @@
// We are here either because SuperKeyword was used somewhere in the expression, or
// because we contain a SpreadElementExpression.
if (node.transformFlags & 4096 /* ContainsRestOrSpread */ ||
- node.expression.kind === 98 /* SuperKeyword */ ||
+ node.expression.kind === 99 /* SuperKeyword */ ||
ts.isSuperProperty(ts.skipOuterExpressions(node.expression))) {
var _a = ts.createCallBinding(node.expression, hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
ts.setEmitFlags(thisArg, 4 /* NoSubstitution */);
}
var resultingCall = void 0;
@@ -74740,7 +75584,7 @@
// _super.apply(this, a.concat([b]))
// _super.m.apply(this, a.concat([b]))
// _super.prototype.m.apply(this, a.concat([b]))
- resultingCall = ts.createFunctionApply(ts.visitNode(target, callExpressionVisitor, ts.isExpression), node.expression.kind === 98 /* SuperKeyword */ ? thisArg : ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false));
+ resultingCall = ts.createFunctionApply(ts.visitNode(target, callExpressionVisitor, ts.isExpression), node.expression.kind === 99 /* SuperKeyword */ ? thisArg : ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false));
}
else {
// [source]
@@ -74752,10 +75596,10 @@
// _super.call(this, a)
// _super.m.call(this, a)
// _super.prototype.m.call(this, a)
- resultingCall = ts.createFunctionCall(ts.visitNode(target, callExpressionVisitor, ts.isExpression), node.expression.kind === 98 /* SuperKeyword */ ? thisArg : ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression),
+ resultingCall = ts.createFunctionCall(ts.visitNode(target, callExpressionVisitor, ts.isExpression), node.expression.kind === 99 /* SuperKeyword */ ? thisArg : ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression),
/*location*/ node);
}
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
var initializer = ts.createLogicalOr(resultingCall, createActualThis());
resultingCall = assignToCapturedThis
? ts.createAssignment(ts.createFileLevelUniqueName("_this"), initializer)
@@ -74818,7 +75662,7 @@
else {
if (segments.length === 1) {
var firstElement = elements[0];
- return needsUniqueCopy && ts.isSpreadElement(firstElement) && firstElement.expression.kind !== 187 /* ArrayLiteralExpression */
+ return needsUniqueCopy && ts.isSpreadElement(firstElement) && firstElement.expression.kind !== 188 /* ArrayLiteralExpression */
? ts.createArraySlice(segments[0])
: segments[0];
}
@@ -75033,8 +75877,8 @@
: ts.createFileLevelUniqueName("_super");
}
function visitMetaProperty(node) {
- if (node.keywordToken === 95 /* NewKeyword */ && node.name.escapedText === "target") {
- hierarchyFacts |= 8192 /* NewTarget */;
+ if (node.keywordToken === 96 /* NewKeyword */ && node.name.escapedText === "target") {
+ hierarchyFacts |= 16384 /* NewTarget */;
return ts.createFileLevelUniqueName("_newTarget");
}
return node;
@@ -75049,7 +75893,7 @@
function onEmitNode(hint, node, emitCallback) {
if (enabledSubstitutions & 1 /* CapturedThis */ && ts.isFunctionLike(node)) {
// If we are tracking a captured `this`, keep track of the enclosing function.
- var ancestorFacts = enterSubtree(8094 /* FunctionExcludes */, ts.getEmitFlags(node) & 8 /* CapturesThis */
+ var ancestorFacts = enterSubtree(16286 /* FunctionExcludes */, ts.getEmitFlags(node) & 8 /* CapturesThis */
? 65 /* FunctionIncludes */ | 16 /* CapturesThis */
: 65 /* FunctionIncludes */);
previousOnEmitNode(hint, node, emitCallback);
@@ -75065,7 +75909,7 @@
function enableSubstitutionsForBlockScopedBindings() {
if ((enabledSubstitutions & 2 /* BlockScopedBindings */) === 0) {
enabledSubstitutions |= 2 /* BlockScopedBindings */;
- context.enableSubstitution(72 /* Identifier */);
+ context.enableSubstitution(73 /* Identifier */);
}
}
/**
@@ -75075,14 +75919,14 @@
function enableSubstitutionsForCapturedThis() {
if ((enabledSubstitutions & 1 /* CapturedThis */) === 0) {
enabledSubstitutions |= 1 /* CapturedThis */;
- context.enableSubstitution(100 /* ThisKeyword */);
- context.enableEmitNotification(157 /* Constructor */);
- context.enableEmitNotification(156 /* MethodDeclaration */);
- context.enableEmitNotification(158 /* GetAccessor */);
- context.enableEmitNotification(159 /* SetAccessor */);
- context.enableEmitNotification(197 /* ArrowFunction */);
- context.enableEmitNotification(196 /* FunctionExpression */);
- context.enableEmitNotification(239 /* FunctionDeclaration */);
+ context.enableSubstitution(101 /* ThisKeyword */);
+ context.enableEmitNotification(158 /* Constructor */);
+ context.enableEmitNotification(157 /* MethodDeclaration */);
+ context.enableEmitNotification(159 /* GetAccessor */);
+ context.enableEmitNotification(160 /* SetAccessor */);
+ context.enableEmitNotification(198 /* ArrowFunction */);
+ context.enableEmitNotification(197 /* FunctionExpression */);
+ context.enableEmitNotification(240 /* FunctionDeclaration */);
}
}
/**
@@ -75123,10 +75967,10 @@
*/
function isNameOfDeclarationWithCollidingName(node) {
switch (node.parent.kind) {
- case 186 /* BindingElement */:
- case 240 /* ClassDeclaration */:
- case 243 /* EnumDeclaration */:
- case 237 /* VariableDeclaration */:
+ case 187 /* BindingElement */:
+ case 241 /* ClassDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 238 /* VariableDeclaration */:
return node.parent.name === node
&& resolver.isDeclarationWithCollidingName(node.parent);
}
@@ -75139,9 +75983,9 @@
*/
function substituteExpression(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return substituteExpressionIdentifier(node);
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
return substituteThisKeyword(node);
}
return node;
@@ -75208,19 +76052,19 @@
return false;
}
var statement = ts.firstOrUndefined(constructor.body.statements);
- if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 221 /* ExpressionStatement */) {
+ if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 222 /* ExpressionStatement */) {
return false;
}
var statementExpression = statement.expression;
- if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 191 /* CallExpression */) {
+ if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 192 /* CallExpression */) {
return false;
}
var callTarget = statementExpression.expression;
- if (!ts.nodeIsSynthesized(callTarget) || callTarget.kind !== 98 /* SuperKeyword */) {
+ if (!ts.nodeIsSynthesized(callTarget) || callTarget.kind !== 99 /* SuperKeyword */) {
return false;
}
var callArgument = ts.singleOrUndefined(statementExpression.arguments);
- if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 208 /* SpreadElement */) {
+ if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 209 /* SpreadElement */) {
return false;
}
var expression = callArgument.expression;
@@ -75273,15 +76117,15 @@
if (compilerOptions.jsx === 1 /* Preserve */ || compilerOptions.jsx === 3 /* ReactNative */) {
previousOnEmitNode = context.onEmitNode;
context.onEmitNode = onEmitNode;
- context.enableEmitNotification(262 /* JsxOpeningElement */);
- context.enableEmitNotification(263 /* JsxClosingElement */);
- context.enableEmitNotification(261 /* JsxSelfClosingElement */);
+ context.enableEmitNotification(263 /* JsxOpeningElement */);
+ context.enableEmitNotification(264 /* JsxClosingElement */);
+ context.enableEmitNotification(262 /* JsxSelfClosingElement */);
noSubstitution = [];
}
var previousOnSubstituteNode = context.onSubstituteNode;
context.onSubstituteNode = onSubstituteNode;
- context.enableSubstitution(189 /* PropertyAccessExpression */);
- context.enableSubstitution(275 /* PropertyAssignment */);
+ context.enableSubstitution(190 /* PropertyAccessExpression */);
+ context.enableSubstitution(276 /* PropertyAssignment */);
return ts.chainBundle(transformSourceFile);
/**
* Transforms an ES5 source file to ES3.
@@ -75300,9 +76144,9 @@
*/
function onEmitNode(hint, node, emitCallback) {
switch (node.kind) {
- case 262 /* JsxOpeningElement */:
- case 263 /* JsxClosingElement */:
- case 261 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
+ case 264 /* JsxClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
var tagName = node.tagName;
noSubstitution[ts.getOriginalNodeId(tagName)] = true;
break;
@@ -75359,7 +76203,7 @@
*/
function trySubstituteReservedName(name) {
var token = name.originalKeywordKind || (ts.nodeIsSynthesized(name) ? ts.stringToToken(ts.idText(name)) : undefined);
- if (token !== undefined && token >= 73 /* FirstReservedWord */ && token <= 108 /* LastReservedWord */) {
+ if (token !== undefined && token >= 74 /* FirstReservedWord */ && token <= 109 /* LastReservedWord */) {
return ts.setTextRange(ts.createLiteral(name), name);
}
return undefined;
@@ -75634,13 +76478,13 @@
*/
function visitJavaScriptInStatementContainingYield(node) {
switch (node.kind) {
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
return visitDoStatement(node);
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
return visitWhileStatement(node);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return visitSwitchStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return visitLabeledStatement(node);
default:
return visitJavaScriptInGeneratorFunctionBody(node);
@@ -75653,24 +76497,24 @@
*/
function visitJavaScriptInGeneratorFunctionBody(node) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return visitFunctionDeclaration(node);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return visitFunctionExpression(node);
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return visitAccessorDeclaration(node);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return visitVariableStatement(node);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return visitForStatement(node);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return visitForInStatement(node);
- case 229 /* BreakStatement */:
+ case 230 /* BreakStatement */:
return visitBreakStatement(node);
- case 228 /* ContinueStatement */:
+ case 229 /* ContinueStatement */:
return visitContinueStatement(node);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return visitReturnStatement(node);
default:
if (node.transformFlags & 131072 /* ContainsYield */) {
@@ -75691,21 +76535,21 @@
*/
function visitJavaScriptContainingYield(node) {
switch (node.kind) {
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return visitBinaryExpression(node);
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return visitConditionalExpression(node);
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return visitYieldExpression(node);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return visitArrayLiteralExpression(node);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return visitObjectLiteralExpression(node);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return visitElementAccessExpression(node);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return visitCallExpression(node);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return visitNewExpression(node);
default:
return ts.visitEachChild(node, visitor, context);
@@ -75718,9 +76562,9 @@
*/
function visitGenerator(node) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return visitFunctionDeclaration(node);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return visitFunctionExpression(node);
default:
return ts.Debug.failBadSyntaxKind(node);
@@ -75919,23 +76763,23 @@
}
}
function isCompoundAssignment(kind) {
- return kind >= 60 /* FirstCompoundAssignment */
- && kind <= 71 /* LastCompoundAssignment */;
+ return kind >= 61 /* FirstCompoundAssignment */
+ && kind <= 72 /* LastCompoundAssignment */;
}
function getOperatorForCompoundAssignment(kind) {
switch (kind) {
- case 60 /* PlusEqualsToken */: return 38 /* PlusToken */;
- case 61 /* MinusEqualsToken */: return 39 /* MinusToken */;
- case 62 /* AsteriskEqualsToken */: return 40 /* AsteriskToken */;
- case 63 /* AsteriskAsteriskEqualsToken */: return 41 /* AsteriskAsteriskToken */;
- case 64 /* SlashEqualsToken */: return 42 /* SlashToken */;
- case 65 /* PercentEqualsToken */: return 43 /* PercentToken */;
- case 66 /* LessThanLessThanEqualsToken */: return 46 /* LessThanLessThanToken */;
- case 67 /* GreaterThanGreaterThanEqualsToken */: return 47 /* GreaterThanGreaterThanToken */;
- case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */: return 48 /* GreaterThanGreaterThanGreaterThanToken */;
- case 69 /* AmpersandEqualsToken */: return 49 /* AmpersandToken */;
- case 70 /* BarEqualsToken */: return 50 /* BarToken */;
- case 71 /* CaretEqualsToken */: return 51 /* CaretToken */;
+ case 61 /* PlusEqualsToken */: return 38 /* PlusToken */;
+ case 62 /* MinusEqualsToken */: return 39 /* MinusToken */;
+ case 63 /* AsteriskEqualsToken */: return 40 /* AsteriskToken */;
+ case 64 /* AsteriskAsteriskEqualsToken */: return 41 /* AsteriskAsteriskToken */;
+ case 65 /* SlashEqualsToken */: return 42 /* SlashToken */;
+ case 66 /* PercentEqualsToken */: return 43 /* PercentToken */;
+ case 67 /* LessThanLessThanEqualsToken */: return 46 /* LessThanLessThanToken */;
+ case 68 /* GreaterThanGreaterThanEqualsToken */: return 47 /* GreaterThanGreaterThanToken */;
+ case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */: return 48 /* GreaterThanGreaterThanGreaterThanToken */;
+ case 70 /* AmpersandEqualsToken */: return 49 /* AmpersandToken */;
+ case 71 /* BarEqualsToken */: return 50 /* BarToken */;
+ case 72 /* CaretEqualsToken */: return 51 /* CaretToken */;
}
}
/**
@@ -75948,7 +76792,7 @@
if (containsYield(right)) {
var target = void 0;
switch (left.kind) {
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
// [source]
// a.b = yield;
//
@@ -75960,7 +76804,7 @@
// _a.b = %sent%;
target = ts.updatePropertyAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name);
break;
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
// [source]
// a[b] = yield;
//
@@ -76336,35 +77180,35 @@
}
function transformAndEmitStatementWorker(node) {
switch (node.kind) {
- case 218 /* Block */:
+ case 219 /* Block */:
return transformAndEmitBlock(node);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return transformAndEmitExpressionStatement(node);
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
return transformAndEmitIfStatement(node);
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
return transformAndEmitDoStatement(node);
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
return transformAndEmitWhileStatement(node);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return transformAndEmitForStatement(node);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return transformAndEmitForInStatement(node);
- case 228 /* ContinueStatement */:
+ case 229 /* ContinueStatement */:
return transformAndEmitContinueStatement(node);
- case 229 /* BreakStatement */:
+ case 230 /* BreakStatement */:
return transformAndEmitBreakStatement(node);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return transformAndEmitReturnStatement(node);
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
return transformAndEmitWithStatement(node);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return transformAndEmitSwitchStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return transformAndEmitLabeledStatement(node);
- case 234 /* ThrowStatement */:
+ case 235 /* ThrowStatement */:
return transformAndEmitThrowStatement(node);
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
return transformAndEmitTryStatement(node);
default:
return emitStatement(ts.visitNode(node, visitor, ts.isStatement));
@@ -76794,7 +77638,7 @@
for (var i = 0; i < numClauses; i++) {
var clause = caseBlock.clauses[i];
clauseLabels.push(defineLabel());
- if (clause.kind === 272 /* DefaultClause */ && defaultClauseIndex === -1) {
+ if (clause.kind === 273 /* DefaultClause */ && defaultClauseIndex === -1) {
defaultClauseIndex = i;
}
}
@@ -76807,7 +77651,7 @@
var defaultClausesSkipped = 0;
for (var i = clausesWritten; i < numClauses; i++) {
var clause = caseBlock.clauses[i];
- if (clause.kind === 271 /* CaseClause */) {
+ if (clause.kind === 272 /* CaseClause */) {
if (containsYield(clause.expression) && pendingClauses.length > 0) {
break;
}
@@ -77119,7 +77963,7 @@
if (!renamedCatchVariables) {
renamedCatchVariables = ts.createMap();
renamedCatchVariableDeclarations = [];
- context.enableSubstitution(72 /* Identifier */);
+ context.enableSubstitution(73 /* Identifier */);
}
renamedCatchVariables.set(text, true);
renamedCatchVariableDeclarations[ts.getOriginalNodeId(variable)] = name;
@@ -78035,12 +78879,12 @@
var previousOnEmitNode = context.onEmitNode;
context.onSubstituteNode = onSubstituteNode;
context.onEmitNode = onEmitNode;
- context.enableSubstitution(72 /* Identifier */); // Substitutes expression identifiers with imported/exported symbols.
- context.enableSubstitution(204 /* BinaryExpression */); // Substitutes assignments to exported symbols.
- context.enableSubstitution(202 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols.
- context.enableSubstitution(203 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols.
- context.enableSubstitution(276 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols.
- context.enableEmitNotification(284 /* SourceFile */); // Restore state when substituting nodes in a file.
+ context.enableSubstitution(73 /* Identifier */); // Substitutes expression identifiers with imported/exported symbols.
+ context.enableSubstitution(205 /* BinaryExpression */); // Substitutes assignments to exported symbols.
+ context.enableSubstitution(203 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols.
+ context.enableSubstitution(204 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols.
+ context.enableSubstitution(277 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols.
+ context.enableEmitNotification(285 /* SourceFile */); // Restore state when substituting nodes in a file.
var moduleInfoMap = []; // The ExternalModuleInfo for each file.
var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found.
var currentSourceFile; // The current file.
@@ -78368,23 +79212,23 @@
*/
function sourceElementVisitor(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return visitImportDeclaration(node);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return visitImportEqualsDeclaration(node);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return visitExportDeclaration(node);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return visitExportAssignment(node);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return visitVariableStatement(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return visitFunctionDeclaration(node);
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return visitClassDeclaration(node);
- case 315 /* MergeDeclarationMarker */:
+ case 316 /* MergeDeclarationMarker */:
return visitMergeDeclarationMarker(node);
- case 316 /* EndOfDeclarationMarker */:
+ case 317 /* EndOfDeclarationMarker */:
return visitEndOfDeclarationMarker(node);
default:
return ts.visitEachChild(node, moduleExpressionElementVisitor, context);
@@ -78411,24 +79255,24 @@
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var elem = _a[_i];
switch (elem.kind) {
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
if (destructuringNeedsFlattening(elem.initializer)) {
return true;
}
break;
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
if (destructuringNeedsFlattening(elem.name)) {
return true;
}
break;
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
if (destructuringNeedsFlattening(elem.expression)) {
return true;
}
break;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return false;
default: ts.Debug.assertNever(elem, "Unhandled object member kind");
}
@@ -78906,7 +79750,7 @@
//
// To balance the declaration, add the exports of the elided variable
// statement.
- if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 219 /* VariableStatement */) {
+ if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 220 /* VariableStatement */) {
var id = ts.getOriginalNodeId(node);
deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original);
}
@@ -78961,10 +79805,10 @@
var namedBindings = importClause.namedBindings;
if (namedBindings) {
switch (namedBindings.kind) {
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
statements = appendExportsOfDeclaration(statements, namedBindings);
break;
- case 252 /* NamedImports */:
+ case 253 /* NamedImports */:
for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) {
var importBinding = _a[_i];
statements = appendExportsOfDeclaration(statements, importBinding);
@@ -79146,8 +79990,8 @@
function modifierVisitor(node) {
// Elide module-specific modifiers.
switch (node.kind) {
- case 85 /* ExportKeyword */:
- case 80 /* DefaultKeyword */:
+ case 86 /* ExportKeyword */:
+ case 81 /* DefaultKeyword */:
return undefined;
}
return node;
@@ -79163,7 +80007,7 @@
* @param emit A callback used to emit the node in the printer.
*/
function onEmitNode(hint, node, emitCallback) {
- if (node.kind === 284 /* SourceFile */) {
+ if (node.kind === 285 /* SourceFile */) {
currentSourceFile = node;
currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)];
noSubstitution = [];
@@ -79225,12 +80069,12 @@
*/
function substituteExpression(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return substituteExpressionIdentifier(node);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return substituteBinaryExpression(node);
- case 203 /* PostfixUnaryExpression */:
- case 202 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return substituteUnaryExpression(node);
}
return node;
@@ -79251,7 +80095,7 @@
}
if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) {
var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node));
- if (exportContainer && exportContainer.kind === 284 /* SourceFile */) {
+ if (exportContainer && exportContainer.kind === 285 /* SourceFile */) {
return ts.setTextRange(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node)),
/*location*/ node);
}
@@ -79326,8 +80170,8 @@
&& !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) {
var exportedNames = getExports(node.operand);
if (exportedNames) {
- var expression = node.kind === 203 /* PostfixUnaryExpression */
- ? ts.setTextRange(ts.createBinary(node.operand, ts.createToken(node.operator === 44 /* PlusPlusToken */ ? 60 /* PlusEqualsToken */ : 61 /* MinusEqualsToken */), ts.createLiteral(1)),
+ var expression = node.kind === 204 /* PostfixUnaryExpression */
+ ? ts.setTextRange(ts.createBinary(node.operand, ts.createToken(node.operator === 44 /* PlusPlusToken */ ? 61 /* PlusEqualsToken */ : 62 /* MinusEqualsToken */), ts.createLiteral(1)),
/*location*/ node)
: node;
for (var _i = 0, exportedNames_3 = exportedNames; _i < exportedNames_3.length; _i++) {
@@ -79401,12 +80245,12 @@
var previousOnEmitNode = context.onEmitNode;
context.onSubstituteNode = onSubstituteNode;
context.onEmitNode = onEmitNode;
- context.enableSubstitution(72 /* Identifier */); // Substitutes expression identifiers for imported symbols.
- context.enableSubstitution(276 /* ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols
- context.enableSubstitution(204 /* BinaryExpression */); // Substitutes assignments to exported symbols.
- context.enableSubstitution(202 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols.
- context.enableSubstitution(203 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols.
- context.enableEmitNotification(284 /* SourceFile */); // Restore state when substituting nodes in a file.
+ context.enableSubstitution(73 /* Identifier */); // Substitutes expression identifiers for imported symbols.
+ context.enableSubstitution(277 /* ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols
+ context.enableSubstitution(205 /* BinaryExpression */); // Substitutes assignments to exported symbols.
+ context.enableSubstitution(203 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols.
+ context.enableSubstitution(204 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols.
+ context.enableEmitNotification(285 /* SourceFile */); // Restore state when substituting nodes in a file.
var moduleInfoMap = []; // The ExternalModuleInfo for each file.
var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found.
var exportFunctionsMap = []; // The export function associated with a source file.
@@ -79627,7 +80471,7 @@
var hasExportDeclarationWithExportClause = false;
for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) {
var externalImport = _a[_i];
- if (externalImport.kind === 255 /* ExportDeclaration */ && externalImport.exportClause) {
+ if (externalImport.kind === 256 /* ExportDeclaration */ && externalImport.exportClause) {
hasExportDeclarationWithExportClause = true;
break;
}
@@ -79652,7 +80496,7 @@
}
for (var _d = 0, _e = moduleInfo.externalImports; _d < _e.length; _d++) {
var externalImport = _e[_d];
- if (externalImport.kind !== 255 /* ExportDeclaration */) {
+ if (externalImport.kind !== 256 /* ExportDeclaration */) {
continue;
}
if (!externalImport.exportClause) {
@@ -79730,19 +80574,19 @@
var entry = _b[_a];
var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile); // TODO: GH#18217
switch (entry.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
if (!entry.importClause) {
// 'import "..."' case
// module is imported only for side-effects, no emit required
break;
}
// falls through
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
ts.Debug.assert(importVariableName !== undefined);
// save import into the local
statements.push(ts.createExpressionStatement(ts.createAssignment(importVariableName, parameterName)));
break;
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
ts.Debug.assert(importVariableName !== undefined);
if (entry.exportClause) {
// export {a, b as c} from 'foo'
@@ -79792,15 +80636,15 @@
*/
function sourceElementVisitor(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return visitImportDeclaration(node);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return visitImportEqualsDeclaration(node);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
// ExportDeclarations are elided as they are handled via
// `appendExportsOfDeclaration`.
return undefined;
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return visitExportAssignment(node);
default:
return nestedElementVisitor(node);
@@ -79976,7 +80820,7 @@
function shouldHoistVariableDeclarationList(node) {
// hoist only non-block scoped declarations or block scoped declarations parented by source file
return (ts.getEmitFlags(node) & 2097152 /* NoHoisting */) === 0
- && (enclosingBlockScopedContainer.kind === 284 /* SourceFile */
+ && (enclosingBlockScopedContainer.kind === 285 /* SourceFile */
|| (ts.getOriginalNode(node).flags & 3 /* BlockScoped */) === 0);
}
/**
@@ -80040,7 +80884,7 @@
//
// To balance the declaration, we defer the exports of the elided variable
// statement until we visit this declaration's `EndOfDeclarationMarker`.
- if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 219 /* VariableStatement */) {
+ if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 220 /* VariableStatement */) {
var id = ts.getOriginalNodeId(node);
var isExportedDeclaration = ts.hasModifier(node.original, 1 /* Export */);
deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration);
@@ -80102,10 +80946,10 @@
var namedBindings = importClause.namedBindings;
if (namedBindings) {
switch (namedBindings.kind) {
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
statements = appendExportsOfDeclaration(statements, namedBindings);
break;
- case 252 /* NamedImports */:
+ case 253 /* NamedImports */:
for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) {
var importBinding = _a[_i];
statements = appendExportsOfDeclaration(statements, importBinding);
@@ -80285,43 +81129,43 @@
*/
function nestedElementVisitor(node) {
switch (node.kind) {
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return visitVariableStatement(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return visitFunctionDeclaration(node);
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return visitClassDeclaration(node);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return visitForStatement(node);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return visitForInStatement(node);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return visitForOfStatement(node);
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
return visitDoStatement(node);
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
return visitWhileStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return visitLabeledStatement(node);
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
return visitWithStatement(node);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return visitSwitchStatement(node);
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
return visitCaseBlock(node);
- case 271 /* CaseClause */:
+ case 272 /* CaseClause */:
return visitCaseClause(node);
- case 272 /* DefaultClause */:
+ case 273 /* DefaultClause */:
return visitDefaultClause(node);
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
return visitTryStatement(node);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return visitCatchClause(node);
- case 218 /* Block */:
+ case 219 /* Block */:
return visitBlock(node);
- case 315 /* MergeDeclarationMarker */:
+ case 316 /* MergeDeclarationMarker */:
return visitMergeDeclarationMarker(node);
- case 316 /* EndOfDeclarationMarker */:
+ case 317 /* EndOfDeclarationMarker */:
return visitEndOfDeclarationMarker(node);
default:
return destructuringAndImportCallVisitor(node);
@@ -80568,7 +81412,7 @@
}
else if (ts.isIdentifier(node)) {
var container = resolver.getReferencedExportContainer(node);
- return container !== undefined && container.kind === 284 /* SourceFile */;
+ return container !== undefined && container.kind === 285 /* SourceFile */;
}
else {
return false;
@@ -80584,8 +81428,8 @@
*/
function modifierVisitor(node) {
switch (node.kind) {
- case 85 /* ExportKeyword */:
- case 80 /* DefaultKeyword */:
+ case 86 /* ExportKeyword */:
+ case 81 /* DefaultKeyword */:
return undefined;
}
return node;
@@ -80601,7 +81445,7 @@
* @param emitCallback A callback used to emit the node in the printer.
*/
function onEmitNode(hint, node, emitCallback) {
- if (node.kind === 284 /* SourceFile */) {
+ if (node.kind === 285 /* SourceFile */) {
var id = ts.getOriginalNodeId(node);
currentSourceFile = node;
moduleInfo = moduleInfoMap[id];
@@ -80649,7 +81493,7 @@
*/
function substituteUnspecified(node) {
switch (node.kind) {
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return substituteShorthandPropertyAssignment(node);
}
return node;
@@ -80683,12 +81527,12 @@
*/
function substituteExpression(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return substituteExpressionIdentifier(node);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return substituteBinaryExpression(node);
- case 202 /* PrefixUnaryExpression */:
- case 203 /* PostfixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return substituteUnaryExpression(node);
}
return node;
@@ -80781,14 +81625,14 @@
&& !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) {
var exportedNames = getExports(node.operand);
if (exportedNames) {
- var expression = node.kind === 203 /* PostfixUnaryExpression */
+ var expression = node.kind === 204 /* PostfixUnaryExpression */
? ts.setTextRange(ts.createPrefix(node.operator, node.operand), node)
: node;
for (var _i = 0, exportedNames_5 = exportedNames; _i < exportedNames_5.length; _i++) {
var exportName = exportedNames_5[_i];
expression = createExportExpression(exportName, preventSubstitution(expression));
}
- if (node.kind === 203 /* PostfixUnaryExpression */) {
+ if (node.kind === 204 /* PostfixUnaryExpression */) {
expression = node.operator === 44 /* PlusPlusToken */
? ts.createSubtract(preventSubstitution(expression), ts.createLiteral(1))
: ts.createAdd(preventSubstitution(expression), ts.createLiteral(1));
@@ -80810,7 +81654,7 @@
|| resolver.getReferencedValueDeclaration(name);
if (valueDeclaration) {
var exportContainer = resolver.getReferencedExportContainer(name, /*prefixLocals*/ false);
- if (exportContainer && exportContainer.kind === 284 /* SourceFile */) {
+ if (exportContainer && exportContainer.kind === 285 /* SourceFile */) {
exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration));
}
exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]);
@@ -80849,8 +81693,8 @@
var previousOnSubstituteNode = context.onSubstituteNode;
context.onEmitNode = onEmitNode;
context.onSubstituteNode = onSubstituteNode;
- context.enableEmitNotification(284 /* SourceFile */);
- context.enableSubstitution(72 /* Identifier */);
+ context.enableEmitNotification(285 /* SourceFile */);
+ context.enableSubstitution(73 /* Identifier */);
var currentSourceFile;
return ts.chainBundle(transformSourceFile);
function transformSourceFile(node) {
@@ -80878,10 +81722,10 @@
}
function visitor(node) {
switch (node.kind) {
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
// Elide `import=` as it is not legal with --module ES6
return undefined;
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return visitExportAssignment(node);
}
return node;
@@ -80989,7 +81833,7 @@
ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1;
}
- else if (node.parent.kind === 240 /* ClassDeclaration */) {
+ else if (node.parent.kind === 241 /* ClassDeclaration */) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -81018,7 +81862,7 @@
ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_private_name_1;
}
- else if (node.parent.kind === 240 /* ClassDeclaration */) {
+ else if (node.parent.kind === 241 /* ClassDeclaration */) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -81065,7 +81909,7 @@
return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: " + ts.SyntaxKind[node.kind]);
}
function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
- if (node.kind === 237 /* VariableDeclaration */ || node.kind === 186 /* BindingElement */) {
+ if (node.kind === 238 /* VariableDeclaration */ || node.kind === 187 /* BindingElement */) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -81074,8 +81918,8 @@
}
// This check is to ensure we don't report error on constructor parameter property as that error would be reported during parameter emit
// The only exception here is if the constructor was marked as private. we are not emitting the constructor parameters at all.
- else if (node.kind === 154 /* PropertyDeclaration */ || node.kind === 189 /* PropertyAccessExpression */ || node.kind === 153 /* PropertySignature */ ||
- (node.kind === 151 /* Parameter */ && ts.hasModifier(node.parent, 8 /* Private */))) {
+ else if (node.kind === 155 /* PropertyDeclaration */ || node.kind === 190 /* PropertyAccessExpression */ || node.kind === 154 /* PropertySignature */ ||
+ (node.kind === 152 /* Parameter */ && ts.hasModifier(node.parent, 8 /* Private */))) {
// TODO(jfreeman): Deal with computed properties in error reporting.
if (ts.hasModifier(node, 32 /* Static */)) {
return symbolAccessibilityResult.errorModuleName ?
@@ -81084,7 +81928,7 @@
ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1;
}
- else if (node.parent.kind === 240 /* ClassDeclaration */ || node.kind === 151 /* Parameter */) {
+ else if (node.parent.kind === 241 /* ClassDeclaration */ || node.kind === 152 /* Parameter */) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -81109,7 +81953,7 @@
}
function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) {
var diagnosticMessage;
- if (node.kind === 159 /* SetAccessor */) {
+ if (node.kind === 160 /* SetAccessor */) {
// Getters can infer the return type from the returned expression, but setters cannot, so the
// "_from_external_module_1_but_cannot_be_named" case cannot occur.
if (ts.hasModifier(node, 32 /* Static */)) {
@@ -81148,26 +81992,26 @@
function getReturnTypeVisibilityError(symbolAccessibilityResult) {
var diagnosticMessage;
switch (node.kind) {
- case 161 /* ConstructSignature */:
+ case 162 /* ConstructSignature */:
// Interfaces cannot have return types that cannot be named
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0;
break;
- case 160 /* CallSignature */:
+ case 161 /* CallSignature */:
// Interfaces cannot have return types that cannot be named
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0;
break;
- case 162 /* IndexSignature */:
+ case 163 /* IndexSignature */:
// Interfaces cannot have return types that cannot be named
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0;
break;
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
if (ts.hasModifier(node, 32 /* Static */)) {
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
@@ -81175,7 +82019,7 @@
ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 :
ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0;
}
- else if (node.parent.kind === 240 /* ClassDeclaration */) {
+ else if (node.parent.kind === 241 /* ClassDeclaration */) {
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
@@ -81189,7 +82033,7 @@
ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0;
}
break;
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
@@ -81214,30 +82058,30 @@
}
function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
switch (node.parent.kind) {
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1;
- case 161 /* ConstructSignature */:
- case 166 /* ConstructorType */:
+ case 162 /* ConstructSignature */:
+ case 167 /* ConstructorType */:
// Interfaces cannot have parameter types that cannot be named
return symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;
- case 160 /* CallSignature */:
+ case 161 /* CallSignature */:
// Interfaces cannot have parameter types that cannot be named
return symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;
- case 162 /* IndexSignature */:
+ case 163 /* IndexSignature */:
// Interfaces cannot have parameter types that cannot be named
return symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1;
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
if (ts.hasModifier(node.parent, 32 /* Static */)) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
@@ -81245,7 +82089,7 @@
ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1;
}
- else if (node.parent.parent.kind === 240 /* ClassDeclaration */) {
+ else if (node.parent.parent.kind === 241 /* ClassDeclaration */) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -81258,8 +82102,8 @@
ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1;
}
- case 239 /* FunctionDeclaration */:
- case 165 /* FunctionType */:
+ case 240 /* FunctionDeclaration */:
+ case 166 /* FunctionType */:
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -81273,39 +82117,39 @@
// Type parameter constraints are named by user so we should always be able to name it
var diagnosticMessage;
switch (node.parent.kind) {
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1;
break;
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1;
break;
- case 181 /* MappedType */:
+ case 182 /* MappedType */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1;
break;
- case 166 /* ConstructorType */:
- case 161 /* ConstructSignature */:
+ case 167 /* ConstructorType */:
+ case 162 /* ConstructSignature */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;
break;
- case 160 /* CallSignature */:
+ case 161 /* CallSignature */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;
break;
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
if (ts.hasModifier(node.parent, 32 /* Static */)) {
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1;
}
- else if (node.parent.parent.kind === 240 /* ClassDeclaration */) {
+ else if (node.parent.parent.kind === 241 /* ClassDeclaration */) {
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1;
}
else {
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1;
}
break;
- case 165 /* FunctionType */:
- case 239 /* FunctionDeclaration */:
+ case 166 /* FunctionType */:
+ case 240 /* FunctionDeclaration */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1;
break;
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1;
break;
default:
@@ -81320,9 +82164,9 @@
function getHeritageClauseVisibilityError() {
var diagnosticMessage;
// Heritage clause is written by user so it can always be named
- if (node.parent.parent.kind === 240 /* ClassDeclaration */) {
+ if (node.parent.parent.kind === 241 /* ClassDeclaration */) {
// Class or Interface implemented/extended is inaccessible
- diagnosticMessage = ts.isHeritageClause(node.parent) && node.parent.token === 109 /* ImplementsKeyword */ ?
+ diagnosticMessage = ts.isHeritageClause(node.parent) && node.parent.token === 110 /* ImplementsKeyword */ ?
ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 :
ts.Diagnostics.extends_clause_of_exported_class_0_has_or_is_using_private_name_1;
}
@@ -81371,7 +82215,7 @@
}
function isInternalDeclaration(node, currentSourceFile) {
var parseTreeNode = ts.getParseTreeNode(node);
- if (parseTreeNode && parseTreeNode.kind === 151 /* Parameter */) {
+ if (parseTreeNode && parseTreeNode.kind === 152 /* Parameter */) {
var paramIdx = parseTreeNode.parent.parameters.indexOf(parseTreeNode);
var previousSibling = paramIdx > 0 ? parseTreeNode.parent.parameters[paramIdx - 1] : undefined;
var text = currentSourceFile.text;
@@ -81518,10 +82362,10 @@
}
}
function transformRoot(node) {
- if (node.kind === 284 /* SourceFile */ && (node.isDeclarationFile || ts.isSourceFileJS(node))) {
+ if (node.kind === 285 /* SourceFile */ && (node.isDeclarationFile || ts.isSourceFileJS(node))) {
return node;
}
- if (node.kind === 285 /* Bundle */) {
+ if (node.kind === 286 /* Bundle */) {
isBundledEmit = true;
refs = ts.createMap();
libs = ts.createMap();
@@ -81544,14 +82388,14 @@
resultHasExternalModuleIndicator = false; // unused in external module bundle emit (all external modules are within module blocks, therefore are known to be modules)
needsDeclare = false;
var statements_4 = ts.visitNodes(sourceFile.statements, visitDeclarationStatements);
- var newFile = ts.updateSourceFileNode(sourceFile, [ts.createModuleDeclaration([], [ts.createModifier(125 /* DeclareKeyword */)], ts.createLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), ts.createModuleBlock(ts.setTextRange(ts.createNodeArray(transformAndReplaceLatePaintedStatements(statements_4)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []);
+ var newFile = ts.updateSourceFileNode(sourceFile, [ts.createModuleDeclaration([], [ts.createModifier(126 /* DeclareKeyword */)], ts.createLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), ts.createModuleBlock(ts.setTextRange(ts.createNodeArray(transformAndReplaceLatePaintedStatements(statements_4)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []);
return newFile;
}
needsDeclare = true;
var updated = ts.visitNodes(sourceFile.statements, visitDeclarationStatements);
return ts.updateSourceFileNode(sourceFile, transformAndReplaceLatePaintedStatements(updated), /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []);
}), ts.mapDefined(node.prepends, function (prepend) {
- if (prepend.kind === 287 /* InputFiles */) {
+ if (prepend.kind === 288 /* InputFiles */) {
var sourceFile = ts.createUnparsedSourceFile(prepend, "dts", stripInternal);
hasNoDefaultLib_1 = hasNoDefaultLib_1 || !!sourceFile.hasNoDefaultLib;
collectReferences(sourceFile, refs);
@@ -81671,11 +82515,11 @@
return ret;
}
function filterBindingPatternInitializers(name) {
- if (name.kind === 72 /* Identifier */) {
+ if (name.kind === 73 /* Identifier */) {
return name;
}
else {
- if (name.kind === 185 /* ArrayBindingPattern */) {
+ if (name.kind === 186 /* ArrayBindingPattern */) {
return ts.updateArrayBindingPattern(name, ts.visitNodes(name.elements, visitBindingElement));
}
else {
@@ -81683,7 +82527,7 @@
}
}
function visitBindingElement(elem) {
- if (elem.kind === 210 /* OmittedExpression */) {
+ if (elem.kind === 211 /* OmittedExpression */) {
return elem;
}
return ts.updateBindingElement(elem, elem.dotDotDotToken, elem.propertyName, filterBindingPatternInitializers(elem.name), shouldPrintWithInitializer(elem) ? elem.initializer : undefined);
@@ -81721,19 +82565,19 @@
// Literal const declarations will have an initializer ensured rather than a type
return;
}
- var shouldUseResolverType = node.kind === 151 /* Parameter */ &&
+ var shouldUseResolverType = node.kind === 152 /* Parameter */ &&
(resolver.isRequiredInitializedParameter(node) ||
resolver.isOptionalUninitializedParameterProperty(node));
if (type && !shouldUseResolverType) {
return ts.visitNode(type, visitDeclarationSubtree);
}
if (!ts.getParseTreeNode(node)) {
- return type ? ts.visitNode(type, visitDeclarationSubtree) : ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ return type ? ts.visitNode(type, visitDeclarationSubtree) : ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
- if (node.kind === 159 /* SetAccessor */) {
+ if (node.kind === 160 /* SetAccessor */) {
// Set accessors with no associated type node (from it's param or get accessor return) are `any` since they are never contextually typed right now
// (The inferred type here will be void, but the old declaration emitter printed `any`, so this replicates that)
- return ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ return ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
errorNameNode = node.name;
var oldDiag;
@@ -81741,12 +82585,12 @@
oldDiag = getSymbolAccessibilityDiagnostic;
getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(node);
}
- if (node.kind === 237 /* VariableDeclaration */ || node.kind === 186 /* BindingElement */) {
+ if (node.kind === 238 /* VariableDeclaration */ || node.kind === 187 /* BindingElement */) {
return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker));
}
- if (node.kind === 151 /* Parameter */
- || node.kind === 154 /* PropertyDeclaration */
- || node.kind === 153 /* PropertySignature */) {
+ if (node.kind === 152 /* Parameter */
+ || node.kind === 155 /* PropertyDeclaration */
+ || node.kind === 154 /* PropertySignature */) {
if (!node.initializer)
return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType));
return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType) || resolver.createTypeOfExpression(node.initializer, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker));
@@ -81757,26 +82601,26 @@
if (!suppressNewDiagnosticContexts) {
getSymbolAccessibilityDiagnostic = oldDiag;
}
- return returnValue || ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ return returnValue || ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
}
function isDeclarationAndNotVisible(node) {
node = ts.getParseTreeNode(node);
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 240 /* ClassDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 243 /* EnumDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 244 /* EnumDeclaration */:
return !resolver.isDeclarationVisible(node);
// The following should be doing their own visibility checks based on filtering their members
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return !getBindingNameVisible(node);
- case 248 /* ImportEqualsDeclaration */:
- case 249 /* ImportDeclaration */:
- case 255 /* ExportDeclaration */:
- case 254 /* ExportAssignment */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 256 /* ExportDeclaration */:
+ case 255 /* ExportAssignment */:
return false;
}
return false;
@@ -81830,7 +82674,7 @@
function rewriteModuleSpecifier(parent, input) {
if (!input)
return undefined; // TODO: GH#18217
- resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 244 /* ModuleDeclaration */ && parent.kind !== 183 /* ImportType */);
+ resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 245 /* ModuleDeclaration */ && parent.kind !== 184 /* ImportType */);
if (ts.isStringLiteralLike(input)) {
if (isBundledEmit) {
var newName = ts.getExternalModuleNameFromDeclaration(context.getEmitHost(), resolver, parent);
@@ -81850,7 +82694,7 @@
function transformImportEqualsDeclaration(decl) {
if (!resolver.isDeclarationVisible(decl))
return;
- if (decl.moduleReference.kind === 259 /* ExternalModuleReference */) {
+ if (decl.moduleReference.kind === 260 /* ExternalModuleReference */) {
// Rewrite external module names if necessary
var specifier = ts.getExternalModuleImportEqualsDeclarationExpression(decl);
return ts.updateImportEqualsDeclaration(decl,
@@ -81877,7 +82721,7 @@
return visibleDefaultBinding && ts.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, ts.updateImportClause(decl.importClause, visibleDefaultBinding,
/*namedBindings*/ undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier));
}
- if (decl.importClause.namedBindings.kind === 251 /* NamespaceImport */) {
+ if (decl.importClause.namedBindings.kind === 252 /* NamespaceImport */) {
// Namespace import (optionally with visible default)
var namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : /*namedBindings*/ undefined;
return visibleDefaultBinding || namedBindings ? ts.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, ts.updateImportClause(decl.importClause, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier)) : undefined;
@@ -81985,68 +82829,68 @@
checkEntityNameVisibility(input.exprName, enclosingDeclaration);
}
var oldWithinObjectLiteralType = suppressNewDiagnosticContexts;
- var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 168 /* TypeLiteral */ || input.kind === 181 /* MappedType */) && input.parent.kind !== 242 /* TypeAliasDeclaration */);
+ var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 169 /* TypeLiteral */ || input.kind === 182 /* MappedType */) && input.parent.kind !== 243 /* TypeAliasDeclaration */);
if (shouldEnterSuppressNewDiagnosticsContextContext) {
// We stop making new diagnostic contexts within object literal types. Unless it's an object type on the RHS of a type alias declaration. Then we do.
suppressNewDiagnosticContexts = true;
}
if (isProcessedComponent(input)) {
switch (input.kind) {
- case 211 /* ExpressionWithTypeArguments */: {
+ case 212 /* ExpressionWithTypeArguments */: {
if ((ts.isEntityName(input.expression) || ts.isEntityNameExpression(input.expression))) {
checkEntityNameVisibility(input.expression, enclosingDeclaration);
}
var node = ts.visitEachChild(input, visitDeclarationSubtree, context);
return cleanup(ts.updateExpressionWithTypeArguments(node, ts.parenthesizeTypeParameters(node.typeArguments), node.expression));
}
- case 164 /* TypeReference */: {
+ case 165 /* TypeReference */: {
checkEntityNameVisibility(input.typeName, enclosingDeclaration);
var node = ts.visitEachChild(input, visitDeclarationSubtree, context);
return cleanup(ts.updateTypeReferenceNode(node, node.typeName, ts.parenthesizeTypeParameters(node.typeArguments)));
}
- case 161 /* ConstructSignature */:
+ case 162 /* ConstructSignature */:
return cleanup(ts.updateConstructSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type)));
- case 157 /* Constructor */: {
+ case 158 /* Constructor */: {
var isPrivate = ts.hasModifier(input, 8 /* Private */);
// A constructor declaration may not have a type annotation
- var ctor = ts.createSignatureDeclaration(157 /* Constructor */, isPrivate ? undefined : ensureTypeParams(input, input.typeParameters),
+ var ctor = ts.createSignatureDeclaration(158 /* Constructor */, isPrivate ? undefined : ensureTypeParams(input, input.typeParameters),
// TODO: GH#18217
isPrivate ? undefined : updateParamsList(input, input.parameters, 0 /* None */),
/*type*/ undefined);
ctor.modifiers = ts.createNodeArray(ensureModifiers(input));
return cleanup(ctor);
}
- case 156 /* MethodDeclaration */: {
- var sig = ts.createSignatureDeclaration(155 /* MethodSignature */, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type));
+ case 157 /* MethodDeclaration */: {
+ var sig = ts.createSignatureDeclaration(156 /* MethodSignature */, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type));
sig.name = input.name;
sig.modifiers = ts.createNodeArray(ensureModifiers(input));
sig.questionToken = input.questionToken;
return cleanup(sig);
}
- case 158 /* GetAccessor */: {
+ case 159 /* GetAccessor */: {
var newNode = ensureAccessor(input);
return cleanup(newNode);
}
- case 159 /* SetAccessor */: {
+ case 160 /* SetAccessor */: {
var newNode = ensureAccessor(input);
return cleanup(newNode);
}
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return cleanup(ts.updateProperty(input,
/*decorators*/ undefined, ensureModifiers(input), input.name, input.questionToken, !ts.hasModifier(input, 8 /* Private */) ? ensureType(input, input.type) : undefined, ensureNoInitializer(input)));
- case 153 /* PropertySignature */:
+ case 154 /* PropertySignature */:
return cleanup(ts.updatePropertySignature(input, ensureModifiers(input), input.name, input.questionToken, !ts.hasModifier(input, 8 /* Private */) ? ensureType(input, input.type) : undefined, ensureNoInitializer(input)));
- case 155 /* MethodSignature */: {
+ case 156 /* MethodSignature */: {
return cleanup(ts.updateMethodSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type), input.name, input.questionToken));
}
- case 160 /* CallSignature */: {
+ case 161 /* CallSignature */: {
return cleanup(ts.updateCallSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type)));
}
- case 162 /* IndexSignature */: {
+ case 163 /* IndexSignature */: {
return cleanup(ts.updateIndexSignature(input,
- /*decorators*/ undefined, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || ts.createKeywordTypeNode(120 /* AnyKeyword */)));
+ /*decorators*/ undefined, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || ts.createKeywordTypeNode(121 /* AnyKeyword */)));
}
- case 237 /* VariableDeclaration */: {
+ case 238 /* VariableDeclaration */: {
if (ts.isBindingPattern(input.name)) {
return recreateBindingPattern(input.name);
}
@@ -82054,13 +82898,13 @@
suppressNewDiagnosticContexts = true; // Variable declaration types also suppress new diagnostic contexts, provided the contexts wouldn't be made for binding pattern types
return cleanup(ts.updateVariableDeclaration(input, input.name, ensureType(input, input.type), ensureNoInitializer(input)));
}
- case 150 /* TypeParameter */: {
+ case 151 /* TypeParameter */: {
if (isPrivateMethodTypeParameter(input) && (input.default || input.constraint)) {
return cleanup(ts.updateTypeParameterDeclaration(input, input.name, /*constraint*/ undefined, /*defaultType*/ undefined));
}
return cleanup(ts.visitEachChild(input, visitDeclarationSubtree, context));
}
- case 175 /* ConditionalType */: {
+ case 176 /* ConditionalType */: {
// We have to process conditional types in a special way because for visibility purposes we need to push a new enclosingDeclaration
// just for the `infer` types in the true branch. It's an implicit declaration scope that only applies to _part_ of the type.
var checkType = ts.visitNode(input.checkType, visitDeclarationSubtree);
@@ -82072,13 +82916,13 @@
var falseType = ts.visitNode(input.falseType, visitDeclarationSubtree);
return cleanup(ts.updateConditionalTypeNode(input, checkType, extendsType, trueType, falseType));
}
- case 165 /* FunctionType */: {
+ case 166 /* FunctionType */: {
return cleanup(ts.updateFunctionTypeNode(input, ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree)));
}
- case 166 /* ConstructorType */: {
+ case 167 /* ConstructorType */: {
return cleanup(ts.updateConstructorTypeNode(input, ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree)));
}
- case 183 /* ImportType */: {
+ case 184 /* ImportType */: {
if (!ts.isLiteralImportTypeNode(input))
return cleanup(input);
return cleanup(ts.updateImportTypeNode(input, ts.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)), input.qualifier, ts.visitNodes(input.typeArguments, visitDeclarationSubtree, ts.isTypeNode), input.isTypeOf));
@@ -82107,7 +82951,7 @@
}
}
function isPrivateMethodTypeParameter(node) {
- return node.parent.kind === 156 /* MethodDeclaration */ && ts.hasModifier(node.parent, 8 /* Private */);
+ return node.parent.kind === 157 /* MethodDeclaration */ && ts.hasModifier(node.parent, 8 /* Private */);
}
function visitDeclarationStatements(input) {
if (!isPreservedDeclarationStatement(input)) {
@@ -82117,7 +82961,7 @@
if (shouldStripInternal(input))
return;
switch (input.kind) {
- case 255 /* ExportDeclaration */: {
+ case 256 /* ExportDeclaration */: {
if (ts.isSourceFile(input.parent)) {
resultHasExternalModuleIndicator = true;
resultHasScopeMarker = true;
@@ -82126,13 +82970,13 @@
// Rewrite external module names if necessary
return ts.updateExportDeclaration(input, /*decorators*/ undefined, input.modifiers, input.exportClause, rewriteModuleSpecifier(input, input.moduleSpecifier));
}
- case 254 /* ExportAssignment */: {
+ case 255 /* ExportAssignment */: {
// Always visible if the parent node isn't dropped for being not visible
if (ts.isSourceFile(input.parent)) {
resultHasExternalModuleIndicator = true;
resultHasScopeMarker = true;
}
- if (input.expression.kind === 72 /* Identifier */) {
+ if (input.expression.kind === 73 /* Identifier */) {
return input;
}
else {
@@ -82142,7 +82986,7 @@
errorNode: input
}); };
var varDecl = ts.createVariableDeclaration(newId, resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined);
- var statement = ts.createVariableStatement(needsDeclare ? [ts.createModifier(125 /* DeclareKeyword */)] : [], ts.createVariableDeclarationList([varDecl], 2 /* Const */));
+ var statement = ts.createVariableStatement(needsDeclare ? [ts.createModifier(126 /* DeclareKeyword */)] : [], ts.createVariableDeclarationList([varDecl], 2 /* Const */));
return [statement, ts.updateExportAssignment(input, input.decorators, input.modifiers, newId)];
}
}
@@ -82156,10 +83000,10 @@
if (shouldStripInternal(input))
return;
switch (input.kind) {
- case 248 /* ImportEqualsDeclaration */: {
+ case 249 /* ImportEqualsDeclaration */: {
return transformImportEqualsDeclaration(input);
}
- case 249 /* ImportDeclaration */: {
+ case 250 /* ImportDeclaration */: {
return transformImportDeclaration(input);
}
}
@@ -82180,14 +83024,14 @@
}
var previousNeedsDeclare = needsDeclare;
switch (input.kind) {
- case 242 /* TypeAliasDeclaration */: // Type aliases get `declare`d if need be (for legacy support), but that's all
+ case 243 /* TypeAliasDeclaration */: // Type aliases get `declare`d if need be (for legacy support), but that's all
return cleanup(ts.updateTypeAliasDeclaration(input,
/*decorators*/ undefined, ensureModifiers(input, isPrivate), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode)));
- case 241 /* InterfaceDeclaration */: {
+ case 242 /* InterfaceDeclaration */: {
return cleanup(ts.updateInterfaceDeclaration(input,
/*decorators*/ undefined, ensureModifiers(input, isPrivate), input.name, ensureTypeParams(input, input.typeParameters), transformHeritageClauses(input.heritageClauses), ts.visitNodes(input.members, visitDeclarationSubtree)));
}
- case 239 /* FunctionDeclaration */: {
+ case 240 /* FunctionDeclaration */: {
// Generators lose their generator-ness, excepting their return type
var clean = cleanup(ts.updateFunctionDeclaration(input,
/*decorators*/ undefined, ensureModifiers(input, isPrivate),
@@ -82205,16 +83049,32 @@
return ts.createVariableStatement(/*modifiers*/ undefined, ts.createVariableDeclarationList([varDecl]));
});
var namespaceDecl = ts.createModuleDeclaration(/*decorators*/ undefined, ensureModifiers(input, isPrivate), input.name, ts.createModuleBlock(declarations), 16 /* Namespace */);
+ if (!ts.hasModifier(clean, 513 /* ExportDefault */)) {
return [clean, namespaceDecl];
}
+ var modifiers = ts.createModifiersFromModifierFlags((ts.getModifierFlags(clean) & ~513 /* ExportDefault */) | 2 /* Ambient */);
+ var cleanDeclaration = ts.updateFunctionDeclaration(clean,
+ /*decorators*/ undefined, modifiers,
+ /*asteriskToken*/ undefined, clean.name, clean.typeParameters, clean.parameters, clean.type,
+ /*body*/ undefined);
+ var namespaceDeclaration = ts.updateModuleDeclaration(namespaceDecl,
+ /*decorators*/ undefined, modifiers, namespaceDecl.name, namespaceDecl.body);
+ var exportDefaultDeclaration = ts.createExportAssignment(
+ /*decorators*/ undefined,
+ /*modifiers*/ undefined,
+ /*isExportEquals*/ false, namespaceDecl.name);
+ resultHasExternalModuleIndicator = true;
+ resultHasScopeMarker = true;
+ return [cleanDeclaration, namespaceDeclaration, exportDefaultDeclaration];
+ }
else {
return clean;
}
}
- case 244 /* ModuleDeclaration */: {
+ case 245 /* ModuleDeclaration */: {
needsDeclare = false;
var inner = input.body;
- if (inner && inner.kind === 245 /* ModuleBlock */) {
+ if (inner && inner.kind === 246 /* ModuleBlock */) {
var statements = ts.visitNodes(inner.statements, visitDeclarationStatements);
var body = ts.updateModuleBlock(inner, transformAndReplaceLatePaintedStatements(statements));
needsDeclare = previousNeedsDeclare;
@@ -82235,7 +83095,7 @@
/*decorators*/ undefined, mods, input.name, body));
}
}
- case 240 /* ClassDeclaration */: {
+ case 241 /* ClassDeclaration */: {
var modifiers = ts.createNodeArray(ensureModifiers(input, isPrivate));
var typeParameters = ensureTypeParams(input, input.typeParameters);
var ctor = ts.getFirstConstructorWithBody(input);
@@ -82246,7 +83106,7 @@
if (!ts.hasModifier(param, 92 /* ParameterPropertyModifier */) || shouldStripInternal(param))
return;
getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(param);
- if (param.name.kind === 72 /* Identifier */) {
+ if (param.name.kind === 73 /* Identifier */) {
return preserveJsDoc(ts.createProperty(
/*decorators*/ undefined, ensureModifiers(param), param.name, param.questionToken, ensureType(param, param.type), ensureNoInitializer(param)), param);
}
@@ -82276,7 +83136,7 @@
}
var members = ts.createNodeArray(ts.concatenate(parameterProperties, ts.visitNodes(input.members, visitDeclarationSubtree)));
var extendsClause_1 = ts.getEffectiveBaseTypeNode(input);
- if (extendsClause_1 && !ts.isEntityNameExpression(extendsClause_1.expression) && extendsClause_1.expression.kind !== 96 /* NullKeyword */) {
+ if (extendsClause_1 && !ts.isEntityNameExpression(extendsClause_1.expression) && extendsClause_1.expression.kind !== 97 /* NullKeyword */) {
// We must add a temporary declaration for the extends clause expression
var oldId = input.name ? ts.unescapeLeadingUnderscores(input.name.escapedText) : "default";
var newId_1 = ts.createOptimisticUniqueName(oldId + "_base");
@@ -82286,16 +83146,16 @@
typeName: input.name
}); };
var varDecl = ts.createVariableDeclaration(newId_1, resolver.createTypeOfExpression(extendsClause_1.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined);
- var statement = ts.createVariableStatement(needsDeclare ? [ts.createModifier(125 /* DeclareKeyword */)] : [], ts.createVariableDeclarationList([varDecl], 2 /* Const */));
+ var statement = ts.createVariableStatement(needsDeclare ? [ts.createModifier(126 /* DeclareKeyword */)] : [], ts.createVariableDeclarationList([varDecl], 2 /* Const */));
var heritageClauses = ts.createNodeArray(ts.map(input.heritageClauses, function (clause) {
- if (clause.token === 86 /* ExtendsKeyword */) {
+ if (clause.token === 87 /* ExtendsKeyword */) {
var oldDiag_2 = getSymbolAccessibilityDiagnostic;
getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(clause.types[0]);
var newClause = ts.updateHeritageClause(clause, ts.map(clause.types, function (t) { return ts.updateExpressionWithTypeArguments(t, ts.visitNodes(t.typeArguments, visitDeclarationSubtree), newId_1); }));
getSymbolAccessibilityDiagnostic = oldDiag_2;
return newClause;
}
- return ts.updateHeritageClause(clause, ts.visitNodes(ts.createNodeArray(ts.filter(clause.types, function (t) { return ts.isEntityNameExpression(t.expression) || t.expression.kind === 96 /* NullKeyword */; })), visitDeclarationSubtree));
+ return ts.updateHeritageClause(clause, ts.visitNodes(ts.createNodeArray(ts.filter(clause.types, function (t) { return ts.isEntityNameExpression(t.expression) || t.expression.kind === 97 /* NullKeyword */; })), visitDeclarationSubtree));
}));
return [statement, cleanup(ts.updateClassDeclaration(input,
/*decorators*/ undefined, modifiers, input.name, typeParameters, heritageClauses, members))]; // TODO: GH#18217
@@ -82306,10 +83166,10 @@
/*decorators*/ undefined, modifiers, input.name, typeParameters, heritageClauses, members));
}
}
- case 219 /* VariableStatement */: {
+ case 220 /* VariableStatement */: {
return cleanup(transformVariableStatement(input, isPrivate));
}
- case 243 /* EnumDeclaration */: {
+ case 244 /* EnumDeclaration */: {
return cleanup(ts.updateEnumDeclaration(input, /*decorators*/ undefined, ts.createNodeArray(ensureModifiers(input, isPrivate)), input.name, ts.createNodeArray(ts.mapDefined(input.members, function (m) {
if (shouldStripInternal(m))
return;
@@ -82328,7 +83188,7 @@
if (canProdiceDiagnostic) {
getSymbolAccessibilityDiagnostic = oldDiag;
}
- if (input.kind === 244 /* ModuleDeclaration */) {
+ if (input.kind === 245 /* ModuleDeclaration */) {
needsDeclare = previousNeedsDeclare;
}
if (node === input) {
@@ -82349,7 +83209,7 @@
return ts.flatten(ts.mapDefined(d.elements, function (e) { return recreateBindingElement(e); }));
}
function recreateBindingElement(e) {
- if (e.kind === 210 /* OmittedExpression */) {
+ if (e.kind === 211 /* OmittedExpression */) {
return;
}
if (e.name) {
@@ -82402,7 +83262,7 @@
function ensureModifierFlags(node, privateDeclaration) {
var mask = 3071 /* All */ ^ (4 /* Public */ | 256 /* Async */); // No async modifiers in declaration files
var additions = (needsDeclare && !isAlwaysType(node)) ? 2 /* Ambient */ : 0 /* None */;
- var parentIsFile = node.parent.kind === 284 /* SourceFile */;
+ var parentIsFile = node.parent.kind === 285 /* SourceFile */;
if (!parentIsFile || (isBundledEmit && parentIsFile && ts.isExternalModule(node.parent))) {
mask ^= ((privateDeclaration || (isBundledEmit && parentIsFile) || hasScopeMarker(node.parent) ? 0 : 1 /* Export */) | 2 /* Ambient */);
additions = 0 /* None */;
@@ -82423,7 +83283,7 @@
var prop = ts.createProperty(/*decorators*/ undefined, maskModifiers(node, /*mask*/ undefined, (!accessors.setAccessor) ? 64 /* Readonly */ : 0 /* None */), node.name, node.questionToken, ensureType(node, accessorType), /*initializer*/ undefined);
var leadingsSyntheticCommentRanges = accessors.secondAccessor && ts.getLeadingCommentRangesOfNode(accessors.secondAccessor, currentSourceFile);
if (leadingsSyntheticCommentRanges) {
- var _loop_10 = function (range) {
+ var _loop_13 = function (range) {
if (range.kind === 3 /* MultiLineCommentTrivia */) {
var text = currentSourceFile.text.slice(range.pos + 2, range.end - 2);
var lines = text.split(/\r\n?|\n/g);
@@ -82437,20 +83297,20 @@
};
for (var _i = 0, leadingsSyntheticCommentRanges_1 = leadingsSyntheticCommentRanges; _i < leadingsSyntheticCommentRanges_1.length; _i++) {
var range = leadingsSyntheticCommentRanges_1[_i];
- _loop_10(range);
+ _loop_13(range);
}
}
return prop;
}
function transformHeritageClauses(nodes) {
return ts.createNodeArray(ts.filter(ts.map(nodes, function (clause) { return ts.updateHeritageClause(clause, ts.visitNodes(ts.createNodeArray(ts.filter(clause.types, function (t) {
- return ts.isEntityNameExpression(t.expression) || (clause.token === 86 /* ExtendsKeyword */ && t.expression.kind === 96 /* NullKeyword */);
+ return ts.isEntityNameExpression(t.expression) || (clause.token === 87 /* ExtendsKeyword */ && t.expression.kind === 97 /* NullKeyword */);
})), visitDeclarationSubtree)); }), function (clause) { return clause.types && !!clause.types.length; }));
}
}
ts.transformDeclarations = transformDeclarations;
function isAlwaysType(node) {
- if (node.kind === 241 /* InterfaceDeclaration */) {
+ if (node.kind === 242 /* InterfaceDeclaration */) {
return true;
}
return false;
@@ -82475,7 +83335,7 @@
}
function getTypeAnnotationFromAccessor(accessor) {
if (accessor) {
- return accessor.kind === 158 /* GetAccessor */
+ return accessor.kind === 159 /* GetAccessor */
? accessor.type // Getter - return type
: accessor.parameters.length > 0
? accessor.parameters[0].type // Setter parameter type
@@ -82484,52 +83344,52 @@
}
function canHaveLiteralInitializer(node) {
switch (node.kind) {
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
return !ts.hasModifier(node, 8 /* Private */);
- case 151 /* Parameter */:
- case 237 /* VariableDeclaration */:
+ case 152 /* Parameter */:
+ case 238 /* VariableDeclaration */:
return true;
}
return false;
}
function isPreservedDeclarationStatement(node) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 240 /* ClassDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 243 /* EnumDeclaration */:
- case 219 /* VariableStatement */:
- case 249 /* ImportDeclaration */:
- case 255 /* ExportDeclaration */:
- case 254 /* ExportAssignment */:
+ case 240 /* FunctionDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 220 /* VariableStatement */:
+ case 250 /* ImportDeclaration */:
+ case 256 /* ExportDeclaration */:
+ case 255 /* ExportAssignment */:
return true;
}
return false;
}
function isProcessedComponent(node) {
switch (node.kind) {
- case 161 /* ConstructSignature */:
- case 157 /* Constructor */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 155 /* MethodSignature */:
- case 160 /* CallSignature */:
- case 162 /* IndexSignature */:
- case 237 /* VariableDeclaration */:
- case 150 /* TypeParameter */:
- case 211 /* ExpressionWithTypeArguments */:
- case 164 /* TypeReference */:
- case 175 /* ConditionalType */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 183 /* ImportType */:
+ case 162 /* ConstructSignature */:
+ case 158 /* Constructor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 156 /* MethodSignature */:
+ case 161 /* CallSignature */:
+ case 163 /* IndexSignature */:
+ case 238 /* VariableDeclaration */:
+ case 151 /* TypeParameter */:
+ case 212 /* ExpressionWithTypeArguments */:
+ case 165 /* TypeReference */:
+ case 176 /* ConditionalType */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 184 /* ImportType */:
return true;
}
return false;
@@ -82561,17 +83421,27 @@
SyntaxKindFeatureFlags[SyntaxKindFeatureFlags["Substitution"] = 1] = "Substitution";
SyntaxKindFeatureFlags[SyntaxKindFeatureFlags["EmitNotifications"] = 2] = "EmitNotifications";
})(SyntaxKindFeatureFlags || (SyntaxKindFeatureFlags = {}));
- function getTransformers(compilerOptions, customTransformers) {
+ ts.noTransformers = { scriptTransformers: ts.emptyArray, declarationTransformers: ts.emptyArray };
+ function getTransformers(compilerOptions, customTransformers, emitOnlyDtsFiles) {
+ return {
+ scriptTransformers: getScriptTransformers(compilerOptions, customTransformers, emitOnlyDtsFiles),
+ declarationTransformers: getDeclarationTransformers(customTransformers),
+ };
+ }
+ ts.getTransformers = getTransformers;
+ function getScriptTransformers(compilerOptions, customTransformers, emitOnlyDtsFiles) {
+ if (emitOnlyDtsFiles)
+ return ts.emptyArray;
var jsx = compilerOptions.jsx;
var languageVersion = ts.getEmitScriptTarget(compilerOptions);
var moduleKind = ts.getEmitModuleKind(compilerOptions);
var transformers = [];
- ts.addRange(transformers, customTransformers && customTransformers.before);
+ ts.addRange(transformers, customTransformers && ts.map(customTransformers.before, wrapScriptTransformerFactory));
transformers.push(ts.transformTypeScript);
if (jsx === 2 /* React */) {
transformers.push(ts.transformJsx);
}
- if (languageVersion < 7 /* ESNext */) {
+ if (languageVersion < 8 /* ESNext */) {
transformers.push(ts.transformESNext);
}
if (languageVersion < 6 /* ES2019 */) {
@@ -82596,10 +83466,38 @@
if (languageVersion < 1 /* ES5 */) {
transformers.push(ts.transformES5);
}
- ts.addRange(transformers, customTransformers && customTransformers.after);
+ ts.addRange(transformers, customTransformers && ts.map(customTransformers.after, wrapScriptTransformerFactory));
return transformers;
}
- ts.getTransformers = getTransformers;
+ function getDeclarationTransformers(customTransformers) {
+ var transformers = [];
+ transformers.push(ts.transformDeclarations);
+ ts.addRange(transformers, customTransformers && ts.map(customTransformers.afterDeclarations, wrapDeclarationTransformerFactory));
+ return transformers;
+ }
+ /**
+ * Wrap a custom script or declaration transformer object in a `Transformer` callback with fallback support for transforming bundles.
+ */
+ function wrapCustomTransformer(transformer) {
+ return function (node) { return ts.isBundle(node) ? transformer.transformBundle(node) : transformer.transformSourceFile(node); };
+ }
+ /**
+ * Wrap a transformer factory that may return a custom script or declaration transformer object.
+ */
+ function wrapCustomTransformerFactory(transformer, handleDefault) {
+ return function (context) {
+ var customTransformer = transformer(context);
+ return typeof customTransformer === "function"
+ ? handleDefault(customTransformer)
+ : wrapCustomTransformer(customTransformer);
+ };
+ }
+ function wrapScriptTransformerFactory(transformer) {
+ return wrapCustomTransformerFactory(transformer, ts.chainBundle);
+ }
+ function wrapDeclarationTransformerFactory(transformer) {
+ return wrapCustomTransformerFactory(transformer, ts.identity);
+ }
function noEmitSubstitution(_hint, node) {
return node;
}
@@ -82619,7 +83517,7 @@
* @param allowDtsFiles A value indicating whether to allow the transformation of .d.ts files.
*/
function transformNodes(resolver, host, options, nodes, transformers, allowDtsFiles) {
- var enabledSyntaxKindFeatures = new Array(317 /* Count */);
+ var enabledSyntaxKindFeatures = new Array(318 /* Count */);
var lexicalEnvironmentVariableDeclarations;
var lexicalEnvironmentFunctionDeclarations;
var lexicalEnvironmentVariableDeclarationsStack = [];
@@ -82672,7 +83570,14 @@
}
ts.performance.mark("beforeTransform");
// Chain together and initialize each transformer.
- var transformation = ts.chain.apply(void 0, transformers)(context);
+ var transformersWithContext = transformers.map(function (t) { return t(context); });
+ var transformation = function (node) {
+ for (var _i = 0, transformersWithContext_1 = transformersWithContext; _i < transformersWithContext_1.length; _i++) {
+ var transform = transformersWithContext_1[_i];
+ node = transform(node);
+ }
+ return node;
+ };
// prevent modification of transformation hooks.
state = 1 /* Initialized */;
// Transform each node.
@@ -82824,6 +83729,7 @@
if (lexicalEnvironmentVariableDeclarations) {
var statement = ts.createVariableStatement(
/*modifiers*/ undefined, ts.createVariableDeclarationList(lexicalEnvironmentVariableDeclarations));
+ ts.setEmitFlags(statement, 1048576 /* CustomPrologue */);
if (!statements) {
statements = [statement];
}
@@ -82931,7 +83837,7 @@
/*@internal*/
function getOutputPathForBuildInfo(options) {
var configFile = options.configFilePath;
- if (!configFile || !ts.isIncrementalCompilation(options))
+ if (!ts.isIncrementalCompilation(options))
return undefined;
if (options.tsBuildInfoFile)
return options.tsBuildInfoFile;
@@ -82941,6 +83847,8 @@
buildInfoExtensionLess = ts.removeFileExtension(outPath);
}
else {
+ if (!configFile)
+ return undefined;
var configFileExtensionLess = ts.removeFileExtension(configFile);
buildInfoExtensionLess = options.outDir ?
options.rootDir ?
@@ -82965,7 +83873,7 @@
/*@internal*/
function getOutputPathsFor(sourceFile, host, forceDtsPaths) {
var options = host.getCompilerOptions();
- if (sourceFile.kind === 285 /* Bundle */) {
+ if (sourceFile.kind === 286 /* Bundle */) {
return getOutputPathsForBundle(options, forceDtsPaths);
}
else {
@@ -83092,14 +84000,15 @@
ts.getFirstProjectOutput = getFirstProjectOutput;
/*@internal*/
// targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature
- function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles, transformers, declarationTransformers, onlyBuildInfo) {
+ function emitFiles(resolver, host, targetSourceFile, _a, emitOnlyDtsFiles, onlyBuildInfo) {
+ var scriptTransformers = _a.scriptTransformers, declarationTransformers = _a.declarationTransformers;
var compilerOptions = host.getCompilerOptions();
var sourceMapDataList = (compilerOptions.sourceMap || compilerOptions.inlineSourceMap || ts.getAreDeclarationMapsEnabled(compilerOptions)) ? [] : undefined;
var emittedFilesList = compilerOptions.listEmittedFiles ? [] : undefined;
var emitterDiagnostics = ts.createDiagnosticCollection();
var newLine = ts.getNewLineCharacter(compilerOptions, function () { return host.getNewLine(); });
var writer = ts.createTextWriter(newLine);
- var _a = ts.performance.createTimer("printTime", "beforePrint", "afterPrint"), enter = _a.enter, exit = _a.exit;
+ var _b = ts.performance.createTimer("printTime", "beforePrint", "afterPrint"), enter = _b.enter, exit = _b.exit;
var bundleBuildInfo;
var emitSkipped = false;
var exportedModulesFromDeclarationEmit;
@@ -83168,7 +84077,7 @@
return;
}
// Transform the source files
- var transform = ts.transformNodes(resolver, host, compilerOptions, [sourceFileOrBundle], transformers, /*allowDtsFiles*/ false);
+ var transform = ts.transformNodes(resolver, host, compilerOptions, [sourceFileOrBundle], scriptTransformers, /*allowDtsFiles*/ false);
var printerOptions = {
removeComments: compilerOptions.removeComments,
newLine: compilerOptions.newLine,
@@ -83209,7 +84118,7 @@
// Do that here when emitting only dts files
nonJsFiles.forEach(collectLinkedAliases);
}
- var declarationTransform = ts.transformNodes(resolver, host, compilerOptions, inputListOrBundle, ts.concatenate([ts.transformDeclarations], declarationTransformers), /*allowDtsFiles*/ false);
+ var declarationTransform = ts.transformNodes(resolver, host, compilerOptions, inputListOrBundle, declarationTransformers, /*allowDtsFiles*/ false);
if (ts.length(declarationTransform.diagnostics)) {
for (var _a = 0, _b = declarationTransform.diagnostics; _a < _b.length; _a++) {
var diagnostic = _b[_a];
@@ -83246,7 +84155,7 @@
mapRoot: compilerOptions.mapRoot,
extendedDiagnostics: compilerOptions.extendedDiagnostics,
});
- if (emitOnlyDtsFiles && declarationTransform.transformed[0].kind === 284 /* SourceFile */) {
+ if (emitOnlyDtsFiles && declarationTransform.transformed[0].kind === 285 /* SourceFile */) {
var sourceFile = declarationTransform.transformed[0];
exportedModulesFromDeclarationEmit = sourceFile.exportedModulesFromDeclarationEmit;
}
@@ -83257,7 +84166,7 @@
}
function collectLinkedAliases(node) {
if (ts.isExportAssignment(node)) {
- if (node.expression.kind === 72 /* Identifier */) {
+ if (node.expression.kind === 73 /* Identifier */) {
resolver.collectLinkedAliases(node.expression, /*setVisibility*/ true);
}
return;
@@ -83269,8 +84178,8 @@
ts.forEachChild(node, collectLinkedAliases);
}
function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, sourceFileOrBundle, printer, mapOptions) {
- var bundle = sourceFileOrBundle.kind === 285 /* Bundle */ ? sourceFileOrBundle : undefined;
- var sourceFile = sourceFileOrBundle.kind === 284 /* SourceFile */ ? sourceFileOrBundle : undefined;
+ var bundle = sourceFileOrBundle.kind === 286 /* Bundle */ ? sourceFileOrBundle : undefined;
+ var sourceFile = sourceFileOrBundle.kind === 285 /* SourceFile */ ? sourceFileOrBundle : undefined;
var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile];
var sourceMapGenerator;
if (shouldEmitSourceMaps(mapOptions, sourceFileOrBundle)) {
@@ -83311,7 +84220,7 @@
}
function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) {
return (mapOptions.sourceMap || mapOptions.inlineSourceMap)
- && (sourceFileOrBundle.kind !== 284 /* SourceFile */ || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Json */));
+ && (sourceFileOrBundle.kind !== 285 /* SourceFile */ || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Json */));
}
function getSourceRoot(mapOptions) {
// Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the
@@ -83421,7 +84330,7 @@
};
function createSourceFilesFromBundleBuildInfo(bundle) {
var sourceFiles = bundle.sourceFiles.map(function (fileName) {
- var sourceFile = ts.createNode(284 /* SourceFile */, 0, 0);
+ var sourceFile = ts.createNode(285 /* SourceFile */, 0, 0);
sourceFile.fileName = fileName;
sourceFile.text = "";
sourceFile.statements = ts.createNodeArray();
@@ -83433,7 +84342,7 @@
sourceFile.text = prologueInfo.text;
sourceFile.end = prologueInfo.text.length;
sourceFile.statements = ts.createNodeArray(prologueInfo.directives.map(function (directive) {
- var statement = ts.createNode(221 /* ExpressionStatement */, directive.pos, directive.end);
+ var statement = ts.createNode(222 /* ExpressionStatement */, directive.pos, directive.end);
statement.expression = ts.createNode(10 /* StringLiteral */, directive.expression.pos, directive.expression.end);
statement.expression.text = directive.expression.text;
return statement;
@@ -83525,7 +84434,7 @@
useCaseSensitiveFileNames: function () { return host.useCaseSensitiveFileNames(); },
getProgramBuildInfo: ts.returnUndefined
};
- emitFiles(ts.notImplementedResolver, emitHost, /*targetSourceFile*/ undefined, /*emitOnlyDtsFiles*/ false, ts.getTransformers(config.options));
+ emitFiles(ts.notImplementedResolver, emitHost, /*targetSourceFile*/ undefined, ts.getTransformers(config.options), /*emitOnlyDtsFiles*/ false);
return outputFiles;
}
ts.emitUsingBuildInfo = emitUsingBuildInfo;
@@ -83602,9 +84511,9 @@
break;
}
switch (node.kind) {
- case 284 /* SourceFile */: return printFile(node);
- case 285 /* Bundle */: return printBundle(node);
- case 286 /* UnparsedSource */: return printUnparsedSource(node);
+ case 285 /* SourceFile */: return printFile(node);
+ case 286 /* Bundle */: return printBundle(node);
+ case 287 /* UnparsedSource */: return printUnparsedSource(node);
}
writeNode(hint, node, sourceFile, beginPrint());
return endPrint();
@@ -83834,12 +84743,12 @@
}
// falls through
case 2 /* Comments */:
- if (!commentsDisabled && node.kind !== 284 /* SourceFile */) {
+ if (!commentsDisabled && node.kind !== 285 /* SourceFile */) {
return pipelineEmitWithComments;
}
// falls through
case 3 /* SourceMaps */:
- if (!sourceMapsDisabled && node.kind !== 284 /* SourceFile */ && !ts.isInJsonFile(node)) {
+ if (!sourceMapsDisabled && node.kind !== 285 /* SourceFile */ && !ts.isInJsonFile(node)) {
return pipelineEmitWithSourceMap;
}
// falls through
@@ -83876,272 +84785,272 @@
case 16 /* TemplateMiddle */:
case 17 /* TemplateTail */:
return emitLiteral(node);
- case 286 /* UnparsedSource */:
- case 280 /* UnparsedPrepend */:
+ case 287 /* UnparsedSource */:
+ case 281 /* UnparsedPrepend */:
return emitUnparsedSourceOrPrepend(node);
- case 279 /* UnparsedPrologue */:
+ case 280 /* UnparsedPrologue */:
return writeUnparsedNode(node);
- case 281 /* UnparsedText */:
- case 282 /* UnparsedInternalText */:
+ case 282 /* UnparsedText */:
+ case 283 /* UnparsedInternalText */:
return emitUnparsedTextLike(node);
- case 283 /* UnparsedSyntheticReference */:
+ case 284 /* UnparsedSyntheticReference */:
return emitUnparsedSyntheticReference(node);
// Identifiers
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return emitIdentifier(node);
// Parse tree nodes
// Names
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
return emitQualifiedName(node);
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
return emitComputedPropertyName(node);
// Signature elements
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
return emitTypeParameter(node);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return emitParameter(node);
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
return emitDecorator(node);
// Type members
- case 153 /* PropertySignature */:
+ case 154 /* PropertySignature */:
return emitPropertySignature(node);
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return emitPropertyDeclaration(node);
- case 155 /* MethodSignature */:
+ case 156 /* MethodSignature */:
return emitMethodSignature(node);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return emitMethodDeclaration(node);
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return emitConstructor(node);
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return emitAccessorDeclaration(node);
- case 160 /* CallSignature */:
+ case 161 /* CallSignature */:
return emitCallSignature(node);
- case 161 /* ConstructSignature */:
+ case 162 /* ConstructSignature */:
return emitConstructSignature(node);
- case 162 /* IndexSignature */:
+ case 163 /* IndexSignature */:
return emitIndexSignature(node);
// Types
- case 163 /* TypePredicate */:
+ case 164 /* TypePredicate */:
return emitTypePredicate(node);
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return emitTypeReference(node);
- case 165 /* FunctionType */:
+ case 166 /* FunctionType */:
return emitFunctionType(node);
- case 294 /* JSDocFunctionType */:
+ case 295 /* JSDocFunctionType */:
return emitJSDocFunctionType(node);
- case 166 /* ConstructorType */:
+ case 167 /* ConstructorType */:
return emitConstructorType(node);
- case 167 /* TypeQuery */:
+ case 168 /* TypeQuery */:
return emitTypeQuery(node);
- case 168 /* TypeLiteral */:
+ case 169 /* TypeLiteral */:
return emitTypeLiteral(node);
- case 169 /* ArrayType */:
+ case 170 /* ArrayType */:
return emitArrayType(node);
- case 170 /* TupleType */:
+ case 171 /* TupleType */:
return emitTupleType(node);
- case 171 /* OptionalType */:
+ case 172 /* OptionalType */:
return emitOptionalType(node);
- case 173 /* UnionType */:
+ case 174 /* UnionType */:
return emitUnionType(node);
- case 174 /* IntersectionType */:
+ case 175 /* IntersectionType */:
return emitIntersectionType(node);
- case 175 /* ConditionalType */:
+ case 176 /* ConditionalType */:
return emitConditionalType(node);
- case 176 /* InferType */:
+ case 177 /* InferType */:
return emitInferType(node);
- case 177 /* ParenthesizedType */:
+ case 178 /* ParenthesizedType */:
return emitParenthesizedType(node);
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return emitExpressionWithTypeArguments(node);
- case 178 /* ThisType */:
+ case 179 /* ThisType */:
return emitThisType();
- case 179 /* TypeOperator */:
+ case 180 /* TypeOperator */:
return emitTypeOperator(node);
- case 180 /* IndexedAccessType */:
+ case 181 /* IndexedAccessType */:
return emitIndexedAccessType(node);
- case 181 /* MappedType */:
+ case 182 /* MappedType */:
return emitMappedType(node);
- case 182 /* LiteralType */:
+ case 183 /* LiteralType */:
return emitLiteralType(node);
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return emitImportTypeNode(node);
- case 289 /* JSDocAllType */:
+ case 290 /* JSDocAllType */:
writePunctuation("*");
return;
- case 290 /* JSDocUnknownType */:
+ case 291 /* JSDocUnknownType */:
writePunctuation("?");
return;
- case 291 /* JSDocNullableType */:
+ case 292 /* JSDocNullableType */:
return emitJSDocNullableType(node);
- case 292 /* JSDocNonNullableType */:
+ case 293 /* JSDocNonNullableType */:
return emitJSDocNonNullableType(node);
- case 293 /* JSDocOptionalType */:
+ case 294 /* JSDocOptionalType */:
return emitJSDocOptionalType(node);
- case 172 /* RestType */:
- case 295 /* JSDocVariadicType */:
+ case 173 /* RestType */:
+ case 296 /* JSDocVariadicType */:
return emitRestOrJSDocVariadicType(node);
// Binding patterns
- case 184 /* ObjectBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
return emitObjectBindingPattern(node);
- case 185 /* ArrayBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
return emitArrayBindingPattern(node);
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return emitBindingElement(node);
// Misc
- case 216 /* TemplateSpan */:
+ case 217 /* TemplateSpan */:
return emitTemplateSpan(node);
- case 217 /* SemicolonClassElement */:
+ case 218 /* SemicolonClassElement */:
return emitSemicolonClassElement();
// Statements
- case 218 /* Block */:
+ case 219 /* Block */:
return emitBlock(node);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return emitVariableStatement(node);
- case 220 /* EmptyStatement */:
+ case 221 /* EmptyStatement */:
return emitEmptyStatement(/*isEmbeddedStatement*/ false);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return emitExpressionStatement(node);
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
return emitIfStatement(node);
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
return emitDoStatement(node);
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
return emitWhileStatement(node);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return emitForStatement(node);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return emitForInStatement(node);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return emitForOfStatement(node);
- case 228 /* ContinueStatement */:
+ case 229 /* ContinueStatement */:
return emitContinueStatement(node);
- case 229 /* BreakStatement */:
+ case 230 /* BreakStatement */:
return emitBreakStatement(node);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return emitReturnStatement(node);
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
return emitWithStatement(node);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return emitSwitchStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return emitLabeledStatement(node);
- case 234 /* ThrowStatement */:
+ case 235 /* ThrowStatement */:
return emitThrowStatement(node);
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
return emitTryStatement(node);
- case 236 /* DebuggerStatement */:
+ case 237 /* DebuggerStatement */:
return emitDebuggerStatement(node);
// Declarations
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return emitVariableDeclaration(node);
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
return emitVariableDeclarationList(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return emitFunctionDeclaration(node);
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return emitClassDeclaration(node);
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
return emitInterfaceDeclaration(node);
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return emitTypeAliasDeclaration(node);
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return emitEnumDeclaration(node);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return emitModuleDeclaration(node);
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
return emitModuleBlock(node);
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
return emitCaseBlock(node);
- case 247 /* NamespaceExportDeclaration */:
+ case 248 /* NamespaceExportDeclaration */:
return emitNamespaceExportDeclaration(node);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return emitImportEqualsDeclaration(node);
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return emitImportDeclaration(node);
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
return emitImportClause(node);
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
return emitNamespaceImport(node);
- case 252 /* NamedImports */:
+ case 253 /* NamedImports */:
return emitNamedImports(node);
- case 253 /* ImportSpecifier */:
+ case 254 /* ImportSpecifier */:
return emitImportSpecifier(node);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return emitExportAssignment(node);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return emitExportDeclaration(node);
- case 256 /* NamedExports */:
+ case 257 /* NamedExports */:
return emitNamedExports(node);
- case 257 /* ExportSpecifier */:
+ case 258 /* ExportSpecifier */:
return emitExportSpecifier(node);
- case 258 /* MissingDeclaration */:
+ case 259 /* MissingDeclaration */:
return;
// Module references
- case 259 /* ExternalModuleReference */:
+ case 260 /* ExternalModuleReference */:
return emitExternalModuleReference(node);
// JSX (non-expression)
case 11 /* JsxText */:
return emitJsxText(node);
- case 262 /* JsxOpeningElement */:
- case 265 /* JsxOpeningFragment */:
+ case 263 /* JsxOpeningElement */:
+ case 266 /* JsxOpeningFragment */:
return emitJsxOpeningElementOrFragment(node);
- case 263 /* JsxClosingElement */:
- case 266 /* JsxClosingFragment */:
+ case 264 /* JsxClosingElement */:
+ case 267 /* JsxClosingFragment */:
return emitJsxClosingElementOrFragment(node);
- case 267 /* JsxAttribute */:
+ case 268 /* JsxAttribute */:
return emitJsxAttribute(node);
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
return emitJsxAttributes(node);
- case 269 /* JsxSpreadAttribute */:
+ case 270 /* JsxSpreadAttribute */:
return emitJsxSpreadAttribute(node);
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return emitJsxExpression(node);
// Clauses
- case 271 /* CaseClause */:
+ case 272 /* CaseClause */:
return emitCaseClause(node);
- case 272 /* DefaultClause */:
+ case 273 /* DefaultClause */:
return emitDefaultClause(node);
- case 273 /* HeritageClause */:
+ case 274 /* HeritageClause */:
return emitHeritageClause(node);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return emitCatchClause(node);
// Property assignments
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return emitPropertyAssignment(node);
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return emitShorthandPropertyAssignment(node);
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
return emitSpreadAssignment(node);
// Enum
- case 278 /* EnumMember */:
+ case 279 /* EnumMember */:
return emitEnumMember(node);
// JSDoc nodes (only used in codefixes currently)
- case 304 /* JSDocParameterTag */:
- case 310 /* JSDocPropertyTag */:
+ case 305 /* JSDocParameterTag */:
+ case 311 /* JSDocPropertyTag */:
return emitJSDocPropertyLikeTag(node);
- case 305 /* JSDocReturnTag */:
- case 307 /* JSDocTypeTag */:
- case 306 /* JSDocThisTag */:
- case 303 /* JSDocEnumTag */:
+ case 306 /* JSDocReturnTag */:
+ case 308 /* JSDocTypeTag */:
+ case 307 /* JSDocThisTag */:
+ case 304 /* JSDocEnumTag */:
return emitJSDocSimpleTypedTag(node);
- case 300 /* JSDocAugmentsTag */:
+ case 301 /* JSDocAugmentsTag */:
return emitJSDocAugmentsTag(node);
- case 308 /* JSDocTemplateTag */:
+ case 309 /* JSDocTemplateTag */:
return emitJSDocTemplateTag(node);
- case 309 /* JSDocTypedefTag */:
+ case 310 /* JSDocTypedefTag */:
return emitJSDocTypedefTag(node);
- case 302 /* JSDocCallbackTag */:
+ case 303 /* JSDocCallbackTag */:
return emitJSDocCallbackTag(node);
- case 298 /* JSDocSignature */:
+ case 299 /* JSDocSignature */:
return emitJSDocSignature(node);
- case 297 /* JSDocTypeLiteral */:
+ case 298 /* JSDocTypeLiteral */:
return emitJSDocTypeLiteral(node);
- case 301 /* JSDocClassTag */:
- case 299 /* JSDocTag */:
+ case 302 /* JSDocClassTag */:
+ case 300 /* JSDocTag */:
return emitJSDocSimpleTag(node);
- case 296 /* JSDocComment */:
+ case 297 /* JSDocComment */:
return emitJSDoc(node);
// Transformation nodes (ignored)
}
@@ -84166,83 +85075,83 @@
case 14 /* NoSubstitutionTemplateLiteral */:
return emitLiteral(node);
// Identifiers
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return emitIdentifier(node);
// Reserved words
- case 87 /* FalseKeyword */:
- case 96 /* NullKeyword */:
- case 98 /* SuperKeyword */:
- case 102 /* TrueKeyword */:
- case 100 /* ThisKeyword */:
- case 92 /* ImportKeyword */:
+ case 88 /* FalseKeyword */:
+ case 97 /* NullKeyword */:
+ case 99 /* SuperKeyword */:
+ case 103 /* TrueKeyword */:
+ case 101 /* ThisKeyword */:
+ case 93 /* ImportKeyword */:
writeTokenNode(node, writeKeyword);
return;
// Expressions
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return emitArrayLiteralExpression(node);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return emitObjectLiteralExpression(node);
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return emitPropertyAccessExpression(node);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return emitElementAccessExpression(node);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return emitCallExpression(node);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return emitNewExpression(node);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return emitTaggedTemplateExpression(node);
- case 194 /* TypeAssertionExpression */:
+ case 195 /* TypeAssertionExpression */:
return emitTypeAssertionExpression(node);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return emitParenthesizedExpression(node);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return emitFunctionExpression(node);
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return emitArrowFunction(node);
- case 198 /* DeleteExpression */:
+ case 199 /* DeleteExpression */:
return emitDeleteExpression(node);
- case 199 /* TypeOfExpression */:
+ case 200 /* TypeOfExpression */:
return emitTypeOfExpression(node);
- case 200 /* VoidExpression */:
+ case 201 /* VoidExpression */:
return emitVoidExpression(node);
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
return emitAwaitExpression(node);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return emitPrefixUnaryExpression(node);
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return emitPostfixUnaryExpression(node);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return emitBinaryExpression(node);
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return emitConditionalExpression(node);
- case 206 /* TemplateExpression */:
+ case 207 /* TemplateExpression */:
return emitTemplateExpression(node);
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return emitYieldExpression(node);
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
return emitSpreadExpression(node);
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
return emitClassExpression(node);
- case 210 /* OmittedExpression */:
+ case 211 /* OmittedExpression */:
return;
- case 212 /* AsExpression */:
+ case 213 /* AsExpression */:
return emitAsExpression(node);
- case 213 /* NonNullExpression */:
+ case 214 /* NonNullExpression */:
return emitNonNullExpression(node);
- case 214 /* MetaProperty */:
+ case 215 /* MetaProperty */:
return emitMetaProperty(node);
// JSX
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
return emitJsxElement(node);
- case 261 /* JsxSelfClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
return emitJsxSelfClosingElement(node);
- case 264 /* JsxFragment */:
+ case 265 /* JsxFragment */:
return emitJsxFragment(node);
// Transformation nodes
- case 313 /* PartiallyEmittedExpression */:
+ case 314 /* PartiallyEmittedExpression */:
return emitPartiallyEmittedExpression(node);
- case 314 /* CommaListExpression */:
+ case 315 /* CommaListExpression */:
return emitCommaList(node);
}
}
@@ -84282,7 +85191,7 @@
}
function emitHelpers(node) {
var helpersEmitted = false;
- var bundle = node.kind === 285 /* Bundle */ ? node : undefined;
+ var bundle = node.kind === 286 /* Bundle */ ? node : undefined;
if (bundle && moduleKind === ts.ModuleKind.None) {
return;
}
@@ -84382,7 +85291,7 @@
var pos = getTextPosWithWriteLine();
writeUnparsedNode(unparsed);
if (bundleFileInfo) {
- updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 281 /* UnparsedText */ ?
+ updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 282 /* UnparsedText */ ?
"text" /* Text */ :
"internal" /* Internal */);
}
@@ -84415,7 +85324,7 @@
emit(node.right);
}
function emitEntityName(node) {
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
emitExpression(node);
}
else {
@@ -84451,7 +85360,7 @@
emit(node.dotDotDotToken);
emitNodeWithWriter(node.name, writeParameter);
emit(node.questionToken);
- if (node.parent && node.parent.kind === 294 /* JSDocFunctionType */ && !node.name) {
+ if (node.parent && node.parent.kind === 295 /* JSDocFunctionType */ && !node.name) {
emit(node.type);
}
else {
@@ -84513,7 +85422,7 @@
function emitAccessorDeclaration(node) {
emitDecorators(node, node.decorators);
emitModifiers(node, node.modifiers);
- writeKeyword(node.kind === 158 /* GetAccessor */ ? "get" : "set");
+ writeKeyword(node.kind === 159 /* GetAccessor */ ? "get" : "set");
writeSpace();
emit(node.name);
emitSignatureAndBody(node, emitSignatureHead);
@@ -84690,7 +85599,7 @@
}
if (node.readonlyToken) {
emit(node.readonlyToken);
- if (node.readonlyToken.kind !== 133 /* ReadonlyKeyword */) {
+ if (node.readonlyToken.kind !== 134 /* ReadonlyKeyword */) {
writeKeyword("readonly");
}
writeSpace();
@@ -84840,7 +85749,7 @@
emitExpressionList(node, node.arguments, 2576 /* CallExpressionArguments */);
}
function emitNewExpression(node) {
- emitTokenWithComment(95 /* NewKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(96 /* NewKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
emitTypeArguments(node, node.typeArguments);
@@ -84880,22 +85789,22 @@
emit(node.equalsGreaterThanToken);
}
function emitDeleteExpression(node) {
- emitTokenWithComment(81 /* DeleteKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(82 /* DeleteKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
}
function emitTypeOfExpression(node) {
- emitTokenWithComment(104 /* TypeOfKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(105 /* TypeOfKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
}
function emitVoidExpression(node) {
- emitTokenWithComment(106 /* VoidKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(107 /* VoidKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
}
function emitAwaitExpression(node) {
- emitTokenWithComment(122 /* AwaitKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(123 /* AwaitKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
}
@@ -84920,7 +85829,7 @@
// expression a prefix increment whose operand is a plus expression - (++(+x))
// The same is true of minus of course.
var operand = node.operand;
- return operand.kind === 202 /* PrefixUnaryExpression */
+ return operand.kind === 203 /* PrefixUnaryExpression */
&& ((node.operator === 38 /* PlusToken */ && (operand.operator === 38 /* PlusToken */ || operand.operator === 44 /* PlusPlusToken */))
|| (node.operator === 39 /* MinusToken */ && (operand.operator === 39 /* MinusToken */ || operand.operator === 45 /* MinusMinusToken */)));
}
@@ -84935,7 +85844,7 @@
emitExpression(node.left);
increaseIndentIf(indentBeforeOperator, isCommaOperator);
emitLeadingCommentsOfPosition(node.operatorToken.pos);
- writeTokenNode(node.operatorToken, node.operatorToken.kind === 93 /* InKeyword */ ? writeKeyword : writeOperator);
+ writeTokenNode(node.operatorToken, node.operatorToken.kind === 94 /* InKeyword */ ? writeKeyword : writeOperator);
emitTrailingCommentsOfPosition(node.operatorToken.end, /*prefixSpace*/ true); // Binary operators should have a space before the comment starts
increaseIndentIf(indentAfterOperator, /*writeSpaceIfNotIndenting*/ true);
emitExpression(node.right);
@@ -84963,7 +85872,7 @@
emitList(node, node.templateSpans, 262144 /* TemplateExpressionSpans */);
}
function emitYieldExpression(node) {
- emitTokenWithComment(117 /* YieldKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(118 /* YieldKeyword */, node.pos, writeKeyword, node);
emit(node.asteriskToken);
emitExpressionWithLeadingSpace(node.expression);
}
@@ -85040,7 +85949,7 @@
}
}
function emitIfStatement(node) {
- var openParenPos = emitTokenWithComment(91 /* IfKeyword */, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(92 /* IfKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
emitExpression(node.expression);
@@ -85048,8 +85957,8 @@
emitEmbeddedStatement(node, node.thenStatement);
if (node.elseStatement) {
writeLineOrSpace(node);
- emitTokenWithComment(83 /* ElseKeyword */, node.thenStatement.end, writeKeyword, node);
- if (node.elseStatement.kind === 222 /* IfStatement */) {
+ emitTokenWithComment(84 /* ElseKeyword */, node.thenStatement.end, writeKeyword, node);
+ if (node.elseStatement.kind === 223 /* IfStatement */) {
writeSpace();
emit(node.elseStatement);
}
@@ -85059,14 +85968,14 @@
}
}
function emitWhileClause(node, startPos) {
- var openParenPos = emitTokenWithComment(107 /* WhileKeyword */, startPos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(108 /* WhileKeyword */, startPos, writeKeyword, node);
writeSpace();
emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
emitExpression(node.expression);
emitTokenWithComment(21 /* CloseParenToken */, node.expression.end, writePunctuation, node);
}
function emitDoStatement(node) {
- emitTokenWithComment(82 /* DoKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(83 /* DoKeyword */, node.pos, writeKeyword, node);
emitEmbeddedStatement(node, node.statement);
if (ts.isBlock(node.statement)) {
writeSpace();
@@ -85082,7 +85991,7 @@
emitEmbeddedStatement(node, node.statement);
}
function emitForStatement(node) {
- var openParenPos = emitTokenWithComment(89 /* ForKeyword */, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(90 /* ForKeyword */, node.pos, writeKeyword, node);
writeSpace();
var pos = emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, /*contextNode*/ node);
emitForBinding(node.initializer);
@@ -85094,25 +86003,25 @@
emitEmbeddedStatement(node, node.statement);
}
function emitForInStatement(node) {
- var openParenPos = emitTokenWithComment(89 /* ForKeyword */, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(90 /* ForKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
emitForBinding(node.initializer);
writeSpace();
- emitTokenWithComment(93 /* InKeyword */, node.initializer.end, writeKeyword, node);
+ emitTokenWithComment(94 /* InKeyword */, node.initializer.end, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
emitTokenWithComment(21 /* CloseParenToken */, node.expression.end, writePunctuation, node);
emitEmbeddedStatement(node, node.statement);
}
function emitForOfStatement(node) {
- var openParenPos = emitTokenWithComment(89 /* ForKeyword */, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(90 /* ForKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitWithTrailingSpace(node.awaitModifier);
emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
emitForBinding(node.initializer);
writeSpace();
- emitTokenWithComment(147 /* OfKeyword */, node.initializer.end, writeKeyword, node);
+ emitTokenWithComment(148 /* OfKeyword */, node.initializer.end, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
emitTokenWithComment(21 /* CloseParenToken */, node.expression.end, writePunctuation, node);
@@ -85120,7 +86029,7 @@
}
function emitForBinding(node) {
if (node !== undefined) {
- if (node.kind === 238 /* VariableDeclarationList */) {
+ if (node.kind === 239 /* VariableDeclarationList */) {
emit(node);
}
else {
@@ -85129,12 +86038,12 @@
}
}
function emitContinueStatement(node) {
- emitTokenWithComment(78 /* ContinueKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(79 /* ContinueKeyword */, node.pos, writeKeyword, node);
emitWithLeadingSpace(node.label);
writeTrailingSemicolon();
}
function emitBreakStatement(node) {
- emitTokenWithComment(73 /* BreakKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(74 /* BreakKeyword */, node.pos, writeKeyword, node);
emitWithLeadingSpace(node.label);
writeTrailingSemicolon();
}
@@ -85162,12 +86071,12 @@
return pos;
}
function emitReturnStatement(node) {
- emitTokenWithComment(97 /* ReturnKeyword */, node.pos, writeKeyword, /*contextNode*/ node);
+ emitTokenWithComment(98 /* ReturnKeyword */, node.pos, writeKeyword, /*contextNode*/ node);
emitExpressionWithLeadingSpace(node.expression);
writeTrailingSemicolon();
}
function emitWithStatement(node) {
- var openParenPos = emitTokenWithComment(108 /* WithKeyword */, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(109 /* WithKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
emitExpression(node.expression);
@@ -85175,7 +86084,7 @@
emitEmbeddedStatement(node, node.statement);
}
function emitSwitchStatement(node) {
- var openParenPos = emitTokenWithComment(99 /* SwitchKeyword */, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(100 /* SwitchKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
emitExpression(node.expression);
@@ -85190,12 +86099,12 @@
emit(node.statement);
}
function emitThrowStatement(node) {
- emitTokenWithComment(101 /* ThrowKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(102 /* ThrowKeyword */, node.pos, writeKeyword, node);
emitExpressionWithLeadingSpace(node.expression);
writeTrailingSemicolon();
}
function emitTryStatement(node) {
- emitTokenWithComment(103 /* TryKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(104 /* TryKeyword */, node.pos, writeKeyword, node);
writeSpace();
emit(node.tryBlock);
if (node.catchClause) {
@@ -85204,13 +86113,13 @@
}
if (node.finallyBlock) {
writeLineOrSpace(node);
- emitTokenWithComment(88 /* FinallyKeyword */, (node.catchClause || node.tryBlock).end, writeKeyword, node);
+ emitTokenWithComment(89 /* FinallyKeyword */, (node.catchClause || node.tryBlock).end, writeKeyword, node);
writeSpace();
emit(node.finallyBlock);
}
}
function emitDebuggerStatement(node) {
- writeToken(79 /* DebuggerKeyword */, node.pos, writeKeyword);
+ writeToken(80 /* DebuggerKeyword */, node.pos, writeKeyword);
writeTrailingSemicolon();
}
//
@@ -85415,7 +86324,7 @@
var body = node.body;
if (!body)
return writeTrailingSemicolon();
- while (body.kind === 244 /* ModuleDeclaration */) {
+ while (body.kind === 245 /* ModuleDeclaration */) {
writePunctuation(".");
emit(body.name);
body = body.body;
@@ -85436,17 +86345,17 @@
}
function emitImportEqualsDeclaration(node) {
emitModifiers(node, node.modifiers);
- emitTokenWithComment(92 /* ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node);
+ emitTokenWithComment(93 /* ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node);
writeSpace();
emit(node.name);
writeSpace();
- emitTokenWithComment(59 /* EqualsToken */, node.name.end, writePunctuation, node);
+ emitTokenWithComment(60 /* EqualsToken */, node.name.end, writePunctuation, node);
writeSpace();
emitModuleReference(node.moduleReference);
writeTrailingSemicolon();
}
function emitModuleReference(node) {
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
emitExpression(node);
}
else {
@@ -85455,12 +86364,12 @@
}
function emitImportDeclaration(node) {
emitModifiers(node, node.modifiers);
- emitTokenWithComment(92 /* ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node);
+ emitTokenWithComment(93 /* ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node);
writeSpace();
if (node.importClause) {
emit(node.importClause);
writeSpace();
- emitTokenWithComment(144 /* FromKeyword */, node.importClause.end, writeKeyword, node);
+ emitTokenWithComment(145 /* FromKeyword */, node.importClause.end, writeKeyword, node);
writeSpace();
}
emitExpression(node.moduleSpecifier);
@@ -85477,7 +86386,7 @@
function emitNamespaceImport(node) {
var asPos = emitTokenWithComment(40 /* AsteriskToken */, node.pos, writePunctuation, node);
writeSpace();
- emitTokenWithComment(119 /* AsKeyword */, asPos, writeKeyword, node);
+ emitTokenWithComment(120 /* AsKeyword */, asPos, writeKeyword, node);
writeSpace();
emit(node.name);
}
@@ -85488,20 +86397,20 @@
emitImportOrExportSpecifier(node);
}
function emitExportAssignment(node) {
- var nextPos = emitTokenWithComment(85 /* ExportKeyword */, node.pos, writeKeyword, node);
+ var nextPos = emitTokenWithComment(86 /* ExportKeyword */, node.pos, writeKeyword, node);
writeSpace();
if (node.isExportEquals) {
- emitTokenWithComment(59 /* EqualsToken */, nextPos, writeOperator, node);
+ emitTokenWithComment(60 /* EqualsToken */, nextPos, writeOperator, node);
}
else {
- emitTokenWithComment(80 /* DefaultKeyword */, nextPos, writeKeyword, node);
+ emitTokenWithComment(81 /* DefaultKeyword */, nextPos, writeKeyword, node);
}
writeSpace();
emitExpression(node.expression);
writeTrailingSemicolon();
}
function emitExportDeclaration(node) {
- var nextPos = emitTokenWithComment(85 /* ExportKeyword */, node.pos, writeKeyword, node);
+ var nextPos = emitTokenWithComment(86 /* ExportKeyword */, node.pos, writeKeyword, node);
writeSpace();
if (node.exportClause) {
emit(node.exportClause);
@@ -85512,18 +86421,18 @@
if (node.moduleSpecifier) {
writeSpace();
var fromPos = node.exportClause ? node.exportClause.end : nextPos;
- emitTokenWithComment(144 /* FromKeyword */, fromPos, writeKeyword, node);
+ emitTokenWithComment(145 /* FromKeyword */, fromPos, writeKeyword, node);
writeSpace();
emitExpression(node.moduleSpecifier);
}
writeTrailingSemicolon();
}
function emitNamespaceExportDeclaration(node) {
- var nextPos = emitTokenWithComment(85 /* ExportKeyword */, node.pos, writeKeyword, node);
+ var nextPos = emitTokenWithComment(86 /* ExportKeyword */, node.pos, writeKeyword, node);
writeSpace();
- nextPos = emitTokenWithComment(119 /* AsKeyword */, nextPos, writeKeyword, node);
+ nextPos = emitTokenWithComment(120 /* AsKeyword */, nextPos, writeKeyword, node);
writeSpace();
- nextPos = emitTokenWithComment(131 /* NamespaceKeyword */, nextPos, writeKeyword, node);
+ nextPos = emitTokenWithComment(132 /* NamespaceKeyword */, nextPos, writeKeyword, node);
writeSpace();
emit(node.name);
writeTrailingSemicolon();
@@ -85543,7 +86452,7 @@
if (node.propertyName) {
emit(node.propertyName);
writeSpace();
- emitTokenWithComment(119 /* AsKeyword */, node.propertyName.end, writeKeyword, node);
+ emitTokenWithComment(120 /* AsKeyword */, node.propertyName.end, writeKeyword, node);
writeSpace();
}
emit(node.name);
@@ -85621,7 +86530,7 @@
}
}
function emitJsxTagName(node) {
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
emitExpression(node);
}
else {
@@ -85632,13 +86541,13 @@
// Clauses
//
function emitCaseClause(node) {
- emitTokenWithComment(74 /* CaseKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(75 /* CaseKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
emitCaseOrDefaultClauseRest(node, node.statements, node.expression.end);
}
function emitDefaultClause(node) {
- var pos = emitTokenWithComment(80 /* DefaultKeyword */, node.pos, writeKeyword, node);
+ var pos = emitTokenWithComment(81 /* DefaultKeyword */, node.pos, writeKeyword, node);
emitCaseOrDefaultClauseRest(node, node.statements, pos);
}
function emitCaseOrDefaultClauseRest(parentNode, statements, colonPos) {
@@ -85666,7 +86575,7 @@
emitList(node, node.types, 528 /* HeritageClauseTypes */);
}
function emitCatchClause(node) {
- var openParenPos = emitTokenWithComment(75 /* CatchKeyword */, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(76 /* CatchKeyword */, node.pos, writeKeyword, node);
writeSpace();
if (node.variableDeclaration) {
emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
@@ -85736,7 +86645,7 @@
}
}
if (node.tags) {
- if (node.tags.length === 1 && node.tags[0].kind === 307 /* JSDocTypeTag */ && !node.comment) {
+ if (node.tags.length === 1 && node.tags[0].kind === 308 /* JSDocTypeTag */ && !node.comment) {
writeSpace();
emit(node.tags[0]);
}
@@ -85770,7 +86679,7 @@
function emitJSDocTypedefTag(tag) {
emitJSDocTagName(tag.tagName);
if (tag.typeExpression) {
- if (tag.typeExpression.kind === 288 /* JSDocTypeExpression */) {
+ if (tag.typeExpression.kind === 289 /* JSDocTypeExpression */) {
emitJSDocTypeExpression(tag.typeExpression);
}
else {
@@ -85789,7 +86698,7 @@
emit(tag.fullName);
}
emitJSDocComment(tag.comment);
- if (tag.typeExpression && tag.typeExpression.kind === 297 /* JSDocTypeLiteral */) {
+ if (tag.typeExpression && tag.typeExpression.kind === 298 /* JSDocTypeLiteral */) {
emitJSDocTypeLiteral(tag.typeExpression);
}
}
@@ -85923,8 +86832,8 @@
bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "reference" /* Reference */, data: directive.fileName });
writeLine();
}
- for (var _d = 0, types_19 = types; _d < types_19.length; _d++) {
- var directive = types_19[_d];
+ for (var _d = 0, types_18 = types; _d < types_18.length; _d++) {
+ var directive = types_18[_d];
var pos = writer.getTextPos();
writeComment("/// <reference types=\"" + directive.fileName + "\" />");
if (bundleFileInfo)
@@ -86104,7 +87013,7 @@
function emitInitializer(node, equalCommentStartPos, container) {
if (node) {
writeSpace();
- emitTokenWithComment(59 /* EqualsToken */, equalCommentStartPos, writeOperator, container);
+ emitTokenWithComment(60 /* EqualsToken */, equalCommentStartPos, writeOperator, container);
writeSpace();
emitExpression(node);
}
@@ -86567,7 +87476,7 @@
&& ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile);
}
function skipSynthesizedParentheses(node) {
- while (node.kind === 195 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) {
+ while (node.kind === 196 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) {
node = node.expression;
}
return node;
@@ -86632,81 +87541,81 @@
if (!node)
return;
switch (node.kind) {
- case 218 /* Block */:
+ case 219 /* Block */:
ts.forEach(node.statements, generateNames);
break;
- case 233 /* LabeledStatement */:
- case 231 /* WithStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
+ case 234 /* LabeledStatement */:
+ case 232 /* WithStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
generateNames(node.statement);
break;
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
generateNames(node.thenStatement);
generateNames(node.elseStatement);
break;
- case 225 /* ForStatement */:
- case 227 /* ForOfStatement */:
- case 226 /* ForInStatement */:
+ case 226 /* ForStatement */:
+ case 228 /* ForOfStatement */:
+ case 227 /* ForInStatement */:
generateNames(node.initializer);
generateNames(node.statement);
break;
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
generateNames(node.caseBlock);
break;
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
ts.forEach(node.clauses, generateNames);
break;
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
ts.forEach(node.statements, generateNames);
break;
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
generateNames(node.tryBlock);
generateNames(node.catchClause);
generateNames(node.finallyBlock);
break;
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
generateNames(node.variableDeclaration);
generateNames(node.block);
break;
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
generateNames(node.declarationList);
break;
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
ts.forEach(node.declarations, generateNames);
break;
- case 237 /* VariableDeclaration */:
- case 151 /* Parameter */:
- case 186 /* BindingElement */:
- case 240 /* ClassDeclaration */:
+ case 238 /* VariableDeclaration */:
+ case 152 /* Parameter */:
+ case 187 /* BindingElement */:
+ case 241 /* ClassDeclaration */:
generateNameIfNeeded(node.name);
break;
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
generateNameIfNeeded(node.name);
if (ts.getEmitFlags(node) & 524288 /* ReuseTempVariableScope */) {
ts.forEach(node.parameters, generateNames);
generateNames(node.body);
}
break;
- case 184 /* ObjectBindingPattern */:
- case 185 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
ts.forEach(node.elements, generateNames);
break;
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
generateNames(node.importClause);
break;
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
generateNameIfNeeded(node.name);
generateNames(node.namedBindings);
break;
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
generateNameIfNeeded(node.name);
break;
- case 252 /* NamedImports */:
+ case 253 /* NamedImports */:
ts.forEach(node.elements, generateNames);
break;
- case 253 /* ImportSpecifier */:
+ case 254 /* ImportSpecifier */:
generateNameIfNeeded(node.propertyName || node.name);
break;
}
@@ -86715,12 +87624,12 @@
if (!node)
return;
switch (node.kind) {
- case 275 /* PropertyAssignment */:
- case 276 /* ShorthandPropertyAssignment */:
- case 154 /* PropertyDeclaration */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 276 /* PropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
+ case 155 /* PropertyDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
generateNameIfNeeded(node.name);
break;
}
@@ -86900,24 +87809,26 @@
*/
function generateNameForNode(node, flags) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return makeUniqueName(getTextOfNode(node), isUniqueName, !!(flags & 16 /* Optimistic */), !!(flags & 8 /* ReservedInNestedScopes */));
- case 244 /* ModuleDeclaration */:
- case 243 /* EnumDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 244 /* EnumDeclaration */:
return generateNameForModuleOrEnum(node);
- case 249 /* ImportDeclaration */:
- case 255 /* ExportDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 256 /* ExportDeclaration */:
return generateNameForImportOrExportDeclaration(node);
- case 239 /* FunctionDeclaration */:
- case 240 /* ClassDeclaration */:
- case 254 /* ExportAssignment */:
+ case 240 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 255 /* ExportAssignment */:
return generateNameForExportDefault();
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
return generateNameForClassExpression();
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return generateNameForMethodOrAccessor(node);
+ case 150 /* ComputedPropertyName */:
+ return makeTempVariableName(0 /* Auto */, /*reserveInNestedScopes*/ true);
default:
return makeTempVariableName(0 /* Auto */);
}
@@ -86963,7 +87874,7 @@
hasWrittenComment = false;
var emitFlags = ts.getEmitFlags(node);
var _a = ts.getCommentRange(node), pos = _a.pos, end = _a.end;
- var isEmittedNode = node.kind !== 312 /* NotEmittedStatement */;
+ var isEmittedNode = node.kind !== 313 /* NotEmittedStatement */;
// We have to explicitly check that the node is JsxText because if the compilerOptions.jsx is "preserve" we will not do any transformation.
// It is expensive to walk entire tree just to set one kind of node to have no comments.
var skipLeadingComments = pos < 0 || (emitFlags & 512 /* NoLeadingComments */) !== 0 || node.kind === 11 /* JsxText */;
@@ -86987,7 +87898,7 @@
containerEnd = end;
// To avoid invalid comment emit in a down-level binding pattern, we
// keep track of the last declaration list container's end
- if (node.kind === 238 /* VariableDeclarationList */) {
+ if (node.kind === 239 /* VariableDeclarationList */) {
declarationListContainerEnd = end;
}
}
@@ -87244,7 +88155,7 @@
else {
var _a = ts.getSourceMapRange(node), pos = _a.pos, end = _a.end, _b = _a.source, source = _b === void 0 ? sourceMapSource : _b;
var emitFlags = ts.getEmitFlags(node);
- if (node.kind !== 312 /* NotEmittedStatement */
+ if (node.kind !== 313 /* NotEmittedStatement */
&& (emitFlags & 16 /* NoLeadingSourceMap */) === 0
&& pos >= 0) {
emitSourcePos(source, skipSourceTrivia(source, pos));
@@ -87257,7 +88168,7 @@
else {
pipelinePhase(hint, node);
}
- if (node.kind !== 312 /* NotEmittedStatement */
+ if (node.kind !== 313 /* NotEmittedStatement */
&& (emitFlags & 32 /* NoTrailingSourceMap */) === 0
&& end >= 0) {
emitSourcePos(source, end);
@@ -87872,7 +88783,8 @@
getDirectories: function (path) { return system.getDirectories(path); },
realpath: realpath,
readDirectory: function (path, extensions, include, exclude, depth) { return system.readDirectory(path, extensions, include, exclude, depth); },
- createDirectory: function (d) { return system.createDirectory(d); }
+ createDirectory: function (d) { return system.createDirectory(d); },
+ createHash: ts.maybeBind(system, system.createHash)
};
return compilerHost;
}
@@ -88158,6 +89070,7 @@
}
}
ts.flattenDiagnosticMessageText = flattenDiagnosticMessageText;
+ /* @internal */
function loadWithLocalCache(names, containingFile, redirectedReference, loader) {
if (names.length === 0) {
return [];
@@ -88177,6 +89090,7 @@
}
return resolutions;
}
+ ts.loadWithLocalCache = loadWithLocalCache;
/**
* Determines if program structure is upto date or needs to be recreated
*/
@@ -88336,7 +89250,7 @@
}); };
}
else {
- moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, function (x) { return host.getCanonicalFileName(x); });
+ moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, function (x) { return host.getCanonicalFileName(x); }, options);
var loader_1 = function (moduleName, containingFile, redirectedReference) { return ts.resolveModuleName(moduleName, containingFile, options, host, moduleResolutionCache, redirectedReference).resolvedModule; }; // TODO: GH#18217
resolveModuleNamesWorker = function (moduleNames, containingFile, _reusedNames, redirectedReference) { return loadWithLocalCache(ts.Debug.assertEachDefined(moduleNames), containingFile, redirectedReference, loader_1); };
}
@@ -88482,6 +89396,7 @@
getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); },
getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); },
getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); },
+ getRelationCacheSizes: function () { return getDiagnosticsProducingTypeChecker().getRelationCacheSizes(); },
getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; },
getResolvedTypeReferenceDirectives: function () { return resolvedTypeReferenceDirectives; },
isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary,
@@ -88579,13 +89494,13 @@
// which per above occurred during the current program creation.
// Since we assume the filesystem does not change during program creation,
// it is safe to reuse resolutions from the earlier call.
- var result_6 = [];
+ var result_8 = [];
for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) {
var moduleName = moduleNames_1[_i];
var resolvedModule = file.resolvedModules.get(moduleName);
- result_6.push(resolvedModule);
+ result_8.push(resolvedModule);
}
- return result_6;
+ return result_8;
}
// At this point, we know at least one of the following hold:
// - file has local declarations for ambient modules
@@ -88672,7 +89587,7 @@
function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName) {
var resolutionToFile = ts.getResolvedModule(oldSourceFile, moduleName);
var resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
- if (resolutionToFile && resolvedFile && !resolvedFile.externalModuleIndicator) {
+ if (resolutionToFile && resolvedFile) {
// In the old program, we resolved to an ambient module that was in the same
// place as we expected to find an actual module file.
// We actually need to return 'false' here even though this seems like a 'true' case
@@ -88935,9 +89850,8 @@
ts.performance.mark("beforeEmit");
var emitResult = ts.emitFiles(ts.notImplementedResolver, getEmitHost(writeFileCallback),
/*targetSourceFile*/ undefined,
+ /*transformers*/ ts.noTransformers,
/*emitOnlyDtsFiles*/ false,
- /*transformers*/ undefined,
- /*declaraitonTransformers*/ undefined,
/*onlyBuildInfo*/ true);
ts.performance.mark("afterEmit");
ts.performance.measure("Emit", "beforeEmit", "afterEmit");
@@ -89025,8 +89939,7 @@
// checked is to not pass the file to getEmitResolver.
var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver((options.outFile || options.out) ? undefined : sourceFile, cancellationToken);
ts.performance.mark("beforeEmit");
- var transformers = emitOnlyDtsFiles ? [] : ts.getTransformers(options, customTransformers);
- var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile, emitOnlyDtsFiles, transformers, customTransformers && customTransformers.afterDeclarations);
+ var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile, ts.getTransformers(options, customTransformers, emitOnlyDtsFiles), emitOnlyDtsFiles);
ts.performance.mark("afterEmit");
ts.performance.measure("Emit", "beforeEmit", "afterEmit");
return emitResult;
@@ -89168,22 +90081,22 @@
// Return directly from the case if the given node doesnt want to visit each child
// Otherwise break to visit each child
switch (parent.kind) {
- case 151 /* Parameter */:
- case 154 /* PropertyDeclaration */:
+ case 152 /* Parameter */:
+ case 155 /* PropertyDeclaration */:
if (parent.questionToken === node) {
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, "?"));
return;
}
// falls through
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 196 /* FunctionExpression */:
- case 239 /* FunctionDeclaration */:
- case 197 /* ArrowFunction */:
- case 237 /* VariableDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 197 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
+ case 198 /* ArrowFunction */:
+ case 238 /* VariableDeclaration */:
// type annotation
if (parent.type === node) {
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.types_can_only_be_used_in_a_ts_file));
@@ -89191,41 +90104,41 @@
}
}
switch (node.kind) {
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file));
return;
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
if (node.isExportEquals) {
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file));
return;
}
break;
- case 273 /* HeritageClause */:
+ case 274 /* HeritageClause */:
var heritageClause = node;
- if (heritageClause.token === 109 /* ImplementsKeyword */) {
+ if (heritageClause.token === 110 /* ImplementsKeyword */) {
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file));
return;
}
break;
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file));
return;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file));
return;
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file));
return;
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file));
return;
- case 213 /* NonNullExpression */:
+ case 214 /* NonNullExpression */:
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.non_null_assertions_can_only_be_used_in_a_ts_file));
return;
- case 212 /* AsExpression */:
+ case 213 /* AsExpression */:
diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file));
return;
- case 194 /* TypeAssertionExpression */:
+ case 195 /* TypeAssertionExpression */:
ts.Debug.fail(); // Won't parse these in a JS file anyway, as they are interpreted as JSX.
}
var prevParent = parent;
@@ -89235,54 +90148,54 @@
}
function walkArray(nodes) {
if (parent.decorators === nodes && !options.experimentalDecorators) {
- diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning));
+ diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning));
}
switch (parent.kind) {
- case 240 /* ClassDeclaration */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 196 /* FunctionExpression */:
- case 239 /* FunctionDeclaration */:
- case 197 /* ArrowFunction */:
+ case 241 /* ClassDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 197 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
+ case 198 /* ArrowFunction */:
// Check type parameters
if (nodes === parent.typeParameters) {
diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file));
return;
}
// falls through
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
// Check modifiers
if (nodes === parent.modifiers) {
- return checkModifiers(nodes, parent.kind === 219 /* VariableStatement */);
+ return checkModifiers(nodes, parent.kind === 220 /* VariableStatement */);
}
break;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
// Check modifiers of property declaration
if (nodes === parent.modifiers) {
for (var _i = 0, _a = nodes; _i < _a.length; _i++) {
var modifier = _a[_i];
- if (modifier.kind !== 116 /* StaticKeyword */) {
+ if (modifier.kind !== 117 /* StaticKeyword */) {
diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind)));
}
}
return;
}
break;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
// Check modifiers of parameter declaration
if (nodes === parent.modifiers) {
diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file));
return;
}
break;
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
- case 211 /* ExpressionWithTypeArguments */:
- case 261 /* JsxSelfClosingElement */:
- case 262 /* JsxOpeningElement */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
+ case 212 /* ExpressionWithTypeArguments */:
+ case 262 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
// Check type arguments
if (nodes === parent.typeArguments) {
diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file));
@@ -89299,24 +90212,24 @@
for (var _i = 0, modifiers_1 = modifiers; _i < modifiers_1.length; _i++) {
var modifier = modifiers_1[_i];
switch (modifier.kind) {
- case 77 /* ConstKeyword */:
+ case 78 /* ConstKeyword */:
if (isConstValid) {
continue;
}
// to report error,
// falls through
- case 115 /* PublicKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 133 /* ReadonlyKeyword */:
- case 125 /* DeclareKeyword */:
- case 118 /* AbstractKeyword */:
+ case 116 /* PublicKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 134 /* ReadonlyKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 119 /* AbstractKeyword */:
diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind)));
break;
// These are all legal modifiers.
- case 116 /* StaticKeyword */:
- case 85 /* ExportKeyword */:
- case 80 /* DefaultKeyword */:
+ case 117 /* StaticKeyword */:
+ case 86 /* ExportKeyword */:
+ case 81 /* DefaultKeyword */:
}
}
}
@@ -89391,8 +90304,8 @@
return a.fileName === b.fileName;
}
function moduleNameIsEqualTo(a, b) {
- return a.kind === 72 /* Identifier */
- ? b.kind === 72 /* Identifier */ && a.escapedText === b.escapedText
+ return a.kind === 73 /* Identifier */
+ ? b.kind === 73 /* Identifier */ && a.escapedText === b.escapedText
: b.kind === 10 /* StringLiteral */ && a.text === b.text;
}
function collectExternalModuleReferences(file) {
@@ -89607,7 +90520,10 @@
if (isRedirect) {
inputName = getProjectReferenceRedirect(fileName) || fileName;
}
- if (ts.getNormalizedAbsolutePath(checkedName, currentDirectory) !== ts.getNormalizedAbsolutePath(inputName, currentDirectory)) {
+ // Check if it differs only in drive letters its ok to ignore that error:
+ var checkedAbsolutePath = ts.getNormalizedAbsolutePathWithoutRoot(checkedName, currentDirectory);
+ var inputAbsolutePath = ts.getNormalizedAbsolutePathWithoutRoot(inputName, currentDirectory);
+ if (checkedAbsolutePath !== inputAbsolutePath) {
reportFileNamesDifferOnlyInCasingError(inputName, checkedName, refFile, refPos, refEnd);
}
}
@@ -89636,8 +90552,13 @@
}
var redirectedPath;
if (refFile) {
- var redirect = getProjectReferenceRedirect(fileName);
- if (redirect) {
+ var redirectProject = getProjectReferenceRedirectProject(fileName);
+ if (redirectProject) {
+ if (redirectProject.commandLine.options.outFile || redirectProject.commandLine.options.out) {
+ // Shouldnt create many to 1 mapping file in --out scenario
+ return undefined;
+ }
+ var redirect = getProjectReferenceOutputName(redirectProject, fileName);
fileName = redirect;
// Once we start redirecting to a file, we can potentially come back to it
// via a back-reference from another file in the .d.ts folder. If that happens we'll
@@ -89721,16 +90642,19 @@
}
}
function getProjectReferenceRedirect(fileName) {
+ var referencedProject = getProjectReferenceRedirectProject(fileName);
+ return referencedProject && getProjectReferenceOutputName(referencedProject, fileName);
+ }
+ function getProjectReferenceRedirectProject(fileName) {
// Ignore dts or any of the non ts files
if (!resolvedProjectReferences || !resolvedProjectReferences.length || ts.fileExtensionIs(fileName, ".d.ts" /* Dts */) || !ts.fileExtensionIsOneOf(fileName, ts.supportedTSExtensions)) {
return undefined;
}
// If this file is produced by a referenced project, we need to rewrite it to
// look in the output folder of the referenced project rather than the input
- var referencedProject = getResolvedProjectReferenceToRedirect(fileName);
- if (!referencedProject) {
- return undefined;
+ return getResolvedProjectReferenceToRedirect(fileName);
}
+ function getProjectReferenceOutputName(referencedProject, fileName) {
var out = referencedProject.commandLine.options.outFile || referencedProject.commandLine.options.out;
return out ?
ts.changeExtension(out, ".d.ts" /* Dts */) :
@@ -89975,18 +90899,33 @@
if (fromCache !== undefined) {
return fromCache || undefined;
}
+ var commandLine;
+ var sourceFile;
+ if (host.getParsedCommandLine) {
+ commandLine = host.getParsedCommandLine(refPath);
+ if (!commandLine) {
+ addFileToFilesByName(/*sourceFile*/ undefined, sourceFilePath, /*redirectedPath*/ undefined);
+ projectReferenceRedirects.set(sourceFilePath, false);
+ return undefined;
+ }
+ sourceFile = ts.Debug.assertDefined(commandLine.options.configFile);
+ ts.Debug.assert(!sourceFile.path || sourceFile.path === sourceFilePath);
+ addFileToFilesByName(sourceFile, sourceFilePath, /*redirectedPath*/ undefined);
+ }
+ else {
// An absolute path pointing to the containing directory of the config file
var basePath = ts.getNormalizedAbsolutePath(ts.getDirectoryPath(refPath), host.getCurrentDirectory());
- var sourceFile = host.getSourceFile(refPath, 100 /* JSON */);
+ sourceFile = host.getSourceFile(refPath, 100 /* JSON */);
addFileToFilesByName(sourceFile, sourceFilePath, /*redirectedPath*/ undefined);
if (sourceFile === undefined) {
projectReferenceRedirects.set(sourceFilePath, false);
return undefined;
}
+ commandLine = ts.parseJsonSourceFileConfigFileContent(sourceFile, configParsingHost, basePath, /*existingOptions*/ undefined, refPath);
+ }
sourceFile.path = sourceFilePath;
sourceFile.resolvedPath = sourceFilePath;
sourceFile.originalFileName = refPath;
- var commandLine = ts.parseJsonSourceFileConfigFileContent(sourceFile, configParsingHost, basePath, /*existingOptions*/ undefined, refPath);
var resolvedRef = { commandLine: commandLine, sourceFile: sourceFile };
projectReferenceRedirects.set(sourceFilePath, resolvedRef);
if (commandLine.projectReferences) {
@@ -90002,9 +90941,6 @@
if (ts.getEmitDeclarations(options)) {
createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, getEmitDeclarationOptionName(options), "isolatedModules");
}
- if (options.noEmitOnError) {
- createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules");
- }
if (options.out) {
createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules");
}
@@ -90036,17 +90972,17 @@
createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "tsBuildInfoFile", "incremental", "composite");
}
}
+ else if (options.incremental && !options.outFile && !options.out && !options.configFilePath) {
+ programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified));
+ }
verifyProjectReferences();
// List of collected files is complete; validate exhautiveness if this is a project with a file list
if (options.composite) {
var rootPaths = rootNames.map(toPath);
for (var _i = 0, files_3 = files; _i < files_3.length; _i++) {
var file = files_3[_i];
- // Ignore declaration files
- if (file.isDeclarationFile)
- continue;
- // Ignore json file thats from project reference
- if (ts.isJsonSourceFile(file) && getResolvedProjectReferenceToRedirect(file.fileName))
+ // Ignore file that is not emitted
+ if (!ts.sourceFileMayBeEmitted(file, options, isSourceFileFromExternalLibrary, getResolvedProjectReferenceToRedirect))
continue;
if (rootPaths.indexOf(file.path) === -1) {
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_is_not_in_project_file_list_Projects_must_list_all_files_or_use_an_include_pattern, file.fileName));
@@ -90123,10 +91059,10 @@
if (options.module === ts.ModuleKind.None && languageVersion < 2 /* ES2015 */) {
createDiagnosticForOptionName(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher, "isolatedModules", "target");
}
- var firstNonExternalModuleSourceFile = ts.find(files, function (f) { return !ts.isExternalModule(f) && !f.isDeclarationFile && f.scriptKind !== 6 /* JSON */; });
+ var firstNonExternalModuleSourceFile = ts.find(files, function (f) { return !ts.isExternalModule(f) && !ts.isSourceFileJS(f) && !f.isDeclarationFile && f.scriptKind !== 6 /* JSON */; });
if (firstNonExternalModuleSourceFile) {
var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile);
- programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided));
+ programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.All_files_must_be_modules_when_the_isolatedModules_flag_is_provided));
}
}
else if (firstNonAmbientExternalModuleSourceFile && languageVersion < 2 /* ES2015 */ && options.module === ts.ModuleKind.None) {
@@ -90211,13 +91147,13 @@
var emitFilePath = toPath(emitFileName);
// Report error if the output overwrites input file
if (filesByName.has(emitFilePath)) {
- var chain_2;
+ var chain = void 0;
if (!options.configFilePath) {
// The program is from either an inferred project or an external project
- chain_2 = ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig);
+ chain = ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig);
}
- chain_2 = ts.chainDiagnosticMessages(chain_2, ts.Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file, emitFileName);
- blockEmittingOfFile(emitFileName, ts.createCompilerDiagnosticFromMessageChain(chain_2));
+ chain = ts.chainDiagnosticMessages(chain, ts.Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file, emitFileName);
+ blockEmittingOfFile(emitFileName, ts.createCompilerDiagnosticFromMessageChain(chain));
}
var emitFileKey = !host.useCaseSensitiveFileNames() ? emitFilePath.toLocaleLowerCase() : emitFilePath;
// Report error if multiple files write into same file
@@ -90752,6 +91688,7 @@
cacheToUpdateSignature.set(sourceFile.path, latestSignature);
return !prevSignature || latestSignature !== prevSignature;
}
+ BuilderState.updateShapeSignature = updateShapeSignature;
/**
* Coverts the declaration emit result into exported modules map
*/
@@ -91029,15 +91966,9 @@
}
}
});
- if (oldCompilerOptions &&
- (oldCompilerOptions.outDir !== compilerOptions.outDir ||
- oldCompilerOptions.declarationDir !== compilerOptions.declarationDir ||
- (oldCompilerOptions.outFile || oldCompilerOptions.out) !== (compilerOptions.outFile || compilerOptions.out))) {
+ if (oldCompilerOptions && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
// Add all files to affectedFilesPendingEmit since emit changed
- state.affectedFilesPendingEmit = ts.concatenate(state.affectedFilesPendingEmit, newProgram.getSourceFiles().map(function (f) { return f.path; }));
- if (state.affectedFilesPendingEmitIndex === undefined) {
- state.affectedFilesPendingEmitIndex = 0;
- }
+ addToAffectedFilesPendingEmit(state, newProgram.getSourceFiles().map(function (f) { return f.path; }));
ts.Debug.assert(state.seenAffectedFiles === undefined);
state.seenAffectedFiles = ts.createMap();
}
@@ -91121,7 +92052,7 @@
if (!seenAffectedFiles.has(affectedFile.path)) {
// Set the next affected file as seen and remove the cached semantic diagnostics
state.affectedFilesIndex = affectedFilesIndex;
- cleanSemanticDiagnosticsOfAffectedFile(state, affectedFile);
+ handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash);
return affectedFile;
}
seenAffectedFiles.set(affectedFile.path, true);
@@ -91182,28 +92113,68 @@
return undefined;
}
/**
- * Remove the semantic diagnostics cached from old state for affected File and the files that are referencing modules that export entities from affected file
+ * Handles semantic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file
+ * This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
*/
- function cleanSemanticDiagnosticsOfAffectedFile(state, affectedFile) {
- if (removeSemanticDiagnosticsOf(state, affectedFile.path)) {
- // If there are no more diagnostics from old cache, done
- return;
- }
- // Clean lib file diagnostics if its all files excluding default files to emit
- if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles && !state.cleanedDiagnosticsOfLibFiles) {
+ function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash) {
+ removeSemanticDiagnosticsOf(state, affectedFile.path);
+ // If affected files is everything except default library, then nothing more to do
+ if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
+ if (!state.cleanedDiagnosticsOfLibFiles) {
state.cleanedDiagnosticsOfLibFiles = true;
var program_1 = ts.Debug.assertDefined(state.program);
var options_2 = program_1.getCompilerOptions();
- if (ts.forEach(program_1.getSourceFiles(), function (f) {
+ ts.forEach(program_1.getSourceFiles(), function (f) {
return program_1.isSourceFileDefaultLibrary(f) &&
!ts.skipTypeChecking(f, options_2) &&
removeSemanticDiagnosticsOf(state, f.path);
- })) {
+ });
+ }
return;
}
+ forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, function (state, path) { return handleDtsMayChangeOf(state, path, cancellationToken, computeHash); });
+ }
+ /**
+ * Handle the dts may change, so they need to be added to pending emit if dts emit is enabled,
+ * Also we need to make sure signature is updated for these files
+ */
+ function handleDtsMayChangeOf(state, path, cancellationToken, computeHash) {
+ removeSemanticDiagnosticsOf(state, path);
+ if (!state.changedFilesSet.has(path)) {
+ var program = ts.Debug.assertDefined(state.program);
+ var sourceFile = program.getSourceFileByPath(path);
+ if (sourceFile) {
+ // Even though the js emit doesnt change and we are already handling dts emit and semantic diagnostics
+ // we need to update the signature to reflect correctness of the signature(which is output d.ts emit) of this file
+ // This ensures that we dont later during incremental builds considering wrong signature.
+ // Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
+ ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.assertDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
+ // If not dts emit, nothing more to do
+ if (ts.getEmitDeclarations(state.compilerOptions)) {
+ addToAffectedFilesPendingEmit(state, [path]);
+ }
+ }
}
- // If there was change in signature for the changed file,
- // then delete the semantic diagnostics for files that are affected by using exports of this module
+ return false;
+ }
+ /**
+ * Removes semantic diagnostics for path and
+ * returns true if there are no more semantic diagnostics from the old state
+ */
+ function removeSemanticDiagnosticsOf(state, path) {
+ if (!state.semanticDiagnosticsFromOldState) {
+ return true;
+ }
+ state.semanticDiagnosticsFromOldState.delete(path);
+ state.semanticDiagnosticsPerFile.delete(path);
+ return !state.semanticDiagnosticsFromOldState.size;
+ }
+ /**
+ * Iterate on referencing modules that export entities from affected file
+ */
+ function forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, fn) {
+ // If there was change in signature (dts output) for the changed file,
+ // then only we need to handle pending file emit
if (!state.exportedModulesMap || state.affectedFiles.length === 1 || !state.changedFilesSet.has(affectedFile.path)) {
return;
}
@@ -91214,7 +92185,7 @@
if (ts.forEachEntry(state.currentAffectedFilesExportedModulesMap, function (exportedModules, exportedFromPath) {
return exportedModules &&
exportedModules.has(affectedFile.path) &&
- removeSemanticDiagnosticsOfFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile);
+ forEachFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile, fn);
})) {
return;
}
@@ -91222,26 +92193,25 @@
ts.forEachEntry(state.exportedModulesMap, function (exportedModules, exportedFromPath) {
return !state.currentAffectedFilesExportedModulesMap.has(exportedFromPath) && // If we already iterated this through cache, ignore it
exportedModules.has(affectedFile.path) &&
- removeSemanticDiagnosticsOfFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile);
+ forEachFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile, fn);
});
}
/**
- * removes the semantic diagnostics of files referencing referencedPath and
- * returns true if there are no more semantic diagnostics from old state
+ * Iterate on files referencing referencedPath
*/
- function removeSemanticDiagnosticsOfFilesReferencingPath(state, referencedPath, seenFileAndExportsOfFile) {
+ function forEachFilesReferencingPath(state, referencedPath, seenFileAndExportsOfFile, fn) {
return ts.forEachEntry(state.referencedMap, function (referencesInFile, filePath) {
- return referencesInFile.has(referencedPath) && removeSemanticDiagnosticsOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile);
+ return referencesInFile.has(referencedPath) && forEachFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, fn);
});
}
/**
- * Removes semantic diagnostics of file and anything that exports this file
+ * fn on file and iterate on anything that exports this file
*/
- function removeSemanticDiagnosticsOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile) {
+ function forEachFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, fn) {
if (!ts.addToSeen(seenFileAndExportsOfFile, filePath)) {
return false;
}
- if (removeSemanticDiagnosticsOf(state, filePath)) {
+ if (fn(state, filePath)) {
// If there are no more diagnostics from old cache, done
return true;
}
@@ -91251,7 +92221,7 @@
if (ts.forEachEntry(state.currentAffectedFilesExportedModulesMap, function (exportedModules, exportedFromPath) {
return exportedModules &&
exportedModules.has(filePath) &&
- removeSemanticDiagnosticsOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile);
+ forEachFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, fn);
})) {
return true;
}
@@ -91259,7 +92229,7 @@
if (ts.forEachEntry(state.exportedModulesMap, function (exportedModules, exportedFromPath) {
return !state.currentAffectedFilesExportedModulesMap.has(exportedFromPath) && // If we already iterated this through cache, ignore it
exportedModules.has(filePath) &&
- removeSemanticDiagnosticsOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile);
+ forEachFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, fn);
})) {
return true;
}
@@ -91267,23 +92237,11 @@
return !!ts.forEachEntry(state.referencedMap, function (referencesInFile, referencingFilePath) {
return referencesInFile.has(filePath) &&
!seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
- removeSemanticDiagnosticsOf(state, referencingFilePath);
+ fn(state, referencingFilePath);
} // Dont add to seen since this is not yet done with the export removal
);
}
/**
- * Removes semantic diagnostics for path and
- * returns true if there are no more semantic diagnostics from the old state
- */
- function removeSemanticDiagnosticsOf(state, path) {
- if (!state.semanticDiagnosticsFromOldState) {
- return true;
- }
- state.semanticDiagnosticsFromOldState.delete(path);
- state.semanticDiagnosticsPerFile.delete(path);
- return !state.semanticDiagnosticsFromOldState.size;
- }
- /**
* This is called after completing operation on the next affected file.
* The operations here are postponed to ensure that cancellation during the iteration is handled correctly
*/
@@ -91510,7 +92468,7 @@
return toAffectedFileResult(state,
// When whole program is affected, do emit only once (eg when --out or --outFile is specified)
// Otherwise just affected file
- affected_1.emitBuildInfo(writeFile || host.writeFile, cancellationToken), affected_1,
+ affected_1.emitBuildInfo(writeFile || ts.maybeBind(host, host.writeFile), cancellationToken), affected_1,
/*isPendingEmitFile*/ false,
/*isBuildInfoEmit*/ true);
}
@@ -91526,14 +92484,10 @@
affected = program;
}
}
- // Mark seen emitted files if there are pending files to be emitted
- if (state.affectedFilesPendingEmit && state.program !== affected) {
- (state.seenEmittedFiles || (state.seenEmittedFiles = ts.createMap())).set(affected.path, true);
- }
return toAffectedFileResult(state,
// When whole program is affected, do emit only once (eg when --out or --outFile is specified)
// Otherwise just affected file
- ts.Debug.assertDefined(state.program).emit(affected === state.program ? undefined : affected, writeFile || host.writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers), affected, isPendingEmitFile);
+ ts.Debug.assertDefined(state.program).emit(affected === state.program ? undefined : affected, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers), affected, isPendingEmitFile);
}
/**
* Emits the JavaScript and declaration files.
@@ -91570,7 +92524,7 @@
};
}
}
- return ts.Debug.assertDefined(state.program).emit(targetSourceFile, writeFile || host.writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers);
+ return ts.Debug.assertDefined(state.program).emit(targetSourceFile, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
}
/**
* Return the semantic diagnostics for the next affected file or undefined if iteration is complete
@@ -91627,14 +92581,7 @@
}
// In case of emit builder, cache the files to be emitted
if (affectedFilesPendingEmit) {
- state.affectedFilesPendingEmit = ts.concatenate(state.affectedFilesPendingEmit, affectedFilesPendingEmit);
- // affectedFilesPendingEmitIndex === undefined
- // - means the emit state.affectedFilesPendingEmit was undefined before adding current affected files
- // so start from 0 as array would be affectedFilesPendingEmit
- // else, continue to iterate from existing index, the current set is appended to existing files
- if (state.affectedFilesPendingEmitIndex === undefined) {
- state.affectedFilesPendingEmitIndex = 0;
- }
+ addToAffectedFilesPendingEmit(state, affectedFilesPendingEmit);
}
var diagnostics;
for (var _i = 0, _a = ts.Debug.assertDefined(state.program).getSourceFiles(); _i < _a.length; _i++) {
@@ -91645,6 +92592,16 @@
}
}
ts.createBuilderProgram = createBuilderProgram;
+ function addToAffectedFilesPendingEmit(state, affectedFilesPendingEmit) {
+ state.affectedFilesPendingEmit = ts.concatenate(state.affectedFilesPendingEmit, affectedFilesPendingEmit);
+ // affectedFilesPendingEmitIndex === undefined
+ // - means the emit state.affectedFilesPendingEmit was undefined before adding current affected files
+ // so start from 0 as array would be affectedFilesPendingEmit
+ // else, continue to iterate from existing index, the current set is appended to existing files
+ if (state.affectedFilesPendingEmitIndex === undefined) {
+ state.affectedFilesPendingEmitIndex = 0;
+ }
+ }
function getMapOfReferencedSet(mapLike) {
if (!mapLike)
return undefined;
@@ -92506,11 +93463,11 @@
}
function discoverProbableSymlinks(files, getCanonicalFileName, cwd) {
var result = ts.createMap();
- var symlinks = ts.mapDefined(files, function (sf) {
- return sf.resolvedModules && ts.firstDefinedIterator(sf.resolvedModules.values(), function (res) {
+ var symlinks = ts.flatten(ts.mapDefined(files, function (sf) {
+ return sf.resolvedModules && ts.compact(ts.arrayFrom(ts.mapIterator(sf.resolvedModules.values(), function (res) {
return res && res.originalPath && res.resolvedFileName !== res.originalPath ? [res.resolvedFileName, res.originalPath] : undefined;
- });
- });
+ })));
+ }));
for (var _i = 0, symlinks_1 = symlinks; _i < symlinks_1.length; _i++) {
var _a = symlinks_1[_i], resolvedPath = _a[0], originalPath = _a[1];
var _b = guessDirectorySymlink(resolvedPath, originalPath, cwd, getCanonicalFileName), commonResolved = _b[0], commonOriginal = _b[1];
@@ -92853,6 +93810,14 @@
return "" + newLine + ts.flattenDiagnosticMessageText(d.messageText, newLine) + newLine + newLine;
}
ts.getErrorSummaryText = getErrorSummaryText;
+ function listFiles(program, writeFileName) {
+ if (program.getCompilerOptions().listFiles) {
+ ts.forEach(program.getSourceFiles(), function (file) {
+ writeFileName(file.fileName);
+ });
+ }
+ }
+ ts.listFiles = listFiles;
/**
* Helper that emit files, report diagnostics and lists emitted and/or source files depending on compiler options
*/
@@ -92880,11 +93845,7 @@
var filepath = ts.getNormalizedAbsolutePath(file, currentDir_1);
writeFileName("TSFILE: " + filepath);
});
- if (program.getCompilerOptions().listFiles) {
- ts.forEach(program.getSourceFiles(), function (file) {
- writeFileName(file.fileName);
- });
- }
+ listFiles(program, writeFileName);
}
if (reportSummary) {
reportSummary(getErrorCountForSummary(diagnostics));
@@ -93697,6 +94658,7 @@
function getCompilerOptionsOfBuildOptions(buildOptions) {
var result = {};
ts.commonOptionsWithBuild.forEach(function (option) {
+ if (ts.hasProperty(buildOptions, option.name))
result[option.name] = buildOptions[option.name];
});
return result;
@@ -93716,12 +94678,18 @@
var projectStatus = createFileMap(toPath);
var missingRoots = ts.createMap();
var globalDependencyGraph;
- var writeFileName = function (s) { return host.trace && host.trace(s); };
+ var writeFileName = host.trace ? function (s) { return host.trace(s); } : undefined;
var readFileWithCache = function (f) { return host.readFile(f); };
var projectCompilerOptions = baseCompilerOptions;
var compilerHost = ts.createCompilerHostFromProgramHost(host, function () { return projectCompilerOptions; });
ts.setGetSourceFileAsHashVersioned(compilerHost, host);
+ compilerHost.getParsedCommandLine = parseConfigFile;
+ compilerHost.resolveModuleNames = ts.maybeBind(host, host.resolveModuleNames);
+ compilerHost.resolveTypeReferenceDirectives = ts.maybeBind(host, host.resolveTypeReferenceDirectives);
+ var moduleResolutionCache = !compilerHost.resolveModuleNames ? ts.createModuleResolutionCache(currentDirectory, getCanonicalFileName) : undefined;
+ var cacheState;
var buildInfoChecked = createFileMap(toPath);
+ var extendedConfigCache = ts.createMap();
// Watch state
var builderPrograms = createFileMap(toPath);
var diagnostics = createFileMap(toPath);
@@ -93785,7 +94753,7 @@
}
var diagnostic;
parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = function (d) { return diagnostic = d; };
- var parsed = ts.getParsedCommandLineOfConfigFile(configFilePath, baseCompilerOptions, parseConfigFileHost);
+ var parsed = ts.getParsedCommandLineOfConfigFile(configFilePath, baseCompilerOptions, parseConfigFileHost, extendedConfigCache);
parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = ts.noop;
configFileCache.setValue(configFilePath, parsed || diagnostic);
return parsed;
@@ -94107,6 +95075,7 @@
projectStatus.removeKey(resolved);
diagnostics.removeKey(resolved);
addProjToQueue(resolved, reloadLevel);
+ enableCache();
}
/**
* return true if new addition
@@ -94162,6 +95131,7 @@
}
}
else {
+ disableCache();
reportErrorSummary();
}
}
@@ -94324,6 +95294,28 @@
}
// TODO: handle resolve module name to cache result in project reference redirect
projectCompilerOptions = configFile.options;
+ // Update module resolution cache if needed
+ if (moduleResolutionCache) {
+ var projPath = toPath(proj);
+ if (moduleResolutionCache.directoryToModuleNameMap.redirectsMap.size === 0) {
+ // The own map will be for projectCompilerOptions
+ ts.Debug.assert(moduleResolutionCache.moduleNameToDirectoryMap.redirectsMap.size === 0);
+ moduleResolutionCache.directoryToModuleNameMap.redirectsMap.set(projPath, moduleResolutionCache.directoryToModuleNameMap.ownMap);
+ moduleResolutionCache.moduleNameToDirectoryMap.redirectsMap.set(projPath, moduleResolutionCache.moduleNameToDirectoryMap.ownMap);
+ }
+ else {
+ // Set correct own map
+ ts.Debug.assert(moduleResolutionCache.moduleNameToDirectoryMap.redirectsMap.size > 0);
+ var ref = {
+ sourceFile: projectCompilerOptions.configFile,
+ commandLine: configFile
+ };
+ moduleResolutionCache.directoryToModuleNameMap.setOwnMap(moduleResolutionCache.directoryToModuleNameMap.getOrCreateMapOfCacheRedirects(ref));
+ moduleResolutionCache.moduleNameToDirectoryMap.setOwnMap(moduleResolutionCache.moduleNameToDirectoryMap.getOrCreateMapOfCacheRedirects(ref));
+ }
+ moduleResolutionCache.directoryToModuleNameMap.setOwnOptions(projectCompilerOptions);
+ moduleResolutionCache.moduleNameToDirectoryMap.setOwnOptions(projectCompilerOptions);
+ }
var program = host.createProgram(configFile.fileNames, configFile.options, compilerHost, getOldProgram(proj, configFile), configFile.errors, configFile.projectReferences);
// Don't emit anything in the presence of syntactic errors or options diagnostics
var syntaxDiagnostics = program.getConfigFileParsingDiagnostics().concat(program.getOptionsDiagnostics(), program.getGlobalDiagnostics(), program.getSyntacticDiagnostics());
@@ -94342,7 +95334,7 @@
var declDiagnostics;
var reportDeclarationDiagnostics = function (d) { return (declDiagnostics || (declDiagnostics = [])).push(d); };
var outputFiles = [];
- ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics, writeFileName, /*reportSummary*/ undefined, function (name, text, writeByteOrderMark) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); });
+ ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics, /*writeFileName*/ undefined, /*reportSummary*/ undefined, function (name, text, writeByteOrderMark) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); });
// Don't emit .d.ts if there are decl file errors
if (declDiagnostics) {
program.restoreState();
@@ -94364,7 +95356,7 @@
anyDtsChanged = true;
}
}
- emittedOutputs.setValue(name, true);
+ emittedOutputs.setValue(name, name);
ts.writeFile(compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
if (priorChangeTime !== undefined) {
newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime);
@@ -94375,6 +95367,10 @@
if (emitDiagnostics.length) {
return buildErrors(emitDiagnostics, BuildResultFlags.EmitErrors, "Emit");
}
+ if (writeFileName) {
+ emittedOutputs.forEach(function (name) { return listEmittedFile(configFile, name); });
+ ts.listFiles(program, writeFileName);
+ }
// Update time stamps for rest of the outputs
newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(configFile, newestDeclarationFileContentChangedTime, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
var status = {
@@ -94390,12 +95386,20 @@
function buildErrors(diagnostics, errorFlags, errorType) {
resultFlags |= errorFlags;
reportAndStoreErrors(proj, diagnostics);
+ // List files if any other build error using program (emit errors already report files)
+ if (writeFileName)
+ ts.listFiles(program, writeFileName);
projectStatus.setValue(proj, { type: UpToDateStatusType.Unbuildable, reason: errorType + " errors" });
afterProgramCreate(proj, program);
projectCompilerOptions = baseCompilerOptions;
return resultFlags;
}
}
+ function listEmittedFile(proj, file) {
+ if (writeFileName && proj.options.listEmittedFiles) {
+ writeFileName("TSFILE: " + file);
+ }
+ }
function afterProgramCreate(proj, program) {
if (host.afterProgramEmitAndDiagnostics) {
host.afterProgramEmitAndDiagnostics(program);
@@ -94434,7 +95438,7 @@
var emittedOutputs = createFileMap(toPath);
outputFiles.forEach(function (_a) {
var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
- emittedOutputs.setValue(name, true);
+ emittedOutputs.setValue(name, name);
ts.writeFile(compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
});
var emitDiagnostics = emitterDiagnostics.getDiagnostics();
@@ -94444,6 +95448,9 @@
projectCompilerOptions = baseCompilerOptions;
return BuildResultFlags.DeclarationOutputUnchanged | BuildResultFlags.EmitErrors;
}
+ if (writeFileName) {
+ emittedOutputs.forEach(function (name) { return listEmittedFile(config, name); });
+ }
// Update timestamps for dts
var newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(config, minimumDate, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
var status = {
@@ -94484,9 +95491,7 @@
priorNewestUpdateTime = newer(priorNewestUpdateTime, host.getModifiedTime(file) || ts.missingFileModifiedTime);
}
host.setModifiedTime(file, now);
- if (proj.options.listEmittedFiles) {
- writeFileName("TSFILE: " + file);
- }
+ listEmittedFile(proj, file);
}
}
return priorNewestUpdateTime;
@@ -94531,28 +95536,67 @@
function resolveProjectNames(configFileNames) {
return configFileNames.map(resolveProjectName);
}
- function buildAllProjects() {
- if (options.watch) {
- reportWatchStatus(ts.Diagnostics.Starting_compilation_in_watch_mode);
+ function enableCache() {
+ if (cacheState) {
+ disableCache();
}
- // TODO:: In watch mode as well to use caches for incremental build once we can invalidate caches correctly and have right api
- // Override readFile for json files and output .d.ts to cache the text
- var savedReadFileWithCache = readFileWithCache;
- var savedGetSourceFile = compilerHost.getSourceFile;
+ var originalReadFileWithCache = readFileWithCache;
+ var originalGetSourceFile = compilerHost.getSourceFile;
var _a = ts.changeCompilerHostLikeToUseCache(host, toPath, function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
- return savedGetSourceFile.call.apply(savedGetSourceFile, [compilerHost].concat(args));
+ return originalGetSourceFile.call.apply(originalGetSourceFile, [compilerHost].concat(args));
}), originalReadFile = _a.originalReadFile, originalFileExists = _a.originalFileExists, originalDirectoryExists = _a.originalDirectoryExists, originalCreateDirectory = _a.originalCreateDirectory, originalWriteFile = _a.originalWriteFile, getSourceFileWithCache = _a.getSourceFileWithCache, newReadFileWithCache = _a.readFileWithCache;
readFileWithCache = newReadFileWithCache;
compilerHost.getSourceFile = getSourceFileWithCache;
+ var originalResolveModuleNames = compilerHost.resolveModuleNames;
+ if (!compilerHost.resolveModuleNames) {
+ var loader_3 = function (moduleName, containingFile, redirectedReference) { return ts.resolveModuleName(moduleName, containingFile, projectCompilerOptions, compilerHost, moduleResolutionCache, redirectedReference).resolvedModule; };
+ compilerHost.resolveModuleNames = function (moduleNames, containingFile, _reusedNames, redirectedReference) {
+ return ts.loadWithLocalCache(ts.Debug.assertEachDefined(moduleNames), containingFile, redirectedReference, loader_3);
+ };
+ }
+ cacheState = {
+ originalReadFile: originalReadFile,
+ originalFileExists: originalFileExists,
+ originalDirectoryExists: originalDirectoryExists,
+ originalCreateDirectory: originalCreateDirectory,
+ originalWriteFile: originalWriteFile,
+ originalReadFileWithCache: originalReadFileWithCache,
+ originalGetSourceFile: originalGetSourceFile,
+ originalResolveModuleNames: originalResolveModuleNames
+ };
+ }
+ function disableCache() {
+ if (!cacheState)
+ return;
+ host.readFile = cacheState.originalReadFile;
+ host.fileExists = cacheState.originalFileExists;
+ host.directoryExists = cacheState.originalDirectoryExists;
+ host.createDirectory = cacheState.originalCreateDirectory;
+ host.writeFile = cacheState.originalWriteFile;
+ compilerHost.getSourceFile = cacheState.originalGetSourceFile;
+ readFileWithCache = cacheState.originalReadFileWithCache;
+ compilerHost.resolveModuleNames = cacheState.originalResolveModuleNames;
+ extendedConfigCache.clear();
+ if (moduleResolutionCache) {
+ moduleResolutionCache.directoryToModuleNameMap.clear();
+ moduleResolutionCache.moduleNameToDirectoryMap.clear();
+ }
+ cacheState = undefined;
+ }
+ function buildAllProjects() {
+ if (options.watch) {
+ reportWatchStatus(ts.Diagnostics.Starting_compilation_in_watch_mode);
+ }
+ enableCache();
var graph = getGlobalDependencyGraph();
reportBuildQueue(graph);
var anyFailed = false;
- for (var _i = 0, _b = graph.buildQueue; _i < _b.length; _i++) {
- var next = _b[_i];
+ for (var _i = 0, _a = graph.buildQueue; _i < _a.length; _i++) {
+ var next = _a[_i];
var proj = parseConfigFile(next);
if (proj === undefined) {
reportParseConfigFileDiagnostic(next);
@@ -94596,13 +95640,7 @@
anyFailed = anyFailed || !!(buildResult & BuildResultFlags.AnyErrors);
}
reportErrorSummary();
- host.readFile = originalReadFile;
- host.fileExists = originalFileExists;
- host.directoryExists = originalDirectoryExists;
- host.createDirectory = originalCreateDirectory;
- host.writeFile = originalWriteFile;
- compilerHost.getSourceFile = savedGetSourceFile;
- readFileWithCache = savedReadFileWithCache;
+ disableCache();
return anyFailed ? ts.ExitStatus.DiagnosticsPresent_OutputsSkipped : ts.ExitStatus.Success;
}
function needsBuild(status, configFile) {
@@ -94690,144 +95728,6 @@
}
ts.formatUpToDateStatus = formatUpToDateStatus;
})(ts || (ts = {}));
-/* @internal */
-var ts;
-(function (ts) {
- var ValueKind;
- (function (ValueKind) {
- ValueKind[ValueKind["Const"] = 0] = "Const";
- ValueKind[ValueKind["Array"] = 1] = "Array";
- ValueKind[ValueKind["FunctionOrClass"] = 2] = "FunctionOrClass";
- ValueKind[ValueKind["Object"] = 3] = "Object";
- })(ValueKind = ts.ValueKind || (ts.ValueKind = {}));
- function inspectModule(fileNameToRequire) {
- return inspectValue(ts.removeFileExtension(ts.getBaseFileName(fileNameToRequire)), tryRequire(fileNameToRequire));
- }
- ts.inspectModule = inspectModule;
- function inspectValue(name, value) {
- return getValueInfo(name, value, getRecurser());
- }
- ts.inspectValue = inspectValue;
- function getRecurser() {
- var seen = [];
- var nameStack = [];
- return function (obj, name, cbOk, cbFail) {
- if (seen.indexOf(obj) !== -1 || nameStack.length > 4) {
- return cbFail(seen.indexOf(obj) !== -1, nameStack);
- }
- seen.push(obj);
- nameStack.push(name);
- var res = cbOk();
- nameStack.pop();
- seen.pop();
- return res;
- };
- }
- function getValueInfo(name, value, recurser) {
- return recurser(value, name, function () {
- if (typeof value === "function")
- return getFunctionOrClassInfo(value, name, recurser);
- if (typeof value === "object") {
- var builtin = getBuiltinType(name, value, recurser);
- if (builtin !== undefined)
- return builtin;
- var entries = getEntriesOfObject(value);
- var hasNontrivialPrototype = Object.getPrototypeOf(value) !== Object.prototype;
- var members = ts.flatMap(entries, function (_a) {
- var key = _a.key, value = _a.value;
- return getValueInfo(key, value, recurser);
- });
- return { kind: 3 /* Object */, name: name, hasNontrivialPrototype: hasNontrivialPrototype, members: members };
- }
- return { kind: 0 /* Const */, name: name, typeName: isNullOrUndefined(value) ? "any" : typeof value };
- }, function (isCircularReference, keyStack) { return anyValue(name, " " + (isCircularReference ? "Circular reference" : "Too-deep object hierarchy") + " from " + keyStack.join(".")); });
- }
- function getFunctionOrClassInfo(fn, name, recurser) {
- var prototypeMembers = getPrototypeMembers(fn, recurser);
- var namespaceMembers = ts.flatMap(getEntriesOfObject(fn), function (_a) {
- var key = _a.key, value = _a.value;
- return getValueInfo(key, value, recurser);
- });
- var toString = ts.cast(Function.prototype.toString.call(fn), ts.isString);
- var source = ts.stringContains(toString, "{ [native code] }") ? getFunctionLength(fn) : toString;
- return { kind: 2 /* FunctionOrClass */, name: name, source: source, namespaceMembers: namespaceMembers, prototypeMembers: prototypeMembers };
- }
- var builtins = ts.memoize(function () {
- var map = ts.createMap();
- for (var _i = 0, _a = getEntriesOfObject(global); _i < _a.length; _i++) {
- var _b = _a[_i], key = _b.key, value = _b.value;
- if (typeof value === "function" && typeof value.prototype === "object" && value !== Object) {
- map.set(key, value);
- }
- }
- return map;
- });
- function getBuiltinType(name, value, recurser) {
- return ts.isArray(value)
- ? { name: name, kind: 1 /* Array */, inner: value.length && getValueInfo("element", ts.first(value), recurser) || anyValue(name) }
- : ts.forEachEntry(builtins(), function (builtin, builtinName) {
- return value instanceof builtin ? { kind: 0 /* Const */, name: name, typeName: builtinName } : undefined;
- });
- }
- function getPrototypeMembers(fn, recurser) {
- var prototype = fn.prototype;
- // tslint:disable-next-line no-unnecessary-type-assertion (TODO: update LKG and it will really be unnecessary)
- return typeof prototype !== "object" || prototype === null ? ts.emptyArray : ts.mapDefined(getEntriesOfObject(prototype), function (_a) {
- var key = _a.key, value = _a.value;
- return key === "constructor" ? undefined : getValueInfo(key, value, recurser);
- });
- }
- var ignoredProperties = ["arguments", "caller", "constructor", "eval", "super_"];
- var reservedFunctionProperties = Object.getOwnPropertyNames(ts.noop);
- function getEntriesOfObject(obj) {
- var seen = ts.createMap();
- var entries = [];
- var chain = obj;
- while (!isNullOrUndefined(chain) && chain !== Object.prototype && chain !== Function.prototype) {
- for (var _i = 0, _a = Object.getOwnPropertyNames(chain); _i < _a.length; _i++) {
- var key = _a[_i];
- if (!isJsPrivate(key) &&
- ignoredProperties.indexOf(key) === -1 &&
- (typeof obj !== "function" || reservedFunctionProperties.indexOf(key) === -1) &&
- // Don't add property from a higher prototype if it already exists in a lower one
- ts.addToSeen(seen, key)) {
- var value = safeGetPropertyOfObject(chain, key);
- // Don't repeat "toString" that matches signature from Object.prototype
- if (!(key === "toString" && typeof value === "function" && value.length === 0)) {
- entries.push({ key: key, value: value });
- }
- }
- }
- chain = Object.getPrototypeOf(chain);
- }
- return entries.sort(function (e1, e2) { return ts.compareStringsCaseSensitive(e1.key, e2.key); });
- }
- function getFunctionLength(fn) {
- return ts.tryCast(safeGetPropertyOfObject(fn, "length"), ts.isNumber) || 0;
- }
- function safeGetPropertyOfObject(obj, key) {
- var desc = Object.getOwnPropertyDescriptor(obj, key);
- return desc && desc.value;
- }
- function isNullOrUndefined(value) {
- return value == null; // tslint:disable-line
- }
- function anyValue(name, comment) {
- return { kind: 0 /* Const */, name: name, typeName: "any", comment: comment };
- }
- function isJsPrivate(name) {
- return ts.startsWith(name, "_");
- }
- ts.isJsPrivate = isJsPrivate;
- function tryRequire(fileNameToRequire) {
- try {
- return require(fileNameToRequire);
- }
- catch (_a) {
- return undefined;
- }
- }
-})(ts || (ts = {}));
var ts;
(function (ts) {
var ScriptSnapshot;
@@ -95110,7 +96010,7 @@
/* @internal */
var ts;
(function (ts) {
- ts.scanner = ts.createScanner(7 /* Latest */, /*skipTrivia*/ true);
+ ts.scanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ true);
var SemanticMeaning;
(function (SemanticMeaning) {
SemanticMeaning[SemanticMeaning["None"] = 0] = "None";
@@ -95121,37 +96021,37 @@
})(SemanticMeaning = ts.SemanticMeaning || (ts.SemanticMeaning = {}));
function getMeaningFromDeclaration(node) {
switch (node.kind) {
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return ts.isInJSFile(node) && ts.getJSDocEnumTag(node) ? 7 /* All */ : 1 /* Value */;
- case 151 /* Parameter */:
- case 186 /* BindingElement */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 275 /* PropertyAssignment */:
- case 276 /* ShorthandPropertyAssignment */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 274 /* CatchClause */:
- case 267 /* JsxAttribute */:
+ case 152 /* Parameter */:
+ case 187 /* BindingElement */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 276 /* PropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 275 /* CatchClause */:
+ case 268 /* JsxAttribute */:
return 1 /* Value */;
- case 150 /* TypeParameter */:
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 168 /* TypeLiteral */:
+ case 151 /* TypeParameter */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 169 /* TypeLiteral */:
return 2 /* Type */;
- case 309 /* JSDocTypedefTag */:
+ case 310 /* JSDocTypedefTag */:
// If it has no name node, it shares the name with the value declaration below it.
return node.name === undefined ? 1 /* Value */ | 2 /* Type */ : 2 /* Type */;
- case 278 /* EnumMember */:
- case 240 /* ClassDeclaration */:
+ case 279 /* EnumMember */:
+ case 241 /* ClassDeclaration */:
return 1 /* Value */ | 2 /* Type */;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
if (ts.isAmbientModule(node)) {
return 4 /* Namespace */ | 1 /* Value */;
}
@@ -95161,26 +96061,26 @@
else {
return 4 /* Namespace */;
}
- case 243 /* EnumDeclaration */:
- case 252 /* NamedImports */:
- case 253 /* ImportSpecifier */:
- case 248 /* ImportEqualsDeclaration */:
- case 249 /* ImportDeclaration */:
- case 254 /* ExportAssignment */:
- case 255 /* ExportDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 253 /* NamedImports */:
+ case 254 /* ImportSpecifier */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 255 /* ExportAssignment */:
+ case 256 /* ExportDeclaration */:
return 7 /* All */;
// An external module can be a Value
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return 4 /* Namespace */ | 1 /* Value */;
}
return 7 /* All */;
}
ts.getMeaningFromDeclaration = getMeaningFromDeclaration;
function getMeaningFromLocation(node) {
- if (node.kind === 284 /* SourceFile */) {
+ if (node.kind === 285 /* SourceFile */) {
return 1 /* Value */;
}
- else if (node.parent.kind === 254 /* ExportAssignment */ || node.parent.kind === 259 /* ExternalModuleReference */) {
+ else if (node.parent.kind === 255 /* ExportAssignment */ || node.parent.kind === 260 /* ExternalModuleReference */) {
return 7 /* All */;
}
else if (isInRightSideOfInternalImportEqualsDeclaration(node)) {
@@ -95212,11 +96112,11 @@
// import a = |b|; // Namespace
// import a = |b.c|; // Value, type, namespace
// import a = |b.c|.d; // Namespace
- var name = node.kind === 148 /* QualifiedName */ ? node : ts.isQualifiedName(node.parent) && node.parent.right === node ? node.parent : undefined;
- return name && name.parent.kind === 248 /* ImportEqualsDeclaration */ ? 7 /* All */ : 4 /* Namespace */;
+ var name = node.kind === 149 /* QualifiedName */ ? node : ts.isQualifiedName(node.parent) && node.parent.right === node ? node.parent : undefined;
+ return name && name.parent.kind === 249 /* ImportEqualsDeclaration */ ? 7 /* All */ : 4 /* Namespace */;
}
function isInRightSideOfInternalImportEqualsDeclaration(node) {
- while (node.parent.kind === 148 /* QualifiedName */) {
+ while (node.parent.kind === 149 /* QualifiedName */) {
node = node.parent;
}
return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node;
@@ -95228,27 +96128,27 @@
function isQualifiedNameNamespaceReference(node) {
var root = node;
var isLastClause = true;
- if (root.parent.kind === 148 /* QualifiedName */) {
- while (root.parent && root.parent.kind === 148 /* QualifiedName */) {
+ if (root.parent.kind === 149 /* QualifiedName */) {
+ while (root.parent && root.parent.kind === 149 /* QualifiedName */) {
root = root.parent;
}
isLastClause = root.right === node;
}
- return root.parent.kind === 164 /* TypeReference */ && !isLastClause;
+ return root.parent.kind === 165 /* TypeReference */ && !isLastClause;
}
function isPropertyAccessNamespaceReference(node) {
var root = node;
var isLastClause = true;
- if (root.parent.kind === 189 /* PropertyAccessExpression */) {
- while (root.parent && root.parent.kind === 189 /* PropertyAccessExpression */) {
+ if (root.parent.kind === 190 /* PropertyAccessExpression */) {
+ while (root.parent && root.parent.kind === 190 /* PropertyAccessExpression */) {
root = root.parent;
}
isLastClause = root.name === node;
}
- if (!isLastClause && root.parent.kind === 211 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 273 /* HeritageClause */) {
+ if (!isLastClause && root.parent.kind === 212 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 274 /* HeritageClause */) {
var decl = root.parent.parent.parent;
- return (decl.kind === 240 /* ClassDeclaration */ && root.parent.parent.token === 109 /* ImplementsKeyword */) ||
- (decl.kind === 241 /* InterfaceDeclaration */ && root.parent.parent.token === 86 /* ExtendsKeyword */);
+ return (decl.kind === 241 /* ClassDeclaration */ && root.parent.parent.token === 110 /* ImplementsKeyword */) ||
+ (decl.kind === 242 /* InterfaceDeclaration */ && root.parent.parent.token === 87 /* ExtendsKeyword */);
}
return false;
}
@@ -95257,17 +96157,17 @@
node = node.parent;
}
switch (node.kind) {
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
return !ts.isExpressionNode(node);
- case 178 /* ThisType */:
+ case 179 /* ThisType */:
return true;
}
switch (node.parent.kind) {
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return true;
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return !node.parent.isTypeOf;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent);
}
return false;
@@ -95294,7 +96194,7 @@
ts.climbPastPropertyAccess = climbPastPropertyAccess;
function getTargetLabel(referenceNode, labelName) {
while (referenceNode) {
- if (referenceNode.kind === 233 /* LabeledStatement */ && referenceNode.label.escapedText === labelName) {
+ if (referenceNode.kind === 234 /* LabeledStatement */ && referenceNode.label.escapedText === labelName) {
return referenceNode.label;
}
referenceNode = referenceNode.parent;
@@ -95310,11 +96210,11 @@
}
ts.hasPropertyAccessExpressionWithName = hasPropertyAccessExpressionWithName;
function isJumpStatementTarget(node) {
- return node.kind === 72 /* Identifier */ && ts.isBreakOrContinueStatement(node.parent) && node.parent.label === node;
+ return node.kind === 73 /* Identifier */ && ts.isBreakOrContinueStatement(node.parent) && node.parent.label === node;
}
ts.isJumpStatementTarget = isJumpStatementTarget;
function isLabelOfLabeledStatement(node) {
- return node.kind === 72 /* Identifier */ && ts.isLabeledStatement(node.parent) && node.parent.label === node;
+ return node.kind === 73 /* Identifier */ && ts.isLabeledStatement(node.parent) && node.parent.label === node;
}
ts.isLabelOfLabeledStatement = isLabelOfLabeledStatement;
function isLabelName(node) {
@@ -95326,40 +96226,40 @@
}
ts.isTagName = isTagName;
function isRightSideOfQualifiedName(node) {
- return node.parent.kind === 148 /* QualifiedName */ && node.parent.right === node;
+ return node.parent.kind === 149 /* QualifiedName */ && node.parent.right === node;
}
ts.isRightSideOfQualifiedName = isRightSideOfQualifiedName;
function isRightSideOfPropertyAccess(node) {
- return node && node.parent && node.parent.kind === 189 /* PropertyAccessExpression */ && node.parent.name === node;
+ return node && node.parent && node.parent.kind === 190 /* PropertyAccessExpression */ && node.parent.name === node;
}
ts.isRightSideOfPropertyAccess = isRightSideOfPropertyAccess;
function isNameOfModuleDeclaration(node) {
- return node.parent.kind === 244 /* ModuleDeclaration */ && node.parent.name === node;
+ return node.parent.kind === 245 /* ModuleDeclaration */ && node.parent.name === node;
}
ts.isNameOfModuleDeclaration = isNameOfModuleDeclaration;
function isNameOfFunctionDeclaration(node) {
- return node.kind === 72 /* Identifier */ &&
+ return node.kind === 73 /* Identifier */ &&
ts.isFunctionLike(node.parent) && node.parent.name === node;
}
ts.isNameOfFunctionDeclaration = isNameOfFunctionDeclaration;
function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) {
switch (node.parent.kind) {
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 275 /* PropertyAssignment */:
- case 278 /* EnumMember */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 244 /* ModuleDeclaration */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 276 /* PropertyAssignment */:
+ case 279 /* EnumMember */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 245 /* ModuleDeclaration */:
return ts.getNameOfDeclaration(node.parent) === node;
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return node.parent.argumentExpression === node;
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
return true;
- case 182 /* LiteralType */:
- return node.parent.parent.kind === 180 /* IndexedAccessType */;
+ case 183 /* LiteralType */:
+ return node.parent.parent.kind === 181 /* IndexedAccessType */;
default:
return false;
}
@@ -95383,17 +96283,17 @@
return undefined;
}
switch (node.kind) {
- case 284 /* SourceFile */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
- case 244 /* ModuleDeclaration */:
+ case 285 /* SourceFile */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 245 /* ModuleDeclaration */:
return node;
}
}
@@ -95401,48 +96301,48 @@
ts.getContainerNode = getContainerNode;
function getNodeKind(node) {
switch (node.kind) {
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return ts.isExternalModule(node) ? "module" /* moduleElement */ : "script" /* scriptElement */;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return "module" /* moduleElement */;
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
return "class" /* classElement */;
- case 241 /* InterfaceDeclaration */: return "interface" /* interfaceElement */;
- case 242 /* TypeAliasDeclaration */:
- case 302 /* JSDocCallbackTag */:
- case 309 /* JSDocTypedefTag */:
+ case 242 /* InterfaceDeclaration */: return "interface" /* interfaceElement */;
+ case 243 /* TypeAliasDeclaration */:
+ case 303 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
return "type" /* typeElement */;
- case 243 /* EnumDeclaration */: return "enum" /* enumElement */;
- case 237 /* VariableDeclaration */:
+ case 244 /* EnumDeclaration */: return "enum" /* enumElement */;
+ case 238 /* VariableDeclaration */:
return getKindOfVariableDeclaration(node);
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return getKindOfVariableDeclaration(ts.getRootDeclaration(node));
- case 197 /* ArrowFunction */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
return "function" /* functionElement */;
- case 158 /* GetAccessor */: return "getter" /* memberGetAccessorElement */;
- case 159 /* SetAccessor */: return "setter" /* memberSetAccessorElement */;
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 159 /* GetAccessor */: return "getter" /* memberGetAccessorElement */;
+ case 160 /* SetAccessor */: return "setter" /* memberSetAccessorElement */;
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
return "method" /* memberFunctionElement */;
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
return "property" /* memberVariableElement */;
- case 162 /* IndexSignature */: return "index" /* indexSignatureElement */;
- case 161 /* ConstructSignature */: return "construct" /* constructSignatureElement */;
- case 160 /* CallSignature */: return "call" /* callSignatureElement */;
- case 157 /* Constructor */: return "constructor" /* constructorImplementationElement */;
- case 150 /* TypeParameter */: return "type parameter" /* typeParameterElement */;
- case 278 /* EnumMember */: return "enum member" /* enumMemberElement */;
- case 151 /* Parameter */: return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) ? "property" /* memberVariableElement */ : "parameter" /* parameterElement */;
- case 248 /* ImportEqualsDeclaration */:
- case 253 /* ImportSpecifier */:
- case 257 /* ExportSpecifier */:
- case 251 /* NamespaceImport */:
+ case 163 /* IndexSignature */: return "index" /* indexSignatureElement */;
+ case 162 /* ConstructSignature */: return "construct" /* constructSignatureElement */;
+ case 161 /* CallSignature */: return "call" /* callSignatureElement */;
+ case 158 /* Constructor */: return "constructor" /* constructorImplementationElement */;
+ case 151 /* TypeParameter */: return "type parameter" /* typeParameterElement */;
+ case 279 /* EnumMember */: return "enum member" /* enumMemberElement */;
+ case 152 /* Parameter */: return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) ? "property" /* memberVariableElement */ : "parameter" /* parameterElement */;
+ case 249 /* ImportEqualsDeclaration */:
+ case 254 /* ImportSpecifier */:
+ case 258 /* ExportSpecifier */:
+ case 252 /* NamespaceImport */:
return "alias" /* alias */;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
var kind = ts.getAssignmentDeclarationKind(node);
var right = node.right;
switch (kind) {
@@ -95469,7 +96369,7 @@
return "" /* unknown */;
}
}
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return ts.isImportClause(node.parent) ? "alias" /* alias */ : "" /* unknown */;
default:
return "" /* unknown */;
@@ -95485,12 +96385,12 @@
ts.getNodeKind = getNodeKind;
function isThis(node) {
switch (node.kind) {
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
// case SyntaxKind.ThisType: TODO: GH#9267
return true;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
// 'this' as a parameter
- return ts.identifierIsThisKeyword(node) && node.parent.kind === 151 /* Parameter */;
+ return ts.identifierIsThisKeyword(node) && node.parent.kind === 152 /* Parameter */;
default:
return false;
}
@@ -95555,42 +96455,42 @@
return false;
}
switch (n.kind) {
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
- case 188 /* ObjectLiteralExpression */:
- case 184 /* ObjectBindingPattern */:
- case 168 /* TypeLiteral */:
- case 218 /* Block */:
- case 245 /* ModuleBlock */:
- case 246 /* CaseBlock */:
- case 252 /* NamedImports */:
- case 256 /* NamedExports */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 189 /* ObjectLiteralExpression */:
+ case 185 /* ObjectBindingPattern */:
+ case 169 /* TypeLiteral */:
+ case 219 /* Block */:
+ case 246 /* ModuleBlock */:
+ case 247 /* CaseBlock */:
+ case 253 /* NamedImports */:
+ case 257 /* NamedExports */:
return nodeEndsWith(n, 19 /* CloseBraceToken */, sourceFile);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return isCompletedNode(n.block, sourceFile);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
if (!n.arguments) {
return true;
}
// falls through
- case 191 /* CallExpression */:
- case 195 /* ParenthesizedExpression */:
- case 177 /* ParenthesizedType */:
+ case 192 /* CallExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 178 /* ParenthesizedType */:
return nodeEndsWith(n, 21 /* CloseParenToken */, sourceFile);
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
return isCompletedNode(n.type, sourceFile);
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 161 /* ConstructSignature */:
- case 160 /* CallSignature */:
- case 197 /* ArrowFunction */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 162 /* ConstructSignature */:
+ case 161 /* CallSignature */:
+ case 198 /* ArrowFunction */:
if (n.body) {
return isCompletedNode(n.body, sourceFile);
}
@@ -95600,65 +96500,65 @@
// Even though type parameters can be unclosed, we can get away with
// having at least a closing paren.
return hasChildOfKind(n, 21 /* CloseParenToken */, sourceFile);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return !!n.body && isCompletedNode(n.body, sourceFile);
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
if (n.elseStatement) {
return isCompletedNode(n.elseStatement, sourceFile);
}
return isCompletedNode(n.thenStatement, sourceFile);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return isCompletedNode(n.expression, sourceFile) ||
hasChildOfKind(n, 26 /* SemicolonToken */, sourceFile);
- case 187 /* ArrayLiteralExpression */:
- case 185 /* ArrayBindingPattern */:
- case 190 /* ElementAccessExpression */:
- case 149 /* ComputedPropertyName */:
- case 170 /* TupleType */:
+ case 188 /* ArrayLiteralExpression */:
+ case 186 /* ArrayBindingPattern */:
+ case 191 /* ElementAccessExpression */:
+ case 150 /* ComputedPropertyName */:
+ case 171 /* TupleType */:
return nodeEndsWith(n, 23 /* CloseBracketToken */, sourceFile);
- case 162 /* IndexSignature */:
+ case 163 /* IndexSignature */:
if (n.type) {
return isCompletedNode(n.type, sourceFile);
}
return hasChildOfKind(n, 23 /* CloseBracketToken */, sourceFile);
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
// there is no such thing as terminator token for CaseClause/DefaultClause so for simplicity always consider them non-completed
return false;
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 224 /* WhileStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 225 /* WhileStatement */:
return isCompletedNode(n.statement, sourceFile);
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
// rough approximation: if DoStatement has While keyword - then if node is completed is checking the presence of ')';
- return hasChildOfKind(n, 107 /* WhileKeyword */, sourceFile)
+ return hasChildOfKind(n, 108 /* WhileKeyword */, sourceFile)
? nodeEndsWith(n, 21 /* CloseParenToken */, sourceFile)
: isCompletedNode(n.statement, sourceFile);
- case 167 /* TypeQuery */:
+ case 168 /* TypeQuery */:
return isCompletedNode(n.exprName, sourceFile);
- case 199 /* TypeOfExpression */:
- case 198 /* DeleteExpression */:
- case 200 /* VoidExpression */:
- case 207 /* YieldExpression */:
- case 208 /* SpreadElement */:
+ case 200 /* TypeOfExpression */:
+ case 199 /* DeleteExpression */:
+ case 201 /* VoidExpression */:
+ case 208 /* YieldExpression */:
+ case 209 /* SpreadElement */:
var unaryWordExpression = n;
return isCompletedNode(unaryWordExpression.expression, sourceFile);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return isCompletedNode(n.template, sourceFile);
- case 206 /* TemplateExpression */:
+ case 207 /* TemplateExpression */:
var lastSpan = ts.lastOrUndefined(n.templateSpans);
return isCompletedNode(lastSpan, sourceFile);
- case 216 /* TemplateSpan */:
+ case 217 /* TemplateSpan */:
return ts.nodeIsPresent(n.literal);
- case 255 /* ExportDeclaration */:
- case 249 /* ImportDeclaration */:
+ case 256 /* ExportDeclaration */:
+ case 250 /* ImportDeclaration */:
return ts.nodeIsPresent(n.moduleSpecifier);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return isCompletedNode(n.operand, sourceFile);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return isCompletedNode(n.right, sourceFile);
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return isCompletedNode(n.whenFalse, sourceFile);
default:
return true;
@@ -95837,7 +96737,7 @@
}
}
}
- ts.Debug.assert(startNode !== undefined || n.kind === 284 /* SourceFile */ || n.kind === 1 /* EndOfFileToken */ || ts.isJSDocCommentContainingNode(n));
+ ts.Debug.assert(startNode !== undefined || n.kind === 285 /* SourceFile */ || n.kind === 1 /* EndOfFileToken */ || ts.isJSDocCommentContainingNode(n));
// Here we know that none of child token nodes embrace the position,
// the only known case is when position is at the end of the file.
// Try to find the rightmost token in the file without filtering.
@@ -95907,17 +96807,17 @@
return true;
}
// <div> { | </div> or <div a={| </div>
- if (token.kind === 28 /* LessThanToken */ && token.parent.kind === 270 /* JsxExpression */) {
+ if (token.kind === 28 /* LessThanToken */ && token.parent.kind === 271 /* JsxExpression */) {
return true;
}
// <div> {
// |
// } < /div>
- if (token && token.kind === 19 /* CloseBraceToken */ && token.parent.kind === 270 /* JsxExpression */) {
+ if (token && token.kind === 19 /* CloseBraceToken */ && token.parent.kind === 271 /* JsxExpression */) {
return true;
}
// <div>|</div>
- if (token.kind === 28 /* LessThanToken */ && token.parent.kind === 263 /* JsxClosingElement */) {
+ if (token.kind === 28 /* LessThanToken */ && token.parent.kind === 264 /* JsxClosingElement */) {
return true;
}
return false;
@@ -96036,15 +96936,15 @@
nTypeArguments++;
break;
case 37 /* EqualsGreaterThanToken */:
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
case 10 /* StringLiteral */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
- case 104 /* TypeOfKeyword */:
- case 86 /* ExtendsKeyword */:
- case 129 /* KeyOfKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
+ case 105 /* TypeOfKeyword */:
+ case 87 /* ExtendsKeyword */:
+ case 130 /* KeyOfKeyword */:
case 24 /* DotToken */:
case 50 /* BarToken */:
case 56 /* QuestionToken */:
@@ -96103,10 +97003,10 @@
}
ts.getNodeModifiers = getNodeModifiers;
function getTypeArgumentOrTypeParameterList(node) {
- if (node.kind === 164 /* TypeReference */ || node.kind === 191 /* CallExpression */) {
+ if (node.kind === 165 /* TypeReference */ || node.kind === 192 /* CallExpression */) {
return node.typeArguments;
}
- if (ts.isFunctionLike(node) || node.kind === 240 /* ClassDeclaration */ || node.kind === 241 /* InterfaceDeclaration */) {
+ if (ts.isFunctionLike(node) || node.kind === 241 /* ClassDeclaration */ || node.kind === 242 /* InterfaceDeclaration */) {
return node.typeParameters;
}
return undefined;
@@ -96126,7 +97026,7 @@
}
ts.isStringOrRegularExpressionOrTemplateLiteral = isStringOrRegularExpressionOrTemplateLiteral;
function isPunctuation(kind) {
- return 18 /* FirstPunctuation */ <= kind && kind <= 71 /* LastPunctuation */;
+ return 18 /* FirstPunctuation */ <= kind && kind <= 72 /* LastPunctuation */;
}
ts.isPunctuation = isPunctuation;
function isInsideTemplateLiteral(node, position, sourceFile) {
@@ -96136,9 +97036,9 @@
ts.isInsideTemplateLiteral = isInsideTemplateLiteral;
function isAccessibilityModifier(kind) {
switch (kind) {
- case 115 /* PublicKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
+ case 116 /* PublicKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
return true;
}
return false;
@@ -96151,18 +97051,18 @@
}
ts.cloneCompilerOptions = cloneCompilerOptions;
function isArrayLiteralOrObjectLiteralDestructuringPattern(node) {
- if (node.kind === 187 /* ArrayLiteralExpression */ ||
- node.kind === 188 /* ObjectLiteralExpression */) {
+ if (node.kind === 188 /* ArrayLiteralExpression */ ||
+ node.kind === 189 /* ObjectLiteralExpression */) {
// [a,b,c] from:
// [a, b, c] = someExpression;
- if (node.parent.kind === 204 /* BinaryExpression */ &&
+ if (node.parent.kind === 205 /* BinaryExpression */ &&
node.parent.left === node &&
- node.parent.operatorToken.kind === 59 /* EqualsToken */) {
+ node.parent.operatorToken.kind === 60 /* EqualsToken */) {
return true;
}
// [a, b, c] from:
// for([a, b, c] of expression)
- if (node.parent.kind === 227 /* ForOfStatement */ &&
+ if (node.parent.kind === 228 /* ForOfStatement */ &&
node.parent.initializer === node) {
return true;
}
@@ -96170,7 +97070,7 @@
// [x, [a, b, c] ] = someExpression
// or
// {x, a: {a, b, c} } = someExpression
- if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 275 /* PropertyAssignment */ ? node.parent.parent : node.parent)) {
+ if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 276 /* PropertyAssignment */ ? node.parent.parent : node.parent)) {
return true;
}
}
@@ -96214,22 +97114,22 @@
}
ts.createTextChange = createTextChange;
ts.typeKeywords = [
- 120 /* AnyKeyword */,
- 146 /* BigIntKeyword */,
- 123 /* BooleanKeyword */,
- 87 /* FalseKeyword */,
- 129 /* KeyOfKeyword */,
- 132 /* NeverKeyword */,
- 96 /* NullKeyword */,
- 135 /* NumberKeyword */,
- 136 /* ObjectKeyword */,
- 138 /* StringKeyword */,
- 139 /* SymbolKeyword */,
- 102 /* TrueKeyword */,
- 106 /* VoidKeyword */,
- 141 /* UndefinedKeyword */,
- 142 /* UniqueKeyword */,
- 143 /* UnknownKeyword */,
+ 121 /* AnyKeyword */,
+ 147 /* BigIntKeyword */,
+ 124 /* BooleanKeyword */,
+ 88 /* FalseKeyword */,
+ 130 /* KeyOfKeyword */,
+ 133 /* NeverKeyword */,
+ 97 /* NullKeyword */,
+ 136 /* NumberKeyword */,
+ 137 /* ObjectKeyword */,
+ 139 /* StringKeyword */,
+ 140 /* SymbolKeyword */,
+ 103 /* TrueKeyword */,
+ 107 /* VoidKeyword */,
+ 142 /* UndefinedKeyword */,
+ 143 /* UniqueKeyword */,
+ 144 /* UnknownKeyword */,
];
function isTypeKeyword(kind) {
return ts.contains(ts.typeKeywords, kind);
@@ -96265,7 +97165,7 @@
}
ts.skipConstraint = skipConstraint;
function getNameFromPropertyName(name) {
- return name.kind === 149 /* ComputedPropertyName */
+ return name.kind === 150 /* ComputedPropertyName */
// treat computed property names where expression is string/numeric literal as just string/numeric literal
? ts.isStringOrNumericLiteralLike(name.expression) ? name.expression.text : undefined
: ts.getTextOfIdentifierOrLiteral(name);
@@ -96341,7 +97241,7 @@
}
return ts.firstDefined(symbol.declarations, function (decl) {
var name = ts.getNameOfDeclaration(decl);
- return name && name.kind === 72 /* Identifier */ ? name.escapedText : undefined;
+ return name && name.kind === 73 /* Identifier */ ? name.escapedText : undefined;
});
}
ts.symbolEscapedNameNoDefault = symbolEscapedNameNoDefault;
@@ -96430,7 +97330,7 @@
/* @internal */
(function (ts) {
function isFirstDeclarationOfSymbolParameter(symbol) {
- return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 151 /* Parameter */;
+ return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 152 /* Parameter */;
}
ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter;
var displayPartWriter = getDisplayPartWriter();
@@ -96684,17 +97584,25 @@
return ts.ensureScriptKind(fileName, host && host.getScriptKind && host.getScriptKind(fileName));
}
ts.getScriptKind = getScriptKind;
- function getSymbolTarget(symbol) {
+ function getSymbolTarget(symbol, checker) {
var next = symbol;
- while (isTransientSymbol(next) && next.target) {
+ while (isAliasSymbol(next) || (isTransientSymbol(next) && next.target)) {
+ if (isTransientSymbol(next) && next.target) {
next = next.target;
}
+ else {
+ next = ts.skipAlias(next, checker);
+ }
+ }
return next;
}
ts.getSymbolTarget = getSymbolTarget;
function isTransientSymbol(symbol) {
return (symbol.flags & 33554432 /* Transient */) !== 0;
}
+ function isAliasSymbol(symbol) {
+ return (symbol.flags & 2097152 /* Alias */) !== 0;
+ }
function getUniqueSymbolId(symbol, checker) {
return ts.getSymbolId(ts.skipAlias(symbol, checker));
}
@@ -96730,7 +97638,14 @@
function getSynthesizedDeepCloneWithRenames(node, includeTrivia, renameMap, checker, callback) {
if (includeTrivia === void 0) { includeTrivia = true; }
var clone;
- if (ts.isIdentifier(node) && renameMap && checker) {
+ if (renameMap && checker && ts.isBindingElement(node) && ts.isIdentifier(node.name) && ts.isObjectBindingPattern(node.parent)) {
+ var symbol = checker.getSymbolAtLocation(node.name);
+ var renameInfo = symbol && renameMap.get(String(ts.getSymbolId(symbol)));
+ if (renameInfo && renameInfo.text !== (node.name || node.propertyName).getText()) {
+ clone = ts.createBindingElement(node.dotDotDotToken, node.propertyName || node.name, renameInfo, node.initializer);
+ }
+ }
+ else if (renameMap && checker && ts.isIdentifier(node)) {
var symbol = checker.getSymbolAtLocation(node);
var renameInfo = symbol && renameMap.get(String(ts.getSymbolId(symbol)));
if (renameInfo) {
@@ -96894,15 +97809,15 @@
function getContextualTypeFromParent(node, checker) {
var parent = node.parent;
switch (parent.kind) {
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return checker.getContextualType(parent);
- case 204 /* BinaryExpression */: {
+ case 205 /* BinaryExpression */: {
var _a = parent, left = _a.left, operatorToken = _a.operatorToken, right = _a.right;
return isEqualityOperatorKind(operatorToken.kind)
? checker.getTypeAtLocation(node === right ? left : right)
: checker.getContextualType(node);
}
- case 271 /* CaseClause */:
+ case 272 /* CaseClause */:
return parent.expression === node ? getSwitchedType(parent, checker) : undefined;
default:
return checker.getContextualType(node);
@@ -96944,8 +97859,8 @@
switch (node.kind) {
case 10 /* StringLiteral */:
case 14 /* NoSubstitutionTemplateLiteral */:
- case 206 /* TemplateExpression */:
- case 193 /* TaggedTemplateExpression */:
+ case 207 /* TemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return true;
default:
return false;
@@ -96988,7 +97903,7 @@
var ts;
(function (ts) {
function createClassifier() {
- var scanner = ts.createScanner(7 /* Latest */, /*skipTrivia*/ false);
+ var scanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false);
function getClassificationsForLine(text, lexState, syntacticClassifierAbsent) {
return convertClassificationsToResult(getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent), text);
}
@@ -97065,13 +97980,13 @@
function handleToken() {
switch (token) {
case 42 /* SlashToken */:
- case 64 /* SlashEqualsToken */:
+ case 65 /* SlashEqualsToken */:
if (!noRegexTable[lastNonTriviaToken] && scanner.reScanSlashToken() === 13 /* RegularExpressionLiteral */) {
token = 13 /* RegularExpressionLiteral */;
}
break;
case 28 /* LessThanToken */:
- if (lastNonTriviaToken === 72 /* Identifier */) {
+ if (lastNonTriviaToken === 73 /* Identifier */) {
// Could be the start of something generic. Keep track of that by bumping
// up the current count of generic contexts we may be in.
angleBracketStack++;
@@ -97084,16 +97999,16 @@
angleBracketStack--;
}
break;
- case 120 /* AnyKeyword */:
- case 138 /* StringKeyword */:
- case 135 /* NumberKeyword */:
- case 123 /* BooleanKeyword */:
- case 139 /* SymbolKeyword */:
+ case 121 /* AnyKeyword */:
+ case 139 /* StringKeyword */:
+ case 136 /* NumberKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 140 /* SymbolKeyword */:
if (angleBracketStack > 0 && !syntacticClassifierAbsent) {
// If it looks like we're could be in something generic, don't classify this
// as a keyword. We may just get overwritten by the syntactic classifier,
// causing a noisy experience for the user.
- token = 72 /* Identifier */;
+ token = 73 /* Identifier */;
}
break;
case 15 /* TemplateHead */:
@@ -97132,14 +98047,14 @@
break;
}
if (lastNonTriviaToken === 24 /* DotToken */) {
- token = 72 /* Identifier */;
+ token = 73 /* Identifier */;
}
else if (ts.isKeyword(lastNonTriviaToken) && ts.isKeyword(token) && !canFollow(lastNonTriviaToken, token)) {
// We have two keywords in a row. Only treat the second as a keyword if
// it's a sequence that could legally occur in the language. Otherwise
// treat it as an identifier. This way, if someone writes "private var"
// we recognize that 'var' is actually an identifier here.
- token = 72 /* Identifier */;
+ token = 73 /* Identifier */;
}
}
}
@@ -97153,19 +98068,19 @@
/// we have a series of divide operator. this list allows us to be more accurate by ruling out
/// locations where a regexp cannot exist.
var noRegexTable = ts.arrayToNumericMap([
- 72 /* Identifier */,
+ 73 /* Identifier */,
10 /* StringLiteral */,
8 /* NumericLiteral */,
9 /* BigIntLiteral */,
13 /* RegularExpressionLiteral */,
- 100 /* ThisKeyword */,
+ 101 /* ThisKeyword */,
44 /* PlusPlusToken */,
45 /* MinusMinusToken */,
21 /* CloseParenToken */,
23 /* CloseBracketToken */,
19 /* CloseBraceToken */,
- 102 /* TrueKeyword */,
- 87 /* FalseKeyword */,
+ 103 /* TrueKeyword */,
+ 88 /* FalseKeyword */,
], function (token) { return token; }, function () { return true; });
function getNewEndOfLineState(scanner, token, lastOnTemplateStack) {
switch (token) {
@@ -97277,10 +98192,10 @@
return true;
}
switch (keyword2) {
- case 126 /* GetKeyword */:
- case 137 /* SetKeyword */:
- case 124 /* ConstructorKeyword */:
- case 116 /* StaticKeyword */:
+ case 127 /* GetKeyword */:
+ case 138 /* SetKeyword */:
+ case 125 /* ConstructorKeyword */:
+ case 117 /* StaticKeyword */:
return true; // Allow things like "public get", "public constructor" and "public static".
default:
return false; // Any other keyword following "public" is actually an identifier, not a real keyword.
@@ -97325,9 +98240,9 @@
case 30 /* GreaterThanToken */:
case 31 /* LessThanEqualsToken */:
case 32 /* GreaterThanEqualsToken */:
- case 94 /* InstanceOfKeyword */:
- case 93 /* InKeyword */:
- case 119 /* AsKeyword */:
+ case 95 /* InstanceOfKeyword */:
+ case 94 /* InKeyword */:
+ case 120 /* AsKeyword */:
case 33 /* EqualsEqualsToken */:
case 34 /* ExclamationEqualsToken */:
case 35 /* EqualsEqualsEqualsToken */:
@@ -97337,18 +98252,18 @@
case 50 /* BarToken */:
case 54 /* AmpersandAmpersandToken */:
case 55 /* BarBarToken */:
- case 70 /* BarEqualsToken */:
- case 69 /* AmpersandEqualsToken */:
- case 71 /* CaretEqualsToken */:
- case 66 /* LessThanLessThanEqualsToken */:
- case 67 /* GreaterThanGreaterThanEqualsToken */:
- case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
- case 60 /* PlusEqualsToken */:
- case 61 /* MinusEqualsToken */:
- case 62 /* AsteriskEqualsToken */:
- case 64 /* SlashEqualsToken */:
- case 65 /* PercentEqualsToken */:
- case 59 /* EqualsToken */:
+ case 71 /* BarEqualsToken */:
+ case 70 /* AmpersandEqualsToken */:
+ case 72 /* CaretEqualsToken */:
+ case 67 /* LessThanLessThanEqualsToken */:
+ case 68 /* GreaterThanGreaterThanEqualsToken */:
+ case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
+ case 61 /* PlusEqualsToken */:
+ case 62 /* MinusEqualsToken */:
+ case 63 /* AsteriskEqualsToken */:
+ case 65 /* SlashEqualsToken */:
+ case 66 /* PercentEqualsToken */:
+ case 60 /* EqualsToken */:
case 27 /* CommaToken */:
return true;
default:
@@ -97375,7 +98290,7 @@
else if (isBinaryExpressionOperatorToken(token) || isPrefixUnaryExpressionOperatorToken(token)) {
return 5 /* operator */;
}
- else if (token >= 18 /* FirstPunctuation */ && token <= 71 /* LastPunctuation */) {
+ else if (token >= 18 /* FirstPunctuation */ && token <= 72 /* LastPunctuation */) {
return 10 /* punctuation */;
}
switch (token) {
@@ -97394,7 +98309,7 @@
case 5 /* WhitespaceTrivia */:
case 4 /* NewLineTrivia */:
return 8 /* whiteSpace */;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
default:
if (ts.isTemplateLiteralKind(token)) {
return 6 /* stringLiteral */;
@@ -97419,10 +98334,10 @@
// That means we're calling back into the host around every 1.2k of the file we process.
// Lib.d.ts has similar numbers.
switch (kind) {
- case 244 /* ModuleDeclaration */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 239 /* FunctionDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 240 /* FunctionDeclaration */:
cancellationToken.throwIfCancellationRequested();
}
}
@@ -97542,8 +98457,8 @@
var spanStart = span.start;
var spanLength = span.length;
// Make a scanner we can get trivia from.
- var triviaScanner = ts.createScanner(7 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
- var mergeConflictScanner = ts.createScanner(7 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
+ var triviaScanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
+ var mergeConflictScanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
var result = [];
processElement(sourceFile);
return { spans: result, endOfLineState: 0 /* None */ };
@@ -97635,18 +98550,18 @@
pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18 /* docCommentTagName */); // e.g. "param"
pos = tag.tagName.end;
switch (tag.kind) {
- case 304 /* JSDocParameterTag */:
+ case 305 /* JSDocParameterTag */:
processJSDocParameterTag(tag);
break;
- case 308 /* JSDocTemplateTag */:
+ case 309 /* JSDocTemplateTag */:
processJSDocTemplateTag(tag);
pos = tag.end;
break;
- case 307 /* JSDocTypeTag */:
+ case 308 /* JSDocTypeTag */:
processElement(tag.typeExpression);
pos = tag.end;
break;
- case 305 /* JSDocReturnTag */:
+ case 306 /* JSDocReturnTag */:
processElement(tag.typeExpression);
pos = tag.end;
break;
@@ -97733,22 +98648,22 @@
}
function tryClassifyJsxElementName(token) {
switch (token.parent && token.parent.kind) {
- case 262 /* JsxOpeningElement */:
+ case 263 /* JsxOpeningElement */:
if (token.parent.tagName === token) {
return 19 /* jsxOpenTagName */;
}
break;
- case 263 /* JsxClosingElement */:
+ case 264 /* JsxClosingElement */:
if (token.parent.tagName === token) {
return 20 /* jsxCloseTagName */;
}
break;
- case 261 /* JsxSelfClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
if (token.parent.tagName === token) {
return 21 /* jsxSelfClosingTagName */;
}
break;
- case 267 /* JsxAttribute */:
+ case 268 /* JsxAttribute */:
if (token.parent.name === token) {
return 22 /* jsxAttribute */;
}
@@ -97775,19 +98690,19 @@
if (ts.isPunctuation(tokenKind)) {
if (token) {
var parent = token.parent;
- if (tokenKind === 59 /* EqualsToken */) {
+ if (tokenKind === 60 /* EqualsToken */) {
// the '=' in a variable declaration is special cased here.
- if (parent.kind === 237 /* VariableDeclaration */ ||
- parent.kind === 154 /* PropertyDeclaration */ ||
- parent.kind === 151 /* Parameter */ ||
- parent.kind === 267 /* JsxAttribute */) {
+ if (parent.kind === 238 /* VariableDeclaration */ ||
+ parent.kind === 155 /* PropertyDeclaration */ ||
+ parent.kind === 152 /* Parameter */ ||
+ parent.kind === 268 /* JsxAttribute */) {
return 5 /* operator */;
}
}
- if (parent.kind === 204 /* BinaryExpression */ ||
- parent.kind === 202 /* PrefixUnaryExpression */ ||
- parent.kind === 203 /* PostfixUnaryExpression */ ||
- parent.kind === 205 /* ConditionalExpression */) {
+ if (parent.kind === 205 /* BinaryExpression */ ||
+ parent.kind === 203 /* PrefixUnaryExpression */ ||
+ parent.kind === 204 /* PostfixUnaryExpression */ ||
+ parent.kind === 206 /* ConditionalExpression */) {
return 5 /* operator */;
}
}
@@ -97801,7 +98716,7 @@
}
else if (tokenKind === 10 /* StringLiteral */) {
// TODO: GH#18217
- return token.parent.kind === 267 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */;
+ return token.parent.kind === 268 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */;
}
else if (tokenKind === 13 /* RegularExpressionLiteral */) {
// TODO: we should get another classification type for these literals.
@@ -97814,35 +98729,35 @@
else if (tokenKind === 11 /* JsxText */) {
return 23 /* jsxText */;
}
- else if (tokenKind === 72 /* Identifier */) {
+ else if (tokenKind === 73 /* Identifier */) {
if (token) {
switch (token.parent.kind) {
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
if (token.parent.name === token) {
return 11 /* className */;
}
return;
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
if (token.parent.name === token) {
return 15 /* typeParameterName */;
}
return;
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
if (token.parent.name === token) {
return 13 /* interfaceName */;
}
return;
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
if (token.parent.name === token) {
return 12 /* enumName */;
}
return;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
if (token.parent.name === token) {
return 14 /* moduleName */;
}
return;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
if (token.parent.name === token) {
return ts.isThisIdentifier(token) ? 3 /* keyword */ : 17 /* parameterName */;
}
@@ -97899,7 +98814,7 @@
return convertPathCompletions(completion.paths);
case 1 /* Properties */: {
var entries = [];
- Completions.getCompletionEntriesFromSymbols(completion.symbols, entries, sourceFile, sourceFile, checker, 7 /* ESNext */, log, 4 /* String */, preferences); // Target will not be used, so arbitrary
+ Completions.getCompletionEntriesFromSymbols(completion.symbols, entries, sourceFile, sourceFile, checker, 8 /* ESNext */, log, 4 /* String */, preferences); // Target will not be used, so arbitrary
return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: completion.hasIndexSignature, entries: entries };
}
case 2 /* Types */: {
@@ -97938,7 +98853,7 @@
var isNewIdentifierLocation = true; // The user may type in a path that doesn't yet exist, creating a "new identifier" with respect to the collection of identifiers the server is aware of.
var entries = pathCompletions.map(function (_a) {
var name = _a.name, kind = _a.kind, span = _a.span, extension = _a.extension;
- return ({ name: name, kind: kind, kindModifiers: kindModifiersFromExtension(extension), sortText: "0", replacementSpan: span });
+ return ({ name: name, kind: kind, kindModifiers: kindModifiersFromExtension(extension), sortText: Completions.SortText.LocationPriority, replacementSpan: span });
});
return { isGlobalCompletion: isGlobalCompletion, isMemberCompletion: false, isNewIdentifierLocation: isNewIdentifierLocation, entries: entries };
}
@@ -97965,11 +98880,11 @@
function getStringLiteralCompletionEntries(sourceFile, node, position, typeChecker, compilerOptions, host) {
var parent = node.parent;
switch (parent.kind) {
- case 182 /* LiteralType */:
+ case 183 /* LiteralType */:
switch (parent.parent.kind) {
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return { kind: 2 /* Types */, types: getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(parent)), isNewIdentifier: false };
- case 180 /* IndexedAccessType */:
+ case 181 /* IndexedAccessType */:
// Get all apparent property names
// i.e. interface Foo {
// foo: string;
@@ -97977,9 +98892,9 @@
// }
// let x: Foo["/*completion position*/"]
return stringLiteralCompletionsFromProperties(typeChecker.getTypeFromTypeNode(parent.parent.objectType));
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker) };
- case 173 /* UnionType */: {
+ case 174 /* UnionType */: {
if (!ts.isTypeReferenceNode(parent.parent.parent))
return undefined;
var alreadyUsedTypes_1 = getAlreadyUsedTypesInStringLiteralUnion(parent.parent, parent);
@@ -97989,7 +98904,7 @@
default:
return undefined;
}
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
if (ts.isObjectLiteralExpression(parent.parent) && parent.name === node) {
// Get quoted name of properties of the object literal expression
// i.e. interface ConfigFiles {
@@ -98006,7 +98921,7 @@
return stringLiteralCompletionsFromProperties(typeChecker.getContextualType(parent.parent));
}
return fromContextualType();
- case 190 /* ElementAccessExpression */: {
+ case 191 /* ElementAccessExpression */: {
var _a = parent, expression = _a.expression, argumentExpression = _a.argumentExpression;
if (node === argumentExpression) {
// Get all names of properties on the expression
@@ -98019,8 +98934,8 @@
}
return undefined;
}
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
if (!ts.isRequireCall(parent, /*checkArgumentIsStringLiteralLike*/ false) && !ts.isImportCall(parent)) {
var argumentInfo = ts.SignatureHelp.getArgumentInfoForCompletions(node, position, sourceFile);
// Get string literal completions from specialized signatures of the target
@@ -98029,9 +98944,9 @@
return argumentInfo ? getStringLiteralCompletionsFromSignature(argumentInfo, typeChecker) : fromContextualType();
}
// falls through (is `require("")` or `import("")`)
- case 249 /* ImportDeclaration */:
- case 255 /* ExportDeclaration */:
- case 259 /* ExternalModuleReference */:
+ case 250 /* ImportDeclaration */:
+ case 256 /* ExportDeclaration */:
+ case 260 /* ExternalModuleReference */:
// Get all known external module names or complete a path to a module
// i.e. import * as ns from "/*completion position*/";
// var y = import("/*completion position*/");
@@ -98478,7 +99393,7 @@
var offset = index !== -1 ? index + 1 : 0;
// If the range is an identifier, span is unnecessary.
var length = text.length - offset;
- return length === 0 || ts.isIdentifierText(text.substr(offset, length), 7 /* ESNext */) ? undefined : ts.createTextSpan(textStart + offset, length);
+ return length === 0 || ts.isIdentifierText(text.substr(offset, length), 8 /* ESNext */) ? undefined : ts.createTextSpan(textStart + offset, length);
}
// Returns true if the path is explicitly relative to the script (i.e. relative to . or ..)
function isPathRelativeToScript(path) {
@@ -98541,6 +99456,14 @@
(function (ts) {
var Completions;
(function (Completions) {
+ var SortText;
+ (function (SortText) {
+ SortText["LocationPriority"] = "0";
+ SortText["SuggestedClassMembers"] = "1";
+ SortText["GlobalsOrKeywords"] = "2";
+ SortText["AutoImportSuggestions"] = "3";
+ SortText["JavascriptIdentifiers"] = "4";
+ })(SortText = Completions.SortText || (Completions.SortText = {}));
var SymbolOriginInfoKind;
(function (SymbolOriginInfoKind) {
SymbolOriginInfoKind[SymbolOriginInfoKind["ThisType"] = 0] = "ThisType";
@@ -98575,14 +99498,15 @@
var typeChecker = program.getTypeChecker();
var compilerOptions = program.getCompilerOptions();
var contextToken = ts.findPrecedingToken(position, sourceFile);
- if (triggerCharacter && !isValidTrigger(sourceFile, triggerCharacter, contextToken, position))
+ if (triggerCharacter && !ts.isInString(sourceFile, position, contextToken) && !isValidTrigger(sourceFile, triggerCharacter, contextToken, position)) {
return undefined;
+ }
var stringCompletions = Completions.StringCompletions.getStringLiteralCompletions(sourceFile, position, contextToken, typeChecker, compilerOptions, host, log, preferences);
if (stringCompletions) {
return stringCompletions;
}
if (contextToken && ts.isBreakOrContinueStatement(contextToken.parent)
- && (contextToken.kind === 73 /* BreakKeyword */ || contextToken.kind === 78 /* ContinueKeyword */ || contextToken.kind === 72 /* Identifier */)) {
+ && (contextToken.kind === 74 /* BreakKeyword */ || contextToken.kind === 79 /* ContinueKeyword */ || contextToken.kind === 73 /* Identifier */)) {
return getLabelCompletionAtPosition(contextToken.parent);
}
var completionData = getCompletionData(program, log, sourceFile, isUncheckedFile(sourceFile, compilerOptions), position, preferences, /*detailsEntryId*/ undefined);
@@ -98609,7 +99533,7 @@
return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: entries };
}
function completionInfoFromData(sourceFile, typeChecker, compilerOptions, log, completionData, preferences) {
- var symbols = completionData.symbols, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, insideJsDocTagTypeExpression = completionData.insideJsDocTagTypeExpression;
+ var symbols = completionData.symbols, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, insideJsDocTagTypeExpression = completionData.insideJsDocTagTypeExpression, symbolToSortTextMap = completionData.symbolToSortTextMap;
if (location && location.parent && ts.isJsxClosingElement(location.parent)) {
// In the TypeScript JSX element, if such element is not defined. When users query for completion at closing tag,
// instead of simply giving unknown value, the completion will return the tag-name of an associated opening-element.
@@ -98623,20 +99547,20 @@
name: tagName.getFullText(sourceFile) + (hasClosingAngleBracket ? "" : ">"),
kind: "class" /* classElement */,
kindModifiers: undefined,
- sortText: "0",
+ sortText: SortText.LocationPriority,
};
return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: false, entries: [entry] };
}
var entries = [];
if (isUncheckedFile(sourceFile, compilerOptions)) {
- var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, sourceFile, typeChecker, compilerOptions.target, log, completionKind, preferences, propertyAccessToConvert, isJsxInitializer, recommendedCompletion, symbolToOriginInfoMap);
+ var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, sourceFile, typeChecker, compilerOptions.target, log, completionKind, preferences, propertyAccessToConvert, isJsxInitializer, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap);
getJSCompletionEntries(sourceFile, location.pos, uniqueNames, compilerOptions.target, entries); // TODO: GH#18217
}
else {
if (!isNewIdentifierLocation && (!symbols || symbols.length === 0) && keywordFilters === 0 /* None */) {
return undefined;
}
- getCompletionEntriesFromSymbols(symbols, entries, location, sourceFile, typeChecker, compilerOptions.target, log, completionKind, preferences, propertyAccessToConvert, isJsxInitializer, recommendedCompletion, symbolToOriginInfoMap);
+ getCompletionEntriesFromSymbols(symbols, entries, location, sourceFile, typeChecker, compilerOptions.target, log, completionKind, preferences, propertyAccessToConvert, isJsxInitializer, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap);
}
if (keywordFilters !== 0 /* None */) {
var entryNames = ts.arrayToSet(entries, function (e) { return e.name; });
@@ -98678,7 +99602,7 @@
name: realName,
kind: "warning" /* warning */,
kindModifiers: "",
- sortText: "1"
+ sortText: SortText.JavascriptIdentifiers
});
}
});
@@ -98687,14 +99611,9 @@
return typeof literal === "object" ? ts.pseudoBigIntToString(literal) + "n" : JSON.stringify(literal);
};
function createCompletionEntryForLiteral(literal) {
- return { name: completionNameForLiteral(literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: "0" };
+ return { name: completionNameForLiteral(literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority };
}
- function createCompletionEntry(symbol, location, sourceFile, typeChecker, target, kind, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, preferences) {
- var info = getCompletionEntryDisplayNameForSymbol(symbol, target, origin, kind);
- if (!info) {
- return undefined;
- }
- var name = info.name, needsConvertPropertyAccess = info.needsConvertPropertyAccess;
+ function createCompletionEntry(symbol, sortText, location, sourceFile, typeChecker, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, preferences) {
var insertText;
var replacementSpan;
if (origin && origin.kind === 0 /* ThisType */) {
@@ -98731,7 +99650,7 @@
name: name,
kind: ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, location),
kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol),
- sortText: "0",
+ sortText: sortText,
source: getSourceFromOrigin(origin),
hasAction: trueOrUndefined(!!origin && originIsExport(origin)),
isRecommended: trueOrUndefined(isRecommendedCompletionMatch(symbol, recommendedCompletion, typeChecker)),
@@ -98749,7 +99668,7 @@
function getSourceFromOrigin(origin) {
return origin && originIsExport(origin) ? ts.stripQuotes(origin.moduleSymbol.name) : undefined;
}
- function getCompletionEntriesFromSymbols(symbols, entries, location, sourceFile, typeChecker, target, log, kind, preferences, propertyAccessToConvert, isJsxInitializer, recommendedCompletion, symbolToOriginInfoMap) {
+ function getCompletionEntriesFromSymbols(symbols, entries, location, sourceFile, typeChecker, target, log, kind, preferences, propertyAccessToConvert, isJsxInitializer, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap) {
var start = ts.timestamp();
// Tracks unique names.
// We don't set this for global variables or completions from external module exports, because we can have multiple of those.
@@ -98759,14 +99678,18 @@
for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) {
var symbol = symbols_1[_i];
var origin = symbolToOriginInfoMap ? symbolToOriginInfoMap[ts.getSymbolId(symbol)] : undefined;
- var entry = createCompletionEntry(symbol, location, sourceFile, typeChecker, target, kind, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, preferences);
- if (!entry) {
+ var info = getCompletionEntryDisplayNameForSymbol(symbol, target, origin, kind);
+ if (!info) {
continue;
}
- var name = entry.name;
+ var name = info.name, needsConvertPropertyAccess = info.needsConvertPropertyAccess;
if (uniques.has(name)) {
continue;
}
+ var entry = createCompletionEntry(symbol, symbolToSortTextMap && symbolToSortTextMap[ts.getSymbolId(symbol)] || SortText.LocationPriority, location, sourceFile, typeChecker, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, preferences);
+ if (!entry) {
+ continue;
+ }
// Latter case tests whether this is a global variable.
if (!origin && !(symbol.parent === undefined && !ts.some(symbol.declarations, function (d) { return d.getSourceFile() === location.getSourceFile(); }))) { // TODO: GH#18217
uniques.set(name, true);
@@ -98799,7 +99722,7 @@
name: name,
kindModifiers: "" /* none */,
kind: "label" /* label */,
- sortText: "0"
+ sortText: SortText.LocationPriority
});
}
}
@@ -98939,25 +99862,25 @@
function getContextualType(previousToken, position, sourceFile, checker) {
var parent = previousToken.parent;
switch (previousToken.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return ts.getContextualTypeFromParent(previousToken, checker);
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
switch (parent.kind) {
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return checker.getContextualType(parent.initializer); // TODO: GH#18217
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return checker.getTypeAtLocation(parent.left);
- case 267 /* JsxAttribute */:
+ case 268 /* JsxAttribute */:
return checker.getContextualTypeForJsxAttribute(parent);
default:
return undefined;
}
- case 95 /* NewKeyword */:
+ case 96 /* NewKeyword */:
return checker.getContextualType(parent);
- case 74 /* CaseKeyword */:
+ case 75 /* CaseKeyword */:
return ts.getSwitchedType(ts.cast(parent, ts.isCaseClause), checker);
case 18 /* OpenBraceToken */:
- return ts.isJsxExpression(parent) && parent.parent.kind !== 260 /* JsxElement */ ? checker.getContextualTypeForJsxAttribute(parent.parent) : undefined;
+ return ts.isJsxExpression(parent) && parent.parent.kind !== 261 /* JsxElement */ ? checker.getContextualTypeForJsxAttribute(parent.parent) : undefined;
default:
var argInfo = ts.SignatureHelp.getArgumentInfoForCompletions(previousToken, position, sourceFile);
return argInfo
@@ -98976,7 +99899,7 @@
return symbol.parent && (isModuleSymbol(symbol.parent) ? symbol : getFirstSymbolInChain(symbol.parent, enclosingDeclaration, checker));
}
function isModuleSymbol(symbol) {
- return symbol.declarations.some(function (d) { return d.kind === 284 /* SourceFile */; });
+ return symbol.declarations.some(function (d) { return d.kind === 285 /* SourceFile */; });
}
function getCompletionData(program, log, sourceFile, isUncheckedFile, position, preferences, detailsEntryId) {
var typeChecker = program.getTypeChecker();
@@ -99027,11 +99950,11 @@
if (tag.tagName.pos <= position && position <= tag.tagName.end) {
return { kind: 1 /* JsDocTagName */ };
}
- if (isTagWithTypeExpression(tag) && tag.typeExpression && tag.typeExpression.kind === 288 /* JSDocTypeExpression */) {
+ if (isTagWithTypeExpression(tag) && tag.typeExpression && tag.typeExpression.kind === 289 /* JSDocTypeExpression */) {
currentToken = ts.getTokenAtPosition(sourceFile, position);
if (!currentToken ||
(!ts.isDeclarationName(currentToken) &&
- (currentToken.parent.kind !== 310 /* JSDocPropertyTag */ ||
+ (currentToken.parent.kind !== 311 /* JSDocPropertyTag */ ||
currentToken.parent.name !== currentToken))) {
// Use as type location if inside tag's type expression
insideJsDocTagTypeExpression = isCurrentlyEditingNode(tag.typeExpression);
@@ -99081,7 +100004,7 @@
if (contextToken.kind === 24 /* DotToken */) {
isRightOfDot = true;
switch (parent.kind) {
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
propertyAccessToConvert = parent;
node = propertyAccessToConvert.expression;
if (node.end === contextToken.pos &&
@@ -99093,14 +100016,14 @@
return undefined;
}
break;
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
node = parent.left;
break;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
node = parent.name;
break;
- case 183 /* ImportType */:
- case 214 /* MetaProperty */:
+ case 184 /* ImportType */:
+ case 215 /* MetaProperty */:
node = parent;
break;
default:
@@ -99113,7 +100036,7 @@
// <UI.Test /* completion position */ />
// If the tagname is a property access expression, we will then walk up to the top most of property access expression.
// Then, try to get a JSX container and its associated attributes type.
- if (parent && parent.kind === 189 /* PropertyAccessExpression */) {
+ if (parent && parent.kind === 190 /* PropertyAccessExpression */) {
contextToken = parent;
parent = parent.parent;
}
@@ -99121,48 +100044,48 @@
if (currentToken.parent === location) {
switch (currentToken.kind) {
case 30 /* GreaterThanToken */:
- if (currentToken.parent.kind === 260 /* JsxElement */ || currentToken.parent.kind === 262 /* JsxOpeningElement */) {
+ if (currentToken.parent.kind === 261 /* JsxElement */ || currentToken.parent.kind === 263 /* JsxOpeningElement */) {
location = currentToken;
}
break;
case 42 /* SlashToken */:
- if (currentToken.parent.kind === 261 /* JsxSelfClosingElement */) {
+ if (currentToken.parent.kind === 262 /* JsxSelfClosingElement */) {
location = currentToken;
}
break;
}
}
switch (parent.kind) {
- case 263 /* JsxClosingElement */:
+ case 264 /* JsxClosingElement */:
if (contextToken.kind === 42 /* SlashToken */) {
isStartingCloseTag = true;
location = contextToken;
}
break;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
if (!binaryExpressionMayBeOpenTag(parent)) {
break;
}
// falls through
- case 261 /* JsxSelfClosingElement */:
- case 260 /* JsxElement */:
- case 262 /* JsxOpeningElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 261 /* JsxElement */:
+ case 263 /* JsxOpeningElement */:
if (contextToken.kind === 28 /* LessThanToken */) {
isRightOfOpenTag = true;
location = contextToken;
}
break;
- case 267 /* JsxAttribute */:
+ case 268 /* JsxAttribute */:
switch (previousToken.kind) {
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
isJsxInitializer = true;
break;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
// For `<div x=[|f/**/|]`, `parent` will be `x` and `previousToken.parent` will be `f` (which is its own JsxAttribute)
// Note for `<div someBool f>` we don't want to treat this as a jsx inializer, instead it's the attribute name.
if (parent !== previousToken.parent &&
!parent.initializer &&
- ts.findChildOfKind(parent, 59 /* EqualsToken */, sourceFile)) {
+ ts.findChildOfKind(parent, 60 /* EqualsToken */, sourceFile)) {
isJsxInitializer = previousToken;
}
}
@@ -99176,6 +100099,7 @@
var keywordFilters = 0 /* None */;
var symbols = [];
var symbolToOriginInfoMap = [];
+ var symbolToSortTextMap = [];
if (isRightOfDot) {
getTypeScriptMemberSymbols();
}
@@ -99221,15 +100145,16 @@
recommendedCompletion: recommendedCompletion,
previousToken: previousToken,
isJsxInitializer: isJsxInitializer,
- insideJsDocTagTypeExpression: insideJsDocTagTypeExpression
+ insideJsDocTagTypeExpression: insideJsDocTagTypeExpression,
+ symbolToSortTextMap: symbolToSortTextMap
};
function isTagWithTypeExpression(tag) {
switch (tag.kind) {
- case 304 /* JSDocParameterTag */:
- case 310 /* JSDocPropertyTag */:
- case 305 /* JSDocReturnTag */:
- case 307 /* JSDocTypeTag */:
- case 309 /* JSDocTypedefTag */:
+ case 305 /* JSDocParameterTag */:
+ case 311 /* JSDocPropertyTag */:
+ case 306 /* JSDocReturnTag */:
+ case 308 /* JSDocTypeTag */:
+ case 310 /* JSDocTypedefTag */:
return true;
default:
return false;
@@ -99271,15 +100196,15 @@
// If the module is merged with a value, we must get the type of the class and add its propertes (for inherited static methods).
if (!isTypeLocation &&
symbol.declarations &&
- symbol.declarations.some(function (d) { return d.kind !== 284 /* SourceFile */ && d.kind !== 244 /* ModuleDeclaration */ && d.kind !== 243 /* EnumDeclaration */; })) {
+ symbol.declarations.some(function (d) { return d.kind !== 285 /* SourceFile */ && d.kind !== 245 /* ModuleDeclaration */ && d.kind !== 244 /* EnumDeclaration */; })) {
addTypeProperties(typeChecker.getTypeOfSymbolAtLocation(symbol, node));
}
return;
}
}
}
- if (ts.isMetaProperty(node) && (node.keywordToken === 95 /* NewKeyword */ || node.keywordToken === 92 /* ImportKeyword */)) {
- var completion = (node.keywordToken === 95 /* NewKeyword */) ? "target" : "meta";
+ if (ts.isMetaProperty(node) && (node.keywordToken === 96 /* NewKeyword */ || node.keywordToken === 93 /* ImportKeyword */)) {
+ var completion = (node.keywordToken === 96 /* NewKeyword */) ? "target" : "meta";
symbols.push(typeChecker.createSymbol(4 /* Property */, ts.escapeLeadingUnderscores(completion)));
return;
}
@@ -99300,7 +100225,7 @@
else {
for (var _i = 0, _a = type.getApparentProperties(); _i < _a.length; _i++) {
var symbol = _a[_i];
- if (typeChecker.isValidPropertyAccessForCompletions(node.kind === 183 /* ImportType */ ? node : node.parent, type, symbol)) {
+ if (typeChecker.isValidPropertyAccessForCompletions(node.kind === 184 /* ImportType */ ? node : node.parent, type, symbol)) {
addPropertySymbol(symbol);
}
}
@@ -99403,14 +100328,22 @@
var isTypeOnly = isTypeOnlyCompletion();
var symbolMeanings = (isTypeOnly ? 0 /* None */ : 67220415 /* Value */) | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */;
symbols = ts.Debug.assertEachDefined(typeChecker.getSymbolsInScope(scopeNode, symbolMeanings), "getSymbolsInScope() should all be defined");
+ for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) {
+ var symbol = symbols_2[_i];
+ if (!typeChecker.isArgumentsSymbol(symbol) &&
+ !ts.some(symbol.declarations, function (d) { return d.getSourceFile() === sourceFile; })) {
+ symbolToSortTextMap[ts.getSymbolId(symbol)] = SortText.GlobalsOrKeywords;
+ }
+ }
// Need to insert 'this.' before properties of `this` type, so only do that if `includeInsertTextCompletions`
- if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 284 /* SourceFile */) {
+ if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 285 /* SourceFile */) {
var thisType = typeChecker.tryGetThisTypeAt(scopeNode, /*includeGlobalThis*/ false);
if (thisType) {
- for (var _i = 0, _a = getPropertiesForCompletion(thisType, typeChecker); _i < _a.length; _i++) {
- var symbol = _a[_i];
+ for (var _a = 0, _b = getPropertiesForCompletion(thisType, typeChecker); _a < _b.length; _a++) {
+ var symbol = _b[_a];
symbolToOriginInfoMap[ts.getSymbolId(symbol)] = { kind: 0 /* ThisType */ };
symbols.push(symbol);
+ symbolToSortTextMap[ts.getSymbolId(symbol)] = SortText.SuggestedClassMembers;
}
}
}
@@ -99437,10 +100370,10 @@
}
function isSnippetScope(scopeNode) {
switch (scopeNode.kind) {
- case 284 /* SourceFile */:
- case 206 /* TemplateExpression */:
- case 270 /* JsxExpression */:
- case 218 /* Block */:
+ case 285 /* SourceFile */:
+ case 207 /* TemplateExpression */:
+ case 271 /* JsxExpression */:
+ case 219 /* Block */:
return true;
default:
return ts.isStatement(scopeNode);
@@ -99479,25 +100412,25 @@
}
function isContextTokenValueLocation(contextToken) {
return contextToken &&
- contextToken.kind === 104 /* TypeOfKeyword */ &&
- (contextToken.parent.kind === 167 /* TypeQuery */ || ts.isTypeOfExpression(contextToken.parent));
+ contextToken.kind === 105 /* TypeOfKeyword */ &&
+ (contextToken.parent.kind === 168 /* TypeQuery */ || ts.isTypeOfExpression(contextToken.parent));
}
function isContextTokenTypeLocation(contextToken) {
if (contextToken) {
var parentKind = contextToken.parent.kind;
switch (contextToken.kind) {
case 57 /* ColonToken */:
- return parentKind === 154 /* PropertyDeclaration */ ||
- parentKind === 153 /* PropertySignature */ ||
- parentKind === 151 /* Parameter */ ||
- parentKind === 237 /* VariableDeclaration */ ||
+ return parentKind === 155 /* PropertyDeclaration */ ||
+ parentKind === 154 /* PropertySignature */ ||
+ parentKind === 152 /* Parameter */ ||
+ parentKind === 238 /* VariableDeclaration */ ||
ts.isFunctionLikeKind(parentKind);
- case 59 /* EqualsToken */:
- return parentKind === 242 /* TypeAliasDeclaration */;
- case 119 /* AsKeyword */:
- return parentKind === 212 /* AsExpression */;
- case 86 /* ExtendsKeyword */:
- return parentKind === 150 /* TypeParameter */;
+ case 60 /* EqualsToken */:
+ return parentKind === 243 /* TypeAliasDeclaration */;
+ case 120 /* AsKeyword */:
+ return parentKind === 213 /* AsExpression */;
+ case 87 /* ExtendsKeyword */:
+ return parentKind === 151 /* TypeParameter */;
}
}
return false;
@@ -99529,6 +100462,7 @@
// So in `declare namespace foo {} declare module "foo" { export = foo; }`, there will just be the global completion for `foo`.
ts.some(resolvedModuleSymbol.declarations, function (d) { return !!d.getSourceFile().externalModuleIndicator; })) {
symbols.push(resolvedModuleSymbol);
+ symbolToSortTextMap[ts.getSymbolId(resolvedModuleSymbol)] = SortText.AutoImportSuggestions;
symbolToOriginInfoMap[ts.getSymbolId(resolvedModuleSymbol)] = { kind: 3 /* Export */, moduleSymbol: moduleSymbol, isDefaultExport: false };
}
for (var _i = 0, _a = typeChecker.getExportsOfModule(moduleSymbol); _i < _a.length; _i++) {
@@ -99553,6 +100487,7 @@
var origin = { kind: 3 /* Export */, moduleSymbol: moduleSymbol, isDefaultExport: isDefaultExport };
if (detailsEntryId || stringContainsCharactersInOrder(getSymbolName(symbol, origin, target).toLowerCase(), tokenTextLowerCase)) {
symbols.push(symbol);
+ symbolToSortTextMap[ts.getSymbolId(symbol)] = SortText.AutoImportSuggestions;
symbolToOriginInfoMap[ts.getSymbolId(symbol)] = origin;
}
}
@@ -99604,11 +100539,11 @@
return true;
}
if (contextToken.kind === 30 /* GreaterThanToken */ && contextToken.parent) {
- if (contextToken.parent.kind === 262 /* JsxOpeningElement */) {
+ if (contextToken.parent.kind === 263 /* JsxOpeningElement */) {
return true;
}
- if (contextToken.parent.kind === 263 /* JsxClosingElement */ || contextToken.parent.kind === 261 /* JsxSelfClosingElement */) {
- return !!contextToken.parent.parent && contextToken.parent.parent.kind === 260 /* JsxElement */;
+ if (contextToken.parent.kind === 264 /* JsxClosingElement */ || contextToken.parent.kind === 262 /* JsxSelfClosingElement */) {
+ return !!contextToken.parent.parent && contextToken.parent.parent.kind === 261 /* JsxElement */;
}
}
return false;
@@ -99619,40 +100554,40 @@
// Previous token may have been a keyword that was converted to an identifier.
switch (keywordForNode(previousToken)) {
case 27 /* CommaToken */:
- return containingNodeKind === 191 /* CallExpression */ // func( a, |
- || containingNodeKind === 157 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */
- || containingNodeKind === 192 /* NewExpression */ // new C(a, |
- || containingNodeKind === 187 /* ArrayLiteralExpression */ // [a, |
- || containingNodeKind === 204 /* BinaryExpression */ // const x = (a, |
- || containingNodeKind === 165 /* FunctionType */; // var x: (s: string, list|
+ return containingNodeKind === 192 /* CallExpression */ // func( a, |
+ || containingNodeKind === 158 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */
+ || containingNodeKind === 193 /* NewExpression */ // new C(a, |
+ || containingNodeKind === 188 /* ArrayLiteralExpression */ // [a, |
+ || containingNodeKind === 205 /* BinaryExpression */ // const x = (a, |
+ || containingNodeKind === 166 /* FunctionType */; // var x: (s: string, list|
case 20 /* OpenParenToken */:
- return containingNodeKind === 191 /* CallExpression */ // func( |
- || containingNodeKind === 157 /* Constructor */ // constructor( |
- || containingNodeKind === 192 /* NewExpression */ // new C(a|
- || containingNodeKind === 195 /* ParenthesizedExpression */ // const x = (a|
- || containingNodeKind === 177 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */
+ return containingNodeKind === 192 /* CallExpression */ // func( |
+ || containingNodeKind === 158 /* Constructor */ // constructor( |
+ || containingNodeKind === 193 /* NewExpression */ // new C(a|
+ || containingNodeKind === 196 /* ParenthesizedExpression */ // const x = (a|
+ || containingNodeKind === 178 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */
case 22 /* OpenBracketToken */:
- return containingNodeKind === 187 /* ArrayLiteralExpression */ // [ |
- || containingNodeKind === 162 /* IndexSignature */ // [ | : string ]
- || containingNodeKind === 149 /* ComputedPropertyName */; // [ | /* this can become an index signature */
- case 130 /* ModuleKeyword */: // module |
- case 131 /* NamespaceKeyword */: // namespace |
+ return containingNodeKind === 188 /* ArrayLiteralExpression */ // [ |
+ || containingNodeKind === 163 /* IndexSignature */ // [ | : string ]
+ || containingNodeKind === 150 /* ComputedPropertyName */; // [ | /* this can become an index signature */
+ case 131 /* ModuleKeyword */: // module |
+ case 132 /* NamespaceKeyword */: // namespace |
return true;
case 24 /* DotToken */:
- return containingNodeKind === 244 /* ModuleDeclaration */; // module A.|
+ return containingNodeKind === 245 /* ModuleDeclaration */; // module A.|
case 18 /* OpenBraceToken */:
- return containingNodeKind === 240 /* ClassDeclaration */; // class A{ |
- case 59 /* EqualsToken */:
- return containingNodeKind === 237 /* VariableDeclaration */ // const x = a|
- || containingNodeKind === 204 /* BinaryExpression */; // x = a|
+ return containingNodeKind === 241 /* ClassDeclaration */; // class A{ |
+ case 60 /* EqualsToken */:
+ return containingNodeKind === 238 /* VariableDeclaration */ // const x = a|
+ || containingNodeKind === 205 /* BinaryExpression */; // x = a|
case 15 /* TemplateHead */:
- return containingNodeKind === 206 /* TemplateExpression */; // `aa ${|
+ return containingNodeKind === 207 /* TemplateExpression */; // `aa ${|
case 16 /* TemplateMiddle */:
- return containingNodeKind === 216 /* TemplateSpan */; // `aa ${10} dd ${|
- case 115 /* PublicKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- return containingNodeKind === 154 /* PropertyDeclaration */; // class A{ public |
+ return containingNodeKind === 217 /* TemplateSpan */; // `aa ${10} dd ${|
+ case 116 /* PublicKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ return containingNodeKind === 155 /* PropertyDeclaration */; // class A{ public |
}
}
return false;
@@ -99679,7 +100614,7 @@
completionKind = 0 /* ObjectPropertyDeclaration */;
var typeMembers;
var existingMembers;
- if (objectLikeContainer.kind === 188 /* ObjectLiteralExpression */) {
+ if (objectLikeContainer.kind === 189 /* ObjectLiteralExpression */) {
var typeForObject = typeChecker.getContextualType(objectLikeContainer);
if (!typeForObject)
return 2 /* Fail */;
@@ -99688,7 +100623,7 @@
existingMembers = objectLikeContainer.properties;
}
else {
- ts.Debug.assert(objectLikeContainer.kind === 184 /* ObjectBindingPattern */);
+ ts.Debug.assert(objectLikeContainer.kind === 185 /* ObjectBindingPattern */);
// We are *only* completing on properties from the type being destructured.
isNewIdentifierLocation = false;
var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent);
@@ -99699,12 +100634,12 @@
// through type declaration or inference.
// Also proceed if rootDeclaration is a parameter and if its containing function expression/arrow function is contextually typed -
// type of parameter will flow in from the contextual type of the function
- var canGetType = ts.hasInitializer(rootDeclaration) || ts.hasType(rootDeclaration) || rootDeclaration.parent.parent.kind === 227 /* ForOfStatement */;
- if (!canGetType && rootDeclaration.kind === 151 /* Parameter */) {
+ var canGetType = ts.hasInitializer(rootDeclaration) || ts.hasType(rootDeclaration) || rootDeclaration.parent.parent.kind === 228 /* ForOfStatement */;
+ if (!canGetType && rootDeclaration.kind === 152 /* Parameter */) {
if (ts.isExpression(rootDeclaration.parent)) {
canGetType = !!typeChecker.getContextualType(rootDeclaration.parent);
}
- else if (rootDeclaration.parent.kind === 156 /* MethodDeclaration */ || rootDeclaration.parent.kind === 159 /* SetAccessor */) {
+ else if (rootDeclaration.parent.kind === 157 /* MethodDeclaration */ || rootDeclaration.parent.kind === 160 /* SetAccessor */) {
canGetType = ts.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent);
}
}
@@ -99746,7 +100681,7 @@
return 0 /* Continue */;
// cursor is in an import clause
// try to show exported member for imported module
- var moduleSpecifier = (namedImportsOrExports.kind === 252 /* NamedImports */ ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent).moduleSpecifier;
+ var moduleSpecifier = (namedImportsOrExports.kind === 253 /* NamedImports */ ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent).moduleSpecifier;
var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(moduleSpecifier); // TODO: GH#18217
if (!moduleSpecifierSymbol)
return 2 /* Fail */;
@@ -99777,7 +100712,7 @@
var classElement = contextToken.parent;
var classElementModifierFlags = ts.isClassElement(classElement) ? ts.getModifierFlags(classElement) : 0 /* None */;
// If this is context token is not something we are editing now, consider if this would lead to be modifier
- if (contextToken.kind === 72 /* Identifier */ && !isCurrentlyEditingNode(contextToken)) {
+ if (contextToken.kind === 73 /* Identifier */ && !isCurrentlyEditingNode(contextToken)) {
switch (contextToken.getText()) {
case "private":
classElementModifierFlags = classElementModifierFlags | 8 /* Private */;
@@ -99814,7 +100749,7 @@
break;
case 40 /* AsteriskToken */:
return ts.isMethodDeclaration(parent) ? ts.tryCast(parent.parent, ts.isObjectLiteralExpression) : undefined;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return contextToken.text === "async" && ts.isShorthandPropertyAssignment(contextToken.parent)
? contextToken.parent.parent : undefined;
}
@@ -99867,12 +100802,12 @@
case 30 /* GreaterThanToken */: // End of a type argument list
case 29 /* LessThanSlashToken */:
case 42 /* SlashToken */:
- case 72 /* Identifier */:
- case 189 /* PropertyAccessExpression */:
- case 268 /* JsxAttributes */:
- case 267 /* JsxAttribute */:
- case 269 /* JsxSpreadAttribute */:
- if (parent && (parent.kind === 261 /* JsxSelfClosingElement */ || parent.kind === 262 /* JsxOpeningElement */)) {
+ case 73 /* Identifier */:
+ case 190 /* PropertyAccessExpression */:
+ case 269 /* JsxAttributes */:
+ case 268 /* JsxAttribute */:
+ case 270 /* JsxSpreadAttribute */:
+ if (parent && (parent.kind === 262 /* JsxSelfClosingElement */ || parent.kind === 263 /* JsxOpeningElement */)) {
if (contextToken.kind === 30 /* GreaterThanToken */) {
var precedingToken = ts.findPrecedingToken(contextToken.pos, sourceFile, /*startNode*/ undefined);
if (!parent.typeArguments || (precedingToken && precedingToken.kind === 42 /* SlashToken */))
@@ -99880,7 +100815,7 @@
}
return parent;
}
- else if (parent.kind === 267 /* JsxAttribute */) {
+ else if (parent.kind === 268 /* JsxAttribute */) {
// Currently we parse JsxOpeningLikeElement as:
// JsxOpeningLikeElement
// attributes: JsxAttributes
@@ -99892,7 +100827,7 @@
// its parent is a JsxExpression, whose parent is a JsxAttribute,
// whose parent is a JsxOpeningLikeElement
case 10 /* StringLiteral */:
- if (parent && ((parent.kind === 267 /* JsxAttribute */) || (parent.kind === 269 /* JsxSpreadAttribute */))) {
+ if (parent && ((parent.kind === 268 /* JsxAttribute */) || (parent.kind === 270 /* JsxSpreadAttribute */))) {
// Currently we parse JsxOpeningLikeElement as:
// JsxOpeningLikeElement
// attributes: JsxAttributes
@@ -99902,8 +100837,8 @@
break;
case 19 /* CloseBraceToken */:
if (parent &&
- parent.kind === 270 /* JsxExpression */ &&
- parent.parent && parent.parent.kind === 267 /* JsxAttribute */) {
+ parent.kind === 271 /* JsxExpression */ &&
+ parent.parent && parent.parent.kind === 268 /* JsxAttribute */) {
// Currently we parse JsxOpeningLikeElement as:
// JsxOpeningLikeElement
// attributes: JsxAttributes
@@ -99911,7 +100846,7 @@
// each JsxAttribute can have initializer as JsxExpression
return parent.parent.parent.parent;
}
- if (parent && parent.kind === 269 /* JsxSpreadAttribute */) {
+ if (parent && parent.kind === 270 /* JsxSpreadAttribute */) {
// Currently we parse JsxOpeningLikeElement as:
// JsxOpeningLikeElement
// attributes: JsxAttributes
@@ -99931,62 +100866,62 @@
var containingNodeKind = parent.kind;
switch (contextToken.kind) {
case 27 /* CommaToken */:
- return containingNodeKind === 237 /* VariableDeclaration */ ||
- containingNodeKind === 238 /* VariableDeclarationList */ ||
- containingNodeKind === 219 /* VariableStatement */ ||
- containingNodeKind === 243 /* EnumDeclaration */ || // enum a { foo, |
+ return containingNodeKind === 238 /* VariableDeclaration */ ||
+ containingNodeKind === 239 /* VariableDeclarationList */ ||
+ containingNodeKind === 220 /* VariableStatement */ ||
+ containingNodeKind === 244 /* EnumDeclaration */ || // enum a { foo, |
isFunctionLikeButNotConstructor(containingNodeKind) ||
- containingNodeKind === 241 /* InterfaceDeclaration */ || // interface A<T, |
- containingNodeKind === 185 /* ArrayBindingPattern */ || // var [x, y|
- containingNodeKind === 242 /* TypeAliasDeclaration */ || // type Map, K, |
+ containingNodeKind === 242 /* InterfaceDeclaration */ || // interface A<T, |
+ containingNodeKind === 186 /* ArrayBindingPattern */ || // var [x, y|
+ containingNodeKind === 243 /* TypeAliasDeclaration */ || // type Map, K, |
// class A<T, |
// var C = class D<T, |
(ts.isClassLike(parent) &&
!!parent.typeParameters &&
parent.typeParameters.end >= contextToken.pos);
case 24 /* DotToken */:
- return containingNodeKind === 185 /* ArrayBindingPattern */; // var [.|
+ return containingNodeKind === 186 /* ArrayBindingPattern */; // var [.|
case 57 /* ColonToken */:
- return containingNodeKind === 186 /* BindingElement */; // var {x :html|
+ return containingNodeKind === 187 /* BindingElement */; // var {x :html|
case 22 /* OpenBracketToken */:
- return containingNodeKind === 185 /* ArrayBindingPattern */; // var [x|
+ return containingNodeKind === 186 /* ArrayBindingPattern */; // var [x|
case 20 /* OpenParenToken */:
- return containingNodeKind === 274 /* CatchClause */ ||
+ return containingNodeKind === 275 /* CatchClause */ ||
isFunctionLikeButNotConstructor(containingNodeKind);
case 18 /* OpenBraceToken */:
- return containingNodeKind === 243 /* EnumDeclaration */; // enum a { |
+ return containingNodeKind === 244 /* EnumDeclaration */; // enum a { |
case 28 /* LessThanToken */:
- return containingNodeKind === 240 /* ClassDeclaration */ || // class A< |
- containingNodeKind === 209 /* ClassExpression */ || // var C = class D< |
- containingNodeKind === 241 /* InterfaceDeclaration */ || // interface A< |
- containingNodeKind === 242 /* TypeAliasDeclaration */ || // type List< |
+ return containingNodeKind === 241 /* ClassDeclaration */ || // class A< |
+ containingNodeKind === 210 /* ClassExpression */ || // var C = class D< |
+ containingNodeKind === 242 /* InterfaceDeclaration */ || // interface A< |
+ containingNodeKind === 243 /* TypeAliasDeclaration */ || // type List< |
ts.isFunctionLikeKind(containingNodeKind);
- case 116 /* StaticKeyword */:
- return containingNodeKind === 154 /* PropertyDeclaration */ && !ts.isClassLike(parent.parent);
+ case 117 /* StaticKeyword */:
+ return containingNodeKind === 155 /* PropertyDeclaration */ && !ts.isClassLike(parent.parent);
case 25 /* DotDotDotToken */:
- return containingNodeKind === 151 /* Parameter */ ||
- (!!parent.parent && parent.parent.kind === 185 /* ArrayBindingPattern */); // var [...z|
- case 115 /* PublicKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- return containingNodeKind === 151 /* Parameter */ && !ts.isConstructorDeclaration(parent.parent);
- case 119 /* AsKeyword */:
- return containingNodeKind === 253 /* ImportSpecifier */ ||
- containingNodeKind === 257 /* ExportSpecifier */ ||
- containingNodeKind === 251 /* NamespaceImport */;
- case 126 /* GetKeyword */:
- case 137 /* SetKeyword */:
+ return containingNodeKind === 152 /* Parameter */ ||
+ (!!parent.parent && parent.parent.kind === 186 /* ArrayBindingPattern */); // var [...z|
+ case 116 /* PublicKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ return containingNodeKind === 152 /* Parameter */ && !ts.isConstructorDeclaration(parent.parent);
+ case 120 /* AsKeyword */:
+ return containingNodeKind === 254 /* ImportSpecifier */ ||
+ containingNodeKind === 258 /* ExportSpecifier */ ||
+ containingNodeKind === 252 /* NamespaceImport */;
+ case 127 /* GetKeyword */:
+ case 138 /* SetKeyword */:
return !isFromObjectTypeDeclaration(contextToken);
- case 76 /* ClassKeyword */:
- case 84 /* EnumKeyword */:
- case 110 /* InterfaceKeyword */:
- case 90 /* FunctionKeyword */:
- case 105 /* VarKeyword */:
- case 92 /* ImportKeyword */:
- case 111 /* LetKeyword */:
- case 77 /* ConstKeyword */:
- case 117 /* YieldKeyword */:
- case 140 /* TypeKeyword */: // type htm|
+ case 77 /* ClassKeyword */:
+ case 85 /* EnumKeyword */:
+ case 111 /* InterfaceKeyword */:
+ case 91 /* FunctionKeyword */:
+ case 106 /* VarKeyword */:
+ case 93 /* ImportKeyword */:
+ case 112 /* LetKeyword */:
+ case 78 /* ConstKeyword */:
+ case 118 /* YieldKeyword */:
+ case 141 /* TypeKeyword */: // type htm|
return true;
case 40 /* AsteriskToken */:
return ts.isFunctionLike(contextToken.parent) && !ts.isMethodDeclaration(contextToken.parent);
@@ -100009,22 +100944,22 @@
}
// Previous token may have been a keyword that was converted to an identifier.
switch (keywordForNode(contextToken)) {
- case 118 /* AbstractKeyword */:
- case 76 /* ClassKeyword */:
- case 77 /* ConstKeyword */:
- case 125 /* DeclareKeyword */:
- case 84 /* EnumKeyword */:
- case 90 /* FunctionKeyword */:
- case 110 /* InterfaceKeyword */:
- case 111 /* LetKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 115 /* PublicKeyword */:
- case 116 /* StaticKeyword */:
- case 105 /* VarKeyword */:
- case 117 /* YieldKeyword */:
+ case 119 /* AbstractKeyword */:
+ case 77 /* ClassKeyword */:
+ case 78 /* ConstKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 85 /* EnumKeyword */:
+ case 91 /* FunctionKeyword */:
+ case 111 /* InterfaceKeyword */:
+ case 112 /* LetKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 116 /* PublicKeyword */:
+ case 117 /* StaticKeyword */:
+ case 106 /* VarKeyword */:
+ case 118 /* YieldKeyword */:
return true;
- case 121 /* AsyncKeyword */:
+ case 122 /* AsyncKeyword */:
return ts.isPropertyDeclaration(contextToken.parent);
}
return ts.isDeclarationName(contextToken)
@@ -100034,7 +100969,7 @@
&& !(ts.isClassLike(contextToken.parent) && (contextToken !== previousToken || position > previousToken.end));
}
function isFunctionLikeButNotConstructor(kind) {
- return ts.isFunctionLikeKind(kind) && kind !== 157 /* Constructor */;
+ return ts.isFunctionLikeKind(kind) && kind !== 158 /* Constructor */;
}
function isDotOfNumericLiteral(contextToken) {
if (contextToken.kind === 8 /* NumericLiteral */) {
@@ -100057,12 +100992,12 @@
for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) {
var m = existingMembers_1[_i];
// Ignore omitted expressions for missing members
- if (m.kind !== 275 /* PropertyAssignment */ &&
- m.kind !== 276 /* ShorthandPropertyAssignment */ &&
- m.kind !== 186 /* BindingElement */ &&
- m.kind !== 156 /* MethodDeclaration */ &&
- m.kind !== 158 /* GetAccessor */ &&
- m.kind !== 159 /* SetAccessor */) {
+ if (m.kind !== 276 /* PropertyAssignment */ &&
+ m.kind !== 277 /* ShorthandPropertyAssignment */ &&
+ m.kind !== 187 /* BindingElement */ &&
+ m.kind !== 157 /* MethodDeclaration */ &&
+ m.kind !== 159 /* GetAccessor */ &&
+ m.kind !== 160 /* SetAccessor */) {
continue;
}
// If this is the current item we are editing right now, do not filter it out
@@ -100072,7 +101007,7 @@
var existingName = void 0;
if (ts.isBindingElement(m) && m.propertyName) {
// include only identifiers in completion list
- if (m.propertyName.kind === 72 /* Identifier */) {
+ if (m.propertyName.kind === 73 /* Identifier */) {
existingName = m.propertyName.escapedText;
}
}
@@ -100097,10 +101032,10 @@
for (var _i = 0, existingMembers_2 = existingMembers; _i < existingMembers_2.length; _i++) {
var m = existingMembers_2[_i];
// Ignore omitted expressions for missing members
- if (m.kind !== 154 /* PropertyDeclaration */ &&
- m.kind !== 156 /* MethodDeclaration */ &&
- m.kind !== 158 /* GetAccessor */ &&
- m.kind !== 159 /* SetAccessor */) {
+ if (m.kind !== 155 /* PropertyDeclaration */ &&
+ m.kind !== 157 /* MethodDeclaration */ &&
+ m.kind !== 159 /* GetAccessor */ &&
+ m.kind !== 160 /* SetAccessor */) {
continue;
}
// If this is the current item we are editing right now, do not filter it out
@@ -100140,7 +101075,7 @@
if (isCurrentlyEditingNode(attr)) {
continue;
}
- if (attr.kind === 267 /* JsxAttribute */) {
+ if (attr.kind === 268 /* JsxAttribute */) {
seenNames.set(attr.name.escapedText, true);
}
}
@@ -100160,9 +101095,9 @@
|| ts.isKnownSymbol(symbol)) {
return undefined;
}
- var validIdentiferResult = { name: name, needsConvertPropertyAccess: false };
+ var validIdentifierResult = { name: name, needsConvertPropertyAccess: false };
if (ts.isIdentifierText(name, target))
- return validIdentiferResult;
+ return validIdentifierResult;
switch (kind) {
case 3 /* MemberLike */:
return undefined;
@@ -100175,7 +101110,7 @@
return name.charCodeAt(0) === 32 /* space */ ? undefined : { name: name, needsConvertPropertyAccess: true };
case 5 /* None */:
case 4 /* String */:
- return validIdentiferResult;
+ return validIdentifierResult;
default:
ts.Debug.assertNever(kind);
}
@@ -100184,12 +101119,12 @@
var _keywordCompletions = [];
var allKeywordsCompletions = ts.memoize(function () {
var res = [];
- for (var i = 73 /* FirstKeyword */; i <= 147 /* LastKeyword */; i++) {
+ for (var i = 74 /* FirstKeyword */; i <= 148 /* LastKeyword */; i++) {
res.push({
name: ts.tokenToString(i),
kind: "keyword" /* keyword */,
kindModifiers: "" /* none */,
- sortText: "0"
+ sortText: SortText.GlobalsOrKeywords
});
}
return res;
@@ -100209,8 +101144,8 @@
case 0 /* None */:
return false;
case 1 /* All */:
- return kind === 121 /* AsyncKeyword */ || 122 /* AwaitKeyword */ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind) || kind === 125 /* DeclareKeyword */ || kind === 130 /* ModuleKeyword */
- || ts.isTypeKeyword(kind) && kind !== 141 /* UndefinedKeyword */;
+ return kind === 122 /* AsyncKeyword */ || 123 /* AwaitKeyword */ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind) || kind === 126 /* DeclareKeyword */ || kind === 131 /* ModuleKeyword */
+ || ts.isTypeKeyword(kind) && kind !== 142 /* UndefinedKeyword */;
case 2 /* ClassElementKeywords */:
return isClassMemberCompletionKeyword(kind);
case 3 /* InterfaceElementKeywords */:
@@ -100228,54 +101163,54 @@
}
function isTypeScriptOnlyKeyword(kind) {
switch (kind) {
- case 118 /* AbstractKeyword */:
- case 120 /* AnyKeyword */:
- case 146 /* BigIntKeyword */:
- case 123 /* BooleanKeyword */:
- case 125 /* DeclareKeyword */:
- case 84 /* EnumKeyword */:
- case 145 /* GlobalKeyword */:
- case 109 /* ImplementsKeyword */:
- case 127 /* InferKeyword */:
- case 110 /* InterfaceKeyword */:
- case 128 /* IsKeyword */:
- case 129 /* KeyOfKeyword */:
- case 130 /* ModuleKeyword */:
- case 131 /* NamespaceKeyword */:
- case 132 /* NeverKeyword */:
- case 135 /* NumberKeyword */:
- case 136 /* ObjectKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 115 /* PublicKeyword */:
- case 133 /* ReadonlyKeyword */:
- case 138 /* StringKeyword */:
- case 139 /* SymbolKeyword */:
- case 140 /* TypeKeyword */:
- case 142 /* UniqueKeyword */:
- case 143 /* UnknownKeyword */:
+ case 119 /* AbstractKeyword */:
+ case 121 /* AnyKeyword */:
+ case 147 /* BigIntKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 85 /* EnumKeyword */:
+ case 146 /* GlobalKeyword */:
+ case 110 /* ImplementsKeyword */:
+ case 128 /* InferKeyword */:
+ case 111 /* InterfaceKeyword */:
+ case 129 /* IsKeyword */:
+ case 130 /* KeyOfKeyword */:
+ case 131 /* ModuleKeyword */:
+ case 132 /* NamespaceKeyword */:
+ case 133 /* NeverKeyword */:
+ case 136 /* NumberKeyword */:
+ case 137 /* ObjectKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 116 /* PublicKeyword */:
+ case 134 /* ReadonlyKeyword */:
+ case 139 /* StringKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 141 /* TypeKeyword */:
+ case 143 /* UniqueKeyword */:
+ case 144 /* UnknownKeyword */:
return true;
default:
return false;
}
}
function isInterfaceOrTypeLiteralCompletionKeyword(kind) {
- return kind === 133 /* ReadonlyKeyword */;
+ return kind === 134 /* ReadonlyKeyword */;
}
function isClassMemberCompletionKeyword(kind) {
switch (kind) {
- case 118 /* AbstractKeyword */:
- case 124 /* ConstructorKeyword */:
- case 126 /* GetKeyword */:
- case 137 /* SetKeyword */:
- case 121 /* AsyncKeyword */:
+ case 119 /* AbstractKeyword */:
+ case 125 /* ConstructorKeyword */:
+ case 127 /* GetKeyword */:
+ case 138 /* SetKeyword */:
+ case 122 /* AsyncKeyword */:
return true;
default:
return ts.isClassMemberModifier(kind);
}
}
function isFunctionLikeBodyKeyword(kind) {
- return kind === 121 /* AsyncKeyword */ || kind === 122 /* AwaitKeyword */ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind);
+ return kind === 122 /* AsyncKeyword */ || kind === 123 /* AwaitKeyword */ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind);
}
function keywordForNode(node) {
return ts.isIdentifier(node) ? node.originalKeywordKind || 0 /* Unknown */ : node.kind;
@@ -100312,7 +101247,7 @@
function tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken, location) {
// class c { method() { } | method2() { } }
switch (location.kind) {
- case 311 /* SyntaxList */:
+ case 312 /* SyntaxList */:
return ts.tryCast(location.parent, ts.isObjectTypeDeclaration);
case 1 /* EndOfFileToken */:
var cls = ts.tryCast(ts.lastOrUndefined(ts.cast(location.parent, ts.isSourceFile).statements), ts.isObjectTypeDeclaration);
@@ -100421,40 +101356,40 @@
}
function getHighlightSpans(node, sourceFile) {
switch (node.kind) {
- case 91 /* IfKeyword */:
- case 83 /* ElseKeyword */:
+ case 92 /* IfKeyword */:
+ case 84 /* ElseKeyword */:
return ts.isIfStatement(node.parent) ? getIfElseOccurrences(node.parent, sourceFile) : undefined;
- case 97 /* ReturnKeyword */:
+ case 98 /* ReturnKeyword */:
return useParent(node.parent, ts.isReturnStatement, getReturnOccurrences);
- case 101 /* ThrowKeyword */:
+ case 102 /* ThrowKeyword */:
return useParent(node.parent, ts.isThrowStatement, getThrowOccurrences);
- case 103 /* TryKeyword */:
- case 75 /* CatchKeyword */:
- case 88 /* FinallyKeyword */:
- var tryStatement = node.kind === 75 /* CatchKeyword */ ? node.parent.parent : node.parent;
+ case 104 /* TryKeyword */:
+ case 76 /* CatchKeyword */:
+ case 89 /* FinallyKeyword */:
+ var tryStatement = node.kind === 76 /* CatchKeyword */ ? node.parent.parent : node.parent;
return useParent(tryStatement, ts.isTryStatement, getTryCatchFinallyOccurrences);
- case 99 /* SwitchKeyword */:
+ case 100 /* SwitchKeyword */:
return useParent(node.parent, ts.isSwitchStatement, getSwitchCaseDefaultOccurrences);
- case 74 /* CaseKeyword */:
- case 80 /* DefaultKeyword */:
+ case 75 /* CaseKeyword */:
+ case 81 /* DefaultKeyword */:
return useParent(node.parent.parent.parent, ts.isSwitchStatement, getSwitchCaseDefaultOccurrences);
- case 73 /* BreakKeyword */:
- case 78 /* ContinueKeyword */:
+ case 74 /* BreakKeyword */:
+ case 79 /* ContinueKeyword */:
return useParent(node.parent, ts.isBreakOrContinueStatement, getBreakOrContinueStatementOccurrences);
- case 89 /* ForKeyword */:
- case 107 /* WhileKeyword */:
- case 82 /* DoKeyword */:
+ case 90 /* ForKeyword */:
+ case 108 /* WhileKeyword */:
+ case 83 /* DoKeyword */:
return useParent(node.parent, function (n) { return ts.isIterationStatement(n, /*lookInLabeledStatements*/ true); }, getLoopBreakContinueOccurrences);
- case 124 /* ConstructorKeyword */:
- return getFromAllDeclarations(ts.isConstructorDeclaration, [124 /* ConstructorKeyword */]);
- case 126 /* GetKeyword */:
- case 137 /* SetKeyword */:
- return getFromAllDeclarations(ts.isAccessor, [126 /* GetKeyword */, 137 /* SetKeyword */]);
- case 122 /* AwaitKeyword */:
+ case 125 /* ConstructorKeyword */:
+ return getFromAllDeclarations(ts.isConstructorDeclaration, [125 /* ConstructorKeyword */]);
+ case 127 /* GetKeyword */:
+ case 138 /* SetKeyword */:
+ return getFromAllDeclarations(ts.isAccessor, [127 /* GetKeyword */, 138 /* SetKeyword */]);
+ case 123 /* AwaitKeyword */:
return useParent(node.parent, ts.isAwaitExpression, getAsyncAndAwaitOccurrences);
- case 121 /* AsyncKeyword */:
+ case 122 /* AsyncKeyword */:
return highlightSpans(getAsyncAndAwaitOccurrences(node));
- case 117 /* YieldKeyword */:
+ case 118 /* YieldKeyword */:
return highlightSpans(getYieldOccurrences(node));
default:
return ts.isModifierKind(node.kind) && (ts.isDeclaration(node.parent) || ts.isVariableStatement(node.parent))
@@ -100497,7 +101432,7 @@
var child = throwStatement;
while (child.parent) {
var parent = child.parent;
- if (ts.isFunctionBlock(parent) || parent.kind === 284 /* SourceFile */) {
+ if (ts.isFunctionBlock(parent) || parent.kind === 285 /* SourceFile */) {
return parent;
}
// A throw-statement is only owned by a try-statement if the try-statement has
@@ -100529,16 +101464,16 @@
function getBreakOrContinueOwner(statement) {
return ts.findAncestor(statement, function (node) {
switch (node.kind) {
- case 232 /* SwitchStatement */:
- if (statement.kind === 228 /* ContinueStatement */) {
+ case 233 /* SwitchStatement */:
+ if (statement.kind === 229 /* ContinueStatement */) {
return false;
}
// falls through
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 224 /* WhileStatement */:
- case 223 /* DoStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 225 /* WhileStatement */:
+ case 224 /* DoStatement */:
return !statement.label || isLabeledBy(node, statement.label.escapedText);
default:
// Don't cross function boundaries.
@@ -100554,11 +101489,11 @@
// Types of node whose children might have modifiers.
var container = declaration.parent;
switch (container.kind) {
- case 245 /* ModuleBlock */:
- case 284 /* SourceFile */:
- case 218 /* Block */:
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
+ case 246 /* ModuleBlock */:
+ case 285 /* SourceFile */:
+ case 219 /* Block */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
// Container is either a class declaration or the declaration is a classDeclaration
if (modifierFlag & 128 /* Abstract */ && ts.isClassDeclaration(declaration)) {
return declaration.members.concat([declaration]);
@@ -100566,12 +101501,12 @@
else {
return container.statements;
}
- case 157 /* Constructor */:
- case 156 /* MethodDeclaration */:
- case 239 /* FunctionDeclaration */:
+ case 158 /* Constructor */:
+ case 157 /* MethodDeclaration */:
+ case 240 /* FunctionDeclaration */:
return container.parameters.concat((ts.isClassLike(container.parent) ? container.parent.members : []));
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
var nodes = container.members;
// If we're an accessibility modifier, we're in an instance member and should search
// the constructor's parameter list for instance members as well.
@@ -100602,12 +101537,12 @@
}
function getLoopBreakContinueOccurrences(loopNode) {
var keywords = [];
- if (pushKeywordIf(keywords, loopNode.getFirstToken(), 89 /* ForKeyword */, 107 /* WhileKeyword */, 82 /* DoKeyword */)) {
+ if (pushKeywordIf(keywords, loopNode.getFirstToken(), 90 /* ForKeyword */, 108 /* WhileKeyword */, 83 /* DoKeyword */)) {
// If we succeeded and got a do-while loop, then start looking for a 'while' keyword.
- if (loopNode.kind === 223 /* DoStatement */) {
+ if (loopNode.kind === 224 /* DoStatement */) {
var loopTokens = loopNode.getChildren();
for (var i = loopTokens.length - 1; i >= 0; i--) {
- if (pushKeywordIf(keywords, loopTokens[i], 107 /* WhileKeyword */)) {
+ if (pushKeywordIf(keywords, loopTokens[i], 108 /* WhileKeyword */)) {
break;
}
}
@@ -100615,7 +101550,7 @@
}
ts.forEach(aggregateAllBreakAndContinueStatements(loopNode.statement), function (statement) {
if (ownsBreakOrContinueStatement(loopNode, statement)) {
- pushKeywordIf(keywords, statement.getFirstToken(), 73 /* BreakKeyword */, 78 /* ContinueKeyword */);
+ pushKeywordIf(keywords, statement.getFirstToken(), 74 /* BreakKeyword */, 79 /* ContinueKeyword */);
}
});
return keywords;
@@ -100624,13 +101559,13 @@
var owner = getBreakOrContinueOwner(breakOrContinueStatement);
if (owner) {
switch (owner.kind) {
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
return getLoopBreakContinueOccurrences(owner);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return getSwitchCaseDefaultOccurrences(owner);
}
}
@@ -100638,13 +101573,13 @@
}
function getSwitchCaseDefaultOccurrences(switchStatement) {
var keywords = [];
- pushKeywordIf(keywords, switchStatement.getFirstToken(), 99 /* SwitchKeyword */);
+ pushKeywordIf(keywords, switchStatement.getFirstToken(), 100 /* SwitchKeyword */);
// Go through each clause in the switch statement, collecting the 'case'/'default' keywords.
ts.forEach(switchStatement.caseBlock.clauses, function (clause) {
- pushKeywordIf(keywords, clause.getFirstToken(), 74 /* CaseKeyword */, 80 /* DefaultKeyword */);
+ pushKeywordIf(keywords, clause.getFirstToken(), 75 /* CaseKeyword */, 81 /* DefaultKeyword */);
ts.forEach(aggregateAllBreakAndContinueStatements(clause), function (statement) {
if (ownsBreakOrContinueStatement(switchStatement, statement)) {
- pushKeywordIf(keywords, statement.getFirstToken(), 73 /* BreakKeyword */);
+ pushKeywordIf(keywords, statement.getFirstToken(), 74 /* BreakKeyword */);
}
});
});
@@ -100652,13 +101587,13 @@
}
function getTryCatchFinallyOccurrences(tryStatement, sourceFile) {
var keywords = [];
- pushKeywordIf(keywords, tryStatement.getFirstToken(), 103 /* TryKeyword */);
+ pushKeywordIf(keywords, tryStatement.getFirstToken(), 104 /* TryKeyword */);
if (tryStatement.catchClause) {
- pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 75 /* CatchKeyword */);
+ pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 76 /* CatchKeyword */);
}
if (tryStatement.finallyBlock) {
- var finallyKeyword = ts.findChildOfKind(tryStatement, 88 /* FinallyKeyword */, sourceFile);
- pushKeywordIf(keywords, finallyKeyword, 88 /* FinallyKeyword */);
+ var finallyKeyword = ts.findChildOfKind(tryStatement, 89 /* FinallyKeyword */, sourceFile);
+ pushKeywordIf(keywords, finallyKeyword, 89 /* FinallyKeyword */);
}
return keywords;
}
@@ -100669,13 +101604,13 @@
}
var keywords = [];
ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) {
- keywords.push(ts.findChildOfKind(throwStatement, 101 /* ThrowKeyword */, sourceFile));
+ keywords.push(ts.findChildOfKind(throwStatement, 102 /* ThrowKeyword */, sourceFile));
});
// If the "owner" is a function, then we equate 'return' and 'throw' statements in their
// ability to "jump out" of the function, and include occurrences for both.
if (ts.isFunctionBlock(owner)) {
ts.forEachReturnStatement(owner, function (returnStatement) {
- keywords.push(ts.findChildOfKind(returnStatement, 97 /* ReturnKeyword */, sourceFile));
+ keywords.push(ts.findChildOfKind(returnStatement, 98 /* ReturnKeyword */, sourceFile));
});
}
return keywords;
@@ -100687,11 +101622,11 @@
}
var keywords = [];
ts.forEachReturnStatement(ts.cast(func.body, ts.isBlock), function (returnStatement) {
- keywords.push(ts.findChildOfKind(returnStatement, 97 /* ReturnKeyword */, sourceFile));
+ keywords.push(ts.findChildOfKind(returnStatement, 98 /* ReturnKeyword */, sourceFile));
});
// Include 'throw' statements that do not occur within a try block.
ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) {
- keywords.push(ts.findChildOfKind(throwStatement, 101 /* ThrowKeyword */, sourceFile));
+ keywords.push(ts.findChildOfKind(throwStatement, 102 /* ThrowKeyword */, sourceFile));
});
return keywords;
}
@@ -100703,13 +101638,13 @@
var keywords = [];
if (func.modifiers) {
func.modifiers.forEach(function (modifier) {
- pushKeywordIf(keywords, modifier, 121 /* AsyncKeyword */);
+ pushKeywordIf(keywords, modifier, 122 /* AsyncKeyword */);
});
}
ts.forEachChild(func, function (child) {
traverseWithoutCrossingFunction(child, function (node) {
if (ts.isAwaitExpression(node)) {
- pushKeywordIf(keywords, node.getFirstToken(), 122 /* AwaitKeyword */);
+ pushKeywordIf(keywords, node.getFirstToken(), 123 /* AwaitKeyword */);
}
});
});
@@ -100724,7 +101659,7 @@
ts.forEachChild(func, function (child) {
traverseWithoutCrossingFunction(child, function (node) {
if (ts.isYieldExpression(node)) {
- pushKeywordIf(keywords, node.getFirstToken(), 117 /* YieldKeyword */);
+ pushKeywordIf(keywords, node.getFirstToken(), 118 /* YieldKeyword */);
}
});
});
@@ -100743,7 +101678,7 @@
// We'd like to highlight else/ifs together if they are only separated by whitespace
// (i.e. the keywords are separated by no comments, no newlines).
for (var i = 0; i < keywords.length; i++) {
- if (keywords[i].kind === 83 /* ElseKeyword */ && i < keywords.length - 1) {
+ if (keywords[i].kind === 84 /* ElseKeyword */ && i < keywords.length - 1) {
var elseKeyword = keywords[i];
var ifKeyword = keywords[i + 1]; // this *should* always be an 'if' keyword.
var shouldCombineElseAndIf = true;
@@ -100778,10 +101713,10 @@
// Now traverse back down through the else branches, aggregating if/else keywords of if-statements.
while (true) {
var children = ifStatement.getChildren(sourceFile);
- pushKeywordIf(keywords, children[0], 91 /* IfKeyword */);
+ pushKeywordIf(keywords, children[0], 92 /* IfKeyword */);
// Generally the 'else' keyword is second-to-last, so we traverse backwards.
for (var i = children.length - 1; i >= 0; i--) {
- if (pushKeywordIf(keywords, children[i], 83 /* ElseKeyword */)) {
+ if (pushKeywordIf(keywords, children[i], 84 /* ElseKeyword */)) {
break;
}
}
@@ -100997,12 +101932,12 @@
if (cancellationToken)
cancellationToken.throwIfCancellationRequested();
switch (direct.kind) {
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
if (!isAvailableThroughGlobal) {
var parent = direct.parent;
- if (exportKind === 2 /* ExportEquals */ && parent.kind === 237 /* VariableDeclaration */) {
+ if (exportKind === 2 /* ExportEquals */ && parent.kind === 238 /* VariableDeclaration */) {
var name = parent.name;
- if (name.kind === 72 /* Identifier */) {
+ if (name.kind === 73 /* Identifier */) {
directImports.push(name);
break;
}
@@ -101011,22 +101946,22 @@
addIndirectUser(direct.getSourceFile());
}
break;
- case 72 /* Identifier */: // for 'const x = require("y");
+ case 73 /* Identifier */: // for 'const x = require("y");
break; // TODO: GH#23879
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
handleNamespaceImport(direct, direct.name, ts.hasModifier(direct, 1 /* Export */), /*alreadyAddedDirect*/ false);
break;
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
directImports.push(direct);
var namedBindings = direct.importClause && direct.importClause.namedBindings;
- if (namedBindings && namedBindings.kind === 251 /* NamespaceImport */) {
+ if (namedBindings && namedBindings.kind === 252 /* NamespaceImport */) {
handleNamespaceImport(direct, namedBindings.name, /*isReExport*/ false, /*alreadyAddedDirect*/ true);
}
else if (!isAvailableThroughGlobal && ts.isDefaultImport(direct)) {
addIndirectUser(getSourceFileLikeForImportDeclaration(direct)); // Add a check for indirect uses to handle synthetic default imports
}
break;
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
if (!direct.exportClause) {
// This is `export * from "foo"`, so imports of this module may import the export too.
handleDirectImports(getContainingModuleSymbol(direct, checker));
@@ -101036,11 +101971,11 @@
directImports.push(direct);
}
break;
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
directImports.push(direct);
break;
default:
- ts.Debug.assertNever(direct, "Unexpected import kind: " + ts.Debug.showSyntaxKind(direct));
+ ts.Debug.failBadSyntaxKind(direct, "Unexpected import kind.");
}
}
}
@@ -101053,7 +101988,7 @@
}
else if (!isAvailableThroughGlobal) {
var sourceFileLike = getSourceFileLikeForImportDeclaration(importDeclaration);
- ts.Debug.assert(sourceFileLike.kind === 284 /* SourceFile */ || sourceFileLike.kind === 244 /* ModuleDeclaration */);
+ ts.Debug.assert(sourceFileLike.kind === 285 /* SourceFile */ || sourceFileLike.kind === 245 /* ModuleDeclaration */);
if (isReExport || findNamespaceReExports(sourceFileLike, name, checker)) {
addIndirectUsers(sourceFileLike);
}
@@ -101108,17 +102043,17 @@
}
return { importSearches: importSearches, singleReferences: singleReferences };
function handleImport(decl) {
- if (decl.kind === 248 /* ImportEqualsDeclaration */) {
+ if (decl.kind === 249 /* ImportEqualsDeclaration */) {
if (isExternalModuleImportEquals(decl)) {
handleNamespaceImportLike(decl.name);
}
return;
}
- if (decl.kind === 72 /* Identifier */) {
+ if (decl.kind === 73 /* Identifier */) {
handleNamespaceImportLike(decl);
return;
}
- if (decl.kind === 183 /* ImportType */) {
+ if (decl.kind === 184 /* ImportType */) {
if (decl.qualifier) {
if (ts.isIdentifier(decl.qualifier) && decl.qualifier.escapedText === ts.symbolName(exportSymbol)) {
singleReferences.push(decl.qualifier);
@@ -101133,17 +102068,17 @@
if (decl.moduleSpecifier.kind !== 10 /* StringLiteral */) {
return;
}
- if (decl.kind === 255 /* ExportDeclaration */) {
+ if (decl.kind === 256 /* ExportDeclaration */) {
searchForNamedImport(decl.exportClause);
return;
}
var _a = decl.importClause || { name: undefined, namedBindings: undefined }, name = _a.name, namedBindings = _a.namedBindings;
if (namedBindings) {
switch (namedBindings.kind) {
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
handleNamespaceImportLike(namedBindings.name);
break;
- case 252 /* NamedImports */:
+ case 253 /* NamedImports */:
// 'default' might be accessed as a named import `{ default as foo }`.
if (exportKind === 0 /* Named */ || exportKind === 1 /* Default */) {
searchForNamedImport(namedBindings);
@@ -101193,7 +102128,7 @@
}
}
else {
- var localSymbol = element.kind === 257 /* ExportSpecifier */ && element.propertyName
+ var localSymbol = element.kind === 258 /* ExportSpecifier */ && element.propertyName
? checker.getExportSpecifierLocalTargetSymbol(element) // For re-exporting under a different name, we want to get the re-exported symbol.
: checker.getSymbolAtLocation(name);
addSearch(name, localSymbol);
@@ -101222,7 +102157,7 @@
for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) {
var referencingFile = sourceFiles_1[_i];
var searchSourceFile = searchModuleSymbol.valueDeclaration;
- if (searchSourceFile.kind === 284 /* SourceFile */) {
+ if (searchSourceFile.kind === 285 /* SourceFile */) {
for (var _a = 0, _b = referencingFile.referencedFiles; _a < _b.length; _a++) {
var ref = _b[_a];
if (program.getSourceFileFromReference(referencingFile, ref) === searchSourceFile) {
@@ -101270,7 +102205,7 @@
}
/** Iterates over all statements at the top level or in module declarations. Returns the first truthy result. */
function forEachPossibleImportOrExportStatement(sourceFileLike, action) {
- return ts.forEach(sourceFileLike.kind === 284 /* SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) {
+ return ts.forEach(sourceFileLike.kind === 285 /* SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) {
return action(statement) || (isAmbientModuleDeclaration(statement) && ts.forEach(statement.body && statement.body.statements, action));
});
}
@@ -101285,15 +102220,15 @@
else {
forEachPossibleImportOrExportStatement(sourceFile, function (statement) {
switch (statement.kind) {
- case 255 /* ExportDeclaration */:
- case 249 /* ImportDeclaration */: {
+ case 256 /* ExportDeclaration */:
+ case 250 /* ImportDeclaration */: {
var decl = statement;
if (decl.moduleSpecifier && ts.isStringLiteral(decl.moduleSpecifier)) {
action(decl, decl.moduleSpecifier);
}
break;
}
- case 248 /* ImportEqualsDeclaration */: {
+ case 249 /* ImportEqualsDeclaration */: {
var decl = statement;
if (isExternalModuleImportEquals(decl)) {
action(decl, decl.moduleReference.expression);
@@ -101317,7 +102252,7 @@
var parent = node.parent;
var grandParent = parent.parent;
if (symbol.exportSymbol) {
- if (parent.kind === 189 /* PropertyAccessExpression */) {
+ if (parent.kind === 190 /* PropertyAccessExpression */) {
// When accessing an export of a JS module, there's no alias. The symbol will still be flagged as an export even though we're at the use.
// So check that we are at the declaration.
return symbol.declarations.some(function (d) { return d === parent; }) && ts.isBinaryExpression(grandParent)
@@ -101383,7 +102318,7 @@
var sym = useLhsSymbol ? checker.getSymbolAtLocation(ts.cast(node.left, ts.isPropertyAccessExpression).name) : symbol;
// Better detection for GH#20803
if (sym && !(checker.getMergedSymbol(sym.parent).flags & 1536 /* Module */)) {
- ts.Debug.fail("Special property assignment kind does not have a module as its parent. Assignment is " + ts.Debug.showSymbol(sym) + ", parent is " + ts.Debug.showSymbol(sym.parent));
+ ts.Debug.fail("Special property assignment kind does not have a module as its parent. Assignment is " + ts.Debug.formatSymbol(sym) + ", parent is " + ts.Debug.formatSymbol(sym.parent));
}
return sym && exportInfo(sym, kind);
}
@@ -101439,10 +102374,10 @@
// If a reference is a class expression, the exported node would be its parent.
// If a reference is a variable declaration, the exported node would be the variable statement.
function getExportNode(parent, node) {
- if (parent.kind === 237 /* VariableDeclaration */) {
+ if (parent.kind === 238 /* VariableDeclaration */) {
var p = parent;
return p.name !== node ? undefined :
- p.parent.kind === 274 /* CatchClause */ ? undefined : p.parent.parent.kind === 219 /* VariableStatement */ ? p.parent.parent : undefined;
+ p.parent.kind === 275 /* CatchClause */ ? undefined : p.parent.parent.kind === 220 /* VariableStatement */ ? p.parent.parent : undefined;
}
else {
return parent;
@@ -101451,13 +102386,13 @@
function isNodeImport(node) {
var parent = node.parent;
switch (parent.kind) {
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return parent.name === node && isExternalModuleImportEquals(parent);
- case 253 /* ImportSpecifier */:
+ case 254 /* ImportSpecifier */:
// For a rename import `{ foo as bar }`, don't search for the imported symbol. Just find local uses of `bar`.
return !parent.propertyName;
- case 250 /* ImportClause */:
- case 251 /* NamespaceImport */:
+ case 251 /* ImportClause */:
+ case 252 /* NamespaceImport */:
ts.Debug.assert(parent.name === node);
return true;
default:
@@ -101490,21 +102425,21 @@
return checker.getMergedSymbol(getSourceFileLikeForImportDeclaration(importer).symbol);
}
function getSourceFileLikeForImportDeclaration(node) {
- if (node.kind === 191 /* CallExpression */) {
+ if (node.kind === 192 /* CallExpression */) {
return node.getSourceFile();
}
var parent = node.parent;
- if (parent.kind === 284 /* SourceFile */) {
+ if (parent.kind === 285 /* SourceFile */) {
return parent;
}
- ts.Debug.assert(parent.kind === 245 /* ModuleBlock */);
+ ts.Debug.assert(parent.kind === 246 /* ModuleBlock */);
return ts.cast(parent.parent, isAmbientModuleDeclaration);
}
function isAmbientModuleDeclaration(node) {
- return node.kind === 244 /* ModuleDeclaration */ && node.name.kind === 10 /* StringLiteral */;
+ return node.kind === 245 /* ModuleDeclaration */ && node.name.kind === 10 /* StringLiteral */;
}
function isExternalModuleImportEquals(eq) {
- return eq.moduleReference.kind === 259 /* ExternalModuleReference */ && eq.moduleReference.expression.kind === 10 /* StringLiteral */;
+ return eq.moduleReference.kind === 260 /* ExternalModuleReference */ && eq.moduleReference.expression.kind === 10 /* StringLiteral */;
}
})(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {}));
})(ts || (ts = {}));
@@ -101556,18 +102491,18 @@
}
FindAllReferences.getImplementationsAtPosition = getImplementationsAtPosition;
function getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node, position) {
- if (node.kind === 284 /* SourceFile */) {
+ if (node.kind === 285 /* SourceFile */) {
return undefined;
}
var checker = program.getTypeChecker();
// If invoked directly on a shorthand property assignment, then return
// the declaration of the symbol being assigned (not the symbol being assigned to).
- if (node.parent.kind === 276 /* ShorthandPropertyAssignment */) {
+ if (node.parent.kind === 277 /* ShorthandPropertyAssignment */) {
var result_1 = [];
FindAllReferences.Core.getReferenceEntriesForShorthandPropertyAssignment(node, checker, function (node) { return result_1.push(nodeEntry(node)); });
return result_1;
}
- else if (node.kind === 98 /* SuperKeyword */ || ts.isSuperProperty(node.parent)) {
+ else if (node.kind === 99 /* SuperKeyword */ || ts.isSuperProperty(node.parent)) {
// References to and accesses on the super keyword only have one possible implementation, so no
// need to "Find all References"
var symbol = checker.getSymbolAtLocation(node);
@@ -101647,7 +102582,7 @@
textSpan: textSpan,
fileName: fileName,
isWriteAccess: isWriteAccessForReference(node),
- isDefinition: node.kind === 80 /* DefaultKeyword */
+ isDefinition: node.kind === 81 /* DefaultKeyword */
|| !!ts.getDeclarationFromName(node)
|| ts.isLiteralComputedPropertyDeclarationName(node),
isInString: kind === 2 /* StringLiteral */ ? true : undefined,
@@ -101704,13 +102639,13 @@
if (symbol) {
return getDefinitionKindAndDisplayParts(symbol, checker, node);
}
- else if (node.kind === 188 /* ObjectLiteralExpression */) {
+ else if (node.kind === 189 /* ObjectLiteralExpression */) {
return {
kind: "interface" /* interfaceElement */,
displayParts: [ts.punctuationPart(20 /* OpenParenToken */), ts.textPart("object literal"), ts.punctuationPart(21 /* CloseParenToken */)]
};
}
- else if (node.kind === 209 /* ClassExpression */) {
+ else if (node.kind === 210 /* ClassExpression */) {
return {
kind: "local class" /* localClassElement */,
displayParts: [ts.punctuationPart(20 /* OpenParenToken */), ts.textPart("anonymous local class"), ts.punctuationPart(21 /* CloseParenToken */)]
@@ -101753,7 +102688,7 @@
/** A node is considered a writeAccess iff it is a name of a declaration or a target of an assignment */
function isWriteAccessForReference(node) {
var decl = ts.getDeclarationFromName(node);
- return !!decl && declarationIsWriteAccess(decl) || node.kind === 80 /* DefaultKeyword */ || ts.isWriteAccess(node);
+ return !!decl && declarationIsWriteAccess(decl) || node.kind === 81 /* DefaultKeyword */ || ts.isWriteAccess(node);
}
/**
* True if 'decl' provides a value, as in `function f() {}`;
@@ -101764,46 +102699,46 @@
if (!!(decl.flags & 4194304 /* Ambient */))
return true;
switch (decl.kind) {
- case 204 /* BinaryExpression */:
- case 186 /* BindingElement */:
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 80 /* DefaultKeyword */:
- case 243 /* EnumDeclaration */:
- case 278 /* EnumMember */:
- case 257 /* ExportSpecifier */:
- case 250 /* ImportClause */: // default import
- case 248 /* ImportEqualsDeclaration */:
- case 253 /* ImportSpecifier */:
- case 241 /* InterfaceDeclaration */:
- case 302 /* JSDocCallbackTag */:
- case 309 /* JSDocTypedefTag */:
- case 267 /* JsxAttribute */:
- case 244 /* ModuleDeclaration */:
- case 247 /* NamespaceExportDeclaration */:
- case 251 /* NamespaceImport */:
- case 151 /* Parameter */:
- case 276 /* ShorthandPropertyAssignment */:
- case 242 /* TypeAliasDeclaration */:
- case 150 /* TypeParameter */:
+ case 205 /* BinaryExpression */:
+ case 187 /* BindingElement */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 81 /* DefaultKeyword */:
+ case 244 /* EnumDeclaration */:
+ case 279 /* EnumMember */:
+ case 258 /* ExportSpecifier */:
+ case 251 /* ImportClause */: // default import
+ case 249 /* ImportEqualsDeclaration */:
+ case 254 /* ImportSpecifier */:
+ case 242 /* InterfaceDeclaration */:
+ case 303 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 268 /* JsxAttribute */:
+ case 245 /* ModuleDeclaration */:
+ case 248 /* NamespaceExportDeclaration */:
+ case 252 /* NamespaceImport */:
+ case 152 /* Parameter */:
+ case 277 /* ShorthandPropertyAssignment */:
+ case 243 /* TypeAliasDeclaration */:
+ case 151 /* TypeParameter */:
return true;
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
// In `({ x: y } = 0);`, `x` is not a write access. (Won't call this function for `y`.)
return !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(decl.parent);
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 157 /* Constructor */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 158 /* Constructor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return !!decl.body;
- case 237 /* VariableDeclaration */:
- case 154 /* PropertyDeclaration */:
+ case 238 /* VariableDeclaration */:
+ case 155 /* PropertyDeclaration */:
return !!decl.initializer || ts.isCatchClause(decl.parent);
- case 155 /* MethodSignature */:
- case 153 /* PropertySignature */:
- case 310 /* JSDocPropertyTag */:
- case 304 /* JSDocParameterTag */:
+ case 156 /* MethodSignature */:
+ case 154 /* PropertySignature */:
+ case 311 /* JSDocPropertyTag */:
+ case 305 /* JSDocParameterTag */:
return false;
default:
return ts.Debug.failBadSyntaxKind(decl);
@@ -101963,10 +102898,10 @@
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var decl = _a[_i];
switch (decl.kind) {
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
// Don't include the source file itself. (This may not be ideal behavior, but awkward to include an entire file as a reference.)
break;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
if (sourceFilesSet.has(decl.getSourceFile().fileName)) {
references.push(FindAllReferences.nodeEntry(decl.name));
}
@@ -101986,7 +102921,7 @@
var node = ts.isBinaryExpression(decl) && ts.isPropertyAccessExpression(decl.left)
? decl.left.expression
: ts.isExportAssignment(decl)
- ? ts.Debug.assertDefined(ts.findChildOfKind(decl, 85 /* ExportKeyword */, sourceFile))
+ ? ts.Debug.assertDefined(ts.findChildOfKind(decl, 86 /* ExportKeyword */, sourceFile))
: ts.getNameOfDeclaration(decl) || decl;
references.push(FindAllReferences.nodeEntry(node));
}
@@ -102013,7 +102948,7 @@
if (ts.isThis(node)) {
return getReferencesForThisKeyword(node, sourceFiles, cancellationToken);
}
- if (node.kind === 98 /* SuperKeyword */) {
+ if (node.kind === 99 /* SuperKeyword */) {
return getReferencesForSuperKeyword(node);
}
return undefined;
@@ -102030,7 +102965,7 @@
// When renaming at an export specifier, rename the export and not the thing being exported.
getReferencesAtExportSpecifier(exportSpecifier.name, symbol, exportSpecifier, state.createSearch(node, originalSymbol, /*comingFrom*/ undefined), state, /*addReferencesHere*/ true, /*alwaysGetReferences*/ true);
}
- else if (node && node.kind === 80 /* DefaultKeyword */) {
+ else if (node && node.kind === 81 /* DefaultKeyword */) {
addReference(node, symbol, state);
searchForImportsOfExport(node, symbol, { exportingModuleSymbol: ts.Debug.assertDefined(symbol.parent, "Expected export symbol to have a parent"), exportKind: 1 /* Default */ }, state);
}
@@ -102058,9 +102993,9 @@
}
function getSpecialSearchKind(node) {
switch (node.kind) {
- case 124 /* ConstructorKeyword */:
+ case 125 /* ConstructorKeyword */:
return 1 /* Constructor */;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
if (ts.isClassLike(node.parent)) {
ts.Debug.assert(node.parent.name === node);
return 2 /* Class */;
@@ -102083,7 +103018,7 @@
if (symbol.flags & 33554432 /* Transient */)
return undefined;
// Assertions for GH#21814. We should be handling SourceFile symbols in `getReferencedSymbolsForModule` instead of getting here.
- ts.Debug.fail("Unexpected symbol at " + ts.Debug.showSyntaxKind(node) + ": " + ts.Debug.showSymbol(symbol));
+ ts.Debug.fail("Unexpected symbol at " + ts.Debug.formatSyntaxKind(node.kind) + ": " + ts.Debug.formatSymbol(symbol));
}
return ts.isTypeLiteralNode(decl.parent) && ts.isUnionTypeNode(decl.parent.parent)
? checker.getPropertyOfType(checker.getTypeFromTypeNode(decl.parent.parent), symbol.name)
@@ -102188,8 +103123,8 @@
var sourceId = ts.getNodeId(sourceFile);
var seenSymbols = this.sourceFileToSeenSymbols[sourceId] || (this.sourceFileToSeenSymbols[sourceId] = ts.createMap());
var anyNewSymbols = false;
- for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) {
- var sym = symbols_2[_i];
+ for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) {
+ var sym = symbols_3[_i];
anyNewSymbols = ts.addToSeen(seenSymbols, ts.getSymbolId(sym)) || anyNewSymbols;
}
return anyNewSymbols;
@@ -102296,7 +103231,7 @@
// If this is the symbol of a named function expression or named class expression,
// then named references are limited to its own scope.
var declarations = symbol.declarations, flags = symbol.flags, parent = symbol.parent, valueDeclaration = symbol.valueDeclaration;
- if (valueDeclaration && (valueDeclaration.kind === 196 /* FunctionExpression */ || valueDeclaration.kind === 209 /* ClassExpression */)) {
+ if (valueDeclaration && (valueDeclaration.kind === 197 /* FunctionExpression */ || valueDeclaration.kind === 210 /* ClassExpression */)) {
return valueDeclaration;
}
if (!declarations) {
@@ -102306,7 +103241,7 @@
if (flags & (4 /* Property */ | 8192 /* Method */)) {
var privateDeclaration = ts.find(declarations, function (d) { return ts.hasModifier(d, 8 /* Private */); });
if (privateDeclaration) {
- return ts.getAncestor(privateDeclaration, 240 /* ClassDeclaration */);
+ return ts.getAncestor(privateDeclaration, 241 /* ClassDeclaration */);
}
// Else this is a public property and could be accessed from anywhere.
return undefined;
@@ -102335,7 +103270,7 @@
// Different declarations have different containers, bail out
return undefined;
}
- if (!container || container.kind === 284 /* SourceFile */ && !ts.isExternalOrCommonJsModule(container)) {
+ if (!container || container.kind === 285 /* SourceFile */ && !ts.isExternalOrCommonJsModule(container)) {
// This is a global variable and not an external module, any declaration defined
// within this scope is visible outside the file
return undefined;
@@ -102422,8 +103357,8 @@
// We found a match. Make sure it's not part of a larger word (i.e. the char
// before and after it have to be a non-identifier char).
var endPosition = position + symbolNameLength;
- if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 7 /* Latest */)) &&
- (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 7 /* Latest */))) {
+ if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 8 /* Latest */)) &&
+ (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 8 /* Latest */))) {
// Found a real match. Keep searching.
positions.push(position);
}
@@ -102443,7 +103378,7 @@
function isValidReferencePosition(node, searchSymbolName) {
// Compare the length so we filter out strict superstrings of the symbol we are looking for
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return node.text.length === searchSymbolName.length;
case 10 /* StringLiteral */: {
var str = node;
@@ -102452,7 +103387,7 @@
}
case 8 /* NumericLiteral */:
return ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && node.text.length === searchSymbolName.length;
- case 80 /* DefaultKeyword */:
+ case 81 /* DefaultKeyword */:
return "default".length === searchSymbolName.length;
default:
return false;
@@ -102516,7 +103451,7 @@
return;
}
if (ts.isExportSpecifier(parent)) {
- ts.Debug.assert(referenceLocation.kind === 72 /* Identifier */);
+ ts.Debug.assert(referenceLocation.kind === 73 /* Identifier */);
getReferencesAtExportSpecifier(referenceLocation, referenceSymbol, parent, search, state, addReferencesHere);
return;
}
@@ -102572,8 +103507,8 @@
}
// For `export { foo as bar }`, rename `foo`, but not `bar`.
if (!isForRenameWithPrefixAndSuffixText(state.options) || alwaysGetReferences) {
- var isDefaultExport = referenceLocation.originalKeywordKind === 80 /* DefaultKeyword */
- || exportSpecifier.name.originalKeywordKind === 80 /* DefaultKeyword */;
+ var isDefaultExport = referenceLocation.originalKeywordKind === 81 /* DefaultKeyword */
+ || exportSpecifier.name.originalKeywordKind === 81 /* DefaultKeyword */;
var exportKind = isDefaultExport ? 1 /* Default */ : 0 /* Named */;
var exportSymbol = ts.Debug.assertDefined(exportSpecifier.symbol);
var exportInfo = ts.Debug.assertDefined(FindAllReferences.getExportInfo(exportSymbol, exportKind, state.checker));
@@ -102652,7 +103587,7 @@
}
var pusher = function () { return state.referenceAdder(search.symbol); };
if (ts.isClassLike(referenceLocation.parent)) {
- ts.Debug.assert(referenceLocation.kind === 80 /* DefaultKeyword */ || referenceLocation.parent.name === referenceLocation);
+ ts.Debug.assert(referenceLocation.kind === 81 /* DefaultKeyword */ || referenceLocation.parent.name === referenceLocation);
// This is the class declaration containing the constructor.
findOwnConstructorReferences(search.symbol, sourceFile, pusher());
}
@@ -102679,7 +103614,7 @@
}
if (member.body) {
member.body.forEachChild(function cb(node) {
- if (node.kind === 100 /* ThisKeyword */) {
+ if (node.kind === 101 /* ThisKeyword */) {
addRef(node);
}
else if (!ts.isFunctionLike(node) && !ts.isClassLike(node)) {
@@ -102698,18 +103633,18 @@
if (constructorSymbol) {
for (var _i = 0, _a = constructorSymbol.declarations; _i < _a.length; _i++) {
var decl = _a[_i];
- var ctrKeyword = ts.findChildOfKind(decl, 124 /* ConstructorKeyword */, sourceFile);
- ts.Debug.assert(decl.kind === 157 /* Constructor */ && !!ctrKeyword);
+ var ctrKeyword = ts.findChildOfKind(decl, 125 /* ConstructorKeyword */, sourceFile);
+ ts.Debug.assert(decl.kind === 158 /* Constructor */ && !!ctrKeyword);
addNode(ctrKeyword);
}
}
if (classSymbol.exports) {
classSymbol.exports.forEach(function (member) {
var decl = member.valueDeclaration;
- if (decl && decl.kind === 156 /* MethodDeclaration */) {
+ if (decl && decl.kind === 157 /* MethodDeclaration */) {
var body = decl.body;
if (body) {
- forEachDescendantOfKind(body, 100 /* ThisKeyword */, function (thisKeyword) {
+ forEachDescendantOfKind(body, 101 /* ThisKeyword */, function (thisKeyword) {
if (ts.isNewExpressionTarget(thisKeyword)) {
addNode(thisKeyword);
}
@@ -102730,10 +103665,10 @@
}
for (var _i = 0, _a = constructor.declarations; _i < _a.length; _i++) {
var decl = _a[_i];
- ts.Debug.assert(decl.kind === 157 /* Constructor */);
+ ts.Debug.assert(decl.kind === 158 /* Constructor */);
var body = decl.body;
if (body) {
- forEachDescendantOfKind(body, 98 /* SuperKeyword */, function (node) {
+ forEachDescendantOfKind(body, 99 /* SuperKeyword */, function (node) {
if (ts.isCallExpressionTarget(node)) {
addNode(node);
}
@@ -102757,10 +103692,10 @@
addReference(refNode);
return;
}
- if (refNode.kind !== 72 /* Identifier */) {
+ if (refNode.kind !== 73 /* Identifier */) {
return;
}
- if (refNode.parent.kind === 276 /* ShorthandPropertyAssignment */) {
+ if (refNode.parent.kind === 277 /* ShorthandPropertyAssignment */) {
// Go ahead and dereference the shorthand assignment by going to its definition
getReferenceEntriesForShorthandPropertyAssignment(refNode, state.checker, addReference);
}
@@ -102780,7 +103715,7 @@
}
else if (ts.isFunctionLike(typeHavingNode) && typeHavingNode.body) {
var body = typeHavingNode.body;
- if (body.kind === 218 /* Block */) {
+ if (body.kind === 219 /* Block */) {
ts.forEachReturnStatement(body, function (returnStatement) {
if (returnStatement.expression)
addIfImplementation(returnStatement.expression);
@@ -102808,13 +103743,13 @@
*/
function isImplementationExpression(node) {
switch (node.kind) {
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return isImplementationExpression(node.expression);
- case 197 /* ArrowFunction */:
- case 196 /* FunctionExpression */:
- case 188 /* ObjectLiteralExpression */:
- case 209 /* ClassExpression */:
- case 187 /* ArrayLiteralExpression */:
+ case 198 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
+ case 189 /* ObjectLiteralExpression */:
+ case 210 /* ClassExpression */:
+ case 188 /* ArrayLiteralExpression */:
return true;
default:
return false;
@@ -102867,13 +103802,13 @@
// Whether 'super' occurs in a static context within a class.
var staticFlag = 32 /* Static */;
switch (searchSpaceNode.kind) {
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
staticFlag &= ts.getModifierFlags(searchSpaceNode);
searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class
break;
@@ -102882,7 +103817,7 @@
}
var sourceFile = searchSpaceNode.getSourceFile();
var references = ts.mapDefined(getPossibleSymbolReferenceNodes(sourceFile, "super", searchSpaceNode), function (node) {
- if (node.kind !== 98 /* SuperKeyword */) {
+ if (node.kind !== 99 /* SuperKeyword */) {
return;
}
var container = ts.getSuperContainer(node, /*stopOnFunctions*/ false);
@@ -102894,41 +103829,41 @@
return [{ definition: { type: 0 /* Symbol */, symbol: searchSpaceNode.symbol }, references: references }];
}
function isParameterName(node) {
- return node.kind === 72 /* Identifier */ && node.parent.kind === 151 /* Parameter */ && node.parent.name === node;
+ return node.kind === 73 /* Identifier */ && node.parent.kind === 152 /* Parameter */ && node.parent.name === node;
}
function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles, cancellationToken) {
var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, /* includeArrowFunctions */ false);
// Whether 'this' occurs in a static context within a class.
var staticFlag = 32 /* Static */;
switch (searchSpaceNode.kind) {
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
if (ts.isObjectLiteralMethod(searchSpaceNode)) {
break;
}
// falls through
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
staticFlag &= ts.getModifierFlags(searchSpaceNode);
searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class
break;
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
if (ts.isExternalModule(searchSpaceNode) || isParameterName(thisOrSuperKeyword)) {
return undefined;
}
// falls through
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
break;
// Computed properties in classes are not handled here because references to this are illegal,
// so there is no point finding references to them.
default:
return undefined;
}
- var references = ts.flatMap(searchSpaceNode.kind === 284 /* SourceFile */ ? sourceFiles : [searchSpaceNode.getSourceFile()], function (sourceFile) {
+ var references = ts.flatMap(searchSpaceNode.kind === 285 /* SourceFile */ ? sourceFiles : [searchSpaceNode.getSourceFile()], function (sourceFile) {
cancellationToken.throwIfCancellationRequested();
return getPossibleSymbolReferenceNodes(sourceFile, "this", ts.isSourceFile(searchSpaceNode) ? sourceFile : searchSpaceNode).filter(function (node) {
if (!ts.isThis(node)) {
@@ -102936,19 +103871,19 @@
}
var container = ts.getThisContainer(node, /* includeArrowFunctions */ false);
switch (searchSpaceNode.kind) {
- case 196 /* FunctionExpression */:
- case 239 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
return searchSpaceNode.symbol === container.symbol;
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
return ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol;
- case 209 /* ClassExpression */:
- case 240 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
// Make sure the container belongs to the same class
// and has the appropriate static modifier from the original container.
return container.parent && searchSpaceNode.symbol === container.parent.symbol && (ts.getModifierFlags(container) & 32 /* Static */) === staticFlag;
- case 284 /* SourceFile */:
- return container.kind === 284 /* SourceFile */ && !ts.isExternalModule(container) && !isParameterName(node);
+ case 285 /* SourceFile */:
+ return container.kind === 285 /* SourceFile */ && !ts.isExternalModule(container) && !isParameterName(node);
}
});
}).map(function (n) { return FindAllReferences.nodeEntry(n); });
@@ -103067,7 +104002,7 @@
});
}
function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol, checker) {
- var bindingElement = ts.getDeclarationOfKind(symbol, 186 /* BindingElement */);
+ var bindingElement = ts.getDeclarationOfKind(symbol, 187 /* BindingElement */);
if (bindingElement && ts.isObjectBindingElementWithoutPropertyName(bindingElement)) {
return ts.getPropertySymbolFromBindingElement(checker, bindingElement);
}
@@ -103426,7 +104361,7 @@
else {
var defs = getDefinitionFromSymbol(typeChecker, symbol, node) || ts.emptyArray;
// For a 'super()' call, put the signature first, else put the variable first.
- return node.kind === 98 /* SuperKeyword */ ? [sigInfo].concat(defs) : defs.concat([sigInfo]);
+ return node.kind === 99 /* SuperKeyword */ ? [sigInfo].concat(defs) : defs.concat([sigInfo]);
}
}
// Because name in short-hand property assignment has two different meanings: property name and property value,
@@ -103434,7 +104369,7 @@
// go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition
// is performed at the location of property access, we would like to go to definition of the property in the short-hand
// assignment. This case and others are handled by the following code.
- if (node.parent.kind === 276 /* ShorthandPropertyAssignment */) {
+ if (node.parent.kind === 277 /* ShorthandPropertyAssignment */) {
var shorthandSymbol_1 = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration);
return shorthandSymbol_1 ? shorthandSymbol_1.declarations.map(function (decl) { return createDefinitionInfo(decl, typeChecker, shorthandSymbol_1, node); }) : [];
}
@@ -103587,18 +104522,18 @@
// (2) when the aliased symbol is originating from an import.
//
function shouldSkipAlias(node, declaration) {
- if (node.kind !== 72 /* Identifier */) {
+ if (node.kind !== 73 /* Identifier */) {
return false;
}
if (node.parent === declaration) {
return true;
}
switch (declaration.kind) {
- case 250 /* ImportClause */:
- case 248 /* ImportEqualsDeclaration */:
+ case 251 /* ImportClause */:
+ case 249 /* ImportEqualsDeclaration */:
return true;
- case 253 /* ImportSpecifier */:
- return declaration.parent.kind === 252 /* NamedImports */;
+ case 254 /* ImportSpecifier */:
+ return declaration.parent.kind === 253 /* NamedImports */;
default:
return false;
}
@@ -103608,7 +104543,7 @@
function getConstructSignatureDefinition() {
// Applicable only if we are in a new expression, or we are on a constructor declaration
// and in either case the symbol has a construct signature definition, i.e. class
- if (symbol.flags & 32 /* Class */ && (ts.isNewExpressionTarget(node) || node.kind === 124 /* ConstructorKeyword */)) {
+ if (symbol.flags & 32 /* Class */ && (ts.isNewExpressionTarget(node) || node.kind === 125 /* ConstructorKeyword */)) {
var cls = ts.find(symbol.declarations, ts.isClassLike) || ts.Debug.fail("Expected declaration to have at least one class-like declaration");
return getSignatureDefinition(cls.members, /*selectConstructors*/ true);
}
@@ -103682,9 +104617,9 @@
}
function isConstructorLike(node) {
switch (node.kind) {
- case 157 /* Constructor */:
- case 166 /* ConstructorType */:
- case 161 /* ConstructSignature */:
+ case 158 /* Constructor */:
+ case 167 /* ConstructorType */:
+ case 162 /* ConstructSignature */:
return true;
default:
return false;
@@ -103802,11 +104737,11 @@
JsDoc.getJsDocCommentsFromDeclarations = getJsDocCommentsFromDeclarations;
function getCommentHavingNodes(declaration) {
switch (declaration.kind) {
- case 304 /* JSDocParameterTag */:
- case 310 /* JSDocPropertyTag */:
+ case 305 /* JSDocParameterTag */:
+ case 311 /* JSDocPropertyTag */:
return [declaration];
- case 302 /* JSDocCallbackTag */:
- case 309 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
return [declaration, declaration.parent];
default:
return ts.getJSDocCommentsAndTags(declaration);
@@ -103827,16 +104762,16 @@
function getCommentText(tag) {
var comment = tag.comment;
switch (tag.kind) {
- case 300 /* JSDocAugmentsTag */:
+ case 301 /* JSDocAugmentsTag */:
return withNode(tag.class);
- case 308 /* JSDocTemplateTag */:
+ case 309 /* JSDocTemplateTag */:
return withList(tag.typeParameters);
- case 307 /* JSDocTypeTag */:
+ case 308 /* JSDocTypeTag */:
return withNode(tag.typeExpression);
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
- case 310 /* JSDocPropertyTag */:
- case 304 /* JSDocParameterTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
+ case 311 /* JSDocPropertyTag */:
+ case 305 /* JSDocParameterTag */:
var name = tag.name;
return name ? withNode(name) : comment;
default:
@@ -104013,7 +104948,7 @@
function parameterDocComments(parameters, isJavaScriptFile, indentationStr, newLine) {
return parameters.map(function (_a, i) {
var name = _a.name, dotDotDotToken = _a.dotDotDotToken;
- var paramName = name.kind === 72 /* Identifier */ ? name.text : "param" + i;
+ var paramName = name.kind === 73 /* Identifier */ ? name.text : "param" + i;
var type = isJavaScriptFile ? (dotDotDotToken ? "{...any} " : "{any} ") : "";
return indentationStr + " * @param " + type + paramName + newLine;
}).join("");
@@ -104023,23 +104958,23 @@
}
function getCommentOwnerInfoWorker(commentOwner) {
switch (commentOwner.kind) {
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 156 /* MethodDeclaration */:
- case 157 /* Constructor */:
- case 155 /* MethodSignature */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 157 /* MethodDeclaration */:
+ case 158 /* Constructor */:
+ case 156 /* MethodSignature */:
var parameters = commentOwner.parameters;
return { commentOwner: commentOwner, parameters: parameters };
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return getCommentOwnerInfoWorker(commentOwner.initializer);
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 153 /* PropertySignature */:
- case 243 /* EnumDeclaration */:
- case 278 /* EnumMember */:
- case 242 /* TypeAliasDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 154 /* PropertySignature */:
+ case 244 /* EnumDeclaration */:
+ case 279 /* EnumMember */:
+ case 243 /* TypeAliasDeclaration */:
return { commentOwner: commentOwner };
- case 219 /* VariableStatement */: {
+ case 220 /* VariableStatement */: {
var varStatement = commentOwner;
var varDeclarations = varStatement.declarationList.declarations;
var parameters_1 = varDeclarations.length === 1 && varDeclarations[0].initializer
@@ -104047,14 +104982,14 @@
: undefined;
return { commentOwner: commentOwner, parameters: parameters_1 };
}
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return "quit";
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
// If in walking up the tree, we hit a a nested namespace declaration,
// then we must be somewhere within a dotted namespace name; however we don't
// want to give back a JSDoc template for the 'b' or 'c' in 'namespace a.b.c { }'.
- return commentOwner.parent.kind === 244 /* ModuleDeclaration */ ? undefined : { commentOwner: commentOwner };
- case 204 /* BinaryExpression */: {
+ return commentOwner.parent.kind === 245 /* ModuleDeclaration */ ? undefined : { commentOwner: commentOwner };
+ case 205 /* BinaryExpression */: {
var be = commentOwner;
if (ts.getAssignmentDeclarationKind(be) === 0 /* None */) {
return "quit";
@@ -104073,14 +105008,14 @@
* @returns the parameters of a signature found on the RHS if one exists; otherwise 'emptyArray'.
*/
function getParametersFromRightHandSideOfAssignment(rightHandSide) {
- while (rightHandSide.kind === 195 /* ParenthesizedExpression */) {
+ while (rightHandSide.kind === 196 /* ParenthesizedExpression */) {
rightHandSide = rightHandSide.expression;
}
switch (rightHandSide.kind) {
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return rightHandSide.parameters;
- case 209 /* ClassExpression */: {
+ case 210 /* ClassExpression */: {
var ctr = ts.find(rightHandSide.members, ts.isConstructorDeclaration);
return ctr ? ctr.parameters : ts.emptyArray;
}
@@ -104142,9 +105077,9 @@
}
function shouldKeepItem(declaration, checker) {
switch (declaration.kind) {
- case 250 /* ImportClause */:
- case 253 /* ImportSpecifier */:
- case 248 /* ImportEqualsDeclaration */:
+ case 251 /* ImportClause */:
+ case 254 /* ImportSpecifier */:
+ case 249 /* ImportEqualsDeclaration */:
var importer = checker.getSymbolAtLocation(declaration.name); // TODO: GH#18217
var imported = checker.getAliasedSymbol(importer);
return importer.escapedName !== imported.escapedName;
@@ -104154,7 +105089,7 @@
}
function tryAddSingleDeclarationName(declaration, containers) {
var name = ts.getNameOfDeclaration(declaration);
- return !!name && (pushLiteral(name, containers) || name.kind === 149 /* ComputedPropertyName */ && tryAddComputedPropertyName(name.expression, containers));
+ return !!name && (pushLiteral(name, containers) || name.kind === 150 /* ComputedPropertyName */ && tryAddComputedPropertyName(name.expression, containers));
}
// Only added the names of computed properties if they're simple dotted expressions, like:
//
@@ -104171,7 +105106,7 @@
// First, if we started with a computed property name, then add all but the last
// portion into the container array.
var name = ts.getNameOfDeclaration(declaration);
- if (name && name.kind === 149 /* ComputedPropertyName */ && !tryAddComputedPropertyName(name.expression, containers)) {
+ if (name && name.kind === 150 /* ComputedPropertyName */ && !tryAddComputedPropertyName(name.expression, containers)) {
return ts.emptyArray;
}
// Don't include the last portion.
@@ -104340,7 +105275,7 @@
return;
}
switch (node.kind) {
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
// Get parameter properties, and treat them as being on the *same* level as the constructor, not under it.
var ctr = node;
addNodeWithRecursiveChild(ctr, ctr.body);
@@ -104352,21 +105287,21 @@
}
}
break;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 155 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 156 /* MethodSignature */:
if (!ts.hasDynamicName(node)) {
addNodeWithRecursiveChild(node, node.body);
}
break;
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
if (!ts.hasDynamicName(node)) {
addLeafNode(node);
}
break;
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
var importClause = node;
// Handle default import case e.g.:
// import d from "mod";
@@ -104378,7 +105313,7 @@
// import {a, b as B} from "mod";
var namedBindings = importClause.namedBindings;
if (namedBindings) {
- if (namedBindings.kind === 251 /* NamespaceImport */) {
+ if (namedBindings.kind === 252 /* NamespaceImport */) {
addLeafNode(namedBindings);
}
else {
@@ -104389,8 +105324,8 @@
}
}
break;
- case 186 /* BindingElement */:
- case 237 /* VariableDeclaration */:
+ case 187 /* BindingElement */:
+ case 238 /* VariableDeclaration */:
var _d = node, name = _d.name, initializer = _d.initializer;
if (ts.isBindingPattern(name)) {
addChildrenRecursively(name);
@@ -104411,12 +105346,12 @@
addNodeWithRecursiveChild(node, initializer);
}
break;
- case 197 /* ArrowFunction */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
addNodeWithRecursiveChild(node, node.body);
break;
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
startNode(node);
for (var _e = 0, _f = node.members; _e < _f.length; _e++) {
var member = _f[_e];
@@ -104426,9 +105361,9 @@
}
endNode();
break;
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
startNode(node);
for (var _g = 0, _h = node.members; _g < _h.length; _g++) {
var member = _h[_g];
@@ -104436,18 +105371,18 @@
}
endNode();
break;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
addNodeWithRecursiveChild(node, getInteriorModule(node).body);
break;
- case 257 /* ExportSpecifier */:
- case 248 /* ImportEqualsDeclaration */:
- case 162 /* IndexSignature */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 242 /* TypeAliasDeclaration */:
+ case 258 /* ExportSpecifier */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 163 /* IndexSignature */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 243 /* TypeAliasDeclaration */:
addLeafNode(node);
break;
- case 204 /* BinaryExpression */: {
+ case 205 /* BinaryExpression */: {
var special = ts.getAssignmentDeclarationKind(node);
switch (special) {
case 1 /* ExportsProperty */:
@@ -104529,12 +105464,12 @@
return false;
}
switch (a.kind) {
- case 154 /* PropertyDeclaration */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 155 /* PropertyDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return ts.hasModifier(a, 32 /* Static */) === ts.hasModifier(b, 32 /* Static */);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return areSameModule(a, b);
default:
return true;
@@ -104550,7 +105485,7 @@
// Only merge module nodes that have the same chain. Don't merge 'A.B.C' with 'A'!
function areSameModule(a, b) {
// TODO: GH#18217
- return a.body.kind === b.body.kind && (a.body.kind !== 244 /* ModuleDeclaration */ || areSameModule(a.body, b.body));
+ return a.body.kind === b.body.kind && (a.body.kind !== 245 /* ModuleDeclaration */ || areSameModule(a.body, b.body));
}
/** Merge source into target. Source should be thrown away after this is called. */
function merge(target, source) {
@@ -104580,7 +105515,7 @@
* So `new()` can still come before an `aardvark` method.
*/
function tryGetName(node) {
- if (node.kind === 244 /* ModuleDeclaration */) {
+ if (node.kind === 245 /* ModuleDeclaration */) {
return getModuleName(node);
}
var declName = ts.getNameOfDeclaration(node);
@@ -104588,16 +105523,16 @@
return ts.unescapeLeadingUnderscores(ts.getPropertyNameForPropertyNameNode(declName)); // TODO: GH#18217
}
switch (node.kind) {
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 209 /* ClassExpression */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 210 /* ClassExpression */:
return getFunctionOrClassName(node);
default:
return undefined;
}
}
function getItemName(node, name) {
- if (node.kind === 244 /* ModuleDeclaration */) {
+ if (node.kind === 245 /* ModuleDeclaration */) {
return getModuleName(node);
}
if (name) {
@@ -104607,16 +105542,16 @@
}
}
switch (node.kind) {
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
var sourceFile = node;
return ts.isExternalModule(sourceFile)
? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\""
: "<global>";
- case 197 /* ArrowFunction */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 198 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
if (ts.getModifierFlags(node) & 512 /* Default */) {
return "default";
}
@@ -104624,13 +105559,13 @@
// (eg: "app\n.onactivated"), so we should remove the whitespace for readabiltiy in the
// navigation bar.
return getFunctionOrClassName(node);
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return "constructor";
- case 161 /* ConstructSignature */:
+ case 162 /* ConstructSignature */:
return "new()";
- case 160 /* CallSignature */:
+ case 161 /* CallSignature */:
return "()";
- case 162 /* IndexSignature */:
+ case 163 /* IndexSignature */:
return "[]";
default:
return "<unknown>";
@@ -104654,25 +105589,25 @@
return topLevel;
function isTopLevel(item) {
switch (navigationBarNodeKind(item)) {
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 243 /* EnumDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 284 /* SourceFile */:
- case 242 /* TypeAliasDeclaration */:
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
- return true;
- case 157 /* Constructor */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 237 /* VariableDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 244 /* EnumDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 285 /* SourceFile */:
+ case 243 /* TypeAliasDeclaration */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
+ return true;
+ case 158 /* Constructor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 238 /* VariableDeclaration */:
return hasSomeImportantChild(item);
- case 197 /* ArrowFunction */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
return isTopLevelFunctionDeclaration(item);
default:
return false;
@@ -104682,10 +105617,10 @@
return false;
}
switch (navigationBarNodeKind(item.parent)) {
- case 245 /* ModuleBlock */:
- case 284 /* SourceFile */:
- case 156 /* MethodDeclaration */:
- case 157 /* Constructor */:
+ case 246 /* ModuleBlock */:
+ case 285 /* SourceFile */:
+ case 157 /* MethodDeclaration */:
+ case 158 /* Constructor */:
return true;
default:
return hasSomeImportantChild(item);
@@ -104694,7 +105629,7 @@
function hasSomeImportantChild(item) {
return ts.some(item.children, function (child) {
var childKind = navigationBarNodeKind(child);
- return childKind !== 237 /* VariableDeclaration */ && childKind !== 186 /* BindingElement */;
+ return childKind !== 238 /* VariableDeclaration */ && childKind !== 187 /* BindingElement */;
});
}
}
@@ -104751,7 +105686,7 @@
// Otherwise, we need to aggregate each identifier to build up the qualified name.
var result = [];
result.push(ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name));
- while (moduleDeclaration.body && moduleDeclaration.body.kind === 244 /* ModuleDeclaration */) {
+ while (moduleDeclaration.body && moduleDeclaration.body.kind === 245 /* ModuleDeclaration */) {
moduleDeclaration = moduleDeclaration.body;
result.push(ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name));
}
@@ -104765,13 +105700,13 @@
return decl.body && ts.isModuleDeclaration(decl.body) ? getInteriorModule(decl.body) : decl;
}
function isComputedProperty(member) {
- return !member.name || member.name.kind === 149 /* ComputedPropertyName */;
+ return !member.name || member.name.kind === 150 /* ComputedPropertyName */;
}
function getNodeSpan(node) {
- return node.kind === 284 /* SourceFile */ ? ts.createTextSpanFromRange(node) : ts.createTextSpanFromNode(node, curSourceFile);
+ return node.kind === 285 /* SourceFile */ ? ts.createTextSpanFromRange(node) : ts.createTextSpanFromNode(node, curSourceFile);
}
function getModifiers(node) {
- if (node.parent && node.parent.kind === 237 /* VariableDeclaration */) {
+ if (node.parent && node.parent.kind === 238 /* VariableDeclaration */) {
node = node.parent;
}
return ts.getNodeModifiers(node);
@@ -104786,7 +105721,7 @@
return ts.declarationNameToString(parent.name);
}
// See if it is of the form "<expr> = function(){...}". If so, use the text from the left-hand side.
- else if (ts.isBinaryExpression(parent) && parent.operatorToken.kind === 59 /* EqualsToken */) {
+ else if (ts.isBinaryExpression(parent) && parent.operatorToken.kind === 60 /* EqualsToken */) {
return nodeText(parent.left).replace(whiteSpaceRegex, "");
}
// See if it is a property assignment, and if so use the property name
@@ -104824,9 +105759,9 @@
}
function isFunctionOrClassExpression(node) {
switch (node.kind) {
- case 197 /* ArrowFunction */:
- case 196 /* FunctionExpression */:
- case 209 /* ClassExpression */:
+ case 198 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
+ case 210 /* ClassExpression */:
return true;
default:
return false;
@@ -105153,7 +106088,7 @@
}
var lastImport = current - 1;
if (lastImport !== firstImport) {
- out.push(createOutliningSpanFromBounds(ts.findChildOfKind(statements[firstImport], 92 /* ImportKeyword */, sourceFile).getStart(sourceFile), statements[lastImport].getEnd(), "imports" /* Imports */));
+ out.push(createOutliningSpanFromBounds(ts.findChildOfKind(statements[firstImport], 93 /* ImportKeyword */, sourceFile).getStart(sourceFile), statements[lastImport].getEnd(), "imports" /* Imports */));
}
}
function visitNonImportNode(n) {
@@ -105270,31 +106205,31 @@
}
function getOutliningSpanForNode(n, sourceFile) {
switch (n.kind) {
- case 218 /* Block */:
- if (ts.isFunctionBlock(n)) {
- return spanForNode(n.parent, /*autoCollapse*/ n.parent.kind !== 197 /* ArrowFunction */);
+ case 219 /* Block */:
+ if (ts.isFunctionLike(n.parent)) {
+ return functionSpan(n.parent, n, sourceFile);
}
// Check if the block is standalone, or 'attached' to some parent statement.
// If the latter, we want to collapse the block, but consider its hint span
// to be the entire span of the parent.
switch (n.parent.kind) {
- case 223 /* DoStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 225 /* ForStatement */:
- case 222 /* IfStatement */:
- case 224 /* WhileStatement */:
- case 231 /* WithStatement */:
- case 274 /* CatchClause */:
+ case 224 /* DoStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 226 /* ForStatement */:
+ case 223 /* IfStatement */:
+ case 225 /* WhileStatement */:
+ case 232 /* WithStatement */:
+ case 275 /* CatchClause */:
return spanForNode(n.parent);
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
// Could be the try-block, or the finally-block.
var tryStatement = n.parent;
if (tryStatement.tryBlock === n) {
return spanForNode(n.parent);
}
else if (tryStatement.finallyBlock === n) {
- return spanForNode(ts.findChildOfKind(tryStatement, 88 /* FinallyKeyword */, sourceFile));
+ return spanForNode(ts.findChildOfKind(tryStatement, 89 /* FinallyKeyword */, sourceFile));
}
// falls through
default:
@@ -105302,22 +106237,22 @@
// the span of the block, independent of any parent span.
return createOutliningSpan(ts.createTextSpanFromNode(n, sourceFile), "code" /* Code */);
}
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
return spanForNode(n.parent);
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
- case 246 /* CaseBlock */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 247 /* CaseBlock */:
return spanForNode(n);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return spanForObjectOrArrayLiteral(n);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return spanForObjectOrArrayLiteral(n, 22 /* OpenBracketToken */);
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
return spanForJSXElement(n);
- case 261 /* JsxSelfClosingElement */:
- case 262 /* JsxOpeningElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
return spanForJSXAttributes(n.attributes);
}
function spanForJSXElement(node) {
@@ -105339,20 +106274,29 @@
// Otherwise, the collapsed section will include the end of the previous line.
return spanForNode(node, /*autoCollapse*/ false, /*useFullStart*/ !ts.isArrayLiteralExpression(node.parent) && !ts.isCallExpression(node.parent), open);
}
- function spanForNode(hintSpanNode, autoCollapse, useFullStart, open) {
+ function spanForNode(hintSpanNode, autoCollapse, useFullStart, open, close) {
if (autoCollapse === void 0) { autoCollapse = false; }
if (useFullStart === void 0) { useFullStart = true; }
if (open === void 0) { open = 18 /* OpenBraceToken */; }
+ if (close === void 0) { close = open === 18 /* OpenBraceToken */ ? 19 /* CloseBraceToken */ : 23 /* CloseBracketToken */; }
var openToken = ts.findChildOfKind(n, open, sourceFile);
- var close = open === 18 /* OpenBraceToken */ ? 19 /* CloseBraceToken */ : 23 /* CloseBracketToken */;
var closeToken = ts.findChildOfKind(n, close, sourceFile);
- if (!openToken || !closeToken) {
- return undefined;
+ return openToken && closeToken && spanBetweenTokens(openToken, closeToken, hintSpanNode, sourceFile, autoCollapse, useFullStart);
}
+ }
+ function functionSpan(node, body, sourceFile) {
+ var openToken = ts.isNodeArrayMultiLine(node.parameters, sourceFile)
+ ? ts.findChildOfKind(node, 20 /* OpenParenToken */, sourceFile)
+ : ts.findChildOfKind(body, 18 /* OpenBraceToken */, sourceFile);
+ var closeToken = ts.findChildOfKind(body, 19 /* CloseBraceToken */, sourceFile);
+ return openToken && closeToken && spanBetweenTokens(openToken, closeToken, node.parent, sourceFile, /*autoCollapse*/ node.parent.kind !== 198 /* ArrowFunction */);
+ }
+ function spanBetweenTokens(openToken, closeToken, hintSpanNode, sourceFile, autoCollapse, useFullStart) {
+ if (autoCollapse === void 0) { autoCollapse = false; }
+ if (useFullStart === void 0) { useFullStart = true; }
var textSpan = ts.createTextSpanFromBounds(useFullStart ? openToken.getFullStart() : openToken.getStart(sourceFile), closeToken.getEnd());
return createOutliningSpan(textSpan, "code" /* Code */, ts.createTextSpanFromNode(hintSpanNode, sourceFile), autoCollapse);
}
- }
function createOutliningSpan(textSpan, kind, hintSpan, autoCollapse, bannerText) {
if (hintSpan === void 0) { hintSpan = textSpan; }
if (autoCollapse === void 0) { autoCollapse = false; }
@@ -105615,7 +106559,7 @@
if (ch >= 65 /* A */ && ch <= 90 /* Z */) {
return true;
}
- if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 7 /* Latest */)) {
+ if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 8 /* Latest */)) {
return false;
}
// TODO: find a way to determine this for any unicode characters in a
@@ -105628,7 +106572,7 @@
if (ch >= 97 /* a */ && ch <= 122 /* z */) {
return true;
}
- if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 7 /* Latest */)) {
+ if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 8 /* Latest */)) {
return false;
}
// TODO: find a way to determine this for any unicode characters in a
@@ -105880,10 +106824,10 @@
*/
function tryConsumeDeclare() {
var token = ts.scanner.getToken();
- if (token === 125 /* DeclareKeyword */) {
+ if (token === 126 /* DeclareKeyword */) {
// declare module "mod"
token = nextToken();
- if (token === 130 /* ModuleKeyword */) {
+ if (token === 131 /* ModuleKeyword */) {
token = nextToken();
if (token === 10 /* StringLiteral */) {
recordAmbientExternalModule();
@@ -105901,7 +106845,7 @@
return false;
}
var token = ts.scanner.getToken();
- if (token === 92 /* ImportKeyword */) {
+ if (token === 93 /* ImportKeyword */) {
token = nextToken();
if (token === 20 /* OpenParenToken */) {
token = nextToken();
@@ -105917,9 +106861,9 @@
return true;
}
else {
- if (token === 72 /* Identifier */ || ts.isKeyword(token)) {
+ if (token === 73 /* Identifier */ || ts.isKeyword(token)) {
token = nextToken();
- if (token === 144 /* FromKeyword */) {
+ if (token === 145 /* FromKeyword */) {
token = nextToken();
if (token === 10 /* StringLiteral */) {
// import d from "mod";
@@ -105927,7 +106871,7 @@
return true;
}
}
- else if (token === 59 /* EqualsToken */) {
+ else if (token === 60 /* EqualsToken */) {
if (tryConsumeRequireCall(/*skipCurrentToken*/ true)) {
return true;
}
@@ -105950,7 +106894,7 @@
}
if (token === 19 /* CloseBraceToken */) {
token = nextToken();
- if (token === 144 /* FromKeyword */) {
+ if (token === 145 /* FromKeyword */) {
token = nextToken();
if (token === 10 /* StringLiteral */) {
// import {a as A} from "mod";
@@ -105962,11 +106906,11 @@
}
else if (token === 40 /* AsteriskToken */) {
token = nextToken();
- if (token === 119 /* AsKeyword */) {
+ if (token === 120 /* AsKeyword */) {
token = nextToken();
- if (token === 72 /* Identifier */ || ts.isKeyword(token)) {
+ if (token === 73 /* Identifier */ || ts.isKeyword(token)) {
token = nextToken();
- if (token === 144 /* FromKeyword */) {
+ if (token === 145 /* FromKeyword */) {
token = nextToken();
if (token === 10 /* StringLiteral */) {
// import * as NS from "mod"
@@ -105984,7 +106928,7 @@
}
function tryConsumeExport() {
var token = ts.scanner.getToken();
- if (token === 85 /* ExportKeyword */) {
+ if (token === 86 /* ExportKeyword */) {
markAsExternalModuleIfTopLevel();
token = nextToken();
if (token === 18 /* OpenBraceToken */) {
@@ -105996,7 +106940,7 @@
}
if (token === 19 /* CloseBraceToken */) {
token = nextToken();
- if (token === 144 /* FromKeyword */) {
+ if (token === 145 /* FromKeyword */) {
token = nextToken();
if (token === 10 /* StringLiteral */) {
// export {a as A} from "mod";
@@ -106008,7 +106952,7 @@
}
else if (token === 40 /* AsteriskToken */) {
token = nextToken();
- if (token === 144 /* FromKeyword */) {
+ if (token === 145 /* FromKeyword */) {
token = nextToken();
if (token === 10 /* StringLiteral */) {
// export * from "mod"
@@ -106016,11 +106960,11 @@
}
}
}
- else if (token === 92 /* ImportKeyword */) {
+ else if (token === 93 /* ImportKeyword */) {
token = nextToken();
- if (token === 72 /* Identifier */ || ts.isKeyword(token)) {
+ if (token === 73 /* Identifier */ || ts.isKeyword(token)) {
token = nextToken();
- if (token === 59 /* EqualsToken */) {
+ if (token === 60 /* EqualsToken */) {
if (tryConsumeRequireCall(/*skipCurrentToken*/ true)) {
return true;
}
@@ -106033,7 +106977,7 @@
}
function tryConsumeRequireCall(skipCurrentToken) {
var token = skipCurrentToken ? nextToken() : ts.scanner.getToken();
- if (token === 134 /* RequireKeyword */) {
+ if (token === 135 /* RequireKeyword */) {
token = nextToken();
if (token === 20 /* OpenParenToken */) {
token = nextToken();
@@ -106048,7 +106992,7 @@
}
function tryConsumeDefine() {
var token = ts.scanner.getToken();
- if (token === 72 /* Identifier */ && ts.scanner.getTokenValue() === "define") {
+ if (token === 73 /* Identifier */ && ts.scanner.getTokenValue() === "define") {
token = nextToken();
if (token !== 20 /* OpenParenToken */) {
return true;
@@ -106182,14 +107126,14 @@
return getRenameInfoError(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library);
}
// Cannot rename `default` as in `import { default as foo } from "./someModule";
- if (ts.isIdentifier(node) && node.originalKeywordKind === 80 /* DefaultKeyword */ && symbol.parent.flags & 1536 /* Module */) {
+ if (ts.isIdentifier(node) && node.originalKeywordKind === 81 /* DefaultKeyword */ && symbol.parent.flags & 1536 /* Module */) {
return undefined;
}
if (ts.isStringLiteralLike(node) && ts.tryGetImportFromModuleSpecifier(node)) {
return options && options.allowRenameOfImportPath ? getRenameInfoForModule(node, sourceFile, symbol) : undefined;
}
var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node);
- var specifierName = (ts.isImportOrExportSpecifierName(node) || ts.isStringOrNumericLiteralLike(node) && node.parent.kind === 149 /* ComputedPropertyName */)
+ var specifierName = (ts.isImportOrExportSpecifierName(node) || ts.isStringOrNumericLiteralLike(node) && node.parent.kind === 150 /* ComputedPropertyName */)
? ts.stripQuotes(ts.getTextOfIdentifierOrLiteral(node))
: undefined;
var displayName = specifierName || typeChecker.symbolToString(symbol);
@@ -106245,9 +107189,9 @@
}
function nodeIsEligibleForRename(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
case 10 /* StringLiteral */:
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
return true;
case 8 /* NumericLiteral */:
return ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node);
@@ -106260,6 +107204,275 @@
/* @internal */
var ts;
(function (ts) {
+ var SmartSelectionRange;
+ (function (SmartSelectionRange) {
+ function getSmartSelectionRange(pos, sourceFile) {
+ var selectionRange = {
+ textSpan: ts.createTextSpanFromBounds(sourceFile.getFullStart(), sourceFile.getEnd())
+ };
+ var parentNode = sourceFile;
+ outer: while (true) {
+ var children = getSelectionChildren(parentNode);
+ if (!children.length)
+ break;
+ for (var i = 0; i < children.length; i++) {
+ var prevNode = children[i - 1];
+ var node = children[i];
+ var nextNode = children[i + 1];
+ if (node.getStart(sourceFile) > pos) {
+ break outer;
+ }
+ if (positionShouldSnapToNode(pos, node, nextNode)) {
+ // 1. Blocks are effectively redundant with SyntaxLists.
+ // 2. TemplateSpans, along with the SyntaxLists containing them, are a somewhat unintuitive grouping
+ // of things that should be considered independently.
+ // 3. A VariableStatement’s children are just a VaraiableDeclarationList and a semicolon.
+ // 4. A lone VariableDeclaration in a VaraibleDeclaration feels redundant with the VariableStatement.
+ //
+ // Dive in without pushing a selection range.
+ if (ts.isBlock(node)
+ || ts.isTemplateSpan(node) || ts.isTemplateHead(node)
+ || prevNode && ts.isTemplateHead(prevNode)
+ || ts.isVariableDeclarationList(node) && ts.isVariableStatement(parentNode)
+ || ts.isSyntaxList(node) && ts.isVariableDeclarationList(parentNode)
+ || ts.isVariableDeclaration(node) && ts.isSyntaxList(parentNode) && children.length === 1) {
+ parentNode = node;
+ break;
+ }
+ // Synthesize a stop for '${ ... }' since '${' and '}' actually belong to siblings.
+ if (ts.isTemplateSpan(parentNode) && nextNode && ts.isTemplateMiddleOrTemplateTail(nextNode)) {
+ var start_2 = node.getFullStart() - "${".length;
+ var end_2 = nextNode.getStart() + "}".length;
+ pushSelectionRange(start_2, end_2);
+ }
+ // Blocks with braces, brackets, parens, or JSX tags on separate lines should be
+ // selected from open to close, including whitespace but not including the braces/etc. themselves.
+ var isBetweenMultiLineBookends = ts.isSyntaxList(node)
+ && isListOpener(prevNode)
+ && isListCloser(nextNode)
+ && !ts.positionsAreOnSameLine(prevNode.getStart(), nextNode.getStart(), sourceFile);
+ var jsDocCommentStart = ts.hasJSDocNodes(node) && node.jsDoc[0].getStart();
+ var start = isBetweenMultiLineBookends ? prevNode.getEnd() : node.getStart();
+ var end = isBetweenMultiLineBookends ? nextNode.getStart() : node.getEnd();
+ if (ts.isNumber(jsDocCommentStart)) {
+ pushSelectionRange(jsDocCommentStart, end);
+ }
+ pushSelectionRange(start, end);
+ // String literals should have a stop both inside and outside their quotes.
+ if (ts.isStringLiteral(node) || ts.isTemplateLiteral(node)) {
+ pushSelectionRange(start + 1, end - 1);
+ }
+ parentNode = node;
+ break;
+ }
+ }
+ }
+ return selectionRange;
+ function pushSelectionRange(start, end) {
+ // Skip empty ranges
+ if (start !== end) {
+ // Skip ranges that are identical to the parent
+ var textSpan = ts.createTextSpanFromBounds(start, end);
+ if (!selectionRange || !ts.textSpansEqual(textSpan, selectionRange.textSpan)) {
+ selectionRange = __assign({ textSpan: textSpan }, selectionRange && { parent: selectionRange });
+ }
+ }
+ }
+ }
+ SmartSelectionRange.getSmartSelectionRange = getSmartSelectionRange;
+ /**
+ * Like `ts.positionBelongsToNode`, except positions immediately after nodes
+ * count too, unless that position belongs to the next node. In effect, makes
+ * selections able to snap to preceding tokens when the cursor is on the tail
+ * end of them with only whitespace ahead.
+ * @param pos The position to check.
+ * @param node The candidate node to snap to.
+ * @param nextNode The next sibling node in the tree.
+ * @param sourceFile The source file containing the nodes.
+ */
+ function positionShouldSnapToNode(pos, node, nextNode) {
+ // Can’t use 'ts.positionBelongsToNode()' here because it cleverly accounts
+ // for missing nodes, which can’t really be considered when deciding what
+ // to select.
+ ts.Debug.assert(node.pos <= pos);
+ if (pos < node.end) {
+ return true;
+ }
+ var nodeEnd = node.getEnd();
+ var nextNodeStart = nextNode && nextNode.getStart();
+ if (nodeEnd === pos) {
+ return pos !== nextNodeStart;
+ }
+ return false;
+ }
+ var isImport = ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration);
+ /**
+ * Gets the children of a node to be considered for selection ranging,
+ * transforming them into an artificial tree according to their intuitive
+ * grouping where no grouping actually exists in the parse tree. For example,
+ * top-level imports are grouped into their own SyntaxList so they can be
+ * selected all together, even though in the AST they’re just siblings of each
+ * other as well as of other top-level statements and declarations.
+ */
+ function getSelectionChildren(node) {
+ // Group top-level imports
+ if (ts.isSourceFile(node)) {
+ return groupChildren(node.getChildAt(0).getChildren(), isImport);
+ }
+ // Mapped types _look_ like ObjectTypes with a single member,
+ // but in fact don’t contain a SyntaxList or a node containing
+ // the “key/value” pair like ObjectTypes do, but it seems intuitive
+ // that the selection would snap to those points. The philosophy
+ // of choosing a selection range is not so much about what the
+ // syntax currently _is_ as what the syntax might easily become
+ // if the user is making a selection; e.g., we synthesize a selection
+ // around the “key/value” pair not because there’s a node there, but
+ // because it allows the mapped type to become an object type with a
+ // few keystrokes.
+ if (ts.isMappedTypeNode(node)) {
+ var _a = node.getChildren(), openBraceToken = _a[0], children = _a.slice(1);
+ var closeBraceToken = ts.Debug.assertDefined(children.pop());
+ ts.Debug.assertEqual(openBraceToken.kind, 18 /* OpenBraceToken */);
+ ts.Debug.assertEqual(closeBraceToken.kind, 19 /* CloseBraceToken */);
+ // Group `-/+readonly` and `-/+?`
+ var groupedWithPlusMinusTokens = groupChildren(children, function (child) {
+ return child === node.readonlyToken || child.kind === 134 /* ReadonlyKeyword */ ||
+ child === node.questionToken || child.kind === 56 /* QuestionToken */;
+ });
+ // Group type parameter with surrounding brackets
+ var groupedWithBrackets = groupChildren(groupedWithPlusMinusTokens, function (_a) {
+ var kind = _a.kind;
+ return kind === 22 /* OpenBracketToken */ ||
+ kind === 151 /* TypeParameter */ ||
+ kind === 23 /* CloseBracketToken */;
+ });
+ return [
+ openBraceToken,
+ // Pivot on `:`
+ createSyntaxList(splitChildren(groupedWithBrackets, function (_a) {
+ var kind = _a.kind;
+ return kind === 57 /* ColonToken */;
+ })),
+ closeBraceToken,
+ ];
+ }
+ // Group modifiers and property name, then pivot on `:`.
+ if (ts.isPropertySignature(node)) {
+ var children = groupChildren(node.getChildren(), function (child) {
+ return child === node.name || ts.contains(node.modifiers, child);
+ });
+ return splitChildren(children, function (_a) {
+ var kind = _a.kind;
+ return kind === 57 /* ColonToken */;
+ });
+ }
+ // Group the parameter name with its `...`, then that group with its `?`, then pivot on `=`.
+ if (ts.isParameter(node)) {
+ var groupedDotDotDotAndName_1 = groupChildren(node.getChildren(), function (child) {
+ return child === node.dotDotDotToken || child === node.name;
+ });
+ var groupedWithQuestionToken = groupChildren(groupedDotDotDotAndName_1, function (child) {
+ return child === groupedDotDotDotAndName_1[0] || child === node.questionToken;
+ });
+ return splitChildren(groupedWithQuestionToken, function (_a) {
+ var kind = _a.kind;
+ return kind === 60 /* EqualsToken */;
+ });
+ }
+ // Pivot on '='
+ if (ts.isBindingElement(node)) {
+ return splitChildren(node.getChildren(), function (_a) {
+ var kind = _a.kind;
+ return kind === 60 /* EqualsToken */;
+ });
+ }
+ return node.getChildren();
+ }
+ /**
+ * Groups sibling nodes together into their own SyntaxList if they
+ * a) are adjacent, AND b) match a predicate function.
+ */
+ function groupChildren(children, groupOn) {
+ var result = [];
+ var group;
+ for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {
+ var child = children_1[_i];
+ if (groupOn(child)) {
+ group = group || [];
+ group.push(child);
+ }
+ else {
+ if (group) {
+ result.push(createSyntaxList(group));
+ group = undefined;
+ }
+ result.push(child);
+ }
+ }
+ if (group) {
+ result.push(createSyntaxList(group));
+ }
+ return result;
+ }
+ /**
+ * Splits sibling nodes into up to four partitions:
+ * 1) everything left of the first node matched by `pivotOn`,
+ * 2) the first node matched by `pivotOn`,
+ * 3) everything right of the first node matched by `pivotOn`,
+ * 4) a trailing semicolon, if `separateTrailingSemicolon` is enabled.
+ * The left and right groups, if not empty, will each be grouped into their own containing SyntaxList.
+ * @param children The sibling nodes to split.
+ * @param pivotOn The predicate function to match the node to be the pivot. The first node that matches
+ * the predicate will be used; any others that may match will be included into the right-hand group.
+ * @param separateTrailingSemicolon If the last token is a semicolon, it will be returned as a separate
+ * child rather than be included in the right-hand group.
+ */
+ function splitChildren(children, pivotOn, separateTrailingSemicolon) {
+ if (separateTrailingSemicolon === void 0) { separateTrailingSemicolon = true; }
+ if (children.length < 2) {
+ return children;
+ }
+ var splitTokenIndex = ts.findIndex(children, pivotOn);
+ if (splitTokenIndex === -1) {
+ return children;
+ }
+ var leftChildren = children.slice(0, splitTokenIndex);
+ var splitToken = children[splitTokenIndex];
+ var lastToken = ts.last(children);
+ var separateLastToken = separateTrailingSemicolon && lastToken.kind === 26 /* SemicolonToken */;
+ var rightChildren = children.slice(splitTokenIndex + 1, separateLastToken ? children.length - 1 : undefined);
+ var result = ts.compact([
+ leftChildren.length ? createSyntaxList(leftChildren) : undefined,
+ splitToken,
+ rightChildren.length ? createSyntaxList(rightChildren) : undefined,
+ ]);
+ return separateLastToken ? result.concat(lastToken) : result;
+ }
+ function createSyntaxList(children) {
+ ts.Debug.assertGreaterThanOrEqual(children.length, 1);
+ var syntaxList = ts.createNode(312 /* SyntaxList */, children[0].pos, ts.last(children).end);
+ syntaxList._children = children;
+ return syntaxList;
+ }
+ function isListOpener(token) {
+ var kind = token && token.kind;
+ return kind === 18 /* OpenBraceToken */
+ || kind === 22 /* OpenBracketToken */
+ || kind === 20 /* OpenParenToken */
+ || kind === 263 /* JsxOpeningElement */;
+ }
+ function isListCloser(token) {
+ var kind = token && token.kind;
+ return kind === 19 /* CloseBraceToken */
+ || kind === 23 /* CloseBracketToken */
+ || kind === 21 /* CloseParenToken */
+ || kind === 264 /* JsxClosingElement */;
+ }
+ })(SmartSelectionRange = ts.SmartSelectionRange || (ts.SmartSelectionRange = {}));
+})(ts || (ts = {}));
+/* @internal */
+var ts;
+(function (ts) {
var SignatureHelp;
(function (SignatureHelp) {
var InvocationKind;
@@ -106370,9 +107583,22 @@
});
}
function containsPrecedingToken(startingToken, sourceFile, container) {
- var precedingToken = ts.Debug.assertDefined(ts.findPrecedingToken(startingToken.getFullStart(), sourceFile, startingToken.parent, /*excludeJsdoc*/ true));
+ var pos = startingToken.getFullStart();
+ // There’s a possibility that `startingToken.parent` contains only `startingToken` and
+ // missing nodes, none of which are valid to be returned by `findPrecedingToken`. In that
+ // case, the preceding token we want is actually higher up the tree—almost definitely the
+ // next parent, but theoretically the situation with missing nodes might be happening on
+ // multiple nested levels.
+ var currentParent = startingToken.parent;
+ while (currentParent) {
+ var precedingToken = ts.findPrecedingToken(pos, sourceFile, currentParent, /*excludeJsdoc*/ true);
+ if (precedingToken) {
return ts.rangeContainsRange(container, precedingToken);
}
+ currentParent = currentParent.parent;
+ }
+ return ts.Debug.fail("Could not find preceding token");
+ }
function getArgumentInfoForCompletions(node, position, sourceFile) {
var info = getImmediatelyContainingArgumentInfo(node, position, sourceFile);
return !info || info.isTypeParameterList || info.invocation.kind !== 0 /* Call */ ? undefined
@@ -106445,10 +107671,10 @@
}
return undefined;
}
- else if (ts.isTemplateHead(node) && parent.parent.kind === 193 /* TaggedTemplateExpression */) {
+ else if (ts.isTemplateHead(node) && parent.parent.kind === 194 /* TaggedTemplateExpression */) {
var templateExpression = parent;
var tagExpression = templateExpression.parent;
- ts.Debug.assert(templateExpression.kind === 206 /* TemplateExpression */);
+ ts.Debug.assert(templateExpression.kind === 207 /* TemplateExpression */);
var argumentIndex = ts.isInsideTemplateLiteral(node, position, sourceFile) ? 0 : 1;
return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile);
}
@@ -106515,17 +107741,17 @@
return undefined;
var parent = startingToken.parent;
switch (parent.kind) {
- case 195 /* ParenthesizedExpression */:
- case 156 /* MethodDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 196 /* ParenthesizedExpression */:
+ case 157 /* MethodDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
var info = getArgumentOrParameterListInfo(startingToken, sourceFile);
if (!info)
return undefined;
var argumentIndex = info.argumentIndex, argumentCount = info.argumentCount, argumentsSpan = info.argumentsSpan;
var contextualType = ts.isMethodDeclaration(parent) ? checker.getContextualTypeForObjectLiteralElement(parent) : checker.getContextualType(parent);
return contextualType && { contextualType: contextualType, argumentIndex: argumentIndex, argumentCount: argumentCount, argumentsSpan: argumentsSpan };
- case 204 /* BinaryExpression */: {
+ case 205 /* BinaryExpression */: {
var highestBinary = getHighestBinary(parent);
var contextualType_1 = checker.getContextualType(highestBinary);
var argumentIndex_1 = startingToken.kind === 20 /* OpenParenToken */ ? 0 : countBinaryExpressionParameters(parent) - 1;
@@ -106649,7 +107875,7 @@
// | |
// This is because a Missing node has no width. However, what we actually want is to include trivia
// leading up to the next token in case the user is about to type in a TemplateMiddle or TemplateTail.
- if (template.kind === 206 /* TemplateExpression */) {
+ if (template.kind === 207 /* TemplateExpression */) {
var lastSpan = ts.last(template.templateSpans);
if (lastSpan.literal.getFullWidth() === 0) {
applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, /*stopAfterLineBreak*/ false);
@@ -106661,7 +107887,7 @@
var _loop_7 = function (n) {
// If the node is not a subspan of its parent, this is a big problem.
// There have been crashes that might be caused by this violation.
- ts.Debug.assert(ts.rangeContainsRange(n.parent, n), "Not a subspan", function () { return "Child: " + ts.Debug.showSyntaxKind(n) + ", parent: " + ts.Debug.showSyntaxKind(n.parent); });
+ ts.Debug.assert(ts.rangeContainsRange(n.parent, n), "Not a subspan", function () { return "Child: " + ts.Debug.formatSyntaxKind(n.kind) + ", parent: " + ts.Debug.formatSyntaxKind(n.parent.kind); });
var argumentInfo = getImmediatelyContainingArgumentOrContextualParameterInfo(n, position, sourceFile, checker);
if (argumentInfo) {
return { value: argumentInfo };
@@ -106961,7 +108187,7 @@
function check(node) {
if (isJsFile) {
switch (node.kind) {
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
var decl = ts.getDeclarationOfExpando(node);
if (decl) {
var symbol_1 = decl.symbol;
@@ -106971,7 +108197,7 @@
}
}
// falls through if no diagnostic was created
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
var symbol = node.symbol;
if (symbol.members && (symbol.members.size > 0)) {
diags.push(ts.createDiagnosticForNode(ts.isVariableDeclaration(node.parent) ? node.parent.name : node, ts.Diagnostics.This_constructor_function_may_be_converted_to_a_class_declaration));
@@ -107004,11 +108230,11 @@
function containsTopLevelCommonjs(sourceFile) {
return sourceFile.statements.some(function (statement) {
switch (statement.kind) {
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return statement.declarationList.declarations.some(function (decl) {
return !!decl.initializer && ts.isRequireCall(propertyAccessLeftHandSide(decl.initializer), /*checkArgumentIsStringLiteralLike*/ true);
});
- case 221 /* ExpressionStatement */: {
+ case 222 /* ExpressionStatement */: {
var expression = statement.expression;
if (!ts.isBinaryExpression(expression))
return ts.isRequireCall(expression, /*checkArgumentIsStringLiteralLike*/ true);
@@ -107025,12 +108251,12 @@
}
function importNameForConvertToDefaultImport(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
var importClause = node.importClause, moduleSpecifier = node.moduleSpecifier;
- return importClause && !importClause.name && importClause.namedBindings && importClause.namedBindings.kind === 251 /* NamespaceImport */ && ts.isStringLiteral(moduleSpecifier)
+ return importClause && !importClause.name && importClause.namedBindings && importClause.namedBindings.kind === 252 /* NamespaceImport */ && ts.isStringLiteral(moduleSpecifier)
? importClause.namedBindings.name
: undefined;
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return node.name;
default:
return undefined;
@@ -107088,13 +108314,13 @@
// should be kept up to date with getTransformationBody in convertToAsyncFunction.ts
function isFixablePromiseArgument(arg) {
switch (arg.kind) {
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
visitedNestedConvertibleFunctions.set(getKeyFromNode(arg), true);
/* falls through */
- case 96 /* NullKeyword */:
- case 72 /* Identifier */: // identifier includes undefined
+ case 97 /* NullKeyword */:
+ case 73 /* Identifier */: // identifier includes undefined
return true;
default:
return false;
@@ -107117,7 +108343,7 @@
}
var flags = ts.getCombinedLocalAndExportSymbolFlags(symbol);
if (flags & 32 /* Class */) {
- return ts.getDeclarationOfKind(symbol, 209 /* ClassExpression */) ?
+ return ts.getDeclarationOfKind(symbol, 210 /* ClassExpression */) ?
"local class" /* localClassElement */ : "class" /* classElement */;
}
if (flags & 384 /* Enum */)
@@ -107154,7 +108380,7 @@
if (typeChecker.isArgumentsSymbol(symbol)) {
return "local var" /* localVariableElement */;
}
- if (location.kind === 100 /* ThisKeyword */ && ts.isExpression(location)) {
+ if (location.kind === 101 /* ThisKeyword */ && ts.isExpression(location)) {
return "parameter" /* parameterElement */;
}
var flags = ts.getCombinedLocalAndExportSymbolFlags(symbol);
@@ -107205,11 +108431,11 @@
// If we requested completions after `x.` at the top-level, we may be at a source file location.
switch (location.parent && location.parent.kind) {
// If we've typed a character of the attribute name, will be 'JsxAttribute', else will be 'JsxOpeningElement'.
- case 262 /* JsxOpeningElement */:
- case 260 /* JsxElement */:
- case 261 /* JsxSelfClosingElement */:
- return location.kind === 72 /* Identifier */ ? "property" /* memberVariableElement */ : "JSX attribute" /* jsxAttribute */;
- case 267 /* JsxAttribute */:
+ case 263 /* JsxOpeningElement */:
+ case 261 /* JsxElement */:
+ case 262 /* JsxSelfClosingElement */:
+ return location.kind === 73 /* Identifier */ ? "property" /* memberVariableElement */ : "JSX attribute" /* jsxAttribute */;
+ case 268 /* JsxAttribute */:
return "JSX attribute" /* jsxAttribute */;
default:
return "property" /* memberVariableElement */;
@@ -107236,13 +108462,13 @@
var symbolFlags = ts.getCombinedLocalAndExportSymbolFlags(symbol);
var symbolKind = semanticMeaning & 1 /* Value */ ? getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location) : "" /* unknown */;
var hasAddedSymbolInfo = false;
- var isThisExpression = location.kind === 100 /* ThisKeyword */ && ts.isInExpressionContext(location);
+ var isThisExpression = location.kind === 101 /* ThisKeyword */ && ts.isInExpressionContext(location);
var type;
var printer;
var documentationFromAlias;
var tagsFromAlias;
- if (location.kind === 100 /* ThisKeyword */ && !isThisExpression) {
- return { displayParts: [ts.keywordPart(100 /* ThisKeyword */)], documentation: [], symbolKind: "primitive type" /* primitiveType */, tags: undefined };
+ if (location.kind === 101 /* ThisKeyword */ && !isThisExpression) {
+ return { displayParts: [ts.keywordPart(101 /* ThisKeyword */)], documentation: [], symbolKind: "primitive type" /* primitiveType */, tags: undefined };
}
// Class at constructor site need to be shown as constructor apart from property,method, vars
if (symbolKind !== "" /* unknown */ || symbolFlags & 32 /* Class */ || symbolFlags & 2097152 /* Alias */) {
@@ -107252,7 +108478,7 @@
}
var signature = void 0;
type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol.exportSymbol || symbol, location);
- if (location.parent && location.parent.kind === 189 /* PropertyAccessExpression */) {
+ if (location.parent && location.parent.kind === 190 /* PropertyAccessExpression */) {
var right = location.parent.name;
// Either the location is on the right of a property access, or on the left and the right is missing
if (right === location || (right && right.getFullWidth() === 0)) {
@@ -107271,9 +108497,8 @@
callExpressionLike = location.parent;
}
if (callExpressionLike) {
- var candidateSignatures = [];
- signature = typeChecker.getResolvedSignature(callExpressionLike, candidateSignatures); // TODO: GH#18217
- var useConstructSignatures = callExpressionLike.kind === 192 /* NewExpression */ || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 98 /* SuperKeyword */);
+ signature = typeChecker.getResolvedSignature(callExpressionLike); // TODO: GH#18217
+ var useConstructSignatures = callExpressionLike.kind === 193 /* NewExpression */ || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 99 /* SuperKeyword */);
var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures();
if (!ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) {
// Get the first signature if there is one -- allSignatures may contain
@@ -107291,7 +108516,7 @@
pushSymbolKind(symbolKind);
displayParts.push(ts.spacePart());
if (useConstructSignatures) {
- displayParts.push(ts.keywordPart(95 /* NewKeyword */));
+ displayParts.push(ts.keywordPart(96 /* NewKeyword */));
displayParts.push(ts.spacePart());
}
addFullSymbolName(symbol);
@@ -107315,7 +108540,7 @@
displayParts.push(ts.lineBreakPart());
}
if (useConstructSignatures) {
- displayParts.push(ts.keywordPart(95 /* NewKeyword */));
+ displayParts.push(ts.keywordPart(96 /* NewKeyword */));
displayParts.push(ts.spacePart());
}
addSignatureDisplayParts(signature, allSignatures, 262144 /* WriteArrowStyleSignature */);
@@ -107328,29 +108553,29 @@
}
}
else if ((ts.isNameOfFunctionDeclaration(location) && !(symbolFlags & 98304 /* Accessor */)) || // name of function declaration
- (location.kind === 124 /* ConstructorKeyword */ && location.parent.kind === 157 /* Constructor */)) { // At constructor keyword of constructor declaration
+ (location.kind === 125 /* ConstructorKeyword */ && location.parent.kind === 158 /* Constructor */)) { // At constructor keyword of constructor declaration
// get the signature from the declaration and write it
var functionDeclaration_1 = location.parent;
// Use function declaration to write the signatures only if the symbol corresponding to this declaration
var locationIsSymbolDeclaration = ts.find(symbol.declarations, function (declaration) {
- return declaration === (location.kind === 124 /* ConstructorKeyword */ ? functionDeclaration_1.parent : functionDeclaration_1);
+ return declaration === (location.kind === 125 /* ConstructorKeyword */ ? functionDeclaration_1.parent : functionDeclaration_1);
});
if (locationIsSymbolDeclaration) {
- var allSignatures = functionDeclaration_1.kind === 157 /* Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures();
+ var allSignatures = functionDeclaration_1.kind === 158 /* Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures();
if (!typeChecker.isImplementationOfOverload(functionDeclaration_1)) {
signature = typeChecker.getSignatureFromDeclaration(functionDeclaration_1); // TODO: GH#18217
}
else {
signature = allSignatures[0];
}
- if (functionDeclaration_1.kind === 157 /* Constructor */) {
+ if (functionDeclaration_1.kind === 158 /* Constructor */) {
// show (constructor) Type(...) signature
symbolKind = "constructor" /* constructorImplementationElement */;
addPrefixForAnyFunctionOrVar(type.symbol, symbolKind);
}
else {
// (function/method) symbol(..signature)
- addPrefixForAnyFunctionOrVar(functionDeclaration_1.kind === 160 /* CallSignature */ &&
+ addPrefixForAnyFunctionOrVar(functionDeclaration_1.kind === 161 /* CallSignature */ &&
!(type.symbol.flags & 2048 /* TypeLiteral */ || type.symbol.flags & 4096 /* ObjectLiteral */) ? type.symbol : symbol, symbolKind);
}
addSignatureDisplayParts(signature, allSignatures);
@@ -107360,7 +108585,7 @@
}
if (symbolFlags & 32 /* Class */ && !hasAddedSymbolInfo && !isThisExpression) {
addAliasPrefixIfNecessary();
- if (ts.getDeclarationOfKind(symbol, 209 /* ClassExpression */)) {
+ if (ts.getDeclarationOfKind(symbol, 210 /* ClassExpression */)) {
// Special case for class expressions because we would like to indicate that
// the class name is local to the class body (similar to function expression)
// (local class) class <className>
@@ -107368,7 +108593,7 @@
}
else {
// Class declaration has name which is not local.
- displayParts.push(ts.keywordPart(76 /* ClassKeyword */));
+ displayParts.push(ts.keywordPart(77 /* ClassKeyword */));
}
displayParts.push(ts.spacePart());
addFullSymbolName(symbol);
@@ -107376,37 +108601,37 @@
}
if ((symbolFlags & 64 /* Interface */) && (semanticMeaning & 2 /* Type */)) {
prefixNextMeaning();
- displayParts.push(ts.keywordPart(110 /* InterfaceKeyword */));
+ displayParts.push(ts.keywordPart(111 /* InterfaceKeyword */));
displayParts.push(ts.spacePart());
addFullSymbolName(symbol);
writeTypeParametersOfSymbol(symbol, sourceFile);
}
if ((symbolFlags & 524288 /* TypeAlias */) && (semanticMeaning & 2 /* Type */)) {
prefixNextMeaning();
- displayParts.push(ts.keywordPart(140 /* TypeKeyword */));
+ displayParts.push(ts.keywordPart(141 /* TypeKeyword */));
displayParts.push(ts.spacePart());
addFullSymbolName(symbol);
writeTypeParametersOfSymbol(symbol, sourceFile);
displayParts.push(ts.spacePart());
- displayParts.push(ts.operatorPart(59 /* EqualsToken */));
+ displayParts.push(ts.operatorPart(60 /* EqualsToken */));
displayParts.push(ts.spacePart());
ts.addRange(displayParts, ts.typeToDisplayParts(typeChecker, typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration, 8388608 /* InTypeAlias */));
}
if (symbolFlags & 384 /* Enum */) {
prefixNextMeaning();
if (ts.some(symbol.declarations, function (d) { return ts.isEnumDeclaration(d) && ts.isEnumConst(d); })) {
- displayParts.push(ts.keywordPart(77 /* ConstKeyword */));
+ displayParts.push(ts.keywordPart(78 /* ConstKeyword */));
displayParts.push(ts.spacePart());
}
- displayParts.push(ts.keywordPart(84 /* EnumKeyword */));
+ displayParts.push(ts.keywordPart(85 /* EnumKeyword */));
displayParts.push(ts.spacePart());
addFullSymbolName(symbol);
}
if (symbolFlags & 1536 /* Module */ && !isThisExpression) {
prefixNextMeaning();
- var declaration = ts.getDeclarationOfKind(symbol, 244 /* ModuleDeclaration */);
- var isNamespace = declaration && declaration.name && declaration.name.kind === 72 /* Identifier */;
- displayParts.push(ts.keywordPart(isNamespace ? 131 /* NamespaceKeyword */ : 130 /* ModuleKeyword */));
+ var declaration = ts.getDeclarationOfKind(symbol, 245 /* ModuleDeclaration */);
+ var isNamespace = declaration && declaration.name && declaration.name.kind === 73 /* Identifier */;
+ displayParts.push(ts.keywordPart(isNamespace ? 132 /* NamespaceKeyword */ : 131 /* ModuleKeyword */));
displayParts.push(ts.spacePart());
addFullSymbolName(symbol);
}
@@ -107425,7 +108650,7 @@
}
else {
// Method/function type parameter
- var decl = ts.getDeclarationOfKind(symbol, 150 /* TypeParameter */);
+ var decl = ts.getDeclarationOfKind(symbol, 151 /* TypeParameter */);
if (decl === undefined)
return ts.Debug.fail();
var declaration = decl.parent;
@@ -107433,21 +108658,21 @@
if (ts.isFunctionLikeKind(declaration.kind)) {
addInPrefix();
var signature = typeChecker.getSignatureFromDeclaration(declaration); // TODO: GH#18217
- if (declaration.kind === 161 /* ConstructSignature */) {
- displayParts.push(ts.keywordPart(95 /* NewKeyword */));
+ if (declaration.kind === 162 /* ConstructSignature */) {
+ displayParts.push(ts.keywordPart(96 /* NewKeyword */));
displayParts.push(ts.spacePart());
}
- else if (declaration.kind !== 160 /* CallSignature */ && declaration.name) {
+ else if (declaration.kind !== 161 /* CallSignature */ && declaration.name) {
addFullSymbolName(declaration.symbol);
}
ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* WriteTypeArgumentsOfSignature */));
}
- else if (declaration.kind === 242 /* TypeAliasDeclaration */) {
+ else if (declaration.kind === 243 /* TypeAliasDeclaration */) {
// Type alias type parameter
// For example
// type list<T> = T[]; // Both T will go through same code path
addInPrefix();
- displayParts.push(ts.keywordPart(140 /* TypeKeyword */));
+ displayParts.push(ts.keywordPart(141 /* TypeKeyword */));
displayParts.push(ts.spacePart());
addFullSymbolName(declaration.symbol);
writeTypeParametersOfSymbol(declaration.symbol, sourceFile);
@@ -107459,11 +108684,11 @@
symbolKind = "enum member" /* enumMemberElement */;
addPrefixForAnyFunctionOrVar(symbol, "enum member");
var declaration = symbol.declarations[0];
- if (declaration.kind === 278 /* EnumMember */) {
+ if (declaration.kind === 279 /* EnumMember */) {
var constantValue = typeChecker.getConstantValue(declaration);
if (constantValue !== undefined) {
displayParts.push(ts.spacePart());
- displayParts.push(ts.operatorPart(59 /* EqualsToken */));
+ displayParts.push(ts.operatorPart(60 /* EqualsToken */));
displayParts.push(ts.spacePart());
displayParts.push(ts.displayPart(ts.getTextOfConstantValue(constantValue), typeof constantValue === "number" ? ts.SymbolDisplayPartKind.numericLiteral : ts.SymbolDisplayPartKind.stringLiteral));
}
@@ -107489,32 +108714,32 @@
}
}
switch (symbol.declarations[0].kind) {
- case 247 /* NamespaceExportDeclaration */:
- displayParts.push(ts.keywordPart(85 /* ExportKeyword */));
+ case 248 /* NamespaceExportDeclaration */:
+ displayParts.push(ts.keywordPart(86 /* ExportKeyword */));
displayParts.push(ts.spacePart());
- displayParts.push(ts.keywordPart(131 /* NamespaceKeyword */));
+ displayParts.push(ts.keywordPart(132 /* NamespaceKeyword */));
break;
- case 254 /* ExportAssignment */:
- displayParts.push(ts.keywordPart(85 /* ExportKeyword */));
+ case 255 /* ExportAssignment */:
+ displayParts.push(ts.keywordPart(86 /* ExportKeyword */));
displayParts.push(ts.spacePart());
- displayParts.push(ts.keywordPart(symbol.declarations[0].isExportEquals ? 59 /* EqualsToken */ : 80 /* DefaultKeyword */));
+ displayParts.push(ts.keywordPart(symbol.declarations[0].isExportEquals ? 60 /* EqualsToken */ : 81 /* DefaultKeyword */));
break;
- case 257 /* ExportSpecifier */:
- displayParts.push(ts.keywordPart(85 /* ExportKeyword */));
+ case 258 /* ExportSpecifier */:
+ displayParts.push(ts.keywordPart(86 /* ExportKeyword */));
break;
default:
- displayParts.push(ts.keywordPart(92 /* ImportKeyword */));
+ displayParts.push(ts.keywordPart(93 /* ImportKeyword */));
}
displayParts.push(ts.spacePart());
addFullSymbolName(symbol);
ts.forEach(symbol.declarations, function (declaration) {
- if (declaration.kind === 248 /* ImportEqualsDeclaration */) {
+ if (declaration.kind === 249 /* ImportEqualsDeclaration */) {
var importEqualsDeclaration = declaration;
if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) {
displayParts.push(ts.spacePart());
- displayParts.push(ts.operatorPart(59 /* EqualsToken */));
+ displayParts.push(ts.operatorPart(60 /* EqualsToken */));
displayParts.push(ts.spacePart());
- displayParts.push(ts.keywordPart(134 /* RequireKeyword */));
+ displayParts.push(ts.keywordPart(135 /* RequireKeyword */));
displayParts.push(ts.punctuationPart(20 /* OpenParenToken */));
displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), ts.SymbolDisplayPartKind.stringLiteral));
displayParts.push(ts.punctuationPart(21 /* CloseParenToken */));
@@ -107523,7 +108748,7 @@
var internalAliasSymbol = typeChecker.getSymbolAtLocation(importEqualsDeclaration.moduleReference);
if (internalAliasSymbol) {
displayParts.push(ts.spacePart());
- displayParts.push(ts.operatorPart(59 /* EqualsToken */));
+ displayParts.push(ts.operatorPart(60 /* EqualsToken */));
displayParts.push(ts.spacePart());
addFullSymbolName(internalAliasSymbol, enclosingDeclaration);
}
@@ -107537,7 +108762,7 @@
if (type) {
if (isThisExpression) {
prefixNextMeaning();
- displayParts.push(ts.keywordPart(100 /* ThisKeyword */));
+ displayParts.push(ts.keywordPart(101 /* ThisKeyword */));
}
else {
addPrefixForAnyFunctionOrVar(symbol, symbolKind);
@@ -107586,10 +108811,10 @@
// For some special property access expressions like `exports.foo = foo` or `module.exports.foo = foo`
// there documentation comments might be attached to the right hand side symbol of their declarations.
// The pattern of such special property access is that the parent symbol is the symbol of the file.
- if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 284 /* SourceFile */; })) {
+ if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 285 /* SourceFile */; })) {
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (!declaration.parent || declaration.parent.kind !== 204 /* BinaryExpression */) {
+ if (!declaration.parent || declaration.parent.kind !== 205 /* BinaryExpression */) {
continue;
}
var rhsSymbol = typeChecker.getSymbolAtLocation(declaration.parent.right);
@@ -107632,7 +108857,7 @@
}
function addInPrefix() {
displayParts.push(ts.spacePart());
- displayParts.push(ts.keywordPart(93 /* InKeyword */));
+ displayParts.push(ts.keywordPart(94 /* InKeyword */));
displayParts.push(ts.spacePart());
}
function addFullSymbolName(symbolToDisplay, enclosingDeclaration) {
@@ -107702,16 +108927,16 @@
}
return ts.forEach(symbol.declarations, function (declaration) {
// Function expressions are local
- if (declaration.kind === 196 /* FunctionExpression */) {
+ if (declaration.kind === 197 /* FunctionExpression */) {
return true;
}
- if (declaration.kind !== 237 /* VariableDeclaration */ && declaration.kind !== 239 /* FunctionDeclaration */) {
+ if (declaration.kind !== 238 /* VariableDeclaration */ && declaration.kind !== 240 /* FunctionDeclaration */) {
return false;
}
// If the parent is not sourceFile or module block it is local variable
for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent) {
// Reached source file or module block
- if (parent.kind === 284 /* SourceFile */ || parent.kind === 245 /* ModuleBlock */) {
+ if (parent.kind === 285 /* SourceFile */ || parent.kind === 246 /* ModuleBlock */) {
return false;
}
}
@@ -107940,8 +109165,8 @@
(function (ts) {
var formatting;
(function (formatting) {
- var standardScanner = ts.createScanner(7 /* Latest */, /*skipTrivia*/ false, 0 /* Standard */);
- var jsxScanner = ts.createScanner(7 /* Latest */, /*skipTrivia*/ false, 1 /* JSX */);
+ var standardScanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false, 0 /* Standard */);
+ var jsxScanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false, 1 /* JSX */);
var ScanAction;
(function (ScanAction) {
ScanAction[ScanAction["Scan"] = 0] = "Scan";
@@ -108005,8 +109230,8 @@
function shouldRescanGreaterThanToken(node) {
switch (node.kind) {
case 32 /* GreaterThanEqualsToken */:
- case 67 /* GreaterThanGreaterThanEqualsToken */:
- case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
+ case 68 /* GreaterThanGreaterThanEqualsToken */:
+ case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
case 48 /* GreaterThanGreaterThanGreaterThanToken */:
case 47 /* GreaterThanGreaterThanToken */:
return true;
@@ -108016,12 +109241,12 @@
function shouldRescanJsxIdentifier(node) {
if (node.parent) {
switch (node.parent.kind) {
- case 267 /* JsxAttribute */:
- case 262 /* JsxOpeningElement */:
- case 263 /* JsxClosingElement */:
- case 261 /* JsxSelfClosingElement */:
+ case 268 /* JsxAttribute */:
+ case 263 /* JsxOpeningElement */:
+ case 264 /* JsxClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
// May parse an identifier like `module-layout`; that will be scanned as a keyword at first, but we should parse the whole thing to get an identifier.
- return ts.isKeyword(node.kind) || node.kind === 72 /* Identifier */;
+ return ts.isKeyword(node.kind) || node.kind === 73 /* Identifier */;
}
}
return false;
@@ -108037,7 +109262,7 @@
container.kind === 17 /* TemplateTail */;
}
function startsWithSlashToken(t) {
- return t === 42 /* SlashToken */ || t === 64 /* SlashEqualsToken */;
+ return t === 42 /* SlashToken */ || t === 65 /* SlashEqualsToken */;
}
function readTokenInfo(n) {
ts.Debug.assert(isOnToken());
@@ -108196,7 +109421,7 @@
(function (formatting) {
function getAllRules() {
var allTokens = [];
- for (var token = 0 /* FirstToken */; token <= 147 /* LastToken */; token++) {
+ for (var token = 0 /* FirstToken */; token <= 148 /* LastToken */; token++) {
allTokens.push(token);
}
function anyTokenExcept() {
@@ -108208,27 +109433,27 @@
}
var anyToken = { tokens: allTokens, isSpecific: false };
var anyTokenIncludingMultilineComments = tokenRangeFrom(allTokens.concat([3 /* MultiLineCommentTrivia */]));
- var keywords = tokenRangeFromRange(73 /* FirstKeyword */, 147 /* LastKeyword */);
- var binaryOperators = tokenRangeFromRange(28 /* FirstBinaryOperator */, 71 /* LastBinaryOperator */);
- var binaryKeywordOperators = [93 /* InKeyword */, 94 /* InstanceOfKeyword */, 147 /* OfKeyword */, 119 /* AsKeyword */, 128 /* IsKeyword */];
+ var keywords = tokenRangeFromRange(74 /* FirstKeyword */, 148 /* LastKeyword */);
+ var binaryOperators = tokenRangeFromRange(28 /* FirstBinaryOperator */, 72 /* LastBinaryOperator */);
+ var binaryKeywordOperators = [94 /* InKeyword */, 95 /* InstanceOfKeyword */, 148 /* OfKeyword */, 120 /* AsKeyword */, 129 /* IsKeyword */];
var unaryPrefixOperators = [44 /* PlusPlusToken */, 45 /* MinusMinusToken */, 53 /* TildeToken */, 52 /* ExclamationToken */];
var unaryPrefixExpressions = [
- 8 /* NumericLiteral */, 9 /* BigIntLiteral */, 72 /* Identifier */, 20 /* OpenParenToken */,
- 22 /* OpenBracketToken */, 18 /* OpenBraceToken */, 100 /* ThisKeyword */, 95 /* NewKeyword */
+ 8 /* NumericLiteral */, 9 /* BigIntLiteral */, 73 /* Identifier */, 20 /* OpenParenToken */,
+ 22 /* OpenBracketToken */, 18 /* OpenBraceToken */, 101 /* ThisKeyword */, 96 /* NewKeyword */
];
- var unaryPreincrementExpressions = [72 /* Identifier */, 20 /* OpenParenToken */, 100 /* ThisKeyword */, 95 /* NewKeyword */];
- var unaryPostincrementExpressions = [72 /* Identifier */, 21 /* CloseParenToken */, 23 /* CloseBracketToken */, 95 /* NewKeyword */];
- var unaryPredecrementExpressions = [72 /* Identifier */, 20 /* OpenParenToken */, 100 /* ThisKeyword */, 95 /* NewKeyword */];
- var unaryPostdecrementExpressions = [72 /* Identifier */, 21 /* CloseParenToken */, 23 /* CloseBracketToken */, 95 /* NewKeyword */];
+ var unaryPreincrementExpressions = [73 /* Identifier */, 20 /* OpenParenToken */, 101 /* ThisKeyword */, 96 /* NewKeyword */];
+ var unaryPostincrementExpressions = [73 /* Identifier */, 21 /* CloseParenToken */, 23 /* CloseBracketToken */, 96 /* NewKeyword */];
+ var unaryPredecrementExpressions = [73 /* Identifier */, 20 /* OpenParenToken */, 101 /* ThisKeyword */, 96 /* NewKeyword */];
+ var unaryPostdecrementExpressions = [73 /* Identifier */, 21 /* CloseParenToken */, 23 /* CloseBracketToken */, 96 /* NewKeyword */];
var comments = [2 /* SingleLineCommentTrivia */, 3 /* MultiLineCommentTrivia */];
- var typeNames = [72 /* Identifier */].concat(ts.typeKeywords);
+ var typeNames = [73 /* Identifier */].concat(ts.typeKeywords);
// Place a space before open brace in a function declaration
// TypeScript: Function can have return types, which can be made of tons of different token kinds
var functionOpenBraceLeftTokenRange = anyTokenIncludingMultilineComments;
// Place a space before open brace in a TypeScript declaration that has braces as children (class, module, enum, etc)
- var typeScriptOpenBraceLeftTokenRange = tokenRangeFrom([72 /* Identifier */, 3 /* MultiLineCommentTrivia */, 76 /* ClassKeyword */, 85 /* ExportKeyword */, 92 /* ImportKeyword */]);
+ var typeScriptOpenBraceLeftTokenRange = tokenRangeFrom([73 /* Identifier */, 3 /* MultiLineCommentTrivia */, 77 /* ClassKeyword */, 86 /* ExportKeyword */, 93 /* ImportKeyword */]);
// Place a space before open brace in a control flow construct
- var controlOpenBraceLeftTokenRange = tokenRangeFrom([21 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 82 /* DoKeyword */, 103 /* TryKeyword */, 88 /* FinallyKeyword */, 83 /* ElseKeyword */]);
+ var controlOpenBraceLeftTokenRange = tokenRangeFrom([21 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 83 /* DoKeyword */, 104 /* TryKeyword */, 89 /* FinallyKeyword */, 84 /* ElseKeyword */]);
// These rules are higher in priority than user-configurable
var highPriorityCommonRules = [
// Leave comments alone
@@ -108243,7 +109468,7 @@
rule("NoSpaceAfterQuestionMark", 56 /* QuestionToken */, anyToken, [isNonJsxSameLineTokenContext], 8 /* Delete */),
rule("NoSpaceBeforeDot", anyToken, 24 /* DotToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
rule("NoSpaceAfterDot", 24 /* DotToken */, anyToken, [isNonJsxSameLineTokenContext], 8 /* Delete */),
- rule("NoSpaceBetweenImportParenInImportType", 92 /* ImportKeyword */, 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext, isImportTypeContext], 8 /* Delete */),
+ rule("NoSpaceBetweenImportParenInImportType", 93 /* ImportKeyword */, 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext, isImportTypeContext], 8 /* Delete */),
// Special handling of unary operators.
// Prefix operators generally shouldn't have a space between
// them and their target unary expression.
@@ -108270,79 +109495,79 @@
rule("SpaceAfterCloseBrace", 19 /* CloseBraceToken */, anyTokenExcept(21 /* CloseParenToken */), [isNonJsxSameLineTokenContext, isAfterCodeBlockContext], 2 /* Space */),
// Special case for (}, else) and (}, while) since else & while tokens are not part of the tree which makes SpaceAfterCloseBrace rule not applied
// Also should not apply to })
- rule("SpaceBetweenCloseBraceAndElse", 19 /* CloseBraceToken */, 83 /* ElseKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */),
- rule("SpaceBetweenCloseBraceAndWhile", 19 /* CloseBraceToken */, 107 /* WhileKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceBetweenCloseBraceAndElse", 19 /* CloseBraceToken */, 84 /* ElseKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceBetweenCloseBraceAndWhile", 19 /* CloseBraceToken */, 108 /* WhileKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */),
rule("NoSpaceBetweenEmptyBraceBrackets", 18 /* OpenBraceToken */, 19 /* CloseBraceToken */, [isNonJsxSameLineTokenContext, isObjectContext], 8 /* Delete */),
// Add a space after control dec context if the next character is an open bracket ex: 'if (false)[a, b] = [1, 2];' -> 'if (false) [a, b] = [1, 2];'
rule("SpaceAfterConditionalClosingParen", 21 /* CloseParenToken */, 22 /* OpenBracketToken */, [isControlDeclContext], 2 /* Space */),
- rule("NoSpaceBetweenFunctionKeywordAndStar", 90 /* FunctionKeyword */, 40 /* AsteriskToken */, [isFunctionDeclarationOrFunctionExpressionContext], 8 /* Delete */),
- rule("SpaceAfterStarInGeneratorDeclaration", 40 /* AsteriskToken */, [72 /* Identifier */, 20 /* OpenParenToken */], [isFunctionDeclarationOrFunctionExpressionContext], 2 /* Space */),
- rule("SpaceAfterFunctionInFuncDecl", 90 /* FunctionKeyword */, anyToken, [isFunctionDeclContext], 2 /* Space */),
+ rule("NoSpaceBetweenFunctionKeywordAndStar", 91 /* FunctionKeyword */, 40 /* AsteriskToken */, [isFunctionDeclarationOrFunctionExpressionContext], 8 /* Delete */),
+ rule("SpaceAfterStarInGeneratorDeclaration", 40 /* AsteriskToken */, 73 /* Identifier */, [isFunctionDeclarationOrFunctionExpressionContext], 2 /* Space */),
+ rule("SpaceAfterFunctionInFuncDecl", 91 /* FunctionKeyword */, anyToken, [isFunctionDeclContext], 2 /* Space */),
// Insert new line after { and before } in multi-line contexts.
rule("NewLineAfterOpenBraceInBlockContext", 18 /* OpenBraceToken */, anyToken, [isMultilineBlockContext], 4 /* NewLine */),
// For get/set members, we check for (identifier,identifier) since get/set don't have tokens and they are represented as just an identifier token.
// Though, we do extra check on the context to make sure we are dealing with get/set node. Example:
// get x() {}
// set x(val) {}
- rule("SpaceAfterGetSetInMember", [126 /* GetKeyword */, 137 /* SetKeyword */], 72 /* Identifier */, [isFunctionDeclContext], 2 /* Space */),
- rule("NoSpaceBetweenYieldKeywordAndStar", 117 /* YieldKeyword */, 40 /* AsteriskToken */, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 8 /* Delete */),
- rule("SpaceBetweenYieldOrYieldStarAndOperand", [117 /* YieldKeyword */, 40 /* AsteriskToken */], anyToken, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 2 /* Space */),
- rule("NoSpaceBetweenReturnAndSemicolon", 97 /* ReturnKeyword */, 26 /* SemicolonToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
- rule("SpaceAfterCertainKeywords", [105 /* VarKeyword */, 101 /* ThrowKeyword */, 95 /* NewKeyword */, 81 /* DeleteKeyword */, 97 /* ReturnKeyword */, 104 /* TypeOfKeyword */, 122 /* AwaitKeyword */], anyToken, [isNonJsxSameLineTokenContext], 2 /* Space */),
- rule("SpaceAfterLetConstInVariableDeclaration", [111 /* LetKeyword */, 77 /* ConstKeyword */], anyToken, [isNonJsxSameLineTokenContext, isStartOfVariableDeclarationList], 2 /* Space */),
+ rule("SpaceAfterGetSetInMember", [127 /* GetKeyword */, 138 /* SetKeyword */], 73 /* Identifier */, [isFunctionDeclContext], 2 /* Space */),
+ rule("NoSpaceBetweenYieldKeywordAndStar", 118 /* YieldKeyword */, 40 /* AsteriskToken */, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 8 /* Delete */),
+ rule("SpaceBetweenYieldOrYieldStarAndOperand", [118 /* YieldKeyword */, 40 /* AsteriskToken */], anyToken, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 2 /* Space */),
+ rule("NoSpaceBetweenReturnAndSemicolon", 98 /* ReturnKeyword */, 26 /* SemicolonToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
+ rule("SpaceAfterCertainKeywords", [106 /* VarKeyword */, 102 /* ThrowKeyword */, 96 /* NewKeyword */, 82 /* DeleteKeyword */, 98 /* ReturnKeyword */, 105 /* TypeOfKeyword */, 123 /* AwaitKeyword */], anyToken, [isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceAfterLetConstInVariableDeclaration", [112 /* LetKeyword */, 78 /* ConstKeyword */], anyToken, [isNonJsxSameLineTokenContext, isStartOfVariableDeclarationList], 2 /* Space */),
rule("NoSpaceBeforeOpenParenInFuncCall", anyToken, 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext, isFunctionCallOrNewContext, isPreviousTokenNotComma], 8 /* Delete */),
// Special case for binary operators (that are keywords). For these we have to add a space and shouldn't follow any user options.
rule("SpaceBeforeBinaryKeywordOperator", anyToken, binaryKeywordOperators, [isNonJsxSameLineTokenContext, isBinaryOpContext], 2 /* Space */),
rule("SpaceAfterBinaryKeywordOperator", binaryKeywordOperators, anyToken, [isNonJsxSameLineTokenContext, isBinaryOpContext], 2 /* Space */),
- rule("SpaceAfterVoidOperator", 106 /* VoidKeyword */, anyToken, [isNonJsxSameLineTokenContext, isVoidOpContext], 2 /* Space */),
+ rule("SpaceAfterVoidOperator", 107 /* VoidKeyword */, anyToken, [isNonJsxSameLineTokenContext, isVoidOpContext], 2 /* Space */),
// Async-await
- rule("SpaceBetweenAsyncAndOpenParen", 121 /* AsyncKeyword */, 20 /* OpenParenToken */, [isArrowFunctionContext, isNonJsxSameLineTokenContext], 2 /* Space */),
- rule("SpaceBetweenAsyncAndFunctionKeyword", 121 /* AsyncKeyword */, 90 /* FunctionKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceBetweenAsyncAndOpenParen", 122 /* AsyncKeyword */, 20 /* OpenParenToken */, [isArrowFunctionContext, isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceBetweenAsyncAndFunctionKeyword", 122 /* AsyncKeyword */, 91 /* FunctionKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */),
// Template string
- rule("NoSpaceBetweenTagAndTemplateString", [72 /* Identifier */, 21 /* CloseParenToken */], [14 /* NoSubstitutionTemplateLiteral */, 15 /* TemplateHead */], [isNonJsxSameLineTokenContext], 8 /* Delete */),
+ rule("NoSpaceBetweenTagAndTemplateString", [73 /* Identifier */, 21 /* CloseParenToken */], [14 /* NoSubstitutionTemplateLiteral */, 15 /* TemplateHead */], [isNonJsxSameLineTokenContext], 8 /* Delete */),
// JSX opening elements
- rule("SpaceBeforeJsxAttribute", anyToken, 72 /* Identifier */, [isNextTokenParentJsxAttribute, isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceBeforeJsxAttribute", anyToken, 73 /* Identifier */, [isNextTokenParentJsxAttribute, isNonJsxSameLineTokenContext], 2 /* Space */),
rule("SpaceBeforeSlashInJsxOpeningElement", anyToken, 42 /* SlashToken */, [isJsxSelfClosingElementContext, isNonJsxSameLineTokenContext], 2 /* Space */),
rule("NoSpaceBeforeGreaterThanTokenInJsxOpeningElement", 42 /* SlashToken */, 30 /* GreaterThanToken */, [isJsxSelfClosingElementContext, isNonJsxSameLineTokenContext], 8 /* Delete */),
- rule("NoSpaceBeforeEqualInJsxAttribute", anyToken, 59 /* EqualsToken */, [isJsxAttributeContext, isNonJsxSameLineTokenContext], 8 /* Delete */),
- rule("NoSpaceAfterEqualInJsxAttribute", 59 /* EqualsToken */, anyToken, [isJsxAttributeContext, isNonJsxSameLineTokenContext], 8 /* Delete */),
+ rule("NoSpaceBeforeEqualInJsxAttribute", anyToken, 60 /* EqualsToken */, [isJsxAttributeContext, isNonJsxSameLineTokenContext], 8 /* Delete */),
+ rule("NoSpaceAfterEqualInJsxAttribute", 60 /* EqualsToken */, anyToken, [isJsxAttributeContext, isNonJsxSameLineTokenContext], 8 /* Delete */),
// TypeScript-specific rules
// Use of module as a function call. e.g.: import m2 = module("m2");
- rule("NoSpaceAfterModuleImport", [130 /* ModuleKeyword */, 134 /* RequireKeyword */], 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
+ rule("NoSpaceAfterModuleImport", [131 /* ModuleKeyword */, 135 /* RequireKeyword */], 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
// Add a space around certain TypeScript keywords
rule("SpaceAfterCertainTypeScriptKeywords", [
- 118 /* AbstractKeyword */,
- 76 /* ClassKeyword */,
- 125 /* DeclareKeyword */,
- 80 /* DefaultKeyword */,
- 84 /* EnumKeyword */,
- 85 /* ExportKeyword */,
- 86 /* ExtendsKeyword */,
- 126 /* GetKeyword */,
- 109 /* ImplementsKeyword */,
- 92 /* ImportKeyword */,
- 110 /* InterfaceKeyword */,
- 130 /* ModuleKeyword */,
- 131 /* NamespaceKeyword */,
- 113 /* PrivateKeyword */,
- 115 /* PublicKeyword */,
- 114 /* ProtectedKeyword */,
- 133 /* ReadonlyKeyword */,
- 137 /* SetKeyword */,
- 116 /* StaticKeyword */,
- 140 /* TypeKeyword */,
- 144 /* FromKeyword */,
- 129 /* KeyOfKeyword */,
- 127 /* InferKeyword */,
+ 119 /* AbstractKeyword */,
+ 77 /* ClassKeyword */,
+ 126 /* DeclareKeyword */,
+ 81 /* DefaultKeyword */,
+ 85 /* EnumKeyword */,
+ 86 /* ExportKeyword */,
+ 87 /* ExtendsKeyword */,
+ 127 /* GetKeyword */,
+ 110 /* ImplementsKeyword */,
+ 93 /* ImportKeyword */,
+ 111 /* InterfaceKeyword */,
+ 131 /* ModuleKeyword */,
+ 132 /* NamespaceKeyword */,
+ 114 /* PrivateKeyword */,
+ 116 /* PublicKeyword */,
+ 115 /* ProtectedKeyword */,
+ 134 /* ReadonlyKeyword */,
+ 138 /* SetKeyword */,
+ 117 /* StaticKeyword */,
+ 141 /* TypeKeyword */,
+ 145 /* FromKeyword */,
+ 130 /* KeyOfKeyword */,
+ 128 /* InferKeyword */,
], anyToken, [isNonJsxSameLineTokenContext], 2 /* Space */),
- rule("SpaceBeforeCertainTypeScriptKeywords", anyToken, [86 /* ExtendsKeyword */, 109 /* ImplementsKeyword */, 144 /* FromKeyword */], [isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceBeforeCertainTypeScriptKeywords", anyToken, [87 /* ExtendsKeyword */, 110 /* ImplementsKeyword */, 145 /* FromKeyword */], [isNonJsxSameLineTokenContext], 2 /* Space */),
// Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" {
rule("SpaceAfterModuleName", 10 /* StringLiteral */, 18 /* OpenBraceToken */, [isModuleDeclContext], 2 /* Space */),
// Lambda expressions
rule("SpaceBeforeArrow", anyToken, 37 /* EqualsGreaterThanToken */, [isNonJsxSameLineTokenContext], 2 /* Space */),
rule("SpaceAfterArrow", 37 /* EqualsGreaterThanToken */, anyToken, [isNonJsxSameLineTokenContext], 2 /* Space */),
// Optional parameters and let args
- rule("NoSpaceAfterEllipsis", 25 /* DotDotDotToken */, 72 /* Identifier */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
+ rule("NoSpaceAfterEllipsis", 25 /* DotDotDotToken */, 73 /* Identifier */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
rule("NoSpaceAfterOptionalParameters", 56 /* QuestionToken */, [21 /* CloseParenToken */, 27 /* CommaToken */], [isNonJsxSameLineTokenContext, isNotBinaryOpContext], 8 /* Delete */),
// Remove spaces in empty interface literals. e.g.: x: {}
rule("NoSpaceBetweenEmptyInterfaceBraceBrackets", 18 /* OpenBraceToken */, 19 /* CloseBraceToken */, [isNonJsxSameLineTokenContext, isObjectTypeContext], 8 /* Delete */),
@@ -108353,37 +109578,37 @@
rule("NoSpaceBeforeCloseAngularBracket", anyToken, 30 /* GreaterThanToken */, [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 8 /* Delete */),
rule("NoSpaceAfterCloseAngularBracket", 30 /* GreaterThanToken */, [20 /* OpenParenToken */, 22 /* OpenBracketToken */, 30 /* GreaterThanToken */, 27 /* CommaToken */], [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext, isNotFunctionDeclContext /*To prevent an interference with the SpaceBeforeOpenParenInFuncDecl rule*/], 8 /* Delete */),
// decorators
- rule("SpaceBeforeAt", [21 /* CloseParenToken */, 72 /* Identifier */], 58 /* AtToken */, [isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceBeforeAt", [21 /* CloseParenToken */, 73 /* Identifier */], 58 /* AtToken */, [isNonJsxSameLineTokenContext], 2 /* Space */),
rule("NoSpaceAfterAt", 58 /* AtToken */, anyToken, [isNonJsxSameLineTokenContext], 8 /* Delete */),
// Insert space after @ in decorator
rule("SpaceAfterDecorator", anyToken, [
- 118 /* AbstractKeyword */,
- 72 /* Identifier */,
- 85 /* ExportKeyword */,
- 80 /* DefaultKeyword */,
- 76 /* ClassKeyword */,
- 116 /* StaticKeyword */,
- 115 /* PublicKeyword */,
- 113 /* PrivateKeyword */,
- 114 /* ProtectedKeyword */,
- 126 /* GetKeyword */,
- 137 /* SetKeyword */,
+ 119 /* AbstractKeyword */,
+ 73 /* Identifier */,
+ 86 /* ExportKeyword */,
+ 81 /* DefaultKeyword */,
+ 77 /* ClassKeyword */,
+ 117 /* StaticKeyword */,
+ 116 /* PublicKeyword */,
+ 114 /* PrivateKeyword */,
+ 115 /* ProtectedKeyword */,
+ 127 /* GetKeyword */,
+ 138 /* SetKeyword */,
22 /* OpenBracketToken */,
40 /* AsteriskToken */,
], [isEndOfDecoratorContextOnSameLine], 2 /* Space */),
rule("NoSpaceBeforeNonNullAssertionOperator", anyToken, 52 /* ExclamationToken */, [isNonJsxSameLineTokenContext, isNonNullAssertionContext], 8 /* Delete */),
- rule("NoSpaceAfterNewKeywordOnConstructorSignature", 95 /* NewKeyword */, 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext, isConstructorSignatureContext], 8 /* Delete */),
+ rule("NoSpaceAfterNewKeywordOnConstructorSignature", 96 /* NewKeyword */, 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext, isConstructorSignatureContext], 8 /* Delete */),
];
// These rules are applied after high priority
var userConfigurableRules = [
// Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses
- rule("SpaceAfterConstructor", 124 /* ConstructorKeyword */, 20 /* OpenParenToken */, [isOptionEnabled("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 2 /* Space */),
- rule("NoSpaceAfterConstructor", 124 /* ConstructorKeyword */, 20 /* OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 8 /* Delete */),
+ rule("SpaceAfterConstructor", 125 /* ConstructorKeyword */, 20 /* OpenParenToken */, [isOptionEnabled("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("NoSpaceAfterConstructor", 125 /* ConstructorKeyword */, 20 /* OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 8 /* Delete */),
rule("SpaceAfterComma", 27 /* CommaToken */, anyToken, [isOptionEnabled("insertSpaceAfterCommaDelimiter"), isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNextTokenNotCloseBracket], 2 /* Space */),
rule("NoSpaceAfterComma", 27 /* CommaToken */, anyToken, [isOptionDisabledOrUndefined("insertSpaceAfterCommaDelimiter"), isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext], 8 /* Delete */),
// Insert space after function keyword for anonymous functions
- rule("SpaceAfterAnonymousFunctionKeyword", 90 /* FunctionKeyword */, 20 /* OpenParenToken */, [isOptionEnabled("insertSpaceAfterFunctionKeywordForAnonymousFunctions"), isFunctionDeclContext], 2 /* Space */),
- rule("NoSpaceAfterAnonymousFunctionKeyword", 90 /* FunctionKeyword */, 20 /* OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterFunctionKeywordForAnonymousFunctions"), isFunctionDeclContext], 8 /* Delete */),
+ rule("SpaceAfterAnonymousFunctionKeyword", [91 /* FunctionKeyword */, 40 /* AsteriskToken */], 20 /* OpenParenToken */, [isOptionEnabled("insertSpaceAfterFunctionKeywordForAnonymousFunctions"), isFunctionDeclContext], 2 /* Space */),
+ rule("NoSpaceAfterAnonymousFunctionKeyword", [91 /* FunctionKeyword */, 40 /* AsteriskToken */], 20 /* OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterFunctionKeywordForAnonymousFunctions"), isFunctionDeclContext], 8 /* Delete */),
// Insert space after keywords in control flow statements
rule("SpaceAfterKeywordInControl", keywords, 20 /* OpenParenToken */, [isOptionEnabled("insertSpaceAfterKeywordsInControlFlowStatements"), isControlDeclContext], 2 /* Space */),
rule("NoSpaceAfterKeywordInControl", keywords, 20 /* OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterKeywordsInControlFlowStatements"), isControlDeclContext], 8 /* Delete */),
@@ -108447,16 +109672,16 @@
rule("SpaceBeforeOpenBraceInTypeScriptDeclWithBlock", typeScriptOpenBraceLeftTokenRange, 18 /* OpenBraceToken */, [isOptionDisabledOrUndefinedOrTokensOnSameLine("placeOpenBraceOnNewLineForFunctions"), isTypeScriptDeclWithBlockContext, isNotFormatOnEnter, isSameLineTokenOrBeforeBlockContext], 2 /* Space */, 1 /* CanDeleteNewLines */),
rule("NoSpaceBeforeComma", anyToken, 27 /* CommaToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
// No space before and after indexer `x[]`
- rule("NoSpaceBeforeOpenBracket", anyTokenExcept(121 /* AsyncKeyword */, 74 /* CaseKeyword */), 22 /* OpenBracketToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
+ rule("NoSpaceBeforeOpenBracket", anyTokenExcept(122 /* AsyncKeyword */, 75 /* CaseKeyword */), 22 /* OpenBracketToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
rule("NoSpaceAfterCloseBracket", 23 /* CloseBracketToken */, anyToken, [isNonJsxSameLineTokenContext, isNotBeforeBlockInFunctionDeclarationContext], 8 /* Delete */),
rule("SpaceAfterSemicolon", 26 /* SemicolonToken */, anyToken, [isNonJsxSameLineTokenContext], 2 /* Space */),
// Remove extra space between for and await
- rule("SpaceBetweenForAndAwaitKeyword", 89 /* ForKeyword */, 122 /* AwaitKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceBetweenForAndAwaitKeyword", 90 /* ForKeyword */, 123 /* AwaitKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */),
// Add a space between statements. All keywords except (do,else,case) has open/close parens after them.
// So, we have a rule to add a space for [),Any], [do,Any], [else,Any], and [case,Any]
- rule("SpaceBetweenStatements", [21 /* CloseParenToken */, 82 /* DoKeyword */, 83 /* ElseKeyword */, 74 /* CaseKeyword */], anyToken, [isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNotForContext], 2 /* Space */),
+ rule("SpaceBetweenStatements", [21 /* CloseParenToken */, 83 /* DoKeyword */, 84 /* ElseKeyword */, 75 /* CaseKeyword */], anyToken, [isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNotForContext], 2 /* Space */),
// This low-pri rule takes care of "try {" and "finally {" in case the rule SpaceBeforeOpenBraceInControl didn't execute on FormatOnEnter.
- rule("SpaceAfterTryFinally", [103 /* TryKeyword */, 88 /* FinallyKeyword */], 18 /* OpenBraceToken */, [isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceAfterTryFinally", [104 /* TryKeyword */, 89 /* FinallyKeyword */], 18 /* OpenBraceToken */, [isNonJsxSameLineTokenContext], 2 /* Space */),
];
return highPriorityCommonRules.concat(userConfigurableRules, lowPriorityCommonRules);
}
@@ -108500,45 +109725,45 @@
return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !!context.options[optionName]; };
}
function isForContext(context) {
- return context.contextNode.kind === 225 /* ForStatement */;
+ return context.contextNode.kind === 226 /* ForStatement */;
}
function isNotForContext(context) {
return !isForContext(context);
}
function isBinaryOpContext(context) {
switch (context.contextNode.kind) {
- case 204 /* BinaryExpression */:
- case 205 /* ConditionalExpression */:
- case 175 /* ConditionalType */:
- case 212 /* AsExpression */:
- case 257 /* ExportSpecifier */:
- case 253 /* ImportSpecifier */:
- case 163 /* TypePredicate */:
- case 173 /* UnionType */:
- case 174 /* IntersectionType */:
+ case 205 /* BinaryExpression */:
+ case 206 /* ConditionalExpression */:
+ case 176 /* ConditionalType */:
+ case 213 /* AsExpression */:
+ case 258 /* ExportSpecifier */:
+ case 254 /* ImportSpecifier */:
+ case 164 /* TypePredicate */:
+ case 174 /* UnionType */:
+ case 175 /* IntersectionType */:
return true;
// equals in binding elements: function foo([[x, y] = [1, 2]])
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
// equals in type X = ...
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
// equal in import a = module('a');
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
// equal in let a = 0;
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
// equal in p = 0;
- case 151 /* Parameter */:
- case 278 /* EnumMember */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- return context.currentTokenSpan.kind === 59 /* EqualsToken */ || context.nextTokenSpan.kind === 59 /* EqualsToken */;
+ case 152 /* Parameter */:
+ case 279 /* EnumMember */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ return context.currentTokenSpan.kind === 60 /* EqualsToken */ || context.nextTokenSpan.kind === 60 /* EqualsToken */;
// "in" keyword in for (let x in []) { }
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
// "in" keyword in [P in keyof T]: T[P]
- case 150 /* TypeParameter */:
- return context.currentTokenSpan.kind === 93 /* InKeyword */ || context.nextTokenSpan.kind === 93 /* InKeyword */ || context.currentTokenSpan.kind === 59 /* EqualsToken */ || context.nextTokenSpan.kind === 59 /* EqualsToken */;
+ case 151 /* TypeParameter */:
+ return context.currentTokenSpan.kind === 94 /* InKeyword */ || context.nextTokenSpan.kind === 94 /* InKeyword */ || context.currentTokenSpan.kind === 60 /* EqualsToken */ || context.nextTokenSpan.kind === 60 /* EqualsToken */;
// Technically, "of" is not a binary operator, but format it the same way as "in"
- case 227 /* ForOfStatement */:
- return context.currentTokenSpan.kind === 147 /* OfKeyword */ || context.nextTokenSpan.kind === 147 /* OfKeyword */;
+ case 228 /* ForOfStatement */:
+ return context.currentTokenSpan.kind === 148 /* OfKeyword */ || context.nextTokenSpan.kind === 148 /* OfKeyword */;
}
return false;
}
@@ -108550,22 +109775,22 @@
}
function isTypeAnnotationContext(context) {
var contextKind = context.contextNode.kind;
- return contextKind === 154 /* PropertyDeclaration */ ||
- contextKind === 153 /* PropertySignature */ ||
- contextKind === 151 /* Parameter */ ||
- contextKind === 237 /* VariableDeclaration */ ||
+ return contextKind === 155 /* PropertyDeclaration */ ||
+ contextKind === 154 /* PropertySignature */ ||
+ contextKind === 152 /* Parameter */ ||
+ contextKind === 238 /* VariableDeclaration */ ||
ts.isFunctionLikeKind(contextKind);
}
function isConditionalOperatorContext(context) {
- return context.contextNode.kind === 205 /* ConditionalExpression */ ||
- context.contextNode.kind === 175 /* ConditionalType */;
+ return context.contextNode.kind === 206 /* ConditionalExpression */ ||
+ context.contextNode.kind === 176 /* ConditionalType */;
}
function isSameLineTokenOrBeforeBlockContext(context) {
return context.TokensAreOnSameLine() || isBeforeBlockContext(context);
}
function isBraceWrappedContext(context) {
- return context.contextNode.kind === 184 /* ObjectBindingPattern */ ||
- context.contextNode.kind === 181 /* MappedType */ ||
+ return context.contextNode.kind === 185 /* ObjectBindingPattern */ ||
+ context.contextNode.kind === 182 /* MappedType */ ||
isSingleLineBlockContext(context);
}
// This check is done before an open brace in a control construct, a function, or a typescript block declaration
@@ -108591,31 +109816,31 @@
return true;
}
switch (node.kind) {
- case 218 /* Block */:
- case 246 /* CaseBlock */:
- case 188 /* ObjectLiteralExpression */:
- case 245 /* ModuleBlock */:
+ case 219 /* Block */:
+ case 247 /* CaseBlock */:
+ case 189 /* ObjectLiteralExpression */:
+ case 246 /* ModuleBlock */:
return true;
}
return false;
}
function isFunctionDeclContext(context) {
switch (context.contextNode.kind) {
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 240 /* FunctionDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
// case SyntaxKind.MemberFunctionDeclaration:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
// case SyntaxKind.MethodSignature:
- case 160 /* CallSignature */:
- case 196 /* FunctionExpression */:
- case 157 /* Constructor */:
- case 197 /* ArrowFunction */:
+ case 161 /* CallSignature */:
+ case 197 /* FunctionExpression */:
+ case 158 /* Constructor */:
+ case 198 /* ArrowFunction */:
// case SyntaxKind.ConstructorDeclaration:
// case SyntaxKind.SimpleArrowFunctionExpression:
// case SyntaxKind.ParenthesizedArrowFunctionExpression:
- case 241 /* InterfaceDeclaration */: // This one is not truly a function, but for formatting purposes, it acts just like one
+ case 242 /* InterfaceDeclaration */: // This one is not truly a function, but for formatting purposes, it acts just like one
return true;
}
return false;
@@ -108624,40 +109849,40 @@
return !isFunctionDeclContext(context);
}
function isFunctionDeclarationOrFunctionExpressionContext(context) {
- return context.contextNode.kind === 239 /* FunctionDeclaration */ || context.contextNode.kind === 196 /* FunctionExpression */;
+ return context.contextNode.kind === 240 /* FunctionDeclaration */ || context.contextNode.kind === 197 /* FunctionExpression */;
}
function isTypeScriptDeclWithBlockContext(context) {
return nodeIsTypeScriptDeclWithBlockContext(context.contextNode);
}
function nodeIsTypeScriptDeclWithBlockContext(node) {
switch (node.kind) {
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
- case 168 /* TypeLiteral */:
- case 244 /* ModuleDeclaration */:
- case 255 /* ExportDeclaration */:
- case 256 /* NamedExports */:
- case 249 /* ImportDeclaration */:
- case 252 /* NamedImports */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 169 /* TypeLiteral */:
+ case 245 /* ModuleDeclaration */:
+ case 256 /* ExportDeclaration */:
+ case 257 /* NamedExports */:
+ case 250 /* ImportDeclaration */:
+ case 253 /* NamedImports */:
return true;
}
return false;
}
function isAfterCodeBlockContext(context) {
switch (context.currentTokenParent.kind) {
- case 240 /* ClassDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 243 /* EnumDeclaration */:
- case 274 /* CatchClause */:
- case 245 /* ModuleBlock */:
- case 232 /* SwitchStatement */:
+ case 241 /* ClassDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 275 /* CatchClause */:
+ case 246 /* ModuleBlock */:
+ case 233 /* SwitchStatement */:
return true;
- case 218 /* Block */: {
+ case 219 /* Block */: {
var blockParent = context.currentTokenParent.parent;
// In a codefix scenario, we can't rely on parents being set. So just always return true.
- if (!blockParent || blockParent.kind !== 197 /* ArrowFunction */ && blockParent.kind !== 196 /* FunctionExpression */) {
+ if (!blockParent || blockParent.kind !== 198 /* ArrowFunction */ && blockParent.kind !== 197 /* FunctionExpression */) {
return true;
}
}
@@ -108666,31 +109891,31 @@
}
function isControlDeclContext(context) {
switch (context.contextNode.kind) {
- case 222 /* IfStatement */:
- case 232 /* SwitchStatement */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 224 /* WhileStatement */:
- case 235 /* TryStatement */:
- case 223 /* DoStatement */:
- case 231 /* WithStatement */:
+ case 223 /* IfStatement */:
+ case 233 /* SwitchStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 225 /* WhileStatement */:
+ case 236 /* TryStatement */:
+ case 224 /* DoStatement */:
+ case 232 /* WithStatement */:
// TODO
// case SyntaxKind.ElseClause:
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return true;
default:
return false;
}
}
function isObjectContext(context) {
- return context.contextNode.kind === 188 /* ObjectLiteralExpression */;
+ return context.contextNode.kind === 189 /* ObjectLiteralExpression */;
}
function isFunctionCallContext(context) {
- return context.contextNode.kind === 191 /* CallExpression */;
+ return context.contextNode.kind === 192 /* CallExpression */;
}
function isNewContext(context) {
- return context.contextNode.kind === 192 /* NewExpression */;
+ return context.contextNode.kind === 193 /* NewExpression */;
}
function isFunctionCallOrNewContext(context) {
return isFunctionCallContext(context) || isNewContext(context);
@@ -108702,28 +109927,28 @@
return context.nextTokenSpan.kind !== 23 /* CloseBracketToken */;
}
function isArrowFunctionContext(context) {
- return context.contextNode.kind === 197 /* ArrowFunction */;
+ return context.contextNode.kind === 198 /* ArrowFunction */;
}
function isImportTypeContext(context) {
- return context.contextNode.kind === 183 /* ImportType */;
+ return context.contextNode.kind === 184 /* ImportType */;
}
function isNonJsxSameLineTokenContext(context) {
return context.TokensAreOnSameLine() && context.contextNode.kind !== 11 /* JsxText */;
}
function isNonJsxElementOrFragmentContext(context) {
- return context.contextNode.kind !== 260 /* JsxElement */ && context.contextNode.kind !== 264 /* JsxFragment */;
+ return context.contextNode.kind !== 261 /* JsxElement */ && context.contextNode.kind !== 265 /* JsxFragment */;
}
function isJsxExpressionContext(context) {
- return context.contextNode.kind === 270 /* JsxExpression */ || context.contextNode.kind === 269 /* JsxSpreadAttribute */;
+ return context.contextNode.kind === 271 /* JsxExpression */ || context.contextNode.kind === 270 /* JsxSpreadAttribute */;
}
function isNextTokenParentJsxAttribute(context) {
- return context.nextTokenParent.kind === 267 /* JsxAttribute */;
+ return context.nextTokenParent.kind === 268 /* JsxAttribute */;
}
function isJsxAttributeContext(context) {
- return context.contextNode.kind === 267 /* JsxAttribute */;
+ return context.contextNode.kind === 268 /* JsxAttribute */;
}
function isJsxSelfClosingElementContext(context) {
- return context.contextNode.kind === 261 /* JsxSelfClosingElement */;
+ return context.contextNode.kind === 262 /* JsxSelfClosingElement */;
}
function isNotBeforeBlockInFunctionDeclarationContext(context) {
return !isFunctionDeclContext(context) && !isBeforeBlockContext(context);
@@ -108738,45 +109963,45 @@
while (ts.isExpressionNode(node)) {
node = node.parent;
}
- return node.kind === 152 /* Decorator */;
+ return node.kind === 153 /* Decorator */;
}
function isStartOfVariableDeclarationList(context) {
- return context.currentTokenParent.kind === 238 /* VariableDeclarationList */ &&
+ return context.currentTokenParent.kind === 239 /* VariableDeclarationList */ &&
context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos;
}
function isNotFormatOnEnter(context) {
return context.formattingRequestKind !== 2 /* FormatOnEnter */;
}
function isModuleDeclContext(context) {
- return context.contextNode.kind === 244 /* ModuleDeclaration */;
+ return context.contextNode.kind === 245 /* ModuleDeclaration */;
}
function isObjectTypeContext(context) {
- return context.contextNode.kind === 168 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration;
+ return context.contextNode.kind === 169 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration;
}
function isConstructorSignatureContext(context) {
- return context.contextNode.kind === 161 /* ConstructSignature */;
+ return context.contextNode.kind === 162 /* ConstructSignature */;
}
function isTypeArgumentOrParameterOrAssertion(token, parent) {
if (token.kind !== 28 /* LessThanToken */ && token.kind !== 30 /* GreaterThanToken */) {
return false;
}
switch (parent.kind) {
- case 164 /* TypeReference */:
- case 194 /* TypeAssertionExpression */:
- case 242 /* TypeAliasDeclaration */:
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
- case 211 /* ExpressionWithTypeArguments */:
+ case 165 /* TypeReference */:
+ case 195 /* TypeAssertionExpression */:
+ case 243 /* TypeAliasDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
+ case 212 /* ExpressionWithTypeArguments */:
return true;
default:
return false;
@@ -108787,16 +110012,16 @@
isTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent);
}
function isTypeAssertionContext(context) {
- return context.contextNode.kind === 194 /* TypeAssertionExpression */;
+ return context.contextNode.kind === 195 /* TypeAssertionExpression */;
}
function isVoidOpContext(context) {
- return context.currentTokenSpan.kind === 106 /* VoidKeyword */ && context.currentTokenParent.kind === 200 /* VoidExpression */;
+ return context.currentTokenSpan.kind === 107 /* VoidKeyword */ && context.currentTokenParent.kind === 201 /* VoidExpression */;
}
function isYieldOrYieldStarWithOperand(context) {
- return context.contextNode.kind === 207 /* YieldExpression */ && context.contextNode.expression !== undefined;
+ return context.contextNode.kind === 208 /* YieldExpression */ && context.contextNode.expression !== undefined;
}
function isNonNullAssertionContext(context) {
- return context.contextNode.kind === 213 /* NonNullExpression */;
+ return context.contextNode.kind === 214 /* NonNullExpression */;
}
})(formatting = ts.formatting || (ts.formatting = {}));
})(ts || (ts = {}));
@@ -108847,12 +110072,12 @@
return map;
}
function getRuleBucketIndex(row, column) {
- ts.Debug.assert(row <= 147 /* LastKeyword */ && column <= 147 /* LastKeyword */, "Must compute formatting context from tokens");
+ ts.Debug.assert(row <= 148 /* LastKeyword */ && column <= 148 /* LastKeyword */, "Must compute formatting context from tokens");
return (row * mapRowLength) + column;
}
var maskBitSize = 5;
var mask = 31; // MaskBitSize bits
- var mapRowLength = 147 /* LastToken */ + 1;
+ var mapRowLength = 148 /* LastToken */ + 1;
var RulesPosition;
(function (RulesPosition) {
RulesPosition[RulesPosition["IgnoreRulesSpecific"] = 0] = "IgnoreRulesSpecific";
@@ -109030,17 +110255,17 @@
// i.e. parent is class declaration with the list of members and node is one of members.
function isListElement(parent, node) {
switch (parent.kind) {
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
return ts.rangeContainsRange(parent.members, node);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
var body = parent.body;
- return !!body && body.kind === 245 /* ModuleBlock */ && ts.rangeContainsRange(body.statements, node);
- case 284 /* SourceFile */:
- case 218 /* Block */:
- case 245 /* ModuleBlock */:
+ return !!body && body.kind === 246 /* ModuleBlock */ && ts.rangeContainsRange(body.statements, node);
+ case 285 /* SourceFile */:
+ case 219 /* Block */:
+ case 246 /* ModuleBlock */:
return ts.rangeContainsRange(parent.statements, node);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return ts.rangeContainsRange(parent.block.statements, node);
}
return false;
@@ -109262,19 +110487,19 @@
return node.modifiers[0].kind;
}
switch (node.kind) {
- case 240 /* ClassDeclaration */: return 76 /* ClassKeyword */;
- case 241 /* InterfaceDeclaration */: return 110 /* InterfaceKeyword */;
- case 239 /* FunctionDeclaration */: return 90 /* FunctionKeyword */;
- case 243 /* EnumDeclaration */: return 243 /* EnumDeclaration */;
- case 158 /* GetAccessor */: return 126 /* GetKeyword */;
- case 159 /* SetAccessor */: return 137 /* SetKeyword */;
- case 156 /* MethodDeclaration */:
+ case 241 /* ClassDeclaration */: return 77 /* ClassKeyword */;
+ case 242 /* InterfaceDeclaration */: return 111 /* InterfaceKeyword */;
+ case 240 /* FunctionDeclaration */: return 91 /* FunctionKeyword */;
+ case 244 /* EnumDeclaration */: return 244 /* EnumDeclaration */;
+ case 159 /* GetAccessor */: return 127 /* GetKeyword */;
+ case 160 /* SetAccessor */: return 138 /* SetKeyword */;
+ case 157 /* MethodDeclaration */:
if (node.asteriskToken) {
return 40 /* AsteriskToken */;
}
// falls through
- case 154 /* PropertyDeclaration */:
- case 151 /* Parameter */:
+ case 155 /* PropertyDeclaration */:
+ case 152 /* Parameter */:
var name = ts.getNameOfDeclaration(node);
if (name) {
return name.kind;
@@ -109324,22 +110549,22 @@
case 18 /* OpenBraceToken */:
case 19 /* CloseBraceToken */:
case 21 /* CloseParenToken */:
- case 83 /* ElseKeyword */:
- case 107 /* WhileKeyword */:
+ case 84 /* ElseKeyword */:
+ case 108 /* WhileKeyword */:
case 58 /* AtToken */:
return false;
case 42 /* SlashToken */:
case 30 /* GreaterThanToken */:
switch (container.kind) {
- case 262 /* JsxOpeningElement */:
- case 263 /* JsxClosingElement */:
- case 261 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
+ case 264 /* JsxClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
return false;
}
break;
case 22 /* OpenBracketToken */:
case 23 /* CloseBracketToken */:
- if (container.kind !== 181 /* MappedType */) {
+ if (container.kind !== 182 /* MappedType */) {
return false;
}
break;
@@ -109431,7 +110656,7 @@
consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, child);
return inheritedIndentation;
}
- var effectiveParentStartLine = child.kind === 152 /* Decorator */ ? childStartLine : undecoratedParentStartLine;
+ var effectiveParentStartLine = child.kind === 153 /* Decorator */ ? childStartLine : undecoratedParentStartLine;
var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine);
processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta);
if (child.kind === 11 /* JsxText */) {
@@ -109439,7 +110664,7 @@
indentMultilineCommentOrJsxText(range, childIndentation.indentation, /*firstLineIsIndented*/ true, /*indentFinalLine*/ false);
}
childContextNode = node;
- if (isFirstListItem && parent.kind === 187 /* ArrayLiteralExpression */ && inheritedIndentation === -1 /* Unknown */) {
+ if (isFirstListItem && parent.kind === 188 /* ArrayLiteralExpression */ && inheritedIndentation === -1 /* Unknown */) {
inheritedIndentation = childIndentation.indentation;
}
return inheritedIndentation;
@@ -109857,12 +111082,12 @@
formatting.getRangeOfEnclosingComment = getRangeOfEnclosingComment;
function getOpenTokenForList(node, list) {
switch (node.kind) {
- case 157 /* Constructor */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 197 /* ArrowFunction */:
+ case 158 /* Constructor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 198 /* ArrowFunction */:
if (node.typeParameters === list) {
return 28 /* LessThanToken */;
}
@@ -109870,8 +111095,8 @@
return 20 /* OpenParenToken */;
}
break;
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
if (node.typeArguments === list) {
return 28 /* LessThanToken */;
}
@@ -109879,12 +111104,12 @@
return 20 /* OpenParenToken */;
}
break;
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
if (node.typeArguments === list) {
return 28 /* LessThanToken */;
}
break;
- case 168 /* TypeLiteral */:
+ case 169 /* TypeLiteral */:
return 18 /* OpenBraceToken */;
}
return 0 /* Unknown */;
@@ -110001,7 +111226,7 @@
if (options.indentStyle === ts.IndentStyle.Block) {
return getBlockIndent(sourceFile, position, options);
}
- if (precedingToken.kind === 27 /* CommaToken */ && precedingToken.parent.kind !== 204 /* BinaryExpression */) {
+ if (precedingToken.kind === 27 /* CommaToken */ && precedingToken.parent.kind !== 205 /* BinaryExpression */) {
// previous token is comma that separates items in list - find the previous item and try to derive indentation from it
var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options);
if (actualIndentation !== -1 /* Unknown */) {
@@ -110155,7 +111380,7 @@
// - parent is SourceFile - by default immediate children of SourceFile are not indented except when user indents them manually
// - parent and child are not on the same line
var useActualIndentation = (ts.isDeclaration(current) || ts.isStatementButNotDeclaration(current)) &&
- (parent.kind === 284 /* SourceFile */ || !parentAndChildShareLine);
+ (parent.kind === 285 /* SourceFile */ || !parentAndChildShareLine);
if (!useActualIndentation) {
return -1 /* Unknown */;
}
@@ -110203,8 +111428,8 @@
}
SmartIndenter.isArgumentAndStartLineOverlapsExpressionBeingCalled = isArgumentAndStartLineOverlapsExpressionBeingCalled;
function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) {
- if (parent.kind === 222 /* IfStatement */ && parent.elseStatement === child) {
- var elseKeyword = ts.findChildOfKind(parent, 83 /* ElseKeyword */, sourceFile);
+ if (parent.kind === 223 /* IfStatement */ && parent.elseStatement === child) {
+ var elseKeyword = ts.findChildOfKind(parent, 84 /* ElseKeyword */, sourceFile);
ts.Debug.assert(elseKeyword !== undefined);
var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line;
return elseKeywordStartLine === childStartLine;
@@ -110221,40 +111446,40 @@
}
function getListByRange(start, end, node, sourceFile) {
switch (node.kind) {
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return getList(node.typeArguments);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return getList(node.properties);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return getList(node.elements);
- case 168 /* TypeLiteral */:
+ case 169 /* TypeLiteral */:
return getList(node.members);
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 160 /* CallSignature */:
- case 157 /* Constructor */:
- case 166 /* ConstructorType */:
- case 161 /* ConstructSignature */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 161 /* CallSignature */:
+ case 158 /* Constructor */:
+ case 167 /* ConstructorType */:
+ case 162 /* ConstructSignature */:
return getList(node.typeParameters) || getList(node.parameters);
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 308 /* JSDocTemplateTag */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 309 /* JSDocTemplateTag */:
return getList(node.typeParameters);
- case 192 /* NewExpression */:
- case 191 /* CallExpression */:
+ case 193 /* NewExpression */:
+ case 192 /* CallExpression */:
return getList(node.typeArguments) || getList(node.arguments);
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
return getList(node.declarations);
- case 252 /* NamedImports */:
- case 256 /* NamedExports */:
+ case 253 /* NamedImports */:
+ case 257 /* NamedExports */:
return getList(node.elements);
- case 184 /* ObjectBindingPattern */:
- case 185 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
return getList(node.elements);
}
function getList(list) {
@@ -110277,7 +111502,7 @@
return findColumnForFirstNonWhitespaceCharacterInLine(sourceFile.getLineAndCharacterOfPosition(list.pos), sourceFile, options);
}
function getActualIndentationForListItem(node, sourceFile, options, listIndentsChild) {
- if (node.parent && node.parent.kind === 238 /* VariableDeclarationList */) {
+ if (node.parent && node.parent.kind === 239 /* VariableDeclarationList */) {
// VariableDeclarationList has no wrapping tokens
return -1 /* Unknown */;
}
@@ -110350,83 +111575,83 @@
function nodeWillIndentChild(settings, parent, child, sourceFile, indentByDefault) {
var childKind = child ? child.kind : 0 /* Unknown */;
switch (parent.kind) {
- case 221 /* ExpressionStatement */:
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 187 /* ArrayLiteralExpression */:
- case 218 /* Block */:
- case 245 /* ModuleBlock */:
- case 188 /* ObjectLiteralExpression */:
- case 168 /* TypeLiteral */:
- case 181 /* MappedType */:
- case 170 /* TupleType */:
- case 246 /* CaseBlock */:
- case 272 /* DefaultClause */:
- case 271 /* CaseClause */:
- case 195 /* ParenthesizedExpression */:
- case 189 /* PropertyAccessExpression */:
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
- case 219 /* VariableStatement */:
- case 254 /* ExportAssignment */:
- case 230 /* ReturnStatement */:
- case 205 /* ConditionalExpression */:
- case 185 /* ArrayBindingPattern */:
- case 184 /* ObjectBindingPattern */:
- case 262 /* JsxOpeningElement */:
- case 265 /* JsxOpeningFragment */:
- case 261 /* JsxSelfClosingElement */:
- case 270 /* JsxExpression */:
- case 155 /* MethodSignature */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 151 /* Parameter */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 177 /* ParenthesizedType */:
- case 193 /* TaggedTemplateExpression */:
- case 201 /* AwaitExpression */:
- case 256 /* NamedExports */:
- case 252 /* NamedImports */:
- case 257 /* ExportSpecifier */:
- case 253 /* ImportSpecifier */:
- case 154 /* PropertyDeclaration */:
- return true;
- case 237 /* VariableDeclaration */:
- case 275 /* PropertyAssignment */:
- if (!settings.indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === 188 /* ObjectLiteralExpression */) { // TODO: GH#18217
+ case 222 /* ExpressionStatement */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 188 /* ArrayLiteralExpression */:
+ case 219 /* Block */:
+ case 246 /* ModuleBlock */:
+ case 189 /* ObjectLiteralExpression */:
+ case 169 /* TypeLiteral */:
+ case 182 /* MappedType */:
+ case 171 /* TupleType */:
+ case 247 /* CaseBlock */:
+ case 273 /* DefaultClause */:
+ case 272 /* CaseClause */:
+ case 196 /* ParenthesizedExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
+ case 220 /* VariableStatement */:
+ case 255 /* ExportAssignment */:
+ case 231 /* ReturnStatement */:
+ case 206 /* ConditionalExpression */:
+ case 186 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
+ case 263 /* JsxOpeningElement */:
+ case 266 /* JsxOpeningFragment */:
+ case 262 /* JsxSelfClosingElement */:
+ case 271 /* JsxExpression */:
+ case 156 /* MethodSignature */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 152 /* Parameter */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 178 /* ParenthesizedType */:
+ case 194 /* TaggedTemplateExpression */:
+ case 202 /* AwaitExpression */:
+ case 257 /* NamedExports */:
+ case 253 /* NamedImports */:
+ case 258 /* ExportSpecifier */:
+ case 254 /* ImportSpecifier */:
+ case 155 /* PropertyDeclaration */:
+ return true;
+ case 238 /* VariableDeclaration */:
+ case 276 /* PropertyAssignment */:
+ if (!settings.indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === 189 /* ObjectLiteralExpression */) { // TODO: GH#18217
return rangeIsOnOneLine(sourceFile, child);
}
return true;
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 225 /* ForStatement */:
- case 222 /* IfStatement */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 156 /* MethodDeclaration */:
- case 197 /* ArrowFunction */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- return childKind !== 218 /* Block */;
- case 255 /* ExportDeclaration */:
- return childKind !== 256 /* NamedExports */;
- case 249 /* ImportDeclaration */:
- return childKind !== 250 /* ImportClause */ ||
- (!!child.namedBindings && child.namedBindings.kind !== 252 /* NamedImports */);
- case 260 /* JsxElement */:
- return childKind !== 263 /* JsxClosingElement */;
- case 264 /* JsxFragment */:
- return childKind !== 266 /* JsxClosingFragment */;
- case 174 /* IntersectionType */:
- case 173 /* UnionType */:
- if (childKind === 168 /* TypeLiteral */) {
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 226 /* ForStatement */:
+ case 223 /* IfStatement */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 157 /* MethodDeclaration */:
+ case 198 /* ArrowFunction */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ return childKind !== 219 /* Block */;
+ case 256 /* ExportDeclaration */:
+ return childKind !== 257 /* NamedExports */;
+ case 250 /* ImportDeclaration */:
+ return childKind !== 251 /* ImportClause */ ||
+ (!!child.namedBindings && child.namedBindings.kind !== 253 /* NamedImports */);
+ case 261 /* JsxElement */:
+ return childKind !== 264 /* JsxClosingElement */;
+ case 265 /* JsxFragment */:
+ return childKind !== 267 /* JsxClosingFragment */;
+ case 175 /* IntersectionType */:
+ case 174 /* UnionType */:
+ if (childKind === 169 /* TypeLiteral */) {
return false;
}
// falls through
@@ -110437,11 +111662,11 @@
SmartIndenter.nodeWillIndentChild = nodeWillIndentChild;
function isControlFlowEndingStatement(kind, parent) {
switch (kind) {
- case 230 /* ReturnStatement */:
- case 234 /* ThrowStatement */:
- case 228 /* ContinueStatement */:
- case 229 /* BreakStatement */:
- return parent.kind !== 218 /* Block */;
+ case 231 /* ReturnStatement */:
+ case 235 /* ThrowStatement */:
+ case 229 /* ContinueStatement */:
+ case 230 /* BreakStatement */:
+ return parent.kind !== 219 /* Block */;
default:
return false;
}
@@ -110583,7 +111808,7 @@
* Checks if 'candidate' argument is a legal separator in the list that contains 'node' as an element
*/
function isSeparator(node, candidate) {
- return !!candidate && !!node.parent && (candidate.kind === 27 /* CommaToken */ || (candidate.kind === 26 /* SemicolonToken */ && node.parent.kind === 188 /* ObjectLiteralExpression */));
+ return !!candidate && !!node.parent && (candidate.kind === 27 /* CommaToken */ || (candidate.kind === 26 /* SemicolonToken */ && node.parent.kind === 189 /* ObjectLiteralExpression */));
}
function spaces(count) {
var s = "";
@@ -110744,7 +111969,7 @@
}
}
else {
- endNode = node.kind !== 237 /* VariableDeclaration */ && node.questionToken ? node.questionToken : node.name;
+ endNode = node.kind !== 238 /* VariableDeclaration */ && node.questionToken ? node.questionToken : node.name;
}
this.insertNodeAt(sourceFile, endNode.end, type, { prefix: ": " });
};
@@ -110856,18 +112081,18 @@
};
ChangeTracker.prototype.getInsertNodeAfterOptionsWorker = function (node) {
switch (node.kind) {
- case 240 /* ClassDeclaration */:
- case 244 /* ModuleDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 245 /* ModuleDeclaration */:
return { prefix: this.newLineCharacter, suffix: this.newLineCharacter };
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
case 10 /* StringLiteral */:
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return { prefix: ", " };
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return { suffix: "," + this.newLineCharacter };
- case 85 /* ExportKeyword */:
+ case 86 /* ExportKeyword */:
return { prefix: " " };
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return {};
default:
ts.Debug.assert(ts.isStatement(node) || ts.isClassOrTypeElement(node)); // Else we haven't handled this kind of node yet -- add it
@@ -110876,12 +112101,12 @@
};
ChangeTracker.prototype.insertName = function (sourceFile, node, name) {
ts.Debug.assert(!node.name);
- if (node.kind === 197 /* ArrowFunction */) {
+ if (node.kind === 198 /* ArrowFunction */) {
var arrow = ts.findChildOfKind(node, 37 /* EqualsGreaterThanToken */, sourceFile);
var lparen = ts.findChildOfKind(node, 20 /* OpenParenToken */, sourceFile);
if (lparen) {
// `() => {}` --> `function f() {}`
- this.insertNodesAt(sourceFile, lparen.getStart(sourceFile), [ts.createToken(90 /* FunctionKeyword */), ts.createIdentifier(name)], { joiner: " " });
+ this.insertNodesAt(sourceFile, lparen.getStart(sourceFile), [ts.createToken(91 /* FunctionKeyword */), ts.createIdentifier(name)], { joiner: " " });
deleteNode(this, sourceFile, arrow);
}
else {
@@ -110890,14 +112115,14 @@
// Replacing full range of arrow to get rid of the leading space -- replace ` =>` with `)`
this.replaceRange(sourceFile, arrow, ts.createToken(21 /* CloseParenToken */));
}
- if (node.body.kind !== 218 /* Block */) {
+ if (node.body.kind !== 219 /* Block */) {
// `() => 0` => `function f() { return 0; }`
- this.insertNodesAt(sourceFile, node.body.getStart(sourceFile), [ts.createToken(18 /* OpenBraceToken */), ts.createToken(97 /* ReturnKeyword */)], { joiner: " ", suffix: " " });
+ this.insertNodesAt(sourceFile, node.body.getStart(sourceFile), [ts.createToken(18 /* OpenBraceToken */), ts.createToken(98 /* ReturnKeyword */)], { joiner: " ", suffix: " " });
this.insertNodesAt(sourceFile, node.body.end, [ts.createToken(26 /* SemicolonToken */), ts.createToken(19 /* CloseBraceToken */)], { joiner: " " });
}
}
else {
- var pos = ts.findChildOfKind(node, node.kind === 196 /* FunctionExpression */ ? 90 /* FunctionKeyword */ : 76 /* ClassKeyword */, sourceFile).end;
+ var pos = ts.findChildOfKind(node, node.kind === 197 /* FunctionExpression */ ? 91 /* FunctionKeyword */ : 77 /* ClassKeyword */, sourceFile).end;
this.insertNodeAt(sourceFile, pos, ts.createIdentifier(name), { prefix: " " });
}
};
@@ -111124,7 +112349,7 @@
function newFileChangesWorker(oldFile, scriptKind, statements, newLineCharacter, formatContext) {
// TODO: this emits the file, parses it back, then formats it that -- may be a less roundabout way to do this
var nonFormattedText = statements.map(function (s) { return getNonformattedText(s, oldFile, newLineCharacter).text; }).join(newLineCharacter);
- var sourceFile = ts.createSourceFile("any file name", nonFormattedText, 7 /* ESNext */, /*setParentNodes*/ true, scriptKind);
+ var sourceFile = ts.createSourceFile("any file name", nonFormattedText, 8 /* ESNext */, /*setParentNodes*/ true, scriptKind);
var changes = ts.formatting.formatDocument(sourceFile, formatContext);
return applyChanges(nonFormattedText, changes) + newLineCharacter;
}
@@ -111392,14 +112617,14 @@
}
textChanges_3.isValidLocationToAddComment = isValidLocationToAddComment;
function needSemicolonBetween(a, b) {
- return (ts.isPropertySignature(a) || ts.isPropertyDeclaration(a)) && ts.isClassOrTypeElement(b) && b.name.kind === 149 /* ComputedPropertyName */
+ return (ts.isPropertySignature(a) || ts.isPropertyDeclaration(a)) && ts.isClassOrTypeElement(b) && b.name.kind === 150 /* ComputedPropertyName */
|| ts.isStatementButNotDeclaration(a) && ts.isStatementButNotDeclaration(b); // TODO: only if b would start with a `(` or `[`
}
var deleteDeclaration;
(function (deleteDeclaration_1) {
function deleteDeclaration(changes, deletedNodesInLists, sourceFile, node) {
switch (node.kind) {
- case 151 /* Parameter */: {
+ case 152 /* Parameter */: {
var oldFunction = node.parent;
if (ts.isArrowFunction(oldFunction) &&
oldFunction.parameters.length === 1 &&
@@ -111414,14 +112639,14 @@
}
break;
}
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
deleteNode(changes, sourceFile, node,
// For first import, leave header comment in place
node === sourceFile.imports[0].parent ? { leadingTriviaOption: LeadingTriviaOption.Exclude } : undefined);
break;
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
var pattern = node.parent;
- var preserveComma = pattern.kind === 185 /* ArrayBindingPattern */ && node !== ts.last(pattern.elements);
+ var preserveComma = pattern.kind === 186 /* ArrayBindingPattern */ && node !== ts.last(pattern.elements);
if (preserveComma) {
deleteNode(changes, sourceFile, node);
}
@@ -111429,13 +112654,13 @@
deleteNodeInList(changes, deletedNodesInLists, sourceFile, node);
}
break;
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
deleteVariableDeclaration(changes, deletedNodesInLists, sourceFile, node);
break;
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
deleteNodeInList(changes, deletedNodesInLists, sourceFile, node);
break;
- case 253 /* ImportSpecifier */:
+ case 254 /* ImportSpecifier */:
var namedImports = node.parent;
if (namedImports.elements.length === 1) {
deleteImportBinding(changes, sourceFile, namedImports);
@@ -111444,7 +112669,7 @@
deleteNodeInList(changes, deletedNodesInLists, sourceFile, node);
}
break;
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
deleteImportBinding(changes, sourceFile, node);
break;
default:
@@ -111491,13 +112716,13 @@
// Delete the entire import declaration
// |import * as ns from './file'|
// |import { a } from './file'|
- var importDecl = ts.getAncestor(node, 249 /* ImportDeclaration */);
+ var importDecl = ts.getAncestor(node, 250 /* ImportDeclaration */);
deleteNode(changes, sourceFile, importDecl);
}
}
function deleteVariableDeclaration(changes, deletedNodesInLists, sourceFile, node) {
var parent = node.parent;
- if (parent.kind === 274 /* CatchClause */) {
+ if (parent.kind === 275 /* CatchClause */) {
// TODO: There's currently no unused diagnostic for this, could be a suggestion
changes.deleteNodeRange(sourceFile, ts.findChildOfKind(parent, 20 /* OpenParenToken */, sourceFile), ts.findChildOfKind(parent, 21 /* CloseParenToken */, sourceFile));
return;
@@ -111508,14 +112733,14 @@
}
var gp = parent.parent;
switch (gp.kind) {
- case 227 /* ForOfStatement */:
- case 226 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 227 /* ForInStatement */:
changes.replaceNode(sourceFile, node, ts.createObjectLiteral());
break;
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
deleteNode(changes, sourceFile, parent);
break;
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
deleteNode(changes, sourceFile, gp);
break;
default:
@@ -111678,8 +112903,8 @@
var token = ts.getTokenAtPosition(sourceFile, pos);
var assertion = ts.Debug.assertDefined(ts.findAncestor(token, function (n) { return ts.isAsExpression(n) || ts.isTypeAssertion(n); }));
var replacement = ts.isAsExpression(assertion)
- ? ts.createAsExpression(assertion.expression, ts.createKeywordTypeNode(143 /* UnknownKeyword */))
- : ts.createTypeAssertion(ts.createKeywordTypeNode(143 /* UnknownKeyword */), assertion.expression);
+ ? ts.createAsExpression(assertion.expression, ts.createKeywordTypeNode(144 /* UnknownKeyword */))
+ : ts.createTypeAssertion(ts.createKeywordTypeNode(144 /* UnknownKeyword */), assertion.expression);
changeTracker.replaceNode(sourceFile, assertion.expression, replacement);
}
})(codefix = ts.codefix || (ts.codefix = {}));
@@ -111728,11 +112953,11 @@
function makeChange(changeTracker, sourceFile, pos) {
var token = ts.getTokenAtPosition(sourceFile, pos);
if (!ts.isIdentifier(token)) {
- return ts.Debug.fail("add-name-to-nameless-parameter operates on identifiers, but got a " + ts.formatSyntaxKind(token.kind));
+ return ts.Debug.fail("add-name-to-nameless-parameter operates on identifiers, but got a " + ts.Debug.formatSyntaxKind(token.kind));
}
var param = token.parent;
if (!ts.isParameter(param)) {
- return ts.Debug.fail("Tried to add a parameter name to a non-parameter: " + ts.formatSyntaxKind(token.kind));
+ return ts.Debug.fail("Tried to add a parameter name to a non-parameter: " + ts.Debug.formatSyntaxKind(token.kind));
}
var i = param.parent.parameters.indexOf(param);
ts.Debug.assert(!param.type, "Tried to add a parameter name to a parameter that already had one.");
@@ -111814,26 +113039,26 @@
}
function isDeclarationWithType(node) {
return ts.isFunctionLikeDeclaration(node) ||
- node.kind === 237 /* VariableDeclaration */ ||
- node.kind === 153 /* PropertySignature */ ||
- node.kind === 154 /* PropertyDeclaration */;
+ node.kind === 238 /* VariableDeclaration */ ||
+ node.kind === 154 /* PropertySignature */ ||
+ node.kind === 155 /* PropertyDeclaration */;
}
function transformJSDocType(node) {
switch (node.kind) {
- case 289 /* JSDocAllType */:
- case 290 /* JSDocUnknownType */:
+ case 290 /* JSDocAllType */:
+ case 291 /* JSDocUnknownType */:
return ts.createTypeReferenceNode("any", ts.emptyArray);
- case 293 /* JSDocOptionalType */:
+ case 294 /* JSDocOptionalType */:
return transformJSDocOptionalType(node);
- case 292 /* JSDocNonNullableType */:
+ case 293 /* JSDocNonNullableType */:
return transformJSDocType(node.type);
- case 291 /* JSDocNullableType */:
+ case 292 /* JSDocNullableType */:
return transformJSDocNullableType(node);
- case 295 /* JSDocVariadicType */:
+ case 296 /* JSDocVariadicType */:
return transformJSDocVariadicType(node);
- case 294 /* JSDocFunctionType */:
+ case 295 /* JSDocFunctionType */:
return transformJSDocFunctionType(node);
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return transformJSDocTypeReference(node);
default:
var visited = ts.visitEachChild(node, transformJSDocType, /*context*/ undefined); // TODO: GH#18217
@@ -111855,7 +113080,7 @@
}
function transformJSDocParameter(node) {
var index = node.parent.parameters.indexOf(node);
- var isRest = node.type.kind === 295 /* JSDocVariadicType */ && index === node.parent.parameters.length - 1; // TODO: GH#18217
+ var isRest = node.type.kind === 296 /* JSDocVariadicType */ && index === node.parent.parameters.length - 1; // TODO: GH#18217
var name = node.name || (isRest ? "rest" : "arg" + index);
var dotdotdot = isRest ? ts.createToken(25 /* DotDotDotToken */) : node.dotDotDotToken;
return ts.createParameter(node.decorators, node.modifiers, dotdotdot, name, node.questionToken, ts.visitNode(node.type, transformJSDocType), node.initializer);
@@ -111895,8 +113120,8 @@
var index = ts.createParameter(
/*decorators*/ undefined,
/*modifiers*/ undefined,
- /*dotDotDotToken*/ undefined, node.typeArguments[0].kind === 135 /* NumberKeyword */ ? "n" : "s",
- /*questionToken*/ undefined, ts.createTypeReferenceNode(node.typeArguments[0].kind === 135 /* NumberKeyword */ ? "number" : "string", []),
+ /*dotDotDotToken*/ undefined, node.typeArguments[0].kind === 136 /* NumberKeyword */ ? "n" : "s",
+ /*questionToken*/ undefined, ts.createTypeReferenceNode(node.typeArguments[0].kind === 136 /* NumberKeyword */ ? "number" : "string", []),
/*initializer*/ undefined);
var indexSignature = ts.createTypeLiteralNode([ts.createIndexSignature(/*decorators*/ undefined, /*modifiers*/ undefined, [index], node.typeArguments[1])]);
ts.setEmitFlags(indexSignature, 1 /* SingleLine */);
@@ -111996,7 +113221,7 @@
return errorCode;
}
function doChange(changes, sourceFile, token, errorCode, program, cancellationToken, markSeen, host) {
- if (!ts.isParameterPropertyModifier(token.kind) && token.kind !== 72 /* Identifier */ && token.kind !== 25 /* DotDotDotToken */ && token.kind !== 100 /* ThisKeyword */) {
+ if (!ts.isParameterPropertyModifier(token.kind) && token.kind !== 73 /* Identifier */ && token.kind !== 25 /* DotDotDotToken */ && token.kind !== 101 /* ThisKeyword */) {
return undefined;
}
var parent = token.parent;
@@ -112117,7 +113342,7 @@
function annotate(changes, sourceFile, declaration, type, program, host) {
var typeNode = ts.getTypeNodeIfAccessible(type, declaration, program, host);
if (typeNode) {
- if (ts.isInJSFile(sourceFile) && declaration.kind !== 153 /* PropertySignature */) {
+ if (ts.isInJSFile(sourceFile) && declaration.kind !== 154 /* PropertySignature */) {
var parent = ts.isVariableDeclaration(declaration) ? ts.tryCast(declaration.parent.parent, ts.isVariableStatement) : declaration;
if (!parent) {
return;
@@ -112158,13 +113383,13 @@
return !!merged;
}); });
var tag = ts.createJSDocComment(comments.join("\n"), ts.createNodeArray((oldTags || ts.emptyArray).concat(unmergedNewTags)));
- var jsDocNode = parent.kind === 197 /* ArrowFunction */ ? getJsDocNodeForArrowFunction(parent) : parent;
+ var jsDocNode = parent.kind === 198 /* ArrowFunction */ ? getJsDocNodeForArrowFunction(parent) : parent;
jsDocNode.jsDoc = parent.jsDoc;
jsDocNode.jsDocCache = parent.jsDocCache;
changes.insertJsdocCommentBefore(sourceFile, jsDocNode, tag);
}
function getJsDocNodeForArrowFunction(signature) {
- if (signature.parent.kind === 154 /* PropertyDeclaration */) {
+ if (signature.parent.kind === 155 /* PropertyDeclaration */) {
return signature.parent;
}
return signature.parent.parent;
@@ -112174,14 +113399,14 @@
return undefined;
}
switch (oldTag.kind) {
- case 304 /* JSDocParameterTag */: {
+ case 305 /* JSDocParameterTag */: {
var oldParam = oldTag;
var newParam = newTag;
return ts.isIdentifier(oldParam.name) && ts.isIdentifier(newParam.name) && oldParam.name.escapedText === newParam.name.escapedText
? ts.createJSDocParamTag(newParam.name, newParam.isBracketed, newParam.typeExpression, oldParam.comment)
: undefined;
}
- case 305 /* JSDocReturnTag */:
+ case 306 /* JSDocReturnTag */:
return ts.createJSDocReturnTag(newTag.typeExpression, oldTag.comment);
}
}
@@ -112200,18 +113425,18 @@
function inferTypeForParametersFromUsage(containingFunction, sourceFile, program, cancellationToken) {
var searchToken;
switch (containingFunction.kind) {
- case 157 /* Constructor */:
- searchToken = ts.findChildOfKind(containingFunction, 124 /* ConstructorKeyword */, sourceFile);
+ case 158 /* Constructor */:
+ searchToken = ts.findChildOfKind(containingFunction, 125 /* ConstructorKeyword */, sourceFile);
break;
- case 197 /* ArrowFunction */:
- case 196 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
var parent = containingFunction.parent;
searchToken = ts.isVariableDeclaration(parent) && ts.isIdentifier(parent.name) ?
parent.name :
containingFunction.name;
break;
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 157 /* MethodDeclaration */:
searchToken = containingFunction.name;
break;
}
@@ -112283,21 +113508,21 @@
node = node.parent;
}
switch (node.parent.kind) {
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
usageContext.isNumber = true;
break;
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
inferTypeFromPrefixUnaryExpressionContext(node.parent, usageContext);
break;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
inferTypeFromBinaryExpressionContext(node, node.parent, checker, usageContext);
break;
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
inferTypeFromSwitchStatementLabelContext(node.parent, checker, usageContext);
break;
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
if (node.parent.expression === node) {
inferTypeFromCallExpressionContext(node.parent, checker, usageContext);
}
@@ -112305,13 +113530,13 @@
inferTypeFromContextualType(node, checker, usageContext);
}
break;
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
inferTypeFromPropertyAccessExpressionContext(node.parent, checker, usageContext);
break;
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
inferTypeFromPropertyElementExpressionContext(node.parent, node, checker, usageContext);
break;
- case 237 /* VariableDeclaration */: {
+ case 238 /* VariableDeclaration */: {
var _a = node.parent, name = _a.name, initializer = _a.initializer;
if (node === name) {
if (initializer) { // This can happen for `let x = null;` which still has an implicit-any error.
@@ -112362,17 +113587,17 @@
case 50 /* BarToken */:
case 51 /* CaretToken */:
// CompoundAssignmentOperator
- case 61 /* MinusEqualsToken */:
- case 63 /* AsteriskAsteriskEqualsToken */:
- case 62 /* AsteriskEqualsToken */:
- case 64 /* SlashEqualsToken */:
- case 65 /* PercentEqualsToken */:
- case 69 /* AmpersandEqualsToken */:
- case 70 /* BarEqualsToken */:
- case 71 /* CaretEqualsToken */:
- case 66 /* LessThanLessThanEqualsToken */:
- case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
- case 67 /* GreaterThanGreaterThanEqualsToken */:
+ case 62 /* MinusEqualsToken */:
+ case 64 /* AsteriskAsteriskEqualsToken */:
+ case 63 /* AsteriskEqualsToken */:
+ case 65 /* SlashEqualsToken */:
+ case 66 /* PercentEqualsToken */:
+ case 70 /* AmpersandEqualsToken */:
+ case 71 /* BarEqualsToken */:
+ case 72 /* CaretEqualsToken */:
+ case 67 /* LessThanLessThanEqualsToken */:
+ case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
+ case 68 /* GreaterThanGreaterThanEqualsToken */:
// AdditiveOperator
case 39 /* MinusToken */:
// RelationalOperator
@@ -112388,7 +113613,7 @@
usageContext.isNumber = true;
}
break;
- case 60 /* PlusEqualsToken */:
+ case 61 /* PlusEqualsToken */:
case 38 /* PlusToken */:
var otherOperandType = checker.getTypeAtLocation(parent.left === node ? parent.right : parent.left);
if (otherOperandType.flags & 1056 /* EnumLike */) {
@@ -112405,14 +113630,14 @@
}
break;
// AssignmentOperators
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
case 33 /* EqualsEqualsToken */:
case 35 /* EqualsEqualsEqualsToken */:
case 36 /* ExclamationEqualsEqualsToken */:
case 34 /* ExclamationEqualsToken */:
addCandidateType(usageContext, checker.getTypeAtLocation(parent.left === node ? parent.right : parent.left));
break;
- case 93 /* InKeyword */:
+ case 94 /* InKeyword */:
if (node === parent.left) {
usageContext.isString = true;
}
@@ -112420,7 +113645,7 @@
// LogicalOperator
case 55 /* BarBarToken */:
if (node === parent.left &&
- (node.parent.parent.kind === 237 /* VariableDeclaration */ || ts.isAssignmentExpression(node.parent.parent, /*excludeCompoundAssignment*/ true))) {
+ (node.parent.parent.kind === 238 /* VariableDeclaration */ || ts.isAssignmentExpression(node.parent.parent, /*excludeCompoundAssignment*/ true))) {
// var x = x || {};
// TODO: use getFalsyflagsOfType
addCandidateType(usageContext, checker.getTypeAtLocation(parent.right));
@@ -112428,7 +113653,7 @@
break;
case 54 /* AmpersandAmpersandToken */:
case 27 /* CommaToken */:
- case 94 /* InstanceOfKeyword */:
+ case 95 /* InstanceOfKeyword */:
// nothing to infer here
break;
}
@@ -112448,7 +113673,7 @@
}
}
inferTypeFromContext(parent, checker, callContext.returnType);
- if (parent.kind === 191 /* CallExpression */) {
+ if (parent.kind === 192 /* CallExpression */) {
(usageContext.callContexts || (usageContext.callContexts = [])).push(callContext);
}
else {
@@ -112688,12 +113913,12 @@
var precedingNode;
var newClassDeclaration;
switch (ctorDeclaration.kind) {
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
precedingNode = ctorDeclaration;
changes.delete(sourceFile, ctorDeclaration);
newClassDeclaration = createClassFromFunctionDeclaration(ctorDeclaration);
break;
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
precedingNode = ctorDeclaration.parent.parent;
newClassDeclaration = createClassFromVariableDeclaration(ctorDeclaration);
if (ctorDeclaration.parent.declarations.length === 1) {
@@ -112725,7 +113950,7 @@
// all static members are stored in the "exports" array of symbol
if (symbol.exports) {
symbol.exports.forEach(function (member) {
- var memberElement = createClassElement(member, [ts.createToken(116 /* StaticKeyword */)]);
+ var memberElement = createClassElement(member, [ts.createToken(117 /* StaticKeyword */)]);
if (memberElement) {
memberElements.push(memberElement);
}
@@ -112748,7 +113973,7 @@
return;
}
// delete the entire statement if this expression is the sole expression to take care of the semicolon at the end
- var nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 221 /* ExpressionStatement */
+ var nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 222 /* ExpressionStatement */
? assignmentBinaryExpression.parent : assignmentBinaryExpression;
changes.delete(sourceFile, nodeToDelete);
if (!assignmentBinaryExpression.right) {
@@ -112756,27 +113981,27 @@
/*type*/ undefined, /*initializer*/ undefined);
}
switch (assignmentBinaryExpression.right.kind) {
- case 196 /* FunctionExpression */: {
+ case 197 /* FunctionExpression */: {
var functionExpression = assignmentBinaryExpression.right;
- var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(functionExpression, 121 /* AsyncKeyword */));
+ var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(functionExpression, 122 /* AsyncKeyword */));
var method = ts.createMethod(/*decorators*/ undefined, fullModifiers, /*asteriskToken*/ undefined, memberDeclaration.name, /*questionToken*/ undefined,
/*typeParameters*/ undefined, functionExpression.parameters, /*type*/ undefined, functionExpression.body);
ts.copyLeadingComments(assignmentBinaryExpression, method, sourceFile);
return method;
}
- case 197 /* ArrowFunction */: {
+ case 198 /* ArrowFunction */: {
var arrowFunction = assignmentBinaryExpression.right;
var arrowFunctionBody = arrowFunction.body;
var bodyBlock = void 0;
// case 1: () => { return [1,2,3] }
- if (arrowFunctionBody.kind === 218 /* Block */) {
+ if (arrowFunctionBody.kind === 219 /* Block */) {
bodyBlock = arrowFunctionBody;
}
// case 2: () => [1,2,3]
else {
bodyBlock = ts.createBlock([ts.createReturn(arrowFunctionBody)]);
}
- var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(arrowFunction, 121 /* AsyncKeyword */));
+ var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(arrowFunction, 122 /* AsyncKeyword */));
var method = ts.createMethod(/*decorators*/ undefined, fullModifiers, /*asteriskToken*/ undefined, memberDeclaration.name, /*questionToken*/ undefined,
/*typeParameters*/ undefined, arrowFunction.parameters, /*type*/ undefined, bodyBlock);
ts.copyLeadingComments(assignmentBinaryExpression, method, sourceFile);
@@ -112797,17 +114022,17 @@
}
function createClassFromVariableDeclaration(node) {
var initializer = node.initializer;
- if (!initializer || initializer.kind !== 196 /* FunctionExpression */) {
+ if (!initializer || initializer.kind !== 197 /* FunctionExpression */) {
return undefined;
}
- if (node.name.kind !== 72 /* Identifier */) {
+ if (node.name.kind !== 73 /* Identifier */) {
return undefined;
}
var memberElements = createClassElementsFromSymbol(node.symbol);
if (initializer.body) {
memberElements.unshift(ts.createConstructor(/*decorators*/ undefined, /*modifiers*/ undefined, initializer.parameters, initializer.body));
}
- var modifiers = getModifierKindFromSource(precedingNode, 85 /* ExportKeyword */);
+ var modifiers = getModifierKindFromSource(precedingNode, 86 /* ExportKeyword */);
var cls = ts.createClassDeclaration(/*decorators*/ undefined, modifiers, node.name,
/*typeParameters*/ undefined, /*heritageClauses*/ undefined, memberElements);
// Don't call copyComments here because we'll already leave them in place
@@ -112818,7 +114043,7 @@
if (node.body) {
memberElements.unshift(ts.createConstructor(/*decorators*/ undefined, /*modifiers*/ undefined, node.parameters, node.body));
}
- var modifiers = getModifierKindFromSource(node, 85 /* ExportKeyword */);
+ var modifiers = getModifierKindFromSource(node, 86 /* ExportKeyword */);
var cls = ts.createClassDeclaration(/*decorators*/ undefined, modifiers, node.name,
/*typeParameters*/ undefined, /*heritageClauses*/ undefined, memberElements);
// Don't call copyComments here because we'll already leave them in place
@@ -112848,6 +114073,11 @@
fixIds: [fixId],
getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, err) { return convertToAsyncFunction(changes, err.file, err.start, context.program.getTypeChecker(), context); }); },
});
+ var SynthBindingNameKind;
+ (function (SynthBindingNameKind) {
+ SynthBindingNameKind[SynthBindingNameKind["Identifier"] = 0] = "Identifier";
+ SynthBindingNameKind[SynthBindingNameKind["BindingPattern"] = 1] = "BindingPattern";
+ })(SynthBindingNameKind || (SynthBindingNameKind = {}));
function convertToAsyncFunction(changes, sourceFile, position, checker, context) {
// get the function declaration - returns a promise
var tokenAtPosition = ts.getTokenAtPosition(sourceFile, position);
@@ -112876,7 +114106,7 @@
return;
}
// add the async keyword
- changes.insertLastModifierBefore(sourceFile, 121 /* AsyncKeyword */, functionToConvert);
+ changes.insertLastModifierBefore(sourceFile, 122 /* AsyncKeyword */, functionToConvert);
function startTransformation(node, nodeToReplace) {
var newNodes = transformExpression(node, transformer, node);
changes.replaceNodeWithNodes(sourceFile, nodeToReplace, newNodes);
@@ -112984,8 +114214,8 @@
allVarNames.push({ identifier: synthName.identifier, symbol: symbol });
addNameToFrequencyMap(collidingSymbolMap, ident.text, symbol);
}
- // we only care about identifiers that are parameters and declarations (don't care about other uses)
- else if (node.parent && (ts.isParameter(node.parent) || ts.isVariableDeclaration(node.parent))) {
+ // we only care about identifiers that are parameters, declarations, or binding elements (don't care about other uses)
+ else if (node.parent && (ts.isParameter(node.parent) || ts.isVariableDeclaration(node.parent) || ts.isBindingElement(node.parent))) {
var originalName = node.text;
var collidingSymbols = collidingSymbolMap.get(originalName);
// if the identifier name conflicts with a different identifier that we've already seen
@@ -112999,7 +114229,7 @@
else {
var identifier = ts.getSynthesizedDeepClone(node);
identsToRenameMap.set(symbolIdString, identifier);
- synthNamesMap.set(symbolIdString, { identifier: identifier, types: [], numberOfAssignmentsOriginal: allVarNames.filter(function (elem) { return elem.identifier.text === node.text; }).length /*, numberOfAssignmentsSynthesized: 0*/ });
+ synthNamesMap.set(symbolIdString, createSynthIdentifier(identifier, [], allVarNames.filter(function (elem) { return elem.identifier.text === node.text; }).length /*, numberOfAssignmentsSynthesized: 0*/));
if ((ts.isParameter(node.parent) && isExpressionOrCallOnTypePromise(node.parent.parent)) || ts.isVariableDeclaration(node.parent)) {
allVarNames.push({ identifier: identifier, symbol: symbol });
addNameToFrequencyMap(collidingSymbolMap, originalName, symbol);
@@ -113047,7 +114277,7 @@
var numVarsSameName = (originalNames.get(name.text) || ts.emptyArray).length;
var numberOfAssignmentsOriginal = 0;
var identifier = numVarsSameName === 0 ? name : ts.createIdentifier(name.text + "_" + numVarsSameName);
- return { identifier: identifier, types: [], numberOfAssignmentsOriginal: numberOfAssignmentsOriginal };
+ return createSynthIdentifier(identifier, [], numberOfAssignmentsOriginal);
}
// dispatch function to recursively build the refactoring
// should be kept up to date with isFixablePromiseHandler in suggestionDiagnostics.ts
@@ -113074,68 +114304,90 @@
}
function transformCatch(node, transformer, prevArgName) {
var func = node.arguments[0];
- var argName = getArgName(func, transformer);
+ var argName = getArgBindingName(func, transformer);
var shouldReturn = transformer.setOfExpressionsToReturn.get(ts.getNodeId(node).toString());
+ var possibleNameForVarDecl;
/*
If there is another call in the chain after the .catch() we are transforming, we will need to save the result of both paths (try block and catch block)
To do this, we will need to synthesize a variable that we were not aware of while we were adding identifiers to the synthNamesMap
We will use the prevArgName and then update the synthNamesMap with a new variable name for the next transformation step
*/
if (prevArgName && !shouldReturn) {
- prevArgName.numberOfAssignmentsOriginal = 2; // Try block and catch block
+ if (isSynthIdentifier(prevArgName)) {
+ possibleNameForVarDecl = prevArgName;
transformer.synthNamesMap.forEach(function (val, key) {
if (val.identifier.text === prevArgName.identifier.text) {
var newSynthName = createUniqueSynthName(prevArgName);
transformer.synthNamesMap.set(key, newSynthName);
}
});
+ }
+ else {
+ possibleNameForVarDecl = createSynthIdentifier(ts.createOptimisticUniqueName("result"), prevArgName.types);
+ }
+ possibleNameForVarDecl.numberOfAssignmentsOriginal = 2; // Try block and catch block
// update the constIdentifiers list
- if (transformer.constIdentifiers.some(function (elem) { return elem.text === prevArgName.identifier.text; })) {
- transformer.constIdentifiers.push(createUniqueSynthName(prevArgName).identifier);
+ if (transformer.constIdentifiers.some(function (elem) { return elem.text === possibleNameForVarDecl.identifier.text; })) {
+ transformer.constIdentifiers.push(createUniqueSynthName(possibleNameForVarDecl).identifier);
}
}
- var tryBlock = ts.createBlock(transformExpression(node.expression, transformer, node, prevArgName));
- var transformationBody = getTransformationBody(func, prevArgName, argName, node, transformer);
- var catchArg = argName ? argName.identifier.text : "e";
- var catchClause = ts.createCatchClause(catchArg, ts.createBlock(transformationBody));
+ var tryBlock = ts.createBlock(transformExpression(node.expression, transformer, node, possibleNameForVarDecl));
+ var transformationBody = getTransformationBody(func, possibleNameForVarDecl, argName, node, transformer);
+ var catchArg = argName ? isSynthIdentifier(argName) ? argName.identifier.text : argName.bindingPattern : "e";
+ var catchVariableDeclaration = ts.createVariableDeclaration(catchArg);
+ var catchClause = ts.createCatchClause(catchVariableDeclaration, ts.createBlock(transformationBody));
/*
In order to avoid an implicit any, we will synthesize a type for the declaration using the unions of the types of both paths (try block and catch block)
*/
var varDeclList;
- if (prevArgName && !shouldReturn) {
- var typeArray = prevArgName.types;
+ var varDeclIdentifier;
+ if (possibleNameForVarDecl && !shouldReturn) {
+ varDeclIdentifier = ts.getSynthesizedDeepClone(possibleNameForVarDecl.identifier);
+ var typeArray = possibleNameForVarDecl.types;
var unionType = transformer.checker.getUnionType(typeArray, 2 /* Subtype */);
var unionTypeNode = transformer.isInJSFile ? undefined : transformer.checker.typeToTypeNode(unionType);
- var varDecl = [ts.createVariableDeclaration(ts.getSynthesizedDeepClone(prevArgName.identifier), unionTypeNode)];
+ var varDecl = [ts.createVariableDeclaration(varDeclIdentifier, unionTypeNode)];
varDeclList = ts.createVariableStatement(/*modifiers*/ undefined, ts.createVariableDeclarationList(varDecl, 1 /* Let */));
}
var tryStatement = ts.createTry(tryBlock, catchClause, /*finallyBlock*/ undefined);
- return varDeclList ? [varDeclList, tryStatement] : [tryStatement];
+ var destructuredResult = prevArgName && varDeclIdentifier && isSynthBindingPattern(prevArgName)
+ && ts.createVariableStatement(/* modifiers */ undefined, ts.createVariableDeclarationList([ts.createVariableDeclaration(ts.getSynthesizedDeepCloneWithRenames(prevArgName.bindingPattern), /* type */ undefined, varDeclIdentifier)], 2 /* Const */));
+ return ts.compact([varDeclList, tryStatement, destructuredResult]);
+ }
+ function getIdentifierTextsFromBindingName(bindingName) {
+ if (ts.isIdentifier(bindingName))
+ return [bindingName.text];
+ return ts.flatMap(bindingName.elements, function (element) {
+ if (ts.isOmittedExpression(element))
+ return [];
+ return getIdentifierTextsFromBindingName(element.name);
+ });
}
function createUniqueSynthName(prevArgName) {
var renamedPrevArg = ts.createOptimisticUniqueName(prevArgName.identifier.text);
- var newSynthName = { identifier: renamedPrevArg, types: [], numberOfAssignmentsOriginal: 0 };
- return newSynthName;
+ return createSynthIdentifier(renamedPrevArg);
}
function transformThen(node, transformer, outermostParent, prevArgName) {
var _a = node.arguments, res = _a[0], rej = _a[1];
if (!res) {
return transformExpression(node.expression, transformer, outermostParent);
}
- var argNameRes = getArgName(res, transformer);
+ var argNameRes = getArgBindingName(res, transformer);
var transformationBody = getTransformationBody(res, prevArgName, argNameRes, node, transformer);
if (rej) {
- var argNameRej = getArgName(rej, transformer);
+ var argNameRej = getArgBindingName(rej, transformer);
var tryBlock = ts.createBlock(transformExpression(node.expression, transformer, node, argNameRes).concat(transformationBody));
var transformationBody2 = getTransformationBody(rej, prevArgName, argNameRej, node, transformer);
- var catchArg = argNameRej ? argNameRej.identifier.text : "e";
- var catchClause = ts.createCatchClause(catchArg, ts.createBlock(transformationBody2));
+ var catchArg = argNameRej ? isSynthIdentifier(argNameRej) ? argNameRej.identifier.text : argNameRej.bindingPattern : "e";
+ var catchVariableDeclaration = ts.createVariableDeclaration(catchArg);
+ var catchClause = ts.createCatchClause(catchVariableDeclaration, ts.createBlock(transformationBody2));
return [ts.createTry(tryBlock, catchClause, /* finallyBlock */ undefined)];
}
return transformExpression(node.expression, transformer, node, argNameRes).concat(transformationBody);
}
- function getFlagOfIdentifier(node, constIdentifiers) {
- var inArr = constIdentifiers.some(function (elem) { return elem.text === node.text; });
+ function getFlagOfBindingName(bindingName, constIdentifiers) {
+ var identifiers = getIdentifierTextsFromBindingName(getNode(bindingName));
+ var inArr = constIdentifiers.some(function (elem) { return ts.contains(identifiers, elem.text); });
return inArr ? 2 /* Const */ : 1 /* Let */;
}
function transformPromiseCall(node, transformer, prevArgName) {
@@ -113151,29 +114403,29 @@
return [ts.createReturn(ts.getSynthesizedDeepClone(node))];
}
function createTransformedStatement(prevArgName, rightHandSide, transformer) {
- if (!prevArgName || prevArgName.identifier.text.length === 0) {
+ if (!prevArgName || isEmpty(prevArgName)) {
// if there's no argName to assign to, there still might be side effects
return [ts.createStatement(rightHandSide)];
}
- if (prevArgName.types.length < prevArgName.numberOfAssignmentsOriginal) {
+ if (isSynthIdentifier(prevArgName) && prevArgName.types.length < prevArgName.numberOfAssignmentsOriginal) {
// if the variable has already been declared, we don't need "let" or "const"
return [ts.createStatement(ts.createAssignment(ts.getSynthesizedDeepClone(prevArgName.identifier), rightHandSide))];
}
- return [ts.createVariableStatement(/*modifiers*/ undefined, (ts.createVariableDeclarationList([ts.createVariableDeclaration(ts.getSynthesizedDeepClone(prevArgName.identifier), /*type*/ undefined, rightHandSide)], getFlagOfIdentifier(prevArgName.identifier, transformer.constIdentifiers))))];
+ return [ts.createVariableStatement(/*modifiers*/ undefined, (ts.createVariableDeclarationList([ts.createVariableDeclaration(ts.getSynthesizedDeepClone(getNode(prevArgName)), /*type*/ undefined, rightHandSide)], getFlagOfBindingName(prevArgName, transformer.constIdentifiers))))];
}
// should be kept up to date with isFixablePromiseArgument in suggestionDiagnostics.ts
function getTransformationBody(func, prevArgName, argName, parent, transformer) {
var shouldReturn = transformer.setOfExpressionsToReturn.get(ts.getNodeId(parent).toString());
switch (func.kind) {
- case 96 /* NullKeyword */:
+ case 97 /* NullKeyword */:
// do not produce a transformed statement for a null argument
break;
- case 72 /* Identifier */: // identifier includes undefined
+ case 73 /* Identifier */: // identifier includes undefined
if (!argName) {
// undefined was argument passed to promise handler
break;
}
- var synthCall = ts.createCall(ts.getSynthesizedDeepClone(func), /*typeArguments*/ undefined, [argName.identifier]);
+ var synthCall = ts.createCall(ts.getSynthesizedDeepClone(func), /*typeArguments*/ undefined, isSynthIdentifier(argName) ? [argName.identifier] : []);
if (shouldReturn) {
return [ts.createReturn(synthCall)];
}
@@ -113190,8 +114442,8 @@
prevArgName.types.push(returnType);
}
return varDeclOrAssignment;
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */: {
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */: {
var funcBody = func.body;
// Arrow functions with block bodies { } will enter this control flow
if (ts.isBlock(funcBody)) {
@@ -113210,7 +114462,7 @@
}
}
return shouldReturn ? refactoredStmts.map(function (s) { return ts.getSynthesizedDeepClone(s); }) :
- removeReturns(refactoredStmts, prevArgName === undefined ? undefined : prevArgName.identifier, transformer, seenReturnStatement);
+ removeReturns(refactoredStmts, prevArgName, transformer, seenReturnStatement);
}
else {
var innerRetStmts = ts.isFixablePromiseHandler(funcBody) ? [ts.createReturn(funcBody)] : ts.emptyArray;
@@ -113256,7 +114508,7 @@
ret.push(ts.createExpressionStatement(possiblyAwaitedExpression));
}
else {
- ret.push(ts.createVariableStatement(/*modifiers*/ undefined, (ts.createVariableDeclarationList([ts.createVariableDeclaration(prevArgName, /*type*/ undefined, possiblyAwaitedExpression)], getFlagOfIdentifier(prevArgName, transformer.constIdentifiers)))));
+ ret.push(ts.createVariableStatement(/*modifiers*/ undefined, (ts.createVariableDeclarationList([ts.createVariableDeclaration(getNode(prevArgName), /*type*/ undefined, possiblyAwaitedExpression)], getFlagOfBindingName(prevArgName, transformer.constIdentifiers)))));
}
}
}
@@ -113266,7 +114518,7 @@
}
// if block has no return statement, need to define prevArgName as undefined to prevent undeclared variables
if (!seenReturnStatement && prevArgName !== undefined) {
- ret.push(ts.createVariableStatement(/*modifiers*/ undefined, (ts.createVariableDeclarationList([ts.createVariableDeclaration(prevArgName, /*type*/ undefined, ts.createIdentifier("undefined"))], getFlagOfIdentifier(prevArgName, transformer.constIdentifiers)))));
+ ret.push(ts.createVariableStatement(/*modifiers*/ undefined, (ts.createVariableDeclarationList([ts.createVariableDeclaration(getNode(prevArgName), /*type*/ undefined, ts.createIdentifier("undefined"))], getFlagOfBindingName(prevArgName, transformer.constIdentifiers)))));
}
return ret;
}
@@ -113289,32 +114541,42 @@
}
return innerCbBody;
}
- function getArgName(funcNode, transformer) {
+ function getArgBindingName(funcNode, transformer) {
var numberOfAssignmentsOriginal = 0;
var types = [];
var name;
if (ts.isFunctionLikeDeclaration(funcNode)) {
if (funcNode.parameters.length > 0) {
var param = funcNode.parameters[0].name;
- name = getMapEntryOrDefault(param);
+ name = getMappedBindingNameOrDefault(param);
}
}
else if (ts.isIdentifier(funcNode)) {
name = getMapEntryOrDefault(funcNode);
}
// return undefined argName when arg is null or undefined
- if (!name || name.identifier.text === "undefined") {
+ if (!name || "identifier" in name && name.identifier.text === "undefined") {
return undefined;
}
return name;
+ function getMappedBindingNameOrDefault(bindingName) {
+ if (ts.isIdentifier(bindingName))
+ return getMapEntryOrDefault(bindingName);
+ var elements = ts.flatMap(bindingName.elements, function (element) {
+ if (ts.isOmittedExpression(element))
+ return [];
+ return [getMappedBindingNameOrDefault(element.name)];
+ });
+ return createSynthBindingPattern(bindingName, elements);
+ }
function getMapEntryOrDefault(identifier) {
var originalNode = getOriginalNode(identifier);
var symbol = getSymbol(originalNode);
if (!symbol) {
- return { identifier: identifier, types: types, numberOfAssignmentsOriginal: numberOfAssignmentsOriginal };
+ return createSynthIdentifier(identifier, types, numberOfAssignmentsOriginal);
}
var mapEntry = transformer.synthNamesMap.get(ts.getSymbolId(symbol).toString());
- return mapEntry || { identifier: identifier, types: types, numberOfAssignmentsOriginal: numberOfAssignmentsOriginal };
+ return mapEntry || createSynthIdentifier(identifier, types, numberOfAssignmentsOriginal);
}
function getSymbol(node) {
return node.symbol ? node.symbol : transformer.checker.getSymbolAtLocation(node);
@@ -113323,6 +114585,34 @@
return node.original ? node.original : node;
}
}
+ function isEmpty(bindingName) {
+ if (!bindingName) {
+ return true;
+ }
+ if (isSynthIdentifier(bindingName)) {
+ return !bindingName.identifier.text;
+ }
+ return ts.every(bindingName.elements, isEmpty);
+ }
+ function getNode(bindingName) {
+ return isSynthIdentifier(bindingName) ? bindingName.identifier : bindingName.bindingPattern;
+ }
+ function createSynthIdentifier(identifier, types, numberOfAssignmentsOriginal) {
+ if (types === void 0) { types = []; }
+ if (numberOfAssignmentsOriginal === void 0) { numberOfAssignmentsOriginal = 0; }
+ return { kind: 0 /* Identifier */, identifier: identifier, types: types, numberOfAssignmentsOriginal: numberOfAssignmentsOriginal };
+ }
+ function createSynthBindingPattern(bindingPattern, elements, types) {
+ if (elements === void 0) { elements = ts.emptyArray; }
+ if (types === void 0) { types = []; }
+ return { kind: 1 /* BindingPattern */, bindingPattern: bindingPattern, elements: elements, types: types };
+ }
+ function isSynthIdentifier(bindingName) {
+ return bindingName.kind === 0 /* Identifier */;
+ }
+ function isSynthBindingPattern(bindingName) {
+ return bindingName.kind === 1 /* BindingPattern */;
+ }
})(codefix = ts.codefix || (ts.codefix = {}));
})(ts || (ts = {}));
/* @internal */
@@ -113356,10 +114646,10 @@
}
var importNode = ts.importFromModuleSpecifier(moduleSpecifier);
switch (importNode.kind) {
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
changes.replaceNode(importingFile, importNode, ts.makeImport(importNode.name, /*namedImports*/ undefined, moduleSpecifier, quotePreference));
break;
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
if (ts.isRequireCall(importNode, /*checkArgumentIsStringLiteralLike*/ false)) {
changes.replaceNode(importingFile, importNode, ts.createPropertyAccess(ts.getSynthesizedDeepClone(importNode), "default"));
}
@@ -113405,29 +114695,29 @@
sourceFile.forEachChild(function recur(node) {
if (ts.isPropertyAccessExpression(node) && ts.isExportsOrModuleExportsOrAlias(sourceFile, node.expression)) {
var parent = node.parent;
- cb(node, ts.isBinaryExpression(parent) && parent.left === node && parent.operatorToken.kind === 59 /* EqualsToken */);
+ cb(node, ts.isBinaryExpression(parent) && parent.left === node && parent.operatorToken.kind === 60 /* EqualsToken */);
}
node.forEachChild(recur);
});
}
function convertStatement(sourceFile, statement, checker, changes, identifiers, target, exports, quotePreference) {
switch (statement.kind) {
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
convertVariableStatement(sourceFile, statement, changes, checker, identifiers, target, quotePreference);
return false;
- case 221 /* ExpressionStatement */: {
+ case 222 /* ExpressionStatement */: {
var expression = statement.expression;
switch (expression.kind) {
- case 191 /* CallExpression */: {
+ case 192 /* CallExpression */: {
if (ts.isRequireCall(expression, /*checkArgumentIsStringLiteralLike*/ true)) {
// For side-effecting require() call, just make a side-effecting import.
changes.replaceNode(sourceFile, statement, ts.makeImport(/*name*/ undefined, /*namedImports*/ undefined, expression.arguments[0], quotePreference));
}
return false;
}
- case 204 /* BinaryExpression */: {
+ case 205 /* BinaryExpression */: {
var operatorToken = expression.operatorToken;
- return operatorToken.kind === 59 /* EqualsToken */ && convertAssignment(sourceFile, checker, expression, changes, exports);
+ return operatorToken.kind === 60 /* EqualsToken */ && convertAssignment(sourceFile, checker, expression, changes, exports);
}
}
}
@@ -113467,8 +114757,8 @@
/** Converts `const name = require("moduleSpecifier").propertyName` */
function convertPropertyAccessImport(name, propertyName, moduleSpecifier, identifiers, quotePreference) {
switch (name.kind) {
- case 184 /* ObjectBindingPattern */:
- case 185 /* ArrayBindingPattern */: {
+ case 185 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */: {
// `const [a, b] = require("c").d` --> `import { d } from "c"; const [a, b] = d;`
var tmp = makeUniqueName(propertyName, identifiers);
return [
@@ -113476,7 +114766,7 @@
makeConst(/*modifiers*/ undefined, name, ts.createIdentifier(tmp)),
];
}
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
// `const a = require("b").c` --> `import { c as a } from "./b";
return [makeSingleImport(name.text, propertyName, moduleSpecifier, quotePreference)];
default:
@@ -113519,16 +114809,16 @@
function tryChangeModuleExportsObject(object) {
var statements = ts.mapAllOrFail(object.properties, function (prop) {
switch (prop.kind) {
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
// TODO: Maybe we should handle this? See fourslash test `refactorConvertToEs6Module_export_object_shorthand.ts`.
- case 276 /* ShorthandPropertyAssignment */:
- case 277 /* SpreadAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
+ case 278 /* SpreadAssignment */:
return undefined;
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return !ts.isIdentifier(prop.name) ? undefined : convertExportsDotXEquals_replaceNode(prop.name.text, prop.initializer);
- case 156 /* MethodDeclaration */:
- return !ts.isIdentifier(prop.name) ? undefined : functionExpressionToDeclaration(prop.name.text, [ts.createToken(85 /* ExportKeyword */)], prop);
+ case 157 /* MethodDeclaration */:
+ return !ts.isIdentifier(prop.name) ? undefined : functionExpressionToDeclaration(prop.name.text, [ts.createToken(86 /* ExportKeyword */)], prop);
default:
ts.Debug.assertNever(prop);
}
@@ -113577,7 +114867,7 @@
var name = left.name.text;
if ((ts.isFunctionExpression(right) || ts.isArrowFunction(right) || ts.isClassExpression(right)) && (!right.name || right.name.text === name)) {
// `exports.f = function() {}` -> `export function f() {}` -- Replace `exports.f = ` with `export `, and insert the name after `function`.
- changes.replaceRange(sourceFile, { pos: left.getStart(sourceFile), end: right.getStart(sourceFile) }, ts.createToken(85 /* ExportKeyword */), { suffix: " " });
+ changes.replaceRange(sourceFile, { pos: left.getStart(sourceFile), end: right.getStart(sourceFile) }, ts.createToken(86 /* ExportKeyword */), { suffix: " " });
if (!right.name)
changes.insertName(sourceFile, right, name);
var semi = ts.findChildOfKind(parent, 26 /* SemicolonToken */, sourceFile);
@@ -113586,14 +114876,14 @@
}
else {
// `exports.f = function g() {}` -> `export const f = function g() {}` -- just replace `exports.` with `export const `
- changes.replaceNodeRangeWithNodes(sourceFile, left.expression, ts.findChildOfKind(left, 24 /* DotToken */, sourceFile), [ts.createToken(85 /* ExportKeyword */), ts.createToken(77 /* ConstKeyword */)], { joiner: " ", suffix: " " });
+ changes.replaceNodeRangeWithNodes(sourceFile, left.expression, ts.findChildOfKind(left, 24 /* DotToken */, sourceFile), [ts.createToken(86 /* ExportKeyword */), ts.createToken(78 /* ConstKeyword */)], { joiner: " ", suffix: " " });
}
}
// TODO: GH#22492 this will cause an error if a change has been made inside the body of the node.
function convertExportsDotXEquals_replaceNode(name, exported) {
- var modifiers = [ts.createToken(85 /* ExportKeyword */)];
+ var modifiers = [ts.createToken(86 /* ExportKeyword */)];
switch (exported.kind) {
- case 196 /* FunctionExpression */: {
+ case 197 /* FunctionExpression */: {
var expressionName = exported.name;
if (expressionName && expressionName.text !== name) {
// `exports.f = function g() {}` -> `export const f = function g() {}`
@@ -113601,10 +114891,10 @@
}
}
// falls through
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
// `exports.f = function() {}` --> `export function f() {}`
return functionExpressionToDeclaration(name, modifiers, exported);
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
// `exports.C = class {}` --> `export class C {}`
return classExpressionToDeclaration(name, modifiers, exported);
default:
@@ -113622,7 +114912,7 @@
*/
function convertSingleImport(file, name, moduleSpecifier, changes, checker, identifiers, target, quotePreference) {
switch (name.kind) {
- case 184 /* ObjectBindingPattern */: {
+ case 185 /* ObjectBindingPattern */: {
var importSpecifiers = ts.mapAllOrFail(name.elements, function (e) {
return e.dotDotDotToken || e.initializer || e.propertyName && !ts.isIdentifier(e.propertyName) || !ts.isIdentifier(e.name)
? undefined
@@ -113633,7 +114923,7 @@
}
}
// falls through -- object destructuring has an interesting pattern and must be a variable declaration
- case 185 /* ArrayBindingPattern */: {
+ case 186 /* ArrayBindingPattern */: {
/*
import x from "x";
const [a, b, c] = x;
@@ -113644,7 +114934,7 @@
makeConst(/*modifiers*/ undefined, ts.getSynthesizedDeepClone(name), ts.createIdentifier(tmp)),
];
}
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return convertSingleIdentifierImport(file, name, moduleSpecifier, changes, checker, identifiers, quotePreference);
default:
return ts.Debug.assertNever(name);
@@ -113716,11 +115006,11 @@
function isFreeIdentifier(node) {
var parent = node.parent;
switch (parent.kind) {
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return parent.name !== node;
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return parent.propertyName !== node;
- case 253 /* ImportSpecifier */:
+ case 254 /* ImportSpecifier */:
return parent.propertyName !== node;
default:
return true;
@@ -114059,21 +115349,21 @@
function tryAddToExistingImport(existingImports) {
return ts.firstDefined(existingImports, function (_a) {
var declaration = _a.declaration, importKind = _a.importKind;
- if (declaration.kind !== 249 /* ImportDeclaration */)
+ if (declaration.kind !== 250 /* ImportDeclaration */)
return undefined;
var importClause = declaration.importClause;
if (!importClause)
return undefined;
var name = importClause.name, namedBindings = importClause.namedBindings;
- return importKind === 1 /* Default */ && !name || importKind === 0 /* Named */ && (!namedBindings || namedBindings.kind === 252 /* NamedImports */)
+ return importKind === 1 /* Default */ && !name || importKind === 0 /* Named */ && (!namedBindings || namedBindings.kind === 253 /* NamedImports */)
? { kind: 2 /* AddToExisting */, importClause: importClause, importKind: importKind }
: undefined;
});
}
function getNamespaceImportName(declaration) {
- if (declaration.kind === 249 /* ImportDeclaration */) {
+ if (declaration.kind === 250 /* ImportDeclaration */) {
var namedBindings = declaration.importClause && ts.isImportClause(declaration.importClause) && declaration.importClause.namedBindings;
- return namedBindings && namedBindings.kind === 251 /* NamespaceImport */ ? namedBindings.name : undefined;
+ return namedBindings && namedBindings.kind === 252 /* NamespaceImport */ ? namedBindings.name : undefined;
}
else {
return declaration.name;
@@ -114084,7 +115374,7 @@
// Can't use an es6 import for a type in JS.
return exportedSymbolIsTypeOnly && ts.isSourceFileJS(sourceFile) ? ts.emptyArray : ts.mapDefined(sourceFile.imports, function (moduleSpecifier) {
var i = ts.importFromModuleSpecifier(moduleSpecifier);
- return (i.kind === 249 /* ImportDeclaration */ || i.kind === 248 /* ImportEqualsDeclaration */)
+ return (i.kind === 250 /* ImportDeclaration */ || i.kind === 249 /* ImportEqualsDeclaration */)
&& checker.getSymbolAtLocation(moduleSpecifier) === moduleSymbol ? { declaration: i, importKind: importKind } : undefined;
});
}
@@ -114107,9 +115397,9 @@
}
function newImportInfoFromExistingSpecifier(_a) {
var declaration = _a.declaration, importKind = _a.importKind;
- var expression = declaration.kind === 249 /* ImportDeclaration */
+ var expression = declaration.kind === 250 /* ImportDeclaration */
? declaration.moduleSpecifier
- : declaration.moduleReference.kind === 259 /* ExternalModuleReference */
+ : declaration.moduleReference.kind === 260 /* ExternalModuleReference */
? declaration.moduleReference.expression
: undefined;
return expression && ts.isStringLiteral(expression) ? { kind: 3 /* AddNew */, moduleSpecifier: expression.text, importKind: importKind } : undefined;
@@ -114437,12 +115727,12 @@
var checker = context.program.getTypeChecker();
var suggestion;
if (ts.isPropertyAccessExpression(node.parent) && node.parent.name === node) {
- ts.Debug.assert(node.kind === 72 /* Identifier */);
+ ts.Debug.assert(node.kind === 73 /* Identifier */);
var containingType = checker.getTypeAtLocation(node.parent.expression);
suggestion = checker.getSuggestionForNonexistentProperty(node, containingType);
}
else if (ts.isImportSpecifier(node.parent) && node.parent.name === node) {
- ts.Debug.assert(node.kind === 72 /* Identifier */);
+ ts.Debug.assert(node.kind === 73 /* Identifier */);
var importDeclaration = ts.findAncestor(node, ts.isImportDeclaration);
var resolvedSourceFile = getResolvedSourceFileFromImportDeclaration(sourceFile, context, importDeclaration);
if (resolvedSourceFile && resolvedSourceFile.symbol) {
@@ -114505,7 +115795,7 @@
codefix.registerCodeFix({
errorCodes: errorCodes,
getCodeActions: function (context) {
- var info = getInfo(context.sourceFile, context.span.start, context.program.getTypeChecker());
+ var info = getInfo(context.sourceFile, context.span.start, context.program.getTypeChecker(), context.program);
if (!info)
return undefined;
if (info.kind === 0 /* Enum */) {
@@ -114528,7 +115818,7 @@
var typeDeclToMembers = new ts.NodeMap();
return codefix.createCombinedCodeActions(ts.textChanges.ChangeTracker.with(context, function (changes) {
codefix.eachDiagnostic(context, errorCodes, function (diag) {
- var info = getInfo(diag.file, diag.start, checker);
+ var info = getInfo(diag.file, diag.start, checker, context.program);
if (!info || !ts.addToSeen(seen, ts.getNodeId(info.parentDeclaration) + "#" + info.token.text)) {
return;
}
@@ -114596,7 +115886,7 @@
InfoKind[InfoKind["Enum"] = 0] = "Enum";
InfoKind[InfoKind["ClassOrInterface"] = 1] = "ClassOrInterface";
})(InfoKind || (InfoKind = {}));
- function getInfo(tokenSourceFile, tokenPos, checker) {
+ function getInfo(tokenSourceFile, tokenPos, checker, program) {
// The identifier of the missing property. eg:
// this.missing = 1;
// ^^^^^^^
@@ -114613,7 +115903,7 @@
return undefined;
// Prefer to change the class instead of the interface if they are merged
var classOrInterface = ts.find(symbol.declarations, ts.isClassLike) || ts.find(symbol.declarations, ts.isInterfaceDeclaration);
- if (classOrInterface) {
+ if (classOrInterface && !program.isSourceFileFromExternalLibrary(classOrInterface.getSourceFile())) {
var makeStatic = (leftExpressionType.target || leftExpressionType) !== checker.getDeclaredTypeOfSymbol(symbol);
var declSourceFile = classOrInterface.getSourceFile();
var inJs = ts.isSourceFileJS(declSourceFile);
@@ -114621,7 +115911,7 @@
return { kind: 1 /* ClassOrInterface */, token: token, parentDeclaration: classOrInterface, makeStatic: makeStatic, declSourceFile: declSourceFile, inJs: inJs, call: call };
}
var enumDeclaration = ts.find(symbol.declarations, ts.isEnumDeclaration);
- if (enumDeclaration) {
+ if (enumDeclaration && !program.isSourceFileFromExternalLibrary(enumDeclaration.getSourceFile())) {
return { kind: 0 /* Enum */, token: token, parentDeclaration: enumDeclaration };
}
return undefined;
@@ -114633,7 +115923,7 @@
}
function addMissingMemberInJs(changeTracker, declSourceFile, classDeclaration, tokenName, makeStatic) {
if (makeStatic) {
- if (classDeclaration.kind === 209 /* ClassExpression */) {
+ if (classDeclaration.kind === 210 /* ClassExpression */) {
return;
}
var className = classDeclaration.name.getText();
@@ -114659,7 +115949,7 @@
}
function getTypeNode(checker, classDeclaration, token) {
var typeNode;
- if (token.parent.parent.kind === 204 /* BinaryExpression */) {
+ if (token.parent.parent.kind === 205 /* BinaryExpression */) {
var binaryExpression = token.parent.parent;
var otherExpression = token.parent === binaryExpression.left ? binaryExpression.right : binaryExpression.left;
var widenedType = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(otherExpression)));
@@ -114669,7 +115959,7 @@
var contextualType = checker.getContextualType(token.parent);
typeNode = contextualType ? checker.typeToTypeNode(contextualType) : undefined;
}
- return typeNode || ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ return typeNode || ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
function createAddPropertyDeclarationAction(context, declSourceFile, classDeclaration, makeStatic, tokenName, typeNode) {
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addPropertyDeclaration(t, declSourceFile, classDeclaration, tokenName, typeNode, makeStatic); });
@@ -114678,7 +115968,7 @@
function addPropertyDeclaration(changeTracker, declSourceFile, classDeclaration, tokenName, typeNode, makeStatic) {
var property = ts.createProperty(
/*decorators*/ undefined,
- /*modifiers*/ makeStatic ? [ts.createToken(116 /* StaticKeyword */)] : undefined, tokenName,
+ /*modifiers*/ makeStatic ? [ts.createToken(117 /* StaticKeyword */)] : undefined, tokenName,
/*questionToken*/ undefined, typeNode,
/*initializer*/ undefined);
var lastProp = getNodeToInsertPropertyAfter(classDeclaration);
@@ -114702,7 +115992,7 @@
}
function createAddIndexSignatureAction(context, declSourceFile, classDeclaration, tokenName, typeNode) {
// Index signatures cannot have the static modifier.
- var stringTypeNode = ts.createKeywordTypeNode(138 /* StringKeyword */);
+ var stringTypeNode = ts.createKeywordTypeNode(139 /* StringKeyword */);
var indexingParameter = ts.createParameter(
/*decorators*/ undefined,
/*modifiers*/ undefined,
@@ -114722,7 +116012,7 @@
}
function addMethodDeclaration(context, changeTracker, declSourceFile, typeDecl, token, callExpression, makeStatic, inJs, preferences) {
var methodDeclaration = codefix.createMethodFromCallExpression(context, callExpression, token.text, inJs, makeStatic, preferences, typeDecl);
- var containingMethodDeclaration = ts.getAncestor(callExpression, 156 /* MethodDeclaration */);
+ var containingMethodDeclaration = ts.getAncestor(callExpression, 157 /* MethodDeclaration */);
if (containingMethodDeclaration && containingMethodDeclaration.parent === typeDecl) {
changeTracker.insertNodeAfter(declSourceFile, containingMethodDeclaration, methodDeclaration);
}
@@ -114786,7 +116076,6 @@
(function (codefix) {
var fixName = "fixCannotFindModule";
var fixIdInstallTypesPackage = "installTypesPackage";
- var fixIdGenerateTypes = "generateTypes";
var errorCodeCannotFindModule = ts.Diagnostics.Cannot_find_module_0.code;
var errorCodes = [
errorCodeCannotFindModule,
@@ -114801,13 +116090,12 @@
return undefined;
var typesPackageName = getTypesPackageNameToInstall(packageName, host, context.errorCode);
return typesPackageName === undefined
- ? ts.singleElementArray(tryGetGenerateTypesAction(context, packageName))
+ ? []
: [codefix.createCodeFixAction(fixName, /*changes*/ [], [ts.Diagnostics.Install_0, typesPackageName], fixIdInstallTypesPackage, ts.Diagnostics.Install_all_missing_types_packages, getInstallCommand(sourceFile.fileName, typesPackageName))];
},
- fixIds: [fixIdInstallTypesPackage, fixIdGenerateTypes],
+ fixIds: [fixIdInstallTypesPackage],
getAllCodeActions: function (context) {
- var savedTypesDir = null; // tslint:disable-line no-null-keyword
- return codefix.codeFixAll(context, errorCodes, function (changes, diag, commands) {
+ return codefix.codeFixAll(context, errorCodes, function (_changes, diag, commands) {
var packageName = tryGetImportedPackageName(diag.file, diag.start);
if (packageName === undefined)
return undefined;
@@ -114819,96 +116107,12 @@
}
break;
}
- case fixIdGenerateTypes: {
- var typesDir = savedTypesDir !== null ? savedTypesDir : savedTypesDir = getOrCreateTypesDirectory(changes, context);
- var command = typesDir === undefined ? undefined : tryGenerateTypes(typesDir, packageName, context);
- if (command)
- commands.push(command);
- break;
- }
default:
ts.Debug.fail("Bad fixId: " + context.fixId);
}
});
},
});
- function tryGetGenerateTypesAction(context, packageName) {
- var command;
- var changes = ts.textChanges.ChangeTracker.with(context, function (t) {
- var typesDir = getOrCreateTypesDirectory(t, context);
- command = typesDir === undefined ? undefined : tryGenerateTypes(typesDir, packageName, context);
- });
- return command && codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Generate_types_for_0, packageName], fixIdGenerateTypes, ts.Diagnostics.Generate_types_for_all_packages_without_types, command);
- }
- function tryGenerateTypes(typesDir, packageName, context) {
- var file = context.sourceFile.fileName;
- var fileToGenerateTypesFor = ts.tryResolveJSModule(packageName, ts.getDirectoryPath(file), context.host); // TODO: GH#18217
- if (fileToGenerateTypesFor === undefined)
- return undefined;
- var outputFileName = ts.resolvePath(ts.getDirectoryPath(context.program.getCompilerOptions().configFile.fileName), typesDir, packageName + ".d.ts");
- if (context.host.fileExists(outputFileName))
- return undefined;
- return { type: "generate types", file: file, fileToGenerateTypesFor: fileToGenerateTypesFor, outputFileName: outputFileName };
- }
- // If no types directory exists yet, adds it to tsconfig.json
- function getOrCreateTypesDirectory(changes, context) {
- var configFile = context.program.getCompilerOptions().configFile;
- if (!configFile)
- return undefined;
- var tsconfigObjectLiteral = ts.getTsConfigObjectLiteralExpression(configFile);
- if (!tsconfigObjectLiteral)
- return undefined;
- var compilerOptionsProperty = codefix.findJsonProperty(tsconfigObjectLiteral, "compilerOptions");
- if (!compilerOptionsProperty) {
- var newCompilerOptions = ts.createObjectLiteral([makeDefaultBaseUrl(), makeDefaultPaths()]);
- changes.insertNodeAtObjectStart(configFile, tsconfigObjectLiteral, codefix.createJsonPropertyAssignment("compilerOptions", newCompilerOptions));
- return defaultTypesDirectoryName;
- }
- var compilerOptions = compilerOptionsProperty.initializer;
- if (!ts.isObjectLiteralExpression(compilerOptions))
- return defaultTypesDirectoryName;
- var baseUrl = getOrAddBaseUrl(changes, configFile, compilerOptions);
- var typesDirectoryFromPathMapping = getOrAddPathMapping(changes, configFile, compilerOptions);
- return ts.combinePaths(baseUrl, typesDirectoryFromPathMapping);
- }
- var defaultBaseUrl = ".";
- function makeDefaultBaseUrl() {
- return codefix.createJsonPropertyAssignment("baseUrl", ts.createStringLiteral(defaultBaseUrl));
- }
- function getOrAddBaseUrl(changes, tsconfig, compilerOptions) {
- var baseUrlProp = codefix.findJsonProperty(compilerOptions, "baseUrl");
- if (baseUrlProp) {
- return ts.isStringLiteral(baseUrlProp.initializer) ? baseUrlProp.initializer.text : defaultBaseUrl;
- }
- else {
- changes.insertNodeAtObjectStart(tsconfig, compilerOptions, makeDefaultBaseUrl());
- return defaultBaseUrl;
- }
- }
- var defaultTypesDirectoryName = "types";
- function makeDefaultPathMapping() {
- return codefix.createJsonPropertyAssignment("*", ts.createArrayLiteral([ts.createStringLiteral(defaultTypesDirectoryName + "/*")]));
- }
- function makeDefaultPaths() {
- return codefix.createJsonPropertyAssignment("paths", ts.createObjectLiteral([makeDefaultPathMapping()]));
- }
- function getOrAddPathMapping(changes, tsconfig, compilerOptions) {
- var paths = codefix.findJsonProperty(compilerOptions, "paths");
- if (!paths || !ts.isObjectLiteralExpression(paths.initializer)) {
- changes.insertNodeAtObjectStart(tsconfig, compilerOptions, makeDefaultPaths());
- return defaultTypesDirectoryName;
- }
- // Look for an existing path mapping. Should look like `"*": "foo/*"`.
- var existing = ts.firstDefined(paths.initializer.properties, function (prop) {
- return ts.isPropertyAssignment(prop) && ts.isStringLiteral(prop.name) && prop.name.text === "*" && ts.isArrayLiteralExpression(prop.initializer)
- ? ts.firstDefined(prop.initializer.elements, function (value) { return ts.isStringLiteral(value) ? ts.tryRemoveSuffix(value.text, "/*") : undefined; })
- : undefined;
- });
- if (existing)
- return existing;
- changes.insertNodeAtObjectStart(tsconfig, paths.initializer, makeDefaultPathMapping());
- return defaultTypesDirectoryName;
- }
function getInstallCommand(fileName, packageName) {
return { type: "install package", file: fileName, packageName: packageName };
}
@@ -115016,7 +116220,7 @@
}
function getNodes(sourceFile, pos) {
var token = ts.getTokenAtPosition(sourceFile, pos);
- if (token.kind !== 100 /* ThisKeyword */)
+ if (token.kind !== 101 /* ThisKeyword */)
return undefined;
var constructor = ts.getContainingFunction(token);
var superCall = findSuperCall(constructor.body);
@@ -115055,7 +116259,7 @@
});
function getNode(sourceFile, pos) {
var token = ts.getTokenAtPosition(sourceFile, pos);
- ts.Debug.assert(token.kind === 124 /* ConstructorKeyword */);
+ ts.Debug.assert(token.kind === 125 /* ConstructorKeyword */);
return token.parent;
}
function doChange(changes, sourceFile, ctr) {
@@ -115071,7 +116275,7 @@
(function (codefix) {
var fixId = "enableExperimentalDecorators";
var errorCodes = [
- ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning.code
+ ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning.code
];
codefix.registerCodeFix({
errorCodes: errorCodes,
@@ -115080,12 +116284,19 @@
if (configFile === undefined) {
return undefined;
}
- var changes = ts.textChanges.ChangeTracker.with(context, function (changeTracker) { return makeChange(changeTracker, configFile); });
+ var changes = ts.textChanges.ChangeTracker.with(context, function (changeTracker) { return doChange(changeTracker, configFile); });
return [codefix.createCodeFixActionNoFixId(fixId, changes, ts.Diagnostics.Enable_the_experimentalDecorators_option_in_your_configuration_file)];
},
fixIds: [fixId],
+ getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes) {
+ var configFile = context.program.getCompilerOptions().configFile;
+ if (configFile === undefined) {
+ return undefined;
+ }
+ doChange(changes, configFile);
+ }); },
});
- function makeChange(changeTracker, configFile) {
+ function doChange(changeTracker, configFile) {
codefix.setJsonCompilerOptionValue(changeTracker, configFile, "experimentalDecorators", ts.createTrue());
}
})(codefix = ts.codefix || (ts.codefix = {}));
@@ -115119,14 +116330,14 @@
var token = ts.getTokenAtPosition(sourceFile, pos);
var heritageClauses = ts.getContainingClass(token).heritageClauses;
var extendsToken = heritageClauses[0].getFirstToken();
- return extendsToken.kind === 86 /* ExtendsKeyword */ ? { extendsToken: extendsToken, heritageClauses: heritageClauses } : undefined;
+ return extendsToken.kind === 87 /* ExtendsKeyword */ ? { extendsToken: extendsToken, heritageClauses: heritageClauses } : undefined;
}
function doChanges(changes, sourceFile, extendsToken, heritageClauses) {
- changes.replaceNode(sourceFile, extendsToken, ts.createToken(109 /* ImplementsKeyword */));
+ changes.replaceNode(sourceFile, extendsToken, ts.createToken(110 /* ImplementsKeyword */));
// If there is already an implements clause, replace the implements keyword with a comma.
if (heritageClauses.length === 2 &&
- heritageClauses[0].token === 86 /* ExtendsKeyword */ &&
- heritageClauses[1].token === 109 /* ImplementsKeyword */) {
+ heritageClauses[0].token === 87 /* ExtendsKeyword */ &&
+ heritageClauses[1].token === 110 /* ImplementsKeyword */) {
var implementsToken = heritageClauses[1].getFirstToken();
var implementsFullStart = implementsToken.getFullStart();
changes.replaceRange(sourceFile, { pos: implementsFullStart, end: implementsFullStart }, ts.createToken(27 /* CommaToken */));
@@ -115233,7 +116444,7 @@
return [createDeleteFix(delVar, ts.Diagnostics.Remove_variable_statement)];
}
var result = [];
- if (token.kind === 127 /* InferKeyword */) {
+ if (token.kind === 128 /* InferKeyword */) {
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return changeInferToUnknown(t, sourceFile, token); });
var name = ts.cast(token.parent, ts.isInferTypeNode).typeParameter.name.text;
result.push(codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Replace_infer_0_with_unknown, name], fixIdInfer, ts.Diagnostics.Replace_all_unused_infer_with_unknown));
@@ -115265,7 +116476,7 @@
tryPrefixDeclaration(changes, diag.code, sourceFile, token);
break;
case fixIdDelete: {
- if (token.kind === 127 /* InferKeyword */)
+ if (token.kind === 128 /* InferKeyword */)
break; // Can't delete
var importDecl = tryGetFullImport(token);
if (importDecl) {
@@ -115284,7 +116495,7 @@
break;
}
case fixIdInfer:
- if (token.kind === 127 /* InferKeyword */) {
+ if (token.kind === 128 /* InferKeyword */) {
changeInferToUnknown(changes, sourceFile, token);
}
break;
@@ -115295,7 +116506,7 @@
},
});
function changeInferToUnknown(changes, sourceFile, token) {
- changes.replaceNode(sourceFile, token.parent, ts.createKeywordTypeNode(143 /* UnknownKeyword */));
+ changes.replaceNode(sourceFile, token.parent, ts.createKeywordTypeNode(144 /* UnknownKeyword */));
}
function createDeleteFix(changes, diag) {
return codefix.createCodeFixAction(fixName, changes, diag, fixIdDelete, ts.Diagnostics.Delete_all_unused_declarations);
@@ -115305,13 +116516,13 @@
}
// Sometimes the diagnostic span is an entire ImportDeclaration, so we should remove the whole thing.
function tryGetFullImport(token) {
- return token.kind === 92 /* ImportKeyword */ ? ts.tryCast(token.parent, ts.isImportDeclaration) : undefined;
+ return token.kind === 93 /* ImportKeyword */ ? ts.tryCast(token.parent, ts.isImportDeclaration) : undefined;
}
function tryDeleteFullDestructure(token, changes, sourceFile, checker, sourceFiles, isFixAll) {
if (token.kind !== 18 /* OpenBraceToken */ || !ts.isObjectBindingPattern(token.parent))
return false;
var decl = token.parent.parent;
- if (decl.kind === 151 /* Parameter */) {
+ if (decl.kind === 152 /* Parameter */) {
tryDeleteParameter(changes, sourceFile, decl, checker, sourceFiles, isFixAll);
}
else {
@@ -115322,7 +116533,7 @@
function tryDeleteFullVariableStatement(sourceFile, token, changes) {
var declarationList = ts.tryCast(token.parent, ts.isVariableDeclarationList);
if (declarationList && declarationList.getChildren(sourceFile)[0] === token) {
- changes.delete(sourceFile, declarationList.parent.kind === 219 /* VariableStatement */ ? declarationList.parent : declarationList);
+ changes.delete(sourceFile, declarationList.parent.kind === 220 /* VariableStatement */ ? declarationList.parent : declarationList);
return true;
}
return false;
@@ -115331,7 +116542,7 @@
// Don't offer to prefix a property.
if (errorCode === ts.Diagnostics.Property_0_is_declared_but_its_value_is_never_read.code)
return;
- if (token.kind === 127 /* InferKeyword */) {
+ if (token.kind === 128 /* InferKeyword */) {
token = ts.cast(token.parent, ts.isInferTypeNode).typeParameter.name;
}
if (ts.isIdentifier(token) && canPrefix(token)) {
@@ -115340,14 +116551,14 @@
}
function canPrefix(token) {
switch (token.parent.kind) {
- case 151 /* Parameter */:
- case 150 /* TypeParameter */:
+ case 152 /* Parameter */:
+ case 151 /* TypeParameter */:
return true;
- case 237 /* VariableDeclaration */: {
+ case 238 /* VariableDeclaration */: {
var varDecl = token.parent;
switch (varDecl.parent.parent.kind) {
- case 227 /* ForOfStatement */:
- case 226 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 227 /* ForInStatement */:
return true;
}
}
@@ -115394,26 +116605,26 @@
function mayDeleteParameter(p, checker, isFixAll) {
var parent = p.parent;
switch (parent.kind) {
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
// Don't remove a parameter if this overrides something.
var symbol = checker.getSymbolAtLocation(parent.name);
if (ts.isMemberSymbolInBaseType(symbol, checker))
return false;
// falls through
- case 157 /* Constructor */:
- case 239 /* FunctionDeclaration */:
+ case 158 /* Constructor */:
+ case 240 /* FunctionDeclaration */:
return true;
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */: {
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */: {
// Can't remove a non-last parameter in a callback. Can remove a parameter in code-fix-all if future parameters are also unused.
var parameters = parent.parameters;
var index = parameters.indexOf(p);
ts.Debug.assert(index !== -1);
return isFixAll
- ? parameters.slice(index + 1).every(function (p) { return p.name.kind === 72 /* Identifier */ && !p.symbol.isReferenced; })
+ ? parameters.slice(index + 1).every(function (p) { return p.name.kind === 73 /* Identifier */ && !p.symbol.isReferenced; })
: index === parameters.length - 1;
}
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
// Setter must have a parameter
return false;
default:
@@ -115453,7 +116664,7 @@
var container = (ts.isBlock(statement.parent) ? statement.parent : statement).parent;
if (!ts.isBlock(statement.parent) || statement === ts.first(statement.parent.statements)) {
switch (container.kind) {
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
if (container.elseStatement) {
if (ts.isBlock(statement.parent)) {
break;
@@ -115464,15 +116675,15 @@
return;
}
// falls through
- case 224 /* WhileStatement */:
- case 225 /* ForStatement */:
+ case 225 /* WhileStatement */:
+ case 226 /* ForStatement */:
changes.delete(sourceFile, container);
return;
}
}
if (ts.isBlock(statement.parent)) {
- var end_2 = start + length;
- var lastStatement = ts.Debug.assertDefined(lastWhere(ts.sliceAfter(statement.parent.statements, statement), function (s) { return s.pos < end_2; }));
+ var end_3 = start + length;
+ var lastStatement = ts.Debug.assertDefined(lastWhere(ts.sliceAfter(statement.parent.statements, statement), function (s) { return s.pos < end_3; }));
changes.deleteNodeRange(sourceFile, statement, lastStatement);
}
else {
@@ -115538,7 +116749,7 @@
var typeNode = info.typeNode, type = info.type;
var original = typeNode.getText(sourceFile);
var actions = [fix(type, fixIdPlain, ts.Diagnostics.Change_all_jsdoc_style_types_to_TypeScript)];
- if (typeNode.kind === 291 /* JSDocNullableType */) {
+ if (typeNode.kind === 292 /* JSDocNullableType */) {
// for nullable types, suggest the flow-compatible `T | null | undefined`
// in addition to the jsdoc/closure-compatible `T | null`
actions.push(fix(checker.getNullableType(type, 32768 /* Undefined */), fixIdNullable, ts.Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types));
@@ -115558,7 +116769,7 @@
if (!info)
return;
var typeNode = info.typeNode, type = info.type;
- var fixedType = typeNode.kind === 291 /* JSDocNullableType */ && fixId === fixIdNullable ? checker.getNullableType(type, 32768 /* Undefined */) : type;
+ var fixedType = typeNode.kind === 292 /* JSDocNullableType */ && fixId === fixIdNullable ? checker.getNullableType(type, 32768 /* Undefined */) : type;
doChange(changes, sourceFile, typeNode, fixedType, checker);
});
}
@@ -115575,22 +116786,22 @@
// NOTE: Some locations are not handled yet:
// MappedTypeNode.typeParameters and SignatureDeclaration.typeParameters, as well as CallExpression.typeArguments
switch (node.kind) {
- case 212 /* AsExpression */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 239 /* FunctionDeclaration */:
- case 158 /* GetAccessor */:
- case 162 /* IndexSignature */:
- case 181 /* MappedType */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 151 /* Parameter */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 159 /* SetAccessor */:
- case 242 /* TypeAliasDeclaration */:
- case 194 /* TypeAssertionExpression */:
- case 237 /* VariableDeclaration */:
+ case 213 /* AsExpression */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 240 /* FunctionDeclaration */:
+ case 159 /* GetAccessor */:
+ case 163 /* IndexSignature */:
+ case 182 /* MappedType */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 152 /* Parameter */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 160 /* SetAccessor */:
+ case 243 /* TypeAliasDeclaration */:
+ case 195 /* TypeAssertionExpression */:
+ case 238 /* VariableDeclaration */:
return true;
default:
return false;
@@ -115644,14 +116855,14 @@
}
var insertBefore;
switch (containingFunction.kind) {
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
insertBefore = containingFunction.name;
break;
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- insertBefore = ts.findChildOfKind(containingFunction, 90 /* FunctionKeyword */, sourceFile);
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ insertBefore = ts.findChildOfKind(containingFunction, 91 /* FunctionKeyword */, sourceFile);
break;
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
insertBefore = ts.findChildOfKind(containingFunction, 20 /* OpenParenToken */, sourceFile) || ts.first(containingFunction.parameters);
break;
default:
@@ -115666,11 +116877,11 @@
var insertBefore = _a.insertBefore, returnType = _a.returnType;
if (returnType) {
var entityName = ts.getEntityNameFromTypeNode(returnType);
- if (!entityName || entityName.kind !== 72 /* Identifier */ || entityName.text !== "Promise") {
+ if (!entityName || entityName.kind !== 73 /* Identifier */ || entityName.text !== "Promise") {
changes.replaceNode(sourceFile, returnType, ts.createTypeReferenceNode("Promise", ts.createNodeArray([returnType])));
}
}
- changes.insertModifierBefore(sourceFile, 121 /* AsyncKeyword */, insertBefore);
+ changes.insertModifierBefore(sourceFile, 122 /* AsyncKeyword */, insertBefore);
}
})(codefix = ts.codefix || (ts.codefix = {}));
})(ts || (ts = {}));
@@ -115779,17 +116990,17 @@
var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration));
var optional = !!(symbol.flags & 16777216 /* Optional */);
switch (declaration.kind) {
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 153 /* PropertySignature */:
- case 154 /* PropertyDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 154 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
var typeNode = checker.typeToTypeNode(type, enclosingDeclaration, /*flags*/ undefined, getNoopSymbolTrackerWithResolver(context));
out(ts.createProperty(
/*decorators*/ undefined, modifiers, name, optional ? ts.createToken(56 /* QuestionToken */) : undefined, typeNode,
/*initializer*/ undefined));
break;
- case 155 /* MethodSignature */:
- case 156 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
// The signature for the implementation appears as an entry in `signatures` iff
// there is only one signature.
// If there are overloads and an implementation signature, it appears as an
@@ -115830,7 +117041,7 @@
}
function signatureToMethodDeclaration(context, signature, enclosingDeclaration, modifiers, name, optional, body) {
var program = context.program;
- var signatureDeclaration = program.getTypeChecker().signatureToSignatureDeclaration(signature, 156 /* MethodDeclaration */, enclosingDeclaration, 1 /* NoTruncation */ | 256 /* SuppressAnyReturnType */, getNoopSymbolTrackerWithResolver(context));
+ var signatureDeclaration = program.getTypeChecker().signatureToSignatureDeclaration(signature, 157 /* MethodDeclaration */, enclosingDeclaration, 1 /* NoTruncation */ | 256 /* SuppressAnyReturnType */, getNoopSymbolTrackerWithResolver(context));
if (!signatureDeclaration) {
return undefined;
}
@@ -115858,7 +117069,7 @@
var returnType = (inJs || !contextualType) ? undefined : checker.typeToTypeNode(contextualType, contextNode, /*flags*/ undefined, tracker);
return ts.createMethod(
/*decorators*/ undefined,
- /*modifiers*/ makeStatic ? [ts.createToken(116 /* StaticKeyword */)] : undefined,
+ /*modifiers*/ makeStatic ? [ts.createToken(117 /* StaticKeyword */)] : undefined,
/*asteriskToken*/ ts.isYieldExpression(parent) ? ts.createToken(40 /* AsteriskToken */) : undefined, methodName,
/*questionToken*/ undefined,
/*typeParameters*/ inJs ? undefined : ts.map(typeArguments, function (_, i) {
@@ -115877,7 +117088,7 @@
/*dotDotDotToken*/ undefined,
/*name*/ names && names[i] || "arg" + i,
/*questionToken*/ minArgumentCount !== undefined && i >= minArgumentCount ? ts.createToken(56 /* QuestionToken */) : undefined,
- /*type*/ inJs ? undefined : types && types[i] || ts.createKeywordTypeNode(120 /* AnyKeyword */),
+ /*type*/ inJs ? undefined : types && types[i] || ts.createKeywordTypeNode(121 /* AnyKeyword */),
/*initializer*/ undefined);
parameters.push(newParameter);
}
@@ -115905,7 +117116,7 @@
var maxArgsParameterSymbolNames = maxArgsSignature.parameters.map(function (symbol) { return symbol.name; });
var parameters = createDummyParameters(maxNonRestArgs, maxArgsParameterSymbolNames, /* types */ undefined, minArgumentCount, /*inJs*/ false);
if (someSigHasRestParameter) {
- var anyArrayType = ts.createArrayTypeNode(ts.createKeywordTypeNode(120 /* AnyKeyword */));
+ var anyArrayType = ts.createArrayTypeNode(ts.createKeywordTypeNode(121 /* AnyKeyword */));
var restParameter = ts.createParameter(
/*decorators*/ undefined,
/*modifiers*/ undefined, ts.createToken(25 /* DotDotDotToken */), maxArgsParameterSymbolNames[maxNonRestArgs] || "rest",
@@ -115931,10 +117142,10 @@
}
function createVisibilityModifier(flags) {
if (flags & 4 /* Public */) {
- return ts.createToken(115 /* PublicKeyword */);
+ return ts.createToken(116 /* PublicKeyword */);
}
else if (flags & 16 /* Protected */) {
- return ts.createToken(114 /* ProtectedKeyword */);
+ return ts.createToken(115 /* ProtectedKeyword */);
}
return undefined;
}
@@ -116006,7 +117217,7 @@
});
function getActionsForUsageOfInvalidImport(context) {
var sourceFile = context.sourceFile;
- var targetKind = ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures.code === context.errorCode ? 191 /* CallExpression */ : 192 /* NewExpression */;
+ var targetKind = ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures.code === context.errorCode ? 192 /* CallExpression */ : 193 /* NewExpression */;
var node = ts.findAncestor(ts.getTokenAtPosition(sourceFile, context.span.start), function (a) { return a.kind === targetKind && a.getStart() === context.span.start && a.getEnd() === (context.span.start + context.span.length); });
if (!node) {
return [];
@@ -116125,7 +117336,7 @@
return codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Add_undefined_type_to_property_0, propertyDeclaration.name.getText()], fixIdAddUndefinedType, ts.Diagnostics.Add_undefined_type_to_all_uninitialized_properties);
}
function addUndefinedType(changeTracker, propertyDeclarationSourceFile, propertyDeclaration) {
- var undefinedTypeNode = ts.createKeywordTypeNode(141 /* UndefinedKeyword */);
+ var undefinedTypeNode = ts.createKeywordTypeNode(142 /* UndefinedKeyword */);
var type = propertyDeclaration.type; // TODO: GH#18217
var types = ts.isUnionTypeNode(type) ? type.types.concat(undefinedTypeNode) : [type, undefinedTypeNode];
changeTracker.replaceNode(propertyDeclarationSourceFile, type, ts.createUnionTypeNode(types));
@@ -116171,235 +117382,6 @@
}
})(codefix = ts.codefix || (ts.codefix = {}));
})(ts || (ts = {}));
-var ts;
-(function (ts) {
- function generateTypesForModule(name, moduleValue, formatSettings) {
- return generateTypesForModuleOrGlobal(name, moduleValue, formatSettings, 0 /* ExportEquals */);
- }
- ts.generateTypesForModule = generateTypesForModule;
- function generateTypesForGlobal(name, globalValue, formatSettings) {
- return generateTypesForModuleOrGlobal(name, globalValue, formatSettings, 3 /* Global */);
- }
- ts.generateTypesForGlobal = generateTypesForGlobal;
- function generateTypesForModuleOrGlobal(name, globalValue, formatSettings, outputKind) {
- return valueInfoToDeclarationFileText(ts.inspectValue(name, globalValue), formatSettings, outputKind);
- }
- /* @internal */
- function valueInfoToDeclarationFileText(valueInfo, formatSettings, outputKind) {
- if (outputKind === void 0) { outputKind = 0 /* ExportEquals */; }
- return ts.textChanges.getNewFileText(toStatements(valueInfo, outputKind), 3 /* TS */, formatSettings.newLineCharacter || "\n", ts.formatting.getFormatContext(formatSettings));
- }
- ts.valueInfoToDeclarationFileText = valueInfoToDeclarationFileText;
- /* @internal */
- var OutputKind;
- (function (OutputKind) {
- OutputKind[OutputKind["ExportEquals"] = 0] = "ExportEquals";
- OutputKind[OutputKind["NamedExport"] = 1] = "NamedExport";
- OutputKind[OutputKind["NamespaceMember"] = 2] = "NamespaceMember";
- OutputKind[OutputKind["Global"] = 3] = "Global";
- })(OutputKind || (OutputKind = {}));
- function toNamespaceMemberStatements(info) {
- return toStatements(info, 2 /* NamespaceMember */);
- }
- function toStatements(info, kind) {
- var isDefault = info.name === "default" /* Default */;
- var name = isDefault ? "_default" : info.name;
- if (!isValidIdentifier(name) || isDefault && kind !== 1 /* NamedExport */)
- return ts.emptyArray;
- var modifiers = isDefault && info.kind === 2 /* FunctionOrClass */ ? [ts.createModifier(85 /* ExportKeyword */), ts.createModifier(80 /* DefaultKeyword */)]
- : kind === 3 /* Global */ || kind === 0 /* ExportEquals */ ? [ts.createModifier(125 /* DeclareKeyword */)]
- : kind === 1 /* NamedExport */ ? [ts.createModifier(85 /* ExportKeyword */)]
- : undefined;
- var exportEquals = function () { return kind === 0 /* ExportEquals */ ? [exportEqualsOrDefault(info.name, /*isExportEquals*/ true)] : ts.emptyArray; };
- var exportDefault = function () { return isDefault ? [exportEqualsOrDefault("_default", /*isExportEquals*/ false)] : ts.emptyArray; };
- switch (info.kind) {
- case 2 /* FunctionOrClass */:
- return exportEquals().concat(functionOrClassToStatements(modifiers, name, info));
- case 3 /* Object */:
- var members = info.members, hasNontrivialPrototype = info.hasNontrivialPrototype;
- if (!hasNontrivialPrototype) {
- if (kind === 0 /* ExportEquals */) {
- return ts.flatMap(members, function (v) { return toStatements(v, 1 /* NamedExport */); });
- }
- if (members.some(function (m) { return m.kind === 2 /* FunctionOrClass */; })) {
- // If some member is a function, use a namespace so it gets a FunctionDeclaration or ClassDeclaration.
- return exportDefault().concat([createNamespace(modifiers, name, ts.flatMap(members, toNamespaceMemberStatements))]);
- }
- }
- // falls through
- case 0 /* Const */:
- case 1 /* Array */: {
- var comment = info.kind === 0 /* Const */ ? info.comment : undefined;
- var constVar = ts.createVariableStatement(modifiers, ts.createVariableDeclarationList([ts.createVariableDeclaration(name, toType(info))], 2 /* Const */));
- return exportEquals().concat(exportDefault(), [addComment(constVar, comment)]);
- }
- default:
- return ts.Debug.assertNever(info);
- }
- }
- function exportEqualsOrDefault(name, isExportEquals) {
- return ts.createExportAssignment(/*decorators*/ undefined, /*modifiers*/ undefined, isExportEquals, ts.createIdentifier(name));
- }
- function functionOrClassToStatements(modifiers, name, _a) {
- var source = _a.source, prototypeMembers = _a.prototypeMembers, namespaceMembers = _a.namespaceMembers;
- var fnAst = parseClassOrFunctionBody(source);
- var _b = fnAst === undefined ? { parameters: ts.emptyArray, returnType: anyType() } : getParametersAndReturnType(fnAst), parameters = _b.parameters, returnType = _b.returnType;
- var protoOrInstanceMembers = ts.createMap();
- if (typeof fnAst === "object")
- getConstructorFunctionInstanceProperties(fnAst, protoOrInstanceMembers);
- for (var _i = 0, prototypeMembers_1 = prototypeMembers; _i < prototypeMembers_1.length; _i++) {
- var p = prototypeMembers_1[_i];
- // ignore non-functions on the prototype
- if (p.kind === 2 /* FunctionOrClass */) {
- var m = tryGetMethod(p);
- if (m) {
- protoOrInstanceMembers.set(p.name, m);
- }
- }
- }
- var classStaticMembers = protoOrInstanceMembers.size !== 0 || fnAst === undefined || typeof fnAst !== "number" && fnAst.kind === 157 /* Constructor */ ? [] : undefined;
- var namespaceStatements = ts.flatMap(namespaceMembers, function (info) {
- if (!isValidIdentifier(info.name))
- return undefined;
- if (classStaticMembers) {
- switch (info.kind) {
- case 3 /* Object */:
- if (info.members.some(function (m) { return m.kind === 2 /* FunctionOrClass */; })) {
- break;
- }
- // falls through
- case 1 /* Array */:
- case 0 /* Const */:
- classStaticMembers.push(addComment(ts.createProperty(/*decorators*/ undefined, [ts.createModifier(116 /* StaticKeyword */)], info.name, /*questionOrExclamationToken*/ undefined, toType(info), /*initializer*/ undefined), info.kind === 0 /* Const */ ? info.comment : undefined));
- return undefined;
- case 2 /* FunctionOrClass */:
- if (!info.namespaceMembers.length) { // Else, can't merge a static method with a namespace. Must make it a function on the namespace.
- var sig = tryGetMethod(info, [ts.createModifier(116 /* StaticKeyword */)]);
- if (sig) {
- classStaticMembers.push(sig);
- return undefined;
- }
- }
- break;
- default:
- ts.Debug.assertNever(info);
- }
- }
- return toStatements(info, 2 /* NamespaceMember */);
- });
- var decl = classStaticMembers
- ? ts.createClassDeclaration(
- /*decorators*/ undefined, modifiers, name,
- /*typeParameters*/ undefined,
- /*heritageClauses*/ undefined, classStaticMembers.concat((parameters.length ? [ts.createConstructor(/*decorators*/ undefined, /*modifiers*/ undefined, parameters, /*body*/ undefined)] : ts.emptyArray), ts.arrayFrom(protoOrInstanceMembers.values())))
- : ts.createFunctionDeclaration(/*decorators*/ undefined, modifiers, /*asteriskToken*/ undefined, name, /*typeParameters*/ undefined, parameters, returnType, /*body*/ undefined);
- return [decl].concat((namespaceStatements.length === 0 ? ts.emptyArray : [createNamespace(modifiers && modifiers.map(function (m) { return ts.getSynthesizedDeepClone(m); }), name, namespaceStatements)]));
- }
- function tryGetMethod(_a, modifiers) {
- var name = _a.name, source = _a.source;
- if (!isValidIdentifier(name))
- return undefined;
- var fnAst = parseClassOrFunctionBody(source);
- if (fnAst === undefined || (typeof fnAst !== "number" && fnAst.kind === 157 /* Constructor */))
- return undefined;
- var sig = getParametersAndReturnType(fnAst);
- return sig && ts.createMethod(
- /*decorators*/ undefined, modifiers,
- /*asteriskToken*/ undefined, name,
- /*questionToken*/ undefined,
- /*typeParameters*/ undefined, sig.parameters, sig.returnType,
- /*body*/ undefined);
- }
- function toType(info) {
- switch (info.kind) {
- case 0 /* Const */:
- return ts.createTypeReferenceNode(info.typeName, /*typeArguments*/ undefined);
- case 1 /* Array */:
- return ts.createArrayTypeNode(toType(info.inner));
- case 2 /* FunctionOrClass */:
- return ts.createTypeReferenceNode("Function", /*typeArguments*/ undefined); // Normally we create a FunctionDeclaration, but this can happen for a function in an array.
- case 3 /* Object */:
- return ts.createTypeLiteralNode(info.members.map(function (m) { return ts.createPropertySignature(/*modifiers*/ undefined, toPropertyName(m.name), /*questionToken*/ undefined, toType(m), /*initializer*/ undefined); }));
- default:
- return ts.Debug.assertNever(info);
- }
- }
- function toPropertyName(name) {
- return ts.isIdentifierText(name, 7 /* ESNext */) ? ts.createIdentifier(name) : ts.createStringLiteral(name);
- }
- // Parses assignments to "this.x" in the constructor into class property declarations
- function getConstructorFunctionInstanceProperties(fnAst, members) {
- forEachOwnNodeOfFunction(fnAst, function (node) {
- if (ts.isAssignmentExpression(node, /*excludeCompoundAssignment*/ true) &&
- ts.isPropertyAccessExpression(node.left) && node.left.expression.kind === 100 /* ThisKeyword */) {
- var name_4 = node.left.name.text;
- if (!ts.isJsPrivate(name_4)) {
- ts.getOrUpdate(members, name_4, function () { return ts.createProperty(/*decorators*/ undefined, /*modifiers*/ undefined, name_4, /*questionOrExclamationToken*/ undefined, anyType(), /*initializer*/ undefined); });
- }
- }
- });
- }
- function getParametersAndReturnType(fnAst) {
- if (typeof fnAst === "number") {
- return { parameters: ts.fill(fnAst, function (i) { return makeParameter("p" + i, anyType()); }), returnType: anyType() };
- }
- var usedArguments = false, hasReturn = false;
- forEachOwnNodeOfFunction(fnAst, function (node) {
- usedArguments = usedArguments || ts.isIdentifier(node) && node.text === "arguments";
- hasReturn = hasReturn || ts.isReturnStatement(node) && !!node.expression && node.expression.kind !== 200 /* VoidExpression */;
- });
- var parameters = fnAst.parameters.map(function (p) { return makeParameter("" + p.name.getText(), inferParameterType(fnAst, p)); }).concat((usedArguments ? [makeRestParameter()] : ts.emptyArray));
- return { parameters: parameters, returnType: hasReturn ? anyType() : ts.createKeywordTypeNode(106 /* VoidKeyword */) };
- }
- function makeParameter(name, type) {
- return ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, name, /*questionToken*/ undefined, type);
- }
- function makeRestParameter() {
- return ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, ts.createToken(25 /* DotDotDotToken */), "args", /*questionToken*/ undefined, ts.createArrayTypeNode(anyType()));
- }
- /** Returns 'undefined' for class with no declared constructor */
- function parseClassOrFunctionBody(source) {
- if (typeof source === "number")
- return source;
- var classOrFunction = ts.tryCast(parseExpression(source), function (node) { return ts.isFunctionExpression(node) || ts.isArrowFunction(node) || ts.isClassExpression(node); });
- return classOrFunction
- ? ts.isClassExpression(classOrFunction) ? ts.find(classOrFunction.members, ts.isConstructorDeclaration) : classOrFunction
- // If that didn't parse, it's a method `m() {}`. Parse again inside of an object literal.
- : ts.cast(ts.first(ts.cast(parseExpression("{ " + source + " }"), ts.isObjectLiteralExpression).properties), ts.isMethodDeclaration);
- }
- function parseExpression(expr) {
- var text = "const _ = " + expr;
- var srcFile = ts.createSourceFile("test.ts", text, 7 /* Latest */, /*setParentNodes*/ true);
- return ts.first(ts.cast(ts.first(srcFile.statements), ts.isVariableStatement).declarationList.declarations).initializer;
- }
- function inferParameterType(_fn, _param) {
- // TODO: Inspect function body for clues (see inferFromUsage.ts)
- return anyType();
- }
- // Descends through all nodes in a function, but not in nested functions.
- function forEachOwnNodeOfFunction(fnAst, cb) {
- fnAst.body.forEachChild(function recur(node) {
- cb(node);
- if (!ts.isFunctionLike(node))
- node.forEachChild(recur);
- });
- }
- function isValidIdentifier(name) {
- var keyword = ts.stringToToken(name);
- return !(keyword && ts.isNonContextualKeyword(keyword)) && ts.isIdentifierText(name, 7 /* ESNext */);
- }
- function addComment(node, comment) {
- if (comment !== undefined)
- ts.addSyntheticLeadingComment(node, 2 /* SingleLineCommentTrivia */, comment);
- return node;
- }
- function anyType() {
- return ts.createKeywordTypeNode(120 /* AnyKeyword */);
- }
- function createNamespace(modifiers, name, statements) {
- return ts.createModuleDeclaration(/*decorators*/ undefined, modifiers, ts.createIdentifier(name), ts.createModuleBlock(statements), 16 /* Namespace */);
- }
-})(ts || (ts = {}));
/* @internal */
var ts;
(function (ts) {
@@ -116496,8 +117478,8 @@
});
function getImportTypeNode(sourceFile, pos) {
var token = ts.getTokenAtPosition(sourceFile, pos);
- ts.Debug.assert(token.kind === 92 /* ImportKeyword */);
- ts.Debug.assert(token.parent.kind === 183 /* ImportType */);
+ ts.Debug.assert(token.kind === 93 /* ImportKeyword */);
+ ts.Debug.assert(token.parent.kind === 184 /* ImportType */);
return token.parent;
}
function doChange(changes, sourceFile, importType) {
@@ -116549,7 +117531,7 @@
var otherMembers = members.filter(function (member) { return !ts.isIndexSignatureDeclaration(member); });
var parameter = ts.first(indexSignature.parameters);
var mappedTypeParameter = ts.createTypeParameterDeclaration(ts.cast(parameter.name, ts.isIdentifier), parameter.type);
- var mappedIntersectionType = ts.createMappedTypeNode(ts.hasReadonlyModifier(indexSignature) ? ts.createModifier(133 /* ReadonlyKeyword */) : undefined, mappedTypeParameter, indexSignature.questionToken, indexSignature.type);
+ var mappedIntersectionType = ts.createMappedTypeNode(ts.hasReadonlyModifier(indexSignature) ? ts.createModifier(134 /* ReadonlyKeyword */) : undefined, mappedTypeParameter, indexSignature.questionToken, indexSignature.type);
var intersectionType = ts.createIntersectionTypeNode(ts.getAllSuperTypeNodes(container).concat([
mappedIntersectionType
], (otherMembers.length ? [ts.createTypeLiteralNode(otherMembers)] : ts.emptyArray)));
@@ -116596,16 +117578,16 @@
return undefined;
}
switch (exportNode.kind) {
- case 239 /* FunctionDeclaration */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 244 /* ModuleDeclaration */: {
+ case 240 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 245 /* ModuleDeclaration */: {
var node = exportNode;
return node.name && ts.isIdentifier(node.name) ? { exportNode: node, exportName: node.name, wasDefault: wasDefault, exportingModuleSymbol: exportingModuleSymbol } : undefined;
}
- case 219 /* VariableStatement */: {
+ case 220 /* VariableStatement */: {
var vs = exportNode;
// Must be `export const x = something;`.
if (!(vs.declarationList.flags & 2 /* Const */) || vs.declarationList.declarations.length !== 1) {
@@ -116628,17 +117610,17 @@
function changeExport(exportingSourceFile, _a, changes, checker) {
var wasDefault = _a.wasDefault, exportNode = _a.exportNode, exportName = _a.exportName;
if (wasDefault) {
- changes.delete(exportingSourceFile, ts.Debug.assertDefined(ts.findModifier(exportNode, 80 /* DefaultKeyword */)));
+ changes.delete(exportingSourceFile, ts.Debug.assertDefined(ts.findModifier(exportNode, 81 /* DefaultKeyword */)));
}
else {
- var exportKeyword = ts.Debug.assertDefined(ts.findModifier(exportNode, 85 /* ExportKeyword */));
+ var exportKeyword = ts.Debug.assertDefined(ts.findModifier(exportNode, 86 /* ExportKeyword */));
switch (exportNode.kind) {
- case 239 /* FunctionDeclaration */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- changes.insertNodeAfter(exportingSourceFile, exportKeyword, ts.createToken(80 /* DefaultKeyword */));
+ case 240 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ changes.insertNodeAfter(exportingSourceFile, exportKeyword, ts.createToken(81 /* DefaultKeyword */));
break;
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
// If 'x' isn't used in this file, `export const x = 0;` --> `export default 0;`
if (!ts.FindAllReferences.Core.isSymbolReferencedInFile(exportName, checker, exportingSourceFile)) {
// We checked in `getInfo` that an initializer exists.
@@ -116646,9 +117628,9 @@
break;
}
// falls through
- case 243 /* EnumDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 244 /* ModuleDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 245 /* ModuleDeclaration */:
// `export type T = number;` -> `type T = number; export default T;`
changes.deleteModifier(exportingSourceFile, exportKeyword);
changes.insertNodeAfter(exportingSourceFile, exportNode, ts.createExportDefault(ts.createIdentifier(exportName.text)));
@@ -116675,18 +117657,18 @@
function changeDefaultToNamedImport(importingSourceFile, ref, changes, exportName) {
var parent = ref.parent;
switch (parent.kind) {
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
// `a.default` --> `a.foo`
changes.replaceNode(importingSourceFile, ref, ts.createIdentifier(exportName));
break;
- case 253 /* ImportSpecifier */:
- case 257 /* ExportSpecifier */: {
+ case 254 /* ImportSpecifier */:
+ case 258 /* ExportSpecifier */: {
var spec = parent;
// `default as foo` --> `foo`, `default as bar` --> `foo as bar`
changes.replaceNode(importingSourceFile, spec, makeImportSpecifier(exportName, spec.name.text));
break;
}
- case 250 /* ImportClause */: {
+ case 251 /* ImportClause */: {
var clause = parent;
ts.Debug.assert(clause.name === ref);
var spec = makeImportSpecifier(exportName, ref.text);
@@ -116695,7 +117677,7 @@
// `import foo from "./a";` --> `import { foo } from "./a";`
changes.replaceNode(importingSourceFile, ref, ts.createNamedImports([spec]));
}
- else if (namedBindings.kind === 251 /* NamespaceImport */) {
+ else if (namedBindings.kind === 252 /* NamespaceImport */) {
// `import foo, * as a from "./a";` --> `import * as a from ".a/"; import { foo } from "./a";`
changes.deleteRange(importingSourceFile, { pos: ref.getStart(importingSourceFile), end: namedBindings.getStart(importingSourceFile) });
var quotePreference = ts.isStringLiteral(clause.parent.moduleSpecifier) ? ts.quotePreferenceFromString(clause.parent.moduleSpecifier, importingSourceFile) : 1 /* Double */;
@@ -116716,11 +117698,11 @@
function changeNamedToDefaultImport(importingSourceFile, ref, changes) {
var parent = ref.parent;
switch (parent.kind) {
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
// `a.foo` --> `a.default`
changes.replaceNode(importingSourceFile, ref, ts.createIdentifier("default"));
break;
- case 253 /* ImportSpecifier */: {
+ case 254 /* ImportSpecifier */: {
// `import { foo } from "./a";` --> `import foo from "./a";`
// `import { foo as bar } from "./a";` --> `import bar from "./a";`
var defaultImport = ts.createIdentifier(parent.name.text);
@@ -116733,7 +117715,7 @@
}
break;
}
- case 257 /* ExportSpecifier */: {
+ case 258 /* ExportSpecifier */: {
// `export { foo } from "./a";` --> `export { default as foo } from "./a";`
// `export { foo as bar } from "./a";` --> `export { default as bar } from "./a";`
// `export { foo as default } from "./a";` --> `export { default } from "./a";`
@@ -116766,8 +117748,8 @@
var i = getImportToConvert(context);
if (!i)
return ts.emptyArray;
- var description = i.kind === 251 /* NamespaceImport */ ? ts.Diagnostics.Convert_namespace_import_to_named_imports.message : ts.Diagnostics.Convert_named_imports_to_namespace_import.message;
- var actionName = i.kind === 251 /* NamespaceImport */ ? actionNameNamespaceToNamed : actionNameNamedToNamespace;
+ var description = i.kind === 252 /* NamespaceImport */ ? ts.Diagnostics.Convert_namespace_import_to_named_imports.message : ts.Diagnostics.Convert_named_imports_to_namespace_import.message;
+ var actionName = i.kind === 252 /* NamespaceImport */ ? actionNameNamespaceToNamed : actionNameNamedToNamespace;
return [{ name: refactorName, description: description, actions: [{ name: actionName, description: description }] }];
},
getEditsForAction: function (context, actionName) {
@@ -116789,7 +117771,7 @@
}
function doChange(sourceFile, program, changes, toConvert) {
var checker = program.getTypeChecker();
- if (toConvert.kind === 251 /* NamespaceImport */) {
+ if (toConvert.kind === 252 /* NamespaceImport */) {
doChangeNamespaceToNamed(sourceFile, checker, changes, toConvert, ts.getAllowSyntheticDefaultImports(program.getCompilerOptions()));
}
else {
@@ -116841,7 +117823,7 @@
function doChangeNamedToNamespace(sourceFile, checker, changes, toConvert) {
var importDecl = toConvert.parent.parent;
var moduleSpecifier = importDecl.moduleSpecifier;
- var preferredName = moduleSpecifier && ts.isStringLiteral(moduleSpecifier) ? ts.codefix.moduleSpecifierToValidIdentifier(moduleSpecifier.text, 7 /* ESNext */) : "module";
+ var preferredName = moduleSpecifier && ts.isStringLiteral(moduleSpecifier) ? ts.codefix.moduleSpecifierToValidIdentifier(moduleSpecifier.text, 8 /* ESNext */) : "module";
var namespaceNameConflicts = toConvert.elements.some(function (element) {
return ts.FindAllReferences.Core.eachSymbolReferenceInFile(element.name, checker, sourceFile, function (id) {
return !!checker.resolveName(preferredName, id, 67108863 /* All */, /*excludeGlobals*/ true);
@@ -117132,20 +118114,20 @@
function checkForStaticContext(nodeToCheck, containingClass) {
var current = nodeToCheck;
while (current !== containingClass) {
- if (current.kind === 154 /* PropertyDeclaration */) {
+ if (current.kind === 155 /* PropertyDeclaration */) {
if (ts.hasModifier(current, 32 /* Static */)) {
rangeFacts |= RangeFacts.InStaticRegion;
}
break;
}
- else if (current.kind === 151 /* Parameter */) {
+ else if (current.kind === 152 /* Parameter */) {
var ctorOrMethod = ts.getContainingFunction(current);
- if (ctorOrMethod.kind === 157 /* Constructor */) {
+ if (ctorOrMethod.kind === 158 /* Constructor */) {
rangeFacts |= RangeFacts.InStaticRegion;
}
break;
}
- else if (current.kind === 156 /* MethodDeclaration */) {
+ else if (current.kind === 157 /* MethodDeclaration */) {
if (ts.hasModifier(current, 32 /* Static */)) {
rangeFacts |= RangeFacts.InStaticRegion;
}
@@ -117188,7 +118170,7 @@
return true;
}
if (ts.isDeclaration(node)) {
- var declaringNode = (node.kind === 237 /* VariableDeclaration */) ? node.parent.parent : node;
+ var declaringNode = (node.kind === 238 /* VariableDeclaration */) ? node.parent.parent : node;
if (ts.hasModifier(declaringNode, 1 /* Export */)) {
// TODO: GH#18217 Silly to use `errors ||` since it's definitely not defined (see top of `visit`)
// Also, if we're only pushing one error, just use `let error: Diagnostic | undefined`!
@@ -117200,13 +118182,13 @@
}
// Some things can't be extracted in certain situations
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
(errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractImport));
return true;
- case 98 /* SuperKeyword */:
+ case 99 /* SuperKeyword */:
// For a super *constructor call*, we have to be extracting the entire class,
// but a super *method call* simply implies a 'this' reference
- if (node.parent.kind === 191 /* CallExpression */) {
+ if (node.parent.kind === 192 /* CallExpression */) {
// Super constructor call
var containingClass_1 = ts.getContainingClass(node); // TODO:GH#18217
if (containingClass_1.pos < span.start || containingClass_1.end >= (span.start + span.length)) {
@@ -117221,8 +118203,8 @@
}
if (ts.isFunctionLikeDeclaration(node) || ts.isClassLike(node)) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 240 /* ClassDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
if (ts.isSourceFile(node.parent) && node.parent.externalModuleIndicator === undefined) {
// You cannot extract global declarations
(errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.functionWillNotBeVisibleInTheNewScope));
@@ -117234,20 +118216,20 @@
}
var savedPermittedJumps = permittedJumps;
switch (node.kind) {
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
permittedJumps = 0 /* None */;
break;
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
// forbid all jumps inside try blocks
permittedJumps = 0 /* None */;
break;
- case 218 /* Block */:
- if (node.parent && node.parent.kind === 235 /* TryStatement */ && node.parent.finallyBlock === node) {
+ case 219 /* Block */:
+ if (node.parent && node.parent.kind === 236 /* TryStatement */ && node.parent.finallyBlock === node) {
// allow unconditional returns from finally blocks
permittedJumps = 4 /* Return */;
}
break;
- case 271 /* CaseClause */:
+ case 272 /* CaseClause */:
// allow unlabeled break inside case clauses
permittedJumps |= 1 /* Break */;
break;
@@ -117259,19 +118241,19 @@
break;
}
switch (node.kind) {
- case 178 /* ThisType */:
- case 100 /* ThisKeyword */:
+ case 179 /* ThisType */:
+ case 101 /* ThisKeyword */:
rangeFacts |= RangeFacts.UsesThis;
break;
- case 233 /* LabeledStatement */: {
+ case 234 /* LabeledStatement */: {
var label = node.label;
(seenLabels || (seenLabels = [])).push(label.escapedText);
ts.forEachChild(node, visit);
seenLabels.pop();
break;
}
- case 229 /* BreakStatement */:
- case 228 /* ContinueStatement */: {
+ case 230 /* BreakStatement */:
+ case 229 /* ContinueStatement */: {
var label = node.label;
if (label) {
if (!ts.contains(seenLabels, label.escapedText)) {
@@ -117280,20 +118262,20 @@
}
}
else {
- if (!(permittedJumps & (node.kind === 229 /* BreakStatement */ ? 1 /* Break */ : 2 /* Continue */))) {
+ if (!(permittedJumps & (node.kind === 230 /* BreakStatement */ ? 1 /* Break */ : 2 /* Continue */))) {
// attempt to break or continue in a forbidden context
(errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractRangeContainingConditionalBreakOrContinueStatements));
}
}
break;
}
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
rangeFacts |= RangeFacts.IsAsyncFunction;
break;
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
rangeFacts |= RangeFacts.IsGenerator;
break;
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
if (permittedJumps & 4 /* Return */) {
rangeFacts |= RangeFacts.HasReturn;
}
@@ -117347,7 +118329,7 @@
while (true) {
current = current.parent;
// A function parameter's initializer is actually in the outer scope, not the function declaration
- if (current.kind === 151 /* Parameter */) {
+ if (current.kind === 152 /* Parameter */) {
// Skip all the way to the outer scope of the function that declared this parameter
current = ts.findAncestor(current, function (parent) { return ts.isFunctionLikeDeclaration(parent); }).parent;
}
@@ -117358,7 +118340,7 @@
// * Module/namespace or source file
if (isScope(current)) {
scopes.push(current);
- if (current.kind === 284 /* SourceFile */) {
+ if (current.kind === 285 /* SourceFile */) {
return scopes;
}
}
@@ -117448,32 +118430,32 @@
}
function getDescriptionForFunctionLikeDeclaration(scope) {
switch (scope.kind) {
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return "constructor";
- case 196 /* FunctionExpression */:
- case 239 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
return scope.name
? "function '" + scope.name.text + "'"
: "anonymous function";
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return "arrow function";
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return "method '" + scope.name.getText() + "'";
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
return "'get " + scope.name.getText() + "'";
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
return "'set " + scope.name.getText() + "'";
default:
throw ts.Debug.assertNever(scope);
}
}
function getDescriptionForClassLikeDeclaration(scope) {
- return scope.kind === 240 /* ClassDeclaration */
+ return scope.kind === 241 /* ClassDeclaration */
? scope.name ? "class '" + scope.name.text + "'" : "anonymous class declaration"
: scope.name ? "class expression '" + scope.name.text + "'" : "anonymous class expression";
}
function getDescriptionForModuleLikeDeclaration(scope) {
- return scope.kind === 245 /* ModuleBlock */
+ return scope.kind === 246 /* ModuleBlock */
? "namespace '" + scope.parent.name.getText() + "'"
: scope.externalModuleIndicator ? 0 /* Module */ : 1 /* Global */;
}
@@ -117539,12 +118521,12 @@
var newFunction;
if (ts.isClassLike(scope)) {
// always create private method in TypeScript files
- var modifiers = isJS ? [] : [ts.createToken(113 /* PrivateKeyword */)];
+ var modifiers = isJS ? [] : [ts.createToken(114 /* PrivateKeyword */)];
if (range.facts & RangeFacts.InStaticRegion) {
- modifiers.push(ts.createToken(116 /* StaticKeyword */));
+ modifiers.push(ts.createToken(117 /* StaticKeyword */));
}
if (range.facts & RangeFacts.IsAsyncFunction) {
- modifiers.push(ts.createToken(121 /* AsyncKeyword */));
+ modifiers.push(ts.createToken(122 /* AsyncKeyword */));
}
newFunction = ts.createMethod(
/*decorators*/ undefined, modifiers.length ? modifiers : undefined, range.facts & RangeFacts.IsGenerator ? ts.createToken(40 /* AsteriskToken */) : undefined, functionName,
@@ -117552,7 +118534,7 @@
}
else {
newFunction = ts.createFunctionDeclaration(
- /*decorators*/ undefined, range.facts & RangeFacts.IsAsyncFunction ? [ts.createToken(121 /* AsyncKeyword */)] : undefined, range.facts & RangeFacts.IsGenerator ? ts.createToken(40 /* AsteriskToken */) : undefined, functionName, typeParameters, parameters, returnType, body);
+ /*decorators*/ undefined, range.facts & RangeFacts.IsAsyncFunction ? [ts.createToken(122 /* AsyncKeyword */)] : undefined, range.facts & RangeFacts.IsGenerator ? ts.createToken(40 /* AsteriskToken */) : undefined, functionName, typeParameters, parameters, returnType, body);
}
var changeTracker = ts.textChanges.ChangeTracker.fromContext(context);
var minInsertionPos = (isReadonlyArray(range.range) ? ts.last(range.range) : range.range).end;
@@ -117693,9 +118675,9 @@
while (ts.isParenthesizedTypeNode(withoutParens)) {
withoutParens = withoutParens.type;
}
- return ts.isUnionTypeNode(withoutParens) && ts.find(withoutParens.types, function (t) { return t.kind === 141 /* UndefinedKeyword */; })
+ return ts.isUnionTypeNode(withoutParens) && ts.find(withoutParens.types, function (t) { return t.kind === 142 /* UndefinedKeyword */; })
? clone
- : ts.createUnionTypeNode([clone, ts.createKeywordTypeNode(141 /* UndefinedKeyword */)]);
+ : ts.createUnionTypeNode([clone, ts.createKeywordTypeNode(142 /* UndefinedKeyword */)]);
}
}
/**
@@ -117718,11 +118700,11 @@
if (ts.isClassLike(scope)) {
ts.Debug.assert(!isJS); // See CannotExtractToJSClass
var modifiers = [];
- modifiers.push(ts.createToken(113 /* PrivateKeyword */));
+ modifiers.push(ts.createToken(114 /* PrivateKeyword */));
if (rangeFacts & RangeFacts.InStaticRegion) {
- modifiers.push(ts.createToken(116 /* StaticKeyword */));
+ modifiers.push(ts.createToken(117 /* StaticKeyword */));
}
- modifiers.push(ts.createToken(133 /* ReadonlyKeyword */));
+ modifiers.push(ts.createToken(134 /* ReadonlyKeyword */));
var newVariable = ts.createProperty(
/*decorators*/ undefined, modifiers, localNameText,
/*questionToken*/ undefined, variableType, initializer);
@@ -117751,7 +118733,7 @@
var localReference = ts.createIdentifier(localNameText);
changeTracker.replaceNode(context.file, node, localReference);
}
- else if (node.parent.kind === 221 /* ExpressionStatement */ && scope === ts.findAncestor(node, isScope)) {
+ else if (node.parent.kind === 222 /* ExpressionStatement */ && scope === ts.findAncestor(node, isScope)) {
// If the parent is an expression statement and the target scope is the immediately enclosing one,
// replace the statement with the declaration.
var newVariableStatement = ts.createVariableStatement(
@@ -117770,7 +118752,7 @@
changeTracker.insertNodeBefore(context.file, nodeToInsertBefore, newVariableStatement, /*blankLineBetween*/ false);
}
// Consume
- if (node.parent.kind === 221 /* ExpressionStatement */) {
+ if (node.parent.kind === 222 /* ExpressionStatement */) {
// If the parent is an expression statement, delete it.
changeTracker.delete(context.file, node.parent);
}
@@ -117857,7 +118839,7 @@
return { body: ts.createBlock(statements, /*multiLine*/ true), returnValueProperty: undefined };
}
function visitor(node) {
- if (!ignoreReturns && node.kind === 230 /* ReturnStatement */ && hasWritesOrVariableDeclarations) {
+ if (!ignoreReturns && node.kind === 231 /* ReturnStatement */ && hasWritesOrVariableDeclarations) {
var assignments = getPropertyAssignmentsForWritesAndVariableDeclarations(exposedVariableDeclarations, writes);
if (node.expression) {
if (!returnValueProperty) {
@@ -118035,7 +119017,7 @@
var scope = scopes_1[_i];
usagesPerScope.push({ usages: ts.createMap(), typeParameterUsages: ts.createMap(), substitutions: ts.createMap() });
substitutionsPerScope.push(ts.createMap());
- functionErrorsPerScope.push(ts.isFunctionLikeDeclaration(scope) && scope.kind !== 239 /* FunctionDeclaration */
+ functionErrorsPerScope.push(ts.isFunctionLikeDeclaration(scope) && scope.kind !== 240 /* FunctionDeclaration */
? [ts.createDiagnosticForNode(scope, Messages.cannotExtractToOtherFunctionLike)]
: []);
var constantErrors = [];
@@ -118351,30 +119333,30 @@
function isExtractableExpression(node) {
var parent = node.parent;
switch (parent.kind) {
- case 278 /* EnumMember */:
+ case 279 /* EnumMember */:
return false;
}
switch (node.kind) {
case 10 /* StringLiteral */:
- return parent.kind !== 249 /* ImportDeclaration */ &&
- parent.kind !== 253 /* ImportSpecifier */;
- case 208 /* SpreadElement */:
- case 184 /* ObjectBindingPattern */:
- case 186 /* BindingElement */:
- return false;
- case 72 /* Identifier */:
- return parent.kind !== 186 /* BindingElement */ &&
- parent.kind !== 253 /* ImportSpecifier */ &&
- parent.kind !== 257 /* ExportSpecifier */;
+ return parent.kind !== 250 /* ImportDeclaration */ &&
+ parent.kind !== 254 /* ImportSpecifier */;
+ case 209 /* SpreadElement */:
+ case 185 /* ObjectBindingPattern */:
+ case 187 /* BindingElement */:
+ return false;
+ case 73 /* Identifier */:
+ return parent.kind !== 187 /* BindingElement */ &&
+ parent.kind !== 254 /* ImportSpecifier */ &&
+ parent.kind !== 258 /* ExportSpecifier */;
}
return true;
}
function isBlockLike(node) {
switch (node.kind) {
- case 218 /* Block */:
- case 284 /* SourceFile */:
- case 245 /* ModuleBlock */:
- case 271 /* CaseClause */:
+ case 219 /* Block */:
+ case 285 /* SourceFile */:
+ case 246 /* ModuleBlock */:
+ case 272 /* CaseClause */:
return true;
default:
return false;
@@ -118388,6 +119370,136 @@
(function (ts) {
var refactor;
(function (refactor) {
+ var refactorName = "Extract type";
+ var extractToTypeAlias = "Extract to type alias";
+ var extractToTypeDef = "Extract to typedef";
+ refactor.registerRefactor(refactorName, {
+ getAvailableActions: function (context) {
+ var info = getRangeToExtract(context);
+ if (!info)
+ return ts.emptyArray;
+ return [{
+ name: refactorName,
+ description: ts.getLocaleSpecificMessage(ts.Diagnostics.Extract_type),
+ actions: [info.isJS ? {
+ name: extractToTypeDef, description: ts.getLocaleSpecificMessage(ts.Diagnostics.Extract_to_typedef)
+ } : {
+ name: extractToTypeAlias, description: ts.getLocaleSpecificMessage(ts.Diagnostics.Extract_to_type_alias)
+ }]
+ }];
+ },
+ getEditsForAction: function (context, actionName) {
+ ts.Debug.assert(actionName === extractToTypeAlias || actionName === extractToTypeDef);
+ var file = context.file;
+ var info = ts.Debug.assertDefined(getRangeToExtract(context));
+ ts.Debug.assert(actionName === extractToTypeAlias && !info.isJS || actionName === extractToTypeDef && info.isJS);
+ var name = ts.getUniqueName("NewType", file);
+ var edits = ts.textChanges.ChangeTracker.with(context, function (changes) { return info.isJS ?
+ doTypedefChange(changes, file, name, info.firstStatement, info.selection, info.typeParameters) :
+ doTypeAliasChange(changes, file, name, info.firstStatement, info.selection, info.typeParameters); });
+ var renameFilename = file.fileName;
+ var renameLocation = ts.getRenameLocation(edits, renameFilename, name, /*preferLastLocation*/ false);
+ return { edits: edits, renameFilename: renameFilename, renameLocation: renameLocation };
+ }
+ });
+ function getRangeToExtract(context) {
+ var file = context.file, startPosition = context.startPosition;
+ var isJS = ts.isSourceFileJS(file);
+ var current = ts.getTokenAtPosition(file, startPosition);
+ var range = ts.createTextRangeFromSpan(ts.getRefactorContextSpan(context));
+ var selection = ts.findAncestor(current, (function (node) { return node.parent && rangeContainsSkipTrivia(range, node, file) && !rangeContainsSkipTrivia(range, node.parent, file); }));
+ if (!selection || !ts.isTypeNode(selection))
+ return undefined;
+ var checker = context.program.getTypeChecker();
+ var firstStatement = ts.Debug.assertDefined(isJS ? ts.findAncestor(selection, isStatementAndHasJSDoc) : ts.findAncestor(selection, ts.isStatement));
+ var typeParameters = collectTypeParameters(checker, selection, firstStatement, file);
+ if (!typeParameters)
+ return undefined;
+ return { isJS: isJS, selection: selection, firstStatement: firstStatement, typeParameters: typeParameters };
+ }
+ function isStatementAndHasJSDoc(n) {
+ return ts.isStatement(n) && ts.hasJSDocNodes(n);
+ }
+ function rangeContainsSkipTrivia(r1, node, file) {
+ return ts.rangeContainsStartEnd(r1, ts.skipTrivia(file.text, node.pos), node.end);
+ }
+ function collectTypeParameters(checker, selection, statement, file) {
+ var result = [];
+ return visitor(selection) ? undefined : result;
+ function visitor(node) {
+ if (ts.isTypeReferenceNode(node)) {
+ if (ts.isIdentifier(node.typeName)) {
+ var symbol = checker.resolveName(node.typeName.text, node.typeName, 262144 /* TypeParameter */, /* excludeGlobals */ true);
+ if (symbol) {
+ var declaration = ts.cast(ts.first(symbol.declarations), ts.isTypeParameterDeclaration);
+ if (rangeContainsSkipTrivia(statement, declaration, file) && !rangeContainsSkipTrivia(selection, declaration, file)) {
+ result.push(declaration);
+ }
+ }
+ }
+ }
+ else if (ts.isInferTypeNode(node)) {
+ var conditionalTypeNode = ts.findAncestor(node, function (n) { return ts.isConditionalTypeNode(n) && rangeContainsSkipTrivia(n.extendsType, node, file); });
+ if (!conditionalTypeNode || !rangeContainsSkipTrivia(selection, conditionalTypeNode, file)) {
+ return true;
+ }
+ }
+ else if ((ts.isTypePredicateNode(node) || ts.isThisTypeNode(node))) {
+ var functionLikeNode = ts.findAncestor(node.parent, ts.isFunctionLike);
+ if (functionLikeNode && functionLikeNode.type && rangeContainsSkipTrivia(functionLikeNode.type, node, file) && !rangeContainsSkipTrivia(selection, functionLikeNode, file)) {
+ return true;
+ }
+ }
+ else if (ts.isTypeQueryNode(node)) {
+ if (ts.isIdentifier(node.exprName)) {
+ var symbol = checker.resolveName(node.exprName.text, node.exprName, 67220415 /* Value */, /* excludeGlobals */ false);
+ if (symbol && rangeContainsSkipTrivia(statement, symbol.valueDeclaration, file) && !rangeContainsSkipTrivia(selection, symbol.valueDeclaration, file)) {
+ return true;
+ }
+ }
+ else {
+ if (ts.isThisIdentifier(node.exprName.left) && !rangeContainsSkipTrivia(selection, node.parent, file)) {
+ return true;
+ }
+ }
+ }
+ return ts.forEachChild(node, visitor);
+ }
+ }
+ function doTypeAliasChange(changes, file, name, firstStatement, selection, typeParameters) {
+ var newTypeNode = ts.createTypeAliasDeclaration(
+ /* decorators */ undefined,
+ /* modifiers */ undefined, name, typeParameters.map(function (id) { return ts.updateTypeParameterDeclaration(id, id.name, id.constraint, /* defaultType */ undefined); }), selection);
+ changes.insertNodeBefore(file, firstStatement, newTypeNode, /* blankLineBetween */ true);
+ changes.replaceNode(file, selection, ts.createTypeReferenceNode(name, typeParameters.map(function (id) { return ts.createTypeReferenceNode(id.name, /* typeArguments */ undefined); })));
+ }
+ function doTypedefChange(changes, file, name, firstStatement, selection, typeParameters) {
+ var node = ts.createNode(310 /* JSDocTypedefTag */);
+ node.tagName = ts.createIdentifier("typedef"); // TODO: jsdoc factory https://github.com/Microsoft/TypeScript/pull/29539
+ node.fullName = ts.createIdentifier(name);
+ node.name = node.fullName;
+ node.typeExpression = ts.createJSDocTypeExpression(selection);
+ var templates = [];
+ ts.forEach(typeParameters, function (typeParameter) {
+ var constraint = ts.getEffectiveConstraintOfTypeParameter(typeParameter);
+ var template = ts.createNode(309 /* JSDocTemplateTag */);
+ template.tagName = ts.createIdentifier("template");
+ template.constraint = constraint && ts.cast(constraint, ts.isJSDocTypeExpression);
+ var parameter = ts.createNode(151 /* TypeParameter */);
+ parameter.name = typeParameter.name;
+ template.typeParameters = ts.createNodeArray([parameter]);
+ templates.push(template);
+ });
+ changes.insertNodeBefore(file, firstStatement, ts.createJSDocComment(/* comment */ undefined, ts.createNodeArray(ts.concatenate(templates, [node]))), /* blankLineBetween */ true);
+ changes.replaceNode(file, selection, ts.createTypeReferenceNode(name, typeParameters.map(function (id) { return ts.createTypeReferenceNode(id.name, /* typeArguments */ undefined); })));
+ }
+ })(refactor = ts.refactor || (ts.refactor = {}));
+})(ts || (ts = {}));
+/* @internal */
+var ts;
+(function (ts) {
+ var refactor;
+ (function (refactor) {
var generateGetAccessorAndSetAccessor;
(function (generateGetAccessorAndSetAccessor) {
var actionName = "Generate 'get' and 'set' accessors";
@@ -118423,10 +119535,10 @@
var modifierFlags = ts.getModifierFlags(declaration) & ~64 /* Readonly */;
var accessorModifiers = isInClassLike
? !modifierFlags || modifierFlags & 8 /* Private */
- ? getModifiers(isJS, isStatic, 115 /* PublicKeyword */)
+ ? getModifiers(isJS, isStatic, 116 /* PublicKeyword */)
: ts.createNodeArray(ts.createModifiersFromModifierFlags(modifierFlags))
: undefined;
- var fieldModifiers = isInClassLike ? getModifiers(isJS, isStatic, 113 /* PrivateKeyword */) : undefined;
+ var fieldModifiers = isInClassLike ? getModifiers(isJS, isStatic, 114 /* PrivateKeyword */) : undefined;
updateFieldDeclaration(changeTracker, file, declaration, fieldName, fieldModifiers);
var getAccessor = generateGetAccessor(fieldName, accessorName, type, accessorModifiers, isStatic, container);
ts.suppressLeadingAndTrailingTrivia(getAccessor);
@@ -118464,7 +119576,7 @@
return ts.isIdentifier(fieldName) ? ts.createPropertyAccess(leftHead, fieldName) : ts.createElementAccess(leftHead, ts.createLiteral(fieldName));
}
function getModifiers(isJS, isStatic, accessModifier) {
- var modifiers = ts.append(!isJS ? [ts.createToken(accessModifier)] : undefined, isStatic ? ts.createToken(116 /* StaticKeyword */) : undefined);
+ var modifiers = ts.append(!isJS ? [ts.createToken(accessModifier)] : undefined, isStatic ? ts.createToken(117 /* StaticKeyword */) : undefined);
return modifiers && ts.createNodeArray(modifiers);
}
function startsWithUnderscore(name) {
@@ -118487,7 +119599,7 @@
isStatic: ts.hasStaticModifier(declaration),
isReadonly: ts.hasReadonlyModifier(declaration),
type: ts.getTypeAnnotationNode(declaration),
- container: declaration.kind === 151 /* Parameter */ ? declaration.parent.parent : declaration.parent,
+ container: declaration.kind === 152 /* Parameter */ ? declaration.parent.parent : declaration.parent,
originalName: declaration.name.text,
declaration: declaration,
fieldName: fieldName,
@@ -118544,13 +119656,13 @@
return;
constructor.body.forEachChild(function recur(node) {
if (ts.isElementAccessExpression(node) &&
- node.expression.kind === 100 /* ThisKeyword */ &&
+ node.expression.kind === 101 /* ThisKeyword */ &&
ts.isStringLiteral(node.argumentExpression) &&
node.argumentExpression.text === originalName &&
ts.isWriteAccess(node)) {
changeTracker.replaceNode(file, node.argumentExpression, ts.createStringLiteral(fieldName));
}
- if (ts.isPropertyAccessExpression(node) && node.expression.kind === 100 /* ThisKeyword */ && node.name.text === originalName && ts.isWriteAccess(node)) {
+ if (ts.isPropertyAccessExpression(node) && node.expression.kind === 101 /* ThisKeyword */ && node.name.text === originalName && ts.isWriteAccess(node)) {
changeTracker.replaceNode(file, node.name, ts.createIdentifier(fieldName));
}
if (!ts.isFunctionLike(node) && !ts.isClassLike(node)) {
@@ -118632,11 +119744,11 @@
}
function isPureImport(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return true;
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return !ts.hasModifier(node, 1 /* Export */);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return node.declarationList.declarations.every(function (d) { return !!d.initializer && ts.isRequireCall(d.initializer, /*checkArgumentIsStringLiteralLike*/ true); });
default:
return false;
@@ -118724,19 +119836,19 @@
}
function getNamespaceLikeImport(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
- return node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 251 /* NamespaceImport */ ?
+ case 250 /* ImportDeclaration */:
+ return node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 252 /* NamespaceImport */ ?
node.importClause.namedBindings.name : undefined;
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return node.name;
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return ts.tryCast(node.name, ts.isIdentifier);
default:
return ts.Debug.assertNever(node);
}
}
function updateNamespaceLikeImport(changes, sourceFile, checker, movedSymbols, newModuleName, newModuleSpecifier, oldImportId, oldImportNode) {
- var preferredNewNamespaceName = ts.codefix.moduleSpecifierToValidIdentifier(newModuleName, 7 /* ESNext */);
+ var preferredNewNamespaceName = ts.codefix.moduleSpecifierToValidIdentifier(newModuleName, 8 /* ESNext */);
var needUniqueName = false;
var toChange = [];
ts.FindAllReferences.Core.eachSymbolReferenceInFile(oldImportId, checker, sourceFile, function (ref) {
@@ -118760,20 +119872,20 @@
var newNamespaceId = ts.createIdentifier(newNamespaceName);
var newModuleString = ts.createLiteral(newModuleSpecifier);
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return ts.createImportDeclaration(
/*decorators*/ undefined, /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(newNamespaceId)), newModuleString);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return ts.createImportEqualsDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, newNamespaceId, ts.createExternalModuleReference(newModuleString));
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return ts.createVariableDeclaration(newNamespaceId, /*type*/ undefined, createRequireCall(newModuleString));
default:
return ts.Debug.assertNever(node);
}
}
function moduleSpecifierFromImport(i) {
- return (i.kind === 249 /* ImportDeclaration */ ? i.moduleSpecifier
- : i.kind === 248 /* ImportEqualsDeclaration */ ? i.moduleReference.expression
+ return (i.kind === 250 /* ImportDeclaration */ ? i.moduleSpecifier
+ : i.kind === 249 /* ImportEqualsDeclaration */ ? i.moduleReference.expression
: i.initializer.arguments[0]);
}
function forEachImportInStatement(statement, cb) {
@@ -118843,15 +119955,15 @@
}
function deleteUnusedImports(sourceFile, importDecl, changes, isUnused) {
switch (importDecl.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
deleteUnusedImportsInDeclaration(sourceFile, importDecl, changes, isUnused);
break;
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
if (isUnused(importDecl.name)) {
changes.delete(sourceFile, importDecl);
}
break;
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
deleteUnusedImportsInVariableDeclaration(sourceFile, importDecl, changes, isUnused);
break;
default:
@@ -118864,7 +119976,7 @@
var _a = importDecl.importClause, name = _a.name, namedBindings = _a.namedBindings;
var defaultUnused = !name || isUnused(name);
var namedBindingsUnused = !namedBindings ||
- (namedBindings.kind === 251 /* NamespaceImport */ ? isUnused(namedBindings.name) : namedBindings.elements.length !== 0 && namedBindings.elements.every(function (e) { return isUnused(e.name); }));
+ (namedBindings.kind === 252 /* NamespaceImport */ ? isUnused(namedBindings.name) : namedBindings.elements.length !== 0 && namedBindings.elements.every(function (e) { return isUnused(e.name); }));
if (defaultUnused && namedBindingsUnused) {
changes.delete(sourceFile, importDecl);
}
@@ -118876,7 +119988,7 @@
if (namedBindingsUnused) {
changes.delete(sourceFile, namedBindings);
}
- else if (namedBindings.kind === 252 /* NamedImports */) {
+ else if (namedBindings.kind === 253 /* NamedImports */) {
for (var _i = 0, _b = namedBindings.elements; _i < _b.length; _i++) {
var element = _b[_i];
if (isUnused(element.name))
@@ -118889,14 +120001,14 @@
function deleteUnusedImportsInVariableDeclaration(sourceFile, varDecl, changes, isUnused) {
var name = varDecl.name;
switch (name.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
if (isUnused(name)) {
changes.delete(sourceFile, name);
}
break;
- case 185 /* ArrayBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
break;
- case 184 /* ObjectBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
if (name.elements.every(function (e) { return ts.isIdentifier(e.name) && isUnused(e.name); })) {
changes.delete(sourceFile, ts.isVariableDeclarationList(varDecl.parent) && varDecl.parent.declarations.length === 1 ? varDecl.parent.parent : varDecl);
}
@@ -119023,13 +120135,13 @@
// Below should all be utilities
function isInImport(decl) {
switch (decl.kind) {
- case 248 /* ImportEqualsDeclaration */:
- case 253 /* ImportSpecifier */:
- case 250 /* ImportClause */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 254 /* ImportSpecifier */:
+ case 251 /* ImportClause */:
return true;
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return isVariableDeclarationInImport(decl);
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return ts.isVariableDeclaration(decl.parent.parent) && isVariableDeclarationInImport(decl.parent.parent);
default:
return false;
@@ -119041,7 +120153,7 @@
}
function filterImport(i, moduleSpecifier, keep) {
switch (i.kind) {
- case 249 /* ImportDeclaration */: {
+ case 250 /* ImportDeclaration */: {
var clause = i.importClause;
if (!clause)
return undefined;
@@ -119051,9 +120163,9 @@
? ts.createImportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, ts.createImportClause(defaultImport, namedBindings), moduleSpecifier)
: undefined;
}
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return keep(i.name) ? i : undefined;
- case 237 /* VariableDeclaration */: {
+ case 238 /* VariableDeclaration */: {
var name = filterBindingName(i.name, keep);
return name ? makeVariableStatement(name, i.type, createRequireCall(moduleSpecifier), i.parent.flags) : undefined;
}
@@ -119062,7 +120174,7 @@
}
}
function filterNamedBindings(namedBindings, keep) {
- if (namedBindings.kind === 251 /* NamespaceImport */) {
+ if (namedBindings.kind === 252 /* NamespaceImport */) {
return keep(namedBindings.name) ? namedBindings : undefined;
}
else {
@@ -119072,11 +120184,11 @@
}
function filterBindingName(name, keep) {
switch (name.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return keep(name) ? name : undefined;
- case 185 /* ArrayBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
return name;
- case 184 /* ObjectBindingPattern */: {
+ case 185 /* ObjectBindingPattern */: {
// We can't handle nested destructurings or property names well here, so just copy them all.
var newElements = name.elements.filter(function (prop) { return prop.propertyName || !ts.isIdentifier(prop.name) || keep(prop.name); });
return newElements.length ? ts.createObjectBindingPattern(newElements) : undefined;
@@ -119133,13 +120245,13 @@
}
function isNonVariableTopLevelDeclaration(node) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 240 /* ClassDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 243 /* EnumDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return true;
default:
return false;
@@ -119147,17 +120259,17 @@
}
function forEachTopLevelDeclaration(statement, cb) {
switch (statement.kind) {
- case 239 /* FunctionDeclaration */:
- case 240 /* ClassDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 243 /* EnumDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return cb(statement);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return ts.firstDefined(statement.declarationList.declarations, function (decl) { return forEachTopLevelDeclarationInBindingName(decl.name, cb); });
- case 221 /* ExpressionStatement */: {
+ case 222 /* ExpressionStatement */: {
var expression = statement.expression;
return ts.isBinaryExpression(expression) && ts.getAssignmentDeclarationKind(expression) === 1 /* ExportsProperty */
? cb(statement)
@@ -119167,10 +120279,10 @@
}
function forEachTopLevelDeclarationInBindingName(name, cb) {
switch (name.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return cb(ts.cast(name.parent, function (x) { return ts.isVariableDeclaration(x) || ts.isBindingElement(x); }));
- case 185 /* ArrayBindingPattern */:
- case 184 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
return ts.firstDefined(name.elements, function (em) { return ts.isOmittedExpression(em) ? undefined : forEachTopLevelDeclarationInBindingName(em.name, cb); });
default:
return ts.Debug.assertNever(name);
@@ -119181,9 +120293,9 @@
}
function getTopLevelDeclarationStatement(d) {
switch (d.kind) {
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return d.parent.parent;
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return getTopLevelDeclarationStatement(ts.cast(d.parent.parent, function (p) { return ts.isVariableDeclaration(p) || ts.isBindingElement(p); }));
default:
return d;
@@ -119214,25 +120326,25 @@
return useEs6Exports ? [addEs6Export(decl)] : addCommonjsExport(decl);
}
function addEs6Export(d) {
- var modifiers = ts.concatenate([ts.createModifier(85 /* ExportKeyword */)], d.modifiers);
+ var modifiers = ts.concatenate([ts.createModifier(86 /* ExportKeyword */)], d.modifiers);
switch (d.kind) {
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return ts.updateFunctionDeclaration(d, d.decorators, modifiers, d.asteriskToken, d.name, d.typeParameters, d.parameters, d.type, d.body);
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return ts.updateClassDeclaration(d, d.decorators, modifiers, d.name, d.typeParameters, d.heritageClauses, d.members);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return ts.updateVariableStatement(d, modifiers, d.declarationList);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return ts.updateModuleDeclaration(d, d.decorators, modifiers, d.name, d.body);
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return ts.updateEnumDeclaration(d, d.decorators, modifiers, d.name, d.members);
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return ts.updateTypeAliasDeclaration(d, d.decorators, modifiers, d.name, d.typeParameters, d.type);
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
return ts.updateInterfaceDeclaration(d, d.decorators, modifiers, d.name, d.typeParameters, d.heritageClauses, d.members);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return ts.updateImportEqualsDeclaration(d, d.decorators, modifiers, d.name, d.moduleReference);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return ts.Debug.fail(); // Shouldn't try to add 'export' keyword to `exports.x = ...`
default:
return ts.Debug.assertNever(d);
@@ -119243,18 +120355,18 @@
}
function getNamesToExportInCommonJS(decl) {
switch (decl.kind) {
- case 239 /* FunctionDeclaration */:
- case 240 /* ClassDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
return [decl.name.text]; // TODO: GH#18217
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return ts.mapDefined(decl.declarationList.declarations, function (d) { return ts.isIdentifier(d.name) ? d.name.text : undefined; });
- case 244 /* ModuleDeclaration */:
- case 243 /* EnumDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return ts.emptyArray;
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return ts.Debug.fail(); // Shouldn't try to add 'export' keyword to `exports.x = ...`
default:
return ts.Debug.assertNever(decl);
@@ -119262,7 +120374,7 @@
}
/** Creates `exports.x = x;` */
function createExportAssignment(name) {
- return ts.createExpressionStatement(ts.createBinary(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.createIdentifier(name)), 59 /* EqualsToken */, ts.createIdentifier(name)));
+ return ts.createExpressionStatement(ts.createBinary(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.createIdentifier(name)), 60 /* EqualsToken */, ts.createIdentifier(name)));
}
})(refactor = ts.refactor || (ts.refactor = {}));
})(ts || (ts = {}));
@@ -119428,8 +120540,8 @@
function groupReferences(referenceEntries) {
var classReferences = { accessExpressions: [], typeUsages: [] };
var groupedReferences = { functionCalls: [], declarations: [], classReferences: classReferences, valid: true };
- var functionSymbols = ts.map(functionNames, checker.getSymbolAtLocation);
- var classSymbols = ts.map(classNames, checker.getSymbolAtLocation);
+ var functionSymbols = ts.map(functionNames, getSymbolTargetAtLocation);
+ var classSymbols = ts.map(classNames, getSymbolTargetAtLocation);
var isConstructor = ts.isConstructorDeclaration(functionDeclaration);
for (var _i = 0, referenceEntries_1 = referenceEntries; _i < referenceEntries_1.length; _i++) {
var entry = referenceEntries_1[_i];
@@ -119448,7 +120560,11 @@
So we need to add a special case for this because when calling a constructor of a class through one of its subclasses,
the symbols are going to be different.
*/
- if (ts.contains(functionSymbols, checker.getSymbolAtLocation(entry.node), symbolComparer) || ts.isNewExpressionTarget(entry.node)) {
+ if (ts.contains(functionSymbols, getSymbolTargetAtLocation(entry.node)) || ts.isNewExpressionTarget(entry.node)) {
+ var importOrExportReference = entryToImportOrExport(entry);
+ if (importOrExportReference) {
+ continue;
+ }
var decl = entryToDeclaration(entry);
if (decl) {
groupedReferences.declarations.push(decl);
@@ -119461,7 +120577,11 @@
}
}
// if the refactored function is a constructor, we must also check if the references to its class are valid
- if (isConstructor && ts.contains(classSymbols, checker.getSymbolAtLocation(entry.node), symbolComparer)) {
+ if (isConstructor && ts.contains(classSymbols, getSymbolTargetAtLocation(entry.node))) {
+ var importOrExportReference = entryToImportOrExport(entry);
+ if (importOrExportReference) {
+ continue;
+ }
var decl = entryToDeclaration(entry);
if (decl) {
groupedReferences.declarations.push(decl);
@@ -119486,9 +120606,23 @@
}
return groupedReferences;
}
+ function getSymbolTargetAtLocation(node) {
+ var symbol = checker.getSymbolAtLocation(node);
+ return symbol && ts.getSymbolTarget(symbol, checker);
+ }
}
- function symbolComparer(a, b) {
- return ts.getSymbolTarget(a) === ts.getSymbolTarget(b);
+ function entryToImportOrExport(entry) {
+ var node = entry.node;
+ if (ts.isImportSpecifier(node.parent)
+ || ts.isImportClause(node.parent)
+ || ts.isImportEqualsDeclaration(node.parent)
+ || ts.isNamespaceImport(node.parent)) {
+ return node;
+ }
+ if (ts.isExportSpecifier(node.parent) || ts.isExportAssignment(node.parent)) {
+ return node;
+ }
+ return undefined;
}
function entryToDeclaration(entry) {
if (ts.isDeclaration(entry.node.parent)) {
@@ -119501,37 +120635,31 @@
var functionReference = entry.node;
var parent = functionReference.parent;
switch (parent.kind) {
- // Function call (foo(...) or super(...))
- case 191 /* CallExpression */:
- var callExpression = ts.tryCast(parent, ts.isCallExpression);
- if (callExpression && callExpression.expression === functionReference) {
- return callExpression;
- }
- break;
- // Constructor call (new Foo(...))
- case 192 /* NewExpression */:
- var newExpression = ts.tryCast(parent, ts.isNewExpression);
- if (newExpression && newExpression.expression === functionReference) {
- return newExpression;
+ // foo(...) or super(...) or new Foo(...)
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
+ var callOrNewExpression = ts.tryCast(parent, ts.isCallOrNewExpression);
+ if (callOrNewExpression && callOrNewExpression.expression === functionReference) {
+ return callOrNewExpression;
}
break;
- // Method call (x.foo(...))
- case 189 /* PropertyAccessExpression */:
+ // x.foo(...)
+ case 190 /* PropertyAccessExpression */:
var propertyAccessExpression = ts.tryCast(parent, ts.isPropertyAccessExpression);
if (propertyAccessExpression && propertyAccessExpression.parent && propertyAccessExpression.name === functionReference) {
- var callExpression_1 = ts.tryCast(propertyAccessExpression.parent, ts.isCallExpression);
- if (callExpression_1 && callExpression_1.expression === propertyAccessExpression) {
- return callExpression_1;
+ var callOrNewExpression_1 = ts.tryCast(propertyAccessExpression.parent, ts.isCallOrNewExpression);
+ if (callOrNewExpression_1 && callOrNewExpression_1.expression === propertyAccessExpression) {
+ return callOrNewExpression_1;
}
}
break;
- // Method call (x["foo"](...))
- case 190 /* ElementAccessExpression */:
+ // x["foo"](...)
+ case 191 /* ElementAccessExpression */:
var elementAccessExpression = ts.tryCast(parent, ts.isElementAccessExpression);
if (elementAccessExpression && elementAccessExpression.parent && elementAccessExpression.argumentExpression === functionReference) {
- var callExpression_2 = ts.tryCast(elementAccessExpression.parent, ts.isCallExpression);
- if (callExpression_2 && callExpression_2.expression === elementAccessExpression) {
- return callExpression_2;
+ var callOrNewExpression_2 = ts.tryCast(elementAccessExpression.parent, ts.isCallOrNewExpression);
+ if (callOrNewExpression_2 && callOrNewExpression_2.expression === elementAccessExpression) {
+ return callOrNewExpression_2;
}
}
break;
@@ -119545,14 +120673,14 @@
var parent = reference.parent;
switch (parent.kind) {
// `C.foo`
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
var propertyAccessExpression = ts.tryCast(parent, ts.isPropertyAccessExpression);
if (propertyAccessExpression && propertyAccessExpression.expression === reference) {
return propertyAccessExpression;
}
break;
// `C["foo"]`
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
var elementAccessExpression = ts.tryCast(parent, ts.isElementAccessExpression);
if (elementAccessExpression && elementAccessExpression.expression === reference) {
return elementAccessExpression;
@@ -119571,7 +120699,7 @@
}
function getFunctionDeclarationAtPosition(file, startPosition, checker) {
var node = ts.getTouchingToken(file, startPosition);
- var functionDeclaration = ts.getContainingFunction(node);
+ var functionDeclaration = ts.getContainingFunctionDeclaration(node);
// don't offer refactor on top-level JSDoc
if (isTopLevelJSDoc(node))
return undefined;
@@ -119594,28 +120722,34 @@
if (!isValidParameterNodeArray(functionDeclaration.parameters, checker))
return false;
switch (functionDeclaration.kind) {
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
- return !!functionDeclaration.name
- && !!functionDeclaration.body
- && !checker.isImplementationOfOverload(functionDeclaration);
- case 157 /* Constructor */:
+ case 240 /* FunctionDeclaration */:
+ return hasNameOrDefault(functionDeclaration) && isSingleImplementation(functionDeclaration, checker);
+ case 157 /* MethodDeclaration */:
+ return isSingleImplementation(functionDeclaration, checker);
+ case 158 /* Constructor */:
if (ts.isClassDeclaration(functionDeclaration.parent)) {
- return !!functionDeclaration.body
- && !!functionDeclaration.parent.name
- && !checker.isImplementationOfOverload(functionDeclaration);
+ return hasNameOrDefault(functionDeclaration.parent) && isSingleImplementation(functionDeclaration, checker);
}
else {
return isValidVariableDeclaration(functionDeclaration.parent.parent)
- && !!functionDeclaration.body
- && !checker.isImplementationOfOverload(functionDeclaration);
+ && isSingleImplementation(functionDeclaration, checker);
}
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return isValidVariableDeclaration(functionDeclaration.parent);
}
return false;
}
+ function isSingleImplementation(functionDeclaration, checker) {
+ return !!functionDeclaration.body && !checker.isImplementationOfOverload(functionDeclaration);
+ }
+ function hasNameOrDefault(functionOrClassDeclaration) {
+ if (!functionOrClassDeclaration.name) {
+ var defaultKeyword = ts.findModifier(functionOrClassDeclaration, 81 /* DefaultKeyword */);
+ return !!defaultKeyword;
+ }
+ return true;
+ }
function isValidParameterNodeArray(parameters, checker) {
return getRefactorableParametersLength(parameters) >= minimumParameterLength
&& ts.every(parameters, /*callback*/ function (/*callback*/ paramDecl) { return isValidParameterDeclaration(paramDecl, checker); });
@@ -119772,10 +120906,15 @@
}
function getClassNames(constructorDeclaration) {
switch (constructorDeclaration.parent.kind) {
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
var classDeclaration = constructorDeclaration.parent;
+ if (classDeclaration.name)
return [classDeclaration.name];
- case 209 /* ClassExpression */:
+ // If the class declaration doesn't have a name, it should have a default modifier.
+ // We validated this in `isValidFunctionDeclaration` through `hasNameOrDefault`
+ var defaultModifier = ts.Debug.assertDefined(ts.findModifier(classDeclaration, 81 /* DefaultKeyword */), "Nameless class declaration should be a default export");
+ return [defaultModifier];
+ case 210 /* ClassExpression */:
var classExpression = constructorDeclaration.parent;
var variableDeclaration = constructorDeclaration.parent.parent;
var className = classExpression.name;
@@ -119786,19 +120925,25 @@
}
function getFunctionNames(functionDeclaration) {
switch (functionDeclaration.kind) {
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ if (functionDeclaration.name)
return [functionDeclaration.name];
- case 157 /* Constructor */:
- var ctrKeyword = ts.findChildOfKind(functionDeclaration, 124 /* ConstructorKeyword */, functionDeclaration.getSourceFile());
- if (functionDeclaration.parent.kind === 209 /* ClassExpression */) {
+ // If the function declaration doesn't have a name, it should have a default modifier.
+ // We validated this in `isValidFunctionDeclaration` through `hasNameOrDefault`
+ var defaultModifier = ts.Debug.assertDefined(ts.findModifier(functionDeclaration, 81 /* DefaultKeyword */), "Nameless function declaration should be a default export");
+ return [defaultModifier];
+ case 157 /* MethodDeclaration */:
+ return [functionDeclaration.name];
+ case 158 /* Constructor */:
+ var ctrKeyword = ts.Debug.assertDefined(ts.findChildOfKind(functionDeclaration, 125 /* ConstructorKeyword */, functionDeclaration.getSourceFile()), "Constructor declaration should have constructor keyword");
+ if (functionDeclaration.parent.kind === 210 /* ClassExpression */) {
var variableDeclaration = functionDeclaration.parent.parent;
return [variableDeclaration.name, ctrKeyword];
}
return [ctrKeyword];
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return [functionDeclaration.parent.name];
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
if (functionDeclaration.name)
return [functionDeclaration.name, functionDeclaration.parent.name];
return [functionDeclaration.parent.name];
@@ -119815,7 +120960,7 @@
ts.servicesVersion = "0.8";
function createNode(kind, pos, end, parent) {
var node = ts.isNodeKind(kind) ? new NodeObject(kind, pos, end) :
- kind === 72 /* Identifier */ ? new IdentifierObject(72 /* Identifier */, pos, end) :
+ kind === 73 /* Identifier */ ? new IdentifierObject(73 /* Identifier */, pos, end) :
new TokenObject(kind, pos, end);
node.parent = parent;
node.flags = parent.flags & 12679168 /* ContextFlags */;
@@ -119889,8 +121034,8 @@
if (!children.length) {
return undefined;
}
- var child = ts.find(children, function (kid) { return kid.kind < 288 /* FirstJSDocNode */ || kid.kind > 310 /* LastJSDocNode */; });
- return child.kind < 148 /* FirstNode */ ?
+ var child = ts.find(children, function (kid) { return kid.kind < 289 /* FirstJSDocNode */ || kid.kind > 311 /* LastJSDocNode */; });
+ return child.kind < 149 /* FirstNode */ ?
child :
child.getFirstToken(sourceFile);
};
@@ -119901,7 +121046,7 @@
if (!child) {
return undefined;
}
- return child.kind < 148 /* FirstNode */ ? child : child.getLastToken(sourceFile);
+ return child.kind < 149 /* FirstNode */ ? child : child.getLastToken(sourceFile);
};
NodeObject.prototype.forEachChild = function (cbNode, cbNodeArray) {
return ts.forEachChild(this, cbNode, cbNodeArray);
@@ -119947,8 +121092,8 @@
var token = ts.scanner.scan();
var textPos = ts.scanner.getTextPos();
if (textPos <= end) {
- if (token === 72 /* Identifier */) {
- ts.Debug.fail("Did not expect " + ts.Debug.showSyntaxKind(parent) + " to have an Identifier in its trivia");
+ if (token === 73 /* Identifier */) {
+ ts.Debug.fail("Did not expect " + ts.Debug.formatSyntaxKind(parent.kind) + " to have an Identifier in its trivia");
}
nodes.push(createNode(token, pos, textPos, parent));
}
@@ -119959,7 +121104,7 @@
}
}
function createSyntaxList(nodes, parent) {
- var list = createNode(311 /* SyntaxList */, nodes.pos, nodes.end, parent);
+ var list = createNode(312 /* SyntaxList */, nodes.pos, nodes.end, parent);
list._children = [];
var pos = nodes.pos;
for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
@@ -120093,7 +121238,7 @@
});
return IdentifierObject;
}(TokenOrIdentifierObject));
- IdentifierObject.prototype.kind = 72 /* Identifier */;
+ IdentifierObject.prototype.kind = 73 /* Identifier */;
var TypeObject = /** @class */ (function () {
function TypeObject(checker, flags) {
this.checker = checker;
@@ -120294,10 +121439,10 @@
}
function visit(node) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
var functionDeclaration = node;
var declarationName = getDeclarationName(functionDeclaration);
if (declarationName) {
@@ -120317,31 +121462,31 @@
}
ts.forEachChild(node, visit);
break;
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 243 /* EnumDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
- case 257 /* ExportSpecifier */:
- case 253 /* ImportSpecifier */:
- case 250 /* ImportClause */:
- case 251 /* NamespaceImport */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 168 /* TypeLiteral */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 258 /* ExportSpecifier */:
+ case 254 /* ImportSpecifier */:
+ case 251 /* ImportClause */:
+ case 252 /* NamespaceImport */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 169 /* TypeLiteral */:
addDeclaration(node);
ts.forEachChild(node, visit);
break;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
// Only consider parameter properties
if (!ts.hasModifier(node, 92 /* ParameterPropertyModifier */)) {
break;
}
// falls through
- case 237 /* VariableDeclaration */:
- case 186 /* BindingElement */: {
+ case 238 /* VariableDeclaration */:
+ case 187 /* BindingElement */: {
var decl = node;
if (ts.isBindingPattern(decl.name)) {
ts.forEachChild(decl.name, visit);
@@ -120352,19 +121497,19 @@
}
}
// falls through
- case 278 /* EnumMember */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 279 /* EnumMember */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
addDeclaration(node);
break;
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
// Handle named exports case e.g.:
// export {a, b as B} from "mod";
if (node.exportClause) {
ts.forEach(node.exportClause.elements, visit);
}
break;
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
var importClause = node.importClause;
if (importClause) {
// Handle default import case e.g.:
@@ -120376,7 +121521,7 @@
// import * as NS from "mod";
// import {a, b as B} from "mod";
if (importClause.namedBindings) {
- if (importClause.namedBindings.kind === 251 /* NamespaceImport */) {
+ if (importClause.namedBindings.kind === 252 /* NamespaceImport */) {
addDeclaration(importClause.namedBindings);
}
else {
@@ -120385,7 +121530,7 @@
}
}
break;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
if (ts.getAssignmentDeclarationKind(node) !== 0 /* None */) {
addDeclaration(node);
}
@@ -120554,7 +121699,7 @@
var sourceFile;
if (this.currentFileName !== fileName) {
// This is a new file, just parse it
- sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 7 /* Latest */, version, /*setNodeParents*/ true, scriptKind);
+ sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 8 /* Latest */, version, /*setNodeParents*/ true, scriptKind);
}
else if (this.currentFileVersion !== version) {
// This is the same file, just a newer version. Incrementally parse the file.
@@ -120958,41 +122103,48 @@
return undefined;
}
var typeChecker = program.getTypeChecker();
- var symbol = getSymbolAtLocationForQuickInfo(node, typeChecker);
+ var nodeForQuickInfo = getNodeForQuickInfo(node);
+ var symbol = getSymbolAtLocationForQuickInfo(nodeForQuickInfo, typeChecker);
if (!symbol || typeChecker.isUnknownSymbol(symbol)) {
- var type_2 = shouldGetType(sourceFile, node, position) ? typeChecker.getTypeAtLocation(node) : undefined;
+ var type_2 = shouldGetType(sourceFile, nodeForQuickInfo, position) ? typeChecker.getTypeAtLocation(nodeForQuickInfo) : undefined;
return type_2 && {
kind: "" /* unknown */,
kindModifiers: "" /* none */,
- textSpan: ts.createTextSpanFromNode(node, sourceFile),
- displayParts: typeChecker.runWithCancellationToken(cancellationToken, function (typeChecker) { return ts.typeToDisplayParts(typeChecker, type_2, ts.getContainerNode(node)); }),
+ textSpan: ts.createTextSpanFromNode(nodeForQuickInfo, sourceFile),
+ displayParts: typeChecker.runWithCancellationToken(cancellationToken, function (typeChecker) { return ts.typeToDisplayParts(typeChecker, type_2, ts.getContainerNode(nodeForQuickInfo)); }),
documentation: type_2.symbol ? type_2.symbol.getDocumentationComment(typeChecker) : undefined,
tags: type_2.symbol ? type_2.symbol.getJsDocTags() : undefined
};
}
var _a = typeChecker.runWithCancellationToken(cancellationToken, function (typeChecker) {
- return ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, ts.getContainerNode(node), node);
+ return ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, ts.getContainerNode(nodeForQuickInfo), nodeForQuickInfo);
}), symbolKind = _a.symbolKind, displayParts = _a.displayParts, documentation = _a.documentation, tags = _a.tags;
return {
kind: symbolKind,
kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol),
- textSpan: ts.createTextSpanFromNode(node, sourceFile),
+ textSpan: ts.createTextSpanFromNode(nodeForQuickInfo, sourceFile),
displayParts: displayParts,
documentation: documentation,
tags: tags,
};
}
+ function getNodeForQuickInfo(node) {
+ if (ts.isNewExpression(node.parent) && node.pos === node.parent.pos) {
+ return node.parent.expression;
+ }
+ return node;
+ }
function shouldGetType(sourceFile, node, position) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return !ts.isLabelName(node) && !ts.isTagName(node);
- case 189 /* PropertyAccessExpression */:
- case 148 /* QualifiedName */:
+ case 190 /* PropertyAccessExpression */:
+ case 149 /* QualifiedName */:
// Don't return quickInfo if inside the comment in `a/**/.b`
return !ts.isInComment(sourceFile, position);
- case 100 /* ThisKeyword */:
- case 178 /* ThisType */:
- case 98 /* SuperKeyword */:
+ case 101 /* ThisKeyword */:
+ case 179 /* ThisType */:
+ case 99 /* SuperKeyword */:
return true;
default:
return false;
@@ -121099,16 +122251,16 @@
return undefined;
}
switch (node.kind) {
- case 189 /* PropertyAccessExpression */:
- case 148 /* QualifiedName */:
+ case 190 /* PropertyAccessExpression */:
+ case 149 /* QualifiedName */:
case 10 /* StringLiteral */:
- case 87 /* FalseKeyword */:
- case 102 /* TrueKeyword */:
- case 96 /* NullKeyword */:
- case 98 /* SuperKeyword */:
- case 100 /* ThisKeyword */:
- case 178 /* ThisType */:
- case 72 /* Identifier */:
+ case 88 /* FalseKeyword */:
+ case 103 /* TrueKeyword */:
+ case 97 /* NullKeyword */:
+ case 99 /* SuperKeyword */:
+ case 101 /* ThisKeyword */:
+ case 179 /* ThisType */:
+ case 73 /* Identifier */:
break;
// Cant create the text span
default:
@@ -121124,7 +122276,7 @@
// If this is name of a module declarations, check if this is right side of dotted module name
// If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of
// Then this name is name from dotted module
- if (nodeForStartPos.parent.parent.kind === 244 /* ModuleDeclaration */ &&
+ if (nodeForStartPos.parent.parent.kind === 245 /* ModuleDeclaration */ &&
nodeForStartPos.parent.parent.body === nodeForStartPos.parent) {
// Use parent module declarations name for start pos
nodeForStartPos = nodeForStartPos.parent.parent.name;
@@ -121267,30 +122419,14 @@
}
function applyCodeActionCommand(fileName, actionOrFormatSettingsOrUndefined) {
var action = typeof fileName === "string" ? actionOrFormatSettingsOrUndefined : fileName;
- var formatSettings = typeof fileName !== "string" ? actionOrFormatSettingsOrUndefined : undefined;
- return ts.isArray(action) ? Promise.all(action.map(function (a) { return applySingleCodeActionCommand(a, formatSettings); })) : applySingleCodeActionCommand(action, formatSettings);
+ return ts.isArray(action) ? Promise.all(action.map(function (a) { return applySingleCodeActionCommand(a); })) : applySingleCodeActionCommand(action);
}
- function applySingleCodeActionCommand(action, formatSettings) {
+ function applySingleCodeActionCommand(action) {
var getPath = function (path) { return ts.toPath(path, currentDirectory, getCanonicalFileName); };
- switch (action.type) {
- case "install package":
+ ts.Debug.assertEqual(action.type, "install package");
return host.installPackage
? host.installPackage({ fileName: getPath(action.file), packageName: action.packageName })
: Promise.reject("Host does not implement `installPackage`");
- case "generate types": {
- var fileToGenerateTypesFor = action.fileToGenerateTypesFor, outputFileName_1 = action.outputFileName;
- if (!host.inspectValue)
- return Promise.reject("Host does not implement `installPackage`");
- var valueInfoPromise = host.inspectValue({ fileNameToRequire: fileToGenerateTypesFor });
- return valueInfoPromise.then(function (valueInfo) {
- var fullOut = getPath(outputFileName_1);
- host.writeFile(fullOut, ts.valueInfoToDeclarationFileText(valueInfo, formatSettings || ts.testFormatSettings)); // TODO: GH#18217
- return { successMessage: "Wrote types to '" + fullOut + "'" };
- });
- }
- default:
- return ts.Debug.assertNever(action);
- }
}
function getDocCommentTemplateAtPosition(fileName, position) {
return ts.JsDoc.getDocCommentTemplateAtPosition(ts.getNewLineOrDefaultFromHost(host), syntaxTreeCache.getCurrentSourceFile(fileName), position);
@@ -121486,6 +122622,9 @@
preferences: preferences,
};
}
+ function getSmartSelectionRange(fileName, position) {
+ return ts.SmartSelectionRange.getSmartSelectionRange(position, syntaxTreeCache.getCurrentSourceFile(fileName));
+ }
function getApplicableRefactors(fileName, positionOrRange, preferences) {
if (preferences === void 0) { preferences = ts.emptyOptions; }
synchronizeHostData();
@@ -121526,6 +122665,7 @@
getBreakpointStatementAtPosition: getBreakpointStatementAtPosition,
getNavigateToItems: getNavigateToItems,
getRenameInfo: getRenameInfo,
+ getSmartSelectionRange: getSmartSelectionRange,
findRenameLocations: findRenameLocations,
getNavigationBarItems: getNavigationBarItems,
getNavigationTree: getNavigationTree,
@@ -121588,7 +122728,7 @@
*/
function literalIsName(node) {
return ts.isDeclarationName(node) ||
- node.parent.kind === 259 /* ExternalModuleReference */ ||
+ node.parent.kind === 260 /* ExternalModuleReference */ ||
isArgumentOfElementAccessExpression(node) ||
ts.isLiteralComputedPropertyDeclarationName(node);
}
@@ -121605,13 +122745,13 @@
switch (node.kind) {
case 10 /* StringLiteral */:
case 8 /* NumericLiteral */:
- if (node.parent.kind === 149 /* ComputedPropertyName */) {
+ if (node.parent.kind === 150 /* ComputedPropertyName */) {
return ts.isObjectLiteralElement(node.parent.parent) ? node.parent.parent : undefined;
}
// falls through
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return ts.isObjectLiteralElement(node.parent) &&
- (node.parent.parent.kind === 188 /* ObjectLiteralExpression */ || node.parent.parent.kind === 268 /* JsxAttributes */) &&
+ (node.parent.parent.kind === 189 /* ObjectLiteralExpression */ || node.parent.parent.kind === 269 /* JsxAttributes */) &&
node.parent.name === node ? node.parent : undefined;
}
return undefined;
@@ -121653,7 +122793,7 @@
function isArgumentOfElementAccessExpression(node) {
return node &&
node.parent &&
- node.parent.kind === 190 /* ElementAccessExpression */ &&
+ node.parent.kind === 191 /* ElementAccessExpression */ &&
node.parent.argumentExpression === node;
}
/**
@@ -121733,114 +122873,114 @@
if (node) {
var parent = node.parent;
switch (node.kind) {
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
// Span on first variable declaration
return spanInVariableDeclaration(node.declarationList.declarations[0]);
- case 237 /* VariableDeclaration */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 238 /* VariableDeclaration */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
return spanInVariableDeclaration(node);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return spanInParameterDeclaration(node);
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 157 /* Constructor */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 158 /* Constructor */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return spanInFunctionDeclaration(node);
- case 218 /* Block */:
+ case 219 /* Block */:
if (ts.isFunctionBlock(node)) {
return spanInFunctionBlock(node);
}
// falls through
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
return spanInBlock(node);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return spanInBlock(node.block);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
// span on the expression
return textSpan(node.expression);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
// span on return keyword and expression if present
return textSpan(node.getChildAt(0), node.expression);
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
// Span on while(...)
return textSpanEndingAtNextToken(node, node.expression);
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
// span in statement of the do statement
return spanInNode(node.statement);
- case 236 /* DebuggerStatement */:
+ case 237 /* DebuggerStatement */:
// span on debugger keyword
return textSpan(node.getChildAt(0));
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
// set on if(..) span
return textSpanEndingAtNextToken(node, node.expression);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
// span in statement
return spanInNode(node.statement);
- case 229 /* BreakStatement */:
- case 228 /* ContinueStatement */:
+ case 230 /* BreakStatement */:
+ case 229 /* ContinueStatement */:
// On break or continue keyword and label if present
return textSpan(node.getChildAt(0), node.label);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return spanInForStatement(node);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
// span of for (a in ...)
return textSpanEndingAtNextToken(node, node.expression);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
// span in initializer
return spanInInitializerOfForLike(node);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
// span on switch(...)
return textSpanEndingAtNextToken(node, node.expression);
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
// span in first statement of the clause
return spanInNode(node.statements[0]);
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
// span in try block
return spanInBlock(node.tryBlock);
- case 234 /* ThrowStatement */:
+ case 235 /* ThrowStatement */:
// span in throw ...
return textSpan(node, node.expression);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
// span on export = id
return textSpan(node, node.expression);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
// import statement without including semicolon
return textSpan(node, node.moduleReference);
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
// import statement without including semicolon
return textSpan(node, node.moduleSpecifier);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
// import statement without including semicolon
return textSpan(node, node.moduleSpecifier);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
// span on complete module if it is instantiated
if (ts.getModuleInstanceState(node) !== 1 /* Instantiated */) {
return undefined;
}
// falls through
- case 240 /* ClassDeclaration */:
- case 243 /* EnumDeclaration */:
- case 278 /* EnumMember */:
- case 186 /* BindingElement */:
+ case 241 /* ClassDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 279 /* EnumMember */:
+ case 187 /* BindingElement */:
// span on complete node
return textSpan(node);
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
// span in statement
return spanInNode(node.statement);
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
return spanInNodeArray(parent.decorators);
- case 184 /* ObjectBindingPattern */:
- case 185 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
return spanInBindingPattern(node);
// No breakpoint in interface, type alias
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return undefined;
// Tokens:
case 26 /* SemicolonToken */:
@@ -121864,13 +123004,13 @@
case 28 /* LessThanToken */:
return spanInGreaterThanOrLessThanToken(node);
// Keywords:
- case 107 /* WhileKeyword */:
+ case 108 /* WhileKeyword */:
return spanInWhileKeyword(node);
- case 83 /* ElseKeyword */:
- case 75 /* CatchKeyword */:
- case 88 /* FinallyKeyword */:
+ case 84 /* ElseKeyword */:
+ case 76 /* CatchKeyword */:
+ case 89 /* FinallyKeyword */:
return spanInNextNode(node);
- case 147 /* OfKeyword */:
+ case 148 /* OfKeyword */:
return spanInOfKeyword(node);
default:
// Destructuring pattern in destructuring assignment
@@ -121882,14 +123022,14 @@
// Set breakpoint on identifier element of destructuring pattern
// `a` or `...c` or `d: x` from
// `[a, b, ...c]` or `{ a, b }` or `{ d: x }` from destructuring pattern
- if ((node.kind === 72 /* Identifier */ ||
- node.kind === 208 /* SpreadElement */ ||
- node.kind === 275 /* PropertyAssignment */ ||
- node.kind === 276 /* ShorthandPropertyAssignment */) &&
+ if ((node.kind === 73 /* Identifier */ ||
+ node.kind === 209 /* SpreadElement */ ||
+ node.kind === 276 /* PropertyAssignment */ ||
+ node.kind === 277 /* ShorthandPropertyAssignment */) &&
ts.isArrayLiteralOrObjectLiteralDestructuringPattern(parent)) {
return textSpan(node);
}
- if (node.kind === 204 /* BinaryExpression */) {
+ if (node.kind === 205 /* BinaryExpression */) {
var _a = node, left = _a.left, operatorToken = _a.operatorToken;
// Set breakpoint in destructuring pattern if its destructuring assignment
// [a, b, c] or {a, b, c} of
@@ -121898,7 +123038,7 @@
if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(left)) {
return spanInArrayLiteralOrObjectLiteralDestructuringPattern(left);
}
- if (operatorToken.kind === 59 /* EqualsToken */ && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) {
+ if (operatorToken.kind === 60 /* EqualsToken */ && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) {
// Set breakpoint on assignment expression element of destructuring pattern
// a = expression of
// [a = expression, b, c] = someExpression or
@@ -121911,22 +123051,22 @@
}
if (ts.isExpressionNode(node)) {
switch (parent.kind) {
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
// Set span as if on while keyword
return spanInPreviousNode(node);
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
// Set breakpoint on the decorator emit
return spanInNode(node.parent);
- case 225 /* ForStatement */:
- case 227 /* ForOfStatement */:
+ case 226 /* ForStatement */:
+ case 228 /* ForOfStatement */:
return textSpan(node);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
if (node.parent.operatorToken.kind === 27 /* CommaToken */) {
// If this is a comma expression, the breakpoint is possible in this expression
return textSpan(node);
}
break;
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
if (node.parent.body === node) {
// If this is body of arrow function, it is allowed to have the breakpoint
return textSpan(node);
@@ -121935,21 +123075,21 @@
}
}
switch (node.parent.kind) {
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
// If this is name of property assignment, set breakpoint in the initializer
if (node.parent.name === node &&
!ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) {
return spanInNode(node.parent.initializer);
}
break;
- case 194 /* TypeAssertionExpression */:
+ case 195 /* TypeAssertionExpression */:
// Breakpoint in type assertion goes to its operand
if (node.parent.type === node) {
return spanInNextNode(node.parent.type);
}
break;
- case 237 /* VariableDeclaration */:
- case 151 /* Parameter */: {
+ case 238 /* VariableDeclaration */:
+ case 152 /* Parameter */: {
// initializer of variable/parameter declaration go to previous node
var _b = node.parent, initializer = _b.initializer, type = _b.type;
if (initializer === node || type === node || ts.isAssignmentOperator(node.kind)) {
@@ -121957,7 +123097,7 @@
}
break;
}
- case 204 /* BinaryExpression */: {
+ case 205 /* BinaryExpression */: {
var left = node.parent.left;
if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(left) && node !== left) {
// If initializer of destructuring assignment move to previous token
@@ -121987,7 +123127,7 @@
}
function spanInVariableDeclaration(variableDeclaration) {
// If declaration of for in statement, just set the span in parent
- if (variableDeclaration.parent.parent.kind === 226 /* ForInStatement */) {
+ if (variableDeclaration.parent.parent.kind === 227 /* ForInStatement */) {
return spanInNode(variableDeclaration.parent.parent);
}
var parent = variableDeclaration.parent;
@@ -121999,7 +123139,7 @@
// or its declaration from 'for of'
if (variableDeclaration.initializer ||
ts.hasModifier(variableDeclaration, 1 /* Export */) ||
- parent.parent.kind === 227 /* ForOfStatement */) {
+ parent.parent.kind === 228 /* ForOfStatement */) {
return textSpanFromVariableDeclaration(variableDeclaration);
}
if (ts.isVariableDeclarationList(variableDeclaration.parent) &&
@@ -122040,7 +123180,7 @@
}
function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) {
return ts.hasModifier(functionDeclaration, 1 /* Export */) ||
- (functionDeclaration.parent.kind === 240 /* ClassDeclaration */ && functionDeclaration.kind !== 157 /* Constructor */);
+ (functionDeclaration.parent.kind === 241 /* ClassDeclaration */ && functionDeclaration.kind !== 158 /* Constructor */);
}
function spanInFunctionDeclaration(functionDeclaration) {
// No breakpoints in the function signature
@@ -122063,26 +123203,26 @@
}
function spanInBlock(block) {
switch (block.parent.kind) {
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
if (ts.getModuleInstanceState(block.parent) !== 1 /* Instantiated */) {
return undefined;
}
// falls through
// Set on parent if on same line otherwise on first statement
- case 224 /* WhileStatement */:
- case 222 /* IfStatement */:
- case 226 /* ForInStatement */:
+ case 225 /* WhileStatement */:
+ case 223 /* IfStatement */:
+ case 227 /* ForInStatement */:
return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]);
// Set span on previous token if it starts on same line otherwise on the first statement of the block
- case 225 /* ForStatement */:
- case 227 /* ForOfStatement */:
+ case 226 /* ForStatement */:
+ case 228 /* ForOfStatement */:
return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]);
}
// Default action is to set on first statement
return spanInNode(block.statements[0]);
}
function spanInInitializerOfForLike(forLikeStatement) {
- if (forLikeStatement.initializer.kind === 238 /* VariableDeclarationList */) {
+ if (forLikeStatement.initializer.kind === 239 /* VariableDeclarationList */) {
// Declaration list - set breakpoint in first declaration
var variableDeclarationList = forLikeStatement.initializer;
if (variableDeclarationList.declarations.length > 0) {
@@ -122107,21 +123247,21 @@
}
function spanInBindingPattern(bindingPattern) {
// Set breakpoint in first binding element
- var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 210 /* OmittedExpression */ ? element : undefined; });
+ var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 211 /* OmittedExpression */ ? element : undefined; });
if (firstBindingElement) {
return spanInNode(firstBindingElement);
}
// Empty binding pattern of binding element, set breakpoint on binding element
- if (bindingPattern.parent.kind === 186 /* BindingElement */) {
+ if (bindingPattern.parent.kind === 187 /* BindingElement */) {
return textSpan(bindingPattern.parent);
}
// Variable declaration is used as the span
return textSpanFromVariableDeclaration(bindingPattern.parent);
}
function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) {
- ts.Debug.assert(node.kind !== 185 /* ArrayBindingPattern */ && node.kind !== 184 /* ObjectBindingPattern */);
- var elements = node.kind === 187 /* ArrayLiteralExpression */ ? node.elements : node.properties;
- var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 210 /* OmittedExpression */ ? element : undefined; });
+ ts.Debug.assert(node.kind !== 186 /* ArrayBindingPattern */ && node.kind !== 185 /* ObjectBindingPattern */);
+ var elements = node.kind === 188 /* ArrayLiteralExpression */ ? node.elements : node.properties;
+ var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 211 /* OmittedExpression */ ? element : undefined; });
if (firstBindingElement) {
return spanInNode(firstBindingElement);
}
@@ -122129,18 +123269,18 @@
// just nested element in another destructuring assignment
// set breakpoint on assignment when parent is destructuring assignment
// Otherwise set breakpoint for this element
- return textSpan(node.parent.kind === 204 /* BinaryExpression */ ? node.parent : node);
+ return textSpan(node.parent.kind === 205 /* BinaryExpression */ ? node.parent : node);
}
// Tokens:
function spanInOpenBraceToken(node) {
switch (node.parent.kind) {
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
var enumDeclaration = node.parent;
return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile));
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
var classDeclaration = node.parent;
return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile));
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]);
}
// Default to parent node
@@ -122148,25 +123288,25 @@
}
function spanInCloseBraceToken(node) {
switch (node.parent.kind) {
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
// If this is not an instantiated module block, no bp span
if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* Instantiated */) {
return undefined;
}
// falls through
- case 243 /* EnumDeclaration */:
- case 240 /* ClassDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 241 /* ClassDeclaration */:
// Span on close brace token
return textSpan(node);
- case 218 /* Block */:
+ case 219 /* Block */:
if (ts.isFunctionBlock(node.parent)) {
// Span on close brace token
return textSpan(node);
}
// falls through
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return spanInNode(ts.lastOrUndefined(node.parent.statements));
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
// breakpoint in last statement of the last clause
var caseBlock = node.parent;
var lastClause = ts.lastOrUndefined(caseBlock.clauses);
@@ -122174,7 +123314,7 @@
return spanInNode(ts.lastOrUndefined(lastClause.statements));
}
return undefined;
- case 184 /* ObjectBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
// Breakpoint in last binding element or binding pattern if it contains no elements
var bindingPattern = node.parent;
return spanInNode(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern);
@@ -122190,7 +123330,7 @@
}
function spanInCloseBracketToken(node) {
switch (node.parent.kind) {
- case 185 /* ArrayBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
// Breakpoint in last binding element or binding pattern if it contains no elements
var bindingPattern = node.parent;
return textSpan(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern);
@@ -122205,12 +123345,12 @@
}
}
function spanInOpenParenToken(node) {
- if (node.parent.kind === 223 /* DoStatement */ || // Go to while keyword and do action instead
- node.parent.kind === 191 /* CallExpression */ ||
- node.parent.kind === 192 /* NewExpression */) {
+ if (node.parent.kind === 224 /* DoStatement */ || // Go to while keyword and do action instead
+ node.parent.kind === 192 /* CallExpression */ ||
+ node.parent.kind === 193 /* NewExpression */) {
return spanInPreviousNode(node);
}
- if (node.parent.kind === 195 /* ParenthesizedExpression */) {
+ if (node.parent.kind === 196 /* ParenthesizedExpression */) {
return spanInNextNode(node);
}
// Default to parent node
@@ -122219,21 +123359,21 @@
function spanInCloseParenToken(node) {
// Is this close paren token of parameter list, set span in previous token
switch (node.parent.kind) {
- case 196 /* FunctionExpression */:
- case 239 /* FunctionDeclaration */:
- case 197 /* ArrowFunction */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 157 /* Constructor */:
- case 224 /* WhileStatement */:
- case 223 /* DoStatement */:
- case 225 /* ForStatement */:
- case 227 /* ForOfStatement */:
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
- case 195 /* ParenthesizedExpression */:
+ case 197 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
+ case 198 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 158 /* Constructor */:
+ case 225 /* WhileStatement */:
+ case 224 /* DoStatement */:
+ case 226 /* ForStatement */:
+ case 228 /* ForOfStatement */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
+ case 196 /* ParenthesizedExpression */:
return spanInPreviousNode(node);
// Default to parent node
default:
@@ -122243,20 +123383,20 @@
function spanInColonToken(node) {
// Is this : specifying return annotation of the function declaration
if (ts.isFunctionLike(node.parent) ||
- node.parent.kind === 275 /* PropertyAssignment */ ||
- node.parent.kind === 151 /* Parameter */) {
+ node.parent.kind === 276 /* PropertyAssignment */ ||
+ node.parent.kind === 152 /* Parameter */) {
return spanInPreviousNode(node);
}
return spanInNode(node.parent);
}
function spanInGreaterThanOrLessThanToken(node) {
- if (node.parent.kind === 194 /* TypeAssertionExpression */) {
+ if (node.parent.kind === 195 /* TypeAssertionExpression */) {
return spanInNextNode(node);
}
return spanInNode(node.parent);
}
function spanInWhileKeyword(node) {
- if (node.parent.kind === 223 /* DoStatement */) {
+ if (node.parent.kind === 224 /* DoStatement */) {
// Set span on while expression
return textSpanEndingAtNextToken(node, node.parent.expression);
}
@@ -122264,7 +123404,7 @@
return spanInNode(node.parent);
}
function spanInOfKeyword(node) {
- if (node.parent.kind === 227 /* ForOfStatement */) {
+ if (node.parent.kind === 228 /* ForOfStatement */) {
// Set using next token
return spanInNextNode(node);
}
@@ -122733,6 +123873,10 @@
var _this = this;
return this.forwardJSONCall("getRenameInfo('" + fileName + "', " + position + ")", function () { return _this.languageService.getRenameInfo(fileName, position, options); });
};
+ LanguageServiceShimObject.prototype.getSmartSelectionRange = function (fileName, position) {
+ var _this = this;
+ return this.forwardJSONCall("getSmartSelectionRange('" + fileName + "', " + position + ")", function () { return _this.languageService.getSmartSelectionRange(fileName, position); });
+ };
LanguageServiceShimObject.prototype.findRenameLocations = function (fileName, position, findInStrings, findInComments, providePrefixAndSuffixTextForRename) {
var _this = this;
return this.forwardJSONCall("findRenameLocations('" + fileName + "', " + position + ", " + findInStrings + ", " + findInComments + ", " + providePrefixAndSuffixTextForRename + ")", function () { return _this.languageService.findRenameLocations(fileName, position, findInStrings, findInComments, providePrefixAndSuffixTextForRename); });
@@ -123087,7 +124231,6 @@
server.ActionSet = "action::set";
server.ActionInvalidate = "action::invalidate";
server.ActionPackageInstalled = "action::packageInstalled";
- server.ActionValueInspected = "action::valueInspected";
server.EventTypesRegistry = "event::typesRegistry";
server.EventBeginInstallTypes = "event::beginInstallTypes";
server.EventEndInstallTypes = "event::endInstallTypes";
@@ -123758,6 +124901,9 @@
/* @internal */
CommandTypes["GetEditsForFileRenameFull"] = "getEditsForFileRename-full";
CommandTypes["ConfigurePlugin"] = "configurePlugin";
+ CommandTypes["SelectionRange"] = "selectionRange";
+ /* @internal */
+ CommandTypes["SelectionRangeFull"] = "selectionRange-full";
// NOTE: If updating this, be sure to also update `allCommandNames` in `harness/unittests/session.ts`.
})(CommandTypes = protocol.CommandTypes || (protocol.CommandTypes = {}));
var IndentStyle;
@@ -123802,6 +124948,9 @@
ScriptTarget["ES2015"] = "ES2015";
ScriptTarget["ES2016"] = "ES2016";
ScriptTarget["ES2017"] = "ES2017";
+ ScriptTarget["ES2018"] = "ES2018";
+ ScriptTarget["ES2019"] = "ES2019";
+ ScriptTarget["ES2020"] = "ES2020";
ScriptTarget["ESNext"] = "ESNext";
})(ScriptTarget = protocol.ScriptTarget || (protocol.ScriptTarget = {}));
})(protocol = server.protocol || (server.protocol = {}));
@@ -124309,7 +125458,6 @@
isKnownTypesPackageName: ts.returnFalse,
// Should never be called because we never provide a types registry.
installPackage: ts.notImplemented,
- inspectValue: ts.notImplemented,
enqueueInstallTypingsRequest: ts.noop,
attach: ts.noop,
onProjectClosed: ts.noop,
@@ -124371,9 +125519,6 @@
TypingsCache.prototype.installPackage = function (options) {
return this.installer.installPackage(options);
};
- TypingsCache.prototype.inspectValue = function (options) {
- return this.installer.inspectValue(options);
- };
TypingsCache.prototype.enqueueInstallTypingsForProject = function (project, unresolvedImports, forceRefresh) {
var typeAcquisition = project.getTypeAcquisition();
if (!typeAcquisition || !typeAcquisition.enable) {
@@ -124586,13 +125731,13 @@
server.updateProjectIfDirty(this);
return hasOneOrMoreJsAndNoTsFiles(this);
};
- Project.resolveModule = function (moduleName, initialDir, host, log) {
+ Project.resolveModule = function (moduleName, initialDir, host, log, logErrors) {
var resolvedPath = ts.normalizeSlashes(host.resolvePath(ts.combinePaths(initialDir, "node_modules")));
log("Loading " + moduleName + " from " + initialDir + " (resolved to " + resolvedPath + ")");
var result = host.require(resolvedPath, moduleName); // TODO: GH#18217
if (result.error) {
var err = result.error.stack || result.error.message || JSON.stringify(result.error);
- log("Failed to load module '" + moduleName + "': " + err);
+ (logErrors || log)("Failed to load module '" + moduleName + "' from " + resolvedPath + ": " + err);
return undefined;
}
return result.module;
@@ -124603,10 +125748,6 @@
Project.prototype.installPackage = function (options) {
return this.typingsCache.installPackage(__assign({}, options, { projectName: this.projectName, projectRootPath: this.toPath(this.currentDirectory) }));
};
- /* @internal */
- Project.prototype.inspectValue = function (options) {
- return this.typingsCache.inspectValue(options);
- };
Object.defineProperty(Project.prototype, "typingsCache", {
get: function () {
return this.projectService.typingsCache;
@@ -125187,6 +126328,9 @@
}, function (removed) { return _this.detachScriptInfoFromProject(removed); });
var elapsed = ts.timestamp() - start;
this.writeLog("Finishing updateGraphWorker: Project: " + this.getProjectName() + " Version: " + this.getProjectVersion() + " structureChanged: " + hasNewProgram + " Elapsed: " + elapsed + "ms");
+ if (this.program !== oldProgram) {
+ this.print();
+ }
return hasNewProgram;
};
Project.prototype.detachScriptInfoFromProject = function (uncheckedFileName, noRemoveResolution) {
@@ -125351,11 +126495,11 @@
Project.prototype.enablePlugin = function (pluginConfigEntry, searchPaths, pluginConfigOverrides) {
var _this = this;
this.projectService.logger.info("Enabling plugin " + pluginConfigEntry.name + " from candidate paths: " + searchPaths.join(","));
- var log = function (message) {
- _this.projectService.logger.info(message);
- };
+ var log = function (message) { return _this.projectService.logger.info(message); };
+ var errorLogs;
+ var logError = function (message) { (errorLogs || (errorLogs = [])).push(message); };
var resolvedModule = ts.firstDefined(searchPaths, function (searchPath) {
- return Project.resolveModule(pluginConfigEntry.name, searchPath, _this.projectService.host, log);
+ return Project.resolveModule(pluginConfigEntry.name, searchPath, _this.projectService.host, log, logError);
});
if (resolvedModule) {
var configurationOverride = pluginConfigOverrides && pluginConfigOverrides.get(pluginConfigEntry.name);
@@ -125368,6 +126512,7 @@
this.enableProxy(resolvedModule, pluginConfigEntry);
}
else {
+ ts.forEach(errorLogs, log);
this.projectService.logger.info("Couldn't find " + pluginConfigEntry.name);
}
};
@@ -128755,8 +129900,8 @@
}
var Session = /** @class */ (function () {
function Session(opts) {
- var _this = this;
var _a;
+ var _this = this;
this.changeSeq = 0;
this.handlers = ts.createMapFromTemplate((_a = {},
_a[server.CommandNames.Status] = function () {
@@ -129088,6 +130233,12 @@
_this.doOutput(/*info*/ undefined, server.CommandNames.ConfigurePlugin, request.seq, /*success*/ true);
return _this.notRequired();
},
+ _a[server.CommandNames.SelectionRange] = function (request) {
+ return _this.requiredResponse(_this.getSmartSelectionRange(request.arguments, /*simplifiedResult*/ true));
+ },
+ _a[server.CommandNames.SelectionRangeFull] = function (request) {
+ return _this.requiredResponse(_this.getSmartSelectionRange(request.arguments, /*simplifiedResult*/ false));
+ },
_a));
this.host = opts.host;
this.cancellationToken = opts.cancellationToken;
@@ -130424,6 +131575,26 @@
Session.prototype.configurePlugin = function (args) {
this.projectService.configurePlugin(args);
};
+ Session.prototype.getSmartSelectionRange = function (args, simplifiedResult) {
+ var _this = this;
+ var locations = args.locations;
+ var _a = this.getFileAndLanguageServiceForSyntacticOperation(args), file = _a.file, languageService = _a.languageService;
+ var scriptInfo = ts.Debug.assertDefined(this.projectService.getScriptInfo(file));
+ return ts.map(locations, function (location) {
+ var pos = _this.getPosition(location, scriptInfo);
+ var selectionRange = languageService.getSmartSelectionRange(file, pos);
+ return simplifiedResult ? _this.mapSelectionRange(selectionRange, scriptInfo) : selectionRange;
+ });
+ };
+ Session.prototype.mapSelectionRange = function (selectionRange, scriptInfo) {
+ var result = {
+ textSpan: this.toLocationTextSpan(selectionRange.textSpan, scriptInfo),
+ };
+ if (selectionRange.parent) {
+ result.parent = this.mapSelectionRange(selectionRange.parent, scriptInfo);
+ }
+ return result;
+ };
Session.prototype.getCanonicalFileName = function (fileName) {
var name = this.host.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase();
return ts.normalizePath(name);
@@ -131347,7 +132518,7 @@
process.env.USERPROFILE ||
(process.env.HOMEDRIVE && process.env.HOMEPATH && ts.normalizeSlashes(process.env.HOMEDRIVE + process.env.HOMEPATH)) ||
os.tmpdir();
- return ts.combinePaths(ts.combinePaths(ts.normalizeSlashes(basePath), "Microsoft/TypeScript"), ts.version);
+ return ts.combinePaths(ts.combinePaths(ts.normalizeSlashes(basePath), "Microsoft/TypeScript"), ts.versionMajorMinor);
}
case "openbsd":
case "freebsd":
@@ -131355,7 +132526,7 @@
case "linux":
case "android": {
var cacheLocation = getNonWindowsCacheLocation(process.platform === "darwin");
- return ts.combinePaths(ts.combinePaths(cacheLocation, "typescript"), ts.version);
+ return ts.combinePaths(ts.combinePaths(cacheLocation, "typescript"), ts.versionMajorMinor);
}
default:
return ts.Debug.fail("unsupported platform '" + process.platform + "'");
@@ -131504,12 +132675,6 @@
_this.packageInstalledPromise = { resolve: resolve, reject: reject };
});
};
- NodeTypingsInstaller.prototype.inspectValue = function (options) {
- var _this = this;
- this.send({ kind: "inspectValue", options: options });
- ts.Debug.assert(this.inspectValuePromise === undefined);
- return new Promise(function (resolve) { _this.inspectValuePromise = { resolve: resolve }; });
- };
NodeTypingsInstaller.prototype.attach = function (projectService) {
var _this = this;
this.projectService = projectService;
@@ -131611,10 +132776,6 @@
this.event(response, "setTypings");
break;
}
- case server.ActionValueInspected:
- this.inspectValuePromise.resolve(response.result);
- this.inspectValuePromise = undefined;
- break;
case server.EventInitializationFailed: {
var body = {
message: response.message

lib/tsserverlibrary.d.ts

@@ -14,7 +14,7 @@
***************************************************************************** */
declare namespace ts {
- const versionMajorMinor = "3.4";
+ const versionMajorMinor = "3.5";
/** The version of the TypeScript compiler release */
const version: string;
}
@@ -72,7 +72,7 @@
pos: number;
end: number;
}
- type JsDocSyntaxKind = SyntaxKind.EndOfFileToken | SyntaxKind.WhitespaceTrivia | SyntaxKind.AtToken | SyntaxKind.NewLineTrivia | SyntaxKind.AsteriskToken | SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.LessThanToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.EqualsToken | SyntaxKind.CommaToken | SyntaxKind.DotToken | SyntaxKind.Identifier | SyntaxKind.NoSubstitutionTemplateLiteral | SyntaxKind.Unknown | KeywordSyntaxKind;
+ type JSDocSyntaxKind = SyntaxKind.EndOfFileToken | SyntaxKind.WhitespaceTrivia | SyntaxKind.AtToken | SyntaxKind.NewLineTrivia | SyntaxKind.AsteriskToken | SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.LessThanToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.EqualsToken | SyntaxKind.CommaToken | SyntaxKind.DotToken | SyntaxKind.Identifier | SyntaxKind.BacktickToken | SyntaxKind.Unknown | KeywordSyntaxKind;
type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InKeyword | SyntaxKind.InferKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.RequireKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.OfKeyword;
type JsxTokenSyntaxKind = SyntaxKind.LessThanSlashToken | SyntaxKind.EndOfFileToken | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.OpenBraceToken | SyntaxKind.LessThanToken;
enum SyntaxKind {
@@ -135,281 +135,283 @@
QuestionToken = 56,
ColonToken = 57,
AtToken = 58,
- EqualsToken = 59,
- PlusEqualsToken = 60,
- MinusEqualsToken = 61,
- AsteriskEqualsToken = 62,
- AsteriskAsteriskEqualsToken = 63,
- SlashEqualsToken = 64,
- PercentEqualsToken = 65,
- LessThanLessThanEqualsToken = 66,
- GreaterThanGreaterThanEqualsToken = 67,
- GreaterThanGreaterThanGreaterThanEqualsToken = 68,
- AmpersandEqualsToken = 69,
- BarEqualsToken = 70,
- CaretEqualsToken = 71,
- Identifier = 72,
- BreakKeyword = 73,
- CaseKeyword = 74,
- CatchKeyword = 75,
- ClassKeyword = 76,
- ConstKeyword = 77,
- ContinueKeyword = 78,
- DebuggerKeyword = 79,
- DefaultKeyword = 80,
- DeleteKeyword = 81,
- DoKeyword = 82,
- ElseKeyword = 83,
- EnumKeyword = 84,
- ExportKeyword = 85,
- ExtendsKeyword = 86,
- FalseKeyword = 87,
- FinallyKeyword = 88,
- ForKeyword = 89,
- FunctionKeyword = 90,
- IfKeyword = 91,
- ImportKeyword = 92,
- InKeyword = 93,
- InstanceOfKeyword = 94,
- NewKeyword = 95,
- NullKeyword = 96,
- ReturnKeyword = 97,
- SuperKeyword = 98,
- SwitchKeyword = 99,
- ThisKeyword = 100,
- ThrowKeyword = 101,
- TrueKeyword = 102,
- TryKeyword = 103,
- TypeOfKeyword = 104,
- VarKeyword = 105,
- VoidKeyword = 106,
- WhileKeyword = 107,
- WithKeyword = 108,
- ImplementsKeyword = 109,
- InterfaceKeyword = 110,
- LetKeyword = 111,
- PackageKeyword = 112,
- PrivateKeyword = 113,
- ProtectedKeyword = 114,
- PublicKeyword = 115,
- StaticKeyword = 116,
- YieldKeyword = 117,
- AbstractKeyword = 118,
- AsKeyword = 119,
- AnyKeyword = 120,
- AsyncKeyword = 121,
- AwaitKeyword = 122,
- BooleanKeyword = 123,
- ConstructorKeyword = 124,
- DeclareKeyword = 125,
- GetKeyword = 126,
- InferKeyword = 127,
- IsKeyword = 128,
- KeyOfKeyword = 129,
- ModuleKeyword = 130,
- NamespaceKeyword = 131,
- NeverKeyword = 132,
- ReadonlyKeyword = 133,
- RequireKeyword = 134,
- NumberKeyword = 135,
- ObjectKeyword = 136,
- SetKeyword = 137,
- StringKeyword = 138,
- SymbolKeyword = 139,
- TypeKeyword = 140,
- UndefinedKeyword = 141,
- UniqueKeyword = 142,
- UnknownKeyword = 143,
- FromKeyword = 144,
- GlobalKeyword = 145,
- BigIntKeyword = 146,
- OfKeyword = 147,
- QualifiedName = 148,
- ComputedPropertyName = 149,
- TypeParameter = 150,
- Parameter = 151,
- Decorator = 152,
- PropertySignature = 153,
- PropertyDeclaration = 154,
- MethodSignature = 155,
- MethodDeclaration = 156,
- Constructor = 157,
- GetAccessor = 158,
- SetAccessor = 159,
- CallSignature = 160,
- ConstructSignature = 161,
- IndexSignature = 162,
- TypePredicate = 163,
- TypeReference = 164,
- FunctionType = 165,
- ConstructorType = 166,
- TypeQuery = 167,
- TypeLiteral = 168,
- ArrayType = 169,
- TupleType = 170,
- OptionalType = 171,
- RestType = 172,
- UnionType = 173,
- IntersectionType = 174,
- ConditionalType = 175,
- InferType = 176,
- ParenthesizedType = 177,
- ThisType = 178,
- TypeOperator = 179,
- IndexedAccessType = 180,
- MappedType = 181,
- LiteralType = 182,
- ImportType = 183,
- ObjectBindingPattern = 184,
- ArrayBindingPattern = 185,
- BindingElement = 186,
- ArrayLiteralExpression = 187,
- ObjectLiteralExpression = 188,
- PropertyAccessExpression = 189,
- ElementAccessExpression = 190,
- CallExpression = 191,
- NewExpression = 192,
- TaggedTemplateExpression = 193,
- TypeAssertionExpression = 194,
- ParenthesizedExpression = 195,
- FunctionExpression = 196,
- ArrowFunction = 197,
- DeleteExpression = 198,
- TypeOfExpression = 199,
- VoidExpression = 200,
- AwaitExpression = 201,
- PrefixUnaryExpression = 202,
- PostfixUnaryExpression = 203,
- BinaryExpression = 204,
- ConditionalExpression = 205,
- TemplateExpression = 206,
- YieldExpression = 207,
- SpreadElement = 208,
- ClassExpression = 209,
- OmittedExpression = 210,
- ExpressionWithTypeArguments = 211,
- AsExpression = 212,
- NonNullExpression = 213,
- MetaProperty = 214,
- SyntheticExpression = 215,
- TemplateSpan = 216,
- SemicolonClassElement = 217,
- Block = 218,
- VariableStatement = 219,
- EmptyStatement = 220,
- ExpressionStatement = 221,
- IfStatement = 222,
- DoStatement = 223,
- WhileStatement = 224,
- ForStatement = 225,
- ForInStatement = 226,
- ForOfStatement = 227,
- ContinueStatement = 228,
- BreakStatement = 229,
- ReturnStatement = 230,
- WithStatement = 231,
- SwitchStatement = 232,
- LabeledStatement = 233,
- ThrowStatement = 234,
- TryStatement = 235,
- DebuggerStatement = 236,
- VariableDeclaration = 237,
- VariableDeclarationList = 238,
- FunctionDeclaration = 239,
- ClassDeclaration = 240,
- InterfaceDeclaration = 241,
- TypeAliasDeclaration = 242,
- EnumDeclaration = 243,
- ModuleDeclaration = 244,
- ModuleBlock = 245,
- CaseBlock = 246,
- NamespaceExportDeclaration = 247,
- ImportEqualsDeclaration = 248,
- ImportDeclaration = 249,
- ImportClause = 250,
- NamespaceImport = 251,
- NamedImports = 252,
- ImportSpecifier = 253,
- ExportAssignment = 254,
- ExportDeclaration = 255,
- NamedExports = 256,
- ExportSpecifier = 257,
- MissingDeclaration = 258,
- ExternalModuleReference = 259,
- JsxElement = 260,
- JsxSelfClosingElement = 261,
- JsxOpeningElement = 262,
- JsxClosingElement = 263,
- JsxFragment = 264,
- JsxOpeningFragment = 265,
- JsxClosingFragment = 266,
- JsxAttribute = 267,
- JsxAttributes = 268,
- JsxSpreadAttribute = 269,
- JsxExpression = 270,
- CaseClause = 271,
- DefaultClause = 272,
- HeritageClause = 273,
- CatchClause = 274,
- PropertyAssignment = 275,
- ShorthandPropertyAssignment = 276,
- SpreadAssignment = 277,
- EnumMember = 278,
- UnparsedPrologue = 279,
- UnparsedPrepend = 280,
- UnparsedText = 281,
- UnparsedInternalText = 282,
- UnparsedSyntheticReference = 283,
- SourceFile = 284,
- Bundle = 285,
- UnparsedSource = 286,
- InputFiles = 287,
- JSDocTypeExpression = 288,
- JSDocAllType = 289,
- JSDocUnknownType = 290,
- JSDocNullableType = 291,
- JSDocNonNullableType = 292,
- JSDocOptionalType = 293,
- JSDocFunctionType = 294,
- JSDocVariadicType = 295,
- JSDocComment = 296,
- JSDocTypeLiteral = 297,
- JSDocSignature = 298,
- JSDocTag = 299,
- JSDocAugmentsTag = 300,
- JSDocClassTag = 301,
- JSDocCallbackTag = 302,
- JSDocEnumTag = 303,
- JSDocParameterTag = 304,
- JSDocReturnTag = 305,
- JSDocThisTag = 306,
- JSDocTypeTag = 307,
- JSDocTemplateTag = 308,
- JSDocTypedefTag = 309,
- JSDocPropertyTag = 310,
- SyntaxList = 311,
- NotEmittedStatement = 312,
- PartiallyEmittedExpression = 313,
- CommaListExpression = 314,
- MergeDeclarationMarker = 315,
- EndOfDeclarationMarker = 316,
- Count = 317,
- FirstAssignment = 59,
- LastAssignment = 71,
- FirstCompoundAssignment = 60,
- LastCompoundAssignment = 71,
- FirstReservedWord = 73,
- LastReservedWord = 108,
- FirstKeyword = 73,
- LastKeyword = 147,
- FirstFutureReservedWord = 109,
- LastFutureReservedWord = 117,
- FirstTypeNode = 163,
- LastTypeNode = 183,
+ /** Only the JSDoc scanner produces BacktickToken. The normal scanner produces NoSubstitutionTemplateLiteral and related kinds. */
+ BacktickToken = 59,
+ EqualsToken = 60,
+ PlusEqualsToken = 61,
+ MinusEqualsToken = 62,
+ AsteriskEqualsToken = 63,
+ AsteriskAsteriskEqualsToken = 64,
+ SlashEqualsToken = 65,
+ PercentEqualsToken = 66,
+ LessThanLessThanEqualsToken = 67,
+ GreaterThanGreaterThanEqualsToken = 68,
+ GreaterThanGreaterThanGreaterThanEqualsToken = 69,
+ AmpersandEqualsToken = 70,
+ BarEqualsToken = 71,
+ CaretEqualsToken = 72,
+ Identifier = 73,
+ BreakKeyword = 74,
+ CaseKeyword = 75,
+ CatchKeyword = 76,
+ ClassKeyword = 77,
+ ConstKeyword = 78,
+ ContinueKeyword = 79,
+ DebuggerKeyword = 80,
+ DefaultKeyword = 81,
+ DeleteKeyword = 82,
+ DoKeyword = 83,
+ ElseKeyword = 84,
+ EnumKeyword = 85,
+ ExportKeyword = 86,
+ ExtendsKeyword = 87,
+ FalseKeyword = 88,
+ FinallyKeyword = 89,
+ ForKeyword = 90,
+ FunctionKeyword = 91,
+ IfKeyword = 92,
+ ImportKeyword = 93,
+ InKeyword = 94,
+ InstanceOfKeyword = 95,
+ NewKeyword = 96,
+ NullKeyword = 97,
+ ReturnKeyword = 98,
+ SuperKeyword = 99,
+ SwitchKeyword = 100,
+ ThisKeyword = 101,
+ ThrowKeyword = 102,
+ TrueKeyword = 103,
+ TryKeyword = 104,
+ TypeOfKeyword = 105,
+ VarKeyword = 106,
+ VoidKeyword = 107,
+ WhileKeyword = 108,
+ WithKeyword = 109,
+ ImplementsKeyword = 110,
+ InterfaceKeyword = 111,
+ LetKeyword = 112,
+ PackageKeyword = 113,
+ PrivateKeyword = 114,
+ ProtectedKeyword = 115,
+ PublicKeyword = 116,
+ StaticKeyword = 117,
+ YieldKeyword = 118,
+ AbstractKeyword = 119,
+ AsKeyword = 120,
+ AnyKeyword = 121,
+ AsyncKeyword = 122,
+ AwaitKeyword = 123,
+ BooleanKeyword = 124,
+ ConstructorKeyword = 125,
+ DeclareKeyword = 126,
+ GetKeyword = 127,
+ InferKeyword = 128,
+ IsKeyword = 129,
+ KeyOfKeyword = 130,
+ ModuleKeyword = 131,
+ NamespaceKeyword = 132,
+ NeverKeyword = 133,
+ ReadonlyKeyword = 134,
+ RequireKeyword = 135,
+ NumberKeyword = 136,
+ ObjectKeyword = 137,
+ SetKeyword = 138,
+ StringKeyword = 139,
+ SymbolKeyword = 140,
+ TypeKeyword = 141,
+ UndefinedKeyword = 142,
+ UniqueKeyword = 143,
+ UnknownKeyword = 144,
+ FromKeyword = 145,
+ GlobalKeyword = 146,
+ BigIntKeyword = 147,
+ OfKeyword = 148,
+ QualifiedName = 149,
+ ComputedPropertyName = 150,
+ TypeParameter = 151,
+ Parameter = 152,
+ Decorator = 153,
+ PropertySignature = 154,
+ PropertyDeclaration = 155,
+ MethodSignature = 156,
+ MethodDeclaration = 157,
+ Constructor = 158,
+ GetAccessor = 159,
+ SetAccessor = 160,
+ CallSignature = 161,
+ ConstructSignature = 162,
+ IndexSignature = 163,
+ TypePredicate = 164,
+ TypeReference = 165,
+ FunctionType = 166,
+ ConstructorType = 167,
+ TypeQuery = 168,
+ TypeLiteral = 169,
+ ArrayType = 170,
+ TupleType = 171,
+ OptionalType = 172,
+ RestType = 173,
+ UnionType = 174,
+ IntersectionType = 175,
+ ConditionalType = 176,
+ InferType = 177,
+ ParenthesizedType = 178,
+ ThisType = 179,
+ TypeOperator = 180,
+ IndexedAccessType = 181,
+ MappedType = 182,
+ LiteralType = 183,
+ ImportType = 184,
+ ObjectBindingPattern = 185,
+ ArrayBindingPattern = 186,
+ BindingElement = 187,
+ ArrayLiteralExpression = 188,
+ ObjectLiteralExpression = 189,
+ PropertyAccessExpression = 190,
+ ElementAccessExpression = 191,
+ CallExpression = 192,
+ NewExpression = 193,
+ TaggedTemplateExpression = 194,
+ TypeAssertionExpression = 195,
+ ParenthesizedExpression = 196,
+ FunctionExpression = 197,
+ ArrowFunction = 198,
+ DeleteExpression = 199,
+ TypeOfExpression = 200,
+ VoidExpression = 201,
+ AwaitExpression = 202,
+ PrefixUnaryExpression = 203,
+ PostfixUnaryExpression = 204,
+ BinaryExpression = 205,
+ ConditionalExpression = 206,
+ TemplateExpression = 207,
+ YieldExpression = 208,
+ SpreadElement = 209,
+ ClassExpression = 210,
+ OmittedExpression = 211,
+ ExpressionWithTypeArguments = 212,
+ AsExpression = 213,
+ NonNullExpression = 214,
+ MetaProperty = 215,
+ SyntheticExpression = 216,
+ TemplateSpan = 217,
+ SemicolonClassElement = 218,
+ Block = 219,
+ VariableStatement = 220,
+ EmptyStatement = 221,
+ ExpressionStatement = 222,
+ IfStatement = 223,
+ DoStatement = 224,
+ WhileStatement = 225,
+ ForStatement = 226,
+ ForInStatement = 227,
+ ForOfStatement = 228,
+ ContinueStatement = 229,
+ BreakStatement = 230,
+ ReturnStatement = 231,
+ WithStatement = 232,
+ SwitchStatement = 233,
+ LabeledStatement = 234,
+ ThrowStatement = 235,
+ TryStatement = 236,
+ DebuggerStatement = 237,
+ VariableDeclaration = 238,
+ VariableDeclarationList = 239,
+ FunctionDeclaration = 240,
+ ClassDeclaration = 241,
+ InterfaceDeclaration = 242,
+ TypeAliasDeclaration = 243,
+ EnumDeclaration = 244,
+ ModuleDeclaration = 245,
+ ModuleBlock = 246,
+ CaseBlock = 247,
+ NamespaceExportDeclaration = 248,
+ ImportEqualsDeclaration = 249,
+ ImportDeclaration = 250,
+ ImportClause = 251,
+ NamespaceImport = 252,
+ NamedImports = 253,
+ ImportSpecifier = 254,
+ ExportAssignment = 255,
+ ExportDeclaration = 256,
+ NamedExports = 257,
+ ExportSpecifier = 258,
+ MissingDeclaration = 259,
+ ExternalModuleReference = 260,
+ JsxElement = 261,
+ JsxSelfClosingElement = 262,
+ JsxOpeningElement = 263,
+ JsxClosingElement = 264,
+ JsxFragment = 265,
+ JsxOpeningFragment = 266,
+ JsxClosingFragment = 267,
+ JsxAttribute = 268,
+ JsxAttributes = 269,
+ JsxSpreadAttribute = 270,
+ JsxExpression = 271,
+ CaseClause = 272,
+ DefaultClause = 273,
+ HeritageClause = 274,
+ CatchClause = 275,
+ PropertyAssignment = 276,
+ ShorthandPropertyAssignment = 277,
+ SpreadAssignment = 278,
+ EnumMember = 279,
+ UnparsedPrologue = 280,
+ UnparsedPrepend = 281,
+ UnparsedText = 282,
+ UnparsedInternalText = 283,
+ UnparsedSyntheticReference = 284,
+ SourceFile = 285,
+ Bundle = 286,
+ UnparsedSource = 287,
+ InputFiles = 288,
+ JSDocTypeExpression = 289,
+ JSDocAllType = 290,
+ JSDocUnknownType = 291,
+ JSDocNullableType = 292,
+ JSDocNonNullableType = 293,
+ JSDocOptionalType = 294,
+ JSDocFunctionType = 295,
+ JSDocVariadicType = 296,
+ JSDocComment = 297,
+ JSDocTypeLiteral = 298,
+ JSDocSignature = 299,
+ JSDocTag = 300,
+ JSDocAugmentsTag = 301,
+ JSDocClassTag = 302,
+ JSDocCallbackTag = 303,
+ JSDocEnumTag = 304,
+ JSDocParameterTag = 305,
+ JSDocReturnTag = 306,
+ JSDocThisTag = 307,
+ JSDocTypeTag = 308,
+ JSDocTemplateTag = 309,
+ JSDocTypedefTag = 310,
+ JSDocPropertyTag = 311,
+ SyntaxList = 312,
+ NotEmittedStatement = 313,
+ PartiallyEmittedExpression = 314,
+ CommaListExpression = 315,
+ MergeDeclarationMarker = 316,
+ EndOfDeclarationMarker = 317,
+ Count = 318,
+ FirstAssignment = 60,
+ LastAssignment = 72,
+ FirstCompoundAssignment = 61,
+ LastCompoundAssignment = 72,
+ FirstReservedWord = 74,
+ LastReservedWord = 109,
+ FirstKeyword = 74,
+ LastKeyword = 148,
+ FirstFutureReservedWord = 110,
+ LastFutureReservedWord = 118,
+ FirstTypeNode = 164,
+ LastTypeNode = 184,
FirstPunctuation = 18,
- LastPunctuation = 71,
+ LastPunctuation = 72,
FirstToken = 0,
- LastToken = 147,
+ LastToken = 148,
FirstTriviaToken = 2,
LastTriviaToken = 7,
FirstLiteralToken = 8,
@@ -417,12 +419,12 @@
FirstTemplateToken = 14,
LastTemplateToken = 17,
FirstBinaryOperator = 28,
- LastBinaryOperator = 71,
- FirstNode = 148,
- FirstJSDocNode = 288,
- LastJSDocNode = 310,
- FirstJSDocTagNode = 299,
- LastJSDocTagNode = 310,
+ LastBinaryOperator = 72,
+ FirstNode = 149,
+ FirstJSDocNode = 289,
+ LastJSDocNode = 311,
+ FirstJSDocTagNode = 300,
+ LastJSDocTagNode = 311,
}
enum NodeFlags {
None = 0,
@@ -626,7 +628,7 @@
initializer?: Expression;
}
interface ObjectLiteralElement extends NamedDeclaration {
- _objectLiteralBrandBrand: any;
+ _objectLiteralBrand: any;
name?: PropertyName;
}
/** Unlike ObjectLiteralElement, excludes JSXAttribute and JSXSpreadAttribute. */
@@ -1601,7 +1603,7 @@
}
interface JSDocTypeTag extends JSDocTag {
kind: SyntaxKind.JSDocTypeTag;
- typeExpression?: JSDocTypeExpression;
+ typeExpression: JSDocTypeExpression;
}
interface JSDocTypedefTag extends JSDocTag, NamedDeclaration {
parent: JSDoc;
@@ -1877,13 +1879,18 @@
sourceFile: SourceFile;
references?: ReadonlyArray<ResolvedProjectReference | undefined>;
}
+ type CustomTransformerFactory = (context: TransformationContext) => CustomTransformer;
+ interface CustomTransformer {
+ transformSourceFile(node: SourceFile): SourceFile;
+ transformBundle(node: Bundle): Bundle;
+ }
interface CustomTransformers {
/** Custom transformers to evaluate before built-in .js transformations. */
- before?: TransformerFactory<SourceFile>[];
+ before?: (TransformerFactory<SourceFile> | CustomTransformerFactory)[];
/** Custom transformers to evaluate after built-in .js transformations. */
- after?: TransformerFactory<SourceFile>[];
+ after?: (TransformerFactory<SourceFile> | CustomTransformerFactory)[];
/** Custom transformers to evaluate after built-in .d.ts transformations. */
- afterDeclarations?: TransformerFactory<Bundle | SourceFile>[];
+ afterDeclarations?: (TransformerFactory<Bundle | SourceFile> | CustomTransformerFactory)[];
}
interface SourceMapSpan {
/** Line number in the .js file. */
@@ -1962,6 +1969,7 @@
*/
getExportSymbolOfSymbol(symbol: Symbol): Symbol;
getPropertySymbolOfDestructuringAssignment(location: Identifier): Symbol | undefined;
+ getTypeOfAssignmentPattern(pattern: AssignmentPattern): Type;
getTypeAtLocation(node: Node): Type;
getTypeFromTypeNode(node: TypeNode): Type;
signatureToString(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): string;
@@ -2359,7 +2367,8 @@
objectType: Type;
indexType: Type;
constraint?: Type;
- simplified?: Type;
+ simplifiedForReading?: Type;
+ simplifiedForWriting?: Type;
}
type TypeVariable = TypeParameter | IndexedAccessType;
interface IndexType extends InstantiableType {
@@ -2382,8 +2391,8 @@
root: ConditionalRoot;
checkType: Type;
extendsType: Type;
- trueType: Type;
- falseType: Type;
+ resolvedTrueType: Type;
+ resolvedFalseType: Type;
}
interface SubstitutionType extends InstantiableType {
typeVariable: TypeVariable;
@@ -2410,12 +2419,13 @@
enum InferencePriority {
NakedTypeVariable = 1,
HomomorphicMappedType = 2,
- MappedTypeConstraint = 4,
- ReturnType = 8,
- LiteralKeyof = 16,
- NoConstraints = 32,
- AlwaysStrict = 64,
- PriorityImpliesCombination = 28
+ PartialHomomorphicMappedType = 4,
+ MappedTypeConstraint = 8,
+ ReturnType = 16,
+ LiteralKeyof = 32,
+ NoConstraints = 64,
+ AlwaysStrict = 128,
+ PriorityImpliesCombination = 56
}
/** @deprecated Use FileExtensionInfo instead. */
type JsFileExtensionInfo = FileExtensionInfo;
@@ -2489,6 +2499,7 @@
interface CompilerOptions {
allowJs?: boolean;
allowSyntheticDefaultImports?: boolean;
+ allowUmdGlobalAccess?: boolean;
allowUnreachableCode?: boolean;
allowUnusedLabels?: boolean;
alwaysStrict?: boolean;
@@ -2621,9 +2632,10 @@
ES2017 = 4,
ES2018 = 5,
ES2019 = 6,
- ESNext = 7,
+ ES2020 = 7,
+ ESNext = 8,
JSON = 100,
- Latest = 7
+ Latest = 8
}
enum LanguageVariant {
Standard = 0,
@@ -2756,6 +2768,7 @@
resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string, redirectedReference?: ResolvedProjectReference): (ResolvedTypeReferenceDirective | undefined)[];
getEnvironmentVariable?(name: string): string | undefined;
createHash?(data: string): string;
+ getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined;
}
interface SourceMapRange extends TextRange {
source?: SourceMapSource;
@@ -3159,7 +3172,7 @@
reScanJsxToken(): JsxTokenSyntaxKind;
reScanLessThanToken(): SyntaxKind;
scanJsxToken(): JsxTokenSyntaxKind;
- scanJSDocToken(): JsDocSyntaxKind;
+ scanJsDocToken(): JSDocSyntaxKind;
scan(): SyntaxKind;
getText(): string;
setText(text: string | undefined, start?: number, length?: number): void;
@@ -3627,7 +3640,7 @@
/**
* Reads the config file, reports errors if any and exits if the config file cannot be found
*/
- function getParsedCommandLineOfConfigFile(configFileName: string, optionsToExtend: CompilerOptions, host: ParseConfigFileHost): ParsedCommandLine | undefined;
+ function getParsedCommandLineOfConfigFile(configFileName: string, optionsToExtend: CompilerOptions, host: ParseConfigFileHost, extendedConfigCache?: Map<ExtendedConfigCacheEntry>): ParsedCommandLine | undefined;
/**
* Read tsconfig.json file
* @param fileName The path to the config file
@@ -3661,7 +3674,7 @@
* @param basePath A root directory to resolve relative path entries in the config
* file to. e.g. outDir
*/
- function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: ReadonlyArray<FileExtensionInfo>): ParsedCommandLine;
+ function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: ReadonlyArray<FileExtensionInfo>, extendedConfigCache?: Map<ExtendedConfigCacheEntry>): ParsedCommandLine;
/**
* Parse the contents of a config file (tsconfig.json).
* @param jsonNode The contents of the config file to parse
@@ -3669,7 +3682,20 @@
* @param basePath A root directory to resolve relative path entries in the config
* file to. e.g. outDir
*/
- function parseJsonSourceFileConfigFileContent(sourceFile: TsConfigSourceFile, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: ReadonlyArray<FileExtensionInfo>): ParsedCommandLine;
+ function parseJsonSourceFileConfigFileContent(sourceFile: TsConfigSourceFile, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: ReadonlyArray<FileExtensionInfo>, extendedConfigCache?: Map<ExtendedConfigCacheEntry>): ParsedCommandLine;
+ interface ParsedTsconfig {
+ raw: any;
+ options?: CompilerOptions;
+ typeAcquisition?: TypeAcquisition;
+ /**
+ * Note that the case of the config path has not yet been normalized, as no files have been imported into the project yet
+ */
+ extendedConfigPath?: string;
+ }
+ interface ExtendedConfigCacheEntry {
+ extendedResult: TsConfigSourceFile;
+ extendedConfig: ParsedTsconfig | undefined;
+ }
function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): {
options: CompilerOptions;
errors: Diagnostic[];
@@ -3714,7 +3740,7 @@
get(directory: string): ResolvedModuleWithFailedLookupLocations | undefined;
set(directory: string, result: ResolvedModuleWithFailedLookupLocations): void;
}
- function createModuleResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string): ModuleResolutionCache;
+ function createModuleResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string, options?: CompilerOptions): ModuleResolutionCache;
function resolveModuleNameFromCache(moduleName: string, containingFile: string, cache: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations | undefined;
function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations;
function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations;
@@ -3837,7 +3863,7 @@
function updateArrayLiteral(node: ArrayLiteralExpression, elements: ReadonlyArray<Expression>): ArrayLiteralExpression;
function createObjectLiteral(properties?: ReadonlyArray<ObjectLiteralElementLike>, multiLine?: boolean): ObjectLiteralExpression;
function updateObjectLiteral(node: ObjectLiteralExpression, properties: ReadonlyArray<ObjectLiteralElementLike>): ObjectLiteralExpression;
- function createPropertyAccess(expression: Expression, name: string | Identifier | undefined): PropertyAccessExpression;
+ function createPropertyAccess(expression: Expression, name: string | Identifier): PropertyAccessExpression;
function updatePropertyAccess(node: PropertyAccessExpression, expression: Expression, name: Identifier): PropertyAccessExpression;
function createElementAccess(expression: Expression, index: number | Expression): ElementAccessExpression;
function updateElementAccess(node: ElementAccessExpression, expression: Expression, argumentExpression: Expression): ElementAccessExpression;
@@ -4052,7 +4078,7 @@
function createInputFiles(javascriptText: string, declarationText: string): InputFiles;
function createInputFiles(readFileText: (path: string) => string | undefined, javascriptPath: string, javascriptMapPath: string | undefined, declarationPath: string, declarationMapPath: string | undefined, buildInfoPath: string | undefined): InputFiles;
function createInputFiles(javascriptText: string, declarationText: string, javascriptMapPath: string | undefined, javascriptMapText: string | undefined, declarationMapPath: string | undefined, declarationMapText: string | undefined): InputFiles;
- function updateBundle(node: Bundle, sourceFiles: ReadonlyArray<SourceFile>, prepends?: ReadonlyArray<UnparsedSource>): Bundle;
+ function updateBundle(node: Bundle, sourceFiles: ReadonlyArray<SourceFile>, prepends?: ReadonlyArray<UnparsedSource | InputFiles>): Bundle;
function createImmediatelyInvokedFunctionExpression(statements: ReadonlyArray<Statement>): CallExpression;
function createImmediatelyInvokedFunctionExpression(statements: ReadonlyArray<Statement>, param: ParameterDeclaration, paramValue: Expression): CallExpression;
function createImmediatelyInvokedArrowFunction(statements: ReadonlyArray<Statement>): CallExpression;
@@ -4540,13 +4566,12 @@
type ActionSet = "action::set";
type ActionInvalidate = "action::invalidate";
type ActionPackageInstalled = "action::packageInstalled";
- type ActionValueInspected = "action::valueInspected";
type EventTypesRegistry = "event::typesRegistry";
type EventBeginInstallTypes = "event::beginInstallTypes";
type EventEndInstallTypes = "event::endInstallTypes";
type EventInitializationFailed = "event::initializationFailed";
interface TypingInstallerResponse {
- readonly kind: ActionSet | ActionInvalidate | EventTypesRegistry | ActionPackageInstalled | ActionValueInspected | EventBeginInstallTypes | EventEndInstallTypes | EventInitializationFailed;
+ readonly kind: ActionSet | ActionInvalidate | EventTypesRegistry | ActionPackageInstalled | EventBeginInstallTypes | EventEndInstallTypes | EventInitializationFailed;
}
interface TypingInstallerRequestWithProjectName {
readonly projectName: string;
@@ -4785,6 +4810,7 @@
getSignatureHelpItems(fileName: string, position: number, options: SignatureHelpItemsOptions | undefined): SignatureHelpItems | undefined;
getRenameInfo(fileName: string, position: number, options?: RenameInfoOptions): RenameInfo;
findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean, providePrefixAndSuffixTextForRename?: boolean): ReadonlyArray<RenameLocation> | undefined;
+ getSmartSelectionRange(fileName: string, position: number): SelectionRange;
getDefinitionAtPosition(fileName: string, position: number): ReadonlyArray<DefinitionInfo> | undefined;
getDefinitionAndBoundSpan(fileName: string, position: number): DefinitionInfoAndBoundSpan | undefined;
getTypeDefinitionAtPosition(fileName: string, position: number): ReadonlyArray<DefinitionInfo> | undefined;
@@ -4979,16 +5005,9 @@
changes: ReadonlyArray<FileTextChanges>;
commands?: ReadonlyArray<CodeActionCommand>;
}
- type CodeActionCommand = InstallPackageAction | GenerateTypesAction;
+ type CodeActionCommand = InstallPackageAction;
interface InstallPackageAction {
}
- interface GenerateTypesAction extends GenerateTypesOptions {
- }
- interface GenerateTypesOptions {
- readonly file: string;
- readonly fileToGenerateTypesFor: string;
- readonly outputFileName: string;
- }
/**
* A set of one or more available refactoring actions, grouped under a parent refactoring.
*/
@@ -5236,6 +5255,10 @@
displayParts: SymbolDisplayPart[];
isOptional: boolean;
}
+ interface SelectionRange {
+ textSpan: TextSpan;
+ parent?: SelectionRange;
+ }
/**
* Represents a single signature to show in signature help.
* The id is used for subsequent calls into the language service to ask questions about the
@@ -5613,10 +5636,6 @@
function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[], moduleName?: string): string;
}
declare namespace ts {
- function generateTypesForModule(name: string, moduleValue: unknown, formatSettings: FormatCodeSettings): string;
- function generateTypesForGlobal(name: string, globalValue: unknown, formatSettings: FormatCodeSettings): string;
-}
-declare namespace ts {
/** The version of the language service API */
const servicesVersion = "0.8";
function toEditorSettings(options: EditorOptions | EditorSettings): EditorSettings;
@@ -5787,7 +5806,8 @@
GetEditsForRefactor = "getEditsForRefactor",
OrganizeImports = "organizeImports",
GetEditsForFileRename = "getEditsForFileRename",
- ConfigurePlugin = "configurePlugin"
+ ConfigurePlugin = "configurePlugin",
+ SelectionRange = "selectionRange",
}
/**
* A TypeScript Server message
@@ -6750,6 +6770,20 @@
}
interface ConfigurePluginResponse extends Response {
}
+ interface SelectionRangeRequest extends FileRequest {
+ command: CommandTypes.SelectionRange;
+ arguments: SelectionRangeRequestArgs;
+ }
+ interface SelectionRangeRequestArgs extends FileRequestArgs {
+ locations: Location[];
+ }
+ interface SelectionRangeResponse extends Response {
+ body?: SelectionRange[];
+ }
+ interface SelectionRange {
+ textSpan: TextSpan;
+ parent?: SelectionRange;
+ }
/**
* Information found in an "open" request.
*/
@@ -8135,6 +8169,9 @@
ES2015 = "ES2015",
ES2016 = "ES2016",
ES2017 = "ES2017",
+ ES2018 = "ES2018",
+ ES2019 = "ES2019",
+ ES2020 = "ES2020",
ESNext = "ESNext"
}
}
@@ -8284,7 +8321,7 @@
private readonly cancellationToken;
isNonTsProject(): boolean;
isJsOnlyProject(): boolean;
- static resolveModule(moduleName: string, initialDir: string, host: ServerHost, log: (message: string) => void): {} | undefined;
+ static resolveModule(moduleName: string, initialDir: string, host: ServerHost, log: (message: string) => void, logErrors?: (message: string) => void): {} | undefined;
isKnownTypesPackageName(name: string): boolean;
installPackage(options: InstallPackageOptions): Promise<ApplyCodeActionCommandResult>;
private readonly typingsCache;
@@ -9023,6 +9060,8 @@
private getBraceMatching;
private getDiagnosticsForProject;
private configurePlugin;
+ private getSmartSelectionRange;
+ private mapSelectionRange;
getCanonicalFileName(fileName: string): string;
exit(): void;
private notRequired;

lib/tsserverlibrary.js

@@ -74,17 +74,19 @@
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
t[p] = s[p];
if (s != null && typeof Object.getOwnPropertySymbols === "function")
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
t[p[i]] = s[p[i]];
+ }
return t;
};
var ts;
(function (ts) {
// WARNING: The script `configureNightly.ts` uses a regexp to parse out these values.
// If changing the text in this section, be sure to test `configureNightly` too.
- ts.versionMajorMinor = "3.4";
+ ts.versionMajorMinor = "3.5";
/** The version of the TypeScript compiler release */
- ts.version = ts.versionMajorMinor + ".5";
+ ts.version = ts.versionMajorMinor + ".1";
})(ts || (ts = {}));
(function (ts) {
/* @internal */
@@ -214,7 +216,7 @@
entry.nextEntry.previousEntry = previousEntry;
}
// When the deleted entry was the last one, we need to
- // adust the lastEntry reference.
+ // adjust the lastEntry reference.
if (this.lastEntry === entry) {
this.lastEntry = previousEntry;
}
@@ -324,7 +326,7 @@
ts.firstDefinedIterator = firstDefinedIterator;
function zipWith(arrayA, arrayB, callback) {
var result = [];
- Debug.assertEqual(arrayA.length, arrayB.length);
+ ts.Debug.assertEqual(arrayA.length, arrayB.length);
for (var i = 0; i < arrayA.length; i++) {
result.push(callback(arrayA[i], arrayB[i], i));
}
@@ -332,7 +334,7 @@
}
ts.zipWith = zipWith;
function zipToIterator(arrayA, arrayB) {
- Debug.assertEqual(arrayA.length, arrayB.length);
+ ts.Debug.assertEqual(arrayA.length, arrayB.length);
var i = 0;
return {
next: function () {
@@ -346,7 +348,7 @@
}
ts.zipToIterator = zipToIterator;
function zipToMap(keys, values) {
- Debug.assert(keys.length === values.length);
+ ts.Debug.assert(keys.length === values.length);
var map = createMap();
for (var i = 0; i < keys.length; ++i) {
map.set(keys[i], values[i]);
@@ -420,7 +422,7 @@
return result;
}
}
- return Debug.fail();
+ return ts.Debug.fail();
}
ts.findMap = findMap;
function contains(array, value, equalityComparer) {
@@ -850,7 +852,7 @@
continue;
case -1 /* LessThan */:
// If `array` is sorted, `next` should **never** be less than `last`.
- return Debug.fail("Array is unsorted.");
+ return ts.Debug.fail("Array is unsorted.");
}
deduplicated.push(last = next);
}
@@ -917,13 +919,13 @@
loopB: for (var offsetA = 0, offsetB = 0; offsetB < arrayB.length; offsetB++) {
if (offsetB > 0) {
// Ensure `arrayB` is properly sorted.
- Debug.assertGreaterThanOrEqual(comparer(arrayB[offsetB], arrayB[offsetB - 1]), 0 /* EqualTo */);
+ ts.Debug.assertGreaterThanOrEqual(comparer(arrayB[offsetB], arrayB[offsetB - 1]), 0 /* EqualTo */);
}
loopA: for (var startA = offsetA; offsetA < arrayA.length; offsetA++) {
if (offsetA > startA) {
// Ensure `arrayA` is properly sorted. We only need to perform this check if
// `offsetA` has changed since we entered the loop.
- Debug.assertGreaterThanOrEqual(comparer(arrayA[offsetA], arrayA[offsetA - 1]), 0 /* EqualTo */);
+ ts.Debug.assertGreaterThanOrEqual(comparer(arrayA[offsetA], arrayA[offsetA - 1]), 0 /* EqualTo */);
}
switch (comparer(arrayB[offsetB], arrayA[offsetA])) {
case -1 /* LessThan */:
@@ -1093,7 +1095,7 @@
}
ts.firstOrUndefined = firstOrUndefined;
function first(array) {
- Debug.assert(array.length !== 0);
+ ts.Debug.assert(array.length !== 0);
return array[0];
}
ts.first = first;
@@ -1105,7 +1107,7 @@
}
ts.lastOrUndefined = lastOrUndefined;
function last(array) {
- Debug.assert(array.length !== 0);
+ ts.Debug.assert(array.length !== 0);
return array[array.length - 1];
}
ts.last = last;
@@ -1430,7 +1432,7 @@
function cast(value, test) {
if (value !== undefined && test(value))
return value;
- return Debug.fail("Invalid cast. The supplied value " + value + " did not pass the test '" + Debug.getFunctionName(test) + "'.");
+ return ts.Debug.fail("Invalid cast. The supplied value " + value + " did not pass the test '" + ts.Debug.getFunctionName(test) + "'.");
}
ts.cast = cast;
/** Does nothing. */
@@ -1467,38 +1469,13 @@
};
}
ts.memoize = memoize;
- function chain(a, b, c, d, e) {
+ function compose(a, b, c, d, e) {
if (e) {
var args_2 = [];
for (var i = 0; i < arguments.length; i++) {
args_2[i] = arguments[i];
}
- return function (t) { return compose.apply(void 0, map(args_2, function (f) { return f(t); })); };
- }
- else if (d) {
- return function (t) { return compose(a(t), b(t), c(t), d(t)); };
- }
- else if (c) {
- return function (t) { return compose(a(t), b(t), c(t)); };
- }
- else if (b) {
- return function (t) { return compose(a(t), b(t)); };
- }
- else if (a) {
- return function (t) { return compose(a(t)); };
- }
- else {
- return function (_) { return function (u) { return u; }; };
- }
- }
- ts.chain = chain;
- function compose(a, b, c, d, e) {
- if (e) {
- var args_3 = [];
- for (var i = 0; i < arguments.length; i++) {
- args_3[i] = arguments[i];
- }
- return function (t) { return reduceLeft(args_3, function (u, f) { return f(u); }, t); };
+ return function (t) { return reduceLeft(args_2, function (u, f) { return f(u); }, t); };
}
else if (d) {
return function (t) { return d(c(b(a(t)))); };
@@ -1524,92 +1501,6 @@
AssertionLevel[AssertionLevel["Aggressive"] = 2] = "Aggressive";
AssertionLevel[AssertionLevel["VeryAggressive"] = 3] = "VeryAggressive";
})(AssertionLevel = ts.AssertionLevel || (ts.AssertionLevel = {}));
- var Debug;
- (function (Debug) {
- Debug.currentAssertionLevel = 0 /* None */;
- Debug.isDebugging = false;
- function shouldAssert(level) {
- return Debug.currentAssertionLevel >= level;
- }
- Debug.shouldAssert = shouldAssert;
- function assert(expression, message, verboseDebugInfo, stackCrawlMark) {
- if (!expression) {
- if (verboseDebugInfo) {
- message += "\r\nVerbose Debug Information: " + (typeof verboseDebugInfo === "string" ? verboseDebugInfo : verboseDebugInfo());
- }
- fail(message ? "False expression: " + message : "False expression.", stackCrawlMark || assert);
- }
- }
- Debug.assert = assert;
- function assertEqual(a, b, msg, msg2) {
- if (a !== b) {
- var message = msg ? msg2 ? msg + " " + msg2 : msg : "";
- fail("Expected " + a + " === " + b + ". " + message);
- }
- }
- Debug.assertEqual = assertEqual;
- function assertLessThan(a, b, msg) {
- if (a >= b) {
- fail("Expected " + a + " < " + b + ". " + (msg || ""));
- }
- }
- Debug.assertLessThan = assertLessThan;
- function assertLessThanOrEqual(a, b) {
- if (a > b) {
- fail("Expected " + a + " <= " + b);
- }
- }
- Debug.assertLessThanOrEqual = assertLessThanOrEqual;
- function assertGreaterThanOrEqual(a, b) {
- if (a < b) {
- fail("Expected " + a + " >= " + b);
- }
- }
- Debug.assertGreaterThanOrEqual = assertGreaterThanOrEqual;
- function fail(message, stackCrawlMark) {
- debugger;
- var e = new Error(message ? "Debug Failure. " + message : "Debug Failure.");
- if (Error.captureStackTrace) {
- Error.captureStackTrace(e, stackCrawlMark || fail);
- }
- throw e;
- }
- Debug.fail = fail;
- function assertDefined(value, message) {
- if (value === undefined || value === null)
- return fail(message);
- return value;
- }
- Debug.assertDefined = assertDefined;
- function assertEachDefined(value, message) {
- for (var _i = 0, value_1 = value; _i < value_1.length; _i++) {
- var v = value_1[_i];
- assertDefined(v, message);
- }
- return value;
- }
- Debug.assertEachDefined = assertEachDefined;
- function assertNever(member, message, stackCrawlMark) {
- if (message === void 0) { message = "Illegal value:"; }
- var detail = typeof member === "object" && "kind" in member && "pos" in member ? "SyntaxKind: " + Debug.showSyntaxKind(member) : JSON.stringify(member);
- return fail(message + " " + detail, stackCrawlMark || assertNever);
- }
- Debug.assertNever = assertNever;
- function getFunctionName(func) {
- if (typeof func !== "function") {
- return "";
- }
- else if (func.hasOwnProperty("name")) {
- return func.name;
- }
- else {
- var text = Function.prototype.toString.call(func);
- var match = /^function\s+([\w\$]+)\s*\(/.exec(text);
- return match ? match[1] : "";
- }
- }
- Debug.getFunctionName = getFunctionName;
- })(Debug = ts.Debug || (ts.Debug = {}));
function equateValues(a, b) {
return a === b;
}
@@ -1866,7 +1757,7 @@
bestCandidate = candidate;
}
else {
- Debug.assert(distance < bestDistance); // Else `levenshteinWithMax` should return undefined
+ ts.Debug.assert(distance < bestDistance); // Else `levenshteinWithMax` should return undefined
bestDistance = distance;
bestCandidate = candidate;
}
@@ -2010,7 +1901,7 @@
* E.g.: matchedText(tryParsePattern("foo*baz"), "foobarbaz") === "bar"
*/
function matchedText(pattern, candidate) {
- Debug.assert(isPatternMatch(pattern, candidate));
+ ts.Debug.assert(isPatternMatch(pattern, candidate));
return candidate.substring(pattern.prefix.length, candidate.length - pattern.suffix.length);
}
ts.matchedText = matchedText;
@@ -2103,6 +1994,267 @@
return result;
}
ts.fill = fill;
+ function cartesianProduct(arrays) {
+ var result = [];
+ cartesianProductWorker(arrays, result, /*outer*/ undefined, 0);
+ return result;
+ }
+ ts.cartesianProduct = cartesianProduct;
+ function cartesianProductWorker(arrays, result, outer, index) {
+ for (var _i = 0, _a = arrays[index]; _i < _a.length; _i++) {
+ var element = _a[_i];
+ var inner = void 0;
+ if (outer) {
+ inner = outer.slice();
+ inner.push(element);
+ }
+ else {
+ inner = [element];
+ }
+ if (index === arrays.length - 1) {
+ result.push(inner);
+ }
+ else {
+ cartesianProductWorker(arrays, result, inner, index + 1);
+ }
+ }
+ }
+})(ts || (ts = {}));
+/* @internal */
+var ts;
+(function (ts) {
+ var Debug;
+ (function (Debug) {
+ Debug.currentAssertionLevel = 0 /* None */;
+ Debug.isDebugging = false;
+ function shouldAssert(level) {
+ return Debug.currentAssertionLevel >= level;
+ }
+ Debug.shouldAssert = shouldAssert;
+ function assert(expression, message, verboseDebugInfo, stackCrawlMark) {
+ if (!expression) {
+ if (verboseDebugInfo) {
+ message += "\r\nVerbose Debug Information: " + (typeof verboseDebugInfo === "string" ? verboseDebugInfo : verboseDebugInfo());
+ }
+ fail(message ? "False expression: " + message : "False expression.", stackCrawlMark || assert);
+ }
+ }
+ Debug.assert = assert;
+ function assertEqual(a, b, msg, msg2) {
+ if (a !== b) {
+ var message = msg ? msg2 ? msg + " " + msg2 : msg : "";
+ fail("Expected " + a + " === " + b + ". " + message);
+ }
+ }
+ Debug.assertEqual = assertEqual;
+ function assertLessThan(a, b, msg) {
+ if (a >= b) {
+ fail("Expected " + a + " < " + b + ". " + (msg || ""));
+ }
+ }
+ Debug.assertLessThan = assertLessThan;
+ function assertLessThanOrEqual(a, b) {
+ if (a > b) {
+ fail("Expected " + a + " <= " + b);
+ }
+ }
+ Debug.assertLessThanOrEqual = assertLessThanOrEqual;
+ function assertGreaterThanOrEqual(a, b) {
+ if (a < b) {
+ fail("Expected " + a + " >= " + b);
+ }
+ }
+ Debug.assertGreaterThanOrEqual = assertGreaterThanOrEqual;
+ function fail(message, stackCrawlMark) {
+ debugger;
+ var e = new Error(message ? "Debug Failure. " + message : "Debug Failure.");
+ if (Error.captureStackTrace) {
+ Error.captureStackTrace(e, stackCrawlMark || fail);
+ }
+ throw e;
+ }
+ Debug.fail = fail;
+ function assertDefined(value, message) {
+ if (value === undefined || value === null)
+ return fail(message);
+ return value;
+ }
+ Debug.assertDefined = assertDefined;
+ function assertEachDefined(value, message) {
+ for (var _i = 0, value_1 = value; _i < value_1.length; _i++) {
+ var v = value_1[_i];
+ assertDefined(v, message);
+ }
+ return value;
+ }
+ Debug.assertEachDefined = assertEachDefined;
+ function assertNever(member, message, stackCrawlMark) {
+ if (message === void 0) { message = "Illegal value:"; }
+ var detail = typeof member === "object" && "kind" in member && "pos" in member && formatSyntaxKind ? "SyntaxKind: " + formatSyntaxKind(member.kind) : JSON.stringify(member);
+ return fail(message + " " + detail, stackCrawlMark || assertNever);
+ }
+ Debug.assertNever = assertNever;
+ function getFunctionName(func) {
+ if (typeof func !== "function") {
+ return "";
+ }
+ else if (func.hasOwnProperty("name")) {
+ return func.name;
+ }
+ else {
+ var text = Function.prototype.toString.call(func);
+ var match = /^function\s+([\w\$]+)\s*\(/.exec(text);
+ return match ? match[1] : "";
+ }
+ }
+ Debug.getFunctionName = getFunctionName;
+ function formatSymbol(symbol) {
+ return "{ name: " + ts.unescapeLeadingUnderscores(symbol.escapedName) + "; flags: " + formatSymbolFlags(symbol.flags) + "; declarations: " + ts.map(symbol.declarations, function (node) { return formatSyntaxKind(node.kind); }) + " }";
+ }
+ Debug.formatSymbol = formatSymbol;
+ /**
+ * Formats an enum value as a string for debugging and debug assertions.
+ */
+ function formatEnum(value, enumObject, isFlags) {
+ if (value === void 0) { value = 0; }
+ var members = getEnumMembers(enumObject);
+ if (value === 0) {
+ return members.length > 0 && members[0][0] === 0 ? members[0][1] : "0";
+ }
+ if (isFlags) {
+ var result = "";
+ var remainingFlags = value;
+ for (var i = members.length - 1; i >= 0 && remainingFlags !== 0; i--) {
+ var _a = members[i], enumValue = _a[0], enumName = _a[1];
+ if (enumValue !== 0 && (remainingFlags & enumValue) === enumValue) {
+ remainingFlags &= ~enumValue;
+ result = "" + enumName + (result ? "|" : "") + result;
+ }
+ }
+ if (remainingFlags === 0) {
+ return result;
+ }
+ }
+ else {
+ for (var _i = 0, members_1 = members; _i < members_1.length; _i++) {
+ var _b = members_1[_i], enumValue = _b[0], enumName = _b[1];
+ if (enumValue === value) {
+ return enumName;
+ }
+ }
+ }
+ return value.toString();
+ }
+ Debug.formatEnum = formatEnum;
+ function getEnumMembers(enumObject) {
+ var result = [];
+ for (var name in enumObject) {
+ var value = enumObject[name];
+ if (typeof value === "number") {
+ result.push([value, name]);
+ }
+ }
+ return ts.stableSort(result, function (x, y) { return ts.compareValues(x[0], y[0]); });
+ }
+ function formatSyntaxKind(kind) {
+ return formatEnum(kind, ts.SyntaxKind, /*isFlags*/ false);
+ }
+ Debug.formatSyntaxKind = formatSyntaxKind;
+ function formatNodeFlags(flags) {
+ return formatEnum(flags, ts.NodeFlags, /*isFlags*/ true);
+ }
+ Debug.formatNodeFlags = formatNodeFlags;
+ function formatModifierFlags(flags) {
+ return formatEnum(flags, ts.ModifierFlags, /*isFlags*/ true);
+ }
+ Debug.formatModifierFlags = formatModifierFlags;
+ function formatTransformFlags(flags) {
+ return formatEnum(flags, ts.TransformFlags, /*isFlags*/ true);
+ }
+ Debug.formatTransformFlags = formatTransformFlags;
+ function formatEmitFlags(flags) {
+ return formatEnum(flags, ts.EmitFlags, /*isFlags*/ true);
+ }
+ Debug.formatEmitFlags = formatEmitFlags;
+ function formatSymbolFlags(flags) {
+ return formatEnum(flags, ts.SymbolFlags, /*isFlags*/ true);
+ }
+ Debug.formatSymbolFlags = formatSymbolFlags;
+ function formatTypeFlags(flags) {
+ return formatEnum(flags, ts.TypeFlags, /*isFlags*/ true);
+ }
+ Debug.formatTypeFlags = formatTypeFlags;
+ function formatObjectFlags(flags) {
+ return formatEnum(flags, ts.ObjectFlags, /*isFlags*/ true);
+ }
+ Debug.formatObjectFlags = formatObjectFlags;
+ function failBadSyntaxKind(node, message) {
+ return fail((message || "Unexpected node.") + "\r\nNode " + formatSyntaxKind(node.kind) + " was unexpected.", failBadSyntaxKind);
+ }
+ Debug.failBadSyntaxKind = failBadSyntaxKind;
+ Debug.assertEachNode = shouldAssert(1 /* Normal */)
+ ? function (nodes, test, message) { return assert(test === undefined || ts.every(nodes, test), message || "Unexpected node.", function () { return "Node array did not pass test '" + getFunctionName(test) + "'."; }, Debug.assertEachNode); }
+ : ts.noop;
+ Debug.assertNode = shouldAssert(1 /* Normal */)
+ ? function (node, test, message) { return assert(test === undefined || test(node), message || "Unexpected node.", function () { return "Node " + formatSyntaxKind(node.kind) + " did not pass test '" + getFunctionName(test) + "'."; }, Debug.assertNode); }
+ : ts.noop;
+ Debug.assertOptionalNode = shouldAssert(1 /* Normal */)
+ ? function (node, test, message) { return assert(test === undefined || node === undefined || test(node), message || "Unexpected node.", function () { return "Node " + formatSyntaxKind(node.kind) + " did not pass test '" + getFunctionName(test) + "'."; }, Debug.assertOptionalNode); }
+ : ts.noop;
+ Debug.assertOptionalToken = shouldAssert(1 /* Normal */)
+ ? function (node, kind, message) { return assert(kind === undefined || node === undefined || node.kind === kind, message || "Unexpected node.", function () { return "Node " + formatSyntaxKind(node.kind) + " was not a '" + formatSyntaxKind(kind) + "' token."; }, Debug.assertOptionalToken); }
+ : ts.noop;
+ Debug.assertMissingNode = shouldAssert(1 /* Normal */)
+ ? function (node, message) { return assert(node === undefined, message || "Unexpected node.", function () { return "Node " + formatSyntaxKind(node.kind) + " was unexpected'."; }, Debug.assertMissingNode); }
+ : ts.noop;
+ var isDebugInfoEnabled = false;
+ /**
+ * Injects debug information into frequently used types.
+ */
+ function enableDebugInfo() {
+ if (isDebugInfoEnabled)
+ return;
+ // Add additional properties in debug mode to assist with debugging.
+ Object.defineProperties(ts.objectAllocator.getSymbolConstructor().prototype, {
+ __debugFlags: { get: function () { return formatSymbolFlags(this.flags); } }
+ });
+ Object.defineProperties(ts.objectAllocator.getTypeConstructor().prototype, {
+ __debugFlags: { get: function () { return formatTypeFlags(this.flags); } },
+ __debugObjectFlags: { get: function () { return this.flags & 524288 /* Object */ ? formatObjectFlags(this.objectFlags) : ""; } },
+ __debugTypeToString: { value: function () { return this.checker.typeToString(this); } },
+ });
+ var nodeConstructors = [
+ ts.objectAllocator.getNodeConstructor(),
+ ts.objectAllocator.getIdentifierConstructor(),
+ ts.objectAllocator.getTokenConstructor(),
+ ts.objectAllocator.getSourceFileConstructor()
+ ];
+ for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) {
+ var ctor = nodeConstructors_1[_i];
+ if (!ctor.prototype.hasOwnProperty("__debugKind")) {
+ Object.defineProperties(ctor.prototype, {
+ __debugKind: { get: function () { return formatSyntaxKind(this.kind); } },
+ __debugNodeFlags: { get: function () { return formatNodeFlags(this.flags); } },
+ __debugModifierFlags: { get: function () { return formatModifierFlags(ts.getModifierFlagsNoCache(this)); } },
+ __debugTransformFlags: { get: function () { return formatTransformFlags(this.transformFlags); } },
+ __debugIsParseTreeNode: { get: function () { return ts.isParseTreeNode(this); } },
+ __debugEmitFlags: { get: function () { return formatEmitFlags(ts.getEmitFlags(this)); } },
+ __debugGetText: {
+ value: function (includeTrivia) {
+ if (ts.nodeIsSynthesized(this))
+ return "";
+ var parseNode = ts.getParseTreeNode(this);
+ var sourceFile = parseNode && ts.getSourceFileOfNode(parseNode);
+ return sourceFile ? ts.getSourceTextOfNodeFromSourceFile(sourceFile, parseNode, includeTrivia) : "";
+ }
+ }
+ });
+ }
+ }
+ isDebugInfoEnabled = true;
+ }
+ Debug.enableDebugInfo = enableDebugInfo;
+ })(Debug = ts.Debug || (ts.Debug = {}));
})(ts || (ts = {}));
/*@internal*/
var ts;
@@ -2655,309 +2807,311 @@
SyntaxKind[SyntaxKind["QuestionToken"] = 56] = "QuestionToken";
SyntaxKind[SyntaxKind["ColonToken"] = 57] = "ColonToken";
SyntaxKind[SyntaxKind["AtToken"] = 58] = "AtToken";
+ /** Only the JSDoc scanner produces BacktickToken. The normal scanner produces NoSubstitutionTemplateLiteral and related kinds. */
+ SyntaxKind[SyntaxKind["BacktickToken"] = 59] = "BacktickToken";
// Assignments
- SyntaxKind[SyntaxKind["EqualsToken"] = 59] = "EqualsToken";
- SyntaxKind[SyntaxKind["PlusEqualsToken"] = 60] = "PlusEqualsToken";
- SyntaxKind[SyntaxKind["MinusEqualsToken"] = 61] = "MinusEqualsToken";
- SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 62] = "AsteriskEqualsToken";
- SyntaxKind[SyntaxKind["AsteriskAsteriskEqualsToken"] = 63] = "AsteriskAsteriskEqualsToken";
- SyntaxKind[SyntaxKind["SlashEqualsToken"] = 64] = "SlashEqualsToken";
- SyntaxKind[SyntaxKind["PercentEqualsToken"] = 65] = "PercentEqualsToken";
- SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 66] = "LessThanLessThanEqualsToken";
- SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 67] = "GreaterThanGreaterThanEqualsToken";
- SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 68] = "GreaterThanGreaterThanGreaterThanEqualsToken";
- SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 69] = "AmpersandEqualsToken";
- SyntaxKind[SyntaxKind["BarEqualsToken"] = 70] = "BarEqualsToken";
- SyntaxKind[SyntaxKind["CaretEqualsToken"] = 71] = "CaretEqualsToken";
+ SyntaxKind[SyntaxKind["EqualsToken"] = 60] = "EqualsToken";
+ SyntaxKind[SyntaxKind["PlusEqualsToken"] = 61] = "PlusEqualsToken";
+ SyntaxKind[SyntaxKind["MinusEqualsToken"] = 62] = "MinusEqualsToken";
+ SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 63] = "AsteriskEqualsToken";
+ SyntaxKind[SyntaxKind["AsteriskAsteriskEqualsToken"] = 64] = "AsteriskAsteriskEqualsToken";
+ SyntaxKind[SyntaxKind["SlashEqualsToken"] = 65] = "SlashEqualsToken";
+ SyntaxKind[SyntaxKind["PercentEqualsToken"] = 66] = "PercentEqualsToken";
+ SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 67] = "LessThanLessThanEqualsToken";
+ SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 68] = "GreaterThanGreaterThanEqualsToken";
+ SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 69] = "GreaterThanGreaterThanGreaterThanEqualsToken";
+ SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 70] = "AmpersandEqualsToken";
+ SyntaxKind[SyntaxKind["BarEqualsToken"] = 71] = "BarEqualsToken";
+ SyntaxKind[SyntaxKind["CaretEqualsToken"] = 72] = "CaretEqualsToken";
// Identifiers
- SyntaxKind[SyntaxKind["Identifier"] = 72] = "Identifier";
+ SyntaxKind[SyntaxKind["Identifier"] = 73] = "Identifier";
// Reserved words
- SyntaxKind[SyntaxKind["BreakKeyword"] = 73] = "BreakKeyword";
- SyntaxKind[SyntaxKind["CaseKeyword"] = 74] = "CaseKeyword";
- SyntaxKind[SyntaxKind["CatchKeyword"] = 75] = "CatchKeyword";
- SyntaxKind[SyntaxKind["ClassKeyword"] = 76] = "ClassKeyword";
- SyntaxKind[SyntaxKind["ConstKeyword"] = 77] = "ConstKeyword";
- SyntaxKind[SyntaxKind["ContinueKeyword"] = 78] = "ContinueKeyword";
- SyntaxKind[SyntaxKind["DebuggerKeyword"] = 79] = "DebuggerKeyword";
- SyntaxKind[SyntaxKind["DefaultKeyword"] = 80] = "DefaultKeyword";
- SyntaxKind[SyntaxKind["DeleteKeyword"] = 81] = "DeleteKeyword";
- SyntaxKind[SyntaxKind["DoKeyword"] = 82] = "DoKeyword";
- SyntaxKind[SyntaxKind["ElseKeyword"] = 83] = "ElseKeyword";
- SyntaxKind[SyntaxKind["EnumKeyword"] = 84] = "EnumKeyword";
- SyntaxKind[SyntaxKind["ExportKeyword"] = 85] = "ExportKeyword";
- SyntaxKind[SyntaxKind["ExtendsKeyword"] = 86] = "ExtendsKeyword";
- SyntaxKind[SyntaxKind["FalseKeyword"] = 87] = "FalseKeyword";
- SyntaxKind[SyntaxKind["FinallyKeyword"] = 88] = "FinallyKeyword";
- SyntaxKind[SyntaxKind["ForKeyword"] = 89] = "ForKeyword";
- SyntaxKind[SyntaxKind["FunctionKeyword"] = 90] = "FunctionKeyword";
- SyntaxKind[SyntaxKind["IfKeyword"] = 91] = "IfKeyword";
- SyntaxKind[SyntaxKind["ImportKeyword"] = 92] = "ImportKeyword";
- SyntaxKind[SyntaxKind["InKeyword"] = 93] = "InKeyword";
- SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 94] = "InstanceOfKeyword";
- SyntaxKind[SyntaxKind["NewKeyword"] = 95] = "NewKeyword";
- SyntaxKind[SyntaxKind["NullKeyword"] = 96] = "NullKeyword";
- SyntaxKind[SyntaxKind["ReturnKeyword"] = 97] = "ReturnKeyword";
- SyntaxKind[SyntaxKind["SuperKeyword"] = 98] = "SuperKeyword";
- SyntaxKind[SyntaxKind["SwitchKeyword"] = 99] = "SwitchKeyword";
- SyntaxKind[SyntaxKind["ThisKeyword"] = 100] = "ThisKeyword";
- SyntaxKind[SyntaxKind["ThrowKeyword"] = 101] = "ThrowKeyword";
- SyntaxKind[SyntaxKind["TrueKeyword"] = 102] = "TrueKeyword";
- SyntaxKind[SyntaxKind["TryKeyword"] = 103] = "TryKeyword";
- SyntaxKind[SyntaxKind["TypeOfKeyword"] = 104] = "TypeOfKeyword";
- SyntaxKind[SyntaxKind["VarKeyword"] = 105] = "VarKeyword";
- SyntaxKind[SyntaxKind["VoidKeyword"] = 106] = "VoidKeyword";
- SyntaxKind[SyntaxKind["WhileKeyword"] = 107] = "WhileKeyword";
- SyntaxKind[SyntaxKind["WithKeyword"] = 108] = "WithKeyword";
+ SyntaxKind[SyntaxKind["BreakKeyword"] = 74] = "BreakKeyword";
+ SyntaxKind[SyntaxKind["CaseKeyword"] = 75] = "CaseKeyword";
+ SyntaxKind[SyntaxKind["CatchKeyword"] = 76] = "CatchKeyword";
+ SyntaxKind[SyntaxKind["ClassKeyword"] = 77] = "ClassKeyword";
+ SyntaxKind[SyntaxKind["ConstKeyword"] = 78] = "ConstKeyword";
+ SyntaxKind[SyntaxKind["ContinueKeyword"] = 79] = "ContinueKeyword";
+ SyntaxKind[SyntaxKind["DebuggerKeyword"] = 80] = "DebuggerKeyword";
+ SyntaxKind[SyntaxKind["DefaultKeyword"] = 81] = "DefaultKeyword";
+ SyntaxKind[SyntaxKind["DeleteKeyword"] = 82] = "DeleteKeyword";
+ SyntaxKind[SyntaxKind["DoKeyword"] = 83] = "DoKeyword";
+ SyntaxKind[SyntaxKind["ElseKeyword"] = 84] = "ElseKeyword";
+ SyntaxKind[SyntaxKind["EnumKeyword"] = 85] = "EnumKeyword";
+ SyntaxKind[SyntaxKind["ExportKeyword"] = 86] = "ExportKeyword";
+ SyntaxKind[SyntaxKind["ExtendsKeyword"] = 87] = "ExtendsKeyword";
+ SyntaxKind[SyntaxKind["FalseKeyword"] = 88] = "FalseKeyword";
+ SyntaxKind[SyntaxKind["FinallyKeyword"] = 89] = "FinallyKeyword";
+ SyntaxKind[SyntaxKind["ForKeyword"] = 90] = "ForKeyword";
+ SyntaxKind[SyntaxKind["FunctionKeyword"] = 91] = "FunctionKeyword";
+ SyntaxKind[SyntaxKind["IfKeyword"] = 92] = "IfKeyword";
+ SyntaxKind[SyntaxKind["ImportKeyword"] = 93] = "ImportKeyword";
+ SyntaxKind[SyntaxKind["InKeyword"] = 94] = "InKeyword";
+ SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 95] = "InstanceOfKeyword";
+ SyntaxKind[SyntaxKind["NewKeyword"] = 96] = "NewKeyword";
+ SyntaxKind[SyntaxKind["NullKeyword"] = 97] = "NullKeyword";
+ SyntaxKind[SyntaxKind["ReturnKeyword"] = 98] = "ReturnKeyword";
+ SyntaxKind[SyntaxKind["SuperKeyword"] = 99] = "SuperKeyword";
+ SyntaxKind[SyntaxKind["SwitchKeyword"] = 100] = "SwitchKeyword";
+ SyntaxKind[SyntaxKind["ThisKeyword"] = 101] = "ThisKeyword";
+ SyntaxKind[SyntaxKind["ThrowKeyword"] = 102] = "ThrowKeyword";
+ SyntaxKind[SyntaxKind["TrueKeyword"] = 103] = "TrueKeyword";
+ SyntaxKind[SyntaxKind["TryKeyword"] = 104] = "TryKeyword";
+ SyntaxKind[SyntaxKind["TypeOfKeyword"] = 105] = "TypeOfKeyword";
+ SyntaxKind[SyntaxKind["VarKeyword"] = 106] = "VarKeyword";
+ SyntaxKind[SyntaxKind["VoidKeyword"] = 107] = "VoidKeyword";
+ SyntaxKind[SyntaxKind["WhileKeyword"] = 108] = "WhileKeyword";
+ SyntaxKind[SyntaxKind["WithKeyword"] = 109] = "WithKeyword";
// Strict mode reserved words
- SyntaxKind[SyntaxKind["ImplementsKeyword"] = 109] = "ImplementsKeyword";
- SyntaxKind[SyntaxKind["InterfaceKeyword"] = 110] = "InterfaceKeyword";
- SyntaxKind[SyntaxKind["LetKeyword"] = 111] = "LetKeyword";
- SyntaxKind[SyntaxKind["PackageKeyword"] = 112] = "PackageKeyword";
- SyntaxKind[SyntaxKind["PrivateKeyword"] = 113] = "PrivateKeyword";
- SyntaxKind[SyntaxKind["ProtectedKeyword"] = 114] = "ProtectedKeyword";
- SyntaxKind[SyntaxKind["PublicKeyword"] = 115] = "PublicKeyword";
- SyntaxKind[SyntaxKind["StaticKeyword"] = 116] = "StaticKeyword";
- SyntaxKind[SyntaxKind["YieldKeyword"] = 117] = "YieldKeyword";
+ SyntaxKind[SyntaxKind["ImplementsKeyword"] = 110] = "ImplementsKeyword";
+ SyntaxKind[SyntaxKind["InterfaceKeyword"] = 111] = "InterfaceKeyword";
+ SyntaxKind[SyntaxKind["LetKeyword"] = 112] = "LetKeyword";
+ SyntaxKind[SyntaxKind["PackageKeyword"] = 113] = "PackageKeyword";
+ SyntaxKind[SyntaxKind["PrivateKeyword"] = 114] = "PrivateKeyword";
+ SyntaxKind[SyntaxKind["ProtectedKeyword"] = 115] = "ProtectedKeyword";
+ SyntaxKind[SyntaxKind["PublicKeyword"] = 116] = "PublicKeyword";
+ SyntaxKind[SyntaxKind["StaticKeyword"] = 117] = "StaticKeyword";
+ SyntaxKind[SyntaxKind["YieldKeyword"] = 118] = "YieldKeyword";
// Contextual keywords
- SyntaxKind[SyntaxKind["AbstractKeyword"] = 118] = "AbstractKeyword";
- SyntaxKind[SyntaxKind["AsKeyword"] = 119] = "AsKeyword";
- SyntaxKind[SyntaxKind["AnyKeyword"] = 120] = "AnyKeyword";
- SyntaxKind[SyntaxKind["AsyncKeyword"] = 121] = "AsyncKeyword";
- SyntaxKind[SyntaxKind["AwaitKeyword"] = 122] = "AwaitKeyword";
- SyntaxKind[SyntaxKind["BooleanKeyword"] = 123] = "BooleanKeyword";
- SyntaxKind[SyntaxKind["ConstructorKeyword"] = 124] = "ConstructorKeyword";
- SyntaxKind[SyntaxKind["DeclareKeyword"] = 125] = "DeclareKeyword";
- SyntaxKind[SyntaxKind["GetKeyword"] = 126] = "GetKeyword";
- SyntaxKind[SyntaxKind["InferKeyword"] = 127] = "InferKeyword";
- SyntaxKind[SyntaxKind["IsKeyword"] = 128] = "IsKeyword";
- SyntaxKind[SyntaxKind["KeyOfKeyword"] = 129] = "KeyOfKeyword";
- SyntaxKind[SyntaxKind["ModuleKeyword"] = 130] = "ModuleKeyword";
- SyntaxKind[SyntaxKind["NamespaceKeyword"] = 131] = "NamespaceKeyword";
- SyntaxKind[SyntaxKind["NeverKeyword"] = 132] = "NeverKeyword";
- SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 133] = "ReadonlyKeyword";
- SyntaxKind[SyntaxKind["RequireKeyword"] = 134] = "RequireKeyword";
- SyntaxKind[SyntaxKind["NumberKeyword"] = 135] = "NumberKeyword";
- SyntaxKind[SyntaxKind["ObjectKeyword"] = 136] = "ObjectKeyword";
- SyntaxKind[SyntaxKind["SetKeyword"] = 137] = "SetKeyword";
- SyntaxKind[SyntaxKind["StringKeyword"] = 138] = "StringKeyword";
- SyntaxKind[SyntaxKind["SymbolKeyword"] = 139] = "SymbolKeyword";
- SyntaxKind[SyntaxKind["TypeKeyword"] = 140] = "TypeKeyword";
- SyntaxKind[SyntaxKind["UndefinedKeyword"] = 141] = "UndefinedKeyword";
- SyntaxKind[SyntaxKind["UniqueKeyword"] = 142] = "UniqueKeyword";
- SyntaxKind[SyntaxKind["UnknownKeyword"] = 143] = "UnknownKeyword";
- SyntaxKind[SyntaxKind["FromKeyword"] = 144] = "FromKeyword";
- SyntaxKind[SyntaxKind["GlobalKeyword"] = 145] = "GlobalKeyword";
- SyntaxKind[SyntaxKind["BigIntKeyword"] = 146] = "BigIntKeyword";
- SyntaxKind[SyntaxKind["OfKeyword"] = 147] = "OfKeyword";
+ SyntaxKind[SyntaxKind["AbstractKeyword"] = 119] = "AbstractKeyword";
+ SyntaxKind[SyntaxKind["AsKeyword"] = 120] = "AsKeyword";
+ SyntaxKind[SyntaxKind["AnyKeyword"] = 121] = "AnyKeyword";
+ SyntaxKind[SyntaxKind["AsyncKeyword"] = 122] = "AsyncKeyword";
+ SyntaxKind[SyntaxKind["AwaitKeyword"] = 123] = "AwaitKeyword";
+ SyntaxKind[SyntaxKind["BooleanKeyword"] = 124] = "BooleanKeyword";
+ SyntaxKind[SyntaxKind["ConstructorKeyword"] = 125] = "ConstructorKeyword";
+ SyntaxKind[SyntaxKind["DeclareKeyword"] = 126] = "DeclareKeyword";
+ SyntaxKind[SyntaxKind["GetKeyword"] = 127] = "GetKeyword";
+ SyntaxKind[SyntaxKind["InferKeyword"] = 128] = "InferKeyword";
+ SyntaxKind[SyntaxKind["IsKeyword"] = 129] = "IsKeyword";
+ SyntaxKind[SyntaxKind["KeyOfKeyword"] = 130] = "KeyOfKeyword";
+ SyntaxKind[SyntaxKind["ModuleKeyword"] = 131] = "ModuleKeyword";
+ SyntaxKind[SyntaxKind["NamespaceKeyword"] = 132] = "NamespaceKeyword";
+ SyntaxKind[SyntaxKind["NeverKeyword"] = 133] = "NeverKeyword";
+ SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 134] = "ReadonlyKeyword";
+ SyntaxKind[SyntaxKind["RequireKeyword"] = 135] = "RequireKeyword";
+ SyntaxKind[SyntaxKind["NumberKeyword"] = 136] = "NumberKeyword";
+ SyntaxKind[SyntaxKind["ObjectKeyword"] = 137] = "ObjectKeyword";
+ SyntaxKind[SyntaxKind["SetKeyword"] = 138] = "SetKeyword";
+ SyntaxKind[SyntaxKind["StringKeyword"] = 139] = "StringKeyword";
+ SyntaxKind[SyntaxKind["SymbolKeyword"] = 140] = "SymbolKeyword";
+ SyntaxKind[SyntaxKind["TypeKeyword"] = 141] = "TypeKeyword";
+ SyntaxKind[SyntaxKind["UndefinedKeyword"] = 142] = "UndefinedKeyword";
+ SyntaxKind[SyntaxKind["UniqueKeyword"] = 143] = "UniqueKeyword";
+ SyntaxKind[SyntaxKind["UnknownKeyword"] = 144] = "UnknownKeyword";
+ SyntaxKind[SyntaxKind["FromKeyword"] = 145] = "FromKeyword";
+ SyntaxKind[SyntaxKind["GlobalKeyword"] = 146] = "GlobalKeyword";
+ SyntaxKind[SyntaxKind["BigIntKeyword"] = 147] = "BigIntKeyword";
+ SyntaxKind[SyntaxKind["OfKeyword"] = 148] = "OfKeyword";
// Parse tree nodes
// Names
- SyntaxKind[SyntaxKind["QualifiedName"] = 148] = "QualifiedName";
- SyntaxKind[SyntaxKind["ComputedPropertyName"] = 149] = "ComputedPropertyName";
+ SyntaxKind[SyntaxKind["QualifiedName"] = 149] = "QualifiedName";
+ SyntaxKind[SyntaxKind["ComputedPropertyName"] = 150] = "ComputedPropertyName";
// Signature elements
- SyntaxKind[SyntaxKind["TypeParameter"] = 150] = "TypeParameter";
- SyntaxKind[SyntaxKind["Parameter"] = 151] = "Parameter";
- SyntaxKind[SyntaxKind["Decorator"] = 152] = "Decorator";
+ SyntaxKind[SyntaxKind["TypeParameter"] = 151] = "TypeParameter";
+ SyntaxKind[SyntaxKind["Parameter"] = 152] = "Parameter";
+ SyntaxKind[SyntaxKind["Decorator"] = 153] = "Decorator";
// TypeMember
- SyntaxKind[SyntaxKind["PropertySignature"] = 153] = "PropertySignature";
- SyntaxKind[SyntaxKind["PropertyDeclaration"] = 154] = "PropertyDeclaration";
- SyntaxKind[SyntaxKind["MethodSignature"] = 155] = "MethodSignature";
- SyntaxKind[SyntaxKind["MethodDeclaration"] = 156] = "MethodDeclaration";
- SyntaxKind[SyntaxKind["Constructor"] = 157] = "Constructor";
- SyntaxKind[SyntaxKind["GetAccessor"] = 158] = "GetAccessor";
- SyntaxKind[SyntaxKind["SetAccessor"] = 159] = "SetAccessor";
- SyntaxKind[SyntaxKind["CallSignature"] = 160] = "CallSignature";
- SyntaxKind[SyntaxKind["ConstructSignature"] = 161] = "ConstructSignature";
- SyntaxKind[SyntaxKind["IndexSignature"] = 162] = "IndexSignature";
+ SyntaxKind[SyntaxKind["PropertySignature"] = 154] = "PropertySignature";
+ SyntaxKind[SyntaxKind["PropertyDeclaration"] = 155] = "PropertyDeclaration";
+ SyntaxKind[SyntaxKind["MethodSignature"] = 156] = "MethodSignature";
+ SyntaxKind[SyntaxKind["MethodDeclaration"] = 157] = "MethodDeclaration";
+ SyntaxKind[SyntaxKind["Constructor"] = 158] = "Constructor";
+ SyntaxKind[SyntaxKind["GetAccessor"] = 159] = "GetAccessor";
+ SyntaxKind[SyntaxKind["SetAccessor"] = 160] = "SetAccessor";
+ SyntaxKind[SyntaxKind["CallSignature"] = 161] = "CallSignature";
+ SyntaxKind[SyntaxKind["ConstructSignature"] = 162] = "ConstructSignature";
+ SyntaxKind[SyntaxKind["IndexSignature"] = 163] = "IndexSignature";
// Type
- SyntaxKind[SyntaxKind["TypePredicate"] = 163] = "TypePredicate";
- SyntaxKind[SyntaxKind["TypeReference"] = 164] = "TypeReference";
- SyntaxKind[SyntaxKind["FunctionType"] = 165] = "FunctionType";
- SyntaxKind[SyntaxKind["ConstructorType"] = 166] = "ConstructorType";
- SyntaxKind[SyntaxKind["TypeQuery"] = 167] = "TypeQuery";
- SyntaxKind[SyntaxKind["TypeLiteral"] = 168] = "TypeLiteral";
- SyntaxKind[SyntaxKind["ArrayType"] = 169] = "ArrayType";
- SyntaxKind[SyntaxKind["TupleType"] = 170] = "TupleType";
- SyntaxKind[SyntaxKind["OptionalType"] = 171] = "OptionalType";
- SyntaxKind[SyntaxKind["RestType"] = 172] = "RestType";
- SyntaxKind[SyntaxKind["UnionType"] = 173] = "UnionType";
- SyntaxKind[SyntaxKind["IntersectionType"] = 174] = "IntersectionType";
- SyntaxKind[SyntaxKind["ConditionalType"] = 175] = "ConditionalType";
- SyntaxKind[SyntaxKind["InferType"] = 176] = "InferType";
- SyntaxKind[SyntaxKind["ParenthesizedType"] = 177] = "ParenthesizedType";
- SyntaxKind[SyntaxKind["ThisType"] = 178] = "ThisType";
- SyntaxKind[SyntaxKind["TypeOperator"] = 179] = "TypeOperator";
- SyntaxKind[SyntaxKind["IndexedAccessType"] = 180] = "IndexedAccessType";
- SyntaxKind[SyntaxKind["MappedType"] = 181] = "MappedType";
- SyntaxKind[SyntaxKind["LiteralType"] = 182] = "LiteralType";
- SyntaxKind[SyntaxKind["ImportType"] = 183] = "ImportType";
+ SyntaxKind[SyntaxKind["TypePredicate"] = 164] = "TypePredicate";
+ SyntaxKind[SyntaxKind["TypeReference"] = 165] = "TypeReference";
+ SyntaxKind[SyntaxKind["FunctionType"] = 166] = "FunctionType";
+ SyntaxKind[SyntaxKind["ConstructorType"] = 167] = "ConstructorType";
+ SyntaxKind[SyntaxKind["TypeQuery"] = 168] = "TypeQuery";
+ SyntaxKind[SyntaxKind["TypeLiteral"] = 169] = "TypeLiteral";
+ SyntaxKind[SyntaxKind["ArrayType"] = 170] = "ArrayType";
+ SyntaxKind[SyntaxKind["TupleType"] = 171] = "TupleType";
+ SyntaxKind[SyntaxKind["OptionalType"] = 172] = "OptionalType";
+ SyntaxKind[SyntaxKind["RestType"] = 173] = "RestType";
+ SyntaxKind[SyntaxKind["UnionType"] = 174] = "UnionType";
+ SyntaxKind[SyntaxKind["IntersectionType"] = 175] = "IntersectionType";
+ SyntaxKind[SyntaxKind["ConditionalType"] = 176] = "ConditionalType";
+ SyntaxKind[SyntaxKind["InferType"] = 177] = "InferType";
+ SyntaxKind[SyntaxKind["ParenthesizedType"] = 178] = "ParenthesizedType";
+ SyntaxKind[SyntaxKind["ThisType"] = 179] = "ThisType";
+ SyntaxKind[SyntaxKind["TypeOperator"] = 180] = "TypeOperator";
+ SyntaxKind[SyntaxKind["IndexedAccessType"] = 181] = "IndexedAccessType";
+ SyntaxKind[SyntaxKind["MappedType"] = 182] = "MappedType";
+ SyntaxKind[SyntaxKind["LiteralType"] = 183] = "LiteralType";
+ SyntaxKind[SyntaxKind["ImportType"] = 184] = "ImportType";
// Binding patterns
- SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 184] = "ObjectBindingPattern";
- SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 185] = "ArrayBindingPattern";
- SyntaxKind[SyntaxKind["BindingElement"] = 186] = "BindingElement";
+ SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 185] = "ObjectBindingPattern";
+ SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 186] = "ArrayBindingPattern";
+ SyntaxKind[SyntaxKind["BindingElement"] = 187] = "BindingElement";
// Expression
- SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 187] = "ArrayLiteralExpression";
- SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 188] = "ObjectLiteralExpression";
- SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 189] = "PropertyAccessExpression";
- SyntaxKind[SyntaxKind["ElementAccessExpression"] = 190] = "ElementAccessExpression";
- SyntaxKind[SyntaxKind["CallExpression"] = 191] = "CallExpression";
- SyntaxKind[SyntaxKind["NewExpression"] = 192] = "NewExpression";
- SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 193] = "TaggedTemplateExpression";
- SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 194] = "TypeAssertionExpression";
- SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 195] = "ParenthesizedExpression";
- SyntaxKind[SyntaxKind["FunctionExpression"] = 196] = "FunctionExpression";
- SyntaxKind[SyntaxKind["ArrowFunction"] = 197] = "ArrowFunction";
- SyntaxKind[SyntaxKind["DeleteExpression"] = 198] = "DeleteExpression";
- SyntaxKind[SyntaxKind["TypeOfExpression"] = 199] = "TypeOfExpression";
- SyntaxKind[SyntaxKind["VoidExpression"] = 200] = "VoidExpression";
- SyntaxKind[SyntaxKind["AwaitExpression"] = 201] = "AwaitExpression";
- SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 202] = "PrefixUnaryExpression";
- SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 203] = "PostfixUnaryExpression";
- SyntaxKind[SyntaxKind["BinaryExpression"] = 204] = "BinaryExpression";
- SyntaxKind[SyntaxKind["ConditionalExpression"] = 205] = "ConditionalExpression";
- SyntaxKind[SyntaxKind["TemplateExpression"] = 206] = "TemplateExpression";
- SyntaxKind[SyntaxKind["YieldExpression"] = 207] = "YieldExpression";
- SyntaxKind[SyntaxKind["SpreadElement"] = 208] = "SpreadElement";
- SyntaxKind[SyntaxKind["ClassExpression"] = 209] = "ClassExpression";
- SyntaxKind[SyntaxKind["OmittedExpression"] = 210] = "OmittedExpression";
- SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 211] = "ExpressionWithTypeArguments";
- SyntaxKind[SyntaxKind["AsExpression"] = 212] = "AsExpression";
- SyntaxKind[SyntaxKind["NonNullExpression"] = 213] = "NonNullExpression";
- SyntaxKind[SyntaxKind["MetaProperty"] = 214] = "MetaProperty";
- SyntaxKind[SyntaxKind["SyntheticExpression"] = 215] = "SyntheticExpression";
+ SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 188] = "ArrayLiteralExpression";
+ SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 189] = "ObjectLiteralExpression";
+ SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 190] = "PropertyAccessExpression";
+ SyntaxKind[SyntaxKind["ElementAccessExpression"] = 191] = "ElementAccessExpression";
+ SyntaxKind[SyntaxKind["CallExpression"] = 192] = "CallExpression";
+ SyntaxKind[SyntaxKind["NewExpression"] = 193] = "NewExpression";
+ SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 194] = "TaggedTemplateExpression";
+ SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 195] = "TypeAssertionExpression";
+ SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 196] = "ParenthesizedExpression";
+ SyntaxKind[SyntaxKind["FunctionExpression"] = 197] = "FunctionExpression";
+ SyntaxKind[SyntaxKind["ArrowFunction"] = 198] = "ArrowFunction";
+ SyntaxKind[SyntaxKind["DeleteExpression"] = 199] = "DeleteExpression";
+ SyntaxKind[SyntaxKind["TypeOfExpression"] = 200] = "TypeOfExpression";
+ SyntaxKind[SyntaxKind["VoidExpression"] = 201] = "VoidExpression";
+ SyntaxKind[SyntaxKind["AwaitExpression"] = 202] = "AwaitExpression";
+ SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 203] = "PrefixUnaryExpression";
+ SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 204] = "PostfixUnaryExpression";
+ SyntaxKind[SyntaxKind["BinaryExpression"] = 205] = "BinaryExpression";
+ SyntaxKind[SyntaxKind["ConditionalExpression"] = 206] = "ConditionalExpression";
+ SyntaxKind[SyntaxKind["TemplateExpression"] = 207] = "TemplateExpression";
+ SyntaxKind[SyntaxKind["YieldExpression"] = 208] = "YieldExpression";
+ SyntaxKind[SyntaxKind["SpreadElement"] = 209] = "SpreadElement";
+ SyntaxKind[SyntaxKind["ClassExpression"] = 210] = "ClassExpression";
+ SyntaxKind[SyntaxKind["OmittedExpression"] = 211] = "OmittedExpression";
+ SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 212] = "ExpressionWithTypeArguments";
+ SyntaxKind[SyntaxKind["AsExpression"] = 213] = "AsExpression";
+ SyntaxKind[SyntaxKind["NonNullExpression"] = 214] = "NonNullExpression";
+ SyntaxKind[SyntaxKind["MetaProperty"] = 215] = "MetaProperty";
+ SyntaxKind[SyntaxKind["SyntheticExpression"] = 216] = "SyntheticExpression";
// Misc
- SyntaxKind[SyntaxKind["TemplateSpan"] = 216] = "TemplateSpan";
- SyntaxKind[SyntaxKind["SemicolonClassElement"] = 217] = "SemicolonClassElement";
+ SyntaxKind[SyntaxKind["TemplateSpan"] = 217] = "TemplateSpan";
+ SyntaxKind[SyntaxKind["SemicolonClassElement"] = 218] = "SemicolonClassElement";
// Element
- SyntaxKind[SyntaxKind["Block"] = 218] = "Block";
- SyntaxKind[SyntaxKind["VariableStatement"] = 219] = "VariableStatement";
- SyntaxKind[SyntaxKind["EmptyStatement"] = 220] = "EmptyStatement";
- SyntaxKind[SyntaxKind["ExpressionStatement"] = 221] = "ExpressionStatement";
- SyntaxKind[SyntaxKind["IfStatement"] = 222] = "IfStatement";
- SyntaxKind[SyntaxKind["DoStatement"] = 223] = "DoStatement";
- SyntaxKind[SyntaxKind["WhileStatement"] = 224] = "WhileStatement";
- SyntaxKind[SyntaxKind["ForStatement"] = 225] = "ForStatement";
- SyntaxKind[SyntaxKind["ForInStatement"] = 226] = "ForInStatement";
- SyntaxKind[SyntaxKind["ForOfStatement"] = 227] = "ForOfStatement";
- SyntaxKind[SyntaxKind["ContinueStatement"] = 228] = "ContinueStatement";
- SyntaxKind[SyntaxKind["BreakStatement"] = 229] = "BreakStatement";
- SyntaxKind[SyntaxKind["ReturnStatement"] = 230] = "ReturnStatement";
- SyntaxKind[SyntaxKind["WithStatement"] = 231] = "WithStatement";
- SyntaxKind[SyntaxKind["SwitchStatement"] = 232] = "SwitchStatement";
- SyntaxKind[SyntaxKind["LabeledStatement"] = 233] = "LabeledStatement";
- SyntaxKind[SyntaxKind["ThrowStatement"] = 234] = "ThrowStatement";
- SyntaxKind[SyntaxKind["TryStatement"] = 235] = "TryStatement";
- SyntaxKind[SyntaxKind["DebuggerStatement"] = 236] = "DebuggerStatement";
- SyntaxKind[SyntaxKind["VariableDeclaration"] = 237] = "VariableDeclaration";
- SyntaxKind[SyntaxKind["VariableDeclarationList"] = 238] = "VariableDeclarationList";
- SyntaxKind[SyntaxKind["FunctionDeclaration"] = 239] = "FunctionDeclaration";
- SyntaxKind[SyntaxKind["ClassDeclaration"] = 240] = "ClassDeclaration";
- SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 241] = "InterfaceDeclaration";
- SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 242] = "TypeAliasDeclaration";
- SyntaxKind[SyntaxKind["EnumDeclaration"] = 243] = "EnumDeclaration";
- SyntaxKind[SyntaxKind["ModuleDeclaration"] = 244] = "ModuleDeclaration";
- SyntaxKind[SyntaxKind["ModuleBlock"] = 245] = "ModuleBlock";
- SyntaxKind[SyntaxKind["CaseBlock"] = 246] = "CaseBlock";
- SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 247] = "NamespaceExportDeclaration";
- SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 248] = "ImportEqualsDeclaration";
- SyntaxKind[SyntaxKind["ImportDeclaration"] = 249] = "ImportDeclaration";
- SyntaxKind[SyntaxKind["ImportClause"] = 250] = "ImportClause";
- SyntaxKind[SyntaxKind["NamespaceImport"] = 251] = "NamespaceImport";
- SyntaxKind[SyntaxKind["NamedImports"] = 252] = "NamedImports";
- SyntaxKind[SyntaxKind["ImportSpecifier"] = 253] = "ImportSpecifier";
- SyntaxKind[SyntaxKind["ExportAssignment"] = 254] = "ExportAssignment";
- SyntaxKind[SyntaxKind["ExportDeclaration"] = 255] = "ExportDeclaration";
- SyntaxKind[SyntaxKind["NamedExports"] = 256] = "NamedExports";
- SyntaxKind[SyntaxKind["ExportSpecifier"] = 257] = "ExportSpecifier";
- SyntaxKind[SyntaxKind["MissingDeclaration"] = 258] = "MissingDeclaration";
+ SyntaxKind[SyntaxKind["Block"] = 219] = "Block";
+ SyntaxKind[SyntaxKind["VariableStatement"] = 220] = "VariableStatement";
+ SyntaxKind[SyntaxKind["EmptyStatement"] = 221] = "EmptyStatement";
+ SyntaxKind[SyntaxKind["ExpressionStatement"] = 222] = "ExpressionStatement";
+ SyntaxKind[SyntaxKind["IfStatement"] = 223] = "IfStatement";
+ SyntaxKind[SyntaxKind["DoStatement"] = 224] = "DoStatement";
+ SyntaxKind[SyntaxKind["WhileStatement"] = 225] = "WhileStatement";
+ SyntaxKind[SyntaxKind["ForStatement"] = 226] = "ForStatement";
+ SyntaxKind[SyntaxKind["ForInStatement"] = 227] = "ForInStatement";
+ SyntaxKind[SyntaxKind["ForOfStatement"] = 228] = "ForOfStatement";
+ SyntaxKind[SyntaxKind["ContinueStatement"] = 229] = "ContinueStatement";
+ SyntaxKind[SyntaxKind["BreakStatement"] = 230] = "BreakStatement";
+ SyntaxKind[SyntaxKind["ReturnStatement"] = 231] = "ReturnStatement";
+ SyntaxKind[SyntaxKind["WithStatement"] = 232] = "WithStatement";
+ SyntaxKind[SyntaxKind["SwitchStatement"] = 233] = "SwitchStatement";
+ SyntaxKind[SyntaxKind["LabeledStatement"] = 234] = "LabeledStatement";
+ SyntaxKind[SyntaxKind["ThrowStatement"] = 235] = "ThrowStatement";
+ SyntaxKind[SyntaxKind["TryStatement"] = 236] = "TryStatement";
+ SyntaxKind[SyntaxKind["DebuggerStatement"] = 237] = "DebuggerStatement";
+ SyntaxKind[SyntaxKind["VariableDeclaration"] = 238] = "VariableDeclaration";
+ SyntaxKind[SyntaxKind["VariableDeclarationList"] = 239] = "VariableDeclarationList";
+ SyntaxKind[SyntaxKind["FunctionDeclaration"] = 240] = "FunctionDeclaration";
+ SyntaxKind[SyntaxKind["ClassDeclaration"] = 241] = "ClassDeclaration";
+ SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 242] = "InterfaceDeclaration";
+ SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 243] = "TypeAliasDeclaration";
+ SyntaxKind[SyntaxKind["EnumDeclaration"] = 244] = "EnumDeclaration";
+ SyntaxKind[SyntaxKind["ModuleDeclaration"] = 245] = "ModuleDeclaration";
+ SyntaxKind[SyntaxKind["ModuleBlock"] = 246] = "ModuleBlock";
+ SyntaxKind[SyntaxKind["CaseBlock"] = 247] = "CaseBlock";
+ SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 248] = "NamespaceExportDeclaration";
+ SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 249] = "ImportEqualsDeclaration";
+ SyntaxKind[SyntaxKind["ImportDeclaration"] = 250] = "ImportDeclaration";
+ SyntaxKind[SyntaxKind["ImportClause"] = 251] = "ImportClause";
+ SyntaxKind[SyntaxKind["NamespaceImport"] = 252] = "NamespaceImport";
+ SyntaxKind[SyntaxKind["NamedImports"] = 253] = "NamedImports";
+ SyntaxKind[SyntaxKind["ImportSpecifier"] = 254] = "ImportSpecifier";
+ SyntaxKind[SyntaxKind["ExportAssignment"] = 255] = "ExportAssignment";
+ SyntaxKind[SyntaxKind["ExportDeclaration"] = 256] = "ExportDeclaration";
+ SyntaxKind[SyntaxKind["NamedExports"] = 257] = "NamedExports";
+ SyntaxKind[SyntaxKind["ExportSpecifier"] = 258] = "ExportSpecifier";
+ SyntaxKind[SyntaxKind["MissingDeclaration"] = 259] = "MissingDeclaration";
// Module references
- SyntaxKind[SyntaxKind["ExternalModuleReference"] = 259] = "ExternalModuleReference";
+ SyntaxKind[SyntaxKind["ExternalModuleReference"] = 260] = "ExternalModuleReference";
// JSX
- SyntaxKind[SyntaxKind["JsxElement"] = 260] = "JsxElement";
- SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 261] = "JsxSelfClosingElement";
- SyntaxKind[SyntaxKind["JsxOpeningElement"] = 262] = "JsxOpeningElement";
- SyntaxKind[SyntaxKind["JsxClosingElement"] = 263] = "JsxClosingElement";
- SyntaxKind[SyntaxKind["JsxFragment"] = 264] = "JsxFragment";
- SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 265] = "JsxOpeningFragment";
- SyntaxKind[SyntaxKind["JsxClosingFragment"] = 266] = "JsxClosingFragment";
- SyntaxKind[SyntaxKind["JsxAttribute"] = 267] = "JsxAttribute";
- SyntaxKind[SyntaxKind["JsxAttributes"] = 268] = "JsxAttributes";
- SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 269] = "JsxSpreadAttribute";
- SyntaxKind[SyntaxKind["JsxExpression"] = 270] = "JsxExpression";
+ SyntaxKind[SyntaxKind["JsxElement"] = 261] = "JsxElement";
+ SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 262] = "JsxSelfClosingElement";
+ SyntaxKind[SyntaxKind["JsxOpeningElement"] = 263] = "JsxOpeningElement";
+ SyntaxKind[SyntaxKind["JsxClosingElement"] = 264] = "JsxClosingElement";
+ SyntaxKind[SyntaxKind["JsxFragment"] = 265] = "JsxFragment";
+ SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 266] = "JsxOpeningFragment";
+ SyntaxKind[SyntaxKind["JsxClosingFragment"] = 267] = "JsxClosingFragment";
+ SyntaxKind[SyntaxKind["JsxAttribute"] = 268] = "JsxAttribute";
+ SyntaxKind[SyntaxKind["JsxAttributes"] = 269] = "JsxAttributes";
+ SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 270] = "JsxSpreadAttribute";
+ SyntaxKind[SyntaxKind["JsxExpression"] = 271] = "JsxExpression";
// Clauses
- SyntaxKind[SyntaxKind["CaseClause"] = 271] = "CaseClause";
- SyntaxKind[SyntaxKind["DefaultClause"] = 272] = "DefaultClause";
- SyntaxKind[SyntaxKind["HeritageClause"] = 273] = "HeritageClause";
- SyntaxKind[SyntaxKind["CatchClause"] = 274] = "CatchClause";
+ SyntaxKind[SyntaxKind["CaseClause"] = 272] = "CaseClause";
+ SyntaxKind[SyntaxKind["DefaultClause"] = 273] = "DefaultClause";
+ SyntaxKind[SyntaxKind["HeritageClause"] = 274] = "HeritageClause";
+ SyntaxKind[SyntaxKind["CatchClause"] = 275] = "CatchClause";
// Property assignments
- SyntaxKind[SyntaxKind["PropertyAssignment"] = 275] = "PropertyAssignment";
- SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 276] = "ShorthandPropertyAssignment";
- SyntaxKind[SyntaxKind["SpreadAssignment"] = 277] = "SpreadAssignment";
+ SyntaxKind[SyntaxKind["PropertyAssignment"] = 276] = "PropertyAssignment";
+ SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 277] = "ShorthandPropertyAssignment";
+ SyntaxKind[SyntaxKind["SpreadAssignment"] = 278] = "SpreadAssignment";
// Enum
- SyntaxKind[SyntaxKind["EnumMember"] = 278] = "EnumMember";
+ SyntaxKind[SyntaxKind["EnumMember"] = 279] = "EnumMember";
// Unparsed
- SyntaxKind[SyntaxKind["UnparsedPrologue"] = 279] = "UnparsedPrologue";
- SyntaxKind[SyntaxKind["UnparsedPrepend"] = 280] = "UnparsedPrepend";
- SyntaxKind[SyntaxKind["UnparsedText"] = 281] = "UnparsedText";
- SyntaxKind[SyntaxKind["UnparsedInternalText"] = 282] = "UnparsedInternalText";
- SyntaxKind[SyntaxKind["UnparsedSyntheticReference"] = 283] = "UnparsedSyntheticReference";
+ SyntaxKind[SyntaxKind["UnparsedPrologue"] = 280] = "UnparsedPrologue";
+ SyntaxKind[SyntaxKind["UnparsedPrepend"] = 281] = "UnparsedPrepend";
+ SyntaxKind[SyntaxKind["UnparsedText"] = 282] = "UnparsedText";
+ SyntaxKind[SyntaxKind["UnparsedInternalText"] = 283] = "UnparsedInternalText";
+ SyntaxKind[SyntaxKind["UnparsedSyntheticReference"] = 284] = "UnparsedSyntheticReference";
// Top-level nodes
- SyntaxKind[SyntaxKind["SourceFile"] = 284] = "SourceFile";
- SyntaxKind[SyntaxKind["Bundle"] = 285] = "Bundle";
- SyntaxKind[SyntaxKind["UnparsedSource"] = 286] = "UnparsedSource";
- SyntaxKind[SyntaxKind["InputFiles"] = 287] = "InputFiles";
+ SyntaxKind[SyntaxKind["SourceFile"] = 285] = "SourceFile";
+ SyntaxKind[SyntaxKind["Bundle"] = 286] = "Bundle";
+ SyntaxKind[SyntaxKind["UnparsedSource"] = 287] = "UnparsedSource";
+ SyntaxKind[SyntaxKind["InputFiles"] = 288] = "InputFiles";
// JSDoc nodes
- SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 288] = "JSDocTypeExpression";
+ SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 289] = "JSDocTypeExpression";
// The * type
- SyntaxKind[SyntaxKind["JSDocAllType"] = 289] = "JSDocAllType";
+ SyntaxKind[SyntaxKind["JSDocAllType"] = 290] = "JSDocAllType";
// The ? type
- SyntaxKind[SyntaxKind["JSDocUnknownType"] = 290] = "JSDocUnknownType";
- SyntaxKind[SyntaxKind["JSDocNullableType"] = 291] = "JSDocNullableType";
- SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 292] = "JSDocNonNullableType";
- SyntaxKind[SyntaxKind["JSDocOptionalType"] = 293] = "JSDocOptionalType";
- SyntaxKind[SyntaxKind["JSDocFunctionType"] = 294] = "JSDocFunctionType";
- SyntaxKind[SyntaxKind["JSDocVariadicType"] = 295] = "JSDocVariadicType";
- SyntaxKind[SyntaxKind["JSDocComment"] = 296] = "JSDocComment";
- SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 297] = "JSDocTypeLiteral";
- SyntaxKind[SyntaxKind["JSDocSignature"] = 298] = "JSDocSignature";
- SyntaxKind[SyntaxKind["JSDocTag"] = 299] = "JSDocTag";
- SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 300] = "JSDocAugmentsTag";
- SyntaxKind[SyntaxKind["JSDocClassTag"] = 301] = "JSDocClassTag";
- SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 302] = "JSDocCallbackTag";
- SyntaxKind[SyntaxKind["JSDocEnumTag"] = 303] = "JSDocEnumTag";
- SyntaxKind[SyntaxKind["JSDocParameterTag"] = 304] = "JSDocParameterTag";
- SyntaxKind[SyntaxKind["JSDocReturnTag"] = 305] = "JSDocReturnTag";
- SyntaxKind[SyntaxKind["JSDocThisTag"] = 306] = "JSDocThisTag";
- SyntaxKind[SyntaxKind["JSDocTypeTag"] = 307] = "JSDocTypeTag";
- SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 308] = "JSDocTemplateTag";
- SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 309] = "JSDocTypedefTag";
- SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 310] = "JSDocPropertyTag";
+ SyntaxKind[SyntaxKind["JSDocUnknownType"] = 291] = "JSDocUnknownType";
+ SyntaxKind[SyntaxKind["JSDocNullableType"] = 292] = "JSDocNullableType";
+ SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 293] = "JSDocNonNullableType";
+ SyntaxKind[SyntaxKind["JSDocOptionalType"] = 294] = "JSDocOptionalType";
+ SyntaxKind[SyntaxKind["JSDocFunctionType"] = 295] = "JSDocFunctionType";
+ SyntaxKind[SyntaxKind["JSDocVariadicType"] = 296] = "JSDocVariadicType";
+ SyntaxKind[SyntaxKind["JSDocComment"] = 297] = "JSDocComment";
+ SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 298] = "JSDocTypeLiteral";
+ SyntaxKind[SyntaxKind["JSDocSignature"] = 299] = "JSDocSignature";
+ SyntaxKind[SyntaxKind["JSDocTag"] = 300] = "JSDocTag";
+ SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 301] = "JSDocAugmentsTag";
+ SyntaxKind[SyntaxKind["JSDocClassTag"] = 302] = "JSDocClassTag";
+ SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 303] = "JSDocCallbackTag";
+ SyntaxKind[SyntaxKind["JSDocEnumTag"] = 304] = "JSDocEnumTag";
+ SyntaxKind[SyntaxKind["JSDocParameterTag"] = 305] = "JSDocParameterTag";
+ SyntaxKind[SyntaxKind["JSDocReturnTag"] = 306] = "JSDocReturnTag";
+ SyntaxKind[SyntaxKind["JSDocThisTag"] = 307] = "JSDocThisTag";
+ SyntaxKind[SyntaxKind["JSDocTypeTag"] = 308] = "JSDocTypeTag";
+ SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 309] = "JSDocTemplateTag";
+ SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 310] = "JSDocTypedefTag";
+ SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 311] = "JSDocPropertyTag";
// Synthesized list
- SyntaxKind[SyntaxKind["SyntaxList"] = 311] = "SyntaxList";
+ SyntaxKind[SyntaxKind["SyntaxList"] = 312] = "SyntaxList";
// Transformation nodes
- SyntaxKind[SyntaxKind["NotEmittedStatement"] = 312] = "NotEmittedStatement";
- SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 313] = "PartiallyEmittedExpression";
- SyntaxKind[SyntaxKind["CommaListExpression"] = 314] = "CommaListExpression";
- SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 315] = "MergeDeclarationMarker";
- SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 316] = "EndOfDeclarationMarker";
+ SyntaxKind[SyntaxKind["NotEmittedStatement"] = 313] = "NotEmittedStatement";
+ SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 314] = "PartiallyEmittedExpression";
+ SyntaxKind[SyntaxKind["CommaListExpression"] = 315] = "CommaListExpression";
+ SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 316] = "MergeDeclarationMarker";
+ SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 317] = "EndOfDeclarationMarker";
// Enum value count
- SyntaxKind[SyntaxKind["Count"] = 317] = "Count";
+ SyntaxKind[SyntaxKind["Count"] = 318] = "Count";
// Markers
- SyntaxKind[SyntaxKind["FirstAssignment"] = 59] = "FirstAssignment";
- SyntaxKind[SyntaxKind["LastAssignment"] = 71] = "LastAssignment";
- SyntaxKind[SyntaxKind["FirstCompoundAssignment"] = 60] = "FirstCompoundAssignment";
- SyntaxKind[SyntaxKind["LastCompoundAssignment"] = 71] = "LastCompoundAssignment";
- SyntaxKind[SyntaxKind["FirstReservedWord"] = 73] = "FirstReservedWord";
- SyntaxKind[SyntaxKind["LastReservedWord"] = 108] = "LastReservedWord";
- SyntaxKind[SyntaxKind["FirstKeyword"] = 73] = "FirstKeyword";
- SyntaxKind[SyntaxKind["LastKeyword"] = 147] = "LastKeyword";
- SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 109] = "FirstFutureReservedWord";
- SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 117] = "LastFutureReservedWord";
- SyntaxKind[SyntaxKind["FirstTypeNode"] = 163] = "FirstTypeNode";
- SyntaxKind[SyntaxKind["LastTypeNode"] = 183] = "LastTypeNode";
+ SyntaxKind[SyntaxKind["FirstAssignment"] = 60] = "FirstAssignment";
+ SyntaxKind[SyntaxKind["LastAssignment"] = 72] = "LastAssignment";
+ SyntaxKind[SyntaxKind["FirstCompoundAssignment"] = 61] = "FirstCompoundAssignment";
+ SyntaxKind[SyntaxKind["LastCompoundAssignment"] = 72] = "LastCompoundAssignment";
+ SyntaxKind[SyntaxKind["FirstReservedWord"] = 74] = "FirstReservedWord";
+ SyntaxKind[SyntaxKind["LastReservedWord"] = 109] = "LastReservedWord";
+ SyntaxKind[SyntaxKind["FirstKeyword"] = 74] = "FirstKeyword";
+ SyntaxKind[SyntaxKind["LastKeyword"] = 148] = "LastKeyword";
+ SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 110] = "FirstFutureReservedWord";
+ SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 118] = "LastFutureReservedWord";
+ SyntaxKind[SyntaxKind["FirstTypeNode"] = 164] = "FirstTypeNode";
+ SyntaxKind[SyntaxKind["LastTypeNode"] = 184] = "LastTypeNode";
SyntaxKind[SyntaxKind["FirstPunctuation"] = 18] = "FirstPunctuation";
- SyntaxKind[SyntaxKind["LastPunctuation"] = 71] = "LastPunctuation";
+ SyntaxKind[SyntaxKind["LastPunctuation"] = 72] = "LastPunctuation";
SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken";
- SyntaxKind[SyntaxKind["LastToken"] = 147] = "LastToken";
+ SyntaxKind[SyntaxKind["LastToken"] = 148] = "LastToken";
SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken";
SyntaxKind[SyntaxKind["LastTriviaToken"] = 7] = "LastTriviaToken";
SyntaxKind[SyntaxKind["FirstLiteralToken"] = 8] = "FirstLiteralToken";
@@ -2965,14 +3119,14 @@
SyntaxKind[SyntaxKind["FirstTemplateToken"] = 14] = "FirstTemplateToken";
SyntaxKind[SyntaxKind["LastTemplateToken"] = 17] = "LastTemplateToken";
SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 28] = "FirstBinaryOperator";
- SyntaxKind[SyntaxKind["LastBinaryOperator"] = 71] = "LastBinaryOperator";
- SyntaxKind[SyntaxKind["FirstNode"] = 148] = "FirstNode";
- SyntaxKind[SyntaxKind["FirstJSDocNode"] = 288] = "FirstJSDocNode";
- SyntaxKind[SyntaxKind["LastJSDocNode"] = 310] = "LastJSDocNode";
- SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 299] = "FirstJSDocTagNode";
- SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 310] = "LastJSDocTagNode";
- /* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 118] = "FirstContextualKeyword";
- /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 147] = "LastContextualKeyword";
+ SyntaxKind[SyntaxKind["LastBinaryOperator"] = 72] = "LastBinaryOperator";
+ SyntaxKind[SyntaxKind["FirstNode"] = 149] = "FirstNode";
+ SyntaxKind[SyntaxKind["FirstJSDocNode"] = 289] = "FirstJSDocNode";
+ SyntaxKind[SyntaxKind["LastJSDocNode"] = 311] = "LastJSDocNode";
+ SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 300] = "FirstJSDocTagNode";
+ SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 311] = "LastJSDocTagNode";
+ /* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 119] = "FirstContextualKeyword";
+ /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 148] = "LastContextualKeyword";
})(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {}));
var NodeFlags;
(function (NodeFlags) {
@@ -3115,6 +3269,8 @@
FlowFlags[FlowFlags["Shared"] = 1024] = "Shared";
FlowFlags[FlowFlags["PreFinally"] = 2048] = "PreFinally";
FlowFlags[FlowFlags["AfterFinally"] = 4096] = "AfterFinally";
+ /** @internal */
+ FlowFlags[FlowFlags["Cached"] = 8192] = "Cached";
FlowFlags[FlowFlags["Label"] = 12] = "Label";
FlowFlags[FlowFlags["Condition"] = 96] = "Condition";
})(FlowFlags = ts.FlowFlags || (ts.FlowFlags = {}));
@@ -3367,19 +3523,22 @@
CheckFlags[CheckFlags["SyntheticProperty"] = 2] = "SyntheticProperty";
CheckFlags[CheckFlags["SyntheticMethod"] = 4] = "SyntheticMethod";
CheckFlags[CheckFlags["Readonly"] = 8] = "Readonly";
- CheckFlags[CheckFlags["Partial"] = 16] = "Partial";
- CheckFlags[CheckFlags["HasNonUniformType"] = 32] = "HasNonUniformType";
- CheckFlags[CheckFlags["HasLiteralType"] = 64] = "HasLiteralType";
- CheckFlags[CheckFlags["ContainsPublic"] = 128] = "ContainsPublic";
- CheckFlags[CheckFlags["ContainsProtected"] = 256] = "ContainsProtected";
- CheckFlags[CheckFlags["ContainsPrivate"] = 512] = "ContainsPrivate";
- CheckFlags[CheckFlags["ContainsStatic"] = 1024] = "ContainsStatic";
- CheckFlags[CheckFlags["Late"] = 2048] = "Late";
- CheckFlags[CheckFlags["ReverseMapped"] = 4096] = "ReverseMapped";
- CheckFlags[CheckFlags["OptionalParameter"] = 8192] = "OptionalParameter";
- CheckFlags[CheckFlags["RestParameter"] = 16384] = "RestParameter";
+ CheckFlags[CheckFlags["ReadPartial"] = 16] = "ReadPartial";
+ CheckFlags[CheckFlags["WritePartial"] = 32] = "WritePartial";
+ CheckFlags[CheckFlags["HasNonUniformType"] = 64] = "HasNonUniformType";
+ CheckFlags[CheckFlags["HasLiteralType"] = 128] = "HasLiteralType";
+ CheckFlags[CheckFlags["ContainsPublic"] = 256] = "ContainsPublic";
+ CheckFlags[CheckFlags["ContainsProtected"] = 512] = "ContainsProtected";
+ CheckFlags[CheckFlags["ContainsPrivate"] = 1024] = "ContainsPrivate";
+ CheckFlags[CheckFlags["ContainsStatic"] = 2048] = "ContainsStatic";
+ CheckFlags[CheckFlags["Late"] = 4096] = "Late";
+ CheckFlags[CheckFlags["ReverseMapped"] = 8192] = "ReverseMapped";
+ CheckFlags[CheckFlags["OptionalParameter"] = 16384] = "OptionalParameter";
+ CheckFlags[CheckFlags["RestParameter"] = 32768] = "RestParameter";
+ CheckFlags[CheckFlags["DeferredType"] = 65536] = "DeferredType";
CheckFlags[CheckFlags["Synthetic"] = 6] = "Synthetic";
- CheckFlags[CheckFlags["Discriminant"] = 96] = "Discriminant";
+ CheckFlags[CheckFlags["Discriminant"] = 192] = "Discriminant";
+ CheckFlags[CheckFlags["Partial"] = 48] = "Partial";
})(CheckFlags = ts.CheckFlags || (ts.CheckFlags = {}));
var InternalSymbolName;
(function (InternalSymbolName) {
@@ -3490,6 +3649,8 @@
TypeFlags[TypeFlags["StructuredOrInstantiable"] = 66846720] = "StructuredOrInstantiable";
/* @internal */
TypeFlags[TypeFlags["ObjectFlagsType"] = 3899392] = "ObjectFlagsType";
+ /* @internal */
+ TypeFlags[TypeFlags["Simplifiable"] = 25165824] = "Simplifiable";
// 'Narrowable' types are types where narrowing actually narrows.
// This *should* be every type other than null, undefined, void, and never
TypeFlags[TypeFlags["Narrowable"] = 133970943] = "Narrowable";
@@ -3545,14 +3706,18 @@
ObjectFlags[ObjectFlags["PropagatingFlags"] = 917504] = "PropagatingFlags";
})(ObjectFlags = ts.ObjectFlags || (ts.ObjectFlags = {}));
/* @internal */
- var Variance;
- (function (Variance) {
- Variance[Variance["Invariant"] = 0] = "Invariant";
- Variance[Variance["Covariant"] = 1] = "Covariant";
- Variance[Variance["Contravariant"] = 2] = "Contravariant";
- Variance[Variance["Bivariant"] = 3] = "Bivariant";
- Variance[Variance["Independent"] = 4] = "Independent";
- })(Variance = ts.Variance || (ts.Variance = {}));
+ var VarianceFlags;
+ (function (VarianceFlags) {
+ VarianceFlags[VarianceFlags["Invariant"] = 0] = "Invariant";
+ VarianceFlags[VarianceFlags["Covariant"] = 1] = "Covariant";
+ VarianceFlags[VarianceFlags["Contravariant"] = 2] = "Contravariant";
+ VarianceFlags[VarianceFlags["Bivariant"] = 3] = "Bivariant";
+ VarianceFlags[VarianceFlags["Independent"] = 4] = "Independent";
+ VarianceFlags[VarianceFlags["VarianceMask"] = 7] = "VarianceMask";
+ VarianceFlags[VarianceFlags["Unmeasurable"] = 8] = "Unmeasurable";
+ VarianceFlags[VarianceFlags["Unreliable"] = 16] = "Unreliable";
+ VarianceFlags[VarianceFlags["AllowsStructuralFallback"] = 24] = "AllowsStructuralFallback";
+ })(VarianceFlags = ts.VarianceFlags || (ts.VarianceFlags = {}));
/* @internal */
var JsxReferenceKind;
(function (JsxReferenceKind) {
@@ -3574,12 +3739,13 @@
(function (InferencePriority) {
InferencePriority[InferencePriority["NakedTypeVariable"] = 1] = "NakedTypeVariable";
InferencePriority[InferencePriority["HomomorphicMappedType"] = 2] = "HomomorphicMappedType";
- InferencePriority[InferencePriority["MappedTypeConstraint"] = 4] = "MappedTypeConstraint";
- InferencePriority[InferencePriority["ReturnType"] = 8] = "ReturnType";
- InferencePriority[InferencePriority["LiteralKeyof"] = 16] = "LiteralKeyof";
- InferencePriority[InferencePriority["NoConstraints"] = 32] = "NoConstraints";
- InferencePriority[InferencePriority["AlwaysStrict"] = 64] = "AlwaysStrict";
- InferencePriority[InferencePriority["PriorityImpliesCombination"] = 28] = "PriorityImpliesCombination";
+ InferencePriority[InferencePriority["PartialHomomorphicMappedType"] = 4] = "PartialHomomorphicMappedType";
+ InferencePriority[InferencePriority["MappedTypeConstraint"] = 8] = "MappedTypeConstraint";
+ InferencePriority[InferencePriority["ReturnType"] = 16] = "ReturnType";
+ InferencePriority[InferencePriority["LiteralKeyof"] = 32] = "LiteralKeyof";
+ InferencePriority[InferencePriority["NoConstraints"] = 64] = "NoConstraints";
+ InferencePriority[InferencePriority["AlwaysStrict"] = 128] = "AlwaysStrict";
+ InferencePriority[InferencePriority["PriorityImpliesCombination"] = 56] = "PriorityImpliesCombination";
})(InferencePriority = ts.InferencePriority || (ts.InferencePriority = {}));
/* @internal */
var InferenceFlags;
@@ -3696,9 +3862,10 @@
ScriptTarget[ScriptTarget["ES2017"] = 4] = "ES2017";
ScriptTarget[ScriptTarget["ES2018"] = 5] = "ES2018";
ScriptTarget[ScriptTarget["ES2019"] = 6] = "ES2019";
- ScriptTarget[ScriptTarget["ESNext"] = 7] = "ESNext";
+ ScriptTarget[ScriptTarget["ES2020"] = 7] = "ES2020";
+ ScriptTarget[ScriptTarget["ESNext"] = 8] = "ESNext";
ScriptTarget[ScriptTarget["JSON"] = 100] = "JSON";
- ScriptTarget[ScriptTarget["Latest"] = 7] = "Latest";
+ ScriptTarget[ScriptTarget["Latest"] = 8] = "Latest";
})(ScriptTarget = ts.ScriptTarget || (ts.ScriptTarget = {}));
var LanguageVariant;
(function (LanguageVariant) {
@@ -4111,17 +4278,10 @@
PragmaKindFlags[PragmaKindFlags["All"] = 7] = "All";
PragmaKindFlags[PragmaKindFlags["Default"] = 7] = "Default";
})(PragmaKindFlags = ts.PragmaKindFlags || (ts.PragmaKindFlags = {}));
- /**
- * This function only exists to cause exact types to be inferred for all the literals within `commentPragmas`
- */
- /* @internal */
- function _contextuallyTypePragmas(args) {
- return args;
- }
// While not strictly a type, this is here because `PragmaMap` needs to be here to be used with `SourceFile`, and we don't
// fancy effectively defining it twice, once in value-space and once in type-space
/* @internal */
- ts.commentPragmas = _contextuallyTypePragmas({
+ ts.commentPragmas = {
"reference": {
args: [
{ name: "types", optional: true, captureSpan: true },
@@ -4149,7 +4309,7 @@
args: [{ name: "factory" }],
kind: 4 /* MultiLine */
},
- });
+ };
})(ts || (ts = {}));
var ts;
(function (ts) {
@@ -5196,7 +5356,7 @@
_0_modifier_cannot_appear_on_a_data_property: diag(1043, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_data_property_1043", "'{0}' modifier cannot appear on a data property."),
_0_modifier_cannot_appear_on_a_module_or_namespace_element: diag(1044, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_module_or_namespace_element_1044", "'{0}' modifier cannot appear on a module or namespace element."),
A_0_modifier_cannot_be_used_with_an_interface_declaration: diag(1045, ts.DiagnosticCategory.Error, "A_0_modifier_cannot_be_used_with_an_interface_declaration_1045", "A '{0}' modifier cannot be used with an interface declaration."),
- A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: diag(1046, ts.DiagnosticCategory.Error, "A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file_1046", "A 'declare' modifier is required for a top level declaration in a .d.ts file."),
+ Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier: diag(1046, ts.DiagnosticCategory.Error, "Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier_1046", "Top-level declarations in .d.ts files must start with either a 'declare' or 'export' modifier."),
A_rest_parameter_cannot_be_optional: diag(1047, ts.DiagnosticCategory.Error, "A_rest_parameter_cannot_be_optional_1047", "A rest parameter cannot be optional."),
A_rest_parameter_cannot_have_an_initializer: diag(1048, ts.DiagnosticCategory.Error, "A_rest_parameter_cannot_have_an_initializer_1048", "A rest parameter cannot have an initializer."),
A_set_accessor_must_have_exactly_one_parameter: diag(1049, ts.DiagnosticCategory.Error, "A_set_accessor_must_have_exactly_one_parameter_1049", "A 'set' accessor must have exactly one parameter."),
@@ -5325,7 +5485,7 @@
Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided: diag(1205, ts.DiagnosticCategory.Error, "Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided_1205", "Cannot re-export a type when the '--isolatedModules' flag is provided."),
Decorators_are_not_valid_here: diag(1206, ts.DiagnosticCategory.Error, "Decorators_are_not_valid_here_1206", "Decorators are not valid here."),
Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: diag(1207, ts.DiagnosticCategory.Error, "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207", "Decorators cannot be applied to multiple get/set accessors of the same name."),
- Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided: diag(1208, ts.DiagnosticCategory.Error, "Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided_1208", "Cannot compile namespaces when the '--isolatedModules' flag is provided."),
+ All_files_must_be_modules_when_the_isolatedModules_flag_is_provided: diag(1208, ts.DiagnosticCategory.Error, "All_files_must_be_modules_when_the_isolatedModules_flag_is_provided_1208", "All files must be modules when the '--isolatedModules' flag is provided."),
Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: diag(1210, ts.DiagnosticCategory.Error, "Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode_1210", "Invalid use of '{0}'. Class definitions are automatically in strict mode."),
A_class_declaration_without_the_default_modifier_must_have_a_name: diag(1211, ts.DiagnosticCategory.Error, "A_class_declaration_without_the_default_modifier_must_have_a_name_1211", "A class declaration without the 'default' modifier must have a name."),
Identifier_expected_0_is_a_reserved_word_in_strict_mode: diag(1212, ts.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_in_strict_mode_1212", "Identifier expected. '{0}' is a reserved word in strict mode."),
@@ -5334,7 +5494,7 @@
Invalid_use_of_0_Modules_are_automatically_in_strict_mode: diag(1215, ts.DiagnosticCategory.Error, "Invalid_use_of_0_Modules_are_automatically_in_strict_mode_1215", "Invalid use of '{0}'. Modules are automatically in strict mode."),
Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules: diag(1216, ts.DiagnosticCategory.Error, "Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules_1216", "Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules."),
Export_assignment_is_not_supported_when_module_flag_is_system: diag(1218, ts.DiagnosticCategory.Error, "Export_assignment_is_not_supported_when_module_flag_is_system_1218", "Export assignment is not supported when '--module' flag is 'system'."),
- Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning: diag(1219, ts.DiagnosticCategory.Error, "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219", "Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning."),
+ Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning: diag(1219, ts.DiagnosticCategory.Error, "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219", "Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning."),
Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher: diag(1220, ts.DiagnosticCategory.Error, "Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher_1220", "Generators are only available when targeting ECMAScript 2015 or higher."),
Generators_are_not_allowed_in_an_ambient_context: diag(1221, ts.DiagnosticCategory.Error, "Generators_are_not_allowed_in_an_ambient_context_1221", "Generators are not allowed in an ambient context."),
An_overload_signature_cannot_be_declared_as_a_generator: diag(1222, ts.DiagnosticCategory.Error, "An_overload_signature_cannot_be_declared_as_a_generator_1222", "An overload signature cannot be declared as a generator."),
@@ -5373,6 +5533,8 @@
A_definite_assignment_assertion_is_not_permitted_in_this_context: diag(1255, ts.DiagnosticCategory.Error, "A_definite_assignment_assertion_is_not_permitted_in_this_context_1255", "A definite assignment assertion '!' is not permitted in this context."),
A_rest_element_must_be_last_in_a_tuple_type: diag(1256, ts.DiagnosticCategory.Error, "A_rest_element_must_be_last_in_a_tuple_type_1256", "A rest element must be last in a tuple type."),
A_required_element_cannot_follow_an_optional_element: diag(1257, ts.DiagnosticCategory.Error, "A_required_element_cannot_follow_an_optional_element_1257", "A required element cannot follow an optional element."),
+ Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation: diag(1258, ts.DiagnosticCategory.Error, "Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation_1258", "Definite assignment assertions can only be used along with a type annotation."),
+ Module_0_can_only_be_default_imported_using_the_1_flag: diag(1259, ts.DiagnosticCategory.Error, "Module_0_can_only_be_default_imported_using_the_1_flag_1259", "Module '{0}' can only be default-imported using the '{1}' flag"),
with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
await_expression_is_only_allowed_within_an_async_function: diag(1308, ts.DiagnosticCategory.Error, "await_expression_is_only_allowed_within_an_async_function_1308", "'await' expression is only allowed within an async function."),
can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment: diag(1312, ts.DiagnosticCategory.Error, "can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment_1312", "'=' can only be used in an object literal property inside a destructuring assignment."),
@@ -5417,7 +5579,8 @@
A_bigint_literal_cannot_use_exponential_notation: diag(1352, ts.DiagnosticCategory.Error, "A_bigint_literal_cannot_use_exponential_notation_1352", "A bigint literal cannot use exponential notation."),
A_bigint_literal_must_be_an_integer: diag(1353, ts.DiagnosticCategory.Error, "A_bigint_literal_must_be_an_integer_1353", "A bigint literal must be an integer."),
readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types: diag(1354, ts.DiagnosticCategory.Error, "readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types_1354", "'readonly' type modifier is only permitted on array and tuple literal types."),
- A_const_assertion_can_only_be_applied_to_a_string_number_boolean_array_or_object_literal: diag(1355, ts.DiagnosticCategory.Error, "A_const_assertion_can_only_be_applied_to_a_string_number_boolean_array_or_object_literal_1355", "A 'const' assertion can only be applied to a string, number, boolean, array, or object literal."),
+ A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals: diag(1355, ts.DiagnosticCategory.Error, "A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array__1355", "A 'const' assertions can only be applied to references to enum members, or string, number, boolean, array, or object literals."),
+ Did_you_mean_to_mark_this_function_as_async: diag(1356, ts.DiagnosticCategory.Error, "Did_you_mean_to_mark_this_function_as_async_1356", "Did you mean to mark this function as 'async'?"),
Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2301, ts.DiagnosticCategory.Error, "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
Static_members_cannot_reference_class_type_parameters: diag(2302, ts.DiagnosticCategory.Error, "Static_members_cannot_reference_class_type_parameters_2302", "Static members cannot reference class type parameters."),
@@ -5699,6 +5862,7 @@
Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig: diag(2591, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_types_Slashnode_and_th_2591", "Cannot find name '{0}'. Do you need to install type definitions for node? Try `npm i @types/node` and then add `node` to the types field in your tsconfig."),
Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_types_Slashjquery_and_then_add_jquery_to_the_types_field_in_your_tsconfig: diag(2592, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_types_Slashjquery_an_2592", "Cannot find name '{0}'. Do you need to install type definitions for jQuery? Try `npm i @types/jquery` and then add `jquery` to the types field in your tsconfig."),
Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_types_Slashjest_or_npm_i_types_Slashmocha_and_then_add_jest_or_mocha_to_the_types_field_in_your_tsconfig: diag(2593, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_types_Slashje_2593", "Cannot find name '{0}'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig."),
+ This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag: diag(2594, ts.DiagnosticCategory.Error, "This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594", "This module is declared with using 'export =', and can only be used with a default import when using the '{0}' flag."),
JSX_element_attributes_type_0_may_not_be_a_union_type: diag(2600, ts.DiagnosticCategory.Error, "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", "JSX element attributes type '{0}' may not be a union type."),
The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: diag(2601, ts.DiagnosticCategory.Error, "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", "The return type of a JSX element constructor must return an object type."),
JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: diag(2602, ts.DiagnosticCategory.Error, "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist."),
@@ -5811,6 +5975,7 @@
Circularity_originates_in_type_at_this_location: diag(2751, ts.DiagnosticCategory.Error, "Circularity_originates_in_type_at_this_location_2751", "Circularity originates in type at this location."),
The_first_export_default_is_here: diag(2752, ts.DiagnosticCategory.Error, "The_first_export_default_is_here_2752", "The first export default is here."),
Another_export_default_is_here: diag(2753, ts.DiagnosticCategory.Error, "Another_export_default_is_here_2753", "Another export default is here."),
+ super_may_not_use_type_arguments: diag(2754, ts.DiagnosticCategory.Error, "super_may_not_use_type_arguments_2754", "'super' may not use type arguments."),
Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -5895,6 +6060,7 @@
Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4101, ts.DiagnosticCategory.Error, "Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2_4101", "Method '{0}' of exported interface has or is using name '{1}' from private module '{2}'."),
Method_0_of_exported_interface_has_or_is_using_private_name_1: diag(4102, ts.DiagnosticCategory.Error, "Method_0_of_exported_interface_has_or_is_using_private_name_1_4102", "Method '{0}' of exported interface has or is using private name '{1}'."),
Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1: diag(4103, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1_4103", "Type parameter '{0}' of exported mapped object type is using private name '{1}'."),
+ The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1: diag(4104, ts.DiagnosticCategory.Error, "The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1_4104", "The type '{0}' is 'readonly' and cannot be assigned to the mutable type '{1}'."),
The_current_host_does_not_support_the_0_option: diag(5001, ts.DiagnosticCategory.Error, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, ts.DiagnosticCategory.Error, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, ts.DiagnosticCategory.Error, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
@@ -5928,6 +6094,8 @@
Option_resolveJsonModule_can_only_be_specified_when_module_code_generation_is_commonjs_amd_es2015_or_esNext: diag(5071, ts.DiagnosticCategory.Error, "Option_resolveJsonModule_can_only_be_specified_when_module_code_generation_is_commonjs_amd_es2015_or_5071", "Option '--resolveJsonModule' can only be specified when module code generation is 'commonjs', 'amd', 'es2015' or 'esNext'."),
Unknown_build_option_0: diag(5072, ts.DiagnosticCategory.Error, "Unknown_build_option_0_5072", "Unknown build option '{0}'."),
Build_option_0_requires_a_value_of_type_1: diag(5073, ts.DiagnosticCategory.Error, "Build_option_0_requires_a_value_of_type_1_5073", "Build option '{0}' requires a value of type {1}."),
+ Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified: diag(5074, ts.DiagnosticCategory.Error, "Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBui_5074", "Option '--incremental' can only be specified using tsconfig, emitting to single file or when option `--tsBuildInfoFile` is specified."),
+ _0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_constraint_2: diag(5075, ts.DiagnosticCategory.Error, "_0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_5075", "'{0}' is assignable to the constraint of type '{1}', but '{1}' could be instantiated with a different subtype of constraint '{2}'."),
Generates_a_sourcemap_for_each_corresponding_d_ts_file: diag(6000, ts.DiagnosticCategory.Message, "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000", "Generates a sourcemap for each corresponding '.d.ts' file."),
Concatenate_and_emit_output_to_single_file: diag(6001, ts.DiagnosticCategory.Message, "Concatenate_and_emit_output_to_single_file_6001", "Concatenate and emit output to single file."),
Generates_corresponding_d_ts_file: diag(6002, ts.DiagnosticCategory.Message, "Generates_corresponding_d_ts_file_6002", "Generates corresponding '.d.ts' file."),
@@ -6104,7 +6272,6 @@
Enable_strict_checking_of_property_initialization_in_classes: diag(6187, ts.DiagnosticCategory.Message, "Enable_strict_checking_of_property_initialization_in_classes_6187", "Enable strict checking of property initialization in classes."),
Numeric_separators_are_not_allowed_here: diag(6188, ts.DiagnosticCategory.Error, "Numeric_separators_are_not_allowed_here_6188", "Numeric separators are not allowed here."),
Multiple_consecutive_numeric_separators_are_not_permitted: diag(6189, ts.DiagnosticCategory.Error, "Multiple_consecutive_numeric_separators_are_not_permitted_6189", "Multiple consecutive numeric separators are not permitted."),
- Found_package_json_at_0_Package_ID_is_1: diag(6190, ts.DiagnosticCategory.Message, "Found_package_json_at_0_Package_ID_is_1_6190", "Found 'package.json' at '{0}'. Package ID is '{1}'."),
Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen: diag(6191, ts.DiagnosticCategory.Message, "Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen_6191", "Whether to keep outdated console output in watch mode instead of clearing the screen."),
All_imports_in_import_declaration_are_unused: diag(6192, ts.DiagnosticCategory.Error, "All_imports_in_import_declaration_are_unused_6192", "All imports in import declaration are unused.", /*reportsUnnecessary*/ true),
Found_1_error_Watching_for_file_changes: diag(6193, ts.DiagnosticCategory.Message, "Found_1_error_Watching_for_file_changes_6193", "Found 1 error. Watching for file changes."),
@@ -6131,6 +6298,9 @@
Using_compiler_options_of_project_reference_redirect_0: diag(6215, ts.DiagnosticCategory.Message, "Using_compiler_options_of_project_reference_redirect_0_6215", "Using compiler options of project reference redirect '{0}'."),
Found_1_error: diag(6216, ts.DiagnosticCategory.Message, "Found_1_error_6216", "Found 1 error."),
Found_0_errors: diag(6217, ts.DiagnosticCategory.Message, "Found_0_errors_6217", "Found {0} errors."),
+ Module_name_0_was_successfully_resolved_to_1_with_Package_ID_2: diag(6218, ts.DiagnosticCategory.Message, "Module_name_0_was_successfully_resolved_to_1_with_Package_ID_2_6218", "======== Module name '{0}' was successfully resolved to '{1}' with Package ID '{2}'. ========"),
+ Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3: diag(6219, ts.DiagnosticCategory.Message, "Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3_6219", "======== Type reference directive '{0}' was successfully resolved to '{1}' with Package ID '{2}', primary: {3}. ========"),
+ package_json_had_a_falsy_0_field: diag(6220, ts.DiagnosticCategory.Message, "package_json_had_a_falsy_0_field_6220", "'package.json' had a falsy '{0}' field."),
Projects_to_reference: diag(6300, ts.DiagnosticCategory.Message, "Projects_to_reference_6300", "Projects to reference"),
Enable_project_compilation: diag(6302, ts.DiagnosticCategory.Message, "Enable_project_compilation_6302", "Enable project compilation"),
Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0: diag(6202, ts.DiagnosticCategory.Error, "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202", "Project references may not form a circular graph. Cycle detected: {0}"),
@@ -6219,6 +6389,9 @@
Property_0_implicitly_has_type_any_but_a_better_type_for_its_set_accessor_may_be_inferred_from_usage: diag(7049, ts.DiagnosticCategory.Suggestion, "Property_0_implicitly_has_type_any_but_a_better_type_for_its_set_accessor_may_be_inferred_from_usage_7049", "Property '{0}' implicitly has type 'any', but a better type for its set accessor may be inferred from usage."),
_0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage: diag(7050, ts.DiagnosticCategory.Suggestion, "_0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage_7050", "'{0}' implicitly has an '{1}' return type, but a better type may be inferred from usage."),
Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1: diag(7051, ts.DiagnosticCategory.Error, "Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1_7051", "Parameter has a name but no type. Did you mean '{0}: {1}'?"),
+ Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1: diag(7052, ts.DiagnosticCategory.Error, "Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1_7052", "Element implicitly has an 'any' type because type '{0}' has no index signature. Did you mean to call '{1}' ?"),
+ Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1: diag(7053, ts.DiagnosticCategory.Error, "Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1_7053", "Element implicitly has an 'any' type because expression of type '{0}' can't be used to index type '{1}'."),
+ No_index_signature_with_a_parameter_of_type_0_was_found_on_type_1: diag(7054, ts.DiagnosticCategory.Error, "No_index_signature_with_a_parameter_of_type_0_was_found_on_type_1_7054", "No index signature with a parameter of type '{0}' was found on type '{1}'."),
You_cannot_rename_this_element: diag(8000, ts.DiagnosticCategory.Error, "You_cannot_rename_this_element_8000", "You cannot rename this element."),
You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: diag(8001, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001", "You cannot rename elements that are defined in the standard TypeScript library."),
import_can_only_be_used_in_a_ts_file: diag(8002, ts.DiagnosticCategory.Error, "import_can_only_be_used_in_a_ts_file_8002", "'import ... =' can only be used in a .ts file."),
@@ -6380,8 +6553,6 @@
Add_all_missing_imports: diag(95064, ts.DiagnosticCategory.Message, "Add_all_missing_imports_95064", "Add all missing imports"),
Convert_to_async_function: diag(95065, ts.DiagnosticCategory.Message, "Convert_to_async_function_95065", "Convert to async function"),
Convert_all_to_async_functions: diag(95066, ts.DiagnosticCategory.Message, "Convert_all_to_async_functions_95066", "Convert all to async functions"),
- Generate_types_for_0: diag(95067, ts.DiagnosticCategory.Message, "Generate_types_for_0_95067", "Generate types for '{0}'"),
- Generate_types_for_all_packages_without_types: diag(95068, ts.DiagnosticCategory.Message, "Generate_types_for_all_packages_without_types_95068", "Generate types for all packages without types"),
Add_unknown_conversion_for_non_overlapping_types: diag(95069, ts.DiagnosticCategory.Message, "Add_unknown_conversion_for_non_overlapping_types_95069", "Add 'unknown' conversion for non-overlapping types"),
Add_unknown_to_all_conversions_of_non_overlapping_types: diag(95070, ts.DiagnosticCategory.Message, "Add_unknown_to_all_conversions_of_non_overlapping_types_95070", "Add 'unknown' to all conversions of non-overlapping types"),
Add_missing_new_operator_to_call: diag(95071, ts.DiagnosticCategory.Message, "Add_missing_new_operator_to_call_95071", "Add missing 'new' operator to call"),
@@ -6389,6 +6560,13 @@
Add_names_to_all_parameters_without_names: diag(95073, ts.DiagnosticCategory.Message, "Add_names_to_all_parameters_without_names_95073", "Add names to all parameters without names"),
Enable_the_experimentalDecorators_option_in_your_configuration_file: diag(95074, ts.DiagnosticCategory.Message, "Enable_the_experimentalDecorators_option_in_your_configuration_file_95074", "Enable the 'experimentalDecorators' option in your configuration file"),
Convert_parameters_to_destructured_object: diag(95075, ts.DiagnosticCategory.Message, "Convert_parameters_to_destructured_object_95075", "Convert parameters to destructured object"),
+ Allow_accessing_UMD_globals_from_modules: diag(95076, ts.DiagnosticCategory.Message, "Allow_accessing_UMD_globals_from_modules_95076", "Allow accessing UMD globals from modules."),
+ Extract_type: diag(95077, ts.DiagnosticCategory.Message, "Extract_type_95077", "Extract type"),
+ Extract_to_type_alias: diag(95078, ts.DiagnosticCategory.Message, "Extract_to_type_alias_95078", "Extract to type alias"),
+ Extract_to_typedef: diag(95079, ts.DiagnosticCategory.Message, "Extract_to_typedef_95079", "Extract to typedef"),
+ No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, ts.DiagnosticCategory.Error, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
+ Quoted_constructors_have_previously_been_interpreted_as_methods_which_is_incorrect_In_TypeScript_3_6_they_will_be_correctly_parsed_as_constructors_In_the_meantime_consider_using_constructor_to_write_a_constructor_or_constructor_to_write_a_method: diag(18005, ts.DiagnosticCategory.Error, "Quoted_constructors_have_previously_been_interpreted_as_methods_which_is_incorrect_In_TypeScript_3_6_18005", "Quoted constructors have previously been interpreted as methods, which is incorrect. In TypeScript 3.6, they will be correctly parsed as constructors. In the meantime, consider using 'constructor()' to write a constructor, or '[\"constructor\"]()' to write a method."),
+ Classes_may_not_have_a_field_named_constructor: diag(18006, ts.DiagnosticCategory.Error, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
};
})(ts || (ts = {}));
var ts;
@@ -6396,7 +6574,7 @@
var _a;
/* @internal */
function tokenIsIdentifierOrKeyword(token) {
- return token >= 72 /* Identifier */;
+ return token >= 73 /* Identifier */;
}
ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword;
/* @internal */
@@ -6405,85 +6583,85 @@
}
ts.tokenIsIdentifierOrKeywordOrGreaterThan = tokenIsIdentifierOrKeywordOrGreaterThan;
var textToKeywordObj = (_a = {
- abstract: 118 /* AbstractKeyword */,
- any: 120 /* AnyKeyword */,
- as: 119 /* AsKeyword */,
- bigint: 146 /* BigIntKeyword */,
- boolean: 123 /* BooleanKeyword */,
- break: 73 /* BreakKeyword */,
- case: 74 /* CaseKeyword */,
- catch: 75 /* CatchKeyword */,
- class: 76 /* ClassKeyword */,
- continue: 78 /* ContinueKeyword */,
- const: 77 /* ConstKeyword */
- },
- _a["" + "constructor"] = 124 /* ConstructorKeyword */,
- _a.debugger = 79 /* DebuggerKeyword */,
- _a.declare = 125 /* DeclareKeyword */,
- _a.default = 80 /* DefaultKeyword */,
- _a.delete = 81 /* DeleteKeyword */,
- _a.do = 82 /* DoKeyword */,
- _a.else = 83 /* ElseKeyword */,
- _a.enum = 84 /* EnumKeyword */,
- _a.export = 85 /* ExportKeyword */,
- _a.extends = 86 /* ExtendsKeyword */,
- _a.false = 87 /* FalseKeyword */,
- _a.finally = 88 /* FinallyKeyword */,
- _a.for = 89 /* ForKeyword */,
- _a.from = 144 /* FromKeyword */,
- _a.function = 90 /* FunctionKeyword */,
- _a.get = 126 /* GetKeyword */,
- _a.if = 91 /* IfKeyword */,
- _a.implements = 109 /* ImplementsKeyword */,
- _a.import = 92 /* ImportKeyword */,
- _a.in = 93 /* InKeyword */,
- _a.infer = 127 /* InferKeyword */,
- _a.instanceof = 94 /* InstanceOfKeyword */,
- _a.interface = 110 /* InterfaceKeyword */,
- _a.is = 128 /* IsKeyword */,
- _a.keyof = 129 /* KeyOfKeyword */,
- _a.let = 111 /* LetKeyword */,
- _a.module = 130 /* ModuleKeyword */,
- _a.namespace = 131 /* NamespaceKeyword */,
- _a.never = 132 /* NeverKeyword */,
- _a.new = 95 /* NewKeyword */,
- _a.null = 96 /* NullKeyword */,
- _a.number = 135 /* NumberKeyword */,
- _a.object = 136 /* ObjectKeyword */,
- _a.package = 112 /* PackageKeyword */,
- _a.private = 113 /* PrivateKeyword */,
- _a.protected = 114 /* ProtectedKeyword */,
- _a.public = 115 /* PublicKeyword */,
- _a.readonly = 133 /* ReadonlyKeyword */,
- _a.require = 134 /* RequireKeyword */,
- _a.global = 145 /* GlobalKeyword */,
- _a.return = 97 /* ReturnKeyword */,
- _a.set = 137 /* SetKeyword */,
- _a.static = 116 /* StaticKeyword */,
- _a.string = 138 /* StringKeyword */,
- _a.super = 98 /* SuperKeyword */,
- _a.switch = 99 /* SwitchKeyword */,
- _a.symbol = 139 /* SymbolKeyword */,
- _a.this = 100 /* ThisKeyword */,
- _a.throw = 101 /* ThrowKeyword */,
- _a.true = 102 /* TrueKeyword */,
- _a.try = 103 /* TryKeyword */,
- _a.type = 140 /* TypeKeyword */,
- _a.typeof = 104 /* TypeOfKeyword */,
- _a.undefined = 141 /* UndefinedKeyword */,
- _a.unique = 142 /* UniqueKeyword */,
- _a.unknown = 143 /* UnknownKeyword */,
- _a.var = 105 /* VarKeyword */,
- _a.void = 106 /* VoidKeyword */,
- _a.while = 107 /* WhileKeyword */,
- _a.with = 108 /* WithKeyword */,
- _a.yield = 117 /* YieldKeyword */,
- _a.async = 121 /* AsyncKeyword */,
- _a.await = 122 /* AwaitKeyword */,
- _a.of = 147 /* OfKeyword */,
+ abstract: 119 /* AbstractKeyword */,
+ any: 121 /* AnyKeyword */,
+ as: 120 /* AsKeyword */,
+ bigint: 147 /* BigIntKeyword */,
+ boolean: 124 /* BooleanKeyword */,
+ break: 74 /* BreakKeyword */,
+ case: 75 /* CaseKeyword */,
+ catch: 76 /* CatchKeyword */,
+ class: 77 /* ClassKeyword */,
+ continue: 79 /* ContinueKeyword */,
+ const: 78 /* ConstKeyword */
+ },
+ _a["" + "constructor"] = 125 /* ConstructorKeyword */,
+ _a.debugger = 80 /* DebuggerKeyword */,
+ _a.declare = 126 /* DeclareKeyword */,
+ _a.default = 81 /* DefaultKeyword */,
+ _a.delete = 82 /* DeleteKeyword */,
+ _a.do = 83 /* DoKeyword */,
+ _a.else = 84 /* ElseKeyword */,
+ _a.enum = 85 /* EnumKeyword */,
+ _a.export = 86 /* ExportKeyword */,
+ _a.extends = 87 /* ExtendsKeyword */,
+ _a.false = 88 /* FalseKeyword */,
+ _a.finally = 89 /* FinallyKeyword */,
+ _a.for = 90 /* ForKeyword */,
+ _a.from = 145 /* FromKeyword */,
+ _a.function = 91 /* FunctionKeyword */,
+ _a.get = 127 /* GetKeyword */,
+ _a.if = 92 /* IfKeyword */,
+ _a.implements = 110 /* ImplementsKeyword */,
+ _a.import = 93 /* ImportKeyword */,
+ _a.in = 94 /* InKeyword */,
+ _a.infer = 128 /* InferKeyword */,
+ _a.instanceof = 95 /* InstanceOfKeyword */,
+ _a.interface = 111 /* InterfaceKeyword */,
+ _a.is = 129 /* IsKeyword */,
+ _a.keyof = 130 /* KeyOfKeyword */,
+ _a.let = 112 /* LetKeyword */,
+ _a.module = 131 /* ModuleKeyword */,
+ _a.namespace = 132 /* NamespaceKeyword */,
+ _a.never = 133 /* NeverKeyword */,
+ _a.new = 96 /* NewKeyword */,
+ _a.null = 97 /* NullKeyword */,
+ _a.number = 136 /* NumberKeyword */,
+ _a.object = 137 /* ObjectKeyword */,
+ _a.package = 113 /* PackageKeyword */,
+ _a.private = 114 /* PrivateKeyword */,
+ _a.protected = 115 /* ProtectedKeyword */,
+ _a.public = 116 /* PublicKeyword */,
+ _a.readonly = 134 /* ReadonlyKeyword */,
+ _a.require = 135 /* RequireKeyword */,
+ _a.global = 146 /* GlobalKeyword */,
+ _a.return = 98 /* ReturnKeyword */,
+ _a.set = 138 /* SetKeyword */,
+ _a.static = 117 /* StaticKeyword */,
+ _a.string = 139 /* StringKeyword */,
+ _a.super = 99 /* SuperKeyword */,
+ _a.switch = 100 /* SwitchKeyword */,
+ _a.symbol = 140 /* SymbolKeyword */,
+ _a.this = 101 /* ThisKeyword */,
+ _a.throw = 102 /* ThrowKeyword */,
+ _a.true = 103 /* TrueKeyword */,
+ _a.try = 104 /* TryKeyword */,
+ _a.type = 141 /* TypeKeyword */,
+ _a.typeof = 105 /* TypeOfKeyword */,
+ _a.undefined = 142 /* UndefinedKeyword */,
+ _a.unique = 143 /* UniqueKeyword */,
+ _a.unknown = 144 /* UnknownKeyword */,
+ _a.var = 106 /* VarKeyword */,
+ _a.void = 107 /* VoidKeyword */,
+ _a.while = 108 /* WhileKeyword */,
+ _a.with = 109 /* WithKeyword */,
+ _a.yield = 118 /* YieldKeyword */,
+ _a.async = 122 /* AsyncKeyword */,
+ _a.await = 123 /* AwaitKeyword */,
+ _a.of = 148 /* OfKeyword */,
_a);
var textToKeyword = ts.createMapFromTemplate(textToKeywordObj);
- var textToToken = ts.createMapFromTemplate(__assign({}, textToKeywordObj, { "{": 18 /* OpenBraceToken */, "}": 19 /* CloseBraceToken */, "(": 20 /* OpenParenToken */, ")": 21 /* CloseParenToken */, "[": 22 /* OpenBracketToken */, "]": 23 /* CloseBracketToken */, ".": 24 /* DotToken */, "...": 25 /* DotDotDotToken */, ";": 26 /* SemicolonToken */, ",": 27 /* CommaToken */, "<": 28 /* LessThanToken */, ">": 30 /* GreaterThanToken */, "<=": 31 /* LessThanEqualsToken */, ">=": 32 /* GreaterThanEqualsToken */, "==": 33 /* EqualsEqualsToken */, "!=": 34 /* ExclamationEqualsToken */, "===": 35 /* EqualsEqualsEqualsToken */, "!==": 36 /* ExclamationEqualsEqualsToken */, "=>": 37 /* EqualsGreaterThanToken */, "+": 38 /* PlusToken */, "-": 39 /* MinusToken */, "**": 41 /* AsteriskAsteriskToken */, "*": 40 /* AsteriskToken */, "/": 42 /* SlashToken */, "%": 43 /* PercentToken */, "++": 44 /* PlusPlusToken */, "--": 45 /* MinusMinusToken */, "<<": 46 /* LessThanLessThanToken */, "</": 29 /* LessThanSlashToken */, ">>": 47 /* GreaterThanGreaterThanToken */, ">>>": 48 /* GreaterThanGreaterThanGreaterThanToken */, "&": 49 /* AmpersandToken */, "|": 50 /* BarToken */, "^": 51 /* CaretToken */, "!": 52 /* ExclamationToken */, "~": 53 /* TildeToken */, "&&": 54 /* AmpersandAmpersandToken */, "||": 55 /* BarBarToken */, "?": 56 /* QuestionToken */, ":": 57 /* ColonToken */, "=": 59 /* EqualsToken */, "+=": 60 /* PlusEqualsToken */, "-=": 61 /* MinusEqualsToken */, "*=": 62 /* AsteriskEqualsToken */, "**=": 63 /* AsteriskAsteriskEqualsToken */, "/=": 64 /* SlashEqualsToken */, "%=": 65 /* PercentEqualsToken */, "<<=": 66 /* LessThanLessThanEqualsToken */, ">>=": 67 /* GreaterThanGreaterThanEqualsToken */, ">>>=": 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */, "&=": 69 /* AmpersandEqualsToken */, "|=": 70 /* BarEqualsToken */, "^=": 71 /* CaretEqualsToken */, "@": 58 /* AtToken */ }));
+ var textToToken = ts.createMapFromTemplate(__assign({}, textToKeywordObj, { "{": 18 /* OpenBraceToken */, "}": 19 /* CloseBraceToken */, "(": 20 /* OpenParenToken */, ")": 21 /* CloseParenToken */, "[": 22 /* OpenBracketToken */, "]": 23 /* CloseBracketToken */, ".": 24 /* DotToken */, "...": 25 /* DotDotDotToken */, ";": 26 /* SemicolonToken */, ",": 27 /* CommaToken */, "<": 28 /* LessThanToken */, ">": 30 /* GreaterThanToken */, "<=": 31 /* LessThanEqualsToken */, ">=": 32 /* GreaterThanEqualsToken */, "==": 33 /* EqualsEqualsToken */, "!=": 34 /* ExclamationEqualsToken */, "===": 35 /* EqualsEqualsEqualsToken */, "!==": 36 /* ExclamationEqualsEqualsToken */, "=>": 37 /* EqualsGreaterThanToken */, "+": 38 /* PlusToken */, "-": 39 /* MinusToken */, "**": 41 /* AsteriskAsteriskToken */, "*": 40 /* AsteriskToken */, "/": 42 /* SlashToken */, "%": 43 /* PercentToken */, "++": 44 /* PlusPlusToken */, "--": 45 /* MinusMinusToken */, "<<": 46 /* LessThanLessThanToken */, "</": 29 /* LessThanSlashToken */, ">>": 47 /* GreaterThanGreaterThanToken */, ">>>": 48 /* GreaterThanGreaterThanGreaterThanToken */, "&": 49 /* AmpersandToken */, "|": 50 /* BarToken */, "^": 51 /* CaretToken */, "!": 52 /* ExclamationToken */, "~": 53 /* TildeToken */, "&&": 54 /* AmpersandAmpersandToken */, "||": 55 /* BarBarToken */, "?": 56 /* QuestionToken */, ":": 57 /* ColonToken */, "=": 60 /* EqualsToken */, "+=": 61 /* PlusEqualsToken */, "-=": 62 /* MinusEqualsToken */, "*=": 63 /* AsteriskEqualsToken */, "**=": 64 /* AsteriskAsteriskEqualsToken */, "/=": 65 /* SlashEqualsToken */, "%=": 66 /* PercentEqualsToken */, "<<=": 67 /* LessThanLessThanEqualsToken */, ">>=": 68 /* GreaterThanGreaterThanEqualsToken */, ">>>=": 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */, "&=": 70 /* AmpersandEqualsToken */, "|=": 71 /* BarEqualsToken */, "^=": 72 /* CaretEqualsToken */, "@": 58 /* AtToken */ }));
/*
As per ECMAScript Language Specification 3th Edition, Section 7.6: Identifiers
IdentifierStart ::
@@ -7097,8 +7275,8 @@
getTokenValue: function () { return tokenValue; },
hasExtendedUnicodeEscape: function () { return (tokenFlags & 8 /* ExtendedUnicodeEscape */) !== 0; },
hasPrecedingLineBreak: function () { return (tokenFlags & 1 /* PrecedingLineBreak */) !== 0; },
- isIdentifier: function () { return token === 72 /* Identifier */ || token > 108 /* LastReservedWord */; },
- isReservedWord: function () { return token >= 73 /* FirstReservedWord */ && token <= 108 /* LastReservedWord */; },
+ isIdentifier: function () { return token === 73 /* Identifier */ || token > 109 /* LastReservedWord */; },
+ isReservedWord: function () { return token >= 74 /* FirstReservedWord */ && token <= 109 /* LastReservedWord */; },
isUnterminated: function () { return (tokenFlags & 4 /* Unterminated */) !== 0; },
getTokenFlags: function () { return tokenFlags; },
reScanGreaterToken: reScanGreaterToken,
@@ -7109,7 +7287,7 @@
reScanJsxToken: reScanJsxToken,
reScanLessThanToken: reScanLessThanToken,
scanJsxToken: scanJsxToken,
- scanJSDocToken: scanJSDocToken,
+ scanJsDocToken: scanJsDocToken,
scan: scan,
getText: getText,
setText: setText,
@@ -7549,7 +7727,7 @@
}
}
}
- return token = 72 /* Identifier */;
+ return token = 73 /* Identifier */;
}
function scanBinaryOrOctalDigits(base) {
var value = "";
@@ -7698,7 +7876,7 @@
return token = scanTemplateAndSetTokenValue();
case 37 /* percent */:
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 65 /* PercentEqualsToken */;
+ return pos += 2, token = 66 /* PercentEqualsToken */;
}
pos++;
return token = 43 /* PercentToken */;
@@ -7707,7 +7885,7 @@
return pos += 2, token = 54 /* AmpersandAmpersandToken */;
}
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 69 /* AmpersandEqualsToken */;
+ return pos += 2, token = 70 /* AmpersandEqualsToken */;
}
pos++;
return token = 49 /* AmpersandToken */;
@@ -7719,11 +7897,11 @@
return token = 21 /* CloseParenToken */;
case 42 /* asterisk */:
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 62 /* AsteriskEqualsToken */;
+ return pos += 2, token = 63 /* AsteriskEqualsToken */;
}
if (text.charCodeAt(pos + 1) === 42 /* asterisk */) {
if (text.charCodeAt(pos + 2) === 61 /* equals */) {
- return pos += 3, token = 63 /* AsteriskAsteriskEqualsToken */;
+ return pos += 3, token = 64 /* AsteriskAsteriskEqualsToken */;
}
return pos += 2, token = 41 /* AsteriskAsteriskToken */;
}
@@ -7739,7 +7917,7 @@
return pos += 2, token = 44 /* PlusPlusToken */;
}
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 60 /* PlusEqualsToken */;
+ return pos += 2, token = 61 /* PlusEqualsToken */;
}
pos++;
return token = 38 /* PlusToken */;
@@ -7751,7 +7929,7 @@
return pos += 2, token = 45 /* MinusMinusToken */;
}
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 61 /* MinusEqualsToken */;
+ return pos += 2, token = 62 /* MinusEqualsToken */;
}
pos++;
return token = 39 /* MinusToken */;
@@ -7815,7 +7993,7 @@
}
}
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 64 /* SlashEqualsToken */;
+ return pos += 2, token = 65 /* SlashEqualsToken */;
}
pos++;
return token = 42 /* SlashToken */;
@@ -7892,7 +8070,7 @@
}
if (text.charCodeAt(pos + 1) === 60 /* lessThan */) {
if (text.charCodeAt(pos + 2) === 61 /* equals */) {
- return pos += 3, token = 66 /* LessThanLessThanEqualsToken */;
+ return pos += 3, token = 67 /* LessThanLessThanEqualsToken */;
}
return pos += 2, token = 46 /* LessThanLessThanToken */;
}
@@ -7926,7 +8104,7 @@
return pos += 2, token = 37 /* EqualsGreaterThanToken */;
}
pos++;
- return token = 59 /* EqualsToken */;
+ return token = 60 /* EqualsToken */;
case 62 /* greaterThan */:
if (isConflictMarkerTrivia(text, pos)) {
pos = scanConflictMarkerTrivia(text, pos, error);
@@ -7950,7 +8128,7 @@
return token = 23 /* CloseBracketToken */;
case 94 /* caret */:
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 71 /* CaretEqualsToken */;
+ return pos += 2, token = 72 /* CaretEqualsToken */;
}
pos++;
return token = 51 /* CaretToken */;
@@ -7971,7 +8149,7 @@
return pos += 2, token = 55 /* BarBarToken */;
}
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 70 /* BarEqualsToken */;
+ return pos += 2, token = 71 /* BarEqualsToken */;
}
pos++;
return token = 50 /* BarToken */;
@@ -8025,12 +8203,12 @@
if (text.charCodeAt(pos) === 62 /* greaterThan */) {
if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) {
if (text.charCodeAt(pos + 2) === 61 /* equals */) {
- return pos += 3, token = 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */;
+ return pos += 3, token = 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */;
}
return pos += 2, token = 48 /* GreaterThanGreaterThanGreaterThanToken */;
}
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 67 /* GreaterThanGreaterThanEqualsToken */;
+ return pos += 2, token = 68 /* GreaterThanGreaterThanEqualsToken */;
}
pos++;
return token = 47 /* GreaterThanGreaterThanToken */;
@@ -8043,7 +8221,7 @@
return token;
}
function reScanSlashToken() {
- if (token === 42 /* SlashToken */ || token === 64 /* SlashEqualsToken */) {
+ if (token === 42 /* SlashToken */ || token === 65 /* SlashEqualsToken */) {
var p = tokenPos + 1;
var inEscape = false;
var inCharacterClass = false;
@@ -8192,7 +8370,7 @@
return scan();
}
}
- function scanJSDocToken() {
+ function scanJsDocToken() {
startPos = tokenPos = pos;
tokenFlags = 0;
if (pos >= end) {
@@ -8228,21 +8406,16 @@
case 60 /* lessThan */:
return token = 28 /* LessThanToken */;
case 61 /* equals */:
- return token = 59 /* EqualsToken */;
+ return token = 60 /* EqualsToken */;
case 44 /* comma */:
return token = 27 /* CommaToken */;
case 46 /* dot */:
return token = 24 /* DotToken */;
case 96 /* backtick */:
- while (pos < end && text.charCodeAt(pos) !== 96 /* backtick */) {
- pos++;
+ return token = 59 /* BacktickToken */;
}
- tokenValue = text.substring(tokenPos + 1, pos);
- pos++;
- return token = 14 /* NoSubstitutionTemplateLiteral */;
- }
- if (isIdentifierStart(ch, 7 /* Latest */)) {
- while (isIdentifierPart(text.charCodeAt(pos), 7 /* Latest */) && pos < end) {
+ if (isIdentifierStart(ch, 8 /* Latest */)) {
+ while (isIdentifierPart(text.charCodeAt(pos), 8 /* Latest */) && pos < end) {
pos++;
}
tokenValue = text.substring(tokenPos, pos);
@@ -8427,11 +8600,16 @@
}
ts.toPath = toPath;
function changesAffectModuleResolution(oldOptions, newOptions) {
- return oldOptions.configFilePath !== newOptions.configFilePath || ts.moduleResolutionOptionDeclarations.some(function (o) {
+ return oldOptions.configFilePath !== newOptions.configFilePath ||
+ optionsHaveModuleResolutionChanges(oldOptions, newOptions);
+ }
+ ts.changesAffectModuleResolution = changesAffectModuleResolution;
+ function optionsHaveModuleResolutionChanges(oldOptions, newOptions) {
+ return ts.moduleResolutionOptionDeclarations.some(function (o) {
return !ts.isJsonEqual(ts.getCompilerOptionValue(oldOptions, o), ts.getCompilerOptionValue(newOptions, o));
});
}
- ts.changesAffectModuleResolution = changesAffectModuleResolution;
+ ts.optionsHaveModuleResolutionChanges = optionsHaveModuleResolutionChanges;
function findAncestor(node, callback) {
while (node) {
var result = callback(node);
@@ -8600,7 +8778,7 @@
}
}
function getSourceFileOfNode(node) {
- while (node && node.kind !== 284 /* SourceFile */) {
+ while (node && node.kind !== 285 /* SourceFile */) {
node = node.parent;
}
return node;
@@ -8608,11 +8786,11 @@
ts.getSourceFileOfNode = getSourceFileOfNode;
function isStatementWithLocals(node) {
switch (node.kind) {
- case 218 /* Block */:
- case 246 /* CaseBlock */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 219 /* Block */:
+ case 247 /* CaseBlock */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
return true;
}
return false;
@@ -8780,7 +8958,7 @@
// the syntax list itself considers them as normal trivia. Therefore if we simply skip
// trivia for the list, we may have skipped the JSDocComment as well. So we should process its
// first child to determine the actual position of its first token.
- if (node.kind === 311 /* SyntaxList */ && node._children.length > 0) {
+ if (node.kind === 312 /* SyntaxList */ && node._children.length > 0) {
return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc);
}
return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos);
@@ -8799,7 +8977,7 @@
}
ts.getSourceTextOfNodeFromSourceFile = getSourceTextOfNodeFromSourceFile;
function isJSDocTypeExpressionOrChild(node) {
- return node.kind === 288 /* JSDocTypeExpression */ || (node.parent && isJSDocTypeExpressionOrChild(node.parent));
+ return node.kind === 289 /* JSDocTypeExpression */ || (node.parent && isJSDocTypeExpressionOrChild(node.parent));
}
function getTextOfNodeFromSourceText(sourceText, node, includeTrivia) {
if (includeTrivia === void 0) { includeTrivia = false; }
@@ -8891,7 +9069,7 @@
ts.isBlockOrCatchScoped = isBlockOrCatchScoped;
function isCatchClauseVariableDeclarationOrBindingElement(declaration) {
var node = getRootDeclaration(declaration);
- return node.kind === 237 /* VariableDeclaration */ && node.parent.kind === 274 /* CatchClause */;
+ return node.kind === 238 /* VariableDeclaration */ && node.parent.kind === 275 /* CatchClause */;
}
ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement;
function isAmbientModule(node) {
@@ -8923,11 +9101,11 @@
ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol;
function isShorthandAmbientModule(node) {
// The only kind of module that can be missing a body is a shorthand ambient module.
- return node && node.kind === 244 /* ModuleDeclaration */ && (!node.body);
+ return node && node.kind === 245 /* ModuleDeclaration */ && (!node.body);
}
function isBlockScopedContainerTopLevel(node) {
- return node.kind === 284 /* SourceFile */ ||
- node.kind === 244 /* ModuleDeclaration */ ||
+ return node.kind === 285 /* SourceFile */ ||
+ node.kind === 245 /* ModuleDeclaration */ ||
ts.isFunctionLike(node);
}
ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel;
@@ -8944,9 +9122,9 @@
// - defined in the top level scope and source file is an external module
// - defined inside ambient module declaration located in the top level scope and source file not an external module
switch (node.parent.kind) {
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return ts.isExternalModule(node.parent);
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
return isAmbientModule(node.parent.parent) && ts.isSourceFile(node.parent.parent.parent) && !ts.isExternalModule(node.parent.parent.parent);
}
return false;
@@ -8962,22 +9140,22 @@
ts.isEffectiveExternalModule = isEffectiveExternalModule;
function isBlockScope(node, parentNode) {
switch (node.kind) {
- case 284 /* SourceFile */:
- case 246 /* CaseBlock */:
- case 274 /* CatchClause */:
- case 244 /* ModuleDeclaration */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 157 /* Constructor */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 285 /* SourceFile */:
+ case 247 /* CaseBlock */:
+ case 275 /* CatchClause */:
+ case 245 /* ModuleDeclaration */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 158 /* Constructor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return true;
- case 218 /* Block */:
+ case 219 /* Block */:
// function block is not considered block-scope container
// see comment in binder.ts: bind(...), case for SyntaxKind.Block
return !ts.isFunctionLike(parentNode);
@@ -8987,9 +9165,9 @@
ts.isBlockScope = isBlockScope;
function isDeclarationWithTypeParameters(node) {
switch (node.kind) {
- case 302 /* JSDocCallbackTag */:
- case 309 /* JSDocTypedefTag */:
- case 298 /* JSDocSignature */:
+ case 303 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 299 /* JSDocSignature */:
return true;
default:
ts.assertType(node);
@@ -8999,25 +9177,25 @@
ts.isDeclarationWithTypeParameters = isDeclarationWithTypeParameters;
function isDeclarationWithTypeParameterChildren(node) {
switch (node.kind) {
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 155 /* MethodSignature */:
- case 162 /* IndexSignature */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 294 /* JSDocFunctionType */:
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 308 /* JSDocTemplateTag */:
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 156 /* MethodSignature */:
+ case 163 /* IndexSignature */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 295 /* JSDocFunctionType */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 309 /* JSDocTemplateTag */:
+ case 240 /* FunctionDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return true;
default:
ts.assertType(node);
@@ -9027,8 +9205,8 @@
ts.isDeclarationWithTypeParameterChildren = isDeclarationWithTypeParameterChildren;
function isAnyImportSyntax(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return true;
default:
return false;
@@ -9037,15 +9215,15 @@
ts.isAnyImportSyntax = isAnyImportSyntax;
function isLateVisibilityPaintedStatement(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
- case 219 /* VariableStatement */:
- case 240 /* ClassDeclaration */:
- case 239 /* FunctionDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 220 /* VariableStatement */:
+ case 241 /* ClassDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
return true;
default:
return false;
@@ -9075,13 +9253,13 @@
ts.getNameFromIndexInfo = getNameFromIndexInfo;
function getTextOfPropertyName(name) {
switch (name.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return name.escapedText;
case 10 /* StringLiteral */:
case 8 /* NumericLiteral */:
case 14 /* NoSubstitutionTemplateLiteral */:
return ts.escapeLeadingUnderscores(name.text);
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
if (isStringOrNumericLiteralLike(name.expression))
return ts.escapeLeadingUnderscores(name.expression.text);
return ts.Debug.fail("Text of property name cannot be read from non-literal-valued ComputedPropertyNames");
@@ -9092,11 +9270,11 @@
ts.getTextOfPropertyName = getTextOfPropertyName;
function entityNameToString(name) {
switch (name.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return getFullWidth(name) === 0 ? ts.idText(name) : getTextOfNode(name);
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
return entityNameToString(name.left) + "." + entityNameToString(name.right);
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return entityNameToString(name.expression) + "." + entityNameToString(name.name);
default:
throw ts.Debug.assertNever(name);
@@ -9141,7 +9319,7 @@
ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition;
function getErrorSpanForArrowFunction(sourceFile, node) {
var pos = ts.skipTrivia(sourceFile.text, node.pos);
- if (node.body && node.body.kind === 218 /* Block */) {
+ if (node.body && node.body.kind === 219 /* Block */) {
var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line;
var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line;
if (startLine < endLine) {
@@ -9155,7 +9333,7 @@
function getErrorSpanForNode(sourceFile, node) {
var errorNode = node;
switch (node.kind) {
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
var pos_1 = ts.skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false);
if (pos_1 === sourceFile.text.length) {
// file is empty - return span for the beginning of the file
@@ -9164,25 +9342,25 @@
return getSpanOfTokenAtPosition(sourceFile, pos_1);
// This list is a work in progress. Add missing node kinds to improve their error
// spans.
- case 237 /* VariableDeclaration */:
- case 186 /* BindingElement */:
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 243 /* EnumDeclaration */:
- case 278 /* EnumMember */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 242 /* TypeAliasDeclaration */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 238 /* VariableDeclaration */:
+ case 187 /* BindingElement */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 279 /* EnumMember */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 243 /* TypeAliasDeclaration */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
errorNode = node.name;
break;
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return getErrorSpanForArrowFunction(sourceFile, node);
}
if (errorNode === undefined) {
@@ -9231,11 +9409,11 @@
}
ts.isLet = isLet;
function isSuperCall(n) {
- return n.kind === 191 /* CallExpression */ && n.expression.kind === 98 /* SuperKeyword */;
+ return n.kind === 192 /* CallExpression */ && n.expression.kind === 99 /* SuperKeyword */;
}
ts.isSuperCall = isSuperCall;
function isImportCall(n) {
- return n.kind === 191 /* CallExpression */ && n.expression.kind === 92 /* ImportKeyword */;
+ return n.kind === 192 /* CallExpression */ && n.expression.kind === 93 /* ImportKeyword */;
}
ts.isImportCall = isImportCall;
function isLiteralImportTypeNode(n) {
@@ -9243,7 +9421,7 @@
}
ts.isLiteralImportTypeNode = isLiteralImportTypeNode;
function isPrologueDirective(node) {
- return node.kind === 221 /* ExpressionStatement */
+ return node.kind === 222 /* ExpressionStatement */
&& node.expression.kind === 10 /* StringLiteral */;
}
ts.isPrologueDirective = isPrologueDirective;
@@ -9252,11 +9430,11 @@
}
ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode;
function getJSDocCommentRanges(node, text) {
- var commentRanges = (node.kind === 151 /* Parameter */ ||
- node.kind === 150 /* TypeParameter */ ||
- node.kind === 196 /* FunctionExpression */ ||
- node.kind === 197 /* ArrowFunction */ ||
- node.kind === 195 /* ParenthesizedExpression */) ?
+ var commentRanges = (node.kind === 152 /* Parameter */ ||
+ node.kind === 151 /* TypeParameter */ ||
+ node.kind === 197 /* FunctionExpression */ ||
+ node.kind === 198 /* ArrowFunction */ ||
+ node.kind === 196 /* ParenthesizedExpression */) ?
ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) :
ts.getLeadingCommentRanges(text, node.pos);
// True if the comment starts with '/**' but not if it is '/**/'
@@ -9272,48 +9450,48 @@
ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*<amd-dependency\s+path\s*=\s*)('|")(.+?)\2.*?\/>/;
var defaultLibReferenceRegEx = /^(\/\/\/\s*<reference\s+no-default-lib\s*=\s*)('|")(.+?)\2\s*\/>/;
function isPartOfTypeNode(node) {
- if (163 /* FirstTypeNode */ <= node.kind && node.kind <= 183 /* LastTypeNode */) {
+ if (164 /* FirstTypeNode */ <= node.kind && node.kind <= 184 /* LastTypeNode */) {
return true;
}
switch (node.kind) {
- case 120 /* AnyKeyword */:
- case 143 /* UnknownKeyword */:
- case 135 /* NumberKeyword */:
- case 146 /* BigIntKeyword */:
- case 138 /* StringKeyword */:
- case 123 /* BooleanKeyword */:
- case 139 /* SymbolKeyword */:
- case 136 /* ObjectKeyword */:
- case 141 /* UndefinedKeyword */:
- case 132 /* NeverKeyword */:
- return true;
- case 106 /* VoidKeyword */:
- return node.parent.kind !== 200 /* VoidExpression */;
- case 211 /* ExpressionWithTypeArguments */:
+ case 121 /* AnyKeyword */:
+ case 144 /* UnknownKeyword */:
+ case 136 /* NumberKeyword */:
+ case 147 /* BigIntKeyword */:
+ case 139 /* StringKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 137 /* ObjectKeyword */:
+ case 142 /* UndefinedKeyword */:
+ case 133 /* NeverKeyword */:
+ return true;
+ case 107 /* VoidKeyword */:
+ return node.parent.kind !== 201 /* VoidExpression */;
+ case 212 /* ExpressionWithTypeArguments */:
return !isExpressionWithTypeArgumentsInClassExtendsClause(node);
- case 150 /* TypeParameter */:
- return node.parent.kind === 181 /* MappedType */ || node.parent.kind === 176 /* InferType */;
+ case 151 /* TypeParameter */:
+ return node.parent.kind === 182 /* MappedType */ || node.parent.kind === 177 /* InferType */;
// Identifiers and qualified names may be type nodes, depending on their context. Climb
// above them to find the lowest container
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
// If the identifier is the RHS of a qualified name, then it's a type iff its parent is.
- if (node.parent.kind === 148 /* QualifiedName */ && node.parent.right === node) {
+ if (node.parent.kind === 149 /* QualifiedName */ && node.parent.right === node) {
node = node.parent;
}
- else if (node.parent.kind === 189 /* PropertyAccessExpression */ && node.parent.name === node) {
+ else if (node.parent.kind === 190 /* PropertyAccessExpression */ && node.parent.name === node) {
node = node.parent;
}
// At this point, node is either a qualified name or an identifier
- ts.Debug.assert(node.kind === 72 /* Identifier */ || node.kind === 148 /* QualifiedName */ || node.kind === 189 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'.");
+ ts.Debug.assert(node.kind === 73 /* Identifier */ || node.kind === 149 /* QualifiedName */ || node.kind === 190 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'.");
// falls through
- case 148 /* QualifiedName */:
- case 189 /* PropertyAccessExpression */:
- case 100 /* ThisKeyword */: {
+ case 149 /* QualifiedName */:
+ case 190 /* PropertyAccessExpression */:
+ case 101 /* ThisKeyword */: {
var parent = node.parent;
- if (parent.kind === 167 /* TypeQuery */) {
+ if (parent.kind === 168 /* TypeQuery */) {
return false;
}
- if (parent.kind === 183 /* ImportType */) {
+ if (parent.kind === 184 /* ImportType */) {
return !parent.isTypeOf;
}
// Do not recursively call isPartOfTypeNode on the parent. In the example:
@@ -9322,40 +9500,40 @@
//
// Calling isPartOfTypeNode would consider the qualified name A.B a type node.
// Only C and A.B.C are type nodes.
- if (163 /* FirstTypeNode */ <= parent.kind && parent.kind <= 183 /* LastTypeNode */) {
+ if (164 /* FirstTypeNode */ <= parent.kind && parent.kind <= 184 /* LastTypeNode */) {
return true;
}
switch (parent.kind) {
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return !isExpressionWithTypeArgumentsInClassExtendsClause(parent);
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
return node === parent.constraint;
- case 308 /* JSDocTemplateTag */:
+ case 309 /* JSDocTemplateTag */:
return node === parent.constraint;
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 151 /* Parameter */:
- case 237 /* VariableDeclaration */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 152 /* Parameter */:
+ case 238 /* VariableDeclaration */:
return node === parent.type;
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 157 /* Constructor */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 158 /* Constructor */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return node === parent.type;
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
return node === parent.type;
- case 194 /* TypeAssertionExpression */:
+ case 195 /* TypeAssertionExpression */:
return node === parent.type;
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
return ts.contains(parent.typeArguments, node);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
// TODO (drosen): TaggedTemplateExpressions may eventually support type arguments.
return false;
}
@@ -9380,23 +9558,23 @@
return traverse(body);
function traverse(node) {
switch (node.kind) {
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return visitor(node);
- case 246 /* CaseBlock */:
- case 218 /* Block */:
- case 222 /* IfStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 231 /* WithStatement */:
- case 232 /* SwitchStatement */:
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
- case 233 /* LabeledStatement */:
- case 235 /* TryStatement */:
- case 274 /* CatchClause */:
+ case 247 /* CaseBlock */:
+ case 219 /* Block */:
+ case 223 /* IfStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 232 /* WithStatement */:
+ case 233 /* SwitchStatement */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
+ case 234 /* LabeledStatement */:
+ case 236 /* TryStatement */:
+ case 275 /* CatchClause */:
return ts.forEachChild(node, traverse);
}
}
@@ -9406,26 +9584,26 @@
return traverse(body);
function traverse(node) {
switch (node.kind) {
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
visitor(node);
var operand = node.expression;
if (operand) {
traverse(operand);
}
return;
- case 243 /* EnumDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 244 /* EnumDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
// These are not allowed inside a generator now, but eventually they may be allowed
// as local types. Regardless, any yield statements contained within them should be
// skipped in this traversal.
return;
default:
if (ts.isFunctionLike(node)) {
- if (node.name && node.name.kind === 149 /* ComputedPropertyName */) {
+ if (node.name && node.name.kind === 150 /* ComputedPropertyName */) {
// Note that we will not include methods/accessors of a class because they would require
// first descending into the class. This is by design.
traverse(node.name.expression);
@@ -9448,10 +9626,10 @@
* @param node The type node.
*/
function getRestParameterElementType(node) {
- if (node && node.kind === 169 /* ArrayType */) {
+ if (node && node.kind === 170 /* ArrayType */) {
return node.elementType;
}
- else if (node && node.kind === 164 /* TypeReference */) {
+ else if (node && node.kind === 165 /* TypeReference */) {
return ts.singleOrUndefined(node.typeArguments);
}
else {
@@ -9461,12 +9639,12 @@
ts.getRestParameterElementType = getRestParameterElementType;
function getMembersOfDeclaration(node) {
switch (node.kind) {
- case 241 /* InterfaceDeclaration */:
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 168 /* TypeLiteral */:
+ case 242 /* InterfaceDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 169 /* TypeLiteral */:
return node.members;
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return node.properties;
}
}
@@ -9474,14 +9652,14 @@
function isVariableLike(node) {
if (node) {
switch (node.kind) {
- case 186 /* BindingElement */:
- case 278 /* EnumMember */:
- case 151 /* Parameter */:
- case 275 /* PropertyAssignment */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 276 /* ShorthandPropertyAssignment */:
- case 237 /* VariableDeclaration */:
+ case 187 /* BindingElement */:
+ case 279 /* EnumMember */:
+ case 152 /* Parameter */:
+ case 276 /* PropertyAssignment */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 277 /* ShorthandPropertyAssignment */:
+ case 238 /* VariableDeclaration */:
return true;
}
}
@@ -9493,8 +9671,8 @@
}
ts.isVariableLikeOrAccessor = isVariableLikeOrAccessor;
function isVariableDeclarationInVariableStatement(node) {
- return node.parent.kind === 238 /* VariableDeclarationList */
- && node.parent.parent.kind === 219 /* VariableStatement */;
+ return node.parent.kind === 239 /* VariableDeclarationList */
+ && node.parent.parent.kind === 220 /* VariableStatement */;
}
ts.isVariableDeclarationInVariableStatement = isVariableDeclarationInVariableStatement;
function isValidESSymbolDeclaration(node) {
@@ -9505,13 +9683,13 @@
ts.isValidESSymbolDeclaration = isValidESSymbolDeclaration;
function introducesArgumentsExoticObject(node) {
switch (node.kind) {
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
return true;
}
return false;
@@ -9522,7 +9700,7 @@
if (beforeUnwrapLabelCallback) {
beforeUnwrapLabelCallback(node);
}
- if (node.statement.kind !== 233 /* LabeledStatement */) {
+ if (node.statement.kind !== 234 /* LabeledStatement */) {
return node.statement;
}
node = node.statement;
@@ -9530,17 +9708,17 @@
}
ts.unwrapInnermostStatementOfLabel = unwrapInnermostStatementOfLabel;
function isFunctionBlock(node) {
- return node && node.kind === 218 /* Block */ && ts.isFunctionLike(node.parent);
+ return node && node.kind === 219 /* Block */ && ts.isFunctionLike(node.parent);
}
ts.isFunctionBlock = isFunctionBlock;
function isObjectLiteralMethod(node) {
- return node && node.kind === 156 /* MethodDeclaration */ && node.parent.kind === 188 /* ObjectLiteralExpression */;
+ return node && node.kind === 157 /* MethodDeclaration */ && node.parent.kind === 189 /* ObjectLiteralExpression */;
}
ts.isObjectLiteralMethod = isObjectLiteralMethod;
function isObjectLiteralOrClassExpressionMethod(node) {
- return node.kind === 156 /* MethodDeclaration */ &&
- (node.parent.kind === 188 /* ObjectLiteralExpression */ ||
- node.parent.kind === 209 /* ClassExpression */);
+ return node.kind === 157 /* MethodDeclaration */ &&
+ (node.parent.kind === 189 /* ObjectLiteralExpression */ ||
+ node.parent.kind === 210 /* ClassExpression */);
}
ts.isObjectLiteralOrClassExpressionMethod = isObjectLiteralOrClassExpressionMethod;
function isIdentifierTypePredicate(predicate) {
@@ -9553,7 +9731,7 @@
ts.isThisTypePredicate = isThisTypePredicate;
function getPropertyAssignment(objectLiteral, key, key2) {
return objectLiteral.properties.filter(function (property) {
- if (property.kind === 275 /* PropertyAssignment */) {
+ if (property.kind === 276 /* PropertyAssignment */) {
var propName = getTextOfPropertyName(property.name);
return key === propName || (!!key2 && key2 === propName);
}
@@ -9585,19 +9763,23 @@
return findAncestor(node.parent, ts.isFunctionLike);
}
ts.getContainingFunction = getContainingFunction;
+ function getContainingFunctionDeclaration(node) {
+ return findAncestor(node.parent, ts.isFunctionLikeDeclaration);
+ }
+ ts.getContainingFunctionDeclaration = getContainingFunctionDeclaration;
function getContainingClass(node) {
return findAncestor(node.parent, ts.isClassLike);
}
ts.getContainingClass = getContainingClass;
function getThisContainer(node, includeArrowFunctions) {
- ts.Debug.assert(node.kind !== 284 /* SourceFile */);
+ ts.Debug.assert(node.kind !== 285 /* SourceFile */);
while (true) {
node = node.parent;
if (!node) {
return ts.Debug.fail(); // If we never pass in a SourceFile, this should be unreachable, since we'll stop when we reach that.
}
switch (node.kind) {
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
// If the grandparent node is an object literal (as opposed to a class),
// then the computed property is not a 'this' container.
// A computed property name in a class needs to be a this container
@@ -9612,9 +9794,9 @@
// the *body* of the container.
node = node.parent;
break;
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
// Decorators are always applied outside of the body of a class or method.
- if (node.parent.kind === 151 /* Parameter */ && ts.isClassElement(node.parent.parent)) {
+ if (node.parent.kind === 152 /* Parameter */ && ts.isClassElement(node.parent.parent)) {
// If the decorator's parent is a Parameter, we resolve the this container from
// the grandparent class declaration.
node = node.parent.parent;
@@ -9625,26 +9807,26 @@
node = node.parent;
}
break;
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
if (!includeArrowFunctions) {
continue;
}
// falls through
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 244 /* ModuleDeclaration */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
- case 243 /* EnumDeclaration */:
- case 284 /* SourceFile */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 245 /* ModuleDeclaration */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
+ case 244 /* EnumDeclaration */:
+ case 285 /* SourceFile */:
return node;
}
}
@@ -9654,9 +9836,9 @@
var container = getThisContainer(node, /*includeArrowFunctions*/ false);
if (container) {
switch (container.kind) {
- case 157 /* Constructor */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
+ case 158 /* Constructor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
return container;
}
}
@@ -9678,27 +9860,27 @@
return node;
}
switch (node.kind) {
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
node = node.parent;
break;
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
if (!stopOnFunctions) {
continue;
}
// falls through
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return node;
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
// Decorators are always applied outside of the body of a class or method.
- if (node.parent.kind === 151 /* Parameter */ && ts.isClassElement(node.parent.parent)) {
+ if (node.parent.kind === 152 /* Parameter */ && ts.isClassElement(node.parent.parent)) {
// If the decorator's parent is a Parameter, we resolve the this container from
// the grandparent class declaration.
node = node.parent.parent;
@@ -9714,21 +9896,21 @@
}
ts.getSuperContainer = getSuperContainer;
function getImmediatelyInvokedFunctionExpression(func) {
- if (func.kind === 196 /* FunctionExpression */ || func.kind === 197 /* ArrowFunction */) {
+ if (func.kind === 197 /* FunctionExpression */ || func.kind === 198 /* ArrowFunction */) {
var prev = func;
var parent = func.parent;
- while (parent.kind === 195 /* ParenthesizedExpression */) {
+ while (parent.kind === 196 /* ParenthesizedExpression */) {
prev = parent;
parent = parent.parent;
}
- if (parent.kind === 191 /* CallExpression */ && parent.expression === prev) {
+ if (parent.kind === 192 /* CallExpression */ && parent.expression === prev) {
return parent;
}
}
}
ts.getImmediatelyInvokedFunctionExpression = getImmediatelyInvokedFunctionExpression;
function isSuperOrSuperProperty(node) {
- return node.kind === 98 /* SuperKeyword */
+ return node.kind === 99 /* SuperKeyword */
|| isSuperProperty(node);
}
ts.isSuperOrSuperProperty = isSuperOrSuperProperty;
@@ -9737,8 +9919,8 @@
*/
function isSuperProperty(node) {
var kind = node.kind;
- return (kind === 189 /* PropertyAccessExpression */ || kind === 190 /* ElementAccessExpression */)
- && node.expression.kind === 98 /* SuperKeyword */;
+ return (kind === 190 /* PropertyAccessExpression */ || kind === 191 /* ElementAccessExpression */)
+ && node.expression.kind === 99 /* SuperKeyword */;
}
ts.isSuperProperty = isSuperProperty;
/**
@@ -9746,20 +9928,20 @@
*/
function isThisProperty(node) {
var kind = node.kind;
- return (kind === 189 /* PropertyAccessExpression */ || kind === 190 /* ElementAccessExpression */)
- && node.expression.kind === 100 /* ThisKeyword */;
+ return (kind === 190 /* PropertyAccessExpression */ || kind === 191 /* ElementAccessExpression */)
+ && node.expression.kind === 101 /* ThisKeyword */;
}
ts.isThisProperty = isThisProperty;
function getEntityNameFromTypeNode(node) {
switch (node.kind) {
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return node.typeName;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return isEntityNameExpression(node.expression)
? node.expression
: undefined;
- case 72 /* Identifier */:
- case 148 /* QualifiedName */:
+ case 73 /* Identifier */:
+ case 149 /* QualifiedName */:
return node;
}
return undefined;
@@ -9767,10 +9949,10 @@
ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode;
function getInvokedExpression(node) {
switch (node.kind) {
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return node.tag;
- case 262 /* JsxOpeningElement */:
- case 261 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
+ case 262 /* JsxSelfClosingElement */:
return node.tagName;
default:
return node.expression;
@@ -9779,25 +9961,25 @@
ts.getInvokedExpression = getInvokedExpression;
function nodeCanBeDecorated(node, parent, grandparent) {
switch (node.kind) {
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
// classes are valid targets
return true;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
// property declarations are valid if their parent is a class declaration.
- return parent.kind === 240 /* ClassDeclaration */;
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 156 /* MethodDeclaration */:
+ return parent.kind === 241 /* ClassDeclaration */;
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
// if this method has a body and its parent is a class declaration, this is a valid target.
return node.body !== undefined
- && parent.kind === 240 /* ClassDeclaration */;
- case 151 /* Parameter */:
+ && parent.kind === 241 /* ClassDeclaration */;
+ case 152 /* Parameter */:
// if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target;
return parent.body !== undefined
- && (parent.kind === 157 /* Constructor */
- || parent.kind === 156 /* MethodDeclaration */
- || parent.kind === 159 /* SetAccessor */)
- && grandparent.kind === 240 /* ClassDeclaration */;
+ && (parent.kind === 158 /* Constructor */
+ || parent.kind === 157 /* MethodDeclaration */
+ || parent.kind === 160 /* SetAccessor */)
+ && grandparent.kind === 241 /* ClassDeclaration */;
}
return false;
}
@@ -9813,10 +9995,10 @@
ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated;
function childIsDecorated(node, parent) {
switch (node.kind) {
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return ts.some(node.members, function (m) { return nodeOrChildIsDecorated(m, node, parent); }); // TODO: GH#18217
- case 156 /* MethodDeclaration */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 160 /* SetAccessor */:
return ts.some(node.parameters, function (p) { return nodeIsDecorated(p, node, parent); }); // TODO: GH#18217
default:
return false;
@@ -9825,9 +10007,9 @@
ts.childIsDecorated = childIsDecorated;
function isJSXTagName(node) {
var parent = node.parent;
- if (parent.kind === 262 /* JsxOpeningElement */ ||
- parent.kind === 261 /* JsxSelfClosingElement */ ||
- parent.kind === 263 /* JsxClosingElement */) {
+ if (parent.kind === 263 /* JsxOpeningElement */ ||
+ parent.kind === 262 /* JsxSelfClosingElement */ ||
+ parent.kind === 264 /* JsxClosingElement */) {
return parent.tagName === node;
}
return false;
@@ -9835,57 +10017,57 @@
ts.isJSXTagName = isJSXTagName;
function isExpressionNode(node) {
switch (node.kind) {
- case 98 /* SuperKeyword */:
- case 96 /* NullKeyword */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
+ case 99 /* SuperKeyword */:
+ case 97 /* NullKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
case 13 /* RegularExpressionLiteral */:
- case 187 /* ArrayLiteralExpression */:
- case 188 /* ObjectLiteralExpression */:
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
- case 193 /* TaggedTemplateExpression */:
- case 212 /* AsExpression */:
- case 194 /* TypeAssertionExpression */:
- case 213 /* NonNullExpression */:
- case 195 /* ParenthesizedExpression */:
- case 196 /* FunctionExpression */:
- case 209 /* ClassExpression */:
- case 197 /* ArrowFunction */:
- case 200 /* VoidExpression */:
- case 198 /* DeleteExpression */:
- case 199 /* TypeOfExpression */:
- case 202 /* PrefixUnaryExpression */:
- case 203 /* PostfixUnaryExpression */:
- case 204 /* BinaryExpression */:
- case 205 /* ConditionalExpression */:
- case 208 /* SpreadElement */:
- case 206 /* TemplateExpression */:
+ case 188 /* ArrayLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
+ case 194 /* TaggedTemplateExpression */:
+ case 213 /* AsExpression */:
+ case 195 /* TypeAssertionExpression */:
+ case 214 /* NonNullExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 197 /* FunctionExpression */:
+ case 210 /* ClassExpression */:
+ case 198 /* ArrowFunction */:
+ case 201 /* VoidExpression */:
+ case 199 /* DeleteExpression */:
+ case 200 /* TypeOfExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
+ case 205 /* BinaryExpression */:
+ case 206 /* ConditionalExpression */:
+ case 209 /* SpreadElement */:
+ case 207 /* TemplateExpression */:
case 14 /* NoSubstitutionTemplateLiteral */:
- case 210 /* OmittedExpression */:
- case 260 /* JsxElement */:
- case 261 /* JsxSelfClosingElement */:
- case 264 /* JsxFragment */:
- case 207 /* YieldExpression */:
- case 201 /* AwaitExpression */:
- case 214 /* MetaProperty */:
+ case 211 /* OmittedExpression */:
+ case 261 /* JsxElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 265 /* JsxFragment */:
+ case 208 /* YieldExpression */:
+ case 202 /* AwaitExpression */:
+ case 215 /* MetaProperty */:
return true;
- case 148 /* QualifiedName */:
- while (node.parent.kind === 148 /* QualifiedName */) {
+ case 149 /* QualifiedName */:
+ while (node.parent.kind === 149 /* QualifiedName */) {
node = node.parent;
}
- return node.parent.kind === 167 /* TypeQuery */ || isJSXTagName(node);
- case 72 /* Identifier */:
- if (node.parent.kind === 167 /* TypeQuery */ || isJSXTagName(node)) {
+ return node.parent.kind === 168 /* TypeQuery */ || isJSXTagName(node);
+ case 73 /* Identifier */:
+ if (node.parent.kind === 168 /* TypeQuery */ || isJSXTagName(node)) {
return true;
}
// falls through
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
case 10 /* StringLiteral */:
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
return isInExpressionContext(node);
default:
return false;
@@ -9895,49 +10077,49 @@
function isInExpressionContext(node) {
var parent = node.parent;
switch (parent.kind) {
- case 237 /* VariableDeclaration */:
- case 151 /* Parameter */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 278 /* EnumMember */:
- case 275 /* PropertyAssignment */:
- case 186 /* BindingElement */:
+ case 238 /* VariableDeclaration */:
+ case 152 /* Parameter */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 279 /* EnumMember */:
+ case 276 /* PropertyAssignment */:
+ case 187 /* BindingElement */:
return parent.initializer === node;
- case 221 /* ExpressionStatement */:
- case 222 /* IfStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
- case 230 /* ReturnStatement */:
- case 231 /* WithStatement */:
- case 232 /* SwitchStatement */:
- case 271 /* CaseClause */:
- case 234 /* ThrowStatement */:
+ case 222 /* ExpressionStatement */:
+ case 223 /* IfStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
+ case 231 /* ReturnStatement */:
+ case 232 /* WithStatement */:
+ case 233 /* SwitchStatement */:
+ case 272 /* CaseClause */:
+ case 235 /* ThrowStatement */:
return parent.expression === node;
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
var forStatement = parent;
- return (forStatement.initializer === node && forStatement.initializer.kind !== 238 /* VariableDeclarationList */) ||
+ return (forStatement.initializer === node && forStatement.initializer.kind !== 239 /* VariableDeclarationList */) ||
forStatement.condition === node ||
forStatement.incrementor === node;
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
var forInStatement = parent;
- return (forInStatement.initializer === node && forInStatement.initializer.kind !== 238 /* VariableDeclarationList */) ||
+ return (forInStatement.initializer === node && forInStatement.initializer.kind !== 239 /* VariableDeclarationList */) ||
forInStatement.expression === node;
- case 194 /* TypeAssertionExpression */:
- case 212 /* AsExpression */:
+ case 195 /* TypeAssertionExpression */:
+ case 213 /* AsExpression */:
return node === parent.expression;
- case 216 /* TemplateSpan */:
+ case 217 /* TemplateSpan */:
return node === parent.expression;
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
return node === parent.expression;
- case 152 /* Decorator */:
- case 270 /* JsxExpression */:
- case 269 /* JsxSpreadAttribute */:
- case 277 /* SpreadAssignment */:
+ case 153 /* Decorator */:
+ case 271 /* JsxExpression */:
+ case 270 /* JsxSpreadAttribute */:
+ case 278 /* SpreadAssignment */:
return true;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return parent.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent);
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return parent.objectAssignmentInitializer === node;
default:
return isExpressionNode(parent);
@@ -9945,7 +10127,7 @@
}
ts.isInExpressionContext = isInExpressionContext;
function isExternalModuleImportEqualsDeclaration(node) {
- return node.kind === 248 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 259 /* ExternalModuleReference */;
+ return node.kind === 249 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 260 /* ExternalModuleReference */;
}
ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration;
function getExternalModuleImportEqualsDeclarationExpression(node) {
@@ -9954,7 +10136,7 @@
}
ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression;
function isInternalModuleImportEqualsDeclaration(node) {
- return node.kind === 248 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 259 /* ExternalModuleReference */;
+ return node.kind === 249 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 260 /* ExternalModuleReference */;
}
ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration;
function isSourceFileJS(file) {
@@ -9982,15 +10164,15 @@
ts.isIdentifier(node.typeName) &&
node.typeName.escapedText === "Object" &&
node.typeArguments && node.typeArguments.length === 2 &&
- (node.typeArguments[0].kind === 138 /* StringKeyword */ || node.typeArguments[0].kind === 135 /* NumberKeyword */);
+ (node.typeArguments[0].kind === 139 /* StringKeyword */ || node.typeArguments[0].kind === 136 /* NumberKeyword */);
}
ts.isJSDocIndexSignature = isJSDocIndexSignature;
function isRequireCall(callExpression, checkArgumentIsStringLiteralLike) {
- if (callExpression.kind !== 191 /* CallExpression */) {
+ if (callExpression.kind !== 192 /* CallExpression */) {
return false;
}
var _a = callExpression, expression = _a.expression, args = _a.arguments;
- if (expression.kind !== 72 /* Identifier */ || expression.escapedText !== "require") {
+ if (expression.kind !== 73 /* Identifier */ || expression.escapedText !== "require") {
return false;
}
if (args.length !== 1) {
@@ -10021,7 +10203,7 @@
name = node.parent.name;
decl = node.parent;
}
- else if (ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 59 /* EqualsToken */ && node.parent.right === node) {
+ else if (ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 60 /* EqualsToken */ && node.parent.right === node) {
name = node.parent.left;
decl = name;
}
@@ -10030,7 +10212,7 @@
name = node.parent.parent.name;
decl = node.parent.parent;
}
- else if (ts.isBinaryExpression(node.parent.parent) && node.parent.parent.operatorToken.kind === 59 /* EqualsToken */ && node.parent.parent.right === node.parent) {
+ else if (ts.isBinaryExpression(node.parent.parent) && node.parent.parent.operatorToken.kind === 60 /* EqualsToken */ && node.parent.parent.right === node.parent) {
name = node.parent.parent.left;
decl = name;
}
@@ -10072,7 +10254,7 @@
* We treat the right hand side of assignments with container-like initalizers as declarations.
*/
function getAssignedExpandoInitializer(node) {
- if (node && node.parent && ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 59 /* EqualsToken */) {
+ if (node && node.parent && ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 60 /* EqualsToken */) {
var isPrototypeAssignment = isPrototypeAccess(node.parent.left);
return getExpandoInitializer(node.parent.right, isPrototypeAssignment) ||
getDefaultedExpandoInitializer(node.parent.left, node.parent.right, isPrototypeAssignment);
@@ -10098,11 +10280,11 @@
function getExpandoInitializer(initializer, isPrototypeAssignment) {
if (ts.isCallExpression(initializer)) {
var e = skipParentheses(initializer.expression);
- return e.kind === 196 /* FunctionExpression */ || e.kind === 197 /* ArrowFunction */ ? initializer : undefined;
+ return e.kind === 197 /* FunctionExpression */ || e.kind === 198 /* ArrowFunction */ ? initializer : undefined;
}
- if (initializer.kind === 196 /* FunctionExpression */ ||
- initializer.kind === 209 /* ClassExpression */ ||
- initializer.kind === 197 /* ArrowFunction */) {
+ if (initializer.kind === 197 /* FunctionExpression */ ||
+ initializer.kind === 210 /* ClassExpression */ ||
+ initializer.kind === 198 /* ArrowFunction */) {
return initializer;
}
if (ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || isPrototypeAssignment)) {
@@ -10126,7 +10308,7 @@
}
function isDefaultedExpandoInitializer(node) {
var name = ts.isVariableDeclaration(node.parent) ? node.parent.name :
- ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 59 /* EqualsToken */ ? node.parent.left :
+ ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 60 /* EqualsToken */ ? node.parent.left :
undefined;
return name && getExpandoInitializer(node.right, isPrototypeAccess(name)) && isEntityNameExpression(name) && isSameEntityName(name, node.left);
}
@@ -10135,7 +10317,7 @@
function getNameOfExpando(node) {
if (ts.isBinaryExpression(node.parent)) {
var parent = (node.parent.operatorToken.kind === 55 /* BarBarToken */ && ts.isBinaryExpression(node.parent.parent)) ? node.parent.parent : node.parent;
- if (parent.operatorToken.kind === 59 /* EqualsToken */ && ts.isIdentifier(parent.left)) {
+ if (parent.operatorToken.kind === 60 /* EqualsToken */ && ts.isIdentifier(parent.left)) {
return parent.left;
}
}
@@ -10158,7 +10340,7 @@
return name.escapedText === initializer.escapedText;
}
if (ts.isIdentifier(name) && ts.isPropertyAccessExpression(initializer)) {
- return (initializer.expression.kind === 100 /* ThisKeyword */ ||
+ return (initializer.expression.kind === 101 /* ThisKeyword */ ||
ts.isIdentifier(initializer.expression) &&
(initializer.expression.escapedText === "window" ||
initializer.expression.escapedText === "self" ||
@@ -10216,7 +10398,7 @@
}
return 7 /* ObjectDefinePropertyValue */;
}
- if (expr.operatorToken.kind !== 59 /* EqualsToken */ ||
+ if (expr.operatorToken.kind !== 60 /* EqualsToken */ ||
!ts.isPropertyAccessExpression(expr.left)) {
return 0 /* None */;
}
@@ -10228,7 +10410,7 @@
return getAssignmentDeclarationPropertyAccessKind(lhs);
}
function getAssignmentDeclarationPropertyAccessKind(lhs) {
- if (lhs.expression.kind === 100 /* ThisKeyword */) {
+ if (lhs.expression.kind === 101 /* ThisKeyword */) {
return 4 /* ThisProperty */;
}
else if (isModuleExportsPropertyAccessExpression(lhs)) {
@@ -10270,7 +10452,7 @@
ts.isPrototypePropertyAssignment = isPrototypePropertyAssignment;
function isSpecialPropertyDeclaration(expr) {
return isInJSFile(expr) &&
- expr.parent && expr.parent.kind === 221 /* ExpressionStatement */ &&
+ expr.parent && expr.parent.kind === 222 /* ExpressionStatement */ &&
!!ts.getJSDocTypeTag(expr.parent);
}
ts.isSpecialPropertyDeclaration = isSpecialPropertyDeclaration;
@@ -10279,23 +10461,23 @@
return false;
}
var decl = symbol.valueDeclaration;
- return decl.kind === 239 /* FunctionDeclaration */ || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer);
+ return decl.kind === 240 /* FunctionDeclaration */ || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer);
}
ts.isFunctionSymbol = isFunctionSymbol;
function importFromModuleSpecifier(node) {
- return tryGetImportFromModuleSpecifier(node) || ts.Debug.fail(ts.Debug.showSyntaxKind(node.parent));
+ return tryGetImportFromModuleSpecifier(node) || ts.Debug.failBadSyntaxKind(node.parent);
}
ts.importFromModuleSpecifier = importFromModuleSpecifier;
function tryGetImportFromModuleSpecifier(node) {
switch (node.parent.kind) {
- case 249 /* ImportDeclaration */:
- case 255 /* ExportDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 256 /* ExportDeclaration */:
return node.parent;
- case 259 /* ExternalModuleReference */:
+ case 260 /* ExternalModuleReference */:
return node.parent.parent;
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return isImportCall(node.parent) || isRequireCall(node.parent, /*checkArg*/ false) ? node.parent : undefined;
- case 182 /* LiteralType */:
+ case 183 /* LiteralType */:
ts.Debug.assert(ts.isStringLiteral(node));
return ts.tryCast(node.parent.parent, ts.isImportTypeNode);
default:
@@ -10305,12 +10487,12 @@
ts.tryGetImportFromModuleSpecifier = tryGetImportFromModuleSpecifier;
function getExternalModuleName(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
- case 255 /* ExportDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 256 /* ExportDeclaration */:
return node.moduleSpecifier;
- case 248 /* ImportEqualsDeclaration */:
- return node.moduleReference.kind === 259 /* ExternalModuleReference */ ? node.moduleReference.expression : undefined;
- case 183 /* ImportType */:
+ case 249 /* ImportEqualsDeclaration */:
+ return node.moduleReference.kind === 260 /* ExternalModuleReference */ ? node.moduleReference.expression : undefined;
+ case 184 /* ImportType */:
return isLiteralImportTypeNode(node) ? node.argument.literal : undefined;
default:
return ts.Debug.assertNever(node);
@@ -10319,11 +10501,11 @@
ts.getExternalModuleName = getExternalModuleName;
function getNamespaceDeclarationNode(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return node.importClause && ts.tryCast(node.importClause.namedBindings, ts.isNamespaceImport);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return node;
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return undefined;
default:
return ts.Debug.assertNever(node);
@@ -10331,19 +10513,19 @@
}
ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode;
function isDefaultImport(node) {
- return node.kind === 249 /* ImportDeclaration */ && !!node.importClause && !!node.importClause.name;
+ return node.kind === 250 /* ImportDeclaration */ && !!node.importClause && !!node.importClause.name;
}
ts.isDefaultImport = isDefaultImport;
function hasQuestionToken(node) {
if (node) {
switch (node.kind) {
- case 151 /* Parameter */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 276 /* ShorthandPropertyAssignment */:
- case 275 /* PropertyAssignment */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 152 /* Parameter */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 277 /* ShorthandPropertyAssignment */:
+ case 276 /* PropertyAssignment */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
return node.questionToken !== undefined;
}
}
@@ -10357,7 +10539,7 @@
}
ts.isJSDocConstructSignature = isJSDocConstructSignature;
function isJSDocTypeAlias(node) {
- return node.kind === 309 /* JSDocTypedefTag */ || node.kind === 302 /* JSDocCallbackTag */;
+ return node.kind === 310 /* JSDocTypedefTag */ || node.kind === 303 /* JSDocCallbackTag */;
}
ts.isJSDocTypeAlias = isJSDocTypeAlias;
function isTypeAlias(node) {
@@ -10367,7 +10549,7 @@
function getSourceOfAssignment(node) {
return ts.isExpressionStatement(node) &&
node.expression && ts.isBinaryExpression(node.expression) &&
- node.expression.operatorToken.kind === 59 /* EqualsToken */
+ node.expression.operatorToken.kind === 60 /* EqualsToken */
? node.expression.right
: undefined;
}
@@ -10382,12 +10564,12 @@
}
function getSingleInitializerOfVariableStatementOrPropertyDeclaration(node) {
switch (node.kind) {
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
var v = getSingleVariableOfVariableStatement(node);
return v && v.initializer;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return node.initializer;
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return node.initializer;
}
}
@@ -10398,7 +10580,7 @@
function getNestedModuleDeclaration(node) {
return ts.isModuleDeclaration(node) &&
node.body &&
- node.body.kind === 244 /* ModuleDeclaration */
+ node.body.kind === 245 /* ModuleDeclaration */
? node.body
: undefined;
}
@@ -10413,11 +10595,11 @@
if (ts.hasJSDocNodes(node)) {
result = ts.addRange(result, node.jsDoc);
}
- if (node.kind === 151 /* Parameter */) {
+ if (node.kind === 152 /* Parameter */) {
result = ts.addRange(result, ts.getJSDocParameterTags(node));
break;
}
- if (node.kind === 150 /* TypeParameter */) {
+ if (node.kind === 151 /* TypeParameter */) {
result = ts.addRange(result, ts.getJSDocTypeParameterTags(node));
break;
}
@@ -10428,11 +10610,12 @@
ts.getJSDocCommentsAndTags = getJSDocCommentsAndTags;
function getNextJSDocCommentLocation(node) {
var parent = node.parent;
- if (parent.kind === 275 /* PropertyAssignment */ ||
- parent.kind === 154 /* PropertyDeclaration */ ||
- parent.kind === 221 /* ExpressionStatement */ && node.kind === 189 /* PropertyAccessExpression */ ||
+ if (parent.kind === 276 /* PropertyAssignment */ ||
+ parent.kind === 255 /* ExportAssignment */ ||
+ parent.kind === 155 /* PropertyDeclaration */ ||
+ parent.kind === 222 /* ExpressionStatement */ && node.kind === 190 /* PropertyAccessExpression */ ||
getNestedModuleDeclaration(parent) ||
- ts.isBinaryExpression(node) && node.operatorToken.kind === 59 /* EqualsToken */) {
+ ts.isBinaryExpression(node) && node.operatorToken.kind === 60 /* EqualsToken */) {
return parent;
}
// Try to recognize this pattern when node is initializer of variable declaration and JSDoc comments are on containing variable statement.
@@ -10443,7 +10626,7 @@
// var x = function(name) { return name.length; }
else if (parent.parent &&
(getSingleVariableOfVariableStatement(parent.parent) === node ||
- ts.isBinaryExpression(parent) && parent.operatorToken.kind === 59 /* EqualsToken */)) {
+ ts.isBinaryExpression(parent) && parent.operatorToken.kind === 60 /* EqualsToken */)) {
return parent.parent;
}
else if (parent.parent && parent.parent.parent &&
@@ -10466,7 +10649,7 @@
if (!decl) {
return undefined;
}
- var parameter = ts.find(decl.parameters, function (p) { return p.name.kind === 72 /* Identifier */ && p.name.escapedText === name; });
+ var parameter = ts.find(decl.parameters, function (p) { return p.name.kind === 73 /* Identifier */ && p.name.escapedText === name; });
return parameter && parameter.symbol;
}
ts.getParameterSymbolFromJSDoc = getParameterSymbolFromJSDoc;
@@ -10501,7 +10684,7 @@
ts.hasRestParameter = hasRestParameter;
function isRestParameter(node) {
var type = ts.isJSDocParameterTag(node) ? (node.typeExpression && node.typeExpression.type) : node.type;
- return node.dotDotDotToken !== undefined || !!type && type.kind === 295 /* JSDocVariadicType */;
+ return node.dotDotDotToken !== undefined || !!type && type.kind === 296 /* JSDocVariadicType */;
}
ts.isRestParameter = isRestParameter;
var AssignmentKind;
@@ -10514,31 +10697,31 @@
var parent = node.parent;
while (true) {
switch (parent.kind) {
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
var binaryOperator = parent.operatorToken.kind;
return isAssignmentOperator(binaryOperator) && parent.left === node ?
- binaryOperator === 59 /* EqualsToken */ ? 1 /* Definite */ : 2 /* Compound */ :
+ binaryOperator === 60 /* EqualsToken */ ? 1 /* Definite */ : 2 /* Compound */ :
0 /* None */;
- case 202 /* PrefixUnaryExpression */:
- case 203 /* PostfixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
var unaryOperator = parent.operator;
return unaryOperator === 44 /* PlusPlusToken */ || unaryOperator === 45 /* MinusMinusToken */ ? 2 /* Compound */ : 0 /* None */;
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
return parent.initializer === node ? 1 /* Definite */ : 0 /* None */;
- case 195 /* ParenthesizedExpression */:
- case 187 /* ArrayLiteralExpression */:
- case 208 /* SpreadElement */:
- case 213 /* NonNullExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 188 /* ArrayLiteralExpression */:
+ case 209 /* SpreadElement */:
+ case 214 /* NonNullExpression */:
node = parent;
break;
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
if (parent.name !== node) {
return 0 /* None */;
}
node = parent.parent;
break;
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
if (parent.name === node) {
return 0 /* None */;
}
@@ -10565,22 +10748,22 @@
*/
function isNodeWithPossibleHoistedDeclaration(node) {
switch (node.kind) {
- case 218 /* Block */:
- case 219 /* VariableStatement */:
- case 231 /* WithStatement */:
- case 222 /* IfStatement */:
- case 232 /* SwitchStatement */:
- case 246 /* CaseBlock */:
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
- case 233 /* LabeledStatement */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
- case 235 /* TryStatement */:
- case 274 /* CatchClause */:
+ case 219 /* Block */:
+ case 220 /* VariableStatement */:
+ case 232 /* WithStatement */:
+ case 223 /* IfStatement */:
+ case 233 /* SwitchStatement */:
+ case 247 /* CaseBlock */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
+ case 234 /* LabeledStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
+ case 236 /* TryStatement */:
+ case 275 /* CatchClause */:
return true;
}
return false;
@@ -10597,33 +10780,33 @@
return node;
}
function walkUpParenthesizedTypes(node) {
- return walkUp(node, 177 /* ParenthesizedType */);
+ return walkUp(node, 178 /* ParenthesizedType */);
}
ts.walkUpParenthesizedTypes = walkUpParenthesizedTypes;
function walkUpParenthesizedExpressions(node) {
- return walkUp(node, 195 /* ParenthesizedExpression */);
+ return walkUp(node, 196 /* ParenthesizedExpression */);
}
ts.walkUpParenthesizedExpressions = walkUpParenthesizedExpressions;
function skipParentheses(node) {
- while (node.kind === 195 /* ParenthesizedExpression */) {
+ while (node.kind === 196 /* ParenthesizedExpression */) {
node = node.expression;
}
return node;
}
ts.skipParentheses = skipParentheses;
function skipParenthesesUp(node) {
- while (node.kind === 195 /* ParenthesizedExpression */) {
+ while (node.kind === 196 /* ParenthesizedExpression */) {
node = node.parent;
}
return node;
}
// a node is delete target iff. it is PropertyAccessExpression/ElementAccessExpression with parentheses skipped
function isDeleteTarget(node) {
- if (node.kind !== 189 /* PropertyAccessExpression */ && node.kind !== 190 /* ElementAccessExpression */) {
+ if (node.kind !== 190 /* PropertyAccessExpression */ && node.kind !== 191 /* ElementAccessExpression */) {
return false;
}
node = walkUpParenthesizedExpressions(node.parent);
- return node && node.kind === 198 /* DeleteExpression */;
+ return node && node.kind === 199 /* DeleteExpression */;
}
ts.isDeleteTarget = isDeleteTarget;
function isNodeDescendantOf(node, ancestor) {
@@ -10649,7 +10832,7 @@
if (ts.isComputedPropertyName(parent))
return parent.parent;
// falls through
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
if (ts.isDeclaration(parent)) {
return parent.name === name ? parent : undefined;
}
@@ -10673,7 +10856,7 @@
ts.getDeclarationFromName = getDeclarationFromName;
function isLiteralComputedPropertyDeclarationName(node) {
return (node.kind === 10 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) &&
- node.parent.kind === 149 /* ComputedPropertyName */ &&
+ node.parent.kind === 150 /* ComputedPropertyName */ &&
ts.isDeclaration(node.parent.parent);
}
ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName;
@@ -10681,32 +10864,32 @@
function isIdentifierName(node) {
var parent = node.parent;
switch (parent.kind) {
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 278 /* EnumMember */:
- case 275 /* PropertyAssignment */:
- case 189 /* PropertyAccessExpression */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 279 /* EnumMember */:
+ case 276 /* PropertyAssignment */:
+ case 190 /* PropertyAccessExpression */:
// Name in member declaration or property name in property access
return parent.name === node;
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
// Name on right hand side of dot in a type query or type reference
if (parent.right === node) {
- while (parent.kind === 148 /* QualifiedName */) {
+ while (parent.kind === 149 /* QualifiedName */) {
parent = parent.parent;
}
- return parent.kind === 167 /* TypeQuery */ || parent.kind === 164 /* TypeReference */;
+ return parent.kind === 168 /* TypeQuery */ || parent.kind === 165 /* TypeReference */;
}
return false;
- case 186 /* BindingElement */:
- case 253 /* ImportSpecifier */:
+ case 187 /* BindingElement */:
+ case 254 /* ImportSpecifier */:
// Property name in binding element or import specifier
return parent.propertyName === node;
- case 257 /* ExportSpecifier */:
- case 267 /* JsxAttribute */:
+ case 258 /* ExportSpecifier */:
+ case 268 /* JsxAttribute */:
// Any name in an export specifier or JSX Attribute
return true;
}
@@ -10723,13 +10906,13 @@
// export default <EntityNameExpression>
// module.exports = <EntityNameExpression>
function isAliasSymbolDeclaration(node) {
- return node.kind === 248 /* ImportEqualsDeclaration */ ||
- node.kind === 247 /* NamespaceExportDeclaration */ ||
- node.kind === 250 /* ImportClause */ && !!node.name ||
- node.kind === 251 /* NamespaceImport */ ||
- node.kind === 253 /* ImportSpecifier */ ||
- node.kind === 257 /* ExportSpecifier */ ||
- node.kind === 254 /* ExportAssignment */ && exportAssignmentIsAlias(node) ||
+ return node.kind === 249 /* ImportEqualsDeclaration */ ||
+ node.kind === 248 /* NamespaceExportDeclaration */ ||
+ node.kind === 251 /* ImportClause */ && !!node.name ||
+ node.kind === 252 /* NamespaceImport */ ||
+ node.kind === 254 /* ImportSpecifier */ ||
+ node.kind === 258 /* ExportSpecifier */ ||
+ node.kind === 255 /* ExportAssignment */ && exportAssignmentIsAlias(node) ||
ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* ModuleExports */ && exportAssignmentIsAlias(node);
}
ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration;
@@ -10751,12 +10934,12 @@
}
ts.getEffectiveBaseTypeNode = getEffectiveBaseTypeNode;
function getClassExtendsHeritageElement(node) {
- var heritageClause = getHeritageClause(node.heritageClauses, 86 /* ExtendsKeyword */);
+ var heritageClause = getHeritageClause(node.heritageClauses, 87 /* ExtendsKeyword */);
return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined;
}
ts.getClassExtendsHeritageElement = getClassExtendsHeritageElement;
function getClassImplementsHeritageClauseElements(node) {
- var heritageClause = getHeritageClause(node.heritageClauses, 109 /* ImplementsKeyword */);
+ var heritageClause = getHeritageClause(node.heritageClauses, 110 /* ImplementsKeyword */);
return heritageClause ? heritageClause.types : undefined;
}
ts.getClassImplementsHeritageClauseElements = getClassImplementsHeritageClauseElements;
@@ -10768,7 +10951,7 @@
}
ts.getAllSuperTypeNodes = getAllSuperTypeNodes;
function getInterfaceBaseTypeNodes(node) {
- var heritageClause = getHeritageClause(node.heritageClauses, 86 /* ExtendsKeyword */);
+ var heritageClause = getHeritageClause(node.heritageClauses, 87 /* ExtendsKeyword */);
return heritageClause ? heritageClause.types : undefined;
}
ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes;
@@ -10802,11 +10985,11 @@
}
ts.getAncestor = getAncestor;
function isKeyword(token) {
- return 73 /* FirstKeyword */ <= token && token <= 147 /* LastKeyword */;
+ return 74 /* FirstKeyword */ <= token && token <= 148 /* LastKeyword */;
}
ts.isKeyword = isKeyword;
function isContextualKeyword(token) {
- return 118 /* FirstContextualKeyword */ <= token && token <= 147 /* LastContextualKeyword */;
+ return 119 /* FirstContextualKeyword */ <= token && token <= 148 /* LastContextualKeyword */;
}
ts.isContextualKeyword = isContextualKeyword;
function isNonContextualKeyword(token) {
@@ -10841,14 +11024,14 @@
}
var flags = 0 /* Normal */;
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 156 /* MethodDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 157 /* MethodDeclaration */:
if (node.asteriskToken) {
flags |= 1 /* Generator */;
}
// falls through
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
if (hasModifier(node, 256 /* Async */)) {
flags |= 2 /* Async */;
}
@@ -10862,10 +11045,10 @@
ts.getFunctionFlags = getFunctionFlags;
function isAsyncFunction(node) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 156 /* MethodDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
return node.body !== undefined
&& node.asteriskToken === undefined
&& hasModifier(node, 256 /* Async */);
@@ -10890,7 +11073,7 @@
}
ts.hasDynamicName = hasDynamicName;
function isDynamicName(name) {
- return name.kind === 149 /* ComputedPropertyName */ &&
+ return name.kind === 150 /* ComputedPropertyName */ &&
!isStringOrNumericLiteralLike(name.expression) &&
!isWellKnownSymbolSyntactically(name.expression);
}
@@ -10906,12 +11089,12 @@
ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically;
function getPropertyNameForPropertyNameNode(name) {
switch (name.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return name.escapedText;
case 10 /* StringLiteral */:
case 8 /* NumericLiteral */:
return ts.escapeLeadingUnderscores(name.text);
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
var nameExpression = name.expression;
if (isWellKnownSymbolSyntactically(nameExpression)) {
return getPropertyNameForKnownSymbolName(ts.idText(nameExpression.name));
@@ -10927,7 +11110,7 @@
ts.getPropertyNameForPropertyNameNode = getPropertyNameForPropertyNameNode;
function isPropertyNameLiteral(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
case 10 /* StringLiteral */:
case 14 /* NoSubstitutionTemplateLiteral */:
case 8 /* NumericLiteral */:
@@ -10938,11 +11121,11 @@
}
ts.isPropertyNameLiteral = isPropertyNameLiteral;
function getTextOfIdentifierOrLiteral(node) {
- return node.kind === 72 /* Identifier */ ? ts.idText(node) : node.text;
+ return node.kind === 73 /* Identifier */ ? ts.idText(node) : node.text;
}
ts.getTextOfIdentifierOrLiteral = getTextOfIdentifierOrLiteral;
function getEscapedTextOfIdentifierOrLiteral(node) {
- return node.kind === 72 /* Identifier */ ? node.escapedText : ts.escapeLeadingUnderscores(node.text);
+ return node.kind === 73 /* Identifier */ ? node.escapedText : ts.escapeLeadingUnderscores(node.text);
}
ts.getEscapedTextOfIdentifierOrLiteral = getEscapedTextOfIdentifierOrLiteral;
function getPropertyNameForKnownSymbolName(symbolName) {
@@ -10957,7 +11140,7 @@
* Includes the word "Symbol" with unicode escapes
*/
function isESSymbolIdentifier(node) {
- return node.kind === 72 /* Identifier */ && node.escapedText === "Symbol";
+ return node.kind === 73 /* Identifier */ && node.escapedText === "Symbol";
}
ts.isESSymbolIdentifier = isESSymbolIdentifier;
function isPushOrUnshiftIdentifier(node) {
@@ -10966,11 +11149,11 @@
ts.isPushOrUnshiftIdentifier = isPushOrUnshiftIdentifier;
function isParameterDeclaration(node) {
var root = getRootDeclaration(node);
- return root.kind === 151 /* Parameter */;
+ return root.kind === 152 /* Parameter */;
}
ts.isParameterDeclaration = isParameterDeclaration;
function getRootDeclaration(node) {
- while (node.kind === 186 /* BindingElement */) {
+ while (node.kind === 187 /* BindingElement */) {
node = node.parent.parent;
}
return node;
@@ -10978,15 +11161,15 @@
ts.getRootDeclaration = getRootDeclaration;
function nodeStartsNewLexicalEnvironment(node) {
var kind = node.kind;
- return kind === 157 /* Constructor */
- || kind === 196 /* FunctionExpression */
- || kind === 239 /* FunctionDeclaration */
- || kind === 197 /* ArrowFunction */
- || kind === 156 /* MethodDeclaration */
- || kind === 158 /* GetAccessor */
- || kind === 159 /* SetAccessor */
- || kind === 244 /* ModuleDeclaration */
- || kind === 284 /* SourceFile */;
+ return kind === 158 /* Constructor */
+ || kind === 197 /* FunctionExpression */
+ || kind === 240 /* FunctionDeclaration */
+ || kind === 198 /* ArrowFunction */
+ || kind === 157 /* MethodDeclaration */
+ || kind === 159 /* GetAccessor */
+ || kind === 160 /* SetAccessor */
+ || kind === 245 /* ModuleDeclaration */
+ || kind === 285 /* SourceFile */;
}
ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment;
function nodeIsSynthesized(range) {
@@ -11005,38 +11188,38 @@
})(Associativity = ts.Associativity || (ts.Associativity = {}));
function getExpressionAssociativity(expression) {
var operator = getOperator(expression);
- var hasArguments = expression.kind === 192 /* NewExpression */ && expression.arguments !== undefined;
+ var hasArguments = expression.kind === 193 /* NewExpression */ && expression.arguments !== undefined;
return getOperatorAssociativity(expression.kind, operator, hasArguments);
}
ts.getExpressionAssociativity = getExpressionAssociativity;
function getOperatorAssociativity(kind, operator, hasArguments) {
switch (kind) {
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return hasArguments ? 0 /* Left */ : 1 /* Right */;
- case 202 /* PrefixUnaryExpression */:
- case 199 /* TypeOfExpression */:
- case 200 /* VoidExpression */:
- case 198 /* DeleteExpression */:
- case 201 /* AwaitExpression */:
- case 205 /* ConditionalExpression */:
- case 207 /* YieldExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 200 /* TypeOfExpression */:
+ case 201 /* VoidExpression */:
+ case 199 /* DeleteExpression */:
+ case 202 /* AwaitExpression */:
+ case 206 /* ConditionalExpression */:
+ case 208 /* YieldExpression */:
return 1 /* Right */;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
switch (operator) {
case 41 /* AsteriskAsteriskToken */:
- case 59 /* EqualsToken */:
- case 60 /* PlusEqualsToken */:
- case 61 /* MinusEqualsToken */:
- case 63 /* AsteriskAsteriskEqualsToken */:
- case 62 /* AsteriskEqualsToken */:
- case 64 /* SlashEqualsToken */:
- case 65 /* PercentEqualsToken */:
- case 66 /* LessThanLessThanEqualsToken */:
- case 67 /* GreaterThanGreaterThanEqualsToken */:
- case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
- case 69 /* AmpersandEqualsToken */:
- case 71 /* CaretEqualsToken */:
- case 70 /* BarEqualsToken */:
+ case 60 /* EqualsToken */:
+ case 61 /* PlusEqualsToken */:
+ case 62 /* MinusEqualsToken */:
+ case 64 /* AsteriskAsteriskEqualsToken */:
+ case 63 /* AsteriskEqualsToken */:
+ case 65 /* SlashEqualsToken */:
+ case 66 /* PercentEqualsToken */:
+ case 67 /* LessThanLessThanEqualsToken */:
+ case 68 /* GreaterThanGreaterThanEqualsToken */:
+ case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
+ case 70 /* AmpersandEqualsToken */:
+ case 72 /* CaretEqualsToken */:
+ case 71 /* BarEqualsToken */:
return 1 /* Right */;
}
}
@@ -11045,15 +11228,15 @@
ts.getOperatorAssociativity = getOperatorAssociativity;
function getExpressionPrecedence(expression) {
var operator = getOperator(expression);
- var hasArguments = expression.kind === 192 /* NewExpression */ && expression.arguments !== undefined;
+ var hasArguments = expression.kind === 193 /* NewExpression */ && expression.arguments !== undefined;
return getOperatorPrecedence(expression.kind, operator, hasArguments);
}
ts.getExpressionPrecedence = getExpressionPrecedence;
function getOperator(expression) {
- if (expression.kind === 204 /* BinaryExpression */) {
+ if (expression.kind === 205 /* BinaryExpression */) {
return expression.operatorToken.kind;
}
- else if (expression.kind === 202 /* PrefixUnaryExpression */ || expression.kind === 203 /* PostfixUnaryExpression */) {
+ else if (expression.kind === 203 /* PrefixUnaryExpression */ || expression.kind === 204 /* PostfixUnaryExpression */) {
return expression.operator;
}
else {
@@ -11063,73 +11246,73 @@
ts.getOperator = getOperator;
function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
switch (nodeKind) {
- case 314 /* CommaListExpression */:
+ case 315 /* CommaListExpression */:
return 0;
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
return 1;
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return 2;
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return 4;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
switch (operatorKind) {
case 27 /* CommaToken */:
return 0;
- case 59 /* EqualsToken */:
- case 60 /* PlusEqualsToken */:
- case 61 /* MinusEqualsToken */:
- case 63 /* AsteriskAsteriskEqualsToken */:
- case 62 /* AsteriskEqualsToken */:
- case 64 /* SlashEqualsToken */:
- case 65 /* PercentEqualsToken */:
- case 66 /* LessThanLessThanEqualsToken */:
- case 67 /* GreaterThanGreaterThanEqualsToken */:
- case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
- case 69 /* AmpersandEqualsToken */:
- case 71 /* CaretEqualsToken */:
- case 70 /* BarEqualsToken */:
+ case 60 /* EqualsToken */:
+ case 61 /* PlusEqualsToken */:
+ case 62 /* MinusEqualsToken */:
+ case 64 /* AsteriskAsteriskEqualsToken */:
+ case 63 /* AsteriskEqualsToken */:
+ case 65 /* SlashEqualsToken */:
+ case 66 /* PercentEqualsToken */:
+ case 67 /* LessThanLessThanEqualsToken */:
+ case 68 /* GreaterThanGreaterThanEqualsToken */:
+ case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
+ case 70 /* AmpersandEqualsToken */:
+ case 72 /* CaretEqualsToken */:
+ case 71 /* BarEqualsToken */:
return 3;
default:
return getBinaryOperatorPrecedence(operatorKind);
}
- case 202 /* PrefixUnaryExpression */:
- case 199 /* TypeOfExpression */:
- case 200 /* VoidExpression */:
- case 198 /* DeleteExpression */:
- case 201 /* AwaitExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 200 /* TypeOfExpression */:
+ case 201 /* VoidExpression */:
+ case 199 /* DeleteExpression */:
+ case 202 /* AwaitExpression */:
return 16;
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return 17;
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return 18;
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return hasArguments ? 19 : 18;
- case 193 /* TaggedTemplateExpression */:
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 194 /* TaggedTemplateExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return 19;
- case 100 /* ThisKeyword */:
- case 98 /* SuperKeyword */:
- case 72 /* Identifier */:
- case 96 /* NullKeyword */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
+ case 101 /* ThisKeyword */:
+ case 99 /* SuperKeyword */:
+ case 73 /* Identifier */:
+ case 97 /* NullKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
case 10 /* StringLiteral */:
- case 187 /* ArrayLiteralExpression */:
- case 188 /* ObjectLiteralExpression */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 209 /* ClassExpression */:
- case 260 /* JsxElement */:
- case 261 /* JsxSelfClosingElement */:
- case 264 /* JsxFragment */:
+ case 188 /* ArrayLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 210 /* ClassExpression */:
+ case 261 /* JsxElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 265 /* JsxFragment */:
case 13 /* RegularExpressionLiteral */:
case 14 /* NoSubstitutionTemplateLiteral */:
- case 206 /* TemplateExpression */:
- case 195 /* ParenthesizedExpression */:
- case 210 /* OmittedExpression */:
+ case 207 /* TemplateExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 211 /* OmittedExpression */:
return 20;
default:
return -1;
@@ -11157,9 +11340,9 @@
case 30 /* GreaterThanToken */:
case 31 /* LessThanEqualsToken */:
case 32 /* GreaterThanEqualsToken */:
- case 94 /* InstanceOfKeyword */:
- case 93 /* InKeyword */:
- case 119 /* AsKeyword */:
+ case 95 /* InstanceOfKeyword */:
+ case 94 /* InKeyword */:
+ case 120 /* AsKeyword */:
return 11;
case 46 /* LessThanLessThanToken */:
case 47 /* GreaterThanGreaterThanToken */:
@@ -11621,11 +11804,11 @@
}
ts.parameterIsThisKeyword = parameterIsThisKeyword;
function isThisIdentifier(node) {
- return !!node && node.kind === 72 /* Identifier */ && identifierIsThisKeyword(node);
+ return !!node && node.kind === 73 /* Identifier */ && identifierIsThisKeyword(node);
}
ts.isThisIdentifier = isThisIdentifier;
function identifierIsThisKeyword(id) {
- return id.originalKeywordKind === 100 /* ThisKeyword */;
+ return id.originalKeywordKind === 101 /* ThisKeyword */;
}
ts.identifierIsThisKeyword = identifierIsThisKeyword;
function getAllAccessorDeclarations(declarations, accessor) {
@@ -11636,10 +11819,10 @@
var setAccessor;
if (hasDynamicName(accessor)) {
firstAccessor = accessor;
- if (accessor.kind === 158 /* GetAccessor */) {
+ if (accessor.kind === 159 /* GetAccessor */) {
getAccessor = accessor;
}
- else if (accessor.kind === 159 /* SetAccessor */) {
+ else if (accessor.kind === 160 /* SetAccessor */) {
setAccessor = accessor;
}
else {
@@ -11659,10 +11842,10 @@
else if (!secondAccessor) {
secondAccessor = member;
}
- if (member.kind === 158 /* GetAccessor */ && !getAccessor) {
+ if (member.kind === 159 /* GetAccessor */ && !getAccessor) {
getAccessor = member;
}
- if (member.kind === 159 /* SetAccessor */ && !setAccessor) {
+ if (member.kind === 160 /* SetAccessor */ && !setAccessor) {
setAccessor = member;
}
}
@@ -11708,7 +11891,7 @@
ts.getJSDocTypeParameterDeclarations = getJSDocTypeParameterDeclarations;
/** template tags are only available when a typedef isn't already using them */
function isNonTypeAliasTemplate(tag) {
- return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 296 /* JSDocComment */ && tag.parent.tags.some(isJSDocTypeAlias));
+ return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 297 /* JSDocComment */ && tag.parent.tags.some(isJSDocTypeAlias));
}
/**
* Gets the effective type annotation of the value parameter of a set accessor. If the node
@@ -11948,7 +12131,7 @@
flags |= modifierToFlag(modifier.kind);
}
}
- if (node.flags & 4 /* NestedNamespace */ || (node.kind === 72 /* Identifier */ && node.isInJSDocNamespace)) {
+ if (node.flags & 4 /* NestedNamespace */ || (node.kind === 73 /* Identifier */ && node.isInJSDocNamespace)) {
flags |= 1 /* Export */;
}
return flags;
@@ -11956,17 +12139,17 @@
ts.getModifierFlagsNoCache = getModifierFlagsNoCache;
function modifierToFlag(token) {
switch (token) {
- case 116 /* StaticKeyword */: return 32 /* Static */;
- case 115 /* PublicKeyword */: return 4 /* Public */;
- case 114 /* ProtectedKeyword */: return 16 /* Protected */;
- case 113 /* PrivateKeyword */: return 8 /* Private */;
- case 118 /* AbstractKeyword */: return 128 /* Abstract */;
- case 85 /* ExportKeyword */: return 1 /* Export */;
- case 125 /* DeclareKeyword */: return 2 /* Ambient */;
- case 77 /* ConstKeyword */: return 2048 /* Const */;
- case 80 /* DefaultKeyword */: return 512 /* Default */;
- case 121 /* AsyncKeyword */: return 256 /* Async */;
- case 133 /* ReadonlyKeyword */: return 64 /* Readonly */;
+ case 117 /* StaticKeyword */: return 32 /* Static */;
+ case 116 /* PublicKeyword */: return 4 /* Public */;
+ case 115 /* ProtectedKeyword */: return 16 /* Protected */;
+ case 114 /* PrivateKeyword */: return 8 /* Private */;
+ case 119 /* AbstractKeyword */: return 128 /* Abstract */;
+ case 86 /* ExportKeyword */: return 1 /* Export */;
+ case 126 /* DeclareKeyword */: return 2 /* Ambient */;
+ case 78 /* ConstKeyword */: return 2048 /* Const */;
+ case 81 /* DefaultKeyword */: return 512 /* Default */;
+ case 122 /* AsyncKeyword */: return 256 /* Async */;
+ case 134 /* ReadonlyKeyword */: return 64 /* Readonly */;
}
return 0 /* None */;
}
@@ -11978,7 +12161,7 @@
}
ts.isLogicalOperator = isLogicalOperator;
function isAssignmentOperator(token) {
- return token >= 59 /* FirstAssignment */ && token <= 71 /* LastAssignment */;
+ return token >= 60 /* FirstAssignment */ && token <= 72 /* LastAssignment */;
}
ts.isAssignmentOperator = isAssignmentOperator;
/** Get `C` given `N` if `N` is in the position `class C extends N` where `N` is an ExpressionWithTypeArguments. */
@@ -11991,14 +12174,14 @@
return ts.isExpressionWithTypeArguments(node)
&& ts.isHeritageClause(node.parent)
&& ts.isClassLike(node.parent.parent)
- ? { class: node.parent.parent, isImplements: node.parent.token === 109 /* ImplementsKeyword */ }
+ ? { class: node.parent.parent, isImplements: node.parent.token === 110 /* ImplementsKeyword */ }
: undefined;
}
ts.tryGetClassImplementingOrExtendingExpressionWithTypeArguments = tryGetClassImplementingOrExtendingExpressionWithTypeArguments;
function isAssignmentExpression(node, excludeCompoundAssignment) {
return ts.isBinaryExpression(node)
&& (excludeCompoundAssignment
- ? node.operatorToken.kind === 59 /* EqualsToken */
+ ? node.operatorToken.kind === 60 /* EqualsToken */
: isAssignmentOperator(node.operatorToken.kind))
&& ts.isLeftHandSideExpression(node.left);
}
@@ -12006,8 +12189,8 @@
function isDestructuringAssignment(node) {
if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) {
var kind = node.left.kind;
- return kind === 188 /* ObjectLiteralExpression */
- || kind === 187 /* ArrayLiteralExpression */;
+ return kind === 189 /* ObjectLiteralExpression */
+ || kind === 188 /* ArrayLiteralExpression */;
}
return false;
}
@@ -12017,29 +12200,39 @@
}
ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause;
function isEntityNameExpression(node) {
- return node.kind === 72 /* Identifier */ || isPropertyAccessEntityNameExpression(node);
+ return node.kind === 73 /* Identifier */ || isPropertyAccessEntityNameExpression(node);
}
ts.isEntityNameExpression = isEntityNameExpression;
function isPropertyAccessEntityNameExpression(node) {
return ts.isPropertyAccessExpression(node) && isEntityNameExpression(node.expression);
}
ts.isPropertyAccessEntityNameExpression = isPropertyAccessEntityNameExpression;
+ function tryGetPropertyAccessOrIdentifierToString(expr) {
+ if (ts.isPropertyAccessExpression(expr)) {
+ return tryGetPropertyAccessOrIdentifierToString(expr.expression) + "." + expr.name;
+ }
+ if (ts.isIdentifier(expr)) {
+ return ts.unescapeLeadingUnderscores(expr.escapedText);
+ }
+ return undefined;
+ }
+ ts.tryGetPropertyAccessOrIdentifierToString = tryGetPropertyAccessOrIdentifierToString;
function isPrototypeAccess(node) {
return ts.isPropertyAccessExpression(node) && node.name.escapedText === "prototype";
}
ts.isPrototypeAccess = isPrototypeAccess;
function isRightSideOfQualifiedNameOrPropertyAccess(node) {
- return (node.parent.kind === 148 /* QualifiedName */ && node.parent.right === node) ||
- (node.parent.kind === 189 /* PropertyAccessExpression */ && node.parent.name === node);
+ return (node.parent.kind === 149 /* QualifiedName */ && node.parent.right === node) ||
+ (node.parent.kind === 190 /* PropertyAccessExpression */ && node.parent.name === node);
}
ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess;
function isEmptyObjectLiteral(expression) {
- return expression.kind === 188 /* ObjectLiteralExpression */ &&
+ return expression.kind === 189 /* ObjectLiteralExpression */ &&
expression.properties.length === 0;
}
ts.isEmptyObjectLiteral = isEmptyObjectLiteral;
function isEmptyArrayLiteral(expression) {
- return expression.kind === 187 /* ArrayLiteralExpression */ &&
+ return expression.kind === 188 /* ArrayLiteralExpression */ &&
expression.elements.length === 0;
}
ts.isEmptyArrayLiteral = isEmptyArrayLiteral;
@@ -12228,77 +12421,6 @@
}
ts.getNewLineCharacter = getNewLineCharacter;
/**
- * Formats an enum value as a string for debugging and debug assertions.
- */
- function formatEnum(value, enumObject, isFlags) {
- if (value === void 0) { value = 0; }
- var members = getEnumMembers(enumObject);
- if (value === 0) {
- return members.length > 0 && members[0][0] === 0 ? members[0][1] : "0";
- }
- if (isFlags) {
- var result = "";
- var remainingFlags = value;
- for (var i = members.length - 1; i >= 0 && remainingFlags !== 0; i--) {
- var _a = members[i], enumValue = _a[0], enumName = _a[1];
- if (enumValue !== 0 && (remainingFlags & enumValue) === enumValue) {
- remainingFlags &= ~enumValue;
- result = "" + enumName + (result ? ", " : "") + result;
- }
- }
- if (remainingFlags === 0) {
- return result;
- }
- }
- else {
- for (var _i = 0, members_1 = members; _i < members_1.length; _i++) {
- var _b = members_1[_i], enumValue = _b[0], enumName = _b[1];
- if (enumValue === value) {
- return enumName;
- }
- }
- }
- return value.toString();
- }
- function getEnumMembers(enumObject) {
- var result = [];
- for (var name in enumObject) {
- var value = enumObject[name];
- if (typeof value === "number") {
- result.push([value, name]);
- }
- }
- return ts.stableSort(result, function (x, y) { return ts.compareValues(x[0], y[0]); });
- }
- function formatSyntaxKind(kind) {
- return formatEnum(kind, ts.SyntaxKind, /*isFlags*/ false);
- }
- ts.formatSyntaxKind = formatSyntaxKind;
- function formatModifierFlags(flags) {
- return formatEnum(flags, ts.ModifierFlags, /*isFlags*/ true);
- }
- ts.formatModifierFlags = formatModifierFlags;
- function formatTransformFlags(flags) {
- return formatEnum(flags, ts.TransformFlags, /*isFlags*/ true);
- }
- ts.formatTransformFlags = formatTransformFlags;
- function formatEmitFlags(flags) {
- return formatEnum(flags, ts.EmitFlags, /*isFlags*/ true);
- }
- ts.formatEmitFlags = formatEmitFlags;
- function formatSymbolFlags(flags) {
- return formatEnum(flags, ts.SymbolFlags, /*isFlags*/ true);
- }
- ts.formatSymbolFlags = formatSymbolFlags;
- function formatTypeFlags(flags) {
- return formatEnum(flags, ts.TypeFlags, /*isFlags*/ true);
- }
- ts.formatTypeFlags = formatTypeFlags;
- function formatObjectFlags(flags) {
- return formatEnum(flags, ts.ObjectFlags, /*isFlags*/ true);
- }
- ts.formatObjectFlags = formatObjectFlags;
- /**
* Creates a new TextRange from the provided pos and end.
*
* @param pos The start position.
@@ -12387,6 +12509,10 @@
return positionsAreOnSameLine(range1.end, getStartPositionOfRange(range2, sourceFile), sourceFile);
}
ts.rangeEndIsOnSameLineAsRangeStart = rangeEndIsOnSameLineAsRangeStart;
+ function isNodeArrayMultiLine(list, sourceFile) {
+ return !positionsAreOnSameLine(list.pos, list.end, sourceFile);
+ }
+ ts.isNodeArrayMultiLine = isNodeArrayMultiLine;
function positionsAreOnSameLine(pos1, pos2, sourceFile) {
return pos1 === pos2 ||
getLineOfLocalPosition(sourceFile, pos1) === getLineOfLocalPosition(sourceFile, pos2);
@@ -12404,8 +12530,8 @@
var parseNode = ts.getParseTreeNode(node);
if (parseNode) {
switch (parseNode.parent.kind) {
- case 243 /* EnumDeclaration */:
- case 244 /* ModuleDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 245 /* ModuleDeclaration */:
return parseNode === parseNode.parent.name;
}
}
@@ -12439,10 +12565,10 @@
}
if (getCheckFlags(s) & 6 /* Synthetic */) {
var checkFlags = s.checkFlags;
- var accessModifier = checkFlags & 512 /* ContainsPrivate */ ? 8 /* Private */ :
- checkFlags & 128 /* ContainsPublic */ ? 4 /* Public */ :
+ var accessModifier = checkFlags & 1024 /* ContainsPrivate */ ? 8 /* Private */ :
+ checkFlags & 256 /* ContainsPublic */ ? 4 /* Public */ :
16 /* Protected */;
- var staticModifier = checkFlags & 1024 /* ContainsStatic */ ? 32 /* Static */ : 0;
+ var staticModifier = checkFlags & 2048 /* ContainsStatic */ ? 32 /* Static */ : 0;
return accessModifier | staticModifier;
}
if (s.flags & 4194304 /* Prototype */) {
@@ -12482,35 +12608,35 @@
if (!parent)
return 0 /* Read */;
switch (parent.kind) {
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return accessKind(parent);
- case 203 /* PostfixUnaryExpression */:
- case 202 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
var operator = parent.operator;
return operator === 44 /* PlusPlusToken */ || operator === 45 /* MinusMinusToken */ ? writeOrReadWrite() : 0 /* Read */;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
var _a = parent, left = _a.left, operatorToken = _a.operatorToken;
return left === node && isAssignmentOperator(operatorToken.kind) ?
- operatorToken.kind === 59 /* EqualsToken */ ? 1 /* Write */ : writeOrReadWrite()
+ operatorToken.kind === 60 /* EqualsToken */ ? 1 /* Write */ : writeOrReadWrite()
: 0 /* Read */;
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return parent.name !== node ? 0 /* Read */ : accessKind(parent);
- case 275 /* PropertyAssignment */: {
+ case 276 /* PropertyAssignment */: {
var parentAccess = accessKind(parent.parent);
// In `({ x: varname }) = { x: 1 }`, the left `x` is a read, the right `x` is a write.
return node === parent.name ? reverseAccessKind(parentAccess) : parentAccess;
}
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
// Assume it's the local variable being accessed, since we don't check public properties for --noUnusedLocals.
return node === parent.objectAssignmentInitializer ? 0 /* Read */ : accessKind(parent.parent);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return accessKind(parent);
default:
return 0 /* Read */;
}
function writeOrReadWrite() {
// If grandparent is not an ExpressionStatement, this is used as an expression in addition to having a side effect.
- return parent.parent && skipParenthesesUp(parent.parent).kind === 221 /* ExpressionStatement */ ? 1 /* Write */ : 2 /* ReadWrite */;
+ return parent.parent && skipParenthesesUp(parent.parent).kind === 222 /* ExpressionStatement */ ? 1 /* Write */ : 2 /* ReadWrite */;
}
}
function reverseAccessKind(a) {
@@ -12665,32 +12791,32 @@
}
ts.isObjectTypeDeclaration = isObjectTypeDeclaration;
function isTypeNodeKind(kind) {
- return (kind >= 163 /* FirstTypeNode */ && kind <= 183 /* LastTypeNode */)
- || kind === 120 /* AnyKeyword */
- || kind === 143 /* UnknownKeyword */
- || kind === 135 /* NumberKeyword */
- || kind === 146 /* BigIntKeyword */
- || kind === 136 /* ObjectKeyword */
- || kind === 123 /* BooleanKeyword */
- || kind === 138 /* StringKeyword */
- || kind === 139 /* SymbolKeyword */
- || kind === 100 /* ThisKeyword */
- || kind === 106 /* VoidKeyword */
- || kind === 141 /* UndefinedKeyword */
- || kind === 96 /* NullKeyword */
- || kind === 132 /* NeverKeyword */
- || kind === 211 /* ExpressionWithTypeArguments */
- || kind === 289 /* JSDocAllType */
- || kind === 290 /* JSDocUnknownType */
- || kind === 291 /* JSDocNullableType */
- || kind === 292 /* JSDocNonNullableType */
- || kind === 293 /* JSDocOptionalType */
- || kind === 294 /* JSDocFunctionType */
- || kind === 295 /* JSDocVariadicType */;
+ return (kind >= 164 /* FirstTypeNode */ && kind <= 184 /* LastTypeNode */)
+ || kind === 121 /* AnyKeyword */
+ || kind === 144 /* UnknownKeyword */
+ || kind === 136 /* NumberKeyword */
+ || kind === 147 /* BigIntKeyword */
+ || kind === 137 /* ObjectKeyword */
+ || kind === 124 /* BooleanKeyword */
+ || kind === 139 /* StringKeyword */
+ || kind === 140 /* SymbolKeyword */
+ || kind === 101 /* ThisKeyword */
+ || kind === 107 /* VoidKeyword */
+ || kind === 142 /* UndefinedKeyword */
+ || kind === 97 /* NullKeyword */
+ || kind === 133 /* NeverKeyword */
+ || kind === 212 /* ExpressionWithTypeArguments */
+ || kind === 290 /* JSDocAllType */
+ || kind === 291 /* JSDocUnknownType */
+ || kind === 292 /* JSDocNullableType */
+ || kind === 293 /* JSDocNonNullableType */
+ || kind === 294 /* JSDocOptionalType */
+ || kind === 295 /* JSDocFunctionType */
+ || kind === 296 /* JSDocVariadicType */;
}
ts.isTypeNodeKind = isTypeNodeKind;
function isAccessExpression(node) {
- return node.kind === 189 /* PropertyAccessExpression */ || node.kind === 190 /* ElementAccessExpression */;
+ return node.kind === 190 /* PropertyAccessExpression */ || node.kind === 191 /* ElementAccessExpression */;
}
ts.isAccessExpression = isAccessExpression;
function isBundleFileTextLike(section) {
@@ -12707,8 +12833,10 @@
(function (ts) {
function getDefaultLibFileName(options) {
switch (options.target) {
- case 7 /* ESNext */:
+ case 8 /* ESNext */:
return "lib.esnext.full.d.ts";
+ case 7 /* ES2020 */:
+ return "lib.es2020.full.d.ts";
case 6 /* ES2019 */:
return "lib.es2019.full.d.ts";
case 5 /* ES2018 */:
@@ -12925,9 +13053,9 @@
}
ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions;
function getTypeParameterOwner(d) {
- if (d && d.kind === 150 /* TypeParameter */) {
+ if (d && d.kind === 151 /* TypeParameter */) {
for (var current = d; current; current = current.parent) {
- if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 241 /* InterfaceDeclaration */) {
+ if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 242 /* InterfaceDeclaration */) {
return current;
}
}
@@ -12935,7 +13063,7 @@
}
ts.getTypeParameterOwner = getTypeParameterOwner;
function isParameterPropertyDeclaration(node) {
- return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) && node.parent.kind === 157 /* Constructor */;
+ return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) && node.parent.kind === 158 /* Constructor */;
}
ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration;
function isEmptyBindingPattern(node) {
@@ -12965,14 +13093,14 @@
node = walkUpBindingElementsAndPatterns(node);
}
var flags = getFlags(node);
- if (node.kind === 237 /* VariableDeclaration */) {
+ if (node.kind === 238 /* VariableDeclaration */) {
node = node.parent;
}
- if (node && node.kind === 238 /* VariableDeclarationList */) {
+ if (node && node.kind === 239 /* VariableDeclarationList */) {
flags |= getFlags(node);
node = node.parent;
}
- if (node && node.kind === 219 /* VariableStatement */) {
+ if (node && node.kind === 220 /* VariableStatement */) {
flags |= getFlags(node);
}
return flags;
@@ -13118,27 +13246,27 @@
}
// Covers remaining cases (returning undefined if none match).
switch (hostNode.kind) {
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
if (hostNode.declarationList && hostNode.declarationList.declarations[0]) {
return getDeclarationIdentifier(hostNode.declarationList.declarations[0]);
}
break;
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
var expr = hostNode.expression;
switch (expr.kind) {
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return expr.name;
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
var arg = expr.argumentExpression;
if (ts.isIdentifier(arg)) {
return arg;
}
}
break;
- case 195 /* ParenthesizedExpression */: {
+ case 196 /* ParenthesizedExpression */: {
return getDeclarationIdentifier(hostNode.expression);
}
- case 233 /* LabeledStatement */: {
+ case 234 /* LabeledStatement */: {
if (ts.isDeclaration(hostNode.statement) || ts.isExpression(hostNode.statement)) {
return getDeclarationIdentifier(hostNode.statement);
}
@@ -13162,18 +13290,18 @@
/** @internal */
function getNonAssignedNameOfDeclaration(declaration) {
switch (declaration.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return declaration;
- case 310 /* JSDocPropertyTag */:
- case 304 /* JSDocParameterTag */: {
+ case 311 /* JSDocPropertyTag */:
+ case 305 /* JSDocParameterTag */: {
var name = declaration.name;
- if (name.kind === 148 /* QualifiedName */) {
+ if (name.kind === 149 /* QualifiedName */) {
return name.right;
}
break;
}
- case 191 /* CallExpression */:
- case 204 /* BinaryExpression */: {
+ case 192 /* CallExpression */:
+ case 205 /* BinaryExpression */: {
var expr = declaration;
switch (ts.getAssignmentDeclarationKind(expr)) {
case 1 /* ExportsProperty */:
@@ -13189,9 +13317,9 @@
return undefined;
}
}
- case 309 /* JSDocTypedefTag */:
+ case 310 /* JSDocTypedefTag */:
return getNameOfJSDocTypedef(declaration);
- case 254 /* ExportAssignment */: {
+ case 255 /* ExportAssignment */: {
var expression = declaration.expression;
return ts.isIdentifier(expression) ? expression : undefined;
}
@@ -13393,7 +13521,7 @@
return ts.emptyArray;
}
if (ts.isJSDocTypeAlias(node)) {
- ts.Debug.assert(node.parent.kind === 296 /* JSDocComment */);
+ ts.Debug.assert(node.parent.kind === 297 /* JSDocComment */);
return ts.flatMap(node.parent.tags, function (tag) { return ts.isJSDocTemplateTag(tag) ? tag.typeParameters : undefined; });
}
if (node.typeParameters) {
@@ -13461,198 +13589,198 @@
}
ts.isTemplateTail = isTemplateTail;
function isIdentifier(node) {
- return node.kind === 72 /* Identifier */;
+ return node.kind === 73 /* Identifier */;
}
ts.isIdentifier = isIdentifier;
// Names
function isQualifiedName(node) {
- return node.kind === 148 /* QualifiedName */;
+ return node.kind === 149 /* QualifiedName */;
}
ts.isQualifiedName = isQualifiedName;
function isComputedPropertyName(node) {
- return node.kind === 149 /* ComputedPropertyName */;
+ return node.kind === 150 /* ComputedPropertyName */;
}
ts.isComputedPropertyName = isComputedPropertyName;
// Signature elements
function isTypeParameterDeclaration(node) {
- return node.kind === 150 /* TypeParameter */;
+ return node.kind === 151 /* TypeParameter */;
}
ts.isTypeParameterDeclaration = isTypeParameterDeclaration;
function isParameter(node) {
- return node.kind === 151 /* Parameter */;
+ return node.kind === 152 /* Parameter */;
}
ts.isParameter = isParameter;
function isDecorator(node) {
- return node.kind === 152 /* Decorator */;
+ return node.kind === 153 /* Decorator */;
}
ts.isDecorator = isDecorator;
// TypeMember
function isPropertySignature(node) {
- return node.kind === 153 /* PropertySignature */;
+ return node.kind === 154 /* PropertySignature */;
}
ts.isPropertySignature = isPropertySignature;
function isPropertyDeclaration(node) {
- return node.kind === 154 /* PropertyDeclaration */;
+ return node.kind === 155 /* PropertyDeclaration */;
}
ts.isPropertyDeclaration = isPropertyDeclaration;
function isMethodSignature(node) {
- return node.kind === 155 /* MethodSignature */;
+ return node.kind === 156 /* MethodSignature */;
}
ts.isMethodSignature = isMethodSignature;
function isMethodDeclaration(node) {
- return node.kind === 156 /* MethodDeclaration */;
+ return node.kind === 157 /* MethodDeclaration */;
}
ts.isMethodDeclaration = isMethodDeclaration;
function isConstructorDeclaration(node) {
- return node.kind === 157 /* Constructor */;
+ return node.kind === 158 /* Constructor */;
}
ts.isConstructorDeclaration = isConstructorDeclaration;
function isGetAccessorDeclaration(node) {
- return node.kind === 158 /* GetAccessor */;
+ return node.kind === 159 /* GetAccessor */;
}
ts.isGetAccessorDeclaration = isGetAccessorDeclaration;
function isSetAccessorDeclaration(node) {
- return node.kind === 159 /* SetAccessor */;
+ return node.kind === 160 /* SetAccessor */;
}
ts.isSetAccessorDeclaration = isSetAccessorDeclaration;
function isCallSignatureDeclaration(node) {
- return node.kind === 160 /* CallSignature */;
+ return node.kind === 161 /* CallSignature */;
}
ts.isCallSignatureDeclaration = isCallSignatureDeclaration;
function isConstructSignatureDeclaration(node) {
- return node.kind === 161 /* ConstructSignature */;
+ return node.kind === 162 /* ConstructSignature */;
}
ts.isConstructSignatureDeclaration = isConstructSignatureDeclaration;
function isIndexSignatureDeclaration(node) {
- return node.kind === 162 /* IndexSignature */;
+ return node.kind === 163 /* IndexSignature */;
}
ts.isIndexSignatureDeclaration = isIndexSignatureDeclaration;
/* @internal */
function isGetOrSetAccessorDeclaration(node) {
- return node.kind === 159 /* SetAccessor */ || node.kind === 158 /* GetAccessor */;
+ return node.kind === 160 /* SetAccessor */ || node.kind === 159 /* GetAccessor */;
}
ts.isGetOrSetAccessorDeclaration = isGetOrSetAccessorDeclaration;
// Type
function isTypePredicateNode(node) {
- return node.kind === 163 /* TypePredicate */;
+ return node.kind === 164 /* TypePredicate */;
}
ts.isTypePredicateNode = isTypePredicateNode;
function isTypeReferenceNode(node) {
- return node.kind === 164 /* TypeReference */;
+ return node.kind === 165 /* TypeReference */;
}
ts.isTypeReferenceNode = isTypeReferenceNode;
function isFunctionTypeNode(node) {
- return node.kind === 165 /* FunctionType */;
+ return node.kind === 166 /* FunctionType */;
}
ts.isFunctionTypeNode = isFunctionTypeNode;
function isConstructorTypeNode(node) {
- return node.kind === 166 /* ConstructorType */;
+ return node.kind === 167 /* ConstructorType */;
}
ts.isConstructorTypeNode = isConstructorTypeNode;
function isTypeQueryNode(node) {
- return node.kind === 167 /* TypeQuery */;
+ return node.kind === 168 /* TypeQuery */;
}
ts.isTypeQueryNode = isTypeQueryNode;
function isTypeLiteralNode(node) {
- return node.kind === 168 /* TypeLiteral */;
+ return node.kind === 169 /* TypeLiteral */;
}
ts.isTypeLiteralNode = isTypeLiteralNode;
function isArrayTypeNode(node) {
- return node.kind === 169 /* ArrayType */;
+ return node.kind === 170 /* ArrayType */;
}
ts.isArrayTypeNode = isArrayTypeNode;
function isTupleTypeNode(node) {
- return node.kind === 170 /* TupleType */;
+ return node.kind === 171 /* TupleType */;
}
ts.isTupleTypeNode = isTupleTypeNode;
function isUnionTypeNode(node) {
- return node.kind === 173 /* UnionType */;
+ return node.kind === 174 /* UnionType */;
}
ts.isUnionTypeNode = isUnionTypeNode;
function isIntersectionTypeNode(node) {
- return node.kind === 174 /* IntersectionType */;
+ return node.kind === 175 /* IntersectionType */;
}
ts.isIntersectionTypeNode = isIntersectionTypeNode;
function isConditionalTypeNode(node) {
- return node.kind === 175 /* ConditionalType */;
+ return node.kind === 176 /* ConditionalType */;
}
ts.isConditionalTypeNode = isConditionalTypeNode;
function isInferTypeNode(node) {
- return node.kind === 176 /* InferType */;
+ return node.kind === 177 /* InferType */;
}
ts.isInferTypeNode = isInferTypeNode;
function isParenthesizedTypeNode(node) {
- return node.kind === 177 /* ParenthesizedType */;
+ return node.kind === 178 /* ParenthesizedType */;
}
ts.isParenthesizedTypeNode = isParenthesizedTypeNode;
function isThisTypeNode(node) {
- return node.kind === 178 /* ThisType */;
+ return node.kind === 179 /* ThisType */;
}
ts.isThisTypeNode = isThisTypeNode;
function isTypeOperatorNode(node) {
- return node.kind === 179 /* TypeOperator */;
+ return node.kind === 180 /* TypeOperator */;
}
ts.isTypeOperatorNode = isTypeOperatorNode;
function isIndexedAccessTypeNode(node) {
- return node.kind === 180 /* IndexedAccessType */;
+ return node.kind === 181 /* IndexedAccessType */;
}
ts.isIndexedAccessTypeNode = isIndexedAccessTypeNode;
function isMappedTypeNode(node) {
- return node.kind === 181 /* MappedType */;
+ return node.kind === 182 /* MappedType */;
}
ts.isMappedTypeNode = isMappedTypeNode;
function isLiteralTypeNode(node) {
- return node.kind === 182 /* LiteralType */;
+ return node.kind === 183 /* LiteralType */;
}
ts.isLiteralTypeNode = isLiteralTypeNode;
function isImportTypeNode(node) {
- return node.kind === 183 /* ImportType */;
+ return node.kind === 184 /* ImportType */;
}
ts.isImportTypeNode = isImportTypeNode;
// Binding patterns
function isObjectBindingPattern(node) {
- return node.kind === 184 /* ObjectBindingPattern */;
+ return node.kind === 185 /* ObjectBindingPattern */;
}
ts.isObjectBindingPattern = isObjectBindingPattern;
function isArrayBindingPattern(node) {
- return node.kind === 185 /* ArrayBindingPattern */;
+ return node.kind === 186 /* ArrayBindingPattern */;
}
ts.isArrayBindingPattern = isArrayBindingPattern;
function isBindingElement(node) {
- return node.kind === 186 /* BindingElement */;
+ return node.kind === 187 /* BindingElement */;
}
ts.isBindingElement = isBindingElement;
// Expression
function isArrayLiteralExpression(node) {
- return node.kind === 187 /* ArrayLiteralExpression */;
+ return node.kind === 188 /* ArrayLiteralExpression */;
}
ts.isArrayLiteralExpression = isArrayLiteralExpression;
function isObjectLiteralExpression(node) {
- return node.kind === 188 /* ObjectLiteralExpression */;
+ return node.kind === 189 /* ObjectLiteralExpression */;
}
ts.isObjectLiteralExpression = isObjectLiteralExpression;
function isPropertyAccessExpression(node) {
- return node.kind === 189 /* PropertyAccessExpression */;
+ return node.kind === 190 /* PropertyAccessExpression */;
}
ts.isPropertyAccessExpression = isPropertyAccessExpression;
function isElementAccessExpression(node) {
- return node.kind === 190 /* ElementAccessExpression */;
+ return node.kind === 191 /* ElementAccessExpression */;
}
ts.isElementAccessExpression = isElementAccessExpression;
function isCallExpression(node) {
- return node.kind === 191 /* CallExpression */;
+ return node.kind === 192 /* CallExpression */;
}
ts.isCallExpression = isCallExpression;
function isNewExpression(node) {
- return node.kind === 192 /* NewExpression */;
+ return node.kind === 193 /* NewExpression */;
}
ts.isNewExpression = isNewExpression;
function isTaggedTemplateExpression(node) {
- return node.kind === 193 /* TaggedTemplateExpression */;
+ return node.kind === 194 /* TaggedTemplateExpression */;
}
ts.isTaggedTemplateExpression = isTaggedTemplateExpression;
function isTypeAssertion(node) {
- return node.kind === 194 /* TypeAssertionExpression */;
+ return node.kind === 195 /* TypeAssertionExpression */;
}
ts.isTypeAssertion = isTypeAssertion;
function isConstTypeReference(node) {
@@ -13661,376 +13789,376 @@
}
ts.isConstTypeReference = isConstTypeReference;
function isParenthesizedExpression(node) {
- return node.kind === 195 /* ParenthesizedExpression */;
+ return node.kind === 196 /* ParenthesizedExpression */;
}
ts.isParenthesizedExpression = isParenthesizedExpression;
function skipPartiallyEmittedExpressions(node) {
- while (node.kind === 313 /* PartiallyEmittedExpression */) {
+ while (node.kind === 314 /* PartiallyEmittedExpression */) {
node = node.expression;
}
return node;
}
ts.skipPartiallyEmittedExpressions = skipPartiallyEmittedExpressions;
function isFunctionExpression(node) {
- return node.kind === 196 /* FunctionExpression */;
+ return node.kind === 197 /* FunctionExpression */;
}
ts.isFunctionExpression = isFunctionExpression;
function isArrowFunction(node) {
- return node.kind === 197 /* ArrowFunction */;
+ return node.kind === 198 /* ArrowFunction */;
}
ts.isArrowFunction = isArrowFunction;
function isDeleteExpression(node) {
- return node.kind === 198 /* DeleteExpression */;
+ return node.kind === 199 /* DeleteExpression */;
}
ts.isDeleteExpression = isDeleteExpression;
function isTypeOfExpression(node) {
- return node.kind === 199 /* TypeOfExpression */;
+ return node.kind === 200 /* TypeOfExpression */;
}
ts.isTypeOfExpression = isTypeOfExpression;
function isVoidExpression(node) {
- return node.kind === 200 /* VoidExpression */;
+ return node.kind === 201 /* VoidExpression */;
}
ts.isVoidExpression = isVoidExpression;
function isAwaitExpression(node) {
- return node.kind === 201 /* AwaitExpression */;
+ return node.kind === 202 /* AwaitExpression */;
}
ts.isAwaitExpression = isAwaitExpression;
function isPrefixUnaryExpression(node) {
- return node.kind === 202 /* PrefixUnaryExpression */;
+ return node.kind === 203 /* PrefixUnaryExpression */;
}
ts.isPrefixUnaryExpression = isPrefixUnaryExpression;
function isPostfixUnaryExpression(node) {
- return node.kind === 203 /* PostfixUnaryExpression */;
+ return node.kind === 204 /* PostfixUnaryExpression */;
}
ts.isPostfixUnaryExpression = isPostfixUnaryExpression;
function isBinaryExpression(node) {
- return node.kind === 204 /* BinaryExpression */;
+ return node.kind === 205 /* BinaryExpression */;
}
ts.isBinaryExpression = isBinaryExpression;
function isConditionalExpression(node) {
- return node.kind === 205 /* ConditionalExpression */;
+ return node.kind === 206 /* ConditionalExpression */;
}
ts.isConditionalExpression = isConditionalExpression;
function isTemplateExpression(node) {
- return node.kind === 206 /* TemplateExpression */;
+ return node.kind === 207 /* TemplateExpression */;
}
ts.isTemplateExpression = isTemplateExpression;
function isYieldExpression(node) {
- return node.kind === 207 /* YieldExpression */;
+ return node.kind === 208 /* YieldExpression */;
}
ts.isYieldExpression = isYieldExpression;
function isSpreadElement(node) {
- return node.kind === 208 /* SpreadElement */;
+ return node.kind === 209 /* SpreadElement */;
}
ts.isSpreadElement = isSpreadElement;
function isClassExpression(node) {
- return node.kind === 209 /* ClassExpression */;
+ return node.kind === 210 /* ClassExpression */;
}
ts.isClassExpression = isClassExpression;
function isOmittedExpression(node) {
- return node.kind === 210 /* OmittedExpression */;
+ return node.kind === 211 /* OmittedExpression */;
}
ts.isOmittedExpression = isOmittedExpression;
function isExpressionWithTypeArguments(node) {
- return node.kind === 211 /* ExpressionWithTypeArguments */;
+ return node.kind === 212 /* ExpressionWithTypeArguments */;
}
ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments;
function isAsExpression(node) {
- return node.kind === 212 /* AsExpression */;
+ return node.kind === 213 /* AsExpression */;
}
ts.isAsExpression = isAsExpression;
function isNonNullExpression(node) {
- return node.kind === 213 /* NonNullExpression */;
+ return node.kind === 214 /* NonNullExpression */;
}
ts.isNonNullExpression = isNonNullExpression;
function isMetaProperty(node) {
- return node.kind === 214 /* MetaProperty */;
+ return node.kind === 215 /* MetaProperty */;
}
ts.isMetaProperty = isMetaProperty;
// Misc
function isTemplateSpan(node) {
- return node.kind === 216 /* TemplateSpan */;
+ return node.kind === 217 /* TemplateSpan */;
}
ts.isTemplateSpan = isTemplateSpan;
function isSemicolonClassElement(node) {
- return node.kind === 217 /* SemicolonClassElement */;
+ return node.kind === 218 /* SemicolonClassElement */;
}
ts.isSemicolonClassElement = isSemicolonClassElement;
// Block
function isBlock(node) {
- return node.kind === 218 /* Block */;
+ return node.kind === 219 /* Block */;
}
ts.isBlock = isBlock;
function isVariableStatement(node) {
- return node.kind === 219 /* VariableStatement */;
+ return node.kind === 220 /* VariableStatement */;
}
ts.isVariableStatement = isVariableStatement;
function isEmptyStatement(node) {
- return node.kind === 220 /* EmptyStatement */;
+ return node.kind === 221 /* EmptyStatement */;
}
ts.isEmptyStatement = isEmptyStatement;
function isExpressionStatement(node) {
- return node.kind === 221 /* ExpressionStatement */;
+ return node.kind === 222 /* ExpressionStatement */;
}
ts.isExpressionStatement = isExpressionStatement;
function isIfStatement(node) {
- return node.kind === 222 /* IfStatement */;
+ return node.kind === 223 /* IfStatement */;
}
ts.isIfStatement = isIfStatement;
function isDoStatement(node) {
- return node.kind === 223 /* DoStatement */;
+ return node.kind === 224 /* DoStatement */;
}
ts.isDoStatement = isDoStatement;
function isWhileStatement(node) {
- return node.kind === 224 /* WhileStatement */;
+ return node.kind === 225 /* WhileStatement */;
}
ts.isWhileStatement = isWhileStatement;
function isForStatement(node) {
- return node.kind === 225 /* ForStatement */;
+ return node.kind === 226 /* ForStatement */;
}
ts.isForStatement = isForStatement;
function isForInStatement(node) {
- return node.kind === 226 /* ForInStatement */;
+ return node.kind === 227 /* ForInStatement */;
}
ts.isForInStatement = isForInStatement;
function isForOfStatement(node) {
- return node.kind === 227 /* ForOfStatement */;
+ return node.kind === 228 /* ForOfStatement */;
}
ts.isForOfStatement = isForOfStatement;
function isContinueStatement(node) {
- return node.kind === 228 /* ContinueStatement */;
+ return node.kind === 229 /* ContinueStatement */;
}
ts.isContinueStatement = isContinueStatement;
function isBreakStatement(node) {
- return node.kind === 229 /* BreakStatement */;
+ return node.kind === 230 /* BreakStatement */;
}
ts.isBreakStatement = isBreakStatement;
function isBreakOrContinueStatement(node) {
- return node.kind === 229 /* BreakStatement */ || node.kind === 228 /* ContinueStatement */;
+ return node.kind === 230 /* BreakStatement */ || node.kind === 229 /* ContinueStatement */;
}
ts.isBreakOrContinueStatement = isBreakOrContinueStatement;
function isReturnStatement(node) {
- return node.kind === 230 /* ReturnStatement */;
+ return node.kind === 231 /* ReturnStatement */;
}
ts.isReturnStatement = isReturnStatement;
function isWithStatement(node) {
- return node.kind === 231 /* WithStatement */;
+ return node.kind === 232 /* WithStatement */;
}
ts.isWithStatement = isWithStatement;
function isSwitchStatement(node) {
- return node.kind === 232 /* SwitchStatement */;
+ return node.kind === 233 /* SwitchStatement */;
}
ts.isSwitchStatement = isSwitchStatement;
function isLabeledStatement(node) {
- return node.kind === 233 /* LabeledStatement */;
+ return node.kind === 234 /* LabeledStatement */;
}
ts.isLabeledStatement = isLabeledStatement;
function isThrowStatement(node) {
- return node.kind === 234 /* ThrowStatement */;
+ return node.kind === 235 /* ThrowStatement */;
}
ts.isThrowStatement = isThrowStatement;
function isTryStatement(node) {
- return node.kind === 235 /* TryStatement */;
+ return node.kind === 236 /* TryStatement */;
}
ts.isTryStatement = isTryStatement;
function isDebuggerStatement(node) {
- return node.kind === 236 /* DebuggerStatement */;
+ return node.kind === 237 /* DebuggerStatement */;
}
ts.isDebuggerStatement = isDebuggerStatement;
function isVariableDeclaration(node) {
- return node.kind === 237 /* VariableDeclaration */;
+ return node.kind === 238 /* VariableDeclaration */;
}
ts.isVariableDeclaration = isVariableDeclaration;
function isVariableDeclarationList(node) {
- return node.kind === 238 /* VariableDeclarationList */;
+ return node.kind === 239 /* VariableDeclarationList */;
}
ts.isVariableDeclarationList = isVariableDeclarationList;
function isFunctionDeclaration(node) {
- return node.kind === 239 /* FunctionDeclaration */;
+ return node.kind === 240 /* FunctionDeclaration */;
}
ts.isFunctionDeclaration = isFunctionDeclaration;
function isClassDeclaration(node) {
- return node.kind === 240 /* ClassDeclaration */;
+ return node.kind === 241 /* ClassDeclaration */;
}
ts.isClassDeclaration = isClassDeclaration;
function isInterfaceDeclaration(node) {
- return node.kind === 241 /* InterfaceDeclaration */;
+ return node.kind === 242 /* InterfaceDeclaration */;
}
ts.isInterfaceDeclaration = isInterfaceDeclaration;
function isTypeAliasDeclaration(node) {
- return node.kind === 242 /* TypeAliasDeclaration */;
+ return node.kind === 243 /* TypeAliasDeclaration */;
}
ts.isTypeAliasDeclaration = isTypeAliasDeclaration;
function isEnumDeclaration(node) {
- return node.kind === 243 /* EnumDeclaration */;
+ return node.kind === 244 /* EnumDeclaration */;
}
ts.isEnumDeclaration = isEnumDeclaration;
function isModuleDeclaration(node) {
- return node.kind === 244 /* ModuleDeclaration */;
+ return node.kind === 245 /* ModuleDeclaration */;
}
ts.isModuleDeclaration = isModuleDeclaration;
function isModuleBlock(node) {
- return node.kind === 245 /* ModuleBlock */;
+ return node.kind === 246 /* ModuleBlock */;
}
ts.isModuleBlock = isModuleBlock;
function isCaseBlock(node) {
- return node.kind === 246 /* CaseBlock */;
+ return node.kind === 247 /* CaseBlock */;
}
ts.isCaseBlock = isCaseBlock;
function isNamespaceExportDeclaration(node) {
- return node.kind === 247 /* NamespaceExportDeclaration */;
+ return node.kind === 248 /* NamespaceExportDeclaration */;
}
ts.isNamespaceExportDeclaration = isNamespaceExportDeclaration;
function isImportEqualsDeclaration(node) {
- return node.kind === 248 /* ImportEqualsDeclaration */;
+ return node.kind === 249 /* ImportEqualsDeclaration */;
}
ts.isImportEqualsDeclaration = isImportEqualsDeclaration;
function isImportDeclaration(node) {
- return node.kind === 249 /* ImportDeclaration */;
+ return node.kind === 250 /* ImportDeclaration */;
}
ts.isImportDeclaration = isImportDeclaration;
function isImportClause(node) {
- return node.kind === 250 /* ImportClause */;
+ return node.kind === 251 /* ImportClause */;
}
ts.isImportClause = isImportClause;
function isNamespaceImport(node) {
- return node.kind === 251 /* NamespaceImport */;
+ return node.kind === 252 /* NamespaceImport */;
}
ts.isNamespaceImport = isNamespaceImport;
function isNamedImports(node) {
- return node.kind === 252 /* NamedImports */;
+ return node.kind === 253 /* NamedImports */;
}
ts.isNamedImports = isNamedImports;
function isImportSpecifier(node) {
- return node.kind === 253 /* ImportSpecifier */;
+ return node.kind === 254 /* ImportSpecifier */;
}
ts.isImportSpecifier = isImportSpecifier;
function isExportAssignment(node) {
- return node.kind === 254 /* ExportAssignment */;
+ return node.kind === 255 /* ExportAssignment */;
}
ts.isExportAssignment = isExportAssignment;
function isExportDeclaration(node) {
- return node.kind === 255 /* ExportDeclaration */;
+ return node.kind === 256 /* ExportDeclaration */;
}
ts.isExportDeclaration = isExportDeclaration;
function isNamedExports(node) {
- return node.kind === 256 /* NamedExports */;
+ return node.kind === 257 /* NamedExports */;
}
ts.isNamedExports = isNamedExports;
function isExportSpecifier(node) {
- return node.kind === 257 /* ExportSpecifier */;
+ return node.kind === 258 /* ExportSpecifier */;
}
ts.isExportSpecifier = isExportSpecifier;
function isMissingDeclaration(node) {
- return node.kind === 258 /* MissingDeclaration */;
+ return node.kind === 259 /* MissingDeclaration */;
}
ts.isMissingDeclaration = isMissingDeclaration;
// Module References
function isExternalModuleReference(node) {
- return node.kind === 259 /* ExternalModuleReference */;
+ return node.kind === 260 /* ExternalModuleReference */;
}
ts.isExternalModuleReference = isExternalModuleReference;
// JSX
function isJsxElement(node) {
- return node.kind === 260 /* JsxElement */;
+ return node.kind === 261 /* JsxElement */;
}
ts.isJsxElement = isJsxElement;
function isJsxSelfClosingElement(node) {
- return node.kind === 261 /* JsxSelfClosingElement */;
+ return node.kind === 262 /* JsxSelfClosingElement */;
}
ts.isJsxSelfClosingElement = isJsxSelfClosingElement;
function isJsxOpeningElement(node) {
- return node.kind === 262 /* JsxOpeningElement */;
+ return node.kind === 263 /* JsxOpeningElement */;
}
ts.isJsxOpeningElement = isJsxOpeningElement;
function isJsxClosingElement(node) {
- return node.kind === 263 /* JsxClosingElement */;
+ return node.kind === 264 /* JsxClosingElement */;
}
ts.isJsxClosingElement = isJsxClosingElement;
function isJsxFragment(node) {
- return node.kind === 264 /* JsxFragment */;
+ return node.kind === 265 /* JsxFragment */;
}
ts.isJsxFragment = isJsxFragment;
function isJsxOpeningFragment(node) {
- return node.kind === 265 /* JsxOpeningFragment */;
+ return node.kind === 266 /* JsxOpeningFragment */;
}
ts.isJsxOpeningFragment = isJsxOpeningFragment;
function isJsxClosingFragment(node) {
- return node.kind === 266 /* JsxClosingFragment */;
+ return node.kind === 267 /* JsxClosingFragment */;
}
ts.isJsxClosingFragment = isJsxClosingFragment;
function isJsxAttribute(node) {
- return node.kind === 267 /* JsxAttribute */;
+ return node.kind === 268 /* JsxAttribute */;
}
ts.isJsxAttribute = isJsxAttribute;
function isJsxAttributes(node) {
- return node.kind === 268 /* JsxAttributes */;
+ return node.kind === 269 /* JsxAttributes */;
}
ts.isJsxAttributes = isJsxAttributes;
function isJsxSpreadAttribute(node) {
- return node.kind === 269 /* JsxSpreadAttribute */;
+ return node.kind === 270 /* JsxSpreadAttribute */;
}
ts.isJsxSpreadAttribute = isJsxSpreadAttribute;
function isJsxExpression(node) {
- return node.kind === 270 /* JsxExpression */;
+ return node.kind === 271 /* JsxExpression */;
}
ts.isJsxExpression = isJsxExpression;
// Clauses
function isCaseClause(node) {
- return node.kind === 271 /* CaseClause */;
+ return node.kind === 272 /* CaseClause */;
}
ts.isCaseClause = isCaseClause;
function isDefaultClause(node) {
- return node.kind === 272 /* DefaultClause */;
+ return node.kind === 273 /* DefaultClause */;
}
ts.isDefaultClause = isDefaultClause;
function isHeritageClause(node) {
- return node.kind === 273 /* HeritageClause */;
+ return node.kind === 274 /* HeritageClause */;
}
ts.isHeritageClause = isHeritageClause;
function isCatchClause(node) {
- return node.kind === 274 /* CatchClause */;
+ return node.kind === 275 /* CatchClause */;
}
ts.isCatchClause = isCatchClause;
// Property assignments
function isPropertyAssignment(node) {
- return node.kind === 275 /* PropertyAssignment */;
+ return node.kind === 276 /* PropertyAssignment */;
}
ts.isPropertyAssignment = isPropertyAssignment;
function isShorthandPropertyAssignment(node) {
- return node.kind === 276 /* ShorthandPropertyAssignment */;
+ return node.kind === 277 /* ShorthandPropertyAssignment */;
}
ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment;
function isSpreadAssignment(node) {
- return node.kind === 277 /* SpreadAssignment */;
+ return node.kind === 278 /* SpreadAssignment */;
}
ts.isSpreadAssignment = isSpreadAssignment;
// Enum
function isEnumMember(node) {
- return node.kind === 278 /* EnumMember */;
+ return node.kind === 279 /* EnumMember */;
}
ts.isEnumMember = isEnumMember;
// Top-level nodes
function isSourceFile(node) {
- return node.kind === 284 /* SourceFile */;
+ return node.kind === 285 /* SourceFile */;
}
ts.isSourceFile = isSourceFile;
function isBundle(node) {
- return node.kind === 285 /* Bundle */;
+ return node.kind === 286 /* Bundle */;
}
ts.isBundle = isBundle;
function isUnparsedSource(node) {
- return node.kind === 286 /* UnparsedSource */;
+ return node.kind === 287 /* UnparsedSource */;
}
ts.isUnparsedSource = isUnparsedSource;
function isUnparsedPrepend(node) {
- return node.kind === 280 /* UnparsedPrepend */;
+ return node.kind === 281 /* UnparsedPrepend */;
}
ts.isUnparsedPrepend = isUnparsedPrepend;
function isUnparsedTextLike(node) {
switch (node.kind) {
- case 281 /* UnparsedText */:
- case 282 /* UnparsedInternalText */:
+ case 282 /* UnparsedText */:
+ case 283 /* UnparsedInternalText */:
return true;
default:
return false;
@@ -14039,101 +14167,101 @@
ts.isUnparsedTextLike = isUnparsedTextLike;
function isUnparsedNode(node) {
return isUnparsedTextLike(node) ||
- node.kind === 279 /* UnparsedPrologue */ ||
- node.kind === 283 /* UnparsedSyntheticReference */;
+ node.kind === 280 /* UnparsedPrologue */ ||
+ node.kind === 284 /* UnparsedSyntheticReference */;
}
ts.isUnparsedNode = isUnparsedNode;
// JSDoc
function isJSDocTypeExpression(node) {
- return node.kind === 288 /* JSDocTypeExpression */;
+ return node.kind === 289 /* JSDocTypeExpression */;
}
ts.isJSDocTypeExpression = isJSDocTypeExpression;
function isJSDocAllType(node) {
- return node.kind === 289 /* JSDocAllType */;
+ return node.kind === 290 /* JSDocAllType */;
}
ts.isJSDocAllType = isJSDocAllType;
function isJSDocUnknownType(node) {
- return node.kind === 290 /* JSDocUnknownType */;
+ return node.kind === 291 /* JSDocUnknownType */;
}
ts.isJSDocUnknownType = isJSDocUnknownType;
function isJSDocNullableType(node) {
- return node.kind === 291 /* JSDocNullableType */;
+ return node.kind === 292 /* JSDocNullableType */;
}
ts.isJSDocNullableType = isJSDocNullableType;
function isJSDocNonNullableType(node) {
- return node.kind === 292 /* JSDocNonNullableType */;
+ return node.kind === 293 /* JSDocNonNullableType */;
}
ts.isJSDocNonNullableType = isJSDocNonNullableType;
function isJSDocOptionalType(node) {
- return node.kind === 293 /* JSDocOptionalType */;
+ return node.kind === 294 /* JSDocOptionalType */;
}
ts.isJSDocOptionalType = isJSDocOptionalType;
function isJSDocFunctionType(node) {
- return node.kind === 294 /* JSDocFunctionType */;
+ return node.kind === 295 /* JSDocFunctionType */;
}
ts.isJSDocFunctionType = isJSDocFunctionType;
function isJSDocVariadicType(node) {
- return node.kind === 295 /* JSDocVariadicType */;
+ return node.kind === 296 /* JSDocVariadicType */;
}
ts.isJSDocVariadicType = isJSDocVariadicType;
function isJSDoc(node) {
- return node.kind === 296 /* JSDocComment */;
+ return node.kind === 297 /* JSDocComment */;
}
ts.isJSDoc = isJSDoc;
function isJSDocAugmentsTag(node) {
- return node.kind === 300 /* JSDocAugmentsTag */;
+ return node.kind === 301 /* JSDocAugmentsTag */;
}
ts.isJSDocAugmentsTag = isJSDocAugmentsTag;
function isJSDocClassTag(node) {
- return node.kind === 301 /* JSDocClassTag */;
+ return node.kind === 302 /* JSDocClassTag */;
}
ts.isJSDocClassTag = isJSDocClassTag;
function isJSDocEnumTag(node) {
- return node.kind === 303 /* JSDocEnumTag */;
+ return node.kind === 304 /* JSDocEnumTag */;
}
ts.isJSDocEnumTag = isJSDocEnumTag;
function isJSDocThisTag(node) {
- return node.kind === 306 /* JSDocThisTag */;
+ return node.kind === 307 /* JSDocThisTag */;
}
ts.isJSDocThisTag = isJSDocThisTag;
function isJSDocParameterTag(node) {
- return node.kind === 304 /* JSDocParameterTag */;
+ return node.kind === 305 /* JSDocParameterTag */;
}
ts.isJSDocParameterTag = isJSDocParameterTag;
function isJSDocReturnTag(node) {
- return node.kind === 305 /* JSDocReturnTag */;
+ return node.kind === 306 /* JSDocReturnTag */;
}
ts.isJSDocReturnTag = isJSDocReturnTag;
function isJSDocTypeTag(node) {
- return node.kind === 307 /* JSDocTypeTag */;
+ return node.kind === 308 /* JSDocTypeTag */;
}
ts.isJSDocTypeTag = isJSDocTypeTag;
function isJSDocTemplateTag(node) {
- return node.kind === 308 /* JSDocTemplateTag */;
+ return node.kind === 309 /* JSDocTemplateTag */;
}
ts.isJSDocTemplateTag = isJSDocTemplateTag;
function isJSDocTypedefTag(node) {
- return node.kind === 309 /* JSDocTypedefTag */;
+ return node.kind === 310 /* JSDocTypedefTag */;
}
ts.isJSDocTypedefTag = isJSDocTypedefTag;
function isJSDocPropertyTag(node) {
- return node.kind === 310 /* JSDocPropertyTag */;
+ return node.kind === 311 /* JSDocPropertyTag */;
}
ts.isJSDocPropertyTag = isJSDocPropertyTag;
function isJSDocPropertyLikeTag(node) {
- return node.kind === 310 /* JSDocPropertyTag */ || node.kind === 304 /* JSDocParameterTag */;
+ return node.kind === 311 /* JSDocPropertyTag */ || node.kind === 305 /* JSDocParameterTag */;
}
ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag;
function isJSDocTypeLiteral(node) {
- return node.kind === 297 /* JSDocTypeLiteral */;
+ return node.kind === 298 /* JSDocTypeLiteral */;
}
ts.isJSDocTypeLiteral = isJSDocTypeLiteral;
function isJSDocCallbackTag(node) {
- return node.kind === 302 /* JSDocCallbackTag */;
+ return node.kind === 303 /* JSDocCallbackTag */;
}
ts.isJSDocCallbackTag = isJSDocCallbackTag;
function isJSDocSignature(node) {
- return node.kind === 298 /* JSDocSignature */;
+ return node.kind === 299 /* JSDocSignature */;
}
ts.isJSDocSignature = isJSDocSignature;
})(ts || (ts = {}));
@@ -14144,7 +14272,7 @@
(function (ts) {
/* @internal */
function isSyntaxList(n) {
- return n.kind === 311 /* SyntaxList */;
+ return n.kind === 312 /* SyntaxList */;
}
ts.isSyntaxList = isSyntaxList;
/* @internal */
@@ -14154,7 +14282,7 @@
ts.isNode = isNode;
/* @internal */
function isNodeKind(kind) {
- return kind >= 148 /* FirstNode */;
+ return kind >= 149 /* FirstNode */;
}
ts.isNodeKind = isNodeKind;
/**
@@ -14163,7 +14291,7 @@
* Literals are considered tokens, except TemplateLiteral, but does include TemplateHead/Middle/Tail.
*/
function isToken(n) {
- return n.kind >= 0 /* FirstToken */ && n.kind <= 147 /* LastToken */;
+ return n.kind >= 0 /* FirstToken */ && n.kind <= 148 /* LastToken */;
}
ts.isToken = isToken;
// Node Arrays
@@ -14216,17 +14344,17 @@
/* @internal */
function isModifierKind(token) {
switch (token) {
- case 118 /* AbstractKeyword */:
- case 121 /* AsyncKeyword */:
- case 77 /* ConstKeyword */:
- case 125 /* DeclareKeyword */:
- case 80 /* DefaultKeyword */:
- case 85 /* ExportKeyword */:
- case 115 /* PublicKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 133 /* ReadonlyKeyword */:
- case 116 /* StaticKeyword */:
+ case 119 /* AbstractKeyword */:
+ case 122 /* AsyncKeyword */:
+ case 78 /* ConstKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 81 /* DefaultKeyword */:
+ case 86 /* ExportKeyword */:
+ case 116 /* PublicKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 134 /* ReadonlyKeyword */:
+ case 117 /* StaticKeyword */:
return true;
}
return false;
@@ -14239,7 +14367,7 @@
ts.isParameterPropertyModifier = isParameterPropertyModifier;
/* @internal */
function isClassMemberModifier(idToken) {
- return isParameterPropertyModifier(idToken) || idToken === 116 /* StaticKeyword */;
+ return isParameterPropertyModifier(idToken) || idToken === 117 /* StaticKeyword */;
}
ts.isClassMemberModifier = isClassMemberModifier;
function isModifier(node) {
@@ -14248,23 +14376,23 @@
ts.isModifier = isModifier;
function isEntityName(node) {
var kind = node.kind;
- return kind === 148 /* QualifiedName */
- || kind === 72 /* Identifier */;
+ return kind === 149 /* QualifiedName */
+ || kind === 73 /* Identifier */;
}
ts.isEntityName = isEntityName;
function isPropertyName(node) {
var kind = node.kind;
- return kind === 72 /* Identifier */
+ return kind === 73 /* Identifier */
|| kind === 10 /* StringLiteral */
|| kind === 8 /* NumericLiteral */
- || kind === 149 /* ComputedPropertyName */;
+ || kind === 150 /* ComputedPropertyName */;
}
ts.isPropertyName = isPropertyName;
function isBindingName(node) {
var kind = node.kind;
- return kind === 72 /* Identifier */
- || kind === 184 /* ObjectBindingPattern */
- || kind === 185 /* ArrayBindingPattern */;
+ return kind === 73 /* Identifier */
+ || kind === 185 /* ObjectBindingPattern */
+ || kind === 186 /* ArrayBindingPattern */;
}
ts.isBindingName = isBindingName;
// Functions
@@ -14279,13 +14407,13 @@
ts.isFunctionLikeDeclaration = isFunctionLikeDeclaration;
function isFunctionLikeDeclarationKind(kind) {
switch (kind) {
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return true;
default:
return false;
@@ -14294,14 +14422,14 @@
/* @internal */
function isFunctionLikeKind(kind) {
switch (kind) {
- case 155 /* MethodSignature */:
- case 160 /* CallSignature */:
- case 298 /* JSDocSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
- case 165 /* FunctionType */:
- case 294 /* JSDocFunctionType */:
- case 166 /* ConstructorType */:
+ case 156 /* MethodSignature */:
+ case 161 /* CallSignature */:
+ case 299 /* JSDocSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
+ case 166 /* FunctionType */:
+ case 295 /* JSDocFunctionType */:
+ case 167 /* ConstructorType */:
return true;
default:
return isFunctionLikeDeclarationKind(kind);
@@ -14316,29 +14444,29 @@
// Classes
function isClassElement(node) {
var kind = node.kind;
- return kind === 157 /* Constructor */
- || kind === 154 /* PropertyDeclaration */
- || kind === 156 /* MethodDeclaration */
- || kind === 158 /* GetAccessor */
- || kind === 159 /* SetAccessor */
- || kind === 162 /* IndexSignature */
- || kind === 217 /* SemicolonClassElement */;
+ return kind === 158 /* Constructor */
+ || kind === 155 /* PropertyDeclaration */
+ || kind === 157 /* MethodDeclaration */
+ || kind === 159 /* GetAccessor */
+ || kind === 160 /* SetAccessor */
+ || kind === 163 /* IndexSignature */
+ || kind === 218 /* SemicolonClassElement */;
}
ts.isClassElement = isClassElement;
function isClassLike(node) {
- return node && (node.kind === 240 /* ClassDeclaration */ || node.kind === 209 /* ClassExpression */);
+ return node && (node.kind === 241 /* ClassDeclaration */ || node.kind === 210 /* ClassExpression */);
}
ts.isClassLike = isClassLike;
function isAccessor(node) {
- return node && (node.kind === 158 /* GetAccessor */ || node.kind === 159 /* SetAccessor */);
+ return node && (node.kind === 159 /* GetAccessor */ || node.kind === 160 /* SetAccessor */);
}
ts.isAccessor = isAccessor;
/* @internal */
function isMethodOrAccessor(node) {
switch (node.kind) {
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return true;
default:
return false;
@@ -14348,11 +14476,11 @@
// Type members
function isTypeElement(node) {
var kind = node.kind;
- return kind === 161 /* ConstructSignature */
- || kind === 160 /* CallSignature */
- || kind === 153 /* PropertySignature */
- || kind === 155 /* MethodSignature */
- || kind === 162 /* IndexSignature */;
+ return kind === 162 /* ConstructSignature */
+ || kind === 161 /* CallSignature */
+ || kind === 154 /* PropertySignature */
+ || kind === 156 /* MethodSignature */
+ || kind === 163 /* IndexSignature */;
}
ts.isTypeElement = isTypeElement;
function isClassOrTypeElement(node) {
@@ -14361,12 +14489,12 @@
ts.isClassOrTypeElement = isClassOrTypeElement;
function isObjectLiteralElementLike(node) {
var kind = node.kind;
- return kind === 275 /* PropertyAssignment */
- || kind === 276 /* ShorthandPropertyAssignment */
- || kind === 277 /* SpreadAssignment */
- || kind === 156 /* MethodDeclaration */
- || kind === 158 /* GetAccessor */
- || kind === 159 /* SetAccessor */;
+ return kind === 276 /* PropertyAssignment */
+ || kind === 277 /* ShorthandPropertyAssignment */
+ || kind === 278 /* SpreadAssignment */
+ || kind === 157 /* MethodDeclaration */
+ || kind === 159 /* GetAccessor */
+ || kind === 160 /* SetAccessor */;
}
ts.isObjectLiteralElementLike = isObjectLiteralElementLike;
// Type
@@ -14381,8 +14509,8 @@
ts.isTypeNode = isTypeNode;
function isFunctionOrConstructorTypeNode(node) {
switch (node.kind) {
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
return true;
}
return false;
@@ -14393,8 +14521,8 @@
function isBindingPattern(node) {
if (node) {
var kind = node.kind;
- return kind === 185 /* ArrayBindingPattern */
- || kind === 184 /* ObjectBindingPattern */;
+ return kind === 186 /* ArrayBindingPattern */
+ || kind === 185 /* ObjectBindingPattern */;
}
return false;
}
@@ -14402,15 +14530,15 @@
/* @internal */
function isAssignmentPattern(node) {
var kind = node.kind;
- return kind === 187 /* ArrayLiteralExpression */
- || kind === 188 /* ObjectLiteralExpression */;
+ return kind === 188 /* ArrayLiteralExpression */
+ || kind === 189 /* ObjectLiteralExpression */;
}
ts.isAssignmentPattern = isAssignmentPattern;
/* @internal */
function isArrayBindingElement(node) {
var kind = node.kind;
- return kind === 186 /* BindingElement */
- || kind === 210 /* OmittedExpression */;
+ return kind === 187 /* BindingElement */
+ || kind === 211 /* OmittedExpression */;
}
ts.isArrayBindingElement = isArrayBindingElement;
/**
@@ -14419,9 +14547,9 @@
/* @internal */
function isDeclarationBindingElement(bindingElement) {
switch (bindingElement.kind) {
- case 237 /* VariableDeclaration */:
- case 151 /* Parameter */:
- case 186 /* BindingElement */:
+ case 238 /* VariableDeclaration */:
+ case 152 /* Parameter */:
+ case 187 /* BindingElement */:
return true;
}
return false;
@@ -14442,8 +14570,8 @@
/* @internal */
function isObjectBindingOrAssignmentPattern(node) {
switch (node.kind) {
- case 184 /* ObjectBindingPattern */:
- case 188 /* ObjectLiteralExpression */:
+ case 185 /* ObjectBindingPattern */:
+ case 189 /* ObjectLiteralExpression */:
return true;
}
return false;
@@ -14455,8 +14583,8 @@
/* @internal */
function isArrayBindingOrAssignmentPattern(node) {
switch (node.kind) {
- case 185 /* ArrayBindingPattern */:
- case 187 /* ArrayLiteralExpression */:
+ case 186 /* ArrayBindingPattern */:
+ case 188 /* ArrayLiteralExpression */:
return true;
}
return false;
@@ -14465,26 +14593,26 @@
/* @internal */
function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) {
var kind = node.kind;
- return kind === 189 /* PropertyAccessExpression */
- || kind === 148 /* QualifiedName */
- || kind === 183 /* ImportType */;
+ return kind === 190 /* PropertyAccessExpression */
+ || kind === 149 /* QualifiedName */
+ || kind === 184 /* ImportType */;
}
ts.isPropertyAccessOrQualifiedNameOrImportTypeNode = isPropertyAccessOrQualifiedNameOrImportTypeNode;
// Expression
function isPropertyAccessOrQualifiedName(node) {
var kind = node.kind;
- return kind === 189 /* PropertyAccessExpression */
- || kind === 148 /* QualifiedName */;
+ return kind === 190 /* PropertyAccessExpression */
+ || kind === 149 /* QualifiedName */;
}
ts.isPropertyAccessOrQualifiedName = isPropertyAccessOrQualifiedName;
function isCallLikeExpression(node) {
switch (node.kind) {
- case 262 /* JsxOpeningElement */:
- case 261 /* JsxSelfClosingElement */:
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
- case 193 /* TaggedTemplateExpression */:
- case 152 /* Decorator */:
+ case 263 /* JsxOpeningElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
+ case 194 /* TaggedTemplateExpression */:
+ case 153 /* Decorator */:
return true;
default:
return false;
@@ -14492,12 +14620,12 @@
}
ts.isCallLikeExpression = isCallLikeExpression;
function isCallOrNewExpression(node) {
- return node.kind === 191 /* CallExpression */ || node.kind === 192 /* NewExpression */;
+ return node.kind === 192 /* CallExpression */ || node.kind === 193 /* NewExpression */;
}
ts.isCallOrNewExpression = isCallOrNewExpression;
function isTemplateLiteral(node) {
var kind = node.kind;
- return kind === 206 /* TemplateExpression */
+ return kind === 207 /* TemplateExpression */
|| kind === 14 /* NoSubstitutionTemplateLiteral */;
}
ts.isTemplateLiteral = isTemplateLiteral;
@@ -14508,34 +14636,34 @@
ts.isLeftHandSideExpression = isLeftHandSideExpression;
function isLeftHandSideExpressionKind(kind) {
switch (kind) {
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
- case 192 /* NewExpression */:
- case 191 /* CallExpression */:
- case 260 /* JsxElement */:
- case 261 /* JsxSelfClosingElement */:
- case 264 /* JsxFragment */:
- case 193 /* TaggedTemplateExpression */:
- case 187 /* ArrayLiteralExpression */:
- case 195 /* ParenthesizedExpression */:
- case 188 /* ObjectLiteralExpression */:
- case 209 /* ClassExpression */:
- case 196 /* FunctionExpression */:
- case 72 /* Identifier */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
+ case 193 /* NewExpression */:
+ case 192 /* CallExpression */:
+ case 261 /* JsxElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 265 /* JsxFragment */:
+ case 194 /* TaggedTemplateExpression */:
+ case 188 /* ArrayLiteralExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 189 /* ObjectLiteralExpression */:
+ case 210 /* ClassExpression */:
+ case 197 /* FunctionExpression */:
+ case 73 /* Identifier */:
case 13 /* RegularExpressionLiteral */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
case 10 /* StringLiteral */:
case 14 /* NoSubstitutionTemplateLiteral */:
- case 206 /* TemplateExpression */:
- case 87 /* FalseKeyword */:
- case 96 /* NullKeyword */:
- case 100 /* ThisKeyword */:
- case 102 /* TrueKeyword */:
- case 98 /* SuperKeyword */:
- case 213 /* NonNullExpression */:
- case 214 /* MetaProperty */:
- case 92 /* ImportKeyword */: // technically this is only an Expression if it's in a CallExpression
+ case 207 /* TemplateExpression */:
+ case 88 /* FalseKeyword */:
+ case 97 /* NullKeyword */:
+ case 101 /* ThisKeyword */:
+ case 103 /* TrueKeyword */:
+ case 99 /* SuperKeyword */:
+ case 214 /* NonNullExpression */:
+ case 215 /* MetaProperty */:
+ case 93 /* ImportKeyword */: // technically this is only an Expression if it's in a CallExpression
return true;
default:
return false;
@@ -14548,13 +14676,13 @@
ts.isUnaryExpression = isUnaryExpression;
function isUnaryExpressionKind(kind) {
switch (kind) {
- case 202 /* PrefixUnaryExpression */:
- case 203 /* PostfixUnaryExpression */:
- case 198 /* DeleteExpression */:
- case 199 /* TypeOfExpression */:
- case 200 /* VoidExpression */:
- case 201 /* AwaitExpression */:
- case 194 /* TypeAssertionExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
+ case 199 /* DeleteExpression */:
+ case 200 /* TypeOfExpression */:
+ case 201 /* VoidExpression */:
+ case 202 /* AwaitExpression */:
+ case 195 /* TypeAssertionExpression */:
return true;
default:
return isLeftHandSideExpressionKind(kind);
@@ -14563,9 +14691,9 @@
/* @internal */
function isUnaryExpressionWithWrite(expr) {
switch (expr.kind) {
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return true;
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return expr.operator === 44 /* PlusPlusToken */ ||
expr.operator === 45 /* MinusMinusToken */;
default:
@@ -14584,15 +14712,15 @@
ts.isExpression = isExpression;
function isExpressionKind(kind) {
switch (kind) {
- case 205 /* ConditionalExpression */:
- case 207 /* YieldExpression */:
- case 197 /* ArrowFunction */:
- case 204 /* BinaryExpression */:
- case 208 /* SpreadElement */:
- case 212 /* AsExpression */:
- case 210 /* OmittedExpression */:
- case 314 /* CommaListExpression */:
- case 313 /* PartiallyEmittedExpression */:
+ case 206 /* ConditionalExpression */:
+ case 208 /* YieldExpression */:
+ case 198 /* ArrowFunction */:
+ case 205 /* BinaryExpression */:
+ case 209 /* SpreadElement */:
+ case 213 /* AsExpression */:
+ case 211 /* OmittedExpression */:
+ case 315 /* CommaListExpression */:
+ case 314 /* PartiallyEmittedExpression */:
return true;
default:
return isUnaryExpressionKind(kind);
@@ -14600,18 +14728,18 @@
}
function isAssertionExpression(node) {
var kind = node.kind;
- return kind === 194 /* TypeAssertionExpression */
- || kind === 212 /* AsExpression */;
+ return kind === 195 /* TypeAssertionExpression */
+ || kind === 213 /* AsExpression */;
}
ts.isAssertionExpression = isAssertionExpression;
/* @internal */
function isPartiallyEmittedExpression(node) {
- return node.kind === 313 /* PartiallyEmittedExpression */;
+ return node.kind === 314 /* PartiallyEmittedExpression */;
}
ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression;
/* @internal */
function isNotEmittedStatement(node) {
- return node.kind === 312 /* NotEmittedStatement */;
+ return node.kind === 313 /* NotEmittedStatement */;
}
ts.isNotEmittedStatement = isNotEmittedStatement;
/* @internal */
@@ -14622,13 +14750,13 @@
ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode;
function isIterationStatement(node, lookInLabeledStatements) {
switch (node.kind) {
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
return true;
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements);
}
return false;
@@ -14636,7 +14764,7 @@
ts.isIterationStatement = isIterationStatement;
/* @internal */
function isForInOrOfStatement(node) {
- return node.kind === 226 /* ForInStatement */ || node.kind === 227 /* ForOfStatement */;
+ return node.kind === 227 /* ForInStatement */ || node.kind === 228 /* ForOfStatement */;
}
ts.isForInOrOfStatement = isForInOrOfStatement;
// Element
@@ -14660,113 +14788,113 @@
/* @internal */
function isModuleBody(node) {
var kind = node.kind;
- return kind === 245 /* ModuleBlock */
- || kind === 244 /* ModuleDeclaration */
- || kind === 72 /* Identifier */;
+ return kind === 246 /* ModuleBlock */
+ || kind === 245 /* ModuleDeclaration */
+ || kind === 73 /* Identifier */;
}
ts.isModuleBody = isModuleBody;
/* @internal */
function isNamespaceBody(node) {
var kind = node.kind;
- return kind === 245 /* ModuleBlock */
- || kind === 244 /* ModuleDeclaration */;
+ return kind === 246 /* ModuleBlock */
+ || kind === 245 /* ModuleDeclaration */;
}
ts.isNamespaceBody = isNamespaceBody;
/* @internal */
function isJSDocNamespaceBody(node) {
var kind = node.kind;
- return kind === 72 /* Identifier */
- || kind === 244 /* ModuleDeclaration */;
+ return kind === 73 /* Identifier */
+ || kind === 245 /* ModuleDeclaration */;
}
ts.isJSDocNamespaceBody = isJSDocNamespaceBody;
/* @internal */
function isNamedImportBindings(node) {
var kind = node.kind;
- return kind === 252 /* NamedImports */
- || kind === 251 /* NamespaceImport */;
+ return kind === 253 /* NamedImports */
+ || kind === 252 /* NamespaceImport */;
}
ts.isNamedImportBindings = isNamedImportBindings;
/* @internal */
function isModuleOrEnumDeclaration(node) {
- return node.kind === 244 /* ModuleDeclaration */ || node.kind === 243 /* EnumDeclaration */;
+ return node.kind === 245 /* ModuleDeclaration */ || node.kind === 244 /* EnumDeclaration */;
}
ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration;
function isDeclarationKind(kind) {
- return kind === 197 /* ArrowFunction */
- || kind === 186 /* BindingElement */
- || kind === 240 /* ClassDeclaration */
- || kind === 209 /* ClassExpression */
- || kind === 157 /* Constructor */
- || kind === 243 /* EnumDeclaration */
- || kind === 278 /* EnumMember */
- || kind === 257 /* ExportSpecifier */
- || kind === 239 /* FunctionDeclaration */
- || kind === 196 /* FunctionExpression */
- || kind === 158 /* GetAccessor */
- || kind === 250 /* ImportClause */
- || kind === 248 /* ImportEqualsDeclaration */
- || kind === 253 /* ImportSpecifier */
- || kind === 241 /* InterfaceDeclaration */
- || kind === 267 /* JsxAttribute */
- || kind === 156 /* MethodDeclaration */
- || kind === 155 /* MethodSignature */
- || kind === 244 /* ModuleDeclaration */
- || kind === 247 /* NamespaceExportDeclaration */
- || kind === 251 /* NamespaceImport */
- || kind === 151 /* Parameter */
- || kind === 275 /* PropertyAssignment */
- || kind === 154 /* PropertyDeclaration */
- || kind === 153 /* PropertySignature */
- || kind === 159 /* SetAccessor */
- || kind === 276 /* ShorthandPropertyAssignment */
- || kind === 242 /* TypeAliasDeclaration */
- || kind === 150 /* TypeParameter */
- || kind === 237 /* VariableDeclaration */
- || kind === 309 /* JSDocTypedefTag */
- || kind === 302 /* JSDocCallbackTag */
- || kind === 310 /* JSDocPropertyTag */;
+ return kind === 198 /* ArrowFunction */
+ || kind === 187 /* BindingElement */
+ || kind === 241 /* ClassDeclaration */
+ || kind === 210 /* ClassExpression */
+ || kind === 158 /* Constructor */
+ || kind === 244 /* EnumDeclaration */
+ || kind === 279 /* EnumMember */
+ || kind === 258 /* ExportSpecifier */
+ || kind === 240 /* FunctionDeclaration */
+ || kind === 197 /* FunctionExpression */
+ || kind === 159 /* GetAccessor */
+ || kind === 251 /* ImportClause */
+ || kind === 249 /* ImportEqualsDeclaration */
+ || kind === 254 /* ImportSpecifier */
+ || kind === 242 /* InterfaceDeclaration */
+ || kind === 268 /* JsxAttribute */
+ || kind === 157 /* MethodDeclaration */
+ || kind === 156 /* MethodSignature */
+ || kind === 245 /* ModuleDeclaration */
+ || kind === 248 /* NamespaceExportDeclaration */
+ || kind === 252 /* NamespaceImport */
+ || kind === 152 /* Parameter */
+ || kind === 276 /* PropertyAssignment */
+ || kind === 155 /* PropertyDeclaration */
+ || kind === 154 /* PropertySignature */
+ || kind === 160 /* SetAccessor */
+ || kind === 277 /* ShorthandPropertyAssignment */
+ || kind === 243 /* TypeAliasDeclaration */
+ || kind === 151 /* TypeParameter */
+ || kind === 238 /* VariableDeclaration */
+ || kind === 310 /* JSDocTypedefTag */
+ || kind === 303 /* JSDocCallbackTag */
+ || kind === 311 /* JSDocPropertyTag */;
}
function isDeclarationStatementKind(kind) {
- return kind === 239 /* FunctionDeclaration */
- || kind === 258 /* MissingDeclaration */
- || kind === 240 /* ClassDeclaration */
- || kind === 241 /* InterfaceDeclaration */
- || kind === 242 /* TypeAliasDeclaration */
- || kind === 243 /* EnumDeclaration */
- || kind === 244 /* ModuleDeclaration */
- || kind === 249 /* ImportDeclaration */
- || kind === 248 /* ImportEqualsDeclaration */
- || kind === 255 /* ExportDeclaration */
- || kind === 254 /* ExportAssignment */
- || kind === 247 /* NamespaceExportDeclaration */;
+ return kind === 240 /* FunctionDeclaration */
+ || kind === 259 /* MissingDeclaration */
+ || kind === 241 /* ClassDeclaration */
+ || kind === 242 /* InterfaceDeclaration */
+ || kind === 243 /* TypeAliasDeclaration */
+ || kind === 244 /* EnumDeclaration */
+ || kind === 245 /* ModuleDeclaration */
+ || kind === 250 /* ImportDeclaration */
+ || kind === 249 /* ImportEqualsDeclaration */
+ || kind === 256 /* ExportDeclaration */
+ || kind === 255 /* ExportAssignment */
+ || kind === 248 /* NamespaceExportDeclaration */;
}
function isStatementKindButNotDeclarationKind(kind) {
- return kind === 229 /* BreakStatement */
- || kind === 228 /* ContinueStatement */
- || kind === 236 /* DebuggerStatement */
- || kind === 223 /* DoStatement */
- || kind === 221 /* ExpressionStatement */
- || kind === 220 /* EmptyStatement */
- || kind === 226 /* ForInStatement */
- || kind === 227 /* ForOfStatement */
- || kind === 225 /* ForStatement */
- || kind === 222 /* IfStatement */
- || kind === 233 /* LabeledStatement */
- || kind === 230 /* ReturnStatement */
- || kind === 232 /* SwitchStatement */
- || kind === 234 /* ThrowStatement */
- || kind === 235 /* TryStatement */
- || kind === 219 /* VariableStatement */
- || kind === 224 /* WhileStatement */
- || kind === 231 /* WithStatement */
- || kind === 312 /* NotEmittedStatement */
- || kind === 316 /* EndOfDeclarationMarker */
- || kind === 315 /* MergeDeclarationMarker */;
+ return kind === 230 /* BreakStatement */
+ || kind === 229 /* ContinueStatement */
+ || kind === 237 /* DebuggerStatement */
+ || kind === 224 /* DoStatement */
+ || kind === 222 /* ExpressionStatement */
+ || kind === 221 /* EmptyStatement */
+ || kind === 227 /* ForInStatement */
+ || kind === 228 /* ForOfStatement */
+ || kind === 226 /* ForStatement */
+ || kind === 223 /* IfStatement */
+ || kind === 234 /* LabeledStatement */
+ || kind === 231 /* ReturnStatement */
+ || kind === 233 /* SwitchStatement */
+ || kind === 235 /* ThrowStatement */
+ || kind === 236 /* TryStatement */
+ || kind === 220 /* VariableStatement */
+ || kind === 225 /* WhileStatement */
+ || kind === 232 /* WithStatement */
+ || kind === 313 /* NotEmittedStatement */
+ || kind === 317 /* EndOfDeclarationMarker */
+ || kind === 316 /* MergeDeclarationMarker */;
}
/* @internal */
function isDeclaration(node) {
- if (node.kind === 150 /* TypeParameter */) {
- return (node.parent && node.parent.kind !== 308 /* JSDocTemplateTag */) || ts.isInJSFile(node);
+ if (node.kind === 151 /* TypeParameter */) {
+ return (node.parent && node.parent.kind !== 309 /* JSDocTemplateTag */) || ts.isInJSFile(node);
}
return isDeclarationKind(node.kind);
}
@@ -14793,10 +14921,10 @@
}
ts.isStatement = isStatement;
function isBlockStatement(node) {
- if (node.kind !== 218 /* Block */)
+ if (node.kind !== 219 /* Block */)
return false;
if (node.parent !== undefined) {
- if (node.parent.kind === 235 /* TryStatement */ || node.parent.kind === 274 /* CatchClause */) {
+ if (node.parent.kind === 236 /* TryStatement */ || node.parent.kind === 275 /* CatchClause */) {
return false;
}
}
@@ -14806,81 +14934,81 @@
/* @internal */
function isModuleReference(node) {
var kind = node.kind;
- return kind === 259 /* ExternalModuleReference */
- || kind === 148 /* QualifiedName */
- || kind === 72 /* Identifier */;
+ return kind === 260 /* ExternalModuleReference */
+ || kind === 149 /* QualifiedName */
+ || kind === 73 /* Identifier */;
}
ts.isModuleReference = isModuleReference;
// JSX
/* @internal */
function isJsxTagNameExpression(node) {
var kind = node.kind;
- return kind === 100 /* ThisKeyword */
- || kind === 72 /* Identifier */
- || kind === 189 /* PropertyAccessExpression */;
+ return kind === 101 /* ThisKeyword */
+ || kind === 73 /* Identifier */
+ || kind === 190 /* PropertyAccessExpression */;
}
ts.isJsxTagNameExpression = isJsxTagNameExpression;
/* @internal */
function isJsxChild(node) {
var kind = node.kind;
- return kind === 260 /* JsxElement */
- || kind === 270 /* JsxExpression */
- || kind === 261 /* JsxSelfClosingElement */
+ return kind === 261 /* JsxElement */
+ || kind === 271 /* JsxExpression */
+ || kind === 262 /* JsxSelfClosingElement */
|| kind === 11 /* JsxText */
- || kind === 264 /* JsxFragment */;
+ || kind === 265 /* JsxFragment */;
}
ts.isJsxChild = isJsxChild;
/* @internal */
function isJsxAttributeLike(node) {
var kind = node.kind;
- return kind === 267 /* JsxAttribute */
- || kind === 269 /* JsxSpreadAttribute */;
+ return kind === 268 /* JsxAttribute */
+ || kind === 270 /* JsxSpreadAttribute */;
}
ts.isJsxAttributeLike = isJsxAttributeLike;
/* @internal */
function isStringLiteralOrJsxExpression(node) {
var kind = node.kind;
return kind === 10 /* StringLiteral */
- || kind === 270 /* JsxExpression */;
+ || kind === 271 /* JsxExpression */;
}
ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression;
function isJsxOpeningLikeElement(node) {
var kind = node.kind;
- return kind === 262 /* JsxOpeningElement */
- || kind === 261 /* JsxSelfClosingElement */;
+ return kind === 263 /* JsxOpeningElement */
+ || kind === 262 /* JsxSelfClosingElement */;
}
ts.isJsxOpeningLikeElement = isJsxOpeningLikeElement;
// Clauses
function isCaseOrDefaultClause(node) {
var kind = node.kind;
- return kind === 271 /* CaseClause */
- || kind === 272 /* DefaultClause */;
+ return kind === 272 /* CaseClause */
+ || kind === 273 /* DefaultClause */;
}
ts.isCaseOrDefaultClause = isCaseOrDefaultClause;
// JSDoc
/** True if node is of some JSDoc syntax kind. */
/* @internal */
function isJSDocNode(node) {
- return node.kind >= 288 /* FirstJSDocNode */ && node.kind <= 310 /* LastJSDocNode */;
+ return node.kind >= 289 /* FirstJSDocNode */ && node.kind <= 311 /* LastJSDocNode */;
}
ts.isJSDocNode = isJSDocNode;
/** True if node is of a kind that may contain comment text. */
function isJSDocCommentContainingNode(node) {
- return node.kind === 296 /* JSDocComment */ || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) || ts.isJSDocSignature(node);
+ return node.kind === 297 /* JSDocComment */ || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) || ts.isJSDocSignature(node);
}
ts.isJSDocCommentContainingNode = isJSDocCommentContainingNode;
// TODO: determine what this does before making it public.
/* @internal */
function isJSDocTag(node) {
- return node.kind >= 299 /* FirstJSDocTagNode */ && node.kind <= 310 /* LastJSDocTagNode */;
+ return node.kind >= 300 /* FirstJSDocTagNode */ && node.kind <= 311 /* LastJSDocTagNode */;
}
ts.isJSDocTag = isJSDocTag;
function isSetAccessor(node) {
- return node.kind === 159 /* SetAccessor */;
+ return node.kind === 160 /* SetAccessor */;
}
ts.isSetAccessor = isSetAccessor;
function isGetAccessor(node) {
- return node.kind === 158 /* GetAccessor */;
+ return node.kind === 159 /* GetAccessor */;
}
ts.isGetAccessor = isGetAccessor;
/** True if has jsdoc nodes attached to it. */
@@ -14910,12 +15038,12 @@
}
ts.hasOnlyExpressionInitializer = hasOnlyExpressionInitializer;
function isObjectLiteralElement(node) {
- return node.kind === 267 /* JsxAttribute */ || node.kind === 269 /* JsxSpreadAttribute */ || isObjectLiteralElementLike(node);
+ return node.kind === 268 /* JsxAttribute */ || node.kind === 270 /* JsxSpreadAttribute */ || isObjectLiteralElementLike(node);
}
ts.isObjectLiteralElement = isObjectLiteralElement;
/* @internal */
function isTypeReferenceType(node) {
- return node.kind === 164 /* TypeReference */ || node.kind === 211 /* ExpressionWithTypeArguments */;
+ return node.kind === 165 /* TypeReference */ || node.kind === 212 /* ExpressionWithTypeArguments */;
}
ts.isTypeReferenceType = isTypeReferenceType;
var MAX_SMI_X86 = 1073741823;
@@ -14951,7 +15079,7 @@
/* @internal */
(function (ts) {
function isNamedImportsOrExports(node) {
- return node.kind === 252 /* NamedImports */ || node.kind === 256 /* NamedExports */;
+ return node.kind === 253 /* NamedImports */ || node.kind === 257 /* NamedExports */;
}
ts.isNamedImportsOrExports = isNamedImportsOrExports;
function Symbol(flags, name) {
@@ -15202,6 +15330,11 @@
ts.semanticDiagnosticsOptionDeclarations.some(function (option) { return !ts.isJsonEqual(getCompilerOptionValue(oldOptions, option), getCompilerOptionValue(newOptions, option)); });
}
ts.compilerOptionsAffectSemanticDiagnostics = compilerOptionsAffectSemanticDiagnostics;
+ function compilerOptionsAffectEmit(newOptions, oldOptions) {
+ return oldOptions !== newOptions &&
+ ts.affectsEmitOptionDeclarations.some(function (option) { return !ts.isJsonEqual(getCompilerOptionValue(oldOptions, option), getCompilerOptionValue(newOptions, option)); });
+ }
+ ts.compilerOptionsAffectEmit = compilerOptionsAffectEmit;
function getCompilerOptionValue(options, option) {
return option.strictFlag ? getStrictOptionValue(options, option.name) : options[option.name];
}
@@ -15480,6 +15613,15 @@
return root + pathComponents.slice(1).join(ts.directorySeparator);
}
ts.getPathFromPathComponents = getPathFromPathComponents;
+ function getNormalizedAbsolutePathWithoutRoot(fileName, currentDirectory) {
+ return getPathWithoutRoot(getNormalizedPathComponents(fileName, currentDirectory));
+ }
+ ts.getNormalizedAbsolutePathWithoutRoot = getNormalizedAbsolutePathWithoutRoot;
+ function getPathWithoutRoot(pathComponents) {
+ if (pathComponents.length === 0)
+ return "";
+ return pathComponents.slice(1).join(ts.directorySeparator);
+ }
})(ts || (ts = {}));
/* @internal */
(function (ts) {
@@ -15510,7 +15652,7 @@
}
ts.getRelativePathFromFile = getRelativePathFromFile;
function getRelativePathFromDirectory(fromDirectory, to, getCanonicalFileNameOrIgnoreCase) {
- Debug.assert((ts.getRootLength(fromDirectory) > 0) === (ts.getRootLength(to) > 0), "Paths must either both be absolute or both be relative");
+ ts.Debug.assert((ts.getRootLength(fromDirectory) > 0) === (ts.getRootLength(to) > 0), "Paths must either both be absolute or both be relative");
var getCanonicalFileName = typeof getCanonicalFileNameOrIgnoreCase === "function" ? getCanonicalFileNameOrIgnoreCase : ts.identity;
var ignoreCase = typeof getCanonicalFileNameOrIgnoreCase === "boolean" ? getCanonicalFileNameOrIgnoreCase : false;
var pathComponents = getPathComponentsRelativeTo(fromDirectory, to, ignoreCase ? ts.equateStringsCaseInsensitive : ts.equateStringsCaseSensitive, getCanonicalFileName);
@@ -16154,32 +16296,9 @@
return pathext ? path.slice(0, path.length - pathext.length) + (ts.startsWith(ext, ".") ? ext : "." + ext) : path;
}
ts.changeAnyExtension = changeAnyExtension;
- var Debug;
- (function (Debug) {
- function showSymbol(symbol) {
- var symbolFlags = ts.SymbolFlags;
- return "{ flags: " + (symbolFlags ? showFlags(symbol.flags, symbolFlags) : symbol.flags) + "; declarations: " + ts.map(symbol.declarations, showSyntaxKind) + " }";
- }
- Debug.showSymbol = showSymbol;
- function showFlags(flags, flagsEnum) {
- var out = [];
- for (var pow = 0; pow <= 30; pow++) {
- var n = 1 << pow;
- if (flags & n) {
- out.push(flagsEnum[n]);
- }
- }
- return out.join("|");
- }
- function showSyntaxKind(node) {
- var syntaxKind = ts.SyntaxKind;
- return syntaxKind ? syntaxKind[node.kind] : node.kind.toString();
- }
- Debug.showSyntaxKind = showSyntaxKind;
- })(Debug = ts.Debug || (ts.Debug = {}));
function tryParsePattern(pattern) {
// This should be verified outside of here and a proper error thrown.
- Debug.assert(ts.hasZeroOrOneAsteriskCharacter(pattern));
+ ts.Debug.assert(ts.hasZeroOrOneAsteriskCharacter(pattern));
var indexOfStar = pattern.indexOf("*");
return indexOfStar === -1 ? undefined : {
prefix: pattern.substr(0, indexOfStar),
@@ -16208,7 +16327,7 @@
*/
function extensionFromPath(path) {
var ext = tryGetExtensionFromPath(path);
- return ext !== undefined ? ext : Debug.fail("File " + path + " has unknown extension.");
+ return ext !== undefined ? ext : ts.Debug.fail("File " + path + " has unknown extension.");
}
ts.extensionFromPath = extensionFromPath;
function isAnySupportedFileExtension(path) {
@@ -16280,7 +16399,7 @@
ts.matchPatternOrExact = matchPatternOrExact;
function sliceAfter(arr, value) {
var index = arr.indexOf(value);
- Debug.assert(index !== -1);
+ ts.Debug.assert(index !== -1);
return arr.slice(index);
}
ts.sliceAfter = sliceAfter;
@@ -16298,7 +16417,7 @@
}
ts.addRelatedInfo = addRelatedInfo;
function minAndMax(arr, getValue) {
- Debug.assert(arr.length !== 0);
+ ts.Debug.assert(arr.length !== 0);
var min = getValue(arr[0]);
var max = min;
for (var i = 1; i < arr.length; i++) {
@@ -16496,10 +16615,10 @@
var SourceFileConstructor;
// tslint:enable variable-name
function createNode(kind, pos, end) {
- if (kind === 284 /* SourceFile */) {
+ if (kind === 285 /* SourceFile */) {
return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end);
}
- else if (kind === 72 /* Identifier */) {
+ else if (kind === 73 /* Identifier */) {
return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, pos, end);
}
else if (!ts.isNodeKind(kind)) {
@@ -16548,19 +16667,19 @@
* that they appear in the source code. The language service depends on this property to locate nodes by position.
*/
function forEachChild(node, cbNode, cbNodes) {
- if (!node || node.kind <= 147 /* LastToken */) {
+ if (!node || node.kind <= 148 /* LastToken */) {
return;
}
switch (node.kind) {
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
return visitNode(cbNode, node.left) ||
visitNode(cbNode, node.right);
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.constraint) ||
visitNode(cbNode, node.default) ||
visitNode(cbNode, node.expression);
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
@@ -16568,9 +16687,9 @@
visitNode(cbNode, node.exclamationToken) ||
visitNode(cbNode, node.equalsToken) ||
visitNode(cbNode, node.objectAssignmentInitializer);
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
return visitNode(cbNode, node.expression);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.dotDotDotToken) ||
@@ -16578,7 +16697,7 @@
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.initializer);
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
@@ -16586,51 +16705,51 @@
visitNode(cbNode, node.exclamationToken) ||
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.initializer);
- case 153 /* PropertySignature */:
+ case 154 /* PropertySignature */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.initializer);
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.initializer);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.exclamationToken) ||
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.initializer);
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.dotDotDotToken) ||
visitNode(cbNode, node.propertyName) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.initializer);
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNodes(cbNode, cbNodes, node.typeParameters) ||
visitNodes(cbNode, cbNodes, node.parameters) ||
visitNode(cbNode, node.type);
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 196 /* FunctionExpression */:
- case 239 /* FunctionDeclaration */:
- case 197 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 197 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
+ case 198 /* ArrowFunction */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.asteriskToken) ||
@@ -16642,343 +16761,343 @@
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.equalsGreaterThanToken) ||
visitNode(cbNode, node.body);
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return visitNode(cbNode, node.typeName) ||
visitNodes(cbNode, cbNodes, node.typeArguments);
- case 163 /* TypePredicate */:
+ case 164 /* TypePredicate */:
return visitNode(cbNode, node.parameterName) ||
visitNode(cbNode, node.type);
- case 167 /* TypeQuery */:
+ case 168 /* TypeQuery */:
return visitNode(cbNode, node.exprName);
- case 168 /* TypeLiteral */:
+ case 169 /* TypeLiteral */:
return visitNodes(cbNode, cbNodes, node.members);
- case 169 /* ArrayType */:
+ case 170 /* ArrayType */:
return visitNode(cbNode, node.elementType);
- case 170 /* TupleType */:
+ case 171 /* TupleType */:
return visitNodes(cbNode, cbNodes, node.elementTypes);
- case 173 /* UnionType */:
- case 174 /* IntersectionType */:
+ case 174 /* UnionType */:
+ case 175 /* IntersectionType */:
return visitNodes(cbNode, cbNodes, node.types);
- case 175 /* ConditionalType */:
+ case 176 /* ConditionalType */:
return visitNode(cbNode, node.checkType) ||
visitNode(cbNode, node.extendsType) ||
visitNode(cbNode, node.trueType) ||
visitNode(cbNode, node.falseType);
- case 176 /* InferType */:
+ case 177 /* InferType */:
return visitNode(cbNode, node.typeParameter);
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return visitNode(cbNode, node.argument) ||
visitNode(cbNode, node.qualifier) ||
visitNodes(cbNode, cbNodes, node.typeArguments);
- case 177 /* ParenthesizedType */:
- case 179 /* TypeOperator */:
+ case 178 /* ParenthesizedType */:
+ case 180 /* TypeOperator */:
return visitNode(cbNode, node.type);
- case 180 /* IndexedAccessType */:
+ case 181 /* IndexedAccessType */:
return visitNode(cbNode, node.objectType) ||
visitNode(cbNode, node.indexType);
- case 181 /* MappedType */:
+ case 182 /* MappedType */:
return visitNode(cbNode, node.readonlyToken) ||
visitNode(cbNode, node.typeParameter) ||
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.type);
- case 182 /* LiteralType */:
+ case 183 /* LiteralType */:
return visitNode(cbNode, node.literal);
- case 184 /* ObjectBindingPattern */:
- case 185 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
return visitNodes(cbNode, cbNodes, node.elements);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return visitNodes(cbNode, cbNodes, node.elements);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return visitNodes(cbNode, cbNodes, node.properties);
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.name);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.argumentExpression);
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
return visitNode(cbNode, node.expression) ||
visitNodes(cbNode, cbNodes, node.typeArguments) ||
visitNodes(cbNode, cbNodes, node.arguments);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return visitNode(cbNode, node.tag) ||
visitNodes(cbNode, cbNodes, node.typeArguments) ||
visitNode(cbNode, node.template);
- case 194 /* TypeAssertionExpression */:
+ case 195 /* TypeAssertionExpression */:
return visitNode(cbNode, node.type) ||
visitNode(cbNode, node.expression);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return visitNode(cbNode, node.expression);
- case 198 /* DeleteExpression */:
+ case 199 /* DeleteExpression */:
return visitNode(cbNode, node.expression);
- case 199 /* TypeOfExpression */:
+ case 200 /* TypeOfExpression */:
return visitNode(cbNode, node.expression);
- case 200 /* VoidExpression */:
+ case 201 /* VoidExpression */:
return visitNode(cbNode, node.expression);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return visitNode(cbNode, node.operand);
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return visitNode(cbNode, node.asteriskToken) ||
visitNode(cbNode, node.expression);
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
return visitNode(cbNode, node.expression);
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return visitNode(cbNode, node.operand);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return visitNode(cbNode, node.left) ||
visitNode(cbNode, node.operatorToken) ||
visitNode(cbNode, node.right);
- case 212 /* AsExpression */:
+ case 213 /* AsExpression */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.type);
- case 213 /* NonNullExpression */:
+ case 214 /* NonNullExpression */:
return visitNode(cbNode, node.expression);
- case 214 /* MetaProperty */:
+ case 215 /* MetaProperty */:
return visitNode(cbNode, node.name);
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return visitNode(cbNode, node.condition) ||
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.whenTrue) ||
visitNode(cbNode, node.colonToken) ||
visitNode(cbNode, node.whenFalse);
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
return visitNode(cbNode, node.expression);
- case 218 /* Block */:
- case 245 /* ModuleBlock */:
+ case 219 /* Block */:
+ case 246 /* ModuleBlock */:
return visitNodes(cbNode, cbNodes, node.statements);
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return visitNodes(cbNode, cbNodes, node.statements) ||
visitNode(cbNode, node.endOfFileToken);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.declarationList);
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
return visitNodes(cbNode, cbNodes, node.declarations);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return visitNode(cbNode, node.expression);
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.thenStatement) ||
visitNode(cbNode, node.elseStatement);
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
return visitNode(cbNode, node.statement) ||
visitNode(cbNode, node.expression);
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.statement);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return visitNode(cbNode, node.initializer) ||
visitNode(cbNode, node.condition) ||
visitNode(cbNode, node.incrementor) ||
visitNode(cbNode, node.statement);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return visitNode(cbNode, node.initializer) ||
visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.statement);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return visitNode(cbNode, node.awaitModifier) ||
visitNode(cbNode, node.initializer) ||
visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.statement);
- case 228 /* ContinueStatement */:
- case 229 /* BreakStatement */:
+ case 229 /* ContinueStatement */:
+ case 230 /* BreakStatement */:
return visitNode(cbNode, node.label);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return visitNode(cbNode, node.expression);
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.statement);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.caseBlock);
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
return visitNodes(cbNode, cbNodes, node.clauses);
- case 271 /* CaseClause */:
+ case 272 /* CaseClause */:
return visitNode(cbNode, node.expression) ||
visitNodes(cbNode, cbNodes, node.statements);
- case 272 /* DefaultClause */:
+ case 273 /* DefaultClause */:
return visitNodes(cbNode, cbNodes, node.statements);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return visitNode(cbNode, node.label) ||
visitNode(cbNode, node.statement);
- case 234 /* ThrowStatement */:
+ case 235 /* ThrowStatement */:
return visitNode(cbNode, node.expression);
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
return visitNode(cbNode, node.tryBlock) ||
visitNode(cbNode, node.catchClause) ||
visitNode(cbNode, node.finallyBlock);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return visitNode(cbNode, node.variableDeclaration) ||
visitNode(cbNode, node.block);
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
return visitNode(cbNode, node.expression);
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNodes(cbNode, cbNodes, node.typeParameters) ||
visitNodes(cbNode, cbNodes, node.heritageClauses) ||
visitNodes(cbNode, cbNodes, node.members);
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNodes(cbNode, cbNodes, node.typeParameters) ||
visitNodes(cbNode, cbNodes, node.heritageClauses) ||
visitNodes(cbNode, cbNodes, node.members);
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNodes(cbNode, cbNodes, node.typeParameters) ||
visitNode(cbNode, node.type);
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNodes(cbNode, cbNodes, node.members);
- case 278 /* EnumMember */:
+ case 279 /* EnumMember */:
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.initializer);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.body);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.moduleReference);
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.importClause) ||
visitNode(cbNode, node.moduleSpecifier);
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.namedBindings);
- case 247 /* NamespaceExportDeclaration */:
+ case 248 /* NamespaceExportDeclaration */:
return visitNode(cbNode, node.name);
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
return visitNode(cbNode, node.name);
- case 252 /* NamedImports */:
- case 256 /* NamedExports */:
+ case 253 /* NamedImports */:
+ case 257 /* NamedExports */:
return visitNodes(cbNode, cbNodes, node.elements);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.exportClause) ||
visitNode(cbNode, node.moduleSpecifier);
- case 253 /* ImportSpecifier */:
- case 257 /* ExportSpecifier */:
+ case 254 /* ImportSpecifier */:
+ case 258 /* ExportSpecifier */:
return visitNode(cbNode, node.propertyName) ||
visitNode(cbNode, node.name);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.expression);
- case 206 /* TemplateExpression */:
+ case 207 /* TemplateExpression */:
return visitNode(cbNode, node.head) || visitNodes(cbNode, cbNodes, node.templateSpans);
- case 216 /* TemplateSpan */:
+ case 217 /* TemplateSpan */:
return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal);
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
return visitNode(cbNode, node.expression);
- case 273 /* HeritageClause */:
+ case 274 /* HeritageClause */:
return visitNodes(cbNode, cbNodes, node.types);
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return visitNode(cbNode, node.expression) ||
visitNodes(cbNode, cbNodes, node.typeArguments);
- case 259 /* ExternalModuleReference */:
+ case 260 /* ExternalModuleReference */:
return visitNode(cbNode, node.expression);
- case 258 /* MissingDeclaration */:
+ case 259 /* MissingDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators);
- case 314 /* CommaListExpression */:
+ case 315 /* CommaListExpression */:
return visitNodes(cbNode, cbNodes, node.elements);
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
return visitNode(cbNode, node.openingElement) ||
visitNodes(cbNode, cbNodes, node.children) ||
visitNode(cbNode, node.closingElement);
- case 264 /* JsxFragment */:
+ case 265 /* JsxFragment */:
return visitNode(cbNode, node.openingFragment) ||
visitNodes(cbNode, cbNodes, node.children) ||
visitNode(cbNode, node.closingFragment);
- case 261 /* JsxSelfClosingElement */:
- case 262 /* JsxOpeningElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
return visitNode(cbNode, node.tagName) ||
visitNodes(cbNode, cbNodes, node.typeArguments) ||
visitNode(cbNode, node.attributes);
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
return visitNodes(cbNode, cbNodes, node.properties);
- case 267 /* JsxAttribute */:
+ case 268 /* JsxAttribute */:
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.initializer);
- case 269 /* JsxSpreadAttribute */:
+ case 270 /* JsxSpreadAttribute */:
return visitNode(cbNode, node.expression);
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return visitNode(cbNode, node.dotDotDotToken) ||
visitNode(cbNode, node.expression);
- case 263 /* JsxClosingElement */:
+ case 264 /* JsxClosingElement */:
return visitNode(cbNode, node.tagName);
- case 171 /* OptionalType */:
- case 172 /* RestType */:
- case 288 /* JSDocTypeExpression */:
- case 292 /* JSDocNonNullableType */:
- case 291 /* JSDocNullableType */:
- case 293 /* JSDocOptionalType */:
- case 295 /* JSDocVariadicType */:
+ case 172 /* OptionalType */:
+ case 173 /* RestType */:
+ case 289 /* JSDocTypeExpression */:
+ case 293 /* JSDocNonNullableType */:
+ case 292 /* JSDocNullableType */:
+ case 294 /* JSDocOptionalType */:
+ case 296 /* JSDocVariadicType */:
return visitNode(cbNode, node.type);
- case 294 /* JSDocFunctionType */:
+ case 295 /* JSDocFunctionType */:
return visitNodes(cbNode, cbNodes, node.parameters) ||
visitNode(cbNode, node.type);
- case 296 /* JSDocComment */:
+ case 297 /* JSDocComment */:
return visitNodes(cbNode, cbNodes, node.tags);
- case 304 /* JSDocParameterTag */:
- case 310 /* JSDocPropertyTag */:
+ case 305 /* JSDocParameterTag */:
+ case 311 /* JSDocPropertyTag */:
return visitNode(cbNode, node.tagName) ||
(node.isNameFirst
? visitNode(cbNode, node.name) ||
visitNode(cbNode, node.typeExpression)
: visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.name));
- case 300 /* JSDocAugmentsTag */:
+ case 301 /* JSDocAugmentsTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.class);
- case 308 /* JSDocTemplateTag */:
+ case 309 /* JSDocTemplateTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.constraint) ||
visitNodes(cbNode, cbNodes, node.typeParameters);
- case 309 /* JSDocTypedefTag */:
+ case 310 /* JSDocTypedefTag */:
return visitNode(cbNode, node.tagName) ||
(node.typeExpression &&
- node.typeExpression.kind === 288 /* JSDocTypeExpression */
+ node.typeExpression.kind === 289 /* JSDocTypeExpression */
? visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.fullName)
: visitNode(cbNode, node.fullName) ||
visitNode(cbNode, node.typeExpression));
- case 302 /* JSDocCallbackTag */:
+ case 303 /* JSDocCallbackTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.fullName) ||
visitNode(cbNode, node.typeExpression);
- case 305 /* JSDocReturnTag */:
- case 307 /* JSDocTypeTag */:
- case 306 /* JSDocThisTag */:
- case 303 /* JSDocEnumTag */:
+ case 306 /* JSDocReturnTag */:
+ case 308 /* JSDocTypeTag */:
+ case 307 /* JSDocThisTag */:
+ case 304 /* JSDocEnumTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.typeExpression);
- case 298 /* JSDocSignature */:
+ case 299 /* JSDocSignature */:
return ts.forEach(node.typeParameters, cbNode) ||
ts.forEach(node.parameters, cbNode) ||
visitNode(cbNode, node.type);
- case 297 /* JSDocTypeLiteral */:
+ case 298 /* JSDocTypeLiteral */:
return ts.forEach(node.jsDocPropertyTags, cbNode);
- case 299 /* JSDocTag */:
- case 301 /* JSDocClassTag */:
+ case 300 /* JSDocTag */:
+ case 302 /* JSDocClassTag */:
return visitNode(cbNode, node.tagName);
- case 313 /* PartiallyEmittedExpression */:
+ case 314 /* PartiallyEmittedExpression */:
return visitNode(cbNode, node.expression);
}
}
@@ -17058,7 +17177,7 @@
(function (Parser) {
// Share a single scanner across all calls to parse a source file. This helps speed things
// up by avoiding the cost of creating/compiling scanners over and over again.
- var scanner = ts.createScanner(7 /* Latest */, /*skipTrivia*/ true);
+ var scanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ true);
var disallowInAndDecoratorContext = 2048 /* DisallowInContext */ | 8192 /* DecoratorContext */;
// capture constructors in 'initializeState' to avoid null checks
// tslint:disable variable-name
@@ -17196,14 +17315,14 @@
sourceFile.endOfFileToken = parseTokenNode();
}
else {
- var statement = createNode(221 /* ExpressionStatement */);
+ var statement = createNode(222 /* ExpressionStatement */);
switch (token()) {
case 22 /* OpenBracketToken */:
statement.expression = parseArrayLiteralExpression();
break;
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
- case 96 /* NullKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
+ case 97 /* NullKeyword */:
statement.expression = parseTokenNode();
break;
case 39 /* MinusToken */:
@@ -17352,7 +17471,7 @@
function createSourceFile(fileName, languageVersion, scriptKind, isDeclarationFile) {
// code from createNode is inlined here so createNode won't have to deal with special case of creating source files
// this is quite rare comparing to other nodes and createNode should be as fast as possible
- var sourceFile = new SourceFileConstructor(284 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length);
+ var sourceFile = new SourceFileConstructor(285 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length);
nodeCount++;
sourceFile.text = sourceText;
sourceFile.bindDiagnostics = [];
@@ -17495,6 +17614,9 @@
function nextToken() {
return currentToken = scanner.scan();
}
+ function nextTokenJSDoc() {
+ return currentToken = scanner.scanJsDocToken();
+ }
function reScanGreaterToken() {
return currentToken = scanner.reScanGreaterToken();
}
@@ -17560,20 +17682,20 @@
}
// Ignore strict mode flag because we will report an error in type checker instead.
function isIdentifier() {
- if (token() === 72 /* Identifier */) {
+ if (token() === 73 /* Identifier */) {
return true;
}
// If we have a 'yield' keyword, and we're in the [yield] context, then 'yield' is
// considered a keyword and is not an identifier.
- if (token() === 117 /* YieldKeyword */ && inYieldContext()) {
+ if (token() === 118 /* YieldKeyword */ && inYieldContext()) {
return false;
}
// If we have a 'await' keyword, and we're in the [Await] context, then 'await' is
// considered a keyword and is not an identifier.
- if (token() === 122 /* AwaitKeyword */ && inAwaitContext()) {
+ if (token() === 123 /* AwaitKeyword */ && inAwaitContext()) {
return false;
}
- return token() > 108 /* LastReservedWord */;
+ return token() > 109 /* LastReservedWord */;
}
function parseExpected(kind, diagnosticMessage, shouldAdvance) {
if (shouldAdvance === void 0) { shouldAdvance = true; }
@@ -17592,6 +17714,14 @@
}
return false;
}
+ function parseExpectedJSDoc(kind) {
+ if (token() === kind) {
+ nextTokenJSDoc();
+ return true;
+ }
+ parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind));
+ return false;
+ }
function parseOptional(t) {
if (token() === t) {
nextToken();
@@ -17605,15 +17735,30 @@
}
return undefined;
}
+ function parseOptionalTokenJSDoc(t) {
+ if (token() === t) {
+ return parseTokenNodeJSDoc();
+ }
+ return undefined;
+ }
function parseExpectedToken(t, diagnosticMessage, arg0) {
return parseOptionalToken(t) ||
createMissingNode(t, /*reportAtCurrentPosition*/ false, diagnosticMessage || ts.Diagnostics._0_expected, arg0 || ts.tokenToString(t));
}
+ function parseExpectedTokenJSDoc(t) {
+ return parseOptionalTokenJSDoc(t) ||
+ createMissingNode(t, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(t));
+ }
function parseTokenNode() {
var node = createNode(token());
nextToken();
return finishNode(node);
}
+ function parseTokenNodeJSDoc() {
+ var node = createNode(token());
+ nextTokenJSDoc();
+ return finishNode(node);
+ }
function canParseSemicolon() {
// If there's a real semicolon, then we can always parse it out.
if (token() === 26 /* SemicolonToken */) {
@@ -17638,7 +17783,7 @@
nodeCount++;
var p = pos >= 0 ? pos : scanner.getStartPos();
return ts.isNodeKind(kind) || kind === 0 /* Unknown */ ? new NodeConstructor(kind, p, p) :
- kind === 72 /* Identifier */ ? new IdentifierConstructor(kind, p, p) :
+ kind === 73 /* Identifier */ ? new IdentifierConstructor(kind, p, p) :
new TokenConstructor(kind, p, p);
}
function createNodeWithJSDoc(kind, pos) {
@@ -17680,7 +17825,7 @@
parseErrorAtCurrentToken(diagnosticMessage, arg0);
}
var result = createNode(kind);
- if (kind === 72 /* Identifier */) {
+ if (kind === 73 /* Identifier */) {
result.escapedText = "";
}
else if (ts.isLiteralKind(kind) || ts.isTemplateLiteralKind(kind)) {
@@ -17701,9 +17846,9 @@
function createIdentifier(isIdentifier, diagnosticMessage) {
identifierCount++;
if (isIdentifier) {
- var node = createNode(72 /* Identifier */);
+ var node = createNode(73 /* Identifier */);
// Store original token kind if it is not just an Identifier so we can report appropriate error later in type checker
- if (token() !== 72 /* Identifier */) {
+ if (token() !== 73 /* Identifier */) {
node.originalKeywordKind = token();
}
node.escapedText = ts.escapeLeadingUnderscores(internIdentifier(scanner.getTokenValue()));
@@ -17712,7 +17857,7 @@
}
// Only for end of file because the error gets reported incorrectly on embedded script tags.
var reportAtCurrentPosition = token() === 1 /* EndOfFileToken */;
- return createMissingNode(72 /* Identifier */, reportAtCurrentPosition, diagnosticMessage || ts.Diagnostics.Identifier_expected);
+ return createMissingNode(73 /* Identifier */, reportAtCurrentPosition, diagnosticMessage || ts.Diagnostics.Identifier_expected);
}
function parseIdentifier(diagnosticMessage) {
return createIdentifier(isIdentifier(), diagnosticMessage);
@@ -17743,7 +17888,7 @@
// PropertyName [Yield]:
// LiteralPropertyName
// ComputedPropertyName[?Yield]
- var node = createNode(149 /* ComputedPropertyName */);
+ var node = createNode(150 /* ComputedPropertyName */);
parseExpected(22 /* OpenBracketToken */);
// We parse any expression (including a comma expression). But the grammar
// says that only an assignment expression is allowed, so the grammar checker
@@ -17764,20 +17909,20 @@
}
function nextTokenCanFollowModifier() {
switch (token()) {
- case 77 /* ConstKeyword */:
+ case 78 /* ConstKeyword */:
// 'const' is only a modifier if followed by 'enum'.
- return nextToken() === 84 /* EnumKeyword */;
- case 85 /* ExportKeyword */:
+ return nextToken() === 85 /* EnumKeyword */;
+ case 86 /* ExportKeyword */:
nextToken();
- if (token() === 80 /* DefaultKeyword */) {
+ if (token() === 81 /* DefaultKeyword */) {
return lookAhead(nextTokenCanFollowDefaultKeyword);
}
- return token() !== 40 /* AsteriskToken */ && token() !== 119 /* AsKeyword */ && token() !== 18 /* OpenBraceToken */ && canFollowModifier();
- case 80 /* DefaultKeyword */:
+ return token() !== 40 /* AsteriskToken */ && token() !== 120 /* AsKeyword */ && token() !== 18 /* OpenBraceToken */ && canFollowModifier();
+ case 81 /* DefaultKeyword */:
return nextTokenCanFollowDefaultKeyword();
- case 116 /* StaticKeyword */:
- case 126 /* GetKeyword */:
- case 137 /* SetKeyword */:
+ case 117 /* StaticKeyword */:
+ case 127 /* GetKeyword */:
+ case 138 /* SetKeyword */:
nextToken();
return canFollowModifier();
default:
@@ -17796,10 +17941,10 @@
}
function nextTokenCanFollowDefaultKeyword() {
nextToken();
- return token() === 76 /* ClassKeyword */ || token() === 90 /* FunctionKeyword */ ||
- token() === 110 /* InterfaceKeyword */ ||
- (token() === 118 /* AbstractKeyword */ && lookAhead(nextTokenIsClassKeywordOnSameLine)) ||
- (token() === 121 /* AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine));
+ return token() === 77 /* ClassKeyword */ || token() === 91 /* FunctionKeyword */ ||
+ token() === 111 /* InterfaceKeyword */ ||
+ (token() === 119 /* AbstractKeyword */ && lookAhead(nextTokenIsClassKeywordOnSameLine)) ||
+ (token() === 122 /* AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine));
}
// True if positioned at the start of a list element
function isListElement(parsingContext, inErrorRecovery) {
@@ -17819,7 +17964,7 @@
// outer module. We just want to consume and move on.
return !(token() === 26 /* SemicolonToken */ && inErrorRecovery) && isStartOfStatement();
case 2 /* SwitchClauses */:
- return token() === 74 /* CaseKeyword */ || token() === 80 /* DefaultKeyword */;
+ return token() === 75 /* CaseKeyword */ || token() === 81 /* DefaultKeyword */;
case 4 /* TypeMembers */:
return lookAhead(isTypeMemberStart);
case 5 /* ClassMembers */:
@@ -17905,7 +18050,7 @@
// extends {} extends
// extends {} implements
var next = nextToken();
- return next === 27 /* CommaToken */ || next === 18 /* OpenBraceToken */ || next === 86 /* ExtendsKeyword */ || next === 109 /* ImplementsKeyword */;
+ return next === 27 /* CommaToken */ || next === 18 /* OpenBraceToken */ || next === 87 /* ExtendsKeyword */ || next === 110 /* ImplementsKeyword */;
}
return true;
}
@@ -17922,8 +18067,8 @@
return ts.tokenIsIdentifierOrKeywordOrGreaterThan(token());
}
function isHeritageClauseExtendsOrImplementsKeyword() {
- if (token() === 109 /* ImplementsKeyword */ ||
- token() === 86 /* ExtendsKeyword */) {
+ if (token() === 110 /* ImplementsKeyword */ ||
+ token() === 87 /* ExtendsKeyword */) {
return lookAhead(nextTokenIsStartOfExpression);
}
return false;
@@ -17953,14 +18098,14 @@
case 23 /* ImportOrExportSpecifiers */:
return token() === 19 /* CloseBraceToken */;
case 3 /* SwitchClauseStatements */:
- return token() === 19 /* CloseBraceToken */ || token() === 74 /* CaseKeyword */ || token() === 80 /* DefaultKeyword */;
+ return token() === 19 /* CloseBraceToken */ || token() === 75 /* CaseKeyword */ || token() === 81 /* DefaultKeyword */;
case 7 /* HeritageClauseElement */:
- return token() === 18 /* OpenBraceToken */ || token() === 86 /* ExtendsKeyword */ || token() === 109 /* ImplementsKeyword */;
+ return token() === 18 /* OpenBraceToken */ || token() === 87 /* ExtendsKeyword */ || token() === 110 /* ImplementsKeyword */;
case 8 /* VariableDeclarations */:
return isVariableDeclaratorListTerminator();
case 19 /* TypeParameters */:
// Tokens other than '>' are here for better error recovery
- return token() === 30 /* GreaterThanToken */ || token() === 20 /* OpenParenToken */ || token() === 18 /* OpenBraceToken */ || token() === 86 /* ExtendsKeyword */ || token() === 109 /* ImplementsKeyword */;
+ return token() === 30 /* GreaterThanToken */ || token() === 20 /* OpenParenToken */ || token() === 18 /* OpenBraceToken */ || token() === 87 /* ExtendsKeyword */ || token() === 110 /* ImplementsKeyword */;
case 11 /* ArgumentExpressions */:
// Tokens other than ')' are here for better error recovery
return token() === 21 /* CloseParenToken */ || token() === 26 /* SemicolonToken */;
@@ -18177,20 +18322,20 @@
function isReusableClassMember(node) {
if (node) {
switch (node.kind) {
- case 157 /* Constructor */:
- case 162 /* IndexSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 154 /* PropertyDeclaration */:
- case 217 /* SemicolonClassElement */:
+ case 158 /* Constructor */:
+ case 163 /* IndexSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 155 /* PropertyDeclaration */:
+ case 218 /* SemicolonClassElement */:
return true;
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
// Method declarations are not necessarily reusable. An object-literal
// may have a method calls "constructor(...)" and we must reparse that
// into an actual .ConstructorDeclaration.
var methodDeclaration = node;
- var nameIsConstructor = methodDeclaration.name.kind === 72 /* Identifier */ &&
- methodDeclaration.name.originalKeywordKind === 124 /* ConstructorKeyword */;
+ var nameIsConstructor = methodDeclaration.name.kind === 73 /* Identifier */ &&
+ methodDeclaration.name.originalKeywordKind === 125 /* ConstructorKeyword */;
return !nameIsConstructor;
}
}
@@ -18199,8 +18344,8 @@
function isReusableSwitchClause(node) {
if (node) {
switch (node.kind) {
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
return true;
}
}
@@ -18209,58 +18354,58 @@
function isReusableStatement(node) {
if (node) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 219 /* VariableStatement */:
- case 218 /* Block */:
- case 222 /* IfStatement */:
- case 221 /* ExpressionStatement */:
- case 234 /* ThrowStatement */:
- case 230 /* ReturnStatement */:
- case 232 /* SwitchStatement */:
- case 229 /* BreakStatement */:
- case 228 /* ContinueStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 225 /* ForStatement */:
- case 224 /* WhileStatement */:
- case 231 /* WithStatement */:
- case 220 /* EmptyStatement */:
- case 235 /* TryStatement */:
- case 233 /* LabeledStatement */:
- case 223 /* DoStatement */:
- case 236 /* DebuggerStatement */:
- case 249 /* ImportDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
- case 255 /* ExportDeclaration */:
- case 254 /* ExportAssignment */:
- case 244 /* ModuleDeclaration */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
- case 242 /* TypeAliasDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 220 /* VariableStatement */:
+ case 219 /* Block */:
+ case 223 /* IfStatement */:
+ case 222 /* ExpressionStatement */:
+ case 235 /* ThrowStatement */:
+ case 231 /* ReturnStatement */:
+ case 233 /* SwitchStatement */:
+ case 230 /* BreakStatement */:
+ case 229 /* ContinueStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 226 /* ForStatement */:
+ case 225 /* WhileStatement */:
+ case 232 /* WithStatement */:
+ case 221 /* EmptyStatement */:
+ case 236 /* TryStatement */:
+ case 234 /* LabeledStatement */:
+ case 224 /* DoStatement */:
+ case 237 /* DebuggerStatement */:
+ case 250 /* ImportDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 256 /* ExportDeclaration */:
+ case 255 /* ExportAssignment */:
+ case 245 /* ModuleDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return true;
}
}
return false;
}
function isReusableEnumMember(node) {
- return node.kind === 278 /* EnumMember */;
+ return node.kind === 279 /* EnumMember */;
}
function isReusableTypeMember(node) {
if (node) {
switch (node.kind) {
- case 161 /* ConstructSignature */:
- case 155 /* MethodSignature */:
- case 162 /* IndexSignature */:
- case 153 /* PropertySignature */:
- case 160 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 156 /* MethodSignature */:
+ case 163 /* IndexSignature */:
+ case 154 /* PropertySignature */:
+ case 161 /* CallSignature */:
return true;
}
}
return false;
}
function isReusableVariableDeclaration(node) {
- if (node.kind !== 237 /* VariableDeclaration */) {
+ if (node.kind !== 238 /* VariableDeclaration */) {
return false;
}
// Very subtle incremental parsing bug. Consider the following code:
@@ -18281,7 +18426,7 @@
return variableDeclarator.initializer === undefined;
}
function isReusableParameter(node) {
- if (node.kind !== 151 /* Parameter */) {
+ if (node.kind !== 152 /* Parameter */) {
return false;
}
// See the comment in isReusableVariableDeclaration for why we do this.
@@ -18417,7 +18562,7 @@
return entity;
}
function createQualifiedName(entity, name) {
- var node = createNode(148 /* QualifiedName */, entity.pos);
+ var node = createNode(149 /* QualifiedName */, entity.pos);
node.left = entity;
node.right = name;
return finishNode(node);
@@ -18448,13 +18593,13 @@
// Report that we need an identifier. However, report it right after the dot,
// and not on the next token. This is because the next token might actually
// be an identifier and the error would be quite confusing.
- return createMissingNode(72 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Identifier_expected);
+ return createMissingNode(73 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Identifier_expected);
}
}
return allowIdentifierNames ? parseIdentifierName() : parseIdentifier();
}
function parseTemplateExpression() {
- var template = createNode(206 /* TemplateExpression */);
+ var template = createNode(207 /* TemplateExpression */);
template.head = parseTemplateHead();
ts.Debug.assert(template.head.kind === 15 /* TemplateHead */, "Template head has wrong token kind");
var list = [];
@@ -18466,7 +18611,7 @@
return finishNode(template);
}
function parseTemplateSpan() {
- var span = createNode(216 /* TemplateSpan */);
+ var span = createNode(217 /* TemplateSpan */);
span.expression = allowInAnd(parseExpression);
var literal;
if (token() === 19 /* CloseBraceToken */) {
@@ -18516,7 +18661,7 @@
}
// TYPES
function parseTypeReference() {
- var node = createNode(164 /* TypeReference */);
+ var node = createNode(165 /* TypeReference */);
node.typeName = parseEntityName(/*allowReservedWords*/ true, ts.Diagnostics.Type_expected);
if (!scanner.hasPrecedingLineBreak() && reScanLessThanToken() === 28 /* LessThanToken */) {
node.typeArguments = parseBracketedList(20 /* TypeArguments */, parseType, 28 /* LessThanToken */, 30 /* GreaterThanToken */);
@@ -18526,14 +18671,14 @@
// If true, we should abort parsing an error function.
function typeHasArrowFunctionBlockingParseError(node) {
switch (node.kind) {
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return ts.nodeIsMissing(node.typeName);
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */: {
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */: {
var _a = node, parameters = _a.parameters, type = _a.type;
return isMissingList(parameters) || typeHasArrowFunctionBlockingParseError(type);
}
- case 177 /* ParenthesizedType */:
+ case 178 /* ParenthesizedType */:
return typeHasArrowFunctionBlockingParseError(node.type);
default:
return false;
@@ -18541,20 +18686,20 @@
}
function parseThisTypePredicate(lhs) {
nextToken();
- var node = createNode(163 /* TypePredicate */, lhs.pos);
+ var node = createNode(164 /* TypePredicate */, lhs.pos);
node.parameterName = lhs;
node.type = parseType();
return finishNode(node);
}
function parseThisTypeNode() {
- var node = createNode(178 /* ThisType */);
+ var node = createNode(179 /* ThisType */);
nextToken();
return finishNode(node);
}
function parseJSDocAllType(postFixEquals) {
- var result = createNode(289 /* JSDocAllType */);
+ var result = createNode(290 /* JSDocAllType */);
if (postFixEquals) {
- return createPostfixType(293 /* JSDocOptionalType */, result);
+ return createPostfixType(294 /* JSDocOptionalType */, result);
}
else {
nextToken();
@@ -18562,7 +18707,7 @@
return finishNode(result);
}
function parseJSDocNonNullableType() {
- var result = createNode(292 /* JSDocNonNullableType */);
+ var result = createNode(293 /* JSDocNonNullableType */);
nextToken();
result.type = parseNonArrayType();
return finishNode(result);
@@ -18584,31 +18729,31 @@
token() === 19 /* CloseBraceToken */ ||
token() === 21 /* CloseParenToken */ ||
token() === 30 /* GreaterThanToken */ ||
- token() === 59 /* EqualsToken */ ||
+ token() === 60 /* EqualsToken */ ||
token() === 50 /* BarToken */) {
- var result = createNode(290 /* JSDocUnknownType */, pos);
+ var result = createNode(291 /* JSDocUnknownType */, pos);
return finishNode(result);
}
else {
- var result = createNode(291 /* JSDocNullableType */, pos);
+ var result = createNode(292 /* JSDocNullableType */, pos);
result.type = parseType();
return finishNode(result);
}
}
function parseJSDocFunctionType() {
if (lookAhead(nextTokenIsOpenParen)) {
- var result = createNodeWithJSDoc(294 /* JSDocFunctionType */);
+ var result = createNodeWithJSDoc(295 /* JSDocFunctionType */);
nextToken();
fillSignature(57 /* ColonToken */, 4 /* Type */ | 32 /* JSDoc */, result);
return finishNode(result);
}
- var node = createNode(164 /* TypeReference */);
+ var node = createNode(165 /* TypeReference */);
node.typeName = parseIdentifierName();
return finishNode(node);
}
function parseJSDocParameter() {
- var parameter = createNode(151 /* Parameter */);
- if (token() === 100 /* ThisKeyword */ || token() === 95 /* NewKeyword */) {
+ var parameter = createNode(152 /* Parameter */);
+ if (token() === 101 /* ThisKeyword */ || token() === 96 /* NewKeyword */) {
parameter.name = parseIdentifierName();
parseExpected(57 /* ColonToken */);
}
@@ -18621,25 +18766,25 @@
var type = parseTypeOrTypePredicate();
scanner.setInJSDocType(false);
if (dotdotdot) {
- var variadic = createNode(295 /* JSDocVariadicType */, dotdotdot.pos);
+ var variadic = createNode(296 /* JSDocVariadicType */, dotdotdot.pos);
variadic.type = type;
type = finishNode(variadic);
}
- if (token() === 59 /* EqualsToken */) {
- return createPostfixType(293 /* JSDocOptionalType */, type);
+ if (token() === 60 /* EqualsToken */) {
+ return createPostfixType(294 /* JSDocOptionalType */, type);
}
return type;
}
function parseTypeQuery() {
- var node = createNode(167 /* TypeQuery */);
- parseExpected(104 /* TypeOfKeyword */);
+ var node = createNode(168 /* TypeQuery */);
+ parseExpected(105 /* TypeOfKeyword */);
node.exprName = parseEntityName(/*allowReservedWords*/ true);
return finishNode(node);
}
function parseTypeParameter() {
- var node = createNode(150 /* TypeParameter */);
+ var node = createNode(151 /* TypeParameter */);
node.name = parseIdentifier();
- if (parseOptional(86 /* ExtendsKeyword */)) {
+ if (parseOptional(87 /* ExtendsKeyword */)) {
// It's not uncommon for people to write improper constraints to a generic. If the
// user writes a constraint that is an expression and not an actual type, then parse
// it out as an expression (so we can recover well), but report that a type is needed
@@ -18658,7 +18803,7 @@
node.expression = parseUnaryExpressionOrHigher();
}
}
- if (parseOptional(59 /* EqualsToken */)) {
+ if (parseOptional(60 /* EqualsToken */)) {
node.default = parseType();
}
return finishNode(node);
@@ -18682,8 +18827,8 @@
isStartOfType(/*inStartOfParameter*/ !isJSDocParameter);
}
function parseParameter() {
- var node = createNodeWithJSDoc(151 /* Parameter */);
- if (token() === 100 /* ThisKeyword */) {
+ var node = createNodeWithJSDoc(152 /* Parameter */);
+ if (token() === 101 /* ThisKeyword */) {
node.name = createIdentifier(/*isIdentifier*/ true);
node.type = parseParameterType();
return finishNode(node);
@@ -18783,8 +18928,8 @@
}
function parseSignatureMember(kind) {
var node = createNodeWithJSDoc(kind);
- if (kind === 161 /* ConstructSignature */) {
- parseExpected(95 /* NewKeyword */);
+ if (kind === 162 /* ConstructSignature */) {
+ parseExpected(96 /* NewKeyword */);
}
fillSignature(57 /* ColonToken */, 4 /* Type */, node);
parseTypeMemberSemicolon();
@@ -18844,7 +18989,7 @@
return token() === 57 /* ColonToken */ || token() === 27 /* CommaToken */ || token() === 23 /* CloseBracketToken */;
}
function parseIndexSignatureDeclaration(node) {
- node.kind = 162 /* IndexSignature */;
+ node.kind = 163 /* IndexSignature */;
node.parameters = parseBracketedList(16 /* Parameters */, parseParameter, 22 /* OpenBracketToken */, 23 /* CloseBracketToken */);
node.type = parseTypeAnnotation();
parseTypeMemberSemicolon();
@@ -18854,15 +18999,15 @@
node.name = parsePropertyName();
node.questionToken = parseOptionalToken(56 /* QuestionToken */);
if (token() === 20 /* OpenParenToken */ || token() === 28 /* LessThanToken */) {
- node.kind = 155 /* MethodSignature */;
+ node.kind = 156 /* MethodSignature */;
// Method signatures don't exist in expression contexts. So they have neither
// [Yield] nor [Await]
fillSignature(57 /* ColonToken */, 4 /* Type */, node);
}
else {
- node.kind = 153 /* PropertySignature */;
+ node.kind = 154 /* PropertySignature */;
node.type = parseTypeAnnotation();
- if (token() === 59 /* EqualsToken */) {
+ if (token() === 60 /* EqualsToken */) {
// Although type literal properties cannot not have initializers, we attempt
// to parse an initializer so we can report in the checker that an interface
// property or type literal property cannot have an initializer.
@@ -18906,10 +19051,10 @@
}
function parseTypeMember() {
if (token() === 20 /* OpenParenToken */ || token() === 28 /* LessThanToken */) {
- return parseSignatureMember(160 /* CallSignature */);
+ return parseSignatureMember(161 /* CallSignature */);
}
- if (token() === 95 /* NewKeyword */ && lookAhead(nextTokenIsOpenParenOrLessThan)) {
- return parseSignatureMember(161 /* ConstructSignature */);
+ if (token() === 96 /* NewKeyword */ && lookAhead(nextTokenIsOpenParenOrLessThan)) {
+ return parseSignatureMember(162 /* ConstructSignature */);
}
var node = createNodeWithJSDoc(0 /* Unknown */);
node.modifiers = parseModifiers();
@@ -18935,7 +19080,7 @@
return false;
}
function parseTypeLiteral() {
- var node = createNode(168 /* TypeLiteral */);
+ var node = createNode(169 /* TypeLiteral */);
node.members = parseObjectTypeMembers();
return finishNode(node);
}
@@ -18953,27 +19098,27 @@
function isStartOfMappedType() {
nextToken();
if (token() === 38 /* PlusToken */ || token() === 39 /* MinusToken */) {
- return nextToken() === 133 /* ReadonlyKeyword */;
+ return nextToken() === 134 /* ReadonlyKeyword */;
}
- if (token() === 133 /* ReadonlyKeyword */) {
+ if (token() === 134 /* ReadonlyKeyword */) {
nextToken();
}
- return token() === 22 /* OpenBracketToken */ && nextTokenIsIdentifier() && nextToken() === 93 /* InKeyword */;
+ return token() === 22 /* OpenBracketToken */ && nextTokenIsIdentifier() && nextToken() === 94 /* InKeyword */;
}
function parseMappedTypeParameter() {
- var node = createNode(150 /* TypeParameter */);
+ var node = createNode(151 /* TypeParameter */);
node.name = parseIdentifier();
- parseExpected(93 /* InKeyword */);
+ parseExpected(94 /* InKeyword */);
node.constraint = parseType();
return finishNode(node);
}
function parseMappedType() {
- var node = createNode(181 /* MappedType */);
+ var node = createNode(182 /* MappedType */);
parseExpected(18 /* OpenBraceToken */);
- if (token() === 133 /* ReadonlyKeyword */ || token() === 38 /* PlusToken */ || token() === 39 /* MinusToken */) {
+ if (token() === 134 /* ReadonlyKeyword */ || token() === 38 /* PlusToken */ || token() === 39 /* MinusToken */) {
node.readonlyToken = parseTokenNode();
- if (node.readonlyToken.kind !== 133 /* ReadonlyKeyword */) {
- parseExpectedToken(133 /* ReadonlyKeyword */);
+ if (node.readonlyToken.kind !== 134 /* ReadonlyKeyword */) {
+ parseExpectedToken(134 /* ReadonlyKeyword */);
}
}
parseExpected(22 /* OpenBracketToken */);
@@ -18993,23 +19138,23 @@
function parseTupleElementType() {
var pos = getNodePos();
if (parseOptional(25 /* DotDotDotToken */)) {
- var node = createNode(172 /* RestType */, pos);
+ var node = createNode(173 /* RestType */, pos);
node.type = parseType();
return finishNode(node);
}
var type = parseType();
- if (!(contextFlags & 2097152 /* JSDoc */) && type.kind === 291 /* JSDocNullableType */ && type.pos === type.type.pos) {
- type.kind = 171 /* OptionalType */;
+ if (!(contextFlags & 2097152 /* JSDoc */) && type.kind === 292 /* JSDocNullableType */ && type.pos === type.type.pos) {
+ type.kind = 172 /* OptionalType */;
}
return type;
}
function parseTupleType() {
- var node = createNode(170 /* TupleType */);
+ var node = createNode(171 /* TupleType */);
node.elementTypes = parseBracketedList(21 /* TupleElementTypes */, parseTupleElementType, 22 /* OpenBracketToken */, 23 /* CloseBracketToken */);
return finishNode(node);
}
function parseParenthesizedType() {
- var node = createNode(177 /* ParenthesizedType */);
+ var node = createNode(178 /* ParenthesizedType */);
parseExpected(20 /* OpenParenToken */);
node.type = parseType();
parseExpected(21 /* CloseParenToken */);
@@ -19017,7 +19162,7 @@
}
function parseFunctionOrConstructorType() {
var pos = getNodePos();
- var kind = parseOptional(95 /* NewKeyword */) ? 166 /* ConstructorType */ : 165 /* FunctionType */;
+ var kind = parseOptional(96 /* NewKeyword */) ? 167 /* ConstructorType */ : 166 /* FunctionType */;
var node = createNodeWithJSDoc(kind, pos);
fillSignature(37 /* EqualsGreaterThanToken */, 4 /* Type */, node);
return finishNode(node);
@@ -19027,14 +19172,14 @@
return token() === 24 /* DotToken */ ? undefined : node;
}
function parseLiteralTypeNode(negative) {
- var node = createNode(182 /* LiteralType */);
+ var node = createNode(183 /* LiteralType */);
var unaryMinusExpression;
if (negative) {
- unaryMinusExpression = createNode(202 /* PrefixUnaryExpression */);
+ unaryMinusExpression = createNode(203 /* PrefixUnaryExpression */);
unaryMinusExpression.operator = 39 /* MinusToken */;
nextToken();
}
- var expression = token() === 102 /* TrueKeyword */ || token() === 87 /* FalseKeyword */
+ var expression = token() === 103 /* TrueKeyword */ || token() === 88 /* FalseKeyword */
? parseTokenNode()
: parseLiteralLikeNode(token());
if (negative) {
@@ -19047,22 +19192,24 @@
}
function isStartOfTypeOfImportType() {
nextToken();
- return token() === 92 /* ImportKeyword */;
+ return token() === 93 /* ImportKeyword */;
}
function parseImportType() {
sourceFile.flags |= 524288 /* PossiblyContainsDynamicImport */;
- var node = createNode(183 /* ImportType */);
- if (parseOptional(104 /* TypeOfKeyword */)) {
+ var node = createNode(184 /* ImportType */);
+ if (parseOptional(105 /* TypeOfKeyword */)) {
node.isTypeOf = true;
}
- parseExpected(92 /* ImportKeyword */);
+ parseExpected(93 /* ImportKeyword */);
parseExpected(20 /* OpenParenToken */);
node.argument = parseType();
parseExpected(21 /* CloseParenToken */);
if (parseOptional(24 /* DotToken */)) {
node.qualifier = parseEntityName(/*allowReservedWords*/ true, ts.Diagnostics.Type_expected);
}
- node.typeArguments = tryParseTypeArguments();
+ if (!scanner.hasPrecedingLineBreak() && reScanLessThanToken() === 28 /* LessThanToken */) {
+ node.typeArguments = parseBracketedList(20 /* TypeArguments */, parseType, 28 /* LessThanToken */, 30 /* GreaterThanToken */);
+ }
return finishNode(node);
}
function nextTokenIsNumericOrBigIntLiteral() {
@@ -19071,25 +19218,25 @@
}
function parseNonArrayType() {
switch (token()) {
- case 120 /* AnyKeyword */:
- case 143 /* UnknownKeyword */:
- case 138 /* StringKeyword */:
- case 135 /* NumberKeyword */:
- case 146 /* BigIntKeyword */:
- case 139 /* SymbolKeyword */:
- case 123 /* BooleanKeyword */:
- case 141 /* UndefinedKeyword */:
- case 132 /* NeverKeyword */:
- case 136 /* ObjectKeyword */:
+ case 121 /* AnyKeyword */:
+ case 144 /* UnknownKeyword */:
+ case 139 /* StringKeyword */:
+ case 136 /* NumberKeyword */:
+ case 147 /* BigIntKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 142 /* UndefinedKeyword */:
+ case 133 /* NeverKeyword */:
+ case 137 /* ObjectKeyword */:
// If these are followed by a dot, then parse these out as a dotted type reference instead.
return tryParse(parseKeywordAndNoDot) || parseTypeReference();
case 40 /* AsteriskToken */:
return parseJSDocAllType(/*postfixEquals*/ false);
- case 62 /* AsteriskEqualsToken */:
+ case 63 /* AsteriskEqualsToken */:
return parseJSDocAllType(/*postfixEquals*/ true);
case 56 /* QuestionToken */:
return parseJSDocUnknownOrNullableType();
- case 90 /* FunctionKeyword */:
+ case 91 /* FunctionKeyword */:
return parseJSDocFunctionType();
case 52 /* ExclamationToken */:
return parseJSDocNonNullableType();
@@ -19097,24 +19244,24 @@
case 10 /* StringLiteral */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
return parseLiteralTypeNode();
case 39 /* MinusToken */:
return lookAhead(nextTokenIsNumericOrBigIntLiteral) ? parseLiteralTypeNode(/*negative*/ true) : parseTypeReference();
- case 106 /* VoidKeyword */:
- case 96 /* NullKeyword */:
+ case 107 /* VoidKeyword */:
+ case 97 /* NullKeyword */:
return parseTokenNode();
- case 100 /* ThisKeyword */: {
+ case 101 /* ThisKeyword */: {
var thisKeyword = parseThisTypeNode();
- if (token() === 128 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) {
+ if (token() === 129 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) {
return parseThisTypePredicate(thisKeyword);
}
else {
return thisKeyword;
}
}
- case 104 /* TypeOfKeyword */:
+ case 105 /* TypeOfKeyword */:
return lookAhead(isStartOfTypeOfImportType) ? parseImportType() : parseTypeQuery();
case 18 /* OpenBraceToken */:
return lookAhead(isStartOfMappedType) ? parseMappedType() : parseTypeLiteral();
@@ -19122,7 +19269,7 @@
return parseTupleType();
case 20 /* OpenParenToken */:
return parseParenthesizedType();
- case 92 /* ImportKeyword */:
+ case 93 /* ImportKeyword */:
return parseImportType();
default:
return parseTypeReference();
@@ -19130,41 +19277,41 @@
}
function isStartOfType(inStartOfParameter) {
switch (token()) {
- case 120 /* AnyKeyword */:
- case 143 /* UnknownKeyword */:
- case 138 /* StringKeyword */:
- case 135 /* NumberKeyword */:
- case 146 /* BigIntKeyword */:
- case 123 /* BooleanKeyword */:
- case 133 /* ReadonlyKeyword */:
- case 139 /* SymbolKeyword */:
- case 142 /* UniqueKeyword */:
- case 106 /* VoidKeyword */:
- case 141 /* UndefinedKeyword */:
- case 96 /* NullKeyword */:
- case 100 /* ThisKeyword */:
- case 104 /* TypeOfKeyword */:
- case 132 /* NeverKeyword */:
+ case 121 /* AnyKeyword */:
+ case 144 /* UnknownKeyword */:
+ case 139 /* StringKeyword */:
+ case 136 /* NumberKeyword */:
+ case 147 /* BigIntKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 134 /* ReadonlyKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 143 /* UniqueKeyword */:
+ case 107 /* VoidKeyword */:
+ case 142 /* UndefinedKeyword */:
+ case 97 /* NullKeyword */:
+ case 101 /* ThisKeyword */:
+ case 105 /* TypeOfKeyword */:
+ case 133 /* NeverKeyword */:
case 18 /* OpenBraceToken */:
case 22 /* OpenBracketToken */:
case 28 /* LessThanToken */:
case 50 /* BarToken */:
case 49 /* AmpersandToken */:
- case 95 /* NewKeyword */:
+ case 96 /* NewKeyword */:
case 10 /* StringLiteral */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
- case 136 /* ObjectKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
+ case 137 /* ObjectKeyword */:
case 40 /* AsteriskToken */:
case 56 /* QuestionToken */:
case 52 /* ExclamationToken */:
case 25 /* DotDotDotToken */:
- case 127 /* InferKeyword */:
- case 92 /* ImportKeyword */:
+ case 128 /* InferKeyword */:
+ case 93 /* ImportKeyword */:
return true;
- case 90 /* FunctionKeyword */:
+ case 91 /* FunctionKeyword */:
return !inStartOfParameter;
case 39 /* MinusToken */:
return !inStartOfParameter && lookAhead(nextTokenIsNumericOrBigIntLiteral);
@@ -19185,26 +19332,26 @@
while (!scanner.hasPrecedingLineBreak()) {
switch (token()) {
case 52 /* ExclamationToken */:
- type = createPostfixType(292 /* JSDocNonNullableType */, type);
+ type = createPostfixType(293 /* JSDocNonNullableType */, type);
break;
case 56 /* QuestionToken */:
// If not in JSDoc and next token is start of a type we have a conditional type
if (!(contextFlags & 2097152 /* JSDoc */) && lookAhead(nextTokenIsStartOfType)) {
return type;
}
- type = createPostfixType(291 /* JSDocNullableType */, type);
+ type = createPostfixType(292 /* JSDocNullableType */, type);
break;
case 22 /* OpenBracketToken */:
parseExpected(22 /* OpenBracketToken */);
if (isStartOfType()) {
- var node = createNode(180 /* IndexedAccessType */, type.pos);
+ var node = createNode(181 /* IndexedAccessType */, type.pos);
node.objectType = type;
node.indexType = parseType();
parseExpected(23 /* CloseBracketToken */);
type = finishNode(node);
}
else {
- var node = createNode(169 /* ArrayType */, type.pos);
+ var node = createNode(170 /* ArrayType */, type.pos);
node.elementType = type;
parseExpected(23 /* CloseBracketToken */);
type = finishNode(node);
@@ -19223,16 +19370,16 @@
return finishNode(postfix);
}
function parseTypeOperator(operator) {
- var node = createNode(179 /* TypeOperator */);
+ var node = createNode(180 /* TypeOperator */);
parseExpected(operator);
node.operator = operator;
node.type = parseTypeOperatorOrHigher();
return finishNode(node);
}
function parseInferType() {
- var node = createNode(176 /* InferType */);
- parseExpected(127 /* InferKeyword */);
- var typeParameter = createNode(150 /* TypeParameter */);
+ var node = createNode(177 /* InferType */);
+ parseExpected(128 /* InferKeyword */);
+ var typeParameter = createNode(151 /* TypeParameter */);
typeParameter.name = parseIdentifier();
node.typeParameter = finishNode(typeParameter);
return finishNode(node);
@@ -19240,34 +19387,35 @@
function parseTypeOperatorOrHigher() {
var operator = token();
switch (operator) {
- case 129 /* KeyOfKeyword */:
- case 142 /* UniqueKeyword */:
- case 133 /* ReadonlyKeyword */:
+ case 130 /* KeyOfKeyword */:
+ case 143 /* UniqueKeyword */:
+ case 134 /* ReadonlyKeyword */:
return parseTypeOperator(operator);
- case 127 /* InferKeyword */:
+ case 128 /* InferKeyword */:
return parseInferType();
}
return parsePostfixTypeOrHigher();
}
function parseUnionOrIntersectionType(kind, parseConstituentType, operator) {
- parseOptional(operator);
+ var start = scanner.getStartPos();
+ var hasLeadingOperator = parseOptional(operator);
var type = parseConstituentType();
- if (token() === operator) {
+ if (token() === operator || hasLeadingOperator) {
var types = [type];
while (parseOptional(operator)) {
types.push(parseConstituentType());
}
- var node = createNode(kind, type.pos);
- node.types = createNodeArray(types, type.pos);
+ var node = createNode(kind, start);
+ node.types = createNodeArray(types, start);
type = finishNode(node);
}
return type;
}
function parseIntersectionTypeOrHigher() {
- return parseUnionOrIntersectionType(174 /* IntersectionType */, parseTypeOperatorOrHigher, 49 /* AmpersandToken */);
+ return parseUnionOrIntersectionType(175 /* IntersectionType */, parseTypeOperatorOrHigher, 49 /* AmpersandToken */);
}
function parseUnionTypeOrHigher() {
- return parseUnionOrIntersectionType(173 /* UnionType */, parseIntersectionTypeOrHigher, 50 /* BarToken */);
+ return parseUnionOrIntersectionType(174 /* UnionType */, parseIntersectionTypeOrHigher, 50 /* BarToken */);
}
function isStartOfFunctionType() {
if (token() === 28 /* LessThanToken */) {
@@ -19280,7 +19428,7 @@
// Skip modifiers
parseModifiers();
}
- if (isIdentifier() || token() === 100 /* ThisKeyword */) {
+ if (isIdentifier() || token() === 101 /* ThisKeyword */) {
nextToken();
return true;
}
@@ -19303,7 +19451,7 @@
// We successfully skipped modifiers (if any) and an identifier or binding pattern,
// now see if we have something that indicates a parameter declaration
if (token() === 57 /* ColonToken */ || token() === 27 /* CommaToken */ ||
- token() === 56 /* QuestionToken */ || token() === 59 /* EqualsToken */) {
+ token() === 56 /* QuestionToken */ || token() === 60 /* EqualsToken */) {
// ( xxx :
// ( xxx ,
// ( xxx ?
@@ -19324,7 +19472,7 @@
var typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix);
var type = parseType();
if (typePredicateVariable) {
- var node = createNode(163 /* TypePredicate */, typePredicateVariable.pos);
+ var node = createNode(164 /* TypePredicate */, typePredicateVariable.pos);
node.parameterName = typePredicateVariable;
node.type = type;
return finishNode(node);
@@ -19335,7 +19483,7 @@
}
function parseTypePredicatePrefix() {
var id = parseIdentifier();
- if (token() === 128 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) {
+ if (token() === 129 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) {
nextToken();
return id;
}
@@ -19346,12 +19494,12 @@
return doOutsideOfContext(20480 /* TypeExcludesFlags */, parseTypeWorker);
}
function parseTypeWorker(noConditionalTypes) {
- if (isStartOfFunctionType() || token() === 95 /* NewKeyword */) {
+ if (isStartOfFunctionType() || token() === 96 /* NewKeyword */) {
return parseFunctionOrConstructorType();
}
var type = parseUnionTypeOrHigher();
- if (!noConditionalTypes && !scanner.hasPrecedingLineBreak() && parseOptional(86 /* ExtendsKeyword */)) {
- var node = createNode(175 /* ConditionalType */, type.pos);
+ if (!noConditionalTypes && !scanner.hasPrecedingLineBreak() && parseOptional(87 /* ExtendsKeyword */)) {
+ var node = createNode(176 /* ConditionalType */, type.pos);
node.checkType = type;
// The type following 'extends' is not permitted to be another conditional type
node.extendsType = parseTypeWorker(/*noConditionalTypes*/ true);
@@ -19369,11 +19517,11 @@
// EXPRESSIONS
function isStartOfLeftHandSideExpression() {
switch (token()) {
- case 100 /* ThisKeyword */:
- case 98 /* SuperKeyword */:
- case 96 /* NullKeyword */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
+ case 101 /* ThisKeyword */:
+ case 99 /* SuperKeyword */:
+ case 97 /* NullKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
case 10 /* StringLiteral */:
@@ -19382,14 +19530,14 @@
case 20 /* OpenParenToken */:
case 22 /* OpenBracketToken */:
case 18 /* OpenBraceToken */:
- case 90 /* FunctionKeyword */:
- case 76 /* ClassKeyword */:
- case 95 /* NewKeyword */:
+ case 91 /* FunctionKeyword */:
+ case 77 /* ClassKeyword */:
+ case 96 /* NewKeyword */:
case 42 /* SlashToken */:
- case 64 /* SlashEqualsToken */:
- case 72 /* Identifier */:
+ case 65 /* SlashEqualsToken */:
+ case 73 /* Identifier */:
return true;
- case 92 /* ImportKeyword */:
+ case 93 /* ImportKeyword */:
return lookAhead(nextTokenIsOpenParenOrLessThanOrDot);
default:
return isIdentifier();
@@ -19404,14 +19552,14 @@
case 39 /* MinusToken */:
case 53 /* TildeToken */:
case 52 /* ExclamationToken */:
- case 81 /* DeleteKeyword */:
- case 104 /* TypeOfKeyword */:
- case 106 /* VoidKeyword */:
+ case 82 /* DeleteKeyword */:
+ case 105 /* TypeOfKeyword */:
+ case 107 /* VoidKeyword */:
case 44 /* PlusPlusToken */:
case 45 /* MinusMinusToken */:
case 28 /* LessThanToken */:
- case 122 /* AwaitKeyword */:
- case 117 /* YieldKeyword */:
+ case 123 /* AwaitKeyword */:
+ case 118 /* YieldKeyword */:
// Yield/await always starts an expression. Either it is an identifier (in which case
// it is definitely an expression). Or it's a keyword (either because we're in
// a generator or async function, or in strict mode (or both)) and it started a yield or await expression.
@@ -19430,8 +19578,8 @@
function isStartOfExpressionStatement() {
// As per the grammar, none of '{' or 'function' or 'class' can start an expression statement.
return token() !== 18 /* OpenBraceToken */ &&
- token() !== 90 /* FunctionKeyword */ &&
- token() !== 76 /* ClassKeyword */ &&
+ token() !== 91 /* FunctionKeyword */ &&
+ token() !== 77 /* ClassKeyword */ &&
token() !== 58 /* AtToken */ &&
isStartOfExpression();
}
@@ -19455,7 +19603,7 @@
return expr;
}
function parseInitializer() {
- return parseOptional(59 /* EqualsToken */) ? parseAssignmentExpressionOrHigher() : undefined;
+ return parseOptional(60 /* EqualsToken */) ? parseAssignmentExpressionOrHigher() : undefined;
}
function parseAssignmentExpressionOrHigher() {
// AssignmentExpression[in,yield]:
@@ -19500,7 +19648,7 @@
// To avoid a look-ahead, we did not handle the case of an arrow function with a single un-parenthesized
// parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single
// identifier and the current token is an arrow.
- if (expr.kind === 72 /* Identifier */ && token() === 37 /* EqualsGreaterThanToken */) {
+ if (expr.kind === 73 /* Identifier */ && token() === 37 /* EqualsGreaterThanToken */) {
return parseSimpleArrowFunctionExpression(expr);
}
// Now see if we might be in cases '2' or '3'.
@@ -19516,7 +19664,7 @@
return parseConditionalExpressionRest(expr);
}
function isYieldExpression() {
- if (token() === 117 /* YieldKeyword */) {
+ if (token() === 118 /* YieldKeyword */) {
// If we have a 'yield' keyword, and this is a context where yield expressions are
// allowed, then definitely parse out a yield expression.
if (inYieldContext()) {
@@ -19545,7 +19693,7 @@
return !scanner.hasPrecedingLineBreak() && isIdentifier();
}
function parseYieldExpression() {
- var node = createNode(207 /* YieldExpression */);
+ var node = createNode(208 /* YieldExpression */);
// YieldExpression[In] :
// yield
// yield [no LineTerminator here] [Lexical goal InputElementRegExp]AssignmentExpression[?In, Yield]
@@ -19567,13 +19715,13 @@
ts.Debug.assert(token() === 37 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
var node;
if (asyncModifier) {
- node = createNode(197 /* ArrowFunction */, asyncModifier.pos);
+ node = createNode(198 /* ArrowFunction */, asyncModifier.pos);
node.modifiers = asyncModifier;
}
else {
- node = createNode(197 /* ArrowFunction */, identifier.pos);
+ node = createNode(198 /* ArrowFunction */, identifier.pos);
}
- var parameter = createNode(151 /* Parameter */, identifier.pos);
+ var parameter = createNode(152 /* Parameter */, identifier.pos);
parameter.name = identifier;
finishNode(parameter);
node.parameters = createNodeArray([parameter], parameter.pos, parameter.end);
@@ -19613,7 +19761,7 @@
// Unknown -> There *might* be a parenthesized arrow function here.
// Speculatively look ahead to be sure, and rollback if not.
function isParenthesizedArrowFunctionExpression() {
- if (token() === 20 /* OpenParenToken */ || token() === 28 /* LessThanToken */ || token() === 121 /* AsyncKeyword */) {
+ if (token() === 20 /* OpenParenToken */ || token() === 28 /* LessThanToken */ || token() === 122 /* AsyncKeyword */) {
return lookAhead(isParenthesizedArrowFunctionExpressionWorker);
}
if (token() === 37 /* EqualsGreaterThanToken */) {
@@ -19626,7 +19774,7 @@
return 0 /* False */;
}
function isParenthesizedArrowFunctionExpressionWorker() {
- if (token() === 121 /* AsyncKeyword */) {
+ if (token() === 122 /* AsyncKeyword */) {
nextToken();
if (scanner.hasPrecedingLineBreak()) {
return 0 /* False */;
@@ -19670,13 +19818,13 @@
// Check for "(xxx yyy", where xxx is a modifier and yyy is an identifier. This
// isn't actually allowed, but we want to treat it as a lambda so we can provide
// a good error message.
- if (ts.isModifierKind(second) && second !== 121 /* AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) {
+ if (ts.isModifierKind(second) && second !== 122 /* AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) {
return 1 /* True */;
}
// If we had "(" followed by something that's not an identifier,
// then this definitely doesn't look like a lambda. "this" is not
// valid, but we want to parse it and then give a semantic error.
- if (!isIdentifier() && second !== 100 /* ThisKeyword */) {
+ if (!isIdentifier() && second !== 101 /* ThisKeyword */) {
return 0 /* False */;
}
switch (nextToken()) {
@@ -19687,13 +19835,13 @@
case 56 /* QuestionToken */:
nextToken();
// If we have "(a?:" or "(a?," or "(a?=" or "(a?)" then it is definitely a lambda.
- if (token() === 57 /* ColonToken */ || token() === 27 /* CommaToken */ || token() === 59 /* EqualsToken */ || token() === 21 /* CloseParenToken */) {
+ if (token() === 57 /* ColonToken */ || token() === 27 /* CommaToken */ || token() === 60 /* EqualsToken */ || token() === 21 /* CloseParenToken */) {
return 1 /* True */;
}
// Otherwise it is definitely not a lambda.
return 0 /* False */;
case 27 /* CommaToken */:
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
case 21 /* CloseParenToken */:
// If we have "(a," or "(a=" or "(a)" this *could* be an arrow function
return 2 /* Unknown */;
@@ -19712,10 +19860,10 @@
if (sourceFile.languageVariant === 1 /* JSX */) {
var isArrowFunctionInJsx = lookAhead(function () {
var third = nextToken();
- if (third === 86 /* ExtendsKeyword */) {
+ if (third === 87 /* ExtendsKeyword */) {
var fourth = nextToken();
switch (fourth) {
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
case 30 /* GreaterThanToken */:
return false;
default:
@@ -19741,7 +19889,7 @@
}
function tryParseAsyncSimpleArrowFunctionExpression() {
// We do a check here so that we won't be doing unnecessarily call to "lookAhead"
- if (token() === 121 /* AsyncKeyword */) {
+ if (token() === 122 /* AsyncKeyword */) {
if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) {
var asyncModifier = parseModifiersForArrowFunction();
var expr = parseBinaryExpressionOrHigher(/*precedence*/ 0);
@@ -19754,7 +19902,7 @@
// AsyncArrowFunctionExpression:
// 1) async[no LineTerminator here]AsyncArrowBindingIdentifier[?Yield][no LineTerminator here]=>AsyncConciseBody[?In]
// 2) CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await][no LineTerminator here]=>AsyncConciseBody[?In]
- if (token() === 121 /* AsyncKeyword */) {
+ if (token() === 122 /* AsyncKeyword */) {
nextToken();
// If the "async" is followed by "=>" token then it is not a beginning of an async arrow-function
// but instead a simple arrow-function which will be parsed inside "parseAssignmentExpressionOrHigher"
@@ -19763,14 +19911,14 @@
}
// Check for un-parenthesized AsyncArrowFunction
var expr = parseBinaryExpressionOrHigher(/*precedence*/ 0);
- if (!scanner.hasPrecedingLineBreak() && expr.kind === 72 /* Identifier */ && token() === 37 /* EqualsGreaterThanToken */) {
+ if (!scanner.hasPrecedingLineBreak() && expr.kind === 73 /* Identifier */ && token() === 37 /* EqualsGreaterThanToken */) {
return 1 /* True */;
}
}
return 0 /* False */;
}
function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) {
- var node = createNodeWithJSDoc(197 /* ArrowFunction */);
+ var node = createNodeWithJSDoc(198 /* ArrowFunction */);
node.modifiers = parseModifiersForArrowFunction();
var isAsync = ts.hasModifier(node, 256 /* Async */) ? 2 /* Await */ : 0 /* None */;
// Arrow functions are never generators.
@@ -19789,9 +19937,11 @@
// - "(x = 10)" is an assignment expression parsed as a signature with a default parameter value.
// - "(x,y)" is a comma expression parsed as a signature with two parameters.
// - "a ? (b): c" will have "(b):" parsed as a signature with a return type annotation.
+ // - "a ? (b): function() {}" will too, since function() is a valid JSDoc function type.
//
// So we need just a bit of lookahead to ensure that it can only be a signature.
- if (!allowAmbiguity && token() !== 37 /* EqualsGreaterThanToken */ && token() !== 18 /* OpenBraceToken */) {
+ var hasJSDocFunctionType = node.type && ts.isJSDocFunctionType(node.type);
+ if (!allowAmbiguity && token() !== 37 /* EqualsGreaterThanToken */ && (hasJSDocFunctionType || token() !== 18 /* OpenBraceToken */)) {
// Returning undefined here will cause our caller to rewind to where we started from.
return undefined;
}
@@ -19802,8 +19952,8 @@
return parseFunctionBlock(isAsync ? 2 /* Await */ : 0 /* None */);
}
if (token() !== 26 /* SemicolonToken */ &&
- token() !== 90 /* FunctionKeyword */ &&
- token() !== 76 /* ClassKeyword */ &&
+ token() !== 91 /* FunctionKeyword */ &&
+ token() !== 77 /* ClassKeyword */ &&
isStartOfStatement() &&
!isStartOfExpressionStatement()) {
// Check if we got a plain statement (i.e. no expression-statements, no function/class expressions/declarations)
@@ -19834,14 +19984,14 @@
}
// Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and
// we do not that for the 'whenFalse' part.
- var node = createNode(205 /* ConditionalExpression */, leftOperand.pos);
+ var node = createNode(206 /* ConditionalExpression */, leftOperand.pos);
node.condition = leftOperand;
node.questionToken = questionToken;
node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher);
node.colonToken = parseExpectedToken(57 /* ColonToken */);
node.whenFalse = ts.nodeIsPresent(node.colonToken)
? parseAssignmentExpressionOrHigher()
- : createMissingNode(72 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(57 /* ColonToken */));
+ : createMissingNode(73 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(57 /* ColonToken */));
return finishNode(node);
}
function parseBinaryExpressionOrHigher(precedence) {
@@ -19849,7 +19999,7 @@
return parseBinaryExpressionRest(precedence, leftOperand);
}
function isInOrOfKeyword(t) {
- return t === 93 /* InKeyword */ || t === 147 /* OfKeyword */;
+ return t === 94 /* InKeyword */ || t === 148 /* OfKeyword */;
}
function parseBinaryExpressionRest(precedence, leftOperand) {
while (true) {
@@ -19884,10 +20034,10 @@
if (!consumeCurrentOperator) {
break;
}
- if (token() === 93 /* InKeyword */ && inDisallowInContext()) {
+ if (token() === 94 /* InKeyword */ && inDisallowInContext()) {
break;
}
- if (token() === 119 /* AsKeyword */) {
+ if (token() === 120 /* AsKeyword */) {
// Make sure we *do* perform ASI for constructs like this:
// var x = foo
// as (Bar)
@@ -19908,51 +20058,51 @@
return leftOperand;
}
function isBinaryOperator() {
- if (inDisallowInContext() && token() === 93 /* InKeyword */) {
+ if (inDisallowInContext() && token() === 94 /* InKeyword */) {
return false;
}
return ts.getBinaryOperatorPrecedence(token()) > 0;
}
function makeBinaryExpression(left, operatorToken, right) {
- var node = createNode(204 /* BinaryExpression */, left.pos);
+ var node = createNode(205 /* BinaryExpression */, left.pos);
node.left = left;
node.operatorToken = operatorToken;
node.right = right;
return finishNode(node);
}
function makeAsExpression(left, right) {
- var node = createNode(212 /* AsExpression */, left.pos);
+ var node = createNode(213 /* AsExpression */, left.pos);
node.expression = left;
node.type = right;
return finishNode(node);
}
function parsePrefixUnaryExpression() {
- var node = createNode(202 /* PrefixUnaryExpression */);
+ var node = createNode(203 /* PrefixUnaryExpression */);
node.operator = token();
nextToken();
node.operand = parseSimpleUnaryExpression();
return finishNode(node);
}
function parseDeleteExpression() {
- var node = createNode(198 /* DeleteExpression */);
+ var node = createNode(199 /* DeleteExpression */);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
}
function parseTypeOfExpression() {
- var node = createNode(199 /* TypeOfExpression */);
+ var node = createNode(200 /* TypeOfExpression */);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
}
function parseVoidExpression() {
- var node = createNode(200 /* VoidExpression */);
+ var node = createNode(201 /* VoidExpression */);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
}
function isAwaitExpression() {
- if (token() === 122 /* AwaitKeyword */) {
+ if (token() === 123 /* AwaitKeyword */) {
if (inAwaitContext()) {
return true;
}
@@ -19962,7 +20112,7 @@
return false;
}
function parseAwaitExpression() {
- var node = createNode(201 /* AwaitExpression */);
+ var node = createNode(202 /* AwaitExpression */);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
@@ -20006,7 +20156,7 @@
if (token() === 41 /* AsteriskAsteriskToken */) {
var pos = ts.skipTrivia(sourceText, simpleUnaryExpression.pos);
var end = simpleUnaryExpression.end;
- if (simpleUnaryExpression.kind === 194 /* TypeAssertionExpression */) {
+ if (simpleUnaryExpression.kind === 195 /* TypeAssertionExpression */) {
parseErrorAt(pos, end, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses);
}
else {
@@ -20036,18 +20186,18 @@
case 53 /* TildeToken */:
case 52 /* ExclamationToken */:
return parsePrefixUnaryExpression();
- case 81 /* DeleteKeyword */:
+ case 82 /* DeleteKeyword */:
return parseDeleteExpression();
- case 104 /* TypeOfKeyword */:
+ case 105 /* TypeOfKeyword */:
return parseTypeOfExpression();
- case 106 /* VoidKeyword */:
+ case 107 /* VoidKeyword */:
return parseVoidExpression();
case 28 /* LessThanToken */:
// This is modified UnaryExpression grammar in TypeScript
// UnaryExpression (modified):
// < type > UnaryExpression
return parseTypeAssertion();
- case 122 /* AwaitKeyword */:
+ case 123 /* AwaitKeyword */:
if (isAwaitExpression()) {
return parseAwaitExpression();
}
@@ -20074,10 +20224,10 @@
case 39 /* MinusToken */:
case 53 /* TildeToken */:
case 52 /* ExclamationToken */:
- case 81 /* DeleteKeyword */:
- case 104 /* TypeOfKeyword */:
- case 106 /* VoidKeyword */:
- case 122 /* AwaitKeyword */:
+ case 82 /* DeleteKeyword */:
+ case 105 /* TypeOfKeyword */:
+ case 107 /* VoidKeyword */:
+ case 123 /* AwaitKeyword */:
return false;
case 28 /* LessThanToken */:
// If we are not in JSX context, we are parsing TypeAssertion which is an UnaryExpression
@@ -20103,7 +20253,7 @@
*/
function parseUpdateExpression() {
if (token() === 44 /* PlusPlusToken */ || token() === 45 /* MinusMinusToken */) {
- var node = createNode(202 /* PrefixUnaryExpression */);
+ var node = createNode(203 /* PrefixUnaryExpression */);
node.operator = token();
nextToken();
node.operand = parseLeftHandSideExpressionOrHigher();
@@ -20116,7 +20266,7 @@
var expression = parseLeftHandSideExpressionOrHigher();
ts.Debug.assert(ts.isLeftHandSideExpression(expression));
if ((token() === 44 /* PlusPlusToken */ || token() === 45 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) {
- var node = createNode(203 /* PostfixUnaryExpression */, expression.pos);
+ var node = createNode(204 /* PostfixUnaryExpression */, expression.pos);
node.operand = expression;
node.operator = token();
nextToken();
@@ -20157,7 +20307,7 @@
// 3)we have a MemberExpression which either completes the LeftHandSideExpression,
// or starts the beginning of the first four CallExpression productions.
var expression;
- if (token() === 92 /* ImportKeyword */) {
+ if (token() === 93 /* ImportKeyword */) {
if (lookAhead(nextTokenIsOpenParenOrLessThan)) {
// We don't want to eagerly consume all import keyword as import call expression so we look ahead to find "("
// For example:
@@ -20172,8 +20322,8 @@
var fullStart = scanner.getStartPos();
nextToken(); // advance past the 'import'
nextToken(); // advance past the dot
- var node = createNode(214 /* MetaProperty */, fullStart);
- node.keywordToken = 92 /* ImportKeyword */;
+ var node = createNode(215 /* MetaProperty */, fullStart);
+ node.keywordToken = 93 /* ImportKeyword */;
node.name = parseIdentifierName();
expression = finishNode(node);
sourceFile.flags |= 1048576 /* PossiblyContainsImportMeta */;
@@ -20183,7 +20333,7 @@
}
}
else {
- expression = token() === 98 /* SuperKeyword */ ? parseSuperExpression() : parseMemberExpressionOrHigher();
+ expression = token() === 99 /* SuperKeyword */ ? parseSuperExpression() : parseMemberExpressionOrHigher();
}
// Now, we *may* be complete. However, we might have consumed the start of a
// CallExpression. As such, we need to consume the rest of it here to be complete.
@@ -20242,12 +20392,19 @@
}
function parseSuperExpression() {
var expression = parseTokenNode();
+ if (token() === 28 /* LessThanToken */) {
+ var startPos = getNodePos();
+ var typeArguments = tryParse(parseTypeArgumentsInExpression);
+ if (typeArguments !== undefined) {
+ parseErrorAt(startPos, getNodePos(), ts.Diagnostics.super_may_not_use_type_arguments);
+ }
+ }
if (token() === 20 /* OpenParenToken */ || token() === 24 /* DotToken */ || token() === 22 /* OpenBracketToken */) {
return expression;
}
// If we have seen "super" it must be followed by '(' or '.'.
// If it wasn't then just try to parse out a '.' and report an error.
- var node = createNode(189 /* PropertyAccessExpression */, expression.pos);
+ var node = createNode(190 /* PropertyAccessExpression */, expression.pos);
node.expression = expression;
parseExpectedToken(24 /* DotToken */, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access);
node.name = parseRightSideOfDot(/*allowIdentifierNames*/ true);
@@ -20256,8 +20413,8 @@
function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext) {
var opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext);
var result;
- if (opening.kind === 262 /* JsxOpeningElement */) {
- var node = createNode(260 /* JsxElement */, opening.pos);
+ if (opening.kind === 263 /* JsxOpeningElement */) {
+ var node = createNode(261 /* JsxElement */, opening.pos);
node.openingElement = opening;
node.children = parseJsxChildren(node.openingElement);
node.closingElement = parseJsxClosingElement(inExpressionContext);
@@ -20266,15 +20423,15 @@
}
result = finishNode(node);
}
- else if (opening.kind === 265 /* JsxOpeningFragment */) {
- var node = createNode(264 /* JsxFragment */, opening.pos);
+ else if (opening.kind === 266 /* JsxOpeningFragment */) {
+ var node = createNode(265 /* JsxFragment */, opening.pos);
node.openingFragment = opening;
node.children = parseJsxChildren(node.openingFragment);
node.closingFragment = parseJsxClosingFragment(inExpressionContext);
result = finishNode(node);
}
else {
- ts.Debug.assert(opening.kind === 261 /* JsxSelfClosingElement */);
+ ts.Debug.assert(opening.kind === 262 /* JsxSelfClosingElement */);
// Nothing else to do for self-closing elements
result = opening;
}
@@ -20289,11 +20446,11 @@
var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElementOrFragment(/*inExpressionContext*/ true); });
if (invalidElement) {
parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element);
- var badNode = createNode(204 /* BinaryExpression */, result.pos);
+ var badNode = createNode(205 /* BinaryExpression */, result.pos);
badNode.end = invalidElement.end;
badNode.left = result;
badNode.right = invalidElement;
- badNode.operatorToken = createMissingNode(27 /* CommaToken */, /*reportAtCurrentPosition*/ false, /*diagnosticMessage*/ undefined); // TODO: GH#18217
+ badNode.operatorToken = createMissingNode(27 /* CommaToken */, /*reportAtCurrentPosition*/ false);
badNode.operatorToken.pos = badNode.operatorToken.end = badNode.right.pos;
return badNode;
}
@@ -20348,7 +20505,7 @@
return createNodeArray(list, listPos);
}
function parseJsxAttributes() {
- var jsxAttributes = createNode(268 /* JsxAttributes */);
+ var jsxAttributes = createNode(269 /* JsxAttributes */);
jsxAttributes.properties = parseList(13 /* JsxAttributes */, parseJsxAttribute);
return finishNode(jsxAttributes);
}
@@ -20357,7 +20514,7 @@
parseExpected(28 /* LessThanToken */);
if (token() === 30 /* GreaterThanToken */) {
// See below for explanation of scanJsxText
- var node_1 = createNode(265 /* JsxOpeningFragment */, fullStart);
+ var node_1 = createNode(266 /* JsxOpeningFragment */, fullStart);
scanJsxText();
return finishNode(node_1);
}
@@ -20369,7 +20526,7 @@
// Closing tag, so scan the immediately-following text with the JSX scanning instead
// of regular scanning to avoid treating illegal characters (e.g. '#') as immediate
// scanning errors
- node = createNode(262 /* JsxOpeningElement */, fullStart);
+ node = createNode(263 /* JsxOpeningElement */, fullStart);
scanJsxText();
}
else {
@@ -20381,7 +20538,7 @@
parseExpected(30 /* GreaterThanToken */, /*diagnostic*/ undefined, /*shouldAdvance*/ false);
scanJsxText();
}
- node = createNode(261 /* JsxSelfClosingElement */, fullStart);
+ node = createNode(262 /* JsxSelfClosingElement */, fullStart);
}
node.tagName = tagName;
node.typeArguments = typeArguments;
@@ -20395,10 +20552,10 @@
// primaryExpression in the form of an identifier and "this" keyword
// We can't just simply use parseLeftHandSideExpressionOrHigher because then we will start consider class,function etc as a keyword
// We only want to consider "this" as a primaryExpression
- var expression = token() === 100 /* ThisKeyword */ ?
+ var expression = token() === 101 /* ThisKeyword */ ?
parseTokenNode() : parseIdentifierName();
while (parseOptional(24 /* DotToken */)) {
- var propertyAccess = createNode(189 /* PropertyAccessExpression */, expression.pos);
+ var propertyAccess = createNode(190 /* PropertyAccessExpression */, expression.pos);
propertyAccess.expression = expression;
propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true);
expression = finishNode(propertyAccess);
@@ -20406,7 +20563,7 @@
return expression;
}
function parseJsxExpression(inExpressionContext) {
- var node = createNode(270 /* JsxExpression */);
+ var node = createNode(271 /* JsxExpression */);
if (!parseExpected(18 /* OpenBraceToken */)) {
return undefined;
}
@@ -20428,9 +20585,9 @@
return parseJsxSpreadAttribute();
}
scanJsxIdentifier();
- var node = createNode(267 /* JsxAttribute */);
+ var node = createNode(268 /* JsxAttribute */);
node.name = parseIdentifierName();
- if (token() === 59 /* EqualsToken */) {
+ if (token() === 60 /* EqualsToken */) {
switch (scanJsxAttributeValue()) {
case 10 /* StringLiteral */:
node.initializer = parseLiteralNode();
@@ -20443,7 +20600,7 @@
return finishNode(node);
}
function parseJsxSpreadAttribute() {
- var node = createNode(269 /* JsxSpreadAttribute */);
+ var node = createNode(270 /* JsxSpreadAttribute */);
parseExpected(18 /* OpenBraceToken */);
parseExpected(25 /* DotDotDotToken */);
node.expression = parseExpression();
@@ -20451,7 +20608,7 @@
return finishNode(node);
}
function parseJsxClosingElement(inExpressionContext) {
- var node = createNode(263 /* JsxClosingElement */);
+ var node = createNode(264 /* JsxClosingElement */);
parseExpected(29 /* LessThanSlashToken */);
node.tagName = parseJsxElementName();
if (inExpressionContext) {
@@ -20464,7 +20621,7 @@
return finishNode(node);
}
function parseJsxClosingFragment(inExpressionContext) {
- var node = createNode(266 /* JsxClosingFragment */);
+ var node = createNode(267 /* JsxClosingFragment */);
parseExpected(29 /* LessThanSlashToken */);
if (ts.tokenIsIdentifierOrKeyword(token())) {
parseErrorAtRange(parseJsxElementName(), ts.Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment);
@@ -20479,7 +20636,7 @@
return finishNode(node);
}
function parseTypeAssertion() {
- var node = createNode(194 /* TypeAssertionExpression */);
+ var node = createNode(195 /* TypeAssertionExpression */);
parseExpected(28 /* LessThanToken */);
node.type = parseType();
parseExpected(30 /* GreaterThanToken */);
@@ -20490,7 +20647,7 @@
while (true) {
var dotToken = parseOptionalToken(24 /* DotToken */);
if (dotToken) {
- var propertyAccess = createNode(189 /* PropertyAccessExpression */, expression.pos);
+ var propertyAccess = createNode(190 /* PropertyAccessExpression */, expression.pos);
propertyAccess.expression = expression;
propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true);
expression = finishNode(propertyAccess);
@@ -20498,17 +20655,17 @@
}
if (token() === 52 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) {
nextToken();
- var nonNullExpression = createNode(213 /* NonNullExpression */, expression.pos);
+ var nonNullExpression = createNode(214 /* NonNullExpression */, expression.pos);
nonNullExpression.expression = expression;
expression = finishNode(nonNullExpression);
continue;
}
// when in the [Decorator] context, we do not parse ElementAccess as it could be part of a ComputedPropertyName
if (!inDecoratorContext() && parseOptional(22 /* OpenBracketToken */)) {
- var indexedAccess = createNode(190 /* ElementAccessExpression */, expression.pos);
+ var indexedAccess = createNode(191 /* ElementAccessExpression */, expression.pos);
indexedAccess.expression = expression;
if (token() === 23 /* CloseBracketToken */) {
- indexedAccess.argumentExpression = createMissingNode(72 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.An_element_access_expression_should_take_an_argument);
+ indexedAccess.argumentExpression = createMissingNode(73 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.An_element_access_expression_should_take_an_argument);
}
else {
var argument = allowInAnd(parseExpression);
@@ -20532,7 +20689,7 @@
return token() === 14 /* NoSubstitutionTemplateLiteral */ || token() === 15 /* TemplateHead */;
}
function parseTaggedTemplateRest(tag, typeArguments) {
- var tagExpression = createNode(193 /* TaggedTemplateExpression */, tag.pos);
+ var tagExpression = createNode(194 /* TaggedTemplateExpression */, tag.pos);
tagExpression.tag = tag;
tagExpression.typeArguments = typeArguments;
tagExpression.template = token() === 14 /* NoSubstitutionTemplateLiteral */
@@ -20557,7 +20714,7 @@
expression = parseTaggedTemplateRest(expression, typeArguments);
continue;
}
- var callExpr = createNode(191 /* CallExpression */, expression.pos);
+ var callExpr = createNode(192 /* CallExpression */, expression.pos);
callExpr.expression = expression;
callExpr.typeArguments = typeArguments;
callExpr.arguments = parseArgumentList();
@@ -20565,7 +20722,7 @@
continue;
}
else if (token() === 20 /* OpenParenToken */) {
- var callExpr = createNode(191 /* CallExpression */, expression.pos);
+ var callExpr = createNode(192 /* CallExpression */, expression.pos);
callExpr.expression = expression;
callExpr.arguments = parseArgumentList();
expression = finishNode(callExpr);
@@ -20641,11 +20798,11 @@
case 10 /* StringLiteral */:
case 14 /* NoSubstitutionTemplateLiteral */:
return parseLiteralNode();
- case 100 /* ThisKeyword */:
- case 98 /* SuperKeyword */:
- case 96 /* NullKeyword */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
+ case 101 /* ThisKeyword */:
+ case 99 /* SuperKeyword */:
+ case 97 /* NullKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
return parseTokenNode();
case 20 /* OpenParenToken */:
return parseParenthesizedExpression();
@@ -20653,7 +20810,7 @@
return parseArrayLiteralExpression();
case 18 /* OpenBraceToken */:
return parseObjectLiteralExpression();
- case 121 /* AsyncKeyword */:
+ case 122 /* AsyncKeyword */:
// Async arrow functions are parsed earlier in parseAssignmentExpressionOrHigher.
// If we encounter `async [no LineTerminator here] function` then this is an async
// function; otherwise, its an identifier.
@@ -20661,14 +20818,14 @@
break;
}
return parseFunctionExpression();
- case 76 /* ClassKeyword */:
+ case 77 /* ClassKeyword */:
return parseClassExpression();
- case 90 /* FunctionKeyword */:
+ case 91 /* FunctionKeyword */:
return parseFunctionExpression();
- case 95 /* NewKeyword */:
+ case 96 /* NewKeyword */:
return parseNewExpressionOrNewDotTarget();
case 42 /* SlashToken */:
- case 64 /* SlashEqualsToken */:
+ case 65 /* SlashEqualsToken */:
if (reScanSlashToken() === 13 /* RegularExpressionLiteral */) {
return parseLiteralNode();
}
@@ -20679,28 +20836,28 @@
return parseIdentifier(ts.Diagnostics.Expression_expected);
}
function parseParenthesizedExpression() {
- var node = createNodeWithJSDoc(195 /* ParenthesizedExpression */);
+ var node = createNodeWithJSDoc(196 /* ParenthesizedExpression */);
parseExpected(20 /* OpenParenToken */);
node.expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
return finishNode(node);
}
function parseSpreadElement() {
- var node = createNode(208 /* SpreadElement */);
+ var node = createNode(209 /* SpreadElement */);
parseExpected(25 /* DotDotDotToken */);
node.expression = parseAssignmentExpressionOrHigher();
return finishNode(node);
}
function parseArgumentOrArrayLiteralElement() {
return token() === 25 /* DotDotDotToken */ ? parseSpreadElement() :
- token() === 27 /* CommaToken */ ? createNode(210 /* OmittedExpression */) :
+ token() === 27 /* CommaToken */ ? createNode(211 /* OmittedExpression */) :
parseAssignmentExpressionOrHigher();
}
function parseArgumentExpression() {
return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement);
}
function parseArrayLiteralExpression() {
- var node = createNode(187 /* ArrayLiteralExpression */);
+ var node = createNode(188 /* ArrayLiteralExpression */);
parseExpected(22 /* OpenBracketToken */);
if (scanner.hasPrecedingLineBreak()) {
node.multiLine = true;
@@ -20712,17 +20869,17 @@
function parseObjectLiteralElement() {
var node = createNodeWithJSDoc(0 /* Unknown */);
if (parseOptionalToken(25 /* DotDotDotToken */)) {
- node.kind = 277 /* SpreadAssignment */;
+ node.kind = 278 /* SpreadAssignment */;
node.expression = parseAssignmentExpressionOrHigher();
return finishNode(node);
}
node.decorators = parseDecorators();
node.modifiers = parseModifiers();
- if (parseContextualModifier(126 /* GetKeyword */)) {
- return parseAccessorDeclaration(node, 158 /* GetAccessor */);
+ if (parseContextualModifier(127 /* GetKeyword */)) {
+ return parseAccessorDeclaration(node, 159 /* GetAccessor */);
}
- if (parseContextualModifier(137 /* SetKeyword */)) {
- return parseAccessorDeclaration(node, 159 /* SetAccessor */);
+ if (parseContextualModifier(138 /* SetKeyword */)) {
+ return parseAccessorDeclaration(node, 160 /* SetAccessor */);
}
var asteriskToken = parseOptionalToken(40 /* AsteriskToken */);
var tokenIsIdentifier = isIdentifier();
@@ -20740,22 +20897,22 @@
// this is necessary because ObjectLiteral productions are also used to cover grammar for ObjectAssignmentPattern
var isShorthandPropertyAssignment = tokenIsIdentifier && (token() !== 57 /* ColonToken */);
if (isShorthandPropertyAssignment) {
- node.kind = 276 /* ShorthandPropertyAssignment */;
- var equalsToken = parseOptionalToken(59 /* EqualsToken */);
+ node.kind = 277 /* ShorthandPropertyAssignment */;
+ var equalsToken = parseOptionalToken(60 /* EqualsToken */);
if (equalsToken) {
node.equalsToken = equalsToken;
node.objectAssignmentInitializer = allowInAnd(parseAssignmentExpressionOrHigher);
}
}
else {
- node.kind = 275 /* PropertyAssignment */;
+ node.kind = 276 /* PropertyAssignment */;
parseExpected(57 /* ColonToken */);
node.initializer = allowInAnd(parseAssignmentExpressionOrHigher);
}
return finishNode(node);
}
function parseObjectLiteralExpression() {
- var node = createNode(188 /* ObjectLiteralExpression */);
+ var node = createNode(189 /* ObjectLiteralExpression */);
parseExpected(18 /* OpenBraceToken */);
if (scanner.hasPrecedingLineBreak()) {
node.multiLine = true;
@@ -20774,9 +20931,9 @@
if (saveDecoratorContext) {
setDecoratorContext(/*val*/ false);
}
- var node = createNodeWithJSDoc(196 /* FunctionExpression */);
+ var node = createNodeWithJSDoc(197 /* FunctionExpression */);
node.modifiers = parseModifiers();
- parseExpected(90 /* FunctionKeyword */);
+ parseExpected(91 /* FunctionKeyword */);
node.asteriskToken = parseOptionalToken(40 /* AsteriskToken */);
var isGenerator = node.asteriskToken ? 1 /* Yield */ : 0 /* None */;
var isAsync = ts.hasModifier(node, 256 /* Async */) ? 2 /* Await */ : 0 /* None */;
@@ -20797,10 +20954,10 @@
}
function parseNewExpressionOrNewDotTarget() {
var fullStart = scanner.getStartPos();
- parseExpected(95 /* NewKeyword */);
+ parseExpected(96 /* NewKeyword */);
if (parseOptional(24 /* DotToken */)) {
- var node_2 = createNode(214 /* MetaProperty */, fullStart);
- node_2.keywordToken = 95 /* NewKeyword */;
+ var node_2 = createNode(215 /* MetaProperty */, fullStart);
+ node_2.keywordToken = 96 /* NewKeyword */;
node_2.name = parseIdentifierName();
return finishNode(node_2);
}
@@ -20816,7 +20973,7 @@
}
break;
}
- var node = createNode(192 /* NewExpression */, fullStart);
+ var node = createNode(193 /* NewExpression */, fullStart);
node.expression = expression;
node.typeArguments = typeArguments;
if (node.typeArguments || token() === 20 /* OpenParenToken */) {
@@ -20826,7 +20983,7 @@
}
// STATEMENTS
function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) {
- var node = createNode(218 /* Block */);
+ var node = createNode(219 /* Block */);
if (parseExpected(18 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) {
if (scanner.hasPrecedingLineBreak()) {
node.multiLine = true;
@@ -20859,25 +21016,25 @@
return block;
}
function parseEmptyStatement() {
- var node = createNode(220 /* EmptyStatement */);
+ var node = createNode(221 /* EmptyStatement */);
parseExpected(26 /* SemicolonToken */);
return finishNode(node);
}
function parseIfStatement() {
- var node = createNode(222 /* IfStatement */);
- parseExpected(91 /* IfKeyword */);
+ var node = createNode(223 /* IfStatement */);
+ parseExpected(92 /* IfKeyword */);
parseExpected(20 /* OpenParenToken */);
node.expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
node.thenStatement = parseStatement();
- node.elseStatement = parseOptional(83 /* ElseKeyword */) ? parseStatement() : undefined;
+ node.elseStatement = parseOptional(84 /* ElseKeyword */) ? parseStatement() : undefined;
return finishNode(node);
}
function parseDoStatement() {
- var node = createNode(223 /* DoStatement */);
- parseExpected(82 /* DoKeyword */);
+ var node = createNode(224 /* DoStatement */);
+ parseExpected(83 /* DoKeyword */);
node.statement = parseStatement();
- parseExpected(107 /* WhileKeyword */);
+ parseExpected(108 /* WhileKeyword */);
parseExpected(20 /* OpenParenToken */);
node.expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
@@ -20889,8 +21046,8 @@
return finishNode(node);
}
function parseWhileStatement() {
- var node = createNode(224 /* WhileStatement */);
- parseExpected(107 /* WhileKeyword */);
+ var node = createNode(225 /* WhileStatement */);
+ parseExpected(108 /* WhileKeyword */);
parseExpected(20 /* OpenParenToken */);
node.expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
@@ -20899,12 +21056,12 @@
}
function parseForOrForInOrForOfStatement() {
var pos = getNodePos();
- parseExpected(89 /* ForKeyword */);
- var awaitToken = parseOptionalToken(122 /* AwaitKeyword */);
+ parseExpected(90 /* ForKeyword */);
+ var awaitToken = parseOptionalToken(123 /* AwaitKeyword */);
parseExpected(20 /* OpenParenToken */);
var initializer;
if (token() !== 26 /* SemicolonToken */) {
- if (token() === 105 /* VarKeyword */ || token() === 111 /* LetKeyword */ || token() === 77 /* ConstKeyword */) {
+ if (token() === 106 /* VarKeyword */ || token() === 112 /* LetKeyword */ || token() === 78 /* ConstKeyword */) {
initializer = parseVariableDeclarationList(/*inForStatementInitializer*/ true);
}
else {
@@ -20912,23 +21069,23 @@
}
}
var forOrForInOrForOfStatement;
- if (awaitToken ? parseExpected(147 /* OfKeyword */) : parseOptional(147 /* OfKeyword */)) {
- var forOfStatement = createNode(227 /* ForOfStatement */, pos);
+ if (awaitToken ? parseExpected(148 /* OfKeyword */) : parseOptional(148 /* OfKeyword */)) {
+ var forOfStatement = createNode(228 /* ForOfStatement */, pos);
forOfStatement.awaitModifier = awaitToken;
forOfStatement.initializer = initializer;
forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher);
parseExpected(21 /* CloseParenToken */);
forOrForInOrForOfStatement = forOfStatement;
}
- else if (parseOptional(93 /* InKeyword */)) {
- var forInStatement = createNode(226 /* ForInStatement */, pos);
+ else if (parseOptional(94 /* InKeyword */)) {
+ var forInStatement = createNode(227 /* ForInStatement */, pos);
forInStatement.initializer = initializer;
forInStatement.expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
forOrForInOrForOfStatement = forInStatement;
}
else {
- var forStatement = createNode(225 /* ForStatement */, pos);
+ var forStatement = createNode(226 /* ForStatement */, pos);
forStatement.initializer = initializer;
parseExpected(26 /* SemicolonToken */);
if (token() !== 26 /* SemicolonToken */ && token() !== 21 /* CloseParenToken */) {
@@ -20946,7 +21103,7 @@
}
function parseBreakOrContinueStatement(kind) {
var node = createNode(kind);
- parseExpected(kind === 229 /* BreakStatement */ ? 73 /* BreakKeyword */ : 78 /* ContinueKeyword */);
+ parseExpected(kind === 230 /* BreakStatement */ ? 74 /* BreakKeyword */ : 79 /* ContinueKeyword */);
if (!canParseSemicolon()) {
node.label = parseIdentifier();
}
@@ -20954,8 +21111,8 @@
return finishNode(node);
}
function parseReturnStatement() {
- var node = createNode(230 /* ReturnStatement */);
- parseExpected(97 /* ReturnKeyword */);
+ var node = createNode(231 /* ReturnStatement */);
+ parseExpected(98 /* ReturnKeyword */);
if (!canParseSemicolon()) {
node.expression = allowInAnd(parseExpression);
}
@@ -20963,8 +21120,8 @@
return finishNode(node);
}
function parseWithStatement() {
- var node = createNode(231 /* WithStatement */);
- parseExpected(108 /* WithKeyword */);
+ var node = createNode(232 /* WithStatement */);
+ parseExpected(109 /* WithKeyword */);
parseExpected(20 /* OpenParenToken */);
node.expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
@@ -20972,30 +21129,30 @@
return finishNode(node);
}
function parseCaseClause() {
- var node = createNode(271 /* CaseClause */);
- parseExpected(74 /* CaseKeyword */);
+ var node = createNode(272 /* CaseClause */);
+ parseExpected(75 /* CaseKeyword */);
node.expression = allowInAnd(parseExpression);
parseExpected(57 /* ColonToken */);
node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement);
return finishNode(node);
}
function parseDefaultClause() {
- var node = createNode(272 /* DefaultClause */);
- parseExpected(80 /* DefaultKeyword */);
+ var node = createNode(273 /* DefaultClause */);
+ parseExpected(81 /* DefaultKeyword */);
parseExpected(57 /* ColonToken */);
node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement);
return finishNode(node);
}
function parseCaseOrDefaultClause() {
- return token() === 74 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause();
+ return token() === 75 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause();
}
function parseSwitchStatement() {
- var node = createNode(232 /* SwitchStatement */);
- parseExpected(99 /* SwitchKeyword */);
+ var node = createNode(233 /* SwitchStatement */);
+ parseExpected(100 /* SwitchKeyword */);
parseExpected(20 /* OpenParenToken */);
node.expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
- var caseBlock = createNode(246 /* CaseBlock */);
+ var caseBlock = createNode(247 /* CaseBlock */);
parseExpected(18 /* OpenBraceToken */);
caseBlock.clauses = parseList(2 /* SwitchClauses */, parseCaseOrDefaultClause);
parseExpected(19 /* CloseBraceToken */);
@@ -21010,29 +21167,29 @@
// directly as that might consume an expression on the following line.
// We just return 'undefined' in that case. The actual error will be reported in the
// grammar walker.
- var node = createNode(234 /* ThrowStatement */);
- parseExpected(101 /* ThrowKeyword */);
+ var node = createNode(235 /* ThrowStatement */);
+ parseExpected(102 /* ThrowKeyword */);
node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression);
parseSemicolon();
return finishNode(node);
}
// TODO: Review for error recovery
function parseTryStatement() {
- var node = createNode(235 /* TryStatement */);
- parseExpected(103 /* TryKeyword */);
+ var node = createNode(236 /* TryStatement */);
+ parseExpected(104 /* TryKeyword */);
node.tryBlock = parseBlock(/*ignoreMissingOpenBrace*/ false);
- node.catchClause = token() === 75 /* CatchKeyword */ ? parseCatchClause() : undefined;
+ node.catchClause = token() === 76 /* CatchKeyword */ ? parseCatchClause() : undefined;
// If we don't have a catch clause, then we must have a finally clause. Try to parse
// one out no matter what.
- if (!node.catchClause || token() === 88 /* FinallyKeyword */) {
- parseExpected(88 /* FinallyKeyword */);
+ if (!node.catchClause || token() === 89 /* FinallyKeyword */) {
+ parseExpected(89 /* FinallyKeyword */);
node.finallyBlock = parseBlock(/*ignoreMissingOpenBrace*/ false);
}
return finishNode(node);
}
function parseCatchClause() {
- var result = createNode(274 /* CatchClause */);
- parseExpected(75 /* CatchKeyword */);
+ var result = createNode(275 /* CatchClause */);
+ parseExpected(76 /* CatchKeyword */);
if (parseOptional(20 /* OpenParenToken */)) {
result.variableDeclaration = parseVariableDeclaration();
parseExpected(21 /* CloseParenToken */);
@@ -21045,8 +21202,8 @@
return finishNode(result);
}
function parseDebuggerStatement() {
- var node = createNode(236 /* DebuggerStatement */);
- parseExpected(79 /* DebuggerKeyword */);
+ var node = createNode(237 /* DebuggerStatement */);
+ parseExpected(80 /* DebuggerKeyword */);
parseSemicolon();
return finishNode(node);
}
@@ -21056,13 +21213,13 @@
// a colon.
var node = createNodeWithJSDoc(0 /* Unknown */);
var expression = allowInAnd(parseExpression);
- if (expression.kind === 72 /* Identifier */ && parseOptional(57 /* ColonToken */)) {
- node.kind = 233 /* LabeledStatement */;
+ if (expression.kind === 73 /* Identifier */ && parseOptional(57 /* ColonToken */)) {
+ node.kind = 234 /* LabeledStatement */;
node.label = expression;
node.statement = parseStatement();
}
else {
- node.kind = 221 /* ExpressionStatement */;
+ node.kind = 222 /* ExpressionStatement */;
node.expression = expression;
parseSemicolon();
}
@@ -21074,11 +21231,11 @@
}
function nextTokenIsClassKeywordOnSameLine() {
nextToken();
- return token() === 76 /* ClassKeyword */ && !scanner.hasPrecedingLineBreak();
+ return token() === 77 /* ClassKeyword */ && !scanner.hasPrecedingLineBreak();
}
function nextTokenIsFunctionKeywordOnSameLine() {
nextToken();
- return token() === 90 /* FunctionKeyword */ && !scanner.hasPrecedingLineBreak();
+ return token() === 91 /* FunctionKeyword */ && !scanner.hasPrecedingLineBreak();
}
function nextTokenIsIdentifierOrKeywordOrLiteralOnSameLine() {
nextToken();
@@ -21087,12 +21244,12 @@
function isDeclaration() {
while (true) {
switch (token()) {
- case 105 /* VarKeyword */:
- case 111 /* LetKeyword */:
- case 77 /* ConstKeyword */:
- case 90 /* FunctionKeyword */:
- case 76 /* ClassKeyword */:
- case 84 /* EnumKeyword */:
+ case 106 /* VarKeyword */:
+ case 112 /* LetKeyword */:
+ case 78 /* ConstKeyword */:
+ case 91 /* FunctionKeyword */:
+ case 77 /* ClassKeyword */:
+ case 85 /* EnumKeyword */:
return true;
// 'declare', 'module', 'namespace', 'interface'* and 'type' are all legal JavaScript identifiers;
// however, an identifier cannot be followed by another identifier on the same line. This is what we
@@ -21115,41 +21272,41 @@
// I {}
//
// could be legal, it would add complexity for very little gain.
- case 110 /* InterfaceKeyword */:
- case 140 /* TypeKeyword */:
+ case 111 /* InterfaceKeyword */:
+ case 141 /* TypeKeyword */:
return nextTokenIsIdentifierOnSameLine();
- case 130 /* ModuleKeyword */:
- case 131 /* NamespaceKeyword */:
+ case 131 /* ModuleKeyword */:
+ case 132 /* NamespaceKeyword */:
return nextTokenIsIdentifierOrStringLiteralOnSameLine();
- case 118 /* AbstractKeyword */:
- case 121 /* AsyncKeyword */:
- case 125 /* DeclareKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 115 /* PublicKeyword */:
- case 133 /* ReadonlyKeyword */:
+ case 119 /* AbstractKeyword */:
+ case 122 /* AsyncKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 116 /* PublicKeyword */:
+ case 134 /* ReadonlyKeyword */:
nextToken();
// ASI takes effect for this modifier.
if (scanner.hasPrecedingLineBreak()) {
return false;
}
continue;
- case 145 /* GlobalKeyword */:
+ case 146 /* GlobalKeyword */:
nextToken();
- return token() === 18 /* OpenBraceToken */ || token() === 72 /* Identifier */ || token() === 85 /* ExportKeyword */;
- case 92 /* ImportKeyword */:
+ return token() === 18 /* OpenBraceToken */ || token() === 73 /* Identifier */ || token() === 86 /* ExportKeyword */;
+ case 93 /* ImportKeyword */:
nextToken();
return token() === 10 /* StringLiteral */ || token() === 40 /* AsteriskToken */ ||
token() === 18 /* OpenBraceToken */ || ts.tokenIsIdentifierOrKeyword(token());
- case 85 /* ExportKeyword */:
+ case 86 /* ExportKeyword */:
nextToken();
- if (token() === 59 /* EqualsToken */ || token() === 40 /* AsteriskToken */ ||
- token() === 18 /* OpenBraceToken */ || token() === 80 /* DefaultKeyword */ ||
- token() === 119 /* AsKeyword */) {
+ if (token() === 60 /* EqualsToken */ || token() === 40 /* AsteriskToken */ ||
+ token() === 18 /* OpenBraceToken */ || token() === 81 /* DefaultKeyword */ ||
+ token() === 120 /* AsKeyword */) {
return true;
}
continue;
- case 116 /* StaticKeyword */:
+ case 117 /* StaticKeyword */:
nextToken();
continue;
default:
@@ -21165,47 +21322,47 @@
case 58 /* AtToken */:
case 26 /* SemicolonToken */:
case 18 /* OpenBraceToken */:
- case 105 /* VarKeyword */:
- case 111 /* LetKeyword */:
- case 90 /* FunctionKeyword */:
- case 76 /* ClassKeyword */:
- case 84 /* EnumKeyword */:
- case 91 /* IfKeyword */:
- case 82 /* DoKeyword */:
- case 107 /* WhileKeyword */:
- case 89 /* ForKeyword */:
- case 78 /* ContinueKeyword */:
- case 73 /* BreakKeyword */:
- case 97 /* ReturnKeyword */:
- case 108 /* WithKeyword */:
- case 99 /* SwitchKeyword */:
- case 101 /* ThrowKeyword */:
- case 103 /* TryKeyword */:
- case 79 /* DebuggerKeyword */:
+ case 106 /* VarKeyword */:
+ case 112 /* LetKeyword */:
+ case 91 /* FunctionKeyword */:
+ case 77 /* ClassKeyword */:
+ case 85 /* EnumKeyword */:
+ case 92 /* IfKeyword */:
+ case 83 /* DoKeyword */:
+ case 108 /* WhileKeyword */:
+ case 90 /* ForKeyword */:
+ case 79 /* ContinueKeyword */:
+ case 74 /* BreakKeyword */:
+ case 98 /* ReturnKeyword */:
+ case 109 /* WithKeyword */:
+ case 100 /* SwitchKeyword */:
+ case 102 /* ThrowKeyword */:
+ case 104 /* TryKeyword */:
+ case 80 /* DebuggerKeyword */:
// 'catch' and 'finally' do not actually indicate that the code is part of a statement,
// however, we say they are here so that we may gracefully parse them and error later.
- case 75 /* CatchKeyword */:
- case 88 /* FinallyKeyword */:
+ case 76 /* CatchKeyword */:
+ case 89 /* FinallyKeyword */:
return true;
- case 92 /* ImportKeyword */:
+ case 93 /* ImportKeyword */:
return isStartOfDeclaration() || lookAhead(nextTokenIsOpenParenOrLessThanOrDot);
- case 77 /* ConstKeyword */:
- case 85 /* ExportKeyword */:
+ case 78 /* ConstKeyword */:
+ case 86 /* ExportKeyword */:
return isStartOfDeclaration();
- case 121 /* AsyncKeyword */:
- case 125 /* DeclareKeyword */:
- case 110 /* InterfaceKeyword */:
- case 130 /* ModuleKeyword */:
- case 131 /* NamespaceKeyword */:
- case 140 /* TypeKeyword */:
- case 145 /* GlobalKeyword */:
+ case 122 /* AsyncKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 111 /* InterfaceKeyword */:
+ case 131 /* ModuleKeyword */:
+ case 132 /* NamespaceKeyword */:
+ case 141 /* TypeKeyword */:
+ case 146 /* GlobalKeyword */:
// When these don't start a declaration, they're an identifier in an expression statement
return true;
- case 115 /* PublicKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 116 /* StaticKeyword */:
- case 133 /* ReadonlyKeyword */:
+ case 116 /* PublicKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 117 /* StaticKeyword */:
+ case 134 /* ReadonlyKeyword */:
// When these don't start a declaration, they may be the start of a class member if an identifier
// immediately follows. Otherwise they're an identifier in an expression statement.
return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine);
@@ -21228,63 +21385,63 @@
return parseEmptyStatement();
case 18 /* OpenBraceToken */:
return parseBlock(/*ignoreMissingOpenBrace*/ false);
- case 105 /* VarKeyword */:
- return parseVariableStatement(createNodeWithJSDoc(237 /* VariableDeclaration */));
- case 111 /* LetKeyword */:
+ case 106 /* VarKeyword */:
+ return parseVariableStatement(createNodeWithJSDoc(238 /* VariableDeclaration */));
+ case 112 /* LetKeyword */:
if (isLetDeclaration()) {
- return parseVariableStatement(createNodeWithJSDoc(237 /* VariableDeclaration */));
+ return parseVariableStatement(createNodeWithJSDoc(238 /* VariableDeclaration */));
}
break;
- case 90 /* FunctionKeyword */:
- return parseFunctionDeclaration(createNodeWithJSDoc(239 /* FunctionDeclaration */));
- case 76 /* ClassKeyword */:
- return parseClassDeclaration(createNodeWithJSDoc(240 /* ClassDeclaration */));
- case 91 /* IfKeyword */:
+ case 91 /* FunctionKeyword */:
+ return parseFunctionDeclaration(createNodeWithJSDoc(240 /* FunctionDeclaration */));
+ case 77 /* ClassKeyword */:
+ return parseClassDeclaration(createNodeWithJSDoc(241 /* ClassDeclaration */));
+ case 92 /* IfKeyword */:
return parseIfStatement();
- case 82 /* DoKeyword */:
+ case 83 /* DoKeyword */:
return parseDoStatement();
- case 107 /* WhileKeyword */:
+ case 108 /* WhileKeyword */:
return parseWhileStatement();
- case 89 /* ForKeyword */:
+ case 90 /* ForKeyword */:
return parseForOrForInOrForOfStatement();
- case 78 /* ContinueKeyword */:
- return parseBreakOrContinueStatement(228 /* ContinueStatement */);
- case 73 /* BreakKeyword */:
- return parseBreakOrContinueStatement(229 /* BreakStatement */);
- case 97 /* ReturnKeyword */:
+ case 79 /* ContinueKeyword */:
+ return parseBreakOrContinueStatement(229 /* ContinueStatement */);
+ case 74 /* BreakKeyword */:
+ return parseBreakOrContinueStatement(230 /* BreakStatement */);
+ case 98 /* ReturnKeyword */:
return parseReturnStatement();
- case 108 /* WithKeyword */:
+ case 109 /* WithKeyword */:
return parseWithStatement();
- case 99 /* SwitchKeyword */:
+ case 100 /* SwitchKeyword */:
return parseSwitchStatement();
- case 101 /* ThrowKeyword */:
+ case 102 /* ThrowKeyword */:
return parseThrowStatement();
- case 103 /* TryKeyword */:
+ case 104 /* TryKeyword */:
// Include 'catch' and 'finally' for error recovery.
- case 75 /* CatchKeyword */:
- case 88 /* FinallyKeyword */:
+ case 76 /* CatchKeyword */:
+ case 89 /* FinallyKeyword */:
return parseTryStatement();
- case 79 /* DebuggerKeyword */:
+ case 80 /* DebuggerKeyword */:
return parseDebuggerStatement();
case 58 /* AtToken */:
return parseDeclaration();
- case 121 /* AsyncKeyword */:
- case 110 /* InterfaceKeyword */:
- case 140 /* TypeKeyword */:
- case 130 /* ModuleKeyword */:
- case 131 /* NamespaceKeyword */:
- case 125 /* DeclareKeyword */:
- case 77 /* ConstKeyword */:
- case 84 /* EnumKeyword */:
- case 85 /* ExportKeyword */:
- case 92 /* ImportKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 115 /* PublicKeyword */:
- case 118 /* AbstractKeyword */:
- case 116 /* StaticKeyword */:
- case 133 /* ReadonlyKeyword */:
- case 145 /* GlobalKeyword */:
+ case 122 /* AsyncKeyword */:
+ case 111 /* InterfaceKeyword */:
+ case 141 /* TypeKeyword */:
+ case 131 /* ModuleKeyword */:
+ case 132 /* NamespaceKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 78 /* ConstKeyword */:
+ case 85 /* EnumKeyword */:
+ case 86 /* ExportKeyword */:
+ case 93 /* ImportKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 116 /* PublicKeyword */:
+ case 119 /* AbstractKeyword */:
+ case 117 /* StaticKeyword */:
+ case 134 /* ReadonlyKeyword */:
+ case 146 /* GlobalKeyword */:
if (isStartOfDeclaration()) {
return parseDeclaration();
}
@@ -21293,7 +21450,7 @@
return parseExpressionOrLabeledStatement();
}
function isDeclareModifier(modifier) {
- return modifier.kind === 125 /* DeclareKeyword */;
+ return modifier.kind === 126 /* DeclareKeyword */;
}
function parseDeclaration() {
var node = createNodeWithJSDoc(0 /* Unknown */);
@@ -21312,33 +21469,33 @@
}
function parseDeclarationWorker(node) {
switch (token()) {
- case 105 /* VarKeyword */:
- case 111 /* LetKeyword */:
- case 77 /* ConstKeyword */:
+ case 106 /* VarKeyword */:
+ case 112 /* LetKeyword */:
+ case 78 /* ConstKeyword */:
return parseVariableStatement(node);
- case 90 /* FunctionKeyword */:
+ case 91 /* FunctionKeyword */:
return parseFunctionDeclaration(node);
- case 76 /* ClassKeyword */:
+ case 77 /* ClassKeyword */:
return parseClassDeclaration(node);
- case 110 /* InterfaceKeyword */:
+ case 111 /* InterfaceKeyword */:
return parseInterfaceDeclaration(node);
- case 140 /* TypeKeyword */:
+ case 141 /* TypeKeyword */:
return parseTypeAliasDeclaration(node);
- case 84 /* EnumKeyword */:
+ case 85 /* EnumKeyword */:
return parseEnumDeclaration(node);
- case 145 /* GlobalKeyword */:
- case 130 /* ModuleKeyword */:
- case 131 /* NamespaceKeyword */:
+ case 146 /* GlobalKeyword */:
+ case 131 /* ModuleKeyword */:
+ case 132 /* NamespaceKeyword */:
return parseModuleDeclaration(node);
- case 92 /* ImportKeyword */:
+ case 93 /* ImportKeyword */:
return parseImportDeclarationOrImportEqualsDeclaration(node);
- case 85 /* ExportKeyword */:
+ case 86 /* ExportKeyword */:
nextToken();
switch (token()) {
- case 80 /* DefaultKeyword */:
- case 59 /* EqualsToken */:
+ case 81 /* DefaultKeyword */:
+ case 60 /* EqualsToken */:
return parseExportAssignment(node);
- case 119 /* AsKeyword */:
+ case 120 /* AsKeyword */:
return parseNamespaceExportDeclaration(node);
default:
return parseExportDeclaration(node);
@@ -21347,7 +21504,7 @@
if (node.decorators || node.modifiers) {
// We reached this point because we encountered decorators and/or modifiers and assumed a declaration
// would follow. For recovery and error reporting purposes, return an incomplete declaration.
- var missing = createMissingNode(258 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected);
+ var missing = createMissingNode(259 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected);
missing.pos = node.pos;
missing.decorators = node.decorators;
missing.modifiers = node.modifiers;
@@ -21370,16 +21527,16 @@
// DECLARATIONS
function parseArrayBindingElement() {
if (token() === 27 /* CommaToken */) {
- return createNode(210 /* OmittedExpression */);
+ return createNode(211 /* OmittedExpression */);
}
- var node = createNode(186 /* BindingElement */);
+ var node = createNode(187 /* BindingElement */);
node.dotDotDotToken = parseOptionalToken(25 /* DotDotDotToken */);
node.name = parseIdentifierOrPattern();
node.initializer = parseInitializer();
return finishNode(node);
}
function parseObjectBindingElement() {
- var node = createNode(186 /* BindingElement */);
+ var node = createNode(187 /* BindingElement */);
node.dotDotDotToken = parseOptionalToken(25 /* DotDotDotToken */);
var tokenIsIdentifier = isIdentifier();
var propertyName = parsePropertyName();
@@ -21395,14 +21552,14 @@
return finishNode(node);
}
function parseObjectBindingPattern() {
- var node = createNode(184 /* ObjectBindingPattern */);
+ var node = createNode(185 /* ObjectBindingPattern */);
parseExpected(18 /* OpenBraceToken */);
node.elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement);
parseExpected(19 /* CloseBraceToken */);
return finishNode(node);
}
function parseArrayBindingPattern() {
- var node = createNode(185 /* ArrayBindingPattern */);
+ var node = createNode(186 /* ArrayBindingPattern */);
parseExpected(22 /* OpenBracketToken */);
node.elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement);
parseExpected(23 /* CloseBracketToken */);
@@ -21424,9 +21581,9 @@
return parseVariableDeclaration(/*allowExclamation*/ true);
}
function parseVariableDeclaration(allowExclamation) {
- var node = createNode(237 /* VariableDeclaration */);
+ var node = createNode(238 /* VariableDeclaration */);
node.name = parseIdentifierOrPattern();
- if (allowExclamation && node.name.kind === 72 /* Identifier */ &&
+ if (allowExclamation && node.name.kind === 73 /* Identifier */ &&
token() === 52 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) {
node.exclamationToken = parseTokenNode();
}
@@ -21437,14 +21594,14 @@
return finishNode(node);
}
function parseVariableDeclarationList(inForStatementInitializer) {
- var node = createNode(238 /* VariableDeclarationList */);
+ var node = createNode(239 /* VariableDeclarationList */);
switch (token()) {
- case 105 /* VarKeyword */:
+ case 106 /* VarKeyword */:
break;
- case 111 /* LetKeyword */:
+ case 112 /* LetKeyword */:
node.flags |= 1 /* Let */;
break;
- case 77 /* ConstKeyword */:
+ case 78 /* ConstKeyword */:
node.flags |= 2 /* Const */;
break;
default:
@@ -21460,7 +21617,7 @@
// So we need to look ahead to determine if 'of' should be treated as a keyword in
// this context.
// The checker will then give an error that there is an empty declaration list.
- if (token() === 147 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) {
+ if (token() === 148 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) {
node.declarations = createMissingList();
}
else {
@@ -21475,14 +21632,14 @@
return nextTokenIsIdentifier() && nextToken() === 21 /* CloseParenToken */;
}
function parseVariableStatement(node) {
- node.kind = 219 /* VariableStatement */;
+ node.kind = 220 /* VariableStatement */;
node.declarationList = parseVariableDeclarationList(/*inForStatementInitializer*/ false);
parseSemicolon();
return finishNode(node);
}
function parseFunctionDeclaration(node) {
- node.kind = 239 /* FunctionDeclaration */;
- parseExpected(90 /* FunctionKeyword */);
+ node.kind = 240 /* FunctionDeclaration */;
+ parseExpected(91 /* FunctionKeyword */);
node.asteriskToken = parseOptionalToken(40 /* AsteriskToken */);
node.name = ts.hasModifier(node, 512 /* Default */) ? parseOptionalIdentifier() : parseIdentifier();
var isGenerator = node.asteriskToken ? 1 /* Yield */ : 0 /* None */;
@@ -21492,14 +21649,14 @@
return finishNode(node);
}
function parseConstructorDeclaration(node) {
- node.kind = 157 /* Constructor */;
- parseExpected(124 /* ConstructorKeyword */);
+ node.kind = 158 /* Constructor */;
+ parseExpected(125 /* ConstructorKeyword */);
fillSignature(57 /* ColonToken */, 0 /* None */, node);
node.body = parseFunctionBlockOrSemicolon(0 /* None */, ts.Diagnostics.or_expected);
return finishNode(node);
}
function parseMethodDeclaration(node, asteriskToken, diagnosticMessage) {
- node.kind = 156 /* MethodDeclaration */;
+ node.kind = 157 /* MethodDeclaration */;
node.asteriskToken = asteriskToken;
var isGenerator = asteriskToken ? 1 /* Yield */ : 0 /* None */;
var isAsync = ts.hasModifier(node, 256 /* Async */) ? 2 /* Await */ : 0 /* None */;
@@ -21508,7 +21665,7 @@
return finishNode(node);
}
function parsePropertyDeclaration(node) {
- node.kind = 154 /* PropertyDeclaration */;
+ node.kind = 155 /* PropertyDeclaration */;
if (!node.questionToken && token() === 52 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) {
node.exclamationToken = parseTokenNode();
}
@@ -21581,7 +21738,7 @@
// If we were able to get any potential identifier...
if (idToken !== undefined) {
// If we have a non-keyword identifier, or if we have an accessor, then it's safe to parse.
- if (!ts.isKeyword(idToken) || idToken === 137 /* SetKeyword */ || idToken === 126 /* GetKeyword */) {
+ if (!ts.isKeyword(idToken) || idToken === 138 /* SetKeyword */ || idToken === 127 /* GetKeyword */) {
return true;
}
// If it *is* a keyword, but not an accessor, check a little farther along
@@ -21591,7 +21748,7 @@
case 28 /* LessThanToken */: // Generic Method declaration
case 52 /* ExclamationToken */: // Non-null assertion on property name
case 57 /* ColonToken */: // Type Annotation for declaration
- case 59 /* EqualsToken */: // Initializer for declaration
+ case 60 /* EqualsToken */: // Initializer for declaration
case 56 /* QuestionToken */: // Not valid, but permitted so that it gets caught later on.
return true;
default:
@@ -21613,7 +21770,7 @@
if (!parseOptional(58 /* AtToken */)) {
break;
}
- var decorator = createNode(152 /* Decorator */, decoratorStart);
+ var decorator = createNode(153 /* Decorator */, decoratorStart);
decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher);
finishNode(decorator);
(list || (list = [])).push(decorator);
@@ -21633,7 +21790,7 @@
while (true) {
var modifierStart = scanner.getStartPos();
var modifierKind = token();
- if (token() === 77 /* ConstKeyword */ && permitInvalidConstAsModifier) {
+ if (token() === 78 /* ConstKeyword */ && permitInvalidConstAsModifier) {
// We need to ensure that any subsequent modifiers appear on the same line
// so that when 'const' is a standalone declaration, we don't issue an error.
if (!tryParse(nextTokenIsOnSameLineAndCanFollowModifier)) {
@@ -21652,7 +21809,7 @@
}
function parseModifiersForArrowFunction() {
var modifiers;
- if (token() === 121 /* AsyncKeyword */) {
+ if (token() === 122 /* AsyncKeyword */) {
var modifierStart = scanner.getStartPos();
var modifierKind = token();
nextToken();
@@ -21663,20 +21820,20 @@
}
function parseClassElement() {
if (token() === 26 /* SemicolonToken */) {
- var result = createNode(217 /* SemicolonClassElement */);
+ var result = createNode(218 /* SemicolonClassElement */);
nextToken();
return finishNode(result);
}
var node = createNodeWithJSDoc(0 /* Unknown */);
node.decorators = parseDecorators();
node.modifiers = parseModifiers(/*permitInvalidConstAsModifier*/ true);
- if (parseContextualModifier(126 /* GetKeyword */)) {
- return parseAccessorDeclaration(node, 158 /* GetAccessor */);
+ if (parseContextualModifier(127 /* GetKeyword */)) {
+ return parseAccessorDeclaration(node, 159 /* GetAccessor */);
}
- if (parseContextualModifier(137 /* SetKeyword */)) {
- return parseAccessorDeclaration(node, 159 /* SetAccessor */);
+ if (parseContextualModifier(138 /* SetKeyword */)) {
+ return parseAccessorDeclaration(node, 160 /* SetAccessor */);
}
- if (token() === 124 /* ConstructorKeyword */) {
+ if (token() === 125 /* ConstructorKeyword */) {
return parseConstructorDeclaration(node);
}
if (isIndexSignature()) {
@@ -21693,21 +21850,21 @@
}
if (node.decorators || node.modifiers) {
// treat this as a property declaration with a missing name.
- node.name = createMissingNode(72 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected);
+ node.name = createMissingNode(73 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected);
return parsePropertyDeclaration(node);
}
// 'isClassMemberStart' should have hinted not to attempt parsing.
return ts.Debug.fail("Should not have attempted to parse class member declaration.");
}
function parseClassExpression() {
- return parseClassDeclarationOrExpression(createNodeWithJSDoc(0 /* Unknown */), 209 /* ClassExpression */);
+ return parseClassDeclarationOrExpression(createNodeWithJSDoc(0 /* Unknown */), 210 /* ClassExpression */);
}
function parseClassDeclaration(node) {
- return parseClassDeclarationOrExpression(node, 240 /* ClassDeclaration */);
+ return parseClassDeclarationOrExpression(node, 241 /* ClassDeclaration */);
}
function parseClassDeclarationOrExpression(node, kind) {
node.kind = kind;
- parseExpected(76 /* ClassKeyword */);
+ parseExpected(77 /* ClassKeyword */);
node.name = parseNameOfClassDeclarationOrExpression();
node.typeParameters = parseTypeParameters();
node.heritageClauses = parseHeritageClauses();
@@ -21733,7 +21890,7 @@
: undefined;
}
function isImplementsClause() {
- return token() === 109 /* ImplementsKeyword */ && lookAhead(nextTokenIsIdentifierOrKeyword);
+ return token() === 110 /* ImplementsKeyword */ && lookAhead(nextTokenIsIdentifierOrKeyword);
}
function parseHeritageClauses() {
// ClassTail[Yield,Await] : (Modified) See 14.5
@@ -21745,15 +21902,15 @@
}
function parseHeritageClause() {
var tok = token();
- ts.Debug.assert(tok === 86 /* ExtendsKeyword */ || tok === 109 /* ImplementsKeyword */); // isListElement() should ensure this.
- var node = createNode(273 /* HeritageClause */);
+ ts.Debug.assert(tok === 87 /* ExtendsKeyword */ || tok === 110 /* ImplementsKeyword */); // isListElement() should ensure this.
+ var node = createNode(274 /* HeritageClause */);
node.token = tok;
nextToken();
node.types = parseDelimitedList(7 /* HeritageClauseElement */, parseExpressionWithTypeArguments);
return finishNode(node);
}
function parseExpressionWithTypeArguments() {
- var node = createNode(211 /* ExpressionWithTypeArguments */);
+ var node = createNode(212 /* ExpressionWithTypeArguments */);
node.expression = parseLeftHandSideExpressionOrHigher();
node.typeArguments = tryParseTypeArguments();
return finishNode(node);
@@ -21764,14 +21921,14 @@
: undefined;
}
function isHeritageClause() {
- return token() === 86 /* ExtendsKeyword */ || token() === 109 /* ImplementsKeyword */;
+ return token() === 87 /* ExtendsKeyword */ || token() === 110 /* ImplementsKeyword */;
}
function parseClassMembers() {
return parseList(5 /* ClassMembers */, parseClassElement);
}
function parseInterfaceDeclaration(node) {
- node.kind = 241 /* InterfaceDeclaration */;
- parseExpected(110 /* InterfaceKeyword */);
+ node.kind = 242 /* InterfaceDeclaration */;
+ parseExpected(111 /* InterfaceKeyword */);
node.name = parseIdentifier();
node.typeParameters = parseTypeParameters();
node.heritageClauses = parseHeritageClauses();
@@ -21779,11 +21936,11 @@
return finishNode(node);
}
function parseTypeAliasDeclaration(node) {
- node.kind = 242 /* TypeAliasDeclaration */;
- parseExpected(140 /* TypeKeyword */);
+ node.kind = 243 /* TypeAliasDeclaration */;
+ parseExpected(141 /* TypeKeyword */);
node.name = parseIdentifier();
node.typeParameters = parseTypeParameters();
- parseExpected(59 /* EqualsToken */);
+ parseExpected(60 /* EqualsToken */);
node.type = parseType();
parseSemicolon();
return finishNode(node);
@@ -21793,14 +21950,14 @@
// ConstantEnumMemberSection, which starts at the beginning of an enum declaration
// or any time an integer literal initializer is encountered.
function parseEnumMember() {
- var node = createNodeWithJSDoc(278 /* EnumMember */);
+ var node = createNodeWithJSDoc(279 /* EnumMember */);
node.name = parsePropertyName();
node.initializer = allowInAnd(parseInitializer);
return finishNode(node);
}
function parseEnumDeclaration(node) {
- node.kind = 243 /* EnumDeclaration */;
- parseExpected(84 /* EnumKeyword */);
+ node.kind = 244 /* EnumDeclaration */;
+ parseExpected(85 /* EnumKeyword */);
node.name = parseIdentifier();
if (parseExpected(18 /* OpenBraceToken */)) {
node.members = parseDelimitedList(6 /* EnumMembers */, parseEnumMember);
@@ -21812,7 +21969,7 @@
return finishNode(node);
}
function parseModuleBlock() {
- var node = createNode(245 /* ModuleBlock */);
+ var node = createNode(246 /* ModuleBlock */);
if (parseExpected(18 /* OpenBraceToken */)) {
node.statements = parseList(1 /* BlockStatements */, parseStatement);
parseExpected(19 /* CloseBraceToken */);
@@ -21823,7 +21980,7 @@
return finishNode(node);
}
function parseModuleOrNamespaceDeclaration(node, flags) {
- node.kind = 244 /* ModuleDeclaration */;
+ node.kind = 245 /* ModuleDeclaration */;
// If we are parsing a dotted namespace name, we want to
// propagate the 'Namespace' flag across the names if set.
var namespaceFlag = flags & 16 /* Namespace */;
@@ -21835,8 +21992,8 @@
return finishNode(node);
}
function parseAmbientExternalModuleDeclaration(node) {
- node.kind = 244 /* ModuleDeclaration */;
- if (token() === 145 /* GlobalKeyword */) {
+ node.kind = 245 /* ModuleDeclaration */;
+ if (token() === 146 /* GlobalKeyword */) {
// parse 'global' as name of global scope augmentation
node.name = parseIdentifier();
node.flags |= 512 /* GlobalAugmentation */;
@@ -21855,15 +22012,15 @@
}
function parseModuleDeclaration(node) {
var flags = 0;
- if (token() === 145 /* GlobalKeyword */) {
+ if (token() === 146 /* GlobalKeyword */) {
// global augmentation
return parseAmbientExternalModuleDeclaration(node);
}
- else if (parseOptional(131 /* NamespaceKeyword */)) {
+ else if (parseOptional(132 /* NamespaceKeyword */)) {
flags |= 16 /* Namespace */;
}
else {
- parseExpected(130 /* ModuleKeyword */);
+ parseExpected(131 /* ModuleKeyword */);
if (token() === 10 /* StringLiteral */) {
return parseAmbientExternalModuleDeclaration(node);
}
@@ -21871,7 +22028,7 @@
return parseModuleOrNamespaceDeclaration(node, flags);
}
function isExternalModuleReference() {
- return token() === 134 /* RequireKeyword */ &&
+ return token() === 135 /* RequireKeyword */ &&
lookAhead(nextTokenIsOpenParen);
}
function nextTokenIsOpenParen() {
@@ -21881,25 +22038,25 @@
return nextToken() === 42 /* SlashToken */;
}
function parseNamespaceExportDeclaration(node) {
- node.kind = 247 /* NamespaceExportDeclaration */;
- parseExpected(119 /* AsKeyword */);
- parseExpected(131 /* NamespaceKeyword */);
+ node.kind = 248 /* NamespaceExportDeclaration */;
+ parseExpected(120 /* AsKeyword */);
+ parseExpected(132 /* NamespaceKeyword */);
node.name = parseIdentifier();
parseSemicolon();
return finishNode(node);
}
function parseImportDeclarationOrImportEqualsDeclaration(node) {
- parseExpected(92 /* ImportKeyword */);
+ parseExpected(93 /* ImportKeyword */);
var afterImportPos = scanner.getStartPos();
var identifier;
if (isIdentifier()) {
identifier = parseIdentifier();
- if (token() !== 27 /* CommaToken */ && token() !== 144 /* FromKeyword */) {
+ if (token() !== 27 /* CommaToken */ && token() !== 145 /* FromKeyword */) {
return parseImportEqualsDeclaration(node, identifier);
}
}
// Import statement
- node.kind = 249 /* ImportDeclaration */;
+ node.kind = 250 /* ImportDeclaration */;
// ImportDeclaration:
// import ImportClause from ModuleSpecifier ;
// import ModuleSpecifier;
@@ -21907,16 +22064,16 @@
token() === 40 /* AsteriskToken */ || // import *
token() === 18 /* OpenBraceToken */) { // import {
node.importClause = parseImportClause(identifier, afterImportPos);
- parseExpected(144 /* FromKeyword */);
+ parseExpected(145 /* FromKeyword */);
}
node.moduleSpecifier = parseModuleSpecifier();
parseSemicolon();
return finishNode(node);
}
function parseImportEqualsDeclaration(node, identifier) {
- node.kind = 248 /* ImportEqualsDeclaration */;
+ node.kind = 249 /* ImportEqualsDeclaration */;
node.name = identifier;
- parseExpected(59 /* EqualsToken */);
+ parseExpected(60 /* EqualsToken */);
node.moduleReference = parseModuleReference();
parseSemicolon();
return finishNode(node);
@@ -21928,7 +22085,7 @@
// NamedImports
// ImportedDefaultBinding, NameSpaceImport
// ImportedDefaultBinding, NamedImports
- var importClause = createNode(250 /* ImportClause */, fullStart);
+ var importClause = createNode(251 /* ImportClause */, fullStart);
if (identifier) {
// ImportedDefaultBinding:
// ImportedBinding
@@ -21938,7 +22095,7 @@
// parse namespace or named imports
if (!importClause.name ||
parseOptional(27 /* CommaToken */)) {
- importClause.namedBindings = token() === 40 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(252 /* NamedImports */);
+ importClause.namedBindings = token() === 40 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(253 /* NamedImports */);
}
return finishNode(importClause);
}
@@ -21948,8 +22105,8 @@
: parseEntityName(/*allowReservedWords*/ false);
}
function parseExternalModuleReference() {
- var node = createNode(259 /* ExternalModuleReference */);
- parseExpected(134 /* RequireKeyword */);
+ var node = createNode(260 /* ExternalModuleReference */);
+ parseExpected(135 /* RequireKeyword */);
parseExpected(20 /* OpenParenToken */);
node.expression = parseModuleSpecifier();
parseExpected(21 /* CloseParenToken */);
@@ -21971,9 +22128,9 @@
function parseNamespaceImport() {
// NameSpaceImport:
// * as ImportedBinding
- var namespaceImport = createNode(251 /* NamespaceImport */);
+ var namespaceImport = createNode(252 /* NamespaceImport */);
parseExpected(40 /* AsteriskToken */);
- parseExpected(119 /* AsKeyword */);
+ parseExpected(120 /* AsKeyword */);
namespaceImport.name = parseIdentifier();
return finishNode(namespaceImport);
}
@@ -21986,14 +22143,14 @@
// ImportsList:
// ImportSpecifier
// ImportsList, ImportSpecifier
- node.elements = parseBracketedList(23 /* ImportOrExportSpecifiers */, kind === 252 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 18 /* OpenBraceToken */, 19 /* CloseBraceToken */);
+ node.elements = parseBracketedList(23 /* ImportOrExportSpecifiers */, kind === 253 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 18 /* OpenBraceToken */, 19 /* CloseBraceToken */);
return finishNode(node);
}
function parseExportSpecifier() {
- return parseImportOrExportSpecifier(257 /* ExportSpecifier */);
+ return parseImportOrExportSpecifier(258 /* ExportSpecifier */);
}
function parseImportSpecifier() {
- return parseImportOrExportSpecifier(253 /* ImportSpecifier */);
+ return parseImportOrExportSpecifier(254 /* ImportSpecifier */);
}
function parseImportOrExportSpecifier(kind) {
var node = createNode(kind);
@@ -22007,9 +22164,9 @@
var checkIdentifierStart = scanner.getTokenPos();
var checkIdentifierEnd = scanner.getTextPos();
var identifierName = parseIdentifierName();
- if (token() === 119 /* AsKeyword */) {
+ if (token() === 120 /* AsKeyword */) {
node.propertyName = identifierName;
- parseExpected(119 /* AsKeyword */);
+ parseExpected(120 /* AsKeyword */);
checkIdentifierIsKeyword = ts.isKeyword(token()) && !isIdentifier();
checkIdentifierStart = scanner.getTokenPos();
checkIdentifierEnd = scanner.getTextPos();
@@ -22018,24 +22175,24 @@
else {
node.name = identifierName;
}
- if (kind === 253 /* ImportSpecifier */ && checkIdentifierIsKeyword) {
+ if (kind === 254 /* ImportSpecifier */ && checkIdentifierIsKeyword) {
parseErrorAt(checkIdentifierStart, checkIdentifierEnd, ts.Diagnostics.Identifier_expected);
}
return finishNode(node);
}
function parseExportDeclaration(node) {
- node.kind = 255 /* ExportDeclaration */;
+ node.kind = 256 /* ExportDeclaration */;
if (parseOptional(40 /* AsteriskToken */)) {
- parseExpected(144 /* FromKeyword */);
+ parseExpected(145 /* FromKeyword */);
node.moduleSpecifier = parseModuleSpecifier();
}
else {
- node.exportClause = parseNamedImportsOrExports(256 /* NamedExports */);
+ node.exportClause = parseNamedImportsOrExports(257 /* NamedExports */);
// It is not uncommon to accidentally omit the 'from' keyword. Additionally, in editing scenarios,
// the 'from' keyword can be parsed as a named export when the export clause is unterminated (i.e. `export { from "moduleName";`)
// If we don't have a 'from' keyword, see if we have a string literal such that ASI won't take effect.
- if (token() === 144 /* FromKeyword */ || (token() === 10 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) {
- parseExpected(144 /* FromKeyword */);
+ if (token() === 145 /* FromKeyword */ || (token() === 10 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) {
+ parseExpected(145 /* FromKeyword */);
node.moduleSpecifier = parseModuleSpecifier();
}
}
@@ -22043,12 +22200,12 @@
return finishNode(node);
}
function parseExportAssignment(node) {
- node.kind = 254 /* ExportAssignment */;
- if (parseOptional(59 /* EqualsToken */)) {
+ node.kind = 255 /* ExportAssignment */;
+ if (parseOptional(60 /* EqualsToken */)) {
node.isExportEquals = true;
}
else {
- parseExpected(80 /* DefaultKeyword */);
+ parseExpected(81 /* DefaultKeyword */);
}
node.expression = parseAssignmentExpressionOrHigher();
parseSemicolon();
@@ -22063,10 +22220,10 @@
}
function isAnExternalModuleIndicatorNode(node) {
return ts.hasModifier(node, 1 /* Export */)
- || node.kind === 248 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 259 /* ExternalModuleReference */
- || node.kind === 249 /* ImportDeclaration */
- || node.kind === 254 /* ExportAssignment */
- || node.kind === 255 /* ExportDeclaration */
+ || node.kind === 249 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 260 /* ExternalModuleReference */
+ || node.kind === 250 /* ImportDeclaration */
+ || node.kind === 255 /* ExportAssignment */
+ || node.kind === 256 /* ExportDeclaration */
? node
: undefined;
}
@@ -22079,7 +22236,7 @@
return isImportMeta(node) ? node : forEachChild(node, walkTreeForExternalModuleIndicators);
}
function isImportMeta(node) {
- return ts.isMetaProperty(node) && node.keywordToken === 92 /* ImportKeyword */ && node.name.escapedText === "meta";
+ return ts.isMetaProperty(node) && node.keywordToken === 93 /* ImportKeyword */ && node.name.escapedText === "meta";
}
var ParsingContext;
(function (ParsingContext) {
@@ -22118,8 +22275,8 @@
var JSDocParser;
(function (JSDocParser) {
function parseJSDocTypeExpressionForTests(content, start, length) {
- initializeState(content, 7 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
- sourceFile = createSourceFile("file.js", 7 /* Latest */, 1 /* JS */, /*isDeclarationFile*/ false);
+ initializeState(content, 8 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
+ sourceFile = createSourceFile("file.js", 8 /* Latest */, 1 /* JS */, /*isDeclarationFile*/ false);
scanner.setText(content, start, length);
currentToken = scanner.scan();
var jsDocTypeExpression = parseJSDocTypeExpression();
@@ -22130,18 +22287,18 @@
JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests;
// Parses out a JSDoc type expression.
function parseJSDocTypeExpression(mayOmitBraces) {
- var result = createNode(288 /* JSDocTypeExpression */);
+ var result = createNode(289 /* JSDocTypeExpression */);
var hasBrace = (mayOmitBraces ? parseOptional : parseExpected)(18 /* OpenBraceToken */);
result.type = doInsideOfContext(2097152 /* JSDoc */, parseJSDocType);
if (!mayOmitBraces || hasBrace) {
- parseExpected(19 /* CloseBraceToken */);
+ parseExpectedJSDoc(19 /* CloseBraceToken */);
}
fixupParentReferences(result);
return finishNode(result);
}
JSDocParser.parseJSDocTypeExpression = parseJSDocTypeExpression;
function parseIsolatedJSDocComment(content, start, length) {
- initializeState(content, 7 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
+ initializeState(content, 8 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
sourceFile = { languageVariant: 0 /* Standard */, text: content }; // tslint:disable-line no-object-literal-type-assertion
var jsDoc = parseJSDocCommentWorker(start, length);
var diagnostics = parseDiagnostics;
@@ -22213,7 +22370,7 @@
comments.push(text);
indent += text.length;
}
- nextJSDocToken();
+ nextTokenJSDoc();
while (parseOptionalJsdoc(5 /* WhitespaceTrivia */))
;
if (parseOptionalJsdoc(4 /* NewLineTrivia */)) {
@@ -22231,7 +22388,6 @@
// for malformed examples like `/** @param {string} x @returns {number} the length */`
state = 0 /* BeginningOfLine */;
margin = undefined;
- indent++;
}
else {
pushComment(scanner.getTokenText());
@@ -22276,7 +22432,7 @@
pushComment(scanner.getTokenText());
break;
}
- nextJSDocToken();
+ nextTokenJSDoc();
}
removeLeadingNewlines(comments);
removeTrailingWhitespace(comments);
@@ -22293,7 +22449,7 @@
}
}
function createJSDocComment() {
- var result = createNode(296 /* JSDocComment */, start);
+ var result = createNode(297 /* JSDocComment */, start);
result.tags = tags && createNodeArray(tags, tagsPos, tagsEnd);
result.comment = comments.length ? comments.join("") : undefined;
return finishNode(result, end);
@@ -22301,7 +22457,7 @@
function isNextNonwhitespaceTokenEndOfFile() {
// We must use infinite lookahead, as there could be any number of newlines :(
while (true) {
- nextJSDocToken();
+ nextTokenJSDoc();
if (token() === 1 /* EndOfFileToken */) {
return true;
}
@@ -22317,32 +22473,38 @@
}
}
while (token() === 5 /* WhitespaceTrivia */ || token() === 4 /* NewLineTrivia */) {
- nextJSDocToken();
+ nextTokenJSDoc();
}
}
function skipWhitespaceOrAsterisk() {
if (token() === 5 /* WhitespaceTrivia */ || token() === 4 /* NewLineTrivia */) {
if (lookAhead(isNextNonwhitespaceTokenEndOfFile)) {
- return; // Don't skip whitespace prior to EoF (or end of comment) - that shouldn't be included in any node's range
+ return ""; // Don't skip whitespace prior to EoF (or end of comment) - that shouldn't be included in any node's range
}
}
var precedingLineBreak = scanner.hasPrecedingLineBreak();
+ var seenLineBreak = false;
+ var indentText = "";
while ((precedingLineBreak && token() === 40 /* AsteriskToken */) || token() === 5 /* WhitespaceTrivia */ || token() === 4 /* NewLineTrivia */) {
+ indentText += scanner.getTokenText();
if (token() === 4 /* NewLineTrivia */) {
precedingLineBreak = true;
+ seenLineBreak = true;
+ indentText = "";
}
else if (token() === 40 /* AsteriskToken */) {
precedingLineBreak = false;
}
- nextJSDocToken();
+ nextTokenJSDoc();
}
+ return seenLineBreak ? indentText : "";
}
- function parseTag(indent) {
+ function parseTag(margin) {
ts.Debug.assert(token() === 58 /* AtToken */);
var start = scanner.getTokenPos();
- nextJSDocToken();
+ nextTokenJSDoc();
var tagName = parseJSDocIdentifierName(/*message*/ undefined);
- skipWhitespaceOrAsterisk();
+ var indentText = skipWhitespaceOrAsterisk();
var tag;
switch (tagName.escapedText) {
case "augments":
@@ -22362,7 +22524,7 @@
case "arg":
case "argument":
case "param":
- return parseParameterOrPropertyTag(start, tagName, 2 /* Parameter */, indent);
+ return parseParameterOrPropertyTag(start, tagName, 2 /* Parameter */, margin);
case "return":
case "returns":
tag = parseReturnTag(start, tagName);
@@ -22374,10 +22536,10 @@
tag = parseTypeTag(start, tagName);
break;
case "typedef":
- tag = parseTypedefTag(start, tagName, indent);
+ tag = parseTypedefTag(start, tagName, margin);
break;
case "callback":
- tag = parseCallbackTag(start, tagName, indent);
+ tag = parseCallbackTag(start, tagName, margin);
break;
default:
tag = parseUnknownTag(start, tagName);
@@ -22385,11 +22547,14 @@
}
if (!tag.comment) {
// some tags, like typedef and callback, have already parsed their comments earlier
- tag.comment = parseTagComments(indent + tag.end - tag.pos);
+ if (!indentText) {
+ margin += tag.end - tag.pos;
+ }
+ tag.comment = parseTagComments(margin, indentText.slice(margin));
}
return tag;
}
- function parseTagComments(indent) {
+ function parseTagComments(indent, initialMargin) {
var comments = [];
var state = 0 /* BeginningOfLine */;
var margin;
@@ -22400,6 +22565,11 @@
comments.push(text);
indent += text.length;
}
+ if (initialMargin) {
+ // jump straight to saving comments if there is some initial indentation
+ pushComment(initialMargin);
+ state = 2 /* SavingComments */;
+ }
var tok = token();
loop: while (true) {
switch (tok) {
@@ -22424,18 +22594,18 @@
var whitespace = scanner.getTokenText();
// if the whitespace crosses the margin, take only the whitespace that passes the margin
if (margin !== undefined && indent + whitespace.length > margin) {
- comments.push(whitespace.slice(margin - indent - 1));
+ comments.push(whitespace.slice(margin - indent));
}
indent += whitespace.length;
}
break;
case 18 /* OpenBraceToken */:
state = 2 /* SavingComments */;
- if (lookAhead(function () { return nextJSDocToken() === 58 /* AtToken */ && ts.tokenIsIdentifierOrKeyword(nextJSDocToken()) && scanner.getTokenText() === "link"; })) {
+ if (lookAhead(function () { return nextTokenJSDoc() === 58 /* AtToken */ && ts.tokenIsIdentifierOrKeyword(nextTokenJSDoc()) && scanner.getTokenText() === "link"; })) {
pushComment(scanner.getTokenText());
- nextJSDocToken();
+ nextTokenJSDoc();
pushComment(scanner.getTokenText());
- nextJSDocToken();
+ nextTokenJSDoc();
}
pushComment(scanner.getTokenText());
break;
@@ -22453,14 +22623,14 @@
pushComment(scanner.getTokenText());
break;
}
- tok = nextJSDocToken();
+ tok = nextTokenJSDoc();
}
removeLeadingNewlines(comments);
removeTrailingWhitespace(comments);
return comments.length === 0 ? undefined : comments.join("");
}
function parseUnknownTag(start, tagName) {
- var result = createNode(299 /* JSDocTag */, start);
+ var result = createNode(300 /* JSDocTag */, start);
result.tagName = tagName;
return finishNode(result);
}
@@ -22482,17 +22652,21 @@
return token() === 18 /* OpenBraceToken */ ? parseJSDocTypeExpression() : undefined;
}
function parseBracketNameInPropertyAndParamTag() {
- if (token() === 14 /* NoSubstitutionTemplateLiteral */) {
- // a markdown-quoted name: `arg` is not legal jsdoc, but occurs in the wild
- return { name: createIdentifier(/*isIdentifier*/ true), isBracketed: false };
- }
// Looking for something like '[foo]', 'foo', '[foo.bar]' or 'foo.bar'
- var isBracketed = parseOptional(22 /* OpenBracketToken */);
+ var isBracketed = parseOptionalJsdoc(22 /* OpenBracketToken */);
+ if (isBracketed) {
+ skipWhitespace();
+ }
+ // a markdown-quoted name: `arg` is not legal jsdoc, but occurs in the wild
+ var isBackquoted = parseOptionalJsdoc(59 /* BacktickToken */);
var name = parseJSDocEntityName();
+ if (isBackquoted) {
+ parseExpectedTokenJSDoc(59 /* BacktickToken */);
+ }
if (isBracketed) {
skipWhitespace();
// May have an optional default, e.g. '[foo = 42]'
- if (parseOptionalToken(59 /* EqualsToken */)) {
+ if (parseOptionalToken(60 /* EqualsToken */)) {
parseExpression();
}
parseExpected(23 /* CloseBracketToken */);
@@ -22501,9 +22675,9 @@
}
function isObjectOrObjectArrayTypeReference(node) {
switch (node.kind) {
- case 136 /* ObjectKeyword */:
+ case 137 /* ObjectKeyword */:
return true;
- case 169 /* ArrayType */:
+ case 170 /* ArrayType */:
return isObjectOrObjectArrayTypeReference(node.elementType);
default:
return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText === "Object";
@@ -22519,8 +22693,8 @@
typeExpression = tryParseTypeExpression();
}
var result = target === 1 /* Property */ ?
- createNode(310 /* JSDocPropertyTag */, start) :
- createNode(304 /* JSDocParameterTag */, start);
+ createNode(311 /* JSDocPropertyTag */, start) :
+ createNode(305 /* JSDocParameterTag */, start);
var comment = parseTagComments(indent + scanner.getStartPos() - start);
var nestedTypeLiteral = target !== 4 /* CallbackParameter */ && parseNestedTypeLiteral(typeExpression, name, target, indent);
if (nestedTypeLiteral) {
@@ -22537,20 +22711,20 @@
}
function parseNestedTypeLiteral(typeExpression, name, target, indent) {
if (typeExpression && isObjectOrObjectArrayTypeReference(typeExpression.type)) {
- var typeLiteralExpression = createNode(288 /* JSDocTypeExpression */, scanner.getTokenPos());
+ var typeLiteralExpression = createNode(289 /* JSDocTypeExpression */, scanner.getTokenPos());
var child = void 0;
var jsdocTypeLiteral = void 0;
var start_2 = scanner.getStartPos();
var children = void 0;
while (child = tryParse(function () { return parseChildParameterOrPropertyTag(target, indent, name); })) {
- if (child.kind === 304 /* JSDocParameterTag */ || child.kind === 310 /* JSDocPropertyTag */) {
+ if (child.kind === 305 /* JSDocParameterTag */ || child.kind === 311 /* JSDocPropertyTag */) {
children = ts.append(children, child);
}
}
if (children) {
- jsdocTypeLiteral = createNode(297 /* JSDocTypeLiteral */, start_2);
+ jsdocTypeLiteral = createNode(298 /* JSDocTypeLiteral */, start_2);
jsdocTypeLiteral.jsDocPropertyTags = children;
- if (typeExpression.type.kind === 169 /* ArrayType */) {
+ if (typeExpression.type.kind === 170 /* ArrayType */) {
jsdocTypeLiteral.isArrayType = true;
}
typeLiteralExpression.type = finishNode(jsdocTypeLiteral);
@@ -22559,32 +22733,32 @@
}
}
function parseReturnTag(start, tagName) {
- if (ts.forEach(tags, function (t) { return t.kind === 305 /* JSDocReturnTag */; })) {
+ if (ts.some(tags, ts.isJSDocReturnTag)) {
parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText);
}
- var result = createNode(305 /* JSDocReturnTag */, start);
+ var result = createNode(306 /* JSDocReturnTag */, start);
result.tagName = tagName;
result.typeExpression = tryParseTypeExpression();
return finishNode(result);
}
function parseTypeTag(start, tagName) {
- if (ts.forEach(tags, function (t) { return t.kind === 307 /* JSDocTypeTag */; })) {
+ if (ts.some(tags, ts.isJSDocTypeTag)) {
parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText);
}
- var result = createNode(307 /* JSDocTypeTag */, start);
+ var result = createNode(308 /* JSDocTypeTag */, start);
result.tagName = tagName;
result.typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true);
return finishNode(result);
}
function parseAugmentsTag(start, tagName) {
- var result = createNode(300 /* JSDocAugmentsTag */, start);
+ var result = createNode(301 /* JSDocAugmentsTag */, start);
result.tagName = tagName;
result.class = parseExpressionWithTypeArgumentsForAugments();
return finishNode(result);
}
function parseExpressionWithTypeArgumentsForAugments() {
var usedBrace = parseOptional(18 /* OpenBraceToken */);
- var node = createNode(211 /* ExpressionWithTypeArguments */);
+ var node = createNode(212 /* ExpressionWithTypeArguments */);
node.expression = parsePropertyAccessEntityNameExpression();
node.typeArguments = tryParseTypeArguments();
var res = finishNode(node);
@@ -22596,7 +22770,7 @@
function parsePropertyAccessEntityNameExpression() {
var node = parseJSDocIdentifierName();
while (parseOptional(24 /* DotToken */)) {
- var prop = createNode(189 /* PropertyAccessExpression */, node.pos);
+ var prop = createNode(190 /* PropertyAccessExpression */, node.pos);
prop.expression = node;
prop.name = parseJSDocIdentifierName();
node = finishNode(prop);
@@ -22604,19 +22778,19 @@
return node;
}
function parseClassTag(start, tagName) {
- var tag = createNode(301 /* JSDocClassTag */, start);
+ var tag = createNode(302 /* JSDocClassTag */, start);
tag.tagName = tagName;
return finishNode(tag);
}
function parseThisTag(start, tagName) {
- var tag = createNode(306 /* JSDocThisTag */, start);
+ var tag = createNode(307 /* JSDocThisTag */, start);
tag.tagName = tagName;
tag.typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true);
skipWhitespace();
return finishNode(tag);
}
function parseEnumTag(start, tagName) {
- var tag = createNode(303 /* JSDocEnumTag */, start);
+ var tag = createNode(304 /* JSDocEnumTag */, start);
tag.tagName = tagName;
tag.typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true);
skipWhitespace();
@@ -22625,7 +22799,7 @@
function parseTypedefTag(start, tagName, indent) {
var typeExpression = tryParseTypeExpression();
skipWhitespaceOrAsterisk();
- var typedefTag = createNode(309 /* JSDocTypedefTag */, start);
+ var typedefTag = createNode(310 /* JSDocTypedefTag */, start);
typedefTag.tagName = tagName;
typedefTag.fullName = parseJSDocTypeNameWithNamespace();
typedefTag.name = getJSDocTypeAliasName(typedefTag.fullName);
@@ -22639,9 +22813,9 @@
var childTypeTag = void 0;
while (child = tryParse(function () { return parseChildPropertyTag(indent); })) {
if (!jsdocTypeLiteral) {
- jsdocTypeLiteral = createNode(297 /* JSDocTypeLiteral */, start);
+ jsdocTypeLiteral = createNode(298 /* JSDocTypeLiteral */, start);
}
- if (child.kind === 307 /* JSDocTypeTag */) {
+ if (child.kind === 308 /* JSDocTypeTag */) {
if (childTypeTag) {
break;
}
@@ -22654,7 +22828,7 @@
}
}
if (jsdocTypeLiteral) {
- if (typeExpression && typeExpression.type.kind === 169 /* ArrayType */) {
+ if (typeExpression && typeExpression.type.kind === 170 /* ArrayType */) {
jsdocTypeLiteral.isArrayType = true;
}
typedefTag.typeExpression = childTypeTag && childTypeTag.typeExpression && !isObjectOrObjectArrayTypeReference(childTypeTag.typeExpression.type) ?
@@ -22673,7 +22847,7 @@
}
var typeNameOrNamespaceName = parseJSDocIdentifierName();
if (parseOptional(24 /* DotToken */)) {
- var jsDocNamespaceNode = createNode(244 /* ModuleDeclaration */, pos);
+ var jsDocNamespaceNode = createNode(245 /* ModuleDeclaration */, pos);
if (nested) {
jsDocNamespaceNode.flags |= 4 /* NestedNamespace */;
}
@@ -22687,14 +22861,14 @@
return typeNameOrNamespaceName;
}
function parseCallbackTag(start, tagName, indent) {
- var callbackTag = createNode(302 /* JSDocCallbackTag */, start);
+ var callbackTag = createNode(303 /* JSDocCallbackTag */, start);
callbackTag.tagName = tagName;
callbackTag.fullName = parseJSDocTypeNameWithNamespace();
callbackTag.name = getJSDocTypeAliasName(callbackTag.fullName);
skipWhitespace();
callbackTag.comment = parseTagComments(indent);
var child;
- var jsdocSignature = createNode(298 /* JSDocSignature */, start);
+ var jsdocSignature = createNode(299 /* JSDocSignature */, start);
jsdocSignature.parameters = [];
while (child = tryParse(function () { return parseChildParameterOrPropertyTag(4 /* CallbackParameter */, indent); })) {
jsdocSignature.parameters = ts.append(jsdocSignature.parameters, child);
@@ -22702,7 +22876,7 @@
var returnTag = tryParse(function () {
if (parseOptionalJsdoc(58 /* AtToken */)) {
var tag = parseTag(indent);
- if (tag && tag.kind === 305 /* JSDocReturnTag */) {
+ if (tag && tag.kind === 306 /* JSDocReturnTag */) {
return tag;
}
}
@@ -22743,11 +22917,11 @@
var canParseTag = true;
var seenAsterisk = false;
while (true) {
- switch (nextJSDocToken()) {
+ switch (nextTokenJSDoc()) {
case 58 /* AtToken */:
if (canParseTag) {
var child = tryParseChildTag(target, indent);
- if (child && (child.kind === 304 /* JSDocParameterTag */ || child.kind === 310 /* JSDocPropertyTag */) &&
+ if (child && (child.kind === 305 /* JSDocParameterTag */ || child.kind === 311 /* JSDocPropertyTag */) &&
target !== 4 /* CallbackParameter */ &&
name && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) {
return false;
@@ -22766,7 +22940,7 @@
}
seenAsterisk = true;
break;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
canParseTag = false;
break;
case 1 /* EndOfFileToken */:
@@ -22777,7 +22951,7 @@
function tryParseChildTag(target, indent) {
ts.Debug.assert(token() === 58 /* AtToken */);
var start = scanner.getStartPos();
- nextJSDocToken();
+ nextTokenJSDoc();
var tagName = parseJSDocIdentifierName();
skipWhitespace();
var t;
@@ -22811,25 +22985,22 @@
var typeParametersPos = getNodePos();
do {
skipWhitespace();
- var typeParameter = createNode(150 /* TypeParameter */);
+ var typeParameter = createNode(151 /* TypeParameter */);
typeParameter.name = parseJSDocIdentifierName(ts.Diagnostics.Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces);
finishNode(typeParameter);
skipWhitespace();
typeParameters.push(typeParameter);
} while (parseOptionalJsdoc(27 /* CommaToken */));
- var result = createNode(308 /* JSDocTemplateTag */, start);
+ var result = createNode(309 /* JSDocTemplateTag */, start);
result.tagName = tagName;
result.constraint = constraint;
result.typeParameters = createNodeArray(typeParameters, typeParametersPos);
finishNode(result);
return result;
}
- function nextJSDocToken() {
- return currentToken = scanner.scanJSDocToken();
- }
function parseOptionalJsdoc(t) {
if (token() === t) {
- nextJSDocToken();
+ nextTokenJSDoc();
return true;
}
return false;
@@ -22853,14 +23024,14 @@
}
function parseJSDocIdentifierName(message) {
if (!ts.tokenIsIdentifierOrKeyword(token())) {
- return createMissingNode(72 /* Identifier */, /*reportAtCurrentPosition*/ !message, message || ts.Diagnostics.Identifier_expected);
+ return createMissingNode(73 /* Identifier */, /*reportAtCurrentPosition*/ !message, message || ts.Diagnostics.Identifier_expected);
}
var pos = scanner.getTokenPos();
var end = scanner.getTextPos();
- var result = createNode(72 /* Identifier */, pos);
+ var result = createNode(73 /* Identifier */, pos);
result.escapedText = ts.escapeLeadingUnderscores(scanner.getTokenText());
finishNode(result, end);
- nextJSDocToken();
+ nextTokenJSDoc();
return result;
}
}
@@ -22985,7 +23156,7 @@
switch (node.kind) {
case 10 /* StringLiteral */:
case 8 /* NumericLiteral */:
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return true;
}
return false;
@@ -23352,28 +23523,16 @@
ts.isDeclarationFileName = isDeclarationFileName;
/*@internal*/
function processCommentPragmas(context, sourceText) {
- var triviaScanner = ts.createScanner(context.languageVersion, /*skipTrivia*/ false, 0 /* Standard */, sourceText);
var pragmas = [];
- // Keep scanning all the leading trivia in the file until we get to something that
- // isn't trivia. Any single line comment will be analyzed to see if it is a
- // reference comment.
- while (true) {
- var kind = triviaScanner.scan();
- if (!ts.isTrivia(kind)) {
- break;
- }
- var range = {
- kind: triviaScanner.getToken(),
- pos: triviaScanner.getTokenPos(),
- end: triviaScanner.getTextPos(),
- };
+ for (var _i = 0, _a = ts.getLeadingCommentRanges(sourceText, 0) || ts.emptyArray; _i < _a.length; _i++) {
+ var range = _a[_i];
var comment = sourceText.substring(range.pos, range.end);
extractPragmas(pragmas, range, comment);
}
context.pragmas = ts.createMap();
- for (var _i = 0, pragmas_1 = pragmas; _i < pragmas_1.length; _i++) {
- var pragma = pragmas_1[_i];
- if (context.pragmas.has(pragma.name)) { // TODO: GH#18217
+ for (var _b = 0, pragmas_1 = pragmas; _b < pragmas_1.length; _b++) {
+ var pragma = pragmas_1[_b];
+ if (context.pragmas.has(pragma.name)) {
var currentValue = context.pragmas.get(pragma.name);
if (currentValue instanceof Array) {
currentValue.push(pragma.args);
@@ -23404,7 +23563,6 @@
var typeReferenceDirectives_1 = context.typeReferenceDirectives;
var libReferenceDirectives_1 = context.libReferenceDirectives;
ts.forEach(ts.toArray(entryOrList), function (arg) {
- // TODO: GH#18217
var _a = arg.arguments, types = _a.types, lib = _a.lib, path = _a.path;
if (arg.arguments["no-default-lib"]) {
context.hasNoDefaultLib = true;
@@ -23425,7 +23583,7 @@
break;
}
case "amd-dependency": {
- context.amdDependencies = ts.map(ts.toArray(entryOrList), function (x) { return ({ name: x.arguments.name, path: x.arguments.path }); }); // TODO: GH#18217
+ context.amdDependencies = ts.map(ts.toArray(entryOrList), function (x) { return ({ name: x.arguments.name, path: x.arguments.path }); });
break;
}
case "amd-module": {
@@ -23448,7 +23606,7 @@
case "ts-check": {
// _last_ of either nocheck or check in a file is the "winner"
ts.forEach(ts.toArray(entryOrList), function (entry) {
- if (!context.checkJsDirective || entry.range.pos > context.checkJsDirective.pos) { // TODO: GH#18217
+ if (!context.checkJsDirective || entry.range.pos > context.checkJsDirective.pos) {
context.checkJsDirective = {
enabled: key === "ts-check",
end: entry.range.end,
@@ -23564,10 +23722,10 @@
if (lhs.kind !== rhs.kind) {
return false;
}
- if (lhs.kind === 72 /* Identifier */) {
+ if (lhs.kind === 73 /* Identifier */) {
return lhs.escapedText === rhs.escapedText;
}
- if (lhs.kind === 100 /* ThisKeyword */) {
+ if (lhs.kind === 101 /* ThisKeyword */) {
return true;
}
// If we are at this statement then we must have PropertyAccessExpression and because tag name in Jsx element can only
@@ -23596,6 +23754,7 @@
["es2017", "lib.es2017.d.ts"],
["es2018", "lib.es2018.d.ts"],
["es2019", "lib.es2019.d.ts"],
+ ["es2020", "lib.es2020.d.ts"],
["esnext", "lib.esnext.d.ts"],
// Host only
["dom", "lib.dom.d.ts"],
@@ -23624,8 +23783,11 @@
["es2018.promise", "lib.es2018.promise.d.ts"],
["es2018.regexp", "lib.es2018.regexp.d.ts"],
["es2019.array", "lib.es2019.array.d.ts"],
+ ["es2019.object", "lib.es2019.object.d.ts"],
["es2019.string", "lib.es2019.string.d.ts"],
["es2019.symbol", "lib.es2019.symbol.d.ts"],
+ ["es2020.string", "lib.es2020.string.d.ts"],
+ ["es2020.symbol.wellknown", "lib.es2020.symbol.wellknown.d.ts"],
["esnext.array", "lib.es2019.array.d.ts"],
["esnext.symbol", "lib.es2019.symbol.d.ts"],
["esnext.asynciterable", "lib.es2018.asynciterable.d.ts"],
@@ -23712,6 +23874,13 @@
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Show_verbose_diagnostic_information
},
+ {
+ name: "incremental",
+ shortName: "i",
+ type: "boolean",
+ category: ts.Diagnostics.Basic_Options,
+ description: ts.Diagnostics.Enable_incremental_compilation,
+ },
];
/* @internal */
ts.optionDeclarations = ts.commonOptionsWithBuild.concat([
@@ -23775,10 +23944,12 @@
es2017: 4 /* ES2017 */,
es2018: 5 /* ES2018 */,
es2019: 6 /* ES2019 */,
- esnext: 7 /* ESNext */,
+ es2020: 7 /* ES2020 */,
+ esnext: 8 /* ESNext */,
}),
affectsSourceFile: true,
affectsModuleResolution: true,
+ affectsEmit: true,
paramType: ts.Diagnostics.VERSION,
showInSimplifiedHelpView: true,
category: ts.Diagnostics.Basic_Options,
@@ -23846,6 +24017,7 @@
name: "declaration",
shortName: "d",
type: "boolean",
+ affectsEmit: true,
showInSimplifiedHelpView: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Generates_corresponding_d_ts_file,
@@ -23853,6 +24025,7 @@
{
name: "declarationMap",
type: "boolean",
+ affectsEmit: true,
showInSimplifiedHelpView: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Generates_a_sourcemap_for_each_corresponding_d_ts_file,
@@ -23860,12 +24033,14 @@
{
name: "emitDeclarationOnly",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Only_emit_d_ts_declaration_files,
},
{
name: "sourceMap",
type: "boolean",
+ affectsEmit: true,
showInSimplifiedHelpView: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Generates_corresponding_map_file,
@@ -23873,6 +24048,7 @@
{
name: "outFile",
type: "string",
+ affectsEmit: true,
isFilePath: true,
paramType: ts.Diagnostics.FILE,
showInSimplifiedHelpView: true,
@@ -23882,6 +24058,7 @@
{
name: "outDir",
type: "string",
+ affectsEmit: true,
isFilePath: true,
paramType: ts.Diagnostics.DIRECTORY,
showInSimplifiedHelpView: true,
@@ -23891,6 +24068,7 @@
{
name: "rootDir",
type: "string",
+ affectsEmit: true,
isFilePath: true,
paramType: ts.Diagnostics.LOCATION,
category: ts.Diagnostics.Basic_Options,
@@ -23899,29 +24077,24 @@
{
name: "composite",
type: "boolean",
+ affectsEmit: true,
isTSConfigOnly: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Enable_project_compilation,
},
{
- name: "incremental",
- type: "boolean",
- isTSConfigOnly: true,
- category: ts.Diagnostics.Basic_Options,
- description: ts.Diagnostics.Enable_incremental_compilation,
- },
- {
name: "tsBuildInfoFile",
type: "string",
+ affectsEmit: true,
isFilePath: true,
paramType: ts.Diagnostics.FILE,
- isTSConfigOnly: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Specify_file_to_store_incremental_compilation_information,
},
{
name: "removeComments",
type: "boolean",
+ affectsEmit: true,
showInSimplifiedHelpView: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Do_not_emit_comments_to_output,
@@ -23929,6 +24102,7 @@
{
name: "noEmit",
type: "boolean",
+ affectsEmit: true,
showInSimplifiedHelpView: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Do_not_emit_outputs,
@@ -23936,12 +24110,14 @@
{
name: "importHelpers",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Import_emit_helpers_from_tslib
},
{
name: "downlevelIteration",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3
},
@@ -24145,10 +24321,18 @@
category: ts.Diagnostics.Module_Resolution_Options,
description: ts.Diagnostics.Do_not_resolve_the_real_path_of_symlinks,
},
+ {
+ name: "allowUmdGlobalAccess",
+ type: "boolean",
+ affectsSemanticDiagnostics: true,
+ category: ts.Diagnostics.Module_Resolution_Options,
+ description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
+ },
// Source Maps
{
name: "sourceRoot",
type: "string",
+ affectsEmit: true,
paramType: ts.Diagnostics.LOCATION,
category: ts.Diagnostics.Source_Map_Options,
description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations,
@@ -24156,6 +24340,7 @@
{
name: "mapRoot",
type: "string",
+ affectsEmit: true,
paramType: ts.Diagnostics.LOCATION,
category: ts.Diagnostics.Source_Map_Options,
description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
@@ -24163,12 +24348,14 @@
{
name: "inlineSourceMap",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Source_Map_Options,
description: ts.Diagnostics.Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file
},
{
name: "inlineSources",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Source_Map_Options,
description: ts.Diagnostics.Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap_to_be_set
},
@@ -24201,6 +24388,7 @@
{
name: "out",
type: "string",
+ affectsEmit: true,
isFilePath: false,
// for correct behaviour, please use outFile
category: ts.Diagnostics.Advanced_Options,
@@ -24210,6 +24398,7 @@
{
name: "reactNamespace",
type: "string",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react_JSX_emit
},
@@ -24228,6 +24417,7 @@
{
name: "emitBOM",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files
},
@@ -24243,6 +24433,7 @@
crlf: 0 /* CarriageReturnLineFeed */,
lf: 1 /* LineFeed */
}),
+ affectsEmit: true,
paramType: ts.Diagnostics.NEWLINE,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix,
@@ -24270,6 +24461,7 @@
{
name: "stripInternal",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation,
},
@@ -24290,24 +24482,28 @@
{
name: "noEmitHelpers",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Do_not_generate_custom_helper_functions_like_extends_in_compiled_output
},
{
name: "noEmitOnError",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported,
},
{
name: "preserveConstEnums",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code
},
{
name: "declarationDir",
type: "string",
+ affectsEmit: true,
isFilePath: true,
paramType: ts.Diagnostics.DIRECTORY,
category: ts.Diagnostics.Advanced_Options,
@@ -24390,6 +24586,8 @@
/* @internal */
ts.semanticDiagnosticsOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsSemanticDiagnostics; });
/* @internal */
+ ts.affectsEmitOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsEmit; });
+ /* @internal */
ts.moduleResolutionOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsModuleResolution; });
/* @internal */
ts.sourceFileAffectingCompilerOptions = ts.optionDeclarations.filter(function (option) {
@@ -24797,7 +24995,7 @@
/**
* Reads the config file, reports errors if any and exits if the config file cannot be found
*/
- function getParsedCommandLineOfConfigFile(configFileName, optionsToExtend, host) {
+ function getParsedCommandLineOfConfigFile(configFileName, optionsToExtend, host, extendedConfigCache) {
var configFileText;
try {
configFileText = host.readFile(configFileName);
@@ -24817,7 +25015,9 @@
result.path = ts.toPath(configFileName, cwd, ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames));
result.resolvedPath = result.path;
result.originalFileName = result.fileName;
- return parseJsonSourceFileConfigFileContent(result, host, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), cwd), optionsToExtend, ts.getNormalizedAbsolutePath(configFileName, cwd));
+ return parseJsonSourceFileConfigFileContent(result, host, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), cwd), optionsToExtend, ts.getNormalizedAbsolutePath(configFileName, cwd),
+ /*resolutionStack*/ undefined,
+ /*extraFileExtension*/ undefined, extendedConfigCache);
}
ts.getParsedCommandLineOfConfigFile = getParsedCommandLineOfConfigFile;
/**
@@ -24956,7 +25156,7 @@
var result = returnValue ? {} : undefined;
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var element = _a[_i];
- if (element.kind !== 275 /* PropertyAssignment */) {
+ if (element.kind !== 276 /* PropertyAssignment */) {
errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected));
continue;
}
@@ -25012,13 +25212,13 @@
}
function convertPropertyValueToJson(valueExpression, option) {
switch (valueExpression.kind) {
- case 102 /* TrueKeyword */:
+ case 103 /* TrueKeyword */:
reportInvalidOptionValue(option && option.type !== "boolean");
return true;
- case 87 /* FalseKeyword */:
+ case 88 /* FalseKeyword */:
reportInvalidOptionValue(option && option.type !== "boolean");
return false;
- case 96 /* NullKeyword */:
+ case 97 /* NullKeyword */:
reportInvalidOptionValue(option && option.name === "extends"); // "extends" is the only option we don't allow null/undefined for
return null; // tslint:disable-line:no-null-keyword
case 10 /* StringLiteral */:
@@ -25038,13 +25238,13 @@
case 8 /* NumericLiteral */:
reportInvalidOptionValue(option && option.type !== "number");
return Number(valueExpression.text);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
if (valueExpression.operator !== 39 /* MinusToken */ || valueExpression.operand.kind !== 8 /* NumericLiteral */) {
break; // not valid JSON syntax
}
reportInvalidOptionValue(option && option.type !== "number");
return -Number(valueExpression.operand.text);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
reportInvalidOptionValue(option && option.type !== "object");
var objectLiteralExpression = valueExpression;
// Currently having element option declaration in the tsconfig with type "object"
@@ -25061,7 +25261,7 @@
return convertObjectLiteralExpressionToJson(objectLiteralExpression, /* knownOptions*/ undefined,
/*extraKeyDiagnosticMessage */ undefined, /*parentOption*/ undefined);
}
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
reportInvalidOptionValue(option && option.type !== "list");
return convertArrayLiteralExpressionToJson(valueExpression.elements, option && option.element);
}
@@ -25317,8 +25517,8 @@
* @param basePath A root directory to resolve relative path entries in the config
* file to. e.g. outDir
*/
- function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) {
- return parseJsonConfigFileContentWorker(json, /*sourceFile*/ undefined, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions);
+ function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache) {
+ return parseJsonConfigFileContentWorker(json, /*sourceFile*/ undefined, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache);
}
ts.parseJsonConfigFileContent = parseJsonConfigFileContent;
/**
@@ -25328,8 +25528,8 @@
* @param basePath A root directory to resolve relative path entries in the config
* file to. e.g. outDir
*/
- function parseJsonSourceFileConfigFileContent(sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) {
- return parseJsonConfigFileContentWorker(/*json*/ undefined, sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions);
+ function parseJsonSourceFileConfigFileContent(sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache) {
+ return parseJsonConfigFileContentWorker(/*json*/ undefined, sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache);
}
ts.parseJsonSourceFileConfigFileContent = parseJsonSourceFileConfigFileContent;
/*@internal*/
@@ -25357,13 +25557,13 @@
* file to. e.g. outDir
* @param resolutionStack Only present for backwards-compatibility. Should be empty.
*/
- function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) {
+ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache) {
if (existingOptions === void 0) { existingOptions = {}; }
if (resolutionStack === void 0) { resolutionStack = []; }
if (extraFileExtensions === void 0) { extraFileExtensions = []; }
ts.Debug.assert((json === undefined && sourceFile !== undefined) || (json !== undefined && sourceFile === undefined));
var errors = [];
- var parsedConfig = parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors);
+ var parsedConfig = parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors, extendedConfigCache);
var raw = parsedConfig.raw;
var options = ts.extend(existingOptions, parsedConfig.options || {});
options.configFilePath = configFileName && ts.normalizeSlashes(configFileName);
@@ -25503,7 +25703,7 @@
* This *just* extracts options/include/exclude/files out of a config file.
* It does *not* resolve the included files.
*/
- function parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors) {
+ function parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors, extendedConfigCache) {
basePath = ts.normalizeSlashes(basePath);
var resolvedPath = ts.getNormalizedAbsolutePath(configFileName || "", basePath);
if (resolutionStack.indexOf(resolvedPath) >= 0) {
@@ -25516,7 +25716,7 @@
if (ownConfig.extendedConfigPath) {
// copy the resolution stack so it is never reused between branches in potential diamond-problem scenarios.
resolutionStack = resolutionStack.concat([resolvedPath]);
- var extendedConfig = getExtendedConfig(sourceFile, ownConfig.extendedConfigPath, host, basePath, resolutionStack, errors);
+ var extendedConfig = getExtendedConfig(sourceFile, ownConfig.extendedConfigPath, host, basePath, resolutionStack, errors, extendedConfigCache);
if (extendedConfig && isSuccessfulParsedTsconfig(extendedConfig)) {
var baseRaw_1 = extendedConfig.raw;
var raw_1 = ownConfig.raw;
@@ -25613,7 +25813,7 @@
if (!host.fileExists(extendedConfigPath) && !ts.endsWith(extendedConfigPath, ".json" /* Json */)) {
extendedConfigPath = extendedConfigPath + ".json";
if (!host.fileExists(extendedConfigPath)) {
- errors.push(createDiagnostic(ts.Diagnostics.File_0_does_not_exist, extendedConfig));
+ errors.push(createDiagnostic(ts.Diagnostics.File_0_not_found, extendedConfig));
return undefined;
}
}
@@ -25624,24 +25824,23 @@
if (resolved.resolvedModule) {
return resolved.resolvedModule.resolvedFileName;
}
- errors.push(createDiagnostic(ts.Diagnostics.File_0_does_not_exist, extendedConfig));
+ errors.push(createDiagnostic(ts.Diagnostics.File_0_not_found, extendedConfig));
return undefined;
}
- function getExtendedConfig(sourceFile, extendedConfigPath, host, basePath, resolutionStack, errors) {
+ function getExtendedConfig(sourceFile, extendedConfigPath, host, basePath, resolutionStack, errors, extendedConfigCache) {
var _a;
- var extendedResult = readJsonConfigFile(extendedConfigPath, function (path) { return host.readFile(path); });
- if (sourceFile) {
- sourceFile.extendedSourceFiles = [extendedResult.fileName];
- }
- if (extendedResult.parseDiagnostics.length) {
- errors.push.apply(errors, extendedResult.parseDiagnostics);
- return undefined;
+ var path = host.useCaseSensitiveFileNames ? extendedConfigPath : ts.toLowerCase(extendedConfigPath);
+ var value;
+ var extendedResult;
+ var extendedConfig;
+ if (extendedConfigCache && (value = extendedConfigCache.get(path))) {
+ (extendedResult = value.extendedResult, extendedConfig = value.extendedConfig);
}
+ else {
+ extendedResult = readJsonConfigFile(extendedConfigPath, function (path) { return host.readFile(path); });
+ if (!extendedResult.parseDiagnostics.length) {
var extendedDirname = ts.getDirectoryPath(extendedConfigPath);
- var extendedConfig = parseConfig(/*json*/ undefined, extendedResult, host, extendedDirname, ts.getBaseFileName(extendedConfigPath), resolutionStack, errors);
- if (sourceFile && extendedResult.extendedSourceFiles) {
- (_a = sourceFile.extendedSourceFiles).push.apply(_a, extendedResult.extendedSourceFiles);
- }
+ extendedConfig = parseConfig(/*json*/ undefined, extendedResult, host, extendedDirname, ts.getBaseFileName(extendedConfigPath), resolutionStack, errors, extendedConfigCache);
if (isSuccessfulParsedTsconfig(extendedConfig)) {
// Update the paths to reflect base path
var relativeDifference_1 = ts.convertToRelativePath(extendedDirname, basePath, ts.identity);
@@ -25656,6 +25855,21 @@
mapPropertiesInRawIfNotUndefined("exclude");
mapPropertiesInRawIfNotUndefined("files");
}
+ }
+ if (extendedConfigCache) {
+ extendedConfigCache.set(path, { extendedResult: extendedResult, extendedConfig: extendedConfig });
+ }
+ }
+ if (sourceFile) {
+ sourceFile.extendedSourceFiles = [extendedResult.fileName];
+ if (extendedResult.extendedSourceFiles) {
+ (_a = sourceFile.extendedSourceFiles).push.apply(_a, extendedResult.extendedSourceFiles);
+ }
+ }
+ if (extendedResult.parseDiagnostics.length) {
+ errors.push.apply(errors, extendedResult.parseDiagnostics);
+ return undefined;
+ }
return extendedConfig;
}
function convertCompileOnSaveOptionFromJson(jsonOption, basePath, errors) {
@@ -26125,11 +26339,22 @@
return !!compilerOptions.traceResolution && host.trace !== undefined;
}
ts.isTraceEnabled = isTraceEnabled;
- function withPackageId(packageId, r) {
+ function withPackageId(packageInfo, r) {
+ var packageId;
+ if (r && packageInfo) {
+ var packageJsonContent = packageInfo.packageJsonContent;
+ if (typeof packageJsonContent.name === "string" && typeof packageJsonContent.version === "string") {
+ packageId = {
+ name: packageJsonContent.name,
+ subModuleName: r.path.slice(packageInfo.packageDirectory.length + ts.directorySeparator.length),
+ version: packageJsonContent.version
+ };
+ }
+ }
return r && { path: r.path, extension: r.ext, packageId: packageId };
}
function noPackageId(r) {
- return withPackageId(/*packageId*/ undefined, r);
+ return withPackageId(/*packageInfo*/ undefined, r);
}
function removeIgnoredPackageId(r) {
if (r) {
@@ -26181,8 +26406,15 @@
}
function readPackageJsonPathField(jsonContent, fieldName, baseDirectory, state) {
var fileName = readPackageJsonField(jsonContent, fieldName, "string", state);
- if (fileName === undefined)
+ if (fileName === undefined) {
return;
+ }
+ if (!fileName) {
+ if (state.traceEnabled) {
+ trace(state.host, ts.Diagnostics.package_json_had_a_falsy_0_field, fieldName);
+ }
+ return;
+ }
var path = ts.normalizePath(ts.combinePaths(baseDirectory, fileName));
if (state.traceEnabled) {
trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, fileName, path);
@@ -26335,8 +26567,13 @@
var fileName = resolved.fileName, packageId = resolved.packageId;
var resolvedFileName = options.preserveSymlinks ? fileName : realPath(fileName, host, traceEnabled);
if (traceEnabled) {
+ if (packageId) {
+ trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3, typeReferenceDirectiveName, resolvedFileName, ts.packageIdToString(packageId), primary);
+ }
+ else {
trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolvedFileName, primary);
}
+ }
resolvedTypeReferenceDirective = { primary: primary, resolvedFileName: resolvedFileName, packageId: packageId, isExternalLibraryImport: pathContainsNodeModules(fileName) };
}
return { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations };
@@ -26437,20 +26674,28 @@
return result;
}
ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames;
- function createModuleResolutionCache(currentDirectory, getCanonicalFileName) {
- return createModuleResolutionCacheWithMaps(createCacheWithRedirects(), createCacheWithRedirects(), currentDirectory, getCanonicalFileName);
+ function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options) {
+ return createModuleResolutionCacheWithMaps(createCacheWithRedirects(options), createCacheWithRedirects(options), currentDirectory, getCanonicalFileName);
}
ts.createModuleResolutionCache = createModuleResolutionCache;
/*@internal*/
- function createCacheWithRedirects() {
+ function createCacheWithRedirects(options) {
var ownMap = ts.createMap();
var redirectsMap = ts.createMap();
return {
ownMap: ownMap,
redirectsMap: redirectsMap,
getOrCreateMapOfCacheRedirects: getOrCreateMapOfCacheRedirects,
- clear: clear
+ clear: clear,
+ setOwnOptions: setOwnOptions,
+ setOwnMap: setOwnMap
};
+ function setOwnOptions(newOptions) {
+ options = newOptions;
+ }
+ function setOwnMap(newOwnMap) {
+ ownMap = newOwnMap;
+ }
function getOrCreateMapOfCacheRedirects(redirectedReference) {
if (!redirectedReference) {
return ownMap;
@@ -26458,7 +26703,8 @@
var path = redirectedReference.sourceFile.path;
var redirects = redirectsMap.get(path);
if (!redirects) {
- redirects = ts.createMap();
+ // Reuse map if redirected reference map uses same resolution
+ redirects = !options || ts.optionsHaveModuleResolutionChanges(options, redirectedReference.commandLine.options) ? ts.createMap() : ownMap;
redirectsMap.set(path, redirects);
}
return redirects;
@@ -26471,7 +26717,7 @@
ts.createCacheWithRedirects = createCacheWithRedirects;
/*@internal*/
function createModuleResolutionCacheWithMaps(directoryToModuleNameMap, moduleNameToDirectoryMap, currentDirectory, getCanonicalFileName) {
- return { getOrCreateCacheForDirectory: getOrCreateCacheForDirectory, getOrCreateCacheForModuleName: getOrCreateCacheForModuleName };
+ return { getOrCreateCacheForDirectory: getOrCreateCacheForDirectory, getOrCreateCacheForModuleName: getOrCreateCacheForModuleName, directoryToModuleNameMap: directoryToModuleNameMap, moduleNameToDirectoryMap: moduleNameToDirectoryMap };
function getOrCreateCacheForDirectory(directoryName, redirectedReference) {
var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName);
return getOrCreateCache(directoryToModuleNameMap, redirectedReference, path, ts.createMap);
@@ -26614,8 +26860,13 @@
}
if (traceEnabled) {
if (result.resolvedModule) {
+ if (result.resolvedModule.packageId) {
+ trace(host, ts.Diagnostics.Module_name_0_was_successfully_resolved_to_1_with_Package_ID_2, moduleName, result.resolvedModule.resolvedFileName, ts.packageIdToString(result.resolvedModule.packageId));
+ }
+ else {
trace(host, ts.Diagnostics.Module_name_0_was_successfully_resolved_to_1, moduleName, result.resolvedModule.resolvedFileName);
}
+ }
else {
trace(host, ts.Diagnostics.Module_name_0_was_not_resolved, moduleName);
}
@@ -26884,10 +27135,9 @@
}
var resolvedFromFile = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state);
if (resolvedFromFile) {
- var nm = considerPackageJson ? parseNodeModuleFromPath(resolvedFromFile) : undefined;
- var packageInfo = nm && getPackageJsonInfo(nm.packageDirectory, nm.subModuleName, /*onlyRecordFailures*/ false, state);
- var packageId = packageInfo && packageInfo.packageId;
- return withPackageId(packageId, resolvedFromFile);
+ var packageDirectory = considerPackageJson ? parseNodeModuleFromPath(resolvedFromFile) : undefined;
+ var packageInfo = packageDirectory ? getPackageJsonInfo(packageDirectory, /*onlyRecordFailures*/ false, state) : undefined;
+ return withPackageId(packageInfo, resolvedFromFile);
}
}
if (!onlyRecordFailures) {
@@ -26913,11 +27163,10 @@
* (Not neeeded for `loadModuleFromNodeModules` as that looks up the `package.json` as part of resolution.)
*
* packageDirectory is the directory of the package itself.
- * subModuleName is the path within the package.
- * For `blah/node_modules/foo/index.d.ts` this is { packageDirectory: "foo", subModuleName: "index.d.ts" }. (Part before "/node_modules/" is ignored.)
- * For `/node_modules/foo/bar.d.ts` this is { packageDirectory: "foo", subModuleName": "bar/index.d.ts" }.
- * For `/node_modules/@types/foo/bar/index.d.ts` this is { packageDirectory: "@types/foo", subModuleName: "bar/index.d.ts" }.
- * For `/node_modules/foo/bar/index.d.ts` this is { packageDirectory: "foo", subModuleName": "bar/index.d.ts" }.
+ * For `blah/node_modules/foo/index.d.ts` this is packageDirectory: "foo"
+ * For `/node_modules/foo/bar.d.ts` this is packageDirectory: "foo"
+ * For `/node_modules/@types/foo/bar/index.d.ts` this is packageDirectory: "@types/foo"
+ * For `/node_modules/foo/bar/index.d.ts` this is packageDirectory: "foo"
*/
function parseNodeModuleFromPath(resolved) {
var path = ts.normalizePath(resolved.path);
@@ -26930,26 +27179,12 @@
if (path.charCodeAt(indexAfterNodeModules) === 64 /* at */) {
indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterPackageName);
}
- var packageDirectory = path.slice(0, indexAfterPackageName);
- var subModuleName = ts.removeExtension(path.slice(indexAfterPackageName + 1), resolved.ext) + ".d.ts" /* Dts */;
- return { packageDirectory: packageDirectory, subModuleName: subModuleName };
+ return path.slice(0, indexAfterPackageName);
}
function moveToNextDirectorySeparatorIfAvailable(path, prevSeparatorIndex) {
var nextSeparatorIndex = path.indexOf(ts.directorySeparator, prevSeparatorIndex + 1);
return nextSeparatorIndex === -1 ? prevSeparatorIndex : nextSeparatorIndex;
}
- function addExtensionAndIndex(path) {
- if (path === "") {
- return "index.d.ts";
- }
- if (ts.endsWith(path, ".d.ts")) {
- return path;
- }
- if (path === "index" || ts.endsWith(path, "/index")) {
- return path + ".d.ts";
- }
- return path + "/index.d.ts";
- }
function loadModuleFromFileNoPackageId(extensions, candidate, onlyRecordFailures, state) {
return noPackageId(loadModuleFromFile(extensions, candidate, onlyRecordFailures, state));
}
@@ -27023,52 +27258,22 @@
}
function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson) {
if (considerPackageJson === void 0) { considerPackageJson = true; }
- var packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, "", onlyRecordFailures, state) : undefined;
- var packageId = packageInfo && packageInfo.packageId;
+ var packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, onlyRecordFailures, state) : undefined;
var packageJsonContent = packageInfo && packageInfo.packageJsonContent;
- var versionPaths = packageJsonContent && readPackageJsonTypesVersionPaths(packageJsonContent, state);
- return withPackageId(packageId, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths));
+ var versionPaths = packageInfo && packageInfo.versionPaths;
+ return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths));
}
- function getPackageJsonInfo(packageDirectory, subModuleName, onlyRecordFailures, state) {
+ function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
var host = state.host, traceEnabled = state.traceEnabled;
var directoryExists = !onlyRecordFailures && ts.directoryProbablyExists(packageDirectory, host);
var packageJsonPath = ts.combinePaths(packageDirectory, "package.json");
if (directoryExists && host.fileExists(packageJsonPath)) {
var packageJsonContent = ts.readJson(packageJsonPath, host);
- if (subModuleName === "") { // looking up the root - need to handle types/typings/main redirects for subModuleName
- var path = readPackageJsonTypesFields(packageJsonContent, packageDirectory, state);
- if (typeof path === "string") {
- subModuleName = addExtensionAndIndex(path.substring(packageDirectory.length + 1));
- }
- else {
- var jsPath = readPackageJsonMainField(packageJsonContent, packageDirectory, state);
- if (typeof jsPath === "string" && jsPath.length > packageDirectory.length) {
- var potentialSubModule_1 = jsPath.substring(packageDirectory.length + 1);
- subModuleName = (ts.forEach(ts.supportedJSExtensions, function (extension) {
- return ts.tryRemoveExtension(potentialSubModule_1, extension);
- }) || potentialSubModule_1) + ".d.ts" /* Dts */;
- }
- else {
- subModuleName = "index.d.ts";
- }
- }
- }
- if (!ts.endsWith(subModuleName, ".d.ts" /* Dts */)) {
- subModuleName = addExtensionAndIndex(subModuleName);
- }
- var versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state);
- var packageId = typeof packageJsonContent.name === "string" && typeof packageJsonContent.version === "string"
- ? { name: packageJsonContent.name, subModuleName: subModuleName, version: packageJsonContent.version }
- : undefined;
if (traceEnabled) {
- if (packageId) {
- trace(host, ts.Diagnostics.Found_package_json_at_0_Package_ID_is_1, packageJsonPath, ts.packageIdToString(packageId));
- }
- else {
trace(host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath);
}
- }
- return { packageJsonContent: packageJsonContent, packageId: packageId, versionPaths: versionPaths };
+ var versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state);
+ return { packageDirectory: packageDirectory, packageJsonContent: packageJsonContent, versionPaths: versionPaths };
}
else {
if (directoryExists && traceEnabled) {
@@ -27207,37 +27412,31 @@
function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state) {
var candidate = ts.normalizePath(ts.combinePaths(nodeModulesDirectory, moduleName));
// First look for a nested package.json, as in `node_modules/foo/bar/package.json`.
- var packageJsonContent;
- var packageId;
- var versionPaths;
- var packageInfo = getPackageJsonInfo(candidate, "", !nodeModulesDirectoryExists, state);
+ var packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state);
if (packageInfo) {
- (packageJsonContent = packageInfo.packageJsonContent, packageId = packageInfo.packageId, versionPaths = packageInfo.versionPaths);
var fromFile = loadModuleFromFile(extensions, candidate, !nodeModulesDirectoryExists, state);
if (fromFile) {
return noPackageId(fromFile);
}
- var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageJsonContent, versionPaths);
- return withPackageId(packageId, fromDirectory);
+ var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageInfo.packageJsonContent, packageInfo.versionPaths);
+ return withPackageId(packageInfo, fromDirectory);
}
var loader = function (extensions, candidate, onlyRecordFailures, state) {
var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) ||
- loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths);
- return withPackageId(packageId, pathAndExtension);
+ loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.packageJsonContent, packageInfo && packageInfo.versionPaths);
+ return withPackageId(packageInfo, pathAndExtension);
};
var _a = parsePackageName(moduleName), packageName = _a.packageName, rest = _a.rest;
if (rest !== "") { // If "rest" is empty, we just did this search above.
var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName);
// Don't use a "types" or "main" from here because we're not loading the root, but a subdirectory -- just here for the packageId and path mappings.
- var packageInfo_1 = getPackageJsonInfo(packageDirectory, rest, !nodeModulesDirectoryExists, state);
- if (packageInfo_1)
- (packageId = packageInfo_1.packageId, versionPaths = packageInfo_1.versionPaths);
- if (versionPaths) {
+ packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state);
+ if (packageInfo && packageInfo.versionPaths) {
if (state.traceEnabled) {
- trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, versionPaths.version, ts.version, rest);
+ trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.versionPaths.version, ts.version, rest);
}
var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host);
- var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, versionPaths.paths, loader, !packageDirectoryExists, state);
+ var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.versionPaths.paths, loader, !packageDirectoryExists, state);
if (fromPaths) {
return fromPaths.value;
}
@@ -27405,24 +27604,24 @@
// A module is uninstantiated if it contains only
switch (node.kind) {
// 1. interface declarations, type alias declarations
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return 0 /* NonInstantiated */;
// 2. const enum declarations
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
if (ts.isEnumConst(node)) {
return 2 /* ConstEnumOnly */;
}
break;
// 3. non-exported import declarations
- case 249 /* ImportDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
if (!(ts.hasModifier(node, 1 /* Export */))) {
return 0 /* NonInstantiated */;
}
break;
// 4. other uninstantiated module declarations.
- case 245 /* ModuleBlock */: {
+ case 246 /* ModuleBlock */: {
var state_1 = 0 /* NonInstantiated */;
ts.forEachChild(node, function (n) {
var childState = getModuleInstanceStateWorker(n);
@@ -27444,9 +27643,9 @@
});
return state_1;
}
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return getModuleInstanceState(node);
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
// Only jsdoc typedef definition can exist in jsdoc namespace, and it should
// be considered the same as type alias
if (node.isInJSDocNamespace) {
@@ -27612,7 +27811,7 @@
// Should not be called on a declaration with a computed property name,
// unless it is a well known Symbol.
function getDeclarationName(node) {
- if (node.kind === 254 /* ExportAssignment */) {
+ if (node.kind === 255 /* ExportAssignment */) {
return node.isExportEquals ? "export=" /* ExportEquals */ : "default" /* Default */;
}
var name = ts.getNameOfDeclaration(node);
@@ -27621,7 +27820,7 @@
var moduleName = ts.getTextOfIdentifierOrLiteral(name);
return (ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + moduleName + "\"");
}
- if (name.kind === 149 /* ComputedPropertyName */) {
+ if (name.kind === 150 /* ComputedPropertyName */) {
var nameExpression = name.expression;
// treat computed property names where expression is string/numeric literal as just string/numeric literal
if (ts.isStringOrNumericLiteralLike(nameExpression)) {
@@ -27633,36 +27832,36 @@
return ts.isPropertyNameLiteral(name) ? ts.getEscapedTextOfIdentifierOrLiteral(name) : undefined;
}
switch (node.kind) {
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return "__constructor" /* Constructor */;
- case 165 /* FunctionType */:
- case 160 /* CallSignature */:
- case 298 /* JSDocSignature */:
+ case 166 /* FunctionType */:
+ case 161 /* CallSignature */:
+ case 299 /* JSDocSignature */:
return "__call" /* Call */;
- case 166 /* ConstructorType */:
- case 161 /* ConstructSignature */:
+ case 167 /* ConstructorType */:
+ case 162 /* ConstructSignature */:
return "__new" /* New */;
- case 162 /* IndexSignature */:
+ case 163 /* IndexSignature */:
return "__index" /* Index */;
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return "__export" /* ExportStar */;
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
// json file should behave as
// module.exports = ...
return "export=" /* ExportEquals */;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
if (ts.getAssignmentDeclarationKind(node) === 2 /* ModuleExports */) {
// module.exports = ...
return "export=" /* ExportEquals */;
}
ts.Debug.fail("Unknown binary declaration kind");
break;
- case 294 /* JSDocFunctionType */:
+ case 295 /* JSDocFunctionType */:
return (ts.isJSDocConstructSignature(node) ? "__new" /* New */ : "__call" /* Call */);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
// Parameters with names are handled at the top of this function. Parameters
// without names can only come from JSDocFunctionTypes.
- ts.Debug.assert(node.parent.kind === 294 /* JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: " + (ts.SyntaxKind ? ts.SyntaxKind[node.parent.kind] : node.parent.kind) + ", expected JSDocFunctionType"; });
+ ts.Debug.assert(node.parent.kind === 295 /* JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: " + (ts.SyntaxKind ? ts.SyntaxKind[node.parent.kind] : node.parent.kind) + ", expected JSDocFunctionType"; });
var functionType = node.parent;
var index = functionType.parameters.indexOf(node);
return "arg" + index;
@@ -27762,7 +27961,7 @@
// 1. multiple export default of class declaration or function declaration by checking NodeFlags.Default
// 2. multiple export default of export assignment. This one doesn't have NodeFlags.Default on (as export default doesn't considered as modifiers)
if (symbol.declarations && symbol.declarations.length &&
- (node.kind === 254 /* ExportAssignment */ && !node.isExportEquals)) {
+ (node.kind === 255 /* ExportAssignment */ && !node.isExportEquals)) {
message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports;
messageNeedsName_1 = false;
multipleDefaultExports_1 = true;
@@ -27797,7 +27996,7 @@
function declareModuleMember(node, symbolFlags, symbolExcludes) {
var hasExportModifier = ts.getCombinedModifierFlags(node) & 1 /* Export */;
if (symbolFlags & 2097152 /* Alias */) {
- if (node.kind === 257 /* ExportSpecifier */ || (node.kind === 248 /* ImportEqualsDeclaration */ && hasExportModifier)) {
+ if (node.kind === 258 /* ExportSpecifier */ || (node.kind === 249 /* ImportEqualsDeclaration */ && hasExportModifier)) {
return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
}
else {
@@ -27864,7 +28063,7 @@
// for it. We must clear this so we don't accidentally move any stale data forward from
// a previous compilation.
if (containerFlags & 1 /* IsContainer */) {
- if (node.kind !== 197 /* ArrowFunction */) {
+ if (node.kind !== 198 /* ArrowFunction */) {
thisParentContainer = container;
}
container = blockScopeContainer = node;
@@ -27897,7 +28096,7 @@
}
// We create a return control flow graph for IIFEs and constructors. For constructors
// we use the return control flow graph in strict property initialization checks.
- currentReturnTarget = isIIFE || node.kind === 157 /* Constructor */ ? createBranchLabel() : undefined;
+ currentReturnTarget = isIIFE || node.kind === 158 /* Constructor */ ? createBranchLabel() : undefined;
currentBreakTarget = undefined;
currentContinueTarget = undefined;
activeLabels = undefined;
@@ -27911,13 +28110,13 @@
if (hasExplicitReturn)
node.flags |= 256 /* HasExplicitReturn */;
}
- if (node.kind === 284 /* SourceFile */) {
+ if (node.kind === 285 /* SourceFile */) {
node.flags |= emitFlags;
}
if (currentReturnTarget) {
addAntecedent(currentReturnTarget, currentFlow);
currentFlow = finishFlowLabel(currentReturnTarget);
- if (node.kind === 157 /* Constructor */) {
+ if (node.kind === 158 /* Constructor */) {
node.returnFlowNode = currentFlow;
}
}
@@ -27961,8 +28160,8 @@
}
}
function bindEachFunctionsFirst(nodes) {
- bindEach(nodes, function (n) { return n.kind === 239 /* FunctionDeclaration */ ? bind(n) : undefined; });
- bindEach(nodes, function (n) { return n.kind !== 239 /* FunctionDeclaration */ ? bind(n) : undefined; });
+ bindEach(nodes, function (n) { return n.kind === 240 /* FunctionDeclaration */ ? bind(n) : undefined; });
+ bindEach(nodes, function (n) { return n.kind !== 240 /* FunctionDeclaration */ ? bind(n) : undefined; });
}
function bindEach(nodes, bindFunction) {
if (bindFunction === void 0) { bindFunction = bind; }
@@ -27995,78 +28194,78 @@
return;
}
switch (node.kind) {
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
bindWhileStatement(node);
break;
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
bindDoStatement(node);
break;
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
bindForStatement(node);
break;
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
bindForInOrForOfStatement(node);
break;
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
bindIfStatement(node);
break;
- case 230 /* ReturnStatement */:
- case 234 /* ThrowStatement */:
+ case 231 /* ReturnStatement */:
+ case 235 /* ThrowStatement */:
bindReturnOrThrow(node);
break;
- case 229 /* BreakStatement */:
- case 228 /* ContinueStatement */:
+ case 230 /* BreakStatement */:
+ case 229 /* ContinueStatement */:
bindBreakOrContinueStatement(node);
break;
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
bindTryStatement(node);
break;
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
bindSwitchStatement(node);
break;
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
bindCaseBlock(node);
break;
- case 271 /* CaseClause */:
+ case 272 /* CaseClause */:
bindCaseClause(node);
break;
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
bindLabeledStatement(node);
break;
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
bindPrefixUnaryExpressionFlow(node);
break;
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
bindPostfixUnaryExpressionFlow(node);
break;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
bindBinaryExpressionFlow(node);
break;
- case 198 /* DeleteExpression */:
+ case 199 /* DeleteExpression */:
bindDeleteExpressionFlow(node);
break;
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
bindConditionalExpressionFlow(node);
break;
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
bindVariableDeclarationFlow(node);
break;
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
bindCallExpressionFlow(node);
break;
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
bindJSDocTypeAlias(node);
break;
// In source files and blocks, bind functions first to match hoisting that occurs at runtime
- case 284 /* SourceFile */: {
+ case 285 /* SourceFile */: {
bindEachFunctionsFirst(node.statements);
bind(node.endOfFileToken);
break;
}
- case 218 /* Block */:
- case 245 /* ModuleBlock */:
+ case 219 /* Block */:
+ case 246 /* ModuleBlock */:
bindEachFunctionsFirst(node.statements);
break;
default:
@@ -28077,26 +28276,26 @@
}
function isNarrowingExpression(expr) {
switch (expr.kind) {
- case 72 /* Identifier */:
- case 100 /* ThisKeyword */:
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 73 /* Identifier */:
+ case 101 /* ThisKeyword */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return isNarrowableReference(expr);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return hasNarrowableArgument(expr);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return isNarrowingExpression(expr.expression);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return isNarrowingBinaryExpression(expr);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return expr.operator === 52 /* ExclamationToken */ && isNarrowingExpression(expr.operand);
- case 199 /* TypeOfExpression */:
+ case 200 /* TypeOfExpression */:
return isNarrowingExpression(expr.expression);
}
return false;
}
function isNarrowableReference(expr) {
- return expr.kind === 72 /* Identifier */ || expr.kind === 100 /* ThisKeyword */ || expr.kind === 98 /* SuperKeyword */ ||
+ return expr.kind === 73 /* Identifier */ || expr.kind === 101 /* ThisKeyword */ || expr.kind === 99 /* SuperKeyword */ ||
(ts.isPropertyAccessExpression(expr) || ts.isNonNullExpression(expr) || ts.isParenthesizedExpression(expr)) && isNarrowableReference(expr.expression) ||
ts.isElementAccessExpression(expr) && expr.argumentExpression &&
(ts.isStringLiteral(expr.argumentExpression) || ts.isNumericLiteral(expr.argumentExpression)) &&
@@ -28111,7 +28310,7 @@
}
}
}
- if (expr.expression.kind === 189 /* PropertyAccessExpression */ &&
+ if (expr.expression.kind === 190 /* PropertyAccessExpression */ &&
isNarrowableReference(expr.expression.expression)) {
return true;
}
@@ -28125,7 +28324,7 @@
}
function isNarrowingBinaryExpression(expr) {
switch (expr.operatorToken.kind) {
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
return isNarrowableReference(expr.left);
case 33 /* EqualsEqualsToken */:
case 34 /* ExclamationEqualsToken */:
@@ -28133,9 +28332,9 @@
case 36 /* ExclamationEqualsEqualsToken */:
return isNarrowableOperand(expr.left) || isNarrowableOperand(expr.right) ||
isNarrowingTypeofOperands(expr.right, expr.left) || isNarrowingTypeofOperands(expr.left, expr.right);
- case 94 /* InstanceOfKeyword */:
+ case 95 /* InstanceOfKeyword */:
return isNarrowableOperand(expr.left);
- case 93 /* InKeyword */:
+ case 94 /* InKeyword */:
return isNarrowableInOperands(expr.left, expr.right);
case 27 /* CommaToken */:
return isNarrowingExpression(expr.right);
@@ -28144,11 +28343,11 @@
}
function isNarrowableOperand(expr) {
switch (expr.kind) {
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return isNarrowableOperand(expr.expression);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
switch (expr.operatorToken.kind) {
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
return isNarrowableOperand(expr.left);
case 27 /* CommaToken */:
return isNarrowableOperand(expr.right);
@@ -28185,8 +28384,8 @@
if (!expression) {
return flags & 32 /* TrueCondition */ ? antecedent : unreachableFlow;
}
- if (expression.kind === 102 /* TrueKeyword */ && flags & 64 /* FalseCondition */ ||
- expression.kind === 87 /* FalseKeyword */ && flags & 32 /* TrueCondition */) {
+ if (expression.kind === 103 /* TrueKeyword */ && flags & 64 /* FalseCondition */ ||
+ expression.kind === 88 /* FalseKeyword */ && flags & 32 /* TrueCondition */) {
return unreachableFlow;
}
if (!isNarrowingExpression(expression)) {
@@ -28224,33 +28423,33 @@
function isStatementCondition(node) {
var parent = node.parent;
switch (parent.kind) {
- case 222 /* IfStatement */:
- case 224 /* WhileStatement */:
- case 223 /* DoStatement */:
+ case 223 /* IfStatement */:
+ case 225 /* WhileStatement */:
+ case 224 /* DoStatement */:
return parent.expression === node;
- case 225 /* ForStatement */:
- case 205 /* ConditionalExpression */:
+ case 226 /* ForStatement */:
+ case 206 /* ConditionalExpression */:
return parent.condition === node;
}
return false;
}
function isLogicalExpression(node) {
while (true) {
- if (node.kind === 195 /* ParenthesizedExpression */) {
+ if (node.kind === 196 /* ParenthesizedExpression */) {
node = node.expression;
}
- else if (node.kind === 202 /* PrefixUnaryExpression */ && node.operator === 52 /* ExclamationToken */) {
+ else if (node.kind === 203 /* PrefixUnaryExpression */ && node.operator === 52 /* ExclamationToken */) {
node = node.operand;
}
else {
- return node.kind === 204 /* BinaryExpression */ && (node.operatorToken.kind === 54 /* AmpersandAmpersandToken */ ||
+ return node.kind === 205 /* BinaryExpression */ && (node.operatorToken.kind === 54 /* AmpersandAmpersandToken */ ||
node.operatorToken.kind === 55 /* BarBarToken */);
}
}
}
function isTopLevelLogicalExpression(node) {
- while (node.parent.kind === 195 /* ParenthesizedExpression */ ||
- node.parent.kind === 202 /* PrefixUnaryExpression */ &&
+ while (node.parent.kind === 196 /* ParenthesizedExpression */ ||
+ node.parent.kind === 203 /* PrefixUnaryExpression */ &&
node.parent.operator === 52 /* ExclamationToken */) {
node = node.parent;
}
@@ -28292,7 +28491,7 @@
}
function bindDoStatement(node) {
var preDoLabel = createLoopLabel();
- var enclosingLabeledStatement = node.parent.kind === 233 /* LabeledStatement */
+ var enclosingLabeledStatement = node.parent.kind === 234 /* LabeledStatement */
? ts.lastOrUndefined(activeLabels)
: undefined;
// if do statement is wrapped in labeled statement then target labels for break/continue with or without
@@ -28326,13 +28525,13 @@
var postLoopLabel = createBranchLabel();
addAntecedent(preLoopLabel, currentFlow);
currentFlow = preLoopLabel;
- if (node.kind === 227 /* ForOfStatement */) {
+ if (node.kind === 228 /* ForOfStatement */) {
bind(node.awaitModifier);
}
bind(node.expression);
addAntecedent(postLoopLabel, currentFlow);
bind(node.initializer);
- if (node.initializer.kind !== 238 /* VariableDeclarationList */) {
+ if (node.initializer.kind !== 239 /* VariableDeclarationList */) {
bindAssignmentTargetFlow(node.initializer);
}
bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel);
@@ -28354,7 +28553,7 @@
}
function bindReturnOrThrow(node) {
bind(node.expression);
- if (node.kind === 230 /* ReturnStatement */) {
+ if (node.kind === 231 /* ReturnStatement */) {
hasExplicitReturn = true;
if (currentReturnTarget) {
addAntecedent(currentReturnTarget, currentFlow);
@@ -28374,7 +28573,7 @@
return undefined;
}
function bindBreakOrContinueFlow(node, breakTarget, continueTarget) {
- var flowLabel = node.kind === 229 /* BreakStatement */ ? breakTarget : continueTarget;
+ var flowLabel = node.kind === 230 /* BreakStatement */ ? breakTarget : continueTarget;
if (flowLabel) {
addAntecedent(flowLabel, currentFlow);
currentFlow = unreachableFlow;
@@ -28502,7 +28701,7 @@
preSwitchCaseFlow = currentFlow;
bind(node.caseBlock);
addAntecedent(postSwitchLabel, currentFlow);
- var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 272 /* DefaultClause */; });
+ var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 273 /* DefaultClause */; });
// We mark a switch statement as possibly exhaustive if it has no default clause and if all
// case clauses have unreachable end points (e.g. they all return).
node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents;
@@ -28569,14 +28768,14 @@
if (!activeLabel.referenced && !options.allowUnusedLabels) {
errorOrSuggestionOnNode(ts.unusedLabelIsError(options), node.label, ts.Diagnostics.Unused_label);
}
- if (!node.statement || node.statement.kind !== 223 /* DoStatement */) {
+ if (!node.statement || node.statement.kind !== 224 /* DoStatement */) {
// do statement sets current flow inside bindDoStatement
addAntecedent(postStatementLabel, currentFlow);
currentFlow = finishFlowLabel(postStatementLabel);
}
}
function bindDestructuringTargetFlow(node) {
- if (node.kind === 204 /* BinaryExpression */ && node.operatorToken.kind === 59 /* EqualsToken */) {
+ if (node.kind === 205 /* BinaryExpression */ && node.operatorToken.kind === 60 /* EqualsToken */) {
bindAssignmentTargetFlow(node.left);
}
else {
@@ -28587,10 +28786,10 @@
if (isNarrowableReference(node)) {
currentFlow = createFlowAssignment(currentFlow, node);
}
- else if (node.kind === 187 /* ArrayLiteralExpression */) {
+ else if (node.kind === 188 /* ArrayLiteralExpression */) {
for (var _i = 0, _a = node.elements; _i < _a.length; _i++) {
var e = _a[_i];
- if (e.kind === 208 /* SpreadElement */) {
+ if (e.kind === 209 /* SpreadElement */) {
bindAssignmentTargetFlow(e.expression);
}
else {
@@ -28598,16 +28797,16 @@
}
}
}
- else if (node.kind === 188 /* ObjectLiteralExpression */) {
+ else if (node.kind === 189 /* ObjectLiteralExpression */) {
for (var _b = 0, _c = node.properties; _b < _c.length; _b++) {
var p = _c[_b];
- if (p.kind === 275 /* PropertyAssignment */) {
+ if (p.kind === 276 /* PropertyAssignment */) {
bindDestructuringTargetFlow(p.initializer);
}
- else if (p.kind === 276 /* ShorthandPropertyAssignment */) {
+ else if (p.kind === 277 /* ShorthandPropertyAssignment */) {
bindAssignmentTargetFlow(p.name);
}
- else if (p.kind === 277 /* SpreadAssignment */) {
+ else if (p.kind === 278 /* SpreadAssignment */) {
bindAssignmentTargetFlow(p.expression);
}
}
@@ -28663,7 +28862,7 @@
bindEachChild(node);
if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) {
bindAssignmentTargetFlow(node.left);
- if (operator === 59 /* EqualsToken */ && node.left.kind === 190 /* ElementAccessExpression */) {
+ if (operator === 60 /* EqualsToken */ && node.left.kind === 191 /* ElementAccessExpression */) {
var elementAccess = node.left;
if (isNarrowableOperand(elementAccess.expression)) {
currentFlow = createFlowArrayMutation(currentFlow, node);
@@ -28674,7 +28873,7 @@
}
function bindDeleteExpressionFlow(node) {
bindEachChild(node);
- if (node.expression.kind === 189 /* PropertyAccessExpression */) {
+ if (node.expression.kind === 190 /* PropertyAccessExpression */) {
bindAssignmentTargetFlow(node.expression);
}
}
@@ -28722,10 +28921,10 @@
// an immediately invoked function expression (IIFE). Initialize the flowNode property to
// the current control flow (which includes evaluation of the IIFE arguments).
var expr = node.expression;
- while (expr.kind === 195 /* ParenthesizedExpression */) {
+ while (expr.kind === 196 /* ParenthesizedExpression */) {
expr = expr.expression;
}
- if (expr.kind === 196 /* FunctionExpression */ || expr.kind === 197 /* ArrowFunction */) {
+ if (expr.kind === 197 /* FunctionExpression */ || expr.kind === 198 /* ArrowFunction */) {
bindEach(node.typeArguments);
bindEach(node.arguments);
bind(node.expression);
@@ -28733,7 +28932,7 @@
else {
bindEachChild(node);
}
- if (node.expression.kind === 189 /* PropertyAccessExpression */) {
+ if (node.expression.kind === 190 /* PropertyAccessExpression */) {
var propertyAccess = node.expression;
if (isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) {
currentFlow = createFlowArrayMutation(currentFlow, node);
@@ -28742,54 +28941,54 @@
}
function getContainerFlags(node) {
switch (node.kind) {
- case 209 /* ClassExpression */:
- case 240 /* ClassDeclaration */:
- case 243 /* EnumDeclaration */:
- case 188 /* ObjectLiteralExpression */:
- case 168 /* TypeLiteral */:
- case 297 /* JSDocTypeLiteral */:
- case 268 /* JsxAttributes */:
+ case 210 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 189 /* ObjectLiteralExpression */:
+ case 169 /* TypeLiteral */:
+ case 298 /* JSDocTypeLiteral */:
+ case 269 /* JsxAttributes */:
return 1 /* IsContainer */;
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
return 1 /* IsContainer */ | 64 /* IsInterface */;
- case 244 /* ModuleDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 181 /* MappedType */:
+ case 245 /* ModuleDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 182 /* MappedType */:
return 1 /* IsContainer */ | 32 /* HasLocals */;
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */;
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
if (ts.isObjectLiteralOrClassExpressionMethod(node)) {
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 128 /* IsObjectLiteralOrClassExpressionMethod */;
}
// falls through
- case 157 /* Constructor */:
- case 239 /* FunctionDeclaration */:
- case 155 /* MethodSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 160 /* CallSignature */:
- case 298 /* JSDocSignature */:
- case 294 /* JSDocFunctionType */:
- case 165 /* FunctionType */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
- case 166 /* ConstructorType */:
+ case 158 /* Constructor */:
+ case 240 /* FunctionDeclaration */:
+ case 156 /* MethodSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 161 /* CallSignature */:
+ case 299 /* JSDocSignature */:
+ case 295 /* JSDocFunctionType */:
+ case 166 /* FunctionType */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
+ case 167 /* ConstructorType */:
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */;
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 16 /* IsFunctionExpression */;
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
return 4 /* IsControlFlowContainer */;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return node.initializer ? 4 /* IsControlFlowContainer */ : 0;
- case 274 /* CatchClause */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 246 /* CaseBlock */:
+ case 275 /* CatchClause */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 247 /* CaseBlock */:
return 2 /* IsBlockScopedContainer */;
- case 218 /* Block */:
+ case 219 /* Block */:
// do not treat blocks directly inside a function as a block-scoped-container.
// Locals that reside in this block should go to the function locals. Otherwise 'x'
// would not appear to be a redeclaration of a block scoped local in the following
@@ -28822,45 +29021,45 @@
// members are declared (for example, a member of a class will go into a specific
// symbol table depending on if it is static or not). We defer to specialized
// handlers to take care of declaring these child members.
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return declareModuleMember(node, symbolFlags, symbolExcludes);
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return declareSourceFileMember(node, symbolFlags, symbolExcludes);
- case 209 /* ClassExpression */:
- case 240 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
return declareClassMember(node, symbolFlags, symbolExcludes);
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
- case 168 /* TypeLiteral */:
- case 297 /* JSDocTypeLiteral */:
- case 188 /* ObjectLiteralExpression */:
- case 241 /* InterfaceDeclaration */:
- case 268 /* JsxAttributes */:
+ case 169 /* TypeLiteral */:
+ case 298 /* JSDocTypeLiteral */:
+ case 189 /* ObjectLiteralExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 269 /* JsxAttributes */:
// Interface/Object-types always have their children added to the 'members' of
// their container. They are only accessible through an instance of their
// container, and are never in scope otherwise (even inside the body of the
// object / type / interface declaring them). An exception is type parameters,
// which are in scope without qualification (similar to 'locals').
return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes);
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 298 /* JSDocSignature */:
- case 162 /* IndexSignature */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 294 /* JSDocFunctionType */:
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
- case 242 /* TypeAliasDeclaration */:
- case 181 /* MappedType */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 299 /* JSDocSignature */:
+ case 163 /* IndexSignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 295 /* JSDocFunctionType */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
+ case 243 /* TypeAliasDeclaration */:
+ case 182 /* MappedType */:
// All the children of these container types are never visible through another
// symbol (i.e. through another symbol's 'exports' or 'members'). Instead,
// they're only accessed 'lexically' (i.e. from code that exists underneath
@@ -28881,16 +29080,8 @@
: declareSymbol(file.locals, /*parent*/ undefined, node, symbolFlags, symbolExcludes);
}
function hasExportDeclarations(node) {
- var body = node.kind === 284 /* SourceFile */ ? node : node.body;
- if (body && (body.kind === 284 /* SourceFile */ || body.kind === 245 /* ModuleBlock */)) {
- for (var _i = 0, _a = body.statements; _i < _a.length; _i++) {
- var stat = _a[_i];
- if (stat.kind === 255 /* ExportDeclaration */ || stat.kind === 254 /* ExportAssignment */) {
- return true;
- }
- }
- }
- return false;
+ var body = ts.isSourceFile(node) ? node : ts.tryCast(node.body, ts.isModuleBlock);
+ return !!body && body.statements.some(function (s) { return ts.isExportDeclaration(s) || ts.isExportAssignment(s); });
}
function setExportContextFlag(node) {
// A declaration source file or ambient module declaration that contains no export declarations (but possibly regular
@@ -28969,7 +29160,7 @@
var seen = ts.createUnderscoreEscapedMap();
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var prop = _a[_i];
- if (prop.kind === 277 /* SpreadAssignment */ || prop.name.kind !== 72 /* Identifier */) {
+ if (prop.kind === 278 /* SpreadAssignment */ || prop.name.kind !== 73 /* Identifier */) {
continue;
}
var identifier = prop.name;
@@ -28981,7 +29172,7 @@
// c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true.
// d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true
// and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields
- var currentKind = prop.kind === 275 /* PropertyAssignment */ || prop.kind === 276 /* ShorthandPropertyAssignment */ || prop.kind === 156 /* MethodDeclaration */
+ var currentKind = prop.kind === 276 /* PropertyAssignment */ || prop.kind === 277 /* ShorthandPropertyAssignment */ || prop.kind === 157 /* MethodDeclaration */
? 1 /* Property */
: 2 /* Accessor */;
var existingKind = seen.get(identifier.escapedText);
@@ -29013,10 +29204,10 @@
}
function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) {
switch (blockScopeContainer.kind) {
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
declareModuleMember(node, symbolFlags, symbolExcludes);
break;
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
if (ts.isExternalOrCommonJsModule(container)) {
declareModuleMember(node, symbolFlags, symbolExcludes);
break;
@@ -29047,7 +29238,7 @@
currentFlow = { flags: 2 /* Start */ };
parent = typeAlias;
bind(typeAlias.typeExpression);
- if (!typeAlias.fullName || typeAlias.fullName.kind === 72 /* Identifier */) {
+ if (!typeAlias.fullName || typeAlias.fullName.kind === 73 /* Identifier */) {
parent = typeAlias.parent;
bindBlockScopedDeclaration(typeAlias, 524288 /* TypeAlias */, 67897832 /* TypeAliasExcludes */);
}
@@ -29065,8 +29256,8 @@
// check for reserved words used as identifiers in strict mode code.
function checkStrictModeIdentifier(node) {
if (inStrictMode &&
- node.originalKeywordKind >= 109 /* FirstFutureReservedWord */ &&
- node.originalKeywordKind <= 117 /* LastFutureReservedWord */ &&
+ node.originalKeywordKind >= 110 /* FirstFutureReservedWord */ &&
+ node.originalKeywordKind <= 118 /* LastFutureReservedWord */ &&
!ts.isIdentifierName(node) &&
!(node.flags & 4194304 /* Ambient */)) {
// Report error only if there are no parse errors in file
@@ -29102,7 +29293,7 @@
}
function checkStrictModeDeleteExpression(node) {
// Grammar checking
- if (inStrictMode && node.expression.kind === 72 /* Identifier */) {
+ if (inStrictMode && node.expression.kind === 73 /* Identifier */) {
// When a delete operator occurs within strict mode code, a SyntaxError is thrown if its
// UnaryExpression is a direct reference to a variable, function argument, or function name
var span = ts.getErrorSpanForNode(file, node.expression);
@@ -29113,7 +29304,7 @@
return ts.isIdentifier(node) && (node.escapedText === "eval" || node.escapedText === "arguments");
}
function checkStrictModeEvalOrArguments(contextNode, name) {
- if (name && name.kind === 72 /* Identifier */) {
+ if (name && name.kind === 73 /* Identifier */) {
var identifier = name;
if (isEvalOrArgumentsIdentifier(identifier)) {
// We check first if the name is inside class declaration or class expression; if so give explicit message
@@ -29154,8 +29345,8 @@
function checkStrictModeFunctionDeclaration(node) {
if (languageVersion < 2 /* ES2015 */) {
// Report error if function is not top level function declaration
- if (blockScopeContainer.kind !== 284 /* SourceFile */ &&
- blockScopeContainer.kind !== 244 /* ModuleDeclaration */ &&
+ if (blockScopeContainer.kind !== 285 /* SourceFile */ &&
+ blockScopeContainer.kind !== 245 /* ModuleDeclaration */ &&
!ts.isFunctionLike(blockScopeContainer)) {
// We check first if the name is inside class declaration or class expression; if so give explicit message
// otherwise report generic error message.
@@ -29250,7 +29441,7 @@
// the current 'container' node when it changes. This helps us know which symbol table
// a local should go into for example. Since terminal nodes are known not to have
// children, as an optimization we don't process those.
- if (node.kind > 147 /* LastToken */) {
+ if (node.kind > 148 /* LastToken */) {
var saveParent = parent;
parent = node;
var containerFlags = getContainerFlags(node);
@@ -29312,7 +29503,7 @@
function bindWorker(node) {
switch (node.kind) {
/* Strict mode checks */
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
// for typedef type names with namespaces, bind the new jsdoc type symbol here
// because it requires all containing namespaces to be in effect, namely the
// current "blockScopeContainer" needs to be set to its immediate namespace parent.
@@ -29325,13 +29516,13 @@
break;
}
// falls through
- case 100 /* ThisKeyword */:
- if (currentFlow && (ts.isExpression(node) || parent.kind === 276 /* ShorthandPropertyAssignment */)) {
+ case 101 /* ThisKeyword */:
+ if (currentFlow && (ts.isExpression(node) || parent.kind === 277 /* ShorthandPropertyAssignment */)) {
node.flowNode = currentFlow;
}
return checkStrictModeIdentifier(node);
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
if (currentFlow && isNarrowableReference(node)) {
node.flowNode = currentFlow;
}
@@ -29345,7 +29536,7 @@
declareSymbol(file.locals, /*parent*/ undefined, node.expression, 1 /* FunctionScopedVariable */ | 134217728 /* ModuleExports */, 67220414 /* FunctionScopedVariableExcludes */);
}
break;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
var specialKind = ts.getAssignmentDeclarationKind(node);
switch (specialKind) {
case 1 /* ExportsProperty */:
@@ -29373,76 +29564,76 @@
ts.Debug.fail("Unknown binary expression special property assignment kind");
}
return checkStrictModeBinaryExpression(node);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return checkStrictModeCatchClause(node);
- case 198 /* DeleteExpression */:
+ case 199 /* DeleteExpression */:
return checkStrictModeDeleteExpression(node);
case 8 /* NumericLiteral */:
return checkStrictModeNumericLiteral(node);
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return checkStrictModePostfixUnaryExpression(node);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return checkStrictModePrefixUnaryExpression(node);
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
return checkStrictModeWithStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return checkStrictModeLabeledStatement(node);
- case 178 /* ThisType */:
+ case 179 /* ThisType */:
seenThisKeyword = true;
return;
- case 163 /* TypePredicate */:
+ case 164 /* TypePredicate */:
break; // Binding the children will handle everything
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
return bindTypeParameter(node);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return bindParameter(node);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return bindVariableDeclarationOrBindingElement(node);
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
node.flowNode = currentFlow;
return bindVariableDeclarationOrBindingElement(node);
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
return bindPropertyWorker(node);
- case 275 /* PropertyAssignment */:
- case 276 /* ShorthandPropertyAssignment */:
+ case 276 /* PropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 0 /* PropertyExcludes */);
- case 278 /* EnumMember */:
+ case 279 /* EnumMember */:
return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 68008959 /* EnumMemberExcludes */);
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
return declareSymbolAndAddToSymbolTable(node, 131072 /* Signature */, 0 /* None */);
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
// If this is an ObjectLiteralExpression method, then it sits in the same space
// as other properties in the object literal. So we use SymbolFlags.PropertyExcludes
// so that it will conflict with any other object literal members with the same
// name.
return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 16777216 /* Optional */ : 0 /* None */), ts.isObjectLiteralMethod(node) ? 0 /* PropertyExcludes */ : 67212223 /* MethodExcludes */);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return bindFunctionDeclaration(node);
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */);
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 67154879 /* GetAccessorExcludes */);
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 67187647 /* SetAccessorExcludes */);
- case 165 /* FunctionType */:
- case 294 /* JSDocFunctionType */:
- case 298 /* JSDocSignature */:
- case 166 /* ConstructorType */:
+ case 166 /* FunctionType */:
+ case 295 /* JSDocFunctionType */:
+ case 299 /* JSDocSignature */:
+ case 167 /* ConstructorType */:
return bindFunctionOrConstructorType(node);
- case 168 /* TypeLiteral */:
- case 297 /* JSDocTypeLiteral */:
- case 181 /* MappedType */:
+ case 169 /* TypeLiteral */:
+ case 298 /* JSDocTypeLiteral */:
+ case 182 /* MappedType */:
return bindAnonymousTypeWorker(node);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return bindObjectLiteralExpression(node);
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return bindFunctionExpression(node);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
var assignmentKind = ts.getAssignmentDeclarationKind(node);
switch (assignmentKind) {
case 7 /* ObjectDefinePropertyValue */:
@@ -29461,64 +29652,64 @@
}
break;
// Members of classes, interfaces, and modules
- case 209 /* ClassExpression */:
- case 240 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
// All classes are automatically in strict mode in ES6.
inStrictMode = true;
return bindClassLikeDeclaration(node);
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
return bindBlockScopedDeclaration(node, 64 /* Interface */, 67897736 /* InterfaceExcludes */);
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 67897832 /* TypeAliasExcludes */);
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return bindEnumDeclaration(node);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return bindModuleDeclaration(node);
// Jsx-attributes
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
return bindJsxAttributes(node);
- case 267 /* JsxAttribute */:
+ case 268 /* JsxAttribute */:
return bindJsxAttribute(node, 4 /* Property */, 0 /* PropertyExcludes */);
// Imports and exports
- case 248 /* ImportEqualsDeclaration */:
- case 251 /* NamespaceImport */:
- case 253 /* ImportSpecifier */:
- case 257 /* ExportSpecifier */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 252 /* NamespaceImport */:
+ case 254 /* ImportSpecifier */:
+ case 258 /* ExportSpecifier */:
return declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */);
- case 247 /* NamespaceExportDeclaration */:
+ case 248 /* NamespaceExportDeclaration */:
return bindNamespaceExportDeclaration(node);
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
return bindImportClause(node);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return bindExportDeclaration(node);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return bindExportAssignment(node);
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
updateStrictModeStatementList(node.statements);
return bindSourceFileIfExternalModule();
- case 218 /* Block */:
+ case 219 /* Block */:
if (!ts.isFunctionLike(node.parent)) {
return;
}
// falls through
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
return updateStrictModeStatementList(node.statements);
- case 304 /* JSDocParameterTag */:
- if (node.parent.kind === 298 /* JSDocSignature */) {
+ case 305 /* JSDocParameterTag */:
+ if (node.parent.kind === 299 /* JSDocSignature */) {
return bindParameter(node);
}
- if (node.parent.kind !== 297 /* JSDocTypeLiteral */) {
+ if (node.parent.kind !== 298 /* JSDocTypeLiteral */) {
break;
}
// falls through
- case 310 /* JSDocPropertyTag */:
+ case 311 /* JSDocPropertyTag */:
var propTag = node;
- var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 293 /* JSDocOptionalType */ ?
+ var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 294 /* JSDocOptionalType */ ?
4 /* Property */ | 16777216 /* Optional */ :
4 /* Property */;
return declareSymbolAndAddToSymbolTable(propTag, flags, 0 /* PropertyExcludes */);
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
return (delayedTypeAliases || (delayedTypeAliases = [])).push(node);
}
}
@@ -29662,11 +29853,11 @@
ts.Debug.assert(ts.isInJSFile(node));
var thisContainer = ts.getThisContainer(node, /*includeArrowFunctions*/ false);
switch (thisContainer.kind) {
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
var constructorSymbol = thisContainer.symbol;
// For `f.prototype.m = function() { this.x = 0; }`, `this.x = 0` should modify `f`'s members, not the function expression.
- if (ts.isBinaryExpression(thisContainer.parent) && thisContainer.parent.operatorToken.kind === 59 /* EqualsToken */) {
+ if (ts.isBinaryExpression(thisContainer.parent) && thisContainer.parent.operatorToken.kind === 60 /* EqualsToken */) {
var l = thisContainer.parent.left;
if (ts.isPropertyAccessEntityNameExpression(l) && ts.isPrototypeAccess(l.expression)) {
constructorSymbol = lookupSymbolForPropertyAccess(l.expression.expression, thisParentContainer);
@@ -29679,18 +29870,18 @@
declareSymbol(constructorSymbol.members, constructorSymbol, node, 4 /* Property */, 0 /* PropertyExcludes */ & ~4 /* Property */);
}
break;
- case 157 /* Constructor */:
- case 154 /* PropertyDeclaration */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 158 /* Constructor */:
+ case 155 /* PropertyDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
// this.foo assignment in a JavaScript class
// Bind this property to the containing class
var containingClass = thisContainer.parent;
var symbolTable = ts.hasModifier(thisContainer, 32 /* Static */) ? containingClass.symbol.exports : containingClass.symbol.members;
declareSymbol(symbolTable, containingClass.symbol, node, 4 /* Property */, 0 /* None */, /*isReplaceableByMethod*/ true);
break;
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
// this.property = assignment in a source file -- declare symbol in exports for a module, in locals for a script
if (thisContainer.commonJsModuleIndicator) {
declareSymbol(thisContainer.symbol.exports, thisContainer.symbol, node, 4 /* Property */ | 1048576 /* ExportValue */, 0 /* None */);
@@ -29700,14 +29891,14 @@
}
break;
default:
- ts.Debug.fail(ts.Debug.showSyntaxKind(thisContainer));
+ ts.Debug.failBadSyntaxKind(thisContainer);
}
}
function bindSpecialPropertyDeclaration(node) {
- if (node.expression.kind === 100 /* ThisKeyword */) {
+ if (node.expression.kind === 101 /* ThisKeyword */) {
bindThisPropertyAssignment(node);
}
- else if (ts.isPropertyAccessEntityNameExpression(node) && node.parent.parent.kind === 284 /* SourceFile */) {
+ else if (ts.isPropertyAccessEntityNameExpression(node) && node.parent.parent.kind === 285 /* SourceFile */) {
if (ts.isPrototypeAccess(node.expression)) {
bindPrototypePropertyAssignment(node, node.parent);
}
@@ -29744,7 +29935,7 @@
}
function bindObjectDefinePropertyAssignment(node) {
var namespaceSymbol = lookupSymbolForPropertyAccess(node.arguments[0]);
- var isToplevel = node.parent.parent.kind === 284 /* SourceFile */;
+ var isToplevel = node.parent.parent.kind === 285 /* SourceFile */;
namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, node.arguments[0], isToplevel, /*isPrototypeProperty*/ false);
bindPotentiallyNewExpandoMemberToNamespace(node, namespaceSymbol, /*isPrototypeProperty*/ false);
}
@@ -29758,7 +29949,7 @@
// Fix up parent pointers since we're going to use these nodes before we bind into them
node.left.parent = node;
node.right.parent = node;
- if (ts.isIdentifier(lhs.expression) && container === file && isNameOfExportsOrModuleExportsAliasDeclaration(file, lhs.expression)) {
+ if (ts.isIdentifier(lhs.expression) && container === file && isExportsOrModuleExportsOrAlias(file, lhs.expression)) {
// This can be an alias for the 'exports' or 'module.exports' names, e.g.
// var util = module.exports;
// util.property = function ...
@@ -29811,8 +30002,8 @@
function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty) {
var namespaceSymbol = lookupSymbolForPropertyAccess(name);
var isToplevel = ts.isBinaryExpression(propertyAccess.parent)
- ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 284 /* SourceFile */
- : propertyAccess.parent.parent.kind === 284 /* SourceFile */;
+ ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 285 /* SourceFile */
+ : propertyAccess.parent.parent.kind === 285 /* SourceFile */;
namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, propertyAccess.expression, isToplevel, isPrototypeProperty);
bindPotentiallyNewExpandoMemberToNamespace(propertyAccess, namespaceSymbol, isPrototypeProperty);
}
@@ -29871,9 +30062,7 @@
}
else {
var s = forEachIdentifierInEntityName(e.expression, parent, action);
- if (!s || !s.exports)
- return ts.Debug.fail();
- return action(e.name, s.exports.get(e.name.escapedText), s);
+ return action(e.name, s && s.exports && s.exports.get(e.name.escapedText), s);
}
}
function bindCallExpression(node) {
@@ -29884,7 +30073,7 @@
}
}
function bindClassLikeDeclaration(node) {
- if (node.kind === 240 /* ClassDeclaration */) {
+ if (node.kind === 241 /* ClassDeclaration */) {
bindBlockScopedDeclaration(node, 32 /* Class */, 68008383 /* ClassExcludes */);
}
else {
@@ -29950,7 +30139,7 @@
}
}
function bindParameter(node) {
- if (node.kind === 304 /* JSDocParameterTag */ && container.kind !== 298 /* JSDocSignature */) {
+ if (node.kind === 305 /* JSDocParameterTag */ && container.kind !== 299 /* JSDocSignature */) {
return;
}
if (inStrictMode && !(node.flags & 4194304 /* Ambient */)) {
@@ -30027,7 +30216,7 @@
declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 67635688 /* TypeParameterExcludes */);
}
}
- else if (node.parent.kind === 176 /* InferType */) {
+ else if (node.parent.kind === 177 /* InferType */) {
var container_2 = getInferTypeContainer(node.parent);
if (container_2) {
if (!container_2.locals) {
@@ -30055,11 +30244,11 @@
if (currentFlow === unreachableFlow) {
var reportError =
// report error on all statements except empty ones
- (ts.isStatementButNotDeclaration(node) && node.kind !== 220 /* EmptyStatement */) ||
+ (ts.isStatementButNotDeclaration(node) && node.kind !== 221 /* EmptyStatement */) ||
// report error on class declarations
- node.kind === 240 /* ClassDeclaration */ ||
+ node.kind === 241 /* ClassDeclaration */ ||
// report error on instantiated modules or const-enums only modules if preserveConstEnums is set
- (node.kind === 244 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node));
+ (node.kind === 245 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node));
if (reportError) {
currentFlow = reportedUnreachableFlow;
if (!options.allowUnreachableCode) {
@@ -30103,32 +30292,41 @@
}
function isPurelyTypeDeclaration(s) {
switch (s.kind) {
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return true;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return getModuleInstanceState(s) !== 1 /* Instantiated */;
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return ts.hasModifier(s, 2048 /* Const */);
default:
return false;
}
}
function isExportsOrModuleExportsOrAlias(sourceFile, node) {
- return ts.isExportsIdentifier(node) ||
- ts.isModuleExportsPropertyAccessExpression(node) ||
- ts.isIdentifier(node) && isNameOfExportsOrModuleExportsAliasDeclaration(sourceFile, node);
+ var i = 0;
+ var q = [node];
+ while (q.length && i < 100) {
+ i++;
+ node = q.shift();
+ if (ts.isExportsIdentifier(node) || ts.isModuleExportsPropertyAccessExpression(node)) {
+ return true;
}
- ts.isExportsOrModuleExportsOrAlias = isExportsOrModuleExportsOrAlias;
- function isNameOfExportsOrModuleExportsAliasDeclaration(sourceFile, node) {
+ else if (ts.isIdentifier(node)) {
var symbol = lookupSymbolForNameWorker(sourceFile, node.escapedText);
- return !!symbol && !!symbol.valueDeclaration && ts.isVariableDeclaration(symbol.valueDeclaration) &&
- !!symbol.valueDeclaration.initializer && isExportsOrModuleExportsOrAliasOrAssignment(sourceFile, symbol.valueDeclaration.initializer);
+ if (!!symbol && !!symbol.valueDeclaration && ts.isVariableDeclaration(symbol.valueDeclaration) && !!symbol.valueDeclaration.initializer) {
+ var init = symbol.valueDeclaration.initializer;
+ q.push(init);
+ if (ts.isAssignmentExpression(init, /*excludeCompoundAssignment*/ true)) {
+ q.push(init.left);
+ q.push(init.right);
+ }
}
- function isExportsOrModuleExportsOrAliasOrAssignment(sourceFile, node) {
- return isExportsOrModuleExportsOrAlias(sourceFile, node) ||
- (ts.isAssignmentExpression(node, /*excludeCompoundAssignment*/ true) && (isExportsOrModuleExportsOrAliasOrAssignment(sourceFile, node.left) || isExportsOrModuleExportsOrAliasOrAssignment(sourceFile, node.right)));
}
+ }
+ return false;
+ }
+ ts.isExportsOrModuleExportsOrAlias = isExportsOrModuleExportsOrAlias;
function lookupSymbolForNameWorker(container, name) {
var local = container.locals && container.locals.get(name);
if (local) {
@@ -30148,58 +30346,58 @@
function computeTransformFlagsForNode(node, subtreeFlags) {
var kind = node.kind;
switch (kind) {
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return computeCallExpression(node, subtreeFlags);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return computeNewExpression(node, subtreeFlags);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return computeModuleDeclaration(node, subtreeFlags);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return computeParenthesizedExpression(node, subtreeFlags);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return computeBinaryExpression(node, subtreeFlags);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return computeExpressionStatement(node, subtreeFlags);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return computeParameter(node, subtreeFlags);
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return computeArrowFunction(node, subtreeFlags);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return computeFunctionExpression(node, subtreeFlags);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return computeFunctionDeclaration(node, subtreeFlags);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return computeVariableDeclaration(node, subtreeFlags);
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
return computeVariableDeclarationList(node, subtreeFlags);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return computeVariableStatement(node, subtreeFlags);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return computeLabeledStatement(node, subtreeFlags);
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return computeClassDeclaration(node, subtreeFlags);
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
return computeClassExpression(node, subtreeFlags);
- case 273 /* HeritageClause */:
+ case 274 /* HeritageClause */:
return computeHeritageClause(node, subtreeFlags);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return computeCatchClause(node, subtreeFlags);
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return computeExpressionWithTypeArguments(node, subtreeFlags);
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return computeConstructor(node, subtreeFlags);
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return computePropertyDeclaration(node, subtreeFlags);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return computeMethod(node, subtreeFlags);
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return computeAccessor(node, subtreeFlags);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return computeImportEquals(node, subtreeFlags);
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return computePropertyAccess(node, subtreeFlags);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return computeElementAccess(node, subtreeFlags);
default:
return computeOther(node, kind, subtreeFlags);
@@ -30221,7 +30419,7 @@
transformFlags |= 2048 /* ContainsLexicalThis */;
}
}
- if (expression.kind === 92 /* ImportKeyword */) {
+ if (expression.kind === 93 /* ImportKeyword */) {
transformFlags |= 524288 /* ContainsDynamicImport */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
@@ -30244,17 +30442,17 @@
var transformFlags = subtreeFlags;
var operatorTokenKind = node.operatorToken.kind;
var leftKind = node.left.kind;
- if (operatorTokenKind === 59 /* EqualsToken */ && leftKind === 188 /* ObjectLiteralExpression */) {
+ if (operatorTokenKind === 60 /* EqualsToken */ && leftKind === 189 /* ObjectLiteralExpression */) {
// Destructuring object assignments with are ES2015 syntax
// and possibly ES2018 if they contain rest
transformFlags |= 16 /* AssertES2018 */ | 128 /* AssertES2015 */ | 512 /* AssertDestructuringAssignment */;
}
- else if (operatorTokenKind === 59 /* EqualsToken */ && leftKind === 187 /* ArrayLiteralExpression */) {
+ else if (operatorTokenKind === 60 /* EqualsToken */ && leftKind === 188 /* ArrayLiteralExpression */) {
// Destructuring assignments are ES2015 syntax.
transformFlags |= 128 /* AssertES2015 */ | 512 /* AssertDestructuringAssignment */;
}
else if (operatorTokenKind === 41 /* AsteriskAsteriskToken */
- || operatorTokenKind === 63 /* AsteriskAsteriskEqualsToken */) {
+ || operatorTokenKind === 64 /* AsteriskAsteriskEqualsToken */) {
// Exponentiation is ES2016 syntax.
transformFlags |= 64 /* AssertES2016 */;
}
@@ -30297,8 +30495,8 @@
// If the node is synthesized, it means the emitter put the parentheses there,
// not the user. If we didn't want them, the emitter would not have put them
// there.
- if (expressionKind === 212 /* AsExpression */
- || expressionKind === 194 /* TypeAssertionExpression */) {
+ if (expressionKind === 213 /* AsExpression */
+ || expressionKind === 195 /* TypeAssertionExpression */) {
transformFlags |= 1 /* AssertTypeScript */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
@@ -30340,11 +30538,11 @@
function computeHeritageClause(node, subtreeFlags) {
var transformFlags = subtreeFlags;
switch (node.token) {
- case 86 /* ExtendsKeyword */:
+ case 87 /* ExtendsKeyword */:
// An `extends` HeritageClause is ES6 syntax.
transformFlags |= 128 /* AssertES2015 */;
break;
- case 109 /* ImplementsKeyword */:
+ case 110 /* ImplementsKeyword */:
// An `implements` HeritageClause is TypeScript syntax.
transformFlags |= 1 /* AssertTypeScript */;
break;
@@ -30537,7 +30735,7 @@
var transformFlags = subtreeFlags;
// If a PropertyAccessExpression starts with a super keyword, then it is
// ES6 syntax, and requires a lexical `this` binding.
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
// super inside of an async function requires hoisting the super access (ES2017).
// same for super inside of an async generator, which is ES2018.
transformFlags |= 32 /* ContainsES2017 */ | 16 /* ContainsES2018 */;
@@ -30549,7 +30747,7 @@
var transformFlags = subtreeFlags;
// If an ElementAccessExpression starts with a super keyword, then it is
// ES6 syntax, and requires a lexical `this` binding.
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
// super inside of an async function requires hoisting the super access (ES2017).
// same for super inside of an async generator, which is ES2018.
transformFlags |= 32 /* ContainsES2017 */ | 16 /* ContainsES2018 */;
@@ -30637,43 +30835,43 @@
var transformFlags = subtreeFlags;
var excludeFlags = 536870912 /* NodeExcludes */;
switch (kind) {
- case 121 /* AsyncKeyword */:
- case 201 /* AwaitExpression */:
+ case 122 /* AsyncKeyword */:
+ case 202 /* AwaitExpression */:
// async/await is ES2017 syntax, but may be ES2018 syntax (for async generators)
transformFlags |= 16 /* AssertES2018 */ | 32 /* AssertES2017 */;
break;
- case 194 /* TypeAssertionExpression */:
- case 212 /* AsExpression */:
- case 313 /* PartiallyEmittedExpression */:
+ case 195 /* TypeAssertionExpression */:
+ case 213 /* AsExpression */:
+ case 314 /* PartiallyEmittedExpression */:
// These nodes are TypeScript syntax.
transformFlags |= 1 /* AssertTypeScript */;
excludeFlags = 536870912 /* OuterExpressionExcludes */;
break;
- case 115 /* PublicKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 118 /* AbstractKeyword */:
- case 125 /* DeclareKeyword */:
- case 77 /* ConstKeyword */:
- case 243 /* EnumDeclaration */:
- case 278 /* EnumMember */:
- case 213 /* NonNullExpression */:
- case 133 /* ReadonlyKeyword */:
+ case 116 /* PublicKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 119 /* AbstractKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 78 /* ConstKeyword */:
+ case 244 /* EnumDeclaration */:
+ case 279 /* EnumMember */:
+ case 214 /* NonNullExpression */:
+ case 134 /* ReadonlyKeyword */:
// These nodes are TypeScript syntax.
transformFlags |= 1 /* AssertTypeScript */;
break;
- case 260 /* JsxElement */:
- case 261 /* JsxSelfClosingElement */:
- case 262 /* JsxOpeningElement */:
+ case 261 /* JsxElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
case 11 /* JsxText */:
- case 263 /* JsxClosingElement */:
- case 264 /* JsxFragment */:
- case 265 /* JsxOpeningFragment */:
- case 266 /* JsxClosingFragment */:
- case 267 /* JsxAttribute */:
- case 268 /* JsxAttributes */:
- case 269 /* JsxSpreadAttribute */:
- case 270 /* JsxExpression */:
+ case 264 /* JsxClosingElement */:
+ case 265 /* JsxFragment */:
+ case 266 /* JsxOpeningFragment */:
+ case 267 /* JsxClosingFragment */:
+ case 268 /* JsxAttribute */:
+ case 269 /* JsxAttributes */:
+ case 270 /* JsxSpreadAttribute */:
+ case 271 /* JsxExpression */:
// These nodes are Jsx syntax.
transformFlags |= 2 /* AssertJsx */;
break;
@@ -30681,11 +30879,11 @@
case 15 /* TemplateHead */:
case 16 /* TemplateMiddle */:
case 17 /* TemplateTail */:
- case 206 /* TemplateExpression */:
- case 193 /* TaggedTemplateExpression */:
- case 276 /* ShorthandPropertyAssignment */:
- case 116 /* StaticKeyword */:
- case 214 /* MetaProperty */:
+ case 207 /* TemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
+ case 277 /* ShorthandPropertyAssignment */:
+ case 117 /* StaticKeyword */:
+ case 215 /* MetaProperty */:
// These nodes are ES6 syntax.
transformFlags |= 128 /* AssertES2015 */;
break;
@@ -30702,103 +30900,103 @@
case 9 /* BigIntLiteral */:
transformFlags |= 4 /* AssertESNext */;
break;
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
// This node is either ES2015 syntax or ES2017 syntax (if it is a for-await-of).
if (node.awaitModifier) {
transformFlags |= 16 /* AssertES2018 */;
}
transformFlags |= 128 /* AssertES2015 */;
break;
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
// This node is either ES2015 syntax (in a generator) or ES2017 syntax (in an async
// generator).
transformFlags |= 16 /* AssertES2018 */ | 128 /* AssertES2015 */ | 131072 /* ContainsYield */;
break;
- case 120 /* AnyKeyword */:
- case 135 /* NumberKeyword */:
- case 146 /* BigIntKeyword */:
- case 132 /* NeverKeyword */:
- case 136 /* ObjectKeyword */:
- case 138 /* StringKeyword */:
- case 123 /* BooleanKeyword */:
- case 139 /* SymbolKeyword */:
- case 106 /* VoidKeyword */:
- case 150 /* TypeParameter */:
- case 153 /* PropertySignature */:
- case 155 /* MethodSignature */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
- case 163 /* TypePredicate */:
- case 164 /* TypeReference */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 167 /* TypeQuery */:
- case 168 /* TypeLiteral */:
- case 169 /* ArrayType */:
- case 170 /* TupleType */:
- case 171 /* OptionalType */:
- case 172 /* RestType */:
- case 173 /* UnionType */:
- case 174 /* IntersectionType */:
- case 175 /* ConditionalType */:
- case 176 /* InferType */:
- case 177 /* ParenthesizedType */:
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 178 /* ThisType */:
- case 179 /* TypeOperator */:
- case 180 /* IndexedAccessType */:
- case 181 /* MappedType */:
- case 182 /* LiteralType */:
- case 247 /* NamespaceExportDeclaration */:
+ case 121 /* AnyKeyword */:
+ case 136 /* NumberKeyword */:
+ case 147 /* BigIntKeyword */:
+ case 133 /* NeverKeyword */:
+ case 137 /* ObjectKeyword */:
+ case 139 /* StringKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 107 /* VoidKeyword */:
+ case 151 /* TypeParameter */:
+ case 154 /* PropertySignature */:
+ case 156 /* MethodSignature */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
+ case 164 /* TypePredicate */:
+ case 165 /* TypeReference */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 168 /* TypeQuery */:
+ case 169 /* TypeLiteral */:
+ case 170 /* ArrayType */:
+ case 171 /* TupleType */:
+ case 172 /* OptionalType */:
+ case 173 /* RestType */:
+ case 174 /* UnionType */:
+ case 175 /* IntersectionType */:
+ case 176 /* ConditionalType */:
+ case 177 /* InferType */:
+ case 178 /* ParenthesizedType */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 179 /* ThisType */:
+ case 180 /* TypeOperator */:
+ case 181 /* IndexedAccessType */:
+ case 182 /* MappedType */:
+ case 183 /* LiteralType */:
+ case 248 /* NamespaceExportDeclaration */:
// Types and signatures are TypeScript syntax, and exclude all other facts.
transformFlags = 1 /* AssertTypeScript */;
excludeFlags = -2 /* TypeExcludes */;
break;
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
// Even though computed property names are ES6, we don't treat them as such.
// This is so that they can flow through PropertyName transforms unaffected.
// Instead, we mark the container as ES6, so that it can properly handle the transform.
transformFlags |= 16384 /* ContainsComputedPropertyName */;
break;
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
transformFlags |= 128 /* AssertES2015 */ | 4096 /* ContainsRestOrSpread */;
break;
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
transformFlags |= 16 /* AssertES2018 */ | 8192 /* ContainsObjectRestOrSpread */;
break;
- case 98 /* SuperKeyword */:
+ case 99 /* SuperKeyword */:
// This node is ES6 syntax.
transformFlags |= 128 /* AssertES2015 */;
excludeFlags = 536870912 /* OuterExpressionExcludes */; // must be set to persist `Super`
break;
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
// Mark this node and its ancestors as containing a lexical `this` keyword.
transformFlags |= 2048 /* ContainsLexicalThis */;
break;
- case 184 /* ObjectBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
transformFlags |= 128 /* AssertES2015 */ | 65536 /* ContainsBindingPattern */;
if (subtreeFlags & 4096 /* ContainsRestOrSpread */) {
transformFlags |= 16 /* AssertES2018 */ | 8192 /* ContainsObjectRestOrSpread */;
}
excludeFlags = 536875008 /* BindingPatternExcludes */;
break;
- case 185 /* ArrayBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
transformFlags |= 128 /* AssertES2015 */ | 65536 /* ContainsBindingPattern */;
excludeFlags = 536875008 /* BindingPatternExcludes */;
break;
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
transformFlags |= 128 /* AssertES2015 */;
if (node.dotDotDotToken) {
transformFlags |= 4096 /* ContainsRestOrSpread */;
}
break;
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
// This node is TypeScript syntax, and marks its container as also being TypeScript syntax.
transformFlags |= 1 /* AssertTypeScript */ | 1024 /* ContainsTypeScriptClassSyntax */;
break;
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
excludeFlags = 536896512 /* ObjectLiteralExcludes */;
if (subtreeFlags & 16384 /* ContainsComputedPropertyName */) {
// If an ObjectLiteralExpression contains a ComputedPropertyName, then it
@@ -30811,26 +31009,26 @@
transformFlags |= 16 /* AssertES2018 */;
}
break;
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
excludeFlags = 536875008 /* ArrayLiteralOrCallOrNewExcludes */;
break;
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
// A loop containing a block scoped binding *may* need to be transformed from ES6.
if (subtreeFlags & 32768 /* ContainsBlockScopedBinding */) {
transformFlags |= 128 /* AssertES2015 */;
}
break;
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
break;
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
// Return statements may require an `await` in ES2018.
transformFlags |= 262144 /* ContainsHoistedDeclarationOrCompletion */ | 16 /* AssertES2018 */;
break;
- case 228 /* ContinueStatement */:
- case 229 /* BreakStatement */:
+ case 229 /* ContinueStatement */:
+ case 230 /* BreakStatement */:
transformFlags |= 262144 /* ContainsHoistedDeclarationOrCompletion */;
break;
}
@@ -30848,67 +31046,67 @@
* than calling this function.
*/
function getTransformFlagsSubtreeExclusions(kind) {
- if (kind >= 163 /* FirstTypeNode */ && kind <= 183 /* LastTypeNode */) {
+ if (kind >= 164 /* FirstTypeNode */ && kind <= 184 /* LastTypeNode */) {
return -2 /* TypeExcludes */;
}
switch (kind) {
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
- case 187 /* ArrayLiteralExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
+ case 188 /* ArrayLiteralExpression */:
return 536875008 /* ArrayLiteralOrCallOrNewExcludes */;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return 537168896 /* ModuleExcludes */;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return 536870912 /* ParameterExcludes */;
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return 537371648 /* ArrowFunctionExcludes */;
- case 196 /* FunctionExpression */:
- case 239 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
return 537373696 /* FunctionExcludes */;
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
return 536944640 /* VariableDeclarationListExcludes */;
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
return 536888320 /* ClassExcludes */;
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return 537372672 /* ConstructorExcludes */;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return 537372672 /* MethodOrAccessorExcludes */;
- case 120 /* AnyKeyword */:
- case 135 /* NumberKeyword */:
- case 146 /* BigIntKeyword */:
- case 132 /* NeverKeyword */:
- case 138 /* StringKeyword */:
- case 136 /* ObjectKeyword */:
- case 123 /* BooleanKeyword */:
- case 139 /* SymbolKeyword */:
- case 106 /* VoidKeyword */:
- case 150 /* TypeParameter */:
- case 153 /* PropertySignature */:
- case 155 /* MethodSignature */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
+ case 121 /* AnyKeyword */:
+ case 136 /* NumberKeyword */:
+ case 147 /* BigIntKeyword */:
+ case 133 /* NeverKeyword */:
+ case 139 /* StringKeyword */:
+ case 137 /* ObjectKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 107 /* VoidKeyword */:
+ case 151 /* TypeParameter */:
+ case 154 /* PropertySignature */:
+ case 156 /* MethodSignature */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return -2 /* TypeExcludes */;
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return 536896512 /* ObjectLiteralExcludes */;
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return 536879104 /* CatchClauseExcludes */;
- case 184 /* ObjectBindingPattern */:
- case 185 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
return 536875008 /* BindingPatternExcludes */;
- case 194 /* TypeAssertionExpression */:
- case 212 /* AsExpression */:
- case 313 /* PartiallyEmittedExpression */:
- case 195 /* ParenthesizedExpression */:
- case 98 /* SuperKeyword */:
+ case 195 /* TypeAssertionExpression */:
+ case 213 /* AsExpression */:
+ case 314 /* PartiallyEmittedExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 99 /* SuperKeyword */:
return 536870912 /* OuterExpressionExcludes */;
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return 536870912 /* PropertyAccessExcludes */;
default:
return 536870912 /* NodeExcludes */;
@@ -31083,7 +31281,7 @@
// (their type resolved directly to the member deeply referenced)
// So to get the intervening symbols, we need to check if there's a type
// query node on any of the symbol's declarations and get symbols there
- if (d.type && d.type.kind === 167 /* TypeQuery */) {
+ if (d.type && d.type.kind === 168 /* TypeQuery */) {
var query = d.type;
var entity = getResolvedSymbol(getFirstIdentifier(query.exprName));
visitSymbol(entity);
@@ -31182,8 +31380,6 @@
undefinedSymbol.declarations = [];
var globalThisSymbol = createSymbol(1536 /* Module */, "globalThis", 8 /* Readonly */);
globalThisSymbol.exports = globals;
- globalThisSymbol.valueDeclaration = ts.createNode(72 /* Identifier */);
- globalThisSymbol.valueDeclaration.escapedText = "globalThis";
globals.set(globalThisSymbol.escapedName, globalThisSymbol);
var argumentsSymbol = createSymbol(4 /* Property */, "arguments");
var requireSymbol = createSymbol(4 /* Property */, "require");
@@ -31199,6 +31395,11 @@
getIdentifierCount: function () { return ts.sum(host.getSourceFiles(), "identifierCount"); },
getSymbolCount: function () { return ts.sum(host.getSourceFiles(), "symbolCount") + symbolCount; },
getTypeCount: function () { return typeCount; },
+ getRelationCacheSizes: function () { return ({
+ assignable: assignableRelation.size,
+ identity: identityRelation.size,
+ subtype: subtypeRelation.size,
+ }); },
isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; },
isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; },
isUnknownSymbol: function (symbol) { return symbol === unknownSymbol; },
@@ -31265,6 +31466,10 @@
node = ts.getParseTreeNode(node);
return node ? getTypeOfNode(node) : errorType;
},
+ getTypeOfAssignmentPattern: function (nodeIn) {
+ var node = ts.getParseTreeNode(nodeIn, ts.isAssignmentPattern);
+ return node && getTypeOfAssignmentPattern(node) || errorType;
+ },
getPropertySymbolOfDestructuringAssignment: function (locationIn) {
var location = ts.getParseTreeNode(locationIn, ts.isIdentifier);
return location ? getPropertySymbolOfDestructuringAssignment(location) : undefined;
@@ -31313,11 +31518,11 @@
},
isContextSensitive: isContextSensitive,
getFullyQualifiedName: getFullyQualifiedName,
- getResolvedSignature: function (node, candidatesOutArray, agumentCount) {
- return getResolvedSignatureWorker(node, candidatesOutArray, agumentCount, 0 /* Normal */);
+ getResolvedSignature: function (node, candidatesOutArray, argumentCount) {
+ return getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0 /* Normal */);
},
- getResolvedSignatureForSignatureHelp: function (node, candidatesOutArray, agumentCount) {
- return getResolvedSignatureWorker(node, candidatesOutArray, agumentCount, 16 /* IsForSignatureHelp */);
+ getResolvedSignatureForSignatureHelp: function (node, candidatesOutArray, argumentCount) {
+ return getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */);
},
getExpandedParameters: getExpandedParameters,
hasEffectiveRestParameter: hasEffectiveRestParameter,
@@ -31460,7 +31665,7 @@
var intersectionTypes = ts.createMap();
var literalTypes = ts.createMap();
var indexedAccessTypes = ts.createMap();
- var conditionalTypes = ts.createMap();
+ var substitutionTypes = ts.createMap();
var evolvingArrayTypes = [];
var undefinedProperties = ts.createMap();
var unknownSymbol = createSymbol(4 /* Property */, "unknown");
@@ -31540,6 +31745,7 @@
* This is only used if there is no exact match.
*/
var patternAmbientModules;
+ var patternAmbientModuleAugmentations;
var globalObjectType;
var globalFunctionType;
var globalCallableFunctionType;
@@ -31574,8 +31780,7 @@
var deferredGlobalTemplateStringsArrayType;
var deferredGlobalImportMetaType;
var deferredGlobalExtractSymbol;
- var deferredGlobalExcludeSymbol;
- var deferredGlobalPickSymbol;
+ var deferredGlobalOmitSymbol;
var deferredGlobalBigIntType;
var allPotentiallyUnusedIdentifiers = ts.createMap(); // key is file name
var flowLoopStart = 0;
@@ -31594,6 +31799,8 @@
var symbolLinks = [];
var nodeLinks = [];
var flowLoopCaches = [];
+ var flowAssignmentKeys = [];
+ var flowAssignmentTypes = [];
var flowLoopNodes = [];
var flowLoopKeys = [];
var flowLoopTypes = [];
@@ -31710,6 +31917,7 @@
var typeofType = createTypeofType();
var _jsxNamespace;
var _jsxFactoryEntity;
+ var outofbandVarianceMarkerHandler;
var subtypeRelation = ts.createMap();
var assignableRelation = ts.createMap();
var comparableRelation = ts.createMap();
@@ -31734,6 +31942,18 @@
CheckMode[CheckMode["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
CheckMode[CheckMode["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
})(CheckMode || (CheckMode = {}));
+ var ContextFlags;
+ (function (ContextFlags) {
+ ContextFlags[ContextFlags["None"] = 0] = "None";
+ ContextFlags[ContextFlags["Signature"] = 1] = "Signature";
+ })(ContextFlags || (ContextFlags = {}));
+ var AccessFlags;
+ (function (AccessFlags) {
+ AccessFlags[AccessFlags["None"] = 0] = "None";
+ AccessFlags[AccessFlags["NoIndexSignatures"] = 1] = "NoIndexSignatures";
+ AccessFlags[AccessFlags["Writing"] = 2] = "Writing";
+ AccessFlags[AccessFlags["CacheSymbol"] = 4] = "CacheSymbol";
+ })(AccessFlags || (AccessFlags = {}));
var CallbackCheck;
(function (CallbackCheck) {
CallbackCheck[CallbackCheck["None"] = 0] = "None";
@@ -31908,7 +32128,8 @@
* Note: if target is transient, then it is mutable, and mergeSymbol with both mutate and return it.
* If target is not transient, mergeSymbol will produce a transient clone, mutate that and return it.
*/
- function mergeSymbol(target, source) {
+ function mergeSymbol(target, source, unidirectional) {
+ if (unidirectional === void 0) { unidirectional = false; }
if (!(target.flags & getExcludedSymbolFlags(source.flags)) ||
(source.flags | target.flags) & 67108864 /* Assignment */) {
ts.Debug.assert(source !== target);
@@ -31936,18 +32157,25 @@
if (source.members) {
if (!target.members)
target.members = ts.createSymbolTable();
- mergeSymbolTable(target.members, source.members);
+ mergeSymbolTable(target.members, source.members, unidirectional);
}
if (source.exports) {
if (!target.exports)
target.exports = ts.createSymbolTable();
- mergeSymbolTable(target.exports, source.exports);
+ mergeSymbolTable(target.exports, source.exports, unidirectional);
}
+ if (!unidirectional) {
recordMergedSymbol(target, source);
}
+ }
else if (target.flags & 1024 /* NamespaceModule */) {
+ // Do not report an error when merging `var globalThis` with the built-in `globalThis`,
+ // as we will already report a "Declaration name conflicts..." error, and this error
+ // won't make much sense.
+ if (target !== globalThisSymbol) {
error(ts.getNameOfDeclaration(source.declarations[0]), ts.Diagnostics.Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity, symbolToString(target));
}
+ }
else { // error
var isEitherEnum = !!(target.flags & 384 /* Enum */ || source.flags & 384 /* Enum */);
var isEitherBlockScoped_1 = !!(target.flags & 2 /* BlockScopedVariable */ || source.flags & 2 /* BlockScopedVariable */);
@@ -32011,10 +32239,11 @@
mergeSymbolTable(combined, second);
return combined;
}
- function mergeSymbolTable(target, source) {
+ function mergeSymbolTable(target, source, unidirectional) {
+ if (unidirectional === void 0) { unidirectional = false; }
source.forEach(function (sourceSymbol, id) {
var targetSymbol = target.get(id);
- target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol) : sourceSymbol);
+ target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : sourceSymbol);
});
}
function mergeModuleAugmentation(moduleName) {
@@ -32035,14 +32264,29 @@
var moduleNotFoundError = !(moduleName.parent.parent.flags & 4194304 /* Ambient */)
? ts.Diagnostics.Invalid_module_name_in_augmentation_module_0_cannot_be_found
: undefined;
- var mainModule = resolveExternalModuleNameWorker(moduleName, moduleName, moduleNotFoundError, /*isForAugmentation*/ true);
- if (!mainModule) {
+ var mainModule_1 = resolveExternalModuleNameWorker(moduleName, moduleName, moduleNotFoundError, /*isForAugmentation*/ true);
+ if (!mainModule_1) {
return;
}
// obtain item referenced by 'export='
- mainModule = resolveExternalModuleSymbol(mainModule);
- if (mainModule.flags & 1920 /* Namespace */) {
- mainModule = mergeSymbol(mainModule, moduleAugmentation.symbol);
+ mainModule_1 = resolveExternalModuleSymbol(mainModule_1);
+ if (mainModule_1.flags & 1920 /* Namespace */) {
+ // If we’re merging an augmentation to a pattern ambient module, we want to
+ // perform the merge unidirectionally from the augmentation ('a.foo') to
+ // the pattern ('*.foo'), so that 'getMergedSymbol()' on a.foo gives you
+ // all the exports both from the pattern and from the augmentation, but
+ // 'getMergedSymbol()' on *.foo only gives you exports from *.foo.
+ if (ts.some(patternAmbientModules, function (module) { return mainModule_1 === module.symbol; })) {
+ var merged = mergeSymbol(moduleAugmentation.symbol, mainModule_1, /*unidirectional*/ true);
+ if (!patternAmbientModuleAugmentations) {
+ patternAmbientModuleAugmentations = ts.createMap();
+ }
+ // moduleName will be a StringLiteral since this is not `declare global`.
+ patternAmbientModuleAugmentations.set(moduleName.text, merged);
+ }
+ else {
+ mergeSymbol(mainModule_1, moduleAugmentation.symbol);
+ }
}
else {
// moduleName will be a StringLiteral since this is not `declare global`.
@@ -32076,7 +32320,7 @@
return nodeLinks[nodeId] || (nodeLinks[nodeId] = { flags: 0 });
}
function isGlobalSourceFile(node) {
- return node.kind === 284 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node);
+ return node.kind === 285 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node);
}
function getSymbol(symbols, name, meaning) {
if (meaning) {
@@ -32134,17 +32378,17 @@
}
if (declaration.pos <= usage.pos) {
// declaration is before usage
- if (declaration.kind === 186 /* BindingElement */) {
+ if (declaration.kind === 187 /* BindingElement */) {
// still might be illegal if declaration and usage are both binding elements (eg var [a = b, b = b] = [1, 2])
- var errorBindingElement = ts.getAncestor(usage, 186 /* BindingElement */);
+ var errorBindingElement = ts.getAncestor(usage, 187 /* BindingElement */);
if (errorBindingElement) {
return ts.findAncestor(errorBindingElement, ts.isBindingElement) !== ts.findAncestor(declaration, ts.isBindingElement) ||
declaration.pos < errorBindingElement.pos;
}
// or it might be illegal if usage happens before parent variable is declared (eg var [a] = a)
- return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 237 /* VariableDeclaration */), usage);
+ return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 238 /* VariableDeclaration */), usage);
}
- else if (declaration.kind === 237 /* VariableDeclaration */) {
+ else if (declaration.kind === 238 /* VariableDeclaration */) {
// still might be illegal if usage is in the initializer of the variable declaration (eg var a = a)
return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage);
}
@@ -32152,6 +32396,10 @@
// still might be illegal if the usage is within a computed property name in the class (eg class A { static p = "a"; [A.p]() {} })
return !ts.findAncestor(usage, function (n) { return ts.isComputedPropertyName(n) && n.parent.parent === declaration; });
}
+ else if (ts.isPropertyDeclaration(declaration)) {
+ // still might be illegal if a self-referencing property initializer (eg private x = this.x)
+ return !isPropertyImmediatelyReferencedWithinDeclaration(declaration, usage);
+ }
return true;
}
// declaration is after usage, but it can still be legal if usage is deferred:
@@ -32163,12 +32411,12 @@
// or if usage is in a type context:
// 1. inside a type query (typeof in type position)
// 2. inside a jsdoc comment
- if (usage.parent.kind === 257 /* ExportSpecifier */ || (usage.parent.kind === 254 /* ExportAssignment */ && usage.parent.isExportEquals)) {
+ if (usage.parent.kind === 258 /* ExportSpecifier */ || (usage.parent.kind === 255 /* ExportAssignment */ && usage.parent.isExportEquals)) {
// export specifiers do not use the variable, they only make it available for use
return true;
}
// When resolving symbols for exports, the `usage` location passed in can be the export site directly
- if (usage.kind === 254 /* ExportAssignment */ && usage.isExportEquals) {
+ if (usage.kind === 255 /* ExportAssignment */ && usage.isExportEquals) {
return true;
}
var container = ts.getEnclosingBlockScopeContainer(declaration);
@@ -32176,9 +32424,9 @@
function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) {
var container = ts.getEnclosingBlockScopeContainer(declaration);
switch (declaration.parent.parent.kind) {
- case 219 /* VariableStatement */:
- case 225 /* ForStatement */:
- case 227 /* ForOfStatement */:
+ case 220 /* VariableStatement */:
+ case 226 /* ForStatement */:
+ case 228 /* ForOfStatement */:
// variable statement/for/for-of statement case,
// use site should not be inside variable declaration (initializer of declaration or binding element)
if (isSameScopeDescendentOf(usage, declaration, container)) {
@@ -32199,16 +32447,16 @@
return true;
}
var initializerOfProperty = current.parent &&
- current.parent.kind === 154 /* PropertyDeclaration */ &&
+ current.parent.kind === 155 /* PropertyDeclaration */ &&
current.parent.initializer === current;
if (initializerOfProperty) {
if (ts.hasModifier(current.parent, 32 /* Static */)) {
- if (declaration.kind === 156 /* MethodDeclaration */) {
+ if (declaration.kind === 157 /* MethodDeclaration */) {
return true;
}
}
else {
- var isDeclarationInstanceProperty = declaration.kind === 154 /* PropertyDeclaration */ && !ts.hasModifier(declaration, 32 /* Static */);
+ var isDeclarationInstanceProperty = declaration.kind === 155 /* PropertyDeclaration */ && !ts.hasModifier(declaration, 32 /* Static */);
if (!isDeclarationInstanceProperty || ts.getContainingClass(usage) !== ts.getContainingClass(declaration)) {
return true;
}
@@ -32217,6 +32465,36 @@
return false;
});
}
+ function isPropertyImmediatelyReferencedWithinDeclaration(declaration, usage) {
+ // always legal if usage is after declaration
+ if (usage.end > declaration.end) {
+ return false;
+ }
+ // still might be legal if usage is deferred (e.g. x: any = () => this.x)
+ // otherwise illegal if immediately referenced within the declaration (e.g. x: any = this.x)
+ var ancestorChangingReferenceScope = ts.findAncestor(usage, function (node) {
+ if (node === declaration) {
+ return "quit";
+ }
+ switch (node.kind) {
+ case 198 /* ArrowFunction */:
+ case 155 /* PropertyDeclaration */:
+ return true;
+ case 219 /* Block */:
+ switch (node.parent.kind) {
+ case 159 /* GetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 160 /* SetAccessor */:
+ return true;
+ default:
+ return false;
+ }
+ default:
+ return false;
+ }
+ });
+ return ancestorChangingReferenceScope === undefined;
+ }
}
/**
* Resolve a given name for a given meaning at a given location. An error is reported if the name was not found and
@@ -32235,6 +32513,8 @@
var lastLocation;
var lastSelfReferenceLocation;
var propertyWithInvalidInitializer;
+ var associatedDeclarationForContainingInitializer;
+ var withinDeferredContext = false;
var errorLocation = location;
var grandparent;
var isInExternalModule = false;
@@ -32250,12 +32530,12 @@
// - parameters are only in the scope of function body
// This restriction does not apply to JSDoc comment types because they are parented
// at a higher level than type parameters would normally be
- if (meaning & result.flags & 67897832 /* Type */ && lastLocation.kind !== 296 /* JSDocComment */) {
+ if (meaning & result.flags & 67897832 /* Type */ && lastLocation.kind !== 297 /* JSDocComment */) {
useResult = result.flags & 262144 /* TypeParameter */
// type parameters are visible in parameter list, return type and type parameter list
? lastLocation === location.type ||
- lastLocation.kind === 151 /* Parameter */ ||
- lastLocation.kind === 150 /* TypeParameter */
+ lastLocation.kind === 152 /* Parameter */ ||
+ lastLocation.kind === 151 /* TypeParameter */
// local types not visible outside the function body
: false;
}
@@ -32272,13 +32552,13 @@
// however it is detected separately when checking initializers of parameters
// to make sure that they reference no variables declared after them.
useResult =
- lastLocation.kind === 151 /* Parameter */ ||
+ lastLocation.kind === 152 /* Parameter */ ||
(lastLocation === location.type &&
!!ts.findAncestor(result.valueDeclaration, ts.isParameter));
}
}
}
- else if (location.kind === 175 /* ConditionalType */) {
+ else if (location.kind === 176 /* ConditionalType */) {
// A type parameter declared using 'infer T' in a conditional type is visible only in
// the true branch of the conditional type.
useResult = lastLocation === location.trueType;
@@ -32291,15 +32571,16 @@
}
}
}
+ withinDeferredContext = withinDeferredContext || getIsDeferredContext(location, lastLocation);
switch (location.kind) {
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
if (!ts.isExternalOrCommonJsModule(location))
break;
isInExternalModule = true;
// falls through
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
var moduleExports = getSymbolOfNode(location).exports;
- if (location.kind === 284 /* SourceFile */ || ts.isAmbientModule(location)) {
+ if (location.kind === 285 /* SourceFile */ || ts.isAmbientModule(location)) {
// It's an external module. First see if the module has an export default and if the local
// name of that export default matches.
if (result = moduleExports.get("default" /* Default */)) {
@@ -32323,7 +32604,7 @@
var moduleExport = moduleExports.get(name);
if (moduleExport &&
moduleExport.flags === 2097152 /* Alias */ &&
- ts.getDeclarationOfKind(moduleExport, 257 /* ExportSpecifier */)) {
+ ts.getDeclarationOfKind(moduleExport, 258 /* ExportSpecifier */)) {
break;
}
}
@@ -32337,20 +32618,19 @@
}
}
break;
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
if (result = lookup(getSymbolOfNode(location).exports, name, meaning & 8 /* EnumMember */)) {
break loop;
}
break;
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
// TypeScript 1.0 spec (April 2014): 8.4.1
// Initializer expressions for instance member variables are evaluated in the scope
// of the class constructor body but are not permitted to reference parameters or
// local variables of the constructor. This effectively means that entities from outer scopes
// by the same name as a constructor parameter or local variable are inaccessible
// in initializer expressions for instance member variables.
- if (ts.isClassLike(location.parent) && !ts.hasModifier(location, 32 /* Static */)) {
+ if (!ts.hasModifier(location, 32 /* Static */)) {
var ctor = findConstructorDeclaration(location.parent);
if (ctor && ctor.locals) {
if (lookup(ctor.locals, name, meaning & 67220415 /* Value */)) {
@@ -32360,9 +32640,9 @@
}
}
break;
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
// The below is used to lookup type parameters within a class or interface, as they are added to the class/interface locals
// These can never be latebound, so the symbol's raw members are sufficient. `getMembersOfNode` cannot be used, as it would
// trigger resolving late-bound names, which we may already be in the process of doing while we're here!
@@ -32381,7 +32661,7 @@
}
break loop;
}
- if (location.kind === 209 /* ClassExpression */ && meaning & 32 /* Class */) {
+ if (location.kind === 210 /* ClassExpression */ && meaning & 32 /* Class */) {
var className = location.name;
if (className && name === className.escapedText) {
result = location.symbol;
@@ -32389,9 +32669,9 @@
}
}
break;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
// The type parameters of a class are not in scope in the base class expression.
- if (lastLocation === location.expression && location.parent.token === 86 /* ExtendsKeyword */) {
+ if (lastLocation === location.expression && location.parent.token === 87 /* ExtendsKeyword */) {
var container = location.parent.parent;
if (ts.isClassLike(container) && (result = lookup(getSymbolOfNode(container).members, name, meaning & 67897832 /* Type */))) {
if (nameNotFoundMessage) {
@@ -32409,9 +32689,9 @@
// [foo<T>()]() { } // <-- Reference to T from class's own computed property
// }
//
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
grandparent = location.parent.parent;
- if (ts.isClassLike(grandparent) || grandparent.kind === 241 /* InterfaceDeclaration */) {
+ if (ts.isClassLike(grandparent) || grandparent.kind === 242 /* InterfaceDeclaration */) {
// A reference to this grandparent's type parameters would be an error
if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 67897832 /* Type */)) {
error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
@@ -32419,24 +32699,24 @@
}
}
break;
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
// when targeting ES6 or higher there is no 'arguments' in an arrow function
// for lower compile targets the resolved symbol is used to emit an error
if (compilerOptions.target >= 2 /* ES2015 */) {
break;
}
// falls through
- case 156 /* MethodDeclaration */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 239 /* FunctionDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 240 /* FunctionDeclaration */:
if (meaning & 3 /* Variable */ && name === "arguments") {
result = argumentsSymbol;
break loop;
}
break;
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
if (meaning & 3 /* Variable */ && name === "arguments") {
result = argumentsSymbol;
break loop;
@@ -32449,7 +32729,7 @@
}
}
break;
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
// Decorators are resolved at the class declaration. Resolving at the parameter
// or member would result in looking up locals in the method.
//
@@ -32458,7 +32738,7 @@
// method(@y x, y) {} // <-- decorator y should be resolved at the class declaration, not the parameter.
// }
//
- if (location.parent && location.parent.kind === 151 /* Parameter */) {
+ if (location.parent && location.parent.kind === 152 /* Parameter */) {
location = location.parent;
}
//
@@ -32473,15 +32753,28 @@
// declare function y(x: T): any;
// @param(1 as T) // <-- T should resolve to the type alias outside of class C
// class C<T> {}
- if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 240 /* ClassDeclaration */)) {
+ if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 241 /* ClassDeclaration */)) {
location = location.parent;
}
break;
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
// js type aliases do not resolve names from their host, so skip past it
location = ts.getJSDocHost(location);
break;
+ case 152 /* Parameter */:
+ if (lastLocation && lastLocation === location.initializer) {
+ associatedDeclarationForContainingInitializer = location;
+ }
+ break;
+ case 187 /* BindingElement */:
+ if (lastLocation && lastLocation === location.initializer) {
+ var root = ts.getRootDeclaration(location);
+ if (root.kind === 152 /* Parameter */) {
+ associatedDeclarationForContainingInitializer = location;
+ }
+ }
+ break;
}
if (isSelfReferenceLocation(location)) {
lastSelfReferenceLocation = location;
@@ -32497,7 +32790,7 @@
}
if (!result) {
if (lastLocation) {
- ts.Debug.assert(lastLocation.kind === 284 /* SourceFile */);
+ ts.Debug.assert(lastLocation.kind === 285 /* SourceFile */);
if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) {
return lastLocation.symbol;
}
@@ -32573,20 +32866,48 @@
if (result && isInExternalModule && (meaning & 67220415 /* Value */) === 67220415 /* Value */ && !(originalLocation.flags & 2097152 /* JSDoc */)) {
var merged = getMergedSymbol(result);
if (ts.length(merged.declarations) && ts.every(merged.declarations, function (d) { return ts.isNamespaceExportDeclaration(d) || ts.isSourceFile(d) && !!d.symbol.globalExports; })) {
- error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, ts.unescapeLeadingUnderscores(name)); // TODO: GH#18217
+ errorOrSuggestion(!compilerOptions.allowUmdGlobalAccess, errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, ts.unescapeLeadingUnderscores(name));
+ }
+ }
+ // If we're in a parameter initializer, we can't reference the values of the parameter whose initializer we're within or parameters to the right
+ if (result && associatedDeclarationForContainingInitializer && !withinDeferredContext && (meaning & 67220415 /* Value */) === 67220415 /* Value */) {
+ var candidate = getMergedSymbol(getLateBoundSymbol(result));
+ var root = ts.getRootDeclaration(associatedDeclarationForContainingInitializer);
+ // A parameter initializer or binding pattern initializer within a parameter cannot refer to itself
+ if (candidate === getSymbolOfNode(associatedDeclarationForContainingInitializer)) {
+ error(errorLocation, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(associatedDeclarationForContainingInitializer.name));
+ }
+ // And it cannot refer to any declarations which come after it
+ else if (candidate.valueDeclaration && candidate.valueDeclaration.pos > associatedDeclarationForContainingInitializer.pos && root.parent.locals && lookup(root.parent.locals, candidate.escapedName, meaning) === candidate) {
+ error(errorLocation, ts.Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(associatedDeclarationForContainingInitializer.name), ts.declarationNameToString(errorLocation));
}
}
}
return result;
}
+ function getIsDeferredContext(location, lastLocation) {
+ if (location.kind !== 198 /* ArrowFunction */ && location.kind !== 197 /* FunctionExpression */) {
+ // initializers in instance property declaration of class like entities are executed in constructor and thus deferred
+ return ts.isTypeQueryNode(location) || ((ts.isFunctionLikeDeclaration(location) ||
+ (location.kind === 155 /* PropertyDeclaration */ && !ts.hasModifier(location, 32 /* Static */))) && (!lastLocation || lastLocation !== location.name)); // A name is evaluated within the enclosing scope - so it shouldn't count as deferred
+ }
+ if (lastLocation && lastLocation === location.name) {
+ return false;
+ }
+ // generator functions and async functions are not inlined in control flow when immediately invoked
+ if (location.asteriskToken || ts.hasModifier(location, 256 /* Async */)) {
+ return true;
+ }
+ return !ts.getImmediatelyInvokedFunctionExpression(location);
+ }
function isSelfReferenceLocation(node) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 244 /* ModuleDeclaration */: // For `namespace N { N; }`
+ case 240 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 245 /* ModuleDeclaration */: // For `namespace N { N; }`
return true;
default:
return false;
@@ -32598,7 +32919,7 @@
function isTypeParameterSymbolDeclaredInContainer(symbol, container) {
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var decl = _a[_i];
- if (decl.kind === 150 /* TypeParameter */) {
+ if (decl.kind === 151 /* TypeParameter */) {
var parent = ts.isJSDocTemplateTag(decl.parent) ? ts.getJSDocHost(decl.parent) : decl.parent;
if (parent === container) {
return !(ts.isJSDocTemplateTag(decl.parent) && ts.find(decl.parent.parent.tags, ts.isJSDocTypeAlias)); // TODO: GH#18217
@@ -32653,10 +32974,10 @@
*/
function getEntityNameForExtendingInterface(node) {
switch (node.kind) {
- case 72 /* Identifier */:
- case 189 /* PropertyAccessExpression */:
+ case 73 /* Identifier */:
+ case 190 /* PropertyAccessExpression */:
return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
if (ts.isEntityNameExpression(node.expression)) {
return node.expression;
}
@@ -32745,7 +33066,7 @@
function checkResolvedBlockScopedVariable(result, errorLocation) {
ts.Debug.assert(!!(result.flags & 2 /* BlockScopedVariable */ || result.flags & 32 /* Class */ || result.flags & 384 /* Enum */));
// Block-scoped variables cannot be used before their definition
- var declaration = ts.find(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 243 /* EnumDeclaration */) || ts.isInJSFile(d) && !!ts.getJSDocEnumTag(d); });
+ var declaration = ts.find(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 244 /* EnumDeclaration */) || ts.isInJSFile(d) && !!ts.getJSDocEnumTag(d); });
if (declaration === undefined)
return ts.Debug.fail("Declaration to checkResolvedBlockScopedVariable is undefined");
if (!(declaration.flags & 4194304 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) {
@@ -32780,13 +33101,13 @@
}
function getAnyImportSyntax(node) {
switch (node.kind) {
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return node;
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
return node.parent;
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
return node.parent.parent;
- case 253 /* ImportSpecifier */:
+ case 254 /* ImportSpecifier */:
return node.parent.parent.parent;
default:
return undefined;
@@ -32796,7 +33117,7 @@
return ts.find(symbol.declarations, ts.isAliasSymbolDeclaration);
}
function getTargetOfImportEqualsDeclaration(node, dontResolveAlias) {
- if (node.moduleReference.kind === 259 /* ExternalModuleReference */) {
+ if (node.moduleReference.kind === 260 /* ExternalModuleReference */) {
return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node)));
}
return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, dontResolveAlias);
@@ -32853,8 +33174,17 @@
var file = ts.find(moduleSymbol.declarations, ts.isSourceFile);
var hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias);
if (!exportDefaultSymbol && !hasSyntheticDefault) {
+ if (hasExportAssignmentSymbol(moduleSymbol)) {
+ var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop";
+ var exportEqualsSymbol = moduleSymbol.exports.get("export=" /* ExportEquals */);
+ var exportAssignment = exportEqualsSymbol.valueDeclaration;
+ var err = error(node.name, ts.Diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag, symbolToString(moduleSymbol), compilerOptionName);
+ ts.addRelatedInfo(err, ts.createDiagnosticForNode(exportAssignment, ts.Diagnostics.This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag, compilerOptionName));
+ }
+ else {
error(node.name, ts.Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol));
}
+ }
else if (hasSyntheticDefault) {
// per emit behavior, a synthetic default overrides a "real" .default member if `__esModule` is not present
return resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
@@ -32988,20 +33318,20 @@
function getTargetOfAliasDeclaration(node, dontRecursivelyResolve) {
if (dontRecursivelyResolve === void 0) { dontRecursivelyResolve = false; }
switch (node.kind) {
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return getTargetOfImportEqualsDeclaration(node, dontRecursivelyResolve);
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
return getTargetOfImportClause(node, dontRecursivelyResolve);
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
return getTargetOfNamespaceImport(node, dontRecursivelyResolve);
- case 253 /* ImportSpecifier */:
+ case 254 /* ImportSpecifier */:
return getTargetOfImportSpecifier(node, dontRecursivelyResolve);
- case 257 /* ExportSpecifier */:
+ case 258 /* ExportSpecifier */:
return getTargetOfExportSpecifier(node, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */, dontRecursivelyResolve);
- case 254 /* ExportAssignment */:
- case 204 /* BinaryExpression */:
+ case 255 /* ExportAssignment */:
+ case 205 /* BinaryExpression */:
return getTargetOfExportAssignment(node, dontRecursivelyResolve);
- case 247 /* NamespaceExportDeclaration */:
+ case 248 /* NamespaceExportDeclaration */:
return getTargetOfNamespaceExportDeclaration(node, dontRecursivelyResolve);
default:
return ts.Debug.fail();
@@ -33062,11 +33392,11 @@
var node = getDeclarationOfAliasSymbol(symbol);
if (!node)
return ts.Debug.fail();
- if (node.kind === 254 /* ExportAssignment */) {
+ if (node.kind === 255 /* ExportAssignment */) {
// export default <symbol>
checkExpressionCached(node.expression);
}
- else if (node.kind === 257 /* ExportSpecifier */) {
+ else if (node.kind === 258 /* ExportSpecifier */) {
// export { <symbol> } or export { <symbol> as foo }
checkExpressionCached(node.propertyName || node.name);
}
@@ -33084,17 +33414,17 @@
// import a = |b|; // Namespace
// import a = |b.c|; // Value, type, namespace
// import a = |b.c|.d; // Namespace
- if (entityName.kind === 72 /* Identifier */ && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {
+ if (entityName.kind === 73 /* Identifier */ && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {
entityName = entityName.parent;
}
// Check for case 1 and 3 in the above example
- if (entityName.kind === 72 /* Identifier */ || entityName.parent.kind === 148 /* QualifiedName */) {
+ if (entityName.kind === 73 /* Identifier */ || entityName.parent.kind === 149 /* QualifiedName */) {
return resolveEntityName(entityName, 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias);
}
else {
// Case 2 in above example
// entityName.kind could be a QualifiedName or a Missing identifier
- ts.Debug.assert(entityName.parent.kind === 248 /* ImportEqualsDeclaration */);
+ ts.Debug.assert(entityName.parent.kind === 249 /* ImportEqualsDeclaration */);
return resolveEntityName(entityName, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias);
}
}
@@ -33110,17 +33440,17 @@
}
var namespaceMeaning = 1920 /* Namespace */ | (ts.isInJSFile(name) ? meaning & 67220415 /* Value */ : 0);
var symbol;
- if (name.kind === 72 /* Identifier */) {
- var message = meaning === namespaceMeaning ? ts.Diagnostics.Cannot_find_namespace_0 : getCannotFindNameDiagnosticForName(getFirstIdentifier(name).escapedText);
+ if (name.kind === 73 /* Identifier */) {
+ var message = meaning === namespaceMeaning ? ts.Diagnostics.Cannot_find_namespace_0 : getCannotFindNameDiagnosticForName(getFirstIdentifier(name));
var symbolFromJSPrototype = ts.isInJSFile(name) ? resolveEntityNameFromAssignmentDeclaration(name, meaning) : undefined;
symbol = resolveName(location || name, name.escapedText, meaning, ignoreErrors || symbolFromJSPrototype ? undefined : message, name, /*isUse*/ true);
if (!symbol) {
return symbolFromJSPrototype;
}
}
- else if (name.kind === 148 /* QualifiedName */ || name.kind === 189 /* PropertyAccessExpression */) {
- var left = name.kind === 148 /* QualifiedName */ ? name.left : name.expression;
- var right = name.kind === 148 /* QualifiedName */ ? name.right : name.name;
+ else if (name.kind === 149 /* QualifiedName */ || name.kind === 190 /* PropertyAccessExpression */) {
+ var left = name.kind === 149 /* QualifiedName */ ? name.left : name.expression;
+ var right = name.kind === 149 /* QualifiedName */ ? name.right : name.name;
var namespace = resolveEntityName(left, namespaceMeaning, ignoreErrors, /*dontResolveAlias*/ false, location);
if (!namespace || ts.nodeIsMissing(right)) {
return undefined;
@@ -33255,6 +33585,14 @@
if (patternAmbientModules) {
var pattern = ts.findBestPatternMatch(patternAmbientModules, function (_) { return _.pattern; }, moduleReference);
if (pattern) {
+ // If the module reference matched a pattern ambient module ('*.foo') but there’s also a
+ // module augmentation by the specific name requested ('a.foo'), we store the merged symbol
+ // by the augmentation name ('a.foo'), because asking for *.foo should not give you exports
+ // from a.foo.
+ var augmentation = patternAmbientModuleAugmentations && patternAmbientModuleAugmentations.get(moduleReference);
+ if (augmentation) {
+ return getMergedSymbol(augmentation);
+ }
return getMergedSymbol(pattern.symbol);
}
}
@@ -33345,7 +33683,7 @@
function resolveESModuleSymbol(moduleSymbol, referencingLocation, dontResolveAlias) {
var symbol = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias);
if (!dontResolveAlias && symbol) {
- if (!(symbol.flags & (1536 /* Module */ | 3 /* Variable */)) && !ts.getDeclarationOfKind(symbol, 284 /* SourceFile */)) {
+ if (!(symbol.flags & (1536 /* Module */ | 3 /* Variable */)) && !ts.getDeclarationOfKind(symbol, 285 /* SourceFile */)) {
var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015
? "allowSyntheticDefaultImports"
: "esModuleInterop";
@@ -33607,7 +33945,7 @@
var members = node.members;
for (var _i = 0, members_2 = members; _i < members_2.length; _i++) {
var member = members_2[_i];
- if (member.kind === 157 /* Constructor */ && ts.nodeIsPresent(member.body)) {
+ if (member.kind === 158 /* Constructor */ && ts.nodeIsPresent(member.body)) {
return member;
}
}
@@ -33653,7 +33991,7 @@
return type;
}
// A reserved member name starts with two underscores, but the third character cannot be an underscore
- // or the @ symbol. A third underscore indicates an escaped form of an identifer that started
+ // or the @ symbol. A third underscore indicates an escaped form of an identifier that started
// with at least two underscores. The @ character indicates that the name is denoted by a well known ES
// Symbol instance.
function isReservedMemberName(name) {
@@ -33693,12 +34031,12 @@
}
}
switch (location.kind) {
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
if (!ts.isExternalOrCommonJsModule(location)) {
break;
}
// falls through
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
if (result = callback(getSymbolOfNode(location).exports)) {
return result;
}
@@ -33762,7 +34100,7 @@
&& (!useOnlyExternalAliasing || ts.some(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration))
// While exports are generally considered to be in scope, export-specifier declared symbols are _not_
// See similar comment in `resolveName` for details
- && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 257 /* ExportSpecifier */))) {
+ && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 258 /* ExportSpecifier */))) {
var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable);
if (isAccessible(symbolFromSymbolTable, resolvedImportedSymbol, ignoreQualification)) {
return [symbolFromSymbolTable];
@@ -33798,7 +34136,7 @@
return true;
}
// Qualify if the symbol from symbol table has same meaning as expected
- symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 257 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable;
+ symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 258 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable;
if (symbolFromSymbolTable.flags & meaning) {
qualify = true;
return true;
@@ -33813,10 +34151,10 @@
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
switch (declaration.kind) {
- case 154 /* PropertyDeclaration */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 155 /* PropertyDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
continue;
default:
return false;
@@ -33872,7 +34210,7 @@
var containers = getContainersOfSymbol(symbol, enclosingDeclaration);
// If we're trying to reference some object literal in, eg `var a = { x: 1 }`, the symbol for the literal, `__object`, is distinct
// from the symbol of the declaration it is being assigned to. Since we can use the declaration to refer to the literal, however,
- // we'd like to make that connection here - potentially causing us to paint the declararation's visibiility, and therefore the literal.
+ // we'd like to make that connection here - potentially causing us to paint the declaration's visibility, and therefore the literal.
var firstDecl = ts.first(symbol.declarations);
if (!ts.length(containers) && meaning & 67220415 /* Value */ && firstDecl && ts.isObjectLiteralExpression(firstDecl)) {
if (firstDecl.parent && ts.isVariableDeclaration(firstDecl.parent) && firstDecl === firstDecl.parent.initializer) {
@@ -33933,10 +34271,10 @@
return node && getSymbolOfNode(node);
}
function hasExternalModuleSymbol(declaration) {
- return ts.isAmbientModule(declaration) || (declaration.kind === 284 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration));
+ return ts.isAmbientModule(declaration) || (declaration.kind === 285 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration));
}
function hasNonGlobalAugmentationExternalModuleSymbol(declaration) {
- return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 284 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration));
+ return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 285 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration));
}
function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) {
var aliasesToMakeVisible;
@@ -33983,14 +34321,14 @@
function isEntityNameVisible(entityName, enclosingDeclaration) {
// get symbol of the first identifier of the entityName
var meaning;
- if (entityName.parent.kind === 167 /* TypeQuery */ ||
+ if (entityName.parent.kind === 168 /* TypeQuery */ ||
ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent) ||
- entityName.parent.kind === 149 /* ComputedPropertyName */) {
+ entityName.parent.kind === 150 /* ComputedPropertyName */) {
// Typeof value
meaning = 67220415 /* Value */ | 1048576 /* ExportValue */;
}
- else if (entityName.kind === 148 /* QualifiedName */ || entityName.kind === 189 /* PropertyAccessExpression */ ||
- entityName.parent.kind === 248 /* ImportEqualsDeclaration */) {
+ else if (entityName.kind === 149 /* QualifiedName */ || entityName.kind === 190 /* PropertyAccessExpression */ ||
+ entityName.parent.kind === 249 /* ImportEqualsDeclaration */) {
// Left identifier from type reference or TypeAlias
// Entity name of the import declaration
meaning = 1920 /* Namespace */;
@@ -34039,10 +34377,10 @@
function signatureToStringWorker(writer) {
var sigOutput;
if (flags & 262144 /* WriteArrowStyleSignature */) {
- sigOutput = kind === 1 /* Construct */ ? 166 /* ConstructorType */ : 165 /* FunctionType */;
+ sigOutput = kind === 1 /* Construct */ ? 167 /* ConstructorType */ : 166 /* FunctionType */;
}
else {
- sigOutput = kind === 1 /* Construct */ ? 161 /* ConstructSignature */ : 160 /* CallSignature */;
+ sigOutput = kind === 1 /* Construct */ ? 162 /* ConstructSignature */ : 161 /* CallSignature */;
}
var sig = nodeBuilder.signatureToSignatureDeclaration(signature, sigOutput, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | 512 /* WriteTypeParametersInQualifiedName */);
var printer = ts.createPrinter({ removeComments: true, omitTrailingSemicolon: true });
@@ -34069,6 +34407,15 @@
}
return result;
}
+ function getTypeNamesForErrorDisplay(left, right) {
+ var leftStr = typeToString(left);
+ var rightStr = typeToString(right);
+ if (leftStr === rightStr) {
+ leftStr = typeToString(left, /*enclosingDeclaration*/ undefined, 64 /* UseFullyQualifiedType */);
+ rightStr = typeToString(right, /*enclosingDeclaration*/ undefined, 64 /* UseFullyQualifiedType */);
+ }
+ return [leftStr, rightStr];
+ }
function toNodeBuilderFlags(flags) {
if (flags === void 0) { flags = 0 /* None */; }
return flags & 9469291 /* NodeBuilderFlagsMask */;
@@ -34137,26 +34484,26 @@
}
if (type.flags & 1 /* Any */) {
context.approximateLength += 3;
- return ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ return ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
if (type.flags & 2 /* Unknown */) {
- return ts.createKeywordTypeNode(143 /* UnknownKeyword */);
+ return ts.createKeywordTypeNode(144 /* UnknownKeyword */);
}
if (type.flags & 4 /* String */) {
context.approximateLength += 6;
- return ts.createKeywordTypeNode(138 /* StringKeyword */);
+ return ts.createKeywordTypeNode(139 /* StringKeyword */);
}
if (type.flags & 8 /* Number */) {
context.approximateLength += 6;
- return ts.createKeywordTypeNode(135 /* NumberKeyword */);
+ return ts.createKeywordTypeNode(136 /* NumberKeyword */);
}
if (type.flags & 64 /* BigInt */) {
context.approximateLength += 6;
- return ts.createKeywordTypeNode(146 /* BigIntKeyword */);
+ return ts.createKeywordTypeNode(147 /* BigIntKeyword */);
}
if (type.flags & 16 /* Boolean */) {
context.approximateLength += 7;
- return ts.createKeywordTypeNode(123 /* BooleanKeyword */);
+ return ts.createKeywordTypeNode(124 /* BooleanKeyword */);
}
if (type.flags & 1024 /* EnumLiteral */ && !(type.flags & 1048576 /* Union */)) {
var parentSymbol = getParentOfSymbol(type.symbol);
@@ -34174,8 +34521,9 @@
return ts.createLiteralTypeNode(ts.setEmitFlags(ts.createLiteral(type.value), 16777216 /* NoAsciiEscaping */));
}
if (type.flags & 256 /* NumberLiteral */) {
- context.approximateLength += (("" + type.value).length);
- return ts.createLiteralTypeNode((ts.createLiteral(type.value)));
+ var value = type.value;
+ context.approximateLength += ("" + value).length;
+ return ts.createLiteralTypeNode(value < 0 ? ts.createPrefix(39 /* MinusToken */, ts.createLiteral(-value)) : ts.createLiteral(value));
}
if (type.flags & 2048 /* BigIntLiteral */) {
context.approximateLength += (ts.pseudoBigIntToString(type.value).length) + 1;
@@ -34196,33 +34544,33 @@
}
}
context.approximateLength += 13;
- return ts.createTypeOperatorNode(142 /* UniqueKeyword */, ts.createKeywordTypeNode(139 /* SymbolKeyword */));
+ return ts.createTypeOperatorNode(143 /* UniqueKeyword */, ts.createKeywordTypeNode(140 /* SymbolKeyword */));
}
if (type.flags & 16384 /* Void */) {
context.approximateLength += 4;
- return ts.createKeywordTypeNode(106 /* VoidKeyword */);
+ return ts.createKeywordTypeNode(107 /* VoidKeyword */);
}
if (type.flags & 32768 /* Undefined */) {
context.approximateLength += 9;
- return ts.createKeywordTypeNode(141 /* UndefinedKeyword */);
+ return ts.createKeywordTypeNode(142 /* UndefinedKeyword */);
}
if (type.flags & 65536 /* Null */) {
context.approximateLength += 4;
- return ts.createKeywordTypeNode(96 /* NullKeyword */);
+ return ts.createKeywordTypeNode(97 /* NullKeyword */);
}
if (type.flags & 131072 /* Never */) {
context.approximateLength += 5;
- return ts.createKeywordTypeNode(132 /* NeverKeyword */);
+ return ts.createKeywordTypeNode(133 /* NeverKeyword */);
}
if (type.flags & 4096 /* ESSymbol */) {
context.approximateLength += 6;
- return ts.createKeywordTypeNode(139 /* SymbolKeyword */);
+ return ts.createKeywordTypeNode(140 /* SymbolKeyword */);
}
if (type.flags & 67108864 /* NonPrimitive */) {
context.approximateLength += 6;
- return ts.createKeywordTypeNode(136 /* ObjectKeyword */);
+ return ts.createKeywordTypeNode(137 /* ObjectKeyword */);
}
- if (type.flags & 262144 /* TypeParameter */ && type.isThisType) {
+ if (isThisTypeParameter(type)) {
if (context.flags & 4194304 /* InObjectTypeLiteral */) {
if (!context.encounteredError && !(context.flags & 32768 /* AllowThisInObjectLiteral */)) {
context.encounteredError = true;
@@ -34272,7 +34620,7 @@
}
var typeNodes = mapToTypeNodes(types, context, /*isBareList*/ true);
if (typeNodes && typeNodes.length > 0) {
- var unionOrIntersectionTypeNode = ts.createUnionOrIntersectionTypeNode(type.flags & 1048576 /* Union */ ? 173 /* UnionType */ : 174 /* IntersectionType */, typeNodes);
+ var unionOrIntersectionTypeNode = ts.createUnionOrIntersectionTypeNode(type.flags & 1048576 /* Union */ ? 174 /* UnionType */ : 175 /* IntersectionType */, typeNodes);
return unionOrIntersectionTypeNode;
}
else {
@@ -34305,8 +34653,8 @@
context.inferTypeParameters = type.root.inferTypeParameters;
var extendsTypeNode = typeToTypeNodeHelper(type.extendsType, context);
context.inferTypeParameters = saveInferTypeParameters;
- var trueTypeNode = typeToTypeNodeHelper(type.trueType, context);
- var falseTypeNode = typeToTypeNodeHelper(type.falseType, context);
+ var trueTypeNode = typeToTypeNodeHelper(getTrueTypeFromConditionalType(type), context);
+ var falseTypeNode = typeToTypeNodeHelper(getFalseTypeFromConditionalType(type), context);
context.approximateLength += 15;
return ts.createConditionalTypeNode(checkTypeNode, extendsTypeNode, trueTypeNode, falseTypeNode);
}
@@ -34346,7 +34694,7 @@
return symbolToTypeNode(symbol, context, isInstanceType);
}
// Always use 'typeof T' for type of class, enum, and module objects
- else if (symbol.flags & 32 /* Class */ && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration.kind === 209 /* ClassExpression */ && context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */) ||
+ else if (symbol.flags & 32 /* Class */ && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration.kind === 210 /* ClassExpression */ && context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */) ||
symbol.flags & (384 /* Enum */ | 512 /* ValueModule */) ||
shouldWriteTypeOfFunctionSymbol()) {
return symbolToTypeNode(symbol, context, 67220415 /* Value */);
@@ -34393,7 +34741,7 @@
var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) &&
(symbol.parent || // is exported function symbol
ts.forEach(symbol.declarations, function (declaration) {
- return declaration.parent.kind === 284 /* SourceFile */ || declaration.parent.kind === 245 /* ModuleBlock */;
+ return declaration.parent.kind === 285 /* SourceFile */ || declaration.parent.kind === 246 /* ModuleBlock */;
}));
if (isStaticMethodSymbol || isNonLocalFunctionSymbol) {
// typeof is allowed only for static/non local functions
@@ -34414,12 +34762,12 @@
}
if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) {
var signature = resolved.callSignatures[0];
- var signatureNode = signatureToSignatureDeclarationHelper(signature, 165 /* FunctionType */, context);
+ var signatureNode = signatureToSignatureDeclarationHelper(signature, 166 /* FunctionType */, context);
return signatureNode;
}
if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) {
var signature = resolved.constructSignatures[0];
- var signatureNode = signatureToSignatureDeclarationHelper(signature, 166 /* ConstructorType */, context);
+ var signatureNode = signatureToSignatureDeclarationHelper(signature, 167 /* ConstructorType */, context);
return signatureNode;
}
}
@@ -34440,7 +34788,7 @@
}
var elementType = typeToTypeNodeHelper(typeArguments[0], context);
var arrayType = ts.createArrayTypeNode(elementType);
- return type.target === globalArrayType ? arrayType : ts.createTypeOperatorNode(133 /* ReadonlyKeyword */, arrayType);
+ return type.target === globalArrayType ? arrayType : ts.createTypeOperatorNode(134 /* ReadonlyKeyword */, arrayType);
}
else if (type.target.objectFlags & 8 /* Tuple */) {
if (typeArguments.length > 0) {
@@ -34454,12 +34802,12 @@
ts.createOptionalTypeNode(tupleConstituentNodes[i]);
}
var tupleTypeNode = ts.createTupleTypeNode(tupleConstituentNodes);
- return type.target.readonly ? ts.createTypeOperatorNode(133 /* ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode;
+ return type.target.readonly ? ts.createTypeOperatorNode(134 /* ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode;
}
}
if (context.encounteredError || (context.flags & 524288 /* AllowEmptyTuple */)) {
var tupleTypeNode = ts.createTupleTypeNode([]);
- return type.target.readonly ? ts.createTypeOperatorNode(133 /* ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode;
+ return type.target.readonly ? ts.createTypeOperatorNode(134 /* ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode;
}
context.encounteredError = true;
return undefined; // TODO: GH#18217
@@ -34554,11 +34902,11 @@
var typeElements = [];
for (var _i = 0, _a = resolvedType.callSignatures; _i < _a.length; _i++) {
var signature = _a[_i];
- typeElements.push(signatureToSignatureDeclarationHelper(signature, 160 /* CallSignature */, context));
+ typeElements.push(signatureToSignatureDeclarationHelper(signature, 161 /* CallSignature */, context));
}
for (var _b = 0, _c = resolvedType.constructSignatures; _b < _c.length; _b++) {
var signature = _c[_b];
- typeElements.push(signatureToSignatureDeclarationHelper(signature, 161 /* ConstructSignature */, context));
+ typeElements.push(signatureToSignatureDeclarationHelper(signature, 162 /* ConstructSignature */, context));
}
if (resolvedType.stringIndexInfo) {
var indexSignature = void 0;
@@ -34605,15 +34953,15 @@
if (!(context.flags & 1 /* NoTruncation */)) {
return ts.createTypeReferenceNode(ts.createIdentifier("..."), /*typeArguments*/ undefined);
}
- return ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ return ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
function addPropertyToElementList(propertySymbol, context, typeElements) {
- var propertyIsReverseMapped = !!(ts.getCheckFlags(propertySymbol) & 4096 /* ReverseMapped */);
+ var propertyIsReverseMapped = !!(ts.getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */);
var propertyType = propertyIsReverseMapped && context.flags & 33554432 /* InReverseMappedType */ ?
anyType : getTypeOfSymbol(propertySymbol);
var saveEnclosingDeclaration = context.enclosingDeclaration;
context.enclosingDeclaration = undefined;
- if (context.tracker.trackSymbol && ts.getCheckFlags(propertySymbol) & 2048 /* Late */) {
+ if (context.tracker.trackSymbol && ts.getCheckFlags(propertySymbol) & 4096 /* Late */) {
var decl = ts.first(propertySymbol.declarations);
if (hasLateBindableName(decl)) {
trackComputedName(decl.name, saveEnclosingDeclaration, context);
@@ -34627,7 +34975,7 @@
var signatures = getSignaturesOfType(propertyType, 0 /* Call */);
for (var _i = 0, signatures_1 = signatures; _i < signatures_1.length; _i++) {
var signature = signatures_1[_i];
- var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 155 /* MethodSignature */, context);
+ var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 156 /* MethodSignature */, context);
methodDeclaration.name = propertyName;
methodDeclaration.questionToken = optionalToken;
if (propertySymbol.valueDeclaration) {
@@ -34645,10 +34993,10 @@
propertyTypeNode = createElidedInformationPlaceholder(context);
}
else {
- propertyTypeNode = propertyType ? typeToTypeNodeHelper(propertyType, context) : ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ propertyTypeNode = propertyType ? typeToTypeNodeHelper(propertyType, context) : ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
context.flags = savedFlags;
- var modifiers = isReadonlySymbol(propertySymbol) ? [ts.createToken(133 /* ReadonlyKeyword */)] : undefined;
+ var modifiers = isReadonlySymbol(propertySymbol) ? [ts.createToken(134 /* ReadonlyKeyword */)] : undefined;
if (modifiers) {
context.approximateLength += 9;
}
@@ -34699,7 +35047,7 @@
}
function indexInfoToIndexSignatureDeclarationHelper(indexInfo, kind, context) {
var name = ts.getNameFromIndexInfo(indexInfo) || "x";
- var indexerTypeNode = ts.createKeywordTypeNode(kind === 0 /* String */ ? 138 /* StringKeyword */ : 135 /* NumberKeyword */);
+ var indexerTypeNode = ts.createKeywordTypeNode(kind === 0 /* String */ ? 139 /* StringKeyword */ : 136 /* NumberKeyword */);
var indexingParameter = ts.createParameter(
/*decorators*/ undefined,
/*modifiers*/ undefined,
@@ -34712,7 +35060,7 @@
}
context.approximateLength += (name.length + 4);
return ts.createIndexSignature(
- /*decorators*/ undefined, indexInfo.isReadonly ? [ts.createToken(133 /* ReadonlyKeyword */)] : undefined, [indexingParameter], typeNode);
+ /*decorators*/ undefined, indexInfo.isReadonly ? [ts.createToken(134 /* ReadonlyKeyword */)] : undefined, [indexingParameter], typeNode);
}
function signatureToSignatureDeclarationHelper(signature, kind, context) {
var typeParameters;
@@ -34723,7 +35071,7 @@
else {
typeParameters = signature.typeParameters && signature.typeParameters.map(function (parameter) { return typeParameterToDeclaration(parameter, context); });
}
- var parameters = getExpandedParameters(signature).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 157 /* Constructor */); });
+ var parameters = getExpandedParameters(signature).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 158 /* Constructor */); });
if (signature.thisParameter) {
var thisParameter = symbolToParameterDeclaration(signature.thisParameter, context);
parameters.unshift(thisParameter);
@@ -34742,12 +35090,12 @@
returnTypeNode = returnType && typeToTypeNodeHelper(returnType, context);
}
if (context.flags & 256 /* SuppressAnyReturnType */) {
- if (returnTypeNode && returnTypeNode.kind === 120 /* AnyKeyword */) {
+ if (returnTypeNode && returnTypeNode.kind === 121 /* AnyKeyword */) {
returnTypeNode = undefined;
}
}
else if (!returnTypeNode) {
- returnTypeNode = ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ returnTypeNode = ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
context.approximateLength += 3; // Usually a signature contributes a few more characters than this, but 3 is the minimum
return ts.createSignatureDeclaration(kind, typeParameters, parameters, returnTypeNode, typeArguments);
@@ -34776,9 +35124,9 @@
return typeParameterToDeclarationWithConstraint(type, context, constraintNode);
}
function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags) {
- var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 151 /* Parameter */);
+ var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 152 /* Parameter */);
if (!parameterDeclaration && !isTransientSymbol(parameterSymbol)) {
- parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 304 /* JSDocParameterTag */);
+ parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 305 /* JSDocParameterTag */);
}
var parameterType = getTypeOfSymbol(parameterSymbol);
if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) {
@@ -34786,16 +35134,16 @@
}
var parameterTypeNode = typeToTypeNodeHelper(parameterType, context);
var modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && preserveModifierFlags && parameterDeclaration && parameterDeclaration.modifiers ? parameterDeclaration.modifiers.map(ts.getSynthesizedClone) : undefined;
- var isRest = parameterDeclaration && ts.isRestParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 16384 /* RestParameter */;
+ var isRest = parameterDeclaration && ts.isRestParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 32768 /* RestParameter */;
var dotDotDotToken = isRest ? ts.createToken(25 /* DotDotDotToken */) : undefined;
var name = parameterDeclaration
? parameterDeclaration.name ?
- parameterDeclaration.name.kind === 72 /* Identifier */ ? ts.setEmitFlags(ts.getSynthesizedClone(parameterDeclaration.name), 16777216 /* NoAsciiEscaping */) :
- parameterDeclaration.name.kind === 148 /* QualifiedName */ ? ts.setEmitFlags(ts.getSynthesizedClone(parameterDeclaration.name.right), 16777216 /* NoAsciiEscaping */) :
+ parameterDeclaration.name.kind === 73 /* Identifier */ ? ts.setEmitFlags(ts.getSynthesizedClone(parameterDeclaration.name), 16777216 /* NoAsciiEscaping */) :
+ parameterDeclaration.name.kind === 149 /* QualifiedName */ ? ts.setEmitFlags(ts.getSynthesizedClone(parameterDeclaration.name.right), 16777216 /* NoAsciiEscaping */) :
cloneBindingName(parameterDeclaration.name) :
ts.symbolName(parameterSymbol)
: ts.symbolName(parameterSymbol);
- var isOptional = parameterDeclaration && isOptionalParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 8192 /* OptionalParameter */;
+ var isOptional = parameterDeclaration && isOptionalParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 16384 /* OptionalParameter */;
var questionToken = isOptional ? ts.createToken(56 /* QuestionToken */) : undefined;
var parameterNode = ts.createParameter(
/*decorators*/ undefined, modifiers, dotDotDotToken, name, questionToken, parameterTypeNode,
@@ -34810,7 +35158,7 @@
}
var visited = ts.visitEachChild(node, elideInitializerAndSetEmitFlags, ts.nullTransformationContext, /*nodesVisitor*/ undefined, elideInitializerAndSetEmitFlags);
var clone = ts.nodeIsSynthesized(visited) ? visited : ts.getSynthesizedClone(visited);
- if (clone.kind === 186 /* BindingElement */) {
+ if (clone.kind === 187 /* BindingElement */) {
clone.initializer = undefined;
}
return ts.setEmitFlags(clone, 1 /* SingleLine */ | 16777216 /* NoAsciiEscaping */);
@@ -34912,6 +35260,11 @@
function lookupTypeParameterNodes(chain, index, context) {
ts.Debug.assert(chain && 0 <= index && index < chain.length);
var symbol = chain[index];
+ var symbolId = "" + getSymbolId(symbol);
+ if (context.typeParameterSymbolList && context.typeParameterSymbolList.get(symbolId)) {
+ return undefined;
+ }
+ (context.typeParameterSymbolList || (context.typeParameterSymbolList = ts.createMap())).set(symbolId, true);
var typeParameterNodes;
if (context.flags & 512 /* WriteTypeParametersInQualifiedName */ && index < (chain.length - 1)) {
var parentSymbol = symbol;
@@ -34936,7 +35289,7 @@
return top;
}
function getSpecifierForModuleSymbol(symbol, context) {
- var file = ts.getDeclarationOfKind(symbol, 284 /* SourceFile */);
+ var file = ts.getDeclarationOfKind(symbol, 285 /* SourceFile */);
if (file && file.moduleName !== undefined) {
// Use the amd name if it is available
return file.moduleName;
@@ -35176,8 +35529,8 @@
}
function getTypeAliasForTypeLiteral(type) {
if (type.symbol && type.symbol.flags & 2048 /* TypeLiteral */) {
- var node = ts.findAncestor(type.symbol.declarations[0].parent, function (n) { return n.kind !== 177 /* ParenthesizedType */; });
- if (node.kind === 242 /* TypeAliasDeclaration */) {
+ var node = ts.findAncestor(type.symbol.declarations[0].parent, function (n) { return n.kind !== 178 /* ParenthesizedType */; });
+ if (node.kind === 243 /* TypeAliasDeclaration */) {
return getSymbolOfNode(node);
}
}
@@ -35185,11 +35538,11 @@
}
function isTopLevelInExternalModuleAugmentation(node) {
return node && node.parent &&
- node.parent.kind === 245 /* ModuleBlock */ &&
+ node.parent.kind === 246 /* ModuleBlock */ &&
ts.isExternalModuleAugmentation(node.parent.parent);
}
function isDefaultBindingContext(location) {
- return location.kind === 284 /* SourceFile */ || ts.isAmbientModule(location);
+ return location.kind === 285 /* SourceFile */ || ts.isAmbientModule(location);
}
function getNameOfSymbolFromNameType(symbol, context) {
var nameType = symbol.nameType;
@@ -35230,7 +35583,7 @@
if (ts.isCallExpression(declaration) && ts.isBindableObjectDefinePropertyCall(declaration)) {
return ts.symbolName(symbol);
}
- if (ts.isComputedPropertyName(name_2) && !(ts.getCheckFlags(symbol) & 2048 /* Late */) && symbol.nameType && symbol.nameType.flags & 384 /* StringOrNumberLiteral */) {
+ if (ts.isComputedPropertyName(name_2) && !(ts.getCheckFlags(symbol) & 4096 /* Late */) && symbol.nameType && symbol.nameType.flags & 384 /* StringOrNumberLiteral */) {
// Computed property name isn't late bound, but has a well-known name type - use name type to generate a symbol name
var result = getNameOfSymbolFromNameType(symbol, context);
if (result !== undefined) {
@@ -35239,17 +35592,17 @@
}
return ts.declarationNameToString(name_2);
}
- if (declaration.parent && declaration.parent.kind === 237 /* VariableDeclaration */) {
+ if (declaration.parent && declaration.parent.kind === 238 /* VariableDeclaration */) {
return ts.declarationNameToString(declaration.parent.name);
}
switch (declaration.kind) {
- case 209 /* ClassExpression */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 210 /* ClassExpression */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
if (context && !context.encounteredError && !(context.flags & 131072 /* AllowAnonymousIdentifier */)) {
context.encounteredError = true;
}
- return declaration.kind === 209 /* ClassExpression */ ? "(Anonymous class)" : "(Anonymous function)";
+ return declaration.kind === 210 /* ClassExpression */ ? "(Anonymous class)" : "(Anonymous function)";
}
}
var name = getNameOfSymbolFromNameType(symbol, context);
@@ -35266,27 +35619,27 @@
return false;
function determineIfDeclarationIsVisible() {
switch (node.kind) {
- case 302 /* JSDocCallbackTag */:
- case 309 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
// Top-level jsdoc type aliases are considered exported
// First parent is comment node, second is hosting declaration or token; we only care about those tokens or declarations whose parent is a source file
return !!(node.parent && node.parent.parent && node.parent.parent.parent && ts.isSourceFile(node.parent.parent.parent));
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return isDeclarationVisible(node.parent.parent);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
if (ts.isBindingPattern(node.name) &&
!node.name.elements.length) {
// If the binding pattern is empty, this variable declaration is not visible
return false;
}
// falls through
- case 244 /* ModuleDeclaration */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 239 /* FunctionDeclaration */:
- case 243 /* EnumDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
// external module augmentation is always visible
if (ts.isExternalModuleAugmentation(node)) {
return true;
@@ -35294,53 +35647,53 @@
var parent = getDeclarationContainer(node);
// If the node is not exported or it is not ambient module element (except import declaration)
if (!(ts.getCombinedModifierFlags(node) & 1 /* Export */) &&
- !(node.kind !== 248 /* ImportEqualsDeclaration */ && parent.kind !== 284 /* SourceFile */ && parent.flags & 4194304 /* Ambient */)) {
+ !(node.kind !== 249 /* ImportEqualsDeclaration */ && parent.kind !== 285 /* SourceFile */ && parent.flags & 4194304 /* Ambient */)) {
return isGlobalSourceFile(parent);
}
// Exported members/ambient module elements (exception import declaration) are visible if parent is visible
return isDeclarationVisible(parent);
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
if (ts.hasModifier(node, 8 /* Private */ | 16 /* Protected */)) {
// Private/protected properties/methods are not visible
return false;
}
// Public properties/methods are visible if its parents are visible, so:
// falls through
- case 157 /* Constructor */:
- case 161 /* ConstructSignature */:
- case 160 /* CallSignature */:
- case 162 /* IndexSignature */:
- case 151 /* Parameter */:
- case 245 /* ModuleBlock */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 168 /* TypeLiteral */:
- case 164 /* TypeReference */:
- case 169 /* ArrayType */:
- case 170 /* TupleType */:
- case 173 /* UnionType */:
- case 174 /* IntersectionType */:
- case 177 /* ParenthesizedType */:
+ case 158 /* Constructor */:
+ case 162 /* ConstructSignature */:
+ case 161 /* CallSignature */:
+ case 163 /* IndexSignature */:
+ case 152 /* Parameter */:
+ case 246 /* ModuleBlock */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 169 /* TypeLiteral */:
+ case 165 /* TypeReference */:
+ case 170 /* ArrayType */:
+ case 171 /* TupleType */:
+ case 174 /* UnionType */:
+ case 175 /* IntersectionType */:
+ case 178 /* ParenthesizedType */:
return isDeclarationVisible(node.parent);
// Default binding, import specifier and namespace import is visible
// only on demand so by default it is not visible
- case 250 /* ImportClause */:
- case 251 /* NamespaceImport */:
- case 253 /* ImportSpecifier */:
+ case 251 /* ImportClause */:
+ case 252 /* NamespaceImport */:
+ case 254 /* ImportSpecifier */:
return false;
// Type parameters are always visible
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
// Source file and namespace export are always visible
- case 284 /* SourceFile */:
- case 247 /* NamespaceExportDeclaration */:
+ case 285 /* SourceFile */:
+ case 248 /* NamespaceExportDeclaration */:
return true;
// Export assignments do not create name bindings outside the module
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return false;
default:
return false;
@@ -35349,10 +35702,10 @@
}
function collectLinkedAliases(node, setVisibility) {
var exportSymbol;
- if (node.parent && node.parent.kind === 254 /* ExportAssignment */) {
+ if (node.parent && node.parent.kind === 255 /* ExportAssignment */) {
exportSymbol = resolveName(node, node.escapedText, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */, /*nameNotFoundMessage*/ undefined, node, /*isUse*/ false);
}
- else if (node.parent.kind === 257 /* ExportSpecifier */) {
+ else if (node.parent.kind === 258 /* ExportSpecifier */) {
exportSymbol = getTargetOfExportSpecifier(node.parent, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */);
}
var result;
@@ -35448,12 +35801,12 @@
function getDeclarationContainer(node) {
return ts.findAncestor(ts.getRootDeclaration(node), function (node) {
switch (node.kind) {
- case 237 /* VariableDeclaration */:
- case 238 /* VariableDeclarationList */:
- case 253 /* ImportSpecifier */:
- case 252 /* NamedImports */:
- case 251 /* NamespaceImport */:
- case 250 /* ImportClause */:
+ case 238 /* VariableDeclaration */:
+ case 239 /* VariableDeclarationList */:
+ case 254 /* ImportSpecifier */:
+ case 253 /* NamedImports */:
+ case 252 /* NamespaceImport */:
+ case 251 /* ImportClause */:
return false;
default:
return true;
@@ -35486,7 +35839,7 @@
return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, /*includeOptionality*/ false);
}
function isComputedNonLiteralName(name) {
- return name.kind === 149 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteralLike(name.expression);
+ return name.kind === 150 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteralLike(name.expression);
}
function getRestType(source, properties, symbol) {
source = filterType(source, function (t) { return !(t.flags & 98304 /* Nullable */); });
@@ -35501,13 +35854,11 @@
if (omitKeyType.flags & 131072 /* Never */) {
return source;
}
- var pickTypeAlias = getGlobalPickSymbol();
- var excludeTypeAlias = getGlobalExcludeSymbol();
- if (!pickTypeAlias || !excludeTypeAlias) {
+ var omitTypeAlias = getGlobalOmitSymbol();
+ if (!omitTypeAlias) {
return errorType;
}
- var pickKeys = getTypeAliasInstantiation(excludeTypeAlias, [getIndexType(source), omitKeyType]);
- return getTypeAliasInstantiation(pickTypeAlias, [source, pickKeys]);
+ return getTypeAliasInstantiation(omitTypeAlias, [source, omitKeyType]);
}
var members = ts.createSymbolTable();
for (var _i = 0, _a = getPropertiesOfType(source); _i < _a.length; _i++) {
@@ -35540,7 +35891,7 @@
if (parentAccess && parentAccess.flowNode) {
var propName = getDestructuringPropertyName(node);
if (propName) {
- var result = ts.createNode(190 /* ElementAccessExpression */, node.pos, node.end);
+ var result = ts.createNode(191 /* ElementAccessExpression */, node.pos, node.end);
result.parent = node;
result.expression = parentAccess;
var literal = ts.createNode(10 /* StringLiteral */, node.pos, node.end);
@@ -35555,23 +35906,23 @@
function getParentElementAccess(node) {
var ancestor = node.parent.parent;
switch (ancestor.kind) {
- case 186 /* BindingElement */:
- case 275 /* PropertyAssignment */:
+ case 187 /* BindingElement */:
+ case 276 /* PropertyAssignment */:
return getSyntheticElementAccess(ancestor);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return getSyntheticElementAccess(node.parent);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return ancestor.initializer;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return ancestor.right;
}
}
function getDestructuringPropertyName(node) {
var parent = node.parent;
- if (node.kind === 186 /* BindingElement */ && parent.kind === 184 /* ObjectBindingPattern */) {
+ if (node.kind === 187 /* BindingElement */ && parent.kind === 185 /* ObjectBindingPattern */) {
return getLiteralPropertyNameText(node.propertyName || node.name);
}
- if (node.kind === 275 /* PropertyAssignment */ || node.kind === 276 /* ShorthandPropertyAssignment */) {
+ if (node.kind === 276 /* PropertyAssignment */ || node.kind === 277 /* ShorthandPropertyAssignment */) {
return getLiteralPropertyNameText(node.name);
}
return "" + parent.elements.indexOf(node);
@@ -35593,7 +35944,7 @@
parentType = getNonNullableType(parentType);
}
var type;
- if (pattern.kind === 184 /* ObjectBindingPattern */) {
+ if (pattern.kind === 185 /* ObjectBindingPattern */) {
if (declaration.dotDotDotToken) {
if (parentType.flags & 2 /* Unknown */ || !isValidSpreadType(parentType)) {
error(declaration, ts.Diagnostics.Rest_types_may_only_be_created_from_object_types);
@@ -35657,30 +36008,30 @@
}
function isNullOrUndefined(node) {
var expr = ts.skipParentheses(node);
- return expr.kind === 96 /* NullKeyword */ || expr.kind === 72 /* Identifier */ && getResolvedSymbol(expr) === undefinedSymbol;
+ return expr.kind === 97 /* NullKeyword */ || expr.kind === 73 /* Identifier */ && getResolvedSymbol(expr) === undefinedSymbol;
}
function isEmptyArrayLiteral(node) {
var expr = ts.skipParentheses(node);
- return expr.kind === 187 /* ArrayLiteralExpression */ && expr.elements.length === 0;
+ return expr.kind === 188 /* ArrayLiteralExpression */ && expr.elements.length === 0;
}
function addOptionality(type, optional) {
if (optional === void 0) { optional = true; }
return strictNullChecks && optional ? getOptionalType(type) : type;
}
function isParameterOfContextuallyTypedFunction(node) {
- return node.kind === 151 /* Parameter */ &&
- (node.parent.kind === 196 /* FunctionExpression */ || node.parent.kind === 197 /* ArrowFunction */) &&
+ return node.kind === 152 /* Parameter */ &&
+ (node.parent.kind === 197 /* FunctionExpression */ || node.parent.kind === 198 /* ArrowFunction */) &&
!!getContextualType(node.parent);
}
// Return the inferred type for a variable, parameter, or property declaration
function getTypeForVariableLikeDeclaration(declaration, includeOptionality) {
// A variable declared in a for..in statement is of type string, or of type keyof T when the
// right hand expression is of a type parameter type.
- if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 226 /* ForInStatement */) {
+ if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 227 /* ForInStatement */) {
var indexType = getIndexType(getNonNullableTypeIfNeeded(checkExpression(declaration.parent.parent.expression)));
return indexType.flags & (262144 /* TypeParameter */ | 4194304 /* Index */) ? getExtractStringType(indexType) : stringType;
}
- if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 227 /* ForOfStatement */) {
+ if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 228 /* ForOfStatement */) {
// checkRightHandSideOfForOf will return undefined if the for-of expression type was
// missing properties/signatures required to get its iteratedType (like
// [Symbol.iterator] or next). This may be because we accessed properties from anyType,
@@ -35699,7 +36050,7 @@
return addOptionality(declaredType, isOptional);
}
if ((noImplicitAny || ts.isInJSFile(declaration)) &&
- declaration.kind === 237 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) &&
+ declaration.kind === 238 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) &&
!(ts.getCombinedModifierFlags(declaration) & 1 /* Export */) && !(declaration.flags & 4194304 /* Ambient */)) {
// If --noImplicitAny is on or the declaration is in a Javascript file,
// use control flow tracked 'any' type for non-ambient, non-exported var or let variables with no
@@ -35713,11 +36064,11 @@
return autoArrayType;
}
}
- if (declaration.kind === 151 /* Parameter */) {
+ if (declaration.kind === 152 /* Parameter */) {
var func = declaration.parent;
// For a parameter of a set accessor, use the type of the get accessor if one is present
- if (func.kind === 159 /* SetAccessor */ && !hasNonBindableDynamicName(func)) {
- var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 158 /* GetAccessor */);
+ if (func.kind === 160 /* SetAccessor */ && !hasNonBindableDynamicName(func)) {
+ var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 159 /* GetAccessor */);
if (getter) {
var getterSignature = getSignatureFromDeclaration(getter);
var thisParameter = getAccessorThisParameter(func);
@@ -35854,7 +36205,7 @@
return type;
}
else if (declaredType !== errorType && type !== errorType && !isTypeIdenticalTo(declaredType, type)) {
- errorNextVariableOrPropertyDeclarationMustHaveSameType(declaredType, declaration, type);
+ errorNextVariableOrPropertyDeclarationMustHaveSameType(/*firstDeclaration*/ undefined, declaredType, declaration, type);
}
}
return declaredType;
@@ -35921,9 +36272,9 @@
var thisContainer = ts.getThisContainer(expression, /*includeArrowFunctions*/ false);
// Properties defined in a constructor (or base constructor, or javascript constructor function) don't get undefined added.
// Function expressions that are assigned to the prototype count as methods.
- return thisContainer.kind === 157 /* Constructor */ ||
- thisContainer.kind === 239 /* FunctionDeclaration */ ||
- (thisContainer.kind === 196 /* FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent));
+ return thisContainer.kind === 158 /* Constructor */ ||
+ thisContainer.kind === 240 /* FunctionDeclaration */ ||
+ (thisContainer.kind === 197 /* FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent));
}
function getConstructorDefinedThisAssignmentTypes(types, declarations) {
ts.Debug.assert(types.length === declarations.length);
@@ -35998,7 +36349,7 @@
function getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors) {
var elements = pattern.elements;
var lastElement = ts.lastOrUndefined(elements);
- var hasRestElement = !!(lastElement && lastElement.kind === 186 /* BindingElement */ && lastElement.dotDotDotToken);
+ var hasRestElement = !!(lastElement && lastElement.kind === 187 /* BindingElement */ && lastElement.dotDotDotToken);
if (elements.length === 0 || elements.length === 1 && hasRestElement) {
return languageVersion >= 2 /* ES2015 */ ? createIterableType(anyType) : anyArrayType;
}
@@ -36021,7 +36372,7 @@
function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) {
if (includePatternInType === void 0) { includePatternInType = false; }
if (reportErrors === void 0) { reportErrors = false; }
- return pattern.kind === 184 /* ObjectBindingPattern */
+ return pattern.kind === 185 /* ObjectBindingPattern */
? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors)
: getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors);
}
@@ -36060,7 +36411,7 @@
}
function declarationBelongsToPrivateAmbientMember(declaration) {
var root = ts.getRootDeclaration(declaration);
- var memberDeclaration = root.kind === 151 /* Parameter */ ? root.parent : root;
+ var memberDeclaration = root.kind === 152 /* Parameter */ ? root.parent : root;
return isPrivateWithinAmbient(memberDeclaration);
}
function tryGetTypeFromEffectiveTypeNode(declaration) {
@@ -36122,7 +36473,7 @@
return reportCircularityError(symbol);
}
var type;
- if (declaration.kind === 254 /* ExportAssignment */) {
+ if (declaration.kind === 255 /* ExportAssignment */) {
type = widenTypeForVariableLikeDeclaration(checkExpressionCached(declaration.expression), declaration);
}
else if (ts.isInJSFile(declaration) &&
@@ -36173,7 +36524,7 @@
type = getTypeOfEnumMember(symbol);
}
else {
- return ts.Debug.fail("Unhandled declaration kind! " + ts.Debug.showSyntaxKind(declaration) + " for " + ts.Debug.showSymbol(symbol));
+ return ts.Debug.fail("Unhandled declaration kind! " + ts.Debug.formatSyntaxKind(declaration.kind) + " for " + ts.Debug.formatSymbol(symbol));
}
if (!popTypeResolution()) {
// Symbol is property of some kind that is merged with something - should use `getTypeOfFuncClassEnumModule` and not `getTypeOfVariableOrParameterOrProperty`
@@ -36186,7 +36537,7 @@
}
function getAnnotatedAccessorTypeNode(accessor) {
if (accessor) {
- if (accessor.kind === 158 /* GetAccessor */) {
+ if (accessor.kind === 159 /* GetAccessor */) {
var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor);
return getterTypeAnnotation;
}
@@ -36213,8 +36564,8 @@
return links.type || (links.type = getTypeOfAccessorsWorker(symbol));
}
function getTypeOfAccessorsWorker(symbol) {
- var getter = ts.getDeclarationOfKind(symbol, 158 /* GetAccessor */);
- var setter = ts.getDeclarationOfKind(symbol, 159 /* SetAccessor */);
+ var getter = ts.getDeclarationOfKind(symbol, 159 /* GetAccessor */);
+ var setter = ts.getDeclarationOfKind(symbol, 160 /* SetAccessor */);
if (getter && ts.isInJSFile(getter)) {
var jsDocType = getTypeForDeclarationFromJSDocComment(getter);
if (jsDocType) {
@@ -36257,7 +36608,7 @@
if (!popTypeResolution()) {
type = anyType;
if (noImplicitAny) {
- var getter_1 = ts.getDeclarationOfKind(symbol, 158 /* GetAccessor */);
+ var getter_1 = ts.getDeclarationOfKind(symbol, 159 /* GetAccessor */);
error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
}
}
@@ -36297,8 +36648,8 @@
if (symbol.flags & 1536 /* Module */ && ts.isShorthandAmbientModuleSymbol(symbol)) {
return anyType;
}
- else if (declaration.kind === 204 /* BinaryExpression */ ||
- declaration.kind === 189 /* PropertyAccessExpression */ && declaration.parent.kind === 204 /* BinaryExpression */) {
+ else if (declaration.kind === 205 /* BinaryExpression */ ||
+ declaration.kind === 190 /* PropertyAccessExpression */ && declaration.parent.kind === 205 /* BinaryExpression */) {
return getWidenedTypeFromAssignmentDeclaration(symbol);
}
else if (symbol.flags & 512 /* ValueModule */ && declaration && ts.isSourceFile(declaration) && declaration.commonJsModuleIndicator) {
@@ -36365,7 +36716,7 @@
return errorType;
}
// Check if variable has initializer that circularly references the variable itself
- if (noImplicitAny && (declaration.kind !== 151 /* Parameter */ || declaration.initializer)) {
+ if (noImplicitAny && (declaration.kind !== 152 /* Parameter */ || declaration.initializer)) {
error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol));
}
// Circularities could also result from parameters in function expressions that end up
@@ -36373,11 +36724,23 @@
// we have already reported an implicit any error so we don't report anything here.
return anyType;
}
+ function getTypeOfSymbolWithDeferredType(symbol) {
+ var links = getSymbolLinks(symbol);
+ if (!links.type) {
+ ts.Debug.assertDefined(links.deferralParent);
+ ts.Debug.assertDefined(links.deferralConstituents);
+ links.type = links.deferralParent.flags & 1048576 /* Union */ ? getUnionType(links.deferralConstituents) : getIntersectionType(links.deferralConstituents);
+ }
+ return links.type;
+ }
function getTypeOfSymbol(symbol) {
+ if (ts.getCheckFlags(symbol) & 65536 /* DeferredType */) {
+ return getTypeOfSymbolWithDeferredType(symbol);
+ }
if (ts.getCheckFlags(symbol) & 1 /* Instantiated */) {
return getTypeOfInstantiatedSymbol(symbol);
}
- if (ts.getCheckFlags(symbol) & 4096 /* ReverseMapped */) {
+ if (ts.getCheckFlags(symbol) & 8192 /* ReverseMapped */) {
return getTypeOfReverseMappedSymbol(symbol);
}
if (symbol.flags & (3 /* Variable */ | 4 /* Property */)) {
@@ -36438,35 +36801,35 @@
return undefined;
}
switch (node.kind) {
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 155 /* MethodSignature */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 294 /* JSDocFunctionType */:
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 242 /* TypeAliasDeclaration */:
- case 308 /* JSDocTemplateTag */:
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
- case 181 /* MappedType */:
- case 175 /* ConditionalType */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 156 /* MethodSignature */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 295 /* JSDocFunctionType */:
+ case 240 /* FunctionDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 243 /* TypeAliasDeclaration */:
+ case 309 /* JSDocTemplateTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
+ case 182 /* MappedType */:
+ case 176 /* ConditionalType */:
var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes);
- if (node.kind === 181 /* MappedType */) {
+ if (node.kind === 182 /* MappedType */) {
return ts.append(outerTypeParameters, getDeclaredTypeOfTypeParameter(getSymbolOfNode(node.typeParameter)));
}
- else if (node.kind === 175 /* ConditionalType */) {
+ else if (node.kind === 176 /* ConditionalType */) {
return ts.concatenate(outerTypeParameters, getInferTypeParameters(node));
}
var outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, ts.getEffectiveTypeParameterDeclarations(node));
var thisType = includeThisTypes &&
- (node.kind === 240 /* ClassDeclaration */ || node.kind === 209 /* ClassExpression */ || node.kind === 241 /* InterfaceDeclaration */) &&
+ (node.kind === 241 /* ClassDeclaration */ || node.kind === 210 /* ClassExpression */ || node.kind === 242 /* InterfaceDeclaration */) &&
getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType;
return thisType ? ts.append(outerAndOwnTypeParameters, thisType) : outerAndOwnTypeParameters;
}
@@ -36474,7 +36837,7 @@
}
// The outer type parameters are those defined by enclosing generic classes, methods, or functions.
function getOuterTypeParametersOfClassOrInterface(symbol) {
- var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 241 /* InterfaceDeclaration */);
+ var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 242 /* InterfaceDeclaration */);
return getOuterTypeParameters(declaration);
}
// The local type parameters are the combined set of type parameters from all declarations of the class,
@@ -36483,9 +36846,9 @@
var result;
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var node = _a[_i];
- if (node.kind === 241 /* InterfaceDeclaration */ ||
- node.kind === 240 /* ClassDeclaration */ ||
- node.kind === 209 /* ClassExpression */ ||
+ if (node.kind === 242 /* InterfaceDeclaration */ ||
+ node.kind === 241 /* ClassDeclaration */ ||
+ node.kind === 210 /* ClassExpression */ ||
ts.isTypeAlias(node)) {
var declaration = node;
result = appendTypeParameters(result, ts.getEffectiveTypeParameterDeclarations(declaration));
@@ -36679,7 +37042,7 @@
type.resolvedBaseTypes = type.resolvedBaseTypes || ts.emptyArray;
for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 241 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) {
+ if (declaration.kind === 242 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) {
for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) {
var node = _c[_b];
var baseType = getTypeFromTypeNode(node);
@@ -36715,7 +37078,7 @@
function isThislessInterface(symbol) {
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 241 /* InterfaceDeclaration */) {
+ if (declaration.kind === 242 /* InterfaceDeclaration */) {
if (declaration.flags & 64 /* ContainsThis */) {
return false;
}
@@ -36772,7 +37135,7 @@
return errorType;
}
var declaration = ts.find(symbol.declarations, function (d) {
- return ts.isJSDocTypeAlias(d) || d.kind === 242 /* TypeAliasDeclaration */;
+ return ts.isJSDocTypeAlias(d) || d.kind === 243 /* TypeAliasDeclaration */;
});
var typeNode = ts.isJSDocTypeAlias(declaration) ? declaration.typeExpression : declaration.type;
// If typeNode is missing, we will error in checkJSDocTypedefTag.
@@ -36799,7 +37162,7 @@
if (expr.kind === 10 /* StringLiteral */) {
return true;
}
- else if (expr.kind === 204 /* BinaryExpression */) {
+ else if (expr.kind === 205 /* BinaryExpression */) {
return isStringConcatExpression(expr.left) && isStringConcatExpression(expr.right);
}
return false;
@@ -36813,12 +37176,12 @@
case 10 /* StringLiteral */:
case 8 /* NumericLiteral */:
return true;
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return expr.operator === 39 /* MinusToken */ &&
expr.operand.kind === 8 /* NumericLiteral */;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return ts.nodeIsMissing(expr) || !!getSymbolOfNode(member.parent).exports.get(expr.escapedText);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return isStringConcatExpression(expr);
default:
return false;
@@ -36832,7 +37195,7 @@
var hasNonLiteralMember = false;
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 243 /* EnumDeclaration */) {
+ if (declaration.kind === 244 /* EnumDeclaration */) {
for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) {
var member = _c[_b];
if (member.initializer && member.initializer.kind === 10 /* StringLiteral */) {
@@ -36859,7 +37222,7 @@
var memberTypeList = [];
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 243 /* EnumDeclaration */) {
+ if (declaration.kind === 244 /* EnumDeclaration */) {
for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) {
var member = _c[_b];
var memberType = getFreshTypeOfLiteralType(getLiteralType(getEnumMemberValue(member), enumCount, getSymbolOfNode(member))); // TODO: GH#18217
@@ -36930,23 +37293,23 @@
*/
function isThislessType(node) {
switch (node.kind) {
- case 120 /* AnyKeyword */:
- case 143 /* UnknownKeyword */:
- case 138 /* StringKeyword */:
- case 135 /* NumberKeyword */:
- case 146 /* BigIntKeyword */:
- case 123 /* BooleanKeyword */:
- case 139 /* SymbolKeyword */:
- case 136 /* ObjectKeyword */:
- case 106 /* VoidKeyword */:
- case 141 /* UndefinedKeyword */:
- case 96 /* NullKeyword */:
- case 132 /* NeverKeyword */:
- case 182 /* LiteralType */:
+ case 121 /* AnyKeyword */:
+ case 144 /* UnknownKeyword */:
+ case 139 /* StringKeyword */:
+ case 136 /* NumberKeyword */:
+ case 147 /* BigIntKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 137 /* ObjectKeyword */:
+ case 107 /* VoidKeyword */:
+ case 142 /* UndefinedKeyword */:
+ case 97 /* NullKeyword */:
+ case 133 /* NeverKeyword */:
+ case 183 /* LiteralType */:
return true;
- case 169 /* ArrayType */:
+ case 170 /* ArrayType */:
return isThislessType(node.elementType);
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return !node.typeArguments || node.typeArguments.every(isThislessType);
}
return false;
@@ -36972,7 +37335,7 @@
function isThislessFunctionLikeDeclaration(node) {
var returnType = ts.getEffectiveReturnTypeNode(node);
var typeParameters = ts.getEffectiveTypeParameterDeclarations(node);
- return (node.kind === 157 /* Constructor */ || (!!returnType && isThislessType(returnType))) &&
+ return (node.kind === 158 /* Constructor */ || (!!returnType && isThislessType(returnType))) &&
node.parameters.every(isThislessVariableLikeDeclaration) &&
typeParameters.every(isThislessTypeParameter);
}
@@ -36988,14 +37351,14 @@
var declaration = symbol.declarations[0];
if (declaration) {
switch (declaration.kind) {
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
return isThislessVariableLikeDeclaration(declaration);
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return isThislessFunctionLikeDeclaration(declaration);
}
}
@@ -37096,7 +37459,7 @@
* members.
*/
function addDeclarationToLateBoundSymbol(symbol, member, symbolFlags) {
- ts.Debug.assert(!!(ts.getCheckFlags(symbol) & 2048 /* Late */), "Expected a late-bound symbol.");
+ ts.Debug.assert(!!(ts.getCheckFlags(symbol) & 4096 /* Late */), "Expected a late-bound symbol.");
symbol.flags |= symbolFlags;
getSymbolLinks(member.symbol).lateSymbol = symbol;
if (!symbol.declarations) {
@@ -37153,7 +37516,7 @@
// Get or add a late-bound symbol for the member. This allows us to merge late-bound accessor declarations.
var lateSymbol = lateSymbols.get(memberName);
if (!lateSymbol)
- lateSymbols.set(memberName, lateSymbol = createSymbol(0 /* None */, memberName, 2048 /* Late */));
+ lateSymbols.set(memberName, lateSymbol = createSymbol(0 /* None */, memberName, 4096 /* Late */));
// Report an error if a late-bound member has the same name as an early-bound member,
// or if we have another early-bound symbol declaration with the same name and
// conflicting flags.
@@ -37165,7 +37528,7 @@
var name_3 = !(type.flags & 8192 /* UniqueESSymbol */) && ts.unescapeLeadingUnderscores(memberName) || ts.declarationNameToString(decl.name);
ts.forEach(declarations, function (declaration) { return error(ts.getNameOfDeclaration(declaration) || declaration, ts.Diagnostics.Property_0_was_also_declared_here, name_3); });
error(decl.name || decl, ts.Diagnostics.Duplicate_property_0, name_3);
- lateSymbol = createSymbol(0 /* None */, memberName, 2048 /* Late */);
+ lateSymbol = createSymbol(0 /* None */, memberName, 4096 /* Late */);
}
lateSymbol.nameType = type;
addDeclarationToLateBoundSymbol(lateSymbol, decl, symbolFlags);
@@ -37230,11 +37593,12 @@
var links = getSymbolLinks(symbol);
if (!links.lateSymbol && ts.some(symbol.declarations, hasLateBindableName)) {
// force late binding of members/exports. This will set the late-bound symbol
+ var parent = getMergedSymbol(symbol.parent);
if (ts.some(symbol.declarations, ts.hasStaticModifier)) {
- getExportsOfSymbol(symbol.parent);
+ getExportsOfSymbol(parent);
}
else {
- getMembersOfSymbol(symbol.parent);
+ getMembersOfSymbol(parent);
}
}
return links.lateSymbol || (links.lateSymbol = symbol);
@@ -37351,8 +37715,8 @@
var tupleRestIndex_1 = restType.target.hasRestElement ? elementTypes.length - 1 : -1;
var restParams = ts.map(elementTypes, function (t, i) {
var name = getParameterNameAtPosition(sig, restIndex_1 + i);
- var checkFlags = i === tupleRestIndex_1 ? 16384 /* RestParameter */ :
- i >= minLength_1 ? 8192 /* OptionalParameter */ : 0;
+ var checkFlags = i === tupleRestIndex_1 ? 32768 /* RestParameter */ :
+ i >= minLength_1 ? 16384 /* OptionalParameter */ : 0;
var symbol = createSymbol(1 /* FunctionScopedVariable */, name, checkFlags);
symbol.type = i === tupleRestIndex_1 ? createArrayType(t) : t;
return symbol;
@@ -37442,10 +37806,10 @@
// Union the result types when more than one signature matches
if (unionSignatures.length > 1) {
var thisParameter = signature.thisParameter;
- if (ts.forEach(unionSignatures, function (sig) { return sig.thisParameter; })) {
- // TODO: GH#18217 We tested that *some* has thisParameter and now act as if *all* do
+ var firstThisParameterOfUnionSignatures = ts.forEach(unionSignatures, function (sig) { return sig.thisParameter; });
+ if (firstThisParameterOfUnionSignatures) {
var thisType = getUnionType(ts.map(unionSignatures, function (sig) { return sig.thisParameter ? getTypeOfSymbol(sig.thisParameter) : anyType; }), 2 /* Subtype */);
- thisParameter = createSymbolWithType(signature.thisParameter, thisType);
+ thisParameter = createSymbolWithType(firstThisParameterOfUnionSignatures, thisType);
}
s = createUnionSignature(signature, unionSignatures);
s.thisParameter = thisParameter;
@@ -37702,7 +38066,7 @@
var members = ts.createSymbolTable();
for (var _i = 0, _a = getPropertiesOfType(type.source); _i < _a.length; _i++) {
var prop = _a[_i];
- var checkFlags = 4096 /* ReverseMapped */ | (readonlyMask && isReadonlySymbol(prop) ? 8 /* Readonly */ : 0);
+ var checkFlags = 8192 /* ReverseMapped */ | (readonlyMask && isReadonlySymbol(prop) ? 8 /* Readonly */ : 0);
var inferredProp = createSymbol(4 /* Property */ | prop.flags & optionalMask, prop.escapedName, checkFlags);
inferredProp.declarations = prop.declarations;
inferredProp.nameType = prop.nameType;
@@ -37724,7 +38088,15 @@
return getIndexType(getApparentType(type.type));
}
if (type.flags & 16777216 /* Conditional */) {
- return getLowerBoundOfConditionalType(type);
+ if (type.root.isDistributive) {
+ var checkType = type.checkType;
+ var constraint = getLowerBoundOfKeyType(checkType);
+ if (constraint !== checkType) {
+ var mapper = makeUnaryTypeMapper(type.root.checkType, constraint);
+ return getConditionalTypeInstantiation(type, combineTypeMappers(mapper, type.mapper));
+ }
+ }
+ return type;
}
if (type.flags & 1048576 /* Union */) {
return getUnionType(ts.sameMap(type.types, getLowerBoundOfKeyType));
@@ -37734,16 +38106,6 @@
}
return neverType;
}
- function getLowerBoundOfConditionalType(type) {
- if (type.root.isDistributive) {
- var constraint = getLowerBoundOfKeyType(type.checkType);
- if (constraint !== type.checkType) {
- var mapper = makeUnaryTypeMapper(type.root.checkType, constraint);
- return getConditionalTypeInstantiation(type, combineTypeMappers(mapper, type.mapper));
- }
- }
- return type;
- }
/** Resolve the members of a mapped type { [P in K]: T } */
function resolveMappedTypeMembers(type) {
var members = ts.createSymbolTable();
@@ -37832,8 +38194,8 @@
}
function isMappedTypeWithKeyofConstraintDeclaration(type) {
var constraintDeclaration = getConstraintDeclarationForMappedType(type); // TODO: GH#18217
- return constraintDeclaration.kind === 179 /* TypeOperator */ &&
- constraintDeclaration.operator === 129 /* KeyOfKeyword */;
+ return constraintDeclaration.kind === 180 /* TypeOperator */ &&
+ constraintDeclaration.operator === 130 /* KeyOfKeyword */;
}
function getModifiersTypeFromMappedType(type) {
if (!type.modifiersType) {
@@ -37850,7 +38212,7 @@
var declaredType = getTypeFromMappedTypeNode(type.declaration);
var constraint = getConstraintTypeFromMappedType(declaredType);
var extendedConstraint = constraint && constraint.flags & 262144 /* TypeParameter */ ? getConstraintOfTypeParameter(constraint) : constraint;
- type.modifiersType = extendedConstraint && extendedConstraint.flags & 4194304 /* Index */ ? instantiateType(extendedConstraint.type, type.mapper || identityMapper) : emptyObjectType;
+ type.modifiersType = extendedConstraint && extendedConstraint.flags & 4194304 /* Index */ ? instantiateType(extendedConstraint.type, type.mapper || identityMapper) : unknownType;
}
}
return type.modifiersType;
@@ -37946,6 +38308,26 @@
}
return type.resolvedProperties;
}
+ function getPossiblePropertiesOfUnionType(type) {
+ if (type.possiblePropertyCache) {
+ return type.possiblePropertyCache.size ? ts.arrayFrom(type.possiblePropertyCache.values()) : ts.emptyArray;
+ }
+ type.possiblePropertyCache = ts.createSymbolTable();
+ for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
+ var t = _a[_i];
+ for (var _b = 0, _c = getPropertiesOfType(t); _b < _c.length; _b++) {
+ var p = _c[_b];
+ if (!type.possiblePropertyCache.has(p.escapedName)) {
+ var prop = getUnionOrIntersectionProperty(type, p.escapedName);
+ if (prop) {
+ type.possiblePropertyCache.set(p.escapedName, prop);
+ }
+ }
+ }
+ }
+ // We can't simply use the normal property cache here, since that will contain cached apparent type members :(
+ return type.possiblePropertyCache.size ? ts.arrayFrom(type.possiblePropertyCache.values()) : ts.emptyArray;
+ }
function getPropertiesOfType(type) {
type = getApparentType(type);
return type.flags & 3145728 /* UnionOrIntersection */ ?
@@ -37993,16 +38375,23 @@
function getConstraintOfIndexedAccess(type) {
return hasNonCircularBaseConstraint(type) ? getConstraintFromIndexedAccess(type) : undefined;
}
+ function getSimplifiedTypeOrConstraint(type) {
+ var simplified = getSimplifiedType(type, /*writing*/ false);
+ return simplified !== type ? simplified : getConstraintOfType(type);
+ }
function getConstraintFromIndexedAccess(type) {
- var objectType = getConstraintOfType(type.objectType) || type.objectType;
- if (objectType !== type.objectType) {
- var constraint = getIndexedAccessType(objectType, type.indexType, /*accessNode*/ undefined, errorType);
- if (constraint && constraint !== errorType) {
- return constraint;
+ var indexConstraint = getSimplifiedTypeOrConstraint(type.indexType);
+ if (indexConstraint && indexConstraint !== type.indexType) {
+ var indexedAccess = getIndexedAccessTypeOrUndefined(type.objectType, indexConstraint);
+ if (indexedAccess) {
+ return indexedAccess;
+ }
}
+ var objectConstraint = getSimplifiedTypeOrConstraint(type.objectType);
+ if (objectConstraint && objectConstraint !== type.objectType) {
+ return getIndexedAccessTypeOrUndefined(objectConstraint, type.indexType);
}
- var baseConstraint = getBaseConstraintOfType(type);
- return baseConstraint && baseConstraint !== type ? baseConstraint : undefined;
+ return undefined;
}
function getDefaultConstraintOfConditionalType(type) {
if (!type.resolvedDefaultConstraint) {
@@ -38011,7 +38400,7 @@
// just `any`. This result is _usually_ unwanted - so instead here we elide an `any` branch from the constraint type,
// in effect treating `any` like `never` rather than `unknown` in this location.
var trueConstraint = getInferredTrueTypeFromConditionalType(type);
- var falseConstraint = type.falseType;
+ var falseConstraint = getFalseTypeFromConditionalType(type);
type.resolvedDefaultConstraint = isTypeAny(trueConstraint) ? falseConstraint : isTypeAny(falseConstraint) ? trueConstraint : getUnionType([trueConstraint, falseConstraint]);
}
return type.resolvedDefaultConstraint;
@@ -38029,7 +38418,7 @@
// a union - once negated types exist and are applied to the conditional false branch, this "constraint"
// likely doesn't need to exist.
if (type.root.isDistributive && type.restrictiveInstantiation !== type) {
- var simplified = getSimplifiedType(type.checkType);
+ var simplified = getSimplifiedType(type.checkType, /*writing*/ false);
var constraint = simplified === type.checkType ? getConstraintOfType(simplified) : simplified;
if (constraint && constraint !== type.checkType) {
var mapper = makeUnaryTypeMapper(type.root.checkType, constraint);
@@ -38060,11 +38449,6 @@
constraint = getConstraintOfType(constraint);
}
if (constraint) {
- // A constraint that isn't a union type implies that the final type would be a non-union
- // type as well. Since non-union constraints are of no interest, we can exit here.
- if (!(constraint.flags & 1048576 /* Union */)) {
- return undefined;
- }
constraints = ts.append(constraints, constraint);
}
}
@@ -38073,10 +38457,10 @@
}
}
// If the target is a union type or if we are intersecting with types belonging to one of the
- // disjoint domans, we may end up producing a constraint that hasn't been examined before.
+ // disjoint domains, we may end up producing a constraint that hasn't been examined before.
if (constraints && (targetIsUnion || hasDisjointDomainType)) {
if (hasDisjointDomainType) {
- // We add any types belong to one of the disjoint domans because they might cause the final
+ // We add any types belong to one of the disjoint domains because they might cause the final
// intersection operation to reduce the union constraints.
for (var _b = 0, _c = type.types; _b < _c.length; _b++) {
var t = _c[_b];
@@ -38122,7 +38506,7 @@
}
if (constraintDepth >= 50) {
// We have reached 50 recursive invocations of getImmediateBaseConstraint and there is a
- // very high likelyhood we're dealing with an infinite generic type that perpetually generates
+ // very high likelihood we're dealing with an infinite generic type that perpetually generates
// new type identities as we descend into it. We stop the recursion here and mark this type
// and the outer types as having circular constraints.
error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
@@ -38130,7 +38514,7 @@
return t.immediateBaseConstraint = noConstraintType;
}
constraintDepth++;
- var result = computeBaseConstraint(getSimplifiedType(t));
+ var result = computeBaseConstraint(getSimplifiedType(t, /*writing*/ false));
constraintDepth--;
if (!popTypeResolution()) {
if (t.flags & 262144 /* TypeParameter */) {
@@ -38182,8 +38566,8 @@
if (t.flags & 8388608 /* IndexedAccess */) {
var baseObjectType = getBaseConstraint(t.objectType);
var baseIndexType = getBaseConstraint(t.indexType);
- var baseIndexedAccess = baseObjectType && baseIndexType ? getIndexedAccessType(baseObjectType, baseIndexType, /*accessNode*/ undefined, errorType) : undefined;
- return baseIndexedAccess && baseIndexedAccess !== errorType ? getBaseConstraint(baseIndexedAccess) : undefined;
+ var baseIndexedAccess = baseObjectType && baseIndexType && getIndexedAccessTypeOrUndefined(baseObjectType, baseIndexType);
+ return baseIndexedAccess && getBaseConstraint(baseIndexedAccess);
}
if (t.flags & 16777216 /* Conditional */) {
var constraint = getConstraintFromConditionalType(t);
@@ -38264,16 +38648,17 @@
* type itself. Note that the apparent type of a union type is the union type itself.
*/
function getApparentType(type) {
- var t = type.flags & 63176704 /* Instantiable */ ? getBaseConstraintOfType(type) || emptyObjectType : type;
+ var t = type.flags & 63176704 /* Instantiable */ ? getBaseConstraintOfType(type) || unknownType : type;
return ts.getObjectFlags(t) & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) :
t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t) :
t.flags & 132 /* StringLike */ ? globalStringType :
t.flags & 296 /* NumberLike */ ? globalNumberType :
- t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType(/*reportErrors*/ languageVersion >= 7 /* ESNext */) :
+ t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType(/*reportErrors*/ languageVersion >= 8 /* ESNext */) :
t.flags & 528 /* BooleanLike */ ? globalBooleanType :
t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType(/*reportErrors*/ languageVersion >= 2 /* ES2015 */) :
t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType :
t.flags & 4194304 /* Index */ ? keyofConstraintType :
+ t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType :
t;
}
function createUnionOrIntersectionProperty(containingType, name) {
@@ -38282,7 +38667,7 @@
var isUnion = containingType.flags & 1048576 /* Union */;
var excludeModifiers = isUnion ? 24 /* NonPublicAccessibilityModifier */ : 0;
// Flags we want to propagate to the result if they exist in all source symbols
- var commonFlags = isUnion ? 0 /* None */ : 16777216 /* Optional */;
+ var optionalFlag = isUnion ? 0 /* None */ : 16777216 /* Optional */;
var syntheticFlag = 4 /* SyntheticMethod */;
var checkFlags = 0;
for (var _i = 0, _a = containingType.types; _i < _a.length; _i++) {
@@ -38292,16 +38677,21 @@
var prop = getPropertyOfType(type, name);
var modifiers = prop ? ts.getDeclarationModifierFlagsFromSymbol(prop) : 0;
if (prop && !(modifiers & excludeModifiers)) {
- commonFlags &= prop.flags;
+ if (isUnion) {
+ optionalFlag |= (prop.flags & 16777216 /* Optional */);
+ }
+ else {
+ optionalFlag &= prop.flags;
+ }
var id = "" + getSymbolId(prop);
if (!propSet.has(id)) {
propSet.set(id, prop);
}
checkFlags |= (isReadonlySymbol(prop) ? 8 /* Readonly */ : 0) |
- (!(modifiers & 24 /* NonPublicAccessibilityModifier */) ? 128 /* ContainsPublic */ : 0) |
- (modifiers & 16 /* Protected */ ? 256 /* ContainsProtected */ : 0) |
- (modifiers & 8 /* Private */ ? 512 /* ContainsPrivate */ : 0) |
- (modifiers & 32 /* Static */ ? 1024 /* ContainsStatic */ : 0);
+ (!(modifiers & 24 /* NonPublicAccessibilityModifier */) ? 256 /* ContainsPublic */ : 0) |
+ (modifiers & 16 /* Protected */ ? 512 /* ContainsProtected */ : 0) |
+ (modifiers & 8 /* Private */ ? 1024 /* ContainsPrivate */ : 0) |
+ (modifiers & 32 /* Static */ ? 2048 /* ContainsStatic */ : 0);
if (!isPrototypeProperty(prop)) {
syntheticFlag = 2 /* SyntheticProperty */;
}
@@ -38310,10 +38700,11 @@
var indexInfo = !isLateBoundName(name) && (isNumericLiteralName(name) && getIndexInfoOfType(type, 1 /* Number */) || getIndexInfoOfType(type, 0 /* String */));
if (indexInfo) {
checkFlags |= indexInfo.isReadonly ? 8 /* Readonly */ : 0;
+ checkFlags |= 32 /* WritePartial */;
indexTypes = ts.append(indexTypes, isTupleType(type) ? getRestTypeOfTupleType(type) || undefinedType : indexInfo.type);
}
else {
- checkFlags |= 16 /* Partial */;
+ checkFlags |= 16 /* ReadPartial */;
}
}
}
@@ -38322,7 +38713,7 @@
return undefined;
}
var props = ts.arrayFrom(propSet.values());
- if (props.length === 1 && !(checkFlags & 16 /* Partial */) && !indexTypes) {
+ if (props.length === 1 && !(checkFlags & 16 /* ReadPartial */) && !indexTypes) {
return props[0];
}
var declarations;
@@ -38346,15 +38737,15 @@
nameType = prop.nameType;
}
else if (type !== firstType) {
- checkFlags |= 32 /* HasNonUniformType */;
+ checkFlags |= 64 /* HasNonUniformType */;
}
if (isLiteralType(type)) {
- checkFlags |= 64 /* HasLiteralType */;
+ checkFlags |= 128 /* HasLiteralType */;
}
propTypes.push(type);
}
ts.addRange(propTypes, indexTypes);
- var result = createSymbol(4 /* Property */ | commonFlags, name, syntheticFlag | checkFlags);
+ var result = createSymbol(4 /* Property */ | optionalFlag, name, syntheticFlag | checkFlags);
result.containingType = containingType;
if (!hasNonUniformValueDeclaration && firstValueDeclaration) {
result.valueDeclaration = firstValueDeclaration;
@@ -38365,7 +38756,15 @@
}
result.declarations = declarations;
result.nameType = nameType;
+ if (propTypes.length > 2) {
+ // When `propTypes` has the potential to explode in size when normalized, defer normalization until absolutely needed
+ result.checkFlags |= 65536 /* DeferredType */;
+ result.deferralParent = containingType;
+ result.deferralConstituents = propTypes;
+ }
+ else {
result.type = isUnion ? getUnionType(propTypes) : getIntersectionType(propTypes);
+ }
return result;
}
// Return the symbol for a given property in a union or intersection type, or undefined if the property
@@ -38387,7 +38786,7 @@
function getPropertyOfUnionOrIntersectionType(type, name) {
var property = getUnionOrIntersectionProperty(type, name);
// We need to filter out partial properties in union types
- return property && !(ts.getCheckFlags(property) & 16 /* Partial */) ? property : undefined;
+ return property && !(ts.getCheckFlags(property) & 16 /* ReadPartial */) ? property : undefined;
}
/**
* Return the symbol for the property with the given name in the given type. Creates synthetic union properties when
@@ -38493,10 +38892,10 @@
function isJSDocOptionalParameter(node) {
return ts.isInJSFile(node) && (
// node.type should only be a JSDocOptionalType when node is a parameter of a JSDocFunctionType
- node.type && node.type.kind === 293 /* JSDocOptionalType */
+ node.type && node.type.kind === 294 /* JSDocOptionalType */
|| ts.getJSDocParameterTags(node).some(function (_a) {
var isBracketed = _a.isBracketed, typeExpression = _a.typeExpression;
- return isBracketed || !!typeExpression && typeExpression.type.kind === 293 /* JSDocOptionalType */;
+ return isBracketed || !!typeExpression && typeExpression.type.kind === 294 /* JSDocOptionalType */;
}));
}
function tryFindAmbientModule(moduleName, withAugmentations) {
@@ -38530,7 +38929,7 @@
return false;
}
var isBracketed = node.isBracketed, typeExpression = node.typeExpression;
- return isBracketed || !!typeExpression && typeExpression.type.kind === 293 /* JSDocOptionalType */;
+ return isBracketed || !!typeExpression && typeExpression.type.kind === 294 /* JSDocOptionalType */;
}
function createIdentifierTypePredicate(parameterName, parameterIndex, type) {
return { kind: 1 /* Identifier */, parameterName: parameterName, parameterIndex: parameterIndex, type: type };
@@ -38568,7 +38967,7 @@
var baseDefaultType = getDefaultTypeArgumentType(isJavaScriptImplicitAny);
for (var i = numTypeArguments; i < numTypeParameters; i++) {
var defaultType = getDefaultFromTypeParameter(typeParameters[i]);
- if (isJavaScriptImplicitAny && defaultType && isTypeIdenticalTo(defaultType, emptyObjectType)) {
+ if (isJavaScriptImplicitAny && defaultType && (isTypeIdenticalTo(defaultType, unknownType) || isTypeIdenticalTo(defaultType, emptyObjectType))) {
defaultType = anyType;
}
result[i] = defaultType ? instantiateType(defaultType, createTypeMapper(typeParameters, result)) : baseDefaultType;
@@ -38612,7 +39011,7 @@
else {
parameters.push(paramSymbol);
}
- if (type && type.kind === 182 /* LiteralType */) {
+ if (type && type.kind === 183 /* LiteralType */) {
hasLiteralTypes = true;
}
// Record a new minimum argument count if this is not an optional parameter
@@ -38626,16 +39025,16 @@
}
}
// If only one accessor includes a this-type annotation, the other behaves as if it had the same type annotation
- if ((declaration.kind === 158 /* GetAccessor */ || declaration.kind === 159 /* SetAccessor */) &&
+ if ((declaration.kind === 159 /* GetAccessor */ || declaration.kind === 160 /* SetAccessor */) &&
!hasNonBindableDynamicName(declaration) &&
(!hasThisParameter || !thisParameter)) {
- var otherKind = declaration.kind === 158 /* GetAccessor */ ? 159 /* SetAccessor */ : 158 /* GetAccessor */;
+ var otherKind = declaration.kind === 159 /* GetAccessor */ ? 160 /* SetAccessor */ : 159 /* GetAccessor */;
var other = ts.getDeclarationOfKind(getSymbolOfNode(declaration), otherKind);
if (other) {
thisParameter = getAnnotatedAccessorThisParameter(other);
}
}
- var classType = declaration.kind === 157 /* Constructor */ ?
+ var classType = declaration.kind === 158 /* Constructor */ ?
getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol))
: undefined;
var typeParameters = classType ? classType.localTypeParameters : getTypeParametersFromDeclaration(declaration);
@@ -38660,7 +39059,7 @@
var lastParamVariadicType = ts.firstDefined(lastParamTags, function (p) {
return p.typeExpression && ts.isJSDocVariadicType(p.typeExpression.type) ? p.typeExpression.type : undefined;
});
- var syntheticArgsSymbol = createSymbol(3 /* Variable */, "args", 16384 /* RestParameter */);
+ var syntheticArgsSymbol = createSymbol(3 /* Variable */, "args", 32768 /* RestParameter */);
syntheticArgsSymbol.type = lastParamVariadicType ? createArrayType(getTypeFromTypeNode(lastParamVariadicType.type)) : anyArrayType;
if (lastParamVariadicType) {
// Replace the last parameter with a rest parameter.
@@ -38693,13 +39092,13 @@
if (!node)
return false;
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return node.escapedText === "arguments" && ts.isExpressionNode(node);
- case 154 /* PropertyDeclaration */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- return node.name.kind === 149 /* ComputedPropertyName */
+ case 155 /* PropertyDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ return node.name.kind === 150 /* ComputedPropertyName */
&& traverse(node.name);
default:
return !ts.nodeStartsNewLexicalEnvironment(node) && !ts.isPartOfTypeNode(node) && !!ts.forEachChild(node, traverse);
@@ -38774,7 +39173,7 @@
function createTypePredicateFromTypePredicateNode(node, signature) {
var parameterName = node.parameterName;
var type = getTypeFromTypeNode(node.type);
- if (parameterName.kind === 72 /* Identifier */) {
+ if (parameterName.kind === 73 /* Identifier */) {
return createIdentifierTypePredicate(parameterName.escapedText, ts.findIndex(signature.parameters, function (p) { return p.escapedName === parameterName.escapedText; }), type);
}
else {
@@ -38815,7 +39214,7 @@
return signature.resolvedReturnType;
}
function getReturnTypeFromAnnotation(declaration) {
- if (declaration.kind === 157 /* Constructor */) {
+ if (declaration.kind === 158 /* Constructor */) {
return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol));
}
if (ts.isJSDocConstructSignature(declaration)) {
@@ -38825,12 +39224,12 @@
if (typeNode) {
return getTypeFromTypeNode(typeNode);
}
- if (declaration.kind === 158 /* GetAccessor */ && !hasNonBindableDynamicName(declaration)) {
+ if (declaration.kind === 159 /* GetAccessor */ && !hasNonBindableDynamicName(declaration)) {
var jsDocType = ts.isInJSFile(declaration) && getTypeForDeclarationFromJSDocComment(declaration);
if (jsDocType) {
return jsDocType;
}
- var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 159 /* SetAccessor */);
+ var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 160 /* SetAccessor */);
var setterType = getAnnotatedAccessorType(setter);
if (setterType) {
return setterType;
@@ -38855,7 +39254,7 @@
function getSignatureInstantiation(signature, typeArguments, isJavascript, inferredTypeParameters) {
var instantiatedSignature = getSignatureInstantiationWithoutFillingInTypeArguments(signature, fillMissingTypeArguments(typeArguments, signature.typeParameters, getMinTypeArgumentCount(signature.typeParameters), isJavascript));
if (inferredTypeParameters) {
- var returnSignature = getSingleCallSignature(getReturnTypeOfSignature(instantiatedSignature));
+ var returnSignature = getSingleCallOrConstructSignature(getReturnTypeOfSignature(instantiatedSignature));
if (returnSignature) {
var newReturnSignature = cloneSignature(returnSignature);
newReturnSignature.typeParameters = inferredTypeParameters;
@@ -38908,7 +39307,7 @@
var typeParameters = signature.typeParameters;
if (typeParameters) {
var typeEraser_1 = createTypeEraser(typeParameters);
- var baseConstraints = ts.map(typeParameters, function (tp) { return instantiateType(getBaseConstraintOfType(tp), typeEraser_1) || emptyObjectType; });
+ var baseConstraints = ts.map(typeParameters, function (tp) { return instantiateType(getBaseConstraintOfType(tp), typeEraser_1) || unknownType; });
return instantiateSignature(signature, createTypeMapper(typeParameters, baseConstraints), /*eraseTypeParameters*/ true);
}
return signature;
@@ -38919,7 +39318,8 @@
// object type literal or interface (using the new keyword). Each way of declaring a constructor
// will result in a different declaration kind.
if (!signature.isolatedSignatureType) {
- var isConstructor = signature.declaration.kind === 157 /* Constructor */ || signature.declaration.kind === 161 /* ConstructSignature */; // TODO: GH#18217
+ var kind = signature.declaration ? signature.declaration.kind : 0 /* Unknown */;
+ var isConstructor = kind === 158 /* Constructor */ || kind === 162 /* ConstructSignature */ || kind === 167 /* ConstructorType */;
var type = createObjectType(16 /* Anonymous */);
type.members = emptySymbols;
type.properties = ts.emptyArray;
@@ -38933,7 +39333,7 @@
return symbol.members.get("__index" /* Index */);
}
function getIndexDeclarationOfSymbol(symbol, kind) {
- var syntaxKind = kind === 1 /* Number */ ? 135 /* NumberKeyword */ : 138 /* StringKeyword */;
+ var syntaxKind = kind === 1 /* Number */ ? 136 /* NumberKeyword */ : 139 /* StringKeyword */;
var indexSymbol = getIndexSymbol(symbol);
if (indexSymbol) {
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
@@ -38960,7 +39360,7 @@
return undefined;
}
function getConstraintDeclaration(type) {
- var decl = type.symbol && ts.getDeclarationOfKind(type.symbol, 150 /* TypeParameter */);
+ var decl = type.symbol && ts.getDeclarationOfKind(type.symbol, 151 /* TypeParameter */);
return decl && ts.getEffectiveConstraintOfTypeParameter(decl);
}
function getInferredTypeParameterConstraint(typeParameter) {
@@ -38968,13 +39368,13 @@
if (typeParameter.symbol) {
for (var _i = 0, _a = typeParameter.symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.parent.kind === 176 /* InferType */) {
+ if (declaration.parent.kind === 177 /* InferType */) {
// When an 'infer T' declaration is immediately contained in a type reference node
// (such as 'Foo<infer T>'), T's constraint is inferred from the constraint of the
// corresponding type parameter in 'Foo'. When multiple 'infer T' declarations are
// present, we form an intersection of the inferred constraint types.
var grandParent = declaration.parent.parent;
- if (grandParent.kind === 164 /* TypeReference */) {
+ if (grandParent.kind === 165 /* TypeReference */) {
var typeReference = grandParent;
var typeParameters = getTypeParametersForTypeReference(typeReference);
if (typeParameters) {
@@ -38999,7 +39399,7 @@
}
// When an 'infer T' declaration is immediately contained in a rest parameter
// declaration, we infer an 'unknown[]' constraint.
- else if (grandParent.kind === 151 /* Parameter */ && grandParent.dotDotDotToken) {
+ else if (grandParent.kind === 152 /* Parameter */ && grandParent.dotDotDotToken) {
inferences = ts.append(inferences, createArrayType(unknownType));
}
}
@@ -39023,7 +39423,7 @@
return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint;
}
function getParentSymbolOfTypeParameter(typeParameter) {
- var tp = ts.getDeclarationOfKind(typeParameter.symbol, 150 /* TypeParameter */);
+ var tp = ts.getDeclarationOfKind(typeParameter.symbol, 151 /* TypeParameter */);
var host = ts.isJSDocTemplateTag(tp.parent) ? ts.getHostSignatureFromJSDoc(tp.parent) : tp.parent;
return host && getSymbolOfNode(host);
}
@@ -39156,9 +39556,9 @@
}
function getTypeReferenceName(node) {
switch (node.kind) {
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return node.typeName;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
// We only support expressions that are simple qualified names. For other
// expressions this produces undefined.
var expr = node.expression;
@@ -39257,16 +39657,22 @@
}
}
function getSubstitutionType(typeVariable, substitute) {
- if (substitute.flags & 3 /* AnyOrUnknown */) {
+ if (substitute.flags & 3 /* AnyOrUnknown */ || substitute === typeVariable) {
return typeVariable;
}
+ var id = getTypeId(typeVariable) + ">" + getTypeId(substitute);
+ var cached = substitutionTypes.get(id);
+ if (cached) {
+ return cached;
+ }
var result = createType(33554432 /* Substitution */);
result.typeVariable = typeVariable;
result.substitute = substitute;
+ substitutionTypes.set(id, result);
return result;
}
function isUnaryTupleTypeNode(node) {
- return node.kind === 170 /* TupleType */ && node.elementTypes.length === 1;
+ return node.kind === 171 /* TupleType */ && node.elementTypes.length === 1;
}
function getImpliedConstraint(typeVariable, checkNode, extendsNode) {
return isUnaryTupleTypeNode(checkNode) && isUnaryTupleTypeNode(extendsNode) ? getImpliedConstraint(typeVariable, checkNode.elementTypes[0], extendsNode.elementTypes[0]) :
@@ -39275,9 +39681,9 @@
}
function getConstrainedTypeVariable(typeVariable, node) {
var constraints;
- while (node && !ts.isStatement(node) && node.kind !== 296 /* JSDocComment */) {
+ while (node && !ts.isStatement(node) && node.kind !== 297 /* JSDocComment */) {
var parent = node.parent;
- if (parent.kind === 175 /* ConditionalType */ && node === parent.trueType) {
+ if (parent.kind === 176 /* ConditionalType */ && node === parent.trueType) {
var constraint = getImpliedConstraint(typeVariable, parent.checkType, parent.extendsType);
if (constraint) {
constraints = ts.append(constraints, constraint);
@@ -39288,7 +39694,7 @@
return constraints ? getSubstitutionType(typeVariable, getIntersectionType(ts.append(constraints, typeVariable))) : typeVariable;
}
function isJSDocTypeReference(node) {
- return !!(node.flags & 2097152 /* JSDoc */) && (node.kind === 164 /* TypeReference */ || node.kind === 183 /* ImportType */);
+ return !!(node.flags & 2097152 /* JSDoc */) && (node.kind === 165 /* TypeReference */ || node.kind === 184 /* ImportType */);
}
function checkNoTypeArguments(node, symbol) {
if (node.typeArguments) {
@@ -39389,9 +39795,9 @@
for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) {
var declaration = declarations_3[_i];
switch (declaration.kind) {
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
return declaration;
}
}
@@ -39477,11 +39883,8 @@
function getGlobalExtractSymbol() {
return deferredGlobalExtractSymbol || (deferredGlobalExtractSymbol = getGlobalSymbol("Extract", 524288 /* TypeAlias */, ts.Diagnostics.Cannot_find_global_type_0)); // TODO: GH#18217
}
- function getGlobalExcludeSymbol() {
- return deferredGlobalExcludeSymbol || (deferredGlobalExcludeSymbol = getGlobalSymbol("Exclude", 524288 /* TypeAlias */, ts.Diagnostics.Cannot_find_global_type_0)); // TODO: GH#18217
- }
- function getGlobalPickSymbol() {
- return deferredGlobalPickSymbol || (deferredGlobalPickSymbol = getGlobalSymbol("Pick", 524288 /* TypeAlias */, ts.Diagnostics.Cannot_find_global_type_0)); // TODO: GH#18217
+ function getGlobalOmitSymbol() {
+ return deferredGlobalOmitSymbol || (deferredGlobalOmitSymbol = getGlobalSymbol("Omit", 524288 /* TypeAlias */, ts.Diagnostics.Cannot_find_global_type_0)); // TODO: GH#18217
}
function getGlobalBigIntType(reportErrors) {
return deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, reportErrors)) || emptyObjectType;
@@ -39518,7 +39921,7 @@
return links.resolvedType;
}
function isReadonlyTypeOperator(node) {
- return ts.isTypeOperatorNode(node) && node.operator === 133 /* ReadonlyKeyword */;
+ return ts.isTypeOperatorNode(node) && node.operator === 134 /* ReadonlyKeyword */;
}
// We represent tuple types as type references to synthesized generic interface types created by
// this function. The types are of the form:
@@ -39593,8 +39996,8 @@
var links = getNodeLinks(node);
if (!links.resolvedType) {
var lastElement = ts.lastOrUndefined(node.elementTypes);
- var restElement_1 = lastElement && lastElement.kind === 172 /* RestType */ ? lastElement : undefined;
- var minLength = ts.findLastIndex(node.elementTypes, function (n) { return n.kind !== 171 /* OptionalType */ && n !== restElement_1; }) + 1;
+ var restElement_1 = lastElement && lastElement.kind === 173 /* RestType */ ? lastElement : undefined;
+ var minLength = ts.findLastIndex(node.elementTypes, function (n) { return n.kind !== 172 /* OptionalType */ && n !== restElement_1; }) + 1;
var elementTypes = ts.map(node.elementTypes, function (n) {
var type = getTypeFromTypeNode(n);
return n === restElement_1 && getIndexTypeOfType(type, 1 /* Number */) || type;
@@ -39981,6 +40384,14 @@
types[index] = getUnionTypeFromSortedList(result, 65536 /* PrimitiveUnion */);
return true;
}
+ function createIntersectionType(types, aliasSymbol, aliasTypeArguments) {
+ var result = createType(2097152 /* Intersection */);
+ result.objectFlags = getPropagatingFlagsOfTypes(types, /*excludeKinds*/ 98304 /* Nullable */);
+ result.types = types;
+ result.aliasSymbol = aliasSymbol; // See comment in `getUnionTypeFromSortedList`.
+ result.aliasTypeArguments = aliasTypeArguments;
+ return result;
+ }
// We normalize combinations of intersection and union types based on the distributive property of the '&'
// operator. Specifically, because X & (A | B) is equivalent to X & A | X & B, we can transform intersection
// types with union type constituents into equivalent union types with intersection type constituents and
@@ -40018,30 +40429,36 @@
if (typeSet.length === 1) {
return typeSet[0];
}
+ var id = getTypeListId(typeSet);
+ var result = intersectionTypes.get(id);
+ if (!result) {
if (includes & 1048576 /* Union */) {
if (intersectUnionsOfPrimitiveTypes(typeSet)) {
// When the intersection creates a reduced set (which might mean that *all* union types have
// disappeared), we restart the operation to get a new set of combined flags. Once we have
// reduced we'll never reduce again, so this occurs at most once.
- return getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
+ result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
}
+ else {
// We are attempting to construct a type of the form X & (A | B) & Y. Transform this into a type of
// the form X & A & Y | X & B & Y and recursively reduce until no union type constituents remain.
+ // If the estimated size of the resulting union type exceeds 100000 constituents, report an error.
+ var size = ts.reduceLeft(typeSet, function (n, t) { return n * (t.flags & 1048576 /* Union */ ? t.types.length : 1); }, 1);
+ if (size >= 100000) {
+ error(currentNode, ts.Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
+ return errorType;
+ }
var unionIndex_1 = ts.findIndex(typeSet, function (t) { return (t.flags & 1048576 /* Union */) !== 0; });
var unionType = typeSet[unionIndex_1];
- return getUnionType(ts.map(unionType.types, function (t) { return getIntersectionType(ts.replaceElement(typeSet, unionIndex_1, t)); }), 1 /* Literal */, aliasSymbol, aliasTypeArguments);
+ result = getUnionType(ts.map(unionType.types, function (t) { return getIntersectionType(ts.replaceElement(typeSet, unionIndex_1, t)); }), 1 /* Literal */, aliasSymbol, aliasTypeArguments);
}
- var id = getTypeListId(typeSet);
- var type = intersectionTypes.get(id);
- if (!type) {
- type = createType(2097152 /* Intersection */);
- intersectionTypes.set(id, type);
- type.objectFlags = getPropagatingFlagsOfTypes(typeSet, /*excludeKinds*/ 98304 /* Nullable */);
- type.types = typeSet;
- type.aliasSymbol = aliasSymbol; // See comment in `getUnionTypeFromSortedList`.
- type.aliasTypeArguments = aliasTypeArguments;
}
- return type;
+ else {
+ result = createIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
+ }
+ intersectionTypes.set(id, result);
+ }
+ return result;
}
function getTypeFromIntersectionTypeNode(node) {
var links = getNodeLinks(node);
@@ -40097,16 +40514,17 @@
var numberIndexInfo = getIndexInfoOfType(type, 1 /* Number */);
return numberIndexInfo !== enumNumberIndexInfo ? numberIndexInfo : undefined;
}
- function getIndexType(type, stringsOnly) {
+ function getIndexType(type, stringsOnly, noIndexSignatures) {
if (stringsOnly === void 0) { stringsOnly = keyofStringsOnly; }
- return type.flags & 1048576 /* Union */ ? getIntersectionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly); })) :
- type.flags & 2097152 /* Intersection */ ? getUnionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly); })) :
+ return type.flags & 1048576 /* Union */ ? getIntersectionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
+ type.flags & 2097152 /* Intersection */ ? getUnionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
maybeTypeOfKind(type, 58982400 /* InstantiableNonPrimitive */) ? getIndexTypeForGenericType(type, stringsOnly) :
- ts.getObjectFlags(type) & 32 /* Mapped */ ? getConstraintTypeFromMappedType(type) :
+ ts.getObjectFlags(type) & 32 /* Mapped */ ? filterType(getConstraintTypeFromMappedType(type), function (t) { return !(noIndexSignatures && t.flags & (1 /* Any */ | 4 /* String */)); }) :
type === wildcardType ? wildcardType :
- type.flags & 1 /* Any */ ? keyofConstraintType :
- stringsOnly ? getIndexInfoOfType(type, 0 /* String */) ? stringType : getLiteralTypeFromProperties(type, 128 /* StringLiteral */) :
- getIndexInfoOfType(type, 0 /* String */) ? getUnionType([stringType, numberType, getLiteralTypeFromProperties(type, 8192 /* UniqueESSymbol */)]) :
+ type.flags & 2 /* Unknown */ ? neverType :
+ type.flags & (1 /* Any */ | 131072 /* Never */) ? keyofConstraintType :
+ stringsOnly ? !noIndexSignatures && getIndexInfoOfType(type, 0 /* String */) ? stringType : getLiteralTypeFromProperties(type, 128 /* StringLiteral */) :
+ !noIndexSignatures && getIndexInfoOfType(type, 0 /* String */) ? getUnionType([stringType, numberType, getLiteralTypeFromProperties(type, 8192 /* UniqueESSymbol */)]) :
getNonEnumNumberIndexInfo(type) ? getUnionType([numberType, getLiteralTypeFromProperties(type, 128 /* StringLiteral */ | 8192 /* UniqueESSymbol */)]) :
getLiteralTypeFromProperties(type, 8576 /* StringOrNumberLiteralOrUnique */);
}
@@ -40125,15 +40543,15 @@
var links = getNodeLinks(node);
if (!links.resolvedType) {
switch (node.operator) {
- case 129 /* KeyOfKeyword */:
+ case 130 /* KeyOfKeyword */:
links.resolvedType = getIndexType(getTypeFromTypeNode(node.type));
break;
- case 142 /* UniqueKeyword */:
- links.resolvedType = node.type.kind === 139 /* SymbolKeyword */
+ case 143 /* UniqueKeyword */:
+ links.resolvedType = node.type.kind === 140 /* SymbolKeyword */
? getESSymbolLikeTypeForNode(ts.walkUpParenthesizedTypes(node.parent))
: errorType;
break;
- case 133 /* ReadonlyKeyword */:
+ case 134 /* ReadonlyKeyword */:
links.resolvedType = getTypeFromTypeNode(node.type);
break;
}
@@ -40173,8 +40591,8 @@
}
return false;
}
- function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol, missingType) {
- var accessExpression = accessNode && accessNode.kind === 190 /* ElementAccessExpression */ ? accessNode : undefined;
+ function getPropertyTypeForIndexType(originalObjectType, objectType, indexType, fullIndexType, suppressNoImplicitAnyError, accessNode, accessFlags) {
+ var accessExpression = accessNode && accessNode.kind === 191 /* ElementAccessExpression */ ? accessNode : undefined;
var propName = isTypeUsableAsPropertyName(indexType) ?
getPropertyNameFromType(indexType) :
accessExpression && checkThatExpressionIsProperSymbolReference(accessExpression.argumentExpression, indexType, /*reportError*/ false) ?
@@ -40187,12 +40605,12 @@
var prop = getPropertyOfType(objectType, propName);
if (prop) {
if (accessExpression) {
- markPropertyAsReferenced(prop, accessExpression, /*isThisAccess*/ accessExpression.expression.kind === 100 /* ThisKeyword */);
+ markPropertyAsReferenced(prop, accessExpression, /*isThisAccess*/ accessExpression.expression.kind === 101 /* ThisKeyword */);
if (ts.isAssignmentTarget(accessExpression) && (isReferenceToReadonlyEntity(accessExpression, prop) || isReferenceThroughNamespaceImport(accessExpression))) {
error(accessExpression.argumentExpression, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, symbolToString(prop));
- return missingType;
+ return undefined;
}
- if (cacheSymbol) {
+ if (accessFlags & 4 /* CacheSymbol */) {
getNodeLinks(accessNode).resolvedSymbol = prop;
}
}
@@ -40211,6 +40629,7 @@
error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.unescapeLeadingUnderscores(propName), typeToString(objectType));
}
}
+ errorIfWritingToReadonlyIndex(getIndexInfoOfType(objectType, 1 /* Number */));
return mapType(objectType, function (t) { return getRestTypeOfTupleType(t) || undefinedType; });
}
}
@@ -40218,17 +40637,21 @@
if (objectType.flags & (1 /* Any */ | 131072 /* Never */)) {
return objectType;
}
- var indexInfo = isTypeAssignableToKind(indexType, 296 /* NumberLike */) && getIndexInfoOfType(objectType, 1 /* Number */) ||
- getIndexInfoOfType(objectType, 0 /* String */) ||
- undefined;
+ var stringIndexInfo = getIndexInfoOfType(objectType, 0 /* String */);
+ var indexInfo = isTypeAssignableToKind(indexType, 296 /* NumberLike */) && getIndexInfoOfType(objectType, 1 /* Number */) || stringIndexInfo;
if (indexInfo) {
+ if (accessFlags & 1 /* NoIndexSignatures */ && indexInfo === stringIndexInfo) {
+ if (accessExpression) {
+ error(accessExpression, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(originalObjectType));
+ }
+ return undefined;
+ }
if (accessNode && !isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
var indexNode = getIndexNodeForAccessExpression(accessNode);
error(indexNode, ts.Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType));
+ return indexInfo.type;
}
- else if (accessExpression && indexInfo.isReadonly && (ts.isAssignmentTarget(accessExpression) || ts.isDeleteTarget(accessExpression))) {
- error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
- }
+ errorIfWritingToReadonlyIndex(indexInfo);
return indexInfo.type;
}
if (indexType.flags & 131072 /* Never */) {
@@ -40241,7 +40664,7 @@
if (objectType.symbol === globalThisSymbol && propName !== undefined && globalThisSymbol.exports.has(propName) && (globalThisSymbol.exports.get(propName).flags & 418 /* BlockScoped */)) {
error(accessExpression, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.unescapeLeadingUnderscores(propName), typeToString(objectType));
}
- else if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors) {
+ else if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors && !suppressNoImplicitAnyError) {
if (propName !== undefined && typeHasStaticProperty(propName, objectType)) {
error(accessExpression, ts.Diagnostics.Property_0_is_a_static_member_of_type_1, propName, typeToString(objectType));
}
@@ -40256,11 +40679,35 @@
}
}
else {
- error(accessExpression, ts.Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature, typeToString(objectType));
+ var suggestion_1 = getSuggestionForNonexistentIndexSignature(objectType, accessExpression);
+ if (suggestion_1 !== undefined) {
+ error(accessExpression, ts.Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1, typeToString(objectType), suggestion_1);
}
+ else {
+ var errorInfo = void 0;
+ if (indexType.flags & 1024 /* EnumLiteral */) {
+ errorInfo = ts.chainDiagnosticMessages(/* details */ undefined, ts.Diagnostics.Property_0_does_not_exist_on_type_1, "[" + typeToString(indexType) + "]", typeToString(objectType));
+ }
+ else if (indexType.flags & 8192 /* UniqueESSymbol */) {
+ var symbolName_2 = getFullyQualifiedName(indexType.symbol, accessExpression);
+ errorInfo = ts.chainDiagnosticMessages(/* details */ undefined, ts.Diagnostics.Property_0_does_not_exist_on_type_1, "[" + symbolName_2 + "]", typeToString(objectType));
+ }
+ else if (indexType.flags & 128 /* StringLiteral */) {
+ errorInfo = ts.chainDiagnosticMessages(/* details */ undefined, ts.Diagnostics.Property_0_does_not_exist_on_type_1, indexType.value, typeToString(objectType));
+ }
+ else if (indexType.flags & 256 /* NumberLiteral */) {
+ errorInfo = ts.chainDiagnosticMessages(/* details */ undefined, ts.Diagnostics.Property_0_does_not_exist_on_type_1, indexType.value, typeToString(objectType));
}
+ else if (indexType.flags & (8 /* Number */ | 4 /* String */)) {
+ errorInfo = ts.chainDiagnosticMessages(/* details */ undefined, ts.Diagnostics.No_index_signature_with_a_parameter_of_type_0_was_found_on_type_1, typeToString(indexType), typeToString(objectType));
}
- return missingType;
+ errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1, typeToString(fullIndexType), typeToString(objectType));
+ diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(accessExpression, errorInfo));
+ }
+ }
+ }
+ }
+ return undefined;
}
}
if (isJSLiteralType(objectType)) {
@@ -40281,14 +40728,19 @@
if (isTypeAny(indexType)) {
return indexType;
}
- return missingType;
+ return undefined;
+ function errorIfWritingToReadonlyIndex(indexInfo) {
+ if (indexInfo && indexInfo.isReadonly && accessExpression && (ts.isAssignmentTarget(accessExpression) || ts.isDeleteTarget(accessExpression))) {
+ error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
+ }
+ }
}
function getIndexNodeForAccessExpression(accessNode) {
- return accessNode.kind === 190 /* ElementAccessExpression */
+ return accessNode.kind === 191 /* ElementAccessExpression */
? accessNode.argumentExpression
- : accessNode.kind === 180 /* IndexedAccessType */
+ : accessNode.kind === 181 /* IndexedAccessType */
? accessNode.indexType
- : accessNode.kind === 149 /* ComputedPropertyName */
+ : accessNode.kind === 150 /* ComputedPropertyName */
? accessNode.expression
: accessNode;
}
@@ -40298,67 +40750,124 @@
function isGenericIndexType(type) {
return maybeTypeOfKind(type, 58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */);
}
- function getSimplifiedType(type) {
- return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type) : type;
+ function isThisTypeParameter(type) {
+ return !!(type.flags & 262144 /* TypeParameter */ && type.isThisType);
}
- function distributeIndexOverObjectType(objectType, indexType) {
- // (T | U)[K] -> T[K] | U[K]
- if (objectType.flags & 1048576 /* Union */) {
- return mapType(objectType, function (t) { return getSimplifiedType(getIndexedAccessType(t, indexType)); });
+ function getSimplifiedType(type, writing) {
+ return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) :
+ type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) :
+ type;
}
+ function distributeIndexOverObjectType(objectType, indexType, writing) {
+ // (T | U)[K] -> T[K] | U[K] (reading)
+ // (T | U)[K] -> T[K] & U[K] (writing)
// (T & U)[K] -> T[K] & U[K]
- if (objectType.flags & 2097152 /* Intersection */) {
- return getIntersectionType(ts.map(objectType.types, function (t) { return getSimplifiedType(getIndexedAccessType(t, indexType)); }));
+ if (objectType.flags & 3145728 /* UnionOrIntersection */) {
+ var types = ts.map(objectType.types, function (t) { return getSimplifiedType(getIndexedAccessType(t, indexType), writing); });
+ return objectType.flags & 2097152 /* Intersection */ || writing ? getIntersectionType(types) : getUnionType(types);
+ }
+ }
+ function distributeObjectOverIndexType(objectType, indexType, writing) {
+ // T[A | B] -> T[A] | T[B] (reading)
+ // T[A | B] -> T[A] & T[B] (writing)
+ if (indexType.flags & 1048576 /* Union */) {
+ var types = ts.map(indexType.types, function (t) { return getSimplifiedType(getIndexedAccessType(objectType, t), writing); });
+ return writing ? getIntersectionType(types) : getUnionType(types);
}
}
// Transform an indexed access to a simpler form, if possible. Return the simpler form, or return
- // the type itself if no transformation is possible.
- function getSimplifiedIndexedAccessType(type) {
- if (type.simplified) {
- return type.simplified === circularConstraintType ? type : type.simplified;
+ // the type itself if no transformation is possible. The writing flag indicates that the type is
+ // the target of an assignment.
+ function getSimplifiedIndexedAccessType(type, writing) {
+ var cache = writing ? "simplifiedForWriting" : "simplifiedForReading";
+ if (type[cache]) {
+ return type[cache] === circularConstraintType ? type : type[cache];
}
- type.simplified = circularConstraintType;
+ type[cache] = circularConstraintType;
// We recursively simplify the object type as it may in turn be an indexed access type. For example, with
// '{ [P in T]: { [Q in U]: number } }[T][U]' we want to first simplify the inner indexed access type.
- var objectType = getSimplifiedType(type.objectType);
- var indexType = getSimplifiedType(type.indexType);
- // T[A | B] -> T[A] | T[B]
- if (indexType.flags & 1048576 /* Union */) {
- return type.simplified = mapType(indexType, function (t) { return getSimplifiedType(getIndexedAccessType(objectType, t)); });
+ var objectType = getSimplifiedType(type.objectType, writing);
+ var indexType = getSimplifiedType(type.indexType, writing);
+ // T[A | B] -> T[A] | T[B] (reading)
+ // T[A | B] -> T[A] & T[B] (writing)
+ var distributedOverIndex = distributeObjectOverIndexType(objectType, indexType, writing);
+ if (distributedOverIndex) {
+ return type[cache] = distributedOverIndex;
}
// Only do the inner distributions if the index can no longer be instantiated to cause index distribution again
if (!(indexType.flags & 63176704 /* Instantiable */)) {
- var simplified = distributeIndexOverObjectType(objectType, indexType);
- if (simplified) {
- return type.simplified = simplified;
+ // (T | U)[K] -> T[K] | U[K] (reading)
+ // (T | U)[K] -> T[K] & U[K] (writing)
+ // (T & U)[K] -> T[K] & U[K]
+ var distributedOverObject = distributeIndexOverObjectType(objectType, indexType, writing);
+ if (distributedOverObject) {
+ return type[cache] = distributedOverObject;
}
}
- // So ultimately:
+ // So ultimately (reading):
// ((A & B) | C)[K1 | K2] -> ((A & B) | C)[K1] | ((A & B) | C)[K2] -> (A & B)[K1] | C[K1] | (A & B)[K2] | C[K2] -> (A[K1] & B[K1]) | C[K1] | (A[K2] & B[K2]) | C[K2]
// If the object type is a mapped type { [P in K]: E }, where K is generic, instantiate E using a mapper
// that substitutes the index type for P. For example, for an index access { [P in K]: Box<T[P]> }[X], we
// construct the type Box<T[X]>.
if (isGenericMappedType(objectType)) {
- return type.simplified = mapType(substituteIndexedMappedType(objectType, type.indexType), getSimplifiedType);
+ return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), function (t) { return getSimplifiedType(t, writing); });
+ }
+ return type[cache] = type;
+ }
+ function getSimplifiedConditionalType(type, writing) {
+ var checkType = type.checkType;
+ var extendsType = type.extendsType;
+ var trueType = getTrueTypeFromConditionalType(type);
+ var falseType = getFalseTypeFromConditionalType(type);
+ // Simplifications for types of the form `T extends U ? T : never` and `T extends U ? never : T`.
+ if (falseType.flags & 131072 /* Never */ && getActualTypeVariable(trueType) === getActualTypeVariable(checkType)) {
+ if (checkType.flags & 1 /* Any */ || isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { // Always true
+ return getSimplifiedType(trueType, writing);
+ }
+ else if (isIntersectionEmpty(checkType, extendsType)) { // Always false
+ return neverType;
+ }
+ }
+ else if (trueType.flags & 131072 /* Never */ && getActualTypeVariable(falseType) === getActualTypeVariable(checkType)) {
+ if (!(checkType.flags & 1 /* Any */) && isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { // Always true
+ return neverType;
+ }
+ else if (checkType.flags & 1 /* Any */ || isIntersectionEmpty(checkType, extendsType)) { // Always false
+ return getSimplifiedType(falseType, writing);
}
- return type.simplified = type;
+ }
+ return type;
+ }
+ /**
+ * Invokes union simplification logic to determine if an intersection is considered empty as a union constituent
+ */
+ function isIntersectionEmpty(type1, type2) {
+ return !!(getUnionType([intersectTypes(type1, type2), neverType]).flags & 131072 /* Never */);
}
function substituteIndexedMappedType(objectType, index) {
var mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [index]);
var templateMapper = combineTypeMappers(objectType.mapper, mapper);
return instantiateType(getTemplateTypeFromMappedType(objectType), templateMapper);
}
- function getIndexedAccessType(objectType, indexType, accessNode, missingType) {
- if (missingType === void 0) { missingType = accessNode ? errorType : unknownType; }
+ function getIndexedAccessType(objectType, indexType, accessNode) {
+ return getIndexedAccessTypeOrUndefined(objectType, indexType, accessNode, 0 /* None */) || (accessNode ? errorType : unknownType);
+ }
+ function getIndexedAccessTypeOrUndefined(objectType, indexType, accessNode, accessFlags) {
+ if (accessFlags === void 0) { accessFlags = 0 /* None */; }
if (objectType === wildcardType || indexType === wildcardType) {
return wildcardType;
}
+ // If the object type has a string index signature and no other members we know that the result will
+ // always be the type of that index signature and we can simplify accordingly.
+ if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
+ indexType = stringType;
+ }
// If the index type is generic, or if the object type is generic and doesn't originate in an expression,
// we are performing a higher-order index access where we cannot meaningfully access the properties of the
// object type. Note that for a generic T and a non-generic K, we eagerly resolve T[K] if it originates in
// an expression. This is to preserve backwards compatibility. For example, an element access 'this["foo"]'
// has always been resolved eagerly using the constraint type of 'this' at the given location.
- if (isGenericIndexType(indexType) || !(accessNode && accessNode.kind !== 180 /* IndexedAccessType */) && isGenericObjectType(objectType)) {
+ if (isGenericIndexType(indexType) || !(accessNode && accessNode.kind !== 181 /* IndexedAccessType */) && isGenericObjectType(objectType)) {
if (objectType.flags & 3 /* AnyOrUnknown */) {
return objectType;
}
@@ -40379,25 +40888,25 @@
var wasMissingProp = false;
for (var _i = 0, _a = indexType.types; _i < _a.length; _i++) {
var t = _a[_i];
- var propType = getPropertyTypeForIndexType(apparentObjectType, t, accessNode, /*cacheSymbol*/ false, missingType);
- if (propType === missingType) {
- if (!accessNode) {
+ var propType = getPropertyTypeForIndexType(objectType, apparentObjectType, t, indexType, wasMissingProp, accessNode, accessFlags);
+ if (propType) {
+ propTypes.push(propType);
+ }
+ else if (!accessNode) {
// If there's no error node, we can immeditely stop, since error reporting is off
- return missingType;
+ return undefined;
}
else {
// Otherwise we set a flag and return at the end of the loop so we still mark all errors
wasMissingProp = true;
}
}
- propTypes.push(propType);
- }
if (wasMissingProp) {
- return missingType;
+ return undefined;
}
- return getUnionType(propTypes);
+ return accessFlags & 2 /* Writing */ ? getIntersectionType(propTypes) : getUnionType(propTypes);
}
- return getPropertyTypeForIndexType(apparentObjectType, indexType, accessNode, /*cacheSymbol*/ true, missingType);
+ return getPropertyTypeForIndexType(objectType, apparentObjectType, indexType, indexType, /* supressNoImplicitAnyError */ false, accessNode, accessFlags | 4 /* CacheSymbol */);
}
function getTypeFromIndexedAccessTypeNode(node) {
var links = getNodeLinks(node);
@@ -40427,13 +40936,14 @@
return links.resolvedType;
}
function getActualTypeVariable(type) {
- return type.flags & 33554432 /* Substitution */ ? type.typeVariable : type;
+ if (type.flags & 33554432 /* Substitution */) {
+ return type.typeVariable;
}
- /**
- * Invokes union simplification logic to determine if an intersection is considered empty as a union constituent
- */
- function isIntersectionEmpty(type1, type2) {
- return !!(getUnionType([intersectTypes(type1, type2), neverType]).flags & 131072 /* Never */);
+ if (type.flags & 8388608 /* IndexedAccess */ && (type.objectType.flags & 33554432 /* Substitution */ ||
+ type.indexType.flags & 33554432 /* Substitution */)) {
+ return getIndexedAccessType(getActualTypeVariable(type.objectType), getActualTypeVariable(type.indexType));
+ }
+ return type;
}
function getConditionalType(root, mapper) {
var checkType = instantiateType(root.checkType, mapper);
@@ -40441,35 +40951,6 @@
if (checkType === wildcardType || extendsType === wildcardType) {
return wildcardType;
}
- var trueType = instantiateType(root.trueType, mapper);
- var falseType = instantiateType(root.falseType, mapper);
- var instantiationId = "" + (root.isDistributive ? "d" : "") + getTypeId(checkType) + ">" + getTypeId(extendsType) + "?" + getTypeId(trueType) + ":" + getTypeId(falseType);
- var result = conditionalTypes.get(instantiationId);
- if (result) {
- return result;
- }
- var newResult = getConditionalTypeWorker(root, mapper, checkType, extendsType, trueType, falseType);
- conditionalTypes.set(instantiationId, newResult);
- return newResult;
- }
- function getConditionalTypeWorker(root, mapper, checkType, extendsType, trueType, falseType) {
- // Simplifications for types of the form `T extends U ? T : never` and `T extends U ? never : T`.
- if (falseType.flags & 131072 /* Never */ && getActualTypeVariable(trueType) === getActualTypeVariable(checkType)) {
- if (checkType.flags & 1 /* Any */ || isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { // Always true
- return trueType;
- }
- else if (isIntersectionEmpty(checkType, extendsType)) { // Always false
- return neverType;
- }
- }
- else if (trueType.flags & 131072 /* Never */ && getActualTypeVariable(falseType) === getActualTypeVariable(checkType)) {
- if (!(checkType.flags & 1 /* Any */) && isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { // Always true
- return neverType;
- }
- else if (checkType.flags & 1 /* Any */ || isIntersectionEmpty(checkType, extendsType)) { // Always false
- return falseType;
- }
- }
var checkTypeInstantiable = maybeTypeOfKind(checkType, 63176704 /* Instantiable */ | 131072 /* GenericMappedType */);
var combinedMapper;
if (root.inferTypeParameters) {
@@ -40478,7 +40959,7 @@
// We don't want inferences from constraints as they may cause us to eagerly resolve the
// conditional type instead of deferring resolution. Also, we always want strict function
// types rules (i.e. proper contravariance) for inferences.
- inferTypes(context.inferences, checkType, extendsType, 32 /* NoConstraints */ | 64 /* AlwaysStrict */);
+ inferTypes(context.inferences, checkType, extendsType, 64 /* NoConstraints */ | 128 /* AlwaysStrict */);
}
combinedMapper = combineTypeMappers(mapper, context.mapper);
}
@@ -40487,18 +40968,18 @@
// We attempt to resolve the conditional type only when the check and extends types are non-generic
if (!checkTypeInstantiable && !maybeTypeOfKind(inferredExtendsType, 63176704 /* Instantiable */ | 131072 /* GenericMappedType */)) {
if (inferredExtendsType.flags & 3 /* AnyOrUnknown */) {
- return trueType;
+ return instantiateType(root.trueType, combinedMapper || mapper);
}
// Return union of trueType and falseType for 'any' since it matches anything
if (checkType.flags & 1 /* Any */) {
- return getUnionType([instantiateType(root.trueType, combinedMapper || mapper), falseType]);
+ return getUnionType([instantiateType(root.trueType, combinedMapper || mapper), instantiateType(root.falseType, mapper)]);
}
// Return falseType for a definitely false extends check. We check an instantiations of the two
// types with type parameters mapped to the wildcard type, the most permissive instantiations
// possible (the wildcard type is assignable to and from all types). If those are not related,
// then no instantiations will be and we can just return the false branch type.
if (!isTypeAssignableTo(getPermissiveInstantiation(checkType), getPermissiveInstantiation(inferredExtendsType))) {
- return falseType;
+ return instantiateType(root.falseType, mapper);
}
// Return trueType for a definitely true extends check. We check instantiations of the two
// types with type parameters mapped to their restrictive form, i.e. a form of the type parameter
@@ -40510,9 +40991,6 @@
}
}
// Return a deferred type for a check that is neither definitely true nor definitely false
- return getDeferredConditionalType(root, mapper, combinedMapper, checkType, extendsType, trueType, falseType);
- }
- function getDeferredConditionalType(root, mapper, combinedMapper, checkType, extendsType, trueType, falseType) {
var erasedCheckType = getActualTypeVariable(checkType);
var result = createType(16777216 /* Conditional */);
result.root = root;
@@ -40520,14 +40998,18 @@
result.extendsType = extendsType;
result.mapper = mapper;
result.combinedMapper = combinedMapper;
- result.trueType = trueType;
- result.falseType = falseType;
result.aliasSymbol = root.aliasSymbol;
result.aliasTypeArguments = instantiateTypes(root.aliasTypeArguments, mapper); // TODO: GH#18217
return result;
}
+ function getTrueTypeFromConditionalType(type) {
+ return type.resolvedTrueType || (type.resolvedTrueType = instantiateType(type.root.trueType, type.mapper));
+ }
+ function getFalseTypeFromConditionalType(type) {
+ return type.resolvedFalseType || (type.resolvedFalseType = instantiateType(type.root.falseType, type.mapper));
+ }
function getInferredTrueTypeFromConditionalType(type) {
- return type.resolvedInferredTrueType || (type.resolvedInferredTrueType = instantiateType(type.root.trueType, type.combinedMapper || type.mapper));
+ return type.resolvedInferredTrueType || (type.resolvedInferredTrueType = type.combinedMapper ? instantiateType(type.root.trueType, type.combinedMapper) : getTrueTypeFromConditionalType(type));
}
function getInferTypeParameters(node) {
var result;
@@ -40540,20 +41022,6 @@
}
return result;
}
- function isPossiblyReferencedInConditionalType(tp, node) {
- if (isTypeParameterPossiblyReferenced(tp, node)) {
- return true;
- }
- while (node) {
- if (node.kind === 175 /* ConditionalType */) {
- if (isTypeParameterPossiblyReferenced(tp, node.extendsType)) {
- return true;
- }
- }
- node = node.parent;
- }
- return false;
- }
function getTypeFromConditionalTypeNode(node) {
var links = getNodeLinks(node);
if (!links.resolvedType) {
@@ -40561,7 +41029,7 @@
var aliasSymbol = getAliasSymbolForTypeNode(node);
var aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol);
var allOuterTypeParameters = getOuterTypeParameters(node, /*includeThisTypes*/ true);
- var outerTypeParameters = aliasTypeArguments ? allOuterTypeParameters : ts.filter(allOuterTypeParameters, function (tp) { return isPossiblyReferencedInConditionalType(tp, node); });
+ var outerTypeParameters = aliasTypeArguments ? allOuterTypeParameters : ts.filter(allOuterTypeParameters, function (tp) { return isTypeParameterPossiblyReferenced(tp, node); });
var root = {
node: node,
checkType: checkType,
@@ -40872,9 +41340,9 @@
function getThisType(node) {
var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false);
var parent = container && container.parent;
- if (parent && (ts.isClassLike(parent) || parent.kind === 241 /* InterfaceDeclaration */)) {
+ if (parent && (ts.isClassLike(parent) || parent.kind === 242 /* InterfaceDeclaration */)) {
if (!ts.hasModifier(container, 32 /* Static */) &&
- (container.kind !== 157 /* Constructor */ || ts.isNodeDescendantOf(node, container.body))) {
+ (container.kind !== 158 /* Constructor */ || ts.isNodeDescendantOf(node, container.body))) {
return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType;
}
}
@@ -40890,89 +41358,89 @@
}
function getTypeFromTypeNode(node) {
switch (node.kind) {
- case 120 /* AnyKeyword */:
- case 289 /* JSDocAllType */:
- case 290 /* JSDocUnknownType */:
+ case 121 /* AnyKeyword */:
+ case 290 /* JSDocAllType */:
+ case 291 /* JSDocUnknownType */:
return anyType;
- case 143 /* UnknownKeyword */:
+ case 144 /* UnknownKeyword */:
return unknownType;
- case 138 /* StringKeyword */:
+ case 139 /* StringKeyword */:
return stringType;
- case 135 /* NumberKeyword */:
+ case 136 /* NumberKeyword */:
return numberType;
- case 146 /* BigIntKeyword */:
+ case 147 /* BigIntKeyword */:
return bigintType;
- case 123 /* BooleanKeyword */:
+ case 124 /* BooleanKeyword */:
return booleanType;
- case 139 /* SymbolKeyword */:
+ case 140 /* SymbolKeyword */:
return esSymbolType;
- case 106 /* VoidKeyword */:
+ case 107 /* VoidKeyword */:
return voidType;
- case 141 /* UndefinedKeyword */:
+ case 142 /* UndefinedKeyword */:
return undefinedType;
- case 96 /* NullKeyword */:
+ case 97 /* NullKeyword */:
return nullType;
- case 132 /* NeverKeyword */:
+ case 133 /* NeverKeyword */:
return neverType;
- case 136 /* ObjectKeyword */:
+ case 137 /* ObjectKeyword */:
return node.flags & 65536 /* JavaScriptFile */ ? anyType : nonPrimitiveType;
- case 178 /* ThisType */:
- case 100 /* ThisKeyword */:
+ case 179 /* ThisType */:
+ case 101 /* ThisKeyword */:
return getTypeFromThisTypeNode(node);
- case 182 /* LiteralType */:
+ case 183 /* LiteralType */:
return getTypeFromLiteralTypeNode(node);
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return getTypeFromTypeReference(node);
- case 163 /* TypePredicate */:
+ case 164 /* TypePredicate */:
return booleanType;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return getTypeFromTypeReference(node);
- case 167 /* TypeQuery */:
+ case 168 /* TypeQuery */:
return getTypeFromTypeQueryNode(node);
- case 169 /* ArrayType */:
+ case 170 /* ArrayType */:
return getTypeFromArrayTypeNode(node);
- case 170 /* TupleType */:
+ case 171 /* TupleType */:
return getTypeFromTupleTypeNode(node);
- case 171 /* OptionalType */:
+ case 172 /* OptionalType */:
return getTypeFromOptionalTypeNode(node);
- case 173 /* UnionType */:
+ case 174 /* UnionType */:
return getTypeFromUnionTypeNode(node);
- case 174 /* IntersectionType */:
+ case 175 /* IntersectionType */:
return getTypeFromIntersectionTypeNode(node);
- case 291 /* JSDocNullableType */:
+ case 292 /* JSDocNullableType */:
return getTypeFromJSDocNullableTypeNode(node);
- case 293 /* JSDocOptionalType */:
+ case 294 /* JSDocOptionalType */:
return addOptionality(getTypeFromTypeNode(node.type));
- case 177 /* ParenthesizedType */:
- case 172 /* RestType */:
- case 292 /* JSDocNonNullableType */:
- case 288 /* JSDocTypeExpression */:
+ case 178 /* ParenthesizedType */:
+ case 173 /* RestType */:
+ case 293 /* JSDocNonNullableType */:
+ case 289 /* JSDocTypeExpression */:
return getTypeFromTypeNode(node.type);
- case 295 /* JSDocVariadicType */:
+ case 296 /* JSDocVariadicType */:
return getTypeFromJSDocVariadicType(node);
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 168 /* TypeLiteral */:
- case 297 /* JSDocTypeLiteral */:
- case 294 /* JSDocFunctionType */:
- case 298 /* JSDocSignature */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 169 /* TypeLiteral */:
+ case 298 /* JSDocTypeLiteral */:
+ case 295 /* JSDocFunctionType */:
+ case 299 /* JSDocSignature */:
return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node);
- case 179 /* TypeOperator */:
+ case 180 /* TypeOperator */:
return getTypeFromTypeOperatorNode(node);
- case 180 /* IndexedAccessType */:
+ case 181 /* IndexedAccessType */:
return getTypeFromIndexedAccessTypeNode(node);
- case 181 /* MappedType */:
+ case 182 /* MappedType */:
return getTypeFromMappedTypeNode(node);
- case 175 /* ConditionalType */:
+ case 176 /* ConditionalType */:
return getTypeFromConditionalTypeNode(node);
- case 176 /* InferType */:
+ case 177 /* InferType */:
return getTypeFromInferTypeNode(node);
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return getTypeFromImportTypeNode(node);
// This function assumes that an identifier or qualified name is a type expression
// Callers should first ensure this by calling isTypeNode
- case 72 /* Identifier */:
- case 148 /* QualifiedName */:
+ case 73 /* Identifier */:
+ case 149 /* QualifiedName */:
var symbol = getSymbolAtLocation(node);
return symbol ? getDeclaredTypeOfSymbol(symbol) : errorType;
default:
@@ -41032,7 +41500,7 @@
* This is used during inference when instantiating type parameter defaults.
*/
function createBackreferenceMapper(context, index) {
- return function (t) { return ts.findIndex(context.inferences, function (info) { return info.typeParameter === t; }) >= index ? emptyObjectType : t; };
+ return function (t) { return ts.findIndex(context.inferences, function (info) { return info.typeParameter === t; }) >= index ? unknownType : t; };
}
function combineTypeMappers(mapper1, mapper2) {
if (!mapper1)
@@ -41115,7 +41583,7 @@
}
// Keep the flags from the symbol we're instantiating. Mark that is instantiated, and
// also transient so that we can just store data on it directly.
- var result = createSymbol(symbol.flags, symbol.escapedName, 1 /* Instantiated */ | ts.getCheckFlags(symbol) & (8 /* Readonly */ | 2048 /* Late */ | 8192 /* OptionalParameter */ | 16384 /* RestParameter */));
+ var result = createSymbol(symbol.flags, symbol.escapedName, 1 /* Instantiated */ | ts.getCheckFlags(symbol) & (8 /* Readonly */ | 4096 /* Late */ | 16384 /* OptionalParameter */ | 32768 /* RestParameter */));
result.declarations = symbol.declarations;
result.parent = symbol.parent;
result.target = symbol;
@@ -41181,28 +41649,31 @@
return type;
}
function maybeTypeParameterReference(node) {
- return !(node.kind === 148 /* QualifiedName */ ||
- node.parent.kind === 164 /* TypeReference */ && node.parent.typeArguments && node === node.parent.typeName);
+ return !(node.kind === 149 /* QualifiedName */ ||
+ node.parent.kind === 165 /* TypeReference */ && node.parent.typeArguments && node === node.parent.typeName);
}
function isTypeParameterPossiblyReferenced(tp, node) {
// If the type parameter doesn't have exactly one declaration, if there are invening statement blocks
// between the node and the type parameter declaration, if the node contains actual references to the
// type parameter, or if the node contains type queries, we consider the type parameter possibly referenced.
if (tp.symbol && tp.symbol.declarations && tp.symbol.declarations.length === 1) {
- var container_3 = tp.symbol.declarations[0].parent;
- if (ts.findAncestor(node, function (n) { return n.kind === 218 /* Block */ ? "quit" : n === container_3; })) {
- return !!ts.forEachChild(node, containsReference);
+ var container = tp.symbol.declarations[0].parent;
+ for (var n = node; n !== container; n = n.parent) {
+ if (!n || n.kind === 219 /* Block */ || n.kind === 176 /* ConditionalType */ && ts.forEachChild(n.extendsType, containsReference)) {
+ return true;
}
}
+ return !!ts.forEachChild(node, containsReference);
+ }
return true;
function containsReference(node) {
switch (node.kind) {
- case 178 /* ThisType */:
+ case 179 /* ThisType */:
return !!tp.isThisType;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return !tp.isThisType && ts.isPartOfTypeNode(node) && maybeTypeParameterReference(node) &&
getTypeFromTypeNode(node) === tp;
- case 167 /* TypeQuery */:
+ case 168 /* TypeQuery */:
return true;
}
return !!ts.forEachChild(node, containsReference);
@@ -41350,7 +41821,7 @@
// If the anonymous type originates in a declaration of a function, method, class, or
// interface, in an object type literal, or in an object literal expression, we may need
// to instantiate the type because it might reference a type parameter.
- return type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations ?
+ return couldContainTypeVariables(type) ?
getAnonymousTypeInstantiation(type, mapper) : type;
}
if (objectFlags & 32 /* Mapped */) {
@@ -41389,7 +41860,7 @@
}
else {
var sub = instantiateType(type.substitute, mapper);
- if (sub.flags & 3 /* AnyOrUnknown */ || isTypeSubtypeOf(getRestrictiveInstantiation(maybeVariable), getRestrictiveInstantiation(sub))) {
+ if (sub.flags & 3 /* AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(maybeVariable), getRestrictiveInstantiation(sub))) {
return maybeVariable;
}
return sub;
@@ -41423,34 +41894,34 @@
// Returns true if the given expression contains (at any level of nesting) a function or arrow expression
// that is subject to contextual typing.
function isContextSensitive(node) {
- ts.Debug.assert(node.kind !== 156 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
+ ts.Debug.assert(node.kind !== 157 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
switch (node.kind) {
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 156 /* MethodDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
return isContextSensitiveFunctionLikeDeclaration(node);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return ts.some(node.properties, isContextSensitive);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return ts.some(node.elements, isContextSensitive);
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return isContextSensitive(node.whenTrue) ||
isContextSensitive(node.whenFalse);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return node.operatorToken.kind === 55 /* BarBarToken */ &&
(isContextSensitive(node.left) || isContextSensitive(node.right));
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return isContextSensitive(node.initializer);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return isContextSensitive(node.expression);
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
return ts.some(node.properties, isContextSensitive) || ts.isJsxOpeningElement(node.parent) && ts.some(node.parent.parent.children, isContextSensitive);
- case 267 /* JsxAttribute */: {
+ case 268 /* JsxAttribute */: {
// If there is no initializer, JSX attribute has a boolean value of true which is not context sensitive.
var initializer = node.initializer;
return !!initializer && isContextSensitive(initializer);
}
- case 270 /* JsxExpression */: {
+ case 271 /* JsxExpression */: {
// It is possible to that node.expression is undefined (e.g <div x={} />)
var expression = node.expression;
return !!expression && isContextSensitive(expression);
@@ -41467,7 +41938,7 @@
if (ts.some(node.parameters, function (p) { return !ts.getEffectiveTypeAnnotationNode(p); })) {
return true;
}
- if (node.kind !== 197 /* ArrowFunction */) {
+ if (node.kind !== 198 /* ArrowFunction */) {
// If the first parameter is not an explicit 'this' parameter, then the function has
// an implicit 'this' parameter which is subject to contextual typing.
var parameter = ts.firstOrUndefined(node.parameters);
@@ -41479,7 +41950,7 @@
}
function hasContextSensitiveReturnExpression(node) {
// TODO(anhans): A block should be context-sensitive if it has a context-sensitive return value.
- return !!node.body && node.body.kind !== 218 /* Block */ && isContextSensitive(node.body);
+ return !!node.body && node.body.kind !== 219 /* Block */ && isContextSensitive(node.body);
}
function isContextSensitiveFunctionOrObjectLiteralMethod(func) {
return (ts.isInJSFile(func) && ts.isFunctionDeclaration(func) || isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) &&
@@ -41532,7 +42003,7 @@
function isTypeDerivedFrom(source, target) {
return source.flags & 1048576 /* Union */ ? ts.every(source.types, function (t) { return isTypeDerivedFrom(t, target); }) :
target.flags & 1048576 /* Union */ ? ts.some(target.types, function (t) { return isTypeDerivedFrom(source, t); }) :
- source.flags & 58982400 /* InstantiableNonPrimitive */ ? isTypeDerivedFrom(getBaseConstraintOfType(source) || emptyObjectType, target) :
+ source.flags & 58982400 /* InstantiableNonPrimitive */ ? isTypeDerivedFrom(getBaseConstraintOfType(source) || unknownType, target) :
target === globalObjectType ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) :
target === globalFunctionType ? !!(source.flags & 524288 /* Object */) && isFunctionObjectType(source) :
hasBaseType(source, getTargetType(target));
@@ -41581,23 +42052,23 @@
return true;
}
switch (node.kind) {
- case 270 /* JsxExpression */:
- case 195 /* ParenthesizedExpression */:
+ case 271 /* JsxExpression */:
+ case 196 /* ParenthesizedExpression */:
return elaborateError(node.expression, source, target, relation, headMessage);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
switch (node.operatorToken.kind) {
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
case 27 /* CommaToken */:
return elaborateError(node.right, source, target, relation, headMessage);
}
break;
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return elaborateObjectLiteral(node, source, target, relation);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return elaborateArrayLiteral(node, source, target, relation);
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
return elaborateJsxComponents(node, source, target, relation);
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return elaborateArrowFunction(node, source, target, relation);
}
return false;
@@ -41666,11 +42137,11 @@
var reportedError = false;
for (var status = iterator.next(); !status.done; status = iterator.next()) {
var _a = status.value, prop = _a.errorNode, next = _a.innerExpression, nameType = _a.nameType, errorMessage = _a.errorMessage;
- var targetPropType = getIndexedAccessType(target, nameType, /*accessNode*/ undefined, errorType);
- if (targetPropType === errorType || targetPropType.flags & 8388608 /* IndexedAccess */)
+ var targetPropType = getIndexedAccessTypeOrUndefined(target, nameType);
+ if (!targetPropType || targetPropType.flags & 8388608 /* IndexedAccess */)
continue; // Don't elaborate on indexes on generic variables
- var sourcePropType = getIndexedAccessType(source, nameType, /*accessNode*/ undefined, errorType);
- if (sourcePropType !== errorType && targetPropType !== errorType && !checkTypeRelatedTo(sourcePropType, targetPropType, relation, /*errorNode*/ undefined)) {
+ var sourcePropType = getIndexedAccessTypeOrUndefined(source, nameType);
+ if (sourcePropType && !checkTypeRelatedTo(sourcePropType, targetPropType, relation, /*errorNode*/ undefined)) {
var elaborated = next && elaborateError(next, sourcePropType, targetPropType, relation, /*headMessage*/ undefined);
if (elaborated) {
reportedError = true;
@@ -41769,7 +42240,7 @@
}
function getElaborationElementForJsxChild(child, nameType, getInvalidTextDiagnostic) {
switch (child.kind) {
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
// child is of the type of the expression
return { errorNode: child, innerExpression: child.expression, nameType: nameType };
case 11 /* JsxText */:
@@ -41778,15 +42249,18 @@
}
// child is a string
return { errorNode: child, innerExpression: undefined, nameType: nameType, errorMessage: getInvalidTextDiagnostic() };
- case 260 /* JsxElement */:
- case 261 /* JsxSelfClosingElement */:
- case 264 /* JsxFragment */:
+ case 261 /* JsxElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 265 /* JsxFragment */:
// child is of type JSX.Element
return { errorNode: child, innerExpression: child, nameType: nameType };
default:
return ts.Debug.assertNever(child, "Found invalid jsx child");
}
}
+ function getSemanticJsxChildren(children) {
+ return ts.filter(children, function (i) { return !ts.isJsxText(i) || !i.containsOnlyTriviaWhiteSpaces; });
+ }
function elaborateJsxComponents(node, source, target, relation) {
var result = elaborateElementwise(generateJsxAttributes(node), source, target, relation);
var invalidTextDiagnostic;
@@ -41796,7 +42270,7 @@
var childrenPropName = childPropName === undefined ? "children" : ts.unescapeLeadingUnderscores(childPropName);
var childrenNameType = getLiteralType(childrenPropName);
var childrenTargetType = getIndexedAccessType(target, childrenNameType);
- var validChildren = ts.filter(containingElement.children, function (i) { return !ts.isJsxText(i) || !i.containsOnlyTriviaWhiteSpaces; });
+ var validChildren = getSemanticJsxChildren(containingElement.children);
if (!ts.length(validChildren)) {
return result;
}
@@ -41880,6 +42354,8 @@
});
}
function elaborateArrayLiteral(node, source, target, relation) {
+ if (target.flags & 131068 /* Primitive */)
+ return false;
if (isTupleLikeType(source)) {
return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation);
}
@@ -41910,11 +42386,11 @@
}
_b = prop.kind;
switch (_b) {
- case 159 /* SetAccessor */: return [3 /*break*/, 2];
- case 158 /* GetAccessor */: return [3 /*break*/, 2];
- case 156 /* MethodDeclaration */: return [3 /*break*/, 2];
- case 276 /* ShorthandPropertyAssignment */: return [3 /*break*/, 2];
- case 275 /* PropertyAssignment */: return [3 /*break*/, 4];
+ case 160 /* SetAccessor */: return [3 /*break*/, 2];
+ case 159 /* GetAccessor */: return [3 /*break*/, 2];
+ case 157 /* MethodDeclaration */: return [3 /*break*/, 2];
+ case 277 /* ShorthandPropertyAssignment */: return [3 /*break*/, 2];
+ case 276 /* PropertyAssignment */: return [3 /*break*/, 4];
}
return [3 /*break*/, 6];
case 2: return [4 /*yield*/, { errorNode: prop.name, innerExpression: undefined, nameType: type }];
@@ -41936,6 +42412,8 @@
});
}
function elaborateObjectLiteral(node, source, target, relation) {
+ if (target.flags & 131068 /* Primitive */)
+ return false;
return elaborateElementwise(generateObjectLiteralElements(node), source, target, relation);
}
/**
@@ -41984,8 +42462,8 @@
return 0 /* False */;
}
var kind = target.declaration ? target.declaration.kind : 0 /* Unknown */;
- var strictVariance = !callbackCheck && strictFunctionTypes && kind !== 156 /* MethodDeclaration */ &&
- kind !== 155 /* MethodSignature */ && kind !== 157 /* Constructor */;
+ var strictVariance = !callbackCheck && strictFunctionTypes && kind !== 157 /* MethodDeclaration */ &&
+ kind !== 156 /* MethodSignature */ && kind !== 158 /* Constructor */;
var result = -1 /* True */;
var sourceThisType = getThisTypeOfSignature(source);
if (sourceThisType && sourceThisType !== voidType) {
@@ -42033,12 +42511,14 @@
result &= related;
}
if (!ignoreReturnTypes) {
- var targetReturnType = (target.declaration && isJSConstructor(target.declaration)) ?
+ // If a signature reolution is already in-flight, skip issuing a circularity error
+ // here and just use the `any` type directly
+ var targetReturnType = isResolvingReturnTypeOfSignature(target) ? anyType : (target.declaration && isJSConstructor(target.declaration)) ?
getJSClassType(target.declaration.symbol) : getReturnTypeOfSignature(target);
if (targetReturnType === voidType) {
return result;
}
- var sourceReturnType = (source.declaration && isJSConstructor(source.declaration)) ?
+ var sourceReturnType = isResolvingReturnTypeOfSignature(source) ? anyType : (source.declaration && isJSConstructor(source.declaration)) ?
getJSClassType(source.declaration.symbol) : getReturnTypeOfSignature(source);
// The following block preserves behavior forbidding boolean returning functions from being assignable to type guard returning functions
var targetTypePredicate = getTypePredicateOfSignature(target);
@@ -42117,6 +42597,11 @@
function isEmptyAnonymousObjectType(type) {
return !!(ts.getObjectFlags(type) & 16 /* Anonymous */) && isEmptyObjectType(type);
}
+ function isStringIndexSignatureOnlyType(type) {
+ return type.flags & 524288 /* Object */ && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfoOfType(type, 0 /* String */) && !getIndexInfoOfType(type, 1 /* Number */) ||
+ type.flags & 3145728 /* UnionOrIntersection */ && ts.every(type.types, isStringIndexSignatureOnlyType) ||
+ false;
+ }
function isEnumTypeRelatedTo(sourceSymbol, targetSymbol, errorReporter) {
if (sourceSymbol === targetSymbol) {
return true;
@@ -42225,8 +42710,8 @@
}
return false;
}
- function isIgnoredJsxProperty(source, sourceProp, targetMemberType) {
- return ts.getObjectFlags(source) & 4096 /* JsxAttributes */ && !(isUnhyphenatedJsxName(sourceProp.escapedName) || targetMemberType);
+ function isIgnoredJsxProperty(source, sourceProp) {
+ return ts.getObjectFlags(source) & 4096 /* JsxAttributes */ && !isUnhyphenatedJsxName(sourceProp.escapedName);
}
/**
* Checks if 'source' is related to 'target' (e.g.: is a assignable to).
@@ -42248,7 +42733,7 @@
var depth = 0;
var expandingFlags = 0 /* None */;
var overflow = false;
- var suppressNextError = false;
+ var overrideNextErrorInfo;
ts.Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
var result = isRelatedTo(source, target, /*reportErrors*/ !!errorNode, headMessage);
if (overflow) {
@@ -42256,9 +42741,9 @@
}
else if (errorInfo) {
if (containingMessageChain) {
- var chain_1 = containingMessageChain();
- if (chain_1) {
- errorInfo = ts.concatenateDiagnosticMessageChains(chain_1, errorInfo);
+ var chain = containingMessageChain();
+ if (chain) {
+ errorInfo = ts.concatenateDiagnosticMessageChains(chain, errorInfo);
}
}
var relatedInformation = void 0;
@@ -42298,11 +42783,9 @@
}
}
function reportRelationError(message, source, target) {
- var sourceType = typeToString(source);
- var targetType = typeToString(target);
- if (sourceType === targetType) {
- sourceType = typeToString(source, /*enclosingDeclaration*/ undefined, 64 /* UseFullyQualifiedType */);
- targetType = typeToString(target, /*enclosingDeclaration*/ undefined, 64 /* UseFullyQualifiedType */);
+ var _a = getTypeNamesForErrorDisplay(source, target), sourceType = _a[0], targetType = _a[1];
+ if (target.flags & 262144 /* TypeParameter */ && target.immediateBaseConstraint !== undefined && isTypeAssignableTo(source, target.immediateBaseConstraint)) {
+ reportError(ts.Diagnostics._0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_constraint_2, sourceType, targetType, typeToString(target.immediateBaseConstraint));
}
if (!message) {
if (relation === comparableRelation) {
@@ -42327,25 +42810,39 @@
reportError(ts.Diagnostics._0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible, targetType, sourceType);
}
}
- function isUnionOrIntersectionTypeWithoutNullableConstituents(type) {
- if (!(type.flags & 3145728 /* UnionOrIntersection */)) {
+ /**
+ * Try and elaborate array and tuple errors. Returns false
+ * if we have found an elaboration, or we should ignore
+ * any other elaborations when relating the `source` and
+ * `target` types.
+ *
+ * @param source
+ * @param target
+ * @param reportErrors
+ */
+ function tryElaborateArrayLikeErrors(source, target, reportErrors) {
+ if (isTupleLikeType(source)) {
+ var sourceTuple = source.target;
+ if (sourceTuple && sourceTuple.readonly && isArrayOrTupleLikeType(target) &&
+ (!isReadonlyArrayType(target) || isTupleType(target) && !target.target.readonly)) {
+ if (reportErrors) {
+ reportError(ts.Diagnostics.The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1, typeToString(source), typeToString(target));
+ }
return false;
}
- // at this point we know that this is union or intersection type possibly with nullable constituents.
- // check if we still will have compound type if we ignore nullable components.
- var seenNonNullable = false;
- for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
- var t = _a[_i];
- if (t.flags & 98304 /* Nullable */) {
- continue;
+ return isArrayLikeType(target);
}
- if (seenNonNullable) {
- return true;
+ if (isTupleLikeType(target)) {
+ return isArrayLikeType(source);
}
- seenNonNullable = true;
+ if (isReadonlyArrayType(source) && isArrayType(target) && !isReadonlyArrayType(target)) {
+ if (reportErrors) {
+ reportError(ts.Diagnostics.The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1, typeToString(source), typeToString(target));
}
return false;
}
+ return true;
+ }
/**
* Compare two types and return
* * Ternary.True if they are related with no assumptions,
@@ -42366,11 +42863,11 @@
if (target.flags & 33554432 /* Substitution */) {
target = target.typeVariable;
}
- if (source.flags & 8388608 /* IndexedAccess */) {
- source = getSimplifiedType(source);
+ if (source.flags & 25165824 /* Simplifiable */) {
+ source = getSimplifiedType(source, /*writing*/ false);
}
- if (target.flags & 8388608 /* IndexedAccess */) {
- target = getSimplifiedType(target);
+ if (target.flags & 25165824 /* Simplifiable */) {
+ target = getSimplifiedType(target, /*writing*/ true);
}
// Try to see if we're relating something like `Foo` -> `Bar | null | undefined`.
// If so, reporting the `null` and `undefined` in the type is hardly useful.
@@ -42398,7 +42895,8 @@
isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : undefined))
return -1 /* True */;
var isComparingJsxAttributes = !!(ts.getObjectFlags(source) & 4096 /* JsxAttributes */);
- if (isObjectLiteralType(source) && ts.getObjectFlags(source) & 32768 /* FreshLiteral */) {
+ var isPerformingExcessPropertyChecks = (isObjectLiteralType(source) && ts.getObjectFlags(source) & 32768 /* FreshLiteral */);
+ if (isPerformingExcessPropertyChecks) {
var discriminantType = target.flags & 1048576 /* Union */ ? findMatchingDiscriminantType(source, target) : undefined;
if (hasExcessProperties(source, target, discriminantType, reportErrors)) {
if (reportErrors) {
@@ -42406,13 +42904,6 @@
}
return 0 /* False */;
}
- // Above we check for excess properties with respect to the entire target type. When union
- // and intersection types are further deconstructed on the target side, we don't want to
- // make the check again (as it might fail for a partial target type). Therefore we obtain
- // the regular source type and proceed with that.
- if (isUnionOrIntersectionTypeWithoutNullableConstituents(target) && !discriminantType) {
- source = getRegularTypeOfObjectLiteral(source);
- }
}
if (relation !== comparableRelation && !isApparentIntersectionConstituent &&
source.flags & (131068 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source !== globalObjectType &&
@@ -42445,11 +42936,24 @@
}
else {
if (target.flags & 1048576 /* Union */) {
- result = typeRelatedToSomeType(source, target, reportErrors && !(source.flags & 131068 /* Primitive */) && !(target.flags & 131068 /* Primitive */));
+ result = typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source), target, reportErrors && !(source.flags & 131068 /* Primitive */) && !(target.flags & 131068 /* Primitive */));
+ if (result && isPerformingExcessPropertyChecks) {
+ // Validate against excess props using the original `source`
+ var discriminantType = target.flags & 1048576 /* Union */ ? findMatchingDiscriminantType(source, target) : undefined;
+ if (!propertiesRelatedTo(source, discriminantType || target, reportErrors, /*excludedProperties*/ undefined)) {
+ return 0 /* False */;
+ }
+ }
}
else if (target.flags & 2097152 /* Intersection */) {
isIntersectionConstituent = true; // set here to affect the following trio of checks
- result = typeRelatedToEachType(source, target, reportErrors);
+ result = typeRelatedToEachType(getRegularTypeOfObjectLiteral(source), target, reportErrors);
+ if (result && isPerformingExcessPropertyChecks) {
+ // Validate against excess props using the original `source`
+ if (!propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined)) {
+ return 0 /* False */;
+ }
+ }
}
else if (source.flags & 2097152 /* Intersection */) {
// Check to see if any constituents of the intersection are immediately related to the target.
@@ -42491,8 +42995,15 @@
}
}
if (!result && reportErrors) {
- var maybeSuppress = suppressNextError;
- suppressNextError = false;
+ var maybeSuppress = overrideNextErrorInfo;
+ overrideNextErrorInfo = undefined;
+ if (source.flags & 524288 /* Object */ && target.flags & 524288 /* Object */) {
+ var currentError = errorInfo;
+ tryElaborateArrayLikeErrors(source, target, reportErrors);
+ if (errorInfo !== currentError) {
+ maybeSuppress = errorInfo;
+ }
+ }
if (source.flags & 524288 /* Object */ && target.flags & 131068 /* Primitive */) {
tryElaborateErrorsForPrimitivesAndObjects(source, target);
}
@@ -42587,7 +43098,7 @@
return { value: true };
}
};
- for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) {
+ for (var _i = 0, _a = getPropertiesOfType(source); _i < _a.length; _i++) {
var prop = _a[_i];
var state_3 = _loop_7(prop);
if (typeof state_3 === "object")
@@ -42694,8 +43205,8 @@
}
// Keep this up-to-date with the same logic within `getApparentTypeOfContextualType`, since they should behave similarly
function findMatchingDiscriminantType(source, target) {
- if (target.flags & 1048576 /* Union */) {
- var sourceProperties = getPropertiesOfObjectType(source);
+ if (target.flags & 1048576 /* Union */ && source.flags & (2097152 /* Intersection */ | 524288 /* Object */)) {
+ var sourceProperties = getPropertiesOfType(source);
if (sourceProperties) {
var sourcePropertiesFiltered = findDiscriminantProperties(sourceProperties, target);
if (sourcePropertiesFiltered) {
@@ -42758,13 +43269,20 @@
// When variance information isn't available we default to covariance. This happens
// in the process of computing variance information for recursive types and when
// comparing 'this' type arguments.
- var variance = i < variances.length ? variances[i] : 1 /* Covariant */;
+ var varianceFlags = i < variances.length ? variances[i] : 1 /* Covariant */;
+ var variance = varianceFlags & 7 /* VarianceMask */;
// We ignore arguments for independent type parameters (because they're never witnessed).
if (variance !== 4 /* Independent */) {
var s = sources[i];
var t = targets[i];
var related = -1 /* True */;
- if (variance === 1 /* Covariant */) {
+ if (varianceFlags & 8 /* Unmeasurable */) {
+ // Even an `Unmeasurable` variance works out without a structural check if the source and target are _identical_.
+ // We can't simply assume invariance, because `Unmeasurable` marks nonlinear relations, for example, a relation tained by
+ // the `-?` modifier in a mapped type (where, no matter how the inputs are related, the outputs still might not be)
+ related = relation === identityRelation ? isRelatedTo(s, t, /*reportErrors*/ false) : compareTypesIdentical(s, t);
+ }
+ else if (variance === 1 /* Covariant */) {
related = isRelatedTo(s, t, reportErrors);
}
else if (variance === 2 /* Contravariant */) {
@@ -42883,8 +43401,8 @@
if (source.root.isDistributive === target.root.isDistributive) {
if (result_3 = isRelatedTo(source.checkType, target.checkType, /*reportErrors*/ false)) {
if (result_3 &= isRelatedTo(source.extendsType, target.extendsType, /*reportErrors*/ false)) {
- if (result_3 &= isRelatedTo(source.trueType, target.trueType, /*reportErrors*/ false)) {
- if (result_3 &= isRelatedTo(source.falseType, target.falseType, /*reportErrors*/ false)) {
+ if (result_3 &= isRelatedTo(getTrueTypeFromConditionalType(source), getTrueTypeFromConditionalType(target), /*reportErrors*/ false)) {
+ if (result_3 &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), /*reportErrors*/ false)) {
return result_3;
}
}
@@ -42934,8 +43452,7 @@
}
// A type S is assignable to keyof T if S is assignable to keyof C, where C is the
// simplified form of T or, if T doesn't simplify, the constraint of T.
- var simplified = getSimplifiedType(target.type);
- var constraint = simplified !== target.type ? simplified : getConstraintOfType(target.type);
+ var constraint = getSimplifiedTypeOrConstraint(target.type);
if (constraint) {
// We require Ternary.True here such that circular constraints don't cause
// false positives. For example, given 'T extends { [K in keyof T]: string }',
@@ -42947,13 +43464,17 @@
}
}
else if (target.flags & 8388608 /* IndexedAccess */) {
- // A type S is related to a type T[K], where T and K aren't both type variables, if S is related to C,
- // where C is the base constraint of T[K]
- if (relation !== identityRelation &&
- !(isGenericObjectType(target.objectType) && isGenericIndexType(target.indexType))) {
- var constraint = getBaseConstraintOfType(target);
- if (constraint && constraint !== target) {
- if (result = isRelatedTo(source, constraint, reportErrors)) {
+ // A type S is related to a type T[K] if S is related to C, where C is the base
+ // constraint of T[K] for writing.
+ if (relation !== identityRelation) {
+ var objectType = target.objectType;
+ var indexType = target.indexType;
+ var baseObjectType = getBaseConstraintOfType(objectType) || objectType;
+ var baseIndexType = getBaseConstraintOfType(indexType) || indexType;
+ if (!isGenericObjectType(baseObjectType) && !isGenericIndexType(baseIndexType)) {
+ var accessFlags = 2 /* Writing */ | (baseObjectType !== objectType ? 1 /* NoIndexSignatures */ : 0);
+ var constraint = getIndexedAccessTypeOrUndefined(baseObjectType, baseIndexType, /*accessNode*/ undefined, accessFlags);
+ if (constraint && (result = isRelatedTo(source, constraint, reportErrors))) {
return result;
}
}
@@ -42970,7 +43491,7 @@
}
if (!isGenericMappedType(source)) {
var targetConstraint = getConstraintTypeFromMappedType(target);
- var sourceKeys_1 = getIndexType(source);
+ var sourceKeys_1 = getIndexType(source, /*stringsOnly*/ undefined, /*noIndexSignatures*/ true);
var hasOptionalUnionKeys = modifiers & 4 /* IncludeOptional */ && targetConstraint.flags & 1048576 /* Union */;
var filteredByApplicability = hasOptionalUnionKeys ? filterType(targetConstraint, function (t) { return !!isRelatedTo(t, sourceKeys_1); }) : undefined;
// A source type T is related to a target type { [P in Q]: X } if Q is related to keyof T and T[Q] is related to X.
@@ -43001,6 +43522,7 @@
return result;
}
}
+ else {
var constraint = getConstraintOfType(source);
if (!constraint || (source.flags & 262144 /* TypeParameter */ && constraint.flags & 1 /* Any */)) {
// A type variable with no constraint is not related to the non-primitive object type.
@@ -43020,6 +43542,7 @@
return result;
}
}
+ }
else if (source.flags & 4194304 /* Index */) {
if (result = isRelatedTo(keyofConstraintType, target, reportErrors)) {
errorInfo = saveErrorInfo;
@@ -43033,8 +43556,8 @@
// and Y1 is related to Y2.
if (isTypeIdenticalTo(source.extendsType, target.extendsType) &&
(isRelatedTo(source.checkType, target.checkType) || isRelatedTo(target.checkType, source.checkType))) {
- if (result = isRelatedTo(source.trueType, target.trueType, reportErrors)) {
- result &= isRelatedTo(source.falseType, target.falseType, reportErrors);
+ if (result = isRelatedTo(getTrueTypeFromConditionalType(source), getTrueTypeFromConditionalType(target), reportErrors)) {
+ result &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), reportErrors);
}
if (result) {
errorInfo = saveErrorInfo;
@@ -43104,7 +43627,7 @@
if (source.flags & (524288 /* Object */ | 2097152 /* Intersection */) && target.flags & 524288 /* Object */) {
// Report structural errors only if we haven't reported any errors yet
var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !sourceIsPrimitive;
- result = propertiesRelatedTo(source, target, reportStructuralErrors);
+ result = propertiesRelatedTo(source, target, reportStructuralErrors, /*excludedProperties*/ undefined);
if (result) {
result &= signaturesRelatedTo(source, target, 0 /* Call */, reportStructuralErrors);
if (result) {
@@ -43124,22 +43647,35 @@
return result;
}
}
+ // If S is an object type and T is a discriminated union, S may be related to T if
+ // there exists a constituent of T for every combination of the discriminants of S
+ // with respect to T. We do not report errors here, as we will use the existing
+ // error result from checking each constituent of the union.
+ if (source.flags & (524288 /* Object */ | 2097152 /* Intersection */) && target.flags & 1048576 /* Union */) {
+ var objectOnlyTarget = extractTypesOfKind(target, 524288 /* Object */);
+ if (objectOnlyTarget.flags & 1048576 /* Union */) {
+ var result_4 = typeRelatedToDiscriminatedType(source, objectOnlyTarget);
+ if (result_4) {
+ return result_4;
+ }
}
- return 0 /* False */;
- function isNonGeneric(type) {
- // If we're already in identity relationship checking, we should use `isRelatedTo`
- // to catch the `Maybe` from an excessively deep type (which we then assume means
- // that the type could possibly contain a generic)
- if (relation === identityRelation) {
- return isRelatedTo(type, getPermissiveInstantiation(type)) === -1 /* True */;
}
- return isTypeIdenticalTo(type, getPermissiveInstantiation(type));
}
+ return 0 /* False */;
function relateVariances(sourceTypeArguments, targetTypeArguments, variances) {
if (result = typeArgumentsRelatedTo(sourceTypeArguments, targetTypeArguments, variances, reportErrors)) {
return result;
}
- var allowStructuralFallback = (targetTypeArguments && hasCovariantVoidArgument(targetTypeArguments, variances)) || isNonGeneric(source) || isNonGeneric(target);
+ if (ts.some(variances, function (v) { return !!(v & 24 /* AllowsStructuralFallback */); })) {
+ // If some type parameter was `Unmeasurable` or `Unreliable`, and we couldn't pass by assuming it was identical, then we
+ // have to allow a structural fallback check
+ // We elide the variance-based error elaborations, since those might not be too helpful, since we'll potentially
+ // be assuming identity of the type parameter.
+ originalErrorInfo = undefined;
+ errorInfo = saveErrorInfo;
+ return undefined;
+ }
+ var allowStructuralFallback = targetTypeArguments && hasCovariantVoidArgument(targetTypeArguments, variances);
varianceCheckFailed = !allowStructuralFallback;
// The type arguments did not relate appropriately, but it may be because we have no variance
// information (in which case typeArgumentsRelatedTo defaulted to covariance for all type
@@ -43157,7 +43693,7 @@
// reveal the reason).
// We can switch on `reportErrors` here, since varianceCheckFailed guarantees we return `False`,
// we can return `False` early here to skip calculating the structural error message we don't need.
- if (varianceCheckFailed && !(reportErrors && ts.some(variances, function (v) { return v === 0 /* Invariant */; }))) {
+ if (varianceCheckFailed && !(reportErrors && ts.some(variances, function (v) { return (v & 7 /* VarianceMask */) === 0 /* Invariant */; }))) {
return 0 /* False */;
}
// We remember the original error information so we can restore it in case the structural
@@ -43168,6 +43704,18 @@
}
}
}
+ function reportUnmeasurableMarkers(p) {
+ if (outofbandVarianceMarkerHandler && (p === markerSuperType || p === markerSubType || p === markerOtherType)) {
+ outofbandVarianceMarkerHandler(/*onlyUnreliable*/ false);
+ }
+ return p;
+ }
+ function reportUnreliableMarkers(p) {
+ if (outofbandVarianceMarkerHandler && (p === markerSuperType || p === markerSubType || p === markerOtherType)) {
+ outofbandVarianceMarkerHandler(/*onlyUnreliable*/ true);
+ }
+ return p;
+ }
// A type [P in S]: X is related to a type [Q in T]: Y if T is related to S and X' is
// related to Y, where X' is an instantiation of X in which P is replaced with Q. Notice
// that S and T are contra-variant whereas X and Y are co-variant.
@@ -43175,99 +43723,185 @@
var modifiersRelated = relation === comparableRelation || (relation === identityRelation ? getMappedTypeModifiers(source) === getMappedTypeModifiers(target) :
getCombinedMappedTypeOptionality(source) <= getCombinedMappedTypeOptionality(target));
if (modifiersRelated) {
- var result_4;
- if (result_4 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) {
+ var result_5;
+ var targetConstraint = getConstraintTypeFromMappedType(target);
+ var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source), getCombinedMappedTypeOptionality(source) < 0 ? reportUnmeasurableMarkers : reportUnreliableMarkers);
+ if (result_5 = isRelatedTo(targetConstraint, sourceConstraint, reportErrors)) {
var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]);
- return result_4 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), reportErrors);
+ return result_5 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), reportErrors);
}
}
return 0 /* False */;
}
- function propertiesRelatedTo(source, target, reportErrors) {
- if (relation === identityRelation) {
- return propertiesIdenticalTo(source, target);
+ function typeRelatedToDiscriminatedType(source, target) {
+ // 1. Generate the combinations of discriminant properties & types 'source' can satisfy.
+ // a. If the number of combinations is above a set limit, the comparison is too complex.
+ // 2. Filter 'target' to the subset of types whose discriminants exist in the matrix.
+ // a. If 'target' does not satisfy all discriminants in the matrix, 'source' is not related.
+ // 3. For each type in the filtered 'target', determine if all non-discriminant properties of
+ // 'target' are related to a property in 'source'.
+ //
+ // NOTE: See ~/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithDiscriminatedUnion.ts
+ // for examples.
+ var sourceProperties = getPropertiesOfObjectType(source);
+ var sourcePropertiesFiltered = findDiscriminantProperties(sourceProperties, target);
+ if (!sourcePropertiesFiltered)
+ return 0 /* False */;
+ // Though we could compute the number of combinations as we generate
+ // the matrix, this would incur additional memory overhead due to
+ // array allocations. To reduce this overhead, we first compute
+ // the number of combinations to ensure we will not surpass our
+ // fixed limit before incurring the cost of any allocations:
+ var numCombinations = 1;
+ for (var _i = 0, sourcePropertiesFiltered_1 = sourcePropertiesFiltered; _i < sourcePropertiesFiltered_1.length; _i++) {
+ var sourceProperty = sourcePropertiesFiltered_1[_i];
+ numCombinations *= countTypes(getTypeOfSymbol(sourceProperty));
+ if (numCombinations > 25) {
+ // We've reached the complexity limit.
+ return 0 /* False */;
}
- var requireOptionalProperties = relation === subtypeRelation && !isObjectLiteralType(source) && !isEmptyArrayLiteralType(source) && !isTupleType(source);
- var unmatchedProperty = getUnmatchedProperty(source, target, requireOptionalProperties, /*matchDiscriminantProperties*/ false);
- if (unmatchedProperty) {
- if (reportErrors) {
- var props = ts.arrayFrom(getUnmatchedProperties(source, target, requireOptionalProperties, /*matchDiscriminantProperties*/ false));
- if (!headMessage || (headMessage.code !== ts.Diagnostics.Class_0_incorrectly_implements_interface_1.code &&
- headMessage.code !== ts.Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass.code)) {
- suppressNextError = true; // Retain top-level error for interface implementing issues, otherwise omit it
}
- if (props.length === 1) {
- var propName = symbolToString(unmatchedProperty);
- reportError(ts.Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2, propName, typeToString(source), typeToString(target));
- if (ts.length(unmatchedProperty.declarations)) {
- associateRelatedInfo(ts.createDiagnosticForNode(unmatchedProperty.declarations[0], ts.Diagnostics._0_is_declared_here, propName));
+ // Compute the set of types for each discriminant property.
+ var sourceDiscriminantTypes = new Array(sourcePropertiesFiltered.length);
+ var excludedProperties = ts.createUnderscoreEscapedMap();
+ for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
+ var sourceProperty = sourcePropertiesFiltered[i];
+ var sourcePropertyType = getTypeOfSymbol(sourceProperty);
+ sourceDiscriminantTypes[i] = sourcePropertyType.flags & 1048576 /* Union */
+ ? sourcePropertyType.types
+ : [sourcePropertyType];
+ excludedProperties.set(sourceProperty.escapedName, true);
+ }
+ // Match each combination of the cartesian product of discriminant properties to one or more
+ // constituents of 'target'. If any combination does not have a match then 'source' is not relatable.
+ var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
+ var matchingTypes = [];
+ var _loop_8 = function (combination) {
+ var hasMatch = false;
+ outer: for (var _i = 0, _a = target.types; _i < _a.length; _i++) {
+ var type = _a[_i];
+ var _loop_9 = function (i) {
+ var sourceProperty = sourcePropertiesFiltered[i];
+ var targetProperty = getPropertyOfObjectType(type, sourceProperty.escapedName);
+ if (!targetProperty)
+ return "continue-outer";
+ if (sourceProperty === targetProperty)
+ return "continue";
+ // We compare the source property to the target in the context of a single discriminant type.
+ var related = propertyRelatedTo(source, target, sourceProperty, targetProperty, function (_) { return combination[i]; }, /*reportErrors*/ false);
+ // If the target property could not be found, or if the properties were not related,
+ // then this constituent is not a match.
+ if (!related) {
+ return "continue-outer";
}
+ };
+ for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
+ var state_5 = _loop_9(i);
+ switch (state_5) {
+ case "continue-outer": continue outer;
}
- else if (props.length > 5) { // arbitrary cutoff for too-long list form
- reportError(ts.Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2_and_3_more, typeToString(source), typeToString(target), ts.map(props.slice(0, 4), function (p) { return symbolToString(p); }).join(", "), props.length - 4);
}
- else {
- reportError(ts.Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2, typeToString(source), typeToString(target), ts.map(props, function (p) { return symbolToString(p); }).join(", "));
+ ts.pushIfUnique(matchingTypes, type, ts.equateValues);
+ hasMatch = true;
}
+ if (!hasMatch) {
+ return { value: 0 /* False */ };
}
- return 0 /* False */;
+ };
+ for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
+ var combination = discriminantCombinations_1[_a];
+ var state_4 = _loop_8(combination);
+ if (typeof state_4 === "object")
+ return state_4.value;
}
- if (isObjectLiteralType(target)) {
- for (var _i = 0, _a = getPropertiesOfType(source); _i < _a.length; _i++) {
- var sourceProp = _a[_i];
- if (!getPropertyOfObjectType(target, sourceProp.escapedName)) {
- var sourceType = getTypeOfSymbol(sourceProp);
- if (!(sourceType === undefinedType || sourceType === undefinedWideningType)) {
- if (reportErrors) {
- reportError(ts.Diagnostics.Property_0_does_not_exist_on_type_1, symbolToString(sourceProp), typeToString(target));
+ // Compare the remaining non-discriminant properties of each match.
+ var result = -1 /* True */;
+ for (var _b = 0, matchingTypes_1 = matchingTypes; _b < matchingTypes_1.length; _b++) {
+ var type = matchingTypes_1[_b];
+ result &= propertiesRelatedTo(source, type, /*reportErrors*/ false, excludedProperties);
+ if (result) {
+ result &= signaturesRelatedTo(source, type, 0 /* Call */, /*reportStructuralErrors*/ false);
+ if (result) {
+ result &= signaturesRelatedTo(source, type, 1 /* Construct */, /*reportStructuralErrors*/ false);
+ if (result) {
+ result &= indexTypesRelatedTo(source, type, 0 /* String */, /*sourceIsPrimitive*/ false, /*reportStructuralErrors*/ false);
+ if (result) {
+ result &= indexTypesRelatedTo(source, type, 1 /* Number */, /*sourceIsPrimitive*/ false, /*reportStructuralErrors*/ false);
}
- return 0 /* False */;
}
}
}
+ if (!result) {
+ return result;
}
- var result = -1 /* True */;
- if (isTupleType(target)) {
- var targetRestType = getRestTypeOfTupleType(target);
- if (targetRestType) {
- if (!isTupleType(source)) {
- return 0 /* False */;
}
- var sourceRestType = getRestTypeOfTupleType(source);
- if (sourceRestType && !isRelatedTo(sourceRestType, targetRestType, reportErrors)) {
- if (reportErrors) {
- reportError(ts.Diagnostics.Rest_signatures_are_incompatible);
+ return result;
}
- return 0 /* False */;
+ function excludeProperties(properties, excludedProperties) {
+ if (!excludedProperties || properties.length === 0)
+ return properties;
+ var result;
+ for (var i = 0; i < properties.length; i++) {
+ if (!excludedProperties.has(properties[i].escapedName)) {
+ if (result) {
+ result.push(properties[i]);
}
- var targetCount = getTypeReferenceArity(target) - 1;
- var sourceCount = getTypeReferenceArity(source) - (sourceRestType ? 1 : 0);
- for (var i = targetCount; i < sourceCount; i++) {
- var related = isRelatedTo(source.typeArguments[i], targetRestType, reportErrors);
+ }
+ else if (!result) {
+ result = properties.slice(0, i);
+ }
+ }
+ return result || properties;
+ }
+ function isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors) {
+ var targetIsOptional = strictNullChecks && !!(ts.getCheckFlags(targetProp) & 48 /* Partial */);
+ var source = getTypeOfSourceProperty(sourceProp);
+ if (ts.getCheckFlags(targetProp) & 65536 /* DeferredType */ && !getSymbolLinks(targetProp).type) {
+ // Rather than resolving (and normalizing) the type, relate constituent-by-constituent without performing normalization or seconadary passes
+ var links = getSymbolLinks(targetProp);
+ ts.Debug.assertDefined(links.deferralParent);
+ ts.Debug.assertDefined(links.deferralConstituents);
+ var unionParent = !!(links.deferralParent.flags & 1048576 /* Union */);
+ var result_6 = unionParent ? 0 /* False */ : -1 /* True */;
+ var targetTypes = links.deferralConstituents;
+ for (var _i = 0, targetTypes_3 = targetTypes; _i < targetTypes_3.length; _i++) {
+ var targetType = targetTypes_3[_i];
+ var related = isRelatedTo(source, targetType, /*reportErrors*/ false, /*headMessage*/ undefined, /*isIntersectionConstituent*/ !unionParent);
+ if (!unionParent) {
if (!related) {
- if (reportErrors) {
- reportError(ts.Diagnostics.Property_0_is_incompatible_with_rest_element_type, "" + i);
+ // Can't assign to a target individually - have to fallback to assigning to the _whole_ intersection (which forces normalization)
+ return isRelatedTo(source, addOptionality(getTypeOfSymbol(targetProp), targetIsOptional), reportErrors);
}
- return 0 /* False */;
+ result_6 &= related;
}
- result &= related;
+ else {
+ if (related) {
+ return related;
}
}
}
- var properties = getPropertiesOfObjectType(target);
- for (var _b = 0, properties_2 = properties; _b < properties_2.length; _b++) {
- var targetProp = properties_2[_b];
- if (!(targetProp.flags & 4194304 /* Prototype */)) {
- var sourceProp = getPropertyOfType(source, targetProp.escapedName);
- if (sourceProp && sourceProp !== targetProp) {
- if (isIgnoredJsxProperty(source, sourceProp, getTypeOfSymbol(targetProp))) {
- continue;
+ if (unionParent && !result_6 && targetIsOptional) {
+ result_6 = isRelatedTo(source, undefinedType);
+ }
+ if (unionParent && !result_6 && reportErrors) {
+ // The easiest way to get the right errors here is to un-defer (which may be costly)
+ // If it turns out this is too costly too often, we can replicate the error handling logic within
+ // typeRelatedToSomeType without the discriminatable type branch (as that requires a manifest union
+ // type on which to hand discriminable properties, which we are expressly trying to avoid here)
+ return isRelatedTo(source, addOptionality(getTypeOfSymbol(targetProp), targetIsOptional), reportErrors);
+ }
+ return result_6;
+ }
+ else {
+ return isRelatedTo(source, addOptionality(getTypeOfSymbol(targetProp), targetIsOptional), reportErrors);
+ }
}
+ function propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSourceProperty, reportErrors) {
var sourcePropFlags = ts.getDeclarationModifierFlagsFromSymbol(sourceProp);
var targetPropFlags = ts.getDeclarationModifierFlagsFromSymbol(targetProp);
if (sourcePropFlags & 8 /* Private */ || targetPropFlags & 8 /* Private */) {
var hasDifferingDeclarations = sourceProp.valueDeclaration !== targetProp.valueDeclaration;
- if (ts.getCheckFlags(sourceProp) & 512 /* ContainsPrivate */ && hasDifferingDeclarations) {
+ if (ts.getCheckFlags(sourceProp) & 1024 /* ContainsPrivate */ && hasDifferingDeclarations) {
if (reportErrors) {
reportError(ts.Diagnostics.Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1, symbolToString(sourceProp), typeToString(source));
}
@@ -43299,14 +43933,14 @@
}
return 0 /* False */;
}
- var related = isRelatedTo(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors);
+ // If the target comes from a partial union prop, allow `undefined` in the target type
+ var related = isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors);
if (!related) {
if (reportErrors) {
reportError(ts.Diagnostics.Types_of_property_0_are_incompatible, symbolToString(targetProp));
}
return 0 /* False */;
}
- result &= related;
// When checking for comparability, be more lenient with optional properties.
if (relation !== comparableRelation && sourceProp.flags & 16777216 /* Optional */ && !(targetProp.flags & 16777216 /* Optional */)) {
// TypeScript 1.0 spec (April 2014): 3.8.3
@@ -43321,17 +43955,113 @@
}
return 0 /* False */;
}
+ return related;
+ }
+ function propertiesRelatedTo(source, target, reportErrors, excludedProperties) {
+ if (relation === identityRelation) {
+ return propertiesIdenticalTo(source, target, excludedProperties);
+ }
+ var requireOptionalProperties = relation === subtypeRelation && !isObjectLiteralType(source) && !isEmptyArrayLiteralType(source) && !isTupleType(source);
+ var unmatchedProperty = getUnmatchedProperty(source, target, requireOptionalProperties, /*matchDiscriminantProperties*/ false);
+ if (unmatchedProperty) {
+ if (reportErrors) {
+ var props = ts.arrayFrom(getUnmatchedProperties(source, target, requireOptionalProperties, /*matchDiscriminantProperties*/ false));
+ var shouldSkipElaboration = false;
+ if (!headMessage || (headMessage.code !== ts.Diagnostics.Class_0_incorrectly_implements_interface_1.code &&
+ headMessage.code !== ts.Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass.code)) {
+ shouldSkipElaboration = true; // Retain top-level error for interface implementing issues, otherwise omit it
+ }
+ if (props.length === 1) {
+ var propName = symbolToString(unmatchedProperty);
+ reportError.apply(void 0, [ts.Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2, propName].concat(getTypeNamesForErrorDisplay(source, target)));
+ if (ts.length(unmatchedProperty.declarations)) {
+ associateRelatedInfo(ts.createDiagnosticForNode(unmatchedProperty.declarations[0], ts.Diagnostics._0_is_declared_here, propName));
+ }
+ if (shouldSkipElaboration) {
+ overrideNextErrorInfo = errorInfo;
+ }
+ }
+ else if (tryElaborateArrayLikeErrors(source, target, /*reportErrors*/ false)) {
+ if (props.length > 5) { // arbitrary cutoff for too-long list form
+ reportError(ts.Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2_and_3_more, typeToString(source), typeToString(target), ts.map(props.slice(0, 4), function (p) { return symbolToString(p); }).join(", "), props.length - 4);
+ }
+ else {
+ reportError(ts.Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2, typeToString(source), typeToString(target), ts.map(props, function (p) { return symbolToString(p); }).join(", "));
+ }
+ if (shouldSkipElaboration) {
+ overrideNextErrorInfo = errorInfo;
+ }
+ }
+ // ELSE: No array like or unmatched property error - just issue top level error (errorInfo = undefined)
+ }
+ return 0 /* False */;
+ }
+ if (isObjectLiteralType(target)) {
+ for (var _i = 0, _a = excludeProperties(getPropertiesOfType(source), excludedProperties); _i < _a.length; _i++) {
+ var sourceProp = _a[_i];
+ if (!getPropertyOfObjectType(target, sourceProp.escapedName)) {
+ var sourceType = getTypeOfSymbol(sourceProp);
+ if (!(sourceType === undefinedType || sourceType === undefinedWideningType)) {
+ if (reportErrors) {
+ reportError(ts.Diagnostics.Property_0_does_not_exist_on_type_1, symbolToString(sourceProp), typeToString(target));
+ }
+ return 0 /* False */;
+ }
+ }
+ }
+ }
+ var result = -1 /* True */;
+ if (isTupleType(target)) {
+ var targetRestType = getRestTypeOfTupleType(target);
+ if (targetRestType) {
+ if (!isTupleType(source)) {
+ return 0 /* False */;
+ }
+ var sourceRestType = getRestTypeOfTupleType(source);
+ if (sourceRestType && !isRelatedTo(sourceRestType, targetRestType, reportErrors)) {
+ if (reportErrors) {
+ reportError(ts.Diagnostics.Rest_signatures_are_incompatible);
+ }
+ return 0 /* False */;
+ }
+ var targetCount = getTypeReferenceArity(target) - 1;
+ var sourceCount = getTypeReferenceArity(source) - (sourceRestType ? 1 : 0);
+ for (var i = targetCount; i < sourceCount; i++) {
+ var related = isRelatedTo(source.typeArguments[i], targetRestType, reportErrors);
+ if (!related) {
+ if (reportErrors) {
+ reportError(ts.Diagnostics.Property_0_is_incompatible_with_rest_element_type, "" + i);
+ }
+ return 0 /* False */;
+ }
+ result &= related;
+ }
+ }
+ }
+ // We only call this for union target types when we're attempting to do excess property checking - in those cases, we want to get _all possible props_
+ // from the target union, across all members
+ var properties = target.flags & 1048576 /* Union */ ? getPossiblePropertiesOfUnionType(target) : getPropertiesOfType(target);
+ for (var _b = 0, _c = excludeProperties(properties, excludedProperties); _b < _c.length; _b++) {
+ var targetProp = _c[_b];
+ if (!(targetProp.flags & 4194304 /* Prototype */)) {
+ var sourceProp = getPropertyOfType(source, targetProp.escapedName);
+ if (sourceProp && sourceProp !== targetProp) {
+ var related = propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSymbol, reportErrors);
+ if (!related) {
+ return 0 /* False */;
+ }
+ result &= related;
}
}
}
return result;
}
- function propertiesIdenticalTo(source, target) {
+ function propertiesIdenticalTo(source, target, excludedProperties) {
if (!(source.flags & 524288 /* Object */ && target.flags & 524288 /* Object */)) {
return 0 /* False */;
}
- var sourceProperties = getPropertiesOfObjectType(source);
- var targetProperties = getPropertiesOfObjectType(target);
+ var sourceProperties = excludeProperties(getPropertiesOfObjectType(source), excludedProperties);
+ var targetProperties = excludeProperties(getPropertiesOfObjectType(target), excludedProperties);
if (sourceProperties.length !== targetProperties.length) {
return 0 /* False */;
}
@@ -43451,7 +44181,7 @@
var result = -1 /* True */;
for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) {
var prop = _a[_i];
- if (isIgnoredJsxProperty(source, prop, /*targetMemberType*/ undefined)) {
+ if (isIgnoredJsxProperty(source, prop)) {
continue;
}
// Skip over symbol-named members
@@ -43483,7 +44213,7 @@
return indexTypesIdenticalTo(source, target, kind);
}
var targetInfo = getIndexInfoOfType(target, kind);
- if (!targetInfo || targetInfo.type.flags & 3 /* AnyOrUnknown */ && !sourceIsPrimitive) {
+ if (!targetInfo || targetInfo.type.flags & 1 /* Any */ && !sourceIsPrimitive) {
// Index signature of type any permits assignment from everything but primitives
return -1 /* True */;
}
@@ -43623,8 +44353,11 @@
// The emptyArray singleton is used to signal a recursive invocation.
cache.variances = ts.emptyArray;
variances = [];
- for (var _i = 0, typeParameters_1 = typeParameters; _i < typeParameters_1.length; _i++) {
- var tp = typeParameters_1[_i];
+ var _loop_10 = function (tp) {
+ var unmeasurable = false;
+ var unreliable = false;
+ var oldHandler = outofbandVarianceMarkerHandler;
+ outofbandVarianceMarkerHandler = function (onlyUnreliable) { return onlyUnreliable ? unreliable = true : unmeasurable = true; };
// We first compare instantiations where the type parameter is replaced with
// marker types that have a known subtype relationship. From this we can infer
// invariance, covariance, contravariance or bivariance.
@@ -43639,7 +44372,26 @@
if (variance === 3 /* Bivariant */ && isTypeAssignableTo(createMarkerType(cache, tp, markerOtherType), typeWithSuper)) {
variance = 4 /* Independent */;
}
+ outofbandVarianceMarkerHandler = oldHandler;
+ if (unmeasurable || unreliable) {
+ if (unmeasurable) {
+ variance |= 8 /* Unmeasurable */;
+ }
+ if (unreliable) {
+ variance |= 16 /* Unreliable */;
+ }
+ var covariantID = getRelationKey(typeWithSub, typeWithSuper, assignableRelation);
+ var contravariantID = getRelationKey(typeWithSuper, typeWithSub, assignableRelation);
+ // We delete the results of these checks, as we want them to actually be run, see the `Unmeasurable` variance we cache,
+ // And then fall back to a structural result.
+ assignableRelation.delete(covariantID);
+ assignableRelation.delete(contravariantID);
+ }
variances.push(variance);
+ };
+ for (var _i = 0, typeParameters_1 = typeParameters; _i < typeParameters_1.length; _i++) {
+ var tp = typeParameters_1[_i];
+ _loop_10(tp);
}
cache.variances = variances;
}
@@ -43656,7 +44408,7 @@
// See comment at call in recursiveTypeRelatedTo for when this case matters.
function hasCovariantVoidArgument(typeArguments, variances) {
for (var i = 0; i < variances.length; i++) {
- if (variances[i] === 1 /* Covariant */ && typeArguments[i].flags & 16384 /* Void */) {
+ if ((variances[i] & 7 /* VarianceMask */) === 1 /* Covariant */ && typeArguments[i].flags & 16384 /* Void */) {
return true;
}
}
@@ -44082,6 +44834,30 @@
return strictNullChecks ? getGlobalNonNullableTypeInstantiation(type) : type;
}
/**
+ * Is source potentially coercible to target type under `==`.
+ * Assumes that `source` is a constituent of a union, hence
+ * the boolean literal flag on the LHS, but not on the RHS.
+ *
+ * This does not fully replicate the semantics of `==`. The
+ * intention is to catch cases that are clearly not right.
+ *
+ * Comparing (string | number) to number should not remove the
+ * string element.
+ *
+ * Comparing (string | number) to 1 will remove the string
+ * element, though this is not sound. This is a pragmatic
+ * choice.
+ *
+ * @see narrowTypeByEquality
+ *
+ * @param source
+ * @param target
+ */
+ function isCoercibleUnderDoubleEquals(source, target) {
+ return ((source.flags & (8 /* Number */ | 4 /* String */ | 512 /* BooleanLiteral */)) !== 0)
+ && ((target.flags & (8 /* Number */ | 4 /* String */ | 16 /* Boolean */)) !== 0);
+ }
+ /**
* Return true if type was inferred from an object literal, written as an object type literal, or is the shape of a module
* with no call or construct signatures.
*/
@@ -44217,26 +44993,34 @@
}
function getWidenedTypeWithContext(type, context) {
if (ts.getObjectFlags(type) & 393216 /* RequiresWidening */) {
+ if (context === undefined && type.widened) {
+ return type.widened;
+ }
+ var result = void 0;
if (type.flags & 98304 /* Nullable */) {
- return anyType;
+ result = anyType;
}
- if (isObjectLiteralType(type)) {
- return getWidenedTypeOfObjectLiteral(type, context);
+ else if (isObjectLiteralType(type)) {
+ result = getWidenedTypeOfObjectLiteral(type, context);
}
- if (type.flags & 1048576 /* Union */) {
+ else if (type.flags & 1048576 /* Union */) {
var unionContext_1 = context || createWideningContext(/*parent*/ undefined, /*propertyName*/ undefined, type.types);
var widenedTypes = ts.sameMap(type.types, function (t) { return t.flags & 98304 /* Nullable */ ? t : getWidenedTypeWithContext(t, unionContext_1); });
// Widening an empty object literal transitions from a highly restrictive type to
// a highly inclusive one. For that reason we perform subtype reduction here if the
// union includes empty object types (e.g. reducing {} | string to just {}).
- return getUnionType(widenedTypes, ts.some(widenedTypes, isEmptyObjectType) ? 2 /* Subtype */ : 1 /* Literal */);
+ result = getUnionType(widenedTypes, ts.some(widenedTypes, isEmptyObjectType) ? 2 /* Subtype */ : 1 /* Literal */);
}
- if (type.flags & 2097152 /* Intersection */) {
- return getIntersectionType(ts.sameMap(type.types, getWidenedType));
+ else if (type.flags & 2097152 /* Intersection */) {
+ result = getIntersectionType(ts.sameMap(type.types, getWidenedType));
}
- if (isArrayType(type) || isTupleType(type)) {
- return createTypeReference(type.target, ts.sameMap(type.typeArguments, getWidenedType));
+ else if (isArrayType(type) || isTupleType(type)) {
+ result = createTypeReference(type.target, ts.sameMap(type.typeArguments, getWidenedType));
}
+ if (result && context === undefined) {
+ type.widened = result;
+ }
+ return result || type;
}
return type;
}
@@ -44298,12 +45082,12 @@
}
var diagnostic;
switch (declaration.kind) {
- case 204 /* BinaryExpression */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 205 /* BinaryExpression */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
diagnostic = noImplicitAny ? ts.Diagnostics.Member_0_implicitly_has_an_1_type : ts.Diagnostics.Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage;
break;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
var param = declaration;
if (ts.isIdentifier(param.name) &&
(ts.isCallSignatureDeclaration(param.parent) || ts.isMethodSignature(param.parent) || ts.isFunctionTypeNode(param.parent)) &&
@@ -44318,30 +45102,30 @@
noImplicitAny ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage :
noImplicitAny ? ts.Diagnostics.Parameter_0_implicitly_has_an_1_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage;
break;
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type;
if (!noImplicitAny) {
// Don't issue a suggestion for binding elements since the codefix doesn't yet support them.
return;
}
break;
- case 294 /* JSDocFunctionType */:
+ case 295 /* JSDocFunctionType */:
error(declaration, ts.Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);
return;
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
if (noImplicitAny && !declaration.name) {
error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);
return;
}
diagnostic = noImplicitAny ? ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type : ts.Diagnostics._0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage;
break;
- case 181 /* MappedType */:
+ case 182 /* MappedType */:
if (noImplicitAny) {
error(declaration, ts.Diagnostics.Mapped_object_type_implicitly_has_an_any_template_type);
}
@@ -44461,7 +45245,7 @@
var objectFlags = ts.getObjectFlags(type);
return !!(type.flags & 63176704 /* Instantiable */ ||
objectFlags & 4 /* Reference */ && ts.forEach(type.typeArguments, couldContainTypeVariables) ||
- objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 2048 /* TypeLiteral */ | 32 /* Class */) ||
+ objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations ||
objectFlags & 32 /* Mapped */ ||
type.flags & 3145728 /* UnionOrIntersection */ && couldUnionOrIntersectionContainTypeVariables(type));
}
@@ -44509,10 +45293,18 @@
reverseMappedCache.set(key, type);
return type;
}
+ // We consider a type to be partially inferable if it isn't marked non-inferable or if it is
+ // an object literal type with at least one property of an inferable type. For example, an object
+ // literal { a: 123, b: x => true } is marked non-inferable because it contains a context sensitive
+ // arrow function, but is considered partially inferable because property 'a' has an inferable type.
+ function isPartiallyInferableType(type) {
+ return !(ts.getObjectFlags(type) & 524288 /* NonInferrableType */) ||
+ isObjectLiteralType(type) && ts.some(getPropertiesOfType(type), function (prop) { return isPartiallyInferableType(getTypeOfSymbol(prop)); });
+ }
function createReverseMappedType(source, target, constraint) {
- // If any property contains context sensitive functions that have been skipped, the source type
- // is incomplete and we can't infer a meaningful input type.
- if (ts.getObjectFlags(source) & 524288 /* NonInferrableType */ || getPropertiesOfType(source).length === 0 && !getIndexInfoOfType(source, 0 /* String */)) {
+ // We consider a source type reverse mappable if it has a string index signature or if
+ // it has one or more properties and is of a partially inferable type.
+ if (!(getIndexInfoOfType(source, 0 /* String */) || getPropertiesOfType(source).length !== 0 && isPartiallyInferableType(source))) {
return undefined;
}
// For arrays and tuples we infer new arrays and tuples where the reverse mapping has been
@@ -44542,20 +45334,20 @@
var templateType = getTemplateTypeFromMappedType(target);
var inference = createInferenceInfo(typeParameter);
inferTypes([inference], sourceType, templateType);
- return getTypeFromInference(inference);
+ return getTypeFromInference(inference) || unknownType;
}
function getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties) {
- var properties, _i, properties_3, targetProp, sourceProp, targetType, sourceType;
+ var properties, _i, properties_2, targetProp, sourceProp, targetType, sourceType;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
- properties = target.flags & 2097152 /* Intersection */ ? getPropertiesOfUnionOrIntersectionType(target) : getPropertiesOfObjectType(target);
- _i = 0, properties_3 = properties;
+ properties = target.flags & 1048576 /* Union */ ? getPossiblePropertiesOfUnionType(target) : getPropertiesOfType(target);
+ _i = 0, properties_2 = properties;
_a.label = 1;
case 1:
- if (!(_i < properties_3.length)) return [3 /*break*/, 6];
- targetProp = properties_3[_i];
- if (!(requireOptionalProperties || !(targetProp.flags & 16777216 /* Optional */))) return [3 /*break*/, 5];
+ if (!(_i < properties_2.length)) return [3 /*break*/, 6];
+ targetProp = properties_2[_i];
+ if (!(requireOptionalProperties || !(targetProp.flags & 16777216 /* Optional */ || ts.getCheckFlags(targetProp) & 48 /* Partial */))) return [3 /*break*/, 5];
sourceProp = getPropertyOfType(source, targetProp.escapedName);
if (!!sourceProp) return [3 /*break*/, 3];
return [4 /*yield*/, targetProp];
@@ -44596,7 +45388,7 @@
function getTypeFromInference(inference) {
return inference.candidates ? getUnionType(inference.candidates, 2 /* Subtype */) :
inference.contraCandidates ? getIntersectionType(inference.contraCandidates) :
- emptyObjectType;
+ undefined;
}
function inferTypes(inferences, originalSource, originalTarget, priority, contravariant) {
if (priority === void 0) { priority = 0; }
@@ -44670,6 +45462,9 @@
target = removeTypesFromUnionOrIntersection(target, matchingTypes);
}
}
+ else if (target.flags & (8388608 /* IndexedAccess */ | 33554432 /* Substitution */)) {
+ target = getActualTypeVariable(target);
+ }
if (target.flags & 8650752 /* TypeVariable */) {
// If target is a type parameter, make an inference, unless the source type contains
// the anyFunctionType (the wildcard type that's used to avoid contextually typing functions).
@@ -44678,7 +45473,7 @@
// not contain anyFunctionType when we come back to this argument for its second round
// of inference. Also, we exclude inferences for silentNeverType (which is used as a wildcard
// when constructing types from type parameters that had no inference candidates).
- if (ts.getObjectFlags(source) & 524288 /* NonInferrableType */ || source === silentNeverType || (priority & 8 /* ReturnType */ && (source === autoType || source === autoArrayType))) {
+ if (ts.getObjectFlags(source) & 524288 /* NonInferrableType */ || source === silentNeverType || (priority & 16 /* ReturnType */ && (source === autoType || source === autoArrayType))) {
return;
}
var inference = getInferenceInfoForType(target);
@@ -44705,7 +45500,7 @@
inference.inferredType = undefined;
}
}
- if (!(priority & 8 /* ReturnType */) && target.flags & 262144 /* TypeParameter */ && inference.topLevel && !isTypeParameterAtTopLevel(originalTarget, target)) {
+ if (!(priority & 16 /* ReturnType */) && target.flags & 262144 /* TypeParameter */ && inference.topLevel && !isTypeParameterAtTopLevel(originalTarget, target)) {
inference.topLevel = false;
inference.inferredType = undefined;
}
@@ -44714,16 +45509,16 @@
}
else {
// Infer to the simplified version of an indexed access, if possible, to (hopefully) expose more bare type parameters to the inference engine
- var simplified = getSimplifiedType(target);
+ var simplified = getSimplifiedType(target, /*writing*/ false);
if (simplified !== target) {
inferFromTypesOnce(source, simplified);
}
else if (target.flags & 8388608 /* IndexedAccess */) {
- var indexType = getSimplifiedType(target.indexType);
+ var indexType = getSimplifiedType(target.indexType, /*writing*/ false);
// Generally simplifications of instantiable indexes are avoided to keep relationship checking correct, however if our target is an access, we can consider
// that key of that access to be "instantiated", since we're looking to find the infernce goal in any way we can.
if (indexType.flags & 63176704 /* Instantiable */) {
- var simplified_1 = distributeIndexOverObjectType(getSimplifiedType(target.objectType), indexType);
+ var simplified_1 = distributeIndexOverObjectType(getSimplifiedType(target.objectType, /*writing*/ false), indexType, /*writing*/ false);
if (simplified_1 && simplified_1 !== target) {
inferFromTypesOnce(source, simplified_1);
}
@@ -44731,9 +45526,6 @@
}
}
}
- else if (target.flags & 33554432 /* Substitution */) {
- inferFromTypes(source, target.typeVariable);
- }
if (ts.getObjectFlags(source) & 4 /* Reference */ && ts.getObjectFlags(target) & 4 /* Reference */ && source.target === target.target) {
// If source and target are references to the same generic type, infer from type arguments
var sourceTypes = source.typeArguments || ts.emptyArray;
@@ -44741,7 +45533,7 @@
var count = sourceTypes.length < targetTypes.length ? sourceTypes.length : targetTypes.length;
var variances = getVariances(source.target);
for (var i = 0; i < count; i++) {
- if (i < variances.length && variances[i] === 2 /* Contravariant */) {
+ if (i < variances.length && (variances[i] & 7 /* VarianceMask */) === 2 /* Contravariant */) {
inferFromContravariantTypes(sourceTypes[i], targetTypes[i]);
}
else {
@@ -44758,7 +45550,7 @@
var empty = createEmptyObjectTypeFromStringLiteral(source);
contravariant = !contravariant;
var savePriority = priority;
- priority |= 16 /* LiteralKeyof */;
+ priority |= 32 /* LiteralKeyof */;
inferFromTypes(empty, target.type);
priority = savePriority;
contravariant = !contravariant;
@@ -44770,12 +45562,12 @@
else if (source.flags & 16777216 /* Conditional */ && target.flags & 16777216 /* Conditional */) {
inferFromTypes(source.checkType, target.checkType);
inferFromTypes(source.extendsType, target.extendsType);
- inferFromTypes(source.trueType, target.trueType);
- inferFromTypes(source.falseType, target.falseType);
+ inferFromTypes(getTrueTypeFromConditionalType(source), getTrueTypeFromConditionalType(target));
+ inferFromTypes(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target));
}
else if (target.flags & 16777216 /* Conditional */ && !contravariant) {
- inferFromTypes(source, target.trueType);
- inferFromTypes(source, target.falseType);
+ inferFromTypes(source, getTrueTypeFromConditionalType(target));
+ inferFromTypes(source, getFalseTypeFromConditionalType(target));
}
else if (target.flags & 3145728 /* UnionOrIntersection */) {
// We infer from types that are not naked type variables first so that inferences we
@@ -44816,7 +45608,7 @@
}
}
else {
- if (!(priority & 32 /* NoConstraints */ && source.flags & (2097152 /* Intersection */ | 63176704 /* Instantiable */))) {
+ if (!(priority & 64 /* NoConstraints */ && source.flags & (2097152 /* Intersection */ | 63176704 /* Instantiable */))) {
var apparentSource = getApparentType(source);
// getApparentType can return _any_ type, since an indexed access or conditional may simplify to any other type.
// If that occurs and it doesn't simplify to an object or intersection, we'll need to restart `inferFromTypes`
@@ -44869,7 +45661,7 @@
}
}
function inferFromContravariantTypes(source, target) {
- if (strictFunctionTypes || priority & 64 /* AlwaysStrict */) {
+ if (strictFunctionTypes || priority & 128 /* AlwaysStrict */) {
contravariant = !contravariant;
inferFromTypes(source, target);
contravariant = !contravariant;
@@ -44908,7 +45700,11 @@
var inferredType = inferTypeForHomomorphicMappedType(source, target, constraintType);
if (inferredType) {
var savePriority = priority;
- priority |= 2 /* HomomorphicMappedType */;
+ // We assign a lower priority to inferences made from types containing non-inferrable
+ // types because we may only have a partial result (i.e. we may have failed to make
+ // reverse inferences for some properties).
+ priority |= ts.getObjectFlags(source) & 524288 /* NonInferrableType */ ?
+ 4 /* PartialHomomorphicMappedType */ : 2 /* HomomorphicMappedType */;
inferFromTypes(inferredType, inference.typeParameter);
priority = savePriority;
}
@@ -44919,7 +45715,7 @@
// We're inferring from some source type S to a mapped type { [P in K]: X }, where K is a type
// parameter. First infer from 'keyof S' to K.
var savePriority = priority;
- priority |= 4 /* MappedTypeConstraint */;
+ priority |= 8 /* MappedTypeConstraint */;
inferFromTypes(getIndexType(source), constraintType);
priority = savePriority;
// If K is constrained to a type C, also infer to C. Thus, for a mapped type { [P in K]: X },
@@ -44932,11 +45728,11 @@
}
// If no inferences can be made to K's constraint, infer from a union of the property types
// in the source to the template type X.
- var valueTypes = ts.compact([
- getIndexTypeOfType(source, 0 /* String */),
- getIndexTypeOfType(source, 1 /* Number */)
- ].concat(ts.map(getPropertiesOfType(source), getTypeOfSymbol)));
- inferFromTypes(getUnionType(valueTypes), getTemplateTypeFromMappedType(target));
+ var propTypes = ts.map(getPropertiesOfType(source), getTypeOfSymbol);
+ var stringIndexType = getIndexTypeOfType(source, 0 /* String */);
+ var numberIndexInfo = getNonEnumNumberIndexInfo(source);
+ var numberIndexType = numberIndexInfo && numberIndexInfo.type;
+ inferFromTypes(getUnionType(ts.append(ts.append(propTypes, stringIndexType), numberIndexType)), getTemplateTypeFromMappedType(target));
return true;
}
return false;
@@ -44990,8 +45786,8 @@
}
}
var properties = getPropertiesOfObjectType(target);
- for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) {
- var targetProp = properties_4[_i];
+ for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) {
+ var targetProp = properties_3[_i];
var sourceProp = getPropertyOfType(source, targetProp.escapedName);
if (sourceProp) {
inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp));
@@ -45014,7 +45810,7 @@
var saveBivariant = bivariant;
var kind = target.declaration ? target.declaration.kind : 0 /* Unknown */;
// Once we descend into a bivariant signature we remain bivariant for all nested inferences
- bivariant = bivariant || kind === 156 /* MethodDeclaration */ || kind === 155 /* MethodSignature */ || kind === 157 /* Constructor */;
+ bivariant = bivariant || kind === 157 /* MethodDeclaration */ || kind === 156 /* MethodSignature */ || kind === 158 /* Constructor */;
applyToParameterTypes(source, target, inferFromContravariantTypes);
bivariant = saveBivariant;
}
@@ -45081,7 +45877,7 @@
return candidates;
}
function getContravariantInference(inference) {
- return inference.priority & 28 /* PriorityImpliesCombination */ ? getIntersectionType(inference.contraCandidates) : getCommonSubtype(inference.contraCandidates);
+ return inference.priority & 56 /* PriorityImpliesCombination */ ? getIntersectionType(inference.contraCandidates) : getCommonSubtype(inference.contraCandidates);
}
function getCovariantInference(inference, signature) {
// Extract all object literal types and replace them with a single widened and normalized type.
@@ -45098,15 +45894,15 @@
candidates;
// If all inferences were made from a position that implies a combined result, infer a union type.
// Otherwise, infer a common supertype.
- var unwidenedType = inference.priority & 28 /* PriorityImpliesCombination */ ?
+ var unwidenedType = inference.priority & 56 /* PriorityImpliesCombination */ ?
getUnionType(baseCandidates, 2 /* Subtype */) :
getCommonSupertype(baseCandidates);
return getWidenedType(unwidenedType);
}
function getInferredType(context, index) {
var inference = context.inferences[index];
- var inferredType = inference.inferredType;
- if (!inferredType) {
+ if (!inference.inferredType) {
+ var inferredType = void 0;
var signature = context.signature;
if (signature) {
var inferredCovariantType = inference.candidates ? getCovariantInference(inference, signature) : undefined;
@@ -45137,27 +45933,24 @@
// parameter should be instantiated to the empty object type.
inferredType = instantiateType(defaultType, combineTypeMappers(createBackreferenceMapper(context, index), context.nonFixingMapper));
}
- else {
- inferredType = getDefaultTypeArgumentType(!!(context.flags & 2 /* AnyDefault */));
- }
}
}
else {
inferredType = getTypeFromInference(inference);
}
- inference.inferredType = inferredType;
+ inference.inferredType = inferredType || getDefaultTypeArgumentType(!!(context.flags & 2 /* AnyDefault */));
var constraint = getConstraintOfTypeParameter(inference.typeParameter);
if (constraint) {
var instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
- if (!context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
+ if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
inference.inferredType = inferredType = instantiatedConstraint;
}
}
}
- return inferredType;
+ return inference.inferredType;
}
function getDefaultTypeArgumentType(isInJavaScriptFile) {
- return isInJavaScriptFile ? anyType : emptyObjectType;
+ return isInJavaScriptFile ? anyType : unknownType;
}
function getInferredTypes(context) {
var result = [];
@@ -45167,8 +45960,8 @@
return result;
}
// EXPRESSION TYPE CHECKING
- function getCannotFindNameDiagnosticForName(name) {
- switch (name) {
+ function getCannotFindNameDiagnosticForName(node) {
+ switch (node.escapedText) {
case "document":
case "console":
return ts.Diagnostics.Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_include_dom;
@@ -45199,14 +45992,20 @@
case "Iterator":
case "AsyncIterator":
return ts.Diagnostics.Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later;
- default: return ts.Diagnostics.Cannot_find_name_0;
+ default:
+ if (node.parent.kind === 277 /* ShorthandPropertyAssignment */) {
+ return ts.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer;
+ }
+ else {
+ return ts.Diagnostics.Cannot_find_name_0;
+ }
}
}
function getResolvedSymbol(node) {
var links = getNodeLinks(node);
if (!links.resolvedSymbol) {
links.resolvedSymbol = !ts.nodeIsMissing(node) &&
- resolveName(node, node.escapedText, 67220415 /* Value */ | 1048576 /* ExportValue */, getCannotFindNameDiagnosticForName(node.escapedText), node, !ts.isWriteOnlyAccess(node),
+ resolveName(node, node.escapedText, 67220415 /* Value */ | 1048576 /* ExportValue */, getCannotFindNameDiagnosticForName(node), node, !ts.isWriteOnlyAccess(node),
/*excludeGlobals*/ false, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_1) || unknownSymbol;
}
return links.resolvedSymbol;
@@ -45215,7 +46014,7 @@
// TypeScript 1.0 spec (April 2014): 3.6.3
// A type query consists of the keyword typeof followed by an expression.
// The expression is restricted to a single identifier or a sequence of identifiers separated by periods
- return !!ts.findAncestor(node, function (n) { return n.kind === 167 /* TypeQuery */ ? true : n.kind === 72 /* Identifier */ || n.kind === 148 /* QualifiedName */ ? false : "quit"; });
+ return !!ts.findAncestor(node, function (n) { return n.kind === 168 /* TypeQuery */ ? true : n.kind === 73 /* Identifier */ || n.kind === 149 /* QualifiedName */ ? false : "quit"; });
}
// Return the flow cache key for a "dotted name" (i.e. a sequence of identifiers
// separated by dots). The key consists of the id of the symbol referenced by the
@@ -45223,21 +46022,21 @@
// The result is undefined if the reference isn't a dotted name. We prefix nodes
// occurring in an apparent type position with '@' because the control flow type
// of such nodes may be based on the apparent type instead of the declared type.
- function getFlowCacheKey(node) {
+ function getFlowCacheKey(node, declaredType, initialType, flowContainer) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
var symbol = getResolvedSymbol(node);
- return symbol !== unknownSymbol ? (isConstraintPosition(node) ? "@" : "") + getSymbolId(symbol) : undefined;
- case 100 /* ThisKeyword */:
+ return symbol !== unknownSymbol ? (flowContainer ? getNodeId(flowContainer) : "-1") + "|" + getTypeId(declaredType) + "|" + getTypeId(initialType) + "|" + (isConstraintPosition(node) ? "@" : "") + getSymbolId(symbol) : undefined;
+ case 101 /* ThisKeyword */:
return "0";
- case 213 /* NonNullExpression */:
- case 195 /* ParenthesizedExpression */:
- return getFlowCacheKey(node.expression);
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 214 /* NonNullExpression */:
+ case 196 /* ParenthesizedExpression */:
+ return getFlowCacheKey(node.expression, declaredType, initialType, flowContainer);
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
var propName = getAccessedPropertyName(node);
if (propName !== undefined) {
- var key = getFlowCacheKey(node.expression);
+ var key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer);
return key && key + "." + propName;
}
}
@@ -45245,24 +46044,24 @@
}
function isMatchingReference(source, target) {
switch (target.kind) {
- case 195 /* ParenthesizedExpression */:
- case 213 /* NonNullExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 214 /* NonNullExpression */:
return isMatchingReference(source, target.expression);
}
switch (source.kind) {
- case 72 /* Identifier */:
- return target.kind === 72 /* Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) ||
- (target.kind === 237 /* VariableDeclaration */ || target.kind === 186 /* BindingElement */) &&
+ case 73 /* Identifier */:
+ return target.kind === 73 /* Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) ||
+ (target.kind === 238 /* VariableDeclaration */ || target.kind === 187 /* BindingElement */) &&
getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target);
- case 100 /* ThisKeyword */:
- return target.kind === 100 /* ThisKeyword */;
- case 98 /* SuperKeyword */:
- return target.kind === 98 /* SuperKeyword */;
- case 213 /* NonNullExpression */:
- case 195 /* ParenthesizedExpression */:
+ case 101 /* ThisKeyword */:
+ return target.kind === 101 /* ThisKeyword */;
+ case 99 /* SuperKeyword */:
+ return target.kind === 99 /* SuperKeyword */;
+ case 214 /* NonNullExpression */:
+ case 196 /* ParenthesizedExpression */:
return isMatchingReference(source.expression, target);
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return ts.isAccessExpression(target) &&
getAccessedPropertyName(source) === getAccessedPropertyName(target) &&
isMatchingReference(source.expression, target.expression);
@@ -45270,7 +46069,7 @@
return false;
}
function getAccessedPropertyName(access) {
- return access.kind === 189 /* PropertyAccessExpression */ ? access.name.escapedText :
+ return access.kind === 190 /* PropertyAccessExpression */ ? access.name.escapedText :
ts.isStringLiteral(access.argumentExpression) || ts.isNumericLiteral(access.argumentExpression) ? ts.escapeLeadingUnderscores(access.argumentExpression.text) :
undefined;
}
@@ -45295,7 +46094,7 @@
isDiscriminantProperty(getDeclaredTypeOfReference(target.expression), name);
}
function getDeclaredTypeOfReference(expr) {
- if (expr.kind === 72 /* Identifier */) {
+ if (expr.kind === 73 /* Identifier */) {
return getTypeOfSymbol(getResolvedSymbol(expr));
}
if (ts.isAccessExpression(expr)) {
@@ -45317,7 +46116,7 @@
if (prop && ts.getCheckFlags(prop) & 2 /* SyntheticProperty */) {
if (prop.isDiscriminantProperty === undefined) {
prop.isDiscriminantProperty =
- (prop.checkFlags & 96 /* Discriminant */) === 96 /* Discriminant */ &&
+ (prop.checkFlags & 192 /* Discriminant */) === 192 /* Discriminant */ &&
isDiscriminantType(getTypeOfSymbol(prop));
}
return !!prop.isDiscriminantProperty;
@@ -45326,7 +46125,7 @@
return false;
}
function isSyntheticThisPropertyAccess(expr) {
- return ts.isAccessExpression(expr) && expr.expression.kind === 100 /* ThisKeyword */ && !!(expr.expression.flags & 8 /* Synthesized */);
+ return ts.isAccessExpression(expr) && expr.expression.kind === 101 /* ThisKeyword */ && !!(expr.expression.flags & 8 /* Synthesized */);
}
function findDiscriminantProperties(sourceProperties, target) {
var result;
@@ -45354,7 +46153,7 @@
}
}
}
- if (callExpression.expression.kind === 189 /* PropertyAccessExpression */ &&
+ if (callExpression.expression.kind === 190 /* PropertyAccessExpression */ &&
isOrContainsMatchingReference(reference, callExpression.expression.expression)) {
return true;
}
@@ -45473,7 +46272,7 @@
return strictNullChecks ? 7888800 /* ObjectStrictFacts */ : 16736160 /* ObjectFacts */;
}
if (flags & 63176704 /* Instantiable */) {
- return getTypeFacts(getBaseConstraintOfType(type) || emptyObjectType);
+ return getTypeFacts(getBaseConstraintOfType(type) || unknownType);
}
if (flags & 3145728 /* UnionOrIntersection */) {
return getTypeFactsOfTypes(type.types);
@@ -45509,15 +46308,15 @@
return createArrayType(checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false, /*allowAsyncIterables*/ false) || errorType);
}
function getAssignedTypeOfBinaryExpression(node) {
- var isDestructuringDefaultAssignment = node.parent.kind === 187 /* ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) ||
- node.parent.kind === 275 /* PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent);
+ var isDestructuringDefaultAssignment = node.parent.kind === 188 /* ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) ||
+ node.parent.kind === 276 /* PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent);
return isDestructuringDefaultAssignment ?
getTypeWithDefault(getAssignedType(node), node.right) :
getTypeOfExpression(node.right);
}
function isDestructuringAssignmentTarget(parent) {
- return parent.parent.kind === 204 /* BinaryExpression */ && parent.parent.left === parent ||
- parent.parent.kind === 227 /* ForOfStatement */ && parent.parent.initializer === parent;
+ return parent.parent.kind === 205 /* BinaryExpression */ && parent.parent.left === parent ||
+ parent.parent.kind === 228 /* ForOfStatement */ && parent.parent.initializer === parent;
}
function getAssignedTypeOfArrayLiteralElement(node, element) {
return getTypeOfDestructuredArrayElement(getAssignedType(node), node.elements.indexOf(element));
@@ -45534,21 +46333,21 @@
function getAssignedType(node) {
var parent = node.parent;
switch (parent.kind) {
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return stringType;
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return checkRightHandSideOfForOf(parent.expression, parent.awaitModifier) || errorType;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return getAssignedTypeOfBinaryExpression(parent);
- case 198 /* DeleteExpression */:
+ case 199 /* DeleteExpression */:
return undefinedType;
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return getAssignedTypeOfArrayLiteralElement(parent, node);
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
return getAssignedTypeOfSpreadExpression(parent);
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return getAssignedTypeOfPropertyAssignment(parent);
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return getAssignedTypeOfShorthandPropertyAssignment(parent);
}
return errorType;
@@ -45556,7 +46355,7 @@
function getInitialTypeOfBindingElement(node) {
var pattern = node.parent;
var parentType = getInitialType(pattern.parent);
- var type = pattern.kind === 184 /* ObjectBindingPattern */ ?
+ var type = pattern.kind === 185 /* ObjectBindingPattern */ ?
getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) :
!node.dotDotDotToken ?
getTypeOfDestructuredArrayElement(parentType, pattern.elements.indexOf(node)) :
@@ -45574,37 +46373,37 @@
if (node.initializer) {
return getTypeOfInitializer(node.initializer);
}
- if (node.parent.parent.kind === 226 /* ForInStatement */) {
+ if (node.parent.parent.kind === 227 /* ForInStatement */) {
return stringType;
}
- if (node.parent.parent.kind === 227 /* ForOfStatement */) {
+ if (node.parent.parent.kind === 228 /* ForOfStatement */) {
return checkRightHandSideOfForOf(node.parent.parent.expression, node.parent.parent.awaitModifier) || errorType;
}
return errorType;
}
function getInitialType(node) {
- return node.kind === 237 /* VariableDeclaration */ ?
+ return node.kind === 238 /* VariableDeclaration */ ?
getInitialTypeOfVariableDeclaration(node) :
getInitialTypeOfBindingElement(node);
}
function getInitialOrAssignedType(node, reference) {
- return getConstraintForLocation(node.kind === 237 /* VariableDeclaration */ || node.kind === 186 /* BindingElement */ ?
+ return getConstraintForLocation(node.kind === 238 /* VariableDeclaration */ || node.kind === 187 /* BindingElement */ ?
getInitialType(node) :
getAssignedType(node), reference);
}
function isEmptyArrayAssignment(node) {
- return node.kind === 237 /* VariableDeclaration */ && node.initializer &&
+ return node.kind === 238 /* VariableDeclaration */ && node.initializer &&
isEmptyArrayLiteral(node.initializer) ||
- node.kind !== 186 /* BindingElement */ && node.parent.kind === 204 /* BinaryExpression */ &&
+ node.kind !== 187 /* BindingElement */ && node.parent.kind === 205 /* BinaryExpression */ &&
isEmptyArrayLiteral(node.parent.right);
}
function getReferenceCandidate(node) {
switch (node.kind) {
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return getReferenceCandidate(node.expression);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
switch (node.operatorToken.kind) {
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
return getReferenceCandidate(node.left);
case 27 /* CommaToken */:
return getReferenceCandidate(node.right);
@@ -45614,13 +46413,13 @@
}
function getReferenceRoot(node) {
var parent = node.parent;
- return parent.kind === 195 /* ParenthesizedExpression */ ||
- parent.kind === 204 /* BinaryExpression */ && parent.operatorToken.kind === 59 /* EqualsToken */ && parent.left === node ||
- parent.kind === 204 /* BinaryExpression */ && parent.operatorToken.kind === 27 /* CommaToken */ && parent.right === node ?
+ return parent.kind === 196 /* ParenthesizedExpression */ ||
+ parent.kind === 205 /* BinaryExpression */ && parent.operatorToken.kind === 60 /* EqualsToken */ && parent.left === node ||
+ parent.kind === 205 /* BinaryExpression */ && parent.operatorToken.kind === 27 /* CommaToken */ && parent.right === node ?
getReferenceRoot(parent) : node;
}
function getTypeOfSwitchClause(clause) {
- if (clause.kind === 271 /* CaseClause */) {
+ if (clause.kind === 272 /* CaseClause */) {
return getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression));
}
return neverType;
@@ -45642,7 +46441,7 @@
var witnesses = [];
for (var _i = 0, _a = switchStatement.caseBlock.clauses; _i < _a.length; _i++) {
var clause = _a[_i];
- if (clause.kind === 271 /* CaseClause */) {
+ if (clause.kind === 272 /* CaseClause */) {
if (clause.expression.kind === 10 /* StringLiteral */) {
witnesses.push(clause.expression.text);
continue;
@@ -45688,6 +46487,9 @@
}
return f(type) ? type : neverType;
}
+ function countTypes(type) {
+ return type.flags & 1048576 /* Union */ ? type.types.length : 1;
+ }
function mapType(type, mapper, noReductions) {
if (type.flags & 131072 /* Never */) {
return type;
@@ -45695,25 +46497,20 @@
if (!(type.flags & 1048576 /* Union */)) {
return mapper(type);
}
- var types = type.types;
- var mappedType;
var mappedTypes;
- for (var _i = 0, types_13 = types; _i < types_13.length; _i++) {
- var current = types_13[_i];
- var t = mapper(current);
- if (t) {
- if (!mappedType) {
- mappedType = t;
- }
- else if (!mappedTypes) {
- mappedTypes = [mappedType, t];
+ for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
+ var t = _a[_i];
+ var mapped = mapper(t);
+ if (mapped) {
+ if (!mappedTypes) {
+ mappedTypes = [mapped];
}
else {
- mappedTypes.push(t);
+ mappedTypes.push(mapped);
}
}
}
- return mappedTypes ? getUnionType(mappedTypes, noReductions ? 0 /* None */ : 1 /* Literal */) : mappedType;
+ return mappedTypes && getUnionType(mappedTypes, noReductions ? 0 /* None */ : 1 /* Literal */);
}
function extractTypesOfKind(type, kind) {
return filterType(type, function (t) { return (t.flags & kind) !== 0; });
@@ -45781,8 +46578,8 @@
}
function isEvolvingArrayTypeList(types) {
var hasEvolvingArrayType = false;
- for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
- var t = types_14[_i];
+ for (var _i = 0, types_13 = types; _i < types_13.length; _i++) {
+ var t = types_13[_i];
if (!(t.flags & 131072 /* Never */)) {
if (!(ts.getObjectFlags(t) & 256 /* EvolvingArray */)) {
return false;
@@ -45805,12 +46602,12 @@
function isEvolvingArrayOperationTarget(node) {
var root = getReferenceRoot(node);
var parent = root.parent;
- var isLengthPushOrUnshift = parent.kind === 189 /* PropertyAccessExpression */ && (parent.name.escapedText === "length" ||
- parent.parent.kind === 191 /* CallExpression */ && ts.isPushOrUnshiftIdentifier(parent.name));
- var isElementAssignment = parent.kind === 190 /* ElementAccessExpression */ &&
+ var isLengthPushOrUnshift = parent.kind === 190 /* PropertyAccessExpression */ && (parent.name.escapedText === "length" ||
+ parent.parent.kind === 192 /* CallExpression */ && ts.isPushOrUnshiftIdentifier(parent.name));
+ var isElementAssignment = parent.kind === 191 /* ElementAccessExpression */ &&
parent.expression === root &&
- parent.parent.kind === 204 /* BinaryExpression */ &&
- parent.parent.operatorToken.kind === 59 /* EqualsToken */ &&
+ parent.parent.kind === 205 /* BinaryExpression */ &&
+ parent.parent.operatorToken.kind === 60 /* EqualsToken */ &&
parent.parent.left === parent &&
!ts.isAssignmentTarget(parent.parent) &&
isTypeAssignableToKind(getTypeOfExpression(parent.argumentExpression), 296 /* NumberLike */);
@@ -45824,7 +46621,7 @@
return links.maybeTypePredicate;
}
function getMaybeTypePredicate(node) {
- if (node.expression.kind !== 98 /* SuperKeyword */) {
+ if (node.expression.kind !== 99 /* SuperKeyword */) {
var funcType = checkNonNullExpression(node.expression);
if (funcType !== silentNeverType) {
var apparentType = getApparentType(funcType);
@@ -45842,6 +46639,7 @@
function getFlowTypeOfReference(reference, declaredType, initialType, flowContainer, couldBeUninitialized) {
if (initialType === void 0) { initialType = declaredType; }
var key;
+ var keySet = false;
var flowDepth = 0;
if (flowAnalysisDisabled) {
return errorType;
@@ -45857,10 +46655,17 @@
// on empty arrays are possible without implicit any errors and new element types can be inferred without
// type mismatch errors.
var resultType = ts.getObjectFlags(evolvedType) & 256 /* EvolvingArray */ && isEvolvingArrayOperationTarget(reference) ? autoArrayType : finalizeEvolvingArrayType(evolvedType);
- if (reference.parent && reference.parent.kind === 213 /* NonNullExpression */ && getTypeWithFacts(resultType, 2097152 /* NEUndefinedOrNull */).flags & 131072 /* Never */) {
+ if (reference.parent && reference.parent.kind === 214 /* NonNullExpression */ && getTypeWithFacts(resultType, 2097152 /* NEUndefinedOrNull */).flags & 131072 /* Never */) {
return declaredType;
}
return resultType;
+ function getOrSetCacheKey() {
+ if (keySet) {
+ return key;
+ }
+ keySet = true;
+ return key = getFlowCacheKey(reference, declaredType, initialType, flowContainer);
+ }
function getTypeAtFlowNode(flow) {
if (flowDepth === 2000) {
// We have made 2000 recursive invocations. To avoid overflowing the call stack we report an error
@@ -45872,6 +46677,15 @@
flowDepth++;
while (true) {
var flags = flow.flags;
+ if (flags & 8192 /* Cached */) {
+ var key_2 = getOrSetCacheKey();
+ if (key_2) {
+ var id = getFlowNodeId(flow);
+ if (flowAssignmentKeys[id] === key_2) {
+ return flowAssignmentTypes[id];
+ }
+ }
+ }
if (flags & 1024 /* Shared */) {
// We cache results of flow type resolution for shared nodes that were previously visited in
// the same getFlowTypeOfReference invocation. A node is considered shared when it is the
@@ -45902,6 +46716,15 @@
flow = flow.antecedent;
continue;
}
+ else if (flowLoopCount === flowLoopStart) { // Only cache assignments when not within loop analysis
+ var key_3 = getOrSetCacheKey();
+ if (key_3 && !isIncomplete(type)) {
+ flow.flags |= 8192 /* Cached */;
+ var id = getFlowNodeId(flow);
+ flowAssignmentKeys[id] = key_3;
+ flowAssignmentTypes[id] = type;
+ }
+ }
}
else if (flags & 96 /* Condition */) {
type = getTypeAtFlowCondition(flow);
@@ -45929,9 +46752,9 @@
// Check if we should continue with the control flow of the containing function.
var container = flow.container;
if (container && container !== flowContainer &&
- reference.kind !== 189 /* PropertyAccessExpression */ &&
- reference.kind !== 190 /* ElementAccessExpression */ &&
- reference.kind !== 100 /* ThisKeyword */) {
+ reference.kind !== 190 /* PropertyAccessExpression */ &&
+ reference.kind !== 191 /* ElementAccessExpression */ &&
+ reference.kind !== 101 /* ThisKeyword */) {
flow = container.flowNode;
continue;
}
@@ -45983,14 +46806,14 @@
// in which case we continue control flow analysis back to the function's declaration
if (ts.isVariableDeclaration(node) && (ts.isInJSFile(node) || ts.isVarConst(node))) {
var init = ts.getDeclaredExpandoInitializer(node);
- if (init && (init.kind === 196 /* FunctionExpression */ || init.kind === 197 /* ArrowFunction */)) {
+ if (init && (init.kind === 197 /* FunctionExpression */ || init.kind === 198 /* ArrowFunction */)) {
return getTypeAtFlowNode(flow.antecedent);
}
}
return declaredType;
}
// for (const _ in ref) acts as a nonnull on ref
- if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 226 /* ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) {
+ if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 227 /* ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) {
return getNonNullableTypeIfNeeded(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent)));
}
// Assignment doesn't affect reference
@@ -45999,7 +46822,7 @@
function getTypeAtFlowArrayMutation(flow) {
if (declaredType === autoType || declaredType === autoArrayType) {
var node = flow.node;
- var expr = node.kind === 191 /* CallExpression */ ?
+ var expr = node.kind === 192 /* CallExpression */ ?
node.expression.expression :
node.left.expression;
if (isMatchingReference(reference, getReferenceCandidate(expr))) {
@@ -46007,7 +46830,7 @@
var type = getTypeFromFlowType(flowType);
if (ts.getObjectFlags(type) & 256 /* EvolvingArray */) {
var evolvedType_1 = type;
- if (node.kind === 191 /* CallExpression */) {
+ if (node.kind === 192 /* CallExpression */) {
for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) {
var arg = _a[_i];
evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg);
@@ -46060,7 +46883,7 @@
else if (isMatchingReferenceDiscriminant(expr, type)) {
type = narrowTypeByDiscriminant(type, expr, function (t) { return narrowTypeBySwitchOnDiscriminant(t, flow.switchStatement, flow.clauseStart, flow.clauseEnd); });
}
- else if (expr.kind === 199 /* TypeOfExpression */ && isMatchingReference(reference, expr.expression)) {
+ else if (expr.kind === 200 /* TypeOfExpression */ && isMatchingReference(reference, expr.expression)) {
type = narrowBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
}
else if (containsMatchingReferenceDiscriminant(reference, expr)) {
@@ -46107,13 +46930,11 @@
// this flow loop junction, return the cached type.
var id = getFlowNodeId(flow);
var cache = flowLoopCaches[id] || (flowLoopCaches[id] = ts.createMap());
+ var key = getOrSetCacheKey();
if (!key) {
- key = getFlowCacheKey(reference);
// No cache key is generated when binding patterns are in unnarrowable situations
- if (!key) {
return declaredType;
}
- }
var cached = cache.get(key);
if (cached) {
return cached;
@@ -46220,7 +47041,7 @@
return !assumeTrue;
}
function narrowByInKeyword(type, literal, assumeTrue) {
- if ((type.flags & (1048576 /* Union */ | 524288 /* Object */)) || (type.flags & 262144 /* TypeParameter */ && type.isThisType)) {
+ if (type.flags & (1048576 /* Union */ | 524288 /* Object */) || isThisTypeParameter(type)) {
var propName_1 = ts.escapeLeadingUnderscores(literal.text);
return filterType(type, function (t) { return isTypePresencePossible(t, propName_1, assumeTrue); });
}
@@ -46228,8 +47049,8 @@
}
function narrowTypeByBinaryExpression(type, expr, assumeTrue) {
switch (expr.operatorToken.kind) {
- case 59 /* EqualsToken */:
- return narrowTypeByTruthiness(type, expr.left, assumeTrue);
+ case 60 /* EqualsToken */:
+ return narrowTypeByTruthiness(narrowType(type, expr.right, assumeTrue), expr.left, assumeTrue);
case 33 /* EqualsEqualsToken */:
case 34 /* ExclamationEqualsToken */:
case 35 /* EqualsEqualsEqualsToken */:
@@ -46237,10 +47058,10 @@
var operator_1 = expr.operatorToken.kind;
var left_1 = getReferenceCandidate(expr.left);
var right_1 = getReferenceCandidate(expr.right);
- if (left_1.kind === 199 /* TypeOfExpression */ && ts.isStringLiteralLike(right_1)) {
+ if (left_1.kind === 200 /* TypeOfExpression */ && ts.isStringLiteralLike(right_1)) {
return narrowTypeByTypeof(type, left_1, operator_1, right_1, assumeTrue);
}
- if (right_1.kind === 199 /* TypeOfExpression */ && ts.isStringLiteralLike(left_1)) {
+ if (right_1.kind === 200 /* TypeOfExpression */ && ts.isStringLiteralLike(left_1)) {
return narrowTypeByTypeof(type, right_1, operator_1, left_1, assumeTrue);
}
if (isMatchingReference(reference, left_1)) {
@@ -46259,9 +47080,9 @@
return declaredType;
}
break;
- case 94 /* InstanceOfKeyword */:
+ case 95 /* InstanceOfKeyword */:
return narrowTypeByInstanceof(type, expr, assumeTrue);
- case 93 /* InKeyword */:
+ case 94 /* InKeyword */:
var target = getReferenceCandidate(expr.right);
if (ts.isStringLiteralLike(expr.left) && isMatchingReference(reference, target)) {
return narrowByInKeyword(type, expr.left, assumeTrue);
@@ -46305,7 +47126,10 @@
return type;
}
if (assumeTrue) {
- var narrowedType = filterType(type, function (t) { return areTypesComparable(t, valueType); });
+ var filterFn = operator === 33 /* EqualsEqualsToken */ ?
+ (function (t) { return areTypesComparable(t, valueType) || isCoercibleUnderDoubleEquals(t, valueType); }) :
+ function (t) { return areTypesComparable(t, valueType); };
+ var narrowedType = filterType(type, filterFn);
return narrowedType.flags & 131072 /* Never */ ? type : replacePrimitivesWithLiterals(narrowedType, valueType);
}
if (isUnitType(valueType)) {
@@ -46594,19 +47418,19 @@
// will be a subtype or the same type as the argument.
function narrowType(type, expr, assumeTrue) {
switch (expr.kind) {
- case 72 /* Identifier */:
- case 100 /* ThisKeyword */:
- case 98 /* SuperKeyword */:
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 73 /* Identifier */:
+ case 101 /* ThisKeyword */:
+ case 99 /* SuperKeyword */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return narrowTypeByTruthiness(type, expr, assumeTrue);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return narrowTypeByTypePredicate(type, expr, assumeTrue);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return narrowType(type, expr.expression, assumeTrue);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return narrowTypeByBinaryExpression(type, expr, assumeTrue);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
if (expr.operator === 52 /* ExclamationToken */) {
return narrowType(type, expr.operand, !assumeTrue);
}
@@ -46621,7 +47445,7 @@
// an dotted name expression, and if the location is not an assignment target, obtain the type
// of the expression (which will reflect control flow analysis). If the expression indeed
// resolved to the given symbol, return the narrowed type.
- if (location.kind === 72 /* Identifier */) {
+ if (location.kind === 73 /* Identifier */) {
if (ts.isRightSideOfQualifiedNameOrPropertyAccess(location)) {
location = location.parent;
}
@@ -46642,9 +47466,9 @@
function getControlFlowContainer(node) {
return ts.findAncestor(node.parent, function (node) {
return ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) ||
- node.kind === 245 /* ModuleBlock */ ||
- node.kind === 284 /* SourceFile */ ||
- node.kind === 154 /* PropertyDeclaration */;
+ node.kind === 246 /* ModuleBlock */ ||
+ node.kind === 285 /* SourceFile */ ||
+ node.kind === 155 /* PropertyDeclaration */;
});
}
// Check if a parameter is assigned anywhere within its declaring function.
@@ -46663,10 +47487,10 @@
return !!ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !!(getNodeLinks(node).flags & 8388608 /* AssignmentsMarked */); });
}
function markParameterAssignments(node) {
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
if (ts.isAssignmentTarget(node)) {
var symbol = getResolvedSymbol(node);
- if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 151 /* Parameter */) {
+ if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 152 /* Parameter */) {
symbol.isAssigned = true;
}
}
@@ -46681,7 +47505,7 @@
/** remove undefined from the annotated type of a parameter when there is an initializer (that doesn't include undefined) */
function removeOptionalityFromDeclaredType(declaredType, declaration) {
var annotationIncludesUndefined = strictNullChecks &&
- declaration.kind === 151 /* Parameter */ &&
+ declaration.kind === 152 /* Parameter */ &&
declaration.initializer &&
getFalsyFlags(declaredType) & 32768 /* Undefined */ &&
!(getFalsyFlags(checkExpression(declaration.initializer)) & 32768 /* Undefined */);
@@ -46689,13 +47513,13 @@
}
function isConstraintPosition(node) {
var parent = node.parent;
- return parent.kind === 189 /* PropertyAccessExpression */ ||
- parent.kind === 191 /* CallExpression */ && parent.expression === node ||
- parent.kind === 190 /* ElementAccessExpression */ && parent.expression === node ||
- parent.kind === 186 /* BindingElement */ && parent.name === node && !!parent.initializer;
+ return parent.kind === 190 /* PropertyAccessExpression */ ||
+ parent.kind === 192 /* CallExpression */ && parent.expression === node ||
+ parent.kind === 191 /* ElementAccessExpression */ && parent.expression === node ||
+ parent.kind === 187 /* BindingElement */ && parent.name === node && !!parent.initializer;
}
function typeHasNullableConstraint(type) {
- return type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || emptyObjectType, 98304 /* Nullable */);
+ return type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 98304 /* Nullable */);
}
function getConstraintForLocation(type, node) {
// When a node is the left hand expression of a property access, element access, or call expression,
@@ -46726,7 +47550,7 @@
if (symbol === argumentsSymbol) {
var container = ts.getContainingFunction(node);
if (languageVersion < 2 /* ES2015 */) {
- if (container.kind === 197 /* ArrowFunction */) {
+ if (container.kind === 198 /* ArrowFunction */) {
error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression);
}
else if (ts.hasModifier(container, 256 /* Async */)) {
@@ -46747,7 +47571,7 @@
// Due to the emit for class decorators, any reference to the class from inside of the class body
// must instead be rewritten to point to a temporary variable to avoid issues with the double-bind
// behavior of class names in ES6.
- if (declaration.kind === 240 /* ClassDeclaration */
+ if (declaration.kind === 241 /* ClassDeclaration */
&& ts.nodeIsDecorated(declaration)) {
var container = ts.getContainingClass(node);
while (container !== undefined) {
@@ -46759,14 +47583,14 @@
container = ts.getContainingClass(container);
}
}
- else if (declaration.kind === 209 /* ClassExpression */) {
+ else if (declaration.kind === 210 /* ClassExpression */) {
// When we emit a class expression with static members that contain a reference
// to the constructor in the initializer, we will need to substitute that
// binding with an alias as the class name is not in scope.
var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false);
- while (container.kind !== 284 /* SourceFile */) {
+ while (container.kind !== 285 /* SourceFile */) {
if (container.parent === declaration) {
- if (container.kind === 154 /* PropertyDeclaration */ && ts.hasModifier(container, 32 /* Static */)) {
+ if (container.kind === 155 /* PropertyDeclaration */ && ts.hasModifier(container, 32 /* Static */)) {
getNodeLinks(declaration).flags |= 16777216 /* ClassWithConstructorReference */;
getNodeLinks(node).flags |= 33554432 /* ConstructorReferenceInClass */;
}
@@ -46815,7 +47639,7 @@
// The declaration container is the innermost function that encloses the declaration of the variable
// or parameter. The flow container is the innermost function starting with which we analyze the control
// flow graph to determine the control flow based type.
- var isParameter = ts.getRootDeclaration(declaration).kind === 151 /* Parameter */;
+ var isParameter = ts.getRootDeclaration(declaration).kind === 152 /* Parameter */;
var declarationContainer = getControlFlowContainer(declaration);
var flowContainer = getControlFlowContainer(node);
var isOuterVariable = flowContainer !== declarationContainer;
@@ -46824,19 +47648,19 @@
// When the control flow originates in a function expression or arrow function and we are referencing
// a const variable or parameter from an outer function, we extend the origin of the control flow
// analysis to include the immediately enclosing function.
- while (flowContainer !== declarationContainer && (flowContainer.kind === 196 /* FunctionExpression */ ||
- flowContainer.kind === 197 /* ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) &&
+ while (flowContainer !== declarationContainer && (flowContainer.kind === 197 /* FunctionExpression */ ||
+ flowContainer.kind === 198 /* ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) &&
(isConstVariable(localOrExportSymbol) || isParameter && !isParameterAssigned(localOrExportSymbol))) {
flowContainer = getControlFlowContainer(flowContainer);
}
// We only look for uninitialized variables in strict null checking mode, and only when we can analyze
// the entire control flow graph from the variable's declaration (i.e. when the flow container and
// declaration container are the same).
- var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports ||
+ var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || ts.isBindingElement(declaration) ||
type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 3 /* AnyOrUnknown */) !== 0 ||
- isInTypeQuery(node) || node.parent.kind === 257 /* ExportSpecifier */) ||
- node.parent.kind === 213 /* NonNullExpression */ ||
- declaration.kind === 237 /* VariableDeclaration */ && declaration.exclamationToken ||
+ isInTypeQuery(node) || node.parent.kind === 258 /* ExportSpecifier */) ||
+ node.parent.kind === 214 /* NonNullExpression */ ||
+ declaration.kind === 238 /* VariableDeclaration */ && declaration.exclamationToken ||
declaration.flags & 4194304 /* Ambient */;
var initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, declaration) : type) :
type === autoType || type === autoArrayType ? undefinedType :
@@ -46871,7 +47695,7 @@
if (languageVersion >= 2 /* ES2015 */ ||
(symbol.flags & (2 /* BlockScopedVariable */ | 32 /* Class */)) === 0 ||
ts.isSourceFile(symbol.valueDeclaration) ||
- symbol.valueDeclaration.parent.kind === 274 /* CatchClause */) {
+ symbol.valueDeclaration.parent.kind === 275 /* CatchClause */) {
return;
}
// 1. walk from the use site up to the declaration and check
@@ -46894,7 +47718,7 @@
// mark iteration statement as containing block-scoped binding captured in some function
var capturesBlockScopeBindingInLoopBody = true;
if (ts.isForStatement(container) &&
- ts.getAncestor(symbol.valueDeclaration, 238 /* VariableDeclarationList */).parent === container) {
+ ts.getAncestor(symbol.valueDeclaration, 239 /* VariableDeclarationList */).parent === container) {
var part = getPartOfForStatementContainingNode(node.parent, container);
if (part) {
var links = getNodeLinks(part);
@@ -46912,8 +47736,8 @@
}
// mark variables that are declared in loop initializer and reassigned inside the body of ForStatement.
// if body of ForStatement will be converted to function then we'll need a extra machinery to propagate reassigned values back.
- if (container.kind === 225 /* ForStatement */ &&
- ts.getAncestor(symbol.valueDeclaration, 238 /* VariableDeclarationList */).parent === container &&
+ if (container.kind === 226 /* ForStatement */ &&
+ ts.getAncestor(symbol.valueDeclaration, 239 /* VariableDeclarationList */).parent === container &&
isAssignedInBodyOfForStatement(node, container)) {
getNodeLinks(symbol.valueDeclaration).flags |= 4194304 /* NeedsLoopOutParameter */;
}
@@ -46931,7 +47755,7 @@
function isAssignedInBodyOfForStatement(node, container) {
// skip parenthesized nodes
var current = node;
- while (current.parent.kind === 195 /* ParenthesizedExpression */) {
+ while (current.parent.kind === 196 /* ParenthesizedExpression */) {
current = current.parent;
}
// check if node is used as LHS in some assignment expression
@@ -46939,7 +47763,7 @@
if (ts.isAssignmentTarget(current)) {
isAssigned = true;
}
- else if ((current.parent.kind === 202 /* PrefixUnaryExpression */ || current.parent.kind === 203 /* PostfixUnaryExpression */)) {
+ else if ((current.parent.kind === 203 /* PrefixUnaryExpression */ || current.parent.kind === 204 /* PostfixUnaryExpression */)) {
var expr = current.parent;
isAssigned = expr.operator === 44 /* PlusPlusToken */ || expr.operator === 45 /* MinusMinusToken */;
}
@@ -46952,7 +47776,7 @@
}
function captureLexicalThis(node, container) {
getNodeLinks(node).flags |= 2 /* LexicalThis */;
- if (container.kind === 154 /* PropertyDeclaration */ || container.kind === 157 /* Constructor */) {
+ if (container.kind === 155 /* PropertyDeclaration */ || container.kind === 158 /* Constructor */) {
var classNode = container.parent;
getNodeLinks(classNode).flags |= 4 /* CaptureThis */;
}
@@ -47020,37 +47844,37 @@
// tell whether 'this' needs to be captured.
var container = ts.getThisContainer(node, /* includeArrowFunctions */ true);
var capturedByArrowFunction = false;
- if (container.kind === 157 /* Constructor */) {
+ if (container.kind === 158 /* Constructor */) {
checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class);
}
// Now skip arrow functions to get the "real" owner of 'this'.
- if (container.kind === 197 /* ArrowFunction */) {
+ if (container.kind === 198 /* ArrowFunction */) {
container = ts.getThisContainer(container, /* includeArrowFunctions */ false);
capturedByArrowFunction = true;
}
switch (container.kind) {
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body);
// do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks
break;
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location);
// do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks
break;
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
if (isInConstructorArgumentInitializer(node, container)) {
error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments);
// do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks
}
break;
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
if (ts.hasModifier(container, 32 /* Static */)) {
error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer);
// do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks
}
break;
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name);
break;
}
@@ -47100,7 +47924,7 @@
// * /** @constructor */ function [name]() { ... }
// * /** @constructor */ var x = function() { ... }
else if (isInJS &&
- (container.kind === 196 /* FunctionExpression */ || container.kind === 239 /* FunctionDeclaration */) &&
+ (container.kind === 197 /* FunctionExpression */ || container.kind === 240 /* FunctionDeclaration */) &&
ts.getJSDocClassTag(container)) {
var classType = getJSClassType(getMergedSymbol(container.symbol));
if (classType) {
@@ -47136,7 +47960,7 @@
}
function getClassNameFromPrototypeMethod(container) {
// Check if it's the RHS of a x.prototype.y = function [name]() { .... }
- if (container.kind === 196 /* FunctionExpression */ &&
+ if (container.kind === 197 /* FunctionExpression */ &&
ts.isBinaryExpression(container.parent) &&
ts.getAssignmentDeclarationKind(container.parent) === 3 /* PrototypeProperty */) {
// Get the 'x' of 'x.prototype.y = container'
@@ -47146,16 +47970,16 @@
.expression; // x
}
// x.prototype = { method() { } }
- else if (container.kind === 156 /* MethodDeclaration */ &&
- container.parent.kind === 188 /* ObjectLiteralExpression */ &&
+ else if (container.kind === 157 /* MethodDeclaration */ &&
+ container.parent.kind === 189 /* ObjectLiteralExpression */ &&
ts.isBinaryExpression(container.parent.parent) &&
ts.getAssignmentDeclarationKind(container.parent.parent) === 6 /* Prototype */) {
return container.parent.parent.left.expression;
}
// x.prototype = { method: function() { } }
- else if (container.kind === 196 /* FunctionExpression */ &&
- container.parent.kind === 275 /* PropertyAssignment */ &&
- container.parent.parent.kind === 188 /* ObjectLiteralExpression */ &&
+ else if (container.kind === 197 /* FunctionExpression */ &&
+ container.parent.kind === 276 /* PropertyAssignment */ &&
+ container.parent.parent.kind === 189 /* ObjectLiteralExpression */ &&
ts.isBinaryExpression(container.parent.parent.parent) &&
ts.getAssignmentDeclarationKind(container.parent.parent.parent) === 6 /* Prototype */) {
return container.parent.parent.parent.left.expression;
@@ -47163,7 +47987,7 @@
// Object.defineProperty(x, "method", { value: function() { } });
// Object.defineProperty(x, "method", { set: (x: () => void) => void });
// Object.defineProperty(x, "method", { get: () => function() { }) });
- else if (container.kind === 196 /* FunctionExpression */ &&
+ else if (container.kind === 197 /* FunctionExpression */ &&
ts.isPropertyAssignment(container.parent) &&
ts.isIdentifier(container.parent.name) &&
(container.parent.name.escapedText === "value" || container.parent.name.escapedText === "get" || container.parent.name.escapedText === "set") &&
@@ -47188,7 +48012,7 @@
}
function getTypeForThisExpressionFromJSDoc(node) {
var jsdocType = ts.getJSDocType(node);
- if (jsdocType && jsdocType.kind === 294 /* JSDocFunctionType */) {
+ if (jsdocType && jsdocType.kind === 295 /* JSDocFunctionType */) {
var jsDocFunctionType = jsdocType;
if (jsDocFunctionType.parameters.length > 0 &&
jsDocFunctionType.parameters[0].name &&
@@ -47202,15 +48026,15 @@
}
}
function isInConstructorArgumentInitializer(node, constructorDecl) {
- return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 151 /* Parameter */ && n.parent === constructorDecl; });
+ return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 152 /* Parameter */ && n.parent === constructorDecl; });
}
function checkSuperExpression(node) {
- var isCallExpression = node.parent.kind === 191 /* CallExpression */ && node.parent.expression === node;
+ var isCallExpression = node.parent.kind === 192 /* CallExpression */ && node.parent.expression === node;
var container = ts.getSuperContainer(node, /*stopOnFunctions*/ true);
var needToCaptureLexicalThis = false;
// adjust the container reference in case if super is used inside arrow functions with arbitrarily deep nesting
if (!isCallExpression) {
- while (container && container.kind === 197 /* ArrowFunction */) {
+ while (container && container.kind === 198 /* ArrowFunction */) {
container = ts.getSuperContainer(container, /*stopOnFunctions*/ true);
needToCaptureLexicalThis = languageVersion < 2 /* ES2015 */;
}
@@ -47223,14 +48047,14 @@
// class B {
// [super.foo()]() {}
// }
- var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 149 /* ComputedPropertyName */; });
- if (current && current.kind === 149 /* ComputedPropertyName */) {
+ var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 150 /* ComputedPropertyName */; });
+ if (current && current.kind === 150 /* ComputedPropertyName */) {
error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name);
}
else if (isCallExpression) {
error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors);
}
- else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 188 /* ObjectLiteralExpression */)) {
+ else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 189 /* ObjectLiteralExpression */)) {
error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions);
}
else {
@@ -47238,7 +48062,7 @@
}
return errorType;
}
- if (!isCallExpression && container.kind === 157 /* Constructor */) {
+ if (!isCallExpression && container.kind === 158 /* Constructor */) {
checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class);
}
if (ts.hasModifier(container, 32 /* Static */) || isCallExpression) {
@@ -47307,7 +48131,7 @@
// as a call expression cannot be used as the target of a destructuring assignment while a property access can.
//
// For element access expressions (`super[x]`), we emit a generic helper that forwards the element access in both situations.
- if (container.kind === 156 /* MethodDeclaration */ && ts.hasModifier(container, 256 /* Async */)) {
+ if (container.kind === 157 /* MethodDeclaration */ && ts.hasModifier(container, 256 /* Async */)) {
if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) {
getNodeLinks(container).flags |= 4096 /* AsyncMethodWithSuperBinding */;
}
@@ -47321,7 +48145,7 @@
// in this case they should also use correct lexical this
captureLexicalThis(node.parent, container);
}
- if (container.parent.kind === 188 /* ObjectLiteralExpression */) {
+ if (container.parent.kind === 189 /* ObjectLiteralExpression */) {
if (languageVersion < 2 /* ES2015 */) {
error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher);
return errorType;
@@ -47342,7 +48166,7 @@
if (!baseClassType) {
return errorType;
}
- if (container.kind === 157 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) {
+ if (container.kind === 158 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) {
// issue custom error message for super property access in constructor arguments (to be aligned with old compiler)
error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments);
return errorType;
@@ -47357,7 +48181,7 @@
if (isCallExpression) {
// TS 1.0 SPEC (April 2014): 4.8.1
// Super calls are only permitted in constructors of derived classes
- return container.kind === 157 /* Constructor */;
+ return container.kind === 158 /* Constructor */;
}
else {
// TS 1.0 SPEC (April 2014)
@@ -47365,21 +48189,21 @@
// - In a constructor, instance member function, instance member accessor, or instance member variable initializer where this references a derived class instance
// - In a static member function or static member accessor
// topmost container must be something that is directly nested in the class declaration\object literal expression
- if (ts.isClassLike(container.parent) || container.parent.kind === 188 /* ObjectLiteralExpression */) {
+ if (ts.isClassLike(container.parent) || container.parent.kind === 189 /* ObjectLiteralExpression */) {
if (ts.hasModifier(container, 32 /* Static */)) {
- return container.kind === 156 /* MethodDeclaration */ ||
- container.kind === 155 /* MethodSignature */ ||
- container.kind === 158 /* GetAccessor */ ||
- container.kind === 159 /* SetAccessor */;
+ return container.kind === 157 /* MethodDeclaration */ ||
+ container.kind === 156 /* MethodSignature */ ||
+ container.kind === 159 /* GetAccessor */ ||
+ container.kind === 160 /* SetAccessor */;
}
else {
- return container.kind === 156 /* MethodDeclaration */ ||
- container.kind === 155 /* MethodSignature */ ||
- container.kind === 158 /* GetAccessor */ ||
- container.kind === 159 /* SetAccessor */ ||
- container.kind === 154 /* PropertyDeclaration */ ||
- container.kind === 153 /* PropertySignature */ ||
- container.kind === 157 /* Constructor */;
+ return container.kind === 157 /* MethodDeclaration */ ||
+ container.kind === 156 /* MethodSignature */ ||
+ container.kind === 159 /* GetAccessor */ ||
+ container.kind === 160 /* SetAccessor */ ||
+ container.kind === 155 /* PropertyDeclaration */ ||
+ container.kind === 154 /* PropertySignature */ ||
+ container.kind === 158 /* Constructor */;
}
}
}
@@ -47387,10 +48211,10 @@
}
}
function getContainingObjectLiteral(func) {
- return (func.kind === 156 /* MethodDeclaration */ ||
- func.kind === 158 /* GetAccessor */ ||
- func.kind === 159 /* SetAccessor */) && func.parent.kind === 188 /* ObjectLiteralExpression */ ? func.parent :
- func.kind === 196 /* FunctionExpression */ && func.parent.kind === 275 /* PropertyAssignment */ ? func.parent.parent :
+ return (func.kind === 157 /* MethodDeclaration */ ||
+ func.kind === 159 /* GetAccessor */ ||
+ func.kind === 160 /* SetAccessor */) && func.parent.kind === 189 /* ObjectLiteralExpression */ ? func.parent :
+ func.kind === 197 /* FunctionExpression */ && func.parent.kind === 276 /* PropertyAssignment */ ? func.parent.parent :
undefined;
}
function getThisTypeArgument(type) {
@@ -47402,7 +48226,7 @@
});
}
function getContextualThisParameterType(func) {
- if (func.kind === 197 /* ArrowFunction */) {
+ if (func.kind === 198 /* ArrowFunction */) {
return undefined;
}
if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) {
@@ -47429,7 +48253,7 @@
if (thisType) {
return instantiateType(thisType, getMapperFromContext(getInferenceContext(containingLiteral)));
}
- if (literal.parent.kind !== 275 /* PropertyAssignment */) {
+ if (literal.parent.kind !== 276 /* PropertyAssignment */) {
break;
}
literal = literal.parent.parent;
@@ -47443,9 +48267,9 @@
// In an assignment of the form 'obj.xxx = function(...)' or 'obj[xxx] = function(...)', the
// contextual type for 'this' is 'obj'.
var parent = func.parent;
- if (parent.kind === 204 /* BinaryExpression */ && parent.operatorToken.kind === 59 /* EqualsToken */) {
+ if (parent.kind === 205 /* BinaryExpression */ && parent.operatorToken.kind === 60 /* EqualsToken */) {
var target = parent.left;
- if (target.kind === 189 /* PropertyAccessExpression */ || target.kind === 190 /* ElementAccessExpression */) {
+ if (target.kind === 190 /* PropertyAccessExpression */ || target.kind === 191 /* ElementAccessExpression */) {
var expression = target.expression;
// Don't contextually type `this` as `exports` in `exports.Point = function(x, y) { this.x = x; this.y = y; }`
if (inJs && ts.isIdentifier(expression)) {
@@ -47496,9 +48320,9 @@
return getTypeFromTypeNode(typeNode);
}
switch (declaration.kind) {
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return getContextuallyTypedParameterType(declaration);
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return getContextualTypeForBindingElement(declaration);
// By default, do nothing and return undefined - only parameters and binding elements have context implied by a parent
}
@@ -47619,16 +48443,16 @@
return getTypeAtPosition(signature, argIndex);
}
function getContextualTypeForSubstitutionExpression(template, substitutionExpression) {
- if (template.parent.kind === 193 /* TaggedTemplateExpression */) {
+ if (template.parent.kind === 194 /* TaggedTemplateExpression */) {
return getContextualTypeForArgument(template.parent, substitutionExpression);
}
return undefined;
}
- function getContextualTypeForBinaryOperand(node) {
+ function getContextualTypeForBinaryOperand(node, contextFlags) {
var binaryExpression = node.parent;
var left = binaryExpression.left, operatorToken = binaryExpression.operatorToken, right = binaryExpression.right;
switch (operatorToken.kind) {
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
if (node !== right) {
return undefined;
}
@@ -47641,12 +48465,12 @@
// When an || expression has a contextual type, the operands are contextually typed by that type. When an ||
// expression has no contextual type, the right operand is contextually typed by the type of the left operand,
// except for the special case of Javascript declarations of the form `namespace.prop = namespace.prop || {}`
- var type = getContextualType(binaryExpression);
+ var type = getContextualType(binaryExpression, contextFlags);
return !type && node === right && !ts.isDefaultedExpandoInitializer(binaryExpression) ?
getTypeOfExpression(left) : type;
case 54 /* AmpersandAmpersandToken */:
case 27 /* CommaToken */:
- return node === right ? getContextualType(binaryExpression) : undefined;
+ return node === right ? getContextualType(binaryExpression, contextFlags) : undefined;
default:
return undefined;
}
@@ -47753,24 +48577,24 @@
// In an object literal contextually typed by a type T, the contextual type of a property assignment is the type of
// the matching property in T, if one exists. Otherwise, it is the type of the numeric index signature in T, if one
// exists. Otherwise, it is the type of the string index signature in T, if one exists.
- function getContextualTypeForObjectLiteralMethod(node) {
+ function getContextualTypeForObjectLiteralMethod(node, contextFlags) {
ts.Debug.assert(ts.isObjectLiteralMethod(node));
if (node.flags & 8388608 /* InWithStatement */) {
// We cannot answer semantic questions within a with block, do not proceed any further
return undefined;
}
- return getContextualTypeForObjectLiteralElement(node);
+ return getContextualTypeForObjectLiteralElement(node, contextFlags);
}
- function getContextualTypeForObjectLiteralElement(element) {
+ function getContextualTypeForObjectLiteralElement(element, contextFlags) {
var objectLiteral = element.parent;
- var type = getApparentTypeOfContextualType(objectLiteral);
+ var type = getApparentTypeOfContextualType(objectLiteral, contextFlags);
if (type) {
if (!hasNonBindableDynamicName(element)) {
// For a (non-symbol) computed property, there is no reason to look up the name
// in the type. It will just be "__computed", which does not appear in any
// SymbolTable.
- var symbolName_2 = getSymbolOfNode(element).escapedName;
- var propertyType = getTypeOfPropertyOfContextualType(type, symbolName_2);
+ var symbolName_3 = getSymbolOfNode(element).escapedName;
+ var propertyType = getTypeOfPropertyOfContextualType(type, symbolName_3);
if (propertyType) {
return propertyType;
}
@@ -47789,9 +48613,9 @@
|| getIteratedTypeOrElementType(arrayContextualType, /*errorNode*/ undefined, /*allowStringInput*/ false, /*allowAsyncIterables*/ false, /*checkAssignability*/ false));
}
// In a contextually typed conditional expression, the true/false expressions are contextually typed by the same type.
- function getContextualTypeForConditionalOperand(node) {
+ function getContextualTypeForConditionalOperand(node, contextFlags) {
var conditional = node.parent;
- return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional) : undefined;
+ return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional, contextFlags) : undefined;
}
function getContextualTypeForChildJsxExpression(node, child) {
var attributesType = getApparentTypeOfContextualType(node.openingElement.tagName);
@@ -47800,16 +48624,17 @@
if (!(attributesType && !isTypeAny(attributesType) && jsxChildrenPropertyName && jsxChildrenPropertyName !== "")) {
return undefined;
}
- var childIndex = node.children.indexOf(child);
+ var realChildren = getSemanticJsxChildren(node.children);
+ var childIndex = realChildren.indexOf(child);
var childFieldType = getTypeOfPropertyOfContextualType(attributesType, jsxChildrenPropertyName);
- return childFieldType && mapType(childFieldType, function (t) {
+ return childFieldType && (realChildren.length === 1 ? childFieldType : mapType(childFieldType, function (t) {
if (isArrayLikeType(t)) {
return getIndexedAccessType(t, getLiteralType(childIndex));
}
else {
return t;
}
- }, /*noReductions*/ true);
+ }, /*noReductions*/ true));
}
function getContextualTypeForJsxExpression(node) {
var exprParent = node.parent;
@@ -47843,30 +48668,30 @@
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
case 14 /* NoSubstitutionTemplateLiteral */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
- case 96 /* NullKeyword */:
- case 72 /* Identifier */:
- case 141 /* UndefinedKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
+ case 97 /* NullKeyword */:
+ case 73 /* Identifier */:
+ case 142 /* UndefinedKeyword */:
return true;
- case 189 /* PropertyAccessExpression */:
- case 195 /* ParenthesizedExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 196 /* ParenthesizedExpression */:
return isPossiblyDiscriminantValue(node.expression);
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return !node.expression || isPossiblyDiscriminantValue(node.expression);
}
return false;
}
function discriminateContextualTypeByObjectMembers(node, contextualType) {
- return discriminateTypeByDiscriminableItems(contextualType, ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 275 /* PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return checkExpression(prop.initializer); }, prop.symbol.escapedName]; }), isTypeAssignableTo, contextualType);
+ return discriminateTypeByDiscriminableItems(contextualType, ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 276 /* PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return checkExpression(prop.initializer); }, prop.symbol.escapedName]; }), isTypeAssignableTo, contextualType);
}
function discriminateContextualTypeByJSXAttributes(node, contextualType) {
- return discriminateTypeByDiscriminableItems(contextualType, ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 267 /* JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return checkExpression(prop.initializer); }), prop.symbol.escapedName]; }), isTypeAssignableTo, contextualType);
+ return discriminateTypeByDiscriminableItems(contextualType, ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 268 /* JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return checkExpression(prop.initializer); }), prop.symbol.escapedName]; }), isTypeAssignableTo, contextualType);
}
// Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily
// be "pushed" onto a node using the contextualType property.
- function getApparentTypeOfContextualType(node) {
- var contextualType = instantiateContextualType(getContextualType(node), node);
+ function getApparentTypeOfContextualType(node, contextFlags) {
+ var contextualType = instantiateContextualType(getContextualType(node, contextFlags), node, contextFlags);
if (contextualType) {
var apparentType = mapType(contextualType, getApparentType, /*noReductions*/ true);
if (apparentType.flags & 1048576 /* Union */) {
@@ -47882,13 +48707,24 @@
}
// If the given contextual type contains instantiable types and if a mapper representing
// return type inferences is available, instantiate those types using that mapper.
- function instantiateContextualType(contextualType, node) {
+ function instantiateContextualType(contextualType, node, contextFlags) {
if (contextualType && maybeTypeOfKind(contextualType, 63176704 /* Instantiable */)) {
var inferenceContext = getInferenceContext(node);
- if (inferenceContext && inferenceContext.returnMapper) {
+ // If no inferences have been made, nothing is gained from instantiating as type parameters
+ // would just be replaced with their defaults similar to the apparent type.
+ if (inferenceContext && ts.some(inferenceContext.inferences, hasInferenceCandidates)) {
+ // For contextual signatures we incorporate all inferences made so far, e.g. from return
+ // types as well as arguments to the left in a function call.
+ if (contextFlags && contextFlags & 1 /* Signature */) {
+ return instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper);
+ }
+ // For other purposes (e.g. determining whether to produce literal types) we only
+ // incorporate inferences made from the return type in a function call.
+ if (inferenceContext.returnMapper) {
return instantiateInstantiableTypes(contextualType, inferenceContext.returnMapper);
}
}
+ }
return contextualType;
}
// This function is similar to instantiateType, except that (a) it only instantiates types that
@@ -47923,7 +48759,7 @@
* @param node the expression whose contextual type will be returned.
* @returns the contextual type of an expression.
*/
- function getContextualType(node) {
+ function getContextualType(node, contextFlags) {
if (node.flags & 8388608 /* InWithStatement */) {
// We cannot answer semantic questions within a with block, do not proceed any further
return undefined;
@@ -47933,54 +48769,54 @@
}
var parent = node.parent;
switch (parent.kind) {
- case 237 /* VariableDeclaration */:
- case 151 /* Parameter */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 186 /* BindingElement */:
+ case 238 /* VariableDeclaration */:
+ case 152 /* Parameter */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 187 /* BindingElement */:
return getContextualTypeForInitializerExpression(node);
- case 197 /* ArrowFunction */:
- case 230 /* ReturnStatement */:
+ case 198 /* ArrowFunction */:
+ case 231 /* ReturnStatement */:
return getContextualTypeForReturnExpression(node);
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return getContextualTypeForYieldOperand(parent);
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
return getContextualTypeForAwaitOperand(parent);
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
return getContextualTypeForArgument(parent, node);
- case 194 /* TypeAssertionExpression */:
- case 212 /* AsExpression */:
+ case 195 /* TypeAssertionExpression */:
+ case 213 /* AsExpression */:
return ts.isConstTypeReference(parent.type) ? undefined : getTypeFromTypeNode(parent.type);
- case 204 /* BinaryExpression */:
- return getContextualTypeForBinaryOperand(node);
- case 275 /* PropertyAssignment */:
- case 276 /* ShorthandPropertyAssignment */:
- return getContextualTypeForObjectLiteralElement(parent);
- case 277 /* SpreadAssignment */:
- return getApparentTypeOfContextualType(parent.parent);
- case 187 /* ArrayLiteralExpression */: {
+ case 205 /* BinaryExpression */:
+ return getContextualTypeForBinaryOperand(node, contextFlags);
+ case 276 /* PropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
+ return getContextualTypeForObjectLiteralElement(parent, contextFlags);
+ case 278 /* SpreadAssignment */:
+ return getApparentTypeOfContextualType(parent.parent, contextFlags);
+ case 188 /* ArrayLiteralExpression */: {
var arrayLiteral = parent;
- var type = getApparentTypeOfContextualType(arrayLiteral);
+ var type = getApparentTypeOfContextualType(arrayLiteral, contextFlags);
return getContextualTypeForElementExpression(type, ts.indexOfNode(arrayLiteral.elements, node));
}
- case 205 /* ConditionalExpression */:
- return getContextualTypeForConditionalOperand(node);
- case 216 /* TemplateSpan */:
- ts.Debug.assert(parent.parent.kind === 206 /* TemplateExpression */);
+ case 206 /* ConditionalExpression */:
+ return getContextualTypeForConditionalOperand(node, contextFlags);
+ case 217 /* TemplateSpan */:
+ ts.Debug.assert(parent.parent.kind === 207 /* TemplateExpression */);
return getContextualTypeForSubstitutionExpression(parent.parent, node);
- case 195 /* ParenthesizedExpression */: {
+ case 196 /* ParenthesizedExpression */: {
// Like in `checkParenthesizedExpression`, an `/** @type {xyz} */` comment before a parenthesized expression acts as a type cast.
var tag = ts.isInJSFile(parent) ? ts.getJSDocTypeTag(parent) : undefined;
- return tag ? getTypeFromTypeNode(tag.typeExpression.type) : getContextualType(parent);
+ return tag ? getTypeFromTypeNode(tag.typeExpression.type) : getContextualType(parent, contextFlags);
}
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return getContextualTypeForJsxExpression(parent);
- case 267 /* JsxAttribute */:
- case 269 /* JsxSpreadAttribute */:
+ case 268 /* JsxAttribute */:
+ case 270 /* JsxSpreadAttribute */:
return getContextualTypeForJsxAttribute(parent);
- case 262 /* JsxOpeningElement */:
- case 261 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
+ case 262 /* JsxSelfClosingElement */:
return getContextualJsxElementAttributesType(parent);
}
return undefined;
@@ -48002,7 +48838,7 @@
return getJsxReferenceKind(node) !== 0 /* Component */ ? getJsxPropsTypeFromCallSignature(signature, node) : getJsxPropsTypeFromClassType(signature, node);
}
function getJsxPropsTypeFromCallSignature(sig, context) {
- var propsType = getTypeOfFirstParameterOfSignatureWithFallback(sig, emptyObjectType);
+ var propsType = getTypeOfFirstParameterOfSignatureWithFallback(sig, unknownType);
propsType = getJsxManagedAttributesFromLocatedAttributes(context, getJsxNamespaceAt(context), propsType);
var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context);
if (intrinsicAttribs !== errorType) {
@@ -48073,7 +48909,7 @@
var forcedLookupLocation = getJsxElementPropertiesName(ns);
var attributesType = forcedLookupLocation === undefined
// If there is no type ElementAttributesProperty, return the type of the first parameter of the signature, which should be the props type
- ? getTypeOfFirstParameterOfSignatureWithFallback(sig, emptyObjectType)
+ ? getTypeOfFirstParameterOfSignatureWithFallback(sig, unknownType)
: forcedLookupLocation === ""
// If there is no e.g. 'props' member in ElementAttributesProperty, use the element class type instead
? getReturnTypeOfSignature(sig)
@@ -48084,7 +48920,7 @@
if (!!forcedLookupLocation && !!ts.length(context.attributes.properties)) {
error(context, ts.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, ts.unescapeLeadingUnderscores(forcedLookupLocation));
}
- return emptyObjectType;
+ return unknownType;
}
attributesType = getJsxManagedAttributesFromLocatedAttributes(context, ns, attributesType);
if (isTypeAny(attributesType)) {
@@ -48135,7 +48971,7 @@
return !hasEffectiveRestParameter(signature) && getParameterCount(signature) < targetParameterCount;
}
function isFunctionExpressionOrArrowFunction(node) {
- return node.kind === 196 /* FunctionExpression */ || node.kind === 197 /* ArrowFunction */;
+ return node.kind === 197 /* FunctionExpression */ || node.kind === 198 /* ArrowFunction */;
}
function getContextualSignatureForFunctionLikeDeclaration(node) {
// Only function expressions, arrow functions, and object literal methods are contextually typed.
@@ -48143,23 +48979,20 @@
? getContextualSignature(node)
: undefined;
}
- function getContextualTypeForFunctionLikeDeclaration(node) {
- return ts.isObjectLiteralMethod(node) ?
- getContextualTypeForObjectLiteralMethod(node) :
- getApparentTypeOfContextualType(node);
- }
// Return the contextual signature for a given expression node. A contextual type provides a
// contextual signature if it has a single call signature and if that call signature is non-generic.
// If the contextual type is a union type, get the signature from each type possible and if they are
// all identical ignoring their return type, the result is same signature but with return type as
// union type of return types from these signatures
function getContextualSignature(node) {
- ts.Debug.assert(node.kind !== 156 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
+ ts.Debug.assert(node.kind !== 157 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
var typeTagSignature = getSignatureOfTypeTag(node);
if (typeTagSignature) {
return typeTagSignature;
}
- var type = getContextualTypeForFunctionLikeDeclaration(node);
+ var type = ts.isObjectLiteralMethod(node) ?
+ getContextualTypeForObjectLiteralMethod(node, 1 /* Signature */) :
+ getApparentTypeOfContextualType(node, 1 /* Signature */);
if (!type) {
return undefined;
}
@@ -48168,8 +49001,8 @@
}
var signatureList;
var types = type.types;
- for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
- var current = types_15[_i];
+ for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
+ var current = types_14[_i];
var signature = getContextualCallSignature(current, node);
if (signature) {
if (!signatureList) {
@@ -48197,8 +49030,8 @@
return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false, /*allowAsyncIterables*/ false);
}
function hasDefaultValue(node) {
- return (node.kind === 186 /* BindingElement */ && !!node.initializer) ||
- (node.kind === 204 /* BinaryExpression */ && node.operatorToken.kind === 59 /* EqualsToken */);
+ return (node.kind === 187 /* BindingElement */ && !!node.initializer) ||
+ (node.kind === 205 /* BinaryExpression */ && node.operatorToken.kind === 60 /* EqualsToken */);
}
function checkArrayLiteral(node, checkMode, forceTuple) {
var elements = node.elements;
@@ -48210,7 +49043,7 @@
var inConstContext = isConstContext(node);
for (var index = 0; index < elementCount; index++) {
var e = elements[index];
- if (inDestructuringPattern && e.kind === 208 /* SpreadElement */) {
+ if (inDestructuringPattern && e.kind === 209 /* SpreadElement */) {
// Given the following situation:
// var c: {};
// [...c] = ["", 0];
@@ -48235,12 +49068,12 @@
var type = checkExpressionForMutableLocation(e, checkMode, elementContextualType, forceTuple);
elementTypes.push(type);
}
- if (index < elementCount - 1 && e.kind === 208 /* SpreadElement */) {
+ if (index < elementCount - 1 && e.kind === 209 /* SpreadElement */) {
hasNonEndingSpreadElement = true;
}
}
if (!hasNonEndingSpreadElement) {
- var hasRestElement = elementCount > 0 && elements[elementCount - 1].kind === 208 /* SpreadElement */;
+ var hasRestElement = elementCount > 0 && elements[elementCount - 1].kind === 209 /* SpreadElement */;
var minLength = elementCount - (hasRestElement ? 1 : 0);
// If array literal is actually a destructuring pattern, mark it as an implied type. We do this such
// that we get the same behavior for "var [x, y] = []" and "[x, y] = []".
@@ -48270,15 +49103,15 @@
var pattern = contextualType && contextualType.pattern;
// If array literal is contextually typed by a binding pattern or an assignment pattern, pad the resulting
// tuple type with the corresponding binding or assignment element types to make the lengths equal.
- if (!hasRestElement && pattern && (pattern.kind === 185 /* ArrayBindingPattern */ || pattern.kind === 187 /* ArrayLiteralExpression */)) {
+ if (!hasRestElement && pattern && (pattern.kind === 186 /* ArrayBindingPattern */ || pattern.kind === 188 /* ArrayLiteralExpression */)) {
var patternElements = pattern.elements;
for (var i = elementCount; i < patternElements.length; i++) {
var e = patternElements[i];
if (hasDefaultValue(e)) {
elementTypes.push(contextualType.typeArguments[i]);
}
- else if (i < patternElements.length - 1 || !(e.kind === 186 /* BindingElement */ && e.dotDotDotToken || e.kind === 208 /* SpreadElement */)) {
- if (e.kind !== 210 /* OmittedExpression */) {
+ else if (i < patternElements.length - 1 || !(e.kind === 187 /* BindingElement */ && e.dotDotDotToken || e.kind === 209 /* SpreadElement */)) {
+ if (e.kind !== 211 /* OmittedExpression */) {
error(e, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value);
}
elementTypes.push(strictNullChecks ? implicitNeverType : undefinedWideningType);
@@ -48290,9 +49123,9 @@
}
function isNumericName(name) {
switch (name.kind) {
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
return isNumericComputedName(name);
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return isNumericLiteralName(name.escapedText);
case 8 /* NumericLiteral */:
case 10 /* StringLiteral */:
@@ -48380,7 +49213,7 @@
var spread = emptyObjectType;
var contextualType = getApparentTypeOfContextualType(node);
var contextualTypeHasPattern = contextualType && contextualType.pattern &&
- (contextualType.pattern.kind === 184 /* ObjectBindingPattern */ || contextualType.pattern.kind === 188 /* ObjectLiteralExpression */);
+ (contextualType.pattern.kind === 185 /* ObjectBindingPattern */ || contextualType.pattern.kind === 189 /* ObjectLiteralExpression */);
var inConstContext = isConstContext(node);
var checkFlags = inConstContext ? 8 /* Readonly */ : 0;
var isInJavascript = ts.isInJSFile(node) && !ts.isInJsonFile(node);
@@ -48395,13 +49228,13 @@
for (var i = 0; i < node.properties.length; i++) {
var memberDecl = node.properties[i];
var member = getSymbolOfNode(memberDecl);
- var computedNameType = memberDecl.name && memberDecl.name.kind === 149 /* ComputedPropertyName */ && !ts.isWellKnownSymbolSyntactically(memberDecl.name.expression) ?
+ var computedNameType = memberDecl.name && memberDecl.name.kind === 150 /* ComputedPropertyName */ && !ts.isWellKnownSymbolSyntactically(memberDecl.name.expression) ?
checkComputedPropertyName(memberDecl.name) : undefined;
- if (memberDecl.kind === 275 /* PropertyAssignment */ ||
- memberDecl.kind === 276 /* ShorthandPropertyAssignment */ ||
+ if (memberDecl.kind === 276 /* PropertyAssignment */ ||
+ memberDecl.kind === 277 /* ShorthandPropertyAssignment */ ||
ts.isObjectLiteralMethod(memberDecl)) {
- var type = memberDecl.kind === 275 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) :
- memberDecl.kind === 276 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(memberDecl.name, checkMode) :
+ var type = memberDecl.kind === 276 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) :
+ memberDecl.kind === 277 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(memberDecl.name, checkMode) :
checkObjectLiteralMethod(memberDecl, checkMode);
if (isInJavascript) {
var jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl);
@@ -48416,7 +49249,7 @@
objectFlags |= ts.getObjectFlags(type) & 917504 /* PropagatingFlags */;
var nameType = computedNameType && isTypeUsableAsPropertyName(computedNameType) ? computedNameType : undefined;
var prop = nameType ?
- createSymbol(4 /* Property */ | member.flags, getPropertyNameFromType(nameType), checkFlags | 2048 /* Late */) :
+ createSymbol(4 /* Property */ | member.flags, getPropertyNameFromType(nameType), checkFlags | 4096 /* Late */) :
createSymbol(4 /* Property */ | member.flags, member.escapedName, checkFlags);
if (nameType) {
prop.nameType = nameType;
@@ -48424,8 +49257,8 @@
if (inDestructuringPattern) {
// If object literal is an assignment pattern and if the assignment pattern specifies a default value
// for the property, make the property optional.
- var isOptional = (memberDecl.kind === 275 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) ||
- (memberDecl.kind === 276 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer);
+ var isOptional = (memberDecl.kind === 276 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) ||
+ (memberDecl.kind === 277 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer);
if (isOptional) {
prop.flags |= 16777216 /* Optional */;
}
@@ -48450,7 +49283,7 @@
prop.target = member;
member = prop;
}
- else if (memberDecl.kind === 277 /* SpreadAssignment */) {
+ else if (memberDecl.kind === 278 /* SpreadAssignment */) {
if (languageVersion < 2 /* ES2015 */) {
checkExternalEmitHelpers(memberDecl, 2 /* Assign */);
}
@@ -48476,7 +49309,7 @@
// an ordinary function declaration(section 6.1) with no parameters.
// A set accessor declaration is processed in the same manner
// as an ordinary function declaration with a single parameter and a Void return type.
- ts.Debug.assert(memberDecl.kind === 158 /* GetAccessor */ || memberDecl.kind === 159 /* SetAccessor */);
+ ts.Debug.assert(memberDecl.kind === 159 /* GetAccessor */ || memberDecl.kind === 160 /* SetAccessor */);
checkNodeDeferred(memberDecl);
}
if (computedNameType && !(computedNameType.flags & 8576 /* StringOrNumberLiteralOrUnique */)) {
@@ -48584,7 +49417,7 @@
* Returns true iff React would emit this tag name as a string rather than an identifier or qualified name
*/
function isJsxIntrinsicIdentifier(tagName) {
- return tagName.kind === 72 /* Identifier */ && ts.isIntrinsicJsxName(tagName.escapedText);
+ return tagName.kind === 73 /* Identifier */ && ts.isIntrinsicJsxName(tagName.escapedText);
}
function checkJsxAttribute(node, checkMode) {
return node.initializer
@@ -48629,7 +49462,7 @@
}
}
else {
- ts.Debug.assert(attributeDecl.kind === 269 /* JsxSpreadAttribute */);
+ ts.Debug.assert(attributeDecl.kind === 270 /* JsxSpreadAttribute */);
if (attributesTable.size > 0) {
spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, objectFlags, /*readonly*/ false);
attributesTable = ts.createSymbolTable();
@@ -48652,7 +49485,7 @@
}
}
// Handle children attribute
- var parent = openingLikeElement.parent.kind === 260 /* JsxElement */ ? openingLikeElement.parent : undefined;
+ var parent = openingLikeElement.parent.kind === 261 /* JsxElement */ ? openingLikeElement.parent : undefined;
// We have to check that openingElement of the parent is the one we are visiting as this may not be true for selfClosingElement
if (parent && parent.openingElement === openingLikeElement && parent.children.length > 0) {
var childrenTypes = checkJsxChildren(parent, checkMode);
@@ -49070,8 +49903,8 @@
*/
function checkPropertyAccessibility(node, isSuper, type, prop) {
var flags = ts.getDeclarationModifierFlagsFromSymbol(prop);
- var errorNode = node.kind === 148 /* QualifiedName */ ? node.right : node.kind === 183 /* ImportType */ ? node : node.name;
- if (ts.getCheckFlags(prop) & 512 /* ContainsPrivate */) {
+ var errorNode = node.kind === 149 /* QualifiedName */ ? node.right : node.kind === 184 /* ImportType */ ? node : node.name;
+ if (ts.getCheckFlags(prop) & 1024 /* ContainsPrivate */) {
// Synthetic property with private constituent property
error(errorNode, ts.Diagnostics.Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1, symbolToString(prop), typeToString(type));
return false;
@@ -49176,7 +50009,7 @@
return type;
}
function checkNonNullType(type, node, nullDiagnostic, undefinedDiagnostic, nullOrUndefinedDiagnostic) {
- if (type.flags & 2 /* Unknown */) {
+ if (strictNullChecks && type.flags & 2 /* Unknown */) {
error(node, ts.Diagnostics.Object_is_of_type_unknown);
return errorType;
}
@@ -49191,6 +50024,13 @@
}
return type;
}
+ function checkNonNullNonVoidType(type, node) {
+ var nonNullType = checkNonNullType(type, node);
+ if (nonNullType !== errorType && nonNullType.flags & 16384 /* Void */) {
+ error(node, ts.Diagnostics.Object_is_possibly_undefined);
+ }
+ return nonNullType;
+ }
function checkPropertyAccessExpression(node) {
return checkPropertyAccessExpressionOrQualifiedName(node, node.expression, node.name);
}
@@ -49214,7 +50054,7 @@
markAliasReferenced(parentSymbol, node);
}
if (!prop) {
- var indexInfo = getIndexInfoOfType(apparentType, 0 /* String */);
+ var indexInfo = assignmentKind === 0 /* None */ || !isGenericObjectType(leftType) ? getIndexInfoOfType(apparentType, 0 /* String */) : undefined;
if (!(indexInfo && indexInfo.type)) {
if (isJSLiteralType(leftType)) {
return anyType;
@@ -49229,7 +50069,7 @@
return anyType;
}
if (right.escapedText && !checkAndReportErrorForExtendingInterface(node)) {
- reportNonexistentProperty(right, leftType.flags & 262144 /* TypeParameter */ && leftType.isThisType ? apparentType : leftType);
+ reportNonexistentProperty(right, isThisTypeParameter(leftType) ? apparentType : leftType);
}
return errorType;
}
@@ -49240,9 +50080,9 @@
}
else {
checkPropertyNotUsedBeforeDeclaration(prop, node, right);
- markPropertyAsReferenced(prop, node, left.kind === 100 /* ThisKeyword */);
+ markPropertyAsReferenced(prop, node, left.kind === 101 /* ThisKeyword */);
getNodeLinks(node).resolvedSymbol = prop;
- checkPropertyAccessibility(node, left.kind === 98 /* SuperKeyword */, apparentType, prop);
+ checkPropertyAccessibility(node, left.kind === 99 /* SuperKeyword */, apparentType, prop);
if (assignmentKind) {
if (isReferenceToReadonlyEntity(node, prop) || isReferenceThroughNamespaceImport(node)) {
error(right, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, ts.idText(right));
@@ -49254,7 +50094,7 @@
// Only compute control flow type if this is a property access expression that isn't an
// assignment target, and the referenced property was declared as a variable, property,
// accessor, or optional method.
- if (node.kind !== 189 /* PropertyAccessExpression */ ||
+ if (node.kind !== 190 /* PropertyAccessExpression */ ||
assignmentKind === 1 /* Definite */ ||
prop && !(prop.flags & (3 /* Variable */ | 4 /* Property */ | 98304 /* Accessor */)) && !(prop.flags & 8192 /* Method */ && propType.flags & 1048576 /* Union */)) {
return propType;
@@ -49264,11 +50104,11 @@
// and if we are in a constructor of the same class as the property declaration, assume that
// the property is uninitialized at the top of the control flow.
var assumeUninitialized = false;
- if (strictNullChecks && strictPropertyInitialization && left.kind === 100 /* ThisKeyword */) {
+ if (strictNullChecks && strictPropertyInitialization && left.kind === 101 /* ThisKeyword */) {
var declaration = prop && prop.valueDeclaration;
if (declaration && isInstancePropertyWithoutInitializer(declaration)) {
var flowContainer = getControlFlowContainer(node);
- if (flowContainer.kind === 157 /* Constructor */ && flowContainer.parent === declaration.parent) {
+ if (flowContainer.kind === 158 /* Constructor */ && flowContainer.parent === declaration.parent) {
assumeUninitialized = true;
}
}
@@ -49299,8 +50139,8 @@
&& !isPropertyDeclaredInAncestorClass(prop)) {
diagnosticMessage = error(right, ts.Diagnostics.Property_0_is_used_before_its_initialization, declarationName);
}
- else if (valueDeclaration.kind === 240 /* ClassDeclaration */ &&
- node.parent.kind !== 164 /* TypeReference */ &&
+ else if (valueDeclaration.kind === 241 /* ClassDeclaration */ &&
+ node.parent.kind !== 165 /* TypeReference */ &&
!(valueDeclaration.flags & 4194304 /* Ambient */) &&
!isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) {
diagnosticMessage = error(right, ts.Diagnostics.Class_0_used_before_its_declaration, declarationName);
@@ -49312,22 +50152,22 @@
function isInPropertyInitializer(node) {
return !!ts.findAncestor(node, function (node) {
switch (node.kind) {
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return true;
- case 275 /* PropertyAssignment */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 277 /* SpreadAssignment */:
- case 149 /* ComputedPropertyName */:
- case 216 /* TemplateSpan */:
- case 270 /* JsxExpression */:
- case 267 /* JsxAttribute */:
- case 268 /* JsxAttributes */:
- case 269 /* JsxSpreadAttribute */:
- case 262 /* JsxOpeningElement */:
- case 211 /* ExpressionWithTypeArguments */:
- case 273 /* HeritageClause */:
+ case 276 /* PropertyAssignment */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 278 /* SpreadAssignment */:
+ case 150 /* ComputedPropertyName */:
+ case 217 /* TemplateSpan */:
+ case 271 /* JsxExpression */:
+ case 268 /* JsxAttribute */:
+ case 269 /* JsxAttributes */:
+ case 270 /* JsxSpreadAttribute */:
+ case 263 /* JsxOpeningElement */:
+ case 212 /* ExpressionWithTypeArguments */:
+ case 274 /* HeritageClause */:
return false;
default:
return ts.isExpressionNode(node) ? false : "quit";
@@ -49433,6 +50273,32 @@
var suggestion = getSuggestedSymbolForNonexistentModule(name, targetModule);
return suggestion && ts.symbolName(suggestion);
}
+ function getSuggestionForNonexistentIndexSignature(objectType, expr) {
+ // check if object type has setter or getter
+ var hasProp = function (name, argCount) {
+ if (argCount === void 0) { argCount = 1; }
+ var prop = getPropertyOfObjectType(objectType, name);
+ if (prop) {
+ var s = getSingleCallSignature(getTypeOfSymbol(prop));
+ if (s && getMinArgumentCount(s) === argCount && typeToString(getTypeAtPosition(s, 0)) === "string") {
+ return true;
+ }
+ }
+ return false;
+ };
+ var suggestedMethod = ts.isAssignmentTarget(expr) ? "set" : "get";
+ if (!hasProp(suggestedMethod)) {
+ return undefined;
+ }
+ var suggestion = ts.tryGetPropertyAccessOrIdentifierToString(expr);
+ if (suggestion === undefined) {
+ suggestion = suggestedMethod;
+ }
+ else {
+ suggestion += "." + suggestedMethod;
+ }
+ return suggestion;
+ }
/**
* Given a name and a list of symbols whose names are *not* equal to the name, return a spelling suggestion if there is one that is close enough.
* Names less than length 3 only check for case-insensitive equality, not levenshtein distance.
@@ -49473,34 +50339,17 @@
}
function isValidPropertyAccess(node, propertyName) {
switch (node.kind) {
- case 189 /* PropertyAccessExpression */:
- return isValidPropertyAccessWithType(node, node.expression.kind === 98 /* SuperKeyword */, propertyName, getWidenedType(checkExpression(node.expression)));
- case 148 /* QualifiedName */:
+ case 190 /* PropertyAccessExpression */:
+ return isValidPropertyAccessWithType(node, node.expression.kind === 99 /* SuperKeyword */, propertyName, getWidenedType(checkExpression(node.expression)));
+ case 149 /* QualifiedName */:
return isValidPropertyAccessWithType(node, /*isSuper*/ false, propertyName, getWidenedType(checkExpression(node.left)));
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return isValidPropertyAccessWithType(node, /*isSuper*/ false, propertyName, getTypeFromTypeNode(node));
}
}
function isValidPropertyAccessForCompletions(node, type, property) {
- return isValidPropertyAccessWithType(node, node.kind === 189 /* PropertyAccessExpression */ && node.expression.kind === 98 /* SuperKeyword */, property.escapedName, type)
- && (!(property.flags & 8192 /* Method */) || isValidMethodAccess(property, type));
- }
- function isValidMethodAccess(method, actualThisType) {
- var propType = getTypeOfPropertyOfType(actualThisType, method.escapedName);
- var signatures = getSignaturesOfType(getNonNullableType(propType), 0 /* Call */);
- ts.Debug.assert(signatures.length !== 0);
- return signatures.some(function (sig) {
- var signatureThisType = getThisTypeOfSignature(sig);
- return !signatureThisType || isTypeAssignableTo(actualThisType, getInstantiatedSignatureThisType(sig, signatureThisType, actualThisType));
- });
- }
- function getInstantiatedSignatureThisType(sig, signatureThisType, actualThisType) {
- if (!sig.typeParameters) {
- return signatureThisType;
- }
- var context = createInferenceContext(sig.typeParameters, sig, 0 /* None */);
- inferTypes(context.inferences, actualThisType, signatureThisType);
- return instantiateType(signatureThisType, createSignatureTypeMapper(sig, getInferredTypes(context)));
+ return isValidPropertyAccessWithType(node, node.kind === 190 /* PropertyAccessExpression */ && node.expression.kind === 99 /* SuperKeyword */, property.escapedName, type);
+ // Previously we validated the 'this' type of methods but this adversely affected performance. See #31377 for more context.
}
function isValidPropertyAccessWithType(node, isSuper, propertyName, type) {
if (type === errorType || isTypeAny(type)) {
@@ -49516,13 +50365,13 @@
*/
function getForInVariableSymbol(node) {
var initializer = node.initializer;
- if (initializer.kind === 238 /* VariableDeclarationList */) {
+ if (initializer.kind === 239 /* VariableDeclarationList */) {
var variable = initializer.declarations[0];
if (variable && !ts.isBindingPattern(variable.name)) {
return getSymbolOfNode(variable);
}
}
- else if (initializer.kind === 72 /* Identifier */) {
+ else if (initializer.kind === 73 /* Identifier */) {
return getResolvedSymbol(initializer);
}
return undefined;
@@ -49539,13 +50388,13 @@
*/
function isForInVariableForNumericPropertyNames(expr) {
var e = ts.skipParentheses(expr);
- if (e.kind === 72 /* Identifier */) {
+ if (e.kind === 73 /* Identifier */) {
var symbol = getResolvedSymbol(e);
if (symbol.flags & 3 /* Variable */) {
var child = expr;
var node = expr.parent;
while (node) {
- if (node.kind === 226 /* ForInStatement */ &&
+ if (node.kind === 227 /* ForInStatement */ &&
child === node.statement &&
getForInVariableSymbol(node) === symbol &&
hasNumericPropertyNames(getTypeOfExpression(node.expression))) {
@@ -49563,7 +50412,7 @@
var indexExpression = node.argumentExpression;
if (!indexExpression) {
var sourceFile = ts.getSourceFileOfNode(node);
- if (node.parent.kind === 192 /* NewExpression */ && node.parent.expression === node) {
+ if (node.parent.kind === 193 /* NewExpression */ && node.parent.expression === node) {
var start = ts.skipTrivia(sourceFile.text, node.expression.end);
var end = node.end;
grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead);
@@ -49583,7 +50432,12 @@
error(indexExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal);
return errorType;
}
- return checkIndexedAccessIndexType(getIndexedAccessType(objectType, isForInVariableForNumericPropertyNames(indexExpression) ? numberType : indexType, node), node);
+ var effectiveIndexType = isForInVariableForNumericPropertyNames(indexExpression) ? numberType : indexType;
+ var accessFlags = ts.isAssignmentTarget(node) ?
+ 2 /* Writing */ | (isGenericObjectType(objectType) && !isThisTypeParameter(objectType) ? 1 /* NoIndexSignatures */ : 0) :
+ 0 /* None */;
+ var indexedAccessType = getIndexedAccessTypeOrUndefined(objectType, effectiveIndexType, node, accessFlags) || errorType;
+ return checkIndexedAccessIndexType(indexedAccessType, node);
}
function checkThatExpressionIsProperSymbolReference(expression, expressionType, reportError) {
if (expressionType === errorType) {
@@ -49629,13 +50483,13 @@
// This gets us diagnostics for the type arguments and marks them as referenced.
ts.forEach(node.typeArguments, checkSourceElement);
}
- if (node.kind === 193 /* TaggedTemplateExpression */) {
+ if (node.kind === 194 /* TaggedTemplateExpression */) {
checkExpression(node.template);
}
else if (ts.isJsxOpeningLikeElement(node)) {
checkExpression(node.attributes);
}
- else if (node.kind !== 152 /* Decorator */) {
+ else if (node.kind !== 153 /* Decorator */) {
ts.forEach(node.arguments, function (argument) {
checkExpression(argument);
});
@@ -49699,7 +50553,7 @@
}
}
function isSpreadArgument(arg) {
- return !!arg && (arg.kind === 208 /* SpreadElement */ || arg.kind === 215 /* SyntheticExpression */ && arg.isSpread);
+ return !!arg && (arg.kind === 209 /* SpreadElement */ || arg.kind === 216 /* SyntheticExpression */ && arg.isSpread);
}
function getSpreadArgumentIndex(args) {
return ts.findIndex(args, isSpreadArgument);
@@ -49713,9 +50567,9 @@
var callIsIncomplete = false; // In incomplete call we want to be lenient when we have too few arguments
var effectiveParameterCount = getParameterCount(signature);
var effectiveMinimumArguments = getMinArgumentCount(signature);
- if (node.kind === 193 /* TaggedTemplateExpression */) {
+ if (node.kind === 194 /* TaggedTemplateExpression */) {
argCount = args.length;
- if (node.template.kind === 206 /* TemplateExpression */) {
+ if (node.template.kind === 207 /* TemplateExpression */) {
// If a tagged template expression lacks a tail literal, the call is incomplete.
// Specifically, a template only can end in a TemplateTail or a Missing literal.
var lastSpan = ts.last(node.template.templateSpans); // we should always have at least one span.
@@ -49730,7 +50584,7 @@
callIsIncomplete = !!templateLiteral.isUnterminated;
}
}
- else if (node.kind === 152 /* Decorator */) {
+ else if (node.kind === 153 /* Decorator */) {
argCount = getDecoratorArgumentCount(node, signature);
}
else if (ts.isJsxOpeningLikeElement(node)) {
@@ -49745,7 +50599,7 @@
else {
if (!node.arguments) {
// This only happens when we have something of the form: 'new C'
- ts.Debug.assert(node.kind === 192 /* NewExpression */);
+ ts.Debug.assert(node.kind === 193 /* NewExpression */);
return getMinArgumentCount(signature) === 0;
}
argCount = signatureHelpTrailingComma ? args.length + 1 : args.length;
@@ -49784,12 +50638,23 @@
}
// If type has a single call signature and no other members, return that signature. Otherwise, return undefined.
function getSingleCallSignature(type) {
+ return getSingleSignature(type, 0 /* Call */, /*allowMembers*/ false);
+ }
+ function getSingleCallOrConstructSignature(type) {
+ return getSingleSignature(type, 0 /* Call */, /*allowMembers*/ false) ||
+ getSingleSignature(type, 1 /* Construct */, /*allowMembers*/ false);
+ }
+ function getSingleSignature(type, kind, allowMembers) {
if (type.flags & 524288 /* Object */) {
var resolved = resolveStructuredTypeMembers(type);
- if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 &&
- resolved.properties.length === 0 && !resolved.stringIndexInfo && !resolved.numberIndexInfo) {
+ if (allowMembers || resolved.properties.length === 0 && !resolved.stringIndexInfo && !resolved.numberIndexInfo) {
+ if (kind === 0 /* Call */ && resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0) {
return resolved.callSignatures[0];
}
+ if (kind === 1 /* Construct */ && resolved.constructSignatures.length === 1 && resolved.callSignatures.length === 0) {
+ return resolved.constructSignatures[0];
+ }
+ }
}
return undefined;
}
@@ -49808,7 +50673,7 @@
});
if (!inferenceContext) {
applyToReturnTypes(contextualSignature, signature, function (source, target) {
- inferTypes(context.inferences, source, target, 8 /* ReturnType */);
+ inferTypes(context.inferences, source, target, 16 /* ReturnType */);
});
}
return getSignatureInstantiation(signature, getInferredTypes(context), ts.isInJSFile(contextualSignature.declaration));
@@ -49827,7 +50692,7 @@
// example, given a 'function wrap<T, U>(cb: (x: T) => U): (x: T) => U' and a call expression
// 'let f: (x: string) => number = wrap(s => s.length)', we infer from the declared type of 'f' to the
// return type of 'wrap'.
- if (node.kind !== 152 /* Decorator */) {
+ if (node.kind !== 153 /* Decorator */) {
var contextualType = getContextualType(node);
if (contextualType) {
// We clone the inference context to avoid disturbing a resolution in progress for an
@@ -49848,7 +50713,7 @@
instantiatedType;
var inferenceTargetType = getReturnTypeOfSignature(signature);
// Inferences made from return types have lower priority than all other inferences.
- inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 8 /* ReturnType */);
+ inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 16 /* ReturnType */);
// Create a type mapper for instantiating generic contextual types using the inferences made
// from the return type.
context.returnMapper = getMapperFromContext(cloneInferredPartOfContext(context));
@@ -49864,7 +50729,7 @@
var argCount = restType ? Math.min(getParameterCount(signature) - 1, args.length) : args.length;
for (var i = 0; i < argCount; i++) {
var arg = args[i];
- if (arg.kind !== 210 /* OmittedExpression */) {
+ if (arg.kind !== 211 /* OmittedExpression */) {
var paramType = getTypeAtPosition(signature, i);
var argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
inferTypes(context.inferences, argType, paramType);
@@ -49878,7 +50743,7 @@
}
function getArrayifiedType(type) {
if (forEachType(type, function (t) { return !(t.flags & (1 /* Any */ | 63176704 /* Instantiable */) || isArrayType(t) || isTupleType(t)); })) {
- return createArrayType(getIndexTypeOfType(type, 1 /* Number */) || errorType);
+ return createArrayType(getIndexedAccessType(type, numberType));
}
return type;
}
@@ -49888,20 +50753,20 @@
if (isSpreadArgument(arg)) {
// We are inferring from a spread expression in the last argument position, i.e. both the parameter
// and the argument are ...x forms.
- return arg.kind === 215 /* SyntheticExpression */ ?
+ return arg.kind === 216 /* SyntheticExpression */ ?
createArrayType(arg.type) :
getArrayifiedType(checkExpressionWithContextualType(arg.expression, restType, context, 0 /* Normal */));
}
}
- var contextualType = getIndexTypeOfType(restType, 1 /* Number */) || anyType;
- var hasPrimitiveContextualType = maybeTypeOfKind(contextualType, 131068 /* Primitive */ | 4194304 /* Index */);
var types = [];
var spreadIndex = -1;
for (var i = index; i < argCount; i++) {
+ var contextualType = getIndexedAccessType(restType, getLiteralType(i - index));
var argType = checkExpressionWithContextualType(args[i], contextualType, context, 0 /* Normal */);
if (spreadIndex < 0 && isSpreadArgument(args[i])) {
spreadIndex = i - index;
}
+ var hasPrimitiveContextualType = maybeTypeOfKind(contextualType, 131068 /* Primitive */ | 4194304 /* Index */);
types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType));
}
return spreadIndex < 0 ?
@@ -49962,7 +50827,7 @@
return checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation, checkMode, reportErrors);
}
var thisType = getThisTypeOfSignature(signature);
- if (thisType && thisType !== voidType && node.kind !== 192 /* NewExpression */) {
+ if (thisType && thisType !== voidType && node.kind !== 193 /* NewExpression */) {
// If the called expression is not of the form `x.f` or `x["f"]`, then sourceType = voidType
// If the signature's 'this' type is voidType, then the check is skipped -- anything is compatible.
// If the expression is a new expression, then the check is skipped.
@@ -49979,7 +50844,7 @@
var argCount = restType ? Math.min(getParameterCount(signature) - 1, args.length) : args.length;
for (var i = 0; i < argCount; i++) {
var arg = args[i];
- if (arg.kind !== 210 /* OmittedExpression */) {
+ if (arg.kind !== 211 /* OmittedExpression */) {
var paramType = getTypeAtPosition(signature, i);
var argType = checkExpressionWithContextualType(arg, paramType, /*inferenceContext*/ undefined, checkMode);
// If one or more arguments are still excluded (as indicated by CheckMode.SkipContextSensitive),
@@ -50002,15 +50867,15 @@
* Returns the this argument in calls like x.f(...) and x[f](...). Undefined otherwise.
*/
function getThisArgumentOfCall(node) {
- if (node.kind === 191 /* CallExpression */) {
+ if (node.kind === 192 /* CallExpression */) {
var callee = ts.skipOuterExpressions(node.expression);
- if (callee.kind === 189 /* PropertyAccessExpression */ || callee.kind === 190 /* ElementAccessExpression */) {
+ if (callee.kind === 190 /* PropertyAccessExpression */ || callee.kind === 191 /* ElementAccessExpression */) {
return callee.expression;
}
}
}
function createSyntheticExpression(parent, type, isSpread) {
- var result = ts.createNode(215 /* SyntheticExpression */, parent.pos, parent.end);
+ var result = ts.createNode(216 /* SyntheticExpression */, parent.pos, parent.end);
result.parent = parent;
result.type = type;
result.isSpread = isSpread || false;
@@ -50020,17 +50885,17 @@
* Returns the effective arguments for an expression that works like a function invocation.
*/
function getEffectiveCallArguments(node) {
- if (node.kind === 193 /* TaggedTemplateExpression */) {
+ if (node.kind === 194 /* TaggedTemplateExpression */) {
var template = node.template;
- var args_4 = [createSyntheticExpression(template, getGlobalTemplateStringsArrayType())];
- if (template.kind === 206 /* TemplateExpression */) {
+ var args_3 = [createSyntheticExpression(template, getGlobalTemplateStringsArrayType())];
+ if (template.kind === 207 /* TemplateExpression */) {
ts.forEach(template.templateSpans, function (span) {
- args_4.push(span.expression);
+ args_3.push(span.expression);
});
}
- return args_4;
+ return args_3;
}
- if (node.kind === 152 /* Decorator */) {
+ if (node.kind === 153 /* Decorator */) {
return getEffectiveDecoratorArguments(node);
}
if (ts.isJsxOpeningLikeElement(node)) {
@@ -50043,7 +50908,7 @@
// of the argument is a tuple type, spread the tuple elements into the argument list. We can
// call checkExpressionCached because spread expressions never have a contextual type.
var spreadArgument_1 = args[length - 1];
- var type = checkExpressionCached(spreadArgument_1.expression);
+ var type = flowLoopCount ? checkExpression(spreadArgument_1.expression) : checkExpressionCached(spreadArgument_1.expression);
if (isTupleType(type)) {
var typeArguments = type.typeArguments || ts.emptyArray;
var restIndex_2 = type.target.hasRestElement ? typeArguments.length - 1 : -1;
@@ -50060,30 +50925,30 @@
var parent = node.parent;
var expr = node.expression;
switch (parent.kind) {
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
// For a class decorator, the `target` is the type of the class (e.g. the
// "static" or "constructor" side of the class).
return [
createSyntheticExpression(expr, getTypeOfSymbol(getSymbolOfNode(parent)))
];
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
// A parameter declaration decorator will have three arguments (see
// `ParameterDecorator` in core.d.ts).
var func = parent.parent;
return [
- createSyntheticExpression(expr, parent.parent.kind === 157 /* Constructor */ ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType),
+ createSyntheticExpression(expr, parent.parent.kind === 158 /* Constructor */ ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType),
createSyntheticExpression(expr, anyType),
createSyntheticExpression(expr, numberType)
];
- case 154 /* PropertyDeclaration */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 155 /* PropertyDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
// A method or accessor declaration decorator will have two or three arguments (see
// `PropertyDecorator` and `MethodDecorator` in core.d.ts). If we are emitting decorators
// for ES3, we will only pass two arguments.
- var hasPropDesc = parent.kind !== 154 /* PropertyDeclaration */ && languageVersion !== 0 /* ES3 */;
+ var hasPropDesc = parent.kind !== 155 /* PropertyDeclaration */ && languageVersion !== 0 /* ES3 */;
return [
createSyntheticExpression(expr, getParentTypeOfClassElement(parent)),
createSyntheticExpression(expr, getClassElementPropertyKeyType(parent)),
@@ -50097,17 +50962,17 @@
*/
function getDecoratorArgumentCount(node, signature) {
switch (node.parent.kind) {
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
return 1;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return 2;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
// For ES3 or decorators with only two parameters we supply only two arguments
return languageVersion === 0 /* ES3 */ || signature.parameters.length <= 2 ? 2 : 3;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return 3;
default:
return ts.Debug.fail();
@@ -50207,15 +51072,15 @@
return ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), typeArguments, ts.Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount);
}
function resolveCall(node, signatures, candidatesOutArray, checkMode, fallbackError) {
- var isTaggedTemplate = node.kind === 193 /* TaggedTemplateExpression */;
- var isDecorator = node.kind === 152 /* Decorator */;
+ var isTaggedTemplate = node.kind === 194 /* TaggedTemplateExpression */;
+ var isDecorator = node.kind === 153 /* Decorator */;
var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node);
var reportErrors = !candidatesOutArray;
var typeArguments;
if (!isDecorator) {
typeArguments = node.typeArguments;
// We already perform checking on the type arguments on the class declaration itself.
- if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 98 /* SuperKeyword */) {
+ if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 99 /* SuperKeyword */) {
ts.forEach(typeArguments, checkSourceElement);
}
}
@@ -50270,7 +51135,7 @@
var result;
// If we are in signature help, a trailing comma indicates that we intend to provide another argument,
// so we will only accept overloads with arity at least 1 higher than the current number of provided arguments.
- var signatureHelpTrailingComma = !!(checkMode & 16 /* IsForSignatureHelp */) && node.kind === 191 /* CallExpression */ && node.arguments.hasTrailingComma;
+ var signatureHelpTrailingComma = !!(checkMode & 16 /* IsForSignatureHelp */) && node.kind === 192 /* CallExpression */ && node.arguments.hasTrailingComma;
// Section 4.12.1:
// if the candidate list contains one or more signatures for which the type of each argument
// expression is a subtype of each corresponding parameter type, the return type of the first
@@ -50421,7 +51286,7 @@
}
var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
var parameters = [];
- var _loop_8 = function (i) {
+ var _loop_11 = function (i) {
var symbols = ts.mapDefined(candidates, function (_a) {
var parameters = _a.parameters, hasRestParameter = _a.hasRestParameter;
return hasRestParameter ?
@@ -50432,7 +51297,7 @@
parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
};
for (var i = 0; i < maxNonRestParam; i++) {
- _loop_8(i);
+ _loop_11(i);
}
var restParameterSymbols = ts.mapDefined(candidates, function (c) { return c.hasRestParameter ? ts.last(c.parameters) : undefined; });
var hasRestParameter = restParameterSymbols.length !== 0;
@@ -50510,7 +51375,7 @@
return maxParamsIndex;
}
function resolveCallExpression(node, candidatesOutArray, checkMode) {
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
var superType = checkSuperExpression(node.expression);
if (isTypeAny(superType)) {
for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) {
@@ -50787,16 +51652,16 @@
*/
function getDiagnosticHeadMessageForDecoratorResolution(node) {
switch (node.parent.kind) {
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression;
default:
return ts.Debug.fail();
@@ -50839,7 +51704,7 @@
// file would probably be preferable.
var typeSymbol = exports && getSymbol(exports, JsxNames.Element, 67897832 /* Type */);
var returnNode = typeSymbol && nodeBuilder.symbolToEntityName(typeSymbol, 67897832 /* Type */, node);
- var declaration = ts.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.createKeywordTypeNode(120 /* AnyKeyword */));
+ var declaration = ts.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.createKeywordTypeNode(121 /* AnyKeyword */));
var parameterSymbol = createSymbol(1 /* FunctionScopedVariable */, "props");
parameterSymbol.type = result;
return createSignature(declaration,
@@ -50886,16 +51751,16 @@
}
function resolveSignature(node, candidatesOutArray, checkMode) {
switch (node.kind) {
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return resolveCallExpression(node, candidatesOutArray, checkMode);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return resolveNewExpression(node, candidatesOutArray, checkMode);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode);
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
return resolveDecorator(node, candidatesOutArray, checkMode);
- case 262 /* JsxOpeningElement */:
- case 261 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
+ case 262 /* JsxSelfClosingElement */:
return resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode);
}
throw ts.Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable.");
@@ -50982,10 +51847,10 @@
return false;
}
var parent = node.parent;
- while (parent && parent.kind === 189 /* PropertyAccessExpression */) {
+ while (parent && parent.kind === 190 /* PropertyAccessExpression */) {
parent = parent.parent;
}
- if (parent && ts.isBinaryExpression(parent) && ts.isPrototypeAccess(parent.left) && parent.operatorToken.kind === 59 /* EqualsToken */) {
+ if (parent && ts.isBinaryExpression(parent) && ts.isPrototypeAccess(parent.left) && parent.operatorToken.kind === 60 /* EqualsToken */) {
var right = ts.getInitializerOfBinaryExpression(parent);
return ts.isObjectLiteralExpression(right) && right;
}
@@ -51011,15 +51876,15 @@
// returns a function type. We defer checking and return nonInferrableType.
return nonInferrableType;
}
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
return voidType;
}
- if (node.kind === 192 /* NewExpression */) {
+ if (node.kind === 193 /* NewExpression */) {
var declaration = signature.declaration;
if (declaration &&
- declaration.kind !== 157 /* Constructor */ &&
- declaration.kind !== 161 /* ConstructSignature */ &&
- declaration.kind !== 166 /* ConstructorType */ &&
+ declaration.kind !== 158 /* Constructor */ &&
+ declaration.kind !== 162 /* ConstructSignature */ &&
+ declaration.kind !== 167 /* ConstructorType */ &&
!ts.isJSDocConstructSignature(declaration) &&
!isJSConstructor(declaration)) {
// When resolved signature is a call signature (and not a construct signature) the result type is any
@@ -51136,9 +52001,9 @@
return false;
}
var targetDeclarationKind = resolvedRequire.flags & 16 /* Function */
- ? 239 /* FunctionDeclaration */
+ ? 240 /* FunctionDeclaration */
: resolvedRequire.flags & 3 /* Variable */
- ? 237 /* VariableDeclaration */
+ ? 238 /* VariableDeclaration */
: 0 /* Unknown */;
if (targetDeclarationKind !== 0 /* Unknown */) {
var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind);
@@ -51163,18 +52028,25 @@
case 14 /* NoSubstitutionTemplateLiteral */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
- case 187 /* ArrayLiteralExpression */:
- case 188 /* ObjectLiteralExpression */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
+ case 188 /* ArrayLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return true;
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return isValidConstAssertionArgument(node.expression);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
var op = node.operator;
var arg = node.operand;
return op === 39 /* MinusToken */ && (arg.kind === 8 /* NumericLiteral */ || arg.kind === 9 /* BigIntLiteral */) ||
op === 38 /* PlusToken */ && arg.kind === 8 /* NumericLiteral */;
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
+ var expr = node.expression;
+ if (ts.isIdentifier(expr)) {
+ var symbol = getSymbolAtLocation(expr);
+ return !!(symbol && (symbol.flags & 384 /* Enum */) && getEnumKind(symbol) === 1 /* Literal */);
+ }
}
return false;
}
@@ -51182,7 +52054,7 @@
var exprType = checkExpression(expression, checkMode);
if (ts.isConstTypeReference(type)) {
if (!isValidConstAssertionArgument(expression)) {
- error(expression, ts.Diagnostics.A_const_assertion_can_only_be_applied_to_a_string_number_boolean_array_or_object_literal);
+ error(expression, ts.Diagnostics.A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals);
}
return getRegularTypeOfLiteralType(exprType);
}
@@ -51202,10 +52074,10 @@
}
function checkMetaProperty(node) {
checkGrammarMetaProperty(node);
- if (node.keywordToken === 95 /* NewKeyword */) {
+ if (node.keywordToken === 96 /* NewKeyword */) {
return checkNewTargetMetaProperty(node);
}
- if (node.keywordToken === 92 /* ImportKeyword */) {
+ if (node.keywordToken === 93 /* ImportKeyword */) {
return checkImportMetaProperty(node);
}
return ts.Debug.assertNever(node.keywordToken);
@@ -51216,7 +52088,7 @@
error(node, ts.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target");
return errorType;
}
- else if (container.kind === 157 /* Constructor */) {
+ else if (container.kind === 158 /* Constructor */) {
var symbol = getSymbolOfNode(container.parent);
return getTypeOfSymbol(symbol);
}
@@ -51226,7 +52098,7 @@
}
}
function checkImportMetaProperty(node) {
- if (languageVersion < 7 /* ESNext */ || moduleKind < ts.ModuleKind.ESNext) {
+ if (languageVersion < 8 /* ESNext */ || moduleKind < ts.ModuleKind.ESNext) {
error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_using_ESNext_for_the_target_and_module_compiler_options);
}
var file = ts.getSourceFileOfNode(node);
@@ -51402,7 +52274,7 @@
for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) {
var element = _a[_i];
if (!ts.isOmittedExpression(element)) {
- if (element.name.kind === 72 /* Identifier */) {
+ if (element.name.kind === 73 /* Identifier */) {
getSymbolLinks(getSymbolOfNode(element)).type = getTypeForBindingElement(element);
}
else {
@@ -51416,9 +52288,9 @@
if (!links.type) {
links.type = contextualType;
var decl = parameter.valueDeclaration;
- if (decl.name.kind !== 72 /* Identifier */) {
+ if (decl.name.kind !== 73 /* Identifier */) {
// if inference didn't come up with anything but {}, fall back to the binding pattern if present.
- if (links.type === emptyObjectType) {
+ if (links.type === unknownType) {
links.type = getTypeFromBindingPattern(decl.name);
}
assignBindingElementTypes(decl.name);
@@ -51430,24 +52302,24 @@
var globalPromiseType = getGlobalPromiseType(/*reportErrors*/ true);
if (globalPromiseType !== emptyGenericType) {
// if the promised type is itself a promise, get the underlying type; otherwise, fallback to the promised type
- promisedType = getAwaitedType(promisedType) || emptyObjectType;
+ promisedType = getAwaitedType(promisedType) || unknownType;
return createTypeReference(globalPromiseType, [promisedType]);
}
- return emptyObjectType;
+ return unknownType;
}
function createPromiseLikeType(promisedType) {
// creates a `PromiseLike<T>` type where `T` is the promisedType argument
var globalPromiseLikeType = getGlobalPromiseLikeType(/*reportErrors*/ true);
if (globalPromiseLikeType !== emptyGenericType) {
// if the promised type is itself a promise, get the underlying type; otherwise, fallback to the promised type
- promisedType = getAwaitedType(promisedType) || emptyObjectType;
+ promisedType = getAwaitedType(promisedType) || unknownType;
return createTypeReference(globalPromiseLikeType, [promisedType]);
}
- return emptyObjectType;
+ return unknownType;
}
function createPromiseReturnType(func, promisedType) {
var promiseType = createPromiseType(promisedType);
- if (promiseType === emptyObjectType) {
+ if (promiseType === unknownType) {
error(func, ts.isImportCall(func) ?
ts.Diagnostics.A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option :
ts.Diagnostics.An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option);
@@ -51466,7 +52338,7 @@
}
var functionFlags = ts.getFunctionFlags(func);
var type;
- if (func.body.kind !== 218 /* Block */) {
+ if (func.body.kind !== 219 /* Block */) {
type = checkExpressionCached(func.body, checkMode && checkMode & ~8 /* SkipGenericFunctions */);
if (functionFlags & 2 /* Async */) {
// From within an async function you can return either a non-promise value or a promise. Any
@@ -51608,7 +52480,7 @@
if (!node.possiblyExhaustive) {
return false;
}
- if (node.expression.kind === 199 /* TypeOfExpression */) {
+ if (node.expression.kind === 200 /* TypeOfExpression */) {
var operandType = getTypeOfExpression(node.expression.expression);
// This cast is safe because the switch is possibly exhaustive and does not contain a default case, so there can be no undefined.
var witnesses = getSwitchClauseTypeOfWitnesses(node);
@@ -51631,7 +52503,7 @@
if (!(func.flags & 128 /* HasImplicitReturn */)) {
return false;
}
- if (ts.some(func.body.statements, function (statement) { return statement.kind === 232 /* SwitchStatement */ && isExhaustiveSwitchStatement(statement); })) {
+ if (ts.some(func.body.statements, function (statement) { return statement.kind === 233 /* SwitchStatement */ && isExhaustiveSwitchStatement(statement); })) {
return false;
}
return true;
@@ -51674,11 +52546,11 @@
}
function mayReturnNever(func) {
switch (func.kind) {
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return true;
- case 156 /* MethodDeclaration */:
- return func.parent.kind === 188 /* ObjectLiteralExpression */;
+ case 157 /* MethodDeclaration */:
+ return func.parent.kind === 189 /* ObjectLiteralExpression */;
default:
return false;
}
@@ -51702,7 +52574,7 @@
}
// If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check.
// also if HasImplicitReturn flag is not set this means that all codepaths in function body end with return or throw
- if (func.kind === 155 /* MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 218 /* Block */ || !functionHasImplicitReturn(func)) {
+ if (func.kind === 156 /* MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 219 /* Block */ || !functionHasImplicitReturn(func)) {
return;
}
var hasExplicitReturn = func.flags & 256 /* HasExplicitReturn */;
@@ -51735,7 +52607,7 @@
}
}
function checkFunctionExpressionOrObjectLiteralMethod(node, checkMode) {
- ts.Debug.assert(node.kind !== 156 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
+ ts.Debug.assert(node.kind !== 157 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
checkNodeDeferred(node);
// The identityMapper object is used to indicate that function expressions are wildcards
if (checkMode && checkMode & 4 /* SkipContextSensitive */ && isContextSensitive(node)) {
@@ -51755,7 +52627,7 @@
}
// Grammar checking
var hasGrammarError = checkGrammarFunctionLikeDeclaration(node);
- if (!hasGrammarError && node.kind === 196 /* FunctionExpression */) {
+ if (!hasGrammarError && node.kind === 197 /* FunctionExpression */) {
checkGrammarForGenerator(node);
}
var links = getNodeLinks(node);
@@ -51800,7 +52672,7 @@
getAwaitedType(type) || errorType : type;
}
function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) {
- ts.Debug.assert(node.kind !== 156 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
+ ts.Debug.assert(node.kind !== 157 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
var functionFlags = ts.getFunctionFlags(node);
var returnOrPromisedType = getReturnOrPromisedType(node, functionFlags);
if ((functionFlags & 1 /* Generator */) === 0) { // Async function or normal function
@@ -51816,7 +52688,7 @@
// checkFunctionExpressionBodies). So it must be done now.
getReturnTypeOfSignature(getSignatureFromDeclaration(node));
}
- if (node.body.kind === 218 /* Block */) {
+ if (node.body.kind === 219 /* Block */) {
checkSourceElement(node.body);
}
else {
@@ -51894,11 +52766,11 @@
if (isReadonlySymbol(symbol)) {
// Allow assignments to readonly properties within constructors of the same class declaration.
if (symbol.flags & 4 /* Property */ &&
- (expr.kind === 189 /* PropertyAccessExpression */ || expr.kind === 190 /* ElementAccessExpression */) &&
- expr.expression.kind === 100 /* ThisKeyword */) {
+ (expr.kind === 190 /* PropertyAccessExpression */ || expr.kind === 191 /* ElementAccessExpression */) &&
+ expr.expression.kind === 101 /* ThisKeyword */) {
// Look for if this is the constructor for the class that `symbol` is a property of.
var func = ts.getContainingFunction(expr);
- if (!(func && func.kind === 157 /* Constructor */)) {
+ if (!(func && func.kind === 158 /* Constructor */)) {
return true;
}
// If func.parent is a class and symbol is a (readonly) property of that class, or
@@ -51911,13 +52783,13 @@
return false;
}
function isReferenceThroughNamespaceImport(expr) {
- if (expr.kind === 189 /* PropertyAccessExpression */ || expr.kind === 190 /* ElementAccessExpression */) {
+ if (expr.kind === 190 /* PropertyAccessExpression */ || expr.kind === 191 /* ElementAccessExpression */) {
var node = ts.skipParentheses(expr.expression);
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
var symbol = getNodeLinks(node).resolvedSymbol;
if (symbol.flags & 2097152 /* Alias */) {
var declaration = getDeclarationOfAliasSymbol(symbol);
- return !!declaration && declaration.kind === 251 /* NamespaceImport */;
+ return !!declaration && declaration.kind === 252 /* NamespaceImport */;
}
}
}
@@ -51926,7 +52798,7 @@
function checkReferenceExpression(expr, invalidReferenceMessage) {
// References are combinations of identifiers, parentheses, and property accesses.
var node = ts.skipOuterExpressions(expr, 2 /* Assertions */ | 1 /* Parentheses */);
- if (node.kind !== 72 /* Identifier */ && node.kind !== 189 /* PropertyAccessExpression */ && node.kind !== 190 /* ElementAccessExpression */) {
+ if (node.kind !== 73 /* Identifier */ && node.kind !== 190 /* PropertyAccessExpression */ && node.kind !== 191 /* ElementAccessExpression */) {
error(expr, invalidReferenceMessage);
return false;
}
@@ -51935,7 +52807,7 @@
function checkDeleteExpression(node) {
checkExpression(node.expression);
var expr = ts.skipParentheses(node.expression);
- if (expr.kind !== 189 /* PropertyAccessExpression */ && expr.kind !== 190 /* ElementAccessExpression */) {
+ if (expr.kind !== 190 /* PropertyAccessExpression */ && expr.kind !== 191 /* ElementAccessExpression */) {
error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference);
return booleanType;
}
@@ -51958,7 +52830,19 @@
// Grammar checking
if (produceDiagnostics) {
if (!(node.flags & 16384 /* AwaitContext */)) {
- grammarErrorOnFirstToken(node, ts.Diagnostics.await_expression_is_only_allowed_within_an_async_function);
+ // use of 'await' in non-async function
+ var sourceFile = ts.getSourceFileOfNode(node);
+ if (!hasParseDiagnostics(sourceFile)) {
+ var span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);
+ var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.await_expression_is_only_allowed_within_an_async_function);
+ var func = ts.getContainingFunction(node);
+ if (func && func.kind !== 158 /* Constructor */) {
+ ts.Debug.assert((ts.getFunctionFlags(func) & 2 /* Async */) === 0, "Enclosing function should never be an async function.");
+ var relatedInfo = ts.createDiagnosticForNode(func, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async);
+ ts.addRelatedInfo(diagnostic, relatedInfo);
+ }
+ diagnostics.add(diagnostic);
+ }
}
if (isInParameterInitializerBeforeContainingFunction(node)) {
error(node, ts.Diagnostics.await_expressions_cannot_be_used_in_a_parameter_initializer);
@@ -52050,8 +52934,8 @@
}
if (type.flags & 3145728 /* UnionOrIntersection */) {
var types = type.types;
- for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
- var t = types_16[_i];
+ for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
+ var t = types_15[_i];
if (maybeTypeOfKind(t, kind)) {
return true;
}
@@ -52130,16 +53014,17 @@
if (strictNullChecks && properties.length === 0) {
return checkNonNullType(sourceType, node);
}
- for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) {
- var p = properties_5[_i];
- checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, properties, rightIsThis);
+ for (var i = 0; i < properties.length; i++) {
+ checkObjectLiteralDestructuringPropertyAssignment(node, sourceType, i, properties, rightIsThis);
}
return sourceType;
}
/** Note: If property cannot be a SpreadAssignment, then allProperties does not need to be provided */
- function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties, rightIsThis) {
+ function checkObjectLiteralDestructuringPropertyAssignment(node, objectLiteralType, propertyIndex, allProperties, rightIsThis) {
if (rightIsThis === void 0) { rightIsThis = false; }
- if (property.kind === 275 /* PropertyAssignment */ || property.kind === 276 /* ShorthandPropertyAssignment */) {
+ var properties = node.properties;
+ var property = properties[propertyIndex];
+ if (property.kind === 276 /* PropertyAssignment */ || property.kind === 277 /* ShorthandPropertyAssignment */) {
var name = property.name;
var exprType = getLiteralTypeFromPropertyName(name);
if (isTypeUsableAsPropertyName(exprType)) {
@@ -52152,22 +53037,30 @@
}
var elementType = getIndexedAccessType(objectLiteralType, exprType, name);
var type = getFlowTypeOfDestructuring(property, elementType);
- return checkDestructuringAssignment(property.kind === 276 /* ShorthandPropertyAssignment */ ? property : property.initializer, type);
+ return checkDestructuringAssignment(property.kind === 277 /* ShorthandPropertyAssignment */ ? property : property.initializer, type);
+ }
+ else if (property.kind === 278 /* SpreadAssignment */) {
+ if (propertyIndex < properties.length - 1) {
+ error(property, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);
}
- else if (property.kind === 277 /* SpreadAssignment */) {
- if (languageVersion < 7 /* ESNext */) {
+ else {
+ if (languageVersion < 8 /* ESNext */) {
checkExternalEmitHelpers(property, 4 /* Rest */);
}
var nonRestNames = [];
if (allProperties) {
- for (var i = 0; i < allProperties.length - 1; i++) {
- nonRestNames.push(allProperties[i].name);
+ for (var _i = 0, allProperties_1 = allProperties; _i < allProperties_1.length; _i++) {
+ var otherProperty = allProperties_1[_i];
+ if (!ts.isSpreadAssignment(otherProperty)) {
+ nonRestNames.push(otherProperty.name);
+ }
}
}
var type = getRestType(objectLiteralType, nonRestNames, objectLiteralType.symbol);
checkGrammarForDisallowedTrailingComma(allProperties, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma);
return checkDestructuringAssignment(property.expression, type);
}
+ }
else {
error(property, ts.Diagnostics.Property_assignment_expected);
}
@@ -52189,8 +53082,8 @@
function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, checkMode) {
var elements = node.elements;
var element = elements[elementIndex];
- if (element.kind !== 210 /* OmittedExpression */) {
- if (element.kind !== 208 /* SpreadElement */) {
+ if (element.kind !== 211 /* OmittedExpression */) {
+ if (element.kind !== 209 /* SpreadElement */) {
var indexType = getLiteralType(elementIndex);
if (isArrayLikeType(sourceType)) {
// We create a synthetic expression so that getIndexedAccessType doesn't get confused
@@ -52206,7 +53099,7 @@
}
else {
var restExpression = element.expression;
- if (restExpression.kind === 204 /* BinaryExpression */ && restExpression.operatorToken.kind === 59 /* EqualsToken */) {
+ if (restExpression.kind === 205 /* BinaryExpression */ && restExpression.operatorToken.kind === 60 /* EqualsToken */) {
error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer);
}
else {
@@ -52222,7 +53115,7 @@
}
function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode, rightIsThis) {
var target;
- if (exprOrAssignment.kind === 276 /* ShorthandPropertyAssignment */) {
+ if (exprOrAssignment.kind === 277 /* ShorthandPropertyAssignment */) {
var prop = exprOrAssignment;
if (prop.objectAssignmentInitializer) {
// In strict null checking mode, if a default value of a non-undefined type is specified, remove
@@ -52238,21 +53131,21 @@
else {
target = exprOrAssignment;
}
- if (target.kind === 204 /* BinaryExpression */ && target.operatorToken.kind === 59 /* EqualsToken */) {
+ if (target.kind === 205 /* BinaryExpression */ && target.operatorToken.kind === 60 /* EqualsToken */) {
checkBinaryExpression(target, checkMode);
target = target.left;
}
- if (target.kind === 188 /* ObjectLiteralExpression */) {
+ if (target.kind === 189 /* ObjectLiteralExpression */) {
return checkObjectLiteralAssignment(target, sourceType, rightIsThis);
}
- if (target.kind === 187 /* ArrayLiteralExpression */) {
+ if (target.kind === 188 /* ArrayLiteralExpression */) {
return checkArrayLiteralAssignment(target, sourceType, checkMode);
}
return checkReferenceAssignment(target, sourceType, checkMode);
}
function checkReferenceAssignment(target, sourceType, checkMode) {
var targetType = checkExpression(target, checkMode);
- var error = target.parent.kind === 277 /* SpreadAssignment */ ?
+ var error = target.parent.kind === 278 /* SpreadAssignment */ ?
ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access :
ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access;
if (checkReferenceExpression(target, error)) {
@@ -52271,39 +53164,39 @@
function isSideEffectFree(node) {
node = ts.skipParentheses(node);
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
case 10 /* StringLiteral */:
case 13 /* RegularExpressionLiteral */:
- case 193 /* TaggedTemplateExpression */:
- case 206 /* TemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
+ case 207 /* TemplateExpression */:
case 14 /* NoSubstitutionTemplateLiteral */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
- case 96 /* NullKeyword */:
- case 141 /* UndefinedKeyword */:
- case 196 /* FunctionExpression */:
- case 209 /* ClassExpression */:
- case 197 /* ArrowFunction */:
- case 187 /* ArrayLiteralExpression */:
- case 188 /* ObjectLiteralExpression */:
- case 199 /* TypeOfExpression */:
- case 213 /* NonNullExpression */:
- case 261 /* JsxSelfClosingElement */:
- case 260 /* JsxElement */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
+ case 97 /* NullKeyword */:
+ case 142 /* UndefinedKeyword */:
+ case 197 /* FunctionExpression */:
+ case 210 /* ClassExpression */:
+ case 198 /* ArrowFunction */:
+ case 188 /* ArrayLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
+ case 200 /* TypeOfExpression */:
+ case 214 /* NonNullExpression */:
+ case 262 /* JsxSelfClosingElement */:
+ case 261 /* JsxElement */:
return true;
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return isSideEffectFree(node.whenTrue) &&
isSideEffectFree(node.whenFalse);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
if (ts.isAssignmentOperator(node.operatorToken.kind)) {
return false;
}
return isSideEffectFree(node.left) &&
isSideEffectFree(node.right);
- case 202 /* PrefixUnaryExpression */:
- case 203 /* PostfixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
// Unary operators ~, !, +, and - have no side effects.
// The rest do.
switch (node.operator) {
@@ -52315,9 +53208,9 @@
}
return false;
// Some forms listed here for clarity
- case 200 /* VoidExpression */: // Explicit opt-out
- case 194 /* TypeAssertionExpression */: // Not SEF, but can produce useful type warnings
- case 212 /* AsExpression */: // Not SEF, but can produce useful type warnings
+ case 201 /* VoidExpression */: // Explicit opt-out
+ case 195 /* TypeAssertionExpression */: // Not SEF, but can produce useful type warnings
+ case 213 /* AsExpression */: // Not SEF, but can produce useful type warnings
default:
return false;
}
@@ -52333,8 +53226,8 @@
}
function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) {
var operator = operatorToken.kind;
- if (operator === 59 /* EqualsToken */ && (left.kind === 188 /* ObjectLiteralExpression */ || left.kind === 187 /* ArrayLiteralExpression */)) {
- return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode, right.kind === 100 /* ThisKeyword */);
+ if (operator === 60 /* EqualsToken */ && (left.kind === 189 /* ObjectLiteralExpression */ || left.kind === 188 /* ArrayLiteralExpression */)) {
+ return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode, right.kind === 101 /* ThisKeyword */);
}
var leftType;
if (operator === 54 /* AmpersandAmpersandToken */ || operator === 55 /* BarBarToken */) {
@@ -52347,26 +53240,26 @@
switch (operator) {
case 40 /* AsteriskToken */:
case 41 /* AsteriskAsteriskToken */:
- case 62 /* AsteriskEqualsToken */:
- case 63 /* AsteriskAsteriskEqualsToken */:
+ case 63 /* AsteriskEqualsToken */:
+ case 64 /* AsteriskAsteriskEqualsToken */:
case 42 /* SlashToken */:
- case 64 /* SlashEqualsToken */:
+ case 65 /* SlashEqualsToken */:
case 43 /* PercentToken */:
- case 65 /* PercentEqualsToken */:
+ case 66 /* PercentEqualsToken */:
case 39 /* MinusToken */:
- case 61 /* MinusEqualsToken */:
+ case 62 /* MinusEqualsToken */:
case 46 /* LessThanLessThanToken */:
- case 66 /* LessThanLessThanEqualsToken */:
+ case 67 /* LessThanLessThanEqualsToken */:
case 47 /* GreaterThanGreaterThanToken */:
- case 67 /* GreaterThanGreaterThanEqualsToken */:
+ case 68 /* GreaterThanGreaterThanEqualsToken */:
case 48 /* GreaterThanGreaterThanGreaterThanToken */:
- case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
+ case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
case 50 /* BarToken */:
- case 70 /* BarEqualsToken */:
+ case 71 /* BarEqualsToken */:
case 51 /* CaretToken */:
- case 71 /* CaretEqualsToken */:
+ case 72 /* CaretEqualsToken */:
case 49 /* AmpersandToken */:
- case 69 /* AmpersandEqualsToken */:
+ case 70 /* AmpersandEqualsToken */:
if (leftType === silentNeverType || rightType === silentNeverType) {
return silentNeverType;
}
@@ -52396,7 +53289,7 @@
else if (isTypeAssignableToKind(leftType, 2112 /* BigIntLike */) && isTypeAssignableToKind(rightType, 2112 /* BigIntLike */)) {
switch (operator) {
case 48 /* GreaterThanGreaterThanGreaterThanToken */:
- case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
+ case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
reportOperatorError();
}
resultType_1 = bigintType;
@@ -52411,7 +53304,7 @@
return resultType_1;
}
case 38 /* PlusToken */:
- case 60 /* PlusEqualsToken */:
+ case 61 /* PlusEqualsToken */:
if (leftType === silentNeverType || rightType === silentNeverType) {
return silentNeverType;
}
@@ -52446,7 +53339,7 @@
reportOperatorError();
return anyType;
}
- if (operator === 60 /* PlusEqualsToken */) {
+ if (operator === 61 /* PlusEqualsToken */) {
checkAssignmentOperator(resultType);
}
return resultType;
@@ -52467,19 +53360,13 @@
case 34 /* ExclamationEqualsToken */:
case 35 /* EqualsEqualsEqualsToken */:
case 36 /* ExclamationEqualsEqualsToken */:
- var leftIsLiteral = isLiteralType(leftType);
- var rightIsLiteral = isLiteralType(rightType);
- if (!leftIsLiteral || !rightIsLiteral) {
- leftType = leftIsLiteral ? getBaseTypeOfLiteralType(leftType) : leftType;
- rightType = rightIsLiteral ? getBaseTypeOfLiteralType(rightType) : rightType;
- }
if (!isTypeEqualityComparableTo(leftType, rightType) && !isTypeEqualityComparableTo(rightType, leftType)) {
reportOperatorError();
}
return booleanType;
- case 94 /* InstanceOfKeyword */:
+ case 95 /* InstanceOfKeyword */:
return checkInstanceOfExpression(left, right, leftType, rightType);
- case 93 /* InKeyword */:
+ case 94 /* InKeyword */:
return checkInExpression(left, right, leftType, rightType);
case 54 /* AmpersandAmpersandToken */:
return getTypeFacts(leftType) & 4194304 /* Truthy */ ?
@@ -52489,7 +53376,7 @@
return getTypeFacts(leftType) & 8388608 /* Falsy */ ?
getUnionType([removeDefinitelyFalsyTypes(leftType), rightType], 2 /* Subtype */) :
leftType;
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
var declKind = ts.isBinaryExpression(left.parent) ? ts.getAssignmentDeclarationKind(left.parent) : 0 /* None */;
checkAssignmentDeclaration(declKind, rightType);
if (isAssignmentDeclaration(declKind)) {
@@ -52533,7 +53420,7 @@
}
}
function isEvalNode(node) {
- return node.kind === 72 /* Identifier */ && node.escapedText === "eval";
+ return node.kind === 73 /* Identifier */ && node.escapedText === "eval";
}
// Return true if there was no error, false if there was an error.
function checkForDisallowedESSymbolOperand(operator) {
@@ -52549,13 +53436,13 @@
function getSuggestedBooleanOperator(operator) {
switch (operator) {
case 50 /* BarToken */:
- case 70 /* BarEqualsToken */:
+ case 71 /* BarEqualsToken */:
return 55 /* BarBarToken */;
case 51 /* CaretToken */:
- case 71 /* CaretEqualsToken */:
+ case 72 /* CaretEqualsToken */:
return 36 /* ExclamationEqualsEqualsToken */;
case 49 /* AmpersandToken */:
- case 69 /* AmpersandEqualsToken */:
+ case 70 /* AmpersandEqualsToken */:
return 54 /* AmpersandAmpersandToken */;
default:
return undefined;
@@ -52594,8 +53481,7 @@
}
}
function reportOperatorError() {
- var leftStr = typeToString(leftType);
- var rightStr = typeToString(rightType);
+ var _a = getTypeNamesForErrorDisplay(leftType, rightType), leftStr = _a[0], rightStr = _a[1];
var errNode = errorNode || operatorToken;
if (!tryGiveBetterPrimaryError(errNode, leftStr, rightStr)) {
error(errNode, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, ts.tokenToString(operatorToken.kind), leftStr, rightStr);
@@ -52650,7 +53536,7 @@
// Async generator functions prior to ESNext require the __await, __asyncDelegator,
// and __asyncValues helpers
if ((functionFlags & 3 /* AsyncGenerator */) === 3 /* AsyncGenerator */ &&
- languageVersion < 7 /* ESNext */) {
+ languageVersion < 8 /* ESNext */) {
checkExternalEmitHelpers(node, 26624 /* AsyncDelegatorIncludes */);
}
// Generator functions prior to ES2015 require the __values helper
@@ -52692,7 +53578,7 @@
return stringType;
}
function getContextNode(node) {
- if (node.kind === 268 /* JsxAttributes */ && !ts.isJsxSelfClosingElement(node.parent)) {
+ if (node.kind === 269 /* JsxAttributes */ && !ts.isJsxSelfClosingElement(node.parent)) {
return node.parent.parent; // Needs to be the root JsxElement, so it encompasses the attributes _and_ the children (which are essentially part of the attributes)
}
return node;
@@ -52731,7 +53617,7 @@
}
function isTypeAssertion(node) {
node = ts.skipParentheses(node);
- return node.kind === 194 /* TypeAssertionExpression */ || node.kind === 212 /* AsExpression */;
+ return node.kind === 195 /* TypeAssertionExpression */ || node.kind === 213 /* AsExpression */;
}
function checkDeclarationInitializer(declaration) {
var initializer = ts.getEffectiveInitializer(declaration);
@@ -52762,7 +53648,7 @@
// If the contextual type is a type variable constrained to a primitive type, consider
// this a literal context for literals of that primitive type. For example, given a
// type parameter 'T extends string', infer string literal types for T.
- var constraint = getBaseConstraintOfType(contextualType) || emptyObjectType;
+ var constraint = getBaseConstraintOfType(contextualType) || unknownType;
return maybeTypeOfKind(constraint, 4 /* String */) && maybeTypeOfKind(candidateType, 128 /* StringLiteral */) ||
maybeTypeOfKind(constraint, 8 /* Number */) && maybeTypeOfKind(candidateType, 256 /* NumberLiteral */) ||
maybeTypeOfKind(constraint, 64 /* BigInt */) && maybeTypeOfKind(candidateType, 2048 /* BigIntLiteral */) ||
@@ -52795,7 +53681,7 @@
// Do not use hasDynamicName here, because that returns false for well known symbols.
// We want to perform checkComputedPropertyName for all computed properties, including
// well known symbols.
- if (node.name.kind === 149 /* ComputedPropertyName */) {
+ if (node.name.kind === 150 /* ComputedPropertyName */) {
checkComputedPropertyName(node.name);
}
return checkExpressionForMutableLocation(node.initializer, checkMode);
@@ -52806,7 +53692,7 @@
// Do not use hasDynamicName here, because that returns false for well known symbols.
// We want to perform checkComputedPropertyName for all computed properties, including
// well known symbols.
- if (node.name.kind === 149 /* ComputedPropertyName */) {
+ if (node.name.kind === 150 /* ComputedPropertyName */) {
checkComputedPropertyName(node.name);
}
var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, checkMode);
@@ -52814,16 +53700,18 @@
}
function instantiateTypeWithSingleGenericCallSignature(node, type, checkMode) {
if (checkMode && checkMode & (2 /* Inferential */ | 8 /* SkipGenericFunctions */)) {
- var signature = getSingleCallSignature(type);
+ var callSignature = getSingleSignature(type, 0 /* Call */, /*allowMembers*/ true);
+ var constructSignature = getSingleSignature(type, 1 /* Construct */, /*allowMembers*/ true);
+ var signature = callSignature || constructSignature;
if (signature && signature.typeParameters) {
+ var contextualType = getApparentTypeOfContextualType(node);
+ if (contextualType && !isMixinConstructorType(contextualType)) {
+ var contextualSignature = getSingleSignature(getNonNullableType(contextualType), callSignature ? 0 /* Call */ : 1 /* Construct */, /*allowMembers*/ false);
+ if (contextualSignature && !contextualSignature.typeParameters) {
if (checkMode & 8 /* SkipGenericFunctions */) {
skippedGenericFunction(node, checkMode);
return anyFunctionType;
}
- var contextualType = getApparentTypeOfContextualType(node);
- if (contextualType) {
- var contextualSignature = getSingleCallSignature(getNonNullableType(contextualType));
- if (contextualSignature && !contextualSignature.typeParameters) {
var context = getInferenceContext(node);
// We have an expression that is an argument of a generic function for which we are performing
// type argument inference. The expression is of a function type with a single generic call
@@ -52831,7 +53719,8 @@
// if the outer function returns a function type with a single non-generic call signature and
// if some of the outer function type parameters have no inferences so far. If so, we can
// potentially add inferred type parameters to the outer function return type.
- var returnSignature = context.signature && getSingleCallSignature(getReturnTypeOfSignature(context.signature));
+ var returnType = context.signature && getReturnTypeOfSignature(context.signature);
+ var returnSignature = returnType && getSingleCallOrConstructSignature(returnType);
if (returnSignature && !returnSignature.typeParameters && !ts.every(context.inferences, hasInferenceCandidates)) {
// Instantiate the signature with its own type parameters as type arguments, possibly
// renaming the type parameters to ensure they have unique names.
@@ -52946,7 +53835,7 @@
var expr = ts.skipParentheses(node);
// Optimize for the common case of a call to a function with a single non-generic call
// signature where we can just fetch the return type without checking the arguments.
- if (expr.kind === 191 /* CallExpression */ && expr.expression.kind !== 98 /* SuperKeyword */ && !ts.isRequireCall(expr, /*checkArgumentIsStringLiteralLike*/ true) && !isSymbolOrSymbolForCall(expr)) {
+ if (expr.kind === 192 /* CallExpression */ && expr.expression.kind !== 99 /* SuperKeyword */ && !ts.isRequireCall(expr, /*checkArgumentIsStringLiteralLike*/ true) && !isSymbolOrSymbolForCall(expr)) {
var funcType = checkNonNullExpression(expr.expression);
var signature = getSingleCallSignature(funcType);
if (signature && !signature.typeParameters) {
@@ -52995,10 +53884,10 @@
// - 'left' in property access
// - 'object' in indexed access
// - target in rhs of import statement
- var ok = (node.parent.kind === 189 /* PropertyAccessExpression */ && node.parent.expression === node) ||
- (node.parent.kind === 190 /* ElementAccessExpression */ && node.parent.expression === node) ||
- ((node.kind === 72 /* Identifier */ || node.kind === 148 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) ||
- (node.parent.kind === 167 /* TypeQuery */ && node.parent.exprName === node));
+ var ok = (node.parent.kind === 190 /* PropertyAccessExpression */ && node.parent.expression === node) ||
+ (node.parent.kind === 191 /* ElementAccessExpression */ && node.parent.expression === node) ||
+ ((node.kind === 73 /* Identifier */ || node.kind === 149 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) ||
+ (node.parent.kind === 168 /* TypeQuery */ && node.parent.exprName === node));
if (!ok) {
error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query);
}
@@ -53019,13 +53908,13 @@
}
function checkExpressionWorker(node, checkMode, forceTuple) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return checkIdentifier(node);
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
return checkThisExpression(node);
- case 98 /* SuperKeyword */:
+ case 99 /* SuperKeyword */:
return checkSuperExpression(node);
- case 96 /* NullKeyword */:
+ case 97 /* NullKeyword */:
return nullWideningType;
case 14 /* NoSubstitutionTemplateLiteral */:
case 10 /* StringLiteral */:
@@ -53036,82 +53925,82 @@
case 9 /* BigIntLiteral */:
checkGrammarBigIntLiteral(node);
return getFreshTypeOfLiteralType(getBigIntLiteralType(node));
- case 102 /* TrueKeyword */:
+ case 103 /* TrueKeyword */:
return trueType;
- case 87 /* FalseKeyword */:
+ case 88 /* FalseKeyword */:
return falseType;
- case 206 /* TemplateExpression */:
+ case 207 /* TemplateExpression */:
return checkTemplateExpression(node);
case 13 /* RegularExpressionLiteral */:
return globalRegExpType;
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return checkArrayLiteral(node, checkMode, forceTuple);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return checkObjectLiteral(node, checkMode);
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return checkPropertyAccessExpression(node);
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
return checkQualifiedName(node);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return checkIndexedAccess(node);
- case 191 /* CallExpression */:
- if (node.expression.kind === 92 /* ImportKeyword */) {
+ case 192 /* CallExpression */:
+ if (node.expression.kind === 93 /* ImportKeyword */) {
return checkImportCallExpression(node);
}
/* falls through */
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return checkCallExpression(node, checkMode);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return checkTaggedTemplateExpression(node);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return checkParenthesizedExpression(node, checkMode);
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
return checkClassExpression(node);
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode);
- case 199 /* TypeOfExpression */:
+ case 200 /* TypeOfExpression */:
return checkTypeOfExpression(node);
- case 194 /* TypeAssertionExpression */:
- case 212 /* AsExpression */:
+ case 195 /* TypeAssertionExpression */:
+ case 213 /* AsExpression */:
return checkAssertion(node);
- case 213 /* NonNullExpression */:
+ case 214 /* NonNullExpression */:
return checkNonNullAssertion(node);
- case 214 /* MetaProperty */:
+ case 215 /* MetaProperty */:
return checkMetaProperty(node);
- case 198 /* DeleteExpression */:
+ case 199 /* DeleteExpression */:
return checkDeleteExpression(node);
- case 200 /* VoidExpression */:
+ case 201 /* VoidExpression */:
return checkVoidExpression(node);
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
return checkAwaitExpression(node);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return checkPrefixUnaryExpression(node);
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return checkPostfixUnaryExpression(node);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return checkBinaryExpression(node, checkMode);
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return checkConditionalExpression(node, checkMode);
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
return checkSpreadExpression(node, checkMode);
- case 210 /* OmittedExpression */:
+ case 211 /* OmittedExpression */:
return undefinedWideningType;
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return checkYieldExpression(node);
- case 215 /* SyntheticExpression */:
+ case 216 /* SyntheticExpression */:
return node.type;
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return checkJsxExpression(node, checkMode);
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
return checkJsxElement(node, checkMode);
- case 261 /* JsxSelfClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
return checkJsxSelfClosingElement(node, checkMode);
- case 264 /* JsxFragment */:
+ case 265 /* JsxFragment */:
return checkJsxFragment(node);
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
return checkJsxAttributes(node, checkMode);
- case 262 /* JsxOpeningElement */:
+ case 263 /* JsxOpeningElement */:
ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement");
}
return errorType;
@@ -53133,7 +54022,7 @@
var constraintType = getConstraintOfTypeParameter(typeParameter);
var defaultType = getDefaultFromTypeParameter(typeParameter);
if (constraintType && defaultType) {
- checkTypeAssignableTo(defaultType, getTypeWithThisArgument(constraintType, defaultType), node.default, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1);
+ checkTypeAssignableTo(defaultType, getTypeWithThisArgument(instantiateType(constraintType, makeUnaryTypeMapper(typeParameter, defaultType)), defaultType), node.default, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1);
}
if (produceDiagnostics) {
checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0);
@@ -53148,7 +54037,7 @@
checkVariableLikeDeclaration(node);
var func = ts.getContainingFunction(node);
if (ts.hasModifier(node, 92 /* ParameterPropertyModifier */)) {
- if (!(func.kind === 157 /* Constructor */ && ts.nodeIsPresent(func.body))) {
+ if (!(func.kind === 158 /* Constructor */ && ts.nodeIsPresent(func.body))) {
error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation);
}
}
@@ -53159,10 +54048,10 @@
if (func.parameters.indexOf(node) !== 0) {
error(node, ts.Diagnostics.A_0_parameter_must_be_the_first_parameter, node.name.escapedText);
}
- if (func.kind === 157 /* Constructor */ || func.kind === 161 /* ConstructSignature */ || func.kind === 166 /* ConstructorType */) {
+ if (func.kind === 158 /* Constructor */ || func.kind === 162 /* ConstructSignature */ || func.kind === 167 /* ConstructorType */) {
error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter);
}
- if (func.kind === 197 /* ArrowFunction */) {
+ if (func.kind === 198 /* ArrowFunction */) {
error(node, ts.Diagnostics.An_arrow_function_cannot_have_a_this_parameter);
}
}
@@ -53218,13 +54107,13 @@
}
function getTypePredicateParent(node) {
switch (node.parent.kind) {
- case 197 /* ArrowFunction */:
- case 160 /* CallSignature */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 165 /* FunctionType */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 198 /* ArrowFunction */:
+ case 161 /* CallSignature */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 166 /* FunctionType */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
var parent = node.parent;
if (node === parent.type) {
return parent;
@@ -53238,11 +54127,11 @@
continue;
}
var name = element.name;
- if (name.kind === 72 /* Identifier */ && name.escapedText === predicateVariableName) {
+ if (name.kind === 73 /* Identifier */ && name.escapedText === predicateVariableName) {
error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName);
return true;
}
- else if (name.kind === 185 /* ArrayBindingPattern */ || name.kind === 184 /* ObjectBindingPattern */) {
+ else if (name.kind === 186 /* ArrayBindingPattern */ || name.kind === 185 /* ObjectBindingPattern */) {
if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) {
return true;
}
@@ -53251,19 +54140,19 @@
}
function checkSignatureDeclaration(node) {
// Grammar checking
- if (node.kind === 162 /* IndexSignature */) {
+ if (node.kind === 163 /* IndexSignature */) {
checkGrammarIndexSignature(node);
}
// TODO (yuisu): Remove this check in else-if when SyntaxKind.Construct is moved and ambient context is handled
- else if (node.kind === 165 /* FunctionType */ || node.kind === 239 /* FunctionDeclaration */ || node.kind === 166 /* ConstructorType */ ||
- node.kind === 160 /* CallSignature */ || node.kind === 157 /* Constructor */ ||
- node.kind === 161 /* ConstructSignature */) {
+ else if (node.kind === 166 /* FunctionType */ || node.kind === 240 /* FunctionDeclaration */ || node.kind === 167 /* ConstructorType */ ||
+ node.kind === 161 /* CallSignature */ || node.kind === 158 /* Constructor */ ||
+ node.kind === 162 /* ConstructSignature */) {
checkGrammarFunctionLikeDeclaration(node);
}
var functionFlags = ts.getFunctionFlags(node);
if (!(functionFlags & 4 /* Invalid */)) {
// Async generators prior to ESNext require the __await and __asyncGenerator helpers
- if ((functionFlags & 3 /* AsyncGenerator */) === 3 /* AsyncGenerator */ && languageVersion < 7 /* ESNext */) {
+ if ((functionFlags & 3 /* AsyncGenerator */) === 3 /* AsyncGenerator */ && languageVersion < 8 /* ESNext */) {
checkExternalEmitHelpers(node, 6144 /* AsyncGeneratorIncludes */);
}
// Async functions prior to ES2017 require the __awaiter helper
@@ -53287,10 +54176,10 @@
var returnTypeNode = ts.getEffectiveReturnTypeNode(node);
if (noImplicitAny && !returnTypeNode) {
switch (node.kind) {
- case 161 /* ConstructSignature */:
+ case 162 /* ConstructSignature */:
error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);
break;
- case 160 /* CallSignature */:
+ case 161 /* CallSignature */:
error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);
break;
}
@@ -53320,7 +54209,7 @@
checkAsyncFunctionReturnType(node, returnTypeNode);
}
}
- if (node.kind !== 162 /* IndexSignature */ && node.kind !== 294 /* JSDocFunctionType */) {
+ if (node.kind !== 163 /* IndexSignature */ && node.kind !== 295 /* JSDocFunctionType */) {
registerForUnusedIdentifiersCheck(node);
}
}
@@ -53337,7 +54226,7 @@
var staticNames = ts.createUnderscoreEscapedMap();
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
- if (member.kind === 157 /* Constructor */) {
+ if (member.kind === 158 /* Constructor */) {
for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) {
var param = _c[_b];
if (ts.isParameterPropertyDeclaration(param) && !ts.isBindingPattern(param.name)) {
@@ -53352,16 +54241,16 @@
var memberName = name && ts.getPropertyNameForPropertyNameNode(name);
if (name && memberName) {
switch (member.kind) {
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
addName(names, name, memberName, 1 /* Getter */);
break;
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
addName(names, name, memberName, 2 /* Setter */);
break;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
addName(names, name, memberName, 3 /* Property */);
break;
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
addName(names, name, memberName, 4 /* Method */);
break;
}
@@ -53424,7 +54313,7 @@
var names = ts.createMap();
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
- if (member.kind === 153 /* PropertySignature */) {
+ if (member.kind === 154 /* PropertySignature */) {
var memberName = void 0;
var name = member.name;
switch (name.kind) {
@@ -53432,7 +54321,7 @@
case 8 /* NumericLiteral */:
memberName = name.text;
break;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
memberName = ts.idText(name);
break;
default:
@@ -53449,7 +54338,7 @@
}
}
function checkTypeForDuplicateIndexSignatures(node) {
- if (node.kind === 241 /* InterfaceDeclaration */) {
+ if (node.kind === 242 /* InterfaceDeclaration */) {
var nodeSymbol = getSymbolOfNode(node);
// in case of merging interface declaration it is possible that we'll enter this check procedure several times for every declaration
// to prevent this run check only for the first declaration of a given kind
@@ -53469,7 +54358,7 @@
var declaration = decl;
if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
switch (declaration.parameters[0].type.kind) {
- case 138 /* StringKeyword */:
+ case 139 /* StringKeyword */:
if (!seenStringIndexer) {
seenStringIndexer = true;
}
@@ -53477,7 +54366,7 @@
error(declaration, ts.Diagnostics.Duplicate_string_index_signature);
}
break;
- case 135 /* NumberKeyword */:
+ case 136 /* NumberKeyword */:
if (!seenNumericIndexer) {
seenNumericIndexer = true;
}
@@ -53504,7 +54393,7 @@
checkFunctionOrMethodDeclaration(node);
// Abstract methods cannot have an implementation.
// Extra checks are to avoid reporting multiple errors relating to the "abstractness" of the node.
- if (ts.hasModifier(node, 128 /* Abstract */) && node.kind === 156 /* MethodDeclaration */ && node.body) {
+ if (ts.hasModifier(node, 128 /* Abstract */) && node.kind === 157 /* MethodDeclaration */ && node.body) {
error(node, ts.Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, ts.declarationNameToString(node.name));
}
}
@@ -53529,7 +54418,7 @@
return;
}
function isInstancePropertyWithInitializer(n) {
- return n.kind === 154 /* PropertyDeclaration */ &&
+ return n.kind === 155 /* PropertyDeclaration */ &&
!ts.hasModifier(n, 32 /* Static */) &&
!!n.initializer;
}
@@ -53559,7 +54448,7 @@
var superCallStatement = void 0;
for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) {
var statement = statements_2[_i];
- if (statement.kind === 221 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) {
+ if (statement.kind === 222 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) {
superCallStatement = statement;
break;
}
@@ -53584,7 +54473,7 @@
checkGrammarComputedPropertyName(node.name);
checkDecorators(node);
checkSignatureDeclaration(node);
- if (node.kind === 158 /* GetAccessor */) {
+ if (node.kind === 159 /* GetAccessor */) {
if (!(node.flags & 4194304 /* Ambient */) && ts.nodeIsPresent(node.body) && (node.flags & 128 /* HasImplicitReturn */)) {
if (!(node.flags & 256 /* HasExplicitReturn */)) {
error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value);
@@ -53594,13 +54483,13 @@
// Do not use hasDynamicName here, because that returns false for well known symbols.
// We want to perform checkComputedPropertyName for all computed properties, including
// well known symbols.
- if (node.name.kind === 149 /* ComputedPropertyName */) {
+ if (node.name.kind === 150 /* ComputedPropertyName */) {
checkComputedPropertyName(node.name);
}
if (!hasNonBindableDynamicName(node)) {
// TypeScript 1.0 spec (April 2014): 8.4.3
// Accessors for the same member name must specify the same accessibility.
- var otherKind = node.kind === 158 /* GetAccessor */ ? 159 /* SetAccessor */ : 158 /* GetAccessor */;
+ var otherKind = node.kind === 159 /* GetAccessor */ ? 160 /* SetAccessor */ : 159 /* GetAccessor */;
var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(node), otherKind);
if (otherAccessor) {
var nodeFlags = ts.getModifierFlags(node);
@@ -53618,7 +54507,7 @@
}
}
var returnType = getTypeOfAccessors(getSymbolOfNode(node));
- if (node.kind === 158 /* GetAccessor */) {
+ if (node.kind === 159 /* GetAccessor */) {
checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType);
}
}
@@ -53666,7 +54555,7 @@
}
function checkTypeReferenceNode(node) {
checkGrammarTypeArguments(node, node.typeArguments);
- if (node.kind === 164 /* TypeReference */ && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) {
+ if (node.kind === 165 /* TypeReference */ && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) {
grammarErrorAtPos(node, node.typeName.jsdocDotPos, 1, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments);
}
var type = getTypeFromTypeReference(node);
@@ -53714,7 +54603,7 @@
var seenOptionalElement = false;
for (var i = 0; i < elementTypes.length; i++) {
var e = elementTypes[i];
- if (e.kind === 172 /* RestType */) {
+ if (e.kind === 173 /* RestType */) {
if (i !== elementTypes.length - 1) {
grammarErrorOnNode(e, ts.Diagnostics.A_rest_element_must_be_last_in_a_tuple_type);
break;
@@ -53723,7 +54612,7 @@
error(e, ts.Diagnostics.A_rest_element_type_must_be_an_array_type);
}
}
- else if (e.kind === 171 /* OptionalType */) {
+ else if (e.kind === 172 /* OptionalType */) {
seenOptionalElement = true;
}
else if (seenOptionalElement) {
@@ -53744,7 +54633,7 @@
var objectType = type.objectType;
var indexType = type.indexType;
if (isTypeAssignableTo(indexType, getIndexType(objectType, /*stringsOnly*/ false))) {
- if (accessNode.kind === 190 /* ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) &&
+ if (accessNode.kind === 191 /* ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) &&
ts.getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) {
error(accessNode, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
}
@@ -53756,7 +54645,7 @@
return type;
}
error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType));
- return type;
+ return errorType;
}
function checkIndexedAccessType(node) {
checkSourceElement(node.objectType);
@@ -53784,7 +54673,7 @@
ts.forEachChild(node, checkSourceElement);
}
function checkInferType(node) {
- if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 175 /* ConditionalType */ && n.parent.extendsType === n; })) {
+ if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 176 /* ConditionalType */ && n.parent.extendsType === n; })) {
grammarErrorOnNode(node, ts.Diagnostics.infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type);
}
checkSourceElement(node.typeParameter);
@@ -53801,9 +54690,9 @@
var flags = ts.getCombinedModifierFlags(n);
// children of classes (even ambient classes) should not be marked as ambient or export
// because those flags have no useful semantics there.
- if (n.parent.kind !== 241 /* InterfaceDeclaration */ &&
- n.parent.kind !== 240 /* ClassDeclaration */ &&
- n.parent.kind !== 209 /* ClassExpression */ &&
+ if (n.parent.kind !== 242 /* InterfaceDeclaration */ &&
+ n.parent.kind !== 241 /* ClassDeclaration */ &&
+ n.parent.kind !== 210 /* ClassExpression */ &&
n.flags & 4194304 /* Ambient */) {
if (!(flags & 2 /* Ambient */) && !(ts.isModuleBlock(n.parent) && ts.isModuleDeclaration(n.parent.parent) && ts.isGlobalScopeAugmentation(n.parent.parent))) {
// It is nested in an ambient context, which means it is automatically exported
@@ -53894,7 +54783,7 @@
if (node.name && subsequentName &&
(ts.isComputedPropertyName(node.name) && ts.isComputedPropertyName(subsequentName) ||
!ts.isComputedPropertyName(node.name) && !ts.isComputedPropertyName(subsequentName) && ts.getEscapedTextOfIdentifierOrLiteral(node.name) === ts.getEscapedTextOfIdentifierOrLiteral(subsequentName))) {
- var reportError = (node.kind === 156 /* MethodDeclaration */ || node.kind === 155 /* MethodSignature */) &&
+ var reportError = (node.kind === 157 /* MethodDeclaration */ || node.kind === 156 /* MethodSignature */) &&
ts.hasModifier(node, 32 /* Static */) !== ts.hasModifier(subsequentNode, 32 /* Static */);
// we can get here in two cases
// 1. mixed static and instance class members
@@ -53933,7 +54822,7 @@
var current = declarations_4[_i];
var node = current;
var inAmbientContext = node.flags & 4194304 /* Ambient */;
- var inAmbientContextOrInterface = node.parent.kind === 241 /* InterfaceDeclaration */ || node.parent.kind === 168 /* TypeLiteral */ || inAmbientContext;
+ var inAmbientContextOrInterface = node.parent.kind === 242 /* InterfaceDeclaration */ || node.parent.kind === 169 /* TypeLiteral */ || inAmbientContext;
if (inAmbientContextOrInterface) {
// check if declarations are consecutive only if they are non-ambient
// 1. ambient declarations can be interleaved
@@ -53944,7 +54833,7 @@
// 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one
previousDeclaration = undefined;
}
- if (node.kind === 239 /* FunctionDeclaration */ || node.kind === 156 /* MethodDeclaration */ || node.kind === 155 /* MethodSignature */ || node.kind === 157 /* Constructor */) {
+ if (node.kind === 240 /* FunctionDeclaration */ || node.kind === 157 /* MethodDeclaration */ || node.kind === 156 /* MethodSignature */ || node.kind === 158 /* Constructor */) {
var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck);
someNodeFlags |= currentNodeFlags;
allNodeFlags &= currentNodeFlags;
@@ -54073,22 +54962,22 @@
function getDeclarationSpaces(decl) {
var d = decl;
switch (d.kind) {
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
// A jsdoc typedef and callback are, by definition, type aliases
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
return 2 /* ExportType */;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */
? 4 /* ExportNamespace */ | 1 /* ExportValue */
: 4 /* ExportNamespace */;
- case 240 /* ClassDeclaration */:
- case 243 /* EnumDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 244 /* EnumDeclaration */:
return 2 /* ExportType */ | 1 /* ExportValue */;
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return 2 /* ExportType */ | 1 /* ExportValue */ | 4 /* ExportNamespace */;
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
// Export assigned entity name expressions act as aliases and should fall through, otherwise they export values
if (!ts.isEntityNameExpression(d.expression)) {
return 1 /* ExportValue */;
@@ -54096,20 +54985,20 @@
d = d.expression;
/* falls through */
// The below options all declare an Alias, which is allowed to merge with other values within the importing module
- case 248 /* ImportEqualsDeclaration */:
- case 251 /* NamespaceImport */:
- case 250 /* ImportClause */:
- var result_5 = 0 /* None */;
+ case 249 /* ImportEqualsDeclaration */:
+ case 252 /* NamespaceImport */:
+ case 251 /* ImportClause */:
+ var result_7 = 0 /* None */;
var target = resolveAlias(getSymbolOfNode(d));
- ts.forEach(target.declarations, function (d) { result_5 |= getDeclarationSpaces(d); });
- return result_5;
- case 237 /* VariableDeclaration */:
- case 186 /* BindingElement */:
- case 239 /* FunctionDeclaration */:
- case 253 /* ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591
+ ts.forEach(target.declarations, function (d) { result_7 |= getDeclarationSpaces(d); });
+ return result_7;
+ case 238 /* VariableDeclaration */:
+ case 187 /* BindingElement */:
+ case 240 /* FunctionDeclaration */:
+ case 254 /* ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591
return 1 /* ExportValue */;
default:
- return ts.Debug.fail(ts.Debug.showSyntaxKind(d));
+ return ts.Debug.failBadSyntaxKind(d);
}
}
}
@@ -54335,7 +55224,7 @@
var promiseConstructorSymbol = resolveEntityName(promiseConstructorName, 67220415 /* Value */, /*ignoreErrors*/ true);
var promiseConstructorType = promiseConstructorSymbol ? getTypeOfSymbol(promiseConstructorSymbol) : errorType;
if (promiseConstructorType === errorType) {
- if (promiseConstructorName.kind === 72 /* Identifier */ && promiseConstructorName.escapedText === "Promise" && getTargetType(returnType) === getGlobalPromiseType(/*reportErrors*/ false)) {
+ if (promiseConstructorName.kind === 73 /* Identifier */ && promiseConstructorName.escapedText === "Promise" && getTargetType(returnType) === getGlobalPromiseType(/*reportErrors*/ false)) {
error(returnTypeNode, ts.Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option);
}
else {
@@ -54374,24 +55263,24 @@
var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node);
var errorInfo;
switch (node.parent.kind) {
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
var classSymbol = getSymbolOfNode(node.parent);
var classConstructorType = getTypeOfSymbol(classSymbol);
expectedReturnType = getUnionType([classConstructorType, voidType]);
break;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
expectedReturnType = voidType;
errorInfo = ts.chainDiagnosticMessages(
/*details*/ undefined, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any);
break;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
expectedReturnType = voidType;
errorInfo = ts.chainDiagnosticMessages(
/*details*/ undefined, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any);
break;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
var methodType = getTypeOfNode(node.parent);
var descriptorType = createTypedPropertyDescriptorType(methodType);
expectedReturnType = getUnionType([descriptorType, voidType]);
@@ -54412,7 +55301,7 @@
if (!typeName)
return;
var rootName = getFirstIdentifier(typeName);
- var meaning = (typeName.kind === 72 /* Identifier */ ? 67897832 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */;
+ var meaning = (typeName.kind === 73 /* Identifier */ ? 67897832 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */;
var rootSymbol = resolveName(rootName, rootName.escapedText, meaning, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isRefernce*/ true);
if (rootSymbol
&& rootSymbol.flags & 2097152 /* Alias */
@@ -54437,29 +55326,29 @@
function getEntityNameForDecoratorMetadata(node) {
if (node) {
switch (node.kind) {
- case 174 /* IntersectionType */:
- case 173 /* UnionType */:
+ case 175 /* IntersectionType */:
+ case 174 /* UnionType */:
return getEntityNameForDecoratorMetadataFromTypeList(node.types);
- case 175 /* ConditionalType */:
+ case 176 /* ConditionalType */:
return getEntityNameForDecoratorMetadataFromTypeList([node.trueType, node.falseType]);
- case 177 /* ParenthesizedType */:
+ case 178 /* ParenthesizedType */:
return getEntityNameForDecoratorMetadata(node.type);
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return node.typeName;
}
}
}
function getEntityNameForDecoratorMetadataFromTypeList(types) {
var commonEntityName;
- for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
- var typeNode = types_17[_i];
- while (typeNode.kind === 177 /* ParenthesizedType */) {
+ for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
+ var typeNode = types_16[_i];
+ while (typeNode.kind === 178 /* ParenthesizedType */) {
typeNode = typeNode.type; // Skip parens if need be
}
- if (typeNode.kind === 132 /* NeverKeyword */) {
+ if (typeNode.kind === 133 /* NeverKeyword */) {
continue; // Always elide `never` from the union/intersection if possible
}
- if (!strictNullChecks && (typeNode.kind === 96 /* NullKeyword */ || typeNode.kind === 141 /* UndefinedKeyword */)) {
+ if (!strictNullChecks && (typeNode.kind === 97 /* NullKeyword */ || typeNode.kind === 142 /* UndefinedKeyword */)) {
continue; // Elide null and undefined from unions for metadata, just like what we did prior to the implementation of strict null checks
}
var individualEntityName = getEntityNameForDecoratorMetadata(typeNode);
@@ -54501,18 +55390,18 @@
return;
}
if (!compilerOptions.experimentalDecorators) {
- error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning);
+ error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning);
}
var firstDecorator = node.decorators[0];
checkExternalEmitHelpers(firstDecorator, 8 /* Decorate */);
- if (node.kind === 151 /* Parameter */) {
+ if (node.kind === 152 /* Parameter */) {
checkExternalEmitHelpers(firstDecorator, 32 /* Param */);
}
if (compilerOptions.emitDecoratorMetadata) {
checkExternalEmitHelpers(firstDecorator, 16 /* Metadata */);
// we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator.
switch (node.kind) {
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
var constructor = ts.getFirstConstructorWithBody(node);
if (constructor) {
for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) {
@@ -54521,23 +55410,23 @@
}
}
break;
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- var otherKind = node.kind === 158 /* GetAccessor */ ? 159 /* SetAccessor */ : 158 /* GetAccessor */;
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ var otherKind = node.kind === 159 /* GetAccessor */ ? 160 /* SetAccessor */ : 159 /* GetAccessor */;
var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(node), otherKind);
markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor));
break;
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) {
var parameter = _c[_b];
markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
}
markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveReturnTypeNode(node));
break;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveTypeAnnotationNode(node));
break;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node));
var containingSignature = node.parent;
for (var _d = 0, _e = containingSignature.parameters; _d < _e.length; _d++) {
@@ -54600,7 +55489,7 @@
else if (ts.findLast(ts.getJSDocTags(decl), ts.isJSDocParameterTag) === node &&
node.typeExpression && node.typeExpression.type &&
!isArrayType(getTypeFromTypeNode(node.typeExpression.type))) {
- error(node.name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_had_an_array_type, ts.idText(node.name.kind === 148 /* QualifiedName */ ? node.name.right : node.name));
+ error(node.name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_had_an_array_type, ts.idText(node.name.kind === 149 /* QualifiedName */ ? node.name.right : node.name));
}
}
}
@@ -54633,9 +55522,9 @@
}
function getIdentifierFromEntityNameExpression(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return node;
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return node.name;
default:
return undefined;
@@ -54648,7 +55537,7 @@
// Do not use hasDynamicName here, because that returns false for well known symbols.
// We want to perform checkComputedPropertyName for all computed properties, including
// well known symbols.
- if (node.name && node.name.kind === 149 /* ComputedPropertyName */) {
+ if (node.name && node.name.kind === 150 /* ComputedPropertyName */) {
// This check will account for methods in class/interface declarations,
// as well as accessors in classes/object literals
checkComputedPropertyName(node.name);
@@ -54677,7 +55566,7 @@
}
}
}
- var body = node.kind === 155 /* MethodSignature */ ? undefined : node.body;
+ var body = node.kind === 156 /* MethodSignature */ ? undefined : node.body;
checkSourceElement(body);
if ((functionFlags & 1 /* Generator */) === 0) { // Async function or normal function
var returnOrPromisedType = getReturnOrPromisedType(node, functionFlags);
@@ -54722,42 +55611,42 @@
for (var _i = 0, potentiallyUnusedIdentifiers_1 = potentiallyUnusedIdentifiers; _i < potentiallyUnusedIdentifiers_1.length; _i++) {
var node = potentiallyUnusedIdentifiers_1[_i];
switch (node.kind) {
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
checkUnusedClassMembers(node, addDiagnostic);
checkUnusedTypeParameters(node, addDiagnostic);
break;
- case 284 /* SourceFile */:
- case 244 /* ModuleDeclaration */:
- case 218 /* Block */:
- case 246 /* CaseBlock */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 285 /* SourceFile */:
+ case 245 /* ModuleDeclaration */:
+ case 219 /* Block */:
+ case 247 /* CaseBlock */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
checkUnusedLocalsAndParameters(node, addDiagnostic);
break;
- case 157 /* Constructor */:
- case 196 /* FunctionExpression */:
- case 239 /* FunctionDeclaration */:
- case 197 /* ArrowFunction */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 158 /* Constructor */:
+ case 197 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
+ case 198 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
if (node.body) { // Don't report unused parameters in overloads
checkUnusedLocalsAndParameters(node, addDiagnostic);
}
checkUnusedTypeParameters(node, addDiagnostic);
break;
- case 155 /* MethodSignature */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 242 /* TypeAliasDeclaration */:
- case 241 /* InterfaceDeclaration */:
+ case 156 /* MethodSignature */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 243 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
checkUnusedTypeParameters(node, addDiagnostic);
break;
- case 176 /* InferType */:
+ case 177 /* InferType */:
checkUnusedInferTypeParameter(node, addDiagnostic);
break;
default:
@@ -54777,11 +55666,11 @@
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
switch (member.kind) {
- case 156 /* MethodDeclaration */:
- case 154 /* PropertyDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- if (member.kind === 159 /* SetAccessor */ && member.symbol.flags & 32768 /* GetAccessor */) {
+ case 157 /* MethodDeclaration */:
+ case 155 /* PropertyDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ if (member.kind === 160 /* SetAccessor */ && member.symbol.flags & 32768 /* GetAccessor */) {
// Already would have reported an error on the getter.
break;
}
@@ -54790,7 +55679,7 @@
addDiagnostic(member, 0 /* Local */, ts.createDiagnosticForNode(member.name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, symbolToString(symbol)));
}
break;
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) {
var parameter = _c[_b];
if (!parameter.symbol.isReferenced && ts.hasModifier(parameter, 8 /* Private */)) {
@@ -54798,8 +55687,8 @@
}
}
break;
- case 162 /* IndexSignature */:
- case 217 /* SemicolonClassElement */:
+ case 163 /* IndexSignature */:
+ case 218 /* SemicolonClassElement */:
// Can't be private
break;
default:
@@ -54826,7 +55715,7 @@
continue;
var name = ts.idText(typeParameter.name);
var parent = typeParameter.parent;
- if (parent.kind !== 176 /* InferType */ && parent.typeParameters.every(isTypeParameterUnused)) {
+ if (parent.kind !== 177 /* InferType */ && parent.typeParameters.every(isTypeParameterUnused)) {
if (seenParentsWithEveryUnused.tryAdd(parent)) {
var range = ts.isJSDocTemplateTag(parent)
// Whole @template tag
@@ -54911,7 +55800,7 @@
var importDecl = importClause.parent;
var nDeclarations = (importClause.name ? 1 : 0) +
(importClause.namedBindings ?
- (importClause.namedBindings.kind === 251 /* NamespaceImport */ ? 1 : importClause.namedBindings.elements.length)
+ (importClause.namedBindings.kind === 252 /* NamespaceImport */ ? 1 : importClause.namedBindings.elements.length)
: 0);
if (nDeclarations === unuseds.length) {
addDiagnostic(importDecl, 0 /* Local */, unuseds.length === 1
@@ -54929,7 +55818,7 @@
var bindingPattern = _a[0], bindingElements = _a[1];
var kind = tryGetRootParameterDeclaration(bindingPattern.parent) ? 1 /* Parameter */ : 0 /* Local */;
if (bindingPattern.elements.length === bindingElements.length) {
- if (bindingElements.length === 1 && bindingPattern.parent.kind === 237 /* VariableDeclaration */ && bindingPattern.parent.parent.kind === 238 /* VariableDeclarationList */) {
+ if (bindingElements.length === 1 && bindingPattern.parent.kind === 238 /* VariableDeclaration */ && bindingPattern.parent.parent.kind === 239 /* VariableDeclarationList */) {
addToGroup(unusedVariables, bindingPattern.parent.parent, bindingPattern.parent, getNodeId);
}
else {
@@ -54950,7 +55839,7 @@
if (declarationList.declarations.length === declarations.length) {
addDiagnostic(declarationList, 0 /* Local */, declarations.length === 1
? ts.createDiagnosticForNode(ts.first(declarations).name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(ts.first(declarations).name))
- : ts.createDiagnosticForNode(declarationList.parent.kind === 219 /* VariableStatement */ ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused));
+ : ts.createDiagnosticForNode(declarationList.parent.kind === 220 /* VariableStatement */ ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused));
}
else {
for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) {
@@ -54962,24 +55851,24 @@
}
function bindingNameText(name) {
switch (name.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return ts.idText(name);
- case 185 /* ArrayBindingPattern */:
- case 184 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
return bindingNameText(ts.cast(ts.first(name.elements), ts.isBindingElement).name);
default:
return ts.Debug.assertNever(name);
}
}
function isImportedDeclaration(node) {
- return node.kind === 250 /* ImportClause */ || node.kind === 253 /* ImportSpecifier */ || node.kind === 251 /* NamespaceImport */;
+ return node.kind === 251 /* ImportClause */ || node.kind === 254 /* ImportSpecifier */ || node.kind === 252 /* NamespaceImport */;
}
function importClauseFromImported(decl) {
- return decl.kind === 250 /* ImportClause */ ? decl : decl.kind === 251 /* NamespaceImport */ ? decl.parent : decl.parent.parent;
+ return decl.kind === 251 /* ImportClause */ ? decl : decl.kind === 252 /* NamespaceImport */ ? decl.parent : decl.parent.parent;
}
function checkBlock(node) {
// Grammar checking for SyntaxKind.Block
- if (node.kind === 218 /* Block */) {
+ if (node.kind === 219 /* Block */) {
checkGrammarStatementInAmbientContext(node);
}
if (ts.isFunctionOrModuleBlock(node)) {
@@ -55009,12 +55898,12 @@
if (!(identifier && identifier.escapedText === name)) {
return false;
}
- if (node.kind === 154 /* PropertyDeclaration */ ||
- node.kind === 153 /* PropertySignature */ ||
- node.kind === 156 /* MethodDeclaration */ ||
- node.kind === 155 /* MethodSignature */ ||
- node.kind === 158 /* GetAccessor */ ||
- node.kind === 159 /* SetAccessor */) {
+ if (node.kind === 155 /* PropertyDeclaration */ ||
+ node.kind === 154 /* PropertySignature */ ||
+ node.kind === 157 /* MethodDeclaration */ ||
+ node.kind === 156 /* MethodSignature */ ||
+ node.kind === 159 /* GetAccessor */ ||
+ node.kind === 160 /* SetAccessor */) {
// it is ok to have member named '_super' or '_this' - member access is always qualified
return false;
}
@@ -55023,7 +55912,7 @@
return false;
}
var root = ts.getRootDeclaration(node);
- if (root.kind === 151 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) {
+ if (root.kind === 152 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) {
// just an overload - no codegen impact
return false;
}
@@ -55033,7 +55922,7 @@
function checkIfThisIsCapturedInEnclosingScope(node) {
ts.findAncestor(node, function (current) {
if (getNodeCheckFlags(current) & 4 /* CaptureThis */) {
- var isDeclaration_1 = node.kind !== 72 /* Identifier */;
+ var isDeclaration_1 = node.kind !== 73 /* Identifier */;
if (isDeclaration_1) {
error(ts.getNameOfDeclaration(node), ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference);
}
@@ -55048,7 +55937,7 @@
function checkIfNewTargetIsCapturedInEnclosingScope(node) {
ts.findAncestor(node, function (current) {
if (getNodeCheckFlags(current) & 8 /* CaptureNewTarget */) {
- var isDeclaration_2 = node.kind !== 72 /* Identifier */;
+ var isDeclaration_2 = node.kind !== 73 /* Identifier */;
if (isDeclaration_2) {
error(ts.getNameOfDeclaration(node), ts.Diagnostics.Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference);
}
@@ -55074,7 +55963,7 @@
}
// In case of variable declaration, node.parent is variable statement so look at the variable statement's parent
var parent = getDeclarationContainer(node);
- if (parent.kind === 284 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) {
+ if (parent.kind === 285 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) {
// If the declaration happens to be in external module, report error that require and exports are reserved keywords
error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name));
}
@@ -55089,7 +55978,7 @@
}
// In case of variable declaration, node.parent is variable statement so look at the variable statement's parent
var parent = getDeclarationContainer(node);
- if (parent.kind === 284 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024 /* HasAsyncFunctions */) {
+ if (parent.kind === 285 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024 /* HasAsyncFunctions */) {
// If the declaration happens to be in external module, report error that Promise is a reserved identifier.
error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name));
}
@@ -55124,7 +56013,7 @@
// skip variable declarations that don't have initializers
// NOTE: in ES6 spec initializer is required in variable declarations where name is binding pattern
// so we'll always treat binding elements as initialized
- if (node.kind === 237 /* VariableDeclaration */ && !node.initializer) {
+ if (node.kind === 238 /* VariableDeclaration */ && !node.initializer) {
return;
}
var symbol = getSymbolOfNode(node);
@@ -55136,17 +56025,17 @@
localDeclarationSymbol !== symbol &&
localDeclarationSymbol.flags & 2 /* BlockScopedVariable */) {
if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3 /* BlockScoped */) {
- var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 238 /* VariableDeclarationList */);
- var container = varDeclList.parent.kind === 219 /* VariableStatement */ && varDeclList.parent.parent
+ var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 239 /* VariableDeclarationList */);
+ var container = varDeclList.parent.kind === 220 /* VariableStatement */ && varDeclList.parent.parent
? varDeclList.parent.parent
: undefined;
// names of block-scoped and function scoped variables can collide only
// if block scoped variable is defined in the function\module\source file scope (because of variable hoisting)
var namesShareScope = container &&
- (container.kind === 218 /* Block */ && ts.isFunctionLike(container.parent) ||
- container.kind === 245 /* ModuleBlock */ ||
- container.kind === 244 /* ModuleDeclaration */ ||
- container.kind === 284 /* SourceFile */);
+ (container.kind === 219 /* Block */ && ts.isFunctionLike(container.parent) ||
+ container.kind === 246 /* ModuleBlock */ ||
+ container.kind === 245 /* ModuleDeclaration */ ||
+ container.kind === 285 /* SourceFile */);
// here we know that function scoped variable is shadowed by block scoped one
// if they are defined in the same scope - binder has already reported redeclaration error
// otherwise if variable has an initializer - show error that initialization will fail
@@ -55159,69 +56048,6 @@
}
}
}
- // Check that a parameter initializer contains no references to parameters declared to the right of itself
- function checkParameterInitializer(node) {
- if (ts.getRootDeclaration(node).kind !== 151 /* Parameter */) {
- return;
- }
- var func = ts.getContainingFunction(node);
- visit(node.initializer);
- function visit(n) {
- if (ts.isTypeNode(n) || ts.isDeclarationName(n)) {
- // do not dive in types
- // skip declaration names (i.e. in object literal expressions)
- return;
- }
- if (n.kind === 189 /* PropertyAccessExpression */) {
- // skip property names in property access expression
- return visit(n.expression);
- }
- else if (n.kind === 72 /* Identifier */) {
- // check FunctionLikeDeclaration.locals (stores parameters\function local variable)
- // if it contains entry with a specified name
- var symbol = resolveName(n, n.escapedText, 67220415 /* Value */ | 2097152 /* Alias */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false);
- if (!symbol || symbol === unknownSymbol || !symbol.valueDeclaration) {
- return;
- }
- if (symbol.valueDeclaration === node) {
- error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name));
- return;
- }
- // locals map for function contain both parameters and function locals
- // so we need to do a bit of extra work to check if reference is legal
- var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration);
- if (enclosingContainer === func) {
- if (symbol.valueDeclaration.kind === 151 /* Parameter */ ||
- symbol.valueDeclaration.kind === 186 /* BindingElement */) {
- // it is ok to reference parameter in initializer if either
- // - parameter is located strictly on the left of current parameter declaration
- if (symbol.valueDeclaration.pos < node.pos) {
- return;
- }
- // - parameter is wrapped in function-like entity
- if (ts.findAncestor(n, function (current) {
- if (current === node.initializer) {
- return "quit";
- }
- return ts.isFunctionLike(current.parent) ||
- // computed property names/initializers in instance property declaration of class like entities
- // are executed in constructor and thus deferred
- (current.parent.kind === 154 /* PropertyDeclaration */ &&
- !(ts.hasModifier(current.parent, 32 /* Static */)) &&
- ts.isClassLike(current.parent.parent));
- })) {
- return;
- }
- // fall through to report error
- }
- error(n, ts.Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(node.name), ts.declarationNameToString(n));
- }
- }
- else {
- return ts.forEachChild(n, visit);
- }
- }
- }
function convertAutoToAny(type) {
return type === autoType ? anyType : type === autoArrayType ? anyArrayType : type;
}
@@ -55239,18 +56065,18 @@
// Do not use hasDynamicName here, because that returns false for well known symbols.
// We want to perform checkComputedPropertyName for all computed properties, including
// well known symbols.
- if (node.name.kind === 149 /* ComputedPropertyName */) {
+ if (node.name.kind === 150 /* ComputedPropertyName */) {
checkComputedPropertyName(node.name);
if (node.initializer) {
checkExpressionCached(node.initializer);
}
}
- if (node.kind === 186 /* BindingElement */) {
- if (node.parent.kind === 184 /* ObjectBindingPattern */ && languageVersion < 7 /* ESNext */) {
+ if (node.kind === 187 /* BindingElement */) {
+ if (node.parent.kind === 185 /* ObjectBindingPattern */ && languageVersion < 8 /* ESNext */) {
checkExternalEmitHelpers(node, 4 /* Rest */);
}
// check computed properties inside property names of binding elements
- if (node.propertyName && node.propertyName.kind === 149 /* ComputedPropertyName */) {
+ if (node.propertyName && node.propertyName.kind === 150 /* ComputedPropertyName */) {
checkComputedPropertyName(node.propertyName);
}
// check private/protected variable access
@@ -55264,35 +56090,48 @@
var property = getPropertyOfType(parentType, nameText);
if (property) {
markPropertyAsReferenced(property, /*nodeForCheckWriteOnly*/ undefined, /*isThisAccess*/ false); // A destructuring is never a write-only reference.
- checkPropertyAccessibility(parent, !!parent.initializer && parent.initializer.kind === 98 /* SuperKeyword */, parentType, property);
+ checkPropertyAccessibility(parent, !!parent.initializer && parent.initializer.kind === 99 /* SuperKeyword */, parentType, property);
}
}
}
}
// For a binding pattern, check contained binding elements
if (ts.isBindingPattern(node.name)) {
- if (node.name.kind === 185 /* ArrayBindingPattern */ && languageVersion < 2 /* ES2015 */ && compilerOptions.downlevelIteration) {
+ if (node.name.kind === 186 /* ArrayBindingPattern */ && languageVersion < 2 /* ES2015 */ && compilerOptions.downlevelIteration) {
checkExternalEmitHelpers(node, 512 /* Read */);
}
ts.forEach(node.name.elements, checkSourceElement);
}
// For a parameter declaration with an initializer, error and exit if the containing function doesn't have a body
- if (node.initializer && ts.getRootDeclaration(node).kind === 151 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) {
+ if (node.initializer && ts.getRootDeclaration(node).kind === 152 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) {
error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation);
return;
}
// For a binding pattern, validate the initializer and exit
if (ts.isBindingPattern(node.name)) {
+ var needCheckInitializer = node.initializer && node.parent.parent.kind !== 227 /* ForInStatement */;
+ var needCheckWidenedType = node.name.elements.length === 0;
+ if (needCheckInitializer || needCheckWidenedType) {
// Don't validate for-in initializer as it is already an error
- if (node.initializer && node.parent.parent.kind !== 226 /* ForInStatement */) {
+ var widenedType = getWidenedTypeForVariableLikeDeclaration(node);
+ if (needCheckInitializer) {
var initializerType = checkExpressionCached(node.initializer);
- if (strictNullChecks && node.name.elements.length === 0) {
- checkNonNullType(initializerType, node);
+ if (strictNullChecks && needCheckWidenedType) {
+ checkNonNullNonVoidType(initializerType, node);
}
else {
checkTypeAssignableToAndOptionallyElaborate(initializerType, getWidenedTypeForVariableLikeDeclaration(node), node, node.initializer);
}
- checkParameterInitializer(node);
+ }
+ // check the binding pattern with empty elements
+ if (needCheckWidenedType) {
+ if (ts.isArrayBindingPattern(node.name)) {
+ checkIteratedTypeOrElementType(widenedType, node, /* allowStringInput */ false, /* allowAsyncIterables */ false);
+ }
+ else if (strictNullChecks) {
+ checkNonNullNonVoidType(widenedType, node);
+ }
+ }
}
return;
}
@@ -55307,9 +56146,8 @@
ts.isObjectLiteralExpression(initializer) &&
(initializer.properties.length === 0 || ts.isPrototypeAccess(node.name)) &&
ts.hasEntries(symbol.exports);
- if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 226 /* ForInStatement */) {
+ if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 227 /* ForInStatement */) {
checkTypeAssignableToAndOptionallyElaborate(checkExpressionCached(initializer), type, node, initializer, /*headMessage*/ undefined);
- checkParameterInitializer(node);
}
}
if (symbol.declarations.length > 1) {
@@ -55325,7 +56163,7 @@
if (type !== errorType && declarationType !== errorType &&
!isTypeIdenticalTo(type, declarationType) &&
!(symbol.flags & 67108864 /* Assignment */)) {
- errorNextVariableOrPropertyDeclarationMustHaveSameType(type, node, declarationType);
+ errorNextVariableOrPropertyDeclarationMustHaveSameType(symbol.valueDeclaration, type, node, declarationType);
}
if (node.initializer) {
checkTypeAssignableToAndOptionallyElaborate(checkExpressionCached(node.initializer), declarationType, node, node.initializer, /*headMessage*/ undefined);
@@ -55334,26 +56172,30 @@
error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name));
}
}
- if (node.kind !== 154 /* PropertyDeclaration */ && node.kind !== 153 /* PropertySignature */) {
+ if (node.kind !== 155 /* PropertyDeclaration */ && node.kind !== 154 /* PropertySignature */) {
// We know we don't have a binding pattern or computed name here
checkExportsOnMergedDeclarations(node);
- if (node.kind === 237 /* VariableDeclaration */ || node.kind === 186 /* BindingElement */) {
+ if (node.kind === 238 /* VariableDeclaration */ || node.kind === 187 /* BindingElement */) {
checkVarDeclaredNamesNotShadowed(node);
}
checkCollisionWithRequireExportsInGeneratedCode(node, node.name);
checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name);
}
}
- function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstType, nextDeclaration, nextType) {
+ function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstDeclaration, firstType, nextDeclaration, nextType) {
var nextDeclarationName = ts.getNameOfDeclaration(nextDeclaration);
- var message = nextDeclaration.kind === 154 /* PropertyDeclaration */ || nextDeclaration.kind === 153 /* PropertySignature */
+ var message = nextDeclaration.kind === 155 /* PropertyDeclaration */ || nextDeclaration.kind === 154 /* PropertySignature */
? ts.Diagnostics.Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2
: ts.Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2;
- error(nextDeclarationName, message, ts.declarationNameToString(nextDeclarationName), typeToString(firstType), typeToString(nextType));
+ var declName = ts.declarationNameToString(nextDeclarationName);
+ var err = error(nextDeclarationName, message, declName, typeToString(firstType), typeToString(nextType));
+ if (firstDeclaration) {
+ ts.addRelatedInfo(err, ts.createDiagnosticForNode(firstDeclaration, ts.Diagnostics._0_was_also_declared_here, declName));
+ }
}
function areDeclarationFlagsIdentical(left, right) {
- if ((left.kind === 151 /* Parameter */ && right.kind === 237 /* VariableDeclaration */) ||
- (left.kind === 237 /* VariableDeclaration */ && right.kind === 151 /* Parameter */)) {
+ if ((left.kind === 152 /* Parameter */ && right.kind === 238 /* VariableDeclaration */) ||
+ (left.kind === 238 /* VariableDeclaration */ && right.kind === 152 /* Parameter */)) {
// Differences in optionality between parameters and variables are allowed.
return true;
}
@@ -55392,7 +56234,7 @@
checkGrammarStatementInAmbientContext(node);
checkTruthinessExpression(node.expression);
checkSourceElement(node.thenStatement);
- if (node.thenStatement.kind === 220 /* EmptyStatement */) {
+ if (node.thenStatement.kind === 221 /* EmptyStatement */) {
error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement);
}
checkSourceElement(node.elseStatement);
@@ -55419,12 +56261,12 @@
function checkForStatement(node) {
// Grammar checking
if (!checkGrammarStatementInAmbientContext(node)) {
- if (node.initializer && node.initializer.kind === 238 /* VariableDeclarationList */) {
+ if (node.initializer && node.initializer.kind === 239 /* VariableDeclarationList */) {
checkGrammarVariableDeclarationList(node.initializer);
}
}
if (node.initializer) {
- if (node.initializer.kind === 238 /* VariableDeclarationList */) {
+ if (node.initializer.kind === 239 /* VariableDeclarationList */) {
ts.forEach(node.initializer.declarations, checkVariableDeclaration);
}
else {
@@ -55444,7 +56286,7 @@
checkGrammarForInOrForOfStatement(node);
if (node.awaitModifier) {
var functionFlags = ts.getFunctionFlags(ts.getContainingFunction(node));
- if ((functionFlags & (4 /* Invalid */ | 2 /* Async */)) === 2 /* Async */ && languageVersion < 7 /* ESNext */) {
+ if ((functionFlags & (4 /* Invalid */ | 2 /* Async */)) === 2 /* Async */ && languageVersion < 8 /* ESNext */) {
// for..await..of in an async function or async generator function prior to ESNext requires the __asyncValues helper
checkExternalEmitHelpers(node, 16384 /* ForAwaitOfIncludes */);
}
@@ -55458,14 +56300,14 @@
// via checkRightHandSideOfForOf.
// If the LHS is an expression, check the LHS, as a destructuring assignment or as a reference.
// Then check that the RHS is assignable to it.
- if (node.initializer.kind === 238 /* VariableDeclarationList */) {
+ if (node.initializer.kind === 239 /* VariableDeclarationList */) {
checkForInOrForOfVariableDeclaration(node);
}
else {
var varExpr = node.initializer;
var iteratedType = checkRightHandSideOfForOf(node.expression, node.awaitModifier);
// There may be a destructuring assignment on the left side
- if (varExpr.kind === 187 /* ArrayLiteralExpression */ || varExpr.kind === 188 /* ObjectLiteralExpression */) {
+ if (varExpr.kind === 188 /* ArrayLiteralExpression */ || varExpr.kind === 189 /* ObjectLiteralExpression */) {
// iteratedType may be undefined. In this case, we still want to check the structure of
// varExpr, in particular making sure it's a valid LeftHandSideExpression. But we'd like
// to short circuit the type relation checking as much as possible, so we pass the unknownType.
@@ -55497,7 +56339,7 @@
// for (let VarDecl in Expr) Statement
// VarDecl must be a variable declaration without a type annotation that declares a variable of type Any,
// and Expr must be an expression of type Any, an object type, or a type parameter type.
- if (node.initializer.kind === 238 /* VariableDeclarationList */) {
+ if (node.initializer.kind === 239 /* VariableDeclarationList */) {
var variable = node.initializer.declarations[0];
if (variable && ts.isBindingPattern(variable.name)) {
error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);
@@ -55511,7 +56353,7 @@
// and Expr must be an expression of type Any, an object type, or a type parameter type.
var varExpr = node.initializer;
var leftType = checkExpression(varExpr);
- if (varExpr.kind === 187 /* ArrayLiteralExpression */ || varExpr.kind === 188 /* ObjectLiteralExpression */) {
+ if (varExpr.kind === 188 /* ArrayLiteralExpression */ || varExpr.kind === 189 /* ObjectLiteralExpression */) {
error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);
}
else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) {
@@ -55871,12 +56713,12 @@
// for generators.
return;
}
- else if (func.kind === 159 /* SetAccessor */) {
+ else if (func.kind === 160 /* SetAccessor */) {
if (node.expression) {
error(node, ts.Diagnostics.Setters_cannot_return_a_value);
}
}
- else if (func.kind === 157 /* Constructor */) {
+ else if (func.kind === 158 /* Constructor */) {
if (node.expression && !checkTypeAssignableToAndOptionallyElaborate(exprType, returnType, node, node.expression)) {
error(node, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class);
}
@@ -55897,7 +56739,7 @@
}
}
}
- else if (func.kind !== 157 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType) && !isGenerator) {
+ else if (func.kind !== 158 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType) && !isGenerator) {
// The function has a return type, but the return statement doesn't have an expression.
error(node, ts.Diagnostics.Not_all_code_paths_return_a_value);
}
@@ -55926,7 +56768,7 @@
var expressionIsLiteral = isLiteralType(expressionType);
ts.forEach(node.caseBlock.clauses, function (clause) {
// Grammar check for duplicate default clauses, skip if we already report duplicate default clause
- if (clause.kind === 272 /* DefaultClause */ && !hasDuplicateDefaultClause) {
+ if (clause.kind === 273 /* DefaultClause */ && !hasDuplicateDefaultClause) {
if (firstDefaultClause === undefined) {
firstDefaultClause = clause;
}
@@ -55938,7 +56780,7 @@
hasDuplicateDefaultClause = true;
}
}
- if (produceDiagnostics && clause.kind === 271 /* CaseClause */) {
+ if (produceDiagnostics && clause.kind === 272 /* CaseClause */) {
// TypeScript 1.0 spec (April 2014): 5.9
// In a 'switch' statement, each 'case' expression must be of a type that is comparable
// to or from the type of the 'switch' expression.
@@ -55967,7 +56809,7 @@
if (ts.isFunctionLike(current)) {
return "quit";
}
- if (current.kind === 233 /* LabeledStatement */ && current.label.escapedText === node.label.escapedText) {
+ if (current.kind === 234 /* LabeledStatement */ && current.label.escapedText === node.label.escapedText) {
grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNode(node.label));
return true;
}
@@ -56074,8 +56916,8 @@
// this allows us to rule out cases when both property and indexer are inherited from the base class
var errorNode;
if (propDeclaration && name &&
- (propDeclaration.kind === 204 /* BinaryExpression */ ||
- name.kind === 149 /* ComputedPropertyName */ ||
+ (propDeclaration.kind === 205 /* BinaryExpression */ ||
+ name.kind === 150 /* ComputedPropertyName */ ||
prop.parent === containingType.symbol)) {
errorNode = propDeclaration;
}
@@ -56152,7 +56994,7 @@
function checkTypeParametersNotReferenced(root, typeParameters, index) {
visit(root);
function visit(node) {
- if (node.kind === 164 /* TypeReference */) {
+ if (node.kind === 165 /* TypeReference */) {
var type = getTypeFromTypeReference(node);
if (type.flags & 262144 /* TypeParameter */) {
for (var i = index; i < typeParameters.length; i++) {
@@ -56274,6 +57116,11 @@
if (languageVersion < 2 /* ES2015 */) {
checkExternalEmitHelpers(baseTypeNode.parent, 1 /* Extends */);
}
+ // check both @extends and extends if both are specified.
+ var extendsNode = ts.getClassExtendsHeritageElement(node);
+ if (extendsNode && extendsNode !== baseTypeNode) {
+ checkExpression(extendsNode.expression);
+ }
var baseTypes = getBaseTypes(type);
if (baseTypes.length && produceDiagnostics) {
var baseType_1 = baseTypes[0];
@@ -56281,10 +57128,6 @@
var staticBaseType = getApparentType(baseConstructorType);
checkBaseTypeAccessibility(staticBaseType, baseTypeNode);
checkSourceElement(baseTypeNode.expression);
- var extendsNode = ts.getClassExtendsHeritageElement(node);
- if (extendsNode && extendsNode !== baseTypeNode) {
- checkExpression(extendsNode.expression);
- }
if (ts.some(baseTypeNode.typeArguments)) {
ts.forEach(baseTypeNode.typeArguments, checkSourceElement);
for (var _i = 0, _a = getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode); _i < _a.length; _i++) {
@@ -56355,7 +57198,7 @@
function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
// iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
var issuedMemberError = false;
- var _loop_9 = function (member) {
+ var _loop_12 = function (member) {
if (ts.hasStaticModifier(member)) {
return "continue";
}
@@ -56374,7 +57217,7 @@
};
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
- _loop_9(member);
+ _loop_12(member);
}
if (!issuedMemberError) {
// check again with diagnostics to generate a less-specific error
@@ -56400,7 +57243,7 @@
}
function getClassOrInterfaceDeclarationsOfSymbol(symbol) {
return ts.filter(symbol.declarations, function (d) {
- return d.kind === 240 /* ClassDeclaration */ || d.kind === 241 /* InterfaceDeclaration */;
+ return d.kind === 241 /* ClassDeclaration */ || d.kind === 242 /* InterfaceDeclaration */;
});
}
function checkKindsOfPropertyMemberOverrides(type, baseType) {
@@ -56439,7 +57282,7 @@
// If there is no declaration for the derived class (as in the case of class expressions),
// then the class cannot be declared abstract.
if (baseDeclarationFlags & 128 /* Abstract */ && (!derivedClassDecl || !ts.hasModifier(derivedClassDecl, 128 /* Abstract */))) {
- if (derivedClassDecl.kind === 209 /* ClassExpression */) {
+ if (derivedClassDecl.kind === 210 /* ClassExpression */) {
error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType));
}
else {
@@ -56489,8 +57332,8 @@
for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) {
var base = baseTypes_2[_i];
var properties = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType));
- for (var _a = 0, properties_6 = properties; _a < properties_6.length; _a++) {
- var prop = properties_6[_a];
+ for (var _a = 0, properties_4 = properties; _a < properties_4.length; _a++) {
+ var prop = properties_4[_a];
var existing = seen.get(prop.escapedName);
if (!existing) {
seen.set(prop.escapedName, { prop: prop, containingType: base });
@@ -56531,7 +57374,7 @@
}
}
function isInstancePropertyWithoutInitializer(node) {
- return node.kind === 154 /* PropertyDeclaration */ &&
+ return node.kind === 155 /* PropertyDeclaration */ &&
!ts.hasModifier(node, 32 /* Static */ | 128 /* Abstract */) &&
!node.exclamationToken &&
!node.initializer;
@@ -56555,7 +57398,7 @@
var symbol = getSymbolOfNode(node);
checkTypeParameterListsIdentical(symbol);
// Only check this symbol once
- var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 241 /* InterfaceDeclaration */);
+ var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 242 /* InterfaceDeclaration */);
if (node === firstInterfaceDecl) {
var type = getDeclaredTypeOfSymbol(symbol);
var typeWithThis = getTypeWithThisArgument(type);
@@ -56660,7 +57503,7 @@
return value;
function evaluate(expr) {
switch (expr.kind) {
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
var value_2 = evaluate(expr.operand);
if (typeof value_2 === "number") {
switch (expr.operator) {
@@ -56670,7 +57513,7 @@
}
}
break;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
var left = evaluate(expr.left);
var right = evaluate(expr.right);
if (typeof left === "number" && typeof right === "number") {
@@ -56698,22 +57541,22 @@
case 8 /* NumericLiteral */:
checkGrammarNumericLiteral(expr);
return +expr.text;
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return evaluate(expr.expression);
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
var identifier = expr;
if (isInfinityOrNaNString(identifier.escapedText)) {
return +(identifier.escapedText);
}
return ts.nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), identifier.escapedText);
- case 190 /* ElementAccessExpression */:
- case 189 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
var ex = expr;
if (isConstantMemberAccess(ex)) {
var type = getTypeOfExpression(ex.expression);
if (type.symbol && type.symbol.flags & 384 /* Enum */) {
var name = void 0;
- if (ex.kind === 189 /* PropertyAccessExpression */) {
+ if (ex.kind === 190 /* PropertyAccessExpression */) {
name = ex.name.escapedText;
}
else {
@@ -56744,9 +57587,9 @@
}
}
function isConstantMemberAccess(node) {
- return node.kind === 72 /* Identifier */ ||
- node.kind === 189 /* PropertyAccessExpression */ && isConstantMemberAccess(node.expression) ||
- node.kind === 190 /* ElementAccessExpression */ && isConstantMemberAccess(node.expression) &&
+ return node.kind === 73 /* Identifier */ ||
+ node.kind === 190 /* PropertyAccessExpression */ && isConstantMemberAccess(node.expression) ||
+ node.kind === 191 /* ElementAccessExpression */ && isConstantMemberAccess(node.expression) &&
node.argumentExpression.kind === 10 /* StringLiteral */;
}
function checkEnumDeclaration(node) {
@@ -56781,7 +57624,7 @@
var seenEnumMissingInitialInitializer_1 = false;
ts.forEach(enumSymbol.declarations, function (declaration) {
// return true if we hit a violation of the rule, false otherwise
- if (declaration.kind !== 243 /* EnumDeclaration */) {
+ if (declaration.kind !== 244 /* EnumDeclaration */) {
return false;
}
var enumDeclaration = declaration;
@@ -56804,8 +57647,8 @@
var declarations = symbol.declarations;
for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) {
var declaration = declarations_8[_i];
- if ((declaration.kind === 240 /* ClassDeclaration */ ||
- (declaration.kind === 239 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) &&
+ if ((declaration.kind === 241 /* ClassDeclaration */ ||
+ (declaration.kind === 240 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) &&
!(declaration.flags & 4194304 /* Ambient */)) {
return declaration;
}
@@ -56868,7 +57711,7 @@
}
// if the module merges with a class declaration in the same lexical scope,
// we need to track this to ensure the correct emit.
- var mergedClass = ts.getDeclarationOfKind(symbol, 240 /* ClassDeclaration */);
+ var mergedClass = ts.getDeclarationOfKind(symbol, 241 /* ClassDeclaration */);
if (mergedClass &&
inSameLexicalScope(node, mergedClass)) {
getNodeLinks(node).flags |= 32768 /* LexicalModuleMergesWithClass */;
@@ -56918,23 +57761,23 @@
}
function checkModuleAugmentationElement(node, isGlobalAugmentation) {
switch (node.kind) {
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
// error each individual name in variable statement instead of marking the entire variable statement
for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {
var decl = _a[_i];
checkModuleAugmentationElement(decl, isGlobalAugmentation);
}
break;
- case 254 /* ExportAssignment */:
- case 255 /* ExportDeclaration */:
+ case 255 /* ExportAssignment */:
+ case 256 /* ExportDeclaration */:
grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations);
break;
- case 248 /* ImportEqualsDeclaration */:
- case 249 /* ImportDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 250 /* ImportDeclaration */:
grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module);
break;
- case 186 /* BindingElement */:
- case 237 /* VariableDeclaration */:
+ case 187 /* BindingElement */:
+ case 238 /* VariableDeclaration */:
var name = node.name;
if (ts.isBindingPattern(name)) {
for (var _b = 0, _c = name.elements; _b < _c.length; _b++) {
@@ -56945,12 +57788,12 @@
break;
}
// falls through
- case 240 /* ClassDeclaration */:
- case 243 /* EnumDeclaration */:
- case 239 /* FunctionDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 242 /* TypeAliasDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
if (isGlobalAugmentation) {
return;
}
@@ -56971,17 +57814,17 @@
}
function getFirstIdentifier(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return node;
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
do {
node = node.left;
- } while (node.kind !== 72 /* Identifier */);
+ } while (node.kind !== 73 /* Identifier */);
return node;
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
do {
node = node.expression;
- } while (node.kind !== 72 /* Identifier */);
+ } while (node.kind !== 73 /* Identifier */);
return node;
}
}
@@ -56995,9 +57838,9 @@
error(moduleName, ts.Diagnostics.String_literal_expected);
return false;
}
- var inAmbientExternalModule = node.parent.kind === 245 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent);
- if (node.parent.kind !== 284 /* SourceFile */ && !inAmbientExternalModule) {
- error(moduleName, node.kind === 255 /* ExportDeclaration */ ?
+ var inAmbientExternalModule = node.parent.kind === 246 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent);
+ if (node.parent.kind !== 285 /* SourceFile */ && !inAmbientExternalModule) {
+ error(moduleName, node.kind === 256 /* ExportDeclaration */ ?
ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace :
ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module);
return false;
@@ -57030,14 +57873,14 @@
(symbol.flags & 67897832 /* Type */ ? 67897832 /* Type */ : 0) |
(symbol.flags & 1920 /* Namespace */ ? 1920 /* Namespace */ : 0);
if (target.flags & excludedMeanings) {
- var message = node.kind === 257 /* ExportSpecifier */ ?
+ var message = node.kind === 258 /* ExportSpecifier */ ?
ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 :
ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0;
error(node, message, symbolToString(symbol));
}
// Don't allow to re-export something with no value side when `--isolatedModules` is set.
if (compilerOptions.isolatedModules
- && node.kind === 257 /* ExportSpecifier */
+ && node.kind === 258 /* ExportSpecifier */
&& !(target.flags & 67220415 /* Value */)
&& !(node.flags & 4194304 /* Ambient */)) {
error(node, ts.Diagnostics.Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided);
@@ -57064,7 +57907,7 @@
checkImportBinding(importClause);
}
if (importClause.namedBindings) {
- if (importClause.namedBindings.kind === 251 /* NamespaceImport */) {
+ if (importClause.namedBindings.kind === 252 /* NamespaceImport */) {
checkImportBinding(importClause.namedBindings);
}
else {
@@ -57088,7 +57931,7 @@
if (ts.hasModifier(node, 1 /* Export */)) {
markExportAsReferenced(node);
}
- if (node.moduleReference.kind !== 259 /* ExternalModuleReference */) {
+ if (node.moduleReference.kind !== 260 /* ExternalModuleReference */) {
var target = resolveAlias(getSymbolOfNode(node));
if (target !== unknownSymbol) {
if (target.flags & 67220415 /* Value */) {
@@ -57124,10 +57967,10 @@
// export { x, y }
// export { x, y } from "foo"
ts.forEach(node.exportClause.elements, checkExportSpecifier);
- var inAmbientExternalModule = node.parent.kind === 245 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent);
- var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 245 /* ModuleBlock */ &&
+ var inAmbientExternalModule = node.parent.kind === 246 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent);
+ var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 246 /* ModuleBlock */ &&
!node.moduleSpecifier && node.flags & 4194304 /* Ambient */;
- if (node.parent.kind !== 284 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) {
+ if (node.parent.kind !== 285 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) {
error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace);
}
}
@@ -57144,7 +57987,7 @@
}
}
function checkGrammarModuleElementContext(node, errorMessage) {
- var isInAppropriateContext = node.parent.kind === 284 /* SourceFile */ || node.parent.kind === 245 /* ModuleBlock */ || node.parent.kind === 244 /* ModuleDeclaration */;
+ var isInAppropriateContext = node.parent.kind === 285 /* SourceFile */ || node.parent.kind === 246 /* ModuleBlock */ || node.parent.kind === 245 /* ModuleDeclaration */;
if (!isInAppropriateContext) {
grammarErrorOnFirstToken(node, errorMessage);
}
@@ -57173,8 +58016,8 @@
// If we hit an export assignment in an illegal context, just bail out to avoid cascading errors.
return;
}
- var container = node.parent.kind === 284 /* SourceFile */ ? node.parent : node.parent.parent;
- if (container.kind === 244 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) {
+ var container = node.parent.kind === 285 /* SourceFile */ ? node.parent : node.parent.parent;
+ if (container.kind === 245 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) {
if (node.isExportEquals) {
error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace);
}
@@ -57187,7 +58030,7 @@
if (!checkGrammarDecoratorsAndModifiers(node) && ts.hasModifiers(node)) {
grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers);
}
- if (node.expression.kind === 72 /* Identifier */) {
+ if (node.expression.kind === 73 /* Identifier */) {
markExportAsReferenced(node);
if (ts.getEmitDeclarations(compilerOptions)) {
collectLinkedAliases(node.expression, /*setVisibility*/ true);
@@ -57262,7 +58105,7 @@
return !ts.isAccessor(declaration);
}
function isNotOverload(declaration) {
- return (declaration.kind !== 239 /* FunctionDeclaration */ && declaration.kind !== 156 /* MethodDeclaration */) ||
+ return (declaration.kind !== 240 /* FunctionDeclaration */ && declaration.kind !== 157 /* MethodDeclaration */) ||
!!declaration.body;
}
function checkSourceElement(node) {
@@ -57285,158 +58128,158 @@
// Only bother checking on a few construct kinds. We don't want to be excessively
// hitting the cancellation token on every node we check.
switch (kind) {
- case 244 /* ModuleDeclaration */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 239 /* FunctionDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 240 /* FunctionDeclaration */:
cancellationToken.throwIfCancellationRequested();
}
}
switch (kind) {
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
return checkTypeParameter(node);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return checkParameter(node);
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
return checkPropertyDeclaration(node);
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
return checkSignatureDeclaration(node);
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
return checkMethodDeclaration(node);
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return checkConstructorDeclaration(node);
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return checkAccessorDeclaration(node);
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return checkTypeReferenceNode(node);
- case 163 /* TypePredicate */:
+ case 164 /* TypePredicate */:
return checkTypePredicate(node);
- case 167 /* TypeQuery */:
+ case 168 /* TypeQuery */:
return checkTypeQuery(node);
- case 168 /* TypeLiteral */:
+ case 169 /* TypeLiteral */:
return checkTypeLiteral(node);
- case 169 /* ArrayType */:
+ case 170 /* ArrayType */:
return checkArrayType(node);
- case 170 /* TupleType */:
+ case 171 /* TupleType */:
return checkTupleType(node);
- case 173 /* UnionType */:
- case 174 /* IntersectionType */:
+ case 174 /* UnionType */:
+ case 175 /* IntersectionType */:
return checkUnionOrIntersectionType(node);
- case 177 /* ParenthesizedType */:
- case 171 /* OptionalType */:
- case 172 /* RestType */:
+ case 178 /* ParenthesizedType */:
+ case 172 /* OptionalType */:
+ case 173 /* RestType */:
return checkSourceElement(node.type);
- case 178 /* ThisType */:
+ case 179 /* ThisType */:
return checkThisType(node);
- case 179 /* TypeOperator */:
+ case 180 /* TypeOperator */:
return checkTypeOperator(node);
- case 175 /* ConditionalType */:
+ case 176 /* ConditionalType */:
return checkConditionalType(node);
- case 176 /* InferType */:
+ case 177 /* InferType */:
return checkInferType(node);
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return checkImportType(node);
- case 300 /* JSDocAugmentsTag */:
+ case 301 /* JSDocAugmentsTag */:
return checkJSDocAugmentsTag(node);
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
return checkJSDocTypeAliasTag(node);
- case 308 /* JSDocTemplateTag */:
+ case 309 /* JSDocTemplateTag */:
return checkJSDocTemplateTag(node);
- case 307 /* JSDocTypeTag */:
+ case 308 /* JSDocTypeTag */:
return checkJSDocTypeTag(node);
- case 304 /* JSDocParameterTag */:
+ case 305 /* JSDocParameterTag */:
return checkJSDocParameterTag(node);
- case 294 /* JSDocFunctionType */:
+ case 295 /* JSDocFunctionType */:
checkJSDocFunctionType(node);
// falls through
- case 292 /* JSDocNonNullableType */:
- case 291 /* JSDocNullableType */:
- case 289 /* JSDocAllType */:
- case 290 /* JSDocUnknownType */:
- case 297 /* JSDocTypeLiteral */:
+ case 293 /* JSDocNonNullableType */:
+ case 292 /* JSDocNullableType */:
+ case 290 /* JSDocAllType */:
+ case 291 /* JSDocUnknownType */:
+ case 298 /* JSDocTypeLiteral */:
checkJSDocTypeIsInJsFile(node);
ts.forEachChild(node, checkSourceElement);
return;
- case 295 /* JSDocVariadicType */:
+ case 296 /* JSDocVariadicType */:
checkJSDocVariadicType(node);
return;
- case 288 /* JSDocTypeExpression */:
+ case 289 /* JSDocTypeExpression */:
return checkSourceElement(node.type);
- case 180 /* IndexedAccessType */:
+ case 181 /* IndexedAccessType */:
return checkIndexedAccessType(node);
- case 181 /* MappedType */:
+ case 182 /* MappedType */:
return checkMappedType(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return checkFunctionDeclaration(node);
- case 218 /* Block */:
- case 245 /* ModuleBlock */:
+ case 219 /* Block */:
+ case 246 /* ModuleBlock */:
return checkBlock(node);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return checkVariableStatement(node);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return checkExpressionStatement(node);
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
return checkIfStatement(node);
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
return checkDoStatement(node);
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
return checkWhileStatement(node);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return checkForStatement(node);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return checkForInStatement(node);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return checkForOfStatement(node);
- case 228 /* ContinueStatement */:
- case 229 /* BreakStatement */:
+ case 229 /* ContinueStatement */:
+ case 230 /* BreakStatement */:
return checkBreakOrContinueStatement(node);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return checkReturnStatement(node);
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
return checkWithStatement(node);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return checkSwitchStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return checkLabeledStatement(node);
- case 234 /* ThrowStatement */:
+ case 235 /* ThrowStatement */:
return checkThrowStatement(node);
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
return checkTryStatement(node);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return checkVariableDeclaration(node);
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return checkBindingElement(node);
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return checkClassDeclaration(node);
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
return checkInterfaceDeclaration(node);
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return checkTypeAliasDeclaration(node);
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return checkEnumDeclaration(node);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return checkModuleDeclaration(node);
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return checkImportDeclaration(node);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return checkImportEqualsDeclaration(node);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return checkExportDeclaration(node);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return checkExportAssignment(node);
- case 220 /* EmptyStatement */:
- case 236 /* DebuggerStatement */:
+ case 221 /* EmptyStatement */:
+ case 237 /* DebuggerStatement */:
checkGrammarStatementInAmbientContext(node);
return;
- case 258 /* MissingDeclaration */:
+ case 259 /* MissingDeclaration */:
return checkMissingDeclaration(node);
}
}
@@ -57530,23 +58373,23 @@
var saveCurrentNode = currentNode;
currentNode = node;
switch (node.kind) {
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
checkFunctionExpressionOrObjectLiteralMethodDeferred(node);
break;
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
checkAccessorDeclaration(node);
break;
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
checkClassExpressionDeferred(node);
break;
- case 261 /* JsxSelfClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
checkJsxSelfClosingElementDeferred(node);
break;
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
checkJsxElementDeferred(node);
break;
}
@@ -57676,17 +58519,17 @@
copySymbols(location.locals, meaning);
}
switch (location.kind) {
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
if (!ts.isExternalOrCommonJsModule(location))
break;
// falls through
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
copySymbols(getSymbolOfNode(location).exports, meaning & 2623475 /* ModuleMember */);
break;
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* EnumMember */);
break;
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
var className = location.name;
if (className) {
copySymbol(location.symbol, meaning);
@@ -57694,8 +58537,8 @@
// falls through
// this fall-through is necessary because we would like to handle
// type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
// If we didn't come from static member of class or interface,
// add the type parameters into the symbol table
// (type parameters of classDeclaration/classExpression and interface are in member property of the symbol.
@@ -57704,7 +58547,7 @@
copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & 67897832 /* Type */);
}
break;
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
var funcName = location.name;
if (funcName) {
copySymbol(location.symbol, meaning);
@@ -57746,17 +58589,17 @@
}
}
function isTypeDeclarationName(name) {
- return name.kind === 72 /* Identifier */ &&
+ return name.kind === 73 /* Identifier */ &&
isTypeDeclaration(name.parent) &&
name.parent.name === name;
}
function isTypeDeclaration(node) {
switch (node.kind) {
- case 150 /* TypeParameter */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 243 /* EnumDeclaration */:
+ case 151 /* TypeParameter */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 244 /* EnumDeclaration */:
return true;
default:
return false;
@@ -57764,16 +58607,16 @@
}
// True if the given identifier is part of a type reference
function isTypeReferenceIdentifier(node) {
- while (node.parent.kind === 148 /* QualifiedName */) {
+ while (node.parent.kind === 149 /* QualifiedName */) {
node = node.parent;
}
- return node.parent.kind === 164 /* TypeReference */;
+ return node.parent.kind === 165 /* TypeReference */;
}
function isHeritageClauseElementIdentifier(node) {
- while (node.parent.kind === 189 /* PropertyAccessExpression */) {
+ while (node.parent.kind === 190 /* PropertyAccessExpression */) {
node = node.parent;
}
- return node.parent.kind === 211 /* ExpressionWithTypeArguments */;
+ return node.parent.kind === 212 /* ExpressionWithTypeArguments */;
}
function forEachEnclosingClass(node, callback) {
var result;
@@ -57801,13 +58644,13 @@
return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; });
}
function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) {
- while (nodeOnRightSide.parent.kind === 148 /* QualifiedName */) {
+ while (nodeOnRightSide.parent.kind === 149 /* QualifiedName */) {
nodeOnRightSide = nodeOnRightSide.parent;
}
- if (nodeOnRightSide.parent.kind === 248 /* ImportEqualsDeclaration */) {
+ if (nodeOnRightSide.parent.kind === 249 /* ImportEqualsDeclaration */) {
return nodeOnRightSide.parent.moduleReference === nodeOnRightSide ? nodeOnRightSide.parent : undefined;
}
- if (nodeOnRightSide.parent.kind === 254 /* ExportAssignment */) {
+ if (nodeOnRightSide.parent.kind === 255 /* ExportAssignment */) {
return nodeOnRightSide.parent.expression === nodeOnRightSide ? nodeOnRightSide.parent : undefined;
}
return undefined;
@@ -57833,7 +58676,7 @@
node = parent;
parent = parent.parent;
}
- if (parent && parent.kind === 183 /* ImportType */ && parent.qualifier === node) {
+ if (parent && parent.kind === 184 /* ImportType */ && parent.qualifier === node) {
return parent;
}
return undefined;
@@ -57843,7 +58686,7 @@
return getSymbolOfNode(entityName.parent);
}
if (ts.isInJSFile(entityName) &&
- entityName.parent.kind === 189 /* PropertyAccessExpression */ &&
+ entityName.parent.kind === 190 /* PropertyAccessExpression */ &&
entityName.parent === entityName.parent.parent.left) {
// Check if this is a special property assignment
var specialPropertyAssignmentSymbol = getSpecialPropertyAssignmentSymbolFromEntityName(entityName);
@@ -57851,7 +58694,7 @@
return specialPropertyAssignmentSymbol;
}
}
- if (entityName.parent.kind === 254 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) {
+ if (entityName.parent.kind === 255 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) {
// Even an entity name expression that doesn't resolve as an entityname may still typecheck as a property access expression
var success = resolveEntityName(entityName,
/*all meanings*/ 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */, /*ignoreErrors*/ true);
@@ -57861,7 +58704,7 @@
}
else if (!ts.isPropertyAccessExpression(entityName) && isInRightSideOfImportOrExportAssignment(entityName)) {
// Since we already checked for ExportAssignment, this really could only be an Import
- var importEqualsDeclaration = ts.getAncestor(entityName, 248 /* ImportEqualsDeclaration */);
+ var importEqualsDeclaration = ts.getAncestor(entityName, 249 /* ImportEqualsDeclaration */);
ts.Debug.assert(importEqualsDeclaration !== undefined);
return getSymbolOfPartOfRightHandSideOfImportEquals(entityName, /*dontResolveAlias*/ true);
}
@@ -57879,7 +58722,7 @@
if (isHeritageClauseElementIdentifier(entityName)) {
var meaning = 0 /* None */;
// In an interface or class, we're definitely interested in a type.
- if (entityName.parent.kind === 211 /* ExpressionWithTypeArguments */) {
+ if (entityName.parent.kind === 212 /* ExpressionWithTypeArguments */) {
meaning = 67897832 /* Type */;
// In a class 'extends' clause we are also looking for a value.
if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) {
@@ -57895,10 +58738,10 @@
return entityNameSymbol;
}
}
- if (entityName.parent.kind === 304 /* JSDocParameterTag */) {
+ if (entityName.parent.kind === 305 /* JSDocParameterTag */) {
return ts.getParameterSymbolFromJSDoc(entityName.parent);
}
- if (entityName.parent.kind === 150 /* TypeParameter */ && entityName.parent.parent.kind === 308 /* JSDocTemplateTag */) {
+ if (entityName.parent.kind === 151 /* TypeParameter */ && entityName.parent.parent.kind === 309 /* JSDocTemplateTag */) {
ts.Debug.assert(!ts.isInJSFile(entityName)); // Otherwise `isDeclarationName` would have been true.
var typeParameter = ts.getTypeParameterFromJsDoc(entityName.parent);
return typeParameter && typeParameter.symbol;
@@ -57908,19 +58751,19 @@
// Missing entity name.
return undefined;
}
- if (entityName.kind === 72 /* Identifier */) {
+ if (entityName.kind === 73 /* Identifier */) {
if (ts.isJSXTagName(entityName) && isJsxIntrinsicIdentifier(entityName)) {
var symbol = getIntrinsicTagSymbol(entityName.parent);
return symbol === unknownSymbol ? undefined : symbol;
}
return resolveEntityName(entityName, 67220415 /* Value */, /*ignoreErrors*/ false, /*dontResolveAlias*/ true);
}
- else if (entityName.kind === 189 /* PropertyAccessExpression */ || entityName.kind === 148 /* QualifiedName */) {
+ else if (entityName.kind === 190 /* PropertyAccessExpression */ || entityName.kind === 149 /* QualifiedName */) {
var links = getNodeLinks(entityName);
if (links.resolvedSymbol) {
return links.resolvedSymbol;
}
- if (entityName.kind === 189 /* PropertyAccessExpression */) {
+ if (entityName.kind === 190 /* PropertyAccessExpression */) {
checkPropertyAccessExpression(entityName);
}
else {
@@ -57930,17 +58773,17 @@
}
}
else if (isTypeReferenceIdentifier(entityName)) {
- var meaning = entityName.parent.kind === 164 /* TypeReference */ ? 67897832 /* Type */ : 1920 /* Namespace */;
+ var meaning = entityName.parent.kind === 165 /* TypeReference */ ? 67897832 /* Type */ : 1920 /* Namespace */;
return resolveEntityName(entityName, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true);
}
- if (entityName.parent.kind === 163 /* TypePredicate */) {
+ if (entityName.parent.kind === 164 /* TypePredicate */) {
return resolveEntityName(entityName, /*meaning*/ 1 /* FunctionScopedVariable */);
}
// Do we want to return undefined here?
return undefined;
}
function getSymbolAtLocation(node) {
- if (node.kind === 284 /* SourceFile */) {
+ if (node.kind === 285 /* SourceFile */) {
return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined;
}
var parent = node.parent;
@@ -57959,12 +58802,12 @@
else if (ts.isLiteralComputedPropertyDeclarationName(node)) {
return getSymbolOfNode(parent.parent);
}
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
if (isInRightSideOfImportOrExportAssignment(node)) {
return getSymbolOfEntityNameOrPropertyAccessExpression(node);
}
- else if (parent.kind === 186 /* BindingElement */ &&
- grandParent.kind === 184 /* ObjectBindingPattern */ &&
+ else if (parent.kind === 187 /* BindingElement */ &&
+ grandParent.kind === 185 /* ObjectBindingPattern */ &&
node === parent.propertyName) {
var typeOfPattern = getTypeOfNode(grandParent);
var propertyDeclaration = getPropertyOfType(typeOfPattern, node.escapedText);
@@ -57974,11 +58817,11 @@
}
}
switch (node.kind) {
- case 72 /* Identifier */:
- case 189 /* PropertyAccessExpression */:
- case 148 /* QualifiedName */:
+ case 73 /* Identifier */:
+ case 190 /* PropertyAccessExpression */:
+ case 149 /* QualifiedName */:
return getSymbolOfEntityNameOrPropertyAccessExpression(node);
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false);
if (ts.isFunctionLike(container)) {
var sig = getSignatureFromDeclaration(container);
@@ -57990,14 +58833,14 @@
return checkExpression(node).symbol;
}
// falls through
- case 178 /* ThisType */:
+ case 179 /* ThisType */:
return getTypeFromThisTypeNode(node).symbol;
- case 98 /* SuperKeyword */:
+ case 99 /* SuperKeyword */:
return checkExpression(node).symbol;
- case 124 /* ConstructorKeyword */:
+ case 125 /* ConstructorKeyword */:
// constructor keyword for an overload, should take us to the definition if it exist
var constructorDeclaration = node.parent;
- if (constructorDeclaration && constructorDeclaration.kind === 157 /* Constructor */) {
+ if (constructorDeclaration && constructorDeclaration.kind === 158 /* Constructor */) {
return constructorDeclaration.parent.symbol;
}
return undefined;
@@ -58008,7 +58851,7 @@
// 3). Dynamic import call or require in javascript
// 4). type A = import("./f/*gotToDefinitionHere*/oo")
if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) ||
- ((node.parent.kind === 249 /* ImportDeclaration */ || node.parent.kind === 255 /* ExportDeclaration */) && node.parent.moduleSpecifier === node) ||
+ ((node.parent.kind === 250 /* ImportDeclaration */ || node.parent.kind === 256 /* ExportDeclaration */) && node.parent.moduleSpecifier === node) ||
((ts.isInJSFile(node) && ts.isRequireCall(node.parent, /*checkArgumentIsStringLiteralLike*/ false)) || ts.isImportCall(node.parent)) ||
(ts.isLiteralTypeNode(node.parent) && ts.isLiteralImportTypeNode(node.parent.parent) && node.parent.parent.argument === node.parent)) {
return resolveExternalModuleName(node, node);
@@ -58025,21 +58868,21 @@
? getTypeFromTypeNode(grandParent.objectType)
: undefined;
return objectType && getPropertyOfType(objectType, ts.escapeLeadingUnderscores(node.text));
- case 80 /* DefaultKeyword */:
- case 90 /* FunctionKeyword */:
+ case 81 /* DefaultKeyword */:
+ case 91 /* FunctionKeyword */:
case 37 /* EqualsGreaterThanToken */:
- case 76 /* ClassKeyword */:
+ case 77 /* ClassKeyword */:
return getSymbolOfNode(node.parent);
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return ts.isLiteralImportTypeNode(node) ? getSymbolAtLocation(node.argument.literal) : undefined;
- case 85 /* ExportKeyword */:
+ case 86 /* ExportKeyword */:
return ts.isExportAssignment(node.parent) ? ts.Debug.assertDefined(node.parent.symbol) : undefined;
default:
return undefined;
}
}
function getShorthandAssignmentValueSymbol(location) {
- if (location && location.kind === 276 /* ShorthandPropertyAssignment */) {
+ if (location && location.kind === 277 /* ShorthandPropertyAssignment */) {
return resolveEntityName(location.name, 67220415 /* Value */ | 2097152 /* Alias */);
}
return undefined;
@@ -58106,33 +58949,35 @@
// }
// [ a ] from
// [a] = [ some array ...]
- function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr) {
- ts.Debug.assert(expr.kind === 188 /* ObjectLiteralExpression */ || expr.kind === 187 /* ArrayLiteralExpression */);
+ function getTypeOfAssignmentPattern(expr) {
+ ts.Debug.assert(expr.kind === 189 /* ObjectLiteralExpression */ || expr.kind === 188 /* ArrayLiteralExpression */);
// If this is from "for of"
// for ( { a } of elems) {
// }
- if (expr.parent.kind === 227 /* ForOfStatement */) {
+ if (expr.parent.kind === 228 /* ForOfStatement */) {
var iteratedType = checkRightHandSideOfForOf(expr.parent.expression, expr.parent.awaitModifier);
return checkDestructuringAssignment(expr, iteratedType || errorType);
}
// If this is from "for" initializer
// for ({a } = elems[0];.....) { }
- if (expr.parent.kind === 204 /* BinaryExpression */) {
+ if (expr.parent.kind === 205 /* BinaryExpression */) {
var iteratedType = getTypeOfExpression(expr.parent.right);
return checkDestructuringAssignment(expr, iteratedType || errorType);
}
// If this is from nested object binding pattern
// for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) {
- if (expr.parent.kind === 275 /* PropertyAssignment */) {
- var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent);
- return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || errorType, expr.parent); // TODO: GH#18217
+ if (expr.parent.kind === 276 /* PropertyAssignment */) {
+ var node_3 = ts.cast(expr.parent.parent, ts.isObjectLiteralExpression);
+ var typeOfParentObjectLiteral = getTypeOfAssignmentPattern(node_3) || errorType;
+ var propertyIndex = ts.indexOfNode(node_3.properties, expr.parent);
+ return checkObjectLiteralDestructuringPropertyAssignment(node_3, typeOfParentObjectLiteral, propertyIndex);
}
// Array literal assignment - array destructuring pattern
- ts.Debug.assert(expr.parent.kind === 187 /* ArrayLiteralExpression */);
+ var node = ts.cast(expr.parent, ts.isArrayLiteralExpression);
// [{ property1: p1, property2 }] = elems;
- var typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent);
- var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || errorType, expr.parent, /*allowStringInput*/ false, /*allowAsyncIterables*/ false) || errorType;
- return checkArrayLiteralDestructuringElementAssignment(expr.parent, typeOfArrayLiteral, expr.parent.elements.indexOf(expr), elementType || errorType); // TODO: GH#18217
+ var typeOfArrayLiteral = getTypeOfAssignmentPattern(node) || errorType;
+ var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral, expr.parent, /*allowStringInput*/ false, /*allowAsyncIterables*/ false) || errorType;
+ return checkArrayLiteralDestructuringElementAssignment(node, typeOfArrayLiteral, node.elements.indexOf(expr), elementType);
}
// Gets the property symbol corresponding to the property in destructuring assignment
// 'property1' from
@@ -58142,7 +58987,7 @@
// [a] = [ property1, property2 ]
function getPropertySymbolOfDestructuringAssignment(location) {
// Get the type of the object or array literal and then look for property of given name in the type
- var typeOfObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(location.parent.parent);
+ var typeOfObjectLiteral = getTypeOfAssignmentPattern(ts.cast(location.parent.parent, ts.isAssignmentPattern));
return typeOfObjectLiteral && getPropertyOfType(typeOfObjectLiteral, location.escapedText);
}
function getRegularTypeOfExpression(expr) {
@@ -58164,12 +59009,12 @@
function getClassElementPropertyKeyType(element) {
var name = element.name;
switch (name.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return getLiteralType(ts.idText(name));
case 8 /* NumericLiteral */:
case 10 /* StringLiteral */:
return getLiteralType(name.text);
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
var nameType = checkComputedPropertyName(name);
return isTypeAssignableToKind(nameType, 12288 /* ESSymbolLike */) ? nameType : stringType;
default:
@@ -58226,7 +59071,7 @@
if (!ts.isGeneratedIdentifier(nodeIn)) {
var node = ts.getParseTreeNode(nodeIn, ts.isIdentifier);
if (node) {
- var isPropertyName_1 = node.parent.kind === 189 /* PropertyAccessExpression */ && node.parent.name === node;
+ var isPropertyName_1 = node.parent.kind === 190 /* PropertyAccessExpression */ && node.parent.name === node;
return !isPropertyName_1 && getReferencedValueSymbol(node) === argumentsSymbol;
}
}
@@ -58282,7 +59127,7 @@
}
var parentSymbol_1 = getParentOfSymbol(symbol);
if (parentSymbol_1) {
- if (parentSymbol_1.flags & 512 /* ValueModule */ && parentSymbol_1.valueDeclaration.kind === 284 /* SourceFile */) {
+ if (parentSymbol_1.flags & 512 /* ValueModule */ && parentSymbol_1.valueDeclaration.kind === 285 /* SourceFile */) {
var symbolFile = parentSymbol_1.valueDeclaration;
var referenceFile = ts.getSourceFileOfNode(node);
// If `node` accesses an export and that export isn't in the same file, then symbol is a namespace export, so return undefined.
@@ -58308,12 +59153,16 @@
}
return undefined;
}
+ function isSymbolOfDestructuredElementOfCatchBinding(symbol) {
+ return ts.isBindingElement(symbol.valueDeclaration)
+ && ts.walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 275 /* CatchClause */;
+ }
function isSymbolOfDeclarationWithCollidingName(symbol) {
if (symbol.flags & 418 /* BlockScoped */ && !ts.isSourceFile(symbol.valueDeclaration)) {
var links = getSymbolLinks(symbol);
if (links.isDeclarationWithCollidingName === undefined) {
var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration);
- if (ts.isStatementWithLocals(container)) {
+ if (ts.isStatementWithLocals(container) || isSymbolOfDestructuredElementOfCatchBinding(symbol)) {
var nodeLinks_1 = getNodeLinks(symbol.valueDeclaration);
if (resolveName(container.parent, symbol.escapedName, 67220415 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)) {
// redeclaration - always should be renamed
@@ -58337,7 +59186,7 @@
// they will not collide with anything
var isDeclaredInLoop = nodeLinks_1.flags & 524288 /* BlockScopedBindingInLoop */;
var inLoopInitializer = ts.isIterationStatement(container, /*lookInLabeledStatements*/ false);
- var inLoopBodyBlock = container.kind === 218 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false);
+ var inLoopBodyBlock = container.kind === 219 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false);
links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock));
}
else {
@@ -58378,18 +59227,18 @@
}
function isValueAliasDeclaration(node) {
switch (node.kind) {
- case 248 /* ImportEqualsDeclaration */:
- case 250 /* ImportClause */:
- case 251 /* NamespaceImport */:
- case 253 /* ImportSpecifier */:
- case 257 /* ExportSpecifier */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 251 /* ImportClause */:
+ case 252 /* NamespaceImport */:
+ case 254 /* ImportSpecifier */:
+ case 258 /* ExportSpecifier */:
return isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
var exportClause = node.exportClause;
return !!exportClause && ts.some(exportClause.elements, isValueAliasDeclaration);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return node.expression
- && node.expression.kind === 72 /* Identifier */
+ && node.expression.kind === 73 /* Identifier */
? isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol)
: true;
}
@@ -58397,7 +59246,7 @@
}
function isTopLevelValueImportEqualsWithEntityName(nodeIn) {
var node = ts.getParseTreeNode(nodeIn, ts.isImportEqualsDeclaration);
- if (node === undefined || node.parent.kind !== 284 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) {
+ if (node === undefined || node.parent.kind !== 285 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) {
// parent is not source file or it is not reference to internal module
return false;
}
@@ -58498,15 +59347,15 @@
}
function canHaveConstantValue(node) {
switch (node.kind) {
- case 278 /* EnumMember */:
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 279 /* EnumMember */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return true;
}
return false;
}
function getConstantValue(node) {
- if (node.kind === 278 /* EnumMember */) {
+ if (node.kind === 279 /* EnumMember */) {
return getEnumMemberValue(node);
}
var symbol = getNodeLinks(node).resolvedSymbol;
@@ -58591,7 +59440,7 @@
function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, tracker, addUndefined) {
var declaration = ts.getParseTreeNode(declarationIn, ts.isVariableLikeOrAccessor);
if (!declaration) {
- return ts.createToken(120 /* AnyKeyword */);
+ return ts.createToken(121 /* AnyKeyword */);
}
// Get type of the symbol if this is the valid symbol otherwise get type at location
var symbol = getSymbolOfNode(declaration);
@@ -58610,7 +59459,7 @@
function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, tracker) {
var signatureDeclaration = ts.getParseTreeNode(signatureDeclarationIn, ts.isFunctionLike);
if (!signatureDeclaration) {
- return ts.createToken(120 /* AnyKeyword */);
+ return ts.createToken(121 /* AnyKeyword */);
}
var signature = getSignatureFromDeclaration(signatureDeclaration);
return nodeBuilder.typeToTypeNode(getReturnTypeOfSignature(signature), enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
@@ -58618,7 +59467,7 @@
function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) {
var expr = ts.getParseTreeNode(exprIn, ts.isExpression);
if (!expr) {
- return ts.createToken(120 /* AnyKeyword */);
+ return ts.createToken(121 /* AnyKeyword */);
}
var type = getWidenedType(getRegularTypeOfExpression(expr));
return nodeBuilder.typeToTypeNode(type, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
@@ -58737,17 +59586,17 @@
isLateBound: function (nodeIn) {
var node = ts.getParseTreeNode(nodeIn, ts.isDeclaration);
var symbol = node && getSymbolOfNode(node);
- return !!(symbol && ts.getCheckFlags(symbol) & 2048 /* Late */);
+ return !!(symbol && ts.getCheckFlags(symbol) & 4096 /* Late */);
},
getJsxFactoryEntity: function (location) { return location ? (getJsxNamespace(location), (ts.getSourceFileOfNode(location).localJsxFactory || _jsxFactoryEntity)) : _jsxFactoryEntity; },
getAllAccessorDeclarations: function (accessor) {
accessor = ts.getParseTreeNode(accessor, ts.isGetOrSetAccessorDeclaration); // TODO: GH#18217
- var otherKind = accessor.kind === 159 /* SetAccessor */ ? 158 /* GetAccessor */ : 159 /* SetAccessor */;
+ var otherKind = accessor.kind === 160 /* SetAccessor */ ? 159 /* GetAccessor */ : 160 /* SetAccessor */;
var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(accessor), otherKind);
var firstAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? otherAccessor : accessor;
var secondAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? accessor : otherAccessor;
- var setAccessor = accessor.kind === 159 /* SetAccessor */ ? accessor : otherAccessor;
- var getAccessor = accessor.kind === 158 /* GetAccessor */ ? accessor : otherAccessor;
+ var setAccessor = accessor.kind === 160 /* SetAccessor */ ? accessor : otherAccessor;
+ var getAccessor = accessor.kind === 159 /* GetAccessor */ ? accessor : otherAccessor;
return {
firstAccessor: firstAccessor,
secondAccessor: secondAccessor,
@@ -58763,7 +59612,7 @@
}
};
function isInHeritageClause(node) {
- return node.parent && node.parent.kind === 211 /* ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 273 /* HeritageClause */;
+ return node.parent && node.parent.kind === 212 /* ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 274 /* HeritageClause */;
}
// defined here to avoid outer scope pollution
function getTypeReferenceDirectivesForEntityName(node) {
@@ -58775,7 +59624,7 @@
// qualified names can only be used as types\namespaces
// identifiers are treated as values only if they appear in type queries
var meaning = 67897832 /* Type */ | 1920 /* Namespace */;
- if ((node.kind === 72 /* Identifier */ && isInTypeQuery(node)) || (node.kind === 189 /* PropertyAccessExpression */ && !isInHeritageClause(node))) {
+ if ((node.kind === 73 /* Identifier */ && isInTypeQuery(node)) || (node.kind === 190 /* PropertyAccessExpression */ && !isInHeritageClause(node))) {
meaning = 67220415 /* Value */ | 1048576 /* ExportValue */;
}
var symbol = resolveEntityName(node, meaning, /*ignoreErrors*/ true);
@@ -58826,7 +59675,7 @@
break;
}
}
- if (current.valueDeclaration && current.valueDeclaration.kind === 284 /* SourceFile */ && current.flags & 512 /* ValueModule */) {
+ if (current.valueDeclaration && current.valueDeclaration.kind === 285 /* SourceFile */ && current.flags & 512 /* ValueModule */) {
return false;
}
// check that at least one declaration of top level symbol originates from type declaration file
@@ -58854,12 +59703,12 @@
}
}
function getExternalModuleFileFromDeclaration(declaration) {
- var specifier = declaration.kind === 244 /* ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration);
+ var specifier = declaration.kind === 245 /* ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration);
var moduleSymbol = resolveExternalModuleNameWorker(specifier, specifier, /*moduleNotFoundError*/ undefined); // TODO: GH#18217
if (!moduleSymbol) {
return undefined;
}
- return ts.getDeclarationOfKind(moduleSymbol, 284 /* SourceFile */);
+ return ts.getDeclarationOfKind(moduleSymbol, 285 /* SourceFile */);
}
function initializeTypeChecker() {
// Bind all source files and propagate errors
@@ -58876,6 +59725,15 @@
continue;
}
if (!ts.isExternalOrCommonJsModule(file)) {
+ // It is an error for a non-external-module (i.e. script) to declare its own `globalThis`.
+ // We can't use `builtinGlobals` for this due to synthetic expando-namespace generation in JS files.
+ var fileGlobalThisSymbol = file.locals.get("globalThis");
+ if (fileGlobalThisSymbol) {
+ for (var _d = 0, _e = fileGlobalThisSymbol.declarations; _d < _e.length; _d++) {
+ var declaration = _e[_d];
+ diagnostics.add(ts.createDiagnosticForNode(declaration, ts.Diagnostics.Declaration_name_conflicts_with_built_in_global_identifier_0, "globalThis"));
+ }
+ }
mergeSymbolTable(globals, file.locals);
}
if (file.jsGlobalAugmentations) {
@@ -58906,10 +59764,10 @@
if (augmentations) {
// merge _global_ module augmentations.
// this needs to be done after global symbol table is initialized to make sure that all ambient modules are indexed
- for (var _d = 0, augmentations_1 = augmentations; _d < augmentations_1.length; _d++) {
- var list = augmentations_1[_d];
- for (var _e = 0, list_1 = list; _e < list_1.length; _e++) {
- var augmentation = list_1[_e];
+ for (var _f = 0, augmentations_1 = augmentations; _f < augmentations_1.length; _f++) {
+ var list = augmentations_1[_f];
+ for (var _g = 0, list_1 = list; _g < list_1.length; _g++) {
+ var augmentation = list_1[_g];
if (!ts.isGlobalScopeAugmentation(augmentation.parent))
continue;
mergeModuleAugmentation(augmentation);
@@ -58921,6 +59779,7 @@
getSymbolLinks(undefinedSymbol).type = undefinedWideningType;
getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments", /*arity*/ 0, /*reportErrors*/ true);
getSymbolLinks(unknownSymbol).type = errorType;
+ getSymbolLinks(globalThisSymbol).type = createObjectType(16 /* Anonymous */, globalThisSymbol);
// Initialize special types
globalArrayType = getGlobalType("Array", /*arity*/ 1, /*reportErrors*/ true);
globalObjectType = getGlobalType("Object", /*arity*/ 0, /*reportErrors*/ true);
@@ -58943,10 +59802,10 @@
if (augmentations) {
// merge _nonglobal_ module augmentations.
// this needs to be done after global symbol table is initialized to make sure that all ambient modules are indexed
- for (var _f = 0, augmentations_2 = augmentations; _f < augmentations_2.length; _f++) {
- var list = augmentations_2[_f];
- for (var _g = 0, list_2 = list; _g < list_2.length; _g++) {
- var augmentation = list_2[_g];
+ for (var _h = 0, augmentations_2 = augmentations; _h < augmentations_2.length; _h++) {
+ var list = augmentations_2[_h];
+ for (var _j = 0, list_2 = list; _j < list_2.length; _j++) {
+ var augmentation = list_2[_j];
if (ts.isGlobalScopeAugmentation(augmentation.parent))
continue;
mergeModuleAugmentation(augmentation);
@@ -59037,14 +59896,14 @@
return false;
}
if (!ts.nodeCanBeDecorated(node, node.parent, node.parent.parent)) {
- if (node.kind === 156 /* MethodDeclaration */ && !ts.nodeIsPresent(node.body)) {
+ if (node.kind === 157 /* MethodDeclaration */ && !ts.nodeIsPresent(node.body)) {
return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload);
}
else {
return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here);
}
}
- else if (node.kind === 158 /* GetAccessor */ || node.kind === 159 /* SetAccessor */) {
+ else if (node.kind === 159 /* GetAccessor */ || node.kind === 160 /* SetAccessor */) {
var accessors = ts.getAllAccessorDeclarations(node.parent.members, node);
if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) {
return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name);
@@ -59061,23 +59920,23 @@
var flags = 0 /* None */;
for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) {
var modifier = _a[_i];
- if (modifier.kind !== 133 /* ReadonlyKeyword */) {
- if (node.kind === 153 /* PropertySignature */ || node.kind === 155 /* MethodSignature */) {
+ if (modifier.kind !== 134 /* ReadonlyKeyword */) {
+ if (node.kind === 154 /* PropertySignature */ || node.kind === 156 /* MethodSignature */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind));
}
- if (node.kind === 162 /* IndexSignature */) {
+ if (node.kind === 163 /* IndexSignature */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind));
}
}
switch (modifier.kind) {
- case 77 /* ConstKeyword */:
- if (node.kind !== 243 /* EnumDeclaration */) {
- return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(77 /* ConstKeyword */));
+ case 78 /* ConstKeyword */:
+ if (node.kind !== 244 /* EnumDeclaration */) {
+ return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(78 /* ConstKeyword */));
}
break;
- case 115 /* PublicKeyword */:
- case 114 /* ProtectedKeyword */:
- case 113 /* PrivateKeyword */:
+ case 116 /* PublicKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 114 /* PrivateKeyword */:
var text = visibilityToString(ts.modifierToFlag(modifier.kind));
if (flags & 28 /* AccessibilityModifier */) {
return grammarErrorOnNode(modifier, ts.Diagnostics.Accessibility_modifier_already_seen);
@@ -59091,11 +59950,11 @@
else if (flags & 256 /* Async */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async");
}
- else if (node.parent.kind === 245 /* ModuleBlock */ || node.parent.kind === 284 /* SourceFile */) {
+ else if (node.parent.kind === 246 /* ModuleBlock */ || node.parent.kind === 285 /* SourceFile */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text);
}
else if (flags & 128 /* Abstract */) {
- if (modifier.kind === 113 /* PrivateKeyword */) {
+ if (modifier.kind === 114 /* PrivateKeyword */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract");
}
else {
@@ -59104,7 +59963,7 @@
}
flags |= ts.modifierToFlag(modifier.kind);
break;
- case 116 /* StaticKeyword */:
+ case 117 /* StaticKeyword */:
if (flags & 32 /* Static */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static");
}
@@ -59114,10 +59973,10 @@
else if (flags & 256 /* Async */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async");
}
- else if (node.parent.kind === 245 /* ModuleBlock */ || node.parent.kind === 284 /* SourceFile */) {
+ else if (node.parent.kind === 246 /* ModuleBlock */ || node.parent.kind === 285 /* SourceFile */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static");
}
- else if (node.kind === 151 /* Parameter */) {
+ else if (node.kind === 152 /* Parameter */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static");
}
else if (flags & 128 /* Abstract */) {
@@ -59126,18 +59985,18 @@
flags |= 32 /* Static */;
lastStatic = modifier;
break;
- case 133 /* ReadonlyKeyword */:
+ case 134 /* ReadonlyKeyword */:
if (flags & 64 /* Readonly */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly");
}
- else if (node.kind !== 154 /* PropertyDeclaration */ && node.kind !== 153 /* PropertySignature */ && node.kind !== 162 /* IndexSignature */ && node.kind !== 151 /* Parameter */) {
+ else if (node.kind !== 155 /* PropertyDeclaration */ && node.kind !== 154 /* PropertySignature */ && node.kind !== 163 /* IndexSignature */ && node.kind !== 152 /* Parameter */) {
// If node.kind === SyntaxKind.Parameter, checkParameter report an error if it's not a parameter property.
return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature);
}
flags |= 64 /* Readonly */;
lastReadonly = modifier;
break;
- case 85 /* ExportKeyword */:
+ case 86 /* ExportKeyword */:
if (flags & 1 /* Export */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "export");
}
@@ -59150,52 +60009,52 @@
else if (flags & 256 /* Async */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async");
}
- else if (node.parent.kind === 240 /* ClassDeclaration */) {
+ else if (node.parent.kind === 241 /* ClassDeclaration */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export");
}
- else if (node.kind === 151 /* Parameter */) {
+ else if (node.kind === 152 /* Parameter */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export");
}
flags |= 1 /* Export */;
break;
- case 80 /* DefaultKeyword */:
- var container = node.parent.kind === 284 /* SourceFile */ ? node.parent : node.parent.parent;
- if (container.kind === 244 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) {
+ case 81 /* DefaultKeyword */:
+ var container = node.parent.kind === 285 /* SourceFile */ ? node.parent : node.parent.parent;
+ if (container.kind === 245 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) {
return grammarErrorOnNode(modifier, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module);
}
flags |= 512 /* Default */;
break;
- case 125 /* DeclareKeyword */:
+ case 126 /* DeclareKeyword */:
if (flags & 2 /* Ambient */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare");
}
else if (flags & 256 /* Async */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async");
}
- else if (node.parent.kind === 240 /* ClassDeclaration */) {
+ else if (node.parent.kind === 241 /* ClassDeclaration */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare");
}
- else if (node.kind === 151 /* Parameter */) {
+ else if (node.kind === 152 /* Parameter */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare");
}
- else if ((node.parent.flags & 4194304 /* Ambient */) && node.parent.kind === 245 /* ModuleBlock */) {
+ else if ((node.parent.flags & 4194304 /* Ambient */) && node.parent.kind === 246 /* ModuleBlock */) {
return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context);
}
flags |= 2 /* Ambient */;
lastDeclare = modifier;
break;
- case 118 /* AbstractKeyword */:
+ case 119 /* AbstractKeyword */:
if (flags & 128 /* Abstract */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract");
}
- if (node.kind !== 240 /* ClassDeclaration */) {
- if (node.kind !== 156 /* MethodDeclaration */ &&
- node.kind !== 154 /* PropertyDeclaration */ &&
- node.kind !== 158 /* GetAccessor */ &&
- node.kind !== 159 /* SetAccessor */) {
+ if (node.kind !== 241 /* ClassDeclaration */) {
+ if (node.kind !== 157 /* MethodDeclaration */ &&
+ node.kind !== 155 /* PropertyDeclaration */ &&
+ node.kind !== 159 /* GetAccessor */ &&
+ node.kind !== 160 /* SetAccessor */) {
return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration);
}
- if (!(node.parent.kind === 240 /* ClassDeclaration */ && ts.hasModifier(node.parent, 128 /* Abstract */))) {
+ if (!(node.parent.kind === 241 /* ClassDeclaration */ && ts.hasModifier(node.parent, 128 /* Abstract */))) {
return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class);
}
if (flags & 32 /* Static */) {
@@ -59207,14 +60066,14 @@
}
flags |= 128 /* Abstract */;
break;
- case 121 /* AsyncKeyword */:
+ case 122 /* AsyncKeyword */:
if (flags & 256 /* Async */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async");
}
else if (flags & 2 /* Ambient */ || node.parent.flags & 4194304 /* Ambient */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async");
}
- else if (node.kind === 151 /* Parameter */) {
+ else if (node.kind === 152 /* Parameter */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async");
}
flags |= 256 /* Async */;
@@ -59222,7 +60081,7 @@
break;
}
}
- if (node.kind === 157 /* Constructor */) {
+ if (node.kind === 158 /* Constructor */) {
if (flags & 32 /* Static */) {
return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static");
}
@@ -59237,13 +60096,13 @@
}
return false;
}
- else if ((node.kind === 249 /* ImportDeclaration */ || node.kind === 248 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) {
+ else if ((node.kind === 250 /* ImportDeclaration */ || node.kind === 249 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) {
return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare");
}
- else if (node.kind === 151 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) {
+ else if (node.kind === 152 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) {
return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern);
}
- else if (node.kind === 151 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && node.dotDotDotToken) {
+ else if (node.kind === 152 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && node.dotDotDotToken) {
return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter);
}
if (flags & 256 /* Async */) {
@@ -59264,38 +60123,38 @@
}
function shouldReportBadModifier(node) {
switch (node.kind) {
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 157 /* Constructor */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 162 /* IndexSignature */:
- case 244 /* ModuleDeclaration */:
- case 249 /* ImportDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
- case 255 /* ExportDeclaration */:
- case 254 /* ExportAssignment */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 151 /* Parameter */:
- return false;
- default:
- if (node.parent.kind === 245 /* ModuleBlock */ || node.parent.kind === 284 /* SourceFile */) {
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 158 /* Constructor */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 163 /* IndexSignature */:
+ case 245 /* ModuleDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 256 /* ExportDeclaration */:
+ case 255 /* ExportAssignment */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 152 /* Parameter */:
+ return false;
+ default:
+ if (node.parent.kind === 246 /* ModuleBlock */ || node.parent.kind === 285 /* SourceFile */) {
return false;
}
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- return nodeHasAnyModifiersExcept(node, 121 /* AsyncKeyword */);
- case 240 /* ClassDeclaration */:
- return nodeHasAnyModifiersExcept(node, 118 /* AbstractKeyword */);
- case 241 /* InterfaceDeclaration */:
- case 219 /* VariableStatement */:
- case 242 /* TypeAliasDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ return nodeHasAnyModifiersExcept(node, 122 /* AsyncKeyword */);
+ case 241 /* ClassDeclaration */:
+ return nodeHasAnyModifiersExcept(node, 119 /* AbstractKeyword */);
+ case 242 /* InterfaceDeclaration */:
+ case 220 /* VariableStatement */:
+ case 243 /* TypeAliasDeclaration */:
return true;
- case 243 /* EnumDeclaration */:
- return nodeHasAnyModifiersExcept(node, 77 /* ConstKeyword */);
+ case 244 /* EnumDeclaration */:
+ return nodeHasAnyModifiersExcept(node, 78 /* ConstKeyword */);
default:
ts.Debug.fail();
return false;
@@ -59307,10 +60166,10 @@
}
function checkGrammarAsyncModifier(node, asyncModifier) {
switch (node.kind) {
- case 156 /* MethodDeclaration */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return false;
}
return grammarErrorOnNode(asyncModifier, ts.Diagnostics._0_modifier_cannot_be_used_here, "async");
@@ -59425,10 +60284,10 @@
if (!parameter.type) {
return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation);
}
- if (parameter.type.kind !== 138 /* StringKeyword */ && parameter.type.kind !== 135 /* NumberKeyword */) {
+ if (parameter.type.kind !== 139 /* StringKeyword */ && parameter.type.kind !== 136 /* NumberKeyword */) {
var type = getTypeFromTypeNode(parameter.type);
if (type.flags & 4 /* String */ || type.flags & 8 /* Number */) {
- return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_cannot_be_a_type_alias_Consider_writing_0_Colon_1_Colon_2_instead, ts.getTextOfNode(parameter.name), typeToString(type), typeToString(getTypeFromTypeNode(node.type)));
+ return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_cannot_be_a_type_alias_Consider_writing_0_Colon_1_Colon_2_instead, ts.getTextOfNode(parameter.name), typeToString(type), typeToString(node.type ? getTypeFromTypeNode(node.type) : anyType));
}
if (type.flags & 1048576 /* Union */ && allTypesAssignableToKind(type, 128 /* StringLiteral */, /*strict*/ true)) {
return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_cannot_be_a_union_type_Consider_using_a_mapped_object_type_instead);
@@ -59459,9 +60318,9 @@
}
function checkGrammarForOmittedArgument(args) {
if (args) {
- for (var _i = 0, args_5 = args; _i < args_5.length; _i++) {
- var arg = args_5[_i];
- if (arg.kind === 210 /* OmittedExpression */) {
+ for (var _i = 0, args_4 = args; _i < args_4.length; _i++) {
+ var arg = args_4[_i];
+ if (arg.kind === 211 /* OmittedExpression */) {
return grammarErrorAtPos(arg, arg.pos, 0, ts.Diagnostics.Argument_expression_expected);
}
}
@@ -59491,7 +60350,7 @@
if (!checkGrammarDecoratorsAndModifiers(node) && node.heritageClauses) {
for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) {
var heritageClause = _a[_i];
- if (heritageClause.token === 86 /* ExtendsKeyword */) {
+ if (heritageClause.token === 87 /* ExtendsKeyword */) {
if (seenExtendsClause) {
return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen);
}
@@ -59504,7 +60363,7 @@
seenExtendsClause = true;
}
else {
- ts.Debug.assert(heritageClause.token === 109 /* ImplementsKeyword */);
+ ts.Debug.assert(heritageClause.token === 110 /* ImplementsKeyword */);
if (seenImplementsClause) {
return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.implements_clause_already_seen);
}
@@ -59520,14 +60379,14 @@
if (node.heritageClauses) {
for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) {
var heritageClause = _a[_i];
- if (heritageClause.token === 86 /* ExtendsKeyword */) {
+ if (heritageClause.token === 87 /* ExtendsKeyword */) {
if (seenExtendsClause) {
return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen);
}
seenExtendsClause = true;
}
else {
- ts.Debug.assert(heritageClause.token === 109 /* ImplementsKeyword */);
+ ts.Debug.assert(heritageClause.token === 110 /* ImplementsKeyword */);
return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.Interface_declaration_cannot_have_implements_clause);
}
// Grammar checking heritageClause inside class declaration
@@ -59538,20 +60397,20 @@
}
function checkGrammarComputedPropertyName(node) {
// If node is not a computedPropertyName, just skip the grammar checking
- if (node.kind !== 149 /* ComputedPropertyName */) {
+ if (node.kind !== 150 /* ComputedPropertyName */) {
return false;
}
var computedPropertyName = node;
- if (computedPropertyName.expression.kind === 204 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 27 /* CommaToken */) {
+ if (computedPropertyName.expression.kind === 205 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 27 /* CommaToken */) {
return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name);
}
return false;
}
function checkGrammarForGenerator(node) {
if (node.asteriskToken) {
- ts.Debug.assert(node.kind === 239 /* FunctionDeclaration */ ||
- node.kind === 196 /* FunctionExpression */ ||
- node.kind === 156 /* MethodDeclaration */);
+ ts.Debug.assert(node.kind === 240 /* FunctionDeclaration */ ||
+ node.kind === 197 /* FunctionExpression */ ||
+ node.kind === 157 /* MethodDeclaration */);
if (node.flags & 4194304 /* Ambient */) {
return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context);
}
@@ -59577,15 +60436,22 @@
var seen = ts.createUnderscoreEscapedMap();
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var prop = _a[_i];
- if (prop.kind === 277 /* SpreadAssignment */) {
+ if (prop.kind === 278 /* SpreadAssignment */) {
+ if (inDestructuring) {
+ // a rest property cannot be destructured any further
+ var expression = ts.skipParentheses(prop.expression);
+ if (ts.isArrayLiteralExpression(expression) || ts.isObjectLiteralExpression(expression)) {
+ return grammarErrorOnNode(prop.expression, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern);
+ }
+ }
continue;
}
var name = prop.name;
- if (name.kind === 149 /* ComputedPropertyName */) {
+ if (name.kind === 150 /* ComputedPropertyName */) {
// If the name is not a ComputedPropertyName, the grammar checking will skip it
checkGrammarComputedPropertyName(name);
}
- if (prop.kind === 276 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) {
+ if (prop.kind === 277 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) {
// having objectAssignmentInitializer is only valid in ObjectAssignmentPattern
// outside of destructuring it is a syntax error
return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment);
@@ -59594,7 +60460,7 @@
if (prop.modifiers) {
for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) { // TODO: GH#19955
var mod = _c[_b];
- if (mod.kind !== 121 /* AsyncKeyword */ || prop.kind !== 156 /* MethodDeclaration */) {
+ if (mod.kind !== 122 /* AsyncKeyword */ || prop.kind !== 157 /* MethodDeclaration */) {
grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod));
}
}
@@ -59609,23 +60475,23 @@
// and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields
var currentKind = void 0;
switch (prop.kind) {
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
checkGrammarForInvalidExclamationToken(prop.exclamationToken, ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context);
/* tslint:disable:no-switch-case-fall-through */
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
// Grammar checking for computedPropertyName and shorthandPropertyAssignment
checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional);
if (name.kind === 8 /* NumericLiteral */) {
checkGrammarNumericLiteral(name);
}
// falls through
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
currentKind = 1 /* Property */;
break;
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
currentKind = 2 /* GetAccessor */;
break;
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
currentKind = 4 /* SetAccessor */;
break;
default:
@@ -59662,7 +60528,7 @@
var seen = ts.createUnderscoreEscapedMap();
for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) {
var attr = _a[_i];
- if (attr.kind === 269 /* JsxSpreadAttribute */) {
+ if (attr.kind === 270 /* JsxSpreadAttribute */) {
continue;
}
var name = attr.name, initializer = attr.initializer;
@@ -59672,7 +60538,7 @@
else {
return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name);
}
- if (initializer && initializer.kind === 270 /* JsxExpression */ && !initializer.expression) {
+ if (initializer && initializer.kind === 271 /* JsxExpression */ && !initializer.expression) {
return grammarErrorOnNode(initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression);
}
}
@@ -59681,12 +60547,25 @@
if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) {
return true;
}
- if (forInOrOfStatement.kind === 227 /* ForOfStatement */ && forInOrOfStatement.awaitModifier) {
+ if (forInOrOfStatement.kind === 228 /* ForOfStatement */ && forInOrOfStatement.awaitModifier) {
if ((forInOrOfStatement.flags & 16384 /* AwaitContext */) === 0 /* None */) {
- return grammarErrorOnNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator);
+ // use of 'for-await-of' in non-async function
+ var sourceFile = ts.getSourceFileOfNode(forInOrOfStatement);
+ if (!hasParseDiagnostics(sourceFile)) {
+ var diagnostic = ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator);
+ var func = ts.getContainingFunction(forInOrOfStatement);
+ if (func && func.kind !== 158 /* Constructor */) {
+ ts.Debug.assert((ts.getFunctionFlags(func) & 2 /* Async */) === 0, "Enclosing function should never be an async function.");
+ var relatedInfo = ts.createDiagnosticForNode(func, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async);
+ ts.addRelatedInfo(diagnostic, relatedInfo);
}
+ diagnostics.add(diagnostic);
+ return true;
+ }
+ return false;
}
- if (forInOrOfStatement.initializer.kind === 238 /* VariableDeclarationList */) {
+ }
+ if (forInOrOfStatement.initializer.kind === 239 /* VariableDeclarationList */) {
var variableList = forInOrOfStatement.initializer;
if (!checkGrammarVariableDeclarationList(variableList)) {
var declarations = variableList.declarations;
@@ -59701,20 +60580,20 @@
return false;
}
if (declarations.length > 1) {
- var diagnostic = forInOrOfStatement.kind === 226 /* ForInStatement */
+ var diagnostic = forInOrOfStatement.kind === 227 /* ForInStatement */
? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement
: ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement;
return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic);
}
var firstDeclaration = declarations[0];
if (firstDeclaration.initializer) {
- var diagnostic = forInOrOfStatement.kind === 226 /* ForInStatement */
+ var diagnostic = forInOrOfStatement.kind === 227 /* ForInStatement */
? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer
: ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer;
return grammarErrorOnNode(firstDeclaration.name, diagnostic);
}
if (firstDeclaration.type) {
- var diagnostic = forInOrOfStatement.kind === 226 /* ForInStatement */
+ var diagnostic = forInOrOfStatement.kind === 227 /* ForInStatement */
? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation
: ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation;
return grammarErrorOnNode(firstDeclaration, diagnostic);
@@ -59741,11 +60620,11 @@
return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters);
}
else if (!doesAccessorHaveCorrectParameterCount(accessor)) {
- return grammarErrorOnNode(accessor.name, kind === 158 /* GetAccessor */ ?
+ return grammarErrorOnNode(accessor.name, kind === 159 /* GetAccessor */ ?
ts.Diagnostics.A_get_accessor_cannot_have_parameters :
ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter);
}
- else if (kind === 159 /* SetAccessor */) {
+ else if (kind === 160 /* SetAccessor */) {
if (accessor.type) {
return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation);
}
@@ -59769,23 +60648,23 @@
* A set accessor has one parameter or a `this` parameter and one more parameter.
*/
function doesAccessorHaveCorrectParameterCount(accessor) {
- return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 158 /* GetAccessor */ ? 0 : 1);
+ return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 159 /* GetAccessor */ ? 0 : 1);
}
function getAccessorThisParameter(accessor) {
- if (accessor.parameters.length === (accessor.kind === 158 /* GetAccessor */ ? 1 : 2)) {
+ if (accessor.parameters.length === (accessor.kind === 159 /* GetAccessor */ ? 1 : 2)) {
return ts.getThisParameter(accessor);
}
}
function checkGrammarTypeOperatorNode(node) {
- if (node.operator === 142 /* UniqueKeyword */) {
- if (node.type.kind !== 139 /* SymbolKeyword */) {
- return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(139 /* SymbolKeyword */));
+ if (node.operator === 143 /* UniqueKeyword */) {
+ if (node.type.kind !== 140 /* SymbolKeyword */) {
+ return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(140 /* SymbolKeyword */));
}
var parent = ts.walkUpParenthesizedTypes(node.parent);
switch (parent.kind) {
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
var decl = parent;
- if (decl.name.kind !== 72 /* Identifier */) {
+ if (decl.name.kind !== 73 /* Identifier */) {
return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name);
}
if (!ts.isVariableDeclarationInVariableStatement(decl)) {
@@ -59795,13 +60674,13 @@
return grammarErrorOnNode(parent.name, ts.Diagnostics.A_variable_whose_type_is_a_unique_symbol_type_must_be_const);
}
break;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
if (!ts.hasModifier(parent, 32 /* Static */) ||
!ts.hasModifier(parent, 64 /* Readonly */)) {
return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly);
}
break;
- case 153 /* PropertySignature */:
+ case 154 /* PropertySignature */:
if (!ts.hasModifier(parent, 64 /* Readonly */)) {
return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly);
}
@@ -59810,9 +60689,9 @@
return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_are_not_allowed_here);
}
}
- else if (node.operator === 133 /* ReadonlyKeyword */) {
- if (node.type.kind !== 169 /* ArrayType */ && node.type.kind !== 170 /* TupleType */) {
- return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(139 /* SymbolKeyword */));
+ else if (node.operator === 134 /* ReadonlyKeyword */) {
+ if (node.type.kind !== 170 /* ArrayType */ && node.type.kind !== 171 /* TupleType */) {
+ return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(140 /* SymbolKeyword */));
}
}
}
@@ -59825,10 +60704,10 @@
if (checkGrammarFunctionLikeDeclaration(node)) {
return true;
}
- if (node.kind === 156 /* MethodDeclaration */) {
- if (node.parent.kind === 188 /* ObjectLiteralExpression */) {
+ if (node.kind === 157 /* MethodDeclaration */) {
+ if (node.parent.kind === 189 /* ObjectLiteralExpression */) {
// We only disallow modifier on a method declaration if it is a property of object-literal-expression
- if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 121 /* AsyncKeyword */)) {
+ if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 122 /* AsyncKeyword */)) {
return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here);
}
else if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) {
@@ -59841,6 +60720,9 @@
return grammarErrorAtPos(node, node.end - 1, ";".length, ts.Diagnostics._0_expected, "{");
}
}
+ else if (ts.isClassLike(node.parent) && ts.isStringLiteral(node.name) && node.name.text === "constructor" && (!compilerOptions.target || compilerOptions.target < 1 /* ES5 */)) {
+ return grammarErrorOnNode(node.name, ts.Diagnostics.Quoted_constructors_have_previously_been_interpreted_as_methods_which_is_incorrect_In_TypeScript_3_6_they_will_be_correctly_parsed_as_constructors_In_the_meantime_consider_using_constructor_to_write_a_constructor_or_constructor_to_write_a_method);
+ }
if (checkGrammarForGenerator(node)) {
return true;
}
@@ -59854,14 +60736,14 @@
if (node.flags & 4194304 /* Ambient */) {
return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type);
}
- else if (node.kind === 156 /* MethodDeclaration */ && !node.body) {
+ else if (node.kind === 157 /* MethodDeclaration */ && !node.body) {
return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type);
}
}
- else if (node.parent.kind === 241 /* InterfaceDeclaration */) {
+ else if (node.parent.kind === 242 /* InterfaceDeclaration */) {
return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type);
}
- else if (node.parent.kind === 168 /* TypeLiteral */) {
+ else if (node.parent.kind === 169 /* TypeLiteral */) {
return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type);
}
}
@@ -59872,11 +60754,11 @@
return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary);
}
switch (current.kind) {
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
if (node.label && current.label.escapedText === node.label.escapedText) {
// found matching label - verify that label usage is correct
// continue can only target labels that are on iteration statements
- var isMisplacedContinueLabel = node.kind === 228 /* ContinueStatement */
+ var isMisplacedContinueLabel = node.kind === 229 /* ContinueStatement */
&& !ts.isIterationStatement(current.statement, /*lookInLabeledStatement*/ true);
if (isMisplacedContinueLabel) {
return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement);
@@ -59884,8 +60766,8 @@
return false;
}
break;
- case 232 /* SwitchStatement */:
- if (node.kind === 229 /* BreakStatement */ && !node.label) {
+ case 233 /* SwitchStatement */:
+ if (node.kind === 230 /* BreakStatement */ && !node.label) {
// unlabeled break within switch statement - ok
return false;
}
@@ -59900,13 +60782,13 @@
current = current.parent;
}
if (node.label) {
- var message = node.kind === 229 /* BreakStatement */
+ var message = node.kind === 230 /* BreakStatement */
? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement
: ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement;
return grammarErrorOnNode(node, message);
}
else {
- var message = node.kind === 229 /* BreakStatement */
+ var message = node.kind === 230 /* BreakStatement */
? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement
: ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement;
return grammarErrorOnNode(node, message);
@@ -59930,12 +60812,12 @@
}
function isStringOrNumberLiteralExpression(expr) {
return expr.kind === 10 /* StringLiteral */ || expr.kind === 8 /* NumericLiteral */ ||
- expr.kind === 202 /* PrefixUnaryExpression */ && expr.operator === 39 /* MinusToken */ &&
+ expr.kind === 203 /* PrefixUnaryExpression */ && expr.operator === 39 /* MinusToken */ &&
expr.operand.kind === 8 /* NumericLiteral */;
}
function isBigIntLiteralExpression(expr) {
return expr.kind === 9 /* BigIntLiteral */ ||
- expr.kind === 202 /* PrefixUnaryExpression */ && expr.operator === 39 /* MinusToken */ &&
+ expr.kind === 203 /* PrefixUnaryExpression */ && expr.operator === 39 /* MinusToken */ &&
expr.operand.kind === 9 /* BigIntLiteral */;
}
function isSimpleLiteralEnumReference(expr) {
@@ -59948,7 +60830,7 @@
if (initializer) {
var isInvalidInitializer = !(isStringOrNumberLiteralExpression(initializer) ||
isSimpleLiteralEnumReference(initializer) ||
- initializer.kind === 102 /* TrueKeyword */ || initializer.kind === 87 /* FalseKeyword */ ||
+ initializer.kind === 103 /* TrueKeyword */ || initializer.kind === 88 /* FalseKeyword */ ||
isBigIntLiteralExpression(initializer));
var isConstOrReadonly = ts.isDeclarationReadonly(node) || ts.isVariableDeclaration(node) && ts.isVarConst(node);
if (isConstOrReadonly && !node.type) {
@@ -59965,7 +60847,7 @@
}
}
function checkGrammarVariableDeclaration(node) {
- if (node.parent.parent.kind !== 226 /* ForInStatement */ && node.parent.parent.kind !== 227 /* ForOfStatement */) {
+ if (node.parent.parent.kind !== 227 /* ForInStatement */ && node.parent.parent.kind !== 228 /* ForOfStatement */) {
if (node.flags & 4194304 /* Ambient */) {
checkAmbientInitializer(node);
}
@@ -59978,8 +60860,8 @@
}
}
}
- if (node.exclamationToken && (node.parent.parent.kind !== 219 /* VariableStatement */ || !node.type || node.initializer || node.flags & 4194304 /* Ambient */)) {
- return grammarErrorOnNode(node.exclamationToken, ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context);
+ if (node.exclamationToken && (node.parent.parent.kind !== 220 /* VariableStatement */ || !node.type || node.initializer || node.flags & 4194304 /* Ambient */)) {
+ return grammarErrorOnNode(node.exclamationToken, ts.Diagnostics.Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation);
}
if (compilerOptions.module !== ts.ModuleKind.ES2015 && compilerOptions.module !== ts.ModuleKind.ESNext && compilerOptions.module !== ts.ModuleKind.System && !compilerOptions.noEmit &&
!(node.parent.parent.flags & 4194304 /* Ambient */) && ts.hasModifier(node.parent.parent, 1 /* Export */)) {
@@ -59995,7 +60877,7 @@
return checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name);
}
function checkESModuleMarker(name) {
- if (name.kind === 72 /* Identifier */) {
+ if (name.kind === 73 /* Identifier */) {
if (ts.idText(name) === "__esModule") {
return grammarErrorOnNode(name, ts.Diagnostics.Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules);
}
@@ -60012,8 +60894,8 @@
return false;
}
function checkGrammarNameInLetOrConstDeclarations(name) {
- if (name.kind === 72 /* Identifier */) {
- if (name.originalKeywordKind === 111 /* LetKeyword */) {
+ if (name.kind === 73 /* Identifier */) {
+ if (name.originalKeywordKind === 112 /* LetKeyword */) {
return grammarErrorOnNode(name, ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations);
}
}
@@ -60040,15 +60922,15 @@
}
function allowLetAndConstDeclarations(parent) {
switch (parent.kind) {
- case 222 /* IfStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
- case 231 /* WithStatement */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 223 /* IfStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
+ case 232 /* WithStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
return false;
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return allowLetAndConstDeclarations(parent.parent);
}
return true;
@@ -60066,12 +60948,12 @@
function checkGrammarMetaProperty(node) {
var escapedText = node.name.escapedText;
switch (node.keywordToken) {
- case 95 /* NewKeyword */:
+ case 96 /* NewKeyword */:
if (escapedText !== "target") {
return grammarErrorOnNode(node.name, ts.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.escapedText, ts.tokenToString(node.keywordToken), "target");
}
break;
- case 92 /* ImportKeyword */:
+ case 93 /* ImportKeyword */:
if (escapedText !== "meta") {
return grammarErrorOnNode(node.name, ts.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.escapedText, ts.tokenToString(node.keywordToken), "meta");
}
@@ -60122,11 +61004,14 @@
}
function checkGrammarProperty(node) {
if (ts.isClassLike(node.parent)) {
+ if (ts.isStringLiteral(node.name) && node.name.text === "constructor") {
+ return grammarErrorOnNode(node.name, ts.Diagnostics.Classes_may_not_have_a_field_named_constructor);
+ }
if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) {
return true;
}
}
- else if (node.parent.kind === 241 /* InterfaceDeclaration */) {
+ else if (node.parent.kind === 242 /* InterfaceDeclaration */) {
if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) {
return true;
}
@@ -60134,7 +61019,7 @@
return grammarErrorOnNode(node.initializer, ts.Diagnostics.An_interface_property_cannot_have_an_initializer);
}
}
- else if (node.parent.kind === 168 /* TypeLiteral */) {
+ else if (node.parent.kind === 169 /* TypeLiteral */) {
if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) {
return true;
}
@@ -60163,22 +61048,22 @@
// export_opt AmbientDeclaration
//
// TODO: The spec needs to be amended to reflect this grammar.
- if (node.kind === 241 /* InterfaceDeclaration */ ||
- node.kind === 242 /* TypeAliasDeclaration */ ||
- node.kind === 249 /* ImportDeclaration */ ||
- node.kind === 248 /* ImportEqualsDeclaration */ ||
- node.kind === 255 /* ExportDeclaration */ ||
- node.kind === 254 /* ExportAssignment */ ||
- node.kind === 247 /* NamespaceExportDeclaration */ ||
+ if (node.kind === 242 /* InterfaceDeclaration */ ||
+ node.kind === 243 /* TypeAliasDeclaration */ ||
+ node.kind === 250 /* ImportDeclaration */ ||
+ node.kind === 249 /* ImportEqualsDeclaration */ ||
+ node.kind === 256 /* ExportDeclaration */ ||
+ node.kind === 255 /* ExportAssignment */ ||
+ node.kind === 248 /* NamespaceExportDeclaration */ ||
ts.hasModifier(node, 2 /* Ambient */ | 1 /* Export */ | 512 /* Default */)) {
return false;
}
- return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file);
+ return grammarErrorOnFirstToken(node, ts.Diagnostics.Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier);
}
function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) {
for (var _i = 0, _a = file.statements; _i < _a.length; _i++) {
var decl = _a[_i];
- if (ts.isDeclaration(decl) || decl.kind === 219 /* VariableStatement */) {
+ if (ts.isDeclaration(decl) || decl.kind === 220 /* VariableStatement */) {
if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) {
return true;
}
@@ -60205,7 +61090,7 @@
// to prevent noisiness. So use a bit on the block to indicate if
// this has already been reported, and don't report if it has.
//
- if (node.parent.kind === 218 /* Block */ || node.parent.kind === 245 /* ModuleBlock */ || node.parent.kind === 284 /* SourceFile */) {
+ if (node.parent.kind === 219 /* Block */ || node.parent.kind === 246 /* ModuleBlock */ || node.parent.kind === 285 /* SourceFile */) {
var links_2 = getNodeLinks(node.parent);
// Check if the containing block ever report this error
if (!links_2.hasReportedStatementInAmbientContext) {
@@ -60227,10 +61112,10 @@
if (languageVersion >= 1 /* ES5 */) {
diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0;
}
- else if (ts.isChildOfNodeWithKind(node, 182 /* LiteralType */)) {
+ else if (ts.isChildOfNodeWithKind(node, 183 /* LiteralType */)) {
diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0;
}
- else if (ts.isChildOfNodeWithKind(node, 278 /* EnumMember */)) {
+ else if (ts.isChildOfNodeWithKind(node, 279 /* EnumMember */)) {
diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0;
}
if (diagnosticMessage) {
@@ -60245,7 +61130,7 @@
var literalType = ts.isLiteralTypeNode(node.parent) ||
ts.isPrefixUnaryExpression(node.parent) && ts.isLiteralTypeNode(node.parent.parent);
if (!literalType) {
- if (languageVersion < 7 /* ESNext */) {
+ if (languageVersion < 8 /* ESNext */) {
if (grammarErrorOnNode(node, ts.Diagnostics.BigInt_literals_are_not_available_when_targeting_lower_than_ESNext)) {
return true;
}
@@ -60298,8 +61183,8 @@
/** Like 'isDeclarationName', but returns true for LHS of `import { x as y }` or `export { x as y }`. */
function isDeclarationNameOrImportPropertyName(name) {
switch (name.parent.kind) {
- case 253 /* ImportSpecifier */:
- case 257 /* ExportSpecifier */:
+ case 254 /* ImportSpecifier */:
+ case 258 /* ExportSpecifier */:
return ts.isIdentifier(name);
default:
return ts.isDeclarationName(name);
@@ -60307,14 +61192,14 @@
}
function isSomeImportDeclaration(decl) {
switch (decl.kind) {
- case 250 /* ImportClause */: // For default import
- case 248 /* ImportEqualsDeclaration */:
- case 251 /* NamespaceImport */:
- case 253 /* ImportSpecifier */: // For rename import `x as y`
+ case 251 /* ImportClause */: // For default import
+ case 249 /* ImportEqualsDeclaration */:
+ case 252 /* NamespaceImport */:
+ case 254 /* ImportSpecifier */: // For rename import `x as y`
return true;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
// For regular import, `decl` is an Identifier under the ImportSpecifier.
- return decl.parent.kind === 253 /* ImportSpecifier */;
+ return decl.parent.kind === 254 /* ImportSpecifier */;
default:
return false;
}
@@ -60442,7 +61327,7 @@
return node;
}
function createIdentifier(text, typeArguments) {
- var node = createSynthesizedNode(72 /* Identifier */);
+ var node = createSynthesizedNode(73 /* Identifier */);
node.escapedText = ts.escapeLeadingUnderscores(text);
node.originalKeywordKind = text ? ts.stringToToken(text) : 0 /* Unknown */;
node.autoGenerateFlags = 0 /* None */;
@@ -60523,23 +61408,23 @@
ts.createToken = createToken;
// Reserved words
function createSuper() {
- return createSynthesizedNode(98 /* SuperKeyword */);
+ return createSynthesizedNode(99 /* SuperKeyword */);
}
ts.createSuper = createSuper;
function createThis() {
- return createSynthesizedNode(100 /* ThisKeyword */);
+ return createSynthesizedNode(101 /* ThisKeyword */);
}
ts.createThis = createThis;
function createNull() {
- return createSynthesizedNode(96 /* NullKeyword */);
+ return createSynthesizedNode(97 /* NullKeyword */);
}
ts.createNull = createNull;
function createTrue() {
- return createSynthesizedNode(102 /* TrueKeyword */);
+ return createSynthesizedNode(103 /* TrueKeyword */);
}
ts.createTrue = createTrue;
function createFalse() {
- return createSynthesizedNode(87 /* FalseKeyword */);
+ return createSynthesizedNode(88 /* FalseKeyword */);
}
ts.createFalse = createFalse;
// Modifiers
@@ -60550,44 +61435,44 @@
function createModifiersFromModifierFlags(flags) {
var result = [];
if (flags & 1 /* Export */) {
- result.push(createModifier(85 /* ExportKeyword */));
+ result.push(createModifier(86 /* ExportKeyword */));
}
if (flags & 2 /* Ambient */) {
- result.push(createModifier(125 /* DeclareKeyword */));
+ result.push(createModifier(126 /* DeclareKeyword */));
}
if (flags & 512 /* Default */) {
- result.push(createModifier(80 /* DefaultKeyword */));
+ result.push(createModifier(81 /* DefaultKeyword */));
}
if (flags & 2048 /* Const */) {
- result.push(createModifier(77 /* ConstKeyword */));
+ result.push(createModifier(78 /* ConstKeyword */));
}
if (flags & 4 /* Public */) {
- result.push(createModifier(115 /* PublicKeyword */));
+ result.push(createModifier(116 /* PublicKeyword */));
}
if (flags & 8 /* Private */) {
- result.push(createModifier(113 /* PrivateKeyword */));
+ result.push(createModifier(114 /* PrivateKeyword */));
}
if (flags & 16 /* Protected */) {
- result.push(createModifier(114 /* ProtectedKeyword */));
+ result.push(createModifier(115 /* ProtectedKeyword */));
}
if (flags & 128 /* Abstract */) {
- result.push(createModifier(118 /* AbstractKeyword */));
+ result.push(createModifier(119 /* AbstractKeyword */));
}
if (flags & 32 /* Static */) {
- result.push(createModifier(116 /* StaticKeyword */));
+ result.push(createModifier(117 /* StaticKeyword */));
}
if (flags & 64 /* Readonly */) {
- result.push(createModifier(133 /* ReadonlyKeyword */));
+ result.push(createModifier(134 /* ReadonlyKeyword */));
}
if (flags & 256 /* Async */) {
- result.push(createModifier(121 /* AsyncKeyword */));
+ result.push(createModifier(122 /* AsyncKeyword */));
}
return result;
}
ts.createModifiersFromModifierFlags = createModifiersFromModifierFlags;
// Names
function createQualifiedName(left, right) {
- var node = createSynthesizedNode(148 /* QualifiedName */);
+ var node = createSynthesizedNode(149 /* QualifiedName */);
node.left = left;
node.right = asName(right);
return node;
@@ -60606,7 +61491,7 @@
: expression;
}
function createComputedPropertyName(expression) {
- var node = createSynthesizedNode(149 /* ComputedPropertyName */);
+ var node = createSynthesizedNode(150 /* ComputedPropertyName */);
node.expression = parenthesizeForComputedName(expression);
return node;
}
@@ -60619,7 +61504,7 @@
ts.updateComputedPropertyName = updateComputedPropertyName;
// Signature elements
function createTypeParameterDeclaration(name, constraint, defaultType) {
- var node = createSynthesizedNode(150 /* TypeParameter */);
+ var node = createSynthesizedNode(151 /* TypeParameter */);
node.name = asName(name);
node.constraint = constraint;
node.default = defaultType;
@@ -60635,7 +61520,7 @@
}
ts.updateTypeParameterDeclaration = updateTypeParameterDeclaration;
function createParameter(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer) {
- var node = createSynthesizedNode(151 /* Parameter */);
+ var node = createSynthesizedNode(152 /* Parameter */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.dotDotDotToken = dotDotDotToken;
@@ -60659,7 +61544,7 @@
}
ts.updateParameter = updateParameter;
function createDecorator(expression) {
- var node = createSynthesizedNode(152 /* Decorator */);
+ var node = createSynthesizedNode(153 /* Decorator */);
node.expression = ts.parenthesizeForAccess(expression);
return node;
}
@@ -60672,7 +61557,7 @@
ts.updateDecorator = updateDecorator;
// Type Elements
function createPropertySignature(modifiers, name, questionToken, type, initializer) {
- var node = createSynthesizedNode(153 /* PropertySignature */);
+ var node = createSynthesizedNode(154 /* PropertySignature */);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
node.questionToken = questionToken;
@@ -60692,7 +61577,7 @@
}
ts.updatePropertySignature = updatePropertySignature;
function createProperty(decorators, modifiers, name, questionOrExclamationToken, type, initializer) {
- var node = createSynthesizedNode(154 /* PropertyDeclaration */);
+ var node = createSynthesizedNode(155 /* PropertyDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -60716,7 +61601,7 @@
}
ts.updateProperty = updateProperty;
function createMethodSignature(typeParameters, parameters, type, name, questionToken) {
- var node = createSignatureDeclaration(155 /* MethodSignature */, typeParameters, parameters, type);
+ var node = createSignatureDeclaration(156 /* MethodSignature */, typeParameters, parameters, type);
node.name = asName(name);
node.questionToken = questionToken;
return node;
@@ -60733,7 +61618,7 @@
}
ts.updateMethodSignature = updateMethodSignature;
function createMethod(decorators, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) {
- var node = createSynthesizedNode(156 /* MethodDeclaration */);
+ var node = createSynthesizedNode(157 /* MethodDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.asteriskToken = asteriskToken;
@@ -60761,7 +61646,7 @@
}
ts.updateMethod = updateMethod;
function createConstructor(decorators, modifiers, parameters, body) {
- var node = createSynthesizedNode(157 /* Constructor */);
+ var node = createSynthesizedNode(158 /* Constructor */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.typeParameters = undefined;
@@ -60781,7 +61666,7 @@
}
ts.updateConstructor = updateConstructor;
function createGetAccessor(decorators, modifiers, name, parameters, type, body) {
- var node = createSynthesizedNode(158 /* GetAccessor */);
+ var node = createSynthesizedNode(159 /* GetAccessor */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -60804,7 +61689,7 @@
}
ts.updateGetAccessor = updateGetAccessor;
function createSetAccessor(decorators, modifiers, name, parameters, body) {
- var node = createSynthesizedNode(159 /* SetAccessor */);
+ var node = createSynthesizedNode(160 /* SetAccessor */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -60825,7 +61710,7 @@
}
ts.updateSetAccessor = updateSetAccessor;
function createCallSignature(typeParameters, parameters, type) {
- return createSignatureDeclaration(160 /* CallSignature */, typeParameters, parameters, type);
+ return createSignatureDeclaration(161 /* CallSignature */, typeParameters, parameters, type);
}
ts.createCallSignature = createCallSignature;
function updateCallSignature(node, typeParameters, parameters, type) {
@@ -60833,7 +61718,7 @@
}
ts.updateCallSignature = updateCallSignature;
function createConstructSignature(typeParameters, parameters, type) {
- return createSignatureDeclaration(161 /* ConstructSignature */, typeParameters, parameters, type);
+ return createSignatureDeclaration(162 /* ConstructSignature */, typeParameters, parameters, type);
}
ts.createConstructSignature = createConstructSignature;
function updateConstructSignature(node, typeParameters, parameters, type) {
@@ -60841,7 +61726,7 @@
}
ts.updateConstructSignature = updateConstructSignature;
function createIndexSignature(decorators, modifiers, parameters, type) {
- var node = createSynthesizedNode(162 /* IndexSignature */);
+ var node = createSynthesizedNode(163 /* IndexSignature */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.parameters = createNodeArray(parameters);
@@ -60881,7 +61766,7 @@
}
ts.createKeywordTypeNode = createKeywordTypeNode;
function createTypePredicateNode(parameterName, type) {
- var node = createSynthesizedNode(163 /* TypePredicate */);
+ var node = createSynthesizedNode(164 /* TypePredicate */);
node.parameterName = asName(parameterName);
node.type = type;
return node;
@@ -60895,7 +61780,7 @@
}
ts.updateTypePredicateNode = updateTypePredicateNode;
function createTypeReferenceNode(typeName, typeArguments) {
- var node = createSynthesizedNode(164 /* TypeReference */);
+ var node = createSynthesizedNode(165 /* TypeReference */);
node.typeName = asName(typeName);
node.typeArguments = typeArguments && ts.parenthesizeTypeParameters(typeArguments);
return node;
@@ -60909,7 +61794,7 @@
}
ts.updateTypeReferenceNode = updateTypeReferenceNode;
function createFunctionTypeNode(typeParameters, parameters, type) {
- return createSignatureDeclaration(165 /* FunctionType */, typeParameters, parameters, type);
+ return createSignatureDeclaration(166 /* FunctionType */, typeParameters, parameters, type);
}
ts.createFunctionTypeNode = createFunctionTypeNode;
function updateFunctionTypeNode(node, typeParameters, parameters, type) {
@@ -60917,7 +61802,7 @@
}
ts.updateFunctionTypeNode = updateFunctionTypeNode;
function createConstructorTypeNode(typeParameters, parameters, type) {
- return createSignatureDeclaration(166 /* ConstructorType */, typeParameters, parameters, type);
+ return createSignatureDeclaration(167 /* ConstructorType */, typeParameters, parameters, type);
}
ts.createConstructorTypeNode = createConstructorTypeNode;
function updateConstructorTypeNode(node, typeParameters, parameters, type) {
@@ -60925,7 +61810,7 @@
}
ts.updateConstructorTypeNode = updateConstructorTypeNode;
function createTypeQueryNode(exprName) {
- var node = createSynthesizedNode(167 /* TypeQuery */);
+ var node = createSynthesizedNode(168 /* TypeQuery */);
node.exprName = exprName;
return node;
}
@@ -60937,7 +61822,7 @@
}
ts.updateTypeQueryNode = updateTypeQueryNode;
function createTypeLiteralNode(members) {
- var node = createSynthesizedNode(168 /* TypeLiteral */);
+ var node = createSynthesizedNode(169 /* TypeLiteral */);
node.members = createNodeArray(members);
return node;
}
@@ -60949,7 +61834,7 @@
}
ts.updateTypeLiteralNode = updateTypeLiteralNode;
function createArrayTypeNode(elementType) {
- var node = createSynthesizedNode(169 /* ArrayType */);
+ var node = createSynthesizedNode(170 /* ArrayType */);
node.elementType = ts.parenthesizeArrayTypeMember(elementType);
return node;
}
@@ -60961,7 +61846,7 @@
}
ts.updateArrayTypeNode = updateArrayTypeNode;
function createTupleTypeNode(elementTypes) {
- var node = createSynthesizedNode(170 /* TupleType */);
+ var node = createSynthesizedNode(171 /* TupleType */);
node.elementTypes = createNodeArray(elementTypes);
return node;
}
@@ -60973,7 +61858,7 @@
}
ts.updateTupleTypeNode = updateTupleTypeNode;
function createOptionalTypeNode(type) {
- var node = createSynthesizedNode(171 /* OptionalType */);
+ var node = createSynthesizedNode(172 /* OptionalType */);
node.type = ts.parenthesizeArrayTypeMember(type);
return node;
}
@@ -60985,7 +61870,7 @@
}
ts.updateOptionalTypeNode = updateOptionalTypeNode;
function createRestTypeNode(type) {
- var node = createSynthesizedNode(172 /* RestType */);
+ var node = createSynthesizedNode(173 /* RestType */);
node.type = type;
return node;
}
@@ -60997,7 +61882,7 @@
}
ts.updateRestTypeNode = updateRestTypeNode;
function createUnionTypeNode(types) {
- return createUnionOrIntersectionTypeNode(173 /* UnionType */, types);
+ return createUnionOrIntersectionTypeNode(174 /* UnionType */, types);
}
ts.createUnionTypeNode = createUnionTypeNode;
function updateUnionTypeNode(node, types) {
@@ -61005,7 +61890,7 @@
}
ts.updateUnionTypeNode = updateUnionTypeNode;
function createIntersectionTypeNode(types) {
- return createUnionOrIntersectionTypeNode(174 /* IntersectionType */, types);
+ return createUnionOrIntersectionTypeNode(175 /* IntersectionType */, types);
}
ts.createIntersectionTypeNode = createIntersectionTypeNode;
function updateIntersectionTypeNode(node, types) {
@@ -61024,7 +61909,7 @@
: node;
}
function createConditionalTypeNode(checkType, extendsType, trueType, falseType) {
- var node = createSynthesizedNode(175 /* ConditionalType */);
+ var node = createSynthesizedNode(176 /* ConditionalType */);
node.checkType = ts.parenthesizeConditionalTypeMember(checkType);
node.extendsType = ts.parenthesizeConditionalTypeMember(extendsType);
node.trueType = trueType;
@@ -61042,7 +61927,7 @@
}
ts.updateConditionalTypeNode = updateConditionalTypeNode;
function createInferTypeNode(typeParameter) {
- var node = createSynthesizedNode(176 /* InferType */);
+ var node = createSynthesizedNode(177 /* InferType */);
node.typeParameter = typeParameter;
return node;
}
@@ -61054,10 +61939,10 @@
}
ts.updateInferTypeNode = updateInferTypeNode;
function createImportTypeNode(argument, qualifier, typeArguments, isTypeOf) {
- var node = createSynthesizedNode(183 /* ImportType */);
+ var node = createSynthesizedNode(184 /* ImportType */);
node.argument = argument;
node.qualifier = qualifier;
- node.typeArguments = asNodeArray(typeArguments);
+ node.typeArguments = ts.parenthesizeTypeParameters(typeArguments);
node.isTypeOf = isTypeOf;
return node;
}
@@ -61072,7 +61957,7 @@
}
ts.updateImportTypeNode = updateImportTypeNode;
function createParenthesizedType(type) {
- var node = createSynthesizedNode(177 /* ParenthesizedType */);
+ var node = createSynthesizedNode(178 /* ParenthesizedType */);
node.type = type;
return node;
}
@@ -61084,12 +61969,12 @@
}
ts.updateParenthesizedType = updateParenthesizedType;
function createThisTypeNode() {
- return createSynthesizedNode(178 /* ThisType */);
+ return createSynthesizedNode(179 /* ThisType */);
}
ts.createThisTypeNode = createThisTypeNode;
function createTypeOperatorNode(operatorOrType, type) {
- var node = createSynthesizedNode(179 /* TypeOperator */);
- node.operator = typeof operatorOrType === "number" ? operatorOrType : 129 /* KeyOfKeyword */;
+ var node = createSynthesizedNode(180 /* TypeOperator */);
+ node.operator = typeof operatorOrType === "number" ? operatorOrType : 130 /* KeyOfKeyword */;
node.type = ts.parenthesizeElementTypeMember(typeof operatorOrType === "number" ? type : operatorOrType);
return node;
}
@@ -61099,7 +61984,7 @@
}
ts.updateTypeOperatorNode = updateTypeOperatorNode;
function createIndexedAccessTypeNode(objectType, indexType) {
- var node = createSynthesizedNode(180 /* IndexedAccessType */);
+ var node = createSynthesizedNode(181 /* IndexedAccessType */);
node.objectType = ts.parenthesizeElementTypeMember(objectType);
node.indexType = indexType;
return node;
@@ -61113,7 +61998,7 @@
}
ts.updateIndexedAccessTypeNode = updateIndexedAccessTypeNode;
function createMappedTypeNode(readonlyToken, typeParameter, questionToken, type) {
- var node = createSynthesizedNode(181 /* MappedType */);
+ var node = createSynthesizedNode(182 /* MappedType */);
node.readonlyToken = readonlyToken;
node.typeParameter = typeParameter;
node.questionToken = questionToken;
@@ -61131,7 +62016,7 @@
}
ts.updateMappedTypeNode = updateMappedTypeNode;
function createLiteralTypeNode(literal) {
- var node = createSynthesizedNode(182 /* LiteralType */);
+ var node = createSynthesizedNode(183 /* LiteralType */);
node.literal = literal;
return node;
}
@@ -61144,7 +62029,7 @@
ts.updateLiteralTypeNode = updateLiteralTypeNode;
// Binding Patterns
function createObjectBindingPattern(elements) {
- var node = createSynthesizedNode(184 /* ObjectBindingPattern */);
+ var node = createSynthesizedNode(185 /* ObjectBindingPattern */);
node.elements = createNodeArray(elements);
return node;
}
@@ -61156,7 +62041,7 @@
}
ts.updateObjectBindingPattern = updateObjectBindingPattern;
function createArrayBindingPattern(elements) {
- var node = createSynthesizedNode(185 /* ArrayBindingPattern */);
+ var node = createSynthesizedNode(186 /* ArrayBindingPattern */);
node.elements = createNodeArray(elements);
return node;
}
@@ -61168,7 +62053,7 @@
}
ts.updateArrayBindingPattern = updateArrayBindingPattern;
function createBindingElement(dotDotDotToken, propertyName, name, initializer) {
- var node = createSynthesizedNode(186 /* BindingElement */);
+ var node = createSynthesizedNode(187 /* BindingElement */);
node.dotDotDotToken = dotDotDotToken;
node.propertyName = asName(propertyName);
node.name = asName(name);
@@ -61187,7 +62072,7 @@
ts.updateBindingElement = updateBindingElement;
// Expression
function createArrayLiteral(elements, multiLine) {
- var node = createSynthesizedNode(187 /* ArrayLiteralExpression */);
+ var node = createSynthesizedNode(188 /* ArrayLiteralExpression */);
node.elements = ts.parenthesizeListElements(createNodeArray(elements));
if (multiLine)
node.multiLine = true;
@@ -61201,7 +62086,7 @@
}
ts.updateArrayLiteral = updateArrayLiteral;
function createObjectLiteral(properties, multiLine) {
- var node = createSynthesizedNode(188 /* ObjectLiteralExpression */);
+ var node = createSynthesizedNode(189 /* ObjectLiteralExpression */);
node.properties = createNodeArray(properties);
if (multiLine)
node.multiLine = true;
@@ -61215,9 +62100,9 @@
}
ts.updateObjectLiteral = updateObjectLiteral;
function createPropertyAccess(expression, name) {
- var node = createSynthesizedNode(189 /* PropertyAccessExpression */);
+ var node = createSynthesizedNode(190 /* PropertyAccessExpression */);
node.expression = ts.parenthesizeForAccess(expression);
- node.name = asName(name); // TODO: GH#18217
+ node.name = asName(name);
setEmitFlags(node, 131072 /* NoIndentation */);
return node;
}
@@ -61232,7 +62117,7 @@
}
ts.updatePropertyAccess = updatePropertyAccess;
function createElementAccess(expression, index) {
- var node = createSynthesizedNode(190 /* ElementAccessExpression */);
+ var node = createSynthesizedNode(191 /* ElementAccessExpression */);
node.expression = ts.parenthesizeForAccess(expression);
node.argumentExpression = asExpression(index);
return node;
@@ -61246,7 +62131,7 @@
}
ts.updateElementAccess = updateElementAccess;
function createCall(expression, typeArguments, argumentsArray) {
- var node = createSynthesizedNode(191 /* CallExpression */);
+ var node = createSynthesizedNode(192 /* CallExpression */);
node.expression = ts.parenthesizeForAccess(expression);
node.typeArguments = asNodeArray(typeArguments);
node.arguments = ts.parenthesizeListElements(createNodeArray(argumentsArray));
@@ -61262,7 +62147,7 @@
}
ts.updateCall = updateCall;
function createNew(expression, typeArguments, argumentsArray) {
- var node = createSynthesizedNode(192 /* NewExpression */);
+ var node = createSynthesizedNode(193 /* NewExpression */);
node.expression = ts.parenthesizeForNew(expression);
node.typeArguments = asNodeArray(typeArguments);
node.arguments = argumentsArray ? ts.parenthesizeListElements(createNodeArray(argumentsArray)) : undefined;
@@ -61278,7 +62163,7 @@
}
ts.updateNew = updateNew;
function createTaggedTemplate(tag, typeArgumentsOrTemplate, template) {
- var node = createSynthesizedNode(193 /* TaggedTemplateExpression */);
+ var node = createSynthesizedNode(194 /* TaggedTemplateExpression */);
node.tag = ts.parenthesizeForAccess(tag);
if (template) {
node.typeArguments = asNodeArray(typeArgumentsOrTemplate);
@@ -61301,7 +62186,7 @@
}
ts.updateTaggedTemplate = updateTaggedTemplate;
function createTypeAssertion(type, expression) {
- var node = createSynthesizedNode(194 /* TypeAssertionExpression */);
+ var node = createSynthesizedNode(195 /* TypeAssertionExpression */);
node.type = type;
node.expression = ts.parenthesizePrefixOperand(expression);
return node;
@@ -61315,7 +62200,7 @@
}
ts.updateTypeAssertion = updateTypeAssertion;
function createParen(expression) {
- var node = createSynthesizedNode(195 /* ParenthesizedExpression */);
+ var node = createSynthesizedNode(196 /* ParenthesizedExpression */);
node.expression = expression;
return node;
}
@@ -61327,7 +62212,7 @@
}
ts.updateParen = updateParen;
function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body) {
- var node = createSynthesizedNode(196 /* FunctionExpression */);
+ var node = createSynthesizedNode(197 /* FunctionExpression */);
node.modifiers = asNodeArray(modifiers);
node.asteriskToken = asteriskToken;
node.name = asName(name);
@@ -61351,7 +62236,7 @@
}
ts.updateFunctionExpression = updateFunctionExpression;
function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) {
- var node = createSynthesizedNode(197 /* ArrowFunction */);
+ var node = createSynthesizedNode(198 /* ArrowFunction */);
node.modifiers = asNodeArray(modifiers);
node.typeParameters = asNodeArray(typeParameters);
node.parameters = createNodeArray(parameters);
@@ -61373,7 +62258,7 @@
}
ts.updateArrowFunction = updateArrowFunction;
function createDelete(expression) {
- var node = createSynthesizedNode(198 /* DeleteExpression */);
+ var node = createSynthesizedNode(199 /* DeleteExpression */);
node.expression = ts.parenthesizePrefixOperand(expression);
return node;
}
@@ -61385,7 +62270,7 @@
}
ts.updateDelete = updateDelete;
function createTypeOf(expression) {
- var node = createSynthesizedNode(199 /* TypeOfExpression */);
+ var node = createSynthesizedNode(200 /* TypeOfExpression */);
node.expression = ts.parenthesizePrefixOperand(expression);
return node;
}
@@ -61397,7 +62282,7 @@
}
ts.updateTypeOf = updateTypeOf;
function createVoid(expression) {
- var node = createSynthesizedNode(200 /* VoidExpression */);
+ var node = createSynthesizedNode(201 /* VoidExpression */);
node.expression = ts.parenthesizePrefixOperand(expression);
return node;
}
@@ -61409,7 +62294,7 @@
}
ts.updateVoid = updateVoid;
function createAwait(expression) {
- var node = createSynthesizedNode(201 /* AwaitExpression */);
+ var node = createSynthesizedNode(202 /* AwaitExpression */);
node.expression = ts.parenthesizePrefixOperand(expression);
return node;
}
@@ -61421,7 +62306,7 @@
}
ts.updateAwait = updateAwait;
function createPrefix(operator, operand) {
- var node = createSynthesizedNode(202 /* PrefixUnaryExpression */);
+ var node = createSynthesizedNode(203 /* PrefixUnaryExpression */);
node.operator = operator;
node.operand = ts.parenthesizePrefixOperand(operand);
return node;
@@ -61434,7 +62319,7 @@
}
ts.updatePrefix = updatePrefix;
function createPostfix(operand, operator) {
- var node = createSynthesizedNode(203 /* PostfixUnaryExpression */);
+ var node = createSynthesizedNode(204 /* PostfixUnaryExpression */);
node.operand = ts.parenthesizePostfixOperand(operand);
node.operator = operator;
return node;
@@ -61447,7 +62332,7 @@
}
ts.updatePostfix = updatePostfix;
function createBinary(left, operator, right) {
- var node = createSynthesizedNode(204 /* BinaryExpression */);
+ var node = createSynthesizedNode(205 /* BinaryExpression */);
var operatorToken = asToken(operator);
var operatorKind = operatorToken.kind;
node.left = ts.parenthesizeBinaryOperand(operatorKind, left, /*isLeftSideOfBinary*/ true, /*leftOperand*/ undefined);
@@ -61464,7 +62349,7 @@
}
ts.updateBinary = updateBinary;
function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonToken, whenFalse) {
- var node = createSynthesizedNode(205 /* ConditionalExpression */);
+ var node = createSynthesizedNode(206 /* ConditionalExpression */);
node.condition = ts.parenthesizeForConditionalHead(condition);
node.questionToken = whenFalse ? questionTokenOrWhenTrue : createToken(56 /* QuestionToken */);
node.whenTrue = ts.parenthesizeSubexpressionOfConditionalExpression(whenFalse ? whenTrueOrWhenFalse : questionTokenOrWhenTrue);
@@ -61484,7 +62369,7 @@
}
ts.updateConditional = updateConditional;
function createTemplateExpression(head, templateSpans) {
- var node = createSynthesizedNode(206 /* TemplateExpression */);
+ var node = createSynthesizedNode(207 /* TemplateExpression */);
node.head = head;
node.templateSpans = createNodeArray(templateSpans);
return node;
@@ -61522,7 +62407,7 @@
}
ts.createNoSubstitutionTemplateLiteral = createNoSubstitutionTemplateLiteral;
function createYield(asteriskTokenOrExpression, expression) {
- var node = createSynthesizedNode(207 /* YieldExpression */);
+ var node = createSynthesizedNode(208 /* YieldExpression */);
node.asteriskToken = asteriskTokenOrExpression && asteriskTokenOrExpression.kind === 40 /* AsteriskToken */ ? asteriskTokenOrExpression : undefined;
node.expression = asteriskTokenOrExpression && asteriskTokenOrExpression.kind !== 40 /* AsteriskToken */ ? asteriskTokenOrExpression : expression;
return node;
@@ -61536,7 +62421,7 @@
}
ts.updateYield = updateYield;
function createSpread(expression) {
- var node = createSynthesizedNode(208 /* SpreadElement */);
+ var node = createSynthesizedNode(209 /* SpreadElement */);
node.expression = ts.parenthesizeExpressionForList(expression);
return node;
}
@@ -61548,7 +62433,7 @@
}
ts.updateSpread = updateSpread;
function createClassExpression(modifiers, name, typeParameters, heritageClauses, members) {
- var node = createSynthesizedNode(209 /* ClassExpression */);
+ var node = createSynthesizedNode(210 /* ClassExpression */);
node.decorators = undefined;
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -61569,11 +62454,11 @@
}
ts.updateClassExpression = updateClassExpression;
function createOmittedExpression() {
- return createSynthesizedNode(210 /* OmittedExpression */);
+ return createSynthesizedNode(211 /* OmittedExpression */);
}
ts.createOmittedExpression = createOmittedExpression;
function createExpressionWithTypeArguments(typeArguments, expression) {
- var node = createSynthesizedNode(211 /* ExpressionWithTypeArguments */);
+ var node = createSynthesizedNode(212 /* ExpressionWithTypeArguments */);
node.expression = ts.parenthesizeForAccess(expression);
node.typeArguments = asNodeArray(typeArguments);
return node;
@@ -61587,7 +62472,7 @@
}
ts.updateExpressionWithTypeArguments = updateExpressionWithTypeArguments;
function createAsExpression(expression, type) {
- var node = createSynthesizedNode(212 /* AsExpression */);
+ var node = createSynthesizedNode(213 /* AsExpression */);
node.expression = expression;
node.type = type;
return node;
@@ -61601,7 +62486,7 @@
}
ts.updateAsExpression = updateAsExpression;
function createNonNullExpression(expression) {
- var node = createSynthesizedNode(213 /* NonNullExpression */);
+ var node = createSynthesizedNode(214 /* NonNullExpression */);
node.expression = ts.parenthesizeForAccess(expression);
return node;
}
@@ -61613,7 +62498,7 @@
}
ts.updateNonNullExpression = updateNonNullExpression;
function createMetaProperty(keywordToken, name) {
- var node = createSynthesizedNode(214 /* MetaProperty */);
+ var node = createSynthesizedNode(215 /* MetaProperty */);
node.keywordToken = keywordToken;
node.name = name;
return node;
@@ -61627,7 +62512,7 @@
ts.updateMetaProperty = updateMetaProperty;
// Misc
function createTemplateSpan(expression, literal) {
- var node = createSynthesizedNode(216 /* TemplateSpan */);
+ var node = createSynthesizedNode(217 /* TemplateSpan */);
node.expression = expression;
node.literal = literal;
return node;
@@ -61641,12 +62526,12 @@
}
ts.updateTemplateSpan = updateTemplateSpan;
function createSemicolonClassElement() {
- return createSynthesizedNode(217 /* SemicolonClassElement */);
+ return createSynthesizedNode(218 /* SemicolonClassElement */);
}
ts.createSemicolonClassElement = createSemicolonClassElement;
// Element
function createBlock(statements, multiLine) {
- var block = createSynthesizedNode(218 /* Block */);
+ var block = createSynthesizedNode(219 /* Block */);
block.statements = createNodeArray(statements);
if (multiLine)
block.multiLine = multiLine;
@@ -61660,7 +62545,7 @@
}
ts.updateBlock = updateBlock;
function createVariableStatement(modifiers, declarationList) {
- var node = createSynthesizedNode(219 /* VariableStatement */);
+ var node = createSynthesizedNode(220 /* VariableStatement */);
node.decorators = undefined;
node.modifiers = asNodeArray(modifiers);
node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList;
@@ -61675,11 +62560,11 @@
}
ts.updateVariableStatement = updateVariableStatement;
function createEmptyStatement() {
- return createSynthesizedNode(220 /* EmptyStatement */);
+ return createSynthesizedNode(221 /* EmptyStatement */);
}
ts.createEmptyStatement = createEmptyStatement;
function createExpressionStatement(expression) {
- var node = createSynthesizedNode(221 /* ExpressionStatement */);
+ var node = createSynthesizedNode(222 /* ExpressionStatement */);
node.expression = ts.parenthesizeExpressionForExpressionStatement(expression);
return node;
}
@@ -61695,7 +62580,7 @@
/** @deprecated Use `updateExpressionStatement` instead. */
ts.updateStatement = updateExpressionStatement;
function createIf(expression, thenStatement, elseStatement) {
- var node = createSynthesizedNode(222 /* IfStatement */);
+ var node = createSynthesizedNode(223 /* IfStatement */);
node.expression = expression;
node.thenStatement = thenStatement;
node.elseStatement = elseStatement;
@@ -61711,7 +62596,7 @@
}
ts.updateIf = updateIf;
function createDo(statement, expression) {
- var node = createSynthesizedNode(223 /* DoStatement */);
+ var node = createSynthesizedNode(224 /* DoStatement */);
node.statement = statement;
node.expression = expression;
return node;
@@ -61725,7 +62610,7 @@
}
ts.updateDo = updateDo;
function createWhile(expression, statement) {
- var node = createSynthesizedNode(224 /* WhileStatement */);
+ var node = createSynthesizedNode(225 /* WhileStatement */);
node.expression = expression;
node.statement = statement;
return node;
@@ -61739,7 +62624,7 @@
}
ts.updateWhile = updateWhile;
function createFor(initializer, condition, incrementor, statement) {
- var node = createSynthesizedNode(225 /* ForStatement */);
+ var node = createSynthesizedNode(226 /* ForStatement */);
node.initializer = initializer;
node.condition = condition;
node.incrementor = incrementor;
@@ -61757,7 +62642,7 @@
}
ts.updateFor = updateFor;
function createForIn(initializer, expression, statement) {
- var node = createSynthesizedNode(226 /* ForInStatement */);
+ var node = createSynthesizedNode(227 /* ForInStatement */);
node.initializer = initializer;
node.expression = expression;
node.statement = statement;
@@ -61773,7 +62658,7 @@
}
ts.updateForIn = updateForIn;
function createForOf(awaitModifier, initializer, expression, statement) {
- var node = createSynthesizedNode(227 /* ForOfStatement */);
+ var node = createSynthesizedNode(228 /* ForOfStatement */);
node.awaitModifier = awaitModifier;
node.initializer = initializer;
node.expression = expression;
@@ -61791,7 +62676,7 @@
}
ts.updateForOf = updateForOf;
function createContinue(label) {
- var node = createSynthesizedNode(228 /* ContinueStatement */);
+ var node = createSynthesizedNode(229 /* ContinueStatement */);
node.label = asName(label);
return node;
}
@@ -61803,7 +62688,7 @@
}
ts.updateContinue = updateContinue;
function createBreak(label) {
- var node = createSynthesizedNode(229 /* BreakStatement */);
+ var node = createSynthesizedNode(230 /* BreakStatement */);
node.label = asName(label);
return node;
}
@@ -61815,7 +62700,7 @@
}
ts.updateBreak = updateBreak;
function createReturn(expression) {
- var node = createSynthesizedNode(230 /* ReturnStatement */);
+ var node = createSynthesizedNode(231 /* ReturnStatement */);
node.expression = expression;
return node;
}
@@ -61827,7 +62712,7 @@
}
ts.updateReturn = updateReturn;
function createWith(expression, statement) {
- var node = createSynthesizedNode(231 /* WithStatement */);
+ var node = createSynthesizedNode(232 /* WithStatement */);
node.expression = expression;
node.statement = statement;
return node;
@@ -61841,7 +62726,7 @@
}
ts.updateWith = updateWith;
function createSwitch(expression, caseBlock) {
- var node = createSynthesizedNode(232 /* SwitchStatement */);
+ var node = createSynthesizedNode(233 /* SwitchStatement */);
node.expression = ts.parenthesizeExpressionForList(expression);
node.caseBlock = caseBlock;
return node;
@@ -61855,7 +62740,7 @@
}
ts.updateSwitch = updateSwitch;
function createLabel(label, statement) {
- var node = createSynthesizedNode(233 /* LabeledStatement */);
+ var node = createSynthesizedNode(234 /* LabeledStatement */);
node.label = asName(label);
node.statement = statement;
return node;
@@ -61869,7 +62754,7 @@
}
ts.updateLabel = updateLabel;
function createThrow(expression) {
- var node = createSynthesizedNode(234 /* ThrowStatement */);
+ var node = createSynthesizedNode(235 /* ThrowStatement */);
node.expression = expression;
return node;
}
@@ -61881,7 +62766,7 @@
}
ts.updateThrow = updateThrow;
function createTry(tryBlock, catchClause, finallyBlock) {
- var node = createSynthesizedNode(235 /* TryStatement */);
+ var node = createSynthesizedNode(236 /* TryStatement */);
node.tryBlock = tryBlock;
node.catchClause = catchClause;
node.finallyBlock = finallyBlock;
@@ -61897,11 +62782,11 @@
}
ts.updateTry = updateTry;
function createDebuggerStatement() {
- return createSynthesizedNode(236 /* DebuggerStatement */);
+ return createSynthesizedNode(237 /* DebuggerStatement */);
}
ts.createDebuggerStatement = createDebuggerStatement;
function createVariableDeclaration(name, type, initializer) {
- var node = createSynthesizedNode(237 /* VariableDeclaration */);
+ var node = createSynthesizedNode(238 /* VariableDeclaration */);
node.name = asName(name);
node.type = type;
node.initializer = initializer !== undefined ? ts.parenthesizeExpressionForList(initializer) : undefined;
@@ -61918,7 +62803,7 @@
ts.updateVariableDeclaration = updateVariableDeclaration;
function createVariableDeclarationList(declarations, flags) {
if (flags === void 0) { flags = 0 /* None */; }
- var node = createSynthesizedNode(238 /* VariableDeclarationList */);
+ var node = createSynthesizedNode(239 /* VariableDeclarationList */);
node.flags |= flags & 3 /* BlockScoped */;
node.declarations = createNodeArray(declarations);
return node;
@@ -61931,7 +62816,7 @@
}
ts.updateVariableDeclarationList = updateVariableDeclarationList;
function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body) {
- var node = createSynthesizedNode(239 /* FunctionDeclaration */);
+ var node = createSynthesizedNode(240 /* FunctionDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.asteriskToken = asteriskToken;
@@ -61957,7 +62842,7 @@
}
ts.updateFunctionDeclaration = updateFunctionDeclaration;
function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members) {
- var node = createSynthesizedNode(240 /* ClassDeclaration */);
+ var node = createSynthesizedNode(241 /* ClassDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -61979,7 +62864,7 @@
}
ts.updateClassDeclaration = updateClassDeclaration;
function createInterfaceDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members) {
- var node = createSynthesizedNode(241 /* InterfaceDeclaration */);
+ var node = createSynthesizedNode(242 /* InterfaceDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -62001,7 +62886,7 @@
}
ts.updateInterfaceDeclaration = updateInterfaceDeclaration;
function createTypeAliasDeclaration(decorators, modifiers, name, typeParameters, type) {
- var node = createSynthesizedNode(242 /* TypeAliasDeclaration */);
+ var node = createSynthesizedNode(243 /* TypeAliasDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -62021,7 +62906,7 @@
}
ts.updateTypeAliasDeclaration = updateTypeAliasDeclaration;
function createEnumDeclaration(decorators, modifiers, name, members) {
- var node = createSynthesizedNode(243 /* EnumDeclaration */);
+ var node = createSynthesizedNode(244 /* EnumDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -62040,7 +62925,7 @@
ts.updateEnumDeclaration = updateEnumDeclaration;
function createModuleDeclaration(decorators, modifiers, name, body, flags) {
if (flags === void 0) { flags = 0 /* None */; }
- var node = createSynthesizedNode(244 /* ModuleDeclaration */);
+ var node = createSynthesizedNode(245 /* ModuleDeclaration */);
node.flags |= flags & (16 /* Namespace */ | 4 /* NestedNamespace */ | 512 /* GlobalAugmentation */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
@@ -62059,7 +62944,7 @@
}
ts.updateModuleDeclaration = updateModuleDeclaration;
function createModuleBlock(statements) {
- var node = createSynthesizedNode(245 /* ModuleBlock */);
+ var node = createSynthesizedNode(246 /* ModuleBlock */);
node.statements = createNodeArray(statements);
return node;
}
@@ -62071,7 +62956,7 @@
}
ts.updateModuleBlock = updateModuleBlock;
function createCaseBlock(clauses) {
- var node = createSynthesizedNode(246 /* CaseBlock */);
+ var node = createSynthesizedNode(247 /* CaseBlock */);
node.clauses = createNodeArray(clauses);
return node;
}
@@ -62083,7 +62968,7 @@
}
ts.updateCaseBlock = updateCaseBlock;
function createNamespaceExportDeclaration(name) {
- var node = createSynthesizedNode(247 /* NamespaceExportDeclaration */);
+ var node = createSynthesizedNode(248 /* NamespaceExportDeclaration */);
node.name = asName(name);
return node;
}
@@ -62095,7 +62980,7 @@
}
ts.updateNamespaceExportDeclaration = updateNamespaceExportDeclaration;
function createImportEqualsDeclaration(decorators, modifiers, name, moduleReference) {
- var node = createSynthesizedNode(248 /* ImportEqualsDeclaration */);
+ var node = createSynthesizedNode(249 /* ImportEqualsDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -62113,7 +62998,7 @@
}
ts.updateImportEqualsDeclaration = updateImportEqualsDeclaration;
function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier) {
- var node = createSynthesizedNode(249 /* ImportDeclaration */);
+ var node = createSynthesizedNode(250 /* ImportDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.importClause = importClause;
@@ -62131,7 +63016,7 @@
}
ts.updateImportDeclaration = updateImportDeclaration;
function createImportClause(name, namedBindings) {
- var node = createSynthesizedNode(250 /* ImportClause */);
+ var node = createSynthesizedNode(251 /* ImportClause */);
node.name = name;
node.namedBindings = namedBindings;
return node;
@@ -62145,7 +63030,7 @@
}
ts.updateImportClause = updateImportClause;
function createNamespaceImport(name) {
- var node = createSynthesizedNode(251 /* NamespaceImport */);
+ var node = createSynthesizedNode(252 /* NamespaceImport */);
node.name = name;
return node;
}
@@ -62157,7 +63042,7 @@
}
ts.updateNamespaceImport = updateNamespaceImport;
function createNamedImports(elements) {
- var node = createSynthesizedNode(252 /* NamedImports */);
+ var node = createSynthesizedNode(253 /* NamedImports */);
node.elements = createNodeArray(elements);
return node;
}
@@ -62169,7 +63054,7 @@
}
ts.updateNamedImports = updateNamedImports;
function createImportSpecifier(propertyName, name) {
- var node = createSynthesizedNode(253 /* ImportSpecifier */);
+ var node = createSynthesizedNode(254 /* ImportSpecifier */);
node.propertyName = propertyName;
node.name = name;
return node;
@@ -62183,11 +63068,11 @@
}
ts.updateImportSpecifier = updateImportSpecifier;
function createExportAssignment(decorators, modifiers, isExportEquals, expression) {
- var node = createSynthesizedNode(254 /* ExportAssignment */);
+ var node = createSynthesizedNode(255 /* ExportAssignment */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.isExportEquals = isExportEquals;
- node.expression = isExportEquals ? ts.parenthesizeBinaryOperand(59 /* EqualsToken */, expression, /*isLeftSideOfBinary*/ false, /*leftOperand*/ undefined) : ts.parenthesizeDefaultExpression(expression);
+ node.expression = isExportEquals ? ts.parenthesizeBinaryOperand(60 /* EqualsToken */, expression, /*isLeftSideOfBinary*/ false, /*leftOperand*/ undefined) : ts.parenthesizeDefaultExpression(expression);
return node;
}
ts.createExportAssignment = createExportAssignment;
@@ -62200,7 +63085,7 @@
}
ts.updateExportAssignment = updateExportAssignment;
function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier) {
- var node = createSynthesizedNode(255 /* ExportDeclaration */);
+ var node = createSynthesizedNode(256 /* ExportDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.exportClause = exportClause;
@@ -62218,7 +63103,7 @@
}
ts.updateExportDeclaration = updateExportDeclaration;
function createNamedExports(elements) {
- var node = createSynthesizedNode(256 /* NamedExports */);
+ var node = createSynthesizedNode(257 /* NamedExports */);
node.elements = createNodeArray(elements);
return node;
}
@@ -62230,7 +63115,7 @@
}
ts.updateNamedExports = updateNamedExports;
function createExportSpecifier(propertyName, name) {
- var node = createSynthesizedNode(257 /* ExportSpecifier */);
+ var node = createSynthesizedNode(258 /* ExportSpecifier */);
node.propertyName = asName(propertyName);
node.name = asName(name);
return node;
@@ -62245,7 +63130,7 @@
ts.updateExportSpecifier = updateExportSpecifier;
// Module references
function createExternalModuleReference(expression) {
- var node = createSynthesizedNode(259 /* ExternalModuleReference */);
+ var node = createSynthesizedNode(260 /* ExternalModuleReference */);
node.expression = expression;
return node;
}
@@ -62259,14 +63144,14 @@
// JSDoc
/* @internal */
function createJSDocTypeExpression(type) {
- var node = createSynthesizedNode(288 /* JSDocTypeExpression */);
+ var node = createSynthesizedNode(289 /* JSDocTypeExpression */);
node.type = type;
return node;
}
ts.createJSDocTypeExpression = createJSDocTypeExpression;
/* @internal */
function createJSDocTypeTag(typeExpression, comment) {
- var tag = createJSDocTag(307 /* JSDocTypeTag */, "type");
+ var tag = createJSDocTag(308 /* JSDocTypeTag */, "type");
tag.typeExpression = typeExpression;
tag.comment = comment;
return tag;
@@ -62274,7 +63159,7 @@
ts.createJSDocTypeTag = createJSDocTypeTag;
/* @internal */
function createJSDocReturnTag(typeExpression, comment) {
- var tag = createJSDocTag(305 /* JSDocReturnTag */, "returns");
+ var tag = createJSDocTag(306 /* JSDocReturnTag */, "returns");
tag.typeExpression = typeExpression;
tag.comment = comment;
return tag;
@@ -62282,7 +63167,7 @@
ts.createJSDocReturnTag = createJSDocReturnTag;
/* @internal */
function createJSDocParamTag(name, isBracketed, typeExpression, comment) {
- var tag = createJSDocTag(304 /* JSDocParameterTag */, "param");
+ var tag = createJSDocTag(305 /* JSDocParameterTag */, "param");
tag.typeExpression = typeExpression;
tag.name = name;
tag.isBracketed = isBracketed;
@@ -62292,7 +63177,7 @@
ts.createJSDocParamTag = createJSDocParamTag;
/* @internal */
function createJSDocComment(comment, tags) {
- var node = createSynthesizedNode(296 /* JSDocComment */);
+ var node = createSynthesizedNode(297 /* JSDocComment */);
node.comment = comment;
node.tags = tags;
return node;
@@ -62306,7 +63191,7 @@
}
// JSX
function createJsxElement(openingElement, children, closingElement) {
- var node = createSynthesizedNode(260 /* JsxElement */);
+ var node = createSynthesizedNode(261 /* JsxElement */);
node.openingElement = openingElement;
node.children = createNodeArray(children);
node.closingElement = closingElement;
@@ -62322,7 +63207,7 @@
}
ts.updateJsxElement = updateJsxElement;
function createJsxSelfClosingElement(tagName, typeArguments, attributes) {
- var node = createSynthesizedNode(261 /* JsxSelfClosingElement */);
+ var node = createSynthesizedNode(262 /* JsxSelfClosingElement */);
node.tagName = tagName;
node.typeArguments = asNodeArray(typeArguments);
node.attributes = attributes;
@@ -62338,7 +63223,7 @@
}
ts.updateJsxSelfClosingElement = updateJsxSelfClosingElement;
function createJsxOpeningElement(tagName, typeArguments, attributes) {
- var node = createSynthesizedNode(262 /* JsxOpeningElement */);
+ var node = createSynthesizedNode(263 /* JsxOpeningElement */);
node.tagName = tagName;
node.typeArguments = asNodeArray(typeArguments);
node.attributes = attributes;
@@ -62354,7 +63239,7 @@
}
ts.updateJsxOpeningElement = updateJsxOpeningElement;
function createJsxClosingElement(tagName) {
- var node = createSynthesizedNode(263 /* JsxClosingElement */);
+ var node = createSynthesizedNode(264 /* JsxClosingElement */);
node.tagName = tagName;
return node;
}
@@ -62366,7 +63251,7 @@
}
ts.updateJsxClosingElement = updateJsxClosingElement;
function createJsxFragment(openingFragment, children, closingFragment) {
- var node = createSynthesizedNode(264 /* JsxFragment */);
+ var node = createSynthesizedNode(265 /* JsxFragment */);
node.openingFragment = openingFragment;
node.children = createNodeArray(children);
node.closingFragment = closingFragment;
@@ -62388,11 +63273,11 @@
}
ts.updateJsxText = updateJsxText;
function createJsxOpeningFragment() {
- return createSynthesizedNode(265 /* JsxOpeningFragment */);
+ return createSynthesizedNode(266 /* JsxOpeningFragment */);
}
ts.createJsxOpeningFragment = createJsxOpeningFragment;
function createJsxJsxClosingFragment() {
- return createSynthesizedNode(266 /* JsxClosingFragment */);
+ return createSynthesizedNode(267 /* JsxClosingFragment */);
}
ts.createJsxJsxClosingFragment = createJsxJsxClosingFragment;
function updateJsxFragment(node, openingFragment, children, closingFragment) {
@@ -62404,7 +63289,7 @@
}
ts.updateJsxFragment = updateJsxFragment;
function createJsxAttribute(name, initializer) {
- var node = createSynthesizedNode(267 /* JsxAttribute */);
+ var node = createSynthesizedNode(268 /* JsxAttribute */);
node.name = name;
node.initializer = initializer;
return node;
@@ -62418,7 +63303,7 @@
}
ts.updateJsxAttribute = updateJsxAttribute;
function createJsxAttributes(properties) {
- var node = createSynthesizedNode(268 /* JsxAttributes */);
+ var node = createSynthesizedNode(269 /* JsxAttributes */);
node.properties = createNodeArray(properties);
return node;
}
@@ -62430,7 +63315,7 @@
}
ts.updateJsxAttributes = updateJsxAttributes;
function createJsxSpreadAttribute(expression) {
- var node = createSynthesizedNode(269 /* JsxSpreadAttribute */);
+ var node = createSynthesizedNode(270 /* JsxSpreadAttribute */);
node.expression = expression;
return node;
}
@@ -62442,7 +63327,7 @@
}
ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute;
function createJsxExpression(dotDotDotToken, expression) {
- var node = createSynthesizedNode(270 /* JsxExpression */);
+ var node = createSynthesizedNode(271 /* JsxExpression */);
node.dotDotDotToken = dotDotDotToken;
node.expression = expression;
return node;
@@ -62456,7 +63341,7 @@
ts.updateJsxExpression = updateJsxExpression;
// Clauses
function createCaseClause(expression, statements) {
- var node = createSynthesizedNode(271 /* CaseClause */);
+ var node = createSynthesizedNode(272 /* CaseClause */);
node.expression = ts.parenthesizeExpressionForList(expression);
node.statements = createNodeArray(statements);
return node;
@@ -62470,7 +63355,7 @@
}
ts.updateCaseClause = updateCaseClause;
function createDefaultClause(statements) {
- var node = createSynthesizedNode(272 /* DefaultClause */);
+ var node = createSynthesizedNode(273 /* DefaultClause */);
node.statements = createNodeArray(statements);
return node;
}
@@ -62482,7 +63367,7 @@
}
ts.updateDefaultClause = updateDefaultClause;
function createHeritageClause(token, types) {
- var node = createSynthesizedNode(273 /* HeritageClause */);
+ var node = createSynthesizedNode(274 /* HeritageClause */);
node.token = token;
node.types = createNodeArray(types);
return node;
@@ -62495,7 +63380,7 @@
}
ts.updateHeritageClause = updateHeritageClause;
function createCatchClause(variableDeclaration, block) {
- var node = createSynthesizedNode(274 /* CatchClause */);
+ var node = createSynthesizedNode(275 /* CatchClause */);
node.variableDeclaration = ts.isString(variableDeclaration) ? createVariableDeclaration(variableDeclaration) : variableDeclaration;
node.block = block;
return node;
@@ -62510,7 +63395,7 @@
ts.updateCatchClause = updateCatchClause;
// Property assignments
function createPropertyAssignment(name, initializer) {
- var node = createSynthesizedNode(275 /* PropertyAssignment */);
+ var node = createSynthesizedNode(276 /* PropertyAssignment */);
node.name = asName(name);
node.questionToken = undefined;
node.initializer = ts.parenthesizeExpressionForList(initializer);
@@ -62525,7 +63410,7 @@
}
ts.updatePropertyAssignment = updatePropertyAssignment;
function createShorthandPropertyAssignment(name, objectAssignmentInitializer) {
- var node = createSynthesizedNode(276 /* ShorthandPropertyAssignment */);
+ var node = createSynthesizedNode(277 /* ShorthandPropertyAssignment */);
node.name = asName(name);
node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? ts.parenthesizeExpressionForList(objectAssignmentInitializer) : undefined;
return node;
@@ -62539,8 +63424,8 @@
}
ts.updateShorthandPropertyAssignment = updateShorthandPropertyAssignment;
function createSpreadAssignment(expression) {
- var node = createSynthesizedNode(277 /* SpreadAssignment */);
- node.expression = expression !== undefined ? ts.parenthesizeExpressionForList(expression) : undefined; // TODO: GH#18217
+ var node = createSynthesizedNode(278 /* SpreadAssignment */);
+ node.expression = ts.parenthesizeExpressionForList(expression);
return node;
}
ts.createSpreadAssignment = createSpreadAssignment;
@@ -62552,7 +63437,7 @@
ts.updateSpreadAssignment = updateSpreadAssignment;
// Enum
function createEnumMember(name, initializer) {
- var node = createSynthesizedNode(278 /* EnumMember */);
+ var node = createSynthesizedNode(279 /* EnumMember */);
node.name = asName(name);
node.initializer = initializer && ts.parenthesizeExpressionForList(initializer);
return node;
@@ -62573,7 +63458,7 @@
(typeReferences !== undefined && node.typeReferenceDirectives !== typeReferences) ||
(libReferences !== undefined && node.libReferenceDirectives !== libReferences) ||
(hasNoDefaultLib !== undefined && node.hasNoDefaultLib !== hasNoDefaultLib)) {
- var updated = createSynthesizedNode(284 /* SourceFile */);
+ var updated = createSynthesizedNode(285 /* SourceFile */);
updated.flags |= node.flags;
updated.statements = createNodeArray(statements);
updated.endOfFileToken = node.endOfFileToken;
@@ -62657,7 +63542,7 @@
* @param original The original statement.
*/
function createNotEmittedStatement(original) {
- var node = createSynthesizedNode(312 /* NotEmittedStatement */);
+ var node = createSynthesizedNode(313 /* NotEmittedStatement */);
node.original = original;
setTextRange(node, original);
return node;
@@ -62669,7 +63554,7 @@
*/
/* @internal */
function createEndOfDeclarationMarker(original) {
- var node = createSynthesizedNode(316 /* EndOfDeclarationMarker */);
+ var node = createSynthesizedNode(317 /* EndOfDeclarationMarker */);
node.emitNode = {};
node.original = original;
return node;
@@ -62681,7 +63566,7 @@
*/
/* @internal */
function createMergeDeclarationMarker(original) {
- var node = createSynthesizedNode(315 /* MergeDeclarationMarker */);
+ var node = createSynthesizedNode(316 /* MergeDeclarationMarker */);
node.emitNode = {};
node.original = original;
return node;
@@ -62696,7 +63581,7 @@
* @param location The location for the expression. Defaults to the positions from "original" if provided.
*/
function createPartiallyEmittedExpression(expression, original) {
- var node = createSynthesizedNode(313 /* PartiallyEmittedExpression */);
+ var node = createSynthesizedNode(314 /* PartiallyEmittedExpression */);
node.expression = expression;
node.original = original;
setTextRange(node, original);
@@ -62712,7 +63597,7 @@
ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression;
function flattenCommaElements(node) {
if (ts.nodeIsSynthesized(node) && !ts.isParseTreeNode(node) && !node.original && !node.emitNode && !node.id) {
- if (node.kind === 314 /* CommaListExpression */) {
+ if (node.kind === 315 /* CommaListExpression */) {
return node.elements;
}
if (ts.isBinaryExpression(node) && node.operatorToken.kind === 27 /* CommaToken */) {
@@ -62722,7 +63607,7 @@
return node;
}
function createCommaList(elements) {
- var node = createSynthesizedNode(314 /* CommaListExpression */);
+ var node = createSynthesizedNode(315 /* CommaListExpression */);
node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements));
return node;
}
@@ -62735,7 +63620,7 @@
ts.updateCommaList = updateCommaList;
function createBundle(sourceFiles, prepends) {
if (prepends === void 0) { prepends = ts.emptyArray; }
- var node = ts.createNode(285 /* Bundle */);
+ var node = ts.createNode(286 /* Bundle */);
node.prepends = prepends;
node.sourceFiles = sourceFiles;
return node;
@@ -62765,7 +63650,7 @@
], function (helper) { return helper.name; }));
}
function createUnparsedSource() {
- var node = ts.createNode(286 /* UnparsedSource */);
+ var node = ts.createNode(287 /* UnparsedSource */);
node.prologues = ts.emptyArray;
node.referencedFiles = ts.emptyArray;
node.libReferenceDirectives = ts.emptyArray;
@@ -62897,10 +63782,10 @@
}
function mapBundleFileSectionKindToSyntaxKind(kind) {
switch (kind) {
- case "prologue" /* Prologue */: return 279 /* UnparsedPrologue */;
- case "prepend" /* Prepend */: return 280 /* UnparsedPrepend */;
- case "internal" /* Internal */: return 282 /* UnparsedInternalText */;
- case "text" /* Text */: return 281 /* UnparsedText */;
+ case "prologue" /* Prologue */: return 280 /* UnparsedPrologue */;
+ case "prepend" /* Prepend */: return 281 /* UnparsedPrepend */;
+ case "internal" /* Internal */: return 283 /* UnparsedInternalText */;
+ case "text" /* Text */: return 282 /* UnparsedText */;
case "emitHelpers" /* EmitHelpers */:
case "no-default-lib" /* NoDefaultLib */:
case "reference" /* Reference */:
@@ -62918,14 +63803,14 @@
return node;
}
function createUnparsedSyntheticReference(section, parent) {
- var node = ts.createNode(283 /* UnparsedSyntheticReference */, section.pos, section.end);
+ var node = ts.createNode(284 /* UnparsedSyntheticReference */, section.pos, section.end);
node.parent = parent;
node.data = section.data;
node.section = section;
return node;
}
function createInputFiles(javascriptTextOrReadFileText, declarationTextOrJavascriptPath, javascriptMapPath, javascriptMapTextOrDeclarationPath, declarationMapPath, declarationMapTextOrBuildInfoPath, javascriptPath, declarationPath, buildInfoPath, buildInfo, oldFileOfCurrentEmit) {
- var node = ts.createNode(287 /* InputFiles */);
+ var node = ts.createNode(288 /* InputFiles */);
if (!ts.isString(javascriptTextOrReadFileText)) {
var cache_1 = ts.createMap();
var textGetter_1 = function (path) {
@@ -63019,7 +63904,7 @@
}
ts.createLessThan = createLessThan;
function createAssignment(left, right) {
- return createBinary(left, 59 /* EqualsToken */, right);
+ return createBinary(left, 60 /* EqualsToken */, right);
}
ts.createAssignment = createAssignment;
function createStrictEquality(left, right) {
@@ -63112,7 +63997,7 @@
// To avoid holding onto transformation artifacts, we keep track of any
// parse tree node we are annotating. This allows us to clean them up after
// all transformations have completed.
- if (node.kind === 284 /* SourceFile */) {
+ if (node.kind === 285 /* SourceFile */) {
return node.emitNode = { annotatedNodes: [node] };
}
var sourceFile = ts.getSourceFileOfNode(ts.getParseTreeNode(ts.getSourceFileOfNode(node)));
@@ -63623,7 +64508,7 @@
if (!outermostLabeledStatement) {
return node;
}
- var updated = ts.updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 233 /* LabeledStatement */
+ var updated = ts.updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 234 /* LabeledStatement */
? restoreEnclosingLabel(node, outermostLabeledStatement.statement)
: node);
if (afterRestoreLabelCallback) {
@@ -63635,20 +64520,20 @@
function shouldBeCapturedInTempVariable(node, cacheIdentifiers) {
var target = ts.skipParentheses(node);
switch (target.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return cacheIdentifiers;
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
case 10 /* StringLiteral */:
return false;
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
var elements = target.elements;
if (elements.length === 0) {
return false;
}
return true;
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return target.properties.length > 0;
default:
return true;
@@ -63663,7 +64548,7 @@
thisArg = ts.createThis();
target = callee;
}
- else if (callee.kind === 98 /* SuperKeyword */) {
+ else if (callee.kind === 99 /* SuperKeyword */) {
thisArg = ts.createThis();
target = languageVersion < 2 /* ES2015 */
? ts.setTextRange(ts.createIdentifier("_super"), callee)
@@ -63675,7 +64560,7 @@
}
else {
switch (callee.kind) {
- case 189 /* PropertyAccessExpression */: {
+ case 190 /* PropertyAccessExpression */: {
if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) {
// for `a.b()` target is `(_a = a).b` and thisArg is `_a`
thisArg = ts.createTempVariable(recordTempVariable);
@@ -63688,7 +64573,7 @@
}
break;
}
- case 190 /* ElementAccessExpression */: {
+ case 191 /* ElementAccessExpression */: {
if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) {
// for `a[b]()` target is `(_a = a)[b]` and thisArg is `_a`
thisArg = ts.createTempVariable(recordTempVariable);
@@ -63745,14 +64630,14 @@
ts.createExpressionForPropertyName = createExpressionForPropertyName;
function createExpressionForObjectLiteralElementLike(node, property, receiver) {
switch (property.kind) {
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return createExpressionForAccessorDeclaration(node.properties, property, receiver, !!node.multiLine);
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return createExpressionForPropertyAssignment(property, receiver);
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return createExpressionForShorthandPropertyAssignment(property, receiver);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return createExpressionForMethodDeclaration(property, receiver);
}
}
@@ -63760,7 +64645,7 @@
function createExpressionForAccessorDeclaration(properties, property, receiver, multiLine) {
var _a = ts.getAllAccessorDeclarations(properties, property), firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor;
if (property === firstAccessor) {
- var properties_7 = [];
+ var properties_5 = [];
if (getAccessor) {
var getterFunction = ts.createFunctionExpression(getAccessor.modifiers,
/*asteriskToken*/ undefined,
@@ -63771,7 +64656,7 @@
ts.setTextRange(getterFunction, getAccessor);
ts.setOriginalNode(getterFunction, getAccessor);
var getter = ts.createPropertyAssignment("get", getterFunction);
- properties_7.push(getter);
+ properties_5.push(getter);
}
if (setAccessor) {
var setterFunction = ts.createFunctionExpression(setAccessor.modifiers,
@@ -63783,15 +64668,15 @@
ts.setTextRange(setterFunction, setAccessor);
ts.setOriginalNode(setterFunction, setAccessor);
var setter = ts.createPropertyAssignment("set", setterFunction);
- properties_7.push(setter);
+ properties_5.push(setter);
}
- properties_7.push(ts.createPropertyAssignment("enumerable", ts.createTrue()));
- properties_7.push(ts.createPropertyAssignment("configurable", ts.createTrue()));
+ properties_5.push(ts.createPropertyAssignment("enumerable", ts.createTrue()));
+ properties_5.push(ts.createPropertyAssignment("configurable", ts.createTrue()));
var expression = ts.setTextRange(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"),
/*typeArguments*/ undefined, [
receiver,
createExpressionForPropertyName(property.name),
- ts.createObjectLiteral(properties_7, multiLine)
+ ts.createObjectLiteral(properties_5, multiLine)
]),
/*location*/ firstAccessor);
return ts.aggregateTransformFlags(expression);
@@ -64078,7 +64963,7 @@
function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) {
var skipped = ts.skipPartiallyEmittedExpressions(operand);
// If the resulting expression is already parenthesized, we do not need to do any further processing.
- if (skipped.kind === 195 /* ParenthesizedExpression */) {
+ if (skipped.kind === 196 /* ParenthesizedExpression */) {
return operand;
}
return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand)
@@ -64112,10 +64997,10 @@
//
// If `a ** d` is on the left of operator `**`, we need to parenthesize to preserve
// the intended order of operations: `(a ** b) ** c`
- var binaryOperatorPrecedence = ts.getOperatorPrecedence(204 /* BinaryExpression */, binaryOperator);
- var binaryOperatorAssociativity = ts.getOperatorAssociativity(204 /* BinaryExpression */, binaryOperator);
+ var binaryOperatorPrecedence = ts.getOperatorPrecedence(205 /* BinaryExpression */, binaryOperator);
+ var binaryOperatorAssociativity = ts.getOperatorAssociativity(205 /* BinaryExpression */, binaryOperator);
var emittedOperand = ts.skipPartiallyEmittedExpressions(operand);
- if (!isLeftSideOfBinary && operand.kind === 197 /* ArrowFunction */ && binaryOperatorPrecedence > 4) {
+ if (!isLeftSideOfBinary && operand.kind === 198 /* ArrowFunction */ && binaryOperatorPrecedence > 4) {
// We need to parenthesize arrow functions on the right side to avoid it being
// parsed as parenthesized expression: `a && (() => {})`
return true;
@@ -64127,7 +65012,7 @@
// and is a yield expression, then we do not need parentheses.
if (!isLeftSideOfBinary
&& binaryOperatorAssociativity === 1 /* Right */
- && operand.kind === 207 /* YieldExpression */) {
+ && operand.kind === 208 /* YieldExpression */) {
return false;
}
return true;
@@ -64215,7 +65100,7 @@
if (ts.isLiteralKind(node.kind)) {
return node.kind;
}
- if (node.kind === 204 /* BinaryExpression */ && node.operatorToken.kind === 38 /* PlusToken */) {
+ if (node.kind === 205 /* BinaryExpression */ && node.operatorToken.kind === 38 /* PlusToken */) {
if (node.cachedLiteralKind !== undefined) {
return node.cachedLiteralKind;
}
@@ -64230,7 +65115,7 @@
return 0 /* Unknown */;
}
function parenthesizeForConditionalHead(condition) {
- var conditionalPrecedence = ts.getOperatorPrecedence(205 /* ConditionalExpression */, 56 /* QuestionToken */);
+ var conditionalPrecedence = ts.getOperatorPrecedence(206 /* ConditionalExpression */, 56 /* QuestionToken */);
var emittedCondition = ts.skipPartiallyEmittedExpressions(condition);
var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition);
if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1 /* LessThan */) {
@@ -64265,8 +65150,8 @@
var needsParens = isCommaSequence(check);
if (!needsParens) {
switch (getLeftmostExpression(check, /*stopAtCallExpression*/ false).kind) {
- case 209 /* ClassExpression */:
- case 196 /* FunctionExpression */:
+ case 210 /* ClassExpression */:
+ case 197 /* FunctionExpression */:
needsParens = true;
}
}
@@ -64282,9 +65167,9 @@
function parenthesizeForNew(expression) {
var leftmostExpr = getLeftmostExpression(expression, /*stopAtCallExpressions*/ true);
switch (leftmostExpr.kind) {
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return ts.createParen(expression);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return !leftmostExpr.arguments
? ts.createParen(expression)
: expression;
@@ -64307,7 +65192,7 @@
//
var emittedExpression = ts.skipPartiallyEmittedExpressions(expression);
if (ts.isLeftHandSideExpression(emittedExpression)
- && (emittedExpression.kind !== 192 /* NewExpression */ || emittedExpression.arguments)) {
+ && (emittedExpression.kind !== 193 /* NewExpression */ || emittedExpression.arguments)) {
return expression;
}
return ts.setTextRange(ts.createParen(expression), expression);
@@ -64345,7 +65230,7 @@
function parenthesizeExpressionForList(expression) {
var emittedExpression = ts.skipPartiallyEmittedExpressions(expression);
var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression);
- var commaPrecedence = ts.getOperatorPrecedence(204 /* BinaryExpression */, 27 /* CommaToken */);
+ var commaPrecedence = ts.getOperatorPrecedence(205 /* BinaryExpression */, 27 /* CommaToken */);
return expressionPrecedence > commaPrecedence
? expression
: ts.setTextRange(ts.createParen(expression), expression);
@@ -64356,29 +65241,29 @@
if (ts.isCallExpression(emittedExpression)) {
var callee = emittedExpression.expression;
var kind = ts.skipPartiallyEmittedExpressions(callee).kind;
- if (kind === 196 /* FunctionExpression */ || kind === 197 /* ArrowFunction */) {
+ if (kind === 197 /* FunctionExpression */ || kind === 198 /* ArrowFunction */) {
var mutableCall = ts.getMutableClone(emittedExpression);
mutableCall.expression = ts.setTextRange(ts.createParen(callee), callee);
return recreateOuterExpressions(expression, mutableCall, 4 /* PartiallyEmittedExpressions */);
}
}
var leftmostExpressionKind = getLeftmostExpression(emittedExpression, /*stopAtCallExpressions*/ false).kind;
- if (leftmostExpressionKind === 188 /* ObjectLiteralExpression */ || leftmostExpressionKind === 196 /* FunctionExpression */) {
+ if (leftmostExpressionKind === 189 /* ObjectLiteralExpression */ || leftmostExpressionKind === 197 /* FunctionExpression */) {
return ts.setTextRange(ts.createParen(expression), expression);
}
return expression;
}
ts.parenthesizeExpressionForExpressionStatement = parenthesizeExpressionForExpressionStatement;
function parenthesizeConditionalTypeMember(member) {
- return member.kind === 175 /* ConditionalType */ ? ts.createParenthesizedType(member) : member;
+ return member.kind === 176 /* ConditionalType */ ? ts.createParenthesizedType(member) : member;
}
ts.parenthesizeConditionalTypeMember = parenthesizeConditionalTypeMember;
function parenthesizeElementTypeMember(member) {
switch (member.kind) {
- case 173 /* UnionType */:
- case 174 /* IntersectionType */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
+ case 174 /* UnionType */:
+ case 175 /* IntersectionType */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
return ts.createParenthesizedType(member);
}
return parenthesizeConditionalTypeMember(member);
@@ -64386,9 +65271,9 @@
ts.parenthesizeElementTypeMember = parenthesizeElementTypeMember;
function parenthesizeArrayTypeMember(member) {
switch (member.kind) {
- case 167 /* TypeQuery */:
- case 179 /* TypeOperator */:
- case 176 /* InferType */:
+ case 168 /* TypeQuery */:
+ case 180 /* TypeOperator */:
+ case 177 /* InferType */:
return ts.createParenthesizedType(member);
}
return parenthesizeElementTypeMember(member);
@@ -64414,28 +65299,28 @@
function getLeftmostExpression(node, stopAtCallExpressions) {
while (true) {
switch (node.kind) {
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
node = node.operand;
continue;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
node = node.left;
continue;
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
node = node.condition;
continue;
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
node = node.tag;
continue;
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
if (stopAtCallExpressions) {
return node;
}
// falls through
- case 212 /* AsExpression */:
- case 190 /* ElementAccessExpression */:
- case 189 /* PropertyAccessExpression */:
- case 213 /* NonNullExpression */:
- case 313 /* PartiallyEmittedExpression */:
+ case 213 /* AsExpression */:
+ case 191 /* ElementAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 214 /* NonNullExpression */:
+ case 314 /* PartiallyEmittedExpression */:
node = node.expression;
continue;
}
@@ -64443,15 +65328,15 @@
}
}
function parenthesizeConciseBody(body) {
- if (!ts.isBlock(body) && (isCommaSequence(body) || getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 188 /* ObjectLiteralExpression */)) {
+ if (!ts.isBlock(body) && (isCommaSequence(body) || getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 189 /* ObjectLiteralExpression */)) {
return ts.setTextRange(ts.createParen(body), body);
}
return body;
}
ts.parenthesizeConciseBody = parenthesizeConciseBody;
function isCommaSequence(node) {
- return node.kind === 204 /* BinaryExpression */ && node.operatorToken.kind === 27 /* CommaToken */ ||
- node.kind === 314 /* CommaListExpression */;
+ return node.kind === 205 /* BinaryExpression */ && node.operatorToken.kind === 27 /* CommaToken */ ||
+ node.kind === 315 /* CommaListExpression */;
}
ts.isCommaSequence = isCommaSequence;
var OuterExpressionKinds;
@@ -64464,13 +65349,13 @@
function isOuterExpression(node, kinds) {
if (kinds === void 0) { kinds = 7 /* All */; }
switch (node.kind) {
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return (kinds & 1 /* Parentheses */) !== 0;
- case 194 /* TypeAssertionExpression */:
- case 212 /* AsExpression */:
- case 213 /* NonNullExpression */:
+ case 195 /* TypeAssertionExpression */:
+ case 213 /* AsExpression */:
+ case 214 /* NonNullExpression */:
return (kinds & 2 /* Assertions */) !== 0;
- case 313 /* PartiallyEmittedExpression */:
+ case 314 /* PartiallyEmittedExpression */:
return (kinds & 4 /* PartiallyEmittedExpressions */) !== 0;
}
return false;
@@ -64495,7 +65380,7 @@
}
ts.skipOuterExpressions = skipOuterExpressions;
function skipAssertions(node) {
- while (ts.isAssertionExpression(node) || node.kind === 213 /* NonNullExpression */) {
+ while (ts.isAssertionExpression(node) || node.kind === 214 /* NonNullExpression */) {
node = node.expression;
}
return node;
@@ -64503,11 +65388,11 @@
ts.skipAssertions = skipAssertions;
function updateOuterExpression(outerExpression, expression) {
switch (outerExpression.kind) {
- case 195 /* ParenthesizedExpression */: return ts.updateParen(outerExpression, expression);
- case 194 /* TypeAssertionExpression */: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression);
- case 212 /* AsExpression */: return ts.updateAsExpression(outerExpression, expression, outerExpression.type);
- case 213 /* NonNullExpression */: return ts.updateNonNullExpression(outerExpression, expression);
- case 313 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(outerExpression, expression);
+ case 196 /* ParenthesizedExpression */: return ts.updateParen(outerExpression, expression);
+ case 195 /* TypeAssertionExpression */: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression);
+ case 213 /* AsExpression */: return ts.updateAsExpression(outerExpression, expression, outerExpression.type);
+ case 214 /* NonNullExpression */: return ts.updateNonNullExpression(outerExpression, expression);
+ case 314 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(outerExpression, expression);
}
}
/**
@@ -64525,7 +65410,7 @@
* the containing expression is created/updated.
*/
function isIgnorableParen(node) {
- return node.kind === 195 /* ParenthesizedExpression */
+ return node.kind === 196 /* ParenthesizedExpression */
&& ts.nodeIsSynthesized(node)
&& ts.nodeIsSynthesized(ts.getSourceMapRange(node))
&& ts.nodeIsSynthesized(ts.getCommentRange(node))
@@ -64590,10 +65475,10 @@
var name = namespaceDeclaration.name;
return ts.isGeneratedIdentifier(name) ? name : ts.createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, name) || ts.idText(name));
}
- if (node.kind === 249 /* ImportDeclaration */ && node.importClause) {
+ if (node.kind === 250 /* ImportDeclaration */ && node.importClause) {
return ts.getGeneratedNameForNode(node);
}
- if (node.kind === 255 /* ExportDeclaration */ && node.moduleSpecifier) {
+ if (node.kind === 256 /* ExportDeclaration */ && node.moduleSpecifier) {
return ts.getGeneratedNameForNode(node);
}
return undefined;
@@ -64712,7 +65597,7 @@
}
if (ts.isObjectLiteralElementLike(bindingElement)) {
switch (bindingElement.kind) {
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
// `b` in `({ a: b } = ...)`
// `b` in `({ a: b = 1 } = ...)`
// `{b}` in `({ a: {b} } = ...)`
@@ -64724,11 +65609,11 @@
// `b[0]` in `({ a: b[0] } = ...)`
// `b[0]` in `({ a: b[0] = 1 } = ...)`
return getTargetOfBindingOrAssignmentElement(bindingElement.initializer);
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
// `a` in `({ a } = ...)`
// `a` in `({ a = 1 } = ...)`
return bindingElement.name;
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
// `a` in `({ ...a } = ...)`
return getTargetOfBindingOrAssignmentElement(bindingElement.expression);
}
@@ -64760,12 +65645,12 @@
*/
function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) {
switch (bindingElement.kind) {
- case 151 /* Parameter */:
- case 186 /* BindingElement */:
+ case 152 /* Parameter */:
+ case 187 /* BindingElement */:
// `...` in `let [...a] = ...`
return bindingElement.dotDotDotToken;
- case 208 /* SpreadElement */:
- case 277 /* SpreadAssignment */:
+ case 209 /* SpreadElement */:
+ case 278 /* SpreadAssignment */:
// `...` in `[...a] = ...`
return bindingElement;
}
@@ -64777,7 +65662,7 @@
*/
function getPropertyNameOfBindingOrAssignmentElement(bindingElement) {
switch (bindingElement.kind) {
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
// `a` in `let { a: b } = ...`
// `[a]` in `let { [a]: b } = ...`
// `"a"` in `let { "a": b } = ...`
@@ -64789,7 +65674,7 @@
: propertyName;
}
break;
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
// `a` in `({ a: b } = ...)`
// `[a]` in `({ [a]: b } = ...)`
// `"a"` in `({ "a": b } = ...)`
@@ -64801,7 +65686,7 @@
: propertyName;
}
break;
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
// `a` in `({ ...a } = ...)`
return bindingElement.name;
}
@@ -64824,13 +65709,13 @@
*/
function getElementsOfBindingOrAssignmentPattern(name) {
switch (name.kind) {
- case 184 /* ObjectBindingPattern */:
- case 185 /* ArrayBindingPattern */:
- case 187 /* ArrayLiteralExpression */:
+ case 185 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
+ case 188 /* ArrayLiteralExpression */:
// `a` in `{a}`
// `a` in `[a]`
return name.elements;
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
// `a` in `{a}`
return name.properties;
}
@@ -64870,11 +65755,11 @@
ts.convertToObjectAssignmentElement = convertToObjectAssignmentElement;
function convertToAssignmentPattern(node) {
switch (node.kind) {
- case 185 /* ArrayBindingPattern */:
- case 187 /* ArrayLiteralExpression */:
+ case 186 /* ArrayBindingPattern */:
+ case 188 /* ArrayLiteralExpression */:
return convertToArrayAssignmentPattern(node);
- case 184 /* ObjectBindingPattern */:
- case 188 /* ObjectLiteralExpression */:
+ case 185 /* ObjectBindingPattern */:
+ case 189 /* ObjectLiteralExpression */:
return convertToObjectAssignmentPattern(node);
}
}
@@ -65035,276 +65920,278 @@
}
var kind = node.kind;
// No need to visit nodes with no children.
- if ((kind > 0 /* FirstToken */ && kind <= 147 /* LastToken */) || kind === 178 /* ThisType */) {
+ if ((kind > 0 /* FirstToken */ && kind <= 148 /* LastToken */) || kind === 179 /* ThisType */) {
return node;
}
switch (kind) {
// Names
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return ts.updateIdentifier(node, nodesVisitor(node.typeArguments, visitor, isTypeNodeOrTypeParameterDeclaration));
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
return ts.updateQualifiedName(node, visitNode(node.left, visitor, ts.isEntityName), visitNode(node.right, visitor, ts.isIdentifier));
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression));
// Signature elements
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
return ts.updateTypeParameterDeclaration(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.constraint, visitor, ts.isTypeNode), visitNode(node.default, visitor, ts.isTypeNode));
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return ts.updateParameter(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.dotDotDotToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression));
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
return ts.updateDecorator(node, visitNode(node.expression, visitor, ts.isExpression));
// Type elements
- case 153 /* PropertySignature */:
+ case 154 /* PropertySignature */:
return ts.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isToken), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression));
- case 154 /* PropertyDeclaration */:
- return ts.updateProperty(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression));
- case 155 /* MethodSignature */:
+ case 155 /* PropertyDeclaration */:
+ return ts.updateProperty(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName),
+ // QuestionToken and ExclamationToken is uniqued in Property Declaration and the signature of 'updateProperty' is that too
+ visitNode(node.questionToken || node.exclamationToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression));
+ case 156 /* MethodSignature */:
return ts.updateMethodSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken));
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return ts.updateMethod(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context));
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return ts.updateConstructor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context));
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
return ts.updateGetAccessor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context));
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
return ts.updateSetAccessor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context));
- case 160 /* CallSignature */:
+ case 161 /* CallSignature */:
return ts.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
- case 161 /* ConstructSignature */:
+ case 162 /* ConstructSignature */:
return ts.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
- case 162 /* IndexSignature */:
+ case 163 /* IndexSignature */:
return ts.updateIndexSignature(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
// Types
- case 163 /* TypePredicate */:
+ case 164 /* TypePredicate */:
return ts.updateTypePredicateNode(node, visitNode(node.parameterName, visitor), visitNode(node.type, visitor, ts.isTypeNode));
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return ts.updateTypeReferenceNode(node, visitNode(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode));
- case 165 /* FunctionType */:
+ case 166 /* FunctionType */:
return ts.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
- case 166 /* ConstructorType */:
+ case 167 /* ConstructorType */:
return ts.updateConstructorTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
- case 167 /* TypeQuery */:
+ case 168 /* TypeQuery */:
return ts.updateTypeQueryNode(node, visitNode(node.exprName, visitor, ts.isEntityName));
- case 168 /* TypeLiteral */:
+ case 169 /* TypeLiteral */:
return ts.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement));
- case 169 /* ArrayType */:
+ case 170 /* ArrayType */:
return ts.updateArrayTypeNode(node, visitNode(node.elementType, visitor, ts.isTypeNode));
- case 170 /* TupleType */:
+ case 171 /* TupleType */:
return ts.updateTupleTypeNode(node, nodesVisitor(node.elementTypes, visitor, ts.isTypeNode));
- case 171 /* OptionalType */:
+ case 172 /* OptionalType */:
return ts.updateOptionalTypeNode(node, visitNode(node.type, visitor, ts.isTypeNode));
- case 172 /* RestType */:
+ case 173 /* RestType */:
return ts.updateRestTypeNode(node, visitNode(node.type, visitor, ts.isTypeNode));
- case 173 /* UnionType */:
+ case 174 /* UnionType */:
return ts.updateUnionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode));
- case 174 /* IntersectionType */:
+ case 175 /* IntersectionType */:
return ts.updateIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode));
- case 175 /* ConditionalType */:
+ case 176 /* ConditionalType */:
return ts.updateConditionalTypeNode(node, visitNode(node.checkType, visitor, ts.isTypeNode), visitNode(node.extendsType, visitor, ts.isTypeNode), visitNode(node.trueType, visitor, ts.isTypeNode), visitNode(node.falseType, visitor, ts.isTypeNode));
- case 176 /* InferType */:
+ case 177 /* InferType */:
return ts.updateInferTypeNode(node, visitNode(node.typeParameter, visitor, ts.isTypeParameterDeclaration));
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return ts.updateImportTypeNode(node, visitNode(node.argument, visitor, ts.isTypeNode), visitNode(node.qualifier, visitor, ts.isEntityName), visitNodes(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf);
- case 177 /* ParenthesizedType */:
+ case 178 /* ParenthesizedType */:
return ts.updateParenthesizedType(node, visitNode(node.type, visitor, ts.isTypeNode));
- case 179 /* TypeOperator */:
+ case 180 /* TypeOperator */:
return ts.updateTypeOperatorNode(node, visitNode(node.type, visitor, ts.isTypeNode));
- case 180 /* IndexedAccessType */:
+ case 181 /* IndexedAccessType */:
return ts.updateIndexedAccessTypeNode(node, visitNode(node.objectType, visitor, ts.isTypeNode), visitNode(node.indexType, visitor, ts.isTypeNode));
- case 181 /* MappedType */:
+ case 182 /* MappedType */:
return ts.updateMappedTypeNode(node, visitNode(node.readonlyToken, tokenVisitor, ts.isToken), visitNode(node.typeParameter, visitor, ts.isTypeParameterDeclaration), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode));
- case 182 /* LiteralType */:
+ case 183 /* LiteralType */:
return ts.updateLiteralTypeNode(node, visitNode(node.literal, visitor, ts.isExpression));
// Binding patterns
- case 184 /* ObjectBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
return ts.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement));
- case 185 /* ArrayBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
return ts.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement));
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return ts.updateBindingElement(node, visitNode(node.dotDotDotToken, tokenVisitor, ts.isToken), visitNode(node.propertyName, visitor, ts.isPropertyName), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression));
// Expression
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return ts.updateArrayLiteral(node, nodesVisitor(node.elements, visitor, ts.isExpression));
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return ts.updateObjectLiteral(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike));
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier));
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression));
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression));
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression));
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return ts.updateTaggedTemplate(node, visitNode(node.tag, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isExpression), visitNode(node.template, visitor, ts.isTemplateLiteral));
- case 194 /* TypeAssertionExpression */:
+ case 195 /* TypeAssertionExpression */:
return ts.updateTypeAssertion(node, visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression));
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression));
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return ts.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context));
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return ts.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.equalsGreaterThanToken, visitor, ts.isToken), visitFunctionBody(node.body, visitor, context));
- case 198 /* DeleteExpression */:
+ case 199 /* DeleteExpression */:
return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression));
- case 199 /* TypeOfExpression */:
+ case 200 /* TypeOfExpression */:
return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression));
- case 200 /* VoidExpression */:
+ case 201 /* VoidExpression */:
return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression));
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
return ts.updateAwait(node, visitNode(node.expression, visitor, ts.isExpression));
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression));
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return ts.updatePostfix(node, visitNode(node.operand, visitor, ts.isExpression));
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return ts.updateBinary(node, visitNode(node.left, visitor, ts.isExpression), visitNode(node.right, visitor, ts.isExpression), visitNode(node.operatorToken, visitor, ts.isToken));
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.questionToken, visitor, ts.isToken), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.colonToken, visitor, ts.isToken), visitNode(node.whenFalse, visitor, ts.isExpression));
- case 206 /* TemplateExpression */:
+ case 207 /* TemplateExpression */:
return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan));
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return ts.updateYield(node, visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.expression, visitor, ts.isExpression));
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression));
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
return ts.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement));
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return ts.updateExpressionWithTypeArguments(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression));
- case 212 /* AsExpression */:
+ case 213 /* AsExpression */:
return ts.updateAsExpression(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.type, visitor, ts.isTypeNode));
- case 213 /* NonNullExpression */:
+ case 214 /* NonNullExpression */:
return ts.updateNonNullExpression(node, visitNode(node.expression, visitor, ts.isExpression));
- case 214 /* MetaProperty */:
+ case 215 /* MetaProperty */:
return ts.updateMetaProperty(node, visitNode(node.name, visitor, ts.isIdentifier));
// Misc
- case 216 /* TemplateSpan */:
+ case 217 /* TemplateSpan */:
return ts.updateTemplateSpan(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail));
// Element
- case 218 /* Block */:
+ case 219 /* Block */:
return ts.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement));
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return ts.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList));
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return ts.updateExpressionStatement(node, visitNode(node.expression, visitor, ts.isExpression));
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, ts.liftToBlock));
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.expression, visitor, ts.isExpression));
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return ts.updateForOf(node, visitNode(node.awaitModifier, visitor, ts.isToken), visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
- case 228 /* ContinueStatement */:
+ case 229 /* ContinueStatement */:
return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier));
- case 229 /* BreakStatement */:
+ case 230 /* BreakStatement */:
return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier));
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression));
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock));
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
- case 234 /* ThrowStatement */:
+ case 235 /* ThrowStatement */:
return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression));
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause), visitNode(node.finallyBlock, visitor, ts.isBlock));
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression));
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
return ts.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration));
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return ts.updateFunctionDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context));
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return ts.updateClassDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement));
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
return ts.updateInterfaceDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement));
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return ts.updateTypeAliasDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return ts.updateEnumDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember));
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return ts.updateModuleDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.body, visitor, ts.isModuleBody));
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
return ts.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement));
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
return ts.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause));
- case 247 /* NamespaceExportDeclaration */:
+ case 248 /* NamespaceExportDeclaration */:
return ts.updateNamespaceExportDeclaration(node, visitNode(node.name, visitor, ts.isIdentifier));
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return ts.updateImportEqualsDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.moduleReference, visitor, ts.isModuleReference));
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return ts.updateImportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause), visitNode(node.moduleSpecifier, visitor, ts.isExpression));
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings));
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier));
- case 252 /* NamedImports */:
+ case 253 /* NamedImports */:
return ts.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier));
- case 253 /* ImportSpecifier */:
+ case 254 /* ImportSpecifier */:
return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier));
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return ts.updateExportAssignment(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression));
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return ts.updateExportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports), visitNode(node.moduleSpecifier, visitor, ts.isExpression));
- case 256 /* NamedExports */:
+ case 257 /* NamedExports */:
return ts.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier));
- case 257 /* ExportSpecifier */:
+ case 258 /* ExportSpecifier */:
return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier));
// Module references
- case 259 /* ExternalModuleReference */:
+ case 260 /* ExternalModuleReference */:
return ts.updateExternalModuleReference(node, visitNode(node.expression, visitor, ts.isExpression));
// JSX
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement));
- case 261 /* JsxSelfClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.attributes, visitor, ts.isJsxAttributes));
- case 262 /* JsxOpeningElement */:
+ case 263 /* JsxOpeningElement */:
return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.attributes, visitor, ts.isJsxAttributes));
- case 263 /* JsxClosingElement */:
+ case 264 /* JsxClosingElement */:
return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression));
- case 264 /* JsxFragment */:
+ case 265 /* JsxFragment */:
return ts.updateJsxFragment(node, visitNode(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingFragment, visitor, ts.isJsxClosingFragment));
- case 267 /* JsxAttribute */:
+ case 268 /* JsxAttribute */:
return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression));
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
return ts.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike));
- case 269 /* JsxSpreadAttribute */:
+ case 270 /* JsxSpreadAttribute */:
return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression));
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression));
// Clauses
- case 271 /* CaseClause */:
+ case 272 /* CaseClause */:
return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement));
- case 272 /* DefaultClause */:
+ case 273 /* DefaultClause */:
return ts.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement));
- case 273 /* HeritageClause */:
+ case 274 /* HeritageClause */:
return ts.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments));
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock));
// Property assignments
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression));
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression));
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression));
// Enum
- case 278 /* EnumMember */:
+ case 279 /* EnumMember */:
return ts.updateEnumMember(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression));
// Top-level nodes
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context));
// Transformation nodes
- case 313 /* PartiallyEmittedExpression */:
+ case 314 /* PartiallyEmittedExpression */:
return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression));
- case 314 /* CommaListExpression */:
+ case 315 /* CommaListExpression */:
return ts.updateCommaList(node, nodesVisitor(node.elements, visitor, ts.isExpression));
default:
// No need to visit nodes with no children.
@@ -65346,58 +66233,58 @@
var cbNodes = cbNodeArray || cbNode;
var kind = node.kind;
// No need to visit nodes with no children.
- if ((kind > 0 /* FirstToken */ && kind <= 147 /* LastToken */)) {
+ if ((kind > 0 /* FirstToken */ && kind <= 148 /* LastToken */)) {
return initial;
}
// We do not yet support types.
- if ((kind >= 163 /* TypePredicate */ && kind <= 182 /* LiteralType */)) {
+ if ((kind >= 164 /* TypePredicate */ && kind <= 183 /* LiteralType */)) {
return initial;
}
var result = initial;
switch (node.kind) {
// Leaf nodes
- case 217 /* SemicolonClassElement */:
- case 220 /* EmptyStatement */:
- case 210 /* OmittedExpression */:
- case 236 /* DebuggerStatement */:
- case 312 /* NotEmittedStatement */:
+ case 218 /* SemicolonClassElement */:
+ case 221 /* EmptyStatement */:
+ case 211 /* OmittedExpression */:
+ case 237 /* DebuggerStatement */:
+ case 313 /* NotEmittedStatement */:
// No need to visit nodes with no children.
break;
// Names
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
result = reduceNode(node.left, cbNode, result);
result = reduceNode(node.right, cbNode, result);
break;
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
result = reduceNode(node.expression, cbNode, result);
break;
// Signature elements
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
result = reduceNode(node.expression, cbNode, result);
break;
// Type member
- case 153 /* PropertySignature */:
+ case 154 /* PropertySignature */:
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.questionToken, cbNode, result);
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
@@ -65406,12 +66293,12 @@
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNodes(node.parameters, cbNodes, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
@@ -65419,7 +66306,7 @@
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
@@ -65427,50 +66314,50 @@
result = reduceNode(node.body, cbNode, result);
break;
// Binding patterns
- case 184 /* ObjectBindingPattern */:
- case 185 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
result = reduceNodes(node.elements, cbNodes, result);
break;
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
result = reduceNode(node.propertyName, cbNode, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
// Expression
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
result = reduceNodes(node.elements, cbNodes, result);
break;
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
result = reduceNodes(node.properties, cbNodes, result);
break;
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.name, cbNode, result);
break;
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.argumentExpression, cbNode, result);
break;
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNodes(node.typeArguments, cbNodes, result);
result = reduceNodes(node.arguments, cbNodes, result);
break;
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNodes(node.typeArguments, cbNodes, result);
result = reduceNodes(node.arguments, cbNodes, result);
break;
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
result = reduceNode(node.tag, cbNode, result);
result = reduceNodes(node.typeArguments, cbNodes, result);
result = reduceNode(node.template, cbNode, result);
break;
- case 194 /* TypeAssertionExpression */:
+ case 195 /* TypeAssertionExpression */:
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.expression, cbNode, result);
break;
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNodes(node.typeParameters, cbNodes, result);
@@ -65478,123 +66365,123 @@
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNodes(node.typeParameters, cbNodes, result);
result = reduceNodes(node.parameters, cbNodes, result);
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 195 /* ParenthesizedExpression */:
- case 198 /* DeleteExpression */:
- case 199 /* TypeOfExpression */:
- case 200 /* VoidExpression */:
- case 201 /* AwaitExpression */:
- case 207 /* YieldExpression */:
- case 208 /* SpreadElement */:
- case 213 /* NonNullExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 199 /* DeleteExpression */:
+ case 200 /* TypeOfExpression */:
+ case 201 /* VoidExpression */:
+ case 202 /* AwaitExpression */:
+ case 208 /* YieldExpression */:
+ case 209 /* SpreadElement */:
+ case 214 /* NonNullExpression */:
result = reduceNode(node.expression, cbNode, result);
break;
- case 202 /* PrefixUnaryExpression */:
- case 203 /* PostfixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
result = reduceNode(node.operand, cbNode, result);
break;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
result = reduceNode(node.left, cbNode, result);
result = reduceNode(node.right, cbNode, result);
break;
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
result = reduceNode(node.condition, cbNode, result);
result = reduceNode(node.whenTrue, cbNode, result);
result = reduceNode(node.whenFalse, cbNode, result);
break;
- case 206 /* TemplateExpression */:
+ case 207 /* TemplateExpression */:
result = reduceNode(node.head, cbNode, result);
result = reduceNodes(node.templateSpans, cbNodes, result);
break;
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNodes(node.typeParameters, cbNodes, result);
result = reduceNodes(node.heritageClauses, cbNodes, result);
result = reduceNodes(node.members, cbNodes, result);
break;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNodes(node.typeArguments, cbNodes, result);
break;
- case 212 /* AsExpression */:
+ case 213 /* AsExpression */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.type, cbNode, result);
break;
// Misc
- case 216 /* TemplateSpan */:
+ case 217 /* TemplateSpan */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.literal, cbNode, result);
break;
// Element
- case 218 /* Block */:
+ case 219 /* Block */:
result = reduceNodes(node.statements, cbNodes, result);
break;
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.declarationList, cbNode, result);
break;
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
result = reduceNode(node.expression, cbNode, result);
break;
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.thenStatement, cbNode, result);
result = reduceNode(node.elseStatement, cbNode, result);
break;
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
result = reduceNode(node.statement, cbNode, result);
result = reduceNode(node.expression, cbNode, result);
break;
- case 224 /* WhileStatement */:
- case 231 /* WithStatement */:
+ case 225 /* WhileStatement */:
+ case 232 /* WithStatement */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.statement, cbNode, result);
break;
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
result = reduceNode(node.initializer, cbNode, result);
result = reduceNode(node.condition, cbNode, result);
result = reduceNode(node.incrementor, cbNode, result);
result = reduceNode(node.statement, cbNode, result);
break;
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
result = reduceNode(node.initializer, cbNode, result);
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.statement, cbNode, result);
break;
- case 230 /* ReturnStatement */:
- case 234 /* ThrowStatement */:
+ case 231 /* ReturnStatement */:
+ case 235 /* ThrowStatement */:
result = reduceNode(node.expression, cbNode, result);
break;
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.caseBlock, cbNode, result);
break;
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
result = reduceNode(node.label, cbNode, result);
result = reduceNode(node.statement, cbNode, result);
break;
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
result = reduceNode(node.tryBlock, cbNode, result);
result = reduceNode(node.catchClause, cbNode, result);
result = reduceNode(node.finallyBlock, cbNode, result);
break;
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
result = reduceNodes(node.declarations, cbNodes, result);
break;
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
@@ -65603,7 +66490,7 @@
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
@@ -65611,140 +66498,140 @@
result = reduceNodes(node.heritageClauses, cbNodes, result);
result = reduceNodes(node.members, cbNodes, result);
break;
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNodes(node.members, cbNodes, result);
break;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
result = reduceNodes(node.statements, cbNodes, result);
break;
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
result = reduceNodes(node.clauses, cbNodes, result);
break;
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.moduleReference, cbNode, result);
break;
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.importClause, cbNode, result);
result = reduceNode(node.moduleSpecifier, cbNode, result);
break;
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.namedBindings, cbNode, result);
break;
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
result = reduceNode(node.name, cbNode, result);
break;
- case 252 /* NamedImports */:
- case 256 /* NamedExports */:
+ case 253 /* NamedImports */:
+ case 257 /* NamedExports */:
result = reduceNodes(node.elements, cbNodes, result);
break;
- case 253 /* ImportSpecifier */:
- case 257 /* ExportSpecifier */:
+ case 254 /* ImportSpecifier */:
+ case 258 /* ExportSpecifier */:
result = reduceNode(node.propertyName, cbNode, result);
result = reduceNode(node.name, cbNode, result);
break;
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
result = ts.reduceLeft(node.decorators, cbNode, result);
result = ts.reduceLeft(node.modifiers, cbNode, result);
result = reduceNode(node.expression, cbNode, result);
break;
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
result = ts.reduceLeft(node.decorators, cbNode, result);
result = ts.reduceLeft(node.modifiers, cbNode, result);
result = reduceNode(node.exportClause, cbNode, result);
result = reduceNode(node.moduleSpecifier, cbNode, result);
break;
// Module references
- case 259 /* ExternalModuleReference */:
+ case 260 /* ExternalModuleReference */:
result = reduceNode(node.expression, cbNode, result);
break;
// JSX
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
result = reduceNode(node.openingElement, cbNode, result);
result = ts.reduceLeft(node.children, cbNode, result);
result = reduceNode(node.closingElement, cbNode, result);
break;
- case 264 /* JsxFragment */:
+ case 265 /* JsxFragment */:
result = reduceNode(node.openingFragment, cbNode, result);
result = ts.reduceLeft(node.children, cbNode, result);
result = reduceNode(node.closingFragment, cbNode, result);
break;
- case 261 /* JsxSelfClosingElement */:
- case 262 /* JsxOpeningElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
result = reduceNode(node.tagName, cbNode, result);
result = reduceNodes(node.typeArguments, cbNode, result);
result = reduceNode(node.attributes, cbNode, result);
break;
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
result = reduceNodes(node.properties, cbNodes, result);
break;
- case 263 /* JsxClosingElement */:
+ case 264 /* JsxClosingElement */:
result = reduceNode(node.tagName, cbNode, result);
break;
- case 267 /* JsxAttribute */:
+ case 268 /* JsxAttribute */:
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
- case 269 /* JsxSpreadAttribute */:
+ case 270 /* JsxSpreadAttribute */:
result = reduceNode(node.expression, cbNode, result);
break;
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
result = reduceNode(node.expression, cbNode, result);
break;
// Clauses
- case 271 /* CaseClause */:
+ case 272 /* CaseClause */:
result = reduceNode(node.expression, cbNode, result);
// falls through
- case 272 /* DefaultClause */:
+ case 273 /* DefaultClause */:
result = reduceNodes(node.statements, cbNodes, result);
break;
- case 273 /* HeritageClause */:
+ case 274 /* HeritageClause */:
result = reduceNodes(node.types, cbNodes, result);
break;
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
result = reduceNode(node.variableDeclaration, cbNode, result);
result = reduceNode(node.block, cbNode, result);
break;
// Property assignments
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.objectAssignmentInitializer, cbNode, result);
break;
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
result = reduceNode(node.expression, cbNode, result);
break;
// Enum
- case 278 /* EnumMember */:
+ case 279 /* EnumMember */:
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
// Top-level nodes
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
result = reduceNodes(node.statements, cbNodes, result);
break;
// Transformation nodes
- case 313 /* PartiallyEmittedExpression */:
+ case 314 /* PartiallyEmittedExpression */:
result = reduceNode(node.expression, cbNode, result);
break;
- case 314 /* CommaListExpression */:
+ case 315 /* CommaListExpression */:
result = reduceNodes(node.elements, cbNodes, result);
break;
default:
@@ -65768,7 +66655,7 @@
* @param nodes The NodeArray.
*/
function liftToBlock(nodes) {
- Debug.assert(ts.every(nodes, ts.isStatement), "Cannot lift nodes to a Block.");
+ ts.Debug.assert(ts.every(nodes, ts.isStatement), "Cannot lift nodes to a Block.");
return ts.singleOrUndefined(nodes) || ts.createBlock(nodes);
}
ts.liftToBlock = liftToBlock;
@@ -65817,7 +66704,7 @@
function aggregateTransformFlagsForSubtree(node) {
// We do not transform ambient declarations or types, so there is no need to
// recursively aggregate transform flags.
- if (ts.hasModifier(node, 2 /* Ambient */) || (ts.isTypeNode(node) && node.kind !== 211 /* ExpressionWithTypeArguments */)) {
+ if (ts.hasModifier(node, 2 /* Ambient */) || (ts.isTypeNode(node) && node.kind !== 212 /* ExpressionWithTypeArguments */)) {
return 0 /* None */;
}
// Aggregate the transform flags of each child.
@@ -65833,73 +66720,6 @@
function aggregateTransformFlagsForChildNodes(transformFlags, nodes) {
return transformFlags | aggregateTransformFlagsForNodeArray(nodes);
}
- var Debug;
- (function (Debug) {
- var isDebugInfoEnabled = false;
- function failBadSyntaxKind(node, message) {
- return Debug.fail((message || "Unexpected node.") + "\r\nNode " + ts.formatSyntaxKind(node.kind) + " was unexpected.", failBadSyntaxKind);
- }
- Debug.failBadSyntaxKind = failBadSyntaxKind;
- Debug.assertEachNode = Debug.shouldAssert(1 /* Normal */)
- ? function (nodes, test, message) { return Debug.assert(test === undefined || ts.every(nodes, test), message || "Unexpected node.", function () { return "Node array did not pass test '" + Debug.getFunctionName(test) + "'."; }, Debug.assertEachNode); }
- : ts.noop;
- Debug.assertNode = Debug.shouldAssert(1 /* Normal */)
- ? function (node, test, message) { return Debug.assert(test === undefined || test(node), message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " did not pass test '" + Debug.getFunctionName(test) + "'."; }, Debug.assertNode); }
- : ts.noop;
- Debug.assertOptionalNode = Debug.shouldAssert(1 /* Normal */)
- ? function (node, test, message) { return Debug.assert(test === undefined || node === undefined || test(node), message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " did not pass test '" + Debug.getFunctionName(test) + "'."; }, Debug.assertOptionalNode); }
- : ts.noop;
- Debug.assertOptionalToken = Debug.shouldAssert(1 /* Normal */)
- ? function (node, kind, message) { return Debug.assert(kind === undefined || node === undefined || node.kind === kind, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was not a '" + ts.formatSyntaxKind(kind) + "' token."; }, Debug.assertOptionalToken); }
- : ts.noop;
- Debug.assertMissingNode = Debug.shouldAssert(1 /* Normal */)
- ? function (node, message) { return Debug.assert(node === undefined, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was unexpected'."; }, Debug.assertMissingNode); }
- : ts.noop;
- /**
- * Injects debug information into frequently used types.
- */
- function enableDebugInfo() {
- if (isDebugInfoEnabled)
- return;
- // Add additional properties in debug mode to assist with debugging.
- Object.defineProperties(ts.objectAllocator.getSymbolConstructor().prototype, {
- __debugFlags: { get: function () { return ts.formatSymbolFlags(this.flags); } }
- });
- Object.defineProperties(ts.objectAllocator.getTypeConstructor().prototype, {
- __debugFlags: { get: function () { return ts.formatTypeFlags(this.flags); } },
- __debugObjectFlags: { get: function () { return this.flags & 524288 /* Object */ ? ts.formatObjectFlags(this.objectFlags) : ""; } },
- __debugTypeToString: { value: function () { return this.checker.typeToString(this); } },
- });
- var nodeConstructors = [
- ts.objectAllocator.getNodeConstructor(),
- ts.objectAllocator.getIdentifierConstructor(),
- ts.objectAllocator.getTokenConstructor(),
- ts.objectAllocator.getSourceFileConstructor()
- ];
- for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) {
- var ctor = nodeConstructors_1[_i];
- if (!ctor.prototype.hasOwnProperty("__debugKind")) {
- Object.defineProperties(ctor.prototype, {
- __debugKind: { get: function () { return ts.formatSyntaxKind(this.kind); } },
- __debugModifierFlags: { get: function () { return ts.formatModifierFlags(ts.getModifierFlagsNoCache(this)); } },
- __debugTransformFlags: { get: function () { return ts.formatTransformFlags(this.transformFlags); } },
- __debugEmitFlags: { get: function () { return ts.formatEmitFlags(ts.getEmitFlags(this)); } },
- __debugGetText: {
- value: function (includeTrivia) {
- if (ts.nodeIsSynthesized(this))
- return "";
- var parseNode = ts.getParseTreeNode(this);
- var sourceFile = parseNode && ts.getSourceFileOfNode(parseNode);
- return sourceFile ? ts.getSourceTextOfNodeFromSourceFile(sourceFile, parseNode, includeTrivia) : "";
- }
- }
- });
- }
- }
- isDebugInfoEnabled = true;
- }
- Debug.enableDebugInfo = enableDebugInfo;
- })(Debug = ts.Debug || (ts.Debug = {}));
})(ts || (ts = {}));
/* @internal */
var ts;
@@ -66557,7 +67377,7 @@
function chainBundle(transformSourceFile) {
return transformSourceFileOrBundle;
function transformSourceFileOrBundle(node) {
- return node.kind === 284 /* SourceFile */ ? transformSourceFile(node) : transformBundle(node);
+ return node.kind === 285 /* SourceFile */ ? transformSourceFile(node) : transformBundle(node);
}
function transformBundle(node) {
return ts.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends);
@@ -66603,7 +67423,7 @@
for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {
var node = _a[_i];
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
// import "mod"
// import x from "mod"
// import * as x from "mod"
@@ -66611,13 +67431,13 @@
externalImports.push(node);
hasImportStarOrImportDefault = hasImportStarOrImportDefault || getImportNeedsImportStarHelper(node) || getImportNeedsImportDefaultHelper(node);
break;
- case 248 /* ImportEqualsDeclaration */:
- if (node.moduleReference.kind === 259 /* ExternalModuleReference */) {
+ case 249 /* ImportEqualsDeclaration */:
+ if (node.moduleReference.kind === 260 /* ExternalModuleReference */) {
// import x = require("mod")
externalImports.push(node);
}
break;
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
if (node.moduleSpecifier) {
if (!node.exportClause) {
// export * from "mod"
@@ -66647,13 +67467,13 @@
}
}
break;
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
if (node.isExportEquals && !exportEquals) {
// export = x
exportEquals = node;
}
break;
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
if (ts.hasModifier(node, 1 /* Export */)) {
for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) {
var decl = _e[_d];
@@ -66661,7 +67481,7 @@
}
}
break;
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
if (ts.hasModifier(node, 1 /* Export */)) {
if (ts.hasModifier(node, 512 /* Default */)) {
// export default function() { }
@@ -66681,7 +67501,7 @@
}
}
break;
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
if (ts.hasModifier(node, 1 /* Export */)) {
if (ts.hasModifier(node, 512 /* Default */)) {
// export default class { }
@@ -67221,7 +68041,7 @@
ts.restHelper = {
name: "typescript:rest",
scoped: false,
- text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\n t[p[i]] = s[p[i]];\n return t;\n };"
+ text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n };"
};
/** Given value: o, propName: p, pattern: { a, b, ...p } from the original statement
* `{ a, b, ...p } = o`, create `p = __rest(o, ["a", "b"]);`
@@ -67297,8 +68117,8 @@
context.onEmitNode = onEmitNode;
context.onSubstituteNode = onSubstituteNode;
// Enable substitution for property/element access to emit const enum values.
- context.enableSubstitution(189 /* PropertyAccessExpression */);
- context.enableSubstitution(190 /* ElementAccessExpression */);
+ context.enableSubstitution(190 /* PropertyAccessExpression */);
+ context.enableSubstitution(191 /* ElementAccessExpression */);
// These variables contain state that changes as we descend into the tree.
var currentSourceFile;
var currentNamespace;
@@ -67328,14 +68148,14 @@
var pendingExpressions;
return transformSourceFileOrBundle;
function transformSourceFileOrBundle(node) {
- if (node.kind === 285 /* Bundle */) {
+ if (node.kind === 286 /* Bundle */) {
return transformBundle(node);
}
return transformSourceFile(node);
}
function transformBundle(node) {
return ts.createBundle(node.sourceFiles.map(transformSourceFile), ts.mapDefined(node.prepends, function (prepend) {
- if (prepend.kind === 287 /* InputFiles */) {
+ if (prepend.kind === 288 /* InputFiles */) {
return ts.createUnparsedSourceFile(prepend, "js");
}
return prepend;
@@ -67384,16 +68204,16 @@
*/
function onBeforeVisitNode(node) {
switch (node.kind) {
- case 284 /* SourceFile */:
- case 246 /* CaseBlock */:
- case 245 /* ModuleBlock */:
- case 218 /* Block */:
+ case 285 /* SourceFile */:
+ case 247 /* CaseBlock */:
+ case 246 /* ModuleBlock */:
+ case 219 /* Block */:
currentLexicalScope = node;
currentNameScope = undefined;
currentScopeFirstDeclarationsOfName = undefined;
break;
- case 240 /* ClassDeclaration */:
- case 239 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 240 /* FunctionDeclaration */:
if (ts.hasModifier(node, 2 /* Ambient */)) {
break;
}
@@ -67405,7 +68225,7 @@
// These nodes should always have names unless they are default-exports;
// however, class declaration parsing allows for undefined names, so syntactically invalid
// programs may also have an undefined name.
- ts.Debug.assert(node.kind === 240 /* ClassDeclaration */ || ts.hasModifier(node, 512 /* Default */));
+ ts.Debug.assert(node.kind === 241 /* ClassDeclaration */ || ts.hasModifier(node, 512 /* Default */));
}
if (ts.isClassDeclaration(node)) {
// XXX: should probably also cover interfaces and type aliases that can have type variables?
@@ -67448,10 +68268,10 @@
*/
function sourceElementVisitorWorker(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
- case 254 /* ExportAssignment */:
- case 255 /* ExportDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 255 /* ExportAssignment */:
+ case 256 /* ExportDeclaration */:
return visitEllidableStatement(node);
default:
return visitorWorker(node);
@@ -67472,13 +68292,13 @@
return node;
}
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return visitImportDeclaration(node);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return visitImportEqualsDeclaration(node);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return visitExportAssignment(node);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return visitExportDeclaration(node);
default:
ts.Debug.fail("Unhandled ellided statement");
@@ -67498,11 +68318,11 @@
* @param node The node to visit.
*/
function namespaceElementVisitorWorker(node) {
- if (node.kind === 255 /* ExportDeclaration */ ||
- node.kind === 249 /* ImportDeclaration */ ||
- node.kind === 250 /* ImportClause */ ||
- (node.kind === 248 /* ImportEqualsDeclaration */ &&
- node.moduleReference.kind === 259 /* ExternalModuleReference */)) {
+ if (node.kind === 256 /* ExportDeclaration */ ||
+ node.kind === 250 /* ImportDeclaration */ ||
+ node.kind === 251 /* ImportClause */ ||
+ (node.kind === 249 /* ImportEqualsDeclaration */ &&
+ node.moduleReference.kind === 260 /* ExternalModuleReference */)) {
// do not emit ES6 imports and exports since they are illegal inside a namespace
return undefined;
}
@@ -67526,19 +68346,19 @@
*/
function classElementVisitorWorker(node) {
switch (node.kind) {
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
// TypeScript constructors are transformed in `visitClassDeclaration`.
// We elide them here as `visitorWorker` checks transform flags, which could
// erronously include an ES6 constructor without TypeScript syntax.
return undefined;
- case 154 /* PropertyDeclaration */:
- case 162 /* IndexSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 156 /* MethodDeclaration */:
+ case 155 /* PropertyDeclaration */:
+ case 163 /* IndexSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
// Fallback to the default visit behavior.
return visitorWorker(node);
- case 217 /* SemicolonClassElement */:
+ case 218 /* SemicolonClassElement */:
return node;
default:
return ts.Debug.failBadSyntaxKind(node);
@@ -67548,7 +68368,7 @@
if (ts.modifierToFlag(node.kind) & 2270 /* TypeScriptModifier */) {
return undefined;
}
- else if (currentNamespace && node.kind === 85 /* ExportKeyword */) {
+ else if (currentNamespace && node.kind === 86 /* ExportKeyword */) {
return undefined;
}
return node;
@@ -67565,67 +68385,67 @@
return ts.createNotEmittedStatement(node);
}
switch (node.kind) {
- case 85 /* ExportKeyword */:
- case 80 /* DefaultKeyword */:
+ case 86 /* ExportKeyword */:
+ case 81 /* DefaultKeyword */:
// ES6 export and default modifiers are elided when inside a namespace.
return currentNamespace ? undefined : node;
- case 115 /* PublicKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 118 /* AbstractKeyword */:
- case 77 /* ConstKeyword */:
- case 125 /* DeclareKeyword */:
- case 133 /* ReadonlyKeyword */:
+ case 116 /* PublicKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 119 /* AbstractKeyword */:
+ case 78 /* ConstKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 134 /* ReadonlyKeyword */:
// TypeScript accessibility and readonly modifiers are elided.
- case 169 /* ArrayType */:
- case 170 /* TupleType */:
- case 171 /* OptionalType */:
- case 172 /* RestType */:
- case 168 /* TypeLiteral */:
- case 163 /* TypePredicate */:
- case 150 /* TypeParameter */:
- case 120 /* AnyKeyword */:
- case 143 /* UnknownKeyword */:
- case 123 /* BooleanKeyword */:
- case 138 /* StringKeyword */:
- case 135 /* NumberKeyword */:
- case 132 /* NeverKeyword */:
- case 106 /* VoidKeyword */:
- case 139 /* SymbolKeyword */:
- case 166 /* ConstructorType */:
- case 165 /* FunctionType */:
- case 167 /* TypeQuery */:
- case 164 /* TypeReference */:
- case 173 /* UnionType */:
- case 174 /* IntersectionType */:
- case 175 /* ConditionalType */:
- case 177 /* ParenthesizedType */:
- case 178 /* ThisType */:
- case 179 /* TypeOperator */:
- case 180 /* IndexedAccessType */:
- case 181 /* MappedType */:
- case 182 /* LiteralType */:
+ case 170 /* ArrayType */:
+ case 171 /* TupleType */:
+ case 172 /* OptionalType */:
+ case 173 /* RestType */:
+ case 169 /* TypeLiteral */:
+ case 164 /* TypePredicate */:
+ case 151 /* TypeParameter */:
+ case 121 /* AnyKeyword */:
+ case 144 /* UnknownKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 139 /* StringKeyword */:
+ case 136 /* NumberKeyword */:
+ case 133 /* NeverKeyword */:
+ case 107 /* VoidKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 167 /* ConstructorType */:
+ case 166 /* FunctionType */:
+ case 168 /* TypeQuery */:
+ case 165 /* TypeReference */:
+ case 174 /* UnionType */:
+ case 175 /* IntersectionType */:
+ case 176 /* ConditionalType */:
+ case 178 /* ParenthesizedType */:
+ case 179 /* ThisType */:
+ case 180 /* TypeOperator */:
+ case 181 /* IndexedAccessType */:
+ case 182 /* MappedType */:
+ case 183 /* LiteralType */:
// TypeScript type nodes are elided.
- case 162 /* IndexSignature */:
+ case 163 /* IndexSignature */:
// TypeScript index signatures are elided.
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
// TypeScript decorators are elided. They will be emitted as part of visitClassDeclaration.
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
// TypeScript type-only declarations are elided.
return undefined;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
// TypeScript property declarations are elided. However their names are still visited, and can potentially be retained if they could have sideeffects
return visitPropertyDeclaration(node);
- case 247 /* NamespaceExportDeclaration */:
+ case 248 /* NamespaceExportDeclaration */:
// TypeScript namespace export declarations are elided.
return undefined;
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return visitConstructor(node);
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
// TypeScript interfaces are elided, but some comments may be preserved.
// See the implementation of `getLeadingComments` in comments.ts for more details.
return ts.createNotEmittedStatement(node);
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
// This may be a class declaration with TypeScript syntax extensions.
//
// TypeScript class syntax extensions include:
@@ -67636,7 +68456,7 @@
// - index signatures
// - method overload signatures
return visitClassDeclaration(node);
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
// This may be a class expression with TypeScript syntax extensions.
//
// TypeScript class syntax extensions include:
@@ -67647,35 +68467,35 @@
// - index signatures
// - method overload signatures
return visitClassExpression(node);
- case 273 /* HeritageClause */:
+ case 274 /* HeritageClause */:
// This may be a heritage clause with TypeScript syntax extensions.
//
// TypeScript heritage clause extensions include:
// - `implements` clause
return visitHeritageClause(node);
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
// TypeScript supports type arguments on an expression in an `extends` heritage clause.
return visitExpressionWithTypeArguments(node);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
// TypeScript method declarations may have decorators, modifiers
// or type annotations.
return visitMethodDeclaration(node);
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
// Get Accessors can have TypeScript modifiers, decorators, and type annotations.
return visitGetAccessor(node);
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
// Set Accessors can have TypeScript modifiers and type annotations.
return visitSetAccessor(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
// Typescript function declarations can have modifiers, decorators, and type annotations.
return visitFunctionDeclaration(node);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
// TypeScript function expressions can have modifiers and type annotations.
return visitFunctionExpression(node);
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
// TypeScript arrow functions can have modifiers and type annotations.
return visitArrowFunction(node);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
// This may be a parameter declaration with TypeScript syntax extensions.
//
// TypeScript parameter declaration syntax extensions include:
@@ -67685,35 +68505,35 @@
// - type annotations
// - this parameters
return visitParameter(node);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
// ParenthesizedExpressions are TypeScript if their expression is a
// TypeAssertion or AsExpression
return visitParenthesizedExpression(node);
- case 194 /* TypeAssertionExpression */:
- case 212 /* AsExpression */:
+ case 195 /* TypeAssertionExpression */:
+ case 213 /* AsExpression */:
// TypeScript type assertions are removed, but their subtrees are preserved.
return visitAssertionExpression(node);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return visitCallExpression(node);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return visitNewExpression(node);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return visitTaggedTemplateExpression(node);
- case 213 /* NonNullExpression */:
+ case 214 /* NonNullExpression */:
// TypeScript non-null expressions are removed, but their subtrees are preserved.
return visitNonNullExpression(node);
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
// TypeScript enum declarations do not exist in ES6 and must be rewritten.
return visitEnumDeclaration(node);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
// TypeScript namespace exports for variable statements must be transformed.
return visitVariableStatement(node);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return visitVariableDeclaration(node);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
// TypeScript namespace declarations must be transformed.
return visitModuleDeclaration(node);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
// TypeScript namespace or external module import.
return visitImportEqualsDeclaration(node);
default:
@@ -67751,7 +68571,7 @@
if (ts.some(staticProperties))
facts |= 1 /* HasStaticInitializedProperties */;
var extendsClauseElement = ts.getEffectiveBaseTypeNode(node);
- if (extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 96 /* NullKeyword */)
+ if (extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 97 /* NullKeyword */)
facts |= 64 /* IsDerivedClass */;
if (shouldEmitDecorateCallForClass(node))
facts |= 2 /* HasConstructorDecorators */;
@@ -68017,7 +68837,7 @@
pendingExpressions = undefined;
var staticProperties = getInitializedProperties(node, /*isStatic*/ true);
var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause);
- var members = transformClassMembers(node, ts.some(heritageClauses, function (c) { return c.token === 86 /* ExtendsKeyword */; }));
+ var members = transformClassMembers(node, ts.some(heritageClauses, function (c) { return c.token === 87 /* ExtendsKeyword */; }));
var classExpression = ts.createClassExpression(
/*modifiers*/ undefined, node.name,
/*typeParameters*/ undefined, heritageClauses, members);
@@ -68193,7 +69013,7 @@
return index;
}
var statement = statements[index];
- if (statement.kind === 221 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) {
+ if (statement.kind === 222 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) {
result.push(ts.visitNode(statement, visitor, ts.isStatement));
return index + 1;
}
@@ -68264,7 +69084,7 @@
* @param isStatic A value indicating whether the member should be a static or instance member.
*/
function isInitializedProperty(member, isStatic) {
- return member.kind === 154 /* PropertyDeclaration */
+ return member.kind === 155 /* PropertyDeclaration */
&& isStatic === ts.hasModifier(member, 32 /* Static */)
&& member.initializer !== undefined;
}
@@ -68275,8 +69095,8 @@
* @param receiver The receiver on which each property should be assigned.
*/
function addInitializedPropertyStatements(statements, properties, receiver) {
- for (var _i = 0, properties_8 = properties; _i < properties_8.length; _i++) {
- var property = properties_8[_i];
+ for (var _i = 0, properties_6 = properties; _i < properties_6.length; _i++) {
+ var property = properties_6[_i];
var statement = ts.createExpressionStatement(transformInitializedProperty(property, receiver));
ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property));
ts.setCommentRange(statement, property);
@@ -68292,8 +69112,8 @@
*/
function generateInitializedPropertyExpressions(properties, receiver) {
var expressions = [];
- for (var _i = 0, properties_9 = properties; _i < properties_9.length; _i++) {
- var property = properties_9[_i];
+ for (var _i = 0, properties_7 = properties; _i < properties_7.length; _i++) {
+ var property = properties_7[_i];
var expression = transformInitializedProperty(property, receiver);
ts.startOnNewLine(expression);
ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property));
@@ -68407,12 +69227,12 @@
*/
function getAllDecoratorsOfClassElement(node, member) {
switch (member.kind) {
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return getAllDecoratorsOfAccessors(node, member);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return getAllDecoratorsOfMethod(member);
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return getAllDecoratorsOfProperty(member);
default:
return undefined;
@@ -68565,7 +69385,7 @@
var prefix = getClassMemberPrefix(node, member);
var memberName = getExpressionForPropertyName(member, /*generateNameForComputedPropertyName*/ true);
var descriptor = languageVersion > 0 /* ES3 */
- ? member.kind === 154 /* PropertyDeclaration */
+ ? member.kind === 155 /* PropertyDeclaration */
// We emit `void 0` here to indicate to `__decorate` that it can invoke `Object.defineProperty` directly, but that it
// should not invoke `Object.getOwnPropertyDescriptor`.
? ts.createVoidZero()
@@ -68688,10 +69508,10 @@
*/
function shouldAddTypeMetadata(node) {
var kind = node.kind;
- return kind === 156 /* MethodDeclaration */
- || kind === 158 /* GetAccessor */
- || kind === 159 /* SetAccessor */
- || kind === 154 /* PropertyDeclaration */;
+ return kind === 157 /* MethodDeclaration */
+ || kind === 159 /* GetAccessor */
+ || kind === 160 /* SetAccessor */
+ || kind === 155 /* PropertyDeclaration */;
}
/**
* Determines whether to emit the "design:returntype" metadata based on the node's kind.
@@ -68701,7 +69521,7 @@
* @param node The node to test.
*/
function shouldAddReturnTypeMetadata(node) {
- return node.kind === 156 /* MethodDeclaration */;
+ return node.kind === 157 /* MethodDeclaration */;
}
/**
* Determines whether to emit the "design:paramtypes" metadata based on the node's kind.
@@ -68712,12 +69532,12 @@
*/
function shouldAddParamTypesMetadata(node) {
switch (node.kind) {
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
return ts.getFirstConstructorWithBody(node) !== undefined;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return true;
}
return false;
@@ -68734,15 +69554,15 @@
*/
function serializeTypeOfNode(node) {
switch (node.kind) {
- case 154 /* PropertyDeclaration */:
- case 151 /* Parameter */:
+ case 155 /* PropertyDeclaration */:
+ case 152 /* Parameter */:
return serializeTypeNode(node.type);
- case 159 /* SetAccessor */:
- case 158 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 159 /* GetAccessor */:
return serializeTypeNode(getAccessorTypeNode(node));
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 156 /* MethodDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 157 /* MethodDeclaration */:
return ts.createIdentifier("Function");
default:
return ts.createVoidZero();
@@ -68779,7 +69599,7 @@
return ts.createArrayLiteral(expressions);
}
function getParametersOfDecoratedDeclaration(node, container) {
- if (container && node.kind === 158 /* GetAccessor */) {
+ if (container && node.kind === 159 /* GetAccessor */) {
var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor;
if (setAccessor) {
return setAccessor.parameters;
@@ -68824,69 +69644,69 @@
return ts.createIdentifier("Object");
}
switch (node.kind) {
- case 106 /* VoidKeyword */:
- case 141 /* UndefinedKeyword */:
- case 96 /* NullKeyword */:
- case 132 /* NeverKeyword */:
+ case 107 /* VoidKeyword */:
+ case 142 /* UndefinedKeyword */:
+ case 97 /* NullKeyword */:
+ case 133 /* NeverKeyword */:
return ts.createVoidZero();
- case 177 /* ParenthesizedType */:
+ case 178 /* ParenthesizedType */:
return serializeTypeNode(node.type);
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
return ts.createIdentifier("Function");
- case 169 /* ArrayType */:
- case 170 /* TupleType */:
+ case 170 /* ArrayType */:
+ case 171 /* TupleType */:
return ts.createIdentifier("Array");
- case 163 /* TypePredicate */:
- case 123 /* BooleanKeyword */:
+ case 164 /* TypePredicate */:
+ case 124 /* BooleanKeyword */:
return ts.createIdentifier("Boolean");
- case 138 /* StringKeyword */:
+ case 139 /* StringKeyword */:
return ts.createIdentifier("String");
- case 136 /* ObjectKeyword */:
+ case 137 /* ObjectKeyword */:
return ts.createIdentifier("Object");
- case 182 /* LiteralType */:
+ case 183 /* LiteralType */:
switch (node.literal.kind) {
case 10 /* StringLiteral */:
return ts.createIdentifier("String");
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
case 8 /* NumericLiteral */:
return ts.createIdentifier("Number");
case 9 /* BigIntLiteral */:
return getGlobalBigIntNameWithFallback();
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
return ts.createIdentifier("Boolean");
default:
return ts.Debug.failBadSyntaxKind(node.literal);
}
- case 135 /* NumberKeyword */:
+ case 136 /* NumberKeyword */:
return ts.createIdentifier("Number");
- case 146 /* BigIntKeyword */:
+ case 147 /* BigIntKeyword */:
return getGlobalBigIntNameWithFallback();
- case 139 /* SymbolKeyword */:
+ case 140 /* SymbolKeyword */:
return languageVersion < 2 /* ES2015 */
? getGlobalSymbolNameWithFallback()
: ts.createIdentifier("Symbol");
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return serializeTypeReferenceNode(node);
- case 174 /* IntersectionType */:
- case 173 /* UnionType */:
+ case 175 /* IntersectionType */:
+ case 174 /* UnionType */:
return serializeTypeList(node.types);
- case 175 /* ConditionalType */:
+ case 176 /* ConditionalType */:
return serializeTypeList([node.trueType, node.falseType]);
- case 179 /* TypeOperator */:
- if (node.operator === 133 /* ReadonlyKeyword */) {
+ case 180 /* TypeOperator */:
+ if (node.operator === 134 /* ReadonlyKeyword */) {
return serializeTypeNode(node.type);
}
break;
- case 167 /* TypeQuery */:
- case 180 /* IndexedAccessType */:
- case 181 /* MappedType */:
- case 168 /* TypeLiteral */:
- case 120 /* AnyKeyword */:
- case 143 /* UnknownKeyword */:
- case 178 /* ThisType */:
- case 183 /* ImportType */:
+ case 168 /* TypeQuery */:
+ case 181 /* IndexedAccessType */:
+ case 182 /* MappedType */:
+ case 169 /* TypeLiteral */:
+ case 121 /* AnyKeyword */:
+ case 144 /* UnknownKeyword */:
+ case 179 /* ThisType */:
+ case 184 /* ImportType */:
break;
default:
return ts.Debug.failBadSyntaxKind(node);
@@ -68897,15 +69717,15 @@
// Note when updating logic here also update getEntityNameForDecoratorMetadata
// so that aliases can be marked as referenced
var serializedUnion;
- for (var _i = 0, types_18 = types; _i < types_18.length; _i++) {
- var typeNode = types_18[_i];
- while (typeNode.kind === 177 /* ParenthesizedType */) {
+ for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
+ var typeNode = types_17[_i];
+ while (typeNode.kind === 178 /* ParenthesizedType */) {
typeNode = typeNode.type; // Skip parens if need be
}
- if (typeNode.kind === 132 /* NeverKeyword */) {
+ if (typeNode.kind === 133 /* NeverKeyword */) {
continue; // Always elide `never` from the union/intersection if possible
}
- if (!strictNullChecks && (typeNode.kind === 96 /* NullKeyword */ || typeNode.kind === 141 /* UndefinedKeyword */)) {
+ if (!strictNullChecks && (typeNode.kind === 97 /* NullKeyword */ || typeNode.kind === 142 /* UndefinedKeyword */)) {
continue; // Elide null and undefined from unions for metadata, just like what we did prior to the implementation of strict null checks
}
var serializedIndividual = serializeTypeNode(typeNode);
@@ -68985,12 +69805,12 @@
* @param node The entity name to serialize.
*/
function serializeEntityNameAsExpressionFallback(node) {
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
// A -> typeof A !== undefined && A
var copied = serializeEntityNameAsExpression(node);
return createCheckedValue(copied, copied);
}
- if (node.left.kind === 72 /* Identifier */) {
+ if (node.left.kind === 73 /* Identifier */) {
// A.B -> typeof A !== undefined && A.B
return createCheckedValue(serializeEntityNameAsExpression(node.left), serializeEntityNameAsExpression(node));
}
@@ -69006,7 +69826,7 @@
*/
function serializeEntityNameAsExpression(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
// Create a clone of the name with a new parent, and treat it as if it were
// a source tree node for the purposes of the checker.
var name = ts.getMutableClone(node);
@@ -69014,7 +69834,7 @@
name.original = undefined;
name.parent = ts.getParseTreeNode(currentLexicalScope); // ensure the parent is set to a parse tree node.
return name;
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
return serializeQualifiedNameAsExpression(node);
}
}
@@ -69040,7 +69860,7 @@
* available.
*/
function getGlobalBigIntNameWithFallback() {
- return languageVersion < 7 /* ESNext */
+ return languageVersion < 8 /* ESNext */
? ts.createConditional(ts.createTypeCheck(ts.createIdentifier("BigInt"), "function"), ts.createIdentifier("BigInt"), ts.createIdentifier("Object"))
: ts.createIdentifier("BigInt");
}
@@ -69124,7 +69944,7 @@
* @param node The HeritageClause to transform.
*/
function visitHeritageClause(node) {
- if (node.token === 109 /* ImplementsKeyword */) {
+ if (node.token === 110 /* ImplementsKeyword */) {
// implements clauses are elided
return undefined;
}
@@ -69363,7 +70183,7 @@
*/
function visitEnumDeclaration(node) {
if (!shouldEmitEnumDeclaration(node)) {
- return undefined;
+ return ts.createNotEmittedStatement(node);
}
var statements = [];
// We request to be advised when the printer is about to print this node. This allows
@@ -69531,12 +70351,12 @@
// enums in any other scope are emitted as a `let` declaration.
var statement = ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([
ts.createVariableDeclaration(ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true))
- ], currentLexicalScope.kind === 284 /* SourceFile */ ? 0 /* None */ : 1 /* Let */));
+ ], currentLexicalScope.kind === 285 /* SourceFile */ ? 0 /* None */ : 1 /* Let */));
ts.setOriginalNode(statement, node);
recordEmittedDeclarationInScope(node);
if (isFirstEmittedDeclarationInScope(node)) {
// Adjust the source map emit to match the old emitter.
- if (node.kind === 243 /* EnumDeclaration */) {
+ if (node.kind === 244 /* EnumDeclaration */) {
ts.setSourceMapRange(statement.declarationList, node);
}
else {
@@ -69661,7 +70481,7 @@
var statementsLocation;
var blockLocation;
var body = node.body;
- if (body.kind === 245 /* ModuleBlock */) {
+ if (body.kind === 246 /* ModuleBlock */) {
saveStateAndInvoke(body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); });
statementsLocation = body.statements;
blockLocation = body;
@@ -69707,13 +70527,13 @@
// })(hi = hello.hi || (hello.hi = {}));
// })(hello || (hello = {}));
// We only want to emit comment on the namespace which contains block body itself, not the containing namespaces.
- if (body.kind !== 245 /* ModuleBlock */) {
+ if (body.kind !== 246 /* ModuleBlock */) {
ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536 /* NoComments */);
}
return block;
}
function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) {
- if (moduleDeclaration.body.kind === 244 /* ModuleDeclaration */) {
+ if (moduleDeclaration.body.kind === 245 /* ModuleDeclaration */) {
var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body);
return recursiveInnerModule || moduleDeclaration.body;
}
@@ -69754,7 +70574,7 @@
* @param node The named import bindings node.
*/
function visitNamedImportBindings(node) {
- if (node.kind === 251 /* NamespaceImport */) {
+ if (node.kind === 252 /* NamespaceImport */) {
// Elide a namespace import if it is not referenced.
return resolver.isReferencedAliasDeclaration(node) ? node : undefined;
}
@@ -69967,7 +70787,7 @@
function enableSubstitutionForNonQualifiedEnumMembers() {
if ((enabledSubstitutions & 8 /* NonQualifiedEnumMembers */) === 0) {
enabledSubstitutions |= 8 /* NonQualifiedEnumMembers */;
- context.enableSubstitution(72 /* Identifier */);
+ context.enableSubstitution(73 /* Identifier */);
}
}
function enableSubstitutionForClassAliases() {
@@ -69975,7 +70795,7 @@
enabledSubstitutions |= 1 /* ClassAliases */;
// We need to enable substitutions for identifiers. This allows us to
// substitute class names inside of a class declaration.
- context.enableSubstitution(72 /* Identifier */);
+ context.enableSubstitution(73 /* Identifier */);
// Keep track of class aliases.
classAliases = [];
}
@@ -69985,17 +70805,17 @@
enabledSubstitutions |= 2 /* NamespaceExports */;
// We need to enable substitutions for identifiers and shorthand property assignments. This allows us to
// substitute the names of exported members of a namespace.
- context.enableSubstitution(72 /* Identifier */);
- context.enableSubstitution(276 /* ShorthandPropertyAssignment */);
+ context.enableSubstitution(73 /* Identifier */);
+ context.enableSubstitution(277 /* ShorthandPropertyAssignment */);
// We need to be notified when entering and exiting namespaces.
- context.enableEmitNotification(244 /* ModuleDeclaration */);
+ context.enableEmitNotification(245 /* ModuleDeclaration */);
}
}
function isTransformedModuleDeclaration(node) {
- return ts.getOriginalNode(node).kind === 244 /* ModuleDeclaration */;
+ return ts.getOriginalNode(node).kind === 245 /* ModuleDeclaration */;
}
function isTransformedEnumDeclaration(node) {
- return ts.getOriginalNode(node).kind === 243 /* EnumDeclaration */;
+ return ts.getOriginalNode(node).kind === 244 /* EnumDeclaration */;
}
/**
* Hook for node emit.
@@ -70054,11 +70874,11 @@
}
function substituteExpression(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return substituteExpressionIdentifier(node);
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return substitutePropertyAccessExpression(node);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return substituteElementAccessExpression(node);
}
return node;
@@ -70096,9 +70916,9 @@
// If we are nested within a namespace declaration, we may need to qualifiy
// an identifier that is exported from a merged namespace.
var container = resolver.getReferencedExportContainer(node, /*prefixLocals*/ false);
- if (container && container.kind !== 284 /* SourceFile */) {
- var substitute = (applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 244 /* ModuleDeclaration */) ||
- (applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 243 /* EnumDeclaration */);
+ if (container && container.kind !== 285 /* SourceFile */) {
+ var substitute = (applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 245 /* ModuleDeclaration */) ||
+ (applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 244 /* EnumDeclaration */);
if (substitute) {
return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node),
/*location*/ node);
@@ -70238,26 +71058,26 @@
return node;
}
switch (node.kind) {
- case 121 /* AsyncKeyword */:
+ case 122 /* AsyncKeyword */:
// ES2017 async modifier should be elided for targets < ES2017
return undefined;
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
return visitAwaitExpression(node);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return visitMethodDeclaration(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return visitFunctionDeclaration(node);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return visitFunctionExpression(node);
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return visitArrowFunction(node);
- case 189 /* PropertyAccessExpression */:
- if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 98 /* SuperKeyword */) {
+ case 190 /* PropertyAccessExpression */:
+ if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 99 /* SuperKeyword */) {
capturedSuperProperties.set(node.name.escapedText, true);
}
return ts.visitEachChild(node, visitor, context);
- case 190 /* ElementAccessExpression */:
- if (capturedSuperProperties && node.expression.kind === 98 /* SuperKeyword */) {
+ case 191 /* ElementAccessExpression */:
+ if (capturedSuperProperties && node.expression.kind === 99 /* SuperKeyword */) {
hasSuperElementAccess = true;
}
return ts.visitEachChild(node, visitor, context);
@@ -70268,27 +71088,27 @@
function asyncBodyVisitor(node) {
if (ts.isNodeWithPossibleHoistedDeclaration(node)) {
switch (node.kind) {
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return visitVariableStatementInAsyncBody(node);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return visitForStatementInAsyncBody(node);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return visitForInStatementInAsyncBody(node);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return visitForOfStatementInAsyncBody(node);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return visitCatchClauseInAsyncBody(node);
- case 218 /* Block */:
- case 232 /* SwitchStatement */:
- case 246 /* CaseBlock */:
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
- case 235 /* TryStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
- case 222 /* IfStatement */:
- case 231 /* WithStatement */:
- case 233 /* LabeledStatement */:
+ case 219 /* Block */:
+ case 233 /* SwitchStatement */:
+ case 247 /* CaseBlock */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
+ case 236 /* TryStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
+ case 223 /* IfStatement */:
+ case 232 /* WithStatement */:
+ case 234 /* LabeledStatement */:
return ts.visitEachChild(node, asyncBodyVisitor, context);
default:
return ts.Debug.assertNever(node, "Unhandled node.");
@@ -70489,7 +71309,7 @@
var original = ts.getOriginalNode(node, ts.isFunctionLike);
var nodeType = original.type;
var promiseConstructor = languageVersion < 2 /* ES2015 */ ? getPromiseConstructor(nodeType) : undefined;
- var isArrowFunction = node.kind === 197 /* ArrowFunction */;
+ var isArrowFunction = node.kind === 198 /* ArrowFunction */;
var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192 /* CaptureArguments */) !== 0;
// An async function is emit as an outer function that calls an inner
// generator function. To preserve lexical bindings, we pass the current
@@ -70580,17 +71400,17 @@
enabledSubstitutions |= 1 /* AsyncMethodsWithSuper */;
// We need to enable substitutions for call, property access, and element access
// if we need to rewrite super calls.
- context.enableSubstitution(191 /* CallExpression */);
- context.enableSubstitution(189 /* PropertyAccessExpression */);
- context.enableSubstitution(190 /* ElementAccessExpression */);
+ context.enableSubstitution(192 /* CallExpression */);
+ context.enableSubstitution(190 /* PropertyAccessExpression */);
+ context.enableSubstitution(191 /* ElementAccessExpression */);
// We need to be notified when entering and exiting declarations that bind super.
- context.enableEmitNotification(240 /* ClassDeclaration */);
- context.enableEmitNotification(156 /* MethodDeclaration */);
- context.enableEmitNotification(158 /* GetAccessor */);
- context.enableEmitNotification(159 /* SetAccessor */);
- context.enableEmitNotification(157 /* Constructor */);
+ context.enableEmitNotification(241 /* ClassDeclaration */);
+ context.enableEmitNotification(157 /* MethodDeclaration */);
+ context.enableEmitNotification(159 /* GetAccessor */);
+ context.enableEmitNotification(160 /* SetAccessor */);
+ context.enableEmitNotification(158 /* Constructor */);
// We need to be notified when entering the generated accessor arrow functions.
- context.enableEmitNotification(219 /* VariableStatement */);
+ context.enableEmitNotification(220 /* VariableStatement */);
}
}
/**
@@ -70638,23 +71458,23 @@
}
function substituteExpression(node) {
switch (node.kind) {
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return substitutePropertyAccessExpression(node);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return substituteElementAccessExpression(node);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return substituteCallExpression(node);
}
return node;
}
function substitutePropertyAccessExpression(node) {
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
return ts.setTextRange(ts.createPropertyAccess(ts.createFileLevelUniqueName("_super"), node.name), node);
}
return node;
}
function substituteElementAccessExpression(node) {
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
return createSuperElementAccessInAsyncMethod(node.argumentExpression, node);
}
return node;
@@ -70674,11 +71494,11 @@
}
function isSuperContainer(node) {
var kind = node.kind;
- return kind === 240 /* ClassDeclaration */
- || kind === 157 /* Constructor */
- || kind === 156 /* MethodDeclaration */
- || kind === 158 /* GetAccessor */
- || kind === 159 /* SetAccessor */;
+ return kind === 241 /* ClassDeclaration */
+ || kind === 158 /* Constructor */
+ || kind === 157 /* MethodDeclaration */
+ || kind === 159 /* GetAccessor */
+ || kind === 160 /* SetAccessor */;
}
function createSuperElementAccessInAsyncMethod(argumentExpression, location) {
if (enclosingSuperContainerFlags & 4096 /* AsyncMethodWithSuperBinding */) {
@@ -70813,7 +71633,7 @@
return visitorWorker(node, /*noDestructuringValue*/ true);
}
function visitorNoAsyncModifier(node) {
- if (node.kind === 121 /* AsyncKeyword */) {
+ if (node.kind === 122 /* AsyncKeyword */) {
return undefined;
}
return node;
@@ -70823,53 +71643,55 @@
return node;
}
switch (node.kind) {
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
return visitAwaitExpression(node);
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return visitYieldExpression(node);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return visitReturnStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return visitLabeledStatement(node);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return visitObjectLiteralExpression(node);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return visitBinaryExpression(node, noDestructuringValue);
- case 237 /* VariableDeclaration */:
+ case 275 /* CatchClause */:
+ return visitCatchClause(node);
+ case 238 /* VariableDeclaration */:
return visitVariableDeclaration(node);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return visitForStatement(node);
- case 200 /* VoidExpression */:
+ case 201 /* VoidExpression */:
return visitVoidExpression(node);
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return visitConstructorDeclaration(node);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return visitMethodDeclaration(node);
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
return visitGetAccessorDeclaration(node);
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
return visitSetAccessorDeclaration(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return visitFunctionDeclaration(node);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return visitFunctionExpression(node);
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return visitArrowFunction(node);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return visitParameter(node);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return visitExpressionStatement(node);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return visitParenthesizedExpression(node, noDestructuringValue);
- case 189 /* PropertyAccessExpression */:
- if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 98 /* SuperKeyword */) {
+ case 190 /* PropertyAccessExpression */:
+ if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 99 /* SuperKeyword */) {
capturedSuperProperties.set(node.name.escapedText, true);
}
return ts.visitEachChild(node, visitor, context);
- case 190 /* ElementAccessExpression */:
- if (capturedSuperProperties && node.expression.kind === 98 /* SuperKeyword */) {
+ case 191 /* ElementAccessExpression */:
+ if (capturedSuperProperties && node.expression.kind === 99 /* SuperKeyword */) {
hasSuperElementAccess = true;
}
return ts.visitEachChild(node, visitor, context);
@@ -70905,7 +71727,7 @@
function visitLabeledStatement(node) {
if (enclosingFunctionFlags & 2 /* Async */) {
var statement = ts.unwrapInnermostStatementOfLabel(node);
- if (statement.kind === 227 /* ForOfStatement */ && statement.awaitModifier) {
+ if (statement.kind === 228 /* ForOfStatement */ && statement.awaitModifier) {
return visitForOfStatement(statement, node);
}
return ts.restoreEnclosingLabel(ts.visitEachChild(statement, visitor, context), node);
@@ -70917,7 +71739,7 @@
var objects = [];
for (var _i = 0, elements_4 = elements; _i < elements_4.length; _i++) {
var e = elements_4[_i];
- if (e.kind === 277 /* SpreadAssignment */) {
+ if (e.kind === 278 /* SpreadAssignment */) {
if (chunkObject) {
objects.push(ts.createObjectLiteral(chunkObject));
chunkObject = undefined;
@@ -70926,7 +71748,7 @@
objects.push(ts.visitNode(target, visitor, ts.isExpression));
}
else {
- chunkObject = ts.append(chunkObject, e.kind === 275 /* PropertyAssignment */
+ chunkObject = ts.append(chunkObject, e.kind === 276 /* PropertyAssignment */
? ts.createPropertyAssignment(e.name, ts.visitNode(e.initializer, visitor, ts.isExpression))
: ts.visitNode(e, visitor, ts.isObjectLiteralElementLike));
}
@@ -70944,7 +71766,7 @@
// If the first element is a spread element, then the first argument to __assign is {}:
// { ...o, a, b, ...o2 } => __assign({}, o, {a, b}, o2)
var objects = chunkObjectLiteralElements(node.properties);
- if (objects.length && objects[0].kind !== 188 /* ObjectLiteralExpression */) {
+ if (objects.length && objects[0].kind !== 189 /* ObjectLiteralExpression */) {
objects.unshift(ts.createObjectLiteral());
}
return createAssignHelper(context, objects);
@@ -70971,6 +71793,23 @@
}
return ts.visitEachChild(node, visitor, context);
}
+ function visitCatchClause(node) {
+ if (node.variableDeclaration &&
+ ts.isBindingPattern(node.variableDeclaration.name) &&
+ node.variableDeclaration.name.transformFlags & 8192 /* ContainsObjectRestOrSpread */) {
+ var name = ts.getGeneratedNameForNode(node.variableDeclaration.name);
+ var updatedDecl = ts.updateVariableDeclaration(node.variableDeclaration, node.variableDeclaration.name, /*type*/ undefined, name);
+ var visitedBindings = ts.flattenDestructuringBinding(updatedDecl, visitor, context, 1 /* ObjectRest */);
+ var block = ts.visitNode(node.block, visitor, ts.isBlock);
+ if (ts.some(visitedBindings)) {
+ block = ts.updateBlock(block, [
+ ts.createVariableStatement(/*modifiers*/ undefined, visitedBindings)
+ ].concat(block.statements));
+ }
+ return ts.updateCatchClause(node, ts.updateVariableDeclaration(node.variableDeclaration, name, /*type*/ undefined, /*initializer*/ undefined), block);
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
/**
* Visits a VariableDeclaration node with a binding pattern.
*
@@ -71263,17 +72102,17 @@
enabledSubstitutions |= 1 /* AsyncMethodsWithSuper */;
// We need to enable substitutions for call, property access, and element access
// if we need to rewrite super calls.
- context.enableSubstitution(191 /* CallExpression */);
- context.enableSubstitution(189 /* PropertyAccessExpression */);
- context.enableSubstitution(190 /* ElementAccessExpression */);
+ context.enableSubstitution(192 /* CallExpression */);
+ context.enableSubstitution(190 /* PropertyAccessExpression */);
+ context.enableSubstitution(191 /* ElementAccessExpression */);
// We need to be notified when entering and exiting declarations that bind super.
- context.enableEmitNotification(240 /* ClassDeclaration */);
- context.enableEmitNotification(156 /* MethodDeclaration */);
- context.enableEmitNotification(158 /* GetAccessor */);
- context.enableEmitNotification(159 /* SetAccessor */);
- context.enableEmitNotification(157 /* Constructor */);
+ context.enableEmitNotification(241 /* ClassDeclaration */);
+ context.enableEmitNotification(157 /* MethodDeclaration */);
+ context.enableEmitNotification(159 /* GetAccessor */);
+ context.enableEmitNotification(160 /* SetAccessor */);
+ context.enableEmitNotification(158 /* Constructor */);
// We need to be notified when entering the generated accessor arrow functions.
- context.enableEmitNotification(219 /* VariableStatement */);
+ context.enableEmitNotification(220 /* VariableStatement */);
}
}
/**
@@ -71321,23 +72160,23 @@
}
function substituteExpression(node) {
switch (node.kind) {
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return substitutePropertyAccessExpression(node);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return substituteElementAccessExpression(node);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return substituteCallExpression(node);
}
return node;
}
function substitutePropertyAccessExpression(node) {
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
return ts.setTextRange(ts.createPropertyAccess(ts.createFileLevelUniqueName("_super"), node.name), node);
}
return node;
}
function substituteElementAccessExpression(node) {
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
return createSuperElementAccessInAsyncMethod(node.argumentExpression, node);
}
return node;
@@ -71357,11 +72196,11 @@
}
function isSuperContainer(node) {
var kind = node.kind;
- return kind === 240 /* ClassDeclaration */
- || kind === 157 /* Constructor */
- || kind === 156 /* MethodDeclaration */
- || kind === 158 /* GetAccessor */
- || kind === 159 /* SetAccessor */;
+ return kind === 241 /* ClassDeclaration */
+ || kind === 158 /* Constructor */
+ || kind === 157 /* MethodDeclaration */
+ || kind === 159 /* GetAccessor */
+ || kind === 160 /* SetAccessor */;
}
function createSuperElementAccessInAsyncMethod(argumentExpression, location) {
if (enclosingSuperContainerFlags & 4096 /* AsyncMethodWithSuperBinding */) {
@@ -71455,7 +72294,7 @@
return node;
}
switch (node.kind) {
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return visitCatchClause(node);
default:
return ts.visitEachChild(node, visitor, context);
@@ -71524,13 +72363,13 @@
}
function visitorWorker(node) {
switch (node.kind) {
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
return visitJsxElement(node, /*isChild*/ false);
- case 261 /* JsxSelfClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
return visitJsxSelfClosingElement(node, /*isChild*/ false);
- case 264 /* JsxFragment */:
+ case 265 /* JsxFragment */:
return visitJsxFragment(node, /*isChild*/ false);
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return visitJsxExpression(node);
default:
return ts.visitEachChild(node, visitor, context);
@@ -71540,13 +72379,13 @@
switch (node.kind) {
case 11 /* JsxText */:
return visitJsxText(node);
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return visitJsxExpression(node);
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
return visitJsxElement(node, /*isChild*/ true);
- case 261 /* JsxSelfClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
return visitJsxSelfClosingElement(node, /*isChild*/ true);
- case 264 /* JsxFragment */:
+ case 265 /* JsxFragment */:
return visitJsxFragment(node, /*isChild*/ true);
default:
return ts.Debug.failBadSyntaxKind(node);
@@ -71621,7 +72460,7 @@
literal.singleQuote = node.singleQuote !== undefined ? node.singleQuote : !ts.isStringDoubleQuoted(node, currentSourceFile);
return ts.setTextRange(literal, node);
}
- else if (node.kind === 270 /* JsxExpression */) {
+ else if (node.kind === 271 /* JsxExpression */) {
if (node.expression === undefined) {
return ts.createTrue();
}
@@ -71715,7 +72554,7 @@
return decoded === text ? undefined : decoded;
}
function getTagName(node) {
- if (node.kind === 260 /* JsxElement */) {
+ if (node.kind === 261 /* JsxElement */) {
return getTagName(node.openingElement);
}
else {
@@ -72021,7 +72860,7 @@
return node;
}
switch (node.kind) {
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return visitBinaryExpression(node);
default:
return ts.visitEachChild(node, visitor, context);
@@ -72029,7 +72868,7 @@
}
function visitBinaryExpression(node) {
switch (node.operatorToken.kind) {
- case 63 /* AsteriskAsteriskEqualsToken */:
+ case 64 /* AsteriskAsteriskEqualsToken */:
return visitExponentiationAssignmentExpression(node);
case 41 /* AsteriskAsteriskToken */:
return visitExponentiationExpression(node);
@@ -72114,62 +72953,63 @@
HierarchyFacts[HierarchyFacts["Block"] = 128] = "Block";
HierarchyFacts[HierarchyFacts["IterationStatement"] = 256] = "IterationStatement";
HierarchyFacts[HierarchyFacts["IterationStatementBlock"] = 512] = "IterationStatementBlock";
- HierarchyFacts[HierarchyFacts["ForStatement"] = 1024] = "ForStatement";
- HierarchyFacts[HierarchyFacts["ForInOrForOfStatement"] = 2048] = "ForInOrForOfStatement";
- HierarchyFacts[HierarchyFacts["ConstructorWithCapturedSuper"] = 4096] = "ConstructorWithCapturedSuper";
+ HierarchyFacts[HierarchyFacts["IterationContainer"] = 1024] = "IterationContainer";
+ HierarchyFacts[HierarchyFacts["ForStatement"] = 2048] = "ForStatement";
+ HierarchyFacts[HierarchyFacts["ForInOrForOfStatement"] = 4096] = "ForInOrForOfStatement";
+ HierarchyFacts[HierarchyFacts["ConstructorWithCapturedSuper"] = 8192] = "ConstructorWithCapturedSuper";
// NOTE: do not add more ancestor flags without also updating AncestorFactsMask below.
// NOTE: when adding a new ancestor flag, be sure to update the subtree flags below.
//
// Ancestor masks
//
- HierarchyFacts[HierarchyFacts["AncestorFactsMask"] = 8191] = "AncestorFactsMask";
+ HierarchyFacts[HierarchyFacts["AncestorFactsMask"] = 16383] = "AncestorFactsMask";
// We are always in *some* kind of block scope, but only specific block-scope containers are
// top-level or Blocks.
HierarchyFacts[HierarchyFacts["BlockScopeIncludes"] = 0] = "BlockScopeIncludes";
- HierarchyFacts[HierarchyFacts["BlockScopeExcludes"] = 4032] = "BlockScopeExcludes";
+ HierarchyFacts[HierarchyFacts["BlockScopeExcludes"] = 7104] = "BlockScopeExcludes";
// A source file is a top-level block scope.
HierarchyFacts[HierarchyFacts["SourceFileIncludes"] = 64] = "SourceFileIncludes";
- HierarchyFacts[HierarchyFacts["SourceFileExcludes"] = 3968] = "SourceFileExcludes";
+ HierarchyFacts[HierarchyFacts["SourceFileExcludes"] = 8064] = "SourceFileExcludes";
// Functions, methods, and accessors are both new lexical scopes and new block scopes.
HierarchyFacts[HierarchyFacts["FunctionIncludes"] = 65] = "FunctionIncludes";
- HierarchyFacts[HierarchyFacts["FunctionExcludes"] = 8094] = "FunctionExcludes";
+ HierarchyFacts[HierarchyFacts["FunctionExcludes"] = 16286] = "FunctionExcludes";
HierarchyFacts[HierarchyFacts["AsyncFunctionBodyIncludes"] = 69] = "AsyncFunctionBodyIncludes";
- HierarchyFacts[HierarchyFacts["AsyncFunctionBodyExcludes"] = 8086] = "AsyncFunctionBodyExcludes";
+ HierarchyFacts[HierarchyFacts["AsyncFunctionBodyExcludes"] = 16278] = "AsyncFunctionBodyExcludes";
// Arrow functions are lexically scoped to their container, but are new block scopes.
HierarchyFacts[HierarchyFacts["ArrowFunctionIncludes"] = 66] = "ArrowFunctionIncludes";
- HierarchyFacts[HierarchyFacts["ArrowFunctionExcludes"] = 8064] = "ArrowFunctionExcludes";
+ HierarchyFacts[HierarchyFacts["ArrowFunctionExcludes"] = 15232] = "ArrowFunctionExcludes";
// Constructors are both new lexical scopes and new block scopes. Constructors are also
// always considered non-static members of a class.
HierarchyFacts[HierarchyFacts["ConstructorIncludes"] = 73] = "ConstructorIncludes";
- HierarchyFacts[HierarchyFacts["ConstructorExcludes"] = 8086] = "ConstructorExcludes";
+ HierarchyFacts[HierarchyFacts["ConstructorExcludes"] = 16278] = "ConstructorExcludes";
// 'do' and 'while' statements are not block scopes. We track that the subtree is contained
// within an IterationStatement to indicate whether the embedded statement is an
// IterationStatementBlock.
- HierarchyFacts[HierarchyFacts["DoOrWhileStatementIncludes"] = 256] = "DoOrWhileStatementIncludes";
+ HierarchyFacts[HierarchyFacts["DoOrWhileStatementIncludes"] = 1280] = "DoOrWhileStatementIncludes";
HierarchyFacts[HierarchyFacts["DoOrWhileStatementExcludes"] = 0] = "DoOrWhileStatementExcludes";
// 'for' statements are new block scopes and have special handling for 'let' declarations.
- HierarchyFacts[HierarchyFacts["ForStatementIncludes"] = 1280] = "ForStatementIncludes";
- HierarchyFacts[HierarchyFacts["ForStatementExcludes"] = 3008] = "ForStatementExcludes";
+ HierarchyFacts[HierarchyFacts["ForStatementIncludes"] = 3328] = "ForStatementIncludes";
+ HierarchyFacts[HierarchyFacts["ForStatementExcludes"] = 5056] = "ForStatementExcludes";
// 'for-in' and 'for-of' statements are new block scopes and have special handling for
// 'let' declarations.
- HierarchyFacts[HierarchyFacts["ForInOrForOfStatementIncludes"] = 2304] = "ForInOrForOfStatementIncludes";
- HierarchyFacts[HierarchyFacts["ForInOrForOfStatementExcludes"] = 1984] = "ForInOrForOfStatementExcludes";
+ HierarchyFacts[HierarchyFacts["ForInOrForOfStatementIncludes"] = 5376] = "ForInOrForOfStatementIncludes";
+ HierarchyFacts[HierarchyFacts["ForInOrForOfStatementExcludes"] = 3008] = "ForInOrForOfStatementExcludes";
// Blocks (other than function bodies) are new block scopes.
HierarchyFacts[HierarchyFacts["BlockIncludes"] = 128] = "BlockIncludes";
- HierarchyFacts[HierarchyFacts["BlockExcludes"] = 3904] = "BlockExcludes";
+ HierarchyFacts[HierarchyFacts["BlockExcludes"] = 6976] = "BlockExcludes";
HierarchyFacts[HierarchyFacts["IterationStatementBlockIncludes"] = 512] = "IterationStatementBlockIncludes";
- HierarchyFacts[HierarchyFacts["IterationStatementBlockExcludes"] = 4032] = "IterationStatementBlockExcludes";
+ HierarchyFacts[HierarchyFacts["IterationStatementBlockExcludes"] = 7104] = "IterationStatementBlockExcludes";
//
// Subtree facts
//
- HierarchyFacts[HierarchyFacts["NewTarget"] = 8192] = "NewTarget";
- HierarchyFacts[HierarchyFacts["CapturedLexicalThis"] = 16384] = "CapturedLexicalThis";
+ HierarchyFacts[HierarchyFacts["NewTarget"] = 16384] = "NewTarget";
+ HierarchyFacts[HierarchyFacts["CapturedLexicalThis"] = 32768] = "CapturedLexicalThis";
//
// Subtree masks
//
- HierarchyFacts[HierarchyFacts["SubtreeFactsMask"] = -8192] = "SubtreeFactsMask";
+ HierarchyFacts[HierarchyFacts["SubtreeFactsMask"] = -16384] = "SubtreeFactsMask";
HierarchyFacts[HierarchyFacts["ArrowFunctionSubtreeExcludes"] = 0] = "ArrowFunctionSubtreeExcludes";
- HierarchyFacts[HierarchyFacts["FunctionSubtreeExcludes"] = 24576] = "FunctionSubtreeExcludes";
+ HierarchyFacts[HierarchyFacts["FunctionSubtreeExcludes"] = 49152] = "FunctionSubtreeExcludes";
})(HierarchyFacts || (HierarchyFacts = {}));
function transformES2015(context) {
var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
@@ -72218,7 +73058,7 @@
*/
function enterSubtree(excludeFacts, includeFacts) {
var ancestorFacts = hierarchyFacts;
- hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & 8191 /* AncestorFactsMask */;
+ hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & 16383 /* AncestorFactsMask */;
return ancestorFacts;
}
/**
@@ -72229,17 +73069,17 @@
* @param includeFacts The new `HierarchyFacts` of the subtree that should be propagated.
*/
function exitSubtree(ancestorFacts, excludeFacts, includeFacts) {
- hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & -8192 /* SubtreeFactsMask */ | ancestorFacts;
+ hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & -16384 /* SubtreeFactsMask */ | ancestorFacts;
}
function isReturnVoidStatementInConstructorWithCapturedSuper(node) {
- return (hierarchyFacts & 4096 /* ConstructorWithCapturedSuper */) !== 0
- && node.kind === 230 /* ReturnStatement */
+ return (hierarchyFacts & 8192 /* ConstructorWithCapturedSuper */) !== 0
+ && node.kind === 231 /* ReturnStatement */
&& !node.expression;
}
function shouldVisitNode(node) {
return (node.transformFlags & 128 /* ContainsES2015 */) !== 0
|| convertedLoopState !== undefined
- || (hierarchyFacts & 4096 /* ConstructorWithCapturedSuper */ && (ts.isStatement(node) || (node.kind === 218 /* Block */)))
+ || (hierarchyFacts & 8192 /* ConstructorWithCapturedSuper */ && (ts.isStatement(node) || (node.kind === 219 /* Block */)))
|| (ts.isIterationStatement(node, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatement(node))
|| (ts.getEmitFlags(node) & 33554432 /* TypeScriptClassWrapper */) !== 0;
}
@@ -72252,72 +73092,72 @@
}
}
function callExpressionVisitor(node) {
- if (node.kind === 98 /* SuperKeyword */) {
+ if (node.kind === 99 /* SuperKeyword */) {
return visitSuperKeyword(/*isExpressionOfCall*/ true);
}
return visitor(node);
}
function visitJavaScript(node) {
switch (node.kind) {
- case 116 /* StaticKeyword */:
+ case 117 /* StaticKeyword */:
return undefined; // elide static keyword
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return visitClassDeclaration(node);
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
return visitClassExpression(node);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return visitParameter(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return visitFunctionDeclaration(node);
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return visitArrowFunction(node);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return visitFunctionExpression(node);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return visitVariableDeclaration(node);
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return visitIdentifier(node);
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
return visitVariableDeclarationList(node);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return visitSwitchStatement(node);
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
return visitCaseBlock(node);
- case 218 /* Block */:
+ case 219 /* Block */:
return visitBlock(node, /*isFunctionBody*/ false);
- case 229 /* BreakStatement */:
- case 228 /* ContinueStatement */:
+ case 230 /* BreakStatement */:
+ case 229 /* ContinueStatement */:
return visitBreakOrContinueStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return visitLabeledStatement(node);
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
return visitDoOrWhileStatement(node, /*outermostLabeledStatement*/ undefined);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return visitForStatement(node, /*outermostLabeledStatement*/ undefined);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return visitForInStatement(node, /*outermostLabeledStatement*/ undefined);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return visitExpressionStatement(node);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return visitObjectLiteralExpression(node);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return visitCatchClause(node);
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return visitShorthandPropertyAssignment(node);
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
return visitComputedPropertyName(node);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return visitArrayLiteralExpression(node);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return visitCallExpression(node);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return visitNewExpression(node);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return visitParenthesizedExpression(node, /*needsDestructuringValue*/ true);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return visitBinaryExpression(node, /*needsDestructuringValue*/ true);
case 14 /* NoSubstitutionTemplateLiteral */:
case 15 /* TemplateHead */:
@@ -72328,35 +73168,35 @@
return visitStringLiteral(node);
case 8 /* NumericLiteral */:
return visitNumericLiteral(node);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return visitTaggedTemplateExpression(node);
- case 206 /* TemplateExpression */:
+ case 207 /* TemplateExpression */:
return visitTemplateExpression(node);
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return visitYieldExpression(node);
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
return visitSpreadElement(node);
- case 98 /* SuperKeyword */:
+ case 99 /* SuperKeyword */:
return visitSuperKeyword(/*isExpressionOfCall*/ false);
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
return visitThisKeyword(node);
- case 214 /* MetaProperty */:
+ case 215 /* MetaProperty */:
return visitMetaProperty(node);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return visitMethodDeclaration(node);
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return visitAccessorDeclaration(node);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return visitVariableStatement(node);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return visitReturnStatement(node);
default:
return ts.visitEachChild(node, visitor, context);
}
}
function visitSourceFile(node) {
- var ancestorFacts = enterSubtree(3968 /* SourceFileExcludes */, 64 /* SourceFileIncludes */);
+ var ancestorFacts = enterSubtree(8064 /* SourceFileExcludes */, 64 /* SourceFileIncludes */);
var prologue = [];
var statements = [];
startLexicalEnvironment();
@@ -72383,7 +73223,7 @@
return ts.visitEachChild(node, visitor, context);
}
function visitCaseBlock(node) {
- var ancestorFacts = enterSubtree(4032 /* BlockScopeExcludes */, 0 /* BlockScopeIncludes */);
+ var ancestorFacts = enterSubtree(7104 /* BlockScopeExcludes */, 0 /* BlockScopeIncludes */);
var updated = ts.visitEachChild(node, visitor, context);
exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */);
return updated;
@@ -72410,7 +73250,7 @@
}
function visitThisKeyword(node) {
if (hierarchyFacts & 2 /* ArrowFunction */) {
- hierarchyFacts |= 16384 /* CapturedLexicalThis */;
+ hierarchyFacts |= 32768 /* CapturedLexicalThis */;
}
if (convertedLoopState) {
if (hierarchyFacts & 2 /* ArrowFunction */) {
@@ -72440,14 +73280,14 @@
// it is possible if either
// - break/continue is labeled and label is located inside the converted loop
// - break/continue is non-labeled and located in non-converted loop/switch statement
- var jump = node.kind === 229 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */;
+ var jump = node.kind === 230 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */;
var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels.get(ts.idText(node.label))) ||
(!node.label && (convertedLoopState.allowedNonLabeledJumps & jump));
if (!canUseBreakOrContinue) {
var labelMarker = void 0;
var label = node.label;
if (!label) {
- if (node.kind === 229 /* BreakStatement */) {
+ if (node.kind === 230 /* BreakStatement */) {
convertedLoopState.nonLocalJumps |= 2 /* Break */;
labelMarker = "break";
}
@@ -72458,7 +73298,7 @@
}
}
else {
- if (node.kind === 229 /* BreakStatement */) {
+ if (node.kind === 230 /* BreakStatement */) {
labelMarker = "break-" + label.escapedText;
setLabeledJump(convertedLoopState, /*isBreak*/ true, ts.idText(label), labelMarker);
}
@@ -72653,7 +73493,7 @@
function addConstructor(statements, node, extendsClauseElement) {
var savedConvertedLoopState = convertedLoopState;
convertedLoopState = undefined;
- var ancestorFacts = enterSubtree(8086 /* ConstructorExcludes */, 73 /* ConstructorIncludes */);
+ var ancestorFacts = enterSubtree(16278 /* ConstructorExcludes */, 73 /* ConstructorIncludes */);
var constructor = ts.getFirstConstructorWithBody(node);
var hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== undefined);
var constructorFunction = ts.createFunctionDeclaration(
@@ -72667,7 +73507,7 @@
ts.setEmitFlags(constructorFunction, 8 /* CapturesThis */);
}
statements.push(constructorFunction);
- exitSubtree(ancestorFacts, 24576 /* FunctionSubtreeExcludes */, 0 /* None */);
+ exitSubtree(ancestorFacts, 49152 /* FunctionSubtreeExcludes */, 0 /* None */);
convertedLoopState = savedConvertedLoopState;
}
/**
@@ -72716,7 +73556,7 @@
function transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper) {
// determine whether the class is known syntactically to be a derived class (e.g. a
// class that extends a value that is not syntactically known to be `null`).
- var isDerivedClass = !!extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 96 /* NullKeyword */;
+ var isDerivedClass = !!extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 97 /* NullKeyword */;
// When the subclass does not have a constructor, we synthesize a *default* constructor using the following
// representation:
//
@@ -72760,7 +73600,7 @@
}
}
if (superCallExpression) {
- hierarchyFacts |= 4096 /* ConstructorWithCapturedSuper */;
+ hierarchyFacts |= 8192 /* ConstructorWithCapturedSuper */;
statementOffset++; // skip this statement, we will add it after visiting the rest of the body.
}
// visit the remaining statements
@@ -72854,11 +73694,11 @@
*/
function isSufficientlyCoveredByReturnStatements(statement) {
// A return statement is considered covered.
- if (statement.kind === 230 /* ReturnStatement */) {
+ if (statement.kind === 231 /* ReturnStatement */) {
return true;
}
// An if-statement with two covered branches is covered.
- else if (statement.kind === 222 /* IfStatement */) {
+ else if (statement.kind === 223 /* IfStatement */) {
var ifStatement = statement;
if (ifStatement.elseStatement) {
return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) &&
@@ -72866,7 +73706,7 @@
}
}
// A block is covered if it has a last statement which is covered.
- else if (statement.kind === 218 /* Block */) {
+ else if (statement.kind === 219 /* Block */) {
var lastStatement = ts.lastOrUndefined(statement.statements);
if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) {
return true;
@@ -73021,10 +73861,10 @@
return false;
}
// `declarationName` is the name of the local declaration for the parameter.
- var declarationName = parameter.name.kind === 72 /* Identifier */ ? ts.getMutableClone(parameter.name) : ts.createTempVariable(/*recordTempVariable*/ undefined);
+ var declarationName = parameter.name.kind === 73 /* Identifier */ ? ts.getMutableClone(parameter.name) : ts.createTempVariable(/*recordTempVariable*/ undefined);
ts.setEmitFlags(declarationName, 48 /* NoSourceMap */);
// `expressionName` is the name of the parameter used in expressions.
- var expressionName = parameter.name.kind === 72 /* Identifier */ ? ts.getSynthesizedClone(parameter.name) : declarationName;
+ var expressionName = parameter.name.kind === 73 /* Identifier */ ? ts.getSynthesizedClone(parameter.name) : declarationName;
var restIndex = node.parameters.length - 1;
var temp = ts.createLoopVariable();
// var param = [];
@@ -73048,7 +73888,7 @@
ts.setEmitFlags(forStatement, 1048576 /* CustomPrologue */);
ts.startOnNewLine(forStatement);
prologueStatements.push(forStatement);
- if (parameter.name.kind !== 72 /* Identifier */) {
+ if (parameter.name.kind !== 73 /* Identifier */) {
// do the actual destructuring of the rest parameter if necessary
prologueStatements.push(ts.setEmitFlags(ts.setTextRange(ts.createVariableStatement(
/*modifiers*/ undefined, ts.createVariableDeclarationList(ts.flattenDestructuringBinding(parameter, visitor, context, 0 /* All */, expressionName))), parameter), 1048576 /* CustomPrologue */));
@@ -73064,7 +73904,7 @@
* @param node A node.
*/
function insertCaptureThisForNodeIfNeeded(statements, node) {
- if (hierarchyFacts & 16384 /* CapturedLexicalThis */ && node.kind !== 197 /* ArrowFunction */) {
+ if (hierarchyFacts & 32768 /* CapturedLexicalThis */ && node.kind !== 198 /* ArrowFunction */) {
insertCaptureThisForNode(statements, node, ts.createThis());
return true;
}
@@ -73082,28 +73922,28 @@
ts.insertStatementAfterCustomPrologue(statements, captureThisStatement);
}
function insertCaptureNewTargetIfNeeded(statements, node, copyOnWrite) {
- if (hierarchyFacts & 8192 /* NewTarget */) {
+ if (hierarchyFacts & 16384 /* NewTarget */) {
var newTarget = void 0;
switch (node.kind) {
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return statements;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
// Methods and accessors cannot be constructors, so 'new.target' will
// always return 'undefined'.
newTarget = ts.createVoidZero();
break;
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
// Class constructors can only be called with `new`, so `this.constructor`
// should be relatively safe to use.
newTarget = ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), "constructor");
break;
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
// Functions can be called or constructed, and may have a `this` due to
// being a member or when calling an imported function via `other_1.f()`.
- newTarget = ts.createConditional(ts.createLogicalAnd(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), ts.createBinary(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), 94 /* InstanceOfKeyword */, ts.getLocalName(node))), ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), "constructor"), ts.createVoidZero());
+ newTarget = ts.createConditional(ts.createLogicalAnd(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), ts.createBinary(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), 95 /* InstanceOfKeyword */, ts.getLocalName(node))), ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), "constructor"), ts.createVoidZero());
break;
default:
return ts.Debug.failBadSyntaxKind(node);
@@ -73132,20 +73972,20 @@
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
switch (member.kind) {
- case 217 /* SemicolonClassElement */:
+ case 218 /* SemicolonClassElement */:
statements.push(transformSemicolonClassElementToStatement(member));
break;
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node));
break;
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
var accessors = ts.getAllAccessorDeclarations(node.members, member);
if (member === accessors.firstAccessor) {
statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node));
}
break;
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
// Constructors are handled in visitClassExpression/visitClassDeclaration
break;
default:
@@ -73212,7 +74052,7 @@
// arguments are both mapped contiguously to the accessor name.
var target = ts.getMutableClone(receiver);
ts.setEmitFlags(target, 1536 /* NoComments */ | 32 /* NoTrailingSourceMap */);
- ts.setSourceMapRange(target, firstAccessor.name); // TODO: GH#18217
+ ts.setSourceMapRange(target, firstAccessor.name);
var propertyName = ts.createExpressionForPropertyName(ts.visitNode(firstAccessor.name, visitor, ts.isPropertyName));
ts.setEmitFlags(propertyName, 1536 /* NoComments */ | 16 /* NoLeadingSourceMap */);
ts.setSourceMapRange(propertyName, firstAccessor.name);
@@ -73252,11 +74092,11 @@
*/
function visitArrowFunction(node) {
if (node.transformFlags & 2048 /* ContainsLexicalThis */) {
- hierarchyFacts |= 16384 /* CapturedLexicalThis */;
+ hierarchyFacts |= 32768 /* CapturedLexicalThis */;
}
var savedConvertedLoopState = convertedLoopState;
convertedLoopState = undefined;
- var ancestorFacts = enterSubtree(8064 /* ArrowFunctionExcludes */, 66 /* ArrowFunctionIncludes */);
+ var ancestorFacts = enterSubtree(15232 /* ArrowFunctionExcludes */, 66 /* ArrowFunctionIncludes */);
var func = ts.createFunctionExpression(
/*modifiers*/ undefined,
/*asteriskToken*/ undefined,
@@ -73266,7 +74106,7 @@
ts.setTextRange(func, node);
ts.setOriginalNode(func, node);
ts.setEmitFlags(func, 8 /* CapturesThis */);
- if (hierarchyFacts & 16384 /* CapturedLexicalThis */) {
+ if (hierarchyFacts & 32768 /* CapturedLexicalThis */) {
enableSubstitutionsForCapturedThis();
}
// If an arrow function contains
@@ -73281,16 +74121,16 @@
*/
function visitFunctionExpression(node) {
var ancestorFacts = ts.getEmitFlags(node) & 262144 /* AsyncFunctionBody */
- ? enterSubtree(8086 /* AsyncFunctionBodyExcludes */, 69 /* AsyncFunctionBodyIncludes */)
- : enterSubtree(8094 /* FunctionExcludes */, 65 /* FunctionIncludes */);
+ ? enterSubtree(16278 /* AsyncFunctionBodyExcludes */, 69 /* AsyncFunctionBodyIncludes */)
+ : enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */);
var savedConvertedLoopState = convertedLoopState;
convertedLoopState = undefined;
var parameters = ts.visitParameterList(node.parameters, visitor, context);
var body = transformFunctionBody(node);
- var name = hierarchyFacts & 8192 /* NewTarget */
+ var name = hierarchyFacts & 16384 /* NewTarget */
? ts.getLocalName(node)
: node.name;
- exitSubtree(ancestorFacts, 24576 /* FunctionSubtreeExcludes */, 0 /* None */);
+ exitSubtree(ancestorFacts, 49152 /* FunctionSubtreeExcludes */, 0 /* None */);
convertedLoopState = savedConvertedLoopState;
return ts.updateFunctionExpression(node,
/*modifiers*/ undefined, node.asteriskToken, name,
@@ -73305,13 +74145,13 @@
function visitFunctionDeclaration(node) {
var savedConvertedLoopState = convertedLoopState;
convertedLoopState = undefined;
- var ancestorFacts = enterSubtree(8094 /* FunctionExcludes */, 65 /* FunctionIncludes */);
+ var ancestorFacts = enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */);
var parameters = ts.visitParameterList(node.parameters, visitor, context);
var body = transformFunctionBody(node);
- var name = hierarchyFacts & 8192 /* NewTarget */
+ var name = hierarchyFacts & 16384 /* NewTarget */
? ts.getLocalName(node)
: node.name;
- exitSubtree(ancestorFacts, 24576 /* FunctionSubtreeExcludes */, 0 /* None */);
+ exitSubtree(ancestorFacts, 49152 /* FunctionSubtreeExcludes */, 0 /* None */);
convertedLoopState = savedConvertedLoopState;
return ts.updateFunctionDeclaration(node,
/*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, name,
@@ -73329,14 +74169,14 @@
var savedConvertedLoopState = convertedLoopState;
convertedLoopState = undefined;
var ancestorFacts = container && ts.isClassLike(container) && !ts.hasModifier(node, 32 /* Static */)
- ? enterSubtree(8094 /* FunctionExcludes */, 65 /* FunctionIncludes */ | 8 /* NonStaticClassElement */)
- : enterSubtree(8094 /* FunctionExcludes */, 65 /* FunctionIncludes */);
+ ? enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */ | 8 /* NonStaticClassElement */)
+ : enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */);
var parameters = ts.visitParameterList(node.parameters, visitor, context);
var body = transformFunctionBody(node);
- if (hierarchyFacts & 8192 /* NewTarget */ && !name && (node.kind === 239 /* FunctionDeclaration */ || node.kind === 196 /* FunctionExpression */)) {
+ if (hierarchyFacts & 16384 /* NewTarget */ && !name && (node.kind === 240 /* FunctionDeclaration */ || node.kind === 197 /* FunctionExpression */)) {
name = ts.getGeneratedNameForNode(node);
}
- exitSubtree(ancestorFacts, 24576 /* FunctionSubtreeExcludes */, 0 /* None */);
+ exitSubtree(ancestorFacts, 49152 /* FunctionSubtreeExcludes */, 0 /* None */);
convertedLoopState = savedConvertedLoopState;
return ts.setOriginalNode(ts.setTextRange(ts.createFunctionExpression(
/*modifiers*/ undefined, node.asteriskToken, name,
@@ -73377,7 +74217,7 @@
}
}
else {
- ts.Debug.assert(node.kind === 197 /* ArrowFunction */);
+ ts.Debug.assert(node.kind === 198 /* ArrowFunction */);
// To align with the old emitter, we use a synthetic end position on the location
// for the statement list we synthesize when we down-level an arrow function with
// an expression function body. This prevents both comments and source maps from
@@ -73431,8 +74271,8 @@
return ts.visitEachChild(node, visitor, context);
}
var ancestorFacts = hierarchyFacts & 256 /* IterationStatement */
- ? enterSubtree(4032 /* IterationStatementBlockExcludes */, 512 /* IterationStatementBlockIncludes */)
- : enterSubtree(3904 /* BlockExcludes */, 128 /* BlockIncludes */);
+ ? enterSubtree(7104 /* IterationStatementBlockExcludes */, 512 /* IterationStatementBlockIncludes */)
+ : enterSubtree(6976 /* BlockExcludes */, 128 /* BlockIncludes */);
var updated = ts.visitEachChild(node, visitor, context);
exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */);
return updated;
@@ -73445,9 +74285,9 @@
function visitExpressionStatement(node) {
// If we are here it is most likely because our expression is a destructuring assignment.
switch (node.expression.kind) {
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return ts.updateExpressionStatement(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false));
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return ts.updateExpressionStatement(node, visitBinaryExpression(node.expression, /*needsDestructuringValue*/ false));
}
return ts.visitEachChild(node, visitor, context);
@@ -73466,9 +74306,9 @@
// expression. If we are in a state where we do not need the destructuring value,
// we pass that information along to the children that care about it.
switch (node.expression.kind) {
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return ts.updateParen(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false));
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return ts.updateParen(node, visitBinaryExpression(node.expression, /*needsDestructuringValue*/ false));
}
}
@@ -73503,7 +74343,7 @@
assignment = ts.flattenDestructuringAssignment(decl, visitor, context, 0 /* All */);
}
else {
- assignment = ts.createBinary(decl.name, 59 /* EqualsToken */, ts.visitNode(decl.initializer, visitor, ts.isExpression));
+ assignment = ts.createBinary(decl.name, 60 /* EqualsToken */, ts.visitNode(decl.initializer, visitor, ts.isExpression));
ts.setTextRange(assignment, decl);
}
assignments = ts.append(assignments, assignment);
@@ -73615,11 +74455,11 @@
&& isDeclaredInLoop
&& (hierarchyFacts & 512 /* IterationStatementBlock */) !== 0);
var emitExplicitInitializer = !emittedAsTopLevel
- && (hierarchyFacts & 2048 /* ForInOrForOfStatement */) === 0
+ && (hierarchyFacts & 4096 /* ForInOrForOfStatement */) === 0
&& (!resolver.isDeclarationWithCollidingName(node)
|| (isDeclaredInLoop
&& !isCapturedInFunction
- && (hierarchyFacts & (1024 /* ForStatement */ | 2048 /* ForInOrForOfStatement */)) === 0));
+ && (hierarchyFacts & (2048 /* ForStatement */ | 4096 /* ForInOrForOfStatement */)) === 0));
return emitExplicitInitializer;
}
/**
@@ -73677,34 +74517,34 @@
}
function visitIterationStatement(node, outermostLabeledStatement) {
switch (node.kind) {
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
return visitDoOrWhileStatement(node, outermostLabeledStatement);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return visitForStatement(node, outermostLabeledStatement);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return visitForInStatement(node, outermostLabeledStatement);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return visitForOfStatement(node, outermostLabeledStatement);
}
}
function visitIterationStatementWithFacts(excludeFacts, includeFacts, node, outermostLabeledStatement, convert) {
var ancestorFacts = enterSubtree(excludeFacts, includeFacts);
- var updated = convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert);
+ var updated = convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, ancestorFacts, convert);
exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */);
return updated;
}
function visitDoOrWhileStatement(node, outermostLabeledStatement) {
- return visitIterationStatementWithFacts(0 /* DoOrWhileStatementExcludes */, 256 /* DoOrWhileStatementIncludes */, node, outermostLabeledStatement);
+ return visitIterationStatementWithFacts(0 /* DoOrWhileStatementExcludes */, 1280 /* DoOrWhileStatementIncludes */, node, outermostLabeledStatement);
}
function visitForStatement(node, outermostLabeledStatement) {
- return visitIterationStatementWithFacts(3008 /* ForStatementExcludes */, 1280 /* ForStatementIncludes */, node, outermostLabeledStatement);
+ return visitIterationStatementWithFacts(5056 /* ForStatementExcludes */, 3328 /* ForStatementIncludes */, node, outermostLabeledStatement);
}
function visitForInStatement(node, outermostLabeledStatement) {
- return visitIterationStatementWithFacts(1984 /* ForInOrForOfStatementExcludes */, 2304 /* ForInOrForOfStatementIncludes */, node, outermostLabeledStatement);
+ return visitIterationStatementWithFacts(3008 /* ForInOrForOfStatementExcludes */, 5376 /* ForInOrForOfStatementIncludes */, node, outermostLabeledStatement);
}
function visitForOfStatement(node, outermostLabeledStatement) {
- return visitIterationStatementWithFacts(1984 /* ForInOrForOfStatementExcludes */, 2304 /* ForInOrForOfStatementIncludes */, node, outermostLabeledStatement, compilerOptions.downlevelIteration ? convertForOfStatementForIterable : convertForOfStatementForArray);
+ return visitIterationStatementWithFacts(3008 /* ForInOrForOfStatementExcludes */, 5376 /* ForInOrForOfStatementIncludes */, node, outermostLabeledStatement, compilerOptions.downlevelIteration ? convertForOfStatementForIterable : convertForOfStatementForArray);
}
function convertForOfStatementHead(node, boundValue, convertedLoopBodyStatements) {
var statements = [];
@@ -73812,7 +74652,7 @@
ts.setTextRange(forStatement, node);
return ts.restoreEnclosingLabel(forStatement, outermostLabeledStatement, convertedLoopState && resetLabel);
}
- function convertForOfStatementForIterable(node, outermostLabeledStatement, convertedLoopBodyStatements) {
+ function convertForOfStatementForIterable(node, outermostLabeledStatement, convertedLoopBodyStatements, ancestorFacts) {
var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
var iterator = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(expression) : ts.createTempVariable(/*recordTempVariable*/ undefined);
var result = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(iterator) : ts.createTempVariable(/*recordTempVariable*/ undefined);
@@ -73823,9 +74663,13 @@
var next = ts.createCall(ts.createPropertyAccess(iterator, "next"), /*typeArguments*/ undefined, []);
hoistVariableDeclaration(errorRecord);
hoistVariableDeclaration(returnMethod);
+ // if we are enclosed in an outer loop ensure we reset 'errorRecord' per each iteration
+ var initializer = ancestorFacts & 1024 /* IterationContainer */
+ ? ts.inlineExpressions([ts.createAssignment(errorRecord, ts.createVoidZero()), values])
+ : values;
var forStatement = ts.setEmitFlags(ts.setTextRange(ts.createFor(
/*initializer*/ ts.setEmitFlags(ts.setTextRange(ts.createVariableDeclarationList([
- ts.setTextRange(ts.createVariableDeclaration(iterator, /*type*/ undefined, values), node.expression),
+ ts.setTextRange(ts.createVariableDeclaration(iterator, /*type*/ undefined, initializer), node.expression),
ts.createVariableDeclaration(result, /*type*/ undefined, next)
]), node.expression), 2097152 /* NoHoisting */),
/*condition*/ ts.createLogicalNot(ts.createPropertyAccess(result, "done")),
@@ -73868,7 +74712,7 @@
&& i < numInitialPropertiesWithoutYield) {
numInitialPropertiesWithoutYield = i;
}
- if (property.name.kind === 149 /* ComputedPropertyName */) {
+ if (property.name.kind === 150 /* ComputedPropertyName */) {
numInitialProperties = i;
break;
}
@@ -73923,7 +74767,7 @@
}
visit(node.name);
function visit(node) {
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
state.hoistedLocalVariables.push(node);
}
else {
@@ -73936,7 +74780,7 @@
}
}
}
- function convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert) {
+ function convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, ancestorFacts, convert) {
if (!shouldConvertIterationStatement(node)) {
var saveAllowedNonLabeledJumps = void 0;
if (convertedLoopState) {
@@ -73946,7 +74790,7 @@
convertedLoopState.allowedNonLabeledJumps = 2 /* Break */ | 4 /* Continue */;
}
var result = convert
- ? convert(node, outermostLabeledStatement, /*convertedLoopBodyStatements*/ undefined)
+ ? convert(node, outermostLabeledStatement, /*convertedLoopBodyStatements*/ undefined, ancestorFacts)
: ts.restoreEnclosingLabel(ts.visitEachChild(node, visitor, context), outermostLabeledStatement, convertedLoopState && resetLabel);
if (convertedLoopState) {
convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps;
@@ -73971,7 +74815,7 @@
var loop;
if (bodyFunction) {
if (convert) {
- loop = convert(node, outermostLabeledStatement, bodyFunction.part);
+ loop = convert(node, outermostLabeledStatement, bodyFunction.part, ancestorFacts);
}
else {
var clone_3 = convertIterationStatementCore(node, initializerFunction, ts.createBlock(bodyFunction.part, /*multiLine*/ true));
@@ -73989,11 +74833,11 @@
}
function convertIterationStatementCore(node, initializerFunction, convertedLoopBody) {
switch (node.kind) {
- case 225 /* ForStatement */: return convertForStatement(node, initializerFunction, convertedLoopBody);
- case 226 /* ForInStatement */: return convertForInStatement(node, convertedLoopBody);
- case 227 /* ForOfStatement */: return convertForOfStatement(node, convertedLoopBody);
- case 223 /* DoStatement */: return convertDoStatement(node, convertedLoopBody);
- case 224 /* WhileStatement */: return convertWhileStatement(node, convertedLoopBody);
+ case 226 /* ForStatement */: return convertForStatement(node, initializerFunction, convertedLoopBody);
+ case 227 /* ForInStatement */: return convertForInStatement(node, convertedLoopBody);
+ case 228 /* ForOfStatement */: return convertForOfStatement(node, convertedLoopBody);
+ case 224 /* DoStatement */: return convertDoStatement(node, convertedLoopBody);
+ case 225 /* WhileStatement */: return convertWhileStatement(node, convertedLoopBody);
default: return ts.Debug.failBadSyntaxKind(node, "IterationStatement expected");
}
}
@@ -74018,11 +74862,11 @@
function createConvertedLoopState(node) {
var loopInitializer;
switch (node.kind) {
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
var initializer = node.initializer;
- if (initializer && initializer.kind === 238 /* VariableDeclarationList */) {
+ if (initializer && initializer.kind === 239 /* VariableDeclarationList */) {
loopInitializer = initializer;
}
break;
@@ -74284,7 +75128,7 @@
function copyOutParameter(outParam, copyDirection) {
var source = copyDirection === 0 /* ToOriginal */ ? outParam.outParamName : outParam.originalName;
var target = copyDirection === 0 /* ToOriginal */ ? outParam.originalName : outParam.outParamName;
- return ts.createBinary(target, 59 /* EqualsToken */, source);
+ return ts.createBinary(target, 60 /* EqualsToken */, source);
}
function copyOutParameters(outParams, partFlags, copyDirection, statements) {
for (var _i = 0, outParams_1 = outParams; _i < outParams_1.length; _i++) {
@@ -74421,20 +75265,20 @@
for (var i = start; i < numProperties; i++) {
var property = properties[i];
switch (property.kind) {
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
var accessors = ts.getAllAccessorDeclarations(node.properties, property);
if (property === accessors.firstAccessor) {
expressions.push(transformAccessorsToExpression(receiver, accessors, node, !!node.multiLine));
}
break;
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine));
break;
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine));
break;
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine));
break;
default:
@@ -74489,7 +75333,7 @@
return expression;
}
function visitCatchClause(node) {
- var ancestorFacts = enterSubtree(4032 /* BlockScopeExcludes */, 0 /* BlockScopeIncludes */);
+ var ancestorFacts = enterSubtree(7104 /* BlockScopeExcludes */, 0 /* BlockScopeIncludes */);
var updated;
ts.Debug.assert(!!node.variableDeclaration, "Catch clause variable should always be present when downleveling ES2015.");
if (ts.isBindingPattern(node.variableDeclaration.name)) {
@@ -74537,17 +75381,17 @@
ts.Debug.assert(!ts.isComputedPropertyName(node.name));
var savedConvertedLoopState = convertedLoopState;
convertedLoopState = undefined;
- var ancestorFacts = enterSubtree(8094 /* FunctionExcludes */, 65 /* FunctionIncludes */);
+ var ancestorFacts = enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */);
var updated;
var parameters = ts.visitParameterList(node.parameters, visitor, context);
var body = transformFunctionBody(node);
- if (node.kind === 158 /* GetAccessor */) {
+ if (node.kind === 159 /* GetAccessor */) {
updated = ts.updateGetAccessor(node, node.decorators, node.modifiers, node.name, parameters, node.type, body);
}
else {
updated = ts.updateSetAccessor(node, node.decorators, node.modifiers, node.name, parameters, body);
}
- exitSubtree(ancestorFacts, 24576 /* FunctionSubtreeExcludes */, 0 /* None */);
+ exitSubtree(ancestorFacts, 49152 /* FunctionSubtreeExcludes */, 0 /* None */);
convertedLoopState = savedConvertedLoopState;
return updated;
}
@@ -74594,7 +75438,7 @@
return visitTypeScriptClassWrapper(node);
}
var expression = ts.skipOuterExpressions(node.expression);
- if (expression.kind === 98 /* SuperKeyword */ ||
+ if (expression.kind === 99 /* SuperKeyword */ ||
ts.isSuperProperty(expression) ||
ts.some(node.arguments, ts.isSpreadElement)) {
return visitCallExpressionWithPotentialCapturedThisAssignment(node, /*assignToCapturedThis*/ true);
@@ -74718,10 +75562,10 @@
// We are here either because SuperKeyword was used somewhere in the expression, or
// because we contain a SpreadElementExpression.
if (node.transformFlags & 4096 /* ContainsRestOrSpread */ ||
- node.expression.kind === 98 /* SuperKeyword */ ||
+ node.expression.kind === 99 /* SuperKeyword */ ||
ts.isSuperProperty(ts.skipOuterExpressions(node.expression))) {
var _a = ts.createCallBinding(node.expression, hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
ts.setEmitFlags(thisArg, 4 /* NoSubstitution */);
}
var resultingCall = void 0;
@@ -74739,7 +75583,7 @@
// _super.apply(this, a.concat([b]))
// _super.m.apply(this, a.concat([b]))
// _super.prototype.m.apply(this, a.concat([b]))
- resultingCall = ts.createFunctionApply(ts.visitNode(target, callExpressionVisitor, ts.isExpression), node.expression.kind === 98 /* SuperKeyword */ ? thisArg : ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false));
+ resultingCall = ts.createFunctionApply(ts.visitNode(target, callExpressionVisitor, ts.isExpression), node.expression.kind === 99 /* SuperKeyword */ ? thisArg : ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false));
}
else {
// [source]
@@ -74751,10 +75595,10 @@
// _super.call(this, a)
// _super.m.call(this, a)
// _super.prototype.m.call(this, a)
- resultingCall = ts.createFunctionCall(ts.visitNode(target, callExpressionVisitor, ts.isExpression), node.expression.kind === 98 /* SuperKeyword */ ? thisArg : ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression),
+ resultingCall = ts.createFunctionCall(ts.visitNode(target, callExpressionVisitor, ts.isExpression), node.expression.kind === 99 /* SuperKeyword */ ? thisArg : ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression),
/*location*/ node);
}
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
var initializer = ts.createLogicalOr(resultingCall, createActualThis());
resultingCall = assignToCapturedThis
? ts.createAssignment(ts.createFileLevelUniqueName("_this"), initializer)
@@ -74817,7 +75661,7 @@
else {
if (segments.length === 1) {
var firstElement = elements[0];
- return needsUniqueCopy && ts.isSpreadElement(firstElement) && firstElement.expression.kind !== 187 /* ArrayLiteralExpression */
+ return needsUniqueCopy && ts.isSpreadElement(firstElement) && firstElement.expression.kind !== 188 /* ArrayLiteralExpression */
? ts.createArraySlice(segments[0])
: segments[0];
}
@@ -75032,8 +75876,8 @@
: ts.createFileLevelUniqueName("_super");
}
function visitMetaProperty(node) {
- if (node.keywordToken === 95 /* NewKeyword */ && node.name.escapedText === "target") {
- hierarchyFacts |= 8192 /* NewTarget */;
+ if (node.keywordToken === 96 /* NewKeyword */ && node.name.escapedText === "target") {
+ hierarchyFacts |= 16384 /* NewTarget */;
return ts.createFileLevelUniqueName("_newTarget");
}
return node;
@@ -75048,7 +75892,7 @@
function onEmitNode(hint, node, emitCallback) {
if (enabledSubstitutions & 1 /* CapturedThis */ && ts.isFunctionLike(node)) {
// If we are tracking a captured `this`, keep track of the enclosing function.
- var ancestorFacts = enterSubtree(8094 /* FunctionExcludes */, ts.getEmitFlags(node) & 8 /* CapturesThis */
+ var ancestorFacts = enterSubtree(16286 /* FunctionExcludes */, ts.getEmitFlags(node) & 8 /* CapturesThis */
? 65 /* FunctionIncludes */ | 16 /* CapturesThis */
: 65 /* FunctionIncludes */);
previousOnEmitNode(hint, node, emitCallback);
@@ -75064,7 +75908,7 @@
function enableSubstitutionsForBlockScopedBindings() {
if ((enabledSubstitutions & 2 /* BlockScopedBindings */) === 0) {
enabledSubstitutions |= 2 /* BlockScopedBindings */;
- context.enableSubstitution(72 /* Identifier */);
+ context.enableSubstitution(73 /* Identifier */);
}
}
/**
@@ -75074,14 +75918,14 @@
function enableSubstitutionsForCapturedThis() {
if ((enabledSubstitutions & 1 /* CapturedThis */) === 0) {
enabledSubstitutions |= 1 /* CapturedThis */;
- context.enableSubstitution(100 /* ThisKeyword */);
- context.enableEmitNotification(157 /* Constructor */);
- context.enableEmitNotification(156 /* MethodDeclaration */);
- context.enableEmitNotification(158 /* GetAccessor */);
- context.enableEmitNotification(159 /* SetAccessor */);
- context.enableEmitNotification(197 /* ArrowFunction */);
- context.enableEmitNotification(196 /* FunctionExpression */);
- context.enableEmitNotification(239 /* FunctionDeclaration */);
+ context.enableSubstitution(101 /* ThisKeyword */);
+ context.enableEmitNotification(158 /* Constructor */);
+ context.enableEmitNotification(157 /* MethodDeclaration */);
+ context.enableEmitNotification(159 /* GetAccessor */);
+ context.enableEmitNotification(160 /* SetAccessor */);
+ context.enableEmitNotification(198 /* ArrowFunction */);
+ context.enableEmitNotification(197 /* FunctionExpression */);
+ context.enableEmitNotification(240 /* FunctionDeclaration */);
}
}
/**
@@ -75122,10 +75966,10 @@
*/
function isNameOfDeclarationWithCollidingName(node) {
switch (node.parent.kind) {
- case 186 /* BindingElement */:
- case 240 /* ClassDeclaration */:
- case 243 /* EnumDeclaration */:
- case 237 /* VariableDeclaration */:
+ case 187 /* BindingElement */:
+ case 241 /* ClassDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 238 /* VariableDeclaration */:
return node.parent.name === node
&& resolver.isDeclarationWithCollidingName(node.parent);
}
@@ -75138,9 +75982,9 @@
*/
function substituteExpression(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return substituteExpressionIdentifier(node);
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
return substituteThisKeyword(node);
}
return node;
@@ -75207,19 +76051,19 @@
return false;
}
var statement = ts.firstOrUndefined(constructor.body.statements);
- if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 221 /* ExpressionStatement */) {
+ if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 222 /* ExpressionStatement */) {
return false;
}
var statementExpression = statement.expression;
- if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 191 /* CallExpression */) {
+ if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 192 /* CallExpression */) {
return false;
}
var callTarget = statementExpression.expression;
- if (!ts.nodeIsSynthesized(callTarget) || callTarget.kind !== 98 /* SuperKeyword */) {
+ if (!ts.nodeIsSynthesized(callTarget) || callTarget.kind !== 99 /* SuperKeyword */) {
return false;
}
var callArgument = ts.singleOrUndefined(statementExpression.arguments);
- if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 208 /* SpreadElement */) {
+ if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 209 /* SpreadElement */) {
return false;
}
var expression = callArgument.expression;
@@ -75272,15 +76116,15 @@
if (compilerOptions.jsx === 1 /* Preserve */ || compilerOptions.jsx === 3 /* ReactNative */) {
previousOnEmitNode = context.onEmitNode;
context.onEmitNode = onEmitNode;
- context.enableEmitNotification(262 /* JsxOpeningElement */);
- context.enableEmitNotification(263 /* JsxClosingElement */);
- context.enableEmitNotification(261 /* JsxSelfClosingElement */);
+ context.enableEmitNotification(263 /* JsxOpeningElement */);
+ context.enableEmitNotification(264 /* JsxClosingElement */);
+ context.enableEmitNotification(262 /* JsxSelfClosingElement */);
noSubstitution = [];
}
var previousOnSubstituteNode = context.onSubstituteNode;
context.onSubstituteNode = onSubstituteNode;
- context.enableSubstitution(189 /* PropertyAccessExpression */);
- context.enableSubstitution(275 /* PropertyAssignment */);
+ context.enableSubstitution(190 /* PropertyAccessExpression */);
+ context.enableSubstitution(276 /* PropertyAssignment */);
return ts.chainBundle(transformSourceFile);
/**
* Transforms an ES5 source file to ES3.
@@ -75299,9 +76143,9 @@
*/
function onEmitNode(hint, node, emitCallback) {
switch (node.kind) {
- case 262 /* JsxOpeningElement */:
- case 263 /* JsxClosingElement */:
- case 261 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
+ case 264 /* JsxClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
var tagName = node.tagName;
noSubstitution[ts.getOriginalNodeId(tagName)] = true;
break;
@@ -75358,7 +76202,7 @@
*/
function trySubstituteReservedName(name) {
var token = name.originalKeywordKind || (ts.nodeIsSynthesized(name) ? ts.stringToToken(ts.idText(name)) : undefined);
- if (token !== undefined && token >= 73 /* FirstReservedWord */ && token <= 108 /* LastReservedWord */) {
+ if (token !== undefined && token >= 74 /* FirstReservedWord */ && token <= 109 /* LastReservedWord */) {
return ts.setTextRange(ts.createLiteral(name), name);
}
return undefined;
@@ -75633,13 +76477,13 @@
*/
function visitJavaScriptInStatementContainingYield(node) {
switch (node.kind) {
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
return visitDoStatement(node);
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
return visitWhileStatement(node);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return visitSwitchStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return visitLabeledStatement(node);
default:
return visitJavaScriptInGeneratorFunctionBody(node);
@@ -75652,24 +76496,24 @@
*/
function visitJavaScriptInGeneratorFunctionBody(node) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return visitFunctionDeclaration(node);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return visitFunctionExpression(node);
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return visitAccessorDeclaration(node);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return visitVariableStatement(node);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return visitForStatement(node);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return visitForInStatement(node);
- case 229 /* BreakStatement */:
+ case 230 /* BreakStatement */:
return visitBreakStatement(node);
- case 228 /* ContinueStatement */:
+ case 229 /* ContinueStatement */:
return visitContinueStatement(node);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return visitReturnStatement(node);
default:
if (node.transformFlags & 131072 /* ContainsYield */) {
@@ -75690,21 +76534,21 @@
*/
function visitJavaScriptContainingYield(node) {
switch (node.kind) {
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return visitBinaryExpression(node);
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return visitConditionalExpression(node);
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return visitYieldExpression(node);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return visitArrayLiteralExpression(node);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return visitObjectLiteralExpression(node);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return visitElementAccessExpression(node);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return visitCallExpression(node);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return visitNewExpression(node);
default:
return ts.visitEachChild(node, visitor, context);
@@ -75717,9 +76561,9 @@
*/
function visitGenerator(node) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return visitFunctionDeclaration(node);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return visitFunctionExpression(node);
default:
return ts.Debug.failBadSyntaxKind(node);
@@ -75918,23 +76762,23 @@
}
}
function isCompoundAssignment(kind) {
- return kind >= 60 /* FirstCompoundAssignment */
- && kind <= 71 /* LastCompoundAssignment */;
+ return kind >= 61 /* FirstCompoundAssignment */
+ && kind <= 72 /* LastCompoundAssignment */;
}
function getOperatorForCompoundAssignment(kind) {
switch (kind) {
- case 60 /* PlusEqualsToken */: return 38 /* PlusToken */;
- case 61 /* MinusEqualsToken */: return 39 /* MinusToken */;
- case 62 /* AsteriskEqualsToken */: return 40 /* AsteriskToken */;
- case 63 /* AsteriskAsteriskEqualsToken */: return 41 /* AsteriskAsteriskToken */;
- case 64 /* SlashEqualsToken */: return 42 /* SlashToken */;
- case 65 /* PercentEqualsToken */: return 43 /* PercentToken */;
- case 66 /* LessThanLessThanEqualsToken */: return 46 /* LessThanLessThanToken */;
- case 67 /* GreaterThanGreaterThanEqualsToken */: return 47 /* GreaterThanGreaterThanToken */;
- case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */: return 48 /* GreaterThanGreaterThanGreaterThanToken */;
- case 69 /* AmpersandEqualsToken */: return 49 /* AmpersandToken */;
- case 70 /* BarEqualsToken */: return 50 /* BarToken */;
- case 71 /* CaretEqualsToken */: return 51 /* CaretToken */;
+ case 61 /* PlusEqualsToken */: return 38 /* PlusToken */;
+ case 62 /* MinusEqualsToken */: return 39 /* MinusToken */;
+ case 63 /* AsteriskEqualsToken */: return 40 /* AsteriskToken */;
+ case 64 /* AsteriskAsteriskEqualsToken */: return 41 /* AsteriskAsteriskToken */;
+ case 65 /* SlashEqualsToken */: return 42 /* SlashToken */;
+ case 66 /* PercentEqualsToken */: return 43 /* PercentToken */;
+ case 67 /* LessThanLessThanEqualsToken */: return 46 /* LessThanLessThanToken */;
+ case 68 /* GreaterThanGreaterThanEqualsToken */: return 47 /* GreaterThanGreaterThanToken */;
+ case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */: return 48 /* GreaterThanGreaterThanGreaterThanToken */;
+ case 70 /* AmpersandEqualsToken */: return 49 /* AmpersandToken */;
+ case 71 /* BarEqualsToken */: return 50 /* BarToken */;
+ case 72 /* CaretEqualsToken */: return 51 /* CaretToken */;
}
}
/**
@@ -75947,7 +76791,7 @@
if (containsYield(right)) {
var target = void 0;
switch (left.kind) {
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
// [source]
// a.b = yield;
//
@@ -75959,7 +76803,7 @@
// _a.b = %sent%;
target = ts.updatePropertyAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name);
break;
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
// [source]
// a[b] = yield;
//
@@ -76335,35 +77179,35 @@
}
function transformAndEmitStatementWorker(node) {
switch (node.kind) {
- case 218 /* Block */:
+ case 219 /* Block */:
return transformAndEmitBlock(node);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return transformAndEmitExpressionStatement(node);
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
return transformAndEmitIfStatement(node);
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
return transformAndEmitDoStatement(node);
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
return transformAndEmitWhileStatement(node);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return transformAndEmitForStatement(node);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return transformAndEmitForInStatement(node);
- case 228 /* ContinueStatement */:
+ case 229 /* ContinueStatement */:
return transformAndEmitContinueStatement(node);
- case 229 /* BreakStatement */:
+ case 230 /* BreakStatement */:
return transformAndEmitBreakStatement(node);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return transformAndEmitReturnStatement(node);
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
return transformAndEmitWithStatement(node);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return transformAndEmitSwitchStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return transformAndEmitLabeledStatement(node);
- case 234 /* ThrowStatement */:
+ case 235 /* ThrowStatement */:
return transformAndEmitThrowStatement(node);
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
return transformAndEmitTryStatement(node);
default:
return emitStatement(ts.visitNode(node, visitor, ts.isStatement));
@@ -76793,7 +77637,7 @@
for (var i = 0; i < numClauses; i++) {
var clause = caseBlock.clauses[i];
clauseLabels.push(defineLabel());
- if (clause.kind === 272 /* DefaultClause */ && defaultClauseIndex === -1) {
+ if (clause.kind === 273 /* DefaultClause */ && defaultClauseIndex === -1) {
defaultClauseIndex = i;
}
}
@@ -76806,7 +77650,7 @@
var defaultClausesSkipped = 0;
for (var i = clausesWritten; i < numClauses; i++) {
var clause = caseBlock.clauses[i];
- if (clause.kind === 271 /* CaseClause */) {
+ if (clause.kind === 272 /* CaseClause */) {
if (containsYield(clause.expression) && pendingClauses.length > 0) {
break;
}
@@ -77118,7 +77962,7 @@
if (!renamedCatchVariables) {
renamedCatchVariables = ts.createMap();
renamedCatchVariableDeclarations = [];
- context.enableSubstitution(72 /* Identifier */);
+ context.enableSubstitution(73 /* Identifier */);
}
renamedCatchVariables.set(text, true);
renamedCatchVariableDeclarations[ts.getOriginalNodeId(variable)] = name;
@@ -78034,12 +78878,12 @@
var previousOnEmitNode = context.onEmitNode;
context.onSubstituteNode = onSubstituteNode;
context.onEmitNode = onEmitNode;
- context.enableSubstitution(72 /* Identifier */); // Substitutes expression identifiers with imported/exported symbols.
- context.enableSubstitution(204 /* BinaryExpression */); // Substitutes assignments to exported symbols.
- context.enableSubstitution(202 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols.
- context.enableSubstitution(203 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols.
- context.enableSubstitution(276 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols.
- context.enableEmitNotification(284 /* SourceFile */); // Restore state when substituting nodes in a file.
+ context.enableSubstitution(73 /* Identifier */); // Substitutes expression identifiers with imported/exported symbols.
+ context.enableSubstitution(205 /* BinaryExpression */); // Substitutes assignments to exported symbols.
+ context.enableSubstitution(203 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols.
+ context.enableSubstitution(204 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols.
+ context.enableSubstitution(277 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols.
+ context.enableEmitNotification(285 /* SourceFile */); // Restore state when substituting nodes in a file.
var moduleInfoMap = []; // The ExternalModuleInfo for each file.
var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found.
var currentSourceFile; // The current file.
@@ -78367,23 +79211,23 @@
*/
function sourceElementVisitor(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return visitImportDeclaration(node);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return visitImportEqualsDeclaration(node);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return visitExportDeclaration(node);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return visitExportAssignment(node);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return visitVariableStatement(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return visitFunctionDeclaration(node);
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return visitClassDeclaration(node);
- case 315 /* MergeDeclarationMarker */:
+ case 316 /* MergeDeclarationMarker */:
return visitMergeDeclarationMarker(node);
- case 316 /* EndOfDeclarationMarker */:
+ case 317 /* EndOfDeclarationMarker */:
return visitEndOfDeclarationMarker(node);
default:
return ts.visitEachChild(node, moduleExpressionElementVisitor, context);
@@ -78410,24 +79254,24 @@
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var elem = _a[_i];
switch (elem.kind) {
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
if (destructuringNeedsFlattening(elem.initializer)) {
return true;
}
break;
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
if (destructuringNeedsFlattening(elem.name)) {
return true;
}
break;
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
if (destructuringNeedsFlattening(elem.expression)) {
return true;
}
break;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return false;
default: ts.Debug.assertNever(elem, "Unhandled object member kind");
}
@@ -78905,7 +79749,7 @@
//
// To balance the declaration, add the exports of the elided variable
// statement.
- if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 219 /* VariableStatement */) {
+ if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 220 /* VariableStatement */) {
var id = ts.getOriginalNodeId(node);
deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original);
}
@@ -78960,10 +79804,10 @@
var namedBindings = importClause.namedBindings;
if (namedBindings) {
switch (namedBindings.kind) {
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
statements = appendExportsOfDeclaration(statements, namedBindings);
break;
- case 252 /* NamedImports */:
+ case 253 /* NamedImports */:
for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) {
var importBinding = _a[_i];
statements = appendExportsOfDeclaration(statements, importBinding);
@@ -79145,8 +79989,8 @@
function modifierVisitor(node) {
// Elide module-specific modifiers.
switch (node.kind) {
- case 85 /* ExportKeyword */:
- case 80 /* DefaultKeyword */:
+ case 86 /* ExportKeyword */:
+ case 81 /* DefaultKeyword */:
return undefined;
}
return node;
@@ -79162,7 +80006,7 @@
* @param emit A callback used to emit the node in the printer.
*/
function onEmitNode(hint, node, emitCallback) {
- if (node.kind === 284 /* SourceFile */) {
+ if (node.kind === 285 /* SourceFile */) {
currentSourceFile = node;
currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)];
noSubstitution = [];
@@ -79224,12 +80068,12 @@
*/
function substituteExpression(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return substituteExpressionIdentifier(node);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return substituteBinaryExpression(node);
- case 203 /* PostfixUnaryExpression */:
- case 202 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return substituteUnaryExpression(node);
}
return node;
@@ -79250,7 +80094,7 @@
}
if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) {
var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node));
- if (exportContainer && exportContainer.kind === 284 /* SourceFile */) {
+ if (exportContainer && exportContainer.kind === 285 /* SourceFile */) {
return ts.setTextRange(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node)),
/*location*/ node);
}
@@ -79325,8 +80169,8 @@
&& !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) {
var exportedNames = getExports(node.operand);
if (exportedNames) {
- var expression = node.kind === 203 /* PostfixUnaryExpression */
- ? ts.setTextRange(ts.createBinary(node.operand, ts.createToken(node.operator === 44 /* PlusPlusToken */ ? 60 /* PlusEqualsToken */ : 61 /* MinusEqualsToken */), ts.createLiteral(1)),
+ var expression = node.kind === 204 /* PostfixUnaryExpression */
+ ? ts.setTextRange(ts.createBinary(node.operand, ts.createToken(node.operator === 44 /* PlusPlusToken */ ? 61 /* PlusEqualsToken */ : 62 /* MinusEqualsToken */), ts.createLiteral(1)),
/*location*/ node)
: node;
for (var _i = 0, exportedNames_3 = exportedNames; _i < exportedNames_3.length; _i++) {
@@ -79400,12 +80244,12 @@
var previousOnEmitNode = context.onEmitNode;
context.onSubstituteNode = onSubstituteNode;
context.onEmitNode = onEmitNode;
- context.enableSubstitution(72 /* Identifier */); // Substitutes expression identifiers for imported symbols.
- context.enableSubstitution(276 /* ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols
- context.enableSubstitution(204 /* BinaryExpression */); // Substitutes assignments to exported symbols.
- context.enableSubstitution(202 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols.
- context.enableSubstitution(203 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols.
- context.enableEmitNotification(284 /* SourceFile */); // Restore state when substituting nodes in a file.
+ context.enableSubstitution(73 /* Identifier */); // Substitutes expression identifiers for imported symbols.
+ context.enableSubstitution(277 /* ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols
+ context.enableSubstitution(205 /* BinaryExpression */); // Substitutes assignments to exported symbols.
+ context.enableSubstitution(203 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols.
+ context.enableSubstitution(204 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols.
+ context.enableEmitNotification(285 /* SourceFile */); // Restore state when substituting nodes in a file.
var moduleInfoMap = []; // The ExternalModuleInfo for each file.
var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found.
var exportFunctionsMap = []; // The export function associated with a source file.
@@ -79626,7 +80470,7 @@
var hasExportDeclarationWithExportClause = false;
for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) {
var externalImport = _a[_i];
- if (externalImport.kind === 255 /* ExportDeclaration */ && externalImport.exportClause) {
+ if (externalImport.kind === 256 /* ExportDeclaration */ && externalImport.exportClause) {
hasExportDeclarationWithExportClause = true;
break;
}
@@ -79651,7 +80495,7 @@
}
for (var _d = 0, _e = moduleInfo.externalImports; _d < _e.length; _d++) {
var externalImport = _e[_d];
- if (externalImport.kind !== 255 /* ExportDeclaration */) {
+ if (externalImport.kind !== 256 /* ExportDeclaration */) {
continue;
}
if (!externalImport.exportClause) {
@@ -79729,19 +80573,19 @@
var entry = _b[_a];
var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile); // TODO: GH#18217
switch (entry.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
if (!entry.importClause) {
// 'import "..."' case
// module is imported only for side-effects, no emit required
break;
}
// falls through
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
ts.Debug.assert(importVariableName !== undefined);
// save import into the local
statements.push(ts.createExpressionStatement(ts.createAssignment(importVariableName, parameterName)));
break;
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
ts.Debug.assert(importVariableName !== undefined);
if (entry.exportClause) {
// export {a, b as c} from 'foo'
@@ -79791,15 +80635,15 @@
*/
function sourceElementVisitor(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return visitImportDeclaration(node);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return visitImportEqualsDeclaration(node);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
// ExportDeclarations are elided as they are handled via
// `appendExportsOfDeclaration`.
return undefined;
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return visitExportAssignment(node);
default:
return nestedElementVisitor(node);
@@ -79975,7 +80819,7 @@
function shouldHoistVariableDeclarationList(node) {
// hoist only non-block scoped declarations or block scoped declarations parented by source file
return (ts.getEmitFlags(node) & 2097152 /* NoHoisting */) === 0
- && (enclosingBlockScopedContainer.kind === 284 /* SourceFile */
+ && (enclosingBlockScopedContainer.kind === 285 /* SourceFile */
|| (ts.getOriginalNode(node).flags & 3 /* BlockScoped */) === 0);
}
/**
@@ -80039,7 +80883,7 @@
//
// To balance the declaration, we defer the exports of the elided variable
// statement until we visit this declaration's `EndOfDeclarationMarker`.
- if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 219 /* VariableStatement */) {
+ if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 220 /* VariableStatement */) {
var id = ts.getOriginalNodeId(node);
var isExportedDeclaration = ts.hasModifier(node.original, 1 /* Export */);
deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration);
@@ -80101,10 +80945,10 @@
var namedBindings = importClause.namedBindings;
if (namedBindings) {
switch (namedBindings.kind) {
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
statements = appendExportsOfDeclaration(statements, namedBindings);
break;
- case 252 /* NamedImports */:
+ case 253 /* NamedImports */:
for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) {
var importBinding = _a[_i];
statements = appendExportsOfDeclaration(statements, importBinding);
@@ -80284,43 +81128,43 @@
*/
function nestedElementVisitor(node) {
switch (node.kind) {
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return visitVariableStatement(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return visitFunctionDeclaration(node);
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return visitClassDeclaration(node);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return visitForStatement(node);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return visitForInStatement(node);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return visitForOfStatement(node);
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
return visitDoStatement(node);
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
return visitWhileStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return visitLabeledStatement(node);
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
return visitWithStatement(node);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return visitSwitchStatement(node);
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
return visitCaseBlock(node);
- case 271 /* CaseClause */:
+ case 272 /* CaseClause */:
return visitCaseClause(node);
- case 272 /* DefaultClause */:
+ case 273 /* DefaultClause */:
return visitDefaultClause(node);
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
return visitTryStatement(node);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return visitCatchClause(node);
- case 218 /* Block */:
+ case 219 /* Block */:
return visitBlock(node);
- case 315 /* MergeDeclarationMarker */:
+ case 316 /* MergeDeclarationMarker */:
return visitMergeDeclarationMarker(node);
- case 316 /* EndOfDeclarationMarker */:
+ case 317 /* EndOfDeclarationMarker */:
return visitEndOfDeclarationMarker(node);
default:
return destructuringAndImportCallVisitor(node);
@@ -80567,7 +81411,7 @@
}
else if (ts.isIdentifier(node)) {
var container = resolver.getReferencedExportContainer(node);
- return container !== undefined && container.kind === 284 /* SourceFile */;
+ return container !== undefined && container.kind === 285 /* SourceFile */;
}
else {
return false;
@@ -80583,8 +81427,8 @@
*/
function modifierVisitor(node) {
switch (node.kind) {
- case 85 /* ExportKeyword */:
- case 80 /* DefaultKeyword */:
+ case 86 /* ExportKeyword */:
+ case 81 /* DefaultKeyword */:
return undefined;
}
return node;
@@ -80600,7 +81444,7 @@
* @param emitCallback A callback used to emit the node in the printer.
*/
function onEmitNode(hint, node, emitCallback) {
- if (node.kind === 284 /* SourceFile */) {
+ if (node.kind === 285 /* SourceFile */) {
var id = ts.getOriginalNodeId(node);
currentSourceFile = node;
moduleInfo = moduleInfoMap[id];
@@ -80648,7 +81492,7 @@
*/
function substituteUnspecified(node) {
switch (node.kind) {
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return substituteShorthandPropertyAssignment(node);
}
return node;
@@ -80682,12 +81526,12 @@
*/
function substituteExpression(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return substituteExpressionIdentifier(node);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return substituteBinaryExpression(node);
- case 202 /* PrefixUnaryExpression */:
- case 203 /* PostfixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return substituteUnaryExpression(node);
}
return node;
@@ -80780,14 +81624,14 @@
&& !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) {
var exportedNames = getExports(node.operand);
if (exportedNames) {
- var expression = node.kind === 203 /* PostfixUnaryExpression */
+ var expression = node.kind === 204 /* PostfixUnaryExpression */
? ts.setTextRange(ts.createPrefix(node.operator, node.operand), node)
: node;
for (var _i = 0, exportedNames_5 = exportedNames; _i < exportedNames_5.length; _i++) {
var exportName = exportedNames_5[_i];
expression = createExportExpression(exportName, preventSubstitution(expression));
}
- if (node.kind === 203 /* PostfixUnaryExpression */) {
+ if (node.kind === 204 /* PostfixUnaryExpression */) {
expression = node.operator === 44 /* PlusPlusToken */
? ts.createSubtract(preventSubstitution(expression), ts.createLiteral(1))
: ts.createAdd(preventSubstitution(expression), ts.createLiteral(1));
@@ -80809,7 +81653,7 @@
|| resolver.getReferencedValueDeclaration(name);
if (valueDeclaration) {
var exportContainer = resolver.getReferencedExportContainer(name, /*prefixLocals*/ false);
- if (exportContainer && exportContainer.kind === 284 /* SourceFile */) {
+ if (exportContainer && exportContainer.kind === 285 /* SourceFile */) {
exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration));
}
exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]);
@@ -80848,8 +81692,8 @@
var previousOnSubstituteNode = context.onSubstituteNode;
context.onEmitNode = onEmitNode;
context.onSubstituteNode = onSubstituteNode;
- context.enableEmitNotification(284 /* SourceFile */);
- context.enableSubstitution(72 /* Identifier */);
+ context.enableEmitNotification(285 /* SourceFile */);
+ context.enableSubstitution(73 /* Identifier */);
var currentSourceFile;
return ts.chainBundle(transformSourceFile);
function transformSourceFile(node) {
@@ -80877,10 +81721,10 @@
}
function visitor(node) {
switch (node.kind) {
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
// Elide `import=` as it is not legal with --module ES6
return undefined;
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return visitExportAssignment(node);
}
return node;
@@ -80988,7 +81832,7 @@
ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1;
}
- else if (node.parent.kind === 240 /* ClassDeclaration */) {
+ else if (node.parent.kind === 241 /* ClassDeclaration */) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -81017,7 +81861,7 @@
ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_private_name_1;
}
- else if (node.parent.kind === 240 /* ClassDeclaration */) {
+ else if (node.parent.kind === 241 /* ClassDeclaration */) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -81064,7 +81908,7 @@
return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: " + ts.SyntaxKind[node.kind]);
}
function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
- if (node.kind === 237 /* VariableDeclaration */ || node.kind === 186 /* BindingElement */) {
+ if (node.kind === 238 /* VariableDeclaration */ || node.kind === 187 /* BindingElement */) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -81073,8 +81917,8 @@
}
// This check is to ensure we don't report error on constructor parameter property as that error would be reported during parameter emit
// The only exception here is if the constructor was marked as private. we are not emitting the constructor parameters at all.
- else if (node.kind === 154 /* PropertyDeclaration */ || node.kind === 189 /* PropertyAccessExpression */ || node.kind === 153 /* PropertySignature */ ||
- (node.kind === 151 /* Parameter */ && ts.hasModifier(node.parent, 8 /* Private */))) {
+ else if (node.kind === 155 /* PropertyDeclaration */ || node.kind === 190 /* PropertyAccessExpression */ || node.kind === 154 /* PropertySignature */ ||
+ (node.kind === 152 /* Parameter */ && ts.hasModifier(node.parent, 8 /* Private */))) {
// TODO(jfreeman): Deal with computed properties in error reporting.
if (ts.hasModifier(node, 32 /* Static */)) {
return symbolAccessibilityResult.errorModuleName ?
@@ -81083,7 +81927,7 @@
ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1;
}
- else if (node.parent.kind === 240 /* ClassDeclaration */ || node.kind === 151 /* Parameter */) {
+ else if (node.parent.kind === 241 /* ClassDeclaration */ || node.kind === 152 /* Parameter */) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -81108,7 +81952,7 @@
}
function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) {
var diagnosticMessage;
- if (node.kind === 159 /* SetAccessor */) {
+ if (node.kind === 160 /* SetAccessor */) {
// Getters can infer the return type from the returned expression, but setters cannot, so the
// "_from_external_module_1_but_cannot_be_named" case cannot occur.
if (ts.hasModifier(node, 32 /* Static */)) {
@@ -81147,26 +81991,26 @@
function getReturnTypeVisibilityError(symbolAccessibilityResult) {
var diagnosticMessage;
switch (node.kind) {
- case 161 /* ConstructSignature */:
+ case 162 /* ConstructSignature */:
// Interfaces cannot have return types that cannot be named
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0;
break;
- case 160 /* CallSignature */:
+ case 161 /* CallSignature */:
// Interfaces cannot have return types that cannot be named
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0;
break;
- case 162 /* IndexSignature */:
+ case 163 /* IndexSignature */:
// Interfaces cannot have return types that cannot be named
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0;
break;
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
if (ts.hasModifier(node, 32 /* Static */)) {
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
@@ -81174,7 +82018,7 @@
ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 :
ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0;
}
- else if (node.parent.kind === 240 /* ClassDeclaration */) {
+ else if (node.parent.kind === 241 /* ClassDeclaration */) {
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
@@ -81188,7 +82032,7 @@
ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0;
}
break;
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
@@ -81213,30 +82057,30 @@
}
function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
switch (node.parent.kind) {
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1;
- case 161 /* ConstructSignature */:
- case 166 /* ConstructorType */:
+ case 162 /* ConstructSignature */:
+ case 167 /* ConstructorType */:
// Interfaces cannot have parameter types that cannot be named
return symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;
- case 160 /* CallSignature */:
+ case 161 /* CallSignature */:
// Interfaces cannot have parameter types that cannot be named
return symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;
- case 162 /* IndexSignature */:
+ case 163 /* IndexSignature */:
// Interfaces cannot have parameter types that cannot be named
return symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1;
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
if (ts.hasModifier(node.parent, 32 /* Static */)) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
@@ -81244,7 +82088,7 @@
ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1;
}
- else if (node.parent.parent.kind === 240 /* ClassDeclaration */) {
+ else if (node.parent.parent.kind === 241 /* ClassDeclaration */) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -81257,8 +82101,8 @@
ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1;
}
- case 239 /* FunctionDeclaration */:
- case 165 /* FunctionType */:
+ case 240 /* FunctionDeclaration */:
+ case 166 /* FunctionType */:
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -81272,39 +82116,39 @@
// Type parameter constraints are named by user so we should always be able to name it
var diagnosticMessage;
switch (node.parent.kind) {
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1;
break;
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1;
break;
- case 181 /* MappedType */:
+ case 182 /* MappedType */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1;
break;
- case 166 /* ConstructorType */:
- case 161 /* ConstructSignature */:
+ case 167 /* ConstructorType */:
+ case 162 /* ConstructSignature */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;
break;
- case 160 /* CallSignature */:
+ case 161 /* CallSignature */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;
break;
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
if (ts.hasModifier(node.parent, 32 /* Static */)) {
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1;
}
- else if (node.parent.parent.kind === 240 /* ClassDeclaration */) {
+ else if (node.parent.parent.kind === 241 /* ClassDeclaration */) {
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1;
}
else {
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1;
}
break;
- case 165 /* FunctionType */:
- case 239 /* FunctionDeclaration */:
+ case 166 /* FunctionType */:
+ case 240 /* FunctionDeclaration */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1;
break;
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1;
break;
default:
@@ -81319,9 +82163,9 @@
function getHeritageClauseVisibilityError() {
var diagnosticMessage;
// Heritage clause is written by user so it can always be named
- if (node.parent.parent.kind === 240 /* ClassDeclaration */) {
+ if (node.parent.parent.kind === 241 /* ClassDeclaration */) {
// Class or Interface implemented/extended is inaccessible
- diagnosticMessage = ts.isHeritageClause(node.parent) && node.parent.token === 109 /* ImplementsKeyword */ ?
+ diagnosticMessage = ts.isHeritageClause(node.parent) && node.parent.token === 110 /* ImplementsKeyword */ ?
ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 :
ts.Diagnostics.extends_clause_of_exported_class_0_has_or_is_using_private_name_1;
}
@@ -81370,7 +82214,7 @@
}
function isInternalDeclaration(node, currentSourceFile) {
var parseTreeNode = ts.getParseTreeNode(node);
- if (parseTreeNode && parseTreeNode.kind === 151 /* Parameter */) {
+ if (parseTreeNode && parseTreeNode.kind === 152 /* Parameter */) {
var paramIdx = parseTreeNode.parent.parameters.indexOf(parseTreeNode);
var previousSibling = paramIdx > 0 ? parseTreeNode.parent.parameters[paramIdx - 1] : undefined;
var text = currentSourceFile.text;
@@ -81517,10 +82361,10 @@
}
}
function transformRoot(node) {
- if (node.kind === 284 /* SourceFile */ && (node.isDeclarationFile || ts.isSourceFileJS(node))) {
+ if (node.kind === 285 /* SourceFile */ && (node.isDeclarationFile || ts.isSourceFileJS(node))) {
return node;
}
- if (node.kind === 285 /* Bundle */) {
+ if (node.kind === 286 /* Bundle */) {
isBundledEmit = true;
refs = ts.createMap();
libs = ts.createMap();
@@ -81543,14 +82387,14 @@
resultHasExternalModuleIndicator = false; // unused in external module bundle emit (all external modules are within module blocks, therefore are known to be modules)
needsDeclare = false;
var statements_4 = ts.visitNodes(sourceFile.statements, visitDeclarationStatements);
- var newFile = ts.updateSourceFileNode(sourceFile, [ts.createModuleDeclaration([], [ts.createModifier(125 /* DeclareKeyword */)], ts.createLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), ts.createModuleBlock(ts.setTextRange(ts.createNodeArray(transformAndReplaceLatePaintedStatements(statements_4)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []);
+ var newFile = ts.updateSourceFileNode(sourceFile, [ts.createModuleDeclaration([], [ts.createModifier(126 /* DeclareKeyword */)], ts.createLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), ts.createModuleBlock(ts.setTextRange(ts.createNodeArray(transformAndReplaceLatePaintedStatements(statements_4)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []);
return newFile;
}
needsDeclare = true;
var updated = ts.visitNodes(sourceFile.statements, visitDeclarationStatements);
return ts.updateSourceFileNode(sourceFile, transformAndReplaceLatePaintedStatements(updated), /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []);
}), ts.mapDefined(node.prepends, function (prepend) {
- if (prepend.kind === 287 /* InputFiles */) {
+ if (prepend.kind === 288 /* InputFiles */) {
var sourceFile = ts.createUnparsedSourceFile(prepend, "dts", stripInternal);
hasNoDefaultLib_1 = hasNoDefaultLib_1 || !!sourceFile.hasNoDefaultLib;
collectReferences(sourceFile, refs);
@@ -81670,11 +82514,11 @@
return ret;
}
function filterBindingPatternInitializers(name) {
- if (name.kind === 72 /* Identifier */) {
+ if (name.kind === 73 /* Identifier */) {
return name;
}
else {
- if (name.kind === 185 /* ArrayBindingPattern */) {
+ if (name.kind === 186 /* ArrayBindingPattern */) {
return ts.updateArrayBindingPattern(name, ts.visitNodes(name.elements, visitBindingElement));
}
else {
@@ -81682,7 +82526,7 @@
}
}
function visitBindingElement(elem) {
- if (elem.kind === 210 /* OmittedExpression */) {
+ if (elem.kind === 211 /* OmittedExpression */) {
return elem;
}
return ts.updateBindingElement(elem, elem.dotDotDotToken, elem.propertyName, filterBindingPatternInitializers(elem.name), shouldPrintWithInitializer(elem) ? elem.initializer : undefined);
@@ -81720,19 +82564,19 @@
// Literal const declarations will have an initializer ensured rather than a type
return;
}
- var shouldUseResolverType = node.kind === 151 /* Parameter */ &&
+ var shouldUseResolverType = node.kind === 152 /* Parameter */ &&
(resolver.isRequiredInitializedParameter(node) ||
resolver.isOptionalUninitializedParameterProperty(node));
if (type && !shouldUseResolverType) {
return ts.visitNode(type, visitDeclarationSubtree);
}
if (!ts.getParseTreeNode(node)) {
- return type ? ts.visitNode(type, visitDeclarationSubtree) : ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ return type ? ts.visitNode(type, visitDeclarationSubtree) : ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
- if (node.kind === 159 /* SetAccessor */) {
+ if (node.kind === 160 /* SetAccessor */) {
// Set accessors with no associated type node (from it's param or get accessor return) are `any` since they are never contextually typed right now
// (The inferred type here will be void, but the old declaration emitter printed `any`, so this replicates that)
- return ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ return ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
errorNameNode = node.name;
var oldDiag;
@@ -81740,12 +82584,12 @@
oldDiag = getSymbolAccessibilityDiagnostic;
getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(node);
}
- if (node.kind === 237 /* VariableDeclaration */ || node.kind === 186 /* BindingElement */) {
+ if (node.kind === 238 /* VariableDeclaration */ || node.kind === 187 /* BindingElement */) {
return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker));
}
- if (node.kind === 151 /* Parameter */
- || node.kind === 154 /* PropertyDeclaration */
- || node.kind === 153 /* PropertySignature */) {
+ if (node.kind === 152 /* Parameter */
+ || node.kind === 155 /* PropertyDeclaration */
+ || node.kind === 154 /* PropertySignature */) {
if (!node.initializer)
return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType));
return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType) || resolver.createTypeOfExpression(node.initializer, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker));
@@ -81756,26 +82600,26 @@
if (!suppressNewDiagnosticContexts) {
getSymbolAccessibilityDiagnostic = oldDiag;
}
- return returnValue || ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ return returnValue || ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
}
function isDeclarationAndNotVisible(node) {
node = ts.getParseTreeNode(node);
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 240 /* ClassDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 243 /* EnumDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 244 /* EnumDeclaration */:
return !resolver.isDeclarationVisible(node);
// The following should be doing their own visibility checks based on filtering their members
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return !getBindingNameVisible(node);
- case 248 /* ImportEqualsDeclaration */:
- case 249 /* ImportDeclaration */:
- case 255 /* ExportDeclaration */:
- case 254 /* ExportAssignment */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 256 /* ExportDeclaration */:
+ case 255 /* ExportAssignment */:
return false;
}
return false;
@@ -81829,7 +82673,7 @@
function rewriteModuleSpecifier(parent, input) {
if (!input)
return undefined; // TODO: GH#18217
- resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 244 /* ModuleDeclaration */ && parent.kind !== 183 /* ImportType */);
+ resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 245 /* ModuleDeclaration */ && parent.kind !== 184 /* ImportType */);
if (ts.isStringLiteralLike(input)) {
if (isBundledEmit) {
var newName = ts.getExternalModuleNameFromDeclaration(context.getEmitHost(), resolver, parent);
@@ -81849,7 +82693,7 @@
function transformImportEqualsDeclaration(decl) {
if (!resolver.isDeclarationVisible(decl))
return;
- if (decl.moduleReference.kind === 259 /* ExternalModuleReference */) {
+ if (decl.moduleReference.kind === 260 /* ExternalModuleReference */) {
// Rewrite external module names if necessary
var specifier = ts.getExternalModuleImportEqualsDeclarationExpression(decl);
return ts.updateImportEqualsDeclaration(decl,
@@ -81876,7 +82720,7 @@
return visibleDefaultBinding && ts.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, ts.updateImportClause(decl.importClause, visibleDefaultBinding,
/*namedBindings*/ undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier));
}
- if (decl.importClause.namedBindings.kind === 251 /* NamespaceImport */) {
+ if (decl.importClause.namedBindings.kind === 252 /* NamespaceImport */) {
// Namespace import (optionally with visible default)
var namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : /*namedBindings*/ undefined;
return visibleDefaultBinding || namedBindings ? ts.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, ts.updateImportClause(decl.importClause, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier)) : undefined;
@@ -81984,68 +82828,68 @@
checkEntityNameVisibility(input.exprName, enclosingDeclaration);
}
var oldWithinObjectLiteralType = suppressNewDiagnosticContexts;
- var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 168 /* TypeLiteral */ || input.kind === 181 /* MappedType */) && input.parent.kind !== 242 /* TypeAliasDeclaration */);
+ var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 169 /* TypeLiteral */ || input.kind === 182 /* MappedType */) && input.parent.kind !== 243 /* TypeAliasDeclaration */);
if (shouldEnterSuppressNewDiagnosticsContextContext) {
// We stop making new diagnostic contexts within object literal types. Unless it's an object type on the RHS of a type alias declaration. Then we do.
suppressNewDiagnosticContexts = true;
}
if (isProcessedComponent(input)) {
switch (input.kind) {
- case 211 /* ExpressionWithTypeArguments */: {
+ case 212 /* ExpressionWithTypeArguments */: {
if ((ts.isEntityName(input.expression) || ts.isEntityNameExpression(input.expression))) {
checkEntityNameVisibility(input.expression, enclosingDeclaration);
}
var node = ts.visitEachChild(input, visitDeclarationSubtree, context);
return cleanup(ts.updateExpressionWithTypeArguments(node, ts.parenthesizeTypeParameters(node.typeArguments), node.expression));
}
- case 164 /* TypeReference */: {
+ case 165 /* TypeReference */: {
checkEntityNameVisibility(input.typeName, enclosingDeclaration);
var node = ts.visitEachChild(input, visitDeclarationSubtree, context);
return cleanup(ts.updateTypeReferenceNode(node, node.typeName, ts.parenthesizeTypeParameters(node.typeArguments)));
}
- case 161 /* ConstructSignature */:
+ case 162 /* ConstructSignature */:
return cleanup(ts.updateConstructSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type)));
- case 157 /* Constructor */: {
+ case 158 /* Constructor */: {
var isPrivate = ts.hasModifier(input, 8 /* Private */);
// A constructor declaration may not have a type annotation
- var ctor = ts.createSignatureDeclaration(157 /* Constructor */, isPrivate ? undefined : ensureTypeParams(input, input.typeParameters),
+ var ctor = ts.createSignatureDeclaration(158 /* Constructor */, isPrivate ? undefined : ensureTypeParams(input, input.typeParameters),
// TODO: GH#18217
isPrivate ? undefined : updateParamsList(input, input.parameters, 0 /* None */),
/*type*/ undefined);
ctor.modifiers = ts.createNodeArray(ensureModifiers(input));
return cleanup(ctor);
}
- case 156 /* MethodDeclaration */: {
- var sig = ts.createSignatureDeclaration(155 /* MethodSignature */, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type));
+ case 157 /* MethodDeclaration */: {
+ var sig = ts.createSignatureDeclaration(156 /* MethodSignature */, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type));
sig.name = input.name;
sig.modifiers = ts.createNodeArray(ensureModifiers(input));
sig.questionToken = input.questionToken;
return cleanup(sig);
}
- case 158 /* GetAccessor */: {
+ case 159 /* GetAccessor */: {
var newNode = ensureAccessor(input);
return cleanup(newNode);
}
- case 159 /* SetAccessor */: {
+ case 160 /* SetAccessor */: {
var newNode = ensureAccessor(input);
return cleanup(newNode);
}
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return cleanup(ts.updateProperty(input,
/*decorators*/ undefined, ensureModifiers(input), input.name, input.questionToken, !ts.hasModifier(input, 8 /* Private */) ? ensureType(input, input.type) : undefined, ensureNoInitializer(input)));
- case 153 /* PropertySignature */:
+ case 154 /* PropertySignature */:
return cleanup(ts.updatePropertySignature(input, ensureModifiers(input), input.name, input.questionToken, !ts.hasModifier(input, 8 /* Private */) ? ensureType(input, input.type) : undefined, ensureNoInitializer(input)));
- case 155 /* MethodSignature */: {
+ case 156 /* MethodSignature */: {
return cleanup(ts.updateMethodSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type), input.name, input.questionToken));
}
- case 160 /* CallSignature */: {
+ case 161 /* CallSignature */: {
return cleanup(ts.updateCallSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type)));
}
- case 162 /* IndexSignature */: {
+ case 163 /* IndexSignature */: {
return cleanup(ts.updateIndexSignature(input,
- /*decorators*/ undefined, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || ts.createKeywordTypeNode(120 /* AnyKeyword */)));
+ /*decorators*/ undefined, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || ts.createKeywordTypeNode(121 /* AnyKeyword */)));
}
- case 237 /* VariableDeclaration */: {
+ case 238 /* VariableDeclaration */: {
if (ts.isBindingPattern(input.name)) {
return recreateBindingPattern(input.name);
}
@@ -82053,13 +82897,13 @@
suppressNewDiagnosticContexts = true; // Variable declaration types also suppress new diagnostic contexts, provided the contexts wouldn't be made for binding pattern types
return cleanup(ts.updateVariableDeclaration(input, input.name, ensureType(input, input.type), ensureNoInitializer(input)));
}
- case 150 /* TypeParameter */: {
+ case 151 /* TypeParameter */: {
if (isPrivateMethodTypeParameter(input) && (input.default || input.constraint)) {
return cleanup(ts.updateTypeParameterDeclaration(input, input.name, /*constraint*/ undefined, /*defaultType*/ undefined));
}
return cleanup(ts.visitEachChild(input, visitDeclarationSubtree, context));
}
- case 175 /* ConditionalType */: {
+ case 176 /* ConditionalType */: {
// We have to process conditional types in a special way because for visibility purposes we need to push a new enclosingDeclaration
// just for the `infer` types in the true branch. It's an implicit declaration scope that only applies to _part_ of the type.
var checkType = ts.visitNode(input.checkType, visitDeclarationSubtree);
@@ -82071,13 +82915,13 @@
var falseType = ts.visitNode(input.falseType, visitDeclarationSubtree);
return cleanup(ts.updateConditionalTypeNode(input, checkType, extendsType, trueType, falseType));
}
- case 165 /* FunctionType */: {
+ case 166 /* FunctionType */: {
return cleanup(ts.updateFunctionTypeNode(input, ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree)));
}
- case 166 /* ConstructorType */: {
+ case 167 /* ConstructorType */: {
return cleanup(ts.updateConstructorTypeNode(input, ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree)));
}
- case 183 /* ImportType */: {
+ case 184 /* ImportType */: {
if (!ts.isLiteralImportTypeNode(input))
return cleanup(input);
return cleanup(ts.updateImportTypeNode(input, ts.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)), input.qualifier, ts.visitNodes(input.typeArguments, visitDeclarationSubtree, ts.isTypeNode), input.isTypeOf));
@@ -82106,7 +82950,7 @@
}
}
function isPrivateMethodTypeParameter(node) {
- return node.parent.kind === 156 /* MethodDeclaration */ && ts.hasModifier(node.parent, 8 /* Private */);
+ return node.parent.kind === 157 /* MethodDeclaration */ && ts.hasModifier(node.parent, 8 /* Private */);
}
function visitDeclarationStatements(input) {
if (!isPreservedDeclarationStatement(input)) {
@@ -82116,7 +82960,7 @@
if (shouldStripInternal(input))
return;
switch (input.kind) {
- case 255 /* ExportDeclaration */: {
+ case 256 /* ExportDeclaration */: {
if (ts.isSourceFile(input.parent)) {
resultHasExternalModuleIndicator = true;
resultHasScopeMarker = true;
@@ -82125,13 +82969,13 @@
// Rewrite external module names if necessary
return ts.updateExportDeclaration(input, /*decorators*/ undefined, input.modifiers, input.exportClause, rewriteModuleSpecifier(input, input.moduleSpecifier));
}
- case 254 /* ExportAssignment */: {
+ case 255 /* ExportAssignment */: {
// Always visible if the parent node isn't dropped for being not visible
if (ts.isSourceFile(input.parent)) {
resultHasExternalModuleIndicator = true;
resultHasScopeMarker = true;
}
- if (input.expression.kind === 72 /* Identifier */) {
+ if (input.expression.kind === 73 /* Identifier */) {
return input;
}
else {
@@ -82141,7 +82985,7 @@
errorNode: input
}); };
var varDecl = ts.createVariableDeclaration(newId, resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined);
- var statement = ts.createVariableStatement(needsDeclare ? [ts.createModifier(125 /* DeclareKeyword */)] : [], ts.createVariableDeclarationList([varDecl], 2 /* Const */));
+ var statement = ts.createVariableStatement(needsDeclare ? [ts.createModifier(126 /* DeclareKeyword */)] : [], ts.createVariableDeclarationList([varDecl], 2 /* Const */));
return [statement, ts.updateExportAssignment(input, input.decorators, input.modifiers, newId)];
}
}
@@ -82155,10 +82999,10 @@
if (shouldStripInternal(input))
return;
switch (input.kind) {
- case 248 /* ImportEqualsDeclaration */: {
+ case 249 /* ImportEqualsDeclaration */: {
return transformImportEqualsDeclaration(input);
}
- case 249 /* ImportDeclaration */: {
+ case 250 /* ImportDeclaration */: {
return transformImportDeclaration(input);
}
}
@@ -82179,14 +83023,14 @@
}
var previousNeedsDeclare = needsDeclare;
switch (input.kind) {
- case 242 /* TypeAliasDeclaration */: // Type aliases get `declare`d if need be (for legacy support), but that's all
+ case 243 /* TypeAliasDeclaration */: // Type aliases get `declare`d if need be (for legacy support), but that's all
return cleanup(ts.updateTypeAliasDeclaration(input,
/*decorators*/ undefined, ensureModifiers(input, isPrivate), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode)));
- case 241 /* InterfaceDeclaration */: {
+ case 242 /* InterfaceDeclaration */: {
return cleanup(ts.updateInterfaceDeclaration(input,
/*decorators*/ undefined, ensureModifiers(input, isPrivate), input.name, ensureTypeParams(input, input.typeParameters), transformHeritageClauses(input.heritageClauses), ts.visitNodes(input.members, visitDeclarationSubtree)));
}
- case 239 /* FunctionDeclaration */: {
+ case 240 /* FunctionDeclaration */: {
// Generators lose their generator-ness, excepting their return type
var clean = cleanup(ts.updateFunctionDeclaration(input,
/*decorators*/ undefined, ensureModifiers(input, isPrivate),
@@ -82204,16 +83048,32 @@
return ts.createVariableStatement(/*modifiers*/ undefined, ts.createVariableDeclarationList([varDecl]));
});
var namespaceDecl = ts.createModuleDeclaration(/*decorators*/ undefined, ensureModifiers(input, isPrivate), input.name, ts.createModuleBlock(declarations), 16 /* Namespace */);
+ if (!ts.hasModifier(clean, 513 /* ExportDefault */)) {
return [clean, namespaceDecl];
}
+ var modifiers = ts.createModifiersFromModifierFlags((ts.getModifierFlags(clean) & ~513 /* ExportDefault */) | 2 /* Ambient */);
+ var cleanDeclaration = ts.updateFunctionDeclaration(clean,
+ /*decorators*/ undefined, modifiers,
+ /*asteriskToken*/ undefined, clean.name, clean.typeParameters, clean.parameters, clean.type,
+ /*body*/ undefined);
+ var namespaceDeclaration = ts.updateModuleDeclaration(namespaceDecl,
+ /*decorators*/ undefined, modifiers, namespaceDecl.name, namespaceDecl.body);
+ var exportDefaultDeclaration = ts.createExportAssignment(
+ /*decorators*/ undefined,
+ /*modifiers*/ undefined,
+ /*isExportEquals*/ false, namespaceDecl.name);
+ resultHasExternalModuleIndicator = true;
+ resultHasScopeMarker = true;
+ return [cleanDeclaration, namespaceDeclaration, exportDefaultDeclaration];
+ }
else {
return clean;
}
}
- case 244 /* ModuleDeclaration */: {
+ case 245 /* ModuleDeclaration */: {
needsDeclare = false;
var inner = input.body;
- if (inner && inner.kind === 245 /* ModuleBlock */) {
+ if (inner && inner.kind === 246 /* ModuleBlock */) {
var statements = ts.visitNodes(inner.statements, visitDeclarationStatements);
var body = ts.updateModuleBlock(inner, transformAndReplaceLatePaintedStatements(statements));
needsDeclare = previousNeedsDeclare;
@@ -82234,7 +83094,7 @@
/*decorators*/ undefined, mods, input.name, body));
}
}
- case 240 /* ClassDeclaration */: {
+ case 241 /* ClassDeclaration */: {
var modifiers = ts.createNodeArray(ensureModifiers(input, isPrivate));
var typeParameters = ensureTypeParams(input, input.typeParameters);
var ctor = ts.getFirstConstructorWithBody(input);
@@ -82245,7 +83105,7 @@
if (!ts.hasModifier(param, 92 /* ParameterPropertyModifier */) || shouldStripInternal(param))
return;
getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(param);
- if (param.name.kind === 72 /* Identifier */) {
+ if (param.name.kind === 73 /* Identifier */) {
return preserveJsDoc(ts.createProperty(
/*decorators*/ undefined, ensureModifiers(param), param.name, param.questionToken, ensureType(param, param.type), ensureNoInitializer(param)), param);
}
@@ -82275,7 +83135,7 @@
}
var members = ts.createNodeArray(ts.concatenate(parameterProperties, ts.visitNodes(input.members, visitDeclarationSubtree)));
var extendsClause_1 = ts.getEffectiveBaseTypeNode(input);
- if (extendsClause_1 && !ts.isEntityNameExpression(extendsClause_1.expression) && extendsClause_1.expression.kind !== 96 /* NullKeyword */) {
+ if (extendsClause_1 && !ts.isEntityNameExpression(extendsClause_1.expression) && extendsClause_1.expression.kind !== 97 /* NullKeyword */) {
// We must add a temporary declaration for the extends clause expression
var oldId = input.name ? ts.unescapeLeadingUnderscores(input.name.escapedText) : "default";
var newId_1 = ts.createOptimisticUniqueName(oldId + "_base");
@@ -82285,16 +83145,16 @@
typeName: input.name
}); };
var varDecl = ts.createVariableDeclaration(newId_1, resolver.createTypeOfExpression(extendsClause_1.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined);
- var statement = ts.createVariableStatement(needsDeclare ? [ts.createModifier(125 /* DeclareKeyword */)] : [], ts.createVariableDeclarationList([varDecl], 2 /* Const */));
+ var statement = ts.createVariableStatement(needsDeclare ? [ts.createModifier(126 /* DeclareKeyword */)] : [], ts.createVariableDeclarationList([varDecl], 2 /* Const */));
var heritageClauses = ts.createNodeArray(ts.map(input.heritageClauses, function (clause) {
- if (clause.token === 86 /* ExtendsKeyword */) {
+ if (clause.token === 87 /* ExtendsKeyword */) {
var oldDiag_2 = getSymbolAccessibilityDiagnostic;
getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(clause.types[0]);
var newClause = ts.updateHeritageClause(clause, ts.map(clause.types, function (t) { return ts.updateExpressionWithTypeArguments(t, ts.visitNodes(t.typeArguments, visitDeclarationSubtree), newId_1); }));
getSymbolAccessibilityDiagnostic = oldDiag_2;
return newClause;
}
- return ts.updateHeritageClause(clause, ts.visitNodes(ts.createNodeArray(ts.filter(clause.types, function (t) { return ts.isEntityNameExpression(t.expression) || t.expression.kind === 96 /* NullKeyword */; })), visitDeclarationSubtree));
+ return ts.updateHeritageClause(clause, ts.visitNodes(ts.createNodeArray(ts.filter(clause.types, function (t) { return ts.isEntityNameExpression(t.expression) || t.expression.kind === 97 /* NullKeyword */; })), visitDeclarationSubtree));
}));
return [statement, cleanup(ts.updateClassDeclaration(input,
/*decorators*/ undefined, modifiers, input.name, typeParameters, heritageClauses, members))]; // TODO: GH#18217
@@ -82305,10 +83165,10 @@
/*decorators*/ undefined, modifiers, input.name, typeParameters, heritageClauses, members));
}
}
- case 219 /* VariableStatement */: {
+ case 220 /* VariableStatement */: {
return cleanup(transformVariableStatement(input, isPrivate));
}
- case 243 /* EnumDeclaration */: {
+ case 244 /* EnumDeclaration */: {
return cleanup(ts.updateEnumDeclaration(input, /*decorators*/ undefined, ts.createNodeArray(ensureModifiers(input, isPrivate)), input.name, ts.createNodeArray(ts.mapDefined(input.members, function (m) {
if (shouldStripInternal(m))
return;
@@ -82327,7 +83187,7 @@
if (canProdiceDiagnostic) {
getSymbolAccessibilityDiagnostic = oldDiag;
}
- if (input.kind === 244 /* ModuleDeclaration */) {
+ if (input.kind === 245 /* ModuleDeclaration */) {
needsDeclare = previousNeedsDeclare;
}
if (node === input) {
@@ -82348,7 +83208,7 @@
return ts.flatten(ts.mapDefined(d.elements, function (e) { return recreateBindingElement(e); }));
}
function recreateBindingElement(e) {
- if (e.kind === 210 /* OmittedExpression */) {
+ if (e.kind === 211 /* OmittedExpression */) {
return;
}
if (e.name) {
@@ -82401,7 +83261,7 @@
function ensureModifierFlags(node, privateDeclaration) {
var mask = 3071 /* All */ ^ (4 /* Public */ | 256 /* Async */); // No async modifiers in declaration files
var additions = (needsDeclare && !isAlwaysType(node)) ? 2 /* Ambient */ : 0 /* None */;
- var parentIsFile = node.parent.kind === 284 /* SourceFile */;
+ var parentIsFile = node.parent.kind === 285 /* SourceFile */;
if (!parentIsFile || (isBundledEmit && parentIsFile && ts.isExternalModule(node.parent))) {
mask ^= ((privateDeclaration || (isBundledEmit && parentIsFile) || hasScopeMarker(node.parent) ? 0 : 1 /* Export */) | 2 /* Ambient */);
additions = 0 /* None */;
@@ -82422,7 +83282,7 @@
var prop = ts.createProperty(/*decorators*/ undefined, maskModifiers(node, /*mask*/ undefined, (!accessors.setAccessor) ? 64 /* Readonly */ : 0 /* None */), node.name, node.questionToken, ensureType(node, accessorType), /*initializer*/ undefined);
var leadingsSyntheticCommentRanges = accessors.secondAccessor && ts.getLeadingCommentRangesOfNode(accessors.secondAccessor, currentSourceFile);
if (leadingsSyntheticCommentRanges) {
- var _loop_10 = function (range) {
+ var _loop_13 = function (range) {
if (range.kind === 3 /* MultiLineCommentTrivia */) {
var text = currentSourceFile.text.slice(range.pos + 2, range.end - 2);
var lines = text.split(/\r\n?|\n/g);
@@ -82436,20 +83296,20 @@
};
for (var _i = 0, leadingsSyntheticCommentRanges_1 = leadingsSyntheticCommentRanges; _i < leadingsSyntheticCommentRanges_1.length; _i++) {
var range = leadingsSyntheticCommentRanges_1[_i];
- _loop_10(range);
+ _loop_13(range);
}
}
return prop;
}
function transformHeritageClauses(nodes) {
return ts.createNodeArray(ts.filter(ts.map(nodes, function (clause) { return ts.updateHeritageClause(clause, ts.visitNodes(ts.createNodeArray(ts.filter(clause.types, function (t) {
- return ts.isEntityNameExpression(t.expression) || (clause.token === 86 /* ExtendsKeyword */ && t.expression.kind === 96 /* NullKeyword */);
+ return ts.isEntityNameExpression(t.expression) || (clause.token === 87 /* ExtendsKeyword */ && t.expression.kind === 97 /* NullKeyword */);
})), visitDeclarationSubtree)); }), function (clause) { return clause.types && !!clause.types.length; }));
}
}
ts.transformDeclarations = transformDeclarations;
function isAlwaysType(node) {
- if (node.kind === 241 /* InterfaceDeclaration */) {
+ if (node.kind === 242 /* InterfaceDeclaration */) {
return true;
}
return false;
@@ -82474,7 +83334,7 @@
}
function getTypeAnnotationFromAccessor(accessor) {
if (accessor) {
- return accessor.kind === 158 /* GetAccessor */
+ return accessor.kind === 159 /* GetAccessor */
? accessor.type // Getter - return type
: accessor.parameters.length > 0
? accessor.parameters[0].type // Setter parameter type
@@ -82483,52 +83343,52 @@
}
function canHaveLiteralInitializer(node) {
switch (node.kind) {
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
return !ts.hasModifier(node, 8 /* Private */);
- case 151 /* Parameter */:
- case 237 /* VariableDeclaration */:
+ case 152 /* Parameter */:
+ case 238 /* VariableDeclaration */:
return true;
}
return false;
}
function isPreservedDeclarationStatement(node) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 240 /* ClassDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 243 /* EnumDeclaration */:
- case 219 /* VariableStatement */:
- case 249 /* ImportDeclaration */:
- case 255 /* ExportDeclaration */:
- case 254 /* ExportAssignment */:
+ case 240 /* FunctionDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 220 /* VariableStatement */:
+ case 250 /* ImportDeclaration */:
+ case 256 /* ExportDeclaration */:
+ case 255 /* ExportAssignment */:
return true;
}
return false;
}
function isProcessedComponent(node) {
switch (node.kind) {
- case 161 /* ConstructSignature */:
- case 157 /* Constructor */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 155 /* MethodSignature */:
- case 160 /* CallSignature */:
- case 162 /* IndexSignature */:
- case 237 /* VariableDeclaration */:
- case 150 /* TypeParameter */:
- case 211 /* ExpressionWithTypeArguments */:
- case 164 /* TypeReference */:
- case 175 /* ConditionalType */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 183 /* ImportType */:
+ case 162 /* ConstructSignature */:
+ case 158 /* Constructor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 156 /* MethodSignature */:
+ case 161 /* CallSignature */:
+ case 163 /* IndexSignature */:
+ case 238 /* VariableDeclaration */:
+ case 151 /* TypeParameter */:
+ case 212 /* ExpressionWithTypeArguments */:
+ case 165 /* TypeReference */:
+ case 176 /* ConditionalType */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 184 /* ImportType */:
return true;
}
return false;
@@ -82560,17 +83420,27 @@
SyntaxKindFeatureFlags[SyntaxKindFeatureFlags["Substitution"] = 1] = "Substitution";
SyntaxKindFeatureFlags[SyntaxKindFeatureFlags["EmitNotifications"] = 2] = "EmitNotifications";
})(SyntaxKindFeatureFlags || (SyntaxKindFeatureFlags = {}));
- function getTransformers(compilerOptions, customTransformers) {
+ ts.noTransformers = { scriptTransformers: ts.emptyArray, declarationTransformers: ts.emptyArray };
+ function getTransformers(compilerOptions, customTransformers, emitOnlyDtsFiles) {
+ return {
+ scriptTransformers: getScriptTransformers(compilerOptions, customTransformers, emitOnlyDtsFiles),
+ declarationTransformers: getDeclarationTransformers(customTransformers),
+ };
+ }
+ ts.getTransformers = getTransformers;
+ function getScriptTransformers(compilerOptions, customTransformers, emitOnlyDtsFiles) {
+ if (emitOnlyDtsFiles)
+ return ts.emptyArray;
var jsx = compilerOptions.jsx;
var languageVersion = ts.getEmitScriptTarget(compilerOptions);
var moduleKind = ts.getEmitModuleKind(compilerOptions);
var transformers = [];
- ts.addRange(transformers, customTransformers && customTransformers.before);
+ ts.addRange(transformers, customTransformers && ts.map(customTransformers.before, wrapScriptTransformerFactory));
transformers.push(ts.transformTypeScript);
if (jsx === 2 /* React */) {
transformers.push(ts.transformJsx);
}
- if (languageVersion < 7 /* ESNext */) {
+ if (languageVersion < 8 /* ESNext */) {
transformers.push(ts.transformESNext);
}
if (languageVersion < 6 /* ES2019 */) {
@@ -82595,10 +83465,38 @@
if (languageVersion < 1 /* ES5 */) {
transformers.push(ts.transformES5);
}
- ts.addRange(transformers, customTransformers && customTransformers.after);
+ ts.addRange(transformers, customTransformers && ts.map(customTransformers.after, wrapScriptTransformerFactory));
return transformers;
}
- ts.getTransformers = getTransformers;
+ function getDeclarationTransformers(customTransformers) {
+ var transformers = [];
+ transformers.push(ts.transformDeclarations);
+ ts.addRange(transformers, customTransformers && ts.map(customTransformers.afterDeclarations, wrapDeclarationTransformerFactory));
+ return transformers;
+ }
+ /**
+ * Wrap a custom script or declaration transformer object in a `Transformer` callback with fallback support for transforming bundles.
+ */
+ function wrapCustomTransformer(transformer) {
+ return function (node) { return ts.isBundle(node) ? transformer.transformBundle(node) : transformer.transformSourceFile(node); };
+ }
+ /**
+ * Wrap a transformer factory that may return a custom script or declaration transformer object.
+ */
+ function wrapCustomTransformerFactory(transformer, handleDefault) {
+ return function (context) {
+ var customTransformer = transformer(context);
+ return typeof customTransformer === "function"
+ ? handleDefault(customTransformer)
+ : wrapCustomTransformer(customTransformer);
+ };
+ }
+ function wrapScriptTransformerFactory(transformer) {
+ return wrapCustomTransformerFactory(transformer, ts.chainBundle);
+ }
+ function wrapDeclarationTransformerFactory(transformer) {
+ return wrapCustomTransformerFactory(transformer, ts.identity);
+ }
function noEmitSubstitution(_hint, node) {
return node;
}
@@ -82618,7 +83516,7 @@
* @param allowDtsFiles A value indicating whether to allow the transformation of .d.ts files.
*/
function transformNodes(resolver, host, options, nodes, transformers, allowDtsFiles) {
- var enabledSyntaxKindFeatures = new Array(317 /* Count */);
+ var enabledSyntaxKindFeatures = new Array(318 /* Count */);
var lexicalEnvironmentVariableDeclarations;
var lexicalEnvironmentFunctionDeclarations;
var lexicalEnvironmentVariableDeclarationsStack = [];
@@ -82671,7 +83569,14 @@
}
ts.performance.mark("beforeTransform");
// Chain together and initialize each transformer.
- var transformation = ts.chain.apply(void 0, transformers)(context);
+ var transformersWithContext = transformers.map(function (t) { return t(context); });
+ var transformation = function (node) {
+ for (var _i = 0, transformersWithContext_1 = transformersWithContext; _i < transformersWithContext_1.length; _i++) {
+ var transform = transformersWithContext_1[_i];
+ node = transform(node);
+ }
+ return node;
+ };
// prevent modification of transformation hooks.
state = 1 /* Initialized */;
// Transform each node.
@@ -82823,6 +83728,7 @@
if (lexicalEnvironmentVariableDeclarations) {
var statement = ts.createVariableStatement(
/*modifiers*/ undefined, ts.createVariableDeclarationList(lexicalEnvironmentVariableDeclarations));
+ ts.setEmitFlags(statement, 1048576 /* CustomPrologue */);
if (!statements) {
statements = [statement];
}
@@ -82930,7 +83836,7 @@
/*@internal*/
function getOutputPathForBuildInfo(options) {
var configFile = options.configFilePath;
- if (!configFile || !ts.isIncrementalCompilation(options))
+ if (!ts.isIncrementalCompilation(options))
return undefined;
if (options.tsBuildInfoFile)
return options.tsBuildInfoFile;
@@ -82940,6 +83846,8 @@
buildInfoExtensionLess = ts.removeFileExtension(outPath);
}
else {
+ if (!configFile)
+ return undefined;
var configFileExtensionLess = ts.removeFileExtension(configFile);
buildInfoExtensionLess = options.outDir ?
options.rootDir ?
@@ -82964,7 +83872,7 @@
/*@internal*/
function getOutputPathsFor(sourceFile, host, forceDtsPaths) {
var options = host.getCompilerOptions();
- if (sourceFile.kind === 285 /* Bundle */) {
+ if (sourceFile.kind === 286 /* Bundle */) {
return getOutputPathsForBundle(options, forceDtsPaths);
}
else {
@@ -83091,14 +83999,15 @@
ts.getFirstProjectOutput = getFirstProjectOutput;
/*@internal*/
// targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature
- function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles, transformers, declarationTransformers, onlyBuildInfo) {
+ function emitFiles(resolver, host, targetSourceFile, _a, emitOnlyDtsFiles, onlyBuildInfo) {
+ var scriptTransformers = _a.scriptTransformers, declarationTransformers = _a.declarationTransformers;
var compilerOptions = host.getCompilerOptions();
var sourceMapDataList = (compilerOptions.sourceMap || compilerOptions.inlineSourceMap || ts.getAreDeclarationMapsEnabled(compilerOptions)) ? [] : undefined;
var emittedFilesList = compilerOptions.listEmittedFiles ? [] : undefined;
var emitterDiagnostics = ts.createDiagnosticCollection();
var newLine = ts.getNewLineCharacter(compilerOptions, function () { return host.getNewLine(); });
var writer = ts.createTextWriter(newLine);
- var _a = ts.performance.createTimer("printTime", "beforePrint", "afterPrint"), enter = _a.enter, exit = _a.exit;
+ var _b = ts.performance.createTimer("printTime", "beforePrint", "afterPrint"), enter = _b.enter, exit = _b.exit;
var bundleBuildInfo;
var emitSkipped = false;
var exportedModulesFromDeclarationEmit;
@@ -83167,7 +84076,7 @@
return;
}
// Transform the source files
- var transform = ts.transformNodes(resolver, host, compilerOptions, [sourceFileOrBundle], transformers, /*allowDtsFiles*/ false);
+ var transform = ts.transformNodes(resolver, host, compilerOptions, [sourceFileOrBundle], scriptTransformers, /*allowDtsFiles*/ false);
var printerOptions = {
removeComments: compilerOptions.removeComments,
newLine: compilerOptions.newLine,
@@ -83208,7 +84117,7 @@
// Do that here when emitting only dts files
nonJsFiles.forEach(collectLinkedAliases);
}
- var declarationTransform = ts.transformNodes(resolver, host, compilerOptions, inputListOrBundle, ts.concatenate([ts.transformDeclarations], declarationTransformers), /*allowDtsFiles*/ false);
+ var declarationTransform = ts.transformNodes(resolver, host, compilerOptions, inputListOrBundle, declarationTransformers, /*allowDtsFiles*/ false);
if (ts.length(declarationTransform.diagnostics)) {
for (var _a = 0, _b = declarationTransform.diagnostics; _a < _b.length; _a++) {
var diagnostic = _b[_a];
@@ -83245,7 +84154,7 @@
mapRoot: compilerOptions.mapRoot,
extendedDiagnostics: compilerOptions.extendedDiagnostics,
});
- if (emitOnlyDtsFiles && declarationTransform.transformed[0].kind === 284 /* SourceFile */) {
+ if (emitOnlyDtsFiles && declarationTransform.transformed[0].kind === 285 /* SourceFile */) {
var sourceFile = declarationTransform.transformed[0];
exportedModulesFromDeclarationEmit = sourceFile.exportedModulesFromDeclarationEmit;
}
@@ -83256,7 +84165,7 @@
}
function collectLinkedAliases(node) {
if (ts.isExportAssignment(node)) {
- if (node.expression.kind === 72 /* Identifier */) {
+ if (node.expression.kind === 73 /* Identifier */) {
resolver.collectLinkedAliases(node.expression, /*setVisibility*/ true);
}
return;
@@ -83268,8 +84177,8 @@
ts.forEachChild(node, collectLinkedAliases);
}
function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, sourceFileOrBundle, printer, mapOptions) {
- var bundle = sourceFileOrBundle.kind === 285 /* Bundle */ ? sourceFileOrBundle : undefined;
- var sourceFile = sourceFileOrBundle.kind === 284 /* SourceFile */ ? sourceFileOrBundle : undefined;
+ var bundle = sourceFileOrBundle.kind === 286 /* Bundle */ ? sourceFileOrBundle : undefined;
+ var sourceFile = sourceFileOrBundle.kind === 285 /* SourceFile */ ? sourceFileOrBundle : undefined;
var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile];
var sourceMapGenerator;
if (shouldEmitSourceMaps(mapOptions, sourceFileOrBundle)) {
@@ -83310,7 +84219,7 @@
}
function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) {
return (mapOptions.sourceMap || mapOptions.inlineSourceMap)
- && (sourceFileOrBundle.kind !== 284 /* SourceFile */ || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Json */));
+ && (sourceFileOrBundle.kind !== 285 /* SourceFile */ || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Json */));
}
function getSourceRoot(mapOptions) {
// Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the
@@ -83420,7 +84329,7 @@
};
function createSourceFilesFromBundleBuildInfo(bundle) {
var sourceFiles = bundle.sourceFiles.map(function (fileName) {
- var sourceFile = ts.createNode(284 /* SourceFile */, 0, 0);
+ var sourceFile = ts.createNode(285 /* SourceFile */, 0, 0);
sourceFile.fileName = fileName;
sourceFile.text = "";
sourceFile.statements = ts.createNodeArray();
@@ -83432,7 +84341,7 @@
sourceFile.text = prologueInfo.text;
sourceFile.end = prologueInfo.text.length;
sourceFile.statements = ts.createNodeArray(prologueInfo.directives.map(function (directive) {
- var statement = ts.createNode(221 /* ExpressionStatement */, directive.pos, directive.end);
+ var statement = ts.createNode(222 /* ExpressionStatement */, directive.pos, directive.end);
statement.expression = ts.createNode(10 /* StringLiteral */, directive.expression.pos, directive.expression.end);
statement.expression.text = directive.expression.text;
return statement;
@@ -83524,7 +84433,7 @@
useCaseSensitiveFileNames: function () { return host.useCaseSensitiveFileNames(); },
getProgramBuildInfo: ts.returnUndefined
};
- emitFiles(ts.notImplementedResolver, emitHost, /*targetSourceFile*/ undefined, /*emitOnlyDtsFiles*/ false, ts.getTransformers(config.options));
+ emitFiles(ts.notImplementedResolver, emitHost, /*targetSourceFile*/ undefined, ts.getTransformers(config.options), /*emitOnlyDtsFiles*/ false);
return outputFiles;
}
ts.emitUsingBuildInfo = emitUsingBuildInfo;
@@ -83601,9 +84510,9 @@
break;
}
switch (node.kind) {
- case 284 /* SourceFile */: return printFile(node);
- case 285 /* Bundle */: return printBundle(node);
- case 286 /* UnparsedSource */: return printUnparsedSource(node);
+ case 285 /* SourceFile */: return printFile(node);
+ case 286 /* Bundle */: return printBundle(node);
+ case 287 /* UnparsedSource */: return printUnparsedSource(node);
}
writeNode(hint, node, sourceFile, beginPrint());
return endPrint();
@@ -83833,12 +84742,12 @@
}
// falls through
case 2 /* Comments */:
- if (!commentsDisabled && node.kind !== 284 /* SourceFile */) {
+ if (!commentsDisabled && node.kind !== 285 /* SourceFile */) {
return pipelineEmitWithComments;
}
// falls through
case 3 /* SourceMaps */:
- if (!sourceMapsDisabled && node.kind !== 284 /* SourceFile */ && !ts.isInJsonFile(node)) {
+ if (!sourceMapsDisabled && node.kind !== 285 /* SourceFile */ && !ts.isInJsonFile(node)) {
return pipelineEmitWithSourceMap;
}
// falls through
@@ -83875,272 +84784,272 @@
case 16 /* TemplateMiddle */:
case 17 /* TemplateTail */:
return emitLiteral(node);
- case 286 /* UnparsedSource */:
- case 280 /* UnparsedPrepend */:
+ case 287 /* UnparsedSource */:
+ case 281 /* UnparsedPrepend */:
return emitUnparsedSourceOrPrepend(node);
- case 279 /* UnparsedPrologue */:
+ case 280 /* UnparsedPrologue */:
return writeUnparsedNode(node);
- case 281 /* UnparsedText */:
- case 282 /* UnparsedInternalText */:
+ case 282 /* UnparsedText */:
+ case 283 /* UnparsedInternalText */:
return emitUnparsedTextLike(node);
- case 283 /* UnparsedSyntheticReference */:
+ case 284 /* UnparsedSyntheticReference */:
return emitUnparsedSyntheticReference(node);
// Identifiers
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return emitIdentifier(node);
// Parse tree nodes
// Names
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
return emitQualifiedName(node);
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
return emitComputedPropertyName(node);
// Signature elements
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
return emitTypeParameter(node);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return emitParameter(node);
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
return emitDecorator(node);
// Type members
- case 153 /* PropertySignature */:
+ case 154 /* PropertySignature */:
return emitPropertySignature(node);
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return emitPropertyDeclaration(node);
- case 155 /* MethodSignature */:
+ case 156 /* MethodSignature */:
return emitMethodSignature(node);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return emitMethodDeclaration(node);
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return emitConstructor(node);
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return emitAccessorDeclaration(node);
- case 160 /* CallSignature */:
+ case 161 /* CallSignature */:
return emitCallSignature(node);
- case 161 /* ConstructSignature */:
+ case 162 /* ConstructSignature */:
return emitConstructSignature(node);
- case 162 /* IndexSignature */:
+ case 163 /* IndexSignature */:
return emitIndexSignature(node);
// Types
- case 163 /* TypePredicate */:
+ case 164 /* TypePredicate */:
return emitTypePredicate(node);
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return emitTypeReference(node);
- case 165 /* FunctionType */:
+ case 166 /* FunctionType */:
return emitFunctionType(node);
- case 294 /* JSDocFunctionType */:
+ case 295 /* JSDocFunctionType */:
return emitJSDocFunctionType(node);
- case 166 /* ConstructorType */:
+ case 167 /* ConstructorType */:
return emitConstructorType(node);
- case 167 /* TypeQuery */:
+ case 168 /* TypeQuery */:
return emitTypeQuery(node);
- case 168 /* TypeLiteral */:
+ case 169 /* TypeLiteral */:
return emitTypeLiteral(node);
- case 169 /* ArrayType */:
+ case 170 /* ArrayType */:
return emitArrayType(node);
- case 170 /* TupleType */:
+ case 171 /* TupleType */:
return emitTupleType(node);
- case 171 /* OptionalType */:
+ case 172 /* OptionalType */:
return emitOptionalType(node);
- case 173 /* UnionType */:
+ case 174 /* UnionType */:
return emitUnionType(node);
- case 174 /* IntersectionType */:
+ case 175 /* IntersectionType */:
return emitIntersectionType(node);
- case 175 /* ConditionalType */:
+ case 176 /* ConditionalType */:
return emitConditionalType(node);
- case 176 /* InferType */:
+ case 177 /* InferType */:
return emitInferType(node);
- case 177 /* ParenthesizedType */:
+ case 178 /* ParenthesizedType */:
return emitParenthesizedType(node);
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return emitExpressionWithTypeArguments(node);
- case 178 /* ThisType */:
+ case 179 /* ThisType */:
return emitThisType();
- case 179 /* TypeOperator */:
+ case 180 /* TypeOperator */:
return emitTypeOperator(node);
- case 180 /* IndexedAccessType */:
+ case 181 /* IndexedAccessType */:
return emitIndexedAccessType(node);
- case 181 /* MappedType */:
+ case 182 /* MappedType */:
return emitMappedType(node);
- case 182 /* LiteralType */:
+ case 183 /* LiteralType */:
return emitLiteralType(node);
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return emitImportTypeNode(node);
- case 289 /* JSDocAllType */:
+ case 290 /* JSDocAllType */:
writePunctuation("*");
return;
- case 290 /* JSDocUnknownType */:
+ case 291 /* JSDocUnknownType */:
writePunctuation("?");
return;
- case 291 /* JSDocNullableType */:
+ case 292 /* JSDocNullableType */:
return emitJSDocNullableType(node);
- case 292 /* JSDocNonNullableType */:
+ case 293 /* JSDocNonNullableType */:
return emitJSDocNonNullableType(node);
- case 293 /* JSDocOptionalType */:
+ case 294 /* JSDocOptionalType */:
return emitJSDocOptionalType(node);
- case 172 /* RestType */:
- case 295 /* JSDocVariadicType */:
+ case 173 /* RestType */:
+ case 296 /* JSDocVariadicType */:
return emitRestOrJSDocVariadicType(node);
// Binding patterns
- case 184 /* ObjectBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
return emitObjectBindingPattern(node);
- case 185 /* ArrayBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
return emitArrayBindingPattern(node);
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return emitBindingElement(node);
// Misc
- case 216 /* TemplateSpan */:
+ case 217 /* TemplateSpan */:
return emitTemplateSpan(node);
- case 217 /* SemicolonClassElement */:
+ case 218 /* SemicolonClassElement */:
return emitSemicolonClassElement();
// Statements
- case 218 /* Block */:
+ case 219 /* Block */:
return emitBlock(node);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return emitVariableStatement(node);
- case 220 /* EmptyStatement */:
+ case 221 /* EmptyStatement */:
return emitEmptyStatement(/*isEmbeddedStatement*/ false);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return emitExpressionStatement(node);
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
return emitIfStatement(node);
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
return emitDoStatement(node);
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
return emitWhileStatement(node);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return emitForStatement(node);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return emitForInStatement(node);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return emitForOfStatement(node);
- case 228 /* ContinueStatement */:
+ case 229 /* ContinueStatement */:
return emitContinueStatement(node);
- case 229 /* BreakStatement */:
+ case 230 /* BreakStatement */:
return emitBreakStatement(node);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return emitReturnStatement(node);
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
return emitWithStatement(node);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return emitSwitchStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return emitLabeledStatement(node);
- case 234 /* ThrowStatement */:
+ case 235 /* ThrowStatement */:
return emitThrowStatement(node);
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
return emitTryStatement(node);
- case 236 /* DebuggerStatement */:
+ case 237 /* DebuggerStatement */:
return emitDebuggerStatement(node);
// Declarations
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return emitVariableDeclaration(node);
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
return emitVariableDeclarationList(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return emitFunctionDeclaration(node);
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return emitClassDeclaration(node);
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
return emitInterfaceDeclaration(node);
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return emitTypeAliasDeclaration(node);
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return emitEnumDeclaration(node);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return emitModuleDeclaration(node);
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
return emitModuleBlock(node);
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
return emitCaseBlock(node);
- case 247 /* NamespaceExportDeclaration */:
+ case 248 /* NamespaceExportDeclaration */:
return emitNamespaceExportDeclaration(node);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return emitImportEqualsDeclaration(node);
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return emitImportDeclaration(node);
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
return emitImportClause(node);
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
return emitNamespaceImport(node);
- case 252 /* NamedImports */:
+ case 253 /* NamedImports */:
return emitNamedImports(node);
- case 253 /* ImportSpecifier */:
+ case 254 /* ImportSpecifier */:
return emitImportSpecifier(node);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return emitExportAssignment(node);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return emitExportDeclaration(node);
- case 256 /* NamedExports */:
+ case 257 /* NamedExports */:
return emitNamedExports(node);
- case 257 /* ExportSpecifier */:
+ case 258 /* ExportSpecifier */:
return emitExportSpecifier(node);
- case 258 /* MissingDeclaration */:
+ case 259 /* MissingDeclaration */:
return;
// Module references
- case 259 /* ExternalModuleReference */:
+ case 260 /* ExternalModuleReference */:
return emitExternalModuleReference(node);
// JSX (non-expression)
case 11 /* JsxText */:
return emitJsxText(node);
- case 262 /* JsxOpeningElement */:
- case 265 /* JsxOpeningFragment */:
+ case 263 /* JsxOpeningElement */:
+ case 266 /* JsxOpeningFragment */:
return emitJsxOpeningElementOrFragment(node);
- case 263 /* JsxClosingElement */:
- case 266 /* JsxClosingFragment */:
+ case 264 /* JsxClosingElement */:
+ case 267 /* JsxClosingFragment */:
return emitJsxClosingElementOrFragment(node);
- case 267 /* JsxAttribute */:
+ case 268 /* JsxAttribute */:
return emitJsxAttribute(node);
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
return emitJsxAttributes(node);
- case 269 /* JsxSpreadAttribute */:
+ case 270 /* JsxSpreadAttribute */:
return emitJsxSpreadAttribute(node);
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return emitJsxExpression(node);
// Clauses
- case 271 /* CaseClause */:
+ case 272 /* CaseClause */:
return emitCaseClause(node);
- case 272 /* DefaultClause */:
+ case 273 /* DefaultClause */:
return emitDefaultClause(node);
- case 273 /* HeritageClause */:
+ case 274 /* HeritageClause */:
return emitHeritageClause(node);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return emitCatchClause(node);
// Property assignments
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return emitPropertyAssignment(node);
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return emitShorthandPropertyAssignment(node);
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
return emitSpreadAssignment(node);
// Enum
- case 278 /* EnumMember */:
+ case 279 /* EnumMember */:
return emitEnumMember(node);
// JSDoc nodes (only used in codefixes currently)
- case 304 /* JSDocParameterTag */:
- case 310 /* JSDocPropertyTag */:
+ case 305 /* JSDocParameterTag */:
+ case 311 /* JSDocPropertyTag */:
return emitJSDocPropertyLikeTag(node);
- case 305 /* JSDocReturnTag */:
- case 307 /* JSDocTypeTag */:
- case 306 /* JSDocThisTag */:
- case 303 /* JSDocEnumTag */:
+ case 306 /* JSDocReturnTag */:
+ case 308 /* JSDocTypeTag */:
+ case 307 /* JSDocThisTag */:
+ case 304 /* JSDocEnumTag */:
return emitJSDocSimpleTypedTag(node);
- case 300 /* JSDocAugmentsTag */:
+ case 301 /* JSDocAugmentsTag */:
return emitJSDocAugmentsTag(node);
- case 308 /* JSDocTemplateTag */:
+ case 309 /* JSDocTemplateTag */:
return emitJSDocTemplateTag(node);
- case 309 /* JSDocTypedefTag */:
+ case 310 /* JSDocTypedefTag */:
return emitJSDocTypedefTag(node);
- case 302 /* JSDocCallbackTag */:
+ case 303 /* JSDocCallbackTag */:
return emitJSDocCallbackTag(node);
- case 298 /* JSDocSignature */:
+ case 299 /* JSDocSignature */:
return emitJSDocSignature(node);
- case 297 /* JSDocTypeLiteral */:
+ case 298 /* JSDocTypeLiteral */:
return emitJSDocTypeLiteral(node);
- case 301 /* JSDocClassTag */:
- case 299 /* JSDocTag */:
+ case 302 /* JSDocClassTag */:
+ case 300 /* JSDocTag */:
return emitJSDocSimpleTag(node);
- case 296 /* JSDocComment */:
+ case 297 /* JSDocComment */:
return emitJSDoc(node);
// Transformation nodes (ignored)
}
@@ -84165,83 +85074,83 @@
case 14 /* NoSubstitutionTemplateLiteral */:
return emitLiteral(node);
// Identifiers
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return emitIdentifier(node);
// Reserved words
- case 87 /* FalseKeyword */:
- case 96 /* NullKeyword */:
- case 98 /* SuperKeyword */:
- case 102 /* TrueKeyword */:
- case 100 /* ThisKeyword */:
- case 92 /* ImportKeyword */:
+ case 88 /* FalseKeyword */:
+ case 97 /* NullKeyword */:
+ case 99 /* SuperKeyword */:
+ case 103 /* TrueKeyword */:
+ case 101 /* ThisKeyword */:
+ case 93 /* ImportKeyword */:
writeTokenNode(node, writeKeyword);
return;
// Expressions
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return emitArrayLiteralExpression(node);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return emitObjectLiteralExpression(node);
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return emitPropertyAccessExpression(node);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return emitElementAccessExpression(node);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return emitCallExpression(node);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return emitNewExpression(node);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return emitTaggedTemplateExpression(node);
- case 194 /* TypeAssertionExpression */:
+ case 195 /* TypeAssertionExpression */:
return emitTypeAssertionExpression(node);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return emitParenthesizedExpression(node);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return emitFunctionExpression(node);
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return emitArrowFunction(node);
- case 198 /* DeleteExpression */:
+ case 199 /* DeleteExpression */:
return emitDeleteExpression(node);
- case 199 /* TypeOfExpression */:
+ case 200 /* TypeOfExpression */:
return emitTypeOfExpression(node);
- case 200 /* VoidExpression */:
+ case 201 /* VoidExpression */:
return emitVoidExpression(node);
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
return emitAwaitExpression(node);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return emitPrefixUnaryExpression(node);
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return emitPostfixUnaryExpression(node);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return emitBinaryExpression(node);
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return emitConditionalExpression(node);
- case 206 /* TemplateExpression */:
+ case 207 /* TemplateExpression */:
return emitTemplateExpression(node);
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return emitYieldExpression(node);
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
return emitSpreadExpression(node);
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
return emitClassExpression(node);
- case 210 /* OmittedExpression */:
+ case 211 /* OmittedExpression */:
return;
- case 212 /* AsExpression */:
+ case 213 /* AsExpression */:
return emitAsExpression(node);
- case 213 /* NonNullExpression */:
+ case 214 /* NonNullExpression */:
return emitNonNullExpression(node);
- case 214 /* MetaProperty */:
+ case 215 /* MetaProperty */:
return emitMetaProperty(node);
// JSX
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
return emitJsxElement(node);
- case 261 /* JsxSelfClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
return emitJsxSelfClosingElement(node);
- case 264 /* JsxFragment */:
+ case 265 /* JsxFragment */:
return emitJsxFragment(node);
// Transformation nodes
- case 313 /* PartiallyEmittedExpression */:
+ case 314 /* PartiallyEmittedExpression */:
return emitPartiallyEmittedExpression(node);
- case 314 /* CommaListExpression */:
+ case 315 /* CommaListExpression */:
return emitCommaList(node);
}
}
@@ -84281,7 +85190,7 @@
}
function emitHelpers(node) {
var helpersEmitted = false;
- var bundle = node.kind === 285 /* Bundle */ ? node : undefined;
+ var bundle = node.kind === 286 /* Bundle */ ? node : undefined;
if (bundle && moduleKind === ts.ModuleKind.None) {
return;
}
@@ -84381,7 +85290,7 @@
var pos = getTextPosWithWriteLine();
writeUnparsedNode(unparsed);
if (bundleFileInfo) {
- updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 281 /* UnparsedText */ ?
+ updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 282 /* UnparsedText */ ?
"text" /* Text */ :
"internal" /* Internal */);
}
@@ -84414,7 +85323,7 @@
emit(node.right);
}
function emitEntityName(node) {
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
emitExpression(node);
}
else {
@@ -84450,7 +85359,7 @@
emit(node.dotDotDotToken);
emitNodeWithWriter(node.name, writeParameter);
emit(node.questionToken);
- if (node.parent && node.parent.kind === 294 /* JSDocFunctionType */ && !node.name) {
+ if (node.parent && node.parent.kind === 295 /* JSDocFunctionType */ && !node.name) {
emit(node.type);
}
else {
@@ -84512,7 +85421,7 @@
function emitAccessorDeclaration(node) {
emitDecorators(node, node.decorators);
emitModifiers(node, node.modifiers);
- writeKeyword(node.kind === 158 /* GetAccessor */ ? "get" : "set");
+ writeKeyword(node.kind === 159 /* GetAccessor */ ? "get" : "set");
writeSpace();
emit(node.name);
emitSignatureAndBody(node, emitSignatureHead);
@@ -84689,7 +85598,7 @@
}
if (node.readonlyToken) {
emit(node.readonlyToken);
- if (node.readonlyToken.kind !== 133 /* ReadonlyKeyword */) {
+ if (node.readonlyToken.kind !== 134 /* ReadonlyKeyword */) {
writeKeyword("readonly");
}
writeSpace();
@@ -84839,7 +85748,7 @@
emitExpressionList(node, node.arguments, 2576 /* CallExpressionArguments */);
}
function emitNewExpression(node) {
- emitTokenWithComment(95 /* NewKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(96 /* NewKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
emitTypeArguments(node, node.typeArguments);
@@ -84879,22 +85788,22 @@
emit(node.equalsGreaterThanToken);
}
function emitDeleteExpression(node) {
- emitTokenWithComment(81 /* DeleteKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(82 /* DeleteKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
}
function emitTypeOfExpression(node) {
- emitTokenWithComment(104 /* TypeOfKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(105 /* TypeOfKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
}
function emitVoidExpression(node) {
- emitTokenWithComment(106 /* VoidKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(107 /* VoidKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
}
function emitAwaitExpression(node) {
- emitTokenWithComment(122 /* AwaitKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(123 /* AwaitKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
}
@@ -84919,7 +85828,7 @@
// expression a prefix increment whose operand is a plus expression - (++(+x))
// The same is true of minus of course.
var operand = node.operand;
- return operand.kind === 202 /* PrefixUnaryExpression */
+ return operand.kind === 203 /* PrefixUnaryExpression */
&& ((node.operator === 38 /* PlusToken */ && (operand.operator === 38 /* PlusToken */ || operand.operator === 44 /* PlusPlusToken */))
|| (node.operator === 39 /* MinusToken */ && (operand.operator === 39 /* MinusToken */ || operand.operator === 45 /* MinusMinusToken */)));
}
@@ -84934,7 +85843,7 @@
emitExpression(node.left);
increaseIndentIf(indentBeforeOperator, isCommaOperator);
emitLeadingCommentsOfPosition(node.operatorToken.pos);
- writeTokenNode(node.operatorToken, node.operatorToken.kind === 93 /* InKeyword */ ? writeKeyword : writeOperator);
+ writeTokenNode(node.operatorToken, node.operatorToken.kind === 94 /* InKeyword */ ? writeKeyword : writeOperator);
emitTrailingCommentsOfPosition(node.operatorToken.end, /*prefixSpace*/ true); // Binary operators should have a space before the comment starts
increaseIndentIf(indentAfterOperator, /*writeSpaceIfNotIndenting*/ true);
emitExpression(node.right);
@@ -84962,7 +85871,7 @@
emitList(node, node.templateSpans, 262144 /* TemplateExpressionSpans */);
}
function emitYieldExpression(node) {
- emitTokenWithComment(117 /* YieldKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(118 /* YieldKeyword */, node.pos, writeKeyword, node);
emit(node.asteriskToken);
emitExpressionWithLeadingSpace(node.expression);
}
@@ -85039,7 +85948,7 @@
}
}
function emitIfStatement(node) {
- var openParenPos = emitTokenWithComment(91 /* IfKeyword */, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(92 /* IfKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
emitExpression(node.expression);
@@ -85047,8 +85956,8 @@
emitEmbeddedStatement(node, node.thenStatement);
if (node.elseStatement) {
writeLineOrSpace(node);
- emitTokenWithComment(83 /* ElseKeyword */, node.thenStatement.end, writeKeyword, node);
- if (node.elseStatement.kind === 222 /* IfStatement */) {
+ emitTokenWithComment(84 /* ElseKeyword */, node.thenStatement.end, writeKeyword, node);
+ if (node.elseStatement.kind === 223 /* IfStatement */) {
writeSpace();
emit(node.elseStatement);
}
@@ -85058,14 +85967,14 @@
}
}
function emitWhileClause(node, startPos) {
- var openParenPos = emitTokenWithComment(107 /* WhileKeyword */, startPos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(108 /* WhileKeyword */, startPos, writeKeyword, node);
writeSpace();
emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
emitExpression(node.expression);
emitTokenWithComment(21 /* CloseParenToken */, node.expression.end, writePunctuation, node);
}
function emitDoStatement(node) {
- emitTokenWithComment(82 /* DoKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(83 /* DoKeyword */, node.pos, writeKeyword, node);
emitEmbeddedStatement(node, node.statement);
if (ts.isBlock(node.statement)) {
writeSpace();
@@ -85081,7 +85990,7 @@
emitEmbeddedStatement(node, node.statement);
}
function emitForStatement(node) {
- var openParenPos = emitTokenWithComment(89 /* ForKeyword */, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(90 /* ForKeyword */, node.pos, writeKeyword, node);
writeSpace();
var pos = emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, /*contextNode*/ node);
emitForBinding(node.initializer);
@@ -85093,25 +86002,25 @@
emitEmbeddedStatement(node, node.statement);
}
function emitForInStatement(node) {
- var openParenPos = emitTokenWithComment(89 /* ForKeyword */, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(90 /* ForKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
emitForBinding(node.initializer);
writeSpace();
- emitTokenWithComment(93 /* InKeyword */, node.initializer.end, writeKeyword, node);
+ emitTokenWithComment(94 /* InKeyword */, node.initializer.end, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
emitTokenWithComment(21 /* CloseParenToken */, node.expression.end, writePunctuation, node);
emitEmbeddedStatement(node, node.statement);
}
function emitForOfStatement(node) {
- var openParenPos = emitTokenWithComment(89 /* ForKeyword */, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(90 /* ForKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitWithTrailingSpace(node.awaitModifier);
emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
emitForBinding(node.initializer);
writeSpace();
- emitTokenWithComment(147 /* OfKeyword */, node.initializer.end, writeKeyword, node);
+ emitTokenWithComment(148 /* OfKeyword */, node.initializer.end, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
emitTokenWithComment(21 /* CloseParenToken */, node.expression.end, writePunctuation, node);
@@ -85119,7 +86028,7 @@
}
function emitForBinding(node) {
if (node !== undefined) {
- if (node.kind === 238 /* VariableDeclarationList */) {
+ if (node.kind === 239 /* VariableDeclarationList */) {
emit(node);
}
else {
@@ -85128,12 +86037,12 @@
}
}
function emitContinueStatement(node) {
- emitTokenWithComment(78 /* ContinueKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(79 /* ContinueKeyword */, node.pos, writeKeyword, node);
emitWithLeadingSpace(node.label);
writeTrailingSemicolon();
}
function emitBreakStatement(node) {
- emitTokenWithComment(73 /* BreakKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(74 /* BreakKeyword */, node.pos, writeKeyword, node);
emitWithLeadingSpace(node.label);
writeTrailingSemicolon();
}
@@ -85161,12 +86070,12 @@
return pos;
}
function emitReturnStatement(node) {
- emitTokenWithComment(97 /* ReturnKeyword */, node.pos, writeKeyword, /*contextNode*/ node);
+ emitTokenWithComment(98 /* ReturnKeyword */, node.pos, writeKeyword, /*contextNode*/ node);
emitExpressionWithLeadingSpace(node.expression);
writeTrailingSemicolon();
}
function emitWithStatement(node) {
- var openParenPos = emitTokenWithComment(108 /* WithKeyword */, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(109 /* WithKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
emitExpression(node.expression);
@@ -85174,7 +86083,7 @@
emitEmbeddedStatement(node, node.statement);
}
function emitSwitchStatement(node) {
- var openParenPos = emitTokenWithComment(99 /* SwitchKeyword */, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(100 /* SwitchKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
emitExpression(node.expression);
@@ -85189,12 +86098,12 @@
emit(node.statement);
}
function emitThrowStatement(node) {
- emitTokenWithComment(101 /* ThrowKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(102 /* ThrowKeyword */, node.pos, writeKeyword, node);
emitExpressionWithLeadingSpace(node.expression);
writeTrailingSemicolon();
}
function emitTryStatement(node) {
- emitTokenWithComment(103 /* TryKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(104 /* TryKeyword */, node.pos, writeKeyword, node);
writeSpace();
emit(node.tryBlock);
if (node.catchClause) {
@@ -85203,13 +86112,13 @@
}
if (node.finallyBlock) {
writeLineOrSpace(node);
- emitTokenWithComment(88 /* FinallyKeyword */, (node.catchClause || node.tryBlock).end, writeKeyword, node);
+ emitTokenWithComment(89 /* FinallyKeyword */, (node.catchClause || node.tryBlock).end, writeKeyword, node);
writeSpace();
emit(node.finallyBlock);
}
}
function emitDebuggerStatement(node) {
- writeToken(79 /* DebuggerKeyword */, node.pos, writeKeyword);
+ writeToken(80 /* DebuggerKeyword */, node.pos, writeKeyword);
writeTrailingSemicolon();
}
//
@@ -85414,7 +86323,7 @@
var body = node.body;
if (!body)
return writeTrailingSemicolon();
- while (body.kind === 244 /* ModuleDeclaration */) {
+ while (body.kind === 245 /* ModuleDeclaration */) {
writePunctuation(".");
emit(body.name);
body = body.body;
@@ -85435,17 +86344,17 @@
}
function emitImportEqualsDeclaration(node) {
emitModifiers(node, node.modifiers);
- emitTokenWithComment(92 /* ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node);
+ emitTokenWithComment(93 /* ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node);
writeSpace();
emit(node.name);
writeSpace();
- emitTokenWithComment(59 /* EqualsToken */, node.name.end, writePunctuation, node);
+ emitTokenWithComment(60 /* EqualsToken */, node.name.end, writePunctuation, node);
writeSpace();
emitModuleReference(node.moduleReference);
writeTrailingSemicolon();
}
function emitModuleReference(node) {
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
emitExpression(node);
}
else {
@@ -85454,12 +86363,12 @@
}
function emitImportDeclaration(node) {
emitModifiers(node, node.modifiers);
- emitTokenWithComment(92 /* ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node);
+ emitTokenWithComment(93 /* ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node);
writeSpace();
if (node.importClause) {
emit(node.importClause);
writeSpace();
- emitTokenWithComment(144 /* FromKeyword */, node.importClause.end, writeKeyword, node);
+ emitTokenWithComment(145 /* FromKeyword */, node.importClause.end, writeKeyword, node);
writeSpace();
}
emitExpression(node.moduleSpecifier);
@@ -85476,7 +86385,7 @@
function emitNamespaceImport(node) {
var asPos = emitTokenWithComment(40 /* AsteriskToken */, node.pos, writePunctuation, node);
writeSpace();
- emitTokenWithComment(119 /* AsKeyword */, asPos, writeKeyword, node);
+ emitTokenWithComment(120 /* AsKeyword */, asPos, writeKeyword, node);
writeSpace();
emit(node.name);
}
@@ -85487,20 +86396,20 @@
emitImportOrExportSpecifier(node);
}
function emitExportAssignment(node) {
- var nextPos = emitTokenWithComment(85 /* ExportKeyword */, node.pos, writeKeyword, node);
+ var nextPos = emitTokenWithComment(86 /* ExportKeyword */, node.pos, writeKeyword, node);
writeSpace();
if (node.isExportEquals) {
- emitTokenWithComment(59 /* EqualsToken */, nextPos, writeOperator, node);
+ emitTokenWithComment(60 /* EqualsToken */, nextPos, writeOperator, node);
}
else {
- emitTokenWithComment(80 /* DefaultKeyword */, nextPos, writeKeyword, node);
+ emitTokenWithComment(81 /* DefaultKeyword */, nextPos, writeKeyword, node);
}
writeSpace();
emitExpression(node.expression);
writeTrailingSemicolon();
}
function emitExportDeclaration(node) {
- var nextPos = emitTokenWithComment(85 /* ExportKeyword */, node.pos, writeKeyword, node);
+ var nextPos = emitTokenWithComment(86 /* ExportKeyword */, node.pos, writeKeyword, node);
writeSpace();
if (node.exportClause) {
emit(node.exportClause);
@@ -85511,18 +86420,18 @@
if (node.moduleSpecifier) {
writeSpace();
var fromPos = node.exportClause ? node.exportClause.end : nextPos;
- emitTokenWithComment(144 /* FromKeyword */, fromPos, writeKeyword, node);
+ emitTokenWithComment(145 /* FromKeyword */, fromPos, writeKeyword, node);
writeSpace();
emitExpression(node.moduleSpecifier);
}
writeTrailingSemicolon();
}
function emitNamespaceExportDeclaration(node) {
- var nextPos = emitTokenWithComment(85 /* ExportKeyword */, node.pos, writeKeyword, node);
+ var nextPos = emitTokenWithComment(86 /* ExportKeyword */, node.pos, writeKeyword, node);
writeSpace();
- nextPos = emitTokenWithComment(119 /* AsKeyword */, nextPos, writeKeyword, node);
+ nextPos = emitTokenWithComment(120 /* AsKeyword */, nextPos, writeKeyword, node);
writeSpace();
- nextPos = emitTokenWithComment(131 /* NamespaceKeyword */, nextPos, writeKeyword, node);
+ nextPos = emitTokenWithComment(132 /* NamespaceKeyword */, nextPos, writeKeyword, node);
writeSpace();
emit(node.name);
writeTrailingSemicolon();
@@ -85542,7 +86451,7 @@
if (node.propertyName) {
emit(node.propertyName);
writeSpace();
- emitTokenWithComment(119 /* AsKeyword */, node.propertyName.end, writeKeyword, node);
+ emitTokenWithComment(120 /* AsKeyword */, node.propertyName.end, writeKeyword, node);
writeSpace();
}
emit(node.name);
@@ -85620,7 +86529,7 @@
}
}
function emitJsxTagName(node) {
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
emitExpression(node);
}
else {
@@ -85631,13 +86540,13 @@
// Clauses
//
function emitCaseClause(node) {
- emitTokenWithComment(74 /* CaseKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(75 /* CaseKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
emitCaseOrDefaultClauseRest(node, node.statements, node.expression.end);
}
function emitDefaultClause(node) {
- var pos = emitTokenWithComment(80 /* DefaultKeyword */, node.pos, writeKeyword, node);
+ var pos = emitTokenWithComment(81 /* DefaultKeyword */, node.pos, writeKeyword, node);
emitCaseOrDefaultClauseRest(node, node.statements, pos);
}
function emitCaseOrDefaultClauseRest(parentNode, statements, colonPos) {
@@ -85665,7 +86574,7 @@
emitList(node, node.types, 528 /* HeritageClauseTypes */);
}
function emitCatchClause(node) {
- var openParenPos = emitTokenWithComment(75 /* CatchKeyword */, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(76 /* CatchKeyword */, node.pos, writeKeyword, node);
writeSpace();
if (node.variableDeclaration) {
emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
@@ -85735,7 +86644,7 @@
}
}
if (node.tags) {
- if (node.tags.length === 1 && node.tags[0].kind === 307 /* JSDocTypeTag */ && !node.comment) {
+ if (node.tags.length === 1 && node.tags[0].kind === 308 /* JSDocTypeTag */ && !node.comment) {
writeSpace();
emit(node.tags[0]);
}
@@ -85769,7 +86678,7 @@
function emitJSDocTypedefTag(tag) {
emitJSDocTagName(tag.tagName);
if (tag.typeExpression) {
- if (tag.typeExpression.kind === 288 /* JSDocTypeExpression */) {
+ if (tag.typeExpression.kind === 289 /* JSDocTypeExpression */) {
emitJSDocTypeExpression(tag.typeExpression);
}
else {
@@ -85788,7 +86697,7 @@
emit(tag.fullName);
}
emitJSDocComment(tag.comment);
- if (tag.typeExpression && tag.typeExpression.kind === 297 /* JSDocTypeLiteral */) {
+ if (tag.typeExpression && tag.typeExpression.kind === 298 /* JSDocTypeLiteral */) {
emitJSDocTypeLiteral(tag.typeExpression);
}
}
@@ -85922,8 +86831,8 @@
bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "reference" /* Reference */, data: directive.fileName });
writeLine();
}
- for (var _d = 0, types_19 = types; _d < types_19.length; _d++) {
- var directive = types_19[_d];
+ for (var _d = 0, types_18 = types; _d < types_18.length; _d++) {
+ var directive = types_18[_d];
var pos = writer.getTextPos();
writeComment("/// <reference types=\"" + directive.fileName + "\" />");
if (bundleFileInfo)
@@ -86103,7 +87012,7 @@
function emitInitializer(node, equalCommentStartPos, container) {
if (node) {
writeSpace();
- emitTokenWithComment(59 /* EqualsToken */, equalCommentStartPos, writeOperator, container);
+ emitTokenWithComment(60 /* EqualsToken */, equalCommentStartPos, writeOperator, container);
writeSpace();
emitExpression(node);
}
@@ -86566,7 +87475,7 @@
&& ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile);
}
function skipSynthesizedParentheses(node) {
- while (node.kind === 195 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) {
+ while (node.kind === 196 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) {
node = node.expression;
}
return node;
@@ -86631,81 +87540,81 @@
if (!node)
return;
switch (node.kind) {
- case 218 /* Block */:
+ case 219 /* Block */:
ts.forEach(node.statements, generateNames);
break;
- case 233 /* LabeledStatement */:
- case 231 /* WithStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
+ case 234 /* LabeledStatement */:
+ case 232 /* WithStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
generateNames(node.statement);
break;
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
generateNames(node.thenStatement);
generateNames(node.elseStatement);
break;
- case 225 /* ForStatement */:
- case 227 /* ForOfStatement */:
- case 226 /* ForInStatement */:
+ case 226 /* ForStatement */:
+ case 228 /* ForOfStatement */:
+ case 227 /* ForInStatement */:
generateNames(node.initializer);
generateNames(node.statement);
break;
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
generateNames(node.caseBlock);
break;
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
ts.forEach(node.clauses, generateNames);
break;
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
ts.forEach(node.statements, generateNames);
break;
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
generateNames(node.tryBlock);
generateNames(node.catchClause);
generateNames(node.finallyBlock);
break;
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
generateNames(node.variableDeclaration);
generateNames(node.block);
break;
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
generateNames(node.declarationList);
break;
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
ts.forEach(node.declarations, generateNames);
break;
- case 237 /* VariableDeclaration */:
- case 151 /* Parameter */:
- case 186 /* BindingElement */:
- case 240 /* ClassDeclaration */:
+ case 238 /* VariableDeclaration */:
+ case 152 /* Parameter */:
+ case 187 /* BindingElement */:
+ case 241 /* ClassDeclaration */:
generateNameIfNeeded(node.name);
break;
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
generateNameIfNeeded(node.name);
if (ts.getEmitFlags(node) & 524288 /* ReuseTempVariableScope */) {
ts.forEach(node.parameters, generateNames);
generateNames(node.body);
}
break;
- case 184 /* ObjectBindingPattern */:
- case 185 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
ts.forEach(node.elements, generateNames);
break;
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
generateNames(node.importClause);
break;
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
generateNameIfNeeded(node.name);
generateNames(node.namedBindings);
break;
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
generateNameIfNeeded(node.name);
break;
- case 252 /* NamedImports */:
+ case 253 /* NamedImports */:
ts.forEach(node.elements, generateNames);
break;
- case 253 /* ImportSpecifier */:
+ case 254 /* ImportSpecifier */:
generateNameIfNeeded(node.propertyName || node.name);
break;
}
@@ -86714,12 +87623,12 @@
if (!node)
return;
switch (node.kind) {
- case 275 /* PropertyAssignment */:
- case 276 /* ShorthandPropertyAssignment */:
- case 154 /* PropertyDeclaration */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 276 /* PropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
+ case 155 /* PropertyDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
generateNameIfNeeded(node.name);
break;
}
@@ -86899,24 +87808,26 @@
*/
function generateNameForNode(node, flags) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return makeUniqueName(getTextOfNode(node), isUniqueName, !!(flags & 16 /* Optimistic */), !!(flags & 8 /* ReservedInNestedScopes */));
- case 244 /* ModuleDeclaration */:
- case 243 /* EnumDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 244 /* EnumDeclaration */:
return generateNameForModuleOrEnum(node);
- case 249 /* ImportDeclaration */:
- case 255 /* ExportDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 256 /* ExportDeclaration */:
return generateNameForImportOrExportDeclaration(node);
- case 239 /* FunctionDeclaration */:
- case 240 /* ClassDeclaration */:
- case 254 /* ExportAssignment */:
+ case 240 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 255 /* ExportAssignment */:
return generateNameForExportDefault();
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
return generateNameForClassExpression();
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return generateNameForMethodOrAccessor(node);
+ case 150 /* ComputedPropertyName */:
+ return makeTempVariableName(0 /* Auto */, /*reserveInNestedScopes*/ true);
default:
return makeTempVariableName(0 /* Auto */);
}
@@ -86962,7 +87873,7 @@
hasWrittenComment = false;
var emitFlags = ts.getEmitFlags(node);
var _a = ts.getCommentRange(node), pos = _a.pos, end = _a.end;
- var isEmittedNode = node.kind !== 312 /* NotEmittedStatement */;
+ var isEmittedNode = node.kind !== 313 /* NotEmittedStatement */;
// We have to explicitly check that the node is JsxText because if the compilerOptions.jsx is "preserve" we will not do any transformation.
// It is expensive to walk entire tree just to set one kind of node to have no comments.
var skipLeadingComments = pos < 0 || (emitFlags & 512 /* NoLeadingComments */) !== 0 || node.kind === 11 /* JsxText */;
@@ -86986,7 +87897,7 @@
containerEnd = end;
// To avoid invalid comment emit in a down-level binding pattern, we
// keep track of the last declaration list container's end
- if (node.kind === 238 /* VariableDeclarationList */) {
+ if (node.kind === 239 /* VariableDeclarationList */) {
declarationListContainerEnd = end;
}
}
@@ -87243,7 +88154,7 @@
else {
var _a = ts.getSourceMapRange(node), pos = _a.pos, end = _a.end, _b = _a.source, source = _b === void 0 ? sourceMapSource : _b;
var emitFlags = ts.getEmitFlags(node);
- if (node.kind !== 312 /* NotEmittedStatement */
+ if (node.kind !== 313 /* NotEmittedStatement */
&& (emitFlags & 16 /* NoLeadingSourceMap */) === 0
&& pos >= 0) {
emitSourcePos(source, skipSourceTrivia(source, pos));
@@ -87256,7 +88167,7 @@
else {
pipelinePhase(hint, node);
}
- if (node.kind !== 312 /* NotEmittedStatement */
+ if (node.kind !== 313 /* NotEmittedStatement */
&& (emitFlags & 32 /* NoTrailingSourceMap */) === 0
&& end >= 0) {
emitSourcePos(source, end);
@@ -87871,7 +88782,8 @@
getDirectories: function (path) { return system.getDirectories(path); },
realpath: realpath,
readDirectory: function (path, extensions, include, exclude, depth) { return system.readDirectory(path, extensions, include, exclude, depth); },
- createDirectory: function (d) { return system.createDirectory(d); }
+ createDirectory: function (d) { return system.createDirectory(d); },
+ createHash: ts.maybeBind(system, system.createHash)
};
return compilerHost;
}
@@ -88157,6 +89069,7 @@
}
}
ts.flattenDiagnosticMessageText = flattenDiagnosticMessageText;
+ /* @internal */
function loadWithLocalCache(names, containingFile, redirectedReference, loader) {
if (names.length === 0) {
return [];
@@ -88176,6 +89089,7 @@
}
return resolutions;
}
+ ts.loadWithLocalCache = loadWithLocalCache;
/**
* Determines if program structure is upto date or needs to be recreated
*/
@@ -88335,7 +89249,7 @@
}); };
}
else {
- moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, function (x) { return host.getCanonicalFileName(x); });
+ moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, function (x) { return host.getCanonicalFileName(x); }, options);
var loader_1 = function (moduleName, containingFile, redirectedReference) { return ts.resolveModuleName(moduleName, containingFile, options, host, moduleResolutionCache, redirectedReference).resolvedModule; }; // TODO: GH#18217
resolveModuleNamesWorker = function (moduleNames, containingFile, _reusedNames, redirectedReference) { return loadWithLocalCache(ts.Debug.assertEachDefined(moduleNames), containingFile, redirectedReference, loader_1); };
}
@@ -88481,6 +89395,7 @@
getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); },
getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); },
getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); },
+ getRelationCacheSizes: function () { return getDiagnosticsProducingTypeChecker().getRelationCacheSizes(); },
getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; },
getResolvedTypeReferenceDirectives: function () { return resolvedTypeReferenceDirectives; },
isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary,
@@ -88578,13 +89493,13 @@
// which per above occurred during the current program creation.
// Since we assume the filesystem does not change during program creation,
// it is safe to reuse resolutions from the earlier call.
- var result_6 = [];
+ var result_8 = [];
for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) {
var moduleName = moduleNames_1[_i];
var resolvedModule = file.resolvedModules.get(moduleName);
- result_6.push(resolvedModule);
+ result_8.push(resolvedModule);
}
- return result_6;
+ return result_8;
}
// At this point, we know at least one of the following hold:
// - file has local declarations for ambient modules
@@ -88671,7 +89586,7 @@
function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName) {
var resolutionToFile = ts.getResolvedModule(oldSourceFile, moduleName);
var resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
- if (resolutionToFile && resolvedFile && !resolvedFile.externalModuleIndicator) {
+ if (resolutionToFile && resolvedFile) {
// In the old program, we resolved to an ambient module that was in the same
// place as we expected to find an actual module file.
// We actually need to return 'false' here even though this seems like a 'true' case
@@ -88934,9 +89849,8 @@
ts.performance.mark("beforeEmit");
var emitResult = ts.emitFiles(ts.notImplementedResolver, getEmitHost(writeFileCallback),
/*targetSourceFile*/ undefined,
+ /*transformers*/ ts.noTransformers,
/*emitOnlyDtsFiles*/ false,
- /*transformers*/ undefined,
- /*declaraitonTransformers*/ undefined,
/*onlyBuildInfo*/ true);
ts.performance.mark("afterEmit");
ts.performance.measure("Emit", "beforeEmit", "afterEmit");
@@ -89024,8 +89938,7 @@
// checked is to not pass the file to getEmitResolver.
var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver((options.outFile || options.out) ? undefined : sourceFile, cancellationToken);
ts.performance.mark("beforeEmit");
- var transformers = emitOnlyDtsFiles ? [] : ts.getTransformers(options, customTransformers);
- var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile, emitOnlyDtsFiles, transformers, customTransformers && customTransformers.afterDeclarations);
+ var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile, ts.getTransformers(options, customTransformers, emitOnlyDtsFiles), emitOnlyDtsFiles);
ts.performance.mark("afterEmit");
ts.performance.measure("Emit", "beforeEmit", "afterEmit");
return emitResult;
@@ -89167,22 +90080,22 @@
// Return directly from the case if the given node doesnt want to visit each child
// Otherwise break to visit each child
switch (parent.kind) {
- case 151 /* Parameter */:
- case 154 /* PropertyDeclaration */:
+ case 152 /* Parameter */:
+ case 155 /* PropertyDeclaration */:
if (parent.questionToken === node) {
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, "?"));
return;
}
// falls through
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 196 /* FunctionExpression */:
- case 239 /* FunctionDeclaration */:
- case 197 /* ArrowFunction */:
- case 237 /* VariableDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 197 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
+ case 198 /* ArrowFunction */:
+ case 238 /* VariableDeclaration */:
// type annotation
if (parent.type === node) {
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.types_can_only_be_used_in_a_ts_file));
@@ -89190,41 +90103,41 @@
}
}
switch (node.kind) {
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file));
return;
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
if (node.isExportEquals) {
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file));
return;
}
break;
- case 273 /* HeritageClause */:
+ case 274 /* HeritageClause */:
var heritageClause = node;
- if (heritageClause.token === 109 /* ImplementsKeyword */) {
+ if (heritageClause.token === 110 /* ImplementsKeyword */) {
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file));
return;
}
break;
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file));
return;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file));
return;
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file));
return;
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file));
return;
- case 213 /* NonNullExpression */:
+ case 214 /* NonNullExpression */:
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.non_null_assertions_can_only_be_used_in_a_ts_file));
return;
- case 212 /* AsExpression */:
+ case 213 /* AsExpression */:
diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file));
return;
- case 194 /* TypeAssertionExpression */:
+ case 195 /* TypeAssertionExpression */:
ts.Debug.fail(); // Won't parse these in a JS file anyway, as they are interpreted as JSX.
}
var prevParent = parent;
@@ -89234,54 +90147,54 @@
}
function walkArray(nodes) {
if (parent.decorators === nodes && !options.experimentalDecorators) {
- diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning));
+ diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning));
}
switch (parent.kind) {
- case 240 /* ClassDeclaration */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 196 /* FunctionExpression */:
- case 239 /* FunctionDeclaration */:
- case 197 /* ArrowFunction */:
+ case 241 /* ClassDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 197 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
+ case 198 /* ArrowFunction */:
// Check type parameters
if (nodes === parent.typeParameters) {
diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file));
return;
}
// falls through
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
// Check modifiers
if (nodes === parent.modifiers) {
- return checkModifiers(nodes, parent.kind === 219 /* VariableStatement */);
+ return checkModifiers(nodes, parent.kind === 220 /* VariableStatement */);
}
break;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
// Check modifiers of property declaration
if (nodes === parent.modifiers) {
for (var _i = 0, _a = nodes; _i < _a.length; _i++) {
var modifier = _a[_i];
- if (modifier.kind !== 116 /* StaticKeyword */) {
+ if (modifier.kind !== 117 /* StaticKeyword */) {
diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind)));
}
}
return;
}
break;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
// Check modifiers of parameter declaration
if (nodes === parent.modifiers) {
diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file));
return;
}
break;
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
- case 211 /* ExpressionWithTypeArguments */:
- case 261 /* JsxSelfClosingElement */:
- case 262 /* JsxOpeningElement */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
+ case 212 /* ExpressionWithTypeArguments */:
+ case 262 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
// Check type arguments
if (nodes === parent.typeArguments) {
diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file));
@@ -89298,24 +90211,24 @@
for (var _i = 0, modifiers_1 = modifiers; _i < modifiers_1.length; _i++) {
var modifier = modifiers_1[_i];
switch (modifier.kind) {
- case 77 /* ConstKeyword */:
+ case 78 /* ConstKeyword */:
if (isConstValid) {
continue;
}
// to report error,
// falls through
- case 115 /* PublicKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 133 /* ReadonlyKeyword */:
- case 125 /* DeclareKeyword */:
- case 118 /* AbstractKeyword */:
+ case 116 /* PublicKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 134 /* ReadonlyKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 119 /* AbstractKeyword */:
diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind)));
break;
// These are all legal modifiers.
- case 116 /* StaticKeyword */:
- case 85 /* ExportKeyword */:
- case 80 /* DefaultKeyword */:
+ case 117 /* StaticKeyword */:
+ case 86 /* ExportKeyword */:
+ case 81 /* DefaultKeyword */:
}
}
}
@@ -89390,8 +90303,8 @@
return a.fileName === b.fileName;
}
function moduleNameIsEqualTo(a, b) {
- return a.kind === 72 /* Identifier */
- ? b.kind === 72 /* Identifier */ && a.escapedText === b.escapedText
+ return a.kind === 73 /* Identifier */
+ ? b.kind === 73 /* Identifier */ && a.escapedText === b.escapedText
: b.kind === 10 /* StringLiteral */ && a.text === b.text;
}
function collectExternalModuleReferences(file) {
@@ -89606,7 +90519,10 @@
if (isRedirect) {
inputName = getProjectReferenceRedirect(fileName) || fileName;
}
- if (ts.getNormalizedAbsolutePath(checkedName, currentDirectory) !== ts.getNormalizedAbsolutePath(inputName, currentDirectory)) {
+ // Check if it differs only in drive letters its ok to ignore that error:
+ var checkedAbsolutePath = ts.getNormalizedAbsolutePathWithoutRoot(checkedName, currentDirectory);
+ var inputAbsolutePath = ts.getNormalizedAbsolutePathWithoutRoot(inputName, currentDirectory);
+ if (checkedAbsolutePath !== inputAbsolutePath) {
reportFileNamesDifferOnlyInCasingError(inputName, checkedName, refFile, refPos, refEnd);
}
}
@@ -89635,8 +90551,13 @@
}
var redirectedPath;
if (refFile) {
- var redirect = getProjectReferenceRedirect(fileName);
- if (redirect) {
+ var redirectProject = getProjectReferenceRedirectProject(fileName);
+ if (redirectProject) {
+ if (redirectProject.commandLine.options.outFile || redirectProject.commandLine.options.out) {
+ // Shouldnt create many to 1 mapping file in --out scenario
+ return undefined;
+ }
+ var redirect = getProjectReferenceOutputName(redirectProject, fileName);
fileName = redirect;
// Once we start redirecting to a file, we can potentially come back to it
// via a back-reference from another file in the .d.ts folder. If that happens we'll
@@ -89720,16 +90641,19 @@
}
}
function getProjectReferenceRedirect(fileName) {
+ var referencedProject = getProjectReferenceRedirectProject(fileName);
+ return referencedProject && getProjectReferenceOutputName(referencedProject, fileName);
+ }
+ function getProjectReferenceRedirectProject(fileName) {
// Ignore dts or any of the non ts files
if (!resolvedProjectReferences || !resolvedProjectReferences.length || ts.fileExtensionIs(fileName, ".d.ts" /* Dts */) || !ts.fileExtensionIsOneOf(fileName, ts.supportedTSExtensions)) {
return undefined;
}
// If this file is produced by a referenced project, we need to rewrite it to
// look in the output folder of the referenced project rather than the input
- var referencedProject = getResolvedProjectReferenceToRedirect(fileName);
- if (!referencedProject) {
- return undefined;
+ return getResolvedProjectReferenceToRedirect(fileName);
}
+ function getProjectReferenceOutputName(referencedProject, fileName) {
var out = referencedProject.commandLine.options.outFile || referencedProject.commandLine.options.out;
return out ?
ts.changeExtension(out, ".d.ts" /* Dts */) :
@@ -89974,18 +90898,33 @@
if (fromCache !== undefined) {
return fromCache || undefined;
}
+ var commandLine;
+ var sourceFile;
+ if (host.getParsedCommandLine) {
+ commandLine = host.getParsedCommandLine(refPath);
+ if (!commandLine) {
+ addFileToFilesByName(/*sourceFile*/ undefined, sourceFilePath, /*redirectedPath*/ undefined);
+ projectReferenceRedirects.set(sourceFilePath, false);
+ return undefined;
+ }
+ sourceFile = ts.Debug.assertDefined(commandLine.options.configFile);
+ ts.Debug.assert(!sourceFile.path || sourceFile.path === sourceFilePath);
+ addFileToFilesByName(sourceFile, sourceFilePath, /*redirectedPath*/ undefined);
+ }
+ else {
// An absolute path pointing to the containing directory of the config file
var basePath = ts.getNormalizedAbsolutePath(ts.getDirectoryPath(refPath), host.getCurrentDirectory());
- var sourceFile = host.getSourceFile(refPath, 100 /* JSON */);
+ sourceFile = host.getSourceFile(refPath, 100 /* JSON */);
addFileToFilesByName(sourceFile, sourceFilePath, /*redirectedPath*/ undefined);
if (sourceFile === undefined) {
projectReferenceRedirects.set(sourceFilePath, false);
return undefined;
}
+ commandLine = ts.parseJsonSourceFileConfigFileContent(sourceFile, configParsingHost, basePath, /*existingOptions*/ undefined, refPath);
+ }
sourceFile.path = sourceFilePath;
sourceFile.resolvedPath = sourceFilePath;
sourceFile.originalFileName = refPath;
- var commandLine = ts.parseJsonSourceFileConfigFileContent(sourceFile, configParsingHost, basePath, /*existingOptions*/ undefined, refPath);
var resolvedRef = { commandLine: commandLine, sourceFile: sourceFile };
projectReferenceRedirects.set(sourceFilePath, resolvedRef);
if (commandLine.projectReferences) {
@@ -90001,9 +90940,6 @@
if (ts.getEmitDeclarations(options)) {
createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, getEmitDeclarationOptionName(options), "isolatedModules");
}
- if (options.noEmitOnError) {
- createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules");
- }
if (options.out) {
createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules");
}
@@ -90035,17 +90971,17 @@
createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "tsBuildInfoFile", "incremental", "composite");
}
}
+ else if (options.incremental && !options.outFile && !options.out && !options.configFilePath) {
+ programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified));
+ }
verifyProjectReferences();
// List of collected files is complete; validate exhautiveness if this is a project with a file list
if (options.composite) {
var rootPaths = rootNames.map(toPath);
for (var _i = 0, files_3 = files; _i < files_3.length; _i++) {
var file = files_3[_i];
- // Ignore declaration files
- if (file.isDeclarationFile)
- continue;
- // Ignore json file thats from project reference
- if (ts.isJsonSourceFile(file) && getResolvedProjectReferenceToRedirect(file.fileName))
+ // Ignore file that is not emitted
+ if (!ts.sourceFileMayBeEmitted(file, options, isSourceFileFromExternalLibrary, getResolvedProjectReferenceToRedirect))
continue;
if (rootPaths.indexOf(file.path) === -1) {
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_is_not_in_project_file_list_Projects_must_list_all_files_or_use_an_include_pattern, file.fileName));
@@ -90122,10 +91058,10 @@
if (options.module === ts.ModuleKind.None && languageVersion < 2 /* ES2015 */) {
createDiagnosticForOptionName(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher, "isolatedModules", "target");
}
- var firstNonExternalModuleSourceFile = ts.find(files, function (f) { return !ts.isExternalModule(f) && !f.isDeclarationFile && f.scriptKind !== 6 /* JSON */; });
+ var firstNonExternalModuleSourceFile = ts.find(files, function (f) { return !ts.isExternalModule(f) && !ts.isSourceFileJS(f) && !f.isDeclarationFile && f.scriptKind !== 6 /* JSON */; });
if (firstNonExternalModuleSourceFile) {
var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile);
- programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided));
+ programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.All_files_must_be_modules_when_the_isolatedModules_flag_is_provided));
}
}
else if (firstNonAmbientExternalModuleSourceFile && languageVersion < 2 /* ES2015 */ && options.module === ts.ModuleKind.None) {
@@ -90210,13 +91146,13 @@
var emitFilePath = toPath(emitFileName);
// Report error if the output overwrites input file
if (filesByName.has(emitFilePath)) {
- var chain_2;
+ var chain = void 0;
if (!options.configFilePath) {
// The program is from either an inferred project or an external project
- chain_2 = ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig);
+ chain = ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig);
}
- chain_2 = ts.chainDiagnosticMessages(chain_2, ts.Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file, emitFileName);
- blockEmittingOfFile(emitFileName, ts.createCompilerDiagnosticFromMessageChain(chain_2));
+ chain = ts.chainDiagnosticMessages(chain, ts.Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file, emitFileName);
+ blockEmittingOfFile(emitFileName, ts.createCompilerDiagnosticFromMessageChain(chain));
}
var emitFileKey = !host.useCaseSensitiveFileNames() ? emitFilePath.toLocaleLowerCase() : emitFilePath;
// Report error if multiple files write into same file
@@ -90751,6 +91687,7 @@
cacheToUpdateSignature.set(sourceFile.path, latestSignature);
return !prevSignature || latestSignature !== prevSignature;
}
+ BuilderState.updateShapeSignature = updateShapeSignature;
/**
* Coverts the declaration emit result into exported modules map
*/
@@ -91028,15 +91965,9 @@
}
}
});
- if (oldCompilerOptions &&
- (oldCompilerOptions.outDir !== compilerOptions.outDir ||
- oldCompilerOptions.declarationDir !== compilerOptions.declarationDir ||
- (oldCompilerOptions.outFile || oldCompilerOptions.out) !== (compilerOptions.outFile || compilerOptions.out))) {
+ if (oldCompilerOptions && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
// Add all files to affectedFilesPendingEmit since emit changed
- state.affectedFilesPendingEmit = ts.concatenate(state.affectedFilesPendingEmit, newProgram.getSourceFiles().map(function (f) { return f.path; }));
- if (state.affectedFilesPendingEmitIndex === undefined) {
- state.affectedFilesPendingEmitIndex = 0;
- }
+ addToAffectedFilesPendingEmit(state, newProgram.getSourceFiles().map(function (f) { return f.path; }));
ts.Debug.assert(state.seenAffectedFiles === undefined);
state.seenAffectedFiles = ts.createMap();
}
@@ -91120,7 +92051,7 @@
if (!seenAffectedFiles.has(affectedFile.path)) {
// Set the next affected file as seen and remove the cached semantic diagnostics
state.affectedFilesIndex = affectedFilesIndex;
- cleanSemanticDiagnosticsOfAffectedFile(state, affectedFile);
+ handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash);
return affectedFile;
}
seenAffectedFiles.set(affectedFile.path, true);
@@ -91181,28 +92112,68 @@
return undefined;
}
/**
- * Remove the semantic diagnostics cached from old state for affected File and the files that are referencing modules that export entities from affected file
+ * Handles semantic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file
+ * This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
*/
- function cleanSemanticDiagnosticsOfAffectedFile(state, affectedFile) {
- if (removeSemanticDiagnosticsOf(state, affectedFile.path)) {
- // If there are no more diagnostics from old cache, done
- return;
- }
- // Clean lib file diagnostics if its all files excluding default files to emit
- if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles && !state.cleanedDiagnosticsOfLibFiles) {
+ function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash) {
+ removeSemanticDiagnosticsOf(state, affectedFile.path);
+ // If affected files is everything except default library, then nothing more to do
+ if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
+ if (!state.cleanedDiagnosticsOfLibFiles) {
state.cleanedDiagnosticsOfLibFiles = true;
var program_1 = ts.Debug.assertDefined(state.program);
var options_2 = program_1.getCompilerOptions();
- if (ts.forEach(program_1.getSourceFiles(), function (f) {
+ ts.forEach(program_1.getSourceFiles(), function (f) {
return program_1.isSourceFileDefaultLibrary(f) &&
!ts.skipTypeChecking(f, options_2) &&
removeSemanticDiagnosticsOf(state, f.path);
- })) {
+ });
+ }
return;
}
+ forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, function (state, path) { return handleDtsMayChangeOf(state, path, cancellationToken, computeHash); });
+ }
+ /**
+ * Handle the dts may change, so they need to be added to pending emit if dts emit is enabled,
+ * Also we need to make sure signature is updated for these files
+ */
+ function handleDtsMayChangeOf(state, path, cancellationToken, computeHash) {
+ removeSemanticDiagnosticsOf(state, path);
+ if (!state.changedFilesSet.has(path)) {
+ var program = ts.Debug.assertDefined(state.program);
+ var sourceFile = program.getSourceFileByPath(path);
+ if (sourceFile) {
+ // Even though the js emit doesnt change and we are already handling dts emit and semantic diagnostics
+ // we need to update the signature to reflect correctness of the signature(which is output d.ts emit) of this file
+ // This ensures that we dont later during incremental builds considering wrong signature.
+ // Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
+ ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.assertDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
+ // If not dts emit, nothing more to do
+ if (ts.getEmitDeclarations(state.compilerOptions)) {
+ addToAffectedFilesPendingEmit(state, [path]);
+ }
+ }
+ }
+ return false;
+ }
+ /**
+ * Removes semantic diagnostics for path and
+ * returns true if there are no more semantic diagnostics from the old state
+ */
+ function removeSemanticDiagnosticsOf(state, path) {
+ if (!state.semanticDiagnosticsFromOldState) {
+ return true;
+ }
+ state.semanticDiagnosticsFromOldState.delete(path);
+ state.semanticDiagnosticsPerFile.delete(path);
+ return !state.semanticDiagnosticsFromOldState.size;
}
- // If there was change in signature for the changed file,
- // then delete the semantic diagnostics for files that are affected by using exports of this module
+ /**
+ * Iterate on referencing modules that export entities from affected file
+ */
+ function forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, fn) {
+ // If there was change in signature (dts output) for the changed file,
+ // then only we need to handle pending file emit
if (!state.exportedModulesMap || state.affectedFiles.length === 1 || !state.changedFilesSet.has(affectedFile.path)) {
return;
}
@@ -91213,7 +92184,7 @@
if (ts.forEachEntry(state.currentAffectedFilesExportedModulesMap, function (exportedModules, exportedFromPath) {
return exportedModules &&
exportedModules.has(affectedFile.path) &&
- removeSemanticDiagnosticsOfFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile);
+ forEachFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile, fn);
})) {
return;
}
@@ -91221,26 +92192,25 @@
ts.forEachEntry(state.exportedModulesMap, function (exportedModules, exportedFromPath) {
return !state.currentAffectedFilesExportedModulesMap.has(exportedFromPath) && // If we already iterated this through cache, ignore it
exportedModules.has(affectedFile.path) &&
- removeSemanticDiagnosticsOfFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile);
+ forEachFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile, fn);
});
}
/**
- * removes the semantic diagnostics of files referencing referencedPath and
- * returns true if there are no more semantic diagnostics from old state
+ * Iterate on files referencing referencedPath
*/
- function removeSemanticDiagnosticsOfFilesReferencingPath(state, referencedPath, seenFileAndExportsOfFile) {
+ function forEachFilesReferencingPath(state, referencedPath, seenFileAndExportsOfFile, fn) {
return ts.forEachEntry(state.referencedMap, function (referencesInFile, filePath) {
- return referencesInFile.has(referencedPath) && removeSemanticDiagnosticsOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile);
+ return referencesInFile.has(referencedPath) && forEachFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, fn);
});
}
/**
- * Removes semantic diagnostics of file and anything that exports this file
+ * fn on file and iterate on anything that exports this file
*/
- function removeSemanticDiagnosticsOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile) {
+ function forEachFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, fn) {
if (!ts.addToSeen(seenFileAndExportsOfFile, filePath)) {
return false;
}
- if (removeSemanticDiagnosticsOf(state, filePath)) {
+ if (fn(state, filePath)) {
// If there are no more diagnostics from old cache, done
return true;
}
@@ -91250,7 +92220,7 @@
if (ts.forEachEntry(state.currentAffectedFilesExportedModulesMap, function (exportedModules, exportedFromPath) {
return exportedModules &&
exportedModules.has(filePath) &&
- removeSemanticDiagnosticsOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile);
+ forEachFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, fn);
})) {
return true;
}
@@ -91258,7 +92228,7 @@
if (ts.forEachEntry(state.exportedModulesMap, function (exportedModules, exportedFromPath) {
return !state.currentAffectedFilesExportedModulesMap.has(exportedFromPath) && // If we already iterated this through cache, ignore it
exportedModules.has(filePath) &&
- removeSemanticDiagnosticsOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile);
+ forEachFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, fn);
})) {
return true;
}
@@ -91266,23 +92236,11 @@
return !!ts.forEachEntry(state.referencedMap, function (referencesInFile, referencingFilePath) {
return referencesInFile.has(filePath) &&
!seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
- removeSemanticDiagnosticsOf(state, referencingFilePath);
+ fn(state, referencingFilePath);
} // Dont add to seen since this is not yet done with the export removal
);
}
/**
- * Removes semantic diagnostics for path and
- * returns true if there are no more semantic diagnostics from the old state
- */
- function removeSemanticDiagnosticsOf(state, path) {
- if (!state.semanticDiagnosticsFromOldState) {
- return true;
- }
- state.semanticDiagnosticsFromOldState.delete(path);
- state.semanticDiagnosticsPerFile.delete(path);
- return !state.semanticDiagnosticsFromOldState.size;
- }
- /**
* This is called after completing operation on the next affected file.
* The operations here are postponed to ensure that cancellation during the iteration is handled correctly
*/
@@ -91509,7 +92467,7 @@
return toAffectedFileResult(state,
// When whole program is affected, do emit only once (eg when --out or --outFile is specified)
// Otherwise just affected file
- affected_1.emitBuildInfo(writeFile || host.writeFile, cancellationToken), affected_1,
+ affected_1.emitBuildInfo(writeFile || ts.maybeBind(host, host.writeFile), cancellationToken), affected_1,
/*isPendingEmitFile*/ false,
/*isBuildInfoEmit*/ true);
}
@@ -91525,14 +92483,10 @@
affected = program;
}
}
- // Mark seen emitted files if there are pending files to be emitted
- if (state.affectedFilesPendingEmit && state.program !== affected) {
- (state.seenEmittedFiles || (state.seenEmittedFiles = ts.createMap())).set(affected.path, true);
- }
return toAffectedFileResult(state,
// When whole program is affected, do emit only once (eg when --out or --outFile is specified)
// Otherwise just affected file
- ts.Debug.assertDefined(state.program).emit(affected === state.program ? undefined : affected, writeFile || host.writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers), affected, isPendingEmitFile);
+ ts.Debug.assertDefined(state.program).emit(affected === state.program ? undefined : affected, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers), affected, isPendingEmitFile);
}
/**
* Emits the JavaScript and declaration files.
@@ -91569,7 +92523,7 @@
};
}
}
- return ts.Debug.assertDefined(state.program).emit(targetSourceFile, writeFile || host.writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers);
+ return ts.Debug.assertDefined(state.program).emit(targetSourceFile, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
}
/**
* Return the semantic diagnostics for the next affected file or undefined if iteration is complete
@@ -91626,14 +92580,7 @@
}
// In case of emit builder, cache the files to be emitted
if (affectedFilesPendingEmit) {
- state.affectedFilesPendingEmit = ts.concatenate(state.affectedFilesPendingEmit, affectedFilesPendingEmit);
- // affectedFilesPendingEmitIndex === undefined
- // - means the emit state.affectedFilesPendingEmit was undefined before adding current affected files
- // so start from 0 as array would be affectedFilesPendingEmit
- // else, continue to iterate from existing index, the current set is appended to existing files
- if (state.affectedFilesPendingEmitIndex === undefined) {
- state.affectedFilesPendingEmitIndex = 0;
- }
+ addToAffectedFilesPendingEmit(state, affectedFilesPendingEmit);
}
var diagnostics;
for (var _i = 0, _a = ts.Debug.assertDefined(state.program).getSourceFiles(); _i < _a.length; _i++) {
@@ -91644,6 +92591,16 @@
}
}
ts.createBuilderProgram = createBuilderProgram;
+ function addToAffectedFilesPendingEmit(state, affectedFilesPendingEmit) {
+ state.affectedFilesPendingEmit = ts.concatenate(state.affectedFilesPendingEmit, affectedFilesPendingEmit);
+ // affectedFilesPendingEmitIndex === undefined
+ // - means the emit state.affectedFilesPendingEmit was undefined before adding current affected files
+ // so start from 0 as array would be affectedFilesPendingEmit
+ // else, continue to iterate from existing index, the current set is appended to existing files
+ if (state.affectedFilesPendingEmitIndex === undefined) {
+ state.affectedFilesPendingEmitIndex = 0;
+ }
+ }
function getMapOfReferencedSet(mapLike) {
if (!mapLike)
return undefined;
@@ -92505,11 +93462,11 @@
}
function discoverProbableSymlinks(files, getCanonicalFileName, cwd) {
var result = ts.createMap();
- var symlinks = ts.mapDefined(files, function (sf) {
- return sf.resolvedModules && ts.firstDefinedIterator(sf.resolvedModules.values(), function (res) {
+ var symlinks = ts.flatten(ts.mapDefined(files, function (sf) {
+ return sf.resolvedModules && ts.compact(ts.arrayFrom(ts.mapIterator(sf.resolvedModules.values(), function (res) {
return res && res.originalPath && res.resolvedFileName !== res.originalPath ? [res.resolvedFileName, res.originalPath] : undefined;
- });
- });
+ })));
+ }));
for (var _i = 0, symlinks_1 = symlinks; _i < symlinks_1.length; _i++) {
var _a = symlinks_1[_i], resolvedPath = _a[0], originalPath = _a[1];
var _b = guessDirectorySymlink(resolvedPath, originalPath, cwd, getCanonicalFileName), commonResolved = _b[0], commonOriginal = _b[1];
@@ -92852,6 +93809,14 @@
return "" + newLine + ts.flattenDiagnosticMessageText(d.messageText, newLine) + newLine + newLine;
}
ts.getErrorSummaryText = getErrorSummaryText;
+ function listFiles(program, writeFileName) {
+ if (program.getCompilerOptions().listFiles) {
+ ts.forEach(program.getSourceFiles(), function (file) {
+ writeFileName(file.fileName);
+ });
+ }
+ }
+ ts.listFiles = listFiles;
/**
* Helper that emit files, report diagnostics and lists emitted and/or source files depending on compiler options
*/
@@ -92879,11 +93844,7 @@
var filepath = ts.getNormalizedAbsolutePath(file, currentDir_1);
writeFileName("TSFILE: " + filepath);
});
- if (program.getCompilerOptions().listFiles) {
- ts.forEach(program.getSourceFiles(), function (file) {
- writeFileName(file.fileName);
- });
- }
+ listFiles(program, writeFileName);
}
if (reportSummary) {
reportSummary(getErrorCountForSummary(diagnostics));
@@ -93696,6 +94657,7 @@
function getCompilerOptionsOfBuildOptions(buildOptions) {
var result = {};
ts.commonOptionsWithBuild.forEach(function (option) {
+ if (ts.hasProperty(buildOptions, option.name))
result[option.name] = buildOptions[option.name];
});
return result;
@@ -93715,12 +94677,18 @@
var projectStatus = createFileMap(toPath);
var missingRoots = ts.createMap();
var globalDependencyGraph;
- var writeFileName = function (s) { return host.trace && host.trace(s); };
+ var writeFileName = host.trace ? function (s) { return host.trace(s); } : undefined;
var readFileWithCache = function (f) { return host.readFile(f); };
var projectCompilerOptions = baseCompilerOptions;
var compilerHost = ts.createCompilerHostFromProgramHost(host, function () { return projectCompilerOptions; });
ts.setGetSourceFileAsHashVersioned(compilerHost, host);
+ compilerHost.getParsedCommandLine = parseConfigFile;
+ compilerHost.resolveModuleNames = ts.maybeBind(host, host.resolveModuleNames);
+ compilerHost.resolveTypeReferenceDirectives = ts.maybeBind(host, host.resolveTypeReferenceDirectives);
+ var moduleResolutionCache = !compilerHost.resolveModuleNames ? ts.createModuleResolutionCache(currentDirectory, getCanonicalFileName) : undefined;
+ var cacheState;
var buildInfoChecked = createFileMap(toPath);
+ var extendedConfigCache = ts.createMap();
// Watch state
var builderPrograms = createFileMap(toPath);
var diagnostics = createFileMap(toPath);
@@ -93784,7 +94752,7 @@
}
var diagnostic;
parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = function (d) { return diagnostic = d; };
- var parsed = ts.getParsedCommandLineOfConfigFile(configFilePath, baseCompilerOptions, parseConfigFileHost);
+ var parsed = ts.getParsedCommandLineOfConfigFile(configFilePath, baseCompilerOptions, parseConfigFileHost, extendedConfigCache);
parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = ts.noop;
configFileCache.setValue(configFilePath, parsed || diagnostic);
return parsed;
@@ -94106,6 +95074,7 @@
projectStatus.removeKey(resolved);
diagnostics.removeKey(resolved);
addProjToQueue(resolved, reloadLevel);
+ enableCache();
}
/**
* return true if new addition
@@ -94161,6 +95130,7 @@
}
}
else {
+ disableCache();
reportErrorSummary();
}
}
@@ -94323,6 +95293,28 @@
}
// TODO: handle resolve module name to cache result in project reference redirect
projectCompilerOptions = configFile.options;
+ // Update module resolution cache if needed
+ if (moduleResolutionCache) {
+ var projPath = toPath(proj);
+ if (moduleResolutionCache.directoryToModuleNameMap.redirectsMap.size === 0) {
+ // The own map will be for projectCompilerOptions
+ ts.Debug.assert(moduleResolutionCache.moduleNameToDirectoryMap.redirectsMap.size === 0);
+ moduleResolutionCache.directoryToModuleNameMap.redirectsMap.set(projPath, moduleResolutionCache.directoryToModuleNameMap.ownMap);
+ moduleResolutionCache.moduleNameToDirectoryMap.redirectsMap.set(projPath, moduleResolutionCache.moduleNameToDirectoryMap.ownMap);
+ }
+ else {
+ // Set correct own map
+ ts.Debug.assert(moduleResolutionCache.moduleNameToDirectoryMap.redirectsMap.size > 0);
+ var ref = {
+ sourceFile: projectCompilerOptions.configFile,
+ commandLine: configFile
+ };
+ moduleResolutionCache.directoryToModuleNameMap.setOwnMap(moduleResolutionCache.directoryToModuleNameMap.getOrCreateMapOfCacheRedirects(ref));
+ moduleResolutionCache.moduleNameToDirectoryMap.setOwnMap(moduleResolutionCache.moduleNameToDirectoryMap.getOrCreateMapOfCacheRedirects(ref));
+ }
+ moduleResolutionCache.directoryToModuleNameMap.setOwnOptions(projectCompilerOptions);
+ moduleResolutionCache.moduleNameToDirectoryMap.setOwnOptions(projectCompilerOptions);
+ }
var program = host.createProgram(configFile.fileNames, configFile.options, compilerHost, getOldProgram(proj, configFile), configFile.errors, configFile.projectReferences);
// Don't emit anything in the presence of syntactic errors or options diagnostics
var syntaxDiagnostics = program.getConfigFileParsingDiagnostics().concat(program.getOptionsDiagnostics(), program.getGlobalDiagnostics(), program.getSyntacticDiagnostics());
@@ -94341,7 +95333,7 @@
var declDiagnostics;
var reportDeclarationDiagnostics = function (d) { return (declDiagnostics || (declDiagnostics = [])).push(d); };
var outputFiles = [];
- ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics, writeFileName, /*reportSummary*/ undefined, function (name, text, writeByteOrderMark) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); });
+ ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics, /*writeFileName*/ undefined, /*reportSummary*/ undefined, function (name, text, writeByteOrderMark) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); });
// Don't emit .d.ts if there are decl file errors
if (declDiagnostics) {
program.restoreState();
@@ -94363,7 +95355,7 @@
anyDtsChanged = true;
}
}
- emittedOutputs.setValue(name, true);
+ emittedOutputs.setValue(name, name);
ts.writeFile(compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
if (priorChangeTime !== undefined) {
newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime);
@@ -94374,6 +95366,10 @@
if (emitDiagnostics.length) {
return buildErrors(emitDiagnostics, BuildResultFlags.EmitErrors, "Emit");
}
+ if (writeFileName) {
+ emittedOutputs.forEach(function (name) { return listEmittedFile(configFile, name); });
+ ts.listFiles(program, writeFileName);
+ }
// Update time stamps for rest of the outputs
newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(configFile, newestDeclarationFileContentChangedTime, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
var status = {
@@ -94389,12 +95385,20 @@
function buildErrors(diagnostics, errorFlags, errorType) {
resultFlags |= errorFlags;
reportAndStoreErrors(proj, diagnostics);
+ // List files if any other build error using program (emit errors already report files)
+ if (writeFileName)
+ ts.listFiles(program, writeFileName);
projectStatus.setValue(proj, { type: UpToDateStatusType.Unbuildable, reason: errorType + " errors" });
afterProgramCreate(proj, program);
projectCompilerOptions = baseCompilerOptions;
return resultFlags;
}
}
+ function listEmittedFile(proj, file) {
+ if (writeFileName && proj.options.listEmittedFiles) {
+ writeFileName("TSFILE: " + file);
+ }
+ }
function afterProgramCreate(proj, program) {
if (host.afterProgramEmitAndDiagnostics) {
host.afterProgramEmitAndDiagnostics(program);
@@ -94433,7 +95437,7 @@
var emittedOutputs = createFileMap(toPath);
outputFiles.forEach(function (_a) {
var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
- emittedOutputs.setValue(name, true);
+ emittedOutputs.setValue(name, name);
ts.writeFile(compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
});
var emitDiagnostics = emitterDiagnostics.getDiagnostics();
@@ -94443,6 +95447,9 @@
projectCompilerOptions = baseCompilerOptions;
return BuildResultFlags.DeclarationOutputUnchanged | BuildResultFlags.EmitErrors;
}
+ if (writeFileName) {
+ emittedOutputs.forEach(function (name) { return listEmittedFile(config, name); });
+ }
// Update timestamps for dts
var newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(config, minimumDate, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
var status = {
@@ -94483,9 +95490,7 @@
priorNewestUpdateTime = newer(priorNewestUpdateTime, host.getModifiedTime(file) || ts.missingFileModifiedTime);
}
host.setModifiedTime(file, now);
- if (proj.options.listEmittedFiles) {
- writeFileName("TSFILE: " + file);
- }
+ listEmittedFile(proj, file);
}
}
return priorNewestUpdateTime;
@@ -94530,28 +95535,67 @@
function resolveProjectNames(configFileNames) {
return configFileNames.map(resolveProjectName);
}
- function buildAllProjects() {
- if (options.watch) {
- reportWatchStatus(ts.Diagnostics.Starting_compilation_in_watch_mode);
+ function enableCache() {
+ if (cacheState) {
+ disableCache();
}
- // TODO:: In watch mode as well to use caches for incremental build once we can invalidate caches correctly and have right api
- // Override readFile for json files and output .d.ts to cache the text
- var savedReadFileWithCache = readFileWithCache;
- var savedGetSourceFile = compilerHost.getSourceFile;
+ var originalReadFileWithCache = readFileWithCache;
+ var originalGetSourceFile = compilerHost.getSourceFile;
var _a = ts.changeCompilerHostLikeToUseCache(host, toPath, function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
- return savedGetSourceFile.call.apply(savedGetSourceFile, [compilerHost].concat(args));
+ return originalGetSourceFile.call.apply(originalGetSourceFile, [compilerHost].concat(args));
}), originalReadFile = _a.originalReadFile, originalFileExists = _a.originalFileExists, originalDirectoryExists = _a.originalDirectoryExists, originalCreateDirectory = _a.originalCreateDirectory, originalWriteFile = _a.originalWriteFile, getSourceFileWithCache = _a.getSourceFileWithCache, newReadFileWithCache = _a.readFileWithCache;
readFileWithCache = newReadFileWithCache;
compilerHost.getSourceFile = getSourceFileWithCache;
+ var originalResolveModuleNames = compilerHost.resolveModuleNames;
+ if (!compilerHost.resolveModuleNames) {
+ var loader_3 = function (moduleName, containingFile, redirectedReference) { return ts.resolveModuleName(moduleName, containingFile, projectCompilerOptions, compilerHost, moduleResolutionCache, redirectedReference).resolvedModule; };
+ compilerHost.resolveModuleNames = function (moduleNames, containingFile, _reusedNames, redirectedReference) {
+ return ts.loadWithLocalCache(ts.Debug.assertEachDefined(moduleNames), containingFile, redirectedReference, loader_3);
+ };
+ }
+ cacheState = {
+ originalReadFile: originalReadFile,
+ originalFileExists: originalFileExists,
+ originalDirectoryExists: originalDirectoryExists,
+ originalCreateDirectory: originalCreateDirectory,
+ originalWriteFile: originalWriteFile,
+ originalReadFileWithCache: originalReadFileWithCache,
+ originalGetSourceFile: originalGetSourceFile,
+ originalResolveModuleNames: originalResolveModuleNames
+ };
+ }
+ function disableCache() {
+ if (!cacheState)
+ return;
+ host.readFile = cacheState.originalReadFile;
+ host.fileExists = cacheState.originalFileExists;
+ host.directoryExists = cacheState.originalDirectoryExists;
+ host.createDirectory = cacheState.originalCreateDirectory;
+ host.writeFile = cacheState.originalWriteFile;
+ compilerHost.getSourceFile = cacheState.originalGetSourceFile;
+ readFileWithCache = cacheState.originalReadFileWithCache;
+ compilerHost.resolveModuleNames = cacheState.originalResolveModuleNames;
+ extendedConfigCache.clear();
+ if (moduleResolutionCache) {
+ moduleResolutionCache.directoryToModuleNameMap.clear();
+ moduleResolutionCache.moduleNameToDirectoryMap.clear();
+ }
+ cacheState = undefined;
+ }
+ function buildAllProjects() {
+ if (options.watch) {
+ reportWatchStatus(ts.Diagnostics.Starting_compilation_in_watch_mode);
+ }
+ enableCache();
var graph = getGlobalDependencyGraph();
reportBuildQueue(graph);
var anyFailed = false;
- for (var _i = 0, _b = graph.buildQueue; _i < _b.length; _i++) {
- var next = _b[_i];
+ for (var _i = 0, _a = graph.buildQueue; _i < _a.length; _i++) {
+ var next = _a[_i];
var proj = parseConfigFile(next);
if (proj === undefined) {
reportParseConfigFileDiagnostic(next);
@@ -94595,13 +95639,7 @@
anyFailed = anyFailed || !!(buildResult & BuildResultFlags.AnyErrors);
}
reportErrorSummary();
- host.readFile = originalReadFile;
- host.fileExists = originalFileExists;
- host.directoryExists = originalDirectoryExists;
- host.createDirectory = originalCreateDirectory;
- host.writeFile = originalWriteFile;
- compilerHost.getSourceFile = savedGetSourceFile;
- readFileWithCache = savedReadFileWithCache;
+ disableCache();
return anyFailed ? ts.ExitStatus.DiagnosticsPresent_OutputsSkipped : ts.ExitStatus.Success;
}
function needsBuild(status, configFile) {
@@ -94692,151 +95730,12 @@
/* @internal */
var ts;
(function (ts) {
- var ValueKind;
- (function (ValueKind) {
- ValueKind[ValueKind["Const"] = 0] = "Const";
- ValueKind[ValueKind["Array"] = 1] = "Array";
- ValueKind[ValueKind["FunctionOrClass"] = 2] = "FunctionOrClass";
- ValueKind[ValueKind["Object"] = 3] = "Object";
- })(ValueKind = ts.ValueKind || (ts.ValueKind = {}));
- function inspectModule(fileNameToRequire) {
- return inspectValue(ts.removeFileExtension(ts.getBaseFileName(fileNameToRequire)), tryRequire(fileNameToRequire));
- }
- ts.inspectModule = inspectModule;
- function inspectValue(name, value) {
- return getValueInfo(name, value, getRecurser());
- }
- ts.inspectValue = inspectValue;
- function getRecurser() {
- var seen = [];
- var nameStack = [];
- return function (obj, name, cbOk, cbFail) {
- if (seen.indexOf(obj) !== -1 || nameStack.length > 4) {
- return cbFail(seen.indexOf(obj) !== -1, nameStack);
- }
- seen.push(obj);
- nameStack.push(name);
- var res = cbOk();
- nameStack.pop();
- seen.pop();
- return res;
- };
- }
- function getValueInfo(name, value, recurser) {
- return recurser(value, name, function () {
- if (typeof value === "function")
- return getFunctionOrClassInfo(value, name, recurser);
- if (typeof value === "object") {
- var builtin = getBuiltinType(name, value, recurser);
- if (builtin !== undefined)
- return builtin;
- var entries = getEntriesOfObject(value);
- var hasNontrivialPrototype = Object.getPrototypeOf(value) !== Object.prototype;
- var members = ts.flatMap(entries, function (_a) {
- var key = _a.key, value = _a.value;
- return getValueInfo(key, value, recurser);
- });
- return { kind: 3 /* Object */, name: name, hasNontrivialPrototype: hasNontrivialPrototype, members: members };
- }
- return { kind: 0 /* Const */, name: name, typeName: isNullOrUndefined(value) ? "any" : typeof value };
- }, function (isCircularReference, keyStack) { return anyValue(name, " " + (isCircularReference ? "Circular reference" : "Too-deep object hierarchy") + " from " + keyStack.join(".")); });
- }
- function getFunctionOrClassInfo(fn, name, recurser) {
- var prototypeMembers = getPrototypeMembers(fn, recurser);
- var namespaceMembers = ts.flatMap(getEntriesOfObject(fn), function (_a) {
- var key = _a.key, value = _a.value;
- return getValueInfo(key, value, recurser);
- });
- var toString = ts.cast(Function.prototype.toString.call(fn), ts.isString);
- var source = ts.stringContains(toString, "{ [native code] }") ? getFunctionLength(fn) : toString;
- return { kind: 2 /* FunctionOrClass */, name: name, source: source, namespaceMembers: namespaceMembers, prototypeMembers: prototypeMembers };
- }
- var builtins = ts.memoize(function () {
- var map = ts.createMap();
- for (var _i = 0, _a = getEntriesOfObject(global); _i < _a.length; _i++) {
- var _b = _a[_i], key = _b.key, value = _b.value;
- if (typeof value === "function" && typeof value.prototype === "object" && value !== Object) {
- map.set(key, value);
- }
- }
- return map;
- });
- function getBuiltinType(name, value, recurser) {
- return ts.isArray(value)
- ? { name: name, kind: 1 /* Array */, inner: value.length && getValueInfo("element", ts.first(value), recurser) || anyValue(name) }
- : ts.forEachEntry(builtins(), function (builtin, builtinName) {
- return value instanceof builtin ? { kind: 0 /* Const */, name: name, typeName: builtinName } : undefined;
- });
- }
- function getPrototypeMembers(fn, recurser) {
- var prototype = fn.prototype;
- // tslint:disable-next-line no-unnecessary-type-assertion (TODO: update LKG and it will really be unnecessary)
- return typeof prototype !== "object" || prototype === null ? ts.emptyArray : ts.mapDefined(getEntriesOfObject(prototype), function (_a) {
- var key = _a.key, value = _a.value;
- return key === "constructor" ? undefined : getValueInfo(key, value, recurser);
- });
- }
- var ignoredProperties = ["arguments", "caller", "constructor", "eval", "super_"];
- var reservedFunctionProperties = Object.getOwnPropertyNames(ts.noop);
- function getEntriesOfObject(obj) {
- var seen = ts.createMap();
- var entries = [];
- var chain = obj;
- while (!isNullOrUndefined(chain) && chain !== Object.prototype && chain !== Function.prototype) {
- for (var _i = 0, _a = Object.getOwnPropertyNames(chain); _i < _a.length; _i++) {
- var key = _a[_i];
- if (!isJsPrivate(key) &&
- ignoredProperties.indexOf(key) === -1 &&
- (typeof obj !== "function" || reservedFunctionProperties.indexOf(key) === -1) &&
- // Don't add property from a higher prototype if it already exists in a lower one
- ts.addToSeen(seen, key)) {
- var value = safeGetPropertyOfObject(chain, key);
- // Don't repeat "toString" that matches signature from Object.prototype
- if (!(key === "toString" && typeof value === "function" && value.length === 0)) {
- entries.push({ key: key, value: value });
- }
- }
- }
- chain = Object.getPrototypeOf(chain);
- }
- return entries.sort(function (e1, e2) { return ts.compareStringsCaseSensitive(e1.key, e2.key); });
- }
- function getFunctionLength(fn) {
- return ts.tryCast(safeGetPropertyOfObject(fn, "length"), ts.isNumber) || 0;
- }
- function safeGetPropertyOfObject(obj, key) {
- var desc = Object.getOwnPropertyDescriptor(obj, key);
- return desc && desc.value;
- }
- function isNullOrUndefined(value) {
- return value == null; // tslint:disable-line
- }
- function anyValue(name, comment) {
- return { kind: 0 /* Const */, name: name, typeName: "any", comment: comment };
- }
- function isJsPrivate(name) {
- return ts.startsWith(name, "_");
- }
- ts.isJsPrivate = isJsPrivate;
- function tryRequire(fileNameToRequire) {
- try {
- return require(fileNameToRequire);
- }
- catch (_a) {
- return undefined;
- }
- }
-})(ts || (ts = {}));
-/* @internal */
-var ts;
-(function (ts) {
var server;
(function (server) {
// tslint:disable variable-name
server.ActionSet = "action::set";
server.ActionInvalidate = "action::invalidate";
server.ActionPackageInstalled = "action::packageInstalled";
- server.ActionValueInspected = "action::valueInspected";
server.EventTypesRegistry = "event::typesRegistry";
server.EventBeginInstallTypes = "event::beginInstallTypes";
server.EventEndInstallTypes = "event::endInstallTypes";
@@ -95454,7 +96353,7 @@
/* @internal */
var ts;
(function (ts) {
- ts.scanner = ts.createScanner(7 /* Latest */, /*skipTrivia*/ true);
+ ts.scanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ true);
var SemanticMeaning;
(function (SemanticMeaning) {
SemanticMeaning[SemanticMeaning["None"] = 0] = "None";
@@ -95465,37 +96364,37 @@
})(SemanticMeaning = ts.SemanticMeaning || (ts.SemanticMeaning = {}));
function getMeaningFromDeclaration(node) {
switch (node.kind) {
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return ts.isInJSFile(node) && ts.getJSDocEnumTag(node) ? 7 /* All */ : 1 /* Value */;
- case 151 /* Parameter */:
- case 186 /* BindingElement */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 275 /* PropertyAssignment */:
- case 276 /* ShorthandPropertyAssignment */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 274 /* CatchClause */:
- case 267 /* JsxAttribute */:
+ case 152 /* Parameter */:
+ case 187 /* BindingElement */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 276 /* PropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 275 /* CatchClause */:
+ case 268 /* JsxAttribute */:
return 1 /* Value */;
- case 150 /* TypeParameter */:
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 168 /* TypeLiteral */:
+ case 151 /* TypeParameter */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 169 /* TypeLiteral */:
return 2 /* Type */;
- case 309 /* JSDocTypedefTag */:
+ case 310 /* JSDocTypedefTag */:
// If it has no name node, it shares the name with the value declaration below it.
return node.name === undefined ? 1 /* Value */ | 2 /* Type */ : 2 /* Type */;
- case 278 /* EnumMember */:
- case 240 /* ClassDeclaration */:
+ case 279 /* EnumMember */:
+ case 241 /* ClassDeclaration */:
return 1 /* Value */ | 2 /* Type */;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
if (ts.isAmbientModule(node)) {
return 4 /* Namespace */ | 1 /* Value */;
}
@@ -95505,26 +96404,26 @@
else {
return 4 /* Namespace */;
}
- case 243 /* EnumDeclaration */:
- case 252 /* NamedImports */:
- case 253 /* ImportSpecifier */:
- case 248 /* ImportEqualsDeclaration */:
- case 249 /* ImportDeclaration */:
- case 254 /* ExportAssignment */:
- case 255 /* ExportDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 253 /* NamedImports */:
+ case 254 /* ImportSpecifier */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 255 /* ExportAssignment */:
+ case 256 /* ExportDeclaration */:
return 7 /* All */;
// An external module can be a Value
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return 4 /* Namespace */ | 1 /* Value */;
}
return 7 /* All */;
}
ts.getMeaningFromDeclaration = getMeaningFromDeclaration;
function getMeaningFromLocation(node) {
- if (node.kind === 284 /* SourceFile */) {
+ if (node.kind === 285 /* SourceFile */) {
return 1 /* Value */;
}
- else if (node.parent.kind === 254 /* ExportAssignment */ || node.parent.kind === 259 /* ExternalModuleReference */) {
+ else if (node.parent.kind === 255 /* ExportAssignment */ || node.parent.kind === 260 /* ExternalModuleReference */) {
return 7 /* All */;
}
else if (isInRightSideOfInternalImportEqualsDeclaration(node)) {
@@ -95556,11 +96455,11 @@
// import a = |b|; // Namespace
// import a = |b.c|; // Value, type, namespace
// import a = |b.c|.d; // Namespace
- var name = node.kind === 148 /* QualifiedName */ ? node : ts.isQualifiedName(node.parent) && node.parent.right === node ? node.parent : undefined;
- return name && name.parent.kind === 248 /* ImportEqualsDeclaration */ ? 7 /* All */ : 4 /* Namespace */;
+ var name = node.kind === 149 /* QualifiedName */ ? node : ts.isQualifiedName(node.parent) && node.parent.right === node ? node.parent : undefined;
+ return name && name.parent.kind === 249 /* ImportEqualsDeclaration */ ? 7 /* All */ : 4 /* Namespace */;
}
function isInRightSideOfInternalImportEqualsDeclaration(node) {
- while (node.parent.kind === 148 /* QualifiedName */) {
+ while (node.parent.kind === 149 /* QualifiedName */) {
node = node.parent;
}
return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node;
@@ -95572,27 +96471,27 @@
function isQualifiedNameNamespaceReference(node) {
var root = node;
var isLastClause = true;
- if (root.parent.kind === 148 /* QualifiedName */) {
- while (root.parent && root.parent.kind === 148 /* QualifiedName */) {
+ if (root.parent.kind === 149 /* QualifiedName */) {
+ while (root.parent && root.parent.kind === 149 /* QualifiedName */) {
root = root.parent;
}
isLastClause = root.right === node;
}
- return root.parent.kind === 164 /* TypeReference */ && !isLastClause;
+ return root.parent.kind === 165 /* TypeReference */ && !isLastClause;
}
function isPropertyAccessNamespaceReference(node) {
var root = node;
var isLastClause = true;
- if (root.parent.kind === 189 /* PropertyAccessExpression */) {
- while (root.parent && root.parent.kind === 189 /* PropertyAccessExpression */) {
+ if (root.parent.kind === 190 /* PropertyAccessExpression */) {
+ while (root.parent && root.parent.kind === 190 /* PropertyAccessExpression */) {
root = root.parent;
}
isLastClause = root.name === node;
}
- if (!isLastClause && root.parent.kind === 211 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 273 /* HeritageClause */) {
+ if (!isLastClause && root.parent.kind === 212 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 274 /* HeritageClause */) {
var decl = root.parent.parent.parent;
- return (decl.kind === 240 /* ClassDeclaration */ && root.parent.parent.token === 109 /* ImplementsKeyword */) ||
- (decl.kind === 241 /* InterfaceDeclaration */ && root.parent.parent.token === 86 /* ExtendsKeyword */);
+ return (decl.kind === 241 /* ClassDeclaration */ && root.parent.parent.token === 110 /* ImplementsKeyword */) ||
+ (decl.kind === 242 /* InterfaceDeclaration */ && root.parent.parent.token === 87 /* ExtendsKeyword */);
}
return false;
}
@@ -95601,17 +96500,17 @@
node = node.parent;
}
switch (node.kind) {
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
return !ts.isExpressionNode(node);
- case 178 /* ThisType */:
+ case 179 /* ThisType */:
return true;
}
switch (node.parent.kind) {
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return true;
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return !node.parent.isTypeOf;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent);
}
return false;
@@ -95638,7 +96537,7 @@
ts.climbPastPropertyAccess = climbPastPropertyAccess;
function getTargetLabel(referenceNode, labelName) {
while (referenceNode) {
- if (referenceNode.kind === 233 /* LabeledStatement */ && referenceNode.label.escapedText === labelName) {
+ if (referenceNode.kind === 234 /* LabeledStatement */ && referenceNode.label.escapedText === labelName) {
return referenceNode.label;
}
referenceNode = referenceNode.parent;
@@ -95654,11 +96553,11 @@
}
ts.hasPropertyAccessExpressionWithName = hasPropertyAccessExpressionWithName;
function isJumpStatementTarget(node) {
- return node.kind === 72 /* Identifier */ && ts.isBreakOrContinueStatement(node.parent) && node.parent.label === node;
+ return node.kind === 73 /* Identifier */ && ts.isBreakOrContinueStatement(node.parent) && node.parent.label === node;
}
ts.isJumpStatementTarget = isJumpStatementTarget;
function isLabelOfLabeledStatement(node) {
- return node.kind === 72 /* Identifier */ && ts.isLabeledStatement(node.parent) && node.parent.label === node;
+ return node.kind === 73 /* Identifier */ && ts.isLabeledStatement(node.parent) && node.parent.label === node;
}
ts.isLabelOfLabeledStatement = isLabelOfLabeledStatement;
function isLabelName(node) {
@@ -95670,40 +96569,40 @@
}
ts.isTagName = isTagName;
function isRightSideOfQualifiedName(node) {
- return node.parent.kind === 148 /* QualifiedName */ && node.parent.right === node;
+ return node.parent.kind === 149 /* QualifiedName */ && node.parent.right === node;
}
ts.isRightSideOfQualifiedName = isRightSideOfQualifiedName;
function isRightSideOfPropertyAccess(node) {
- return node && node.parent && node.parent.kind === 189 /* PropertyAccessExpression */ && node.parent.name === node;
+ return node && node.parent && node.parent.kind === 190 /* PropertyAccessExpression */ && node.parent.name === node;
}
ts.isRightSideOfPropertyAccess = isRightSideOfPropertyAccess;
function isNameOfModuleDeclaration(node) {
- return node.parent.kind === 244 /* ModuleDeclaration */ && node.parent.name === node;
+ return node.parent.kind === 245 /* ModuleDeclaration */ && node.parent.name === node;
}
ts.isNameOfModuleDeclaration = isNameOfModuleDeclaration;
function isNameOfFunctionDeclaration(node) {
- return node.kind === 72 /* Identifier */ &&
+ return node.kind === 73 /* Identifier */ &&
ts.isFunctionLike(node.parent) && node.parent.name === node;
}
ts.isNameOfFunctionDeclaration = isNameOfFunctionDeclaration;
function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) {
switch (node.parent.kind) {
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 275 /* PropertyAssignment */:
- case 278 /* EnumMember */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 244 /* ModuleDeclaration */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 276 /* PropertyAssignment */:
+ case 279 /* EnumMember */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 245 /* ModuleDeclaration */:
return ts.getNameOfDeclaration(node.parent) === node;
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return node.parent.argumentExpression === node;
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
return true;
- case 182 /* LiteralType */:
- return node.parent.parent.kind === 180 /* IndexedAccessType */;
+ case 183 /* LiteralType */:
+ return node.parent.parent.kind === 181 /* IndexedAccessType */;
default:
return false;
}
@@ -95727,17 +96626,17 @@
return undefined;
}
switch (node.kind) {
- case 284 /* SourceFile */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
- case 244 /* ModuleDeclaration */:
+ case 285 /* SourceFile */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 245 /* ModuleDeclaration */:
return node;
}
}
@@ -95745,48 +96644,48 @@
ts.getContainerNode = getContainerNode;
function getNodeKind(node) {
switch (node.kind) {
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return ts.isExternalModule(node) ? "module" /* moduleElement */ : "script" /* scriptElement */;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return "module" /* moduleElement */;
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
return "class" /* classElement */;
- case 241 /* InterfaceDeclaration */: return "interface" /* interfaceElement */;
- case 242 /* TypeAliasDeclaration */:
- case 302 /* JSDocCallbackTag */:
- case 309 /* JSDocTypedefTag */:
+ case 242 /* InterfaceDeclaration */: return "interface" /* interfaceElement */;
+ case 243 /* TypeAliasDeclaration */:
+ case 303 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
return "type" /* typeElement */;
- case 243 /* EnumDeclaration */: return "enum" /* enumElement */;
- case 237 /* VariableDeclaration */:
+ case 244 /* EnumDeclaration */: return "enum" /* enumElement */;
+ case 238 /* VariableDeclaration */:
return getKindOfVariableDeclaration(node);
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return getKindOfVariableDeclaration(ts.getRootDeclaration(node));
- case 197 /* ArrowFunction */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
return "function" /* functionElement */;
- case 158 /* GetAccessor */: return "getter" /* memberGetAccessorElement */;
- case 159 /* SetAccessor */: return "setter" /* memberSetAccessorElement */;
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 159 /* GetAccessor */: return "getter" /* memberGetAccessorElement */;
+ case 160 /* SetAccessor */: return "setter" /* memberSetAccessorElement */;
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
return "method" /* memberFunctionElement */;
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
return "property" /* memberVariableElement */;
- case 162 /* IndexSignature */: return "index" /* indexSignatureElement */;
- case 161 /* ConstructSignature */: return "construct" /* constructSignatureElement */;
- case 160 /* CallSignature */: return "call" /* callSignatureElement */;
- case 157 /* Constructor */: return "constructor" /* constructorImplementationElement */;
- case 150 /* TypeParameter */: return "type parameter" /* typeParameterElement */;
- case 278 /* EnumMember */: return "enum member" /* enumMemberElement */;
- case 151 /* Parameter */: return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) ? "property" /* memberVariableElement */ : "parameter" /* parameterElement */;
- case 248 /* ImportEqualsDeclaration */:
- case 253 /* ImportSpecifier */:
- case 257 /* ExportSpecifier */:
- case 251 /* NamespaceImport */:
+ case 163 /* IndexSignature */: return "index" /* indexSignatureElement */;
+ case 162 /* ConstructSignature */: return "construct" /* constructSignatureElement */;
+ case 161 /* CallSignature */: return "call" /* callSignatureElement */;
+ case 158 /* Constructor */: return "constructor" /* constructorImplementationElement */;
+ case 151 /* TypeParameter */: return "type parameter" /* typeParameterElement */;
+ case 279 /* EnumMember */: return "enum member" /* enumMemberElement */;
+ case 152 /* Parameter */: return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) ? "property" /* memberVariableElement */ : "parameter" /* parameterElement */;
+ case 249 /* ImportEqualsDeclaration */:
+ case 254 /* ImportSpecifier */:
+ case 258 /* ExportSpecifier */:
+ case 252 /* NamespaceImport */:
return "alias" /* alias */;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
var kind = ts.getAssignmentDeclarationKind(node);
var right = node.right;
switch (kind) {
@@ -95813,7 +96712,7 @@
return "" /* unknown */;
}
}
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return ts.isImportClause(node.parent) ? "alias" /* alias */ : "" /* unknown */;
default:
return "" /* unknown */;
@@ -95829,12 +96728,12 @@
ts.getNodeKind = getNodeKind;
function isThis(node) {
switch (node.kind) {
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
// case SyntaxKind.ThisType: TODO: GH#9267
return true;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
// 'this' as a parameter
- return ts.identifierIsThisKeyword(node) && node.parent.kind === 151 /* Parameter */;
+ return ts.identifierIsThisKeyword(node) && node.parent.kind === 152 /* Parameter */;
default:
return false;
}
@@ -95899,42 +96798,42 @@
return false;
}
switch (n.kind) {
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
- case 188 /* ObjectLiteralExpression */:
- case 184 /* ObjectBindingPattern */:
- case 168 /* TypeLiteral */:
- case 218 /* Block */:
- case 245 /* ModuleBlock */:
- case 246 /* CaseBlock */:
- case 252 /* NamedImports */:
- case 256 /* NamedExports */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 189 /* ObjectLiteralExpression */:
+ case 185 /* ObjectBindingPattern */:
+ case 169 /* TypeLiteral */:
+ case 219 /* Block */:
+ case 246 /* ModuleBlock */:
+ case 247 /* CaseBlock */:
+ case 253 /* NamedImports */:
+ case 257 /* NamedExports */:
return nodeEndsWith(n, 19 /* CloseBraceToken */, sourceFile);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return isCompletedNode(n.block, sourceFile);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
if (!n.arguments) {
return true;
}
// falls through
- case 191 /* CallExpression */:
- case 195 /* ParenthesizedExpression */:
- case 177 /* ParenthesizedType */:
+ case 192 /* CallExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 178 /* ParenthesizedType */:
return nodeEndsWith(n, 21 /* CloseParenToken */, sourceFile);
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
return isCompletedNode(n.type, sourceFile);
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 161 /* ConstructSignature */:
- case 160 /* CallSignature */:
- case 197 /* ArrowFunction */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 162 /* ConstructSignature */:
+ case 161 /* CallSignature */:
+ case 198 /* ArrowFunction */:
if (n.body) {
return isCompletedNode(n.body, sourceFile);
}
@@ -95944,65 +96843,65 @@
// Even though type parameters can be unclosed, we can get away with
// having at least a closing paren.
return hasChildOfKind(n, 21 /* CloseParenToken */, sourceFile);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return !!n.body && isCompletedNode(n.body, sourceFile);
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
if (n.elseStatement) {
return isCompletedNode(n.elseStatement, sourceFile);
}
return isCompletedNode(n.thenStatement, sourceFile);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return isCompletedNode(n.expression, sourceFile) ||
hasChildOfKind(n, 26 /* SemicolonToken */, sourceFile);
- case 187 /* ArrayLiteralExpression */:
- case 185 /* ArrayBindingPattern */:
- case 190 /* ElementAccessExpression */:
- case 149 /* ComputedPropertyName */:
- case 170 /* TupleType */:
+ case 188 /* ArrayLiteralExpression */:
+ case 186 /* ArrayBindingPattern */:
+ case 191 /* ElementAccessExpression */:
+ case 150 /* ComputedPropertyName */:
+ case 171 /* TupleType */:
return nodeEndsWith(n, 23 /* CloseBracketToken */, sourceFile);
- case 162 /* IndexSignature */:
+ case 163 /* IndexSignature */:
if (n.type) {
return isCompletedNode(n.type, sourceFile);
}
return hasChildOfKind(n, 23 /* CloseBracketToken */, sourceFile);
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
// there is no such thing as terminator token for CaseClause/DefaultClause so for simplicity always consider them non-completed
return false;
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 224 /* WhileStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 225 /* WhileStatement */:
return isCompletedNode(n.statement, sourceFile);
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
// rough approximation: if DoStatement has While keyword - then if node is completed is checking the presence of ')';
- return hasChildOfKind(n, 107 /* WhileKeyword */, sourceFile)
+ return hasChildOfKind(n, 108 /* WhileKeyword */, sourceFile)
? nodeEndsWith(n, 21 /* CloseParenToken */, sourceFile)
: isCompletedNode(n.statement, sourceFile);
- case 167 /* TypeQuery */:
+ case 168 /* TypeQuery */:
return isCompletedNode(n.exprName, sourceFile);
- case 199 /* TypeOfExpression */:
- case 198 /* DeleteExpression */:
- case 200 /* VoidExpression */:
- case 207 /* YieldExpression */:
- case 208 /* SpreadElement */:
+ case 200 /* TypeOfExpression */:
+ case 199 /* DeleteExpression */:
+ case 201 /* VoidExpression */:
+ case 208 /* YieldExpression */:
+ case 209 /* SpreadElement */:
var unaryWordExpression = n;
return isCompletedNode(unaryWordExpression.expression, sourceFile);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return isCompletedNode(n.template, sourceFile);
- case 206 /* TemplateExpression */:
+ case 207 /* TemplateExpression */:
var lastSpan = ts.lastOrUndefined(n.templateSpans);
return isCompletedNode(lastSpan, sourceFile);
- case 216 /* TemplateSpan */:
+ case 217 /* TemplateSpan */:
return ts.nodeIsPresent(n.literal);
- case 255 /* ExportDeclaration */:
- case 249 /* ImportDeclaration */:
+ case 256 /* ExportDeclaration */:
+ case 250 /* ImportDeclaration */:
return ts.nodeIsPresent(n.moduleSpecifier);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return isCompletedNode(n.operand, sourceFile);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return isCompletedNode(n.right, sourceFile);
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return isCompletedNode(n.whenFalse, sourceFile);
default:
return true;
@@ -96181,7 +97080,7 @@
}
}
}
- ts.Debug.assert(startNode !== undefined || n.kind === 284 /* SourceFile */ || n.kind === 1 /* EndOfFileToken */ || ts.isJSDocCommentContainingNode(n));
+ ts.Debug.assert(startNode !== undefined || n.kind === 285 /* SourceFile */ || n.kind === 1 /* EndOfFileToken */ || ts.isJSDocCommentContainingNode(n));
// Here we know that none of child token nodes embrace the position,
// the only known case is when position is at the end of the file.
// Try to find the rightmost token in the file without filtering.
@@ -96251,17 +97150,17 @@
return true;
}
// <div> { | </div> or <div a={| </div>
- if (token.kind === 28 /* LessThanToken */ && token.parent.kind === 270 /* JsxExpression */) {
+ if (token.kind === 28 /* LessThanToken */ && token.parent.kind === 271 /* JsxExpression */) {
return true;
}
// <div> {
// |
// } < /div>
- if (token && token.kind === 19 /* CloseBraceToken */ && token.parent.kind === 270 /* JsxExpression */) {
+ if (token && token.kind === 19 /* CloseBraceToken */ && token.parent.kind === 271 /* JsxExpression */) {
return true;
}
// <div>|</div>
- if (token.kind === 28 /* LessThanToken */ && token.parent.kind === 263 /* JsxClosingElement */) {
+ if (token.kind === 28 /* LessThanToken */ && token.parent.kind === 264 /* JsxClosingElement */) {
return true;
}
return false;
@@ -96380,15 +97279,15 @@
nTypeArguments++;
break;
case 37 /* EqualsGreaterThanToken */:
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
case 10 /* StringLiteral */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
- case 104 /* TypeOfKeyword */:
- case 86 /* ExtendsKeyword */:
- case 129 /* KeyOfKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
+ case 105 /* TypeOfKeyword */:
+ case 87 /* ExtendsKeyword */:
+ case 130 /* KeyOfKeyword */:
case 24 /* DotToken */:
case 50 /* BarToken */:
case 56 /* QuestionToken */:
@@ -96447,10 +97346,10 @@
}
ts.getNodeModifiers = getNodeModifiers;
function getTypeArgumentOrTypeParameterList(node) {
- if (node.kind === 164 /* TypeReference */ || node.kind === 191 /* CallExpression */) {
+ if (node.kind === 165 /* TypeReference */ || node.kind === 192 /* CallExpression */) {
return node.typeArguments;
}
- if (ts.isFunctionLike(node) || node.kind === 240 /* ClassDeclaration */ || node.kind === 241 /* InterfaceDeclaration */) {
+ if (ts.isFunctionLike(node) || node.kind === 241 /* ClassDeclaration */ || node.kind === 242 /* InterfaceDeclaration */) {
return node.typeParameters;
}
return undefined;
@@ -96470,7 +97369,7 @@
}
ts.isStringOrRegularExpressionOrTemplateLiteral = isStringOrRegularExpressionOrTemplateLiteral;
function isPunctuation(kind) {
- return 18 /* FirstPunctuation */ <= kind && kind <= 71 /* LastPunctuation */;
+ return 18 /* FirstPunctuation */ <= kind && kind <= 72 /* LastPunctuation */;
}
ts.isPunctuation = isPunctuation;
function isInsideTemplateLiteral(node, position, sourceFile) {
@@ -96480,9 +97379,9 @@
ts.isInsideTemplateLiteral = isInsideTemplateLiteral;
function isAccessibilityModifier(kind) {
switch (kind) {
- case 115 /* PublicKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
+ case 116 /* PublicKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
return true;
}
return false;
@@ -96495,18 +97394,18 @@
}
ts.cloneCompilerOptions = cloneCompilerOptions;
function isArrayLiteralOrObjectLiteralDestructuringPattern(node) {
- if (node.kind === 187 /* ArrayLiteralExpression */ ||
- node.kind === 188 /* ObjectLiteralExpression */) {
+ if (node.kind === 188 /* ArrayLiteralExpression */ ||
+ node.kind === 189 /* ObjectLiteralExpression */) {
// [a,b,c] from:
// [a, b, c] = someExpression;
- if (node.parent.kind === 204 /* BinaryExpression */ &&
+ if (node.parent.kind === 205 /* BinaryExpression */ &&
node.parent.left === node &&
- node.parent.operatorToken.kind === 59 /* EqualsToken */) {
+ node.parent.operatorToken.kind === 60 /* EqualsToken */) {
return true;
}
// [a, b, c] from:
// for([a, b, c] of expression)
- if (node.parent.kind === 227 /* ForOfStatement */ &&
+ if (node.parent.kind === 228 /* ForOfStatement */ &&
node.parent.initializer === node) {
return true;
}
@@ -96514,7 +97413,7 @@
// [x, [a, b, c] ] = someExpression
// or
// {x, a: {a, b, c} } = someExpression
- if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 275 /* PropertyAssignment */ ? node.parent.parent : node.parent)) {
+ if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 276 /* PropertyAssignment */ ? node.parent.parent : node.parent)) {
return true;
}
}
@@ -96558,22 +97457,22 @@
}
ts.createTextChange = createTextChange;
ts.typeKeywords = [
- 120 /* AnyKeyword */,
- 146 /* BigIntKeyword */,
- 123 /* BooleanKeyword */,
- 87 /* FalseKeyword */,
- 129 /* KeyOfKeyword */,
- 132 /* NeverKeyword */,
- 96 /* NullKeyword */,
- 135 /* NumberKeyword */,
- 136 /* ObjectKeyword */,
- 138 /* StringKeyword */,
- 139 /* SymbolKeyword */,
- 102 /* TrueKeyword */,
- 106 /* VoidKeyword */,
- 141 /* UndefinedKeyword */,
- 142 /* UniqueKeyword */,
- 143 /* UnknownKeyword */,
+ 121 /* AnyKeyword */,
+ 147 /* BigIntKeyword */,
+ 124 /* BooleanKeyword */,
+ 88 /* FalseKeyword */,
+ 130 /* KeyOfKeyword */,
+ 133 /* NeverKeyword */,
+ 97 /* NullKeyword */,
+ 136 /* NumberKeyword */,
+ 137 /* ObjectKeyword */,
+ 139 /* StringKeyword */,
+ 140 /* SymbolKeyword */,
+ 103 /* TrueKeyword */,
+ 107 /* VoidKeyword */,
+ 142 /* UndefinedKeyword */,
+ 143 /* UniqueKeyword */,
+ 144 /* UnknownKeyword */,
];
function isTypeKeyword(kind) {
return ts.contains(ts.typeKeywords, kind);
@@ -96609,7 +97508,7 @@
}
ts.skipConstraint = skipConstraint;
function getNameFromPropertyName(name) {
- return name.kind === 149 /* ComputedPropertyName */
+ return name.kind === 150 /* ComputedPropertyName */
// treat computed property names where expression is string/numeric literal as just string/numeric literal
? ts.isStringOrNumericLiteralLike(name.expression) ? name.expression.text : undefined
: ts.getTextOfIdentifierOrLiteral(name);
@@ -96685,7 +97584,7 @@
}
return ts.firstDefined(symbol.declarations, function (decl) {
var name = ts.getNameOfDeclaration(decl);
- return name && name.kind === 72 /* Identifier */ ? name.escapedText : undefined;
+ return name && name.kind === 73 /* Identifier */ ? name.escapedText : undefined;
});
}
ts.symbolEscapedNameNoDefault = symbolEscapedNameNoDefault;
@@ -96774,7 +97673,7 @@
/* @internal */
(function (ts) {
function isFirstDeclarationOfSymbolParameter(symbol) {
- return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 151 /* Parameter */;
+ return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 152 /* Parameter */;
}
ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter;
var displayPartWriter = getDisplayPartWriter();
@@ -97028,17 +97927,25 @@
return ts.ensureScriptKind(fileName, host && host.getScriptKind && host.getScriptKind(fileName));
}
ts.getScriptKind = getScriptKind;
- function getSymbolTarget(symbol) {
+ function getSymbolTarget(symbol, checker) {
var next = symbol;
- while (isTransientSymbol(next) && next.target) {
+ while (isAliasSymbol(next) || (isTransientSymbol(next) && next.target)) {
+ if (isTransientSymbol(next) && next.target) {
next = next.target;
}
+ else {
+ next = ts.skipAlias(next, checker);
+ }
+ }
return next;
}
ts.getSymbolTarget = getSymbolTarget;
function isTransientSymbol(symbol) {
return (symbol.flags & 33554432 /* Transient */) !== 0;
}
+ function isAliasSymbol(symbol) {
+ return (symbol.flags & 2097152 /* Alias */) !== 0;
+ }
function getUniqueSymbolId(symbol, checker) {
return ts.getSymbolId(ts.skipAlias(symbol, checker));
}
@@ -97074,7 +97981,14 @@
function getSynthesizedDeepCloneWithRenames(node, includeTrivia, renameMap, checker, callback) {
if (includeTrivia === void 0) { includeTrivia = true; }
var clone;
- if (ts.isIdentifier(node) && renameMap && checker) {
+ if (renameMap && checker && ts.isBindingElement(node) && ts.isIdentifier(node.name) && ts.isObjectBindingPattern(node.parent)) {
+ var symbol = checker.getSymbolAtLocation(node.name);
+ var renameInfo = symbol && renameMap.get(String(ts.getSymbolId(symbol)));
+ if (renameInfo && renameInfo.text !== (node.name || node.propertyName).getText()) {
+ clone = ts.createBindingElement(node.dotDotDotToken, node.propertyName || node.name, renameInfo, node.initializer);
+ }
+ }
+ else if (renameMap && checker && ts.isIdentifier(node)) {
var symbol = checker.getSymbolAtLocation(node);
var renameInfo = symbol && renameMap.get(String(ts.getSymbolId(symbol)));
if (renameInfo) {
@@ -97238,15 +98152,15 @@
function getContextualTypeFromParent(node, checker) {
var parent = node.parent;
switch (parent.kind) {
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return checker.getContextualType(parent);
- case 204 /* BinaryExpression */: {
+ case 205 /* BinaryExpression */: {
var _a = parent, left = _a.left, operatorToken = _a.operatorToken, right = _a.right;
return isEqualityOperatorKind(operatorToken.kind)
? checker.getTypeAtLocation(node === right ? left : right)
: checker.getContextualType(node);
}
- case 271 /* CaseClause */:
+ case 272 /* CaseClause */:
return parent.expression === node ? getSwitchedType(parent, checker) : undefined;
default:
return checker.getContextualType(node);
@@ -97288,8 +98202,8 @@
switch (node.kind) {
case 10 /* StringLiteral */:
case 14 /* NoSubstitutionTemplateLiteral */:
- case 206 /* TemplateExpression */:
- case 193 /* TaggedTemplateExpression */:
+ case 207 /* TemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return true;
default:
return false;
@@ -97332,7 +98246,7 @@
var ts;
(function (ts) {
function createClassifier() {
- var scanner = ts.createScanner(7 /* Latest */, /*skipTrivia*/ false);
+ var scanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false);
function getClassificationsForLine(text, lexState, syntacticClassifierAbsent) {
return convertClassificationsToResult(getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent), text);
}
@@ -97409,13 +98323,13 @@
function handleToken() {
switch (token) {
case 42 /* SlashToken */:
- case 64 /* SlashEqualsToken */:
+ case 65 /* SlashEqualsToken */:
if (!noRegexTable[lastNonTriviaToken] && scanner.reScanSlashToken() === 13 /* RegularExpressionLiteral */) {
token = 13 /* RegularExpressionLiteral */;
}
break;
case 28 /* LessThanToken */:
- if (lastNonTriviaToken === 72 /* Identifier */) {
+ if (lastNonTriviaToken === 73 /* Identifier */) {
// Could be the start of something generic. Keep track of that by bumping
// up the current count of generic contexts we may be in.
angleBracketStack++;
@@ -97428,16 +98342,16 @@
angleBracketStack--;
}
break;
- case 120 /* AnyKeyword */:
- case 138 /* StringKeyword */:
- case 135 /* NumberKeyword */:
- case 123 /* BooleanKeyword */:
- case 139 /* SymbolKeyword */:
+ case 121 /* AnyKeyword */:
+ case 139 /* StringKeyword */:
+ case 136 /* NumberKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 140 /* SymbolKeyword */:
if (angleBracketStack > 0 && !syntacticClassifierAbsent) {
// If it looks like we're could be in something generic, don't classify this
// as a keyword. We may just get overwritten by the syntactic classifier,
// causing a noisy experience for the user.
- token = 72 /* Identifier */;
+ token = 73 /* Identifier */;
}
break;
case 15 /* TemplateHead */:
@@ -97476,14 +98390,14 @@
break;
}
if (lastNonTriviaToken === 24 /* DotToken */) {
- token = 72 /* Identifier */;
+ token = 73 /* Identifier */;
}
else if (ts.isKeyword(lastNonTriviaToken) && ts.isKeyword(token) && !canFollow(lastNonTriviaToken, token)) {
// We have two keywords in a row. Only treat the second as a keyword if
// it's a sequence that could legally occur in the language. Otherwise
// treat it as an identifier. This way, if someone writes "private var"
// we recognize that 'var' is actually an identifier here.
- token = 72 /* Identifier */;
+ token = 73 /* Identifier */;
}
}
}
@@ -97497,19 +98411,19 @@
/// we have a series of divide operator. this list allows us to be more accurate by ruling out
/// locations where a regexp cannot exist.
var noRegexTable = ts.arrayToNumericMap([
- 72 /* Identifier */,
+ 73 /* Identifier */,
10 /* StringLiteral */,
8 /* NumericLiteral */,
9 /* BigIntLiteral */,
13 /* RegularExpressionLiteral */,
- 100 /* ThisKeyword */,
+ 101 /* ThisKeyword */,
44 /* PlusPlusToken */,
45 /* MinusMinusToken */,
21 /* CloseParenToken */,
23 /* CloseBracketToken */,
19 /* CloseBraceToken */,
- 102 /* TrueKeyword */,
- 87 /* FalseKeyword */,
+ 103 /* TrueKeyword */,
+ 88 /* FalseKeyword */,
], function (token) { return token; }, function () { return true; });
function getNewEndOfLineState(scanner, token, lastOnTemplateStack) {
switch (token) {
@@ -97621,10 +98535,10 @@
return true;
}
switch (keyword2) {
- case 126 /* GetKeyword */:
- case 137 /* SetKeyword */:
- case 124 /* ConstructorKeyword */:
- case 116 /* StaticKeyword */:
+ case 127 /* GetKeyword */:
+ case 138 /* SetKeyword */:
+ case 125 /* ConstructorKeyword */:
+ case 117 /* StaticKeyword */:
return true; // Allow things like "public get", "public constructor" and "public static".
default:
return false; // Any other keyword following "public" is actually an identifier, not a real keyword.
@@ -97669,9 +98583,9 @@
case 30 /* GreaterThanToken */:
case 31 /* LessThanEqualsToken */:
case 32 /* GreaterThanEqualsToken */:
- case 94 /* InstanceOfKeyword */:
- case 93 /* InKeyword */:
- case 119 /* AsKeyword */:
+ case 95 /* InstanceOfKeyword */:
+ case 94 /* InKeyword */:
+ case 120 /* AsKeyword */:
case 33 /* EqualsEqualsToken */:
case 34 /* ExclamationEqualsToken */:
case 35 /* EqualsEqualsEqualsToken */:
@@ -97681,18 +98595,18 @@
case 50 /* BarToken */:
case 54 /* AmpersandAmpersandToken */:
case 55 /* BarBarToken */:
- case 70 /* BarEqualsToken */:
- case 69 /* AmpersandEqualsToken */:
- case 71 /* CaretEqualsToken */:
- case 66 /* LessThanLessThanEqualsToken */:
- case 67 /* GreaterThanGreaterThanEqualsToken */:
- case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
- case 60 /* PlusEqualsToken */:
- case 61 /* MinusEqualsToken */:
- case 62 /* AsteriskEqualsToken */:
- case 64 /* SlashEqualsToken */:
- case 65 /* PercentEqualsToken */:
- case 59 /* EqualsToken */:
+ case 71 /* BarEqualsToken */:
+ case 70 /* AmpersandEqualsToken */:
+ case 72 /* CaretEqualsToken */:
+ case 67 /* LessThanLessThanEqualsToken */:
+ case 68 /* GreaterThanGreaterThanEqualsToken */:
+ case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
+ case 61 /* PlusEqualsToken */:
+ case 62 /* MinusEqualsToken */:
+ case 63 /* AsteriskEqualsToken */:
+ case 65 /* SlashEqualsToken */:
+ case 66 /* PercentEqualsToken */:
+ case 60 /* EqualsToken */:
case 27 /* CommaToken */:
return true;
default:
@@ -97719,7 +98633,7 @@
else if (isBinaryExpressionOperatorToken(token) || isPrefixUnaryExpressionOperatorToken(token)) {
return 5 /* operator */;
}
- else if (token >= 18 /* FirstPunctuation */ && token <= 71 /* LastPunctuation */) {
+ else if (token >= 18 /* FirstPunctuation */ && token <= 72 /* LastPunctuation */) {
return 10 /* punctuation */;
}
switch (token) {
@@ -97738,7 +98652,7 @@
case 5 /* WhitespaceTrivia */:
case 4 /* NewLineTrivia */:
return 8 /* whiteSpace */;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
default:
if (ts.isTemplateLiteralKind(token)) {
return 6 /* stringLiteral */;
@@ -97763,10 +98677,10 @@
// That means we're calling back into the host around every 1.2k of the file we process.
// Lib.d.ts has similar numbers.
switch (kind) {
- case 244 /* ModuleDeclaration */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 239 /* FunctionDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 240 /* FunctionDeclaration */:
cancellationToken.throwIfCancellationRequested();
}
}
@@ -97886,8 +98800,8 @@
var spanStart = span.start;
var spanLength = span.length;
// Make a scanner we can get trivia from.
- var triviaScanner = ts.createScanner(7 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
- var mergeConflictScanner = ts.createScanner(7 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
+ var triviaScanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
+ var mergeConflictScanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
var result = [];
processElement(sourceFile);
return { spans: result, endOfLineState: 0 /* None */ };
@@ -97979,18 +98893,18 @@
pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18 /* docCommentTagName */); // e.g. "param"
pos = tag.tagName.end;
switch (tag.kind) {
- case 304 /* JSDocParameterTag */:
+ case 305 /* JSDocParameterTag */:
processJSDocParameterTag(tag);
break;
- case 308 /* JSDocTemplateTag */:
+ case 309 /* JSDocTemplateTag */:
processJSDocTemplateTag(tag);
pos = tag.end;
break;
- case 307 /* JSDocTypeTag */:
+ case 308 /* JSDocTypeTag */:
processElement(tag.typeExpression);
pos = tag.end;
break;
- case 305 /* JSDocReturnTag */:
+ case 306 /* JSDocReturnTag */:
processElement(tag.typeExpression);
pos = tag.end;
break;
@@ -98077,22 +98991,22 @@
}
function tryClassifyJsxElementName(token) {
switch (token.parent && token.parent.kind) {
- case 262 /* JsxOpeningElement */:
+ case 263 /* JsxOpeningElement */:
if (token.parent.tagName === token) {
return 19 /* jsxOpenTagName */;
}
break;
- case 263 /* JsxClosingElement */:
+ case 264 /* JsxClosingElement */:
if (token.parent.tagName === token) {
return 20 /* jsxCloseTagName */;
}
break;
- case 261 /* JsxSelfClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
if (token.parent.tagName === token) {
return 21 /* jsxSelfClosingTagName */;
}
break;
- case 267 /* JsxAttribute */:
+ case 268 /* JsxAttribute */:
if (token.parent.name === token) {
return 22 /* jsxAttribute */;
}
@@ -98119,19 +99033,19 @@
if (ts.isPunctuation(tokenKind)) {
if (token) {
var parent = token.parent;
- if (tokenKind === 59 /* EqualsToken */) {
+ if (tokenKind === 60 /* EqualsToken */) {
// the '=' in a variable declaration is special cased here.
- if (parent.kind === 237 /* VariableDeclaration */ ||
- parent.kind === 154 /* PropertyDeclaration */ ||
- parent.kind === 151 /* Parameter */ ||
- parent.kind === 267 /* JsxAttribute */) {
+ if (parent.kind === 238 /* VariableDeclaration */ ||
+ parent.kind === 155 /* PropertyDeclaration */ ||
+ parent.kind === 152 /* Parameter */ ||
+ parent.kind === 268 /* JsxAttribute */) {
return 5 /* operator */;
}
}
- if (parent.kind === 204 /* BinaryExpression */ ||
- parent.kind === 202 /* PrefixUnaryExpression */ ||
- parent.kind === 203 /* PostfixUnaryExpression */ ||
- parent.kind === 205 /* ConditionalExpression */) {
+ if (parent.kind === 205 /* BinaryExpression */ ||
+ parent.kind === 203 /* PrefixUnaryExpression */ ||
+ parent.kind === 204 /* PostfixUnaryExpression */ ||
+ parent.kind === 206 /* ConditionalExpression */) {
return 5 /* operator */;
}
}
@@ -98145,7 +99059,7 @@
}
else if (tokenKind === 10 /* StringLiteral */) {
// TODO: GH#18217
- return token.parent.kind === 267 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */;
+ return token.parent.kind === 268 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */;
}
else if (tokenKind === 13 /* RegularExpressionLiteral */) {
// TODO: we should get another classification type for these literals.
@@ -98158,35 +99072,35 @@
else if (tokenKind === 11 /* JsxText */) {
return 23 /* jsxText */;
}
- else if (tokenKind === 72 /* Identifier */) {
+ else if (tokenKind === 73 /* Identifier */) {
if (token) {
switch (token.parent.kind) {
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
if (token.parent.name === token) {
return 11 /* className */;
}
return;
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
if (token.parent.name === token) {
return 15 /* typeParameterName */;
}
return;
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
if (token.parent.name === token) {
return 13 /* interfaceName */;
}
return;
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
if (token.parent.name === token) {
return 12 /* enumName */;
}
return;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
if (token.parent.name === token) {
return 14 /* moduleName */;
}
return;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
if (token.parent.name === token) {
return ts.isThisIdentifier(token) ? 3 /* keyword */ : 17 /* parameterName */;
}
@@ -98243,7 +99157,7 @@
return convertPathCompletions(completion.paths);
case 1 /* Properties */: {
var entries = [];
- Completions.getCompletionEntriesFromSymbols(completion.symbols, entries, sourceFile, sourceFile, checker, 7 /* ESNext */, log, 4 /* String */, preferences); // Target will not be used, so arbitrary
+ Completions.getCompletionEntriesFromSymbols(completion.symbols, entries, sourceFile, sourceFile, checker, 8 /* ESNext */, log, 4 /* String */, preferences); // Target will not be used, so arbitrary
return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: completion.hasIndexSignature, entries: entries };
}
case 2 /* Types */: {
@@ -98282,7 +99196,7 @@
var isNewIdentifierLocation = true; // The user may type in a path that doesn't yet exist, creating a "new identifier" with respect to the collection of identifiers the server is aware of.
var entries = pathCompletions.map(function (_a) {
var name = _a.name, kind = _a.kind, span = _a.span, extension = _a.extension;
- return ({ name: name, kind: kind, kindModifiers: kindModifiersFromExtension(extension), sortText: "0", replacementSpan: span });
+ return ({ name: name, kind: kind, kindModifiers: kindModifiersFromExtension(extension), sortText: Completions.SortText.LocationPriority, replacementSpan: span });
});
return { isGlobalCompletion: isGlobalCompletion, isMemberCompletion: false, isNewIdentifierLocation: isNewIdentifierLocation, entries: entries };
}
@@ -98309,11 +99223,11 @@
function getStringLiteralCompletionEntries(sourceFile, node, position, typeChecker, compilerOptions, host) {
var parent = node.parent;
switch (parent.kind) {
- case 182 /* LiteralType */:
+ case 183 /* LiteralType */:
switch (parent.parent.kind) {
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return { kind: 2 /* Types */, types: getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(parent)), isNewIdentifier: false };
- case 180 /* IndexedAccessType */:
+ case 181 /* IndexedAccessType */:
// Get all apparent property names
// i.e. interface Foo {
// foo: string;
@@ -98321,9 +99235,9 @@
// }
// let x: Foo["/*completion position*/"]
return stringLiteralCompletionsFromProperties(typeChecker.getTypeFromTypeNode(parent.parent.objectType));
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker) };
- case 173 /* UnionType */: {
+ case 174 /* UnionType */: {
if (!ts.isTypeReferenceNode(parent.parent.parent))
return undefined;
var alreadyUsedTypes_1 = getAlreadyUsedTypesInStringLiteralUnion(parent.parent, parent);
@@ -98333,7 +99247,7 @@
default:
return undefined;
}
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
if (ts.isObjectLiteralExpression(parent.parent) && parent.name === node) {
// Get quoted name of properties of the object literal expression
// i.e. interface ConfigFiles {
@@ -98350,7 +99264,7 @@
return stringLiteralCompletionsFromProperties(typeChecker.getContextualType(parent.parent));
}
return fromContextualType();
- case 190 /* ElementAccessExpression */: {
+ case 191 /* ElementAccessExpression */: {
var _a = parent, expression = _a.expression, argumentExpression = _a.argumentExpression;
if (node === argumentExpression) {
// Get all names of properties on the expression
@@ -98363,8 +99277,8 @@
}
return undefined;
}
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
if (!ts.isRequireCall(parent, /*checkArgumentIsStringLiteralLike*/ false) && !ts.isImportCall(parent)) {
var argumentInfo = ts.SignatureHelp.getArgumentInfoForCompletions(node, position, sourceFile);
// Get string literal completions from specialized signatures of the target
@@ -98373,9 +99287,9 @@
return argumentInfo ? getStringLiteralCompletionsFromSignature(argumentInfo, typeChecker) : fromContextualType();
}
// falls through (is `require("")` or `import("")`)
- case 249 /* ImportDeclaration */:
- case 255 /* ExportDeclaration */:
- case 259 /* ExternalModuleReference */:
+ case 250 /* ImportDeclaration */:
+ case 256 /* ExportDeclaration */:
+ case 260 /* ExternalModuleReference */:
// Get all known external module names or complete a path to a module
// i.e. import * as ns from "/*completion position*/";
// var y = import("/*completion position*/");
@@ -98822,7 +99736,7 @@
var offset = index !== -1 ? index + 1 : 0;
// If the range is an identifier, span is unnecessary.
var length = text.length - offset;
- return length === 0 || ts.isIdentifierText(text.substr(offset, length), 7 /* ESNext */) ? undefined : ts.createTextSpan(textStart + offset, length);
+ return length === 0 || ts.isIdentifierText(text.substr(offset, length), 8 /* ESNext */) ? undefined : ts.createTextSpan(textStart + offset, length);
}
// Returns true if the path is explicitly relative to the script (i.e. relative to . or ..)
function isPathRelativeToScript(path) {
@@ -98885,6 +99799,14 @@
(function (ts) {
var Completions;
(function (Completions) {
+ var SortText;
+ (function (SortText) {
+ SortText["LocationPriority"] = "0";
+ SortText["SuggestedClassMembers"] = "1";
+ SortText["GlobalsOrKeywords"] = "2";
+ SortText["AutoImportSuggestions"] = "3";
+ SortText["JavascriptIdentifiers"] = "4";
+ })(SortText = Completions.SortText || (Completions.SortText = {}));
var SymbolOriginInfoKind;
(function (SymbolOriginInfoKind) {
SymbolOriginInfoKind[SymbolOriginInfoKind["ThisType"] = 0] = "ThisType";
@@ -98919,14 +99841,15 @@
var typeChecker = program.getTypeChecker();
var compilerOptions = program.getCompilerOptions();
var contextToken = ts.findPrecedingToken(position, sourceFile);
- if (triggerCharacter && !isValidTrigger(sourceFile, triggerCharacter, contextToken, position))
+ if (triggerCharacter && !ts.isInString(sourceFile, position, contextToken) && !isValidTrigger(sourceFile, triggerCharacter, contextToken, position)) {
return undefined;
+ }
var stringCompletions = Completions.StringCompletions.getStringLiteralCompletions(sourceFile, position, contextToken, typeChecker, compilerOptions, host, log, preferences);
if (stringCompletions) {
return stringCompletions;
}
if (contextToken && ts.isBreakOrContinueStatement(contextToken.parent)
- && (contextToken.kind === 73 /* BreakKeyword */ || contextToken.kind === 78 /* ContinueKeyword */ || contextToken.kind === 72 /* Identifier */)) {
+ && (contextToken.kind === 74 /* BreakKeyword */ || contextToken.kind === 79 /* ContinueKeyword */ || contextToken.kind === 73 /* Identifier */)) {
return getLabelCompletionAtPosition(contextToken.parent);
}
var completionData = getCompletionData(program, log, sourceFile, isUncheckedFile(sourceFile, compilerOptions), position, preferences, /*detailsEntryId*/ undefined);
@@ -98953,7 +99876,7 @@
return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: entries };
}
function completionInfoFromData(sourceFile, typeChecker, compilerOptions, log, completionData, preferences) {
- var symbols = completionData.symbols, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, insideJsDocTagTypeExpression = completionData.insideJsDocTagTypeExpression;
+ var symbols = completionData.symbols, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, insideJsDocTagTypeExpression = completionData.insideJsDocTagTypeExpression, symbolToSortTextMap = completionData.symbolToSortTextMap;
if (location && location.parent && ts.isJsxClosingElement(location.parent)) {
// In the TypeScript JSX element, if such element is not defined. When users query for completion at closing tag,
// instead of simply giving unknown value, the completion will return the tag-name of an associated opening-element.
@@ -98967,20 +99890,20 @@
name: tagName.getFullText(sourceFile) + (hasClosingAngleBracket ? "" : ">"),
kind: "class" /* classElement */,
kindModifiers: undefined,
- sortText: "0",
+ sortText: SortText.LocationPriority,
};
return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: false, entries: [entry] };
}
var entries = [];
if (isUncheckedFile(sourceFile, compilerOptions)) {
- var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, sourceFile, typeChecker, compilerOptions.target, log, completionKind, preferences, propertyAccessToConvert, isJsxInitializer, recommendedCompletion, symbolToOriginInfoMap);
+ var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, sourceFile, typeChecker, compilerOptions.target, log, completionKind, preferences, propertyAccessToConvert, isJsxInitializer, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap);
getJSCompletionEntries(sourceFile, location.pos, uniqueNames, compilerOptions.target, entries); // TODO: GH#18217
}
else {
if (!isNewIdentifierLocation && (!symbols || symbols.length === 0) && keywordFilters === 0 /* None */) {
return undefined;
}
- getCompletionEntriesFromSymbols(symbols, entries, location, sourceFile, typeChecker, compilerOptions.target, log, completionKind, preferences, propertyAccessToConvert, isJsxInitializer, recommendedCompletion, symbolToOriginInfoMap);
+ getCompletionEntriesFromSymbols(symbols, entries, location, sourceFile, typeChecker, compilerOptions.target, log, completionKind, preferences, propertyAccessToConvert, isJsxInitializer, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap);
}
if (keywordFilters !== 0 /* None */) {
var entryNames = ts.arrayToSet(entries, function (e) { return e.name; });
@@ -99022,7 +99945,7 @@
name: realName,
kind: "warning" /* warning */,
kindModifiers: "",
- sortText: "1"
+ sortText: SortText.JavascriptIdentifiers
});
}
});
@@ -99031,14 +99954,9 @@
return typeof literal === "object" ? ts.pseudoBigIntToString(literal) + "n" : JSON.stringify(literal);
};
function createCompletionEntryForLiteral(literal) {
- return { name: completionNameForLiteral(literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: "0" };
+ return { name: completionNameForLiteral(literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority };
}
- function createCompletionEntry(symbol, location, sourceFile, typeChecker, target, kind, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, preferences) {
- var info = getCompletionEntryDisplayNameForSymbol(symbol, target, origin, kind);
- if (!info) {
- return undefined;
- }
- var name = info.name, needsConvertPropertyAccess = info.needsConvertPropertyAccess;
+ function createCompletionEntry(symbol, sortText, location, sourceFile, typeChecker, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, preferences) {
var insertText;
var replacementSpan;
if (origin && origin.kind === 0 /* ThisType */) {
@@ -99075,7 +99993,7 @@
name: name,
kind: ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, location),
kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol),
- sortText: "0",
+ sortText: sortText,
source: getSourceFromOrigin(origin),
hasAction: trueOrUndefined(!!origin && originIsExport(origin)),
isRecommended: trueOrUndefined(isRecommendedCompletionMatch(symbol, recommendedCompletion, typeChecker)),
@@ -99093,7 +100011,7 @@
function getSourceFromOrigin(origin) {
return origin && originIsExport(origin) ? ts.stripQuotes(origin.moduleSymbol.name) : undefined;
}
- function getCompletionEntriesFromSymbols(symbols, entries, location, sourceFile, typeChecker, target, log, kind, preferences, propertyAccessToConvert, isJsxInitializer, recommendedCompletion, symbolToOriginInfoMap) {
+ function getCompletionEntriesFromSymbols(symbols, entries, location, sourceFile, typeChecker, target, log, kind, preferences, propertyAccessToConvert, isJsxInitializer, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap) {
var start = ts.timestamp();
// Tracks unique names.
// We don't set this for global variables or completions from external module exports, because we can have multiple of those.
@@ -99103,14 +100021,18 @@
for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) {
var symbol = symbols_1[_i];
var origin = symbolToOriginInfoMap ? symbolToOriginInfoMap[ts.getSymbolId(symbol)] : undefined;
- var entry = createCompletionEntry(symbol, location, sourceFile, typeChecker, target, kind, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, preferences);
- if (!entry) {
+ var info = getCompletionEntryDisplayNameForSymbol(symbol, target, origin, kind);
+ if (!info) {
continue;
}
- var name = entry.name;
+ var name = info.name, needsConvertPropertyAccess = info.needsConvertPropertyAccess;
if (uniques.has(name)) {
continue;
}
+ var entry = createCompletionEntry(symbol, symbolToSortTextMap && symbolToSortTextMap[ts.getSymbolId(symbol)] || SortText.LocationPriority, location, sourceFile, typeChecker, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, preferences);
+ if (!entry) {
+ continue;
+ }
// Latter case tests whether this is a global variable.
if (!origin && !(symbol.parent === undefined && !ts.some(symbol.declarations, function (d) { return d.getSourceFile() === location.getSourceFile(); }))) { // TODO: GH#18217
uniques.set(name, true);
@@ -99143,7 +100065,7 @@
name: name,
kindModifiers: "" /* none */,
kind: "label" /* label */,
- sortText: "0"
+ sortText: SortText.LocationPriority
});
}
}
@@ -99283,25 +100205,25 @@
function getContextualType(previousToken, position, sourceFile, checker) {
var parent = previousToken.parent;
switch (previousToken.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return ts.getContextualTypeFromParent(previousToken, checker);
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
switch (parent.kind) {
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return checker.getContextualType(parent.initializer); // TODO: GH#18217
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return checker.getTypeAtLocation(parent.left);
- case 267 /* JsxAttribute */:
+ case 268 /* JsxAttribute */:
return checker.getContextualTypeForJsxAttribute(parent);
default:
return undefined;
}
- case 95 /* NewKeyword */:
+ case 96 /* NewKeyword */:
return checker.getContextualType(parent);
- case 74 /* CaseKeyword */:
+ case 75 /* CaseKeyword */:
return ts.getSwitchedType(ts.cast(parent, ts.isCaseClause), checker);
case 18 /* OpenBraceToken */:
- return ts.isJsxExpression(parent) && parent.parent.kind !== 260 /* JsxElement */ ? checker.getContextualTypeForJsxAttribute(parent.parent) : undefined;
+ return ts.isJsxExpression(parent) && parent.parent.kind !== 261 /* JsxElement */ ? checker.getContextualTypeForJsxAttribute(parent.parent) : undefined;
default:
var argInfo = ts.SignatureHelp.getArgumentInfoForCompletions(previousToken, position, sourceFile);
return argInfo
@@ -99320,7 +100242,7 @@
return symbol.parent && (isModuleSymbol(symbol.parent) ? symbol : getFirstSymbolInChain(symbol.parent, enclosingDeclaration, checker));
}
function isModuleSymbol(symbol) {
- return symbol.declarations.some(function (d) { return d.kind === 284 /* SourceFile */; });
+ return symbol.declarations.some(function (d) { return d.kind === 285 /* SourceFile */; });
}
function getCompletionData(program, log, sourceFile, isUncheckedFile, position, preferences, detailsEntryId) {
var typeChecker = program.getTypeChecker();
@@ -99371,11 +100293,11 @@
if (tag.tagName.pos <= position && position <= tag.tagName.end) {
return { kind: 1 /* JsDocTagName */ };
}
- if (isTagWithTypeExpression(tag) && tag.typeExpression && tag.typeExpression.kind === 288 /* JSDocTypeExpression */) {
+ if (isTagWithTypeExpression(tag) && tag.typeExpression && tag.typeExpression.kind === 289 /* JSDocTypeExpression */) {
currentToken = ts.getTokenAtPosition(sourceFile, position);
if (!currentToken ||
(!ts.isDeclarationName(currentToken) &&
- (currentToken.parent.kind !== 310 /* JSDocPropertyTag */ ||
+ (currentToken.parent.kind !== 311 /* JSDocPropertyTag */ ||
currentToken.parent.name !== currentToken))) {
// Use as type location if inside tag's type expression
insideJsDocTagTypeExpression = isCurrentlyEditingNode(tag.typeExpression);
@@ -99425,7 +100347,7 @@
if (contextToken.kind === 24 /* DotToken */) {
isRightOfDot = true;
switch (parent.kind) {
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
propertyAccessToConvert = parent;
node = propertyAccessToConvert.expression;
if (node.end === contextToken.pos &&
@@ -99437,14 +100359,14 @@
return undefined;
}
break;
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
node = parent.left;
break;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
node = parent.name;
break;
- case 183 /* ImportType */:
- case 214 /* MetaProperty */:
+ case 184 /* ImportType */:
+ case 215 /* MetaProperty */:
node = parent;
break;
default:
@@ -99457,7 +100379,7 @@
// <UI.Test /* completion position */ />
// If the tagname is a property access expression, we will then walk up to the top most of property access expression.
// Then, try to get a JSX container and its associated attributes type.
- if (parent && parent.kind === 189 /* PropertyAccessExpression */) {
+ if (parent && parent.kind === 190 /* PropertyAccessExpression */) {
contextToken = parent;
parent = parent.parent;
}
@@ -99465,48 +100387,48 @@
if (currentToken.parent === location) {
switch (currentToken.kind) {
case 30 /* GreaterThanToken */:
- if (currentToken.parent.kind === 260 /* JsxElement */ || currentToken.parent.kind === 262 /* JsxOpeningElement */) {
+ if (currentToken.parent.kind === 261 /* JsxElement */ || currentToken.parent.kind === 263 /* JsxOpeningElement */) {
location = currentToken;
}
break;
case 42 /* SlashToken */:
- if (currentToken.parent.kind === 261 /* JsxSelfClosingElement */) {
+ if (currentToken.parent.kind === 262 /* JsxSelfClosingElement */) {
location = currentToken;
}
break;
}
}
switch (parent.kind) {
- case 263 /* JsxClosingElement */:
+ case 264 /* JsxClosingElement */:
if (contextToken.kind === 42 /* SlashToken */) {
isStartingCloseTag = true;
location = contextToken;
}
break;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
if (!binaryExpressionMayBeOpenTag(parent)) {
break;
}
// falls through
- case 261 /* JsxSelfClosingElement */:
- case 260 /* JsxElement */:
- case 262 /* JsxOpeningElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 261 /* JsxElement */:
+ case 263 /* JsxOpeningElement */:
if (contextToken.kind === 28 /* LessThanToken */) {
isRightOfOpenTag = true;
location = contextToken;
}
break;
- case 267 /* JsxAttribute */:
+ case 268 /* JsxAttribute */:
switch (previousToken.kind) {
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
isJsxInitializer = true;
break;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
// For `<div x=[|f/**/|]`, `parent` will be `x` and `previousToken.parent` will be `f` (which is its own JsxAttribute)
// Note for `<div someBool f>` we don't want to treat this as a jsx inializer, instead it's the attribute name.
if (parent !== previousToken.parent &&
!parent.initializer &&
- ts.findChildOfKind(parent, 59 /* EqualsToken */, sourceFile)) {
+ ts.findChildOfKind(parent, 60 /* EqualsToken */, sourceFile)) {
isJsxInitializer = previousToken;
}
}
@@ -99520,6 +100442,7 @@
var keywordFilters = 0 /* None */;
var symbols = [];
var symbolToOriginInfoMap = [];
+ var symbolToSortTextMap = [];
if (isRightOfDot) {
getTypeScriptMemberSymbols();
}
@@ -99565,15 +100488,16 @@
recommendedCompletion: recommendedCompletion,
previousToken: previousToken,
isJsxInitializer: isJsxInitializer,
- insideJsDocTagTypeExpression: insideJsDocTagTypeExpression
+ insideJsDocTagTypeExpression: insideJsDocTagTypeExpression,
+ symbolToSortTextMap: symbolToSortTextMap
};
function isTagWithTypeExpression(tag) {
switch (tag.kind) {
- case 304 /* JSDocParameterTag */:
- case 310 /* JSDocPropertyTag */:
- case 305 /* JSDocReturnTag */:
- case 307 /* JSDocTypeTag */:
- case 309 /* JSDocTypedefTag */:
+ case 305 /* JSDocParameterTag */:
+ case 311 /* JSDocPropertyTag */:
+ case 306 /* JSDocReturnTag */:
+ case 308 /* JSDocTypeTag */:
+ case 310 /* JSDocTypedefTag */:
return true;
default:
return false;
@@ -99615,15 +100539,15 @@
// If the module is merged with a value, we must get the type of the class and add its propertes (for inherited static methods).
if (!isTypeLocation &&
symbol.declarations &&
- symbol.declarations.some(function (d) { return d.kind !== 284 /* SourceFile */ && d.kind !== 244 /* ModuleDeclaration */ && d.kind !== 243 /* EnumDeclaration */; })) {
+ symbol.declarations.some(function (d) { return d.kind !== 285 /* SourceFile */ && d.kind !== 245 /* ModuleDeclaration */ && d.kind !== 244 /* EnumDeclaration */; })) {
addTypeProperties(typeChecker.getTypeOfSymbolAtLocation(symbol, node));
}
return;
}
}
}
- if (ts.isMetaProperty(node) && (node.keywordToken === 95 /* NewKeyword */ || node.keywordToken === 92 /* ImportKeyword */)) {
- var completion = (node.keywordToken === 95 /* NewKeyword */) ? "target" : "meta";
+ if (ts.isMetaProperty(node) && (node.keywordToken === 96 /* NewKeyword */ || node.keywordToken === 93 /* ImportKeyword */)) {
+ var completion = (node.keywordToken === 96 /* NewKeyword */) ? "target" : "meta";
symbols.push(typeChecker.createSymbol(4 /* Property */, ts.escapeLeadingUnderscores(completion)));
return;
}
@@ -99644,7 +100568,7 @@
else {
for (var _i = 0, _a = type.getApparentProperties(); _i < _a.length; _i++) {
var symbol = _a[_i];
- if (typeChecker.isValidPropertyAccessForCompletions(node.kind === 183 /* ImportType */ ? node : node.parent, type, symbol)) {
+ if (typeChecker.isValidPropertyAccessForCompletions(node.kind === 184 /* ImportType */ ? node : node.parent, type, symbol)) {
addPropertySymbol(symbol);
}
}
@@ -99747,14 +100671,22 @@
var isTypeOnly = isTypeOnlyCompletion();
var symbolMeanings = (isTypeOnly ? 0 /* None */ : 67220415 /* Value */) | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */;
symbols = ts.Debug.assertEachDefined(typeChecker.getSymbolsInScope(scopeNode, symbolMeanings), "getSymbolsInScope() should all be defined");
+ for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) {
+ var symbol = symbols_2[_i];
+ if (!typeChecker.isArgumentsSymbol(symbol) &&
+ !ts.some(symbol.declarations, function (d) { return d.getSourceFile() === sourceFile; })) {
+ symbolToSortTextMap[ts.getSymbolId(symbol)] = SortText.GlobalsOrKeywords;
+ }
+ }
// Need to insert 'this.' before properties of `this` type, so only do that if `includeInsertTextCompletions`
- if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 284 /* SourceFile */) {
+ if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 285 /* SourceFile */) {
var thisType = typeChecker.tryGetThisTypeAt(scopeNode, /*includeGlobalThis*/ false);
if (thisType) {
- for (var _i = 0, _a = getPropertiesForCompletion(thisType, typeChecker); _i < _a.length; _i++) {
- var symbol = _a[_i];
+ for (var _a = 0, _b = getPropertiesForCompletion(thisType, typeChecker); _a < _b.length; _a++) {
+ var symbol = _b[_a];
symbolToOriginInfoMap[ts.getSymbolId(symbol)] = { kind: 0 /* ThisType */ };
symbols.push(symbol);
+ symbolToSortTextMap[ts.getSymbolId(symbol)] = SortText.SuggestedClassMembers;
}
}
}
@@ -99781,10 +100713,10 @@
}
function isSnippetScope(scopeNode) {
switch (scopeNode.kind) {
- case 284 /* SourceFile */:
- case 206 /* TemplateExpression */:
- case 270 /* JsxExpression */:
- case 218 /* Block */:
+ case 285 /* SourceFile */:
+ case 207 /* TemplateExpression */:
+ case 271 /* JsxExpression */:
+ case 219 /* Block */:
return true;
default:
return ts.isStatement(scopeNode);
@@ -99823,25 +100755,25 @@
}
function isContextTokenValueLocation(contextToken) {
return contextToken &&
- contextToken.kind === 104 /* TypeOfKeyword */ &&
- (contextToken.parent.kind === 167 /* TypeQuery */ || ts.isTypeOfExpression(contextToken.parent));
+ contextToken.kind === 105 /* TypeOfKeyword */ &&
+ (contextToken.parent.kind === 168 /* TypeQuery */ || ts.isTypeOfExpression(contextToken.parent));
}
function isContextTokenTypeLocation(contextToken) {
if (contextToken) {
var parentKind = contextToken.parent.kind;
switch (contextToken.kind) {
case 57 /* ColonToken */:
- return parentKind === 154 /* PropertyDeclaration */ ||
- parentKind === 153 /* PropertySignature */ ||
- parentKind === 151 /* Parameter */ ||
- parentKind === 237 /* VariableDeclaration */ ||
+ return parentKind === 155 /* PropertyDeclaration */ ||
+ parentKind === 154 /* PropertySignature */ ||
+ parentKind === 152 /* Parameter */ ||
+ parentKind === 238 /* VariableDeclaration */ ||
ts.isFunctionLikeKind(parentKind);
- case 59 /* EqualsToken */:
- return parentKind === 242 /* TypeAliasDeclaration */;
- case 119 /* AsKeyword */:
- return parentKind === 212 /* AsExpression */;
- case 86 /* ExtendsKeyword */:
- return parentKind === 150 /* TypeParameter */;
+ case 60 /* EqualsToken */:
+ return parentKind === 243 /* TypeAliasDeclaration */;
+ case 120 /* AsKeyword */:
+ return parentKind === 213 /* AsExpression */;
+ case 87 /* ExtendsKeyword */:
+ return parentKind === 151 /* TypeParameter */;
}
}
return false;
@@ -99873,6 +100805,7 @@
// So in `declare namespace foo {} declare module "foo" { export = foo; }`, there will just be the global completion for `foo`.
ts.some(resolvedModuleSymbol.declarations, function (d) { return !!d.getSourceFile().externalModuleIndicator; })) {
symbols.push(resolvedModuleSymbol);
+ symbolToSortTextMap[ts.getSymbolId(resolvedModuleSymbol)] = SortText.AutoImportSuggestions;
symbolToOriginInfoMap[ts.getSymbolId(resolvedModuleSymbol)] = { kind: 3 /* Export */, moduleSymbol: moduleSymbol, isDefaultExport: false };
}
for (var _i = 0, _a = typeChecker.getExportsOfModule(moduleSymbol); _i < _a.length; _i++) {
@@ -99897,6 +100830,7 @@
var origin = { kind: 3 /* Export */, moduleSymbol: moduleSymbol, isDefaultExport: isDefaultExport };
if (detailsEntryId || stringContainsCharactersInOrder(getSymbolName(symbol, origin, target).toLowerCase(), tokenTextLowerCase)) {
symbols.push(symbol);
+ symbolToSortTextMap[ts.getSymbolId(symbol)] = SortText.AutoImportSuggestions;
symbolToOriginInfoMap[ts.getSymbolId(symbol)] = origin;
}
}
@@ -99948,11 +100882,11 @@
return true;
}
if (contextToken.kind === 30 /* GreaterThanToken */ && contextToken.parent) {
- if (contextToken.parent.kind === 262 /* JsxOpeningElement */) {
+ if (contextToken.parent.kind === 263 /* JsxOpeningElement */) {
return true;
}
- if (contextToken.parent.kind === 263 /* JsxClosingElement */ || contextToken.parent.kind === 261 /* JsxSelfClosingElement */) {
- return !!contextToken.parent.parent && contextToken.parent.parent.kind === 260 /* JsxElement */;
+ if (contextToken.parent.kind === 264 /* JsxClosingElement */ || contextToken.parent.kind === 262 /* JsxSelfClosingElement */) {
+ return !!contextToken.parent.parent && contextToken.parent.parent.kind === 261 /* JsxElement */;
}
}
return false;
@@ -99963,40 +100897,40 @@
// Previous token may have been a keyword that was converted to an identifier.
switch (keywordForNode(previousToken)) {
case 27 /* CommaToken */:
- return containingNodeKind === 191 /* CallExpression */ // func( a, |
- || containingNodeKind === 157 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */
- || containingNodeKind === 192 /* NewExpression */ // new C(a, |
- || containingNodeKind === 187 /* ArrayLiteralExpression */ // [a, |
- || containingNodeKind === 204 /* BinaryExpression */ // const x = (a, |
- || containingNodeKind === 165 /* FunctionType */; // var x: (s: string, list|
+ return containingNodeKind === 192 /* CallExpression */ // func( a, |
+ || containingNodeKind === 158 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */
+ || containingNodeKind === 193 /* NewExpression */ // new C(a, |
+ || containingNodeKind === 188 /* ArrayLiteralExpression */ // [a, |
+ || containingNodeKind === 205 /* BinaryExpression */ // const x = (a, |
+ || containingNodeKind === 166 /* FunctionType */; // var x: (s: string, list|
case 20 /* OpenParenToken */:
- return containingNodeKind === 191 /* CallExpression */ // func( |
- || containingNodeKind === 157 /* Constructor */ // constructor( |
- || containingNodeKind === 192 /* NewExpression */ // new C(a|
- || containingNodeKind === 195 /* ParenthesizedExpression */ // const x = (a|
- || containingNodeKind === 177 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */
+ return containingNodeKind === 192 /* CallExpression */ // func( |
+ || containingNodeKind === 158 /* Constructor */ // constructor( |
+ || containingNodeKind === 193 /* NewExpression */ // new C(a|
+ || containingNodeKind === 196 /* ParenthesizedExpression */ // const x = (a|
+ || containingNodeKind === 178 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */
case 22 /* OpenBracketToken */:
- return containingNodeKind === 187 /* ArrayLiteralExpression */ // [ |
- || containingNodeKind === 162 /* IndexSignature */ // [ | : string ]
- || containingNodeKind === 149 /* ComputedPropertyName */; // [ | /* this can become an index signature */
- case 130 /* ModuleKeyword */: // module |
- case 131 /* NamespaceKeyword */: // namespace |
+ return containingNodeKind === 188 /* ArrayLiteralExpression */ // [ |
+ || containingNodeKind === 163 /* IndexSignature */ // [ | : string ]
+ || containingNodeKind === 150 /* ComputedPropertyName */; // [ | /* this can become an index signature */
+ case 131 /* ModuleKeyword */: // module |
+ case 132 /* NamespaceKeyword */: // namespace |
return true;
case 24 /* DotToken */:
- return containingNodeKind === 244 /* ModuleDeclaration */; // module A.|
+ return containingNodeKind === 245 /* ModuleDeclaration */; // module A.|
case 18 /* OpenBraceToken */:
- return containingNodeKind === 240 /* ClassDeclaration */; // class A{ |
- case 59 /* EqualsToken */:
- return containingNodeKind === 237 /* VariableDeclaration */ // const x = a|
- || containingNodeKind === 204 /* BinaryExpression */; // x = a|
+ return containingNodeKind === 241 /* ClassDeclaration */; // class A{ |
+ case 60 /* EqualsToken */:
+ return containingNodeKind === 238 /* VariableDeclaration */ // const x = a|
+ || containingNodeKind === 205 /* BinaryExpression */; // x = a|
case 15 /* TemplateHead */:
- return containingNodeKind === 206 /* TemplateExpression */; // `aa ${|
+ return containingNodeKind === 207 /* TemplateExpression */; // `aa ${|
case 16 /* TemplateMiddle */:
- return containingNodeKind === 216 /* TemplateSpan */; // `aa ${10} dd ${|
- case 115 /* PublicKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- return containingNodeKind === 154 /* PropertyDeclaration */; // class A{ public |
+ return containingNodeKind === 217 /* TemplateSpan */; // `aa ${10} dd ${|
+ case 116 /* PublicKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ return containingNodeKind === 155 /* PropertyDeclaration */; // class A{ public |
}
}
return false;
@@ -100023,7 +100957,7 @@
completionKind = 0 /* ObjectPropertyDeclaration */;
var typeMembers;
var existingMembers;
- if (objectLikeContainer.kind === 188 /* ObjectLiteralExpression */) {
+ if (objectLikeContainer.kind === 189 /* ObjectLiteralExpression */) {
var typeForObject = typeChecker.getContextualType(objectLikeContainer);
if (!typeForObject)
return 2 /* Fail */;
@@ -100032,7 +100966,7 @@
existingMembers = objectLikeContainer.properties;
}
else {
- ts.Debug.assert(objectLikeContainer.kind === 184 /* ObjectBindingPattern */);
+ ts.Debug.assert(objectLikeContainer.kind === 185 /* ObjectBindingPattern */);
// We are *only* completing on properties from the type being destructured.
isNewIdentifierLocation = false;
var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent);
@@ -100043,12 +100977,12 @@
// through type declaration or inference.
// Also proceed if rootDeclaration is a parameter and if its containing function expression/arrow function is contextually typed -
// type of parameter will flow in from the contextual type of the function
- var canGetType = ts.hasInitializer(rootDeclaration) || ts.hasType(rootDeclaration) || rootDeclaration.parent.parent.kind === 227 /* ForOfStatement */;
- if (!canGetType && rootDeclaration.kind === 151 /* Parameter */) {
+ var canGetType = ts.hasInitializer(rootDeclaration) || ts.hasType(rootDeclaration) || rootDeclaration.parent.parent.kind === 228 /* ForOfStatement */;
+ if (!canGetType && rootDeclaration.kind === 152 /* Parameter */) {
if (ts.isExpression(rootDeclaration.parent)) {
canGetType = !!typeChecker.getContextualType(rootDeclaration.parent);
}
- else if (rootDeclaration.parent.kind === 156 /* MethodDeclaration */ || rootDeclaration.parent.kind === 159 /* SetAccessor */) {
+ else if (rootDeclaration.parent.kind === 157 /* MethodDeclaration */ || rootDeclaration.parent.kind === 160 /* SetAccessor */) {
canGetType = ts.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent);
}
}
@@ -100090,7 +101024,7 @@
return 0 /* Continue */;
// cursor is in an import clause
// try to show exported member for imported module
- var moduleSpecifier = (namedImportsOrExports.kind === 252 /* NamedImports */ ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent).moduleSpecifier;
+ var moduleSpecifier = (namedImportsOrExports.kind === 253 /* NamedImports */ ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent).moduleSpecifier;
var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(moduleSpecifier); // TODO: GH#18217
if (!moduleSpecifierSymbol)
return 2 /* Fail */;
@@ -100121,7 +101055,7 @@
var classElement = contextToken.parent;
var classElementModifierFlags = ts.isClassElement(classElement) ? ts.getModifierFlags(classElement) : 0 /* None */;
// If this is context token is not something we are editing now, consider if this would lead to be modifier
- if (contextToken.kind === 72 /* Identifier */ && !isCurrentlyEditingNode(contextToken)) {
+ if (contextToken.kind === 73 /* Identifier */ && !isCurrentlyEditingNode(contextToken)) {
switch (contextToken.getText()) {
case "private":
classElementModifierFlags = classElementModifierFlags | 8 /* Private */;
@@ -100158,7 +101092,7 @@
break;
case 40 /* AsteriskToken */:
return ts.isMethodDeclaration(parent) ? ts.tryCast(parent.parent, ts.isObjectLiteralExpression) : undefined;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return contextToken.text === "async" && ts.isShorthandPropertyAssignment(contextToken.parent)
? contextToken.parent.parent : undefined;
}
@@ -100211,12 +101145,12 @@
case 30 /* GreaterThanToken */: // End of a type argument list
case 29 /* LessThanSlashToken */:
case 42 /* SlashToken */:
- case 72 /* Identifier */:
- case 189 /* PropertyAccessExpression */:
- case 268 /* JsxAttributes */:
- case 267 /* JsxAttribute */:
- case 269 /* JsxSpreadAttribute */:
- if (parent && (parent.kind === 261 /* JsxSelfClosingElement */ || parent.kind === 262 /* JsxOpeningElement */)) {
+ case 73 /* Identifier */:
+ case 190 /* PropertyAccessExpression */:
+ case 269 /* JsxAttributes */:
+ case 268 /* JsxAttribute */:
+ case 270 /* JsxSpreadAttribute */:
+ if (parent && (parent.kind === 262 /* JsxSelfClosingElement */ || parent.kind === 263 /* JsxOpeningElement */)) {
if (contextToken.kind === 30 /* GreaterThanToken */) {
var precedingToken = ts.findPrecedingToken(contextToken.pos, sourceFile, /*startNode*/ undefined);
if (!parent.typeArguments || (precedingToken && precedingToken.kind === 42 /* SlashToken */))
@@ -100224,7 +101158,7 @@
}
return parent;
}
- else if (parent.kind === 267 /* JsxAttribute */) {
+ else if (parent.kind === 268 /* JsxAttribute */) {
// Currently we parse JsxOpeningLikeElement as:
// JsxOpeningLikeElement
// attributes: JsxAttributes
@@ -100236,7 +101170,7 @@
// its parent is a JsxExpression, whose parent is a JsxAttribute,
// whose parent is a JsxOpeningLikeElement
case 10 /* StringLiteral */:
- if (parent && ((parent.kind === 267 /* JsxAttribute */) || (parent.kind === 269 /* JsxSpreadAttribute */))) {
+ if (parent && ((parent.kind === 268 /* JsxAttribute */) || (parent.kind === 270 /* JsxSpreadAttribute */))) {
// Currently we parse JsxOpeningLikeElement as:
// JsxOpeningLikeElement
// attributes: JsxAttributes
@@ -100246,8 +101180,8 @@
break;
case 19 /* CloseBraceToken */:
if (parent &&
- parent.kind === 270 /* JsxExpression */ &&
- parent.parent && parent.parent.kind === 267 /* JsxAttribute */) {
+ parent.kind === 271 /* JsxExpression */ &&
+ parent.parent && parent.parent.kind === 268 /* JsxAttribute */) {
// Currently we parse JsxOpeningLikeElement as:
// JsxOpeningLikeElement
// attributes: JsxAttributes
@@ -100255,7 +101189,7 @@
// each JsxAttribute can have initializer as JsxExpression
return parent.parent.parent.parent;
}
- if (parent && parent.kind === 269 /* JsxSpreadAttribute */) {
+ if (parent && parent.kind === 270 /* JsxSpreadAttribute */) {
// Currently we parse JsxOpeningLikeElement as:
// JsxOpeningLikeElement
// attributes: JsxAttributes
@@ -100275,62 +101209,62 @@
var containingNodeKind = parent.kind;
switch (contextToken.kind) {
case 27 /* CommaToken */:
- return containingNodeKind === 237 /* VariableDeclaration */ ||
- containingNodeKind === 238 /* VariableDeclarationList */ ||
- containingNodeKind === 219 /* VariableStatement */ ||
- containingNodeKind === 243 /* EnumDeclaration */ || // enum a { foo, |
+ return containingNodeKind === 238 /* VariableDeclaration */ ||
+ containingNodeKind === 239 /* VariableDeclarationList */ ||
+ containingNodeKind === 220 /* VariableStatement */ ||
+ containingNodeKind === 244 /* EnumDeclaration */ || // enum a { foo, |
isFunctionLikeButNotConstructor(containingNodeKind) ||
- containingNodeKind === 241 /* InterfaceDeclaration */ || // interface A<T, |
- containingNodeKind === 185 /* ArrayBindingPattern */ || // var [x, y|
- containingNodeKind === 242 /* TypeAliasDeclaration */ || // type Map, K, |
+ containingNodeKind === 242 /* InterfaceDeclaration */ || // interface A<T, |
+ containingNodeKind === 186 /* ArrayBindingPattern */ || // var [x, y|
+ containingNodeKind === 243 /* TypeAliasDeclaration */ || // type Map, K, |
// class A<T, |
// var C = class D<T, |
(ts.isClassLike(parent) &&
!!parent.typeParameters &&
parent.typeParameters.end >= contextToken.pos);
case 24 /* DotToken */:
- return containingNodeKind === 185 /* ArrayBindingPattern */; // var [.|
+ return containingNodeKind === 186 /* ArrayBindingPattern */; // var [.|
case 57 /* ColonToken */:
- return containingNodeKind === 186 /* BindingElement */; // var {x :html|
+ return containingNodeKind === 187 /* BindingElement */; // var {x :html|
case 22 /* OpenBracketToken */:
- return containingNodeKind === 185 /* ArrayBindingPattern */; // var [x|
+ return containingNodeKind === 186 /* ArrayBindingPattern */; // var [x|
case 20 /* OpenParenToken */:
- return containingNodeKind === 274 /* CatchClause */ ||
+ return containingNodeKind === 275 /* CatchClause */ ||
isFunctionLikeButNotConstructor(containingNodeKind);
case 18 /* OpenBraceToken */:
- return containingNodeKind === 243 /* EnumDeclaration */; // enum a { |
+ return containingNodeKind === 244 /* EnumDeclaration */; // enum a { |
case 28 /* LessThanToken */:
- return containingNodeKind === 240 /* ClassDeclaration */ || // class A< |
- containingNodeKind === 209 /* ClassExpression */ || // var C = class D< |
- containingNodeKind === 241 /* InterfaceDeclaration */ || // interface A< |
- containingNodeKind === 242 /* TypeAliasDeclaration */ || // type List< |
+ return containingNodeKind === 241 /* ClassDeclaration */ || // class A< |
+ containingNodeKind === 210 /* ClassExpression */ || // var C = class D< |
+ containingNodeKind === 242 /* InterfaceDeclaration */ || // interface A< |
+ containingNodeKind === 243 /* TypeAliasDeclaration */ || // type List< |
ts.isFunctionLikeKind(containingNodeKind);
- case 116 /* StaticKeyword */:
- return containingNodeKind === 154 /* PropertyDeclaration */ && !ts.isClassLike(parent.parent);
+ case 117 /* StaticKeyword */:
+ return containingNodeKind === 155 /* PropertyDeclaration */ && !ts.isClassLike(parent.parent);
case 25 /* DotDotDotToken */:
- return containingNodeKind === 151 /* Parameter */ ||
- (!!parent.parent && parent.parent.kind === 185 /* ArrayBindingPattern */); // var [...z|
- case 115 /* PublicKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- return containingNodeKind === 151 /* Parameter */ && !ts.isConstructorDeclaration(parent.parent);
- case 119 /* AsKeyword */:
- return containingNodeKind === 253 /* ImportSpecifier */ ||
- containingNodeKind === 257 /* ExportSpecifier */ ||
- containingNodeKind === 251 /* NamespaceImport */;
- case 126 /* GetKeyword */:
- case 137 /* SetKeyword */:
+ return containingNodeKind === 152 /* Parameter */ ||
+ (!!parent.parent && parent.parent.kind === 186 /* ArrayBindingPattern */); // var [...z|
+ case 116 /* PublicKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ return containingNodeKind === 152 /* Parameter */ && !ts.isConstructorDeclaration(parent.parent);
+ case 120 /* AsKeyword */:
+ return containingNodeKind === 254 /* ImportSpecifier */ ||
+ containingNodeKind === 258 /* ExportSpecifier */ ||
+ containingNodeKind === 252 /* NamespaceImport */;
+ case 127 /* GetKeyword */:
+ case 138 /* SetKeyword */:
return !isFromObjectTypeDeclaration(contextToken);
- case 76 /* ClassKeyword */:
- case 84 /* EnumKeyword */:
- case 110 /* InterfaceKeyword */:
- case 90 /* FunctionKeyword */:
- case 105 /* VarKeyword */:
- case 92 /* ImportKeyword */:
- case 111 /* LetKeyword */:
- case 77 /* ConstKeyword */:
- case 117 /* YieldKeyword */:
- case 140 /* TypeKeyword */: // type htm|
+ case 77 /* ClassKeyword */:
+ case 85 /* EnumKeyword */:
+ case 111 /* InterfaceKeyword */:
+ case 91 /* FunctionKeyword */:
+ case 106 /* VarKeyword */:
+ case 93 /* ImportKeyword */:
+ case 112 /* LetKeyword */:
+ case 78 /* ConstKeyword */:
+ case 118 /* YieldKeyword */:
+ case 141 /* TypeKeyword */: // type htm|
return true;
case 40 /* AsteriskToken */:
return ts.isFunctionLike(contextToken.parent) && !ts.isMethodDeclaration(contextToken.parent);
@@ -100353,22 +101287,22 @@
}
// Previous token may have been a keyword that was converted to an identifier.
switch (keywordForNode(contextToken)) {
- case 118 /* AbstractKeyword */:
- case 76 /* ClassKeyword */:
- case 77 /* ConstKeyword */:
- case 125 /* DeclareKeyword */:
- case 84 /* EnumKeyword */:
- case 90 /* FunctionKeyword */:
- case 110 /* InterfaceKeyword */:
- case 111 /* LetKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 115 /* PublicKeyword */:
- case 116 /* StaticKeyword */:
- case 105 /* VarKeyword */:
- case 117 /* YieldKeyword */:
+ case 119 /* AbstractKeyword */:
+ case 77 /* ClassKeyword */:
+ case 78 /* ConstKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 85 /* EnumKeyword */:
+ case 91 /* FunctionKeyword */:
+ case 111 /* InterfaceKeyword */:
+ case 112 /* LetKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 116 /* PublicKeyword */:
+ case 117 /* StaticKeyword */:
+ case 106 /* VarKeyword */:
+ case 118 /* YieldKeyword */:
return true;
- case 121 /* AsyncKeyword */:
+ case 122 /* AsyncKeyword */:
return ts.isPropertyDeclaration(contextToken.parent);
}
return ts.isDeclarationName(contextToken)
@@ -100378,7 +101312,7 @@
&& !(ts.isClassLike(contextToken.parent) && (contextToken !== previousToken || position > previousToken.end));
}
function isFunctionLikeButNotConstructor(kind) {
- return ts.isFunctionLikeKind(kind) && kind !== 157 /* Constructor */;
+ return ts.isFunctionLikeKind(kind) && kind !== 158 /* Constructor */;
}
function isDotOfNumericLiteral(contextToken) {
if (contextToken.kind === 8 /* NumericLiteral */) {
@@ -100401,12 +101335,12 @@
for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) {
var m = existingMembers_1[_i];
// Ignore omitted expressions for missing members
- if (m.kind !== 275 /* PropertyAssignment */ &&
- m.kind !== 276 /* ShorthandPropertyAssignment */ &&
- m.kind !== 186 /* BindingElement */ &&
- m.kind !== 156 /* MethodDeclaration */ &&
- m.kind !== 158 /* GetAccessor */ &&
- m.kind !== 159 /* SetAccessor */) {
+ if (m.kind !== 276 /* PropertyAssignment */ &&
+ m.kind !== 277 /* ShorthandPropertyAssignment */ &&
+ m.kind !== 187 /* BindingElement */ &&
+ m.kind !== 157 /* MethodDeclaration */ &&
+ m.kind !== 159 /* GetAccessor */ &&
+ m.kind !== 160 /* SetAccessor */) {
continue;
}
// If this is the current item we are editing right now, do not filter it out
@@ -100416,7 +101350,7 @@
var existingName = void 0;
if (ts.isBindingElement(m) && m.propertyName) {
// include only identifiers in completion list
- if (m.propertyName.kind === 72 /* Identifier */) {
+ if (m.propertyName.kind === 73 /* Identifier */) {
existingName = m.propertyName.escapedText;
}
}
@@ -100441,10 +101375,10 @@
for (var _i = 0, existingMembers_2 = existingMembers; _i < existingMembers_2.length; _i++) {
var m = existingMembers_2[_i];
// Ignore omitted expressions for missing members
- if (m.kind !== 154 /* PropertyDeclaration */ &&
- m.kind !== 156 /* MethodDeclaration */ &&
- m.kind !== 158 /* GetAccessor */ &&
- m.kind !== 159 /* SetAccessor */) {
+ if (m.kind !== 155 /* PropertyDeclaration */ &&
+ m.kind !== 157 /* MethodDeclaration */ &&
+ m.kind !== 159 /* GetAccessor */ &&
+ m.kind !== 160 /* SetAccessor */) {
continue;
}
// If this is the current item we are editing right now, do not filter it out
@@ -100484,7 +101418,7 @@
if (isCurrentlyEditingNode(attr)) {
continue;
}
- if (attr.kind === 267 /* JsxAttribute */) {
+ if (attr.kind === 268 /* JsxAttribute */) {
seenNames.set(attr.name.escapedText, true);
}
}
@@ -100504,9 +101438,9 @@
|| ts.isKnownSymbol(symbol)) {
return undefined;
}
- var validIdentiferResult = { name: name, needsConvertPropertyAccess: false };
+ var validIdentifierResult = { name: name, needsConvertPropertyAccess: false };
if (ts.isIdentifierText(name, target))
- return validIdentiferResult;
+ return validIdentifierResult;
switch (kind) {
case 3 /* MemberLike */:
return undefined;
@@ -100519,7 +101453,7 @@
return name.charCodeAt(0) === 32 /* space */ ? undefined : { name: name, needsConvertPropertyAccess: true };
case 5 /* None */:
case 4 /* String */:
- return validIdentiferResult;
+ return validIdentifierResult;
default:
ts.Debug.assertNever(kind);
}
@@ -100528,12 +101462,12 @@
var _keywordCompletions = [];
var allKeywordsCompletions = ts.memoize(function () {
var res = [];
- for (var i = 73 /* FirstKeyword */; i <= 147 /* LastKeyword */; i++) {
+ for (var i = 74 /* FirstKeyword */; i <= 148 /* LastKeyword */; i++) {
res.push({
name: ts.tokenToString(i),
kind: "keyword" /* keyword */,
kindModifiers: "" /* none */,
- sortText: "0"
+ sortText: SortText.GlobalsOrKeywords
});
}
return res;
@@ -100553,8 +101487,8 @@
case 0 /* None */:
return false;
case 1 /* All */:
- return kind === 121 /* AsyncKeyword */ || 122 /* AwaitKeyword */ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind) || kind === 125 /* DeclareKeyword */ || kind === 130 /* ModuleKeyword */
- || ts.isTypeKeyword(kind) && kind !== 141 /* UndefinedKeyword */;
+ return kind === 122 /* AsyncKeyword */ || 123 /* AwaitKeyword */ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind) || kind === 126 /* DeclareKeyword */ || kind === 131 /* ModuleKeyword */
+ || ts.isTypeKeyword(kind) && kind !== 142 /* UndefinedKeyword */;
case 2 /* ClassElementKeywords */:
return isClassMemberCompletionKeyword(kind);
case 3 /* InterfaceElementKeywords */:
@@ -100572,54 +101506,54 @@
}
function isTypeScriptOnlyKeyword(kind) {
switch (kind) {
- case 118 /* AbstractKeyword */:
- case 120 /* AnyKeyword */:
- case 146 /* BigIntKeyword */:
- case 123 /* BooleanKeyword */:
- case 125 /* DeclareKeyword */:
- case 84 /* EnumKeyword */:
- case 145 /* GlobalKeyword */:
- case 109 /* ImplementsKeyword */:
- case 127 /* InferKeyword */:
- case 110 /* InterfaceKeyword */:
- case 128 /* IsKeyword */:
- case 129 /* KeyOfKeyword */:
- case 130 /* ModuleKeyword */:
- case 131 /* NamespaceKeyword */:
- case 132 /* NeverKeyword */:
- case 135 /* NumberKeyword */:
- case 136 /* ObjectKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 115 /* PublicKeyword */:
- case 133 /* ReadonlyKeyword */:
- case 138 /* StringKeyword */:
- case 139 /* SymbolKeyword */:
- case 140 /* TypeKeyword */:
- case 142 /* UniqueKeyword */:
- case 143 /* UnknownKeyword */:
+ case 119 /* AbstractKeyword */:
+ case 121 /* AnyKeyword */:
+ case 147 /* BigIntKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 85 /* EnumKeyword */:
+ case 146 /* GlobalKeyword */:
+ case 110 /* ImplementsKeyword */:
+ case 128 /* InferKeyword */:
+ case 111 /* InterfaceKeyword */:
+ case 129 /* IsKeyword */:
+ case 130 /* KeyOfKeyword */:
+ case 131 /* ModuleKeyword */:
+ case 132 /* NamespaceKeyword */:
+ case 133 /* NeverKeyword */:
+ case 136 /* NumberKeyword */:
+ case 137 /* ObjectKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 116 /* PublicKeyword */:
+ case 134 /* ReadonlyKeyword */:
+ case 139 /* StringKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 141 /* TypeKeyword */:
+ case 143 /* UniqueKeyword */:
+ case 144 /* UnknownKeyword */:
return true;
default:
return false;
}
}
function isInterfaceOrTypeLiteralCompletionKeyword(kind) {
- return kind === 133 /* ReadonlyKeyword */;
+ return kind === 134 /* ReadonlyKeyword */;
}
function isClassMemberCompletionKeyword(kind) {
switch (kind) {
- case 118 /* AbstractKeyword */:
- case 124 /* ConstructorKeyword */:
- case 126 /* GetKeyword */:
- case 137 /* SetKeyword */:
- case 121 /* AsyncKeyword */:
+ case 119 /* AbstractKeyword */:
+ case 125 /* ConstructorKeyword */:
+ case 127 /* GetKeyword */:
+ case 138 /* SetKeyword */:
+ case 122 /* AsyncKeyword */:
return true;
default:
return ts.isClassMemberModifier(kind);
}
}
function isFunctionLikeBodyKeyword(kind) {
- return kind === 121 /* AsyncKeyword */ || kind === 122 /* AwaitKeyword */ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind);
+ return kind === 122 /* AsyncKeyword */ || kind === 123 /* AwaitKeyword */ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind);
}
function keywordForNode(node) {
return ts.isIdentifier(node) ? node.originalKeywordKind || 0 /* Unknown */ : node.kind;
@@ -100656,7 +101590,7 @@
function tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken, location) {
// class c { method() { } | method2() { } }
switch (location.kind) {
- case 311 /* SyntaxList */:
+ case 312 /* SyntaxList */:
return ts.tryCast(location.parent, ts.isObjectTypeDeclaration);
case 1 /* EndOfFileToken */:
var cls = ts.tryCast(ts.lastOrUndefined(ts.cast(location.parent, ts.isSourceFile).statements), ts.isObjectTypeDeclaration);
@@ -100765,40 +101699,40 @@
}
function getHighlightSpans(node, sourceFile) {
switch (node.kind) {
- case 91 /* IfKeyword */:
- case 83 /* ElseKeyword */:
+ case 92 /* IfKeyword */:
+ case 84 /* ElseKeyword */:
return ts.isIfStatement(node.parent) ? getIfElseOccurrences(node.parent, sourceFile) : undefined;
- case 97 /* ReturnKeyword */:
+ case 98 /* ReturnKeyword */:
return useParent(node.parent, ts.isReturnStatement, getReturnOccurrences);
- case 101 /* ThrowKeyword */:
+ case 102 /* ThrowKeyword */:
return useParent(node.parent, ts.isThrowStatement, getThrowOccurrences);
- case 103 /* TryKeyword */:
- case 75 /* CatchKeyword */:
- case 88 /* FinallyKeyword */:
- var tryStatement = node.kind === 75 /* CatchKeyword */ ? node.parent.parent : node.parent;
+ case 104 /* TryKeyword */:
+ case 76 /* CatchKeyword */:
+ case 89 /* FinallyKeyword */:
+ var tryStatement = node.kind === 76 /* CatchKeyword */ ? node.parent.parent : node.parent;
return useParent(tryStatement, ts.isTryStatement, getTryCatchFinallyOccurrences);
- case 99 /* SwitchKeyword */:
+ case 100 /* SwitchKeyword */:
return useParent(node.parent, ts.isSwitchStatement, getSwitchCaseDefaultOccurrences);
- case 74 /* CaseKeyword */:
- case 80 /* DefaultKeyword */:
+ case 75 /* CaseKeyword */:
+ case 81 /* DefaultKeyword */:
return useParent(node.parent.parent.parent, ts.isSwitchStatement, getSwitchCaseDefaultOccurrences);
- case 73 /* BreakKeyword */:
- case 78 /* ContinueKeyword */:
+ case 74 /* BreakKeyword */:
+ case 79 /* ContinueKeyword */:
return useParent(node.parent, ts.isBreakOrContinueStatement, getBreakOrContinueStatementOccurrences);
- case 89 /* ForKeyword */:
- case 107 /* WhileKeyword */:
- case 82 /* DoKeyword */:
+ case 90 /* ForKeyword */:
+ case 108 /* WhileKeyword */:
+ case 83 /* DoKeyword */:
return useParent(node.parent, function (n) { return ts.isIterationStatement(n, /*lookInLabeledStatements*/ true); }, getLoopBreakContinueOccurrences);
- case 124 /* ConstructorKeyword */:
- return getFromAllDeclarations(ts.isConstructorDeclaration, [124 /* ConstructorKeyword */]);
- case 126 /* GetKeyword */:
- case 137 /* SetKeyword */:
- return getFromAllDeclarations(ts.isAccessor, [126 /* GetKeyword */, 137 /* SetKeyword */]);
- case 122 /* AwaitKeyword */:
+ case 125 /* ConstructorKeyword */:
+ return getFromAllDeclarations(ts.isConstructorDeclaration, [125 /* ConstructorKeyword */]);
+ case 127 /* GetKeyword */:
+ case 138 /* SetKeyword */:
+ return getFromAllDeclarations(ts.isAccessor, [127 /* GetKeyword */, 138 /* SetKeyword */]);
+ case 123 /* AwaitKeyword */:
return useParent(node.parent, ts.isAwaitExpression, getAsyncAndAwaitOccurrences);
- case 121 /* AsyncKeyword */:
+ case 122 /* AsyncKeyword */:
return highlightSpans(getAsyncAndAwaitOccurrences(node));
- case 117 /* YieldKeyword */:
+ case 118 /* YieldKeyword */:
return highlightSpans(getYieldOccurrences(node));
default:
return ts.isModifierKind(node.kind) && (ts.isDeclaration(node.parent) || ts.isVariableStatement(node.parent))
@@ -100841,7 +101775,7 @@
var child = throwStatement;
while (child.parent) {
var parent = child.parent;
- if (ts.isFunctionBlock(parent) || parent.kind === 284 /* SourceFile */) {
+ if (ts.isFunctionBlock(parent) || parent.kind === 285 /* SourceFile */) {
return parent;
}
// A throw-statement is only owned by a try-statement if the try-statement has
@@ -100873,16 +101807,16 @@
function getBreakOrContinueOwner(statement) {
return ts.findAncestor(statement, function (node) {
switch (node.kind) {
- case 232 /* SwitchStatement */:
- if (statement.kind === 228 /* ContinueStatement */) {
+ case 233 /* SwitchStatement */:
+ if (statement.kind === 229 /* ContinueStatement */) {
return false;
}
// falls through
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 224 /* WhileStatement */:
- case 223 /* DoStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 225 /* WhileStatement */:
+ case 224 /* DoStatement */:
return !statement.label || isLabeledBy(node, statement.label.escapedText);
default:
// Don't cross function boundaries.
@@ -100898,11 +101832,11 @@
// Types of node whose children might have modifiers.
var container = declaration.parent;
switch (container.kind) {
- case 245 /* ModuleBlock */:
- case 284 /* SourceFile */:
- case 218 /* Block */:
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
+ case 246 /* ModuleBlock */:
+ case 285 /* SourceFile */:
+ case 219 /* Block */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
// Container is either a class declaration or the declaration is a classDeclaration
if (modifierFlag & 128 /* Abstract */ && ts.isClassDeclaration(declaration)) {
return declaration.members.concat([declaration]);
@@ -100910,12 +101844,12 @@
else {
return container.statements;
}
- case 157 /* Constructor */:
- case 156 /* MethodDeclaration */:
- case 239 /* FunctionDeclaration */:
+ case 158 /* Constructor */:
+ case 157 /* MethodDeclaration */:
+ case 240 /* FunctionDeclaration */:
return container.parameters.concat((ts.isClassLike(container.parent) ? container.parent.members : []));
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
var nodes = container.members;
// If we're an accessibility modifier, we're in an instance member and should search
// the constructor's parameter list for instance members as well.
@@ -100946,12 +101880,12 @@
}
function getLoopBreakContinueOccurrences(loopNode) {
var keywords = [];
- if (pushKeywordIf(keywords, loopNode.getFirstToken(), 89 /* ForKeyword */, 107 /* WhileKeyword */, 82 /* DoKeyword */)) {
+ if (pushKeywordIf(keywords, loopNode.getFirstToken(), 90 /* ForKeyword */, 108 /* WhileKeyword */, 83 /* DoKeyword */)) {
// If we succeeded and got a do-while loop, then start looking for a 'while' keyword.
- if (loopNode.kind === 223 /* DoStatement */) {
+ if (loopNode.kind === 224 /* DoStatement */) {
var loopTokens = loopNode.getChildren();
for (var i = loopTokens.length - 1; i >= 0; i--) {
- if (pushKeywordIf(keywords, loopTokens[i], 107 /* WhileKeyword */)) {
+ if (pushKeywordIf(keywords, loopTokens[i], 108 /* WhileKeyword */)) {
break;
}
}
@@ -100959,7 +101893,7 @@
}
ts.forEach(aggregateAllBreakAndContinueStatements(loopNode.statement), function (statement) {
if (ownsBreakOrContinueStatement(loopNode, statement)) {
- pushKeywordIf(keywords, statement.getFirstToken(), 73 /* BreakKeyword */, 78 /* ContinueKeyword */);
+ pushKeywordIf(keywords, statement.getFirstToken(), 74 /* BreakKeyword */, 79 /* ContinueKeyword */);
}
});
return keywords;
@@ -100968,13 +101902,13 @@
var owner = getBreakOrContinueOwner(breakOrContinueStatement);
if (owner) {
switch (owner.kind) {
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
return getLoopBreakContinueOccurrences(owner);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return getSwitchCaseDefaultOccurrences(owner);
}
}
@@ -100982,13 +101916,13 @@
}
function getSwitchCaseDefaultOccurrences(switchStatement) {
var keywords = [];
- pushKeywordIf(keywords, switchStatement.getFirstToken(), 99 /* SwitchKeyword */);
+ pushKeywordIf(keywords, switchStatement.getFirstToken(), 100 /* SwitchKeyword */);
// Go through each clause in the switch statement, collecting the 'case'/'default' keywords.
ts.forEach(switchStatement.caseBlock.clauses, function (clause) {
- pushKeywordIf(keywords, clause.getFirstToken(), 74 /* CaseKeyword */, 80 /* DefaultKeyword */);
+ pushKeywordIf(keywords, clause.getFirstToken(), 75 /* CaseKeyword */, 81 /* DefaultKeyword */);
ts.forEach(aggregateAllBreakAndContinueStatements(clause), function (statement) {
if (ownsBreakOrContinueStatement(switchStatement, statement)) {
- pushKeywordIf(keywords, statement.getFirstToken(), 73 /* BreakKeyword */);
+ pushKeywordIf(keywords, statement.getFirstToken(), 74 /* BreakKeyword */);
}
});
});
@@ -100996,13 +101930,13 @@
}
function getTryCatchFinallyOccurrences(tryStatement, sourceFile) {
var keywords = [];
- pushKeywordIf(keywords, tryStatement.getFirstToken(), 103 /* TryKeyword */);
+ pushKeywordIf(keywords, tryStatement.getFirstToken(), 104 /* TryKeyword */);
if (tryStatement.catchClause) {
- pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 75 /* CatchKeyword */);
+ pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 76 /* CatchKeyword */);
}
if (tryStatement.finallyBlock) {
- var finallyKeyword = ts.findChildOfKind(tryStatement, 88 /* FinallyKeyword */, sourceFile);
- pushKeywordIf(keywords, finallyKeyword, 88 /* FinallyKeyword */);
+ var finallyKeyword = ts.findChildOfKind(tryStatement, 89 /* FinallyKeyword */, sourceFile);
+ pushKeywordIf(keywords, finallyKeyword, 89 /* FinallyKeyword */);
}
return keywords;
}
@@ -101013,13 +101947,13 @@
}
var keywords = [];
ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) {
- keywords.push(ts.findChildOfKind(throwStatement, 101 /* ThrowKeyword */, sourceFile));
+ keywords.push(ts.findChildOfKind(throwStatement, 102 /* ThrowKeyword */, sourceFile));
});
// If the "owner" is a function, then we equate 'return' and 'throw' statements in their
// ability to "jump out" of the function, and include occurrences for both.
if (ts.isFunctionBlock(owner)) {
ts.forEachReturnStatement(owner, function (returnStatement) {
- keywords.push(ts.findChildOfKind(returnStatement, 97 /* ReturnKeyword */, sourceFile));
+ keywords.push(ts.findChildOfKind(returnStatement, 98 /* ReturnKeyword */, sourceFile));
});
}
return keywords;
@@ -101031,11 +101965,11 @@
}
var keywords = [];
ts.forEachReturnStatement(ts.cast(func.body, ts.isBlock), function (returnStatement) {
- keywords.push(ts.findChildOfKind(returnStatement, 97 /* ReturnKeyword */, sourceFile));
+ keywords.push(ts.findChildOfKind(returnStatement, 98 /* ReturnKeyword */, sourceFile));
});
// Include 'throw' statements that do not occur within a try block.
ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) {
- keywords.push(ts.findChildOfKind(throwStatement, 101 /* ThrowKeyword */, sourceFile));
+ keywords.push(ts.findChildOfKind(throwStatement, 102 /* ThrowKeyword */, sourceFile));
});
return keywords;
}
@@ -101047,13 +101981,13 @@
var keywords = [];
if (func.modifiers) {
func.modifiers.forEach(function (modifier) {
- pushKeywordIf(keywords, modifier, 121 /* AsyncKeyword */);
+ pushKeywordIf(keywords, modifier, 122 /* AsyncKeyword */);
});
}
ts.forEachChild(func, function (child) {
traverseWithoutCrossingFunction(child, function (node) {
if (ts.isAwaitExpression(node)) {
- pushKeywordIf(keywords, node.getFirstToken(), 122 /* AwaitKeyword */);
+ pushKeywordIf(keywords, node.getFirstToken(), 123 /* AwaitKeyword */);
}
});
});
@@ -101068,7 +102002,7 @@
ts.forEachChild(func, function (child) {
traverseWithoutCrossingFunction(child, function (node) {
if (ts.isYieldExpression(node)) {
- pushKeywordIf(keywords, node.getFirstToken(), 117 /* YieldKeyword */);
+ pushKeywordIf(keywords, node.getFirstToken(), 118 /* YieldKeyword */);
}
});
});
@@ -101087,7 +102021,7 @@
// We'd like to highlight else/ifs together if they are only separated by whitespace
// (i.e. the keywords are separated by no comments, no newlines).
for (var i = 0; i < keywords.length; i++) {
- if (keywords[i].kind === 83 /* ElseKeyword */ && i < keywords.length - 1) {
+ if (keywords[i].kind === 84 /* ElseKeyword */ && i < keywords.length - 1) {
var elseKeyword = keywords[i];
var ifKeyword = keywords[i + 1]; // this *should* always be an 'if' keyword.
var shouldCombineElseAndIf = true;
@@ -101122,10 +102056,10 @@
// Now traverse back down through the else branches, aggregating if/else keywords of if-statements.
while (true) {
var children = ifStatement.getChildren(sourceFile);
- pushKeywordIf(keywords, children[0], 91 /* IfKeyword */);
+ pushKeywordIf(keywords, children[0], 92 /* IfKeyword */);
// Generally the 'else' keyword is second-to-last, so we traverse backwards.
for (var i = children.length - 1; i >= 0; i--) {
- if (pushKeywordIf(keywords, children[i], 83 /* ElseKeyword */)) {
+ if (pushKeywordIf(keywords, children[i], 84 /* ElseKeyword */)) {
break;
}
}
@@ -101341,12 +102275,12 @@
if (cancellationToken)
cancellationToken.throwIfCancellationRequested();
switch (direct.kind) {
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
if (!isAvailableThroughGlobal) {
var parent = direct.parent;
- if (exportKind === 2 /* ExportEquals */ && parent.kind === 237 /* VariableDeclaration */) {
+ if (exportKind === 2 /* ExportEquals */ && parent.kind === 238 /* VariableDeclaration */) {
var name = parent.name;
- if (name.kind === 72 /* Identifier */) {
+ if (name.kind === 73 /* Identifier */) {
directImports.push(name);
break;
}
@@ -101355,22 +102289,22 @@
addIndirectUser(direct.getSourceFile());
}
break;
- case 72 /* Identifier */: // for 'const x = require("y");
+ case 73 /* Identifier */: // for 'const x = require("y");
break; // TODO: GH#23879
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
handleNamespaceImport(direct, direct.name, ts.hasModifier(direct, 1 /* Export */), /*alreadyAddedDirect*/ false);
break;
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
directImports.push(direct);
var namedBindings = direct.importClause && direct.importClause.namedBindings;
- if (namedBindings && namedBindings.kind === 251 /* NamespaceImport */) {
+ if (namedBindings && namedBindings.kind === 252 /* NamespaceImport */) {
handleNamespaceImport(direct, namedBindings.name, /*isReExport*/ false, /*alreadyAddedDirect*/ true);
}
else if (!isAvailableThroughGlobal && ts.isDefaultImport(direct)) {
addIndirectUser(getSourceFileLikeForImportDeclaration(direct)); // Add a check for indirect uses to handle synthetic default imports
}
break;
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
if (!direct.exportClause) {
// This is `export * from "foo"`, so imports of this module may import the export too.
handleDirectImports(getContainingModuleSymbol(direct, checker));
@@ -101380,11 +102314,11 @@
directImports.push(direct);
}
break;
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
directImports.push(direct);
break;
default:
- ts.Debug.assertNever(direct, "Unexpected import kind: " + ts.Debug.showSyntaxKind(direct));
+ ts.Debug.failBadSyntaxKind(direct, "Unexpected import kind.");
}
}
}
@@ -101397,7 +102331,7 @@
}
else if (!isAvailableThroughGlobal) {
var sourceFileLike = getSourceFileLikeForImportDeclaration(importDeclaration);
- ts.Debug.assert(sourceFileLike.kind === 284 /* SourceFile */ || sourceFileLike.kind === 244 /* ModuleDeclaration */);
+ ts.Debug.assert(sourceFileLike.kind === 285 /* SourceFile */ || sourceFileLike.kind === 245 /* ModuleDeclaration */);
if (isReExport || findNamespaceReExports(sourceFileLike, name, checker)) {
addIndirectUsers(sourceFileLike);
}
@@ -101452,17 +102386,17 @@
}
return { importSearches: importSearches, singleReferences: singleReferences };
function handleImport(decl) {
- if (decl.kind === 248 /* ImportEqualsDeclaration */) {
+ if (decl.kind === 249 /* ImportEqualsDeclaration */) {
if (isExternalModuleImportEquals(decl)) {
handleNamespaceImportLike(decl.name);
}
return;
}
- if (decl.kind === 72 /* Identifier */) {
+ if (decl.kind === 73 /* Identifier */) {
handleNamespaceImportLike(decl);
return;
}
- if (decl.kind === 183 /* ImportType */) {
+ if (decl.kind === 184 /* ImportType */) {
if (decl.qualifier) {
if (ts.isIdentifier(decl.qualifier) && decl.qualifier.escapedText === ts.symbolName(exportSymbol)) {
singleReferences.push(decl.qualifier);
@@ -101477,17 +102411,17 @@
if (decl.moduleSpecifier.kind !== 10 /* StringLiteral */) {
return;
}
- if (decl.kind === 255 /* ExportDeclaration */) {
+ if (decl.kind === 256 /* ExportDeclaration */) {
searchForNamedImport(decl.exportClause);
return;
}
var _a = decl.importClause || { name: undefined, namedBindings: undefined }, name = _a.name, namedBindings = _a.namedBindings;
if (namedBindings) {
switch (namedBindings.kind) {
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
handleNamespaceImportLike(namedBindings.name);
break;
- case 252 /* NamedImports */:
+ case 253 /* NamedImports */:
// 'default' might be accessed as a named import `{ default as foo }`.
if (exportKind === 0 /* Named */ || exportKind === 1 /* Default */) {
searchForNamedImport(namedBindings);
@@ -101537,7 +102471,7 @@
}
}
else {
- var localSymbol = element.kind === 257 /* ExportSpecifier */ && element.propertyName
+ var localSymbol = element.kind === 258 /* ExportSpecifier */ && element.propertyName
? checker.getExportSpecifierLocalTargetSymbol(element) // For re-exporting under a different name, we want to get the re-exported symbol.
: checker.getSymbolAtLocation(name);
addSearch(name, localSymbol);
@@ -101566,7 +102500,7 @@
for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) {
var referencingFile = sourceFiles_1[_i];
var searchSourceFile = searchModuleSymbol.valueDeclaration;
- if (searchSourceFile.kind === 284 /* SourceFile */) {
+ if (searchSourceFile.kind === 285 /* SourceFile */) {
for (var _a = 0, _b = referencingFile.referencedFiles; _a < _b.length; _a++) {
var ref = _b[_a];
if (program.getSourceFileFromReference(referencingFile, ref) === searchSourceFile) {
@@ -101614,7 +102548,7 @@
}
/** Iterates over all statements at the top level or in module declarations. Returns the first truthy result. */
function forEachPossibleImportOrExportStatement(sourceFileLike, action) {
- return ts.forEach(sourceFileLike.kind === 284 /* SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) {
+ return ts.forEach(sourceFileLike.kind === 285 /* SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) {
return action(statement) || (isAmbientModuleDeclaration(statement) && ts.forEach(statement.body && statement.body.statements, action));
});
}
@@ -101629,15 +102563,15 @@
else {
forEachPossibleImportOrExportStatement(sourceFile, function (statement) {
switch (statement.kind) {
- case 255 /* ExportDeclaration */:
- case 249 /* ImportDeclaration */: {
+ case 256 /* ExportDeclaration */:
+ case 250 /* ImportDeclaration */: {
var decl = statement;
if (decl.moduleSpecifier && ts.isStringLiteral(decl.moduleSpecifier)) {
action(decl, decl.moduleSpecifier);
}
break;
}
- case 248 /* ImportEqualsDeclaration */: {
+ case 249 /* ImportEqualsDeclaration */: {
var decl = statement;
if (isExternalModuleImportEquals(decl)) {
action(decl, decl.moduleReference.expression);
@@ -101661,7 +102595,7 @@
var parent = node.parent;
var grandParent = parent.parent;
if (symbol.exportSymbol) {
- if (parent.kind === 189 /* PropertyAccessExpression */) {
+ if (parent.kind === 190 /* PropertyAccessExpression */) {
// When accessing an export of a JS module, there's no alias. The symbol will still be flagged as an export even though we're at the use.
// So check that we are at the declaration.
return symbol.declarations.some(function (d) { return d === parent; }) && ts.isBinaryExpression(grandParent)
@@ -101727,7 +102661,7 @@
var sym = useLhsSymbol ? checker.getSymbolAtLocation(ts.cast(node.left, ts.isPropertyAccessExpression).name) : symbol;
// Better detection for GH#20803
if (sym && !(checker.getMergedSymbol(sym.parent).flags & 1536 /* Module */)) {
- ts.Debug.fail("Special property assignment kind does not have a module as its parent. Assignment is " + ts.Debug.showSymbol(sym) + ", parent is " + ts.Debug.showSymbol(sym.parent));
+ ts.Debug.fail("Special property assignment kind does not have a module as its parent. Assignment is " + ts.Debug.formatSymbol(sym) + ", parent is " + ts.Debug.formatSymbol(sym.parent));
}
return sym && exportInfo(sym, kind);
}
@@ -101783,10 +102717,10 @@
// If a reference is a class expression, the exported node would be its parent.
// If a reference is a variable declaration, the exported node would be the variable statement.
function getExportNode(parent, node) {
- if (parent.kind === 237 /* VariableDeclaration */) {
+ if (parent.kind === 238 /* VariableDeclaration */) {
var p = parent;
return p.name !== node ? undefined :
- p.parent.kind === 274 /* CatchClause */ ? undefined : p.parent.parent.kind === 219 /* VariableStatement */ ? p.parent.parent : undefined;
+ p.parent.kind === 275 /* CatchClause */ ? undefined : p.parent.parent.kind === 220 /* VariableStatement */ ? p.parent.parent : undefined;
}
else {
return parent;
@@ -101795,13 +102729,13 @@
function isNodeImport(node) {
var parent = node.parent;
switch (parent.kind) {
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return parent.name === node && isExternalModuleImportEquals(parent);
- case 253 /* ImportSpecifier */:
+ case 254 /* ImportSpecifier */:
// For a rename import `{ foo as bar }`, don't search for the imported symbol. Just find local uses of `bar`.
return !parent.propertyName;
- case 250 /* ImportClause */:
- case 251 /* NamespaceImport */:
+ case 251 /* ImportClause */:
+ case 252 /* NamespaceImport */:
ts.Debug.assert(parent.name === node);
return true;
default:
@@ -101834,21 +102768,21 @@
return checker.getMergedSymbol(getSourceFileLikeForImportDeclaration(importer).symbol);
}
function getSourceFileLikeForImportDeclaration(node) {
- if (node.kind === 191 /* CallExpression */) {
+ if (node.kind === 192 /* CallExpression */) {
return node.getSourceFile();
}
var parent = node.parent;
- if (parent.kind === 284 /* SourceFile */) {
+ if (parent.kind === 285 /* SourceFile */) {
return parent;
}
- ts.Debug.assert(parent.kind === 245 /* ModuleBlock */);
+ ts.Debug.assert(parent.kind === 246 /* ModuleBlock */);
return ts.cast(parent.parent, isAmbientModuleDeclaration);
}
function isAmbientModuleDeclaration(node) {
- return node.kind === 244 /* ModuleDeclaration */ && node.name.kind === 10 /* StringLiteral */;
+ return node.kind === 245 /* ModuleDeclaration */ && node.name.kind === 10 /* StringLiteral */;
}
function isExternalModuleImportEquals(eq) {
- return eq.moduleReference.kind === 259 /* ExternalModuleReference */ && eq.moduleReference.expression.kind === 10 /* StringLiteral */;
+ return eq.moduleReference.kind === 260 /* ExternalModuleReference */ && eq.moduleReference.expression.kind === 10 /* StringLiteral */;
}
})(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {}));
})(ts || (ts = {}));
@@ -101900,18 +102834,18 @@
}
FindAllReferences.getImplementationsAtPosition = getImplementationsAtPosition;
function getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node, position) {
- if (node.kind === 284 /* SourceFile */) {
+ if (node.kind === 285 /* SourceFile */) {
return undefined;
}
var checker = program.getTypeChecker();
// If invoked directly on a shorthand property assignment, then return
// the declaration of the symbol being assigned (not the symbol being assigned to).
- if (node.parent.kind === 276 /* ShorthandPropertyAssignment */) {
+ if (node.parent.kind === 277 /* ShorthandPropertyAssignment */) {
var result_1 = [];
FindAllReferences.Core.getReferenceEntriesForShorthandPropertyAssignment(node, checker, function (node) { return result_1.push(nodeEntry(node)); });
return result_1;
}
- else if (node.kind === 98 /* SuperKeyword */ || ts.isSuperProperty(node.parent)) {
+ else if (node.kind === 99 /* SuperKeyword */ || ts.isSuperProperty(node.parent)) {
// References to and accesses on the super keyword only have one possible implementation, so no
// need to "Find all References"
var symbol = checker.getSymbolAtLocation(node);
@@ -101991,7 +102925,7 @@
textSpan: textSpan,
fileName: fileName,
isWriteAccess: isWriteAccessForReference(node),
- isDefinition: node.kind === 80 /* DefaultKeyword */
+ isDefinition: node.kind === 81 /* DefaultKeyword */
|| !!ts.getDeclarationFromName(node)
|| ts.isLiteralComputedPropertyDeclarationName(node),
isInString: kind === 2 /* StringLiteral */ ? true : undefined,
@@ -102048,13 +102982,13 @@
if (symbol) {
return getDefinitionKindAndDisplayParts(symbol, checker, node);
}
- else if (node.kind === 188 /* ObjectLiteralExpression */) {
+ else if (node.kind === 189 /* ObjectLiteralExpression */) {
return {
kind: "interface" /* interfaceElement */,
displayParts: [ts.punctuationPart(20 /* OpenParenToken */), ts.textPart("object literal"), ts.punctuationPart(21 /* CloseParenToken */)]
};
}
- else if (node.kind === 209 /* ClassExpression */) {
+ else if (node.kind === 210 /* ClassExpression */) {
return {
kind: "local class" /* localClassElement */,
displayParts: [ts.punctuationPart(20 /* OpenParenToken */), ts.textPart("anonymous local class"), ts.punctuationPart(21 /* CloseParenToken */)]
@@ -102097,7 +103031,7 @@
/** A node is considered a writeAccess iff it is a name of a declaration or a target of an assignment */
function isWriteAccessForReference(node) {
var decl = ts.getDeclarationFromName(node);
- return !!decl && declarationIsWriteAccess(decl) || node.kind === 80 /* DefaultKeyword */ || ts.isWriteAccess(node);
+ return !!decl && declarationIsWriteAccess(decl) || node.kind === 81 /* DefaultKeyword */ || ts.isWriteAccess(node);
}
/**
* True if 'decl' provides a value, as in `function f() {}`;
@@ -102108,46 +103042,46 @@
if (!!(decl.flags & 4194304 /* Ambient */))
return true;
switch (decl.kind) {
- case 204 /* BinaryExpression */:
- case 186 /* BindingElement */:
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 80 /* DefaultKeyword */:
- case 243 /* EnumDeclaration */:
- case 278 /* EnumMember */:
- case 257 /* ExportSpecifier */:
- case 250 /* ImportClause */: // default import
- case 248 /* ImportEqualsDeclaration */:
- case 253 /* ImportSpecifier */:
- case 241 /* InterfaceDeclaration */:
- case 302 /* JSDocCallbackTag */:
- case 309 /* JSDocTypedefTag */:
- case 267 /* JsxAttribute */:
- case 244 /* ModuleDeclaration */:
- case 247 /* NamespaceExportDeclaration */:
- case 251 /* NamespaceImport */:
- case 151 /* Parameter */:
- case 276 /* ShorthandPropertyAssignment */:
- case 242 /* TypeAliasDeclaration */:
- case 150 /* TypeParameter */:
+ case 205 /* BinaryExpression */:
+ case 187 /* BindingElement */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 81 /* DefaultKeyword */:
+ case 244 /* EnumDeclaration */:
+ case 279 /* EnumMember */:
+ case 258 /* ExportSpecifier */:
+ case 251 /* ImportClause */: // default import
+ case 249 /* ImportEqualsDeclaration */:
+ case 254 /* ImportSpecifier */:
+ case 242 /* InterfaceDeclaration */:
+ case 303 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 268 /* JsxAttribute */:
+ case 245 /* ModuleDeclaration */:
+ case 248 /* NamespaceExportDeclaration */:
+ case 252 /* NamespaceImport */:
+ case 152 /* Parameter */:
+ case 277 /* ShorthandPropertyAssignment */:
+ case 243 /* TypeAliasDeclaration */:
+ case 151 /* TypeParameter */:
return true;
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
// In `({ x: y } = 0);`, `x` is not a write access. (Won't call this function for `y`.)
return !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(decl.parent);
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 157 /* Constructor */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 158 /* Constructor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return !!decl.body;
- case 237 /* VariableDeclaration */:
- case 154 /* PropertyDeclaration */:
+ case 238 /* VariableDeclaration */:
+ case 155 /* PropertyDeclaration */:
return !!decl.initializer || ts.isCatchClause(decl.parent);
- case 155 /* MethodSignature */:
- case 153 /* PropertySignature */:
- case 310 /* JSDocPropertyTag */:
- case 304 /* JSDocParameterTag */:
+ case 156 /* MethodSignature */:
+ case 154 /* PropertySignature */:
+ case 311 /* JSDocPropertyTag */:
+ case 305 /* JSDocParameterTag */:
return false;
default:
return ts.Debug.failBadSyntaxKind(decl);
@@ -102307,10 +103241,10 @@
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var decl = _a[_i];
switch (decl.kind) {
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
// Don't include the source file itself. (This may not be ideal behavior, but awkward to include an entire file as a reference.)
break;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
if (sourceFilesSet.has(decl.getSourceFile().fileName)) {
references.push(FindAllReferences.nodeEntry(decl.name));
}
@@ -102330,7 +103264,7 @@
var node = ts.isBinaryExpression(decl) && ts.isPropertyAccessExpression(decl.left)
? decl.left.expression
: ts.isExportAssignment(decl)
- ? ts.Debug.assertDefined(ts.findChildOfKind(decl, 85 /* ExportKeyword */, sourceFile))
+ ? ts.Debug.assertDefined(ts.findChildOfKind(decl, 86 /* ExportKeyword */, sourceFile))
: ts.getNameOfDeclaration(decl) || decl;
references.push(FindAllReferences.nodeEntry(node));
}
@@ -102357,7 +103291,7 @@
if (ts.isThis(node)) {
return getReferencesForThisKeyword(node, sourceFiles, cancellationToken);
}
- if (node.kind === 98 /* SuperKeyword */) {
+ if (node.kind === 99 /* SuperKeyword */) {
return getReferencesForSuperKeyword(node);
}
return undefined;
@@ -102374,7 +103308,7 @@
// When renaming at an export specifier, rename the export and not the thing being exported.
getReferencesAtExportSpecifier(exportSpecifier.name, symbol, exportSpecifier, state.createSearch(node, originalSymbol, /*comingFrom*/ undefined), state, /*addReferencesHere*/ true, /*alwaysGetReferences*/ true);
}
- else if (node && node.kind === 80 /* DefaultKeyword */) {
+ else if (node && node.kind === 81 /* DefaultKeyword */) {
addReference(node, symbol, state);
searchForImportsOfExport(node, symbol, { exportingModuleSymbol: ts.Debug.assertDefined(symbol.parent, "Expected export symbol to have a parent"), exportKind: 1 /* Default */ }, state);
}
@@ -102402,9 +103336,9 @@
}
function getSpecialSearchKind(node) {
switch (node.kind) {
- case 124 /* ConstructorKeyword */:
+ case 125 /* ConstructorKeyword */:
return 1 /* Constructor */;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
if (ts.isClassLike(node.parent)) {
ts.Debug.assert(node.parent.name === node);
return 2 /* Class */;
@@ -102427,7 +103361,7 @@
if (symbol.flags & 33554432 /* Transient */)
return undefined;
// Assertions for GH#21814. We should be handling SourceFile symbols in `getReferencedSymbolsForModule` instead of getting here.
- ts.Debug.fail("Unexpected symbol at " + ts.Debug.showSyntaxKind(node) + ": " + ts.Debug.showSymbol(symbol));
+ ts.Debug.fail("Unexpected symbol at " + ts.Debug.formatSyntaxKind(node.kind) + ": " + ts.Debug.formatSymbol(symbol));
}
return ts.isTypeLiteralNode(decl.parent) && ts.isUnionTypeNode(decl.parent.parent)
? checker.getPropertyOfType(checker.getTypeFromTypeNode(decl.parent.parent), symbol.name)
@@ -102532,8 +103466,8 @@
var sourceId = ts.getNodeId(sourceFile);
var seenSymbols = this.sourceFileToSeenSymbols[sourceId] || (this.sourceFileToSeenSymbols[sourceId] = ts.createMap());
var anyNewSymbols = false;
- for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) {
- var sym = symbols_2[_i];
+ for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) {
+ var sym = symbols_3[_i];
anyNewSymbols = ts.addToSeen(seenSymbols, ts.getSymbolId(sym)) || anyNewSymbols;
}
return anyNewSymbols;
@@ -102640,7 +103574,7 @@
// If this is the symbol of a named function expression or named class expression,
// then named references are limited to its own scope.
var declarations = symbol.declarations, flags = symbol.flags, parent = symbol.parent, valueDeclaration = symbol.valueDeclaration;
- if (valueDeclaration && (valueDeclaration.kind === 196 /* FunctionExpression */ || valueDeclaration.kind === 209 /* ClassExpression */)) {
+ if (valueDeclaration && (valueDeclaration.kind === 197 /* FunctionExpression */ || valueDeclaration.kind === 210 /* ClassExpression */)) {
return valueDeclaration;
}
if (!declarations) {
@@ -102650,7 +103584,7 @@
if (flags & (4 /* Property */ | 8192 /* Method */)) {
var privateDeclaration = ts.find(declarations, function (d) { return ts.hasModifier(d, 8 /* Private */); });
if (privateDeclaration) {
- return ts.getAncestor(privateDeclaration, 240 /* ClassDeclaration */);
+ return ts.getAncestor(privateDeclaration, 241 /* ClassDeclaration */);
}
// Else this is a public property and could be accessed from anywhere.
return undefined;
@@ -102679,7 +103613,7 @@
// Different declarations have different containers, bail out
return undefined;
}
- if (!container || container.kind === 284 /* SourceFile */ && !ts.isExternalOrCommonJsModule(container)) {
+ if (!container || container.kind === 285 /* SourceFile */ && !ts.isExternalOrCommonJsModule(container)) {
// This is a global variable and not an external module, any declaration defined
// within this scope is visible outside the file
return undefined;
@@ -102766,8 +103700,8 @@
// We found a match. Make sure it's not part of a larger word (i.e. the char
// before and after it have to be a non-identifier char).
var endPosition = position + symbolNameLength;
- if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 7 /* Latest */)) &&
- (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 7 /* Latest */))) {
+ if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 8 /* Latest */)) &&
+ (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 8 /* Latest */))) {
// Found a real match. Keep searching.
positions.push(position);
}
@@ -102787,7 +103721,7 @@
function isValidReferencePosition(node, searchSymbolName) {
// Compare the length so we filter out strict superstrings of the symbol we are looking for
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return node.text.length === searchSymbolName.length;
case 10 /* StringLiteral */: {
var str = node;
@@ -102796,7 +103730,7 @@
}
case 8 /* NumericLiteral */:
return ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && node.text.length === searchSymbolName.length;
- case 80 /* DefaultKeyword */:
+ case 81 /* DefaultKeyword */:
return "default".length === searchSymbolName.length;
default:
return false;
@@ -102860,7 +103794,7 @@
return;
}
if (ts.isExportSpecifier(parent)) {
- ts.Debug.assert(referenceLocation.kind === 72 /* Identifier */);
+ ts.Debug.assert(referenceLocation.kind === 73 /* Identifier */);
getReferencesAtExportSpecifier(referenceLocation, referenceSymbol, parent, search, state, addReferencesHere);
return;
}
@@ -102916,8 +103850,8 @@
}
// For `export { foo as bar }`, rename `foo`, but not `bar`.
if (!isForRenameWithPrefixAndSuffixText(state.options) || alwaysGetReferences) {
- var isDefaultExport = referenceLocation.originalKeywordKind === 80 /* DefaultKeyword */
- || exportSpecifier.name.originalKeywordKind === 80 /* DefaultKeyword */;
+ var isDefaultExport = referenceLocation.originalKeywordKind === 81 /* DefaultKeyword */
+ || exportSpecifier.name.originalKeywordKind === 81 /* DefaultKeyword */;
var exportKind = isDefaultExport ? 1 /* Default */ : 0 /* Named */;
var exportSymbol = ts.Debug.assertDefined(exportSpecifier.symbol);
var exportInfo = ts.Debug.assertDefined(FindAllReferences.getExportInfo(exportSymbol, exportKind, state.checker));
@@ -102996,7 +103930,7 @@
}
var pusher = function () { return state.referenceAdder(search.symbol); };
if (ts.isClassLike(referenceLocation.parent)) {
- ts.Debug.assert(referenceLocation.kind === 80 /* DefaultKeyword */ || referenceLocation.parent.name === referenceLocation);
+ ts.Debug.assert(referenceLocation.kind === 81 /* DefaultKeyword */ || referenceLocation.parent.name === referenceLocation);
// This is the class declaration containing the constructor.
findOwnConstructorReferences(search.symbol, sourceFile, pusher());
}
@@ -103023,7 +103957,7 @@
}
if (member.body) {
member.body.forEachChild(function cb(node) {
- if (node.kind === 100 /* ThisKeyword */) {
+ if (node.kind === 101 /* ThisKeyword */) {
addRef(node);
}
else if (!ts.isFunctionLike(node) && !ts.isClassLike(node)) {
@@ -103042,18 +103976,18 @@
if (constructorSymbol) {
for (var _i = 0, _a = constructorSymbol.declarations; _i < _a.length; _i++) {
var decl = _a[_i];
- var ctrKeyword = ts.findChildOfKind(decl, 124 /* ConstructorKeyword */, sourceFile);
- ts.Debug.assert(decl.kind === 157 /* Constructor */ && !!ctrKeyword);
+ var ctrKeyword = ts.findChildOfKind(decl, 125 /* ConstructorKeyword */, sourceFile);
+ ts.Debug.assert(decl.kind === 158 /* Constructor */ && !!ctrKeyword);
addNode(ctrKeyword);
}
}
if (classSymbol.exports) {
classSymbol.exports.forEach(function (member) {
var decl = member.valueDeclaration;
- if (decl && decl.kind === 156 /* MethodDeclaration */) {
+ if (decl && decl.kind === 157 /* MethodDeclaration */) {
var body = decl.body;
if (body) {
- forEachDescendantOfKind(body, 100 /* ThisKeyword */, function (thisKeyword) {
+ forEachDescendantOfKind(body, 101 /* ThisKeyword */, function (thisKeyword) {
if (ts.isNewExpressionTarget(thisKeyword)) {
addNode(thisKeyword);
}
@@ -103074,10 +104008,10 @@
}
for (var _i = 0, _a = constructor.declarations; _i < _a.length; _i++) {
var decl = _a[_i];
- ts.Debug.assert(decl.kind === 157 /* Constructor */);
+ ts.Debug.assert(decl.kind === 158 /* Constructor */);
var body = decl.body;
if (body) {
- forEachDescendantOfKind(body, 98 /* SuperKeyword */, function (node) {
+ forEachDescendantOfKind(body, 99 /* SuperKeyword */, function (node) {
if (ts.isCallExpressionTarget(node)) {
addNode(node);
}
@@ -103101,10 +104035,10 @@
addReference(refNode);
return;
}
- if (refNode.kind !== 72 /* Identifier */) {
+ if (refNode.kind !== 73 /* Identifier */) {
return;
}
- if (refNode.parent.kind === 276 /* ShorthandPropertyAssignment */) {
+ if (refNode.parent.kind === 277 /* ShorthandPropertyAssignment */) {
// Go ahead and dereference the shorthand assignment by going to its definition
getReferenceEntriesForShorthandPropertyAssignment(refNode, state.checker, addReference);
}
@@ -103124,7 +104058,7 @@
}
else if (ts.isFunctionLike(typeHavingNode) && typeHavingNode.body) {
var body = typeHavingNode.body;
- if (body.kind === 218 /* Block */) {
+ if (body.kind === 219 /* Block */) {
ts.forEachReturnStatement(body, function (returnStatement) {
if (returnStatement.expression)
addIfImplementation(returnStatement.expression);
@@ -103152,13 +104086,13 @@
*/
function isImplementationExpression(node) {
switch (node.kind) {
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return isImplementationExpression(node.expression);
- case 197 /* ArrowFunction */:
- case 196 /* FunctionExpression */:
- case 188 /* ObjectLiteralExpression */:
- case 209 /* ClassExpression */:
- case 187 /* ArrayLiteralExpression */:
+ case 198 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
+ case 189 /* ObjectLiteralExpression */:
+ case 210 /* ClassExpression */:
+ case 188 /* ArrayLiteralExpression */:
return true;
default:
return false;
@@ -103211,13 +104145,13 @@
// Whether 'super' occurs in a static context within a class.
var staticFlag = 32 /* Static */;
switch (searchSpaceNode.kind) {
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
staticFlag &= ts.getModifierFlags(searchSpaceNode);
searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class
break;
@@ -103226,7 +104160,7 @@
}
var sourceFile = searchSpaceNode.getSourceFile();
var references = ts.mapDefined(getPossibleSymbolReferenceNodes(sourceFile, "super", searchSpaceNode), function (node) {
- if (node.kind !== 98 /* SuperKeyword */) {
+ if (node.kind !== 99 /* SuperKeyword */) {
return;
}
var container = ts.getSuperContainer(node, /*stopOnFunctions*/ false);
@@ -103238,41 +104172,41 @@
return [{ definition: { type: 0 /* Symbol */, symbol: searchSpaceNode.symbol }, references: references }];
}
function isParameterName(node) {
- return node.kind === 72 /* Identifier */ && node.parent.kind === 151 /* Parameter */ && node.parent.name === node;
+ return node.kind === 73 /* Identifier */ && node.parent.kind === 152 /* Parameter */ && node.parent.name === node;
}
function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles, cancellationToken) {
var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, /* includeArrowFunctions */ false);
// Whether 'this' occurs in a static context within a class.
var staticFlag = 32 /* Static */;
switch (searchSpaceNode.kind) {
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
if (ts.isObjectLiteralMethod(searchSpaceNode)) {
break;
}
// falls through
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
staticFlag &= ts.getModifierFlags(searchSpaceNode);
searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class
break;
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
if (ts.isExternalModule(searchSpaceNode) || isParameterName(thisOrSuperKeyword)) {
return undefined;
}
// falls through
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
break;
// Computed properties in classes are not handled here because references to this are illegal,
// so there is no point finding references to them.
default:
return undefined;
}
- var references = ts.flatMap(searchSpaceNode.kind === 284 /* SourceFile */ ? sourceFiles : [searchSpaceNode.getSourceFile()], function (sourceFile) {
+ var references = ts.flatMap(searchSpaceNode.kind === 285 /* SourceFile */ ? sourceFiles : [searchSpaceNode.getSourceFile()], function (sourceFile) {
cancellationToken.throwIfCancellationRequested();
return getPossibleSymbolReferenceNodes(sourceFile, "this", ts.isSourceFile(searchSpaceNode) ? sourceFile : searchSpaceNode).filter(function (node) {
if (!ts.isThis(node)) {
@@ -103280,19 +104214,19 @@
}
var container = ts.getThisContainer(node, /* includeArrowFunctions */ false);
switch (searchSpaceNode.kind) {
- case 196 /* FunctionExpression */:
- case 239 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
return searchSpaceNode.symbol === container.symbol;
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
return ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol;
- case 209 /* ClassExpression */:
- case 240 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
// Make sure the container belongs to the same class
// and has the appropriate static modifier from the original container.
return container.parent && searchSpaceNode.symbol === container.parent.symbol && (ts.getModifierFlags(container) & 32 /* Static */) === staticFlag;
- case 284 /* SourceFile */:
- return container.kind === 284 /* SourceFile */ && !ts.isExternalModule(container) && !isParameterName(node);
+ case 285 /* SourceFile */:
+ return container.kind === 285 /* SourceFile */ && !ts.isExternalModule(container) && !isParameterName(node);
}
});
}).map(function (n) { return FindAllReferences.nodeEntry(n); });
@@ -103411,7 +104345,7 @@
});
}
function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol, checker) {
- var bindingElement = ts.getDeclarationOfKind(symbol, 186 /* BindingElement */);
+ var bindingElement = ts.getDeclarationOfKind(symbol, 187 /* BindingElement */);
if (bindingElement && ts.isObjectBindingElementWithoutPropertyName(bindingElement)) {
return ts.getPropertySymbolFromBindingElement(checker, bindingElement);
}
@@ -103770,7 +104704,7 @@
else {
var defs = getDefinitionFromSymbol(typeChecker, symbol, node) || ts.emptyArray;
// For a 'super()' call, put the signature first, else put the variable first.
- return node.kind === 98 /* SuperKeyword */ ? [sigInfo].concat(defs) : defs.concat([sigInfo]);
+ return node.kind === 99 /* SuperKeyword */ ? [sigInfo].concat(defs) : defs.concat([sigInfo]);
}
}
// Because name in short-hand property assignment has two different meanings: property name and property value,
@@ -103778,7 +104712,7 @@
// go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition
// is performed at the location of property access, we would like to go to definition of the property in the short-hand
// assignment. This case and others are handled by the following code.
- if (node.parent.kind === 276 /* ShorthandPropertyAssignment */) {
+ if (node.parent.kind === 277 /* ShorthandPropertyAssignment */) {
var shorthandSymbol_1 = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration);
return shorthandSymbol_1 ? shorthandSymbol_1.declarations.map(function (decl) { return createDefinitionInfo(decl, typeChecker, shorthandSymbol_1, node); }) : [];
}
@@ -103931,18 +104865,18 @@
// (2) when the aliased symbol is originating from an import.
//
function shouldSkipAlias(node, declaration) {
- if (node.kind !== 72 /* Identifier */) {
+ if (node.kind !== 73 /* Identifier */) {
return false;
}
if (node.parent === declaration) {
return true;
}
switch (declaration.kind) {
- case 250 /* ImportClause */:
- case 248 /* ImportEqualsDeclaration */:
+ case 251 /* ImportClause */:
+ case 249 /* ImportEqualsDeclaration */:
return true;
- case 253 /* ImportSpecifier */:
- return declaration.parent.kind === 252 /* NamedImports */;
+ case 254 /* ImportSpecifier */:
+ return declaration.parent.kind === 253 /* NamedImports */;
default:
return false;
}
@@ -103952,7 +104886,7 @@
function getConstructSignatureDefinition() {
// Applicable only if we are in a new expression, or we are on a constructor declaration
// and in either case the symbol has a construct signature definition, i.e. class
- if (symbol.flags & 32 /* Class */ && (ts.isNewExpressionTarget(node) || node.kind === 124 /* ConstructorKeyword */)) {
+ if (symbol.flags & 32 /* Class */ && (ts.isNewExpressionTarget(node) || node.kind === 125 /* ConstructorKeyword */)) {
var cls = ts.find(symbol.declarations, ts.isClassLike) || ts.Debug.fail("Expected declaration to have at least one class-like declaration");
return getSignatureDefinition(cls.members, /*selectConstructors*/ true);
}
@@ -104026,9 +104960,9 @@
}
function isConstructorLike(node) {
switch (node.kind) {
- case 157 /* Constructor */:
- case 166 /* ConstructorType */:
- case 161 /* ConstructSignature */:
+ case 158 /* Constructor */:
+ case 167 /* ConstructorType */:
+ case 162 /* ConstructSignature */:
return true;
default:
return false;
@@ -104146,11 +105080,11 @@
JsDoc.getJsDocCommentsFromDeclarations = getJsDocCommentsFromDeclarations;
function getCommentHavingNodes(declaration) {
switch (declaration.kind) {
- case 304 /* JSDocParameterTag */:
- case 310 /* JSDocPropertyTag */:
+ case 305 /* JSDocParameterTag */:
+ case 311 /* JSDocPropertyTag */:
return [declaration];
- case 302 /* JSDocCallbackTag */:
- case 309 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
return [declaration, declaration.parent];
default:
return ts.getJSDocCommentsAndTags(declaration);
@@ -104171,16 +105105,16 @@
function getCommentText(tag) {
var comment = tag.comment;
switch (tag.kind) {
- case 300 /* JSDocAugmentsTag */:
+ case 301 /* JSDocAugmentsTag */:
return withNode(tag.class);
- case 308 /* JSDocTemplateTag */:
+ case 309 /* JSDocTemplateTag */:
return withList(tag.typeParameters);
- case 307 /* JSDocTypeTag */:
+ case 308 /* JSDocTypeTag */:
return withNode(tag.typeExpression);
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
- case 310 /* JSDocPropertyTag */:
- case 304 /* JSDocParameterTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
+ case 311 /* JSDocPropertyTag */:
+ case 305 /* JSDocParameterTag */:
var name = tag.name;
return name ? withNode(name) : comment;
default:
@@ -104357,7 +105291,7 @@
function parameterDocComments(parameters, isJavaScriptFile, indentationStr, newLine) {
return parameters.map(function (_a, i) {
var name = _a.name, dotDotDotToken = _a.dotDotDotToken;
- var paramName = name.kind === 72 /* Identifier */ ? name.text : "param" + i;
+ var paramName = name.kind === 73 /* Identifier */ ? name.text : "param" + i;
var type = isJavaScriptFile ? (dotDotDotToken ? "{...any} " : "{any} ") : "";
return indentationStr + " * @param " + type + paramName + newLine;
}).join("");
@@ -104367,23 +105301,23 @@
}
function getCommentOwnerInfoWorker(commentOwner) {
switch (commentOwner.kind) {
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 156 /* MethodDeclaration */:
- case 157 /* Constructor */:
- case 155 /* MethodSignature */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 157 /* MethodDeclaration */:
+ case 158 /* Constructor */:
+ case 156 /* MethodSignature */:
var parameters = commentOwner.parameters;
return { commentOwner: commentOwner, parameters: parameters };
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return getCommentOwnerInfoWorker(commentOwner.initializer);
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 153 /* PropertySignature */:
- case 243 /* EnumDeclaration */:
- case 278 /* EnumMember */:
- case 242 /* TypeAliasDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 154 /* PropertySignature */:
+ case 244 /* EnumDeclaration */:
+ case 279 /* EnumMember */:
+ case 243 /* TypeAliasDeclaration */:
return { commentOwner: commentOwner };
- case 219 /* VariableStatement */: {
+ case 220 /* VariableStatement */: {
var varStatement = commentOwner;
var varDeclarations = varStatement.declarationList.declarations;
var parameters_1 = varDeclarations.length === 1 && varDeclarations[0].initializer
@@ -104391,14 +105325,14 @@
: undefined;
return { commentOwner: commentOwner, parameters: parameters_1 };
}
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return "quit";
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
// If in walking up the tree, we hit a a nested namespace declaration,
// then we must be somewhere within a dotted namespace name; however we don't
// want to give back a JSDoc template for the 'b' or 'c' in 'namespace a.b.c { }'.
- return commentOwner.parent.kind === 244 /* ModuleDeclaration */ ? undefined : { commentOwner: commentOwner };
- case 204 /* BinaryExpression */: {
+ return commentOwner.parent.kind === 245 /* ModuleDeclaration */ ? undefined : { commentOwner: commentOwner };
+ case 205 /* BinaryExpression */: {
var be = commentOwner;
if (ts.getAssignmentDeclarationKind(be) === 0 /* None */) {
return "quit";
@@ -104417,14 +105351,14 @@
* @returns the parameters of a signature found on the RHS if one exists; otherwise 'emptyArray'.
*/
function getParametersFromRightHandSideOfAssignment(rightHandSide) {
- while (rightHandSide.kind === 195 /* ParenthesizedExpression */) {
+ while (rightHandSide.kind === 196 /* ParenthesizedExpression */) {
rightHandSide = rightHandSide.expression;
}
switch (rightHandSide.kind) {
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return rightHandSide.parameters;
- case 209 /* ClassExpression */: {
+ case 210 /* ClassExpression */: {
var ctr = ts.find(rightHandSide.members, ts.isConstructorDeclaration);
return ctr ? ctr.parameters : ts.emptyArray;
}
@@ -104486,9 +105420,9 @@
}
function shouldKeepItem(declaration, checker) {
switch (declaration.kind) {
- case 250 /* ImportClause */:
- case 253 /* ImportSpecifier */:
- case 248 /* ImportEqualsDeclaration */:
+ case 251 /* ImportClause */:
+ case 254 /* ImportSpecifier */:
+ case 249 /* ImportEqualsDeclaration */:
var importer = checker.getSymbolAtLocation(declaration.name); // TODO: GH#18217
var imported = checker.getAliasedSymbol(importer);
return importer.escapedName !== imported.escapedName;
@@ -104498,7 +105432,7 @@
}
function tryAddSingleDeclarationName(declaration, containers) {
var name = ts.getNameOfDeclaration(declaration);
- return !!name && (pushLiteral(name, containers) || name.kind === 149 /* ComputedPropertyName */ && tryAddComputedPropertyName(name.expression, containers));
+ return !!name && (pushLiteral(name, containers) || name.kind === 150 /* ComputedPropertyName */ && tryAddComputedPropertyName(name.expression, containers));
}
// Only added the names of computed properties if they're simple dotted expressions, like:
//
@@ -104515,7 +105449,7 @@
// First, if we started with a computed property name, then add all but the last
// portion into the container array.
var name = ts.getNameOfDeclaration(declaration);
- if (name && name.kind === 149 /* ComputedPropertyName */ && !tryAddComputedPropertyName(name.expression, containers)) {
+ if (name && name.kind === 150 /* ComputedPropertyName */ && !tryAddComputedPropertyName(name.expression, containers)) {
return ts.emptyArray;
}
// Don't include the last portion.
@@ -104684,7 +105618,7 @@
return;
}
switch (node.kind) {
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
// Get parameter properties, and treat them as being on the *same* level as the constructor, not under it.
var ctr = node;
addNodeWithRecursiveChild(ctr, ctr.body);
@@ -104696,21 +105630,21 @@
}
}
break;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 155 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 156 /* MethodSignature */:
if (!ts.hasDynamicName(node)) {
addNodeWithRecursiveChild(node, node.body);
}
break;
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
if (!ts.hasDynamicName(node)) {
addLeafNode(node);
}
break;
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
var importClause = node;
// Handle default import case e.g.:
// import d from "mod";
@@ -104722,7 +105656,7 @@
// import {a, b as B} from "mod";
var namedBindings = importClause.namedBindings;
if (namedBindings) {
- if (namedBindings.kind === 251 /* NamespaceImport */) {
+ if (namedBindings.kind === 252 /* NamespaceImport */) {
addLeafNode(namedBindings);
}
else {
@@ -104733,8 +105667,8 @@
}
}
break;
- case 186 /* BindingElement */:
- case 237 /* VariableDeclaration */:
+ case 187 /* BindingElement */:
+ case 238 /* VariableDeclaration */:
var _d = node, name = _d.name, initializer = _d.initializer;
if (ts.isBindingPattern(name)) {
addChildrenRecursively(name);
@@ -104755,12 +105689,12 @@
addNodeWithRecursiveChild(node, initializer);
}
break;
- case 197 /* ArrowFunction */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
addNodeWithRecursiveChild(node, node.body);
break;
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
startNode(node);
for (var _e = 0, _f = node.members; _e < _f.length; _e++) {
var member = _f[_e];
@@ -104770,9 +105704,9 @@
}
endNode();
break;
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
startNode(node);
for (var _g = 0, _h = node.members; _g < _h.length; _g++) {
var member = _h[_g];
@@ -104780,18 +105714,18 @@
}
endNode();
break;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
addNodeWithRecursiveChild(node, getInteriorModule(node).body);
break;
- case 257 /* ExportSpecifier */:
- case 248 /* ImportEqualsDeclaration */:
- case 162 /* IndexSignature */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 242 /* TypeAliasDeclaration */:
+ case 258 /* ExportSpecifier */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 163 /* IndexSignature */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 243 /* TypeAliasDeclaration */:
addLeafNode(node);
break;
- case 204 /* BinaryExpression */: {
+ case 205 /* BinaryExpression */: {
var special = ts.getAssignmentDeclarationKind(node);
switch (special) {
case 1 /* ExportsProperty */:
@@ -104873,12 +105807,12 @@
return false;
}
switch (a.kind) {
- case 154 /* PropertyDeclaration */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 155 /* PropertyDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return ts.hasModifier(a, 32 /* Static */) === ts.hasModifier(b, 32 /* Static */);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return areSameModule(a, b);
default:
return true;
@@ -104894,7 +105828,7 @@
// Only merge module nodes that have the same chain. Don't merge 'A.B.C' with 'A'!
function areSameModule(a, b) {
// TODO: GH#18217
- return a.body.kind === b.body.kind && (a.body.kind !== 244 /* ModuleDeclaration */ || areSameModule(a.body, b.body));
+ return a.body.kind === b.body.kind && (a.body.kind !== 245 /* ModuleDeclaration */ || areSameModule(a.body, b.body));
}
/** Merge source into target. Source should be thrown away after this is called. */
function merge(target, source) {
@@ -104924,7 +105858,7 @@
* So `new()` can still come before an `aardvark` method.
*/
function tryGetName(node) {
- if (node.kind === 244 /* ModuleDeclaration */) {
+ if (node.kind === 245 /* ModuleDeclaration */) {
return getModuleName(node);
}
var declName = ts.getNameOfDeclaration(node);
@@ -104932,16 +105866,16 @@
return ts.unescapeLeadingUnderscores(ts.getPropertyNameForPropertyNameNode(declName)); // TODO: GH#18217
}
switch (node.kind) {
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 209 /* ClassExpression */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 210 /* ClassExpression */:
return getFunctionOrClassName(node);
default:
return undefined;
}
}
function getItemName(node, name) {
- if (node.kind === 244 /* ModuleDeclaration */) {
+ if (node.kind === 245 /* ModuleDeclaration */) {
return getModuleName(node);
}
if (name) {
@@ -104951,16 +105885,16 @@
}
}
switch (node.kind) {
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
var sourceFile = node;
return ts.isExternalModule(sourceFile)
? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\""
: "<global>";
- case 197 /* ArrowFunction */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 198 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
if (ts.getModifierFlags(node) & 512 /* Default */) {
return "default";
}
@@ -104968,13 +105902,13 @@
// (eg: "app\n.onactivated"), so we should remove the whitespace for readabiltiy in the
// navigation bar.
return getFunctionOrClassName(node);
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return "constructor";
- case 161 /* ConstructSignature */:
+ case 162 /* ConstructSignature */:
return "new()";
- case 160 /* CallSignature */:
+ case 161 /* CallSignature */:
return "()";
- case 162 /* IndexSignature */:
+ case 163 /* IndexSignature */:
return "[]";
default:
return "<unknown>";
@@ -104998,25 +105932,25 @@
return topLevel;
function isTopLevel(item) {
switch (navigationBarNodeKind(item)) {
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 243 /* EnumDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 284 /* SourceFile */:
- case 242 /* TypeAliasDeclaration */:
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
- return true;
- case 157 /* Constructor */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 237 /* VariableDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 244 /* EnumDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 285 /* SourceFile */:
+ case 243 /* TypeAliasDeclaration */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
+ return true;
+ case 158 /* Constructor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 238 /* VariableDeclaration */:
return hasSomeImportantChild(item);
- case 197 /* ArrowFunction */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
return isTopLevelFunctionDeclaration(item);
default:
return false;
@@ -105026,10 +105960,10 @@
return false;
}
switch (navigationBarNodeKind(item.parent)) {
- case 245 /* ModuleBlock */:
- case 284 /* SourceFile */:
- case 156 /* MethodDeclaration */:
- case 157 /* Constructor */:
+ case 246 /* ModuleBlock */:
+ case 285 /* SourceFile */:
+ case 157 /* MethodDeclaration */:
+ case 158 /* Constructor */:
return true;
default:
return hasSomeImportantChild(item);
@@ -105038,7 +105972,7 @@
function hasSomeImportantChild(item) {
return ts.some(item.children, function (child) {
var childKind = navigationBarNodeKind(child);
- return childKind !== 237 /* VariableDeclaration */ && childKind !== 186 /* BindingElement */;
+ return childKind !== 238 /* VariableDeclaration */ && childKind !== 187 /* BindingElement */;
});
}
}
@@ -105095,7 +106029,7 @@
// Otherwise, we need to aggregate each identifier to build up the qualified name.
var result = [];
result.push(ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name));
- while (moduleDeclaration.body && moduleDeclaration.body.kind === 244 /* ModuleDeclaration */) {
+ while (moduleDeclaration.body && moduleDeclaration.body.kind === 245 /* ModuleDeclaration */) {
moduleDeclaration = moduleDeclaration.body;
result.push(ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name));
}
@@ -105109,13 +106043,13 @@
return decl.body && ts.isModuleDeclaration(decl.body) ? getInteriorModule(decl.body) : decl;
}
function isComputedProperty(member) {
- return !member.name || member.name.kind === 149 /* ComputedPropertyName */;
+ return !member.name || member.name.kind === 150 /* ComputedPropertyName */;
}
function getNodeSpan(node) {
- return node.kind === 284 /* SourceFile */ ? ts.createTextSpanFromRange(node) : ts.createTextSpanFromNode(node, curSourceFile);
+ return node.kind === 285 /* SourceFile */ ? ts.createTextSpanFromRange(node) : ts.createTextSpanFromNode(node, curSourceFile);
}
function getModifiers(node) {
- if (node.parent && node.parent.kind === 237 /* VariableDeclaration */) {
+ if (node.parent && node.parent.kind === 238 /* VariableDeclaration */) {
node = node.parent;
}
return ts.getNodeModifiers(node);
@@ -105130,7 +106064,7 @@
return ts.declarationNameToString(parent.name);
}
// See if it is of the form "<expr> = function(){...}". If so, use the text from the left-hand side.
- else if (ts.isBinaryExpression(parent) && parent.operatorToken.kind === 59 /* EqualsToken */) {
+ else if (ts.isBinaryExpression(parent) && parent.operatorToken.kind === 60 /* EqualsToken */) {
return nodeText(parent.left).replace(whiteSpaceRegex, "");
}
// See if it is a property assignment, and if so use the property name
@@ -105168,9 +106102,9 @@
}
function isFunctionOrClassExpression(node) {
switch (node.kind) {
- case 197 /* ArrowFunction */:
- case 196 /* FunctionExpression */:
- case 209 /* ClassExpression */:
+ case 198 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
+ case 210 /* ClassExpression */:
return true;
default:
return false;
@@ -105497,7 +106431,7 @@
}
var lastImport = current - 1;
if (lastImport !== firstImport) {
- out.push(createOutliningSpanFromBounds(ts.findChildOfKind(statements[firstImport], 92 /* ImportKeyword */, sourceFile).getStart(sourceFile), statements[lastImport].getEnd(), "imports" /* Imports */));
+ out.push(createOutliningSpanFromBounds(ts.findChildOfKind(statements[firstImport], 93 /* ImportKeyword */, sourceFile).getStart(sourceFile), statements[lastImport].getEnd(), "imports" /* Imports */));
}
}
function visitNonImportNode(n) {
@@ -105614,31 +106548,31 @@
}
function getOutliningSpanForNode(n, sourceFile) {
switch (n.kind) {
- case 218 /* Block */:
- if (ts.isFunctionBlock(n)) {
- return spanForNode(n.parent, /*autoCollapse*/ n.parent.kind !== 197 /* ArrowFunction */);
+ case 219 /* Block */:
+ if (ts.isFunctionLike(n.parent)) {
+ return functionSpan(n.parent, n, sourceFile);
}
// Check if the block is standalone, or 'attached' to some parent statement.
// If the latter, we want to collapse the block, but consider its hint span
// to be the entire span of the parent.
switch (n.parent.kind) {
- case 223 /* DoStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 225 /* ForStatement */:
- case 222 /* IfStatement */:
- case 224 /* WhileStatement */:
- case 231 /* WithStatement */:
- case 274 /* CatchClause */:
+ case 224 /* DoStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 226 /* ForStatement */:
+ case 223 /* IfStatement */:
+ case 225 /* WhileStatement */:
+ case 232 /* WithStatement */:
+ case 275 /* CatchClause */:
return spanForNode(n.parent);
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
// Could be the try-block, or the finally-block.
var tryStatement = n.parent;
if (tryStatement.tryBlock === n) {
return spanForNode(n.parent);
}
else if (tryStatement.finallyBlock === n) {
- return spanForNode(ts.findChildOfKind(tryStatement, 88 /* FinallyKeyword */, sourceFile));
+ return spanForNode(ts.findChildOfKind(tryStatement, 89 /* FinallyKeyword */, sourceFile));
}
// falls through
default:
@@ -105646,22 +106580,22 @@
// the span of the block, independent of any parent span.
return createOutliningSpan(ts.createTextSpanFromNode(n, sourceFile), "code" /* Code */);
}
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
return spanForNode(n.parent);
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
- case 246 /* CaseBlock */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 247 /* CaseBlock */:
return spanForNode(n);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return spanForObjectOrArrayLiteral(n);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return spanForObjectOrArrayLiteral(n, 22 /* OpenBracketToken */);
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
return spanForJSXElement(n);
- case 261 /* JsxSelfClosingElement */:
- case 262 /* JsxOpeningElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
return spanForJSXAttributes(n.attributes);
}
function spanForJSXElement(node) {
@@ -105683,20 +106617,29 @@
// Otherwise, the collapsed section will include the end of the previous line.
return spanForNode(node, /*autoCollapse*/ false, /*useFullStart*/ !ts.isArrayLiteralExpression(node.parent) && !ts.isCallExpression(node.parent), open);
}
- function spanForNode(hintSpanNode, autoCollapse, useFullStart, open) {
+ function spanForNode(hintSpanNode, autoCollapse, useFullStart, open, close) {
if (autoCollapse === void 0) { autoCollapse = false; }
if (useFullStart === void 0) { useFullStart = true; }
if (open === void 0) { open = 18 /* OpenBraceToken */; }
+ if (close === void 0) { close = open === 18 /* OpenBraceToken */ ? 19 /* CloseBraceToken */ : 23 /* CloseBracketToken */; }
var openToken = ts.findChildOfKind(n, open, sourceFile);
- var close = open === 18 /* OpenBraceToken */ ? 19 /* CloseBraceToken */ : 23 /* CloseBracketToken */;
var closeToken = ts.findChildOfKind(n, close, sourceFile);
- if (!openToken || !closeToken) {
- return undefined;
+ return openToken && closeToken && spanBetweenTokens(openToken, closeToken, hintSpanNode, sourceFile, autoCollapse, useFullStart);
}
+ }
+ function functionSpan(node, body, sourceFile) {
+ var openToken = ts.isNodeArrayMultiLine(node.parameters, sourceFile)
+ ? ts.findChildOfKind(node, 20 /* OpenParenToken */, sourceFile)
+ : ts.findChildOfKind(body, 18 /* OpenBraceToken */, sourceFile);
+ var closeToken = ts.findChildOfKind(body, 19 /* CloseBraceToken */, sourceFile);
+ return openToken && closeToken && spanBetweenTokens(openToken, closeToken, node.parent, sourceFile, /*autoCollapse*/ node.parent.kind !== 198 /* ArrowFunction */);
+ }
+ function spanBetweenTokens(openToken, closeToken, hintSpanNode, sourceFile, autoCollapse, useFullStart) {
+ if (autoCollapse === void 0) { autoCollapse = false; }
+ if (useFullStart === void 0) { useFullStart = true; }
var textSpan = ts.createTextSpanFromBounds(useFullStart ? openToken.getFullStart() : openToken.getStart(sourceFile), closeToken.getEnd());
return createOutliningSpan(textSpan, "code" /* Code */, ts.createTextSpanFromNode(hintSpanNode, sourceFile), autoCollapse);
}
- }
function createOutliningSpan(textSpan, kind, hintSpan, autoCollapse, bannerText) {
if (hintSpan === void 0) { hintSpan = textSpan; }
if (autoCollapse === void 0) { autoCollapse = false; }
@@ -105959,7 +106902,7 @@
if (ch >= 65 /* A */ && ch <= 90 /* Z */) {
return true;
}
- if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 7 /* Latest */)) {
+ if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 8 /* Latest */)) {
return false;
}
// TODO: find a way to determine this for any unicode characters in a
@@ -105972,7 +106915,7 @@
if (ch >= 97 /* a */ && ch <= 122 /* z */) {
return true;
}
- if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 7 /* Latest */)) {
+ if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 8 /* Latest */)) {
return false;
}
// TODO: find a way to determine this for any unicode characters in a
@@ -106224,10 +107167,10 @@
*/
function tryConsumeDeclare() {
var token = ts.scanner.getToken();
- if (token === 125 /* DeclareKeyword */) {
+ if (token === 126 /* DeclareKeyword */) {
// declare module "mod"
token = nextToken();
- if (token === 130 /* ModuleKeyword */) {
+ if (token === 131 /* ModuleKeyword */) {
token = nextToken();
if (token === 10 /* StringLiteral */) {
recordAmbientExternalModule();
@@ -106245,7 +107188,7 @@
return false;
}
var token = ts.scanner.getToken();
- if (token === 92 /* ImportKeyword */) {
+ if (token === 93 /* ImportKeyword */) {
token = nextToken();
if (token === 20 /* OpenParenToken */) {
token = nextToken();
@@ -106261,9 +107204,9 @@
return true;
}
else {
- if (token === 72 /* Identifier */ || ts.isKeyword(token)) {
+ if (token === 73 /* Identifier */ || ts.isKeyword(token)) {
token = nextToken();
- if (token === 144 /* FromKeyword */) {
+ if (token === 145 /* FromKeyword */) {
token = nextToken();
if (token === 10 /* StringLiteral */) {
// import d from "mod";
@@ -106271,7 +107214,7 @@
return true;
}
}
- else if (token === 59 /* EqualsToken */) {
+ else if (token === 60 /* EqualsToken */) {
if (tryConsumeRequireCall(/*skipCurrentToken*/ true)) {
return true;
}
@@ -106294,7 +107237,7 @@
}
if (token === 19 /* CloseBraceToken */) {
token = nextToken();
- if (token === 144 /* FromKeyword */) {
+ if (token === 145 /* FromKeyword */) {
token = nextToken();
if (token === 10 /* StringLiteral */) {
// import {a as A} from "mod";
@@ -106306,11 +107249,11 @@
}
else if (token === 40 /* AsteriskToken */) {
token = nextToken();
- if (token === 119 /* AsKeyword */) {
+ if (token === 120 /* AsKeyword */) {
token = nextToken();
- if (token === 72 /* Identifier */ || ts.isKeyword(token)) {
+ if (token === 73 /* Identifier */ || ts.isKeyword(token)) {
token = nextToken();
- if (token === 144 /* FromKeyword */) {
+ if (token === 145 /* FromKeyword */) {
token = nextToken();
if (token === 10 /* StringLiteral */) {
// import * as NS from "mod"
@@ -106328,7 +107271,7 @@
}
function tryConsumeExport() {
var token = ts.scanner.getToken();
- if (token === 85 /* ExportKeyword */) {
+ if (token === 86 /* ExportKeyword */) {
markAsExternalModuleIfTopLevel();
token = nextToken();
if (token === 18 /* OpenBraceToken */) {
@@ -106340,7 +107283,7 @@
}
if (token === 19 /* CloseBraceToken */) {
token = nextToken();
- if (token === 144 /* FromKeyword */) {
+ if (token === 145 /* FromKeyword */) {
token = nextToken();
if (token === 10 /* StringLiteral */) {
// export {a as A} from "mod";
@@ -106352,7 +107295,7 @@
}
else if (token === 40 /* AsteriskToken */) {
token = nextToken();
- if (token === 144 /* FromKeyword */) {
+ if (token === 145 /* FromKeyword */) {
token = nextToken();
if (token === 10 /* StringLiteral */) {
// export * from "mod"
@@ -106360,11 +107303,11 @@
}
}
}
- else if (token === 92 /* ImportKeyword */) {
+ else if (token === 93 /* ImportKeyword */) {
token = nextToken();
- if (token === 72 /* Identifier */ || ts.isKeyword(token)) {
+ if (token === 73 /* Identifier */ || ts.isKeyword(token)) {
token = nextToken();
- if (token === 59 /* EqualsToken */) {
+ if (token === 60 /* EqualsToken */) {
if (tryConsumeRequireCall(/*skipCurrentToken*/ true)) {
return true;
}
@@ -106377,7 +107320,7 @@
}
function tryConsumeRequireCall(skipCurrentToken) {
var token = skipCurrentToken ? nextToken() : ts.scanner.getToken();
- if (token === 134 /* RequireKeyword */) {
+ if (token === 135 /* RequireKeyword */) {
token = nextToken();
if (token === 20 /* OpenParenToken */) {
token = nextToken();
@@ -106392,7 +107335,7 @@
}
function tryConsumeDefine() {
var token = ts.scanner.getToken();
- if (token === 72 /* Identifier */ && ts.scanner.getTokenValue() === "define") {
+ if (token === 73 /* Identifier */ && ts.scanner.getTokenValue() === "define") {
token = nextToken();
if (token !== 20 /* OpenParenToken */) {
return true;
@@ -106526,14 +107469,14 @@
return getRenameInfoError(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library);
}
// Cannot rename `default` as in `import { default as foo } from "./someModule";
- if (ts.isIdentifier(node) && node.originalKeywordKind === 80 /* DefaultKeyword */ && symbol.parent.flags & 1536 /* Module */) {
+ if (ts.isIdentifier(node) && node.originalKeywordKind === 81 /* DefaultKeyword */ && symbol.parent.flags & 1536 /* Module */) {
return undefined;
}
if (ts.isStringLiteralLike(node) && ts.tryGetImportFromModuleSpecifier(node)) {
return options && options.allowRenameOfImportPath ? getRenameInfoForModule(node, sourceFile, symbol) : undefined;
}
var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node);
- var specifierName = (ts.isImportOrExportSpecifierName(node) || ts.isStringOrNumericLiteralLike(node) && node.parent.kind === 149 /* ComputedPropertyName */)
+ var specifierName = (ts.isImportOrExportSpecifierName(node) || ts.isStringOrNumericLiteralLike(node) && node.parent.kind === 150 /* ComputedPropertyName */)
? ts.stripQuotes(ts.getTextOfIdentifierOrLiteral(node))
: undefined;
var displayName = specifierName || typeChecker.symbolToString(symbol);
@@ -106589,9 +107532,9 @@
}
function nodeIsEligibleForRename(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
case 10 /* StringLiteral */:
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
return true;
case 8 /* NumericLiteral */:
return ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node);
@@ -106604,6 +107547,275 @@
/* @internal */
var ts;
(function (ts) {
+ var SmartSelectionRange;
+ (function (SmartSelectionRange) {
+ function getSmartSelectionRange(pos, sourceFile) {
+ var selectionRange = {
+ textSpan: ts.createTextSpanFromBounds(sourceFile.getFullStart(), sourceFile.getEnd())
+ };
+ var parentNode = sourceFile;
+ outer: while (true) {
+ var children = getSelectionChildren(parentNode);
+ if (!children.length)
+ break;
+ for (var i = 0; i < children.length; i++) {
+ var prevNode = children[i - 1];
+ var node = children[i];
+ var nextNode = children[i + 1];
+ if (node.getStart(sourceFile) > pos) {
+ break outer;
+ }
+ if (positionShouldSnapToNode(pos, node, nextNode)) {
+ // 1. Blocks are effectively redundant with SyntaxLists.
+ // 2. TemplateSpans, along with the SyntaxLists containing them, are a somewhat unintuitive grouping
+ // of things that should be considered independently.
+ // 3. A VariableStatement’s children are just a VaraiableDeclarationList and a semicolon.
+ // 4. A lone VariableDeclaration in a VaraibleDeclaration feels redundant with the VariableStatement.
+ //
+ // Dive in without pushing a selection range.
+ if (ts.isBlock(node)
+ || ts.isTemplateSpan(node) || ts.isTemplateHead(node)
+ || prevNode && ts.isTemplateHead(prevNode)
+ || ts.isVariableDeclarationList(node) && ts.isVariableStatement(parentNode)
+ || ts.isSyntaxList(node) && ts.isVariableDeclarationList(parentNode)
+ || ts.isVariableDeclaration(node) && ts.isSyntaxList(parentNode) && children.length === 1) {
+ parentNode = node;
+ break;
+ }
+ // Synthesize a stop for '${ ... }' since '${' and '}' actually belong to siblings.
+ if (ts.isTemplateSpan(parentNode) && nextNode && ts.isTemplateMiddleOrTemplateTail(nextNode)) {
+ var start_2 = node.getFullStart() - "${".length;
+ var end_2 = nextNode.getStart() + "}".length;
+ pushSelectionRange(start_2, end_2);
+ }
+ // Blocks with braces, brackets, parens, or JSX tags on separate lines should be
+ // selected from open to close, including whitespace but not including the braces/etc. themselves.
+ var isBetweenMultiLineBookends = ts.isSyntaxList(node)
+ && isListOpener(prevNode)
+ && isListCloser(nextNode)
+ && !ts.positionsAreOnSameLine(prevNode.getStart(), nextNode.getStart(), sourceFile);
+ var jsDocCommentStart = ts.hasJSDocNodes(node) && node.jsDoc[0].getStart();
+ var start = isBetweenMultiLineBookends ? prevNode.getEnd() : node.getStart();
+ var end = isBetweenMultiLineBookends ? nextNode.getStart() : node.getEnd();
+ if (ts.isNumber(jsDocCommentStart)) {
+ pushSelectionRange(jsDocCommentStart, end);
+ }
+ pushSelectionRange(start, end);
+ // String literals should have a stop both inside and outside their quotes.
+ if (ts.isStringLiteral(node) || ts.isTemplateLiteral(node)) {
+ pushSelectionRange(start + 1, end - 1);
+ }
+ parentNode = node;
+ break;
+ }
+ }
+ }
+ return selectionRange;
+ function pushSelectionRange(start, end) {
+ // Skip empty ranges
+ if (start !== end) {
+ // Skip ranges that are identical to the parent
+ var textSpan = ts.createTextSpanFromBounds(start, end);
+ if (!selectionRange || !ts.textSpansEqual(textSpan, selectionRange.textSpan)) {
+ selectionRange = __assign({ textSpan: textSpan }, selectionRange && { parent: selectionRange });
+ }
+ }
+ }
+ }
+ SmartSelectionRange.getSmartSelectionRange = getSmartSelectionRange;
+ /**
+ * Like `ts.positionBelongsToNode`, except positions immediately after nodes
+ * count too, unless that position belongs to the next node. In effect, makes
+ * selections able to snap to preceding tokens when the cursor is on the tail
+ * end of them with only whitespace ahead.
+ * @param pos The position to check.
+ * @param node The candidate node to snap to.
+ * @param nextNode The next sibling node in the tree.
+ * @param sourceFile The source file containing the nodes.
+ */
+ function positionShouldSnapToNode(pos, node, nextNode) {
+ // Can’t use 'ts.positionBelongsToNode()' here because it cleverly accounts
+ // for missing nodes, which can’t really be considered when deciding what
+ // to select.
+ ts.Debug.assert(node.pos <= pos);
+ if (pos < node.end) {
+ return true;
+ }
+ var nodeEnd = node.getEnd();
+ var nextNodeStart = nextNode && nextNode.getStart();
+ if (nodeEnd === pos) {
+ return pos !== nextNodeStart;
+ }
+ return false;
+ }
+ var isImport = ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration);
+ /**
+ * Gets the children of a node to be considered for selection ranging,
+ * transforming them into an artificial tree according to their intuitive
+ * grouping where no grouping actually exists in the parse tree. For example,
+ * top-level imports are grouped into their own SyntaxList so they can be
+ * selected all together, even though in the AST they’re just siblings of each
+ * other as well as of other top-level statements and declarations.
+ */
+ function getSelectionChildren(node) {
+ // Group top-level imports
+ if (ts.isSourceFile(node)) {
+ return groupChildren(node.getChildAt(0).getChildren(), isImport);
+ }
+ // Mapped types _look_ like ObjectTypes with a single member,
+ // but in fact don’t contain a SyntaxList or a node containing
+ // the “key/value” pair like ObjectTypes do, but it seems intuitive
+ // that the selection would snap to those points. The philosophy
+ // of choosing a selection range is not so much about what the
+ // syntax currently _is_ as what the syntax might easily become
+ // if the user is making a selection; e.g., we synthesize a selection
+ // around the “key/value” pair not because there’s a node there, but
+ // because it allows the mapped type to become an object type with a
+ // few keystrokes.
+ if (ts.isMappedTypeNode(node)) {
+ var _a = node.getChildren(), openBraceToken = _a[0], children = _a.slice(1);
+ var closeBraceToken = ts.Debug.assertDefined(children.pop());
+ ts.Debug.assertEqual(openBraceToken.kind, 18 /* OpenBraceToken */);
+ ts.Debug.assertEqual(closeBraceToken.kind, 19 /* CloseBraceToken */);
+ // Group `-/+readonly` and `-/+?`
+ var groupedWithPlusMinusTokens = groupChildren(children, function (child) {
+ return child === node.readonlyToken || child.kind === 134 /* ReadonlyKeyword */ ||
+ child === node.questionToken || child.kind === 56 /* QuestionToken */;
+ });
+ // Group type parameter with surrounding brackets
+ var groupedWithBrackets = groupChildren(groupedWithPlusMinusTokens, function (_a) {
+ var kind = _a.kind;
+ return kind === 22 /* OpenBracketToken */ ||
+ kind === 151 /* TypeParameter */ ||
+ kind === 23 /* CloseBracketToken */;
+ });
+ return [
+ openBraceToken,
+ // Pivot on `:`
+ createSyntaxList(splitChildren(groupedWithBrackets, function (_a) {
+ var kind = _a.kind;
+ return kind === 57 /* ColonToken */;
+ })),
+ closeBraceToken,
+ ];
+ }
+ // Group modifiers and property name, then pivot on `:`.
+ if (ts.isPropertySignature(node)) {
+ var children = groupChildren(node.getChildren(), function (child) {
+ return child === node.name || ts.contains(node.modifiers, child);
+ });
+ return splitChildren(children, function (_a) {
+ var kind = _a.kind;
+ return kind === 57 /* ColonToken */;
+ });
+ }
+ // Group the parameter name with its `...`, then that group with its `?`, then pivot on `=`.
+ if (ts.isParameter(node)) {
+ var groupedDotDotDotAndName_1 = groupChildren(node.getChildren(), function (child) {
+ return child === node.dotDotDotToken || child === node.name;
+ });
+ var groupedWithQuestionToken = groupChildren(groupedDotDotDotAndName_1, function (child) {
+ return child === groupedDotDotDotAndName_1[0] || child === node.questionToken;
+ });
+ return splitChildren(groupedWithQuestionToken, function (_a) {
+ var kind = _a.kind;
+ return kind === 60 /* EqualsToken */;
+ });
+ }
+ // Pivot on '='
+ if (ts.isBindingElement(node)) {
+ return splitChildren(node.getChildren(), function (_a) {
+ var kind = _a.kind;
+ return kind === 60 /* EqualsToken */;
+ });
+ }
+ return node.getChildren();
+ }
+ /**
+ * Groups sibling nodes together into their own SyntaxList if they
+ * a) are adjacent, AND b) match a predicate function.
+ */
+ function groupChildren(children, groupOn) {
+ var result = [];
+ var group;
+ for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {
+ var child = children_1[_i];
+ if (groupOn(child)) {
+ group = group || [];
+ group.push(child);
+ }
+ else {
+ if (group) {
+ result.push(createSyntaxList(group));
+ group = undefined;
+ }
+ result.push(child);
+ }
+ }
+ if (group) {
+ result.push(createSyntaxList(group));
+ }
+ return result;
+ }
+ /**
+ * Splits sibling nodes into up to four partitions:
+ * 1) everything left of the first node matched by `pivotOn`,
+ * 2) the first node matched by `pivotOn`,
+ * 3) everything right of the first node matched by `pivotOn`,
+ * 4) a trailing semicolon, if `separateTrailingSemicolon` is enabled.
+ * The left and right groups, if not empty, will each be grouped into their own containing SyntaxList.
+ * @param children The sibling nodes to split.
+ * @param pivotOn The predicate function to match the node to be the pivot. The first node that matches
+ * the predicate will be used; any others that may match will be included into the right-hand group.
+ * @param separateTrailingSemicolon If the last token is a semicolon, it will be returned as a separate
+ * child rather than be included in the right-hand group.
+ */
+ function splitChildren(children, pivotOn, separateTrailingSemicolon) {
+ if (separateTrailingSemicolon === void 0) { separateTrailingSemicolon = true; }
+ if (children.length < 2) {
+ return children;
+ }
+ var splitTokenIndex = ts.findIndex(children, pivotOn);
+ if (splitTokenIndex === -1) {
+ return children;
+ }
+ var leftChildren = children.slice(0, splitTokenIndex);
+ var splitToken = children[splitTokenIndex];
+ var lastToken = ts.last(children);
+ var separateLastToken = separateTrailingSemicolon && lastToken.kind === 26 /* SemicolonToken */;
+ var rightChildren = children.slice(splitTokenIndex + 1, separateLastToken ? children.length - 1 : undefined);
+ var result = ts.compact([
+ leftChildren.length ? createSyntaxList(leftChildren) : undefined,
+ splitToken,
+ rightChildren.length ? createSyntaxList(rightChildren) : undefined,
+ ]);
+ return separateLastToken ? result.concat(lastToken) : result;
+ }
+ function createSyntaxList(children) {
+ ts.Debug.assertGreaterThanOrEqual(children.length, 1);
+ var syntaxList = ts.createNode(312 /* SyntaxList */, children[0].pos, ts.last(children).end);
+ syntaxList._children = children;
+ return syntaxList;
+ }
+ function isListOpener(token) {
+ var kind = token && token.kind;
+ return kind === 18 /* OpenBraceToken */
+ || kind === 22 /* OpenBracketToken */
+ || kind === 20 /* OpenParenToken */
+ || kind === 263 /* JsxOpeningElement */;
+ }
+ function isListCloser(token) {
+ var kind = token && token.kind;
+ return kind === 19 /* CloseBraceToken */
+ || kind === 23 /* CloseBracketToken */
+ || kind === 21 /* CloseParenToken */
+ || kind === 264 /* JsxClosingElement */;
+ }
+ })(SmartSelectionRange = ts.SmartSelectionRange || (ts.SmartSelectionRange = {}));
+})(ts || (ts = {}));
+/* @internal */
+var ts;
+(function (ts) {
var SignatureHelp;
(function (SignatureHelp) {
var InvocationKind;
@@ -106714,9 +107926,22 @@
});
}
function containsPrecedingToken(startingToken, sourceFile, container) {
- var precedingToken = ts.Debug.assertDefined(ts.findPrecedingToken(startingToken.getFullStart(), sourceFile, startingToken.parent, /*excludeJsdoc*/ true));
+ var pos = startingToken.getFullStart();
+ // There’s a possibility that `startingToken.parent` contains only `startingToken` and
+ // missing nodes, none of which are valid to be returned by `findPrecedingToken`. In that
+ // case, the preceding token we want is actually higher up the tree—almost definitely the
+ // next parent, but theoretically the situation with missing nodes might be happening on
+ // multiple nested levels.
+ var currentParent = startingToken.parent;
+ while (currentParent) {
+ var precedingToken = ts.findPrecedingToken(pos, sourceFile, currentParent, /*excludeJsdoc*/ true);
+ if (precedingToken) {
return ts.rangeContainsRange(container, precedingToken);
}
+ currentParent = currentParent.parent;
+ }
+ return ts.Debug.fail("Could not find preceding token");
+ }
function getArgumentInfoForCompletions(node, position, sourceFile) {
var info = getImmediatelyContainingArgumentInfo(node, position, sourceFile);
return !info || info.isTypeParameterList || info.invocation.kind !== 0 /* Call */ ? undefined
@@ -106789,10 +108014,10 @@
}
return undefined;
}
- else if (ts.isTemplateHead(node) && parent.parent.kind === 193 /* TaggedTemplateExpression */) {
+ else if (ts.isTemplateHead(node) && parent.parent.kind === 194 /* TaggedTemplateExpression */) {
var templateExpression = parent;
var tagExpression = templateExpression.parent;
- ts.Debug.assert(templateExpression.kind === 206 /* TemplateExpression */);
+ ts.Debug.assert(templateExpression.kind === 207 /* TemplateExpression */);
var argumentIndex = ts.isInsideTemplateLiteral(node, position, sourceFile) ? 0 : 1;
return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile);
}
@@ -106859,17 +108084,17 @@
return undefined;
var parent = startingToken.parent;
switch (parent.kind) {
- case 195 /* ParenthesizedExpression */:
- case 156 /* MethodDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 196 /* ParenthesizedExpression */:
+ case 157 /* MethodDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
var info = getArgumentOrParameterListInfo(startingToken, sourceFile);
if (!info)
return undefined;
var argumentIndex = info.argumentIndex, argumentCount = info.argumentCount, argumentsSpan = info.argumentsSpan;
var contextualType = ts.isMethodDeclaration(parent) ? checker.getContextualTypeForObjectLiteralElement(parent) : checker.getContextualType(parent);
return contextualType && { contextualType: contextualType, argumentIndex: argumentIndex, argumentCount: argumentCount, argumentsSpan: argumentsSpan };
- case 204 /* BinaryExpression */: {
+ case 205 /* BinaryExpression */: {
var highestBinary = getHighestBinary(parent);
var contextualType_1 = checker.getContextualType(highestBinary);
var argumentIndex_1 = startingToken.kind === 20 /* OpenParenToken */ ? 0 : countBinaryExpressionParameters(parent) - 1;
@@ -106993,7 +108218,7 @@
// | |
// This is because a Missing node has no width. However, what we actually want is to include trivia
// leading up to the next token in case the user is about to type in a TemplateMiddle or TemplateTail.
- if (template.kind === 206 /* TemplateExpression */) {
+ if (template.kind === 207 /* TemplateExpression */) {
var lastSpan = ts.last(template.templateSpans);
if (lastSpan.literal.getFullWidth() === 0) {
applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, /*stopAfterLineBreak*/ false);
@@ -107005,7 +108230,7 @@
var _loop_7 = function (n) {
// If the node is not a subspan of its parent, this is a big problem.
// There have been crashes that might be caused by this violation.
- ts.Debug.assert(ts.rangeContainsRange(n.parent, n), "Not a subspan", function () { return "Child: " + ts.Debug.showSyntaxKind(n) + ", parent: " + ts.Debug.showSyntaxKind(n.parent); });
+ ts.Debug.assert(ts.rangeContainsRange(n.parent, n), "Not a subspan", function () { return "Child: " + ts.Debug.formatSyntaxKind(n.kind) + ", parent: " + ts.Debug.formatSyntaxKind(n.parent.kind); });
var argumentInfo = getImmediatelyContainingArgumentOrContextualParameterInfo(n, position, sourceFile, checker);
if (argumentInfo) {
return { value: argumentInfo };
@@ -107305,7 +108530,7 @@
function check(node) {
if (isJsFile) {
switch (node.kind) {
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
var decl = ts.getDeclarationOfExpando(node);
if (decl) {
var symbol_1 = decl.symbol;
@@ -107315,7 +108540,7 @@
}
}
// falls through if no diagnostic was created
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
var symbol = node.symbol;
if (symbol.members && (symbol.members.size > 0)) {
diags.push(ts.createDiagnosticForNode(ts.isVariableDeclaration(node.parent) ? node.parent.name : node, ts.Diagnostics.This_constructor_function_may_be_converted_to_a_class_declaration));
@@ -107348,11 +108573,11 @@
function containsTopLevelCommonjs(sourceFile) {
return sourceFile.statements.some(function (statement) {
switch (statement.kind) {
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return statement.declarationList.declarations.some(function (decl) {
return !!decl.initializer && ts.isRequireCall(propertyAccessLeftHandSide(decl.initializer), /*checkArgumentIsStringLiteralLike*/ true);
});
- case 221 /* ExpressionStatement */: {
+ case 222 /* ExpressionStatement */: {
var expression = statement.expression;
if (!ts.isBinaryExpression(expression))
return ts.isRequireCall(expression, /*checkArgumentIsStringLiteralLike*/ true);
@@ -107369,12 +108594,12 @@
}
function importNameForConvertToDefaultImport(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
var importClause = node.importClause, moduleSpecifier = node.moduleSpecifier;
- return importClause && !importClause.name && importClause.namedBindings && importClause.namedBindings.kind === 251 /* NamespaceImport */ && ts.isStringLiteral(moduleSpecifier)
+ return importClause && !importClause.name && importClause.namedBindings && importClause.namedBindings.kind === 252 /* NamespaceImport */ && ts.isStringLiteral(moduleSpecifier)
? importClause.namedBindings.name
: undefined;
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return node.name;
default:
return undefined;
@@ -107432,13 +108657,13 @@
// should be kept up to date with getTransformationBody in convertToAsyncFunction.ts
function isFixablePromiseArgument(arg) {
switch (arg.kind) {
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
visitedNestedConvertibleFunctions.set(getKeyFromNode(arg), true);
/* falls through */
- case 96 /* NullKeyword */:
- case 72 /* Identifier */: // identifier includes undefined
+ case 97 /* NullKeyword */:
+ case 73 /* Identifier */: // identifier includes undefined
return true;
default:
return false;
@@ -107461,7 +108686,7 @@
}
var flags = ts.getCombinedLocalAndExportSymbolFlags(symbol);
if (flags & 32 /* Class */) {
- return ts.getDeclarationOfKind(symbol, 209 /* ClassExpression */) ?
+ return ts.getDeclarationOfKind(symbol, 210 /* ClassExpression */) ?
"local class" /* localClassElement */ : "class" /* classElement */;
}
if (flags & 384 /* Enum */)
@@ -107498,7 +108723,7 @@
if (typeChecker.isArgumentsSymbol(symbol)) {
return "local var" /* localVariableElement */;
}
- if (location.kind === 100 /* ThisKeyword */ && ts.isExpression(location)) {
+ if (location.kind === 101 /* ThisKeyword */ && ts.isExpression(location)) {
return "parameter" /* parameterElement */;
}
var flags = ts.getCombinedLocalAndExportSymbolFlags(symbol);
@@ -107549,11 +108774,11 @@
// If we requested completions after `x.` at the top-level, we may be at a source file location.
switch (location.parent && location.parent.kind) {
// If we've typed a character of the attribute name, will be 'JsxAttribute', else will be 'JsxOpeningElement'.
- case 262 /* JsxOpeningElement */:
- case 260 /* JsxElement */:
- case 261 /* JsxSelfClosingElement */:
- return location.kind === 72 /* Identifier */ ? "property" /* memberVariableElement */ : "JSX attribute" /* jsxAttribute */;
- case 267 /* JsxAttribute */:
+ case 263 /* JsxOpeningElement */:
+ case 261 /* JsxElement */:
+ case 262 /* JsxSelfClosingElement */:
+ return location.kind === 73 /* Identifier */ ? "property" /* memberVariableElement */ : "JSX attribute" /* jsxAttribute */;
+ case 268 /* JsxAttribute */:
return "JSX attribute" /* jsxAttribute */;
default:
return "property" /* memberVariableElement */;
@@ -107580,13 +108805,13 @@
var symbolFlags = ts.getCombinedLocalAndExportSymbolFlags(symbol);
var symbolKind = semanticMeaning & 1 /* Value */ ? getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location) : "" /* unknown */;
var hasAddedSymbolInfo = false;
- var isThisExpression = location.kind === 100 /* ThisKeyword */ && ts.isInExpressionContext(location);
+ var isThisExpression = location.kind === 101 /* ThisKeyword */ && ts.isInExpressionContext(location);
var type;
var printer;
var documentationFromAlias;
var tagsFromAlias;
- if (location.kind === 100 /* ThisKeyword */ && !isThisExpression) {
- return { displayParts: [ts.keywordPart(100 /* ThisKeyword */)], documentation: [], symbolKind: "primitive type" /* primitiveType */, tags: undefined };
+ if (location.kind === 101 /* ThisKeyword */ && !isThisExpression) {
+ return { displayParts: [ts.keywordPart(101 /* ThisKeyword */)], documentation: [], symbolKind: "primitive type" /* primitiveType */, tags: undefined };
}
// Class at constructor site need to be shown as constructor apart from property,method, vars
if (symbolKind !== "" /* unknown */ || symbolFlags & 32 /* Class */ || symbolFlags & 2097152 /* Alias */) {
@@ -107596,7 +108821,7 @@
}
var signature = void 0;
type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol.exportSymbol || symbol, location);
- if (location.parent && location.parent.kind === 189 /* PropertyAccessExpression */) {
+ if (location.parent && location.parent.kind === 190 /* PropertyAccessExpression */) {
var right = location.parent.name;
// Either the location is on the right of a property access, or on the left and the right is missing
if (right === location || (right && right.getFullWidth() === 0)) {
@@ -107615,9 +108840,8 @@
callExpressionLike = location.parent;
}
if (callExpressionLike) {
- var candidateSignatures = [];
- signature = typeChecker.getResolvedSignature(callExpressionLike, candidateSignatures); // TODO: GH#18217
- var useConstructSignatures = callExpressionLike.kind === 192 /* NewExpression */ || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 98 /* SuperKeyword */);
+ signature = typeChecker.getResolvedSignature(callExpressionLike); // TODO: GH#18217
+ var useConstructSignatures = callExpressionLike.kind === 193 /* NewExpression */ || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 99 /* SuperKeyword */);
var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures();
if (!ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) {
// Get the first signature if there is one -- allSignatures may contain
@@ -107635,7 +108859,7 @@
pushSymbolKind(symbolKind);
displayParts.push(ts.spacePart());
if (useConstructSignatures) {
- displayParts.push(ts.keywordPart(95 /* NewKeyword */));
+ displayParts.push(ts.keywordPart(96 /* NewKeyword */));
displayParts.push(ts.spacePart());
}
addFullSymbolName(symbol);
@@ -107659,7 +108883,7 @@
displayParts.push(ts.lineBreakPart());
}
if (useConstructSignatures) {
- displayParts.push(ts.keywordPart(95 /* NewKeyword */));
+ displayParts.push(ts.keywordPart(96 /* NewKeyword */));
displayParts.push(ts.spacePart());
}
addSignatureDisplayParts(signature, allSignatures, 262144 /* WriteArrowStyleSignature */);
@@ -107672,29 +108896,29 @@
}
}
else if ((ts.isNameOfFunctionDeclaration(location) && !(symbolFlags & 98304 /* Accessor */)) || // name of function declaration
- (location.kind === 124 /* ConstructorKeyword */ && location.parent.kind === 157 /* Constructor */)) { // At constructor keyword of constructor declaration
+ (location.kind === 125 /* ConstructorKeyword */ && location.parent.kind === 158 /* Constructor */)) { // At constructor keyword of constructor declaration
// get the signature from the declaration and write it
var functionDeclaration_1 = location.parent;
// Use function declaration to write the signatures only if the symbol corresponding to this declaration
var locationIsSymbolDeclaration = ts.find(symbol.declarations, function (declaration) {
- return declaration === (location.kind === 124 /* ConstructorKeyword */ ? functionDeclaration_1.parent : functionDeclaration_1);
+ return declaration === (location.kind === 125 /* ConstructorKeyword */ ? functionDeclaration_1.parent : functionDeclaration_1);
});
if (locationIsSymbolDeclaration) {
- var allSignatures = functionDeclaration_1.kind === 157 /* Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures();
+ var allSignatures = functionDeclaration_1.kind === 158 /* Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures();
if (!typeChecker.isImplementationOfOverload(functionDeclaration_1)) {
signature = typeChecker.getSignatureFromDeclaration(functionDeclaration_1); // TODO: GH#18217
}
else {
signature = allSignatures[0];
}
- if (functionDeclaration_1.kind === 157 /* Constructor */) {
+ if (functionDeclaration_1.kind === 158 /* Constructor */) {
// show (constructor) Type(...) signature
symbolKind = "constructor" /* constructorImplementationElement */;
addPrefixForAnyFunctionOrVar(type.symbol, symbolKind);
}
else {
// (function/method) symbol(..signature)
- addPrefixForAnyFunctionOrVar(functionDeclaration_1.kind === 160 /* CallSignature */ &&
+ addPrefixForAnyFunctionOrVar(functionDeclaration_1.kind === 161 /* CallSignature */ &&
!(type.symbol.flags & 2048 /* TypeLiteral */ || type.symbol.flags & 4096 /* ObjectLiteral */) ? type.symbol : symbol, symbolKind);
}
addSignatureDisplayParts(signature, allSignatures);
@@ -107704,7 +108928,7 @@
}
if (symbolFlags & 32 /* Class */ && !hasAddedSymbolInfo && !isThisExpression) {
addAliasPrefixIfNecessary();
- if (ts.getDeclarationOfKind(symbol, 209 /* ClassExpression */)) {
+ if (ts.getDeclarationOfKind(symbol, 210 /* ClassExpression */)) {
// Special case for class expressions because we would like to indicate that
// the class name is local to the class body (similar to function expression)
// (local class) class <className>
@@ -107712,7 +108936,7 @@
}
else {
// Class declaration has name which is not local.
- displayParts.push(ts.keywordPart(76 /* ClassKeyword */));
+ displayParts.push(ts.keywordPart(77 /* ClassKeyword */));
}
displayParts.push(ts.spacePart());
addFullSymbolName(symbol);
@@ -107720,37 +108944,37 @@
}
if ((symbolFlags & 64 /* Interface */) && (semanticMeaning & 2 /* Type */)) {
prefixNextMeaning();
- displayParts.push(ts.keywordPart(110 /* InterfaceKeyword */));
+ displayParts.push(ts.keywordPart(111 /* InterfaceKeyword */));
displayParts.push(ts.spacePart());
addFullSymbolName(symbol);
writeTypeParametersOfSymbol(symbol, sourceFile);
}
if ((symbolFlags & 524288 /* TypeAlias */) && (semanticMeaning & 2 /* Type */)) {
prefixNextMeaning();
- displayParts.push(ts.keywordPart(140 /* TypeKeyword */));
+ displayParts.push(ts.keywordPart(141 /* TypeKeyword */));
displayParts.push(ts.spacePart());
addFullSymbolName(symbol);
writeTypeParametersOfSymbol(symbol, sourceFile);
displayParts.push(ts.spacePart());
- displayParts.push(ts.operatorPart(59 /* EqualsToken */));
+ displayParts.push(ts.operatorPart(60 /* EqualsToken */));
displayParts.push(ts.spacePart());
ts.addRange(displayParts, ts.typeToDisplayParts(typeChecker, typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration, 8388608 /* InTypeAlias */));
}
if (symbolFlags & 384 /* Enum */) {
prefixNextMeaning();
if (ts.some(symbol.declarations, function (d) { return ts.isEnumDeclaration(d) && ts.isEnumConst(d); })) {
- displayParts.push(ts.keywordPart(77 /* ConstKeyword */));
+ displayParts.push(ts.keywordPart(78 /* ConstKeyword */));
displayParts.push(ts.spacePart());
}
- displayParts.push(ts.keywordPart(84 /* EnumKeyword */));
+ displayParts.push(ts.keywordPart(85 /* EnumKeyword */));
displayParts.push(ts.spacePart());
addFullSymbolName(symbol);
}
if (symbolFlags & 1536 /* Module */ && !isThisExpression) {
prefixNextMeaning();
- var declaration = ts.getDeclarationOfKind(symbol, 244 /* ModuleDeclaration */);
- var isNamespace = declaration && declaration.name && declaration.name.kind === 72 /* Identifier */;
- displayParts.push(ts.keywordPart(isNamespace ? 131 /* NamespaceKeyword */ : 130 /* ModuleKeyword */));
+ var declaration = ts.getDeclarationOfKind(symbol, 245 /* ModuleDeclaration */);
+ var isNamespace = declaration && declaration.name && declaration.name.kind === 73 /* Identifier */;
+ displayParts.push(ts.keywordPart(isNamespace ? 132 /* NamespaceKeyword */ : 131 /* ModuleKeyword */));
displayParts.push(ts.spacePart());
addFullSymbolName(symbol);
}
@@ -107769,7 +108993,7 @@
}
else {
// Method/function type parameter
- var decl = ts.getDeclarationOfKind(symbol, 150 /* TypeParameter */);
+ var decl = ts.getDeclarationOfKind(symbol, 151 /* TypeParameter */);
if (decl === undefined)
return ts.Debug.fail();
var declaration = decl.parent;
@@ -107777,21 +109001,21 @@
if (ts.isFunctionLikeKind(declaration.kind)) {
addInPrefix();
var signature = typeChecker.getSignatureFromDeclaration(declaration); // TODO: GH#18217
- if (declaration.kind === 161 /* ConstructSignature */) {
- displayParts.push(ts.keywordPart(95 /* NewKeyword */));
+ if (declaration.kind === 162 /* ConstructSignature */) {
+ displayParts.push(ts.keywordPart(96 /* NewKeyword */));
displayParts.push(ts.spacePart());
}
- else if (declaration.kind !== 160 /* CallSignature */ && declaration.name) {
+ else if (declaration.kind !== 161 /* CallSignature */ && declaration.name) {
addFullSymbolName(declaration.symbol);
}
ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* WriteTypeArgumentsOfSignature */));
}
- else if (declaration.kind === 242 /* TypeAliasDeclaration */) {
+ else if (declaration.kind === 243 /* TypeAliasDeclaration */) {
// Type alias type parameter
// For example
// type list<T> = T[]; // Both T will go through same code path
addInPrefix();
- displayParts.push(ts.keywordPart(140 /* TypeKeyword */));
+ displayParts.push(ts.keywordPart(141 /* TypeKeyword */));
displayParts.push(ts.spacePart());
addFullSymbolName(declaration.symbol);
writeTypeParametersOfSymbol(declaration.symbol, sourceFile);
@@ -107803,11 +109027,11 @@
symbolKind = "enum member" /* enumMemberElement */;
addPrefixForAnyFunctionOrVar(symbol, "enum member");
var declaration = symbol.declarations[0];
- if (declaration.kind === 278 /* EnumMember */) {
+ if (declaration.kind === 279 /* EnumMember */) {
var constantValue = typeChecker.getConstantValue(declaration);
if (constantValue !== undefined) {
displayParts.push(ts.spacePart());
- displayParts.push(ts.operatorPart(59 /* EqualsToken */));
+ displayParts.push(ts.operatorPart(60 /* EqualsToken */));
displayParts.push(ts.spacePart());
displayParts.push(ts.displayPart(ts.getTextOfConstantValue(constantValue), typeof constantValue === "number" ? ts.SymbolDisplayPartKind.numericLiteral : ts.SymbolDisplayPartKind.stringLiteral));
}
@@ -107833,32 +109057,32 @@
}
}
switch (symbol.declarations[0].kind) {
- case 247 /* NamespaceExportDeclaration */:
- displayParts.push(ts.keywordPart(85 /* ExportKeyword */));
+ case 248 /* NamespaceExportDeclaration */:
+ displayParts.push(ts.keywordPart(86 /* ExportKeyword */));
displayParts.push(ts.spacePart());
- displayParts.push(ts.keywordPart(131 /* NamespaceKeyword */));
+ displayParts.push(ts.keywordPart(132 /* NamespaceKeyword */));
break;
- case 254 /* ExportAssignment */:
- displayParts.push(ts.keywordPart(85 /* ExportKeyword */));
+ case 255 /* ExportAssignment */:
+ displayParts.push(ts.keywordPart(86 /* ExportKeyword */));
displayParts.push(ts.spacePart());
- displayParts.push(ts.keywordPart(symbol.declarations[0].isExportEquals ? 59 /* EqualsToken */ : 80 /* DefaultKeyword */));
+ displayParts.push(ts.keywordPart(symbol.declarations[0].isExportEquals ? 60 /* EqualsToken */ : 81 /* DefaultKeyword */));
break;
- case 257 /* ExportSpecifier */:
- displayParts.push(ts.keywordPart(85 /* ExportKeyword */));
+ case 258 /* ExportSpecifier */:
+ displayParts.push(ts.keywordPart(86 /* ExportKeyword */));
break;
default:
- displayParts.push(ts.keywordPart(92 /* ImportKeyword */));
+ displayParts.push(ts.keywordPart(93 /* ImportKeyword */));
}
displayParts.push(ts.spacePart());
addFullSymbolName(symbol);
ts.forEach(symbol.declarations, function (declaration) {
- if (declaration.kind === 248 /* ImportEqualsDeclaration */) {
+ if (declaration.kind === 249 /* ImportEqualsDeclaration */) {
var importEqualsDeclaration = declaration;
if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) {
displayParts.push(ts.spacePart());
- displayParts.push(ts.operatorPart(59 /* EqualsToken */));
+ displayParts.push(ts.operatorPart(60 /* EqualsToken */));
displayParts.push(ts.spacePart());
- displayParts.push(ts.keywordPart(134 /* RequireKeyword */));
+ displayParts.push(ts.keywordPart(135 /* RequireKeyword */));
displayParts.push(ts.punctuationPart(20 /* OpenParenToken */));
displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), ts.SymbolDisplayPartKind.stringLiteral));
displayParts.push(ts.punctuationPart(21 /* CloseParenToken */));
@@ -107867,7 +109091,7 @@
var internalAliasSymbol = typeChecker.getSymbolAtLocation(importEqualsDeclaration.moduleReference);
if (internalAliasSymbol) {
displayParts.push(ts.spacePart());
- displayParts.push(ts.operatorPart(59 /* EqualsToken */));
+ displayParts.push(ts.operatorPart(60 /* EqualsToken */));
displayParts.push(ts.spacePart());
addFullSymbolName(internalAliasSymbol, enclosingDeclaration);
}
@@ -107881,7 +109105,7 @@
if (type) {
if (isThisExpression) {
prefixNextMeaning();
- displayParts.push(ts.keywordPart(100 /* ThisKeyword */));
+ displayParts.push(ts.keywordPart(101 /* ThisKeyword */));
}
else {
addPrefixForAnyFunctionOrVar(symbol, symbolKind);
@@ -107930,10 +109154,10 @@
// For some special property access expressions like `exports.foo = foo` or `module.exports.foo = foo`
// there documentation comments might be attached to the right hand side symbol of their declarations.
// The pattern of such special property access is that the parent symbol is the symbol of the file.
- if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 284 /* SourceFile */; })) {
+ if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 285 /* SourceFile */; })) {
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (!declaration.parent || declaration.parent.kind !== 204 /* BinaryExpression */) {
+ if (!declaration.parent || declaration.parent.kind !== 205 /* BinaryExpression */) {
continue;
}
var rhsSymbol = typeChecker.getSymbolAtLocation(declaration.parent.right);
@@ -107976,7 +109200,7 @@
}
function addInPrefix() {
displayParts.push(ts.spacePart());
- displayParts.push(ts.keywordPart(93 /* InKeyword */));
+ displayParts.push(ts.keywordPart(94 /* InKeyword */));
displayParts.push(ts.spacePart());
}
function addFullSymbolName(symbolToDisplay, enclosingDeclaration) {
@@ -108046,16 +109270,16 @@
}
return ts.forEach(symbol.declarations, function (declaration) {
// Function expressions are local
- if (declaration.kind === 196 /* FunctionExpression */) {
+ if (declaration.kind === 197 /* FunctionExpression */) {
return true;
}
- if (declaration.kind !== 237 /* VariableDeclaration */ && declaration.kind !== 239 /* FunctionDeclaration */) {
+ if (declaration.kind !== 238 /* VariableDeclaration */ && declaration.kind !== 240 /* FunctionDeclaration */) {
return false;
}
// If the parent is not sourceFile or module block it is local variable
for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent) {
// Reached source file or module block
- if (parent.kind === 284 /* SourceFile */ || parent.kind === 245 /* ModuleBlock */) {
+ if (parent.kind === 285 /* SourceFile */ || parent.kind === 246 /* ModuleBlock */) {
return false;
}
}
@@ -108284,8 +109508,8 @@
(function (ts) {
var formatting;
(function (formatting) {
- var standardScanner = ts.createScanner(7 /* Latest */, /*skipTrivia*/ false, 0 /* Standard */);
- var jsxScanner = ts.createScanner(7 /* Latest */, /*skipTrivia*/ false, 1 /* JSX */);
+ var standardScanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false, 0 /* Standard */);
+ var jsxScanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false, 1 /* JSX */);
var ScanAction;
(function (ScanAction) {
ScanAction[ScanAction["Scan"] = 0] = "Scan";
@@ -108349,8 +109573,8 @@
function shouldRescanGreaterThanToken(node) {
switch (node.kind) {
case 32 /* GreaterThanEqualsToken */:
- case 67 /* GreaterThanGreaterThanEqualsToken */:
- case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
+ case 68 /* GreaterThanGreaterThanEqualsToken */:
+ case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
case 48 /* GreaterThanGreaterThanGreaterThanToken */:
case 47 /* GreaterThanGreaterThanToken */:
return true;
@@ -108360,12 +109584,12 @@
function shouldRescanJsxIdentifier(node) {
if (node.parent) {
switch (node.parent.kind) {
- case 267 /* JsxAttribute */:
- case 262 /* JsxOpeningElement */:
- case 263 /* JsxClosingElement */:
- case 261 /* JsxSelfClosingElement */:
+ case 268 /* JsxAttribute */:
+ case 263 /* JsxOpeningElement */:
+ case 264 /* JsxClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
// May parse an identifier like `module-layout`; that will be scanned as a keyword at first, but we should parse the whole thing to get an identifier.
- return ts.isKeyword(node.kind) || node.kind === 72 /* Identifier */;
+ return ts.isKeyword(node.kind) || node.kind === 73 /* Identifier */;
}
}
return false;
@@ -108381,7 +109605,7 @@
container.kind === 17 /* TemplateTail */;
}
function startsWithSlashToken(t) {
- return t === 42 /* SlashToken */ || t === 64 /* SlashEqualsToken */;
+ return t === 42 /* SlashToken */ || t === 65 /* SlashEqualsToken */;
}
function readTokenInfo(n) {
ts.Debug.assert(isOnToken());
@@ -108540,7 +109764,7 @@
(function (formatting) {
function getAllRules() {
var allTokens = [];
- for (var token = 0 /* FirstToken */; token <= 147 /* LastToken */; token++) {
+ for (var token = 0 /* FirstToken */; token <= 148 /* LastToken */; token++) {
allTokens.push(token);
}
function anyTokenExcept() {
@@ -108552,27 +109776,27 @@
}
var anyToken = { tokens: allTokens, isSpecific: false };
var anyTokenIncludingMultilineComments = tokenRangeFrom(allTokens.concat([3 /* MultiLineCommentTrivia */]));
- var keywords = tokenRangeFromRange(73 /* FirstKeyword */, 147 /* LastKeyword */);
- var binaryOperators = tokenRangeFromRange(28 /* FirstBinaryOperator */, 71 /* LastBinaryOperator */);
- var binaryKeywordOperators = [93 /* InKeyword */, 94 /* InstanceOfKeyword */, 147 /* OfKeyword */, 119 /* AsKeyword */, 128 /* IsKeyword */];
+ var keywords = tokenRangeFromRange(74 /* FirstKeyword */, 148 /* LastKeyword */);
+ var binaryOperators = tokenRangeFromRange(28 /* FirstBinaryOperator */, 72 /* LastBinaryOperator */);
+ var binaryKeywordOperators = [94 /* InKeyword */, 95 /* InstanceOfKeyword */, 148 /* OfKeyword */, 120 /* AsKeyword */, 129 /* IsKeyword */];
var unaryPrefixOperators = [44 /* PlusPlusToken */, 45 /* MinusMinusToken */, 53 /* TildeToken */, 52 /* ExclamationToken */];
var unaryPrefixExpressions = [
- 8 /* NumericLiteral */, 9 /* BigIntLiteral */, 72 /* Identifier */, 20 /* OpenParenToken */,
- 22 /* OpenBracketToken */, 18 /* OpenBraceToken */, 100 /* ThisKeyword */, 95 /* NewKeyword */
+ 8 /* NumericLiteral */, 9 /* BigIntLiteral */, 73 /* Identifier */, 20 /* OpenParenToken */,
+ 22 /* OpenBracketToken */, 18 /* OpenBraceToken */, 101 /* ThisKeyword */, 96 /* NewKeyword */
];
- var unaryPreincrementExpressions = [72 /* Identifier */, 20 /* OpenParenToken */, 100 /* ThisKeyword */, 95 /* NewKeyword */];
- var unaryPostincrementExpressions = [72 /* Identifier */, 21 /* CloseParenToken */, 23 /* CloseBracketToken */, 95 /* NewKeyword */];
- var unaryPredecrementExpressions = [72 /* Identifier */, 20 /* OpenParenToken */, 100 /* ThisKeyword */, 95 /* NewKeyword */];
- var unaryPostdecrementExpressions = [72 /* Identifier */, 21 /* CloseParenToken */, 23 /* CloseBracketToken */, 95 /* NewKeyword */];
+ var unaryPreincrementExpressions = [73 /* Identifier */, 20 /* OpenParenToken */, 101 /* ThisKeyword */, 96 /* NewKeyword */];
+ var unaryPostincrementExpressions = [73 /* Identifier */, 21 /* CloseParenToken */, 23 /* CloseBracketToken */, 96 /* NewKeyword */];
+ var unaryPredecrementExpressions = [73 /* Identifier */, 20 /* OpenParenToken */, 101 /* ThisKeyword */, 96 /* NewKeyword */];
+ var unaryPostdecrementExpressions = [73 /* Identifier */, 21 /* CloseParenToken */, 23 /* CloseBracketToken */, 96 /* NewKeyword */];
var comments = [2 /* SingleLineCommentTrivia */, 3 /* MultiLineCommentTrivia */];
- var typeNames = [72 /* Identifier */].concat(ts.typeKeywords);
+ var typeNames = [73 /* Identifier */].concat(ts.typeKeywords);
// Place a space before open brace in a function declaration
// TypeScript: Function can have return types, which can be made of tons of different token kinds
var functionOpenBraceLeftTokenRange = anyTokenIncludingMultilineComments;
// Place a space before open brace in a TypeScript declaration that has braces as children (class, module, enum, etc)
- var typeScriptOpenBraceLeftTokenRange = tokenRangeFrom([72 /* Identifier */, 3 /* MultiLineCommentTrivia */, 76 /* ClassKeyword */, 85 /* ExportKeyword */, 92 /* ImportKeyword */]);
+ var typeScriptOpenBraceLeftTokenRange = tokenRangeFrom([73 /* Identifier */, 3 /* MultiLineCommentTrivia */, 77 /* ClassKeyword */, 86 /* ExportKeyword */, 93 /* ImportKeyword */]);
// Place a space before open brace in a control flow construct
- var controlOpenBraceLeftTokenRange = tokenRangeFrom([21 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 82 /* DoKeyword */, 103 /* TryKeyword */, 88 /* FinallyKeyword */, 83 /* ElseKeyword */]);
+ var controlOpenBraceLeftTokenRange = tokenRangeFrom([21 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 83 /* DoKeyword */, 104 /* TryKeyword */, 89 /* FinallyKeyword */, 84 /* ElseKeyword */]);
// These rules are higher in priority than user-configurable
var highPriorityCommonRules = [
// Leave comments alone
@@ -108587,7 +109811,7 @@
rule("NoSpaceAfterQuestionMark", 56 /* QuestionToken */, anyToken, [isNonJsxSameLineTokenContext], 8 /* Delete */),
rule("NoSpaceBeforeDot", anyToken, 24 /* DotToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
rule("NoSpaceAfterDot", 24 /* DotToken */, anyToken, [isNonJsxSameLineTokenContext], 8 /* Delete */),
- rule("NoSpaceBetweenImportParenInImportType", 92 /* ImportKeyword */, 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext, isImportTypeContext], 8 /* Delete */),
+ rule("NoSpaceBetweenImportParenInImportType", 93 /* ImportKeyword */, 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext, isImportTypeContext], 8 /* Delete */),
// Special handling of unary operators.
// Prefix operators generally shouldn't have a space between
// them and their target unary expression.
@@ -108614,79 +109838,79 @@
rule("SpaceAfterCloseBrace", 19 /* CloseBraceToken */, anyTokenExcept(21 /* CloseParenToken */), [isNonJsxSameLineTokenContext, isAfterCodeBlockContext], 2 /* Space */),
// Special case for (}, else) and (}, while) since else & while tokens are not part of the tree which makes SpaceAfterCloseBrace rule not applied
// Also should not apply to })
- rule("SpaceBetweenCloseBraceAndElse", 19 /* CloseBraceToken */, 83 /* ElseKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */),
- rule("SpaceBetweenCloseBraceAndWhile", 19 /* CloseBraceToken */, 107 /* WhileKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceBetweenCloseBraceAndElse", 19 /* CloseBraceToken */, 84 /* ElseKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceBetweenCloseBraceAndWhile", 19 /* CloseBraceToken */, 108 /* WhileKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */),
rule("NoSpaceBetweenEmptyBraceBrackets", 18 /* OpenBraceToken */, 19 /* CloseBraceToken */, [isNonJsxSameLineTokenContext, isObjectContext], 8 /* Delete */),
// Add a space after control dec context if the next character is an open bracket ex: 'if (false)[a, b] = [1, 2];' -> 'if (false) [a, b] = [1, 2];'
rule("SpaceAfterConditionalClosingParen", 21 /* CloseParenToken */, 22 /* OpenBracketToken */, [isControlDeclContext], 2 /* Space */),
- rule("NoSpaceBetweenFunctionKeywordAndStar", 90 /* FunctionKeyword */, 40 /* AsteriskToken */, [isFunctionDeclarationOrFunctionExpressionContext], 8 /* Delete */),
- rule("SpaceAfterStarInGeneratorDeclaration", 40 /* AsteriskToken */, [72 /* Identifier */, 20 /* OpenParenToken */], [isFunctionDeclarationOrFunctionExpressionContext], 2 /* Space */),
- rule("SpaceAfterFunctionInFuncDecl", 90 /* FunctionKeyword */, anyToken, [isFunctionDeclContext], 2 /* Space */),
+ rule("NoSpaceBetweenFunctionKeywordAndStar", 91 /* FunctionKeyword */, 40 /* AsteriskToken */, [isFunctionDeclarationOrFunctionExpressionContext], 8 /* Delete */),
+ rule("SpaceAfterStarInGeneratorDeclaration", 40 /* AsteriskToken */, 73 /* Identifier */, [isFunctionDeclarationOrFunctionExpressionContext], 2 /* Space */),
+ rule("SpaceAfterFunctionInFuncDecl", 91 /* FunctionKeyword */, anyToken, [isFunctionDeclContext], 2 /* Space */),
// Insert new line after { and before } in multi-line contexts.
rule("NewLineAfterOpenBraceInBlockContext", 18 /* OpenBraceToken */, anyToken, [isMultilineBlockContext], 4 /* NewLine */),
// For get/set members, we check for (identifier,identifier) since get/set don't have tokens and they are represented as just an identifier token.
// Though, we do extra check on the context to make sure we are dealing with get/set node. Example:
// get x() {}
// set x(val) {}
- rule("SpaceAfterGetSetInMember", [126 /* GetKeyword */, 137 /* SetKeyword */], 72 /* Identifier */, [isFunctionDeclContext], 2 /* Space */),
- rule("NoSpaceBetweenYieldKeywordAndStar", 117 /* YieldKeyword */, 40 /* AsteriskToken */, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 8 /* Delete */),
- rule("SpaceBetweenYieldOrYieldStarAndOperand", [117 /* YieldKeyword */, 40 /* AsteriskToken */], anyToken, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 2 /* Space */),
- rule("NoSpaceBetweenReturnAndSemicolon", 97 /* ReturnKeyword */, 26 /* SemicolonToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
- rule("SpaceAfterCertainKeywords", [105 /* VarKeyword */, 101 /* ThrowKeyword */, 95 /* NewKeyword */, 81 /* DeleteKeyword */, 97 /* ReturnKeyword */, 104 /* TypeOfKeyword */, 122 /* AwaitKeyword */], anyToken, [isNonJsxSameLineTokenContext], 2 /* Space */),
- rule("SpaceAfterLetConstInVariableDeclaration", [111 /* LetKeyword */, 77 /* ConstKeyword */], anyToken, [isNonJsxSameLineTokenContext, isStartOfVariableDeclarationList], 2 /* Space */),
+ rule("SpaceAfterGetSetInMember", [127 /* GetKeyword */, 138 /* SetKeyword */], 73 /* Identifier */, [isFunctionDeclContext], 2 /* Space */),
+ rule("NoSpaceBetweenYieldKeywordAndStar", 118 /* YieldKeyword */, 40 /* AsteriskToken */, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 8 /* Delete */),
+ rule("SpaceBetweenYieldOrYieldStarAndOperand", [118 /* YieldKeyword */, 40 /* AsteriskToken */], anyToken, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 2 /* Space */),
+ rule("NoSpaceBetweenReturnAndSemicolon", 98 /* ReturnKeyword */, 26 /* SemicolonToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
+ rule("SpaceAfterCertainKeywords", [106 /* VarKeyword */, 102 /* ThrowKeyword */, 96 /* NewKeyword */, 82 /* DeleteKeyword */, 98 /* ReturnKeyword */, 105 /* TypeOfKeyword */, 123 /* AwaitKeyword */], anyToken, [isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceAfterLetConstInVariableDeclaration", [112 /* LetKeyword */, 78 /* ConstKeyword */], anyToken, [isNonJsxSameLineTokenContext, isStartOfVariableDeclarationList], 2 /* Space */),
rule("NoSpaceBeforeOpenParenInFuncCall", anyToken, 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext, isFunctionCallOrNewContext, isPreviousTokenNotComma], 8 /* Delete */),
// Special case for binary operators (that are keywords). For these we have to add a space and shouldn't follow any user options.
rule("SpaceBeforeBinaryKeywordOperator", anyToken, binaryKeywordOperators, [isNonJsxSameLineTokenContext, isBinaryOpContext], 2 /* Space */),
rule("SpaceAfterBinaryKeywordOperator", binaryKeywordOperators, anyToken, [isNonJsxSameLineTokenContext, isBinaryOpContext], 2 /* Space */),
- rule("SpaceAfterVoidOperator", 106 /* VoidKeyword */, anyToken, [isNonJsxSameLineTokenContext, isVoidOpContext], 2 /* Space */),
+ rule("SpaceAfterVoidOperator", 107 /* VoidKeyword */, anyToken, [isNonJsxSameLineTokenContext, isVoidOpContext], 2 /* Space */),
// Async-await
- rule("SpaceBetweenAsyncAndOpenParen", 121 /* AsyncKeyword */, 20 /* OpenParenToken */, [isArrowFunctionContext, isNonJsxSameLineTokenContext], 2 /* Space */),
- rule("SpaceBetweenAsyncAndFunctionKeyword", 121 /* AsyncKeyword */, 90 /* FunctionKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceBetweenAsyncAndOpenParen", 122 /* AsyncKeyword */, 20 /* OpenParenToken */, [isArrowFunctionContext, isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceBetweenAsyncAndFunctionKeyword", 122 /* AsyncKeyword */, 91 /* FunctionKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */),
// Template string
- rule("NoSpaceBetweenTagAndTemplateString", [72 /* Identifier */, 21 /* CloseParenToken */], [14 /* NoSubstitutionTemplateLiteral */, 15 /* TemplateHead */], [isNonJsxSameLineTokenContext], 8 /* Delete */),
+ rule("NoSpaceBetweenTagAndTemplateString", [73 /* Identifier */, 21 /* CloseParenToken */], [14 /* NoSubstitutionTemplateLiteral */, 15 /* TemplateHead */], [isNonJsxSameLineTokenContext], 8 /* Delete */),
// JSX opening elements
- rule("SpaceBeforeJsxAttribute", anyToken, 72 /* Identifier */, [isNextTokenParentJsxAttribute, isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceBeforeJsxAttribute", anyToken, 73 /* Identifier */, [isNextTokenParentJsxAttribute, isNonJsxSameLineTokenContext], 2 /* Space */),
rule("SpaceBeforeSlashInJsxOpeningElement", anyToken, 42 /* SlashToken */, [isJsxSelfClosingElementContext, isNonJsxSameLineTokenContext], 2 /* Space */),
rule("NoSpaceBeforeGreaterThanTokenInJsxOpeningElement", 42 /* SlashToken */, 30 /* GreaterThanToken */, [isJsxSelfClosingElementContext, isNonJsxSameLineTokenContext], 8 /* Delete */),
- rule("NoSpaceBeforeEqualInJsxAttribute", anyToken, 59 /* EqualsToken */, [isJsxAttributeContext, isNonJsxSameLineTokenContext], 8 /* Delete */),
- rule("NoSpaceAfterEqualInJsxAttribute", 59 /* EqualsToken */, anyToken, [isJsxAttributeContext, isNonJsxSameLineTokenContext], 8 /* Delete */),
+ rule("NoSpaceBeforeEqualInJsxAttribute", anyToken, 60 /* EqualsToken */, [isJsxAttributeContext, isNonJsxSameLineTokenContext], 8 /* Delete */),
+ rule("NoSpaceAfterEqualInJsxAttribute", 60 /* EqualsToken */, anyToken, [isJsxAttributeContext, isNonJsxSameLineTokenContext], 8 /* Delete */),
// TypeScript-specific rules
// Use of module as a function call. e.g.: import m2 = module("m2");
- rule("NoSpaceAfterModuleImport", [130 /* ModuleKeyword */, 134 /* RequireKeyword */], 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
+ rule("NoSpaceAfterModuleImport", [131 /* ModuleKeyword */, 135 /* RequireKeyword */], 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
// Add a space around certain TypeScript keywords
rule("SpaceAfterCertainTypeScriptKeywords", [
- 118 /* AbstractKeyword */,
- 76 /* ClassKeyword */,
- 125 /* DeclareKeyword */,
- 80 /* DefaultKeyword */,
- 84 /* EnumKeyword */,
- 85 /* ExportKeyword */,
- 86 /* ExtendsKeyword */,
- 126 /* GetKeyword */,
- 109 /* ImplementsKeyword */,
- 92 /* ImportKeyword */,
- 110 /* InterfaceKeyword */,
- 130 /* ModuleKeyword */,
- 131 /* NamespaceKeyword */,
- 113 /* PrivateKeyword */,
- 115 /* PublicKeyword */,
- 114 /* ProtectedKeyword */,
- 133 /* ReadonlyKeyword */,
- 137 /* SetKeyword */,
- 116 /* StaticKeyword */,
- 140 /* TypeKeyword */,
- 144 /* FromKeyword */,
- 129 /* KeyOfKeyword */,
- 127 /* InferKeyword */,
+ 119 /* AbstractKeyword */,
+ 77 /* ClassKeyword */,
+ 126 /* DeclareKeyword */,
+ 81 /* DefaultKeyword */,
+ 85 /* EnumKeyword */,
+ 86 /* ExportKeyword */,
+ 87 /* ExtendsKeyword */,
+ 127 /* GetKeyword */,
+ 110 /* ImplementsKeyword */,
+ 93 /* ImportKeyword */,
+ 111 /* InterfaceKeyword */,
+ 131 /* ModuleKeyword */,
+ 132 /* NamespaceKeyword */,
+ 114 /* PrivateKeyword */,
+ 116 /* PublicKeyword */,
+ 115 /* ProtectedKeyword */,
+ 134 /* ReadonlyKeyword */,
+ 138 /* SetKeyword */,
+ 117 /* StaticKeyword */,
+ 141 /* TypeKeyword */,
+ 145 /* FromKeyword */,
+ 130 /* KeyOfKeyword */,
+ 128 /* InferKeyword */,
], anyToken, [isNonJsxSameLineTokenContext], 2 /* Space */),
- rule("SpaceBeforeCertainTypeScriptKeywords", anyToken, [86 /* ExtendsKeyword */, 109 /* ImplementsKeyword */, 144 /* FromKeyword */], [isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceBeforeCertainTypeScriptKeywords", anyToken, [87 /* ExtendsKeyword */, 110 /* ImplementsKeyword */, 145 /* FromKeyword */], [isNonJsxSameLineTokenContext], 2 /* Space */),
// Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" {
rule("SpaceAfterModuleName", 10 /* StringLiteral */, 18 /* OpenBraceToken */, [isModuleDeclContext], 2 /* Space */),
// Lambda expressions
rule("SpaceBeforeArrow", anyToken, 37 /* EqualsGreaterThanToken */, [isNonJsxSameLineTokenContext], 2 /* Space */),
rule("SpaceAfterArrow", 37 /* EqualsGreaterThanToken */, anyToken, [isNonJsxSameLineTokenContext], 2 /* Space */),
// Optional parameters and let args
- rule("NoSpaceAfterEllipsis", 25 /* DotDotDotToken */, 72 /* Identifier */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
+ rule("NoSpaceAfterEllipsis", 25 /* DotDotDotToken */, 73 /* Identifier */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
rule("NoSpaceAfterOptionalParameters", 56 /* QuestionToken */, [21 /* CloseParenToken */, 27 /* CommaToken */], [isNonJsxSameLineTokenContext, isNotBinaryOpContext], 8 /* Delete */),
// Remove spaces in empty interface literals. e.g.: x: {}
rule("NoSpaceBetweenEmptyInterfaceBraceBrackets", 18 /* OpenBraceToken */, 19 /* CloseBraceToken */, [isNonJsxSameLineTokenContext, isObjectTypeContext], 8 /* Delete */),
@@ -108697,37 +109921,37 @@
rule("NoSpaceBeforeCloseAngularBracket", anyToken, 30 /* GreaterThanToken */, [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 8 /* Delete */),
rule("NoSpaceAfterCloseAngularBracket", 30 /* GreaterThanToken */, [20 /* OpenParenToken */, 22 /* OpenBracketToken */, 30 /* GreaterThanToken */, 27 /* CommaToken */], [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext, isNotFunctionDeclContext /*To prevent an interference with the SpaceBeforeOpenParenInFuncDecl rule*/], 8 /* Delete */),
// decorators
- rule("SpaceBeforeAt", [21 /* CloseParenToken */, 72 /* Identifier */], 58 /* AtToken */, [isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceBeforeAt", [21 /* CloseParenToken */, 73 /* Identifier */], 58 /* AtToken */, [isNonJsxSameLineTokenContext], 2 /* Space */),
rule("NoSpaceAfterAt", 58 /* AtToken */, anyToken, [isNonJsxSameLineTokenContext], 8 /* Delete */),
// Insert space after @ in decorator
rule("SpaceAfterDecorator", anyToken, [
- 118 /* AbstractKeyword */,
- 72 /* Identifier */,
- 85 /* ExportKeyword */,
- 80 /* DefaultKeyword */,
- 76 /* ClassKeyword */,
- 116 /* StaticKeyword */,
- 115 /* PublicKeyword */,
- 113 /* PrivateKeyword */,
- 114 /* ProtectedKeyword */,
- 126 /* GetKeyword */,
- 137 /* SetKeyword */,
+ 119 /* AbstractKeyword */,
+ 73 /* Identifier */,
+ 86 /* ExportKeyword */,
+ 81 /* DefaultKeyword */,
+ 77 /* ClassKeyword */,
+ 117 /* StaticKeyword */,
+ 116 /* PublicKeyword */,
+ 114 /* PrivateKeyword */,
+ 115 /* ProtectedKeyword */,
+ 127 /* GetKeyword */,
+ 138 /* SetKeyword */,
22 /* OpenBracketToken */,
40 /* AsteriskToken */,
], [isEndOfDecoratorContextOnSameLine], 2 /* Space */),
rule("NoSpaceBeforeNonNullAssertionOperator", anyToken, 52 /* ExclamationToken */, [isNonJsxSameLineTokenContext, isNonNullAssertionContext], 8 /* Delete */),
- rule("NoSpaceAfterNewKeywordOnConstructorSignature", 95 /* NewKeyword */, 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext, isConstructorSignatureContext], 8 /* Delete */),
+ rule("NoSpaceAfterNewKeywordOnConstructorSignature", 96 /* NewKeyword */, 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext, isConstructorSignatureContext], 8 /* Delete */),
];
// These rules are applied after high priority
var userConfigurableRules = [
// Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses
- rule("SpaceAfterConstructor", 124 /* ConstructorKeyword */, 20 /* OpenParenToken */, [isOptionEnabled("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 2 /* Space */),
- rule("NoSpaceAfterConstructor", 124 /* ConstructorKeyword */, 20 /* OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 8 /* Delete */),
+ rule("SpaceAfterConstructor", 125 /* ConstructorKeyword */, 20 /* OpenParenToken */, [isOptionEnabled("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("NoSpaceAfterConstructor", 125 /* ConstructorKeyword */, 20 /* OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 8 /* Delete */),
rule("SpaceAfterComma", 27 /* CommaToken */, anyToken, [isOptionEnabled("insertSpaceAfterCommaDelimiter"), isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNextTokenNotCloseBracket], 2 /* Space */),
rule("NoSpaceAfterComma", 27 /* CommaToken */, anyToken, [isOptionDisabledOrUndefined("insertSpaceAfterCommaDelimiter"), isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext], 8 /* Delete */),
// Insert space after function keyword for anonymous functions
- rule("SpaceAfterAnonymousFunctionKeyword", 90 /* FunctionKeyword */, 20 /* OpenParenToken */, [isOptionEnabled("insertSpaceAfterFunctionKeywordForAnonymousFunctions"), isFunctionDeclContext], 2 /* Space */),
- rule("NoSpaceAfterAnonymousFunctionKeyword", 90 /* FunctionKeyword */, 20 /* OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterFunctionKeywordForAnonymousFunctions"), isFunctionDeclContext], 8 /* Delete */),
+ rule("SpaceAfterAnonymousFunctionKeyword", [91 /* FunctionKeyword */, 40 /* AsteriskToken */], 20 /* OpenParenToken */, [isOptionEnabled("insertSpaceAfterFunctionKeywordForAnonymousFunctions"), isFunctionDeclContext], 2 /* Space */),
+ rule("NoSpaceAfterAnonymousFunctionKeyword", [91 /* FunctionKeyword */, 40 /* AsteriskToken */], 20 /* OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterFunctionKeywordForAnonymousFunctions"), isFunctionDeclContext], 8 /* Delete */),
// Insert space after keywords in control flow statements
rule("SpaceAfterKeywordInControl", keywords, 20 /* OpenParenToken */, [isOptionEnabled("insertSpaceAfterKeywordsInControlFlowStatements"), isControlDeclContext], 2 /* Space */),
rule("NoSpaceAfterKeywordInControl", keywords, 20 /* OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterKeywordsInControlFlowStatements"), isControlDeclContext], 8 /* Delete */),
@@ -108791,16 +110015,16 @@
rule("SpaceBeforeOpenBraceInTypeScriptDeclWithBlock", typeScriptOpenBraceLeftTokenRange, 18 /* OpenBraceToken */, [isOptionDisabledOrUndefinedOrTokensOnSameLine("placeOpenBraceOnNewLineForFunctions"), isTypeScriptDeclWithBlockContext, isNotFormatOnEnter, isSameLineTokenOrBeforeBlockContext], 2 /* Space */, 1 /* CanDeleteNewLines */),
rule("NoSpaceBeforeComma", anyToken, 27 /* CommaToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
// No space before and after indexer `x[]`
- rule("NoSpaceBeforeOpenBracket", anyTokenExcept(121 /* AsyncKeyword */, 74 /* CaseKeyword */), 22 /* OpenBracketToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
+ rule("NoSpaceBeforeOpenBracket", anyTokenExcept(122 /* AsyncKeyword */, 75 /* CaseKeyword */), 22 /* OpenBracketToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
rule("NoSpaceAfterCloseBracket", 23 /* CloseBracketToken */, anyToken, [isNonJsxSameLineTokenContext, isNotBeforeBlockInFunctionDeclarationContext], 8 /* Delete */),
rule("SpaceAfterSemicolon", 26 /* SemicolonToken */, anyToken, [isNonJsxSameLineTokenContext], 2 /* Space */),
// Remove extra space between for and await
- rule("SpaceBetweenForAndAwaitKeyword", 89 /* ForKeyword */, 122 /* AwaitKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceBetweenForAndAwaitKeyword", 90 /* ForKeyword */, 123 /* AwaitKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */),
// Add a space between statements. All keywords except (do,else,case) has open/close parens after them.
// So, we have a rule to add a space for [),Any], [do,Any], [else,Any], and [case,Any]
- rule("SpaceBetweenStatements", [21 /* CloseParenToken */, 82 /* DoKeyword */, 83 /* ElseKeyword */, 74 /* CaseKeyword */], anyToken, [isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNotForContext], 2 /* Space */),
+ rule("SpaceBetweenStatements", [21 /* CloseParenToken */, 83 /* DoKeyword */, 84 /* ElseKeyword */, 75 /* CaseKeyword */], anyToken, [isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNotForContext], 2 /* Space */),
// This low-pri rule takes care of "try {" and "finally {" in case the rule SpaceBeforeOpenBraceInControl didn't execute on FormatOnEnter.
- rule("SpaceAfterTryFinally", [103 /* TryKeyword */, 88 /* FinallyKeyword */], 18 /* OpenBraceToken */, [isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceAfterTryFinally", [104 /* TryKeyword */, 89 /* FinallyKeyword */], 18 /* OpenBraceToken */, [isNonJsxSameLineTokenContext], 2 /* Space */),
];
return highPriorityCommonRules.concat(userConfigurableRules, lowPriorityCommonRules);
}
@@ -108844,45 +110068,45 @@
return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !!context.options[optionName]; };
}
function isForContext(context) {
- return context.contextNode.kind === 225 /* ForStatement */;
+ return context.contextNode.kind === 226 /* ForStatement */;
}
function isNotForContext(context) {
return !isForContext(context);
}
function isBinaryOpContext(context) {
switch (context.contextNode.kind) {
- case 204 /* BinaryExpression */:
- case 205 /* ConditionalExpression */:
- case 175 /* ConditionalType */:
- case 212 /* AsExpression */:
- case 257 /* ExportSpecifier */:
- case 253 /* ImportSpecifier */:
- case 163 /* TypePredicate */:
- case 173 /* UnionType */:
- case 174 /* IntersectionType */:
+ case 205 /* BinaryExpression */:
+ case 206 /* ConditionalExpression */:
+ case 176 /* ConditionalType */:
+ case 213 /* AsExpression */:
+ case 258 /* ExportSpecifier */:
+ case 254 /* ImportSpecifier */:
+ case 164 /* TypePredicate */:
+ case 174 /* UnionType */:
+ case 175 /* IntersectionType */:
return true;
// equals in binding elements: function foo([[x, y] = [1, 2]])
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
// equals in type X = ...
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
// equal in import a = module('a');
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
// equal in let a = 0;
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
// equal in p = 0;
- case 151 /* Parameter */:
- case 278 /* EnumMember */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- return context.currentTokenSpan.kind === 59 /* EqualsToken */ || context.nextTokenSpan.kind === 59 /* EqualsToken */;
+ case 152 /* Parameter */:
+ case 279 /* EnumMember */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ return context.currentTokenSpan.kind === 60 /* EqualsToken */ || context.nextTokenSpan.kind === 60 /* EqualsToken */;
// "in" keyword in for (let x in []) { }
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
// "in" keyword in [P in keyof T]: T[P]
- case 150 /* TypeParameter */:
- return context.currentTokenSpan.kind === 93 /* InKeyword */ || context.nextTokenSpan.kind === 93 /* InKeyword */ || context.currentTokenSpan.kind === 59 /* EqualsToken */ || context.nextTokenSpan.kind === 59 /* EqualsToken */;
+ case 151 /* TypeParameter */:
+ return context.currentTokenSpan.kind === 94 /* InKeyword */ || context.nextTokenSpan.kind === 94 /* InKeyword */ || context.currentTokenSpan.kind === 60 /* EqualsToken */ || context.nextTokenSpan.kind === 60 /* EqualsToken */;
// Technically, "of" is not a binary operator, but format it the same way as "in"
- case 227 /* ForOfStatement */:
- return context.currentTokenSpan.kind === 147 /* OfKeyword */ || context.nextTokenSpan.kind === 147 /* OfKeyword */;
+ case 228 /* ForOfStatement */:
+ return context.currentTokenSpan.kind === 148 /* OfKeyword */ || context.nextTokenSpan.kind === 148 /* OfKeyword */;
}
return false;
}
@@ -108894,22 +110118,22 @@
}
function isTypeAnnotationContext(context) {
var contextKind = context.contextNode.kind;
- return contextKind === 154 /* PropertyDeclaration */ ||
- contextKind === 153 /* PropertySignature */ ||
- contextKind === 151 /* Parameter */ ||
- contextKind === 237 /* VariableDeclaration */ ||
+ return contextKind === 155 /* PropertyDeclaration */ ||
+ contextKind === 154 /* PropertySignature */ ||
+ contextKind === 152 /* Parameter */ ||
+ contextKind === 238 /* VariableDeclaration */ ||
ts.isFunctionLikeKind(contextKind);
}
function isConditionalOperatorContext(context) {
- return context.contextNode.kind === 205 /* ConditionalExpression */ ||
- context.contextNode.kind === 175 /* ConditionalType */;
+ return context.contextNode.kind === 206 /* ConditionalExpression */ ||
+ context.contextNode.kind === 176 /* ConditionalType */;
}
function isSameLineTokenOrBeforeBlockContext(context) {
return context.TokensAreOnSameLine() || isBeforeBlockContext(context);
}
function isBraceWrappedContext(context) {
- return context.contextNode.kind === 184 /* ObjectBindingPattern */ ||
- context.contextNode.kind === 181 /* MappedType */ ||
+ return context.contextNode.kind === 185 /* ObjectBindingPattern */ ||
+ context.contextNode.kind === 182 /* MappedType */ ||
isSingleLineBlockContext(context);
}
// This check is done before an open brace in a control construct, a function, or a typescript block declaration
@@ -108935,31 +110159,31 @@
return true;
}
switch (node.kind) {
- case 218 /* Block */:
- case 246 /* CaseBlock */:
- case 188 /* ObjectLiteralExpression */:
- case 245 /* ModuleBlock */:
+ case 219 /* Block */:
+ case 247 /* CaseBlock */:
+ case 189 /* ObjectLiteralExpression */:
+ case 246 /* ModuleBlock */:
return true;
}
return false;
}
function isFunctionDeclContext(context) {
switch (context.contextNode.kind) {
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 240 /* FunctionDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
// case SyntaxKind.MemberFunctionDeclaration:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
// case SyntaxKind.MethodSignature:
- case 160 /* CallSignature */:
- case 196 /* FunctionExpression */:
- case 157 /* Constructor */:
- case 197 /* ArrowFunction */:
+ case 161 /* CallSignature */:
+ case 197 /* FunctionExpression */:
+ case 158 /* Constructor */:
+ case 198 /* ArrowFunction */:
// case SyntaxKind.ConstructorDeclaration:
// case SyntaxKind.SimpleArrowFunctionExpression:
// case SyntaxKind.ParenthesizedArrowFunctionExpression:
- case 241 /* InterfaceDeclaration */: // This one is not truly a function, but for formatting purposes, it acts just like one
+ case 242 /* InterfaceDeclaration */: // This one is not truly a function, but for formatting purposes, it acts just like one
return true;
}
return false;
@@ -108968,40 +110192,40 @@
return !isFunctionDeclContext(context);
}
function isFunctionDeclarationOrFunctionExpressionContext(context) {
- return context.contextNode.kind === 239 /* FunctionDeclaration */ || context.contextNode.kind === 196 /* FunctionExpression */;
+ return context.contextNode.kind === 240 /* FunctionDeclaration */ || context.contextNode.kind === 197 /* FunctionExpression */;
}
function isTypeScriptDeclWithBlockContext(context) {
return nodeIsTypeScriptDeclWithBlockContext(context.contextNode);
}
function nodeIsTypeScriptDeclWithBlockContext(node) {
switch (node.kind) {
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
- case 168 /* TypeLiteral */:
- case 244 /* ModuleDeclaration */:
- case 255 /* ExportDeclaration */:
- case 256 /* NamedExports */:
- case 249 /* ImportDeclaration */:
- case 252 /* NamedImports */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 169 /* TypeLiteral */:
+ case 245 /* ModuleDeclaration */:
+ case 256 /* ExportDeclaration */:
+ case 257 /* NamedExports */:
+ case 250 /* ImportDeclaration */:
+ case 253 /* NamedImports */:
return true;
}
return false;
}
function isAfterCodeBlockContext(context) {
switch (context.currentTokenParent.kind) {
- case 240 /* ClassDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 243 /* EnumDeclaration */:
- case 274 /* CatchClause */:
- case 245 /* ModuleBlock */:
- case 232 /* SwitchStatement */:
+ case 241 /* ClassDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 275 /* CatchClause */:
+ case 246 /* ModuleBlock */:
+ case 233 /* SwitchStatement */:
return true;
- case 218 /* Block */: {
+ case 219 /* Block */: {
var blockParent = context.currentTokenParent.parent;
// In a codefix scenario, we can't rely on parents being set. So just always return true.
- if (!blockParent || blockParent.kind !== 197 /* ArrowFunction */ && blockParent.kind !== 196 /* FunctionExpression */) {
+ if (!blockParent || blockParent.kind !== 198 /* ArrowFunction */ && blockParent.kind !== 197 /* FunctionExpression */) {
return true;
}
}
@@ -109010,31 +110234,31 @@
}
function isControlDeclContext(context) {
switch (context.contextNode.kind) {
- case 222 /* IfStatement */:
- case 232 /* SwitchStatement */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 224 /* WhileStatement */:
- case 235 /* TryStatement */:
- case 223 /* DoStatement */:
- case 231 /* WithStatement */:
+ case 223 /* IfStatement */:
+ case 233 /* SwitchStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 225 /* WhileStatement */:
+ case 236 /* TryStatement */:
+ case 224 /* DoStatement */:
+ case 232 /* WithStatement */:
// TODO
// case SyntaxKind.ElseClause:
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return true;
default:
return false;
}
}
function isObjectContext(context) {
- return context.contextNode.kind === 188 /* ObjectLiteralExpression */;
+ return context.contextNode.kind === 189 /* ObjectLiteralExpression */;
}
function isFunctionCallContext(context) {
- return context.contextNode.kind === 191 /* CallExpression */;
+ return context.contextNode.kind === 192 /* CallExpression */;
}
function isNewContext(context) {
- return context.contextNode.kind === 192 /* NewExpression */;
+ return context.contextNode.kind === 193 /* NewExpression */;
}
function isFunctionCallOrNewContext(context) {
return isFunctionCallContext(context) || isNewContext(context);
@@ -109046,28 +110270,28 @@
return context.nextTokenSpan.kind !== 23 /* CloseBracketToken */;
}
function isArrowFunctionContext(context) {
- return context.contextNode.kind === 197 /* ArrowFunction */;
+ return context.contextNode.kind === 198 /* ArrowFunction */;
}
function isImportTypeContext(context) {
- return context.contextNode.kind === 183 /* ImportType */;
+ return context.contextNode.kind === 184 /* ImportType */;
}
function isNonJsxSameLineTokenContext(context) {
return context.TokensAreOnSameLine() && context.contextNode.kind !== 11 /* JsxText */;
}
function isNonJsxElementOrFragmentContext(context) {
- return context.contextNode.kind !== 260 /* JsxElement */ && context.contextNode.kind !== 264 /* JsxFragment */;
+ return context.contextNode.kind !== 261 /* JsxElement */ && context.contextNode.kind !== 265 /* JsxFragment */;
}
function isJsxExpressionContext(context) {
- return context.contextNode.kind === 270 /* JsxExpression */ || context.contextNode.kind === 269 /* JsxSpreadAttribute */;
+ return context.contextNode.kind === 271 /* JsxExpression */ || context.contextNode.kind === 270 /* JsxSpreadAttribute */;
}
function isNextTokenParentJsxAttribute(context) {
- return context.nextTokenParent.kind === 267 /* JsxAttribute */;
+ return context.nextTokenParent.kind === 268 /* JsxAttribute */;
}
function isJsxAttributeContext(context) {
- return context.contextNode.kind === 267 /* JsxAttribute */;
+ return context.contextNode.kind === 268 /* JsxAttribute */;
}
function isJsxSelfClosingElementContext(context) {
- return context.contextNode.kind === 261 /* JsxSelfClosingElement */;
+ return context.contextNode.kind === 262 /* JsxSelfClosingElement */;
}
function isNotBeforeBlockInFunctionDeclarationContext(context) {
return !isFunctionDeclContext(context) && !isBeforeBlockContext(context);
@@ -109082,45 +110306,45 @@
while (ts.isExpressionNode(node)) {
node = node.parent;
}
- return node.kind === 152 /* Decorator */;
+ return node.kind === 153 /* Decorator */;
}
function isStartOfVariableDeclarationList(context) {
- return context.currentTokenParent.kind === 238 /* VariableDeclarationList */ &&
+ return context.currentTokenParent.kind === 239 /* VariableDeclarationList */ &&
context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos;
}
function isNotFormatOnEnter(context) {
return context.formattingRequestKind !== 2 /* FormatOnEnter */;
}
function isModuleDeclContext(context) {
- return context.contextNode.kind === 244 /* ModuleDeclaration */;
+ return context.contextNode.kind === 245 /* ModuleDeclaration */;
}
function isObjectTypeContext(context) {
- return context.contextNode.kind === 168 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration;
+ return context.contextNode.kind === 169 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration;
}
function isConstructorSignatureContext(context) {
- return context.contextNode.kind === 161 /* ConstructSignature */;
+ return context.contextNode.kind === 162 /* ConstructSignature */;
}
function isTypeArgumentOrParameterOrAssertion(token, parent) {
if (token.kind !== 28 /* LessThanToken */ && token.kind !== 30 /* GreaterThanToken */) {
return false;
}
switch (parent.kind) {
- case 164 /* TypeReference */:
- case 194 /* TypeAssertionExpression */:
- case 242 /* TypeAliasDeclaration */:
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
- case 211 /* ExpressionWithTypeArguments */:
+ case 165 /* TypeReference */:
+ case 195 /* TypeAssertionExpression */:
+ case 243 /* TypeAliasDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
+ case 212 /* ExpressionWithTypeArguments */:
return true;
default:
return false;
@@ -109131,16 +110355,16 @@
isTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent);
}
function isTypeAssertionContext(context) {
- return context.contextNode.kind === 194 /* TypeAssertionExpression */;
+ return context.contextNode.kind === 195 /* TypeAssertionExpression */;
}
function isVoidOpContext(context) {
- return context.currentTokenSpan.kind === 106 /* VoidKeyword */ && context.currentTokenParent.kind === 200 /* VoidExpression */;
+ return context.currentTokenSpan.kind === 107 /* VoidKeyword */ && context.currentTokenParent.kind === 201 /* VoidExpression */;
}
function isYieldOrYieldStarWithOperand(context) {
- return context.contextNode.kind === 207 /* YieldExpression */ && context.contextNode.expression !== undefined;
+ return context.contextNode.kind === 208 /* YieldExpression */ && context.contextNode.expression !== undefined;
}
function isNonNullAssertionContext(context) {
- return context.contextNode.kind === 213 /* NonNullExpression */;
+ return context.contextNode.kind === 214 /* NonNullExpression */;
}
})(formatting = ts.formatting || (ts.formatting = {}));
})(ts || (ts = {}));
@@ -109191,12 +110415,12 @@
return map;
}
function getRuleBucketIndex(row, column) {
- ts.Debug.assert(row <= 147 /* LastKeyword */ && column <= 147 /* LastKeyword */, "Must compute formatting context from tokens");
+ ts.Debug.assert(row <= 148 /* LastKeyword */ && column <= 148 /* LastKeyword */, "Must compute formatting context from tokens");
return (row * mapRowLength) + column;
}
var maskBitSize = 5;
var mask = 31; // MaskBitSize bits
- var mapRowLength = 147 /* LastToken */ + 1;
+ var mapRowLength = 148 /* LastToken */ + 1;
var RulesPosition;
(function (RulesPosition) {
RulesPosition[RulesPosition["IgnoreRulesSpecific"] = 0] = "IgnoreRulesSpecific";
@@ -109374,17 +110598,17 @@
// i.e. parent is class declaration with the list of members and node is one of members.
function isListElement(parent, node) {
switch (parent.kind) {
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
return ts.rangeContainsRange(parent.members, node);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
var body = parent.body;
- return !!body && body.kind === 245 /* ModuleBlock */ && ts.rangeContainsRange(body.statements, node);
- case 284 /* SourceFile */:
- case 218 /* Block */:
- case 245 /* ModuleBlock */:
+ return !!body && body.kind === 246 /* ModuleBlock */ && ts.rangeContainsRange(body.statements, node);
+ case 285 /* SourceFile */:
+ case 219 /* Block */:
+ case 246 /* ModuleBlock */:
return ts.rangeContainsRange(parent.statements, node);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return ts.rangeContainsRange(parent.block.statements, node);
}
return false;
@@ -109606,19 +110830,19 @@
return node.modifiers[0].kind;
}
switch (node.kind) {
- case 240 /* ClassDeclaration */: return 76 /* ClassKeyword */;
- case 241 /* InterfaceDeclaration */: return 110 /* InterfaceKeyword */;
- case 239 /* FunctionDeclaration */: return 90 /* FunctionKeyword */;
- case 243 /* EnumDeclaration */: return 243 /* EnumDeclaration */;
- case 158 /* GetAccessor */: return 126 /* GetKeyword */;
- case 159 /* SetAccessor */: return 137 /* SetKeyword */;
- case 156 /* MethodDeclaration */:
+ case 241 /* ClassDeclaration */: return 77 /* ClassKeyword */;
+ case 242 /* InterfaceDeclaration */: return 111 /* InterfaceKeyword */;
+ case 240 /* FunctionDeclaration */: return 91 /* FunctionKeyword */;
+ case 244 /* EnumDeclaration */: return 244 /* EnumDeclaration */;
+ case 159 /* GetAccessor */: return 127 /* GetKeyword */;
+ case 160 /* SetAccessor */: return 138 /* SetKeyword */;
+ case 157 /* MethodDeclaration */:
if (node.asteriskToken) {
return 40 /* AsteriskToken */;
}
// falls through
- case 154 /* PropertyDeclaration */:
- case 151 /* Parameter */:
+ case 155 /* PropertyDeclaration */:
+ case 152 /* Parameter */:
var name = ts.getNameOfDeclaration(node);
if (name) {
return name.kind;
@@ -109668,22 +110892,22 @@
case 18 /* OpenBraceToken */:
case 19 /* CloseBraceToken */:
case 21 /* CloseParenToken */:
- case 83 /* ElseKeyword */:
- case 107 /* WhileKeyword */:
+ case 84 /* ElseKeyword */:
+ case 108 /* WhileKeyword */:
case 58 /* AtToken */:
return false;
case 42 /* SlashToken */:
case 30 /* GreaterThanToken */:
switch (container.kind) {
- case 262 /* JsxOpeningElement */:
- case 263 /* JsxClosingElement */:
- case 261 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
+ case 264 /* JsxClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
return false;
}
break;
case 22 /* OpenBracketToken */:
case 23 /* CloseBracketToken */:
- if (container.kind !== 181 /* MappedType */) {
+ if (container.kind !== 182 /* MappedType */) {
return false;
}
break;
@@ -109775,7 +110999,7 @@
consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, child);
return inheritedIndentation;
}
- var effectiveParentStartLine = child.kind === 152 /* Decorator */ ? childStartLine : undecoratedParentStartLine;
+ var effectiveParentStartLine = child.kind === 153 /* Decorator */ ? childStartLine : undecoratedParentStartLine;
var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine);
processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta);
if (child.kind === 11 /* JsxText */) {
@@ -109783,7 +111007,7 @@
indentMultilineCommentOrJsxText(range, childIndentation.indentation, /*firstLineIsIndented*/ true, /*indentFinalLine*/ false);
}
childContextNode = node;
- if (isFirstListItem && parent.kind === 187 /* ArrayLiteralExpression */ && inheritedIndentation === -1 /* Unknown */) {
+ if (isFirstListItem && parent.kind === 188 /* ArrayLiteralExpression */ && inheritedIndentation === -1 /* Unknown */) {
inheritedIndentation = childIndentation.indentation;
}
return inheritedIndentation;
@@ -110201,12 +111425,12 @@
formatting.getRangeOfEnclosingComment = getRangeOfEnclosingComment;
function getOpenTokenForList(node, list) {
switch (node.kind) {
- case 157 /* Constructor */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 197 /* ArrowFunction */:
+ case 158 /* Constructor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 198 /* ArrowFunction */:
if (node.typeParameters === list) {
return 28 /* LessThanToken */;
}
@@ -110214,8 +111438,8 @@
return 20 /* OpenParenToken */;
}
break;
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
if (node.typeArguments === list) {
return 28 /* LessThanToken */;
}
@@ -110223,12 +111447,12 @@
return 20 /* OpenParenToken */;
}
break;
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
if (node.typeArguments === list) {
return 28 /* LessThanToken */;
}
break;
- case 168 /* TypeLiteral */:
+ case 169 /* TypeLiteral */:
return 18 /* OpenBraceToken */;
}
return 0 /* Unknown */;
@@ -110345,7 +111569,7 @@
if (options.indentStyle === ts.IndentStyle.Block) {
return getBlockIndent(sourceFile, position, options);
}
- if (precedingToken.kind === 27 /* CommaToken */ && precedingToken.parent.kind !== 204 /* BinaryExpression */) {
+ if (precedingToken.kind === 27 /* CommaToken */ && precedingToken.parent.kind !== 205 /* BinaryExpression */) {
// previous token is comma that separates items in list - find the previous item and try to derive indentation from it
var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options);
if (actualIndentation !== -1 /* Unknown */) {
@@ -110499,7 +111723,7 @@
// - parent is SourceFile - by default immediate children of SourceFile are not indented except when user indents them manually
// - parent and child are not on the same line
var useActualIndentation = (ts.isDeclaration(current) || ts.isStatementButNotDeclaration(current)) &&
- (parent.kind === 284 /* SourceFile */ || !parentAndChildShareLine);
+ (parent.kind === 285 /* SourceFile */ || !parentAndChildShareLine);
if (!useActualIndentation) {
return -1 /* Unknown */;
}
@@ -110547,8 +111771,8 @@
}
SmartIndenter.isArgumentAndStartLineOverlapsExpressionBeingCalled = isArgumentAndStartLineOverlapsExpressionBeingCalled;
function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) {
- if (parent.kind === 222 /* IfStatement */ && parent.elseStatement === child) {
- var elseKeyword = ts.findChildOfKind(parent, 83 /* ElseKeyword */, sourceFile);
+ if (parent.kind === 223 /* IfStatement */ && parent.elseStatement === child) {
+ var elseKeyword = ts.findChildOfKind(parent, 84 /* ElseKeyword */, sourceFile);
ts.Debug.assert(elseKeyword !== undefined);
var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line;
return elseKeywordStartLine === childStartLine;
@@ -110565,40 +111789,40 @@
}
function getListByRange(start, end, node, sourceFile) {
switch (node.kind) {
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return getList(node.typeArguments);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return getList(node.properties);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return getList(node.elements);
- case 168 /* TypeLiteral */:
+ case 169 /* TypeLiteral */:
return getList(node.members);
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 160 /* CallSignature */:
- case 157 /* Constructor */:
- case 166 /* ConstructorType */:
- case 161 /* ConstructSignature */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 161 /* CallSignature */:
+ case 158 /* Constructor */:
+ case 167 /* ConstructorType */:
+ case 162 /* ConstructSignature */:
return getList(node.typeParameters) || getList(node.parameters);
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 308 /* JSDocTemplateTag */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 309 /* JSDocTemplateTag */:
return getList(node.typeParameters);
- case 192 /* NewExpression */:
- case 191 /* CallExpression */:
+ case 193 /* NewExpression */:
+ case 192 /* CallExpression */:
return getList(node.typeArguments) || getList(node.arguments);
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
return getList(node.declarations);
- case 252 /* NamedImports */:
- case 256 /* NamedExports */:
+ case 253 /* NamedImports */:
+ case 257 /* NamedExports */:
return getList(node.elements);
- case 184 /* ObjectBindingPattern */:
- case 185 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
return getList(node.elements);
}
function getList(list) {
@@ -110621,7 +111845,7 @@
return findColumnForFirstNonWhitespaceCharacterInLine(sourceFile.getLineAndCharacterOfPosition(list.pos), sourceFile, options);
}
function getActualIndentationForListItem(node, sourceFile, options, listIndentsChild) {
- if (node.parent && node.parent.kind === 238 /* VariableDeclarationList */) {
+ if (node.parent && node.parent.kind === 239 /* VariableDeclarationList */) {
// VariableDeclarationList has no wrapping tokens
return -1 /* Unknown */;
}
@@ -110694,83 +111918,83 @@
function nodeWillIndentChild(settings, parent, child, sourceFile, indentByDefault) {
var childKind = child ? child.kind : 0 /* Unknown */;
switch (parent.kind) {
- case 221 /* ExpressionStatement */:
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 187 /* ArrayLiteralExpression */:
- case 218 /* Block */:
- case 245 /* ModuleBlock */:
- case 188 /* ObjectLiteralExpression */:
- case 168 /* TypeLiteral */:
- case 181 /* MappedType */:
- case 170 /* TupleType */:
- case 246 /* CaseBlock */:
- case 272 /* DefaultClause */:
- case 271 /* CaseClause */:
- case 195 /* ParenthesizedExpression */:
- case 189 /* PropertyAccessExpression */:
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
- case 219 /* VariableStatement */:
- case 254 /* ExportAssignment */:
- case 230 /* ReturnStatement */:
- case 205 /* ConditionalExpression */:
- case 185 /* ArrayBindingPattern */:
- case 184 /* ObjectBindingPattern */:
- case 262 /* JsxOpeningElement */:
- case 265 /* JsxOpeningFragment */:
- case 261 /* JsxSelfClosingElement */:
- case 270 /* JsxExpression */:
- case 155 /* MethodSignature */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 151 /* Parameter */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 177 /* ParenthesizedType */:
- case 193 /* TaggedTemplateExpression */:
- case 201 /* AwaitExpression */:
- case 256 /* NamedExports */:
- case 252 /* NamedImports */:
- case 257 /* ExportSpecifier */:
- case 253 /* ImportSpecifier */:
- case 154 /* PropertyDeclaration */:
- return true;
- case 237 /* VariableDeclaration */:
- case 275 /* PropertyAssignment */:
- if (!settings.indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === 188 /* ObjectLiteralExpression */) { // TODO: GH#18217
+ case 222 /* ExpressionStatement */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 188 /* ArrayLiteralExpression */:
+ case 219 /* Block */:
+ case 246 /* ModuleBlock */:
+ case 189 /* ObjectLiteralExpression */:
+ case 169 /* TypeLiteral */:
+ case 182 /* MappedType */:
+ case 171 /* TupleType */:
+ case 247 /* CaseBlock */:
+ case 273 /* DefaultClause */:
+ case 272 /* CaseClause */:
+ case 196 /* ParenthesizedExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
+ case 220 /* VariableStatement */:
+ case 255 /* ExportAssignment */:
+ case 231 /* ReturnStatement */:
+ case 206 /* ConditionalExpression */:
+ case 186 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
+ case 263 /* JsxOpeningElement */:
+ case 266 /* JsxOpeningFragment */:
+ case 262 /* JsxSelfClosingElement */:
+ case 271 /* JsxExpression */:
+ case 156 /* MethodSignature */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 152 /* Parameter */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 178 /* ParenthesizedType */:
+ case 194 /* TaggedTemplateExpression */:
+ case 202 /* AwaitExpression */:
+ case 257 /* NamedExports */:
+ case 253 /* NamedImports */:
+ case 258 /* ExportSpecifier */:
+ case 254 /* ImportSpecifier */:
+ case 155 /* PropertyDeclaration */:
+ return true;
+ case 238 /* VariableDeclaration */:
+ case 276 /* PropertyAssignment */:
+ if (!settings.indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === 189 /* ObjectLiteralExpression */) { // TODO: GH#18217
return rangeIsOnOneLine(sourceFile, child);
}
return true;
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 225 /* ForStatement */:
- case 222 /* IfStatement */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 156 /* MethodDeclaration */:
- case 197 /* ArrowFunction */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- return childKind !== 218 /* Block */;
- case 255 /* ExportDeclaration */:
- return childKind !== 256 /* NamedExports */;
- case 249 /* ImportDeclaration */:
- return childKind !== 250 /* ImportClause */ ||
- (!!child.namedBindings && child.namedBindings.kind !== 252 /* NamedImports */);
- case 260 /* JsxElement */:
- return childKind !== 263 /* JsxClosingElement */;
- case 264 /* JsxFragment */:
- return childKind !== 266 /* JsxClosingFragment */;
- case 174 /* IntersectionType */:
- case 173 /* UnionType */:
- if (childKind === 168 /* TypeLiteral */) {
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 226 /* ForStatement */:
+ case 223 /* IfStatement */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 157 /* MethodDeclaration */:
+ case 198 /* ArrowFunction */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ return childKind !== 219 /* Block */;
+ case 256 /* ExportDeclaration */:
+ return childKind !== 257 /* NamedExports */;
+ case 250 /* ImportDeclaration */:
+ return childKind !== 251 /* ImportClause */ ||
+ (!!child.namedBindings && child.namedBindings.kind !== 253 /* NamedImports */);
+ case 261 /* JsxElement */:
+ return childKind !== 264 /* JsxClosingElement */;
+ case 265 /* JsxFragment */:
+ return childKind !== 267 /* JsxClosingFragment */;
+ case 175 /* IntersectionType */:
+ case 174 /* UnionType */:
+ if (childKind === 169 /* TypeLiteral */) {
return false;
}
// falls through
@@ -110781,11 +112005,11 @@
SmartIndenter.nodeWillIndentChild = nodeWillIndentChild;
function isControlFlowEndingStatement(kind, parent) {
switch (kind) {
- case 230 /* ReturnStatement */:
- case 234 /* ThrowStatement */:
- case 228 /* ContinueStatement */:
- case 229 /* BreakStatement */:
- return parent.kind !== 218 /* Block */;
+ case 231 /* ReturnStatement */:
+ case 235 /* ThrowStatement */:
+ case 229 /* ContinueStatement */:
+ case 230 /* BreakStatement */:
+ return parent.kind !== 219 /* Block */;
default:
return false;
}
@@ -110927,7 +112151,7 @@
* Checks if 'candidate' argument is a legal separator in the list that contains 'node' as an element
*/
function isSeparator(node, candidate) {
- return !!candidate && !!node.parent && (candidate.kind === 27 /* CommaToken */ || (candidate.kind === 26 /* SemicolonToken */ && node.parent.kind === 188 /* ObjectLiteralExpression */));
+ return !!candidate && !!node.parent && (candidate.kind === 27 /* CommaToken */ || (candidate.kind === 26 /* SemicolonToken */ && node.parent.kind === 189 /* ObjectLiteralExpression */));
}
function spaces(count) {
var s = "";
@@ -111088,7 +112312,7 @@
}
}
else {
- endNode = node.kind !== 237 /* VariableDeclaration */ && node.questionToken ? node.questionToken : node.name;
+ endNode = node.kind !== 238 /* VariableDeclaration */ && node.questionToken ? node.questionToken : node.name;
}
this.insertNodeAt(sourceFile, endNode.end, type, { prefix: ": " });
};
@@ -111200,18 +112424,18 @@
};
ChangeTracker.prototype.getInsertNodeAfterOptionsWorker = function (node) {
switch (node.kind) {
- case 240 /* ClassDeclaration */:
- case 244 /* ModuleDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 245 /* ModuleDeclaration */:
return { prefix: this.newLineCharacter, suffix: this.newLineCharacter };
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
case 10 /* StringLiteral */:
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return { prefix: ", " };
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return { suffix: "," + this.newLineCharacter };
- case 85 /* ExportKeyword */:
+ case 86 /* ExportKeyword */:
return { prefix: " " };
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return {};
default:
ts.Debug.assert(ts.isStatement(node) || ts.isClassOrTypeElement(node)); // Else we haven't handled this kind of node yet -- add it
@@ -111220,12 +112444,12 @@
};
ChangeTracker.prototype.insertName = function (sourceFile, node, name) {
ts.Debug.assert(!node.name);
- if (node.kind === 197 /* ArrowFunction */) {
+ if (node.kind === 198 /* ArrowFunction */) {
var arrow = ts.findChildOfKind(node, 37 /* EqualsGreaterThanToken */, sourceFile);
var lparen = ts.findChildOfKind(node, 20 /* OpenParenToken */, sourceFile);
if (lparen) {
// `() => {}` --> `function f() {}`
- this.insertNodesAt(sourceFile, lparen.getStart(sourceFile), [ts.createToken(90 /* FunctionKeyword */), ts.createIdentifier(name)], { joiner: " " });
+ this.insertNodesAt(sourceFile, lparen.getStart(sourceFile), [ts.createToken(91 /* FunctionKeyword */), ts.createIdentifier(name)], { joiner: " " });
deleteNode(this, sourceFile, arrow);
}
else {
@@ -111234,14 +112458,14 @@
// Replacing full range of arrow to get rid of the leading space -- replace ` =>` with `)`
this.replaceRange(sourceFile, arrow, ts.createToken(21 /* CloseParenToken */));
}
- if (node.body.kind !== 218 /* Block */) {
+ if (node.body.kind !== 219 /* Block */) {
// `() => 0` => `function f() { return 0; }`
- this.insertNodesAt(sourceFile, node.body.getStart(sourceFile), [ts.createToken(18 /* OpenBraceToken */), ts.createToken(97 /* ReturnKeyword */)], { joiner: " ", suffix: " " });
+ this.insertNodesAt(sourceFile, node.body.getStart(sourceFile), [ts.createToken(18 /* OpenBraceToken */), ts.createToken(98 /* ReturnKeyword */)], { joiner: " ", suffix: " " });
this.insertNodesAt(sourceFile, node.body.end, [ts.createToken(26 /* SemicolonToken */), ts.createToken(19 /* CloseBraceToken */)], { joiner: " " });
}
}
else {
- var pos = ts.findChildOfKind(node, node.kind === 196 /* FunctionExpression */ ? 90 /* FunctionKeyword */ : 76 /* ClassKeyword */, sourceFile).end;
+ var pos = ts.findChildOfKind(node, node.kind === 197 /* FunctionExpression */ ? 91 /* FunctionKeyword */ : 77 /* ClassKeyword */, sourceFile).end;
this.insertNodeAt(sourceFile, pos, ts.createIdentifier(name), { prefix: " " });
}
};
@@ -111468,7 +112692,7 @@
function newFileChangesWorker(oldFile, scriptKind, statements, newLineCharacter, formatContext) {
// TODO: this emits the file, parses it back, then formats it that -- may be a less roundabout way to do this
var nonFormattedText = statements.map(function (s) { return getNonformattedText(s, oldFile, newLineCharacter).text; }).join(newLineCharacter);
- var sourceFile = ts.createSourceFile("any file name", nonFormattedText, 7 /* ESNext */, /*setParentNodes*/ true, scriptKind);
+ var sourceFile = ts.createSourceFile("any file name", nonFormattedText, 8 /* ESNext */, /*setParentNodes*/ true, scriptKind);
var changes = ts.formatting.formatDocument(sourceFile, formatContext);
return applyChanges(nonFormattedText, changes) + newLineCharacter;
}
@@ -111736,14 +112960,14 @@
}
textChanges_3.isValidLocationToAddComment = isValidLocationToAddComment;
function needSemicolonBetween(a, b) {
- return (ts.isPropertySignature(a) || ts.isPropertyDeclaration(a)) && ts.isClassOrTypeElement(b) && b.name.kind === 149 /* ComputedPropertyName */
+ return (ts.isPropertySignature(a) || ts.isPropertyDeclaration(a)) && ts.isClassOrTypeElement(b) && b.name.kind === 150 /* ComputedPropertyName */
|| ts.isStatementButNotDeclaration(a) && ts.isStatementButNotDeclaration(b); // TODO: only if b would start with a `(` or `[`
}
var deleteDeclaration;
(function (deleteDeclaration_1) {
function deleteDeclaration(changes, deletedNodesInLists, sourceFile, node) {
switch (node.kind) {
- case 151 /* Parameter */: {
+ case 152 /* Parameter */: {
var oldFunction = node.parent;
if (ts.isArrowFunction(oldFunction) &&
oldFunction.parameters.length === 1 &&
@@ -111758,14 +112982,14 @@
}
break;
}
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
deleteNode(changes, sourceFile, node,
// For first import, leave header comment in place
node === sourceFile.imports[0].parent ? { leadingTriviaOption: LeadingTriviaOption.Exclude } : undefined);
break;
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
var pattern = node.parent;
- var preserveComma = pattern.kind === 185 /* ArrayBindingPattern */ && node !== ts.last(pattern.elements);
+ var preserveComma = pattern.kind === 186 /* ArrayBindingPattern */ && node !== ts.last(pattern.elements);
if (preserveComma) {
deleteNode(changes, sourceFile, node);
}
@@ -111773,13 +112997,13 @@
deleteNodeInList(changes, deletedNodesInLists, sourceFile, node);
}
break;
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
deleteVariableDeclaration(changes, deletedNodesInLists, sourceFile, node);
break;
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
deleteNodeInList(changes, deletedNodesInLists, sourceFile, node);
break;
- case 253 /* ImportSpecifier */:
+ case 254 /* ImportSpecifier */:
var namedImports = node.parent;
if (namedImports.elements.length === 1) {
deleteImportBinding(changes, sourceFile, namedImports);
@@ -111788,7 +113012,7 @@
deleteNodeInList(changes, deletedNodesInLists, sourceFile, node);
}
break;
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
deleteImportBinding(changes, sourceFile, node);
break;
default:
@@ -111835,13 +113059,13 @@
// Delete the entire import declaration
// |import * as ns from './file'|
// |import { a } from './file'|
- var importDecl = ts.getAncestor(node, 249 /* ImportDeclaration */);
+ var importDecl = ts.getAncestor(node, 250 /* ImportDeclaration */);
deleteNode(changes, sourceFile, importDecl);
}
}
function deleteVariableDeclaration(changes, deletedNodesInLists, sourceFile, node) {
var parent = node.parent;
- if (parent.kind === 274 /* CatchClause */) {
+ if (parent.kind === 275 /* CatchClause */) {
// TODO: There's currently no unused diagnostic for this, could be a suggestion
changes.deleteNodeRange(sourceFile, ts.findChildOfKind(parent, 20 /* OpenParenToken */, sourceFile), ts.findChildOfKind(parent, 21 /* CloseParenToken */, sourceFile));
return;
@@ -111852,14 +113076,14 @@
}
var gp = parent.parent;
switch (gp.kind) {
- case 227 /* ForOfStatement */:
- case 226 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 227 /* ForInStatement */:
changes.replaceNode(sourceFile, node, ts.createObjectLiteral());
break;
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
deleteNode(changes, sourceFile, parent);
break;
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
deleteNode(changes, sourceFile, gp);
break;
default:
@@ -112022,8 +113246,8 @@
var token = ts.getTokenAtPosition(sourceFile, pos);
var assertion = ts.Debug.assertDefined(ts.findAncestor(token, function (n) { return ts.isAsExpression(n) || ts.isTypeAssertion(n); }));
var replacement = ts.isAsExpression(assertion)
- ? ts.createAsExpression(assertion.expression, ts.createKeywordTypeNode(143 /* UnknownKeyword */))
- : ts.createTypeAssertion(ts.createKeywordTypeNode(143 /* UnknownKeyword */), assertion.expression);
+ ? ts.createAsExpression(assertion.expression, ts.createKeywordTypeNode(144 /* UnknownKeyword */))
+ : ts.createTypeAssertion(ts.createKeywordTypeNode(144 /* UnknownKeyword */), assertion.expression);
changeTracker.replaceNode(sourceFile, assertion.expression, replacement);
}
})(codefix = ts.codefix || (ts.codefix = {}));
@@ -112072,11 +113296,11 @@
function makeChange(changeTracker, sourceFile, pos) {
var token = ts.getTokenAtPosition(sourceFile, pos);
if (!ts.isIdentifier(token)) {
- return ts.Debug.fail("add-name-to-nameless-parameter operates on identifiers, but got a " + ts.formatSyntaxKind(token.kind));
+ return ts.Debug.fail("add-name-to-nameless-parameter operates on identifiers, but got a " + ts.Debug.formatSyntaxKind(token.kind));
}
var param = token.parent;
if (!ts.isParameter(param)) {
- return ts.Debug.fail("Tried to add a parameter name to a non-parameter: " + ts.formatSyntaxKind(token.kind));
+ return ts.Debug.fail("Tried to add a parameter name to a non-parameter: " + ts.Debug.formatSyntaxKind(token.kind));
}
var i = param.parent.parameters.indexOf(param);
ts.Debug.assert(!param.type, "Tried to add a parameter name to a parameter that already had one.");
@@ -112158,26 +113382,26 @@
}
function isDeclarationWithType(node) {
return ts.isFunctionLikeDeclaration(node) ||
- node.kind === 237 /* VariableDeclaration */ ||
- node.kind === 153 /* PropertySignature */ ||
- node.kind === 154 /* PropertyDeclaration */;
+ node.kind === 238 /* VariableDeclaration */ ||
+ node.kind === 154 /* PropertySignature */ ||
+ node.kind === 155 /* PropertyDeclaration */;
}
function transformJSDocType(node) {
switch (node.kind) {
- case 289 /* JSDocAllType */:
- case 290 /* JSDocUnknownType */:
+ case 290 /* JSDocAllType */:
+ case 291 /* JSDocUnknownType */:
return ts.createTypeReferenceNode("any", ts.emptyArray);
- case 293 /* JSDocOptionalType */:
+ case 294 /* JSDocOptionalType */:
return transformJSDocOptionalType(node);
- case 292 /* JSDocNonNullableType */:
+ case 293 /* JSDocNonNullableType */:
return transformJSDocType(node.type);
- case 291 /* JSDocNullableType */:
+ case 292 /* JSDocNullableType */:
return transformJSDocNullableType(node);
- case 295 /* JSDocVariadicType */:
+ case 296 /* JSDocVariadicType */:
return transformJSDocVariadicType(node);
- case 294 /* JSDocFunctionType */:
+ case 295 /* JSDocFunctionType */:
return transformJSDocFunctionType(node);
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return transformJSDocTypeReference(node);
default:
var visited = ts.visitEachChild(node, transformJSDocType, /*context*/ undefined); // TODO: GH#18217
@@ -112199,7 +113423,7 @@
}
function transformJSDocParameter(node) {
var index = node.parent.parameters.indexOf(node);
- var isRest = node.type.kind === 295 /* JSDocVariadicType */ && index === node.parent.parameters.length - 1; // TODO: GH#18217
+ var isRest = node.type.kind === 296 /* JSDocVariadicType */ && index === node.parent.parameters.length - 1; // TODO: GH#18217
var name = node.name || (isRest ? "rest" : "arg" + index);
var dotdotdot = isRest ? ts.createToken(25 /* DotDotDotToken */) : node.dotDotDotToken;
return ts.createParameter(node.decorators, node.modifiers, dotdotdot, name, node.questionToken, ts.visitNode(node.type, transformJSDocType), node.initializer);
@@ -112239,8 +113463,8 @@
var index = ts.createParameter(
/*decorators*/ undefined,
/*modifiers*/ undefined,
- /*dotDotDotToken*/ undefined, node.typeArguments[0].kind === 135 /* NumberKeyword */ ? "n" : "s",
- /*questionToken*/ undefined, ts.createTypeReferenceNode(node.typeArguments[0].kind === 135 /* NumberKeyword */ ? "number" : "string", []),
+ /*dotDotDotToken*/ undefined, node.typeArguments[0].kind === 136 /* NumberKeyword */ ? "n" : "s",
+ /*questionToken*/ undefined, ts.createTypeReferenceNode(node.typeArguments[0].kind === 136 /* NumberKeyword */ ? "number" : "string", []),
/*initializer*/ undefined);
var indexSignature = ts.createTypeLiteralNode([ts.createIndexSignature(/*decorators*/ undefined, /*modifiers*/ undefined, [index], node.typeArguments[1])]);
ts.setEmitFlags(indexSignature, 1 /* SingleLine */);
@@ -112340,7 +113564,7 @@
return errorCode;
}
function doChange(changes, sourceFile, token, errorCode, program, cancellationToken, markSeen, host) {
- if (!ts.isParameterPropertyModifier(token.kind) && token.kind !== 72 /* Identifier */ && token.kind !== 25 /* DotDotDotToken */ && token.kind !== 100 /* ThisKeyword */) {
+ if (!ts.isParameterPropertyModifier(token.kind) && token.kind !== 73 /* Identifier */ && token.kind !== 25 /* DotDotDotToken */ && token.kind !== 101 /* ThisKeyword */) {
return undefined;
}
var parent = token.parent;
@@ -112461,7 +113685,7 @@
function annotate(changes, sourceFile, declaration, type, program, host) {
var typeNode = ts.getTypeNodeIfAccessible(type, declaration, program, host);
if (typeNode) {
- if (ts.isInJSFile(sourceFile) && declaration.kind !== 153 /* PropertySignature */) {
+ if (ts.isInJSFile(sourceFile) && declaration.kind !== 154 /* PropertySignature */) {
var parent = ts.isVariableDeclaration(declaration) ? ts.tryCast(declaration.parent.parent, ts.isVariableStatement) : declaration;
if (!parent) {
return;
@@ -112502,13 +113726,13 @@
return !!merged;
}); });
var tag = ts.createJSDocComment(comments.join("\n"), ts.createNodeArray((oldTags || ts.emptyArray).concat(unmergedNewTags)));
- var jsDocNode = parent.kind === 197 /* ArrowFunction */ ? getJsDocNodeForArrowFunction(parent) : parent;
+ var jsDocNode = parent.kind === 198 /* ArrowFunction */ ? getJsDocNodeForArrowFunction(parent) : parent;
jsDocNode.jsDoc = parent.jsDoc;
jsDocNode.jsDocCache = parent.jsDocCache;
changes.insertJsdocCommentBefore(sourceFile, jsDocNode, tag);
}
function getJsDocNodeForArrowFunction(signature) {
- if (signature.parent.kind === 154 /* PropertyDeclaration */) {
+ if (signature.parent.kind === 155 /* PropertyDeclaration */) {
return signature.parent;
}
return signature.parent.parent;
@@ -112518,14 +113742,14 @@
return undefined;
}
switch (oldTag.kind) {
- case 304 /* JSDocParameterTag */: {
+ case 305 /* JSDocParameterTag */: {
var oldParam = oldTag;
var newParam = newTag;
return ts.isIdentifier(oldParam.name) && ts.isIdentifier(newParam.name) && oldParam.name.escapedText === newParam.name.escapedText
? ts.createJSDocParamTag(newParam.name, newParam.isBracketed, newParam.typeExpression, oldParam.comment)
: undefined;
}
- case 305 /* JSDocReturnTag */:
+ case 306 /* JSDocReturnTag */:
return ts.createJSDocReturnTag(newTag.typeExpression, oldTag.comment);
}
}
@@ -112544,18 +113768,18 @@
function inferTypeForParametersFromUsage(containingFunction, sourceFile, program, cancellationToken) {
var searchToken;
switch (containingFunction.kind) {
- case 157 /* Constructor */:
- searchToken = ts.findChildOfKind(containingFunction, 124 /* ConstructorKeyword */, sourceFile);
+ case 158 /* Constructor */:
+ searchToken = ts.findChildOfKind(containingFunction, 125 /* ConstructorKeyword */, sourceFile);
break;
- case 197 /* ArrowFunction */:
- case 196 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
var parent = containingFunction.parent;
searchToken = ts.isVariableDeclaration(parent) && ts.isIdentifier(parent.name) ?
parent.name :
containingFunction.name;
break;
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 157 /* MethodDeclaration */:
searchToken = containingFunction.name;
break;
}
@@ -112627,21 +113851,21 @@
node = node.parent;
}
switch (node.parent.kind) {
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
usageContext.isNumber = true;
break;
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
inferTypeFromPrefixUnaryExpressionContext(node.parent, usageContext);
break;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
inferTypeFromBinaryExpressionContext(node, node.parent, checker, usageContext);
break;
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
inferTypeFromSwitchStatementLabelContext(node.parent, checker, usageContext);
break;
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
if (node.parent.expression === node) {
inferTypeFromCallExpressionContext(node.parent, checker, usageContext);
}
@@ -112649,13 +113873,13 @@
inferTypeFromContextualType(node, checker, usageContext);
}
break;
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
inferTypeFromPropertyAccessExpressionContext(node.parent, checker, usageContext);
break;
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
inferTypeFromPropertyElementExpressionContext(node.parent, node, checker, usageContext);
break;
- case 237 /* VariableDeclaration */: {
+ case 238 /* VariableDeclaration */: {
var _a = node.parent, name = _a.name, initializer = _a.initializer;
if (node === name) {
if (initializer) { // This can happen for `let x = null;` which still has an implicit-any error.
@@ -112706,17 +113930,17 @@
case 50 /* BarToken */:
case 51 /* CaretToken */:
// CompoundAssignmentOperator
- case 61 /* MinusEqualsToken */:
- case 63 /* AsteriskAsteriskEqualsToken */:
- case 62 /* AsteriskEqualsToken */:
- case 64 /* SlashEqualsToken */:
- case 65 /* PercentEqualsToken */:
- case 69 /* AmpersandEqualsToken */:
- case 70 /* BarEqualsToken */:
- case 71 /* CaretEqualsToken */:
- case 66 /* LessThanLessThanEqualsToken */:
- case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
- case 67 /* GreaterThanGreaterThanEqualsToken */:
+ case 62 /* MinusEqualsToken */:
+ case 64 /* AsteriskAsteriskEqualsToken */:
+ case 63 /* AsteriskEqualsToken */:
+ case 65 /* SlashEqualsToken */:
+ case 66 /* PercentEqualsToken */:
+ case 70 /* AmpersandEqualsToken */:
+ case 71 /* BarEqualsToken */:
+ case 72 /* CaretEqualsToken */:
+ case 67 /* LessThanLessThanEqualsToken */:
+ case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
+ case 68 /* GreaterThanGreaterThanEqualsToken */:
// AdditiveOperator
case 39 /* MinusToken */:
// RelationalOperator
@@ -112732,7 +113956,7 @@
usageContext.isNumber = true;
}
break;
- case 60 /* PlusEqualsToken */:
+ case 61 /* PlusEqualsToken */:
case 38 /* PlusToken */:
var otherOperandType = checker.getTypeAtLocation(parent.left === node ? parent.right : parent.left);
if (otherOperandType.flags & 1056 /* EnumLike */) {
@@ -112749,14 +113973,14 @@
}
break;
// AssignmentOperators
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
case 33 /* EqualsEqualsToken */:
case 35 /* EqualsEqualsEqualsToken */:
case 36 /* ExclamationEqualsEqualsToken */:
case 34 /* ExclamationEqualsToken */:
addCandidateType(usageContext, checker.getTypeAtLocation(parent.left === node ? parent.right : parent.left));
break;
- case 93 /* InKeyword */:
+ case 94 /* InKeyword */:
if (node === parent.left) {
usageContext.isString = true;
}
@@ -112764,7 +113988,7 @@
// LogicalOperator
case 55 /* BarBarToken */:
if (node === parent.left &&
- (node.parent.parent.kind === 237 /* VariableDeclaration */ || ts.isAssignmentExpression(node.parent.parent, /*excludeCompoundAssignment*/ true))) {
+ (node.parent.parent.kind === 238 /* VariableDeclaration */ || ts.isAssignmentExpression(node.parent.parent, /*excludeCompoundAssignment*/ true))) {
// var x = x || {};
// TODO: use getFalsyflagsOfType
addCandidateType(usageContext, checker.getTypeAtLocation(parent.right));
@@ -112772,7 +113996,7 @@
break;
case 54 /* AmpersandAmpersandToken */:
case 27 /* CommaToken */:
- case 94 /* InstanceOfKeyword */:
+ case 95 /* InstanceOfKeyword */:
// nothing to infer here
break;
}
@@ -112792,7 +114016,7 @@
}
}
inferTypeFromContext(parent, checker, callContext.returnType);
- if (parent.kind === 191 /* CallExpression */) {
+ if (parent.kind === 192 /* CallExpression */) {
(usageContext.callContexts || (usageContext.callContexts = [])).push(callContext);
}
else {
@@ -113032,12 +114256,12 @@
var precedingNode;
var newClassDeclaration;
switch (ctorDeclaration.kind) {
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
precedingNode = ctorDeclaration;
changes.delete(sourceFile, ctorDeclaration);
newClassDeclaration = createClassFromFunctionDeclaration(ctorDeclaration);
break;
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
precedingNode = ctorDeclaration.parent.parent;
newClassDeclaration = createClassFromVariableDeclaration(ctorDeclaration);
if (ctorDeclaration.parent.declarations.length === 1) {
@@ -113069,7 +114293,7 @@
// all static members are stored in the "exports" array of symbol
if (symbol.exports) {
symbol.exports.forEach(function (member) {
- var memberElement = createClassElement(member, [ts.createToken(116 /* StaticKeyword */)]);
+ var memberElement = createClassElement(member, [ts.createToken(117 /* StaticKeyword */)]);
if (memberElement) {
memberElements.push(memberElement);
}
@@ -113092,7 +114316,7 @@
return;
}
// delete the entire statement if this expression is the sole expression to take care of the semicolon at the end
- var nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 221 /* ExpressionStatement */
+ var nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 222 /* ExpressionStatement */
? assignmentBinaryExpression.parent : assignmentBinaryExpression;
changes.delete(sourceFile, nodeToDelete);
if (!assignmentBinaryExpression.right) {
@@ -113100,27 +114324,27 @@
/*type*/ undefined, /*initializer*/ undefined);
}
switch (assignmentBinaryExpression.right.kind) {
- case 196 /* FunctionExpression */: {
+ case 197 /* FunctionExpression */: {
var functionExpression = assignmentBinaryExpression.right;
- var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(functionExpression, 121 /* AsyncKeyword */));
+ var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(functionExpression, 122 /* AsyncKeyword */));
var method = ts.createMethod(/*decorators*/ undefined, fullModifiers, /*asteriskToken*/ undefined, memberDeclaration.name, /*questionToken*/ undefined,
/*typeParameters*/ undefined, functionExpression.parameters, /*type*/ undefined, functionExpression.body);
ts.copyLeadingComments(assignmentBinaryExpression, method, sourceFile);
return method;
}
- case 197 /* ArrowFunction */: {
+ case 198 /* ArrowFunction */: {
var arrowFunction = assignmentBinaryExpression.right;
var arrowFunctionBody = arrowFunction.body;
var bodyBlock = void 0;
// case 1: () => { return [1,2,3] }
- if (arrowFunctionBody.kind === 218 /* Block */) {
+ if (arrowFunctionBody.kind === 219 /* Block */) {
bodyBlock = arrowFunctionBody;
}
// case 2: () => [1,2,3]
else {
bodyBlock = ts.createBlock([ts.createReturn(arrowFunctionBody)]);
}
- var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(arrowFunction, 121 /* AsyncKeyword */));
+ var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(arrowFunction, 122 /* AsyncKeyword */));
var method = ts.createMethod(/*decorators*/ undefined, fullModifiers, /*asteriskToken*/ undefined, memberDeclaration.name, /*questionToken*/ undefined,
/*typeParameters*/ undefined, arrowFunction.parameters, /*type*/ undefined, bodyBlock);
ts.copyLeadingComments(assignmentBinaryExpression, method, sourceFile);
@@ -113141,17 +114365,17 @@
}
function createClassFromVariableDeclaration(node) {
var initializer = node.initializer;
- if (!initializer || initializer.kind !== 196 /* FunctionExpression */) {
+ if (!initializer || initializer.kind !== 197 /* FunctionExpression */) {
return undefined;
}
- if (node.name.kind !== 72 /* Identifier */) {
+ if (node.name.kind !== 73 /* Identifier */) {
return undefined;
}
var memberElements = createClassElementsFromSymbol(node.symbol);
if (initializer.body) {
memberElements.unshift(ts.createConstructor(/*decorators*/ undefined, /*modifiers*/ undefined, initializer.parameters, initializer.body));
}
- var modifiers = getModifierKindFromSource(precedingNode, 85 /* ExportKeyword */);
+ var modifiers = getModifierKindFromSource(precedingNode, 86 /* ExportKeyword */);
var cls = ts.createClassDeclaration(/*decorators*/ undefined, modifiers, node.name,
/*typeParameters*/ undefined, /*heritageClauses*/ undefined, memberElements);
// Don't call copyComments here because we'll already leave them in place
@@ -113162,7 +114386,7 @@
if (node.body) {
memberElements.unshift(ts.createConstructor(/*decorators*/ undefined, /*modifiers*/ undefined, node.parameters, node.body));
}
- var modifiers = getModifierKindFromSource(node, 85 /* ExportKeyword */);
+ var modifiers = getModifierKindFromSource(node, 86 /* ExportKeyword */);
var cls = ts.createClassDeclaration(/*decorators*/ undefined, modifiers, node.name,
/*typeParameters*/ undefined, /*heritageClauses*/ undefined, memberElements);
// Don't call copyComments here because we'll already leave them in place
@@ -113192,6 +114416,11 @@
fixIds: [fixId],
getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, err) { return convertToAsyncFunction(changes, err.file, err.start, context.program.getTypeChecker(), context); }); },
});
+ var SynthBindingNameKind;
+ (function (SynthBindingNameKind) {
+ SynthBindingNameKind[SynthBindingNameKind["Identifier"] = 0] = "Identifier";
+ SynthBindingNameKind[SynthBindingNameKind["BindingPattern"] = 1] = "BindingPattern";
+ })(SynthBindingNameKind || (SynthBindingNameKind = {}));
function convertToAsyncFunction(changes, sourceFile, position, checker, context) {
// get the function declaration - returns a promise
var tokenAtPosition = ts.getTokenAtPosition(sourceFile, position);
@@ -113220,7 +114449,7 @@
return;
}
// add the async keyword
- changes.insertLastModifierBefore(sourceFile, 121 /* AsyncKeyword */, functionToConvert);
+ changes.insertLastModifierBefore(sourceFile, 122 /* AsyncKeyword */, functionToConvert);
function startTransformation(node, nodeToReplace) {
var newNodes = transformExpression(node, transformer, node);
changes.replaceNodeWithNodes(sourceFile, nodeToReplace, newNodes);
@@ -113328,8 +114557,8 @@
allVarNames.push({ identifier: synthName.identifier, symbol: symbol });
addNameToFrequencyMap(collidingSymbolMap, ident.text, symbol);
}
- // we only care about identifiers that are parameters and declarations (don't care about other uses)
- else if (node.parent && (ts.isParameter(node.parent) || ts.isVariableDeclaration(node.parent))) {
+ // we only care about identifiers that are parameters, declarations, or binding elements (don't care about other uses)
+ else if (node.parent && (ts.isParameter(node.parent) || ts.isVariableDeclaration(node.parent) || ts.isBindingElement(node.parent))) {
var originalName = node.text;
var collidingSymbols = collidingSymbolMap.get(originalName);
// if the identifier name conflicts with a different identifier that we've already seen
@@ -113343,7 +114572,7 @@
else {
var identifier = ts.getSynthesizedDeepClone(node);
identsToRenameMap.set(symbolIdString, identifier);
- synthNamesMap.set(symbolIdString, { identifier: identifier, types: [], numberOfAssignmentsOriginal: allVarNames.filter(function (elem) { return elem.identifier.text === node.text; }).length /*, numberOfAssignmentsSynthesized: 0*/ });
+ synthNamesMap.set(symbolIdString, createSynthIdentifier(identifier, [], allVarNames.filter(function (elem) { return elem.identifier.text === node.text; }).length /*, numberOfAssignmentsSynthesized: 0*/));
if ((ts.isParameter(node.parent) && isExpressionOrCallOnTypePromise(node.parent.parent)) || ts.isVariableDeclaration(node.parent)) {
allVarNames.push({ identifier: identifier, symbol: symbol });
addNameToFrequencyMap(collidingSymbolMap, originalName, symbol);
@@ -113391,7 +114620,7 @@
var numVarsSameName = (originalNames.get(name.text) || ts.emptyArray).length;
var numberOfAssignmentsOriginal = 0;
var identifier = numVarsSameName === 0 ? name : ts.createIdentifier(name.text + "_" + numVarsSameName);
- return { identifier: identifier, types: [], numberOfAssignmentsOriginal: numberOfAssignmentsOriginal };
+ return createSynthIdentifier(identifier, [], numberOfAssignmentsOriginal);
}
// dispatch function to recursively build the refactoring
// should be kept up to date with isFixablePromiseHandler in suggestionDiagnostics.ts
@@ -113418,68 +114647,90 @@
}
function transformCatch(node, transformer, prevArgName) {
var func = node.arguments[0];
- var argName = getArgName(func, transformer);
+ var argName = getArgBindingName(func, transformer);
var shouldReturn = transformer.setOfExpressionsToReturn.get(ts.getNodeId(node).toString());
+ var possibleNameForVarDecl;
/*
If there is another call in the chain after the .catch() we are transforming, we will need to save the result of both paths (try block and catch block)
To do this, we will need to synthesize a variable that we were not aware of while we were adding identifiers to the synthNamesMap
We will use the prevArgName and then update the synthNamesMap with a new variable name for the next transformation step
*/
if (prevArgName && !shouldReturn) {
- prevArgName.numberOfAssignmentsOriginal = 2; // Try block and catch block
+ if (isSynthIdentifier(prevArgName)) {
+ possibleNameForVarDecl = prevArgName;
transformer.synthNamesMap.forEach(function (val, key) {
if (val.identifier.text === prevArgName.identifier.text) {
var newSynthName = createUniqueSynthName(prevArgName);
transformer.synthNamesMap.set(key, newSynthName);
}
});
+ }
+ else {
+ possibleNameForVarDecl = createSynthIdentifier(ts.createOptimisticUniqueName("result"), prevArgName.types);
+ }
+ possibleNameForVarDecl.numberOfAssignmentsOriginal = 2; // Try block and catch block
// update the constIdentifiers list
- if (transformer.constIdentifiers.some(function (elem) { return elem.text === prevArgName.identifier.text; })) {
- transformer.constIdentifiers.push(createUniqueSynthName(prevArgName).identifier);
+ if (transformer.constIdentifiers.some(function (elem) { return elem.text === possibleNameForVarDecl.identifier.text; })) {
+ transformer.constIdentifiers.push(createUniqueSynthName(possibleNameForVarDecl).identifier);
}
}
- var tryBlock = ts.createBlock(transformExpression(node.expression, transformer, node, prevArgName));
- var transformationBody = getTransformationBody(func, prevArgName, argName, node, transformer);
- var catchArg = argName ? argName.identifier.text : "e";
- var catchClause = ts.createCatchClause(catchArg, ts.createBlock(transformationBody));
+ var tryBlock = ts.createBlock(transformExpression(node.expression, transformer, node, possibleNameForVarDecl));
+ var transformationBody = getTransformationBody(func, possibleNameForVarDecl, argName, node, transformer);
+ var catchArg = argName ? isSynthIdentifier(argName) ? argName.identifier.text : argName.bindingPattern : "e";
+ var catchVariableDeclaration = ts.createVariableDeclaration(catchArg);
+ var catchClause = ts.createCatchClause(catchVariableDeclaration, ts.createBlock(transformationBody));
/*
In order to avoid an implicit any, we will synthesize a type for the declaration using the unions of the types of both paths (try block and catch block)
*/
var varDeclList;
- if (prevArgName && !shouldReturn) {
- var typeArray = prevArgName.types;
+ var varDeclIdentifier;
+ if (possibleNameForVarDecl && !shouldReturn) {
+ varDeclIdentifier = ts.getSynthesizedDeepClone(possibleNameForVarDecl.identifier);
+ var typeArray = possibleNameForVarDecl.types;
var unionType = transformer.checker.getUnionType(typeArray, 2 /* Subtype */);
var unionTypeNode = transformer.isInJSFile ? undefined : transformer.checker.typeToTypeNode(unionType);
- var varDecl = [ts.createVariableDeclaration(ts.getSynthesizedDeepClone(prevArgName.identifier), unionTypeNode)];
+ var varDecl = [ts.createVariableDeclaration(varDeclIdentifier, unionTypeNode)];
varDeclList = ts.createVariableStatement(/*modifiers*/ undefined, ts.createVariableDeclarationList(varDecl, 1 /* Let */));
}
var tryStatement = ts.createTry(tryBlock, catchClause, /*finallyBlock*/ undefined);
- return varDeclList ? [varDeclList, tryStatement] : [tryStatement];
+ var destructuredResult = prevArgName && varDeclIdentifier && isSynthBindingPattern(prevArgName)
+ && ts.createVariableStatement(/* modifiers */ undefined, ts.createVariableDeclarationList([ts.createVariableDeclaration(ts.getSynthesizedDeepCloneWithRenames(prevArgName.bindingPattern), /* type */ undefined, varDeclIdentifier)], 2 /* Const */));
+ return ts.compact([varDeclList, tryStatement, destructuredResult]);
+ }
+ function getIdentifierTextsFromBindingName(bindingName) {
+ if (ts.isIdentifier(bindingName))
+ return [bindingName.text];
+ return ts.flatMap(bindingName.elements, function (element) {
+ if (ts.isOmittedExpression(element))
+ return [];
+ return getIdentifierTextsFromBindingName(element.name);
+ });
}
function createUniqueSynthName(prevArgName) {
var renamedPrevArg = ts.createOptimisticUniqueName(prevArgName.identifier.text);
- var newSynthName = { identifier: renamedPrevArg, types: [], numberOfAssignmentsOriginal: 0 };
- return newSynthName;
+ return createSynthIdentifier(renamedPrevArg);
}
function transformThen(node, transformer, outermostParent, prevArgName) {
var _a = node.arguments, res = _a[0], rej = _a[1];
if (!res) {
return transformExpression(node.expression, transformer, outermostParent);
}
- var argNameRes = getArgName(res, transformer);
+ var argNameRes = getArgBindingName(res, transformer);
var transformationBody = getTransformationBody(res, prevArgName, argNameRes, node, transformer);
if (rej) {
- var argNameRej = getArgName(rej, transformer);
+ var argNameRej = getArgBindingName(rej, transformer);
var tryBlock = ts.createBlock(transformExpression(node.expression, transformer, node, argNameRes).concat(transformationBody));
var transformationBody2 = getTransformationBody(rej, prevArgName, argNameRej, node, transformer);
- var catchArg = argNameRej ? argNameRej.identifier.text : "e";
- var catchClause = ts.createCatchClause(catchArg, ts.createBlock(transformationBody2));
+ var catchArg = argNameRej ? isSynthIdentifier(argNameRej) ? argNameRej.identifier.text : argNameRej.bindingPattern : "e";
+ var catchVariableDeclaration = ts.createVariableDeclaration(catchArg);
+ var catchClause = ts.createCatchClause(catchVariableDeclaration, ts.createBlock(transformationBody2));
return [ts.createTry(tryBlock, catchClause, /* finallyBlock */ undefined)];
}
return transformExpression(node.expression, transformer, node, argNameRes).concat(transformationBody);
}
- function getFlagOfIdentifier(node, constIdentifiers) {
- var inArr = constIdentifiers.some(function (elem) { return elem.text === node.text; });
+ function getFlagOfBindingName(bindingName, constIdentifiers) {
+ var identifiers = getIdentifierTextsFromBindingName(getNode(bindingName));
+ var inArr = constIdentifiers.some(function (elem) { return ts.contains(identifiers, elem.text); });
return inArr ? 2 /* Const */ : 1 /* Let */;
}
function transformPromiseCall(node, transformer, prevArgName) {
@@ -113495,29 +114746,29 @@
return [ts.createReturn(ts.getSynthesizedDeepClone(node))];
}
function createTransformedStatement(prevArgName, rightHandSide, transformer) {
- if (!prevArgName || prevArgName.identifier.text.length === 0) {
+ if (!prevArgName || isEmpty(prevArgName)) {
// if there's no argName to assign to, there still might be side effects
return [ts.createStatement(rightHandSide)];
}
- if (prevArgName.types.length < prevArgName.numberOfAssignmentsOriginal) {
+ if (isSynthIdentifier(prevArgName) && prevArgName.types.length < prevArgName.numberOfAssignmentsOriginal) {
// if the variable has already been declared, we don't need "let" or "const"
return [ts.createStatement(ts.createAssignment(ts.getSynthesizedDeepClone(prevArgName.identifier), rightHandSide))];
}
- return [ts.createVariableStatement(/*modifiers*/ undefined, (ts.createVariableDeclarationList([ts.createVariableDeclaration(ts.getSynthesizedDeepClone(prevArgName.identifier), /*type*/ undefined, rightHandSide)], getFlagOfIdentifier(prevArgName.identifier, transformer.constIdentifiers))))];
+ return [ts.createVariableStatement(/*modifiers*/ undefined, (ts.createVariableDeclarationList([ts.createVariableDeclaration(ts.getSynthesizedDeepClone(getNode(prevArgName)), /*type*/ undefined, rightHandSide)], getFlagOfBindingName(prevArgName, transformer.constIdentifiers))))];
}
// should be kept up to date with isFixablePromiseArgument in suggestionDiagnostics.ts
function getTransformationBody(func, prevArgName, argName, parent, transformer) {
var shouldReturn = transformer.setOfExpressionsToReturn.get(ts.getNodeId(parent).toString());
switch (func.kind) {
- case 96 /* NullKeyword */:
+ case 97 /* NullKeyword */:
// do not produce a transformed statement for a null argument
break;
- case 72 /* Identifier */: // identifier includes undefined
+ case 73 /* Identifier */: // identifier includes undefined
if (!argName) {
// undefined was argument passed to promise handler
break;
}
- var synthCall = ts.createCall(ts.getSynthesizedDeepClone(func), /*typeArguments*/ undefined, [argName.identifier]);
+ var synthCall = ts.createCall(ts.getSynthesizedDeepClone(func), /*typeArguments*/ undefined, isSynthIdentifier(argName) ? [argName.identifier] : []);
if (shouldReturn) {
return [ts.createReturn(synthCall)];
}
@@ -113534,8 +114785,8 @@
prevArgName.types.push(returnType);
}
return varDeclOrAssignment;
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */: {
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */: {
var funcBody = func.body;
// Arrow functions with block bodies { } will enter this control flow
if (ts.isBlock(funcBody)) {
@@ -113554,7 +114805,7 @@
}
}
return shouldReturn ? refactoredStmts.map(function (s) { return ts.getSynthesizedDeepClone(s); }) :
- removeReturns(refactoredStmts, prevArgName === undefined ? undefined : prevArgName.identifier, transformer, seenReturnStatement);
+ removeReturns(refactoredStmts, prevArgName, transformer, seenReturnStatement);
}
else {
var innerRetStmts = ts.isFixablePromiseHandler(funcBody) ? [ts.createReturn(funcBody)] : ts.emptyArray;
@@ -113600,7 +114851,7 @@
ret.push(ts.createExpressionStatement(possiblyAwaitedExpression));
}
else {
- ret.push(ts.createVariableStatement(/*modifiers*/ undefined, (ts.createVariableDeclarationList([ts.createVariableDeclaration(prevArgName, /*type*/ undefined, possiblyAwaitedExpression)], getFlagOfIdentifier(prevArgName, transformer.constIdentifiers)))));
+ ret.push(ts.createVariableStatement(/*modifiers*/ undefined, (ts.createVariableDeclarationList([ts.createVariableDeclaration(getNode(prevArgName), /*type*/ undefined, possiblyAwaitedExpression)], getFlagOfBindingName(prevArgName, transformer.constIdentifiers)))));
}
}
}
@@ -113610,7 +114861,7 @@
}
// if block has no return statement, need to define prevArgName as undefined to prevent undeclared variables
if (!seenReturnStatement && prevArgName !== undefined) {
- ret.push(ts.createVariableStatement(/*modifiers*/ undefined, (ts.createVariableDeclarationList([ts.createVariableDeclaration(prevArgName, /*type*/ undefined, ts.createIdentifier("undefined"))], getFlagOfIdentifier(prevArgName, transformer.constIdentifiers)))));
+ ret.push(ts.createVariableStatement(/*modifiers*/ undefined, (ts.createVariableDeclarationList([ts.createVariableDeclaration(getNode(prevArgName), /*type*/ undefined, ts.createIdentifier("undefined"))], getFlagOfBindingName(prevArgName, transformer.constIdentifiers)))));
}
return ret;
}
@@ -113633,32 +114884,42 @@
}
return innerCbBody;
}
- function getArgName(funcNode, transformer) {
+ function getArgBindingName(funcNode, transformer) {
var numberOfAssignmentsOriginal = 0;
var types = [];
var name;
if (ts.isFunctionLikeDeclaration(funcNode)) {
if (funcNode.parameters.length > 0) {
var param = funcNode.parameters[0].name;
- name = getMapEntryOrDefault(param);
+ name = getMappedBindingNameOrDefault(param);
}
}
else if (ts.isIdentifier(funcNode)) {
name = getMapEntryOrDefault(funcNode);
}
// return undefined argName when arg is null or undefined
- if (!name || name.identifier.text === "undefined") {
+ if (!name || "identifier" in name && name.identifier.text === "undefined") {
return undefined;
}
return name;
+ function getMappedBindingNameOrDefault(bindingName) {
+ if (ts.isIdentifier(bindingName))
+ return getMapEntryOrDefault(bindingName);
+ var elements = ts.flatMap(bindingName.elements, function (element) {
+ if (ts.isOmittedExpression(element))
+ return [];
+ return [getMappedBindingNameOrDefault(element.name)];
+ });
+ return createSynthBindingPattern(bindingName, elements);
+ }
function getMapEntryOrDefault(identifier) {
var originalNode = getOriginalNode(identifier);
var symbol = getSymbol(originalNode);
if (!symbol) {
- return { identifier: identifier, types: types, numberOfAssignmentsOriginal: numberOfAssignmentsOriginal };
+ return createSynthIdentifier(identifier, types, numberOfAssignmentsOriginal);
}
var mapEntry = transformer.synthNamesMap.get(ts.getSymbolId(symbol).toString());
- return mapEntry || { identifier: identifier, types: types, numberOfAssignmentsOriginal: numberOfAssignmentsOriginal };
+ return mapEntry || createSynthIdentifier(identifier, types, numberOfAssignmentsOriginal);
}
function getSymbol(node) {
return node.symbol ? node.symbol : transformer.checker.getSymbolAtLocation(node);
@@ -113667,6 +114928,34 @@
return node.original ? node.original : node;
}
}
+ function isEmpty(bindingName) {
+ if (!bindingName) {
+ return true;
+ }
+ if (isSynthIdentifier(bindingName)) {
+ return !bindingName.identifier.text;
+ }
+ return ts.every(bindingName.elements, isEmpty);
+ }
+ function getNode(bindingName) {
+ return isSynthIdentifier(bindingName) ? bindingName.identifier : bindingName.bindingPattern;
+ }
+ function createSynthIdentifier(identifier, types, numberOfAssignmentsOriginal) {
+ if (types === void 0) { types = []; }
+ if (numberOfAssignmentsOriginal === void 0) { numberOfAssignmentsOriginal = 0; }
+ return { kind: 0 /* Identifier */, identifier: identifier, types: types, numberOfAssignmentsOriginal: numberOfAssignmentsOriginal };
+ }
+ function createSynthBindingPattern(bindingPattern, elements, types) {
+ if (elements === void 0) { elements = ts.emptyArray; }
+ if (types === void 0) { types = []; }
+ return { kind: 1 /* BindingPattern */, bindingPattern: bindingPattern, elements: elements, types: types };
+ }
+ function isSynthIdentifier(bindingName) {
+ return bindingName.kind === 0 /* Identifier */;
+ }
+ function isSynthBindingPattern(bindingName) {
+ return bindingName.kind === 1 /* BindingPattern */;
+ }
})(codefix = ts.codefix || (ts.codefix = {}));
})(ts || (ts = {}));
/* @internal */
@@ -113700,10 +114989,10 @@
}
var importNode = ts.importFromModuleSpecifier(moduleSpecifier);
switch (importNode.kind) {
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
changes.replaceNode(importingFile, importNode, ts.makeImport(importNode.name, /*namedImports*/ undefined, moduleSpecifier, quotePreference));
break;
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
if (ts.isRequireCall(importNode, /*checkArgumentIsStringLiteralLike*/ false)) {
changes.replaceNode(importingFile, importNode, ts.createPropertyAccess(ts.getSynthesizedDeepClone(importNode), "default"));
}
@@ -113749,29 +115038,29 @@
sourceFile.forEachChild(function recur(node) {
if (ts.isPropertyAccessExpression(node) && ts.isExportsOrModuleExportsOrAlias(sourceFile, node.expression)) {
var parent = node.parent;
- cb(node, ts.isBinaryExpression(parent) && parent.left === node && parent.operatorToken.kind === 59 /* EqualsToken */);
+ cb(node, ts.isBinaryExpression(parent) && parent.left === node && parent.operatorToken.kind === 60 /* EqualsToken */);
}
node.forEachChild(recur);
});
}
function convertStatement(sourceFile, statement, checker, changes, identifiers, target, exports, quotePreference) {
switch (statement.kind) {
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
convertVariableStatement(sourceFile, statement, changes, checker, identifiers, target, quotePreference);
return false;
- case 221 /* ExpressionStatement */: {
+ case 222 /* ExpressionStatement */: {
var expression = statement.expression;
switch (expression.kind) {
- case 191 /* CallExpression */: {
+ case 192 /* CallExpression */: {
if (ts.isRequireCall(expression, /*checkArgumentIsStringLiteralLike*/ true)) {
// For side-effecting require() call, just make a side-effecting import.
changes.replaceNode(sourceFile, statement, ts.makeImport(/*name*/ undefined, /*namedImports*/ undefined, expression.arguments[0], quotePreference));
}
return false;
}
- case 204 /* BinaryExpression */: {
+ case 205 /* BinaryExpression */: {
var operatorToken = expression.operatorToken;
- return operatorToken.kind === 59 /* EqualsToken */ && convertAssignment(sourceFile, checker, expression, changes, exports);
+ return operatorToken.kind === 60 /* EqualsToken */ && convertAssignment(sourceFile, checker, expression, changes, exports);
}
}
}
@@ -113811,8 +115100,8 @@
/** Converts `const name = require("moduleSpecifier").propertyName` */
function convertPropertyAccessImport(name, propertyName, moduleSpecifier, identifiers, quotePreference) {
switch (name.kind) {
- case 184 /* ObjectBindingPattern */:
- case 185 /* ArrayBindingPattern */: {
+ case 185 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */: {
// `const [a, b] = require("c").d` --> `import { d } from "c"; const [a, b] = d;`
var tmp = makeUniqueName(propertyName, identifiers);
return [
@@ -113820,7 +115109,7 @@
makeConst(/*modifiers*/ undefined, name, ts.createIdentifier(tmp)),
];
}
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
// `const a = require("b").c` --> `import { c as a } from "./b";
return [makeSingleImport(name.text, propertyName, moduleSpecifier, quotePreference)];
default:
@@ -113863,16 +115152,16 @@
function tryChangeModuleExportsObject(object) {
var statements = ts.mapAllOrFail(object.properties, function (prop) {
switch (prop.kind) {
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
// TODO: Maybe we should handle this? See fourslash test `refactorConvertToEs6Module_export_object_shorthand.ts`.
- case 276 /* ShorthandPropertyAssignment */:
- case 277 /* SpreadAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
+ case 278 /* SpreadAssignment */:
return undefined;
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return !ts.isIdentifier(prop.name) ? undefined : convertExportsDotXEquals_replaceNode(prop.name.text, prop.initializer);
- case 156 /* MethodDeclaration */:
- return !ts.isIdentifier(prop.name) ? undefined : functionExpressionToDeclaration(prop.name.text, [ts.createToken(85 /* ExportKeyword */)], prop);
+ case 157 /* MethodDeclaration */:
+ return !ts.isIdentifier(prop.name) ? undefined : functionExpressionToDeclaration(prop.name.text, [ts.createToken(86 /* ExportKeyword */)], prop);
default:
ts.Debug.assertNever(prop);
}
@@ -113921,7 +115210,7 @@
var name = left.name.text;
if ((ts.isFunctionExpression(right) || ts.isArrowFunction(right) || ts.isClassExpression(right)) && (!right.name || right.name.text === name)) {
// `exports.f = function() {}` -> `export function f() {}` -- Replace `exports.f = ` with `export `, and insert the name after `function`.
- changes.replaceRange(sourceFile, { pos: left.getStart(sourceFile), end: right.getStart(sourceFile) }, ts.createToken(85 /* ExportKeyword */), { suffix: " " });
+ changes.replaceRange(sourceFile, { pos: left.getStart(sourceFile), end: right.getStart(sourceFile) }, ts.createToken(86 /* ExportKeyword */), { suffix: " " });
if (!right.name)
changes.insertName(sourceFile, right, name);
var semi = ts.findChildOfKind(parent, 26 /* SemicolonToken */, sourceFile);
@@ -113930,14 +115219,14 @@
}
else {
// `exports.f = function g() {}` -> `export const f = function g() {}` -- just replace `exports.` with `export const `
- changes.replaceNodeRangeWithNodes(sourceFile, left.expression, ts.findChildOfKind(left, 24 /* DotToken */, sourceFile), [ts.createToken(85 /* ExportKeyword */), ts.createToken(77 /* ConstKeyword */)], { joiner: " ", suffix: " " });
+ changes.replaceNodeRangeWithNodes(sourceFile, left.expression, ts.findChildOfKind(left, 24 /* DotToken */, sourceFile), [ts.createToken(86 /* ExportKeyword */), ts.createToken(78 /* ConstKeyword */)], { joiner: " ", suffix: " " });
}
}
// TODO: GH#22492 this will cause an error if a change has been made inside the body of the node.
function convertExportsDotXEquals_replaceNode(name, exported) {
- var modifiers = [ts.createToken(85 /* ExportKeyword */)];
+ var modifiers = [ts.createToken(86 /* ExportKeyword */)];
switch (exported.kind) {
- case 196 /* FunctionExpression */: {
+ case 197 /* FunctionExpression */: {
var expressionName = exported.name;
if (expressionName && expressionName.text !== name) {
// `exports.f = function g() {}` -> `export const f = function g() {}`
@@ -113945,10 +115234,10 @@
}
}
// falls through
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
// `exports.f = function() {}` --> `export function f() {}`
return functionExpressionToDeclaration(name, modifiers, exported);
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
// `exports.C = class {}` --> `export class C {}`
return classExpressionToDeclaration(name, modifiers, exported);
default:
@@ -113966,7 +115255,7 @@
*/
function convertSingleImport(file, name, moduleSpecifier, changes, checker, identifiers, target, quotePreference) {
switch (name.kind) {
- case 184 /* ObjectBindingPattern */: {
+ case 185 /* ObjectBindingPattern */: {
var importSpecifiers = ts.mapAllOrFail(name.elements, function (e) {
return e.dotDotDotToken || e.initializer || e.propertyName && !ts.isIdentifier(e.propertyName) || !ts.isIdentifier(e.name)
? undefined
@@ -113977,7 +115266,7 @@
}
}
// falls through -- object destructuring has an interesting pattern and must be a variable declaration
- case 185 /* ArrayBindingPattern */: {
+ case 186 /* ArrayBindingPattern */: {
/*
import x from "x";
const [a, b, c] = x;
@@ -113988,7 +115277,7 @@
makeConst(/*modifiers*/ undefined, ts.getSynthesizedDeepClone(name), ts.createIdentifier(tmp)),
];
}
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return convertSingleIdentifierImport(file, name, moduleSpecifier, changes, checker, identifiers, quotePreference);
default:
return ts.Debug.assertNever(name);
@@ -114060,11 +115349,11 @@
function isFreeIdentifier(node) {
var parent = node.parent;
switch (parent.kind) {
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return parent.name !== node;
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return parent.propertyName !== node;
- case 253 /* ImportSpecifier */:
+ case 254 /* ImportSpecifier */:
return parent.propertyName !== node;
default:
return true;
@@ -114403,21 +115692,21 @@
function tryAddToExistingImport(existingImports) {
return ts.firstDefined(existingImports, function (_a) {
var declaration = _a.declaration, importKind = _a.importKind;
- if (declaration.kind !== 249 /* ImportDeclaration */)
+ if (declaration.kind !== 250 /* ImportDeclaration */)
return undefined;
var importClause = declaration.importClause;
if (!importClause)
return undefined;
var name = importClause.name, namedBindings = importClause.namedBindings;
- return importKind === 1 /* Default */ && !name || importKind === 0 /* Named */ && (!namedBindings || namedBindings.kind === 252 /* NamedImports */)
+ return importKind === 1 /* Default */ && !name || importKind === 0 /* Named */ && (!namedBindings || namedBindings.kind === 253 /* NamedImports */)
? { kind: 2 /* AddToExisting */, importClause: importClause, importKind: importKind }
: undefined;
});
}
function getNamespaceImportName(declaration) {
- if (declaration.kind === 249 /* ImportDeclaration */) {
+ if (declaration.kind === 250 /* ImportDeclaration */) {
var namedBindings = declaration.importClause && ts.isImportClause(declaration.importClause) && declaration.importClause.namedBindings;
- return namedBindings && namedBindings.kind === 251 /* NamespaceImport */ ? namedBindings.name : undefined;
+ return namedBindings && namedBindings.kind === 252 /* NamespaceImport */ ? namedBindings.name : undefined;
}
else {
return declaration.name;
@@ -114428,7 +115717,7 @@
// Can't use an es6 import for a type in JS.
return exportedSymbolIsTypeOnly && ts.isSourceFileJS(sourceFile) ? ts.emptyArray : ts.mapDefined(sourceFile.imports, function (moduleSpecifier) {
var i = ts.importFromModuleSpecifier(moduleSpecifier);
- return (i.kind === 249 /* ImportDeclaration */ || i.kind === 248 /* ImportEqualsDeclaration */)
+ return (i.kind === 250 /* ImportDeclaration */ || i.kind === 249 /* ImportEqualsDeclaration */)
&& checker.getSymbolAtLocation(moduleSpecifier) === moduleSymbol ? { declaration: i, importKind: importKind } : undefined;
});
}
@@ -114451,9 +115740,9 @@
}
function newImportInfoFromExistingSpecifier(_a) {
var declaration = _a.declaration, importKind = _a.importKind;
- var expression = declaration.kind === 249 /* ImportDeclaration */
+ var expression = declaration.kind === 250 /* ImportDeclaration */
? declaration.moduleSpecifier
- : declaration.moduleReference.kind === 259 /* ExternalModuleReference */
+ : declaration.moduleReference.kind === 260 /* ExternalModuleReference */
? declaration.moduleReference.expression
: undefined;
return expression && ts.isStringLiteral(expression) ? { kind: 3 /* AddNew */, moduleSpecifier: expression.text, importKind: importKind } : undefined;
@@ -114781,12 +116070,12 @@
var checker = context.program.getTypeChecker();
var suggestion;
if (ts.isPropertyAccessExpression(node.parent) && node.parent.name === node) {
- ts.Debug.assert(node.kind === 72 /* Identifier */);
+ ts.Debug.assert(node.kind === 73 /* Identifier */);
var containingType = checker.getTypeAtLocation(node.parent.expression);
suggestion = checker.getSuggestionForNonexistentProperty(node, containingType);
}
else if (ts.isImportSpecifier(node.parent) && node.parent.name === node) {
- ts.Debug.assert(node.kind === 72 /* Identifier */);
+ ts.Debug.assert(node.kind === 73 /* Identifier */);
var importDeclaration = ts.findAncestor(node, ts.isImportDeclaration);
var resolvedSourceFile = getResolvedSourceFileFromImportDeclaration(sourceFile, context, importDeclaration);
if (resolvedSourceFile && resolvedSourceFile.symbol) {
@@ -114849,7 +116138,7 @@
codefix.registerCodeFix({
errorCodes: errorCodes,
getCodeActions: function (context) {
- var info = getInfo(context.sourceFile, context.span.start, context.program.getTypeChecker());
+ var info = getInfo(context.sourceFile, context.span.start, context.program.getTypeChecker(), context.program);
if (!info)
return undefined;
if (info.kind === 0 /* Enum */) {
@@ -114872,7 +116161,7 @@
var typeDeclToMembers = new ts.NodeMap();
return codefix.createCombinedCodeActions(ts.textChanges.ChangeTracker.with(context, function (changes) {
codefix.eachDiagnostic(context, errorCodes, function (diag) {
- var info = getInfo(diag.file, diag.start, checker);
+ var info = getInfo(diag.file, diag.start, checker, context.program);
if (!info || !ts.addToSeen(seen, ts.getNodeId(info.parentDeclaration) + "#" + info.token.text)) {
return;
}
@@ -114940,7 +116229,7 @@
InfoKind[InfoKind["Enum"] = 0] = "Enum";
InfoKind[InfoKind["ClassOrInterface"] = 1] = "ClassOrInterface";
})(InfoKind || (InfoKind = {}));
- function getInfo(tokenSourceFile, tokenPos, checker) {
+ function getInfo(tokenSourceFile, tokenPos, checker, program) {
// The identifier of the missing property. eg:
// this.missing = 1;
// ^^^^^^^
@@ -114957,7 +116246,7 @@
return undefined;
// Prefer to change the class instead of the interface if they are merged
var classOrInterface = ts.find(symbol.declarations, ts.isClassLike) || ts.find(symbol.declarations, ts.isInterfaceDeclaration);
- if (classOrInterface) {
+ if (classOrInterface && !program.isSourceFileFromExternalLibrary(classOrInterface.getSourceFile())) {
var makeStatic = (leftExpressionType.target || leftExpressionType) !== checker.getDeclaredTypeOfSymbol(symbol);
var declSourceFile = classOrInterface.getSourceFile();
var inJs = ts.isSourceFileJS(declSourceFile);
@@ -114965,7 +116254,7 @@
return { kind: 1 /* ClassOrInterface */, token: token, parentDeclaration: classOrInterface, makeStatic: makeStatic, declSourceFile: declSourceFile, inJs: inJs, call: call };
}
var enumDeclaration = ts.find(symbol.declarations, ts.isEnumDeclaration);
- if (enumDeclaration) {
+ if (enumDeclaration && !program.isSourceFileFromExternalLibrary(enumDeclaration.getSourceFile())) {
return { kind: 0 /* Enum */, token: token, parentDeclaration: enumDeclaration };
}
return undefined;
@@ -114977,7 +116266,7 @@
}
function addMissingMemberInJs(changeTracker, declSourceFile, classDeclaration, tokenName, makeStatic) {
if (makeStatic) {
- if (classDeclaration.kind === 209 /* ClassExpression */) {
+ if (classDeclaration.kind === 210 /* ClassExpression */) {
return;
}
var className = classDeclaration.name.getText();
@@ -115003,7 +116292,7 @@
}
function getTypeNode(checker, classDeclaration, token) {
var typeNode;
- if (token.parent.parent.kind === 204 /* BinaryExpression */) {
+ if (token.parent.parent.kind === 205 /* BinaryExpression */) {
var binaryExpression = token.parent.parent;
var otherExpression = token.parent === binaryExpression.left ? binaryExpression.right : binaryExpression.left;
var widenedType = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(otherExpression)));
@@ -115013,7 +116302,7 @@
var contextualType = checker.getContextualType(token.parent);
typeNode = contextualType ? checker.typeToTypeNode(contextualType) : undefined;
}
- return typeNode || ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ return typeNode || ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
function createAddPropertyDeclarationAction(context, declSourceFile, classDeclaration, makeStatic, tokenName, typeNode) {
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addPropertyDeclaration(t, declSourceFile, classDeclaration, tokenName, typeNode, makeStatic); });
@@ -115022,7 +116311,7 @@
function addPropertyDeclaration(changeTracker, declSourceFile, classDeclaration, tokenName, typeNode, makeStatic) {
var property = ts.createProperty(
/*decorators*/ undefined,
- /*modifiers*/ makeStatic ? [ts.createToken(116 /* StaticKeyword */)] : undefined, tokenName,
+ /*modifiers*/ makeStatic ? [ts.createToken(117 /* StaticKeyword */)] : undefined, tokenName,
/*questionToken*/ undefined, typeNode,
/*initializer*/ undefined);
var lastProp = getNodeToInsertPropertyAfter(classDeclaration);
@@ -115046,7 +116335,7 @@
}
function createAddIndexSignatureAction(context, declSourceFile, classDeclaration, tokenName, typeNode) {
// Index signatures cannot have the static modifier.
- var stringTypeNode = ts.createKeywordTypeNode(138 /* StringKeyword */);
+ var stringTypeNode = ts.createKeywordTypeNode(139 /* StringKeyword */);
var indexingParameter = ts.createParameter(
/*decorators*/ undefined,
/*modifiers*/ undefined,
@@ -115066,7 +116355,7 @@
}
function addMethodDeclaration(context, changeTracker, declSourceFile, typeDecl, token, callExpression, makeStatic, inJs, preferences) {
var methodDeclaration = codefix.createMethodFromCallExpression(context, callExpression, token.text, inJs, makeStatic, preferences, typeDecl);
- var containingMethodDeclaration = ts.getAncestor(callExpression, 156 /* MethodDeclaration */);
+ var containingMethodDeclaration = ts.getAncestor(callExpression, 157 /* MethodDeclaration */);
if (containingMethodDeclaration && containingMethodDeclaration.parent === typeDecl) {
changeTracker.insertNodeAfter(declSourceFile, containingMethodDeclaration, methodDeclaration);
}
@@ -115130,7 +116419,6 @@
(function (codefix) {
var fixName = "fixCannotFindModule";
var fixIdInstallTypesPackage = "installTypesPackage";
- var fixIdGenerateTypes = "generateTypes";
var errorCodeCannotFindModule = ts.Diagnostics.Cannot_find_module_0.code;
var errorCodes = [
errorCodeCannotFindModule,
@@ -115145,13 +116433,12 @@
return undefined;
var typesPackageName = getTypesPackageNameToInstall(packageName, host, context.errorCode);
return typesPackageName === undefined
- ? ts.singleElementArray(tryGetGenerateTypesAction(context, packageName))
+ ? []
: [codefix.createCodeFixAction(fixName, /*changes*/ [], [ts.Diagnostics.Install_0, typesPackageName], fixIdInstallTypesPackage, ts.Diagnostics.Install_all_missing_types_packages, getInstallCommand(sourceFile.fileName, typesPackageName))];
},
- fixIds: [fixIdInstallTypesPackage, fixIdGenerateTypes],
+ fixIds: [fixIdInstallTypesPackage],
getAllCodeActions: function (context) {
- var savedTypesDir = null; // tslint:disable-line no-null-keyword
- return codefix.codeFixAll(context, errorCodes, function (changes, diag, commands) {
+ return codefix.codeFixAll(context, errorCodes, function (_changes, diag, commands) {
var packageName = tryGetImportedPackageName(diag.file, diag.start);
if (packageName === undefined)
return undefined;
@@ -115163,96 +116450,12 @@
}
break;
}
- case fixIdGenerateTypes: {
- var typesDir = savedTypesDir !== null ? savedTypesDir : savedTypesDir = getOrCreateTypesDirectory(changes, context);
- var command = typesDir === undefined ? undefined : tryGenerateTypes(typesDir, packageName, context);
- if (command)
- commands.push(command);
- break;
- }
default:
ts.Debug.fail("Bad fixId: " + context.fixId);
}
});
},
});
- function tryGetGenerateTypesAction(context, packageName) {
- var command;
- var changes = ts.textChanges.ChangeTracker.with(context, function (t) {
- var typesDir = getOrCreateTypesDirectory(t, context);
- command = typesDir === undefined ? undefined : tryGenerateTypes(typesDir, packageName, context);
- });
- return command && codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Generate_types_for_0, packageName], fixIdGenerateTypes, ts.Diagnostics.Generate_types_for_all_packages_without_types, command);
- }
- function tryGenerateTypes(typesDir, packageName, context) {
- var file = context.sourceFile.fileName;
- var fileToGenerateTypesFor = ts.tryResolveJSModule(packageName, ts.getDirectoryPath(file), context.host); // TODO: GH#18217
- if (fileToGenerateTypesFor === undefined)
- return undefined;
- var outputFileName = ts.resolvePath(ts.getDirectoryPath(context.program.getCompilerOptions().configFile.fileName), typesDir, packageName + ".d.ts");
- if (context.host.fileExists(outputFileName))
- return undefined;
- return { type: "generate types", file: file, fileToGenerateTypesFor: fileToGenerateTypesFor, outputFileName: outputFileName };
- }
- // If no types directory exists yet, adds it to tsconfig.json
- function getOrCreateTypesDirectory(changes, context) {
- var configFile = context.program.getCompilerOptions().configFile;
- if (!configFile)
- return undefined;
- var tsconfigObjectLiteral = ts.getTsConfigObjectLiteralExpression(configFile);
- if (!tsconfigObjectLiteral)
- return undefined;
- var compilerOptionsProperty = codefix.findJsonProperty(tsconfigObjectLiteral, "compilerOptions");
- if (!compilerOptionsProperty) {
- var newCompilerOptions = ts.createObjectLiteral([makeDefaultBaseUrl(), makeDefaultPaths()]);
- changes.insertNodeAtObjectStart(configFile, tsconfigObjectLiteral, codefix.createJsonPropertyAssignment("compilerOptions", newCompilerOptions));
- return defaultTypesDirectoryName;
- }
- var compilerOptions = compilerOptionsProperty.initializer;
- if (!ts.isObjectLiteralExpression(compilerOptions))
- return defaultTypesDirectoryName;
- var baseUrl = getOrAddBaseUrl(changes, configFile, compilerOptions);
- var typesDirectoryFromPathMapping = getOrAddPathMapping(changes, configFile, compilerOptions);
- return ts.combinePaths(baseUrl, typesDirectoryFromPathMapping);
- }
- var defaultBaseUrl = ".";
- function makeDefaultBaseUrl() {
- return codefix.createJsonPropertyAssignment("baseUrl", ts.createStringLiteral(defaultBaseUrl));
- }
- function getOrAddBaseUrl(changes, tsconfig, compilerOptions) {
- var baseUrlProp = codefix.findJsonProperty(compilerOptions, "baseUrl");
- if (baseUrlProp) {
- return ts.isStringLiteral(baseUrlProp.initializer) ? baseUrlProp.initializer.text : defaultBaseUrl;
- }
- else {
- changes.insertNodeAtObjectStart(tsconfig, compilerOptions, makeDefaultBaseUrl());
- return defaultBaseUrl;
- }
- }
- var defaultTypesDirectoryName = "types";
- function makeDefaultPathMapping() {
- return codefix.createJsonPropertyAssignment("*", ts.createArrayLiteral([ts.createStringLiteral(defaultTypesDirectoryName + "/*")]));
- }
- function makeDefaultPaths() {
- return codefix.createJsonPropertyAssignment("paths", ts.createObjectLiteral([makeDefaultPathMapping()]));
- }
- function getOrAddPathMapping(changes, tsconfig, compilerOptions) {
- var paths = codefix.findJsonProperty(compilerOptions, "paths");
- if (!paths || !ts.isObjectLiteralExpression(paths.initializer)) {
- changes.insertNodeAtObjectStart(tsconfig, compilerOptions, makeDefaultPaths());
- return defaultTypesDirectoryName;
- }
- // Look for an existing path mapping. Should look like `"*": "foo/*"`.
- var existing = ts.firstDefined(paths.initializer.properties, function (prop) {
- return ts.isPropertyAssignment(prop) && ts.isStringLiteral(prop.name) && prop.name.text === "*" && ts.isArrayLiteralExpression(prop.initializer)
- ? ts.firstDefined(prop.initializer.elements, function (value) { return ts.isStringLiteral(value) ? ts.tryRemoveSuffix(value.text, "/*") : undefined; })
- : undefined;
- });
- if (existing)
- return existing;
- changes.insertNodeAtObjectStart(tsconfig, paths.initializer, makeDefaultPathMapping());
- return defaultTypesDirectoryName;
- }
function getInstallCommand(fileName, packageName) {
return { type: "install package", file: fileName, packageName: packageName };
}
@@ -115360,7 +116563,7 @@
}
function getNodes(sourceFile, pos) {
var token = ts.getTokenAtPosition(sourceFile, pos);
- if (token.kind !== 100 /* ThisKeyword */)
+ if (token.kind !== 101 /* ThisKeyword */)
return undefined;
var constructor = ts.getContainingFunction(token);
var superCall = findSuperCall(constructor.body);
@@ -115399,7 +116602,7 @@
});
function getNode(sourceFile, pos) {
var token = ts.getTokenAtPosition(sourceFile, pos);
- ts.Debug.assert(token.kind === 124 /* ConstructorKeyword */);
+ ts.Debug.assert(token.kind === 125 /* ConstructorKeyword */);
return token.parent;
}
function doChange(changes, sourceFile, ctr) {
@@ -115415,7 +116618,7 @@
(function (codefix) {
var fixId = "enableExperimentalDecorators";
var errorCodes = [
- ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning.code
+ ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning.code
];
codefix.registerCodeFix({
errorCodes: errorCodes,
@@ -115424,12 +116627,19 @@
if (configFile === undefined) {
return undefined;
}
- var changes = ts.textChanges.ChangeTracker.with(context, function (changeTracker) { return makeChange(changeTracker, configFile); });
+ var changes = ts.textChanges.ChangeTracker.with(context, function (changeTracker) { return doChange(changeTracker, configFile); });
return [codefix.createCodeFixActionNoFixId(fixId, changes, ts.Diagnostics.Enable_the_experimentalDecorators_option_in_your_configuration_file)];
},
fixIds: [fixId],
+ getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes) {
+ var configFile = context.program.getCompilerOptions().configFile;
+ if (configFile === undefined) {
+ return undefined;
+ }
+ doChange(changes, configFile);
+ }); },
});
- function makeChange(changeTracker, configFile) {
+ function doChange(changeTracker, configFile) {
codefix.setJsonCompilerOptionValue(changeTracker, configFile, "experimentalDecorators", ts.createTrue());
}
})(codefix = ts.codefix || (ts.codefix = {}));
@@ -115463,14 +116673,14 @@
var token = ts.getTokenAtPosition(sourceFile, pos);
var heritageClauses = ts.getContainingClass(token).heritageClauses;
var extendsToken = heritageClauses[0].getFirstToken();
- return extendsToken.kind === 86 /* ExtendsKeyword */ ? { extendsToken: extendsToken, heritageClauses: heritageClauses } : undefined;
+ return extendsToken.kind === 87 /* ExtendsKeyword */ ? { extendsToken: extendsToken, heritageClauses: heritageClauses } : undefined;
}
function doChanges(changes, sourceFile, extendsToken, heritageClauses) {
- changes.replaceNode(sourceFile, extendsToken, ts.createToken(109 /* ImplementsKeyword */));
+ changes.replaceNode(sourceFile, extendsToken, ts.createToken(110 /* ImplementsKeyword */));
// If there is already an implements clause, replace the implements keyword with a comma.
if (heritageClauses.length === 2 &&
- heritageClauses[0].token === 86 /* ExtendsKeyword */ &&
- heritageClauses[1].token === 109 /* ImplementsKeyword */) {
+ heritageClauses[0].token === 87 /* ExtendsKeyword */ &&
+ heritageClauses[1].token === 110 /* ImplementsKeyword */) {
var implementsToken = heritageClauses[1].getFirstToken();
var implementsFullStart = implementsToken.getFullStart();
changes.replaceRange(sourceFile, { pos: implementsFullStart, end: implementsFullStart }, ts.createToken(27 /* CommaToken */));
@@ -115577,7 +116787,7 @@
return [createDeleteFix(delVar, ts.Diagnostics.Remove_variable_statement)];
}
var result = [];
- if (token.kind === 127 /* InferKeyword */) {
+ if (token.kind === 128 /* InferKeyword */) {
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return changeInferToUnknown(t, sourceFile, token); });
var name = ts.cast(token.parent, ts.isInferTypeNode).typeParameter.name.text;
result.push(codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Replace_infer_0_with_unknown, name], fixIdInfer, ts.Diagnostics.Replace_all_unused_infer_with_unknown));
@@ -115609,7 +116819,7 @@
tryPrefixDeclaration(changes, diag.code, sourceFile, token);
break;
case fixIdDelete: {
- if (token.kind === 127 /* InferKeyword */)
+ if (token.kind === 128 /* InferKeyword */)
break; // Can't delete
var importDecl = tryGetFullImport(token);
if (importDecl) {
@@ -115628,7 +116838,7 @@
break;
}
case fixIdInfer:
- if (token.kind === 127 /* InferKeyword */) {
+ if (token.kind === 128 /* InferKeyword */) {
changeInferToUnknown(changes, sourceFile, token);
}
break;
@@ -115639,7 +116849,7 @@
},
});
function changeInferToUnknown(changes, sourceFile, token) {
- changes.replaceNode(sourceFile, token.parent, ts.createKeywordTypeNode(143 /* UnknownKeyword */));
+ changes.replaceNode(sourceFile, token.parent, ts.createKeywordTypeNode(144 /* UnknownKeyword */));
}
function createDeleteFix(changes, diag) {
return codefix.createCodeFixAction(fixName, changes, diag, fixIdDelete, ts.Diagnostics.Delete_all_unused_declarations);
@@ -115649,13 +116859,13 @@
}
// Sometimes the diagnostic span is an entire ImportDeclaration, so we should remove the whole thing.
function tryGetFullImport(token) {
- return token.kind === 92 /* ImportKeyword */ ? ts.tryCast(token.parent, ts.isImportDeclaration) : undefined;
+ return token.kind === 93 /* ImportKeyword */ ? ts.tryCast(token.parent, ts.isImportDeclaration) : undefined;
}
function tryDeleteFullDestructure(token, changes, sourceFile, checker, sourceFiles, isFixAll) {
if (token.kind !== 18 /* OpenBraceToken */ || !ts.isObjectBindingPattern(token.parent))
return false;
var decl = token.parent.parent;
- if (decl.kind === 151 /* Parameter */) {
+ if (decl.kind === 152 /* Parameter */) {
tryDeleteParameter(changes, sourceFile, decl, checker, sourceFiles, isFixAll);
}
else {
@@ -115666,7 +116876,7 @@
function tryDeleteFullVariableStatement(sourceFile, token, changes) {
var declarationList = ts.tryCast(token.parent, ts.isVariableDeclarationList);
if (declarationList && declarationList.getChildren(sourceFile)[0] === token) {
- changes.delete(sourceFile, declarationList.parent.kind === 219 /* VariableStatement */ ? declarationList.parent : declarationList);
+ changes.delete(sourceFile, declarationList.parent.kind === 220 /* VariableStatement */ ? declarationList.parent : declarationList);
return true;
}
return false;
@@ -115675,7 +116885,7 @@
// Don't offer to prefix a property.
if (errorCode === ts.Diagnostics.Property_0_is_declared_but_its_value_is_never_read.code)
return;
- if (token.kind === 127 /* InferKeyword */) {
+ if (token.kind === 128 /* InferKeyword */) {
token = ts.cast(token.parent, ts.isInferTypeNode).typeParameter.name;
}
if (ts.isIdentifier(token) && canPrefix(token)) {
@@ -115684,14 +116894,14 @@
}
function canPrefix(token) {
switch (token.parent.kind) {
- case 151 /* Parameter */:
- case 150 /* TypeParameter */:
+ case 152 /* Parameter */:
+ case 151 /* TypeParameter */:
return true;
- case 237 /* VariableDeclaration */: {
+ case 238 /* VariableDeclaration */: {
var varDecl = token.parent;
switch (varDecl.parent.parent.kind) {
- case 227 /* ForOfStatement */:
- case 226 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 227 /* ForInStatement */:
return true;
}
}
@@ -115738,26 +116948,26 @@
function mayDeleteParameter(p, checker, isFixAll) {
var parent = p.parent;
switch (parent.kind) {
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
// Don't remove a parameter if this overrides something.
var symbol = checker.getSymbolAtLocation(parent.name);
if (ts.isMemberSymbolInBaseType(symbol, checker))
return false;
// falls through
- case 157 /* Constructor */:
- case 239 /* FunctionDeclaration */:
+ case 158 /* Constructor */:
+ case 240 /* FunctionDeclaration */:
return true;
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */: {
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */: {
// Can't remove a non-last parameter in a callback. Can remove a parameter in code-fix-all if future parameters are also unused.
var parameters = parent.parameters;
var index = parameters.indexOf(p);
ts.Debug.assert(index !== -1);
return isFixAll
- ? parameters.slice(index + 1).every(function (p) { return p.name.kind === 72 /* Identifier */ && !p.symbol.isReferenced; })
+ ? parameters.slice(index + 1).every(function (p) { return p.name.kind === 73 /* Identifier */ && !p.symbol.isReferenced; })
: index === parameters.length - 1;
}
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
// Setter must have a parameter
return false;
default:
@@ -115797,7 +117007,7 @@
var container = (ts.isBlock(statement.parent) ? statement.parent : statement).parent;
if (!ts.isBlock(statement.parent) || statement === ts.first(statement.parent.statements)) {
switch (container.kind) {
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
if (container.elseStatement) {
if (ts.isBlock(statement.parent)) {
break;
@@ -115808,15 +117018,15 @@
return;
}
// falls through
- case 224 /* WhileStatement */:
- case 225 /* ForStatement */:
+ case 225 /* WhileStatement */:
+ case 226 /* ForStatement */:
changes.delete(sourceFile, container);
return;
}
}
if (ts.isBlock(statement.parent)) {
- var end_2 = start + length;
- var lastStatement = ts.Debug.assertDefined(lastWhere(ts.sliceAfter(statement.parent.statements, statement), function (s) { return s.pos < end_2; }));
+ var end_3 = start + length;
+ var lastStatement = ts.Debug.assertDefined(lastWhere(ts.sliceAfter(statement.parent.statements, statement), function (s) { return s.pos < end_3; }));
changes.deleteNodeRange(sourceFile, statement, lastStatement);
}
else {
@@ -115882,7 +117092,7 @@
var typeNode = info.typeNode, type = info.type;
var original = typeNode.getText(sourceFile);
var actions = [fix(type, fixIdPlain, ts.Diagnostics.Change_all_jsdoc_style_types_to_TypeScript)];
- if (typeNode.kind === 291 /* JSDocNullableType */) {
+ if (typeNode.kind === 292 /* JSDocNullableType */) {
// for nullable types, suggest the flow-compatible `T | null | undefined`
// in addition to the jsdoc/closure-compatible `T | null`
actions.push(fix(checker.getNullableType(type, 32768 /* Undefined */), fixIdNullable, ts.Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types));
@@ -115902,7 +117112,7 @@
if (!info)
return;
var typeNode = info.typeNode, type = info.type;
- var fixedType = typeNode.kind === 291 /* JSDocNullableType */ && fixId === fixIdNullable ? checker.getNullableType(type, 32768 /* Undefined */) : type;
+ var fixedType = typeNode.kind === 292 /* JSDocNullableType */ && fixId === fixIdNullable ? checker.getNullableType(type, 32768 /* Undefined */) : type;
doChange(changes, sourceFile, typeNode, fixedType, checker);
});
}
@@ -115919,22 +117129,22 @@
// NOTE: Some locations are not handled yet:
// MappedTypeNode.typeParameters and SignatureDeclaration.typeParameters, as well as CallExpression.typeArguments
switch (node.kind) {
- case 212 /* AsExpression */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 239 /* FunctionDeclaration */:
- case 158 /* GetAccessor */:
- case 162 /* IndexSignature */:
- case 181 /* MappedType */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 151 /* Parameter */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 159 /* SetAccessor */:
- case 242 /* TypeAliasDeclaration */:
- case 194 /* TypeAssertionExpression */:
- case 237 /* VariableDeclaration */:
+ case 213 /* AsExpression */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 240 /* FunctionDeclaration */:
+ case 159 /* GetAccessor */:
+ case 163 /* IndexSignature */:
+ case 182 /* MappedType */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 152 /* Parameter */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 160 /* SetAccessor */:
+ case 243 /* TypeAliasDeclaration */:
+ case 195 /* TypeAssertionExpression */:
+ case 238 /* VariableDeclaration */:
return true;
default:
return false;
@@ -115988,14 +117198,14 @@
}
var insertBefore;
switch (containingFunction.kind) {
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
insertBefore = containingFunction.name;
break;
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- insertBefore = ts.findChildOfKind(containingFunction, 90 /* FunctionKeyword */, sourceFile);
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ insertBefore = ts.findChildOfKind(containingFunction, 91 /* FunctionKeyword */, sourceFile);
break;
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
insertBefore = ts.findChildOfKind(containingFunction, 20 /* OpenParenToken */, sourceFile) || ts.first(containingFunction.parameters);
break;
default:
@@ -116010,11 +117220,11 @@
var insertBefore = _a.insertBefore, returnType = _a.returnType;
if (returnType) {
var entityName = ts.getEntityNameFromTypeNode(returnType);
- if (!entityName || entityName.kind !== 72 /* Identifier */ || entityName.text !== "Promise") {
+ if (!entityName || entityName.kind !== 73 /* Identifier */ || entityName.text !== "Promise") {
changes.replaceNode(sourceFile, returnType, ts.createTypeReferenceNode("Promise", ts.createNodeArray([returnType])));
}
}
- changes.insertModifierBefore(sourceFile, 121 /* AsyncKeyword */, insertBefore);
+ changes.insertModifierBefore(sourceFile, 122 /* AsyncKeyword */, insertBefore);
}
})(codefix = ts.codefix || (ts.codefix = {}));
})(ts || (ts = {}));
@@ -116123,17 +117333,17 @@
var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration));
var optional = !!(symbol.flags & 16777216 /* Optional */);
switch (declaration.kind) {
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 153 /* PropertySignature */:
- case 154 /* PropertyDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 154 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
var typeNode = checker.typeToTypeNode(type, enclosingDeclaration, /*flags*/ undefined, getNoopSymbolTrackerWithResolver(context));
out(ts.createProperty(
/*decorators*/ undefined, modifiers, name, optional ? ts.createToken(56 /* QuestionToken */) : undefined, typeNode,
/*initializer*/ undefined));
break;
- case 155 /* MethodSignature */:
- case 156 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
// The signature for the implementation appears as an entry in `signatures` iff
// there is only one signature.
// If there are overloads and an implementation signature, it appears as an
@@ -116174,7 +117384,7 @@
}
function signatureToMethodDeclaration(context, signature, enclosingDeclaration, modifiers, name, optional, body) {
var program = context.program;
- var signatureDeclaration = program.getTypeChecker().signatureToSignatureDeclaration(signature, 156 /* MethodDeclaration */, enclosingDeclaration, 1 /* NoTruncation */ | 256 /* SuppressAnyReturnType */, getNoopSymbolTrackerWithResolver(context));
+ var signatureDeclaration = program.getTypeChecker().signatureToSignatureDeclaration(signature, 157 /* MethodDeclaration */, enclosingDeclaration, 1 /* NoTruncation */ | 256 /* SuppressAnyReturnType */, getNoopSymbolTrackerWithResolver(context));
if (!signatureDeclaration) {
return undefined;
}
@@ -116202,7 +117412,7 @@
var returnType = (inJs || !contextualType) ? undefined : checker.typeToTypeNode(contextualType, contextNode, /*flags*/ undefined, tracker);
return ts.createMethod(
/*decorators*/ undefined,
- /*modifiers*/ makeStatic ? [ts.createToken(116 /* StaticKeyword */)] : undefined,
+ /*modifiers*/ makeStatic ? [ts.createToken(117 /* StaticKeyword */)] : undefined,
/*asteriskToken*/ ts.isYieldExpression(parent) ? ts.createToken(40 /* AsteriskToken */) : undefined, methodName,
/*questionToken*/ undefined,
/*typeParameters*/ inJs ? undefined : ts.map(typeArguments, function (_, i) {
@@ -116221,7 +117431,7 @@
/*dotDotDotToken*/ undefined,
/*name*/ names && names[i] || "arg" + i,
/*questionToken*/ minArgumentCount !== undefined && i >= minArgumentCount ? ts.createToken(56 /* QuestionToken */) : undefined,
- /*type*/ inJs ? undefined : types && types[i] || ts.createKeywordTypeNode(120 /* AnyKeyword */),
+ /*type*/ inJs ? undefined : types && types[i] || ts.createKeywordTypeNode(121 /* AnyKeyword */),
/*initializer*/ undefined);
parameters.push(newParameter);
}
@@ -116249,7 +117459,7 @@
var maxArgsParameterSymbolNames = maxArgsSignature.parameters.map(function (symbol) { return symbol.name; });
var parameters = createDummyParameters(maxNonRestArgs, maxArgsParameterSymbolNames, /* types */ undefined, minArgumentCount, /*inJs*/ false);
if (someSigHasRestParameter) {
- var anyArrayType = ts.createArrayTypeNode(ts.createKeywordTypeNode(120 /* AnyKeyword */));
+ var anyArrayType = ts.createArrayTypeNode(ts.createKeywordTypeNode(121 /* AnyKeyword */));
var restParameter = ts.createParameter(
/*decorators*/ undefined,
/*modifiers*/ undefined, ts.createToken(25 /* DotDotDotToken */), maxArgsParameterSymbolNames[maxNonRestArgs] || "rest",
@@ -116275,10 +117485,10 @@
}
function createVisibilityModifier(flags) {
if (flags & 4 /* Public */) {
- return ts.createToken(115 /* PublicKeyword */);
+ return ts.createToken(116 /* PublicKeyword */);
}
else if (flags & 16 /* Protected */) {
- return ts.createToken(114 /* ProtectedKeyword */);
+ return ts.createToken(115 /* ProtectedKeyword */);
}
return undefined;
}
@@ -116350,7 +117560,7 @@
});
function getActionsForUsageOfInvalidImport(context) {
var sourceFile = context.sourceFile;
- var targetKind = ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures.code === context.errorCode ? 191 /* CallExpression */ : 192 /* NewExpression */;
+ var targetKind = ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures.code === context.errorCode ? 192 /* CallExpression */ : 193 /* NewExpression */;
var node = ts.findAncestor(ts.getTokenAtPosition(sourceFile, context.span.start), function (a) { return a.kind === targetKind && a.getStart() === context.span.start && a.getEnd() === (context.span.start + context.span.length); });
if (!node) {
return [];
@@ -116469,7 +117679,7 @@
return codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Add_undefined_type_to_property_0, propertyDeclaration.name.getText()], fixIdAddUndefinedType, ts.Diagnostics.Add_undefined_type_to_all_uninitialized_properties);
}
function addUndefinedType(changeTracker, propertyDeclarationSourceFile, propertyDeclaration) {
- var undefinedTypeNode = ts.createKeywordTypeNode(141 /* UndefinedKeyword */);
+ var undefinedTypeNode = ts.createKeywordTypeNode(142 /* UndefinedKeyword */);
var type = propertyDeclaration.type; // TODO: GH#18217
var types = ts.isUnionTypeNode(type) ? type.types.concat(undefinedTypeNode) : [type, undefinedTypeNode];
changeTracker.replaceNode(propertyDeclarationSourceFile, type, ts.createUnionTypeNode(types));
@@ -116515,235 +117725,6 @@
}
})(codefix = ts.codefix || (ts.codefix = {}));
})(ts || (ts = {}));
-var ts;
-(function (ts) {
- function generateTypesForModule(name, moduleValue, formatSettings) {
- return generateTypesForModuleOrGlobal(name, moduleValue, formatSettings, 0 /* ExportEquals */);
- }
- ts.generateTypesForModule = generateTypesForModule;
- function generateTypesForGlobal(name, globalValue, formatSettings) {
- return generateTypesForModuleOrGlobal(name, globalValue, formatSettings, 3 /* Global */);
- }
- ts.generateTypesForGlobal = generateTypesForGlobal;
- function generateTypesForModuleOrGlobal(name, globalValue, formatSettings, outputKind) {
- return valueInfoToDeclarationFileText(ts.inspectValue(name, globalValue), formatSettings, outputKind);
- }
- /* @internal */
- function valueInfoToDeclarationFileText(valueInfo, formatSettings, outputKind) {
- if (outputKind === void 0) { outputKind = 0 /* ExportEquals */; }
- return ts.textChanges.getNewFileText(toStatements(valueInfo, outputKind), 3 /* TS */, formatSettings.newLineCharacter || "\n", ts.formatting.getFormatContext(formatSettings));
- }
- ts.valueInfoToDeclarationFileText = valueInfoToDeclarationFileText;
- /* @internal */
- var OutputKind;
- (function (OutputKind) {
- OutputKind[OutputKind["ExportEquals"] = 0] = "ExportEquals";
- OutputKind[OutputKind["NamedExport"] = 1] = "NamedExport";
- OutputKind[OutputKind["NamespaceMember"] = 2] = "NamespaceMember";
- OutputKind[OutputKind["Global"] = 3] = "Global";
- })(OutputKind || (OutputKind = {}));
- function toNamespaceMemberStatements(info) {
- return toStatements(info, 2 /* NamespaceMember */);
- }
- function toStatements(info, kind) {
- var isDefault = info.name === "default" /* Default */;
- var name = isDefault ? "_default" : info.name;
- if (!isValidIdentifier(name) || isDefault && kind !== 1 /* NamedExport */)
- return ts.emptyArray;
- var modifiers = isDefault && info.kind === 2 /* FunctionOrClass */ ? [ts.createModifier(85 /* ExportKeyword */), ts.createModifier(80 /* DefaultKeyword */)]
- : kind === 3 /* Global */ || kind === 0 /* ExportEquals */ ? [ts.createModifier(125 /* DeclareKeyword */)]
- : kind === 1 /* NamedExport */ ? [ts.createModifier(85 /* ExportKeyword */)]
- : undefined;
- var exportEquals = function () { return kind === 0 /* ExportEquals */ ? [exportEqualsOrDefault(info.name, /*isExportEquals*/ true)] : ts.emptyArray; };
- var exportDefault = function () { return isDefault ? [exportEqualsOrDefault("_default", /*isExportEquals*/ false)] : ts.emptyArray; };
- switch (info.kind) {
- case 2 /* FunctionOrClass */:
- return exportEquals().concat(functionOrClassToStatements(modifiers, name, info));
- case 3 /* Object */:
- var members = info.members, hasNontrivialPrototype = info.hasNontrivialPrototype;
- if (!hasNontrivialPrototype) {
- if (kind === 0 /* ExportEquals */) {
- return ts.flatMap(members, function (v) { return toStatements(v, 1 /* NamedExport */); });
- }
- if (members.some(function (m) { return m.kind === 2 /* FunctionOrClass */; })) {
- // If some member is a function, use a namespace so it gets a FunctionDeclaration or ClassDeclaration.
- return exportDefault().concat([createNamespace(modifiers, name, ts.flatMap(members, toNamespaceMemberStatements))]);
- }
- }
- // falls through
- case 0 /* Const */:
- case 1 /* Array */: {
- var comment = info.kind === 0 /* Const */ ? info.comment : undefined;
- var constVar = ts.createVariableStatement(modifiers, ts.createVariableDeclarationList([ts.createVariableDeclaration(name, toType(info))], 2 /* Const */));
- return exportEquals().concat(exportDefault(), [addComment(constVar, comment)]);
- }
- default:
- return ts.Debug.assertNever(info);
- }
- }
- function exportEqualsOrDefault(name, isExportEquals) {
- return ts.createExportAssignment(/*decorators*/ undefined, /*modifiers*/ undefined, isExportEquals, ts.createIdentifier(name));
- }
- function functionOrClassToStatements(modifiers, name, _a) {
- var source = _a.source, prototypeMembers = _a.prototypeMembers, namespaceMembers = _a.namespaceMembers;
- var fnAst = parseClassOrFunctionBody(source);
- var _b = fnAst === undefined ? { parameters: ts.emptyArray, returnType: anyType() } : getParametersAndReturnType(fnAst), parameters = _b.parameters, returnType = _b.returnType;
- var protoOrInstanceMembers = ts.createMap();
- if (typeof fnAst === "object")
- getConstructorFunctionInstanceProperties(fnAst, protoOrInstanceMembers);
- for (var _i = 0, prototypeMembers_1 = prototypeMembers; _i < prototypeMembers_1.length; _i++) {
- var p = prototypeMembers_1[_i];
- // ignore non-functions on the prototype
- if (p.kind === 2 /* FunctionOrClass */) {
- var m = tryGetMethod(p);
- if (m) {
- protoOrInstanceMembers.set(p.name, m);
- }
- }
- }
- var classStaticMembers = protoOrInstanceMembers.size !== 0 || fnAst === undefined || typeof fnAst !== "number" && fnAst.kind === 157 /* Constructor */ ? [] : undefined;
- var namespaceStatements = ts.flatMap(namespaceMembers, function (info) {
- if (!isValidIdentifier(info.name))
- return undefined;
- if (classStaticMembers) {
- switch (info.kind) {
- case 3 /* Object */:
- if (info.members.some(function (m) { return m.kind === 2 /* FunctionOrClass */; })) {
- break;
- }
- // falls through
- case 1 /* Array */:
- case 0 /* Const */:
- classStaticMembers.push(addComment(ts.createProperty(/*decorators*/ undefined, [ts.createModifier(116 /* StaticKeyword */)], info.name, /*questionOrExclamationToken*/ undefined, toType(info), /*initializer*/ undefined), info.kind === 0 /* Const */ ? info.comment : undefined));
- return undefined;
- case 2 /* FunctionOrClass */:
- if (!info.namespaceMembers.length) { // Else, can't merge a static method with a namespace. Must make it a function on the namespace.
- var sig = tryGetMethod(info, [ts.createModifier(116 /* StaticKeyword */)]);
- if (sig) {
- classStaticMembers.push(sig);
- return undefined;
- }
- }
- break;
- default:
- ts.Debug.assertNever(info);
- }
- }
- return toStatements(info, 2 /* NamespaceMember */);
- });
- var decl = classStaticMembers
- ? ts.createClassDeclaration(
- /*decorators*/ undefined, modifiers, name,
- /*typeParameters*/ undefined,
- /*heritageClauses*/ undefined, classStaticMembers.concat((parameters.length ? [ts.createConstructor(/*decorators*/ undefined, /*modifiers*/ undefined, parameters, /*body*/ undefined)] : ts.emptyArray), ts.arrayFrom(protoOrInstanceMembers.values())))
- : ts.createFunctionDeclaration(/*decorators*/ undefined, modifiers, /*asteriskToken*/ undefined, name, /*typeParameters*/ undefined, parameters, returnType, /*body*/ undefined);
- return [decl].concat((namespaceStatements.length === 0 ? ts.emptyArray : [createNamespace(modifiers && modifiers.map(function (m) { return ts.getSynthesizedDeepClone(m); }), name, namespaceStatements)]));
- }
- function tryGetMethod(_a, modifiers) {
- var name = _a.name, source = _a.source;
- if (!isValidIdentifier(name))
- return undefined;
- var fnAst = parseClassOrFunctionBody(source);
- if (fnAst === undefined || (typeof fnAst !== "number" && fnAst.kind === 157 /* Constructor */))
- return undefined;
- var sig = getParametersAndReturnType(fnAst);
- return sig && ts.createMethod(
- /*decorators*/ undefined, modifiers,
- /*asteriskToken*/ undefined, name,
- /*questionToken*/ undefined,
- /*typeParameters*/ undefined, sig.parameters, sig.returnType,
- /*body*/ undefined);
- }
- function toType(info) {
- switch (info.kind) {
- case 0 /* Const */:
- return ts.createTypeReferenceNode(info.typeName, /*typeArguments*/ undefined);
- case 1 /* Array */:
- return ts.createArrayTypeNode(toType(info.inner));
- case 2 /* FunctionOrClass */:
- return ts.createTypeReferenceNode("Function", /*typeArguments*/ undefined); // Normally we create a FunctionDeclaration, but this can happen for a function in an array.
- case 3 /* Object */:
- return ts.createTypeLiteralNode(info.members.map(function (m) { return ts.createPropertySignature(/*modifiers*/ undefined, toPropertyName(m.name), /*questionToken*/ undefined, toType(m), /*initializer*/ undefined); }));
- default:
- return ts.Debug.assertNever(info);
- }
- }
- function toPropertyName(name) {
- return ts.isIdentifierText(name, 7 /* ESNext */) ? ts.createIdentifier(name) : ts.createStringLiteral(name);
- }
- // Parses assignments to "this.x" in the constructor into class property declarations
- function getConstructorFunctionInstanceProperties(fnAst, members) {
- forEachOwnNodeOfFunction(fnAst, function (node) {
- if (ts.isAssignmentExpression(node, /*excludeCompoundAssignment*/ true) &&
- ts.isPropertyAccessExpression(node.left) && node.left.expression.kind === 100 /* ThisKeyword */) {
- var name_4 = node.left.name.text;
- if (!ts.isJsPrivate(name_4)) {
- ts.getOrUpdate(members, name_4, function () { return ts.createProperty(/*decorators*/ undefined, /*modifiers*/ undefined, name_4, /*questionOrExclamationToken*/ undefined, anyType(), /*initializer*/ undefined); });
- }
- }
- });
- }
- function getParametersAndReturnType(fnAst) {
- if (typeof fnAst === "number") {
- return { parameters: ts.fill(fnAst, function (i) { return makeParameter("p" + i, anyType()); }), returnType: anyType() };
- }
- var usedArguments = false, hasReturn = false;
- forEachOwnNodeOfFunction(fnAst, function (node) {
- usedArguments = usedArguments || ts.isIdentifier(node) && node.text === "arguments";
- hasReturn = hasReturn || ts.isReturnStatement(node) && !!node.expression && node.expression.kind !== 200 /* VoidExpression */;
- });
- var parameters = fnAst.parameters.map(function (p) { return makeParameter("" + p.name.getText(), inferParameterType(fnAst, p)); }).concat((usedArguments ? [makeRestParameter()] : ts.emptyArray));
- return { parameters: parameters, returnType: hasReturn ? anyType() : ts.createKeywordTypeNode(106 /* VoidKeyword */) };
- }
- function makeParameter(name, type) {
- return ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, name, /*questionToken*/ undefined, type);
- }
- function makeRestParameter() {
- return ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, ts.createToken(25 /* DotDotDotToken */), "args", /*questionToken*/ undefined, ts.createArrayTypeNode(anyType()));
- }
- /** Returns 'undefined' for class with no declared constructor */
- function parseClassOrFunctionBody(source) {
- if (typeof source === "number")
- return source;
- var classOrFunction = ts.tryCast(parseExpression(source), function (node) { return ts.isFunctionExpression(node) || ts.isArrowFunction(node) || ts.isClassExpression(node); });
- return classOrFunction
- ? ts.isClassExpression(classOrFunction) ? ts.find(classOrFunction.members, ts.isConstructorDeclaration) : classOrFunction
- // If that didn't parse, it's a method `m() {}`. Parse again inside of an object literal.
- : ts.cast(ts.first(ts.cast(parseExpression("{ " + source + " }"), ts.isObjectLiteralExpression).properties), ts.isMethodDeclaration);
- }
- function parseExpression(expr) {
- var text = "const _ = " + expr;
- var srcFile = ts.createSourceFile("test.ts", text, 7 /* Latest */, /*setParentNodes*/ true);
- return ts.first(ts.cast(ts.first(srcFile.statements), ts.isVariableStatement).declarationList.declarations).initializer;
- }
- function inferParameterType(_fn, _param) {
- // TODO: Inspect function body for clues (see inferFromUsage.ts)
- return anyType();
- }
- // Descends through all nodes in a function, but not in nested functions.
- function forEachOwnNodeOfFunction(fnAst, cb) {
- fnAst.body.forEachChild(function recur(node) {
- cb(node);
- if (!ts.isFunctionLike(node))
- node.forEachChild(recur);
- });
- }
- function isValidIdentifier(name) {
- var keyword = ts.stringToToken(name);
- return !(keyword && ts.isNonContextualKeyword(keyword)) && ts.isIdentifierText(name, 7 /* ESNext */);
- }
- function addComment(node, comment) {
- if (comment !== undefined)
- ts.addSyntheticLeadingComment(node, 2 /* SingleLineCommentTrivia */, comment);
- return node;
- }
- function anyType() {
- return ts.createKeywordTypeNode(120 /* AnyKeyword */);
- }
- function createNamespace(modifiers, name, statements) {
- return ts.createModuleDeclaration(/*decorators*/ undefined, modifiers, ts.createIdentifier(name), ts.createModuleBlock(statements), 16 /* Namespace */);
- }
-})(ts || (ts = {}));
/* @internal */
var ts;
(function (ts) {
@@ -116840,8 +117821,8 @@
});
function getImportTypeNode(sourceFile, pos) {
var token = ts.getTokenAtPosition(sourceFile, pos);
- ts.Debug.assert(token.kind === 92 /* ImportKeyword */);
- ts.Debug.assert(token.parent.kind === 183 /* ImportType */);
+ ts.Debug.assert(token.kind === 93 /* ImportKeyword */);
+ ts.Debug.assert(token.parent.kind === 184 /* ImportType */);
return token.parent;
}
function doChange(changes, sourceFile, importType) {
@@ -116893,7 +117874,7 @@
var otherMembers = members.filter(function (member) { return !ts.isIndexSignatureDeclaration(member); });
var parameter = ts.first(indexSignature.parameters);
var mappedTypeParameter = ts.createTypeParameterDeclaration(ts.cast(parameter.name, ts.isIdentifier), parameter.type);
- var mappedIntersectionType = ts.createMappedTypeNode(ts.hasReadonlyModifier(indexSignature) ? ts.createModifier(133 /* ReadonlyKeyword */) : undefined, mappedTypeParameter, indexSignature.questionToken, indexSignature.type);
+ var mappedIntersectionType = ts.createMappedTypeNode(ts.hasReadonlyModifier(indexSignature) ? ts.createModifier(134 /* ReadonlyKeyword */) : undefined, mappedTypeParameter, indexSignature.questionToken, indexSignature.type);
var intersectionType = ts.createIntersectionTypeNode(ts.getAllSuperTypeNodes(container).concat([
mappedIntersectionType
], (otherMembers.length ? [ts.createTypeLiteralNode(otherMembers)] : ts.emptyArray)));
@@ -116940,16 +117921,16 @@
return undefined;
}
switch (exportNode.kind) {
- case 239 /* FunctionDeclaration */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 244 /* ModuleDeclaration */: {
+ case 240 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 245 /* ModuleDeclaration */: {
var node = exportNode;
return node.name && ts.isIdentifier(node.name) ? { exportNode: node, exportName: node.name, wasDefault: wasDefault, exportingModuleSymbol: exportingModuleSymbol } : undefined;
}
- case 219 /* VariableStatement */: {
+ case 220 /* VariableStatement */: {
var vs = exportNode;
// Must be `export const x = something;`.
if (!(vs.declarationList.flags & 2 /* Const */) || vs.declarationList.declarations.length !== 1) {
@@ -116972,17 +117953,17 @@
function changeExport(exportingSourceFile, _a, changes, checker) {
var wasDefault = _a.wasDefault, exportNode = _a.exportNode, exportName = _a.exportName;
if (wasDefault) {
- changes.delete(exportingSourceFile, ts.Debug.assertDefined(ts.findModifier(exportNode, 80 /* DefaultKeyword */)));
+ changes.delete(exportingSourceFile, ts.Debug.assertDefined(ts.findModifier(exportNode, 81 /* DefaultKeyword */)));
}
else {
- var exportKeyword = ts.Debug.assertDefined(ts.findModifier(exportNode, 85 /* ExportKeyword */));
+ var exportKeyword = ts.Debug.assertDefined(ts.findModifier(exportNode, 86 /* ExportKeyword */));
switch (exportNode.kind) {
- case 239 /* FunctionDeclaration */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- changes.insertNodeAfter(exportingSourceFile, exportKeyword, ts.createToken(80 /* DefaultKeyword */));
+ case 240 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ changes.insertNodeAfter(exportingSourceFile, exportKeyword, ts.createToken(81 /* DefaultKeyword */));
break;
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
// If 'x' isn't used in this file, `export const x = 0;` --> `export default 0;`
if (!ts.FindAllReferences.Core.isSymbolReferencedInFile(exportName, checker, exportingSourceFile)) {
// We checked in `getInfo` that an initializer exists.
@@ -116990,9 +117971,9 @@
break;
}
// falls through
- case 243 /* EnumDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 244 /* ModuleDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 245 /* ModuleDeclaration */:
// `export type T = number;` -> `type T = number; export default T;`
changes.deleteModifier(exportingSourceFile, exportKeyword);
changes.insertNodeAfter(exportingSourceFile, exportNode, ts.createExportDefault(ts.createIdentifier(exportName.text)));
@@ -117019,18 +118000,18 @@
function changeDefaultToNamedImport(importingSourceFile, ref, changes, exportName) {
var parent = ref.parent;
switch (parent.kind) {
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
// `a.default` --> `a.foo`
changes.replaceNode(importingSourceFile, ref, ts.createIdentifier(exportName));
break;
- case 253 /* ImportSpecifier */:
- case 257 /* ExportSpecifier */: {
+ case 254 /* ImportSpecifier */:
+ case 258 /* ExportSpecifier */: {
var spec = parent;
// `default as foo` --> `foo`, `default as bar` --> `foo as bar`
changes.replaceNode(importingSourceFile, spec, makeImportSpecifier(exportName, spec.name.text));
break;
}
- case 250 /* ImportClause */: {
+ case 251 /* ImportClause */: {
var clause = parent;
ts.Debug.assert(clause.name === ref);
var spec = makeImportSpecifier(exportName, ref.text);
@@ -117039,7 +118020,7 @@
// `import foo from "./a";` --> `import { foo } from "./a";`
changes.replaceNode(importingSourceFile, ref, ts.createNamedImports([spec]));
}
- else if (namedBindings.kind === 251 /* NamespaceImport */) {
+ else if (namedBindings.kind === 252 /* NamespaceImport */) {
// `import foo, * as a from "./a";` --> `import * as a from ".a/"; import { foo } from "./a";`
changes.deleteRange(importingSourceFile, { pos: ref.getStart(importingSourceFile), end: namedBindings.getStart(importingSourceFile) });
var quotePreference = ts.isStringLiteral(clause.parent.moduleSpecifier) ? ts.quotePreferenceFromString(clause.parent.moduleSpecifier, importingSourceFile) : 1 /* Double */;
@@ -117060,11 +118041,11 @@
function changeNamedToDefaultImport(importingSourceFile, ref, changes) {
var parent = ref.parent;
switch (parent.kind) {
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
// `a.foo` --> `a.default`
changes.replaceNode(importingSourceFile, ref, ts.createIdentifier("default"));
break;
- case 253 /* ImportSpecifier */: {
+ case 254 /* ImportSpecifier */: {
// `import { foo } from "./a";` --> `import foo from "./a";`
// `import { foo as bar } from "./a";` --> `import bar from "./a";`
var defaultImport = ts.createIdentifier(parent.name.text);
@@ -117077,7 +118058,7 @@
}
break;
}
- case 257 /* ExportSpecifier */: {
+ case 258 /* ExportSpecifier */: {
// `export { foo } from "./a";` --> `export { default as foo } from "./a";`
// `export { foo as bar } from "./a";` --> `export { default as bar } from "./a";`
// `export { foo as default } from "./a";` --> `export { default } from "./a";`
@@ -117110,8 +118091,8 @@
var i = getImportToConvert(context);
if (!i)
return ts.emptyArray;
- var description = i.kind === 251 /* NamespaceImport */ ? ts.Diagnostics.Convert_namespace_import_to_named_imports.message : ts.Diagnostics.Convert_named_imports_to_namespace_import.message;
- var actionName = i.kind === 251 /* NamespaceImport */ ? actionNameNamespaceToNamed : actionNameNamedToNamespace;
+ var description = i.kind === 252 /* NamespaceImport */ ? ts.Diagnostics.Convert_namespace_import_to_named_imports.message : ts.Diagnostics.Convert_named_imports_to_namespace_import.message;
+ var actionName = i.kind === 252 /* NamespaceImport */ ? actionNameNamespaceToNamed : actionNameNamedToNamespace;
return [{ name: refactorName, description: description, actions: [{ name: actionName, description: description }] }];
},
getEditsForAction: function (context, actionName) {
@@ -117133,7 +118114,7 @@
}
function doChange(sourceFile, program, changes, toConvert) {
var checker = program.getTypeChecker();
- if (toConvert.kind === 251 /* NamespaceImport */) {
+ if (toConvert.kind === 252 /* NamespaceImport */) {
doChangeNamespaceToNamed(sourceFile, checker, changes, toConvert, ts.getAllowSyntheticDefaultImports(program.getCompilerOptions()));
}
else {
@@ -117185,7 +118166,7 @@
function doChangeNamedToNamespace(sourceFile, checker, changes, toConvert) {
var importDecl = toConvert.parent.parent;
var moduleSpecifier = importDecl.moduleSpecifier;
- var preferredName = moduleSpecifier && ts.isStringLiteral(moduleSpecifier) ? ts.codefix.moduleSpecifierToValidIdentifier(moduleSpecifier.text, 7 /* ESNext */) : "module";
+ var preferredName = moduleSpecifier && ts.isStringLiteral(moduleSpecifier) ? ts.codefix.moduleSpecifierToValidIdentifier(moduleSpecifier.text, 8 /* ESNext */) : "module";
var namespaceNameConflicts = toConvert.elements.some(function (element) {
return ts.FindAllReferences.Core.eachSymbolReferenceInFile(element.name, checker, sourceFile, function (id) {
return !!checker.resolveName(preferredName, id, 67108863 /* All */, /*excludeGlobals*/ true);
@@ -117476,20 +118457,20 @@
function checkForStaticContext(nodeToCheck, containingClass) {
var current = nodeToCheck;
while (current !== containingClass) {
- if (current.kind === 154 /* PropertyDeclaration */) {
+ if (current.kind === 155 /* PropertyDeclaration */) {
if (ts.hasModifier(current, 32 /* Static */)) {
rangeFacts |= RangeFacts.InStaticRegion;
}
break;
}
- else if (current.kind === 151 /* Parameter */) {
+ else if (current.kind === 152 /* Parameter */) {
var ctorOrMethod = ts.getContainingFunction(current);
- if (ctorOrMethod.kind === 157 /* Constructor */) {
+ if (ctorOrMethod.kind === 158 /* Constructor */) {
rangeFacts |= RangeFacts.InStaticRegion;
}
break;
}
- else if (current.kind === 156 /* MethodDeclaration */) {
+ else if (current.kind === 157 /* MethodDeclaration */) {
if (ts.hasModifier(current, 32 /* Static */)) {
rangeFacts |= RangeFacts.InStaticRegion;
}
@@ -117532,7 +118513,7 @@
return true;
}
if (ts.isDeclaration(node)) {
- var declaringNode = (node.kind === 237 /* VariableDeclaration */) ? node.parent.parent : node;
+ var declaringNode = (node.kind === 238 /* VariableDeclaration */) ? node.parent.parent : node;
if (ts.hasModifier(declaringNode, 1 /* Export */)) {
// TODO: GH#18217 Silly to use `errors ||` since it's definitely not defined (see top of `visit`)
// Also, if we're only pushing one error, just use `let error: Diagnostic | undefined`!
@@ -117544,13 +118525,13 @@
}
// Some things can't be extracted in certain situations
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
(errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractImport));
return true;
- case 98 /* SuperKeyword */:
+ case 99 /* SuperKeyword */:
// For a super *constructor call*, we have to be extracting the entire class,
// but a super *method call* simply implies a 'this' reference
- if (node.parent.kind === 191 /* CallExpression */) {
+ if (node.parent.kind === 192 /* CallExpression */) {
// Super constructor call
var containingClass_1 = ts.getContainingClass(node); // TODO:GH#18217
if (containingClass_1.pos < span.start || containingClass_1.end >= (span.start + span.length)) {
@@ -117565,8 +118546,8 @@
}
if (ts.isFunctionLikeDeclaration(node) || ts.isClassLike(node)) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 240 /* ClassDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
if (ts.isSourceFile(node.parent) && node.parent.externalModuleIndicator === undefined) {
// You cannot extract global declarations
(errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.functionWillNotBeVisibleInTheNewScope));
@@ -117578,20 +118559,20 @@
}
var savedPermittedJumps = permittedJumps;
switch (node.kind) {
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
permittedJumps = 0 /* None */;
break;
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
// forbid all jumps inside try blocks
permittedJumps = 0 /* None */;
break;
- case 218 /* Block */:
- if (node.parent && node.parent.kind === 235 /* TryStatement */ && node.parent.finallyBlock === node) {
+ case 219 /* Block */:
+ if (node.parent && node.parent.kind === 236 /* TryStatement */ && node.parent.finallyBlock === node) {
// allow unconditional returns from finally blocks
permittedJumps = 4 /* Return */;
}
break;
- case 271 /* CaseClause */:
+ case 272 /* CaseClause */:
// allow unlabeled break inside case clauses
permittedJumps |= 1 /* Break */;
break;
@@ -117603,19 +118584,19 @@
break;
}
switch (node.kind) {
- case 178 /* ThisType */:
- case 100 /* ThisKeyword */:
+ case 179 /* ThisType */:
+ case 101 /* ThisKeyword */:
rangeFacts |= RangeFacts.UsesThis;
break;
- case 233 /* LabeledStatement */: {
+ case 234 /* LabeledStatement */: {
var label = node.label;
(seenLabels || (seenLabels = [])).push(label.escapedText);
ts.forEachChild(node, visit);
seenLabels.pop();
break;
}
- case 229 /* BreakStatement */:
- case 228 /* ContinueStatement */: {
+ case 230 /* BreakStatement */:
+ case 229 /* ContinueStatement */: {
var label = node.label;
if (label) {
if (!ts.contains(seenLabels, label.escapedText)) {
@@ -117624,20 +118605,20 @@
}
}
else {
- if (!(permittedJumps & (node.kind === 229 /* BreakStatement */ ? 1 /* Break */ : 2 /* Continue */))) {
+ if (!(permittedJumps & (node.kind === 230 /* BreakStatement */ ? 1 /* Break */ : 2 /* Continue */))) {
// attempt to break or continue in a forbidden context
(errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractRangeContainingConditionalBreakOrContinueStatements));
}
}
break;
}
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
rangeFacts |= RangeFacts.IsAsyncFunction;
break;
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
rangeFacts |= RangeFacts.IsGenerator;
break;
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
if (permittedJumps & 4 /* Return */) {
rangeFacts |= RangeFacts.HasReturn;
}
@@ -117691,7 +118672,7 @@
while (true) {
current = current.parent;
// A function parameter's initializer is actually in the outer scope, not the function declaration
- if (current.kind === 151 /* Parameter */) {
+ if (current.kind === 152 /* Parameter */) {
// Skip all the way to the outer scope of the function that declared this parameter
current = ts.findAncestor(current, function (parent) { return ts.isFunctionLikeDeclaration(parent); }).parent;
}
@@ -117702,7 +118683,7 @@
// * Module/namespace or source file
if (isScope(current)) {
scopes.push(current);
- if (current.kind === 284 /* SourceFile */) {
+ if (current.kind === 285 /* SourceFile */) {
return scopes;
}
}
@@ -117792,32 +118773,32 @@
}
function getDescriptionForFunctionLikeDeclaration(scope) {
switch (scope.kind) {
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return "constructor";
- case 196 /* FunctionExpression */:
- case 239 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
return scope.name
? "function '" + scope.name.text + "'"
: "anonymous function";
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return "arrow function";
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return "method '" + scope.name.getText() + "'";
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
return "'get " + scope.name.getText() + "'";
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
return "'set " + scope.name.getText() + "'";
default:
throw ts.Debug.assertNever(scope);
}
}
function getDescriptionForClassLikeDeclaration(scope) {
- return scope.kind === 240 /* ClassDeclaration */
+ return scope.kind === 241 /* ClassDeclaration */
? scope.name ? "class '" + scope.name.text + "'" : "anonymous class declaration"
: scope.name ? "class expression '" + scope.name.text + "'" : "anonymous class expression";
}
function getDescriptionForModuleLikeDeclaration(scope) {
- return scope.kind === 245 /* ModuleBlock */
+ return scope.kind === 246 /* ModuleBlock */
? "namespace '" + scope.parent.name.getText() + "'"
: scope.externalModuleIndicator ? 0 /* Module */ : 1 /* Global */;
}
@@ -117883,12 +118864,12 @@
var newFunction;
if (ts.isClassLike(scope)) {
// always create private method in TypeScript files
- var modifiers = isJS ? [] : [ts.createToken(113 /* PrivateKeyword */)];
+ var modifiers = isJS ? [] : [ts.createToken(114 /* PrivateKeyword */)];
if (range.facts & RangeFacts.InStaticRegion) {
- modifiers.push(ts.createToken(116 /* StaticKeyword */));
+ modifiers.push(ts.createToken(117 /* StaticKeyword */));
}
if (range.facts & RangeFacts.IsAsyncFunction) {
- modifiers.push(ts.createToken(121 /* AsyncKeyword */));
+ modifiers.push(ts.createToken(122 /* AsyncKeyword */));
}
newFunction = ts.createMethod(
/*decorators*/ undefined, modifiers.length ? modifiers : undefined, range.facts & RangeFacts.IsGenerator ? ts.createToken(40 /* AsteriskToken */) : undefined, functionName,
@@ -117896,7 +118877,7 @@
}
else {
newFunction = ts.createFunctionDeclaration(
- /*decorators*/ undefined, range.facts & RangeFacts.IsAsyncFunction ? [ts.createToken(121 /* AsyncKeyword */)] : undefined, range.facts & RangeFacts.IsGenerator ? ts.createToken(40 /* AsteriskToken */) : undefined, functionName, typeParameters, parameters, returnType, body);
+ /*decorators*/ undefined, range.facts & RangeFacts.IsAsyncFunction ? [ts.createToken(122 /* AsyncKeyword */)] : undefined, range.facts & RangeFacts.IsGenerator ? ts.createToken(40 /* AsteriskToken */) : undefined, functionName, typeParameters, parameters, returnType, body);
}
var changeTracker = ts.textChanges.ChangeTracker.fromContext(context);
var minInsertionPos = (isReadonlyArray(range.range) ? ts.last(range.range) : range.range).end;
@@ -118037,9 +119018,9 @@
while (ts.isParenthesizedTypeNode(withoutParens)) {
withoutParens = withoutParens.type;
}
- return ts.isUnionTypeNode(withoutParens) && ts.find(withoutParens.types, function (t) { return t.kind === 141 /* UndefinedKeyword */; })
+ return ts.isUnionTypeNode(withoutParens) && ts.find(withoutParens.types, function (t) { return t.kind === 142 /* UndefinedKeyword */; })
? clone
- : ts.createUnionTypeNode([clone, ts.createKeywordTypeNode(141 /* UndefinedKeyword */)]);
+ : ts.createUnionTypeNode([clone, ts.createKeywordTypeNode(142 /* UndefinedKeyword */)]);
}
}
/**
@@ -118062,11 +119043,11 @@
if (ts.isClassLike(scope)) {
ts.Debug.assert(!isJS); // See CannotExtractToJSClass
var modifiers = [];
- modifiers.push(ts.createToken(113 /* PrivateKeyword */));
+ modifiers.push(ts.createToken(114 /* PrivateKeyword */));
if (rangeFacts & RangeFacts.InStaticRegion) {
- modifiers.push(ts.createToken(116 /* StaticKeyword */));
+ modifiers.push(ts.createToken(117 /* StaticKeyword */));
}
- modifiers.push(ts.createToken(133 /* ReadonlyKeyword */));
+ modifiers.push(ts.createToken(134 /* ReadonlyKeyword */));
var newVariable = ts.createProperty(
/*decorators*/ undefined, modifiers, localNameText,
/*questionToken*/ undefined, variableType, initializer);
@@ -118095,7 +119076,7 @@
var localReference = ts.createIdentifier(localNameText);
changeTracker.replaceNode(context.file, node, localReference);
}
- else if (node.parent.kind === 221 /* ExpressionStatement */ && scope === ts.findAncestor(node, isScope)) {
+ else if (node.parent.kind === 222 /* ExpressionStatement */ && scope === ts.findAncestor(node, isScope)) {
// If the parent is an expression statement and the target scope is the immediately enclosing one,
// replace the statement with the declaration.
var newVariableStatement = ts.createVariableStatement(
@@ -118114,7 +119095,7 @@
changeTracker.insertNodeBefore(context.file, nodeToInsertBefore, newVariableStatement, /*blankLineBetween*/ false);
}
// Consume
- if (node.parent.kind === 221 /* ExpressionStatement */) {
+ if (node.parent.kind === 222 /* ExpressionStatement */) {
// If the parent is an expression statement, delete it.
changeTracker.delete(context.file, node.parent);
}
@@ -118201,7 +119182,7 @@
return { body: ts.createBlock(statements, /*multiLine*/ true), returnValueProperty: undefined };
}
function visitor(node) {
- if (!ignoreReturns && node.kind === 230 /* ReturnStatement */ && hasWritesOrVariableDeclarations) {
+ if (!ignoreReturns && node.kind === 231 /* ReturnStatement */ && hasWritesOrVariableDeclarations) {
var assignments = getPropertyAssignmentsForWritesAndVariableDeclarations(exposedVariableDeclarations, writes);
if (node.expression) {
if (!returnValueProperty) {
@@ -118379,7 +119360,7 @@
var scope = scopes_1[_i];
usagesPerScope.push({ usages: ts.createMap(), typeParameterUsages: ts.createMap(), substitutions: ts.createMap() });
substitutionsPerScope.push(ts.createMap());
- functionErrorsPerScope.push(ts.isFunctionLikeDeclaration(scope) && scope.kind !== 239 /* FunctionDeclaration */
+ functionErrorsPerScope.push(ts.isFunctionLikeDeclaration(scope) && scope.kind !== 240 /* FunctionDeclaration */
? [ts.createDiagnosticForNode(scope, Messages.cannotExtractToOtherFunctionLike)]
: []);
var constantErrors = [];
@@ -118695,30 +119676,30 @@
function isExtractableExpression(node) {
var parent = node.parent;
switch (parent.kind) {
- case 278 /* EnumMember */:
+ case 279 /* EnumMember */:
return false;
}
switch (node.kind) {
case 10 /* StringLiteral */:
- return parent.kind !== 249 /* ImportDeclaration */ &&
- parent.kind !== 253 /* ImportSpecifier */;
- case 208 /* SpreadElement */:
- case 184 /* ObjectBindingPattern */:
- case 186 /* BindingElement */:
- return false;
- case 72 /* Identifier */:
- return parent.kind !== 186 /* BindingElement */ &&
- parent.kind !== 253 /* ImportSpecifier */ &&
- parent.kind !== 257 /* ExportSpecifier */;
+ return parent.kind !== 250 /* ImportDeclaration */ &&
+ parent.kind !== 254 /* ImportSpecifier */;
+ case 209 /* SpreadElement */:
+ case 185 /* ObjectBindingPattern */:
+ case 187 /* BindingElement */:
+ return false;
+ case 73 /* Identifier */:
+ return parent.kind !== 187 /* BindingElement */ &&
+ parent.kind !== 254 /* ImportSpecifier */ &&
+ parent.kind !== 258 /* ExportSpecifier */;
}
return true;
}
function isBlockLike(node) {
switch (node.kind) {
- case 218 /* Block */:
- case 284 /* SourceFile */:
- case 245 /* ModuleBlock */:
- case 271 /* CaseClause */:
+ case 219 /* Block */:
+ case 285 /* SourceFile */:
+ case 246 /* ModuleBlock */:
+ case 272 /* CaseClause */:
return true;
default:
return false;
@@ -118732,6 +119713,136 @@
(function (ts) {
var refactor;
(function (refactor) {
+ var refactorName = "Extract type";
+ var extractToTypeAlias = "Extract to type alias";
+ var extractToTypeDef = "Extract to typedef";
+ refactor.registerRefactor(refactorName, {
+ getAvailableActions: function (context) {
+ var info = getRangeToExtract(context);
+ if (!info)
+ return ts.emptyArray;
+ return [{
+ name: refactorName,
+ description: ts.getLocaleSpecificMessage(ts.Diagnostics.Extract_type),
+ actions: [info.isJS ? {
+ name: extractToTypeDef, description: ts.getLocaleSpecificMessage(ts.Diagnostics.Extract_to_typedef)
+ } : {
+ name: extractToTypeAlias, description: ts.getLocaleSpecificMessage(ts.Diagnostics.Extract_to_type_alias)
+ }]
+ }];
+ },
+ getEditsForAction: function (context, actionName) {
+ ts.Debug.assert(actionName === extractToTypeAlias || actionName === extractToTypeDef);
+ var file = context.file;
+ var info = ts.Debug.assertDefined(getRangeToExtract(context));
+ ts.Debug.assert(actionName === extractToTypeAlias && !info.isJS || actionName === extractToTypeDef && info.isJS);
+ var name = ts.getUniqueName("NewType", file);
+ var edits = ts.textChanges.ChangeTracker.with(context, function (changes) { return info.isJS ?
+ doTypedefChange(changes, file, name, info.firstStatement, info.selection, info.typeParameters) :
+ doTypeAliasChange(changes, file, name, info.firstStatement, info.selection, info.typeParameters); });
+ var renameFilename = file.fileName;
+ var renameLocation = ts.getRenameLocation(edits, renameFilename, name, /*preferLastLocation*/ false);
+ return { edits: edits, renameFilename: renameFilename, renameLocation: renameLocation };
+ }
+ });
+ function getRangeToExtract(context) {
+ var file = context.file, startPosition = context.startPosition;
+ var isJS = ts.isSourceFileJS(file);
+ var current = ts.getTokenAtPosition(file, startPosition);
+ var range = ts.createTextRangeFromSpan(ts.getRefactorContextSpan(context));
+ var selection = ts.findAncestor(current, (function (node) { return node.parent && rangeContainsSkipTrivia(range, node, file) && !rangeContainsSkipTrivia(range, node.parent, file); }));
+ if (!selection || !ts.isTypeNode(selection))
+ return undefined;
+ var checker = context.program.getTypeChecker();
+ var firstStatement = ts.Debug.assertDefined(isJS ? ts.findAncestor(selection, isStatementAndHasJSDoc) : ts.findAncestor(selection, ts.isStatement));
+ var typeParameters = collectTypeParameters(checker, selection, firstStatement, file);
+ if (!typeParameters)
+ return undefined;
+ return { isJS: isJS, selection: selection, firstStatement: firstStatement, typeParameters: typeParameters };
+ }
+ function isStatementAndHasJSDoc(n) {
+ return ts.isStatement(n) && ts.hasJSDocNodes(n);
+ }
+ function rangeContainsSkipTrivia(r1, node, file) {
+ return ts.rangeContainsStartEnd(r1, ts.skipTrivia(file.text, node.pos), node.end);
+ }
+ function collectTypeParameters(checker, selection, statement, file) {
+ var result = [];
+ return visitor(selection) ? undefined : result;
+ function visitor(node) {
+ if (ts.isTypeReferenceNode(node)) {
+ if (ts.isIdentifier(node.typeName)) {
+ var symbol = checker.resolveName(node.typeName.text, node.typeName, 262144 /* TypeParameter */, /* excludeGlobals */ true);
+ if (symbol) {
+ var declaration = ts.cast(ts.first(symbol.declarations), ts.isTypeParameterDeclaration);
+ if (rangeContainsSkipTrivia(statement, declaration, file) && !rangeContainsSkipTrivia(selection, declaration, file)) {
+ result.push(declaration);
+ }
+ }
+ }
+ }
+ else if (ts.isInferTypeNode(node)) {
+ var conditionalTypeNode = ts.findAncestor(node, function (n) { return ts.isConditionalTypeNode(n) && rangeContainsSkipTrivia(n.extendsType, node, file); });
+ if (!conditionalTypeNode || !rangeContainsSkipTrivia(selection, conditionalTypeNode, file)) {
+ return true;
+ }
+ }
+ else if ((ts.isTypePredicateNode(node) || ts.isThisTypeNode(node))) {
+ var functionLikeNode = ts.findAncestor(node.parent, ts.isFunctionLike);
+ if (functionLikeNode && functionLikeNode.type && rangeContainsSkipTrivia(functionLikeNode.type, node, file) && !rangeContainsSkipTrivia(selection, functionLikeNode, file)) {
+ return true;
+ }
+ }
+ else if (ts.isTypeQueryNode(node)) {
+ if (ts.isIdentifier(node.exprName)) {
+ var symbol = checker.resolveName(node.exprName.text, node.exprName, 67220415 /* Value */, /* excludeGlobals */ false);
+ if (symbol && rangeContainsSkipTrivia(statement, symbol.valueDeclaration, file) && !rangeContainsSkipTrivia(selection, symbol.valueDeclaration, file)) {
+ return true;
+ }
+ }
+ else {
+ if (ts.isThisIdentifier(node.exprName.left) && !rangeContainsSkipTrivia(selection, node.parent, file)) {
+ return true;
+ }
+ }
+ }
+ return ts.forEachChild(node, visitor);
+ }
+ }
+ function doTypeAliasChange(changes, file, name, firstStatement, selection, typeParameters) {
+ var newTypeNode = ts.createTypeAliasDeclaration(
+ /* decorators */ undefined,
+ /* modifiers */ undefined, name, typeParameters.map(function (id) { return ts.updateTypeParameterDeclaration(id, id.name, id.constraint, /* defaultType */ undefined); }), selection);
+ changes.insertNodeBefore(file, firstStatement, newTypeNode, /* blankLineBetween */ true);
+ changes.replaceNode(file, selection, ts.createTypeReferenceNode(name, typeParameters.map(function (id) { return ts.createTypeReferenceNode(id.name, /* typeArguments */ undefined); })));
+ }
+ function doTypedefChange(changes, file, name, firstStatement, selection, typeParameters) {
+ var node = ts.createNode(310 /* JSDocTypedefTag */);
+ node.tagName = ts.createIdentifier("typedef"); // TODO: jsdoc factory https://github.com/Microsoft/TypeScript/pull/29539
+ node.fullName = ts.createIdentifier(name);
+ node.name = node.fullName;
+ node.typeExpression = ts.createJSDocTypeExpression(selection);
+ var templates = [];
+ ts.forEach(typeParameters, function (typeParameter) {
+ var constraint = ts.getEffectiveConstraintOfTypeParameter(typeParameter);
+ var template = ts.createNode(309 /* JSDocTemplateTag */);
+ template.tagName = ts.createIdentifier("template");
+ template.constraint = constraint && ts.cast(constraint, ts.isJSDocTypeExpression);
+ var parameter = ts.createNode(151 /* TypeParameter */);
+ parameter.name = typeParameter.name;
+ template.typeParameters = ts.createNodeArray([parameter]);
+ templates.push(template);
+ });
+ changes.insertNodeBefore(file, firstStatement, ts.createJSDocComment(/* comment */ undefined, ts.createNodeArray(ts.concatenate(templates, [node]))), /* blankLineBetween */ true);
+ changes.replaceNode(file, selection, ts.createTypeReferenceNode(name, typeParameters.map(function (id) { return ts.createTypeReferenceNode(id.name, /* typeArguments */ undefined); })));
+ }
+ })(refactor = ts.refactor || (ts.refactor = {}));
+})(ts || (ts = {}));
+/* @internal */
+var ts;
+(function (ts) {
+ var refactor;
+ (function (refactor) {
var generateGetAccessorAndSetAccessor;
(function (generateGetAccessorAndSetAccessor) {
var actionName = "Generate 'get' and 'set' accessors";
@@ -118767,10 +119878,10 @@
var modifierFlags = ts.getModifierFlags(declaration) & ~64 /* Readonly */;
var accessorModifiers = isInClassLike
? !modifierFlags || modifierFlags & 8 /* Private */
- ? getModifiers(isJS, isStatic, 115 /* PublicKeyword */)
+ ? getModifiers(isJS, isStatic, 116 /* PublicKeyword */)
: ts.createNodeArray(ts.createModifiersFromModifierFlags(modifierFlags))
: undefined;
- var fieldModifiers = isInClassLike ? getModifiers(isJS, isStatic, 113 /* PrivateKeyword */) : undefined;
+ var fieldModifiers = isInClassLike ? getModifiers(isJS, isStatic, 114 /* PrivateKeyword */) : undefined;
updateFieldDeclaration(changeTracker, file, declaration, fieldName, fieldModifiers);
var getAccessor = generateGetAccessor(fieldName, accessorName, type, accessorModifiers, isStatic, container);
ts.suppressLeadingAndTrailingTrivia(getAccessor);
@@ -118808,7 +119919,7 @@
return ts.isIdentifier(fieldName) ? ts.createPropertyAccess(leftHead, fieldName) : ts.createElementAccess(leftHead, ts.createLiteral(fieldName));
}
function getModifiers(isJS, isStatic, accessModifier) {
- var modifiers = ts.append(!isJS ? [ts.createToken(accessModifier)] : undefined, isStatic ? ts.createToken(116 /* StaticKeyword */) : undefined);
+ var modifiers = ts.append(!isJS ? [ts.createToken(accessModifier)] : undefined, isStatic ? ts.createToken(117 /* StaticKeyword */) : undefined);
return modifiers && ts.createNodeArray(modifiers);
}
function startsWithUnderscore(name) {
@@ -118831,7 +119942,7 @@
isStatic: ts.hasStaticModifier(declaration),
isReadonly: ts.hasReadonlyModifier(declaration),
type: ts.getTypeAnnotationNode(declaration),
- container: declaration.kind === 151 /* Parameter */ ? declaration.parent.parent : declaration.parent,
+ container: declaration.kind === 152 /* Parameter */ ? declaration.parent.parent : declaration.parent,
originalName: declaration.name.text,
declaration: declaration,
fieldName: fieldName,
@@ -118888,13 +119999,13 @@
return;
constructor.body.forEachChild(function recur(node) {
if (ts.isElementAccessExpression(node) &&
- node.expression.kind === 100 /* ThisKeyword */ &&
+ node.expression.kind === 101 /* ThisKeyword */ &&
ts.isStringLiteral(node.argumentExpression) &&
node.argumentExpression.text === originalName &&
ts.isWriteAccess(node)) {
changeTracker.replaceNode(file, node.argumentExpression, ts.createStringLiteral(fieldName));
}
- if (ts.isPropertyAccessExpression(node) && node.expression.kind === 100 /* ThisKeyword */ && node.name.text === originalName && ts.isWriteAccess(node)) {
+ if (ts.isPropertyAccessExpression(node) && node.expression.kind === 101 /* ThisKeyword */ && node.name.text === originalName && ts.isWriteAccess(node)) {
changeTracker.replaceNode(file, node.name, ts.createIdentifier(fieldName));
}
if (!ts.isFunctionLike(node) && !ts.isClassLike(node)) {
@@ -118976,11 +120087,11 @@
}
function isPureImport(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return true;
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return !ts.hasModifier(node, 1 /* Export */);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return node.declarationList.declarations.every(function (d) { return !!d.initializer && ts.isRequireCall(d.initializer, /*checkArgumentIsStringLiteralLike*/ true); });
default:
return false;
@@ -119068,19 +120179,19 @@
}
function getNamespaceLikeImport(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
- return node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 251 /* NamespaceImport */ ?
+ case 250 /* ImportDeclaration */:
+ return node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 252 /* NamespaceImport */ ?
node.importClause.namedBindings.name : undefined;
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return node.name;
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return ts.tryCast(node.name, ts.isIdentifier);
default:
return ts.Debug.assertNever(node);
}
}
function updateNamespaceLikeImport(changes, sourceFile, checker, movedSymbols, newModuleName, newModuleSpecifier, oldImportId, oldImportNode) {
- var preferredNewNamespaceName = ts.codefix.moduleSpecifierToValidIdentifier(newModuleName, 7 /* ESNext */);
+ var preferredNewNamespaceName = ts.codefix.moduleSpecifierToValidIdentifier(newModuleName, 8 /* ESNext */);
var needUniqueName = false;
var toChange = [];
ts.FindAllReferences.Core.eachSymbolReferenceInFile(oldImportId, checker, sourceFile, function (ref) {
@@ -119104,20 +120215,20 @@
var newNamespaceId = ts.createIdentifier(newNamespaceName);
var newModuleString = ts.createLiteral(newModuleSpecifier);
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return ts.createImportDeclaration(
/*decorators*/ undefined, /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(newNamespaceId)), newModuleString);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return ts.createImportEqualsDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, newNamespaceId, ts.createExternalModuleReference(newModuleString));
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return ts.createVariableDeclaration(newNamespaceId, /*type*/ undefined, createRequireCall(newModuleString));
default:
return ts.Debug.assertNever(node);
}
}
function moduleSpecifierFromImport(i) {
- return (i.kind === 249 /* ImportDeclaration */ ? i.moduleSpecifier
- : i.kind === 248 /* ImportEqualsDeclaration */ ? i.moduleReference.expression
+ return (i.kind === 250 /* ImportDeclaration */ ? i.moduleSpecifier
+ : i.kind === 249 /* ImportEqualsDeclaration */ ? i.moduleReference.expression
: i.initializer.arguments[0]);
}
function forEachImportInStatement(statement, cb) {
@@ -119187,15 +120298,15 @@
}
function deleteUnusedImports(sourceFile, importDecl, changes, isUnused) {
switch (importDecl.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
deleteUnusedImportsInDeclaration(sourceFile, importDecl, changes, isUnused);
break;
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
if (isUnused(importDecl.name)) {
changes.delete(sourceFile, importDecl);
}
break;
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
deleteUnusedImportsInVariableDeclaration(sourceFile, importDecl, changes, isUnused);
break;
default:
@@ -119208,7 +120319,7 @@
var _a = importDecl.importClause, name = _a.name, namedBindings = _a.namedBindings;
var defaultUnused = !name || isUnused(name);
var namedBindingsUnused = !namedBindings ||
- (namedBindings.kind === 251 /* NamespaceImport */ ? isUnused(namedBindings.name) : namedBindings.elements.length !== 0 && namedBindings.elements.every(function (e) { return isUnused(e.name); }));
+ (namedBindings.kind === 252 /* NamespaceImport */ ? isUnused(namedBindings.name) : namedBindings.elements.length !== 0 && namedBindings.elements.every(function (e) { return isUnused(e.name); }));
if (defaultUnused && namedBindingsUnused) {
changes.delete(sourceFile, importDecl);
}
@@ -119220,7 +120331,7 @@
if (namedBindingsUnused) {
changes.delete(sourceFile, namedBindings);
}
- else if (namedBindings.kind === 252 /* NamedImports */) {
+ else if (namedBindings.kind === 253 /* NamedImports */) {
for (var _i = 0, _b = namedBindings.elements; _i < _b.length; _i++) {
var element = _b[_i];
if (isUnused(element.name))
@@ -119233,14 +120344,14 @@
function deleteUnusedImportsInVariableDeclaration(sourceFile, varDecl, changes, isUnused) {
var name = varDecl.name;
switch (name.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
if (isUnused(name)) {
changes.delete(sourceFile, name);
}
break;
- case 185 /* ArrayBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
break;
- case 184 /* ObjectBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
if (name.elements.every(function (e) { return ts.isIdentifier(e.name) && isUnused(e.name); })) {
changes.delete(sourceFile, ts.isVariableDeclarationList(varDecl.parent) && varDecl.parent.declarations.length === 1 ? varDecl.parent.parent : varDecl);
}
@@ -119367,13 +120478,13 @@
// Below should all be utilities
function isInImport(decl) {
switch (decl.kind) {
- case 248 /* ImportEqualsDeclaration */:
- case 253 /* ImportSpecifier */:
- case 250 /* ImportClause */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 254 /* ImportSpecifier */:
+ case 251 /* ImportClause */:
return true;
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return isVariableDeclarationInImport(decl);
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return ts.isVariableDeclaration(decl.parent.parent) && isVariableDeclarationInImport(decl.parent.parent);
default:
return false;
@@ -119385,7 +120496,7 @@
}
function filterImport(i, moduleSpecifier, keep) {
switch (i.kind) {
- case 249 /* ImportDeclaration */: {
+ case 250 /* ImportDeclaration */: {
var clause = i.importClause;
if (!clause)
return undefined;
@@ -119395,9 +120506,9 @@
? ts.createImportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, ts.createImportClause(defaultImport, namedBindings), moduleSpecifier)
: undefined;
}
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return keep(i.name) ? i : undefined;
- case 237 /* VariableDeclaration */: {
+ case 238 /* VariableDeclaration */: {
var name = filterBindingName(i.name, keep);
return name ? makeVariableStatement(name, i.type, createRequireCall(moduleSpecifier), i.parent.flags) : undefined;
}
@@ -119406,7 +120517,7 @@
}
}
function filterNamedBindings(namedBindings, keep) {
- if (namedBindings.kind === 251 /* NamespaceImport */) {
+ if (namedBindings.kind === 252 /* NamespaceImport */) {
return keep(namedBindings.name) ? namedBindings : undefined;
}
else {
@@ -119416,11 +120527,11 @@
}
function filterBindingName(name, keep) {
switch (name.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return keep(name) ? name : undefined;
- case 185 /* ArrayBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
return name;
- case 184 /* ObjectBindingPattern */: {
+ case 185 /* ObjectBindingPattern */: {
// We can't handle nested destructurings or property names well here, so just copy them all.
var newElements = name.elements.filter(function (prop) { return prop.propertyName || !ts.isIdentifier(prop.name) || keep(prop.name); });
return newElements.length ? ts.createObjectBindingPattern(newElements) : undefined;
@@ -119477,13 +120588,13 @@
}
function isNonVariableTopLevelDeclaration(node) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 240 /* ClassDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 243 /* EnumDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return true;
default:
return false;
@@ -119491,17 +120602,17 @@
}
function forEachTopLevelDeclaration(statement, cb) {
switch (statement.kind) {
- case 239 /* FunctionDeclaration */:
- case 240 /* ClassDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 243 /* EnumDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return cb(statement);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return ts.firstDefined(statement.declarationList.declarations, function (decl) { return forEachTopLevelDeclarationInBindingName(decl.name, cb); });
- case 221 /* ExpressionStatement */: {
+ case 222 /* ExpressionStatement */: {
var expression = statement.expression;
return ts.isBinaryExpression(expression) && ts.getAssignmentDeclarationKind(expression) === 1 /* ExportsProperty */
? cb(statement)
@@ -119511,10 +120622,10 @@
}
function forEachTopLevelDeclarationInBindingName(name, cb) {
switch (name.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return cb(ts.cast(name.parent, function (x) { return ts.isVariableDeclaration(x) || ts.isBindingElement(x); }));
- case 185 /* ArrayBindingPattern */:
- case 184 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
return ts.firstDefined(name.elements, function (em) { return ts.isOmittedExpression(em) ? undefined : forEachTopLevelDeclarationInBindingName(em.name, cb); });
default:
return ts.Debug.assertNever(name);
@@ -119525,9 +120636,9 @@
}
function getTopLevelDeclarationStatement(d) {
switch (d.kind) {
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return d.parent.parent;
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return getTopLevelDeclarationStatement(ts.cast(d.parent.parent, function (p) { return ts.isVariableDeclaration(p) || ts.isBindingElement(p); }));
default:
return d;
@@ -119558,25 +120669,25 @@
return useEs6Exports ? [addEs6Export(decl)] : addCommonjsExport(decl);
}
function addEs6Export(d) {
- var modifiers = ts.concatenate([ts.createModifier(85 /* ExportKeyword */)], d.modifiers);
+ var modifiers = ts.concatenate([ts.createModifier(86 /* ExportKeyword */)], d.modifiers);
switch (d.kind) {
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return ts.updateFunctionDeclaration(d, d.decorators, modifiers, d.asteriskToken, d.name, d.typeParameters, d.parameters, d.type, d.body);
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return ts.updateClassDeclaration(d, d.decorators, modifiers, d.name, d.typeParameters, d.heritageClauses, d.members);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return ts.updateVariableStatement(d, modifiers, d.declarationList);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return ts.updateModuleDeclaration(d, d.decorators, modifiers, d.name, d.body);
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return ts.updateEnumDeclaration(d, d.decorators, modifiers, d.name, d.members);
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return ts.updateTypeAliasDeclaration(d, d.decorators, modifiers, d.name, d.typeParameters, d.type);
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
return ts.updateInterfaceDeclaration(d, d.decorators, modifiers, d.name, d.typeParameters, d.heritageClauses, d.members);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return ts.updateImportEqualsDeclaration(d, d.decorators, modifiers, d.name, d.moduleReference);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return ts.Debug.fail(); // Shouldn't try to add 'export' keyword to `exports.x = ...`
default:
return ts.Debug.assertNever(d);
@@ -119587,18 +120698,18 @@
}
function getNamesToExportInCommonJS(decl) {
switch (decl.kind) {
- case 239 /* FunctionDeclaration */:
- case 240 /* ClassDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
return [decl.name.text]; // TODO: GH#18217
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return ts.mapDefined(decl.declarationList.declarations, function (d) { return ts.isIdentifier(d.name) ? d.name.text : undefined; });
- case 244 /* ModuleDeclaration */:
- case 243 /* EnumDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return ts.emptyArray;
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return ts.Debug.fail(); // Shouldn't try to add 'export' keyword to `exports.x = ...`
default:
return ts.Debug.assertNever(decl);
@@ -119606,7 +120717,7 @@
}
/** Creates `exports.x = x;` */
function createExportAssignment(name) {
- return ts.createExpressionStatement(ts.createBinary(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.createIdentifier(name)), 59 /* EqualsToken */, ts.createIdentifier(name)));
+ return ts.createExpressionStatement(ts.createBinary(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.createIdentifier(name)), 60 /* EqualsToken */, ts.createIdentifier(name)));
}
})(refactor = ts.refactor || (ts.refactor = {}));
})(ts || (ts = {}));
@@ -119772,8 +120883,8 @@
function groupReferences(referenceEntries) {
var classReferences = { accessExpressions: [], typeUsages: [] };
var groupedReferences = { functionCalls: [], declarations: [], classReferences: classReferences, valid: true };
- var functionSymbols = ts.map(functionNames, checker.getSymbolAtLocation);
- var classSymbols = ts.map(classNames, checker.getSymbolAtLocation);
+ var functionSymbols = ts.map(functionNames, getSymbolTargetAtLocation);
+ var classSymbols = ts.map(classNames, getSymbolTargetAtLocation);
var isConstructor = ts.isConstructorDeclaration(functionDeclaration);
for (var _i = 0, referenceEntries_1 = referenceEntries; _i < referenceEntries_1.length; _i++) {
var entry = referenceEntries_1[_i];
@@ -119792,7 +120903,11 @@
So we need to add a special case for this because when calling a constructor of a class through one of its subclasses,
the symbols are going to be different.
*/
- if (ts.contains(functionSymbols, checker.getSymbolAtLocation(entry.node), symbolComparer) || ts.isNewExpressionTarget(entry.node)) {
+ if (ts.contains(functionSymbols, getSymbolTargetAtLocation(entry.node)) || ts.isNewExpressionTarget(entry.node)) {
+ var importOrExportReference = entryToImportOrExport(entry);
+ if (importOrExportReference) {
+ continue;
+ }
var decl = entryToDeclaration(entry);
if (decl) {
groupedReferences.declarations.push(decl);
@@ -119805,7 +120920,11 @@
}
}
// if the refactored function is a constructor, we must also check if the references to its class are valid
- if (isConstructor && ts.contains(classSymbols, checker.getSymbolAtLocation(entry.node), symbolComparer)) {
+ if (isConstructor && ts.contains(classSymbols, getSymbolTargetAtLocation(entry.node))) {
+ var importOrExportReference = entryToImportOrExport(entry);
+ if (importOrExportReference) {
+ continue;
+ }
var decl = entryToDeclaration(entry);
if (decl) {
groupedReferences.declarations.push(decl);
@@ -119830,9 +120949,23 @@
}
return groupedReferences;
}
+ function getSymbolTargetAtLocation(node) {
+ var symbol = checker.getSymbolAtLocation(node);
+ return symbol && ts.getSymbolTarget(symbol, checker);
+ }
}
- function symbolComparer(a, b) {
- return ts.getSymbolTarget(a) === ts.getSymbolTarget(b);
+ function entryToImportOrExport(entry) {
+ var node = entry.node;
+ if (ts.isImportSpecifier(node.parent)
+ || ts.isImportClause(node.parent)
+ || ts.isImportEqualsDeclaration(node.parent)
+ || ts.isNamespaceImport(node.parent)) {
+ return node;
+ }
+ if (ts.isExportSpecifier(node.parent) || ts.isExportAssignment(node.parent)) {
+ return node;
+ }
+ return undefined;
}
function entryToDeclaration(entry) {
if (ts.isDeclaration(entry.node.parent)) {
@@ -119845,37 +120978,31 @@
var functionReference = entry.node;
var parent = functionReference.parent;
switch (parent.kind) {
- // Function call (foo(...) or super(...))
- case 191 /* CallExpression */:
- var callExpression = ts.tryCast(parent, ts.isCallExpression);
- if (callExpression && callExpression.expression === functionReference) {
- return callExpression;
- }
- break;
- // Constructor call (new Foo(...))
- case 192 /* NewExpression */:
- var newExpression = ts.tryCast(parent, ts.isNewExpression);
- if (newExpression && newExpression.expression === functionReference) {
- return newExpression;
+ // foo(...) or super(...) or new Foo(...)
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
+ var callOrNewExpression = ts.tryCast(parent, ts.isCallOrNewExpression);
+ if (callOrNewExpression && callOrNewExpression.expression === functionReference) {
+ return callOrNewExpression;
}
break;
- // Method call (x.foo(...))
- case 189 /* PropertyAccessExpression */:
+ // x.foo(...)
+ case 190 /* PropertyAccessExpression */:
var propertyAccessExpression = ts.tryCast(parent, ts.isPropertyAccessExpression);
if (propertyAccessExpression && propertyAccessExpression.parent && propertyAccessExpression.name === functionReference) {
- var callExpression_1 = ts.tryCast(propertyAccessExpression.parent, ts.isCallExpression);
- if (callExpression_1 && callExpression_1.expression === propertyAccessExpression) {
- return callExpression_1;
+ var callOrNewExpression_1 = ts.tryCast(propertyAccessExpression.parent, ts.isCallOrNewExpression);
+ if (callOrNewExpression_1 && callOrNewExpression_1.expression === propertyAccessExpression) {
+ return callOrNewExpression_1;
}
}
break;
- // Method call (x["foo"](...))
- case 190 /* ElementAccessExpression */:
+ // x["foo"](...)
+ case 191 /* ElementAccessExpression */:
var elementAccessExpression = ts.tryCast(parent, ts.isElementAccessExpression);
if (elementAccessExpression && elementAccessExpression.parent && elementAccessExpression.argumentExpression === functionReference) {
- var callExpression_2 = ts.tryCast(elementAccessExpression.parent, ts.isCallExpression);
- if (callExpression_2 && callExpression_2.expression === elementAccessExpression) {
- return callExpression_2;
+ var callOrNewExpression_2 = ts.tryCast(elementAccessExpression.parent, ts.isCallOrNewExpression);
+ if (callOrNewExpression_2 && callOrNewExpression_2.expression === elementAccessExpression) {
+ return callOrNewExpression_2;
}
}
break;
@@ -119889,14 +121016,14 @@
var parent = reference.parent;
switch (parent.kind) {
// `C.foo`
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
var propertyAccessExpression = ts.tryCast(parent, ts.isPropertyAccessExpression);
if (propertyAccessExpression && propertyAccessExpression.expression === reference) {
return propertyAccessExpression;
}
break;
// `C["foo"]`
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
var elementAccessExpression = ts.tryCast(parent, ts.isElementAccessExpression);
if (elementAccessExpression && elementAccessExpression.expression === reference) {
return elementAccessExpression;
@@ -119915,7 +121042,7 @@
}
function getFunctionDeclarationAtPosition(file, startPosition, checker) {
var node = ts.getTouchingToken(file, startPosition);
- var functionDeclaration = ts.getContainingFunction(node);
+ var functionDeclaration = ts.getContainingFunctionDeclaration(node);
// don't offer refactor on top-level JSDoc
if (isTopLevelJSDoc(node))
return undefined;
@@ -119938,28 +121065,34 @@
if (!isValidParameterNodeArray(functionDeclaration.parameters, checker))
return false;
switch (functionDeclaration.kind) {
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
- return !!functionDeclaration.name
- && !!functionDeclaration.body
- && !checker.isImplementationOfOverload(functionDeclaration);
- case 157 /* Constructor */:
+ case 240 /* FunctionDeclaration */:
+ return hasNameOrDefault(functionDeclaration) && isSingleImplementation(functionDeclaration, checker);
+ case 157 /* MethodDeclaration */:
+ return isSingleImplementation(functionDeclaration, checker);
+ case 158 /* Constructor */:
if (ts.isClassDeclaration(functionDeclaration.parent)) {
- return !!functionDeclaration.body
- && !!functionDeclaration.parent.name
- && !checker.isImplementationOfOverload(functionDeclaration);
+ return hasNameOrDefault(functionDeclaration.parent) && isSingleImplementation(functionDeclaration, checker);
}
else {
return isValidVariableDeclaration(functionDeclaration.parent.parent)
- && !!functionDeclaration.body
- && !checker.isImplementationOfOverload(functionDeclaration);
+ && isSingleImplementation(functionDeclaration, checker);
}
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return isValidVariableDeclaration(functionDeclaration.parent);
}
return false;
}
+ function isSingleImplementation(functionDeclaration, checker) {
+ return !!functionDeclaration.body && !checker.isImplementationOfOverload(functionDeclaration);
+ }
+ function hasNameOrDefault(functionOrClassDeclaration) {
+ if (!functionOrClassDeclaration.name) {
+ var defaultKeyword = ts.findModifier(functionOrClassDeclaration, 81 /* DefaultKeyword */);
+ return !!defaultKeyword;
+ }
+ return true;
+ }
function isValidParameterNodeArray(parameters, checker) {
return getRefactorableParametersLength(parameters) >= minimumParameterLength
&& ts.every(parameters, /*callback*/ function (/*callback*/ paramDecl) { return isValidParameterDeclaration(paramDecl, checker); });
@@ -120116,10 +121249,15 @@
}
function getClassNames(constructorDeclaration) {
switch (constructorDeclaration.parent.kind) {
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
var classDeclaration = constructorDeclaration.parent;
+ if (classDeclaration.name)
return [classDeclaration.name];
- case 209 /* ClassExpression */:
+ // If the class declaration doesn't have a name, it should have a default modifier.
+ // We validated this in `isValidFunctionDeclaration` through `hasNameOrDefault`
+ var defaultModifier = ts.Debug.assertDefined(ts.findModifier(classDeclaration, 81 /* DefaultKeyword */), "Nameless class declaration should be a default export");
+ return [defaultModifier];
+ case 210 /* ClassExpression */:
var classExpression = constructorDeclaration.parent;
var variableDeclaration = constructorDeclaration.parent.parent;
var className = classExpression.name;
@@ -120130,19 +121268,25 @@
}
function getFunctionNames(functionDeclaration) {
switch (functionDeclaration.kind) {
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ if (functionDeclaration.name)
return [functionDeclaration.name];
- case 157 /* Constructor */:
- var ctrKeyword = ts.findChildOfKind(functionDeclaration, 124 /* ConstructorKeyword */, functionDeclaration.getSourceFile());
- if (functionDeclaration.parent.kind === 209 /* ClassExpression */) {
+ // If the function declaration doesn't have a name, it should have a default modifier.
+ // We validated this in `isValidFunctionDeclaration` through `hasNameOrDefault`
+ var defaultModifier = ts.Debug.assertDefined(ts.findModifier(functionDeclaration, 81 /* DefaultKeyword */), "Nameless function declaration should be a default export");
+ return [defaultModifier];
+ case 157 /* MethodDeclaration */:
+ return [functionDeclaration.name];
+ case 158 /* Constructor */:
+ var ctrKeyword = ts.Debug.assertDefined(ts.findChildOfKind(functionDeclaration, 125 /* ConstructorKeyword */, functionDeclaration.getSourceFile()), "Constructor declaration should have constructor keyword");
+ if (functionDeclaration.parent.kind === 210 /* ClassExpression */) {
var variableDeclaration = functionDeclaration.parent.parent;
return [variableDeclaration.name, ctrKeyword];
}
return [ctrKeyword];
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return [functionDeclaration.parent.name];
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
if (functionDeclaration.name)
return [functionDeclaration.name, functionDeclaration.parent.name];
return [functionDeclaration.parent.name];
@@ -120159,7 +121303,7 @@
ts.servicesVersion = "0.8";
function createNode(kind, pos, end, parent) {
var node = ts.isNodeKind(kind) ? new NodeObject(kind, pos, end) :
- kind === 72 /* Identifier */ ? new IdentifierObject(72 /* Identifier */, pos, end) :
+ kind === 73 /* Identifier */ ? new IdentifierObject(73 /* Identifier */, pos, end) :
new TokenObject(kind, pos, end);
node.parent = parent;
node.flags = parent.flags & 12679168 /* ContextFlags */;
@@ -120233,8 +121377,8 @@
if (!children.length) {
return undefined;
}
- var child = ts.find(children, function (kid) { return kid.kind < 288 /* FirstJSDocNode */ || kid.kind > 310 /* LastJSDocNode */; });
- return child.kind < 148 /* FirstNode */ ?
+ var child = ts.find(children, function (kid) { return kid.kind < 289 /* FirstJSDocNode */ || kid.kind > 311 /* LastJSDocNode */; });
+ return child.kind < 149 /* FirstNode */ ?
child :
child.getFirstToken(sourceFile);
};
@@ -120245,7 +121389,7 @@
if (!child) {
return undefined;
}
- return child.kind < 148 /* FirstNode */ ? child : child.getLastToken(sourceFile);
+ return child.kind < 149 /* FirstNode */ ? child : child.getLastToken(sourceFile);
};
NodeObject.prototype.forEachChild = function (cbNode, cbNodeArray) {
return ts.forEachChild(this, cbNode, cbNodeArray);
@@ -120291,8 +121435,8 @@
var token = ts.scanner.scan();
var textPos = ts.scanner.getTextPos();
if (textPos <= end) {
- if (token === 72 /* Identifier */) {
- ts.Debug.fail("Did not expect " + ts.Debug.showSyntaxKind(parent) + " to have an Identifier in its trivia");
+ if (token === 73 /* Identifier */) {
+ ts.Debug.fail("Did not expect " + ts.Debug.formatSyntaxKind(parent.kind) + " to have an Identifier in its trivia");
}
nodes.push(createNode(token, pos, textPos, parent));
}
@@ -120303,7 +121447,7 @@
}
}
function createSyntaxList(nodes, parent) {
- var list = createNode(311 /* SyntaxList */, nodes.pos, nodes.end, parent);
+ var list = createNode(312 /* SyntaxList */, nodes.pos, nodes.end, parent);
list._children = [];
var pos = nodes.pos;
for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
@@ -120437,7 +121581,7 @@
});
return IdentifierObject;
}(TokenOrIdentifierObject));
- IdentifierObject.prototype.kind = 72 /* Identifier */;
+ IdentifierObject.prototype.kind = 73 /* Identifier */;
var TypeObject = /** @class */ (function () {
function TypeObject(checker, flags) {
this.checker = checker;
@@ -120638,10 +121782,10 @@
}
function visit(node) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
var functionDeclaration = node;
var declarationName = getDeclarationName(functionDeclaration);
if (declarationName) {
@@ -120661,31 +121805,31 @@
}
ts.forEachChild(node, visit);
break;
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 243 /* EnumDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
- case 257 /* ExportSpecifier */:
- case 253 /* ImportSpecifier */:
- case 250 /* ImportClause */:
- case 251 /* NamespaceImport */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 168 /* TypeLiteral */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 258 /* ExportSpecifier */:
+ case 254 /* ImportSpecifier */:
+ case 251 /* ImportClause */:
+ case 252 /* NamespaceImport */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 169 /* TypeLiteral */:
addDeclaration(node);
ts.forEachChild(node, visit);
break;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
// Only consider parameter properties
if (!ts.hasModifier(node, 92 /* ParameterPropertyModifier */)) {
break;
}
// falls through
- case 237 /* VariableDeclaration */:
- case 186 /* BindingElement */: {
+ case 238 /* VariableDeclaration */:
+ case 187 /* BindingElement */: {
var decl = node;
if (ts.isBindingPattern(decl.name)) {
ts.forEachChild(decl.name, visit);
@@ -120696,19 +121840,19 @@
}
}
// falls through
- case 278 /* EnumMember */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 279 /* EnumMember */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
addDeclaration(node);
break;
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
// Handle named exports case e.g.:
// export {a, b as B} from "mod";
if (node.exportClause) {
ts.forEach(node.exportClause.elements, visit);
}
break;
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
var importClause = node.importClause;
if (importClause) {
// Handle default import case e.g.:
@@ -120720,7 +121864,7 @@
// import * as NS from "mod";
// import {a, b as B} from "mod";
if (importClause.namedBindings) {
- if (importClause.namedBindings.kind === 251 /* NamespaceImport */) {
+ if (importClause.namedBindings.kind === 252 /* NamespaceImport */) {
addDeclaration(importClause.namedBindings);
}
else {
@@ -120729,7 +121873,7 @@
}
}
break;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
if (ts.getAssignmentDeclarationKind(node) !== 0 /* None */) {
addDeclaration(node);
}
@@ -120898,7 +122042,7 @@
var sourceFile;
if (this.currentFileName !== fileName) {
// This is a new file, just parse it
- sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 7 /* Latest */, version, /*setNodeParents*/ true, scriptKind);
+ sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 8 /* Latest */, version, /*setNodeParents*/ true, scriptKind);
}
else if (this.currentFileVersion !== version) {
// This is the same file, just a newer version. Incrementally parse the file.
@@ -121302,41 +122446,48 @@
return undefined;
}
var typeChecker = program.getTypeChecker();
- var symbol = getSymbolAtLocationForQuickInfo(node, typeChecker);
+ var nodeForQuickInfo = getNodeForQuickInfo(node);
+ var symbol = getSymbolAtLocationForQuickInfo(nodeForQuickInfo, typeChecker);
if (!symbol || typeChecker.isUnknownSymbol(symbol)) {
- var type_2 = shouldGetType(sourceFile, node, position) ? typeChecker.getTypeAtLocation(node) : undefined;
+ var type_2 = shouldGetType(sourceFile, nodeForQuickInfo, position) ? typeChecker.getTypeAtLocation(nodeForQuickInfo) : undefined;
return type_2 && {
kind: "" /* unknown */,
kindModifiers: "" /* none */,
- textSpan: ts.createTextSpanFromNode(node, sourceFile),
- displayParts: typeChecker.runWithCancellationToken(cancellationToken, function (typeChecker) { return ts.typeToDisplayParts(typeChecker, type_2, ts.getContainerNode(node)); }),
+ textSpan: ts.createTextSpanFromNode(nodeForQuickInfo, sourceFile),
+ displayParts: typeChecker.runWithCancellationToken(cancellationToken, function (typeChecker) { return ts.typeToDisplayParts(typeChecker, type_2, ts.getContainerNode(nodeForQuickInfo)); }),
documentation: type_2.symbol ? type_2.symbol.getDocumentationComment(typeChecker) : undefined,
tags: type_2.symbol ? type_2.symbol.getJsDocTags() : undefined
};
}
var _a = typeChecker.runWithCancellationToken(cancellationToken, function (typeChecker) {
- return ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, ts.getContainerNode(node), node);
+ return ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, ts.getContainerNode(nodeForQuickInfo), nodeForQuickInfo);
}), symbolKind = _a.symbolKind, displayParts = _a.displayParts, documentation = _a.documentation, tags = _a.tags;
return {
kind: symbolKind,
kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol),
- textSpan: ts.createTextSpanFromNode(node, sourceFile),
+ textSpan: ts.createTextSpanFromNode(nodeForQuickInfo, sourceFile),
displayParts: displayParts,
documentation: documentation,
tags: tags,
};
}
+ function getNodeForQuickInfo(node) {
+ if (ts.isNewExpression(node.parent) && node.pos === node.parent.pos) {
+ return node.parent.expression;
+ }
+ return node;
+ }
function shouldGetType(sourceFile, node, position) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return !ts.isLabelName(node) && !ts.isTagName(node);
- case 189 /* PropertyAccessExpression */:
- case 148 /* QualifiedName */:
+ case 190 /* PropertyAccessExpression */:
+ case 149 /* QualifiedName */:
// Don't return quickInfo if inside the comment in `a/**/.b`
return !ts.isInComment(sourceFile, position);
- case 100 /* ThisKeyword */:
- case 178 /* ThisType */:
- case 98 /* SuperKeyword */:
+ case 101 /* ThisKeyword */:
+ case 179 /* ThisType */:
+ case 99 /* SuperKeyword */:
return true;
default:
return false;
@@ -121443,16 +122594,16 @@
return undefined;
}
switch (node.kind) {
- case 189 /* PropertyAccessExpression */:
- case 148 /* QualifiedName */:
+ case 190 /* PropertyAccessExpression */:
+ case 149 /* QualifiedName */:
case 10 /* StringLiteral */:
- case 87 /* FalseKeyword */:
- case 102 /* TrueKeyword */:
- case 96 /* NullKeyword */:
- case 98 /* SuperKeyword */:
- case 100 /* ThisKeyword */:
- case 178 /* ThisType */:
- case 72 /* Identifier */:
+ case 88 /* FalseKeyword */:
+ case 103 /* TrueKeyword */:
+ case 97 /* NullKeyword */:
+ case 99 /* SuperKeyword */:
+ case 101 /* ThisKeyword */:
+ case 179 /* ThisType */:
+ case 73 /* Identifier */:
break;
// Cant create the text span
default:
@@ -121468,7 +122619,7 @@
// If this is name of a module declarations, check if this is right side of dotted module name
// If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of
// Then this name is name from dotted module
- if (nodeForStartPos.parent.parent.kind === 244 /* ModuleDeclaration */ &&
+ if (nodeForStartPos.parent.parent.kind === 245 /* ModuleDeclaration */ &&
nodeForStartPos.parent.parent.body === nodeForStartPos.parent) {
// Use parent module declarations name for start pos
nodeForStartPos = nodeForStartPos.parent.parent.name;
@@ -121611,30 +122762,14 @@
}
function applyCodeActionCommand(fileName, actionOrFormatSettingsOrUndefined) {
var action = typeof fileName === "string" ? actionOrFormatSettingsOrUndefined : fileName;
- var formatSettings = typeof fileName !== "string" ? actionOrFormatSettingsOrUndefined : undefined;
- return ts.isArray(action) ? Promise.all(action.map(function (a) { return applySingleCodeActionCommand(a, formatSettings); })) : applySingleCodeActionCommand(action, formatSettings);
+ return ts.isArray(action) ? Promise.all(action.map(function (a) { return applySingleCodeActionCommand(a); })) : applySingleCodeActionCommand(action);
}
- function applySingleCodeActionCommand(action, formatSettings) {
+ function applySingleCodeActionCommand(action) {
var getPath = function (path) { return ts.toPath(path, currentDirectory, getCanonicalFileName); };
- switch (action.type) {
- case "install package":
+ ts.Debug.assertEqual(action.type, "install package");
return host.installPackage
? host.installPackage({ fileName: getPath(action.file), packageName: action.packageName })
: Promise.reject("Host does not implement `installPackage`");
- case "generate types": {
- var fileToGenerateTypesFor = action.fileToGenerateTypesFor, outputFileName_1 = action.outputFileName;
- if (!host.inspectValue)
- return Promise.reject("Host does not implement `installPackage`");
- var valueInfoPromise = host.inspectValue({ fileNameToRequire: fileToGenerateTypesFor });
- return valueInfoPromise.then(function (valueInfo) {
- var fullOut = getPath(outputFileName_1);
- host.writeFile(fullOut, ts.valueInfoToDeclarationFileText(valueInfo, formatSettings || ts.testFormatSettings)); // TODO: GH#18217
- return { successMessage: "Wrote types to '" + fullOut + "'" };
- });
- }
- default:
- return ts.Debug.assertNever(action);
- }
}
function getDocCommentTemplateAtPosition(fileName, position) {
return ts.JsDoc.getDocCommentTemplateAtPosition(ts.getNewLineOrDefaultFromHost(host), syntaxTreeCache.getCurrentSourceFile(fileName), position);
@@ -121830,6 +122965,9 @@
preferences: preferences,
};
}
+ function getSmartSelectionRange(fileName, position) {
+ return ts.SmartSelectionRange.getSmartSelectionRange(position, syntaxTreeCache.getCurrentSourceFile(fileName));
+ }
function getApplicableRefactors(fileName, positionOrRange, preferences) {
if (preferences === void 0) { preferences = ts.emptyOptions; }
synchronizeHostData();
@@ -121870,6 +123008,7 @@
getBreakpointStatementAtPosition: getBreakpointStatementAtPosition,
getNavigateToItems: getNavigateToItems,
getRenameInfo: getRenameInfo,
+ getSmartSelectionRange: getSmartSelectionRange,
findRenameLocations: findRenameLocations,
getNavigationBarItems: getNavigationBarItems,
getNavigationTree: getNavigationTree,
@@ -121932,7 +123071,7 @@
*/
function literalIsName(node) {
return ts.isDeclarationName(node) ||
- node.parent.kind === 259 /* ExternalModuleReference */ ||
+ node.parent.kind === 260 /* ExternalModuleReference */ ||
isArgumentOfElementAccessExpression(node) ||
ts.isLiteralComputedPropertyDeclarationName(node);
}
@@ -121949,13 +123088,13 @@
switch (node.kind) {
case 10 /* StringLiteral */:
case 8 /* NumericLiteral */:
- if (node.parent.kind === 149 /* ComputedPropertyName */) {
+ if (node.parent.kind === 150 /* ComputedPropertyName */) {
return ts.isObjectLiteralElement(node.parent.parent) ? node.parent.parent : undefined;
}
// falls through
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return ts.isObjectLiteralElement(node.parent) &&
- (node.parent.parent.kind === 188 /* ObjectLiteralExpression */ || node.parent.parent.kind === 268 /* JsxAttributes */) &&
+ (node.parent.parent.kind === 189 /* ObjectLiteralExpression */ || node.parent.parent.kind === 269 /* JsxAttributes */) &&
node.parent.name === node ? node.parent : undefined;
}
return undefined;
@@ -121997,7 +123136,7 @@
function isArgumentOfElementAccessExpression(node) {
return node &&
node.parent &&
- node.parent.kind === 190 /* ElementAccessExpression */ &&
+ node.parent.kind === 191 /* ElementAccessExpression */ &&
node.parent.argumentExpression === node;
}
/**
@@ -122077,114 +123216,114 @@
if (node) {
var parent = node.parent;
switch (node.kind) {
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
// Span on first variable declaration
return spanInVariableDeclaration(node.declarationList.declarations[0]);
- case 237 /* VariableDeclaration */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 238 /* VariableDeclaration */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
return spanInVariableDeclaration(node);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return spanInParameterDeclaration(node);
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 157 /* Constructor */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 158 /* Constructor */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return spanInFunctionDeclaration(node);
- case 218 /* Block */:
+ case 219 /* Block */:
if (ts.isFunctionBlock(node)) {
return spanInFunctionBlock(node);
}
// falls through
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
return spanInBlock(node);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return spanInBlock(node.block);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
// span on the expression
return textSpan(node.expression);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
// span on return keyword and expression if present
return textSpan(node.getChildAt(0), node.expression);
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
// Span on while(...)
return textSpanEndingAtNextToken(node, node.expression);
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
// span in statement of the do statement
return spanInNode(node.statement);
- case 236 /* DebuggerStatement */:
+ case 237 /* DebuggerStatement */:
// span on debugger keyword
return textSpan(node.getChildAt(0));
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
// set on if(..) span
return textSpanEndingAtNextToken(node, node.expression);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
// span in statement
return spanInNode(node.statement);
- case 229 /* BreakStatement */:
- case 228 /* ContinueStatement */:
+ case 230 /* BreakStatement */:
+ case 229 /* ContinueStatement */:
// On break or continue keyword and label if present
return textSpan(node.getChildAt(0), node.label);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return spanInForStatement(node);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
// span of for (a in ...)
return textSpanEndingAtNextToken(node, node.expression);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
// span in initializer
return spanInInitializerOfForLike(node);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
// span on switch(...)
return textSpanEndingAtNextToken(node, node.expression);
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
// span in first statement of the clause
return spanInNode(node.statements[0]);
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
// span in try block
return spanInBlock(node.tryBlock);
- case 234 /* ThrowStatement */:
+ case 235 /* ThrowStatement */:
// span in throw ...
return textSpan(node, node.expression);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
// span on export = id
return textSpan(node, node.expression);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
// import statement without including semicolon
return textSpan(node, node.moduleReference);
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
// import statement without including semicolon
return textSpan(node, node.moduleSpecifier);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
// import statement without including semicolon
return textSpan(node, node.moduleSpecifier);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
// span on complete module if it is instantiated
if (ts.getModuleInstanceState(node) !== 1 /* Instantiated */) {
return undefined;
}
// falls through
- case 240 /* ClassDeclaration */:
- case 243 /* EnumDeclaration */:
- case 278 /* EnumMember */:
- case 186 /* BindingElement */:
+ case 241 /* ClassDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 279 /* EnumMember */:
+ case 187 /* BindingElement */:
// span on complete node
return textSpan(node);
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
// span in statement
return spanInNode(node.statement);
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
return spanInNodeArray(parent.decorators);
- case 184 /* ObjectBindingPattern */:
- case 185 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
return spanInBindingPattern(node);
// No breakpoint in interface, type alias
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return undefined;
// Tokens:
case 26 /* SemicolonToken */:
@@ -122208,13 +123347,13 @@
case 28 /* LessThanToken */:
return spanInGreaterThanOrLessThanToken(node);
// Keywords:
- case 107 /* WhileKeyword */:
+ case 108 /* WhileKeyword */:
return spanInWhileKeyword(node);
- case 83 /* ElseKeyword */:
- case 75 /* CatchKeyword */:
- case 88 /* FinallyKeyword */:
+ case 84 /* ElseKeyword */:
+ case 76 /* CatchKeyword */:
+ case 89 /* FinallyKeyword */:
return spanInNextNode(node);
- case 147 /* OfKeyword */:
+ case 148 /* OfKeyword */:
return spanInOfKeyword(node);
default:
// Destructuring pattern in destructuring assignment
@@ -122226,14 +123365,14 @@
// Set breakpoint on identifier element of destructuring pattern
// `a` or `...c` or `d: x` from
// `[a, b, ...c]` or `{ a, b }` or `{ d: x }` from destructuring pattern
- if ((node.kind === 72 /* Identifier */ ||
- node.kind === 208 /* SpreadElement */ ||
- node.kind === 275 /* PropertyAssignment */ ||
- node.kind === 276 /* ShorthandPropertyAssignment */) &&
+ if ((node.kind === 73 /* Identifier */ ||
+ node.kind === 209 /* SpreadElement */ ||
+ node.kind === 276 /* PropertyAssignment */ ||
+ node.kind === 277 /* ShorthandPropertyAssignment */) &&
ts.isArrayLiteralOrObjectLiteralDestructuringPattern(parent)) {
return textSpan(node);
}
- if (node.kind === 204 /* BinaryExpression */) {
+ if (node.kind === 205 /* BinaryExpression */) {
var _a = node, left = _a.left, operatorToken = _a.operatorToken;
// Set breakpoint in destructuring pattern if its destructuring assignment
// [a, b, c] or {a, b, c} of
@@ -122242,7 +123381,7 @@
if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(left)) {
return spanInArrayLiteralOrObjectLiteralDestructuringPattern(left);
}
- if (operatorToken.kind === 59 /* EqualsToken */ && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) {
+ if (operatorToken.kind === 60 /* EqualsToken */ && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) {
// Set breakpoint on assignment expression element of destructuring pattern
// a = expression of
// [a = expression, b, c] = someExpression or
@@ -122255,22 +123394,22 @@
}
if (ts.isExpressionNode(node)) {
switch (parent.kind) {
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
// Set span as if on while keyword
return spanInPreviousNode(node);
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
// Set breakpoint on the decorator emit
return spanInNode(node.parent);
- case 225 /* ForStatement */:
- case 227 /* ForOfStatement */:
+ case 226 /* ForStatement */:
+ case 228 /* ForOfStatement */:
return textSpan(node);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
if (node.parent.operatorToken.kind === 27 /* CommaToken */) {
// If this is a comma expression, the breakpoint is possible in this expression
return textSpan(node);
}
break;
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
if (node.parent.body === node) {
// If this is body of arrow function, it is allowed to have the breakpoint
return textSpan(node);
@@ -122279,21 +123418,21 @@
}
}
switch (node.parent.kind) {
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
// If this is name of property assignment, set breakpoint in the initializer
if (node.parent.name === node &&
!ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) {
return spanInNode(node.parent.initializer);
}
break;
- case 194 /* TypeAssertionExpression */:
+ case 195 /* TypeAssertionExpression */:
// Breakpoint in type assertion goes to its operand
if (node.parent.type === node) {
return spanInNextNode(node.parent.type);
}
break;
- case 237 /* VariableDeclaration */:
- case 151 /* Parameter */: {
+ case 238 /* VariableDeclaration */:
+ case 152 /* Parameter */: {
// initializer of variable/parameter declaration go to previous node
var _b = node.parent, initializer = _b.initializer, type = _b.type;
if (initializer === node || type === node || ts.isAssignmentOperator(node.kind)) {
@@ -122301,7 +123440,7 @@
}
break;
}
- case 204 /* BinaryExpression */: {
+ case 205 /* BinaryExpression */: {
var left = node.parent.left;
if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(left) && node !== left) {
// If initializer of destructuring assignment move to previous token
@@ -122331,7 +123470,7 @@
}
function spanInVariableDeclaration(variableDeclaration) {
// If declaration of for in statement, just set the span in parent
- if (variableDeclaration.parent.parent.kind === 226 /* ForInStatement */) {
+ if (variableDeclaration.parent.parent.kind === 227 /* ForInStatement */) {
return spanInNode(variableDeclaration.parent.parent);
}
var parent = variableDeclaration.parent;
@@ -122343,7 +123482,7 @@
// or its declaration from 'for of'
if (variableDeclaration.initializer ||
ts.hasModifier(variableDeclaration, 1 /* Export */) ||
- parent.parent.kind === 227 /* ForOfStatement */) {
+ parent.parent.kind === 228 /* ForOfStatement */) {
return textSpanFromVariableDeclaration(variableDeclaration);
}
if (ts.isVariableDeclarationList(variableDeclaration.parent) &&
@@ -122384,7 +123523,7 @@
}
function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) {
return ts.hasModifier(functionDeclaration, 1 /* Export */) ||
- (functionDeclaration.parent.kind === 240 /* ClassDeclaration */ && functionDeclaration.kind !== 157 /* Constructor */);
+ (functionDeclaration.parent.kind === 241 /* ClassDeclaration */ && functionDeclaration.kind !== 158 /* Constructor */);
}
function spanInFunctionDeclaration(functionDeclaration) {
// No breakpoints in the function signature
@@ -122407,26 +123546,26 @@
}
function spanInBlock(block) {
switch (block.parent.kind) {
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
if (ts.getModuleInstanceState(block.parent) !== 1 /* Instantiated */) {
return undefined;
}
// falls through
// Set on parent if on same line otherwise on first statement
- case 224 /* WhileStatement */:
- case 222 /* IfStatement */:
- case 226 /* ForInStatement */:
+ case 225 /* WhileStatement */:
+ case 223 /* IfStatement */:
+ case 227 /* ForInStatement */:
return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]);
// Set span on previous token if it starts on same line otherwise on the first statement of the block
- case 225 /* ForStatement */:
- case 227 /* ForOfStatement */:
+ case 226 /* ForStatement */:
+ case 228 /* ForOfStatement */:
return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]);
}
// Default action is to set on first statement
return spanInNode(block.statements[0]);
}
function spanInInitializerOfForLike(forLikeStatement) {
- if (forLikeStatement.initializer.kind === 238 /* VariableDeclarationList */) {
+ if (forLikeStatement.initializer.kind === 239 /* VariableDeclarationList */) {
// Declaration list - set breakpoint in first declaration
var variableDeclarationList = forLikeStatement.initializer;
if (variableDeclarationList.declarations.length > 0) {
@@ -122451,21 +123590,21 @@
}
function spanInBindingPattern(bindingPattern) {
// Set breakpoint in first binding element
- var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 210 /* OmittedExpression */ ? element : undefined; });
+ var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 211 /* OmittedExpression */ ? element : undefined; });
if (firstBindingElement) {
return spanInNode(firstBindingElement);
}
// Empty binding pattern of binding element, set breakpoint on binding element
- if (bindingPattern.parent.kind === 186 /* BindingElement */) {
+ if (bindingPattern.parent.kind === 187 /* BindingElement */) {
return textSpan(bindingPattern.parent);
}
// Variable declaration is used as the span
return textSpanFromVariableDeclaration(bindingPattern.parent);
}
function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) {
- ts.Debug.assert(node.kind !== 185 /* ArrayBindingPattern */ && node.kind !== 184 /* ObjectBindingPattern */);
- var elements = node.kind === 187 /* ArrayLiteralExpression */ ? node.elements : node.properties;
- var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 210 /* OmittedExpression */ ? element : undefined; });
+ ts.Debug.assert(node.kind !== 186 /* ArrayBindingPattern */ && node.kind !== 185 /* ObjectBindingPattern */);
+ var elements = node.kind === 188 /* ArrayLiteralExpression */ ? node.elements : node.properties;
+ var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 211 /* OmittedExpression */ ? element : undefined; });
if (firstBindingElement) {
return spanInNode(firstBindingElement);
}
@@ -122473,18 +123612,18 @@
// just nested element in another destructuring assignment
// set breakpoint on assignment when parent is destructuring assignment
// Otherwise set breakpoint for this element
- return textSpan(node.parent.kind === 204 /* BinaryExpression */ ? node.parent : node);
+ return textSpan(node.parent.kind === 205 /* BinaryExpression */ ? node.parent : node);
}
// Tokens:
function spanInOpenBraceToken(node) {
switch (node.parent.kind) {
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
var enumDeclaration = node.parent;
return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile));
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
var classDeclaration = node.parent;
return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile));
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]);
}
// Default to parent node
@@ -122492,25 +123631,25 @@
}
function spanInCloseBraceToken(node) {
switch (node.parent.kind) {
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
// If this is not an instantiated module block, no bp span
if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* Instantiated */) {
return undefined;
}
// falls through
- case 243 /* EnumDeclaration */:
- case 240 /* ClassDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 241 /* ClassDeclaration */:
// Span on close brace token
return textSpan(node);
- case 218 /* Block */:
+ case 219 /* Block */:
if (ts.isFunctionBlock(node.parent)) {
// Span on close brace token
return textSpan(node);
}
// falls through
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return spanInNode(ts.lastOrUndefined(node.parent.statements));
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
// breakpoint in last statement of the last clause
var caseBlock = node.parent;
var lastClause = ts.lastOrUndefined(caseBlock.clauses);
@@ -122518,7 +123657,7 @@
return spanInNode(ts.lastOrUndefined(lastClause.statements));
}
return undefined;
- case 184 /* ObjectBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
// Breakpoint in last binding element or binding pattern if it contains no elements
var bindingPattern = node.parent;
return spanInNode(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern);
@@ -122534,7 +123673,7 @@
}
function spanInCloseBracketToken(node) {
switch (node.parent.kind) {
- case 185 /* ArrayBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
// Breakpoint in last binding element or binding pattern if it contains no elements
var bindingPattern = node.parent;
return textSpan(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern);
@@ -122549,12 +123688,12 @@
}
}
function spanInOpenParenToken(node) {
- if (node.parent.kind === 223 /* DoStatement */ || // Go to while keyword and do action instead
- node.parent.kind === 191 /* CallExpression */ ||
- node.parent.kind === 192 /* NewExpression */) {
+ if (node.parent.kind === 224 /* DoStatement */ || // Go to while keyword and do action instead
+ node.parent.kind === 192 /* CallExpression */ ||
+ node.parent.kind === 193 /* NewExpression */) {
return spanInPreviousNode(node);
}
- if (node.parent.kind === 195 /* ParenthesizedExpression */) {
+ if (node.parent.kind === 196 /* ParenthesizedExpression */) {
return spanInNextNode(node);
}
// Default to parent node
@@ -122563,21 +123702,21 @@
function spanInCloseParenToken(node) {
// Is this close paren token of parameter list, set span in previous token
switch (node.parent.kind) {
- case 196 /* FunctionExpression */:
- case 239 /* FunctionDeclaration */:
- case 197 /* ArrowFunction */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 157 /* Constructor */:
- case 224 /* WhileStatement */:
- case 223 /* DoStatement */:
- case 225 /* ForStatement */:
- case 227 /* ForOfStatement */:
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
- case 195 /* ParenthesizedExpression */:
+ case 197 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
+ case 198 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 158 /* Constructor */:
+ case 225 /* WhileStatement */:
+ case 224 /* DoStatement */:
+ case 226 /* ForStatement */:
+ case 228 /* ForOfStatement */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
+ case 196 /* ParenthesizedExpression */:
return spanInPreviousNode(node);
// Default to parent node
default:
@@ -122587,20 +123726,20 @@
function spanInColonToken(node) {
// Is this : specifying return annotation of the function declaration
if (ts.isFunctionLike(node.parent) ||
- node.parent.kind === 275 /* PropertyAssignment */ ||
- node.parent.kind === 151 /* Parameter */) {
+ node.parent.kind === 276 /* PropertyAssignment */ ||
+ node.parent.kind === 152 /* Parameter */) {
return spanInPreviousNode(node);
}
return spanInNode(node.parent);
}
function spanInGreaterThanOrLessThanToken(node) {
- if (node.parent.kind === 194 /* TypeAssertionExpression */) {
+ if (node.parent.kind === 195 /* TypeAssertionExpression */) {
return spanInNextNode(node);
}
return spanInNode(node.parent);
}
function spanInWhileKeyword(node) {
- if (node.parent.kind === 223 /* DoStatement */) {
+ if (node.parent.kind === 224 /* DoStatement */) {
// Set span on while expression
return textSpanEndingAtNextToken(node, node.parent.expression);
}
@@ -122608,7 +123747,7 @@
return spanInNode(node.parent);
}
function spanInOfKeyword(node) {
- if (node.parent.kind === 227 /* ForOfStatement */) {
+ if (node.parent.kind === 228 /* ForOfStatement */) {
// Set using next token
return spanInNextNode(node);
}
@@ -123077,6 +124216,10 @@
var _this = this;
return this.forwardJSONCall("getRenameInfo('" + fileName + "', " + position + ")", function () { return _this.languageService.getRenameInfo(fileName, position, options); });
};
+ LanguageServiceShimObject.prototype.getSmartSelectionRange = function (fileName, position) {
+ var _this = this;
+ return this.forwardJSONCall("getSmartSelectionRange('" + fileName + "', " + position + ")", function () { return _this.languageService.getSmartSelectionRange(fileName, position); });
+ };
LanguageServiceShimObject.prototype.findRenameLocations = function (fileName, position, findInStrings, findInComments, providePrefixAndSuffixTextForRename) {
var _this = this;
return this.forwardJSONCall("findRenameLocations('" + fileName + "', " + position + ", " + findInStrings + ", " + findInComments + ", " + providePrefixAndSuffixTextForRename + ")", function () { return _this.languageService.findRenameLocations(fileName, position, findInStrings, findInComments, providePrefixAndSuffixTextForRename); });
@@ -123757,6 +124900,9 @@
/* @internal */
CommandTypes["GetEditsForFileRenameFull"] = "getEditsForFileRename-full";
CommandTypes["ConfigurePlugin"] = "configurePlugin";
+ CommandTypes["SelectionRange"] = "selectionRange";
+ /* @internal */
+ CommandTypes["SelectionRangeFull"] = "selectionRange-full";
// NOTE: If updating this, be sure to also update `allCommandNames` in `harness/unittests/session.ts`.
})(CommandTypes = protocol.CommandTypes || (protocol.CommandTypes = {}));
var IndentStyle;
@@ -123801,6 +124947,9 @@
ScriptTarget["ES2015"] = "ES2015";
ScriptTarget["ES2016"] = "ES2016";
ScriptTarget["ES2017"] = "ES2017";
+ ScriptTarget["ES2018"] = "ES2018";
+ ScriptTarget["ES2019"] = "ES2019";
+ ScriptTarget["ES2020"] = "ES2020";
ScriptTarget["ESNext"] = "ESNext";
})(ScriptTarget = protocol.ScriptTarget || (protocol.ScriptTarget = {}));
})(protocol = server.protocol || (server.protocol = {}));
@@ -124308,7 +125457,6 @@
isKnownTypesPackageName: ts.returnFalse,
// Should never be called because we never provide a types registry.
installPackage: ts.notImplemented,
- inspectValue: ts.notImplemented,
enqueueInstallTypingsRequest: ts.noop,
attach: ts.noop,
onProjectClosed: ts.noop,
@@ -124370,9 +125518,6 @@
TypingsCache.prototype.installPackage = function (options) {
return this.installer.installPackage(options);
};
- TypingsCache.prototype.inspectValue = function (options) {
- return this.installer.inspectValue(options);
- };
TypingsCache.prototype.enqueueInstallTypingsForProject = function (project, unresolvedImports, forceRefresh) {
var typeAcquisition = project.getTypeAcquisition();
if (!typeAcquisition || !typeAcquisition.enable) {
@@ -124585,13 +125730,13 @@
server.updateProjectIfDirty(this);
return hasOneOrMoreJsAndNoTsFiles(this);
};
- Project.resolveModule = function (moduleName, initialDir, host, log) {
+ Project.resolveModule = function (moduleName, initialDir, host, log, logErrors) {
var resolvedPath = ts.normalizeSlashes(host.resolvePath(ts.combinePaths(initialDir, "node_modules")));
log("Loading " + moduleName + " from " + initialDir + " (resolved to " + resolvedPath + ")");
var result = host.require(resolvedPath, moduleName); // TODO: GH#18217
if (result.error) {
var err = result.error.stack || result.error.message || JSON.stringify(result.error);
- log("Failed to load module '" + moduleName + "': " + err);
+ (logErrors || log)("Failed to load module '" + moduleName + "' from " + resolvedPath + ": " + err);
return undefined;
}
return result.module;
@@ -124602,10 +125747,6 @@
Project.prototype.installPackage = function (options) {
return this.typingsCache.installPackage(__assign({}, options, { projectName: this.projectName, projectRootPath: this.toPath(this.currentDirectory) }));
};
- /* @internal */
- Project.prototype.inspectValue = function (options) {
- return this.typingsCache.inspectValue(options);
- };
Object.defineProperty(Project.prototype, "typingsCache", {
get: function () {
return this.projectService.typingsCache;
@@ -125186,6 +126327,9 @@
}, function (removed) { return _this.detachScriptInfoFromProject(removed); });
var elapsed = ts.timestamp() - start;
this.writeLog("Finishing updateGraphWorker: Project: " + this.getProjectName() + " Version: " + this.getProjectVersion() + " structureChanged: " + hasNewProgram + " Elapsed: " + elapsed + "ms");
+ if (this.program !== oldProgram) {
+ this.print();
+ }
return hasNewProgram;
};
Project.prototype.detachScriptInfoFromProject = function (uncheckedFileName, noRemoveResolution) {
@@ -125350,11 +126494,11 @@
Project.prototype.enablePlugin = function (pluginConfigEntry, searchPaths, pluginConfigOverrides) {
var _this = this;
this.projectService.logger.info("Enabling plugin " + pluginConfigEntry.name + " from candidate paths: " + searchPaths.join(","));
- var log = function (message) {
- _this.projectService.logger.info(message);
- };
+ var log = function (message) { return _this.projectService.logger.info(message); };
+ var errorLogs;
+ var logError = function (message) { (errorLogs || (errorLogs = [])).push(message); };
var resolvedModule = ts.firstDefined(searchPaths, function (searchPath) {
- return Project.resolveModule(pluginConfigEntry.name, searchPath, _this.projectService.host, log);
+ return Project.resolveModule(pluginConfigEntry.name, searchPath, _this.projectService.host, log, logError);
});
if (resolvedModule) {
var configurationOverride = pluginConfigOverrides && pluginConfigOverrides.get(pluginConfigEntry.name);
@@ -125367,6 +126511,7 @@
this.enableProxy(resolvedModule, pluginConfigEntry);
}
else {
+ ts.forEach(errorLogs, log);
this.projectService.logger.info("Couldn't find " + pluginConfigEntry.name);
}
};
@@ -128754,8 +129899,8 @@
}
var Session = /** @class */ (function () {
function Session(opts) {
- var _this = this;
var _a;
+ var _this = this;
this.changeSeq = 0;
this.handlers = ts.createMapFromTemplate((_a = {},
_a[server.CommandNames.Status] = function () {
@@ -129087,6 +130232,12 @@
_this.doOutput(/*info*/ undefined, server.CommandNames.ConfigurePlugin, request.seq, /*success*/ true);
return _this.notRequired();
},
+ _a[server.CommandNames.SelectionRange] = function (request) {
+ return _this.requiredResponse(_this.getSmartSelectionRange(request.arguments, /*simplifiedResult*/ true));
+ },
+ _a[server.CommandNames.SelectionRangeFull] = function (request) {
+ return _this.requiredResponse(_this.getSmartSelectionRange(request.arguments, /*simplifiedResult*/ false));
+ },
_a));
this.host = opts.host;
this.cancellationToken = opts.cancellationToken;
@@ -130423,6 +131574,26 @@
Session.prototype.configurePlugin = function (args) {
this.projectService.configurePlugin(args);
};
+ Session.prototype.getSmartSelectionRange = function (args, simplifiedResult) {
+ var _this = this;
+ var locations = args.locations;
+ var _a = this.getFileAndLanguageServiceForSyntacticOperation(args), file = _a.file, languageService = _a.languageService;
+ var scriptInfo = ts.Debug.assertDefined(this.projectService.getScriptInfo(file));
+ return ts.map(locations, function (location) {
+ var pos = _this.getPosition(location, scriptInfo);
+ var selectionRange = languageService.getSmartSelectionRange(file, pos);
+ return simplifiedResult ? _this.mapSelectionRange(selectionRange, scriptInfo) : selectionRange;
+ });
+ };
+ Session.prototype.mapSelectionRange = function (selectionRange, scriptInfo) {
+ var result = {
+ textSpan: this.toLocationTextSpan(selectionRange.textSpan, scriptInfo),
+ };
+ if (selectionRange.parent) {
+ result.parent = this.mapSelectionRange(selectionRange.parent, scriptInfo);
+ }
+ return result;
+ };
Session.prototype.getCanonicalFileName = function (fileName) {
var name = this.host.useCaseSensitiveFileNames ? fileName : fileName.toLowerCase();
return ts.normalizePath(name);

lib/typescript.d.ts

@@ -14,7 +14,7 @@
***************************************************************************** */
declare namespace ts {
- const versionMajorMinor = "3.4";
+ const versionMajorMinor = "3.5";
/** The version of the TypeScript compiler release */
const version: string;
}
@@ -72,7 +72,7 @@
pos: number;
end: number;
}
- type JsDocSyntaxKind = SyntaxKind.EndOfFileToken | SyntaxKind.WhitespaceTrivia | SyntaxKind.AtToken | SyntaxKind.NewLineTrivia | SyntaxKind.AsteriskToken | SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.LessThanToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.EqualsToken | SyntaxKind.CommaToken | SyntaxKind.DotToken | SyntaxKind.Identifier | SyntaxKind.NoSubstitutionTemplateLiteral | SyntaxKind.Unknown | KeywordSyntaxKind;
+ type JSDocSyntaxKind = SyntaxKind.EndOfFileToken | SyntaxKind.WhitespaceTrivia | SyntaxKind.AtToken | SyntaxKind.NewLineTrivia | SyntaxKind.AsteriskToken | SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.LessThanToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.EqualsToken | SyntaxKind.CommaToken | SyntaxKind.DotToken | SyntaxKind.Identifier | SyntaxKind.BacktickToken | SyntaxKind.Unknown | KeywordSyntaxKind;
type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InKeyword | SyntaxKind.InferKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.RequireKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.OfKeyword;
type JsxTokenSyntaxKind = SyntaxKind.LessThanSlashToken | SyntaxKind.EndOfFileToken | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.OpenBraceToken | SyntaxKind.LessThanToken;
enum SyntaxKind {
@@ -135,281 +135,283 @@
QuestionToken = 56,
ColonToken = 57,
AtToken = 58,
- EqualsToken = 59,
- PlusEqualsToken = 60,
- MinusEqualsToken = 61,
- AsteriskEqualsToken = 62,
- AsteriskAsteriskEqualsToken = 63,
- SlashEqualsToken = 64,
- PercentEqualsToken = 65,
- LessThanLessThanEqualsToken = 66,
- GreaterThanGreaterThanEqualsToken = 67,
- GreaterThanGreaterThanGreaterThanEqualsToken = 68,
- AmpersandEqualsToken = 69,
- BarEqualsToken = 70,
- CaretEqualsToken = 71,
- Identifier = 72,
- BreakKeyword = 73,
- CaseKeyword = 74,
- CatchKeyword = 75,
- ClassKeyword = 76,
- ConstKeyword = 77,
- ContinueKeyword = 78,
- DebuggerKeyword = 79,
- DefaultKeyword = 80,
- DeleteKeyword = 81,
- DoKeyword = 82,
- ElseKeyword = 83,
- EnumKeyword = 84,
- ExportKeyword = 85,
- ExtendsKeyword = 86,
- FalseKeyword = 87,
- FinallyKeyword = 88,
- ForKeyword = 89,
- FunctionKeyword = 90,
- IfKeyword = 91,
- ImportKeyword = 92,
- InKeyword = 93,
- InstanceOfKeyword = 94,
- NewKeyword = 95,
- NullKeyword = 96,
- ReturnKeyword = 97,
- SuperKeyword = 98,
- SwitchKeyword = 99,
- ThisKeyword = 100,
- ThrowKeyword = 101,
- TrueKeyword = 102,
- TryKeyword = 103,
- TypeOfKeyword = 104,
- VarKeyword = 105,
- VoidKeyword = 106,
- WhileKeyword = 107,
- WithKeyword = 108,
- ImplementsKeyword = 109,
- InterfaceKeyword = 110,
- LetKeyword = 111,
- PackageKeyword = 112,
- PrivateKeyword = 113,
- ProtectedKeyword = 114,
- PublicKeyword = 115,
- StaticKeyword = 116,
- YieldKeyword = 117,
- AbstractKeyword = 118,
- AsKeyword = 119,
- AnyKeyword = 120,
- AsyncKeyword = 121,
- AwaitKeyword = 122,
- BooleanKeyword = 123,
- ConstructorKeyword = 124,
- DeclareKeyword = 125,
- GetKeyword = 126,
- InferKeyword = 127,
- IsKeyword = 128,
- KeyOfKeyword = 129,
- ModuleKeyword = 130,
- NamespaceKeyword = 131,
- NeverKeyword = 132,
- ReadonlyKeyword = 133,
- RequireKeyword = 134,
- NumberKeyword = 135,
- ObjectKeyword = 136,
- SetKeyword = 137,
- StringKeyword = 138,
- SymbolKeyword = 139,
- TypeKeyword = 140,
- UndefinedKeyword = 141,
- UniqueKeyword = 142,
- UnknownKeyword = 143,
- FromKeyword = 144,
- GlobalKeyword = 145,
- BigIntKeyword = 146,
- OfKeyword = 147,
- QualifiedName = 148,
- ComputedPropertyName = 149,
- TypeParameter = 150,
- Parameter = 151,
- Decorator = 152,
- PropertySignature = 153,
- PropertyDeclaration = 154,
- MethodSignature = 155,
- MethodDeclaration = 156,
- Constructor = 157,
- GetAccessor = 158,
- SetAccessor = 159,
- CallSignature = 160,
- ConstructSignature = 161,
- IndexSignature = 162,
- TypePredicate = 163,
- TypeReference = 164,
- FunctionType = 165,
- ConstructorType = 166,
- TypeQuery = 167,
- TypeLiteral = 168,
- ArrayType = 169,
- TupleType = 170,
- OptionalType = 171,
- RestType = 172,
- UnionType = 173,
- IntersectionType = 174,
- ConditionalType = 175,
- InferType = 176,
- ParenthesizedType = 177,
- ThisType = 178,
- TypeOperator = 179,
- IndexedAccessType = 180,
- MappedType = 181,
- LiteralType = 182,
- ImportType = 183,
- ObjectBindingPattern = 184,
- ArrayBindingPattern = 185,
- BindingElement = 186,
- ArrayLiteralExpression = 187,
- ObjectLiteralExpression = 188,
- PropertyAccessExpression = 189,
- ElementAccessExpression = 190,
- CallExpression = 191,
- NewExpression = 192,
- TaggedTemplateExpression = 193,
- TypeAssertionExpression = 194,
- ParenthesizedExpression = 195,
- FunctionExpression = 196,
- ArrowFunction = 197,
- DeleteExpression = 198,
- TypeOfExpression = 199,
- VoidExpression = 200,
- AwaitExpression = 201,
- PrefixUnaryExpression = 202,
- PostfixUnaryExpression = 203,
- BinaryExpression = 204,
- ConditionalExpression = 205,
- TemplateExpression = 206,
- YieldExpression = 207,
- SpreadElement = 208,
- ClassExpression = 209,
- OmittedExpression = 210,
- ExpressionWithTypeArguments = 211,
- AsExpression = 212,
- NonNullExpression = 213,
- MetaProperty = 214,
- SyntheticExpression = 215,
- TemplateSpan = 216,
- SemicolonClassElement = 217,
- Block = 218,
- VariableStatement = 219,
- EmptyStatement = 220,
- ExpressionStatement = 221,
- IfStatement = 222,
- DoStatement = 223,
- WhileStatement = 224,
- ForStatement = 225,
- ForInStatement = 226,
- ForOfStatement = 227,
- ContinueStatement = 228,
- BreakStatement = 229,
- ReturnStatement = 230,
- WithStatement = 231,
- SwitchStatement = 232,
- LabeledStatement = 233,
- ThrowStatement = 234,
- TryStatement = 235,
- DebuggerStatement = 236,
- VariableDeclaration = 237,
- VariableDeclarationList = 238,
- FunctionDeclaration = 239,
- ClassDeclaration = 240,
- InterfaceDeclaration = 241,
- TypeAliasDeclaration = 242,
- EnumDeclaration = 243,
- ModuleDeclaration = 244,
- ModuleBlock = 245,
- CaseBlock = 246,
- NamespaceExportDeclaration = 247,
- ImportEqualsDeclaration = 248,
- ImportDeclaration = 249,
- ImportClause = 250,
- NamespaceImport = 251,
- NamedImports = 252,
- ImportSpecifier = 253,
- ExportAssignment = 254,
- ExportDeclaration = 255,
- NamedExports = 256,
- ExportSpecifier = 257,
- MissingDeclaration = 258,
- ExternalModuleReference = 259,
- JsxElement = 260,
- JsxSelfClosingElement = 261,
- JsxOpeningElement = 262,
- JsxClosingElement = 263,
- JsxFragment = 264,
- JsxOpeningFragment = 265,
- JsxClosingFragment = 266,
- JsxAttribute = 267,
- JsxAttributes = 268,
- JsxSpreadAttribute = 269,
- JsxExpression = 270,
- CaseClause = 271,
- DefaultClause = 272,
- HeritageClause = 273,
- CatchClause = 274,
- PropertyAssignment = 275,
- ShorthandPropertyAssignment = 276,
- SpreadAssignment = 277,
- EnumMember = 278,
- UnparsedPrologue = 279,
- UnparsedPrepend = 280,
- UnparsedText = 281,
- UnparsedInternalText = 282,
- UnparsedSyntheticReference = 283,
- SourceFile = 284,
- Bundle = 285,
- UnparsedSource = 286,
- InputFiles = 287,
- JSDocTypeExpression = 288,
- JSDocAllType = 289,
- JSDocUnknownType = 290,
- JSDocNullableType = 291,
- JSDocNonNullableType = 292,
- JSDocOptionalType = 293,
- JSDocFunctionType = 294,
- JSDocVariadicType = 295,
- JSDocComment = 296,
- JSDocTypeLiteral = 297,
- JSDocSignature = 298,
- JSDocTag = 299,
- JSDocAugmentsTag = 300,
- JSDocClassTag = 301,
- JSDocCallbackTag = 302,
- JSDocEnumTag = 303,
- JSDocParameterTag = 304,
- JSDocReturnTag = 305,
- JSDocThisTag = 306,
- JSDocTypeTag = 307,
- JSDocTemplateTag = 308,
- JSDocTypedefTag = 309,
- JSDocPropertyTag = 310,
- SyntaxList = 311,
- NotEmittedStatement = 312,
- PartiallyEmittedExpression = 313,
- CommaListExpression = 314,
- MergeDeclarationMarker = 315,
- EndOfDeclarationMarker = 316,
- Count = 317,
- FirstAssignment = 59,
- LastAssignment = 71,
- FirstCompoundAssignment = 60,
- LastCompoundAssignment = 71,
- FirstReservedWord = 73,
- LastReservedWord = 108,
- FirstKeyword = 73,
- LastKeyword = 147,
- FirstFutureReservedWord = 109,
- LastFutureReservedWord = 117,
- FirstTypeNode = 163,
- LastTypeNode = 183,
+ /** Only the JSDoc scanner produces BacktickToken. The normal scanner produces NoSubstitutionTemplateLiteral and related kinds. */
+ BacktickToken = 59,
+ EqualsToken = 60,
+ PlusEqualsToken = 61,
+ MinusEqualsToken = 62,
+ AsteriskEqualsToken = 63,
+ AsteriskAsteriskEqualsToken = 64,
+ SlashEqualsToken = 65,
+ PercentEqualsToken = 66,
+ LessThanLessThanEqualsToken = 67,
+ GreaterThanGreaterThanEqualsToken = 68,
+ GreaterThanGreaterThanGreaterThanEqualsToken = 69,
+ AmpersandEqualsToken = 70,
+ BarEqualsToken = 71,
+ CaretEqualsToken = 72,
+ Identifier = 73,
+ BreakKeyword = 74,
+ CaseKeyword = 75,
+ CatchKeyword = 76,
+ ClassKeyword = 77,
+ ConstKeyword = 78,
+ ContinueKeyword = 79,
+ DebuggerKeyword = 80,
+ DefaultKeyword = 81,
+ DeleteKeyword = 82,
+ DoKeyword = 83,
+ ElseKeyword = 84,
+ EnumKeyword = 85,
+ ExportKeyword = 86,
+ ExtendsKeyword = 87,
+ FalseKeyword = 88,
+ FinallyKeyword = 89,
+ ForKeyword = 90,
+ FunctionKeyword = 91,
+ IfKeyword = 92,
+ ImportKeyword = 93,
+ InKeyword = 94,
+ InstanceOfKeyword = 95,
+ NewKeyword = 96,
+ NullKeyword = 97,
+ ReturnKeyword = 98,
+ SuperKeyword = 99,
+ SwitchKeyword = 100,
+ ThisKeyword = 101,
+ ThrowKeyword = 102,
+ TrueKeyword = 103,
+ TryKeyword = 104,
+ TypeOfKeyword = 105,
+ VarKeyword = 106,
+ VoidKeyword = 107,
+ WhileKeyword = 108,
+ WithKeyword = 109,
+ ImplementsKeyword = 110,
+ InterfaceKeyword = 111,
+ LetKeyword = 112,
+ PackageKeyword = 113,
+ PrivateKeyword = 114,
+ ProtectedKeyword = 115,
+ PublicKeyword = 116,
+ StaticKeyword = 117,
+ YieldKeyword = 118,
+ AbstractKeyword = 119,
+ AsKeyword = 120,
+ AnyKeyword = 121,
+ AsyncKeyword = 122,
+ AwaitKeyword = 123,
+ BooleanKeyword = 124,
+ ConstructorKeyword = 125,
+ DeclareKeyword = 126,
+ GetKeyword = 127,
+ InferKeyword = 128,
+ IsKeyword = 129,
+ KeyOfKeyword = 130,
+ ModuleKeyword = 131,
+ NamespaceKeyword = 132,
+ NeverKeyword = 133,
+ ReadonlyKeyword = 134,
+ RequireKeyword = 135,
+ NumberKeyword = 136,
+ ObjectKeyword = 137,
+ SetKeyword = 138,
+ StringKeyword = 139,
+ SymbolKeyword = 140,
+ TypeKeyword = 141,
+ UndefinedKeyword = 142,
+ UniqueKeyword = 143,
+ UnknownKeyword = 144,
+ FromKeyword = 145,
+ GlobalKeyword = 146,
+ BigIntKeyword = 147,
+ OfKeyword = 148,
+ QualifiedName = 149,
+ ComputedPropertyName = 150,
+ TypeParameter = 151,
+ Parameter = 152,
+ Decorator = 153,
+ PropertySignature = 154,
+ PropertyDeclaration = 155,
+ MethodSignature = 156,
+ MethodDeclaration = 157,
+ Constructor = 158,
+ GetAccessor = 159,
+ SetAccessor = 160,
+ CallSignature = 161,
+ ConstructSignature = 162,
+ IndexSignature = 163,
+ TypePredicate = 164,
+ TypeReference = 165,
+ FunctionType = 166,
+ ConstructorType = 167,
+ TypeQuery = 168,
+ TypeLiteral = 169,
+ ArrayType = 170,
+ TupleType = 171,
+ OptionalType = 172,
+ RestType = 173,
+ UnionType = 174,
+ IntersectionType = 175,
+ ConditionalType = 176,
+ InferType = 177,
+ ParenthesizedType = 178,
+ ThisType = 179,
+ TypeOperator = 180,
+ IndexedAccessType = 181,
+ MappedType = 182,
+ LiteralType = 183,
+ ImportType = 184,
+ ObjectBindingPattern = 185,
+ ArrayBindingPattern = 186,
+ BindingElement = 187,
+ ArrayLiteralExpression = 188,
+ ObjectLiteralExpression = 189,
+ PropertyAccessExpression = 190,
+ ElementAccessExpression = 191,
+ CallExpression = 192,
+ NewExpression = 193,
+ TaggedTemplateExpression = 194,
+ TypeAssertionExpression = 195,
+ ParenthesizedExpression = 196,
+ FunctionExpression = 197,
+ ArrowFunction = 198,
+ DeleteExpression = 199,
+ TypeOfExpression = 200,
+ VoidExpression = 201,
+ AwaitExpression = 202,
+ PrefixUnaryExpression = 203,
+ PostfixUnaryExpression = 204,
+ BinaryExpression = 205,
+ ConditionalExpression = 206,
+ TemplateExpression = 207,
+ YieldExpression = 208,
+ SpreadElement = 209,
+ ClassExpression = 210,
+ OmittedExpression = 211,
+ ExpressionWithTypeArguments = 212,
+ AsExpression = 213,
+ NonNullExpression = 214,
+ MetaProperty = 215,
+ SyntheticExpression = 216,
+ TemplateSpan = 217,
+ SemicolonClassElement = 218,
+ Block = 219,
+ VariableStatement = 220,
+ EmptyStatement = 221,
+ ExpressionStatement = 222,
+ IfStatement = 223,
+ DoStatement = 224,
+ WhileStatement = 225,
+ ForStatement = 226,
+ ForInStatement = 227,
+ ForOfStatement = 228,
+ ContinueStatement = 229,
+ BreakStatement = 230,
+ ReturnStatement = 231,
+ WithStatement = 232,
+ SwitchStatement = 233,
+ LabeledStatement = 234,
+ ThrowStatement = 235,
+ TryStatement = 236,
+ DebuggerStatement = 237,
+ VariableDeclaration = 238,
+ VariableDeclarationList = 239,
+ FunctionDeclaration = 240,
+ ClassDeclaration = 241,
+ InterfaceDeclaration = 242,
+ TypeAliasDeclaration = 243,
+ EnumDeclaration = 244,
+ ModuleDeclaration = 245,
+ ModuleBlock = 246,
+ CaseBlock = 247,
+ NamespaceExportDeclaration = 248,
+ ImportEqualsDeclaration = 249,
+ ImportDeclaration = 250,
+ ImportClause = 251,
+ NamespaceImport = 252,
+ NamedImports = 253,
+ ImportSpecifier = 254,
+ ExportAssignment = 255,
+ ExportDeclaration = 256,
+ NamedExports = 257,
+ ExportSpecifier = 258,
+ MissingDeclaration = 259,
+ ExternalModuleReference = 260,
+ JsxElement = 261,
+ JsxSelfClosingElement = 262,
+ JsxOpeningElement = 263,
+ JsxClosingElement = 264,
+ JsxFragment = 265,
+ JsxOpeningFragment = 266,
+ JsxClosingFragment = 267,
+ JsxAttribute = 268,
+ JsxAttributes = 269,
+ JsxSpreadAttribute = 270,
+ JsxExpression = 271,
+ CaseClause = 272,
+ DefaultClause = 273,
+ HeritageClause = 274,
+ CatchClause = 275,
+ PropertyAssignment = 276,
+ ShorthandPropertyAssignment = 277,
+ SpreadAssignment = 278,
+ EnumMember = 279,
+ UnparsedPrologue = 280,
+ UnparsedPrepend = 281,
+ UnparsedText = 282,
+ UnparsedInternalText = 283,
+ UnparsedSyntheticReference = 284,
+ SourceFile = 285,
+ Bundle = 286,
+ UnparsedSource = 287,
+ InputFiles = 288,
+ JSDocTypeExpression = 289,
+ JSDocAllType = 290,
+ JSDocUnknownType = 291,
+ JSDocNullableType = 292,
+ JSDocNonNullableType = 293,
+ JSDocOptionalType = 294,
+ JSDocFunctionType = 295,
+ JSDocVariadicType = 296,
+ JSDocComment = 297,
+ JSDocTypeLiteral = 298,
+ JSDocSignature = 299,
+ JSDocTag = 300,
+ JSDocAugmentsTag = 301,
+ JSDocClassTag = 302,
+ JSDocCallbackTag = 303,
+ JSDocEnumTag = 304,
+ JSDocParameterTag = 305,
+ JSDocReturnTag = 306,
+ JSDocThisTag = 307,
+ JSDocTypeTag = 308,
+ JSDocTemplateTag = 309,
+ JSDocTypedefTag = 310,
+ JSDocPropertyTag = 311,
+ SyntaxList = 312,
+ NotEmittedStatement = 313,
+ PartiallyEmittedExpression = 314,
+ CommaListExpression = 315,
+ MergeDeclarationMarker = 316,
+ EndOfDeclarationMarker = 317,
+ Count = 318,
+ FirstAssignment = 60,
+ LastAssignment = 72,
+ FirstCompoundAssignment = 61,
+ LastCompoundAssignment = 72,
+ FirstReservedWord = 74,
+ LastReservedWord = 109,
+ FirstKeyword = 74,
+ LastKeyword = 148,
+ FirstFutureReservedWord = 110,
+ LastFutureReservedWord = 118,
+ FirstTypeNode = 164,
+ LastTypeNode = 184,
FirstPunctuation = 18,
- LastPunctuation = 71,
+ LastPunctuation = 72,
FirstToken = 0,
- LastToken = 147,
+ LastToken = 148,
FirstTriviaToken = 2,
LastTriviaToken = 7,
FirstLiteralToken = 8,
@@ -417,12 +419,12 @@
FirstTemplateToken = 14,
LastTemplateToken = 17,
FirstBinaryOperator = 28,
- LastBinaryOperator = 71,
- FirstNode = 148,
- FirstJSDocNode = 288,
- LastJSDocNode = 310,
- FirstJSDocTagNode = 299,
- LastJSDocTagNode = 310,
+ LastBinaryOperator = 72,
+ FirstNode = 149,
+ FirstJSDocNode = 289,
+ LastJSDocNode = 311,
+ FirstJSDocTagNode = 300,
+ LastJSDocTagNode = 311,
}
enum NodeFlags {
None = 0,
@@ -626,7 +628,7 @@
initializer?: Expression;
}
interface ObjectLiteralElement extends NamedDeclaration {
- _objectLiteralBrandBrand: any;
+ _objectLiteralBrand: any;
name?: PropertyName;
}
/** Unlike ObjectLiteralElement, excludes JSXAttribute and JSXSpreadAttribute. */
@@ -1601,7 +1603,7 @@
}
interface JSDocTypeTag extends JSDocTag {
kind: SyntaxKind.JSDocTypeTag;
- typeExpression?: JSDocTypeExpression;
+ typeExpression: JSDocTypeExpression;
}
interface JSDocTypedefTag extends JSDocTag, NamedDeclaration {
parent: JSDoc;
@@ -1877,13 +1879,18 @@
sourceFile: SourceFile;
references?: ReadonlyArray<ResolvedProjectReference | undefined>;
}
+ type CustomTransformerFactory = (context: TransformationContext) => CustomTransformer;
+ interface CustomTransformer {
+ transformSourceFile(node: SourceFile): SourceFile;
+ transformBundle(node: Bundle): Bundle;
+ }
interface CustomTransformers {
/** Custom transformers to evaluate before built-in .js transformations. */
- before?: TransformerFactory<SourceFile>[];
+ before?: (TransformerFactory<SourceFile> | CustomTransformerFactory)[];
/** Custom transformers to evaluate after built-in .js transformations. */
- after?: TransformerFactory<SourceFile>[];
+ after?: (TransformerFactory<SourceFile> | CustomTransformerFactory)[];
/** Custom transformers to evaluate after built-in .d.ts transformations. */
- afterDeclarations?: TransformerFactory<Bundle | SourceFile>[];
+ afterDeclarations?: (TransformerFactory<Bundle | SourceFile> | CustomTransformerFactory)[];
}
interface SourceMapSpan {
/** Line number in the .js file. */
@@ -1962,6 +1969,7 @@
*/
getExportSymbolOfSymbol(symbol: Symbol): Symbol;
getPropertySymbolOfDestructuringAssignment(location: Identifier): Symbol | undefined;
+ getTypeOfAssignmentPattern(pattern: AssignmentPattern): Type;
getTypeAtLocation(node: Node): Type;
getTypeFromTypeNode(node: TypeNode): Type;
signatureToString(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): string;
@@ -2359,7 +2367,8 @@
objectType: Type;
indexType: Type;
constraint?: Type;
- simplified?: Type;
+ simplifiedForReading?: Type;
+ simplifiedForWriting?: Type;
}
type TypeVariable = TypeParameter | IndexedAccessType;
interface IndexType extends InstantiableType {
@@ -2382,8 +2391,8 @@
root: ConditionalRoot;
checkType: Type;
extendsType: Type;
- trueType: Type;
- falseType: Type;
+ resolvedTrueType: Type;
+ resolvedFalseType: Type;
}
interface SubstitutionType extends InstantiableType {
typeVariable: TypeVariable;
@@ -2410,12 +2419,13 @@
enum InferencePriority {
NakedTypeVariable = 1,
HomomorphicMappedType = 2,
- MappedTypeConstraint = 4,
- ReturnType = 8,
- LiteralKeyof = 16,
- NoConstraints = 32,
- AlwaysStrict = 64,
- PriorityImpliesCombination = 28
+ PartialHomomorphicMappedType = 4,
+ MappedTypeConstraint = 8,
+ ReturnType = 16,
+ LiteralKeyof = 32,
+ NoConstraints = 64,
+ AlwaysStrict = 128,
+ PriorityImpliesCombination = 56
}
/** @deprecated Use FileExtensionInfo instead. */
type JsFileExtensionInfo = FileExtensionInfo;
@@ -2489,6 +2499,7 @@
interface CompilerOptions {
allowJs?: boolean;
allowSyntheticDefaultImports?: boolean;
+ allowUmdGlobalAccess?: boolean;
allowUnreachableCode?: boolean;
allowUnusedLabels?: boolean;
alwaysStrict?: boolean;
@@ -2621,9 +2632,10 @@
ES2017 = 4,
ES2018 = 5,
ES2019 = 6,
- ESNext = 7,
+ ES2020 = 7,
+ ESNext = 8,
JSON = 100,
- Latest = 7
+ Latest = 8
}
enum LanguageVariant {
Standard = 0,
@@ -2756,6 +2768,7 @@
resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string, redirectedReference?: ResolvedProjectReference): (ResolvedTypeReferenceDirective | undefined)[];
getEnvironmentVariable?(name: string): string | undefined;
createHash?(data: string): string;
+ getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined;
}
interface SourceMapRange extends TextRange {
source?: SourceMapSource;
@@ -3159,7 +3172,7 @@
reScanJsxToken(): JsxTokenSyntaxKind;
reScanLessThanToken(): SyntaxKind;
scanJsxToken(): JsxTokenSyntaxKind;
- scanJSDocToken(): JsDocSyntaxKind;
+ scanJsDocToken(): JSDocSyntaxKind;
scan(): SyntaxKind;
getText(): string;
setText(text: string | undefined, start?: number, length?: number): void;
@@ -3627,7 +3640,7 @@
/**
* Reads the config file, reports errors if any and exits if the config file cannot be found
*/
- function getParsedCommandLineOfConfigFile(configFileName: string, optionsToExtend: CompilerOptions, host: ParseConfigFileHost): ParsedCommandLine | undefined;
+ function getParsedCommandLineOfConfigFile(configFileName: string, optionsToExtend: CompilerOptions, host: ParseConfigFileHost, extendedConfigCache?: Map<ExtendedConfigCacheEntry>): ParsedCommandLine | undefined;
/**
* Read tsconfig.json file
* @param fileName The path to the config file
@@ -3661,7 +3674,7 @@
* @param basePath A root directory to resolve relative path entries in the config
* file to. e.g. outDir
*/
- function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: ReadonlyArray<FileExtensionInfo>): ParsedCommandLine;
+ function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: ReadonlyArray<FileExtensionInfo>, extendedConfigCache?: Map<ExtendedConfigCacheEntry>): ParsedCommandLine;
/**
* Parse the contents of a config file (tsconfig.json).
* @param jsonNode The contents of the config file to parse
@@ -3669,7 +3682,20 @@
* @param basePath A root directory to resolve relative path entries in the config
* file to. e.g. outDir
*/
- function parseJsonSourceFileConfigFileContent(sourceFile: TsConfigSourceFile, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: ReadonlyArray<FileExtensionInfo>): ParsedCommandLine;
+ function parseJsonSourceFileConfigFileContent(sourceFile: TsConfigSourceFile, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: ReadonlyArray<FileExtensionInfo>, extendedConfigCache?: Map<ExtendedConfigCacheEntry>): ParsedCommandLine;
+ interface ParsedTsconfig {
+ raw: any;
+ options?: CompilerOptions;
+ typeAcquisition?: TypeAcquisition;
+ /**
+ * Note that the case of the config path has not yet been normalized, as no files have been imported into the project yet
+ */
+ extendedConfigPath?: string;
+ }
+ interface ExtendedConfigCacheEntry {
+ extendedResult: TsConfigSourceFile;
+ extendedConfig: ParsedTsconfig | undefined;
+ }
function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): {
options: CompilerOptions;
errors: Diagnostic[];
@@ -3714,7 +3740,7 @@
get(directory: string): ResolvedModuleWithFailedLookupLocations | undefined;
set(directory: string, result: ResolvedModuleWithFailedLookupLocations): void;
}
- function createModuleResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string): ModuleResolutionCache;
+ function createModuleResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string, options?: CompilerOptions): ModuleResolutionCache;
function resolveModuleNameFromCache(moduleName: string, containingFile: string, cache: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations | undefined;
function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations;
function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations;
@@ -3837,7 +3863,7 @@
function updateArrayLiteral(node: ArrayLiteralExpression, elements: ReadonlyArray<Expression>): ArrayLiteralExpression;
function createObjectLiteral(properties?: ReadonlyArray<ObjectLiteralElementLike>, multiLine?: boolean): ObjectLiteralExpression;
function updateObjectLiteral(node: ObjectLiteralExpression, properties: ReadonlyArray<ObjectLiteralElementLike>): ObjectLiteralExpression;
- function createPropertyAccess(expression: Expression, name: string | Identifier | undefined): PropertyAccessExpression;
+ function createPropertyAccess(expression: Expression, name: string | Identifier): PropertyAccessExpression;
function updatePropertyAccess(node: PropertyAccessExpression, expression: Expression, name: Identifier): PropertyAccessExpression;
function createElementAccess(expression: Expression, index: number | Expression): ElementAccessExpression;
function updateElementAccess(node: ElementAccessExpression, expression: Expression, argumentExpression: Expression): ElementAccessExpression;
@@ -4052,7 +4078,7 @@
function createInputFiles(javascriptText: string, declarationText: string): InputFiles;
function createInputFiles(readFileText: (path: string) => string | undefined, javascriptPath: string, javascriptMapPath: string | undefined, declarationPath: string, declarationMapPath: string | undefined, buildInfoPath: string | undefined): InputFiles;
function createInputFiles(javascriptText: string, declarationText: string, javascriptMapPath: string | undefined, javascriptMapText: string | undefined, declarationMapPath: string | undefined, declarationMapText: string | undefined): InputFiles;
- function updateBundle(node: Bundle, sourceFiles: ReadonlyArray<SourceFile>, prepends?: ReadonlyArray<UnparsedSource>): Bundle;
+ function updateBundle(node: Bundle, sourceFiles: ReadonlyArray<SourceFile>, prepends?: ReadonlyArray<UnparsedSource | InputFiles>): Bundle;
function createImmediatelyInvokedFunctionExpression(statements: ReadonlyArray<Statement>): CallExpression;
function createImmediatelyInvokedFunctionExpression(statements: ReadonlyArray<Statement>, param: ParameterDeclaration, paramValue: Expression): CallExpression;
function createImmediatelyInvokedArrowFunction(statements: ReadonlyArray<Statement>): CallExpression;
@@ -4540,13 +4566,12 @@
type ActionSet = "action::set";
type ActionInvalidate = "action::invalidate";
type ActionPackageInstalled = "action::packageInstalled";
- type ActionValueInspected = "action::valueInspected";
type EventTypesRegistry = "event::typesRegistry";
type EventBeginInstallTypes = "event::beginInstallTypes";
type EventEndInstallTypes = "event::endInstallTypes";
type EventInitializationFailed = "event::initializationFailed";
interface TypingInstallerResponse {
- readonly kind: ActionSet | ActionInvalidate | EventTypesRegistry | ActionPackageInstalled | ActionValueInspected | EventBeginInstallTypes | EventEndInstallTypes | EventInitializationFailed;
+ readonly kind: ActionSet | ActionInvalidate | EventTypesRegistry | ActionPackageInstalled | EventBeginInstallTypes | EventEndInstallTypes | EventInitializationFailed;
}
interface TypingInstallerRequestWithProjectName {
readonly projectName: string;
@@ -4785,6 +4810,7 @@
getSignatureHelpItems(fileName: string, position: number, options: SignatureHelpItemsOptions | undefined): SignatureHelpItems | undefined;
getRenameInfo(fileName: string, position: number, options?: RenameInfoOptions): RenameInfo;
findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean, providePrefixAndSuffixTextForRename?: boolean): ReadonlyArray<RenameLocation> | undefined;
+ getSmartSelectionRange(fileName: string, position: number): SelectionRange;
getDefinitionAtPosition(fileName: string, position: number): ReadonlyArray<DefinitionInfo> | undefined;
getDefinitionAndBoundSpan(fileName: string, position: number): DefinitionInfoAndBoundSpan | undefined;
getTypeDefinitionAtPosition(fileName: string, position: number): ReadonlyArray<DefinitionInfo> | undefined;
@@ -4979,16 +5005,9 @@
changes: ReadonlyArray<FileTextChanges>;
commands?: ReadonlyArray<CodeActionCommand>;
}
- type CodeActionCommand = InstallPackageAction | GenerateTypesAction;
+ type CodeActionCommand = InstallPackageAction;
interface InstallPackageAction {
}
- interface GenerateTypesAction extends GenerateTypesOptions {
- }
- interface GenerateTypesOptions {
- readonly file: string;
- readonly fileToGenerateTypesFor: string;
- readonly outputFileName: string;
- }
/**
* A set of one or more available refactoring actions, grouped under a parent refactoring.
*/
@@ -5236,6 +5255,10 @@
displayParts: SymbolDisplayPart[];
isOptional: boolean;
}
+ interface SelectionRange {
+ textSpan: TextSpan;
+ parent?: SelectionRange;
+ }
/**
* Represents a single signature to show in signature help.
* The id is used for subsequent calls into the language service to ask questions about the
@@ -5613,10 +5636,6 @@
function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[], moduleName?: string): string;
}
declare namespace ts {
- function generateTypesForModule(name: string, moduleValue: unknown, formatSettings: FormatCodeSettings): string;
- function generateTypesForGlobal(name: string, globalValue: unknown, formatSettings: FormatCodeSettings): string;
-}
-declare namespace ts {
/** The version of the language service API */
const servicesVersion = "0.8";
function toEditorSettings(options: EditorOptions | EditorSettings): EditorSettings;

lib/typescript.js

@@ -73,9 +73,9 @@
(function (ts) {
// WARNING: The script `configureNightly.ts` uses a regexp to parse out these values.
// If changing the text in this section, be sure to test `configureNightly` too.
- ts.versionMajorMinor = "3.4";
+ ts.versionMajorMinor = "3.5";
/** The version of the TypeScript compiler release */
- ts.version = ts.versionMajorMinor + ".5";
+ ts.version = ts.versionMajorMinor + ".1";
})(ts || (ts = {}));
(function (ts) {
/* @internal */
@@ -205,7 +205,7 @@
entry.nextEntry.previousEntry = previousEntry;
}
// When the deleted entry was the last one, we need to
- // adust the lastEntry reference.
+ // adjust the lastEntry reference.
if (this.lastEntry === entry) {
this.lastEntry = previousEntry;
}
@@ -315,7 +315,7 @@
ts.firstDefinedIterator = firstDefinedIterator;
function zipWith(arrayA, arrayB, callback) {
var result = [];
- Debug.assertEqual(arrayA.length, arrayB.length);
+ ts.Debug.assertEqual(arrayA.length, arrayB.length);
for (var i = 0; i < arrayA.length; i++) {
result.push(callback(arrayA[i], arrayB[i], i));
}
@@ -323,7 +323,7 @@
}
ts.zipWith = zipWith;
function zipToIterator(arrayA, arrayB) {
- Debug.assertEqual(arrayA.length, arrayB.length);
+ ts.Debug.assertEqual(arrayA.length, arrayB.length);
var i = 0;
return {
next: function () {
@@ -337,7 +337,7 @@
}
ts.zipToIterator = zipToIterator;
function zipToMap(keys, values) {
- Debug.assert(keys.length === values.length);
+ ts.Debug.assert(keys.length === values.length);
var map = createMap();
for (var i = 0; i < keys.length; ++i) {
map.set(keys[i], values[i]);
@@ -411,7 +411,7 @@
return result;
}
}
- return Debug.fail();
+ return ts.Debug.fail();
}
ts.findMap = findMap;
function contains(array, value, equalityComparer) {
@@ -841,7 +841,7 @@
continue;
case -1 /* LessThan */:
// If `array` is sorted, `next` should **never** be less than `last`.
- return Debug.fail("Array is unsorted.");
+ return ts.Debug.fail("Array is unsorted.");
}
deduplicated.push(last = next);
}
@@ -908,13 +908,13 @@
loopB: for (var offsetA = 0, offsetB = 0; offsetB < arrayB.length; offsetB++) {
if (offsetB > 0) {
// Ensure `arrayB` is properly sorted.
- Debug.assertGreaterThanOrEqual(comparer(arrayB[offsetB], arrayB[offsetB - 1]), 0 /* EqualTo */);
+ ts.Debug.assertGreaterThanOrEqual(comparer(arrayB[offsetB], arrayB[offsetB - 1]), 0 /* EqualTo */);
}
loopA: for (var startA = offsetA; offsetA < arrayA.length; offsetA++) {
if (offsetA > startA) {
// Ensure `arrayA` is properly sorted. We only need to perform this check if
// `offsetA` has changed since we entered the loop.
- Debug.assertGreaterThanOrEqual(comparer(arrayA[offsetA], arrayA[offsetA - 1]), 0 /* EqualTo */);
+ ts.Debug.assertGreaterThanOrEqual(comparer(arrayA[offsetA], arrayA[offsetA - 1]), 0 /* EqualTo */);
}
switch (comparer(arrayB[offsetB], arrayA[offsetA])) {
case -1 /* LessThan */:
@@ -1084,7 +1084,7 @@
}
ts.firstOrUndefined = firstOrUndefined;
function first(array) {
- Debug.assert(array.length !== 0);
+ ts.Debug.assert(array.length !== 0);
return array[0];
}
ts.first = first;
@@ -1096,7 +1096,7 @@
}
ts.lastOrUndefined = lastOrUndefined;
function last(array) {
- Debug.assert(array.length !== 0);
+ ts.Debug.assert(array.length !== 0);
return array[array.length - 1];
}
ts.last = last;
@@ -1421,7 +1421,7 @@
function cast(value, test) {
if (value !== undefined && test(value))
return value;
- return Debug.fail("Invalid cast. The supplied value " + value + " did not pass the test '" + Debug.getFunctionName(test) + "'.");
+ return ts.Debug.fail("Invalid cast. The supplied value " + value + " did not pass the test '" + ts.Debug.getFunctionName(test) + "'.");
}
ts.cast = cast;
/** Does nothing. */
@@ -1458,38 +1458,13 @@
};
}
ts.memoize = memoize;
- function chain(a, b, c, d, e) {
+ function compose(a, b, c, d, e) {
if (e) {
var args_2 = [];
for (var i = 0; i < arguments.length; i++) {
args_2[i] = arguments[i];
}
- return function (t) { return compose.apply(void 0, map(args_2, function (f) { return f(t); })); };
- }
- else if (d) {
- return function (t) { return compose(a(t), b(t), c(t), d(t)); };
- }
- else if (c) {
- return function (t) { return compose(a(t), b(t), c(t)); };
- }
- else if (b) {
- return function (t) { return compose(a(t), b(t)); };
- }
- else if (a) {
- return function (t) { return compose(a(t)); };
- }
- else {
- return function (_) { return function (u) { return u; }; };
- }
- }
- ts.chain = chain;
- function compose(a, b, c, d, e) {
- if (e) {
- var args_3 = [];
- for (var i = 0; i < arguments.length; i++) {
- args_3[i] = arguments[i];
- }
- return function (t) { return reduceLeft(args_3, function (u, f) { return f(u); }, t); };
+ return function (t) { return reduceLeft(args_2, function (u, f) { return f(u); }, t); };
}
else if (d) {
return function (t) { return d(c(b(a(t)))); };
@@ -1515,92 +1490,6 @@
AssertionLevel[AssertionLevel["Aggressive"] = 2] = "Aggressive";
AssertionLevel[AssertionLevel["VeryAggressive"] = 3] = "VeryAggressive";
})(AssertionLevel = ts.AssertionLevel || (ts.AssertionLevel = {}));
- var Debug;
- (function (Debug) {
- Debug.currentAssertionLevel = 0 /* None */;
- Debug.isDebugging = false;
- function shouldAssert(level) {
- return Debug.currentAssertionLevel >= level;
- }
- Debug.shouldAssert = shouldAssert;
- function assert(expression, message, verboseDebugInfo, stackCrawlMark) {
- if (!expression) {
- if (verboseDebugInfo) {
- message += "\r\nVerbose Debug Information: " + (typeof verboseDebugInfo === "string" ? verboseDebugInfo : verboseDebugInfo());
- }
- fail(message ? "False expression: " + message : "False expression.", stackCrawlMark || assert);
- }
- }
- Debug.assert = assert;
- function assertEqual(a, b, msg, msg2) {
- if (a !== b) {
- var message = msg ? msg2 ? msg + " " + msg2 : msg : "";
- fail("Expected " + a + " === " + b + ". " + message);
- }
- }
- Debug.assertEqual = assertEqual;
- function assertLessThan(a, b, msg) {
- if (a >= b) {
- fail("Expected " + a + " < " + b + ". " + (msg || ""));
- }
- }
- Debug.assertLessThan = assertLessThan;
- function assertLessThanOrEqual(a, b) {
- if (a > b) {
- fail("Expected " + a + " <= " + b);
- }
- }
- Debug.assertLessThanOrEqual = assertLessThanOrEqual;
- function assertGreaterThanOrEqual(a, b) {
- if (a < b) {
- fail("Expected " + a + " >= " + b);
- }
- }
- Debug.assertGreaterThanOrEqual = assertGreaterThanOrEqual;
- function fail(message, stackCrawlMark) {
- debugger;
- var e = new Error(message ? "Debug Failure. " + message : "Debug Failure.");
- if (Error.captureStackTrace) {
- Error.captureStackTrace(e, stackCrawlMark || fail);
- }
- throw e;
- }
- Debug.fail = fail;
- function assertDefined(value, message) {
- if (value === undefined || value === null)
- return fail(message);
- return value;
- }
- Debug.assertDefined = assertDefined;
- function assertEachDefined(value, message) {
- for (var _i = 0, value_1 = value; _i < value_1.length; _i++) {
- var v = value_1[_i];
- assertDefined(v, message);
- }
- return value;
- }
- Debug.assertEachDefined = assertEachDefined;
- function assertNever(member, message, stackCrawlMark) {
- if (message === void 0) { message = "Illegal value:"; }
- var detail = typeof member === "object" && "kind" in member && "pos" in member ? "SyntaxKind: " + Debug.showSyntaxKind(member) : JSON.stringify(member);
- return fail(message + " " + detail, stackCrawlMark || assertNever);
- }
- Debug.assertNever = assertNever;
- function getFunctionName(func) {
- if (typeof func !== "function") {
- return "";
- }
- else if (func.hasOwnProperty("name")) {
- return func.name;
- }
- else {
- var text = Function.prototype.toString.call(func);
- var match = /^function\s+([\w\$]+)\s*\(/.exec(text);
- return match ? match[1] : "";
- }
- }
- Debug.getFunctionName = getFunctionName;
- })(Debug = ts.Debug || (ts.Debug = {}));
function equateValues(a, b) {
return a === b;
}
@@ -1857,7 +1746,7 @@
bestCandidate = candidate;
}
else {
- Debug.assert(distance < bestDistance); // Else `levenshteinWithMax` should return undefined
+ ts.Debug.assert(distance < bestDistance); // Else `levenshteinWithMax` should return undefined
bestDistance = distance;
bestCandidate = candidate;
}
@@ -2001,7 +1890,7 @@
* E.g.: matchedText(tryParsePattern("foo*baz"), "foobarbaz") === "bar"
*/
function matchedText(pattern, candidate) {
- Debug.assert(isPatternMatch(pattern, candidate));
+ ts.Debug.assert(isPatternMatch(pattern, candidate));
return candidate.substring(pattern.prefix.length, candidate.length - pattern.suffix.length);
}
ts.matchedText = matchedText;
@@ -2094,6 +1983,267 @@
return result;
}
ts.fill = fill;
+ function cartesianProduct(arrays) {
+ var result = [];
+ cartesianProductWorker(arrays, result, /*outer*/ undefined, 0);
+ return result;
+ }
+ ts.cartesianProduct = cartesianProduct;
+ function cartesianProductWorker(arrays, result, outer, index) {
+ for (var _i = 0, _a = arrays[index]; _i < _a.length; _i++) {
+ var element = _a[_i];
+ var inner = void 0;
+ if (outer) {
+ inner = outer.slice();
+ inner.push(element);
+ }
+ else {
+ inner = [element];
+ }
+ if (index === arrays.length - 1) {
+ result.push(inner);
+ }
+ else {
+ cartesianProductWorker(arrays, result, inner, index + 1);
+ }
+ }
+ }
+})(ts || (ts = {}));
+/* @internal */
+var ts;
+(function (ts) {
+ var Debug;
+ (function (Debug) {
+ Debug.currentAssertionLevel = 0 /* None */;
+ Debug.isDebugging = false;
+ function shouldAssert(level) {
+ return Debug.currentAssertionLevel >= level;
+ }
+ Debug.shouldAssert = shouldAssert;
+ function assert(expression, message, verboseDebugInfo, stackCrawlMark) {
+ if (!expression) {
+ if (verboseDebugInfo) {
+ message += "\r\nVerbose Debug Information: " + (typeof verboseDebugInfo === "string" ? verboseDebugInfo : verboseDebugInfo());
+ }
+ fail(message ? "False expression: " + message : "False expression.", stackCrawlMark || assert);
+ }
+ }
+ Debug.assert = assert;
+ function assertEqual(a, b, msg, msg2) {
+ if (a !== b) {
+ var message = msg ? msg2 ? msg + " " + msg2 : msg : "";
+ fail("Expected " + a + " === " + b + ". " + message);
+ }
+ }
+ Debug.assertEqual = assertEqual;
+ function assertLessThan(a, b, msg) {
+ if (a >= b) {
+ fail("Expected " + a + " < " + b + ". " + (msg || ""));
+ }
+ }
+ Debug.assertLessThan = assertLessThan;
+ function assertLessThanOrEqual(a, b) {
+ if (a > b) {
+ fail("Expected " + a + " <= " + b);
+ }
+ }
+ Debug.assertLessThanOrEqual = assertLessThanOrEqual;
+ function assertGreaterThanOrEqual(a, b) {
+ if (a < b) {
+ fail("Expected " + a + " >= " + b);
+ }
+ }
+ Debug.assertGreaterThanOrEqual = assertGreaterThanOrEqual;
+ function fail(message, stackCrawlMark) {
+ debugger;
+ var e = new Error(message ? "Debug Failure. " + message : "Debug Failure.");
+ if (Error.captureStackTrace) {
+ Error.captureStackTrace(e, stackCrawlMark || fail);
+ }
+ throw e;
+ }
+ Debug.fail = fail;
+ function assertDefined(value, message) {
+ if (value === undefined || value === null)
+ return fail(message);
+ return value;
+ }
+ Debug.assertDefined = assertDefined;
+ function assertEachDefined(value, message) {
+ for (var _i = 0, value_1 = value; _i < value_1.length; _i++) {
+ var v = value_1[_i];
+ assertDefined(v, message);
+ }
+ return value;
+ }
+ Debug.assertEachDefined = assertEachDefined;
+ function assertNever(member, message, stackCrawlMark) {
+ if (message === void 0) { message = "Illegal value:"; }
+ var detail = typeof member === "object" && "kind" in member && "pos" in member && formatSyntaxKind ? "SyntaxKind: " + formatSyntaxKind(member.kind) : JSON.stringify(member);
+ return fail(message + " " + detail, stackCrawlMark || assertNever);
+ }
+ Debug.assertNever = assertNever;
+ function getFunctionName(func) {
+ if (typeof func !== "function") {
+ return "";
+ }
+ else if (func.hasOwnProperty("name")) {
+ return func.name;
+ }
+ else {
+ var text = Function.prototype.toString.call(func);
+ var match = /^function\s+([\w\$]+)\s*\(/.exec(text);
+ return match ? match[1] : "";
+ }
+ }
+ Debug.getFunctionName = getFunctionName;
+ function formatSymbol(symbol) {
+ return "{ name: " + ts.unescapeLeadingUnderscores(symbol.escapedName) + "; flags: " + formatSymbolFlags(symbol.flags) + "; declarations: " + ts.map(symbol.declarations, function (node) { return formatSyntaxKind(node.kind); }) + " }";
+ }
+ Debug.formatSymbol = formatSymbol;
+ /**
+ * Formats an enum value as a string for debugging and debug assertions.
+ */
+ function formatEnum(value, enumObject, isFlags) {
+ if (value === void 0) { value = 0; }
+ var members = getEnumMembers(enumObject);
+ if (value === 0) {
+ return members.length > 0 && members[0][0] === 0 ? members[0][1] : "0";
+ }
+ if (isFlags) {
+ var result = "";
+ var remainingFlags = value;
+ for (var i = members.length - 1; i >= 0 && remainingFlags !== 0; i--) {
+ var _a = members[i], enumValue = _a[0], enumName = _a[1];
+ if (enumValue !== 0 && (remainingFlags & enumValue) === enumValue) {
+ remainingFlags &= ~enumValue;
+ result = "" + enumName + (result ? "|" : "") + result;
+ }
+ }
+ if (remainingFlags === 0) {
+ return result;
+ }
+ }
+ else {
+ for (var _i = 0, members_1 = members; _i < members_1.length; _i++) {
+ var _b = members_1[_i], enumValue = _b[0], enumName = _b[1];
+ if (enumValue === value) {
+ return enumName;
+ }
+ }
+ }
+ return value.toString();
+ }
+ Debug.formatEnum = formatEnum;
+ function getEnumMembers(enumObject) {
+ var result = [];
+ for (var name in enumObject) {
+ var value = enumObject[name];
+ if (typeof value === "number") {
+ result.push([value, name]);
+ }
+ }
+ return ts.stableSort(result, function (x, y) { return ts.compareValues(x[0], y[0]); });
+ }
+ function formatSyntaxKind(kind) {
+ return formatEnum(kind, ts.SyntaxKind, /*isFlags*/ false);
+ }
+ Debug.formatSyntaxKind = formatSyntaxKind;
+ function formatNodeFlags(flags) {
+ return formatEnum(flags, ts.NodeFlags, /*isFlags*/ true);
+ }
+ Debug.formatNodeFlags = formatNodeFlags;
+ function formatModifierFlags(flags) {
+ return formatEnum(flags, ts.ModifierFlags, /*isFlags*/ true);
+ }
+ Debug.formatModifierFlags = formatModifierFlags;
+ function formatTransformFlags(flags) {
+ return formatEnum(flags, ts.TransformFlags, /*isFlags*/ true);
+ }
+ Debug.formatTransformFlags = formatTransformFlags;
+ function formatEmitFlags(flags) {
+ return formatEnum(flags, ts.EmitFlags, /*isFlags*/ true);
+ }
+ Debug.formatEmitFlags = formatEmitFlags;
+ function formatSymbolFlags(flags) {
+ return formatEnum(flags, ts.SymbolFlags, /*isFlags*/ true);
+ }
+ Debug.formatSymbolFlags = formatSymbolFlags;
+ function formatTypeFlags(flags) {
+ return formatEnum(flags, ts.TypeFlags, /*isFlags*/ true);
+ }
+ Debug.formatTypeFlags = formatTypeFlags;
+ function formatObjectFlags(flags) {
+ return formatEnum(flags, ts.ObjectFlags, /*isFlags*/ true);
+ }
+ Debug.formatObjectFlags = formatObjectFlags;
+ function failBadSyntaxKind(node, message) {
+ return fail((message || "Unexpected node.") + "\r\nNode " + formatSyntaxKind(node.kind) + " was unexpected.", failBadSyntaxKind);
+ }
+ Debug.failBadSyntaxKind = failBadSyntaxKind;
+ Debug.assertEachNode = shouldAssert(1 /* Normal */)
+ ? function (nodes, test, message) { return assert(test === undefined || ts.every(nodes, test), message || "Unexpected node.", function () { return "Node array did not pass test '" + getFunctionName(test) + "'."; }, Debug.assertEachNode); }
+ : ts.noop;
+ Debug.assertNode = shouldAssert(1 /* Normal */)
+ ? function (node, test, message) { return assert(test === undefined || test(node), message || "Unexpected node.", function () { return "Node " + formatSyntaxKind(node.kind) + " did not pass test '" + getFunctionName(test) + "'."; }, Debug.assertNode); }
+ : ts.noop;
+ Debug.assertOptionalNode = shouldAssert(1 /* Normal */)
+ ? function (node, test, message) { return assert(test === undefined || node === undefined || test(node), message || "Unexpected node.", function () { return "Node " + formatSyntaxKind(node.kind) + " did not pass test '" + getFunctionName(test) + "'."; }, Debug.assertOptionalNode); }
+ : ts.noop;
+ Debug.assertOptionalToken = shouldAssert(1 /* Normal */)
+ ? function (node, kind, message) { return assert(kind === undefined || node === undefined || node.kind === kind, message || "Unexpected node.", function () { return "Node " + formatSyntaxKind(node.kind) + " was not a '" + formatSyntaxKind(kind) + "' token."; }, Debug.assertOptionalToken); }
+ : ts.noop;
+ Debug.assertMissingNode = shouldAssert(1 /* Normal */)
+ ? function (node, message) { return assert(node === undefined, message || "Unexpected node.", function () { return "Node " + formatSyntaxKind(node.kind) + " was unexpected'."; }, Debug.assertMissingNode); }
+ : ts.noop;
+ var isDebugInfoEnabled = false;
+ /**
+ * Injects debug information into frequently used types.
+ */
+ function enableDebugInfo() {
+ if (isDebugInfoEnabled)
+ return;
+ // Add additional properties in debug mode to assist with debugging.
+ Object.defineProperties(ts.objectAllocator.getSymbolConstructor().prototype, {
+ __debugFlags: { get: function () { return formatSymbolFlags(this.flags); } }
+ });
+ Object.defineProperties(ts.objectAllocator.getTypeConstructor().prototype, {
+ __debugFlags: { get: function () { return formatTypeFlags(this.flags); } },
+ __debugObjectFlags: { get: function () { return this.flags & 524288 /* Object */ ? formatObjectFlags(this.objectFlags) : ""; } },
+ __debugTypeToString: { value: function () { return this.checker.typeToString(this); } },
+ });
+ var nodeConstructors = [
+ ts.objectAllocator.getNodeConstructor(),
+ ts.objectAllocator.getIdentifierConstructor(),
+ ts.objectAllocator.getTokenConstructor(),
+ ts.objectAllocator.getSourceFileConstructor()
+ ];
+ for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) {
+ var ctor = nodeConstructors_1[_i];
+ if (!ctor.prototype.hasOwnProperty("__debugKind")) {
+ Object.defineProperties(ctor.prototype, {
+ __debugKind: { get: function () { return formatSyntaxKind(this.kind); } },
+ __debugNodeFlags: { get: function () { return formatNodeFlags(this.flags); } },
+ __debugModifierFlags: { get: function () { return formatModifierFlags(ts.getModifierFlagsNoCache(this)); } },
+ __debugTransformFlags: { get: function () { return formatTransformFlags(this.transformFlags); } },
+ __debugIsParseTreeNode: { get: function () { return ts.isParseTreeNode(this); } },
+ __debugEmitFlags: { get: function () { return formatEmitFlags(ts.getEmitFlags(this)); } },
+ __debugGetText: {
+ value: function (includeTrivia) {
+ if (ts.nodeIsSynthesized(this))
+ return "";
+ var parseNode = ts.getParseTreeNode(this);
+ var sourceFile = parseNode && ts.getSourceFileOfNode(parseNode);
+ return sourceFile ? ts.getSourceTextOfNodeFromSourceFile(sourceFile, parseNode, includeTrivia) : "";
+ }
+ }
+ });
+ }
+ }
+ isDebugInfoEnabled = true;
+ }
+ Debug.enableDebugInfo = enableDebugInfo;
+ })(Debug = ts.Debug || (ts.Debug = {}));
})(ts || (ts = {}));
/*@internal*/
var ts;
@@ -2646,309 +2796,311 @@
SyntaxKind[SyntaxKind["QuestionToken"] = 56] = "QuestionToken";
SyntaxKind[SyntaxKind["ColonToken"] = 57] = "ColonToken";
SyntaxKind[SyntaxKind["AtToken"] = 58] = "AtToken";
+ /** Only the JSDoc scanner produces BacktickToken. The normal scanner produces NoSubstitutionTemplateLiteral and related kinds. */
+ SyntaxKind[SyntaxKind["BacktickToken"] = 59] = "BacktickToken";
// Assignments
- SyntaxKind[SyntaxKind["EqualsToken"] = 59] = "EqualsToken";
- SyntaxKind[SyntaxKind["PlusEqualsToken"] = 60] = "PlusEqualsToken";
- SyntaxKind[SyntaxKind["MinusEqualsToken"] = 61] = "MinusEqualsToken";
- SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 62] = "AsteriskEqualsToken";
- SyntaxKind[SyntaxKind["AsteriskAsteriskEqualsToken"] = 63] = "AsteriskAsteriskEqualsToken";
- SyntaxKind[SyntaxKind["SlashEqualsToken"] = 64] = "SlashEqualsToken";
- SyntaxKind[SyntaxKind["PercentEqualsToken"] = 65] = "PercentEqualsToken";
- SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 66] = "LessThanLessThanEqualsToken";
- SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 67] = "GreaterThanGreaterThanEqualsToken";
- SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 68] = "GreaterThanGreaterThanGreaterThanEqualsToken";
- SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 69] = "AmpersandEqualsToken";
- SyntaxKind[SyntaxKind["BarEqualsToken"] = 70] = "BarEqualsToken";
- SyntaxKind[SyntaxKind["CaretEqualsToken"] = 71] = "CaretEqualsToken";
+ SyntaxKind[SyntaxKind["EqualsToken"] = 60] = "EqualsToken";
+ SyntaxKind[SyntaxKind["PlusEqualsToken"] = 61] = "PlusEqualsToken";
+ SyntaxKind[SyntaxKind["MinusEqualsToken"] = 62] = "MinusEqualsToken";
+ SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 63] = "AsteriskEqualsToken";
+ SyntaxKind[SyntaxKind["AsteriskAsteriskEqualsToken"] = 64] = "AsteriskAsteriskEqualsToken";
+ SyntaxKind[SyntaxKind["SlashEqualsToken"] = 65] = "SlashEqualsToken";
+ SyntaxKind[SyntaxKind["PercentEqualsToken"] = 66] = "PercentEqualsToken";
+ SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 67] = "LessThanLessThanEqualsToken";
+ SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 68] = "GreaterThanGreaterThanEqualsToken";
+ SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 69] = "GreaterThanGreaterThanGreaterThanEqualsToken";
+ SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 70] = "AmpersandEqualsToken";
+ SyntaxKind[SyntaxKind["BarEqualsToken"] = 71] = "BarEqualsToken";
+ SyntaxKind[SyntaxKind["CaretEqualsToken"] = 72] = "CaretEqualsToken";
// Identifiers
- SyntaxKind[SyntaxKind["Identifier"] = 72] = "Identifier";
+ SyntaxKind[SyntaxKind["Identifier"] = 73] = "Identifier";
// Reserved words
- SyntaxKind[SyntaxKind["BreakKeyword"] = 73] = "BreakKeyword";
- SyntaxKind[SyntaxKind["CaseKeyword"] = 74] = "CaseKeyword";
- SyntaxKind[SyntaxKind["CatchKeyword"] = 75] = "CatchKeyword";
- SyntaxKind[SyntaxKind["ClassKeyword"] = 76] = "ClassKeyword";
- SyntaxKind[SyntaxKind["ConstKeyword"] = 77] = "ConstKeyword";
- SyntaxKind[SyntaxKind["ContinueKeyword"] = 78] = "ContinueKeyword";
- SyntaxKind[SyntaxKind["DebuggerKeyword"] = 79] = "DebuggerKeyword";
- SyntaxKind[SyntaxKind["DefaultKeyword"] = 80] = "DefaultKeyword";
- SyntaxKind[SyntaxKind["DeleteKeyword"] = 81] = "DeleteKeyword";
- SyntaxKind[SyntaxKind["DoKeyword"] = 82] = "DoKeyword";
- SyntaxKind[SyntaxKind["ElseKeyword"] = 83] = "ElseKeyword";
- SyntaxKind[SyntaxKind["EnumKeyword"] = 84] = "EnumKeyword";
- SyntaxKind[SyntaxKind["ExportKeyword"] = 85] = "ExportKeyword";
- SyntaxKind[SyntaxKind["ExtendsKeyword"] = 86] = "ExtendsKeyword";
- SyntaxKind[SyntaxKind["FalseKeyword"] = 87] = "FalseKeyword";
- SyntaxKind[SyntaxKind["FinallyKeyword"] = 88] = "FinallyKeyword";
- SyntaxKind[SyntaxKind["ForKeyword"] = 89] = "ForKeyword";
- SyntaxKind[SyntaxKind["FunctionKeyword"] = 90] = "FunctionKeyword";
- SyntaxKind[SyntaxKind["IfKeyword"] = 91] = "IfKeyword";
- SyntaxKind[SyntaxKind["ImportKeyword"] = 92] = "ImportKeyword";
- SyntaxKind[SyntaxKind["InKeyword"] = 93] = "InKeyword";
- SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 94] = "InstanceOfKeyword";
- SyntaxKind[SyntaxKind["NewKeyword"] = 95] = "NewKeyword";
- SyntaxKind[SyntaxKind["NullKeyword"] = 96] = "NullKeyword";
- SyntaxKind[SyntaxKind["ReturnKeyword"] = 97] = "ReturnKeyword";
- SyntaxKind[SyntaxKind["SuperKeyword"] = 98] = "SuperKeyword";
- SyntaxKind[SyntaxKind["SwitchKeyword"] = 99] = "SwitchKeyword";
- SyntaxKind[SyntaxKind["ThisKeyword"] = 100] = "ThisKeyword";
- SyntaxKind[SyntaxKind["ThrowKeyword"] = 101] = "ThrowKeyword";
- SyntaxKind[SyntaxKind["TrueKeyword"] = 102] = "TrueKeyword";
- SyntaxKind[SyntaxKind["TryKeyword"] = 103] = "TryKeyword";
- SyntaxKind[SyntaxKind["TypeOfKeyword"] = 104] = "TypeOfKeyword";
- SyntaxKind[SyntaxKind["VarKeyword"] = 105] = "VarKeyword";
- SyntaxKind[SyntaxKind["VoidKeyword"] = 106] = "VoidKeyword";
- SyntaxKind[SyntaxKind["WhileKeyword"] = 107] = "WhileKeyword";
- SyntaxKind[SyntaxKind["WithKeyword"] = 108] = "WithKeyword";
+ SyntaxKind[SyntaxKind["BreakKeyword"] = 74] = "BreakKeyword";
+ SyntaxKind[SyntaxKind["CaseKeyword"] = 75] = "CaseKeyword";
+ SyntaxKind[SyntaxKind["CatchKeyword"] = 76] = "CatchKeyword";
+ SyntaxKind[SyntaxKind["ClassKeyword"] = 77] = "ClassKeyword";
+ SyntaxKind[SyntaxKind["ConstKeyword"] = 78] = "ConstKeyword";
+ SyntaxKind[SyntaxKind["ContinueKeyword"] = 79] = "ContinueKeyword";
+ SyntaxKind[SyntaxKind["DebuggerKeyword"] = 80] = "DebuggerKeyword";
+ SyntaxKind[SyntaxKind["DefaultKeyword"] = 81] = "DefaultKeyword";
+ SyntaxKind[SyntaxKind["DeleteKeyword"] = 82] = "DeleteKeyword";
+ SyntaxKind[SyntaxKind["DoKeyword"] = 83] = "DoKeyword";
+ SyntaxKind[SyntaxKind["ElseKeyword"] = 84] = "ElseKeyword";
+ SyntaxKind[SyntaxKind["EnumKeyword"] = 85] = "EnumKeyword";
+ SyntaxKind[SyntaxKind["ExportKeyword"] = 86] = "ExportKeyword";
+ SyntaxKind[SyntaxKind["ExtendsKeyword"] = 87] = "ExtendsKeyword";
+ SyntaxKind[SyntaxKind["FalseKeyword"] = 88] = "FalseKeyword";
+ SyntaxKind[SyntaxKind["FinallyKeyword"] = 89] = "FinallyKeyword";
+ SyntaxKind[SyntaxKind["ForKeyword"] = 90] = "ForKeyword";
+ SyntaxKind[SyntaxKind["FunctionKeyword"] = 91] = "FunctionKeyword";
+ SyntaxKind[SyntaxKind["IfKeyword"] = 92] = "IfKeyword";
+ SyntaxKind[SyntaxKind["ImportKeyword"] = 93] = "ImportKeyword";
+ SyntaxKind[SyntaxKind["InKeyword"] = 94] = "InKeyword";
+ SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 95] = "InstanceOfKeyword";
+ SyntaxKind[SyntaxKind["NewKeyword"] = 96] = "NewKeyword";
+ SyntaxKind[SyntaxKind["NullKeyword"] = 97] = "NullKeyword";
+ SyntaxKind[SyntaxKind["ReturnKeyword"] = 98] = "ReturnKeyword";
+ SyntaxKind[SyntaxKind["SuperKeyword"] = 99] = "SuperKeyword";
+ SyntaxKind[SyntaxKind["SwitchKeyword"] = 100] = "SwitchKeyword";
+ SyntaxKind[SyntaxKind["ThisKeyword"] = 101] = "ThisKeyword";
+ SyntaxKind[SyntaxKind["ThrowKeyword"] = 102] = "ThrowKeyword";
+ SyntaxKind[SyntaxKind["TrueKeyword"] = 103] = "TrueKeyword";
+ SyntaxKind[SyntaxKind["TryKeyword"] = 104] = "TryKeyword";
+ SyntaxKind[SyntaxKind["TypeOfKeyword"] = 105] = "TypeOfKeyword";
+ SyntaxKind[SyntaxKind["VarKeyword"] = 106] = "VarKeyword";
+ SyntaxKind[SyntaxKind["VoidKeyword"] = 107] = "VoidKeyword";
+ SyntaxKind[SyntaxKind["WhileKeyword"] = 108] = "WhileKeyword";
+ SyntaxKind[SyntaxKind["WithKeyword"] = 109] = "WithKeyword";
// Strict mode reserved words
- SyntaxKind[SyntaxKind["ImplementsKeyword"] = 109] = "ImplementsKeyword";
- SyntaxKind[SyntaxKind["InterfaceKeyword"] = 110] = "InterfaceKeyword";
- SyntaxKind[SyntaxKind["LetKeyword"] = 111] = "LetKeyword";
- SyntaxKind[SyntaxKind["PackageKeyword"] = 112] = "PackageKeyword";
- SyntaxKind[SyntaxKind["PrivateKeyword"] = 113] = "PrivateKeyword";
- SyntaxKind[SyntaxKind["ProtectedKeyword"] = 114] = "ProtectedKeyword";
- SyntaxKind[SyntaxKind["PublicKeyword"] = 115] = "PublicKeyword";
- SyntaxKind[SyntaxKind["StaticKeyword"] = 116] = "StaticKeyword";
- SyntaxKind[SyntaxKind["YieldKeyword"] = 117] = "YieldKeyword";
+ SyntaxKind[SyntaxKind["ImplementsKeyword"] = 110] = "ImplementsKeyword";
+ SyntaxKind[SyntaxKind["InterfaceKeyword"] = 111] = "InterfaceKeyword";
+ SyntaxKind[SyntaxKind["LetKeyword"] = 112] = "LetKeyword";
+ SyntaxKind[SyntaxKind["PackageKeyword"] = 113] = "PackageKeyword";
+ SyntaxKind[SyntaxKind["PrivateKeyword"] = 114] = "PrivateKeyword";
+ SyntaxKind[SyntaxKind["ProtectedKeyword"] = 115] = "ProtectedKeyword";
+ SyntaxKind[SyntaxKind["PublicKeyword"] = 116] = "PublicKeyword";
+ SyntaxKind[SyntaxKind["StaticKeyword"] = 117] = "StaticKeyword";
+ SyntaxKind[SyntaxKind["YieldKeyword"] = 118] = "YieldKeyword";
// Contextual keywords
- SyntaxKind[SyntaxKind["AbstractKeyword"] = 118] = "AbstractKeyword";
- SyntaxKind[SyntaxKind["AsKeyword"] = 119] = "AsKeyword";
- SyntaxKind[SyntaxKind["AnyKeyword"] = 120] = "AnyKeyword";
- SyntaxKind[SyntaxKind["AsyncKeyword"] = 121] = "AsyncKeyword";
- SyntaxKind[SyntaxKind["AwaitKeyword"] = 122] = "AwaitKeyword";
- SyntaxKind[SyntaxKind["BooleanKeyword"] = 123] = "BooleanKeyword";
- SyntaxKind[SyntaxKind["ConstructorKeyword"] = 124] = "ConstructorKeyword";
- SyntaxKind[SyntaxKind["DeclareKeyword"] = 125] = "DeclareKeyword";
- SyntaxKind[SyntaxKind["GetKeyword"] = 126] = "GetKeyword";
- SyntaxKind[SyntaxKind["InferKeyword"] = 127] = "InferKeyword";
- SyntaxKind[SyntaxKind["IsKeyword"] = 128] = "IsKeyword";
- SyntaxKind[SyntaxKind["KeyOfKeyword"] = 129] = "KeyOfKeyword";
- SyntaxKind[SyntaxKind["ModuleKeyword"] = 130] = "ModuleKeyword";
- SyntaxKind[SyntaxKind["NamespaceKeyword"] = 131] = "NamespaceKeyword";
- SyntaxKind[SyntaxKind["NeverKeyword"] = 132] = "NeverKeyword";
- SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 133] = "ReadonlyKeyword";
- SyntaxKind[SyntaxKind["RequireKeyword"] = 134] = "RequireKeyword";
- SyntaxKind[SyntaxKind["NumberKeyword"] = 135] = "NumberKeyword";
- SyntaxKind[SyntaxKind["ObjectKeyword"] = 136] = "ObjectKeyword";
- SyntaxKind[SyntaxKind["SetKeyword"] = 137] = "SetKeyword";
- SyntaxKind[SyntaxKind["StringKeyword"] = 138] = "StringKeyword";
- SyntaxKind[SyntaxKind["SymbolKeyword"] = 139] = "SymbolKeyword";
- SyntaxKind[SyntaxKind["TypeKeyword"] = 140] = "TypeKeyword";
- SyntaxKind[SyntaxKind["UndefinedKeyword"] = 141] = "UndefinedKeyword";
- SyntaxKind[SyntaxKind["UniqueKeyword"] = 142] = "UniqueKeyword";
- SyntaxKind[SyntaxKind["UnknownKeyword"] = 143] = "UnknownKeyword";
- SyntaxKind[SyntaxKind["FromKeyword"] = 144] = "FromKeyword";
- SyntaxKind[SyntaxKind["GlobalKeyword"] = 145] = "GlobalKeyword";
- SyntaxKind[SyntaxKind["BigIntKeyword"] = 146] = "BigIntKeyword";
- SyntaxKind[SyntaxKind["OfKeyword"] = 147] = "OfKeyword";
+ SyntaxKind[SyntaxKind["AbstractKeyword"] = 119] = "AbstractKeyword";
+ SyntaxKind[SyntaxKind["AsKeyword"] = 120] = "AsKeyword";
+ SyntaxKind[SyntaxKind["AnyKeyword"] = 121] = "AnyKeyword";
+ SyntaxKind[SyntaxKind["AsyncKeyword"] = 122] = "AsyncKeyword";
+ SyntaxKind[SyntaxKind["AwaitKeyword"] = 123] = "AwaitKeyword";
+ SyntaxKind[SyntaxKind["BooleanKeyword"] = 124] = "BooleanKeyword";
+ SyntaxKind[SyntaxKind["ConstructorKeyword"] = 125] = "ConstructorKeyword";
+ SyntaxKind[SyntaxKind["DeclareKeyword"] = 126] = "DeclareKeyword";
+ SyntaxKind[SyntaxKind["GetKeyword"] = 127] = "GetKeyword";
+ SyntaxKind[SyntaxKind["InferKeyword"] = 128] = "InferKeyword";
+ SyntaxKind[SyntaxKind["IsKeyword"] = 129] = "IsKeyword";
+ SyntaxKind[SyntaxKind["KeyOfKeyword"] = 130] = "KeyOfKeyword";
+ SyntaxKind[SyntaxKind["ModuleKeyword"] = 131] = "ModuleKeyword";
+ SyntaxKind[SyntaxKind["NamespaceKeyword"] = 132] = "NamespaceKeyword";
+ SyntaxKind[SyntaxKind["NeverKeyword"] = 133] = "NeverKeyword";
+ SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 134] = "ReadonlyKeyword";
+ SyntaxKind[SyntaxKind["RequireKeyword"] = 135] = "RequireKeyword";
+ SyntaxKind[SyntaxKind["NumberKeyword"] = 136] = "NumberKeyword";
+ SyntaxKind[SyntaxKind["ObjectKeyword"] = 137] = "ObjectKeyword";
+ SyntaxKind[SyntaxKind["SetKeyword"] = 138] = "SetKeyword";
+ SyntaxKind[SyntaxKind["StringKeyword"] = 139] = "StringKeyword";
+ SyntaxKind[SyntaxKind["SymbolKeyword"] = 140] = "SymbolKeyword";
+ SyntaxKind[SyntaxKind["TypeKeyword"] = 141] = "TypeKeyword";
+ SyntaxKind[SyntaxKind["UndefinedKeyword"] = 142] = "UndefinedKeyword";
+ SyntaxKind[SyntaxKind["UniqueKeyword"] = 143] = "UniqueKeyword";
+ SyntaxKind[SyntaxKind["UnknownKeyword"] = 144] = "UnknownKeyword";
+ SyntaxKind[SyntaxKind["FromKeyword"] = 145] = "FromKeyword";
+ SyntaxKind[SyntaxKind["GlobalKeyword"] = 146] = "GlobalKeyword";
+ SyntaxKind[SyntaxKind["BigIntKeyword"] = 147] = "BigIntKeyword";
+ SyntaxKind[SyntaxKind["OfKeyword"] = 148] = "OfKeyword";
// Parse tree nodes
// Names
- SyntaxKind[SyntaxKind["QualifiedName"] = 148] = "QualifiedName";
- SyntaxKind[SyntaxKind["ComputedPropertyName"] = 149] = "ComputedPropertyName";
+ SyntaxKind[SyntaxKind["QualifiedName"] = 149] = "QualifiedName";
+ SyntaxKind[SyntaxKind["ComputedPropertyName"] = 150] = "ComputedPropertyName";
// Signature elements
- SyntaxKind[SyntaxKind["TypeParameter"] = 150] = "TypeParameter";
- SyntaxKind[SyntaxKind["Parameter"] = 151] = "Parameter";
- SyntaxKind[SyntaxKind["Decorator"] = 152] = "Decorator";
+ SyntaxKind[SyntaxKind["TypeParameter"] = 151] = "TypeParameter";
+ SyntaxKind[SyntaxKind["Parameter"] = 152] = "Parameter";
+ SyntaxKind[SyntaxKind["Decorator"] = 153] = "Decorator";
// TypeMember
- SyntaxKind[SyntaxKind["PropertySignature"] = 153] = "PropertySignature";
- SyntaxKind[SyntaxKind["PropertyDeclaration"] = 154] = "PropertyDeclaration";
- SyntaxKind[SyntaxKind["MethodSignature"] = 155] = "MethodSignature";
- SyntaxKind[SyntaxKind["MethodDeclaration"] = 156] = "MethodDeclaration";
- SyntaxKind[SyntaxKind["Constructor"] = 157] = "Constructor";
- SyntaxKind[SyntaxKind["GetAccessor"] = 158] = "GetAccessor";
- SyntaxKind[SyntaxKind["SetAccessor"] = 159] = "SetAccessor";
- SyntaxKind[SyntaxKind["CallSignature"] = 160] = "CallSignature";
- SyntaxKind[SyntaxKind["ConstructSignature"] = 161] = "ConstructSignature";
- SyntaxKind[SyntaxKind["IndexSignature"] = 162] = "IndexSignature";
+ SyntaxKind[SyntaxKind["PropertySignature"] = 154] = "PropertySignature";
+ SyntaxKind[SyntaxKind["PropertyDeclaration"] = 155] = "PropertyDeclaration";
+ SyntaxKind[SyntaxKind["MethodSignature"] = 156] = "MethodSignature";
+ SyntaxKind[SyntaxKind["MethodDeclaration"] = 157] = "MethodDeclaration";
+ SyntaxKind[SyntaxKind["Constructor"] = 158] = "Constructor";
+ SyntaxKind[SyntaxKind["GetAccessor"] = 159] = "GetAccessor";
+ SyntaxKind[SyntaxKind["SetAccessor"] = 160] = "SetAccessor";
+ SyntaxKind[SyntaxKind["CallSignature"] = 161] = "CallSignature";
+ SyntaxKind[SyntaxKind["ConstructSignature"] = 162] = "ConstructSignature";
+ SyntaxKind[SyntaxKind["IndexSignature"] = 163] = "IndexSignature";
// Type
- SyntaxKind[SyntaxKind["TypePredicate"] = 163] = "TypePredicate";
- SyntaxKind[SyntaxKind["TypeReference"] = 164] = "TypeReference";
- SyntaxKind[SyntaxKind["FunctionType"] = 165] = "FunctionType";
- SyntaxKind[SyntaxKind["ConstructorType"] = 166] = "ConstructorType";
- SyntaxKind[SyntaxKind["TypeQuery"] = 167] = "TypeQuery";
- SyntaxKind[SyntaxKind["TypeLiteral"] = 168] = "TypeLiteral";
- SyntaxKind[SyntaxKind["ArrayType"] = 169] = "ArrayType";
- SyntaxKind[SyntaxKind["TupleType"] = 170] = "TupleType";
- SyntaxKind[SyntaxKind["OptionalType"] = 171] = "OptionalType";
- SyntaxKind[SyntaxKind["RestType"] = 172] = "RestType";
- SyntaxKind[SyntaxKind["UnionType"] = 173] = "UnionType";
- SyntaxKind[SyntaxKind["IntersectionType"] = 174] = "IntersectionType";
- SyntaxKind[SyntaxKind["ConditionalType"] = 175] = "ConditionalType";
- SyntaxKind[SyntaxKind["InferType"] = 176] = "InferType";
- SyntaxKind[SyntaxKind["ParenthesizedType"] = 177] = "ParenthesizedType";
- SyntaxKind[SyntaxKind["ThisType"] = 178] = "ThisType";
- SyntaxKind[SyntaxKind["TypeOperator"] = 179] = "TypeOperator";
- SyntaxKind[SyntaxKind["IndexedAccessType"] = 180] = "IndexedAccessType";
- SyntaxKind[SyntaxKind["MappedType"] = 181] = "MappedType";
- SyntaxKind[SyntaxKind["LiteralType"] = 182] = "LiteralType";
- SyntaxKind[SyntaxKind["ImportType"] = 183] = "ImportType";
+ SyntaxKind[SyntaxKind["TypePredicate"] = 164] = "TypePredicate";
+ SyntaxKind[SyntaxKind["TypeReference"] = 165] = "TypeReference";
+ SyntaxKind[SyntaxKind["FunctionType"] = 166] = "FunctionType";
+ SyntaxKind[SyntaxKind["ConstructorType"] = 167] = "ConstructorType";
+ SyntaxKind[SyntaxKind["TypeQuery"] = 168] = "TypeQuery";
+ SyntaxKind[SyntaxKind["TypeLiteral"] = 169] = "TypeLiteral";
+ SyntaxKind[SyntaxKind["ArrayType"] = 170] = "ArrayType";
+ SyntaxKind[SyntaxKind["TupleType"] = 171] = "TupleType";
+ SyntaxKind[SyntaxKind["OptionalType"] = 172] = "OptionalType";
+ SyntaxKind[SyntaxKind["RestType"] = 173] = "RestType";
+ SyntaxKind[SyntaxKind["UnionType"] = 174] = "UnionType";
+ SyntaxKind[SyntaxKind["IntersectionType"] = 175] = "IntersectionType";
+ SyntaxKind[SyntaxKind["ConditionalType"] = 176] = "ConditionalType";
+ SyntaxKind[SyntaxKind["InferType"] = 177] = "InferType";
+ SyntaxKind[SyntaxKind["ParenthesizedType"] = 178] = "ParenthesizedType";
+ SyntaxKind[SyntaxKind["ThisType"] = 179] = "ThisType";
+ SyntaxKind[SyntaxKind["TypeOperator"] = 180] = "TypeOperator";
+ SyntaxKind[SyntaxKind["IndexedAccessType"] = 181] = "IndexedAccessType";
+ SyntaxKind[SyntaxKind["MappedType"] = 182] = "MappedType";
+ SyntaxKind[SyntaxKind["LiteralType"] = 183] = "LiteralType";
+ SyntaxKind[SyntaxKind["ImportType"] = 184] = "ImportType";
// Binding patterns
- SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 184] = "ObjectBindingPattern";
- SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 185] = "ArrayBindingPattern";
- SyntaxKind[SyntaxKind["BindingElement"] = 186] = "BindingElement";
+ SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 185] = "ObjectBindingPattern";
+ SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 186] = "ArrayBindingPattern";
+ SyntaxKind[SyntaxKind["BindingElement"] = 187] = "BindingElement";
// Expression
- SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 187] = "ArrayLiteralExpression";
- SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 188] = "ObjectLiteralExpression";
- SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 189] = "PropertyAccessExpression";
- SyntaxKind[SyntaxKind["ElementAccessExpression"] = 190] = "ElementAccessExpression";
- SyntaxKind[SyntaxKind["CallExpression"] = 191] = "CallExpression";
- SyntaxKind[SyntaxKind["NewExpression"] = 192] = "NewExpression";
- SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 193] = "TaggedTemplateExpression";
- SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 194] = "TypeAssertionExpression";
- SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 195] = "ParenthesizedExpression";
- SyntaxKind[SyntaxKind["FunctionExpression"] = 196] = "FunctionExpression";
- SyntaxKind[SyntaxKind["ArrowFunction"] = 197] = "ArrowFunction";
- SyntaxKind[SyntaxKind["DeleteExpression"] = 198] = "DeleteExpression";
- SyntaxKind[SyntaxKind["TypeOfExpression"] = 199] = "TypeOfExpression";
- SyntaxKind[SyntaxKind["VoidExpression"] = 200] = "VoidExpression";
- SyntaxKind[SyntaxKind["AwaitExpression"] = 201] = "AwaitExpression";
- SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 202] = "PrefixUnaryExpression";
- SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 203] = "PostfixUnaryExpression";
- SyntaxKind[SyntaxKind["BinaryExpression"] = 204] = "BinaryExpression";
- SyntaxKind[SyntaxKind["ConditionalExpression"] = 205] = "ConditionalExpression";
- SyntaxKind[SyntaxKind["TemplateExpression"] = 206] = "TemplateExpression";
- SyntaxKind[SyntaxKind["YieldExpression"] = 207] = "YieldExpression";
- SyntaxKind[SyntaxKind["SpreadElement"] = 208] = "SpreadElement";
- SyntaxKind[SyntaxKind["ClassExpression"] = 209] = "ClassExpression";
- SyntaxKind[SyntaxKind["OmittedExpression"] = 210] = "OmittedExpression";
- SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 211] = "ExpressionWithTypeArguments";
- SyntaxKind[SyntaxKind["AsExpression"] = 212] = "AsExpression";
- SyntaxKind[SyntaxKind["NonNullExpression"] = 213] = "NonNullExpression";
- SyntaxKind[SyntaxKind["MetaProperty"] = 214] = "MetaProperty";
- SyntaxKind[SyntaxKind["SyntheticExpression"] = 215] = "SyntheticExpression";
+ SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 188] = "ArrayLiteralExpression";
+ SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 189] = "ObjectLiteralExpression";
+ SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 190] = "PropertyAccessExpression";
+ SyntaxKind[SyntaxKind["ElementAccessExpression"] = 191] = "ElementAccessExpression";
+ SyntaxKind[SyntaxKind["CallExpression"] = 192] = "CallExpression";
+ SyntaxKind[SyntaxKind["NewExpression"] = 193] = "NewExpression";
+ SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 194] = "TaggedTemplateExpression";
+ SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 195] = "TypeAssertionExpression";
+ SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 196] = "ParenthesizedExpression";
+ SyntaxKind[SyntaxKind["FunctionExpression"] = 197] = "FunctionExpression";
+ SyntaxKind[SyntaxKind["ArrowFunction"] = 198] = "ArrowFunction";
+ SyntaxKind[SyntaxKind["DeleteExpression"] = 199] = "DeleteExpression";
+ SyntaxKind[SyntaxKind["TypeOfExpression"] = 200] = "TypeOfExpression";
+ SyntaxKind[SyntaxKind["VoidExpression"] = 201] = "VoidExpression";
+ SyntaxKind[SyntaxKind["AwaitExpression"] = 202] = "AwaitExpression";
+ SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 203] = "PrefixUnaryExpression";
+ SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 204] = "PostfixUnaryExpression";
+ SyntaxKind[SyntaxKind["BinaryExpression"] = 205] = "BinaryExpression";
+ SyntaxKind[SyntaxKind["ConditionalExpression"] = 206] = "ConditionalExpression";
+ SyntaxKind[SyntaxKind["TemplateExpression"] = 207] = "TemplateExpression";
+ SyntaxKind[SyntaxKind["YieldExpression"] = 208] = "YieldExpression";
+ SyntaxKind[SyntaxKind["SpreadElement"] = 209] = "SpreadElement";
+ SyntaxKind[SyntaxKind["ClassExpression"] = 210] = "ClassExpression";
+ SyntaxKind[SyntaxKind["OmittedExpression"] = 211] = "OmittedExpression";
+ SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 212] = "ExpressionWithTypeArguments";
+ SyntaxKind[SyntaxKind["AsExpression"] = 213] = "AsExpression";
+ SyntaxKind[SyntaxKind["NonNullExpression"] = 214] = "NonNullExpression";
+ SyntaxKind[SyntaxKind["MetaProperty"] = 215] = "MetaProperty";
+ SyntaxKind[SyntaxKind["SyntheticExpression"] = 216] = "SyntheticExpression";
// Misc
- SyntaxKind[SyntaxKind["TemplateSpan"] = 216] = "TemplateSpan";
- SyntaxKind[SyntaxKind["SemicolonClassElement"] = 217] = "SemicolonClassElement";
+ SyntaxKind[SyntaxKind["TemplateSpan"] = 217] = "TemplateSpan";
+ SyntaxKind[SyntaxKind["SemicolonClassElement"] = 218] = "SemicolonClassElement";
// Element
- SyntaxKind[SyntaxKind["Block"] = 218] = "Block";
- SyntaxKind[SyntaxKind["VariableStatement"] = 219] = "VariableStatement";
- SyntaxKind[SyntaxKind["EmptyStatement"] = 220] = "EmptyStatement";
- SyntaxKind[SyntaxKind["ExpressionStatement"] = 221] = "ExpressionStatement";
- SyntaxKind[SyntaxKind["IfStatement"] = 222] = "IfStatement";
- SyntaxKind[SyntaxKind["DoStatement"] = 223] = "DoStatement";
- SyntaxKind[SyntaxKind["WhileStatement"] = 224] = "WhileStatement";
- SyntaxKind[SyntaxKind["ForStatement"] = 225] = "ForStatement";
- SyntaxKind[SyntaxKind["ForInStatement"] = 226] = "ForInStatement";
- SyntaxKind[SyntaxKind["ForOfStatement"] = 227] = "ForOfStatement";
- SyntaxKind[SyntaxKind["ContinueStatement"] = 228] = "ContinueStatement";
- SyntaxKind[SyntaxKind["BreakStatement"] = 229] = "BreakStatement";
- SyntaxKind[SyntaxKind["ReturnStatement"] = 230] = "ReturnStatement";
- SyntaxKind[SyntaxKind["WithStatement"] = 231] = "WithStatement";
- SyntaxKind[SyntaxKind["SwitchStatement"] = 232] = "SwitchStatement";
- SyntaxKind[SyntaxKind["LabeledStatement"] = 233] = "LabeledStatement";
- SyntaxKind[SyntaxKind["ThrowStatement"] = 234] = "ThrowStatement";
- SyntaxKind[SyntaxKind["TryStatement"] = 235] = "TryStatement";
- SyntaxKind[SyntaxKind["DebuggerStatement"] = 236] = "DebuggerStatement";
- SyntaxKind[SyntaxKind["VariableDeclaration"] = 237] = "VariableDeclaration";
- SyntaxKind[SyntaxKind["VariableDeclarationList"] = 238] = "VariableDeclarationList";
- SyntaxKind[SyntaxKind["FunctionDeclaration"] = 239] = "FunctionDeclaration";
- SyntaxKind[SyntaxKind["ClassDeclaration"] = 240] = "ClassDeclaration";
- SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 241] = "InterfaceDeclaration";
- SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 242] = "TypeAliasDeclaration";
- SyntaxKind[SyntaxKind["EnumDeclaration"] = 243] = "EnumDeclaration";
- SyntaxKind[SyntaxKind["ModuleDeclaration"] = 244] = "ModuleDeclaration";
- SyntaxKind[SyntaxKind["ModuleBlock"] = 245] = "ModuleBlock";
- SyntaxKind[SyntaxKind["CaseBlock"] = 246] = "CaseBlock";
- SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 247] = "NamespaceExportDeclaration";
- SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 248] = "ImportEqualsDeclaration";
- SyntaxKind[SyntaxKind["ImportDeclaration"] = 249] = "ImportDeclaration";
- SyntaxKind[SyntaxKind["ImportClause"] = 250] = "ImportClause";
- SyntaxKind[SyntaxKind["NamespaceImport"] = 251] = "NamespaceImport";
- SyntaxKind[SyntaxKind["NamedImports"] = 252] = "NamedImports";
- SyntaxKind[SyntaxKind["ImportSpecifier"] = 253] = "ImportSpecifier";
- SyntaxKind[SyntaxKind["ExportAssignment"] = 254] = "ExportAssignment";
- SyntaxKind[SyntaxKind["ExportDeclaration"] = 255] = "ExportDeclaration";
- SyntaxKind[SyntaxKind["NamedExports"] = 256] = "NamedExports";
- SyntaxKind[SyntaxKind["ExportSpecifier"] = 257] = "ExportSpecifier";
- SyntaxKind[SyntaxKind["MissingDeclaration"] = 258] = "MissingDeclaration";
+ SyntaxKind[SyntaxKind["Block"] = 219] = "Block";
+ SyntaxKind[SyntaxKind["VariableStatement"] = 220] = "VariableStatement";
+ SyntaxKind[SyntaxKind["EmptyStatement"] = 221] = "EmptyStatement";
+ SyntaxKind[SyntaxKind["ExpressionStatement"] = 222] = "ExpressionStatement";
+ SyntaxKind[SyntaxKind["IfStatement"] = 223] = "IfStatement";
+ SyntaxKind[SyntaxKind["DoStatement"] = 224] = "DoStatement";
+ SyntaxKind[SyntaxKind["WhileStatement"] = 225] = "WhileStatement";
+ SyntaxKind[SyntaxKind["ForStatement"] = 226] = "ForStatement";
+ SyntaxKind[SyntaxKind["ForInStatement"] = 227] = "ForInStatement";
+ SyntaxKind[SyntaxKind["ForOfStatement"] = 228] = "ForOfStatement";
+ SyntaxKind[SyntaxKind["ContinueStatement"] = 229] = "ContinueStatement";
+ SyntaxKind[SyntaxKind["BreakStatement"] = 230] = "BreakStatement";
+ SyntaxKind[SyntaxKind["ReturnStatement"] = 231] = "ReturnStatement";
+ SyntaxKind[SyntaxKind["WithStatement"] = 232] = "WithStatement";
+ SyntaxKind[SyntaxKind["SwitchStatement"] = 233] = "SwitchStatement";
+ SyntaxKind[SyntaxKind["LabeledStatement"] = 234] = "LabeledStatement";
+ SyntaxKind[SyntaxKind["ThrowStatement"] = 235] = "ThrowStatement";
+ SyntaxKind[SyntaxKind["TryStatement"] = 236] = "TryStatement";
+ SyntaxKind[SyntaxKind["DebuggerStatement"] = 237] = "DebuggerStatement";
+ SyntaxKind[SyntaxKind["VariableDeclaration"] = 238] = "VariableDeclaration";
+ SyntaxKind[SyntaxKind["VariableDeclarationList"] = 239] = "VariableDeclarationList";
+ SyntaxKind[SyntaxKind["FunctionDeclaration"] = 240] = "FunctionDeclaration";
+ SyntaxKind[SyntaxKind["ClassDeclaration"] = 241] = "ClassDeclaration";
+ SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 242] = "InterfaceDeclaration";
+ SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 243] = "TypeAliasDeclaration";
+ SyntaxKind[SyntaxKind["EnumDeclaration"] = 244] = "EnumDeclaration";
+ SyntaxKind[SyntaxKind["ModuleDeclaration"] = 245] = "ModuleDeclaration";
+ SyntaxKind[SyntaxKind["ModuleBlock"] = 246] = "ModuleBlock";
+ SyntaxKind[SyntaxKind["CaseBlock"] = 247] = "CaseBlock";
+ SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 248] = "NamespaceExportDeclaration";
+ SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 249] = "ImportEqualsDeclaration";
+ SyntaxKind[SyntaxKind["ImportDeclaration"] = 250] = "ImportDeclaration";
+ SyntaxKind[SyntaxKind["ImportClause"] = 251] = "ImportClause";
+ SyntaxKind[SyntaxKind["NamespaceImport"] = 252] = "NamespaceImport";
+ SyntaxKind[SyntaxKind["NamedImports"] = 253] = "NamedImports";
+ SyntaxKind[SyntaxKind["ImportSpecifier"] = 254] = "ImportSpecifier";
+ SyntaxKind[SyntaxKind["ExportAssignment"] = 255] = "ExportAssignment";
+ SyntaxKind[SyntaxKind["ExportDeclaration"] = 256] = "ExportDeclaration";
+ SyntaxKind[SyntaxKind["NamedExports"] = 257] = "NamedExports";
+ SyntaxKind[SyntaxKind["ExportSpecifier"] = 258] = "ExportSpecifier";
+ SyntaxKind[SyntaxKind["MissingDeclaration"] = 259] = "MissingDeclaration";
// Module references
- SyntaxKind[SyntaxKind["ExternalModuleReference"] = 259] = "ExternalModuleReference";
+ SyntaxKind[SyntaxKind["ExternalModuleReference"] = 260] = "ExternalModuleReference";
// JSX
- SyntaxKind[SyntaxKind["JsxElement"] = 260] = "JsxElement";
- SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 261] = "JsxSelfClosingElement";
- SyntaxKind[SyntaxKind["JsxOpeningElement"] = 262] = "JsxOpeningElement";
- SyntaxKind[SyntaxKind["JsxClosingElement"] = 263] = "JsxClosingElement";
- SyntaxKind[SyntaxKind["JsxFragment"] = 264] = "JsxFragment";
- SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 265] = "JsxOpeningFragment";
- SyntaxKind[SyntaxKind["JsxClosingFragment"] = 266] = "JsxClosingFragment";
- SyntaxKind[SyntaxKind["JsxAttribute"] = 267] = "JsxAttribute";
- SyntaxKind[SyntaxKind["JsxAttributes"] = 268] = "JsxAttributes";
- SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 269] = "JsxSpreadAttribute";
- SyntaxKind[SyntaxKind["JsxExpression"] = 270] = "JsxExpression";
+ SyntaxKind[SyntaxKind["JsxElement"] = 261] = "JsxElement";
+ SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 262] = "JsxSelfClosingElement";
+ SyntaxKind[SyntaxKind["JsxOpeningElement"] = 263] = "JsxOpeningElement";
+ SyntaxKind[SyntaxKind["JsxClosingElement"] = 264] = "JsxClosingElement";
+ SyntaxKind[SyntaxKind["JsxFragment"] = 265] = "JsxFragment";
+ SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 266] = "JsxOpeningFragment";
+ SyntaxKind[SyntaxKind["JsxClosingFragment"] = 267] = "JsxClosingFragment";
+ SyntaxKind[SyntaxKind["JsxAttribute"] = 268] = "JsxAttribute";
+ SyntaxKind[SyntaxKind["JsxAttributes"] = 269] = "JsxAttributes";
+ SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 270] = "JsxSpreadAttribute";
+ SyntaxKind[SyntaxKind["JsxExpression"] = 271] = "JsxExpression";
// Clauses
- SyntaxKind[SyntaxKind["CaseClause"] = 271] = "CaseClause";
- SyntaxKind[SyntaxKind["DefaultClause"] = 272] = "DefaultClause";
- SyntaxKind[SyntaxKind["HeritageClause"] = 273] = "HeritageClause";
- SyntaxKind[SyntaxKind["CatchClause"] = 274] = "CatchClause";
+ SyntaxKind[SyntaxKind["CaseClause"] = 272] = "CaseClause";
+ SyntaxKind[SyntaxKind["DefaultClause"] = 273] = "DefaultClause";
+ SyntaxKind[SyntaxKind["HeritageClause"] = 274] = "HeritageClause";
+ SyntaxKind[SyntaxKind["CatchClause"] = 275] = "CatchClause";
// Property assignments
- SyntaxKind[SyntaxKind["PropertyAssignment"] = 275] = "PropertyAssignment";
- SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 276] = "ShorthandPropertyAssignment";
- SyntaxKind[SyntaxKind["SpreadAssignment"] = 277] = "SpreadAssignment";
+ SyntaxKind[SyntaxKind["PropertyAssignment"] = 276] = "PropertyAssignment";
+ SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 277] = "ShorthandPropertyAssignment";
+ SyntaxKind[SyntaxKind["SpreadAssignment"] = 278] = "SpreadAssignment";
// Enum
- SyntaxKind[SyntaxKind["EnumMember"] = 278] = "EnumMember";
+ SyntaxKind[SyntaxKind["EnumMember"] = 279] = "EnumMember";
// Unparsed
- SyntaxKind[SyntaxKind["UnparsedPrologue"] = 279] = "UnparsedPrologue";
- SyntaxKind[SyntaxKind["UnparsedPrepend"] = 280] = "UnparsedPrepend";
- SyntaxKind[SyntaxKind["UnparsedText"] = 281] = "UnparsedText";
- SyntaxKind[SyntaxKind["UnparsedInternalText"] = 282] = "UnparsedInternalText";
- SyntaxKind[SyntaxKind["UnparsedSyntheticReference"] = 283] = "UnparsedSyntheticReference";
+ SyntaxKind[SyntaxKind["UnparsedPrologue"] = 280] = "UnparsedPrologue";
+ SyntaxKind[SyntaxKind["UnparsedPrepend"] = 281] = "UnparsedPrepend";
+ SyntaxKind[SyntaxKind["UnparsedText"] = 282] = "UnparsedText";
+ SyntaxKind[SyntaxKind["UnparsedInternalText"] = 283] = "UnparsedInternalText";
+ SyntaxKind[SyntaxKind["UnparsedSyntheticReference"] = 284] = "UnparsedSyntheticReference";
// Top-level nodes
- SyntaxKind[SyntaxKind["SourceFile"] = 284] = "SourceFile";
- SyntaxKind[SyntaxKind["Bundle"] = 285] = "Bundle";
- SyntaxKind[SyntaxKind["UnparsedSource"] = 286] = "UnparsedSource";
- SyntaxKind[SyntaxKind["InputFiles"] = 287] = "InputFiles";
+ SyntaxKind[SyntaxKind["SourceFile"] = 285] = "SourceFile";
+ SyntaxKind[SyntaxKind["Bundle"] = 286] = "Bundle";
+ SyntaxKind[SyntaxKind["UnparsedSource"] = 287] = "UnparsedSource";
+ SyntaxKind[SyntaxKind["InputFiles"] = 288] = "InputFiles";
// JSDoc nodes
- SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 288] = "JSDocTypeExpression";
+ SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 289] = "JSDocTypeExpression";
// The * type
- SyntaxKind[SyntaxKind["JSDocAllType"] = 289] = "JSDocAllType";
+ SyntaxKind[SyntaxKind["JSDocAllType"] = 290] = "JSDocAllType";
// The ? type
- SyntaxKind[SyntaxKind["JSDocUnknownType"] = 290] = "JSDocUnknownType";
- SyntaxKind[SyntaxKind["JSDocNullableType"] = 291] = "JSDocNullableType";
- SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 292] = "JSDocNonNullableType";
- SyntaxKind[SyntaxKind["JSDocOptionalType"] = 293] = "JSDocOptionalType";
- SyntaxKind[SyntaxKind["JSDocFunctionType"] = 294] = "JSDocFunctionType";
- SyntaxKind[SyntaxKind["JSDocVariadicType"] = 295] = "JSDocVariadicType";
- SyntaxKind[SyntaxKind["JSDocComment"] = 296] = "JSDocComment";
- SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 297] = "JSDocTypeLiteral";
- SyntaxKind[SyntaxKind["JSDocSignature"] = 298] = "JSDocSignature";
- SyntaxKind[SyntaxKind["JSDocTag"] = 299] = "JSDocTag";
- SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 300] = "JSDocAugmentsTag";
- SyntaxKind[SyntaxKind["JSDocClassTag"] = 301] = "JSDocClassTag";
- SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 302] = "JSDocCallbackTag";
- SyntaxKind[SyntaxKind["JSDocEnumTag"] = 303] = "JSDocEnumTag";
- SyntaxKind[SyntaxKind["JSDocParameterTag"] = 304] = "JSDocParameterTag";
- SyntaxKind[SyntaxKind["JSDocReturnTag"] = 305] = "JSDocReturnTag";
- SyntaxKind[SyntaxKind["JSDocThisTag"] = 306] = "JSDocThisTag";
- SyntaxKind[SyntaxKind["JSDocTypeTag"] = 307] = "JSDocTypeTag";
- SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 308] = "JSDocTemplateTag";
- SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 309] = "JSDocTypedefTag";
- SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 310] = "JSDocPropertyTag";
+ SyntaxKind[SyntaxKind["JSDocUnknownType"] = 291] = "JSDocUnknownType";
+ SyntaxKind[SyntaxKind["JSDocNullableType"] = 292] = "JSDocNullableType";
+ SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 293] = "JSDocNonNullableType";
+ SyntaxKind[SyntaxKind["JSDocOptionalType"] = 294] = "JSDocOptionalType";
+ SyntaxKind[SyntaxKind["JSDocFunctionType"] = 295] = "JSDocFunctionType";
+ SyntaxKind[SyntaxKind["JSDocVariadicType"] = 296] = "JSDocVariadicType";
+ SyntaxKind[SyntaxKind["JSDocComment"] = 297] = "JSDocComment";
+ SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 298] = "JSDocTypeLiteral";
+ SyntaxKind[SyntaxKind["JSDocSignature"] = 299] = "JSDocSignature";
+ SyntaxKind[SyntaxKind["JSDocTag"] = 300] = "JSDocTag";
+ SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 301] = "JSDocAugmentsTag";
+ SyntaxKind[SyntaxKind["JSDocClassTag"] = 302] = "JSDocClassTag";
+ SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 303] = "JSDocCallbackTag";
+ SyntaxKind[SyntaxKind["JSDocEnumTag"] = 304] = "JSDocEnumTag";
+ SyntaxKind[SyntaxKind["JSDocParameterTag"] = 305] = "JSDocParameterTag";
+ SyntaxKind[SyntaxKind["JSDocReturnTag"] = 306] = "JSDocReturnTag";
+ SyntaxKind[SyntaxKind["JSDocThisTag"] = 307] = "JSDocThisTag";
+ SyntaxKind[SyntaxKind["JSDocTypeTag"] = 308] = "JSDocTypeTag";
+ SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 309] = "JSDocTemplateTag";
+ SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 310] = "JSDocTypedefTag";
+ SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 311] = "JSDocPropertyTag";
// Synthesized list
- SyntaxKind[SyntaxKind["SyntaxList"] = 311] = "SyntaxList";
+ SyntaxKind[SyntaxKind["SyntaxList"] = 312] = "SyntaxList";
// Transformation nodes
- SyntaxKind[SyntaxKind["NotEmittedStatement"] = 312] = "NotEmittedStatement";
- SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 313] = "PartiallyEmittedExpression";
- SyntaxKind[SyntaxKind["CommaListExpression"] = 314] = "CommaListExpression";
- SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 315] = "MergeDeclarationMarker";
- SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 316] = "EndOfDeclarationMarker";
+ SyntaxKind[SyntaxKind["NotEmittedStatement"] = 313] = "NotEmittedStatement";
+ SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 314] = "PartiallyEmittedExpression";
+ SyntaxKind[SyntaxKind["CommaListExpression"] = 315] = "CommaListExpression";
+ SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 316] = "MergeDeclarationMarker";
+ SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 317] = "EndOfDeclarationMarker";
// Enum value count
- SyntaxKind[SyntaxKind["Count"] = 317] = "Count";
+ SyntaxKind[SyntaxKind["Count"] = 318] = "Count";
// Markers
- SyntaxKind[SyntaxKind["FirstAssignment"] = 59] = "FirstAssignment";
- SyntaxKind[SyntaxKind["LastAssignment"] = 71] = "LastAssignment";
- SyntaxKind[SyntaxKind["FirstCompoundAssignment"] = 60] = "FirstCompoundAssignment";
- SyntaxKind[SyntaxKind["LastCompoundAssignment"] = 71] = "LastCompoundAssignment";
- SyntaxKind[SyntaxKind["FirstReservedWord"] = 73] = "FirstReservedWord";
- SyntaxKind[SyntaxKind["LastReservedWord"] = 108] = "LastReservedWord";
- SyntaxKind[SyntaxKind["FirstKeyword"] = 73] = "FirstKeyword";
- SyntaxKind[SyntaxKind["LastKeyword"] = 147] = "LastKeyword";
- SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 109] = "FirstFutureReservedWord";
- SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 117] = "LastFutureReservedWord";
- SyntaxKind[SyntaxKind["FirstTypeNode"] = 163] = "FirstTypeNode";
- SyntaxKind[SyntaxKind["LastTypeNode"] = 183] = "LastTypeNode";
+ SyntaxKind[SyntaxKind["FirstAssignment"] = 60] = "FirstAssignment";
+ SyntaxKind[SyntaxKind["LastAssignment"] = 72] = "LastAssignment";
+ SyntaxKind[SyntaxKind["FirstCompoundAssignment"] = 61] = "FirstCompoundAssignment";
+ SyntaxKind[SyntaxKind["LastCompoundAssignment"] = 72] = "LastCompoundAssignment";
+ SyntaxKind[SyntaxKind["FirstReservedWord"] = 74] = "FirstReservedWord";
+ SyntaxKind[SyntaxKind["LastReservedWord"] = 109] = "LastReservedWord";
+ SyntaxKind[SyntaxKind["FirstKeyword"] = 74] = "FirstKeyword";
+ SyntaxKind[SyntaxKind["LastKeyword"] = 148] = "LastKeyword";
+ SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 110] = "FirstFutureReservedWord";
+ SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 118] = "LastFutureReservedWord";
+ SyntaxKind[SyntaxKind["FirstTypeNode"] = 164] = "FirstTypeNode";
+ SyntaxKind[SyntaxKind["LastTypeNode"] = 184] = "LastTypeNode";
SyntaxKind[SyntaxKind["FirstPunctuation"] = 18] = "FirstPunctuation";
- SyntaxKind[SyntaxKind["LastPunctuation"] = 71] = "LastPunctuation";
+ SyntaxKind[SyntaxKind["LastPunctuation"] = 72] = "LastPunctuation";
SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken";
- SyntaxKind[SyntaxKind["LastToken"] = 147] = "LastToken";
+ SyntaxKind[SyntaxKind["LastToken"] = 148] = "LastToken";
SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken";
SyntaxKind[SyntaxKind["LastTriviaToken"] = 7] = "LastTriviaToken";
SyntaxKind[SyntaxKind["FirstLiteralToken"] = 8] = "FirstLiteralToken";
@@ -2956,14 +3108,14 @@
SyntaxKind[SyntaxKind["FirstTemplateToken"] = 14] = "FirstTemplateToken";
SyntaxKind[SyntaxKind["LastTemplateToken"] = 17] = "LastTemplateToken";
SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 28] = "FirstBinaryOperator";
- SyntaxKind[SyntaxKind["LastBinaryOperator"] = 71] = "LastBinaryOperator";
- SyntaxKind[SyntaxKind["FirstNode"] = 148] = "FirstNode";
- SyntaxKind[SyntaxKind["FirstJSDocNode"] = 288] = "FirstJSDocNode";
- SyntaxKind[SyntaxKind["LastJSDocNode"] = 310] = "LastJSDocNode";
- SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 299] = "FirstJSDocTagNode";
- SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 310] = "LastJSDocTagNode";
- /* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 118] = "FirstContextualKeyword";
- /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 147] = "LastContextualKeyword";
+ SyntaxKind[SyntaxKind["LastBinaryOperator"] = 72] = "LastBinaryOperator";
+ SyntaxKind[SyntaxKind["FirstNode"] = 149] = "FirstNode";
+ SyntaxKind[SyntaxKind["FirstJSDocNode"] = 289] = "FirstJSDocNode";
+ SyntaxKind[SyntaxKind["LastJSDocNode"] = 311] = "LastJSDocNode";
+ SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 300] = "FirstJSDocTagNode";
+ SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 311] = "LastJSDocTagNode";
+ /* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 119] = "FirstContextualKeyword";
+ /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 148] = "LastContextualKeyword";
})(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {}));
var NodeFlags;
(function (NodeFlags) {
@@ -3106,6 +3258,8 @@
FlowFlags[FlowFlags["Shared"] = 1024] = "Shared";
FlowFlags[FlowFlags["PreFinally"] = 2048] = "PreFinally";
FlowFlags[FlowFlags["AfterFinally"] = 4096] = "AfterFinally";
+ /** @internal */
+ FlowFlags[FlowFlags["Cached"] = 8192] = "Cached";
FlowFlags[FlowFlags["Label"] = 12] = "Label";
FlowFlags[FlowFlags["Condition"] = 96] = "Condition";
})(FlowFlags = ts.FlowFlags || (ts.FlowFlags = {}));
@@ -3358,19 +3512,22 @@
CheckFlags[CheckFlags["SyntheticProperty"] = 2] = "SyntheticProperty";
CheckFlags[CheckFlags["SyntheticMethod"] = 4] = "SyntheticMethod";
CheckFlags[CheckFlags["Readonly"] = 8] = "Readonly";
- CheckFlags[CheckFlags["Partial"] = 16] = "Partial";
- CheckFlags[CheckFlags["HasNonUniformType"] = 32] = "HasNonUniformType";
- CheckFlags[CheckFlags["HasLiteralType"] = 64] = "HasLiteralType";
- CheckFlags[CheckFlags["ContainsPublic"] = 128] = "ContainsPublic";
- CheckFlags[CheckFlags["ContainsProtected"] = 256] = "ContainsProtected";
- CheckFlags[CheckFlags["ContainsPrivate"] = 512] = "ContainsPrivate";
- CheckFlags[CheckFlags["ContainsStatic"] = 1024] = "ContainsStatic";
- CheckFlags[CheckFlags["Late"] = 2048] = "Late";
- CheckFlags[CheckFlags["ReverseMapped"] = 4096] = "ReverseMapped";
- CheckFlags[CheckFlags["OptionalParameter"] = 8192] = "OptionalParameter";
- CheckFlags[CheckFlags["RestParameter"] = 16384] = "RestParameter";
+ CheckFlags[CheckFlags["ReadPartial"] = 16] = "ReadPartial";
+ CheckFlags[CheckFlags["WritePartial"] = 32] = "WritePartial";
+ CheckFlags[CheckFlags["HasNonUniformType"] = 64] = "HasNonUniformType";
+ CheckFlags[CheckFlags["HasLiteralType"] = 128] = "HasLiteralType";
+ CheckFlags[CheckFlags["ContainsPublic"] = 256] = "ContainsPublic";
+ CheckFlags[CheckFlags["ContainsProtected"] = 512] = "ContainsProtected";
+ CheckFlags[CheckFlags["ContainsPrivate"] = 1024] = "ContainsPrivate";
+ CheckFlags[CheckFlags["ContainsStatic"] = 2048] = "ContainsStatic";
+ CheckFlags[CheckFlags["Late"] = 4096] = "Late";
+ CheckFlags[CheckFlags["ReverseMapped"] = 8192] = "ReverseMapped";
+ CheckFlags[CheckFlags["OptionalParameter"] = 16384] = "OptionalParameter";
+ CheckFlags[CheckFlags["RestParameter"] = 32768] = "RestParameter";
+ CheckFlags[CheckFlags["DeferredType"] = 65536] = "DeferredType";
CheckFlags[CheckFlags["Synthetic"] = 6] = "Synthetic";
- CheckFlags[CheckFlags["Discriminant"] = 96] = "Discriminant";
+ CheckFlags[CheckFlags["Discriminant"] = 192] = "Discriminant";
+ CheckFlags[CheckFlags["Partial"] = 48] = "Partial";
})(CheckFlags = ts.CheckFlags || (ts.CheckFlags = {}));
var InternalSymbolName;
(function (InternalSymbolName) {
@@ -3481,6 +3638,8 @@
TypeFlags[TypeFlags["StructuredOrInstantiable"] = 66846720] = "StructuredOrInstantiable";
/* @internal */
TypeFlags[TypeFlags["ObjectFlagsType"] = 3899392] = "ObjectFlagsType";
+ /* @internal */
+ TypeFlags[TypeFlags["Simplifiable"] = 25165824] = "Simplifiable";
// 'Narrowable' types are types where narrowing actually narrows.
// This *should* be every type other than null, undefined, void, and never
TypeFlags[TypeFlags["Narrowable"] = 133970943] = "Narrowable";
@@ -3536,14 +3695,18 @@
ObjectFlags[ObjectFlags["PropagatingFlags"] = 917504] = "PropagatingFlags";
})(ObjectFlags = ts.ObjectFlags || (ts.ObjectFlags = {}));
/* @internal */
- var Variance;
- (function (Variance) {
- Variance[Variance["Invariant"] = 0] = "Invariant";
- Variance[Variance["Covariant"] = 1] = "Covariant";
- Variance[Variance["Contravariant"] = 2] = "Contravariant";
- Variance[Variance["Bivariant"] = 3] = "Bivariant";
- Variance[Variance["Independent"] = 4] = "Independent";
- })(Variance = ts.Variance || (ts.Variance = {}));
+ var VarianceFlags;
+ (function (VarianceFlags) {
+ VarianceFlags[VarianceFlags["Invariant"] = 0] = "Invariant";
+ VarianceFlags[VarianceFlags["Covariant"] = 1] = "Covariant";
+ VarianceFlags[VarianceFlags["Contravariant"] = 2] = "Contravariant";
+ VarianceFlags[VarianceFlags["Bivariant"] = 3] = "Bivariant";
+ VarianceFlags[VarianceFlags["Independent"] = 4] = "Independent";
+ VarianceFlags[VarianceFlags["VarianceMask"] = 7] = "VarianceMask";
+ VarianceFlags[VarianceFlags["Unmeasurable"] = 8] = "Unmeasurable";
+ VarianceFlags[VarianceFlags["Unreliable"] = 16] = "Unreliable";
+ VarianceFlags[VarianceFlags["AllowsStructuralFallback"] = 24] = "AllowsStructuralFallback";
+ })(VarianceFlags = ts.VarianceFlags || (ts.VarianceFlags = {}));
/* @internal */
var JsxReferenceKind;
(function (JsxReferenceKind) {
@@ -3565,12 +3728,13 @@
(function (InferencePriority) {
InferencePriority[InferencePriority["NakedTypeVariable"] = 1] = "NakedTypeVariable";
InferencePriority[InferencePriority["HomomorphicMappedType"] = 2] = "HomomorphicMappedType";
- InferencePriority[InferencePriority["MappedTypeConstraint"] = 4] = "MappedTypeConstraint";
- InferencePriority[InferencePriority["ReturnType"] = 8] = "ReturnType";
- InferencePriority[InferencePriority["LiteralKeyof"] = 16] = "LiteralKeyof";
- InferencePriority[InferencePriority["NoConstraints"] = 32] = "NoConstraints";
- InferencePriority[InferencePriority["AlwaysStrict"] = 64] = "AlwaysStrict";
- InferencePriority[InferencePriority["PriorityImpliesCombination"] = 28] = "PriorityImpliesCombination";
+ InferencePriority[InferencePriority["PartialHomomorphicMappedType"] = 4] = "PartialHomomorphicMappedType";
+ InferencePriority[InferencePriority["MappedTypeConstraint"] = 8] = "MappedTypeConstraint";
+ InferencePriority[InferencePriority["ReturnType"] = 16] = "ReturnType";
+ InferencePriority[InferencePriority["LiteralKeyof"] = 32] = "LiteralKeyof";
+ InferencePriority[InferencePriority["NoConstraints"] = 64] = "NoConstraints";
+ InferencePriority[InferencePriority["AlwaysStrict"] = 128] = "AlwaysStrict";
+ InferencePriority[InferencePriority["PriorityImpliesCombination"] = 56] = "PriorityImpliesCombination";
})(InferencePriority = ts.InferencePriority || (ts.InferencePriority = {}));
/* @internal */
var InferenceFlags;
@@ -3687,9 +3851,10 @@
ScriptTarget[ScriptTarget["ES2017"] = 4] = "ES2017";
ScriptTarget[ScriptTarget["ES2018"] = 5] = "ES2018";
ScriptTarget[ScriptTarget["ES2019"] = 6] = "ES2019";
- ScriptTarget[ScriptTarget["ESNext"] = 7] = "ESNext";
+ ScriptTarget[ScriptTarget["ES2020"] = 7] = "ES2020";
+ ScriptTarget[ScriptTarget["ESNext"] = 8] = "ESNext";
ScriptTarget[ScriptTarget["JSON"] = 100] = "JSON";
- ScriptTarget[ScriptTarget["Latest"] = 7] = "Latest";
+ ScriptTarget[ScriptTarget["Latest"] = 8] = "Latest";
})(ScriptTarget = ts.ScriptTarget || (ts.ScriptTarget = {}));
var LanguageVariant;
(function (LanguageVariant) {
@@ -4102,17 +4267,10 @@
PragmaKindFlags[PragmaKindFlags["All"] = 7] = "All";
PragmaKindFlags[PragmaKindFlags["Default"] = 7] = "Default";
})(PragmaKindFlags = ts.PragmaKindFlags || (ts.PragmaKindFlags = {}));
- /**
- * This function only exists to cause exact types to be inferred for all the literals within `commentPragmas`
- */
- /* @internal */
- function _contextuallyTypePragmas(args) {
- return args;
- }
// While not strictly a type, this is here because `PragmaMap` needs to be here to be used with `SourceFile`, and we don't
// fancy effectively defining it twice, once in value-space and once in type-space
/* @internal */
- ts.commentPragmas = _contextuallyTypePragmas({
+ ts.commentPragmas = {
"reference": {
args: [
{ name: "types", optional: true, captureSpan: true },
@@ -4140,7 +4298,7 @@
args: [{ name: "factory" }],
kind: 4 /* MultiLine */
},
- });
+ };
})(ts || (ts = {}));
var ts;
(function (ts) {
@@ -5187,7 +5345,7 @@
_0_modifier_cannot_appear_on_a_data_property: diag(1043, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_data_property_1043", "'{0}' modifier cannot appear on a data property."),
_0_modifier_cannot_appear_on_a_module_or_namespace_element: diag(1044, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_module_or_namespace_element_1044", "'{0}' modifier cannot appear on a module or namespace element."),
A_0_modifier_cannot_be_used_with_an_interface_declaration: diag(1045, ts.DiagnosticCategory.Error, "A_0_modifier_cannot_be_used_with_an_interface_declaration_1045", "A '{0}' modifier cannot be used with an interface declaration."),
- A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: diag(1046, ts.DiagnosticCategory.Error, "A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file_1046", "A 'declare' modifier is required for a top level declaration in a .d.ts file."),
+ Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier: diag(1046, ts.DiagnosticCategory.Error, "Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier_1046", "Top-level declarations in .d.ts files must start with either a 'declare' or 'export' modifier."),
A_rest_parameter_cannot_be_optional: diag(1047, ts.DiagnosticCategory.Error, "A_rest_parameter_cannot_be_optional_1047", "A rest parameter cannot be optional."),
A_rest_parameter_cannot_have_an_initializer: diag(1048, ts.DiagnosticCategory.Error, "A_rest_parameter_cannot_have_an_initializer_1048", "A rest parameter cannot have an initializer."),
A_set_accessor_must_have_exactly_one_parameter: diag(1049, ts.DiagnosticCategory.Error, "A_set_accessor_must_have_exactly_one_parameter_1049", "A 'set' accessor must have exactly one parameter."),
@@ -5316,7 +5474,7 @@
Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided: diag(1205, ts.DiagnosticCategory.Error, "Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided_1205", "Cannot re-export a type when the '--isolatedModules' flag is provided."),
Decorators_are_not_valid_here: diag(1206, ts.DiagnosticCategory.Error, "Decorators_are_not_valid_here_1206", "Decorators are not valid here."),
Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: diag(1207, ts.DiagnosticCategory.Error, "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207", "Decorators cannot be applied to multiple get/set accessors of the same name."),
- Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided: diag(1208, ts.DiagnosticCategory.Error, "Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided_1208", "Cannot compile namespaces when the '--isolatedModules' flag is provided."),
+ All_files_must_be_modules_when_the_isolatedModules_flag_is_provided: diag(1208, ts.DiagnosticCategory.Error, "All_files_must_be_modules_when_the_isolatedModules_flag_is_provided_1208", "All files must be modules when the '--isolatedModules' flag is provided."),
Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: diag(1210, ts.DiagnosticCategory.Error, "Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode_1210", "Invalid use of '{0}'. Class definitions are automatically in strict mode."),
A_class_declaration_without_the_default_modifier_must_have_a_name: diag(1211, ts.DiagnosticCategory.Error, "A_class_declaration_without_the_default_modifier_must_have_a_name_1211", "A class declaration without the 'default' modifier must have a name."),
Identifier_expected_0_is_a_reserved_word_in_strict_mode: diag(1212, ts.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_in_strict_mode_1212", "Identifier expected. '{0}' is a reserved word in strict mode."),
@@ -5325,7 +5483,7 @@
Invalid_use_of_0_Modules_are_automatically_in_strict_mode: diag(1215, ts.DiagnosticCategory.Error, "Invalid_use_of_0_Modules_are_automatically_in_strict_mode_1215", "Invalid use of '{0}'. Modules are automatically in strict mode."),
Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules: diag(1216, ts.DiagnosticCategory.Error, "Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules_1216", "Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules."),
Export_assignment_is_not_supported_when_module_flag_is_system: diag(1218, ts.DiagnosticCategory.Error, "Export_assignment_is_not_supported_when_module_flag_is_system_1218", "Export assignment is not supported when '--module' flag is 'system'."),
- Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning: diag(1219, ts.DiagnosticCategory.Error, "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219", "Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning."),
+ Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning: diag(1219, ts.DiagnosticCategory.Error, "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219", "Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning."),
Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher: diag(1220, ts.DiagnosticCategory.Error, "Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher_1220", "Generators are only available when targeting ECMAScript 2015 or higher."),
Generators_are_not_allowed_in_an_ambient_context: diag(1221, ts.DiagnosticCategory.Error, "Generators_are_not_allowed_in_an_ambient_context_1221", "Generators are not allowed in an ambient context."),
An_overload_signature_cannot_be_declared_as_a_generator: diag(1222, ts.DiagnosticCategory.Error, "An_overload_signature_cannot_be_declared_as_a_generator_1222", "An overload signature cannot be declared as a generator."),
@@ -5364,6 +5522,8 @@
A_definite_assignment_assertion_is_not_permitted_in_this_context: diag(1255, ts.DiagnosticCategory.Error, "A_definite_assignment_assertion_is_not_permitted_in_this_context_1255", "A definite assignment assertion '!' is not permitted in this context."),
A_rest_element_must_be_last_in_a_tuple_type: diag(1256, ts.DiagnosticCategory.Error, "A_rest_element_must_be_last_in_a_tuple_type_1256", "A rest element must be last in a tuple type."),
A_required_element_cannot_follow_an_optional_element: diag(1257, ts.DiagnosticCategory.Error, "A_required_element_cannot_follow_an_optional_element_1257", "A required element cannot follow an optional element."),
+ Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation: diag(1258, ts.DiagnosticCategory.Error, "Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation_1258", "Definite assignment assertions can only be used along with a type annotation."),
+ Module_0_can_only_be_default_imported_using_the_1_flag: diag(1259, ts.DiagnosticCategory.Error, "Module_0_can_only_be_default_imported_using_the_1_flag_1259", "Module '{0}' can only be default-imported using the '{1}' flag"),
with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
await_expression_is_only_allowed_within_an_async_function: diag(1308, ts.DiagnosticCategory.Error, "await_expression_is_only_allowed_within_an_async_function_1308", "'await' expression is only allowed within an async function."),
can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment: diag(1312, ts.DiagnosticCategory.Error, "can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment_1312", "'=' can only be used in an object literal property inside a destructuring assignment."),
@@ -5408,7 +5568,8 @@
A_bigint_literal_cannot_use_exponential_notation: diag(1352, ts.DiagnosticCategory.Error, "A_bigint_literal_cannot_use_exponential_notation_1352", "A bigint literal cannot use exponential notation."),
A_bigint_literal_must_be_an_integer: diag(1353, ts.DiagnosticCategory.Error, "A_bigint_literal_must_be_an_integer_1353", "A bigint literal must be an integer."),
readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types: diag(1354, ts.DiagnosticCategory.Error, "readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types_1354", "'readonly' type modifier is only permitted on array and tuple literal types."),
- A_const_assertion_can_only_be_applied_to_a_string_number_boolean_array_or_object_literal: diag(1355, ts.DiagnosticCategory.Error, "A_const_assertion_can_only_be_applied_to_a_string_number_boolean_array_or_object_literal_1355", "A 'const' assertion can only be applied to a string, number, boolean, array, or object literal."),
+ A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals: diag(1355, ts.DiagnosticCategory.Error, "A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array__1355", "A 'const' assertions can only be applied to references to enum members, or string, number, boolean, array, or object literals."),
+ Did_you_mean_to_mark_this_function_as_async: diag(1356, ts.DiagnosticCategory.Error, "Did_you_mean_to_mark_this_function_as_async_1356", "Did you mean to mark this function as 'async'?"),
Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2301, ts.DiagnosticCategory.Error, "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
Static_members_cannot_reference_class_type_parameters: diag(2302, ts.DiagnosticCategory.Error, "Static_members_cannot_reference_class_type_parameters_2302", "Static members cannot reference class type parameters."),
@@ -5690,6 +5851,7 @@
Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig: diag(2591, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_types_Slashnode_and_th_2591", "Cannot find name '{0}'. Do you need to install type definitions for node? Try `npm i @types/node` and then add `node` to the types field in your tsconfig."),
Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_types_Slashjquery_and_then_add_jquery_to_the_types_field_in_your_tsconfig: diag(2592, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_types_Slashjquery_an_2592", "Cannot find name '{0}'. Do you need to install type definitions for jQuery? Try `npm i @types/jquery` and then add `jquery` to the types field in your tsconfig."),
Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_types_Slashjest_or_npm_i_types_Slashmocha_and_then_add_jest_or_mocha_to_the_types_field_in_your_tsconfig: diag(2593, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_types_Slashje_2593", "Cannot find name '{0}'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig."),
+ This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag: diag(2594, ts.DiagnosticCategory.Error, "This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594", "This module is declared with using 'export =', and can only be used with a default import when using the '{0}' flag."),
JSX_element_attributes_type_0_may_not_be_a_union_type: diag(2600, ts.DiagnosticCategory.Error, "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", "JSX element attributes type '{0}' may not be a union type."),
The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: diag(2601, ts.DiagnosticCategory.Error, "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", "The return type of a JSX element constructor must return an object type."),
JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: diag(2602, ts.DiagnosticCategory.Error, "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist."),
@@ -5802,6 +5964,7 @@
Circularity_originates_in_type_at_this_location: diag(2751, ts.DiagnosticCategory.Error, "Circularity_originates_in_type_at_this_location_2751", "Circularity originates in type at this location."),
The_first_export_default_is_here: diag(2752, ts.DiagnosticCategory.Error, "The_first_export_default_is_here_2752", "The first export default is here."),
Another_export_default_is_here: diag(2753, ts.DiagnosticCategory.Error, "Another_export_default_is_here_2753", "Another export default is here."),
+ super_may_not_use_type_arguments: diag(2754, ts.DiagnosticCategory.Error, "super_may_not_use_type_arguments_2754", "'super' may not use type arguments."),
Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -5886,6 +6049,7 @@
Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4101, ts.DiagnosticCategory.Error, "Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2_4101", "Method '{0}' of exported interface has or is using name '{1}' from private module '{2}'."),
Method_0_of_exported_interface_has_or_is_using_private_name_1: diag(4102, ts.DiagnosticCategory.Error, "Method_0_of_exported_interface_has_or_is_using_private_name_1_4102", "Method '{0}' of exported interface has or is using private name '{1}'."),
Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1: diag(4103, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1_4103", "Type parameter '{0}' of exported mapped object type is using private name '{1}'."),
+ The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1: diag(4104, ts.DiagnosticCategory.Error, "The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1_4104", "The type '{0}' is 'readonly' and cannot be assigned to the mutable type '{1}'."),
The_current_host_does_not_support_the_0_option: diag(5001, ts.DiagnosticCategory.Error, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, ts.DiagnosticCategory.Error, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, ts.DiagnosticCategory.Error, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
@@ -5919,6 +6083,8 @@
Option_resolveJsonModule_can_only_be_specified_when_module_code_generation_is_commonjs_amd_es2015_or_esNext: diag(5071, ts.DiagnosticCategory.Error, "Option_resolveJsonModule_can_only_be_specified_when_module_code_generation_is_commonjs_amd_es2015_or_5071", "Option '--resolveJsonModule' can only be specified when module code generation is 'commonjs', 'amd', 'es2015' or 'esNext'."),
Unknown_build_option_0: diag(5072, ts.DiagnosticCategory.Error, "Unknown_build_option_0_5072", "Unknown build option '{0}'."),
Build_option_0_requires_a_value_of_type_1: diag(5073, ts.DiagnosticCategory.Error, "Build_option_0_requires_a_value_of_type_1_5073", "Build option '{0}' requires a value of type {1}."),
+ Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified: diag(5074, ts.DiagnosticCategory.Error, "Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBui_5074", "Option '--incremental' can only be specified using tsconfig, emitting to single file or when option `--tsBuildInfoFile` is specified."),
+ _0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_constraint_2: diag(5075, ts.DiagnosticCategory.Error, "_0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_5075", "'{0}' is assignable to the constraint of type '{1}', but '{1}' could be instantiated with a different subtype of constraint '{2}'."),
Generates_a_sourcemap_for_each_corresponding_d_ts_file: diag(6000, ts.DiagnosticCategory.Message, "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000", "Generates a sourcemap for each corresponding '.d.ts' file."),
Concatenate_and_emit_output_to_single_file: diag(6001, ts.DiagnosticCategory.Message, "Concatenate_and_emit_output_to_single_file_6001", "Concatenate and emit output to single file."),
Generates_corresponding_d_ts_file: diag(6002, ts.DiagnosticCategory.Message, "Generates_corresponding_d_ts_file_6002", "Generates corresponding '.d.ts' file."),
@@ -6095,7 +6261,6 @@
Enable_strict_checking_of_property_initialization_in_classes: diag(6187, ts.DiagnosticCategory.Message, "Enable_strict_checking_of_property_initialization_in_classes_6187", "Enable strict checking of property initialization in classes."),
Numeric_separators_are_not_allowed_here: diag(6188, ts.DiagnosticCategory.Error, "Numeric_separators_are_not_allowed_here_6188", "Numeric separators are not allowed here."),
Multiple_consecutive_numeric_separators_are_not_permitted: diag(6189, ts.DiagnosticCategory.Error, "Multiple_consecutive_numeric_separators_are_not_permitted_6189", "Multiple consecutive numeric separators are not permitted."),
- Found_package_json_at_0_Package_ID_is_1: diag(6190, ts.DiagnosticCategory.Message, "Found_package_json_at_0_Package_ID_is_1_6190", "Found 'package.json' at '{0}'. Package ID is '{1}'."),
Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen: diag(6191, ts.DiagnosticCategory.Message, "Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen_6191", "Whether to keep outdated console output in watch mode instead of clearing the screen."),
All_imports_in_import_declaration_are_unused: diag(6192, ts.DiagnosticCategory.Error, "All_imports_in_import_declaration_are_unused_6192", "All imports in import declaration are unused.", /*reportsUnnecessary*/ true),
Found_1_error_Watching_for_file_changes: diag(6193, ts.DiagnosticCategory.Message, "Found_1_error_Watching_for_file_changes_6193", "Found 1 error. Watching for file changes."),
@@ -6122,6 +6287,9 @@
Using_compiler_options_of_project_reference_redirect_0: diag(6215, ts.DiagnosticCategory.Message, "Using_compiler_options_of_project_reference_redirect_0_6215", "Using compiler options of project reference redirect '{0}'."),
Found_1_error: diag(6216, ts.DiagnosticCategory.Message, "Found_1_error_6216", "Found 1 error."),
Found_0_errors: diag(6217, ts.DiagnosticCategory.Message, "Found_0_errors_6217", "Found {0} errors."),
+ Module_name_0_was_successfully_resolved_to_1_with_Package_ID_2: diag(6218, ts.DiagnosticCategory.Message, "Module_name_0_was_successfully_resolved_to_1_with_Package_ID_2_6218", "======== Module name '{0}' was successfully resolved to '{1}' with Package ID '{2}'. ========"),
+ Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3: diag(6219, ts.DiagnosticCategory.Message, "Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3_6219", "======== Type reference directive '{0}' was successfully resolved to '{1}' with Package ID '{2}', primary: {3}. ========"),
+ package_json_had_a_falsy_0_field: diag(6220, ts.DiagnosticCategory.Message, "package_json_had_a_falsy_0_field_6220", "'package.json' had a falsy '{0}' field."),
Projects_to_reference: diag(6300, ts.DiagnosticCategory.Message, "Projects_to_reference_6300", "Projects to reference"),
Enable_project_compilation: diag(6302, ts.DiagnosticCategory.Message, "Enable_project_compilation_6302", "Enable project compilation"),
Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0: diag(6202, ts.DiagnosticCategory.Error, "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202", "Project references may not form a circular graph. Cycle detected: {0}"),
@@ -6210,6 +6378,9 @@
Property_0_implicitly_has_type_any_but_a_better_type_for_its_set_accessor_may_be_inferred_from_usage: diag(7049, ts.DiagnosticCategory.Suggestion, "Property_0_implicitly_has_type_any_but_a_better_type_for_its_set_accessor_may_be_inferred_from_usage_7049", "Property '{0}' implicitly has type 'any', but a better type for its set accessor may be inferred from usage."),
_0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage: diag(7050, ts.DiagnosticCategory.Suggestion, "_0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage_7050", "'{0}' implicitly has an '{1}' return type, but a better type may be inferred from usage."),
Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1: diag(7051, ts.DiagnosticCategory.Error, "Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1_7051", "Parameter has a name but no type. Did you mean '{0}: {1}'?"),
+ Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1: diag(7052, ts.DiagnosticCategory.Error, "Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1_7052", "Element implicitly has an 'any' type because type '{0}' has no index signature. Did you mean to call '{1}' ?"),
+ Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1: diag(7053, ts.DiagnosticCategory.Error, "Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1_7053", "Element implicitly has an 'any' type because expression of type '{0}' can't be used to index type '{1}'."),
+ No_index_signature_with_a_parameter_of_type_0_was_found_on_type_1: diag(7054, ts.DiagnosticCategory.Error, "No_index_signature_with_a_parameter_of_type_0_was_found_on_type_1_7054", "No index signature with a parameter of type '{0}' was found on type '{1}'."),
You_cannot_rename_this_element: diag(8000, ts.DiagnosticCategory.Error, "You_cannot_rename_this_element_8000", "You cannot rename this element."),
You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: diag(8001, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001", "You cannot rename elements that are defined in the standard TypeScript library."),
import_can_only_be_used_in_a_ts_file: diag(8002, ts.DiagnosticCategory.Error, "import_can_only_be_used_in_a_ts_file_8002", "'import ... =' can only be used in a .ts file."),
@@ -6371,8 +6542,6 @@
Add_all_missing_imports: diag(95064, ts.DiagnosticCategory.Message, "Add_all_missing_imports_95064", "Add all missing imports"),
Convert_to_async_function: diag(95065, ts.DiagnosticCategory.Message, "Convert_to_async_function_95065", "Convert to async function"),
Convert_all_to_async_functions: diag(95066, ts.DiagnosticCategory.Message, "Convert_all_to_async_functions_95066", "Convert all to async functions"),
- Generate_types_for_0: diag(95067, ts.DiagnosticCategory.Message, "Generate_types_for_0_95067", "Generate types for '{0}'"),
- Generate_types_for_all_packages_without_types: diag(95068, ts.DiagnosticCategory.Message, "Generate_types_for_all_packages_without_types_95068", "Generate types for all packages without types"),
Add_unknown_conversion_for_non_overlapping_types: diag(95069, ts.DiagnosticCategory.Message, "Add_unknown_conversion_for_non_overlapping_types_95069", "Add 'unknown' conversion for non-overlapping types"),
Add_unknown_to_all_conversions_of_non_overlapping_types: diag(95070, ts.DiagnosticCategory.Message, "Add_unknown_to_all_conversions_of_non_overlapping_types_95070", "Add 'unknown' to all conversions of non-overlapping types"),
Add_missing_new_operator_to_call: diag(95071, ts.DiagnosticCategory.Message, "Add_missing_new_operator_to_call_95071", "Add missing 'new' operator to call"),
@@ -6380,6 +6549,13 @@
Add_names_to_all_parameters_without_names: diag(95073, ts.DiagnosticCategory.Message, "Add_names_to_all_parameters_without_names_95073", "Add names to all parameters without names"),
Enable_the_experimentalDecorators_option_in_your_configuration_file: diag(95074, ts.DiagnosticCategory.Message, "Enable_the_experimentalDecorators_option_in_your_configuration_file_95074", "Enable the 'experimentalDecorators' option in your configuration file"),
Convert_parameters_to_destructured_object: diag(95075, ts.DiagnosticCategory.Message, "Convert_parameters_to_destructured_object_95075", "Convert parameters to destructured object"),
+ Allow_accessing_UMD_globals_from_modules: diag(95076, ts.DiagnosticCategory.Message, "Allow_accessing_UMD_globals_from_modules_95076", "Allow accessing UMD globals from modules."),
+ Extract_type: diag(95077, ts.DiagnosticCategory.Message, "Extract_type_95077", "Extract type"),
+ Extract_to_type_alias: diag(95078, ts.DiagnosticCategory.Message, "Extract_to_type_alias_95078", "Extract to type alias"),
+ Extract_to_typedef: diag(95079, ts.DiagnosticCategory.Message, "Extract_to_typedef_95079", "Extract to typedef"),
+ No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, ts.DiagnosticCategory.Error, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
+ Quoted_constructors_have_previously_been_interpreted_as_methods_which_is_incorrect_In_TypeScript_3_6_they_will_be_correctly_parsed_as_constructors_In_the_meantime_consider_using_constructor_to_write_a_constructor_or_constructor_to_write_a_method: diag(18005, ts.DiagnosticCategory.Error, "Quoted_constructors_have_previously_been_interpreted_as_methods_which_is_incorrect_In_TypeScript_3_6_18005", "Quoted constructors have previously been interpreted as methods, which is incorrect. In TypeScript 3.6, they will be correctly parsed as constructors. In the meantime, consider using 'constructor()' to write a constructor, or '[\"constructor\"]()' to write a method."),
+ Classes_may_not_have_a_field_named_constructor: diag(18006, ts.DiagnosticCategory.Error, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
};
})(ts || (ts = {}));
var ts;
@@ -6387,7 +6563,7 @@
var _a;
/* @internal */
function tokenIsIdentifierOrKeyword(token) {
- return token >= 72 /* Identifier */;
+ return token >= 73 /* Identifier */;
}
ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword;
/* @internal */
@@ -6396,85 +6572,85 @@
}
ts.tokenIsIdentifierOrKeywordOrGreaterThan = tokenIsIdentifierOrKeywordOrGreaterThan;
var textToKeywordObj = (_a = {
- abstract: 118 /* AbstractKeyword */,
- any: 120 /* AnyKeyword */,
- as: 119 /* AsKeyword */,
- bigint: 146 /* BigIntKeyword */,
- boolean: 123 /* BooleanKeyword */,
- break: 73 /* BreakKeyword */,
- case: 74 /* CaseKeyword */,
- catch: 75 /* CatchKeyword */,
- class: 76 /* ClassKeyword */,
- continue: 78 /* ContinueKeyword */,
- const: 77 /* ConstKeyword */
- },
- _a["" + "constructor"] = 124 /* ConstructorKeyword */,
- _a.debugger = 79 /* DebuggerKeyword */,
- _a.declare = 125 /* DeclareKeyword */,
- _a.default = 80 /* DefaultKeyword */,
- _a.delete = 81 /* DeleteKeyword */,
- _a.do = 82 /* DoKeyword */,
- _a.else = 83 /* ElseKeyword */,
- _a.enum = 84 /* EnumKeyword */,
- _a.export = 85 /* ExportKeyword */,
- _a.extends = 86 /* ExtendsKeyword */,
- _a.false = 87 /* FalseKeyword */,
- _a.finally = 88 /* FinallyKeyword */,
- _a.for = 89 /* ForKeyword */,
- _a.from = 144 /* FromKeyword */,
- _a.function = 90 /* FunctionKeyword */,
- _a.get = 126 /* GetKeyword */,
- _a.if = 91 /* IfKeyword */,
- _a.implements = 109 /* ImplementsKeyword */,
- _a.import = 92 /* ImportKeyword */,
- _a.in = 93 /* InKeyword */,
- _a.infer = 127 /* InferKeyword */,
- _a.instanceof = 94 /* InstanceOfKeyword */,
- _a.interface = 110 /* InterfaceKeyword */,
- _a.is = 128 /* IsKeyword */,
- _a.keyof = 129 /* KeyOfKeyword */,
- _a.let = 111 /* LetKeyword */,
- _a.module = 130 /* ModuleKeyword */,
- _a.namespace = 131 /* NamespaceKeyword */,
- _a.never = 132 /* NeverKeyword */,
- _a.new = 95 /* NewKeyword */,
- _a.null = 96 /* NullKeyword */,
- _a.number = 135 /* NumberKeyword */,
- _a.object = 136 /* ObjectKeyword */,
- _a.package = 112 /* PackageKeyword */,
- _a.private = 113 /* PrivateKeyword */,
- _a.protected = 114 /* ProtectedKeyword */,
- _a.public = 115 /* PublicKeyword */,
- _a.readonly = 133 /* ReadonlyKeyword */,
- _a.require = 134 /* RequireKeyword */,
- _a.global = 145 /* GlobalKeyword */,
- _a.return = 97 /* ReturnKeyword */,
- _a.set = 137 /* SetKeyword */,
- _a.static = 116 /* StaticKeyword */,
- _a.string = 138 /* StringKeyword */,
- _a.super = 98 /* SuperKeyword */,
- _a.switch = 99 /* SwitchKeyword */,
- _a.symbol = 139 /* SymbolKeyword */,
- _a.this = 100 /* ThisKeyword */,
- _a.throw = 101 /* ThrowKeyword */,
- _a.true = 102 /* TrueKeyword */,
- _a.try = 103 /* TryKeyword */,
- _a.type = 140 /* TypeKeyword */,
- _a.typeof = 104 /* TypeOfKeyword */,
- _a.undefined = 141 /* UndefinedKeyword */,
- _a.unique = 142 /* UniqueKeyword */,
- _a.unknown = 143 /* UnknownKeyword */,
- _a.var = 105 /* VarKeyword */,
- _a.void = 106 /* VoidKeyword */,
- _a.while = 107 /* WhileKeyword */,
- _a.with = 108 /* WithKeyword */,
- _a.yield = 117 /* YieldKeyword */,
- _a.async = 121 /* AsyncKeyword */,
- _a.await = 122 /* AwaitKeyword */,
- _a.of = 147 /* OfKeyword */,
+ abstract: 119 /* AbstractKeyword */,
+ any: 121 /* AnyKeyword */,
+ as: 120 /* AsKeyword */,
+ bigint: 147 /* BigIntKeyword */,
+ boolean: 124 /* BooleanKeyword */,
+ break: 74 /* BreakKeyword */,
+ case: 75 /* CaseKeyword */,
+ catch: 76 /* CatchKeyword */,
+ class: 77 /* ClassKeyword */,
+ continue: 79 /* ContinueKeyword */,
+ const: 78 /* ConstKeyword */
+ },
+ _a["" + "constructor"] = 125 /* ConstructorKeyword */,
+ _a.debugger = 80 /* DebuggerKeyword */,
+ _a.declare = 126 /* DeclareKeyword */,
+ _a.default = 81 /* DefaultKeyword */,
+ _a.delete = 82 /* DeleteKeyword */,
+ _a.do = 83 /* DoKeyword */,
+ _a.else = 84 /* ElseKeyword */,
+ _a.enum = 85 /* EnumKeyword */,
+ _a.export = 86 /* ExportKeyword */,
+ _a.extends = 87 /* ExtendsKeyword */,
+ _a.false = 88 /* FalseKeyword */,
+ _a.finally = 89 /* FinallyKeyword */,
+ _a.for = 90 /* ForKeyword */,
+ _a.from = 145 /* FromKeyword */,
+ _a.function = 91 /* FunctionKeyword */,
+ _a.get = 127 /* GetKeyword */,
+ _a.if = 92 /* IfKeyword */,
+ _a.implements = 110 /* ImplementsKeyword */,
+ _a.import = 93 /* ImportKeyword */,
+ _a.in = 94 /* InKeyword */,
+ _a.infer = 128 /* InferKeyword */,
+ _a.instanceof = 95 /* InstanceOfKeyword */,
+ _a.interface = 111 /* InterfaceKeyword */,
+ _a.is = 129 /* IsKeyword */,
+ _a.keyof = 130 /* KeyOfKeyword */,
+ _a.let = 112 /* LetKeyword */,
+ _a.module = 131 /* ModuleKeyword */,
+ _a.namespace = 132 /* NamespaceKeyword */,
+ _a.never = 133 /* NeverKeyword */,
+ _a.new = 96 /* NewKeyword */,
+ _a.null = 97 /* NullKeyword */,
+ _a.number = 136 /* NumberKeyword */,
+ _a.object = 137 /* ObjectKeyword */,
+ _a.package = 113 /* PackageKeyword */,
+ _a.private = 114 /* PrivateKeyword */,
+ _a.protected = 115 /* ProtectedKeyword */,
+ _a.public = 116 /* PublicKeyword */,
+ _a.readonly = 134 /* ReadonlyKeyword */,
+ _a.require = 135 /* RequireKeyword */,
+ _a.global = 146 /* GlobalKeyword */,
+ _a.return = 98 /* ReturnKeyword */,
+ _a.set = 138 /* SetKeyword */,
+ _a.static = 117 /* StaticKeyword */,
+ _a.string = 139 /* StringKeyword */,
+ _a.super = 99 /* SuperKeyword */,
+ _a.switch = 100 /* SwitchKeyword */,
+ _a.symbol = 140 /* SymbolKeyword */,
+ _a.this = 101 /* ThisKeyword */,
+ _a.throw = 102 /* ThrowKeyword */,
+ _a.true = 103 /* TrueKeyword */,
+ _a.try = 104 /* TryKeyword */,
+ _a.type = 141 /* TypeKeyword */,
+ _a.typeof = 105 /* TypeOfKeyword */,
+ _a.undefined = 142 /* UndefinedKeyword */,
+ _a.unique = 143 /* UniqueKeyword */,
+ _a.unknown = 144 /* UnknownKeyword */,
+ _a.var = 106 /* VarKeyword */,
+ _a.void = 107 /* VoidKeyword */,
+ _a.while = 108 /* WhileKeyword */,
+ _a.with = 109 /* WithKeyword */,
+ _a.yield = 118 /* YieldKeyword */,
+ _a.async = 122 /* AsyncKeyword */,
+ _a.await = 123 /* AwaitKeyword */,
+ _a.of = 148 /* OfKeyword */,
_a);
var textToKeyword = ts.createMapFromTemplate(textToKeywordObj);
- var textToToken = ts.createMapFromTemplate(__assign({}, textToKeywordObj, { "{": 18 /* OpenBraceToken */, "}": 19 /* CloseBraceToken */, "(": 20 /* OpenParenToken */, ")": 21 /* CloseParenToken */, "[": 22 /* OpenBracketToken */, "]": 23 /* CloseBracketToken */, ".": 24 /* DotToken */, "...": 25 /* DotDotDotToken */, ";": 26 /* SemicolonToken */, ",": 27 /* CommaToken */, "<": 28 /* LessThanToken */, ">": 30 /* GreaterThanToken */, "<=": 31 /* LessThanEqualsToken */, ">=": 32 /* GreaterThanEqualsToken */, "==": 33 /* EqualsEqualsToken */, "!=": 34 /* ExclamationEqualsToken */, "===": 35 /* EqualsEqualsEqualsToken */, "!==": 36 /* ExclamationEqualsEqualsToken */, "=>": 37 /* EqualsGreaterThanToken */, "+": 38 /* PlusToken */, "-": 39 /* MinusToken */, "**": 41 /* AsteriskAsteriskToken */, "*": 40 /* AsteriskToken */, "/": 42 /* SlashToken */, "%": 43 /* PercentToken */, "++": 44 /* PlusPlusToken */, "--": 45 /* MinusMinusToken */, "<<": 46 /* LessThanLessThanToken */, "</": 29 /* LessThanSlashToken */, ">>": 47 /* GreaterThanGreaterThanToken */, ">>>": 48 /* GreaterThanGreaterThanGreaterThanToken */, "&": 49 /* AmpersandToken */, "|": 50 /* BarToken */, "^": 51 /* CaretToken */, "!": 52 /* ExclamationToken */, "~": 53 /* TildeToken */, "&&": 54 /* AmpersandAmpersandToken */, "||": 55 /* BarBarToken */, "?": 56 /* QuestionToken */, ":": 57 /* ColonToken */, "=": 59 /* EqualsToken */, "+=": 60 /* PlusEqualsToken */, "-=": 61 /* MinusEqualsToken */, "*=": 62 /* AsteriskEqualsToken */, "**=": 63 /* AsteriskAsteriskEqualsToken */, "/=": 64 /* SlashEqualsToken */, "%=": 65 /* PercentEqualsToken */, "<<=": 66 /* LessThanLessThanEqualsToken */, ">>=": 67 /* GreaterThanGreaterThanEqualsToken */, ">>>=": 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */, "&=": 69 /* AmpersandEqualsToken */, "|=": 70 /* BarEqualsToken */, "^=": 71 /* CaretEqualsToken */, "@": 58 /* AtToken */ }));
+ var textToToken = ts.createMapFromTemplate(__assign({}, textToKeywordObj, { "{": 18 /* OpenBraceToken */, "}": 19 /* CloseBraceToken */, "(": 20 /* OpenParenToken */, ")": 21 /* CloseParenToken */, "[": 22 /* OpenBracketToken */, "]": 23 /* CloseBracketToken */, ".": 24 /* DotToken */, "...": 25 /* DotDotDotToken */, ";": 26 /* SemicolonToken */, ",": 27 /* CommaToken */, "<": 28 /* LessThanToken */, ">": 30 /* GreaterThanToken */, "<=": 31 /* LessThanEqualsToken */, ">=": 32 /* GreaterThanEqualsToken */, "==": 33 /* EqualsEqualsToken */, "!=": 34 /* ExclamationEqualsToken */, "===": 35 /* EqualsEqualsEqualsToken */, "!==": 36 /* ExclamationEqualsEqualsToken */, "=>": 37 /* EqualsGreaterThanToken */, "+": 38 /* PlusToken */, "-": 39 /* MinusToken */, "**": 41 /* AsteriskAsteriskToken */, "*": 40 /* AsteriskToken */, "/": 42 /* SlashToken */, "%": 43 /* PercentToken */, "++": 44 /* PlusPlusToken */, "--": 45 /* MinusMinusToken */, "<<": 46 /* LessThanLessThanToken */, "</": 29 /* LessThanSlashToken */, ">>": 47 /* GreaterThanGreaterThanToken */, ">>>": 48 /* GreaterThanGreaterThanGreaterThanToken */, "&": 49 /* AmpersandToken */, "|": 50 /* BarToken */, "^": 51 /* CaretToken */, "!": 52 /* ExclamationToken */, "~": 53 /* TildeToken */, "&&": 54 /* AmpersandAmpersandToken */, "||": 55 /* BarBarToken */, "?": 56 /* QuestionToken */, ":": 57 /* ColonToken */, "=": 60 /* EqualsToken */, "+=": 61 /* PlusEqualsToken */, "-=": 62 /* MinusEqualsToken */, "*=": 63 /* AsteriskEqualsToken */, "**=": 64 /* AsteriskAsteriskEqualsToken */, "/=": 65 /* SlashEqualsToken */, "%=": 66 /* PercentEqualsToken */, "<<=": 67 /* LessThanLessThanEqualsToken */, ">>=": 68 /* GreaterThanGreaterThanEqualsToken */, ">>>=": 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */, "&=": 70 /* AmpersandEqualsToken */, "|=": 71 /* BarEqualsToken */, "^=": 72 /* CaretEqualsToken */, "@": 58 /* AtToken */ }));
/*
As per ECMAScript Language Specification 3th Edition, Section 7.6: Identifiers
IdentifierStart ::
@@ -7088,8 +7264,8 @@
getTokenValue: function () { return tokenValue; },
hasExtendedUnicodeEscape: function () { return (tokenFlags & 8 /* ExtendedUnicodeEscape */) !== 0; },
hasPrecedingLineBreak: function () { return (tokenFlags & 1 /* PrecedingLineBreak */) !== 0; },
- isIdentifier: function () { return token === 72 /* Identifier */ || token > 108 /* LastReservedWord */; },
- isReservedWord: function () { return token >= 73 /* FirstReservedWord */ && token <= 108 /* LastReservedWord */; },
+ isIdentifier: function () { return token === 73 /* Identifier */ || token > 109 /* LastReservedWord */; },
+ isReservedWord: function () { return token >= 74 /* FirstReservedWord */ && token <= 109 /* LastReservedWord */; },
isUnterminated: function () { return (tokenFlags & 4 /* Unterminated */) !== 0; },
getTokenFlags: function () { return tokenFlags; },
reScanGreaterToken: reScanGreaterToken,
@@ -7100,7 +7276,7 @@
reScanJsxToken: reScanJsxToken,
reScanLessThanToken: reScanLessThanToken,
scanJsxToken: scanJsxToken,
- scanJSDocToken: scanJSDocToken,
+ scanJsDocToken: scanJsDocToken,
scan: scan,
getText: getText,
setText: setText,
@@ -7540,7 +7716,7 @@
}
}
}
- return token = 72 /* Identifier */;
+ return token = 73 /* Identifier */;
}
function scanBinaryOrOctalDigits(base) {
var value = "";
@@ -7689,7 +7865,7 @@
return token = scanTemplateAndSetTokenValue();
case 37 /* percent */:
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 65 /* PercentEqualsToken */;
+ return pos += 2, token = 66 /* PercentEqualsToken */;
}
pos++;
return token = 43 /* PercentToken */;
@@ -7698,7 +7874,7 @@
return pos += 2, token = 54 /* AmpersandAmpersandToken */;
}
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 69 /* AmpersandEqualsToken */;
+ return pos += 2, token = 70 /* AmpersandEqualsToken */;
}
pos++;
return token = 49 /* AmpersandToken */;
@@ -7710,11 +7886,11 @@
return token = 21 /* CloseParenToken */;
case 42 /* asterisk */:
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 62 /* AsteriskEqualsToken */;
+ return pos += 2, token = 63 /* AsteriskEqualsToken */;
}
if (text.charCodeAt(pos + 1) === 42 /* asterisk */) {
if (text.charCodeAt(pos + 2) === 61 /* equals */) {
- return pos += 3, token = 63 /* AsteriskAsteriskEqualsToken */;
+ return pos += 3, token = 64 /* AsteriskAsteriskEqualsToken */;
}
return pos += 2, token = 41 /* AsteriskAsteriskToken */;
}
@@ -7730,7 +7906,7 @@
return pos += 2, token = 44 /* PlusPlusToken */;
}
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 60 /* PlusEqualsToken */;
+ return pos += 2, token = 61 /* PlusEqualsToken */;
}
pos++;
return token = 38 /* PlusToken */;
@@ -7742,7 +7918,7 @@
return pos += 2, token = 45 /* MinusMinusToken */;
}
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 61 /* MinusEqualsToken */;
+ return pos += 2, token = 62 /* MinusEqualsToken */;
}
pos++;
return token = 39 /* MinusToken */;
@@ -7806,7 +7982,7 @@
}
}
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 64 /* SlashEqualsToken */;
+ return pos += 2, token = 65 /* SlashEqualsToken */;
}
pos++;
return token = 42 /* SlashToken */;
@@ -7883,7 +8059,7 @@
}
if (text.charCodeAt(pos + 1) === 60 /* lessThan */) {
if (text.charCodeAt(pos + 2) === 61 /* equals */) {
- return pos += 3, token = 66 /* LessThanLessThanEqualsToken */;
+ return pos += 3, token = 67 /* LessThanLessThanEqualsToken */;
}
return pos += 2, token = 46 /* LessThanLessThanToken */;
}
@@ -7917,7 +8093,7 @@
return pos += 2, token = 37 /* EqualsGreaterThanToken */;
}
pos++;
- return token = 59 /* EqualsToken */;
+ return token = 60 /* EqualsToken */;
case 62 /* greaterThan */:
if (isConflictMarkerTrivia(text, pos)) {
pos = scanConflictMarkerTrivia(text, pos, error);
@@ -7941,7 +8117,7 @@
return token = 23 /* CloseBracketToken */;
case 94 /* caret */:
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 71 /* CaretEqualsToken */;
+ return pos += 2, token = 72 /* CaretEqualsToken */;
}
pos++;
return token = 51 /* CaretToken */;
@@ -7962,7 +8138,7 @@
return pos += 2, token = 55 /* BarBarToken */;
}
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 70 /* BarEqualsToken */;
+ return pos += 2, token = 71 /* BarEqualsToken */;
}
pos++;
return token = 50 /* BarToken */;
@@ -8016,12 +8192,12 @@
if (text.charCodeAt(pos) === 62 /* greaterThan */) {
if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) {
if (text.charCodeAt(pos + 2) === 61 /* equals */) {
- return pos += 3, token = 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */;
+ return pos += 3, token = 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */;
}
return pos += 2, token = 48 /* GreaterThanGreaterThanGreaterThanToken */;
}
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 67 /* GreaterThanGreaterThanEqualsToken */;
+ return pos += 2, token = 68 /* GreaterThanGreaterThanEqualsToken */;
}
pos++;
return token = 47 /* GreaterThanGreaterThanToken */;
@@ -8034,7 +8210,7 @@
return token;
}
function reScanSlashToken() {
- if (token === 42 /* SlashToken */ || token === 64 /* SlashEqualsToken */) {
+ if (token === 42 /* SlashToken */ || token === 65 /* SlashEqualsToken */) {
var p = tokenPos + 1;
var inEscape = false;
var inCharacterClass = false;
@@ -8183,7 +8359,7 @@
return scan();
}
}
- function scanJSDocToken() {
+ function scanJsDocToken() {
startPos = tokenPos = pos;
tokenFlags = 0;
if (pos >= end) {
@@ -8219,21 +8395,16 @@
case 60 /* lessThan */:
return token = 28 /* LessThanToken */;
case 61 /* equals */:
- return token = 59 /* EqualsToken */;
+ return token = 60 /* EqualsToken */;
case 44 /* comma */:
return token = 27 /* CommaToken */;
case 46 /* dot */:
return token = 24 /* DotToken */;
case 96 /* backtick */:
- while (pos < end && text.charCodeAt(pos) !== 96 /* backtick */) {
- pos++;
- }
- tokenValue = text.substring(tokenPos + 1, pos);
- pos++;
- return token = 14 /* NoSubstitutionTemplateLiteral */;
+ return token = 59 /* BacktickToken */;
}
- if (isIdentifierStart(ch, 7 /* Latest */)) {
- while (isIdentifierPart(text.charCodeAt(pos), 7 /* Latest */) && pos < end) {
+ if (isIdentifierStart(ch, 8 /* Latest */)) {
+ while (isIdentifierPart(text.charCodeAt(pos), 8 /* Latest */) && pos < end) {
pos++;
}
tokenValue = text.substring(tokenPos, pos);
@@ -8418,11 +8589,16 @@
}
ts.toPath = toPath;
function changesAffectModuleResolution(oldOptions, newOptions) {
- return oldOptions.configFilePath !== newOptions.configFilePath || ts.moduleResolutionOptionDeclarations.some(function (o) {
+ return oldOptions.configFilePath !== newOptions.configFilePath ||
+ optionsHaveModuleResolutionChanges(oldOptions, newOptions);
+ }
+ ts.changesAffectModuleResolution = changesAffectModuleResolution;
+ function optionsHaveModuleResolutionChanges(oldOptions, newOptions) {
+ return ts.moduleResolutionOptionDeclarations.some(function (o) {
return !ts.isJsonEqual(ts.getCompilerOptionValue(oldOptions, o), ts.getCompilerOptionValue(newOptions, o));
});
}
- ts.changesAffectModuleResolution = changesAffectModuleResolution;
+ ts.optionsHaveModuleResolutionChanges = optionsHaveModuleResolutionChanges;
function findAncestor(node, callback) {
while (node) {
var result = callback(node);
@@ -8591,7 +8767,7 @@
}
}
function getSourceFileOfNode(node) {
- while (node && node.kind !== 284 /* SourceFile */) {
+ while (node && node.kind !== 285 /* SourceFile */) {
node = node.parent;
}
return node;
@@ -8599,11 +8775,11 @@
ts.getSourceFileOfNode = getSourceFileOfNode;
function isStatementWithLocals(node) {
switch (node.kind) {
- case 218 /* Block */:
- case 246 /* CaseBlock */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 219 /* Block */:
+ case 247 /* CaseBlock */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
return true;
}
return false;
@@ -8771,7 +8947,7 @@
// the syntax list itself considers them as normal trivia. Therefore if we simply skip
// trivia for the list, we may have skipped the JSDocComment as well. So we should process its
// first child to determine the actual position of its first token.
- if (node.kind === 311 /* SyntaxList */ && node._children.length > 0) {
+ if (node.kind === 312 /* SyntaxList */ && node._children.length > 0) {
return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc);
}
return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos);
@@ -8790,7 +8966,7 @@
}
ts.getSourceTextOfNodeFromSourceFile = getSourceTextOfNodeFromSourceFile;
function isJSDocTypeExpressionOrChild(node) {
- return node.kind === 288 /* JSDocTypeExpression */ || (node.parent && isJSDocTypeExpressionOrChild(node.parent));
+ return node.kind === 289 /* JSDocTypeExpression */ || (node.parent && isJSDocTypeExpressionOrChild(node.parent));
}
function getTextOfNodeFromSourceText(sourceText, node, includeTrivia) {
if (includeTrivia === void 0) { includeTrivia = false; }
@@ -8882,7 +9058,7 @@
ts.isBlockOrCatchScoped = isBlockOrCatchScoped;
function isCatchClauseVariableDeclarationOrBindingElement(declaration) {
var node = getRootDeclaration(declaration);
- return node.kind === 237 /* VariableDeclaration */ && node.parent.kind === 274 /* CatchClause */;
+ return node.kind === 238 /* VariableDeclaration */ && node.parent.kind === 275 /* CatchClause */;
}
ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement;
function isAmbientModule(node) {
@@ -8914,11 +9090,11 @@
ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol;
function isShorthandAmbientModule(node) {
// The only kind of module that can be missing a body is a shorthand ambient module.
- return node && node.kind === 244 /* ModuleDeclaration */ && (!node.body);
+ return node && node.kind === 245 /* ModuleDeclaration */ && (!node.body);
}
function isBlockScopedContainerTopLevel(node) {
- return node.kind === 284 /* SourceFile */ ||
- node.kind === 244 /* ModuleDeclaration */ ||
+ return node.kind === 285 /* SourceFile */ ||
+ node.kind === 245 /* ModuleDeclaration */ ||
ts.isFunctionLike(node);
}
ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel;
@@ -8935,9 +9111,9 @@
// - defined in the top level scope and source file is an external module
// - defined inside ambient module declaration located in the top level scope and source file not an external module
switch (node.parent.kind) {
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return ts.isExternalModule(node.parent);
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
return isAmbientModule(node.parent.parent) && ts.isSourceFile(node.parent.parent.parent) && !ts.isExternalModule(node.parent.parent.parent);
}
return false;
@@ -8953,22 +9129,22 @@
ts.isEffectiveExternalModule = isEffectiveExternalModule;
function isBlockScope(node, parentNode) {
switch (node.kind) {
- case 284 /* SourceFile */:
- case 246 /* CaseBlock */:
- case 274 /* CatchClause */:
- case 244 /* ModuleDeclaration */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 157 /* Constructor */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 285 /* SourceFile */:
+ case 247 /* CaseBlock */:
+ case 275 /* CatchClause */:
+ case 245 /* ModuleDeclaration */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 158 /* Constructor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return true;
- case 218 /* Block */:
+ case 219 /* Block */:
// function block is not considered block-scope container
// see comment in binder.ts: bind(...), case for SyntaxKind.Block
return !ts.isFunctionLike(parentNode);
@@ -8978,9 +9154,9 @@
ts.isBlockScope = isBlockScope;
function isDeclarationWithTypeParameters(node) {
switch (node.kind) {
- case 302 /* JSDocCallbackTag */:
- case 309 /* JSDocTypedefTag */:
- case 298 /* JSDocSignature */:
+ case 303 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 299 /* JSDocSignature */:
return true;
default:
ts.assertType(node);
@@ -8990,25 +9166,25 @@
ts.isDeclarationWithTypeParameters = isDeclarationWithTypeParameters;
function isDeclarationWithTypeParameterChildren(node) {
switch (node.kind) {
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 155 /* MethodSignature */:
- case 162 /* IndexSignature */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 294 /* JSDocFunctionType */:
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 308 /* JSDocTemplateTag */:
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 156 /* MethodSignature */:
+ case 163 /* IndexSignature */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 295 /* JSDocFunctionType */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 309 /* JSDocTemplateTag */:
+ case 240 /* FunctionDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return true;
default:
ts.assertType(node);
@@ -9018,8 +9194,8 @@
ts.isDeclarationWithTypeParameterChildren = isDeclarationWithTypeParameterChildren;
function isAnyImportSyntax(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return true;
default:
return false;
@@ -9028,15 +9204,15 @@
ts.isAnyImportSyntax = isAnyImportSyntax;
function isLateVisibilityPaintedStatement(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
- case 219 /* VariableStatement */:
- case 240 /* ClassDeclaration */:
- case 239 /* FunctionDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 220 /* VariableStatement */:
+ case 241 /* ClassDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
return true;
default:
return false;
@@ -9066,13 +9242,13 @@
ts.getNameFromIndexInfo = getNameFromIndexInfo;
function getTextOfPropertyName(name) {
switch (name.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return name.escapedText;
case 10 /* StringLiteral */:
case 8 /* NumericLiteral */:
case 14 /* NoSubstitutionTemplateLiteral */:
return ts.escapeLeadingUnderscores(name.text);
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
if (isStringOrNumericLiteralLike(name.expression))
return ts.escapeLeadingUnderscores(name.expression.text);
return ts.Debug.fail("Text of property name cannot be read from non-literal-valued ComputedPropertyNames");
@@ -9083,11 +9259,11 @@
ts.getTextOfPropertyName = getTextOfPropertyName;
function entityNameToString(name) {
switch (name.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return getFullWidth(name) === 0 ? ts.idText(name) : getTextOfNode(name);
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
return entityNameToString(name.left) + "." + entityNameToString(name.right);
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return entityNameToString(name.expression) + "." + entityNameToString(name.name);
default:
throw ts.Debug.assertNever(name);
@@ -9132,7 +9308,7 @@
ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition;
function getErrorSpanForArrowFunction(sourceFile, node) {
var pos = ts.skipTrivia(sourceFile.text, node.pos);
- if (node.body && node.body.kind === 218 /* Block */) {
+ if (node.body && node.body.kind === 219 /* Block */) {
var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line;
var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line;
if (startLine < endLine) {
@@ -9146,7 +9322,7 @@
function getErrorSpanForNode(sourceFile, node) {
var errorNode = node;
switch (node.kind) {
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
var pos_1 = ts.skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false);
if (pos_1 === sourceFile.text.length) {
// file is empty - return span for the beginning of the file
@@ -9155,25 +9331,25 @@
return getSpanOfTokenAtPosition(sourceFile, pos_1);
// This list is a work in progress. Add missing node kinds to improve their error
// spans.
- case 237 /* VariableDeclaration */:
- case 186 /* BindingElement */:
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 243 /* EnumDeclaration */:
- case 278 /* EnumMember */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 242 /* TypeAliasDeclaration */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 238 /* VariableDeclaration */:
+ case 187 /* BindingElement */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 279 /* EnumMember */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 243 /* TypeAliasDeclaration */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
errorNode = node.name;
break;
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return getErrorSpanForArrowFunction(sourceFile, node);
}
if (errorNode === undefined) {
@@ -9222,11 +9398,11 @@
}
ts.isLet = isLet;
function isSuperCall(n) {
- return n.kind === 191 /* CallExpression */ && n.expression.kind === 98 /* SuperKeyword */;
+ return n.kind === 192 /* CallExpression */ && n.expression.kind === 99 /* SuperKeyword */;
}
ts.isSuperCall = isSuperCall;
function isImportCall(n) {
- return n.kind === 191 /* CallExpression */ && n.expression.kind === 92 /* ImportKeyword */;
+ return n.kind === 192 /* CallExpression */ && n.expression.kind === 93 /* ImportKeyword */;
}
ts.isImportCall = isImportCall;
function isLiteralImportTypeNode(n) {
@@ -9234,7 +9410,7 @@
}
ts.isLiteralImportTypeNode = isLiteralImportTypeNode;
function isPrologueDirective(node) {
- return node.kind === 221 /* ExpressionStatement */
+ return node.kind === 222 /* ExpressionStatement */
&& node.expression.kind === 10 /* StringLiteral */;
}
ts.isPrologueDirective = isPrologueDirective;
@@ -9243,11 +9419,11 @@
}
ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode;
function getJSDocCommentRanges(node, text) {
- var commentRanges = (node.kind === 151 /* Parameter */ ||
- node.kind === 150 /* TypeParameter */ ||
- node.kind === 196 /* FunctionExpression */ ||
- node.kind === 197 /* ArrowFunction */ ||
- node.kind === 195 /* ParenthesizedExpression */) ?
+ var commentRanges = (node.kind === 152 /* Parameter */ ||
+ node.kind === 151 /* TypeParameter */ ||
+ node.kind === 197 /* FunctionExpression */ ||
+ node.kind === 198 /* ArrowFunction */ ||
+ node.kind === 196 /* ParenthesizedExpression */) ?
ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) :
ts.getLeadingCommentRanges(text, node.pos);
// True if the comment starts with '/**' but not if it is '/**/'
@@ -9263,48 +9439,48 @@
ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*<amd-dependency\s+path\s*=\s*)('|")(.+?)\2.*?\/>/;
var defaultLibReferenceRegEx = /^(\/\/\/\s*<reference\s+no-default-lib\s*=\s*)('|")(.+?)\2\s*\/>/;
function isPartOfTypeNode(node) {
- if (163 /* FirstTypeNode */ <= node.kind && node.kind <= 183 /* LastTypeNode */) {
+ if (164 /* FirstTypeNode */ <= node.kind && node.kind <= 184 /* LastTypeNode */) {
return true;
}
switch (node.kind) {
- case 120 /* AnyKeyword */:
- case 143 /* UnknownKeyword */:
- case 135 /* NumberKeyword */:
- case 146 /* BigIntKeyword */:
- case 138 /* StringKeyword */:
- case 123 /* BooleanKeyword */:
- case 139 /* SymbolKeyword */:
- case 136 /* ObjectKeyword */:
- case 141 /* UndefinedKeyword */:
- case 132 /* NeverKeyword */:
- return true;
- case 106 /* VoidKeyword */:
- return node.parent.kind !== 200 /* VoidExpression */;
- case 211 /* ExpressionWithTypeArguments */:
+ case 121 /* AnyKeyword */:
+ case 144 /* UnknownKeyword */:
+ case 136 /* NumberKeyword */:
+ case 147 /* BigIntKeyword */:
+ case 139 /* StringKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 137 /* ObjectKeyword */:
+ case 142 /* UndefinedKeyword */:
+ case 133 /* NeverKeyword */:
+ return true;
+ case 107 /* VoidKeyword */:
+ return node.parent.kind !== 201 /* VoidExpression */;
+ case 212 /* ExpressionWithTypeArguments */:
return !isExpressionWithTypeArgumentsInClassExtendsClause(node);
- case 150 /* TypeParameter */:
- return node.parent.kind === 181 /* MappedType */ || node.parent.kind === 176 /* InferType */;
+ case 151 /* TypeParameter */:
+ return node.parent.kind === 182 /* MappedType */ || node.parent.kind === 177 /* InferType */;
// Identifiers and qualified names may be type nodes, depending on their context. Climb
// above them to find the lowest container
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
// If the identifier is the RHS of a qualified name, then it's a type iff its parent is.
- if (node.parent.kind === 148 /* QualifiedName */ && node.parent.right === node) {
+ if (node.parent.kind === 149 /* QualifiedName */ && node.parent.right === node) {
node = node.parent;
}
- else if (node.parent.kind === 189 /* PropertyAccessExpression */ && node.parent.name === node) {
+ else if (node.parent.kind === 190 /* PropertyAccessExpression */ && node.parent.name === node) {
node = node.parent;
}
// At this point, node is either a qualified name or an identifier
- ts.Debug.assert(node.kind === 72 /* Identifier */ || node.kind === 148 /* QualifiedName */ || node.kind === 189 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'.");
+ ts.Debug.assert(node.kind === 73 /* Identifier */ || node.kind === 149 /* QualifiedName */ || node.kind === 190 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'.");
// falls through
- case 148 /* QualifiedName */:
- case 189 /* PropertyAccessExpression */:
- case 100 /* ThisKeyword */: {
+ case 149 /* QualifiedName */:
+ case 190 /* PropertyAccessExpression */:
+ case 101 /* ThisKeyword */: {
var parent = node.parent;
- if (parent.kind === 167 /* TypeQuery */) {
+ if (parent.kind === 168 /* TypeQuery */) {
return false;
}
- if (parent.kind === 183 /* ImportType */) {
+ if (parent.kind === 184 /* ImportType */) {
return !parent.isTypeOf;
}
// Do not recursively call isPartOfTypeNode on the parent. In the example:
@@ -9313,40 +9489,40 @@
//
// Calling isPartOfTypeNode would consider the qualified name A.B a type node.
// Only C and A.B.C are type nodes.
- if (163 /* FirstTypeNode */ <= parent.kind && parent.kind <= 183 /* LastTypeNode */) {
+ if (164 /* FirstTypeNode */ <= parent.kind && parent.kind <= 184 /* LastTypeNode */) {
return true;
}
switch (parent.kind) {
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return !isExpressionWithTypeArgumentsInClassExtendsClause(parent);
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
return node === parent.constraint;
- case 308 /* JSDocTemplateTag */:
+ case 309 /* JSDocTemplateTag */:
return node === parent.constraint;
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 151 /* Parameter */:
- case 237 /* VariableDeclaration */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 152 /* Parameter */:
+ case 238 /* VariableDeclaration */:
return node === parent.type;
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 157 /* Constructor */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 158 /* Constructor */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return node === parent.type;
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
return node === parent.type;
- case 194 /* TypeAssertionExpression */:
+ case 195 /* TypeAssertionExpression */:
return node === parent.type;
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
return ts.contains(parent.typeArguments, node);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
// TODO (drosen): TaggedTemplateExpressions may eventually support type arguments.
return false;
}
@@ -9371,23 +9547,23 @@
return traverse(body);
function traverse(node) {
switch (node.kind) {
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return visitor(node);
- case 246 /* CaseBlock */:
- case 218 /* Block */:
- case 222 /* IfStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 231 /* WithStatement */:
- case 232 /* SwitchStatement */:
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
- case 233 /* LabeledStatement */:
- case 235 /* TryStatement */:
- case 274 /* CatchClause */:
+ case 247 /* CaseBlock */:
+ case 219 /* Block */:
+ case 223 /* IfStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 232 /* WithStatement */:
+ case 233 /* SwitchStatement */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
+ case 234 /* LabeledStatement */:
+ case 236 /* TryStatement */:
+ case 275 /* CatchClause */:
return ts.forEachChild(node, traverse);
}
}
@@ -9397,26 +9573,26 @@
return traverse(body);
function traverse(node) {
switch (node.kind) {
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
visitor(node);
var operand = node.expression;
if (operand) {
traverse(operand);
}
return;
- case 243 /* EnumDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 244 /* EnumDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
// These are not allowed inside a generator now, but eventually they may be allowed
// as local types. Regardless, any yield statements contained within them should be
// skipped in this traversal.
return;
default:
if (ts.isFunctionLike(node)) {
- if (node.name && node.name.kind === 149 /* ComputedPropertyName */) {
+ if (node.name && node.name.kind === 150 /* ComputedPropertyName */) {
// Note that we will not include methods/accessors of a class because they would require
// first descending into the class. This is by design.
traverse(node.name.expression);
@@ -9439,10 +9615,10 @@
* @param node The type node.
*/
function getRestParameterElementType(node) {
- if (node && node.kind === 169 /* ArrayType */) {
+ if (node && node.kind === 170 /* ArrayType */) {
return node.elementType;
}
- else if (node && node.kind === 164 /* TypeReference */) {
+ else if (node && node.kind === 165 /* TypeReference */) {
return ts.singleOrUndefined(node.typeArguments);
}
else {
@@ -9452,12 +9628,12 @@
ts.getRestParameterElementType = getRestParameterElementType;
function getMembersOfDeclaration(node) {
switch (node.kind) {
- case 241 /* InterfaceDeclaration */:
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 168 /* TypeLiteral */:
+ case 242 /* InterfaceDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 169 /* TypeLiteral */:
return node.members;
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return node.properties;
}
}
@@ -9465,14 +9641,14 @@
function isVariableLike(node) {
if (node) {
switch (node.kind) {
- case 186 /* BindingElement */:
- case 278 /* EnumMember */:
- case 151 /* Parameter */:
- case 275 /* PropertyAssignment */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 276 /* ShorthandPropertyAssignment */:
- case 237 /* VariableDeclaration */:
+ case 187 /* BindingElement */:
+ case 279 /* EnumMember */:
+ case 152 /* Parameter */:
+ case 276 /* PropertyAssignment */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 277 /* ShorthandPropertyAssignment */:
+ case 238 /* VariableDeclaration */:
return true;
}
}
@@ -9484,8 +9660,8 @@
}
ts.isVariableLikeOrAccessor = isVariableLikeOrAccessor;
function isVariableDeclarationInVariableStatement(node) {
- return node.parent.kind === 238 /* VariableDeclarationList */
- && node.parent.parent.kind === 219 /* VariableStatement */;
+ return node.parent.kind === 239 /* VariableDeclarationList */
+ && node.parent.parent.kind === 220 /* VariableStatement */;
}
ts.isVariableDeclarationInVariableStatement = isVariableDeclarationInVariableStatement;
function isValidESSymbolDeclaration(node) {
@@ -9496,13 +9672,13 @@
ts.isValidESSymbolDeclaration = isValidESSymbolDeclaration;
function introducesArgumentsExoticObject(node) {
switch (node.kind) {
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
return true;
}
return false;
@@ -9513,7 +9689,7 @@
if (beforeUnwrapLabelCallback) {
beforeUnwrapLabelCallback(node);
}
- if (node.statement.kind !== 233 /* LabeledStatement */) {
+ if (node.statement.kind !== 234 /* LabeledStatement */) {
return node.statement;
}
node = node.statement;
@@ -9521,17 +9697,17 @@
}
ts.unwrapInnermostStatementOfLabel = unwrapInnermostStatementOfLabel;
function isFunctionBlock(node) {
- return node && node.kind === 218 /* Block */ && ts.isFunctionLike(node.parent);
+ return node && node.kind === 219 /* Block */ && ts.isFunctionLike(node.parent);
}
ts.isFunctionBlock = isFunctionBlock;
function isObjectLiteralMethod(node) {
- return node && node.kind === 156 /* MethodDeclaration */ && node.parent.kind === 188 /* ObjectLiteralExpression */;
+ return node && node.kind === 157 /* MethodDeclaration */ && node.parent.kind === 189 /* ObjectLiteralExpression */;
}
ts.isObjectLiteralMethod = isObjectLiteralMethod;
function isObjectLiteralOrClassExpressionMethod(node) {
- return node.kind === 156 /* MethodDeclaration */ &&
- (node.parent.kind === 188 /* ObjectLiteralExpression */ ||
- node.parent.kind === 209 /* ClassExpression */);
+ return node.kind === 157 /* MethodDeclaration */ &&
+ (node.parent.kind === 189 /* ObjectLiteralExpression */ ||
+ node.parent.kind === 210 /* ClassExpression */);
}
ts.isObjectLiteralOrClassExpressionMethod = isObjectLiteralOrClassExpressionMethod;
function isIdentifierTypePredicate(predicate) {
@@ -9544,7 +9720,7 @@
ts.isThisTypePredicate = isThisTypePredicate;
function getPropertyAssignment(objectLiteral, key, key2) {
return objectLiteral.properties.filter(function (property) {
- if (property.kind === 275 /* PropertyAssignment */) {
+ if (property.kind === 276 /* PropertyAssignment */) {
var propName = getTextOfPropertyName(property.name);
return key === propName || (!!key2 && key2 === propName);
}
@@ -9576,19 +9752,23 @@
return findAncestor(node.parent, ts.isFunctionLike);
}
ts.getContainingFunction = getContainingFunction;
+ function getContainingFunctionDeclaration(node) {
+ return findAncestor(node.parent, ts.isFunctionLikeDeclaration);
+ }
+ ts.getContainingFunctionDeclaration = getContainingFunctionDeclaration;
function getContainingClass(node) {
return findAncestor(node.parent, ts.isClassLike);
}
ts.getContainingClass = getContainingClass;
function getThisContainer(node, includeArrowFunctions) {
- ts.Debug.assert(node.kind !== 284 /* SourceFile */);
+ ts.Debug.assert(node.kind !== 285 /* SourceFile */);
while (true) {
node = node.parent;
if (!node) {
return ts.Debug.fail(); // If we never pass in a SourceFile, this should be unreachable, since we'll stop when we reach that.
}
switch (node.kind) {
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
// If the grandparent node is an object literal (as opposed to a class),
// then the computed property is not a 'this' container.
// A computed property name in a class needs to be a this container
@@ -9603,9 +9783,9 @@
// the *body* of the container.
node = node.parent;
break;
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
// Decorators are always applied outside of the body of a class or method.
- if (node.parent.kind === 151 /* Parameter */ && ts.isClassElement(node.parent.parent)) {
+ if (node.parent.kind === 152 /* Parameter */ && ts.isClassElement(node.parent.parent)) {
// If the decorator's parent is a Parameter, we resolve the this container from
// the grandparent class declaration.
node = node.parent.parent;
@@ -9616,26 +9796,26 @@
node = node.parent;
}
break;
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
if (!includeArrowFunctions) {
continue;
}
// falls through
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 244 /* ModuleDeclaration */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
- case 243 /* EnumDeclaration */:
- case 284 /* SourceFile */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 245 /* ModuleDeclaration */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
+ case 244 /* EnumDeclaration */:
+ case 285 /* SourceFile */:
return node;
}
}
@@ -9645,9 +9825,9 @@
var container = getThisContainer(node, /*includeArrowFunctions*/ false);
if (container) {
switch (container.kind) {
- case 157 /* Constructor */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
+ case 158 /* Constructor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
return container;
}
}
@@ -9669,27 +9849,27 @@
return node;
}
switch (node.kind) {
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
node = node.parent;
break;
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
if (!stopOnFunctions) {
continue;
}
// falls through
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return node;
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
// Decorators are always applied outside of the body of a class or method.
- if (node.parent.kind === 151 /* Parameter */ && ts.isClassElement(node.parent.parent)) {
+ if (node.parent.kind === 152 /* Parameter */ && ts.isClassElement(node.parent.parent)) {
// If the decorator's parent is a Parameter, we resolve the this container from
// the grandparent class declaration.
node = node.parent.parent;
@@ -9705,21 +9885,21 @@
}
ts.getSuperContainer = getSuperContainer;
function getImmediatelyInvokedFunctionExpression(func) {
- if (func.kind === 196 /* FunctionExpression */ || func.kind === 197 /* ArrowFunction */) {
+ if (func.kind === 197 /* FunctionExpression */ || func.kind === 198 /* ArrowFunction */) {
var prev = func;
var parent = func.parent;
- while (parent.kind === 195 /* ParenthesizedExpression */) {
+ while (parent.kind === 196 /* ParenthesizedExpression */) {
prev = parent;
parent = parent.parent;
}
- if (parent.kind === 191 /* CallExpression */ && parent.expression === prev) {
+ if (parent.kind === 192 /* CallExpression */ && parent.expression === prev) {
return parent;
}
}
}
ts.getImmediatelyInvokedFunctionExpression = getImmediatelyInvokedFunctionExpression;
function isSuperOrSuperProperty(node) {
- return node.kind === 98 /* SuperKeyword */
+ return node.kind === 99 /* SuperKeyword */
|| isSuperProperty(node);
}
ts.isSuperOrSuperProperty = isSuperOrSuperProperty;
@@ -9728,8 +9908,8 @@
*/
function isSuperProperty(node) {
var kind = node.kind;
- return (kind === 189 /* PropertyAccessExpression */ || kind === 190 /* ElementAccessExpression */)
- && node.expression.kind === 98 /* SuperKeyword */;
+ return (kind === 190 /* PropertyAccessExpression */ || kind === 191 /* ElementAccessExpression */)
+ && node.expression.kind === 99 /* SuperKeyword */;
}
ts.isSuperProperty = isSuperProperty;
/**
@@ -9737,20 +9917,20 @@
*/
function isThisProperty(node) {
var kind = node.kind;
- return (kind === 189 /* PropertyAccessExpression */ || kind === 190 /* ElementAccessExpression */)
- && node.expression.kind === 100 /* ThisKeyword */;
+ return (kind === 190 /* PropertyAccessExpression */ || kind === 191 /* ElementAccessExpression */)
+ && node.expression.kind === 101 /* ThisKeyword */;
}
ts.isThisProperty = isThisProperty;
function getEntityNameFromTypeNode(node) {
switch (node.kind) {
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return node.typeName;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return isEntityNameExpression(node.expression)
? node.expression
: undefined;
- case 72 /* Identifier */:
- case 148 /* QualifiedName */:
+ case 73 /* Identifier */:
+ case 149 /* QualifiedName */:
return node;
}
return undefined;
@@ -9758,10 +9938,10 @@
ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode;
function getInvokedExpression(node) {
switch (node.kind) {
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return node.tag;
- case 262 /* JsxOpeningElement */:
- case 261 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
+ case 262 /* JsxSelfClosingElement */:
return node.tagName;
default:
return node.expression;
@@ -9770,25 +9950,25 @@
ts.getInvokedExpression = getInvokedExpression;
function nodeCanBeDecorated(node, parent, grandparent) {
switch (node.kind) {
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
// classes are valid targets
return true;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
// property declarations are valid if their parent is a class declaration.
- return parent.kind === 240 /* ClassDeclaration */;
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 156 /* MethodDeclaration */:
+ return parent.kind === 241 /* ClassDeclaration */;
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
// if this method has a body and its parent is a class declaration, this is a valid target.
return node.body !== undefined
- && parent.kind === 240 /* ClassDeclaration */;
- case 151 /* Parameter */:
+ && parent.kind === 241 /* ClassDeclaration */;
+ case 152 /* Parameter */:
// if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target;
return parent.body !== undefined
- && (parent.kind === 157 /* Constructor */
- || parent.kind === 156 /* MethodDeclaration */
- || parent.kind === 159 /* SetAccessor */)
- && grandparent.kind === 240 /* ClassDeclaration */;
+ && (parent.kind === 158 /* Constructor */
+ || parent.kind === 157 /* MethodDeclaration */
+ || parent.kind === 160 /* SetAccessor */)
+ && grandparent.kind === 241 /* ClassDeclaration */;
}
return false;
}
@@ -9804,10 +9984,10 @@
ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated;
function childIsDecorated(node, parent) {
switch (node.kind) {
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return ts.some(node.members, function (m) { return nodeOrChildIsDecorated(m, node, parent); }); // TODO: GH#18217
- case 156 /* MethodDeclaration */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 160 /* SetAccessor */:
return ts.some(node.parameters, function (p) { return nodeIsDecorated(p, node, parent); }); // TODO: GH#18217
default:
return false;
@@ -9816,9 +9996,9 @@
ts.childIsDecorated = childIsDecorated;
function isJSXTagName(node) {
var parent = node.parent;
- if (parent.kind === 262 /* JsxOpeningElement */ ||
- parent.kind === 261 /* JsxSelfClosingElement */ ||
- parent.kind === 263 /* JsxClosingElement */) {
+ if (parent.kind === 263 /* JsxOpeningElement */ ||
+ parent.kind === 262 /* JsxSelfClosingElement */ ||
+ parent.kind === 264 /* JsxClosingElement */) {
return parent.tagName === node;
}
return false;
@@ -9826,57 +10006,57 @@
ts.isJSXTagName = isJSXTagName;
function isExpressionNode(node) {
switch (node.kind) {
- case 98 /* SuperKeyword */:
- case 96 /* NullKeyword */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
+ case 99 /* SuperKeyword */:
+ case 97 /* NullKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
case 13 /* RegularExpressionLiteral */:
- case 187 /* ArrayLiteralExpression */:
- case 188 /* ObjectLiteralExpression */:
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
- case 193 /* TaggedTemplateExpression */:
- case 212 /* AsExpression */:
- case 194 /* TypeAssertionExpression */:
- case 213 /* NonNullExpression */:
- case 195 /* ParenthesizedExpression */:
- case 196 /* FunctionExpression */:
- case 209 /* ClassExpression */:
- case 197 /* ArrowFunction */:
- case 200 /* VoidExpression */:
- case 198 /* DeleteExpression */:
- case 199 /* TypeOfExpression */:
- case 202 /* PrefixUnaryExpression */:
- case 203 /* PostfixUnaryExpression */:
- case 204 /* BinaryExpression */:
- case 205 /* ConditionalExpression */:
- case 208 /* SpreadElement */:
- case 206 /* TemplateExpression */:
+ case 188 /* ArrayLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
+ case 194 /* TaggedTemplateExpression */:
+ case 213 /* AsExpression */:
+ case 195 /* TypeAssertionExpression */:
+ case 214 /* NonNullExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 197 /* FunctionExpression */:
+ case 210 /* ClassExpression */:
+ case 198 /* ArrowFunction */:
+ case 201 /* VoidExpression */:
+ case 199 /* DeleteExpression */:
+ case 200 /* TypeOfExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
+ case 205 /* BinaryExpression */:
+ case 206 /* ConditionalExpression */:
+ case 209 /* SpreadElement */:
+ case 207 /* TemplateExpression */:
case 14 /* NoSubstitutionTemplateLiteral */:
- case 210 /* OmittedExpression */:
- case 260 /* JsxElement */:
- case 261 /* JsxSelfClosingElement */:
- case 264 /* JsxFragment */:
- case 207 /* YieldExpression */:
- case 201 /* AwaitExpression */:
- case 214 /* MetaProperty */:
+ case 211 /* OmittedExpression */:
+ case 261 /* JsxElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 265 /* JsxFragment */:
+ case 208 /* YieldExpression */:
+ case 202 /* AwaitExpression */:
+ case 215 /* MetaProperty */:
return true;
- case 148 /* QualifiedName */:
- while (node.parent.kind === 148 /* QualifiedName */) {
+ case 149 /* QualifiedName */:
+ while (node.parent.kind === 149 /* QualifiedName */) {
node = node.parent;
}
- return node.parent.kind === 167 /* TypeQuery */ || isJSXTagName(node);
- case 72 /* Identifier */:
- if (node.parent.kind === 167 /* TypeQuery */ || isJSXTagName(node)) {
+ return node.parent.kind === 168 /* TypeQuery */ || isJSXTagName(node);
+ case 73 /* Identifier */:
+ if (node.parent.kind === 168 /* TypeQuery */ || isJSXTagName(node)) {
return true;
}
// falls through
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
case 10 /* StringLiteral */:
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
return isInExpressionContext(node);
default:
return false;
@@ -9886,49 +10066,49 @@
function isInExpressionContext(node) {
var parent = node.parent;
switch (parent.kind) {
- case 237 /* VariableDeclaration */:
- case 151 /* Parameter */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 278 /* EnumMember */:
- case 275 /* PropertyAssignment */:
- case 186 /* BindingElement */:
+ case 238 /* VariableDeclaration */:
+ case 152 /* Parameter */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 279 /* EnumMember */:
+ case 276 /* PropertyAssignment */:
+ case 187 /* BindingElement */:
return parent.initializer === node;
- case 221 /* ExpressionStatement */:
- case 222 /* IfStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
- case 230 /* ReturnStatement */:
- case 231 /* WithStatement */:
- case 232 /* SwitchStatement */:
- case 271 /* CaseClause */:
- case 234 /* ThrowStatement */:
+ case 222 /* ExpressionStatement */:
+ case 223 /* IfStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
+ case 231 /* ReturnStatement */:
+ case 232 /* WithStatement */:
+ case 233 /* SwitchStatement */:
+ case 272 /* CaseClause */:
+ case 235 /* ThrowStatement */:
return parent.expression === node;
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
var forStatement = parent;
- return (forStatement.initializer === node && forStatement.initializer.kind !== 238 /* VariableDeclarationList */) ||
+ return (forStatement.initializer === node && forStatement.initializer.kind !== 239 /* VariableDeclarationList */) ||
forStatement.condition === node ||
forStatement.incrementor === node;
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
var forInStatement = parent;
- return (forInStatement.initializer === node && forInStatement.initializer.kind !== 238 /* VariableDeclarationList */) ||
+ return (forInStatement.initializer === node && forInStatement.initializer.kind !== 239 /* VariableDeclarationList */) ||
forInStatement.expression === node;
- case 194 /* TypeAssertionExpression */:
- case 212 /* AsExpression */:
+ case 195 /* TypeAssertionExpression */:
+ case 213 /* AsExpression */:
return node === parent.expression;
- case 216 /* TemplateSpan */:
+ case 217 /* TemplateSpan */:
return node === parent.expression;
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
return node === parent.expression;
- case 152 /* Decorator */:
- case 270 /* JsxExpression */:
- case 269 /* JsxSpreadAttribute */:
- case 277 /* SpreadAssignment */:
+ case 153 /* Decorator */:
+ case 271 /* JsxExpression */:
+ case 270 /* JsxSpreadAttribute */:
+ case 278 /* SpreadAssignment */:
return true;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return parent.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent);
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return parent.objectAssignmentInitializer === node;
default:
return isExpressionNode(parent);
@@ -9936,7 +10116,7 @@
}
ts.isInExpressionContext = isInExpressionContext;
function isExternalModuleImportEqualsDeclaration(node) {
- return node.kind === 248 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 259 /* ExternalModuleReference */;
+ return node.kind === 249 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 260 /* ExternalModuleReference */;
}
ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration;
function getExternalModuleImportEqualsDeclarationExpression(node) {
@@ -9945,7 +10125,7 @@
}
ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression;
function isInternalModuleImportEqualsDeclaration(node) {
- return node.kind === 248 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 259 /* ExternalModuleReference */;
+ return node.kind === 249 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 260 /* ExternalModuleReference */;
}
ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration;
function isSourceFileJS(file) {
@@ -9973,15 +10153,15 @@
ts.isIdentifier(node.typeName) &&
node.typeName.escapedText === "Object" &&
node.typeArguments && node.typeArguments.length === 2 &&
- (node.typeArguments[0].kind === 138 /* StringKeyword */ || node.typeArguments[0].kind === 135 /* NumberKeyword */);
+ (node.typeArguments[0].kind === 139 /* StringKeyword */ || node.typeArguments[0].kind === 136 /* NumberKeyword */);
}
ts.isJSDocIndexSignature = isJSDocIndexSignature;
function isRequireCall(callExpression, checkArgumentIsStringLiteralLike) {
- if (callExpression.kind !== 191 /* CallExpression */) {
+ if (callExpression.kind !== 192 /* CallExpression */) {
return false;
}
var _a = callExpression, expression = _a.expression, args = _a.arguments;
- if (expression.kind !== 72 /* Identifier */ || expression.escapedText !== "require") {
+ if (expression.kind !== 73 /* Identifier */ || expression.escapedText !== "require") {
return false;
}
if (args.length !== 1) {
@@ -10012,7 +10192,7 @@
name = node.parent.name;
decl = node.parent;
}
- else if (ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 59 /* EqualsToken */ && node.parent.right === node) {
+ else if (ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 60 /* EqualsToken */ && node.parent.right === node) {
name = node.parent.left;
decl = name;
}
@@ -10021,7 +10201,7 @@
name = node.parent.parent.name;
decl = node.parent.parent;
}
- else if (ts.isBinaryExpression(node.parent.parent) && node.parent.parent.operatorToken.kind === 59 /* EqualsToken */ && node.parent.parent.right === node.parent) {
+ else if (ts.isBinaryExpression(node.parent.parent) && node.parent.parent.operatorToken.kind === 60 /* EqualsToken */ && node.parent.parent.right === node.parent) {
name = node.parent.parent.left;
decl = name;
}
@@ -10063,7 +10243,7 @@
* We treat the right hand side of assignments with container-like initalizers as declarations.
*/
function getAssignedExpandoInitializer(node) {
- if (node && node.parent && ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 59 /* EqualsToken */) {
+ if (node && node.parent && ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 60 /* EqualsToken */) {
var isPrototypeAssignment = isPrototypeAccess(node.parent.left);
return getExpandoInitializer(node.parent.right, isPrototypeAssignment) ||
getDefaultedExpandoInitializer(node.parent.left, node.parent.right, isPrototypeAssignment);
@@ -10089,11 +10269,11 @@
function getExpandoInitializer(initializer, isPrototypeAssignment) {
if (ts.isCallExpression(initializer)) {
var e = skipParentheses(initializer.expression);
- return e.kind === 196 /* FunctionExpression */ || e.kind === 197 /* ArrowFunction */ ? initializer : undefined;
+ return e.kind === 197 /* FunctionExpression */ || e.kind === 198 /* ArrowFunction */ ? initializer : undefined;
}
- if (initializer.kind === 196 /* FunctionExpression */ ||
- initializer.kind === 209 /* ClassExpression */ ||
- initializer.kind === 197 /* ArrowFunction */) {
+ if (initializer.kind === 197 /* FunctionExpression */ ||
+ initializer.kind === 210 /* ClassExpression */ ||
+ initializer.kind === 198 /* ArrowFunction */) {
return initializer;
}
if (ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || isPrototypeAssignment)) {
@@ -10117,7 +10297,7 @@
}
function isDefaultedExpandoInitializer(node) {
var name = ts.isVariableDeclaration(node.parent) ? node.parent.name :
- ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 59 /* EqualsToken */ ? node.parent.left :
+ ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 60 /* EqualsToken */ ? node.parent.left :
undefined;
return name && getExpandoInitializer(node.right, isPrototypeAccess(name)) && isEntityNameExpression(name) && isSameEntityName(name, node.left);
}
@@ -10126,7 +10306,7 @@
function getNameOfExpando(node) {
if (ts.isBinaryExpression(node.parent)) {
var parent = (node.parent.operatorToken.kind === 55 /* BarBarToken */ && ts.isBinaryExpression(node.parent.parent)) ? node.parent.parent : node.parent;
- if (parent.operatorToken.kind === 59 /* EqualsToken */ && ts.isIdentifier(parent.left)) {
+ if (parent.operatorToken.kind === 60 /* EqualsToken */ && ts.isIdentifier(parent.left)) {
return parent.left;
}
}
@@ -10149,7 +10329,7 @@
return name.escapedText === initializer.escapedText;
}
if (ts.isIdentifier(name) && ts.isPropertyAccessExpression(initializer)) {
- return (initializer.expression.kind === 100 /* ThisKeyword */ ||
+ return (initializer.expression.kind === 101 /* ThisKeyword */ ||
ts.isIdentifier(initializer.expression) &&
(initializer.expression.escapedText === "window" ||
initializer.expression.escapedText === "self" ||
@@ -10207,7 +10387,7 @@
}
return 7 /* ObjectDefinePropertyValue */;
}
- if (expr.operatorToken.kind !== 59 /* EqualsToken */ ||
+ if (expr.operatorToken.kind !== 60 /* EqualsToken */ ||
!ts.isPropertyAccessExpression(expr.left)) {
return 0 /* None */;
}
@@ -10219,7 +10399,7 @@
return getAssignmentDeclarationPropertyAccessKind(lhs);
}
function getAssignmentDeclarationPropertyAccessKind(lhs) {
- if (lhs.expression.kind === 100 /* ThisKeyword */) {
+ if (lhs.expression.kind === 101 /* ThisKeyword */) {
return 4 /* ThisProperty */;
}
else if (isModuleExportsPropertyAccessExpression(lhs)) {
@@ -10261,7 +10441,7 @@
ts.isPrototypePropertyAssignment = isPrototypePropertyAssignment;
function isSpecialPropertyDeclaration(expr) {
return isInJSFile(expr) &&
- expr.parent && expr.parent.kind === 221 /* ExpressionStatement */ &&
+ expr.parent && expr.parent.kind === 222 /* ExpressionStatement */ &&
!!ts.getJSDocTypeTag(expr.parent);
}
ts.isSpecialPropertyDeclaration = isSpecialPropertyDeclaration;
@@ -10270,23 +10450,23 @@
return false;
}
var decl = symbol.valueDeclaration;
- return decl.kind === 239 /* FunctionDeclaration */ || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer);
+ return decl.kind === 240 /* FunctionDeclaration */ || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer);
}
ts.isFunctionSymbol = isFunctionSymbol;
function importFromModuleSpecifier(node) {
- return tryGetImportFromModuleSpecifier(node) || ts.Debug.fail(ts.Debug.showSyntaxKind(node.parent));
+ return tryGetImportFromModuleSpecifier(node) || ts.Debug.failBadSyntaxKind(node.parent);
}
ts.importFromModuleSpecifier = importFromModuleSpecifier;
function tryGetImportFromModuleSpecifier(node) {
switch (node.parent.kind) {
- case 249 /* ImportDeclaration */:
- case 255 /* ExportDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 256 /* ExportDeclaration */:
return node.parent;
- case 259 /* ExternalModuleReference */:
+ case 260 /* ExternalModuleReference */:
return node.parent.parent;
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return isImportCall(node.parent) || isRequireCall(node.parent, /*checkArg*/ false) ? node.parent : undefined;
- case 182 /* LiteralType */:
+ case 183 /* LiteralType */:
ts.Debug.assert(ts.isStringLiteral(node));
return ts.tryCast(node.parent.parent, ts.isImportTypeNode);
default:
@@ -10296,12 +10476,12 @@
ts.tryGetImportFromModuleSpecifier = tryGetImportFromModuleSpecifier;
function getExternalModuleName(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
- case 255 /* ExportDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 256 /* ExportDeclaration */:
return node.moduleSpecifier;
- case 248 /* ImportEqualsDeclaration */:
- return node.moduleReference.kind === 259 /* ExternalModuleReference */ ? node.moduleReference.expression : undefined;
- case 183 /* ImportType */:
+ case 249 /* ImportEqualsDeclaration */:
+ return node.moduleReference.kind === 260 /* ExternalModuleReference */ ? node.moduleReference.expression : undefined;
+ case 184 /* ImportType */:
return isLiteralImportTypeNode(node) ? node.argument.literal : undefined;
default:
return ts.Debug.assertNever(node);
@@ -10310,11 +10490,11 @@
ts.getExternalModuleName = getExternalModuleName;
function getNamespaceDeclarationNode(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return node.importClause && ts.tryCast(node.importClause.namedBindings, ts.isNamespaceImport);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return node;
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return undefined;
default:
return ts.Debug.assertNever(node);
@@ -10322,19 +10502,19 @@
}
ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode;
function isDefaultImport(node) {
- return node.kind === 249 /* ImportDeclaration */ && !!node.importClause && !!node.importClause.name;
+ return node.kind === 250 /* ImportDeclaration */ && !!node.importClause && !!node.importClause.name;
}
ts.isDefaultImport = isDefaultImport;
function hasQuestionToken(node) {
if (node) {
switch (node.kind) {
- case 151 /* Parameter */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 276 /* ShorthandPropertyAssignment */:
- case 275 /* PropertyAssignment */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 152 /* Parameter */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 277 /* ShorthandPropertyAssignment */:
+ case 276 /* PropertyAssignment */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
return node.questionToken !== undefined;
}
}
@@ -10348,7 +10528,7 @@
}
ts.isJSDocConstructSignature = isJSDocConstructSignature;
function isJSDocTypeAlias(node) {
- return node.kind === 309 /* JSDocTypedefTag */ || node.kind === 302 /* JSDocCallbackTag */;
+ return node.kind === 310 /* JSDocTypedefTag */ || node.kind === 303 /* JSDocCallbackTag */;
}
ts.isJSDocTypeAlias = isJSDocTypeAlias;
function isTypeAlias(node) {
@@ -10358,7 +10538,7 @@
function getSourceOfAssignment(node) {
return ts.isExpressionStatement(node) &&
node.expression && ts.isBinaryExpression(node.expression) &&
- node.expression.operatorToken.kind === 59 /* EqualsToken */
+ node.expression.operatorToken.kind === 60 /* EqualsToken */
? node.expression.right
: undefined;
}
@@ -10373,12 +10553,12 @@
}
function getSingleInitializerOfVariableStatementOrPropertyDeclaration(node) {
switch (node.kind) {
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
var v = getSingleVariableOfVariableStatement(node);
return v && v.initializer;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return node.initializer;
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return node.initializer;
}
}
@@ -10389,7 +10569,7 @@
function getNestedModuleDeclaration(node) {
return ts.isModuleDeclaration(node) &&
node.body &&
- node.body.kind === 244 /* ModuleDeclaration */
+ node.body.kind === 245 /* ModuleDeclaration */
? node.body
: undefined;
}
@@ -10404,11 +10584,11 @@
if (ts.hasJSDocNodes(node)) {
result = ts.addRange(result, node.jsDoc);
}
- if (node.kind === 151 /* Parameter */) {
+ if (node.kind === 152 /* Parameter */) {
result = ts.addRange(result, ts.getJSDocParameterTags(node));
break;
}
- if (node.kind === 150 /* TypeParameter */) {
+ if (node.kind === 151 /* TypeParameter */) {
result = ts.addRange(result, ts.getJSDocTypeParameterTags(node));
break;
}
@@ -10419,11 +10599,12 @@
ts.getJSDocCommentsAndTags = getJSDocCommentsAndTags;
function getNextJSDocCommentLocation(node) {
var parent = node.parent;
- if (parent.kind === 275 /* PropertyAssignment */ ||
- parent.kind === 154 /* PropertyDeclaration */ ||
- parent.kind === 221 /* ExpressionStatement */ && node.kind === 189 /* PropertyAccessExpression */ ||
+ if (parent.kind === 276 /* PropertyAssignment */ ||
+ parent.kind === 255 /* ExportAssignment */ ||
+ parent.kind === 155 /* PropertyDeclaration */ ||
+ parent.kind === 222 /* ExpressionStatement */ && node.kind === 190 /* PropertyAccessExpression */ ||
getNestedModuleDeclaration(parent) ||
- ts.isBinaryExpression(node) && node.operatorToken.kind === 59 /* EqualsToken */) {
+ ts.isBinaryExpression(node) && node.operatorToken.kind === 60 /* EqualsToken */) {
return parent;
}
// Try to recognize this pattern when node is initializer of variable declaration and JSDoc comments are on containing variable statement.
@@ -10434,7 +10615,7 @@
// var x = function(name) { return name.length; }
else if (parent.parent &&
(getSingleVariableOfVariableStatement(parent.parent) === node ||
- ts.isBinaryExpression(parent) && parent.operatorToken.kind === 59 /* EqualsToken */)) {
+ ts.isBinaryExpression(parent) && parent.operatorToken.kind === 60 /* EqualsToken */)) {
return parent.parent;
}
else if (parent.parent && parent.parent.parent &&
@@ -10457,7 +10638,7 @@
if (!decl) {
return undefined;
}
- var parameter = ts.find(decl.parameters, function (p) { return p.name.kind === 72 /* Identifier */ && p.name.escapedText === name; });
+ var parameter = ts.find(decl.parameters, function (p) { return p.name.kind === 73 /* Identifier */ && p.name.escapedText === name; });
return parameter && parameter.symbol;
}
ts.getParameterSymbolFromJSDoc = getParameterSymbolFromJSDoc;
@@ -10492,7 +10673,7 @@
ts.hasRestParameter = hasRestParameter;
function isRestParameter(node) {
var type = ts.isJSDocParameterTag(node) ? (node.typeExpression && node.typeExpression.type) : node.type;
- return node.dotDotDotToken !== undefined || !!type && type.kind === 295 /* JSDocVariadicType */;
+ return node.dotDotDotToken !== undefined || !!type && type.kind === 296 /* JSDocVariadicType */;
}
ts.isRestParameter = isRestParameter;
var AssignmentKind;
@@ -10505,31 +10686,31 @@
var parent = node.parent;
while (true) {
switch (parent.kind) {
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
var binaryOperator = parent.operatorToken.kind;
return isAssignmentOperator(binaryOperator) && parent.left === node ?
- binaryOperator === 59 /* EqualsToken */ ? 1 /* Definite */ : 2 /* Compound */ :
+ binaryOperator === 60 /* EqualsToken */ ? 1 /* Definite */ : 2 /* Compound */ :
0 /* None */;
- case 202 /* PrefixUnaryExpression */:
- case 203 /* PostfixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
var unaryOperator = parent.operator;
return unaryOperator === 44 /* PlusPlusToken */ || unaryOperator === 45 /* MinusMinusToken */ ? 2 /* Compound */ : 0 /* None */;
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
return parent.initializer === node ? 1 /* Definite */ : 0 /* None */;
- case 195 /* ParenthesizedExpression */:
- case 187 /* ArrayLiteralExpression */:
- case 208 /* SpreadElement */:
- case 213 /* NonNullExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 188 /* ArrayLiteralExpression */:
+ case 209 /* SpreadElement */:
+ case 214 /* NonNullExpression */:
node = parent;
break;
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
if (parent.name !== node) {
return 0 /* None */;
}
node = parent.parent;
break;
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
if (parent.name === node) {
return 0 /* None */;
}
@@ -10556,22 +10737,22 @@
*/
function isNodeWithPossibleHoistedDeclaration(node) {
switch (node.kind) {
- case 218 /* Block */:
- case 219 /* VariableStatement */:
- case 231 /* WithStatement */:
- case 222 /* IfStatement */:
- case 232 /* SwitchStatement */:
- case 246 /* CaseBlock */:
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
- case 233 /* LabeledStatement */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
- case 235 /* TryStatement */:
- case 274 /* CatchClause */:
+ case 219 /* Block */:
+ case 220 /* VariableStatement */:
+ case 232 /* WithStatement */:
+ case 223 /* IfStatement */:
+ case 233 /* SwitchStatement */:
+ case 247 /* CaseBlock */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
+ case 234 /* LabeledStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
+ case 236 /* TryStatement */:
+ case 275 /* CatchClause */:
return true;
}
return false;
@@ -10588,33 +10769,33 @@
return node;
}
function walkUpParenthesizedTypes(node) {
- return walkUp(node, 177 /* ParenthesizedType */);
+ return walkUp(node, 178 /* ParenthesizedType */);
}
ts.walkUpParenthesizedTypes = walkUpParenthesizedTypes;
function walkUpParenthesizedExpressions(node) {
- return walkUp(node, 195 /* ParenthesizedExpression */);
+ return walkUp(node, 196 /* ParenthesizedExpression */);
}
ts.walkUpParenthesizedExpressions = walkUpParenthesizedExpressions;
function skipParentheses(node) {
- while (node.kind === 195 /* ParenthesizedExpression */) {
+ while (node.kind === 196 /* ParenthesizedExpression */) {
node = node.expression;
}
return node;
}
ts.skipParentheses = skipParentheses;
function skipParenthesesUp(node) {
- while (node.kind === 195 /* ParenthesizedExpression */) {
+ while (node.kind === 196 /* ParenthesizedExpression */) {
node = node.parent;
}
return node;
}
// a node is delete target iff. it is PropertyAccessExpression/ElementAccessExpression with parentheses skipped
function isDeleteTarget(node) {
- if (node.kind !== 189 /* PropertyAccessExpression */ && node.kind !== 190 /* ElementAccessExpression */) {
+ if (node.kind !== 190 /* PropertyAccessExpression */ && node.kind !== 191 /* ElementAccessExpression */) {
return false;
}
node = walkUpParenthesizedExpressions(node.parent);
- return node && node.kind === 198 /* DeleteExpression */;
+ return node && node.kind === 199 /* DeleteExpression */;
}
ts.isDeleteTarget = isDeleteTarget;
function isNodeDescendantOf(node, ancestor) {
@@ -10640,7 +10821,7 @@
if (ts.isComputedPropertyName(parent))
return parent.parent;
// falls through
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
if (ts.isDeclaration(parent)) {
return parent.name === name ? parent : undefined;
}
@@ -10664,7 +10845,7 @@
ts.getDeclarationFromName = getDeclarationFromName;
function isLiteralComputedPropertyDeclarationName(node) {
return (node.kind === 10 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) &&
- node.parent.kind === 149 /* ComputedPropertyName */ &&
+ node.parent.kind === 150 /* ComputedPropertyName */ &&
ts.isDeclaration(node.parent.parent);
}
ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName;
@@ -10672,32 +10853,32 @@
function isIdentifierName(node) {
var parent = node.parent;
switch (parent.kind) {
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 278 /* EnumMember */:
- case 275 /* PropertyAssignment */:
- case 189 /* PropertyAccessExpression */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 279 /* EnumMember */:
+ case 276 /* PropertyAssignment */:
+ case 190 /* PropertyAccessExpression */:
// Name in member declaration or property name in property access
return parent.name === node;
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
// Name on right hand side of dot in a type query or type reference
if (parent.right === node) {
- while (parent.kind === 148 /* QualifiedName */) {
+ while (parent.kind === 149 /* QualifiedName */) {
parent = parent.parent;
}
- return parent.kind === 167 /* TypeQuery */ || parent.kind === 164 /* TypeReference */;
+ return parent.kind === 168 /* TypeQuery */ || parent.kind === 165 /* TypeReference */;
}
return false;
- case 186 /* BindingElement */:
- case 253 /* ImportSpecifier */:
+ case 187 /* BindingElement */:
+ case 254 /* ImportSpecifier */:
// Property name in binding element or import specifier
return parent.propertyName === node;
- case 257 /* ExportSpecifier */:
- case 267 /* JsxAttribute */:
+ case 258 /* ExportSpecifier */:
+ case 268 /* JsxAttribute */:
// Any name in an export specifier or JSX Attribute
return true;
}
@@ -10714,13 +10895,13 @@
// export default <EntityNameExpression>
// module.exports = <EntityNameExpression>
function isAliasSymbolDeclaration(node) {
- return node.kind === 248 /* ImportEqualsDeclaration */ ||
- node.kind === 247 /* NamespaceExportDeclaration */ ||
- node.kind === 250 /* ImportClause */ && !!node.name ||
- node.kind === 251 /* NamespaceImport */ ||
- node.kind === 253 /* ImportSpecifier */ ||
- node.kind === 257 /* ExportSpecifier */ ||
- node.kind === 254 /* ExportAssignment */ && exportAssignmentIsAlias(node) ||
+ return node.kind === 249 /* ImportEqualsDeclaration */ ||
+ node.kind === 248 /* NamespaceExportDeclaration */ ||
+ node.kind === 251 /* ImportClause */ && !!node.name ||
+ node.kind === 252 /* NamespaceImport */ ||
+ node.kind === 254 /* ImportSpecifier */ ||
+ node.kind === 258 /* ExportSpecifier */ ||
+ node.kind === 255 /* ExportAssignment */ && exportAssignmentIsAlias(node) ||
ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* ModuleExports */ && exportAssignmentIsAlias(node);
}
ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration;
@@ -10742,12 +10923,12 @@
}
ts.getEffectiveBaseTypeNode = getEffectiveBaseTypeNode;
function getClassExtendsHeritageElement(node) {
- var heritageClause = getHeritageClause(node.heritageClauses, 86 /* ExtendsKeyword */);
+ var heritageClause = getHeritageClause(node.heritageClauses, 87 /* ExtendsKeyword */);
return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined;
}
ts.getClassExtendsHeritageElement = getClassExtendsHeritageElement;
function getClassImplementsHeritageClauseElements(node) {
- var heritageClause = getHeritageClause(node.heritageClauses, 109 /* ImplementsKeyword */);
+ var heritageClause = getHeritageClause(node.heritageClauses, 110 /* ImplementsKeyword */);
return heritageClause ? heritageClause.types : undefined;
}
ts.getClassImplementsHeritageClauseElements = getClassImplementsHeritageClauseElements;
@@ -10759,7 +10940,7 @@
}
ts.getAllSuperTypeNodes = getAllSuperTypeNodes;
function getInterfaceBaseTypeNodes(node) {
- var heritageClause = getHeritageClause(node.heritageClauses, 86 /* ExtendsKeyword */);
+ var heritageClause = getHeritageClause(node.heritageClauses, 87 /* ExtendsKeyword */);
return heritageClause ? heritageClause.types : undefined;
}
ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes;
@@ -10793,11 +10974,11 @@
}
ts.getAncestor = getAncestor;
function isKeyword(token) {
- return 73 /* FirstKeyword */ <= token && token <= 147 /* LastKeyword */;
+ return 74 /* FirstKeyword */ <= token && token <= 148 /* LastKeyword */;
}
ts.isKeyword = isKeyword;
function isContextualKeyword(token) {
- return 118 /* FirstContextualKeyword */ <= token && token <= 147 /* LastContextualKeyword */;
+ return 119 /* FirstContextualKeyword */ <= token && token <= 148 /* LastContextualKeyword */;
}
ts.isContextualKeyword = isContextualKeyword;
function isNonContextualKeyword(token) {
@@ -10832,14 +11013,14 @@
}
var flags = 0 /* Normal */;
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 156 /* MethodDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 157 /* MethodDeclaration */:
if (node.asteriskToken) {
flags |= 1 /* Generator */;
}
// falls through
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
if (hasModifier(node, 256 /* Async */)) {
flags |= 2 /* Async */;
}
@@ -10853,10 +11034,10 @@
ts.getFunctionFlags = getFunctionFlags;
function isAsyncFunction(node) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 156 /* MethodDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
return node.body !== undefined
&& node.asteriskToken === undefined
&& hasModifier(node, 256 /* Async */);
@@ -10881,7 +11062,7 @@
}
ts.hasDynamicName = hasDynamicName;
function isDynamicName(name) {
- return name.kind === 149 /* ComputedPropertyName */ &&
+ return name.kind === 150 /* ComputedPropertyName */ &&
!isStringOrNumericLiteralLike(name.expression) &&
!isWellKnownSymbolSyntactically(name.expression);
}
@@ -10897,12 +11078,12 @@
ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically;
function getPropertyNameForPropertyNameNode(name) {
switch (name.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return name.escapedText;
case 10 /* StringLiteral */:
case 8 /* NumericLiteral */:
return ts.escapeLeadingUnderscores(name.text);
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
var nameExpression = name.expression;
if (isWellKnownSymbolSyntactically(nameExpression)) {
return getPropertyNameForKnownSymbolName(ts.idText(nameExpression.name));
@@ -10918,7 +11099,7 @@
ts.getPropertyNameForPropertyNameNode = getPropertyNameForPropertyNameNode;
function isPropertyNameLiteral(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
case 10 /* StringLiteral */:
case 14 /* NoSubstitutionTemplateLiteral */:
case 8 /* NumericLiteral */:
@@ -10929,11 +11110,11 @@
}
ts.isPropertyNameLiteral = isPropertyNameLiteral;
function getTextOfIdentifierOrLiteral(node) {
- return node.kind === 72 /* Identifier */ ? ts.idText(node) : node.text;
+ return node.kind === 73 /* Identifier */ ? ts.idText(node) : node.text;
}
ts.getTextOfIdentifierOrLiteral = getTextOfIdentifierOrLiteral;
function getEscapedTextOfIdentifierOrLiteral(node) {
- return node.kind === 72 /* Identifier */ ? node.escapedText : ts.escapeLeadingUnderscores(node.text);
+ return node.kind === 73 /* Identifier */ ? node.escapedText : ts.escapeLeadingUnderscores(node.text);
}
ts.getEscapedTextOfIdentifierOrLiteral = getEscapedTextOfIdentifierOrLiteral;
function getPropertyNameForKnownSymbolName(symbolName) {
@@ -10948,7 +11129,7 @@
* Includes the word "Symbol" with unicode escapes
*/
function isESSymbolIdentifier(node) {
- return node.kind === 72 /* Identifier */ && node.escapedText === "Symbol";
+ return node.kind === 73 /* Identifier */ && node.escapedText === "Symbol";
}
ts.isESSymbolIdentifier = isESSymbolIdentifier;
function isPushOrUnshiftIdentifier(node) {
@@ -10957,11 +11138,11 @@
ts.isPushOrUnshiftIdentifier = isPushOrUnshiftIdentifier;
function isParameterDeclaration(node) {
var root = getRootDeclaration(node);
- return root.kind === 151 /* Parameter */;
+ return root.kind === 152 /* Parameter */;
}
ts.isParameterDeclaration = isParameterDeclaration;
function getRootDeclaration(node) {
- while (node.kind === 186 /* BindingElement */) {
+ while (node.kind === 187 /* BindingElement */) {
node = node.parent.parent;
}
return node;
@@ -10969,15 +11150,15 @@
ts.getRootDeclaration = getRootDeclaration;
function nodeStartsNewLexicalEnvironment(node) {
var kind = node.kind;
- return kind === 157 /* Constructor */
- || kind === 196 /* FunctionExpression */
- || kind === 239 /* FunctionDeclaration */
- || kind === 197 /* ArrowFunction */
- || kind === 156 /* MethodDeclaration */
- || kind === 158 /* GetAccessor */
- || kind === 159 /* SetAccessor */
- || kind === 244 /* ModuleDeclaration */
- || kind === 284 /* SourceFile */;
+ return kind === 158 /* Constructor */
+ || kind === 197 /* FunctionExpression */
+ || kind === 240 /* FunctionDeclaration */
+ || kind === 198 /* ArrowFunction */
+ || kind === 157 /* MethodDeclaration */
+ || kind === 159 /* GetAccessor */
+ || kind === 160 /* SetAccessor */
+ || kind === 245 /* ModuleDeclaration */
+ || kind === 285 /* SourceFile */;
}
ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment;
function nodeIsSynthesized(range) {
@@ -10996,38 +11177,38 @@
})(Associativity = ts.Associativity || (ts.Associativity = {}));
function getExpressionAssociativity(expression) {
var operator = getOperator(expression);
- var hasArguments = expression.kind === 192 /* NewExpression */ && expression.arguments !== undefined;
+ var hasArguments = expression.kind === 193 /* NewExpression */ && expression.arguments !== undefined;
return getOperatorAssociativity(expression.kind, operator, hasArguments);
}
ts.getExpressionAssociativity = getExpressionAssociativity;
function getOperatorAssociativity(kind, operator, hasArguments) {
switch (kind) {
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return hasArguments ? 0 /* Left */ : 1 /* Right */;
- case 202 /* PrefixUnaryExpression */:
- case 199 /* TypeOfExpression */:
- case 200 /* VoidExpression */:
- case 198 /* DeleteExpression */:
- case 201 /* AwaitExpression */:
- case 205 /* ConditionalExpression */:
- case 207 /* YieldExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 200 /* TypeOfExpression */:
+ case 201 /* VoidExpression */:
+ case 199 /* DeleteExpression */:
+ case 202 /* AwaitExpression */:
+ case 206 /* ConditionalExpression */:
+ case 208 /* YieldExpression */:
return 1 /* Right */;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
switch (operator) {
case 41 /* AsteriskAsteriskToken */:
- case 59 /* EqualsToken */:
- case 60 /* PlusEqualsToken */:
- case 61 /* MinusEqualsToken */:
- case 63 /* AsteriskAsteriskEqualsToken */:
- case 62 /* AsteriskEqualsToken */:
- case 64 /* SlashEqualsToken */:
- case 65 /* PercentEqualsToken */:
- case 66 /* LessThanLessThanEqualsToken */:
- case 67 /* GreaterThanGreaterThanEqualsToken */:
- case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
- case 69 /* AmpersandEqualsToken */:
- case 71 /* CaretEqualsToken */:
- case 70 /* BarEqualsToken */:
+ case 60 /* EqualsToken */:
+ case 61 /* PlusEqualsToken */:
+ case 62 /* MinusEqualsToken */:
+ case 64 /* AsteriskAsteriskEqualsToken */:
+ case 63 /* AsteriskEqualsToken */:
+ case 65 /* SlashEqualsToken */:
+ case 66 /* PercentEqualsToken */:
+ case 67 /* LessThanLessThanEqualsToken */:
+ case 68 /* GreaterThanGreaterThanEqualsToken */:
+ case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
+ case 70 /* AmpersandEqualsToken */:
+ case 72 /* CaretEqualsToken */:
+ case 71 /* BarEqualsToken */:
return 1 /* Right */;
}
}
@@ -11036,15 +11217,15 @@
ts.getOperatorAssociativity = getOperatorAssociativity;
function getExpressionPrecedence(expression) {
var operator = getOperator(expression);
- var hasArguments = expression.kind === 192 /* NewExpression */ && expression.arguments !== undefined;
+ var hasArguments = expression.kind === 193 /* NewExpression */ && expression.arguments !== undefined;
return getOperatorPrecedence(expression.kind, operator, hasArguments);
}
ts.getExpressionPrecedence = getExpressionPrecedence;
function getOperator(expression) {
- if (expression.kind === 204 /* BinaryExpression */) {
+ if (expression.kind === 205 /* BinaryExpression */) {
return expression.operatorToken.kind;
}
- else if (expression.kind === 202 /* PrefixUnaryExpression */ || expression.kind === 203 /* PostfixUnaryExpression */) {
+ else if (expression.kind === 203 /* PrefixUnaryExpression */ || expression.kind === 204 /* PostfixUnaryExpression */) {
return expression.operator;
}
else {
@@ -11054,73 +11235,73 @@
ts.getOperator = getOperator;
function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
switch (nodeKind) {
- case 314 /* CommaListExpression */:
+ case 315 /* CommaListExpression */:
return 0;
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
return 1;
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return 2;
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return 4;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
switch (operatorKind) {
case 27 /* CommaToken */:
return 0;
- case 59 /* EqualsToken */:
- case 60 /* PlusEqualsToken */:
- case 61 /* MinusEqualsToken */:
- case 63 /* AsteriskAsteriskEqualsToken */:
- case 62 /* AsteriskEqualsToken */:
- case 64 /* SlashEqualsToken */:
- case 65 /* PercentEqualsToken */:
- case 66 /* LessThanLessThanEqualsToken */:
- case 67 /* GreaterThanGreaterThanEqualsToken */:
- case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
- case 69 /* AmpersandEqualsToken */:
- case 71 /* CaretEqualsToken */:
- case 70 /* BarEqualsToken */:
+ case 60 /* EqualsToken */:
+ case 61 /* PlusEqualsToken */:
+ case 62 /* MinusEqualsToken */:
+ case 64 /* AsteriskAsteriskEqualsToken */:
+ case 63 /* AsteriskEqualsToken */:
+ case 65 /* SlashEqualsToken */:
+ case 66 /* PercentEqualsToken */:
+ case 67 /* LessThanLessThanEqualsToken */:
+ case 68 /* GreaterThanGreaterThanEqualsToken */:
+ case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
+ case 70 /* AmpersandEqualsToken */:
+ case 72 /* CaretEqualsToken */:
+ case 71 /* BarEqualsToken */:
return 3;
default:
return getBinaryOperatorPrecedence(operatorKind);
}
- case 202 /* PrefixUnaryExpression */:
- case 199 /* TypeOfExpression */:
- case 200 /* VoidExpression */:
- case 198 /* DeleteExpression */:
- case 201 /* AwaitExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 200 /* TypeOfExpression */:
+ case 201 /* VoidExpression */:
+ case 199 /* DeleteExpression */:
+ case 202 /* AwaitExpression */:
return 16;
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return 17;
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return 18;
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return hasArguments ? 19 : 18;
- case 193 /* TaggedTemplateExpression */:
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 194 /* TaggedTemplateExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return 19;
- case 100 /* ThisKeyword */:
- case 98 /* SuperKeyword */:
- case 72 /* Identifier */:
- case 96 /* NullKeyword */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
+ case 101 /* ThisKeyword */:
+ case 99 /* SuperKeyword */:
+ case 73 /* Identifier */:
+ case 97 /* NullKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
case 10 /* StringLiteral */:
- case 187 /* ArrayLiteralExpression */:
- case 188 /* ObjectLiteralExpression */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 209 /* ClassExpression */:
- case 260 /* JsxElement */:
- case 261 /* JsxSelfClosingElement */:
- case 264 /* JsxFragment */:
+ case 188 /* ArrayLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 210 /* ClassExpression */:
+ case 261 /* JsxElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 265 /* JsxFragment */:
case 13 /* RegularExpressionLiteral */:
case 14 /* NoSubstitutionTemplateLiteral */:
- case 206 /* TemplateExpression */:
- case 195 /* ParenthesizedExpression */:
- case 210 /* OmittedExpression */:
+ case 207 /* TemplateExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 211 /* OmittedExpression */:
return 20;
default:
return -1;
@@ -11148,9 +11329,9 @@
case 30 /* GreaterThanToken */:
case 31 /* LessThanEqualsToken */:
case 32 /* GreaterThanEqualsToken */:
- case 94 /* InstanceOfKeyword */:
- case 93 /* InKeyword */:
- case 119 /* AsKeyword */:
+ case 95 /* InstanceOfKeyword */:
+ case 94 /* InKeyword */:
+ case 120 /* AsKeyword */:
return 11;
case 46 /* LessThanLessThanToken */:
case 47 /* GreaterThanGreaterThanToken */:
@@ -11612,11 +11793,11 @@
}
ts.parameterIsThisKeyword = parameterIsThisKeyword;
function isThisIdentifier(node) {
- return !!node && node.kind === 72 /* Identifier */ && identifierIsThisKeyword(node);
+ return !!node && node.kind === 73 /* Identifier */ && identifierIsThisKeyword(node);
}
ts.isThisIdentifier = isThisIdentifier;
function identifierIsThisKeyword(id) {
- return id.originalKeywordKind === 100 /* ThisKeyword */;
+ return id.originalKeywordKind === 101 /* ThisKeyword */;
}
ts.identifierIsThisKeyword = identifierIsThisKeyword;
function getAllAccessorDeclarations(declarations, accessor) {
@@ -11627,10 +11808,10 @@
var setAccessor;
if (hasDynamicName(accessor)) {
firstAccessor = accessor;
- if (accessor.kind === 158 /* GetAccessor */) {
+ if (accessor.kind === 159 /* GetAccessor */) {
getAccessor = accessor;
}
- else if (accessor.kind === 159 /* SetAccessor */) {
+ else if (accessor.kind === 160 /* SetAccessor */) {
setAccessor = accessor;
}
else {
@@ -11650,10 +11831,10 @@
else if (!secondAccessor) {
secondAccessor = member;
}
- if (member.kind === 158 /* GetAccessor */ && !getAccessor) {
+ if (member.kind === 159 /* GetAccessor */ && !getAccessor) {
getAccessor = member;
}
- if (member.kind === 159 /* SetAccessor */ && !setAccessor) {
+ if (member.kind === 160 /* SetAccessor */ && !setAccessor) {
setAccessor = member;
}
}
@@ -11699,7 +11880,7 @@
ts.getJSDocTypeParameterDeclarations = getJSDocTypeParameterDeclarations;
/** template tags are only available when a typedef isn't already using them */
function isNonTypeAliasTemplate(tag) {
- return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 296 /* JSDocComment */ && tag.parent.tags.some(isJSDocTypeAlias));
+ return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 297 /* JSDocComment */ && tag.parent.tags.some(isJSDocTypeAlias));
}
/**
* Gets the effective type annotation of the value parameter of a set accessor. If the node
@@ -11939,7 +12120,7 @@
flags |= modifierToFlag(modifier.kind);
}
}
- if (node.flags & 4 /* NestedNamespace */ || (node.kind === 72 /* Identifier */ && node.isInJSDocNamespace)) {
+ if (node.flags & 4 /* NestedNamespace */ || (node.kind === 73 /* Identifier */ && node.isInJSDocNamespace)) {
flags |= 1 /* Export */;
}
return flags;
@@ -11947,17 +12128,17 @@
ts.getModifierFlagsNoCache = getModifierFlagsNoCache;
function modifierToFlag(token) {
switch (token) {
- case 116 /* StaticKeyword */: return 32 /* Static */;
- case 115 /* PublicKeyword */: return 4 /* Public */;
- case 114 /* ProtectedKeyword */: return 16 /* Protected */;
- case 113 /* PrivateKeyword */: return 8 /* Private */;
- case 118 /* AbstractKeyword */: return 128 /* Abstract */;
- case 85 /* ExportKeyword */: return 1 /* Export */;
- case 125 /* DeclareKeyword */: return 2 /* Ambient */;
- case 77 /* ConstKeyword */: return 2048 /* Const */;
- case 80 /* DefaultKeyword */: return 512 /* Default */;
- case 121 /* AsyncKeyword */: return 256 /* Async */;
- case 133 /* ReadonlyKeyword */: return 64 /* Readonly */;
+ case 117 /* StaticKeyword */: return 32 /* Static */;
+ case 116 /* PublicKeyword */: return 4 /* Public */;
+ case 115 /* ProtectedKeyword */: return 16 /* Protected */;
+ case 114 /* PrivateKeyword */: return 8 /* Private */;
+ case 119 /* AbstractKeyword */: return 128 /* Abstract */;
+ case 86 /* ExportKeyword */: return 1 /* Export */;
+ case 126 /* DeclareKeyword */: return 2 /* Ambient */;
+ case 78 /* ConstKeyword */: return 2048 /* Const */;
+ case 81 /* DefaultKeyword */: return 512 /* Default */;
+ case 122 /* AsyncKeyword */: return 256 /* Async */;
+ case 134 /* ReadonlyKeyword */: return 64 /* Readonly */;
}
return 0 /* None */;
}
@@ -11969,7 +12150,7 @@
}
ts.isLogicalOperator = isLogicalOperator;
function isAssignmentOperator(token) {
- return token >= 59 /* FirstAssignment */ && token <= 71 /* LastAssignment */;
+ return token >= 60 /* FirstAssignment */ && token <= 72 /* LastAssignment */;
}
ts.isAssignmentOperator = isAssignmentOperator;
/** Get `C` given `N` if `N` is in the position `class C extends N` where `N` is an ExpressionWithTypeArguments. */
@@ -11982,14 +12163,14 @@
return ts.isExpressionWithTypeArguments(node)
&& ts.isHeritageClause(node.parent)
&& ts.isClassLike(node.parent.parent)
- ? { class: node.parent.parent, isImplements: node.parent.token === 109 /* ImplementsKeyword */ }
+ ? { class: node.parent.parent, isImplements: node.parent.token === 110 /* ImplementsKeyword */ }
: undefined;
}
ts.tryGetClassImplementingOrExtendingExpressionWithTypeArguments = tryGetClassImplementingOrExtendingExpressionWithTypeArguments;
function isAssignmentExpression(node, excludeCompoundAssignment) {
return ts.isBinaryExpression(node)
&& (excludeCompoundAssignment
- ? node.operatorToken.kind === 59 /* EqualsToken */
+ ? node.operatorToken.kind === 60 /* EqualsToken */
: isAssignmentOperator(node.operatorToken.kind))
&& ts.isLeftHandSideExpression(node.left);
}
@@ -11997,8 +12178,8 @@
function isDestructuringAssignment(node) {
if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) {
var kind = node.left.kind;
- return kind === 188 /* ObjectLiteralExpression */
- || kind === 187 /* ArrayLiteralExpression */;
+ return kind === 189 /* ObjectLiteralExpression */
+ || kind === 188 /* ArrayLiteralExpression */;
}
return false;
}
@@ -12008,29 +12189,39 @@
}
ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause;
function isEntityNameExpression(node) {
- return node.kind === 72 /* Identifier */ || isPropertyAccessEntityNameExpression(node);
+ return node.kind === 73 /* Identifier */ || isPropertyAccessEntityNameExpression(node);
}
ts.isEntityNameExpression = isEntityNameExpression;
function isPropertyAccessEntityNameExpression(node) {
return ts.isPropertyAccessExpression(node) && isEntityNameExpression(node.expression);
}
ts.isPropertyAccessEntityNameExpression = isPropertyAccessEntityNameExpression;
+ function tryGetPropertyAccessOrIdentifierToString(expr) {
+ if (ts.isPropertyAccessExpression(expr)) {
+ return tryGetPropertyAccessOrIdentifierToString(expr.expression) + "." + expr.name;
+ }
+ if (ts.isIdentifier(expr)) {
+ return ts.unescapeLeadingUnderscores(expr.escapedText);
+ }
+ return undefined;
+ }
+ ts.tryGetPropertyAccessOrIdentifierToString = tryGetPropertyAccessOrIdentifierToString;
function isPrototypeAccess(node) {
return ts.isPropertyAccessExpression(node) && node.name.escapedText === "prototype";
}
ts.isPrototypeAccess = isPrototypeAccess;
function isRightSideOfQualifiedNameOrPropertyAccess(node) {
- return (node.parent.kind === 148 /* QualifiedName */ && node.parent.right === node) ||
- (node.parent.kind === 189 /* PropertyAccessExpression */ && node.parent.name === node);
+ return (node.parent.kind === 149 /* QualifiedName */ && node.parent.right === node) ||
+ (node.parent.kind === 190 /* PropertyAccessExpression */ && node.parent.name === node);
}
ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess;
function isEmptyObjectLiteral(expression) {
- return expression.kind === 188 /* ObjectLiteralExpression */ &&
+ return expression.kind === 189 /* ObjectLiteralExpression */ &&
expression.properties.length === 0;
}
ts.isEmptyObjectLiteral = isEmptyObjectLiteral;
function isEmptyArrayLiteral(expression) {
- return expression.kind === 187 /* ArrayLiteralExpression */ &&
+ return expression.kind === 188 /* ArrayLiteralExpression */ &&
expression.elements.length === 0;
}
ts.isEmptyArrayLiteral = isEmptyArrayLiteral;
@@ -12219,77 +12410,6 @@
}
ts.getNewLineCharacter = getNewLineCharacter;
/**
- * Formats an enum value as a string for debugging and debug assertions.
- */
- function formatEnum(value, enumObject, isFlags) {
- if (value === void 0) { value = 0; }
- var members = getEnumMembers(enumObject);
- if (value === 0) {
- return members.length > 0 && members[0][0] === 0 ? members[0][1] : "0";
- }
- if (isFlags) {
- var result = "";
- var remainingFlags = value;
- for (var i = members.length - 1; i >= 0 && remainingFlags !== 0; i--) {
- var _a = members[i], enumValue = _a[0], enumName = _a[1];
- if (enumValue !== 0 && (remainingFlags & enumValue) === enumValue) {
- remainingFlags &= ~enumValue;
- result = "" + enumName + (result ? ", " : "") + result;
- }
- }
- if (remainingFlags === 0) {
- return result;
- }
- }
- else {
- for (var _i = 0, members_1 = members; _i < members_1.length; _i++) {
- var _b = members_1[_i], enumValue = _b[0], enumName = _b[1];
- if (enumValue === value) {
- return enumName;
- }
- }
- }
- return value.toString();
- }
- function getEnumMembers(enumObject) {
- var result = [];
- for (var name in enumObject) {
- var value = enumObject[name];
- if (typeof value === "number") {
- result.push([value, name]);
- }
- }
- return ts.stableSort(result, function (x, y) { return ts.compareValues(x[0], y[0]); });
- }
- function formatSyntaxKind(kind) {
- return formatEnum(kind, ts.SyntaxKind, /*isFlags*/ false);
- }
- ts.formatSyntaxKind = formatSyntaxKind;
- function formatModifierFlags(flags) {
- return formatEnum(flags, ts.ModifierFlags, /*isFlags*/ true);
- }
- ts.formatModifierFlags = formatModifierFlags;
- function formatTransformFlags(flags) {
- return formatEnum(flags, ts.TransformFlags, /*isFlags*/ true);
- }
- ts.formatTransformFlags = formatTransformFlags;
- function formatEmitFlags(flags) {
- return formatEnum(flags, ts.EmitFlags, /*isFlags*/ true);
- }
- ts.formatEmitFlags = formatEmitFlags;
- function formatSymbolFlags(flags) {
- return formatEnum(flags, ts.SymbolFlags, /*isFlags*/ true);
- }
- ts.formatSymbolFlags = formatSymbolFlags;
- function formatTypeFlags(flags) {
- return formatEnum(flags, ts.TypeFlags, /*isFlags*/ true);
- }
- ts.formatTypeFlags = formatTypeFlags;
- function formatObjectFlags(flags) {
- return formatEnum(flags, ts.ObjectFlags, /*isFlags*/ true);
- }
- ts.formatObjectFlags = formatObjectFlags;
- /**
* Creates a new TextRange from the provided pos and end.
*
* @param pos The start position.
@@ -12378,6 +12498,10 @@
return positionsAreOnSameLine(range1.end, getStartPositionOfRange(range2, sourceFile), sourceFile);
}
ts.rangeEndIsOnSameLineAsRangeStart = rangeEndIsOnSameLineAsRangeStart;
+ function isNodeArrayMultiLine(list, sourceFile) {
+ return !positionsAreOnSameLine(list.pos, list.end, sourceFile);
+ }
+ ts.isNodeArrayMultiLine = isNodeArrayMultiLine;
function positionsAreOnSameLine(pos1, pos2, sourceFile) {
return pos1 === pos2 ||
getLineOfLocalPosition(sourceFile, pos1) === getLineOfLocalPosition(sourceFile, pos2);
@@ -12395,8 +12519,8 @@
var parseNode = ts.getParseTreeNode(node);
if (parseNode) {
switch (parseNode.parent.kind) {
- case 243 /* EnumDeclaration */:
- case 244 /* ModuleDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 245 /* ModuleDeclaration */:
return parseNode === parseNode.parent.name;
}
}
@@ -12430,10 +12554,10 @@
}
if (getCheckFlags(s) & 6 /* Synthetic */) {
var checkFlags = s.checkFlags;
- var accessModifier = checkFlags & 512 /* ContainsPrivate */ ? 8 /* Private */ :
- checkFlags & 128 /* ContainsPublic */ ? 4 /* Public */ :
+ var accessModifier = checkFlags & 1024 /* ContainsPrivate */ ? 8 /* Private */ :
+ checkFlags & 256 /* ContainsPublic */ ? 4 /* Public */ :
16 /* Protected */;
- var staticModifier = checkFlags & 1024 /* ContainsStatic */ ? 32 /* Static */ : 0;
+ var staticModifier = checkFlags & 2048 /* ContainsStatic */ ? 32 /* Static */ : 0;
return accessModifier | staticModifier;
}
if (s.flags & 4194304 /* Prototype */) {
@@ -12473,35 +12597,35 @@
if (!parent)
return 0 /* Read */;
switch (parent.kind) {
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return accessKind(parent);
- case 203 /* PostfixUnaryExpression */:
- case 202 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
var operator = parent.operator;
return operator === 44 /* PlusPlusToken */ || operator === 45 /* MinusMinusToken */ ? writeOrReadWrite() : 0 /* Read */;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
var _a = parent, left = _a.left, operatorToken = _a.operatorToken;
return left === node && isAssignmentOperator(operatorToken.kind) ?
- operatorToken.kind === 59 /* EqualsToken */ ? 1 /* Write */ : writeOrReadWrite()
+ operatorToken.kind === 60 /* EqualsToken */ ? 1 /* Write */ : writeOrReadWrite()
: 0 /* Read */;
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return parent.name !== node ? 0 /* Read */ : accessKind(parent);
- case 275 /* PropertyAssignment */: {
+ case 276 /* PropertyAssignment */: {
var parentAccess = accessKind(parent.parent);
// In `({ x: varname }) = { x: 1 }`, the left `x` is a read, the right `x` is a write.
return node === parent.name ? reverseAccessKind(parentAccess) : parentAccess;
}
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
// Assume it's the local variable being accessed, since we don't check public properties for --noUnusedLocals.
return node === parent.objectAssignmentInitializer ? 0 /* Read */ : accessKind(parent.parent);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return accessKind(parent);
default:
return 0 /* Read */;
}
function writeOrReadWrite() {
// If grandparent is not an ExpressionStatement, this is used as an expression in addition to having a side effect.
- return parent.parent && skipParenthesesUp(parent.parent).kind === 221 /* ExpressionStatement */ ? 1 /* Write */ : 2 /* ReadWrite */;
+ return parent.parent && skipParenthesesUp(parent.parent).kind === 222 /* ExpressionStatement */ ? 1 /* Write */ : 2 /* ReadWrite */;
}
}
function reverseAccessKind(a) {
@@ -12656,32 +12780,32 @@
}
ts.isObjectTypeDeclaration = isObjectTypeDeclaration;
function isTypeNodeKind(kind) {
- return (kind >= 163 /* FirstTypeNode */ && kind <= 183 /* LastTypeNode */)
- || kind === 120 /* AnyKeyword */
- || kind === 143 /* UnknownKeyword */
- || kind === 135 /* NumberKeyword */
- || kind === 146 /* BigIntKeyword */
- || kind === 136 /* ObjectKeyword */
- || kind === 123 /* BooleanKeyword */
- || kind === 138 /* StringKeyword */
- || kind === 139 /* SymbolKeyword */
- || kind === 100 /* ThisKeyword */
- || kind === 106 /* VoidKeyword */
- || kind === 141 /* UndefinedKeyword */
- || kind === 96 /* NullKeyword */
- || kind === 132 /* NeverKeyword */
- || kind === 211 /* ExpressionWithTypeArguments */
- || kind === 289 /* JSDocAllType */
- || kind === 290 /* JSDocUnknownType */
- || kind === 291 /* JSDocNullableType */
- || kind === 292 /* JSDocNonNullableType */
- || kind === 293 /* JSDocOptionalType */
- || kind === 294 /* JSDocFunctionType */
- || kind === 295 /* JSDocVariadicType */;
+ return (kind >= 164 /* FirstTypeNode */ && kind <= 184 /* LastTypeNode */)
+ || kind === 121 /* AnyKeyword */
+ || kind === 144 /* UnknownKeyword */
+ || kind === 136 /* NumberKeyword */
+ || kind === 147 /* BigIntKeyword */
+ || kind === 137 /* ObjectKeyword */
+ || kind === 124 /* BooleanKeyword */
+ || kind === 139 /* StringKeyword */
+ || kind === 140 /* SymbolKeyword */
+ || kind === 101 /* ThisKeyword */
+ || kind === 107 /* VoidKeyword */
+ || kind === 142 /* UndefinedKeyword */
+ || kind === 97 /* NullKeyword */
+ || kind === 133 /* NeverKeyword */
+ || kind === 212 /* ExpressionWithTypeArguments */
+ || kind === 290 /* JSDocAllType */
+ || kind === 291 /* JSDocUnknownType */
+ || kind === 292 /* JSDocNullableType */
+ || kind === 293 /* JSDocNonNullableType */
+ || kind === 294 /* JSDocOptionalType */
+ || kind === 295 /* JSDocFunctionType */
+ || kind === 296 /* JSDocVariadicType */;
}
ts.isTypeNodeKind = isTypeNodeKind;
function isAccessExpression(node) {
- return node.kind === 189 /* PropertyAccessExpression */ || node.kind === 190 /* ElementAccessExpression */;
+ return node.kind === 190 /* PropertyAccessExpression */ || node.kind === 191 /* ElementAccessExpression */;
}
ts.isAccessExpression = isAccessExpression;
function isBundleFileTextLike(section) {
@@ -12698,8 +12822,10 @@
(function (ts) {
function getDefaultLibFileName(options) {
switch (options.target) {
- case 7 /* ESNext */:
+ case 8 /* ESNext */:
return "lib.esnext.full.d.ts";
+ case 7 /* ES2020 */:
+ return "lib.es2020.full.d.ts";
case 6 /* ES2019 */:
return "lib.es2019.full.d.ts";
case 5 /* ES2018 */:
@@ -12916,9 +13042,9 @@
}
ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions;
function getTypeParameterOwner(d) {
- if (d && d.kind === 150 /* TypeParameter */) {
+ if (d && d.kind === 151 /* TypeParameter */) {
for (var current = d; current; current = current.parent) {
- if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 241 /* InterfaceDeclaration */) {
+ if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 242 /* InterfaceDeclaration */) {
return current;
}
}
@@ -12926,7 +13052,7 @@
}
ts.getTypeParameterOwner = getTypeParameterOwner;
function isParameterPropertyDeclaration(node) {
- return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) && node.parent.kind === 157 /* Constructor */;
+ return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) && node.parent.kind === 158 /* Constructor */;
}
ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration;
function isEmptyBindingPattern(node) {
@@ -12956,14 +13082,14 @@
node = walkUpBindingElementsAndPatterns(node);
}
var flags = getFlags(node);
- if (node.kind === 237 /* VariableDeclaration */) {
+ if (node.kind === 238 /* VariableDeclaration */) {
node = node.parent;
}
- if (node && node.kind === 238 /* VariableDeclarationList */) {
+ if (node && node.kind === 239 /* VariableDeclarationList */) {
flags |= getFlags(node);
node = node.parent;
}
- if (node && node.kind === 219 /* VariableStatement */) {
+ if (node && node.kind === 220 /* VariableStatement */) {
flags |= getFlags(node);
}
return flags;
@@ -13109,27 +13235,27 @@
}
// Covers remaining cases (returning undefined if none match).
switch (hostNode.kind) {
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
if (hostNode.declarationList && hostNode.declarationList.declarations[0]) {
return getDeclarationIdentifier(hostNode.declarationList.declarations[0]);
}
break;
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
var expr = hostNode.expression;
switch (expr.kind) {
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return expr.name;
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
var arg = expr.argumentExpression;
if (ts.isIdentifier(arg)) {
return arg;
}
}
break;
- case 195 /* ParenthesizedExpression */: {
+ case 196 /* ParenthesizedExpression */: {
return getDeclarationIdentifier(hostNode.expression);
}
- case 233 /* LabeledStatement */: {
+ case 234 /* LabeledStatement */: {
if (ts.isDeclaration(hostNode.statement) || ts.isExpression(hostNode.statement)) {
return getDeclarationIdentifier(hostNode.statement);
}
@@ -13153,18 +13279,18 @@
/** @internal */
function getNonAssignedNameOfDeclaration(declaration) {
switch (declaration.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return declaration;
- case 310 /* JSDocPropertyTag */:
- case 304 /* JSDocParameterTag */: {
+ case 311 /* JSDocPropertyTag */:
+ case 305 /* JSDocParameterTag */: {
var name = declaration.name;
- if (name.kind === 148 /* QualifiedName */) {
+ if (name.kind === 149 /* QualifiedName */) {
return name.right;
}
break;
}
- case 191 /* CallExpression */:
- case 204 /* BinaryExpression */: {
+ case 192 /* CallExpression */:
+ case 205 /* BinaryExpression */: {
var expr = declaration;
switch (ts.getAssignmentDeclarationKind(expr)) {
case 1 /* ExportsProperty */:
@@ -13180,9 +13306,9 @@
return undefined;
}
}
- case 309 /* JSDocTypedefTag */:
+ case 310 /* JSDocTypedefTag */:
return getNameOfJSDocTypedef(declaration);
- case 254 /* ExportAssignment */: {
+ case 255 /* ExportAssignment */: {
var expression = declaration.expression;
return ts.isIdentifier(expression) ? expression : undefined;
}
@@ -13384,7 +13510,7 @@
return ts.emptyArray;
}
if (ts.isJSDocTypeAlias(node)) {
- ts.Debug.assert(node.parent.kind === 296 /* JSDocComment */);
+ ts.Debug.assert(node.parent.kind === 297 /* JSDocComment */);
return ts.flatMap(node.parent.tags, function (tag) { return ts.isJSDocTemplateTag(tag) ? tag.typeParameters : undefined; });
}
if (node.typeParameters) {
@@ -13452,198 +13578,198 @@
}
ts.isTemplateTail = isTemplateTail;
function isIdentifier(node) {
- return node.kind === 72 /* Identifier */;
+ return node.kind === 73 /* Identifier */;
}
ts.isIdentifier = isIdentifier;
// Names
function isQualifiedName(node) {
- return node.kind === 148 /* QualifiedName */;
+ return node.kind === 149 /* QualifiedName */;
}
ts.isQualifiedName = isQualifiedName;
function isComputedPropertyName(node) {
- return node.kind === 149 /* ComputedPropertyName */;
+ return node.kind === 150 /* ComputedPropertyName */;
}
ts.isComputedPropertyName = isComputedPropertyName;
// Signature elements
function isTypeParameterDeclaration(node) {
- return node.kind === 150 /* TypeParameter */;
+ return node.kind === 151 /* TypeParameter */;
}
ts.isTypeParameterDeclaration = isTypeParameterDeclaration;
function isParameter(node) {
- return node.kind === 151 /* Parameter */;
+ return node.kind === 152 /* Parameter */;
}
ts.isParameter = isParameter;
function isDecorator(node) {
- return node.kind === 152 /* Decorator */;
+ return node.kind === 153 /* Decorator */;
}
ts.isDecorator = isDecorator;
// TypeMember
function isPropertySignature(node) {
- return node.kind === 153 /* PropertySignature */;
+ return node.kind === 154 /* PropertySignature */;
}
ts.isPropertySignature = isPropertySignature;
function isPropertyDeclaration(node) {
- return node.kind === 154 /* PropertyDeclaration */;
+ return node.kind === 155 /* PropertyDeclaration */;
}
ts.isPropertyDeclaration = isPropertyDeclaration;
function isMethodSignature(node) {
- return node.kind === 155 /* MethodSignature */;
+ return node.kind === 156 /* MethodSignature */;
}
ts.isMethodSignature = isMethodSignature;
function isMethodDeclaration(node) {
- return node.kind === 156 /* MethodDeclaration */;
+ return node.kind === 157 /* MethodDeclaration */;
}
ts.isMethodDeclaration = isMethodDeclaration;
function isConstructorDeclaration(node) {
- return node.kind === 157 /* Constructor */;
+ return node.kind === 158 /* Constructor */;
}
ts.isConstructorDeclaration = isConstructorDeclaration;
function isGetAccessorDeclaration(node) {
- return node.kind === 158 /* GetAccessor */;
+ return node.kind === 159 /* GetAccessor */;
}
ts.isGetAccessorDeclaration = isGetAccessorDeclaration;
function isSetAccessorDeclaration(node) {
- return node.kind === 159 /* SetAccessor */;
+ return node.kind === 160 /* SetAccessor */;
}
ts.isSetAccessorDeclaration = isSetAccessorDeclaration;
function isCallSignatureDeclaration(node) {
- return node.kind === 160 /* CallSignature */;
+ return node.kind === 161 /* CallSignature */;
}
ts.isCallSignatureDeclaration = isCallSignatureDeclaration;
function isConstructSignatureDeclaration(node) {
- return node.kind === 161 /* ConstructSignature */;
+ return node.kind === 162 /* ConstructSignature */;
}
ts.isConstructSignatureDeclaration = isConstructSignatureDeclaration;
function isIndexSignatureDeclaration(node) {
- return node.kind === 162 /* IndexSignature */;
+ return node.kind === 163 /* IndexSignature */;
}
ts.isIndexSignatureDeclaration = isIndexSignatureDeclaration;
/* @internal */
function isGetOrSetAccessorDeclaration(node) {
- return node.kind === 159 /* SetAccessor */ || node.kind === 158 /* GetAccessor */;
+ return node.kind === 160 /* SetAccessor */ || node.kind === 159 /* GetAccessor */;
}
ts.isGetOrSetAccessorDeclaration = isGetOrSetAccessorDeclaration;
// Type
function isTypePredicateNode(node) {
- return node.kind === 163 /* TypePredicate */;
+ return node.kind === 164 /* TypePredicate */;
}
ts.isTypePredicateNode = isTypePredicateNode;
function isTypeReferenceNode(node) {
- return node.kind === 164 /* TypeReference */;
+ return node.kind === 165 /* TypeReference */;
}
ts.isTypeReferenceNode = isTypeReferenceNode;
function isFunctionTypeNode(node) {
- return node.kind === 165 /* FunctionType */;
+ return node.kind === 166 /* FunctionType */;
}
ts.isFunctionTypeNode = isFunctionTypeNode;
function isConstructorTypeNode(node) {
- return node.kind === 166 /* ConstructorType */;
+ return node.kind === 167 /* ConstructorType */;
}
ts.isConstructorTypeNode = isConstructorTypeNode;
function isTypeQueryNode(node) {
- return node.kind === 167 /* TypeQuery */;
+ return node.kind === 168 /* TypeQuery */;
}
ts.isTypeQueryNode = isTypeQueryNode;
function isTypeLiteralNode(node) {
- return node.kind === 168 /* TypeLiteral */;
+ return node.kind === 169 /* TypeLiteral */;
}
ts.isTypeLiteralNode = isTypeLiteralNode;
function isArrayTypeNode(node) {
- return node.kind === 169 /* ArrayType */;
+ return node.kind === 170 /* ArrayType */;
}
ts.isArrayTypeNode = isArrayTypeNode;
function isTupleTypeNode(node) {
- return node.kind === 170 /* TupleType */;
+ return node.kind === 171 /* TupleType */;
}
ts.isTupleTypeNode = isTupleTypeNode;
function isUnionTypeNode(node) {
- return node.kind === 173 /* UnionType */;
+ return node.kind === 174 /* UnionType */;
}
ts.isUnionTypeNode = isUnionTypeNode;
function isIntersectionTypeNode(node) {
- return node.kind === 174 /* IntersectionType */;
+ return node.kind === 175 /* IntersectionType */;
}
ts.isIntersectionTypeNode = isIntersectionTypeNode;
function isConditionalTypeNode(node) {
- return node.kind === 175 /* ConditionalType */;
+ return node.kind === 176 /* ConditionalType */;
}
ts.isConditionalTypeNode = isConditionalTypeNode;
function isInferTypeNode(node) {
- return node.kind === 176 /* InferType */;
+ return node.kind === 177 /* InferType */;
}
ts.isInferTypeNode = isInferTypeNode;
function isParenthesizedTypeNode(node) {
- return node.kind === 177 /* ParenthesizedType */;
+ return node.kind === 178 /* ParenthesizedType */;
}
ts.isParenthesizedTypeNode = isParenthesizedTypeNode;
function isThisTypeNode(node) {
- return node.kind === 178 /* ThisType */;
+ return node.kind === 179 /* ThisType */;
}
ts.isThisTypeNode = isThisTypeNode;
function isTypeOperatorNode(node) {
- return node.kind === 179 /* TypeOperator */;
+ return node.kind === 180 /* TypeOperator */;
}
ts.isTypeOperatorNode = isTypeOperatorNode;
function isIndexedAccessTypeNode(node) {
- return node.kind === 180 /* IndexedAccessType */;
+ return node.kind === 181 /* IndexedAccessType */;
}
ts.isIndexedAccessTypeNode = isIndexedAccessTypeNode;
function isMappedTypeNode(node) {
- return node.kind === 181 /* MappedType */;
+ return node.kind === 182 /* MappedType */;
}
ts.isMappedTypeNode = isMappedTypeNode;
function isLiteralTypeNode(node) {
- return node.kind === 182 /* LiteralType */;
+ return node.kind === 183 /* LiteralType */;
}
ts.isLiteralTypeNode = isLiteralTypeNode;
function isImportTypeNode(node) {
- return node.kind === 183 /* ImportType */;
+ return node.kind === 184 /* ImportType */;
}
ts.isImportTypeNode = isImportTypeNode;
// Binding patterns
function isObjectBindingPattern(node) {
- return node.kind === 184 /* ObjectBindingPattern */;
+ return node.kind === 185 /* ObjectBindingPattern */;
}
ts.isObjectBindingPattern = isObjectBindingPattern;
function isArrayBindingPattern(node) {
- return node.kind === 185 /* ArrayBindingPattern */;
+ return node.kind === 186 /* ArrayBindingPattern */;
}
ts.isArrayBindingPattern = isArrayBindingPattern;
function isBindingElement(node) {
- return node.kind === 186 /* BindingElement */;
+ return node.kind === 187 /* BindingElement */;
}
ts.isBindingElement = isBindingElement;
// Expression
function isArrayLiteralExpression(node) {
- return node.kind === 187 /* ArrayLiteralExpression */;
+ return node.kind === 188 /* ArrayLiteralExpression */;
}
ts.isArrayLiteralExpression = isArrayLiteralExpression;
function isObjectLiteralExpression(node) {
- return node.kind === 188 /* ObjectLiteralExpression */;
+ return node.kind === 189 /* ObjectLiteralExpression */;
}
ts.isObjectLiteralExpression = isObjectLiteralExpression;
function isPropertyAccessExpression(node) {
- return node.kind === 189 /* PropertyAccessExpression */;
+ return node.kind === 190 /* PropertyAccessExpression */;
}
ts.isPropertyAccessExpression = isPropertyAccessExpression;
function isElementAccessExpression(node) {
- return node.kind === 190 /* ElementAccessExpression */;
+ return node.kind === 191 /* ElementAccessExpression */;
}
ts.isElementAccessExpression = isElementAccessExpression;
function isCallExpression(node) {
- return node.kind === 191 /* CallExpression */;
+ return node.kind === 192 /* CallExpression */;
}
ts.isCallExpression = isCallExpression;
function isNewExpression(node) {
- return node.kind === 192 /* NewExpression */;
+ return node.kind === 193 /* NewExpression */;
}
ts.isNewExpression = isNewExpression;
function isTaggedTemplateExpression(node) {
- return node.kind === 193 /* TaggedTemplateExpression */;
+ return node.kind === 194 /* TaggedTemplateExpression */;
}
ts.isTaggedTemplateExpression = isTaggedTemplateExpression;
function isTypeAssertion(node) {
- return node.kind === 194 /* TypeAssertionExpression */;
+ return node.kind === 195 /* TypeAssertionExpression */;
}
ts.isTypeAssertion = isTypeAssertion;
function isConstTypeReference(node) {
@@ -13652,376 +13778,376 @@
}
ts.isConstTypeReference = isConstTypeReference;
function isParenthesizedExpression(node) {
- return node.kind === 195 /* ParenthesizedExpression */;
+ return node.kind === 196 /* ParenthesizedExpression */;
}
ts.isParenthesizedExpression = isParenthesizedExpression;
function skipPartiallyEmittedExpressions(node) {
- while (node.kind === 313 /* PartiallyEmittedExpression */) {
+ while (node.kind === 314 /* PartiallyEmittedExpression */) {
node = node.expression;
}
return node;
}
ts.skipPartiallyEmittedExpressions = skipPartiallyEmittedExpressions;
function isFunctionExpression(node) {
- return node.kind === 196 /* FunctionExpression */;
+ return node.kind === 197 /* FunctionExpression */;
}
ts.isFunctionExpression = isFunctionExpression;
function isArrowFunction(node) {
- return node.kind === 197 /* ArrowFunction */;
+ return node.kind === 198 /* ArrowFunction */;
}
ts.isArrowFunction = isArrowFunction;
function isDeleteExpression(node) {
- return node.kind === 198 /* DeleteExpression */;
+ return node.kind === 199 /* DeleteExpression */;
}
ts.isDeleteExpression = isDeleteExpression;
function isTypeOfExpression(node) {
- return node.kind === 199 /* TypeOfExpression */;
+ return node.kind === 200 /* TypeOfExpression */;
}
ts.isTypeOfExpression = isTypeOfExpression;
function isVoidExpression(node) {
- return node.kind === 200 /* VoidExpression */;
+ return node.kind === 201 /* VoidExpression */;
}
ts.isVoidExpression = isVoidExpression;
function isAwaitExpression(node) {
- return node.kind === 201 /* AwaitExpression */;
+ return node.kind === 202 /* AwaitExpression */;
}
ts.isAwaitExpression = isAwaitExpression;
function isPrefixUnaryExpression(node) {
- return node.kind === 202 /* PrefixUnaryExpression */;
+ return node.kind === 203 /* PrefixUnaryExpression */;
}
ts.isPrefixUnaryExpression = isPrefixUnaryExpression;
function isPostfixUnaryExpression(node) {
- return node.kind === 203 /* PostfixUnaryExpression */;
+ return node.kind === 204 /* PostfixUnaryExpression */;
}
ts.isPostfixUnaryExpression = isPostfixUnaryExpression;
function isBinaryExpression(node) {
- return node.kind === 204 /* BinaryExpression */;
+ return node.kind === 205 /* BinaryExpression */;
}
ts.isBinaryExpression = isBinaryExpression;
function isConditionalExpression(node) {
- return node.kind === 205 /* ConditionalExpression */;
+ return node.kind === 206 /* ConditionalExpression */;
}
ts.isConditionalExpression = isConditionalExpression;
function isTemplateExpression(node) {
- return node.kind === 206 /* TemplateExpression */;
+ return node.kind === 207 /* TemplateExpression */;
}
ts.isTemplateExpression = isTemplateExpression;
function isYieldExpression(node) {
- return node.kind === 207 /* YieldExpression */;
+ return node.kind === 208 /* YieldExpression */;
}
ts.isYieldExpression = isYieldExpression;
function isSpreadElement(node) {
- return node.kind === 208 /* SpreadElement */;
+ return node.kind === 209 /* SpreadElement */;
}
ts.isSpreadElement = isSpreadElement;
function isClassExpression(node) {
- return node.kind === 209 /* ClassExpression */;
+ return node.kind === 210 /* ClassExpression */;
}
ts.isClassExpression = isClassExpression;
function isOmittedExpression(node) {
- return node.kind === 210 /* OmittedExpression */;
+ return node.kind === 211 /* OmittedExpression */;
}
ts.isOmittedExpression = isOmittedExpression;
function isExpressionWithTypeArguments(node) {
- return node.kind === 211 /* ExpressionWithTypeArguments */;
+ return node.kind === 212 /* ExpressionWithTypeArguments */;
}
ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments;
function isAsExpression(node) {
- return node.kind === 212 /* AsExpression */;
+ return node.kind === 213 /* AsExpression */;
}
ts.isAsExpression = isAsExpression;
function isNonNullExpression(node) {
- return node.kind === 213 /* NonNullExpression */;
+ return node.kind === 214 /* NonNullExpression */;
}
ts.isNonNullExpression = isNonNullExpression;
function isMetaProperty(node) {
- return node.kind === 214 /* MetaProperty */;
+ return node.kind === 215 /* MetaProperty */;
}
ts.isMetaProperty = isMetaProperty;
// Misc
function isTemplateSpan(node) {
- return node.kind === 216 /* TemplateSpan */;
+ return node.kind === 217 /* TemplateSpan */;
}
ts.isTemplateSpan = isTemplateSpan;
function isSemicolonClassElement(node) {
- return node.kind === 217 /* SemicolonClassElement */;
+ return node.kind === 218 /* SemicolonClassElement */;
}
ts.isSemicolonClassElement = isSemicolonClassElement;
// Block
function isBlock(node) {
- return node.kind === 218 /* Block */;
+ return node.kind === 219 /* Block */;
}
ts.isBlock = isBlock;
function isVariableStatement(node) {
- return node.kind === 219 /* VariableStatement */;
+ return node.kind === 220 /* VariableStatement */;
}
ts.isVariableStatement = isVariableStatement;
function isEmptyStatement(node) {
- return node.kind === 220 /* EmptyStatement */;
+ return node.kind === 221 /* EmptyStatement */;
}
ts.isEmptyStatement = isEmptyStatement;
function isExpressionStatement(node) {
- return node.kind === 221 /* ExpressionStatement */;
+ return node.kind === 222 /* ExpressionStatement */;
}
ts.isExpressionStatement = isExpressionStatement;
function isIfStatement(node) {
- return node.kind === 222 /* IfStatement */;
+ return node.kind === 223 /* IfStatement */;
}
ts.isIfStatement = isIfStatement;
function isDoStatement(node) {
- return node.kind === 223 /* DoStatement */;
+ return node.kind === 224 /* DoStatement */;
}
ts.isDoStatement = isDoStatement;
function isWhileStatement(node) {
- return node.kind === 224 /* WhileStatement */;
+ return node.kind === 225 /* WhileStatement */;
}
ts.isWhileStatement = isWhileStatement;
function isForStatement(node) {
- return node.kind === 225 /* ForStatement */;
+ return node.kind === 226 /* ForStatement */;
}
ts.isForStatement = isForStatement;
function isForInStatement(node) {
- return node.kind === 226 /* ForInStatement */;
+ return node.kind === 227 /* ForInStatement */;
}
ts.isForInStatement = isForInStatement;
function isForOfStatement(node) {
- return node.kind === 227 /* ForOfStatement */;
+ return node.kind === 228 /* ForOfStatement */;
}
ts.isForOfStatement = isForOfStatement;
function isContinueStatement(node) {
- return node.kind === 228 /* ContinueStatement */;
+ return node.kind === 229 /* ContinueStatement */;
}
ts.isContinueStatement = isContinueStatement;
function isBreakStatement(node) {
- return node.kind === 229 /* BreakStatement */;
+ return node.kind === 230 /* BreakStatement */;
}
ts.isBreakStatement = isBreakStatement;
function isBreakOrContinueStatement(node) {
- return node.kind === 229 /* BreakStatement */ || node.kind === 228 /* ContinueStatement */;
+ return node.kind === 230 /* BreakStatement */ || node.kind === 229 /* ContinueStatement */;
}
ts.isBreakOrContinueStatement = isBreakOrContinueStatement;
function isReturnStatement(node) {
- return node.kind === 230 /* ReturnStatement */;
+ return node.kind === 231 /* ReturnStatement */;
}
ts.isReturnStatement = isReturnStatement;
function isWithStatement(node) {
- return node.kind === 231 /* WithStatement */;
+ return node.kind === 232 /* WithStatement */;
}
ts.isWithStatement = isWithStatement;
function isSwitchStatement(node) {
- return node.kind === 232 /* SwitchStatement */;
+ return node.kind === 233 /* SwitchStatement */;
}
ts.isSwitchStatement = isSwitchStatement;
function isLabeledStatement(node) {
- return node.kind === 233 /* LabeledStatement */;
+ return node.kind === 234 /* LabeledStatement */;
}
ts.isLabeledStatement = isLabeledStatement;
function isThrowStatement(node) {
- return node.kind === 234 /* ThrowStatement */;
+ return node.kind === 235 /* ThrowStatement */;
}
ts.isThrowStatement = isThrowStatement;
function isTryStatement(node) {
- return node.kind === 235 /* TryStatement */;
+ return node.kind === 236 /* TryStatement */;
}
ts.isTryStatement = isTryStatement;
function isDebuggerStatement(node) {
- return node.kind === 236 /* DebuggerStatement */;
+ return node.kind === 237 /* DebuggerStatement */;
}
ts.isDebuggerStatement = isDebuggerStatement;
function isVariableDeclaration(node) {
- return node.kind === 237 /* VariableDeclaration */;
+ return node.kind === 238 /* VariableDeclaration */;
}
ts.isVariableDeclaration = isVariableDeclaration;
function isVariableDeclarationList(node) {
- return node.kind === 238 /* VariableDeclarationList */;
+ return node.kind === 239 /* VariableDeclarationList */;
}
ts.isVariableDeclarationList = isVariableDeclarationList;
function isFunctionDeclaration(node) {
- return node.kind === 239 /* FunctionDeclaration */;
+ return node.kind === 240 /* FunctionDeclaration */;
}
ts.isFunctionDeclaration = isFunctionDeclaration;
function isClassDeclaration(node) {
- return node.kind === 240 /* ClassDeclaration */;
+ return node.kind === 241 /* ClassDeclaration */;
}
ts.isClassDeclaration = isClassDeclaration;
function isInterfaceDeclaration(node) {
- return node.kind === 241 /* InterfaceDeclaration */;
+ return node.kind === 242 /* InterfaceDeclaration */;
}
ts.isInterfaceDeclaration = isInterfaceDeclaration;
function isTypeAliasDeclaration(node) {
- return node.kind === 242 /* TypeAliasDeclaration */;
+ return node.kind === 243 /* TypeAliasDeclaration */;
}
ts.isTypeAliasDeclaration = isTypeAliasDeclaration;
function isEnumDeclaration(node) {
- return node.kind === 243 /* EnumDeclaration */;
+ return node.kind === 244 /* EnumDeclaration */;
}
ts.isEnumDeclaration = isEnumDeclaration;
function isModuleDeclaration(node) {
- return node.kind === 244 /* ModuleDeclaration */;
+ return node.kind === 245 /* ModuleDeclaration */;
}
ts.isModuleDeclaration = isModuleDeclaration;
function isModuleBlock(node) {
- return node.kind === 245 /* ModuleBlock */;
+ return node.kind === 246 /* ModuleBlock */;
}
ts.isModuleBlock = isModuleBlock;
function isCaseBlock(node) {
- return node.kind === 246 /* CaseBlock */;
+ return node.kind === 247 /* CaseBlock */;
}
ts.isCaseBlock = isCaseBlock;
function isNamespaceExportDeclaration(node) {
- return node.kind === 247 /* NamespaceExportDeclaration */;
+ return node.kind === 248 /* NamespaceExportDeclaration */;
}
ts.isNamespaceExportDeclaration = isNamespaceExportDeclaration;
function isImportEqualsDeclaration(node) {
- return node.kind === 248 /* ImportEqualsDeclaration */;
+ return node.kind === 249 /* ImportEqualsDeclaration */;
}
ts.isImportEqualsDeclaration = isImportEqualsDeclaration;
function isImportDeclaration(node) {
- return node.kind === 249 /* ImportDeclaration */;
+ return node.kind === 250 /* ImportDeclaration */;
}
ts.isImportDeclaration = isImportDeclaration;
function isImportClause(node) {
- return node.kind === 250 /* ImportClause */;
+ return node.kind === 251 /* ImportClause */;
}
ts.isImportClause = isImportClause;
function isNamespaceImport(node) {
- return node.kind === 251 /* NamespaceImport */;
+ return node.kind === 252 /* NamespaceImport */;
}
ts.isNamespaceImport = isNamespaceImport;
function isNamedImports(node) {
- return node.kind === 252 /* NamedImports */;
+ return node.kind === 253 /* NamedImports */;
}
ts.isNamedImports = isNamedImports;
function isImportSpecifier(node) {
- return node.kind === 253 /* ImportSpecifier */;
+ return node.kind === 254 /* ImportSpecifier */;
}
ts.isImportSpecifier = isImportSpecifier;
function isExportAssignment(node) {
- return node.kind === 254 /* ExportAssignment */;
+ return node.kind === 255 /* ExportAssignment */;
}
ts.isExportAssignment = isExportAssignment;
function isExportDeclaration(node) {
- return node.kind === 255 /* ExportDeclaration */;
+ return node.kind === 256 /* ExportDeclaration */;
}
ts.isExportDeclaration = isExportDeclaration;
function isNamedExports(node) {
- return node.kind === 256 /* NamedExports */;
+ return node.kind === 257 /* NamedExports */;
}
ts.isNamedExports = isNamedExports;
function isExportSpecifier(node) {
- return node.kind === 257 /* ExportSpecifier */;
+ return node.kind === 258 /* ExportSpecifier */;
}
ts.isExportSpecifier = isExportSpecifier;
function isMissingDeclaration(node) {
- return node.kind === 258 /* MissingDeclaration */;
+ return node.kind === 259 /* MissingDeclaration */;
}
ts.isMissingDeclaration = isMissingDeclaration;
// Module References
function isExternalModuleReference(node) {
- return node.kind === 259 /* ExternalModuleReference */;
+ return node.kind === 260 /* ExternalModuleReference */;
}
ts.isExternalModuleReference = isExternalModuleReference;
// JSX
function isJsxElement(node) {
- return node.kind === 260 /* JsxElement */;
+ return node.kind === 261 /* JsxElement */;
}
ts.isJsxElement = isJsxElement;
function isJsxSelfClosingElement(node) {
- return node.kind === 261 /* JsxSelfClosingElement */;
+ return node.kind === 262 /* JsxSelfClosingElement */;
}
ts.isJsxSelfClosingElement = isJsxSelfClosingElement;
function isJsxOpeningElement(node) {
- return node.kind === 262 /* JsxOpeningElement */;
+ return node.kind === 263 /* JsxOpeningElement */;
}
ts.isJsxOpeningElement = isJsxOpeningElement;
function isJsxClosingElement(node) {
- return node.kind === 263 /* JsxClosingElement */;
+ return node.kind === 264 /* JsxClosingElement */;
}
ts.isJsxClosingElement = isJsxClosingElement;
function isJsxFragment(node) {
- return node.kind === 264 /* JsxFragment */;
+ return node.kind === 265 /* JsxFragment */;
}
ts.isJsxFragment = isJsxFragment;
function isJsxOpeningFragment(node) {
- return node.kind === 265 /* JsxOpeningFragment */;
+ return node.kind === 266 /* JsxOpeningFragment */;
}
ts.isJsxOpeningFragment = isJsxOpeningFragment;
function isJsxClosingFragment(node) {
- return node.kind === 266 /* JsxClosingFragment */;
+ return node.kind === 267 /* JsxClosingFragment */;
}
ts.isJsxClosingFragment = isJsxClosingFragment;
function isJsxAttribute(node) {
- return node.kind === 267 /* JsxAttribute */;
+ return node.kind === 268 /* JsxAttribute */;
}
ts.isJsxAttribute = isJsxAttribute;
function isJsxAttributes(node) {
- return node.kind === 268 /* JsxAttributes */;
+ return node.kind === 269 /* JsxAttributes */;
}
ts.isJsxAttributes = isJsxAttributes;
function isJsxSpreadAttribute(node) {
- return node.kind === 269 /* JsxSpreadAttribute */;
+ return node.kind === 270 /* JsxSpreadAttribute */;
}
ts.isJsxSpreadAttribute = isJsxSpreadAttribute;
function isJsxExpression(node) {
- return node.kind === 270 /* JsxExpression */;
+ return node.kind === 271 /* JsxExpression */;
}
ts.isJsxExpression = isJsxExpression;
// Clauses
function isCaseClause(node) {
- return node.kind === 271 /* CaseClause */;
+ return node.kind === 272 /* CaseClause */;
}
ts.isCaseClause = isCaseClause;
function isDefaultClause(node) {
- return node.kind === 272 /* DefaultClause */;
+ return node.kind === 273 /* DefaultClause */;
}
ts.isDefaultClause = isDefaultClause;
function isHeritageClause(node) {
- return node.kind === 273 /* HeritageClause */;
+ return node.kind === 274 /* HeritageClause */;
}
ts.isHeritageClause = isHeritageClause;
function isCatchClause(node) {
- return node.kind === 274 /* CatchClause */;
+ return node.kind === 275 /* CatchClause */;
}
ts.isCatchClause = isCatchClause;
// Property assignments
function isPropertyAssignment(node) {
- return node.kind === 275 /* PropertyAssignment */;
+ return node.kind === 276 /* PropertyAssignment */;
}
ts.isPropertyAssignment = isPropertyAssignment;
function isShorthandPropertyAssignment(node) {
- return node.kind === 276 /* ShorthandPropertyAssignment */;
+ return node.kind === 277 /* ShorthandPropertyAssignment */;
}
ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment;
function isSpreadAssignment(node) {
- return node.kind === 277 /* SpreadAssignment */;
+ return node.kind === 278 /* SpreadAssignment */;
}
ts.isSpreadAssignment = isSpreadAssignment;
// Enum
function isEnumMember(node) {
- return node.kind === 278 /* EnumMember */;
+ return node.kind === 279 /* EnumMember */;
}
ts.isEnumMember = isEnumMember;
// Top-level nodes
function isSourceFile(node) {
- return node.kind === 284 /* SourceFile */;
+ return node.kind === 285 /* SourceFile */;
}
ts.isSourceFile = isSourceFile;
function isBundle(node) {
- return node.kind === 285 /* Bundle */;
+ return node.kind === 286 /* Bundle */;
}
ts.isBundle = isBundle;
function isUnparsedSource(node) {
- return node.kind === 286 /* UnparsedSource */;
+ return node.kind === 287 /* UnparsedSource */;
}
ts.isUnparsedSource = isUnparsedSource;
function isUnparsedPrepend(node) {
- return node.kind === 280 /* UnparsedPrepend */;
+ return node.kind === 281 /* UnparsedPrepend */;
}
ts.isUnparsedPrepend = isUnparsedPrepend;
function isUnparsedTextLike(node) {
switch (node.kind) {
- case 281 /* UnparsedText */:
- case 282 /* UnparsedInternalText */:
+ case 282 /* UnparsedText */:
+ case 283 /* UnparsedInternalText */:
return true;
default:
return false;
@@ -14030,101 +14156,101 @@
ts.isUnparsedTextLike = isUnparsedTextLike;
function isUnparsedNode(node) {
return isUnparsedTextLike(node) ||
- node.kind === 279 /* UnparsedPrologue */ ||
- node.kind === 283 /* UnparsedSyntheticReference */;
+ node.kind === 280 /* UnparsedPrologue */ ||
+ node.kind === 284 /* UnparsedSyntheticReference */;
}
ts.isUnparsedNode = isUnparsedNode;
// JSDoc
function isJSDocTypeExpression(node) {
- return node.kind === 288 /* JSDocTypeExpression */;
+ return node.kind === 289 /* JSDocTypeExpression */;
}
ts.isJSDocTypeExpression = isJSDocTypeExpression;
function isJSDocAllType(node) {
- return node.kind === 289 /* JSDocAllType */;
+ return node.kind === 290 /* JSDocAllType */;
}
ts.isJSDocAllType = isJSDocAllType;
function isJSDocUnknownType(node) {
- return node.kind === 290 /* JSDocUnknownType */;
+ return node.kind === 291 /* JSDocUnknownType */;
}
ts.isJSDocUnknownType = isJSDocUnknownType;
function isJSDocNullableType(node) {
- return node.kind === 291 /* JSDocNullableType */;
+ return node.kind === 292 /* JSDocNullableType */;
}
ts.isJSDocNullableType = isJSDocNullableType;
function isJSDocNonNullableType(node) {
- return node.kind === 292 /* JSDocNonNullableType */;
+ return node.kind === 293 /* JSDocNonNullableType */;
}
ts.isJSDocNonNullableType = isJSDocNonNullableType;
function isJSDocOptionalType(node) {
- return node.kind === 293 /* JSDocOptionalType */;
+ return node.kind === 294 /* JSDocOptionalType */;
}
ts.isJSDocOptionalType = isJSDocOptionalType;
function isJSDocFunctionType(node) {
- return node.kind === 294 /* JSDocFunctionType */;
+ return node.kind === 295 /* JSDocFunctionType */;
}
ts.isJSDocFunctionType = isJSDocFunctionType;
function isJSDocVariadicType(node) {
- return node.kind === 295 /* JSDocVariadicType */;
+ return node.kind === 296 /* JSDocVariadicType */;
}
ts.isJSDocVariadicType = isJSDocVariadicType;
function isJSDoc(node) {
- return node.kind === 296 /* JSDocComment */;
+ return node.kind === 297 /* JSDocComment */;
}
ts.isJSDoc = isJSDoc;
function isJSDocAugmentsTag(node) {
- return node.kind === 300 /* JSDocAugmentsTag */;
+ return node.kind === 301 /* JSDocAugmentsTag */;
}
ts.isJSDocAugmentsTag = isJSDocAugmentsTag;
function isJSDocClassTag(node) {
- return node.kind === 301 /* JSDocClassTag */;
+ return node.kind === 302 /* JSDocClassTag */;
}
ts.isJSDocClassTag = isJSDocClassTag;
function isJSDocEnumTag(node) {
- return node.kind === 303 /* JSDocEnumTag */;
+ return node.kind === 304 /* JSDocEnumTag */;
}
ts.isJSDocEnumTag = isJSDocEnumTag;
function isJSDocThisTag(node) {
- return node.kind === 306 /* JSDocThisTag */;
+ return node.kind === 307 /* JSDocThisTag */;
}
ts.isJSDocThisTag = isJSDocThisTag;
function isJSDocParameterTag(node) {
- return node.kind === 304 /* JSDocParameterTag */;
+ return node.kind === 305 /* JSDocParameterTag */;
}
ts.isJSDocParameterTag = isJSDocParameterTag;
function isJSDocReturnTag(node) {
- return node.kind === 305 /* JSDocReturnTag */;
+ return node.kind === 306 /* JSDocReturnTag */;
}
ts.isJSDocReturnTag = isJSDocReturnTag;
function isJSDocTypeTag(node) {
- return node.kind === 307 /* JSDocTypeTag */;
+ return node.kind === 308 /* JSDocTypeTag */;
}
ts.isJSDocTypeTag = isJSDocTypeTag;
function isJSDocTemplateTag(node) {
- return node.kind === 308 /* JSDocTemplateTag */;
+ return node.kind === 309 /* JSDocTemplateTag */;
}
ts.isJSDocTemplateTag = isJSDocTemplateTag;
function isJSDocTypedefTag(node) {
- return node.kind === 309 /* JSDocTypedefTag */;
+ return node.kind === 310 /* JSDocTypedefTag */;
}
ts.isJSDocTypedefTag = isJSDocTypedefTag;
function isJSDocPropertyTag(node) {
- return node.kind === 310 /* JSDocPropertyTag */;
+ return node.kind === 311 /* JSDocPropertyTag */;
}
ts.isJSDocPropertyTag = isJSDocPropertyTag;
function isJSDocPropertyLikeTag(node) {
- return node.kind === 310 /* JSDocPropertyTag */ || node.kind === 304 /* JSDocParameterTag */;
+ return node.kind === 311 /* JSDocPropertyTag */ || node.kind === 305 /* JSDocParameterTag */;
}
ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag;
function isJSDocTypeLiteral(node) {
- return node.kind === 297 /* JSDocTypeLiteral */;
+ return node.kind === 298 /* JSDocTypeLiteral */;
}
ts.isJSDocTypeLiteral = isJSDocTypeLiteral;
function isJSDocCallbackTag(node) {
- return node.kind === 302 /* JSDocCallbackTag */;
+ return node.kind === 303 /* JSDocCallbackTag */;
}
ts.isJSDocCallbackTag = isJSDocCallbackTag;
function isJSDocSignature(node) {
- return node.kind === 298 /* JSDocSignature */;
+ return node.kind === 299 /* JSDocSignature */;
}
ts.isJSDocSignature = isJSDocSignature;
})(ts || (ts = {}));
@@ -14135,7 +14261,7 @@
(function (ts) {
/* @internal */
function isSyntaxList(n) {
- return n.kind === 311 /* SyntaxList */;
+ return n.kind === 312 /* SyntaxList */;
}
ts.isSyntaxList = isSyntaxList;
/* @internal */
@@ -14145,7 +14271,7 @@
ts.isNode = isNode;
/* @internal */
function isNodeKind(kind) {
- return kind >= 148 /* FirstNode */;
+ return kind >= 149 /* FirstNode */;
}
ts.isNodeKind = isNodeKind;
/**
@@ -14154,7 +14280,7 @@
* Literals are considered tokens, except TemplateLiteral, but does include TemplateHead/Middle/Tail.
*/
function isToken(n) {
- return n.kind >= 0 /* FirstToken */ && n.kind <= 147 /* LastToken */;
+ return n.kind >= 0 /* FirstToken */ && n.kind <= 148 /* LastToken */;
}
ts.isToken = isToken;
// Node Arrays
@@ -14207,17 +14333,17 @@
/* @internal */
function isModifierKind(token) {
switch (token) {
- case 118 /* AbstractKeyword */:
- case 121 /* AsyncKeyword */:
- case 77 /* ConstKeyword */:
- case 125 /* DeclareKeyword */:
- case 80 /* DefaultKeyword */:
- case 85 /* ExportKeyword */:
- case 115 /* PublicKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 133 /* ReadonlyKeyword */:
- case 116 /* StaticKeyword */:
+ case 119 /* AbstractKeyword */:
+ case 122 /* AsyncKeyword */:
+ case 78 /* ConstKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 81 /* DefaultKeyword */:
+ case 86 /* ExportKeyword */:
+ case 116 /* PublicKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 134 /* ReadonlyKeyword */:
+ case 117 /* StaticKeyword */:
return true;
}
return false;
@@ -14230,7 +14356,7 @@
ts.isParameterPropertyModifier = isParameterPropertyModifier;
/* @internal */
function isClassMemberModifier(idToken) {
- return isParameterPropertyModifier(idToken) || idToken === 116 /* StaticKeyword */;
+ return isParameterPropertyModifier(idToken) || idToken === 117 /* StaticKeyword */;
}
ts.isClassMemberModifier = isClassMemberModifier;
function isModifier(node) {
@@ -14239,23 +14365,23 @@
ts.isModifier = isModifier;
function isEntityName(node) {
var kind = node.kind;
- return kind === 148 /* QualifiedName */
- || kind === 72 /* Identifier */;
+ return kind === 149 /* QualifiedName */
+ || kind === 73 /* Identifier */;
}
ts.isEntityName = isEntityName;
function isPropertyName(node) {
var kind = node.kind;
- return kind === 72 /* Identifier */
+ return kind === 73 /* Identifier */
|| kind === 10 /* StringLiteral */
|| kind === 8 /* NumericLiteral */
- || kind === 149 /* ComputedPropertyName */;
+ || kind === 150 /* ComputedPropertyName */;
}
ts.isPropertyName = isPropertyName;
function isBindingName(node) {
var kind = node.kind;
- return kind === 72 /* Identifier */
- || kind === 184 /* ObjectBindingPattern */
- || kind === 185 /* ArrayBindingPattern */;
+ return kind === 73 /* Identifier */
+ || kind === 185 /* ObjectBindingPattern */
+ || kind === 186 /* ArrayBindingPattern */;
}
ts.isBindingName = isBindingName;
// Functions
@@ -14270,13 +14396,13 @@
ts.isFunctionLikeDeclaration = isFunctionLikeDeclaration;
function isFunctionLikeDeclarationKind(kind) {
switch (kind) {
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return true;
default:
return false;
@@ -14285,14 +14411,14 @@
/* @internal */
function isFunctionLikeKind(kind) {
switch (kind) {
- case 155 /* MethodSignature */:
- case 160 /* CallSignature */:
- case 298 /* JSDocSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
- case 165 /* FunctionType */:
- case 294 /* JSDocFunctionType */:
- case 166 /* ConstructorType */:
+ case 156 /* MethodSignature */:
+ case 161 /* CallSignature */:
+ case 299 /* JSDocSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
+ case 166 /* FunctionType */:
+ case 295 /* JSDocFunctionType */:
+ case 167 /* ConstructorType */:
return true;
default:
return isFunctionLikeDeclarationKind(kind);
@@ -14307,29 +14433,29 @@
// Classes
function isClassElement(node) {
var kind = node.kind;
- return kind === 157 /* Constructor */
- || kind === 154 /* PropertyDeclaration */
- || kind === 156 /* MethodDeclaration */
- || kind === 158 /* GetAccessor */
- || kind === 159 /* SetAccessor */
- || kind === 162 /* IndexSignature */
- || kind === 217 /* SemicolonClassElement */;
+ return kind === 158 /* Constructor */
+ || kind === 155 /* PropertyDeclaration */
+ || kind === 157 /* MethodDeclaration */
+ || kind === 159 /* GetAccessor */
+ || kind === 160 /* SetAccessor */
+ || kind === 163 /* IndexSignature */
+ || kind === 218 /* SemicolonClassElement */;
}
ts.isClassElement = isClassElement;
function isClassLike(node) {
- return node && (node.kind === 240 /* ClassDeclaration */ || node.kind === 209 /* ClassExpression */);
+ return node && (node.kind === 241 /* ClassDeclaration */ || node.kind === 210 /* ClassExpression */);
}
ts.isClassLike = isClassLike;
function isAccessor(node) {
- return node && (node.kind === 158 /* GetAccessor */ || node.kind === 159 /* SetAccessor */);
+ return node && (node.kind === 159 /* GetAccessor */ || node.kind === 160 /* SetAccessor */);
}
ts.isAccessor = isAccessor;
/* @internal */
function isMethodOrAccessor(node) {
switch (node.kind) {
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return true;
default:
return false;
@@ -14339,11 +14465,11 @@
// Type members
function isTypeElement(node) {
var kind = node.kind;
- return kind === 161 /* ConstructSignature */
- || kind === 160 /* CallSignature */
- || kind === 153 /* PropertySignature */
- || kind === 155 /* MethodSignature */
- || kind === 162 /* IndexSignature */;
+ return kind === 162 /* ConstructSignature */
+ || kind === 161 /* CallSignature */
+ || kind === 154 /* PropertySignature */
+ || kind === 156 /* MethodSignature */
+ || kind === 163 /* IndexSignature */;
}
ts.isTypeElement = isTypeElement;
function isClassOrTypeElement(node) {
@@ -14352,12 +14478,12 @@
ts.isClassOrTypeElement = isClassOrTypeElement;
function isObjectLiteralElementLike(node) {
var kind = node.kind;
- return kind === 275 /* PropertyAssignment */
- || kind === 276 /* ShorthandPropertyAssignment */
- || kind === 277 /* SpreadAssignment */
- || kind === 156 /* MethodDeclaration */
- || kind === 158 /* GetAccessor */
- || kind === 159 /* SetAccessor */;
+ return kind === 276 /* PropertyAssignment */
+ || kind === 277 /* ShorthandPropertyAssignment */
+ || kind === 278 /* SpreadAssignment */
+ || kind === 157 /* MethodDeclaration */
+ || kind === 159 /* GetAccessor */
+ || kind === 160 /* SetAccessor */;
}
ts.isObjectLiteralElementLike = isObjectLiteralElementLike;
// Type
@@ -14372,8 +14498,8 @@
ts.isTypeNode = isTypeNode;
function isFunctionOrConstructorTypeNode(node) {
switch (node.kind) {
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
return true;
}
return false;
@@ -14384,8 +14510,8 @@
function isBindingPattern(node) {
if (node) {
var kind = node.kind;
- return kind === 185 /* ArrayBindingPattern */
- || kind === 184 /* ObjectBindingPattern */;
+ return kind === 186 /* ArrayBindingPattern */
+ || kind === 185 /* ObjectBindingPattern */;
}
return false;
}
@@ -14393,15 +14519,15 @@
/* @internal */
function isAssignmentPattern(node) {
var kind = node.kind;
- return kind === 187 /* ArrayLiteralExpression */
- || kind === 188 /* ObjectLiteralExpression */;
+ return kind === 188 /* ArrayLiteralExpression */
+ || kind === 189 /* ObjectLiteralExpression */;
}
ts.isAssignmentPattern = isAssignmentPattern;
/* @internal */
function isArrayBindingElement(node) {
var kind = node.kind;
- return kind === 186 /* BindingElement */
- || kind === 210 /* OmittedExpression */;
+ return kind === 187 /* BindingElement */
+ || kind === 211 /* OmittedExpression */;
}
ts.isArrayBindingElement = isArrayBindingElement;
/**
@@ -14410,9 +14536,9 @@
/* @internal */
function isDeclarationBindingElement(bindingElement) {
switch (bindingElement.kind) {
- case 237 /* VariableDeclaration */:
- case 151 /* Parameter */:
- case 186 /* BindingElement */:
+ case 238 /* VariableDeclaration */:
+ case 152 /* Parameter */:
+ case 187 /* BindingElement */:
return true;
}
return false;
@@ -14433,8 +14559,8 @@
/* @internal */
function isObjectBindingOrAssignmentPattern(node) {
switch (node.kind) {
- case 184 /* ObjectBindingPattern */:
- case 188 /* ObjectLiteralExpression */:
+ case 185 /* ObjectBindingPattern */:
+ case 189 /* ObjectLiteralExpression */:
return true;
}
return false;
@@ -14446,8 +14572,8 @@
/* @internal */
function isArrayBindingOrAssignmentPattern(node) {
switch (node.kind) {
- case 185 /* ArrayBindingPattern */:
- case 187 /* ArrayLiteralExpression */:
+ case 186 /* ArrayBindingPattern */:
+ case 188 /* ArrayLiteralExpression */:
return true;
}
return false;
@@ -14456,26 +14582,26 @@
/* @internal */
function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) {
var kind = node.kind;
- return kind === 189 /* PropertyAccessExpression */
- || kind === 148 /* QualifiedName */
- || kind === 183 /* ImportType */;
+ return kind === 190 /* PropertyAccessExpression */
+ || kind === 149 /* QualifiedName */
+ || kind === 184 /* ImportType */;
}
ts.isPropertyAccessOrQualifiedNameOrImportTypeNode = isPropertyAccessOrQualifiedNameOrImportTypeNode;
// Expression
function isPropertyAccessOrQualifiedName(node) {
var kind = node.kind;
- return kind === 189 /* PropertyAccessExpression */
- || kind === 148 /* QualifiedName */;
+ return kind === 190 /* PropertyAccessExpression */
+ || kind === 149 /* QualifiedName */;
}
ts.isPropertyAccessOrQualifiedName = isPropertyAccessOrQualifiedName;
function isCallLikeExpression(node) {
switch (node.kind) {
- case 262 /* JsxOpeningElement */:
- case 261 /* JsxSelfClosingElement */:
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
- case 193 /* TaggedTemplateExpression */:
- case 152 /* Decorator */:
+ case 263 /* JsxOpeningElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
+ case 194 /* TaggedTemplateExpression */:
+ case 153 /* Decorator */:
return true;
default:
return false;
@@ -14483,12 +14609,12 @@
}
ts.isCallLikeExpression = isCallLikeExpression;
function isCallOrNewExpression(node) {
- return node.kind === 191 /* CallExpression */ || node.kind === 192 /* NewExpression */;
+ return node.kind === 192 /* CallExpression */ || node.kind === 193 /* NewExpression */;
}
ts.isCallOrNewExpression = isCallOrNewExpression;
function isTemplateLiteral(node) {
var kind = node.kind;
- return kind === 206 /* TemplateExpression */
+ return kind === 207 /* TemplateExpression */
|| kind === 14 /* NoSubstitutionTemplateLiteral */;
}
ts.isTemplateLiteral = isTemplateLiteral;
@@ -14499,34 +14625,34 @@
ts.isLeftHandSideExpression = isLeftHandSideExpression;
function isLeftHandSideExpressionKind(kind) {
switch (kind) {
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
- case 192 /* NewExpression */:
- case 191 /* CallExpression */:
- case 260 /* JsxElement */:
- case 261 /* JsxSelfClosingElement */:
- case 264 /* JsxFragment */:
- case 193 /* TaggedTemplateExpression */:
- case 187 /* ArrayLiteralExpression */:
- case 195 /* ParenthesizedExpression */:
- case 188 /* ObjectLiteralExpression */:
- case 209 /* ClassExpression */:
- case 196 /* FunctionExpression */:
- case 72 /* Identifier */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
+ case 193 /* NewExpression */:
+ case 192 /* CallExpression */:
+ case 261 /* JsxElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 265 /* JsxFragment */:
+ case 194 /* TaggedTemplateExpression */:
+ case 188 /* ArrayLiteralExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 189 /* ObjectLiteralExpression */:
+ case 210 /* ClassExpression */:
+ case 197 /* FunctionExpression */:
+ case 73 /* Identifier */:
case 13 /* RegularExpressionLiteral */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
case 10 /* StringLiteral */:
case 14 /* NoSubstitutionTemplateLiteral */:
- case 206 /* TemplateExpression */:
- case 87 /* FalseKeyword */:
- case 96 /* NullKeyword */:
- case 100 /* ThisKeyword */:
- case 102 /* TrueKeyword */:
- case 98 /* SuperKeyword */:
- case 213 /* NonNullExpression */:
- case 214 /* MetaProperty */:
- case 92 /* ImportKeyword */: // technically this is only an Expression if it's in a CallExpression
+ case 207 /* TemplateExpression */:
+ case 88 /* FalseKeyword */:
+ case 97 /* NullKeyword */:
+ case 101 /* ThisKeyword */:
+ case 103 /* TrueKeyword */:
+ case 99 /* SuperKeyword */:
+ case 214 /* NonNullExpression */:
+ case 215 /* MetaProperty */:
+ case 93 /* ImportKeyword */: // technically this is only an Expression if it's in a CallExpression
return true;
default:
return false;
@@ -14539,13 +14665,13 @@
ts.isUnaryExpression = isUnaryExpression;
function isUnaryExpressionKind(kind) {
switch (kind) {
- case 202 /* PrefixUnaryExpression */:
- case 203 /* PostfixUnaryExpression */:
- case 198 /* DeleteExpression */:
- case 199 /* TypeOfExpression */:
- case 200 /* VoidExpression */:
- case 201 /* AwaitExpression */:
- case 194 /* TypeAssertionExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
+ case 199 /* DeleteExpression */:
+ case 200 /* TypeOfExpression */:
+ case 201 /* VoidExpression */:
+ case 202 /* AwaitExpression */:
+ case 195 /* TypeAssertionExpression */:
return true;
default:
return isLeftHandSideExpressionKind(kind);
@@ -14554,9 +14680,9 @@
/* @internal */
function isUnaryExpressionWithWrite(expr) {
switch (expr.kind) {
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return true;
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return expr.operator === 44 /* PlusPlusToken */ ||
expr.operator === 45 /* MinusMinusToken */;
default:
@@ -14575,15 +14701,15 @@
ts.isExpression = isExpression;
function isExpressionKind(kind) {
switch (kind) {
- case 205 /* ConditionalExpression */:
- case 207 /* YieldExpression */:
- case 197 /* ArrowFunction */:
- case 204 /* BinaryExpression */:
- case 208 /* SpreadElement */:
- case 212 /* AsExpression */:
- case 210 /* OmittedExpression */:
- case 314 /* CommaListExpression */:
- case 313 /* PartiallyEmittedExpression */:
+ case 206 /* ConditionalExpression */:
+ case 208 /* YieldExpression */:
+ case 198 /* ArrowFunction */:
+ case 205 /* BinaryExpression */:
+ case 209 /* SpreadElement */:
+ case 213 /* AsExpression */:
+ case 211 /* OmittedExpression */:
+ case 315 /* CommaListExpression */:
+ case 314 /* PartiallyEmittedExpression */:
return true;
default:
return isUnaryExpressionKind(kind);
@@ -14591,18 +14717,18 @@
}
function isAssertionExpression(node) {
var kind = node.kind;
- return kind === 194 /* TypeAssertionExpression */
- || kind === 212 /* AsExpression */;
+ return kind === 195 /* TypeAssertionExpression */
+ || kind === 213 /* AsExpression */;
}
ts.isAssertionExpression = isAssertionExpression;
/* @internal */
function isPartiallyEmittedExpression(node) {
- return node.kind === 313 /* PartiallyEmittedExpression */;
+ return node.kind === 314 /* PartiallyEmittedExpression */;
}
ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression;
/* @internal */
function isNotEmittedStatement(node) {
- return node.kind === 312 /* NotEmittedStatement */;
+ return node.kind === 313 /* NotEmittedStatement */;
}
ts.isNotEmittedStatement = isNotEmittedStatement;
/* @internal */
@@ -14613,13 +14739,13 @@
ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode;
function isIterationStatement(node, lookInLabeledStatements) {
switch (node.kind) {
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
return true;
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements);
}
return false;
@@ -14627,7 +14753,7 @@
ts.isIterationStatement = isIterationStatement;
/* @internal */
function isForInOrOfStatement(node) {
- return node.kind === 226 /* ForInStatement */ || node.kind === 227 /* ForOfStatement */;
+ return node.kind === 227 /* ForInStatement */ || node.kind === 228 /* ForOfStatement */;
}
ts.isForInOrOfStatement = isForInOrOfStatement;
// Element
@@ -14651,113 +14777,113 @@
/* @internal */
function isModuleBody(node) {
var kind = node.kind;
- return kind === 245 /* ModuleBlock */
- || kind === 244 /* ModuleDeclaration */
- || kind === 72 /* Identifier */;
+ return kind === 246 /* ModuleBlock */
+ || kind === 245 /* ModuleDeclaration */
+ || kind === 73 /* Identifier */;
}
ts.isModuleBody = isModuleBody;
/* @internal */
function isNamespaceBody(node) {
var kind = node.kind;
- return kind === 245 /* ModuleBlock */
- || kind === 244 /* ModuleDeclaration */;
+ return kind === 246 /* ModuleBlock */
+ || kind === 245 /* ModuleDeclaration */;
}
ts.isNamespaceBody = isNamespaceBody;
/* @internal */
function isJSDocNamespaceBody(node) {
var kind = node.kind;
- return kind === 72 /* Identifier */
- || kind === 244 /* ModuleDeclaration */;
+ return kind === 73 /* Identifier */
+ || kind === 245 /* ModuleDeclaration */;
}
ts.isJSDocNamespaceBody = isJSDocNamespaceBody;
/* @internal */
function isNamedImportBindings(node) {
var kind = node.kind;
- return kind === 252 /* NamedImports */
- || kind === 251 /* NamespaceImport */;
+ return kind === 253 /* NamedImports */
+ || kind === 252 /* NamespaceImport */;
}
ts.isNamedImportBindings = isNamedImportBindings;
/* @internal */
function isModuleOrEnumDeclaration(node) {
- return node.kind === 244 /* ModuleDeclaration */ || node.kind === 243 /* EnumDeclaration */;
+ return node.kind === 245 /* ModuleDeclaration */ || node.kind === 244 /* EnumDeclaration */;
}
ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration;
function isDeclarationKind(kind) {
- return kind === 197 /* ArrowFunction */
- || kind === 186 /* BindingElement */
- || kind === 240 /* ClassDeclaration */
- || kind === 209 /* ClassExpression */
- || kind === 157 /* Constructor */
- || kind === 243 /* EnumDeclaration */
- || kind === 278 /* EnumMember */
- || kind === 257 /* ExportSpecifier */
- || kind === 239 /* FunctionDeclaration */
- || kind === 196 /* FunctionExpression */
- || kind === 158 /* GetAccessor */
- || kind === 250 /* ImportClause */
- || kind === 248 /* ImportEqualsDeclaration */
- || kind === 253 /* ImportSpecifier */
- || kind === 241 /* InterfaceDeclaration */
- || kind === 267 /* JsxAttribute */
- || kind === 156 /* MethodDeclaration */
- || kind === 155 /* MethodSignature */
- || kind === 244 /* ModuleDeclaration */
- || kind === 247 /* NamespaceExportDeclaration */
- || kind === 251 /* NamespaceImport */
- || kind === 151 /* Parameter */
- || kind === 275 /* PropertyAssignment */
- || kind === 154 /* PropertyDeclaration */
- || kind === 153 /* PropertySignature */
- || kind === 159 /* SetAccessor */
- || kind === 276 /* ShorthandPropertyAssignment */
- || kind === 242 /* TypeAliasDeclaration */
- || kind === 150 /* TypeParameter */
- || kind === 237 /* VariableDeclaration */
- || kind === 309 /* JSDocTypedefTag */
- || kind === 302 /* JSDocCallbackTag */
- || kind === 310 /* JSDocPropertyTag */;
+ return kind === 198 /* ArrowFunction */
+ || kind === 187 /* BindingElement */
+ || kind === 241 /* ClassDeclaration */
+ || kind === 210 /* ClassExpression */
+ || kind === 158 /* Constructor */
+ || kind === 244 /* EnumDeclaration */
+ || kind === 279 /* EnumMember */
+ || kind === 258 /* ExportSpecifier */
+ || kind === 240 /* FunctionDeclaration */
+ || kind === 197 /* FunctionExpression */
+ || kind === 159 /* GetAccessor */
+ || kind === 251 /* ImportClause */
+ || kind === 249 /* ImportEqualsDeclaration */
+ || kind === 254 /* ImportSpecifier */
+ || kind === 242 /* InterfaceDeclaration */
+ || kind === 268 /* JsxAttribute */
+ || kind === 157 /* MethodDeclaration */
+ || kind === 156 /* MethodSignature */
+ || kind === 245 /* ModuleDeclaration */
+ || kind === 248 /* NamespaceExportDeclaration */
+ || kind === 252 /* NamespaceImport */
+ || kind === 152 /* Parameter */
+ || kind === 276 /* PropertyAssignment */
+ || kind === 155 /* PropertyDeclaration */
+ || kind === 154 /* PropertySignature */
+ || kind === 160 /* SetAccessor */
+ || kind === 277 /* ShorthandPropertyAssignment */
+ || kind === 243 /* TypeAliasDeclaration */
+ || kind === 151 /* TypeParameter */
+ || kind === 238 /* VariableDeclaration */
+ || kind === 310 /* JSDocTypedefTag */
+ || kind === 303 /* JSDocCallbackTag */
+ || kind === 311 /* JSDocPropertyTag */;
}
function isDeclarationStatementKind(kind) {
- return kind === 239 /* FunctionDeclaration */
- || kind === 258 /* MissingDeclaration */
- || kind === 240 /* ClassDeclaration */
- || kind === 241 /* InterfaceDeclaration */
- || kind === 242 /* TypeAliasDeclaration */
- || kind === 243 /* EnumDeclaration */
- || kind === 244 /* ModuleDeclaration */
- || kind === 249 /* ImportDeclaration */
- || kind === 248 /* ImportEqualsDeclaration */
- || kind === 255 /* ExportDeclaration */
- || kind === 254 /* ExportAssignment */
- || kind === 247 /* NamespaceExportDeclaration */;
+ return kind === 240 /* FunctionDeclaration */
+ || kind === 259 /* MissingDeclaration */
+ || kind === 241 /* ClassDeclaration */
+ || kind === 242 /* InterfaceDeclaration */
+ || kind === 243 /* TypeAliasDeclaration */
+ || kind === 244 /* EnumDeclaration */
+ || kind === 245 /* ModuleDeclaration */
+ || kind === 250 /* ImportDeclaration */
+ || kind === 249 /* ImportEqualsDeclaration */
+ || kind === 256 /* ExportDeclaration */
+ || kind === 255 /* ExportAssignment */
+ || kind === 248 /* NamespaceExportDeclaration */;
}
function isStatementKindButNotDeclarationKind(kind) {
- return kind === 229 /* BreakStatement */
- || kind === 228 /* ContinueStatement */
- || kind === 236 /* DebuggerStatement */
- || kind === 223 /* DoStatement */
- || kind === 221 /* ExpressionStatement */
- || kind === 220 /* EmptyStatement */
- || kind === 226 /* ForInStatement */
- || kind === 227 /* ForOfStatement */
- || kind === 225 /* ForStatement */
- || kind === 222 /* IfStatement */
- || kind === 233 /* LabeledStatement */
- || kind === 230 /* ReturnStatement */
- || kind === 232 /* SwitchStatement */
- || kind === 234 /* ThrowStatement */
- || kind === 235 /* TryStatement */
- || kind === 219 /* VariableStatement */
- || kind === 224 /* WhileStatement */
- || kind === 231 /* WithStatement */
- || kind === 312 /* NotEmittedStatement */
- || kind === 316 /* EndOfDeclarationMarker */
- || kind === 315 /* MergeDeclarationMarker */;
+ return kind === 230 /* BreakStatement */
+ || kind === 229 /* ContinueStatement */
+ || kind === 237 /* DebuggerStatement */
+ || kind === 224 /* DoStatement */
+ || kind === 222 /* ExpressionStatement */
+ || kind === 221 /* EmptyStatement */
+ || kind === 227 /* ForInStatement */
+ || kind === 228 /* ForOfStatement */
+ || kind === 226 /* ForStatement */
+ || kind === 223 /* IfStatement */
+ || kind === 234 /* LabeledStatement */
+ || kind === 231 /* ReturnStatement */
+ || kind === 233 /* SwitchStatement */
+ || kind === 235 /* ThrowStatement */
+ || kind === 236 /* TryStatement */
+ || kind === 220 /* VariableStatement */
+ || kind === 225 /* WhileStatement */
+ || kind === 232 /* WithStatement */
+ || kind === 313 /* NotEmittedStatement */
+ || kind === 317 /* EndOfDeclarationMarker */
+ || kind === 316 /* MergeDeclarationMarker */;
}
/* @internal */
function isDeclaration(node) {
- if (node.kind === 150 /* TypeParameter */) {
- return (node.parent && node.parent.kind !== 308 /* JSDocTemplateTag */) || ts.isInJSFile(node);
+ if (node.kind === 151 /* TypeParameter */) {
+ return (node.parent && node.parent.kind !== 309 /* JSDocTemplateTag */) || ts.isInJSFile(node);
}
return isDeclarationKind(node.kind);
}
@@ -14784,10 +14910,10 @@
}
ts.isStatement = isStatement;
function isBlockStatement(node) {
- if (node.kind !== 218 /* Block */)
+ if (node.kind !== 219 /* Block */)
return false;
if (node.parent !== undefined) {
- if (node.parent.kind === 235 /* TryStatement */ || node.parent.kind === 274 /* CatchClause */) {
+ if (node.parent.kind === 236 /* TryStatement */ || node.parent.kind === 275 /* CatchClause */) {
return false;
}
}
@@ -14797,81 +14923,81 @@
/* @internal */
function isModuleReference(node) {
var kind = node.kind;
- return kind === 259 /* ExternalModuleReference */
- || kind === 148 /* QualifiedName */
- || kind === 72 /* Identifier */;
+ return kind === 260 /* ExternalModuleReference */
+ || kind === 149 /* QualifiedName */
+ || kind === 73 /* Identifier */;
}
ts.isModuleReference = isModuleReference;
// JSX
/* @internal */
function isJsxTagNameExpression(node) {
var kind = node.kind;
- return kind === 100 /* ThisKeyword */
- || kind === 72 /* Identifier */
- || kind === 189 /* PropertyAccessExpression */;
+ return kind === 101 /* ThisKeyword */
+ || kind === 73 /* Identifier */
+ || kind === 190 /* PropertyAccessExpression */;
}
ts.isJsxTagNameExpression = isJsxTagNameExpression;
/* @internal */
function isJsxChild(node) {
var kind = node.kind;
- return kind === 260 /* JsxElement */
- || kind === 270 /* JsxExpression */
- || kind === 261 /* JsxSelfClosingElement */
+ return kind === 261 /* JsxElement */
+ || kind === 271 /* JsxExpression */
+ || kind === 262 /* JsxSelfClosingElement */
|| kind === 11 /* JsxText */
- || kind === 264 /* JsxFragment */;
+ || kind === 265 /* JsxFragment */;
}
ts.isJsxChild = isJsxChild;
/* @internal */
function isJsxAttributeLike(node) {
var kind = node.kind;
- return kind === 267 /* JsxAttribute */
- || kind === 269 /* JsxSpreadAttribute */;
+ return kind === 268 /* JsxAttribute */
+ || kind === 270 /* JsxSpreadAttribute */;
}
ts.isJsxAttributeLike = isJsxAttributeLike;
/* @internal */
function isStringLiteralOrJsxExpression(node) {
var kind = node.kind;
return kind === 10 /* StringLiteral */
- || kind === 270 /* JsxExpression */;
+ || kind === 271 /* JsxExpression */;
}
ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression;
function isJsxOpeningLikeElement(node) {
var kind = node.kind;
- return kind === 262 /* JsxOpeningElement */
- || kind === 261 /* JsxSelfClosingElement */;
+ return kind === 263 /* JsxOpeningElement */
+ || kind === 262 /* JsxSelfClosingElement */;
}
ts.isJsxOpeningLikeElement = isJsxOpeningLikeElement;
// Clauses
function isCaseOrDefaultClause(node) {
var kind = node.kind;
- return kind === 271 /* CaseClause */
- || kind === 272 /* DefaultClause */;
+ return kind === 272 /* CaseClause */
+ || kind === 273 /* DefaultClause */;
}
ts.isCaseOrDefaultClause = isCaseOrDefaultClause;
// JSDoc
/** True if node is of some JSDoc syntax kind. */
/* @internal */
function isJSDocNode(node) {
- return node.kind >= 288 /* FirstJSDocNode */ && node.kind <= 310 /* LastJSDocNode */;
+ return node.kind >= 289 /* FirstJSDocNode */ && node.kind <= 311 /* LastJSDocNode */;
}
ts.isJSDocNode = isJSDocNode;
/** True if node is of a kind that may contain comment text. */
function isJSDocCommentContainingNode(node) {
- return node.kind === 296 /* JSDocComment */ || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) || ts.isJSDocSignature(node);
+ return node.kind === 297 /* JSDocComment */ || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) || ts.isJSDocSignature(node);
}
ts.isJSDocCommentContainingNode = isJSDocCommentContainingNode;
// TODO: determine what this does before making it public.
/* @internal */
function isJSDocTag(node) {
- return node.kind >= 299 /* FirstJSDocTagNode */ && node.kind <= 310 /* LastJSDocTagNode */;
+ return node.kind >= 300 /* FirstJSDocTagNode */ && node.kind <= 311 /* LastJSDocTagNode */;
}
ts.isJSDocTag = isJSDocTag;
function isSetAccessor(node) {
- return node.kind === 159 /* SetAccessor */;
+ return node.kind === 160 /* SetAccessor */;
}
ts.isSetAccessor = isSetAccessor;
function isGetAccessor(node) {
- return node.kind === 158 /* GetAccessor */;
+ return node.kind === 159 /* GetAccessor */;
}
ts.isGetAccessor = isGetAccessor;
/** True if has jsdoc nodes attached to it. */
@@ -14901,12 +15027,12 @@
}
ts.hasOnlyExpressionInitializer = hasOnlyExpressionInitializer;
function isObjectLiteralElement(node) {
- return node.kind === 267 /* JsxAttribute */ || node.kind === 269 /* JsxSpreadAttribute */ || isObjectLiteralElementLike(node);
+ return node.kind === 268 /* JsxAttribute */ || node.kind === 270 /* JsxSpreadAttribute */ || isObjectLiteralElementLike(node);
}
ts.isObjectLiteralElement = isObjectLiteralElement;
/* @internal */
function isTypeReferenceType(node) {
- return node.kind === 164 /* TypeReference */ || node.kind === 211 /* ExpressionWithTypeArguments */;
+ return node.kind === 165 /* TypeReference */ || node.kind === 212 /* ExpressionWithTypeArguments */;
}
ts.isTypeReferenceType = isTypeReferenceType;
var MAX_SMI_X86 = 1073741823;
@@ -14942,7 +15068,7 @@
/* @internal */
(function (ts) {
function isNamedImportsOrExports(node) {
- return node.kind === 252 /* NamedImports */ || node.kind === 256 /* NamedExports */;
+ return node.kind === 253 /* NamedImports */ || node.kind === 257 /* NamedExports */;
}
ts.isNamedImportsOrExports = isNamedImportsOrExports;
function Symbol(flags, name) {
@@ -15193,6 +15319,11 @@
ts.semanticDiagnosticsOptionDeclarations.some(function (option) { return !ts.isJsonEqual(getCompilerOptionValue(oldOptions, option), getCompilerOptionValue(newOptions, option)); });
}
ts.compilerOptionsAffectSemanticDiagnostics = compilerOptionsAffectSemanticDiagnostics;
+ function compilerOptionsAffectEmit(newOptions, oldOptions) {
+ return oldOptions !== newOptions &&
+ ts.affectsEmitOptionDeclarations.some(function (option) { return !ts.isJsonEqual(getCompilerOptionValue(oldOptions, option), getCompilerOptionValue(newOptions, option)); });
+ }
+ ts.compilerOptionsAffectEmit = compilerOptionsAffectEmit;
function getCompilerOptionValue(options, option) {
return option.strictFlag ? getStrictOptionValue(options, option.name) : options[option.name];
}
@@ -15471,6 +15602,15 @@
return root + pathComponents.slice(1).join(ts.directorySeparator);
}
ts.getPathFromPathComponents = getPathFromPathComponents;
+ function getNormalizedAbsolutePathWithoutRoot(fileName, currentDirectory) {
+ return getPathWithoutRoot(getNormalizedPathComponents(fileName, currentDirectory));
+ }
+ ts.getNormalizedAbsolutePathWithoutRoot = getNormalizedAbsolutePathWithoutRoot;
+ function getPathWithoutRoot(pathComponents) {
+ if (pathComponents.length === 0)
+ return "";
+ return pathComponents.slice(1).join(ts.directorySeparator);
+ }
})(ts || (ts = {}));
/* @internal */
(function (ts) {
@@ -15501,7 +15641,7 @@
}
ts.getRelativePathFromFile = getRelativePathFromFile;
function getRelativePathFromDirectory(fromDirectory, to, getCanonicalFileNameOrIgnoreCase) {
- Debug.assert((ts.getRootLength(fromDirectory) > 0) === (ts.getRootLength(to) > 0), "Paths must either both be absolute or both be relative");
+ ts.Debug.assert((ts.getRootLength(fromDirectory) > 0) === (ts.getRootLength(to) > 0), "Paths must either both be absolute or both be relative");
var getCanonicalFileName = typeof getCanonicalFileNameOrIgnoreCase === "function" ? getCanonicalFileNameOrIgnoreCase : ts.identity;
var ignoreCase = typeof getCanonicalFileNameOrIgnoreCase === "boolean" ? getCanonicalFileNameOrIgnoreCase : false;
var pathComponents = getPathComponentsRelativeTo(fromDirectory, to, ignoreCase ? ts.equateStringsCaseInsensitive : ts.equateStringsCaseSensitive, getCanonicalFileName);
@@ -16145,32 +16285,9 @@
return pathext ? path.slice(0, path.length - pathext.length) + (ts.startsWith(ext, ".") ? ext : "." + ext) : path;
}
ts.changeAnyExtension = changeAnyExtension;
- var Debug;
- (function (Debug) {
- function showSymbol(symbol) {
- var symbolFlags = ts.SymbolFlags;
- return "{ flags: " + (symbolFlags ? showFlags(symbol.flags, symbolFlags) : symbol.flags) + "; declarations: " + ts.map(symbol.declarations, showSyntaxKind) + " }";
- }
- Debug.showSymbol = showSymbol;
- function showFlags(flags, flagsEnum) {
- var out = [];
- for (var pow = 0; pow <= 30; pow++) {
- var n = 1 << pow;
- if (flags & n) {
- out.push(flagsEnum[n]);
- }
- }
- return out.join("|");
- }
- function showSyntaxKind(node) {
- var syntaxKind = ts.SyntaxKind;
- return syntaxKind ? syntaxKind[node.kind] : node.kind.toString();
- }
- Debug.showSyntaxKind = showSyntaxKind;
- })(Debug = ts.Debug || (ts.Debug = {}));
function tryParsePattern(pattern) {
// This should be verified outside of here and a proper error thrown.
- Debug.assert(ts.hasZeroOrOneAsteriskCharacter(pattern));
+ ts.Debug.assert(ts.hasZeroOrOneAsteriskCharacter(pattern));
var indexOfStar = pattern.indexOf("*");
return indexOfStar === -1 ? undefined : {
prefix: pattern.substr(0, indexOfStar),
@@ -16199,7 +16316,7 @@
*/
function extensionFromPath(path) {
var ext = tryGetExtensionFromPath(path);
- return ext !== undefined ? ext : Debug.fail("File " + path + " has unknown extension.");
+ return ext !== undefined ? ext : ts.Debug.fail("File " + path + " has unknown extension.");
}
ts.extensionFromPath = extensionFromPath;
function isAnySupportedFileExtension(path) {
@@ -16271,7 +16388,7 @@
ts.matchPatternOrExact = matchPatternOrExact;
function sliceAfter(arr, value) {
var index = arr.indexOf(value);
- Debug.assert(index !== -1);
+ ts.Debug.assert(index !== -1);
return arr.slice(index);
}
ts.sliceAfter = sliceAfter;
@@ -16289,7 +16406,7 @@
}
ts.addRelatedInfo = addRelatedInfo;
function minAndMax(arr, getValue) {
- Debug.assert(arr.length !== 0);
+ ts.Debug.assert(arr.length !== 0);
var min = getValue(arr[0]);
var max = min;
for (var i = 1; i < arr.length; i++) {
@@ -16487,10 +16604,10 @@
var SourceFileConstructor;
// tslint:enable variable-name
function createNode(kind, pos, end) {
- if (kind === 284 /* SourceFile */) {
+ if (kind === 285 /* SourceFile */) {
return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end);
}
- else if (kind === 72 /* Identifier */) {
+ else if (kind === 73 /* Identifier */) {
return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, pos, end);
}
else if (!ts.isNodeKind(kind)) {
@@ -16539,19 +16656,19 @@
* that they appear in the source code. The language service depends on this property to locate nodes by position.
*/
function forEachChild(node, cbNode, cbNodes) {
- if (!node || node.kind <= 147 /* LastToken */) {
+ if (!node || node.kind <= 148 /* LastToken */) {
return;
}
switch (node.kind) {
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
return visitNode(cbNode, node.left) ||
visitNode(cbNode, node.right);
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.constraint) ||
visitNode(cbNode, node.default) ||
visitNode(cbNode, node.expression);
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
@@ -16559,9 +16676,9 @@
visitNode(cbNode, node.exclamationToken) ||
visitNode(cbNode, node.equalsToken) ||
visitNode(cbNode, node.objectAssignmentInitializer);
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
return visitNode(cbNode, node.expression);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.dotDotDotToken) ||
@@ -16569,7 +16686,7 @@
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.initializer);
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
@@ -16577,51 +16694,51 @@
visitNode(cbNode, node.exclamationToken) ||
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.initializer);
- case 153 /* PropertySignature */:
+ case 154 /* PropertySignature */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.initializer);
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.initializer);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.exclamationToken) ||
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.initializer);
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.dotDotDotToken) ||
visitNode(cbNode, node.propertyName) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.initializer);
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNodes(cbNode, cbNodes, node.typeParameters) ||
visitNodes(cbNode, cbNodes, node.parameters) ||
visitNode(cbNode, node.type);
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 196 /* FunctionExpression */:
- case 239 /* FunctionDeclaration */:
- case 197 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 197 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
+ case 198 /* ArrowFunction */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.asteriskToken) ||
@@ -16633,343 +16750,343 @@
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.equalsGreaterThanToken) ||
visitNode(cbNode, node.body);
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return visitNode(cbNode, node.typeName) ||
visitNodes(cbNode, cbNodes, node.typeArguments);
- case 163 /* TypePredicate */:
+ case 164 /* TypePredicate */:
return visitNode(cbNode, node.parameterName) ||
visitNode(cbNode, node.type);
- case 167 /* TypeQuery */:
+ case 168 /* TypeQuery */:
return visitNode(cbNode, node.exprName);
- case 168 /* TypeLiteral */:
+ case 169 /* TypeLiteral */:
return visitNodes(cbNode, cbNodes, node.members);
- case 169 /* ArrayType */:
+ case 170 /* ArrayType */:
return visitNode(cbNode, node.elementType);
- case 170 /* TupleType */:
+ case 171 /* TupleType */:
return visitNodes(cbNode, cbNodes, node.elementTypes);
- case 173 /* UnionType */:
- case 174 /* IntersectionType */:
+ case 174 /* UnionType */:
+ case 175 /* IntersectionType */:
return visitNodes(cbNode, cbNodes, node.types);
- case 175 /* ConditionalType */:
+ case 176 /* ConditionalType */:
return visitNode(cbNode, node.checkType) ||
visitNode(cbNode, node.extendsType) ||
visitNode(cbNode, node.trueType) ||
visitNode(cbNode, node.falseType);
- case 176 /* InferType */:
+ case 177 /* InferType */:
return visitNode(cbNode, node.typeParameter);
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return visitNode(cbNode, node.argument) ||
visitNode(cbNode, node.qualifier) ||
visitNodes(cbNode, cbNodes, node.typeArguments);
- case 177 /* ParenthesizedType */:
- case 179 /* TypeOperator */:
+ case 178 /* ParenthesizedType */:
+ case 180 /* TypeOperator */:
return visitNode(cbNode, node.type);
- case 180 /* IndexedAccessType */:
+ case 181 /* IndexedAccessType */:
return visitNode(cbNode, node.objectType) ||
visitNode(cbNode, node.indexType);
- case 181 /* MappedType */:
+ case 182 /* MappedType */:
return visitNode(cbNode, node.readonlyToken) ||
visitNode(cbNode, node.typeParameter) ||
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.type);
- case 182 /* LiteralType */:
+ case 183 /* LiteralType */:
return visitNode(cbNode, node.literal);
- case 184 /* ObjectBindingPattern */:
- case 185 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
return visitNodes(cbNode, cbNodes, node.elements);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return visitNodes(cbNode, cbNodes, node.elements);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return visitNodes(cbNode, cbNodes, node.properties);
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.name);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.argumentExpression);
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
return visitNode(cbNode, node.expression) ||
visitNodes(cbNode, cbNodes, node.typeArguments) ||
visitNodes(cbNode, cbNodes, node.arguments);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return visitNode(cbNode, node.tag) ||
visitNodes(cbNode, cbNodes, node.typeArguments) ||
visitNode(cbNode, node.template);
- case 194 /* TypeAssertionExpression */:
+ case 195 /* TypeAssertionExpression */:
return visitNode(cbNode, node.type) ||
visitNode(cbNode, node.expression);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return visitNode(cbNode, node.expression);
- case 198 /* DeleteExpression */:
+ case 199 /* DeleteExpression */:
return visitNode(cbNode, node.expression);
- case 199 /* TypeOfExpression */:
+ case 200 /* TypeOfExpression */:
return visitNode(cbNode, node.expression);
- case 200 /* VoidExpression */:
+ case 201 /* VoidExpression */:
return visitNode(cbNode, node.expression);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return visitNode(cbNode, node.operand);
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return visitNode(cbNode, node.asteriskToken) ||
visitNode(cbNode, node.expression);
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
return visitNode(cbNode, node.expression);
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return visitNode(cbNode, node.operand);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return visitNode(cbNode, node.left) ||
visitNode(cbNode, node.operatorToken) ||
visitNode(cbNode, node.right);
- case 212 /* AsExpression */:
+ case 213 /* AsExpression */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.type);
- case 213 /* NonNullExpression */:
+ case 214 /* NonNullExpression */:
return visitNode(cbNode, node.expression);
- case 214 /* MetaProperty */:
+ case 215 /* MetaProperty */:
return visitNode(cbNode, node.name);
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return visitNode(cbNode, node.condition) ||
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.whenTrue) ||
visitNode(cbNode, node.colonToken) ||
visitNode(cbNode, node.whenFalse);
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
return visitNode(cbNode, node.expression);
- case 218 /* Block */:
- case 245 /* ModuleBlock */:
+ case 219 /* Block */:
+ case 246 /* ModuleBlock */:
return visitNodes(cbNode, cbNodes, node.statements);
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return visitNodes(cbNode, cbNodes, node.statements) ||
visitNode(cbNode, node.endOfFileToken);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.declarationList);
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
return visitNodes(cbNode, cbNodes, node.declarations);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return visitNode(cbNode, node.expression);
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.thenStatement) ||
visitNode(cbNode, node.elseStatement);
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
return visitNode(cbNode, node.statement) ||
visitNode(cbNode, node.expression);
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.statement);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return visitNode(cbNode, node.initializer) ||
visitNode(cbNode, node.condition) ||
visitNode(cbNode, node.incrementor) ||
visitNode(cbNode, node.statement);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return visitNode(cbNode, node.initializer) ||
visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.statement);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return visitNode(cbNode, node.awaitModifier) ||
visitNode(cbNode, node.initializer) ||
visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.statement);
- case 228 /* ContinueStatement */:
- case 229 /* BreakStatement */:
+ case 229 /* ContinueStatement */:
+ case 230 /* BreakStatement */:
return visitNode(cbNode, node.label);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return visitNode(cbNode, node.expression);
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.statement);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.caseBlock);
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
return visitNodes(cbNode, cbNodes, node.clauses);
- case 271 /* CaseClause */:
+ case 272 /* CaseClause */:
return visitNode(cbNode, node.expression) ||
visitNodes(cbNode, cbNodes, node.statements);
- case 272 /* DefaultClause */:
+ case 273 /* DefaultClause */:
return visitNodes(cbNode, cbNodes, node.statements);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return visitNode(cbNode, node.label) ||
visitNode(cbNode, node.statement);
- case 234 /* ThrowStatement */:
+ case 235 /* ThrowStatement */:
return visitNode(cbNode, node.expression);
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
return visitNode(cbNode, node.tryBlock) ||
visitNode(cbNode, node.catchClause) ||
visitNode(cbNode, node.finallyBlock);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return visitNode(cbNode, node.variableDeclaration) ||
visitNode(cbNode, node.block);
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
return visitNode(cbNode, node.expression);
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNodes(cbNode, cbNodes, node.typeParameters) ||
visitNodes(cbNode, cbNodes, node.heritageClauses) ||
visitNodes(cbNode, cbNodes, node.members);
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNodes(cbNode, cbNodes, node.typeParameters) ||
visitNodes(cbNode, cbNodes, node.heritageClauses) ||
visitNodes(cbNode, cbNodes, node.members);
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNodes(cbNode, cbNodes, node.typeParameters) ||
visitNode(cbNode, node.type);
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNodes(cbNode, cbNodes, node.members);
- case 278 /* EnumMember */:
+ case 279 /* EnumMember */:
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.initializer);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.body);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.moduleReference);
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.importClause) ||
visitNode(cbNode, node.moduleSpecifier);
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.namedBindings);
- case 247 /* NamespaceExportDeclaration */:
+ case 248 /* NamespaceExportDeclaration */:
return visitNode(cbNode, node.name);
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
return visitNode(cbNode, node.name);
- case 252 /* NamedImports */:
- case 256 /* NamedExports */:
+ case 253 /* NamedImports */:
+ case 257 /* NamedExports */:
return visitNodes(cbNode, cbNodes, node.elements);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.exportClause) ||
visitNode(cbNode, node.moduleSpecifier);
- case 253 /* ImportSpecifier */:
- case 257 /* ExportSpecifier */:
+ case 254 /* ImportSpecifier */:
+ case 258 /* ExportSpecifier */:
return visitNode(cbNode, node.propertyName) ||
visitNode(cbNode, node.name);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.expression);
- case 206 /* TemplateExpression */:
+ case 207 /* TemplateExpression */:
return visitNode(cbNode, node.head) || visitNodes(cbNode, cbNodes, node.templateSpans);
- case 216 /* TemplateSpan */:
+ case 217 /* TemplateSpan */:
return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal);
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
return visitNode(cbNode, node.expression);
- case 273 /* HeritageClause */:
+ case 274 /* HeritageClause */:
return visitNodes(cbNode, cbNodes, node.types);
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return visitNode(cbNode, node.expression) ||
visitNodes(cbNode, cbNodes, node.typeArguments);
- case 259 /* ExternalModuleReference */:
+ case 260 /* ExternalModuleReference */:
return visitNode(cbNode, node.expression);
- case 258 /* MissingDeclaration */:
+ case 259 /* MissingDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators);
- case 314 /* CommaListExpression */:
+ case 315 /* CommaListExpression */:
return visitNodes(cbNode, cbNodes, node.elements);
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
return visitNode(cbNode, node.openingElement) ||
visitNodes(cbNode, cbNodes, node.children) ||
visitNode(cbNode, node.closingElement);
- case 264 /* JsxFragment */:
+ case 265 /* JsxFragment */:
return visitNode(cbNode, node.openingFragment) ||
visitNodes(cbNode, cbNodes, node.children) ||
visitNode(cbNode, node.closingFragment);
- case 261 /* JsxSelfClosingElement */:
- case 262 /* JsxOpeningElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
return visitNode(cbNode, node.tagName) ||
visitNodes(cbNode, cbNodes, node.typeArguments) ||
visitNode(cbNode, node.attributes);
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
return visitNodes(cbNode, cbNodes, node.properties);
- case 267 /* JsxAttribute */:
+ case 268 /* JsxAttribute */:
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.initializer);
- case 269 /* JsxSpreadAttribute */:
+ case 270 /* JsxSpreadAttribute */:
return visitNode(cbNode, node.expression);
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return visitNode(cbNode, node.dotDotDotToken) ||
visitNode(cbNode, node.expression);
- case 263 /* JsxClosingElement */:
+ case 264 /* JsxClosingElement */:
return visitNode(cbNode, node.tagName);
- case 171 /* OptionalType */:
- case 172 /* RestType */:
- case 288 /* JSDocTypeExpression */:
- case 292 /* JSDocNonNullableType */:
- case 291 /* JSDocNullableType */:
- case 293 /* JSDocOptionalType */:
- case 295 /* JSDocVariadicType */:
+ case 172 /* OptionalType */:
+ case 173 /* RestType */:
+ case 289 /* JSDocTypeExpression */:
+ case 293 /* JSDocNonNullableType */:
+ case 292 /* JSDocNullableType */:
+ case 294 /* JSDocOptionalType */:
+ case 296 /* JSDocVariadicType */:
return visitNode(cbNode, node.type);
- case 294 /* JSDocFunctionType */:
+ case 295 /* JSDocFunctionType */:
return visitNodes(cbNode, cbNodes, node.parameters) ||
visitNode(cbNode, node.type);
- case 296 /* JSDocComment */:
+ case 297 /* JSDocComment */:
return visitNodes(cbNode, cbNodes, node.tags);
- case 304 /* JSDocParameterTag */:
- case 310 /* JSDocPropertyTag */:
+ case 305 /* JSDocParameterTag */:
+ case 311 /* JSDocPropertyTag */:
return visitNode(cbNode, node.tagName) ||
(node.isNameFirst
? visitNode(cbNode, node.name) ||
visitNode(cbNode, node.typeExpression)
: visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.name));
- case 300 /* JSDocAugmentsTag */:
+ case 301 /* JSDocAugmentsTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.class);
- case 308 /* JSDocTemplateTag */:
+ case 309 /* JSDocTemplateTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.constraint) ||
visitNodes(cbNode, cbNodes, node.typeParameters);
- case 309 /* JSDocTypedefTag */:
+ case 310 /* JSDocTypedefTag */:
return visitNode(cbNode, node.tagName) ||
(node.typeExpression &&
- node.typeExpression.kind === 288 /* JSDocTypeExpression */
+ node.typeExpression.kind === 289 /* JSDocTypeExpression */
? visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.fullName)
: visitNode(cbNode, node.fullName) ||
visitNode(cbNode, node.typeExpression));
- case 302 /* JSDocCallbackTag */:
+ case 303 /* JSDocCallbackTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.fullName) ||
visitNode(cbNode, node.typeExpression);
- case 305 /* JSDocReturnTag */:
- case 307 /* JSDocTypeTag */:
- case 306 /* JSDocThisTag */:
- case 303 /* JSDocEnumTag */:
+ case 306 /* JSDocReturnTag */:
+ case 308 /* JSDocTypeTag */:
+ case 307 /* JSDocThisTag */:
+ case 304 /* JSDocEnumTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.typeExpression);
- case 298 /* JSDocSignature */:
+ case 299 /* JSDocSignature */:
return ts.forEach(node.typeParameters, cbNode) ||
ts.forEach(node.parameters, cbNode) ||
visitNode(cbNode, node.type);
- case 297 /* JSDocTypeLiteral */:
+ case 298 /* JSDocTypeLiteral */:
return ts.forEach(node.jsDocPropertyTags, cbNode);
- case 299 /* JSDocTag */:
- case 301 /* JSDocClassTag */:
+ case 300 /* JSDocTag */:
+ case 302 /* JSDocClassTag */:
return visitNode(cbNode, node.tagName);
- case 313 /* PartiallyEmittedExpression */:
+ case 314 /* PartiallyEmittedExpression */:
return visitNode(cbNode, node.expression);
}
}
@@ -17049,7 +17166,7 @@
(function (Parser) {
// Share a single scanner across all calls to parse a source file. This helps speed things
// up by avoiding the cost of creating/compiling scanners over and over again.
- var scanner = ts.createScanner(7 /* Latest */, /*skipTrivia*/ true);
+ var scanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ true);
var disallowInAndDecoratorContext = 2048 /* DisallowInContext */ | 8192 /* DecoratorContext */;
// capture constructors in 'initializeState' to avoid null checks
// tslint:disable variable-name
@@ -17187,14 +17304,14 @@
sourceFile.endOfFileToken = parseTokenNode();
}
else {
- var statement = createNode(221 /* ExpressionStatement */);
+ var statement = createNode(222 /* ExpressionStatement */);
switch (token()) {
case 22 /* OpenBracketToken */:
statement.expression = parseArrayLiteralExpression();
break;
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
- case 96 /* NullKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
+ case 97 /* NullKeyword */:
statement.expression = parseTokenNode();
break;
case 39 /* MinusToken */:
@@ -17343,7 +17460,7 @@
function createSourceFile(fileName, languageVersion, scriptKind, isDeclarationFile) {
// code from createNode is inlined here so createNode won't have to deal with special case of creating source files
// this is quite rare comparing to other nodes and createNode should be as fast as possible
- var sourceFile = new SourceFileConstructor(284 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length);
+ var sourceFile = new SourceFileConstructor(285 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length);
nodeCount++;
sourceFile.text = sourceText;
sourceFile.bindDiagnostics = [];
@@ -17486,6 +17603,9 @@
function nextToken() {
return currentToken = scanner.scan();
}
+ function nextTokenJSDoc() {
+ return currentToken = scanner.scanJsDocToken();
+ }
function reScanGreaterToken() {
return currentToken = scanner.reScanGreaterToken();
}
@@ -17551,20 +17671,20 @@
}
// Ignore strict mode flag because we will report an error in type checker instead.
function isIdentifier() {
- if (token() === 72 /* Identifier */) {
+ if (token() === 73 /* Identifier */) {
return true;
}
// If we have a 'yield' keyword, and we're in the [yield] context, then 'yield' is
// considered a keyword and is not an identifier.
- if (token() === 117 /* YieldKeyword */ && inYieldContext()) {
+ if (token() === 118 /* YieldKeyword */ && inYieldContext()) {
return false;
}
// If we have a 'await' keyword, and we're in the [Await] context, then 'await' is
// considered a keyword and is not an identifier.
- if (token() === 122 /* AwaitKeyword */ && inAwaitContext()) {
+ if (token() === 123 /* AwaitKeyword */ && inAwaitContext()) {
return false;
}
- return token() > 108 /* LastReservedWord */;
+ return token() > 109 /* LastReservedWord */;
}
function parseExpected(kind, diagnosticMessage, shouldAdvance) {
if (shouldAdvance === void 0) { shouldAdvance = true; }
@@ -17583,6 +17703,14 @@
}
return false;
}
+ function parseExpectedJSDoc(kind) {
+ if (token() === kind) {
+ nextTokenJSDoc();
+ return true;
+ }
+ parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind));
+ return false;
+ }
function parseOptional(t) {
if (token() === t) {
nextToken();
@@ -17596,15 +17724,30 @@
}
return undefined;
}
+ function parseOptionalTokenJSDoc(t) {
+ if (token() === t) {
+ return parseTokenNodeJSDoc();
+ }
+ return undefined;
+ }
function parseExpectedToken(t, diagnosticMessage, arg0) {
return parseOptionalToken(t) ||
createMissingNode(t, /*reportAtCurrentPosition*/ false, diagnosticMessage || ts.Diagnostics._0_expected, arg0 || ts.tokenToString(t));
}
+ function parseExpectedTokenJSDoc(t) {
+ return parseOptionalTokenJSDoc(t) ||
+ createMissingNode(t, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(t));
+ }
function parseTokenNode() {
var node = createNode(token());
nextToken();
return finishNode(node);
}
+ function parseTokenNodeJSDoc() {
+ var node = createNode(token());
+ nextTokenJSDoc();
+ return finishNode(node);
+ }
function canParseSemicolon() {
// If there's a real semicolon, then we can always parse it out.
if (token() === 26 /* SemicolonToken */) {
@@ -17629,7 +17772,7 @@
nodeCount++;
var p = pos >= 0 ? pos : scanner.getStartPos();
return ts.isNodeKind(kind) || kind === 0 /* Unknown */ ? new NodeConstructor(kind, p, p) :
- kind === 72 /* Identifier */ ? new IdentifierConstructor(kind, p, p) :
+ kind === 73 /* Identifier */ ? new IdentifierConstructor(kind, p, p) :
new TokenConstructor(kind, p, p);
}
function createNodeWithJSDoc(kind, pos) {
@@ -17671,7 +17814,7 @@
parseErrorAtCurrentToken(diagnosticMessage, arg0);
}
var result = createNode(kind);
- if (kind === 72 /* Identifier */) {
+ if (kind === 73 /* Identifier */) {
result.escapedText = "";
}
else if (ts.isLiteralKind(kind) || ts.isTemplateLiteralKind(kind)) {
@@ -17692,9 +17835,9 @@
function createIdentifier(isIdentifier, diagnosticMessage) {
identifierCount++;
if (isIdentifier) {
- var node = createNode(72 /* Identifier */);
+ var node = createNode(73 /* Identifier */);
// Store original token kind if it is not just an Identifier so we can report appropriate error later in type checker
- if (token() !== 72 /* Identifier */) {
+ if (token() !== 73 /* Identifier */) {
node.originalKeywordKind = token();
}
node.escapedText = ts.escapeLeadingUnderscores(internIdentifier(scanner.getTokenValue()));
@@ -17703,7 +17846,7 @@
}
// Only for end of file because the error gets reported incorrectly on embedded script tags.
var reportAtCurrentPosition = token() === 1 /* EndOfFileToken */;
- return createMissingNode(72 /* Identifier */, reportAtCurrentPosition, diagnosticMessage || ts.Diagnostics.Identifier_expected);
+ return createMissingNode(73 /* Identifier */, reportAtCurrentPosition, diagnosticMessage || ts.Diagnostics.Identifier_expected);
}
function parseIdentifier(diagnosticMessage) {
return createIdentifier(isIdentifier(), diagnosticMessage);
@@ -17734,7 +17877,7 @@
// PropertyName [Yield]:
// LiteralPropertyName
// ComputedPropertyName[?Yield]
- var node = createNode(149 /* ComputedPropertyName */);
+ var node = createNode(150 /* ComputedPropertyName */);
parseExpected(22 /* OpenBracketToken */);
// We parse any expression (including a comma expression). But the grammar
// says that only an assignment expression is allowed, so the grammar checker
@@ -17755,20 +17898,20 @@
}
function nextTokenCanFollowModifier() {
switch (token()) {
- case 77 /* ConstKeyword */:
+ case 78 /* ConstKeyword */:
// 'const' is only a modifier if followed by 'enum'.
- return nextToken() === 84 /* EnumKeyword */;
- case 85 /* ExportKeyword */:
+ return nextToken() === 85 /* EnumKeyword */;
+ case 86 /* ExportKeyword */:
nextToken();
- if (token() === 80 /* DefaultKeyword */) {
+ if (token() === 81 /* DefaultKeyword */) {
return lookAhead(nextTokenCanFollowDefaultKeyword);
}
- return token() !== 40 /* AsteriskToken */ && token() !== 119 /* AsKeyword */ && token() !== 18 /* OpenBraceToken */ && canFollowModifier();
- case 80 /* DefaultKeyword */:
+ return token() !== 40 /* AsteriskToken */ && token() !== 120 /* AsKeyword */ && token() !== 18 /* OpenBraceToken */ && canFollowModifier();
+ case 81 /* DefaultKeyword */:
return nextTokenCanFollowDefaultKeyword();
- case 116 /* StaticKeyword */:
- case 126 /* GetKeyword */:
- case 137 /* SetKeyword */:
+ case 117 /* StaticKeyword */:
+ case 127 /* GetKeyword */:
+ case 138 /* SetKeyword */:
nextToken();
return canFollowModifier();
default:
@@ -17787,10 +17930,10 @@
}
function nextTokenCanFollowDefaultKeyword() {
nextToken();
- return token() === 76 /* ClassKeyword */ || token() === 90 /* FunctionKeyword */ ||
- token() === 110 /* InterfaceKeyword */ ||
- (token() === 118 /* AbstractKeyword */ && lookAhead(nextTokenIsClassKeywordOnSameLine)) ||
- (token() === 121 /* AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine));
+ return token() === 77 /* ClassKeyword */ || token() === 91 /* FunctionKeyword */ ||
+ token() === 111 /* InterfaceKeyword */ ||
+ (token() === 119 /* AbstractKeyword */ && lookAhead(nextTokenIsClassKeywordOnSameLine)) ||
+ (token() === 122 /* AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine));
}
// True if positioned at the start of a list element
function isListElement(parsingContext, inErrorRecovery) {
@@ -17810,7 +17953,7 @@
// outer module. We just want to consume and move on.
return !(token() === 26 /* SemicolonToken */ && inErrorRecovery) && isStartOfStatement();
case 2 /* SwitchClauses */:
- return token() === 74 /* CaseKeyword */ || token() === 80 /* DefaultKeyword */;
+ return token() === 75 /* CaseKeyword */ || token() === 81 /* DefaultKeyword */;
case 4 /* TypeMembers */:
return lookAhead(isTypeMemberStart);
case 5 /* ClassMembers */:
@@ -17896,7 +18039,7 @@
// extends {} extends
// extends {} implements
var next = nextToken();
- return next === 27 /* CommaToken */ || next === 18 /* OpenBraceToken */ || next === 86 /* ExtendsKeyword */ || next === 109 /* ImplementsKeyword */;
+ return next === 27 /* CommaToken */ || next === 18 /* OpenBraceToken */ || next === 87 /* ExtendsKeyword */ || next === 110 /* ImplementsKeyword */;
}
return true;
}
@@ -17913,8 +18056,8 @@
return ts.tokenIsIdentifierOrKeywordOrGreaterThan(token());
}
function isHeritageClauseExtendsOrImplementsKeyword() {
- if (token() === 109 /* ImplementsKeyword */ ||
- token() === 86 /* ExtendsKeyword */) {
+ if (token() === 110 /* ImplementsKeyword */ ||
+ token() === 87 /* ExtendsKeyword */) {
return lookAhead(nextTokenIsStartOfExpression);
}
return false;
@@ -17944,14 +18087,14 @@
case 23 /* ImportOrExportSpecifiers */:
return token() === 19 /* CloseBraceToken */;
case 3 /* SwitchClauseStatements */:
- return token() === 19 /* CloseBraceToken */ || token() === 74 /* CaseKeyword */ || token() === 80 /* DefaultKeyword */;
+ return token() === 19 /* CloseBraceToken */ || token() === 75 /* CaseKeyword */ || token() === 81 /* DefaultKeyword */;
case 7 /* HeritageClauseElement */:
- return token() === 18 /* OpenBraceToken */ || token() === 86 /* ExtendsKeyword */ || token() === 109 /* ImplementsKeyword */;
+ return token() === 18 /* OpenBraceToken */ || token() === 87 /* ExtendsKeyword */ || token() === 110 /* ImplementsKeyword */;
case 8 /* VariableDeclarations */:
return isVariableDeclaratorListTerminator();
case 19 /* TypeParameters */:
// Tokens other than '>' are here for better error recovery
- return token() === 30 /* GreaterThanToken */ || token() === 20 /* OpenParenToken */ || token() === 18 /* OpenBraceToken */ || token() === 86 /* ExtendsKeyword */ || token() === 109 /* ImplementsKeyword */;
+ return token() === 30 /* GreaterThanToken */ || token() === 20 /* OpenParenToken */ || token() === 18 /* OpenBraceToken */ || token() === 87 /* ExtendsKeyword */ || token() === 110 /* ImplementsKeyword */;
case 11 /* ArgumentExpressions */:
// Tokens other than ')' are here for better error recovery
return token() === 21 /* CloseParenToken */ || token() === 26 /* SemicolonToken */;
@@ -18168,20 +18311,20 @@
function isReusableClassMember(node) {
if (node) {
switch (node.kind) {
- case 157 /* Constructor */:
- case 162 /* IndexSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 154 /* PropertyDeclaration */:
- case 217 /* SemicolonClassElement */:
+ case 158 /* Constructor */:
+ case 163 /* IndexSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 155 /* PropertyDeclaration */:
+ case 218 /* SemicolonClassElement */:
return true;
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
// Method declarations are not necessarily reusable. An object-literal
// may have a method calls "constructor(...)" and we must reparse that
// into an actual .ConstructorDeclaration.
var methodDeclaration = node;
- var nameIsConstructor = methodDeclaration.name.kind === 72 /* Identifier */ &&
- methodDeclaration.name.originalKeywordKind === 124 /* ConstructorKeyword */;
+ var nameIsConstructor = methodDeclaration.name.kind === 73 /* Identifier */ &&
+ methodDeclaration.name.originalKeywordKind === 125 /* ConstructorKeyword */;
return !nameIsConstructor;
}
}
@@ -18190,8 +18333,8 @@
function isReusableSwitchClause(node) {
if (node) {
switch (node.kind) {
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
return true;
}
}
@@ -18200,58 +18343,58 @@
function isReusableStatement(node) {
if (node) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 219 /* VariableStatement */:
- case 218 /* Block */:
- case 222 /* IfStatement */:
- case 221 /* ExpressionStatement */:
- case 234 /* ThrowStatement */:
- case 230 /* ReturnStatement */:
- case 232 /* SwitchStatement */:
- case 229 /* BreakStatement */:
- case 228 /* ContinueStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 225 /* ForStatement */:
- case 224 /* WhileStatement */:
- case 231 /* WithStatement */:
- case 220 /* EmptyStatement */:
- case 235 /* TryStatement */:
- case 233 /* LabeledStatement */:
- case 223 /* DoStatement */:
- case 236 /* DebuggerStatement */:
- case 249 /* ImportDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
- case 255 /* ExportDeclaration */:
- case 254 /* ExportAssignment */:
- case 244 /* ModuleDeclaration */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
- case 242 /* TypeAliasDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 220 /* VariableStatement */:
+ case 219 /* Block */:
+ case 223 /* IfStatement */:
+ case 222 /* ExpressionStatement */:
+ case 235 /* ThrowStatement */:
+ case 231 /* ReturnStatement */:
+ case 233 /* SwitchStatement */:
+ case 230 /* BreakStatement */:
+ case 229 /* ContinueStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 226 /* ForStatement */:
+ case 225 /* WhileStatement */:
+ case 232 /* WithStatement */:
+ case 221 /* EmptyStatement */:
+ case 236 /* TryStatement */:
+ case 234 /* LabeledStatement */:
+ case 224 /* DoStatement */:
+ case 237 /* DebuggerStatement */:
+ case 250 /* ImportDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 256 /* ExportDeclaration */:
+ case 255 /* ExportAssignment */:
+ case 245 /* ModuleDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return true;
}
}
return false;
}
function isReusableEnumMember(node) {
- return node.kind === 278 /* EnumMember */;
+ return node.kind === 279 /* EnumMember */;
}
function isReusableTypeMember(node) {
if (node) {
switch (node.kind) {
- case 161 /* ConstructSignature */:
- case 155 /* MethodSignature */:
- case 162 /* IndexSignature */:
- case 153 /* PropertySignature */:
- case 160 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 156 /* MethodSignature */:
+ case 163 /* IndexSignature */:
+ case 154 /* PropertySignature */:
+ case 161 /* CallSignature */:
return true;
}
}
return false;
}
function isReusableVariableDeclaration(node) {
- if (node.kind !== 237 /* VariableDeclaration */) {
+ if (node.kind !== 238 /* VariableDeclaration */) {
return false;
}
// Very subtle incremental parsing bug. Consider the following code:
@@ -18272,7 +18415,7 @@
return variableDeclarator.initializer === undefined;
}
function isReusableParameter(node) {
- if (node.kind !== 151 /* Parameter */) {
+ if (node.kind !== 152 /* Parameter */) {
return false;
}
// See the comment in isReusableVariableDeclaration for why we do this.
@@ -18408,7 +18551,7 @@
return entity;
}
function createQualifiedName(entity, name) {
- var node = createNode(148 /* QualifiedName */, entity.pos);
+ var node = createNode(149 /* QualifiedName */, entity.pos);
node.left = entity;
node.right = name;
return finishNode(node);
@@ -18439,13 +18582,13 @@
// Report that we need an identifier. However, report it right after the dot,
// and not on the next token. This is because the next token might actually
// be an identifier and the error would be quite confusing.
- return createMissingNode(72 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Identifier_expected);
+ return createMissingNode(73 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Identifier_expected);
}
}
return allowIdentifierNames ? parseIdentifierName() : parseIdentifier();
}
function parseTemplateExpression() {
- var template = createNode(206 /* TemplateExpression */);
+ var template = createNode(207 /* TemplateExpression */);
template.head = parseTemplateHead();
ts.Debug.assert(template.head.kind === 15 /* TemplateHead */, "Template head has wrong token kind");
var list = [];
@@ -18457,7 +18600,7 @@
return finishNode(template);
}
function parseTemplateSpan() {
- var span = createNode(216 /* TemplateSpan */);
+ var span = createNode(217 /* TemplateSpan */);
span.expression = allowInAnd(parseExpression);
var literal;
if (token() === 19 /* CloseBraceToken */) {
@@ -18507,7 +18650,7 @@
}
// TYPES
function parseTypeReference() {
- var node = createNode(164 /* TypeReference */);
+ var node = createNode(165 /* TypeReference */);
node.typeName = parseEntityName(/*allowReservedWords*/ true, ts.Diagnostics.Type_expected);
if (!scanner.hasPrecedingLineBreak() && reScanLessThanToken() === 28 /* LessThanToken */) {
node.typeArguments = parseBracketedList(20 /* TypeArguments */, parseType, 28 /* LessThanToken */, 30 /* GreaterThanToken */);
@@ -18517,14 +18660,14 @@
// If true, we should abort parsing an error function.
function typeHasArrowFunctionBlockingParseError(node) {
switch (node.kind) {
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return ts.nodeIsMissing(node.typeName);
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */: {
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */: {
var _a = node, parameters = _a.parameters, type = _a.type;
return isMissingList(parameters) || typeHasArrowFunctionBlockingParseError(type);
}
- case 177 /* ParenthesizedType */:
+ case 178 /* ParenthesizedType */:
return typeHasArrowFunctionBlockingParseError(node.type);
default:
return false;
@@ -18532,20 +18675,20 @@
}
function parseThisTypePredicate(lhs) {
nextToken();
- var node = createNode(163 /* TypePredicate */, lhs.pos);
+ var node = createNode(164 /* TypePredicate */, lhs.pos);
node.parameterName = lhs;
node.type = parseType();
return finishNode(node);
}
function parseThisTypeNode() {
- var node = createNode(178 /* ThisType */);
+ var node = createNode(179 /* ThisType */);
nextToken();
return finishNode(node);
}
function parseJSDocAllType(postFixEquals) {
- var result = createNode(289 /* JSDocAllType */);
+ var result = createNode(290 /* JSDocAllType */);
if (postFixEquals) {
- return createPostfixType(293 /* JSDocOptionalType */, result);
+ return createPostfixType(294 /* JSDocOptionalType */, result);
}
else {
nextToken();
@@ -18553,7 +18696,7 @@
return finishNode(result);
}
function parseJSDocNonNullableType() {
- var result = createNode(292 /* JSDocNonNullableType */);
+ var result = createNode(293 /* JSDocNonNullableType */);
nextToken();
result.type = parseNonArrayType();
return finishNode(result);
@@ -18575,31 +18718,31 @@
token() === 19 /* CloseBraceToken */ ||
token() === 21 /* CloseParenToken */ ||
token() === 30 /* GreaterThanToken */ ||
- token() === 59 /* EqualsToken */ ||
+ token() === 60 /* EqualsToken */ ||
token() === 50 /* BarToken */) {
- var result = createNode(290 /* JSDocUnknownType */, pos);
+ var result = createNode(291 /* JSDocUnknownType */, pos);
return finishNode(result);
}
else {
- var result = createNode(291 /* JSDocNullableType */, pos);
+ var result = createNode(292 /* JSDocNullableType */, pos);
result.type = parseType();
return finishNode(result);
}
}
function parseJSDocFunctionType() {
if (lookAhead(nextTokenIsOpenParen)) {
- var result = createNodeWithJSDoc(294 /* JSDocFunctionType */);
+ var result = createNodeWithJSDoc(295 /* JSDocFunctionType */);
nextToken();
fillSignature(57 /* ColonToken */, 4 /* Type */ | 32 /* JSDoc */, result);
return finishNode(result);
}
- var node = createNode(164 /* TypeReference */);
+ var node = createNode(165 /* TypeReference */);
node.typeName = parseIdentifierName();
return finishNode(node);
}
function parseJSDocParameter() {
- var parameter = createNode(151 /* Parameter */);
- if (token() === 100 /* ThisKeyword */ || token() === 95 /* NewKeyword */) {
+ var parameter = createNode(152 /* Parameter */);
+ if (token() === 101 /* ThisKeyword */ || token() === 96 /* NewKeyword */) {
parameter.name = parseIdentifierName();
parseExpected(57 /* ColonToken */);
}
@@ -18612,25 +18755,25 @@
var type = parseTypeOrTypePredicate();
scanner.setInJSDocType(false);
if (dotdotdot) {
- var variadic = createNode(295 /* JSDocVariadicType */, dotdotdot.pos);
+ var variadic = createNode(296 /* JSDocVariadicType */, dotdotdot.pos);
variadic.type = type;
type = finishNode(variadic);
}
- if (token() === 59 /* EqualsToken */) {
- return createPostfixType(293 /* JSDocOptionalType */, type);
+ if (token() === 60 /* EqualsToken */) {
+ return createPostfixType(294 /* JSDocOptionalType */, type);
}
return type;
}
function parseTypeQuery() {
- var node = createNode(167 /* TypeQuery */);
- parseExpected(104 /* TypeOfKeyword */);
+ var node = createNode(168 /* TypeQuery */);
+ parseExpected(105 /* TypeOfKeyword */);
node.exprName = parseEntityName(/*allowReservedWords*/ true);
return finishNode(node);
}
function parseTypeParameter() {
- var node = createNode(150 /* TypeParameter */);
+ var node = createNode(151 /* TypeParameter */);
node.name = parseIdentifier();
- if (parseOptional(86 /* ExtendsKeyword */)) {
+ if (parseOptional(87 /* ExtendsKeyword */)) {
// It's not uncommon for people to write improper constraints to a generic. If the
// user writes a constraint that is an expression and not an actual type, then parse
// it out as an expression (so we can recover well), but report that a type is needed
@@ -18649,7 +18792,7 @@
node.expression = parseUnaryExpressionOrHigher();
}
}
- if (parseOptional(59 /* EqualsToken */)) {
+ if (parseOptional(60 /* EqualsToken */)) {
node.default = parseType();
}
return finishNode(node);
@@ -18673,8 +18816,8 @@
isStartOfType(/*inStartOfParameter*/ !isJSDocParameter);
}
function parseParameter() {
- var node = createNodeWithJSDoc(151 /* Parameter */);
- if (token() === 100 /* ThisKeyword */) {
+ var node = createNodeWithJSDoc(152 /* Parameter */);
+ if (token() === 101 /* ThisKeyword */) {
node.name = createIdentifier(/*isIdentifier*/ true);
node.type = parseParameterType();
return finishNode(node);
@@ -18774,8 +18917,8 @@
}
function parseSignatureMember(kind) {
var node = createNodeWithJSDoc(kind);
- if (kind === 161 /* ConstructSignature */) {
- parseExpected(95 /* NewKeyword */);
+ if (kind === 162 /* ConstructSignature */) {
+ parseExpected(96 /* NewKeyword */);
}
fillSignature(57 /* ColonToken */, 4 /* Type */, node);
parseTypeMemberSemicolon();
@@ -18835,7 +18978,7 @@
return token() === 57 /* ColonToken */ || token() === 27 /* CommaToken */ || token() === 23 /* CloseBracketToken */;
}
function parseIndexSignatureDeclaration(node) {
- node.kind = 162 /* IndexSignature */;
+ node.kind = 163 /* IndexSignature */;
node.parameters = parseBracketedList(16 /* Parameters */, parseParameter, 22 /* OpenBracketToken */, 23 /* CloseBracketToken */);
node.type = parseTypeAnnotation();
parseTypeMemberSemicolon();
@@ -18845,15 +18988,15 @@
node.name = parsePropertyName();
node.questionToken = parseOptionalToken(56 /* QuestionToken */);
if (token() === 20 /* OpenParenToken */ || token() === 28 /* LessThanToken */) {
- node.kind = 155 /* MethodSignature */;
+ node.kind = 156 /* MethodSignature */;
// Method signatures don't exist in expression contexts. So they have neither
// [Yield] nor [Await]
fillSignature(57 /* ColonToken */, 4 /* Type */, node);
}
else {
- node.kind = 153 /* PropertySignature */;
+ node.kind = 154 /* PropertySignature */;
node.type = parseTypeAnnotation();
- if (token() === 59 /* EqualsToken */) {
+ if (token() === 60 /* EqualsToken */) {
// Although type literal properties cannot not have initializers, we attempt
// to parse an initializer so we can report in the checker that an interface
// property or type literal property cannot have an initializer.
@@ -18897,10 +19040,10 @@
}
function parseTypeMember() {
if (token() === 20 /* OpenParenToken */ || token() === 28 /* LessThanToken */) {
- return parseSignatureMember(160 /* CallSignature */);
+ return parseSignatureMember(161 /* CallSignature */);
}
- if (token() === 95 /* NewKeyword */ && lookAhead(nextTokenIsOpenParenOrLessThan)) {
- return parseSignatureMember(161 /* ConstructSignature */);
+ if (token() === 96 /* NewKeyword */ && lookAhead(nextTokenIsOpenParenOrLessThan)) {
+ return parseSignatureMember(162 /* ConstructSignature */);
}
var node = createNodeWithJSDoc(0 /* Unknown */);
node.modifiers = parseModifiers();
@@ -18926,7 +19069,7 @@
return false;
}
function parseTypeLiteral() {
- var node = createNode(168 /* TypeLiteral */);
+ var node = createNode(169 /* TypeLiteral */);
node.members = parseObjectTypeMembers();
return finishNode(node);
}
@@ -18944,27 +19087,27 @@
function isStartOfMappedType() {
nextToken();
if (token() === 38 /* PlusToken */ || token() === 39 /* MinusToken */) {
- return nextToken() === 133 /* ReadonlyKeyword */;
+ return nextToken() === 134 /* ReadonlyKeyword */;
}
- if (token() === 133 /* ReadonlyKeyword */) {
+ if (token() === 134 /* ReadonlyKeyword */) {
nextToken();
}
- return token() === 22 /* OpenBracketToken */ && nextTokenIsIdentifier() && nextToken() === 93 /* InKeyword */;
+ return token() === 22 /* OpenBracketToken */ && nextTokenIsIdentifier() && nextToken() === 94 /* InKeyword */;
}
function parseMappedTypeParameter() {
- var node = createNode(150 /* TypeParameter */);
+ var node = createNode(151 /* TypeParameter */);
node.name = parseIdentifier();
- parseExpected(93 /* InKeyword */);
+ parseExpected(94 /* InKeyword */);
node.constraint = parseType();
return finishNode(node);
}
function parseMappedType() {
- var node = createNode(181 /* MappedType */);
+ var node = createNode(182 /* MappedType */);
parseExpected(18 /* OpenBraceToken */);
- if (token() === 133 /* ReadonlyKeyword */ || token() === 38 /* PlusToken */ || token() === 39 /* MinusToken */) {
+ if (token() === 134 /* ReadonlyKeyword */ || token() === 38 /* PlusToken */ || token() === 39 /* MinusToken */) {
node.readonlyToken = parseTokenNode();
- if (node.readonlyToken.kind !== 133 /* ReadonlyKeyword */) {
- parseExpectedToken(133 /* ReadonlyKeyword */);
+ if (node.readonlyToken.kind !== 134 /* ReadonlyKeyword */) {
+ parseExpectedToken(134 /* ReadonlyKeyword */);
}
}
parseExpected(22 /* OpenBracketToken */);
@@ -18984,23 +19127,23 @@
function parseTupleElementType() {
var pos = getNodePos();
if (parseOptional(25 /* DotDotDotToken */)) {
- var node = createNode(172 /* RestType */, pos);
+ var node = createNode(173 /* RestType */, pos);
node.type = parseType();
return finishNode(node);
}
var type = parseType();
- if (!(contextFlags & 2097152 /* JSDoc */) && type.kind === 291 /* JSDocNullableType */ && type.pos === type.type.pos) {
- type.kind = 171 /* OptionalType */;
+ if (!(contextFlags & 2097152 /* JSDoc */) && type.kind === 292 /* JSDocNullableType */ && type.pos === type.type.pos) {
+ type.kind = 172 /* OptionalType */;
}
return type;
}
function parseTupleType() {
- var node = createNode(170 /* TupleType */);
+ var node = createNode(171 /* TupleType */);
node.elementTypes = parseBracketedList(21 /* TupleElementTypes */, parseTupleElementType, 22 /* OpenBracketToken */, 23 /* CloseBracketToken */);
return finishNode(node);
}
function parseParenthesizedType() {
- var node = createNode(177 /* ParenthesizedType */);
+ var node = createNode(178 /* ParenthesizedType */);
parseExpected(20 /* OpenParenToken */);
node.type = parseType();
parseExpected(21 /* CloseParenToken */);
@@ -19008,7 +19151,7 @@
}
function parseFunctionOrConstructorType() {
var pos = getNodePos();
- var kind = parseOptional(95 /* NewKeyword */) ? 166 /* ConstructorType */ : 165 /* FunctionType */;
+ var kind = parseOptional(96 /* NewKeyword */) ? 167 /* ConstructorType */ : 166 /* FunctionType */;
var node = createNodeWithJSDoc(kind, pos);
fillSignature(37 /* EqualsGreaterThanToken */, 4 /* Type */, node);
return finishNode(node);
@@ -19018,14 +19161,14 @@
return token() === 24 /* DotToken */ ? undefined : node;
}
function parseLiteralTypeNode(negative) {
- var node = createNode(182 /* LiteralType */);
+ var node = createNode(183 /* LiteralType */);
var unaryMinusExpression;
if (negative) {
- unaryMinusExpression = createNode(202 /* PrefixUnaryExpression */);
+ unaryMinusExpression = createNode(203 /* PrefixUnaryExpression */);
unaryMinusExpression.operator = 39 /* MinusToken */;
nextToken();
}
- var expression = token() === 102 /* TrueKeyword */ || token() === 87 /* FalseKeyword */
+ var expression = token() === 103 /* TrueKeyword */ || token() === 88 /* FalseKeyword */
? parseTokenNode()
: parseLiteralLikeNode(token());
if (negative) {
@@ -19038,22 +19181,24 @@
}
function isStartOfTypeOfImportType() {
nextToken();
- return token() === 92 /* ImportKeyword */;
+ return token() === 93 /* ImportKeyword */;
}
function parseImportType() {
sourceFile.flags |= 524288 /* PossiblyContainsDynamicImport */;
- var node = createNode(183 /* ImportType */);
- if (parseOptional(104 /* TypeOfKeyword */)) {
+ var node = createNode(184 /* ImportType */);
+ if (parseOptional(105 /* TypeOfKeyword */)) {
node.isTypeOf = true;
}
- parseExpected(92 /* ImportKeyword */);
+ parseExpected(93 /* ImportKeyword */);
parseExpected(20 /* OpenParenToken */);
node.argument = parseType();
parseExpected(21 /* CloseParenToken */);
if (parseOptional(24 /* DotToken */)) {
node.qualifier = parseEntityName(/*allowReservedWords*/ true, ts.Diagnostics.Type_expected);
}
- node.typeArguments = tryParseTypeArguments();
+ if (!scanner.hasPrecedingLineBreak() && reScanLessThanToken() === 28 /* LessThanToken */) {
+ node.typeArguments = parseBracketedList(20 /* TypeArguments */, parseType, 28 /* LessThanToken */, 30 /* GreaterThanToken */);
+ }
return finishNode(node);
}
function nextTokenIsNumericOrBigIntLiteral() {
@@ -19062,25 +19207,25 @@
}
function parseNonArrayType() {
switch (token()) {
- case 120 /* AnyKeyword */:
- case 143 /* UnknownKeyword */:
- case 138 /* StringKeyword */:
- case 135 /* NumberKeyword */:
- case 146 /* BigIntKeyword */:
- case 139 /* SymbolKeyword */:
- case 123 /* BooleanKeyword */:
- case 141 /* UndefinedKeyword */:
- case 132 /* NeverKeyword */:
- case 136 /* ObjectKeyword */:
+ case 121 /* AnyKeyword */:
+ case 144 /* UnknownKeyword */:
+ case 139 /* StringKeyword */:
+ case 136 /* NumberKeyword */:
+ case 147 /* BigIntKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 142 /* UndefinedKeyword */:
+ case 133 /* NeverKeyword */:
+ case 137 /* ObjectKeyword */:
// If these are followed by a dot, then parse these out as a dotted type reference instead.
return tryParse(parseKeywordAndNoDot) || parseTypeReference();
case 40 /* AsteriskToken */:
return parseJSDocAllType(/*postfixEquals*/ false);
- case 62 /* AsteriskEqualsToken */:
+ case 63 /* AsteriskEqualsToken */:
return parseJSDocAllType(/*postfixEquals*/ true);
case 56 /* QuestionToken */:
return parseJSDocUnknownOrNullableType();
- case 90 /* FunctionKeyword */:
+ case 91 /* FunctionKeyword */:
return parseJSDocFunctionType();
case 52 /* ExclamationToken */:
return parseJSDocNonNullableType();
@@ -19088,24 +19233,24 @@
case 10 /* StringLiteral */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
return parseLiteralTypeNode();
case 39 /* MinusToken */:
return lookAhead(nextTokenIsNumericOrBigIntLiteral) ? parseLiteralTypeNode(/*negative*/ true) : parseTypeReference();
- case 106 /* VoidKeyword */:
- case 96 /* NullKeyword */:
+ case 107 /* VoidKeyword */:
+ case 97 /* NullKeyword */:
return parseTokenNode();
- case 100 /* ThisKeyword */: {
+ case 101 /* ThisKeyword */: {
var thisKeyword = parseThisTypeNode();
- if (token() === 128 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) {
+ if (token() === 129 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) {
return parseThisTypePredicate(thisKeyword);
}
else {
return thisKeyword;
}
}
- case 104 /* TypeOfKeyword */:
+ case 105 /* TypeOfKeyword */:
return lookAhead(isStartOfTypeOfImportType) ? parseImportType() : parseTypeQuery();
case 18 /* OpenBraceToken */:
return lookAhead(isStartOfMappedType) ? parseMappedType() : parseTypeLiteral();
@@ -19113,7 +19258,7 @@
return parseTupleType();
case 20 /* OpenParenToken */:
return parseParenthesizedType();
- case 92 /* ImportKeyword */:
+ case 93 /* ImportKeyword */:
return parseImportType();
default:
return parseTypeReference();
@@ -19121,41 +19266,41 @@
}
function isStartOfType(inStartOfParameter) {
switch (token()) {
- case 120 /* AnyKeyword */:
- case 143 /* UnknownKeyword */:
- case 138 /* StringKeyword */:
- case 135 /* NumberKeyword */:
- case 146 /* BigIntKeyword */:
- case 123 /* BooleanKeyword */:
- case 133 /* ReadonlyKeyword */:
- case 139 /* SymbolKeyword */:
- case 142 /* UniqueKeyword */:
- case 106 /* VoidKeyword */:
- case 141 /* UndefinedKeyword */:
- case 96 /* NullKeyword */:
- case 100 /* ThisKeyword */:
- case 104 /* TypeOfKeyword */:
- case 132 /* NeverKeyword */:
+ case 121 /* AnyKeyword */:
+ case 144 /* UnknownKeyword */:
+ case 139 /* StringKeyword */:
+ case 136 /* NumberKeyword */:
+ case 147 /* BigIntKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 134 /* ReadonlyKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 143 /* UniqueKeyword */:
+ case 107 /* VoidKeyword */:
+ case 142 /* UndefinedKeyword */:
+ case 97 /* NullKeyword */:
+ case 101 /* ThisKeyword */:
+ case 105 /* TypeOfKeyword */:
+ case 133 /* NeverKeyword */:
case 18 /* OpenBraceToken */:
case 22 /* OpenBracketToken */:
case 28 /* LessThanToken */:
case 50 /* BarToken */:
case 49 /* AmpersandToken */:
- case 95 /* NewKeyword */:
+ case 96 /* NewKeyword */:
case 10 /* StringLiteral */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
- case 136 /* ObjectKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
+ case 137 /* ObjectKeyword */:
case 40 /* AsteriskToken */:
case 56 /* QuestionToken */:
case 52 /* ExclamationToken */:
case 25 /* DotDotDotToken */:
- case 127 /* InferKeyword */:
- case 92 /* ImportKeyword */:
+ case 128 /* InferKeyword */:
+ case 93 /* ImportKeyword */:
return true;
- case 90 /* FunctionKeyword */:
+ case 91 /* FunctionKeyword */:
return !inStartOfParameter;
case 39 /* MinusToken */:
return !inStartOfParameter && lookAhead(nextTokenIsNumericOrBigIntLiteral);
@@ -19176,26 +19321,26 @@
while (!scanner.hasPrecedingLineBreak()) {
switch (token()) {
case 52 /* ExclamationToken */:
- type = createPostfixType(292 /* JSDocNonNullableType */, type);
+ type = createPostfixType(293 /* JSDocNonNullableType */, type);
break;
case 56 /* QuestionToken */:
// If not in JSDoc and next token is start of a type we have a conditional type
if (!(contextFlags & 2097152 /* JSDoc */) && lookAhead(nextTokenIsStartOfType)) {
return type;
}
- type = createPostfixType(291 /* JSDocNullableType */, type);
+ type = createPostfixType(292 /* JSDocNullableType */, type);
break;
case 22 /* OpenBracketToken */:
parseExpected(22 /* OpenBracketToken */);
if (isStartOfType()) {
- var node = createNode(180 /* IndexedAccessType */, type.pos);
+ var node = createNode(181 /* IndexedAccessType */, type.pos);
node.objectType = type;
node.indexType = parseType();
parseExpected(23 /* CloseBracketToken */);
type = finishNode(node);
}
else {
- var node = createNode(169 /* ArrayType */, type.pos);
+ var node = createNode(170 /* ArrayType */, type.pos);
node.elementType = type;
parseExpected(23 /* CloseBracketToken */);
type = finishNode(node);
@@ -19214,16 +19359,16 @@
return finishNode(postfix);
}
function parseTypeOperator(operator) {
- var node = createNode(179 /* TypeOperator */);
+ var node = createNode(180 /* TypeOperator */);
parseExpected(operator);
node.operator = operator;
node.type = parseTypeOperatorOrHigher();
return finishNode(node);
}
function parseInferType() {
- var node = createNode(176 /* InferType */);
- parseExpected(127 /* InferKeyword */);
- var typeParameter = createNode(150 /* TypeParameter */);
+ var node = createNode(177 /* InferType */);
+ parseExpected(128 /* InferKeyword */);
+ var typeParameter = createNode(151 /* TypeParameter */);
typeParameter.name = parseIdentifier();
node.typeParameter = finishNode(typeParameter);
return finishNode(node);
@@ -19231,34 +19376,35 @@
function parseTypeOperatorOrHigher() {
var operator = token();
switch (operator) {
- case 129 /* KeyOfKeyword */:
- case 142 /* UniqueKeyword */:
- case 133 /* ReadonlyKeyword */:
+ case 130 /* KeyOfKeyword */:
+ case 143 /* UniqueKeyword */:
+ case 134 /* ReadonlyKeyword */:
return parseTypeOperator(operator);
- case 127 /* InferKeyword */:
+ case 128 /* InferKeyword */:
return parseInferType();
}
return parsePostfixTypeOrHigher();
}
function parseUnionOrIntersectionType(kind, parseConstituentType, operator) {
- parseOptional(operator);
+ var start = scanner.getStartPos();
+ var hasLeadingOperator = parseOptional(operator);
var type = parseConstituentType();
- if (token() === operator) {
+ if (token() === operator || hasLeadingOperator) {
var types = [type];
while (parseOptional(operator)) {
types.push(parseConstituentType());
}
- var node = createNode(kind, type.pos);
- node.types = createNodeArray(types, type.pos);
+ var node = createNode(kind, start);
+ node.types = createNodeArray(types, start);
type = finishNode(node);
}
return type;
}
function parseIntersectionTypeOrHigher() {
- return parseUnionOrIntersectionType(174 /* IntersectionType */, parseTypeOperatorOrHigher, 49 /* AmpersandToken */);
+ return parseUnionOrIntersectionType(175 /* IntersectionType */, parseTypeOperatorOrHigher, 49 /* AmpersandToken */);
}
function parseUnionTypeOrHigher() {
- return parseUnionOrIntersectionType(173 /* UnionType */, parseIntersectionTypeOrHigher, 50 /* BarToken */);
+ return parseUnionOrIntersectionType(174 /* UnionType */, parseIntersectionTypeOrHigher, 50 /* BarToken */);
}
function isStartOfFunctionType() {
if (token() === 28 /* LessThanToken */) {
@@ -19271,7 +19417,7 @@
// Skip modifiers
parseModifiers();
}
- if (isIdentifier() || token() === 100 /* ThisKeyword */) {
+ if (isIdentifier() || token() === 101 /* ThisKeyword */) {
nextToken();
return true;
}
@@ -19294,7 +19440,7 @@
// We successfully skipped modifiers (if any) and an identifier or binding pattern,
// now see if we have something that indicates a parameter declaration
if (token() === 57 /* ColonToken */ || token() === 27 /* CommaToken */ ||
- token() === 56 /* QuestionToken */ || token() === 59 /* EqualsToken */) {
+ token() === 56 /* QuestionToken */ || token() === 60 /* EqualsToken */) {
// ( xxx :
// ( xxx ,
// ( xxx ?
@@ -19315,7 +19461,7 @@
var typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix);
var type = parseType();
if (typePredicateVariable) {
- var node = createNode(163 /* TypePredicate */, typePredicateVariable.pos);
+ var node = createNode(164 /* TypePredicate */, typePredicateVariable.pos);
node.parameterName = typePredicateVariable;
node.type = type;
return finishNode(node);
@@ -19326,7 +19472,7 @@
}
function parseTypePredicatePrefix() {
var id = parseIdentifier();
- if (token() === 128 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) {
+ if (token() === 129 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) {
nextToken();
return id;
}
@@ -19337,12 +19483,12 @@
return doOutsideOfContext(20480 /* TypeExcludesFlags */, parseTypeWorker);
}
function parseTypeWorker(noConditionalTypes) {
- if (isStartOfFunctionType() || token() === 95 /* NewKeyword */) {
+ if (isStartOfFunctionType() || token() === 96 /* NewKeyword */) {
return parseFunctionOrConstructorType();
}
var type = parseUnionTypeOrHigher();
- if (!noConditionalTypes && !scanner.hasPrecedingLineBreak() && parseOptional(86 /* ExtendsKeyword */)) {
- var node = createNode(175 /* ConditionalType */, type.pos);
+ if (!noConditionalTypes && !scanner.hasPrecedingLineBreak() && parseOptional(87 /* ExtendsKeyword */)) {
+ var node = createNode(176 /* ConditionalType */, type.pos);
node.checkType = type;
// The type following 'extends' is not permitted to be another conditional type
node.extendsType = parseTypeWorker(/*noConditionalTypes*/ true);
@@ -19360,11 +19506,11 @@
// EXPRESSIONS
function isStartOfLeftHandSideExpression() {
switch (token()) {
- case 100 /* ThisKeyword */:
- case 98 /* SuperKeyword */:
- case 96 /* NullKeyword */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
+ case 101 /* ThisKeyword */:
+ case 99 /* SuperKeyword */:
+ case 97 /* NullKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
case 10 /* StringLiteral */:
@@ -19373,14 +19519,14 @@
case 20 /* OpenParenToken */:
case 22 /* OpenBracketToken */:
case 18 /* OpenBraceToken */:
- case 90 /* FunctionKeyword */:
- case 76 /* ClassKeyword */:
- case 95 /* NewKeyword */:
+ case 91 /* FunctionKeyword */:
+ case 77 /* ClassKeyword */:
+ case 96 /* NewKeyword */:
case 42 /* SlashToken */:
- case 64 /* SlashEqualsToken */:
- case 72 /* Identifier */:
+ case 65 /* SlashEqualsToken */:
+ case 73 /* Identifier */:
return true;
- case 92 /* ImportKeyword */:
+ case 93 /* ImportKeyword */:
return lookAhead(nextTokenIsOpenParenOrLessThanOrDot);
default:
return isIdentifier();
@@ -19395,14 +19541,14 @@
case 39 /* MinusToken */:
case 53 /* TildeToken */:
case 52 /* ExclamationToken */:
- case 81 /* DeleteKeyword */:
- case 104 /* TypeOfKeyword */:
- case 106 /* VoidKeyword */:
+ case 82 /* DeleteKeyword */:
+ case 105 /* TypeOfKeyword */:
+ case 107 /* VoidKeyword */:
case 44 /* PlusPlusToken */:
case 45 /* MinusMinusToken */:
case 28 /* LessThanToken */:
- case 122 /* AwaitKeyword */:
- case 117 /* YieldKeyword */:
+ case 123 /* AwaitKeyword */:
+ case 118 /* YieldKeyword */:
// Yield/await always starts an expression. Either it is an identifier (in which case
// it is definitely an expression). Or it's a keyword (either because we're in
// a generator or async function, or in strict mode (or both)) and it started a yield or await expression.
@@ -19421,8 +19567,8 @@
function isStartOfExpressionStatement() {
// As per the grammar, none of '{' or 'function' or 'class' can start an expression statement.
return token() !== 18 /* OpenBraceToken */ &&
- token() !== 90 /* FunctionKeyword */ &&
- token() !== 76 /* ClassKeyword */ &&
+ token() !== 91 /* FunctionKeyword */ &&
+ token() !== 77 /* ClassKeyword */ &&
token() !== 58 /* AtToken */ &&
isStartOfExpression();
}
@@ -19446,7 +19592,7 @@
return expr;
}
function parseInitializer() {
- return parseOptional(59 /* EqualsToken */) ? parseAssignmentExpressionOrHigher() : undefined;
+ return parseOptional(60 /* EqualsToken */) ? parseAssignmentExpressionOrHigher() : undefined;
}
function parseAssignmentExpressionOrHigher() {
// AssignmentExpression[in,yield]:
@@ -19491,7 +19637,7 @@
// To avoid a look-ahead, we did not handle the case of an arrow function with a single un-parenthesized
// parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single
// identifier and the current token is an arrow.
- if (expr.kind === 72 /* Identifier */ && token() === 37 /* EqualsGreaterThanToken */) {
+ if (expr.kind === 73 /* Identifier */ && token() === 37 /* EqualsGreaterThanToken */) {
return parseSimpleArrowFunctionExpression(expr);
}
// Now see if we might be in cases '2' or '3'.
@@ -19507,7 +19653,7 @@
return parseConditionalExpressionRest(expr);
}
function isYieldExpression() {
- if (token() === 117 /* YieldKeyword */) {
+ if (token() === 118 /* YieldKeyword */) {
// If we have a 'yield' keyword, and this is a context where yield expressions are
// allowed, then definitely parse out a yield expression.
if (inYieldContext()) {
@@ -19536,7 +19682,7 @@
return !scanner.hasPrecedingLineBreak() && isIdentifier();
}
function parseYieldExpression() {
- var node = createNode(207 /* YieldExpression */);
+ var node = createNode(208 /* YieldExpression */);
// YieldExpression[In] :
// yield
// yield [no LineTerminator here] [Lexical goal InputElementRegExp]AssignmentExpression[?In, Yield]
@@ -19558,13 +19704,13 @@
ts.Debug.assert(token() === 37 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
var node;
if (asyncModifier) {
- node = createNode(197 /* ArrowFunction */, asyncModifier.pos);
+ node = createNode(198 /* ArrowFunction */, asyncModifier.pos);
node.modifiers = asyncModifier;
}
else {
- node = createNode(197 /* ArrowFunction */, identifier.pos);
+ node = createNode(198 /* ArrowFunction */, identifier.pos);
}
- var parameter = createNode(151 /* Parameter */, identifier.pos);
+ var parameter = createNode(152 /* Parameter */, identifier.pos);
parameter.name = identifier;
finishNode(parameter);
node.parameters = createNodeArray([parameter], parameter.pos, parameter.end);
@@ -19604,7 +19750,7 @@
// Unknown -> There *might* be a parenthesized arrow function here.
// Speculatively look ahead to be sure, and rollback if not.
function isParenthesizedArrowFunctionExpression() {
- if (token() === 20 /* OpenParenToken */ || token() === 28 /* LessThanToken */ || token() === 121 /* AsyncKeyword */) {
+ if (token() === 20 /* OpenParenToken */ || token() === 28 /* LessThanToken */ || token() === 122 /* AsyncKeyword */) {
return lookAhead(isParenthesizedArrowFunctionExpressionWorker);
}
if (token() === 37 /* EqualsGreaterThanToken */) {
@@ -19617,7 +19763,7 @@
return 0 /* False */;
}
function isParenthesizedArrowFunctionExpressionWorker() {
- if (token() === 121 /* AsyncKeyword */) {
+ if (token() === 122 /* AsyncKeyword */) {
nextToken();
if (scanner.hasPrecedingLineBreak()) {
return 0 /* False */;
@@ -19661,13 +19807,13 @@
// Check for "(xxx yyy", where xxx is a modifier and yyy is an identifier. This
// isn't actually allowed, but we want to treat it as a lambda so we can provide
// a good error message.
- if (ts.isModifierKind(second) && second !== 121 /* AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) {
+ if (ts.isModifierKind(second) && second !== 122 /* AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) {
return 1 /* True */;
}
// If we had "(" followed by something that's not an identifier,
// then this definitely doesn't look like a lambda. "this" is not
// valid, but we want to parse it and then give a semantic error.
- if (!isIdentifier() && second !== 100 /* ThisKeyword */) {
+ if (!isIdentifier() && second !== 101 /* ThisKeyword */) {
return 0 /* False */;
}
switch (nextToken()) {
@@ -19678,13 +19824,13 @@
case 56 /* QuestionToken */:
nextToken();
// If we have "(a?:" or "(a?," or "(a?=" or "(a?)" then it is definitely a lambda.
- if (token() === 57 /* ColonToken */ || token() === 27 /* CommaToken */ || token() === 59 /* EqualsToken */ || token() === 21 /* CloseParenToken */) {
+ if (token() === 57 /* ColonToken */ || token() === 27 /* CommaToken */ || token() === 60 /* EqualsToken */ || token() === 21 /* CloseParenToken */) {
return 1 /* True */;
}
// Otherwise it is definitely not a lambda.
return 0 /* False */;
case 27 /* CommaToken */:
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
case 21 /* CloseParenToken */:
// If we have "(a," or "(a=" or "(a)" this *could* be an arrow function
return 2 /* Unknown */;
@@ -19703,10 +19849,10 @@
if (sourceFile.languageVariant === 1 /* JSX */) {
var isArrowFunctionInJsx = lookAhead(function () {
var third = nextToken();
- if (third === 86 /* ExtendsKeyword */) {
+ if (third === 87 /* ExtendsKeyword */) {
var fourth = nextToken();
switch (fourth) {
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
case 30 /* GreaterThanToken */:
return false;
default:
@@ -19732,7 +19878,7 @@
}
function tryParseAsyncSimpleArrowFunctionExpression() {
// We do a check here so that we won't be doing unnecessarily call to "lookAhead"
- if (token() === 121 /* AsyncKeyword */) {
+ if (token() === 122 /* AsyncKeyword */) {
if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) {
var asyncModifier = parseModifiersForArrowFunction();
var expr = parseBinaryExpressionOrHigher(/*precedence*/ 0);
@@ -19745,7 +19891,7 @@
// AsyncArrowFunctionExpression:
// 1) async[no LineTerminator here]AsyncArrowBindingIdentifier[?Yield][no LineTerminator here]=>AsyncConciseBody[?In]
// 2) CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await][no LineTerminator here]=>AsyncConciseBody[?In]
- if (token() === 121 /* AsyncKeyword */) {
+ if (token() === 122 /* AsyncKeyword */) {
nextToken();
// If the "async" is followed by "=>" token then it is not a beginning of an async arrow-function
// but instead a simple arrow-function which will be parsed inside "parseAssignmentExpressionOrHigher"
@@ -19754,14 +19900,14 @@
}
// Check for un-parenthesized AsyncArrowFunction
var expr = parseBinaryExpressionOrHigher(/*precedence*/ 0);
- if (!scanner.hasPrecedingLineBreak() && expr.kind === 72 /* Identifier */ && token() === 37 /* EqualsGreaterThanToken */) {
+ if (!scanner.hasPrecedingLineBreak() && expr.kind === 73 /* Identifier */ && token() === 37 /* EqualsGreaterThanToken */) {
return 1 /* True */;
}
}
return 0 /* False */;
}
function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) {
- var node = createNodeWithJSDoc(197 /* ArrowFunction */);
+ var node = createNodeWithJSDoc(198 /* ArrowFunction */);
node.modifiers = parseModifiersForArrowFunction();
var isAsync = ts.hasModifier(node, 256 /* Async */) ? 2 /* Await */ : 0 /* None */;
// Arrow functions are never generators.
@@ -19780,9 +19926,11 @@
// - "(x = 10)" is an assignment expression parsed as a signature with a default parameter value.
// - "(x,y)" is a comma expression parsed as a signature with two parameters.
// - "a ? (b): c" will have "(b):" parsed as a signature with a return type annotation.
+ // - "a ? (b): function() {}" will too, since function() is a valid JSDoc function type.
//
// So we need just a bit of lookahead to ensure that it can only be a signature.
- if (!allowAmbiguity && token() !== 37 /* EqualsGreaterThanToken */ && token() !== 18 /* OpenBraceToken */) {
+ var hasJSDocFunctionType = node.type && ts.isJSDocFunctionType(node.type);
+ if (!allowAmbiguity && token() !== 37 /* EqualsGreaterThanToken */ && (hasJSDocFunctionType || token() !== 18 /* OpenBraceToken */)) {
// Returning undefined here will cause our caller to rewind to where we started from.
return undefined;
}
@@ -19793,8 +19941,8 @@
return parseFunctionBlock(isAsync ? 2 /* Await */ : 0 /* None */);
}
if (token() !== 26 /* SemicolonToken */ &&
- token() !== 90 /* FunctionKeyword */ &&
- token() !== 76 /* ClassKeyword */ &&
+ token() !== 91 /* FunctionKeyword */ &&
+ token() !== 77 /* ClassKeyword */ &&
isStartOfStatement() &&
!isStartOfExpressionStatement()) {
// Check if we got a plain statement (i.e. no expression-statements, no function/class expressions/declarations)
@@ -19825,14 +19973,14 @@
}
// Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and
// we do not that for the 'whenFalse' part.
- var node = createNode(205 /* ConditionalExpression */, leftOperand.pos);
+ var node = createNode(206 /* ConditionalExpression */, leftOperand.pos);
node.condition = leftOperand;
node.questionToken = questionToken;
node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher);
node.colonToken = parseExpectedToken(57 /* ColonToken */);
node.whenFalse = ts.nodeIsPresent(node.colonToken)
? parseAssignmentExpressionOrHigher()
- : createMissingNode(72 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(57 /* ColonToken */));
+ : createMissingNode(73 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(57 /* ColonToken */));
return finishNode(node);
}
function parseBinaryExpressionOrHigher(precedence) {
@@ -19840,7 +19988,7 @@
return parseBinaryExpressionRest(precedence, leftOperand);
}
function isInOrOfKeyword(t) {
- return t === 93 /* InKeyword */ || t === 147 /* OfKeyword */;
+ return t === 94 /* InKeyword */ || t === 148 /* OfKeyword */;
}
function parseBinaryExpressionRest(precedence, leftOperand) {
while (true) {
@@ -19875,10 +20023,10 @@
if (!consumeCurrentOperator) {
break;
}
- if (token() === 93 /* InKeyword */ && inDisallowInContext()) {
+ if (token() === 94 /* InKeyword */ && inDisallowInContext()) {
break;
}
- if (token() === 119 /* AsKeyword */) {
+ if (token() === 120 /* AsKeyword */) {
// Make sure we *do* perform ASI for constructs like this:
// var x = foo
// as (Bar)
@@ -19899,51 +20047,51 @@
return leftOperand;
}
function isBinaryOperator() {
- if (inDisallowInContext() && token() === 93 /* InKeyword */) {
+ if (inDisallowInContext() && token() === 94 /* InKeyword */) {
return false;
}
return ts.getBinaryOperatorPrecedence(token()) > 0;
}
function makeBinaryExpression(left, operatorToken, right) {
- var node = createNode(204 /* BinaryExpression */, left.pos);
+ var node = createNode(205 /* BinaryExpression */, left.pos);
node.left = left;
node.operatorToken = operatorToken;
node.right = right;
return finishNode(node);
}
function makeAsExpression(left, right) {
- var node = createNode(212 /* AsExpression */, left.pos);
+ var node = createNode(213 /* AsExpression */, left.pos);
node.expression = left;
node.type = right;
return finishNode(node);
}
function parsePrefixUnaryExpression() {
- var node = createNode(202 /* PrefixUnaryExpression */);
+ var node = createNode(203 /* PrefixUnaryExpression */);
node.operator = token();
nextToken();
node.operand = parseSimpleUnaryExpression();
return finishNode(node);
}
function parseDeleteExpression() {
- var node = createNode(198 /* DeleteExpression */);
+ var node = createNode(199 /* DeleteExpression */);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
}
function parseTypeOfExpression() {
- var node = createNode(199 /* TypeOfExpression */);
+ var node = createNode(200 /* TypeOfExpression */);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
}
function parseVoidExpression() {
- var node = createNode(200 /* VoidExpression */);
+ var node = createNode(201 /* VoidExpression */);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
}
function isAwaitExpression() {
- if (token() === 122 /* AwaitKeyword */) {
+ if (token() === 123 /* AwaitKeyword */) {
if (inAwaitContext()) {
return true;
}
@@ -19953,7 +20101,7 @@
return false;
}
function parseAwaitExpression() {
- var node = createNode(201 /* AwaitExpression */);
+ var node = createNode(202 /* AwaitExpression */);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
@@ -19997,7 +20145,7 @@
if (token() === 41 /* AsteriskAsteriskToken */) {
var pos = ts.skipTrivia(sourceText, simpleUnaryExpression.pos);
var end = simpleUnaryExpression.end;
- if (simpleUnaryExpression.kind === 194 /* TypeAssertionExpression */) {
+ if (simpleUnaryExpression.kind === 195 /* TypeAssertionExpression */) {
parseErrorAt(pos, end, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses);
}
else {
@@ -20027,18 +20175,18 @@
case 53 /* TildeToken */:
case 52 /* ExclamationToken */:
return parsePrefixUnaryExpression();
- case 81 /* DeleteKeyword */:
+ case 82 /* DeleteKeyword */:
return parseDeleteExpression();
- case 104 /* TypeOfKeyword */:
+ case 105 /* TypeOfKeyword */:
return parseTypeOfExpression();
- case 106 /* VoidKeyword */:
+ case 107 /* VoidKeyword */:
return parseVoidExpression();
case 28 /* LessThanToken */:
// This is modified UnaryExpression grammar in TypeScript
// UnaryExpression (modified):
// < type > UnaryExpression
return parseTypeAssertion();
- case 122 /* AwaitKeyword */:
+ case 123 /* AwaitKeyword */:
if (isAwaitExpression()) {
return parseAwaitExpression();
}
@@ -20065,10 +20213,10 @@
case 39 /* MinusToken */:
case 53 /* TildeToken */:
case 52 /* ExclamationToken */:
- case 81 /* DeleteKeyword */:
- case 104 /* TypeOfKeyword */:
- case 106 /* VoidKeyword */:
- case 122 /* AwaitKeyword */:
+ case 82 /* DeleteKeyword */:
+ case 105 /* TypeOfKeyword */:
+ case 107 /* VoidKeyword */:
+ case 123 /* AwaitKeyword */:
return false;
case 28 /* LessThanToken */:
// If we are not in JSX context, we are parsing TypeAssertion which is an UnaryExpression
@@ -20094,7 +20242,7 @@
*/
function parseUpdateExpression() {
if (token() === 44 /* PlusPlusToken */ || token() === 45 /* MinusMinusToken */) {
- var node = createNode(202 /* PrefixUnaryExpression */);
+ var node = createNode(203 /* PrefixUnaryExpression */);
node.operator = token();
nextToken();
node.operand = parseLeftHandSideExpressionOrHigher();
@@ -20107,7 +20255,7 @@
var expression = parseLeftHandSideExpressionOrHigher();
ts.Debug.assert(ts.isLeftHandSideExpression(expression));
if ((token() === 44 /* PlusPlusToken */ || token() === 45 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) {
- var node = createNode(203 /* PostfixUnaryExpression */, expression.pos);
+ var node = createNode(204 /* PostfixUnaryExpression */, expression.pos);
node.operand = expression;
node.operator = token();
nextToken();
@@ -20148,7 +20296,7 @@
// 3)we have a MemberExpression which either completes the LeftHandSideExpression,
// or starts the beginning of the first four CallExpression productions.
var expression;
- if (token() === 92 /* ImportKeyword */) {
+ if (token() === 93 /* ImportKeyword */) {
if (lookAhead(nextTokenIsOpenParenOrLessThan)) {
// We don't want to eagerly consume all import keyword as import call expression so we look ahead to find "("
// For example:
@@ -20163,8 +20311,8 @@
var fullStart = scanner.getStartPos();
nextToken(); // advance past the 'import'
nextToken(); // advance past the dot
- var node = createNode(214 /* MetaProperty */, fullStart);
- node.keywordToken = 92 /* ImportKeyword */;
+ var node = createNode(215 /* MetaProperty */, fullStart);
+ node.keywordToken = 93 /* ImportKeyword */;
node.name = parseIdentifierName();
expression = finishNode(node);
sourceFile.flags |= 1048576 /* PossiblyContainsImportMeta */;
@@ -20174,7 +20322,7 @@
}
}
else {
- expression = token() === 98 /* SuperKeyword */ ? parseSuperExpression() : parseMemberExpressionOrHigher();
+ expression = token() === 99 /* SuperKeyword */ ? parseSuperExpression() : parseMemberExpressionOrHigher();
}
// Now, we *may* be complete. However, we might have consumed the start of a
// CallExpression. As such, we need to consume the rest of it here to be complete.
@@ -20233,12 +20381,19 @@
}
function parseSuperExpression() {
var expression = parseTokenNode();
+ if (token() === 28 /* LessThanToken */) {
+ var startPos = getNodePos();
+ var typeArguments = tryParse(parseTypeArgumentsInExpression);
+ if (typeArguments !== undefined) {
+ parseErrorAt(startPos, getNodePos(), ts.Diagnostics.super_may_not_use_type_arguments);
+ }
+ }
if (token() === 20 /* OpenParenToken */ || token() === 24 /* DotToken */ || token() === 22 /* OpenBracketToken */) {
return expression;
}
// If we have seen "super" it must be followed by '(' or '.'.
// If it wasn't then just try to parse out a '.' and report an error.
- var node = createNode(189 /* PropertyAccessExpression */, expression.pos);
+ var node = createNode(190 /* PropertyAccessExpression */, expression.pos);
node.expression = expression;
parseExpectedToken(24 /* DotToken */, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access);
node.name = parseRightSideOfDot(/*allowIdentifierNames*/ true);
@@ -20247,8 +20402,8 @@
function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext) {
var opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext);
var result;
- if (opening.kind === 262 /* JsxOpeningElement */) {
- var node = createNode(260 /* JsxElement */, opening.pos);
+ if (opening.kind === 263 /* JsxOpeningElement */) {
+ var node = createNode(261 /* JsxElement */, opening.pos);
node.openingElement = opening;
node.children = parseJsxChildren(node.openingElement);
node.closingElement = parseJsxClosingElement(inExpressionContext);
@@ -20257,15 +20412,15 @@
}
result = finishNode(node);
}
- else if (opening.kind === 265 /* JsxOpeningFragment */) {
- var node = createNode(264 /* JsxFragment */, opening.pos);
+ else if (opening.kind === 266 /* JsxOpeningFragment */) {
+ var node = createNode(265 /* JsxFragment */, opening.pos);
node.openingFragment = opening;
node.children = parseJsxChildren(node.openingFragment);
node.closingFragment = parseJsxClosingFragment(inExpressionContext);
result = finishNode(node);
}
else {
- ts.Debug.assert(opening.kind === 261 /* JsxSelfClosingElement */);
+ ts.Debug.assert(opening.kind === 262 /* JsxSelfClosingElement */);
// Nothing else to do for self-closing elements
result = opening;
}
@@ -20280,11 +20435,11 @@
var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElementOrFragment(/*inExpressionContext*/ true); });
if (invalidElement) {
parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element);
- var badNode = createNode(204 /* BinaryExpression */, result.pos);
+ var badNode = createNode(205 /* BinaryExpression */, result.pos);
badNode.end = invalidElement.end;
badNode.left = result;
badNode.right = invalidElement;
- badNode.operatorToken = createMissingNode(27 /* CommaToken */, /*reportAtCurrentPosition*/ false, /*diagnosticMessage*/ undefined); // TODO: GH#18217
+ badNode.operatorToken = createMissingNode(27 /* CommaToken */, /*reportAtCurrentPosition*/ false);
badNode.operatorToken.pos = badNode.operatorToken.end = badNode.right.pos;
return badNode;
}
@@ -20339,7 +20494,7 @@
return createNodeArray(list, listPos);
}
function parseJsxAttributes() {
- var jsxAttributes = createNode(268 /* JsxAttributes */);
+ var jsxAttributes = createNode(269 /* JsxAttributes */);
jsxAttributes.properties = parseList(13 /* JsxAttributes */, parseJsxAttribute);
return finishNode(jsxAttributes);
}
@@ -20348,7 +20503,7 @@
parseExpected(28 /* LessThanToken */);
if (token() === 30 /* GreaterThanToken */) {
// See below for explanation of scanJsxText
- var node_1 = createNode(265 /* JsxOpeningFragment */, fullStart);
+ var node_1 = createNode(266 /* JsxOpeningFragment */, fullStart);
scanJsxText();
return finishNode(node_1);
}
@@ -20360,7 +20515,7 @@
// Closing tag, so scan the immediately-following text with the JSX scanning instead
// of regular scanning to avoid treating illegal characters (e.g. '#') as immediate
// scanning errors
- node = createNode(262 /* JsxOpeningElement */, fullStart);
+ node = createNode(263 /* JsxOpeningElement */, fullStart);
scanJsxText();
}
else {
@@ -20372,7 +20527,7 @@
parseExpected(30 /* GreaterThanToken */, /*diagnostic*/ undefined, /*shouldAdvance*/ false);
scanJsxText();
}
- node = createNode(261 /* JsxSelfClosingElement */, fullStart);
+ node = createNode(262 /* JsxSelfClosingElement */, fullStart);
}
node.tagName = tagName;
node.typeArguments = typeArguments;
@@ -20386,10 +20541,10 @@
// primaryExpression in the form of an identifier and "this" keyword
// We can't just simply use parseLeftHandSideExpressionOrHigher because then we will start consider class,function etc as a keyword
// We only want to consider "this" as a primaryExpression
- var expression = token() === 100 /* ThisKeyword */ ?
+ var expression = token() === 101 /* ThisKeyword */ ?
parseTokenNode() : parseIdentifierName();
while (parseOptional(24 /* DotToken */)) {
- var propertyAccess = createNode(189 /* PropertyAccessExpression */, expression.pos);
+ var propertyAccess = createNode(190 /* PropertyAccessExpression */, expression.pos);
propertyAccess.expression = expression;
propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true);
expression = finishNode(propertyAccess);
@@ -20397,7 +20552,7 @@
return expression;
}
function parseJsxExpression(inExpressionContext) {
- var node = createNode(270 /* JsxExpression */);
+ var node = createNode(271 /* JsxExpression */);
if (!parseExpected(18 /* OpenBraceToken */)) {
return undefined;
}
@@ -20419,9 +20574,9 @@
return parseJsxSpreadAttribute();
}
scanJsxIdentifier();
- var node = createNode(267 /* JsxAttribute */);
+ var node = createNode(268 /* JsxAttribute */);
node.name = parseIdentifierName();
- if (token() === 59 /* EqualsToken */) {
+ if (token() === 60 /* EqualsToken */) {
switch (scanJsxAttributeValue()) {
case 10 /* StringLiteral */:
node.initializer = parseLiteralNode();
@@ -20434,7 +20589,7 @@
return finishNode(node);
}
function parseJsxSpreadAttribute() {
- var node = createNode(269 /* JsxSpreadAttribute */);
+ var node = createNode(270 /* JsxSpreadAttribute */);
parseExpected(18 /* OpenBraceToken */);
parseExpected(25 /* DotDotDotToken */);
node.expression = parseExpression();
@@ -20442,7 +20597,7 @@
return finishNode(node);
}
function parseJsxClosingElement(inExpressionContext) {
- var node = createNode(263 /* JsxClosingElement */);
+ var node = createNode(264 /* JsxClosingElement */);
parseExpected(29 /* LessThanSlashToken */);
node.tagName = parseJsxElementName();
if (inExpressionContext) {
@@ -20455,7 +20610,7 @@
return finishNode(node);
}
function parseJsxClosingFragment(inExpressionContext) {
- var node = createNode(266 /* JsxClosingFragment */);
+ var node = createNode(267 /* JsxClosingFragment */);
parseExpected(29 /* LessThanSlashToken */);
if (ts.tokenIsIdentifierOrKeyword(token())) {
parseErrorAtRange(parseJsxElementName(), ts.Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment);
@@ -20470,7 +20625,7 @@
return finishNode(node);
}
function parseTypeAssertion() {
- var node = createNode(194 /* TypeAssertionExpression */);
+ var node = createNode(195 /* TypeAssertionExpression */);
parseExpected(28 /* LessThanToken */);
node.type = parseType();
parseExpected(30 /* GreaterThanToken */);
@@ -20481,7 +20636,7 @@
while (true) {
var dotToken = parseOptionalToken(24 /* DotToken */);
if (dotToken) {
- var propertyAccess = createNode(189 /* PropertyAccessExpression */, expression.pos);
+ var propertyAccess = createNode(190 /* PropertyAccessExpression */, expression.pos);
propertyAccess.expression = expression;
propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true);
expression = finishNode(propertyAccess);
@@ -20489,17 +20644,17 @@
}
if (token() === 52 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) {
nextToken();
- var nonNullExpression = createNode(213 /* NonNullExpression */, expression.pos);
+ var nonNullExpression = createNode(214 /* NonNullExpression */, expression.pos);
nonNullExpression.expression = expression;
expression = finishNode(nonNullExpression);
continue;
}
// when in the [Decorator] context, we do not parse ElementAccess as it could be part of a ComputedPropertyName
if (!inDecoratorContext() && parseOptional(22 /* OpenBracketToken */)) {
- var indexedAccess = createNode(190 /* ElementAccessExpression */, expression.pos);
+ var indexedAccess = createNode(191 /* ElementAccessExpression */, expression.pos);
indexedAccess.expression = expression;
if (token() === 23 /* CloseBracketToken */) {
- indexedAccess.argumentExpression = createMissingNode(72 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.An_element_access_expression_should_take_an_argument);
+ indexedAccess.argumentExpression = createMissingNode(73 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.An_element_access_expression_should_take_an_argument);
}
else {
var argument = allowInAnd(parseExpression);
@@ -20523,7 +20678,7 @@
return token() === 14 /* NoSubstitutionTemplateLiteral */ || token() === 15 /* TemplateHead */;
}
function parseTaggedTemplateRest(tag, typeArguments) {
- var tagExpression = createNode(193 /* TaggedTemplateExpression */, tag.pos);
+ var tagExpression = createNode(194 /* TaggedTemplateExpression */, tag.pos);
tagExpression.tag = tag;
tagExpression.typeArguments = typeArguments;
tagExpression.template = token() === 14 /* NoSubstitutionTemplateLiteral */
@@ -20548,7 +20703,7 @@
expression = parseTaggedTemplateRest(expression, typeArguments);
continue;
}
- var callExpr = createNode(191 /* CallExpression */, expression.pos);
+ var callExpr = createNode(192 /* CallExpression */, expression.pos);
callExpr.expression = expression;
callExpr.typeArguments = typeArguments;
callExpr.arguments = parseArgumentList();
@@ -20556,7 +20711,7 @@
continue;
}
else if (token() === 20 /* OpenParenToken */) {
- var callExpr = createNode(191 /* CallExpression */, expression.pos);
+ var callExpr = createNode(192 /* CallExpression */, expression.pos);
callExpr.expression = expression;
callExpr.arguments = parseArgumentList();
expression = finishNode(callExpr);
@@ -20632,11 +20787,11 @@
case 10 /* StringLiteral */:
case 14 /* NoSubstitutionTemplateLiteral */:
return parseLiteralNode();
- case 100 /* ThisKeyword */:
- case 98 /* SuperKeyword */:
- case 96 /* NullKeyword */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
+ case 101 /* ThisKeyword */:
+ case 99 /* SuperKeyword */:
+ case 97 /* NullKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
return parseTokenNode();
case 20 /* OpenParenToken */:
return parseParenthesizedExpression();
@@ -20644,7 +20799,7 @@
return parseArrayLiteralExpression();
case 18 /* OpenBraceToken */:
return parseObjectLiteralExpression();
- case 121 /* AsyncKeyword */:
+ case 122 /* AsyncKeyword */:
// Async arrow functions are parsed earlier in parseAssignmentExpressionOrHigher.
// If we encounter `async [no LineTerminator here] function` then this is an async
// function; otherwise, its an identifier.
@@ -20652,14 +20807,14 @@
break;
}
return parseFunctionExpression();
- case 76 /* ClassKeyword */:
+ case 77 /* ClassKeyword */:
return parseClassExpression();
- case 90 /* FunctionKeyword */:
+ case 91 /* FunctionKeyword */:
return parseFunctionExpression();
- case 95 /* NewKeyword */:
+ case 96 /* NewKeyword */:
return parseNewExpressionOrNewDotTarget();
case 42 /* SlashToken */:
- case 64 /* SlashEqualsToken */:
+ case 65 /* SlashEqualsToken */:
if (reScanSlashToken() === 13 /* RegularExpressionLiteral */) {
return parseLiteralNode();
}
@@ -20670,28 +20825,28 @@
return parseIdentifier(ts.Diagnostics.Expression_expected);
}
function parseParenthesizedExpression() {
- var node = createNodeWithJSDoc(195 /* ParenthesizedExpression */);
+ var node = createNodeWithJSDoc(196 /* ParenthesizedExpression */);
parseExpected(20 /* OpenParenToken */);
node.expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
return finishNode(node);
}
function parseSpreadElement() {
- var node = createNode(208 /* SpreadElement */);
+ var node = createNode(209 /* SpreadElement */);
parseExpected(25 /* DotDotDotToken */);
node.expression = parseAssignmentExpressionOrHigher();
return finishNode(node);
}
function parseArgumentOrArrayLiteralElement() {
return token() === 25 /* DotDotDotToken */ ? parseSpreadElement() :
- token() === 27 /* CommaToken */ ? createNode(210 /* OmittedExpression */) :
+ token() === 27 /* CommaToken */ ? createNode(211 /* OmittedExpression */) :
parseAssignmentExpressionOrHigher();
}
function parseArgumentExpression() {
return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement);
}
function parseArrayLiteralExpression() {
- var node = createNode(187 /* ArrayLiteralExpression */);
+ var node = createNode(188 /* ArrayLiteralExpression */);
parseExpected(22 /* OpenBracketToken */);
if (scanner.hasPrecedingLineBreak()) {
node.multiLine = true;
@@ -20703,17 +20858,17 @@
function parseObjectLiteralElement() {
var node = createNodeWithJSDoc(0 /* Unknown */);
if (parseOptionalToken(25 /* DotDotDotToken */)) {
- node.kind = 277 /* SpreadAssignment */;
+ node.kind = 278 /* SpreadAssignment */;
node.expression = parseAssignmentExpressionOrHigher();
return finishNode(node);
}
node.decorators = parseDecorators();
node.modifiers = parseModifiers();
- if (parseContextualModifier(126 /* GetKeyword */)) {
- return parseAccessorDeclaration(node, 158 /* GetAccessor */);
+ if (parseContextualModifier(127 /* GetKeyword */)) {
+ return parseAccessorDeclaration(node, 159 /* GetAccessor */);
}
- if (parseContextualModifier(137 /* SetKeyword */)) {
- return parseAccessorDeclaration(node, 159 /* SetAccessor */);
+ if (parseContextualModifier(138 /* SetKeyword */)) {
+ return parseAccessorDeclaration(node, 160 /* SetAccessor */);
}
var asteriskToken = parseOptionalToken(40 /* AsteriskToken */);
var tokenIsIdentifier = isIdentifier();
@@ -20731,22 +20886,22 @@
// this is necessary because ObjectLiteral productions are also used to cover grammar for ObjectAssignmentPattern
var isShorthandPropertyAssignment = tokenIsIdentifier && (token() !== 57 /* ColonToken */);
if (isShorthandPropertyAssignment) {
- node.kind = 276 /* ShorthandPropertyAssignment */;
- var equalsToken = parseOptionalToken(59 /* EqualsToken */);
+ node.kind = 277 /* ShorthandPropertyAssignment */;
+ var equalsToken = parseOptionalToken(60 /* EqualsToken */);
if (equalsToken) {
node.equalsToken = equalsToken;
node.objectAssignmentInitializer = allowInAnd(parseAssignmentExpressionOrHigher);
}
}
else {
- node.kind = 275 /* PropertyAssignment */;
+ node.kind = 276 /* PropertyAssignment */;
parseExpected(57 /* ColonToken */);
node.initializer = allowInAnd(parseAssignmentExpressionOrHigher);
}
return finishNode(node);
}
function parseObjectLiteralExpression() {
- var node = createNode(188 /* ObjectLiteralExpression */);
+ var node = createNode(189 /* ObjectLiteralExpression */);
parseExpected(18 /* OpenBraceToken */);
if (scanner.hasPrecedingLineBreak()) {
node.multiLine = true;
@@ -20765,9 +20920,9 @@
if (saveDecoratorContext) {
setDecoratorContext(/*val*/ false);
}
- var node = createNodeWithJSDoc(196 /* FunctionExpression */);
+ var node = createNodeWithJSDoc(197 /* FunctionExpression */);
node.modifiers = parseModifiers();
- parseExpected(90 /* FunctionKeyword */);
+ parseExpected(91 /* FunctionKeyword */);
node.asteriskToken = parseOptionalToken(40 /* AsteriskToken */);
var isGenerator = node.asteriskToken ? 1 /* Yield */ : 0 /* None */;
var isAsync = ts.hasModifier(node, 256 /* Async */) ? 2 /* Await */ : 0 /* None */;
@@ -20788,10 +20943,10 @@
}
function parseNewExpressionOrNewDotTarget() {
var fullStart = scanner.getStartPos();
- parseExpected(95 /* NewKeyword */);
+ parseExpected(96 /* NewKeyword */);
if (parseOptional(24 /* DotToken */)) {
- var node_2 = createNode(214 /* MetaProperty */, fullStart);
- node_2.keywordToken = 95 /* NewKeyword */;
+ var node_2 = createNode(215 /* MetaProperty */, fullStart);
+ node_2.keywordToken = 96 /* NewKeyword */;
node_2.name = parseIdentifierName();
return finishNode(node_2);
}
@@ -20807,7 +20962,7 @@
}
break;
}
- var node = createNode(192 /* NewExpression */, fullStart);
+ var node = createNode(193 /* NewExpression */, fullStart);
node.expression = expression;
node.typeArguments = typeArguments;
if (node.typeArguments || token() === 20 /* OpenParenToken */) {
@@ -20817,7 +20972,7 @@
}
// STATEMENTS
function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) {
- var node = createNode(218 /* Block */);
+ var node = createNode(219 /* Block */);
if (parseExpected(18 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) {
if (scanner.hasPrecedingLineBreak()) {
node.multiLine = true;
@@ -20850,25 +21005,25 @@
return block;
}
function parseEmptyStatement() {
- var node = createNode(220 /* EmptyStatement */);
+ var node = createNode(221 /* EmptyStatement */);
parseExpected(26 /* SemicolonToken */);
return finishNode(node);
}
function parseIfStatement() {
- var node = createNode(222 /* IfStatement */);
- parseExpected(91 /* IfKeyword */);
+ var node = createNode(223 /* IfStatement */);
+ parseExpected(92 /* IfKeyword */);
parseExpected(20 /* OpenParenToken */);
node.expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
node.thenStatement = parseStatement();
- node.elseStatement = parseOptional(83 /* ElseKeyword */) ? parseStatement() : undefined;
+ node.elseStatement = parseOptional(84 /* ElseKeyword */) ? parseStatement() : undefined;
return finishNode(node);
}
function parseDoStatement() {
- var node = createNode(223 /* DoStatement */);
- parseExpected(82 /* DoKeyword */);
+ var node = createNode(224 /* DoStatement */);
+ parseExpected(83 /* DoKeyword */);
node.statement = parseStatement();
- parseExpected(107 /* WhileKeyword */);
+ parseExpected(108 /* WhileKeyword */);
parseExpected(20 /* OpenParenToken */);
node.expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
@@ -20880,8 +21035,8 @@
return finishNode(node);
}
function parseWhileStatement() {
- var node = createNode(224 /* WhileStatement */);
- parseExpected(107 /* WhileKeyword */);
+ var node = createNode(225 /* WhileStatement */);
+ parseExpected(108 /* WhileKeyword */);
parseExpected(20 /* OpenParenToken */);
node.expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
@@ -20890,12 +21045,12 @@
}
function parseForOrForInOrForOfStatement() {
var pos = getNodePos();
- parseExpected(89 /* ForKeyword */);
- var awaitToken = parseOptionalToken(122 /* AwaitKeyword */);
+ parseExpected(90 /* ForKeyword */);
+ var awaitToken = parseOptionalToken(123 /* AwaitKeyword */);
parseExpected(20 /* OpenParenToken */);
var initializer;
if (token() !== 26 /* SemicolonToken */) {
- if (token() === 105 /* VarKeyword */ || token() === 111 /* LetKeyword */ || token() === 77 /* ConstKeyword */) {
+ if (token() === 106 /* VarKeyword */ || token() === 112 /* LetKeyword */ || token() === 78 /* ConstKeyword */) {
initializer = parseVariableDeclarationList(/*inForStatementInitializer*/ true);
}
else {
@@ -20903,23 +21058,23 @@
}
}
var forOrForInOrForOfStatement;
- if (awaitToken ? parseExpected(147 /* OfKeyword */) : parseOptional(147 /* OfKeyword */)) {
- var forOfStatement = createNode(227 /* ForOfStatement */, pos);
+ if (awaitToken ? parseExpected(148 /* OfKeyword */) : parseOptional(148 /* OfKeyword */)) {
+ var forOfStatement = createNode(228 /* ForOfStatement */, pos);
forOfStatement.awaitModifier = awaitToken;
forOfStatement.initializer = initializer;
forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher);
parseExpected(21 /* CloseParenToken */);
forOrForInOrForOfStatement = forOfStatement;
}
- else if (parseOptional(93 /* InKeyword */)) {
- var forInStatement = createNode(226 /* ForInStatement */, pos);
+ else if (parseOptional(94 /* InKeyword */)) {
+ var forInStatement = createNode(227 /* ForInStatement */, pos);
forInStatement.initializer = initializer;
forInStatement.expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
forOrForInOrForOfStatement = forInStatement;
}
else {
- var forStatement = createNode(225 /* ForStatement */, pos);
+ var forStatement = createNode(226 /* ForStatement */, pos);
forStatement.initializer = initializer;
parseExpected(26 /* SemicolonToken */);
if (token() !== 26 /* SemicolonToken */ && token() !== 21 /* CloseParenToken */) {
@@ -20937,7 +21092,7 @@
}
function parseBreakOrContinueStatement(kind) {
var node = createNode(kind);
- parseExpected(kind === 229 /* BreakStatement */ ? 73 /* BreakKeyword */ : 78 /* ContinueKeyword */);
+ parseExpected(kind === 230 /* BreakStatement */ ? 74 /* BreakKeyword */ : 79 /* ContinueKeyword */);
if (!canParseSemicolon()) {
node.label = parseIdentifier();
}
@@ -20945,8 +21100,8 @@
return finishNode(node);
}
function parseReturnStatement() {
- var node = createNode(230 /* ReturnStatement */);
- parseExpected(97 /* ReturnKeyword */);
+ var node = createNode(231 /* ReturnStatement */);
+ parseExpected(98 /* ReturnKeyword */);
if (!canParseSemicolon()) {
node.expression = allowInAnd(parseExpression);
}
@@ -20954,8 +21109,8 @@
return finishNode(node);
}
function parseWithStatement() {
- var node = createNode(231 /* WithStatement */);
- parseExpected(108 /* WithKeyword */);
+ var node = createNode(232 /* WithStatement */);
+ parseExpected(109 /* WithKeyword */);
parseExpected(20 /* OpenParenToken */);
node.expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
@@ -20963,30 +21118,30 @@
return finishNode(node);
}
function parseCaseClause() {
- var node = createNode(271 /* CaseClause */);
- parseExpected(74 /* CaseKeyword */);
+ var node = createNode(272 /* CaseClause */);
+ parseExpected(75 /* CaseKeyword */);
node.expression = allowInAnd(parseExpression);
parseExpected(57 /* ColonToken */);
node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement);
return finishNode(node);
}
function parseDefaultClause() {
- var node = createNode(272 /* DefaultClause */);
- parseExpected(80 /* DefaultKeyword */);
+ var node = createNode(273 /* DefaultClause */);
+ parseExpected(81 /* DefaultKeyword */);
parseExpected(57 /* ColonToken */);
node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement);
return finishNode(node);
}
function parseCaseOrDefaultClause() {
- return token() === 74 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause();
+ return token() === 75 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause();
}
function parseSwitchStatement() {
- var node = createNode(232 /* SwitchStatement */);
- parseExpected(99 /* SwitchKeyword */);
+ var node = createNode(233 /* SwitchStatement */);
+ parseExpected(100 /* SwitchKeyword */);
parseExpected(20 /* OpenParenToken */);
node.expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
- var caseBlock = createNode(246 /* CaseBlock */);
+ var caseBlock = createNode(247 /* CaseBlock */);
parseExpected(18 /* OpenBraceToken */);
caseBlock.clauses = parseList(2 /* SwitchClauses */, parseCaseOrDefaultClause);
parseExpected(19 /* CloseBraceToken */);
@@ -21001,29 +21156,29 @@
// directly as that might consume an expression on the following line.
// We just return 'undefined' in that case. The actual error will be reported in the
// grammar walker.
- var node = createNode(234 /* ThrowStatement */);
- parseExpected(101 /* ThrowKeyword */);
+ var node = createNode(235 /* ThrowStatement */);
+ parseExpected(102 /* ThrowKeyword */);
node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression);
parseSemicolon();
return finishNode(node);
}
// TODO: Review for error recovery
function parseTryStatement() {
- var node = createNode(235 /* TryStatement */);
- parseExpected(103 /* TryKeyword */);
+ var node = createNode(236 /* TryStatement */);
+ parseExpected(104 /* TryKeyword */);
node.tryBlock = parseBlock(/*ignoreMissingOpenBrace*/ false);
- node.catchClause = token() === 75 /* CatchKeyword */ ? parseCatchClause() : undefined;
+ node.catchClause = token() === 76 /* CatchKeyword */ ? parseCatchClause() : undefined;
// If we don't have a catch clause, then we must have a finally clause. Try to parse
// one out no matter what.
- if (!node.catchClause || token() === 88 /* FinallyKeyword */) {
- parseExpected(88 /* FinallyKeyword */);
+ if (!node.catchClause || token() === 89 /* FinallyKeyword */) {
+ parseExpected(89 /* FinallyKeyword */);
node.finallyBlock = parseBlock(/*ignoreMissingOpenBrace*/ false);
}
return finishNode(node);
}
function parseCatchClause() {
- var result = createNode(274 /* CatchClause */);
- parseExpected(75 /* CatchKeyword */);
+ var result = createNode(275 /* CatchClause */);
+ parseExpected(76 /* CatchKeyword */);
if (parseOptional(20 /* OpenParenToken */)) {
result.variableDeclaration = parseVariableDeclaration();
parseExpected(21 /* CloseParenToken */);
@@ -21036,8 +21191,8 @@
return finishNode(result);
}
function parseDebuggerStatement() {
- var node = createNode(236 /* DebuggerStatement */);
- parseExpected(79 /* DebuggerKeyword */);
+ var node = createNode(237 /* DebuggerStatement */);
+ parseExpected(80 /* DebuggerKeyword */);
parseSemicolon();
return finishNode(node);
}
@@ -21047,13 +21202,13 @@
// a colon.
var node = createNodeWithJSDoc(0 /* Unknown */);
var expression = allowInAnd(parseExpression);
- if (expression.kind === 72 /* Identifier */ && parseOptional(57 /* ColonToken */)) {
- node.kind = 233 /* LabeledStatement */;
+ if (expression.kind === 73 /* Identifier */ && parseOptional(57 /* ColonToken */)) {
+ node.kind = 234 /* LabeledStatement */;
node.label = expression;
node.statement = parseStatement();
}
else {
- node.kind = 221 /* ExpressionStatement */;
+ node.kind = 222 /* ExpressionStatement */;
node.expression = expression;
parseSemicolon();
}
@@ -21065,11 +21220,11 @@
}
function nextTokenIsClassKeywordOnSameLine() {
nextToken();
- return token() === 76 /* ClassKeyword */ && !scanner.hasPrecedingLineBreak();
+ return token() === 77 /* ClassKeyword */ && !scanner.hasPrecedingLineBreak();
}
function nextTokenIsFunctionKeywordOnSameLine() {
nextToken();
- return token() === 90 /* FunctionKeyword */ && !scanner.hasPrecedingLineBreak();
+ return token() === 91 /* FunctionKeyword */ && !scanner.hasPrecedingLineBreak();
}
function nextTokenIsIdentifierOrKeywordOrLiteralOnSameLine() {
nextToken();
@@ -21078,12 +21233,12 @@
function isDeclaration() {
while (true) {
switch (token()) {
- case 105 /* VarKeyword */:
- case 111 /* LetKeyword */:
- case 77 /* ConstKeyword */:
- case 90 /* FunctionKeyword */:
- case 76 /* ClassKeyword */:
- case 84 /* EnumKeyword */:
+ case 106 /* VarKeyword */:
+ case 112 /* LetKeyword */:
+ case 78 /* ConstKeyword */:
+ case 91 /* FunctionKeyword */:
+ case 77 /* ClassKeyword */:
+ case 85 /* EnumKeyword */:
return true;
// 'declare', 'module', 'namespace', 'interface'* and 'type' are all legal JavaScript identifiers;
// however, an identifier cannot be followed by another identifier on the same line. This is what we
@@ -21106,41 +21261,41 @@
// I {}
//
// could be legal, it would add complexity for very little gain.
- case 110 /* InterfaceKeyword */:
- case 140 /* TypeKeyword */:
+ case 111 /* InterfaceKeyword */:
+ case 141 /* TypeKeyword */:
return nextTokenIsIdentifierOnSameLine();
- case 130 /* ModuleKeyword */:
- case 131 /* NamespaceKeyword */:
+ case 131 /* ModuleKeyword */:
+ case 132 /* NamespaceKeyword */:
return nextTokenIsIdentifierOrStringLiteralOnSameLine();
- case 118 /* AbstractKeyword */:
- case 121 /* AsyncKeyword */:
- case 125 /* DeclareKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 115 /* PublicKeyword */:
- case 133 /* ReadonlyKeyword */:
+ case 119 /* AbstractKeyword */:
+ case 122 /* AsyncKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 116 /* PublicKeyword */:
+ case 134 /* ReadonlyKeyword */:
nextToken();
// ASI takes effect for this modifier.
if (scanner.hasPrecedingLineBreak()) {
return false;
}
continue;
- case 145 /* GlobalKeyword */:
+ case 146 /* GlobalKeyword */:
nextToken();
- return token() === 18 /* OpenBraceToken */ || token() === 72 /* Identifier */ || token() === 85 /* ExportKeyword */;
- case 92 /* ImportKeyword */:
+ return token() === 18 /* OpenBraceToken */ || token() === 73 /* Identifier */ || token() === 86 /* ExportKeyword */;
+ case 93 /* ImportKeyword */:
nextToken();
return token() === 10 /* StringLiteral */ || token() === 40 /* AsteriskToken */ ||
token() === 18 /* OpenBraceToken */ || ts.tokenIsIdentifierOrKeyword(token());
- case 85 /* ExportKeyword */:
+ case 86 /* ExportKeyword */:
nextToken();
- if (token() === 59 /* EqualsToken */ || token() === 40 /* AsteriskToken */ ||
- token() === 18 /* OpenBraceToken */ || token() === 80 /* DefaultKeyword */ ||
- token() === 119 /* AsKeyword */) {
+ if (token() === 60 /* EqualsToken */ || token() === 40 /* AsteriskToken */ ||
+ token() === 18 /* OpenBraceToken */ || token() === 81 /* DefaultKeyword */ ||
+ token() === 120 /* AsKeyword */) {
return true;
}
continue;
- case 116 /* StaticKeyword */:
+ case 117 /* StaticKeyword */:
nextToken();
continue;
default:
@@ -21156,47 +21311,47 @@
case 58 /* AtToken */:
case 26 /* SemicolonToken */:
case 18 /* OpenBraceToken */:
- case 105 /* VarKeyword */:
- case 111 /* LetKeyword */:
- case 90 /* FunctionKeyword */:
- case 76 /* ClassKeyword */:
- case 84 /* EnumKeyword */:
- case 91 /* IfKeyword */:
- case 82 /* DoKeyword */:
- case 107 /* WhileKeyword */:
- case 89 /* ForKeyword */:
- case 78 /* ContinueKeyword */:
- case 73 /* BreakKeyword */:
- case 97 /* ReturnKeyword */:
- case 108 /* WithKeyword */:
- case 99 /* SwitchKeyword */:
- case 101 /* ThrowKeyword */:
- case 103 /* TryKeyword */:
- case 79 /* DebuggerKeyword */:
+ case 106 /* VarKeyword */:
+ case 112 /* LetKeyword */:
+ case 91 /* FunctionKeyword */:
+ case 77 /* ClassKeyword */:
+ case 85 /* EnumKeyword */:
+ case 92 /* IfKeyword */:
+ case 83 /* DoKeyword */:
+ case 108 /* WhileKeyword */:
+ case 90 /* ForKeyword */:
+ case 79 /* ContinueKeyword */:
+ case 74 /* BreakKeyword */:
+ case 98 /* ReturnKeyword */:
+ case 109 /* WithKeyword */:
+ case 100 /* SwitchKeyword */:
+ case 102 /* ThrowKeyword */:
+ case 104 /* TryKeyword */:
+ case 80 /* DebuggerKeyword */:
// 'catch' and 'finally' do not actually indicate that the code is part of a statement,
// however, we say they are here so that we may gracefully parse them and error later.
- case 75 /* CatchKeyword */:
- case 88 /* FinallyKeyword */:
+ case 76 /* CatchKeyword */:
+ case 89 /* FinallyKeyword */:
return true;
- case 92 /* ImportKeyword */:
+ case 93 /* ImportKeyword */:
return isStartOfDeclaration() || lookAhead(nextTokenIsOpenParenOrLessThanOrDot);
- case 77 /* ConstKeyword */:
- case 85 /* ExportKeyword */:
+ case 78 /* ConstKeyword */:
+ case 86 /* ExportKeyword */:
return isStartOfDeclaration();
- case 121 /* AsyncKeyword */:
- case 125 /* DeclareKeyword */:
- case 110 /* InterfaceKeyword */:
- case 130 /* ModuleKeyword */:
- case 131 /* NamespaceKeyword */:
- case 140 /* TypeKeyword */:
- case 145 /* GlobalKeyword */:
+ case 122 /* AsyncKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 111 /* InterfaceKeyword */:
+ case 131 /* ModuleKeyword */:
+ case 132 /* NamespaceKeyword */:
+ case 141 /* TypeKeyword */:
+ case 146 /* GlobalKeyword */:
// When these don't start a declaration, they're an identifier in an expression statement
return true;
- case 115 /* PublicKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 116 /* StaticKeyword */:
- case 133 /* ReadonlyKeyword */:
+ case 116 /* PublicKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 117 /* StaticKeyword */:
+ case 134 /* ReadonlyKeyword */:
// When these don't start a declaration, they may be the start of a class member if an identifier
// immediately follows. Otherwise they're an identifier in an expression statement.
return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine);
@@ -21219,63 +21374,63 @@
return parseEmptyStatement();
case 18 /* OpenBraceToken */:
return parseBlock(/*ignoreMissingOpenBrace*/ false);
- case 105 /* VarKeyword */:
- return parseVariableStatement(createNodeWithJSDoc(237 /* VariableDeclaration */));
- case 111 /* LetKeyword */:
+ case 106 /* VarKeyword */:
+ return parseVariableStatement(createNodeWithJSDoc(238 /* VariableDeclaration */));
+ case 112 /* LetKeyword */:
if (isLetDeclaration()) {
- return parseVariableStatement(createNodeWithJSDoc(237 /* VariableDeclaration */));
+ return parseVariableStatement(createNodeWithJSDoc(238 /* VariableDeclaration */));
}
break;
- case 90 /* FunctionKeyword */:
- return parseFunctionDeclaration(createNodeWithJSDoc(239 /* FunctionDeclaration */));
- case 76 /* ClassKeyword */:
- return parseClassDeclaration(createNodeWithJSDoc(240 /* ClassDeclaration */));
- case 91 /* IfKeyword */:
+ case 91 /* FunctionKeyword */:
+ return parseFunctionDeclaration(createNodeWithJSDoc(240 /* FunctionDeclaration */));
+ case 77 /* ClassKeyword */:
+ return parseClassDeclaration(createNodeWithJSDoc(241 /* ClassDeclaration */));
+ case 92 /* IfKeyword */:
return parseIfStatement();
- case 82 /* DoKeyword */:
+ case 83 /* DoKeyword */:
return parseDoStatement();
- case 107 /* WhileKeyword */:
+ case 108 /* WhileKeyword */:
return parseWhileStatement();
- case 89 /* ForKeyword */:
+ case 90 /* ForKeyword */:
return parseForOrForInOrForOfStatement();
- case 78 /* ContinueKeyword */:
- return parseBreakOrContinueStatement(228 /* ContinueStatement */);
- case 73 /* BreakKeyword */:
- return parseBreakOrContinueStatement(229 /* BreakStatement */);
- case 97 /* ReturnKeyword */:
+ case 79 /* ContinueKeyword */:
+ return parseBreakOrContinueStatement(229 /* ContinueStatement */);
+ case 74 /* BreakKeyword */:
+ return parseBreakOrContinueStatement(230 /* BreakStatement */);
+ case 98 /* ReturnKeyword */:
return parseReturnStatement();
- case 108 /* WithKeyword */:
+ case 109 /* WithKeyword */:
return parseWithStatement();
- case 99 /* SwitchKeyword */:
+ case 100 /* SwitchKeyword */:
return parseSwitchStatement();
- case 101 /* ThrowKeyword */:
+ case 102 /* ThrowKeyword */:
return parseThrowStatement();
- case 103 /* TryKeyword */:
+ case 104 /* TryKeyword */:
// Include 'catch' and 'finally' for error recovery.
- case 75 /* CatchKeyword */:
- case 88 /* FinallyKeyword */:
+ case 76 /* CatchKeyword */:
+ case 89 /* FinallyKeyword */:
return parseTryStatement();
- case 79 /* DebuggerKeyword */:
+ case 80 /* DebuggerKeyword */:
return parseDebuggerStatement();
case 58 /* AtToken */:
return parseDeclaration();
- case 121 /* AsyncKeyword */:
- case 110 /* InterfaceKeyword */:
- case 140 /* TypeKeyword */:
- case 130 /* ModuleKeyword */:
- case 131 /* NamespaceKeyword */:
- case 125 /* DeclareKeyword */:
- case 77 /* ConstKeyword */:
- case 84 /* EnumKeyword */:
- case 85 /* ExportKeyword */:
- case 92 /* ImportKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 115 /* PublicKeyword */:
- case 118 /* AbstractKeyword */:
- case 116 /* StaticKeyword */:
- case 133 /* ReadonlyKeyword */:
- case 145 /* GlobalKeyword */:
+ case 122 /* AsyncKeyword */:
+ case 111 /* InterfaceKeyword */:
+ case 141 /* TypeKeyword */:
+ case 131 /* ModuleKeyword */:
+ case 132 /* NamespaceKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 78 /* ConstKeyword */:
+ case 85 /* EnumKeyword */:
+ case 86 /* ExportKeyword */:
+ case 93 /* ImportKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 116 /* PublicKeyword */:
+ case 119 /* AbstractKeyword */:
+ case 117 /* StaticKeyword */:
+ case 134 /* ReadonlyKeyword */:
+ case 146 /* GlobalKeyword */:
if (isStartOfDeclaration()) {
return parseDeclaration();
}
@@ -21284,7 +21439,7 @@
return parseExpressionOrLabeledStatement();
}
function isDeclareModifier(modifier) {
- return modifier.kind === 125 /* DeclareKeyword */;
+ return modifier.kind === 126 /* DeclareKeyword */;
}
function parseDeclaration() {
var node = createNodeWithJSDoc(0 /* Unknown */);
@@ -21303,33 +21458,33 @@
}
function parseDeclarationWorker(node) {
switch (token()) {
- case 105 /* VarKeyword */:
- case 111 /* LetKeyword */:
- case 77 /* ConstKeyword */:
+ case 106 /* VarKeyword */:
+ case 112 /* LetKeyword */:
+ case 78 /* ConstKeyword */:
return parseVariableStatement(node);
- case 90 /* FunctionKeyword */:
+ case 91 /* FunctionKeyword */:
return parseFunctionDeclaration(node);
- case 76 /* ClassKeyword */:
+ case 77 /* ClassKeyword */:
return parseClassDeclaration(node);
- case 110 /* InterfaceKeyword */:
+ case 111 /* InterfaceKeyword */:
return parseInterfaceDeclaration(node);
- case 140 /* TypeKeyword */:
+ case 141 /* TypeKeyword */:
return parseTypeAliasDeclaration(node);
- case 84 /* EnumKeyword */:
+ case 85 /* EnumKeyword */:
return parseEnumDeclaration(node);
- case 145 /* GlobalKeyword */:
- case 130 /* ModuleKeyword */:
- case 131 /* NamespaceKeyword */:
+ case 146 /* GlobalKeyword */:
+ case 131 /* ModuleKeyword */:
+ case 132 /* NamespaceKeyword */:
return parseModuleDeclaration(node);
- case 92 /* ImportKeyword */:
+ case 93 /* ImportKeyword */:
return parseImportDeclarationOrImportEqualsDeclaration(node);
- case 85 /* ExportKeyword */:
+ case 86 /* ExportKeyword */:
nextToken();
switch (token()) {
- case 80 /* DefaultKeyword */:
- case 59 /* EqualsToken */:
+ case 81 /* DefaultKeyword */:
+ case 60 /* EqualsToken */:
return parseExportAssignment(node);
- case 119 /* AsKeyword */:
+ case 120 /* AsKeyword */:
return parseNamespaceExportDeclaration(node);
default:
return parseExportDeclaration(node);
@@ -21338,7 +21493,7 @@
if (node.decorators || node.modifiers) {
// We reached this point because we encountered decorators and/or modifiers and assumed a declaration
// would follow. For recovery and error reporting purposes, return an incomplete declaration.
- var missing = createMissingNode(258 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected);
+ var missing = createMissingNode(259 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected);
missing.pos = node.pos;
missing.decorators = node.decorators;
missing.modifiers = node.modifiers;
@@ -21361,16 +21516,16 @@
// DECLARATIONS
function parseArrayBindingElement() {
if (token() === 27 /* CommaToken */) {
- return createNode(210 /* OmittedExpression */);
+ return createNode(211 /* OmittedExpression */);
}
- var node = createNode(186 /* BindingElement */);
+ var node = createNode(187 /* BindingElement */);
node.dotDotDotToken = parseOptionalToken(25 /* DotDotDotToken */);
node.name = parseIdentifierOrPattern();
node.initializer = parseInitializer();
return finishNode(node);
}
function parseObjectBindingElement() {
- var node = createNode(186 /* BindingElement */);
+ var node = createNode(187 /* BindingElement */);
node.dotDotDotToken = parseOptionalToken(25 /* DotDotDotToken */);
var tokenIsIdentifier = isIdentifier();
var propertyName = parsePropertyName();
@@ -21386,14 +21541,14 @@
return finishNode(node);
}
function parseObjectBindingPattern() {
- var node = createNode(184 /* ObjectBindingPattern */);
+ var node = createNode(185 /* ObjectBindingPattern */);
parseExpected(18 /* OpenBraceToken */);
node.elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement);
parseExpected(19 /* CloseBraceToken */);
return finishNode(node);
}
function parseArrayBindingPattern() {
- var node = createNode(185 /* ArrayBindingPattern */);
+ var node = createNode(186 /* ArrayBindingPattern */);
parseExpected(22 /* OpenBracketToken */);
node.elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement);
parseExpected(23 /* CloseBracketToken */);
@@ -21415,9 +21570,9 @@
return parseVariableDeclaration(/*allowExclamation*/ true);
}
function parseVariableDeclaration(allowExclamation) {
- var node = createNode(237 /* VariableDeclaration */);
+ var node = createNode(238 /* VariableDeclaration */);
node.name = parseIdentifierOrPattern();
- if (allowExclamation && node.name.kind === 72 /* Identifier */ &&
+ if (allowExclamation && node.name.kind === 73 /* Identifier */ &&
token() === 52 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) {
node.exclamationToken = parseTokenNode();
}
@@ -21428,14 +21583,14 @@
return finishNode(node);
}
function parseVariableDeclarationList(inForStatementInitializer) {
- var node = createNode(238 /* VariableDeclarationList */);
+ var node = createNode(239 /* VariableDeclarationList */);
switch (token()) {
- case 105 /* VarKeyword */:
+ case 106 /* VarKeyword */:
break;
- case 111 /* LetKeyword */:
+ case 112 /* LetKeyword */:
node.flags |= 1 /* Let */;
break;
- case 77 /* ConstKeyword */:
+ case 78 /* ConstKeyword */:
node.flags |= 2 /* Const */;
break;
default:
@@ -21451,7 +21606,7 @@
// So we need to look ahead to determine if 'of' should be treated as a keyword in
// this context.
// The checker will then give an error that there is an empty declaration list.
- if (token() === 147 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) {
+ if (token() === 148 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) {
node.declarations = createMissingList();
}
else {
@@ -21466,14 +21621,14 @@
return nextTokenIsIdentifier() && nextToken() === 21 /* CloseParenToken */;
}
function parseVariableStatement(node) {
- node.kind = 219 /* VariableStatement */;
+ node.kind = 220 /* VariableStatement */;
node.declarationList = parseVariableDeclarationList(/*inForStatementInitializer*/ false);
parseSemicolon();
return finishNode(node);
}
function parseFunctionDeclaration(node) {
- node.kind = 239 /* FunctionDeclaration */;
- parseExpected(90 /* FunctionKeyword */);
+ node.kind = 240 /* FunctionDeclaration */;
+ parseExpected(91 /* FunctionKeyword */);
node.asteriskToken = parseOptionalToken(40 /* AsteriskToken */);
node.name = ts.hasModifier(node, 512 /* Default */) ? parseOptionalIdentifier() : parseIdentifier();
var isGenerator = node.asteriskToken ? 1 /* Yield */ : 0 /* None */;
@@ -21483,14 +21638,14 @@
return finishNode(node);
}
function parseConstructorDeclaration(node) {
- node.kind = 157 /* Constructor */;
- parseExpected(124 /* ConstructorKeyword */);
+ node.kind = 158 /* Constructor */;
+ parseExpected(125 /* ConstructorKeyword */);
fillSignature(57 /* ColonToken */, 0 /* None */, node);
node.body = parseFunctionBlockOrSemicolon(0 /* None */, ts.Diagnostics.or_expected);
return finishNode(node);
}
function parseMethodDeclaration(node, asteriskToken, diagnosticMessage) {
- node.kind = 156 /* MethodDeclaration */;
+ node.kind = 157 /* MethodDeclaration */;
node.asteriskToken = asteriskToken;
var isGenerator = asteriskToken ? 1 /* Yield */ : 0 /* None */;
var isAsync = ts.hasModifier(node, 256 /* Async */) ? 2 /* Await */ : 0 /* None */;
@@ -21499,7 +21654,7 @@
return finishNode(node);
}
function parsePropertyDeclaration(node) {
- node.kind = 154 /* PropertyDeclaration */;
+ node.kind = 155 /* PropertyDeclaration */;
if (!node.questionToken && token() === 52 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) {
node.exclamationToken = parseTokenNode();
}
@@ -21572,7 +21727,7 @@
// If we were able to get any potential identifier...
if (idToken !== undefined) {
// If we have a non-keyword identifier, or if we have an accessor, then it's safe to parse.
- if (!ts.isKeyword(idToken) || idToken === 137 /* SetKeyword */ || idToken === 126 /* GetKeyword */) {
+ if (!ts.isKeyword(idToken) || idToken === 138 /* SetKeyword */ || idToken === 127 /* GetKeyword */) {
return true;
}
// If it *is* a keyword, but not an accessor, check a little farther along
@@ -21582,7 +21737,7 @@
case 28 /* LessThanToken */: // Generic Method declaration
case 52 /* ExclamationToken */: // Non-null assertion on property name
case 57 /* ColonToken */: // Type Annotation for declaration
- case 59 /* EqualsToken */: // Initializer for declaration
+ case 60 /* EqualsToken */: // Initializer for declaration
case 56 /* QuestionToken */: // Not valid, but permitted so that it gets caught later on.
return true;
default:
@@ -21604,7 +21759,7 @@
if (!parseOptional(58 /* AtToken */)) {
break;
}
- var decorator = createNode(152 /* Decorator */, decoratorStart);
+ var decorator = createNode(153 /* Decorator */, decoratorStart);
decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher);
finishNode(decorator);
(list || (list = [])).push(decorator);
@@ -21624,7 +21779,7 @@
while (true) {
var modifierStart = scanner.getStartPos();
var modifierKind = token();
- if (token() === 77 /* ConstKeyword */ && permitInvalidConstAsModifier) {
+ if (token() === 78 /* ConstKeyword */ && permitInvalidConstAsModifier) {
// We need to ensure that any subsequent modifiers appear on the same line
// so that when 'const' is a standalone declaration, we don't issue an error.
if (!tryParse(nextTokenIsOnSameLineAndCanFollowModifier)) {
@@ -21643,7 +21798,7 @@
}
function parseModifiersForArrowFunction() {
var modifiers;
- if (token() === 121 /* AsyncKeyword */) {
+ if (token() === 122 /* AsyncKeyword */) {
var modifierStart = scanner.getStartPos();
var modifierKind = token();
nextToken();
@@ -21654,20 +21809,20 @@
}
function parseClassElement() {
if (token() === 26 /* SemicolonToken */) {
- var result = createNode(217 /* SemicolonClassElement */);
+ var result = createNode(218 /* SemicolonClassElement */);
nextToken();
return finishNode(result);
}
var node = createNodeWithJSDoc(0 /* Unknown */);
node.decorators = parseDecorators();
node.modifiers = parseModifiers(/*permitInvalidConstAsModifier*/ true);
- if (parseContextualModifier(126 /* GetKeyword */)) {
- return parseAccessorDeclaration(node, 158 /* GetAccessor */);
+ if (parseContextualModifier(127 /* GetKeyword */)) {
+ return parseAccessorDeclaration(node, 159 /* GetAccessor */);
}
- if (parseContextualModifier(137 /* SetKeyword */)) {
- return parseAccessorDeclaration(node, 159 /* SetAccessor */);
+ if (parseContextualModifier(138 /* SetKeyword */)) {
+ return parseAccessorDeclaration(node, 160 /* SetAccessor */);
}
- if (token() === 124 /* ConstructorKeyword */) {
+ if (token() === 125 /* ConstructorKeyword */) {
return parseConstructorDeclaration(node);
}
if (isIndexSignature()) {
@@ -21684,21 +21839,21 @@
}
if (node.decorators || node.modifiers) {
// treat this as a property declaration with a missing name.
- node.name = createMissingNode(72 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected);
+ node.name = createMissingNode(73 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected);
return parsePropertyDeclaration(node);
}
// 'isClassMemberStart' should have hinted not to attempt parsing.
return ts.Debug.fail("Should not have attempted to parse class member declaration.");
}
function parseClassExpression() {
- return parseClassDeclarationOrExpression(createNodeWithJSDoc(0 /* Unknown */), 209 /* ClassExpression */);
+ return parseClassDeclarationOrExpression(createNodeWithJSDoc(0 /* Unknown */), 210 /* ClassExpression */);
}
function parseClassDeclaration(node) {
- return parseClassDeclarationOrExpression(node, 240 /* ClassDeclaration */);
+ return parseClassDeclarationOrExpression(node, 241 /* ClassDeclaration */);
}
function parseClassDeclarationOrExpression(node, kind) {
node.kind = kind;
- parseExpected(76 /* ClassKeyword */);
+ parseExpected(77 /* ClassKeyword */);
node.name = parseNameOfClassDeclarationOrExpression();
node.typeParameters = parseTypeParameters();
node.heritageClauses = parseHeritageClauses();
@@ -21724,7 +21879,7 @@
: undefined;
}
function isImplementsClause() {
- return token() === 109 /* ImplementsKeyword */ && lookAhead(nextTokenIsIdentifierOrKeyword);
+ return token() === 110 /* ImplementsKeyword */ && lookAhead(nextTokenIsIdentifierOrKeyword);
}
function parseHeritageClauses() {
// ClassTail[Yield,Await] : (Modified) See 14.5
@@ -21736,15 +21891,15 @@
}
function parseHeritageClause() {
var tok = token();
- ts.Debug.assert(tok === 86 /* ExtendsKeyword */ || tok === 109 /* ImplementsKeyword */); // isListElement() should ensure this.
- var node = createNode(273 /* HeritageClause */);
+ ts.Debug.assert(tok === 87 /* ExtendsKeyword */ || tok === 110 /* ImplementsKeyword */); // isListElement() should ensure this.
+ var node = createNode(274 /* HeritageClause */);
node.token = tok;
nextToken();
node.types = parseDelimitedList(7 /* HeritageClauseElement */, parseExpressionWithTypeArguments);
return finishNode(node);
}
function parseExpressionWithTypeArguments() {
- var node = createNode(211 /* ExpressionWithTypeArguments */);
+ var node = createNode(212 /* ExpressionWithTypeArguments */);
node.expression = parseLeftHandSideExpressionOrHigher();
node.typeArguments = tryParseTypeArguments();
return finishNode(node);
@@ -21755,14 +21910,14 @@
: undefined;
}
function isHeritageClause() {
- return token() === 86 /* ExtendsKeyword */ || token() === 109 /* ImplementsKeyword */;
+ return token() === 87 /* ExtendsKeyword */ || token() === 110 /* ImplementsKeyword */;
}
function parseClassMembers() {
return parseList(5 /* ClassMembers */, parseClassElement);
}
function parseInterfaceDeclaration(node) {
- node.kind = 241 /* InterfaceDeclaration */;
- parseExpected(110 /* InterfaceKeyword */);
+ node.kind = 242 /* InterfaceDeclaration */;
+ parseExpected(111 /* InterfaceKeyword */);
node.name = parseIdentifier();
node.typeParameters = parseTypeParameters();
node.heritageClauses = parseHeritageClauses();
@@ -21770,11 +21925,11 @@
return finishNode(node);
}
function parseTypeAliasDeclaration(node) {
- node.kind = 242 /* TypeAliasDeclaration */;
- parseExpected(140 /* TypeKeyword */);
+ node.kind = 243 /* TypeAliasDeclaration */;
+ parseExpected(141 /* TypeKeyword */);
node.name = parseIdentifier();
node.typeParameters = parseTypeParameters();
- parseExpected(59 /* EqualsToken */);
+ parseExpected(60 /* EqualsToken */);
node.type = parseType();
parseSemicolon();
return finishNode(node);
@@ -21784,14 +21939,14 @@
// ConstantEnumMemberSection, which starts at the beginning of an enum declaration
// or any time an integer literal initializer is encountered.
function parseEnumMember() {
- var node = createNodeWithJSDoc(278 /* EnumMember */);
+ var node = createNodeWithJSDoc(279 /* EnumMember */);
node.name = parsePropertyName();
node.initializer = allowInAnd(parseInitializer);
return finishNode(node);
}
function parseEnumDeclaration(node) {
- node.kind = 243 /* EnumDeclaration */;
- parseExpected(84 /* EnumKeyword */);
+ node.kind = 244 /* EnumDeclaration */;
+ parseExpected(85 /* EnumKeyword */);
node.name = parseIdentifier();
if (parseExpected(18 /* OpenBraceToken */)) {
node.members = parseDelimitedList(6 /* EnumMembers */, parseEnumMember);
@@ -21803,7 +21958,7 @@
return finishNode(node);
}
function parseModuleBlock() {
- var node = createNode(245 /* ModuleBlock */);
+ var node = createNode(246 /* ModuleBlock */);
if (parseExpected(18 /* OpenBraceToken */)) {
node.statements = parseList(1 /* BlockStatements */, parseStatement);
parseExpected(19 /* CloseBraceToken */);
@@ -21814,7 +21969,7 @@
return finishNode(node);
}
function parseModuleOrNamespaceDeclaration(node, flags) {
- node.kind = 244 /* ModuleDeclaration */;
+ node.kind = 245 /* ModuleDeclaration */;
// If we are parsing a dotted namespace name, we want to
// propagate the 'Namespace' flag across the names if set.
var namespaceFlag = flags & 16 /* Namespace */;
@@ -21826,8 +21981,8 @@
return finishNode(node);
}
function parseAmbientExternalModuleDeclaration(node) {
- node.kind = 244 /* ModuleDeclaration */;
- if (token() === 145 /* GlobalKeyword */) {
+ node.kind = 245 /* ModuleDeclaration */;
+ if (token() === 146 /* GlobalKeyword */) {
// parse 'global' as name of global scope augmentation
node.name = parseIdentifier();
node.flags |= 512 /* GlobalAugmentation */;
@@ -21846,15 +22001,15 @@
}
function parseModuleDeclaration(node) {
var flags = 0;
- if (token() === 145 /* GlobalKeyword */) {
+ if (token() === 146 /* GlobalKeyword */) {
// global augmentation
return parseAmbientExternalModuleDeclaration(node);
}
- else if (parseOptional(131 /* NamespaceKeyword */)) {
+ else if (parseOptional(132 /* NamespaceKeyword */)) {
flags |= 16 /* Namespace */;
}
else {
- parseExpected(130 /* ModuleKeyword */);
+ parseExpected(131 /* ModuleKeyword */);
if (token() === 10 /* StringLiteral */) {
return parseAmbientExternalModuleDeclaration(node);
}
@@ -21862,7 +22017,7 @@
return parseModuleOrNamespaceDeclaration(node, flags);
}
function isExternalModuleReference() {
- return token() === 134 /* RequireKeyword */ &&
+ return token() === 135 /* RequireKeyword */ &&
lookAhead(nextTokenIsOpenParen);
}
function nextTokenIsOpenParen() {
@@ -21872,25 +22027,25 @@
return nextToken() === 42 /* SlashToken */;
}
function parseNamespaceExportDeclaration(node) {
- node.kind = 247 /* NamespaceExportDeclaration */;
- parseExpected(119 /* AsKeyword */);
- parseExpected(131 /* NamespaceKeyword */);
+ node.kind = 248 /* NamespaceExportDeclaration */;
+ parseExpected(120 /* AsKeyword */);
+ parseExpected(132 /* NamespaceKeyword */);
node.name = parseIdentifier();
parseSemicolon();
return finishNode(node);
}
function parseImportDeclarationOrImportEqualsDeclaration(node) {
- parseExpected(92 /* ImportKeyword */);
+ parseExpected(93 /* ImportKeyword */);
var afterImportPos = scanner.getStartPos();
var identifier;
if (isIdentifier()) {
identifier = parseIdentifier();
- if (token() !== 27 /* CommaToken */ && token() !== 144 /* FromKeyword */) {
+ if (token() !== 27 /* CommaToken */ && token() !== 145 /* FromKeyword */) {
return parseImportEqualsDeclaration(node, identifier);
}
}
// Import statement
- node.kind = 249 /* ImportDeclaration */;
+ node.kind = 250 /* ImportDeclaration */;
// ImportDeclaration:
// import ImportClause from ModuleSpecifier ;
// import ModuleSpecifier;
@@ -21898,16 +22053,16 @@
token() === 40 /* AsteriskToken */ || // import *
token() === 18 /* OpenBraceToken */) { // import {
node.importClause = parseImportClause(identifier, afterImportPos);
- parseExpected(144 /* FromKeyword */);
+ parseExpected(145 /* FromKeyword */);
}
node.moduleSpecifier = parseModuleSpecifier();
parseSemicolon();
return finishNode(node);
}
function parseImportEqualsDeclaration(node, identifier) {
- node.kind = 248 /* ImportEqualsDeclaration */;
+ node.kind = 249 /* ImportEqualsDeclaration */;
node.name = identifier;
- parseExpected(59 /* EqualsToken */);
+ parseExpected(60 /* EqualsToken */);
node.moduleReference = parseModuleReference();
parseSemicolon();
return finishNode(node);
@@ -21919,7 +22074,7 @@
// NamedImports
// ImportedDefaultBinding, NameSpaceImport
// ImportedDefaultBinding, NamedImports
- var importClause = createNode(250 /* ImportClause */, fullStart);
+ var importClause = createNode(251 /* ImportClause */, fullStart);
if (identifier) {
// ImportedDefaultBinding:
// ImportedBinding
@@ -21929,7 +22084,7 @@
// parse namespace or named imports
if (!importClause.name ||
parseOptional(27 /* CommaToken */)) {
- importClause.namedBindings = token() === 40 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(252 /* NamedImports */);
+ importClause.namedBindings = token() === 40 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(253 /* NamedImports */);
}
return finishNode(importClause);
}
@@ -21939,8 +22094,8 @@
: parseEntityName(/*allowReservedWords*/ false);
}
function parseExternalModuleReference() {
- var node = createNode(259 /* ExternalModuleReference */);
- parseExpected(134 /* RequireKeyword */);
+ var node = createNode(260 /* ExternalModuleReference */);
+ parseExpected(135 /* RequireKeyword */);
parseExpected(20 /* OpenParenToken */);
node.expression = parseModuleSpecifier();
parseExpected(21 /* CloseParenToken */);
@@ -21962,9 +22117,9 @@
function parseNamespaceImport() {
// NameSpaceImport:
// * as ImportedBinding
- var namespaceImport = createNode(251 /* NamespaceImport */);
+ var namespaceImport = createNode(252 /* NamespaceImport */);
parseExpected(40 /* AsteriskToken */);
- parseExpected(119 /* AsKeyword */);
+ parseExpected(120 /* AsKeyword */);
namespaceImport.name = parseIdentifier();
return finishNode(namespaceImport);
}
@@ -21977,14 +22132,14 @@
// ImportsList:
// ImportSpecifier
// ImportsList, ImportSpecifier
- node.elements = parseBracketedList(23 /* ImportOrExportSpecifiers */, kind === 252 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 18 /* OpenBraceToken */, 19 /* CloseBraceToken */);
+ node.elements = parseBracketedList(23 /* ImportOrExportSpecifiers */, kind === 253 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 18 /* OpenBraceToken */, 19 /* CloseBraceToken */);
return finishNode(node);
}
function parseExportSpecifier() {
- return parseImportOrExportSpecifier(257 /* ExportSpecifier */);
+ return parseImportOrExportSpecifier(258 /* ExportSpecifier */);
}
function parseImportSpecifier() {
- return parseImportOrExportSpecifier(253 /* ImportSpecifier */);
+ return parseImportOrExportSpecifier(254 /* ImportSpecifier */);
}
function parseImportOrExportSpecifier(kind) {
var node = createNode(kind);
@@ -21998,9 +22153,9 @@
var checkIdentifierStart = scanner.getTokenPos();
var checkIdentifierEnd = scanner.getTextPos();
var identifierName = parseIdentifierName();
- if (token() === 119 /* AsKeyword */) {
+ if (token() === 120 /* AsKeyword */) {
node.propertyName = identifierName;
- parseExpected(119 /* AsKeyword */);
+ parseExpected(120 /* AsKeyword */);
checkIdentifierIsKeyword = ts.isKeyword(token()) && !isIdentifier();
checkIdentifierStart = scanner.getTokenPos();
checkIdentifierEnd = scanner.getTextPos();
@@ -22009,24 +22164,24 @@
else {
node.name = identifierName;
}
- if (kind === 253 /* ImportSpecifier */ && checkIdentifierIsKeyword) {
+ if (kind === 254 /* ImportSpecifier */ && checkIdentifierIsKeyword) {
parseErrorAt(checkIdentifierStart, checkIdentifierEnd, ts.Diagnostics.Identifier_expected);
}
return finishNode(node);
}
function parseExportDeclaration(node) {
- node.kind = 255 /* ExportDeclaration */;
+ node.kind = 256 /* ExportDeclaration */;
if (parseOptional(40 /* AsteriskToken */)) {
- parseExpected(144 /* FromKeyword */);
+ parseExpected(145 /* FromKeyword */);
node.moduleSpecifier = parseModuleSpecifier();
}
else {
- node.exportClause = parseNamedImportsOrExports(256 /* NamedExports */);
+ node.exportClause = parseNamedImportsOrExports(257 /* NamedExports */);
// It is not uncommon to accidentally omit the 'from' keyword. Additionally, in editing scenarios,
// the 'from' keyword can be parsed as a named export when the export clause is unterminated (i.e. `export { from "moduleName";`)
// If we don't have a 'from' keyword, see if we have a string literal such that ASI won't take effect.
- if (token() === 144 /* FromKeyword */ || (token() === 10 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) {
- parseExpected(144 /* FromKeyword */);
+ if (token() === 145 /* FromKeyword */ || (token() === 10 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) {
+ parseExpected(145 /* FromKeyword */);
node.moduleSpecifier = parseModuleSpecifier();
}
}
@@ -22034,12 +22189,12 @@
return finishNode(node);
}
function parseExportAssignment(node) {
- node.kind = 254 /* ExportAssignment */;
- if (parseOptional(59 /* EqualsToken */)) {
+ node.kind = 255 /* ExportAssignment */;
+ if (parseOptional(60 /* EqualsToken */)) {
node.isExportEquals = true;
}
else {
- parseExpected(80 /* DefaultKeyword */);
+ parseExpected(81 /* DefaultKeyword */);
}
node.expression = parseAssignmentExpressionOrHigher();
parseSemicolon();
@@ -22054,10 +22209,10 @@
}
function isAnExternalModuleIndicatorNode(node) {
return ts.hasModifier(node, 1 /* Export */)
- || node.kind === 248 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 259 /* ExternalModuleReference */
- || node.kind === 249 /* ImportDeclaration */
- || node.kind === 254 /* ExportAssignment */
- || node.kind === 255 /* ExportDeclaration */
+ || node.kind === 249 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 260 /* ExternalModuleReference */
+ || node.kind === 250 /* ImportDeclaration */
+ || node.kind === 255 /* ExportAssignment */
+ || node.kind === 256 /* ExportDeclaration */
? node
: undefined;
}
@@ -22070,7 +22225,7 @@
return isImportMeta(node) ? node : forEachChild(node, walkTreeForExternalModuleIndicators);
}
function isImportMeta(node) {
- return ts.isMetaProperty(node) && node.keywordToken === 92 /* ImportKeyword */ && node.name.escapedText === "meta";
+ return ts.isMetaProperty(node) && node.keywordToken === 93 /* ImportKeyword */ && node.name.escapedText === "meta";
}
var ParsingContext;
(function (ParsingContext) {
@@ -22109,8 +22264,8 @@
var JSDocParser;
(function (JSDocParser) {
function parseJSDocTypeExpressionForTests(content, start, length) {
- initializeState(content, 7 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
- sourceFile = createSourceFile("file.js", 7 /* Latest */, 1 /* JS */, /*isDeclarationFile*/ false);
+ initializeState(content, 8 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
+ sourceFile = createSourceFile("file.js", 8 /* Latest */, 1 /* JS */, /*isDeclarationFile*/ false);
scanner.setText(content, start, length);
currentToken = scanner.scan();
var jsDocTypeExpression = parseJSDocTypeExpression();
@@ -22121,18 +22276,18 @@
JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests;
// Parses out a JSDoc type expression.
function parseJSDocTypeExpression(mayOmitBraces) {
- var result = createNode(288 /* JSDocTypeExpression */);
+ var result = createNode(289 /* JSDocTypeExpression */);
var hasBrace = (mayOmitBraces ? parseOptional : parseExpected)(18 /* OpenBraceToken */);
result.type = doInsideOfContext(2097152 /* JSDoc */, parseJSDocType);
if (!mayOmitBraces || hasBrace) {
- parseExpected(19 /* CloseBraceToken */);
+ parseExpectedJSDoc(19 /* CloseBraceToken */);
}
fixupParentReferences(result);
return finishNode(result);
}
JSDocParser.parseJSDocTypeExpression = parseJSDocTypeExpression;
function parseIsolatedJSDocComment(content, start, length) {
- initializeState(content, 7 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
+ initializeState(content, 8 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
sourceFile = { languageVariant: 0 /* Standard */, text: content }; // tslint:disable-line no-object-literal-type-assertion
var jsDoc = parseJSDocCommentWorker(start, length);
var diagnostics = parseDiagnostics;
@@ -22204,7 +22359,7 @@
comments.push(text);
indent += text.length;
}
- nextJSDocToken();
+ nextTokenJSDoc();
while (parseOptionalJsdoc(5 /* WhitespaceTrivia */))
;
if (parseOptionalJsdoc(4 /* NewLineTrivia */)) {
@@ -22222,7 +22377,6 @@
// for malformed examples like `/** @param {string} x @returns {number} the length */`
state = 0 /* BeginningOfLine */;
margin = undefined;
- indent++;
}
else {
pushComment(scanner.getTokenText());
@@ -22267,7 +22421,7 @@
pushComment(scanner.getTokenText());
break;
}
- nextJSDocToken();
+ nextTokenJSDoc();
}
removeLeadingNewlines(comments);
removeTrailingWhitespace(comments);
@@ -22284,7 +22438,7 @@
}
}
function createJSDocComment() {
- var result = createNode(296 /* JSDocComment */, start);
+ var result = createNode(297 /* JSDocComment */, start);
result.tags = tags && createNodeArray(tags, tagsPos, tagsEnd);
result.comment = comments.length ? comments.join("") : undefined;
return finishNode(result, end);
@@ -22292,7 +22446,7 @@
function isNextNonwhitespaceTokenEndOfFile() {
// We must use infinite lookahead, as there could be any number of newlines :(
while (true) {
- nextJSDocToken();
+ nextTokenJSDoc();
if (token() === 1 /* EndOfFileToken */) {
return true;
}
@@ -22308,32 +22462,38 @@
}
}
while (token() === 5 /* WhitespaceTrivia */ || token() === 4 /* NewLineTrivia */) {
- nextJSDocToken();
+ nextTokenJSDoc();
}
}
function skipWhitespaceOrAsterisk() {
if (token() === 5 /* WhitespaceTrivia */ || token() === 4 /* NewLineTrivia */) {
if (lookAhead(isNextNonwhitespaceTokenEndOfFile)) {
- return; // Don't skip whitespace prior to EoF (or end of comment) - that shouldn't be included in any node's range
+ return ""; // Don't skip whitespace prior to EoF (or end of comment) - that shouldn't be included in any node's range
}
}
var precedingLineBreak = scanner.hasPrecedingLineBreak();
+ var seenLineBreak = false;
+ var indentText = "";
while ((precedingLineBreak && token() === 40 /* AsteriskToken */) || token() === 5 /* WhitespaceTrivia */ || token() === 4 /* NewLineTrivia */) {
+ indentText += scanner.getTokenText();
if (token() === 4 /* NewLineTrivia */) {
precedingLineBreak = true;
+ seenLineBreak = true;
+ indentText = "";
}
else if (token() === 40 /* AsteriskToken */) {
precedingLineBreak = false;
}
- nextJSDocToken();
+ nextTokenJSDoc();
}
+ return seenLineBreak ? indentText : "";
}
- function parseTag(indent) {
+ function parseTag(margin) {
ts.Debug.assert(token() === 58 /* AtToken */);
var start = scanner.getTokenPos();
- nextJSDocToken();
+ nextTokenJSDoc();
var tagName = parseJSDocIdentifierName(/*message*/ undefined);
- skipWhitespaceOrAsterisk();
+ var indentText = skipWhitespaceOrAsterisk();
var tag;
switch (tagName.escapedText) {
case "augments":
@@ -22353,7 +22513,7 @@
case "arg":
case "argument":
case "param":
- return parseParameterOrPropertyTag(start, tagName, 2 /* Parameter */, indent);
+ return parseParameterOrPropertyTag(start, tagName, 2 /* Parameter */, margin);
case "return":
case "returns":
tag = parseReturnTag(start, tagName);
@@ -22365,10 +22525,10 @@
tag = parseTypeTag(start, tagName);
break;
case "typedef":
- tag = parseTypedefTag(start, tagName, indent);
+ tag = parseTypedefTag(start, tagName, margin);
break;
case "callback":
- tag = parseCallbackTag(start, tagName, indent);
+ tag = parseCallbackTag(start, tagName, margin);
break;
default:
tag = parseUnknownTag(start, tagName);
@@ -22376,11 +22536,14 @@
}
if (!tag.comment) {
// some tags, like typedef and callback, have already parsed their comments earlier
- tag.comment = parseTagComments(indent + tag.end - tag.pos);
+ if (!indentText) {
+ margin += tag.end - tag.pos;
+ }
+ tag.comment = parseTagComments(margin, indentText.slice(margin));
}
return tag;
}
- function parseTagComments(indent) {
+ function parseTagComments(indent, initialMargin) {
var comments = [];
var state = 0 /* BeginningOfLine */;
var margin;
@@ -22391,6 +22554,11 @@
comments.push(text);
indent += text.length;
}
+ if (initialMargin) {
+ // jump straight to saving comments if there is some initial indentation
+ pushComment(initialMargin);
+ state = 2 /* SavingComments */;
+ }
var tok = token();
loop: while (true) {
switch (tok) {
@@ -22415,18 +22583,18 @@
var whitespace = scanner.getTokenText();
// if the whitespace crosses the margin, take only the whitespace that passes the margin
if (margin !== undefined && indent + whitespace.length > margin) {
- comments.push(whitespace.slice(margin - indent - 1));
+ comments.push(whitespace.slice(margin - indent));
}
indent += whitespace.length;
}
break;
case 18 /* OpenBraceToken */:
state = 2 /* SavingComments */;
- if (lookAhead(function () { return nextJSDocToken() === 58 /* AtToken */ && ts.tokenIsIdentifierOrKeyword(nextJSDocToken()) && scanner.getTokenText() === "link"; })) {
+ if (lookAhead(function () { return nextTokenJSDoc() === 58 /* AtToken */ && ts.tokenIsIdentifierOrKeyword(nextTokenJSDoc()) && scanner.getTokenText() === "link"; })) {
pushComment(scanner.getTokenText());
- nextJSDocToken();
+ nextTokenJSDoc();
pushComment(scanner.getTokenText());
- nextJSDocToken();
+ nextTokenJSDoc();
}
pushComment(scanner.getTokenText());
break;
@@ -22444,14 +22612,14 @@
pushComment(scanner.getTokenText());
break;
}
- tok = nextJSDocToken();
+ tok = nextTokenJSDoc();
}
removeLeadingNewlines(comments);
removeTrailingWhitespace(comments);
return comments.length === 0 ? undefined : comments.join("");
}
function parseUnknownTag(start, tagName) {
- var result = createNode(299 /* JSDocTag */, start);
+ var result = createNode(300 /* JSDocTag */, start);
result.tagName = tagName;
return finishNode(result);
}
@@ -22473,17 +22641,21 @@
return token() === 18 /* OpenBraceToken */ ? parseJSDocTypeExpression() : undefined;
}
function parseBracketNameInPropertyAndParamTag() {
- if (token() === 14 /* NoSubstitutionTemplateLiteral */) {
- // a markdown-quoted name: `arg` is not legal jsdoc, but occurs in the wild
- return { name: createIdentifier(/*isIdentifier*/ true), isBracketed: false };
- }
// Looking for something like '[foo]', 'foo', '[foo.bar]' or 'foo.bar'
- var isBracketed = parseOptional(22 /* OpenBracketToken */);
+ var isBracketed = parseOptionalJsdoc(22 /* OpenBracketToken */);
+ if (isBracketed) {
+ skipWhitespace();
+ }
+ // a markdown-quoted name: `arg` is not legal jsdoc, but occurs in the wild
+ var isBackquoted = parseOptionalJsdoc(59 /* BacktickToken */);
var name = parseJSDocEntityName();
+ if (isBackquoted) {
+ parseExpectedTokenJSDoc(59 /* BacktickToken */);
+ }
if (isBracketed) {
skipWhitespace();
// May have an optional default, e.g. '[foo = 42]'
- if (parseOptionalToken(59 /* EqualsToken */)) {
+ if (parseOptionalToken(60 /* EqualsToken */)) {
parseExpression();
}
parseExpected(23 /* CloseBracketToken */);
@@ -22492,9 +22664,9 @@
}
function isObjectOrObjectArrayTypeReference(node) {
switch (node.kind) {
- case 136 /* ObjectKeyword */:
+ case 137 /* ObjectKeyword */:
return true;
- case 169 /* ArrayType */:
+ case 170 /* ArrayType */:
return isObjectOrObjectArrayTypeReference(node.elementType);
default:
return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText === "Object";
@@ -22510,8 +22682,8 @@
typeExpression = tryParseTypeExpression();
}
var result = target === 1 /* Property */ ?
- createNode(310 /* JSDocPropertyTag */, start) :
- createNode(304 /* JSDocParameterTag */, start);
+ createNode(311 /* JSDocPropertyTag */, start) :
+ createNode(305 /* JSDocParameterTag */, start);
var comment = parseTagComments(indent + scanner.getStartPos() - start);
var nestedTypeLiteral = target !== 4 /* CallbackParameter */ && parseNestedTypeLiteral(typeExpression, name, target, indent);
if (nestedTypeLiteral) {
@@ -22528,20 +22700,20 @@
}
function parseNestedTypeLiteral(typeExpression, name, target, indent) {
if (typeExpression && isObjectOrObjectArrayTypeReference(typeExpression.type)) {
- var typeLiteralExpression = createNode(288 /* JSDocTypeExpression */, scanner.getTokenPos());
+ var typeLiteralExpression = createNode(289 /* JSDocTypeExpression */, scanner.getTokenPos());
var child = void 0;
var jsdocTypeLiteral = void 0;
var start_2 = scanner.getStartPos();
var children = void 0;
while (child = tryParse(function () { return parseChildParameterOrPropertyTag(target, indent, name); })) {
- if (child.kind === 304 /* JSDocParameterTag */ || child.kind === 310 /* JSDocPropertyTag */) {
+ if (child.kind === 305 /* JSDocParameterTag */ || child.kind === 311 /* JSDocPropertyTag */) {
children = ts.append(children, child);
}
}
if (children) {
- jsdocTypeLiteral = createNode(297 /* JSDocTypeLiteral */, start_2);
+ jsdocTypeLiteral = createNode(298 /* JSDocTypeLiteral */, start_2);
jsdocTypeLiteral.jsDocPropertyTags = children;
- if (typeExpression.type.kind === 169 /* ArrayType */) {
+ if (typeExpression.type.kind === 170 /* ArrayType */) {
jsdocTypeLiteral.isArrayType = true;
}
typeLiteralExpression.type = finishNode(jsdocTypeLiteral);
@@ -22550,32 +22722,32 @@
}
}
function parseReturnTag(start, tagName) {
- if (ts.forEach(tags, function (t) { return t.kind === 305 /* JSDocReturnTag */; })) {
+ if (ts.some(tags, ts.isJSDocReturnTag)) {
parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText);
}
- var result = createNode(305 /* JSDocReturnTag */, start);
+ var result = createNode(306 /* JSDocReturnTag */, start);
result.tagName = tagName;
result.typeExpression = tryParseTypeExpression();
return finishNode(result);
}
function parseTypeTag(start, tagName) {
- if (ts.forEach(tags, function (t) { return t.kind === 307 /* JSDocTypeTag */; })) {
+ if (ts.some(tags, ts.isJSDocTypeTag)) {
parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText);
}
- var result = createNode(307 /* JSDocTypeTag */, start);
+ var result = createNode(308 /* JSDocTypeTag */, start);
result.tagName = tagName;
result.typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true);
return finishNode(result);
}
function parseAugmentsTag(start, tagName) {
- var result = createNode(300 /* JSDocAugmentsTag */, start);
+ var result = createNode(301 /* JSDocAugmentsTag */, start);
result.tagName = tagName;
result.class = parseExpressionWithTypeArgumentsForAugments();
return finishNode(result);
}
function parseExpressionWithTypeArgumentsForAugments() {
var usedBrace = parseOptional(18 /* OpenBraceToken */);
- var node = createNode(211 /* ExpressionWithTypeArguments */);
+ var node = createNode(212 /* ExpressionWithTypeArguments */);
node.expression = parsePropertyAccessEntityNameExpression();
node.typeArguments = tryParseTypeArguments();
var res = finishNode(node);
@@ -22587,7 +22759,7 @@
function parsePropertyAccessEntityNameExpression() {
var node = parseJSDocIdentifierName();
while (parseOptional(24 /* DotToken */)) {
- var prop = createNode(189 /* PropertyAccessExpression */, node.pos);
+ var prop = createNode(190 /* PropertyAccessExpression */, node.pos);
prop.expression = node;
prop.name = parseJSDocIdentifierName();
node = finishNode(prop);
@@ -22595,19 +22767,19 @@
return node;
}
function parseClassTag(start, tagName) {
- var tag = createNode(301 /* JSDocClassTag */, start);
+ var tag = createNode(302 /* JSDocClassTag */, start);
tag.tagName = tagName;
return finishNode(tag);
}
function parseThisTag(start, tagName) {
- var tag = createNode(306 /* JSDocThisTag */, start);
+ var tag = createNode(307 /* JSDocThisTag */, start);
tag.tagName = tagName;
tag.typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true);
skipWhitespace();
return finishNode(tag);
}
function parseEnumTag(start, tagName) {
- var tag = createNode(303 /* JSDocEnumTag */, start);
+ var tag = createNode(304 /* JSDocEnumTag */, start);
tag.tagName = tagName;
tag.typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true);
skipWhitespace();
@@ -22616,7 +22788,7 @@
function parseTypedefTag(start, tagName, indent) {
var typeExpression = tryParseTypeExpression();
skipWhitespaceOrAsterisk();
- var typedefTag = createNode(309 /* JSDocTypedefTag */, start);
+ var typedefTag = createNode(310 /* JSDocTypedefTag */, start);
typedefTag.tagName = tagName;
typedefTag.fullName = parseJSDocTypeNameWithNamespace();
typedefTag.name = getJSDocTypeAliasName(typedefTag.fullName);
@@ -22630,9 +22802,9 @@
var childTypeTag = void 0;
while (child = tryParse(function () { return parseChildPropertyTag(indent); })) {
if (!jsdocTypeLiteral) {
- jsdocTypeLiteral = createNode(297 /* JSDocTypeLiteral */, start);
+ jsdocTypeLiteral = createNode(298 /* JSDocTypeLiteral */, start);
}
- if (child.kind === 307 /* JSDocTypeTag */) {
+ if (child.kind === 308 /* JSDocTypeTag */) {
if (childTypeTag) {
break;
}
@@ -22645,7 +22817,7 @@
}
}
if (jsdocTypeLiteral) {
- if (typeExpression && typeExpression.type.kind === 169 /* ArrayType */) {
+ if (typeExpression && typeExpression.type.kind === 170 /* ArrayType */) {
jsdocTypeLiteral.isArrayType = true;
}
typedefTag.typeExpression = childTypeTag && childTypeTag.typeExpression && !isObjectOrObjectArrayTypeReference(childTypeTag.typeExpression.type) ?
@@ -22664,7 +22836,7 @@
}
var typeNameOrNamespaceName = parseJSDocIdentifierName();
if (parseOptional(24 /* DotToken */)) {
- var jsDocNamespaceNode = createNode(244 /* ModuleDeclaration */, pos);
+ var jsDocNamespaceNode = createNode(245 /* ModuleDeclaration */, pos);
if (nested) {
jsDocNamespaceNode.flags |= 4 /* NestedNamespace */;
}
@@ -22678,14 +22850,14 @@
return typeNameOrNamespaceName;
}
function parseCallbackTag(start, tagName, indent) {
- var callbackTag = createNode(302 /* JSDocCallbackTag */, start);
+ var callbackTag = createNode(303 /* JSDocCallbackTag */, start);
callbackTag.tagName = tagName;
callbackTag.fullName = parseJSDocTypeNameWithNamespace();
callbackTag.name = getJSDocTypeAliasName(callbackTag.fullName);
skipWhitespace();
callbackTag.comment = parseTagComments(indent);
var child;
- var jsdocSignature = createNode(298 /* JSDocSignature */, start);
+ var jsdocSignature = createNode(299 /* JSDocSignature */, start);
jsdocSignature.parameters = [];
while (child = tryParse(function () { return parseChildParameterOrPropertyTag(4 /* CallbackParameter */, indent); })) {
jsdocSignature.parameters = ts.append(jsdocSignature.parameters, child);
@@ -22693,7 +22865,7 @@
var returnTag = tryParse(function () {
if (parseOptionalJsdoc(58 /* AtToken */)) {
var tag = parseTag(indent);
- if (tag && tag.kind === 305 /* JSDocReturnTag */) {
+ if (tag && tag.kind === 306 /* JSDocReturnTag */) {
return tag;
}
}
@@ -22734,11 +22906,11 @@
var canParseTag = true;
var seenAsterisk = false;
while (true) {
- switch (nextJSDocToken()) {
+ switch (nextTokenJSDoc()) {
case 58 /* AtToken */:
if (canParseTag) {
var child = tryParseChildTag(target, indent);
- if (child && (child.kind === 304 /* JSDocParameterTag */ || child.kind === 310 /* JSDocPropertyTag */) &&
+ if (child && (child.kind === 305 /* JSDocParameterTag */ || child.kind === 311 /* JSDocPropertyTag */) &&
target !== 4 /* CallbackParameter */ &&
name && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) {
return false;
@@ -22757,7 +22929,7 @@
}
seenAsterisk = true;
break;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
canParseTag = false;
break;
case 1 /* EndOfFileToken */:
@@ -22768,7 +22940,7 @@
function tryParseChildTag(target, indent) {
ts.Debug.assert(token() === 58 /* AtToken */);
var start = scanner.getStartPos();
- nextJSDocToken();
+ nextTokenJSDoc();
var tagName = parseJSDocIdentifierName();
skipWhitespace();
var t;
@@ -22802,25 +22974,22 @@
var typeParametersPos = getNodePos();
do {
skipWhitespace();
- var typeParameter = createNode(150 /* TypeParameter */);
+ var typeParameter = createNode(151 /* TypeParameter */);
typeParameter.name = parseJSDocIdentifierName(ts.Diagnostics.Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces);
finishNode(typeParameter);
skipWhitespace();
typeParameters.push(typeParameter);
} while (parseOptionalJsdoc(27 /* CommaToken */));
- var result = createNode(308 /* JSDocTemplateTag */, start);
+ var result = createNode(309 /* JSDocTemplateTag */, start);
result.tagName = tagName;
result.constraint = constraint;
result.typeParameters = createNodeArray(typeParameters, typeParametersPos);
finishNode(result);
return result;
}
- function nextJSDocToken() {
- return currentToken = scanner.scanJSDocToken();
- }
function parseOptionalJsdoc(t) {
if (token() === t) {
- nextJSDocToken();
+ nextTokenJSDoc();
return true;
}
return false;
@@ -22844,14 +23013,14 @@
}
function parseJSDocIdentifierName(message) {
if (!ts.tokenIsIdentifierOrKeyword(token())) {
- return createMissingNode(72 /* Identifier */, /*reportAtCurrentPosition*/ !message, message || ts.Diagnostics.Identifier_expected);
+ return createMissingNode(73 /* Identifier */, /*reportAtCurrentPosition*/ !message, message || ts.Diagnostics.Identifier_expected);
}
var pos = scanner.getTokenPos();
var end = scanner.getTextPos();
- var result = createNode(72 /* Identifier */, pos);
+ var result = createNode(73 /* Identifier */, pos);
result.escapedText = ts.escapeLeadingUnderscores(scanner.getTokenText());
finishNode(result, end);
- nextJSDocToken();
+ nextTokenJSDoc();
return result;
}
}
@@ -22976,7 +23145,7 @@
switch (node.kind) {
case 10 /* StringLiteral */:
case 8 /* NumericLiteral */:
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return true;
}
return false;
@@ -23343,28 +23512,16 @@
ts.isDeclarationFileName = isDeclarationFileName;
/*@internal*/
function processCommentPragmas(context, sourceText) {
- var triviaScanner = ts.createScanner(context.languageVersion, /*skipTrivia*/ false, 0 /* Standard */, sourceText);
var pragmas = [];
- // Keep scanning all the leading trivia in the file until we get to something that
- // isn't trivia. Any single line comment will be analyzed to see if it is a
- // reference comment.
- while (true) {
- var kind = triviaScanner.scan();
- if (!ts.isTrivia(kind)) {
- break;
- }
- var range = {
- kind: triviaScanner.getToken(),
- pos: triviaScanner.getTokenPos(),
- end: triviaScanner.getTextPos(),
- };
+ for (var _i = 0, _a = ts.getLeadingCommentRanges(sourceText, 0) || ts.emptyArray; _i < _a.length; _i++) {
+ var range = _a[_i];
var comment = sourceText.substring(range.pos, range.end);
extractPragmas(pragmas, range, comment);
}
context.pragmas = ts.createMap();
- for (var _i = 0, pragmas_1 = pragmas; _i < pragmas_1.length; _i++) {
- var pragma = pragmas_1[_i];
- if (context.pragmas.has(pragma.name)) { // TODO: GH#18217
+ for (var _b = 0, pragmas_1 = pragmas; _b < pragmas_1.length; _b++) {
+ var pragma = pragmas_1[_b];
+ if (context.pragmas.has(pragma.name)) {
var currentValue = context.pragmas.get(pragma.name);
if (currentValue instanceof Array) {
currentValue.push(pragma.args);
@@ -23395,7 +23552,6 @@
var typeReferenceDirectives_1 = context.typeReferenceDirectives;
var libReferenceDirectives_1 = context.libReferenceDirectives;
ts.forEach(ts.toArray(entryOrList), function (arg) {
- // TODO: GH#18217
var _a = arg.arguments, types = _a.types, lib = _a.lib, path = _a.path;
if (arg.arguments["no-default-lib"]) {
context.hasNoDefaultLib = true;
@@ -23416,7 +23572,7 @@
break;
}
case "amd-dependency": {
- context.amdDependencies = ts.map(ts.toArray(entryOrList), function (x) { return ({ name: x.arguments.name, path: x.arguments.path }); }); // TODO: GH#18217
+ context.amdDependencies = ts.map(ts.toArray(entryOrList), function (x) { return ({ name: x.arguments.name, path: x.arguments.path }); });
break;
}
case "amd-module": {
@@ -23439,7 +23595,7 @@
case "ts-check": {
// _last_ of either nocheck or check in a file is the "winner"
ts.forEach(ts.toArray(entryOrList), function (entry) {
- if (!context.checkJsDirective || entry.range.pos > context.checkJsDirective.pos) { // TODO: GH#18217
+ if (!context.checkJsDirective || entry.range.pos > context.checkJsDirective.pos) {
context.checkJsDirective = {
enabled: key === "ts-check",
end: entry.range.end,
@@ -23555,10 +23711,10 @@
if (lhs.kind !== rhs.kind) {
return false;
}
- if (lhs.kind === 72 /* Identifier */) {
+ if (lhs.kind === 73 /* Identifier */) {
return lhs.escapedText === rhs.escapedText;
}
- if (lhs.kind === 100 /* ThisKeyword */) {
+ if (lhs.kind === 101 /* ThisKeyword */) {
return true;
}
// If we are at this statement then we must have PropertyAccessExpression and because tag name in Jsx element can only
@@ -23587,6 +23743,7 @@
["es2017", "lib.es2017.d.ts"],
["es2018", "lib.es2018.d.ts"],
["es2019", "lib.es2019.d.ts"],
+ ["es2020", "lib.es2020.d.ts"],
["esnext", "lib.esnext.d.ts"],
// Host only
["dom", "lib.dom.d.ts"],
@@ -23615,8 +23772,11 @@
["es2018.promise", "lib.es2018.promise.d.ts"],
["es2018.regexp", "lib.es2018.regexp.d.ts"],
["es2019.array", "lib.es2019.array.d.ts"],
+ ["es2019.object", "lib.es2019.object.d.ts"],
["es2019.string", "lib.es2019.string.d.ts"],
["es2019.symbol", "lib.es2019.symbol.d.ts"],
+ ["es2020.string", "lib.es2020.string.d.ts"],
+ ["es2020.symbol.wellknown", "lib.es2020.symbol.wellknown.d.ts"],
["esnext.array", "lib.es2019.array.d.ts"],
["esnext.symbol", "lib.es2019.symbol.d.ts"],
["esnext.asynciterable", "lib.es2018.asynciterable.d.ts"],
@@ -23703,6 +23863,13 @@
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Show_verbose_diagnostic_information
},
+ {
+ name: "incremental",
+ shortName: "i",
+ type: "boolean",
+ category: ts.Diagnostics.Basic_Options,
+ description: ts.Diagnostics.Enable_incremental_compilation,
+ },
];
/* @internal */
ts.optionDeclarations = ts.commonOptionsWithBuild.concat([
@@ -23766,10 +23933,12 @@
es2017: 4 /* ES2017 */,
es2018: 5 /* ES2018 */,
es2019: 6 /* ES2019 */,
- esnext: 7 /* ESNext */,
+ es2020: 7 /* ES2020 */,
+ esnext: 8 /* ESNext */,
}),
affectsSourceFile: true,
affectsModuleResolution: true,
+ affectsEmit: true,
paramType: ts.Diagnostics.VERSION,
showInSimplifiedHelpView: true,
category: ts.Diagnostics.Basic_Options,
@@ -23837,6 +24006,7 @@
name: "declaration",
shortName: "d",
type: "boolean",
+ affectsEmit: true,
showInSimplifiedHelpView: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Generates_corresponding_d_ts_file,
@@ -23844,6 +24014,7 @@
{
name: "declarationMap",
type: "boolean",
+ affectsEmit: true,
showInSimplifiedHelpView: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Generates_a_sourcemap_for_each_corresponding_d_ts_file,
@@ -23851,12 +24022,14 @@
{
name: "emitDeclarationOnly",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Only_emit_d_ts_declaration_files,
},
{
name: "sourceMap",
type: "boolean",
+ affectsEmit: true,
showInSimplifiedHelpView: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Generates_corresponding_map_file,
@@ -23864,6 +24037,7 @@
{
name: "outFile",
type: "string",
+ affectsEmit: true,
isFilePath: true,
paramType: ts.Diagnostics.FILE,
showInSimplifiedHelpView: true,
@@ -23873,6 +24047,7 @@
{
name: "outDir",
type: "string",
+ affectsEmit: true,
isFilePath: true,
paramType: ts.Diagnostics.DIRECTORY,
showInSimplifiedHelpView: true,
@@ -23882,6 +24057,7 @@
{
name: "rootDir",
type: "string",
+ affectsEmit: true,
isFilePath: true,
paramType: ts.Diagnostics.LOCATION,
category: ts.Diagnostics.Basic_Options,
@@ -23890,29 +24066,24 @@
{
name: "composite",
type: "boolean",
+ affectsEmit: true,
isTSConfigOnly: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Enable_project_compilation,
},
{
- name: "incremental",
- type: "boolean",
- isTSConfigOnly: true,
- category: ts.Diagnostics.Basic_Options,
- description: ts.Diagnostics.Enable_incremental_compilation,
- },
- {
name: "tsBuildInfoFile",
type: "string",
+ affectsEmit: true,
isFilePath: true,
paramType: ts.Diagnostics.FILE,
- isTSConfigOnly: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Specify_file_to_store_incremental_compilation_information,
},
{
name: "removeComments",
type: "boolean",
+ affectsEmit: true,
showInSimplifiedHelpView: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Do_not_emit_comments_to_output,
@@ -23920,6 +24091,7 @@
{
name: "noEmit",
type: "boolean",
+ affectsEmit: true,
showInSimplifiedHelpView: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Do_not_emit_outputs,
@@ -23927,12 +24099,14 @@
{
name: "importHelpers",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Import_emit_helpers_from_tslib
},
{
name: "downlevelIteration",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3
},
@@ -24136,10 +24310,18 @@
category: ts.Diagnostics.Module_Resolution_Options,
description: ts.Diagnostics.Do_not_resolve_the_real_path_of_symlinks,
},
+ {
+ name: "allowUmdGlobalAccess",
+ type: "boolean",
+ affectsSemanticDiagnostics: true,
+ category: ts.Diagnostics.Module_Resolution_Options,
+ description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
+ },
// Source Maps
{
name: "sourceRoot",
type: "string",
+ affectsEmit: true,
paramType: ts.Diagnostics.LOCATION,
category: ts.Diagnostics.Source_Map_Options,
description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations,
@@ -24147,6 +24329,7 @@
{
name: "mapRoot",
type: "string",
+ affectsEmit: true,
paramType: ts.Diagnostics.LOCATION,
category: ts.Diagnostics.Source_Map_Options,
description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
@@ -24154,12 +24337,14 @@
{
name: "inlineSourceMap",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Source_Map_Options,
description: ts.Diagnostics.Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file
},
{
name: "inlineSources",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Source_Map_Options,
description: ts.Diagnostics.Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap_to_be_set
},
@@ -24192,6 +24377,7 @@
{
name: "out",
type: "string",
+ affectsEmit: true,
isFilePath: false,
// for correct behaviour, please use outFile
category: ts.Diagnostics.Advanced_Options,
@@ -24201,6 +24387,7 @@
{
name: "reactNamespace",
type: "string",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react_JSX_emit
},
@@ -24219,6 +24406,7 @@
{
name: "emitBOM",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files
},
@@ -24234,6 +24422,7 @@
crlf: 0 /* CarriageReturnLineFeed */,
lf: 1 /* LineFeed */
}),
+ affectsEmit: true,
paramType: ts.Diagnostics.NEWLINE,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix,
@@ -24261,6 +24450,7 @@
{
name: "stripInternal",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation,
},
@@ -24281,24 +24471,28 @@
{
name: "noEmitHelpers",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Do_not_generate_custom_helper_functions_like_extends_in_compiled_output
},
{
name: "noEmitOnError",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported,
},
{
name: "preserveConstEnums",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code
},
{
name: "declarationDir",
type: "string",
+ affectsEmit: true,
isFilePath: true,
paramType: ts.Diagnostics.DIRECTORY,
category: ts.Diagnostics.Advanced_Options,
@@ -24381,6 +24575,8 @@
/* @internal */
ts.semanticDiagnosticsOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsSemanticDiagnostics; });
/* @internal */
+ ts.affectsEmitOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsEmit; });
+ /* @internal */
ts.moduleResolutionOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsModuleResolution; });
/* @internal */
ts.sourceFileAffectingCompilerOptions = ts.optionDeclarations.filter(function (option) {
@@ -24788,7 +24984,7 @@
/**
* Reads the config file, reports errors if any and exits if the config file cannot be found
*/
- function getParsedCommandLineOfConfigFile(configFileName, optionsToExtend, host) {
+ function getParsedCommandLineOfConfigFile(configFileName, optionsToExtend, host, extendedConfigCache) {
var configFileText;
try {
configFileText = host.readFile(configFileName);
@@ -24808,7 +25004,9 @@
result.path = ts.toPath(configFileName, cwd, ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames));
result.resolvedPath = result.path;
result.originalFileName = result.fileName;
- return parseJsonSourceFileConfigFileContent(result, host, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), cwd), optionsToExtend, ts.getNormalizedAbsolutePath(configFileName, cwd));
+ return parseJsonSourceFileConfigFileContent(result, host, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), cwd), optionsToExtend, ts.getNormalizedAbsolutePath(configFileName, cwd),
+ /*resolutionStack*/ undefined,
+ /*extraFileExtension*/ undefined, extendedConfigCache);
}
ts.getParsedCommandLineOfConfigFile = getParsedCommandLineOfConfigFile;
/**
@@ -24947,7 +25145,7 @@
var result = returnValue ? {} : undefined;
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var element = _a[_i];
- if (element.kind !== 275 /* PropertyAssignment */) {
+ if (element.kind !== 276 /* PropertyAssignment */) {
errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected));
continue;
}
@@ -25003,13 +25201,13 @@
}
function convertPropertyValueToJson(valueExpression, option) {
switch (valueExpression.kind) {
- case 102 /* TrueKeyword */:
+ case 103 /* TrueKeyword */:
reportInvalidOptionValue(option && option.type !== "boolean");
return true;
- case 87 /* FalseKeyword */:
+ case 88 /* FalseKeyword */:
reportInvalidOptionValue(option && option.type !== "boolean");
return false;
- case 96 /* NullKeyword */:
+ case 97 /* NullKeyword */:
reportInvalidOptionValue(option && option.name === "extends"); // "extends" is the only option we don't allow null/undefined for
return null; // tslint:disable-line:no-null-keyword
case 10 /* StringLiteral */:
@@ -25029,13 +25227,13 @@
case 8 /* NumericLiteral */:
reportInvalidOptionValue(option && option.type !== "number");
return Number(valueExpression.text);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
if (valueExpression.operator !== 39 /* MinusToken */ || valueExpression.operand.kind !== 8 /* NumericLiteral */) {
break; // not valid JSON syntax
}
reportInvalidOptionValue(option && option.type !== "number");
return -Number(valueExpression.operand.text);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
reportInvalidOptionValue(option && option.type !== "object");
var objectLiteralExpression = valueExpression;
// Currently having element option declaration in the tsconfig with type "object"
@@ -25052,7 +25250,7 @@
return convertObjectLiteralExpressionToJson(objectLiteralExpression, /* knownOptions*/ undefined,
/*extraKeyDiagnosticMessage */ undefined, /*parentOption*/ undefined);
}
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
reportInvalidOptionValue(option && option.type !== "list");
return convertArrayLiteralExpressionToJson(valueExpression.elements, option && option.element);
}
@@ -25308,8 +25506,8 @@
* @param basePath A root directory to resolve relative path entries in the config
* file to. e.g. outDir
*/
- function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) {
- return parseJsonConfigFileContentWorker(json, /*sourceFile*/ undefined, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions);
+ function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache) {
+ return parseJsonConfigFileContentWorker(json, /*sourceFile*/ undefined, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache);
}
ts.parseJsonConfigFileContent = parseJsonConfigFileContent;
/**
@@ -25319,8 +25517,8 @@
* @param basePath A root directory to resolve relative path entries in the config
* file to. e.g. outDir
*/
- function parseJsonSourceFileConfigFileContent(sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) {
- return parseJsonConfigFileContentWorker(/*json*/ undefined, sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions);
+ function parseJsonSourceFileConfigFileContent(sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache) {
+ return parseJsonConfigFileContentWorker(/*json*/ undefined, sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache);
}
ts.parseJsonSourceFileConfigFileContent = parseJsonSourceFileConfigFileContent;
/*@internal*/
@@ -25348,13 +25546,13 @@
* file to. e.g. outDir
* @param resolutionStack Only present for backwards-compatibility. Should be empty.
*/
- function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) {
+ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache) {
if (existingOptions === void 0) { existingOptions = {}; }
if (resolutionStack === void 0) { resolutionStack = []; }
if (extraFileExtensions === void 0) { extraFileExtensions = []; }
ts.Debug.assert((json === undefined && sourceFile !== undefined) || (json !== undefined && sourceFile === undefined));
var errors = [];
- var parsedConfig = parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors);
+ var parsedConfig = parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors, extendedConfigCache);
var raw = parsedConfig.raw;
var options = ts.extend(existingOptions, parsedConfig.options || {});
options.configFilePath = configFileName && ts.normalizeSlashes(configFileName);
@@ -25494,7 +25692,7 @@
* This *just* extracts options/include/exclude/files out of a config file.
* It does *not* resolve the included files.
*/
- function parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors) {
+ function parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors, extendedConfigCache) {
basePath = ts.normalizeSlashes(basePath);
var resolvedPath = ts.getNormalizedAbsolutePath(configFileName || "", basePath);
if (resolutionStack.indexOf(resolvedPath) >= 0) {
@@ -25507,7 +25705,7 @@
if (ownConfig.extendedConfigPath) {
// copy the resolution stack so it is never reused between branches in potential diamond-problem scenarios.
resolutionStack = resolutionStack.concat([resolvedPath]);
- var extendedConfig = getExtendedConfig(sourceFile, ownConfig.extendedConfigPath, host, basePath, resolutionStack, errors);
+ var extendedConfig = getExtendedConfig(sourceFile, ownConfig.extendedConfigPath, host, basePath, resolutionStack, errors, extendedConfigCache);
if (extendedConfig && isSuccessfulParsedTsconfig(extendedConfig)) {
var baseRaw_1 = extendedConfig.raw;
var raw_1 = ownConfig.raw;
@@ -25604,7 +25802,7 @@
if (!host.fileExists(extendedConfigPath) && !ts.endsWith(extendedConfigPath, ".json" /* Json */)) {
extendedConfigPath = extendedConfigPath + ".json";
if (!host.fileExists(extendedConfigPath)) {
- errors.push(createDiagnostic(ts.Diagnostics.File_0_does_not_exist, extendedConfig));
+ errors.push(createDiagnostic(ts.Diagnostics.File_0_not_found, extendedConfig));
return undefined;
}
}
@@ -25615,24 +25813,23 @@
if (resolved.resolvedModule) {
return resolved.resolvedModule.resolvedFileName;
}
- errors.push(createDiagnostic(ts.Diagnostics.File_0_does_not_exist, extendedConfig));
+ errors.push(createDiagnostic(ts.Diagnostics.File_0_not_found, extendedConfig));
return undefined;
}
- function getExtendedConfig(sourceFile, extendedConfigPath, host, basePath, resolutionStack, errors) {
+ function getExtendedConfig(sourceFile, extendedConfigPath, host, basePath, resolutionStack, errors, extendedConfigCache) {
var _a;
- var extendedResult = readJsonConfigFile(extendedConfigPath, function (path) { return host.readFile(path); });
- if (sourceFile) {
- sourceFile.extendedSourceFiles = [extendedResult.fileName];
- }
- if (extendedResult.parseDiagnostics.length) {
- errors.push.apply(errors, extendedResult.parseDiagnostics);
- return undefined;
+ var path = host.useCaseSensitiveFileNames ? extendedConfigPath : ts.toLowerCase(extendedConfigPath);
+ var value;
+ var extendedResult;
+ var extendedConfig;
+ if (extendedConfigCache && (value = extendedConfigCache.get(path))) {
+ (extendedResult = value.extendedResult, extendedConfig = value.extendedConfig);
}
+ else {
+ extendedResult = readJsonConfigFile(extendedConfigPath, function (path) { return host.readFile(path); });
+ if (!extendedResult.parseDiagnostics.length) {
var extendedDirname = ts.getDirectoryPath(extendedConfigPath);
- var extendedConfig = parseConfig(/*json*/ undefined, extendedResult, host, extendedDirname, ts.getBaseFileName(extendedConfigPath), resolutionStack, errors);
- if (sourceFile && extendedResult.extendedSourceFiles) {
- (_a = sourceFile.extendedSourceFiles).push.apply(_a, extendedResult.extendedSourceFiles);
- }
+ extendedConfig = parseConfig(/*json*/ undefined, extendedResult, host, extendedDirname, ts.getBaseFileName(extendedConfigPath), resolutionStack, errors, extendedConfigCache);
if (isSuccessfulParsedTsconfig(extendedConfig)) {
// Update the paths to reflect base path
var relativeDifference_1 = ts.convertToRelativePath(extendedDirname, basePath, ts.identity);
@@ -25647,6 +25844,21 @@
mapPropertiesInRawIfNotUndefined("exclude");
mapPropertiesInRawIfNotUndefined("files");
}
+ }
+ if (extendedConfigCache) {
+ extendedConfigCache.set(path, { extendedResult: extendedResult, extendedConfig: extendedConfig });
+ }
+ }
+ if (sourceFile) {
+ sourceFile.extendedSourceFiles = [extendedResult.fileName];
+ if (extendedResult.extendedSourceFiles) {
+ (_a = sourceFile.extendedSourceFiles).push.apply(_a, extendedResult.extendedSourceFiles);
+ }
+ }
+ if (extendedResult.parseDiagnostics.length) {
+ errors.push.apply(errors, extendedResult.parseDiagnostics);
+ return undefined;
+ }
return extendedConfig;
}
function convertCompileOnSaveOptionFromJson(jsonOption, basePath, errors) {
@@ -26116,11 +26328,22 @@
return !!compilerOptions.traceResolution && host.trace !== undefined;
}
ts.isTraceEnabled = isTraceEnabled;
- function withPackageId(packageId, r) {
+ function withPackageId(packageInfo, r) {
+ var packageId;
+ if (r && packageInfo) {
+ var packageJsonContent = packageInfo.packageJsonContent;
+ if (typeof packageJsonContent.name === "string" && typeof packageJsonContent.version === "string") {
+ packageId = {
+ name: packageJsonContent.name,
+ subModuleName: r.path.slice(packageInfo.packageDirectory.length + ts.directorySeparator.length),
+ version: packageJsonContent.version
+ };
+ }
+ }
return r && { path: r.path, extension: r.ext, packageId: packageId };
}
function noPackageId(r) {
- return withPackageId(/*packageId*/ undefined, r);
+ return withPackageId(/*packageInfo*/ undefined, r);
}
function removeIgnoredPackageId(r) {
if (r) {
@@ -26172,8 +26395,15 @@
}
function readPackageJsonPathField(jsonContent, fieldName, baseDirectory, state) {
var fileName = readPackageJsonField(jsonContent, fieldName, "string", state);
- if (fileName === undefined)
+ if (fileName === undefined) {
return;
+ }
+ if (!fileName) {
+ if (state.traceEnabled) {
+ trace(state.host, ts.Diagnostics.package_json_had_a_falsy_0_field, fieldName);
+ }
+ return;
+ }
var path = ts.normalizePath(ts.combinePaths(baseDirectory, fileName));
if (state.traceEnabled) {
trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, fileName, path);
@@ -26326,8 +26556,13 @@
var fileName = resolved.fileName, packageId = resolved.packageId;
var resolvedFileName = options.preserveSymlinks ? fileName : realPath(fileName, host, traceEnabled);
if (traceEnabled) {
+ if (packageId) {
+ trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3, typeReferenceDirectiveName, resolvedFileName, ts.packageIdToString(packageId), primary);
+ }
+ else {
trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolvedFileName, primary);
}
+ }
resolvedTypeReferenceDirective = { primary: primary, resolvedFileName: resolvedFileName, packageId: packageId, isExternalLibraryImport: pathContainsNodeModules(fileName) };
}
return { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations };
@@ -26428,20 +26663,28 @@
return result;
}
ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames;
- function createModuleResolutionCache(currentDirectory, getCanonicalFileName) {
- return createModuleResolutionCacheWithMaps(createCacheWithRedirects(), createCacheWithRedirects(), currentDirectory, getCanonicalFileName);
+ function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options) {
+ return createModuleResolutionCacheWithMaps(createCacheWithRedirects(options), createCacheWithRedirects(options), currentDirectory, getCanonicalFileName);
}
ts.createModuleResolutionCache = createModuleResolutionCache;
/*@internal*/
- function createCacheWithRedirects() {
+ function createCacheWithRedirects(options) {
var ownMap = ts.createMap();
var redirectsMap = ts.createMap();
return {
ownMap: ownMap,
redirectsMap: redirectsMap,
getOrCreateMapOfCacheRedirects: getOrCreateMapOfCacheRedirects,
- clear: clear
+ clear: clear,
+ setOwnOptions: setOwnOptions,
+ setOwnMap: setOwnMap
};
+ function setOwnOptions(newOptions) {
+ options = newOptions;
+ }
+ function setOwnMap(newOwnMap) {
+ ownMap = newOwnMap;
+ }
function getOrCreateMapOfCacheRedirects(redirectedReference) {
if (!redirectedReference) {
return ownMap;
@@ -26449,7 +26692,8 @@
var path = redirectedReference.sourceFile.path;
var redirects = redirectsMap.get(path);
if (!redirects) {
- redirects = ts.createMap();
+ // Reuse map if redirected reference map uses same resolution
+ redirects = !options || ts.optionsHaveModuleResolutionChanges(options, redirectedReference.commandLine.options) ? ts.createMap() : ownMap;
redirectsMap.set(path, redirects);
}
return redirects;
@@ -26462,7 +26706,7 @@
ts.createCacheWithRedirects = createCacheWithRedirects;
/*@internal*/
function createModuleResolutionCacheWithMaps(directoryToModuleNameMap, moduleNameToDirectoryMap, currentDirectory, getCanonicalFileName) {
- return { getOrCreateCacheForDirectory: getOrCreateCacheForDirectory, getOrCreateCacheForModuleName: getOrCreateCacheForModuleName };
+ return { getOrCreateCacheForDirectory: getOrCreateCacheForDirectory, getOrCreateCacheForModuleName: getOrCreateCacheForModuleName, directoryToModuleNameMap: directoryToModuleNameMap, moduleNameToDirectoryMap: moduleNameToDirectoryMap };
function getOrCreateCacheForDirectory(directoryName, redirectedReference) {
var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName);
return getOrCreateCache(directoryToModuleNameMap, redirectedReference, path, ts.createMap);
@@ -26605,8 +26849,13 @@
}
if (traceEnabled) {
if (result.resolvedModule) {
+ if (result.resolvedModule.packageId) {
+ trace(host, ts.Diagnostics.Module_name_0_was_successfully_resolved_to_1_with_Package_ID_2, moduleName, result.resolvedModule.resolvedFileName, ts.packageIdToString(result.resolvedModule.packageId));
+ }
+ else {
trace(host, ts.Diagnostics.Module_name_0_was_successfully_resolved_to_1, moduleName, result.resolvedModule.resolvedFileName);
}
+ }
else {
trace(host, ts.Diagnostics.Module_name_0_was_not_resolved, moduleName);
}
@@ -26875,10 +27124,9 @@
}
var resolvedFromFile = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state);
if (resolvedFromFile) {
- var nm = considerPackageJson ? parseNodeModuleFromPath(resolvedFromFile) : undefined;
- var packageInfo = nm && getPackageJsonInfo(nm.packageDirectory, nm.subModuleName, /*onlyRecordFailures*/ false, state);
- var packageId = packageInfo && packageInfo.packageId;
- return withPackageId(packageId, resolvedFromFile);
+ var packageDirectory = considerPackageJson ? parseNodeModuleFromPath(resolvedFromFile) : undefined;
+ var packageInfo = packageDirectory ? getPackageJsonInfo(packageDirectory, /*onlyRecordFailures*/ false, state) : undefined;
+ return withPackageId(packageInfo, resolvedFromFile);
}
}
if (!onlyRecordFailures) {
@@ -26904,11 +27152,10 @@
* (Not neeeded for `loadModuleFromNodeModules` as that looks up the `package.json` as part of resolution.)
*
* packageDirectory is the directory of the package itself.
- * subModuleName is the path within the package.
- * For `blah/node_modules/foo/index.d.ts` this is { packageDirectory: "foo", subModuleName: "index.d.ts" }. (Part before "/node_modules/" is ignored.)
- * For `/node_modules/foo/bar.d.ts` this is { packageDirectory: "foo", subModuleName": "bar/index.d.ts" }.
- * For `/node_modules/@types/foo/bar/index.d.ts` this is { packageDirectory: "@types/foo", subModuleName: "bar/index.d.ts" }.
- * For `/node_modules/foo/bar/index.d.ts` this is { packageDirectory: "foo", subModuleName": "bar/index.d.ts" }.
+ * For `blah/node_modules/foo/index.d.ts` this is packageDirectory: "foo"
+ * For `/node_modules/foo/bar.d.ts` this is packageDirectory: "foo"
+ * For `/node_modules/@types/foo/bar/index.d.ts` this is packageDirectory: "@types/foo"
+ * For `/node_modules/foo/bar/index.d.ts` this is packageDirectory: "foo"
*/
function parseNodeModuleFromPath(resolved) {
var path = ts.normalizePath(resolved.path);
@@ -26921,26 +27168,12 @@
if (path.charCodeAt(indexAfterNodeModules) === 64 /* at */) {
indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterPackageName);
}
- var packageDirectory = path.slice(0, indexAfterPackageName);
- var subModuleName = ts.removeExtension(path.slice(indexAfterPackageName + 1), resolved.ext) + ".d.ts" /* Dts */;
- return { packageDirectory: packageDirectory, subModuleName: subModuleName };
+ return path.slice(0, indexAfterPackageName);
}
function moveToNextDirectorySeparatorIfAvailable(path, prevSeparatorIndex) {
var nextSeparatorIndex = path.indexOf(ts.directorySeparator, prevSeparatorIndex + 1);
return nextSeparatorIndex === -1 ? prevSeparatorIndex : nextSeparatorIndex;
}
- function addExtensionAndIndex(path) {
- if (path === "") {
- return "index.d.ts";
- }
- if (ts.endsWith(path, ".d.ts")) {
- return path;
- }
- if (path === "index" || ts.endsWith(path, "/index")) {
- return path + ".d.ts";
- }
- return path + "/index.d.ts";
- }
function loadModuleFromFileNoPackageId(extensions, candidate, onlyRecordFailures, state) {
return noPackageId(loadModuleFromFile(extensions, candidate, onlyRecordFailures, state));
}
@@ -27014,52 +27247,22 @@
}
function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson) {
if (considerPackageJson === void 0) { considerPackageJson = true; }
- var packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, "", onlyRecordFailures, state) : undefined;
- var packageId = packageInfo && packageInfo.packageId;
+ var packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, onlyRecordFailures, state) : undefined;
var packageJsonContent = packageInfo && packageInfo.packageJsonContent;
- var versionPaths = packageJsonContent && readPackageJsonTypesVersionPaths(packageJsonContent, state);
- return withPackageId(packageId, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths));
+ var versionPaths = packageInfo && packageInfo.versionPaths;
+ return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths));
}
- function getPackageJsonInfo(packageDirectory, subModuleName, onlyRecordFailures, state) {
+ function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
var host = state.host, traceEnabled = state.traceEnabled;
var directoryExists = !onlyRecordFailures && ts.directoryProbablyExists(packageDirectory, host);
var packageJsonPath = ts.combinePaths(packageDirectory, "package.json");
if (directoryExists && host.fileExists(packageJsonPath)) {
var packageJsonContent = ts.readJson(packageJsonPath, host);
- if (subModuleName === "") { // looking up the root - need to handle types/typings/main redirects for subModuleName
- var path = readPackageJsonTypesFields(packageJsonContent, packageDirectory, state);
- if (typeof path === "string") {
- subModuleName = addExtensionAndIndex(path.substring(packageDirectory.length + 1));
- }
- else {
- var jsPath = readPackageJsonMainField(packageJsonContent, packageDirectory, state);
- if (typeof jsPath === "string" && jsPath.length > packageDirectory.length) {
- var potentialSubModule_1 = jsPath.substring(packageDirectory.length + 1);
- subModuleName = (ts.forEach(ts.supportedJSExtensions, function (extension) {
- return ts.tryRemoveExtension(potentialSubModule_1, extension);
- }) || potentialSubModule_1) + ".d.ts" /* Dts */;
- }
- else {
- subModuleName = "index.d.ts";
- }
- }
- }
- if (!ts.endsWith(subModuleName, ".d.ts" /* Dts */)) {
- subModuleName = addExtensionAndIndex(subModuleName);
- }
- var versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state);
- var packageId = typeof packageJsonContent.name === "string" && typeof packageJsonContent.version === "string"
- ? { name: packageJsonContent.name, subModuleName: subModuleName, version: packageJsonContent.version }
- : undefined;
if (traceEnabled) {
- if (packageId) {
- trace(host, ts.Diagnostics.Found_package_json_at_0_Package_ID_is_1, packageJsonPath, ts.packageIdToString(packageId));
- }
- else {
trace(host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath);
}
- }
- return { packageJsonContent: packageJsonContent, packageId: packageId, versionPaths: versionPaths };
+ var versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state);
+ return { packageDirectory: packageDirectory, packageJsonContent: packageJsonContent, versionPaths: versionPaths };
}
else {
if (directoryExists && traceEnabled) {
@@ -27198,37 +27401,31 @@
function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state) {
var candidate = ts.normalizePath(ts.combinePaths(nodeModulesDirectory, moduleName));
// First look for a nested package.json, as in `node_modules/foo/bar/package.json`.
- var packageJsonContent;
- var packageId;
- var versionPaths;
- var packageInfo = getPackageJsonInfo(candidate, "", !nodeModulesDirectoryExists, state);
+ var packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state);
if (packageInfo) {
- (packageJsonContent = packageInfo.packageJsonContent, packageId = packageInfo.packageId, versionPaths = packageInfo.versionPaths);
var fromFile = loadModuleFromFile(extensions, candidate, !nodeModulesDirectoryExists, state);
if (fromFile) {
return noPackageId(fromFile);
}
- var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageJsonContent, versionPaths);
- return withPackageId(packageId, fromDirectory);
+ var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageInfo.packageJsonContent, packageInfo.versionPaths);
+ return withPackageId(packageInfo, fromDirectory);
}
var loader = function (extensions, candidate, onlyRecordFailures, state) {
var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) ||
- loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths);
- return withPackageId(packageId, pathAndExtension);
+ loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.packageJsonContent, packageInfo && packageInfo.versionPaths);
+ return withPackageId(packageInfo, pathAndExtension);
};
var _a = parsePackageName(moduleName), packageName = _a.packageName, rest = _a.rest;
if (rest !== "") { // If "rest" is empty, we just did this search above.
var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName);
// Don't use a "types" or "main" from here because we're not loading the root, but a subdirectory -- just here for the packageId and path mappings.
- var packageInfo_1 = getPackageJsonInfo(packageDirectory, rest, !nodeModulesDirectoryExists, state);
- if (packageInfo_1)
- (packageId = packageInfo_1.packageId, versionPaths = packageInfo_1.versionPaths);
- if (versionPaths) {
+ packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state);
+ if (packageInfo && packageInfo.versionPaths) {
if (state.traceEnabled) {
- trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, versionPaths.version, ts.version, rest);
+ trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.versionPaths.version, ts.version, rest);
}
var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host);
- var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, versionPaths.paths, loader, !packageDirectoryExists, state);
+ var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.versionPaths.paths, loader, !packageDirectoryExists, state);
if (fromPaths) {
return fromPaths.value;
}
@@ -27396,24 +27593,24 @@
// A module is uninstantiated if it contains only
switch (node.kind) {
// 1. interface declarations, type alias declarations
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return 0 /* NonInstantiated */;
// 2. const enum declarations
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
if (ts.isEnumConst(node)) {
return 2 /* ConstEnumOnly */;
}
break;
// 3. non-exported import declarations
- case 249 /* ImportDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
if (!(ts.hasModifier(node, 1 /* Export */))) {
return 0 /* NonInstantiated */;
}
break;
// 4. other uninstantiated module declarations.
- case 245 /* ModuleBlock */: {
+ case 246 /* ModuleBlock */: {
var state_1 = 0 /* NonInstantiated */;
ts.forEachChild(node, function (n) {
var childState = getModuleInstanceStateWorker(n);
@@ -27435,9 +27632,9 @@
});
return state_1;
}
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return getModuleInstanceState(node);
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
// Only jsdoc typedef definition can exist in jsdoc namespace, and it should
// be considered the same as type alias
if (node.isInJSDocNamespace) {
@@ -27603,7 +27800,7 @@
// Should not be called on a declaration with a computed property name,
// unless it is a well known Symbol.
function getDeclarationName(node) {
- if (node.kind === 254 /* ExportAssignment */) {
+ if (node.kind === 255 /* ExportAssignment */) {
return node.isExportEquals ? "export=" /* ExportEquals */ : "default" /* Default */;
}
var name = ts.getNameOfDeclaration(node);
@@ -27612,7 +27809,7 @@
var moduleName = ts.getTextOfIdentifierOrLiteral(name);
return (ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + moduleName + "\"");
}
- if (name.kind === 149 /* ComputedPropertyName */) {
+ if (name.kind === 150 /* ComputedPropertyName */) {
var nameExpression = name.expression;
// treat computed property names where expression is string/numeric literal as just string/numeric literal
if (ts.isStringOrNumericLiteralLike(nameExpression)) {
@@ -27624,36 +27821,36 @@
return ts.isPropertyNameLiteral(name) ? ts.getEscapedTextOfIdentifierOrLiteral(name) : undefined;
}
switch (node.kind) {
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return "__constructor" /* Constructor */;
- case 165 /* FunctionType */:
- case 160 /* CallSignature */:
- case 298 /* JSDocSignature */:
+ case 166 /* FunctionType */:
+ case 161 /* CallSignature */:
+ case 299 /* JSDocSignature */:
return "__call" /* Call */;
- case 166 /* ConstructorType */:
- case 161 /* ConstructSignature */:
+ case 167 /* ConstructorType */:
+ case 162 /* ConstructSignature */:
return "__new" /* New */;
- case 162 /* IndexSignature */:
+ case 163 /* IndexSignature */:
return "__index" /* Index */;
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return "__export" /* ExportStar */;
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
// json file should behave as
// module.exports = ...
return "export=" /* ExportEquals */;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
if (ts.getAssignmentDeclarationKind(node) === 2 /* ModuleExports */) {
// module.exports = ...
return "export=" /* ExportEquals */;
}
ts.Debug.fail("Unknown binary declaration kind");
break;
- case 294 /* JSDocFunctionType */:
+ case 295 /* JSDocFunctionType */:
return (ts.isJSDocConstructSignature(node) ? "__new" /* New */ : "__call" /* Call */);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
// Parameters with names are handled at the top of this function. Parameters
// without names can only come from JSDocFunctionTypes.
- ts.Debug.assert(node.parent.kind === 294 /* JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: " + (ts.SyntaxKind ? ts.SyntaxKind[node.parent.kind] : node.parent.kind) + ", expected JSDocFunctionType"; });
+ ts.Debug.assert(node.parent.kind === 295 /* JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: " + (ts.SyntaxKind ? ts.SyntaxKind[node.parent.kind] : node.parent.kind) + ", expected JSDocFunctionType"; });
var functionType = node.parent;
var index = functionType.parameters.indexOf(node);
return "arg" + index;
@@ -27753,7 +27950,7 @@
// 1. multiple export default of class declaration or function declaration by checking NodeFlags.Default
// 2. multiple export default of export assignment. This one doesn't have NodeFlags.Default on (as export default doesn't considered as modifiers)
if (symbol.declarations && symbol.declarations.length &&
- (node.kind === 254 /* ExportAssignment */ && !node.isExportEquals)) {
+ (node.kind === 255 /* ExportAssignment */ && !node.isExportEquals)) {
message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports;
messageNeedsName_1 = false;
multipleDefaultExports_1 = true;
@@ -27788,7 +27985,7 @@
function declareModuleMember(node, symbolFlags, symbolExcludes) {
var hasExportModifier = ts.getCombinedModifierFlags(node) & 1 /* Export */;
if (symbolFlags & 2097152 /* Alias */) {
- if (node.kind === 257 /* ExportSpecifier */ || (node.kind === 248 /* ImportEqualsDeclaration */ && hasExportModifier)) {
+ if (node.kind === 258 /* ExportSpecifier */ || (node.kind === 249 /* ImportEqualsDeclaration */ && hasExportModifier)) {
return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
}
else {
@@ -27855,7 +28052,7 @@
// for it. We must clear this so we don't accidentally move any stale data forward from
// a previous compilation.
if (containerFlags & 1 /* IsContainer */) {
- if (node.kind !== 197 /* ArrowFunction */) {
+ if (node.kind !== 198 /* ArrowFunction */) {
thisParentContainer = container;
}
container = blockScopeContainer = node;
@@ -27888,7 +28085,7 @@
}
// We create a return control flow graph for IIFEs and constructors. For constructors
// we use the return control flow graph in strict property initialization checks.
- currentReturnTarget = isIIFE || node.kind === 157 /* Constructor */ ? createBranchLabel() : undefined;
+ currentReturnTarget = isIIFE || node.kind === 158 /* Constructor */ ? createBranchLabel() : undefined;
currentBreakTarget = undefined;
currentContinueTarget = undefined;
activeLabels = undefined;
@@ -27902,13 +28099,13 @@
if (hasExplicitReturn)
node.flags |= 256 /* HasExplicitReturn */;
}
- if (node.kind === 284 /* SourceFile */) {
+ if (node.kind === 285 /* SourceFile */) {
node.flags |= emitFlags;
}
if (currentReturnTarget) {
addAntecedent(currentReturnTarget, currentFlow);
currentFlow = finishFlowLabel(currentReturnTarget);
- if (node.kind === 157 /* Constructor */) {
+ if (node.kind === 158 /* Constructor */) {
node.returnFlowNode = currentFlow;
}
}
@@ -27952,8 +28149,8 @@
}
}
function bindEachFunctionsFirst(nodes) {
- bindEach(nodes, function (n) { return n.kind === 239 /* FunctionDeclaration */ ? bind(n) : undefined; });
- bindEach(nodes, function (n) { return n.kind !== 239 /* FunctionDeclaration */ ? bind(n) : undefined; });
+ bindEach(nodes, function (n) { return n.kind === 240 /* FunctionDeclaration */ ? bind(n) : undefined; });
+ bindEach(nodes, function (n) { return n.kind !== 240 /* FunctionDeclaration */ ? bind(n) : undefined; });
}
function bindEach(nodes, bindFunction) {
if (bindFunction === void 0) { bindFunction = bind; }
@@ -27986,78 +28183,78 @@
return;
}
switch (node.kind) {
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
bindWhileStatement(node);
break;
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
bindDoStatement(node);
break;
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
bindForStatement(node);
break;
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
bindForInOrForOfStatement(node);
break;
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
bindIfStatement(node);
break;
- case 230 /* ReturnStatement */:
- case 234 /* ThrowStatement */:
+ case 231 /* ReturnStatement */:
+ case 235 /* ThrowStatement */:
bindReturnOrThrow(node);
break;
- case 229 /* BreakStatement */:
- case 228 /* ContinueStatement */:
+ case 230 /* BreakStatement */:
+ case 229 /* ContinueStatement */:
bindBreakOrContinueStatement(node);
break;
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
bindTryStatement(node);
break;
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
bindSwitchStatement(node);
break;
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
bindCaseBlock(node);
break;
- case 271 /* CaseClause */:
+ case 272 /* CaseClause */:
bindCaseClause(node);
break;
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
bindLabeledStatement(node);
break;
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
bindPrefixUnaryExpressionFlow(node);
break;
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
bindPostfixUnaryExpressionFlow(node);
break;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
bindBinaryExpressionFlow(node);
break;
- case 198 /* DeleteExpression */:
+ case 199 /* DeleteExpression */:
bindDeleteExpressionFlow(node);
break;
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
bindConditionalExpressionFlow(node);
break;
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
bindVariableDeclarationFlow(node);
break;
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
bindCallExpressionFlow(node);
break;
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
bindJSDocTypeAlias(node);
break;
// In source files and blocks, bind functions first to match hoisting that occurs at runtime
- case 284 /* SourceFile */: {
+ case 285 /* SourceFile */: {
bindEachFunctionsFirst(node.statements);
bind(node.endOfFileToken);
break;
}
- case 218 /* Block */:
- case 245 /* ModuleBlock */:
+ case 219 /* Block */:
+ case 246 /* ModuleBlock */:
bindEachFunctionsFirst(node.statements);
break;
default:
@@ -28068,26 +28265,26 @@
}
function isNarrowingExpression(expr) {
switch (expr.kind) {
- case 72 /* Identifier */:
- case 100 /* ThisKeyword */:
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 73 /* Identifier */:
+ case 101 /* ThisKeyword */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return isNarrowableReference(expr);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return hasNarrowableArgument(expr);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return isNarrowingExpression(expr.expression);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return isNarrowingBinaryExpression(expr);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return expr.operator === 52 /* ExclamationToken */ && isNarrowingExpression(expr.operand);
- case 199 /* TypeOfExpression */:
+ case 200 /* TypeOfExpression */:
return isNarrowingExpression(expr.expression);
}
return false;
}
function isNarrowableReference(expr) {
- return expr.kind === 72 /* Identifier */ || expr.kind === 100 /* ThisKeyword */ || expr.kind === 98 /* SuperKeyword */ ||
+ return expr.kind === 73 /* Identifier */ || expr.kind === 101 /* ThisKeyword */ || expr.kind === 99 /* SuperKeyword */ ||
(ts.isPropertyAccessExpression(expr) || ts.isNonNullExpression(expr) || ts.isParenthesizedExpression(expr)) && isNarrowableReference(expr.expression) ||
ts.isElementAccessExpression(expr) && expr.argumentExpression &&
(ts.isStringLiteral(expr.argumentExpression) || ts.isNumericLiteral(expr.argumentExpression)) &&
@@ -28102,7 +28299,7 @@
}
}
}
- if (expr.expression.kind === 189 /* PropertyAccessExpression */ &&
+ if (expr.expression.kind === 190 /* PropertyAccessExpression */ &&
isNarrowableReference(expr.expression.expression)) {
return true;
}
@@ -28116,7 +28313,7 @@
}
function isNarrowingBinaryExpression(expr) {
switch (expr.operatorToken.kind) {
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
return isNarrowableReference(expr.left);
case 33 /* EqualsEqualsToken */:
case 34 /* ExclamationEqualsToken */:
@@ -28124,9 +28321,9 @@
case 36 /* ExclamationEqualsEqualsToken */:
return isNarrowableOperand(expr.left) || isNarrowableOperand(expr.right) ||
isNarrowingTypeofOperands(expr.right, expr.left) || isNarrowingTypeofOperands(expr.left, expr.right);
- case 94 /* InstanceOfKeyword */:
+ case 95 /* InstanceOfKeyword */:
return isNarrowableOperand(expr.left);
- case 93 /* InKeyword */:
+ case 94 /* InKeyword */:
return isNarrowableInOperands(expr.left, expr.right);
case 27 /* CommaToken */:
return isNarrowingExpression(expr.right);
@@ -28135,11 +28332,11 @@
}
function isNarrowableOperand(expr) {
switch (expr.kind) {
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return isNarrowableOperand(expr.expression);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
switch (expr.operatorToken.kind) {
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
return isNarrowableOperand(expr.left);
case 27 /* CommaToken */:
return isNarrowableOperand(expr.right);
@@ -28176,8 +28373,8 @@
if (!expression) {
return flags & 32 /* TrueCondition */ ? antecedent : unreachableFlow;
}
- if (expression.kind === 102 /* TrueKeyword */ && flags & 64 /* FalseCondition */ ||
- expression.kind === 87 /* FalseKeyword */ && flags & 32 /* TrueCondition */) {
+ if (expression.kind === 103 /* TrueKeyword */ && flags & 64 /* FalseCondition */ ||
+ expression.kind === 88 /* FalseKeyword */ && flags & 32 /* TrueCondition */) {
return unreachableFlow;
}
if (!isNarrowingExpression(expression)) {
@@ -28215,33 +28412,33 @@
function isStatementCondition(node) {
var parent = node.parent;
switch (parent.kind) {
- case 222 /* IfStatement */:
- case 224 /* WhileStatement */:
- case 223 /* DoStatement */:
+ case 223 /* IfStatement */:
+ case 225 /* WhileStatement */:
+ case 224 /* DoStatement */:
return parent.expression === node;
- case 225 /* ForStatement */:
- case 205 /* ConditionalExpression */:
+ case 226 /* ForStatement */:
+ case 206 /* ConditionalExpression */:
return parent.condition === node;
}
return false;
}
function isLogicalExpression(node) {
while (true) {
- if (node.kind === 195 /* ParenthesizedExpression */) {
+ if (node.kind === 196 /* ParenthesizedExpression */) {
node = node.expression;
}
- else if (node.kind === 202 /* PrefixUnaryExpression */ && node.operator === 52 /* ExclamationToken */) {
+ else if (node.kind === 203 /* PrefixUnaryExpression */ && node.operator === 52 /* ExclamationToken */) {
node = node.operand;
}
else {
- return node.kind === 204 /* BinaryExpression */ && (node.operatorToken.kind === 54 /* AmpersandAmpersandToken */ ||
+ return node.kind === 205 /* BinaryExpression */ && (node.operatorToken.kind === 54 /* AmpersandAmpersandToken */ ||
node.operatorToken.kind === 55 /* BarBarToken */);
}
}
}
function isTopLevelLogicalExpression(node) {
- while (node.parent.kind === 195 /* ParenthesizedExpression */ ||
- node.parent.kind === 202 /* PrefixUnaryExpression */ &&
+ while (node.parent.kind === 196 /* ParenthesizedExpression */ ||
+ node.parent.kind === 203 /* PrefixUnaryExpression */ &&
node.parent.operator === 52 /* ExclamationToken */) {
node = node.parent;
}
@@ -28283,7 +28480,7 @@
}
function bindDoStatement(node) {
var preDoLabel = createLoopLabel();
- var enclosingLabeledStatement = node.parent.kind === 233 /* LabeledStatement */
+ var enclosingLabeledStatement = node.parent.kind === 234 /* LabeledStatement */
? ts.lastOrUndefined(activeLabels)
: undefined;
// if do statement is wrapped in labeled statement then target labels for break/continue with or without
@@ -28317,13 +28514,13 @@
var postLoopLabel = createBranchLabel();
addAntecedent(preLoopLabel, currentFlow);
currentFlow = preLoopLabel;
- if (node.kind === 227 /* ForOfStatement */) {
+ if (node.kind === 228 /* ForOfStatement */) {
bind(node.awaitModifier);
}
bind(node.expression);
addAntecedent(postLoopLabel, currentFlow);
bind(node.initializer);
- if (node.initializer.kind !== 238 /* VariableDeclarationList */) {
+ if (node.initializer.kind !== 239 /* VariableDeclarationList */) {
bindAssignmentTargetFlow(node.initializer);
}
bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel);
@@ -28345,7 +28542,7 @@
}
function bindReturnOrThrow(node) {
bind(node.expression);
- if (node.kind === 230 /* ReturnStatement */) {
+ if (node.kind === 231 /* ReturnStatement */) {
hasExplicitReturn = true;
if (currentReturnTarget) {
addAntecedent(currentReturnTarget, currentFlow);
@@ -28365,7 +28562,7 @@
return undefined;
}
function bindBreakOrContinueFlow(node, breakTarget, continueTarget) {
- var flowLabel = node.kind === 229 /* BreakStatement */ ? breakTarget : continueTarget;
+ var flowLabel = node.kind === 230 /* BreakStatement */ ? breakTarget : continueTarget;
if (flowLabel) {
addAntecedent(flowLabel, currentFlow);
currentFlow = unreachableFlow;
@@ -28493,7 +28690,7 @@
preSwitchCaseFlow = currentFlow;
bind(node.caseBlock);
addAntecedent(postSwitchLabel, currentFlow);
- var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 272 /* DefaultClause */; });
+ var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 273 /* DefaultClause */; });
// We mark a switch statement as possibly exhaustive if it has no default clause and if all
// case clauses have unreachable end points (e.g. they all return).
node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents;
@@ -28560,14 +28757,14 @@
if (!activeLabel.referenced && !options.allowUnusedLabels) {
errorOrSuggestionOnNode(ts.unusedLabelIsError(options), node.label, ts.Diagnostics.Unused_label);
}
- if (!node.statement || node.statement.kind !== 223 /* DoStatement */) {
+ if (!node.statement || node.statement.kind !== 224 /* DoStatement */) {
// do statement sets current flow inside bindDoStatement
addAntecedent(postStatementLabel, currentFlow);
currentFlow = finishFlowLabel(postStatementLabel);
}
}
function bindDestructuringTargetFlow(node) {
- if (node.kind === 204 /* BinaryExpression */ && node.operatorToken.kind === 59 /* EqualsToken */) {
+ if (node.kind === 205 /* BinaryExpression */ && node.operatorToken.kind === 60 /* EqualsToken */) {
bindAssignmentTargetFlow(node.left);
}
else {
@@ -28578,10 +28775,10 @@
if (isNarrowableReference(node)) {
currentFlow = createFlowAssignment(currentFlow, node);
}
- else if (node.kind === 187 /* ArrayLiteralExpression */) {
+ else if (node.kind === 188 /* ArrayLiteralExpression */) {
for (var _i = 0, _a = node.elements; _i < _a.length; _i++) {
var e = _a[_i];
- if (e.kind === 208 /* SpreadElement */) {
+ if (e.kind === 209 /* SpreadElement */) {
bindAssignmentTargetFlow(e.expression);
}
else {
@@ -28589,16 +28786,16 @@
}
}
}
- else if (node.kind === 188 /* ObjectLiteralExpression */) {
+ else if (node.kind === 189 /* ObjectLiteralExpression */) {
for (var _b = 0, _c = node.properties; _b < _c.length; _b++) {
var p = _c[_b];
- if (p.kind === 275 /* PropertyAssignment */) {
+ if (p.kind === 276 /* PropertyAssignment */) {
bindDestructuringTargetFlow(p.initializer);
}
- else if (p.kind === 276 /* ShorthandPropertyAssignment */) {
+ else if (p.kind === 277 /* ShorthandPropertyAssignment */) {
bindAssignmentTargetFlow(p.name);
}
- else if (p.kind === 277 /* SpreadAssignment */) {
+ else if (p.kind === 278 /* SpreadAssignment */) {
bindAssignmentTargetFlow(p.expression);
}
}
@@ -28654,7 +28851,7 @@
bindEachChild(node);
if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) {
bindAssignmentTargetFlow(node.left);
- if (operator === 59 /* EqualsToken */ && node.left.kind === 190 /* ElementAccessExpression */) {
+ if (operator === 60 /* EqualsToken */ && node.left.kind === 191 /* ElementAccessExpression */) {
var elementAccess = node.left;
if (isNarrowableOperand(elementAccess.expression)) {
currentFlow = createFlowArrayMutation(currentFlow, node);
@@ -28665,7 +28862,7 @@
}
function bindDeleteExpressionFlow(node) {
bindEachChild(node);
- if (node.expression.kind === 189 /* PropertyAccessExpression */) {
+ if (node.expression.kind === 190 /* PropertyAccessExpression */) {
bindAssignmentTargetFlow(node.expression);
}
}
@@ -28713,10 +28910,10 @@
// an immediately invoked function expression (IIFE). Initialize the flowNode property to
// the current control flow (which includes evaluation of the IIFE arguments).
var expr = node.expression;
- while (expr.kind === 195 /* ParenthesizedExpression */) {
+ while (expr.kind === 196 /* ParenthesizedExpression */) {
expr = expr.expression;
}
- if (expr.kind === 196 /* FunctionExpression */ || expr.kind === 197 /* ArrowFunction */) {
+ if (expr.kind === 197 /* FunctionExpression */ || expr.kind === 198 /* ArrowFunction */) {
bindEach(node.typeArguments);
bindEach(node.arguments);
bind(node.expression);
@@ -28724,7 +28921,7 @@
else {
bindEachChild(node);
}
- if (node.expression.kind === 189 /* PropertyAccessExpression */) {
+ if (node.expression.kind === 190 /* PropertyAccessExpression */) {
var propertyAccess = node.expression;
if (isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) {
currentFlow = createFlowArrayMutation(currentFlow, node);
@@ -28733,54 +28930,54 @@
}
function getContainerFlags(node) {
switch (node.kind) {
- case 209 /* ClassExpression */:
- case 240 /* ClassDeclaration */:
- case 243 /* EnumDeclaration */:
- case 188 /* ObjectLiteralExpression */:
- case 168 /* TypeLiteral */:
- case 297 /* JSDocTypeLiteral */:
- case 268 /* JsxAttributes */:
+ case 210 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 189 /* ObjectLiteralExpression */:
+ case 169 /* TypeLiteral */:
+ case 298 /* JSDocTypeLiteral */:
+ case 269 /* JsxAttributes */:
return 1 /* IsContainer */;
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
return 1 /* IsContainer */ | 64 /* IsInterface */;
- case 244 /* ModuleDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 181 /* MappedType */:
+ case 245 /* ModuleDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 182 /* MappedType */:
return 1 /* IsContainer */ | 32 /* HasLocals */;
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */;
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
if (ts.isObjectLiteralOrClassExpressionMethod(node)) {
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 128 /* IsObjectLiteralOrClassExpressionMethod */;
}
// falls through
- case 157 /* Constructor */:
- case 239 /* FunctionDeclaration */:
- case 155 /* MethodSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 160 /* CallSignature */:
- case 298 /* JSDocSignature */:
- case 294 /* JSDocFunctionType */:
- case 165 /* FunctionType */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
- case 166 /* ConstructorType */:
+ case 158 /* Constructor */:
+ case 240 /* FunctionDeclaration */:
+ case 156 /* MethodSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 161 /* CallSignature */:
+ case 299 /* JSDocSignature */:
+ case 295 /* JSDocFunctionType */:
+ case 166 /* FunctionType */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
+ case 167 /* ConstructorType */:
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */;
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 16 /* IsFunctionExpression */;
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
return 4 /* IsControlFlowContainer */;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return node.initializer ? 4 /* IsControlFlowContainer */ : 0;
- case 274 /* CatchClause */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 246 /* CaseBlock */:
+ case 275 /* CatchClause */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 247 /* CaseBlock */:
return 2 /* IsBlockScopedContainer */;
- case 218 /* Block */:
+ case 219 /* Block */:
// do not treat blocks directly inside a function as a block-scoped-container.
// Locals that reside in this block should go to the function locals. Otherwise 'x'
// would not appear to be a redeclaration of a block scoped local in the following
@@ -28813,45 +29010,45 @@
// members are declared (for example, a member of a class will go into a specific
// symbol table depending on if it is static or not). We defer to specialized
// handlers to take care of declaring these child members.
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return declareModuleMember(node, symbolFlags, symbolExcludes);
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return declareSourceFileMember(node, symbolFlags, symbolExcludes);
- case 209 /* ClassExpression */:
- case 240 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
return declareClassMember(node, symbolFlags, symbolExcludes);
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
- case 168 /* TypeLiteral */:
- case 297 /* JSDocTypeLiteral */:
- case 188 /* ObjectLiteralExpression */:
- case 241 /* InterfaceDeclaration */:
- case 268 /* JsxAttributes */:
+ case 169 /* TypeLiteral */:
+ case 298 /* JSDocTypeLiteral */:
+ case 189 /* ObjectLiteralExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 269 /* JsxAttributes */:
// Interface/Object-types always have their children added to the 'members' of
// their container. They are only accessible through an instance of their
// container, and are never in scope otherwise (even inside the body of the
// object / type / interface declaring them). An exception is type parameters,
// which are in scope without qualification (similar to 'locals').
return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes);
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 298 /* JSDocSignature */:
- case 162 /* IndexSignature */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 294 /* JSDocFunctionType */:
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
- case 242 /* TypeAliasDeclaration */:
- case 181 /* MappedType */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 299 /* JSDocSignature */:
+ case 163 /* IndexSignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 295 /* JSDocFunctionType */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
+ case 243 /* TypeAliasDeclaration */:
+ case 182 /* MappedType */:
// All the children of these container types are never visible through another
// symbol (i.e. through another symbol's 'exports' or 'members'). Instead,
// they're only accessed 'lexically' (i.e. from code that exists underneath
@@ -28872,16 +29069,8 @@
: declareSymbol(file.locals, /*parent*/ undefined, node, symbolFlags, symbolExcludes);
}
function hasExportDeclarations(node) {
- var body = node.kind === 284 /* SourceFile */ ? node : node.body;
- if (body && (body.kind === 284 /* SourceFile */ || body.kind === 245 /* ModuleBlock */)) {
- for (var _i = 0, _a = body.statements; _i < _a.length; _i++) {
- var stat = _a[_i];
- if (stat.kind === 255 /* ExportDeclaration */ || stat.kind === 254 /* ExportAssignment */) {
- return true;
- }
- }
- }
- return false;
+ var body = ts.isSourceFile(node) ? node : ts.tryCast(node.body, ts.isModuleBlock);
+ return !!body && body.statements.some(function (s) { return ts.isExportDeclaration(s) || ts.isExportAssignment(s); });
}
function setExportContextFlag(node) {
// A declaration source file or ambient module declaration that contains no export declarations (but possibly regular
@@ -28960,7 +29149,7 @@
var seen = ts.createUnderscoreEscapedMap();
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var prop = _a[_i];
- if (prop.kind === 277 /* SpreadAssignment */ || prop.name.kind !== 72 /* Identifier */) {
+ if (prop.kind === 278 /* SpreadAssignment */ || prop.name.kind !== 73 /* Identifier */) {
continue;
}
var identifier = prop.name;
@@ -28972,7 +29161,7 @@
// c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true.
// d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true
// and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields
- var currentKind = prop.kind === 275 /* PropertyAssignment */ || prop.kind === 276 /* ShorthandPropertyAssignment */ || prop.kind === 156 /* MethodDeclaration */
+ var currentKind = prop.kind === 276 /* PropertyAssignment */ || prop.kind === 277 /* ShorthandPropertyAssignment */ || prop.kind === 157 /* MethodDeclaration */
? 1 /* Property */
: 2 /* Accessor */;
var existingKind = seen.get(identifier.escapedText);
@@ -29004,10 +29193,10 @@
}
function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) {
switch (blockScopeContainer.kind) {
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
declareModuleMember(node, symbolFlags, symbolExcludes);
break;
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
if (ts.isExternalOrCommonJsModule(container)) {
declareModuleMember(node, symbolFlags, symbolExcludes);
break;
@@ -29038,7 +29227,7 @@
currentFlow = { flags: 2 /* Start */ };
parent = typeAlias;
bind(typeAlias.typeExpression);
- if (!typeAlias.fullName || typeAlias.fullName.kind === 72 /* Identifier */) {
+ if (!typeAlias.fullName || typeAlias.fullName.kind === 73 /* Identifier */) {
parent = typeAlias.parent;
bindBlockScopedDeclaration(typeAlias, 524288 /* TypeAlias */, 67897832 /* TypeAliasExcludes */);
}
@@ -29056,8 +29245,8 @@
// check for reserved words used as identifiers in strict mode code.
function checkStrictModeIdentifier(node) {
if (inStrictMode &&
- node.originalKeywordKind >= 109 /* FirstFutureReservedWord */ &&
- node.originalKeywordKind <= 117 /* LastFutureReservedWord */ &&
+ node.originalKeywordKind >= 110 /* FirstFutureReservedWord */ &&
+ node.originalKeywordKind <= 118 /* LastFutureReservedWord */ &&
!ts.isIdentifierName(node) &&
!(node.flags & 4194304 /* Ambient */)) {
// Report error only if there are no parse errors in file
@@ -29093,7 +29282,7 @@
}
function checkStrictModeDeleteExpression(node) {
// Grammar checking
- if (inStrictMode && node.expression.kind === 72 /* Identifier */) {
+ if (inStrictMode && node.expression.kind === 73 /* Identifier */) {
// When a delete operator occurs within strict mode code, a SyntaxError is thrown if its
// UnaryExpression is a direct reference to a variable, function argument, or function name
var span = ts.getErrorSpanForNode(file, node.expression);
@@ -29104,7 +29293,7 @@
return ts.isIdentifier(node) && (node.escapedText === "eval" || node.escapedText === "arguments");
}
function checkStrictModeEvalOrArguments(contextNode, name) {
- if (name && name.kind === 72 /* Identifier */) {
+ if (name && name.kind === 73 /* Identifier */) {
var identifier = name;
if (isEvalOrArgumentsIdentifier(identifier)) {
// We check first if the name is inside class declaration or class expression; if so give explicit message
@@ -29145,8 +29334,8 @@
function checkStrictModeFunctionDeclaration(node) {
if (languageVersion < 2 /* ES2015 */) {
// Report error if function is not top level function declaration
- if (blockScopeContainer.kind !== 284 /* SourceFile */ &&
- blockScopeContainer.kind !== 244 /* ModuleDeclaration */ &&
+ if (blockScopeContainer.kind !== 285 /* SourceFile */ &&
+ blockScopeContainer.kind !== 245 /* ModuleDeclaration */ &&
!ts.isFunctionLike(blockScopeContainer)) {
// We check first if the name is inside class declaration or class expression; if so give explicit message
// otherwise report generic error message.
@@ -29241,7 +29430,7 @@
// the current 'container' node when it changes. This helps us know which symbol table
// a local should go into for example. Since terminal nodes are known not to have
// children, as an optimization we don't process those.
- if (node.kind > 147 /* LastToken */) {
+ if (node.kind > 148 /* LastToken */) {
var saveParent = parent;
parent = node;
var containerFlags = getContainerFlags(node);
@@ -29303,7 +29492,7 @@
function bindWorker(node) {
switch (node.kind) {
/* Strict mode checks */
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
// for typedef type names with namespaces, bind the new jsdoc type symbol here
// because it requires all containing namespaces to be in effect, namely the
// current "blockScopeContainer" needs to be set to its immediate namespace parent.
@@ -29316,13 +29505,13 @@
break;
}
// falls through
- case 100 /* ThisKeyword */:
- if (currentFlow && (ts.isExpression(node) || parent.kind === 276 /* ShorthandPropertyAssignment */)) {
+ case 101 /* ThisKeyword */:
+ if (currentFlow && (ts.isExpression(node) || parent.kind === 277 /* ShorthandPropertyAssignment */)) {
node.flowNode = currentFlow;
}
return checkStrictModeIdentifier(node);
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
if (currentFlow && isNarrowableReference(node)) {
node.flowNode = currentFlow;
}
@@ -29336,7 +29525,7 @@
declareSymbol(file.locals, /*parent*/ undefined, node.expression, 1 /* FunctionScopedVariable */ | 134217728 /* ModuleExports */, 67220414 /* FunctionScopedVariableExcludes */);
}
break;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
var specialKind = ts.getAssignmentDeclarationKind(node);
switch (specialKind) {
case 1 /* ExportsProperty */:
@@ -29364,76 +29553,76 @@
ts.Debug.fail("Unknown binary expression special property assignment kind");
}
return checkStrictModeBinaryExpression(node);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return checkStrictModeCatchClause(node);
- case 198 /* DeleteExpression */:
+ case 199 /* DeleteExpression */:
return checkStrictModeDeleteExpression(node);
case 8 /* NumericLiteral */:
return checkStrictModeNumericLiteral(node);
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return checkStrictModePostfixUnaryExpression(node);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return checkStrictModePrefixUnaryExpression(node);
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
return checkStrictModeWithStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return checkStrictModeLabeledStatement(node);
- case 178 /* ThisType */:
+ case 179 /* ThisType */:
seenThisKeyword = true;
return;
- case 163 /* TypePredicate */:
+ case 164 /* TypePredicate */:
break; // Binding the children will handle everything
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
return bindTypeParameter(node);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return bindParameter(node);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return bindVariableDeclarationOrBindingElement(node);
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
node.flowNode = currentFlow;
return bindVariableDeclarationOrBindingElement(node);
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
return bindPropertyWorker(node);
- case 275 /* PropertyAssignment */:
- case 276 /* ShorthandPropertyAssignment */:
+ case 276 /* PropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 0 /* PropertyExcludes */);
- case 278 /* EnumMember */:
+ case 279 /* EnumMember */:
return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 68008959 /* EnumMemberExcludes */);
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
return declareSymbolAndAddToSymbolTable(node, 131072 /* Signature */, 0 /* None */);
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
// If this is an ObjectLiteralExpression method, then it sits in the same space
// as other properties in the object literal. So we use SymbolFlags.PropertyExcludes
// so that it will conflict with any other object literal members with the same
// name.
return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 16777216 /* Optional */ : 0 /* None */), ts.isObjectLiteralMethod(node) ? 0 /* PropertyExcludes */ : 67212223 /* MethodExcludes */);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return bindFunctionDeclaration(node);
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */);
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 67154879 /* GetAccessorExcludes */);
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 67187647 /* SetAccessorExcludes */);
- case 165 /* FunctionType */:
- case 294 /* JSDocFunctionType */:
- case 298 /* JSDocSignature */:
- case 166 /* ConstructorType */:
+ case 166 /* FunctionType */:
+ case 295 /* JSDocFunctionType */:
+ case 299 /* JSDocSignature */:
+ case 167 /* ConstructorType */:
return bindFunctionOrConstructorType(node);
- case 168 /* TypeLiteral */:
- case 297 /* JSDocTypeLiteral */:
- case 181 /* MappedType */:
+ case 169 /* TypeLiteral */:
+ case 298 /* JSDocTypeLiteral */:
+ case 182 /* MappedType */:
return bindAnonymousTypeWorker(node);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return bindObjectLiteralExpression(node);
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return bindFunctionExpression(node);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
var assignmentKind = ts.getAssignmentDeclarationKind(node);
switch (assignmentKind) {
case 7 /* ObjectDefinePropertyValue */:
@@ -29452,64 +29641,64 @@
}
break;
// Members of classes, interfaces, and modules
- case 209 /* ClassExpression */:
- case 240 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
// All classes are automatically in strict mode in ES6.
inStrictMode = true;
return bindClassLikeDeclaration(node);
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
return bindBlockScopedDeclaration(node, 64 /* Interface */, 67897736 /* InterfaceExcludes */);
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 67897832 /* TypeAliasExcludes */);
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return bindEnumDeclaration(node);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return bindModuleDeclaration(node);
// Jsx-attributes
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
return bindJsxAttributes(node);
- case 267 /* JsxAttribute */:
+ case 268 /* JsxAttribute */:
return bindJsxAttribute(node, 4 /* Property */, 0 /* PropertyExcludes */);
// Imports and exports
- case 248 /* ImportEqualsDeclaration */:
- case 251 /* NamespaceImport */:
- case 253 /* ImportSpecifier */:
- case 257 /* ExportSpecifier */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 252 /* NamespaceImport */:
+ case 254 /* ImportSpecifier */:
+ case 258 /* ExportSpecifier */:
return declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */);
- case 247 /* NamespaceExportDeclaration */:
+ case 248 /* NamespaceExportDeclaration */:
return bindNamespaceExportDeclaration(node);
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
return bindImportClause(node);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return bindExportDeclaration(node);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return bindExportAssignment(node);
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
updateStrictModeStatementList(node.statements);
return bindSourceFileIfExternalModule();
- case 218 /* Block */:
+ case 219 /* Block */:
if (!ts.isFunctionLike(node.parent)) {
return;
}
// falls through
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
return updateStrictModeStatementList(node.statements);
- case 304 /* JSDocParameterTag */:
- if (node.parent.kind === 298 /* JSDocSignature */) {
+ case 305 /* JSDocParameterTag */:
+ if (node.parent.kind === 299 /* JSDocSignature */) {
return bindParameter(node);
}
- if (node.parent.kind !== 297 /* JSDocTypeLiteral */) {
+ if (node.parent.kind !== 298 /* JSDocTypeLiteral */) {
break;
}
// falls through
- case 310 /* JSDocPropertyTag */:
+ case 311 /* JSDocPropertyTag */:
var propTag = node;
- var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 293 /* JSDocOptionalType */ ?
+ var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 294 /* JSDocOptionalType */ ?
4 /* Property */ | 16777216 /* Optional */ :
4 /* Property */;
return declareSymbolAndAddToSymbolTable(propTag, flags, 0 /* PropertyExcludes */);
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
return (delayedTypeAliases || (delayedTypeAliases = [])).push(node);
}
}
@@ -29653,11 +29842,11 @@
ts.Debug.assert(ts.isInJSFile(node));
var thisContainer = ts.getThisContainer(node, /*includeArrowFunctions*/ false);
switch (thisContainer.kind) {
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
var constructorSymbol = thisContainer.symbol;
// For `f.prototype.m = function() { this.x = 0; }`, `this.x = 0` should modify `f`'s members, not the function expression.
- if (ts.isBinaryExpression(thisContainer.parent) && thisContainer.parent.operatorToken.kind === 59 /* EqualsToken */) {
+ if (ts.isBinaryExpression(thisContainer.parent) && thisContainer.parent.operatorToken.kind === 60 /* EqualsToken */) {
var l = thisContainer.parent.left;
if (ts.isPropertyAccessEntityNameExpression(l) && ts.isPrototypeAccess(l.expression)) {
constructorSymbol = lookupSymbolForPropertyAccess(l.expression.expression, thisParentContainer);
@@ -29670,18 +29859,18 @@
declareSymbol(constructorSymbol.members, constructorSymbol, node, 4 /* Property */, 0 /* PropertyExcludes */ & ~4 /* Property */);
}
break;
- case 157 /* Constructor */:
- case 154 /* PropertyDeclaration */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 158 /* Constructor */:
+ case 155 /* PropertyDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
// this.foo assignment in a JavaScript class
// Bind this property to the containing class
var containingClass = thisContainer.parent;
var symbolTable = ts.hasModifier(thisContainer, 32 /* Static */) ? containingClass.symbol.exports : containingClass.symbol.members;
declareSymbol(symbolTable, containingClass.symbol, node, 4 /* Property */, 0 /* None */, /*isReplaceableByMethod*/ true);
break;
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
// this.property = assignment in a source file -- declare symbol in exports for a module, in locals for a script
if (thisContainer.commonJsModuleIndicator) {
declareSymbol(thisContainer.symbol.exports, thisContainer.symbol, node, 4 /* Property */ | 1048576 /* ExportValue */, 0 /* None */);
@@ -29691,14 +29880,14 @@
}
break;
default:
- ts.Debug.fail(ts.Debug.showSyntaxKind(thisContainer));
+ ts.Debug.failBadSyntaxKind(thisContainer);
}
}
function bindSpecialPropertyDeclaration(node) {
- if (node.expression.kind === 100 /* ThisKeyword */) {
+ if (node.expression.kind === 101 /* ThisKeyword */) {
bindThisPropertyAssignment(node);
}
- else if (ts.isPropertyAccessEntityNameExpression(node) && node.parent.parent.kind === 284 /* SourceFile */) {
+ else if (ts.isPropertyAccessEntityNameExpression(node) && node.parent.parent.kind === 285 /* SourceFile */) {
if (ts.isPrototypeAccess(node.expression)) {
bindPrototypePropertyAssignment(node, node.parent);
}
@@ -29735,7 +29924,7 @@
}
function bindObjectDefinePropertyAssignment(node) {
var namespaceSymbol = lookupSymbolForPropertyAccess(node.arguments[0]);
- var isToplevel = node.parent.parent.kind === 284 /* SourceFile */;
+ var isToplevel = node.parent.parent.kind === 285 /* SourceFile */;
namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, node.arguments[0], isToplevel, /*isPrototypeProperty*/ false);
bindPotentiallyNewExpandoMemberToNamespace(node, namespaceSymbol, /*isPrototypeProperty*/ false);
}
@@ -29749,7 +29938,7 @@
// Fix up parent pointers since we're going to use these nodes before we bind into them
node.left.parent = node;
node.right.parent = node;
- if (ts.isIdentifier(lhs.expression) && container === file && isNameOfExportsOrModuleExportsAliasDeclaration(file, lhs.expression)) {
+ if (ts.isIdentifier(lhs.expression) && container === file && isExportsOrModuleExportsOrAlias(file, lhs.expression)) {
// This can be an alias for the 'exports' or 'module.exports' names, e.g.
// var util = module.exports;
// util.property = function ...
@@ -29802,8 +29991,8 @@
function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty) {
var namespaceSymbol = lookupSymbolForPropertyAccess(name);
var isToplevel = ts.isBinaryExpression(propertyAccess.parent)
- ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 284 /* SourceFile */
- : propertyAccess.parent.parent.kind === 284 /* SourceFile */;
+ ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 285 /* SourceFile */
+ : propertyAccess.parent.parent.kind === 285 /* SourceFile */;
namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, propertyAccess.expression, isToplevel, isPrototypeProperty);
bindPotentiallyNewExpandoMemberToNamespace(propertyAccess, namespaceSymbol, isPrototypeProperty);
}
@@ -29862,9 +30051,7 @@
}
else {
var s = forEachIdentifierInEntityName(e.expression, parent, action);
- if (!s || !s.exports)
- return ts.Debug.fail();
- return action(e.name, s.exports.get(e.name.escapedText), s);
+ return action(e.name, s && s.exports && s.exports.get(e.name.escapedText), s);
}
}
function bindCallExpression(node) {
@@ -29875,7 +30062,7 @@
}
}
function bindClassLikeDeclaration(node) {
- if (node.kind === 240 /* ClassDeclaration */) {
+ if (node.kind === 241 /* ClassDeclaration */) {
bindBlockScopedDeclaration(node, 32 /* Class */, 68008383 /* ClassExcludes */);
}
else {
@@ -29941,7 +30128,7 @@
}
}
function bindParameter(node) {
- if (node.kind === 304 /* JSDocParameterTag */ && container.kind !== 298 /* JSDocSignature */) {
+ if (node.kind === 305 /* JSDocParameterTag */ && container.kind !== 299 /* JSDocSignature */) {
return;
}
if (inStrictMode && !(node.flags & 4194304 /* Ambient */)) {
@@ -30018,7 +30205,7 @@
declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 67635688 /* TypeParameterExcludes */);
}
}
- else if (node.parent.kind === 176 /* InferType */) {
+ else if (node.parent.kind === 177 /* InferType */) {
var container_2 = getInferTypeContainer(node.parent);
if (container_2) {
if (!container_2.locals) {
@@ -30046,11 +30233,11 @@
if (currentFlow === unreachableFlow) {
var reportError =
// report error on all statements except empty ones
- (ts.isStatementButNotDeclaration(node) && node.kind !== 220 /* EmptyStatement */) ||
+ (ts.isStatementButNotDeclaration(node) && node.kind !== 221 /* EmptyStatement */) ||
// report error on class declarations
- node.kind === 240 /* ClassDeclaration */ ||
+ node.kind === 241 /* ClassDeclaration */ ||
// report error on instantiated modules or const-enums only modules if preserveConstEnums is set
- (node.kind === 244 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node));
+ (node.kind === 245 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node));
if (reportError) {
currentFlow = reportedUnreachableFlow;
if (!options.allowUnreachableCode) {
@@ -30094,32 +30281,41 @@
}
function isPurelyTypeDeclaration(s) {
switch (s.kind) {
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return true;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return getModuleInstanceState(s) !== 1 /* Instantiated */;
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return ts.hasModifier(s, 2048 /* Const */);
default:
return false;
}
}
function isExportsOrModuleExportsOrAlias(sourceFile, node) {
- return ts.isExportsIdentifier(node) ||
- ts.isModuleExportsPropertyAccessExpression(node) ||
- ts.isIdentifier(node) && isNameOfExportsOrModuleExportsAliasDeclaration(sourceFile, node);
+ var i = 0;
+ var q = [node];
+ while (q.length && i < 100) {
+ i++;
+ node = q.shift();
+ if (ts.isExportsIdentifier(node) || ts.isModuleExportsPropertyAccessExpression(node)) {
+ return true;
}
- ts.isExportsOrModuleExportsOrAlias = isExportsOrModuleExportsOrAlias;
- function isNameOfExportsOrModuleExportsAliasDeclaration(sourceFile, node) {
+ else if (ts.isIdentifier(node)) {
var symbol = lookupSymbolForNameWorker(sourceFile, node.escapedText);
- return !!symbol && !!symbol.valueDeclaration && ts.isVariableDeclaration(symbol.valueDeclaration) &&
- !!symbol.valueDeclaration.initializer && isExportsOrModuleExportsOrAliasOrAssignment(sourceFile, symbol.valueDeclaration.initializer);
+ if (!!symbol && !!symbol.valueDeclaration && ts.isVariableDeclaration(symbol.valueDeclaration) && !!symbol.valueDeclaration.initializer) {
+ var init = symbol.valueDeclaration.initializer;
+ q.push(init);
+ if (ts.isAssignmentExpression(init, /*excludeCompoundAssignment*/ true)) {
+ q.push(init.left);
+ q.push(init.right);
+ }
}
- function isExportsOrModuleExportsOrAliasOrAssignment(sourceFile, node) {
- return isExportsOrModuleExportsOrAlias(sourceFile, node) ||
- (ts.isAssignmentExpression(node, /*excludeCompoundAssignment*/ true) && (isExportsOrModuleExportsOrAliasOrAssignment(sourceFile, node.left) || isExportsOrModuleExportsOrAliasOrAssignment(sourceFile, node.right)));
}
+ }
+ return false;
+ }
+ ts.isExportsOrModuleExportsOrAlias = isExportsOrModuleExportsOrAlias;
function lookupSymbolForNameWorker(container, name) {
var local = container.locals && container.locals.get(name);
if (local) {
@@ -30139,58 +30335,58 @@
function computeTransformFlagsForNode(node, subtreeFlags) {
var kind = node.kind;
switch (kind) {
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return computeCallExpression(node, subtreeFlags);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return computeNewExpression(node, subtreeFlags);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return computeModuleDeclaration(node, subtreeFlags);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return computeParenthesizedExpression(node, subtreeFlags);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return computeBinaryExpression(node, subtreeFlags);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return computeExpressionStatement(node, subtreeFlags);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return computeParameter(node, subtreeFlags);
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return computeArrowFunction(node, subtreeFlags);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return computeFunctionExpression(node, subtreeFlags);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return computeFunctionDeclaration(node, subtreeFlags);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return computeVariableDeclaration(node, subtreeFlags);
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
return computeVariableDeclarationList(node, subtreeFlags);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return computeVariableStatement(node, subtreeFlags);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return computeLabeledStatement(node, subtreeFlags);
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return computeClassDeclaration(node, subtreeFlags);
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
return computeClassExpression(node, subtreeFlags);
- case 273 /* HeritageClause */:
+ case 274 /* HeritageClause */:
return computeHeritageClause(node, subtreeFlags);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return computeCatchClause(node, subtreeFlags);
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return computeExpressionWithTypeArguments(node, subtreeFlags);
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return computeConstructor(node, subtreeFlags);
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return computePropertyDeclaration(node, subtreeFlags);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return computeMethod(node, subtreeFlags);
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return computeAccessor(node, subtreeFlags);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return computeImportEquals(node, subtreeFlags);
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return computePropertyAccess(node, subtreeFlags);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return computeElementAccess(node, subtreeFlags);
default:
return computeOther(node, kind, subtreeFlags);
@@ -30212,7 +30408,7 @@
transformFlags |= 2048 /* ContainsLexicalThis */;
}
}
- if (expression.kind === 92 /* ImportKeyword */) {
+ if (expression.kind === 93 /* ImportKeyword */) {
transformFlags |= 524288 /* ContainsDynamicImport */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
@@ -30235,17 +30431,17 @@
var transformFlags = subtreeFlags;
var operatorTokenKind = node.operatorToken.kind;
var leftKind = node.left.kind;
- if (operatorTokenKind === 59 /* EqualsToken */ && leftKind === 188 /* ObjectLiteralExpression */) {
+ if (operatorTokenKind === 60 /* EqualsToken */ && leftKind === 189 /* ObjectLiteralExpression */) {
// Destructuring object assignments with are ES2015 syntax
// and possibly ES2018 if they contain rest
transformFlags |= 16 /* AssertES2018 */ | 128 /* AssertES2015 */ | 512 /* AssertDestructuringAssignment */;
}
- else if (operatorTokenKind === 59 /* EqualsToken */ && leftKind === 187 /* ArrayLiteralExpression */) {
+ else if (operatorTokenKind === 60 /* EqualsToken */ && leftKind === 188 /* ArrayLiteralExpression */) {
// Destructuring assignments are ES2015 syntax.
transformFlags |= 128 /* AssertES2015 */ | 512 /* AssertDestructuringAssignment */;
}
else if (operatorTokenKind === 41 /* AsteriskAsteriskToken */
- || operatorTokenKind === 63 /* AsteriskAsteriskEqualsToken */) {
+ || operatorTokenKind === 64 /* AsteriskAsteriskEqualsToken */) {
// Exponentiation is ES2016 syntax.
transformFlags |= 64 /* AssertES2016 */;
}
@@ -30288,8 +30484,8 @@
// If the node is synthesized, it means the emitter put the parentheses there,
// not the user. If we didn't want them, the emitter would not have put them
// there.
- if (expressionKind === 212 /* AsExpression */
- || expressionKind === 194 /* TypeAssertionExpression */) {
+ if (expressionKind === 213 /* AsExpression */
+ || expressionKind === 195 /* TypeAssertionExpression */) {
transformFlags |= 1 /* AssertTypeScript */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
@@ -30331,11 +30527,11 @@
function computeHeritageClause(node, subtreeFlags) {
var transformFlags = subtreeFlags;
switch (node.token) {
- case 86 /* ExtendsKeyword */:
+ case 87 /* ExtendsKeyword */:
// An `extends` HeritageClause is ES6 syntax.
transformFlags |= 128 /* AssertES2015 */;
break;
- case 109 /* ImplementsKeyword */:
+ case 110 /* ImplementsKeyword */:
// An `implements` HeritageClause is TypeScript syntax.
transformFlags |= 1 /* AssertTypeScript */;
break;
@@ -30528,7 +30724,7 @@
var transformFlags = subtreeFlags;
// If a PropertyAccessExpression starts with a super keyword, then it is
// ES6 syntax, and requires a lexical `this` binding.
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
// super inside of an async function requires hoisting the super access (ES2017).
// same for super inside of an async generator, which is ES2018.
transformFlags |= 32 /* ContainsES2017 */ | 16 /* ContainsES2018 */;
@@ -30540,7 +30736,7 @@
var transformFlags = subtreeFlags;
// If an ElementAccessExpression starts with a super keyword, then it is
// ES6 syntax, and requires a lexical `this` binding.
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
// super inside of an async function requires hoisting the super access (ES2017).
// same for super inside of an async generator, which is ES2018.
transformFlags |= 32 /* ContainsES2017 */ | 16 /* ContainsES2018 */;
@@ -30628,43 +30824,43 @@
var transformFlags = subtreeFlags;
var excludeFlags = 536870912 /* NodeExcludes */;
switch (kind) {
- case 121 /* AsyncKeyword */:
- case 201 /* AwaitExpression */:
+ case 122 /* AsyncKeyword */:
+ case 202 /* AwaitExpression */:
// async/await is ES2017 syntax, but may be ES2018 syntax (for async generators)
transformFlags |= 16 /* AssertES2018 */ | 32 /* AssertES2017 */;
break;
- case 194 /* TypeAssertionExpression */:
- case 212 /* AsExpression */:
- case 313 /* PartiallyEmittedExpression */:
+ case 195 /* TypeAssertionExpression */:
+ case 213 /* AsExpression */:
+ case 314 /* PartiallyEmittedExpression */:
// These nodes are TypeScript syntax.
transformFlags |= 1 /* AssertTypeScript */;
excludeFlags = 536870912 /* OuterExpressionExcludes */;
break;
- case 115 /* PublicKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 118 /* AbstractKeyword */:
- case 125 /* DeclareKeyword */:
- case 77 /* ConstKeyword */:
- case 243 /* EnumDeclaration */:
- case 278 /* EnumMember */:
- case 213 /* NonNullExpression */:
- case 133 /* ReadonlyKeyword */:
+ case 116 /* PublicKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 119 /* AbstractKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 78 /* ConstKeyword */:
+ case 244 /* EnumDeclaration */:
+ case 279 /* EnumMember */:
+ case 214 /* NonNullExpression */:
+ case 134 /* ReadonlyKeyword */:
// These nodes are TypeScript syntax.
transformFlags |= 1 /* AssertTypeScript */;
break;
- case 260 /* JsxElement */:
- case 261 /* JsxSelfClosingElement */:
- case 262 /* JsxOpeningElement */:
+ case 261 /* JsxElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
case 11 /* JsxText */:
- case 263 /* JsxClosingElement */:
- case 264 /* JsxFragment */:
- case 265 /* JsxOpeningFragment */:
- case 266 /* JsxClosingFragment */:
- case 267 /* JsxAttribute */:
- case 268 /* JsxAttributes */:
- case 269 /* JsxSpreadAttribute */:
- case 270 /* JsxExpression */:
+ case 264 /* JsxClosingElement */:
+ case 265 /* JsxFragment */:
+ case 266 /* JsxOpeningFragment */:
+ case 267 /* JsxClosingFragment */:
+ case 268 /* JsxAttribute */:
+ case 269 /* JsxAttributes */:
+ case 270 /* JsxSpreadAttribute */:
+ case 271 /* JsxExpression */:
// These nodes are Jsx syntax.
transformFlags |= 2 /* AssertJsx */;
break;
@@ -30672,11 +30868,11 @@
case 15 /* TemplateHead */:
case 16 /* TemplateMiddle */:
case 17 /* TemplateTail */:
- case 206 /* TemplateExpression */:
- case 193 /* TaggedTemplateExpression */:
- case 276 /* ShorthandPropertyAssignment */:
- case 116 /* StaticKeyword */:
- case 214 /* MetaProperty */:
+ case 207 /* TemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
+ case 277 /* ShorthandPropertyAssignment */:
+ case 117 /* StaticKeyword */:
+ case 215 /* MetaProperty */:
// These nodes are ES6 syntax.
transformFlags |= 128 /* AssertES2015 */;
break;
@@ -30693,103 +30889,103 @@
case 9 /* BigIntLiteral */:
transformFlags |= 4 /* AssertESNext */;
break;
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
// This node is either ES2015 syntax or ES2017 syntax (if it is a for-await-of).
if (node.awaitModifier) {
transformFlags |= 16 /* AssertES2018 */;
}
transformFlags |= 128 /* AssertES2015 */;
break;
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
// This node is either ES2015 syntax (in a generator) or ES2017 syntax (in an async
// generator).
transformFlags |= 16 /* AssertES2018 */ | 128 /* AssertES2015 */ | 131072 /* ContainsYield */;
break;
- case 120 /* AnyKeyword */:
- case 135 /* NumberKeyword */:
- case 146 /* BigIntKeyword */:
- case 132 /* NeverKeyword */:
- case 136 /* ObjectKeyword */:
- case 138 /* StringKeyword */:
- case 123 /* BooleanKeyword */:
- case 139 /* SymbolKeyword */:
- case 106 /* VoidKeyword */:
- case 150 /* TypeParameter */:
- case 153 /* PropertySignature */:
- case 155 /* MethodSignature */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
- case 163 /* TypePredicate */:
- case 164 /* TypeReference */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 167 /* TypeQuery */:
- case 168 /* TypeLiteral */:
- case 169 /* ArrayType */:
- case 170 /* TupleType */:
- case 171 /* OptionalType */:
- case 172 /* RestType */:
- case 173 /* UnionType */:
- case 174 /* IntersectionType */:
- case 175 /* ConditionalType */:
- case 176 /* InferType */:
- case 177 /* ParenthesizedType */:
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 178 /* ThisType */:
- case 179 /* TypeOperator */:
- case 180 /* IndexedAccessType */:
- case 181 /* MappedType */:
- case 182 /* LiteralType */:
- case 247 /* NamespaceExportDeclaration */:
+ case 121 /* AnyKeyword */:
+ case 136 /* NumberKeyword */:
+ case 147 /* BigIntKeyword */:
+ case 133 /* NeverKeyword */:
+ case 137 /* ObjectKeyword */:
+ case 139 /* StringKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 107 /* VoidKeyword */:
+ case 151 /* TypeParameter */:
+ case 154 /* PropertySignature */:
+ case 156 /* MethodSignature */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
+ case 164 /* TypePredicate */:
+ case 165 /* TypeReference */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 168 /* TypeQuery */:
+ case 169 /* TypeLiteral */:
+ case 170 /* ArrayType */:
+ case 171 /* TupleType */:
+ case 172 /* OptionalType */:
+ case 173 /* RestType */:
+ case 174 /* UnionType */:
+ case 175 /* IntersectionType */:
+ case 176 /* ConditionalType */:
+ case 177 /* InferType */:
+ case 178 /* ParenthesizedType */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 179 /* ThisType */:
+ case 180 /* TypeOperator */:
+ case 181 /* IndexedAccessType */:
+ case 182 /* MappedType */:
+ case 183 /* LiteralType */:
+ case 248 /* NamespaceExportDeclaration */:
// Types and signatures are TypeScript syntax, and exclude all other facts.
transformFlags = 1 /* AssertTypeScript */;
excludeFlags = -2 /* TypeExcludes */;
break;
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
// Even though computed property names are ES6, we don't treat them as such.
// This is so that they can flow through PropertyName transforms unaffected.
// Instead, we mark the container as ES6, so that it can properly handle the transform.
transformFlags |= 16384 /* ContainsComputedPropertyName */;
break;
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
transformFlags |= 128 /* AssertES2015 */ | 4096 /* ContainsRestOrSpread */;
break;
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
transformFlags |= 16 /* AssertES2018 */ | 8192 /* ContainsObjectRestOrSpread */;
break;
- case 98 /* SuperKeyword */:
+ case 99 /* SuperKeyword */:
// This node is ES6 syntax.
transformFlags |= 128 /* AssertES2015 */;
excludeFlags = 536870912 /* OuterExpressionExcludes */; // must be set to persist `Super`
break;
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
// Mark this node and its ancestors as containing a lexical `this` keyword.
transformFlags |= 2048 /* ContainsLexicalThis */;
break;
- case 184 /* ObjectBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
transformFlags |= 128 /* AssertES2015 */ | 65536 /* ContainsBindingPattern */;
if (subtreeFlags & 4096 /* ContainsRestOrSpread */) {
transformFlags |= 16 /* AssertES2018 */ | 8192 /* ContainsObjectRestOrSpread */;
}
excludeFlags = 536875008 /* BindingPatternExcludes */;
break;
- case 185 /* ArrayBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
transformFlags |= 128 /* AssertES2015 */ | 65536 /* ContainsBindingPattern */;
excludeFlags = 536875008 /* BindingPatternExcludes */;
break;
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
transformFlags |= 128 /* AssertES2015 */;
if (node.dotDotDotToken) {
transformFlags |= 4096 /* ContainsRestOrSpread */;
}
break;
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
// This node is TypeScript syntax, and marks its container as also being TypeScript syntax.
transformFlags |= 1 /* AssertTypeScript */ | 1024 /* ContainsTypeScriptClassSyntax */;
break;
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
excludeFlags = 536896512 /* ObjectLiteralExcludes */;
if (subtreeFlags & 16384 /* ContainsComputedPropertyName */) {
// If an ObjectLiteralExpression contains a ComputedPropertyName, then it
@@ -30802,26 +30998,26 @@
transformFlags |= 16 /* AssertES2018 */;
}
break;
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
excludeFlags = 536875008 /* ArrayLiteralOrCallOrNewExcludes */;
break;
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
// A loop containing a block scoped binding *may* need to be transformed from ES6.
if (subtreeFlags & 32768 /* ContainsBlockScopedBinding */) {
transformFlags |= 128 /* AssertES2015 */;
}
break;
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
break;
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
// Return statements may require an `await` in ES2018.
transformFlags |= 262144 /* ContainsHoistedDeclarationOrCompletion */ | 16 /* AssertES2018 */;
break;
- case 228 /* ContinueStatement */:
- case 229 /* BreakStatement */:
+ case 229 /* ContinueStatement */:
+ case 230 /* BreakStatement */:
transformFlags |= 262144 /* ContainsHoistedDeclarationOrCompletion */;
break;
}
@@ -30839,67 +31035,67 @@
* than calling this function.
*/
function getTransformFlagsSubtreeExclusions(kind) {
- if (kind >= 163 /* FirstTypeNode */ && kind <= 183 /* LastTypeNode */) {
+ if (kind >= 164 /* FirstTypeNode */ && kind <= 184 /* LastTypeNode */) {
return -2 /* TypeExcludes */;
}
switch (kind) {
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
- case 187 /* ArrayLiteralExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
+ case 188 /* ArrayLiteralExpression */:
return 536875008 /* ArrayLiteralOrCallOrNewExcludes */;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return 537168896 /* ModuleExcludes */;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return 536870912 /* ParameterExcludes */;
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return 537371648 /* ArrowFunctionExcludes */;
- case 196 /* FunctionExpression */:
- case 239 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
return 537373696 /* FunctionExcludes */;
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
return 536944640 /* VariableDeclarationListExcludes */;
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
return 536888320 /* ClassExcludes */;
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return 537372672 /* ConstructorExcludes */;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return 537372672 /* MethodOrAccessorExcludes */;
- case 120 /* AnyKeyword */:
- case 135 /* NumberKeyword */:
- case 146 /* BigIntKeyword */:
- case 132 /* NeverKeyword */:
- case 138 /* StringKeyword */:
- case 136 /* ObjectKeyword */:
- case 123 /* BooleanKeyword */:
- case 139 /* SymbolKeyword */:
- case 106 /* VoidKeyword */:
- case 150 /* TypeParameter */:
- case 153 /* PropertySignature */:
- case 155 /* MethodSignature */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
+ case 121 /* AnyKeyword */:
+ case 136 /* NumberKeyword */:
+ case 147 /* BigIntKeyword */:
+ case 133 /* NeverKeyword */:
+ case 139 /* StringKeyword */:
+ case 137 /* ObjectKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 107 /* VoidKeyword */:
+ case 151 /* TypeParameter */:
+ case 154 /* PropertySignature */:
+ case 156 /* MethodSignature */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return -2 /* TypeExcludes */;
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return 536896512 /* ObjectLiteralExcludes */;
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return 536879104 /* CatchClauseExcludes */;
- case 184 /* ObjectBindingPattern */:
- case 185 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
return 536875008 /* BindingPatternExcludes */;
- case 194 /* TypeAssertionExpression */:
- case 212 /* AsExpression */:
- case 313 /* PartiallyEmittedExpression */:
- case 195 /* ParenthesizedExpression */:
- case 98 /* SuperKeyword */:
+ case 195 /* TypeAssertionExpression */:
+ case 213 /* AsExpression */:
+ case 314 /* PartiallyEmittedExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 99 /* SuperKeyword */:
return 536870912 /* OuterExpressionExcludes */;
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return 536870912 /* PropertyAccessExcludes */;
default:
return 536870912 /* NodeExcludes */;
@@ -31074,7 +31270,7 @@
// (their type resolved directly to the member deeply referenced)
// So to get the intervening symbols, we need to check if there's a type
// query node on any of the symbol's declarations and get symbols there
- if (d.type && d.type.kind === 167 /* TypeQuery */) {
+ if (d.type && d.type.kind === 168 /* TypeQuery */) {
var query = d.type;
var entity = getResolvedSymbol(getFirstIdentifier(query.exprName));
visitSymbol(entity);
@@ -31173,8 +31369,6 @@
undefinedSymbol.declarations = [];
var globalThisSymbol = createSymbol(1536 /* Module */, "globalThis", 8 /* Readonly */);
globalThisSymbol.exports = globals;
- globalThisSymbol.valueDeclaration = ts.createNode(72 /* Identifier */);
- globalThisSymbol.valueDeclaration.escapedText = "globalThis";
globals.set(globalThisSymbol.escapedName, globalThisSymbol);
var argumentsSymbol = createSymbol(4 /* Property */, "arguments");
var requireSymbol = createSymbol(4 /* Property */, "require");
@@ -31190,6 +31384,11 @@
getIdentifierCount: function () { return ts.sum(host.getSourceFiles(), "identifierCount"); },
getSymbolCount: function () { return ts.sum(host.getSourceFiles(), "symbolCount") + symbolCount; },
getTypeCount: function () { return typeCount; },
+ getRelationCacheSizes: function () { return ({
+ assignable: assignableRelation.size,
+ identity: identityRelation.size,
+ subtype: subtypeRelation.size,
+ }); },
isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; },
isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; },
isUnknownSymbol: function (symbol) { return symbol === unknownSymbol; },
@@ -31256,6 +31455,10 @@
node = ts.getParseTreeNode(node);
return node ? getTypeOfNode(node) : errorType;
},
+ getTypeOfAssignmentPattern: function (nodeIn) {
+ var node = ts.getParseTreeNode(nodeIn, ts.isAssignmentPattern);
+ return node && getTypeOfAssignmentPattern(node) || errorType;
+ },
getPropertySymbolOfDestructuringAssignment: function (locationIn) {
var location = ts.getParseTreeNode(locationIn, ts.isIdentifier);
return location ? getPropertySymbolOfDestructuringAssignment(location) : undefined;
@@ -31304,11 +31507,11 @@
},
isContextSensitive: isContextSensitive,
getFullyQualifiedName: getFullyQualifiedName,
- getResolvedSignature: function (node, candidatesOutArray, agumentCount) {
- return getResolvedSignatureWorker(node, candidatesOutArray, agumentCount, 0 /* Normal */);
+ getResolvedSignature: function (node, candidatesOutArray, argumentCount) {
+ return getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0 /* Normal */);
},
- getResolvedSignatureForSignatureHelp: function (node, candidatesOutArray, agumentCount) {
- return getResolvedSignatureWorker(node, candidatesOutArray, agumentCount, 16 /* IsForSignatureHelp */);
+ getResolvedSignatureForSignatureHelp: function (node, candidatesOutArray, argumentCount) {
+ return getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */);
},
getExpandedParameters: getExpandedParameters,
hasEffectiveRestParameter: hasEffectiveRestParameter,
@@ -31451,7 +31654,7 @@
var intersectionTypes = ts.createMap();
var literalTypes = ts.createMap();
var indexedAccessTypes = ts.createMap();
- var conditionalTypes = ts.createMap();
+ var substitutionTypes = ts.createMap();
var evolvingArrayTypes = [];
var undefinedProperties = ts.createMap();
var unknownSymbol = createSymbol(4 /* Property */, "unknown");
@@ -31531,6 +31734,7 @@
* This is only used if there is no exact match.
*/
var patternAmbientModules;
+ var patternAmbientModuleAugmentations;
var globalObjectType;
var globalFunctionType;
var globalCallableFunctionType;
@@ -31565,8 +31769,7 @@
var deferredGlobalTemplateStringsArrayType;
var deferredGlobalImportMetaType;
var deferredGlobalExtractSymbol;
- var deferredGlobalExcludeSymbol;
- var deferredGlobalPickSymbol;
+ var deferredGlobalOmitSymbol;
var deferredGlobalBigIntType;
var allPotentiallyUnusedIdentifiers = ts.createMap(); // key is file name
var flowLoopStart = 0;
@@ -31585,6 +31788,8 @@
var symbolLinks = [];
var nodeLinks = [];
var flowLoopCaches = [];
+ var flowAssignmentKeys = [];
+ var flowAssignmentTypes = [];
var flowLoopNodes = [];
var flowLoopKeys = [];
var flowLoopTypes = [];
@@ -31701,6 +31906,7 @@
var typeofType = createTypeofType();
var _jsxNamespace;
var _jsxFactoryEntity;
+ var outofbandVarianceMarkerHandler;
var subtypeRelation = ts.createMap();
var assignableRelation = ts.createMap();
var comparableRelation = ts.createMap();
@@ -31725,6 +31931,18 @@
CheckMode[CheckMode["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
CheckMode[CheckMode["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
})(CheckMode || (CheckMode = {}));
+ var ContextFlags;
+ (function (ContextFlags) {
+ ContextFlags[ContextFlags["None"] = 0] = "None";
+ ContextFlags[ContextFlags["Signature"] = 1] = "Signature";
+ })(ContextFlags || (ContextFlags = {}));
+ var AccessFlags;
+ (function (AccessFlags) {
+ AccessFlags[AccessFlags["None"] = 0] = "None";
+ AccessFlags[AccessFlags["NoIndexSignatures"] = 1] = "NoIndexSignatures";
+ AccessFlags[AccessFlags["Writing"] = 2] = "Writing";
+ AccessFlags[AccessFlags["CacheSymbol"] = 4] = "CacheSymbol";
+ })(AccessFlags || (AccessFlags = {}));
var CallbackCheck;
(function (CallbackCheck) {
CallbackCheck[CallbackCheck["None"] = 0] = "None";
@@ -31899,7 +32117,8 @@
* Note: if target is transient, then it is mutable, and mergeSymbol with both mutate and return it.
* If target is not transient, mergeSymbol will produce a transient clone, mutate that and return it.
*/
- function mergeSymbol(target, source) {
+ function mergeSymbol(target, source, unidirectional) {
+ if (unidirectional === void 0) { unidirectional = false; }
if (!(target.flags & getExcludedSymbolFlags(source.flags)) ||
(source.flags | target.flags) & 67108864 /* Assignment */) {
ts.Debug.assert(source !== target);
@@ -31927,18 +32146,25 @@
if (source.members) {
if (!target.members)
target.members = ts.createSymbolTable();
- mergeSymbolTable(target.members, source.members);
+ mergeSymbolTable(target.members, source.members, unidirectional);
}
if (source.exports) {
if (!target.exports)
target.exports = ts.createSymbolTable();
- mergeSymbolTable(target.exports, source.exports);
+ mergeSymbolTable(target.exports, source.exports, unidirectional);
}
+ if (!unidirectional) {
recordMergedSymbol(target, source);
}
+ }
else if (target.flags & 1024 /* NamespaceModule */) {
+ // Do not report an error when merging `var globalThis` with the built-in `globalThis`,
+ // as we will already report a "Declaration name conflicts..." error, and this error
+ // won't make much sense.
+ if (target !== globalThisSymbol) {
error(ts.getNameOfDeclaration(source.declarations[0]), ts.Diagnostics.Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity, symbolToString(target));
}
+ }
else { // error
var isEitherEnum = !!(target.flags & 384 /* Enum */ || source.flags & 384 /* Enum */);
var isEitherBlockScoped_1 = !!(target.flags & 2 /* BlockScopedVariable */ || source.flags & 2 /* BlockScopedVariable */);
@@ -32002,10 +32228,11 @@
mergeSymbolTable(combined, second);
return combined;
}
- function mergeSymbolTable(target, source) {
+ function mergeSymbolTable(target, source, unidirectional) {
+ if (unidirectional === void 0) { unidirectional = false; }
source.forEach(function (sourceSymbol, id) {
var targetSymbol = target.get(id);
- target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol) : sourceSymbol);
+ target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : sourceSymbol);
});
}
function mergeModuleAugmentation(moduleName) {
@@ -32026,14 +32253,29 @@
var moduleNotFoundError = !(moduleName.parent.parent.flags & 4194304 /* Ambient */)
? ts.Diagnostics.Invalid_module_name_in_augmentation_module_0_cannot_be_found
: undefined;
- var mainModule = resolveExternalModuleNameWorker(moduleName, moduleName, moduleNotFoundError, /*isForAugmentation*/ true);
- if (!mainModule) {
+ var mainModule_1 = resolveExternalModuleNameWorker(moduleName, moduleName, moduleNotFoundError, /*isForAugmentation*/ true);
+ if (!mainModule_1) {
return;
}
// obtain item referenced by 'export='
- mainModule = resolveExternalModuleSymbol(mainModule);
- if (mainModule.flags & 1920 /* Namespace */) {
- mainModule = mergeSymbol(mainModule, moduleAugmentation.symbol);
+ mainModule_1 = resolveExternalModuleSymbol(mainModule_1);
+ if (mainModule_1.flags & 1920 /* Namespace */) {
+ // If we’re merging an augmentation to a pattern ambient module, we want to
+ // perform the merge unidirectionally from the augmentation ('a.foo') to
+ // the pattern ('*.foo'), so that 'getMergedSymbol()' on a.foo gives you
+ // all the exports both from the pattern and from the augmentation, but
+ // 'getMergedSymbol()' on *.foo only gives you exports from *.foo.
+ if (ts.some(patternAmbientModules, function (module) { return mainModule_1 === module.symbol; })) {
+ var merged = mergeSymbol(moduleAugmentation.symbol, mainModule_1, /*unidirectional*/ true);
+ if (!patternAmbientModuleAugmentations) {
+ patternAmbientModuleAugmentations = ts.createMap();
+ }
+ // moduleName will be a StringLiteral since this is not `declare global`.
+ patternAmbientModuleAugmentations.set(moduleName.text, merged);
+ }
+ else {
+ mergeSymbol(mainModule_1, moduleAugmentation.symbol);
+ }
}
else {
// moduleName will be a StringLiteral since this is not `declare global`.
@@ -32067,7 +32309,7 @@
return nodeLinks[nodeId] || (nodeLinks[nodeId] = { flags: 0 });
}
function isGlobalSourceFile(node) {
- return node.kind === 284 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node);
+ return node.kind === 285 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node);
}
function getSymbol(symbols, name, meaning) {
if (meaning) {
@@ -32125,17 +32367,17 @@
}
if (declaration.pos <= usage.pos) {
// declaration is before usage
- if (declaration.kind === 186 /* BindingElement */) {
+ if (declaration.kind === 187 /* BindingElement */) {
// still might be illegal if declaration and usage are both binding elements (eg var [a = b, b = b] = [1, 2])
- var errorBindingElement = ts.getAncestor(usage, 186 /* BindingElement */);
+ var errorBindingElement = ts.getAncestor(usage, 187 /* BindingElement */);
if (errorBindingElement) {
return ts.findAncestor(errorBindingElement, ts.isBindingElement) !== ts.findAncestor(declaration, ts.isBindingElement) ||
declaration.pos < errorBindingElement.pos;
}
// or it might be illegal if usage happens before parent variable is declared (eg var [a] = a)
- return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 237 /* VariableDeclaration */), usage);
+ return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 238 /* VariableDeclaration */), usage);
}
- else if (declaration.kind === 237 /* VariableDeclaration */) {
+ else if (declaration.kind === 238 /* VariableDeclaration */) {
// still might be illegal if usage is in the initializer of the variable declaration (eg var a = a)
return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage);
}
@@ -32143,6 +32385,10 @@
// still might be illegal if the usage is within a computed property name in the class (eg class A { static p = "a"; [A.p]() {} })
return !ts.findAncestor(usage, function (n) { return ts.isComputedPropertyName(n) && n.parent.parent === declaration; });
}
+ else if (ts.isPropertyDeclaration(declaration)) {
+ // still might be illegal if a self-referencing property initializer (eg private x = this.x)
+ return !isPropertyImmediatelyReferencedWithinDeclaration(declaration, usage);
+ }
return true;
}
// declaration is after usage, but it can still be legal if usage is deferred:
@@ -32154,12 +32400,12 @@
// or if usage is in a type context:
// 1. inside a type query (typeof in type position)
// 2. inside a jsdoc comment
- if (usage.parent.kind === 257 /* ExportSpecifier */ || (usage.parent.kind === 254 /* ExportAssignment */ && usage.parent.isExportEquals)) {
+ if (usage.parent.kind === 258 /* ExportSpecifier */ || (usage.parent.kind === 255 /* ExportAssignment */ && usage.parent.isExportEquals)) {
// export specifiers do not use the variable, they only make it available for use
return true;
}
// When resolving symbols for exports, the `usage` location passed in can be the export site directly
- if (usage.kind === 254 /* ExportAssignment */ && usage.isExportEquals) {
+ if (usage.kind === 255 /* ExportAssignment */ && usage.isExportEquals) {
return true;
}
var container = ts.getEnclosingBlockScopeContainer(declaration);
@@ -32167,9 +32413,9 @@
function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) {
var container = ts.getEnclosingBlockScopeContainer(declaration);
switch (declaration.parent.parent.kind) {
- case 219 /* VariableStatement */:
- case 225 /* ForStatement */:
- case 227 /* ForOfStatement */:
+ case 220 /* VariableStatement */:
+ case 226 /* ForStatement */:
+ case 228 /* ForOfStatement */:
// variable statement/for/for-of statement case,
// use site should not be inside variable declaration (initializer of declaration or binding element)
if (isSameScopeDescendentOf(usage, declaration, container)) {
@@ -32190,16 +32436,16 @@
return true;
}
var initializerOfProperty = current.parent &&
- current.parent.kind === 154 /* PropertyDeclaration */ &&
+ current.parent.kind === 155 /* PropertyDeclaration */ &&
current.parent.initializer === current;
if (initializerOfProperty) {
if (ts.hasModifier(current.parent, 32 /* Static */)) {
- if (declaration.kind === 156 /* MethodDeclaration */) {
+ if (declaration.kind === 157 /* MethodDeclaration */) {
return true;
}
}
else {
- var isDeclarationInstanceProperty = declaration.kind === 154 /* PropertyDeclaration */ && !ts.hasModifier(declaration, 32 /* Static */);
+ var isDeclarationInstanceProperty = declaration.kind === 155 /* PropertyDeclaration */ && !ts.hasModifier(declaration, 32 /* Static */);
if (!isDeclarationInstanceProperty || ts.getContainingClass(usage) !== ts.getContainingClass(declaration)) {
return true;
}
@@ -32208,6 +32454,36 @@
return false;
});
}
+ function isPropertyImmediatelyReferencedWithinDeclaration(declaration, usage) {
+ // always legal if usage is after declaration
+ if (usage.end > declaration.end) {
+ return false;
+ }
+ // still might be legal if usage is deferred (e.g. x: any = () => this.x)
+ // otherwise illegal if immediately referenced within the declaration (e.g. x: any = this.x)
+ var ancestorChangingReferenceScope = ts.findAncestor(usage, function (node) {
+ if (node === declaration) {
+ return "quit";
+ }
+ switch (node.kind) {
+ case 198 /* ArrowFunction */:
+ case 155 /* PropertyDeclaration */:
+ return true;
+ case 219 /* Block */:
+ switch (node.parent.kind) {
+ case 159 /* GetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 160 /* SetAccessor */:
+ return true;
+ default:
+ return false;
+ }
+ default:
+ return false;
+ }
+ });
+ return ancestorChangingReferenceScope === undefined;
+ }
}
/**
* Resolve a given name for a given meaning at a given location. An error is reported if the name was not found and
@@ -32226,6 +32502,8 @@
var lastLocation;
var lastSelfReferenceLocation;
var propertyWithInvalidInitializer;
+ var associatedDeclarationForContainingInitializer;
+ var withinDeferredContext = false;
var errorLocation = location;
var grandparent;
var isInExternalModule = false;
@@ -32241,12 +32519,12 @@
// - parameters are only in the scope of function body
// This restriction does not apply to JSDoc comment types because they are parented
// at a higher level than type parameters would normally be
- if (meaning & result.flags & 67897832 /* Type */ && lastLocation.kind !== 296 /* JSDocComment */) {
+ if (meaning & result.flags & 67897832 /* Type */ && lastLocation.kind !== 297 /* JSDocComment */) {
useResult = result.flags & 262144 /* TypeParameter */
// type parameters are visible in parameter list, return type and type parameter list
? lastLocation === location.type ||
- lastLocation.kind === 151 /* Parameter */ ||
- lastLocation.kind === 150 /* TypeParameter */
+ lastLocation.kind === 152 /* Parameter */ ||
+ lastLocation.kind === 151 /* TypeParameter */
// local types not visible outside the function body
: false;
}
@@ -32263,13 +32541,13 @@
// however it is detected separately when checking initializers of parameters
// to make sure that they reference no variables declared after them.
useResult =
- lastLocation.kind === 151 /* Parameter */ ||
+ lastLocation.kind === 152 /* Parameter */ ||
(lastLocation === location.type &&
!!ts.findAncestor(result.valueDeclaration, ts.isParameter));
}
}
}
- else if (location.kind === 175 /* ConditionalType */) {
+ else if (location.kind === 176 /* ConditionalType */) {
// A type parameter declared using 'infer T' in a conditional type is visible only in
// the true branch of the conditional type.
useResult = lastLocation === location.trueType;
@@ -32282,15 +32560,16 @@
}
}
}
+ withinDeferredContext = withinDeferredContext || getIsDeferredContext(location, lastLocation);
switch (location.kind) {
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
if (!ts.isExternalOrCommonJsModule(location))
break;
isInExternalModule = true;
// falls through
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
var moduleExports = getSymbolOfNode(location).exports;
- if (location.kind === 284 /* SourceFile */ || ts.isAmbientModule(location)) {
+ if (location.kind === 285 /* SourceFile */ || ts.isAmbientModule(location)) {
// It's an external module. First see if the module has an export default and if the local
// name of that export default matches.
if (result = moduleExports.get("default" /* Default */)) {
@@ -32314,7 +32593,7 @@
var moduleExport = moduleExports.get(name);
if (moduleExport &&
moduleExport.flags === 2097152 /* Alias */ &&
- ts.getDeclarationOfKind(moduleExport, 257 /* ExportSpecifier */)) {
+ ts.getDeclarationOfKind(moduleExport, 258 /* ExportSpecifier */)) {
break;
}
}
@@ -32328,20 +32607,19 @@
}
}
break;
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
if (result = lookup(getSymbolOfNode(location).exports, name, meaning & 8 /* EnumMember */)) {
break loop;
}
break;
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
// TypeScript 1.0 spec (April 2014): 8.4.1
// Initializer expressions for instance member variables are evaluated in the scope
// of the class constructor body but are not permitted to reference parameters or
// local variables of the constructor. This effectively means that entities from outer scopes
// by the same name as a constructor parameter or local variable are inaccessible
// in initializer expressions for instance member variables.
- if (ts.isClassLike(location.parent) && !ts.hasModifier(location, 32 /* Static */)) {
+ if (!ts.hasModifier(location, 32 /* Static */)) {
var ctor = findConstructorDeclaration(location.parent);
if (ctor && ctor.locals) {
if (lookup(ctor.locals, name, meaning & 67220415 /* Value */)) {
@@ -32351,9 +32629,9 @@
}
}
break;
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
// The below is used to lookup type parameters within a class or interface, as they are added to the class/interface locals
// These can never be latebound, so the symbol's raw members are sufficient. `getMembersOfNode` cannot be used, as it would
// trigger resolving late-bound names, which we may already be in the process of doing while we're here!
@@ -32372,7 +32650,7 @@
}
break loop;
}
- if (location.kind === 209 /* ClassExpression */ && meaning & 32 /* Class */) {
+ if (location.kind === 210 /* ClassExpression */ && meaning & 32 /* Class */) {
var className = location.name;
if (className && name === className.escapedText) {
result = location.symbol;
@@ -32380,9 +32658,9 @@
}
}
break;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
// The type parameters of a class are not in scope in the base class expression.
- if (lastLocation === location.expression && location.parent.token === 86 /* ExtendsKeyword */) {
+ if (lastLocation === location.expression && location.parent.token === 87 /* ExtendsKeyword */) {
var container = location.parent.parent;
if (ts.isClassLike(container) && (result = lookup(getSymbolOfNode(container).members, name, meaning & 67897832 /* Type */))) {
if (nameNotFoundMessage) {
@@ -32400,9 +32678,9 @@
// [foo<T>()]() { } // <-- Reference to T from class's own computed property
// }
//
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
grandparent = location.parent.parent;
- if (ts.isClassLike(grandparent) || grandparent.kind === 241 /* InterfaceDeclaration */) {
+ if (ts.isClassLike(grandparent) || grandparent.kind === 242 /* InterfaceDeclaration */) {
// A reference to this grandparent's type parameters would be an error
if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 67897832 /* Type */)) {
error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
@@ -32410,24 +32688,24 @@
}
}
break;
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
// when targeting ES6 or higher there is no 'arguments' in an arrow function
// for lower compile targets the resolved symbol is used to emit an error
if (compilerOptions.target >= 2 /* ES2015 */) {
break;
}
// falls through
- case 156 /* MethodDeclaration */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 239 /* FunctionDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 240 /* FunctionDeclaration */:
if (meaning & 3 /* Variable */ && name === "arguments") {
result = argumentsSymbol;
break loop;
}
break;
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
if (meaning & 3 /* Variable */ && name === "arguments") {
result = argumentsSymbol;
break loop;
@@ -32440,7 +32718,7 @@
}
}
break;
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
// Decorators are resolved at the class declaration. Resolving at the parameter
// or member would result in looking up locals in the method.
//
@@ -32449,7 +32727,7 @@
// method(@y x, y) {} // <-- decorator y should be resolved at the class declaration, not the parameter.
// }
//
- if (location.parent && location.parent.kind === 151 /* Parameter */) {
+ if (location.parent && location.parent.kind === 152 /* Parameter */) {
location = location.parent;
}
//
@@ -32464,15 +32742,28 @@
// declare function y(x: T): any;
// @param(1 as T) // <-- T should resolve to the type alias outside of class C
// class C<T> {}
- if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 240 /* ClassDeclaration */)) {
+ if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 241 /* ClassDeclaration */)) {
location = location.parent;
}
break;
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
// js type aliases do not resolve names from their host, so skip past it
location = ts.getJSDocHost(location);
break;
+ case 152 /* Parameter */:
+ if (lastLocation && lastLocation === location.initializer) {
+ associatedDeclarationForContainingInitializer = location;
+ }
+ break;
+ case 187 /* BindingElement */:
+ if (lastLocation && lastLocation === location.initializer) {
+ var root = ts.getRootDeclaration(location);
+ if (root.kind === 152 /* Parameter */) {
+ associatedDeclarationForContainingInitializer = location;
+ }
+ }
+ break;
}
if (isSelfReferenceLocation(location)) {
lastSelfReferenceLocation = location;
@@ -32488,7 +32779,7 @@
}
if (!result) {
if (lastLocation) {
- ts.Debug.assert(lastLocation.kind === 284 /* SourceFile */);
+ ts.Debug.assert(lastLocation.kind === 285 /* SourceFile */);
if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) {
return lastLocation.symbol;
}
@@ -32564,20 +32855,48 @@
if (result && isInExternalModule && (meaning & 67220415 /* Value */) === 67220415 /* Value */ && !(originalLocation.flags & 2097152 /* JSDoc */)) {
var merged = getMergedSymbol(result);
if (ts.length(merged.declarations) && ts.every(merged.declarations, function (d) { return ts.isNamespaceExportDeclaration(d) || ts.isSourceFile(d) && !!d.symbol.globalExports; })) {
- error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, ts.unescapeLeadingUnderscores(name)); // TODO: GH#18217
+ errorOrSuggestion(!compilerOptions.allowUmdGlobalAccess, errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, ts.unescapeLeadingUnderscores(name));
+ }
+ }
+ // If we're in a parameter initializer, we can't reference the values of the parameter whose initializer we're within or parameters to the right
+ if (result && associatedDeclarationForContainingInitializer && !withinDeferredContext && (meaning & 67220415 /* Value */) === 67220415 /* Value */) {
+ var candidate = getMergedSymbol(getLateBoundSymbol(result));
+ var root = ts.getRootDeclaration(associatedDeclarationForContainingInitializer);
+ // A parameter initializer or binding pattern initializer within a parameter cannot refer to itself
+ if (candidate === getSymbolOfNode(associatedDeclarationForContainingInitializer)) {
+ error(errorLocation, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(associatedDeclarationForContainingInitializer.name));
+ }
+ // And it cannot refer to any declarations which come after it
+ else if (candidate.valueDeclaration && candidate.valueDeclaration.pos > associatedDeclarationForContainingInitializer.pos && root.parent.locals && lookup(root.parent.locals, candidate.escapedName, meaning) === candidate) {
+ error(errorLocation, ts.Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(associatedDeclarationForContainingInitializer.name), ts.declarationNameToString(errorLocation));
}
}
}
return result;
}
+ function getIsDeferredContext(location, lastLocation) {
+ if (location.kind !== 198 /* ArrowFunction */ && location.kind !== 197 /* FunctionExpression */) {
+ // initializers in instance property declaration of class like entities are executed in constructor and thus deferred
+ return ts.isTypeQueryNode(location) || ((ts.isFunctionLikeDeclaration(location) ||
+ (location.kind === 155 /* PropertyDeclaration */ && !ts.hasModifier(location, 32 /* Static */))) && (!lastLocation || lastLocation !== location.name)); // A name is evaluated within the enclosing scope - so it shouldn't count as deferred
+ }
+ if (lastLocation && lastLocation === location.name) {
+ return false;
+ }
+ // generator functions and async functions are not inlined in control flow when immediately invoked
+ if (location.asteriskToken || ts.hasModifier(location, 256 /* Async */)) {
+ return true;
+ }
+ return !ts.getImmediatelyInvokedFunctionExpression(location);
+ }
function isSelfReferenceLocation(node) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 244 /* ModuleDeclaration */: // For `namespace N { N; }`
+ case 240 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 245 /* ModuleDeclaration */: // For `namespace N { N; }`
return true;
default:
return false;
@@ -32589,7 +32908,7 @@
function isTypeParameterSymbolDeclaredInContainer(symbol, container) {
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var decl = _a[_i];
- if (decl.kind === 150 /* TypeParameter */) {
+ if (decl.kind === 151 /* TypeParameter */) {
var parent = ts.isJSDocTemplateTag(decl.parent) ? ts.getJSDocHost(decl.parent) : decl.parent;
if (parent === container) {
return !(ts.isJSDocTemplateTag(decl.parent) && ts.find(decl.parent.parent.tags, ts.isJSDocTypeAlias)); // TODO: GH#18217
@@ -32644,10 +32963,10 @@
*/
function getEntityNameForExtendingInterface(node) {
switch (node.kind) {
- case 72 /* Identifier */:
- case 189 /* PropertyAccessExpression */:
+ case 73 /* Identifier */:
+ case 190 /* PropertyAccessExpression */:
return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
if (ts.isEntityNameExpression(node.expression)) {
return node.expression;
}
@@ -32736,7 +33055,7 @@
function checkResolvedBlockScopedVariable(result, errorLocation) {
ts.Debug.assert(!!(result.flags & 2 /* BlockScopedVariable */ || result.flags & 32 /* Class */ || result.flags & 384 /* Enum */));
// Block-scoped variables cannot be used before their definition
- var declaration = ts.find(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 243 /* EnumDeclaration */) || ts.isInJSFile(d) && !!ts.getJSDocEnumTag(d); });
+ var declaration = ts.find(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 244 /* EnumDeclaration */) || ts.isInJSFile(d) && !!ts.getJSDocEnumTag(d); });
if (declaration === undefined)
return ts.Debug.fail("Declaration to checkResolvedBlockScopedVariable is undefined");
if (!(declaration.flags & 4194304 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) {
@@ -32771,13 +33090,13 @@
}
function getAnyImportSyntax(node) {
switch (node.kind) {
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return node;
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
return node.parent;
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
return node.parent.parent;
- case 253 /* ImportSpecifier */:
+ case 254 /* ImportSpecifier */:
return node.parent.parent.parent;
default:
return undefined;
@@ -32787,7 +33106,7 @@
return ts.find(symbol.declarations, ts.isAliasSymbolDeclaration);
}
function getTargetOfImportEqualsDeclaration(node, dontResolveAlias) {
- if (node.moduleReference.kind === 259 /* ExternalModuleReference */) {
+ if (node.moduleReference.kind === 260 /* ExternalModuleReference */) {
return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node)));
}
return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, dontResolveAlias);
@@ -32844,8 +33163,17 @@
var file = ts.find(moduleSymbol.declarations, ts.isSourceFile);
var hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias);
if (!exportDefaultSymbol && !hasSyntheticDefault) {
+ if (hasExportAssignmentSymbol(moduleSymbol)) {
+ var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop";
+ var exportEqualsSymbol = moduleSymbol.exports.get("export=" /* ExportEquals */);
+ var exportAssignment = exportEqualsSymbol.valueDeclaration;
+ var err = error(node.name, ts.Diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag, symbolToString(moduleSymbol), compilerOptionName);
+ ts.addRelatedInfo(err, ts.createDiagnosticForNode(exportAssignment, ts.Diagnostics.This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag, compilerOptionName));
+ }
+ else {
error(node.name, ts.Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol));
}
+ }
else if (hasSyntheticDefault) {
// per emit behavior, a synthetic default overrides a "real" .default member if `__esModule` is not present
return resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
@@ -32979,20 +33307,20 @@
function getTargetOfAliasDeclaration(node, dontRecursivelyResolve) {
if (dontRecursivelyResolve === void 0) { dontRecursivelyResolve = false; }
switch (node.kind) {
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return getTargetOfImportEqualsDeclaration(node, dontRecursivelyResolve);
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
return getTargetOfImportClause(node, dontRecursivelyResolve);
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
return getTargetOfNamespaceImport(node, dontRecursivelyResolve);
- case 253 /* ImportSpecifier */:
+ case 254 /* ImportSpecifier */:
return getTargetOfImportSpecifier(node, dontRecursivelyResolve);
- case 257 /* ExportSpecifier */:
+ case 258 /* ExportSpecifier */:
return getTargetOfExportSpecifier(node, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */, dontRecursivelyResolve);
- case 254 /* ExportAssignment */:
- case 204 /* BinaryExpression */:
+ case 255 /* ExportAssignment */:
+ case 205 /* BinaryExpression */:
return getTargetOfExportAssignment(node, dontRecursivelyResolve);
- case 247 /* NamespaceExportDeclaration */:
+ case 248 /* NamespaceExportDeclaration */:
return getTargetOfNamespaceExportDeclaration(node, dontRecursivelyResolve);
default:
return ts.Debug.fail();
@@ -33053,11 +33381,11 @@
var node = getDeclarationOfAliasSymbol(symbol);
if (!node)
return ts.Debug.fail();
- if (node.kind === 254 /* ExportAssignment */) {
+ if (node.kind === 255 /* ExportAssignment */) {
// export default <symbol>
checkExpressionCached(node.expression);
}
- else if (node.kind === 257 /* ExportSpecifier */) {
+ else if (node.kind === 258 /* ExportSpecifier */) {
// export { <symbol> } or export { <symbol> as foo }
checkExpressionCached(node.propertyName || node.name);
}
@@ -33075,17 +33403,17 @@
// import a = |b|; // Namespace
// import a = |b.c|; // Value, type, namespace
// import a = |b.c|.d; // Namespace
- if (entityName.kind === 72 /* Identifier */ && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {
+ if (entityName.kind === 73 /* Identifier */ && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {
entityName = entityName.parent;
}
// Check for case 1 and 3 in the above example
- if (entityName.kind === 72 /* Identifier */ || entityName.parent.kind === 148 /* QualifiedName */) {
+ if (entityName.kind === 73 /* Identifier */ || entityName.parent.kind === 149 /* QualifiedName */) {
return resolveEntityName(entityName, 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias);
}
else {
// Case 2 in above example
// entityName.kind could be a QualifiedName or a Missing identifier
- ts.Debug.assert(entityName.parent.kind === 248 /* ImportEqualsDeclaration */);
+ ts.Debug.assert(entityName.parent.kind === 249 /* ImportEqualsDeclaration */);
return resolveEntityName(entityName, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias);
}
}
@@ -33101,17 +33429,17 @@
}
var namespaceMeaning = 1920 /* Namespace */ | (ts.isInJSFile(name) ? meaning & 67220415 /* Value */ : 0);
var symbol;
- if (name.kind === 72 /* Identifier */) {
- var message = meaning === namespaceMeaning ? ts.Diagnostics.Cannot_find_namespace_0 : getCannotFindNameDiagnosticForName(getFirstIdentifier(name).escapedText);
+ if (name.kind === 73 /* Identifier */) {
+ var message = meaning === namespaceMeaning ? ts.Diagnostics.Cannot_find_namespace_0 : getCannotFindNameDiagnosticForName(getFirstIdentifier(name));
var symbolFromJSPrototype = ts.isInJSFile(name) ? resolveEntityNameFromAssignmentDeclaration(name, meaning) : undefined;
symbol = resolveName(location || name, name.escapedText, meaning, ignoreErrors || symbolFromJSPrototype ? undefined : message, name, /*isUse*/ true);
if (!symbol) {
return symbolFromJSPrototype;
}
}
- else if (name.kind === 148 /* QualifiedName */ || name.kind === 189 /* PropertyAccessExpression */) {
- var left = name.kind === 148 /* QualifiedName */ ? name.left : name.expression;
- var right = name.kind === 148 /* QualifiedName */ ? name.right : name.name;
+ else if (name.kind === 149 /* QualifiedName */ || name.kind === 190 /* PropertyAccessExpression */) {
+ var left = name.kind === 149 /* QualifiedName */ ? name.left : name.expression;
+ var right = name.kind === 149 /* QualifiedName */ ? name.right : name.name;
var namespace = resolveEntityName(left, namespaceMeaning, ignoreErrors, /*dontResolveAlias*/ false, location);
if (!namespace || ts.nodeIsMissing(right)) {
return undefined;
@@ -33246,6 +33574,14 @@
if (patternAmbientModules) {
var pattern = ts.findBestPatternMatch(patternAmbientModules, function (_) { return _.pattern; }, moduleReference);
if (pattern) {
+ // If the module reference matched a pattern ambient module ('*.foo') but there’s also a
+ // module augmentation by the specific name requested ('a.foo'), we store the merged symbol
+ // by the augmentation name ('a.foo'), because asking for *.foo should not give you exports
+ // from a.foo.
+ var augmentation = patternAmbientModuleAugmentations && patternAmbientModuleAugmentations.get(moduleReference);
+ if (augmentation) {
+ return getMergedSymbol(augmentation);
+ }
return getMergedSymbol(pattern.symbol);
}
}
@@ -33336,7 +33672,7 @@
function resolveESModuleSymbol(moduleSymbol, referencingLocation, dontResolveAlias) {
var symbol = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias);
if (!dontResolveAlias && symbol) {
- if (!(symbol.flags & (1536 /* Module */ | 3 /* Variable */)) && !ts.getDeclarationOfKind(symbol, 284 /* SourceFile */)) {
+ if (!(symbol.flags & (1536 /* Module */ | 3 /* Variable */)) && !ts.getDeclarationOfKind(symbol, 285 /* SourceFile */)) {
var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015
? "allowSyntheticDefaultImports"
: "esModuleInterop";
@@ -33598,7 +33934,7 @@
var members = node.members;
for (var _i = 0, members_2 = members; _i < members_2.length; _i++) {
var member = members_2[_i];
- if (member.kind === 157 /* Constructor */ && ts.nodeIsPresent(member.body)) {
+ if (member.kind === 158 /* Constructor */ && ts.nodeIsPresent(member.body)) {
return member;
}
}
@@ -33644,7 +33980,7 @@
return type;
}
// A reserved member name starts with two underscores, but the third character cannot be an underscore
- // or the @ symbol. A third underscore indicates an escaped form of an identifer that started
+ // or the @ symbol. A third underscore indicates an escaped form of an identifier that started
// with at least two underscores. The @ character indicates that the name is denoted by a well known ES
// Symbol instance.
function isReservedMemberName(name) {
@@ -33684,12 +34020,12 @@
}
}
switch (location.kind) {
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
if (!ts.isExternalOrCommonJsModule(location)) {
break;
}
// falls through
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
if (result = callback(getSymbolOfNode(location).exports)) {
return result;
}
@@ -33753,7 +34089,7 @@
&& (!useOnlyExternalAliasing || ts.some(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration))
// While exports are generally considered to be in scope, export-specifier declared symbols are _not_
// See similar comment in `resolveName` for details
- && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 257 /* ExportSpecifier */))) {
+ && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 258 /* ExportSpecifier */))) {
var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable);
if (isAccessible(symbolFromSymbolTable, resolvedImportedSymbol, ignoreQualification)) {
return [symbolFromSymbolTable];
@@ -33789,7 +34125,7 @@
return true;
}
// Qualify if the symbol from symbol table has same meaning as expected
- symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 257 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable;
+ symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 258 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable;
if (symbolFromSymbolTable.flags & meaning) {
qualify = true;
return true;
@@ -33804,10 +34140,10 @@
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
switch (declaration.kind) {
- case 154 /* PropertyDeclaration */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 155 /* PropertyDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
continue;
default:
return false;
@@ -33863,7 +34199,7 @@
var containers = getContainersOfSymbol(symbol, enclosingDeclaration);
// If we're trying to reference some object literal in, eg `var a = { x: 1 }`, the symbol for the literal, `__object`, is distinct
// from the symbol of the declaration it is being assigned to. Since we can use the declaration to refer to the literal, however,
- // we'd like to make that connection here - potentially causing us to paint the declararation's visibiility, and therefore the literal.
+ // we'd like to make that connection here - potentially causing us to paint the declaration's visibility, and therefore the literal.
var firstDecl = ts.first(symbol.declarations);
if (!ts.length(containers) && meaning & 67220415 /* Value */ && firstDecl && ts.isObjectLiteralExpression(firstDecl)) {
if (firstDecl.parent && ts.isVariableDeclaration(firstDecl.parent) && firstDecl === firstDecl.parent.initializer) {
@@ -33924,10 +34260,10 @@
return node && getSymbolOfNode(node);
}
function hasExternalModuleSymbol(declaration) {
- return ts.isAmbientModule(declaration) || (declaration.kind === 284 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration));
+ return ts.isAmbientModule(declaration) || (declaration.kind === 285 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration));
}
function hasNonGlobalAugmentationExternalModuleSymbol(declaration) {
- return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 284 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration));
+ return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 285 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration));
}
function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) {
var aliasesToMakeVisible;
@@ -33974,14 +34310,14 @@
function isEntityNameVisible(entityName, enclosingDeclaration) {
// get symbol of the first identifier of the entityName
var meaning;
- if (entityName.parent.kind === 167 /* TypeQuery */ ||
+ if (entityName.parent.kind === 168 /* TypeQuery */ ||
ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent) ||
- entityName.parent.kind === 149 /* ComputedPropertyName */) {
+ entityName.parent.kind === 150 /* ComputedPropertyName */) {
// Typeof value
meaning = 67220415 /* Value */ | 1048576 /* ExportValue */;
}
- else if (entityName.kind === 148 /* QualifiedName */ || entityName.kind === 189 /* PropertyAccessExpression */ ||
- entityName.parent.kind === 248 /* ImportEqualsDeclaration */) {
+ else if (entityName.kind === 149 /* QualifiedName */ || entityName.kind === 190 /* PropertyAccessExpression */ ||
+ entityName.parent.kind === 249 /* ImportEqualsDeclaration */) {
// Left identifier from type reference or TypeAlias
// Entity name of the import declaration
meaning = 1920 /* Namespace */;
@@ -34030,10 +34366,10 @@
function signatureToStringWorker(writer) {
var sigOutput;
if (flags & 262144 /* WriteArrowStyleSignature */) {
- sigOutput = kind === 1 /* Construct */ ? 166 /* ConstructorType */ : 165 /* FunctionType */;
+ sigOutput = kind === 1 /* Construct */ ? 167 /* ConstructorType */ : 166 /* FunctionType */;
}
else {
- sigOutput = kind === 1 /* Construct */ ? 161 /* ConstructSignature */ : 160 /* CallSignature */;
+ sigOutput = kind === 1 /* Construct */ ? 162 /* ConstructSignature */ : 161 /* CallSignature */;
}
var sig = nodeBuilder.signatureToSignatureDeclaration(signature, sigOutput, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | 512 /* WriteTypeParametersInQualifiedName */);
var printer = ts.createPrinter({ removeComments: true, omitTrailingSemicolon: true });
@@ -34060,6 +34396,15 @@
}
return result;
}
+ function getTypeNamesForErrorDisplay(left, right) {
+ var leftStr = typeToString(left);
+ var rightStr = typeToString(right);
+ if (leftStr === rightStr) {
+ leftStr = typeToString(left, /*enclosingDeclaration*/ undefined, 64 /* UseFullyQualifiedType */);
+ rightStr = typeToString(right, /*enclosingDeclaration*/ undefined, 64 /* UseFullyQualifiedType */);
+ }
+ return [leftStr, rightStr];
+ }
function toNodeBuilderFlags(flags) {
if (flags === void 0) { flags = 0 /* None */; }
return flags & 9469291 /* NodeBuilderFlagsMask */;
@@ -34128,26 +34473,26 @@
}
if (type.flags & 1 /* Any */) {
context.approximateLength += 3;
- return ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ return ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
if (type.flags & 2 /* Unknown */) {
- return ts.createKeywordTypeNode(143 /* UnknownKeyword */);
+ return ts.createKeywordTypeNode(144 /* UnknownKeyword */);
}
if (type.flags & 4 /* String */) {
context.approximateLength += 6;
- return ts.createKeywordTypeNode(138 /* StringKeyword */);
+ return ts.createKeywordTypeNode(139 /* StringKeyword */);
}
if (type.flags & 8 /* Number */) {
context.approximateLength += 6;
- return ts.createKeywordTypeNode(135 /* NumberKeyword */);
+ return ts.createKeywordTypeNode(136 /* NumberKeyword */);
}
if (type.flags & 64 /* BigInt */) {
context.approximateLength += 6;
- return ts.createKeywordTypeNode(146 /* BigIntKeyword */);
+ return ts.createKeywordTypeNode(147 /* BigIntKeyword */);
}
if (type.flags & 16 /* Boolean */) {
context.approximateLength += 7;
- return ts.createKeywordTypeNode(123 /* BooleanKeyword */);
+ return ts.createKeywordTypeNode(124 /* BooleanKeyword */);
}
if (type.flags & 1024 /* EnumLiteral */ && !(type.flags & 1048576 /* Union */)) {
var parentSymbol = getParentOfSymbol(type.symbol);
@@ -34165,8 +34510,9 @@
return ts.createLiteralTypeNode(ts.setEmitFlags(ts.createLiteral(type.value), 16777216 /* NoAsciiEscaping */));
}
if (type.flags & 256 /* NumberLiteral */) {
- context.approximateLength += (("" + type.value).length);
- return ts.createLiteralTypeNode((ts.createLiteral(type.value)));
+ var value = type.value;
+ context.approximateLength += ("" + value).length;
+ return ts.createLiteralTypeNode(value < 0 ? ts.createPrefix(39 /* MinusToken */, ts.createLiteral(-value)) : ts.createLiteral(value));
}
if (type.flags & 2048 /* BigIntLiteral */) {
context.approximateLength += (ts.pseudoBigIntToString(type.value).length) + 1;
@@ -34187,33 +34533,33 @@
}
}
context.approximateLength += 13;
- return ts.createTypeOperatorNode(142 /* UniqueKeyword */, ts.createKeywordTypeNode(139 /* SymbolKeyword */));
+ return ts.createTypeOperatorNode(143 /* UniqueKeyword */, ts.createKeywordTypeNode(140 /* SymbolKeyword */));
}
if (type.flags & 16384 /* Void */) {
context.approximateLength += 4;
- return ts.createKeywordTypeNode(106 /* VoidKeyword */);
+ return ts.createKeywordTypeNode(107 /* VoidKeyword */);
}
if (type.flags & 32768 /* Undefined */) {
context.approximateLength += 9;
- return ts.createKeywordTypeNode(141 /* UndefinedKeyword */);
+ return ts.createKeywordTypeNode(142 /* UndefinedKeyword */);
}
if (type.flags & 65536 /* Null */) {
context.approximateLength += 4;
- return ts.createKeywordTypeNode(96 /* NullKeyword */);
+ return ts.createKeywordTypeNode(97 /* NullKeyword */);
}
if (type.flags & 131072 /* Never */) {
context.approximateLength += 5;
- return ts.createKeywordTypeNode(132 /* NeverKeyword */);
+ return ts.createKeywordTypeNode(133 /* NeverKeyword */);
}
if (type.flags & 4096 /* ESSymbol */) {
context.approximateLength += 6;
- return ts.createKeywordTypeNode(139 /* SymbolKeyword */);
+ return ts.createKeywordTypeNode(140 /* SymbolKeyword */);
}
if (type.flags & 67108864 /* NonPrimitive */) {
context.approximateLength += 6;
- return ts.createKeywordTypeNode(136 /* ObjectKeyword */);
+ return ts.createKeywordTypeNode(137 /* ObjectKeyword */);
}
- if (type.flags & 262144 /* TypeParameter */ && type.isThisType) {
+ if (isThisTypeParameter(type)) {
if (context.flags & 4194304 /* InObjectTypeLiteral */) {
if (!context.encounteredError && !(context.flags & 32768 /* AllowThisInObjectLiteral */)) {
context.encounteredError = true;
@@ -34263,7 +34609,7 @@
}
var typeNodes = mapToTypeNodes(types, context, /*isBareList*/ true);
if (typeNodes && typeNodes.length > 0) {
- var unionOrIntersectionTypeNode = ts.createUnionOrIntersectionTypeNode(type.flags & 1048576 /* Union */ ? 173 /* UnionType */ : 174 /* IntersectionType */, typeNodes);
+ var unionOrIntersectionTypeNode = ts.createUnionOrIntersectionTypeNode(type.flags & 1048576 /* Union */ ? 174 /* UnionType */ : 175 /* IntersectionType */, typeNodes);
return unionOrIntersectionTypeNode;
}
else {
@@ -34296,8 +34642,8 @@
context.inferTypeParameters = type.root.inferTypeParameters;
var extendsTypeNode = typeToTypeNodeHelper(type.extendsType, context);
context.inferTypeParameters = saveInferTypeParameters;
- var trueTypeNode = typeToTypeNodeHelper(type.trueType, context);
- var falseTypeNode = typeToTypeNodeHelper(type.falseType, context);
+ var trueTypeNode = typeToTypeNodeHelper(getTrueTypeFromConditionalType(type), context);
+ var falseTypeNode = typeToTypeNodeHelper(getFalseTypeFromConditionalType(type), context);
context.approximateLength += 15;
return ts.createConditionalTypeNode(checkTypeNode, extendsTypeNode, trueTypeNode, falseTypeNode);
}
@@ -34337,7 +34683,7 @@
return symbolToTypeNode(symbol, context, isInstanceType);
}
// Always use 'typeof T' for type of class, enum, and module objects
- else if (symbol.flags & 32 /* Class */ && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration.kind === 209 /* ClassExpression */ && context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */) ||
+ else if (symbol.flags & 32 /* Class */ && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration.kind === 210 /* ClassExpression */ && context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */) ||
symbol.flags & (384 /* Enum */ | 512 /* ValueModule */) ||
shouldWriteTypeOfFunctionSymbol()) {
return symbolToTypeNode(symbol, context, 67220415 /* Value */);
@@ -34384,7 +34730,7 @@
var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) &&
(symbol.parent || // is exported function symbol
ts.forEach(symbol.declarations, function (declaration) {
- return declaration.parent.kind === 284 /* SourceFile */ || declaration.parent.kind === 245 /* ModuleBlock */;
+ return declaration.parent.kind === 285 /* SourceFile */ || declaration.parent.kind === 246 /* ModuleBlock */;
}));
if (isStaticMethodSymbol || isNonLocalFunctionSymbol) {
// typeof is allowed only for static/non local functions
@@ -34405,12 +34751,12 @@
}
if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) {
var signature = resolved.callSignatures[0];
- var signatureNode = signatureToSignatureDeclarationHelper(signature, 165 /* FunctionType */, context);
+ var signatureNode = signatureToSignatureDeclarationHelper(signature, 166 /* FunctionType */, context);
return signatureNode;
}
if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) {
var signature = resolved.constructSignatures[0];
- var signatureNode = signatureToSignatureDeclarationHelper(signature, 166 /* ConstructorType */, context);
+ var signatureNode = signatureToSignatureDeclarationHelper(signature, 167 /* ConstructorType */, context);
return signatureNode;
}
}
@@ -34431,7 +34777,7 @@
}
var elementType = typeToTypeNodeHelper(typeArguments[0], context);
var arrayType = ts.createArrayTypeNode(elementType);
- return type.target === globalArrayType ? arrayType : ts.createTypeOperatorNode(133 /* ReadonlyKeyword */, arrayType);
+ return type.target === globalArrayType ? arrayType : ts.createTypeOperatorNode(134 /* ReadonlyKeyword */, arrayType);
}
else if (type.target.objectFlags & 8 /* Tuple */) {
if (typeArguments.length > 0) {
@@ -34445,12 +34791,12 @@
ts.createOptionalTypeNode(tupleConstituentNodes[i]);
}
var tupleTypeNode = ts.createTupleTypeNode(tupleConstituentNodes);
- return type.target.readonly ? ts.createTypeOperatorNode(133 /* ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode;
+ return type.target.readonly ? ts.createTypeOperatorNode(134 /* ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode;
}
}
if (context.encounteredError || (context.flags & 524288 /* AllowEmptyTuple */)) {
var tupleTypeNode = ts.createTupleTypeNode([]);
- return type.target.readonly ? ts.createTypeOperatorNode(133 /* ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode;
+ return type.target.readonly ? ts.createTypeOperatorNode(134 /* ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode;
}
context.encounteredError = true;
return undefined; // TODO: GH#18217
@@ -34545,11 +34891,11 @@
var typeElements = [];
for (var _i = 0, _a = resolvedType.callSignatures; _i < _a.length; _i++) {
var signature = _a[_i];
- typeElements.push(signatureToSignatureDeclarationHelper(signature, 160 /* CallSignature */, context));
+ typeElements.push(signatureToSignatureDeclarationHelper(signature, 161 /* CallSignature */, context));
}
for (var _b = 0, _c = resolvedType.constructSignatures; _b < _c.length; _b++) {
var signature = _c[_b];
- typeElements.push(signatureToSignatureDeclarationHelper(signature, 161 /* ConstructSignature */, context));
+ typeElements.push(signatureToSignatureDeclarationHelper(signature, 162 /* ConstructSignature */, context));
}
if (resolvedType.stringIndexInfo) {
var indexSignature = void 0;
@@ -34596,15 +34942,15 @@
if (!(context.flags & 1 /* NoTruncation */)) {
return ts.createTypeReferenceNode(ts.createIdentifier("..."), /*typeArguments*/ undefined);
}
- return ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ return ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
function addPropertyToElementList(propertySymbol, context, typeElements) {
- var propertyIsReverseMapped = !!(ts.getCheckFlags(propertySymbol) & 4096 /* ReverseMapped */);
+ var propertyIsReverseMapped = !!(ts.getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */);
var propertyType = propertyIsReverseMapped && context.flags & 33554432 /* InReverseMappedType */ ?
anyType : getTypeOfSymbol(propertySymbol);
var saveEnclosingDeclaration = context.enclosingDeclaration;
context.enclosingDeclaration = undefined;
- if (context.tracker.trackSymbol && ts.getCheckFlags(propertySymbol) & 2048 /* Late */) {
+ if (context.tracker.trackSymbol && ts.getCheckFlags(propertySymbol) & 4096 /* Late */) {
var decl = ts.first(propertySymbol.declarations);
if (hasLateBindableName(decl)) {
trackComputedName(decl.name, saveEnclosingDeclaration, context);
@@ -34618,7 +34964,7 @@
var signatures = getSignaturesOfType(propertyType, 0 /* Call */);
for (var _i = 0, signatures_1 = signatures; _i < signatures_1.length; _i++) {
var signature = signatures_1[_i];
- var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 155 /* MethodSignature */, context);
+ var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 156 /* MethodSignature */, context);
methodDeclaration.name = propertyName;
methodDeclaration.questionToken = optionalToken;
if (propertySymbol.valueDeclaration) {
@@ -34636,10 +34982,10 @@
propertyTypeNode = createElidedInformationPlaceholder(context);
}
else {
- propertyTypeNode = propertyType ? typeToTypeNodeHelper(propertyType, context) : ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ propertyTypeNode = propertyType ? typeToTypeNodeHelper(propertyType, context) : ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
context.flags = savedFlags;
- var modifiers = isReadonlySymbol(propertySymbol) ? [ts.createToken(133 /* ReadonlyKeyword */)] : undefined;
+ var modifiers = isReadonlySymbol(propertySymbol) ? [ts.createToken(134 /* ReadonlyKeyword */)] : undefined;
if (modifiers) {
context.approximateLength += 9;
}
@@ -34690,7 +35036,7 @@
}
function indexInfoToIndexSignatureDeclarationHelper(indexInfo, kind, context) {
var name = ts.getNameFromIndexInfo(indexInfo) || "x";
- var indexerTypeNode = ts.createKeywordTypeNode(kind === 0 /* String */ ? 138 /* StringKeyword */ : 135 /* NumberKeyword */);
+ var indexerTypeNode = ts.createKeywordTypeNode(kind === 0 /* String */ ? 139 /* StringKeyword */ : 136 /* NumberKeyword */);
var indexingParameter = ts.createParameter(
/*decorators*/ undefined,
/*modifiers*/ undefined,
@@ -34703,7 +35049,7 @@
}
context.approximateLength += (name.length + 4);
return ts.createIndexSignature(
- /*decorators*/ undefined, indexInfo.isReadonly ? [ts.createToken(133 /* ReadonlyKeyword */)] : undefined, [indexingParameter], typeNode);
+ /*decorators*/ undefined, indexInfo.isReadonly ? [ts.createToken(134 /* ReadonlyKeyword */)] : undefined, [indexingParameter], typeNode);
}
function signatureToSignatureDeclarationHelper(signature, kind, context) {
var typeParameters;
@@ -34714,7 +35060,7 @@
else {
typeParameters = signature.typeParameters && signature.typeParameters.map(function (parameter) { return typeParameterToDeclaration(parameter, context); });
}
- var parameters = getExpandedParameters(signature).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 157 /* Constructor */); });
+ var parameters = getExpandedParameters(signature).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 158 /* Constructor */); });
if (signature.thisParameter) {
var thisParameter = symbolToParameterDeclaration(signature.thisParameter, context);
parameters.unshift(thisParameter);
@@ -34733,12 +35079,12 @@
returnTypeNode = returnType && typeToTypeNodeHelper(returnType, context);
}
if (context.flags & 256 /* SuppressAnyReturnType */) {
- if (returnTypeNode && returnTypeNode.kind === 120 /* AnyKeyword */) {
+ if (returnTypeNode && returnTypeNode.kind === 121 /* AnyKeyword */) {
returnTypeNode = undefined;
}
}
else if (!returnTypeNode) {
- returnTypeNode = ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ returnTypeNode = ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
context.approximateLength += 3; // Usually a signature contributes a few more characters than this, but 3 is the minimum
return ts.createSignatureDeclaration(kind, typeParameters, parameters, returnTypeNode, typeArguments);
@@ -34767,9 +35113,9 @@
return typeParameterToDeclarationWithConstraint(type, context, constraintNode);
}
function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags) {
- var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 151 /* Parameter */);
+ var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 152 /* Parameter */);
if (!parameterDeclaration && !isTransientSymbol(parameterSymbol)) {
- parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 304 /* JSDocParameterTag */);
+ parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 305 /* JSDocParameterTag */);
}
var parameterType = getTypeOfSymbol(parameterSymbol);
if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) {
@@ -34777,16 +35123,16 @@
}
var parameterTypeNode = typeToTypeNodeHelper(parameterType, context);
var modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && preserveModifierFlags && parameterDeclaration && parameterDeclaration.modifiers ? parameterDeclaration.modifiers.map(ts.getSynthesizedClone) : undefined;
- var isRest = parameterDeclaration && ts.isRestParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 16384 /* RestParameter */;
+ var isRest = parameterDeclaration && ts.isRestParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 32768 /* RestParameter */;
var dotDotDotToken = isRest ? ts.createToken(25 /* DotDotDotToken */) : undefined;
var name = parameterDeclaration
? parameterDeclaration.name ?
- parameterDeclaration.name.kind === 72 /* Identifier */ ? ts.setEmitFlags(ts.getSynthesizedClone(parameterDeclaration.name), 16777216 /* NoAsciiEscaping */) :
- parameterDeclaration.name.kind === 148 /* QualifiedName */ ? ts.setEmitFlags(ts.getSynthesizedClone(parameterDeclaration.name.right), 16777216 /* NoAsciiEscaping */) :
+ parameterDeclaration.name.kind === 73 /* Identifier */ ? ts.setEmitFlags(ts.getSynthesizedClone(parameterDeclaration.name), 16777216 /* NoAsciiEscaping */) :
+ parameterDeclaration.name.kind === 149 /* QualifiedName */ ? ts.setEmitFlags(ts.getSynthesizedClone(parameterDeclaration.name.right), 16777216 /* NoAsciiEscaping */) :
cloneBindingName(parameterDeclaration.name) :
ts.symbolName(parameterSymbol)
: ts.symbolName(parameterSymbol);
- var isOptional = parameterDeclaration && isOptionalParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 8192 /* OptionalParameter */;
+ var isOptional = parameterDeclaration && isOptionalParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 16384 /* OptionalParameter */;
var questionToken = isOptional ? ts.createToken(56 /* QuestionToken */) : undefined;
var parameterNode = ts.createParameter(
/*decorators*/ undefined, modifiers, dotDotDotToken, name, questionToken, parameterTypeNode,
@@ -34801,7 +35147,7 @@
}
var visited = ts.visitEachChild(node, elideInitializerAndSetEmitFlags, ts.nullTransformationContext, /*nodesVisitor*/ undefined, elideInitializerAndSetEmitFlags);
var clone = ts.nodeIsSynthesized(visited) ? visited : ts.getSynthesizedClone(visited);
- if (clone.kind === 186 /* BindingElement */) {
+ if (clone.kind === 187 /* BindingElement */) {
clone.initializer = undefined;
}
return ts.setEmitFlags(clone, 1 /* SingleLine */ | 16777216 /* NoAsciiEscaping */);
@@ -34903,6 +35249,11 @@
function lookupTypeParameterNodes(chain, index, context) {
ts.Debug.assert(chain && 0 <= index && index < chain.length);
var symbol = chain[index];
+ var symbolId = "" + getSymbolId(symbol);
+ if (context.typeParameterSymbolList && context.typeParameterSymbolList.get(symbolId)) {
+ return undefined;
+ }
+ (context.typeParameterSymbolList || (context.typeParameterSymbolList = ts.createMap())).set(symbolId, true);
var typeParameterNodes;
if (context.flags & 512 /* WriteTypeParametersInQualifiedName */ && index < (chain.length - 1)) {
var parentSymbol = symbol;
@@ -34927,7 +35278,7 @@
return top;
}
function getSpecifierForModuleSymbol(symbol, context) {
- var file = ts.getDeclarationOfKind(symbol, 284 /* SourceFile */);
+ var file = ts.getDeclarationOfKind(symbol, 285 /* SourceFile */);
if (file && file.moduleName !== undefined) {
// Use the amd name if it is available
return file.moduleName;
@@ -35167,8 +35518,8 @@
}
function getTypeAliasForTypeLiteral(type) {
if (type.symbol && type.symbol.flags & 2048 /* TypeLiteral */) {
- var node = ts.findAncestor(type.symbol.declarations[0].parent, function (n) { return n.kind !== 177 /* ParenthesizedType */; });
- if (node.kind === 242 /* TypeAliasDeclaration */) {
+ var node = ts.findAncestor(type.symbol.declarations[0].parent, function (n) { return n.kind !== 178 /* ParenthesizedType */; });
+ if (node.kind === 243 /* TypeAliasDeclaration */) {
return getSymbolOfNode(node);
}
}
@@ -35176,11 +35527,11 @@
}
function isTopLevelInExternalModuleAugmentation(node) {
return node && node.parent &&
- node.parent.kind === 245 /* ModuleBlock */ &&
+ node.parent.kind === 246 /* ModuleBlock */ &&
ts.isExternalModuleAugmentation(node.parent.parent);
}
function isDefaultBindingContext(location) {
- return location.kind === 284 /* SourceFile */ || ts.isAmbientModule(location);
+ return location.kind === 285 /* SourceFile */ || ts.isAmbientModule(location);
}
function getNameOfSymbolFromNameType(symbol, context) {
var nameType = symbol.nameType;
@@ -35221,7 +35572,7 @@
if (ts.isCallExpression(declaration) && ts.isBindableObjectDefinePropertyCall(declaration)) {
return ts.symbolName(symbol);
}
- if (ts.isComputedPropertyName(name_2) && !(ts.getCheckFlags(symbol) & 2048 /* Late */) && symbol.nameType && symbol.nameType.flags & 384 /* StringOrNumberLiteral */) {
+ if (ts.isComputedPropertyName(name_2) && !(ts.getCheckFlags(symbol) & 4096 /* Late */) && symbol.nameType && symbol.nameType.flags & 384 /* StringOrNumberLiteral */) {
// Computed property name isn't late bound, but has a well-known name type - use name type to generate a symbol name
var result = getNameOfSymbolFromNameType(symbol, context);
if (result !== undefined) {
@@ -35230,17 +35581,17 @@
}
return ts.declarationNameToString(name_2);
}
- if (declaration.parent && declaration.parent.kind === 237 /* VariableDeclaration */) {
+ if (declaration.parent && declaration.parent.kind === 238 /* VariableDeclaration */) {
return ts.declarationNameToString(declaration.parent.name);
}
switch (declaration.kind) {
- case 209 /* ClassExpression */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 210 /* ClassExpression */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
if (context && !context.encounteredError && !(context.flags & 131072 /* AllowAnonymousIdentifier */)) {
context.encounteredError = true;
}
- return declaration.kind === 209 /* ClassExpression */ ? "(Anonymous class)" : "(Anonymous function)";
+ return declaration.kind === 210 /* ClassExpression */ ? "(Anonymous class)" : "(Anonymous function)";
}
}
var name = getNameOfSymbolFromNameType(symbol, context);
@@ -35257,27 +35608,27 @@
return false;
function determineIfDeclarationIsVisible() {
switch (node.kind) {
- case 302 /* JSDocCallbackTag */:
- case 309 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
// Top-level jsdoc type aliases are considered exported
// First parent is comment node, second is hosting declaration or token; we only care about those tokens or declarations whose parent is a source file
return !!(node.parent && node.parent.parent && node.parent.parent.parent && ts.isSourceFile(node.parent.parent.parent));
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return isDeclarationVisible(node.parent.parent);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
if (ts.isBindingPattern(node.name) &&
!node.name.elements.length) {
// If the binding pattern is empty, this variable declaration is not visible
return false;
}
// falls through
- case 244 /* ModuleDeclaration */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 239 /* FunctionDeclaration */:
- case 243 /* EnumDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
// external module augmentation is always visible
if (ts.isExternalModuleAugmentation(node)) {
return true;
@@ -35285,53 +35636,53 @@
var parent = getDeclarationContainer(node);
// If the node is not exported or it is not ambient module element (except import declaration)
if (!(ts.getCombinedModifierFlags(node) & 1 /* Export */) &&
- !(node.kind !== 248 /* ImportEqualsDeclaration */ && parent.kind !== 284 /* SourceFile */ && parent.flags & 4194304 /* Ambient */)) {
+ !(node.kind !== 249 /* ImportEqualsDeclaration */ && parent.kind !== 285 /* SourceFile */ && parent.flags & 4194304 /* Ambient */)) {
return isGlobalSourceFile(parent);
}
// Exported members/ambient module elements (exception import declaration) are visible if parent is visible
return isDeclarationVisible(parent);
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
if (ts.hasModifier(node, 8 /* Private */ | 16 /* Protected */)) {
// Private/protected properties/methods are not visible
return false;
}
// Public properties/methods are visible if its parents are visible, so:
// falls through
- case 157 /* Constructor */:
- case 161 /* ConstructSignature */:
- case 160 /* CallSignature */:
- case 162 /* IndexSignature */:
- case 151 /* Parameter */:
- case 245 /* ModuleBlock */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 168 /* TypeLiteral */:
- case 164 /* TypeReference */:
- case 169 /* ArrayType */:
- case 170 /* TupleType */:
- case 173 /* UnionType */:
- case 174 /* IntersectionType */:
- case 177 /* ParenthesizedType */:
+ case 158 /* Constructor */:
+ case 162 /* ConstructSignature */:
+ case 161 /* CallSignature */:
+ case 163 /* IndexSignature */:
+ case 152 /* Parameter */:
+ case 246 /* ModuleBlock */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 169 /* TypeLiteral */:
+ case 165 /* TypeReference */:
+ case 170 /* ArrayType */:
+ case 171 /* TupleType */:
+ case 174 /* UnionType */:
+ case 175 /* IntersectionType */:
+ case 178 /* ParenthesizedType */:
return isDeclarationVisible(node.parent);
// Default binding, import specifier and namespace import is visible
// only on demand so by default it is not visible
- case 250 /* ImportClause */:
- case 251 /* NamespaceImport */:
- case 253 /* ImportSpecifier */:
+ case 251 /* ImportClause */:
+ case 252 /* NamespaceImport */:
+ case 254 /* ImportSpecifier */:
return false;
// Type parameters are always visible
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
// Source file and namespace export are always visible
- case 284 /* SourceFile */:
- case 247 /* NamespaceExportDeclaration */:
+ case 285 /* SourceFile */:
+ case 248 /* NamespaceExportDeclaration */:
return true;
// Export assignments do not create name bindings outside the module
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return false;
default:
return false;
@@ -35340,10 +35691,10 @@
}
function collectLinkedAliases(node, setVisibility) {
var exportSymbol;
- if (node.parent && node.parent.kind === 254 /* ExportAssignment */) {
+ if (node.parent && node.parent.kind === 255 /* ExportAssignment */) {
exportSymbol = resolveName(node, node.escapedText, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */, /*nameNotFoundMessage*/ undefined, node, /*isUse*/ false);
}
- else if (node.parent.kind === 257 /* ExportSpecifier */) {
+ else if (node.parent.kind === 258 /* ExportSpecifier */) {
exportSymbol = getTargetOfExportSpecifier(node.parent, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */);
}
var result;
@@ -35439,12 +35790,12 @@
function getDeclarationContainer(node) {
return ts.findAncestor(ts.getRootDeclaration(node), function (node) {
switch (node.kind) {
- case 237 /* VariableDeclaration */:
- case 238 /* VariableDeclarationList */:
- case 253 /* ImportSpecifier */:
- case 252 /* NamedImports */:
- case 251 /* NamespaceImport */:
- case 250 /* ImportClause */:
+ case 238 /* VariableDeclaration */:
+ case 239 /* VariableDeclarationList */:
+ case 254 /* ImportSpecifier */:
+ case 253 /* NamedImports */:
+ case 252 /* NamespaceImport */:
+ case 251 /* ImportClause */:
return false;
default:
return true;
@@ -35477,7 +35828,7 @@
return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, /*includeOptionality*/ false);
}
function isComputedNonLiteralName(name) {
- return name.kind === 149 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteralLike(name.expression);
+ return name.kind === 150 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteralLike(name.expression);
}
function getRestType(source, properties, symbol) {
source = filterType(source, function (t) { return !(t.flags & 98304 /* Nullable */); });
@@ -35492,13 +35843,11 @@
if (omitKeyType.flags & 131072 /* Never */) {
return source;
}
- var pickTypeAlias = getGlobalPickSymbol();
- var excludeTypeAlias = getGlobalExcludeSymbol();
- if (!pickTypeAlias || !excludeTypeAlias) {
+ var omitTypeAlias = getGlobalOmitSymbol();
+ if (!omitTypeAlias) {
return errorType;
}
- var pickKeys = getTypeAliasInstantiation(excludeTypeAlias, [getIndexType(source), omitKeyType]);
- return getTypeAliasInstantiation(pickTypeAlias, [source, pickKeys]);
+ return getTypeAliasInstantiation(omitTypeAlias, [source, omitKeyType]);
}
var members = ts.createSymbolTable();
for (var _i = 0, _a = getPropertiesOfType(source); _i < _a.length; _i++) {
@@ -35531,7 +35880,7 @@
if (parentAccess && parentAccess.flowNode) {
var propName = getDestructuringPropertyName(node);
if (propName) {
- var result = ts.createNode(190 /* ElementAccessExpression */, node.pos, node.end);
+ var result = ts.createNode(191 /* ElementAccessExpression */, node.pos, node.end);
result.parent = node;
result.expression = parentAccess;
var literal = ts.createNode(10 /* StringLiteral */, node.pos, node.end);
@@ -35546,23 +35895,23 @@
function getParentElementAccess(node) {
var ancestor = node.parent.parent;
switch (ancestor.kind) {
- case 186 /* BindingElement */:
- case 275 /* PropertyAssignment */:
+ case 187 /* BindingElement */:
+ case 276 /* PropertyAssignment */:
return getSyntheticElementAccess(ancestor);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return getSyntheticElementAccess(node.parent);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return ancestor.initializer;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return ancestor.right;
}
}
function getDestructuringPropertyName(node) {
var parent = node.parent;
- if (node.kind === 186 /* BindingElement */ && parent.kind === 184 /* ObjectBindingPattern */) {
+ if (node.kind === 187 /* BindingElement */ && parent.kind === 185 /* ObjectBindingPattern */) {
return getLiteralPropertyNameText(node.propertyName || node.name);
}
- if (node.kind === 275 /* PropertyAssignment */ || node.kind === 276 /* ShorthandPropertyAssignment */) {
+ if (node.kind === 276 /* PropertyAssignment */ || node.kind === 277 /* ShorthandPropertyAssignment */) {
return getLiteralPropertyNameText(node.name);
}
return "" + parent.elements.indexOf(node);
@@ -35584,7 +35933,7 @@
parentType = getNonNullableType(parentType);
}
var type;
- if (pattern.kind === 184 /* ObjectBindingPattern */) {
+ if (pattern.kind === 185 /* ObjectBindingPattern */) {
if (declaration.dotDotDotToken) {
if (parentType.flags & 2 /* Unknown */ || !isValidSpreadType(parentType)) {
error(declaration, ts.Diagnostics.Rest_types_may_only_be_created_from_object_types);
@@ -35648,30 +35997,30 @@
}
function isNullOrUndefined(node) {
var expr = ts.skipParentheses(node);
- return expr.kind === 96 /* NullKeyword */ || expr.kind === 72 /* Identifier */ && getResolvedSymbol(expr) === undefinedSymbol;
+ return expr.kind === 97 /* NullKeyword */ || expr.kind === 73 /* Identifier */ && getResolvedSymbol(expr) === undefinedSymbol;
}
function isEmptyArrayLiteral(node) {
var expr = ts.skipParentheses(node);
- return expr.kind === 187 /* ArrayLiteralExpression */ && expr.elements.length === 0;
+ return expr.kind === 188 /* ArrayLiteralExpression */ && expr.elements.length === 0;
}
function addOptionality(type, optional) {
if (optional === void 0) { optional = true; }
return strictNullChecks && optional ? getOptionalType(type) : type;
}
function isParameterOfContextuallyTypedFunction(node) {
- return node.kind === 151 /* Parameter */ &&
- (node.parent.kind === 196 /* FunctionExpression */ || node.parent.kind === 197 /* ArrowFunction */) &&
+ return node.kind === 152 /* Parameter */ &&
+ (node.parent.kind === 197 /* FunctionExpression */ || node.parent.kind === 198 /* ArrowFunction */) &&
!!getContextualType(node.parent);
}
// Return the inferred type for a variable, parameter, or property declaration
function getTypeForVariableLikeDeclaration(declaration, includeOptionality) {
// A variable declared in a for..in statement is of type string, or of type keyof T when the
// right hand expression is of a type parameter type.
- if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 226 /* ForInStatement */) {
+ if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 227 /* ForInStatement */) {
var indexType = getIndexType(getNonNullableTypeIfNeeded(checkExpression(declaration.parent.parent.expression)));
return indexType.flags & (262144 /* TypeParameter */ | 4194304 /* Index */) ? getExtractStringType(indexType) : stringType;
}
- if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 227 /* ForOfStatement */) {
+ if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 228 /* ForOfStatement */) {
// checkRightHandSideOfForOf will return undefined if the for-of expression type was
// missing properties/signatures required to get its iteratedType (like
// [Symbol.iterator] or next). This may be because we accessed properties from anyType,
@@ -35690,7 +36039,7 @@
return addOptionality(declaredType, isOptional);
}
if ((noImplicitAny || ts.isInJSFile(declaration)) &&
- declaration.kind === 237 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) &&
+ declaration.kind === 238 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) &&
!(ts.getCombinedModifierFlags(declaration) & 1 /* Export */) && !(declaration.flags & 4194304 /* Ambient */)) {
// If --noImplicitAny is on or the declaration is in a Javascript file,
// use control flow tracked 'any' type for non-ambient, non-exported var or let variables with no
@@ -35704,11 +36053,11 @@
return autoArrayType;
}
}
- if (declaration.kind === 151 /* Parameter */) {
+ if (declaration.kind === 152 /* Parameter */) {
var func = declaration.parent;
// For a parameter of a set accessor, use the type of the get accessor if one is present
- if (func.kind === 159 /* SetAccessor */ && !hasNonBindableDynamicName(func)) {
- var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 158 /* GetAccessor */);
+ if (func.kind === 160 /* SetAccessor */ && !hasNonBindableDynamicName(func)) {
+ var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 159 /* GetAccessor */);
if (getter) {
var getterSignature = getSignatureFromDeclaration(getter);
var thisParameter = getAccessorThisParameter(func);
@@ -35845,7 +36194,7 @@
return type;
}
else if (declaredType !== errorType && type !== errorType && !isTypeIdenticalTo(declaredType, type)) {
- errorNextVariableOrPropertyDeclarationMustHaveSameType(declaredType, declaration, type);
+ errorNextVariableOrPropertyDeclarationMustHaveSameType(/*firstDeclaration*/ undefined, declaredType, declaration, type);
}
}
return declaredType;
@@ -35912,9 +36261,9 @@
var thisContainer = ts.getThisContainer(expression, /*includeArrowFunctions*/ false);
// Properties defined in a constructor (or base constructor, or javascript constructor function) don't get undefined added.
// Function expressions that are assigned to the prototype count as methods.
- return thisContainer.kind === 157 /* Constructor */ ||
- thisContainer.kind === 239 /* FunctionDeclaration */ ||
- (thisContainer.kind === 196 /* FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent));
+ return thisContainer.kind === 158 /* Constructor */ ||
+ thisContainer.kind === 240 /* FunctionDeclaration */ ||
+ (thisContainer.kind === 197 /* FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent));
}
function getConstructorDefinedThisAssignmentTypes(types, declarations) {
ts.Debug.assert(types.length === declarations.length);
@@ -35989,7 +36338,7 @@
function getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors) {
var elements = pattern.elements;
var lastElement = ts.lastOrUndefined(elements);
- var hasRestElement = !!(lastElement && lastElement.kind === 186 /* BindingElement */ && lastElement.dotDotDotToken);
+ var hasRestElement = !!(lastElement && lastElement.kind === 187 /* BindingElement */ && lastElement.dotDotDotToken);
if (elements.length === 0 || elements.length === 1 && hasRestElement) {
return languageVersion >= 2 /* ES2015 */ ? createIterableType(anyType) : anyArrayType;
}
@@ -36012,7 +36361,7 @@
function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) {
if (includePatternInType === void 0) { includePatternInType = false; }
if (reportErrors === void 0) { reportErrors = false; }
- return pattern.kind === 184 /* ObjectBindingPattern */
+ return pattern.kind === 185 /* ObjectBindingPattern */
? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors)
: getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors);
}
@@ -36051,7 +36400,7 @@
}
function declarationBelongsToPrivateAmbientMember(declaration) {
var root = ts.getRootDeclaration(declaration);
- var memberDeclaration = root.kind === 151 /* Parameter */ ? root.parent : root;
+ var memberDeclaration = root.kind === 152 /* Parameter */ ? root.parent : root;
return isPrivateWithinAmbient(memberDeclaration);
}
function tryGetTypeFromEffectiveTypeNode(declaration) {
@@ -36113,7 +36462,7 @@
return reportCircularityError(symbol);
}
var type;
- if (declaration.kind === 254 /* ExportAssignment */) {
+ if (declaration.kind === 255 /* ExportAssignment */) {
type = widenTypeForVariableLikeDeclaration(checkExpressionCached(declaration.expression), declaration);
}
else if (ts.isInJSFile(declaration) &&
@@ -36164,7 +36513,7 @@
type = getTypeOfEnumMember(symbol);
}
else {
- return ts.Debug.fail("Unhandled declaration kind! " + ts.Debug.showSyntaxKind(declaration) + " for " + ts.Debug.showSymbol(symbol));
+ return ts.Debug.fail("Unhandled declaration kind! " + ts.Debug.formatSyntaxKind(declaration.kind) + " for " + ts.Debug.formatSymbol(symbol));
}
if (!popTypeResolution()) {
// Symbol is property of some kind that is merged with something - should use `getTypeOfFuncClassEnumModule` and not `getTypeOfVariableOrParameterOrProperty`
@@ -36177,7 +36526,7 @@
}
function getAnnotatedAccessorTypeNode(accessor) {
if (accessor) {
- if (accessor.kind === 158 /* GetAccessor */) {
+ if (accessor.kind === 159 /* GetAccessor */) {
var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor);
return getterTypeAnnotation;
}
@@ -36204,8 +36553,8 @@
return links.type || (links.type = getTypeOfAccessorsWorker(symbol));
}
function getTypeOfAccessorsWorker(symbol) {
- var getter = ts.getDeclarationOfKind(symbol, 158 /* GetAccessor */);
- var setter = ts.getDeclarationOfKind(symbol, 159 /* SetAccessor */);
+ var getter = ts.getDeclarationOfKind(symbol, 159 /* GetAccessor */);
+ var setter = ts.getDeclarationOfKind(symbol, 160 /* SetAccessor */);
if (getter && ts.isInJSFile(getter)) {
var jsDocType = getTypeForDeclarationFromJSDocComment(getter);
if (jsDocType) {
@@ -36248,7 +36597,7 @@
if (!popTypeResolution()) {
type = anyType;
if (noImplicitAny) {
- var getter_1 = ts.getDeclarationOfKind(symbol, 158 /* GetAccessor */);
+ var getter_1 = ts.getDeclarationOfKind(symbol, 159 /* GetAccessor */);
error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
}
}
@@ -36288,8 +36637,8 @@
if (symbol.flags & 1536 /* Module */ && ts.isShorthandAmbientModuleSymbol(symbol)) {
return anyType;
}
- else if (declaration.kind === 204 /* BinaryExpression */ ||
- declaration.kind === 189 /* PropertyAccessExpression */ && declaration.parent.kind === 204 /* BinaryExpression */) {
+ else if (declaration.kind === 205 /* BinaryExpression */ ||
+ declaration.kind === 190 /* PropertyAccessExpression */ && declaration.parent.kind === 205 /* BinaryExpression */) {
return getWidenedTypeFromAssignmentDeclaration(symbol);
}
else if (symbol.flags & 512 /* ValueModule */ && declaration && ts.isSourceFile(declaration) && declaration.commonJsModuleIndicator) {
@@ -36356,7 +36705,7 @@
return errorType;
}
// Check if variable has initializer that circularly references the variable itself
- if (noImplicitAny && (declaration.kind !== 151 /* Parameter */ || declaration.initializer)) {
+ if (noImplicitAny && (declaration.kind !== 152 /* Parameter */ || declaration.initializer)) {
error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol));
}
// Circularities could also result from parameters in function expressions that end up
@@ -36364,11 +36713,23 @@
// we have already reported an implicit any error so we don't report anything here.
return anyType;
}
+ function getTypeOfSymbolWithDeferredType(symbol) {
+ var links = getSymbolLinks(symbol);
+ if (!links.type) {
+ ts.Debug.assertDefined(links.deferralParent);
+ ts.Debug.assertDefined(links.deferralConstituents);
+ links.type = links.deferralParent.flags & 1048576 /* Union */ ? getUnionType(links.deferralConstituents) : getIntersectionType(links.deferralConstituents);
+ }
+ return links.type;
+ }
function getTypeOfSymbol(symbol) {
+ if (ts.getCheckFlags(symbol) & 65536 /* DeferredType */) {
+ return getTypeOfSymbolWithDeferredType(symbol);
+ }
if (ts.getCheckFlags(symbol) & 1 /* Instantiated */) {
return getTypeOfInstantiatedSymbol(symbol);
}
- if (ts.getCheckFlags(symbol) & 4096 /* ReverseMapped */) {
+ if (ts.getCheckFlags(symbol) & 8192 /* ReverseMapped */) {
return getTypeOfReverseMappedSymbol(symbol);
}
if (symbol.flags & (3 /* Variable */ | 4 /* Property */)) {
@@ -36429,35 +36790,35 @@
return undefined;
}
switch (node.kind) {
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 155 /* MethodSignature */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 294 /* JSDocFunctionType */:
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 242 /* TypeAliasDeclaration */:
- case 308 /* JSDocTemplateTag */:
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
- case 181 /* MappedType */:
- case 175 /* ConditionalType */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 156 /* MethodSignature */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 295 /* JSDocFunctionType */:
+ case 240 /* FunctionDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 243 /* TypeAliasDeclaration */:
+ case 309 /* JSDocTemplateTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
+ case 182 /* MappedType */:
+ case 176 /* ConditionalType */:
var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes);
- if (node.kind === 181 /* MappedType */) {
+ if (node.kind === 182 /* MappedType */) {
return ts.append(outerTypeParameters, getDeclaredTypeOfTypeParameter(getSymbolOfNode(node.typeParameter)));
}
- else if (node.kind === 175 /* ConditionalType */) {
+ else if (node.kind === 176 /* ConditionalType */) {
return ts.concatenate(outerTypeParameters, getInferTypeParameters(node));
}
var outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, ts.getEffectiveTypeParameterDeclarations(node));
var thisType = includeThisTypes &&
- (node.kind === 240 /* ClassDeclaration */ || node.kind === 209 /* ClassExpression */ || node.kind === 241 /* InterfaceDeclaration */) &&
+ (node.kind === 241 /* ClassDeclaration */ || node.kind === 210 /* ClassExpression */ || node.kind === 242 /* InterfaceDeclaration */) &&
getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType;
return thisType ? ts.append(outerAndOwnTypeParameters, thisType) : outerAndOwnTypeParameters;
}
@@ -36465,7 +36826,7 @@
}
// The outer type parameters are those defined by enclosing generic classes, methods, or functions.
function getOuterTypeParametersOfClassOrInterface(symbol) {
- var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 241 /* InterfaceDeclaration */);
+ var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 242 /* InterfaceDeclaration */);
return getOuterTypeParameters(declaration);
}
// The local type parameters are the combined set of type parameters from all declarations of the class,
@@ -36474,9 +36835,9 @@
var result;
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var node = _a[_i];
- if (node.kind === 241 /* InterfaceDeclaration */ ||
- node.kind === 240 /* ClassDeclaration */ ||
- node.kind === 209 /* ClassExpression */ ||
+ if (node.kind === 242 /* InterfaceDeclaration */ ||
+ node.kind === 241 /* ClassDeclaration */ ||
+ node.kind === 210 /* ClassExpression */ ||
ts.isTypeAlias(node)) {
var declaration = node;
result = appendTypeParameters(result, ts.getEffectiveTypeParameterDeclarations(declaration));
@@ -36670,7 +37031,7 @@
type.resolvedBaseTypes = type.resolvedBaseTypes || ts.emptyArray;
for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 241 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) {
+ if (declaration.kind === 242 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) {
for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) {
var node = _c[_b];
var baseType = getTypeFromTypeNode(node);
@@ -36706,7 +37067,7 @@
function isThislessInterface(symbol) {
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 241 /* InterfaceDeclaration */) {
+ if (declaration.kind === 242 /* InterfaceDeclaration */) {
if (declaration.flags & 64 /* ContainsThis */) {
return false;
}
@@ -36763,7 +37124,7 @@
return errorType;
}
var declaration = ts.find(symbol.declarations, function (d) {
- return ts.isJSDocTypeAlias(d) || d.kind === 242 /* TypeAliasDeclaration */;
+ return ts.isJSDocTypeAlias(d) || d.kind === 243 /* TypeAliasDeclaration */;
});
var typeNode = ts.isJSDocTypeAlias(declaration) ? declaration.typeExpression : declaration.type;
// If typeNode is missing, we will error in checkJSDocTypedefTag.
@@ -36790,7 +37151,7 @@
if (expr.kind === 10 /* StringLiteral */) {
return true;
}
- else if (expr.kind === 204 /* BinaryExpression */) {
+ else if (expr.kind === 205 /* BinaryExpression */) {
return isStringConcatExpression(expr.left) && isStringConcatExpression(expr.right);
}
return false;
@@ -36804,12 +37165,12 @@
case 10 /* StringLiteral */:
case 8 /* NumericLiteral */:
return true;
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return expr.operator === 39 /* MinusToken */ &&
expr.operand.kind === 8 /* NumericLiteral */;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return ts.nodeIsMissing(expr) || !!getSymbolOfNode(member.parent).exports.get(expr.escapedText);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return isStringConcatExpression(expr);
default:
return false;
@@ -36823,7 +37184,7 @@
var hasNonLiteralMember = false;
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 243 /* EnumDeclaration */) {
+ if (declaration.kind === 244 /* EnumDeclaration */) {
for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) {
var member = _c[_b];
if (member.initializer && member.initializer.kind === 10 /* StringLiteral */) {
@@ -36850,7 +37211,7 @@
var memberTypeList = [];
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 243 /* EnumDeclaration */) {
+ if (declaration.kind === 244 /* EnumDeclaration */) {
for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) {
var member = _c[_b];
var memberType = getFreshTypeOfLiteralType(getLiteralType(getEnumMemberValue(member), enumCount, getSymbolOfNode(member))); // TODO: GH#18217
@@ -36921,23 +37282,23 @@
*/
function isThislessType(node) {
switch (node.kind) {
- case 120 /* AnyKeyword */:
- case 143 /* UnknownKeyword */:
- case 138 /* StringKeyword */:
- case 135 /* NumberKeyword */:
- case 146 /* BigIntKeyword */:
- case 123 /* BooleanKeyword */:
- case 139 /* SymbolKeyword */:
- case 136 /* ObjectKeyword */:
- case 106 /* VoidKeyword */:
- case 141 /* UndefinedKeyword */:
- case 96 /* NullKeyword */:
- case 132 /* NeverKeyword */:
- case 182 /* LiteralType */:
+ case 121 /* AnyKeyword */:
+ case 144 /* UnknownKeyword */:
+ case 139 /* StringKeyword */:
+ case 136 /* NumberKeyword */:
+ case 147 /* BigIntKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 137 /* ObjectKeyword */:
+ case 107 /* VoidKeyword */:
+ case 142 /* UndefinedKeyword */:
+ case 97 /* NullKeyword */:
+ case 133 /* NeverKeyword */:
+ case 183 /* LiteralType */:
return true;
- case 169 /* ArrayType */:
+ case 170 /* ArrayType */:
return isThislessType(node.elementType);
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return !node.typeArguments || node.typeArguments.every(isThislessType);
}
return false;
@@ -36963,7 +37324,7 @@
function isThislessFunctionLikeDeclaration(node) {
var returnType = ts.getEffectiveReturnTypeNode(node);
var typeParameters = ts.getEffectiveTypeParameterDeclarations(node);
- return (node.kind === 157 /* Constructor */ || (!!returnType && isThislessType(returnType))) &&
+ return (node.kind === 158 /* Constructor */ || (!!returnType && isThislessType(returnType))) &&
node.parameters.every(isThislessVariableLikeDeclaration) &&
typeParameters.every(isThislessTypeParameter);
}
@@ -36979,14 +37340,14 @@
var declaration = symbol.declarations[0];
if (declaration) {
switch (declaration.kind) {
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
return isThislessVariableLikeDeclaration(declaration);
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return isThislessFunctionLikeDeclaration(declaration);
}
}
@@ -37087,7 +37448,7 @@
* members.
*/
function addDeclarationToLateBoundSymbol(symbol, member, symbolFlags) {
- ts.Debug.assert(!!(ts.getCheckFlags(symbol) & 2048 /* Late */), "Expected a late-bound symbol.");
+ ts.Debug.assert(!!(ts.getCheckFlags(symbol) & 4096 /* Late */), "Expected a late-bound symbol.");
symbol.flags |= symbolFlags;
getSymbolLinks(member.symbol).lateSymbol = symbol;
if (!symbol.declarations) {
@@ -37144,7 +37505,7 @@
// Get or add a late-bound symbol for the member. This allows us to merge late-bound accessor declarations.
var lateSymbol = lateSymbols.get(memberName);
if (!lateSymbol)
- lateSymbols.set(memberName, lateSymbol = createSymbol(0 /* None */, memberName, 2048 /* Late */));
+ lateSymbols.set(memberName, lateSymbol = createSymbol(0 /* None */, memberName, 4096 /* Late */));
// Report an error if a late-bound member has the same name as an early-bound member,
// or if we have another early-bound symbol declaration with the same name and
// conflicting flags.
@@ -37156,7 +37517,7 @@
var name_3 = !(type.flags & 8192 /* UniqueESSymbol */) && ts.unescapeLeadingUnderscores(memberName) || ts.declarationNameToString(decl.name);
ts.forEach(declarations, function (declaration) { return error(ts.getNameOfDeclaration(declaration) || declaration, ts.Diagnostics.Property_0_was_also_declared_here, name_3); });
error(decl.name || decl, ts.Diagnostics.Duplicate_property_0, name_3);
- lateSymbol = createSymbol(0 /* None */, memberName, 2048 /* Late */);
+ lateSymbol = createSymbol(0 /* None */, memberName, 4096 /* Late */);
}
lateSymbol.nameType = type;
addDeclarationToLateBoundSymbol(lateSymbol, decl, symbolFlags);
@@ -37221,11 +37582,12 @@
var links = getSymbolLinks(symbol);
if (!links.lateSymbol && ts.some(symbol.declarations, hasLateBindableName)) {
// force late binding of members/exports. This will set the late-bound symbol
+ var parent = getMergedSymbol(symbol.parent);
if (ts.some(symbol.declarations, ts.hasStaticModifier)) {
- getExportsOfSymbol(symbol.parent);
+ getExportsOfSymbol(parent);
}
else {
- getMembersOfSymbol(symbol.parent);
+ getMembersOfSymbol(parent);
}
}
return links.lateSymbol || (links.lateSymbol = symbol);
@@ -37342,8 +37704,8 @@
var tupleRestIndex_1 = restType.target.hasRestElement ? elementTypes.length - 1 : -1;
var restParams = ts.map(elementTypes, function (t, i) {
var name = getParameterNameAtPosition(sig, restIndex_1 + i);
- var checkFlags = i === tupleRestIndex_1 ? 16384 /* RestParameter */ :
- i >= minLength_1 ? 8192 /* OptionalParameter */ : 0;
+ var checkFlags = i === tupleRestIndex_1 ? 32768 /* RestParameter */ :
+ i >= minLength_1 ? 16384 /* OptionalParameter */ : 0;
var symbol = createSymbol(1 /* FunctionScopedVariable */, name, checkFlags);
symbol.type = i === tupleRestIndex_1 ? createArrayType(t) : t;
return symbol;
@@ -37433,10 +37795,10 @@
// Union the result types when more than one signature matches
if (unionSignatures.length > 1) {
var thisParameter = signature.thisParameter;
- if (ts.forEach(unionSignatures, function (sig) { return sig.thisParameter; })) {
- // TODO: GH#18217 We tested that *some* has thisParameter and now act as if *all* do
+ var firstThisParameterOfUnionSignatures = ts.forEach(unionSignatures, function (sig) { return sig.thisParameter; });
+ if (firstThisParameterOfUnionSignatures) {
var thisType = getUnionType(ts.map(unionSignatures, function (sig) { return sig.thisParameter ? getTypeOfSymbol(sig.thisParameter) : anyType; }), 2 /* Subtype */);
- thisParameter = createSymbolWithType(signature.thisParameter, thisType);
+ thisParameter = createSymbolWithType(firstThisParameterOfUnionSignatures, thisType);
}
s = createUnionSignature(signature, unionSignatures);
s.thisParameter = thisParameter;
@@ -37693,7 +38055,7 @@
var members = ts.createSymbolTable();
for (var _i = 0, _a = getPropertiesOfType(type.source); _i < _a.length; _i++) {
var prop = _a[_i];
- var checkFlags = 4096 /* ReverseMapped */ | (readonlyMask && isReadonlySymbol(prop) ? 8 /* Readonly */ : 0);
+ var checkFlags = 8192 /* ReverseMapped */ | (readonlyMask && isReadonlySymbol(prop) ? 8 /* Readonly */ : 0);
var inferredProp = createSymbol(4 /* Property */ | prop.flags & optionalMask, prop.escapedName, checkFlags);
inferredProp.declarations = prop.declarations;
inferredProp.nameType = prop.nameType;
@@ -37715,7 +38077,15 @@
return getIndexType(getApparentType(type.type));
}
if (type.flags & 16777216 /* Conditional */) {
- return getLowerBoundOfConditionalType(type);
+ if (type.root.isDistributive) {
+ var checkType = type.checkType;
+ var constraint = getLowerBoundOfKeyType(checkType);
+ if (constraint !== checkType) {
+ var mapper = makeUnaryTypeMapper(type.root.checkType, constraint);
+ return getConditionalTypeInstantiation(type, combineTypeMappers(mapper, type.mapper));
+ }
+ }
+ return type;
}
if (type.flags & 1048576 /* Union */) {
return getUnionType(ts.sameMap(type.types, getLowerBoundOfKeyType));
@@ -37725,16 +38095,6 @@
}
return neverType;
}
- function getLowerBoundOfConditionalType(type) {
- if (type.root.isDistributive) {
- var constraint = getLowerBoundOfKeyType(type.checkType);
- if (constraint !== type.checkType) {
- var mapper = makeUnaryTypeMapper(type.root.checkType, constraint);
- return getConditionalTypeInstantiation(type, combineTypeMappers(mapper, type.mapper));
- }
- }
- return type;
- }
/** Resolve the members of a mapped type { [P in K]: T } */
function resolveMappedTypeMembers(type) {
var members = ts.createSymbolTable();
@@ -37823,8 +38183,8 @@
}
function isMappedTypeWithKeyofConstraintDeclaration(type) {
var constraintDeclaration = getConstraintDeclarationForMappedType(type); // TODO: GH#18217
- return constraintDeclaration.kind === 179 /* TypeOperator */ &&
- constraintDeclaration.operator === 129 /* KeyOfKeyword */;
+ return constraintDeclaration.kind === 180 /* TypeOperator */ &&
+ constraintDeclaration.operator === 130 /* KeyOfKeyword */;
}
function getModifiersTypeFromMappedType(type) {
if (!type.modifiersType) {
@@ -37841,7 +38201,7 @@
var declaredType = getTypeFromMappedTypeNode(type.declaration);
var constraint = getConstraintTypeFromMappedType(declaredType);
var extendedConstraint = constraint && constraint.flags & 262144 /* TypeParameter */ ? getConstraintOfTypeParameter(constraint) : constraint;
- type.modifiersType = extendedConstraint && extendedConstraint.flags & 4194304 /* Index */ ? instantiateType(extendedConstraint.type, type.mapper || identityMapper) : emptyObjectType;
+ type.modifiersType = extendedConstraint && extendedConstraint.flags & 4194304 /* Index */ ? instantiateType(extendedConstraint.type, type.mapper || identityMapper) : unknownType;
}
}
return type.modifiersType;
@@ -37937,6 +38297,26 @@
}
return type.resolvedProperties;
}
+ function getPossiblePropertiesOfUnionType(type) {
+ if (type.possiblePropertyCache) {
+ return type.possiblePropertyCache.size ? ts.arrayFrom(type.possiblePropertyCache.values()) : ts.emptyArray;
+ }
+ type.possiblePropertyCache = ts.createSymbolTable();
+ for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
+ var t = _a[_i];
+ for (var _b = 0, _c = getPropertiesOfType(t); _b < _c.length; _b++) {
+ var p = _c[_b];
+ if (!type.possiblePropertyCache.has(p.escapedName)) {
+ var prop = getUnionOrIntersectionProperty(type, p.escapedName);
+ if (prop) {
+ type.possiblePropertyCache.set(p.escapedName, prop);
+ }
+ }
+ }
+ }
+ // We can't simply use the normal property cache here, since that will contain cached apparent type members :(
+ return type.possiblePropertyCache.size ? ts.arrayFrom(type.possiblePropertyCache.values()) : ts.emptyArray;
+ }
function getPropertiesOfType(type) {
type = getApparentType(type);
return type.flags & 3145728 /* UnionOrIntersection */ ?
@@ -37984,16 +38364,23 @@
function getConstraintOfIndexedAccess(type) {
return hasNonCircularBaseConstraint(type) ? getConstraintFromIndexedAccess(type) : undefined;
}
+ function getSimplifiedTypeOrConstraint(type) {
+ var simplified = getSimplifiedType(type, /*writing*/ false);
+ return simplified !== type ? simplified : getConstraintOfType(type);
+ }
function getConstraintFromIndexedAccess(type) {
- var objectType = getConstraintOfType(type.objectType) || type.objectType;
- if (objectType !== type.objectType) {
- var constraint = getIndexedAccessType(objectType, type.indexType, /*accessNode*/ undefined, errorType);
- if (constraint && constraint !== errorType) {
- return constraint;
+ var indexConstraint = getSimplifiedTypeOrConstraint(type.indexType);
+ if (indexConstraint && indexConstraint !== type.indexType) {
+ var indexedAccess = getIndexedAccessTypeOrUndefined(type.objectType, indexConstraint);
+ if (indexedAccess) {
+ return indexedAccess;
}
}
- var baseConstraint = getBaseConstraintOfType(type);
- return baseConstraint && baseConstraint !== type ? baseConstraint : undefined;
+ var objectConstraint = getSimplifiedTypeOrConstraint(type.objectType);
+ if (objectConstraint && objectConstraint !== type.objectType) {
+ return getIndexedAccessTypeOrUndefined(objectConstraint, type.indexType);
+ }
+ return undefined;
}
function getDefaultConstraintOfConditionalType(type) {
if (!type.resolvedDefaultConstraint) {
@@ -38002,7 +38389,7 @@
// just `any`. This result is _usually_ unwanted - so instead here we elide an `any` branch from the constraint type,
// in effect treating `any` like `never` rather than `unknown` in this location.
var trueConstraint = getInferredTrueTypeFromConditionalType(type);
- var falseConstraint = type.falseType;
+ var falseConstraint = getFalseTypeFromConditionalType(type);
type.resolvedDefaultConstraint = isTypeAny(trueConstraint) ? falseConstraint : isTypeAny(falseConstraint) ? trueConstraint : getUnionType([trueConstraint, falseConstraint]);
}
return type.resolvedDefaultConstraint;
@@ -38020,7 +38407,7 @@
// a union - once negated types exist and are applied to the conditional false branch, this "constraint"
// likely doesn't need to exist.
if (type.root.isDistributive && type.restrictiveInstantiation !== type) {
- var simplified = getSimplifiedType(type.checkType);
+ var simplified = getSimplifiedType(type.checkType, /*writing*/ false);
var constraint = simplified === type.checkType ? getConstraintOfType(simplified) : simplified;
if (constraint && constraint !== type.checkType) {
var mapper = makeUnaryTypeMapper(type.root.checkType, constraint);
@@ -38051,11 +38438,6 @@
constraint = getConstraintOfType(constraint);
}
if (constraint) {
- // A constraint that isn't a union type implies that the final type would be a non-union
- // type as well. Since non-union constraints are of no interest, we can exit here.
- if (!(constraint.flags & 1048576 /* Union */)) {
- return undefined;
- }
constraints = ts.append(constraints, constraint);
}
}
@@ -38064,10 +38446,10 @@
}
}
// If the target is a union type or if we are intersecting with types belonging to one of the
- // disjoint domans, we may end up producing a constraint that hasn't been examined before.
+ // disjoint domains, we may end up producing a constraint that hasn't been examined before.
if (constraints && (targetIsUnion || hasDisjointDomainType)) {
if (hasDisjointDomainType) {
- // We add any types belong to one of the disjoint domans because they might cause the final
+ // We add any types belong to one of the disjoint domains because they might cause the final
// intersection operation to reduce the union constraints.
for (var _b = 0, _c = type.types; _b < _c.length; _b++) {
var t = _c[_b];
@@ -38113,7 +38495,7 @@
}
if (constraintDepth >= 50) {
// We have reached 50 recursive invocations of getImmediateBaseConstraint and there is a
- // very high likelyhood we're dealing with an infinite generic type that perpetually generates
+ // very high likelihood we're dealing with an infinite generic type that perpetually generates
// new type identities as we descend into it. We stop the recursion here and mark this type
// and the outer types as having circular constraints.
error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
@@ -38121,7 +38503,7 @@
return t.immediateBaseConstraint = noConstraintType;
}
constraintDepth++;
- var result = computeBaseConstraint(getSimplifiedType(t));
+ var result = computeBaseConstraint(getSimplifiedType(t, /*writing*/ false));
constraintDepth--;
if (!popTypeResolution()) {
if (t.flags & 262144 /* TypeParameter */) {
@@ -38173,8 +38555,8 @@
if (t.flags & 8388608 /* IndexedAccess */) {
var baseObjectType = getBaseConstraint(t.objectType);
var baseIndexType = getBaseConstraint(t.indexType);
- var baseIndexedAccess = baseObjectType && baseIndexType ? getIndexedAccessType(baseObjectType, baseIndexType, /*accessNode*/ undefined, errorType) : undefined;
- return baseIndexedAccess && baseIndexedAccess !== errorType ? getBaseConstraint(baseIndexedAccess) : undefined;
+ var baseIndexedAccess = baseObjectType && baseIndexType && getIndexedAccessTypeOrUndefined(baseObjectType, baseIndexType);
+ return baseIndexedAccess && getBaseConstraint(baseIndexedAccess);
}
if (t.flags & 16777216 /* Conditional */) {
var constraint = getConstraintFromConditionalType(t);
@@ -38255,16 +38637,17 @@
* type itself. Note that the apparent type of a union type is the union type itself.
*/
function getApparentType(type) {
- var t = type.flags & 63176704 /* Instantiable */ ? getBaseConstraintOfType(type) || emptyObjectType : type;
+ var t = type.flags & 63176704 /* Instantiable */ ? getBaseConstraintOfType(type) || unknownType : type;
return ts.getObjectFlags(t) & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) :
t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t) :
t.flags & 132 /* StringLike */ ? globalStringType :
t.flags & 296 /* NumberLike */ ? globalNumberType :
- t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType(/*reportErrors*/ languageVersion >= 7 /* ESNext */) :
+ t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType(/*reportErrors*/ languageVersion >= 8 /* ESNext */) :
t.flags & 528 /* BooleanLike */ ? globalBooleanType :
t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType(/*reportErrors*/ languageVersion >= 2 /* ES2015 */) :
t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType :
t.flags & 4194304 /* Index */ ? keyofConstraintType :
+ t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType :
t;
}
function createUnionOrIntersectionProperty(containingType, name) {
@@ -38273,7 +38656,7 @@
var isUnion = containingType.flags & 1048576 /* Union */;
var excludeModifiers = isUnion ? 24 /* NonPublicAccessibilityModifier */ : 0;
// Flags we want to propagate to the result if they exist in all source symbols
- var commonFlags = isUnion ? 0 /* None */ : 16777216 /* Optional */;
+ var optionalFlag = isUnion ? 0 /* None */ : 16777216 /* Optional */;
var syntheticFlag = 4 /* SyntheticMethod */;
var checkFlags = 0;
for (var _i = 0, _a = containingType.types; _i < _a.length; _i++) {
@@ -38283,16 +38666,21 @@
var prop = getPropertyOfType(type, name);
var modifiers = prop ? ts.getDeclarationModifierFlagsFromSymbol(prop) : 0;
if (prop && !(modifiers & excludeModifiers)) {
- commonFlags &= prop.flags;
+ if (isUnion) {
+ optionalFlag |= (prop.flags & 16777216 /* Optional */);
+ }
+ else {
+ optionalFlag &= prop.flags;
+ }
var id = "" + getSymbolId(prop);
if (!propSet.has(id)) {
propSet.set(id, prop);
}
checkFlags |= (isReadonlySymbol(prop) ? 8 /* Readonly */ : 0) |
- (!(modifiers & 24 /* NonPublicAccessibilityModifier */) ? 128 /* ContainsPublic */ : 0) |
- (modifiers & 16 /* Protected */ ? 256 /* ContainsProtected */ : 0) |
- (modifiers & 8 /* Private */ ? 512 /* ContainsPrivate */ : 0) |
- (modifiers & 32 /* Static */ ? 1024 /* ContainsStatic */ : 0);
+ (!(modifiers & 24 /* NonPublicAccessibilityModifier */) ? 256 /* ContainsPublic */ : 0) |
+ (modifiers & 16 /* Protected */ ? 512 /* ContainsProtected */ : 0) |
+ (modifiers & 8 /* Private */ ? 1024 /* ContainsPrivate */ : 0) |
+ (modifiers & 32 /* Static */ ? 2048 /* ContainsStatic */ : 0);
if (!isPrototypeProperty(prop)) {
syntheticFlag = 2 /* SyntheticProperty */;
}
@@ -38301,10 +38689,11 @@
var indexInfo = !isLateBoundName(name) && (isNumericLiteralName(name) && getIndexInfoOfType(type, 1 /* Number */) || getIndexInfoOfType(type, 0 /* String */));
if (indexInfo) {
checkFlags |= indexInfo.isReadonly ? 8 /* Readonly */ : 0;
+ checkFlags |= 32 /* WritePartial */;
indexTypes = ts.append(indexTypes, isTupleType(type) ? getRestTypeOfTupleType(type) || undefinedType : indexInfo.type);
}
else {
- checkFlags |= 16 /* Partial */;
+ checkFlags |= 16 /* ReadPartial */;
}
}
}
@@ -38313,7 +38702,7 @@
return undefined;
}
var props = ts.arrayFrom(propSet.values());
- if (props.length === 1 && !(checkFlags & 16 /* Partial */) && !indexTypes) {
+ if (props.length === 1 && !(checkFlags & 16 /* ReadPartial */) && !indexTypes) {
return props[0];
}
var declarations;
@@ -38337,15 +38726,15 @@
nameType = prop.nameType;
}
else if (type !== firstType) {
- checkFlags |= 32 /* HasNonUniformType */;
+ checkFlags |= 64 /* HasNonUniformType */;
}
if (isLiteralType(type)) {
- checkFlags |= 64 /* HasLiteralType */;
+ checkFlags |= 128 /* HasLiteralType */;
}
propTypes.push(type);
}
ts.addRange(propTypes, indexTypes);
- var result = createSymbol(4 /* Property */ | commonFlags, name, syntheticFlag | checkFlags);
+ var result = createSymbol(4 /* Property */ | optionalFlag, name, syntheticFlag | checkFlags);
result.containingType = containingType;
if (!hasNonUniformValueDeclaration && firstValueDeclaration) {
result.valueDeclaration = firstValueDeclaration;
@@ -38356,7 +38745,15 @@
}
result.declarations = declarations;
result.nameType = nameType;
+ if (propTypes.length > 2) {
+ // When `propTypes` has the potential to explode in size when normalized, defer normalization until absolutely needed
+ result.checkFlags |= 65536 /* DeferredType */;
+ result.deferralParent = containingType;
+ result.deferralConstituents = propTypes;
+ }
+ else {
result.type = isUnion ? getUnionType(propTypes) : getIntersectionType(propTypes);
+ }
return result;
}
// Return the symbol for a given property in a union or intersection type, or undefined if the property
@@ -38378,7 +38775,7 @@
function getPropertyOfUnionOrIntersectionType(type, name) {
var property = getUnionOrIntersectionProperty(type, name);
// We need to filter out partial properties in union types
- return property && !(ts.getCheckFlags(property) & 16 /* Partial */) ? property : undefined;
+ return property && !(ts.getCheckFlags(property) & 16 /* ReadPartial */) ? property : undefined;
}
/**
* Return the symbol for the property with the given name in the given type. Creates synthetic union properties when
@@ -38484,10 +38881,10 @@
function isJSDocOptionalParameter(node) {
return ts.isInJSFile(node) && (
// node.type should only be a JSDocOptionalType when node is a parameter of a JSDocFunctionType
- node.type && node.type.kind === 293 /* JSDocOptionalType */
+ node.type && node.type.kind === 294 /* JSDocOptionalType */
|| ts.getJSDocParameterTags(node).some(function (_a) {
var isBracketed = _a.isBracketed, typeExpression = _a.typeExpression;
- return isBracketed || !!typeExpression && typeExpression.type.kind === 293 /* JSDocOptionalType */;
+ return isBracketed || !!typeExpression && typeExpression.type.kind === 294 /* JSDocOptionalType */;
}));
}
function tryFindAmbientModule(moduleName, withAugmentations) {
@@ -38521,7 +38918,7 @@
return false;
}
var isBracketed = node.isBracketed, typeExpression = node.typeExpression;
- return isBracketed || !!typeExpression && typeExpression.type.kind === 293 /* JSDocOptionalType */;
+ return isBracketed || !!typeExpression && typeExpression.type.kind === 294 /* JSDocOptionalType */;
}
function createIdentifierTypePredicate(parameterName, parameterIndex, type) {
return { kind: 1 /* Identifier */, parameterName: parameterName, parameterIndex: parameterIndex, type: type };
@@ -38559,7 +38956,7 @@
var baseDefaultType = getDefaultTypeArgumentType(isJavaScriptImplicitAny);
for (var i = numTypeArguments; i < numTypeParameters; i++) {
var defaultType = getDefaultFromTypeParameter(typeParameters[i]);
- if (isJavaScriptImplicitAny && defaultType && isTypeIdenticalTo(defaultType, emptyObjectType)) {
+ if (isJavaScriptImplicitAny && defaultType && (isTypeIdenticalTo(defaultType, unknownType) || isTypeIdenticalTo(defaultType, emptyObjectType))) {
defaultType = anyType;
}
result[i] = defaultType ? instantiateType(defaultType, createTypeMapper(typeParameters, result)) : baseDefaultType;
@@ -38603,7 +39000,7 @@
else {
parameters.push(paramSymbol);
}
- if (type && type.kind === 182 /* LiteralType */) {
+ if (type && type.kind === 183 /* LiteralType */) {
hasLiteralTypes = true;
}
// Record a new minimum argument count if this is not an optional parameter
@@ -38617,16 +39014,16 @@
}
}
// If only one accessor includes a this-type annotation, the other behaves as if it had the same type annotation
- if ((declaration.kind === 158 /* GetAccessor */ || declaration.kind === 159 /* SetAccessor */) &&
+ if ((declaration.kind === 159 /* GetAccessor */ || declaration.kind === 160 /* SetAccessor */) &&
!hasNonBindableDynamicName(declaration) &&
(!hasThisParameter || !thisParameter)) {
- var otherKind = declaration.kind === 158 /* GetAccessor */ ? 159 /* SetAccessor */ : 158 /* GetAccessor */;
+ var otherKind = declaration.kind === 159 /* GetAccessor */ ? 160 /* SetAccessor */ : 159 /* GetAccessor */;
var other = ts.getDeclarationOfKind(getSymbolOfNode(declaration), otherKind);
if (other) {
thisParameter = getAnnotatedAccessorThisParameter(other);
}
}
- var classType = declaration.kind === 157 /* Constructor */ ?
+ var classType = declaration.kind === 158 /* Constructor */ ?
getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol))
: undefined;
var typeParameters = classType ? classType.localTypeParameters : getTypeParametersFromDeclaration(declaration);
@@ -38651,7 +39048,7 @@
var lastParamVariadicType = ts.firstDefined(lastParamTags, function (p) {
return p.typeExpression && ts.isJSDocVariadicType(p.typeExpression.type) ? p.typeExpression.type : undefined;
});
- var syntheticArgsSymbol = createSymbol(3 /* Variable */, "args", 16384 /* RestParameter */);
+ var syntheticArgsSymbol = createSymbol(3 /* Variable */, "args", 32768 /* RestParameter */);
syntheticArgsSymbol.type = lastParamVariadicType ? createArrayType(getTypeFromTypeNode(lastParamVariadicType.type)) : anyArrayType;
if (lastParamVariadicType) {
// Replace the last parameter with a rest parameter.
@@ -38684,13 +39081,13 @@
if (!node)
return false;
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return node.escapedText === "arguments" && ts.isExpressionNode(node);
- case 154 /* PropertyDeclaration */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- return node.name.kind === 149 /* ComputedPropertyName */
+ case 155 /* PropertyDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ return node.name.kind === 150 /* ComputedPropertyName */
&& traverse(node.name);
default:
return !ts.nodeStartsNewLexicalEnvironment(node) && !ts.isPartOfTypeNode(node) && !!ts.forEachChild(node, traverse);
@@ -38765,7 +39162,7 @@
function createTypePredicateFromTypePredicateNode(node, signature) {
var parameterName = node.parameterName;
var type = getTypeFromTypeNode(node.type);
- if (parameterName.kind === 72 /* Identifier */) {
+ if (parameterName.kind === 73 /* Identifier */) {
return createIdentifierTypePredicate(parameterName.escapedText, ts.findIndex(signature.parameters, function (p) { return p.escapedName === parameterName.escapedText; }), type);
}
else {
@@ -38806,7 +39203,7 @@
return signature.resolvedReturnType;
}
function getReturnTypeFromAnnotation(declaration) {
- if (declaration.kind === 157 /* Constructor */) {
+ if (declaration.kind === 158 /* Constructor */) {
return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol));
}
if (ts.isJSDocConstructSignature(declaration)) {
@@ -38816,12 +39213,12 @@
if (typeNode) {
return getTypeFromTypeNode(typeNode);
}
- if (declaration.kind === 158 /* GetAccessor */ && !hasNonBindableDynamicName(declaration)) {
+ if (declaration.kind === 159 /* GetAccessor */ && !hasNonBindableDynamicName(declaration)) {
var jsDocType = ts.isInJSFile(declaration) && getTypeForDeclarationFromJSDocComment(declaration);
if (jsDocType) {
return jsDocType;
}
- var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 159 /* SetAccessor */);
+ var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 160 /* SetAccessor */);
var setterType = getAnnotatedAccessorType(setter);
if (setterType) {
return setterType;
@@ -38846,7 +39243,7 @@
function getSignatureInstantiation(signature, typeArguments, isJavascript, inferredTypeParameters) {
var instantiatedSignature = getSignatureInstantiationWithoutFillingInTypeArguments(signature, fillMissingTypeArguments(typeArguments, signature.typeParameters, getMinTypeArgumentCount(signature.typeParameters), isJavascript));
if (inferredTypeParameters) {
- var returnSignature = getSingleCallSignature(getReturnTypeOfSignature(instantiatedSignature));
+ var returnSignature = getSingleCallOrConstructSignature(getReturnTypeOfSignature(instantiatedSignature));
if (returnSignature) {
var newReturnSignature = cloneSignature(returnSignature);
newReturnSignature.typeParameters = inferredTypeParameters;
@@ -38899,7 +39296,7 @@
var typeParameters = signature.typeParameters;
if (typeParameters) {
var typeEraser_1 = createTypeEraser(typeParameters);
- var baseConstraints = ts.map(typeParameters, function (tp) { return instantiateType(getBaseConstraintOfType(tp), typeEraser_1) || emptyObjectType; });
+ var baseConstraints = ts.map(typeParameters, function (tp) { return instantiateType(getBaseConstraintOfType(tp), typeEraser_1) || unknownType; });
return instantiateSignature(signature, createTypeMapper(typeParameters, baseConstraints), /*eraseTypeParameters*/ true);
}
return signature;
@@ -38910,7 +39307,8 @@
// object type literal or interface (using the new keyword). Each way of declaring a constructor
// will result in a different declaration kind.
if (!signature.isolatedSignatureType) {
- var isConstructor = signature.declaration.kind === 157 /* Constructor */ || signature.declaration.kind === 161 /* ConstructSignature */; // TODO: GH#18217
+ var kind = signature.declaration ? signature.declaration.kind : 0 /* Unknown */;
+ var isConstructor = kind === 158 /* Constructor */ || kind === 162 /* ConstructSignature */ || kind === 167 /* ConstructorType */;
var type = createObjectType(16 /* Anonymous */);
type.members = emptySymbols;
type.properties = ts.emptyArray;
@@ -38924,7 +39322,7 @@
return symbol.members.get("__index" /* Index */);
}
function getIndexDeclarationOfSymbol(symbol, kind) {
- var syntaxKind = kind === 1 /* Number */ ? 135 /* NumberKeyword */ : 138 /* StringKeyword */;
+ var syntaxKind = kind === 1 /* Number */ ? 136 /* NumberKeyword */ : 139 /* StringKeyword */;
var indexSymbol = getIndexSymbol(symbol);
if (indexSymbol) {
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
@@ -38951,7 +39349,7 @@
return undefined;
}
function getConstraintDeclaration(type) {
- var decl = type.symbol && ts.getDeclarationOfKind(type.symbol, 150 /* TypeParameter */);
+ var decl = type.symbol && ts.getDeclarationOfKind(type.symbol, 151 /* TypeParameter */);
return decl && ts.getEffectiveConstraintOfTypeParameter(decl);
}
function getInferredTypeParameterConstraint(typeParameter) {
@@ -38959,13 +39357,13 @@
if (typeParameter.symbol) {
for (var _i = 0, _a = typeParameter.symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.parent.kind === 176 /* InferType */) {
+ if (declaration.parent.kind === 177 /* InferType */) {
// When an 'infer T' declaration is immediately contained in a type reference node
// (such as 'Foo<infer T>'), T's constraint is inferred from the constraint of the
// corresponding type parameter in 'Foo'. When multiple 'infer T' declarations are
// present, we form an intersection of the inferred constraint types.
var grandParent = declaration.parent.parent;
- if (grandParent.kind === 164 /* TypeReference */) {
+ if (grandParent.kind === 165 /* TypeReference */) {
var typeReference = grandParent;
var typeParameters = getTypeParametersForTypeReference(typeReference);
if (typeParameters) {
@@ -38990,7 +39388,7 @@
}
// When an 'infer T' declaration is immediately contained in a rest parameter
// declaration, we infer an 'unknown[]' constraint.
- else if (grandParent.kind === 151 /* Parameter */ && grandParent.dotDotDotToken) {
+ else if (grandParent.kind === 152 /* Parameter */ && grandParent.dotDotDotToken) {
inferences = ts.append(inferences, createArrayType(unknownType));
}
}
@@ -39014,7 +39412,7 @@
return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint;
}
function getParentSymbolOfTypeParameter(typeParameter) {
- var tp = ts.getDeclarationOfKind(typeParameter.symbol, 150 /* TypeParameter */);
+ var tp = ts.getDeclarationOfKind(typeParameter.symbol, 151 /* TypeParameter */);
var host = ts.isJSDocTemplateTag(tp.parent) ? ts.getHostSignatureFromJSDoc(tp.parent) : tp.parent;
return host && getSymbolOfNode(host);
}
@@ -39147,9 +39545,9 @@
}
function getTypeReferenceName(node) {
switch (node.kind) {
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return node.typeName;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
// We only support expressions that are simple qualified names. For other
// expressions this produces undefined.
var expr = node.expression;
@@ -39248,16 +39646,22 @@
}
}
function getSubstitutionType(typeVariable, substitute) {
- if (substitute.flags & 3 /* AnyOrUnknown */) {
+ if (substitute.flags & 3 /* AnyOrUnknown */ || substitute === typeVariable) {
return typeVariable;
}
+ var id = getTypeId(typeVariable) + ">" + getTypeId(substitute);
+ var cached = substitutionTypes.get(id);
+ if (cached) {
+ return cached;
+ }
var result = createType(33554432 /* Substitution */);
result.typeVariable = typeVariable;
result.substitute = substitute;
+ substitutionTypes.set(id, result);
return result;
}
function isUnaryTupleTypeNode(node) {
- return node.kind === 170 /* TupleType */ && node.elementTypes.length === 1;
+ return node.kind === 171 /* TupleType */ && node.elementTypes.length === 1;
}
function getImpliedConstraint(typeVariable, checkNode, extendsNode) {
return isUnaryTupleTypeNode(checkNode) && isUnaryTupleTypeNode(extendsNode) ? getImpliedConstraint(typeVariable, checkNode.elementTypes[0], extendsNode.elementTypes[0]) :
@@ -39266,9 +39670,9 @@
}
function getConstrainedTypeVariable(typeVariable, node) {
var constraints;
- while (node && !ts.isStatement(node) && node.kind !== 296 /* JSDocComment */) {
+ while (node && !ts.isStatement(node) && node.kind !== 297 /* JSDocComment */) {
var parent = node.parent;
- if (parent.kind === 175 /* ConditionalType */ && node === parent.trueType) {
+ if (parent.kind === 176 /* ConditionalType */ && node === parent.trueType) {
var constraint = getImpliedConstraint(typeVariable, parent.checkType, parent.extendsType);
if (constraint) {
constraints = ts.append(constraints, constraint);
@@ -39279,7 +39683,7 @@
return constraints ? getSubstitutionType(typeVariable, getIntersectionType(ts.append(constraints, typeVariable))) : typeVariable;
}
function isJSDocTypeReference(node) {
- return !!(node.flags & 2097152 /* JSDoc */) && (node.kind === 164 /* TypeReference */ || node.kind === 183 /* ImportType */);
+ return !!(node.flags & 2097152 /* JSDoc */) && (node.kind === 165 /* TypeReference */ || node.kind === 184 /* ImportType */);
}
function checkNoTypeArguments(node, symbol) {
if (node.typeArguments) {
@@ -39380,9 +39784,9 @@
for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) {
var declaration = declarations_3[_i];
switch (declaration.kind) {
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
return declaration;
}
}
@@ -39468,11 +39872,8 @@
function getGlobalExtractSymbol() {
return deferredGlobalExtractSymbol || (deferredGlobalExtractSymbol = getGlobalSymbol("Extract", 524288 /* TypeAlias */, ts.Diagnostics.Cannot_find_global_type_0)); // TODO: GH#18217
}
- function getGlobalExcludeSymbol() {
- return deferredGlobalExcludeSymbol || (deferredGlobalExcludeSymbol = getGlobalSymbol("Exclude", 524288 /* TypeAlias */, ts.Diagnostics.Cannot_find_global_type_0)); // TODO: GH#18217
- }
- function getGlobalPickSymbol() {
- return deferredGlobalPickSymbol || (deferredGlobalPickSymbol = getGlobalSymbol("Pick", 524288 /* TypeAlias */, ts.Diagnostics.Cannot_find_global_type_0)); // TODO: GH#18217
+ function getGlobalOmitSymbol() {
+ return deferredGlobalOmitSymbol || (deferredGlobalOmitSymbol = getGlobalSymbol("Omit", 524288 /* TypeAlias */, ts.Diagnostics.Cannot_find_global_type_0)); // TODO: GH#18217
}
function getGlobalBigIntType(reportErrors) {
return deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, reportErrors)) || emptyObjectType;
@@ -39509,7 +39910,7 @@
return links.resolvedType;
}
function isReadonlyTypeOperator(node) {
- return ts.isTypeOperatorNode(node) && node.operator === 133 /* ReadonlyKeyword */;
+ return ts.isTypeOperatorNode(node) && node.operator === 134 /* ReadonlyKeyword */;
}
// We represent tuple types as type references to synthesized generic interface types created by
// this function. The types are of the form:
@@ -39584,8 +39985,8 @@
var links = getNodeLinks(node);
if (!links.resolvedType) {
var lastElement = ts.lastOrUndefined(node.elementTypes);
- var restElement_1 = lastElement && lastElement.kind === 172 /* RestType */ ? lastElement : undefined;
- var minLength = ts.findLastIndex(node.elementTypes, function (n) { return n.kind !== 171 /* OptionalType */ && n !== restElement_1; }) + 1;
+ var restElement_1 = lastElement && lastElement.kind === 173 /* RestType */ ? lastElement : undefined;
+ var minLength = ts.findLastIndex(node.elementTypes, function (n) { return n.kind !== 172 /* OptionalType */ && n !== restElement_1; }) + 1;
var elementTypes = ts.map(node.elementTypes, function (n) {
var type = getTypeFromTypeNode(n);
return n === restElement_1 && getIndexTypeOfType(type, 1 /* Number */) || type;
@@ -39972,6 +40373,14 @@
types[index] = getUnionTypeFromSortedList(result, 65536 /* PrimitiveUnion */);
return true;
}
+ function createIntersectionType(types, aliasSymbol, aliasTypeArguments) {
+ var result = createType(2097152 /* Intersection */);
+ result.objectFlags = getPropagatingFlagsOfTypes(types, /*excludeKinds*/ 98304 /* Nullable */);
+ result.types = types;
+ result.aliasSymbol = aliasSymbol; // See comment in `getUnionTypeFromSortedList`.
+ result.aliasTypeArguments = aliasTypeArguments;
+ return result;
+ }
// We normalize combinations of intersection and union types based on the distributive property of the '&'
// operator. Specifically, because X & (A | B) is equivalent to X & A | X & B, we can transform intersection
// types with union type constituents into equivalent union types with intersection type constituents and
@@ -40009,30 +40418,36 @@
if (typeSet.length === 1) {
return typeSet[0];
}
+ var id = getTypeListId(typeSet);
+ var result = intersectionTypes.get(id);
+ if (!result) {
if (includes & 1048576 /* Union */) {
if (intersectUnionsOfPrimitiveTypes(typeSet)) {
// When the intersection creates a reduced set (which might mean that *all* union types have
// disappeared), we restart the operation to get a new set of combined flags. Once we have
// reduced we'll never reduce again, so this occurs at most once.
- return getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
+ result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
}
+ else {
// We are attempting to construct a type of the form X & (A | B) & Y. Transform this into a type of
// the form X & A & Y | X & B & Y and recursively reduce until no union type constituents remain.
+ // If the estimated size of the resulting union type exceeds 100000 constituents, report an error.
+ var size = ts.reduceLeft(typeSet, function (n, t) { return n * (t.flags & 1048576 /* Union */ ? t.types.length : 1); }, 1);
+ if (size >= 100000) {
+ error(currentNode, ts.Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
+ return errorType;
+ }
var unionIndex_1 = ts.findIndex(typeSet, function (t) { return (t.flags & 1048576 /* Union */) !== 0; });
var unionType = typeSet[unionIndex_1];
- return getUnionType(ts.map(unionType.types, function (t) { return getIntersectionType(ts.replaceElement(typeSet, unionIndex_1, t)); }), 1 /* Literal */, aliasSymbol, aliasTypeArguments);
+ result = getUnionType(ts.map(unionType.types, function (t) { return getIntersectionType(ts.replaceElement(typeSet, unionIndex_1, t)); }), 1 /* Literal */, aliasSymbol, aliasTypeArguments);
}
- var id = getTypeListId(typeSet);
- var type = intersectionTypes.get(id);
- if (!type) {
- type = createType(2097152 /* Intersection */);
- intersectionTypes.set(id, type);
- type.objectFlags = getPropagatingFlagsOfTypes(typeSet, /*excludeKinds*/ 98304 /* Nullable */);
- type.types = typeSet;
- type.aliasSymbol = aliasSymbol; // See comment in `getUnionTypeFromSortedList`.
- type.aliasTypeArguments = aliasTypeArguments;
}
- return type;
+ else {
+ result = createIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
+ }
+ intersectionTypes.set(id, result);
+ }
+ return result;
}
function getTypeFromIntersectionTypeNode(node) {
var links = getNodeLinks(node);
@@ -40088,16 +40503,17 @@
var numberIndexInfo = getIndexInfoOfType(type, 1 /* Number */);
return numberIndexInfo !== enumNumberIndexInfo ? numberIndexInfo : undefined;
}
- function getIndexType(type, stringsOnly) {
+ function getIndexType(type, stringsOnly, noIndexSignatures) {
if (stringsOnly === void 0) { stringsOnly = keyofStringsOnly; }
- return type.flags & 1048576 /* Union */ ? getIntersectionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly); })) :
- type.flags & 2097152 /* Intersection */ ? getUnionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly); })) :
+ return type.flags & 1048576 /* Union */ ? getIntersectionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
+ type.flags & 2097152 /* Intersection */ ? getUnionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
maybeTypeOfKind(type, 58982400 /* InstantiableNonPrimitive */) ? getIndexTypeForGenericType(type, stringsOnly) :
- ts.getObjectFlags(type) & 32 /* Mapped */ ? getConstraintTypeFromMappedType(type) :
+ ts.getObjectFlags(type) & 32 /* Mapped */ ? filterType(getConstraintTypeFromMappedType(type), function (t) { return !(noIndexSignatures && t.flags & (1 /* Any */ | 4 /* String */)); }) :
type === wildcardType ? wildcardType :
- type.flags & 1 /* Any */ ? keyofConstraintType :
- stringsOnly ? getIndexInfoOfType(type, 0 /* String */) ? stringType : getLiteralTypeFromProperties(type, 128 /* StringLiteral */) :
- getIndexInfoOfType(type, 0 /* String */) ? getUnionType([stringType, numberType, getLiteralTypeFromProperties(type, 8192 /* UniqueESSymbol */)]) :
+ type.flags & 2 /* Unknown */ ? neverType :
+ type.flags & (1 /* Any */ | 131072 /* Never */) ? keyofConstraintType :
+ stringsOnly ? !noIndexSignatures && getIndexInfoOfType(type, 0 /* String */) ? stringType : getLiteralTypeFromProperties(type, 128 /* StringLiteral */) :
+ !noIndexSignatures && getIndexInfoOfType(type, 0 /* String */) ? getUnionType([stringType, numberType, getLiteralTypeFromProperties(type, 8192 /* UniqueESSymbol */)]) :
getNonEnumNumberIndexInfo(type) ? getUnionType([numberType, getLiteralTypeFromProperties(type, 128 /* StringLiteral */ | 8192 /* UniqueESSymbol */)]) :
getLiteralTypeFromProperties(type, 8576 /* StringOrNumberLiteralOrUnique */);
}
@@ -40116,15 +40532,15 @@
var links = getNodeLinks(node);
if (!links.resolvedType) {
switch (node.operator) {
- case 129 /* KeyOfKeyword */:
+ case 130 /* KeyOfKeyword */:
links.resolvedType = getIndexType(getTypeFromTypeNode(node.type));
break;
- case 142 /* UniqueKeyword */:
- links.resolvedType = node.type.kind === 139 /* SymbolKeyword */
+ case 143 /* UniqueKeyword */:
+ links.resolvedType = node.type.kind === 140 /* SymbolKeyword */
? getESSymbolLikeTypeForNode(ts.walkUpParenthesizedTypes(node.parent))
: errorType;
break;
- case 133 /* ReadonlyKeyword */:
+ case 134 /* ReadonlyKeyword */:
links.resolvedType = getTypeFromTypeNode(node.type);
break;
}
@@ -40164,8 +40580,8 @@
}
return false;
}
- function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol, missingType) {
- var accessExpression = accessNode && accessNode.kind === 190 /* ElementAccessExpression */ ? accessNode : undefined;
+ function getPropertyTypeForIndexType(originalObjectType, objectType, indexType, fullIndexType, suppressNoImplicitAnyError, accessNode, accessFlags) {
+ var accessExpression = accessNode && accessNode.kind === 191 /* ElementAccessExpression */ ? accessNode : undefined;
var propName = isTypeUsableAsPropertyName(indexType) ?
getPropertyNameFromType(indexType) :
accessExpression && checkThatExpressionIsProperSymbolReference(accessExpression.argumentExpression, indexType, /*reportError*/ false) ?
@@ -40178,12 +40594,12 @@
var prop = getPropertyOfType(objectType, propName);
if (prop) {
if (accessExpression) {
- markPropertyAsReferenced(prop, accessExpression, /*isThisAccess*/ accessExpression.expression.kind === 100 /* ThisKeyword */);
+ markPropertyAsReferenced(prop, accessExpression, /*isThisAccess*/ accessExpression.expression.kind === 101 /* ThisKeyword */);
if (ts.isAssignmentTarget(accessExpression) && (isReferenceToReadonlyEntity(accessExpression, prop) || isReferenceThroughNamespaceImport(accessExpression))) {
error(accessExpression.argumentExpression, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, symbolToString(prop));
- return missingType;
+ return undefined;
}
- if (cacheSymbol) {
+ if (accessFlags & 4 /* CacheSymbol */) {
getNodeLinks(accessNode).resolvedSymbol = prop;
}
}
@@ -40202,6 +40618,7 @@
error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.unescapeLeadingUnderscores(propName), typeToString(objectType));
}
}
+ errorIfWritingToReadonlyIndex(getIndexInfoOfType(objectType, 1 /* Number */));
return mapType(objectType, function (t) { return getRestTypeOfTupleType(t) || undefinedType; });
}
}
@@ -40209,17 +40626,21 @@
if (objectType.flags & (1 /* Any */ | 131072 /* Never */)) {
return objectType;
}
- var indexInfo = isTypeAssignableToKind(indexType, 296 /* NumberLike */) && getIndexInfoOfType(objectType, 1 /* Number */) ||
- getIndexInfoOfType(objectType, 0 /* String */) ||
- undefined;
+ var stringIndexInfo = getIndexInfoOfType(objectType, 0 /* String */);
+ var indexInfo = isTypeAssignableToKind(indexType, 296 /* NumberLike */) && getIndexInfoOfType(objectType, 1 /* Number */) || stringIndexInfo;
if (indexInfo) {
+ if (accessFlags & 1 /* NoIndexSignatures */ && indexInfo === stringIndexInfo) {
+ if (accessExpression) {
+ error(accessExpression, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(originalObjectType));
+ }
+ return undefined;
+ }
if (accessNode && !isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
var indexNode = getIndexNodeForAccessExpression(accessNode);
error(indexNode, ts.Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType));
+ return indexInfo.type;
}
- else if (accessExpression && indexInfo.isReadonly && (ts.isAssignmentTarget(accessExpression) || ts.isDeleteTarget(accessExpression))) {
- error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
- }
+ errorIfWritingToReadonlyIndex(indexInfo);
return indexInfo.type;
}
if (indexType.flags & 131072 /* Never */) {
@@ -40232,7 +40653,7 @@
if (objectType.symbol === globalThisSymbol && propName !== undefined && globalThisSymbol.exports.has(propName) && (globalThisSymbol.exports.get(propName).flags & 418 /* BlockScoped */)) {
error(accessExpression, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.unescapeLeadingUnderscores(propName), typeToString(objectType));
}
- else if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors) {
+ else if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors && !suppressNoImplicitAnyError) {
if (propName !== undefined && typeHasStaticProperty(propName, objectType)) {
error(accessExpression, ts.Diagnostics.Property_0_is_a_static_member_of_type_1, propName, typeToString(objectType));
}
@@ -40247,11 +40668,35 @@
}
}
else {
- error(accessExpression, ts.Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature, typeToString(objectType));
+ var suggestion_1 = getSuggestionForNonexistentIndexSignature(objectType, accessExpression);
+ if (suggestion_1 !== undefined) {
+ error(accessExpression, ts.Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1, typeToString(objectType), suggestion_1);
+ }
+ else {
+ var errorInfo = void 0;
+ if (indexType.flags & 1024 /* EnumLiteral */) {
+ errorInfo = ts.chainDiagnosticMessages(/* details */ undefined, ts.Diagnostics.Property_0_does_not_exist_on_type_1, "[" + typeToString(indexType) + "]", typeToString(objectType));
+ }
+ else if (indexType.flags & 8192 /* UniqueESSymbol */) {
+ var symbolName_2 = getFullyQualifiedName(indexType.symbol, accessExpression);
+ errorInfo = ts.chainDiagnosticMessages(/* details */ undefined, ts.Diagnostics.Property_0_does_not_exist_on_type_1, "[" + symbolName_2 + "]", typeToString(objectType));
+ }
+ else if (indexType.flags & 128 /* StringLiteral */) {
+ errorInfo = ts.chainDiagnosticMessages(/* details */ undefined, ts.Diagnostics.Property_0_does_not_exist_on_type_1, indexType.value, typeToString(objectType));
+ }
+ else if (indexType.flags & 256 /* NumberLiteral */) {
+ errorInfo = ts.chainDiagnosticMessages(/* details */ undefined, ts.Diagnostics.Property_0_does_not_exist_on_type_1, indexType.value, typeToString(objectType));
+ }
+ else if (indexType.flags & (8 /* Number */ | 4 /* String */)) {
+ errorInfo = ts.chainDiagnosticMessages(/* details */ undefined, ts.Diagnostics.No_index_signature_with_a_parameter_of_type_0_was_found_on_type_1, typeToString(indexType), typeToString(objectType));
}
+ errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1, typeToString(fullIndexType), typeToString(objectType));
+ diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(accessExpression, errorInfo));
}
}
- return missingType;
+ }
+ }
+ return undefined;
}
}
if (isJSLiteralType(objectType)) {
@@ -40272,14 +40717,19 @@
if (isTypeAny(indexType)) {
return indexType;
}
- return missingType;
+ return undefined;
+ function errorIfWritingToReadonlyIndex(indexInfo) {
+ if (indexInfo && indexInfo.isReadonly && accessExpression && (ts.isAssignmentTarget(accessExpression) || ts.isDeleteTarget(accessExpression))) {
+ error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
+ }
+ }
}
function getIndexNodeForAccessExpression(accessNode) {
- return accessNode.kind === 190 /* ElementAccessExpression */
+ return accessNode.kind === 191 /* ElementAccessExpression */
? accessNode.argumentExpression
- : accessNode.kind === 180 /* IndexedAccessType */
+ : accessNode.kind === 181 /* IndexedAccessType */
? accessNode.indexType
- : accessNode.kind === 149 /* ComputedPropertyName */
+ : accessNode.kind === 150 /* ComputedPropertyName */
? accessNode.expression
: accessNode;
}
@@ -40289,67 +40739,124 @@
function isGenericIndexType(type) {
return maybeTypeOfKind(type, 58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */);
}
- function getSimplifiedType(type) {
- return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type) : type;
+ function isThisTypeParameter(type) {
+ return !!(type.flags & 262144 /* TypeParameter */ && type.isThisType);
}
- function distributeIndexOverObjectType(objectType, indexType) {
- // (T | U)[K] -> T[K] | U[K]
- if (objectType.flags & 1048576 /* Union */) {
- return mapType(objectType, function (t) { return getSimplifiedType(getIndexedAccessType(t, indexType)); });
+ function getSimplifiedType(type, writing) {
+ return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) :
+ type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) :
+ type;
}
+ function distributeIndexOverObjectType(objectType, indexType, writing) {
+ // (T | U)[K] -> T[K] | U[K] (reading)
+ // (T | U)[K] -> T[K] & U[K] (writing)
// (T & U)[K] -> T[K] & U[K]
- if (objectType.flags & 2097152 /* Intersection */) {
- return getIntersectionType(ts.map(objectType.types, function (t) { return getSimplifiedType(getIndexedAccessType(t, indexType)); }));
+ if (objectType.flags & 3145728 /* UnionOrIntersection */) {
+ var types = ts.map(objectType.types, function (t) { return getSimplifiedType(getIndexedAccessType(t, indexType), writing); });
+ return objectType.flags & 2097152 /* Intersection */ || writing ? getIntersectionType(types) : getUnionType(types);
+ }
+ }
+ function distributeObjectOverIndexType(objectType, indexType, writing) {
+ // T[A | B] -> T[A] | T[B] (reading)
+ // T[A | B] -> T[A] & T[B] (writing)
+ if (indexType.flags & 1048576 /* Union */) {
+ var types = ts.map(indexType.types, function (t) { return getSimplifiedType(getIndexedAccessType(objectType, t), writing); });
+ return writing ? getIntersectionType(types) : getUnionType(types);
}
}
// Transform an indexed access to a simpler form, if possible. Return the simpler form, or return
- // the type itself if no transformation is possible.
- function getSimplifiedIndexedAccessType(type) {
- if (type.simplified) {
- return type.simplified === circularConstraintType ? type : type.simplified;
+ // the type itself if no transformation is possible. The writing flag indicates that the type is
+ // the target of an assignment.
+ function getSimplifiedIndexedAccessType(type, writing) {
+ var cache = writing ? "simplifiedForWriting" : "simplifiedForReading";
+ if (type[cache]) {
+ return type[cache] === circularConstraintType ? type : type[cache];
}
- type.simplified = circularConstraintType;
+ type[cache] = circularConstraintType;
// We recursively simplify the object type as it may in turn be an indexed access type. For example, with
// '{ [P in T]: { [Q in U]: number } }[T][U]' we want to first simplify the inner indexed access type.
- var objectType = getSimplifiedType(type.objectType);
- var indexType = getSimplifiedType(type.indexType);
- // T[A | B] -> T[A] | T[B]
- if (indexType.flags & 1048576 /* Union */) {
- return type.simplified = mapType(indexType, function (t) { return getSimplifiedType(getIndexedAccessType(objectType, t)); });
+ var objectType = getSimplifiedType(type.objectType, writing);
+ var indexType = getSimplifiedType(type.indexType, writing);
+ // T[A | B] -> T[A] | T[B] (reading)
+ // T[A | B] -> T[A] & T[B] (writing)
+ var distributedOverIndex = distributeObjectOverIndexType(objectType, indexType, writing);
+ if (distributedOverIndex) {
+ return type[cache] = distributedOverIndex;
}
// Only do the inner distributions if the index can no longer be instantiated to cause index distribution again
if (!(indexType.flags & 63176704 /* Instantiable */)) {
- var simplified = distributeIndexOverObjectType(objectType, indexType);
- if (simplified) {
- return type.simplified = simplified;
+ // (T | U)[K] -> T[K] | U[K] (reading)
+ // (T | U)[K] -> T[K] & U[K] (writing)
+ // (T & U)[K] -> T[K] & U[K]
+ var distributedOverObject = distributeIndexOverObjectType(objectType, indexType, writing);
+ if (distributedOverObject) {
+ return type[cache] = distributedOverObject;
}
}
- // So ultimately:
+ // So ultimately (reading):
// ((A & B) | C)[K1 | K2] -> ((A & B) | C)[K1] | ((A & B) | C)[K2] -> (A & B)[K1] | C[K1] | (A & B)[K2] | C[K2] -> (A[K1] & B[K1]) | C[K1] | (A[K2] & B[K2]) | C[K2]
// If the object type is a mapped type { [P in K]: E }, where K is generic, instantiate E using a mapper
// that substitutes the index type for P. For example, for an index access { [P in K]: Box<T[P]> }[X], we
// construct the type Box<T[X]>.
if (isGenericMappedType(objectType)) {
- return type.simplified = mapType(substituteIndexedMappedType(objectType, type.indexType), getSimplifiedType);
+ return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), function (t) { return getSimplifiedType(t, writing); });
}
- return type.simplified = type;
+ return type[cache] = type;
+ }
+ function getSimplifiedConditionalType(type, writing) {
+ var checkType = type.checkType;
+ var extendsType = type.extendsType;
+ var trueType = getTrueTypeFromConditionalType(type);
+ var falseType = getFalseTypeFromConditionalType(type);
+ // Simplifications for types of the form `T extends U ? T : never` and `T extends U ? never : T`.
+ if (falseType.flags & 131072 /* Never */ && getActualTypeVariable(trueType) === getActualTypeVariable(checkType)) {
+ if (checkType.flags & 1 /* Any */ || isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { // Always true
+ return getSimplifiedType(trueType, writing);
+ }
+ else if (isIntersectionEmpty(checkType, extendsType)) { // Always false
+ return neverType;
+ }
+ }
+ else if (trueType.flags & 131072 /* Never */ && getActualTypeVariable(falseType) === getActualTypeVariable(checkType)) {
+ if (!(checkType.flags & 1 /* Any */) && isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { // Always true
+ return neverType;
+ }
+ else if (checkType.flags & 1 /* Any */ || isIntersectionEmpty(checkType, extendsType)) { // Always false
+ return getSimplifiedType(falseType, writing);
+ }
+ }
+ return type;
+ }
+ /**
+ * Invokes union simplification logic to determine if an intersection is considered empty as a union constituent
+ */
+ function isIntersectionEmpty(type1, type2) {
+ return !!(getUnionType([intersectTypes(type1, type2), neverType]).flags & 131072 /* Never */);
}
function substituteIndexedMappedType(objectType, index) {
var mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [index]);
var templateMapper = combineTypeMappers(objectType.mapper, mapper);
return instantiateType(getTemplateTypeFromMappedType(objectType), templateMapper);
}
- function getIndexedAccessType(objectType, indexType, accessNode, missingType) {
- if (missingType === void 0) { missingType = accessNode ? errorType : unknownType; }
+ function getIndexedAccessType(objectType, indexType, accessNode) {
+ return getIndexedAccessTypeOrUndefined(objectType, indexType, accessNode, 0 /* None */) || (accessNode ? errorType : unknownType);
+ }
+ function getIndexedAccessTypeOrUndefined(objectType, indexType, accessNode, accessFlags) {
+ if (accessFlags === void 0) { accessFlags = 0 /* None */; }
if (objectType === wildcardType || indexType === wildcardType) {
return wildcardType;
}
+ // If the object type has a string index signature and no other members we know that the result will
+ // always be the type of that index signature and we can simplify accordingly.
+ if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
+ indexType = stringType;
+ }
// If the index type is generic, or if the object type is generic and doesn't originate in an expression,
// we are performing a higher-order index access where we cannot meaningfully access the properties of the
// object type. Note that for a generic T and a non-generic K, we eagerly resolve T[K] if it originates in
// an expression. This is to preserve backwards compatibility. For example, an element access 'this["foo"]'
// has always been resolved eagerly using the constraint type of 'this' at the given location.
- if (isGenericIndexType(indexType) || !(accessNode && accessNode.kind !== 180 /* IndexedAccessType */) && isGenericObjectType(objectType)) {
+ if (isGenericIndexType(indexType) || !(accessNode && accessNode.kind !== 181 /* IndexedAccessType */) && isGenericObjectType(objectType)) {
if (objectType.flags & 3 /* AnyOrUnknown */) {
return objectType;
}
@@ -40370,25 +40877,25 @@
var wasMissingProp = false;
for (var _i = 0, _a = indexType.types; _i < _a.length; _i++) {
var t = _a[_i];
- var propType = getPropertyTypeForIndexType(apparentObjectType, t, accessNode, /*cacheSymbol*/ false, missingType);
- if (propType === missingType) {
- if (!accessNode) {
+ var propType = getPropertyTypeForIndexType(objectType, apparentObjectType, t, indexType, wasMissingProp, accessNode, accessFlags);
+ if (propType) {
+ propTypes.push(propType);
+ }
+ else if (!accessNode) {
// If there's no error node, we can immeditely stop, since error reporting is off
- return missingType;
+ return undefined;
}
else {
// Otherwise we set a flag and return at the end of the loop so we still mark all errors
wasMissingProp = true;
}
}
- propTypes.push(propType);
- }
if (wasMissingProp) {
- return missingType;
+ return undefined;
}
- return getUnionType(propTypes);
+ return accessFlags & 2 /* Writing */ ? getIntersectionType(propTypes) : getUnionType(propTypes);
}
- return getPropertyTypeForIndexType(apparentObjectType, indexType, accessNode, /*cacheSymbol*/ true, missingType);
+ return getPropertyTypeForIndexType(objectType, apparentObjectType, indexType, indexType, /* supressNoImplicitAnyError */ false, accessNode, accessFlags | 4 /* CacheSymbol */);
}
function getTypeFromIndexedAccessTypeNode(node) {
var links = getNodeLinks(node);
@@ -40418,13 +40925,14 @@
return links.resolvedType;
}
function getActualTypeVariable(type) {
- return type.flags & 33554432 /* Substitution */ ? type.typeVariable : type;
+ if (type.flags & 33554432 /* Substitution */) {
+ return type.typeVariable;
}
- /**
- * Invokes union simplification logic to determine if an intersection is considered empty as a union constituent
- */
- function isIntersectionEmpty(type1, type2) {
- return !!(getUnionType([intersectTypes(type1, type2), neverType]).flags & 131072 /* Never */);
+ if (type.flags & 8388608 /* IndexedAccess */ && (type.objectType.flags & 33554432 /* Substitution */ ||
+ type.indexType.flags & 33554432 /* Substitution */)) {
+ return getIndexedAccessType(getActualTypeVariable(type.objectType), getActualTypeVariable(type.indexType));
+ }
+ return type;
}
function getConditionalType(root, mapper) {
var checkType = instantiateType(root.checkType, mapper);
@@ -40432,35 +40940,6 @@
if (checkType === wildcardType || extendsType === wildcardType) {
return wildcardType;
}
- var trueType = instantiateType(root.trueType, mapper);
- var falseType = instantiateType(root.falseType, mapper);
- var instantiationId = "" + (root.isDistributive ? "d" : "") + getTypeId(checkType) + ">" + getTypeId(extendsType) + "?" + getTypeId(trueType) + ":" + getTypeId(falseType);
- var result = conditionalTypes.get(instantiationId);
- if (result) {
- return result;
- }
- var newResult = getConditionalTypeWorker(root, mapper, checkType, extendsType, trueType, falseType);
- conditionalTypes.set(instantiationId, newResult);
- return newResult;
- }
- function getConditionalTypeWorker(root, mapper, checkType, extendsType, trueType, falseType) {
- // Simplifications for types of the form `T extends U ? T : never` and `T extends U ? never : T`.
- if (falseType.flags & 131072 /* Never */ && getActualTypeVariable(trueType) === getActualTypeVariable(checkType)) {
- if (checkType.flags & 1 /* Any */ || isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { // Always true
- return trueType;
- }
- else if (isIntersectionEmpty(checkType, extendsType)) { // Always false
- return neverType;
- }
- }
- else if (trueType.flags & 131072 /* Never */ && getActualTypeVariable(falseType) === getActualTypeVariable(checkType)) {
- if (!(checkType.flags & 1 /* Any */) && isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { // Always true
- return neverType;
- }
- else if (checkType.flags & 1 /* Any */ || isIntersectionEmpty(checkType, extendsType)) { // Always false
- return falseType;
- }
- }
var checkTypeInstantiable = maybeTypeOfKind(checkType, 63176704 /* Instantiable */ | 131072 /* GenericMappedType */);
var combinedMapper;
if (root.inferTypeParameters) {
@@ -40469,7 +40948,7 @@
// We don't want inferences from constraints as they may cause us to eagerly resolve the
// conditional type instead of deferring resolution. Also, we always want strict function
// types rules (i.e. proper contravariance) for inferences.
- inferTypes(context.inferences, checkType, extendsType, 32 /* NoConstraints */ | 64 /* AlwaysStrict */);
+ inferTypes(context.inferences, checkType, extendsType, 64 /* NoConstraints */ | 128 /* AlwaysStrict */);
}
combinedMapper = combineTypeMappers(mapper, context.mapper);
}
@@ -40478,18 +40957,18 @@
// We attempt to resolve the conditional type only when the check and extends types are non-generic
if (!checkTypeInstantiable && !maybeTypeOfKind(inferredExtendsType, 63176704 /* Instantiable */ | 131072 /* GenericMappedType */)) {
if (inferredExtendsType.flags & 3 /* AnyOrUnknown */) {
- return trueType;
+ return instantiateType(root.trueType, combinedMapper || mapper);
}
// Return union of trueType and falseType for 'any' since it matches anything
if (checkType.flags & 1 /* Any */) {
- return getUnionType([instantiateType(root.trueType, combinedMapper || mapper), falseType]);
+ return getUnionType([instantiateType(root.trueType, combinedMapper || mapper), instantiateType(root.falseType, mapper)]);
}
// Return falseType for a definitely false extends check. We check an instantiations of the two
// types with type parameters mapped to the wildcard type, the most permissive instantiations
// possible (the wildcard type is assignable to and from all types). If those are not related,
// then no instantiations will be and we can just return the false branch type.
if (!isTypeAssignableTo(getPermissiveInstantiation(checkType), getPermissiveInstantiation(inferredExtendsType))) {
- return falseType;
+ return instantiateType(root.falseType, mapper);
}
// Return trueType for a definitely true extends check. We check instantiations of the two
// types with type parameters mapped to their restrictive form, i.e. a form of the type parameter
@@ -40501,9 +40980,6 @@
}
}
// Return a deferred type for a check that is neither definitely true nor definitely false
- return getDeferredConditionalType(root, mapper, combinedMapper, checkType, extendsType, trueType, falseType);
- }
- function getDeferredConditionalType(root, mapper, combinedMapper, checkType, extendsType, trueType, falseType) {
var erasedCheckType = getActualTypeVariable(checkType);
var result = createType(16777216 /* Conditional */);
result.root = root;
@@ -40511,14 +40987,18 @@
result.extendsType = extendsType;
result.mapper = mapper;
result.combinedMapper = combinedMapper;
- result.trueType = trueType;
- result.falseType = falseType;
result.aliasSymbol = root.aliasSymbol;
result.aliasTypeArguments = instantiateTypes(root.aliasTypeArguments, mapper); // TODO: GH#18217
return result;
}
+ function getTrueTypeFromConditionalType(type) {
+ return type.resolvedTrueType || (type.resolvedTrueType = instantiateType(type.root.trueType, type.mapper));
+ }
+ function getFalseTypeFromConditionalType(type) {
+ return type.resolvedFalseType || (type.resolvedFalseType = instantiateType(type.root.falseType, type.mapper));
+ }
function getInferredTrueTypeFromConditionalType(type) {
- return type.resolvedInferredTrueType || (type.resolvedInferredTrueType = instantiateType(type.root.trueType, type.combinedMapper || type.mapper));
+ return type.resolvedInferredTrueType || (type.resolvedInferredTrueType = type.combinedMapper ? instantiateType(type.root.trueType, type.combinedMapper) : getTrueTypeFromConditionalType(type));
}
function getInferTypeParameters(node) {
var result;
@@ -40531,20 +41011,6 @@
}
return result;
}
- function isPossiblyReferencedInConditionalType(tp, node) {
- if (isTypeParameterPossiblyReferenced(tp, node)) {
- return true;
- }
- while (node) {
- if (node.kind === 175 /* ConditionalType */) {
- if (isTypeParameterPossiblyReferenced(tp, node.extendsType)) {
- return true;
- }
- }
- node = node.parent;
- }
- return false;
- }
function getTypeFromConditionalTypeNode(node) {
var links = getNodeLinks(node);
if (!links.resolvedType) {
@@ -40552,7 +41018,7 @@
var aliasSymbol = getAliasSymbolForTypeNode(node);
var aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol);
var allOuterTypeParameters = getOuterTypeParameters(node, /*includeThisTypes*/ true);
- var outerTypeParameters = aliasTypeArguments ? allOuterTypeParameters : ts.filter(allOuterTypeParameters, function (tp) { return isPossiblyReferencedInConditionalType(tp, node); });
+ var outerTypeParameters = aliasTypeArguments ? allOuterTypeParameters : ts.filter(allOuterTypeParameters, function (tp) { return isTypeParameterPossiblyReferenced(tp, node); });
var root = {
node: node,
checkType: checkType,
@@ -40863,9 +41329,9 @@
function getThisType(node) {
var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false);
var parent = container && container.parent;
- if (parent && (ts.isClassLike(parent) || parent.kind === 241 /* InterfaceDeclaration */)) {
+ if (parent && (ts.isClassLike(parent) || parent.kind === 242 /* InterfaceDeclaration */)) {
if (!ts.hasModifier(container, 32 /* Static */) &&
- (container.kind !== 157 /* Constructor */ || ts.isNodeDescendantOf(node, container.body))) {
+ (container.kind !== 158 /* Constructor */ || ts.isNodeDescendantOf(node, container.body))) {
return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType;
}
}
@@ -40881,89 +41347,89 @@
}
function getTypeFromTypeNode(node) {
switch (node.kind) {
- case 120 /* AnyKeyword */:
- case 289 /* JSDocAllType */:
- case 290 /* JSDocUnknownType */:
+ case 121 /* AnyKeyword */:
+ case 290 /* JSDocAllType */:
+ case 291 /* JSDocUnknownType */:
return anyType;
- case 143 /* UnknownKeyword */:
+ case 144 /* UnknownKeyword */:
return unknownType;
- case 138 /* StringKeyword */:
+ case 139 /* StringKeyword */:
return stringType;
- case 135 /* NumberKeyword */:
+ case 136 /* NumberKeyword */:
return numberType;
- case 146 /* BigIntKeyword */:
+ case 147 /* BigIntKeyword */:
return bigintType;
- case 123 /* BooleanKeyword */:
+ case 124 /* BooleanKeyword */:
return booleanType;
- case 139 /* SymbolKeyword */:
+ case 140 /* SymbolKeyword */:
return esSymbolType;
- case 106 /* VoidKeyword */:
+ case 107 /* VoidKeyword */:
return voidType;
- case 141 /* UndefinedKeyword */:
+ case 142 /* UndefinedKeyword */:
return undefinedType;
- case 96 /* NullKeyword */:
+ case 97 /* NullKeyword */:
return nullType;
- case 132 /* NeverKeyword */:
+ case 133 /* NeverKeyword */:
return neverType;
- case 136 /* ObjectKeyword */:
+ case 137 /* ObjectKeyword */:
return node.flags & 65536 /* JavaScriptFile */ ? anyType : nonPrimitiveType;
- case 178 /* ThisType */:
- case 100 /* ThisKeyword */:
+ case 179 /* ThisType */:
+ case 101 /* ThisKeyword */:
return getTypeFromThisTypeNode(node);
- case 182 /* LiteralType */:
+ case 183 /* LiteralType */:
return getTypeFromLiteralTypeNode(node);
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return getTypeFromTypeReference(node);
- case 163 /* TypePredicate */:
+ case 164 /* TypePredicate */:
return booleanType;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return getTypeFromTypeReference(node);
- case 167 /* TypeQuery */:
+ case 168 /* TypeQuery */:
return getTypeFromTypeQueryNode(node);
- case 169 /* ArrayType */:
+ case 170 /* ArrayType */:
return getTypeFromArrayTypeNode(node);
- case 170 /* TupleType */:
+ case 171 /* TupleType */:
return getTypeFromTupleTypeNode(node);
- case 171 /* OptionalType */:
+ case 172 /* OptionalType */:
return getTypeFromOptionalTypeNode(node);
- case 173 /* UnionType */:
+ case 174 /* UnionType */:
return getTypeFromUnionTypeNode(node);
- case 174 /* IntersectionType */:
+ case 175 /* IntersectionType */:
return getTypeFromIntersectionTypeNode(node);
- case 291 /* JSDocNullableType */:
+ case 292 /* JSDocNullableType */:
return getTypeFromJSDocNullableTypeNode(node);
- case 293 /* JSDocOptionalType */:
+ case 294 /* JSDocOptionalType */:
return addOptionality(getTypeFromTypeNode(node.type));
- case 177 /* ParenthesizedType */:
- case 172 /* RestType */:
- case 292 /* JSDocNonNullableType */:
- case 288 /* JSDocTypeExpression */:
+ case 178 /* ParenthesizedType */:
+ case 173 /* RestType */:
+ case 293 /* JSDocNonNullableType */:
+ case 289 /* JSDocTypeExpression */:
return getTypeFromTypeNode(node.type);
- case 295 /* JSDocVariadicType */:
+ case 296 /* JSDocVariadicType */:
return getTypeFromJSDocVariadicType(node);
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 168 /* TypeLiteral */:
- case 297 /* JSDocTypeLiteral */:
- case 294 /* JSDocFunctionType */:
- case 298 /* JSDocSignature */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 169 /* TypeLiteral */:
+ case 298 /* JSDocTypeLiteral */:
+ case 295 /* JSDocFunctionType */:
+ case 299 /* JSDocSignature */:
return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node);
- case 179 /* TypeOperator */:
+ case 180 /* TypeOperator */:
return getTypeFromTypeOperatorNode(node);
- case 180 /* IndexedAccessType */:
+ case 181 /* IndexedAccessType */:
return getTypeFromIndexedAccessTypeNode(node);
- case 181 /* MappedType */:
+ case 182 /* MappedType */:
return getTypeFromMappedTypeNode(node);
- case 175 /* ConditionalType */:
+ case 176 /* ConditionalType */:
return getTypeFromConditionalTypeNode(node);
- case 176 /* InferType */:
+ case 177 /* InferType */:
return getTypeFromInferTypeNode(node);
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return getTypeFromImportTypeNode(node);
// This function assumes that an identifier or qualified name is a type expression
// Callers should first ensure this by calling isTypeNode
- case 72 /* Identifier */:
- case 148 /* QualifiedName */:
+ case 73 /* Identifier */:
+ case 149 /* QualifiedName */:
var symbol = getSymbolAtLocation(node);
return symbol ? getDeclaredTypeOfSymbol(symbol) : errorType;
default:
@@ -41023,7 +41489,7 @@
* This is used during inference when instantiating type parameter defaults.
*/
function createBackreferenceMapper(context, index) {
- return function (t) { return ts.findIndex(context.inferences, function (info) { return info.typeParameter === t; }) >= index ? emptyObjectType : t; };
+ return function (t) { return ts.findIndex(context.inferences, function (info) { return info.typeParameter === t; }) >= index ? unknownType : t; };
}
function combineTypeMappers(mapper1, mapper2) {
if (!mapper1)
@@ -41106,7 +41572,7 @@
}
// Keep the flags from the symbol we're instantiating. Mark that is instantiated, and
// also transient so that we can just store data on it directly.
- var result = createSymbol(symbol.flags, symbol.escapedName, 1 /* Instantiated */ | ts.getCheckFlags(symbol) & (8 /* Readonly */ | 2048 /* Late */ | 8192 /* OptionalParameter */ | 16384 /* RestParameter */));
+ var result = createSymbol(symbol.flags, symbol.escapedName, 1 /* Instantiated */ | ts.getCheckFlags(symbol) & (8 /* Readonly */ | 4096 /* Late */ | 16384 /* OptionalParameter */ | 32768 /* RestParameter */));
result.declarations = symbol.declarations;
result.parent = symbol.parent;
result.target = symbol;
@@ -41172,28 +41638,31 @@
return type;
}
function maybeTypeParameterReference(node) {
- return !(node.kind === 148 /* QualifiedName */ ||
- node.parent.kind === 164 /* TypeReference */ && node.parent.typeArguments && node === node.parent.typeName);
+ return !(node.kind === 149 /* QualifiedName */ ||
+ node.parent.kind === 165 /* TypeReference */ && node.parent.typeArguments && node === node.parent.typeName);
}
function isTypeParameterPossiblyReferenced(tp, node) {
// If the type parameter doesn't have exactly one declaration, if there are invening statement blocks
// between the node and the type parameter declaration, if the node contains actual references to the
// type parameter, or if the node contains type queries, we consider the type parameter possibly referenced.
if (tp.symbol && tp.symbol.declarations && tp.symbol.declarations.length === 1) {
- var container_3 = tp.symbol.declarations[0].parent;
- if (ts.findAncestor(node, function (n) { return n.kind === 218 /* Block */ ? "quit" : n === container_3; })) {
- return !!ts.forEachChild(node, containsReference);
+ var container = tp.symbol.declarations[0].parent;
+ for (var n = node; n !== container; n = n.parent) {
+ if (!n || n.kind === 219 /* Block */ || n.kind === 176 /* ConditionalType */ && ts.forEachChild(n.extendsType, containsReference)) {
+ return true;
}
}
+ return !!ts.forEachChild(node, containsReference);
+ }
return true;
function containsReference(node) {
switch (node.kind) {
- case 178 /* ThisType */:
+ case 179 /* ThisType */:
return !!tp.isThisType;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return !tp.isThisType && ts.isPartOfTypeNode(node) && maybeTypeParameterReference(node) &&
getTypeFromTypeNode(node) === tp;
- case 167 /* TypeQuery */:
+ case 168 /* TypeQuery */:
return true;
}
return !!ts.forEachChild(node, containsReference);
@@ -41341,7 +41810,7 @@
// If the anonymous type originates in a declaration of a function, method, class, or
// interface, in an object type literal, or in an object literal expression, we may need
// to instantiate the type because it might reference a type parameter.
- return type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations ?
+ return couldContainTypeVariables(type) ?
getAnonymousTypeInstantiation(type, mapper) : type;
}
if (objectFlags & 32 /* Mapped */) {
@@ -41380,7 +41849,7 @@
}
else {
var sub = instantiateType(type.substitute, mapper);
- if (sub.flags & 3 /* AnyOrUnknown */ || isTypeSubtypeOf(getRestrictiveInstantiation(maybeVariable), getRestrictiveInstantiation(sub))) {
+ if (sub.flags & 3 /* AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(maybeVariable), getRestrictiveInstantiation(sub))) {
return maybeVariable;
}
return sub;
@@ -41414,34 +41883,34 @@
// Returns true if the given expression contains (at any level of nesting) a function or arrow expression
// that is subject to contextual typing.
function isContextSensitive(node) {
- ts.Debug.assert(node.kind !== 156 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
+ ts.Debug.assert(node.kind !== 157 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
switch (node.kind) {
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 156 /* MethodDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
return isContextSensitiveFunctionLikeDeclaration(node);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return ts.some(node.properties, isContextSensitive);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return ts.some(node.elements, isContextSensitive);
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return isContextSensitive(node.whenTrue) ||
isContextSensitive(node.whenFalse);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return node.operatorToken.kind === 55 /* BarBarToken */ &&
(isContextSensitive(node.left) || isContextSensitive(node.right));
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return isContextSensitive(node.initializer);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return isContextSensitive(node.expression);
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
return ts.some(node.properties, isContextSensitive) || ts.isJsxOpeningElement(node.parent) && ts.some(node.parent.parent.children, isContextSensitive);
- case 267 /* JsxAttribute */: {
+ case 268 /* JsxAttribute */: {
// If there is no initializer, JSX attribute has a boolean value of true which is not context sensitive.
var initializer = node.initializer;
return !!initializer && isContextSensitive(initializer);
}
- case 270 /* JsxExpression */: {
+ case 271 /* JsxExpression */: {
// It is possible to that node.expression is undefined (e.g <div x={} />)
var expression = node.expression;
return !!expression && isContextSensitive(expression);
@@ -41458,7 +41927,7 @@
if (ts.some(node.parameters, function (p) { return !ts.getEffectiveTypeAnnotationNode(p); })) {
return true;
}
- if (node.kind !== 197 /* ArrowFunction */) {
+ if (node.kind !== 198 /* ArrowFunction */) {
// If the first parameter is not an explicit 'this' parameter, then the function has
// an implicit 'this' parameter which is subject to contextual typing.
var parameter = ts.firstOrUndefined(node.parameters);
@@ -41470,7 +41939,7 @@
}
function hasContextSensitiveReturnExpression(node) {
// TODO(anhans): A block should be context-sensitive if it has a context-sensitive return value.
- return !!node.body && node.body.kind !== 218 /* Block */ && isContextSensitive(node.body);
+ return !!node.body && node.body.kind !== 219 /* Block */ && isContextSensitive(node.body);
}
function isContextSensitiveFunctionOrObjectLiteralMethod(func) {
return (ts.isInJSFile(func) && ts.isFunctionDeclaration(func) || isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) &&
@@ -41523,7 +41992,7 @@
function isTypeDerivedFrom(source, target) {
return source.flags & 1048576 /* Union */ ? ts.every(source.types, function (t) { return isTypeDerivedFrom(t, target); }) :
target.flags & 1048576 /* Union */ ? ts.some(target.types, function (t) { return isTypeDerivedFrom(source, t); }) :
- source.flags & 58982400 /* InstantiableNonPrimitive */ ? isTypeDerivedFrom(getBaseConstraintOfType(source) || emptyObjectType, target) :
+ source.flags & 58982400 /* InstantiableNonPrimitive */ ? isTypeDerivedFrom(getBaseConstraintOfType(source) || unknownType, target) :
target === globalObjectType ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) :
target === globalFunctionType ? !!(source.flags & 524288 /* Object */) && isFunctionObjectType(source) :
hasBaseType(source, getTargetType(target));
@@ -41572,23 +42041,23 @@
return true;
}
switch (node.kind) {
- case 270 /* JsxExpression */:
- case 195 /* ParenthesizedExpression */:
+ case 271 /* JsxExpression */:
+ case 196 /* ParenthesizedExpression */:
return elaborateError(node.expression, source, target, relation, headMessage);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
switch (node.operatorToken.kind) {
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
case 27 /* CommaToken */:
return elaborateError(node.right, source, target, relation, headMessage);
}
break;
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return elaborateObjectLiteral(node, source, target, relation);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return elaborateArrayLiteral(node, source, target, relation);
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
return elaborateJsxComponents(node, source, target, relation);
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return elaborateArrowFunction(node, source, target, relation);
}
return false;
@@ -41657,11 +42126,11 @@
var reportedError = false;
for (var status = iterator.next(); !status.done; status = iterator.next()) {
var _a = status.value, prop = _a.errorNode, next = _a.innerExpression, nameType = _a.nameType, errorMessage = _a.errorMessage;
- var targetPropType = getIndexedAccessType(target, nameType, /*accessNode*/ undefined, errorType);
- if (targetPropType === errorType || targetPropType.flags & 8388608 /* IndexedAccess */)
+ var targetPropType = getIndexedAccessTypeOrUndefined(target, nameType);
+ if (!targetPropType || targetPropType.flags & 8388608 /* IndexedAccess */)
continue; // Don't elaborate on indexes on generic variables
- var sourcePropType = getIndexedAccessType(source, nameType, /*accessNode*/ undefined, errorType);
- if (sourcePropType !== errorType && targetPropType !== errorType && !checkTypeRelatedTo(sourcePropType, targetPropType, relation, /*errorNode*/ undefined)) {
+ var sourcePropType = getIndexedAccessTypeOrUndefined(source, nameType);
+ if (sourcePropType && !checkTypeRelatedTo(sourcePropType, targetPropType, relation, /*errorNode*/ undefined)) {
var elaborated = next && elaborateError(next, sourcePropType, targetPropType, relation, /*headMessage*/ undefined);
if (elaborated) {
reportedError = true;
@@ -41760,7 +42229,7 @@
}
function getElaborationElementForJsxChild(child, nameType, getInvalidTextDiagnostic) {
switch (child.kind) {
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
// child is of the type of the expression
return { errorNode: child, innerExpression: child.expression, nameType: nameType };
case 11 /* JsxText */:
@@ -41769,15 +42238,18 @@
}
// child is a string
return { errorNode: child, innerExpression: undefined, nameType: nameType, errorMessage: getInvalidTextDiagnostic() };
- case 260 /* JsxElement */:
- case 261 /* JsxSelfClosingElement */:
- case 264 /* JsxFragment */:
+ case 261 /* JsxElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 265 /* JsxFragment */:
// child is of type JSX.Element
return { errorNode: child, innerExpression: child, nameType: nameType };
default:
return ts.Debug.assertNever(child, "Found invalid jsx child");
}
}
+ function getSemanticJsxChildren(children) {
+ return ts.filter(children, function (i) { return !ts.isJsxText(i) || !i.containsOnlyTriviaWhiteSpaces; });
+ }
function elaborateJsxComponents(node, source, target, relation) {
var result = elaborateElementwise(generateJsxAttributes(node), source, target, relation);
var invalidTextDiagnostic;
@@ -41787,7 +42259,7 @@
var childrenPropName = childPropName === undefined ? "children" : ts.unescapeLeadingUnderscores(childPropName);
var childrenNameType = getLiteralType(childrenPropName);
var childrenTargetType = getIndexedAccessType(target, childrenNameType);
- var validChildren = ts.filter(containingElement.children, function (i) { return !ts.isJsxText(i) || !i.containsOnlyTriviaWhiteSpaces; });
+ var validChildren = getSemanticJsxChildren(containingElement.children);
if (!ts.length(validChildren)) {
return result;
}
@@ -41871,6 +42343,8 @@
});
}
function elaborateArrayLiteral(node, source, target, relation) {
+ if (target.flags & 131068 /* Primitive */)
+ return false;
if (isTupleLikeType(source)) {
return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation);
}
@@ -41901,11 +42375,11 @@
}
_b = prop.kind;
switch (_b) {
- case 159 /* SetAccessor */: return [3 /*break*/, 2];
- case 158 /* GetAccessor */: return [3 /*break*/, 2];
- case 156 /* MethodDeclaration */: return [3 /*break*/, 2];
- case 276 /* ShorthandPropertyAssignment */: return [3 /*break*/, 2];
- case 275 /* PropertyAssignment */: return [3 /*break*/, 4];
+ case 160 /* SetAccessor */: return [3 /*break*/, 2];
+ case 159 /* GetAccessor */: return [3 /*break*/, 2];
+ case 157 /* MethodDeclaration */: return [3 /*break*/, 2];
+ case 277 /* ShorthandPropertyAssignment */: return [3 /*break*/, 2];
+ case 276 /* PropertyAssignment */: return [3 /*break*/, 4];
}
return [3 /*break*/, 6];
case 2: return [4 /*yield*/, { errorNode: prop.name, innerExpression: undefined, nameType: type }];
@@ -41927,6 +42401,8 @@
});
}
function elaborateObjectLiteral(node, source, target, relation) {
+ if (target.flags & 131068 /* Primitive */)
+ return false;
return elaborateElementwise(generateObjectLiteralElements(node), source, target, relation);
}
/**
@@ -41975,8 +42451,8 @@
return 0 /* False */;
}
var kind = target.declaration ? target.declaration.kind : 0 /* Unknown */;
- var strictVariance = !callbackCheck && strictFunctionTypes && kind !== 156 /* MethodDeclaration */ &&
- kind !== 155 /* MethodSignature */ && kind !== 157 /* Constructor */;
+ var strictVariance = !callbackCheck && strictFunctionTypes && kind !== 157 /* MethodDeclaration */ &&
+ kind !== 156 /* MethodSignature */ && kind !== 158 /* Constructor */;
var result = -1 /* True */;
var sourceThisType = getThisTypeOfSignature(source);
if (sourceThisType && sourceThisType !== voidType) {
@@ -42024,12 +42500,14 @@
result &= related;
}
if (!ignoreReturnTypes) {
- var targetReturnType = (target.declaration && isJSConstructor(target.declaration)) ?
+ // If a signature reolution is already in-flight, skip issuing a circularity error
+ // here and just use the `any` type directly
+ var targetReturnType = isResolvingReturnTypeOfSignature(target) ? anyType : (target.declaration && isJSConstructor(target.declaration)) ?
getJSClassType(target.declaration.symbol) : getReturnTypeOfSignature(target);
if (targetReturnType === voidType) {
return result;
}
- var sourceReturnType = (source.declaration && isJSConstructor(source.declaration)) ?
+ var sourceReturnType = isResolvingReturnTypeOfSignature(source) ? anyType : (source.declaration && isJSConstructor(source.declaration)) ?
getJSClassType(source.declaration.symbol) : getReturnTypeOfSignature(source);
// The following block preserves behavior forbidding boolean returning functions from being assignable to type guard returning functions
var targetTypePredicate = getTypePredicateOfSignature(target);
@@ -42108,6 +42586,11 @@
function isEmptyAnonymousObjectType(type) {
return !!(ts.getObjectFlags(type) & 16 /* Anonymous */) && isEmptyObjectType(type);
}
+ function isStringIndexSignatureOnlyType(type) {
+ return type.flags & 524288 /* Object */ && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfoOfType(type, 0 /* String */) && !getIndexInfoOfType(type, 1 /* Number */) ||
+ type.flags & 3145728 /* UnionOrIntersection */ && ts.every(type.types, isStringIndexSignatureOnlyType) ||
+ false;
+ }
function isEnumTypeRelatedTo(sourceSymbol, targetSymbol, errorReporter) {
if (sourceSymbol === targetSymbol) {
return true;
@@ -42216,8 +42699,8 @@
}
return false;
}
- function isIgnoredJsxProperty(source, sourceProp, targetMemberType) {
- return ts.getObjectFlags(source) & 4096 /* JsxAttributes */ && !(isUnhyphenatedJsxName(sourceProp.escapedName) || targetMemberType);
+ function isIgnoredJsxProperty(source, sourceProp) {
+ return ts.getObjectFlags(source) & 4096 /* JsxAttributes */ && !isUnhyphenatedJsxName(sourceProp.escapedName);
}
/**
* Checks if 'source' is related to 'target' (e.g.: is a assignable to).
@@ -42239,7 +42722,7 @@
var depth = 0;
var expandingFlags = 0 /* None */;
var overflow = false;
- var suppressNextError = false;
+ var overrideNextErrorInfo;
ts.Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
var result = isRelatedTo(source, target, /*reportErrors*/ !!errorNode, headMessage);
if (overflow) {
@@ -42247,9 +42730,9 @@
}
else if (errorInfo) {
if (containingMessageChain) {
- var chain_1 = containingMessageChain();
- if (chain_1) {
- errorInfo = ts.concatenateDiagnosticMessageChains(chain_1, errorInfo);
+ var chain = containingMessageChain();
+ if (chain) {
+ errorInfo = ts.concatenateDiagnosticMessageChains(chain, errorInfo);
}
}
var relatedInformation = void 0;
@@ -42289,11 +42772,9 @@
}
}
function reportRelationError(message, source, target) {
- var sourceType = typeToString(source);
- var targetType = typeToString(target);
- if (sourceType === targetType) {
- sourceType = typeToString(source, /*enclosingDeclaration*/ undefined, 64 /* UseFullyQualifiedType */);
- targetType = typeToString(target, /*enclosingDeclaration*/ undefined, 64 /* UseFullyQualifiedType */);
+ var _a = getTypeNamesForErrorDisplay(source, target), sourceType = _a[0], targetType = _a[1];
+ if (target.flags & 262144 /* TypeParameter */ && target.immediateBaseConstraint !== undefined && isTypeAssignableTo(source, target.immediateBaseConstraint)) {
+ reportError(ts.Diagnostics._0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_constraint_2, sourceType, targetType, typeToString(target.immediateBaseConstraint));
}
if (!message) {
if (relation === comparableRelation) {
@@ -42318,25 +42799,39 @@
reportError(ts.Diagnostics._0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible, targetType, sourceType);
}
}
- function isUnionOrIntersectionTypeWithoutNullableConstituents(type) {
- if (!(type.flags & 3145728 /* UnionOrIntersection */)) {
+ /**
+ * Try and elaborate array and tuple errors. Returns false
+ * if we have found an elaboration, or we should ignore
+ * any other elaborations when relating the `source` and
+ * `target` types.
+ *
+ * @param source
+ * @param target
+ * @param reportErrors
+ */
+ function tryElaborateArrayLikeErrors(source, target, reportErrors) {
+ if (isTupleLikeType(source)) {
+ var sourceTuple = source.target;
+ if (sourceTuple && sourceTuple.readonly && isArrayOrTupleLikeType(target) &&
+ (!isReadonlyArrayType(target) || isTupleType(target) && !target.target.readonly)) {
+ if (reportErrors) {
+ reportError(ts.Diagnostics.The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1, typeToString(source), typeToString(target));
+ }
return false;
}
- // at this point we know that this is union or intersection type possibly with nullable constituents.
- // check if we still will have compound type if we ignore nullable components.
- var seenNonNullable = false;
- for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
- var t = _a[_i];
- if (t.flags & 98304 /* Nullable */) {
- continue;
+ return isArrayLikeType(target);
}
- if (seenNonNullable) {
- return true;
+ if (isTupleLikeType(target)) {
+ return isArrayLikeType(source);
}
- seenNonNullable = true;
+ if (isReadonlyArrayType(source) && isArrayType(target) && !isReadonlyArrayType(target)) {
+ if (reportErrors) {
+ reportError(ts.Diagnostics.The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1, typeToString(source), typeToString(target));
}
return false;
}
+ return true;
+ }
/**
* Compare two types and return
* * Ternary.True if they are related with no assumptions,
@@ -42357,11 +42852,11 @@
if (target.flags & 33554432 /* Substitution */) {
target = target.typeVariable;
}
- if (source.flags & 8388608 /* IndexedAccess */) {
- source = getSimplifiedType(source);
+ if (source.flags & 25165824 /* Simplifiable */) {
+ source = getSimplifiedType(source, /*writing*/ false);
}
- if (target.flags & 8388608 /* IndexedAccess */) {
- target = getSimplifiedType(target);
+ if (target.flags & 25165824 /* Simplifiable */) {
+ target = getSimplifiedType(target, /*writing*/ true);
}
// Try to see if we're relating something like `Foo` -> `Bar | null | undefined`.
// If so, reporting the `null` and `undefined` in the type is hardly useful.
@@ -42389,7 +42884,8 @@
isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : undefined))
return -1 /* True */;
var isComparingJsxAttributes = !!(ts.getObjectFlags(source) & 4096 /* JsxAttributes */);
- if (isObjectLiteralType(source) && ts.getObjectFlags(source) & 32768 /* FreshLiteral */) {
+ var isPerformingExcessPropertyChecks = (isObjectLiteralType(source) && ts.getObjectFlags(source) & 32768 /* FreshLiteral */);
+ if (isPerformingExcessPropertyChecks) {
var discriminantType = target.flags & 1048576 /* Union */ ? findMatchingDiscriminantType(source, target) : undefined;
if (hasExcessProperties(source, target, discriminantType, reportErrors)) {
if (reportErrors) {
@@ -42397,13 +42893,6 @@
}
return 0 /* False */;
}
- // Above we check for excess properties with respect to the entire target type. When union
- // and intersection types are further deconstructed on the target side, we don't want to
- // make the check again (as it might fail for a partial target type). Therefore we obtain
- // the regular source type and proceed with that.
- if (isUnionOrIntersectionTypeWithoutNullableConstituents(target) && !discriminantType) {
- source = getRegularTypeOfObjectLiteral(source);
- }
}
if (relation !== comparableRelation && !isApparentIntersectionConstituent &&
source.flags & (131068 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source !== globalObjectType &&
@@ -42436,11 +42925,24 @@
}
else {
if (target.flags & 1048576 /* Union */) {
- result = typeRelatedToSomeType(source, target, reportErrors && !(source.flags & 131068 /* Primitive */) && !(target.flags & 131068 /* Primitive */));
+ result = typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source), target, reportErrors && !(source.flags & 131068 /* Primitive */) && !(target.flags & 131068 /* Primitive */));
+ if (result && isPerformingExcessPropertyChecks) {
+ // Validate against excess props using the original `source`
+ var discriminantType = target.flags & 1048576 /* Union */ ? findMatchingDiscriminantType(source, target) : undefined;
+ if (!propertiesRelatedTo(source, discriminantType || target, reportErrors, /*excludedProperties*/ undefined)) {
+ return 0 /* False */;
+ }
+ }
}
else if (target.flags & 2097152 /* Intersection */) {
isIntersectionConstituent = true; // set here to affect the following trio of checks
- result = typeRelatedToEachType(source, target, reportErrors);
+ result = typeRelatedToEachType(getRegularTypeOfObjectLiteral(source), target, reportErrors);
+ if (result && isPerformingExcessPropertyChecks) {
+ // Validate against excess props using the original `source`
+ if (!propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined)) {
+ return 0 /* False */;
+ }
+ }
}
else if (source.flags & 2097152 /* Intersection */) {
// Check to see if any constituents of the intersection are immediately related to the target.
@@ -42482,8 +42984,15 @@
}
}
if (!result && reportErrors) {
- var maybeSuppress = suppressNextError;
- suppressNextError = false;
+ var maybeSuppress = overrideNextErrorInfo;
+ overrideNextErrorInfo = undefined;
+ if (source.flags & 524288 /* Object */ && target.flags & 524288 /* Object */) {
+ var currentError = errorInfo;
+ tryElaborateArrayLikeErrors(source, target, reportErrors);
+ if (errorInfo !== currentError) {
+ maybeSuppress = errorInfo;
+ }
+ }
if (source.flags & 524288 /* Object */ && target.flags & 131068 /* Primitive */) {
tryElaborateErrorsForPrimitivesAndObjects(source, target);
}
@@ -42578,7 +43087,7 @@
return { value: true };
}
};
- for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) {
+ for (var _i = 0, _a = getPropertiesOfType(source); _i < _a.length; _i++) {
var prop = _a[_i];
var state_3 = _loop_7(prop);
if (typeof state_3 === "object")
@@ -42685,8 +43194,8 @@
}
// Keep this up-to-date with the same logic within `getApparentTypeOfContextualType`, since they should behave similarly
function findMatchingDiscriminantType(source, target) {
- if (target.flags & 1048576 /* Union */) {
- var sourceProperties = getPropertiesOfObjectType(source);
+ if (target.flags & 1048576 /* Union */ && source.flags & (2097152 /* Intersection */ | 524288 /* Object */)) {
+ var sourceProperties = getPropertiesOfType(source);
if (sourceProperties) {
var sourcePropertiesFiltered = findDiscriminantProperties(sourceProperties, target);
if (sourcePropertiesFiltered) {
@@ -42749,13 +43258,20 @@
// When variance information isn't available we default to covariance. This happens
// in the process of computing variance information for recursive types and when
// comparing 'this' type arguments.
- var variance = i < variances.length ? variances[i] : 1 /* Covariant */;
+ var varianceFlags = i < variances.length ? variances[i] : 1 /* Covariant */;
+ var variance = varianceFlags & 7 /* VarianceMask */;
// We ignore arguments for independent type parameters (because they're never witnessed).
if (variance !== 4 /* Independent */) {
var s = sources[i];
var t = targets[i];
var related = -1 /* True */;
- if (variance === 1 /* Covariant */) {
+ if (varianceFlags & 8 /* Unmeasurable */) {
+ // Even an `Unmeasurable` variance works out without a structural check if the source and target are _identical_.
+ // We can't simply assume invariance, because `Unmeasurable` marks nonlinear relations, for example, a relation tained by
+ // the `-?` modifier in a mapped type (where, no matter how the inputs are related, the outputs still might not be)
+ related = relation === identityRelation ? isRelatedTo(s, t, /*reportErrors*/ false) : compareTypesIdentical(s, t);
+ }
+ else if (variance === 1 /* Covariant */) {
related = isRelatedTo(s, t, reportErrors);
}
else if (variance === 2 /* Contravariant */) {
@@ -42874,8 +43390,8 @@
if (source.root.isDistributive === target.root.isDistributive) {
if (result_3 = isRelatedTo(source.checkType, target.checkType, /*reportErrors*/ false)) {
if (result_3 &= isRelatedTo(source.extendsType, target.extendsType, /*reportErrors*/ false)) {
- if (result_3 &= isRelatedTo(source.trueType, target.trueType, /*reportErrors*/ false)) {
- if (result_3 &= isRelatedTo(source.falseType, target.falseType, /*reportErrors*/ false)) {
+ if (result_3 &= isRelatedTo(getTrueTypeFromConditionalType(source), getTrueTypeFromConditionalType(target), /*reportErrors*/ false)) {
+ if (result_3 &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), /*reportErrors*/ false)) {
return result_3;
}
}
@@ -42925,8 +43441,7 @@
}
// A type S is assignable to keyof T if S is assignable to keyof C, where C is the
// simplified form of T or, if T doesn't simplify, the constraint of T.
- var simplified = getSimplifiedType(target.type);
- var constraint = simplified !== target.type ? simplified : getConstraintOfType(target.type);
+ var constraint = getSimplifiedTypeOrConstraint(target.type);
if (constraint) {
// We require Ternary.True here such that circular constraints don't cause
// false positives. For example, given 'T extends { [K in keyof T]: string }',
@@ -42938,13 +43453,17 @@
}
}
else if (target.flags & 8388608 /* IndexedAccess */) {
- // A type S is related to a type T[K], where T and K aren't both type variables, if S is related to C,
- // where C is the base constraint of T[K]
- if (relation !== identityRelation &&
- !(isGenericObjectType(target.objectType) && isGenericIndexType(target.indexType))) {
- var constraint = getBaseConstraintOfType(target);
- if (constraint && constraint !== target) {
- if (result = isRelatedTo(source, constraint, reportErrors)) {
+ // A type S is related to a type T[K] if S is related to C, where C is the base
+ // constraint of T[K] for writing.
+ if (relation !== identityRelation) {
+ var objectType = target.objectType;
+ var indexType = target.indexType;
+ var baseObjectType = getBaseConstraintOfType(objectType) || objectType;
+ var baseIndexType = getBaseConstraintOfType(indexType) || indexType;
+ if (!isGenericObjectType(baseObjectType) && !isGenericIndexType(baseIndexType)) {
+ var accessFlags = 2 /* Writing */ | (baseObjectType !== objectType ? 1 /* NoIndexSignatures */ : 0);
+ var constraint = getIndexedAccessTypeOrUndefined(baseObjectType, baseIndexType, /*accessNode*/ undefined, accessFlags);
+ if (constraint && (result = isRelatedTo(source, constraint, reportErrors))) {
return result;
}
}
@@ -42961,7 +43480,7 @@
}
if (!isGenericMappedType(source)) {
var targetConstraint = getConstraintTypeFromMappedType(target);
- var sourceKeys_1 = getIndexType(source);
+ var sourceKeys_1 = getIndexType(source, /*stringsOnly*/ undefined, /*noIndexSignatures*/ true);
var hasOptionalUnionKeys = modifiers & 4 /* IncludeOptional */ && targetConstraint.flags & 1048576 /* Union */;
var filteredByApplicability = hasOptionalUnionKeys ? filterType(targetConstraint, function (t) { return !!isRelatedTo(t, sourceKeys_1); }) : undefined;
// A source type T is related to a target type { [P in Q]: X } if Q is related to keyof T and T[Q] is related to X.
@@ -42992,6 +43511,7 @@
return result;
}
}
+ else {
var constraint = getConstraintOfType(source);
if (!constraint || (source.flags & 262144 /* TypeParameter */ && constraint.flags & 1 /* Any */)) {
// A type variable with no constraint is not related to the non-primitive object type.
@@ -43011,6 +43531,7 @@
return result;
}
}
+ }
else if (source.flags & 4194304 /* Index */) {
if (result = isRelatedTo(keyofConstraintType, target, reportErrors)) {
errorInfo = saveErrorInfo;
@@ -43024,8 +43545,8 @@
// and Y1 is related to Y2.
if (isTypeIdenticalTo(source.extendsType, target.extendsType) &&
(isRelatedTo(source.checkType, target.checkType) || isRelatedTo(target.checkType, source.checkType))) {
- if (result = isRelatedTo(source.trueType, target.trueType, reportErrors)) {
- result &= isRelatedTo(source.falseType, target.falseType, reportErrors);
+ if (result = isRelatedTo(getTrueTypeFromConditionalType(source), getTrueTypeFromConditionalType(target), reportErrors)) {
+ result &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), reportErrors);
}
if (result) {
errorInfo = saveErrorInfo;
@@ -43095,7 +43616,7 @@
if (source.flags & (524288 /* Object */ | 2097152 /* Intersection */) && target.flags & 524288 /* Object */) {
// Report structural errors only if we haven't reported any errors yet
var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !sourceIsPrimitive;
- result = propertiesRelatedTo(source, target, reportStructuralErrors);
+ result = propertiesRelatedTo(source, target, reportStructuralErrors, /*excludedProperties*/ undefined);
if (result) {
result &= signaturesRelatedTo(source, target, 0 /* Call */, reportStructuralErrors);
if (result) {
@@ -43115,22 +43636,35 @@
return result;
}
}
+ // If S is an object type and T is a discriminated union, S may be related to T if
+ // there exists a constituent of T for every combination of the discriminants of S
+ // with respect to T. We do not report errors here, as we will use the existing
+ // error result from checking each constituent of the union.
+ if (source.flags & (524288 /* Object */ | 2097152 /* Intersection */) && target.flags & 1048576 /* Union */) {
+ var objectOnlyTarget = extractTypesOfKind(target, 524288 /* Object */);
+ if (objectOnlyTarget.flags & 1048576 /* Union */) {
+ var result_4 = typeRelatedToDiscriminatedType(source, objectOnlyTarget);
+ if (result_4) {
+ return result_4;
+ }
}
- return 0 /* False */;
- function isNonGeneric(type) {
- // If we're already in identity relationship checking, we should use `isRelatedTo`
- // to catch the `Maybe` from an excessively deep type (which we then assume means
- // that the type could possibly contain a generic)
- if (relation === identityRelation) {
- return isRelatedTo(type, getPermissiveInstantiation(type)) === -1 /* True */;
}
- return isTypeIdenticalTo(type, getPermissiveInstantiation(type));
}
+ return 0 /* False */;
function relateVariances(sourceTypeArguments, targetTypeArguments, variances) {
if (result = typeArgumentsRelatedTo(sourceTypeArguments, targetTypeArguments, variances, reportErrors)) {
return result;
}
- var allowStructuralFallback = (targetTypeArguments && hasCovariantVoidArgument(targetTypeArguments, variances)) || isNonGeneric(source) || isNonGeneric(target);
+ if (ts.some(variances, function (v) { return !!(v & 24 /* AllowsStructuralFallback */); })) {
+ // If some type parameter was `Unmeasurable` or `Unreliable`, and we couldn't pass by assuming it was identical, then we
+ // have to allow a structural fallback check
+ // We elide the variance-based error elaborations, since those might not be too helpful, since we'll potentially
+ // be assuming identity of the type parameter.
+ originalErrorInfo = undefined;
+ errorInfo = saveErrorInfo;
+ return undefined;
+ }
+ var allowStructuralFallback = targetTypeArguments && hasCovariantVoidArgument(targetTypeArguments, variances);
varianceCheckFailed = !allowStructuralFallback;
// The type arguments did not relate appropriately, but it may be because we have no variance
// information (in which case typeArgumentsRelatedTo defaulted to covariance for all type
@@ -43148,7 +43682,7 @@
// reveal the reason).
// We can switch on `reportErrors` here, since varianceCheckFailed guarantees we return `False`,
// we can return `False` early here to skip calculating the structural error message we don't need.
- if (varianceCheckFailed && !(reportErrors && ts.some(variances, function (v) { return v === 0 /* Invariant */; }))) {
+ if (varianceCheckFailed && !(reportErrors && ts.some(variances, function (v) { return (v & 7 /* VarianceMask */) === 0 /* Invariant */; }))) {
return 0 /* False */;
}
// We remember the original error information so we can restore it in case the structural
@@ -43159,6 +43693,18 @@
}
}
}
+ function reportUnmeasurableMarkers(p) {
+ if (outofbandVarianceMarkerHandler && (p === markerSuperType || p === markerSubType || p === markerOtherType)) {
+ outofbandVarianceMarkerHandler(/*onlyUnreliable*/ false);
+ }
+ return p;
+ }
+ function reportUnreliableMarkers(p) {
+ if (outofbandVarianceMarkerHandler && (p === markerSuperType || p === markerSubType || p === markerOtherType)) {
+ outofbandVarianceMarkerHandler(/*onlyUnreliable*/ true);
+ }
+ return p;
+ }
// A type [P in S]: X is related to a type [Q in T]: Y if T is related to S and X' is
// related to Y, where X' is an instantiation of X in which P is replaced with Q. Notice
// that S and T are contra-variant whereas X and Y are co-variant.
@@ -43166,99 +43712,185 @@
var modifiersRelated = relation === comparableRelation || (relation === identityRelation ? getMappedTypeModifiers(source) === getMappedTypeModifiers(target) :
getCombinedMappedTypeOptionality(source) <= getCombinedMappedTypeOptionality(target));
if (modifiersRelated) {
- var result_4;
- if (result_4 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) {
+ var result_5;
+ var targetConstraint = getConstraintTypeFromMappedType(target);
+ var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source), getCombinedMappedTypeOptionality(source) < 0 ? reportUnmeasurableMarkers : reportUnreliableMarkers);
+ if (result_5 = isRelatedTo(targetConstraint, sourceConstraint, reportErrors)) {
var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]);
- return result_4 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), reportErrors);
+ return result_5 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), reportErrors);
}
}
return 0 /* False */;
}
- function propertiesRelatedTo(source, target, reportErrors) {
- if (relation === identityRelation) {
- return propertiesIdenticalTo(source, target);
+ function typeRelatedToDiscriminatedType(source, target) {
+ // 1. Generate the combinations of discriminant properties & types 'source' can satisfy.
+ // a. If the number of combinations is above a set limit, the comparison is too complex.
+ // 2. Filter 'target' to the subset of types whose discriminants exist in the matrix.
+ // a. If 'target' does not satisfy all discriminants in the matrix, 'source' is not related.
+ // 3. For each type in the filtered 'target', determine if all non-discriminant properties of
+ // 'target' are related to a property in 'source'.
+ //
+ // NOTE: See ~/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithDiscriminatedUnion.ts
+ // for examples.
+ var sourceProperties = getPropertiesOfObjectType(source);
+ var sourcePropertiesFiltered = findDiscriminantProperties(sourceProperties, target);
+ if (!sourcePropertiesFiltered)
+ return 0 /* False */;
+ // Though we could compute the number of combinations as we generate
+ // the matrix, this would incur additional memory overhead due to
+ // array allocations. To reduce this overhead, we first compute
+ // the number of combinations to ensure we will not surpass our
+ // fixed limit before incurring the cost of any allocations:
+ var numCombinations = 1;
+ for (var _i = 0, sourcePropertiesFiltered_1 = sourcePropertiesFiltered; _i < sourcePropertiesFiltered_1.length; _i++) {
+ var sourceProperty = sourcePropertiesFiltered_1[_i];
+ numCombinations *= countTypes(getTypeOfSymbol(sourceProperty));
+ if (numCombinations > 25) {
+ // We've reached the complexity limit.
+ return 0 /* False */;
}
- var requireOptionalProperties = relation === subtypeRelation && !isObjectLiteralType(source) && !isEmptyArrayLiteralType(source) && !isTupleType(source);
- var unmatchedProperty = getUnmatchedProperty(source, target, requireOptionalProperties, /*matchDiscriminantProperties*/ false);
- if (unmatchedProperty) {
- if (reportErrors) {
- var props = ts.arrayFrom(getUnmatchedProperties(source, target, requireOptionalProperties, /*matchDiscriminantProperties*/ false));
- if (!headMessage || (headMessage.code !== ts.Diagnostics.Class_0_incorrectly_implements_interface_1.code &&
- headMessage.code !== ts.Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass.code)) {
- suppressNextError = true; // Retain top-level error for interface implementing issues, otherwise omit it
}
- if (props.length === 1) {
- var propName = symbolToString(unmatchedProperty);
- reportError(ts.Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2, propName, typeToString(source), typeToString(target));
- if (ts.length(unmatchedProperty.declarations)) {
- associateRelatedInfo(ts.createDiagnosticForNode(unmatchedProperty.declarations[0], ts.Diagnostics._0_is_declared_here, propName));
+ // Compute the set of types for each discriminant property.
+ var sourceDiscriminantTypes = new Array(sourcePropertiesFiltered.length);
+ var excludedProperties = ts.createUnderscoreEscapedMap();
+ for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
+ var sourceProperty = sourcePropertiesFiltered[i];
+ var sourcePropertyType = getTypeOfSymbol(sourceProperty);
+ sourceDiscriminantTypes[i] = sourcePropertyType.flags & 1048576 /* Union */
+ ? sourcePropertyType.types
+ : [sourcePropertyType];
+ excludedProperties.set(sourceProperty.escapedName, true);
+ }
+ // Match each combination of the cartesian product of discriminant properties to one or more
+ // constituents of 'target'. If any combination does not have a match then 'source' is not relatable.
+ var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
+ var matchingTypes = [];
+ var _loop_8 = function (combination) {
+ var hasMatch = false;
+ outer: for (var _i = 0, _a = target.types; _i < _a.length; _i++) {
+ var type = _a[_i];
+ var _loop_9 = function (i) {
+ var sourceProperty = sourcePropertiesFiltered[i];
+ var targetProperty = getPropertyOfObjectType(type, sourceProperty.escapedName);
+ if (!targetProperty)
+ return "continue-outer";
+ if (sourceProperty === targetProperty)
+ return "continue";
+ // We compare the source property to the target in the context of a single discriminant type.
+ var related = propertyRelatedTo(source, target, sourceProperty, targetProperty, function (_) { return combination[i]; }, /*reportErrors*/ false);
+ // If the target property could not be found, or if the properties were not related,
+ // then this constituent is not a match.
+ if (!related) {
+ return "continue-outer";
+ }
+ };
+ for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
+ var state_5 = _loop_9(i);
+ switch (state_5) {
+ case "continue-outer": continue outer;
}
}
- else if (props.length > 5) { // arbitrary cutoff for too-long list form
- reportError(ts.Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2_and_3_more, typeToString(source), typeToString(target), ts.map(props.slice(0, 4), function (p) { return symbolToString(p); }).join(", "), props.length - 4);
+ ts.pushIfUnique(matchingTypes, type, ts.equateValues);
+ hasMatch = true;
}
- else {
- reportError(ts.Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2, typeToString(source), typeToString(target), ts.map(props, function (p) { return symbolToString(p); }).join(", "));
+ if (!hasMatch) {
+ return { value: 0 /* False */ };
}
+ };
+ for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
+ var combination = discriminantCombinations_1[_a];
+ var state_4 = _loop_8(combination);
+ if (typeof state_4 === "object")
+ return state_4.value;
}
- return 0 /* False */;
+ // Compare the remaining non-discriminant properties of each match.
+ var result = -1 /* True */;
+ for (var _b = 0, matchingTypes_1 = matchingTypes; _b < matchingTypes_1.length; _b++) {
+ var type = matchingTypes_1[_b];
+ result &= propertiesRelatedTo(source, type, /*reportErrors*/ false, excludedProperties);
+ if (result) {
+ result &= signaturesRelatedTo(source, type, 0 /* Call */, /*reportStructuralErrors*/ false);
+ if (result) {
+ result &= signaturesRelatedTo(source, type, 1 /* Construct */, /*reportStructuralErrors*/ false);
+ if (result) {
+ result &= indexTypesRelatedTo(source, type, 0 /* String */, /*sourceIsPrimitive*/ false, /*reportStructuralErrors*/ false);
+ if (result) {
+ result &= indexTypesRelatedTo(source, type, 1 /* Number */, /*sourceIsPrimitive*/ false, /*reportStructuralErrors*/ false);
}
- if (isObjectLiteralType(target)) {
- for (var _i = 0, _a = getPropertiesOfType(source); _i < _a.length; _i++) {
- var sourceProp = _a[_i];
- if (!getPropertyOfObjectType(target, sourceProp.escapedName)) {
- var sourceType = getTypeOfSymbol(sourceProp);
- if (!(sourceType === undefinedType || sourceType === undefinedWideningType)) {
- if (reportErrors) {
- reportError(ts.Diagnostics.Property_0_does_not_exist_on_type_1, symbolToString(sourceProp), typeToString(target));
}
- return 0 /* False */;
}
}
+ if (!result) {
+ return result;
}
}
- var result = -1 /* True */;
- if (isTupleType(target)) {
- var targetRestType = getRestTypeOfTupleType(target);
- if (targetRestType) {
- if (!isTupleType(source)) {
- return 0 /* False */;
+ return result;
}
- var sourceRestType = getRestTypeOfTupleType(source);
- if (sourceRestType && !isRelatedTo(sourceRestType, targetRestType, reportErrors)) {
- if (reportErrors) {
- reportError(ts.Diagnostics.Rest_signatures_are_incompatible);
+ function excludeProperties(properties, excludedProperties) {
+ if (!excludedProperties || properties.length === 0)
+ return properties;
+ var result;
+ for (var i = 0; i < properties.length; i++) {
+ if (!excludedProperties.has(properties[i].escapedName)) {
+ if (result) {
+ result.push(properties[i]);
}
- return 0 /* False */;
}
- var targetCount = getTypeReferenceArity(target) - 1;
- var sourceCount = getTypeReferenceArity(source) - (sourceRestType ? 1 : 0);
- for (var i = targetCount; i < sourceCount; i++) {
- var related = isRelatedTo(source.typeArguments[i], targetRestType, reportErrors);
+ else if (!result) {
+ result = properties.slice(0, i);
+ }
+ }
+ return result || properties;
+ }
+ function isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors) {
+ var targetIsOptional = strictNullChecks && !!(ts.getCheckFlags(targetProp) & 48 /* Partial */);
+ var source = getTypeOfSourceProperty(sourceProp);
+ if (ts.getCheckFlags(targetProp) & 65536 /* DeferredType */ && !getSymbolLinks(targetProp).type) {
+ // Rather than resolving (and normalizing) the type, relate constituent-by-constituent without performing normalization or seconadary passes
+ var links = getSymbolLinks(targetProp);
+ ts.Debug.assertDefined(links.deferralParent);
+ ts.Debug.assertDefined(links.deferralConstituents);
+ var unionParent = !!(links.deferralParent.flags & 1048576 /* Union */);
+ var result_6 = unionParent ? 0 /* False */ : -1 /* True */;
+ var targetTypes = links.deferralConstituents;
+ for (var _i = 0, targetTypes_3 = targetTypes; _i < targetTypes_3.length; _i++) {
+ var targetType = targetTypes_3[_i];
+ var related = isRelatedTo(source, targetType, /*reportErrors*/ false, /*headMessage*/ undefined, /*isIntersectionConstituent*/ !unionParent);
+ if (!unionParent) {
if (!related) {
- if (reportErrors) {
- reportError(ts.Diagnostics.Property_0_is_incompatible_with_rest_element_type, "" + i);
+ // Can't assign to a target individually - have to fallback to assigning to the _whole_ intersection (which forces normalization)
+ return isRelatedTo(source, addOptionality(getTypeOfSymbol(targetProp), targetIsOptional), reportErrors);
}
- return 0 /* False */;
+ result_6 &= related;
}
- result &= related;
+ else {
+ if (related) {
+ return related;
}
}
}
- var properties = getPropertiesOfObjectType(target);
- for (var _b = 0, properties_2 = properties; _b < properties_2.length; _b++) {
- var targetProp = properties_2[_b];
- if (!(targetProp.flags & 4194304 /* Prototype */)) {
- var sourceProp = getPropertyOfType(source, targetProp.escapedName);
- if (sourceProp && sourceProp !== targetProp) {
- if (isIgnoredJsxProperty(source, sourceProp, getTypeOfSymbol(targetProp))) {
- continue;
+ if (unionParent && !result_6 && targetIsOptional) {
+ result_6 = isRelatedTo(source, undefinedType);
+ }
+ if (unionParent && !result_6 && reportErrors) {
+ // The easiest way to get the right errors here is to un-defer (which may be costly)
+ // If it turns out this is too costly too often, we can replicate the error handling logic within
+ // typeRelatedToSomeType without the discriminatable type branch (as that requires a manifest union
+ // type on which to hand discriminable properties, which we are expressly trying to avoid here)
+ return isRelatedTo(source, addOptionality(getTypeOfSymbol(targetProp), targetIsOptional), reportErrors);
+ }
+ return result_6;
+ }
+ else {
+ return isRelatedTo(source, addOptionality(getTypeOfSymbol(targetProp), targetIsOptional), reportErrors);
}
+ }
+ function propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSourceProperty, reportErrors) {
var sourcePropFlags = ts.getDeclarationModifierFlagsFromSymbol(sourceProp);
var targetPropFlags = ts.getDeclarationModifierFlagsFromSymbol(targetProp);
if (sourcePropFlags & 8 /* Private */ || targetPropFlags & 8 /* Private */) {
var hasDifferingDeclarations = sourceProp.valueDeclaration !== targetProp.valueDeclaration;
- if (ts.getCheckFlags(sourceProp) & 512 /* ContainsPrivate */ && hasDifferingDeclarations) {
+ if (ts.getCheckFlags(sourceProp) & 1024 /* ContainsPrivate */ && hasDifferingDeclarations) {
if (reportErrors) {
reportError(ts.Diagnostics.Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1, symbolToString(sourceProp), typeToString(source));
}
@@ -43290,14 +43922,14 @@
}
return 0 /* False */;
}
- var related = isRelatedTo(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors);
+ // If the target comes from a partial union prop, allow `undefined` in the target type
+ var related = isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors);
if (!related) {
if (reportErrors) {
reportError(ts.Diagnostics.Types_of_property_0_are_incompatible, symbolToString(targetProp));
}
return 0 /* False */;
}
- result &= related;
// When checking for comparability, be more lenient with optional properties.
if (relation !== comparableRelation && sourceProp.flags & 16777216 /* Optional */ && !(targetProp.flags & 16777216 /* Optional */)) {
// TypeScript 1.0 spec (April 2014): 3.8.3
@@ -43312,17 +43944,113 @@
}
return 0 /* False */;
}
+ return related;
+ }
+ function propertiesRelatedTo(source, target, reportErrors, excludedProperties) {
+ if (relation === identityRelation) {
+ return propertiesIdenticalTo(source, target, excludedProperties);
+ }
+ var requireOptionalProperties = relation === subtypeRelation && !isObjectLiteralType(source) && !isEmptyArrayLiteralType(source) && !isTupleType(source);
+ var unmatchedProperty = getUnmatchedProperty(source, target, requireOptionalProperties, /*matchDiscriminantProperties*/ false);
+ if (unmatchedProperty) {
+ if (reportErrors) {
+ var props = ts.arrayFrom(getUnmatchedProperties(source, target, requireOptionalProperties, /*matchDiscriminantProperties*/ false));
+ var shouldSkipElaboration = false;
+ if (!headMessage || (headMessage.code !== ts.Diagnostics.Class_0_incorrectly_implements_interface_1.code &&
+ headMessage.code !== ts.Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass.code)) {
+ shouldSkipElaboration = true; // Retain top-level error for interface implementing issues, otherwise omit it
+ }
+ if (props.length === 1) {
+ var propName = symbolToString(unmatchedProperty);
+ reportError.apply(void 0, [ts.Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2, propName].concat(getTypeNamesForErrorDisplay(source, target)));
+ if (ts.length(unmatchedProperty.declarations)) {
+ associateRelatedInfo(ts.createDiagnosticForNode(unmatchedProperty.declarations[0], ts.Diagnostics._0_is_declared_here, propName));
+ }
+ if (shouldSkipElaboration) {
+ overrideNextErrorInfo = errorInfo;
+ }
+ }
+ else if (tryElaborateArrayLikeErrors(source, target, /*reportErrors*/ false)) {
+ if (props.length > 5) { // arbitrary cutoff for too-long list form
+ reportError(ts.Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2_and_3_more, typeToString(source), typeToString(target), ts.map(props.slice(0, 4), function (p) { return symbolToString(p); }).join(", "), props.length - 4);
+ }
+ else {
+ reportError(ts.Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2, typeToString(source), typeToString(target), ts.map(props, function (p) { return symbolToString(p); }).join(", "));
+ }
+ if (shouldSkipElaboration) {
+ overrideNextErrorInfo = errorInfo;
+ }
+ }
+ // ELSE: No array like or unmatched property error - just issue top level error (errorInfo = undefined)
+ }
+ return 0 /* False */;
+ }
+ if (isObjectLiteralType(target)) {
+ for (var _i = 0, _a = excludeProperties(getPropertiesOfType(source), excludedProperties); _i < _a.length; _i++) {
+ var sourceProp = _a[_i];
+ if (!getPropertyOfObjectType(target, sourceProp.escapedName)) {
+ var sourceType = getTypeOfSymbol(sourceProp);
+ if (!(sourceType === undefinedType || sourceType === undefinedWideningType)) {
+ if (reportErrors) {
+ reportError(ts.Diagnostics.Property_0_does_not_exist_on_type_1, symbolToString(sourceProp), typeToString(target));
+ }
+ return 0 /* False */;
+ }
+ }
+ }
+ }
+ var result = -1 /* True */;
+ if (isTupleType(target)) {
+ var targetRestType = getRestTypeOfTupleType(target);
+ if (targetRestType) {
+ if (!isTupleType(source)) {
+ return 0 /* False */;
+ }
+ var sourceRestType = getRestTypeOfTupleType(source);
+ if (sourceRestType && !isRelatedTo(sourceRestType, targetRestType, reportErrors)) {
+ if (reportErrors) {
+ reportError(ts.Diagnostics.Rest_signatures_are_incompatible);
+ }
+ return 0 /* False */;
+ }
+ var targetCount = getTypeReferenceArity(target) - 1;
+ var sourceCount = getTypeReferenceArity(source) - (sourceRestType ? 1 : 0);
+ for (var i = targetCount; i < sourceCount; i++) {
+ var related = isRelatedTo(source.typeArguments[i], targetRestType, reportErrors);
+ if (!related) {
+ if (reportErrors) {
+ reportError(ts.Diagnostics.Property_0_is_incompatible_with_rest_element_type, "" + i);
+ }
+ return 0 /* False */;
+ }
+ result &= related;
+ }
+ }
+ }
+ // We only call this for union target types when we're attempting to do excess property checking - in those cases, we want to get _all possible props_
+ // from the target union, across all members
+ var properties = target.flags & 1048576 /* Union */ ? getPossiblePropertiesOfUnionType(target) : getPropertiesOfType(target);
+ for (var _b = 0, _c = excludeProperties(properties, excludedProperties); _b < _c.length; _b++) {
+ var targetProp = _c[_b];
+ if (!(targetProp.flags & 4194304 /* Prototype */)) {
+ var sourceProp = getPropertyOfType(source, targetProp.escapedName);
+ if (sourceProp && sourceProp !== targetProp) {
+ var related = propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSymbol, reportErrors);
+ if (!related) {
+ return 0 /* False */;
+ }
+ result &= related;
}
}
}
return result;
}
- function propertiesIdenticalTo(source, target) {
+ function propertiesIdenticalTo(source, target, excludedProperties) {
if (!(source.flags & 524288 /* Object */ && target.flags & 524288 /* Object */)) {
return 0 /* False */;
}
- var sourceProperties = getPropertiesOfObjectType(source);
- var targetProperties = getPropertiesOfObjectType(target);
+ var sourceProperties = excludeProperties(getPropertiesOfObjectType(source), excludedProperties);
+ var targetProperties = excludeProperties(getPropertiesOfObjectType(target), excludedProperties);
if (sourceProperties.length !== targetProperties.length) {
return 0 /* False */;
}
@@ -43442,7 +44170,7 @@
var result = -1 /* True */;
for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) {
var prop = _a[_i];
- if (isIgnoredJsxProperty(source, prop, /*targetMemberType*/ undefined)) {
+ if (isIgnoredJsxProperty(source, prop)) {
continue;
}
// Skip over symbol-named members
@@ -43474,7 +44202,7 @@
return indexTypesIdenticalTo(source, target, kind);
}
var targetInfo = getIndexInfoOfType(target, kind);
- if (!targetInfo || targetInfo.type.flags & 3 /* AnyOrUnknown */ && !sourceIsPrimitive) {
+ if (!targetInfo || targetInfo.type.flags & 1 /* Any */ && !sourceIsPrimitive) {
// Index signature of type any permits assignment from everything but primitives
return -1 /* True */;
}
@@ -43614,8 +44342,11 @@
// The emptyArray singleton is used to signal a recursive invocation.
cache.variances = ts.emptyArray;
variances = [];
- for (var _i = 0, typeParameters_1 = typeParameters; _i < typeParameters_1.length; _i++) {
- var tp = typeParameters_1[_i];
+ var _loop_10 = function (tp) {
+ var unmeasurable = false;
+ var unreliable = false;
+ var oldHandler = outofbandVarianceMarkerHandler;
+ outofbandVarianceMarkerHandler = function (onlyUnreliable) { return onlyUnreliable ? unreliable = true : unmeasurable = true; };
// We first compare instantiations where the type parameter is replaced with
// marker types that have a known subtype relationship. From this we can infer
// invariance, covariance, contravariance or bivariance.
@@ -43630,7 +44361,26 @@
if (variance === 3 /* Bivariant */ && isTypeAssignableTo(createMarkerType(cache, tp, markerOtherType), typeWithSuper)) {
variance = 4 /* Independent */;
}
+ outofbandVarianceMarkerHandler = oldHandler;
+ if (unmeasurable || unreliable) {
+ if (unmeasurable) {
+ variance |= 8 /* Unmeasurable */;
+ }
+ if (unreliable) {
+ variance |= 16 /* Unreliable */;
+ }
+ var covariantID = getRelationKey(typeWithSub, typeWithSuper, assignableRelation);
+ var contravariantID = getRelationKey(typeWithSuper, typeWithSub, assignableRelation);
+ // We delete the results of these checks, as we want them to actually be run, see the `Unmeasurable` variance we cache,
+ // And then fall back to a structural result.
+ assignableRelation.delete(covariantID);
+ assignableRelation.delete(contravariantID);
+ }
variances.push(variance);
+ };
+ for (var _i = 0, typeParameters_1 = typeParameters; _i < typeParameters_1.length; _i++) {
+ var tp = typeParameters_1[_i];
+ _loop_10(tp);
}
cache.variances = variances;
}
@@ -43647,7 +44397,7 @@
// See comment at call in recursiveTypeRelatedTo for when this case matters.
function hasCovariantVoidArgument(typeArguments, variances) {
for (var i = 0; i < variances.length; i++) {
- if (variances[i] === 1 /* Covariant */ && typeArguments[i].flags & 16384 /* Void */) {
+ if ((variances[i] & 7 /* VarianceMask */) === 1 /* Covariant */ && typeArguments[i].flags & 16384 /* Void */) {
return true;
}
}
@@ -44073,6 +44823,30 @@
return strictNullChecks ? getGlobalNonNullableTypeInstantiation(type) : type;
}
/**
+ * Is source potentially coercible to target type under `==`.
+ * Assumes that `source` is a constituent of a union, hence
+ * the boolean literal flag on the LHS, but not on the RHS.
+ *
+ * This does not fully replicate the semantics of `==`. The
+ * intention is to catch cases that are clearly not right.
+ *
+ * Comparing (string | number) to number should not remove the
+ * string element.
+ *
+ * Comparing (string | number) to 1 will remove the string
+ * element, though this is not sound. This is a pragmatic
+ * choice.
+ *
+ * @see narrowTypeByEquality
+ *
+ * @param source
+ * @param target
+ */
+ function isCoercibleUnderDoubleEquals(source, target) {
+ return ((source.flags & (8 /* Number */ | 4 /* String */ | 512 /* BooleanLiteral */)) !== 0)
+ && ((target.flags & (8 /* Number */ | 4 /* String */ | 16 /* Boolean */)) !== 0);
+ }
+ /**
* Return true if type was inferred from an object literal, written as an object type literal, or is the shape of a module
* with no call or construct signatures.
*/
@@ -44208,26 +44982,34 @@
}
function getWidenedTypeWithContext(type, context) {
if (ts.getObjectFlags(type) & 393216 /* RequiresWidening */) {
+ if (context === undefined && type.widened) {
+ return type.widened;
+ }
+ var result = void 0;
if (type.flags & 98304 /* Nullable */) {
- return anyType;
+ result = anyType;
}
- if (isObjectLiteralType(type)) {
- return getWidenedTypeOfObjectLiteral(type, context);
+ else if (isObjectLiteralType(type)) {
+ result = getWidenedTypeOfObjectLiteral(type, context);
}
- if (type.flags & 1048576 /* Union */) {
+ else if (type.flags & 1048576 /* Union */) {
var unionContext_1 = context || createWideningContext(/*parent*/ undefined, /*propertyName*/ undefined, type.types);
var widenedTypes = ts.sameMap(type.types, function (t) { return t.flags & 98304 /* Nullable */ ? t : getWidenedTypeWithContext(t, unionContext_1); });
// Widening an empty object literal transitions from a highly restrictive type to
// a highly inclusive one. For that reason we perform subtype reduction here if the
// union includes empty object types (e.g. reducing {} | string to just {}).
- return getUnionType(widenedTypes, ts.some(widenedTypes, isEmptyObjectType) ? 2 /* Subtype */ : 1 /* Literal */);
+ result = getUnionType(widenedTypes, ts.some(widenedTypes, isEmptyObjectType) ? 2 /* Subtype */ : 1 /* Literal */);
}
- if (type.flags & 2097152 /* Intersection */) {
- return getIntersectionType(ts.sameMap(type.types, getWidenedType));
+ else if (type.flags & 2097152 /* Intersection */) {
+ result = getIntersectionType(ts.sameMap(type.types, getWidenedType));
}
- if (isArrayType(type) || isTupleType(type)) {
- return createTypeReference(type.target, ts.sameMap(type.typeArguments, getWidenedType));
+ else if (isArrayType(type) || isTupleType(type)) {
+ result = createTypeReference(type.target, ts.sameMap(type.typeArguments, getWidenedType));
}
+ if (result && context === undefined) {
+ type.widened = result;
+ }
+ return result || type;
}
return type;
}
@@ -44289,12 +45071,12 @@
}
var diagnostic;
switch (declaration.kind) {
- case 204 /* BinaryExpression */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 205 /* BinaryExpression */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
diagnostic = noImplicitAny ? ts.Diagnostics.Member_0_implicitly_has_an_1_type : ts.Diagnostics.Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage;
break;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
var param = declaration;
if (ts.isIdentifier(param.name) &&
(ts.isCallSignatureDeclaration(param.parent) || ts.isMethodSignature(param.parent) || ts.isFunctionTypeNode(param.parent)) &&
@@ -44309,30 +45091,30 @@
noImplicitAny ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage :
noImplicitAny ? ts.Diagnostics.Parameter_0_implicitly_has_an_1_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage;
break;
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type;
if (!noImplicitAny) {
// Don't issue a suggestion for binding elements since the codefix doesn't yet support them.
return;
}
break;
- case 294 /* JSDocFunctionType */:
+ case 295 /* JSDocFunctionType */:
error(declaration, ts.Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);
return;
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
if (noImplicitAny && !declaration.name) {
error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);
return;
}
diagnostic = noImplicitAny ? ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type : ts.Diagnostics._0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage;
break;
- case 181 /* MappedType */:
+ case 182 /* MappedType */:
if (noImplicitAny) {
error(declaration, ts.Diagnostics.Mapped_object_type_implicitly_has_an_any_template_type);
}
@@ -44452,7 +45234,7 @@
var objectFlags = ts.getObjectFlags(type);
return !!(type.flags & 63176704 /* Instantiable */ ||
objectFlags & 4 /* Reference */ && ts.forEach(type.typeArguments, couldContainTypeVariables) ||
- objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 2048 /* TypeLiteral */ | 32 /* Class */) ||
+ objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations ||
objectFlags & 32 /* Mapped */ ||
type.flags & 3145728 /* UnionOrIntersection */ && couldUnionOrIntersectionContainTypeVariables(type));
}
@@ -44500,10 +45282,18 @@
reverseMappedCache.set(key, type);
return type;
}
+ // We consider a type to be partially inferable if it isn't marked non-inferable or if it is
+ // an object literal type with at least one property of an inferable type. For example, an object
+ // literal { a: 123, b: x => true } is marked non-inferable because it contains a context sensitive
+ // arrow function, but is considered partially inferable because property 'a' has an inferable type.
+ function isPartiallyInferableType(type) {
+ return !(ts.getObjectFlags(type) & 524288 /* NonInferrableType */) ||
+ isObjectLiteralType(type) && ts.some(getPropertiesOfType(type), function (prop) { return isPartiallyInferableType(getTypeOfSymbol(prop)); });
+ }
function createReverseMappedType(source, target, constraint) {
- // If any property contains context sensitive functions that have been skipped, the source type
- // is incomplete and we can't infer a meaningful input type.
- if (ts.getObjectFlags(source) & 524288 /* NonInferrableType */ || getPropertiesOfType(source).length === 0 && !getIndexInfoOfType(source, 0 /* String */)) {
+ // We consider a source type reverse mappable if it has a string index signature or if
+ // it has one or more properties and is of a partially inferable type.
+ if (!(getIndexInfoOfType(source, 0 /* String */) || getPropertiesOfType(source).length !== 0 && isPartiallyInferableType(source))) {
return undefined;
}
// For arrays and tuples we infer new arrays and tuples where the reverse mapping has been
@@ -44533,20 +45323,20 @@
var templateType = getTemplateTypeFromMappedType(target);
var inference = createInferenceInfo(typeParameter);
inferTypes([inference], sourceType, templateType);
- return getTypeFromInference(inference);
+ return getTypeFromInference(inference) || unknownType;
}
function getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties) {
- var properties, _i, properties_3, targetProp, sourceProp, targetType, sourceType;
+ var properties, _i, properties_2, targetProp, sourceProp, targetType, sourceType;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
- properties = target.flags & 2097152 /* Intersection */ ? getPropertiesOfUnionOrIntersectionType(target) : getPropertiesOfObjectType(target);
- _i = 0, properties_3 = properties;
+ properties = target.flags & 1048576 /* Union */ ? getPossiblePropertiesOfUnionType(target) : getPropertiesOfType(target);
+ _i = 0, properties_2 = properties;
_a.label = 1;
case 1:
- if (!(_i < properties_3.length)) return [3 /*break*/, 6];
- targetProp = properties_3[_i];
- if (!(requireOptionalProperties || !(targetProp.flags & 16777216 /* Optional */))) return [3 /*break*/, 5];
+ if (!(_i < properties_2.length)) return [3 /*break*/, 6];
+ targetProp = properties_2[_i];
+ if (!(requireOptionalProperties || !(targetProp.flags & 16777216 /* Optional */ || ts.getCheckFlags(targetProp) & 48 /* Partial */))) return [3 /*break*/, 5];
sourceProp = getPropertyOfType(source, targetProp.escapedName);
if (!!sourceProp) return [3 /*break*/, 3];
return [4 /*yield*/, targetProp];
@@ -44587,7 +45377,7 @@
function getTypeFromInference(inference) {
return inference.candidates ? getUnionType(inference.candidates, 2 /* Subtype */) :
inference.contraCandidates ? getIntersectionType(inference.contraCandidates) :
- emptyObjectType;
+ undefined;
}
function inferTypes(inferences, originalSource, originalTarget, priority, contravariant) {
if (priority === void 0) { priority = 0; }
@@ -44661,6 +45451,9 @@
target = removeTypesFromUnionOrIntersection(target, matchingTypes);
}
}
+ else if (target.flags & (8388608 /* IndexedAccess */ | 33554432 /* Substitution */)) {
+ target = getActualTypeVariable(target);
+ }
if (target.flags & 8650752 /* TypeVariable */) {
// If target is a type parameter, make an inference, unless the source type contains
// the anyFunctionType (the wildcard type that's used to avoid contextually typing functions).
@@ -44669,7 +45462,7 @@
// not contain anyFunctionType when we come back to this argument for its second round
// of inference. Also, we exclude inferences for silentNeverType (which is used as a wildcard
// when constructing types from type parameters that had no inference candidates).
- if (ts.getObjectFlags(source) & 524288 /* NonInferrableType */ || source === silentNeverType || (priority & 8 /* ReturnType */ && (source === autoType || source === autoArrayType))) {
+ if (ts.getObjectFlags(source) & 524288 /* NonInferrableType */ || source === silentNeverType || (priority & 16 /* ReturnType */ && (source === autoType || source === autoArrayType))) {
return;
}
var inference = getInferenceInfoForType(target);
@@ -44696,7 +45489,7 @@
inference.inferredType = undefined;
}
}
- if (!(priority & 8 /* ReturnType */) && target.flags & 262144 /* TypeParameter */ && inference.topLevel && !isTypeParameterAtTopLevel(originalTarget, target)) {
+ if (!(priority & 16 /* ReturnType */) && target.flags & 262144 /* TypeParameter */ && inference.topLevel && !isTypeParameterAtTopLevel(originalTarget, target)) {
inference.topLevel = false;
inference.inferredType = undefined;
}
@@ -44705,16 +45498,16 @@
}
else {
// Infer to the simplified version of an indexed access, if possible, to (hopefully) expose more bare type parameters to the inference engine
- var simplified = getSimplifiedType(target);
+ var simplified = getSimplifiedType(target, /*writing*/ false);
if (simplified !== target) {
inferFromTypesOnce(source, simplified);
}
else if (target.flags & 8388608 /* IndexedAccess */) {
- var indexType = getSimplifiedType(target.indexType);
+ var indexType = getSimplifiedType(target.indexType, /*writing*/ false);
// Generally simplifications of instantiable indexes are avoided to keep relationship checking correct, however if our target is an access, we can consider
// that key of that access to be "instantiated", since we're looking to find the infernce goal in any way we can.
if (indexType.flags & 63176704 /* Instantiable */) {
- var simplified_1 = distributeIndexOverObjectType(getSimplifiedType(target.objectType), indexType);
+ var simplified_1 = distributeIndexOverObjectType(getSimplifiedType(target.objectType, /*writing*/ false), indexType, /*writing*/ false);
if (simplified_1 && simplified_1 !== target) {
inferFromTypesOnce(source, simplified_1);
}
@@ -44722,9 +45515,6 @@
}
}
}
- else if (target.flags & 33554432 /* Substitution */) {
- inferFromTypes(source, target.typeVariable);
- }
if (ts.getObjectFlags(source) & 4 /* Reference */ && ts.getObjectFlags(target) & 4 /* Reference */ && source.target === target.target) {
// If source and target are references to the same generic type, infer from type arguments
var sourceTypes = source.typeArguments || ts.emptyArray;
@@ -44732,7 +45522,7 @@
var count = sourceTypes.length < targetTypes.length ? sourceTypes.length : targetTypes.length;
var variances = getVariances(source.target);
for (var i = 0; i < count; i++) {
- if (i < variances.length && variances[i] === 2 /* Contravariant */) {
+ if (i < variances.length && (variances[i] & 7 /* VarianceMask */) === 2 /* Contravariant */) {
inferFromContravariantTypes(sourceTypes[i], targetTypes[i]);
}
else {
@@ -44749,7 +45539,7 @@
var empty = createEmptyObjectTypeFromStringLiteral(source);
contravariant = !contravariant;
var savePriority = priority;
- priority |= 16 /* LiteralKeyof */;
+ priority |= 32 /* LiteralKeyof */;
inferFromTypes(empty, target.type);
priority = savePriority;
contravariant = !contravariant;
@@ -44761,12 +45551,12 @@
else if (source.flags & 16777216 /* Conditional */ && target.flags & 16777216 /* Conditional */) {
inferFromTypes(source.checkType, target.checkType);
inferFromTypes(source.extendsType, target.extendsType);
- inferFromTypes(source.trueType, target.trueType);
- inferFromTypes(source.falseType, target.falseType);
+ inferFromTypes(getTrueTypeFromConditionalType(source), getTrueTypeFromConditionalType(target));
+ inferFromTypes(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target));
}
else if (target.flags & 16777216 /* Conditional */ && !contravariant) {
- inferFromTypes(source, target.trueType);
- inferFromTypes(source, target.falseType);
+ inferFromTypes(source, getTrueTypeFromConditionalType(target));
+ inferFromTypes(source, getFalseTypeFromConditionalType(target));
}
else if (target.flags & 3145728 /* UnionOrIntersection */) {
// We infer from types that are not naked type variables first so that inferences we
@@ -44807,7 +45597,7 @@
}
}
else {
- if (!(priority & 32 /* NoConstraints */ && source.flags & (2097152 /* Intersection */ | 63176704 /* Instantiable */))) {
+ if (!(priority & 64 /* NoConstraints */ && source.flags & (2097152 /* Intersection */ | 63176704 /* Instantiable */))) {
var apparentSource = getApparentType(source);
// getApparentType can return _any_ type, since an indexed access or conditional may simplify to any other type.
// If that occurs and it doesn't simplify to an object or intersection, we'll need to restart `inferFromTypes`
@@ -44860,7 +45650,7 @@
}
}
function inferFromContravariantTypes(source, target) {
- if (strictFunctionTypes || priority & 64 /* AlwaysStrict */) {
+ if (strictFunctionTypes || priority & 128 /* AlwaysStrict */) {
contravariant = !contravariant;
inferFromTypes(source, target);
contravariant = !contravariant;
@@ -44899,7 +45689,11 @@
var inferredType = inferTypeForHomomorphicMappedType(source, target, constraintType);
if (inferredType) {
var savePriority = priority;
- priority |= 2 /* HomomorphicMappedType */;
+ // We assign a lower priority to inferences made from types containing non-inferrable
+ // types because we may only have a partial result (i.e. we may have failed to make
+ // reverse inferences for some properties).
+ priority |= ts.getObjectFlags(source) & 524288 /* NonInferrableType */ ?
+ 4 /* PartialHomomorphicMappedType */ : 2 /* HomomorphicMappedType */;
inferFromTypes(inferredType, inference.typeParameter);
priority = savePriority;
}
@@ -44910,7 +45704,7 @@
// We're inferring from some source type S to a mapped type { [P in K]: X }, where K is a type
// parameter. First infer from 'keyof S' to K.
var savePriority = priority;
- priority |= 4 /* MappedTypeConstraint */;
+ priority |= 8 /* MappedTypeConstraint */;
inferFromTypes(getIndexType(source), constraintType);
priority = savePriority;
// If K is constrained to a type C, also infer to C. Thus, for a mapped type { [P in K]: X },
@@ -44923,11 +45717,11 @@
}
// If no inferences can be made to K's constraint, infer from a union of the property types
// in the source to the template type X.
- var valueTypes = ts.compact([
- getIndexTypeOfType(source, 0 /* String */),
- getIndexTypeOfType(source, 1 /* Number */)
- ].concat(ts.map(getPropertiesOfType(source), getTypeOfSymbol)));
- inferFromTypes(getUnionType(valueTypes), getTemplateTypeFromMappedType(target));
+ var propTypes = ts.map(getPropertiesOfType(source), getTypeOfSymbol);
+ var stringIndexType = getIndexTypeOfType(source, 0 /* String */);
+ var numberIndexInfo = getNonEnumNumberIndexInfo(source);
+ var numberIndexType = numberIndexInfo && numberIndexInfo.type;
+ inferFromTypes(getUnionType(ts.append(ts.append(propTypes, stringIndexType), numberIndexType)), getTemplateTypeFromMappedType(target));
return true;
}
return false;
@@ -44981,8 +45775,8 @@
}
}
var properties = getPropertiesOfObjectType(target);
- for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) {
- var targetProp = properties_4[_i];
+ for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) {
+ var targetProp = properties_3[_i];
var sourceProp = getPropertyOfType(source, targetProp.escapedName);
if (sourceProp) {
inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp));
@@ -45005,7 +45799,7 @@
var saveBivariant = bivariant;
var kind = target.declaration ? target.declaration.kind : 0 /* Unknown */;
// Once we descend into a bivariant signature we remain bivariant for all nested inferences
- bivariant = bivariant || kind === 156 /* MethodDeclaration */ || kind === 155 /* MethodSignature */ || kind === 157 /* Constructor */;
+ bivariant = bivariant || kind === 157 /* MethodDeclaration */ || kind === 156 /* MethodSignature */ || kind === 158 /* Constructor */;
applyToParameterTypes(source, target, inferFromContravariantTypes);
bivariant = saveBivariant;
}
@@ -45072,7 +45866,7 @@
return candidates;
}
function getContravariantInference(inference) {
- return inference.priority & 28 /* PriorityImpliesCombination */ ? getIntersectionType(inference.contraCandidates) : getCommonSubtype(inference.contraCandidates);
+ return inference.priority & 56 /* PriorityImpliesCombination */ ? getIntersectionType(inference.contraCandidates) : getCommonSubtype(inference.contraCandidates);
}
function getCovariantInference(inference, signature) {
// Extract all object literal types and replace them with a single widened and normalized type.
@@ -45089,15 +45883,15 @@
candidates;
// If all inferences were made from a position that implies a combined result, infer a union type.
// Otherwise, infer a common supertype.
- var unwidenedType = inference.priority & 28 /* PriorityImpliesCombination */ ?
+ var unwidenedType = inference.priority & 56 /* PriorityImpliesCombination */ ?
getUnionType(baseCandidates, 2 /* Subtype */) :
getCommonSupertype(baseCandidates);
return getWidenedType(unwidenedType);
}
function getInferredType(context, index) {
var inference = context.inferences[index];
- var inferredType = inference.inferredType;
- if (!inferredType) {
+ if (!inference.inferredType) {
+ var inferredType = void 0;
var signature = context.signature;
if (signature) {
var inferredCovariantType = inference.candidates ? getCovariantInference(inference, signature) : undefined;
@@ -45128,27 +45922,24 @@
// parameter should be instantiated to the empty object type.
inferredType = instantiateType(defaultType, combineTypeMappers(createBackreferenceMapper(context, index), context.nonFixingMapper));
}
- else {
- inferredType = getDefaultTypeArgumentType(!!(context.flags & 2 /* AnyDefault */));
- }
}
}
else {
inferredType = getTypeFromInference(inference);
}
- inference.inferredType = inferredType;
+ inference.inferredType = inferredType || getDefaultTypeArgumentType(!!(context.flags & 2 /* AnyDefault */));
var constraint = getConstraintOfTypeParameter(inference.typeParameter);
if (constraint) {
var instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
- if (!context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
+ if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
inference.inferredType = inferredType = instantiatedConstraint;
}
}
}
- return inferredType;
+ return inference.inferredType;
}
function getDefaultTypeArgumentType(isInJavaScriptFile) {
- return isInJavaScriptFile ? anyType : emptyObjectType;
+ return isInJavaScriptFile ? anyType : unknownType;
}
function getInferredTypes(context) {
var result = [];
@@ -45158,8 +45949,8 @@
return result;
}
// EXPRESSION TYPE CHECKING
- function getCannotFindNameDiagnosticForName(name) {
- switch (name) {
+ function getCannotFindNameDiagnosticForName(node) {
+ switch (node.escapedText) {
case "document":
case "console":
return ts.Diagnostics.Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_include_dom;
@@ -45190,14 +45981,20 @@
case "Iterator":
case "AsyncIterator":
return ts.Diagnostics.Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later;
- default: return ts.Diagnostics.Cannot_find_name_0;
+ default:
+ if (node.parent.kind === 277 /* ShorthandPropertyAssignment */) {
+ return ts.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer;
+ }
+ else {
+ return ts.Diagnostics.Cannot_find_name_0;
+ }
}
}
function getResolvedSymbol(node) {
var links = getNodeLinks(node);
if (!links.resolvedSymbol) {
links.resolvedSymbol = !ts.nodeIsMissing(node) &&
- resolveName(node, node.escapedText, 67220415 /* Value */ | 1048576 /* ExportValue */, getCannotFindNameDiagnosticForName(node.escapedText), node, !ts.isWriteOnlyAccess(node),
+ resolveName(node, node.escapedText, 67220415 /* Value */ | 1048576 /* ExportValue */, getCannotFindNameDiagnosticForName(node), node, !ts.isWriteOnlyAccess(node),
/*excludeGlobals*/ false, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_1) || unknownSymbol;
}
return links.resolvedSymbol;
@@ -45206,7 +46003,7 @@
// TypeScript 1.0 spec (April 2014): 3.6.3
// A type query consists of the keyword typeof followed by an expression.
// The expression is restricted to a single identifier or a sequence of identifiers separated by periods
- return !!ts.findAncestor(node, function (n) { return n.kind === 167 /* TypeQuery */ ? true : n.kind === 72 /* Identifier */ || n.kind === 148 /* QualifiedName */ ? false : "quit"; });
+ return !!ts.findAncestor(node, function (n) { return n.kind === 168 /* TypeQuery */ ? true : n.kind === 73 /* Identifier */ || n.kind === 149 /* QualifiedName */ ? false : "quit"; });
}
// Return the flow cache key for a "dotted name" (i.e. a sequence of identifiers
// separated by dots). The key consists of the id of the symbol referenced by the
@@ -45214,21 +46011,21 @@
// The result is undefined if the reference isn't a dotted name. We prefix nodes
// occurring in an apparent type position with '@' because the control flow type
// of such nodes may be based on the apparent type instead of the declared type.
- function getFlowCacheKey(node) {
+ function getFlowCacheKey(node, declaredType, initialType, flowContainer) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
var symbol = getResolvedSymbol(node);
- return symbol !== unknownSymbol ? (isConstraintPosition(node) ? "@" : "") + getSymbolId(symbol) : undefined;
- case 100 /* ThisKeyword */:
+ return symbol !== unknownSymbol ? (flowContainer ? getNodeId(flowContainer) : "-1") + "|" + getTypeId(declaredType) + "|" + getTypeId(initialType) + "|" + (isConstraintPosition(node) ? "@" : "") + getSymbolId(symbol) : undefined;
+ case 101 /* ThisKeyword */:
return "0";
- case 213 /* NonNullExpression */:
- case 195 /* ParenthesizedExpression */:
- return getFlowCacheKey(node.expression);
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 214 /* NonNullExpression */:
+ case 196 /* ParenthesizedExpression */:
+ return getFlowCacheKey(node.expression, declaredType, initialType, flowContainer);
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
var propName = getAccessedPropertyName(node);
if (propName !== undefined) {
- var key = getFlowCacheKey(node.expression);
+ var key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer);
return key && key + "." + propName;
}
}
@@ -45236,24 +46033,24 @@
}
function isMatchingReference(source, target) {
switch (target.kind) {
- case 195 /* ParenthesizedExpression */:
- case 213 /* NonNullExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 214 /* NonNullExpression */:
return isMatchingReference(source, target.expression);
}
switch (source.kind) {
- case 72 /* Identifier */:
- return target.kind === 72 /* Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) ||
- (target.kind === 237 /* VariableDeclaration */ || target.kind === 186 /* BindingElement */) &&
+ case 73 /* Identifier */:
+ return target.kind === 73 /* Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) ||
+ (target.kind === 238 /* VariableDeclaration */ || target.kind === 187 /* BindingElement */) &&
getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target);
- case 100 /* ThisKeyword */:
- return target.kind === 100 /* ThisKeyword */;
- case 98 /* SuperKeyword */:
- return target.kind === 98 /* SuperKeyword */;
- case 213 /* NonNullExpression */:
- case 195 /* ParenthesizedExpression */:
+ case 101 /* ThisKeyword */:
+ return target.kind === 101 /* ThisKeyword */;
+ case 99 /* SuperKeyword */:
+ return target.kind === 99 /* SuperKeyword */;
+ case 214 /* NonNullExpression */:
+ case 196 /* ParenthesizedExpression */:
return isMatchingReference(source.expression, target);
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return ts.isAccessExpression(target) &&
getAccessedPropertyName(source) === getAccessedPropertyName(target) &&
isMatchingReference(source.expression, target.expression);
@@ -45261,7 +46058,7 @@
return false;
}
function getAccessedPropertyName(access) {
- return access.kind === 189 /* PropertyAccessExpression */ ? access.name.escapedText :
+ return access.kind === 190 /* PropertyAccessExpression */ ? access.name.escapedText :
ts.isStringLiteral(access.argumentExpression) || ts.isNumericLiteral(access.argumentExpression) ? ts.escapeLeadingUnderscores(access.argumentExpression.text) :
undefined;
}
@@ -45286,7 +46083,7 @@
isDiscriminantProperty(getDeclaredTypeOfReference(target.expression), name);
}
function getDeclaredTypeOfReference(expr) {
- if (expr.kind === 72 /* Identifier */) {
+ if (expr.kind === 73 /* Identifier */) {
return getTypeOfSymbol(getResolvedSymbol(expr));
}
if (ts.isAccessExpression(expr)) {
@@ -45308,7 +46105,7 @@
if (prop && ts.getCheckFlags(prop) & 2 /* SyntheticProperty */) {
if (prop.isDiscriminantProperty === undefined) {
prop.isDiscriminantProperty =
- (prop.checkFlags & 96 /* Discriminant */) === 96 /* Discriminant */ &&
+ (prop.checkFlags & 192 /* Discriminant */) === 192 /* Discriminant */ &&
isDiscriminantType(getTypeOfSymbol(prop));
}
return !!prop.isDiscriminantProperty;
@@ -45317,7 +46114,7 @@
return false;
}
function isSyntheticThisPropertyAccess(expr) {
- return ts.isAccessExpression(expr) && expr.expression.kind === 100 /* ThisKeyword */ && !!(expr.expression.flags & 8 /* Synthesized */);
+ return ts.isAccessExpression(expr) && expr.expression.kind === 101 /* ThisKeyword */ && !!(expr.expression.flags & 8 /* Synthesized */);
}
function findDiscriminantProperties(sourceProperties, target) {
var result;
@@ -45345,7 +46142,7 @@
}
}
}
- if (callExpression.expression.kind === 189 /* PropertyAccessExpression */ &&
+ if (callExpression.expression.kind === 190 /* PropertyAccessExpression */ &&
isOrContainsMatchingReference(reference, callExpression.expression.expression)) {
return true;
}
@@ -45464,7 +46261,7 @@
return strictNullChecks ? 7888800 /* ObjectStrictFacts */ : 16736160 /* ObjectFacts */;
}
if (flags & 63176704 /* Instantiable */) {
- return getTypeFacts(getBaseConstraintOfType(type) || emptyObjectType);
+ return getTypeFacts(getBaseConstraintOfType(type) || unknownType);
}
if (flags & 3145728 /* UnionOrIntersection */) {
return getTypeFactsOfTypes(type.types);
@@ -45500,15 +46297,15 @@
return createArrayType(checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false, /*allowAsyncIterables*/ false) || errorType);
}
function getAssignedTypeOfBinaryExpression(node) {
- var isDestructuringDefaultAssignment = node.parent.kind === 187 /* ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) ||
- node.parent.kind === 275 /* PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent);
+ var isDestructuringDefaultAssignment = node.parent.kind === 188 /* ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) ||
+ node.parent.kind === 276 /* PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent);
return isDestructuringDefaultAssignment ?
getTypeWithDefault(getAssignedType(node), node.right) :
getTypeOfExpression(node.right);
}
function isDestructuringAssignmentTarget(parent) {
- return parent.parent.kind === 204 /* BinaryExpression */ && parent.parent.left === parent ||
- parent.parent.kind === 227 /* ForOfStatement */ && parent.parent.initializer === parent;
+ return parent.parent.kind === 205 /* BinaryExpression */ && parent.parent.left === parent ||
+ parent.parent.kind === 228 /* ForOfStatement */ && parent.parent.initializer === parent;
}
function getAssignedTypeOfArrayLiteralElement(node, element) {
return getTypeOfDestructuredArrayElement(getAssignedType(node), node.elements.indexOf(element));
@@ -45525,21 +46322,21 @@
function getAssignedType(node) {
var parent = node.parent;
switch (parent.kind) {
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return stringType;
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return checkRightHandSideOfForOf(parent.expression, parent.awaitModifier) || errorType;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return getAssignedTypeOfBinaryExpression(parent);
- case 198 /* DeleteExpression */:
+ case 199 /* DeleteExpression */:
return undefinedType;
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return getAssignedTypeOfArrayLiteralElement(parent, node);
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
return getAssignedTypeOfSpreadExpression(parent);
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return getAssignedTypeOfPropertyAssignment(parent);
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return getAssignedTypeOfShorthandPropertyAssignment(parent);
}
return errorType;
@@ -45547,7 +46344,7 @@
function getInitialTypeOfBindingElement(node) {
var pattern = node.parent;
var parentType = getInitialType(pattern.parent);
- var type = pattern.kind === 184 /* ObjectBindingPattern */ ?
+ var type = pattern.kind === 185 /* ObjectBindingPattern */ ?
getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) :
!node.dotDotDotToken ?
getTypeOfDestructuredArrayElement(parentType, pattern.elements.indexOf(node)) :
@@ -45565,37 +46362,37 @@
if (node.initializer) {
return getTypeOfInitializer(node.initializer);
}
- if (node.parent.parent.kind === 226 /* ForInStatement */) {
+ if (node.parent.parent.kind === 227 /* ForInStatement */) {
return stringType;
}
- if (node.parent.parent.kind === 227 /* ForOfStatement */) {
+ if (node.parent.parent.kind === 228 /* ForOfStatement */) {
return checkRightHandSideOfForOf(node.parent.parent.expression, node.parent.parent.awaitModifier) || errorType;
}
return errorType;
}
function getInitialType(node) {
- return node.kind === 237 /* VariableDeclaration */ ?
+ return node.kind === 238 /* VariableDeclaration */ ?
getInitialTypeOfVariableDeclaration(node) :
getInitialTypeOfBindingElement(node);
}
function getInitialOrAssignedType(node, reference) {
- return getConstraintForLocation(node.kind === 237 /* VariableDeclaration */ || node.kind === 186 /* BindingElement */ ?
+ return getConstraintForLocation(node.kind === 238 /* VariableDeclaration */ || node.kind === 187 /* BindingElement */ ?
getInitialType(node) :
getAssignedType(node), reference);
}
function isEmptyArrayAssignment(node) {
- return node.kind === 237 /* VariableDeclaration */ && node.initializer &&
+ return node.kind === 238 /* VariableDeclaration */ && node.initializer &&
isEmptyArrayLiteral(node.initializer) ||
- node.kind !== 186 /* BindingElement */ && node.parent.kind === 204 /* BinaryExpression */ &&
+ node.kind !== 187 /* BindingElement */ && node.parent.kind === 205 /* BinaryExpression */ &&
isEmptyArrayLiteral(node.parent.right);
}
function getReferenceCandidate(node) {
switch (node.kind) {
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return getReferenceCandidate(node.expression);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
switch (node.operatorToken.kind) {
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
return getReferenceCandidate(node.left);
case 27 /* CommaToken */:
return getReferenceCandidate(node.right);
@@ -45605,13 +46402,13 @@
}
function getReferenceRoot(node) {
var parent = node.parent;
- return parent.kind === 195 /* ParenthesizedExpression */ ||
- parent.kind === 204 /* BinaryExpression */ && parent.operatorToken.kind === 59 /* EqualsToken */ && parent.left === node ||
- parent.kind === 204 /* BinaryExpression */ && parent.operatorToken.kind === 27 /* CommaToken */ && parent.right === node ?
+ return parent.kind === 196 /* ParenthesizedExpression */ ||
+ parent.kind === 205 /* BinaryExpression */ && parent.operatorToken.kind === 60 /* EqualsToken */ && parent.left === node ||
+ parent.kind === 205 /* BinaryExpression */ && parent.operatorToken.kind === 27 /* CommaToken */ && parent.right === node ?
getReferenceRoot(parent) : node;
}
function getTypeOfSwitchClause(clause) {
- if (clause.kind === 271 /* CaseClause */) {
+ if (clause.kind === 272 /* CaseClause */) {
return getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression));
}
return neverType;
@@ -45633,7 +46430,7 @@
var witnesses = [];
for (var _i = 0, _a = switchStatement.caseBlock.clauses; _i < _a.length; _i++) {
var clause = _a[_i];
- if (clause.kind === 271 /* CaseClause */) {
+ if (clause.kind === 272 /* CaseClause */) {
if (clause.expression.kind === 10 /* StringLiteral */) {
witnesses.push(clause.expression.text);
continue;
@@ -45679,6 +46476,9 @@
}
return f(type) ? type : neverType;
}
+ function countTypes(type) {
+ return type.flags & 1048576 /* Union */ ? type.types.length : 1;
+ }
function mapType(type, mapper, noReductions) {
if (type.flags & 131072 /* Never */) {
return type;
@@ -45686,25 +46486,20 @@
if (!(type.flags & 1048576 /* Union */)) {
return mapper(type);
}
- var types = type.types;
- var mappedType;
var mappedTypes;
- for (var _i = 0, types_13 = types; _i < types_13.length; _i++) {
- var current = types_13[_i];
- var t = mapper(current);
- if (t) {
- if (!mappedType) {
- mappedType = t;
- }
- else if (!mappedTypes) {
- mappedTypes = [mappedType, t];
+ for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
+ var t = _a[_i];
+ var mapped = mapper(t);
+ if (mapped) {
+ if (!mappedTypes) {
+ mappedTypes = [mapped];
}
else {
- mappedTypes.push(t);
+ mappedTypes.push(mapped);
}
}
}
- return mappedTypes ? getUnionType(mappedTypes, noReductions ? 0 /* None */ : 1 /* Literal */) : mappedType;
+ return mappedTypes && getUnionType(mappedTypes, noReductions ? 0 /* None */ : 1 /* Literal */);
}
function extractTypesOfKind(type, kind) {
return filterType(type, function (t) { return (t.flags & kind) !== 0; });
@@ -45772,8 +46567,8 @@
}
function isEvolvingArrayTypeList(types) {
var hasEvolvingArrayType = false;
- for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
- var t = types_14[_i];
+ for (var _i = 0, types_13 = types; _i < types_13.length; _i++) {
+ var t = types_13[_i];
if (!(t.flags & 131072 /* Never */)) {
if (!(ts.getObjectFlags(t) & 256 /* EvolvingArray */)) {
return false;
@@ -45796,12 +46591,12 @@
function isEvolvingArrayOperationTarget(node) {
var root = getReferenceRoot(node);
var parent = root.parent;
- var isLengthPushOrUnshift = parent.kind === 189 /* PropertyAccessExpression */ && (parent.name.escapedText === "length" ||
- parent.parent.kind === 191 /* CallExpression */ && ts.isPushOrUnshiftIdentifier(parent.name));
- var isElementAssignment = parent.kind === 190 /* ElementAccessExpression */ &&
+ var isLengthPushOrUnshift = parent.kind === 190 /* PropertyAccessExpression */ && (parent.name.escapedText === "length" ||
+ parent.parent.kind === 192 /* CallExpression */ && ts.isPushOrUnshiftIdentifier(parent.name));
+ var isElementAssignment = parent.kind === 191 /* ElementAccessExpression */ &&
parent.expression === root &&
- parent.parent.kind === 204 /* BinaryExpression */ &&
- parent.parent.operatorToken.kind === 59 /* EqualsToken */ &&
+ parent.parent.kind === 205 /* BinaryExpression */ &&
+ parent.parent.operatorToken.kind === 60 /* EqualsToken */ &&
parent.parent.left === parent &&
!ts.isAssignmentTarget(parent.parent) &&
isTypeAssignableToKind(getTypeOfExpression(parent.argumentExpression), 296 /* NumberLike */);
@@ -45815,7 +46610,7 @@
return links.maybeTypePredicate;
}
function getMaybeTypePredicate(node) {
- if (node.expression.kind !== 98 /* SuperKeyword */) {
+ if (node.expression.kind !== 99 /* SuperKeyword */) {
var funcType = checkNonNullExpression(node.expression);
if (funcType !== silentNeverType) {
var apparentType = getApparentType(funcType);
@@ -45833,6 +46628,7 @@
function getFlowTypeOfReference(reference, declaredType, initialType, flowContainer, couldBeUninitialized) {
if (initialType === void 0) { initialType = declaredType; }
var key;
+ var keySet = false;
var flowDepth = 0;
if (flowAnalysisDisabled) {
return errorType;
@@ -45848,10 +46644,17 @@
// on empty arrays are possible without implicit any errors and new element types can be inferred without
// type mismatch errors.
var resultType = ts.getObjectFlags(evolvedType) & 256 /* EvolvingArray */ && isEvolvingArrayOperationTarget(reference) ? autoArrayType : finalizeEvolvingArrayType(evolvedType);
- if (reference.parent && reference.parent.kind === 213 /* NonNullExpression */ && getTypeWithFacts(resultType, 2097152 /* NEUndefinedOrNull */).flags & 131072 /* Never */) {
+ if (reference.parent && reference.parent.kind === 214 /* NonNullExpression */ && getTypeWithFacts(resultType, 2097152 /* NEUndefinedOrNull */).flags & 131072 /* Never */) {
return declaredType;
}
return resultType;
+ function getOrSetCacheKey() {
+ if (keySet) {
+ return key;
+ }
+ keySet = true;
+ return key = getFlowCacheKey(reference, declaredType, initialType, flowContainer);
+ }
function getTypeAtFlowNode(flow) {
if (flowDepth === 2000) {
// We have made 2000 recursive invocations. To avoid overflowing the call stack we report an error
@@ -45863,6 +46666,15 @@
flowDepth++;
while (true) {
var flags = flow.flags;
+ if (flags & 8192 /* Cached */) {
+ var key_2 = getOrSetCacheKey();
+ if (key_2) {
+ var id = getFlowNodeId(flow);
+ if (flowAssignmentKeys[id] === key_2) {
+ return flowAssignmentTypes[id];
+ }
+ }
+ }
if (flags & 1024 /* Shared */) {
// We cache results of flow type resolution for shared nodes that were previously visited in
// the same getFlowTypeOfReference invocation. A node is considered shared when it is the
@@ -45893,6 +46705,15 @@
flow = flow.antecedent;
continue;
}
+ else if (flowLoopCount === flowLoopStart) { // Only cache assignments when not within loop analysis
+ var key_3 = getOrSetCacheKey();
+ if (key_3 && !isIncomplete(type)) {
+ flow.flags |= 8192 /* Cached */;
+ var id = getFlowNodeId(flow);
+ flowAssignmentKeys[id] = key_3;
+ flowAssignmentTypes[id] = type;
+ }
+ }
}
else if (flags & 96 /* Condition */) {
type = getTypeAtFlowCondition(flow);
@@ -45920,9 +46741,9 @@
// Check if we should continue with the control flow of the containing function.
var container = flow.container;
if (container && container !== flowContainer &&
- reference.kind !== 189 /* PropertyAccessExpression */ &&
- reference.kind !== 190 /* ElementAccessExpression */ &&
- reference.kind !== 100 /* ThisKeyword */) {
+ reference.kind !== 190 /* PropertyAccessExpression */ &&
+ reference.kind !== 191 /* ElementAccessExpression */ &&
+ reference.kind !== 101 /* ThisKeyword */) {
flow = container.flowNode;
continue;
}
@@ -45974,14 +46795,14 @@
// in which case we continue control flow analysis back to the function's declaration
if (ts.isVariableDeclaration(node) && (ts.isInJSFile(node) || ts.isVarConst(node))) {
var init = ts.getDeclaredExpandoInitializer(node);
- if (init && (init.kind === 196 /* FunctionExpression */ || init.kind === 197 /* ArrowFunction */)) {
+ if (init && (init.kind === 197 /* FunctionExpression */ || init.kind === 198 /* ArrowFunction */)) {
return getTypeAtFlowNode(flow.antecedent);
}
}
return declaredType;
}
// for (const _ in ref) acts as a nonnull on ref
- if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 226 /* ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) {
+ if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 227 /* ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) {
return getNonNullableTypeIfNeeded(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent)));
}
// Assignment doesn't affect reference
@@ -45990,7 +46811,7 @@
function getTypeAtFlowArrayMutation(flow) {
if (declaredType === autoType || declaredType === autoArrayType) {
var node = flow.node;
- var expr = node.kind === 191 /* CallExpression */ ?
+ var expr = node.kind === 192 /* CallExpression */ ?
node.expression.expression :
node.left.expression;
if (isMatchingReference(reference, getReferenceCandidate(expr))) {
@@ -45998,7 +46819,7 @@
var type = getTypeFromFlowType(flowType);
if (ts.getObjectFlags(type) & 256 /* EvolvingArray */) {
var evolvedType_1 = type;
- if (node.kind === 191 /* CallExpression */) {
+ if (node.kind === 192 /* CallExpression */) {
for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) {
var arg = _a[_i];
evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg);
@@ -46051,7 +46872,7 @@
else if (isMatchingReferenceDiscriminant(expr, type)) {
type = narrowTypeByDiscriminant(type, expr, function (t) { return narrowTypeBySwitchOnDiscriminant(t, flow.switchStatement, flow.clauseStart, flow.clauseEnd); });
}
- else if (expr.kind === 199 /* TypeOfExpression */ && isMatchingReference(reference, expr.expression)) {
+ else if (expr.kind === 200 /* TypeOfExpression */ && isMatchingReference(reference, expr.expression)) {
type = narrowBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
}
else if (containsMatchingReferenceDiscriminant(reference, expr)) {
@@ -46098,13 +46919,11 @@
// this flow loop junction, return the cached type.
var id = getFlowNodeId(flow);
var cache = flowLoopCaches[id] || (flowLoopCaches[id] = ts.createMap());
+ var key = getOrSetCacheKey();
if (!key) {
- key = getFlowCacheKey(reference);
// No cache key is generated when binding patterns are in unnarrowable situations
- if (!key) {
return declaredType;
}
- }
var cached = cache.get(key);
if (cached) {
return cached;
@@ -46211,7 +47030,7 @@
return !assumeTrue;
}
function narrowByInKeyword(type, literal, assumeTrue) {
- if ((type.flags & (1048576 /* Union */ | 524288 /* Object */)) || (type.flags & 262144 /* TypeParameter */ && type.isThisType)) {
+ if (type.flags & (1048576 /* Union */ | 524288 /* Object */) || isThisTypeParameter(type)) {
var propName_1 = ts.escapeLeadingUnderscores(literal.text);
return filterType(type, function (t) { return isTypePresencePossible(t, propName_1, assumeTrue); });
}
@@ -46219,8 +47038,8 @@
}
function narrowTypeByBinaryExpression(type, expr, assumeTrue) {
switch (expr.operatorToken.kind) {
- case 59 /* EqualsToken */:
- return narrowTypeByTruthiness(type, expr.left, assumeTrue);
+ case 60 /* EqualsToken */:
+ return narrowTypeByTruthiness(narrowType(type, expr.right, assumeTrue), expr.left, assumeTrue);
case 33 /* EqualsEqualsToken */:
case 34 /* ExclamationEqualsToken */:
case 35 /* EqualsEqualsEqualsToken */:
@@ -46228,10 +47047,10 @@
var operator_1 = expr.operatorToken.kind;
var left_1 = getReferenceCandidate(expr.left);
var right_1 = getReferenceCandidate(expr.right);
- if (left_1.kind === 199 /* TypeOfExpression */ && ts.isStringLiteralLike(right_1)) {
+ if (left_1.kind === 200 /* TypeOfExpression */ && ts.isStringLiteralLike(right_1)) {
return narrowTypeByTypeof(type, left_1, operator_1, right_1, assumeTrue);
}
- if (right_1.kind === 199 /* TypeOfExpression */ && ts.isStringLiteralLike(left_1)) {
+ if (right_1.kind === 200 /* TypeOfExpression */ && ts.isStringLiteralLike(left_1)) {
return narrowTypeByTypeof(type, right_1, operator_1, left_1, assumeTrue);
}
if (isMatchingReference(reference, left_1)) {
@@ -46250,9 +47069,9 @@
return declaredType;
}
break;
- case 94 /* InstanceOfKeyword */:
+ case 95 /* InstanceOfKeyword */:
return narrowTypeByInstanceof(type, expr, assumeTrue);
- case 93 /* InKeyword */:
+ case 94 /* InKeyword */:
var target = getReferenceCandidate(expr.right);
if (ts.isStringLiteralLike(expr.left) && isMatchingReference(reference, target)) {
return narrowByInKeyword(type, expr.left, assumeTrue);
@@ -46296,7 +47115,10 @@
return type;
}
if (assumeTrue) {
- var narrowedType = filterType(type, function (t) { return areTypesComparable(t, valueType); });
+ var filterFn = operator === 33 /* EqualsEqualsToken */ ?
+ (function (t) { return areTypesComparable(t, valueType) || isCoercibleUnderDoubleEquals(t, valueType); }) :
+ function (t) { return areTypesComparable(t, valueType); };
+ var narrowedType = filterType(type, filterFn);
return narrowedType.flags & 131072 /* Never */ ? type : replacePrimitivesWithLiterals(narrowedType, valueType);
}
if (isUnitType(valueType)) {
@@ -46585,19 +47407,19 @@
// will be a subtype or the same type as the argument.
function narrowType(type, expr, assumeTrue) {
switch (expr.kind) {
- case 72 /* Identifier */:
- case 100 /* ThisKeyword */:
- case 98 /* SuperKeyword */:
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 73 /* Identifier */:
+ case 101 /* ThisKeyword */:
+ case 99 /* SuperKeyword */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return narrowTypeByTruthiness(type, expr, assumeTrue);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return narrowTypeByTypePredicate(type, expr, assumeTrue);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return narrowType(type, expr.expression, assumeTrue);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return narrowTypeByBinaryExpression(type, expr, assumeTrue);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
if (expr.operator === 52 /* ExclamationToken */) {
return narrowType(type, expr.operand, !assumeTrue);
}
@@ -46612,7 +47434,7 @@
// an dotted name expression, and if the location is not an assignment target, obtain the type
// of the expression (which will reflect control flow analysis). If the expression indeed
// resolved to the given symbol, return the narrowed type.
- if (location.kind === 72 /* Identifier */) {
+ if (location.kind === 73 /* Identifier */) {
if (ts.isRightSideOfQualifiedNameOrPropertyAccess(location)) {
location = location.parent;
}
@@ -46633,9 +47455,9 @@
function getControlFlowContainer(node) {
return ts.findAncestor(node.parent, function (node) {
return ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) ||
- node.kind === 245 /* ModuleBlock */ ||
- node.kind === 284 /* SourceFile */ ||
- node.kind === 154 /* PropertyDeclaration */;
+ node.kind === 246 /* ModuleBlock */ ||
+ node.kind === 285 /* SourceFile */ ||
+ node.kind === 155 /* PropertyDeclaration */;
});
}
// Check if a parameter is assigned anywhere within its declaring function.
@@ -46654,10 +47476,10 @@
return !!ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !!(getNodeLinks(node).flags & 8388608 /* AssignmentsMarked */); });
}
function markParameterAssignments(node) {
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
if (ts.isAssignmentTarget(node)) {
var symbol = getResolvedSymbol(node);
- if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 151 /* Parameter */) {
+ if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 152 /* Parameter */) {
symbol.isAssigned = true;
}
}
@@ -46672,7 +47494,7 @@
/** remove undefined from the annotated type of a parameter when there is an initializer (that doesn't include undefined) */
function removeOptionalityFromDeclaredType(declaredType, declaration) {
var annotationIncludesUndefined = strictNullChecks &&
- declaration.kind === 151 /* Parameter */ &&
+ declaration.kind === 152 /* Parameter */ &&
declaration.initializer &&
getFalsyFlags(declaredType) & 32768 /* Undefined */ &&
!(getFalsyFlags(checkExpression(declaration.initializer)) & 32768 /* Undefined */);
@@ -46680,13 +47502,13 @@
}
function isConstraintPosition(node) {
var parent = node.parent;
- return parent.kind === 189 /* PropertyAccessExpression */ ||
- parent.kind === 191 /* CallExpression */ && parent.expression === node ||
- parent.kind === 190 /* ElementAccessExpression */ && parent.expression === node ||
- parent.kind === 186 /* BindingElement */ && parent.name === node && !!parent.initializer;
+ return parent.kind === 190 /* PropertyAccessExpression */ ||
+ parent.kind === 192 /* CallExpression */ && parent.expression === node ||
+ parent.kind === 191 /* ElementAccessExpression */ && parent.expression === node ||
+ parent.kind === 187 /* BindingElement */ && parent.name === node && !!parent.initializer;
}
function typeHasNullableConstraint(type) {
- return type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || emptyObjectType, 98304 /* Nullable */);
+ return type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 98304 /* Nullable */);
}
function getConstraintForLocation(type, node) {
// When a node is the left hand expression of a property access, element access, or call expression,
@@ -46717,7 +47539,7 @@
if (symbol === argumentsSymbol) {
var container = ts.getContainingFunction(node);
if (languageVersion < 2 /* ES2015 */) {
- if (container.kind === 197 /* ArrowFunction */) {
+ if (container.kind === 198 /* ArrowFunction */) {
error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression);
}
else if (ts.hasModifier(container, 256 /* Async */)) {
@@ -46738,7 +47560,7 @@
// Due to the emit for class decorators, any reference to the class from inside of the class body
// must instead be rewritten to point to a temporary variable to avoid issues with the double-bind
// behavior of class names in ES6.
- if (declaration.kind === 240 /* ClassDeclaration */
+ if (declaration.kind === 241 /* ClassDeclaration */
&& ts.nodeIsDecorated(declaration)) {
var container = ts.getContainingClass(node);
while (container !== undefined) {
@@ -46750,14 +47572,14 @@
container = ts.getContainingClass(container);
}
}
- else if (declaration.kind === 209 /* ClassExpression */) {
+ else if (declaration.kind === 210 /* ClassExpression */) {
// When we emit a class expression with static members that contain a reference
// to the constructor in the initializer, we will need to substitute that
// binding with an alias as the class name is not in scope.
var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false);
- while (container.kind !== 284 /* SourceFile */) {
+ while (container.kind !== 285 /* SourceFile */) {
if (container.parent === declaration) {
- if (container.kind === 154 /* PropertyDeclaration */ && ts.hasModifier(container, 32 /* Static */)) {
+ if (container.kind === 155 /* PropertyDeclaration */ && ts.hasModifier(container, 32 /* Static */)) {
getNodeLinks(declaration).flags |= 16777216 /* ClassWithConstructorReference */;
getNodeLinks(node).flags |= 33554432 /* ConstructorReferenceInClass */;
}
@@ -46806,7 +47628,7 @@
// The declaration container is the innermost function that encloses the declaration of the variable
// or parameter. The flow container is the innermost function starting with which we analyze the control
// flow graph to determine the control flow based type.
- var isParameter = ts.getRootDeclaration(declaration).kind === 151 /* Parameter */;
+ var isParameter = ts.getRootDeclaration(declaration).kind === 152 /* Parameter */;
var declarationContainer = getControlFlowContainer(declaration);
var flowContainer = getControlFlowContainer(node);
var isOuterVariable = flowContainer !== declarationContainer;
@@ -46815,19 +47637,19 @@
// When the control flow originates in a function expression or arrow function and we are referencing
// a const variable or parameter from an outer function, we extend the origin of the control flow
// analysis to include the immediately enclosing function.
- while (flowContainer !== declarationContainer && (flowContainer.kind === 196 /* FunctionExpression */ ||
- flowContainer.kind === 197 /* ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) &&
+ while (flowContainer !== declarationContainer && (flowContainer.kind === 197 /* FunctionExpression */ ||
+ flowContainer.kind === 198 /* ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) &&
(isConstVariable(localOrExportSymbol) || isParameter && !isParameterAssigned(localOrExportSymbol))) {
flowContainer = getControlFlowContainer(flowContainer);
}
// We only look for uninitialized variables in strict null checking mode, and only when we can analyze
// the entire control flow graph from the variable's declaration (i.e. when the flow container and
// declaration container are the same).
- var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports ||
+ var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || ts.isBindingElement(declaration) ||
type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 3 /* AnyOrUnknown */) !== 0 ||
- isInTypeQuery(node) || node.parent.kind === 257 /* ExportSpecifier */) ||
- node.parent.kind === 213 /* NonNullExpression */ ||
- declaration.kind === 237 /* VariableDeclaration */ && declaration.exclamationToken ||
+ isInTypeQuery(node) || node.parent.kind === 258 /* ExportSpecifier */) ||
+ node.parent.kind === 214 /* NonNullExpression */ ||
+ declaration.kind === 238 /* VariableDeclaration */ && declaration.exclamationToken ||
declaration.flags & 4194304 /* Ambient */;
var initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, declaration) : type) :
type === autoType || type === autoArrayType ? undefinedType :
@@ -46862,7 +47684,7 @@
if (languageVersion >= 2 /* ES2015 */ ||
(symbol.flags & (2 /* BlockScopedVariable */ | 32 /* Class */)) === 0 ||
ts.isSourceFile(symbol.valueDeclaration) ||
- symbol.valueDeclaration.parent.kind === 274 /* CatchClause */) {
+ symbol.valueDeclaration.parent.kind === 275 /* CatchClause */) {
return;
}
// 1. walk from the use site up to the declaration and check
@@ -46885,7 +47707,7 @@
// mark iteration statement as containing block-scoped binding captured in some function
var capturesBlockScopeBindingInLoopBody = true;
if (ts.isForStatement(container) &&
- ts.getAncestor(symbol.valueDeclaration, 238 /* VariableDeclarationList */).parent === container) {
+ ts.getAncestor(symbol.valueDeclaration, 239 /* VariableDeclarationList */).parent === container) {
var part = getPartOfForStatementContainingNode(node.parent, container);
if (part) {
var links = getNodeLinks(part);
@@ -46903,8 +47725,8 @@
}
// mark variables that are declared in loop initializer and reassigned inside the body of ForStatement.
// if body of ForStatement will be converted to function then we'll need a extra machinery to propagate reassigned values back.
- if (container.kind === 225 /* ForStatement */ &&
- ts.getAncestor(symbol.valueDeclaration, 238 /* VariableDeclarationList */).parent === container &&
+ if (container.kind === 226 /* ForStatement */ &&
+ ts.getAncestor(symbol.valueDeclaration, 239 /* VariableDeclarationList */).parent === container &&
isAssignedInBodyOfForStatement(node, container)) {
getNodeLinks(symbol.valueDeclaration).flags |= 4194304 /* NeedsLoopOutParameter */;
}
@@ -46922,7 +47744,7 @@
function isAssignedInBodyOfForStatement(node, container) {
// skip parenthesized nodes
var current = node;
- while (current.parent.kind === 195 /* ParenthesizedExpression */) {
+ while (current.parent.kind === 196 /* ParenthesizedExpression */) {
current = current.parent;
}
// check if node is used as LHS in some assignment expression
@@ -46930,7 +47752,7 @@
if (ts.isAssignmentTarget(current)) {
isAssigned = true;
}
- else if ((current.parent.kind === 202 /* PrefixUnaryExpression */ || current.parent.kind === 203 /* PostfixUnaryExpression */)) {
+ else if ((current.parent.kind === 203 /* PrefixUnaryExpression */ || current.parent.kind === 204 /* PostfixUnaryExpression */)) {
var expr = current.parent;
isAssigned = expr.operator === 44 /* PlusPlusToken */ || expr.operator === 45 /* MinusMinusToken */;
}
@@ -46943,7 +47765,7 @@
}
function captureLexicalThis(node, container) {
getNodeLinks(node).flags |= 2 /* LexicalThis */;
- if (container.kind === 154 /* PropertyDeclaration */ || container.kind === 157 /* Constructor */) {
+ if (container.kind === 155 /* PropertyDeclaration */ || container.kind === 158 /* Constructor */) {
var classNode = container.parent;
getNodeLinks(classNode).flags |= 4 /* CaptureThis */;
}
@@ -47011,37 +47833,37 @@
// tell whether 'this' needs to be captured.
var container = ts.getThisContainer(node, /* includeArrowFunctions */ true);
var capturedByArrowFunction = false;
- if (container.kind === 157 /* Constructor */) {
+ if (container.kind === 158 /* Constructor */) {
checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class);
}
// Now skip arrow functions to get the "real" owner of 'this'.
- if (container.kind === 197 /* ArrowFunction */) {
+ if (container.kind === 198 /* ArrowFunction */) {
container = ts.getThisContainer(container, /* includeArrowFunctions */ false);
capturedByArrowFunction = true;
}
switch (container.kind) {
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body);
// do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks
break;
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location);
// do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks
break;
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
if (isInConstructorArgumentInitializer(node, container)) {
error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments);
// do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks
}
break;
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
if (ts.hasModifier(container, 32 /* Static */)) {
error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer);
// do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks
}
break;
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name);
break;
}
@@ -47091,7 +47913,7 @@
// * /** @constructor */ function [name]() { ... }
// * /** @constructor */ var x = function() { ... }
else if (isInJS &&
- (container.kind === 196 /* FunctionExpression */ || container.kind === 239 /* FunctionDeclaration */) &&
+ (container.kind === 197 /* FunctionExpression */ || container.kind === 240 /* FunctionDeclaration */) &&
ts.getJSDocClassTag(container)) {
var classType = getJSClassType(getMergedSymbol(container.symbol));
if (classType) {
@@ -47127,7 +47949,7 @@
}
function getClassNameFromPrototypeMethod(container) {
// Check if it's the RHS of a x.prototype.y = function [name]() { .... }
- if (container.kind === 196 /* FunctionExpression */ &&
+ if (container.kind === 197 /* FunctionExpression */ &&
ts.isBinaryExpression(container.parent) &&
ts.getAssignmentDeclarationKind(container.parent) === 3 /* PrototypeProperty */) {
// Get the 'x' of 'x.prototype.y = container'
@@ -47137,16 +47959,16 @@
.expression; // x
}
// x.prototype = { method() { } }
- else if (container.kind === 156 /* MethodDeclaration */ &&
- container.parent.kind === 188 /* ObjectLiteralExpression */ &&
+ else if (container.kind === 157 /* MethodDeclaration */ &&
+ container.parent.kind === 189 /* ObjectLiteralExpression */ &&
ts.isBinaryExpression(container.parent.parent) &&
ts.getAssignmentDeclarationKind(container.parent.parent) === 6 /* Prototype */) {
return container.parent.parent.left.expression;
}
// x.prototype = { method: function() { } }
- else if (container.kind === 196 /* FunctionExpression */ &&
- container.parent.kind === 275 /* PropertyAssignment */ &&
- container.parent.parent.kind === 188 /* ObjectLiteralExpression */ &&
+ else if (container.kind === 197 /* FunctionExpression */ &&
+ container.parent.kind === 276 /* PropertyAssignment */ &&
+ container.parent.parent.kind === 189 /* ObjectLiteralExpression */ &&
ts.isBinaryExpression(container.parent.parent.parent) &&
ts.getAssignmentDeclarationKind(container.parent.parent.parent) === 6 /* Prototype */) {
return container.parent.parent.parent.left.expression;
@@ -47154,7 +47976,7 @@
// Object.defineProperty(x, "method", { value: function() { } });
// Object.defineProperty(x, "method", { set: (x: () => void) => void });
// Object.defineProperty(x, "method", { get: () => function() { }) });
- else if (container.kind === 196 /* FunctionExpression */ &&
+ else if (container.kind === 197 /* FunctionExpression */ &&
ts.isPropertyAssignment(container.parent) &&
ts.isIdentifier(container.parent.name) &&
(container.parent.name.escapedText === "value" || container.parent.name.escapedText === "get" || container.parent.name.escapedText === "set") &&
@@ -47179,7 +48001,7 @@
}
function getTypeForThisExpressionFromJSDoc(node) {
var jsdocType = ts.getJSDocType(node);
- if (jsdocType && jsdocType.kind === 294 /* JSDocFunctionType */) {
+ if (jsdocType && jsdocType.kind === 295 /* JSDocFunctionType */) {
var jsDocFunctionType = jsdocType;
if (jsDocFunctionType.parameters.length > 0 &&
jsDocFunctionType.parameters[0].name &&
@@ -47193,15 +48015,15 @@
}
}
function isInConstructorArgumentInitializer(node, constructorDecl) {
- return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 151 /* Parameter */ && n.parent === constructorDecl; });
+ return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 152 /* Parameter */ && n.parent === constructorDecl; });
}
function checkSuperExpression(node) {
- var isCallExpression = node.parent.kind === 191 /* CallExpression */ && node.parent.expression === node;
+ var isCallExpression = node.parent.kind === 192 /* CallExpression */ && node.parent.expression === node;
var container = ts.getSuperContainer(node, /*stopOnFunctions*/ true);
var needToCaptureLexicalThis = false;
// adjust the container reference in case if super is used inside arrow functions with arbitrarily deep nesting
if (!isCallExpression) {
- while (container && container.kind === 197 /* ArrowFunction */) {
+ while (container && container.kind === 198 /* ArrowFunction */) {
container = ts.getSuperContainer(container, /*stopOnFunctions*/ true);
needToCaptureLexicalThis = languageVersion < 2 /* ES2015 */;
}
@@ -47214,14 +48036,14 @@
// class B {
// [super.foo()]() {}
// }
- var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 149 /* ComputedPropertyName */; });
- if (current && current.kind === 149 /* ComputedPropertyName */) {
+ var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 150 /* ComputedPropertyName */; });
+ if (current && current.kind === 150 /* ComputedPropertyName */) {
error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name);
}
else if (isCallExpression) {
error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors);
}
- else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 188 /* ObjectLiteralExpression */)) {
+ else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 189 /* ObjectLiteralExpression */)) {
error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions);
}
else {
@@ -47229,7 +48051,7 @@
}
return errorType;
}
- if (!isCallExpression && container.kind === 157 /* Constructor */) {
+ if (!isCallExpression && container.kind === 158 /* Constructor */) {
checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class);
}
if (ts.hasModifier(container, 32 /* Static */) || isCallExpression) {
@@ -47298,7 +48120,7 @@
// as a call expression cannot be used as the target of a destructuring assignment while a property access can.
//
// For element access expressions (`super[x]`), we emit a generic helper that forwards the element access in both situations.
- if (container.kind === 156 /* MethodDeclaration */ && ts.hasModifier(container, 256 /* Async */)) {
+ if (container.kind === 157 /* MethodDeclaration */ && ts.hasModifier(container, 256 /* Async */)) {
if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) {
getNodeLinks(container).flags |= 4096 /* AsyncMethodWithSuperBinding */;
}
@@ -47312,7 +48134,7 @@
// in this case they should also use correct lexical this
captureLexicalThis(node.parent, container);
}
- if (container.parent.kind === 188 /* ObjectLiteralExpression */) {
+ if (container.parent.kind === 189 /* ObjectLiteralExpression */) {
if (languageVersion < 2 /* ES2015 */) {
error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher);
return errorType;
@@ -47333,7 +48155,7 @@
if (!baseClassType) {
return errorType;
}
- if (container.kind === 157 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) {
+ if (container.kind === 158 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) {
// issue custom error message for super property access in constructor arguments (to be aligned with old compiler)
error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments);
return errorType;
@@ -47348,7 +48170,7 @@
if (isCallExpression) {
// TS 1.0 SPEC (April 2014): 4.8.1
// Super calls are only permitted in constructors of derived classes
- return container.kind === 157 /* Constructor */;
+ return container.kind === 158 /* Constructor */;
}
else {
// TS 1.0 SPEC (April 2014)
@@ -47356,21 +48178,21 @@
// - In a constructor, instance member function, instance member accessor, or instance member variable initializer where this references a derived class instance
// - In a static member function or static member accessor
// topmost container must be something that is directly nested in the class declaration\object literal expression
- if (ts.isClassLike(container.parent) || container.parent.kind === 188 /* ObjectLiteralExpression */) {
+ if (ts.isClassLike(container.parent) || container.parent.kind === 189 /* ObjectLiteralExpression */) {
if (ts.hasModifier(container, 32 /* Static */)) {
- return container.kind === 156 /* MethodDeclaration */ ||
- container.kind === 155 /* MethodSignature */ ||
- container.kind === 158 /* GetAccessor */ ||
- container.kind === 159 /* SetAccessor */;
+ return container.kind === 157 /* MethodDeclaration */ ||
+ container.kind === 156 /* MethodSignature */ ||
+ container.kind === 159 /* GetAccessor */ ||
+ container.kind === 160 /* SetAccessor */;
}
else {
- return container.kind === 156 /* MethodDeclaration */ ||
- container.kind === 155 /* MethodSignature */ ||
- container.kind === 158 /* GetAccessor */ ||
- container.kind === 159 /* SetAccessor */ ||
- container.kind === 154 /* PropertyDeclaration */ ||
- container.kind === 153 /* PropertySignature */ ||
- container.kind === 157 /* Constructor */;
+ return container.kind === 157 /* MethodDeclaration */ ||
+ container.kind === 156 /* MethodSignature */ ||
+ container.kind === 159 /* GetAccessor */ ||
+ container.kind === 160 /* SetAccessor */ ||
+ container.kind === 155 /* PropertyDeclaration */ ||
+ container.kind === 154 /* PropertySignature */ ||
+ container.kind === 158 /* Constructor */;
}
}
}
@@ -47378,10 +48200,10 @@
}
}
function getContainingObjectLiteral(func) {
- return (func.kind === 156 /* MethodDeclaration */ ||
- func.kind === 158 /* GetAccessor */ ||
- func.kind === 159 /* SetAccessor */) && func.parent.kind === 188 /* ObjectLiteralExpression */ ? func.parent :
- func.kind === 196 /* FunctionExpression */ && func.parent.kind === 275 /* PropertyAssignment */ ? func.parent.parent :
+ return (func.kind === 157 /* MethodDeclaration */ ||
+ func.kind === 159 /* GetAccessor */ ||
+ func.kind === 160 /* SetAccessor */) && func.parent.kind === 189 /* ObjectLiteralExpression */ ? func.parent :
+ func.kind === 197 /* FunctionExpression */ && func.parent.kind === 276 /* PropertyAssignment */ ? func.parent.parent :
undefined;
}
function getThisTypeArgument(type) {
@@ -47393,7 +48215,7 @@
});
}
function getContextualThisParameterType(func) {
- if (func.kind === 197 /* ArrowFunction */) {
+ if (func.kind === 198 /* ArrowFunction */) {
return undefined;
}
if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) {
@@ -47420,7 +48242,7 @@
if (thisType) {
return instantiateType(thisType, getMapperFromContext(getInferenceContext(containingLiteral)));
}
- if (literal.parent.kind !== 275 /* PropertyAssignment */) {
+ if (literal.parent.kind !== 276 /* PropertyAssignment */) {
break;
}
literal = literal.parent.parent;
@@ -47434,9 +48256,9 @@
// In an assignment of the form 'obj.xxx = function(...)' or 'obj[xxx] = function(...)', the
// contextual type for 'this' is 'obj'.
var parent = func.parent;
- if (parent.kind === 204 /* BinaryExpression */ && parent.operatorToken.kind === 59 /* EqualsToken */) {
+ if (parent.kind === 205 /* BinaryExpression */ && parent.operatorToken.kind === 60 /* EqualsToken */) {
var target = parent.left;
- if (target.kind === 189 /* PropertyAccessExpression */ || target.kind === 190 /* ElementAccessExpression */) {
+ if (target.kind === 190 /* PropertyAccessExpression */ || target.kind === 191 /* ElementAccessExpression */) {
var expression = target.expression;
// Don't contextually type `this` as `exports` in `exports.Point = function(x, y) { this.x = x; this.y = y; }`
if (inJs && ts.isIdentifier(expression)) {
@@ -47487,9 +48309,9 @@
return getTypeFromTypeNode(typeNode);
}
switch (declaration.kind) {
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return getContextuallyTypedParameterType(declaration);
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return getContextualTypeForBindingElement(declaration);
// By default, do nothing and return undefined - only parameters and binding elements have context implied by a parent
}
@@ -47610,16 +48432,16 @@
return getTypeAtPosition(signature, argIndex);
}
function getContextualTypeForSubstitutionExpression(template, substitutionExpression) {
- if (template.parent.kind === 193 /* TaggedTemplateExpression */) {
+ if (template.parent.kind === 194 /* TaggedTemplateExpression */) {
return getContextualTypeForArgument(template.parent, substitutionExpression);
}
return undefined;
}
- function getContextualTypeForBinaryOperand(node) {
+ function getContextualTypeForBinaryOperand(node, contextFlags) {
var binaryExpression = node.parent;
var left = binaryExpression.left, operatorToken = binaryExpression.operatorToken, right = binaryExpression.right;
switch (operatorToken.kind) {
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
if (node !== right) {
return undefined;
}
@@ -47632,12 +48454,12 @@
// When an || expression has a contextual type, the operands are contextually typed by that type. When an ||
// expression has no contextual type, the right operand is contextually typed by the type of the left operand,
// except for the special case of Javascript declarations of the form `namespace.prop = namespace.prop || {}`
- var type = getContextualType(binaryExpression);
+ var type = getContextualType(binaryExpression, contextFlags);
return !type && node === right && !ts.isDefaultedExpandoInitializer(binaryExpression) ?
getTypeOfExpression(left) : type;
case 54 /* AmpersandAmpersandToken */:
case 27 /* CommaToken */:
- return node === right ? getContextualType(binaryExpression) : undefined;
+ return node === right ? getContextualType(binaryExpression, contextFlags) : undefined;
default:
return undefined;
}
@@ -47744,24 +48566,24 @@
// In an object literal contextually typed by a type T, the contextual type of a property assignment is the type of
// the matching property in T, if one exists. Otherwise, it is the type of the numeric index signature in T, if one
// exists. Otherwise, it is the type of the string index signature in T, if one exists.
- function getContextualTypeForObjectLiteralMethod(node) {
+ function getContextualTypeForObjectLiteralMethod(node, contextFlags) {
ts.Debug.assert(ts.isObjectLiteralMethod(node));
if (node.flags & 8388608 /* InWithStatement */) {
// We cannot answer semantic questions within a with block, do not proceed any further
return undefined;
}
- return getContextualTypeForObjectLiteralElement(node);
+ return getContextualTypeForObjectLiteralElement(node, contextFlags);
}
- function getContextualTypeForObjectLiteralElement(element) {
+ function getContextualTypeForObjectLiteralElement(element, contextFlags) {
var objectLiteral = element.parent;
- var type = getApparentTypeOfContextualType(objectLiteral);
+ var type = getApparentTypeOfContextualType(objectLiteral, contextFlags);
if (type) {
if (!hasNonBindableDynamicName(element)) {
// For a (non-symbol) computed property, there is no reason to look up the name
// in the type. It will just be "__computed", which does not appear in any
// SymbolTable.
- var symbolName_2 = getSymbolOfNode(element).escapedName;
- var propertyType = getTypeOfPropertyOfContextualType(type, symbolName_2);
+ var symbolName_3 = getSymbolOfNode(element).escapedName;
+ var propertyType = getTypeOfPropertyOfContextualType(type, symbolName_3);
if (propertyType) {
return propertyType;
}
@@ -47780,9 +48602,9 @@
|| getIteratedTypeOrElementType(arrayContextualType, /*errorNode*/ undefined, /*allowStringInput*/ false, /*allowAsyncIterables*/ false, /*checkAssignability*/ false));
}
// In a contextually typed conditional expression, the true/false expressions are contextually typed by the same type.
- function getContextualTypeForConditionalOperand(node) {
+ function getContextualTypeForConditionalOperand(node, contextFlags) {
var conditional = node.parent;
- return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional) : undefined;
+ return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional, contextFlags) : undefined;
}
function getContextualTypeForChildJsxExpression(node, child) {
var attributesType = getApparentTypeOfContextualType(node.openingElement.tagName);
@@ -47791,16 +48613,17 @@
if (!(attributesType && !isTypeAny(attributesType) && jsxChildrenPropertyName && jsxChildrenPropertyName !== "")) {
return undefined;
}
- var childIndex = node.children.indexOf(child);
+ var realChildren = getSemanticJsxChildren(node.children);
+ var childIndex = realChildren.indexOf(child);
var childFieldType = getTypeOfPropertyOfContextualType(attributesType, jsxChildrenPropertyName);
- return childFieldType && mapType(childFieldType, function (t) {
+ return childFieldType && (realChildren.length === 1 ? childFieldType : mapType(childFieldType, function (t) {
if (isArrayLikeType(t)) {
return getIndexedAccessType(t, getLiteralType(childIndex));
}
else {
return t;
}
- }, /*noReductions*/ true);
+ }, /*noReductions*/ true));
}
function getContextualTypeForJsxExpression(node) {
var exprParent = node.parent;
@@ -47834,30 +48657,30 @@
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
case 14 /* NoSubstitutionTemplateLiteral */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
- case 96 /* NullKeyword */:
- case 72 /* Identifier */:
- case 141 /* UndefinedKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
+ case 97 /* NullKeyword */:
+ case 73 /* Identifier */:
+ case 142 /* UndefinedKeyword */:
return true;
- case 189 /* PropertyAccessExpression */:
- case 195 /* ParenthesizedExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 196 /* ParenthesizedExpression */:
return isPossiblyDiscriminantValue(node.expression);
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return !node.expression || isPossiblyDiscriminantValue(node.expression);
}
return false;
}
function discriminateContextualTypeByObjectMembers(node, contextualType) {
- return discriminateTypeByDiscriminableItems(contextualType, ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 275 /* PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return checkExpression(prop.initializer); }, prop.symbol.escapedName]; }), isTypeAssignableTo, contextualType);
+ return discriminateTypeByDiscriminableItems(contextualType, ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 276 /* PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return checkExpression(prop.initializer); }, prop.symbol.escapedName]; }), isTypeAssignableTo, contextualType);
}
function discriminateContextualTypeByJSXAttributes(node, contextualType) {
- return discriminateTypeByDiscriminableItems(contextualType, ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 267 /* JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return checkExpression(prop.initializer); }), prop.symbol.escapedName]; }), isTypeAssignableTo, contextualType);
+ return discriminateTypeByDiscriminableItems(contextualType, ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 268 /* JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return checkExpression(prop.initializer); }), prop.symbol.escapedName]; }), isTypeAssignableTo, contextualType);
}
// Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily
// be "pushed" onto a node using the contextualType property.
- function getApparentTypeOfContextualType(node) {
- var contextualType = instantiateContextualType(getContextualType(node), node);
+ function getApparentTypeOfContextualType(node, contextFlags) {
+ var contextualType = instantiateContextualType(getContextualType(node, contextFlags), node, contextFlags);
if (contextualType) {
var apparentType = mapType(contextualType, getApparentType, /*noReductions*/ true);
if (apparentType.flags & 1048576 /* Union */) {
@@ -47873,13 +48696,24 @@
}
// If the given contextual type contains instantiable types and if a mapper representing
// return type inferences is available, instantiate those types using that mapper.
- function instantiateContextualType(contextualType, node) {
+ function instantiateContextualType(contextualType, node, contextFlags) {
if (contextualType && maybeTypeOfKind(contextualType, 63176704 /* Instantiable */)) {
var inferenceContext = getInferenceContext(node);
- if (inferenceContext && inferenceContext.returnMapper) {
+ // If no inferences have been made, nothing is gained from instantiating as type parameters
+ // would just be replaced with their defaults similar to the apparent type.
+ if (inferenceContext && ts.some(inferenceContext.inferences, hasInferenceCandidates)) {
+ // For contextual signatures we incorporate all inferences made so far, e.g. from return
+ // types as well as arguments to the left in a function call.
+ if (contextFlags && contextFlags & 1 /* Signature */) {
+ return instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper);
+ }
+ // For other purposes (e.g. determining whether to produce literal types) we only
+ // incorporate inferences made from the return type in a function call.
+ if (inferenceContext.returnMapper) {
return instantiateInstantiableTypes(contextualType, inferenceContext.returnMapper);
}
}
+ }
return contextualType;
}
// This function is similar to instantiateType, except that (a) it only instantiates types that
@@ -47914,7 +48748,7 @@
* @param node the expression whose contextual type will be returned.
* @returns the contextual type of an expression.
*/
- function getContextualType(node) {
+ function getContextualType(node, contextFlags) {
if (node.flags & 8388608 /* InWithStatement */) {
// We cannot answer semantic questions within a with block, do not proceed any further
return undefined;
@@ -47924,54 +48758,54 @@
}
var parent = node.parent;
switch (parent.kind) {
- case 237 /* VariableDeclaration */:
- case 151 /* Parameter */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 186 /* BindingElement */:
+ case 238 /* VariableDeclaration */:
+ case 152 /* Parameter */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 187 /* BindingElement */:
return getContextualTypeForInitializerExpression(node);
- case 197 /* ArrowFunction */:
- case 230 /* ReturnStatement */:
+ case 198 /* ArrowFunction */:
+ case 231 /* ReturnStatement */:
return getContextualTypeForReturnExpression(node);
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return getContextualTypeForYieldOperand(parent);
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
return getContextualTypeForAwaitOperand(parent);
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
return getContextualTypeForArgument(parent, node);
- case 194 /* TypeAssertionExpression */:
- case 212 /* AsExpression */:
+ case 195 /* TypeAssertionExpression */:
+ case 213 /* AsExpression */:
return ts.isConstTypeReference(parent.type) ? undefined : getTypeFromTypeNode(parent.type);
- case 204 /* BinaryExpression */:
- return getContextualTypeForBinaryOperand(node);
- case 275 /* PropertyAssignment */:
- case 276 /* ShorthandPropertyAssignment */:
- return getContextualTypeForObjectLiteralElement(parent);
- case 277 /* SpreadAssignment */:
- return getApparentTypeOfContextualType(parent.parent);
- case 187 /* ArrayLiteralExpression */: {
+ case 205 /* BinaryExpression */:
+ return getContextualTypeForBinaryOperand(node, contextFlags);
+ case 276 /* PropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
+ return getContextualTypeForObjectLiteralElement(parent, contextFlags);
+ case 278 /* SpreadAssignment */:
+ return getApparentTypeOfContextualType(parent.parent, contextFlags);
+ case 188 /* ArrayLiteralExpression */: {
var arrayLiteral = parent;
- var type = getApparentTypeOfContextualType(arrayLiteral);
+ var type = getApparentTypeOfContextualType(arrayLiteral, contextFlags);
return getContextualTypeForElementExpression(type, ts.indexOfNode(arrayLiteral.elements, node));
}
- case 205 /* ConditionalExpression */:
- return getContextualTypeForConditionalOperand(node);
- case 216 /* TemplateSpan */:
- ts.Debug.assert(parent.parent.kind === 206 /* TemplateExpression */);
+ case 206 /* ConditionalExpression */:
+ return getContextualTypeForConditionalOperand(node, contextFlags);
+ case 217 /* TemplateSpan */:
+ ts.Debug.assert(parent.parent.kind === 207 /* TemplateExpression */);
return getContextualTypeForSubstitutionExpression(parent.parent, node);
- case 195 /* ParenthesizedExpression */: {
+ case 196 /* ParenthesizedExpression */: {
// Like in `checkParenthesizedExpression`, an `/** @type {xyz} */` comment before a parenthesized expression acts as a type cast.
var tag = ts.isInJSFile(parent) ? ts.getJSDocTypeTag(parent) : undefined;
- return tag ? getTypeFromTypeNode(tag.typeExpression.type) : getContextualType(parent);
+ return tag ? getTypeFromTypeNode(tag.typeExpression.type) : getContextualType(parent, contextFlags);
}
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return getContextualTypeForJsxExpression(parent);
- case 267 /* JsxAttribute */:
- case 269 /* JsxSpreadAttribute */:
+ case 268 /* JsxAttribute */:
+ case 270 /* JsxSpreadAttribute */:
return getContextualTypeForJsxAttribute(parent);
- case 262 /* JsxOpeningElement */:
- case 261 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
+ case 262 /* JsxSelfClosingElement */:
return getContextualJsxElementAttributesType(parent);
}
return undefined;
@@ -47993,7 +48827,7 @@
return getJsxReferenceKind(node) !== 0 /* Component */ ? getJsxPropsTypeFromCallSignature(signature, node) : getJsxPropsTypeFromClassType(signature, node);
}
function getJsxPropsTypeFromCallSignature(sig, context) {
- var propsType = getTypeOfFirstParameterOfSignatureWithFallback(sig, emptyObjectType);
+ var propsType = getTypeOfFirstParameterOfSignatureWithFallback(sig, unknownType);
propsType = getJsxManagedAttributesFromLocatedAttributes(context, getJsxNamespaceAt(context), propsType);
var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context);
if (intrinsicAttribs !== errorType) {
@@ -48064,7 +48898,7 @@
var forcedLookupLocation = getJsxElementPropertiesName(ns);
var attributesType = forcedLookupLocation === undefined
// If there is no type ElementAttributesProperty, return the type of the first parameter of the signature, which should be the props type
- ? getTypeOfFirstParameterOfSignatureWithFallback(sig, emptyObjectType)
+ ? getTypeOfFirstParameterOfSignatureWithFallback(sig, unknownType)
: forcedLookupLocation === ""
// If there is no e.g. 'props' member in ElementAttributesProperty, use the element class type instead
? getReturnTypeOfSignature(sig)
@@ -48075,7 +48909,7 @@
if (!!forcedLookupLocation && !!ts.length(context.attributes.properties)) {
error(context, ts.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, ts.unescapeLeadingUnderscores(forcedLookupLocation));
}
- return emptyObjectType;
+ return unknownType;
}
attributesType = getJsxManagedAttributesFromLocatedAttributes(context, ns, attributesType);
if (isTypeAny(attributesType)) {
@@ -48126,7 +48960,7 @@
return !hasEffectiveRestParameter(signature) && getParameterCount(signature) < targetParameterCount;
}
function isFunctionExpressionOrArrowFunction(node) {
- return node.kind === 196 /* FunctionExpression */ || node.kind === 197 /* ArrowFunction */;
+ return node.kind === 197 /* FunctionExpression */ || node.kind === 198 /* ArrowFunction */;
}
function getContextualSignatureForFunctionLikeDeclaration(node) {
// Only function expressions, arrow functions, and object literal methods are contextually typed.
@@ -48134,23 +48968,20 @@
? getContextualSignature(node)
: undefined;
}
- function getContextualTypeForFunctionLikeDeclaration(node) {
- return ts.isObjectLiteralMethod(node) ?
- getContextualTypeForObjectLiteralMethod(node) :
- getApparentTypeOfContextualType(node);
- }
// Return the contextual signature for a given expression node. A contextual type provides a
// contextual signature if it has a single call signature and if that call signature is non-generic.
// If the contextual type is a union type, get the signature from each type possible and if they are
// all identical ignoring their return type, the result is same signature but with return type as
// union type of return types from these signatures
function getContextualSignature(node) {
- ts.Debug.assert(node.kind !== 156 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
+ ts.Debug.assert(node.kind !== 157 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
var typeTagSignature = getSignatureOfTypeTag(node);
if (typeTagSignature) {
return typeTagSignature;
}
- var type = getContextualTypeForFunctionLikeDeclaration(node);
+ var type = ts.isObjectLiteralMethod(node) ?
+ getContextualTypeForObjectLiteralMethod(node, 1 /* Signature */) :
+ getApparentTypeOfContextualType(node, 1 /* Signature */);
if (!type) {
return undefined;
}
@@ -48159,8 +48990,8 @@
}
var signatureList;
var types = type.types;
- for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
- var current = types_15[_i];
+ for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
+ var current = types_14[_i];
var signature = getContextualCallSignature(current, node);
if (signature) {
if (!signatureList) {
@@ -48188,8 +49019,8 @@
return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false, /*allowAsyncIterables*/ false);
}
function hasDefaultValue(node) {
- return (node.kind === 186 /* BindingElement */ && !!node.initializer) ||
- (node.kind === 204 /* BinaryExpression */ && node.operatorToken.kind === 59 /* EqualsToken */);
+ return (node.kind === 187 /* BindingElement */ && !!node.initializer) ||
+ (node.kind === 205 /* BinaryExpression */ && node.operatorToken.kind === 60 /* EqualsToken */);
}
function checkArrayLiteral(node, checkMode, forceTuple) {
var elements = node.elements;
@@ -48201,7 +49032,7 @@
var inConstContext = isConstContext(node);
for (var index = 0; index < elementCount; index++) {
var e = elements[index];
- if (inDestructuringPattern && e.kind === 208 /* SpreadElement */) {
+ if (inDestructuringPattern && e.kind === 209 /* SpreadElement */) {
// Given the following situation:
// var c: {};
// [...c] = ["", 0];
@@ -48226,12 +49057,12 @@
var type = checkExpressionForMutableLocation(e, checkMode, elementContextualType, forceTuple);
elementTypes.push(type);
}
- if (index < elementCount - 1 && e.kind === 208 /* SpreadElement */) {
+ if (index < elementCount - 1 && e.kind === 209 /* SpreadElement */) {
hasNonEndingSpreadElement = true;
}
}
if (!hasNonEndingSpreadElement) {
- var hasRestElement = elementCount > 0 && elements[elementCount - 1].kind === 208 /* SpreadElement */;
+ var hasRestElement = elementCount > 0 && elements[elementCount - 1].kind === 209 /* SpreadElement */;
var minLength = elementCount - (hasRestElement ? 1 : 0);
// If array literal is actually a destructuring pattern, mark it as an implied type. We do this such
// that we get the same behavior for "var [x, y] = []" and "[x, y] = []".
@@ -48261,15 +49092,15 @@
var pattern = contextualType && contextualType.pattern;
// If array literal is contextually typed by a binding pattern or an assignment pattern, pad the resulting
// tuple type with the corresponding binding or assignment element types to make the lengths equal.
- if (!hasRestElement && pattern && (pattern.kind === 185 /* ArrayBindingPattern */ || pattern.kind === 187 /* ArrayLiteralExpression */)) {
+ if (!hasRestElement && pattern && (pattern.kind === 186 /* ArrayBindingPattern */ || pattern.kind === 188 /* ArrayLiteralExpression */)) {
var patternElements = pattern.elements;
for (var i = elementCount; i < patternElements.length; i++) {
var e = patternElements[i];
if (hasDefaultValue(e)) {
elementTypes.push(contextualType.typeArguments[i]);
}
- else if (i < patternElements.length - 1 || !(e.kind === 186 /* BindingElement */ && e.dotDotDotToken || e.kind === 208 /* SpreadElement */)) {
- if (e.kind !== 210 /* OmittedExpression */) {
+ else if (i < patternElements.length - 1 || !(e.kind === 187 /* BindingElement */ && e.dotDotDotToken || e.kind === 209 /* SpreadElement */)) {
+ if (e.kind !== 211 /* OmittedExpression */) {
error(e, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value);
}
elementTypes.push(strictNullChecks ? implicitNeverType : undefinedWideningType);
@@ -48281,9 +49112,9 @@
}
function isNumericName(name) {
switch (name.kind) {
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
return isNumericComputedName(name);
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return isNumericLiteralName(name.escapedText);
case 8 /* NumericLiteral */:
case 10 /* StringLiteral */:
@@ -48371,7 +49202,7 @@
var spread = emptyObjectType;
var contextualType = getApparentTypeOfContextualType(node);
var contextualTypeHasPattern = contextualType && contextualType.pattern &&
- (contextualType.pattern.kind === 184 /* ObjectBindingPattern */ || contextualType.pattern.kind === 188 /* ObjectLiteralExpression */);
+ (contextualType.pattern.kind === 185 /* ObjectBindingPattern */ || contextualType.pattern.kind === 189 /* ObjectLiteralExpression */);
var inConstContext = isConstContext(node);
var checkFlags = inConstContext ? 8 /* Readonly */ : 0;
var isInJavascript = ts.isInJSFile(node) && !ts.isInJsonFile(node);
@@ -48386,13 +49217,13 @@
for (var i = 0; i < node.properties.length; i++) {
var memberDecl = node.properties[i];
var member = getSymbolOfNode(memberDecl);
- var computedNameType = memberDecl.name && memberDecl.name.kind === 149 /* ComputedPropertyName */ && !ts.isWellKnownSymbolSyntactically(memberDecl.name.expression) ?
+ var computedNameType = memberDecl.name && memberDecl.name.kind === 150 /* ComputedPropertyName */ && !ts.isWellKnownSymbolSyntactically(memberDecl.name.expression) ?
checkComputedPropertyName(memberDecl.name) : undefined;
- if (memberDecl.kind === 275 /* PropertyAssignment */ ||
- memberDecl.kind === 276 /* ShorthandPropertyAssignment */ ||
+ if (memberDecl.kind === 276 /* PropertyAssignment */ ||
+ memberDecl.kind === 277 /* ShorthandPropertyAssignment */ ||
ts.isObjectLiteralMethod(memberDecl)) {
- var type = memberDecl.kind === 275 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) :
- memberDecl.kind === 276 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(memberDecl.name, checkMode) :
+ var type = memberDecl.kind === 276 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) :
+ memberDecl.kind === 277 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(memberDecl.name, checkMode) :
checkObjectLiteralMethod(memberDecl, checkMode);
if (isInJavascript) {
var jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl);
@@ -48407,7 +49238,7 @@
objectFlags |= ts.getObjectFlags(type) & 917504 /* PropagatingFlags */;
var nameType = computedNameType && isTypeUsableAsPropertyName(computedNameType) ? computedNameType : undefined;
var prop = nameType ?
- createSymbol(4 /* Property */ | member.flags, getPropertyNameFromType(nameType), checkFlags | 2048 /* Late */) :
+ createSymbol(4 /* Property */ | member.flags, getPropertyNameFromType(nameType), checkFlags | 4096 /* Late */) :
createSymbol(4 /* Property */ | member.flags, member.escapedName, checkFlags);
if (nameType) {
prop.nameType = nameType;
@@ -48415,8 +49246,8 @@
if (inDestructuringPattern) {
// If object literal is an assignment pattern and if the assignment pattern specifies a default value
// for the property, make the property optional.
- var isOptional = (memberDecl.kind === 275 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) ||
- (memberDecl.kind === 276 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer);
+ var isOptional = (memberDecl.kind === 276 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) ||
+ (memberDecl.kind === 277 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer);
if (isOptional) {
prop.flags |= 16777216 /* Optional */;
}
@@ -48441,7 +49272,7 @@
prop.target = member;
member = prop;
}
- else if (memberDecl.kind === 277 /* SpreadAssignment */) {
+ else if (memberDecl.kind === 278 /* SpreadAssignment */) {
if (languageVersion < 2 /* ES2015 */) {
checkExternalEmitHelpers(memberDecl, 2 /* Assign */);
}
@@ -48467,7 +49298,7 @@
// an ordinary function declaration(section 6.1) with no parameters.
// A set accessor declaration is processed in the same manner
// as an ordinary function declaration with a single parameter and a Void return type.
- ts.Debug.assert(memberDecl.kind === 158 /* GetAccessor */ || memberDecl.kind === 159 /* SetAccessor */);
+ ts.Debug.assert(memberDecl.kind === 159 /* GetAccessor */ || memberDecl.kind === 160 /* SetAccessor */);
checkNodeDeferred(memberDecl);
}
if (computedNameType && !(computedNameType.flags & 8576 /* StringOrNumberLiteralOrUnique */)) {
@@ -48575,7 +49406,7 @@
* Returns true iff React would emit this tag name as a string rather than an identifier or qualified name
*/
function isJsxIntrinsicIdentifier(tagName) {
- return tagName.kind === 72 /* Identifier */ && ts.isIntrinsicJsxName(tagName.escapedText);
+ return tagName.kind === 73 /* Identifier */ && ts.isIntrinsicJsxName(tagName.escapedText);
}
function checkJsxAttribute(node, checkMode) {
return node.initializer
@@ -48620,7 +49451,7 @@
}
}
else {
- ts.Debug.assert(attributeDecl.kind === 269 /* JsxSpreadAttribute */);
+ ts.Debug.assert(attributeDecl.kind === 270 /* JsxSpreadAttribute */);
if (attributesTable.size > 0) {
spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, objectFlags, /*readonly*/ false);
attributesTable = ts.createSymbolTable();
@@ -48643,7 +49474,7 @@
}
}
// Handle children attribute
- var parent = openingLikeElement.parent.kind === 260 /* JsxElement */ ? openingLikeElement.parent : undefined;
+ var parent = openingLikeElement.parent.kind === 261 /* JsxElement */ ? openingLikeElement.parent : undefined;
// We have to check that openingElement of the parent is the one we are visiting as this may not be true for selfClosingElement
if (parent && parent.openingElement === openingLikeElement && parent.children.length > 0) {
var childrenTypes = checkJsxChildren(parent, checkMode);
@@ -49061,8 +49892,8 @@
*/
function checkPropertyAccessibility(node, isSuper, type, prop) {
var flags = ts.getDeclarationModifierFlagsFromSymbol(prop);
- var errorNode = node.kind === 148 /* QualifiedName */ ? node.right : node.kind === 183 /* ImportType */ ? node : node.name;
- if (ts.getCheckFlags(prop) & 512 /* ContainsPrivate */) {
+ var errorNode = node.kind === 149 /* QualifiedName */ ? node.right : node.kind === 184 /* ImportType */ ? node : node.name;
+ if (ts.getCheckFlags(prop) & 1024 /* ContainsPrivate */) {
// Synthetic property with private constituent property
error(errorNode, ts.Diagnostics.Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1, symbolToString(prop), typeToString(type));
return false;
@@ -49167,7 +49998,7 @@
return type;
}
function checkNonNullType(type, node, nullDiagnostic, undefinedDiagnostic, nullOrUndefinedDiagnostic) {
- if (type.flags & 2 /* Unknown */) {
+ if (strictNullChecks && type.flags & 2 /* Unknown */) {
error(node, ts.Diagnostics.Object_is_of_type_unknown);
return errorType;
}
@@ -49182,6 +50013,13 @@
}
return type;
}
+ function checkNonNullNonVoidType(type, node) {
+ var nonNullType = checkNonNullType(type, node);
+ if (nonNullType !== errorType && nonNullType.flags & 16384 /* Void */) {
+ error(node, ts.Diagnostics.Object_is_possibly_undefined);
+ }
+ return nonNullType;
+ }
function checkPropertyAccessExpression(node) {
return checkPropertyAccessExpressionOrQualifiedName(node, node.expression, node.name);
}
@@ -49205,7 +50043,7 @@
markAliasReferenced(parentSymbol, node);
}
if (!prop) {
- var indexInfo = getIndexInfoOfType(apparentType, 0 /* String */);
+ var indexInfo = assignmentKind === 0 /* None */ || !isGenericObjectType(leftType) ? getIndexInfoOfType(apparentType, 0 /* String */) : undefined;
if (!(indexInfo && indexInfo.type)) {
if (isJSLiteralType(leftType)) {
return anyType;
@@ -49220,7 +50058,7 @@
return anyType;
}
if (right.escapedText && !checkAndReportErrorForExtendingInterface(node)) {
- reportNonexistentProperty(right, leftType.flags & 262144 /* TypeParameter */ && leftType.isThisType ? apparentType : leftType);
+ reportNonexistentProperty(right, isThisTypeParameter(leftType) ? apparentType : leftType);
}
return errorType;
}
@@ -49231,9 +50069,9 @@
}
else {
checkPropertyNotUsedBeforeDeclaration(prop, node, right);
- markPropertyAsReferenced(prop, node, left.kind === 100 /* ThisKeyword */);
+ markPropertyAsReferenced(prop, node, left.kind === 101 /* ThisKeyword */);
getNodeLinks(node).resolvedSymbol = prop;
- checkPropertyAccessibility(node, left.kind === 98 /* SuperKeyword */, apparentType, prop);
+ checkPropertyAccessibility(node, left.kind === 99 /* SuperKeyword */, apparentType, prop);
if (assignmentKind) {
if (isReferenceToReadonlyEntity(node, prop) || isReferenceThroughNamespaceImport(node)) {
error(right, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, ts.idText(right));
@@ -49245,7 +50083,7 @@
// Only compute control flow type if this is a property access expression that isn't an
// assignment target, and the referenced property was declared as a variable, property,
// accessor, or optional method.
- if (node.kind !== 189 /* PropertyAccessExpression */ ||
+ if (node.kind !== 190 /* PropertyAccessExpression */ ||
assignmentKind === 1 /* Definite */ ||
prop && !(prop.flags & (3 /* Variable */ | 4 /* Property */ | 98304 /* Accessor */)) && !(prop.flags & 8192 /* Method */ && propType.flags & 1048576 /* Union */)) {
return propType;
@@ -49255,11 +50093,11 @@
// and if we are in a constructor of the same class as the property declaration, assume that
// the property is uninitialized at the top of the control flow.
var assumeUninitialized = false;
- if (strictNullChecks && strictPropertyInitialization && left.kind === 100 /* ThisKeyword */) {
+ if (strictNullChecks && strictPropertyInitialization && left.kind === 101 /* ThisKeyword */) {
var declaration = prop && prop.valueDeclaration;
if (declaration && isInstancePropertyWithoutInitializer(declaration)) {
var flowContainer = getControlFlowContainer(node);
- if (flowContainer.kind === 157 /* Constructor */ && flowContainer.parent === declaration.parent) {
+ if (flowContainer.kind === 158 /* Constructor */ && flowContainer.parent === declaration.parent) {
assumeUninitialized = true;
}
}
@@ -49290,8 +50128,8 @@
&& !isPropertyDeclaredInAncestorClass(prop)) {
diagnosticMessage = error(right, ts.Diagnostics.Property_0_is_used_before_its_initialization, declarationName);
}
- else if (valueDeclaration.kind === 240 /* ClassDeclaration */ &&
- node.parent.kind !== 164 /* TypeReference */ &&
+ else if (valueDeclaration.kind === 241 /* ClassDeclaration */ &&
+ node.parent.kind !== 165 /* TypeReference */ &&
!(valueDeclaration.flags & 4194304 /* Ambient */) &&
!isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) {
diagnosticMessage = error(right, ts.Diagnostics.Class_0_used_before_its_declaration, declarationName);
@@ -49303,22 +50141,22 @@
function isInPropertyInitializer(node) {
return !!ts.findAncestor(node, function (node) {
switch (node.kind) {
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return true;
- case 275 /* PropertyAssignment */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 277 /* SpreadAssignment */:
- case 149 /* ComputedPropertyName */:
- case 216 /* TemplateSpan */:
- case 270 /* JsxExpression */:
- case 267 /* JsxAttribute */:
- case 268 /* JsxAttributes */:
- case 269 /* JsxSpreadAttribute */:
- case 262 /* JsxOpeningElement */:
- case 211 /* ExpressionWithTypeArguments */:
- case 273 /* HeritageClause */:
+ case 276 /* PropertyAssignment */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 278 /* SpreadAssignment */:
+ case 150 /* ComputedPropertyName */:
+ case 217 /* TemplateSpan */:
+ case 271 /* JsxExpression */:
+ case 268 /* JsxAttribute */:
+ case 269 /* JsxAttributes */:
+ case 270 /* JsxSpreadAttribute */:
+ case 263 /* JsxOpeningElement */:
+ case 212 /* ExpressionWithTypeArguments */:
+ case 274 /* HeritageClause */:
return false;
default:
return ts.isExpressionNode(node) ? false : "quit";
@@ -49424,6 +50262,32 @@
var suggestion = getSuggestedSymbolForNonexistentModule(name, targetModule);
return suggestion && ts.symbolName(suggestion);
}
+ function getSuggestionForNonexistentIndexSignature(objectType, expr) {
+ // check if object type has setter or getter
+ var hasProp = function (name, argCount) {
+ if (argCount === void 0) { argCount = 1; }
+ var prop = getPropertyOfObjectType(objectType, name);
+ if (prop) {
+ var s = getSingleCallSignature(getTypeOfSymbol(prop));
+ if (s && getMinArgumentCount(s) === argCount && typeToString(getTypeAtPosition(s, 0)) === "string") {
+ return true;
+ }
+ }
+ return false;
+ };
+ var suggestedMethod = ts.isAssignmentTarget(expr) ? "set" : "get";
+ if (!hasProp(suggestedMethod)) {
+ return undefined;
+ }
+ var suggestion = ts.tryGetPropertyAccessOrIdentifierToString(expr);
+ if (suggestion === undefined) {
+ suggestion = suggestedMethod;
+ }
+ else {
+ suggestion += "." + suggestedMethod;
+ }
+ return suggestion;
+ }
/**
* Given a name and a list of symbols whose names are *not* equal to the name, return a spelling suggestion if there is one that is close enough.
* Names less than length 3 only check for case-insensitive equality, not levenshtein distance.
@@ -49464,34 +50328,17 @@
}
function isValidPropertyAccess(node, propertyName) {
switch (node.kind) {
- case 189 /* PropertyAccessExpression */:
- return isValidPropertyAccessWithType(node, node.expression.kind === 98 /* SuperKeyword */, propertyName, getWidenedType(checkExpression(node.expression)));
- case 148 /* QualifiedName */:
+ case 190 /* PropertyAccessExpression */:
+ return isValidPropertyAccessWithType(node, node.expression.kind === 99 /* SuperKeyword */, propertyName, getWidenedType(checkExpression(node.expression)));
+ case 149 /* QualifiedName */:
return isValidPropertyAccessWithType(node, /*isSuper*/ false, propertyName, getWidenedType(checkExpression(node.left)));
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return isValidPropertyAccessWithType(node, /*isSuper*/ false, propertyName, getTypeFromTypeNode(node));
}
}
function isValidPropertyAccessForCompletions(node, type, property) {
- return isValidPropertyAccessWithType(node, node.kind === 189 /* PropertyAccessExpression */ && node.expression.kind === 98 /* SuperKeyword */, property.escapedName, type)
- && (!(property.flags & 8192 /* Method */) || isValidMethodAccess(property, type));
- }
- function isValidMethodAccess(method, actualThisType) {
- var propType = getTypeOfPropertyOfType(actualThisType, method.escapedName);
- var signatures = getSignaturesOfType(getNonNullableType(propType), 0 /* Call */);
- ts.Debug.assert(signatures.length !== 0);
- return signatures.some(function (sig) {
- var signatureThisType = getThisTypeOfSignature(sig);
- return !signatureThisType || isTypeAssignableTo(actualThisType, getInstantiatedSignatureThisType(sig, signatureThisType, actualThisType));
- });
- }
- function getInstantiatedSignatureThisType(sig, signatureThisType, actualThisType) {
- if (!sig.typeParameters) {
- return signatureThisType;
- }
- var context = createInferenceContext(sig.typeParameters, sig, 0 /* None */);
- inferTypes(context.inferences, actualThisType, signatureThisType);
- return instantiateType(signatureThisType, createSignatureTypeMapper(sig, getInferredTypes(context)));
+ return isValidPropertyAccessWithType(node, node.kind === 190 /* PropertyAccessExpression */ && node.expression.kind === 99 /* SuperKeyword */, property.escapedName, type);
+ // Previously we validated the 'this' type of methods but this adversely affected performance. See #31377 for more context.
}
function isValidPropertyAccessWithType(node, isSuper, propertyName, type) {
if (type === errorType || isTypeAny(type)) {
@@ -49507,13 +50354,13 @@
*/
function getForInVariableSymbol(node) {
var initializer = node.initializer;
- if (initializer.kind === 238 /* VariableDeclarationList */) {
+ if (initializer.kind === 239 /* VariableDeclarationList */) {
var variable = initializer.declarations[0];
if (variable && !ts.isBindingPattern(variable.name)) {
return getSymbolOfNode(variable);
}
}
- else if (initializer.kind === 72 /* Identifier */) {
+ else if (initializer.kind === 73 /* Identifier */) {
return getResolvedSymbol(initializer);
}
return undefined;
@@ -49530,13 +50377,13 @@
*/
function isForInVariableForNumericPropertyNames(expr) {
var e = ts.skipParentheses(expr);
- if (e.kind === 72 /* Identifier */) {
+ if (e.kind === 73 /* Identifier */) {
var symbol = getResolvedSymbol(e);
if (symbol.flags & 3 /* Variable */) {
var child = expr;
var node = expr.parent;
while (node) {
- if (node.kind === 226 /* ForInStatement */ &&
+ if (node.kind === 227 /* ForInStatement */ &&
child === node.statement &&
getForInVariableSymbol(node) === symbol &&
hasNumericPropertyNames(getTypeOfExpression(node.expression))) {
@@ -49554,7 +50401,7 @@
var indexExpression = node.argumentExpression;
if (!indexExpression) {
var sourceFile = ts.getSourceFileOfNode(node);
- if (node.parent.kind === 192 /* NewExpression */ && node.parent.expression === node) {
+ if (node.parent.kind === 193 /* NewExpression */ && node.parent.expression === node) {
var start = ts.skipTrivia(sourceFile.text, node.expression.end);
var end = node.end;
grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead);
@@ -49574,7 +50421,12 @@
error(indexExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal);
return errorType;
}
- return checkIndexedAccessIndexType(getIndexedAccessType(objectType, isForInVariableForNumericPropertyNames(indexExpression) ? numberType : indexType, node), node);
+ var effectiveIndexType = isForInVariableForNumericPropertyNames(indexExpression) ? numberType : indexType;
+ var accessFlags = ts.isAssignmentTarget(node) ?
+ 2 /* Writing */ | (isGenericObjectType(objectType) && !isThisTypeParameter(objectType) ? 1 /* NoIndexSignatures */ : 0) :
+ 0 /* None */;
+ var indexedAccessType = getIndexedAccessTypeOrUndefined(objectType, effectiveIndexType, node, accessFlags) || errorType;
+ return checkIndexedAccessIndexType(indexedAccessType, node);
}
function checkThatExpressionIsProperSymbolReference(expression, expressionType, reportError) {
if (expressionType === errorType) {
@@ -49620,13 +50472,13 @@
// This gets us diagnostics for the type arguments and marks them as referenced.
ts.forEach(node.typeArguments, checkSourceElement);
}
- if (node.kind === 193 /* TaggedTemplateExpression */) {
+ if (node.kind === 194 /* TaggedTemplateExpression */) {
checkExpression(node.template);
}
else if (ts.isJsxOpeningLikeElement(node)) {
checkExpression(node.attributes);
}
- else if (node.kind !== 152 /* Decorator */) {
+ else if (node.kind !== 153 /* Decorator */) {
ts.forEach(node.arguments, function (argument) {
checkExpression(argument);
});
@@ -49690,7 +50542,7 @@
}
}
function isSpreadArgument(arg) {
- return !!arg && (arg.kind === 208 /* SpreadElement */ || arg.kind === 215 /* SyntheticExpression */ && arg.isSpread);
+ return !!arg && (arg.kind === 209 /* SpreadElement */ || arg.kind === 216 /* SyntheticExpression */ && arg.isSpread);
}
function getSpreadArgumentIndex(args) {
return ts.findIndex(args, isSpreadArgument);
@@ -49704,9 +50556,9 @@
var callIsIncomplete = false; // In incomplete call we want to be lenient when we have too few arguments
var effectiveParameterCount = getParameterCount(signature);
var effectiveMinimumArguments = getMinArgumentCount(signature);
- if (node.kind === 193 /* TaggedTemplateExpression */) {
+ if (node.kind === 194 /* TaggedTemplateExpression */) {
argCount = args.length;
- if (node.template.kind === 206 /* TemplateExpression */) {
+ if (node.template.kind === 207 /* TemplateExpression */) {
// If a tagged template expression lacks a tail literal, the call is incomplete.
// Specifically, a template only can end in a TemplateTail or a Missing literal.
var lastSpan = ts.last(node.template.templateSpans); // we should always have at least one span.
@@ -49721,7 +50573,7 @@
callIsIncomplete = !!templateLiteral.isUnterminated;
}
}
- else if (node.kind === 152 /* Decorator */) {
+ else if (node.kind === 153 /* Decorator */) {
argCount = getDecoratorArgumentCount(node, signature);
}
else if (ts.isJsxOpeningLikeElement(node)) {
@@ -49736,7 +50588,7 @@
else {
if (!node.arguments) {
// This only happens when we have something of the form: 'new C'
- ts.Debug.assert(node.kind === 192 /* NewExpression */);
+ ts.Debug.assert(node.kind === 193 /* NewExpression */);
return getMinArgumentCount(signature) === 0;
}
argCount = signatureHelpTrailingComma ? args.length + 1 : args.length;
@@ -49775,12 +50627,23 @@
}
// If type has a single call signature and no other members, return that signature. Otherwise, return undefined.
function getSingleCallSignature(type) {
+ return getSingleSignature(type, 0 /* Call */, /*allowMembers*/ false);
+ }
+ function getSingleCallOrConstructSignature(type) {
+ return getSingleSignature(type, 0 /* Call */, /*allowMembers*/ false) ||
+ getSingleSignature(type, 1 /* Construct */, /*allowMembers*/ false);
+ }
+ function getSingleSignature(type, kind, allowMembers) {
if (type.flags & 524288 /* Object */) {
var resolved = resolveStructuredTypeMembers(type);
- if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 &&
- resolved.properties.length === 0 && !resolved.stringIndexInfo && !resolved.numberIndexInfo) {
+ if (allowMembers || resolved.properties.length === 0 && !resolved.stringIndexInfo && !resolved.numberIndexInfo) {
+ if (kind === 0 /* Call */ && resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0) {
return resolved.callSignatures[0];
}
+ if (kind === 1 /* Construct */ && resolved.constructSignatures.length === 1 && resolved.callSignatures.length === 0) {
+ return resolved.constructSignatures[0];
+ }
+ }
}
return undefined;
}
@@ -49799,7 +50662,7 @@
});
if (!inferenceContext) {
applyToReturnTypes(contextualSignature, signature, function (source, target) {
- inferTypes(context.inferences, source, target, 8 /* ReturnType */);
+ inferTypes(context.inferences, source, target, 16 /* ReturnType */);
});
}
return getSignatureInstantiation(signature, getInferredTypes(context), ts.isInJSFile(contextualSignature.declaration));
@@ -49818,7 +50681,7 @@
// example, given a 'function wrap<T, U>(cb: (x: T) => U): (x: T) => U' and a call expression
// 'let f: (x: string) => number = wrap(s => s.length)', we infer from the declared type of 'f' to the
// return type of 'wrap'.
- if (node.kind !== 152 /* Decorator */) {
+ if (node.kind !== 153 /* Decorator */) {
var contextualType = getContextualType(node);
if (contextualType) {
// We clone the inference context to avoid disturbing a resolution in progress for an
@@ -49839,7 +50702,7 @@
instantiatedType;
var inferenceTargetType = getReturnTypeOfSignature(signature);
// Inferences made from return types have lower priority than all other inferences.
- inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 8 /* ReturnType */);
+ inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 16 /* ReturnType */);
// Create a type mapper for instantiating generic contextual types using the inferences made
// from the return type.
context.returnMapper = getMapperFromContext(cloneInferredPartOfContext(context));
@@ -49855,7 +50718,7 @@
var argCount = restType ? Math.min(getParameterCount(signature) - 1, args.length) : args.length;
for (var i = 0; i < argCount; i++) {
var arg = args[i];
- if (arg.kind !== 210 /* OmittedExpression */) {
+ if (arg.kind !== 211 /* OmittedExpression */) {
var paramType = getTypeAtPosition(signature, i);
var argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
inferTypes(context.inferences, argType, paramType);
@@ -49869,7 +50732,7 @@
}
function getArrayifiedType(type) {
if (forEachType(type, function (t) { return !(t.flags & (1 /* Any */ | 63176704 /* Instantiable */) || isArrayType(t) || isTupleType(t)); })) {
- return createArrayType(getIndexTypeOfType(type, 1 /* Number */) || errorType);
+ return createArrayType(getIndexedAccessType(type, numberType));
}
return type;
}
@@ -49879,20 +50742,20 @@
if (isSpreadArgument(arg)) {
// We are inferring from a spread expression in the last argument position, i.e. both the parameter
// and the argument are ...x forms.
- return arg.kind === 215 /* SyntheticExpression */ ?
+ return arg.kind === 216 /* SyntheticExpression */ ?
createArrayType(arg.type) :
getArrayifiedType(checkExpressionWithContextualType(arg.expression, restType, context, 0 /* Normal */));
}
}
- var contextualType = getIndexTypeOfType(restType, 1 /* Number */) || anyType;
- var hasPrimitiveContextualType = maybeTypeOfKind(contextualType, 131068 /* Primitive */ | 4194304 /* Index */);
var types = [];
var spreadIndex = -1;
for (var i = index; i < argCount; i++) {
+ var contextualType = getIndexedAccessType(restType, getLiteralType(i - index));
var argType = checkExpressionWithContextualType(args[i], contextualType, context, 0 /* Normal */);
if (spreadIndex < 0 && isSpreadArgument(args[i])) {
spreadIndex = i - index;
}
+ var hasPrimitiveContextualType = maybeTypeOfKind(contextualType, 131068 /* Primitive */ | 4194304 /* Index */);
types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType));
}
return spreadIndex < 0 ?
@@ -49953,7 +50816,7 @@
return checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation, checkMode, reportErrors);
}
var thisType = getThisTypeOfSignature(signature);
- if (thisType && thisType !== voidType && node.kind !== 192 /* NewExpression */) {
+ if (thisType && thisType !== voidType && node.kind !== 193 /* NewExpression */) {
// If the called expression is not of the form `x.f` or `x["f"]`, then sourceType = voidType
// If the signature's 'this' type is voidType, then the check is skipped -- anything is compatible.
// If the expression is a new expression, then the check is skipped.
@@ -49970,7 +50833,7 @@
var argCount = restType ? Math.min(getParameterCount(signature) - 1, args.length) : args.length;
for (var i = 0; i < argCount; i++) {
var arg = args[i];
- if (arg.kind !== 210 /* OmittedExpression */) {
+ if (arg.kind !== 211 /* OmittedExpression */) {
var paramType = getTypeAtPosition(signature, i);
var argType = checkExpressionWithContextualType(arg, paramType, /*inferenceContext*/ undefined, checkMode);
// If one or more arguments are still excluded (as indicated by CheckMode.SkipContextSensitive),
@@ -49993,15 +50856,15 @@
* Returns the this argument in calls like x.f(...) and x[f](...). Undefined otherwise.
*/
function getThisArgumentOfCall(node) {
- if (node.kind === 191 /* CallExpression */) {
+ if (node.kind === 192 /* CallExpression */) {
var callee = ts.skipOuterExpressions(node.expression);
- if (callee.kind === 189 /* PropertyAccessExpression */ || callee.kind === 190 /* ElementAccessExpression */) {
+ if (callee.kind === 190 /* PropertyAccessExpression */ || callee.kind === 191 /* ElementAccessExpression */) {
return callee.expression;
}
}
}
function createSyntheticExpression(parent, type, isSpread) {
- var result = ts.createNode(215 /* SyntheticExpression */, parent.pos, parent.end);
+ var result = ts.createNode(216 /* SyntheticExpression */, parent.pos, parent.end);
result.parent = parent;
result.type = type;
result.isSpread = isSpread || false;
@@ -50011,17 +50874,17 @@
* Returns the effective arguments for an expression that works like a function invocation.
*/
function getEffectiveCallArguments(node) {
- if (node.kind === 193 /* TaggedTemplateExpression */) {
+ if (node.kind === 194 /* TaggedTemplateExpression */) {
var template = node.template;
- var args_4 = [createSyntheticExpression(template, getGlobalTemplateStringsArrayType())];
- if (template.kind === 206 /* TemplateExpression */) {
+ var args_3 = [createSyntheticExpression(template, getGlobalTemplateStringsArrayType())];
+ if (template.kind === 207 /* TemplateExpression */) {
ts.forEach(template.templateSpans, function (span) {
- args_4.push(span.expression);
+ args_3.push(span.expression);
});
}
- return args_4;
+ return args_3;
}
- if (node.kind === 152 /* Decorator */) {
+ if (node.kind === 153 /* Decorator */) {
return getEffectiveDecoratorArguments(node);
}
if (ts.isJsxOpeningLikeElement(node)) {
@@ -50034,7 +50897,7 @@
// of the argument is a tuple type, spread the tuple elements into the argument list. We can
// call checkExpressionCached because spread expressions never have a contextual type.
var spreadArgument_1 = args[length - 1];
- var type = checkExpressionCached(spreadArgument_1.expression);
+ var type = flowLoopCount ? checkExpression(spreadArgument_1.expression) : checkExpressionCached(spreadArgument_1.expression);
if (isTupleType(type)) {
var typeArguments = type.typeArguments || ts.emptyArray;
var restIndex_2 = type.target.hasRestElement ? typeArguments.length - 1 : -1;
@@ -50051,30 +50914,30 @@
var parent = node.parent;
var expr = node.expression;
switch (parent.kind) {
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
// For a class decorator, the `target` is the type of the class (e.g. the
// "static" or "constructor" side of the class).
return [
createSyntheticExpression(expr, getTypeOfSymbol(getSymbolOfNode(parent)))
];
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
// A parameter declaration decorator will have three arguments (see
// `ParameterDecorator` in core.d.ts).
var func = parent.parent;
return [
- createSyntheticExpression(expr, parent.parent.kind === 157 /* Constructor */ ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType),
+ createSyntheticExpression(expr, parent.parent.kind === 158 /* Constructor */ ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType),
createSyntheticExpression(expr, anyType),
createSyntheticExpression(expr, numberType)
];
- case 154 /* PropertyDeclaration */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 155 /* PropertyDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
// A method or accessor declaration decorator will have two or three arguments (see
// `PropertyDecorator` and `MethodDecorator` in core.d.ts). If we are emitting decorators
// for ES3, we will only pass two arguments.
- var hasPropDesc = parent.kind !== 154 /* PropertyDeclaration */ && languageVersion !== 0 /* ES3 */;
+ var hasPropDesc = parent.kind !== 155 /* PropertyDeclaration */ && languageVersion !== 0 /* ES3 */;
return [
createSyntheticExpression(expr, getParentTypeOfClassElement(parent)),
createSyntheticExpression(expr, getClassElementPropertyKeyType(parent)),
@@ -50088,17 +50951,17 @@
*/
function getDecoratorArgumentCount(node, signature) {
switch (node.parent.kind) {
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
return 1;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return 2;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
// For ES3 or decorators with only two parameters we supply only two arguments
return languageVersion === 0 /* ES3 */ || signature.parameters.length <= 2 ? 2 : 3;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return 3;
default:
return ts.Debug.fail();
@@ -50198,15 +51061,15 @@
return ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), typeArguments, ts.Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount);
}
function resolveCall(node, signatures, candidatesOutArray, checkMode, fallbackError) {
- var isTaggedTemplate = node.kind === 193 /* TaggedTemplateExpression */;
- var isDecorator = node.kind === 152 /* Decorator */;
+ var isTaggedTemplate = node.kind === 194 /* TaggedTemplateExpression */;
+ var isDecorator = node.kind === 153 /* Decorator */;
var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node);
var reportErrors = !candidatesOutArray;
var typeArguments;
if (!isDecorator) {
typeArguments = node.typeArguments;
// We already perform checking on the type arguments on the class declaration itself.
- if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 98 /* SuperKeyword */) {
+ if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 99 /* SuperKeyword */) {
ts.forEach(typeArguments, checkSourceElement);
}
}
@@ -50261,7 +51124,7 @@
var result;
// If we are in signature help, a trailing comma indicates that we intend to provide another argument,
// so we will only accept overloads with arity at least 1 higher than the current number of provided arguments.
- var signatureHelpTrailingComma = !!(checkMode & 16 /* IsForSignatureHelp */) && node.kind === 191 /* CallExpression */ && node.arguments.hasTrailingComma;
+ var signatureHelpTrailingComma = !!(checkMode & 16 /* IsForSignatureHelp */) && node.kind === 192 /* CallExpression */ && node.arguments.hasTrailingComma;
// Section 4.12.1:
// if the candidate list contains one or more signatures for which the type of each argument
// expression is a subtype of each corresponding parameter type, the return type of the first
@@ -50412,7 +51275,7 @@
}
var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
var parameters = [];
- var _loop_8 = function (i) {
+ var _loop_11 = function (i) {
var symbols = ts.mapDefined(candidates, function (_a) {
var parameters = _a.parameters, hasRestParameter = _a.hasRestParameter;
return hasRestParameter ?
@@ -50423,7 +51286,7 @@
parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
};
for (var i = 0; i < maxNonRestParam; i++) {
- _loop_8(i);
+ _loop_11(i);
}
var restParameterSymbols = ts.mapDefined(candidates, function (c) { return c.hasRestParameter ? ts.last(c.parameters) : undefined; });
var hasRestParameter = restParameterSymbols.length !== 0;
@@ -50501,7 +51364,7 @@
return maxParamsIndex;
}
function resolveCallExpression(node, candidatesOutArray, checkMode) {
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
var superType = checkSuperExpression(node.expression);
if (isTypeAny(superType)) {
for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) {
@@ -50778,16 +51641,16 @@
*/
function getDiagnosticHeadMessageForDecoratorResolution(node) {
switch (node.parent.kind) {
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression;
default:
return ts.Debug.fail();
@@ -50830,7 +51693,7 @@
// file would probably be preferable.
var typeSymbol = exports && getSymbol(exports, JsxNames.Element, 67897832 /* Type */);
var returnNode = typeSymbol && nodeBuilder.symbolToEntityName(typeSymbol, 67897832 /* Type */, node);
- var declaration = ts.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.createKeywordTypeNode(120 /* AnyKeyword */));
+ var declaration = ts.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.createKeywordTypeNode(121 /* AnyKeyword */));
var parameterSymbol = createSymbol(1 /* FunctionScopedVariable */, "props");
parameterSymbol.type = result;
return createSignature(declaration,
@@ -50877,16 +51740,16 @@
}
function resolveSignature(node, candidatesOutArray, checkMode) {
switch (node.kind) {
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return resolveCallExpression(node, candidatesOutArray, checkMode);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return resolveNewExpression(node, candidatesOutArray, checkMode);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode);
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
return resolveDecorator(node, candidatesOutArray, checkMode);
- case 262 /* JsxOpeningElement */:
- case 261 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
+ case 262 /* JsxSelfClosingElement */:
return resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode);
}
throw ts.Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable.");
@@ -50973,10 +51836,10 @@
return false;
}
var parent = node.parent;
- while (parent && parent.kind === 189 /* PropertyAccessExpression */) {
+ while (parent && parent.kind === 190 /* PropertyAccessExpression */) {
parent = parent.parent;
}
- if (parent && ts.isBinaryExpression(parent) && ts.isPrototypeAccess(parent.left) && parent.operatorToken.kind === 59 /* EqualsToken */) {
+ if (parent && ts.isBinaryExpression(parent) && ts.isPrototypeAccess(parent.left) && parent.operatorToken.kind === 60 /* EqualsToken */) {
var right = ts.getInitializerOfBinaryExpression(parent);
return ts.isObjectLiteralExpression(right) && right;
}
@@ -51002,15 +51865,15 @@
// returns a function type. We defer checking and return nonInferrableType.
return nonInferrableType;
}
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
return voidType;
}
- if (node.kind === 192 /* NewExpression */) {
+ if (node.kind === 193 /* NewExpression */) {
var declaration = signature.declaration;
if (declaration &&
- declaration.kind !== 157 /* Constructor */ &&
- declaration.kind !== 161 /* ConstructSignature */ &&
- declaration.kind !== 166 /* ConstructorType */ &&
+ declaration.kind !== 158 /* Constructor */ &&
+ declaration.kind !== 162 /* ConstructSignature */ &&
+ declaration.kind !== 167 /* ConstructorType */ &&
!ts.isJSDocConstructSignature(declaration) &&
!isJSConstructor(declaration)) {
// When resolved signature is a call signature (and not a construct signature) the result type is any
@@ -51127,9 +51990,9 @@
return false;
}
var targetDeclarationKind = resolvedRequire.flags & 16 /* Function */
- ? 239 /* FunctionDeclaration */
+ ? 240 /* FunctionDeclaration */
: resolvedRequire.flags & 3 /* Variable */
- ? 237 /* VariableDeclaration */
+ ? 238 /* VariableDeclaration */
: 0 /* Unknown */;
if (targetDeclarationKind !== 0 /* Unknown */) {
var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind);
@@ -51154,18 +52017,25 @@
case 14 /* NoSubstitutionTemplateLiteral */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
- case 187 /* ArrayLiteralExpression */:
- case 188 /* ObjectLiteralExpression */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
+ case 188 /* ArrayLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return true;
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return isValidConstAssertionArgument(node.expression);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
var op = node.operator;
var arg = node.operand;
return op === 39 /* MinusToken */ && (arg.kind === 8 /* NumericLiteral */ || arg.kind === 9 /* BigIntLiteral */) ||
op === 38 /* PlusToken */ && arg.kind === 8 /* NumericLiteral */;
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
+ var expr = node.expression;
+ if (ts.isIdentifier(expr)) {
+ var symbol = getSymbolAtLocation(expr);
+ return !!(symbol && (symbol.flags & 384 /* Enum */) && getEnumKind(symbol) === 1 /* Literal */);
+ }
}
return false;
}
@@ -51173,7 +52043,7 @@
var exprType = checkExpression(expression, checkMode);
if (ts.isConstTypeReference(type)) {
if (!isValidConstAssertionArgument(expression)) {
- error(expression, ts.Diagnostics.A_const_assertion_can_only_be_applied_to_a_string_number_boolean_array_or_object_literal);
+ error(expression, ts.Diagnostics.A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals);
}
return getRegularTypeOfLiteralType(exprType);
}
@@ -51193,10 +52063,10 @@
}
function checkMetaProperty(node) {
checkGrammarMetaProperty(node);
- if (node.keywordToken === 95 /* NewKeyword */) {
+ if (node.keywordToken === 96 /* NewKeyword */) {
return checkNewTargetMetaProperty(node);
}
- if (node.keywordToken === 92 /* ImportKeyword */) {
+ if (node.keywordToken === 93 /* ImportKeyword */) {
return checkImportMetaProperty(node);
}
return ts.Debug.assertNever(node.keywordToken);
@@ -51207,7 +52077,7 @@
error(node, ts.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target");
return errorType;
}
- else if (container.kind === 157 /* Constructor */) {
+ else if (container.kind === 158 /* Constructor */) {
var symbol = getSymbolOfNode(container.parent);
return getTypeOfSymbol(symbol);
}
@@ -51217,7 +52087,7 @@
}
}
function checkImportMetaProperty(node) {
- if (languageVersion < 7 /* ESNext */ || moduleKind < ts.ModuleKind.ESNext) {
+ if (languageVersion < 8 /* ESNext */ || moduleKind < ts.ModuleKind.ESNext) {
error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_using_ESNext_for_the_target_and_module_compiler_options);
}
var file = ts.getSourceFileOfNode(node);
@@ -51393,7 +52263,7 @@
for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) {
var element = _a[_i];
if (!ts.isOmittedExpression(element)) {
- if (element.name.kind === 72 /* Identifier */) {
+ if (element.name.kind === 73 /* Identifier */) {
getSymbolLinks(getSymbolOfNode(element)).type = getTypeForBindingElement(element);
}
else {
@@ -51407,9 +52277,9 @@
if (!links.type) {
links.type = contextualType;
var decl = parameter.valueDeclaration;
- if (decl.name.kind !== 72 /* Identifier */) {
+ if (decl.name.kind !== 73 /* Identifier */) {
// if inference didn't come up with anything but {}, fall back to the binding pattern if present.
- if (links.type === emptyObjectType) {
+ if (links.type === unknownType) {
links.type = getTypeFromBindingPattern(decl.name);
}
assignBindingElementTypes(decl.name);
@@ -51421,24 +52291,24 @@
var globalPromiseType = getGlobalPromiseType(/*reportErrors*/ true);
if (globalPromiseType !== emptyGenericType) {
// if the promised type is itself a promise, get the underlying type; otherwise, fallback to the promised type
- promisedType = getAwaitedType(promisedType) || emptyObjectType;
+ promisedType = getAwaitedType(promisedType) || unknownType;
return createTypeReference(globalPromiseType, [promisedType]);
}
- return emptyObjectType;
+ return unknownType;
}
function createPromiseLikeType(promisedType) {
// creates a `PromiseLike<T>` type where `T` is the promisedType argument
var globalPromiseLikeType = getGlobalPromiseLikeType(/*reportErrors*/ true);
if (globalPromiseLikeType !== emptyGenericType) {
// if the promised type is itself a promise, get the underlying type; otherwise, fallback to the promised type
- promisedType = getAwaitedType(promisedType) || emptyObjectType;
+ promisedType = getAwaitedType(promisedType) || unknownType;
return createTypeReference(globalPromiseLikeType, [promisedType]);
}
- return emptyObjectType;
+ return unknownType;
}
function createPromiseReturnType(func, promisedType) {
var promiseType = createPromiseType(promisedType);
- if (promiseType === emptyObjectType) {
+ if (promiseType === unknownType) {
error(func, ts.isImportCall(func) ?
ts.Diagnostics.A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option :
ts.Diagnostics.An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option);
@@ -51457,7 +52327,7 @@
}
var functionFlags = ts.getFunctionFlags(func);
var type;
- if (func.body.kind !== 218 /* Block */) {
+ if (func.body.kind !== 219 /* Block */) {
type = checkExpressionCached(func.body, checkMode && checkMode & ~8 /* SkipGenericFunctions */);
if (functionFlags & 2 /* Async */) {
// From within an async function you can return either a non-promise value or a promise. Any
@@ -51599,7 +52469,7 @@
if (!node.possiblyExhaustive) {
return false;
}
- if (node.expression.kind === 199 /* TypeOfExpression */) {
+ if (node.expression.kind === 200 /* TypeOfExpression */) {
var operandType = getTypeOfExpression(node.expression.expression);
// This cast is safe because the switch is possibly exhaustive and does not contain a default case, so there can be no undefined.
var witnesses = getSwitchClauseTypeOfWitnesses(node);
@@ -51622,7 +52492,7 @@
if (!(func.flags & 128 /* HasImplicitReturn */)) {
return false;
}
- if (ts.some(func.body.statements, function (statement) { return statement.kind === 232 /* SwitchStatement */ && isExhaustiveSwitchStatement(statement); })) {
+ if (ts.some(func.body.statements, function (statement) { return statement.kind === 233 /* SwitchStatement */ && isExhaustiveSwitchStatement(statement); })) {
return false;
}
return true;
@@ -51665,11 +52535,11 @@
}
function mayReturnNever(func) {
switch (func.kind) {
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return true;
- case 156 /* MethodDeclaration */:
- return func.parent.kind === 188 /* ObjectLiteralExpression */;
+ case 157 /* MethodDeclaration */:
+ return func.parent.kind === 189 /* ObjectLiteralExpression */;
default:
return false;
}
@@ -51693,7 +52563,7 @@
}
// If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check.
// also if HasImplicitReturn flag is not set this means that all codepaths in function body end with return or throw
- if (func.kind === 155 /* MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 218 /* Block */ || !functionHasImplicitReturn(func)) {
+ if (func.kind === 156 /* MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 219 /* Block */ || !functionHasImplicitReturn(func)) {
return;
}
var hasExplicitReturn = func.flags & 256 /* HasExplicitReturn */;
@@ -51726,7 +52596,7 @@
}
}
function checkFunctionExpressionOrObjectLiteralMethod(node, checkMode) {
- ts.Debug.assert(node.kind !== 156 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
+ ts.Debug.assert(node.kind !== 157 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
checkNodeDeferred(node);
// The identityMapper object is used to indicate that function expressions are wildcards
if (checkMode && checkMode & 4 /* SkipContextSensitive */ && isContextSensitive(node)) {
@@ -51746,7 +52616,7 @@
}
// Grammar checking
var hasGrammarError = checkGrammarFunctionLikeDeclaration(node);
- if (!hasGrammarError && node.kind === 196 /* FunctionExpression */) {
+ if (!hasGrammarError && node.kind === 197 /* FunctionExpression */) {
checkGrammarForGenerator(node);
}
var links = getNodeLinks(node);
@@ -51791,7 +52661,7 @@
getAwaitedType(type) || errorType : type;
}
function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) {
- ts.Debug.assert(node.kind !== 156 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
+ ts.Debug.assert(node.kind !== 157 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
var functionFlags = ts.getFunctionFlags(node);
var returnOrPromisedType = getReturnOrPromisedType(node, functionFlags);
if ((functionFlags & 1 /* Generator */) === 0) { // Async function or normal function
@@ -51807,7 +52677,7 @@
// checkFunctionExpressionBodies). So it must be done now.
getReturnTypeOfSignature(getSignatureFromDeclaration(node));
}
- if (node.body.kind === 218 /* Block */) {
+ if (node.body.kind === 219 /* Block */) {
checkSourceElement(node.body);
}
else {
@@ -51885,11 +52755,11 @@
if (isReadonlySymbol(symbol)) {
// Allow assignments to readonly properties within constructors of the same class declaration.
if (symbol.flags & 4 /* Property */ &&
- (expr.kind === 189 /* PropertyAccessExpression */ || expr.kind === 190 /* ElementAccessExpression */) &&
- expr.expression.kind === 100 /* ThisKeyword */) {
+ (expr.kind === 190 /* PropertyAccessExpression */ || expr.kind === 191 /* ElementAccessExpression */) &&
+ expr.expression.kind === 101 /* ThisKeyword */) {
// Look for if this is the constructor for the class that `symbol` is a property of.
var func = ts.getContainingFunction(expr);
- if (!(func && func.kind === 157 /* Constructor */)) {
+ if (!(func && func.kind === 158 /* Constructor */)) {
return true;
}
// If func.parent is a class and symbol is a (readonly) property of that class, or
@@ -51902,13 +52772,13 @@
return false;
}
function isReferenceThroughNamespaceImport(expr) {
- if (expr.kind === 189 /* PropertyAccessExpression */ || expr.kind === 190 /* ElementAccessExpression */) {
+ if (expr.kind === 190 /* PropertyAccessExpression */ || expr.kind === 191 /* ElementAccessExpression */) {
var node = ts.skipParentheses(expr.expression);
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
var symbol = getNodeLinks(node).resolvedSymbol;
if (symbol.flags & 2097152 /* Alias */) {
var declaration = getDeclarationOfAliasSymbol(symbol);
- return !!declaration && declaration.kind === 251 /* NamespaceImport */;
+ return !!declaration && declaration.kind === 252 /* NamespaceImport */;
}
}
}
@@ -51917,7 +52787,7 @@
function checkReferenceExpression(expr, invalidReferenceMessage) {
// References are combinations of identifiers, parentheses, and property accesses.
var node = ts.skipOuterExpressions(expr, 2 /* Assertions */ | 1 /* Parentheses */);
- if (node.kind !== 72 /* Identifier */ && node.kind !== 189 /* PropertyAccessExpression */ && node.kind !== 190 /* ElementAccessExpression */) {
+ if (node.kind !== 73 /* Identifier */ && node.kind !== 190 /* PropertyAccessExpression */ && node.kind !== 191 /* ElementAccessExpression */) {
error(expr, invalidReferenceMessage);
return false;
}
@@ -51926,7 +52796,7 @@
function checkDeleteExpression(node) {
checkExpression(node.expression);
var expr = ts.skipParentheses(node.expression);
- if (expr.kind !== 189 /* PropertyAccessExpression */ && expr.kind !== 190 /* ElementAccessExpression */) {
+ if (expr.kind !== 190 /* PropertyAccessExpression */ && expr.kind !== 191 /* ElementAccessExpression */) {
error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference);
return booleanType;
}
@@ -51949,7 +52819,19 @@
// Grammar checking
if (produceDiagnostics) {
if (!(node.flags & 16384 /* AwaitContext */)) {
- grammarErrorOnFirstToken(node, ts.Diagnostics.await_expression_is_only_allowed_within_an_async_function);
+ // use of 'await' in non-async function
+ var sourceFile = ts.getSourceFileOfNode(node);
+ if (!hasParseDiagnostics(sourceFile)) {
+ var span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);
+ var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.await_expression_is_only_allowed_within_an_async_function);
+ var func = ts.getContainingFunction(node);
+ if (func && func.kind !== 158 /* Constructor */) {
+ ts.Debug.assert((ts.getFunctionFlags(func) & 2 /* Async */) === 0, "Enclosing function should never be an async function.");
+ var relatedInfo = ts.createDiagnosticForNode(func, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async);
+ ts.addRelatedInfo(diagnostic, relatedInfo);
+ }
+ diagnostics.add(diagnostic);
+ }
}
if (isInParameterInitializerBeforeContainingFunction(node)) {
error(node, ts.Diagnostics.await_expressions_cannot_be_used_in_a_parameter_initializer);
@@ -52041,8 +52923,8 @@
}
if (type.flags & 3145728 /* UnionOrIntersection */) {
var types = type.types;
- for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
- var t = types_16[_i];
+ for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
+ var t = types_15[_i];
if (maybeTypeOfKind(t, kind)) {
return true;
}
@@ -52121,16 +53003,17 @@
if (strictNullChecks && properties.length === 0) {
return checkNonNullType(sourceType, node);
}
- for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) {
- var p = properties_5[_i];
- checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, properties, rightIsThis);
+ for (var i = 0; i < properties.length; i++) {
+ checkObjectLiteralDestructuringPropertyAssignment(node, sourceType, i, properties, rightIsThis);
}
return sourceType;
}
/** Note: If property cannot be a SpreadAssignment, then allProperties does not need to be provided */
- function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties, rightIsThis) {
+ function checkObjectLiteralDestructuringPropertyAssignment(node, objectLiteralType, propertyIndex, allProperties, rightIsThis) {
if (rightIsThis === void 0) { rightIsThis = false; }
- if (property.kind === 275 /* PropertyAssignment */ || property.kind === 276 /* ShorthandPropertyAssignment */) {
+ var properties = node.properties;
+ var property = properties[propertyIndex];
+ if (property.kind === 276 /* PropertyAssignment */ || property.kind === 277 /* ShorthandPropertyAssignment */) {
var name = property.name;
var exprType = getLiteralTypeFromPropertyName(name);
if (isTypeUsableAsPropertyName(exprType)) {
@@ -52143,22 +53026,30 @@
}
var elementType = getIndexedAccessType(objectLiteralType, exprType, name);
var type = getFlowTypeOfDestructuring(property, elementType);
- return checkDestructuringAssignment(property.kind === 276 /* ShorthandPropertyAssignment */ ? property : property.initializer, type);
+ return checkDestructuringAssignment(property.kind === 277 /* ShorthandPropertyAssignment */ ? property : property.initializer, type);
+ }
+ else if (property.kind === 278 /* SpreadAssignment */) {
+ if (propertyIndex < properties.length - 1) {
+ error(property, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);
}
- else if (property.kind === 277 /* SpreadAssignment */) {
- if (languageVersion < 7 /* ESNext */) {
+ else {
+ if (languageVersion < 8 /* ESNext */) {
checkExternalEmitHelpers(property, 4 /* Rest */);
}
var nonRestNames = [];
if (allProperties) {
- for (var i = 0; i < allProperties.length - 1; i++) {
- nonRestNames.push(allProperties[i].name);
+ for (var _i = 0, allProperties_1 = allProperties; _i < allProperties_1.length; _i++) {
+ var otherProperty = allProperties_1[_i];
+ if (!ts.isSpreadAssignment(otherProperty)) {
+ nonRestNames.push(otherProperty.name);
+ }
}
}
var type = getRestType(objectLiteralType, nonRestNames, objectLiteralType.symbol);
checkGrammarForDisallowedTrailingComma(allProperties, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma);
return checkDestructuringAssignment(property.expression, type);
}
+ }
else {
error(property, ts.Diagnostics.Property_assignment_expected);
}
@@ -52180,8 +53071,8 @@
function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, checkMode) {
var elements = node.elements;
var element = elements[elementIndex];
- if (element.kind !== 210 /* OmittedExpression */) {
- if (element.kind !== 208 /* SpreadElement */) {
+ if (element.kind !== 211 /* OmittedExpression */) {
+ if (element.kind !== 209 /* SpreadElement */) {
var indexType = getLiteralType(elementIndex);
if (isArrayLikeType(sourceType)) {
// We create a synthetic expression so that getIndexedAccessType doesn't get confused
@@ -52197,7 +53088,7 @@
}
else {
var restExpression = element.expression;
- if (restExpression.kind === 204 /* BinaryExpression */ && restExpression.operatorToken.kind === 59 /* EqualsToken */) {
+ if (restExpression.kind === 205 /* BinaryExpression */ && restExpression.operatorToken.kind === 60 /* EqualsToken */) {
error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer);
}
else {
@@ -52213,7 +53104,7 @@
}
function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode, rightIsThis) {
var target;
- if (exprOrAssignment.kind === 276 /* ShorthandPropertyAssignment */) {
+ if (exprOrAssignment.kind === 277 /* ShorthandPropertyAssignment */) {
var prop = exprOrAssignment;
if (prop.objectAssignmentInitializer) {
// In strict null checking mode, if a default value of a non-undefined type is specified, remove
@@ -52229,21 +53120,21 @@
else {
target = exprOrAssignment;
}
- if (target.kind === 204 /* BinaryExpression */ && target.operatorToken.kind === 59 /* EqualsToken */) {
+ if (target.kind === 205 /* BinaryExpression */ && target.operatorToken.kind === 60 /* EqualsToken */) {
checkBinaryExpression(target, checkMode);
target = target.left;
}
- if (target.kind === 188 /* ObjectLiteralExpression */) {
+ if (target.kind === 189 /* ObjectLiteralExpression */) {
return checkObjectLiteralAssignment(target, sourceType, rightIsThis);
}
- if (target.kind === 187 /* ArrayLiteralExpression */) {
+ if (target.kind === 188 /* ArrayLiteralExpression */) {
return checkArrayLiteralAssignment(target, sourceType, checkMode);
}
return checkReferenceAssignment(target, sourceType, checkMode);
}
function checkReferenceAssignment(target, sourceType, checkMode) {
var targetType = checkExpression(target, checkMode);
- var error = target.parent.kind === 277 /* SpreadAssignment */ ?
+ var error = target.parent.kind === 278 /* SpreadAssignment */ ?
ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access :
ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access;
if (checkReferenceExpression(target, error)) {
@@ -52262,39 +53153,39 @@
function isSideEffectFree(node) {
node = ts.skipParentheses(node);
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
case 10 /* StringLiteral */:
case 13 /* RegularExpressionLiteral */:
- case 193 /* TaggedTemplateExpression */:
- case 206 /* TemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
+ case 207 /* TemplateExpression */:
case 14 /* NoSubstitutionTemplateLiteral */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
- case 96 /* NullKeyword */:
- case 141 /* UndefinedKeyword */:
- case 196 /* FunctionExpression */:
- case 209 /* ClassExpression */:
- case 197 /* ArrowFunction */:
- case 187 /* ArrayLiteralExpression */:
- case 188 /* ObjectLiteralExpression */:
- case 199 /* TypeOfExpression */:
- case 213 /* NonNullExpression */:
- case 261 /* JsxSelfClosingElement */:
- case 260 /* JsxElement */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
+ case 97 /* NullKeyword */:
+ case 142 /* UndefinedKeyword */:
+ case 197 /* FunctionExpression */:
+ case 210 /* ClassExpression */:
+ case 198 /* ArrowFunction */:
+ case 188 /* ArrayLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
+ case 200 /* TypeOfExpression */:
+ case 214 /* NonNullExpression */:
+ case 262 /* JsxSelfClosingElement */:
+ case 261 /* JsxElement */:
return true;
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return isSideEffectFree(node.whenTrue) &&
isSideEffectFree(node.whenFalse);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
if (ts.isAssignmentOperator(node.operatorToken.kind)) {
return false;
}
return isSideEffectFree(node.left) &&
isSideEffectFree(node.right);
- case 202 /* PrefixUnaryExpression */:
- case 203 /* PostfixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
// Unary operators ~, !, +, and - have no side effects.
// The rest do.
switch (node.operator) {
@@ -52306,9 +53197,9 @@
}
return false;
// Some forms listed here for clarity
- case 200 /* VoidExpression */: // Explicit opt-out
- case 194 /* TypeAssertionExpression */: // Not SEF, but can produce useful type warnings
- case 212 /* AsExpression */: // Not SEF, but can produce useful type warnings
+ case 201 /* VoidExpression */: // Explicit opt-out
+ case 195 /* TypeAssertionExpression */: // Not SEF, but can produce useful type warnings
+ case 213 /* AsExpression */: // Not SEF, but can produce useful type warnings
default:
return false;
}
@@ -52324,8 +53215,8 @@
}
function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) {
var operator = operatorToken.kind;
- if (operator === 59 /* EqualsToken */ && (left.kind === 188 /* ObjectLiteralExpression */ || left.kind === 187 /* ArrayLiteralExpression */)) {
- return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode, right.kind === 100 /* ThisKeyword */);
+ if (operator === 60 /* EqualsToken */ && (left.kind === 189 /* ObjectLiteralExpression */ || left.kind === 188 /* ArrayLiteralExpression */)) {
+ return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode, right.kind === 101 /* ThisKeyword */);
}
var leftType;
if (operator === 54 /* AmpersandAmpersandToken */ || operator === 55 /* BarBarToken */) {
@@ -52338,26 +53229,26 @@
switch (operator) {
case 40 /* AsteriskToken */:
case 41 /* AsteriskAsteriskToken */:
- case 62 /* AsteriskEqualsToken */:
- case 63 /* AsteriskAsteriskEqualsToken */:
+ case 63 /* AsteriskEqualsToken */:
+ case 64 /* AsteriskAsteriskEqualsToken */:
case 42 /* SlashToken */:
- case 64 /* SlashEqualsToken */:
+ case 65 /* SlashEqualsToken */:
case 43 /* PercentToken */:
- case 65 /* PercentEqualsToken */:
+ case 66 /* PercentEqualsToken */:
case 39 /* MinusToken */:
- case 61 /* MinusEqualsToken */:
+ case 62 /* MinusEqualsToken */:
case 46 /* LessThanLessThanToken */:
- case 66 /* LessThanLessThanEqualsToken */:
+ case 67 /* LessThanLessThanEqualsToken */:
case 47 /* GreaterThanGreaterThanToken */:
- case 67 /* GreaterThanGreaterThanEqualsToken */:
+ case 68 /* GreaterThanGreaterThanEqualsToken */:
case 48 /* GreaterThanGreaterThanGreaterThanToken */:
- case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
+ case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
case 50 /* BarToken */:
- case 70 /* BarEqualsToken */:
+ case 71 /* BarEqualsToken */:
case 51 /* CaretToken */:
- case 71 /* CaretEqualsToken */:
+ case 72 /* CaretEqualsToken */:
case 49 /* AmpersandToken */:
- case 69 /* AmpersandEqualsToken */:
+ case 70 /* AmpersandEqualsToken */:
if (leftType === silentNeverType || rightType === silentNeverType) {
return silentNeverType;
}
@@ -52387,7 +53278,7 @@
else if (isTypeAssignableToKind(leftType, 2112 /* BigIntLike */) && isTypeAssignableToKind(rightType, 2112 /* BigIntLike */)) {
switch (operator) {
case 48 /* GreaterThanGreaterThanGreaterThanToken */:
- case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
+ case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
reportOperatorError();
}
resultType_1 = bigintType;
@@ -52402,7 +53293,7 @@
return resultType_1;
}
case 38 /* PlusToken */:
- case 60 /* PlusEqualsToken */:
+ case 61 /* PlusEqualsToken */:
if (leftType === silentNeverType || rightType === silentNeverType) {
return silentNeverType;
}
@@ -52437,7 +53328,7 @@
reportOperatorError();
return anyType;
}
- if (operator === 60 /* PlusEqualsToken */) {
+ if (operator === 61 /* PlusEqualsToken */) {
checkAssignmentOperator(resultType);
}
return resultType;
@@ -52458,19 +53349,13 @@
case 34 /* ExclamationEqualsToken */:
case 35 /* EqualsEqualsEqualsToken */:
case 36 /* ExclamationEqualsEqualsToken */:
- var leftIsLiteral = isLiteralType(leftType);
- var rightIsLiteral = isLiteralType(rightType);
- if (!leftIsLiteral || !rightIsLiteral) {
- leftType = leftIsLiteral ? getBaseTypeOfLiteralType(leftType) : leftType;
- rightType = rightIsLiteral ? getBaseTypeOfLiteralType(rightType) : rightType;
- }
if (!isTypeEqualityComparableTo(leftType, rightType) && !isTypeEqualityComparableTo(rightType, leftType)) {
reportOperatorError();
}
return booleanType;
- case 94 /* InstanceOfKeyword */:
+ case 95 /* InstanceOfKeyword */:
return checkInstanceOfExpression(left, right, leftType, rightType);
- case 93 /* InKeyword */:
+ case 94 /* InKeyword */:
return checkInExpression(left, right, leftType, rightType);
case 54 /* AmpersandAmpersandToken */:
return getTypeFacts(leftType) & 4194304 /* Truthy */ ?
@@ -52480,7 +53365,7 @@
return getTypeFacts(leftType) & 8388608 /* Falsy */ ?
getUnionType([removeDefinitelyFalsyTypes(leftType), rightType], 2 /* Subtype */) :
leftType;
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
var declKind = ts.isBinaryExpression(left.parent) ? ts.getAssignmentDeclarationKind(left.parent) : 0 /* None */;
checkAssignmentDeclaration(declKind, rightType);
if (isAssignmentDeclaration(declKind)) {
@@ -52524,7 +53409,7 @@
}
}
function isEvalNode(node) {
- return node.kind === 72 /* Identifier */ && node.escapedText === "eval";
+ return node.kind === 73 /* Identifier */ && node.escapedText === "eval";
}
// Return true if there was no error, false if there was an error.
function checkForDisallowedESSymbolOperand(operator) {
@@ -52540,13 +53425,13 @@
function getSuggestedBooleanOperator(operator) {
switch (operator) {
case 50 /* BarToken */:
- case 70 /* BarEqualsToken */:
+ case 71 /* BarEqualsToken */:
return 55 /* BarBarToken */;
case 51 /* CaretToken */:
- case 71 /* CaretEqualsToken */:
+ case 72 /* CaretEqualsToken */:
return 36 /* ExclamationEqualsEqualsToken */;
case 49 /* AmpersandToken */:
- case 69 /* AmpersandEqualsToken */:
+ case 70 /* AmpersandEqualsToken */:
return 54 /* AmpersandAmpersandToken */;
default:
return undefined;
@@ -52585,8 +53470,7 @@
}
}
function reportOperatorError() {
- var leftStr = typeToString(leftType);
- var rightStr = typeToString(rightType);
+ var _a = getTypeNamesForErrorDisplay(leftType, rightType), leftStr = _a[0], rightStr = _a[1];
var errNode = errorNode || operatorToken;
if (!tryGiveBetterPrimaryError(errNode, leftStr, rightStr)) {
error(errNode, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, ts.tokenToString(operatorToken.kind), leftStr, rightStr);
@@ -52641,7 +53525,7 @@
// Async generator functions prior to ESNext require the __await, __asyncDelegator,
// and __asyncValues helpers
if ((functionFlags & 3 /* AsyncGenerator */) === 3 /* AsyncGenerator */ &&
- languageVersion < 7 /* ESNext */) {
+ languageVersion < 8 /* ESNext */) {
checkExternalEmitHelpers(node, 26624 /* AsyncDelegatorIncludes */);
}
// Generator functions prior to ES2015 require the __values helper
@@ -52683,7 +53567,7 @@
return stringType;
}
function getContextNode(node) {
- if (node.kind === 268 /* JsxAttributes */ && !ts.isJsxSelfClosingElement(node.parent)) {
+ if (node.kind === 269 /* JsxAttributes */ && !ts.isJsxSelfClosingElement(node.parent)) {
return node.parent.parent; // Needs to be the root JsxElement, so it encompasses the attributes _and_ the children (which are essentially part of the attributes)
}
return node;
@@ -52722,7 +53606,7 @@
}
function isTypeAssertion(node) {
node = ts.skipParentheses(node);
- return node.kind === 194 /* TypeAssertionExpression */ || node.kind === 212 /* AsExpression */;
+ return node.kind === 195 /* TypeAssertionExpression */ || node.kind === 213 /* AsExpression */;
}
function checkDeclarationInitializer(declaration) {
var initializer = ts.getEffectiveInitializer(declaration);
@@ -52753,7 +53637,7 @@
// If the contextual type is a type variable constrained to a primitive type, consider
// this a literal context for literals of that primitive type. For example, given a
// type parameter 'T extends string', infer string literal types for T.
- var constraint = getBaseConstraintOfType(contextualType) || emptyObjectType;
+ var constraint = getBaseConstraintOfType(contextualType) || unknownType;
return maybeTypeOfKind(constraint, 4 /* String */) && maybeTypeOfKind(candidateType, 128 /* StringLiteral */) ||
maybeTypeOfKind(constraint, 8 /* Number */) && maybeTypeOfKind(candidateType, 256 /* NumberLiteral */) ||
maybeTypeOfKind(constraint, 64 /* BigInt */) && maybeTypeOfKind(candidateType, 2048 /* BigIntLiteral */) ||
@@ -52786,7 +53670,7 @@
// Do not use hasDynamicName here, because that returns false for well known symbols.
// We want to perform checkComputedPropertyName for all computed properties, including
// well known symbols.
- if (node.name.kind === 149 /* ComputedPropertyName */) {
+ if (node.name.kind === 150 /* ComputedPropertyName */) {
checkComputedPropertyName(node.name);
}
return checkExpressionForMutableLocation(node.initializer, checkMode);
@@ -52797,7 +53681,7 @@
// Do not use hasDynamicName here, because that returns false for well known symbols.
// We want to perform checkComputedPropertyName for all computed properties, including
// well known symbols.
- if (node.name.kind === 149 /* ComputedPropertyName */) {
+ if (node.name.kind === 150 /* ComputedPropertyName */) {
checkComputedPropertyName(node.name);
}
var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, checkMode);
@@ -52805,16 +53689,18 @@
}
function instantiateTypeWithSingleGenericCallSignature(node, type, checkMode) {
if (checkMode && checkMode & (2 /* Inferential */ | 8 /* SkipGenericFunctions */)) {
- var signature = getSingleCallSignature(type);
+ var callSignature = getSingleSignature(type, 0 /* Call */, /*allowMembers*/ true);
+ var constructSignature = getSingleSignature(type, 1 /* Construct */, /*allowMembers*/ true);
+ var signature = callSignature || constructSignature;
if (signature && signature.typeParameters) {
+ var contextualType = getApparentTypeOfContextualType(node);
+ if (contextualType && !isMixinConstructorType(contextualType)) {
+ var contextualSignature = getSingleSignature(getNonNullableType(contextualType), callSignature ? 0 /* Call */ : 1 /* Construct */, /*allowMembers*/ false);
+ if (contextualSignature && !contextualSignature.typeParameters) {
if (checkMode & 8 /* SkipGenericFunctions */) {
skippedGenericFunction(node, checkMode);
return anyFunctionType;
}
- var contextualType = getApparentTypeOfContextualType(node);
- if (contextualType) {
- var contextualSignature = getSingleCallSignature(getNonNullableType(contextualType));
- if (contextualSignature && !contextualSignature.typeParameters) {
var context = getInferenceContext(node);
// We have an expression that is an argument of a generic function for which we are performing
// type argument inference. The expression is of a function type with a single generic call
@@ -52822,7 +53708,8 @@
// if the outer function returns a function type with a single non-generic call signature and
// if some of the outer function type parameters have no inferences so far. If so, we can
// potentially add inferred type parameters to the outer function return type.
- var returnSignature = context.signature && getSingleCallSignature(getReturnTypeOfSignature(context.signature));
+ var returnType = context.signature && getReturnTypeOfSignature(context.signature);
+ var returnSignature = returnType && getSingleCallOrConstructSignature(returnType);
if (returnSignature && !returnSignature.typeParameters && !ts.every(context.inferences, hasInferenceCandidates)) {
// Instantiate the signature with its own type parameters as type arguments, possibly
// renaming the type parameters to ensure they have unique names.
@@ -52937,7 +53824,7 @@
var expr = ts.skipParentheses(node);
// Optimize for the common case of a call to a function with a single non-generic call
// signature where we can just fetch the return type without checking the arguments.
- if (expr.kind === 191 /* CallExpression */ && expr.expression.kind !== 98 /* SuperKeyword */ && !ts.isRequireCall(expr, /*checkArgumentIsStringLiteralLike*/ true) && !isSymbolOrSymbolForCall(expr)) {
+ if (expr.kind === 192 /* CallExpression */ && expr.expression.kind !== 99 /* SuperKeyword */ && !ts.isRequireCall(expr, /*checkArgumentIsStringLiteralLike*/ true) && !isSymbolOrSymbolForCall(expr)) {
var funcType = checkNonNullExpression(expr.expression);
var signature = getSingleCallSignature(funcType);
if (signature && !signature.typeParameters) {
@@ -52986,10 +53873,10 @@
// - 'left' in property access
// - 'object' in indexed access
// - target in rhs of import statement
- var ok = (node.parent.kind === 189 /* PropertyAccessExpression */ && node.parent.expression === node) ||
- (node.parent.kind === 190 /* ElementAccessExpression */ && node.parent.expression === node) ||
- ((node.kind === 72 /* Identifier */ || node.kind === 148 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) ||
- (node.parent.kind === 167 /* TypeQuery */ && node.parent.exprName === node));
+ var ok = (node.parent.kind === 190 /* PropertyAccessExpression */ && node.parent.expression === node) ||
+ (node.parent.kind === 191 /* ElementAccessExpression */ && node.parent.expression === node) ||
+ ((node.kind === 73 /* Identifier */ || node.kind === 149 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) ||
+ (node.parent.kind === 168 /* TypeQuery */ && node.parent.exprName === node));
if (!ok) {
error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query);
}
@@ -53010,13 +53897,13 @@
}
function checkExpressionWorker(node, checkMode, forceTuple) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return checkIdentifier(node);
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
return checkThisExpression(node);
- case 98 /* SuperKeyword */:
+ case 99 /* SuperKeyword */:
return checkSuperExpression(node);
- case 96 /* NullKeyword */:
+ case 97 /* NullKeyword */:
return nullWideningType;
case 14 /* NoSubstitutionTemplateLiteral */:
case 10 /* StringLiteral */:
@@ -53027,82 +53914,82 @@
case 9 /* BigIntLiteral */:
checkGrammarBigIntLiteral(node);
return getFreshTypeOfLiteralType(getBigIntLiteralType(node));
- case 102 /* TrueKeyword */:
+ case 103 /* TrueKeyword */:
return trueType;
- case 87 /* FalseKeyword */:
+ case 88 /* FalseKeyword */:
return falseType;
- case 206 /* TemplateExpression */:
+ case 207 /* TemplateExpression */:
return checkTemplateExpression(node);
case 13 /* RegularExpressionLiteral */:
return globalRegExpType;
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return checkArrayLiteral(node, checkMode, forceTuple);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return checkObjectLiteral(node, checkMode);
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return checkPropertyAccessExpression(node);
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
return checkQualifiedName(node);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return checkIndexedAccess(node);
- case 191 /* CallExpression */:
- if (node.expression.kind === 92 /* ImportKeyword */) {
+ case 192 /* CallExpression */:
+ if (node.expression.kind === 93 /* ImportKeyword */) {
return checkImportCallExpression(node);
}
/* falls through */
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return checkCallExpression(node, checkMode);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return checkTaggedTemplateExpression(node);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return checkParenthesizedExpression(node, checkMode);
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
return checkClassExpression(node);
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode);
- case 199 /* TypeOfExpression */:
+ case 200 /* TypeOfExpression */:
return checkTypeOfExpression(node);
- case 194 /* TypeAssertionExpression */:
- case 212 /* AsExpression */:
+ case 195 /* TypeAssertionExpression */:
+ case 213 /* AsExpression */:
return checkAssertion(node);
- case 213 /* NonNullExpression */:
+ case 214 /* NonNullExpression */:
return checkNonNullAssertion(node);
- case 214 /* MetaProperty */:
+ case 215 /* MetaProperty */:
return checkMetaProperty(node);
- case 198 /* DeleteExpression */:
+ case 199 /* DeleteExpression */:
return checkDeleteExpression(node);
- case 200 /* VoidExpression */:
+ case 201 /* VoidExpression */:
return checkVoidExpression(node);
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
return checkAwaitExpression(node);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return checkPrefixUnaryExpression(node);
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return checkPostfixUnaryExpression(node);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return checkBinaryExpression(node, checkMode);
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return checkConditionalExpression(node, checkMode);
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
return checkSpreadExpression(node, checkMode);
- case 210 /* OmittedExpression */:
+ case 211 /* OmittedExpression */:
return undefinedWideningType;
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return checkYieldExpression(node);
- case 215 /* SyntheticExpression */:
+ case 216 /* SyntheticExpression */:
return node.type;
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return checkJsxExpression(node, checkMode);
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
return checkJsxElement(node, checkMode);
- case 261 /* JsxSelfClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
return checkJsxSelfClosingElement(node, checkMode);
- case 264 /* JsxFragment */:
+ case 265 /* JsxFragment */:
return checkJsxFragment(node);
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
return checkJsxAttributes(node, checkMode);
- case 262 /* JsxOpeningElement */:
+ case 263 /* JsxOpeningElement */:
ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement");
}
return errorType;
@@ -53124,7 +54011,7 @@
var constraintType = getConstraintOfTypeParameter(typeParameter);
var defaultType = getDefaultFromTypeParameter(typeParameter);
if (constraintType && defaultType) {
- checkTypeAssignableTo(defaultType, getTypeWithThisArgument(constraintType, defaultType), node.default, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1);
+ checkTypeAssignableTo(defaultType, getTypeWithThisArgument(instantiateType(constraintType, makeUnaryTypeMapper(typeParameter, defaultType)), defaultType), node.default, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1);
}
if (produceDiagnostics) {
checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0);
@@ -53139,7 +54026,7 @@
checkVariableLikeDeclaration(node);
var func = ts.getContainingFunction(node);
if (ts.hasModifier(node, 92 /* ParameterPropertyModifier */)) {
- if (!(func.kind === 157 /* Constructor */ && ts.nodeIsPresent(func.body))) {
+ if (!(func.kind === 158 /* Constructor */ && ts.nodeIsPresent(func.body))) {
error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation);
}
}
@@ -53150,10 +54037,10 @@
if (func.parameters.indexOf(node) !== 0) {
error(node, ts.Diagnostics.A_0_parameter_must_be_the_first_parameter, node.name.escapedText);
}
- if (func.kind === 157 /* Constructor */ || func.kind === 161 /* ConstructSignature */ || func.kind === 166 /* ConstructorType */) {
+ if (func.kind === 158 /* Constructor */ || func.kind === 162 /* ConstructSignature */ || func.kind === 167 /* ConstructorType */) {
error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter);
}
- if (func.kind === 197 /* ArrowFunction */) {
+ if (func.kind === 198 /* ArrowFunction */) {
error(node, ts.Diagnostics.An_arrow_function_cannot_have_a_this_parameter);
}
}
@@ -53209,13 +54096,13 @@
}
function getTypePredicateParent(node) {
switch (node.parent.kind) {
- case 197 /* ArrowFunction */:
- case 160 /* CallSignature */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 165 /* FunctionType */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 198 /* ArrowFunction */:
+ case 161 /* CallSignature */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 166 /* FunctionType */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
var parent = node.parent;
if (node === parent.type) {
return parent;
@@ -53229,11 +54116,11 @@
continue;
}
var name = element.name;
- if (name.kind === 72 /* Identifier */ && name.escapedText === predicateVariableName) {
+ if (name.kind === 73 /* Identifier */ && name.escapedText === predicateVariableName) {
error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName);
return true;
}
- else if (name.kind === 185 /* ArrayBindingPattern */ || name.kind === 184 /* ObjectBindingPattern */) {
+ else if (name.kind === 186 /* ArrayBindingPattern */ || name.kind === 185 /* ObjectBindingPattern */) {
if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) {
return true;
}
@@ -53242,19 +54129,19 @@
}
function checkSignatureDeclaration(node) {
// Grammar checking
- if (node.kind === 162 /* IndexSignature */) {
+ if (node.kind === 163 /* IndexSignature */) {
checkGrammarIndexSignature(node);
}
// TODO (yuisu): Remove this check in else-if when SyntaxKind.Construct is moved and ambient context is handled
- else if (node.kind === 165 /* FunctionType */ || node.kind === 239 /* FunctionDeclaration */ || node.kind === 166 /* ConstructorType */ ||
- node.kind === 160 /* CallSignature */ || node.kind === 157 /* Constructor */ ||
- node.kind === 161 /* ConstructSignature */) {
+ else if (node.kind === 166 /* FunctionType */ || node.kind === 240 /* FunctionDeclaration */ || node.kind === 167 /* ConstructorType */ ||
+ node.kind === 161 /* CallSignature */ || node.kind === 158 /* Constructor */ ||
+ node.kind === 162 /* ConstructSignature */) {
checkGrammarFunctionLikeDeclaration(node);
}
var functionFlags = ts.getFunctionFlags(node);
if (!(functionFlags & 4 /* Invalid */)) {
// Async generators prior to ESNext require the __await and __asyncGenerator helpers
- if ((functionFlags & 3 /* AsyncGenerator */) === 3 /* AsyncGenerator */ && languageVersion < 7 /* ESNext */) {
+ if ((functionFlags & 3 /* AsyncGenerator */) === 3 /* AsyncGenerator */ && languageVersion < 8 /* ESNext */) {
checkExternalEmitHelpers(node, 6144 /* AsyncGeneratorIncludes */);
}
// Async functions prior to ES2017 require the __awaiter helper
@@ -53278,10 +54165,10 @@
var returnTypeNode = ts.getEffectiveReturnTypeNode(node);
if (noImplicitAny && !returnTypeNode) {
switch (node.kind) {
- case 161 /* ConstructSignature */:
+ case 162 /* ConstructSignature */:
error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);
break;
- case 160 /* CallSignature */:
+ case 161 /* CallSignature */:
error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);
break;
}
@@ -53311,7 +54198,7 @@
checkAsyncFunctionReturnType(node, returnTypeNode);
}
}
- if (node.kind !== 162 /* IndexSignature */ && node.kind !== 294 /* JSDocFunctionType */) {
+ if (node.kind !== 163 /* IndexSignature */ && node.kind !== 295 /* JSDocFunctionType */) {
registerForUnusedIdentifiersCheck(node);
}
}
@@ -53328,7 +54215,7 @@
var staticNames = ts.createUnderscoreEscapedMap();
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
- if (member.kind === 157 /* Constructor */) {
+ if (member.kind === 158 /* Constructor */) {
for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) {
var param = _c[_b];
if (ts.isParameterPropertyDeclaration(param) && !ts.isBindingPattern(param.name)) {
@@ -53343,16 +54230,16 @@
var memberName = name && ts.getPropertyNameForPropertyNameNode(name);
if (name && memberName) {
switch (member.kind) {
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
addName(names, name, memberName, 1 /* Getter */);
break;
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
addName(names, name, memberName, 2 /* Setter */);
break;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
addName(names, name, memberName, 3 /* Property */);
break;
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
addName(names, name, memberName, 4 /* Method */);
break;
}
@@ -53415,7 +54302,7 @@
var names = ts.createMap();
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
- if (member.kind === 153 /* PropertySignature */) {
+ if (member.kind === 154 /* PropertySignature */) {
var memberName = void 0;
var name = member.name;
switch (name.kind) {
@@ -53423,7 +54310,7 @@
case 8 /* NumericLiteral */:
memberName = name.text;
break;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
memberName = ts.idText(name);
break;
default:
@@ -53440,7 +54327,7 @@
}
}
function checkTypeForDuplicateIndexSignatures(node) {
- if (node.kind === 241 /* InterfaceDeclaration */) {
+ if (node.kind === 242 /* InterfaceDeclaration */) {
var nodeSymbol = getSymbolOfNode(node);
// in case of merging interface declaration it is possible that we'll enter this check procedure several times for every declaration
// to prevent this run check only for the first declaration of a given kind
@@ -53460,7 +54347,7 @@
var declaration = decl;
if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
switch (declaration.parameters[0].type.kind) {
- case 138 /* StringKeyword */:
+ case 139 /* StringKeyword */:
if (!seenStringIndexer) {
seenStringIndexer = true;
}
@@ -53468,7 +54355,7 @@
error(declaration, ts.Diagnostics.Duplicate_string_index_signature);
}
break;
- case 135 /* NumberKeyword */:
+ case 136 /* NumberKeyword */:
if (!seenNumericIndexer) {
seenNumericIndexer = true;
}
@@ -53495,7 +54382,7 @@
checkFunctionOrMethodDeclaration(node);
// Abstract methods cannot have an implementation.
// Extra checks are to avoid reporting multiple errors relating to the "abstractness" of the node.
- if (ts.hasModifier(node, 128 /* Abstract */) && node.kind === 156 /* MethodDeclaration */ && node.body) {
+ if (ts.hasModifier(node, 128 /* Abstract */) && node.kind === 157 /* MethodDeclaration */ && node.body) {
error(node, ts.Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, ts.declarationNameToString(node.name));
}
}
@@ -53520,7 +54407,7 @@
return;
}
function isInstancePropertyWithInitializer(n) {
- return n.kind === 154 /* PropertyDeclaration */ &&
+ return n.kind === 155 /* PropertyDeclaration */ &&
!ts.hasModifier(n, 32 /* Static */) &&
!!n.initializer;
}
@@ -53550,7 +54437,7 @@
var superCallStatement = void 0;
for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) {
var statement = statements_2[_i];
- if (statement.kind === 221 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) {
+ if (statement.kind === 222 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) {
superCallStatement = statement;
break;
}
@@ -53575,7 +54462,7 @@
checkGrammarComputedPropertyName(node.name);
checkDecorators(node);
checkSignatureDeclaration(node);
- if (node.kind === 158 /* GetAccessor */) {
+ if (node.kind === 159 /* GetAccessor */) {
if (!(node.flags & 4194304 /* Ambient */) && ts.nodeIsPresent(node.body) && (node.flags & 128 /* HasImplicitReturn */)) {
if (!(node.flags & 256 /* HasExplicitReturn */)) {
error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value);
@@ -53585,13 +54472,13 @@
// Do not use hasDynamicName here, because that returns false for well known symbols.
// We want to perform checkComputedPropertyName for all computed properties, including
// well known symbols.
- if (node.name.kind === 149 /* ComputedPropertyName */) {
+ if (node.name.kind === 150 /* ComputedPropertyName */) {
checkComputedPropertyName(node.name);
}
if (!hasNonBindableDynamicName(node)) {
// TypeScript 1.0 spec (April 2014): 8.4.3
// Accessors for the same member name must specify the same accessibility.
- var otherKind = node.kind === 158 /* GetAccessor */ ? 159 /* SetAccessor */ : 158 /* GetAccessor */;
+ var otherKind = node.kind === 159 /* GetAccessor */ ? 160 /* SetAccessor */ : 159 /* GetAccessor */;
var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(node), otherKind);
if (otherAccessor) {
var nodeFlags = ts.getModifierFlags(node);
@@ -53609,7 +54496,7 @@
}
}
var returnType = getTypeOfAccessors(getSymbolOfNode(node));
- if (node.kind === 158 /* GetAccessor */) {
+ if (node.kind === 159 /* GetAccessor */) {
checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType);
}
}
@@ -53657,7 +54544,7 @@
}
function checkTypeReferenceNode(node) {
checkGrammarTypeArguments(node, node.typeArguments);
- if (node.kind === 164 /* TypeReference */ && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) {
+ if (node.kind === 165 /* TypeReference */ && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) {
grammarErrorAtPos(node, node.typeName.jsdocDotPos, 1, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments);
}
var type = getTypeFromTypeReference(node);
@@ -53705,7 +54592,7 @@
var seenOptionalElement = false;
for (var i = 0; i < elementTypes.length; i++) {
var e = elementTypes[i];
- if (e.kind === 172 /* RestType */) {
+ if (e.kind === 173 /* RestType */) {
if (i !== elementTypes.length - 1) {
grammarErrorOnNode(e, ts.Diagnostics.A_rest_element_must_be_last_in_a_tuple_type);
break;
@@ -53714,7 +54601,7 @@
error(e, ts.Diagnostics.A_rest_element_type_must_be_an_array_type);
}
}
- else if (e.kind === 171 /* OptionalType */) {
+ else if (e.kind === 172 /* OptionalType */) {
seenOptionalElement = true;
}
else if (seenOptionalElement) {
@@ -53735,7 +54622,7 @@
var objectType = type.objectType;
var indexType = type.indexType;
if (isTypeAssignableTo(indexType, getIndexType(objectType, /*stringsOnly*/ false))) {
- if (accessNode.kind === 190 /* ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) &&
+ if (accessNode.kind === 191 /* ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) &&
ts.getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) {
error(accessNode, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
}
@@ -53747,7 +54634,7 @@
return type;
}
error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType));
- return type;
+ return errorType;
}
function checkIndexedAccessType(node) {
checkSourceElement(node.objectType);
@@ -53775,7 +54662,7 @@
ts.forEachChild(node, checkSourceElement);
}
function checkInferType(node) {
- if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 175 /* ConditionalType */ && n.parent.extendsType === n; })) {
+ if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 176 /* ConditionalType */ && n.parent.extendsType === n; })) {
grammarErrorOnNode(node, ts.Diagnostics.infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type);
}
checkSourceElement(node.typeParameter);
@@ -53792,9 +54679,9 @@
var flags = ts.getCombinedModifierFlags(n);
// children of classes (even ambient classes) should not be marked as ambient or export
// because those flags have no useful semantics there.
- if (n.parent.kind !== 241 /* InterfaceDeclaration */ &&
- n.parent.kind !== 240 /* ClassDeclaration */ &&
- n.parent.kind !== 209 /* ClassExpression */ &&
+ if (n.parent.kind !== 242 /* InterfaceDeclaration */ &&
+ n.parent.kind !== 241 /* ClassDeclaration */ &&
+ n.parent.kind !== 210 /* ClassExpression */ &&
n.flags & 4194304 /* Ambient */) {
if (!(flags & 2 /* Ambient */) && !(ts.isModuleBlock(n.parent) && ts.isModuleDeclaration(n.parent.parent) && ts.isGlobalScopeAugmentation(n.parent.parent))) {
// It is nested in an ambient context, which means it is automatically exported
@@ -53885,7 +54772,7 @@
if (node.name && subsequentName &&
(ts.isComputedPropertyName(node.name) && ts.isComputedPropertyName(subsequentName) ||
!ts.isComputedPropertyName(node.name) && !ts.isComputedPropertyName(subsequentName) && ts.getEscapedTextOfIdentifierOrLiteral(node.name) === ts.getEscapedTextOfIdentifierOrLiteral(subsequentName))) {
- var reportError = (node.kind === 156 /* MethodDeclaration */ || node.kind === 155 /* MethodSignature */) &&
+ var reportError = (node.kind === 157 /* MethodDeclaration */ || node.kind === 156 /* MethodSignature */) &&
ts.hasModifier(node, 32 /* Static */) !== ts.hasModifier(subsequentNode, 32 /* Static */);
// we can get here in two cases
// 1. mixed static and instance class members
@@ -53924,7 +54811,7 @@
var current = declarations_4[_i];
var node = current;
var inAmbientContext = node.flags & 4194304 /* Ambient */;
- var inAmbientContextOrInterface = node.parent.kind === 241 /* InterfaceDeclaration */ || node.parent.kind === 168 /* TypeLiteral */ || inAmbientContext;
+ var inAmbientContextOrInterface = node.parent.kind === 242 /* InterfaceDeclaration */ || node.parent.kind === 169 /* TypeLiteral */ || inAmbientContext;
if (inAmbientContextOrInterface) {
// check if declarations are consecutive only if they are non-ambient
// 1. ambient declarations can be interleaved
@@ -53935,7 +54822,7 @@
// 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one
previousDeclaration = undefined;
}
- if (node.kind === 239 /* FunctionDeclaration */ || node.kind === 156 /* MethodDeclaration */ || node.kind === 155 /* MethodSignature */ || node.kind === 157 /* Constructor */) {
+ if (node.kind === 240 /* FunctionDeclaration */ || node.kind === 157 /* MethodDeclaration */ || node.kind === 156 /* MethodSignature */ || node.kind === 158 /* Constructor */) {
var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck);
someNodeFlags |= currentNodeFlags;
allNodeFlags &= currentNodeFlags;
@@ -54064,22 +54951,22 @@
function getDeclarationSpaces(decl) {
var d = decl;
switch (d.kind) {
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
// A jsdoc typedef and callback are, by definition, type aliases
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
return 2 /* ExportType */;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */
? 4 /* ExportNamespace */ | 1 /* ExportValue */
: 4 /* ExportNamespace */;
- case 240 /* ClassDeclaration */:
- case 243 /* EnumDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 244 /* EnumDeclaration */:
return 2 /* ExportType */ | 1 /* ExportValue */;
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return 2 /* ExportType */ | 1 /* ExportValue */ | 4 /* ExportNamespace */;
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
// Export assigned entity name expressions act as aliases and should fall through, otherwise they export values
if (!ts.isEntityNameExpression(d.expression)) {
return 1 /* ExportValue */;
@@ -54087,20 +54974,20 @@
d = d.expression;
/* falls through */
// The below options all declare an Alias, which is allowed to merge with other values within the importing module
- case 248 /* ImportEqualsDeclaration */:
- case 251 /* NamespaceImport */:
- case 250 /* ImportClause */:
- var result_5 = 0 /* None */;
+ case 249 /* ImportEqualsDeclaration */:
+ case 252 /* NamespaceImport */:
+ case 251 /* ImportClause */:
+ var result_7 = 0 /* None */;
var target = resolveAlias(getSymbolOfNode(d));
- ts.forEach(target.declarations, function (d) { result_5 |= getDeclarationSpaces(d); });
- return result_5;
- case 237 /* VariableDeclaration */:
- case 186 /* BindingElement */:
- case 239 /* FunctionDeclaration */:
- case 253 /* ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591
+ ts.forEach(target.declarations, function (d) { result_7 |= getDeclarationSpaces(d); });
+ return result_7;
+ case 238 /* VariableDeclaration */:
+ case 187 /* BindingElement */:
+ case 240 /* FunctionDeclaration */:
+ case 254 /* ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591
return 1 /* ExportValue */;
default:
- return ts.Debug.fail(ts.Debug.showSyntaxKind(d));
+ return ts.Debug.failBadSyntaxKind(d);
}
}
}
@@ -54326,7 +55213,7 @@
var promiseConstructorSymbol = resolveEntityName(promiseConstructorName, 67220415 /* Value */, /*ignoreErrors*/ true);
var promiseConstructorType = promiseConstructorSymbol ? getTypeOfSymbol(promiseConstructorSymbol) : errorType;
if (promiseConstructorType === errorType) {
- if (promiseConstructorName.kind === 72 /* Identifier */ && promiseConstructorName.escapedText === "Promise" && getTargetType(returnType) === getGlobalPromiseType(/*reportErrors*/ false)) {
+ if (promiseConstructorName.kind === 73 /* Identifier */ && promiseConstructorName.escapedText === "Promise" && getTargetType(returnType) === getGlobalPromiseType(/*reportErrors*/ false)) {
error(returnTypeNode, ts.Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option);
}
else {
@@ -54365,24 +55252,24 @@
var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node);
var errorInfo;
switch (node.parent.kind) {
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
var classSymbol = getSymbolOfNode(node.parent);
var classConstructorType = getTypeOfSymbol(classSymbol);
expectedReturnType = getUnionType([classConstructorType, voidType]);
break;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
expectedReturnType = voidType;
errorInfo = ts.chainDiagnosticMessages(
/*details*/ undefined, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any);
break;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
expectedReturnType = voidType;
errorInfo = ts.chainDiagnosticMessages(
/*details*/ undefined, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any);
break;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
var methodType = getTypeOfNode(node.parent);
var descriptorType = createTypedPropertyDescriptorType(methodType);
expectedReturnType = getUnionType([descriptorType, voidType]);
@@ -54403,7 +55290,7 @@
if (!typeName)
return;
var rootName = getFirstIdentifier(typeName);
- var meaning = (typeName.kind === 72 /* Identifier */ ? 67897832 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */;
+ var meaning = (typeName.kind === 73 /* Identifier */ ? 67897832 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */;
var rootSymbol = resolveName(rootName, rootName.escapedText, meaning, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isRefernce*/ true);
if (rootSymbol
&& rootSymbol.flags & 2097152 /* Alias */
@@ -54428,29 +55315,29 @@
function getEntityNameForDecoratorMetadata(node) {
if (node) {
switch (node.kind) {
- case 174 /* IntersectionType */:
- case 173 /* UnionType */:
+ case 175 /* IntersectionType */:
+ case 174 /* UnionType */:
return getEntityNameForDecoratorMetadataFromTypeList(node.types);
- case 175 /* ConditionalType */:
+ case 176 /* ConditionalType */:
return getEntityNameForDecoratorMetadataFromTypeList([node.trueType, node.falseType]);
- case 177 /* ParenthesizedType */:
+ case 178 /* ParenthesizedType */:
return getEntityNameForDecoratorMetadata(node.type);
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return node.typeName;
}
}
}
function getEntityNameForDecoratorMetadataFromTypeList(types) {
var commonEntityName;
- for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
- var typeNode = types_17[_i];
- while (typeNode.kind === 177 /* ParenthesizedType */) {
+ for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
+ var typeNode = types_16[_i];
+ while (typeNode.kind === 178 /* ParenthesizedType */) {
typeNode = typeNode.type; // Skip parens if need be
}
- if (typeNode.kind === 132 /* NeverKeyword */) {
+ if (typeNode.kind === 133 /* NeverKeyword */) {
continue; // Always elide `never` from the union/intersection if possible
}
- if (!strictNullChecks && (typeNode.kind === 96 /* NullKeyword */ || typeNode.kind === 141 /* UndefinedKeyword */)) {
+ if (!strictNullChecks && (typeNode.kind === 97 /* NullKeyword */ || typeNode.kind === 142 /* UndefinedKeyword */)) {
continue; // Elide null and undefined from unions for metadata, just like what we did prior to the implementation of strict null checks
}
var individualEntityName = getEntityNameForDecoratorMetadata(typeNode);
@@ -54492,18 +55379,18 @@
return;
}
if (!compilerOptions.experimentalDecorators) {
- error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning);
+ error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning);
}
var firstDecorator = node.decorators[0];
checkExternalEmitHelpers(firstDecorator, 8 /* Decorate */);
- if (node.kind === 151 /* Parameter */) {
+ if (node.kind === 152 /* Parameter */) {
checkExternalEmitHelpers(firstDecorator, 32 /* Param */);
}
if (compilerOptions.emitDecoratorMetadata) {
checkExternalEmitHelpers(firstDecorator, 16 /* Metadata */);
// we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator.
switch (node.kind) {
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
var constructor = ts.getFirstConstructorWithBody(node);
if (constructor) {
for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) {
@@ -54512,23 +55399,23 @@
}
}
break;
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- var otherKind = node.kind === 158 /* GetAccessor */ ? 159 /* SetAccessor */ : 158 /* GetAccessor */;
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ var otherKind = node.kind === 159 /* GetAccessor */ ? 160 /* SetAccessor */ : 159 /* GetAccessor */;
var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(node), otherKind);
markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor));
break;
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) {
var parameter = _c[_b];
markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
}
markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveReturnTypeNode(node));
break;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveTypeAnnotationNode(node));
break;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node));
var containingSignature = node.parent;
for (var _d = 0, _e = containingSignature.parameters; _d < _e.length; _d++) {
@@ -54591,7 +55478,7 @@
else if (ts.findLast(ts.getJSDocTags(decl), ts.isJSDocParameterTag) === node &&
node.typeExpression && node.typeExpression.type &&
!isArrayType(getTypeFromTypeNode(node.typeExpression.type))) {
- error(node.name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_had_an_array_type, ts.idText(node.name.kind === 148 /* QualifiedName */ ? node.name.right : node.name));
+ error(node.name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_had_an_array_type, ts.idText(node.name.kind === 149 /* QualifiedName */ ? node.name.right : node.name));
}
}
}
@@ -54624,9 +55511,9 @@
}
function getIdentifierFromEntityNameExpression(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return node;
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return node.name;
default:
return undefined;
@@ -54639,7 +55526,7 @@
// Do not use hasDynamicName here, because that returns false for well known symbols.
// We want to perform checkComputedPropertyName for all computed properties, including
// well known symbols.
- if (node.name && node.name.kind === 149 /* ComputedPropertyName */) {
+ if (node.name && node.name.kind === 150 /* ComputedPropertyName */) {
// This check will account for methods in class/interface declarations,
// as well as accessors in classes/object literals
checkComputedPropertyName(node.name);
@@ -54668,7 +55555,7 @@
}
}
}
- var body = node.kind === 155 /* MethodSignature */ ? undefined : node.body;
+ var body = node.kind === 156 /* MethodSignature */ ? undefined : node.body;
checkSourceElement(body);
if ((functionFlags & 1 /* Generator */) === 0) { // Async function or normal function
var returnOrPromisedType = getReturnOrPromisedType(node, functionFlags);
@@ -54713,42 +55600,42 @@
for (var _i = 0, potentiallyUnusedIdentifiers_1 = potentiallyUnusedIdentifiers; _i < potentiallyUnusedIdentifiers_1.length; _i++) {
var node = potentiallyUnusedIdentifiers_1[_i];
switch (node.kind) {
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
checkUnusedClassMembers(node, addDiagnostic);
checkUnusedTypeParameters(node, addDiagnostic);
break;
- case 284 /* SourceFile */:
- case 244 /* ModuleDeclaration */:
- case 218 /* Block */:
- case 246 /* CaseBlock */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 285 /* SourceFile */:
+ case 245 /* ModuleDeclaration */:
+ case 219 /* Block */:
+ case 247 /* CaseBlock */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
checkUnusedLocalsAndParameters(node, addDiagnostic);
break;
- case 157 /* Constructor */:
- case 196 /* FunctionExpression */:
- case 239 /* FunctionDeclaration */:
- case 197 /* ArrowFunction */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 158 /* Constructor */:
+ case 197 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
+ case 198 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
if (node.body) { // Don't report unused parameters in overloads
checkUnusedLocalsAndParameters(node, addDiagnostic);
}
checkUnusedTypeParameters(node, addDiagnostic);
break;
- case 155 /* MethodSignature */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 242 /* TypeAliasDeclaration */:
- case 241 /* InterfaceDeclaration */:
+ case 156 /* MethodSignature */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 243 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
checkUnusedTypeParameters(node, addDiagnostic);
break;
- case 176 /* InferType */:
+ case 177 /* InferType */:
checkUnusedInferTypeParameter(node, addDiagnostic);
break;
default:
@@ -54768,11 +55655,11 @@
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
switch (member.kind) {
- case 156 /* MethodDeclaration */:
- case 154 /* PropertyDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- if (member.kind === 159 /* SetAccessor */ && member.symbol.flags & 32768 /* GetAccessor */) {
+ case 157 /* MethodDeclaration */:
+ case 155 /* PropertyDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ if (member.kind === 160 /* SetAccessor */ && member.symbol.flags & 32768 /* GetAccessor */) {
// Already would have reported an error on the getter.
break;
}
@@ -54781,7 +55668,7 @@
addDiagnostic(member, 0 /* Local */, ts.createDiagnosticForNode(member.name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, symbolToString(symbol)));
}
break;
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) {
var parameter = _c[_b];
if (!parameter.symbol.isReferenced && ts.hasModifier(parameter, 8 /* Private */)) {
@@ -54789,8 +55676,8 @@
}
}
break;
- case 162 /* IndexSignature */:
- case 217 /* SemicolonClassElement */:
+ case 163 /* IndexSignature */:
+ case 218 /* SemicolonClassElement */:
// Can't be private
break;
default:
@@ -54817,7 +55704,7 @@
continue;
var name = ts.idText(typeParameter.name);
var parent = typeParameter.parent;
- if (parent.kind !== 176 /* InferType */ && parent.typeParameters.every(isTypeParameterUnused)) {
+ if (parent.kind !== 177 /* InferType */ && parent.typeParameters.every(isTypeParameterUnused)) {
if (seenParentsWithEveryUnused.tryAdd(parent)) {
var range = ts.isJSDocTemplateTag(parent)
// Whole @template tag
@@ -54902,7 +55789,7 @@
var importDecl = importClause.parent;
var nDeclarations = (importClause.name ? 1 : 0) +
(importClause.namedBindings ?
- (importClause.namedBindings.kind === 251 /* NamespaceImport */ ? 1 : importClause.namedBindings.elements.length)
+ (importClause.namedBindings.kind === 252 /* NamespaceImport */ ? 1 : importClause.namedBindings.elements.length)
: 0);
if (nDeclarations === unuseds.length) {
addDiagnostic(importDecl, 0 /* Local */, unuseds.length === 1
@@ -54920,7 +55807,7 @@
var bindingPattern = _a[0], bindingElements = _a[1];
var kind = tryGetRootParameterDeclaration(bindingPattern.parent) ? 1 /* Parameter */ : 0 /* Local */;
if (bindingPattern.elements.length === bindingElements.length) {
- if (bindingElements.length === 1 && bindingPattern.parent.kind === 237 /* VariableDeclaration */ && bindingPattern.parent.parent.kind === 238 /* VariableDeclarationList */) {
+ if (bindingElements.length === 1 && bindingPattern.parent.kind === 238 /* VariableDeclaration */ && bindingPattern.parent.parent.kind === 239 /* VariableDeclarationList */) {
addToGroup(unusedVariables, bindingPattern.parent.parent, bindingPattern.parent, getNodeId);
}
else {
@@ -54941,7 +55828,7 @@
if (declarationList.declarations.length === declarations.length) {
addDiagnostic(declarationList, 0 /* Local */, declarations.length === 1
? ts.createDiagnosticForNode(ts.first(declarations).name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(ts.first(declarations).name))
- : ts.createDiagnosticForNode(declarationList.parent.kind === 219 /* VariableStatement */ ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused));
+ : ts.createDiagnosticForNode(declarationList.parent.kind === 220 /* VariableStatement */ ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused));
}
else {
for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) {
@@ -54953,24 +55840,24 @@
}
function bindingNameText(name) {
switch (name.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return ts.idText(name);
- case 185 /* ArrayBindingPattern */:
- case 184 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
return bindingNameText(ts.cast(ts.first(name.elements), ts.isBindingElement).name);
default:
return ts.Debug.assertNever(name);
}
}
function isImportedDeclaration(node) {
- return node.kind === 250 /* ImportClause */ || node.kind === 253 /* ImportSpecifier */ || node.kind === 251 /* NamespaceImport */;
+ return node.kind === 251 /* ImportClause */ || node.kind === 254 /* ImportSpecifier */ || node.kind === 252 /* NamespaceImport */;
}
function importClauseFromImported(decl) {
- return decl.kind === 250 /* ImportClause */ ? decl : decl.kind === 251 /* NamespaceImport */ ? decl.parent : decl.parent.parent;
+ return decl.kind === 251 /* ImportClause */ ? decl : decl.kind === 252 /* NamespaceImport */ ? decl.parent : decl.parent.parent;
}
function checkBlock(node) {
// Grammar checking for SyntaxKind.Block
- if (node.kind === 218 /* Block */) {
+ if (node.kind === 219 /* Block */) {
checkGrammarStatementInAmbientContext(node);
}
if (ts.isFunctionOrModuleBlock(node)) {
@@ -55000,12 +55887,12 @@
if (!(identifier && identifier.escapedText === name)) {
return false;
}
- if (node.kind === 154 /* PropertyDeclaration */ ||
- node.kind === 153 /* PropertySignature */ ||
- node.kind === 156 /* MethodDeclaration */ ||
- node.kind === 155 /* MethodSignature */ ||
- node.kind === 158 /* GetAccessor */ ||
- node.kind === 159 /* SetAccessor */) {
+ if (node.kind === 155 /* PropertyDeclaration */ ||
+ node.kind === 154 /* PropertySignature */ ||
+ node.kind === 157 /* MethodDeclaration */ ||
+ node.kind === 156 /* MethodSignature */ ||
+ node.kind === 159 /* GetAccessor */ ||
+ node.kind === 160 /* SetAccessor */) {
// it is ok to have member named '_super' or '_this' - member access is always qualified
return false;
}
@@ -55014,7 +55901,7 @@
return false;
}
var root = ts.getRootDeclaration(node);
- if (root.kind === 151 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) {
+ if (root.kind === 152 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) {
// just an overload - no codegen impact
return false;
}
@@ -55024,7 +55911,7 @@
function checkIfThisIsCapturedInEnclosingScope(node) {
ts.findAncestor(node, function (current) {
if (getNodeCheckFlags(current) & 4 /* CaptureThis */) {
- var isDeclaration_1 = node.kind !== 72 /* Identifier */;
+ var isDeclaration_1 = node.kind !== 73 /* Identifier */;
if (isDeclaration_1) {
error(ts.getNameOfDeclaration(node), ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference);
}
@@ -55039,7 +55926,7 @@
function checkIfNewTargetIsCapturedInEnclosingScope(node) {
ts.findAncestor(node, function (current) {
if (getNodeCheckFlags(current) & 8 /* CaptureNewTarget */) {
- var isDeclaration_2 = node.kind !== 72 /* Identifier */;
+ var isDeclaration_2 = node.kind !== 73 /* Identifier */;
if (isDeclaration_2) {
error(ts.getNameOfDeclaration(node), ts.Diagnostics.Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference);
}
@@ -55065,7 +55952,7 @@
}
// In case of variable declaration, node.parent is variable statement so look at the variable statement's parent
var parent = getDeclarationContainer(node);
- if (parent.kind === 284 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) {
+ if (parent.kind === 285 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) {
// If the declaration happens to be in external module, report error that require and exports are reserved keywords
error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name));
}
@@ -55080,7 +55967,7 @@
}
// In case of variable declaration, node.parent is variable statement so look at the variable statement's parent
var parent = getDeclarationContainer(node);
- if (parent.kind === 284 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024 /* HasAsyncFunctions */) {
+ if (parent.kind === 285 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024 /* HasAsyncFunctions */) {
// If the declaration happens to be in external module, report error that Promise is a reserved identifier.
error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name));
}
@@ -55115,7 +56002,7 @@
// skip variable declarations that don't have initializers
// NOTE: in ES6 spec initializer is required in variable declarations where name is binding pattern
// so we'll always treat binding elements as initialized
- if (node.kind === 237 /* VariableDeclaration */ && !node.initializer) {
+ if (node.kind === 238 /* VariableDeclaration */ && !node.initializer) {
return;
}
var symbol = getSymbolOfNode(node);
@@ -55127,17 +56014,17 @@
localDeclarationSymbol !== symbol &&
localDeclarationSymbol.flags & 2 /* BlockScopedVariable */) {
if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3 /* BlockScoped */) {
- var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 238 /* VariableDeclarationList */);
- var container = varDeclList.parent.kind === 219 /* VariableStatement */ && varDeclList.parent.parent
+ var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 239 /* VariableDeclarationList */);
+ var container = varDeclList.parent.kind === 220 /* VariableStatement */ && varDeclList.parent.parent
? varDeclList.parent.parent
: undefined;
// names of block-scoped and function scoped variables can collide only
// if block scoped variable is defined in the function\module\source file scope (because of variable hoisting)
var namesShareScope = container &&
- (container.kind === 218 /* Block */ && ts.isFunctionLike(container.parent) ||
- container.kind === 245 /* ModuleBlock */ ||
- container.kind === 244 /* ModuleDeclaration */ ||
- container.kind === 284 /* SourceFile */);
+ (container.kind === 219 /* Block */ && ts.isFunctionLike(container.parent) ||
+ container.kind === 246 /* ModuleBlock */ ||
+ container.kind === 245 /* ModuleDeclaration */ ||
+ container.kind === 285 /* SourceFile */);
// here we know that function scoped variable is shadowed by block scoped one
// if they are defined in the same scope - binder has already reported redeclaration error
// otherwise if variable has an initializer - show error that initialization will fail
@@ -55150,69 +56037,6 @@
}
}
}
- // Check that a parameter initializer contains no references to parameters declared to the right of itself
- function checkParameterInitializer(node) {
- if (ts.getRootDeclaration(node).kind !== 151 /* Parameter */) {
- return;
- }
- var func = ts.getContainingFunction(node);
- visit(node.initializer);
- function visit(n) {
- if (ts.isTypeNode(n) || ts.isDeclarationName(n)) {
- // do not dive in types
- // skip declaration names (i.e. in object literal expressions)
- return;
- }
- if (n.kind === 189 /* PropertyAccessExpression */) {
- // skip property names in property access expression
- return visit(n.expression);
- }
- else if (n.kind === 72 /* Identifier */) {
- // check FunctionLikeDeclaration.locals (stores parameters\function local variable)
- // if it contains entry with a specified name
- var symbol = resolveName(n, n.escapedText, 67220415 /* Value */ | 2097152 /* Alias */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false);
- if (!symbol || symbol === unknownSymbol || !symbol.valueDeclaration) {
- return;
- }
- if (symbol.valueDeclaration === node) {
- error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name));
- return;
- }
- // locals map for function contain both parameters and function locals
- // so we need to do a bit of extra work to check if reference is legal
- var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration);
- if (enclosingContainer === func) {
- if (symbol.valueDeclaration.kind === 151 /* Parameter */ ||
- symbol.valueDeclaration.kind === 186 /* BindingElement */) {
- // it is ok to reference parameter in initializer if either
- // - parameter is located strictly on the left of current parameter declaration
- if (symbol.valueDeclaration.pos < node.pos) {
- return;
- }
- // - parameter is wrapped in function-like entity
- if (ts.findAncestor(n, function (current) {
- if (current === node.initializer) {
- return "quit";
- }
- return ts.isFunctionLike(current.parent) ||
- // computed property names/initializers in instance property declaration of class like entities
- // are executed in constructor and thus deferred
- (current.parent.kind === 154 /* PropertyDeclaration */ &&
- !(ts.hasModifier(current.parent, 32 /* Static */)) &&
- ts.isClassLike(current.parent.parent));
- })) {
- return;
- }
- // fall through to report error
- }
- error(n, ts.Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(node.name), ts.declarationNameToString(n));
- }
- }
- else {
- return ts.forEachChild(n, visit);
- }
- }
- }
function convertAutoToAny(type) {
return type === autoType ? anyType : type === autoArrayType ? anyArrayType : type;
}
@@ -55230,18 +56054,18 @@
// Do not use hasDynamicName here, because that returns false for well known symbols.
// We want to perform checkComputedPropertyName for all computed properties, including
// well known symbols.
- if (node.name.kind === 149 /* ComputedPropertyName */) {
+ if (node.name.kind === 150 /* ComputedPropertyName */) {
checkComputedPropertyName(node.name);
if (node.initializer) {
checkExpressionCached(node.initializer);
}
}
- if (node.kind === 186 /* BindingElement */) {
- if (node.parent.kind === 184 /* ObjectBindingPattern */ && languageVersion < 7 /* ESNext */) {
+ if (node.kind === 187 /* BindingElement */) {
+ if (node.parent.kind === 185 /* ObjectBindingPattern */ && languageVersion < 8 /* ESNext */) {
checkExternalEmitHelpers(node, 4 /* Rest */);
}
// check computed properties inside property names of binding elements
- if (node.propertyName && node.propertyName.kind === 149 /* ComputedPropertyName */) {
+ if (node.propertyName && node.propertyName.kind === 150 /* ComputedPropertyName */) {
checkComputedPropertyName(node.propertyName);
}
// check private/protected variable access
@@ -55255,35 +56079,48 @@
var property = getPropertyOfType(parentType, nameText);
if (property) {
markPropertyAsReferenced(property, /*nodeForCheckWriteOnly*/ undefined, /*isThisAccess*/ false); // A destructuring is never a write-only reference.
- checkPropertyAccessibility(parent, !!parent.initializer && parent.initializer.kind === 98 /* SuperKeyword */, parentType, property);
+ checkPropertyAccessibility(parent, !!parent.initializer && parent.initializer.kind === 99 /* SuperKeyword */, parentType, property);
}
}
}
}
// For a binding pattern, check contained binding elements
if (ts.isBindingPattern(node.name)) {
- if (node.name.kind === 185 /* ArrayBindingPattern */ && languageVersion < 2 /* ES2015 */ && compilerOptions.downlevelIteration) {
+ if (node.name.kind === 186 /* ArrayBindingPattern */ && languageVersion < 2 /* ES2015 */ && compilerOptions.downlevelIteration) {
checkExternalEmitHelpers(node, 512 /* Read */);
}
ts.forEach(node.name.elements, checkSourceElement);
}
// For a parameter declaration with an initializer, error and exit if the containing function doesn't have a body
- if (node.initializer && ts.getRootDeclaration(node).kind === 151 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) {
+ if (node.initializer && ts.getRootDeclaration(node).kind === 152 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) {
error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation);
return;
}
// For a binding pattern, validate the initializer and exit
if (ts.isBindingPattern(node.name)) {
+ var needCheckInitializer = node.initializer && node.parent.parent.kind !== 227 /* ForInStatement */;
+ var needCheckWidenedType = node.name.elements.length === 0;
+ if (needCheckInitializer || needCheckWidenedType) {
// Don't validate for-in initializer as it is already an error
- if (node.initializer && node.parent.parent.kind !== 226 /* ForInStatement */) {
+ var widenedType = getWidenedTypeForVariableLikeDeclaration(node);
+ if (needCheckInitializer) {
var initializerType = checkExpressionCached(node.initializer);
- if (strictNullChecks && node.name.elements.length === 0) {
- checkNonNullType(initializerType, node);
+ if (strictNullChecks && needCheckWidenedType) {
+ checkNonNullNonVoidType(initializerType, node);
}
else {
checkTypeAssignableToAndOptionallyElaborate(initializerType, getWidenedTypeForVariableLikeDeclaration(node), node, node.initializer);
}
- checkParameterInitializer(node);
+ }
+ // check the binding pattern with empty elements
+ if (needCheckWidenedType) {
+ if (ts.isArrayBindingPattern(node.name)) {
+ checkIteratedTypeOrElementType(widenedType, node, /* allowStringInput */ false, /* allowAsyncIterables */ false);
+ }
+ else if (strictNullChecks) {
+ checkNonNullNonVoidType(widenedType, node);
+ }
+ }
}
return;
}
@@ -55298,9 +56135,8 @@
ts.isObjectLiteralExpression(initializer) &&
(initializer.properties.length === 0 || ts.isPrototypeAccess(node.name)) &&
ts.hasEntries(symbol.exports);
- if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 226 /* ForInStatement */) {
+ if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 227 /* ForInStatement */) {
checkTypeAssignableToAndOptionallyElaborate(checkExpressionCached(initializer), type, node, initializer, /*headMessage*/ undefined);
- checkParameterInitializer(node);
}
}
if (symbol.declarations.length > 1) {
@@ -55316,7 +56152,7 @@
if (type !== errorType && declarationType !== errorType &&
!isTypeIdenticalTo(type, declarationType) &&
!(symbol.flags & 67108864 /* Assignment */)) {
- errorNextVariableOrPropertyDeclarationMustHaveSameType(type, node, declarationType);
+ errorNextVariableOrPropertyDeclarationMustHaveSameType(symbol.valueDeclaration, type, node, declarationType);
}
if (node.initializer) {
checkTypeAssignableToAndOptionallyElaborate(checkExpressionCached(node.initializer), declarationType, node, node.initializer, /*headMessage*/ undefined);
@@ -55325,26 +56161,30 @@
error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name));
}
}
- if (node.kind !== 154 /* PropertyDeclaration */ && node.kind !== 153 /* PropertySignature */) {
+ if (node.kind !== 155 /* PropertyDeclaration */ && node.kind !== 154 /* PropertySignature */) {
// We know we don't have a binding pattern or computed name here
checkExportsOnMergedDeclarations(node);
- if (node.kind === 237 /* VariableDeclaration */ || node.kind === 186 /* BindingElement */) {
+ if (node.kind === 238 /* VariableDeclaration */ || node.kind === 187 /* BindingElement */) {
checkVarDeclaredNamesNotShadowed(node);
}
checkCollisionWithRequireExportsInGeneratedCode(node, node.name);
checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name);
}
}
- function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstType, nextDeclaration, nextType) {
+ function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstDeclaration, firstType, nextDeclaration, nextType) {
var nextDeclarationName = ts.getNameOfDeclaration(nextDeclaration);
- var message = nextDeclaration.kind === 154 /* PropertyDeclaration */ || nextDeclaration.kind === 153 /* PropertySignature */
+ var message = nextDeclaration.kind === 155 /* PropertyDeclaration */ || nextDeclaration.kind === 154 /* PropertySignature */
? ts.Diagnostics.Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2
: ts.Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2;
- error(nextDeclarationName, message, ts.declarationNameToString(nextDeclarationName), typeToString(firstType), typeToString(nextType));
+ var declName = ts.declarationNameToString(nextDeclarationName);
+ var err = error(nextDeclarationName, message, declName, typeToString(firstType), typeToString(nextType));
+ if (firstDeclaration) {
+ ts.addRelatedInfo(err, ts.createDiagnosticForNode(firstDeclaration, ts.Diagnostics._0_was_also_declared_here, declName));
+ }
}
function areDeclarationFlagsIdentical(left, right) {
- if ((left.kind === 151 /* Parameter */ && right.kind === 237 /* VariableDeclaration */) ||
- (left.kind === 237 /* VariableDeclaration */ && right.kind === 151 /* Parameter */)) {
+ if ((left.kind === 152 /* Parameter */ && right.kind === 238 /* VariableDeclaration */) ||
+ (left.kind === 238 /* VariableDeclaration */ && right.kind === 152 /* Parameter */)) {
// Differences in optionality between parameters and variables are allowed.
return true;
}
@@ -55383,7 +56223,7 @@
checkGrammarStatementInAmbientContext(node);
checkTruthinessExpression(node.expression);
checkSourceElement(node.thenStatement);
- if (node.thenStatement.kind === 220 /* EmptyStatement */) {
+ if (node.thenStatement.kind === 221 /* EmptyStatement */) {
error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement);
}
checkSourceElement(node.elseStatement);
@@ -55410,12 +56250,12 @@
function checkForStatement(node) {
// Grammar checking
if (!checkGrammarStatementInAmbientContext(node)) {
- if (node.initializer && node.initializer.kind === 238 /* VariableDeclarationList */) {
+ if (node.initializer && node.initializer.kind === 239 /* VariableDeclarationList */) {
checkGrammarVariableDeclarationList(node.initializer);
}
}
if (node.initializer) {
- if (node.initializer.kind === 238 /* VariableDeclarationList */) {
+ if (node.initializer.kind === 239 /* VariableDeclarationList */) {
ts.forEach(node.initializer.declarations, checkVariableDeclaration);
}
else {
@@ -55435,7 +56275,7 @@
checkGrammarForInOrForOfStatement(node);
if (node.awaitModifier) {
var functionFlags = ts.getFunctionFlags(ts.getContainingFunction(node));
- if ((functionFlags & (4 /* Invalid */ | 2 /* Async */)) === 2 /* Async */ && languageVersion < 7 /* ESNext */) {
+ if ((functionFlags & (4 /* Invalid */ | 2 /* Async */)) === 2 /* Async */ && languageVersion < 8 /* ESNext */) {
// for..await..of in an async function or async generator function prior to ESNext requires the __asyncValues helper
checkExternalEmitHelpers(node, 16384 /* ForAwaitOfIncludes */);
}
@@ -55449,14 +56289,14 @@
// via checkRightHandSideOfForOf.
// If the LHS is an expression, check the LHS, as a destructuring assignment or as a reference.
// Then check that the RHS is assignable to it.
- if (node.initializer.kind === 238 /* VariableDeclarationList */) {
+ if (node.initializer.kind === 239 /* VariableDeclarationList */) {
checkForInOrForOfVariableDeclaration(node);
}
else {
var varExpr = node.initializer;
var iteratedType = checkRightHandSideOfForOf(node.expression, node.awaitModifier);
// There may be a destructuring assignment on the left side
- if (varExpr.kind === 187 /* ArrayLiteralExpression */ || varExpr.kind === 188 /* ObjectLiteralExpression */) {
+ if (varExpr.kind === 188 /* ArrayLiteralExpression */ || varExpr.kind === 189 /* ObjectLiteralExpression */) {
// iteratedType may be undefined. In this case, we still want to check the structure of
// varExpr, in particular making sure it's a valid LeftHandSideExpression. But we'd like
// to short circuit the type relation checking as much as possible, so we pass the unknownType.
@@ -55488,7 +56328,7 @@
// for (let VarDecl in Expr) Statement
// VarDecl must be a variable declaration without a type annotation that declares a variable of type Any,
// and Expr must be an expression of type Any, an object type, or a type parameter type.
- if (node.initializer.kind === 238 /* VariableDeclarationList */) {
+ if (node.initializer.kind === 239 /* VariableDeclarationList */) {
var variable = node.initializer.declarations[0];
if (variable && ts.isBindingPattern(variable.name)) {
error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);
@@ -55502,7 +56342,7 @@
// and Expr must be an expression of type Any, an object type, or a type parameter type.
var varExpr = node.initializer;
var leftType = checkExpression(varExpr);
- if (varExpr.kind === 187 /* ArrayLiteralExpression */ || varExpr.kind === 188 /* ObjectLiteralExpression */) {
+ if (varExpr.kind === 188 /* ArrayLiteralExpression */ || varExpr.kind === 189 /* ObjectLiteralExpression */) {
error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);
}
else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) {
@@ -55862,12 +56702,12 @@
// for generators.
return;
}
- else if (func.kind === 159 /* SetAccessor */) {
+ else if (func.kind === 160 /* SetAccessor */) {
if (node.expression) {
error(node, ts.Diagnostics.Setters_cannot_return_a_value);
}
}
- else if (func.kind === 157 /* Constructor */) {
+ else if (func.kind === 158 /* Constructor */) {
if (node.expression && !checkTypeAssignableToAndOptionallyElaborate(exprType, returnType, node, node.expression)) {
error(node, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class);
}
@@ -55888,7 +56728,7 @@
}
}
}
- else if (func.kind !== 157 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType) && !isGenerator) {
+ else if (func.kind !== 158 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType) && !isGenerator) {
// The function has a return type, but the return statement doesn't have an expression.
error(node, ts.Diagnostics.Not_all_code_paths_return_a_value);
}
@@ -55917,7 +56757,7 @@
var expressionIsLiteral = isLiteralType(expressionType);
ts.forEach(node.caseBlock.clauses, function (clause) {
// Grammar check for duplicate default clauses, skip if we already report duplicate default clause
- if (clause.kind === 272 /* DefaultClause */ && !hasDuplicateDefaultClause) {
+ if (clause.kind === 273 /* DefaultClause */ && !hasDuplicateDefaultClause) {
if (firstDefaultClause === undefined) {
firstDefaultClause = clause;
}
@@ -55929,7 +56769,7 @@
hasDuplicateDefaultClause = true;
}
}
- if (produceDiagnostics && clause.kind === 271 /* CaseClause */) {
+ if (produceDiagnostics && clause.kind === 272 /* CaseClause */) {
// TypeScript 1.0 spec (April 2014): 5.9
// In a 'switch' statement, each 'case' expression must be of a type that is comparable
// to or from the type of the 'switch' expression.
@@ -55958,7 +56798,7 @@
if (ts.isFunctionLike(current)) {
return "quit";
}
- if (current.kind === 233 /* LabeledStatement */ && current.label.escapedText === node.label.escapedText) {
+ if (current.kind === 234 /* LabeledStatement */ && current.label.escapedText === node.label.escapedText) {
grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNode(node.label));
return true;
}
@@ -56065,8 +56905,8 @@
// this allows us to rule out cases when both property and indexer are inherited from the base class
var errorNode;
if (propDeclaration && name &&
- (propDeclaration.kind === 204 /* BinaryExpression */ ||
- name.kind === 149 /* ComputedPropertyName */ ||
+ (propDeclaration.kind === 205 /* BinaryExpression */ ||
+ name.kind === 150 /* ComputedPropertyName */ ||
prop.parent === containingType.symbol)) {
errorNode = propDeclaration;
}
@@ -56143,7 +56983,7 @@
function checkTypeParametersNotReferenced(root, typeParameters, index) {
visit(root);
function visit(node) {
- if (node.kind === 164 /* TypeReference */) {
+ if (node.kind === 165 /* TypeReference */) {
var type = getTypeFromTypeReference(node);
if (type.flags & 262144 /* TypeParameter */) {
for (var i = index; i < typeParameters.length; i++) {
@@ -56265,6 +57105,11 @@
if (languageVersion < 2 /* ES2015 */) {
checkExternalEmitHelpers(baseTypeNode.parent, 1 /* Extends */);
}
+ // check both @extends and extends if both are specified.
+ var extendsNode = ts.getClassExtendsHeritageElement(node);
+ if (extendsNode && extendsNode !== baseTypeNode) {
+ checkExpression(extendsNode.expression);
+ }
var baseTypes = getBaseTypes(type);
if (baseTypes.length && produceDiagnostics) {
var baseType_1 = baseTypes[0];
@@ -56272,10 +57117,6 @@
var staticBaseType = getApparentType(baseConstructorType);
checkBaseTypeAccessibility(staticBaseType, baseTypeNode);
checkSourceElement(baseTypeNode.expression);
- var extendsNode = ts.getClassExtendsHeritageElement(node);
- if (extendsNode && extendsNode !== baseTypeNode) {
- checkExpression(extendsNode.expression);
- }
if (ts.some(baseTypeNode.typeArguments)) {
ts.forEach(baseTypeNode.typeArguments, checkSourceElement);
for (var _i = 0, _a = getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode); _i < _a.length; _i++) {
@@ -56346,7 +57187,7 @@
function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
// iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
var issuedMemberError = false;
- var _loop_9 = function (member) {
+ var _loop_12 = function (member) {
if (ts.hasStaticModifier(member)) {
return "continue";
}
@@ -56365,7 +57206,7 @@
};
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
- _loop_9(member);
+ _loop_12(member);
}
if (!issuedMemberError) {
// check again with diagnostics to generate a less-specific error
@@ -56391,7 +57232,7 @@
}
function getClassOrInterfaceDeclarationsOfSymbol(symbol) {
return ts.filter(symbol.declarations, function (d) {
- return d.kind === 240 /* ClassDeclaration */ || d.kind === 241 /* InterfaceDeclaration */;
+ return d.kind === 241 /* ClassDeclaration */ || d.kind === 242 /* InterfaceDeclaration */;
});
}
function checkKindsOfPropertyMemberOverrides(type, baseType) {
@@ -56430,7 +57271,7 @@
// If there is no declaration for the derived class (as in the case of class expressions),
// then the class cannot be declared abstract.
if (baseDeclarationFlags & 128 /* Abstract */ && (!derivedClassDecl || !ts.hasModifier(derivedClassDecl, 128 /* Abstract */))) {
- if (derivedClassDecl.kind === 209 /* ClassExpression */) {
+ if (derivedClassDecl.kind === 210 /* ClassExpression */) {
error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType));
}
else {
@@ -56480,8 +57321,8 @@
for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) {
var base = baseTypes_2[_i];
var properties = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType));
- for (var _a = 0, properties_6 = properties; _a < properties_6.length; _a++) {
- var prop = properties_6[_a];
+ for (var _a = 0, properties_4 = properties; _a < properties_4.length; _a++) {
+ var prop = properties_4[_a];
var existing = seen.get(prop.escapedName);
if (!existing) {
seen.set(prop.escapedName, { prop: prop, containingType: base });
@@ -56522,7 +57363,7 @@
}
}
function isInstancePropertyWithoutInitializer(node) {
- return node.kind === 154 /* PropertyDeclaration */ &&
+ return node.kind === 155 /* PropertyDeclaration */ &&
!ts.hasModifier(node, 32 /* Static */ | 128 /* Abstract */) &&
!node.exclamationToken &&
!node.initializer;
@@ -56546,7 +57387,7 @@
var symbol = getSymbolOfNode(node);
checkTypeParameterListsIdentical(symbol);
// Only check this symbol once
- var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 241 /* InterfaceDeclaration */);
+ var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 242 /* InterfaceDeclaration */);
if (node === firstInterfaceDecl) {
var type = getDeclaredTypeOfSymbol(symbol);
var typeWithThis = getTypeWithThisArgument(type);
@@ -56651,7 +57492,7 @@
return value;
function evaluate(expr) {
switch (expr.kind) {
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
var value_2 = evaluate(expr.operand);
if (typeof value_2 === "number") {
switch (expr.operator) {
@@ -56661,7 +57502,7 @@
}
}
break;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
var left = evaluate(expr.left);
var right = evaluate(expr.right);
if (typeof left === "number" && typeof right === "number") {
@@ -56689,22 +57530,22 @@
case 8 /* NumericLiteral */:
checkGrammarNumericLiteral(expr);
return +expr.text;
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return evaluate(expr.expression);
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
var identifier = expr;
if (isInfinityOrNaNString(identifier.escapedText)) {
return +(identifier.escapedText);
}
return ts.nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), identifier.escapedText);
- case 190 /* ElementAccessExpression */:
- case 189 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
var ex = expr;
if (isConstantMemberAccess(ex)) {
var type = getTypeOfExpression(ex.expression);
if (type.symbol && type.symbol.flags & 384 /* Enum */) {
var name = void 0;
- if (ex.kind === 189 /* PropertyAccessExpression */) {
+ if (ex.kind === 190 /* PropertyAccessExpression */) {
name = ex.name.escapedText;
}
else {
@@ -56735,9 +57576,9 @@
}
}
function isConstantMemberAccess(node) {
- return node.kind === 72 /* Identifier */ ||
- node.kind === 189 /* PropertyAccessExpression */ && isConstantMemberAccess(node.expression) ||
- node.kind === 190 /* ElementAccessExpression */ && isConstantMemberAccess(node.expression) &&
+ return node.kind === 73 /* Identifier */ ||
+ node.kind === 190 /* PropertyAccessExpression */ && isConstantMemberAccess(node.expression) ||
+ node.kind === 191 /* ElementAccessExpression */ && isConstantMemberAccess(node.expression) &&
node.argumentExpression.kind === 10 /* StringLiteral */;
}
function checkEnumDeclaration(node) {
@@ -56772,7 +57613,7 @@
var seenEnumMissingInitialInitializer_1 = false;
ts.forEach(enumSymbol.declarations, function (declaration) {
// return true if we hit a violation of the rule, false otherwise
- if (declaration.kind !== 243 /* EnumDeclaration */) {
+ if (declaration.kind !== 244 /* EnumDeclaration */) {
return false;
}
var enumDeclaration = declaration;
@@ -56795,8 +57636,8 @@
var declarations = symbol.declarations;
for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) {
var declaration = declarations_8[_i];
- if ((declaration.kind === 240 /* ClassDeclaration */ ||
- (declaration.kind === 239 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) &&
+ if ((declaration.kind === 241 /* ClassDeclaration */ ||
+ (declaration.kind === 240 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) &&
!(declaration.flags & 4194304 /* Ambient */)) {
return declaration;
}
@@ -56859,7 +57700,7 @@
}
// if the module merges with a class declaration in the same lexical scope,
// we need to track this to ensure the correct emit.
- var mergedClass = ts.getDeclarationOfKind(symbol, 240 /* ClassDeclaration */);
+ var mergedClass = ts.getDeclarationOfKind(symbol, 241 /* ClassDeclaration */);
if (mergedClass &&
inSameLexicalScope(node, mergedClass)) {
getNodeLinks(node).flags |= 32768 /* LexicalModuleMergesWithClass */;
@@ -56909,23 +57750,23 @@
}
function checkModuleAugmentationElement(node, isGlobalAugmentation) {
switch (node.kind) {
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
// error each individual name in variable statement instead of marking the entire variable statement
for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {
var decl = _a[_i];
checkModuleAugmentationElement(decl, isGlobalAugmentation);
}
break;
- case 254 /* ExportAssignment */:
- case 255 /* ExportDeclaration */:
+ case 255 /* ExportAssignment */:
+ case 256 /* ExportDeclaration */:
grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations);
break;
- case 248 /* ImportEqualsDeclaration */:
- case 249 /* ImportDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 250 /* ImportDeclaration */:
grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module);
break;
- case 186 /* BindingElement */:
- case 237 /* VariableDeclaration */:
+ case 187 /* BindingElement */:
+ case 238 /* VariableDeclaration */:
var name = node.name;
if (ts.isBindingPattern(name)) {
for (var _b = 0, _c = name.elements; _b < _c.length; _b++) {
@@ -56936,12 +57777,12 @@
break;
}
// falls through
- case 240 /* ClassDeclaration */:
- case 243 /* EnumDeclaration */:
- case 239 /* FunctionDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 242 /* TypeAliasDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
if (isGlobalAugmentation) {
return;
}
@@ -56962,17 +57803,17 @@
}
function getFirstIdentifier(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return node;
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
do {
node = node.left;
- } while (node.kind !== 72 /* Identifier */);
+ } while (node.kind !== 73 /* Identifier */);
return node;
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
do {
node = node.expression;
- } while (node.kind !== 72 /* Identifier */);
+ } while (node.kind !== 73 /* Identifier */);
return node;
}
}
@@ -56986,9 +57827,9 @@
error(moduleName, ts.Diagnostics.String_literal_expected);
return false;
}
- var inAmbientExternalModule = node.parent.kind === 245 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent);
- if (node.parent.kind !== 284 /* SourceFile */ && !inAmbientExternalModule) {
- error(moduleName, node.kind === 255 /* ExportDeclaration */ ?
+ var inAmbientExternalModule = node.parent.kind === 246 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent);
+ if (node.parent.kind !== 285 /* SourceFile */ && !inAmbientExternalModule) {
+ error(moduleName, node.kind === 256 /* ExportDeclaration */ ?
ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace :
ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module);
return false;
@@ -57021,14 +57862,14 @@
(symbol.flags & 67897832 /* Type */ ? 67897832 /* Type */ : 0) |
(symbol.flags & 1920 /* Namespace */ ? 1920 /* Namespace */ : 0);
if (target.flags & excludedMeanings) {
- var message = node.kind === 257 /* ExportSpecifier */ ?
+ var message = node.kind === 258 /* ExportSpecifier */ ?
ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 :
ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0;
error(node, message, symbolToString(symbol));
}
// Don't allow to re-export something with no value side when `--isolatedModules` is set.
if (compilerOptions.isolatedModules
- && node.kind === 257 /* ExportSpecifier */
+ && node.kind === 258 /* ExportSpecifier */
&& !(target.flags & 67220415 /* Value */)
&& !(node.flags & 4194304 /* Ambient */)) {
error(node, ts.Diagnostics.Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided);
@@ -57055,7 +57896,7 @@
checkImportBinding(importClause);
}
if (importClause.namedBindings) {
- if (importClause.namedBindings.kind === 251 /* NamespaceImport */) {
+ if (importClause.namedBindings.kind === 252 /* NamespaceImport */) {
checkImportBinding(importClause.namedBindings);
}
else {
@@ -57079,7 +57920,7 @@
if (ts.hasModifier(node, 1 /* Export */)) {
markExportAsReferenced(node);
}
- if (node.moduleReference.kind !== 259 /* ExternalModuleReference */) {
+ if (node.moduleReference.kind !== 260 /* ExternalModuleReference */) {
var target = resolveAlias(getSymbolOfNode(node));
if (target !== unknownSymbol) {
if (target.flags & 67220415 /* Value */) {
@@ -57115,10 +57956,10 @@
// export { x, y }
// export { x, y } from "foo"
ts.forEach(node.exportClause.elements, checkExportSpecifier);
- var inAmbientExternalModule = node.parent.kind === 245 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent);
- var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 245 /* ModuleBlock */ &&
+ var inAmbientExternalModule = node.parent.kind === 246 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent);
+ var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 246 /* ModuleBlock */ &&
!node.moduleSpecifier && node.flags & 4194304 /* Ambient */;
- if (node.parent.kind !== 284 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) {
+ if (node.parent.kind !== 285 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) {
error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace);
}
}
@@ -57135,7 +57976,7 @@
}
}
function checkGrammarModuleElementContext(node, errorMessage) {
- var isInAppropriateContext = node.parent.kind === 284 /* SourceFile */ || node.parent.kind === 245 /* ModuleBlock */ || node.parent.kind === 244 /* ModuleDeclaration */;
+ var isInAppropriateContext = node.parent.kind === 285 /* SourceFile */ || node.parent.kind === 246 /* ModuleBlock */ || node.parent.kind === 245 /* ModuleDeclaration */;
if (!isInAppropriateContext) {
grammarErrorOnFirstToken(node, errorMessage);
}
@@ -57164,8 +58005,8 @@
// If we hit an export assignment in an illegal context, just bail out to avoid cascading errors.
return;
}
- var container = node.parent.kind === 284 /* SourceFile */ ? node.parent : node.parent.parent;
- if (container.kind === 244 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) {
+ var container = node.parent.kind === 285 /* SourceFile */ ? node.parent : node.parent.parent;
+ if (container.kind === 245 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) {
if (node.isExportEquals) {
error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace);
}
@@ -57178,7 +58019,7 @@
if (!checkGrammarDecoratorsAndModifiers(node) && ts.hasModifiers(node)) {
grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers);
}
- if (node.expression.kind === 72 /* Identifier */) {
+ if (node.expression.kind === 73 /* Identifier */) {
markExportAsReferenced(node);
if (ts.getEmitDeclarations(compilerOptions)) {
collectLinkedAliases(node.expression, /*setVisibility*/ true);
@@ -57253,7 +58094,7 @@
return !ts.isAccessor(declaration);
}
function isNotOverload(declaration) {
- return (declaration.kind !== 239 /* FunctionDeclaration */ && declaration.kind !== 156 /* MethodDeclaration */) ||
+ return (declaration.kind !== 240 /* FunctionDeclaration */ && declaration.kind !== 157 /* MethodDeclaration */) ||
!!declaration.body;
}
function checkSourceElement(node) {
@@ -57276,158 +58117,158 @@
// Only bother checking on a few construct kinds. We don't want to be excessively
// hitting the cancellation token on every node we check.
switch (kind) {
- case 244 /* ModuleDeclaration */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 239 /* FunctionDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 240 /* FunctionDeclaration */:
cancellationToken.throwIfCancellationRequested();
}
}
switch (kind) {
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
return checkTypeParameter(node);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return checkParameter(node);
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
return checkPropertyDeclaration(node);
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
return checkSignatureDeclaration(node);
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
return checkMethodDeclaration(node);
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return checkConstructorDeclaration(node);
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return checkAccessorDeclaration(node);
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return checkTypeReferenceNode(node);
- case 163 /* TypePredicate */:
+ case 164 /* TypePredicate */:
return checkTypePredicate(node);
- case 167 /* TypeQuery */:
+ case 168 /* TypeQuery */:
return checkTypeQuery(node);
- case 168 /* TypeLiteral */:
+ case 169 /* TypeLiteral */:
return checkTypeLiteral(node);
- case 169 /* ArrayType */:
+ case 170 /* ArrayType */:
return checkArrayType(node);
- case 170 /* TupleType */:
+ case 171 /* TupleType */:
return checkTupleType(node);
- case 173 /* UnionType */:
- case 174 /* IntersectionType */:
+ case 174 /* UnionType */:
+ case 175 /* IntersectionType */:
return checkUnionOrIntersectionType(node);
- case 177 /* ParenthesizedType */:
- case 171 /* OptionalType */:
- case 172 /* RestType */:
+ case 178 /* ParenthesizedType */:
+ case 172 /* OptionalType */:
+ case 173 /* RestType */:
return checkSourceElement(node.type);
- case 178 /* ThisType */:
+ case 179 /* ThisType */:
return checkThisType(node);
- case 179 /* TypeOperator */:
+ case 180 /* TypeOperator */:
return checkTypeOperator(node);
- case 175 /* ConditionalType */:
+ case 176 /* ConditionalType */:
return checkConditionalType(node);
- case 176 /* InferType */:
+ case 177 /* InferType */:
return checkInferType(node);
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return checkImportType(node);
- case 300 /* JSDocAugmentsTag */:
+ case 301 /* JSDocAugmentsTag */:
return checkJSDocAugmentsTag(node);
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
return checkJSDocTypeAliasTag(node);
- case 308 /* JSDocTemplateTag */:
+ case 309 /* JSDocTemplateTag */:
return checkJSDocTemplateTag(node);
- case 307 /* JSDocTypeTag */:
+ case 308 /* JSDocTypeTag */:
return checkJSDocTypeTag(node);
- case 304 /* JSDocParameterTag */:
+ case 305 /* JSDocParameterTag */:
return checkJSDocParameterTag(node);
- case 294 /* JSDocFunctionType */:
+ case 295 /* JSDocFunctionType */:
checkJSDocFunctionType(node);
// falls through
- case 292 /* JSDocNonNullableType */:
- case 291 /* JSDocNullableType */:
- case 289 /* JSDocAllType */:
- case 290 /* JSDocUnknownType */:
- case 297 /* JSDocTypeLiteral */:
+ case 293 /* JSDocNonNullableType */:
+ case 292 /* JSDocNullableType */:
+ case 290 /* JSDocAllType */:
+ case 291 /* JSDocUnknownType */:
+ case 298 /* JSDocTypeLiteral */:
checkJSDocTypeIsInJsFile(node);
ts.forEachChild(node, checkSourceElement);
return;
- case 295 /* JSDocVariadicType */:
+ case 296 /* JSDocVariadicType */:
checkJSDocVariadicType(node);
return;
- case 288 /* JSDocTypeExpression */:
+ case 289 /* JSDocTypeExpression */:
return checkSourceElement(node.type);
- case 180 /* IndexedAccessType */:
+ case 181 /* IndexedAccessType */:
return checkIndexedAccessType(node);
- case 181 /* MappedType */:
+ case 182 /* MappedType */:
return checkMappedType(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return checkFunctionDeclaration(node);
- case 218 /* Block */:
- case 245 /* ModuleBlock */:
+ case 219 /* Block */:
+ case 246 /* ModuleBlock */:
return checkBlock(node);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return checkVariableStatement(node);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return checkExpressionStatement(node);
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
return checkIfStatement(node);
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
return checkDoStatement(node);
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
return checkWhileStatement(node);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return checkForStatement(node);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return checkForInStatement(node);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return checkForOfStatement(node);
- case 228 /* ContinueStatement */:
- case 229 /* BreakStatement */:
+ case 229 /* ContinueStatement */:
+ case 230 /* BreakStatement */:
return checkBreakOrContinueStatement(node);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return checkReturnStatement(node);
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
return checkWithStatement(node);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return checkSwitchStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return checkLabeledStatement(node);
- case 234 /* ThrowStatement */:
+ case 235 /* ThrowStatement */:
return checkThrowStatement(node);
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
return checkTryStatement(node);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return checkVariableDeclaration(node);
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return checkBindingElement(node);
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return checkClassDeclaration(node);
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
return checkInterfaceDeclaration(node);
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return checkTypeAliasDeclaration(node);
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return checkEnumDeclaration(node);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return checkModuleDeclaration(node);
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return checkImportDeclaration(node);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return checkImportEqualsDeclaration(node);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return checkExportDeclaration(node);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return checkExportAssignment(node);
- case 220 /* EmptyStatement */:
- case 236 /* DebuggerStatement */:
+ case 221 /* EmptyStatement */:
+ case 237 /* DebuggerStatement */:
checkGrammarStatementInAmbientContext(node);
return;
- case 258 /* MissingDeclaration */:
+ case 259 /* MissingDeclaration */:
return checkMissingDeclaration(node);
}
}
@@ -57521,23 +58362,23 @@
var saveCurrentNode = currentNode;
currentNode = node;
switch (node.kind) {
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
checkFunctionExpressionOrObjectLiteralMethodDeferred(node);
break;
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
checkAccessorDeclaration(node);
break;
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
checkClassExpressionDeferred(node);
break;
- case 261 /* JsxSelfClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
checkJsxSelfClosingElementDeferred(node);
break;
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
checkJsxElementDeferred(node);
break;
}
@@ -57667,17 +58508,17 @@
copySymbols(location.locals, meaning);
}
switch (location.kind) {
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
if (!ts.isExternalOrCommonJsModule(location))
break;
// falls through
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
copySymbols(getSymbolOfNode(location).exports, meaning & 2623475 /* ModuleMember */);
break;
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* EnumMember */);
break;
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
var className = location.name;
if (className) {
copySymbol(location.symbol, meaning);
@@ -57685,8 +58526,8 @@
// falls through
// this fall-through is necessary because we would like to handle
// type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
// If we didn't come from static member of class or interface,
// add the type parameters into the symbol table
// (type parameters of classDeclaration/classExpression and interface are in member property of the symbol.
@@ -57695,7 +58536,7 @@
copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & 67897832 /* Type */);
}
break;
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
var funcName = location.name;
if (funcName) {
copySymbol(location.symbol, meaning);
@@ -57737,17 +58578,17 @@
}
}
function isTypeDeclarationName(name) {
- return name.kind === 72 /* Identifier */ &&
+ return name.kind === 73 /* Identifier */ &&
isTypeDeclaration(name.parent) &&
name.parent.name === name;
}
function isTypeDeclaration(node) {
switch (node.kind) {
- case 150 /* TypeParameter */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 243 /* EnumDeclaration */:
+ case 151 /* TypeParameter */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 244 /* EnumDeclaration */:
return true;
default:
return false;
@@ -57755,16 +58596,16 @@
}
// True if the given identifier is part of a type reference
function isTypeReferenceIdentifier(node) {
- while (node.parent.kind === 148 /* QualifiedName */) {
+ while (node.parent.kind === 149 /* QualifiedName */) {
node = node.parent;
}
- return node.parent.kind === 164 /* TypeReference */;
+ return node.parent.kind === 165 /* TypeReference */;
}
function isHeritageClauseElementIdentifier(node) {
- while (node.parent.kind === 189 /* PropertyAccessExpression */) {
+ while (node.parent.kind === 190 /* PropertyAccessExpression */) {
node = node.parent;
}
- return node.parent.kind === 211 /* ExpressionWithTypeArguments */;
+ return node.parent.kind === 212 /* ExpressionWithTypeArguments */;
}
function forEachEnclosingClass(node, callback) {
var result;
@@ -57792,13 +58633,13 @@
return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; });
}
function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) {
- while (nodeOnRightSide.parent.kind === 148 /* QualifiedName */) {
+ while (nodeOnRightSide.parent.kind === 149 /* QualifiedName */) {
nodeOnRightSide = nodeOnRightSide.parent;
}
- if (nodeOnRightSide.parent.kind === 248 /* ImportEqualsDeclaration */) {
+ if (nodeOnRightSide.parent.kind === 249 /* ImportEqualsDeclaration */) {
return nodeOnRightSide.parent.moduleReference === nodeOnRightSide ? nodeOnRightSide.parent : undefined;
}
- if (nodeOnRightSide.parent.kind === 254 /* ExportAssignment */) {
+ if (nodeOnRightSide.parent.kind === 255 /* ExportAssignment */) {
return nodeOnRightSide.parent.expression === nodeOnRightSide ? nodeOnRightSide.parent : undefined;
}
return undefined;
@@ -57824,7 +58665,7 @@
node = parent;
parent = parent.parent;
}
- if (parent && parent.kind === 183 /* ImportType */ && parent.qualifier === node) {
+ if (parent && parent.kind === 184 /* ImportType */ && parent.qualifier === node) {
return parent;
}
return undefined;
@@ -57834,7 +58675,7 @@
return getSymbolOfNode(entityName.parent);
}
if (ts.isInJSFile(entityName) &&
- entityName.parent.kind === 189 /* PropertyAccessExpression */ &&
+ entityName.parent.kind === 190 /* PropertyAccessExpression */ &&
entityName.parent === entityName.parent.parent.left) {
// Check if this is a special property assignment
var specialPropertyAssignmentSymbol = getSpecialPropertyAssignmentSymbolFromEntityName(entityName);
@@ -57842,7 +58683,7 @@
return specialPropertyAssignmentSymbol;
}
}
- if (entityName.parent.kind === 254 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) {
+ if (entityName.parent.kind === 255 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) {
// Even an entity name expression that doesn't resolve as an entityname may still typecheck as a property access expression
var success = resolveEntityName(entityName,
/*all meanings*/ 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */, /*ignoreErrors*/ true);
@@ -57852,7 +58693,7 @@
}
else if (!ts.isPropertyAccessExpression(entityName) && isInRightSideOfImportOrExportAssignment(entityName)) {
// Since we already checked for ExportAssignment, this really could only be an Import
- var importEqualsDeclaration = ts.getAncestor(entityName, 248 /* ImportEqualsDeclaration */);
+ var importEqualsDeclaration = ts.getAncestor(entityName, 249 /* ImportEqualsDeclaration */);
ts.Debug.assert(importEqualsDeclaration !== undefined);
return getSymbolOfPartOfRightHandSideOfImportEquals(entityName, /*dontResolveAlias*/ true);
}
@@ -57870,7 +58711,7 @@
if (isHeritageClauseElementIdentifier(entityName)) {
var meaning = 0 /* None */;
// In an interface or class, we're definitely interested in a type.
- if (entityName.parent.kind === 211 /* ExpressionWithTypeArguments */) {
+ if (entityName.parent.kind === 212 /* ExpressionWithTypeArguments */) {
meaning = 67897832 /* Type */;
// In a class 'extends' clause we are also looking for a value.
if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) {
@@ -57886,10 +58727,10 @@
return entityNameSymbol;
}
}
- if (entityName.parent.kind === 304 /* JSDocParameterTag */) {
+ if (entityName.parent.kind === 305 /* JSDocParameterTag */) {
return ts.getParameterSymbolFromJSDoc(entityName.parent);
}
- if (entityName.parent.kind === 150 /* TypeParameter */ && entityName.parent.parent.kind === 308 /* JSDocTemplateTag */) {
+ if (entityName.parent.kind === 151 /* TypeParameter */ && entityName.parent.parent.kind === 309 /* JSDocTemplateTag */) {
ts.Debug.assert(!ts.isInJSFile(entityName)); // Otherwise `isDeclarationName` would have been true.
var typeParameter = ts.getTypeParameterFromJsDoc(entityName.parent);
return typeParameter && typeParameter.symbol;
@@ -57899,19 +58740,19 @@
// Missing entity name.
return undefined;
}
- if (entityName.kind === 72 /* Identifier */) {
+ if (entityName.kind === 73 /* Identifier */) {
if (ts.isJSXTagName(entityName) && isJsxIntrinsicIdentifier(entityName)) {
var symbol = getIntrinsicTagSymbol(entityName.parent);
return symbol === unknownSymbol ? undefined : symbol;
}
return resolveEntityName(entityName, 67220415 /* Value */, /*ignoreErrors*/ false, /*dontResolveAlias*/ true);
}
- else if (entityName.kind === 189 /* PropertyAccessExpression */ || entityName.kind === 148 /* QualifiedName */) {
+ else if (entityName.kind === 190 /* PropertyAccessExpression */ || entityName.kind === 149 /* QualifiedName */) {
var links = getNodeLinks(entityName);
if (links.resolvedSymbol) {
return links.resolvedSymbol;
}
- if (entityName.kind === 189 /* PropertyAccessExpression */) {
+ if (entityName.kind === 190 /* PropertyAccessExpression */) {
checkPropertyAccessExpression(entityName);
}
else {
@@ -57921,17 +58762,17 @@
}
}
else if (isTypeReferenceIdentifier(entityName)) {
- var meaning = entityName.parent.kind === 164 /* TypeReference */ ? 67897832 /* Type */ : 1920 /* Namespace */;
+ var meaning = entityName.parent.kind === 165 /* TypeReference */ ? 67897832 /* Type */ : 1920 /* Namespace */;
return resolveEntityName(entityName, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true);
}
- if (entityName.parent.kind === 163 /* TypePredicate */) {
+ if (entityName.parent.kind === 164 /* TypePredicate */) {
return resolveEntityName(entityName, /*meaning*/ 1 /* FunctionScopedVariable */);
}
// Do we want to return undefined here?
return undefined;
}
function getSymbolAtLocation(node) {
- if (node.kind === 284 /* SourceFile */) {
+ if (node.kind === 285 /* SourceFile */) {
return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined;
}
var parent = node.parent;
@@ -57950,12 +58791,12 @@
else if (ts.isLiteralComputedPropertyDeclarationName(node)) {
return getSymbolOfNode(parent.parent);
}
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
if (isInRightSideOfImportOrExportAssignment(node)) {
return getSymbolOfEntityNameOrPropertyAccessExpression(node);
}
- else if (parent.kind === 186 /* BindingElement */ &&
- grandParent.kind === 184 /* ObjectBindingPattern */ &&
+ else if (parent.kind === 187 /* BindingElement */ &&
+ grandParent.kind === 185 /* ObjectBindingPattern */ &&
node === parent.propertyName) {
var typeOfPattern = getTypeOfNode(grandParent);
var propertyDeclaration = getPropertyOfType(typeOfPattern, node.escapedText);
@@ -57965,11 +58806,11 @@
}
}
switch (node.kind) {
- case 72 /* Identifier */:
- case 189 /* PropertyAccessExpression */:
- case 148 /* QualifiedName */:
+ case 73 /* Identifier */:
+ case 190 /* PropertyAccessExpression */:
+ case 149 /* QualifiedName */:
return getSymbolOfEntityNameOrPropertyAccessExpression(node);
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false);
if (ts.isFunctionLike(container)) {
var sig = getSignatureFromDeclaration(container);
@@ -57981,14 +58822,14 @@
return checkExpression(node).symbol;
}
// falls through
- case 178 /* ThisType */:
+ case 179 /* ThisType */:
return getTypeFromThisTypeNode(node).symbol;
- case 98 /* SuperKeyword */:
+ case 99 /* SuperKeyword */:
return checkExpression(node).symbol;
- case 124 /* ConstructorKeyword */:
+ case 125 /* ConstructorKeyword */:
// constructor keyword for an overload, should take us to the definition if it exist
var constructorDeclaration = node.parent;
- if (constructorDeclaration && constructorDeclaration.kind === 157 /* Constructor */) {
+ if (constructorDeclaration && constructorDeclaration.kind === 158 /* Constructor */) {
return constructorDeclaration.parent.symbol;
}
return undefined;
@@ -57999,7 +58840,7 @@
// 3). Dynamic import call or require in javascript
// 4). type A = import("./f/*gotToDefinitionHere*/oo")
if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) ||
- ((node.parent.kind === 249 /* ImportDeclaration */ || node.parent.kind === 255 /* ExportDeclaration */) && node.parent.moduleSpecifier === node) ||
+ ((node.parent.kind === 250 /* ImportDeclaration */ || node.parent.kind === 256 /* ExportDeclaration */) && node.parent.moduleSpecifier === node) ||
((ts.isInJSFile(node) && ts.isRequireCall(node.parent, /*checkArgumentIsStringLiteralLike*/ false)) || ts.isImportCall(node.parent)) ||
(ts.isLiteralTypeNode(node.parent) && ts.isLiteralImportTypeNode(node.parent.parent) && node.parent.parent.argument === node.parent)) {
return resolveExternalModuleName(node, node);
@@ -58016,21 +58857,21 @@
? getTypeFromTypeNode(grandParent.objectType)
: undefined;
return objectType && getPropertyOfType(objectType, ts.escapeLeadingUnderscores(node.text));
- case 80 /* DefaultKeyword */:
- case 90 /* FunctionKeyword */:
+ case 81 /* DefaultKeyword */:
+ case 91 /* FunctionKeyword */:
case 37 /* EqualsGreaterThanToken */:
- case 76 /* ClassKeyword */:
+ case 77 /* ClassKeyword */:
return getSymbolOfNode(node.parent);
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return ts.isLiteralImportTypeNode(node) ? getSymbolAtLocation(node.argument.literal) : undefined;
- case 85 /* ExportKeyword */:
+ case 86 /* ExportKeyword */:
return ts.isExportAssignment(node.parent) ? ts.Debug.assertDefined(node.parent.symbol) : undefined;
default:
return undefined;
}
}
function getShorthandAssignmentValueSymbol(location) {
- if (location && location.kind === 276 /* ShorthandPropertyAssignment */) {
+ if (location && location.kind === 277 /* ShorthandPropertyAssignment */) {
return resolveEntityName(location.name, 67220415 /* Value */ | 2097152 /* Alias */);
}
return undefined;
@@ -58097,33 +58938,35 @@
// }
// [ a ] from
// [a] = [ some array ...]
- function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr) {
- ts.Debug.assert(expr.kind === 188 /* ObjectLiteralExpression */ || expr.kind === 187 /* ArrayLiteralExpression */);
+ function getTypeOfAssignmentPattern(expr) {
+ ts.Debug.assert(expr.kind === 189 /* ObjectLiteralExpression */ || expr.kind === 188 /* ArrayLiteralExpression */);
// If this is from "for of"
// for ( { a } of elems) {
// }
- if (expr.parent.kind === 227 /* ForOfStatement */) {
+ if (expr.parent.kind === 228 /* ForOfStatement */) {
var iteratedType = checkRightHandSideOfForOf(expr.parent.expression, expr.parent.awaitModifier);
return checkDestructuringAssignment(expr, iteratedType || errorType);
}
// If this is from "for" initializer
// for ({a } = elems[0];.....) { }
- if (expr.parent.kind === 204 /* BinaryExpression */) {
+ if (expr.parent.kind === 205 /* BinaryExpression */) {
var iteratedType = getTypeOfExpression(expr.parent.right);
return checkDestructuringAssignment(expr, iteratedType || errorType);
}
// If this is from nested object binding pattern
// for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) {
- if (expr.parent.kind === 275 /* PropertyAssignment */) {
- var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent);
- return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || errorType, expr.parent); // TODO: GH#18217
+ if (expr.parent.kind === 276 /* PropertyAssignment */) {
+ var node_3 = ts.cast(expr.parent.parent, ts.isObjectLiteralExpression);
+ var typeOfParentObjectLiteral = getTypeOfAssignmentPattern(node_3) || errorType;
+ var propertyIndex = ts.indexOfNode(node_3.properties, expr.parent);
+ return checkObjectLiteralDestructuringPropertyAssignment(node_3, typeOfParentObjectLiteral, propertyIndex);
}
// Array literal assignment - array destructuring pattern
- ts.Debug.assert(expr.parent.kind === 187 /* ArrayLiteralExpression */);
+ var node = ts.cast(expr.parent, ts.isArrayLiteralExpression);
// [{ property1: p1, property2 }] = elems;
- var typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent);
- var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || errorType, expr.parent, /*allowStringInput*/ false, /*allowAsyncIterables*/ false) || errorType;
- return checkArrayLiteralDestructuringElementAssignment(expr.parent, typeOfArrayLiteral, expr.parent.elements.indexOf(expr), elementType || errorType); // TODO: GH#18217
+ var typeOfArrayLiteral = getTypeOfAssignmentPattern(node) || errorType;
+ var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral, expr.parent, /*allowStringInput*/ false, /*allowAsyncIterables*/ false) || errorType;
+ return checkArrayLiteralDestructuringElementAssignment(node, typeOfArrayLiteral, node.elements.indexOf(expr), elementType);
}
// Gets the property symbol corresponding to the property in destructuring assignment
// 'property1' from
@@ -58133,7 +58976,7 @@
// [a] = [ property1, property2 ]
function getPropertySymbolOfDestructuringAssignment(location) {
// Get the type of the object or array literal and then look for property of given name in the type
- var typeOfObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(location.parent.parent);
+ var typeOfObjectLiteral = getTypeOfAssignmentPattern(ts.cast(location.parent.parent, ts.isAssignmentPattern));
return typeOfObjectLiteral && getPropertyOfType(typeOfObjectLiteral, location.escapedText);
}
function getRegularTypeOfExpression(expr) {
@@ -58155,12 +58998,12 @@
function getClassElementPropertyKeyType(element) {
var name = element.name;
switch (name.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return getLiteralType(ts.idText(name));
case 8 /* NumericLiteral */:
case 10 /* StringLiteral */:
return getLiteralType(name.text);
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
var nameType = checkComputedPropertyName(name);
return isTypeAssignableToKind(nameType, 12288 /* ESSymbolLike */) ? nameType : stringType;
default:
@@ -58217,7 +59060,7 @@
if (!ts.isGeneratedIdentifier(nodeIn)) {
var node = ts.getParseTreeNode(nodeIn, ts.isIdentifier);
if (node) {
- var isPropertyName_1 = node.parent.kind === 189 /* PropertyAccessExpression */ && node.parent.name === node;
+ var isPropertyName_1 = node.parent.kind === 190 /* PropertyAccessExpression */ && node.parent.name === node;
return !isPropertyName_1 && getReferencedValueSymbol(node) === argumentsSymbol;
}
}
@@ -58273,7 +59116,7 @@
}
var parentSymbol_1 = getParentOfSymbol(symbol);
if (parentSymbol_1) {
- if (parentSymbol_1.flags & 512 /* ValueModule */ && parentSymbol_1.valueDeclaration.kind === 284 /* SourceFile */) {
+ if (parentSymbol_1.flags & 512 /* ValueModule */ && parentSymbol_1.valueDeclaration.kind === 285 /* SourceFile */) {
var symbolFile = parentSymbol_1.valueDeclaration;
var referenceFile = ts.getSourceFileOfNode(node);
// If `node` accesses an export and that export isn't in the same file, then symbol is a namespace export, so return undefined.
@@ -58299,12 +59142,16 @@
}
return undefined;
}
+ function isSymbolOfDestructuredElementOfCatchBinding(symbol) {
+ return ts.isBindingElement(symbol.valueDeclaration)
+ && ts.walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 275 /* CatchClause */;
+ }
function isSymbolOfDeclarationWithCollidingName(symbol) {
if (symbol.flags & 418 /* BlockScoped */ && !ts.isSourceFile(symbol.valueDeclaration)) {
var links = getSymbolLinks(symbol);
if (links.isDeclarationWithCollidingName === undefined) {
var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration);
- if (ts.isStatementWithLocals(container)) {
+ if (ts.isStatementWithLocals(container) || isSymbolOfDestructuredElementOfCatchBinding(symbol)) {
var nodeLinks_1 = getNodeLinks(symbol.valueDeclaration);
if (resolveName(container.parent, symbol.escapedName, 67220415 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)) {
// redeclaration - always should be renamed
@@ -58328,7 +59175,7 @@
// they will not collide with anything
var isDeclaredInLoop = nodeLinks_1.flags & 524288 /* BlockScopedBindingInLoop */;
var inLoopInitializer = ts.isIterationStatement(container, /*lookInLabeledStatements*/ false);
- var inLoopBodyBlock = container.kind === 218 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false);
+ var inLoopBodyBlock = container.kind === 219 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false);
links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock));
}
else {
@@ -58369,18 +59216,18 @@
}
function isValueAliasDeclaration(node) {
switch (node.kind) {
- case 248 /* ImportEqualsDeclaration */:
- case 250 /* ImportClause */:
- case 251 /* NamespaceImport */:
- case 253 /* ImportSpecifier */:
- case 257 /* ExportSpecifier */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 251 /* ImportClause */:
+ case 252 /* NamespaceImport */:
+ case 254 /* ImportSpecifier */:
+ case 258 /* ExportSpecifier */:
return isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
var exportClause = node.exportClause;
return !!exportClause && ts.some(exportClause.elements, isValueAliasDeclaration);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return node.expression
- && node.expression.kind === 72 /* Identifier */
+ && node.expression.kind === 73 /* Identifier */
? isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol)
: true;
}
@@ -58388,7 +59235,7 @@
}
function isTopLevelValueImportEqualsWithEntityName(nodeIn) {
var node = ts.getParseTreeNode(nodeIn, ts.isImportEqualsDeclaration);
- if (node === undefined || node.parent.kind !== 284 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) {
+ if (node === undefined || node.parent.kind !== 285 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) {
// parent is not source file or it is not reference to internal module
return false;
}
@@ -58489,15 +59336,15 @@
}
function canHaveConstantValue(node) {
switch (node.kind) {
- case 278 /* EnumMember */:
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 279 /* EnumMember */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return true;
}
return false;
}
function getConstantValue(node) {
- if (node.kind === 278 /* EnumMember */) {
+ if (node.kind === 279 /* EnumMember */) {
return getEnumMemberValue(node);
}
var symbol = getNodeLinks(node).resolvedSymbol;
@@ -58582,7 +59429,7 @@
function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, tracker, addUndefined) {
var declaration = ts.getParseTreeNode(declarationIn, ts.isVariableLikeOrAccessor);
if (!declaration) {
- return ts.createToken(120 /* AnyKeyword */);
+ return ts.createToken(121 /* AnyKeyword */);
}
// Get type of the symbol if this is the valid symbol otherwise get type at location
var symbol = getSymbolOfNode(declaration);
@@ -58601,7 +59448,7 @@
function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, tracker) {
var signatureDeclaration = ts.getParseTreeNode(signatureDeclarationIn, ts.isFunctionLike);
if (!signatureDeclaration) {
- return ts.createToken(120 /* AnyKeyword */);
+ return ts.createToken(121 /* AnyKeyword */);
}
var signature = getSignatureFromDeclaration(signatureDeclaration);
return nodeBuilder.typeToTypeNode(getReturnTypeOfSignature(signature), enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
@@ -58609,7 +59456,7 @@
function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) {
var expr = ts.getParseTreeNode(exprIn, ts.isExpression);
if (!expr) {
- return ts.createToken(120 /* AnyKeyword */);
+ return ts.createToken(121 /* AnyKeyword */);
}
var type = getWidenedType(getRegularTypeOfExpression(expr));
return nodeBuilder.typeToTypeNode(type, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
@@ -58728,17 +59575,17 @@
isLateBound: function (nodeIn) {
var node = ts.getParseTreeNode(nodeIn, ts.isDeclaration);
var symbol = node && getSymbolOfNode(node);
- return !!(symbol && ts.getCheckFlags(symbol) & 2048 /* Late */);
+ return !!(symbol && ts.getCheckFlags(symbol) & 4096 /* Late */);
},
getJsxFactoryEntity: function (location) { return location ? (getJsxNamespace(location), (ts.getSourceFileOfNode(location).localJsxFactory || _jsxFactoryEntity)) : _jsxFactoryEntity; },
getAllAccessorDeclarations: function (accessor) {
accessor = ts.getParseTreeNode(accessor, ts.isGetOrSetAccessorDeclaration); // TODO: GH#18217
- var otherKind = accessor.kind === 159 /* SetAccessor */ ? 158 /* GetAccessor */ : 159 /* SetAccessor */;
+ var otherKind = accessor.kind === 160 /* SetAccessor */ ? 159 /* GetAccessor */ : 160 /* SetAccessor */;
var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(accessor), otherKind);
var firstAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? otherAccessor : accessor;
var secondAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? accessor : otherAccessor;
- var setAccessor = accessor.kind === 159 /* SetAccessor */ ? accessor : otherAccessor;
- var getAccessor = accessor.kind === 158 /* GetAccessor */ ? accessor : otherAccessor;
+ var setAccessor = accessor.kind === 160 /* SetAccessor */ ? accessor : otherAccessor;
+ var getAccessor = accessor.kind === 159 /* GetAccessor */ ? accessor : otherAccessor;
return {
firstAccessor: firstAccessor,
secondAccessor: secondAccessor,
@@ -58754,7 +59601,7 @@
}
};
function isInHeritageClause(node) {
- return node.parent && node.parent.kind === 211 /* ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 273 /* HeritageClause */;
+ return node.parent && node.parent.kind === 212 /* ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 274 /* HeritageClause */;
}
// defined here to avoid outer scope pollution
function getTypeReferenceDirectivesForEntityName(node) {
@@ -58766,7 +59613,7 @@
// qualified names can only be used as types\namespaces
// identifiers are treated as values only if they appear in type queries
var meaning = 67897832 /* Type */ | 1920 /* Namespace */;
- if ((node.kind === 72 /* Identifier */ && isInTypeQuery(node)) || (node.kind === 189 /* PropertyAccessExpression */ && !isInHeritageClause(node))) {
+ if ((node.kind === 73 /* Identifier */ && isInTypeQuery(node)) || (node.kind === 190 /* PropertyAccessExpression */ && !isInHeritageClause(node))) {
meaning = 67220415 /* Value */ | 1048576 /* ExportValue */;
}
var symbol = resolveEntityName(node, meaning, /*ignoreErrors*/ true);
@@ -58817,7 +59664,7 @@
break;
}
}
- if (current.valueDeclaration && current.valueDeclaration.kind === 284 /* SourceFile */ && current.flags & 512 /* ValueModule */) {
+ if (current.valueDeclaration && current.valueDeclaration.kind === 285 /* SourceFile */ && current.flags & 512 /* ValueModule */) {
return false;
}
// check that at least one declaration of top level symbol originates from type declaration file
@@ -58845,12 +59692,12 @@
}
}
function getExternalModuleFileFromDeclaration(declaration) {
- var specifier = declaration.kind === 244 /* ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration);
+ var specifier = declaration.kind === 245 /* ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration);
var moduleSymbol = resolveExternalModuleNameWorker(specifier, specifier, /*moduleNotFoundError*/ undefined); // TODO: GH#18217
if (!moduleSymbol) {
return undefined;
}
- return ts.getDeclarationOfKind(moduleSymbol, 284 /* SourceFile */);
+ return ts.getDeclarationOfKind(moduleSymbol, 285 /* SourceFile */);
}
function initializeTypeChecker() {
// Bind all source files and propagate errors
@@ -58867,6 +59714,15 @@
continue;
}
if (!ts.isExternalOrCommonJsModule(file)) {
+ // It is an error for a non-external-module (i.e. script) to declare its own `globalThis`.
+ // We can't use `builtinGlobals` for this due to synthetic expando-namespace generation in JS files.
+ var fileGlobalThisSymbol = file.locals.get("globalThis");
+ if (fileGlobalThisSymbol) {
+ for (var _d = 0, _e = fileGlobalThisSymbol.declarations; _d < _e.length; _d++) {
+ var declaration = _e[_d];
+ diagnostics.add(ts.createDiagnosticForNode(declaration, ts.Diagnostics.Declaration_name_conflicts_with_built_in_global_identifier_0, "globalThis"));
+ }
+ }
mergeSymbolTable(globals, file.locals);
}
if (file.jsGlobalAugmentations) {
@@ -58897,10 +59753,10 @@
if (augmentations) {
// merge _global_ module augmentations.
// this needs to be done after global symbol table is initialized to make sure that all ambient modules are indexed
- for (var _d = 0, augmentations_1 = augmentations; _d < augmentations_1.length; _d++) {
- var list = augmentations_1[_d];
- for (var _e = 0, list_1 = list; _e < list_1.length; _e++) {
- var augmentation = list_1[_e];
+ for (var _f = 0, augmentations_1 = augmentations; _f < augmentations_1.length; _f++) {
+ var list = augmentations_1[_f];
+ for (var _g = 0, list_1 = list; _g < list_1.length; _g++) {
+ var augmentation = list_1[_g];
if (!ts.isGlobalScopeAugmentation(augmentation.parent))
continue;
mergeModuleAugmentation(augmentation);
@@ -58912,6 +59768,7 @@
getSymbolLinks(undefinedSymbol).type = undefinedWideningType;
getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments", /*arity*/ 0, /*reportErrors*/ true);
getSymbolLinks(unknownSymbol).type = errorType;
+ getSymbolLinks(globalThisSymbol).type = createObjectType(16 /* Anonymous */, globalThisSymbol);
// Initialize special types
globalArrayType = getGlobalType("Array", /*arity*/ 1, /*reportErrors*/ true);
globalObjectType = getGlobalType("Object", /*arity*/ 0, /*reportErrors*/ true);
@@ -58934,10 +59791,10 @@
if (augmentations) {
// merge _nonglobal_ module augmentations.
// this needs to be done after global symbol table is initialized to make sure that all ambient modules are indexed
- for (var _f = 0, augmentations_2 = augmentations; _f < augmentations_2.length; _f++) {
- var list = augmentations_2[_f];
- for (var _g = 0, list_2 = list; _g < list_2.length; _g++) {
- var augmentation = list_2[_g];
+ for (var _h = 0, augmentations_2 = augmentations; _h < augmentations_2.length; _h++) {
+ var list = augmentations_2[_h];
+ for (var _j = 0, list_2 = list; _j < list_2.length; _j++) {
+ var augmentation = list_2[_j];
if (ts.isGlobalScopeAugmentation(augmentation.parent))
continue;
mergeModuleAugmentation(augmentation);
@@ -59028,14 +59885,14 @@
return false;
}
if (!ts.nodeCanBeDecorated(node, node.parent, node.parent.parent)) {
- if (node.kind === 156 /* MethodDeclaration */ && !ts.nodeIsPresent(node.body)) {
+ if (node.kind === 157 /* MethodDeclaration */ && !ts.nodeIsPresent(node.body)) {
return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload);
}
else {
return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here);
}
}
- else if (node.kind === 158 /* GetAccessor */ || node.kind === 159 /* SetAccessor */) {
+ else if (node.kind === 159 /* GetAccessor */ || node.kind === 160 /* SetAccessor */) {
var accessors = ts.getAllAccessorDeclarations(node.parent.members, node);
if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) {
return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name);
@@ -59052,23 +59909,23 @@
var flags = 0 /* None */;
for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) {
var modifier = _a[_i];
- if (modifier.kind !== 133 /* ReadonlyKeyword */) {
- if (node.kind === 153 /* PropertySignature */ || node.kind === 155 /* MethodSignature */) {
+ if (modifier.kind !== 134 /* ReadonlyKeyword */) {
+ if (node.kind === 154 /* PropertySignature */ || node.kind === 156 /* MethodSignature */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind));
}
- if (node.kind === 162 /* IndexSignature */) {
+ if (node.kind === 163 /* IndexSignature */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind));
}
}
switch (modifier.kind) {
- case 77 /* ConstKeyword */:
- if (node.kind !== 243 /* EnumDeclaration */) {
- return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(77 /* ConstKeyword */));
+ case 78 /* ConstKeyword */:
+ if (node.kind !== 244 /* EnumDeclaration */) {
+ return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(78 /* ConstKeyword */));
}
break;
- case 115 /* PublicKeyword */:
- case 114 /* ProtectedKeyword */:
- case 113 /* PrivateKeyword */:
+ case 116 /* PublicKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 114 /* PrivateKeyword */:
var text = visibilityToString(ts.modifierToFlag(modifier.kind));
if (flags & 28 /* AccessibilityModifier */) {
return grammarErrorOnNode(modifier, ts.Diagnostics.Accessibility_modifier_already_seen);
@@ -59082,11 +59939,11 @@
else if (flags & 256 /* Async */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async");
}
- else if (node.parent.kind === 245 /* ModuleBlock */ || node.parent.kind === 284 /* SourceFile */) {
+ else if (node.parent.kind === 246 /* ModuleBlock */ || node.parent.kind === 285 /* SourceFile */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text);
}
else if (flags & 128 /* Abstract */) {
- if (modifier.kind === 113 /* PrivateKeyword */) {
+ if (modifier.kind === 114 /* PrivateKeyword */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract");
}
else {
@@ -59095,7 +59952,7 @@
}
flags |= ts.modifierToFlag(modifier.kind);
break;
- case 116 /* StaticKeyword */:
+ case 117 /* StaticKeyword */:
if (flags & 32 /* Static */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static");
}
@@ -59105,10 +59962,10 @@
else if (flags & 256 /* Async */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async");
}
- else if (node.parent.kind === 245 /* ModuleBlock */ || node.parent.kind === 284 /* SourceFile */) {
+ else if (node.parent.kind === 246 /* ModuleBlock */ || node.parent.kind === 285 /* SourceFile */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static");
}
- else if (node.kind === 151 /* Parameter */) {
+ else if (node.kind === 152 /* Parameter */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static");
}
else if (flags & 128 /* Abstract */) {
@@ -59117,18 +59974,18 @@
flags |= 32 /* Static */;
lastStatic = modifier;
break;
- case 133 /* ReadonlyKeyword */:
+ case 134 /* ReadonlyKeyword */:
if (flags & 64 /* Readonly */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly");
}
- else if (node.kind !== 154 /* PropertyDeclaration */ && node.kind !== 153 /* PropertySignature */ && node.kind !== 162 /* IndexSignature */ && node.kind !== 151 /* Parameter */) {
+ else if (node.kind !== 155 /* PropertyDeclaration */ && node.kind !== 154 /* PropertySignature */ && node.kind !== 163 /* IndexSignature */ && node.kind !== 152 /* Parameter */) {
// If node.kind === SyntaxKind.Parameter, checkParameter report an error if it's not a parameter property.
return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature);
}
flags |= 64 /* Readonly */;
lastReadonly = modifier;
break;
- case 85 /* ExportKeyword */:
+ case 86 /* ExportKeyword */:
if (flags & 1 /* Export */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "export");
}
@@ -59141,52 +59998,52 @@
else if (flags & 256 /* Async */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async");
}
- else if (node.parent.kind === 240 /* ClassDeclaration */) {
+ else if (node.parent.kind === 241 /* ClassDeclaration */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export");
}
- else if (node.kind === 151 /* Parameter */) {
+ else if (node.kind === 152 /* Parameter */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export");
}
flags |= 1 /* Export */;
break;
- case 80 /* DefaultKeyword */:
- var container = node.parent.kind === 284 /* SourceFile */ ? node.parent : node.parent.parent;
- if (container.kind === 244 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) {
+ case 81 /* DefaultKeyword */:
+ var container = node.parent.kind === 285 /* SourceFile */ ? node.parent : node.parent.parent;
+ if (container.kind === 245 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) {
return grammarErrorOnNode(modifier, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module);
}
flags |= 512 /* Default */;
break;
- case 125 /* DeclareKeyword */:
+ case 126 /* DeclareKeyword */:
if (flags & 2 /* Ambient */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare");
}
else if (flags & 256 /* Async */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async");
}
- else if (node.parent.kind === 240 /* ClassDeclaration */) {
+ else if (node.parent.kind === 241 /* ClassDeclaration */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare");
}
- else if (node.kind === 151 /* Parameter */) {
+ else if (node.kind === 152 /* Parameter */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare");
}
- else if ((node.parent.flags & 4194304 /* Ambient */) && node.parent.kind === 245 /* ModuleBlock */) {
+ else if ((node.parent.flags & 4194304 /* Ambient */) && node.parent.kind === 246 /* ModuleBlock */) {
return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context);
}
flags |= 2 /* Ambient */;
lastDeclare = modifier;
break;
- case 118 /* AbstractKeyword */:
+ case 119 /* AbstractKeyword */:
if (flags & 128 /* Abstract */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract");
}
- if (node.kind !== 240 /* ClassDeclaration */) {
- if (node.kind !== 156 /* MethodDeclaration */ &&
- node.kind !== 154 /* PropertyDeclaration */ &&
- node.kind !== 158 /* GetAccessor */ &&
- node.kind !== 159 /* SetAccessor */) {
+ if (node.kind !== 241 /* ClassDeclaration */) {
+ if (node.kind !== 157 /* MethodDeclaration */ &&
+ node.kind !== 155 /* PropertyDeclaration */ &&
+ node.kind !== 159 /* GetAccessor */ &&
+ node.kind !== 160 /* SetAccessor */) {
return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration);
}
- if (!(node.parent.kind === 240 /* ClassDeclaration */ && ts.hasModifier(node.parent, 128 /* Abstract */))) {
+ if (!(node.parent.kind === 241 /* ClassDeclaration */ && ts.hasModifier(node.parent, 128 /* Abstract */))) {
return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class);
}
if (flags & 32 /* Static */) {
@@ -59198,14 +60055,14 @@
}
flags |= 128 /* Abstract */;
break;
- case 121 /* AsyncKeyword */:
+ case 122 /* AsyncKeyword */:
if (flags & 256 /* Async */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async");
}
else if (flags & 2 /* Ambient */ || node.parent.flags & 4194304 /* Ambient */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async");
}
- else if (node.kind === 151 /* Parameter */) {
+ else if (node.kind === 152 /* Parameter */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async");
}
flags |= 256 /* Async */;
@@ -59213,7 +60070,7 @@
break;
}
}
- if (node.kind === 157 /* Constructor */) {
+ if (node.kind === 158 /* Constructor */) {
if (flags & 32 /* Static */) {
return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static");
}
@@ -59228,13 +60085,13 @@
}
return false;
}
- else if ((node.kind === 249 /* ImportDeclaration */ || node.kind === 248 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) {
+ else if ((node.kind === 250 /* ImportDeclaration */ || node.kind === 249 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) {
return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare");
}
- else if (node.kind === 151 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) {
+ else if (node.kind === 152 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) {
return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern);
}
- else if (node.kind === 151 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && node.dotDotDotToken) {
+ else if (node.kind === 152 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && node.dotDotDotToken) {
return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter);
}
if (flags & 256 /* Async */) {
@@ -59255,38 +60112,38 @@
}
function shouldReportBadModifier(node) {
switch (node.kind) {
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 157 /* Constructor */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 162 /* IndexSignature */:
- case 244 /* ModuleDeclaration */:
- case 249 /* ImportDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
- case 255 /* ExportDeclaration */:
- case 254 /* ExportAssignment */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 151 /* Parameter */:
- return false;
- default:
- if (node.parent.kind === 245 /* ModuleBlock */ || node.parent.kind === 284 /* SourceFile */) {
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 158 /* Constructor */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 163 /* IndexSignature */:
+ case 245 /* ModuleDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 256 /* ExportDeclaration */:
+ case 255 /* ExportAssignment */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 152 /* Parameter */:
+ return false;
+ default:
+ if (node.parent.kind === 246 /* ModuleBlock */ || node.parent.kind === 285 /* SourceFile */) {
return false;
}
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- return nodeHasAnyModifiersExcept(node, 121 /* AsyncKeyword */);
- case 240 /* ClassDeclaration */:
- return nodeHasAnyModifiersExcept(node, 118 /* AbstractKeyword */);
- case 241 /* InterfaceDeclaration */:
- case 219 /* VariableStatement */:
- case 242 /* TypeAliasDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ return nodeHasAnyModifiersExcept(node, 122 /* AsyncKeyword */);
+ case 241 /* ClassDeclaration */:
+ return nodeHasAnyModifiersExcept(node, 119 /* AbstractKeyword */);
+ case 242 /* InterfaceDeclaration */:
+ case 220 /* VariableStatement */:
+ case 243 /* TypeAliasDeclaration */:
return true;
- case 243 /* EnumDeclaration */:
- return nodeHasAnyModifiersExcept(node, 77 /* ConstKeyword */);
+ case 244 /* EnumDeclaration */:
+ return nodeHasAnyModifiersExcept(node, 78 /* ConstKeyword */);
default:
ts.Debug.fail();
return false;
@@ -59298,10 +60155,10 @@
}
function checkGrammarAsyncModifier(node, asyncModifier) {
switch (node.kind) {
- case 156 /* MethodDeclaration */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return false;
}
return grammarErrorOnNode(asyncModifier, ts.Diagnostics._0_modifier_cannot_be_used_here, "async");
@@ -59416,10 +60273,10 @@
if (!parameter.type) {
return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation);
}
- if (parameter.type.kind !== 138 /* StringKeyword */ && parameter.type.kind !== 135 /* NumberKeyword */) {
+ if (parameter.type.kind !== 139 /* StringKeyword */ && parameter.type.kind !== 136 /* NumberKeyword */) {
var type = getTypeFromTypeNode(parameter.type);
if (type.flags & 4 /* String */ || type.flags & 8 /* Number */) {
- return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_cannot_be_a_type_alias_Consider_writing_0_Colon_1_Colon_2_instead, ts.getTextOfNode(parameter.name), typeToString(type), typeToString(getTypeFromTypeNode(node.type)));
+ return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_cannot_be_a_type_alias_Consider_writing_0_Colon_1_Colon_2_instead, ts.getTextOfNode(parameter.name), typeToString(type), typeToString(node.type ? getTypeFromTypeNode(node.type) : anyType));
}
if (type.flags & 1048576 /* Union */ && allTypesAssignableToKind(type, 128 /* StringLiteral */, /*strict*/ true)) {
return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_cannot_be_a_union_type_Consider_using_a_mapped_object_type_instead);
@@ -59450,9 +60307,9 @@
}
function checkGrammarForOmittedArgument(args) {
if (args) {
- for (var _i = 0, args_5 = args; _i < args_5.length; _i++) {
- var arg = args_5[_i];
- if (arg.kind === 210 /* OmittedExpression */) {
+ for (var _i = 0, args_4 = args; _i < args_4.length; _i++) {
+ var arg = args_4[_i];
+ if (arg.kind === 211 /* OmittedExpression */) {
return grammarErrorAtPos(arg, arg.pos, 0, ts.Diagnostics.Argument_expression_expected);
}
}
@@ -59482,7 +60339,7 @@
if (!checkGrammarDecoratorsAndModifiers(node) && node.heritageClauses) {
for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) {
var heritageClause = _a[_i];
- if (heritageClause.token === 86 /* ExtendsKeyword */) {
+ if (heritageClause.token === 87 /* ExtendsKeyword */) {
if (seenExtendsClause) {
return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen);
}
@@ -59495,7 +60352,7 @@
seenExtendsClause = true;
}
else {
- ts.Debug.assert(heritageClause.token === 109 /* ImplementsKeyword */);
+ ts.Debug.assert(heritageClause.token === 110 /* ImplementsKeyword */);
if (seenImplementsClause) {
return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.implements_clause_already_seen);
}
@@ -59511,14 +60368,14 @@
if (node.heritageClauses) {
for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) {
var heritageClause = _a[_i];
- if (heritageClause.token === 86 /* ExtendsKeyword */) {
+ if (heritageClause.token === 87 /* ExtendsKeyword */) {
if (seenExtendsClause) {
return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen);
}
seenExtendsClause = true;
}
else {
- ts.Debug.assert(heritageClause.token === 109 /* ImplementsKeyword */);
+ ts.Debug.assert(heritageClause.token === 110 /* ImplementsKeyword */);
return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.Interface_declaration_cannot_have_implements_clause);
}
// Grammar checking heritageClause inside class declaration
@@ -59529,20 +60386,20 @@
}
function checkGrammarComputedPropertyName(node) {
// If node is not a computedPropertyName, just skip the grammar checking
- if (node.kind !== 149 /* ComputedPropertyName */) {
+ if (node.kind !== 150 /* ComputedPropertyName */) {
return false;
}
var computedPropertyName = node;
- if (computedPropertyName.expression.kind === 204 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 27 /* CommaToken */) {
+ if (computedPropertyName.expression.kind === 205 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 27 /* CommaToken */) {
return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name);
}
return false;
}
function checkGrammarForGenerator(node) {
if (node.asteriskToken) {
- ts.Debug.assert(node.kind === 239 /* FunctionDeclaration */ ||
- node.kind === 196 /* FunctionExpression */ ||
- node.kind === 156 /* MethodDeclaration */);
+ ts.Debug.assert(node.kind === 240 /* FunctionDeclaration */ ||
+ node.kind === 197 /* FunctionExpression */ ||
+ node.kind === 157 /* MethodDeclaration */);
if (node.flags & 4194304 /* Ambient */) {
return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context);
}
@@ -59568,15 +60425,22 @@
var seen = ts.createUnderscoreEscapedMap();
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var prop = _a[_i];
- if (prop.kind === 277 /* SpreadAssignment */) {
+ if (prop.kind === 278 /* SpreadAssignment */) {
+ if (inDestructuring) {
+ // a rest property cannot be destructured any further
+ var expression = ts.skipParentheses(prop.expression);
+ if (ts.isArrayLiteralExpression(expression) || ts.isObjectLiteralExpression(expression)) {
+ return grammarErrorOnNode(prop.expression, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern);
+ }
+ }
continue;
}
var name = prop.name;
- if (name.kind === 149 /* ComputedPropertyName */) {
+ if (name.kind === 150 /* ComputedPropertyName */) {
// If the name is not a ComputedPropertyName, the grammar checking will skip it
checkGrammarComputedPropertyName(name);
}
- if (prop.kind === 276 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) {
+ if (prop.kind === 277 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) {
// having objectAssignmentInitializer is only valid in ObjectAssignmentPattern
// outside of destructuring it is a syntax error
return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment);
@@ -59585,7 +60449,7 @@
if (prop.modifiers) {
for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) { // TODO: GH#19955
var mod = _c[_b];
- if (mod.kind !== 121 /* AsyncKeyword */ || prop.kind !== 156 /* MethodDeclaration */) {
+ if (mod.kind !== 122 /* AsyncKeyword */ || prop.kind !== 157 /* MethodDeclaration */) {
grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod));
}
}
@@ -59600,23 +60464,23 @@
// and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields
var currentKind = void 0;
switch (prop.kind) {
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
checkGrammarForInvalidExclamationToken(prop.exclamationToken, ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context);
/* tslint:disable:no-switch-case-fall-through */
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
// Grammar checking for computedPropertyName and shorthandPropertyAssignment
checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional);
if (name.kind === 8 /* NumericLiteral */) {
checkGrammarNumericLiteral(name);
}
// falls through
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
currentKind = 1 /* Property */;
break;
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
currentKind = 2 /* GetAccessor */;
break;
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
currentKind = 4 /* SetAccessor */;
break;
default:
@@ -59653,7 +60517,7 @@
var seen = ts.createUnderscoreEscapedMap();
for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) {
var attr = _a[_i];
- if (attr.kind === 269 /* JsxSpreadAttribute */) {
+ if (attr.kind === 270 /* JsxSpreadAttribute */) {
continue;
}
var name = attr.name, initializer = attr.initializer;
@@ -59663,7 +60527,7 @@
else {
return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name);
}
- if (initializer && initializer.kind === 270 /* JsxExpression */ && !initializer.expression) {
+ if (initializer && initializer.kind === 271 /* JsxExpression */ && !initializer.expression) {
return grammarErrorOnNode(initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression);
}
}
@@ -59672,12 +60536,25 @@
if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) {
return true;
}
- if (forInOrOfStatement.kind === 227 /* ForOfStatement */ && forInOrOfStatement.awaitModifier) {
+ if (forInOrOfStatement.kind === 228 /* ForOfStatement */ && forInOrOfStatement.awaitModifier) {
if ((forInOrOfStatement.flags & 16384 /* AwaitContext */) === 0 /* None */) {
- return grammarErrorOnNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator);
+ // use of 'for-await-of' in non-async function
+ var sourceFile = ts.getSourceFileOfNode(forInOrOfStatement);
+ if (!hasParseDiagnostics(sourceFile)) {
+ var diagnostic = ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator);
+ var func = ts.getContainingFunction(forInOrOfStatement);
+ if (func && func.kind !== 158 /* Constructor */) {
+ ts.Debug.assert((ts.getFunctionFlags(func) & 2 /* Async */) === 0, "Enclosing function should never be an async function.");
+ var relatedInfo = ts.createDiagnosticForNode(func, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async);
+ ts.addRelatedInfo(diagnostic, relatedInfo);
}
+ diagnostics.add(diagnostic);
+ return true;
}
- if (forInOrOfStatement.initializer.kind === 238 /* VariableDeclarationList */) {
+ return false;
+ }
+ }
+ if (forInOrOfStatement.initializer.kind === 239 /* VariableDeclarationList */) {
var variableList = forInOrOfStatement.initializer;
if (!checkGrammarVariableDeclarationList(variableList)) {
var declarations = variableList.declarations;
@@ -59692,20 +60569,20 @@
return false;
}
if (declarations.length > 1) {
- var diagnostic = forInOrOfStatement.kind === 226 /* ForInStatement */
+ var diagnostic = forInOrOfStatement.kind === 227 /* ForInStatement */
? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement
: ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement;
return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic);
}
var firstDeclaration = declarations[0];
if (firstDeclaration.initializer) {
- var diagnostic = forInOrOfStatement.kind === 226 /* ForInStatement */
+ var diagnostic = forInOrOfStatement.kind === 227 /* ForInStatement */
? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer
: ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer;
return grammarErrorOnNode(firstDeclaration.name, diagnostic);
}
if (firstDeclaration.type) {
- var diagnostic = forInOrOfStatement.kind === 226 /* ForInStatement */
+ var diagnostic = forInOrOfStatement.kind === 227 /* ForInStatement */
? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation
: ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation;
return grammarErrorOnNode(firstDeclaration, diagnostic);
@@ -59732,11 +60609,11 @@
return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters);
}
else if (!doesAccessorHaveCorrectParameterCount(accessor)) {
- return grammarErrorOnNode(accessor.name, kind === 158 /* GetAccessor */ ?
+ return grammarErrorOnNode(accessor.name, kind === 159 /* GetAccessor */ ?
ts.Diagnostics.A_get_accessor_cannot_have_parameters :
ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter);
}
- else if (kind === 159 /* SetAccessor */) {
+ else if (kind === 160 /* SetAccessor */) {
if (accessor.type) {
return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation);
}
@@ -59760,23 +60637,23 @@
* A set accessor has one parameter or a `this` parameter and one more parameter.
*/
function doesAccessorHaveCorrectParameterCount(accessor) {
- return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 158 /* GetAccessor */ ? 0 : 1);
+ return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 159 /* GetAccessor */ ? 0 : 1);
}
function getAccessorThisParameter(accessor) {
- if (accessor.parameters.length === (accessor.kind === 158 /* GetAccessor */ ? 1 : 2)) {
+ if (accessor.parameters.length === (accessor.kind === 159 /* GetAccessor */ ? 1 : 2)) {
return ts.getThisParameter(accessor);
}
}
function checkGrammarTypeOperatorNode(node) {
- if (node.operator === 142 /* UniqueKeyword */) {
- if (node.type.kind !== 139 /* SymbolKeyword */) {
- return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(139 /* SymbolKeyword */));
+ if (node.operator === 143 /* UniqueKeyword */) {
+ if (node.type.kind !== 140 /* SymbolKeyword */) {
+ return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(140 /* SymbolKeyword */));
}
var parent = ts.walkUpParenthesizedTypes(node.parent);
switch (parent.kind) {
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
var decl = parent;
- if (decl.name.kind !== 72 /* Identifier */) {
+ if (decl.name.kind !== 73 /* Identifier */) {
return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name);
}
if (!ts.isVariableDeclarationInVariableStatement(decl)) {
@@ -59786,13 +60663,13 @@
return grammarErrorOnNode(parent.name, ts.Diagnostics.A_variable_whose_type_is_a_unique_symbol_type_must_be_const);
}
break;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
if (!ts.hasModifier(parent, 32 /* Static */) ||
!ts.hasModifier(parent, 64 /* Readonly */)) {
return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly);
}
break;
- case 153 /* PropertySignature */:
+ case 154 /* PropertySignature */:
if (!ts.hasModifier(parent, 64 /* Readonly */)) {
return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly);
}
@@ -59801,9 +60678,9 @@
return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_are_not_allowed_here);
}
}
- else if (node.operator === 133 /* ReadonlyKeyword */) {
- if (node.type.kind !== 169 /* ArrayType */ && node.type.kind !== 170 /* TupleType */) {
- return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(139 /* SymbolKeyword */));
+ else if (node.operator === 134 /* ReadonlyKeyword */) {
+ if (node.type.kind !== 170 /* ArrayType */ && node.type.kind !== 171 /* TupleType */) {
+ return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(140 /* SymbolKeyword */));
}
}
}
@@ -59816,10 +60693,10 @@
if (checkGrammarFunctionLikeDeclaration(node)) {
return true;
}
- if (node.kind === 156 /* MethodDeclaration */) {
- if (node.parent.kind === 188 /* ObjectLiteralExpression */) {
+ if (node.kind === 157 /* MethodDeclaration */) {
+ if (node.parent.kind === 189 /* ObjectLiteralExpression */) {
// We only disallow modifier on a method declaration if it is a property of object-literal-expression
- if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 121 /* AsyncKeyword */)) {
+ if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 122 /* AsyncKeyword */)) {
return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here);
}
else if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) {
@@ -59832,6 +60709,9 @@
return grammarErrorAtPos(node, node.end - 1, ";".length, ts.Diagnostics._0_expected, "{");
}
}
+ else if (ts.isClassLike(node.parent) && ts.isStringLiteral(node.name) && node.name.text === "constructor" && (!compilerOptions.target || compilerOptions.target < 1 /* ES5 */)) {
+ return grammarErrorOnNode(node.name, ts.Diagnostics.Quoted_constructors_have_previously_been_interpreted_as_methods_which_is_incorrect_In_TypeScript_3_6_they_will_be_correctly_parsed_as_constructors_In_the_meantime_consider_using_constructor_to_write_a_constructor_or_constructor_to_write_a_method);
+ }
if (checkGrammarForGenerator(node)) {
return true;
}
@@ -59845,14 +60725,14 @@
if (node.flags & 4194304 /* Ambient */) {
return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type);
}
- else if (node.kind === 156 /* MethodDeclaration */ && !node.body) {
+ else if (node.kind === 157 /* MethodDeclaration */ && !node.body) {
return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type);
}
}
- else if (node.parent.kind === 241 /* InterfaceDeclaration */) {
+ else if (node.parent.kind === 242 /* InterfaceDeclaration */) {
return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type);
}
- else if (node.parent.kind === 168 /* TypeLiteral */) {
+ else if (node.parent.kind === 169 /* TypeLiteral */) {
return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type);
}
}
@@ -59863,11 +60743,11 @@
return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary);
}
switch (current.kind) {
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
if (node.label && current.label.escapedText === node.label.escapedText) {
// found matching label - verify that label usage is correct
// continue can only target labels that are on iteration statements
- var isMisplacedContinueLabel = node.kind === 228 /* ContinueStatement */
+ var isMisplacedContinueLabel = node.kind === 229 /* ContinueStatement */
&& !ts.isIterationStatement(current.statement, /*lookInLabeledStatement*/ true);
if (isMisplacedContinueLabel) {
return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement);
@@ -59875,8 +60755,8 @@
return false;
}
break;
- case 232 /* SwitchStatement */:
- if (node.kind === 229 /* BreakStatement */ && !node.label) {
+ case 233 /* SwitchStatement */:
+ if (node.kind === 230 /* BreakStatement */ && !node.label) {
// unlabeled break within switch statement - ok
return false;
}
@@ -59891,13 +60771,13 @@
current = current.parent;
}
if (node.label) {
- var message = node.kind === 229 /* BreakStatement */
+ var message = node.kind === 230 /* BreakStatement */
? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement
: ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement;
return grammarErrorOnNode(node, message);
}
else {
- var message = node.kind === 229 /* BreakStatement */
+ var message = node.kind === 230 /* BreakStatement */
? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement
: ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement;
return grammarErrorOnNode(node, message);
@@ -59921,12 +60801,12 @@
}
function isStringOrNumberLiteralExpression(expr) {
return expr.kind === 10 /* StringLiteral */ || expr.kind === 8 /* NumericLiteral */ ||
- expr.kind === 202 /* PrefixUnaryExpression */ && expr.operator === 39 /* MinusToken */ &&
+ expr.kind === 203 /* PrefixUnaryExpression */ && expr.operator === 39 /* MinusToken */ &&
expr.operand.kind === 8 /* NumericLiteral */;
}
function isBigIntLiteralExpression(expr) {
return expr.kind === 9 /* BigIntLiteral */ ||
- expr.kind === 202 /* PrefixUnaryExpression */ && expr.operator === 39 /* MinusToken */ &&
+ expr.kind === 203 /* PrefixUnaryExpression */ && expr.operator === 39 /* MinusToken */ &&
expr.operand.kind === 9 /* BigIntLiteral */;
}
function isSimpleLiteralEnumReference(expr) {
@@ -59939,7 +60819,7 @@
if (initializer) {
var isInvalidInitializer = !(isStringOrNumberLiteralExpression(initializer) ||
isSimpleLiteralEnumReference(initializer) ||
- initializer.kind === 102 /* TrueKeyword */ || initializer.kind === 87 /* FalseKeyword */ ||
+ initializer.kind === 103 /* TrueKeyword */ || initializer.kind === 88 /* FalseKeyword */ ||
isBigIntLiteralExpression(initializer));
var isConstOrReadonly = ts.isDeclarationReadonly(node) || ts.isVariableDeclaration(node) && ts.isVarConst(node);
if (isConstOrReadonly && !node.type) {
@@ -59956,7 +60836,7 @@
}
}
function checkGrammarVariableDeclaration(node) {
- if (node.parent.parent.kind !== 226 /* ForInStatement */ && node.parent.parent.kind !== 227 /* ForOfStatement */) {
+ if (node.parent.parent.kind !== 227 /* ForInStatement */ && node.parent.parent.kind !== 228 /* ForOfStatement */) {
if (node.flags & 4194304 /* Ambient */) {
checkAmbientInitializer(node);
}
@@ -59969,8 +60849,8 @@
}
}
}
- if (node.exclamationToken && (node.parent.parent.kind !== 219 /* VariableStatement */ || !node.type || node.initializer || node.flags & 4194304 /* Ambient */)) {
- return grammarErrorOnNode(node.exclamationToken, ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context);
+ if (node.exclamationToken && (node.parent.parent.kind !== 220 /* VariableStatement */ || !node.type || node.initializer || node.flags & 4194304 /* Ambient */)) {
+ return grammarErrorOnNode(node.exclamationToken, ts.Diagnostics.Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation);
}
if (compilerOptions.module !== ts.ModuleKind.ES2015 && compilerOptions.module !== ts.ModuleKind.ESNext && compilerOptions.module !== ts.ModuleKind.System && !compilerOptions.noEmit &&
!(node.parent.parent.flags & 4194304 /* Ambient */) && ts.hasModifier(node.parent.parent, 1 /* Export */)) {
@@ -59986,7 +60866,7 @@
return checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name);
}
function checkESModuleMarker(name) {
- if (name.kind === 72 /* Identifier */) {
+ if (name.kind === 73 /* Identifier */) {
if (ts.idText(name) === "__esModule") {
return grammarErrorOnNode(name, ts.Diagnostics.Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules);
}
@@ -60003,8 +60883,8 @@
return false;
}
function checkGrammarNameInLetOrConstDeclarations(name) {
- if (name.kind === 72 /* Identifier */) {
- if (name.originalKeywordKind === 111 /* LetKeyword */) {
+ if (name.kind === 73 /* Identifier */) {
+ if (name.originalKeywordKind === 112 /* LetKeyword */) {
return grammarErrorOnNode(name, ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations);
}
}
@@ -60031,15 +60911,15 @@
}
function allowLetAndConstDeclarations(parent) {
switch (parent.kind) {
- case 222 /* IfStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
- case 231 /* WithStatement */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 223 /* IfStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
+ case 232 /* WithStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
return false;
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return allowLetAndConstDeclarations(parent.parent);
}
return true;
@@ -60057,12 +60937,12 @@
function checkGrammarMetaProperty(node) {
var escapedText = node.name.escapedText;
switch (node.keywordToken) {
- case 95 /* NewKeyword */:
+ case 96 /* NewKeyword */:
if (escapedText !== "target") {
return grammarErrorOnNode(node.name, ts.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.escapedText, ts.tokenToString(node.keywordToken), "target");
}
break;
- case 92 /* ImportKeyword */:
+ case 93 /* ImportKeyword */:
if (escapedText !== "meta") {
return grammarErrorOnNode(node.name, ts.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.escapedText, ts.tokenToString(node.keywordToken), "meta");
}
@@ -60113,11 +60993,14 @@
}
function checkGrammarProperty(node) {
if (ts.isClassLike(node.parent)) {
+ if (ts.isStringLiteral(node.name) && node.name.text === "constructor") {
+ return grammarErrorOnNode(node.name, ts.Diagnostics.Classes_may_not_have_a_field_named_constructor);
+ }
if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) {
return true;
}
}
- else if (node.parent.kind === 241 /* InterfaceDeclaration */) {
+ else if (node.parent.kind === 242 /* InterfaceDeclaration */) {
if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) {
return true;
}
@@ -60125,7 +61008,7 @@
return grammarErrorOnNode(node.initializer, ts.Diagnostics.An_interface_property_cannot_have_an_initializer);
}
}
- else if (node.parent.kind === 168 /* TypeLiteral */) {
+ else if (node.parent.kind === 169 /* TypeLiteral */) {
if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) {
return true;
}
@@ -60154,22 +61037,22 @@
// export_opt AmbientDeclaration
//
// TODO: The spec needs to be amended to reflect this grammar.
- if (node.kind === 241 /* InterfaceDeclaration */ ||
- node.kind === 242 /* TypeAliasDeclaration */ ||
- node.kind === 249 /* ImportDeclaration */ ||
- node.kind === 248 /* ImportEqualsDeclaration */ ||
- node.kind === 255 /* ExportDeclaration */ ||
- node.kind === 254 /* ExportAssignment */ ||
- node.kind === 247 /* NamespaceExportDeclaration */ ||
+ if (node.kind === 242 /* InterfaceDeclaration */ ||
+ node.kind === 243 /* TypeAliasDeclaration */ ||
+ node.kind === 250 /* ImportDeclaration */ ||
+ node.kind === 249 /* ImportEqualsDeclaration */ ||
+ node.kind === 256 /* ExportDeclaration */ ||
+ node.kind === 255 /* ExportAssignment */ ||
+ node.kind === 248 /* NamespaceExportDeclaration */ ||
ts.hasModifier(node, 2 /* Ambient */ | 1 /* Export */ | 512 /* Default */)) {
return false;
}
- return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file);
+ return grammarErrorOnFirstToken(node, ts.Diagnostics.Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier);
}
function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) {
for (var _i = 0, _a = file.statements; _i < _a.length; _i++) {
var decl = _a[_i];
- if (ts.isDeclaration(decl) || decl.kind === 219 /* VariableStatement */) {
+ if (ts.isDeclaration(decl) || decl.kind === 220 /* VariableStatement */) {
if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) {
return true;
}
@@ -60196,7 +61079,7 @@
// to prevent noisiness. So use a bit on the block to indicate if
// this has already been reported, and don't report if it has.
//
- if (node.parent.kind === 218 /* Block */ || node.parent.kind === 245 /* ModuleBlock */ || node.parent.kind === 284 /* SourceFile */) {
+ if (node.parent.kind === 219 /* Block */ || node.parent.kind === 246 /* ModuleBlock */ || node.parent.kind === 285 /* SourceFile */) {
var links_2 = getNodeLinks(node.parent);
// Check if the containing block ever report this error
if (!links_2.hasReportedStatementInAmbientContext) {
@@ -60218,10 +61101,10 @@
if (languageVersion >= 1 /* ES5 */) {
diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0;
}
- else if (ts.isChildOfNodeWithKind(node, 182 /* LiteralType */)) {
+ else if (ts.isChildOfNodeWithKind(node, 183 /* LiteralType */)) {
diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0;
}
- else if (ts.isChildOfNodeWithKind(node, 278 /* EnumMember */)) {
+ else if (ts.isChildOfNodeWithKind(node, 279 /* EnumMember */)) {
diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0;
}
if (diagnosticMessage) {
@@ -60236,7 +61119,7 @@
var literalType = ts.isLiteralTypeNode(node.parent) ||
ts.isPrefixUnaryExpression(node.parent) && ts.isLiteralTypeNode(node.parent.parent);
if (!literalType) {
- if (languageVersion < 7 /* ESNext */) {
+ if (languageVersion < 8 /* ESNext */) {
if (grammarErrorOnNode(node, ts.Diagnostics.BigInt_literals_are_not_available_when_targeting_lower_than_ESNext)) {
return true;
}
@@ -60289,8 +61172,8 @@
/** Like 'isDeclarationName', but returns true for LHS of `import { x as y }` or `export { x as y }`. */
function isDeclarationNameOrImportPropertyName(name) {
switch (name.parent.kind) {
- case 253 /* ImportSpecifier */:
- case 257 /* ExportSpecifier */:
+ case 254 /* ImportSpecifier */:
+ case 258 /* ExportSpecifier */:
return ts.isIdentifier(name);
default:
return ts.isDeclarationName(name);
@@ -60298,14 +61181,14 @@
}
function isSomeImportDeclaration(decl) {
switch (decl.kind) {
- case 250 /* ImportClause */: // For default import
- case 248 /* ImportEqualsDeclaration */:
- case 251 /* NamespaceImport */:
- case 253 /* ImportSpecifier */: // For rename import `x as y`
+ case 251 /* ImportClause */: // For default import
+ case 249 /* ImportEqualsDeclaration */:
+ case 252 /* NamespaceImport */:
+ case 254 /* ImportSpecifier */: // For rename import `x as y`
return true;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
// For regular import, `decl` is an Identifier under the ImportSpecifier.
- return decl.parent.kind === 253 /* ImportSpecifier */;
+ return decl.parent.kind === 254 /* ImportSpecifier */;
default:
return false;
}
@@ -60433,7 +61316,7 @@
return node;
}
function createIdentifier(text, typeArguments) {
- var node = createSynthesizedNode(72 /* Identifier */);
+ var node = createSynthesizedNode(73 /* Identifier */);
node.escapedText = ts.escapeLeadingUnderscores(text);
node.originalKeywordKind = text ? ts.stringToToken(text) : 0 /* Unknown */;
node.autoGenerateFlags = 0 /* None */;
@@ -60514,23 +61397,23 @@
ts.createToken = createToken;
// Reserved words
function createSuper() {
- return createSynthesizedNode(98 /* SuperKeyword */);
+ return createSynthesizedNode(99 /* SuperKeyword */);
}
ts.createSuper = createSuper;
function createThis() {
- return createSynthesizedNode(100 /* ThisKeyword */);
+ return createSynthesizedNode(101 /* ThisKeyword */);
}
ts.createThis = createThis;
function createNull() {
- return createSynthesizedNode(96 /* NullKeyword */);
+ return createSynthesizedNode(97 /* NullKeyword */);
}
ts.createNull = createNull;
function createTrue() {
- return createSynthesizedNode(102 /* TrueKeyword */);
+ return createSynthesizedNode(103 /* TrueKeyword */);
}
ts.createTrue = createTrue;
function createFalse() {
- return createSynthesizedNode(87 /* FalseKeyword */);
+ return createSynthesizedNode(88 /* FalseKeyword */);
}
ts.createFalse = createFalse;
// Modifiers
@@ -60541,44 +61424,44 @@
function createModifiersFromModifierFlags(flags) {
var result = [];
if (flags & 1 /* Export */) {
- result.push(createModifier(85 /* ExportKeyword */));
+ result.push(createModifier(86 /* ExportKeyword */));
}
if (flags & 2 /* Ambient */) {
- result.push(createModifier(125 /* DeclareKeyword */));
+ result.push(createModifier(126 /* DeclareKeyword */));
}
if (flags & 512 /* Default */) {
- result.push(createModifier(80 /* DefaultKeyword */));
+ result.push(createModifier(81 /* DefaultKeyword */));
}
if (flags & 2048 /* Const */) {
- result.push(createModifier(77 /* ConstKeyword */));
+ result.push(createModifier(78 /* ConstKeyword */));
}
if (flags & 4 /* Public */) {
- result.push(createModifier(115 /* PublicKeyword */));
+ result.push(createModifier(116 /* PublicKeyword */));
}
if (flags & 8 /* Private */) {
- result.push(createModifier(113 /* PrivateKeyword */));
+ result.push(createModifier(114 /* PrivateKeyword */));
}
if (flags & 16 /* Protected */) {
- result.push(createModifier(114 /* ProtectedKeyword */));
+ result.push(createModifier(115 /* ProtectedKeyword */));
}
if (flags & 128 /* Abstract */) {
- result.push(createModifier(118 /* AbstractKeyword */));
+ result.push(createModifier(119 /* AbstractKeyword */));
}
if (flags & 32 /* Static */) {
- result.push(createModifier(116 /* StaticKeyword */));
+ result.push(createModifier(117 /* StaticKeyword */));
}
if (flags & 64 /* Readonly */) {
- result.push(createModifier(133 /* ReadonlyKeyword */));
+ result.push(createModifier(134 /* ReadonlyKeyword */));
}
if (flags & 256 /* Async */) {
- result.push(createModifier(121 /* AsyncKeyword */));
+ result.push(createModifier(122 /* AsyncKeyword */));
}
return result;
}
ts.createModifiersFromModifierFlags = createModifiersFromModifierFlags;
// Names
function createQualifiedName(left, right) {
- var node = createSynthesizedNode(148 /* QualifiedName */);
+ var node = createSynthesizedNode(149 /* QualifiedName */);
node.left = left;
node.right = asName(right);
return node;
@@ -60597,7 +61480,7 @@
: expression;
}
function createComputedPropertyName(expression) {
- var node = createSynthesizedNode(149 /* ComputedPropertyName */);
+ var node = createSynthesizedNode(150 /* ComputedPropertyName */);
node.expression = parenthesizeForComputedName(expression);
return node;
}
@@ -60610,7 +61493,7 @@
ts.updateComputedPropertyName = updateComputedPropertyName;
// Signature elements
function createTypeParameterDeclaration(name, constraint, defaultType) {
- var node = createSynthesizedNode(150 /* TypeParameter */);
+ var node = createSynthesizedNode(151 /* TypeParameter */);
node.name = asName(name);
node.constraint = constraint;
node.default = defaultType;
@@ -60626,7 +61509,7 @@
}
ts.updateTypeParameterDeclaration = updateTypeParameterDeclaration;
function createParameter(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer) {
- var node = createSynthesizedNode(151 /* Parameter */);
+ var node = createSynthesizedNode(152 /* Parameter */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.dotDotDotToken = dotDotDotToken;
@@ -60650,7 +61533,7 @@
}
ts.updateParameter = updateParameter;
function createDecorator(expression) {
- var node = createSynthesizedNode(152 /* Decorator */);
+ var node = createSynthesizedNode(153 /* Decorator */);
node.expression = ts.parenthesizeForAccess(expression);
return node;
}
@@ -60663,7 +61546,7 @@
ts.updateDecorator = updateDecorator;
// Type Elements
function createPropertySignature(modifiers, name, questionToken, type, initializer) {
- var node = createSynthesizedNode(153 /* PropertySignature */);
+ var node = createSynthesizedNode(154 /* PropertySignature */);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
node.questionToken = questionToken;
@@ -60683,7 +61566,7 @@
}
ts.updatePropertySignature = updatePropertySignature;
function createProperty(decorators, modifiers, name, questionOrExclamationToken, type, initializer) {
- var node = createSynthesizedNode(154 /* PropertyDeclaration */);
+ var node = createSynthesizedNode(155 /* PropertyDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -60707,7 +61590,7 @@
}
ts.updateProperty = updateProperty;
function createMethodSignature(typeParameters, parameters, type, name, questionToken) {
- var node = createSignatureDeclaration(155 /* MethodSignature */, typeParameters, parameters, type);
+ var node = createSignatureDeclaration(156 /* MethodSignature */, typeParameters, parameters, type);
node.name = asName(name);
node.questionToken = questionToken;
return node;
@@ -60724,7 +61607,7 @@
}
ts.updateMethodSignature = updateMethodSignature;
function createMethod(decorators, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) {
- var node = createSynthesizedNode(156 /* MethodDeclaration */);
+ var node = createSynthesizedNode(157 /* MethodDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.asteriskToken = asteriskToken;
@@ -60752,7 +61635,7 @@
}
ts.updateMethod = updateMethod;
function createConstructor(decorators, modifiers, parameters, body) {
- var node = createSynthesizedNode(157 /* Constructor */);
+ var node = createSynthesizedNode(158 /* Constructor */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.typeParameters = undefined;
@@ -60772,7 +61655,7 @@
}
ts.updateConstructor = updateConstructor;
function createGetAccessor(decorators, modifiers, name, parameters, type, body) {
- var node = createSynthesizedNode(158 /* GetAccessor */);
+ var node = createSynthesizedNode(159 /* GetAccessor */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -60795,7 +61678,7 @@
}
ts.updateGetAccessor = updateGetAccessor;
function createSetAccessor(decorators, modifiers, name, parameters, body) {
- var node = createSynthesizedNode(159 /* SetAccessor */);
+ var node = createSynthesizedNode(160 /* SetAccessor */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -60816,7 +61699,7 @@
}
ts.updateSetAccessor = updateSetAccessor;
function createCallSignature(typeParameters, parameters, type) {
- return createSignatureDeclaration(160 /* CallSignature */, typeParameters, parameters, type);
+ return createSignatureDeclaration(161 /* CallSignature */, typeParameters, parameters, type);
}
ts.createCallSignature = createCallSignature;
function updateCallSignature(node, typeParameters, parameters, type) {
@@ -60824,7 +61707,7 @@
}
ts.updateCallSignature = updateCallSignature;
function createConstructSignature(typeParameters, parameters, type) {
- return createSignatureDeclaration(161 /* ConstructSignature */, typeParameters, parameters, type);
+ return createSignatureDeclaration(162 /* ConstructSignature */, typeParameters, parameters, type);
}
ts.createConstructSignature = createConstructSignature;
function updateConstructSignature(node, typeParameters, parameters, type) {
@@ -60832,7 +61715,7 @@
}
ts.updateConstructSignature = updateConstructSignature;
function createIndexSignature(decorators, modifiers, parameters, type) {
- var node = createSynthesizedNode(162 /* IndexSignature */);
+ var node = createSynthesizedNode(163 /* IndexSignature */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.parameters = createNodeArray(parameters);
@@ -60872,7 +61755,7 @@
}
ts.createKeywordTypeNode = createKeywordTypeNode;
function createTypePredicateNode(parameterName, type) {
- var node = createSynthesizedNode(163 /* TypePredicate */);
+ var node = createSynthesizedNode(164 /* TypePredicate */);
node.parameterName = asName(parameterName);
node.type = type;
return node;
@@ -60886,7 +61769,7 @@
}
ts.updateTypePredicateNode = updateTypePredicateNode;
function createTypeReferenceNode(typeName, typeArguments) {
- var node = createSynthesizedNode(164 /* TypeReference */);
+ var node = createSynthesizedNode(165 /* TypeReference */);
node.typeName = asName(typeName);
node.typeArguments = typeArguments && ts.parenthesizeTypeParameters(typeArguments);
return node;
@@ -60900,7 +61783,7 @@
}
ts.updateTypeReferenceNode = updateTypeReferenceNode;
function createFunctionTypeNode(typeParameters, parameters, type) {
- return createSignatureDeclaration(165 /* FunctionType */, typeParameters, parameters, type);
+ return createSignatureDeclaration(166 /* FunctionType */, typeParameters, parameters, type);
}
ts.createFunctionTypeNode = createFunctionTypeNode;
function updateFunctionTypeNode(node, typeParameters, parameters, type) {
@@ -60908,7 +61791,7 @@
}
ts.updateFunctionTypeNode = updateFunctionTypeNode;
function createConstructorTypeNode(typeParameters, parameters, type) {
- return createSignatureDeclaration(166 /* ConstructorType */, typeParameters, parameters, type);
+ return createSignatureDeclaration(167 /* ConstructorType */, typeParameters, parameters, type);
}
ts.createConstructorTypeNode = createConstructorTypeNode;
function updateConstructorTypeNode(node, typeParameters, parameters, type) {
@@ -60916,7 +61799,7 @@
}
ts.updateConstructorTypeNode = updateConstructorTypeNode;
function createTypeQueryNode(exprName) {
- var node = createSynthesizedNode(167 /* TypeQuery */);
+ var node = createSynthesizedNode(168 /* TypeQuery */);
node.exprName = exprName;
return node;
}
@@ -60928,7 +61811,7 @@
}
ts.updateTypeQueryNode = updateTypeQueryNode;
function createTypeLiteralNode(members) {
- var node = createSynthesizedNode(168 /* TypeLiteral */);
+ var node = createSynthesizedNode(169 /* TypeLiteral */);
node.members = createNodeArray(members);
return node;
}
@@ -60940,7 +61823,7 @@
}
ts.updateTypeLiteralNode = updateTypeLiteralNode;
function createArrayTypeNode(elementType) {
- var node = createSynthesizedNode(169 /* ArrayType */);
+ var node = createSynthesizedNode(170 /* ArrayType */);
node.elementType = ts.parenthesizeArrayTypeMember(elementType);
return node;
}
@@ -60952,7 +61835,7 @@
}
ts.updateArrayTypeNode = updateArrayTypeNode;
function createTupleTypeNode(elementTypes) {
- var node = createSynthesizedNode(170 /* TupleType */);
+ var node = createSynthesizedNode(171 /* TupleType */);
node.elementTypes = createNodeArray(elementTypes);
return node;
}
@@ -60964,7 +61847,7 @@
}
ts.updateTupleTypeNode = updateTupleTypeNode;
function createOptionalTypeNode(type) {
- var node = createSynthesizedNode(171 /* OptionalType */);
+ var node = createSynthesizedNode(172 /* OptionalType */);
node.type = ts.parenthesizeArrayTypeMember(type);
return node;
}
@@ -60976,7 +61859,7 @@
}
ts.updateOptionalTypeNode = updateOptionalTypeNode;
function createRestTypeNode(type) {
- var node = createSynthesizedNode(172 /* RestType */);
+ var node = createSynthesizedNode(173 /* RestType */);
node.type = type;
return node;
}
@@ -60988,7 +61871,7 @@
}
ts.updateRestTypeNode = updateRestTypeNode;
function createUnionTypeNode(types) {
- return createUnionOrIntersectionTypeNode(173 /* UnionType */, types);
+ return createUnionOrIntersectionTypeNode(174 /* UnionType */, types);
}
ts.createUnionTypeNode = createUnionTypeNode;
function updateUnionTypeNode(node, types) {
@@ -60996,7 +61879,7 @@
}
ts.updateUnionTypeNode = updateUnionTypeNode;
function createIntersectionTypeNode(types) {
- return createUnionOrIntersectionTypeNode(174 /* IntersectionType */, types);
+ return createUnionOrIntersectionTypeNode(175 /* IntersectionType */, types);
}
ts.createIntersectionTypeNode = createIntersectionTypeNode;
function updateIntersectionTypeNode(node, types) {
@@ -61015,7 +61898,7 @@
: node;
}
function createConditionalTypeNode(checkType, extendsType, trueType, falseType) {
- var node = createSynthesizedNode(175 /* ConditionalType */);
+ var node = createSynthesizedNode(176 /* ConditionalType */);
node.checkType = ts.parenthesizeConditionalTypeMember(checkType);
node.extendsType = ts.parenthesizeConditionalTypeMember(extendsType);
node.trueType = trueType;
@@ -61033,7 +61916,7 @@
}
ts.updateConditionalTypeNode = updateConditionalTypeNode;
function createInferTypeNode(typeParameter) {
- var node = createSynthesizedNode(176 /* InferType */);
+ var node = createSynthesizedNode(177 /* InferType */);
node.typeParameter = typeParameter;
return node;
}
@@ -61045,10 +61928,10 @@
}
ts.updateInferTypeNode = updateInferTypeNode;
function createImportTypeNode(argument, qualifier, typeArguments, isTypeOf) {
- var node = createSynthesizedNode(183 /* ImportType */);
+ var node = createSynthesizedNode(184 /* ImportType */);
node.argument = argument;
node.qualifier = qualifier;
- node.typeArguments = asNodeArray(typeArguments);
+ node.typeArguments = ts.parenthesizeTypeParameters(typeArguments);
node.isTypeOf = isTypeOf;
return node;
}
@@ -61063,7 +61946,7 @@
}
ts.updateImportTypeNode = updateImportTypeNode;
function createParenthesizedType(type) {
- var node = createSynthesizedNode(177 /* ParenthesizedType */);
+ var node = createSynthesizedNode(178 /* ParenthesizedType */);
node.type = type;
return node;
}
@@ -61075,12 +61958,12 @@
}
ts.updateParenthesizedType = updateParenthesizedType;
function createThisTypeNode() {
- return createSynthesizedNode(178 /* ThisType */);
+ return createSynthesizedNode(179 /* ThisType */);
}
ts.createThisTypeNode = createThisTypeNode;
function createTypeOperatorNode(operatorOrType, type) {
- var node = createSynthesizedNode(179 /* TypeOperator */);
- node.operator = typeof operatorOrType === "number" ? operatorOrType : 129 /* KeyOfKeyword */;
+ var node = createSynthesizedNode(180 /* TypeOperator */);
+ node.operator = typeof operatorOrType === "number" ? operatorOrType : 130 /* KeyOfKeyword */;
node.type = ts.parenthesizeElementTypeMember(typeof operatorOrType === "number" ? type : operatorOrType);
return node;
}
@@ -61090,7 +61973,7 @@
}
ts.updateTypeOperatorNode = updateTypeOperatorNode;
function createIndexedAccessTypeNode(objectType, indexType) {
- var node = createSynthesizedNode(180 /* IndexedAccessType */);
+ var node = createSynthesizedNode(181 /* IndexedAccessType */);
node.objectType = ts.parenthesizeElementTypeMember(objectType);
node.indexType = indexType;
return node;
@@ -61104,7 +61987,7 @@
}
ts.updateIndexedAccessTypeNode = updateIndexedAccessTypeNode;
function createMappedTypeNode(readonlyToken, typeParameter, questionToken, type) {
- var node = createSynthesizedNode(181 /* MappedType */);
+ var node = createSynthesizedNode(182 /* MappedType */);
node.readonlyToken = readonlyToken;
node.typeParameter = typeParameter;
node.questionToken = questionToken;
@@ -61122,7 +62005,7 @@
}
ts.updateMappedTypeNode = updateMappedTypeNode;
function createLiteralTypeNode(literal) {
- var node = createSynthesizedNode(182 /* LiteralType */);
+ var node = createSynthesizedNode(183 /* LiteralType */);
node.literal = literal;
return node;
}
@@ -61135,7 +62018,7 @@
ts.updateLiteralTypeNode = updateLiteralTypeNode;
// Binding Patterns
function createObjectBindingPattern(elements) {
- var node = createSynthesizedNode(184 /* ObjectBindingPattern */);
+ var node = createSynthesizedNode(185 /* ObjectBindingPattern */);
node.elements = createNodeArray(elements);
return node;
}
@@ -61147,7 +62030,7 @@
}
ts.updateObjectBindingPattern = updateObjectBindingPattern;
function createArrayBindingPattern(elements) {
- var node = createSynthesizedNode(185 /* ArrayBindingPattern */);
+ var node = createSynthesizedNode(186 /* ArrayBindingPattern */);
node.elements = createNodeArray(elements);
return node;
}
@@ -61159,7 +62042,7 @@
}
ts.updateArrayBindingPattern = updateArrayBindingPattern;
function createBindingElement(dotDotDotToken, propertyName, name, initializer) {
- var node = createSynthesizedNode(186 /* BindingElement */);
+ var node = createSynthesizedNode(187 /* BindingElement */);
node.dotDotDotToken = dotDotDotToken;
node.propertyName = asName(propertyName);
node.name = asName(name);
@@ -61178,7 +62061,7 @@
ts.updateBindingElement = updateBindingElement;
// Expression
function createArrayLiteral(elements, multiLine) {
- var node = createSynthesizedNode(187 /* ArrayLiteralExpression */);
+ var node = createSynthesizedNode(188 /* ArrayLiteralExpression */);
node.elements = ts.parenthesizeListElements(createNodeArray(elements));
if (multiLine)
node.multiLine = true;
@@ -61192,7 +62075,7 @@
}
ts.updateArrayLiteral = updateArrayLiteral;
function createObjectLiteral(properties, multiLine) {
- var node = createSynthesizedNode(188 /* ObjectLiteralExpression */);
+ var node = createSynthesizedNode(189 /* ObjectLiteralExpression */);
node.properties = createNodeArray(properties);
if (multiLine)
node.multiLine = true;
@@ -61206,9 +62089,9 @@
}
ts.updateObjectLiteral = updateObjectLiteral;
function createPropertyAccess(expression, name) {
- var node = createSynthesizedNode(189 /* PropertyAccessExpression */);
+ var node = createSynthesizedNode(190 /* PropertyAccessExpression */);
node.expression = ts.parenthesizeForAccess(expression);
- node.name = asName(name); // TODO: GH#18217
+ node.name = asName(name);
setEmitFlags(node, 131072 /* NoIndentation */);
return node;
}
@@ -61223,7 +62106,7 @@
}
ts.updatePropertyAccess = updatePropertyAccess;
function createElementAccess(expression, index) {
- var node = createSynthesizedNode(190 /* ElementAccessExpression */);
+ var node = createSynthesizedNode(191 /* ElementAccessExpression */);
node.expression = ts.parenthesizeForAccess(expression);
node.argumentExpression = asExpression(index);
return node;
@@ -61237,7 +62120,7 @@
}
ts.updateElementAccess = updateElementAccess;
function createCall(expression, typeArguments, argumentsArray) {
- var node = createSynthesizedNode(191 /* CallExpression */);
+ var node = createSynthesizedNode(192 /* CallExpression */);
node.expression = ts.parenthesizeForAccess(expression);
node.typeArguments = asNodeArray(typeArguments);
node.arguments = ts.parenthesizeListElements(createNodeArray(argumentsArray));
@@ -61253,7 +62136,7 @@
}
ts.updateCall = updateCall;
function createNew(expression, typeArguments, argumentsArray) {
- var node = createSynthesizedNode(192 /* NewExpression */);
+ var node = createSynthesizedNode(193 /* NewExpression */);
node.expression = ts.parenthesizeForNew(expression);
node.typeArguments = asNodeArray(typeArguments);
node.arguments = argumentsArray ? ts.parenthesizeListElements(createNodeArray(argumentsArray)) : undefined;
@@ -61269,7 +62152,7 @@
}
ts.updateNew = updateNew;
function createTaggedTemplate(tag, typeArgumentsOrTemplate, template) {
- var node = createSynthesizedNode(193 /* TaggedTemplateExpression */);
+ var node = createSynthesizedNode(194 /* TaggedTemplateExpression */);
node.tag = ts.parenthesizeForAccess(tag);
if (template) {
node.typeArguments = asNodeArray(typeArgumentsOrTemplate);
@@ -61292,7 +62175,7 @@
}
ts.updateTaggedTemplate = updateTaggedTemplate;
function createTypeAssertion(type, expression) {
- var node = createSynthesizedNode(194 /* TypeAssertionExpression */);
+ var node = createSynthesizedNode(195 /* TypeAssertionExpression */);
node.type = type;
node.expression = ts.parenthesizePrefixOperand(expression);
return node;
@@ -61306,7 +62189,7 @@
}
ts.updateTypeAssertion = updateTypeAssertion;
function createParen(expression) {
- var node = createSynthesizedNode(195 /* ParenthesizedExpression */);
+ var node = createSynthesizedNode(196 /* ParenthesizedExpression */);
node.expression = expression;
return node;
}
@@ -61318,7 +62201,7 @@
}
ts.updateParen = updateParen;
function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body) {
- var node = createSynthesizedNode(196 /* FunctionExpression */);
+ var node = createSynthesizedNode(197 /* FunctionExpression */);
node.modifiers = asNodeArray(modifiers);
node.asteriskToken = asteriskToken;
node.name = asName(name);
@@ -61342,7 +62225,7 @@
}
ts.updateFunctionExpression = updateFunctionExpression;
function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) {
- var node = createSynthesizedNode(197 /* ArrowFunction */);
+ var node = createSynthesizedNode(198 /* ArrowFunction */);
node.modifiers = asNodeArray(modifiers);
node.typeParameters = asNodeArray(typeParameters);
node.parameters = createNodeArray(parameters);
@@ -61364,7 +62247,7 @@
}
ts.updateArrowFunction = updateArrowFunction;
function createDelete(expression) {
- var node = createSynthesizedNode(198 /* DeleteExpression */);
+ var node = createSynthesizedNode(199 /* DeleteExpression */);
node.expression = ts.parenthesizePrefixOperand(expression);
return node;
}
@@ -61376,7 +62259,7 @@
}
ts.updateDelete = updateDelete;
function createTypeOf(expression) {
- var node = createSynthesizedNode(199 /* TypeOfExpression */);
+ var node = createSynthesizedNode(200 /* TypeOfExpression */);
node.expression = ts.parenthesizePrefixOperand(expression);
return node;
}
@@ -61388,7 +62271,7 @@
}
ts.updateTypeOf = updateTypeOf;
function createVoid(expression) {
- var node = createSynthesizedNode(200 /* VoidExpression */);
+ var node = createSynthesizedNode(201 /* VoidExpression */);
node.expression = ts.parenthesizePrefixOperand(expression);
return node;
}
@@ -61400,7 +62283,7 @@
}
ts.updateVoid = updateVoid;
function createAwait(expression) {
- var node = createSynthesizedNode(201 /* AwaitExpression */);
+ var node = createSynthesizedNode(202 /* AwaitExpression */);
node.expression = ts.parenthesizePrefixOperand(expression);
return node;
}
@@ -61412,7 +62295,7 @@
}
ts.updateAwait = updateAwait;
function createPrefix(operator, operand) {
- var node = createSynthesizedNode(202 /* PrefixUnaryExpression */);
+ var node = createSynthesizedNode(203 /* PrefixUnaryExpression */);
node.operator = operator;
node.operand = ts.parenthesizePrefixOperand(operand);
return node;
@@ -61425,7 +62308,7 @@
}
ts.updatePrefix = updatePrefix;
function createPostfix(operand, operator) {
- var node = createSynthesizedNode(203 /* PostfixUnaryExpression */);
+ var node = createSynthesizedNode(204 /* PostfixUnaryExpression */);
node.operand = ts.parenthesizePostfixOperand(operand);
node.operator = operator;
return node;
@@ -61438,7 +62321,7 @@
}
ts.updatePostfix = updatePostfix;
function createBinary(left, operator, right) {
- var node = createSynthesizedNode(204 /* BinaryExpression */);
+ var node = createSynthesizedNode(205 /* BinaryExpression */);
var operatorToken = asToken(operator);
var operatorKind = operatorToken.kind;
node.left = ts.parenthesizeBinaryOperand(operatorKind, left, /*isLeftSideOfBinary*/ true, /*leftOperand*/ undefined);
@@ -61455,7 +62338,7 @@
}
ts.updateBinary = updateBinary;
function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonToken, whenFalse) {
- var node = createSynthesizedNode(205 /* ConditionalExpression */);
+ var node = createSynthesizedNode(206 /* ConditionalExpression */);
node.condition = ts.parenthesizeForConditionalHead(condition);
node.questionToken = whenFalse ? questionTokenOrWhenTrue : createToken(56 /* QuestionToken */);
node.whenTrue = ts.parenthesizeSubexpressionOfConditionalExpression(whenFalse ? whenTrueOrWhenFalse : questionTokenOrWhenTrue);
@@ -61475,7 +62358,7 @@
}
ts.updateConditional = updateConditional;
function createTemplateExpression(head, templateSpans) {
- var node = createSynthesizedNode(206 /* TemplateExpression */);
+ var node = createSynthesizedNode(207 /* TemplateExpression */);
node.head = head;
node.templateSpans = createNodeArray(templateSpans);
return node;
@@ -61513,7 +62396,7 @@
}
ts.createNoSubstitutionTemplateLiteral = createNoSubstitutionTemplateLiteral;
function createYield(asteriskTokenOrExpression, expression) {
- var node = createSynthesizedNode(207 /* YieldExpression */);
+ var node = createSynthesizedNode(208 /* YieldExpression */);
node.asteriskToken = asteriskTokenOrExpression && asteriskTokenOrExpression.kind === 40 /* AsteriskToken */ ? asteriskTokenOrExpression : undefined;
node.expression = asteriskTokenOrExpression && asteriskTokenOrExpression.kind !== 40 /* AsteriskToken */ ? asteriskTokenOrExpression : expression;
return node;
@@ -61527,7 +62410,7 @@
}
ts.updateYield = updateYield;
function createSpread(expression) {
- var node = createSynthesizedNode(208 /* SpreadElement */);
+ var node = createSynthesizedNode(209 /* SpreadElement */);
node.expression = ts.parenthesizeExpressionForList(expression);
return node;
}
@@ -61539,7 +62422,7 @@
}
ts.updateSpread = updateSpread;
function createClassExpression(modifiers, name, typeParameters, heritageClauses, members) {
- var node = createSynthesizedNode(209 /* ClassExpression */);
+ var node = createSynthesizedNode(210 /* ClassExpression */);
node.decorators = undefined;
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -61560,11 +62443,11 @@
}
ts.updateClassExpression = updateClassExpression;
function createOmittedExpression() {
- return createSynthesizedNode(210 /* OmittedExpression */);
+ return createSynthesizedNode(211 /* OmittedExpression */);
}
ts.createOmittedExpression = createOmittedExpression;
function createExpressionWithTypeArguments(typeArguments, expression) {
- var node = createSynthesizedNode(211 /* ExpressionWithTypeArguments */);
+ var node = createSynthesizedNode(212 /* ExpressionWithTypeArguments */);
node.expression = ts.parenthesizeForAccess(expression);
node.typeArguments = asNodeArray(typeArguments);
return node;
@@ -61578,7 +62461,7 @@
}
ts.updateExpressionWithTypeArguments = updateExpressionWithTypeArguments;
function createAsExpression(expression, type) {
- var node = createSynthesizedNode(212 /* AsExpression */);
+ var node = createSynthesizedNode(213 /* AsExpression */);
node.expression = expression;
node.type = type;
return node;
@@ -61592,7 +62475,7 @@
}
ts.updateAsExpression = updateAsExpression;
function createNonNullExpression(expression) {
- var node = createSynthesizedNode(213 /* NonNullExpression */);
+ var node = createSynthesizedNode(214 /* NonNullExpression */);
node.expression = ts.parenthesizeForAccess(expression);
return node;
}
@@ -61604,7 +62487,7 @@
}
ts.updateNonNullExpression = updateNonNullExpression;
function createMetaProperty(keywordToken, name) {
- var node = createSynthesizedNode(214 /* MetaProperty */);
+ var node = createSynthesizedNode(215 /* MetaProperty */);
node.keywordToken = keywordToken;
node.name = name;
return node;
@@ -61618,7 +62501,7 @@
ts.updateMetaProperty = updateMetaProperty;
// Misc
function createTemplateSpan(expression, literal) {
- var node = createSynthesizedNode(216 /* TemplateSpan */);
+ var node = createSynthesizedNode(217 /* TemplateSpan */);
node.expression = expression;
node.literal = literal;
return node;
@@ -61632,12 +62515,12 @@
}
ts.updateTemplateSpan = updateTemplateSpan;
function createSemicolonClassElement() {
- return createSynthesizedNode(217 /* SemicolonClassElement */);
+ return createSynthesizedNode(218 /* SemicolonClassElement */);
}
ts.createSemicolonClassElement = createSemicolonClassElement;
// Element
function createBlock(statements, multiLine) {
- var block = createSynthesizedNode(218 /* Block */);
+ var block = createSynthesizedNode(219 /* Block */);
block.statements = createNodeArray(statements);
if (multiLine)
block.multiLine = multiLine;
@@ -61651,7 +62534,7 @@
}
ts.updateBlock = updateBlock;
function createVariableStatement(modifiers, declarationList) {
- var node = createSynthesizedNode(219 /* VariableStatement */);
+ var node = createSynthesizedNode(220 /* VariableStatement */);
node.decorators = undefined;
node.modifiers = asNodeArray(modifiers);
node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList;
@@ -61666,11 +62549,11 @@
}
ts.updateVariableStatement = updateVariableStatement;
function createEmptyStatement() {
- return createSynthesizedNode(220 /* EmptyStatement */);
+ return createSynthesizedNode(221 /* EmptyStatement */);
}
ts.createEmptyStatement = createEmptyStatement;
function createExpressionStatement(expression) {
- var node = createSynthesizedNode(221 /* ExpressionStatement */);
+ var node = createSynthesizedNode(222 /* ExpressionStatement */);
node.expression = ts.parenthesizeExpressionForExpressionStatement(expression);
return node;
}
@@ -61686,7 +62569,7 @@
/** @deprecated Use `updateExpressionStatement` instead. */
ts.updateStatement = updateExpressionStatement;
function createIf(expression, thenStatement, elseStatement) {
- var node = createSynthesizedNode(222 /* IfStatement */);
+ var node = createSynthesizedNode(223 /* IfStatement */);
node.expression = expression;
node.thenStatement = thenStatement;
node.elseStatement = elseStatement;
@@ -61702,7 +62585,7 @@
}
ts.updateIf = updateIf;
function createDo(statement, expression) {
- var node = createSynthesizedNode(223 /* DoStatement */);
+ var node = createSynthesizedNode(224 /* DoStatement */);
node.statement = statement;
node.expression = expression;
return node;
@@ -61716,7 +62599,7 @@
}
ts.updateDo = updateDo;
function createWhile(expression, statement) {
- var node = createSynthesizedNode(224 /* WhileStatement */);
+ var node = createSynthesizedNode(225 /* WhileStatement */);
node.expression = expression;
node.statement = statement;
return node;
@@ -61730,7 +62613,7 @@
}
ts.updateWhile = updateWhile;
function createFor(initializer, condition, incrementor, statement) {
- var node = createSynthesizedNode(225 /* ForStatement */);
+ var node = createSynthesizedNode(226 /* ForStatement */);
node.initializer = initializer;
node.condition = condition;
node.incrementor = incrementor;
@@ -61748,7 +62631,7 @@
}
ts.updateFor = updateFor;
function createForIn(initializer, expression, statement) {
- var node = createSynthesizedNode(226 /* ForInStatement */);
+ var node = createSynthesizedNode(227 /* ForInStatement */);
node.initializer = initializer;
node.expression = expression;
node.statement = statement;
@@ -61764,7 +62647,7 @@
}
ts.updateForIn = updateForIn;
function createForOf(awaitModifier, initializer, expression, statement) {
- var node = createSynthesizedNode(227 /* ForOfStatement */);
+ var node = createSynthesizedNode(228 /* ForOfStatement */);
node.awaitModifier = awaitModifier;
node.initializer = initializer;
node.expression = expression;
@@ -61782,7 +62665,7 @@
}
ts.updateForOf = updateForOf;
function createContinue(label) {
- var node = createSynthesizedNode(228 /* ContinueStatement */);
+ var node = createSynthesizedNode(229 /* ContinueStatement */);
node.label = asName(label);
return node;
}
@@ -61794,7 +62677,7 @@
}
ts.updateContinue = updateContinue;
function createBreak(label) {
- var node = createSynthesizedNode(229 /* BreakStatement */);
+ var node = createSynthesizedNode(230 /* BreakStatement */);
node.label = asName(label);
return node;
}
@@ -61806,7 +62689,7 @@
}
ts.updateBreak = updateBreak;
function createReturn(expression) {
- var node = createSynthesizedNode(230 /* ReturnStatement */);
+ var node = createSynthesizedNode(231 /* ReturnStatement */);
node.expression = expression;
return node;
}
@@ -61818,7 +62701,7 @@
}
ts.updateReturn = updateReturn;
function createWith(expression, statement) {
- var node = createSynthesizedNode(231 /* WithStatement */);
+ var node = createSynthesizedNode(232 /* WithStatement */);
node.expression = expression;
node.statement = statement;
return node;
@@ -61832,7 +62715,7 @@
}
ts.updateWith = updateWith;
function createSwitch(expression, caseBlock) {
- var node = createSynthesizedNode(232 /* SwitchStatement */);
+ var node = createSynthesizedNode(233 /* SwitchStatement */);
node.expression = ts.parenthesizeExpressionForList(expression);
node.caseBlock = caseBlock;
return node;
@@ -61846,7 +62729,7 @@
}
ts.updateSwitch = updateSwitch;
function createLabel(label, statement) {
- var node = createSynthesizedNode(233 /* LabeledStatement */);
+ var node = createSynthesizedNode(234 /* LabeledStatement */);
node.label = asName(label);
node.statement = statement;
return node;
@@ -61860,7 +62743,7 @@
}
ts.updateLabel = updateLabel;
function createThrow(expression) {
- var node = createSynthesizedNode(234 /* ThrowStatement */);
+ var node = createSynthesizedNode(235 /* ThrowStatement */);
node.expression = expression;
return node;
}
@@ -61872,7 +62755,7 @@
}
ts.updateThrow = updateThrow;
function createTry(tryBlock, catchClause, finallyBlock) {
- var node = createSynthesizedNode(235 /* TryStatement */);
+ var node = createSynthesizedNode(236 /* TryStatement */);
node.tryBlock = tryBlock;
node.catchClause = catchClause;
node.finallyBlock = finallyBlock;
@@ -61888,11 +62771,11 @@
}
ts.updateTry = updateTry;
function createDebuggerStatement() {
- return createSynthesizedNode(236 /* DebuggerStatement */);
+ return createSynthesizedNode(237 /* DebuggerStatement */);
}
ts.createDebuggerStatement = createDebuggerStatement;
function createVariableDeclaration(name, type, initializer) {
- var node = createSynthesizedNode(237 /* VariableDeclaration */);
+ var node = createSynthesizedNode(238 /* VariableDeclaration */);
node.name = asName(name);
node.type = type;
node.initializer = initializer !== undefined ? ts.parenthesizeExpressionForList(initializer) : undefined;
@@ -61909,7 +62792,7 @@
ts.updateVariableDeclaration = updateVariableDeclaration;
function createVariableDeclarationList(declarations, flags) {
if (flags === void 0) { flags = 0 /* None */; }
- var node = createSynthesizedNode(238 /* VariableDeclarationList */);
+ var node = createSynthesizedNode(239 /* VariableDeclarationList */);
node.flags |= flags & 3 /* BlockScoped */;
node.declarations = createNodeArray(declarations);
return node;
@@ -61922,7 +62805,7 @@
}
ts.updateVariableDeclarationList = updateVariableDeclarationList;
function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body) {
- var node = createSynthesizedNode(239 /* FunctionDeclaration */);
+ var node = createSynthesizedNode(240 /* FunctionDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.asteriskToken = asteriskToken;
@@ -61948,7 +62831,7 @@
}
ts.updateFunctionDeclaration = updateFunctionDeclaration;
function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members) {
- var node = createSynthesizedNode(240 /* ClassDeclaration */);
+ var node = createSynthesizedNode(241 /* ClassDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -61970,7 +62853,7 @@
}
ts.updateClassDeclaration = updateClassDeclaration;
function createInterfaceDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members) {
- var node = createSynthesizedNode(241 /* InterfaceDeclaration */);
+ var node = createSynthesizedNode(242 /* InterfaceDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -61992,7 +62875,7 @@
}
ts.updateInterfaceDeclaration = updateInterfaceDeclaration;
function createTypeAliasDeclaration(decorators, modifiers, name, typeParameters, type) {
- var node = createSynthesizedNode(242 /* TypeAliasDeclaration */);
+ var node = createSynthesizedNode(243 /* TypeAliasDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -62012,7 +62895,7 @@
}
ts.updateTypeAliasDeclaration = updateTypeAliasDeclaration;
function createEnumDeclaration(decorators, modifiers, name, members) {
- var node = createSynthesizedNode(243 /* EnumDeclaration */);
+ var node = createSynthesizedNode(244 /* EnumDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -62031,7 +62914,7 @@
ts.updateEnumDeclaration = updateEnumDeclaration;
function createModuleDeclaration(decorators, modifiers, name, body, flags) {
if (flags === void 0) { flags = 0 /* None */; }
- var node = createSynthesizedNode(244 /* ModuleDeclaration */);
+ var node = createSynthesizedNode(245 /* ModuleDeclaration */);
node.flags |= flags & (16 /* Namespace */ | 4 /* NestedNamespace */ | 512 /* GlobalAugmentation */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
@@ -62050,7 +62933,7 @@
}
ts.updateModuleDeclaration = updateModuleDeclaration;
function createModuleBlock(statements) {
- var node = createSynthesizedNode(245 /* ModuleBlock */);
+ var node = createSynthesizedNode(246 /* ModuleBlock */);
node.statements = createNodeArray(statements);
return node;
}
@@ -62062,7 +62945,7 @@
}
ts.updateModuleBlock = updateModuleBlock;
function createCaseBlock(clauses) {
- var node = createSynthesizedNode(246 /* CaseBlock */);
+ var node = createSynthesizedNode(247 /* CaseBlock */);
node.clauses = createNodeArray(clauses);
return node;
}
@@ -62074,7 +62957,7 @@
}
ts.updateCaseBlock = updateCaseBlock;
function createNamespaceExportDeclaration(name) {
- var node = createSynthesizedNode(247 /* NamespaceExportDeclaration */);
+ var node = createSynthesizedNode(248 /* NamespaceExportDeclaration */);
node.name = asName(name);
return node;
}
@@ -62086,7 +62969,7 @@
}
ts.updateNamespaceExportDeclaration = updateNamespaceExportDeclaration;
function createImportEqualsDeclaration(decorators, modifiers, name, moduleReference) {
- var node = createSynthesizedNode(248 /* ImportEqualsDeclaration */);
+ var node = createSynthesizedNode(249 /* ImportEqualsDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -62104,7 +62987,7 @@
}
ts.updateImportEqualsDeclaration = updateImportEqualsDeclaration;
function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier) {
- var node = createSynthesizedNode(249 /* ImportDeclaration */);
+ var node = createSynthesizedNode(250 /* ImportDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.importClause = importClause;
@@ -62122,7 +63005,7 @@
}
ts.updateImportDeclaration = updateImportDeclaration;
function createImportClause(name, namedBindings) {
- var node = createSynthesizedNode(250 /* ImportClause */);
+ var node = createSynthesizedNode(251 /* ImportClause */);
node.name = name;
node.namedBindings = namedBindings;
return node;
@@ -62136,7 +63019,7 @@
}
ts.updateImportClause = updateImportClause;
function createNamespaceImport(name) {
- var node = createSynthesizedNode(251 /* NamespaceImport */);
+ var node = createSynthesizedNode(252 /* NamespaceImport */);
node.name = name;
return node;
}
@@ -62148,7 +63031,7 @@
}
ts.updateNamespaceImport = updateNamespaceImport;
function createNamedImports(elements) {
- var node = createSynthesizedNode(252 /* NamedImports */);
+ var node = createSynthesizedNode(253 /* NamedImports */);
node.elements = createNodeArray(elements);
return node;
}
@@ -62160,7 +63043,7 @@
}
ts.updateNamedImports = updateNamedImports;
function createImportSpecifier(propertyName, name) {
- var node = createSynthesizedNode(253 /* ImportSpecifier */);
+ var node = createSynthesizedNode(254 /* ImportSpecifier */);
node.propertyName = propertyName;
node.name = name;
return node;
@@ -62174,11 +63057,11 @@
}
ts.updateImportSpecifier = updateImportSpecifier;
function createExportAssignment(decorators, modifiers, isExportEquals, expression) {
- var node = createSynthesizedNode(254 /* ExportAssignment */);
+ var node = createSynthesizedNode(255 /* ExportAssignment */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.isExportEquals = isExportEquals;
- node.expression = isExportEquals ? ts.parenthesizeBinaryOperand(59 /* EqualsToken */, expression, /*isLeftSideOfBinary*/ false, /*leftOperand*/ undefined) : ts.parenthesizeDefaultExpression(expression);
+ node.expression = isExportEquals ? ts.parenthesizeBinaryOperand(60 /* EqualsToken */, expression, /*isLeftSideOfBinary*/ false, /*leftOperand*/ undefined) : ts.parenthesizeDefaultExpression(expression);
return node;
}
ts.createExportAssignment = createExportAssignment;
@@ -62191,7 +63074,7 @@
}
ts.updateExportAssignment = updateExportAssignment;
function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier) {
- var node = createSynthesizedNode(255 /* ExportDeclaration */);
+ var node = createSynthesizedNode(256 /* ExportDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.exportClause = exportClause;
@@ -62209,7 +63092,7 @@
}
ts.updateExportDeclaration = updateExportDeclaration;
function createNamedExports(elements) {
- var node = createSynthesizedNode(256 /* NamedExports */);
+ var node = createSynthesizedNode(257 /* NamedExports */);
node.elements = createNodeArray(elements);
return node;
}
@@ -62221,7 +63104,7 @@
}
ts.updateNamedExports = updateNamedExports;
function createExportSpecifier(propertyName, name) {
- var node = createSynthesizedNode(257 /* ExportSpecifier */);
+ var node = createSynthesizedNode(258 /* ExportSpecifier */);
node.propertyName = asName(propertyName);
node.name = asName(name);
return node;
@@ -62236,7 +63119,7 @@
ts.updateExportSpecifier = updateExportSpecifier;
// Module references
function createExternalModuleReference(expression) {
- var node = createSynthesizedNode(259 /* ExternalModuleReference */);
+ var node = createSynthesizedNode(260 /* ExternalModuleReference */);
node.expression = expression;
return node;
}
@@ -62250,14 +63133,14 @@
// JSDoc
/* @internal */
function createJSDocTypeExpression(type) {
- var node = createSynthesizedNode(288 /* JSDocTypeExpression */);
+ var node = createSynthesizedNode(289 /* JSDocTypeExpression */);
node.type = type;
return node;
}
ts.createJSDocTypeExpression = createJSDocTypeExpression;
/* @internal */
function createJSDocTypeTag(typeExpression, comment) {
- var tag = createJSDocTag(307 /* JSDocTypeTag */, "type");
+ var tag = createJSDocTag(308 /* JSDocTypeTag */, "type");
tag.typeExpression = typeExpression;
tag.comment = comment;
return tag;
@@ -62265,7 +63148,7 @@
ts.createJSDocTypeTag = createJSDocTypeTag;
/* @internal */
function createJSDocReturnTag(typeExpression, comment) {
- var tag = createJSDocTag(305 /* JSDocReturnTag */, "returns");
+ var tag = createJSDocTag(306 /* JSDocReturnTag */, "returns");
tag.typeExpression = typeExpression;
tag.comment = comment;
return tag;
@@ -62273,7 +63156,7 @@
ts.createJSDocReturnTag = createJSDocReturnTag;
/* @internal */
function createJSDocParamTag(name, isBracketed, typeExpression, comment) {
- var tag = createJSDocTag(304 /* JSDocParameterTag */, "param");
+ var tag = createJSDocTag(305 /* JSDocParameterTag */, "param");
tag.typeExpression = typeExpression;
tag.name = name;
tag.isBracketed = isBracketed;
@@ -62283,7 +63166,7 @@
ts.createJSDocParamTag = createJSDocParamTag;
/* @internal */
function createJSDocComment(comment, tags) {
- var node = createSynthesizedNode(296 /* JSDocComment */);
+ var node = createSynthesizedNode(297 /* JSDocComment */);
node.comment = comment;
node.tags = tags;
return node;
@@ -62297,7 +63180,7 @@
}
// JSX
function createJsxElement(openingElement, children, closingElement) {
- var node = createSynthesizedNode(260 /* JsxElement */);
+ var node = createSynthesizedNode(261 /* JsxElement */);
node.openingElement = openingElement;
node.children = createNodeArray(children);
node.closingElement = closingElement;
@@ -62313,7 +63196,7 @@
}
ts.updateJsxElement = updateJsxElement;
function createJsxSelfClosingElement(tagName, typeArguments, attributes) {
- var node = createSynthesizedNode(261 /* JsxSelfClosingElement */);
+ var node = createSynthesizedNode(262 /* JsxSelfClosingElement */);
node.tagName = tagName;
node.typeArguments = asNodeArray(typeArguments);
node.attributes = attributes;
@@ -62329,7 +63212,7 @@
}
ts.updateJsxSelfClosingElement = updateJsxSelfClosingElement;
function createJsxOpeningElement(tagName, typeArguments, attributes) {
- var node = createSynthesizedNode(262 /* JsxOpeningElement */);
+ var node = createSynthesizedNode(263 /* JsxOpeningElement */);
node.tagName = tagName;
node.typeArguments = asNodeArray(typeArguments);
node.attributes = attributes;
@@ -62345,7 +63228,7 @@
}
ts.updateJsxOpeningElement = updateJsxOpeningElement;
function createJsxClosingElement(tagName) {
- var node = createSynthesizedNode(263 /* JsxClosingElement */);
+ var node = createSynthesizedNode(264 /* JsxClosingElement */);
node.tagName = tagName;
return node;
}
@@ -62357,7 +63240,7 @@
}
ts.updateJsxClosingElement = updateJsxClosingElement;
function createJsxFragment(openingFragment, children, closingFragment) {
- var node = createSynthesizedNode(264 /* JsxFragment */);
+ var node = createSynthesizedNode(265 /* JsxFragment */);
node.openingFragment = openingFragment;
node.children = createNodeArray(children);
node.closingFragment = closingFragment;
@@ -62379,11 +63262,11 @@
}
ts.updateJsxText = updateJsxText;
function createJsxOpeningFragment() {
- return createSynthesizedNode(265 /* JsxOpeningFragment */);
+ return createSynthesizedNode(266 /* JsxOpeningFragment */);
}
ts.createJsxOpeningFragment = createJsxOpeningFragment;
function createJsxJsxClosingFragment() {
- return createSynthesizedNode(266 /* JsxClosingFragment */);
+ return createSynthesizedNode(267 /* JsxClosingFragment */);
}
ts.createJsxJsxClosingFragment = createJsxJsxClosingFragment;
function updateJsxFragment(node, openingFragment, children, closingFragment) {
@@ -62395,7 +63278,7 @@
}
ts.updateJsxFragment = updateJsxFragment;
function createJsxAttribute(name, initializer) {
- var node = createSynthesizedNode(267 /* JsxAttribute */);
+ var node = createSynthesizedNode(268 /* JsxAttribute */);
node.name = name;
node.initializer = initializer;
return node;
@@ -62409,7 +63292,7 @@
}
ts.updateJsxAttribute = updateJsxAttribute;
function createJsxAttributes(properties) {
- var node = createSynthesizedNode(268 /* JsxAttributes */);
+ var node = createSynthesizedNode(269 /* JsxAttributes */);
node.properties = createNodeArray(properties);
return node;
}
@@ -62421,7 +63304,7 @@
}
ts.updateJsxAttributes = updateJsxAttributes;
function createJsxSpreadAttribute(expression) {
- var node = createSynthesizedNode(269 /* JsxSpreadAttribute */);
+ var node = createSynthesizedNode(270 /* JsxSpreadAttribute */);
node.expression = expression;
return node;
}
@@ -62433,7 +63316,7 @@
}
ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute;
function createJsxExpression(dotDotDotToken, expression) {
- var node = createSynthesizedNode(270 /* JsxExpression */);
+ var node = createSynthesizedNode(271 /* JsxExpression */);
node.dotDotDotToken = dotDotDotToken;
node.expression = expression;
return node;
@@ -62447,7 +63330,7 @@
ts.updateJsxExpression = updateJsxExpression;
// Clauses
function createCaseClause(expression, statements) {
- var node = createSynthesizedNode(271 /* CaseClause */);
+ var node = createSynthesizedNode(272 /* CaseClause */);
node.expression = ts.parenthesizeExpressionForList(expression);
node.statements = createNodeArray(statements);
return node;
@@ -62461,7 +63344,7 @@
}
ts.updateCaseClause = updateCaseClause;
function createDefaultClause(statements) {
- var node = createSynthesizedNode(272 /* DefaultClause */);
+ var node = createSynthesizedNode(273 /* DefaultClause */);
node.statements = createNodeArray(statements);
return node;
}
@@ -62473,7 +63356,7 @@
}
ts.updateDefaultClause = updateDefaultClause;
function createHeritageClause(token, types) {
- var node = createSynthesizedNode(273 /* HeritageClause */);
+ var node = createSynthesizedNode(274 /* HeritageClause */);
node.token = token;
node.types = createNodeArray(types);
return node;
@@ -62486,7 +63369,7 @@
}
ts.updateHeritageClause = updateHeritageClause;
function createCatchClause(variableDeclaration, block) {
- var node = createSynthesizedNode(274 /* CatchClause */);
+ var node = createSynthesizedNode(275 /* CatchClause */);
node.variableDeclaration = ts.isString(variableDeclaration) ? createVariableDeclaration(variableDeclaration) : variableDeclaration;
node.block = block;
return node;
@@ -62501,7 +63384,7 @@
ts.updateCatchClause = updateCatchClause;
// Property assignments
function createPropertyAssignment(name, initializer) {
- var node = createSynthesizedNode(275 /* PropertyAssignment */);
+ var node = createSynthesizedNode(276 /* PropertyAssignment */);
node.name = asName(name);
node.questionToken = undefined;
node.initializer = ts.parenthesizeExpressionForList(initializer);
@@ -62516,7 +63399,7 @@
}
ts.updatePropertyAssignment = updatePropertyAssignment;
function createShorthandPropertyAssignment(name, objectAssignmentInitializer) {
- var node = createSynthesizedNode(276 /* ShorthandPropertyAssignment */);
+ var node = createSynthesizedNode(277 /* ShorthandPropertyAssignment */);
node.name = asName(name);
node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? ts.parenthesizeExpressionForList(objectAssignmentInitializer) : undefined;
return node;
@@ -62530,8 +63413,8 @@
}
ts.updateShorthandPropertyAssignment = updateShorthandPropertyAssignment;
function createSpreadAssignment(expression) {
- var node = createSynthesizedNode(277 /* SpreadAssignment */);
- node.expression = expression !== undefined ? ts.parenthesizeExpressionForList(expression) : undefined; // TODO: GH#18217
+ var node = createSynthesizedNode(278 /* SpreadAssignment */);
+ node.expression = ts.parenthesizeExpressionForList(expression);
return node;
}
ts.createSpreadAssignment = createSpreadAssignment;
@@ -62543,7 +63426,7 @@
ts.updateSpreadAssignment = updateSpreadAssignment;
// Enum
function createEnumMember(name, initializer) {
- var node = createSynthesizedNode(278 /* EnumMember */);
+ var node = createSynthesizedNode(279 /* EnumMember */);
node.name = asName(name);
node.initializer = initializer && ts.parenthesizeExpressionForList(initializer);
return node;
@@ -62564,7 +63447,7 @@
(typeReferences !== undefined && node.typeReferenceDirectives !== typeReferences) ||
(libReferences !== undefined && node.libReferenceDirectives !== libReferences) ||
(hasNoDefaultLib !== undefined && node.hasNoDefaultLib !== hasNoDefaultLib)) {
- var updated = createSynthesizedNode(284 /* SourceFile */);
+ var updated = createSynthesizedNode(285 /* SourceFile */);
updated.flags |= node.flags;
updated.statements = createNodeArray(statements);
updated.endOfFileToken = node.endOfFileToken;
@@ -62648,7 +63531,7 @@
* @param original The original statement.
*/
function createNotEmittedStatement(original) {
- var node = createSynthesizedNode(312 /* NotEmittedStatement */);
+ var node = createSynthesizedNode(313 /* NotEmittedStatement */);
node.original = original;
setTextRange(node, original);
return node;
@@ -62660,7 +63543,7 @@
*/
/* @internal */
function createEndOfDeclarationMarker(original) {
- var node = createSynthesizedNode(316 /* EndOfDeclarationMarker */);
+ var node = createSynthesizedNode(317 /* EndOfDeclarationMarker */);
node.emitNode = {};
node.original = original;
return node;
@@ -62672,7 +63555,7 @@
*/
/* @internal */
function createMergeDeclarationMarker(original) {
- var node = createSynthesizedNode(315 /* MergeDeclarationMarker */);
+ var node = createSynthesizedNode(316 /* MergeDeclarationMarker */);
node.emitNode = {};
node.original = original;
return node;
@@ -62687,7 +63570,7 @@
* @param location The location for the expression. Defaults to the positions from "original" if provided.
*/
function createPartiallyEmittedExpression(expression, original) {
- var node = createSynthesizedNode(313 /* PartiallyEmittedExpression */);
+ var node = createSynthesizedNode(314 /* PartiallyEmittedExpression */);
node.expression = expression;
node.original = original;
setTextRange(node, original);
@@ -62703,7 +63586,7 @@
ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression;
function flattenCommaElements(node) {
if (ts.nodeIsSynthesized(node) && !ts.isParseTreeNode(node) && !node.original && !node.emitNode && !node.id) {
- if (node.kind === 314 /* CommaListExpression */) {
+ if (node.kind === 315 /* CommaListExpression */) {
return node.elements;
}
if (ts.isBinaryExpression(node) && node.operatorToken.kind === 27 /* CommaToken */) {
@@ -62713,7 +63596,7 @@
return node;
}
function createCommaList(elements) {
- var node = createSynthesizedNode(314 /* CommaListExpression */);
+ var node = createSynthesizedNode(315 /* CommaListExpression */);
node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements));
return node;
}
@@ -62726,7 +63609,7 @@
ts.updateCommaList = updateCommaList;
function createBundle(sourceFiles, prepends) {
if (prepends === void 0) { prepends = ts.emptyArray; }
- var node = ts.createNode(285 /* Bundle */);
+ var node = ts.createNode(286 /* Bundle */);
node.prepends = prepends;
node.sourceFiles = sourceFiles;
return node;
@@ -62756,7 +63639,7 @@
], function (helper) { return helper.name; }));
}
function createUnparsedSource() {
- var node = ts.createNode(286 /* UnparsedSource */);
+ var node = ts.createNode(287 /* UnparsedSource */);
node.prologues = ts.emptyArray;
node.referencedFiles = ts.emptyArray;
node.libReferenceDirectives = ts.emptyArray;
@@ -62888,10 +63771,10 @@
}
function mapBundleFileSectionKindToSyntaxKind(kind) {
switch (kind) {
- case "prologue" /* Prologue */: return 279 /* UnparsedPrologue */;
- case "prepend" /* Prepend */: return 280 /* UnparsedPrepend */;
- case "internal" /* Internal */: return 282 /* UnparsedInternalText */;
- case "text" /* Text */: return 281 /* UnparsedText */;
+ case "prologue" /* Prologue */: return 280 /* UnparsedPrologue */;
+ case "prepend" /* Prepend */: return 281 /* UnparsedPrepend */;
+ case "internal" /* Internal */: return 283 /* UnparsedInternalText */;
+ case "text" /* Text */: return 282 /* UnparsedText */;
case "emitHelpers" /* EmitHelpers */:
case "no-default-lib" /* NoDefaultLib */:
case "reference" /* Reference */:
@@ -62909,14 +63792,14 @@
return node;
}
function createUnparsedSyntheticReference(section, parent) {
- var node = ts.createNode(283 /* UnparsedSyntheticReference */, section.pos, section.end);
+ var node = ts.createNode(284 /* UnparsedSyntheticReference */, section.pos, section.end);
node.parent = parent;
node.data = section.data;
node.section = section;
return node;
}
function createInputFiles(javascriptTextOrReadFileText, declarationTextOrJavascriptPath, javascriptMapPath, javascriptMapTextOrDeclarationPath, declarationMapPath, declarationMapTextOrBuildInfoPath, javascriptPath, declarationPath, buildInfoPath, buildInfo, oldFileOfCurrentEmit) {
- var node = ts.createNode(287 /* InputFiles */);
+ var node = ts.createNode(288 /* InputFiles */);
if (!ts.isString(javascriptTextOrReadFileText)) {
var cache_1 = ts.createMap();
var textGetter_1 = function (path) {
@@ -63010,7 +63893,7 @@
}
ts.createLessThan = createLessThan;
function createAssignment(left, right) {
- return createBinary(left, 59 /* EqualsToken */, right);
+ return createBinary(left, 60 /* EqualsToken */, right);
}
ts.createAssignment = createAssignment;
function createStrictEquality(left, right) {
@@ -63103,7 +63986,7 @@
// To avoid holding onto transformation artifacts, we keep track of any
// parse tree node we are annotating. This allows us to clean them up after
// all transformations have completed.
- if (node.kind === 284 /* SourceFile */) {
+ if (node.kind === 285 /* SourceFile */) {
return node.emitNode = { annotatedNodes: [node] };
}
var sourceFile = ts.getSourceFileOfNode(ts.getParseTreeNode(ts.getSourceFileOfNode(node)));
@@ -63614,7 +64497,7 @@
if (!outermostLabeledStatement) {
return node;
}
- var updated = ts.updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 233 /* LabeledStatement */
+ var updated = ts.updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 234 /* LabeledStatement */
? restoreEnclosingLabel(node, outermostLabeledStatement.statement)
: node);
if (afterRestoreLabelCallback) {
@@ -63626,20 +64509,20 @@
function shouldBeCapturedInTempVariable(node, cacheIdentifiers) {
var target = ts.skipParentheses(node);
switch (target.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return cacheIdentifiers;
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
case 10 /* StringLiteral */:
return false;
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
var elements = target.elements;
if (elements.length === 0) {
return false;
}
return true;
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return target.properties.length > 0;
default:
return true;
@@ -63654,7 +64537,7 @@
thisArg = ts.createThis();
target = callee;
}
- else if (callee.kind === 98 /* SuperKeyword */) {
+ else if (callee.kind === 99 /* SuperKeyword */) {
thisArg = ts.createThis();
target = languageVersion < 2 /* ES2015 */
? ts.setTextRange(ts.createIdentifier("_super"), callee)
@@ -63666,7 +64549,7 @@
}
else {
switch (callee.kind) {
- case 189 /* PropertyAccessExpression */: {
+ case 190 /* PropertyAccessExpression */: {
if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) {
// for `a.b()` target is `(_a = a).b` and thisArg is `_a`
thisArg = ts.createTempVariable(recordTempVariable);
@@ -63679,7 +64562,7 @@
}
break;
}
- case 190 /* ElementAccessExpression */: {
+ case 191 /* ElementAccessExpression */: {
if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) {
// for `a[b]()` target is `(_a = a)[b]` and thisArg is `_a`
thisArg = ts.createTempVariable(recordTempVariable);
@@ -63736,14 +64619,14 @@
ts.createExpressionForPropertyName = createExpressionForPropertyName;
function createExpressionForObjectLiteralElementLike(node, property, receiver) {
switch (property.kind) {
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return createExpressionForAccessorDeclaration(node.properties, property, receiver, !!node.multiLine);
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return createExpressionForPropertyAssignment(property, receiver);
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return createExpressionForShorthandPropertyAssignment(property, receiver);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return createExpressionForMethodDeclaration(property, receiver);
}
}
@@ -63751,7 +64634,7 @@
function createExpressionForAccessorDeclaration(properties, property, receiver, multiLine) {
var _a = ts.getAllAccessorDeclarations(properties, property), firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor;
if (property === firstAccessor) {
- var properties_7 = [];
+ var properties_5 = [];
if (getAccessor) {
var getterFunction = ts.createFunctionExpression(getAccessor.modifiers,
/*asteriskToken*/ undefined,
@@ -63762,7 +64645,7 @@
ts.setTextRange(getterFunction, getAccessor);
ts.setOriginalNode(getterFunction, getAccessor);
var getter = ts.createPropertyAssignment("get", getterFunction);
- properties_7.push(getter);
+ properties_5.push(getter);
}
if (setAccessor) {
var setterFunction = ts.createFunctionExpression(setAccessor.modifiers,
@@ -63774,15 +64657,15 @@
ts.setTextRange(setterFunction, setAccessor);
ts.setOriginalNode(setterFunction, setAccessor);
var setter = ts.createPropertyAssignment("set", setterFunction);
- properties_7.push(setter);
+ properties_5.push(setter);
}
- properties_7.push(ts.createPropertyAssignment("enumerable", ts.createTrue()));
- properties_7.push(ts.createPropertyAssignment("configurable", ts.createTrue()));
+ properties_5.push(ts.createPropertyAssignment("enumerable", ts.createTrue()));
+ properties_5.push(ts.createPropertyAssignment("configurable", ts.createTrue()));
var expression = ts.setTextRange(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"),
/*typeArguments*/ undefined, [
receiver,
createExpressionForPropertyName(property.name),
- ts.createObjectLiteral(properties_7, multiLine)
+ ts.createObjectLiteral(properties_5, multiLine)
]),
/*location*/ firstAccessor);
return ts.aggregateTransformFlags(expression);
@@ -64069,7 +64952,7 @@
function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) {
var skipped = ts.skipPartiallyEmittedExpressions(operand);
// If the resulting expression is already parenthesized, we do not need to do any further processing.
- if (skipped.kind === 195 /* ParenthesizedExpression */) {
+ if (skipped.kind === 196 /* ParenthesizedExpression */) {
return operand;
}
return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand)
@@ -64103,10 +64986,10 @@
//
// If `a ** d` is on the left of operator `**`, we need to parenthesize to preserve
// the intended order of operations: `(a ** b) ** c`
- var binaryOperatorPrecedence = ts.getOperatorPrecedence(204 /* BinaryExpression */, binaryOperator);
- var binaryOperatorAssociativity = ts.getOperatorAssociativity(204 /* BinaryExpression */, binaryOperator);
+ var binaryOperatorPrecedence = ts.getOperatorPrecedence(205 /* BinaryExpression */, binaryOperator);
+ var binaryOperatorAssociativity = ts.getOperatorAssociativity(205 /* BinaryExpression */, binaryOperator);
var emittedOperand = ts.skipPartiallyEmittedExpressions(operand);
- if (!isLeftSideOfBinary && operand.kind === 197 /* ArrowFunction */ && binaryOperatorPrecedence > 4) {
+ if (!isLeftSideOfBinary && operand.kind === 198 /* ArrowFunction */ && binaryOperatorPrecedence > 4) {
// We need to parenthesize arrow functions on the right side to avoid it being
// parsed as parenthesized expression: `a && (() => {})`
return true;
@@ -64118,7 +65001,7 @@
// and is a yield expression, then we do not need parentheses.
if (!isLeftSideOfBinary
&& binaryOperatorAssociativity === 1 /* Right */
- && operand.kind === 207 /* YieldExpression */) {
+ && operand.kind === 208 /* YieldExpression */) {
return false;
}
return true;
@@ -64206,7 +65089,7 @@
if (ts.isLiteralKind(node.kind)) {
return node.kind;
}
- if (node.kind === 204 /* BinaryExpression */ && node.operatorToken.kind === 38 /* PlusToken */) {
+ if (node.kind === 205 /* BinaryExpression */ && node.operatorToken.kind === 38 /* PlusToken */) {
if (node.cachedLiteralKind !== undefined) {
return node.cachedLiteralKind;
}
@@ -64221,7 +65104,7 @@
return 0 /* Unknown */;
}
function parenthesizeForConditionalHead(condition) {
- var conditionalPrecedence = ts.getOperatorPrecedence(205 /* ConditionalExpression */, 56 /* QuestionToken */);
+ var conditionalPrecedence = ts.getOperatorPrecedence(206 /* ConditionalExpression */, 56 /* QuestionToken */);
var emittedCondition = ts.skipPartiallyEmittedExpressions(condition);
var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition);
if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1 /* LessThan */) {
@@ -64256,8 +65139,8 @@
var needsParens = isCommaSequence(check);
if (!needsParens) {
switch (getLeftmostExpression(check, /*stopAtCallExpression*/ false).kind) {
- case 209 /* ClassExpression */:
- case 196 /* FunctionExpression */:
+ case 210 /* ClassExpression */:
+ case 197 /* FunctionExpression */:
needsParens = true;
}
}
@@ -64273,9 +65156,9 @@
function parenthesizeForNew(expression) {
var leftmostExpr = getLeftmostExpression(expression, /*stopAtCallExpressions*/ true);
switch (leftmostExpr.kind) {
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return ts.createParen(expression);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return !leftmostExpr.arguments
? ts.createParen(expression)
: expression;
@@ -64298,7 +65181,7 @@
//
var emittedExpression = ts.skipPartiallyEmittedExpressions(expression);
if (ts.isLeftHandSideExpression(emittedExpression)
- && (emittedExpression.kind !== 192 /* NewExpression */ || emittedExpression.arguments)) {
+ && (emittedExpression.kind !== 193 /* NewExpression */ || emittedExpression.arguments)) {
return expression;
}
return ts.setTextRange(ts.createParen(expression), expression);
@@ -64336,7 +65219,7 @@
function parenthesizeExpressionForList(expression) {
var emittedExpression = ts.skipPartiallyEmittedExpressions(expression);
var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression);
- var commaPrecedence = ts.getOperatorPrecedence(204 /* BinaryExpression */, 27 /* CommaToken */);
+ var commaPrecedence = ts.getOperatorPrecedence(205 /* BinaryExpression */, 27 /* CommaToken */);
return expressionPrecedence > commaPrecedence
? expression
: ts.setTextRange(ts.createParen(expression), expression);
@@ -64347,29 +65230,29 @@
if (ts.isCallExpression(emittedExpression)) {
var callee = emittedExpression.expression;
var kind = ts.skipPartiallyEmittedExpressions(callee).kind;
- if (kind === 196 /* FunctionExpression */ || kind === 197 /* ArrowFunction */) {
+ if (kind === 197 /* FunctionExpression */ || kind === 198 /* ArrowFunction */) {
var mutableCall = ts.getMutableClone(emittedExpression);
mutableCall.expression = ts.setTextRange(ts.createParen(callee), callee);
return recreateOuterExpressions(expression, mutableCall, 4 /* PartiallyEmittedExpressions */);
}
}
var leftmostExpressionKind = getLeftmostExpression(emittedExpression, /*stopAtCallExpressions*/ false).kind;
- if (leftmostExpressionKind === 188 /* ObjectLiteralExpression */ || leftmostExpressionKind === 196 /* FunctionExpression */) {
+ if (leftmostExpressionKind === 189 /* ObjectLiteralExpression */ || leftmostExpressionKind === 197 /* FunctionExpression */) {
return ts.setTextRange(ts.createParen(expression), expression);
}
return expression;
}
ts.parenthesizeExpressionForExpressionStatement = parenthesizeExpressionForExpressionStatement;
function parenthesizeConditionalTypeMember(member) {
- return member.kind === 175 /* ConditionalType */ ? ts.createParenthesizedType(member) : member;
+ return member.kind === 176 /* ConditionalType */ ? ts.createParenthesizedType(member) : member;
}
ts.parenthesizeConditionalTypeMember = parenthesizeConditionalTypeMember;
function parenthesizeElementTypeMember(member) {
switch (member.kind) {
- case 173 /* UnionType */:
- case 174 /* IntersectionType */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
+ case 174 /* UnionType */:
+ case 175 /* IntersectionType */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
return ts.createParenthesizedType(member);
}
return parenthesizeConditionalTypeMember(member);
@@ -64377,9 +65260,9 @@
ts.parenthesizeElementTypeMember = parenthesizeElementTypeMember;
function parenthesizeArrayTypeMember(member) {
switch (member.kind) {
- case 167 /* TypeQuery */:
- case 179 /* TypeOperator */:
- case 176 /* InferType */:
+ case 168 /* TypeQuery */:
+ case 180 /* TypeOperator */:
+ case 177 /* InferType */:
return ts.createParenthesizedType(member);
}
return parenthesizeElementTypeMember(member);
@@ -64405,28 +65288,28 @@
function getLeftmostExpression(node, stopAtCallExpressions) {
while (true) {
switch (node.kind) {
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
node = node.operand;
continue;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
node = node.left;
continue;
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
node = node.condition;
continue;
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
node = node.tag;
continue;
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
if (stopAtCallExpressions) {
return node;
}
// falls through
- case 212 /* AsExpression */:
- case 190 /* ElementAccessExpression */:
- case 189 /* PropertyAccessExpression */:
- case 213 /* NonNullExpression */:
- case 313 /* PartiallyEmittedExpression */:
+ case 213 /* AsExpression */:
+ case 191 /* ElementAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 214 /* NonNullExpression */:
+ case 314 /* PartiallyEmittedExpression */:
node = node.expression;
continue;
}
@@ -64434,15 +65317,15 @@
}
}
function parenthesizeConciseBody(body) {
- if (!ts.isBlock(body) && (isCommaSequence(body) || getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 188 /* ObjectLiteralExpression */)) {
+ if (!ts.isBlock(body) && (isCommaSequence(body) || getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 189 /* ObjectLiteralExpression */)) {
return ts.setTextRange(ts.createParen(body), body);
}
return body;
}
ts.parenthesizeConciseBody = parenthesizeConciseBody;
function isCommaSequence(node) {
- return node.kind === 204 /* BinaryExpression */ && node.operatorToken.kind === 27 /* CommaToken */ ||
- node.kind === 314 /* CommaListExpression */;
+ return node.kind === 205 /* BinaryExpression */ && node.operatorToken.kind === 27 /* CommaToken */ ||
+ node.kind === 315 /* CommaListExpression */;
}
ts.isCommaSequence = isCommaSequence;
var OuterExpressionKinds;
@@ -64455,13 +65338,13 @@
function isOuterExpression(node, kinds) {
if (kinds === void 0) { kinds = 7 /* All */; }
switch (node.kind) {
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return (kinds & 1 /* Parentheses */) !== 0;
- case 194 /* TypeAssertionExpression */:
- case 212 /* AsExpression */:
- case 213 /* NonNullExpression */:
+ case 195 /* TypeAssertionExpression */:
+ case 213 /* AsExpression */:
+ case 214 /* NonNullExpression */:
return (kinds & 2 /* Assertions */) !== 0;
- case 313 /* PartiallyEmittedExpression */:
+ case 314 /* PartiallyEmittedExpression */:
return (kinds & 4 /* PartiallyEmittedExpressions */) !== 0;
}
return false;
@@ -64486,7 +65369,7 @@
}
ts.skipOuterExpressions = skipOuterExpressions;
function skipAssertions(node) {
- while (ts.isAssertionExpression(node) || node.kind === 213 /* NonNullExpression */) {
+ while (ts.isAssertionExpression(node) || node.kind === 214 /* NonNullExpression */) {
node = node.expression;
}
return node;
@@ -64494,11 +65377,11 @@
ts.skipAssertions = skipAssertions;
function updateOuterExpression(outerExpression, expression) {
switch (outerExpression.kind) {
- case 195 /* ParenthesizedExpression */: return ts.updateParen(outerExpression, expression);
- case 194 /* TypeAssertionExpression */: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression);
- case 212 /* AsExpression */: return ts.updateAsExpression(outerExpression, expression, outerExpression.type);
- case 213 /* NonNullExpression */: return ts.updateNonNullExpression(outerExpression, expression);
- case 313 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(outerExpression, expression);
+ case 196 /* ParenthesizedExpression */: return ts.updateParen(outerExpression, expression);
+ case 195 /* TypeAssertionExpression */: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression);
+ case 213 /* AsExpression */: return ts.updateAsExpression(outerExpression, expression, outerExpression.type);
+ case 214 /* NonNullExpression */: return ts.updateNonNullExpression(outerExpression, expression);
+ case 314 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(outerExpression, expression);
}
}
/**
@@ -64516,7 +65399,7 @@
* the containing expression is created/updated.
*/
function isIgnorableParen(node) {
- return node.kind === 195 /* ParenthesizedExpression */
+ return node.kind === 196 /* ParenthesizedExpression */
&& ts.nodeIsSynthesized(node)
&& ts.nodeIsSynthesized(ts.getSourceMapRange(node))
&& ts.nodeIsSynthesized(ts.getCommentRange(node))
@@ -64581,10 +65464,10 @@
var name = namespaceDeclaration.name;
return ts.isGeneratedIdentifier(name) ? name : ts.createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, name) || ts.idText(name));
}
- if (node.kind === 249 /* ImportDeclaration */ && node.importClause) {
+ if (node.kind === 250 /* ImportDeclaration */ && node.importClause) {
return ts.getGeneratedNameForNode(node);
}
- if (node.kind === 255 /* ExportDeclaration */ && node.moduleSpecifier) {
+ if (node.kind === 256 /* ExportDeclaration */ && node.moduleSpecifier) {
return ts.getGeneratedNameForNode(node);
}
return undefined;
@@ -64703,7 +65586,7 @@
}
if (ts.isObjectLiteralElementLike(bindingElement)) {
switch (bindingElement.kind) {
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
// `b` in `({ a: b } = ...)`
// `b` in `({ a: b = 1 } = ...)`
// `{b}` in `({ a: {b} } = ...)`
@@ -64715,11 +65598,11 @@
// `b[0]` in `({ a: b[0] } = ...)`
// `b[0]` in `({ a: b[0] = 1 } = ...)`
return getTargetOfBindingOrAssignmentElement(bindingElement.initializer);
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
// `a` in `({ a } = ...)`
// `a` in `({ a = 1 } = ...)`
return bindingElement.name;
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
// `a` in `({ ...a } = ...)`
return getTargetOfBindingOrAssignmentElement(bindingElement.expression);
}
@@ -64751,12 +65634,12 @@
*/
function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) {
switch (bindingElement.kind) {
- case 151 /* Parameter */:
- case 186 /* BindingElement */:
+ case 152 /* Parameter */:
+ case 187 /* BindingElement */:
// `...` in `let [...a] = ...`
return bindingElement.dotDotDotToken;
- case 208 /* SpreadElement */:
- case 277 /* SpreadAssignment */:
+ case 209 /* SpreadElement */:
+ case 278 /* SpreadAssignment */:
// `...` in `[...a] = ...`
return bindingElement;
}
@@ -64768,7 +65651,7 @@
*/
function getPropertyNameOfBindingOrAssignmentElement(bindingElement) {
switch (bindingElement.kind) {
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
// `a` in `let { a: b } = ...`
// `[a]` in `let { [a]: b } = ...`
// `"a"` in `let { "a": b } = ...`
@@ -64780,7 +65663,7 @@
: propertyName;
}
break;
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
// `a` in `({ a: b } = ...)`
// `[a]` in `({ [a]: b } = ...)`
// `"a"` in `({ "a": b } = ...)`
@@ -64792,7 +65675,7 @@
: propertyName;
}
break;
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
// `a` in `({ ...a } = ...)`
return bindingElement.name;
}
@@ -64815,13 +65698,13 @@
*/
function getElementsOfBindingOrAssignmentPattern(name) {
switch (name.kind) {
- case 184 /* ObjectBindingPattern */:
- case 185 /* ArrayBindingPattern */:
- case 187 /* ArrayLiteralExpression */:
+ case 185 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
+ case 188 /* ArrayLiteralExpression */:
// `a` in `{a}`
// `a` in `[a]`
return name.elements;
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
// `a` in `{a}`
return name.properties;
}
@@ -64861,11 +65744,11 @@
ts.convertToObjectAssignmentElement = convertToObjectAssignmentElement;
function convertToAssignmentPattern(node) {
switch (node.kind) {
- case 185 /* ArrayBindingPattern */:
- case 187 /* ArrayLiteralExpression */:
+ case 186 /* ArrayBindingPattern */:
+ case 188 /* ArrayLiteralExpression */:
return convertToArrayAssignmentPattern(node);
- case 184 /* ObjectBindingPattern */:
- case 188 /* ObjectLiteralExpression */:
+ case 185 /* ObjectBindingPattern */:
+ case 189 /* ObjectLiteralExpression */:
return convertToObjectAssignmentPattern(node);
}
}
@@ -65026,276 +65909,278 @@
}
var kind = node.kind;
// No need to visit nodes with no children.
- if ((kind > 0 /* FirstToken */ && kind <= 147 /* LastToken */) || kind === 178 /* ThisType */) {
+ if ((kind > 0 /* FirstToken */ && kind <= 148 /* LastToken */) || kind === 179 /* ThisType */) {
return node;
}
switch (kind) {
// Names
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return ts.updateIdentifier(node, nodesVisitor(node.typeArguments, visitor, isTypeNodeOrTypeParameterDeclaration));
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
return ts.updateQualifiedName(node, visitNode(node.left, visitor, ts.isEntityName), visitNode(node.right, visitor, ts.isIdentifier));
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression));
// Signature elements
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
return ts.updateTypeParameterDeclaration(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.constraint, visitor, ts.isTypeNode), visitNode(node.default, visitor, ts.isTypeNode));
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return ts.updateParameter(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.dotDotDotToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression));
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
return ts.updateDecorator(node, visitNode(node.expression, visitor, ts.isExpression));
// Type elements
- case 153 /* PropertySignature */:
+ case 154 /* PropertySignature */:
return ts.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isToken), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression));
- case 154 /* PropertyDeclaration */:
- return ts.updateProperty(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression));
- case 155 /* MethodSignature */:
+ case 155 /* PropertyDeclaration */:
+ return ts.updateProperty(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName),
+ // QuestionToken and ExclamationToken is uniqued in Property Declaration and the signature of 'updateProperty' is that too
+ visitNode(node.questionToken || node.exclamationToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression));
+ case 156 /* MethodSignature */:
return ts.updateMethodSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken));
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return ts.updateMethod(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context));
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return ts.updateConstructor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context));
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
return ts.updateGetAccessor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context));
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
return ts.updateSetAccessor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context));
- case 160 /* CallSignature */:
+ case 161 /* CallSignature */:
return ts.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
- case 161 /* ConstructSignature */:
+ case 162 /* ConstructSignature */:
return ts.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
- case 162 /* IndexSignature */:
+ case 163 /* IndexSignature */:
return ts.updateIndexSignature(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
// Types
- case 163 /* TypePredicate */:
+ case 164 /* TypePredicate */:
return ts.updateTypePredicateNode(node, visitNode(node.parameterName, visitor), visitNode(node.type, visitor, ts.isTypeNode));
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return ts.updateTypeReferenceNode(node, visitNode(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode));
- case 165 /* FunctionType */:
+ case 166 /* FunctionType */:
return ts.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
- case 166 /* ConstructorType */:
+ case 167 /* ConstructorType */:
return ts.updateConstructorTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
- case 167 /* TypeQuery */:
+ case 168 /* TypeQuery */:
return ts.updateTypeQueryNode(node, visitNode(node.exprName, visitor, ts.isEntityName));
- case 168 /* TypeLiteral */:
+ case 169 /* TypeLiteral */:
return ts.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement));
- case 169 /* ArrayType */:
+ case 170 /* ArrayType */:
return ts.updateArrayTypeNode(node, visitNode(node.elementType, visitor, ts.isTypeNode));
- case 170 /* TupleType */:
+ case 171 /* TupleType */:
return ts.updateTupleTypeNode(node, nodesVisitor(node.elementTypes, visitor, ts.isTypeNode));
- case 171 /* OptionalType */:
+ case 172 /* OptionalType */:
return ts.updateOptionalTypeNode(node, visitNode(node.type, visitor, ts.isTypeNode));
- case 172 /* RestType */:
+ case 173 /* RestType */:
return ts.updateRestTypeNode(node, visitNode(node.type, visitor, ts.isTypeNode));
- case 173 /* UnionType */:
+ case 174 /* UnionType */:
return ts.updateUnionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode));
- case 174 /* IntersectionType */:
+ case 175 /* IntersectionType */:
return ts.updateIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode));
- case 175 /* ConditionalType */:
+ case 176 /* ConditionalType */:
return ts.updateConditionalTypeNode(node, visitNode(node.checkType, visitor, ts.isTypeNode), visitNode(node.extendsType, visitor, ts.isTypeNode), visitNode(node.trueType, visitor, ts.isTypeNode), visitNode(node.falseType, visitor, ts.isTypeNode));
- case 176 /* InferType */:
+ case 177 /* InferType */:
return ts.updateInferTypeNode(node, visitNode(node.typeParameter, visitor, ts.isTypeParameterDeclaration));
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return ts.updateImportTypeNode(node, visitNode(node.argument, visitor, ts.isTypeNode), visitNode(node.qualifier, visitor, ts.isEntityName), visitNodes(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf);
- case 177 /* ParenthesizedType */:
+ case 178 /* ParenthesizedType */:
return ts.updateParenthesizedType(node, visitNode(node.type, visitor, ts.isTypeNode));
- case 179 /* TypeOperator */:
+ case 180 /* TypeOperator */:
return ts.updateTypeOperatorNode(node, visitNode(node.type, visitor, ts.isTypeNode));
- case 180 /* IndexedAccessType */:
+ case 181 /* IndexedAccessType */:
return ts.updateIndexedAccessTypeNode(node, visitNode(node.objectType, visitor, ts.isTypeNode), visitNode(node.indexType, visitor, ts.isTypeNode));
- case 181 /* MappedType */:
+ case 182 /* MappedType */:
return ts.updateMappedTypeNode(node, visitNode(node.readonlyToken, tokenVisitor, ts.isToken), visitNode(node.typeParameter, visitor, ts.isTypeParameterDeclaration), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode));
- case 182 /* LiteralType */:
+ case 183 /* LiteralType */:
return ts.updateLiteralTypeNode(node, visitNode(node.literal, visitor, ts.isExpression));
// Binding patterns
- case 184 /* ObjectBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
return ts.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement));
- case 185 /* ArrayBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
return ts.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement));
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return ts.updateBindingElement(node, visitNode(node.dotDotDotToken, tokenVisitor, ts.isToken), visitNode(node.propertyName, visitor, ts.isPropertyName), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression));
// Expression
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return ts.updateArrayLiteral(node, nodesVisitor(node.elements, visitor, ts.isExpression));
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return ts.updateObjectLiteral(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike));
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier));
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression));
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression));
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression));
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return ts.updateTaggedTemplate(node, visitNode(node.tag, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isExpression), visitNode(node.template, visitor, ts.isTemplateLiteral));
- case 194 /* TypeAssertionExpression */:
+ case 195 /* TypeAssertionExpression */:
return ts.updateTypeAssertion(node, visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression));
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression));
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return ts.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context));
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return ts.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.equalsGreaterThanToken, visitor, ts.isToken), visitFunctionBody(node.body, visitor, context));
- case 198 /* DeleteExpression */:
+ case 199 /* DeleteExpression */:
return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression));
- case 199 /* TypeOfExpression */:
+ case 200 /* TypeOfExpression */:
return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression));
- case 200 /* VoidExpression */:
+ case 201 /* VoidExpression */:
return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression));
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
return ts.updateAwait(node, visitNode(node.expression, visitor, ts.isExpression));
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression));
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return ts.updatePostfix(node, visitNode(node.operand, visitor, ts.isExpression));
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return ts.updateBinary(node, visitNode(node.left, visitor, ts.isExpression), visitNode(node.right, visitor, ts.isExpression), visitNode(node.operatorToken, visitor, ts.isToken));
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.questionToken, visitor, ts.isToken), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.colonToken, visitor, ts.isToken), visitNode(node.whenFalse, visitor, ts.isExpression));
- case 206 /* TemplateExpression */:
+ case 207 /* TemplateExpression */:
return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan));
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return ts.updateYield(node, visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.expression, visitor, ts.isExpression));
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression));
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
return ts.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement));
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return ts.updateExpressionWithTypeArguments(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression));
- case 212 /* AsExpression */:
+ case 213 /* AsExpression */:
return ts.updateAsExpression(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.type, visitor, ts.isTypeNode));
- case 213 /* NonNullExpression */:
+ case 214 /* NonNullExpression */:
return ts.updateNonNullExpression(node, visitNode(node.expression, visitor, ts.isExpression));
- case 214 /* MetaProperty */:
+ case 215 /* MetaProperty */:
return ts.updateMetaProperty(node, visitNode(node.name, visitor, ts.isIdentifier));
// Misc
- case 216 /* TemplateSpan */:
+ case 217 /* TemplateSpan */:
return ts.updateTemplateSpan(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail));
// Element
- case 218 /* Block */:
+ case 219 /* Block */:
return ts.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement));
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return ts.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList));
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return ts.updateExpressionStatement(node, visitNode(node.expression, visitor, ts.isExpression));
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, ts.liftToBlock));
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.expression, visitor, ts.isExpression));
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return ts.updateForOf(node, visitNode(node.awaitModifier, visitor, ts.isToken), visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
- case 228 /* ContinueStatement */:
+ case 229 /* ContinueStatement */:
return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier));
- case 229 /* BreakStatement */:
+ case 230 /* BreakStatement */:
return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier));
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression));
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock));
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
- case 234 /* ThrowStatement */:
+ case 235 /* ThrowStatement */:
return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression));
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause), visitNode(node.finallyBlock, visitor, ts.isBlock));
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression));
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
return ts.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration));
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return ts.updateFunctionDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context));
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return ts.updateClassDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement));
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
return ts.updateInterfaceDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement));
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return ts.updateTypeAliasDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return ts.updateEnumDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember));
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return ts.updateModuleDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.body, visitor, ts.isModuleBody));
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
return ts.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement));
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
return ts.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause));
- case 247 /* NamespaceExportDeclaration */:
+ case 248 /* NamespaceExportDeclaration */:
return ts.updateNamespaceExportDeclaration(node, visitNode(node.name, visitor, ts.isIdentifier));
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return ts.updateImportEqualsDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.moduleReference, visitor, ts.isModuleReference));
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return ts.updateImportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause), visitNode(node.moduleSpecifier, visitor, ts.isExpression));
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings));
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier));
- case 252 /* NamedImports */:
+ case 253 /* NamedImports */:
return ts.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier));
- case 253 /* ImportSpecifier */:
+ case 254 /* ImportSpecifier */:
return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier));
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return ts.updateExportAssignment(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression));
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return ts.updateExportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports), visitNode(node.moduleSpecifier, visitor, ts.isExpression));
- case 256 /* NamedExports */:
+ case 257 /* NamedExports */:
return ts.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier));
- case 257 /* ExportSpecifier */:
+ case 258 /* ExportSpecifier */:
return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier));
// Module references
- case 259 /* ExternalModuleReference */:
+ case 260 /* ExternalModuleReference */:
return ts.updateExternalModuleReference(node, visitNode(node.expression, visitor, ts.isExpression));
// JSX
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement));
- case 261 /* JsxSelfClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.attributes, visitor, ts.isJsxAttributes));
- case 262 /* JsxOpeningElement */:
+ case 263 /* JsxOpeningElement */:
return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.attributes, visitor, ts.isJsxAttributes));
- case 263 /* JsxClosingElement */:
+ case 264 /* JsxClosingElement */:
return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression));
- case 264 /* JsxFragment */:
+ case 265 /* JsxFragment */:
return ts.updateJsxFragment(node, visitNode(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingFragment, visitor, ts.isJsxClosingFragment));
- case 267 /* JsxAttribute */:
+ case 268 /* JsxAttribute */:
return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression));
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
return ts.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike));
- case 269 /* JsxSpreadAttribute */:
+ case 270 /* JsxSpreadAttribute */:
return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression));
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression));
// Clauses
- case 271 /* CaseClause */:
+ case 272 /* CaseClause */:
return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement));
- case 272 /* DefaultClause */:
+ case 273 /* DefaultClause */:
return ts.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement));
- case 273 /* HeritageClause */:
+ case 274 /* HeritageClause */:
return ts.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments));
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock));
// Property assignments
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression));
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression));
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression));
// Enum
- case 278 /* EnumMember */:
+ case 279 /* EnumMember */:
return ts.updateEnumMember(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression));
// Top-level nodes
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context));
// Transformation nodes
- case 313 /* PartiallyEmittedExpression */:
+ case 314 /* PartiallyEmittedExpression */:
return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression));
- case 314 /* CommaListExpression */:
+ case 315 /* CommaListExpression */:
return ts.updateCommaList(node, nodesVisitor(node.elements, visitor, ts.isExpression));
default:
// No need to visit nodes with no children.
@@ -65337,58 +66222,58 @@
var cbNodes = cbNodeArray || cbNode;
var kind = node.kind;
// No need to visit nodes with no children.
- if ((kind > 0 /* FirstToken */ && kind <= 147 /* LastToken */)) {
+ if ((kind > 0 /* FirstToken */ && kind <= 148 /* LastToken */)) {
return initial;
}
// We do not yet support types.
- if ((kind >= 163 /* TypePredicate */ && kind <= 182 /* LiteralType */)) {
+ if ((kind >= 164 /* TypePredicate */ && kind <= 183 /* LiteralType */)) {
return initial;
}
var result = initial;
switch (node.kind) {
// Leaf nodes
- case 217 /* SemicolonClassElement */:
- case 220 /* EmptyStatement */:
- case 210 /* OmittedExpression */:
- case 236 /* DebuggerStatement */:
- case 312 /* NotEmittedStatement */:
+ case 218 /* SemicolonClassElement */:
+ case 221 /* EmptyStatement */:
+ case 211 /* OmittedExpression */:
+ case 237 /* DebuggerStatement */:
+ case 313 /* NotEmittedStatement */:
// No need to visit nodes with no children.
break;
// Names
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
result = reduceNode(node.left, cbNode, result);
result = reduceNode(node.right, cbNode, result);
break;
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
result = reduceNode(node.expression, cbNode, result);
break;
// Signature elements
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
result = reduceNode(node.expression, cbNode, result);
break;
// Type member
- case 153 /* PropertySignature */:
+ case 154 /* PropertySignature */:
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.questionToken, cbNode, result);
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
@@ -65397,12 +66282,12 @@
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNodes(node.parameters, cbNodes, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
@@ -65410,7 +66295,7 @@
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
@@ -65418,50 +66303,50 @@
result = reduceNode(node.body, cbNode, result);
break;
// Binding patterns
- case 184 /* ObjectBindingPattern */:
- case 185 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
result = reduceNodes(node.elements, cbNodes, result);
break;
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
result = reduceNode(node.propertyName, cbNode, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
// Expression
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
result = reduceNodes(node.elements, cbNodes, result);
break;
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
result = reduceNodes(node.properties, cbNodes, result);
break;
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.name, cbNode, result);
break;
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.argumentExpression, cbNode, result);
break;
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNodes(node.typeArguments, cbNodes, result);
result = reduceNodes(node.arguments, cbNodes, result);
break;
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNodes(node.typeArguments, cbNodes, result);
result = reduceNodes(node.arguments, cbNodes, result);
break;
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
result = reduceNode(node.tag, cbNode, result);
result = reduceNodes(node.typeArguments, cbNodes, result);
result = reduceNode(node.template, cbNode, result);
break;
- case 194 /* TypeAssertionExpression */:
+ case 195 /* TypeAssertionExpression */:
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.expression, cbNode, result);
break;
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNodes(node.typeParameters, cbNodes, result);
@@ -65469,123 +66354,123 @@
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNodes(node.typeParameters, cbNodes, result);
result = reduceNodes(node.parameters, cbNodes, result);
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 195 /* ParenthesizedExpression */:
- case 198 /* DeleteExpression */:
- case 199 /* TypeOfExpression */:
- case 200 /* VoidExpression */:
- case 201 /* AwaitExpression */:
- case 207 /* YieldExpression */:
- case 208 /* SpreadElement */:
- case 213 /* NonNullExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 199 /* DeleteExpression */:
+ case 200 /* TypeOfExpression */:
+ case 201 /* VoidExpression */:
+ case 202 /* AwaitExpression */:
+ case 208 /* YieldExpression */:
+ case 209 /* SpreadElement */:
+ case 214 /* NonNullExpression */:
result = reduceNode(node.expression, cbNode, result);
break;
- case 202 /* PrefixUnaryExpression */:
- case 203 /* PostfixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
result = reduceNode(node.operand, cbNode, result);
break;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
result = reduceNode(node.left, cbNode, result);
result = reduceNode(node.right, cbNode, result);
break;
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
result = reduceNode(node.condition, cbNode, result);
result = reduceNode(node.whenTrue, cbNode, result);
result = reduceNode(node.whenFalse, cbNode, result);
break;
- case 206 /* TemplateExpression */:
+ case 207 /* TemplateExpression */:
result = reduceNode(node.head, cbNode, result);
result = reduceNodes(node.templateSpans, cbNodes, result);
break;
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNodes(node.typeParameters, cbNodes, result);
result = reduceNodes(node.heritageClauses, cbNodes, result);
result = reduceNodes(node.members, cbNodes, result);
break;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNodes(node.typeArguments, cbNodes, result);
break;
- case 212 /* AsExpression */:
+ case 213 /* AsExpression */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.type, cbNode, result);
break;
// Misc
- case 216 /* TemplateSpan */:
+ case 217 /* TemplateSpan */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.literal, cbNode, result);
break;
// Element
- case 218 /* Block */:
+ case 219 /* Block */:
result = reduceNodes(node.statements, cbNodes, result);
break;
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.declarationList, cbNode, result);
break;
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
result = reduceNode(node.expression, cbNode, result);
break;
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.thenStatement, cbNode, result);
result = reduceNode(node.elseStatement, cbNode, result);
break;
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
result = reduceNode(node.statement, cbNode, result);
result = reduceNode(node.expression, cbNode, result);
break;
- case 224 /* WhileStatement */:
- case 231 /* WithStatement */:
+ case 225 /* WhileStatement */:
+ case 232 /* WithStatement */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.statement, cbNode, result);
break;
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
result = reduceNode(node.initializer, cbNode, result);
result = reduceNode(node.condition, cbNode, result);
result = reduceNode(node.incrementor, cbNode, result);
result = reduceNode(node.statement, cbNode, result);
break;
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
result = reduceNode(node.initializer, cbNode, result);
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.statement, cbNode, result);
break;
- case 230 /* ReturnStatement */:
- case 234 /* ThrowStatement */:
+ case 231 /* ReturnStatement */:
+ case 235 /* ThrowStatement */:
result = reduceNode(node.expression, cbNode, result);
break;
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.caseBlock, cbNode, result);
break;
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
result = reduceNode(node.label, cbNode, result);
result = reduceNode(node.statement, cbNode, result);
break;
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
result = reduceNode(node.tryBlock, cbNode, result);
result = reduceNode(node.catchClause, cbNode, result);
result = reduceNode(node.finallyBlock, cbNode, result);
break;
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
result = reduceNodes(node.declarations, cbNodes, result);
break;
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
@@ -65594,7 +66479,7 @@
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
@@ -65602,140 +66487,140 @@
result = reduceNodes(node.heritageClauses, cbNodes, result);
result = reduceNodes(node.members, cbNodes, result);
break;
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNodes(node.members, cbNodes, result);
break;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
result = reduceNodes(node.statements, cbNodes, result);
break;
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
result = reduceNodes(node.clauses, cbNodes, result);
break;
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.moduleReference, cbNode, result);
break;
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.importClause, cbNode, result);
result = reduceNode(node.moduleSpecifier, cbNode, result);
break;
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.namedBindings, cbNode, result);
break;
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
result = reduceNode(node.name, cbNode, result);
break;
- case 252 /* NamedImports */:
- case 256 /* NamedExports */:
+ case 253 /* NamedImports */:
+ case 257 /* NamedExports */:
result = reduceNodes(node.elements, cbNodes, result);
break;
- case 253 /* ImportSpecifier */:
- case 257 /* ExportSpecifier */:
+ case 254 /* ImportSpecifier */:
+ case 258 /* ExportSpecifier */:
result = reduceNode(node.propertyName, cbNode, result);
result = reduceNode(node.name, cbNode, result);
break;
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
result = ts.reduceLeft(node.decorators, cbNode, result);
result = ts.reduceLeft(node.modifiers, cbNode, result);
result = reduceNode(node.expression, cbNode, result);
break;
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
result = ts.reduceLeft(node.decorators, cbNode, result);
result = ts.reduceLeft(node.modifiers, cbNode, result);
result = reduceNode(node.exportClause, cbNode, result);
result = reduceNode(node.moduleSpecifier, cbNode, result);
break;
// Module references
- case 259 /* ExternalModuleReference */:
+ case 260 /* ExternalModuleReference */:
result = reduceNode(node.expression, cbNode, result);
break;
// JSX
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
result = reduceNode(node.openingElement, cbNode, result);
result = ts.reduceLeft(node.children, cbNode, result);
result = reduceNode(node.closingElement, cbNode, result);
break;
- case 264 /* JsxFragment */:
+ case 265 /* JsxFragment */:
result = reduceNode(node.openingFragment, cbNode, result);
result = ts.reduceLeft(node.children, cbNode, result);
result = reduceNode(node.closingFragment, cbNode, result);
break;
- case 261 /* JsxSelfClosingElement */:
- case 262 /* JsxOpeningElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
result = reduceNode(node.tagName, cbNode, result);
result = reduceNodes(node.typeArguments, cbNode, result);
result = reduceNode(node.attributes, cbNode, result);
break;
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
result = reduceNodes(node.properties, cbNodes, result);
break;
- case 263 /* JsxClosingElement */:
+ case 264 /* JsxClosingElement */:
result = reduceNode(node.tagName, cbNode, result);
break;
- case 267 /* JsxAttribute */:
+ case 268 /* JsxAttribute */:
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
- case 269 /* JsxSpreadAttribute */:
+ case 270 /* JsxSpreadAttribute */:
result = reduceNode(node.expression, cbNode, result);
break;
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
result = reduceNode(node.expression, cbNode, result);
break;
// Clauses
- case 271 /* CaseClause */:
+ case 272 /* CaseClause */:
result = reduceNode(node.expression, cbNode, result);
// falls through
- case 272 /* DefaultClause */:
+ case 273 /* DefaultClause */:
result = reduceNodes(node.statements, cbNodes, result);
break;
- case 273 /* HeritageClause */:
+ case 274 /* HeritageClause */:
result = reduceNodes(node.types, cbNodes, result);
break;
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
result = reduceNode(node.variableDeclaration, cbNode, result);
result = reduceNode(node.block, cbNode, result);
break;
// Property assignments
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.objectAssignmentInitializer, cbNode, result);
break;
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
result = reduceNode(node.expression, cbNode, result);
break;
// Enum
- case 278 /* EnumMember */:
+ case 279 /* EnumMember */:
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
// Top-level nodes
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
result = reduceNodes(node.statements, cbNodes, result);
break;
// Transformation nodes
- case 313 /* PartiallyEmittedExpression */:
+ case 314 /* PartiallyEmittedExpression */:
result = reduceNode(node.expression, cbNode, result);
break;
- case 314 /* CommaListExpression */:
+ case 315 /* CommaListExpression */:
result = reduceNodes(node.elements, cbNodes, result);
break;
default:
@@ -65759,7 +66644,7 @@
* @param nodes The NodeArray.
*/
function liftToBlock(nodes) {
- Debug.assert(ts.every(nodes, ts.isStatement), "Cannot lift nodes to a Block.");
+ ts.Debug.assert(ts.every(nodes, ts.isStatement), "Cannot lift nodes to a Block.");
return ts.singleOrUndefined(nodes) || ts.createBlock(nodes);
}
ts.liftToBlock = liftToBlock;
@@ -65808,7 +66693,7 @@
function aggregateTransformFlagsForSubtree(node) {
// We do not transform ambient declarations or types, so there is no need to
// recursively aggregate transform flags.
- if (ts.hasModifier(node, 2 /* Ambient */) || (ts.isTypeNode(node) && node.kind !== 211 /* ExpressionWithTypeArguments */)) {
+ if (ts.hasModifier(node, 2 /* Ambient */) || (ts.isTypeNode(node) && node.kind !== 212 /* ExpressionWithTypeArguments */)) {
return 0 /* None */;
}
// Aggregate the transform flags of each child.
@@ -65824,73 +66709,6 @@
function aggregateTransformFlagsForChildNodes(transformFlags, nodes) {
return transformFlags | aggregateTransformFlagsForNodeArray(nodes);
}
- var Debug;
- (function (Debug) {
- var isDebugInfoEnabled = false;
- function failBadSyntaxKind(node, message) {
- return Debug.fail((message || "Unexpected node.") + "\r\nNode " + ts.formatSyntaxKind(node.kind) + " was unexpected.", failBadSyntaxKind);
- }
- Debug.failBadSyntaxKind = failBadSyntaxKind;
- Debug.assertEachNode = Debug.shouldAssert(1 /* Normal */)
- ? function (nodes, test, message) { return Debug.assert(test === undefined || ts.every(nodes, test), message || "Unexpected node.", function () { return "Node array did not pass test '" + Debug.getFunctionName(test) + "'."; }, Debug.assertEachNode); }
- : ts.noop;
- Debug.assertNode = Debug.shouldAssert(1 /* Normal */)
- ? function (node, test, message) { return Debug.assert(test === undefined || test(node), message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " did not pass test '" + Debug.getFunctionName(test) + "'."; }, Debug.assertNode); }
- : ts.noop;
- Debug.assertOptionalNode = Debug.shouldAssert(1 /* Normal */)
- ? function (node, test, message) { return Debug.assert(test === undefined || node === undefined || test(node), message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " did not pass test '" + Debug.getFunctionName(test) + "'."; }, Debug.assertOptionalNode); }
- : ts.noop;
- Debug.assertOptionalToken = Debug.shouldAssert(1 /* Normal */)
- ? function (node, kind, message) { return Debug.assert(kind === undefined || node === undefined || node.kind === kind, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was not a '" + ts.formatSyntaxKind(kind) + "' token."; }, Debug.assertOptionalToken); }
- : ts.noop;
- Debug.assertMissingNode = Debug.shouldAssert(1 /* Normal */)
- ? function (node, message) { return Debug.assert(node === undefined, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was unexpected'."; }, Debug.assertMissingNode); }
- : ts.noop;
- /**
- * Injects debug information into frequently used types.
- */
- function enableDebugInfo() {
- if (isDebugInfoEnabled)
- return;
- // Add additional properties in debug mode to assist with debugging.
- Object.defineProperties(ts.objectAllocator.getSymbolConstructor().prototype, {
- __debugFlags: { get: function () { return ts.formatSymbolFlags(this.flags); } }
- });
- Object.defineProperties(ts.objectAllocator.getTypeConstructor().prototype, {
- __debugFlags: { get: function () { return ts.formatTypeFlags(this.flags); } },
- __debugObjectFlags: { get: function () { return this.flags & 524288 /* Object */ ? ts.formatObjectFlags(this.objectFlags) : ""; } },
- __debugTypeToString: { value: function () { return this.checker.typeToString(this); } },
- });
- var nodeConstructors = [
- ts.objectAllocator.getNodeConstructor(),
- ts.objectAllocator.getIdentifierConstructor(),
- ts.objectAllocator.getTokenConstructor(),
- ts.objectAllocator.getSourceFileConstructor()
- ];
- for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) {
- var ctor = nodeConstructors_1[_i];
- if (!ctor.prototype.hasOwnProperty("__debugKind")) {
- Object.defineProperties(ctor.prototype, {
- __debugKind: { get: function () { return ts.formatSyntaxKind(this.kind); } },
- __debugModifierFlags: { get: function () { return ts.formatModifierFlags(ts.getModifierFlagsNoCache(this)); } },
- __debugTransformFlags: { get: function () { return ts.formatTransformFlags(this.transformFlags); } },
- __debugEmitFlags: { get: function () { return ts.formatEmitFlags(ts.getEmitFlags(this)); } },
- __debugGetText: {
- value: function (includeTrivia) {
- if (ts.nodeIsSynthesized(this))
- return "";
- var parseNode = ts.getParseTreeNode(this);
- var sourceFile = parseNode && ts.getSourceFileOfNode(parseNode);
- return sourceFile ? ts.getSourceTextOfNodeFromSourceFile(sourceFile, parseNode, includeTrivia) : "";
- }
- }
- });
- }
- }
- isDebugInfoEnabled = true;
- }
- Debug.enableDebugInfo = enableDebugInfo;
- })(Debug = ts.Debug || (ts.Debug = {}));
})(ts || (ts = {}));
/* @internal */
var ts;
@@ -66548,7 +67366,7 @@
function chainBundle(transformSourceFile) {
return transformSourceFileOrBundle;
function transformSourceFileOrBundle(node) {
- return node.kind === 284 /* SourceFile */ ? transformSourceFile(node) : transformBundle(node);
+ return node.kind === 285 /* SourceFile */ ? transformSourceFile(node) : transformBundle(node);
}
function transformBundle(node) {
return ts.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends);
@@ -66594,7 +67412,7 @@
for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {
var node = _a[_i];
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
// import "mod"
// import x from "mod"
// import * as x from "mod"
@@ -66602,13 +67420,13 @@
externalImports.push(node);
hasImportStarOrImportDefault = hasImportStarOrImportDefault || getImportNeedsImportStarHelper(node) || getImportNeedsImportDefaultHelper(node);
break;
- case 248 /* ImportEqualsDeclaration */:
- if (node.moduleReference.kind === 259 /* ExternalModuleReference */) {
+ case 249 /* ImportEqualsDeclaration */:
+ if (node.moduleReference.kind === 260 /* ExternalModuleReference */) {
// import x = require("mod")
externalImports.push(node);
}
break;
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
if (node.moduleSpecifier) {
if (!node.exportClause) {
// export * from "mod"
@@ -66638,13 +67456,13 @@
}
}
break;
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
if (node.isExportEquals && !exportEquals) {
// export = x
exportEquals = node;
}
break;
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
if (ts.hasModifier(node, 1 /* Export */)) {
for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) {
var decl = _e[_d];
@@ -66652,7 +67470,7 @@
}
}
break;
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
if (ts.hasModifier(node, 1 /* Export */)) {
if (ts.hasModifier(node, 512 /* Default */)) {
// export default function() { }
@@ -66672,7 +67490,7 @@
}
}
break;
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
if (ts.hasModifier(node, 1 /* Export */)) {
if (ts.hasModifier(node, 512 /* Default */)) {
// export default class { }
@@ -67212,7 +68030,7 @@
ts.restHelper = {
name: "typescript:rest",
scoped: false,
- text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\n t[p[i]] = s[p[i]];\n return t;\n };"
+ text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n };"
};
/** Given value: o, propName: p, pattern: { a, b, ...p } from the original statement
* `{ a, b, ...p } = o`, create `p = __rest(o, ["a", "b"]);`
@@ -67288,8 +68106,8 @@
context.onEmitNode = onEmitNode;
context.onSubstituteNode = onSubstituteNode;
// Enable substitution for property/element access to emit const enum values.
- context.enableSubstitution(189 /* PropertyAccessExpression */);
- context.enableSubstitution(190 /* ElementAccessExpression */);
+ context.enableSubstitution(190 /* PropertyAccessExpression */);
+ context.enableSubstitution(191 /* ElementAccessExpression */);
// These variables contain state that changes as we descend into the tree.
var currentSourceFile;
var currentNamespace;
@@ -67319,14 +68137,14 @@
var pendingExpressions;
return transformSourceFileOrBundle;
function transformSourceFileOrBundle(node) {
- if (node.kind === 285 /* Bundle */) {
+ if (node.kind === 286 /* Bundle */) {
return transformBundle(node);
}
return transformSourceFile(node);
}
function transformBundle(node) {
return ts.createBundle(node.sourceFiles.map(transformSourceFile), ts.mapDefined(node.prepends, function (prepend) {
- if (prepend.kind === 287 /* InputFiles */) {
+ if (prepend.kind === 288 /* InputFiles */) {
return ts.createUnparsedSourceFile(prepend, "js");
}
return prepend;
@@ -67375,16 +68193,16 @@
*/
function onBeforeVisitNode(node) {
switch (node.kind) {
- case 284 /* SourceFile */:
- case 246 /* CaseBlock */:
- case 245 /* ModuleBlock */:
- case 218 /* Block */:
+ case 285 /* SourceFile */:
+ case 247 /* CaseBlock */:
+ case 246 /* ModuleBlock */:
+ case 219 /* Block */:
currentLexicalScope = node;
currentNameScope = undefined;
currentScopeFirstDeclarationsOfName = undefined;
break;
- case 240 /* ClassDeclaration */:
- case 239 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 240 /* FunctionDeclaration */:
if (ts.hasModifier(node, 2 /* Ambient */)) {
break;
}
@@ -67396,7 +68214,7 @@
// These nodes should always have names unless they are default-exports;
// however, class declaration parsing allows for undefined names, so syntactically invalid
// programs may also have an undefined name.
- ts.Debug.assert(node.kind === 240 /* ClassDeclaration */ || ts.hasModifier(node, 512 /* Default */));
+ ts.Debug.assert(node.kind === 241 /* ClassDeclaration */ || ts.hasModifier(node, 512 /* Default */));
}
if (ts.isClassDeclaration(node)) {
// XXX: should probably also cover interfaces and type aliases that can have type variables?
@@ -67439,10 +68257,10 @@
*/
function sourceElementVisitorWorker(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
- case 254 /* ExportAssignment */:
- case 255 /* ExportDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 255 /* ExportAssignment */:
+ case 256 /* ExportDeclaration */:
return visitEllidableStatement(node);
default:
return visitorWorker(node);
@@ -67463,13 +68281,13 @@
return node;
}
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return visitImportDeclaration(node);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return visitImportEqualsDeclaration(node);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return visitExportAssignment(node);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return visitExportDeclaration(node);
default:
ts.Debug.fail("Unhandled ellided statement");
@@ -67489,11 +68307,11 @@
* @param node The node to visit.
*/
function namespaceElementVisitorWorker(node) {
- if (node.kind === 255 /* ExportDeclaration */ ||
- node.kind === 249 /* ImportDeclaration */ ||
- node.kind === 250 /* ImportClause */ ||
- (node.kind === 248 /* ImportEqualsDeclaration */ &&
- node.moduleReference.kind === 259 /* ExternalModuleReference */)) {
+ if (node.kind === 256 /* ExportDeclaration */ ||
+ node.kind === 250 /* ImportDeclaration */ ||
+ node.kind === 251 /* ImportClause */ ||
+ (node.kind === 249 /* ImportEqualsDeclaration */ &&
+ node.moduleReference.kind === 260 /* ExternalModuleReference */)) {
// do not emit ES6 imports and exports since they are illegal inside a namespace
return undefined;
}
@@ -67517,19 +68335,19 @@
*/
function classElementVisitorWorker(node) {
switch (node.kind) {
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
// TypeScript constructors are transformed in `visitClassDeclaration`.
// We elide them here as `visitorWorker` checks transform flags, which could
// erronously include an ES6 constructor without TypeScript syntax.
return undefined;
- case 154 /* PropertyDeclaration */:
- case 162 /* IndexSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 156 /* MethodDeclaration */:
+ case 155 /* PropertyDeclaration */:
+ case 163 /* IndexSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
// Fallback to the default visit behavior.
return visitorWorker(node);
- case 217 /* SemicolonClassElement */:
+ case 218 /* SemicolonClassElement */:
return node;
default:
return ts.Debug.failBadSyntaxKind(node);
@@ -67539,7 +68357,7 @@
if (ts.modifierToFlag(node.kind) & 2270 /* TypeScriptModifier */) {
return undefined;
}
- else if (currentNamespace && node.kind === 85 /* ExportKeyword */) {
+ else if (currentNamespace && node.kind === 86 /* ExportKeyword */) {
return undefined;
}
return node;
@@ -67556,67 +68374,67 @@
return ts.createNotEmittedStatement(node);
}
switch (node.kind) {
- case 85 /* ExportKeyword */:
- case 80 /* DefaultKeyword */:
+ case 86 /* ExportKeyword */:
+ case 81 /* DefaultKeyword */:
// ES6 export and default modifiers are elided when inside a namespace.
return currentNamespace ? undefined : node;
- case 115 /* PublicKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 118 /* AbstractKeyword */:
- case 77 /* ConstKeyword */:
- case 125 /* DeclareKeyword */:
- case 133 /* ReadonlyKeyword */:
+ case 116 /* PublicKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 119 /* AbstractKeyword */:
+ case 78 /* ConstKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 134 /* ReadonlyKeyword */:
// TypeScript accessibility and readonly modifiers are elided.
- case 169 /* ArrayType */:
- case 170 /* TupleType */:
- case 171 /* OptionalType */:
- case 172 /* RestType */:
- case 168 /* TypeLiteral */:
- case 163 /* TypePredicate */:
- case 150 /* TypeParameter */:
- case 120 /* AnyKeyword */:
- case 143 /* UnknownKeyword */:
- case 123 /* BooleanKeyword */:
- case 138 /* StringKeyword */:
- case 135 /* NumberKeyword */:
- case 132 /* NeverKeyword */:
- case 106 /* VoidKeyword */:
- case 139 /* SymbolKeyword */:
- case 166 /* ConstructorType */:
- case 165 /* FunctionType */:
- case 167 /* TypeQuery */:
- case 164 /* TypeReference */:
- case 173 /* UnionType */:
- case 174 /* IntersectionType */:
- case 175 /* ConditionalType */:
- case 177 /* ParenthesizedType */:
- case 178 /* ThisType */:
- case 179 /* TypeOperator */:
- case 180 /* IndexedAccessType */:
- case 181 /* MappedType */:
- case 182 /* LiteralType */:
+ case 170 /* ArrayType */:
+ case 171 /* TupleType */:
+ case 172 /* OptionalType */:
+ case 173 /* RestType */:
+ case 169 /* TypeLiteral */:
+ case 164 /* TypePredicate */:
+ case 151 /* TypeParameter */:
+ case 121 /* AnyKeyword */:
+ case 144 /* UnknownKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 139 /* StringKeyword */:
+ case 136 /* NumberKeyword */:
+ case 133 /* NeverKeyword */:
+ case 107 /* VoidKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 167 /* ConstructorType */:
+ case 166 /* FunctionType */:
+ case 168 /* TypeQuery */:
+ case 165 /* TypeReference */:
+ case 174 /* UnionType */:
+ case 175 /* IntersectionType */:
+ case 176 /* ConditionalType */:
+ case 178 /* ParenthesizedType */:
+ case 179 /* ThisType */:
+ case 180 /* TypeOperator */:
+ case 181 /* IndexedAccessType */:
+ case 182 /* MappedType */:
+ case 183 /* LiteralType */:
// TypeScript type nodes are elided.
- case 162 /* IndexSignature */:
+ case 163 /* IndexSignature */:
// TypeScript index signatures are elided.
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
// TypeScript decorators are elided. They will be emitted as part of visitClassDeclaration.
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
// TypeScript type-only declarations are elided.
return undefined;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
// TypeScript property declarations are elided. However their names are still visited, and can potentially be retained if they could have sideeffects
return visitPropertyDeclaration(node);
- case 247 /* NamespaceExportDeclaration */:
+ case 248 /* NamespaceExportDeclaration */:
// TypeScript namespace export declarations are elided.
return undefined;
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return visitConstructor(node);
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
// TypeScript interfaces are elided, but some comments may be preserved.
// See the implementation of `getLeadingComments` in comments.ts for more details.
return ts.createNotEmittedStatement(node);
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
// This may be a class declaration with TypeScript syntax extensions.
//
// TypeScript class syntax extensions include:
@@ -67627,7 +68445,7 @@
// - index signatures
// - method overload signatures
return visitClassDeclaration(node);
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
// This may be a class expression with TypeScript syntax extensions.
//
// TypeScript class syntax extensions include:
@@ -67638,35 +68456,35 @@
// - index signatures
// - method overload signatures
return visitClassExpression(node);
- case 273 /* HeritageClause */:
+ case 274 /* HeritageClause */:
// This may be a heritage clause with TypeScript syntax extensions.
//
// TypeScript heritage clause extensions include:
// - `implements` clause
return visitHeritageClause(node);
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
// TypeScript supports type arguments on an expression in an `extends` heritage clause.
return visitExpressionWithTypeArguments(node);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
// TypeScript method declarations may have decorators, modifiers
// or type annotations.
return visitMethodDeclaration(node);
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
// Get Accessors can have TypeScript modifiers, decorators, and type annotations.
return visitGetAccessor(node);
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
// Set Accessors can have TypeScript modifiers and type annotations.
return visitSetAccessor(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
// Typescript function declarations can have modifiers, decorators, and type annotations.
return visitFunctionDeclaration(node);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
// TypeScript function expressions can have modifiers and type annotations.
return visitFunctionExpression(node);
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
// TypeScript arrow functions can have modifiers and type annotations.
return visitArrowFunction(node);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
// This may be a parameter declaration with TypeScript syntax extensions.
//
// TypeScript parameter declaration syntax extensions include:
@@ -67676,35 +68494,35 @@
// - type annotations
// - this parameters
return visitParameter(node);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
// ParenthesizedExpressions are TypeScript if their expression is a
// TypeAssertion or AsExpression
return visitParenthesizedExpression(node);
- case 194 /* TypeAssertionExpression */:
- case 212 /* AsExpression */:
+ case 195 /* TypeAssertionExpression */:
+ case 213 /* AsExpression */:
// TypeScript type assertions are removed, but their subtrees are preserved.
return visitAssertionExpression(node);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return visitCallExpression(node);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return visitNewExpression(node);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return visitTaggedTemplateExpression(node);
- case 213 /* NonNullExpression */:
+ case 214 /* NonNullExpression */:
// TypeScript non-null expressions are removed, but their subtrees are preserved.
return visitNonNullExpression(node);
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
// TypeScript enum declarations do not exist in ES6 and must be rewritten.
return visitEnumDeclaration(node);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
// TypeScript namespace exports for variable statements must be transformed.
return visitVariableStatement(node);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return visitVariableDeclaration(node);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
// TypeScript namespace declarations must be transformed.
return visitModuleDeclaration(node);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
// TypeScript namespace or external module import.
return visitImportEqualsDeclaration(node);
default:
@@ -67742,7 +68560,7 @@
if (ts.some(staticProperties))
facts |= 1 /* HasStaticInitializedProperties */;
var extendsClauseElement = ts.getEffectiveBaseTypeNode(node);
- if (extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 96 /* NullKeyword */)
+ if (extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 97 /* NullKeyword */)
facts |= 64 /* IsDerivedClass */;
if (shouldEmitDecorateCallForClass(node))
facts |= 2 /* HasConstructorDecorators */;
@@ -68008,7 +68826,7 @@
pendingExpressions = undefined;
var staticProperties = getInitializedProperties(node, /*isStatic*/ true);
var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause);
- var members = transformClassMembers(node, ts.some(heritageClauses, function (c) { return c.token === 86 /* ExtendsKeyword */; }));
+ var members = transformClassMembers(node, ts.some(heritageClauses, function (c) { return c.token === 87 /* ExtendsKeyword */; }));
var classExpression = ts.createClassExpression(
/*modifiers*/ undefined, node.name,
/*typeParameters*/ undefined, heritageClauses, members);
@@ -68184,7 +69002,7 @@
return index;
}
var statement = statements[index];
- if (statement.kind === 221 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) {
+ if (statement.kind === 222 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) {
result.push(ts.visitNode(statement, visitor, ts.isStatement));
return index + 1;
}
@@ -68255,7 +69073,7 @@
* @param isStatic A value indicating whether the member should be a static or instance member.
*/
function isInitializedProperty(member, isStatic) {
- return member.kind === 154 /* PropertyDeclaration */
+ return member.kind === 155 /* PropertyDeclaration */
&& isStatic === ts.hasModifier(member, 32 /* Static */)
&& member.initializer !== undefined;
}
@@ -68266,8 +69084,8 @@
* @param receiver The receiver on which each property should be assigned.
*/
function addInitializedPropertyStatements(statements, properties, receiver) {
- for (var _i = 0, properties_8 = properties; _i < properties_8.length; _i++) {
- var property = properties_8[_i];
+ for (var _i = 0, properties_6 = properties; _i < properties_6.length; _i++) {
+ var property = properties_6[_i];
var statement = ts.createExpressionStatement(transformInitializedProperty(property, receiver));
ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property));
ts.setCommentRange(statement, property);
@@ -68283,8 +69101,8 @@
*/
function generateInitializedPropertyExpressions(properties, receiver) {
var expressions = [];
- for (var _i = 0, properties_9 = properties; _i < properties_9.length; _i++) {
- var property = properties_9[_i];
+ for (var _i = 0, properties_7 = properties; _i < properties_7.length; _i++) {
+ var property = properties_7[_i];
var expression = transformInitializedProperty(property, receiver);
ts.startOnNewLine(expression);
ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property));
@@ -68398,12 +69216,12 @@
*/
function getAllDecoratorsOfClassElement(node, member) {
switch (member.kind) {
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return getAllDecoratorsOfAccessors(node, member);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return getAllDecoratorsOfMethod(member);
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return getAllDecoratorsOfProperty(member);
default:
return undefined;
@@ -68556,7 +69374,7 @@
var prefix = getClassMemberPrefix(node, member);
var memberName = getExpressionForPropertyName(member, /*generateNameForComputedPropertyName*/ true);
var descriptor = languageVersion > 0 /* ES3 */
- ? member.kind === 154 /* PropertyDeclaration */
+ ? member.kind === 155 /* PropertyDeclaration */
// We emit `void 0` here to indicate to `__decorate` that it can invoke `Object.defineProperty` directly, but that it
// should not invoke `Object.getOwnPropertyDescriptor`.
? ts.createVoidZero()
@@ -68679,10 +69497,10 @@
*/
function shouldAddTypeMetadata(node) {
var kind = node.kind;
- return kind === 156 /* MethodDeclaration */
- || kind === 158 /* GetAccessor */
- || kind === 159 /* SetAccessor */
- || kind === 154 /* PropertyDeclaration */;
+ return kind === 157 /* MethodDeclaration */
+ || kind === 159 /* GetAccessor */
+ || kind === 160 /* SetAccessor */
+ || kind === 155 /* PropertyDeclaration */;
}
/**
* Determines whether to emit the "design:returntype" metadata based on the node's kind.
@@ -68692,7 +69510,7 @@
* @param node The node to test.
*/
function shouldAddReturnTypeMetadata(node) {
- return node.kind === 156 /* MethodDeclaration */;
+ return node.kind === 157 /* MethodDeclaration */;
}
/**
* Determines whether to emit the "design:paramtypes" metadata based on the node's kind.
@@ -68703,12 +69521,12 @@
*/
function shouldAddParamTypesMetadata(node) {
switch (node.kind) {
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
return ts.getFirstConstructorWithBody(node) !== undefined;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return true;
}
return false;
@@ -68725,15 +69543,15 @@
*/
function serializeTypeOfNode(node) {
switch (node.kind) {
- case 154 /* PropertyDeclaration */:
- case 151 /* Parameter */:
+ case 155 /* PropertyDeclaration */:
+ case 152 /* Parameter */:
return serializeTypeNode(node.type);
- case 159 /* SetAccessor */:
- case 158 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 159 /* GetAccessor */:
return serializeTypeNode(getAccessorTypeNode(node));
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 156 /* MethodDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 157 /* MethodDeclaration */:
return ts.createIdentifier("Function");
default:
return ts.createVoidZero();
@@ -68770,7 +69588,7 @@
return ts.createArrayLiteral(expressions);
}
function getParametersOfDecoratedDeclaration(node, container) {
- if (container && node.kind === 158 /* GetAccessor */) {
+ if (container && node.kind === 159 /* GetAccessor */) {
var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor;
if (setAccessor) {
return setAccessor.parameters;
@@ -68815,69 +69633,69 @@
return ts.createIdentifier("Object");
}
switch (node.kind) {
- case 106 /* VoidKeyword */:
- case 141 /* UndefinedKeyword */:
- case 96 /* NullKeyword */:
- case 132 /* NeverKeyword */:
+ case 107 /* VoidKeyword */:
+ case 142 /* UndefinedKeyword */:
+ case 97 /* NullKeyword */:
+ case 133 /* NeverKeyword */:
return ts.createVoidZero();
- case 177 /* ParenthesizedType */:
+ case 178 /* ParenthesizedType */:
return serializeTypeNode(node.type);
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
return ts.createIdentifier("Function");
- case 169 /* ArrayType */:
- case 170 /* TupleType */:
+ case 170 /* ArrayType */:
+ case 171 /* TupleType */:
return ts.createIdentifier("Array");
- case 163 /* TypePredicate */:
- case 123 /* BooleanKeyword */:
+ case 164 /* TypePredicate */:
+ case 124 /* BooleanKeyword */:
return ts.createIdentifier("Boolean");
- case 138 /* StringKeyword */:
+ case 139 /* StringKeyword */:
return ts.createIdentifier("String");
- case 136 /* ObjectKeyword */:
+ case 137 /* ObjectKeyword */:
return ts.createIdentifier("Object");
- case 182 /* LiteralType */:
+ case 183 /* LiteralType */:
switch (node.literal.kind) {
case 10 /* StringLiteral */:
return ts.createIdentifier("String");
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
case 8 /* NumericLiteral */:
return ts.createIdentifier("Number");
case 9 /* BigIntLiteral */:
return getGlobalBigIntNameWithFallback();
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
return ts.createIdentifier("Boolean");
default:
return ts.Debug.failBadSyntaxKind(node.literal);
}
- case 135 /* NumberKeyword */:
+ case 136 /* NumberKeyword */:
return ts.createIdentifier("Number");
- case 146 /* BigIntKeyword */:
+ case 147 /* BigIntKeyword */:
return getGlobalBigIntNameWithFallback();
- case 139 /* SymbolKeyword */:
+ case 140 /* SymbolKeyword */:
return languageVersion < 2 /* ES2015 */
? getGlobalSymbolNameWithFallback()
: ts.createIdentifier("Symbol");
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return serializeTypeReferenceNode(node);
- case 174 /* IntersectionType */:
- case 173 /* UnionType */:
+ case 175 /* IntersectionType */:
+ case 174 /* UnionType */:
return serializeTypeList(node.types);
- case 175 /* ConditionalType */:
+ case 176 /* ConditionalType */:
return serializeTypeList([node.trueType, node.falseType]);
- case 179 /* TypeOperator */:
- if (node.operator === 133 /* ReadonlyKeyword */) {
+ case 180 /* TypeOperator */:
+ if (node.operator === 134 /* ReadonlyKeyword */) {
return serializeTypeNode(node.type);
}
break;
- case 167 /* TypeQuery */:
- case 180 /* IndexedAccessType */:
- case 181 /* MappedType */:
- case 168 /* TypeLiteral */:
- case 120 /* AnyKeyword */:
- case 143 /* UnknownKeyword */:
- case 178 /* ThisType */:
- case 183 /* ImportType */:
+ case 168 /* TypeQuery */:
+ case 181 /* IndexedAccessType */:
+ case 182 /* MappedType */:
+ case 169 /* TypeLiteral */:
+ case 121 /* AnyKeyword */:
+ case 144 /* UnknownKeyword */:
+ case 179 /* ThisType */:
+ case 184 /* ImportType */:
break;
default:
return ts.Debug.failBadSyntaxKind(node);
@@ -68888,15 +69706,15 @@
// Note when updating logic here also update getEntityNameForDecoratorMetadata
// so that aliases can be marked as referenced
var serializedUnion;
- for (var _i = 0, types_18 = types; _i < types_18.length; _i++) {
- var typeNode = types_18[_i];
- while (typeNode.kind === 177 /* ParenthesizedType */) {
+ for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
+ var typeNode = types_17[_i];
+ while (typeNode.kind === 178 /* ParenthesizedType */) {
typeNode = typeNode.type; // Skip parens if need be
}
- if (typeNode.kind === 132 /* NeverKeyword */) {
+ if (typeNode.kind === 133 /* NeverKeyword */) {
continue; // Always elide `never` from the union/intersection if possible
}
- if (!strictNullChecks && (typeNode.kind === 96 /* NullKeyword */ || typeNode.kind === 141 /* UndefinedKeyword */)) {
+ if (!strictNullChecks && (typeNode.kind === 97 /* NullKeyword */ || typeNode.kind === 142 /* UndefinedKeyword */)) {
continue; // Elide null and undefined from unions for metadata, just like what we did prior to the implementation of strict null checks
}
var serializedIndividual = serializeTypeNode(typeNode);
@@ -68976,12 +69794,12 @@
* @param node The entity name to serialize.
*/
function serializeEntityNameAsExpressionFallback(node) {
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
// A -> typeof A !== undefined && A
var copied = serializeEntityNameAsExpression(node);
return createCheckedValue(copied, copied);
}
- if (node.left.kind === 72 /* Identifier */) {
+ if (node.left.kind === 73 /* Identifier */) {
// A.B -> typeof A !== undefined && A.B
return createCheckedValue(serializeEntityNameAsExpression(node.left), serializeEntityNameAsExpression(node));
}
@@ -68997,7 +69815,7 @@
*/
function serializeEntityNameAsExpression(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
// Create a clone of the name with a new parent, and treat it as if it were
// a source tree node for the purposes of the checker.
var name = ts.getMutableClone(node);
@@ -69005,7 +69823,7 @@
name.original = undefined;
name.parent = ts.getParseTreeNode(currentLexicalScope); // ensure the parent is set to a parse tree node.
return name;
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
return serializeQualifiedNameAsExpression(node);
}
}
@@ -69031,7 +69849,7 @@
* available.
*/
function getGlobalBigIntNameWithFallback() {
- return languageVersion < 7 /* ESNext */
+ return languageVersion < 8 /* ESNext */
? ts.createConditional(ts.createTypeCheck(ts.createIdentifier("BigInt"), "function"), ts.createIdentifier("BigInt"), ts.createIdentifier("Object"))
: ts.createIdentifier("BigInt");
}
@@ -69115,7 +69933,7 @@
* @param node The HeritageClause to transform.
*/
function visitHeritageClause(node) {
- if (node.token === 109 /* ImplementsKeyword */) {
+ if (node.token === 110 /* ImplementsKeyword */) {
// implements clauses are elided
return undefined;
}
@@ -69354,7 +70172,7 @@
*/
function visitEnumDeclaration(node) {
if (!shouldEmitEnumDeclaration(node)) {
- return undefined;
+ return ts.createNotEmittedStatement(node);
}
var statements = [];
// We request to be advised when the printer is about to print this node. This allows
@@ -69522,12 +70340,12 @@
// enums in any other scope are emitted as a `let` declaration.
var statement = ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([
ts.createVariableDeclaration(ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true))
- ], currentLexicalScope.kind === 284 /* SourceFile */ ? 0 /* None */ : 1 /* Let */));
+ ], currentLexicalScope.kind === 285 /* SourceFile */ ? 0 /* None */ : 1 /* Let */));
ts.setOriginalNode(statement, node);
recordEmittedDeclarationInScope(node);
if (isFirstEmittedDeclarationInScope(node)) {
// Adjust the source map emit to match the old emitter.
- if (node.kind === 243 /* EnumDeclaration */) {
+ if (node.kind === 244 /* EnumDeclaration */) {
ts.setSourceMapRange(statement.declarationList, node);
}
else {
@@ -69652,7 +70470,7 @@
var statementsLocation;
var blockLocation;
var body = node.body;
- if (body.kind === 245 /* ModuleBlock */) {
+ if (body.kind === 246 /* ModuleBlock */) {
saveStateAndInvoke(body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); });
statementsLocation = body.statements;
blockLocation = body;
@@ -69698,13 +70516,13 @@
// })(hi = hello.hi || (hello.hi = {}));
// })(hello || (hello = {}));
// We only want to emit comment on the namespace which contains block body itself, not the containing namespaces.
- if (body.kind !== 245 /* ModuleBlock */) {
+ if (body.kind !== 246 /* ModuleBlock */) {
ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536 /* NoComments */);
}
return block;
}
function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) {
- if (moduleDeclaration.body.kind === 244 /* ModuleDeclaration */) {
+ if (moduleDeclaration.body.kind === 245 /* ModuleDeclaration */) {
var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body);
return recursiveInnerModule || moduleDeclaration.body;
}
@@ -69745,7 +70563,7 @@
* @param node The named import bindings node.
*/
function visitNamedImportBindings(node) {
- if (node.kind === 251 /* NamespaceImport */) {
+ if (node.kind === 252 /* NamespaceImport */) {
// Elide a namespace import if it is not referenced.
return resolver.isReferencedAliasDeclaration(node) ? node : undefined;
}
@@ -69958,7 +70776,7 @@
function enableSubstitutionForNonQualifiedEnumMembers() {
if ((enabledSubstitutions & 8 /* NonQualifiedEnumMembers */) === 0) {
enabledSubstitutions |= 8 /* NonQualifiedEnumMembers */;
- context.enableSubstitution(72 /* Identifier */);
+ context.enableSubstitution(73 /* Identifier */);
}
}
function enableSubstitutionForClassAliases() {
@@ -69966,7 +70784,7 @@
enabledSubstitutions |= 1 /* ClassAliases */;
// We need to enable substitutions for identifiers. This allows us to
// substitute class names inside of a class declaration.
- context.enableSubstitution(72 /* Identifier */);
+ context.enableSubstitution(73 /* Identifier */);
// Keep track of class aliases.
classAliases = [];
}
@@ -69976,17 +70794,17 @@
enabledSubstitutions |= 2 /* NamespaceExports */;
// We need to enable substitutions for identifiers and shorthand property assignments. This allows us to
// substitute the names of exported members of a namespace.
- context.enableSubstitution(72 /* Identifier */);
- context.enableSubstitution(276 /* ShorthandPropertyAssignment */);
+ context.enableSubstitution(73 /* Identifier */);
+ context.enableSubstitution(277 /* ShorthandPropertyAssignment */);
// We need to be notified when entering and exiting namespaces.
- context.enableEmitNotification(244 /* ModuleDeclaration */);
+ context.enableEmitNotification(245 /* ModuleDeclaration */);
}
}
function isTransformedModuleDeclaration(node) {
- return ts.getOriginalNode(node).kind === 244 /* ModuleDeclaration */;
+ return ts.getOriginalNode(node).kind === 245 /* ModuleDeclaration */;
}
function isTransformedEnumDeclaration(node) {
- return ts.getOriginalNode(node).kind === 243 /* EnumDeclaration */;
+ return ts.getOriginalNode(node).kind === 244 /* EnumDeclaration */;
}
/**
* Hook for node emit.
@@ -70045,11 +70863,11 @@
}
function substituteExpression(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return substituteExpressionIdentifier(node);
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return substitutePropertyAccessExpression(node);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return substituteElementAccessExpression(node);
}
return node;
@@ -70087,9 +70905,9 @@
// If we are nested within a namespace declaration, we may need to qualifiy
// an identifier that is exported from a merged namespace.
var container = resolver.getReferencedExportContainer(node, /*prefixLocals*/ false);
- if (container && container.kind !== 284 /* SourceFile */) {
- var substitute = (applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 244 /* ModuleDeclaration */) ||
- (applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 243 /* EnumDeclaration */);
+ if (container && container.kind !== 285 /* SourceFile */) {
+ var substitute = (applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 245 /* ModuleDeclaration */) ||
+ (applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 244 /* EnumDeclaration */);
if (substitute) {
return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node),
/*location*/ node);
@@ -70229,26 +71047,26 @@
return node;
}
switch (node.kind) {
- case 121 /* AsyncKeyword */:
+ case 122 /* AsyncKeyword */:
// ES2017 async modifier should be elided for targets < ES2017
return undefined;
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
return visitAwaitExpression(node);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return visitMethodDeclaration(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return visitFunctionDeclaration(node);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return visitFunctionExpression(node);
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return visitArrowFunction(node);
- case 189 /* PropertyAccessExpression */:
- if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 98 /* SuperKeyword */) {
+ case 190 /* PropertyAccessExpression */:
+ if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 99 /* SuperKeyword */) {
capturedSuperProperties.set(node.name.escapedText, true);
}
return ts.visitEachChild(node, visitor, context);
- case 190 /* ElementAccessExpression */:
- if (capturedSuperProperties && node.expression.kind === 98 /* SuperKeyword */) {
+ case 191 /* ElementAccessExpression */:
+ if (capturedSuperProperties && node.expression.kind === 99 /* SuperKeyword */) {
hasSuperElementAccess = true;
}
return ts.visitEachChild(node, visitor, context);
@@ -70259,27 +71077,27 @@
function asyncBodyVisitor(node) {
if (ts.isNodeWithPossibleHoistedDeclaration(node)) {
switch (node.kind) {
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return visitVariableStatementInAsyncBody(node);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return visitForStatementInAsyncBody(node);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return visitForInStatementInAsyncBody(node);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return visitForOfStatementInAsyncBody(node);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return visitCatchClauseInAsyncBody(node);
- case 218 /* Block */:
- case 232 /* SwitchStatement */:
- case 246 /* CaseBlock */:
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
- case 235 /* TryStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
- case 222 /* IfStatement */:
- case 231 /* WithStatement */:
- case 233 /* LabeledStatement */:
+ case 219 /* Block */:
+ case 233 /* SwitchStatement */:
+ case 247 /* CaseBlock */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
+ case 236 /* TryStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
+ case 223 /* IfStatement */:
+ case 232 /* WithStatement */:
+ case 234 /* LabeledStatement */:
return ts.visitEachChild(node, asyncBodyVisitor, context);
default:
return ts.Debug.assertNever(node, "Unhandled node.");
@@ -70480,7 +71298,7 @@
var original = ts.getOriginalNode(node, ts.isFunctionLike);
var nodeType = original.type;
var promiseConstructor = languageVersion < 2 /* ES2015 */ ? getPromiseConstructor(nodeType) : undefined;
- var isArrowFunction = node.kind === 197 /* ArrowFunction */;
+ var isArrowFunction = node.kind === 198 /* ArrowFunction */;
var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192 /* CaptureArguments */) !== 0;
// An async function is emit as an outer function that calls an inner
// generator function. To preserve lexical bindings, we pass the current
@@ -70571,17 +71389,17 @@
enabledSubstitutions |= 1 /* AsyncMethodsWithSuper */;
// We need to enable substitutions for call, property access, and element access
// if we need to rewrite super calls.
- context.enableSubstitution(191 /* CallExpression */);
- context.enableSubstitution(189 /* PropertyAccessExpression */);
- context.enableSubstitution(190 /* ElementAccessExpression */);
+ context.enableSubstitution(192 /* CallExpression */);
+ context.enableSubstitution(190 /* PropertyAccessExpression */);
+ context.enableSubstitution(191 /* ElementAccessExpression */);
// We need to be notified when entering and exiting declarations that bind super.
- context.enableEmitNotification(240 /* ClassDeclaration */);
- context.enableEmitNotification(156 /* MethodDeclaration */);
- context.enableEmitNotification(158 /* GetAccessor */);
- context.enableEmitNotification(159 /* SetAccessor */);
- context.enableEmitNotification(157 /* Constructor */);
+ context.enableEmitNotification(241 /* ClassDeclaration */);
+ context.enableEmitNotification(157 /* MethodDeclaration */);
+ context.enableEmitNotification(159 /* GetAccessor */);
+ context.enableEmitNotification(160 /* SetAccessor */);
+ context.enableEmitNotification(158 /* Constructor */);
// We need to be notified when entering the generated accessor arrow functions.
- context.enableEmitNotification(219 /* VariableStatement */);
+ context.enableEmitNotification(220 /* VariableStatement */);
}
}
/**
@@ -70629,23 +71447,23 @@
}
function substituteExpression(node) {
switch (node.kind) {
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return substitutePropertyAccessExpression(node);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return substituteElementAccessExpression(node);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return substituteCallExpression(node);
}
return node;
}
function substitutePropertyAccessExpression(node) {
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
return ts.setTextRange(ts.createPropertyAccess(ts.createFileLevelUniqueName("_super"), node.name), node);
}
return node;
}
function substituteElementAccessExpression(node) {
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
return createSuperElementAccessInAsyncMethod(node.argumentExpression, node);
}
return node;
@@ -70665,11 +71483,11 @@
}
function isSuperContainer(node) {
var kind = node.kind;
- return kind === 240 /* ClassDeclaration */
- || kind === 157 /* Constructor */
- || kind === 156 /* MethodDeclaration */
- || kind === 158 /* GetAccessor */
- || kind === 159 /* SetAccessor */;
+ return kind === 241 /* ClassDeclaration */
+ || kind === 158 /* Constructor */
+ || kind === 157 /* MethodDeclaration */
+ || kind === 159 /* GetAccessor */
+ || kind === 160 /* SetAccessor */;
}
function createSuperElementAccessInAsyncMethod(argumentExpression, location) {
if (enclosingSuperContainerFlags & 4096 /* AsyncMethodWithSuperBinding */) {
@@ -70804,7 +71622,7 @@
return visitorWorker(node, /*noDestructuringValue*/ true);
}
function visitorNoAsyncModifier(node) {
- if (node.kind === 121 /* AsyncKeyword */) {
+ if (node.kind === 122 /* AsyncKeyword */) {
return undefined;
}
return node;
@@ -70814,53 +71632,55 @@
return node;
}
switch (node.kind) {
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
return visitAwaitExpression(node);
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return visitYieldExpression(node);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return visitReturnStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return visitLabeledStatement(node);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return visitObjectLiteralExpression(node);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return visitBinaryExpression(node, noDestructuringValue);
- case 237 /* VariableDeclaration */:
+ case 275 /* CatchClause */:
+ return visitCatchClause(node);
+ case 238 /* VariableDeclaration */:
return visitVariableDeclaration(node);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return visitForStatement(node);
- case 200 /* VoidExpression */:
+ case 201 /* VoidExpression */:
return visitVoidExpression(node);
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return visitConstructorDeclaration(node);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return visitMethodDeclaration(node);
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
return visitGetAccessorDeclaration(node);
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
return visitSetAccessorDeclaration(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return visitFunctionDeclaration(node);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return visitFunctionExpression(node);
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return visitArrowFunction(node);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return visitParameter(node);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return visitExpressionStatement(node);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return visitParenthesizedExpression(node, noDestructuringValue);
- case 189 /* PropertyAccessExpression */:
- if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 98 /* SuperKeyword */) {
+ case 190 /* PropertyAccessExpression */:
+ if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 99 /* SuperKeyword */) {
capturedSuperProperties.set(node.name.escapedText, true);
}
return ts.visitEachChild(node, visitor, context);
- case 190 /* ElementAccessExpression */:
- if (capturedSuperProperties && node.expression.kind === 98 /* SuperKeyword */) {
+ case 191 /* ElementAccessExpression */:
+ if (capturedSuperProperties && node.expression.kind === 99 /* SuperKeyword */) {
hasSuperElementAccess = true;
}
return ts.visitEachChild(node, visitor, context);
@@ -70896,7 +71716,7 @@
function visitLabeledStatement(node) {
if (enclosingFunctionFlags & 2 /* Async */) {
var statement = ts.unwrapInnermostStatementOfLabel(node);
- if (statement.kind === 227 /* ForOfStatement */ && statement.awaitModifier) {
+ if (statement.kind === 228 /* ForOfStatement */ && statement.awaitModifier) {
return visitForOfStatement(statement, node);
}
return ts.restoreEnclosingLabel(ts.visitEachChild(statement, visitor, context), node);
@@ -70908,7 +71728,7 @@
var objects = [];
for (var _i = 0, elements_4 = elements; _i < elements_4.length; _i++) {
var e = elements_4[_i];
- if (e.kind === 277 /* SpreadAssignment */) {
+ if (e.kind === 278 /* SpreadAssignment */) {
if (chunkObject) {
objects.push(ts.createObjectLiteral(chunkObject));
chunkObject = undefined;
@@ -70917,7 +71737,7 @@
objects.push(ts.visitNode(target, visitor, ts.isExpression));
}
else {
- chunkObject = ts.append(chunkObject, e.kind === 275 /* PropertyAssignment */
+ chunkObject = ts.append(chunkObject, e.kind === 276 /* PropertyAssignment */
? ts.createPropertyAssignment(e.name, ts.visitNode(e.initializer, visitor, ts.isExpression))
: ts.visitNode(e, visitor, ts.isObjectLiteralElementLike));
}
@@ -70935,7 +71755,7 @@
// If the first element is a spread element, then the first argument to __assign is {}:
// { ...o, a, b, ...o2 } => __assign({}, o, {a, b}, o2)
var objects = chunkObjectLiteralElements(node.properties);
- if (objects.length && objects[0].kind !== 188 /* ObjectLiteralExpression */) {
+ if (objects.length && objects[0].kind !== 189 /* ObjectLiteralExpression */) {
objects.unshift(ts.createObjectLiteral());
}
return createAssignHelper(context, objects);
@@ -70962,6 +71782,23 @@
}
return ts.visitEachChild(node, visitor, context);
}
+ function visitCatchClause(node) {
+ if (node.variableDeclaration &&
+ ts.isBindingPattern(node.variableDeclaration.name) &&
+ node.variableDeclaration.name.transformFlags & 8192 /* ContainsObjectRestOrSpread */) {
+ var name = ts.getGeneratedNameForNode(node.variableDeclaration.name);
+ var updatedDecl = ts.updateVariableDeclaration(node.variableDeclaration, node.variableDeclaration.name, /*type*/ undefined, name);
+ var visitedBindings = ts.flattenDestructuringBinding(updatedDecl, visitor, context, 1 /* ObjectRest */);
+ var block = ts.visitNode(node.block, visitor, ts.isBlock);
+ if (ts.some(visitedBindings)) {
+ block = ts.updateBlock(block, [
+ ts.createVariableStatement(/*modifiers*/ undefined, visitedBindings)
+ ].concat(block.statements));
+ }
+ return ts.updateCatchClause(node, ts.updateVariableDeclaration(node.variableDeclaration, name, /*type*/ undefined, /*initializer*/ undefined), block);
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
/**
* Visits a VariableDeclaration node with a binding pattern.
*
@@ -71254,17 +72091,17 @@
enabledSubstitutions |= 1 /* AsyncMethodsWithSuper */;
// We need to enable substitutions for call, property access, and element access
// if we need to rewrite super calls.
- context.enableSubstitution(191 /* CallExpression */);
- context.enableSubstitution(189 /* PropertyAccessExpression */);
- context.enableSubstitution(190 /* ElementAccessExpression */);
+ context.enableSubstitution(192 /* CallExpression */);
+ context.enableSubstitution(190 /* PropertyAccessExpression */);
+ context.enableSubstitution(191 /* ElementAccessExpression */);
// We need to be notified when entering and exiting declarations that bind super.
- context.enableEmitNotification(240 /* ClassDeclaration */);
- context.enableEmitNotification(156 /* MethodDeclaration */);
- context.enableEmitNotification(158 /* GetAccessor */);
- context.enableEmitNotification(159 /* SetAccessor */);
- context.enableEmitNotification(157 /* Constructor */);
+ context.enableEmitNotification(241 /* ClassDeclaration */);
+ context.enableEmitNotification(157 /* MethodDeclaration */);
+ context.enableEmitNotification(159 /* GetAccessor */);
+ context.enableEmitNotification(160 /* SetAccessor */);
+ context.enableEmitNotification(158 /* Constructor */);
// We need to be notified when entering the generated accessor arrow functions.
- context.enableEmitNotification(219 /* VariableStatement */);
+ context.enableEmitNotification(220 /* VariableStatement */);
}
}
/**
@@ -71312,23 +72149,23 @@
}
function substituteExpression(node) {
switch (node.kind) {
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return substitutePropertyAccessExpression(node);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return substituteElementAccessExpression(node);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return substituteCallExpression(node);
}
return node;
}
function substitutePropertyAccessExpression(node) {
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
return ts.setTextRange(ts.createPropertyAccess(ts.createFileLevelUniqueName("_super"), node.name), node);
}
return node;
}
function substituteElementAccessExpression(node) {
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
return createSuperElementAccessInAsyncMethod(node.argumentExpression, node);
}
return node;
@@ -71348,11 +72185,11 @@
}
function isSuperContainer(node) {
var kind = node.kind;
- return kind === 240 /* ClassDeclaration */
- || kind === 157 /* Constructor */
- || kind === 156 /* MethodDeclaration */
- || kind === 158 /* GetAccessor */
- || kind === 159 /* SetAccessor */;
+ return kind === 241 /* ClassDeclaration */
+ || kind === 158 /* Constructor */
+ || kind === 157 /* MethodDeclaration */
+ || kind === 159 /* GetAccessor */
+ || kind === 160 /* SetAccessor */;
}
function createSuperElementAccessInAsyncMethod(argumentExpression, location) {
if (enclosingSuperContainerFlags & 4096 /* AsyncMethodWithSuperBinding */) {
@@ -71446,7 +72283,7 @@
return node;
}
switch (node.kind) {
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return visitCatchClause(node);
default:
return ts.visitEachChild(node, visitor, context);
@@ -71515,13 +72352,13 @@
}
function visitorWorker(node) {
switch (node.kind) {
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
return visitJsxElement(node, /*isChild*/ false);
- case 261 /* JsxSelfClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
return visitJsxSelfClosingElement(node, /*isChild*/ false);
- case 264 /* JsxFragment */:
+ case 265 /* JsxFragment */:
return visitJsxFragment(node, /*isChild*/ false);
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return visitJsxExpression(node);
default:
return ts.visitEachChild(node, visitor, context);
@@ -71531,13 +72368,13 @@
switch (node.kind) {
case 11 /* JsxText */:
return visitJsxText(node);
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return visitJsxExpression(node);
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
return visitJsxElement(node, /*isChild*/ true);
- case 261 /* JsxSelfClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
return visitJsxSelfClosingElement(node, /*isChild*/ true);
- case 264 /* JsxFragment */:
+ case 265 /* JsxFragment */:
return visitJsxFragment(node, /*isChild*/ true);
default:
return ts.Debug.failBadSyntaxKind(node);
@@ -71612,7 +72449,7 @@
literal.singleQuote = node.singleQuote !== undefined ? node.singleQuote : !ts.isStringDoubleQuoted(node, currentSourceFile);
return ts.setTextRange(literal, node);
}
- else if (node.kind === 270 /* JsxExpression */) {
+ else if (node.kind === 271 /* JsxExpression */) {
if (node.expression === undefined) {
return ts.createTrue();
}
@@ -71706,7 +72543,7 @@
return decoded === text ? undefined : decoded;
}
function getTagName(node) {
- if (node.kind === 260 /* JsxElement */) {
+ if (node.kind === 261 /* JsxElement */) {
return getTagName(node.openingElement);
}
else {
@@ -72012,7 +72849,7 @@
return node;
}
switch (node.kind) {
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return visitBinaryExpression(node);
default:
return ts.visitEachChild(node, visitor, context);
@@ -72020,7 +72857,7 @@
}
function visitBinaryExpression(node) {
switch (node.operatorToken.kind) {
- case 63 /* AsteriskAsteriskEqualsToken */:
+ case 64 /* AsteriskAsteriskEqualsToken */:
return visitExponentiationAssignmentExpression(node);
case 41 /* AsteriskAsteriskToken */:
return visitExponentiationExpression(node);
@@ -72105,62 +72942,63 @@
HierarchyFacts[HierarchyFacts["Block"] = 128] = "Block";
HierarchyFacts[HierarchyFacts["IterationStatement"] = 256] = "IterationStatement";
HierarchyFacts[HierarchyFacts["IterationStatementBlock"] = 512] = "IterationStatementBlock";
- HierarchyFacts[HierarchyFacts["ForStatement"] = 1024] = "ForStatement";
- HierarchyFacts[HierarchyFacts["ForInOrForOfStatement"] = 2048] = "ForInOrForOfStatement";
- HierarchyFacts[HierarchyFacts["ConstructorWithCapturedSuper"] = 4096] = "ConstructorWithCapturedSuper";
+ HierarchyFacts[HierarchyFacts["IterationContainer"] = 1024] = "IterationContainer";
+ HierarchyFacts[HierarchyFacts["ForStatement"] = 2048] = "ForStatement";
+ HierarchyFacts[HierarchyFacts["ForInOrForOfStatement"] = 4096] = "ForInOrForOfStatement";
+ HierarchyFacts[HierarchyFacts["ConstructorWithCapturedSuper"] = 8192] = "ConstructorWithCapturedSuper";
// NOTE: do not add more ancestor flags without also updating AncestorFactsMask below.
// NOTE: when adding a new ancestor flag, be sure to update the subtree flags below.
//
// Ancestor masks
//
- HierarchyFacts[HierarchyFacts["AncestorFactsMask"] = 8191] = "AncestorFactsMask";
+ HierarchyFacts[HierarchyFacts["AncestorFactsMask"] = 16383] = "AncestorFactsMask";
// We are always in *some* kind of block scope, but only specific block-scope containers are
// top-level or Blocks.
HierarchyFacts[HierarchyFacts["BlockScopeIncludes"] = 0] = "BlockScopeIncludes";
- HierarchyFacts[HierarchyFacts["BlockScopeExcludes"] = 4032] = "BlockScopeExcludes";
+ HierarchyFacts[HierarchyFacts["BlockScopeExcludes"] = 7104] = "BlockScopeExcludes";
// A source file is a top-level block scope.
HierarchyFacts[HierarchyFacts["SourceFileIncludes"] = 64] = "SourceFileIncludes";
- HierarchyFacts[HierarchyFacts["SourceFileExcludes"] = 3968] = "SourceFileExcludes";
+ HierarchyFacts[HierarchyFacts["SourceFileExcludes"] = 8064] = "SourceFileExcludes";
// Functions, methods, and accessors are both new lexical scopes and new block scopes.
HierarchyFacts[HierarchyFacts["FunctionIncludes"] = 65] = "FunctionIncludes";
- HierarchyFacts[HierarchyFacts["FunctionExcludes"] = 8094] = "FunctionExcludes";
+ HierarchyFacts[HierarchyFacts["FunctionExcludes"] = 16286] = "FunctionExcludes";
HierarchyFacts[HierarchyFacts["AsyncFunctionBodyIncludes"] = 69] = "AsyncFunctionBodyIncludes";
- HierarchyFacts[HierarchyFacts["AsyncFunctionBodyExcludes"] = 8086] = "AsyncFunctionBodyExcludes";
+ HierarchyFacts[HierarchyFacts["AsyncFunctionBodyExcludes"] = 16278] = "AsyncFunctionBodyExcludes";
// Arrow functions are lexically scoped to their container, but are new block scopes.
HierarchyFacts[HierarchyFacts["ArrowFunctionIncludes"] = 66] = "ArrowFunctionIncludes";
- HierarchyFacts[HierarchyFacts["ArrowFunctionExcludes"] = 8064] = "ArrowFunctionExcludes";
+ HierarchyFacts[HierarchyFacts["ArrowFunctionExcludes"] = 15232] = "ArrowFunctionExcludes";
// Constructors are both new lexical scopes and new block scopes. Constructors are also
// always considered non-static members of a class.
HierarchyFacts[HierarchyFacts["ConstructorIncludes"] = 73] = "ConstructorIncludes";
- HierarchyFacts[HierarchyFacts["ConstructorExcludes"] = 8086] = "ConstructorExcludes";
+ HierarchyFacts[HierarchyFacts["ConstructorExcludes"] = 16278] = "ConstructorExcludes";
// 'do' and 'while' statements are not block scopes. We track that the subtree is contained
// within an IterationStatement to indicate whether the embedded statement is an
// IterationStatementBlock.
- HierarchyFacts[HierarchyFacts["DoOrWhileStatementIncludes"] = 256] = "DoOrWhileStatementIncludes";
+ HierarchyFacts[HierarchyFacts["DoOrWhileStatementIncludes"] = 1280] = "DoOrWhileStatementIncludes";
HierarchyFacts[HierarchyFacts["DoOrWhileStatementExcludes"] = 0] = "DoOrWhileStatementExcludes";
// 'for' statements are new block scopes and have special handling for 'let' declarations.
- HierarchyFacts[HierarchyFacts["ForStatementIncludes"] = 1280] = "ForStatementIncludes";
- HierarchyFacts[HierarchyFacts["ForStatementExcludes"] = 3008] = "ForStatementExcludes";
+ HierarchyFacts[HierarchyFacts["ForStatementIncludes"] = 3328] = "ForStatementIncludes";
+ HierarchyFacts[HierarchyFacts["ForStatementExcludes"] = 5056] = "ForStatementExcludes";
// 'for-in' and 'for-of' statements are new block scopes and have special handling for
// 'let' declarations.
- HierarchyFacts[HierarchyFacts["ForInOrForOfStatementIncludes"] = 2304] = "ForInOrForOfStatementIncludes";
- HierarchyFacts[HierarchyFacts["ForInOrForOfStatementExcludes"] = 1984] = "ForInOrForOfStatementExcludes";
+ HierarchyFacts[HierarchyFacts["ForInOrForOfStatementIncludes"] = 5376] = "ForInOrForOfStatementIncludes";
+ HierarchyFacts[HierarchyFacts["ForInOrForOfStatementExcludes"] = 3008] = "ForInOrForOfStatementExcludes";
// Blocks (other than function bodies) are new block scopes.
HierarchyFacts[HierarchyFacts["BlockIncludes"] = 128] = "BlockIncludes";
- HierarchyFacts[HierarchyFacts["BlockExcludes"] = 3904] = "BlockExcludes";
+ HierarchyFacts[HierarchyFacts["BlockExcludes"] = 6976] = "BlockExcludes";
HierarchyFacts[HierarchyFacts["IterationStatementBlockIncludes"] = 512] = "IterationStatementBlockIncludes";
- HierarchyFacts[HierarchyFacts["IterationStatementBlockExcludes"] = 4032] = "IterationStatementBlockExcludes";
+ HierarchyFacts[HierarchyFacts["IterationStatementBlockExcludes"] = 7104] = "IterationStatementBlockExcludes";
//
// Subtree facts
//
- HierarchyFacts[HierarchyFacts["NewTarget"] = 8192] = "NewTarget";
- HierarchyFacts[HierarchyFacts["CapturedLexicalThis"] = 16384] = "CapturedLexicalThis";
+ HierarchyFacts[HierarchyFacts["NewTarget"] = 16384] = "NewTarget";
+ HierarchyFacts[HierarchyFacts["CapturedLexicalThis"] = 32768] = "CapturedLexicalThis";
//
// Subtree masks
//
- HierarchyFacts[HierarchyFacts["SubtreeFactsMask"] = -8192] = "SubtreeFactsMask";
+ HierarchyFacts[HierarchyFacts["SubtreeFactsMask"] = -16384] = "SubtreeFactsMask";
HierarchyFacts[HierarchyFacts["ArrowFunctionSubtreeExcludes"] = 0] = "ArrowFunctionSubtreeExcludes";
- HierarchyFacts[HierarchyFacts["FunctionSubtreeExcludes"] = 24576] = "FunctionSubtreeExcludes";
+ HierarchyFacts[HierarchyFacts["FunctionSubtreeExcludes"] = 49152] = "FunctionSubtreeExcludes";
})(HierarchyFacts || (HierarchyFacts = {}));
function transformES2015(context) {
var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
@@ -72209,7 +73047,7 @@
*/
function enterSubtree(excludeFacts, includeFacts) {
var ancestorFacts = hierarchyFacts;
- hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & 8191 /* AncestorFactsMask */;
+ hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & 16383 /* AncestorFactsMask */;
return ancestorFacts;
}
/**
@@ -72220,17 +73058,17 @@
* @param includeFacts The new `HierarchyFacts` of the subtree that should be propagated.
*/
function exitSubtree(ancestorFacts, excludeFacts, includeFacts) {
- hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & -8192 /* SubtreeFactsMask */ | ancestorFacts;
+ hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & -16384 /* SubtreeFactsMask */ | ancestorFacts;
}
function isReturnVoidStatementInConstructorWithCapturedSuper(node) {
- return (hierarchyFacts & 4096 /* ConstructorWithCapturedSuper */) !== 0
- && node.kind === 230 /* ReturnStatement */
+ return (hierarchyFacts & 8192 /* ConstructorWithCapturedSuper */) !== 0
+ && node.kind === 231 /* ReturnStatement */
&& !node.expression;
}
function shouldVisitNode(node) {
return (node.transformFlags & 128 /* ContainsES2015 */) !== 0
|| convertedLoopState !== undefined
- || (hierarchyFacts & 4096 /* ConstructorWithCapturedSuper */ && (ts.isStatement(node) || (node.kind === 218 /* Block */)))
+ || (hierarchyFacts & 8192 /* ConstructorWithCapturedSuper */ && (ts.isStatement(node) || (node.kind === 219 /* Block */)))
|| (ts.isIterationStatement(node, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatement(node))
|| (ts.getEmitFlags(node) & 33554432 /* TypeScriptClassWrapper */) !== 0;
}
@@ -72243,72 +73081,72 @@
}
}
function callExpressionVisitor(node) {
- if (node.kind === 98 /* SuperKeyword */) {
+ if (node.kind === 99 /* SuperKeyword */) {
return visitSuperKeyword(/*isExpressionOfCall*/ true);
}
return visitor(node);
}
function visitJavaScript(node) {
switch (node.kind) {
- case 116 /* StaticKeyword */:
+ case 117 /* StaticKeyword */:
return undefined; // elide static keyword
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return visitClassDeclaration(node);
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
return visitClassExpression(node);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return visitParameter(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return visitFunctionDeclaration(node);
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return visitArrowFunction(node);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return visitFunctionExpression(node);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return visitVariableDeclaration(node);
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return visitIdentifier(node);
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
return visitVariableDeclarationList(node);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return visitSwitchStatement(node);
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
return visitCaseBlock(node);
- case 218 /* Block */:
+ case 219 /* Block */:
return visitBlock(node, /*isFunctionBody*/ false);
- case 229 /* BreakStatement */:
- case 228 /* ContinueStatement */:
+ case 230 /* BreakStatement */:
+ case 229 /* ContinueStatement */:
return visitBreakOrContinueStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return visitLabeledStatement(node);
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
return visitDoOrWhileStatement(node, /*outermostLabeledStatement*/ undefined);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return visitForStatement(node, /*outermostLabeledStatement*/ undefined);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return visitForInStatement(node, /*outermostLabeledStatement*/ undefined);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return visitExpressionStatement(node);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return visitObjectLiteralExpression(node);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return visitCatchClause(node);
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return visitShorthandPropertyAssignment(node);
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
return visitComputedPropertyName(node);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return visitArrayLiteralExpression(node);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return visitCallExpression(node);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return visitNewExpression(node);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return visitParenthesizedExpression(node, /*needsDestructuringValue*/ true);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return visitBinaryExpression(node, /*needsDestructuringValue*/ true);
case 14 /* NoSubstitutionTemplateLiteral */:
case 15 /* TemplateHead */:
@@ -72319,35 +73157,35 @@
return visitStringLiteral(node);
case 8 /* NumericLiteral */:
return visitNumericLiteral(node);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return visitTaggedTemplateExpression(node);
- case 206 /* TemplateExpression */:
+ case 207 /* TemplateExpression */:
return visitTemplateExpression(node);
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return visitYieldExpression(node);
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
return visitSpreadElement(node);
- case 98 /* SuperKeyword */:
+ case 99 /* SuperKeyword */:
return visitSuperKeyword(/*isExpressionOfCall*/ false);
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
return visitThisKeyword(node);
- case 214 /* MetaProperty */:
+ case 215 /* MetaProperty */:
return visitMetaProperty(node);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return visitMethodDeclaration(node);
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return visitAccessorDeclaration(node);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return visitVariableStatement(node);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return visitReturnStatement(node);
default:
return ts.visitEachChild(node, visitor, context);
}
}
function visitSourceFile(node) {
- var ancestorFacts = enterSubtree(3968 /* SourceFileExcludes */, 64 /* SourceFileIncludes */);
+ var ancestorFacts = enterSubtree(8064 /* SourceFileExcludes */, 64 /* SourceFileIncludes */);
var prologue = [];
var statements = [];
startLexicalEnvironment();
@@ -72374,7 +73212,7 @@
return ts.visitEachChild(node, visitor, context);
}
function visitCaseBlock(node) {
- var ancestorFacts = enterSubtree(4032 /* BlockScopeExcludes */, 0 /* BlockScopeIncludes */);
+ var ancestorFacts = enterSubtree(7104 /* BlockScopeExcludes */, 0 /* BlockScopeIncludes */);
var updated = ts.visitEachChild(node, visitor, context);
exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */);
return updated;
@@ -72401,7 +73239,7 @@
}
function visitThisKeyword(node) {
if (hierarchyFacts & 2 /* ArrowFunction */) {
- hierarchyFacts |= 16384 /* CapturedLexicalThis */;
+ hierarchyFacts |= 32768 /* CapturedLexicalThis */;
}
if (convertedLoopState) {
if (hierarchyFacts & 2 /* ArrowFunction */) {
@@ -72431,14 +73269,14 @@
// it is possible if either
// - break/continue is labeled and label is located inside the converted loop
// - break/continue is non-labeled and located in non-converted loop/switch statement
- var jump = node.kind === 229 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */;
+ var jump = node.kind === 230 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */;
var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels.get(ts.idText(node.label))) ||
(!node.label && (convertedLoopState.allowedNonLabeledJumps & jump));
if (!canUseBreakOrContinue) {
var labelMarker = void 0;
var label = node.label;
if (!label) {
- if (node.kind === 229 /* BreakStatement */) {
+ if (node.kind === 230 /* BreakStatement */) {
convertedLoopState.nonLocalJumps |= 2 /* Break */;
labelMarker = "break";
}
@@ -72449,7 +73287,7 @@
}
}
else {
- if (node.kind === 229 /* BreakStatement */) {
+ if (node.kind === 230 /* BreakStatement */) {
labelMarker = "break-" + label.escapedText;
setLabeledJump(convertedLoopState, /*isBreak*/ true, ts.idText(label), labelMarker);
}
@@ -72644,7 +73482,7 @@
function addConstructor(statements, node, extendsClauseElement) {
var savedConvertedLoopState = convertedLoopState;
convertedLoopState = undefined;
- var ancestorFacts = enterSubtree(8086 /* ConstructorExcludes */, 73 /* ConstructorIncludes */);
+ var ancestorFacts = enterSubtree(16278 /* ConstructorExcludes */, 73 /* ConstructorIncludes */);
var constructor = ts.getFirstConstructorWithBody(node);
var hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== undefined);
var constructorFunction = ts.createFunctionDeclaration(
@@ -72658,7 +73496,7 @@
ts.setEmitFlags(constructorFunction, 8 /* CapturesThis */);
}
statements.push(constructorFunction);
- exitSubtree(ancestorFacts, 24576 /* FunctionSubtreeExcludes */, 0 /* None */);
+ exitSubtree(ancestorFacts, 49152 /* FunctionSubtreeExcludes */, 0 /* None */);
convertedLoopState = savedConvertedLoopState;
}
/**
@@ -72707,7 +73545,7 @@
function transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper) {
// determine whether the class is known syntactically to be a derived class (e.g. a
// class that extends a value that is not syntactically known to be `null`).
- var isDerivedClass = !!extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 96 /* NullKeyword */;
+ var isDerivedClass = !!extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 97 /* NullKeyword */;
// When the subclass does not have a constructor, we synthesize a *default* constructor using the following
// representation:
//
@@ -72751,7 +73589,7 @@
}
}
if (superCallExpression) {
- hierarchyFacts |= 4096 /* ConstructorWithCapturedSuper */;
+ hierarchyFacts |= 8192 /* ConstructorWithCapturedSuper */;
statementOffset++; // skip this statement, we will add it after visiting the rest of the body.
}
// visit the remaining statements
@@ -72845,11 +73683,11 @@
*/
function isSufficientlyCoveredByReturnStatements(statement) {
// A return statement is considered covered.
- if (statement.kind === 230 /* ReturnStatement */) {
+ if (statement.kind === 231 /* ReturnStatement */) {
return true;
}
// An if-statement with two covered branches is covered.
- else if (statement.kind === 222 /* IfStatement */) {
+ else if (statement.kind === 223 /* IfStatement */) {
var ifStatement = statement;
if (ifStatement.elseStatement) {
return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) &&
@@ -72857,7 +73695,7 @@
}
}
// A block is covered if it has a last statement which is covered.
- else if (statement.kind === 218 /* Block */) {
+ else if (statement.kind === 219 /* Block */) {
var lastStatement = ts.lastOrUndefined(statement.statements);
if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) {
return true;
@@ -73012,10 +73850,10 @@
return false;
}
// `declarationName` is the name of the local declaration for the parameter.
- var declarationName = parameter.name.kind === 72 /* Identifier */ ? ts.getMutableClone(parameter.name) : ts.createTempVariable(/*recordTempVariable*/ undefined);
+ var declarationName = parameter.name.kind === 73 /* Identifier */ ? ts.getMutableClone(parameter.name) : ts.createTempVariable(/*recordTempVariable*/ undefined);
ts.setEmitFlags(declarationName, 48 /* NoSourceMap */);
// `expressionName` is the name of the parameter used in expressions.
- var expressionName = parameter.name.kind === 72 /* Identifier */ ? ts.getSynthesizedClone(parameter.name) : declarationName;
+ var expressionName = parameter.name.kind === 73 /* Identifier */ ? ts.getSynthesizedClone(parameter.name) : declarationName;
var restIndex = node.parameters.length - 1;
var temp = ts.createLoopVariable();
// var param = [];
@@ -73039,7 +73877,7 @@
ts.setEmitFlags(forStatement, 1048576 /* CustomPrologue */);
ts.startOnNewLine(forStatement);
prologueStatements.push(forStatement);
- if (parameter.name.kind !== 72 /* Identifier */) {
+ if (parameter.name.kind !== 73 /* Identifier */) {
// do the actual destructuring of the rest parameter if necessary
prologueStatements.push(ts.setEmitFlags(ts.setTextRange(ts.createVariableStatement(
/*modifiers*/ undefined, ts.createVariableDeclarationList(ts.flattenDestructuringBinding(parameter, visitor, context, 0 /* All */, expressionName))), parameter), 1048576 /* CustomPrologue */));
@@ -73055,7 +73893,7 @@
* @param node A node.
*/
function insertCaptureThisForNodeIfNeeded(statements, node) {
- if (hierarchyFacts & 16384 /* CapturedLexicalThis */ && node.kind !== 197 /* ArrowFunction */) {
+ if (hierarchyFacts & 32768 /* CapturedLexicalThis */ && node.kind !== 198 /* ArrowFunction */) {
insertCaptureThisForNode(statements, node, ts.createThis());
return true;
}
@@ -73073,28 +73911,28 @@
ts.insertStatementAfterCustomPrologue(statements, captureThisStatement);
}
function insertCaptureNewTargetIfNeeded(statements, node, copyOnWrite) {
- if (hierarchyFacts & 8192 /* NewTarget */) {
+ if (hierarchyFacts & 16384 /* NewTarget */) {
var newTarget = void 0;
switch (node.kind) {
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return statements;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
// Methods and accessors cannot be constructors, so 'new.target' will
// always return 'undefined'.
newTarget = ts.createVoidZero();
break;
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
// Class constructors can only be called with `new`, so `this.constructor`
// should be relatively safe to use.
newTarget = ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), "constructor");
break;
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
// Functions can be called or constructed, and may have a `this` due to
// being a member or when calling an imported function via `other_1.f()`.
- newTarget = ts.createConditional(ts.createLogicalAnd(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), ts.createBinary(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), 94 /* InstanceOfKeyword */, ts.getLocalName(node))), ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), "constructor"), ts.createVoidZero());
+ newTarget = ts.createConditional(ts.createLogicalAnd(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), ts.createBinary(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), 95 /* InstanceOfKeyword */, ts.getLocalName(node))), ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), "constructor"), ts.createVoidZero());
break;
default:
return ts.Debug.failBadSyntaxKind(node);
@@ -73123,20 +73961,20 @@
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
switch (member.kind) {
- case 217 /* SemicolonClassElement */:
+ case 218 /* SemicolonClassElement */:
statements.push(transformSemicolonClassElementToStatement(member));
break;
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node));
break;
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
var accessors = ts.getAllAccessorDeclarations(node.members, member);
if (member === accessors.firstAccessor) {
statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node));
}
break;
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
// Constructors are handled in visitClassExpression/visitClassDeclaration
break;
default:
@@ -73203,7 +74041,7 @@
// arguments are both mapped contiguously to the accessor name.
var target = ts.getMutableClone(receiver);
ts.setEmitFlags(target, 1536 /* NoComments */ | 32 /* NoTrailingSourceMap */);
- ts.setSourceMapRange(target, firstAccessor.name); // TODO: GH#18217
+ ts.setSourceMapRange(target, firstAccessor.name);
var propertyName = ts.createExpressionForPropertyName(ts.visitNode(firstAccessor.name, visitor, ts.isPropertyName));
ts.setEmitFlags(propertyName, 1536 /* NoComments */ | 16 /* NoLeadingSourceMap */);
ts.setSourceMapRange(propertyName, firstAccessor.name);
@@ -73243,11 +74081,11 @@
*/
function visitArrowFunction(node) {
if (node.transformFlags & 2048 /* ContainsLexicalThis */) {
- hierarchyFacts |= 16384 /* CapturedLexicalThis */;
+ hierarchyFacts |= 32768 /* CapturedLexicalThis */;
}
var savedConvertedLoopState = convertedLoopState;
convertedLoopState = undefined;
- var ancestorFacts = enterSubtree(8064 /* ArrowFunctionExcludes */, 66 /* ArrowFunctionIncludes */);
+ var ancestorFacts = enterSubtree(15232 /* ArrowFunctionExcludes */, 66 /* ArrowFunctionIncludes */);
var func = ts.createFunctionExpression(
/*modifiers*/ undefined,
/*asteriskToken*/ undefined,
@@ -73257,7 +74095,7 @@
ts.setTextRange(func, node);
ts.setOriginalNode(func, node);
ts.setEmitFlags(func, 8 /* CapturesThis */);
- if (hierarchyFacts & 16384 /* CapturedLexicalThis */) {
+ if (hierarchyFacts & 32768 /* CapturedLexicalThis */) {
enableSubstitutionsForCapturedThis();
}
// If an arrow function contains
@@ -73272,16 +74110,16 @@
*/
function visitFunctionExpression(node) {
var ancestorFacts = ts.getEmitFlags(node) & 262144 /* AsyncFunctionBody */
- ? enterSubtree(8086 /* AsyncFunctionBodyExcludes */, 69 /* AsyncFunctionBodyIncludes */)
- : enterSubtree(8094 /* FunctionExcludes */, 65 /* FunctionIncludes */);
+ ? enterSubtree(16278 /* AsyncFunctionBodyExcludes */, 69 /* AsyncFunctionBodyIncludes */)
+ : enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */);
var savedConvertedLoopState = convertedLoopState;
convertedLoopState = undefined;
var parameters = ts.visitParameterList(node.parameters, visitor, context);
var body = transformFunctionBody(node);
- var name = hierarchyFacts & 8192 /* NewTarget */
+ var name = hierarchyFacts & 16384 /* NewTarget */
? ts.getLocalName(node)
: node.name;
- exitSubtree(ancestorFacts, 24576 /* FunctionSubtreeExcludes */, 0 /* None */);
+ exitSubtree(ancestorFacts, 49152 /* FunctionSubtreeExcludes */, 0 /* None */);
convertedLoopState = savedConvertedLoopState;
return ts.updateFunctionExpression(node,
/*modifiers*/ undefined, node.asteriskToken, name,
@@ -73296,13 +74134,13 @@
function visitFunctionDeclaration(node) {
var savedConvertedLoopState = convertedLoopState;
convertedLoopState = undefined;
- var ancestorFacts = enterSubtree(8094 /* FunctionExcludes */, 65 /* FunctionIncludes */);
+ var ancestorFacts = enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */);
var parameters = ts.visitParameterList(node.parameters, visitor, context);
var body = transformFunctionBody(node);
- var name = hierarchyFacts & 8192 /* NewTarget */
+ var name = hierarchyFacts & 16384 /* NewTarget */
? ts.getLocalName(node)
: node.name;
- exitSubtree(ancestorFacts, 24576 /* FunctionSubtreeExcludes */, 0 /* None */);
+ exitSubtree(ancestorFacts, 49152 /* FunctionSubtreeExcludes */, 0 /* None */);
convertedLoopState = savedConvertedLoopState;
return ts.updateFunctionDeclaration(node,
/*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, name,
@@ -73320,14 +74158,14 @@
var savedConvertedLoopState = convertedLoopState;
convertedLoopState = undefined;
var ancestorFacts = container && ts.isClassLike(container) && !ts.hasModifier(node, 32 /* Static */)
- ? enterSubtree(8094 /* FunctionExcludes */, 65 /* FunctionIncludes */ | 8 /* NonStaticClassElement */)
- : enterSubtree(8094 /* FunctionExcludes */, 65 /* FunctionIncludes */);
+ ? enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */ | 8 /* NonStaticClassElement */)
+ : enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */);
var parameters = ts.visitParameterList(node.parameters, visitor, context);
var body = transformFunctionBody(node);
- if (hierarchyFacts & 8192 /* NewTarget */ && !name && (node.kind === 239 /* FunctionDeclaration */ || node.kind === 196 /* FunctionExpression */)) {
+ if (hierarchyFacts & 16384 /* NewTarget */ && !name && (node.kind === 240 /* FunctionDeclaration */ || node.kind === 197 /* FunctionExpression */)) {
name = ts.getGeneratedNameForNode(node);
}
- exitSubtree(ancestorFacts, 24576 /* FunctionSubtreeExcludes */, 0 /* None */);
+ exitSubtree(ancestorFacts, 49152 /* FunctionSubtreeExcludes */, 0 /* None */);
convertedLoopState = savedConvertedLoopState;
return ts.setOriginalNode(ts.setTextRange(ts.createFunctionExpression(
/*modifiers*/ undefined, node.asteriskToken, name,
@@ -73368,7 +74206,7 @@
}
}
else {
- ts.Debug.assert(node.kind === 197 /* ArrowFunction */);
+ ts.Debug.assert(node.kind === 198 /* ArrowFunction */);
// To align with the old emitter, we use a synthetic end position on the location
// for the statement list we synthesize when we down-level an arrow function with
// an expression function body. This prevents both comments and source maps from
@@ -73422,8 +74260,8 @@
return ts.visitEachChild(node, visitor, context);
}
var ancestorFacts = hierarchyFacts & 256 /* IterationStatement */
- ? enterSubtree(4032 /* IterationStatementBlockExcludes */, 512 /* IterationStatementBlockIncludes */)
- : enterSubtree(3904 /* BlockExcludes */, 128 /* BlockIncludes */);
+ ? enterSubtree(7104 /* IterationStatementBlockExcludes */, 512 /* IterationStatementBlockIncludes */)
+ : enterSubtree(6976 /* BlockExcludes */, 128 /* BlockIncludes */);
var updated = ts.visitEachChild(node, visitor, context);
exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */);
return updated;
@@ -73436,9 +74274,9 @@
function visitExpressionStatement(node) {
// If we are here it is most likely because our expression is a destructuring assignment.
switch (node.expression.kind) {
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return ts.updateExpressionStatement(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false));
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return ts.updateExpressionStatement(node, visitBinaryExpression(node.expression, /*needsDestructuringValue*/ false));
}
return ts.visitEachChild(node, visitor, context);
@@ -73457,9 +74295,9 @@
// expression. If we are in a state where we do not need the destructuring value,
// we pass that information along to the children that care about it.
switch (node.expression.kind) {
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return ts.updateParen(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false));
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return ts.updateParen(node, visitBinaryExpression(node.expression, /*needsDestructuringValue*/ false));
}
}
@@ -73494,7 +74332,7 @@
assignment = ts.flattenDestructuringAssignment(decl, visitor, context, 0 /* All */);
}
else {
- assignment = ts.createBinary(decl.name, 59 /* EqualsToken */, ts.visitNode(decl.initializer, visitor, ts.isExpression));
+ assignment = ts.createBinary(decl.name, 60 /* EqualsToken */, ts.visitNode(decl.initializer, visitor, ts.isExpression));
ts.setTextRange(assignment, decl);
}
assignments = ts.append(assignments, assignment);
@@ -73606,11 +74444,11 @@
&& isDeclaredInLoop
&& (hierarchyFacts & 512 /* IterationStatementBlock */) !== 0);
var emitExplicitInitializer = !emittedAsTopLevel
- && (hierarchyFacts & 2048 /* ForInOrForOfStatement */) === 0
+ && (hierarchyFacts & 4096 /* ForInOrForOfStatement */) === 0
&& (!resolver.isDeclarationWithCollidingName(node)
|| (isDeclaredInLoop
&& !isCapturedInFunction
- && (hierarchyFacts & (1024 /* ForStatement */ | 2048 /* ForInOrForOfStatement */)) === 0));
+ && (hierarchyFacts & (2048 /* ForStatement */ | 4096 /* ForInOrForOfStatement */)) === 0));
return emitExplicitInitializer;
}
/**
@@ -73668,34 +74506,34 @@
}
function visitIterationStatement(node, outermostLabeledStatement) {
switch (node.kind) {
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
return visitDoOrWhileStatement(node, outermostLabeledStatement);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return visitForStatement(node, outermostLabeledStatement);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return visitForInStatement(node, outermostLabeledStatement);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return visitForOfStatement(node, outermostLabeledStatement);
}
}
function visitIterationStatementWithFacts(excludeFacts, includeFacts, node, outermostLabeledStatement, convert) {
var ancestorFacts = enterSubtree(excludeFacts, includeFacts);
- var updated = convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert);
+ var updated = convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, ancestorFacts, convert);
exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */);
return updated;
}
function visitDoOrWhileStatement(node, outermostLabeledStatement) {
- return visitIterationStatementWithFacts(0 /* DoOrWhileStatementExcludes */, 256 /* DoOrWhileStatementIncludes */, node, outermostLabeledStatement);
+ return visitIterationStatementWithFacts(0 /* DoOrWhileStatementExcludes */, 1280 /* DoOrWhileStatementIncludes */, node, outermostLabeledStatement);
}
function visitForStatement(node, outermostLabeledStatement) {
- return visitIterationStatementWithFacts(3008 /* ForStatementExcludes */, 1280 /* ForStatementIncludes */, node, outermostLabeledStatement);
+ return visitIterationStatementWithFacts(5056 /* ForStatementExcludes */, 3328 /* ForStatementIncludes */, node, outermostLabeledStatement);
}
function visitForInStatement(node, outermostLabeledStatement) {
- return visitIterationStatementWithFacts(1984 /* ForInOrForOfStatementExcludes */, 2304 /* ForInOrForOfStatementIncludes */, node, outermostLabeledStatement);
+ return visitIterationStatementWithFacts(3008 /* ForInOrForOfStatementExcludes */, 5376 /* ForInOrForOfStatementIncludes */, node, outermostLabeledStatement);
}
function visitForOfStatement(node, outermostLabeledStatement) {
- return visitIterationStatementWithFacts(1984 /* ForInOrForOfStatementExcludes */, 2304 /* ForInOrForOfStatementIncludes */, node, outermostLabeledStatement, compilerOptions.downlevelIteration ? convertForOfStatementForIterable : convertForOfStatementForArray);
+ return visitIterationStatementWithFacts(3008 /* ForInOrForOfStatementExcludes */, 5376 /* ForInOrForOfStatementIncludes */, node, outermostLabeledStatement, compilerOptions.downlevelIteration ? convertForOfStatementForIterable : convertForOfStatementForArray);
}
function convertForOfStatementHead(node, boundValue, convertedLoopBodyStatements) {
var statements = [];
@@ -73803,7 +74641,7 @@
ts.setTextRange(forStatement, node);
return ts.restoreEnclosingLabel(forStatement, outermostLabeledStatement, convertedLoopState && resetLabel);
}
- function convertForOfStatementForIterable(node, outermostLabeledStatement, convertedLoopBodyStatements) {
+ function convertForOfStatementForIterable(node, outermostLabeledStatement, convertedLoopBodyStatements, ancestorFacts) {
var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
var iterator = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(expression) : ts.createTempVariable(/*recordTempVariable*/ undefined);
var result = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(iterator) : ts.createTempVariable(/*recordTempVariable*/ undefined);
@@ -73814,9 +74652,13 @@
var next = ts.createCall(ts.createPropertyAccess(iterator, "next"), /*typeArguments*/ undefined, []);
hoistVariableDeclaration(errorRecord);
hoistVariableDeclaration(returnMethod);
+ // if we are enclosed in an outer loop ensure we reset 'errorRecord' per each iteration
+ var initializer = ancestorFacts & 1024 /* IterationContainer */
+ ? ts.inlineExpressions([ts.createAssignment(errorRecord, ts.createVoidZero()), values])
+ : values;
var forStatement = ts.setEmitFlags(ts.setTextRange(ts.createFor(
/*initializer*/ ts.setEmitFlags(ts.setTextRange(ts.createVariableDeclarationList([
- ts.setTextRange(ts.createVariableDeclaration(iterator, /*type*/ undefined, values), node.expression),
+ ts.setTextRange(ts.createVariableDeclaration(iterator, /*type*/ undefined, initializer), node.expression),
ts.createVariableDeclaration(result, /*type*/ undefined, next)
]), node.expression), 2097152 /* NoHoisting */),
/*condition*/ ts.createLogicalNot(ts.createPropertyAccess(result, "done")),
@@ -73859,7 +74701,7 @@
&& i < numInitialPropertiesWithoutYield) {
numInitialPropertiesWithoutYield = i;
}
- if (property.name.kind === 149 /* ComputedPropertyName */) {
+ if (property.name.kind === 150 /* ComputedPropertyName */) {
numInitialProperties = i;
break;
}
@@ -73914,7 +74756,7 @@
}
visit(node.name);
function visit(node) {
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
state.hoistedLocalVariables.push(node);
}
else {
@@ -73927,7 +74769,7 @@
}
}
}
- function convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert) {
+ function convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, ancestorFacts, convert) {
if (!shouldConvertIterationStatement(node)) {
var saveAllowedNonLabeledJumps = void 0;
if (convertedLoopState) {
@@ -73937,7 +74779,7 @@
convertedLoopState.allowedNonLabeledJumps = 2 /* Break */ | 4 /* Continue */;
}
var result = convert
- ? convert(node, outermostLabeledStatement, /*convertedLoopBodyStatements*/ undefined)
+ ? convert(node, outermostLabeledStatement, /*convertedLoopBodyStatements*/ undefined, ancestorFacts)
: ts.restoreEnclosingLabel(ts.visitEachChild(node, visitor, context), outermostLabeledStatement, convertedLoopState && resetLabel);
if (convertedLoopState) {
convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps;
@@ -73962,7 +74804,7 @@
var loop;
if (bodyFunction) {
if (convert) {
- loop = convert(node, outermostLabeledStatement, bodyFunction.part);
+ loop = convert(node, outermostLabeledStatement, bodyFunction.part, ancestorFacts);
}
else {
var clone_3 = convertIterationStatementCore(node, initializerFunction, ts.createBlock(bodyFunction.part, /*multiLine*/ true));
@@ -73980,11 +74822,11 @@
}
function convertIterationStatementCore(node, initializerFunction, convertedLoopBody) {
switch (node.kind) {
- case 225 /* ForStatement */: return convertForStatement(node, initializerFunction, convertedLoopBody);
- case 226 /* ForInStatement */: return convertForInStatement(node, convertedLoopBody);
- case 227 /* ForOfStatement */: return convertForOfStatement(node, convertedLoopBody);
- case 223 /* DoStatement */: return convertDoStatement(node, convertedLoopBody);
- case 224 /* WhileStatement */: return convertWhileStatement(node, convertedLoopBody);
+ case 226 /* ForStatement */: return convertForStatement(node, initializerFunction, convertedLoopBody);
+ case 227 /* ForInStatement */: return convertForInStatement(node, convertedLoopBody);
+ case 228 /* ForOfStatement */: return convertForOfStatement(node, convertedLoopBody);
+ case 224 /* DoStatement */: return convertDoStatement(node, convertedLoopBody);
+ case 225 /* WhileStatement */: return convertWhileStatement(node, convertedLoopBody);
default: return ts.Debug.failBadSyntaxKind(node, "IterationStatement expected");
}
}
@@ -74009,11 +74851,11 @@
function createConvertedLoopState(node) {
var loopInitializer;
switch (node.kind) {
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
var initializer = node.initializer;
- if (initializer && initializer.kind === 238 /* VariableDeclarationList */) {
+ if (initializer && initializer.kind === 239 /* VariableDeclarationList */) {
loopInitializer = initializer;
}
break;
@@ -74275,7 +75117,7 @@
function copyOutParameter(outParam, copyDirection) {
var source = copyDirection === 0 /* ToOriginal */ ? outParam.outParamName : outParam.originalName;
var target = copyDirection === 0 /* ToOriginal */ ? outParam.originalName : outParam.outParamName;
- return ts.createBinary(target, 59 /* EqualsToken */, source);
+ return ts.createBinary(target, 60 /* EqualsToken */, source);
}
function copyOutParameters(outParams, partFlags, copyDirection, statements) {
for (var _i = 0, outParams_1 = outParams; _i < outParams_1.length; _i++) {
@@ -74412,20 +75254,20 @@
for (var i = start; i < numProperties; i++) {
var property = properties[i];
switch (property.kind) {
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
var accessors = ts.getAllAccessorDeclarations(node.properties, property);
if (property === accessors.firstAccessor) {
expressions.push(transformAccessorsToExpression(receiver, accessors, node, !!node.multiLine));
}
break;
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine));
break;
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine));
break;
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine));
break;
default:
@@ -74480,7 +75322,7 @@
return expression;
}
function visitCatchClause(node) {
- var ancestorFacts = enterSubtree(4032 /* BlockScopeExcludes */, 0 /* BlockScopeIncludes */);
+ var ancestorFacts = enterSubtree(7104 /* BlockScopeExcludes */, 0 /* BlockScopeIncludes */);
var updated;
ts.Debug.assert(!!node.variableDeclaration, "Catch clause variable should always be present when downleveling ES2015.");
if (ts.isBindingPattern(node.variableDeclaration.name)) {
@@ -74528,17 +75370,17 @@
ts.Debug.assert(!ts.isComputedPropertyName(node.name));
var savedConvertedLoopState = convertedLoopState;
convertedLoopState = undefined;
- var ancestorFacts = enterSubtree(8094 /* FunctionExcludes */, 65 /* FunctionIncludes */);
+ var ancestorFacts = enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */);
var updated;
var parameters = ts.visitParameterList(node.parameters, visitor, context);
var body = transformFunctionBody(node);
- if (node.kind === 158 /* GetAccessor */) {
+ if (node.kind === 159 /* GetAccessor */) {
updated = ts.updateGetAccessor(node, node.decorators, node.modifiers, node.name, parameters, node.type, body);
}
else {
updated = ts.updateSetAccessor(node, node.decorators, node.modifiers, node.name, parameters, body);
}
- exitSubtree(ancestorFacts, 24576 /* FunctionSubtreeExcludes */, 0 /* None */);
+ exitSubtree(ancestorFacts, 49152 /* FunctionSubtreeExcludes */, 0 /* None */);
convertedLoopState = savedConvertedLoopState;
return updated;
}
@@ -74585,7 +75427,7 @@
return visitTypeScriptClassWrapper(node);
}
var expression = ts.skipOuterExpressions(node.expression);
- if (expression.kind === 98 /* SuperKeyword */ ||
+ if (expression.kind === 99 /* SuperKeyword */ ||
ts.isSuperProperty(expression) ||
ts.some(node.arguments, ts.isSpreadElement)) {
return visitCallExpressionWithPotentialCapturedThisAssignment(node, /*assignToCapturedThis*/ true);
@@ -74709,10 +75551,10 @@
// We are here either because SuperKeyword was used somewhere in the expression, or
// because we contain a SpreadElementExpression.
if (node.transformFlags & 4096 /* ContainsRestOrSpread */ ||
- node.expression.kind === 98 /* SuperKeyword */ ||
+ node.expression.kind === 99 /* SuperKeyword */ ||
ts.isSuperProperty(ts.skipOuterExpressions(node.expression))) {
var _a = ts.createCallBinding(node.expression, hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
ts.setEmitFlags(thisArg, 4 /* NoSubstitution */);
}
var resultingCall = void 0;
@@ -74730,7 +75572,7 @@
// _super.apply(this, a.concat([b]))
// _super.m.apply(this, a.concat([b]))
// _super.prototype.m.apply(this, a.concat([b]))
- resultingCall = ts.createFunctionApply(ts.visitNode(target, callExpressionVisitor, ts.isExpression), node.expression.kind === 98 /* SuperKeyword */ ? thisArg : ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false));
+ resultingCall = ts.createFunctionApply(ts.visitNode(target, callExpressionVisitor, ts.isExpression), node.expression.kind === 99 /* SuperKeyword */ ? thisArg : ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false));
}
else {
// [source]
@@ -74742,10 +75584,10 @@
// _super.call(this, a)
// _super.m.call(this, a)
// _super.prototype.m.call(this, a)
- resultingCall = ts.createFunctionCall(ts.visitNode(target, callExpressionVisitor, ts.isExpression), node.expression.kind === 98 /* SuperKeyword */ ? thisArg : ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression),
+ resultingCall = ts.createFunctionCall(ts.visitNode(target, callExpressionVisitor, ts.isExpression), node.expression.kind === 99 /* SuperKeyword */ ? thisArg : ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression),
/*location*/ node);
}
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
var initializer = ts.createLogicalOr(resultingCall, createActualThis());
resultingCall = assignToCapturedThis
? ts.createAssignment(ts.createFileLevelUniqueName("_this"), initializer)
@@ -74808,7 +75650,7 @@
else {
if (segments.length === 1) {
var firstElement = elements[0];
- return needsUniqueCopy && ts.isSpreadElement(firstElement) && firstElement.expression.kind !== 187 /* ArrayLiteralExpression */
+ return needsUniqueCopy && ts.isSpreadElement(firstElement) && firstElement.expression.kind !== 188 /* ArrayLiteralExpression */
? ts.createArraySlice(segments[0])
: segments[0];
}
@@ -75023,8 +75865,8 @@
: ts.createFileLevelUniqueName("_super");
}
function visitMetaProperty(node) {
- if (node.keywordToken === 95 /* NewKeyword */ && node.name.escapedText === "target") {
- hierarchyFacts |= 8192 /* NewTarget */;
+ if (node.keywordToken === 96 /* NewKeyword */ && node.name.escapedText === "target") {
+ hierarchyFacts |= 16384 /* NewTarget */;
return ts.createFileLevelUniqueName("_newTarget");
}
return node;
@@ -75039,7 +75881,7 @@
function onEmitNode(hint, node, emitCallback) {
if (enabledSubstitutions & 1 /* CapturedThis */ && ts.isFunctionLike(node)) {
// If we are tracking a captured `this`, keep track of the enclosing function.
- var ancestorFacts = enterSubtree(8094 /* FunctionExcludes */, ts.getEmitFlags(node) & 8 /* CapturesThis */
+ var ancestorFacts = enterSubtree(16286 /* FunctionExcludes */, ts.getEmitFlags(node) & 8 /* CapturesThis */
? 65 /* FunctionIncludes */ | 16 /* CapturesThis */
: 65 /* FunctionIncludes */);
previousOnEmitNode(hint, node, emitCallback);
@@ -75055,7 +75897,7 @@
function enableSubstitutionsForBlockScopedBindings() {
if ((enabledSubstitutions & 2 /* BlockScopedBindings */) === 0) {
enabledSubstitutions |= 2 /* BlockScopedBindings */;
- context.enableSubstitution(72 /* Identifier */);
+ context.enableSubstitution(73 /* Identifier */);
}
}
/**
@@ -75065,14 +75907,14 @@
function enableSubstitutionsForCapturedThis() {
if ((enabledSubstitutions & 1 /* CapturedThis */) === 0) {
enabledSubstitutions |= 1 /* CapturedThis */;
- context.enableSubstitution(100 /* ThisKeyword */);
- context.enableEmitNotification(157 /* Constructor */);
- context.enableEmitNotification(156 /* MethodDeclaration */);
- context.enableEmitNotification(158 /* GetAccessor */);
- context.enableEmitNotification(159 /* SetAccessor */);
- context.enableEmitNotification(197 /* ArrowFunction */);
- context.enableEmitNotification(196 /* FunctionExpression */);
- context.enableEmitNotification(239 /* FunctionDeclaration */);
+ context.enableSubstitution(101 /* ThisKeyword */);
+ context.enableEmitNotification(158 /* Constructor */);
+ context.enableEmitNotification(157 /* MethodDeclaration */);
+ context.enableEmitNotification(159 /* GetAccessor */);
+ context.enableEmitNotification(160 /* SetAccessor */);
+ context.enableEmitNotification(198 /* ArrowFunction */);
+ context.enableEmitNotification(197 /* FunctionExpression */);
+ context.enableEmitNotification(240 /* FunctionDeclaration */);
}
}
/**
@@ -75113,10 +75955,10 @@
*/
function isNameOfDeclarationWithCollidingName(node) {
switch (node.parent.kind) {
- case 186 /* BindingElement */:
- case 240 /* ClassDeclaration */:
- case 243 /* EnumDeclaration */:
- case 237 /* VariableDeclaration */:
+ case 187 /* BindingElement */:
+ case 241 /* ClassDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 238 /* VariableDeclaration */:
return node.parent.name === node
&& resolver.isDeclarationWithCollidingName(node.parent);
}
@@ -75129,9 +75971,9 @@
*/
function substituteExpression(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return substituteExpressionIdentifier(node);
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
return substituteThisKeyword(node);
}
return node;
@@ -75198,19 +76040,19 @@
return false;
}
var statement = ts.firstOrUndefined(constructor.body.statements);
- if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 221 /* ExpressionStatement */) {
+ if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 222 /* ExpressionStatement */) {
return false;
}
var statementExpression = statement.expression;
- if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 191 /* CallExpression */) {
+ if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 192 /* CallExpression */) {
return false;
}
var callTarget = statementExpression.expression;
- if (!ts.nodeIsSynthesized(callTarget) || callTarget.kind !== 98 /* SuperKeyword */) {
+ if (!ts.nodeIsSynthesized(callTarget) || callTarget.kind !== 99 /* SuperKeyword */) {
return false;
}
var callArgument = ts.singleOrUndefined(statementExpression.arguments);
- if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 208 /* SpreadElement */) {
+ if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 209 /* SpreadElement */) {
return false;
}
var expression = callArgument.expression;
@@ -75263,15 +76105,15 @@
if (compilerOptions.jsx === 1 /* Preserve */ || compilerOptions.jsx === 3 /* ReactNative */) {
previousOnEmitNode = context.onEmitNode;
context.onEmitNode = onEmitNode;
- context.enableEmitNotification(262 /* JsxOpeningElement */);
- context.enableEmitNotification(263 /* JsxClosingElement */);
- context.enableEmitNotification(261 /* JsxSelfClosingElement */);
+ context.enableEmitNotification(263 /* JsxOpeningElement */);
+ context.enableEmitNotification(264 /* JsxClosingElement */);
+ context.enableEmitNotification(262 /* JsxSelfClosingElement */);
noSubstitution = [];
}
var previousOnSubstituteNode = context.onSubstituteNode;
context.onSubstituteNode = onSubstituteNode;
- context.enableSubstitution(189 /* PropertyAccessExpression */);
- context.enableSubstitution(275 /* PropertyAssignment */);
+ context.enableSubstitution(190 /* PropertyAccessExpression */);
+ context.enableSubstitution(276 /* PropertyAssignment */);
return ts.chainBundle(transformSourceFile);
/**
* Transforms an ES5 source file to ES3.
@@ -75290,9 +76132,9 @@
*/
function onEmitNode(hint, node, emitCallback) {
switch (node.kind) {
- case 262 /* JsxOpeningElement */:
- case 263 /* JsxClosingElement */:
- case 261 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
+ case 264 /* JsxClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
var tagName = node.tagName;
noSubstitution[ts.getOriginalNodeId(tagName)] = true;
break;
@@ -75349,7 +76191,7 @@
*/
function trySubstituteReservedName(name) {
var token = name.originalKeywordKind || (ts.nodeIsSynthesized(name) ? ts.stringToToken(ts.idText(name)) : undefined);
- if (token !== undefined && token >= 73 /* FirstReservedWord */ && token <= 108 /* LastReservedWord */) {
+ if (token !== undefined && token >= 74 /* FirstReservedWord */ && token <= 109 /* LastReservedWord */) {
return ts.setTextRange(ts.createLiteral(name), name);
}
return undefined;
@@ -75624,13 +76466,13 @@
*/
function visitJavaScriptInStatementContainingYield(node) {
switch (node.kind) {
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
return visitDoStatement(node);
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
return visitWhileStatement(node);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return visitSwitchStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return visitLabeledStatement(node);
default:
return visitJavaScriptInGeneratorFunctionBody(node);
@@ -75643,24 +76485,24 @@
*/
function visitJavaScriptInGeneratorFunctionBody(node) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return visitFunctionDeclaration(node);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return visitFunctionExpression(node);
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return visitAccessorDeclaration(node);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return visitVariableStatement(node);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return visitForStatement(node);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return visitForInStatement(node);
- case 229 /* BreakStatement */:
+ case 230 /* BreakStatement */:
return visitBreakStatement(node);
- case 228 /* ContinueStatement */:
+ case 229 /* ContinueStatement */:
return visitContinueStatement(node);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return visitReturnStatement(node);
default:
if (node.transformFlags & 131072 /* ContainsYield */) {
@@ -75681,21 +76523,21 @@
*/
function visitJavaScriptContainingYield(node) {
switch (node.kind) {
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return visitBinaryExpression(node);
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return visitConditionalExpression(node);
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return visitYieldExpression(node);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return visitArrayLiteralExpression(node);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return visitObjectLiteralExpression(node);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return visitElementAccessExpression(node);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return visitCallExpression(node);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return visitNewExpression(node);
default:
return ts.visitEachChild(node, visitor, context);
@@ -75708,9 +76550,9 @@
*/
function visitGenerator(node) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return visitFunctionDeclaration(node);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return visitFunctionExpression(node);
default:
return ts.Debug.failBadSyntaxKind(node);
@@ -75909,23 +76751,23 @@
}
}
function isCompoundAssignment(kind) {
- return kind >= 60 /* FirstCompoundAssignment */
- && kind <= 71 /* LastCompoundAssignment */;
+ return kind >= 61 /* FirstCompoundAssignment */
+ && kind <= 72 /* LastCompoundAssignment */;
}
function getOperatorForCompoundAssignment(kind) {
switch (kind) {
- case 60 /* PlusEqualsToken */: return 38 /* PlusToken */;
- case 61 /* MinusEqualsToken */: return 39 /* MinusToken */;
- case 62 /* AsteriskEqualsToken */: return 40 /* AsteriskToken */;
- case 63 /* AsteriskAsteriskEqualsToken */: return 41 /* AsteriskAsteriskToken */;
- case 64 /* SlashEqualsToken */: return 42 /* SlashToken */;
- case 65 /* PercentEqualsToken */: return 43 /* PercentToken */;
- case 66 /* LessThanLessThanEqualsToken */: return 46 /* LessThanLessThanToken */;
- case 67 /* GreaterThanGreaterThanEqualsToken */: return 47 /* GreaterThanGreaterThanToken */;
- case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */: return 48 /* GreaterThanGreaterThanGreaterThanToken */;
- case 69 /* AmpersandEqualsToken */: return 49 /* AmpersandToken */;
- case 70 /* BarEqualsToken */: return 50 /* BarToken */;
- case 71 /* CaretEqualsToken */: return 51 /* CaretToken */;
+ case 61 /* PlusEqualsToken */: return 38 /* PlusToken */;
+ case 62 /* MinusEqualsToken */: return 39 /* MinusToken */;
+ case 63 /* AsteriskEqualsToken */: return 40 /* AsteriskToken */;
+ case 64 /* AsteriskAsteriskEqualsToken */: return 41 /* AsteriskAsteriskToken */;
+ case 65 /* SlashEqualsToken */: return 42 /* SlashToken */;
+ case 66 /* PercentEqualsToken */: return 43 /* PercentToken */;
+ case 67 /* LessThanLessThanEqualsToken */: return 46 /* LessThanLessThanToken */;
+ case 68 /* GreaterThanGreaterThanEqualsToken */: return 47 /* GreaterThanGreaterThanToken */;
+ case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */: return 48 /* GreaterThanGreaterThanGreaterThanToken */;
+ case 70 /* AmpersandEqualsToken */: return 49 /* AmpersandToken */;
+ case 71 /* BarEqualsToken */: return 50 /* BarToken */;
+ case 72 /* CaretEqualsToken */: return 51 /* CaretToken */;
}
}
/**
@@ -75938,7 +76780,7 @@
if (containsYield(right)) {
var target = void 0;
switch (left.kind) {
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
// [source]
// a.b = yield;
//
@@ -75950,7 +76792,7 @@
// _a.b = %sent%;
target = ts.updatePropertyAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name);
break;
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
// [source]
// a[b] = yield;
//
@@ -76326,35 +77168,35 @@
}
function transformAndEmitStatementWorker(node) {
switch (node.kind) {
- case 218 /* Block */:
+ case 219 /* Block */:
return transformAndEmitBlock(node);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return transformAndEmitExpressionStatement(node);
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
return transformAndEmitIfStatement(node);
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
return transformAndEmitDoStatement(node);
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
return transformAndEmitWhileStatement(node);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return transformAndEmitForStatement(node);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return transformAndEmitForInStatement(node);
- case 228 /* ContinueStatement */:
+ case 229 /* ContinueStatement */:
return transformAndEmitContinueStatement(node);
- case 229 /* BreakStatement */:
+ case 230 /* BreakStatement */:
return transformAndEmitBreakStatement(node);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return transformAndEmitReturnStatement(node);
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
return transformAndEmitWithStatement(node);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return transformAndEmitSwitchStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return transformAndEmitLabeledStatement(node);
- case 234 /* ThrowStatement */:
+ case 235 /* ThrowStatement */:
return transformAndEmitThrowStatement(node);
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
return transformAndEmitTryStatement(node);
default:
return emitStatement(ts.visitNode(node, visitor, ts.isStatement));
@@ -76784,7 +77626,7 @@
for (var i = 0; i < numClauses; i++) {
var clause = caseBlock.clauses[i];
clauseLabels.push(defineLabel());
- if (clause.kind === 272 /* DefaultClause */ && defaultClauseIndex === -1) {
+ if (clause.kind === 273 /* DefaultClause */ && defaultClauseIndex === -1) {
defaultClauseIndex = i;
}
}
@@ -76797,7 +77639,7 @@
var defaultClausesSkipped = 0;
for (var i = clausesWritten; i < numClauses; i++) {
var clause = caseBlock.clauses[i];
- if (clause.kind === 271 /* CaseClause */) {
+ if (clause.kind === 272 /* CaseClause */) {
if (containsYield(clause.expression) && pendingClauses.length > 0) {
break;
}
@@ -77109,7 +77951,7 @@
if (!renamedCatchVariables) {
renamedCatchVariables = ts.createMap();
renamedCatchVariableDeclarations = [];
- context.enableSubstitution(72 /* Identifier */);
+ context.enableSubstitution(73 /* Identifier */);
}
renamedCatchVariables.set(text, true);
renamedCatchVariableDeclarations[ts.getOriginalNodeId(variable)] = name;
@@ -78025,12 +78867,12 @@
var previousOnEmitNode = context.onEmitNode;
context.onSubstituteNode = onSubstituteNode;
context.onEmitNode = onEmitNode;
- context.enableSubstitution(72 /* Identifier */); // Substitutes expression identifiers with imported/exported symbols.
- context.enableSubstitution(204 /* BinaryExpression */); // Substitutes assignments to exported symbols.
- context.enableSubstitution(202 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols.
- context.enableSubstitution(203 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols.
- context.enableSubstitution(276 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols.
- context.enableEmitNotification(284 /* SourceFile */); // Restore state when substituting nodes in a file.
+ context.enableSubstitution(73 /* Identifier */); // Substitutes expression identifiers with imported/exported symbols.
+ context.enableSubstitution(205 /* BinaryExpression */); // Substitutes assignments to exported symbols.
+ context.enableSubstitution(203 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols.
+ context.enableSubstitution(204 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols.
+ context.enableSubstitution(277 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols.
+ context.enableEmitNotification(285 /* SourceFile */); // Restore state when substituting nodes in a file.
var moduleInfoMap = []; // The ExternalModuleInfo for each file.
var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found.
var currentSourceFile; // The current file.
@@ -78358,23 +79200,23 @@
*/
function sourceElementVisitor(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return visitImportDeclaration(node);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return visitImportEqualsDeclaration(node);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return visitExportDeclaration(node);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return visitExportAssignment(node);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return visitVariableStatement(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return visitFunctionDeclaration(node);
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return visitClassDeclaration(node);
- case 315 /* MergeDeclarationMarker */:
+ case 316 /* MergeDeclarationMarker */:
return visitMergeDeclarationMarker(node);
- case 316 /* EndOfDeclarationMarker */:
+ case 317 /* EndOfDeclarationMarker */:
return visitEndOfDeclarationMarker(node);
default:
return ts.visitEachChild(node, moduleExpressionElementVisitor, context);
@@ -78401,24 +79243,24 @@
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var elem = _a[_i];
switch (elem.kind) {
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
if (destructuringNeedsFlattening(elem.initializer)) {
return true;
}
break;
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
if (destructuringNeedsFlattening(elem.name)) {
return true;
}
break;
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
if (destructuringNeedsFlattening(elem.expression)) {
return true;
}
break;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return false;
default: ts.Debug.assertNever(elem, "Unhandled object member kind");
}
@@ -78896,7 +79738,7 @@
//
// To balance the declaration, add the exports of the elided variable
// statement.
- if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 219 /* VariableStatement */) {
+ if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 220 /* VariableStatement */) {
var id = ts.getOriginalNodeId(node);
deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original);
}
@@ -78951,10 +79793,10 @@
var namedBindings = importClause.namedBindings;
if (namedBindings) {
switch (namedBindings.kind) {
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
statements = appendExportsOfDeclaration(statements, namedBindings);
break;
- case 252 /* NamedImports */:
+ case 253 /* NamedImports */:
for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) {
var importBinding = _a[_i];
statements = appendExportsOfDeclaration(statements, importBinding);
@@ -79136,8 +79978,8 @@
function modifierVisitor(node) {
// Elide module-specific modifiers.
switch (node.kind) {
- case 85 /* ExportKeyword */:
- case 80 /* DefaultKeyword */:
+ case 86 /* ExportKeyword */:
+ case 81 /* DefaultKeyword */:
return undefined;
}
return node;
@@ -79153,7 +79995,7 @@
* @param emit A callback used to emit the node in the printer.
*/
function onEmitNode(hint, node, emitCallback) {
- if (node.kind === 284 /* SourceFile */) {
+ if (node.kind === 285 /* SourceFile */) {
currentSourceFile = node;
currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)];
noSubstitution = [];
@@ -79215,12 +80057,12 @@
*/
function substituteExpression(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return substituteExpressionIdentifier(node);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return substituteBinaryExpression(node);
- case 203 /* PostfixUnaryExpression */:
- case 202 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return substituteUnaryExpression(node);
}
return node;
@@ -79241,7 +80083,7 @@
}
if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) {
var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node));
- if (exportContainer && exportContainer.kind === 284 /* SourceFile */) {
+ if (exportContainer && exportContainer.kind === 285 /* SourceFile */) {
return ts.setTextRange(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node)),
/*location*/ node);
}
@@ -79316,8 +80158,8 @@
&& !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) {
var exportedNames = getExports(node.operand);
if (exportedNames) {
- var expression = node.kind === 203 /* PostfixUnaryExpression */
- ? ts.setTextRange(ts.createBinary(node.operand, ts.createToken(node.operator === 44 /* PlusPlusToken */ ? 60 /* PlusEqualsToken */ : 61 /* MinusEqualsToken */), ts.createLiteral(1)),
+ var expression = node.kind === 204 /* PostfixUnaryExpression */
+ ? ts.setTextRange(ts.createBinary(node.operand, ts.createToken(node.operator === 44 /* PlusPlusToken */ ? 61 /* PlusEqualsToken */ : 62 /* MinusEqualsToken */), ts.createLiteral(1)),
/*location*/ node)
: node;
for (var _i = 0, exportedNames_3 = exportedNames; _i < exportedNames_3.length; _i++) {
@@ -79391,12 +80233,12 @@
var previousOnEmitNode = context.onEmitNode;
context.onSubstituteNode = onSubstituteNode;
context.onEmitNode = onEmitNode;
- context.enableSubstitution(72 /* Identifier */); // Substitutes expression identifiers for imported symbols.
- context.enableSubstitution(276 /* ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols
- context.enableSubstitution(204 /* BinaryExpression */); // Substitutes assignments to exported symbols.
- context.enableSubstitution(202 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols.
- context.enableSubstitution(203 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols.
- context.enableEmitNotification(284 /* SourceFile */); // Restore state when substituting nodes in a file.
+ context.enableSubstitution(73 /* Identifier */); // Substitutes expression identifiers for imported symbols.
+ context.enableSubstitution(277 /* ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols
+ context.enableSubstitution(205 /* BinaryExpression */); // Substitutes assignments to exported symbols.
+ context.enableSubstitution(203 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols.
+ context.enableSubstitution(204 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols.
+ context.enableEmitNotification(285 /* SourceFile */); // Restore state when substituting nodes in a file.
var moduleInfoMap = []; // The ExternalModuleInfo for each file.
var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found.
var exportFunctionsMap = []; // The export function associated with a source file.
@@ -79617,7 +80459,7 @@
var hasExportDeclarationWithExportClause = false;
for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) {
var externalImport = _a[_i];
- if (externalImport.kind === 255 /* ExportDeclaration */ && externalImport.exportClause) {
+ if (externalImport.kind === 256 /* ExportDeclaration */ && externalImport.exportClause) {
hasExportDeclarationWithExportClause = true;
break;
}
@@ -79642,7 +80484,7 @@
}
for (var _d = 0, _e = moduleInfo.externalImports; _d < _e.length; _d++) {
var externalImport = _e[_d];
- if (externalImport.kind !== 255 /* ExportDeclaration */) {
+ if (externalImport.kind !== 256 /* ExportDeclaration */) {
continue;
}
if (!externalImport.exportClause) {
@@ -79720,19 +80562,19 @@
var entry = _b[_a];
var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile); // TODO: GH#18217
switch (entry.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
if (!entry.importClause) {
// 'import "..."' case
// module is imported only for side-effects, no emit required
break;
}
// falls through
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
ts.Debug.assert(importVariableName !== undefined);
// save import into the local
statements.push(ts.createExpressionStatement(ts.createAssignment(importVariableName, parameterName)));
break;
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
ts.Debug.assert(importVariableName !== undefined);
if (entry.exportClause) {
// export {a, b as c} from 'foo'
@@ -79782,15 +80624,15 @@
*/
function sourceElementVisitor(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return visitImportDeclaration(node);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return visitImportEqualsDeclaration(node);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
// ExportDeclarations are elided as they are handled via
// `appendExportsOfDeclaration`.
return undefined;
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return visitExportAssignment(node);
default:
return nestedElementVisitor(node);
@@ -79966,7 +80808,7 @@
function shouldHoistVariableDeclarationList(node) {
// hoist only non-block scoped declarations or block scoped declarations parented by source file
return (ts.getEmitFlags(node) & 2097152 /* NoHoisting */) === 0
- && (enclosingBlockScopedContainer.kind === 284 /* SourceFile */
+ && (enclosingBlockScopedContainer.kind === 285 /* SourceFile */
|| (ts.getOriginalNode(node).flags & 3 /* BlockScoped */) === 0);
}
/**
@@ -80030,7 +80872,7 @@
//
// To balance the declaration, we defer the exports of the elided variable
// statement until we visit this declaration's `EndOfDeclarationMarker`.
- if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 219 /* VariableStatement */) {
+ if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 220 /* VariableStatement */) {
var id = ts.getOriginalNodeId(node);
var isExportedDeclaration = ts.hasModifier(node.original, 1 /* Export */);
deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration);
@@ -80092,10 +80934,10 @@
var namedBindings = importClause.namedBindings;
if (namedBindings) {
switch (namedBindings.kind) {
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
statements = appendExportsOfDeclaration(statements, namedBindings);
break;
- case 252 /* NamedImports */:
+ case 253 /* NamedImports */:
for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) {
var importBinding = _a[_i];
statements = appendExportsOfDeclaration(statements, importBinding);
@@ -80275,43 +81117,43 @@
*/
function nestedElementVisitor(node) {
switch (node.kind) {
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return visitVariableStatement(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return visitFunctionDeclaration(node);
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return visitClassDeclaration(node);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return visitForStatement(node);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return visitForInStatement(node);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return visitForOfStatement(node);
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
return visitDoStatement(node);
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
return visitWhileStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return visitLabeledStatement(node);
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
return visitWithStatement(node);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return visitSwitchStatement(node);
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
return visitCaseBlock(node);
- case 271 /* CaseClause */:
+ case 272 /* CaseClause */:
return visitCaseClause(node);
- case 272 /* DefaultClause */:
+ case 273 /* DefaultClause */:
return visitDefaultClause(node);
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
return visitTryStatement(node);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return visitCatchClause(node);
- case 218 /* Block */:
+ case 219 /* Block */:
return visitBlock(node);
- case 315 /* MergeDeclarationMarker */:
+ case 316 /* MergeDeclarationMarker */:
return visitMergeDeclarationMarker(node);
- case 316 /* EndOfDeclarationMarker */:
+ case 317 /* EndOfDeclarationMarker */:
return visitEndOfDeclarationMarker(node);
default:
return destructuringAndImportCallVisitor(node);
@@ -80558,7 +81400,7 @@
}
else if (ts.isIdentifier(node)) {
var container = resolver.getReferencedExportContainer(node);
- return container !== undefined && container.kind === 284 /* SourceFile */;
+ return container !== undefined && container.kind === 285 /* SourceFile */;
}
else {
return false;
@@ -80574,8 +81416,8 @@
*/
function modifierVisitor(node) {
switch (node.kind) {
- case 85 /* ExportKeyword */:
- case 80 /* DefaultKeyword */:
+ case 86 /* ExportKeyword */:
+ case 81 /* DefaultKeyword */:
return undefined;
}
return node;
@@ -80591,7 +81433,7 @@
* @param emitCallback A callback used to emit the node in the printer.
*/
function onEmitNode(hint, node, emitCallback) {
- if (node.kind === 284 /* SourceFile */) {
+ if (node.kind === 285 /* SourceFile */) {
var id = ts.getOriginalNodeId(node);
currentSourceFile = node;
moduleInfo = moduleInfoMap[id];
@@ -80639,7 +81481,7 @@
*/
function substituteUnspecified(node) {
switch (node.kind) {
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return substituteShorthandPropertyAssignment(node);
}
return node;
@@ -80673,12 +81515,12 @@
*/
function substituteExpression(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return substituteExpressionIdentifier(node);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return substituteBinaryExpression(node);
- case 202 /* PrefixUnaryExpression */:
- case 203 /* PostfixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return substituteUnaryExpression(node);
}
return node;
@@ -80771,14 +81613,14 @@
&& !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) {
var exportedNames = getExports(node.operand);
if (exportedNames) {
- var expression = node.kind === 203 /* PostfixUnaryExpression */
+ var expression = node.kind === 204 /* PostfixUnaryExpression */
? ts.setTextRange(ts.createPrefix(node.operator, node.operand), node)
: node;
for (var _i = 0, exportedNames_5 = exportedNames; _i < exportedNames_5.length; _i++) {
var exportName = exportedNames_5[_i];
expression = createExportExpression(exportName, preventSubstitution(expression));
}
- if (node.kind === 203 /* PostfixUnaryExpression */) {
+ if (node.kind === 204 /* PostfixUnaryExpression */) {
expression = node.operator === 44 /* PlusPlusToken */
? ts.createSubtract(preventSubstitution(expression), ts.createLiteral(1))
: ts.createAdd(preventSubstitution(expression), ts.createLiteral(1));
@@ -80800,7 +81642,7 @@
|| resolver.getReferencedValueDeclaration(name);
if (valueDeclaration) {
var exportContainer = resolver.getReferencedExportContainer(name, /*prefixLocals*/ false);
- if (exportContainer && exportContainer.kind === 284 /* SourceFile */) {
+ if (exportContainer && exportContainer.kind === 285 /* SourceFile */) {
exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration));
}
exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]);
@@ -80839,8 +81681,8 @@
var previousOnSubstituteNode = context.onSubstituteNode;
context.onEmitNode = onEmitNode;
context.onSubstituteNode = onSubstituteNode;
- context.enableEmitNotification(284 /* SourceFile */);
- context.enableSubstitution(72 /* Identifier */);
+ context.enableEmitNotification(285 /* SourceFile */);
+ context.enableSubstitution(73 /* Identifier */);
var currentSourceFile;
return ts.chainBundle(transformSourceFile);
function transformSourceFile(node) {
@@ -80868,10 +81710,10 @@
}
function visitor(node) {
switch (node.kind) {
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
// Elide `import=` as it is not legal with --module ES6
return undefined;
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return visitExportAssignment(node);
}
return node;
@@ -80979,7 +81821,7 @@
ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1;
}
- else if (node.parent.kind === 240 /* ClassDeclaration */) {
+ else if (node.parent.kind === 241 /* ClassDeclaration */) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -81008,7 +81850,7 @@
ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_private_name_1;
}
- else if (node.parent.kind === 240 /* ClassDeclaration */) {
+ else if (node.parent.kind === 241 /* ClassDeclaration */) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -81055,7 +81897,7 @@
return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: " + ts.SyntaxKind[node.kind]);
}
function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
- if (node.kind === 237 /* VariableDeclaration */ || node.kind === 186 /* BindingElement */) {
+ if (node.kind === 238 /* VariableDeclaration */ || node.kind === 187 /* BindingElement */) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -81064,8 +81906,8 @@
}
// This check is to ensure we don't report error on constructor parameter property as that error would be reported during parameter emit
// The only exception here is if the constructor was marked as private. we are not emitting the constructor parameters at all.
- else if (node.kind === 154 /* PropertyDeclaration */ || node.kind === 189 /* PropertyAccessExpression */ || node.kind === 153 /* PropertySignature */ ||
- (node.kind === 151 /* Parameter */ && ts.hasModifier(node.parent, 8 /* Private */))) {
+ else if (node.kind === 155 /* PropertyDeclaration */ || node.kind === 190 /* PropertyAccessExpression */ || node.kind === 154 /* PropertySignature */ ||
+ (node.kind === 152 /* Parameter */ && ts.hasModifier(node.parent, 8 /* Private */))) {
// TODO(jfreeman): Deal with computed properties in error reporting.
if (ts.hasModifier(node, 32 /* Static */)) {
return symbolAccessibilityResult.errorModuleName ?
@@ -81074,7 +81916,7 @@
ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1;
}
- else if (node.parent.kind === 240 /* ClassDeclaration */ || node.kind === 151 /* Parameter */) {
+ else if (node.parent.kind === 241 /* ClassDeclaration */ || node.kind === 152 /* Parameter */) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -81099,7 +81941,7 @@
}
function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) {
var diagnosticMessage;
- if (node.kind === 159 /* SetAccessor */) {
+ if (node.kind === 160 /* SetAccessor */) {
// Getters can infer the return type from the returned expression, but setters cannot, so the
// "_from_external_module_1_but_cannot_be_named" case cannot occur.
if (ts.hasModifier(node, 32 /* Static */)) {
@@ -81138,26 +81980,26 @@
function getReturnTypeVisibilityError(symbolAccessibilityResult) {
var diagnosticMessage;
switch (node.kind) {
- case 161 /* ConstructSignature */:
+ case 162 /* ConstructSignature */:
// Interfaces cannot have return types that cannot be named
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0;
break;
- case 160 /* CallSignature */:
+ case 161 /* CallSignature */:
// Interfaces cannot have return types that cannot be named
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0;
break;
- case 162 /* IndexSignature */:
+ case 163 /* IndexSignature */:
// Interfaces cannot have return types that cannot be named
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0;
break;
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
if (ts.hasModifier(node, 32 /* Static */)) {
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
@@ -81165,7 +82007,7 @@
ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 :
ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0;
}
- else if (node.parent.kind === 240 /* ClassDeclaration */) {
+ else if (node.parent.kind === 241 /* ClassDeclaration */) {
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
@@ -81179,7 +82021,7 @@
ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0;
}
break;
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
@@ -81204,30 +82046,30 @@
}
function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
switch (node.parent.kind) {
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1;
- case 161 /* ConstructSignature */:
- case 166 /* ConstructorType */:
+ case 162 /* ConstructSignature */:
+ case 167 /* ConstructorType */:
// Interfaces cannot have parameter types that cannot be named
return symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;
- case 160 /* CallSignature */:
+ case 161 /* CallSignature */:
// Interfaces cannot have parameter types that cannot be named
return symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;
- case 162 /* IndexSignature */:
+ case 163 /* IndexSignature */:
// Interfaces cannot have parameter types that cannot be named
return symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1;
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
if (ts.hasModifier(node.parent, 32 /* Static */)) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
@@ -81235,7 +82077,7 @@
ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1;
}
- else if (node.parent.parent.kind === 240 /* ClassDeclaration */) {
+ else if (node.parent.parent.kind === 241 /* ClassDeclaration */) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -81248,8 +82090,8 @@
ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1;
}
- case 239 /* FunctionDeclaration */:
- case 165 /* FunctionType */:
+ case 240 /* FunctionDeclaration */:
+ case 166 /* FunctionType */:
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -81263,39 +82105,39 @@
// Type parameter constraints are named by user so we should always be able to name it
var diagnosticMessage;
switch (node.parent.kind) {
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1;
break;
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1;
break;
- case 181 /* MappedType */:
+ case 182 /* MappedType */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1;
break;
- case 166 /* ConstructorType */:
- case 161 /* ConstructSignature */:
+ case 167 /* ConstructorType */:
+ case 162 /* ConstructSignature */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;
break;
- case 160 /* CallSignature */:
+ case 161 /* CallSignature */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;
break;
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
if (ts.hasModifier(node.parent, 32 /* Static */)) {
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1;
}
- else if (node.parent.parent.kind === 240 /* ClassDeclaration */) {
+ else if (node.parent.parent.kind === 241 /* ClassDeclaration */) {
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1;
}
else {
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1;
}
break;
- case 165 /* FunctionType */:
- case 239 /* FunctionDeclaration */:
+ case 166 /* FunctionType */:
+ case 240 /* FunctionDeclaration */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1;
break;
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1;
break;
default:
@@ -81310,9 +82152,9 @@
function getHeritageClauseVisibilityError() {
var diagnosticMessage;
// Heritage clause is written by user so it can always be named
- if (node.parent.parent.kind === 240 /* ClassDeclaration */) {
+ if (node.parent.parent.kind === 241 /* ClassDeclaration */) {
// Class or Interface implemented/extended is inaccessible
- diagnosticMessage = ts.isHeritageClause(node.parent) && node.parent.token === 109 /* ImplementsKeyword */ ?
+ diagnosticMessage = ts.isHeritageClause(node.parent) && node.parent.token === 110 /* ImplementsKeyword */ ?
ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 :
ts.Diagnostics.extends_clause_of_exported_class_0_has_or_is_using_private_name_1;
}
@@ -81361,7 +82203,7 @@
}
function isInternalDeclaration(node, currentSourceFile) {
var parseTreeNode = ts.getParseTreeNode(node);
- if (parseTreeNode && parseTreeNode.kind === 151 /* Parameter */) {
+ if (parseTreeNode && parseTreeNode.kind === 152 /* Parameter */) {
var paramIdx = parseTreeNode.parent.parameters.indexOf(parseTreeNode);
var previousSibling = paramIdx > 0 ? parseTreeNode.parent.parameters[paramIdx - 1] : undefined;
var text = currentSourceFile.text;
@@ -81508,10 +82350,10 @@
}
}
function transformRoot(node) {
- if (node.kind === 284 /* SourceFile */ && (node.isDeclarationFile || ts.isSourceFileJS(node))) {
+ if (node.kind === 285 /* SourceFile */ && (node.isDeclarationFile || ts.isSourceFileJS(node))) {
return node;
}
- if (node.kind === 285 /* Bundle */) {
+ if (node.kind === 286 /* Bundle */) {
isBundledEmit = true;
refs = ts.createMap();
libs = ts.createMap();
@@ -81534,14 +82376,14 @@
resultHasExternalModuleIndicator = false; // unused in external module bundle emit (all external modules are within module blocks, therefore are known to be modules)
needsDeclare = false;
var statements_4 = ts.visitNodes(sourceFile.statements, visitDeclarationStatements);
- var newFile = ts.updateSourceFileNode(sourceFile, [ts.createModuleDeclaration([], [ts.createModifier(125 /* DeclareKeyword */)], ts.createLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), ts.createModuleBlock(ts.setTextRange(ts.createNodeArray(transformAndReplaceLatePaintedStatements(statements_4)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []);
+ var newFile = ts.updateSourceFileNode(sourceFile, [ts.createModuleDeclaration([], [ts.createModifier(126 /* DeclareKeyword */)], ts.createLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), ts.createModuleBlock(ts.setTextRange(ts.createNodeArray(transformAndReplaceLatePaintedStatements(statements_4)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []);
return newFile;
}
needsDeclare = true;
var updated = ts.visitNodes(sourceFile.statements, visitDeclarationStatements);
return ts.updateSourceFileNode(sourceFile, transformAndReplaceLatePaintedStatements(updated), /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []);
}), ts.mapDefined(node.prepends, function (prepend) {
- if (prepend.kind === 287 /* InputFiles */) {
+ if (prepend.kind === 288 /* InputFiles */) {
var sourceFile = ts.createUnparsedSourceFile(prepend, "dts", stripInternal);
hasNoDefaultLib_1 = hasNoDefaultLib_1 || !!sourceFile.hasNoDefaultLib;
collectReferences(sourceFile, refs);
@@ -81661,11 +82503,11 @@
return ret;
}
function filterBindingPatternInitializers(name) {
- if (name.kind === 72 /* Identifier */) {
+ if (name.kind === 73 /* Identifier */) {
return name;
}
else {
- if (name.kind === 185 /* ArrayBindingPattern */) {
+ if (name.kind === 186 /* ArrayBindingPattern */) {
return ts.updateArrayBindingPattern(name, ts.visitNodes(name.elements, visitBindingElement));
}
else {
@@ -81673,7 +82515,7 @@
}
}
function visitBindingElement(elem) {
- if (elem.kind === 210 /* OmittedExpression */) {
+ if (elem.kind === 211 /* OmittedExpression */) {
return elem;
}
return ts.updateBindingElement(elem, elem.dotDotDotToken, elem.propertyName, filterBindingPatternInitializers(elem.name), shouldPrintWithInitializer(elem) ? elem.initializer : undefined);
@@ -81711,19 +82553,19 @@
// Literal const declarations will have an initializer ensured rather than a type
return;
}
- var shouldUseResolverType = node.kind === 151 /* Parameter */ &&
+ var shouldUseResolverType = node.kind === 152 /* Parameter */ &&
(resolver.isRequiredInitializedParameter(node) ||
resolver.isOptionalUninitializedParameterProperty(node));
if (type && !shouldUseResolverType) {
return ts.visitNode(type, visitDeclarationSubtree);
}
if (!ts.getParseTreeNode(node)) {
- return type ? ts.visitNode(type, visitDeclarationSubtree) : ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ return type ? ts.visitNode(type, visitDeclarationSubtree) : ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
- if (node.kind === 159 /* SetAccessor */) {
+ if (node.kind === 160 /* SetAccessor */) {
// Set accessors with no associated type node (from it's param or get accessor return) are `any` since they are never contextually typed right now
// (The inferred type here will be void, but the old declaration emitter printed `any`, so this replicates that)
- return ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ return ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
errorNameNode = node.name;
var oldDiag;
@@ -81731,12 +82573,12 @@
oldDiag = getSymbolAccessibilityDiagnostic;
getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(node);
}
- if (node.kind === 237 /* VariableDeclaration */ || node.kind === 186 /* BindingElement */) {
+ if (node.kind === 238 /* VariableDeclaration */ || node.kind === 187 /* BindingElement */) {
return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker));
}
- if (node.kind === 151 /* Parameter */
- || node.kind === 154 /* PropertyDeclaration */
- || node.kind === 153 /* PropertySignature */) {
+ if (node.kind === 152 /* Parameter */
+ || node.kind === 155 /* PropertyDeclaration */
+ || node.kind === 154 /* PropertySignature */) {
if (!node.initializer)
return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType));
return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType) || resolver.createTypeOfExpression(node.initializer, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker));
@@ -81747,26 +82589,26 @@
if (!suppressNewDiagnosticContexts) {
getSymbolAccessibilityDiagnostic = oldDiag;
}
- return returnValue || ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ return returnValue || ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
}
function isDeclarationAndNotVisible(node) {
node = ts.getParseTreeNode(node);
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 240 /* ClassDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 243 /* EnumDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 244 /* EnumDeclaration */:
return !resolver.isDeclarationVisible(node);
// The following should be doing their own visibility checks based on filtering their members
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return !getBindingNameVisible(node);
- case 248 /* ImportEqualsDeclaration */:
- case 249 /* ImportDeclaration */:
- case 255 /* ExportDeclaration */:
- case 254 /* ExportAssignment */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 256 /* ExportDeclaration */:
+ case 255 /* ExportAssignment */:
return false;
}
return false;
@@ -81820,7 +82662,7 @@
function rewriteModuleSpecifier(parent, input) {
if (!input)
return undefined; // TODO: GH#18217
- resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 244 /* ModuleDeclaration */ && parent.kind !== 183 /* ImportType */);
+ resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 245 /* ModuleDeclaration */ && parent.kind !== 184 /* ImportType */);
if (ts.isStringLiteralLike(input)) {
if (isBundledEmit) {
var newName = ts.getExternalModuleNameFromDeclaration(context.getEmitHost(), resolver, parent);
@@ -81840,7 +82682,7 @@
function transformImportEqualsDeclaration(decl) {
if (!resolver.isDeclarationVisible(decl))
return;
- if (decl.moduleReference.kind === 259 /* ExternalModuleReference */) {
+ if (decl.moduleReference.kind === 260 /* ExternalModuleReference */) {
// Rewrite external module names if necessary
var specifier = ts.getExternalModuleImportEqualsDeclarationExpression(decl);
return ts.updateImportEqualsDeclaration(decl,
@@ -81867,7 +82709,7 @@
return visibleDefaultBinding && ts.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, ts.updateImportClause(decl.importClause, visibleDefaultBinding,
/*namedBindings*/ undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier));
}
- if (decl.importClause.namedBindings.kind === 251 /* NamespaceImport */) {
+ if (decl.importClause.namedBindings.kind === 252 /* NamespaceImport */) {
// Namespace import (optionally with visible default)
var namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : /*namedBindings*/ undefined;
return visibleDefaultBinding || namedBindings ? ts.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, ts.updateImportClause(decl.importClause, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier)) : undefined;
@@ -81975,68 +82817,68 @@
checkEntityNameVisibility(input.exprName, enclosingDeclaration);
}
var oldWithinObjectLiteralType = suppressNewDiagnosticContexts;
- var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 168 /* TypeLiteral */ || input.kind === 181 /* MappedType */) && input.parent.kind !== 242 /* TypeAliasDeclaration */);
+ var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 169 /* TypeLiteral */ || input.kind === 182 /* MappedType */) && input.parent.kind !== 243 /* TypeAliasDeclaration */);
if (shouldEnterSuppressNewDiagnosticsContextContext) {
// We stop making new diagnostic contexts within object literal types. Unless it's an object type on the RHS of a type alias declaration. Then we do.
suppressNewDiagnosticContexts = true;
}
if (isProcessedComponent(input)) {
switch (input.kind) {
- case 211 /* ExpressionWithTypeArguments */: {
+ case 212 /* ExpressionWithTypeArguments */: {
if ((ts.isEntityName(input.expression) || ts.isEntityNameExpression(input.expression))) {
checkEntityNameVisibility(input.expression, enclosingDeclaration);
}
var node = ts.visitEachChild(input, visitDeclarationSubtree, context);
return cleanup(ts.updateExpressionWithTypeArguments(node, ts.parenthesizeTypeParameters(node.typeArguments), node.expression));
}
- case 164 /* TypeReference */: {
+ case 165 /* TypeReference */: {
checkEntityNameVisibility(input.typeName, enclosingDeclaration);
var node = ts.visitEachChild(input, visitDeclarationSubtree, context);
return cleanup(ts.updateTypeReferenceNode(node, node.typeName, ts.parenthesizeTypeParameters(node.typeArguments)));
}
- case 161 /* ConstructSignature */:
+ case 162 /* ConstructSignature */:
return cleanup(ts.updateConstructSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type)));
- case 157 /* Constructor */: {
+ case 158 /* Constructor */: {
var isPrivate = ts.hasModifier(input, 8 /* Private */);
// A constructor declaration may not have a type annotation
- var ctor = ts.createSignatureDeclaration(157 /* Constructor */, isPrivate ? undefined : ensureTypeParams(input, input.typeParameters),
+ var ctor = ts.createSignatureDeclaration(158 /* Constructor */, isPrivate ? undefined : ensureTypeParams(input, input.typeParameters),
// TODO: GH#18217
isPrivate ? undefined : updateParamsList(input, input.parameters, 0 /* None */),
/*type*/ undefined);
ctor.modifiers = ts.createNodeArray(ensureModifiers(input));
return cleanup(ctor);
}
- case 156 /* MethodDeclaration */: {
- var sig = ts.createSignatureDeclaration(155 /* MethodSignature */, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type));
+ case 157 /* MethodDeclaration */: {
+ var sig = ts.createSignatureDeclaration(156 /* MethodSignature */, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type));
sig.name = input.name;
sig.modifiers = ts.createNodeArray(ensureModifiers(input));
sig.questionToken = input.questionToken;
return cleanup(sig);
}
- case 158 /* GetAccessor */: {
+ case 159 /* GetAccessor */: {
var newNode = ensureAccessor(input);
return cleanup(newNode);
}
- case 159 /* SetAccessor */: {
+ case 160 /* SetAccessor */: {
var newNode = ensureAccessor(input);
return cleanup(newNode);
}
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return cleanup(ts.updateProperty(input,
/*decorators*/ undefined, ensureModifiers(input), input.name, input.questionToken, !ts.hasModifier(input, 8 /* Private */) ? ensureType(input, input.type) : undefined, ensureNoInitializer(input)));
- case 153 /* PropertySignature */:
+ case 154 /* PropertySignature */:
return cleanup(ts.updatePropertySignature(input, ensureModifiers(input), input.name, input.questionToken, !ts.hasModifier(input, 8 /* Private */) ? ensureType(input, input.type) : undefined, ensureNoInitializer(input)));
- case 155 /* MethodSignature */: {
+ case 156 /* MethodSignature */: {
return cleanup(ts.updateMethodSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type), input.name, input.questionToken));
}
- case 160 /* CallSignature */: {
+ case 161 /* CallSignature */: {
return cleanup(ts.updateCallSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type)));
}
- case 162 /* IndexSignature */: {
+ case 163 /* IndexSignature */: {
return cleanup(ts.updateIndexSignature(input,
- /*decorators*/ undefined, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || ts.createKeywordTypeNode(120 /* AnyKeyword */)));
+ /*decorators*/ undefined, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || ts.createKeywordTypeNode(121 /* AnyKeyword */)));
}
- case 237 /* VariableDeclaration */: {
+ case 238 /* VariableDeclaration */: {
if (ts.isBindingPattern(input.name)) {
return recreateBindingPattern(input.name);
}
@@ -82044,13 +82886,13 @@
suppressNewDiagnosticContexts = true; // Variable declaration types also suppress new diagnostic contexts, provided the contexts wouldn't be made for binding pattern types
return cleanup(ts.updateVariableDeclaration(input, input.name, ensureType(input, input.type), ensureNoInitializer(input)));
}
- case 150 /* TypeParameter */: {
+ case 151 /* TypeParameter */: {
if (isPrivateMethodTypeParameter(input) && (input.default || input.constraint)) {
return cleanup(ts.updateTypeParameterDeclaration(input, input.name, /*constraint*/ undefined, /*defaultType*/ undefined));
}
return cleanup(ts.visitEachChild(input, visitDeclarationSubtree, context));
}
- case 175 /* ConditionalType */: {
+ case 176 /* ConditionalType */: {
// We have to process conditional types in a special way because for visibility purposes we need to push a new enclosingDeclaration
// just for the `infer` types in the true branch. It's an implicit declaration scope that only applies to _part_ of the type.
var checkType = ts.visitNode(input.checkType, visitDeclarationSubtree);
@@ -82062,13 +82904,13 @@
var falseType = ts.visitNode(input.falseType, visitDeclarationSubtree);
return cleanup(ts.updateConditionalTypeNode(input, checkType, extendsType, trueType, falseType));
}
- case 165 /* FunctionType */: {
+ case 166 /* FunctionType */: {
return cleanup(ts.updateFunctionTypeNode(input, ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree)));
}
- case 166 /* ConstructorType */: {
+ case 167 /* ConstructorType */: {
return cleanup(ts.updateConstructorTypeNode(input, ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree)));
}
- case 183 /* ImportType */: {
+ case 184 /* ImportType */: {
if (!ts.isLiteralImportTypeNode(input))
return cleanup(input);
return cleanup(ts.updateImportTypeNode(input, ts.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)), input.qualifier, ts.visitNodes(input.typeArguments, visitDeclarationSubtree, ts.isTypeNode), input.isTypeOf));
@@ -82097,7 +82939,7 @@
}
}
function isPrivateMethodTypeParameter(node) {
- return node.parent.kind === 156 /* MethodDeclaration */ && ts.hasModifier(node.parent, 8 /* Private */);
+ return node.parent.kind === 157 /* MethodDeclaration */ && ts.hasModifier(node.parent, 8 /* Private */);
}
function visitDeclarationStatements(input) {
if (!isPreservedDeclarationStatement(input)) {
@@ -82107,7 +82949,7 @@
if (shouldStripInternal(input))
return;
switch (input.kind) {
- case 255 /* ExportDeclaration */: {
+ case 256 /* ExportDeclaration */: {
if (ts.isSourceFile(input.parent)) {
resultHasExternalModuleIndicator = true;
resultHasScopeMarker = true;
@@ -82116,13 +82958,13 @@
// Rewrite external module names if necessary
return ts.updateExportDeclaration(input, /*decorators*/ undefined, input.modifiers, input.exportClause, rewriteModuleSpecifier(input, input.moduleSpecifier));
}
- case 254 /* ExportAssignment */: {
+ case 255 /* ExportAssignment */: {
// Always visible if the parent node isn't dropped for being not visible
if (ts.isSourceFile(input.parent)) {
resultHasExternalModuleIndicator = true;
resultHasScopeMarker = true;
}
- if (input.expression.kind === 72 /* Identifier */) {
+ if (input.expression.kind === 73 /* Identifier */) {
return input;
}
else {
@@ -82132,7 +82974,7 @@
errorNode: input
}); };
var varDecl = ts.createVariableDeclaration(newId, resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined);
- var statement = ts.createVariableStatement(needsDeclare ? [ts.createModifier(125 /* DeclareKeyword */)] : [], ts.createVariableDeclarationList([varDecl], 2 /* Const */));
+ var statement = ts.createVariableStatement(needsDeclare ? [ts.createModifier(126 /* DeclareKeyword */)] : [], ts.createVariableDeclarationList([varDecl], 2 /* Const */));
return [statement, ts.updateExportAssignment(input, input.decorators, input.modifiers, newId)];
}
}
@@ -82146,10 +82988,10 @@
if (shouldStripInternal(input))
return;
switch (input.kind) {
- case 248 /* ImportEqualsDeclaration */: {
+ case 249 /* ImportEqualsDeclaration */: {
return transformImportEqualsDeclaration(input);
}
- case 249 /* ImportDeclaration */: {
+ case 250 /* ImportDeclaration */: {
return transformImportDeclaration(input);
}
}
@@ -82170,14 +83012,14 @@
}
var previousNeedsDeclare = needsDeclare;
switch (input.kind) {
- case 242 /* TypeAliasDeclaration */: // Type aliases get `declare`d if need be (for legacy support), but that's all
+ case 243 /* TypeAliasDeclaration */: // Type aliases get `declare`d if need be (for legacy support), but that's all
return cleanup(ts.updateTypeAliasDeclaration(input,
/*decorators*/ undefined, ensureModifiers(input, isPrivate), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode)));
- case 241 /* InterfaceDeclaration */: {
+ case 242 /* InterfaceDeclaration */: {
return cleanup(ts.updateInterfaceDeclaration(input,
/*decorators*/ undefined, ensureModifiers(input, isPrivate), input.name, ensureTypeParams(input, input.typeParameters), transformHeritageClauses(input.heritageClauses), ts.visitNodes(input.members, visitDeclarationSubtree)));
}
- case 239 /* FunctionDeclaration */: {
+ case 240 /* FunctionDeclaration */: {
// Generators lose their generator-ness, excepting their return type
var clean = cleanup(ts.updateFunctionDeclaration(input,
/*decorators*/ undefined, ensureModifiers(input, isPrivate),
@@ -82195,16 +83037,32 @@
return ts.createVariableStatement(/*modifiers*/ undefined, ts.createVariableDeclarationList([varDecl]));
});
var namespaceDecl = ts.createModuleDeclaration(/*decorators*/ undefined, ensureModifiers(input, isPrivate), input.name, ts.createModuleBlock(declarations), 16 /* Namespace */);
+ if (!ts.hasModifier(clean, 513 /* ExportDefault */)) {
return [clean, namespaceDecl];
}
+ var modifiers = ts.createModifiersFromModifierFlags((ts.getModifierFlags(clean) & ~513 /* ExportDefault */) | 2 /* Ambient */);
+ var cleanDeclaration = ts.updateFunctionDeclaration(clean,
+ /*decorators*/ undefined, modifiers,
+ /*asteriskToken*/ undefined, clean.name, clean.typeParameters, clean.parameters, clean.type,
+ /*body*/ undefined);
+ var namespaceDeclaration = ts.updateModuleDeclaration(namespaceDecl,
+ /*decorators*/ undefined, modifiers, namespaceDecl.name, namespaceDecl.body);
+ var exportDefaultDeclaration = ts.createExportAssignment(
+ /*decorators*/ undefined,
+ /*modifiers*/ undefined,
+ /*isExportEquals*/ false, namespaceDecl.name);
+ resultHasExternalModuleIndicator = true;
+ resultHasScopeMarker = true;
+ return [cleanDeclaration, namespaceDeclaration, exportDefaultDeclaration];
+ }
else {
return clean;
}
}
- case 244 /* ModuleDeclaration */: {
+ case 245 /* ModuleDeclaration */: {
needsDeclare = false;
var inner = input.body;
- if (inner && inner.kind === 245 /* ModuleBlock */) {
+ if (inner && inner.kind === 246 /* ModuleBlock */) {
var statements = ts.visitNodes(inner.statements, visitDeclarationStatements);
var body = ts.updateModuleBlock(inner, transformAndReplaceLatePaintedStatements(statements));
needsDeclare = previousNeedsDeclare;
@@ -82225,7 +83083,7 @@
/*decorators*/ undefined, mods, input.name, body));
}
}
- case 240 /* ClassDeclaration */: {
+ case 241 /* ClassDeclaration */: {
var modifiers = ts.createNodeArray(ensureModifiers(input, isPrivate));
var typeParameters = ensureTypeParams(input, input.typeParameters);
var ctor = ts.getFirstConstructorWithBody(input);
@@ -82236,7 +83094,7 @@
if (!ts.hasModifier(param, 92 /* ParameterPropertyModifier */) || shouldStripInternal(param))
return;
getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(param);
- if (param.name.kind === 72 /* Identifier */) {
+ if (param.name.kind === 73 /* Identifier */) {
return preserveJsDoc(ts.createProperty(
/*decorators*/ undefined, ensureModifiers(param), param.name, param.questionToken, ensureType(param, param.type), ensureNoInitializer(param)), param);
}
@@ -82266,7 +83124,7 @@
}
var members = ts.createNodeArray(ts.concatenate(parameterProperties, ts.visitNodes(input.members, visitDeclarationSubtree)));
var extendsClause_1 = ts.getEffectiveBaseTypeNode(input);
- if (extendsClause_1 && !ts.isEntityNameExpression(extendsClause_1.expression) && extendsClause_1.expression.kind !== 96 /* NullKeyword */) {
+ if (extendsClause_1 && !ts.isEntityNameExpression(extendsClause_1.expression) && extendsClause_1.expression.kind !== 97 /* NullKeyword */) {
// We must add a temporary declaration for the extends clause expression
var oldId = input.name ? ts.unescapeLeadingUnderscores(input.name.escapedText) : "default";
var newId_1 = ts.createOptimisticUniqueName(oldId + "_base");
@@ -82276,16 +83134,16 @@
typeName: input.name
}); };
var varDecl = ts.createVariableDeclaration(newId_1, resolver.createTypeOfExpression(extendsClause_1.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined);
- var statement = ts.createVariableStatement(needsDeclare ? [ts.createModifier(125 /* DeclareKeyword */)] : [], ts.createVariableDeclarationList([varDecl], 2 /* Const */));
+ var statement = ts.createVariableStatement(needsDeclare ? [ts.createModifier(126 /* DeclareKeyword */)] : [], ts.createVariableDeclarationList([varDecl], 2 /* Const */));
var heritageClauses = ts.createNodeArray(ts.map(input.heritageClauses, function (clause) {
- if (clause.token === 86 /* ExtendsKeyword */) {
+ if (clause.token === 87 /* ExtendsKeyword */) {
var oldDiag_2 = getSymbolAccessibilityDiagnostic;
getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(clause.types[0]);
var newClause = ts.updateHeritageClause(clause, ts.map(clause.types, function (t) { return ts.updateExpressionWithTypeArguments(t, ts.visitNodes(t.typeArguments, visitDeclarationSubtree), newId_1); }));
getSymbolAccessibilityDiagnostic = oldDiag_2;
return newClause;
}
- return ts.updateHeritageClause(clause, ts.visitNodes(ts.createNodeArray(ts.filter(clause.types, function (t) { return ts.isEntityNameExpression(t.expression) || t.expression.kind === 96 /* NullKeyword */; })), visitDeclarationSubtree));
+ return ts.updateHeritageClause(clause, ts.visitNodes(ts.createNodeArray(ts.filter(clause.types, function (t) { return ts.isEntityNameExpression(t.expression) || t.expression.kind === 97 /* NullKeyword */; })), visitDeclarationSubtree));
}));
return [statement, cleanup(ts.updateClassDeclaration(input,
/*decorators*/ undefined, modifiers, input.name, typeParameters, heritageClauses, members))]; // TODO: GH#18217
@@ -82296,10 +83154,10 @@
/*decorators*/ undefined, modifiers, input.name, typeParameters, heritageClauses, members));
}
}
- case 219 /* VariableStatement */: {
+ case 220 /* VariableStatement */: {
return cleanup(transformVariableStatement(input, isPrivate));
}
- case 243 /* EnumDeclaration */: {
+ case 244 /* EnumDeclaration */: {
return cleanup(ts.updateEnumDeclaration(input, /*decorators*/ undefined, ts.createNodeArray(ensureModifiers(input, isPrivate)), input.name, ts.createNodeArray(ts.mapDefined(input.members, function (m) {
if (shouldStripInternal(m))
return;
@@ -82318,7 +83176,7 @@
if (canProdiceDiagnostic) {
getSymbolAccessibilityDiagnostic = oldDiag;
}
- if (input.kind === 244 /* ModuleDeclaration */) {
+ if (input.kind === 245 /* ModuleDeclaration */) {
needsDeclare = previousNeedsDeclare;
}
if (node === input) {
@@ -82339,7 +83197,7 @@
return ts.flatten(ts.mapDefined(d.elements, function (e) { return recreateBindingElement(e); }));
}
function recreateBindingElement(e) {
- if (e.kind === 210 /* OmittedExpression */) {
+ if (e.kind === 211 /* OmittedExpression */) {
return;
}
if (e.name) {
@@ -82392,7 +83250,7 @@
function ensureModifierFlags(node, privateDeclaration) {
var mask = 3071 /* All */ ^ (4 /* Public */ | 256 /* Async */); // No async modifiers in declaration files
var additions = (needsDeclare && !isAlwaysType(node)) ? 2 /* Ambient */ : 0 /* None */;
- var parentIsFile = node.parent.kind === 284 /* SourceFile */;
+ var parentIsFile = node.parent.kind === 285 /* SourceFile */;
if (!parentIsFile || (isBundledEmit && parentIsFile && ts.isExternalModule(node.parent))) {
mask ^= ((privateDeclaration || (isBundledEmit && parentIsFile) || hasScopeMarker(node.parent) ? 0 : 1 /* Export */) | 2 /* Ambient */);
additions = 0 /* None */;
@@ -82413,7 +83271,7 @@
var prop = ts.createProperty(/*decorators*/ undefined, maskModifiers(node, /*mask*/ undefined, (!accessors.setAccessor) ? 64 /* Readonly */ : 0 /* None */), node.name, node.questionToken, ensureType(node, accessorType), /*initializer*/ undefined);
var leadingsSyntheticCommentRanges = accessors.secondAccessor && ts.getLeadingCommentRangesOfNode(accessors.secondAccessor, currentSourceFile);
if (leadingsSyntheticCommentRanges) {
- var _loop_10 = function (range) {
+ var _loop_13 = function (range) {
if (range.kind === 3 /* MultiLineCommentTrivia */) {
var text = currentSourceFile.text.slice(range.pos + 2, range.end - 2);
var lines = text.split(/\r\n?|\n/g);
@@ -82427,20 +83285,20 @@
};
for (var _i = 0, leadingsSyntheticCommentRanges_1 = leadingsSyntheticCommentRanges; _i < leadingsSyntheticCommentRanges_1.length; _i++) {
var range = leadingsSyntheticCommentRanges_1[_i];
- _loop_10(range);
+ _loop_13(range);
}
}
return prop;
}
function transformHeritageClauses(nodes) {
return ts.createNodeArray(ts.filter(ts.map(nodes, function (clause) { return ts.updateHeritageClause(clause, ts.visitNodes(ts.createNodeArray(ts.filter(clause.types, function (t) {
- return ts.isEntityNameExpression(t.expression) || (clause.token === 86 /* ExtendsKeyword */ && t.expression.kind === 96 /* NullKeyword */);
+ return ts.isEntityNameExpression(t.expression) || (clause.token === 87 /* ExtendsKeyword */ && t.expression.kind === 97 /* NullKeyword */);
})), visitDeclarationSubtree)); }), function (clause) { return clause.types && !!clause.types.length; }));
}
}
ts.transformDeclarations = transformDeclarations;
function isAlwaysType(node) {
- if (node.kind === 241 /* InterfaceDeclaration */) {
+ if (node.kind === 242 /* InterfaceDeclaration */) {
return true;
}
return false;
@@ -82465,7 +83323,7 @@
}
function getTypeAnnotationFromAccessor(accessor) {
if (accessor) {
- return accessor.kind === 158 /* GetAccessor */
+ return accessor.kind === 159 /* GetAccessor */
? accessor.type // Getter - return type
: accessor.parameters.length > 0
? accessor.parameters[0].type // Setter parameter type
@@ -82474,52 +83332,52 @@
}
function canHaveLiteralInitializer(node) {
switch (node.kind) {
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
return !ts.hasModifier(node, 8 /* Private */);
- case 151 /* Parameter */:
- case 237 /* VariableDeclaration */:
+ case 152 /* Parameter */:
+ case 238 /* VariableDeclaration */:
return true;
}
return false;
}
function isPreservedDeclarationStatement(node) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 240 /* ClassDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 243 /* EnumDeclaration */:
- case 219 /* VariableStatement */:
- case 249 /* ImportDeclaration */:
- case 255 /* ExportDeclaration */:
- case 254 /* ExportAssignment */:
+ case 240 /* FunctionDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 220 /* VariableStatement */:
+ case 250 /* ImportDeclaration */:
+ case 256 /* ExportDeclaration */:
+ case 255 /* ExportAssignment */:
return true;
}
return false;
}
function isProcessedComponent(node) {
switch (node.kind) {
- case 161 /* ConstructSignature */:
- case 157 /* Constructor */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 155 /* MethodSignature */:
- case 160 /* CallSignature */:
- case 162 /* IndexSignature */:
- case 237 /* VariableDeclaration */:
- case 150 /* TypeParameter */:
- case 211 /* ExpressionWithTypeArguments */:
- case 164 /* TypeReference */:
- case 175 /* ConditionalType */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 183 /* ImportType */:
+ case 162 /* ConstructSignature */:
+ case 158 /* Constructor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 156 /* MethodSignature */:
+ case 161 /* CallSignature */:
+ case 163 /* IndexSignature */:
+ case 238 /* VariableDeclaration */:
+ case 151 /* TypeParameter */:
+ case 212 /* ExpressionWithTypeArguments */:
+ case 165 /* TypeReference */:
+ case 176 /* ConditionalType */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 184 /* ImportType */:
return true;
}
return false;
@@ -82551,17 +83409,27 @@
SyntaxKindFeatureFlags[SyntaxKindFeatureFlags["Substitution"] = 1] = "Substitution";
SyntaxKindFeatureFlags[SyntaxKindFeatureFlags["EmitNotifications"] = 2] = "EmitNotifications";
})(SyntaxKindFeatureFlags || (SyntaxKindFeatureFlags = {}));
- function getTransformers(compilerOptions, customTransformers) {
+ ts.noTransformers = { scriptTransformers: ts.emptyArray, declarationTransformers: ts.emptyArray };
+ function getTransformers(compilerOptions, customTransformers, emitOnlyDtsFiles) {
+ return {
+ scriptTransformers: getScriptTransformers(compilerOptions, customTransformers, emitOnlyDtsFiles),
+ declarationTransformers: getDeclarationTransformers(customTransformers),
+ };
+ }
+ ts.getTransformers = getTransformers;
+ function getScriptTransformers(compilerOptions, customTransformers, emitOnlyDtsFiles) {
+ if (emitOnlyDtsFiles)
+ return ts.emptyArray;
var jsx = compilerOptions.jsx;
var languageVersion = ts.getEmitScriptTarget(compilerOptions);
var moduleKind = ts.getEmitModuleKind(compilerOptions);
var transformers = [];
- ts.addRange(transformers, customTransformers && customTransformers.before);
+ ts.addRange(transformers, customTransformers && ts.map(customTransformers.before, wrapScriptTransformerFactory));
transformers.push(ts.transformTypeScript);
if (jsx === 2 /* React */) {
transformers.push(ts.transformJsx);
}
- if (languageVersion < 7 /* ESNext */) {
+ if (languageVersion < 8 /* ESNext */) {
transformers.push(ts.transformESNext);
}
if (languageVersion < 6 /* ES2019 */) {
@@ -82586,10 +83454,38 @@
if (languageVersion < 1 /* ES5 */) {
transformers.push(ts.transformES5);
}
- ts.addRange(transformers, customTransformers && customTransformers.after);
+ ts.addRange(transformers, customTransformers && ts.map(customTransformers.after, wrapScriptTransformerFactory));
return transformers;
}
- ts.getTransformers = getTransformers;
+ function getDeclarationTransformers(customTransformers) {
+ var transformers = [];
+ transformers.push(ts.transformDeclarations);
+ ts.addRange(transformers, customTransformers && ts.map(customTransformers.afterDeclarations, wrapDeclarationTransformerFactory));
+ return transformers;
+ }
+ /**
+ * Wrap a custom script or declaration transformer object in a `Transformer` callback with fallback support for transforming bundles.
+ */
+ function wrapCustomTransformer(transformer) {
+ return function (node) { return ts.isBundle(node) ? transformer.transformBundle(node) : transformer.transformSourceFile(node); };
+ }
+ /**
+ * Wrap a transformer factory that may return a custom script or declaration transformer object.
+ */
+ function wrapCustomTransformerFactory(transformer, handleDefault) {
+ return function (context) {
+ var customTransformer = transformer(context);
+ return typeof customTransformer === "function"
+ ? handleDefault(customTransformer)
+ : wrapCustomTransformer(customTransformer);
+ };
+ }
+ function wrapScriptTransformerFactory(transformer) {
+ return wrapCustomTransformerFactory(transformer, ts.chainBundle);
+ }
+ function wrapDeclarationTransformerFactory(transformer) {
+ return wrapCustomTransformerFactory(transformer, ts.identity);
+ }
function noEmitSubstitution(_hint, node) {
return node;
}
@@ -82609,7 +83505,7 @@
* @param allowDtsFiles A value indicating whether to allow the transformation of .d.ts files.
*/
function transformNodes(resolver, host, options, nodes, transformers, allowDtsFiles) {
- var enabledSyntaxKindFeatures = new Array(317 /* Count */);
+ var enabledSyntaxKindFeatures = new Array(318 /* Count */);
var lexicalEnvironmentVariableDeclarations;
var lexicalEnvironmentFunctionDeclarations;
var lexicalEnvironmentVariableDeclarationsStack = [];
@@ -82662,7 +83558,14 @@
}
ts.performance.mark("beforeTransform");
// Chain together and initialize each transformer.
- var transformation = ts.chain.apply(void 0, transformers)(context);
+ var transformersWithContext = transformers.map(function (t) { return t(context); });
+ var transformation = function (node) {
+ for (var _i = 0, transformersWithContext_1 = transformersWithContext; _i < transformersWithContext_1.length; _i++) {
+ var transform = transformersWithContext_1[_i];
+ node = transform(node);
+ }
+ return node;
+ };
// prevent modification of transformation hooks.
state = 1 /* Initialized */;
// Transform each node.
@@ -82814,6 +83717,7 @@
if (lexicalEnvironmentVariableDeclarations) {
var statement = ts.createVariableStatement(
/*modifiers*/ undefined, ts.createVariableDeclarationList(lexicalEnvironmentVariableDeclarations));
+ ts.setEmitFlags(statement, 1048576 /* CustomPrologue */);
if (!statements) {
statements = [statement];
}
@@ -82921,7 +83825,7 @@
/*@internal*/
function getOutputPathForBuildInfo(options) {
var configFile = options.configFilePath;
- if (!configFile || !ts.isIncrementalCompilation(options))
+ if (!ts.isIncrementalCompilation(options))
return undefined;
if (options.tsBuildInfoFile)
return options.tsBuildInfoFile;
@@ -82931,6 +83835,8 @@
buildInfoExtensionLess = ts.removeFileExtension(outPath);
}
else {
+ if (!configFile)
+ return undefined;
var configFileExtensionLess = ts.removeFileExtension(configFile);
buildInfoExtensionLess = options.outDir ?
options.rootDir ?
@@ -82955,7 +83861,7 @@
/*@internal*/
function getOutputPathsFor(sourceFile, host, forceDtsPaths) {
var options = host.getCompilerOptions();
- if (sourceFile.kind === 285 /* Bundle */) {
+ if (sourceFile.kind === 286 /* Bundle */) {
return getOutputPathsForBundle(options, forceDtsPaths);
}
else {
@@ -83082,14 +83988,15 @@
ts.getFirstProjectOutput = getFirstProjectOutput;
/*@internal*/
// targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature
- function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles, transformers, declarationTransformers, onlyBuildInfo) {
+ function emitFiles(resolver, host, targetSourceFile, _a, emitOnlyDtsFiles, onlyBuildInfo) {
+ var scriptTransformers = _a.scriptTransformers, declarationTransformers = _a.declarationTransformers;
var compilerOptions = host.getCompilerOptions();
var sourceMapDataList = (compilerOptions.sourceMap || compilerOptions.inlineSourceMap || ts.getAreDeclarationMapsEnabled(compilerOptions)) ? [] : undefined;
var emittedFilesList = compilerOptions.listEmittedFiles ? [] : undefined;
var emitterDiagnostics = ts.createDiagnosticCollection();
var newLine = ts.getNewLineCharacter(compilerOptions, function () { return host.getNewLine(); });
var writer = ts.createTextWriter(newLine);
- var _a = ts.performance.createTimer("printTime", "beforePrint", "afterPrint"), enter = _a.enter, exit = _a.exit;
+ var _b = ts.performance.createTimer("printTime", "beforePrint", "afterPrint"), enter = _b.enter, exit = _b.exit;
var bundleBuildInfo;
var emitSkipped = false;
var exportedModulesFromDeclarationEmit;
@@ -83158,7 +84065,7 @@
return;
}
// Transform the source files
- var transform = ts.transformNodes(resolver, host, compilerOptions, [sourceFileOrBundle], transformers, /*allowDtsFiles*/ false);
+ var transform = ts.transformNodes(resolver, host, compilerOptions, [sourceFileOrBundle], scriptTransformers, /*allowDtsFiles*/ false);
var printerOptions = {
removeComments: compilerOptions.removeComments,
newLine: compilerOptions.newLine,
@@ -83199,7 +84106,7 @@
// Do that here when emitting only dts files
nonJsFiles.forEach(collectLinkedAliases);
}
- var declarationTransform = ts.transformNodes(resolver, host, compilerOptions, inputListOrBundle, ts.concatenate([ts.transformDeclarations], declarationTransformers), /*allowDtsFiles*/ false);
+ var declarationTransform = ts.transformNodes(resolver, host, compilerOptions, inputListOrBundle, declarationTransformers, /*allowDtsFiles*/ false);
if (ts.length(declarationTransform.diagnostics)) {
for (var _a = 0, _b = declarationTransform.diagnostics; _a < _b.length; _a++) {
var diagnostic = _b[_a];
@@ -83236,7 +84143,7 @@
mapRoot: compilerOptions.mapRoot,
extendedDiagnostics: compilerOptions.extendedDiagnostics,
});
- if (emitOnlyDtsFiles && declarationTransform.transformed[0].kind === 284 /* SourceFile */) {
+ if (emitOnlyDtsFiles && declarationTransform.transformed[0].kind === 285 /* SourceFile */) {
var sourceFile = declarationTransform.transformed[0];
exportedModulesFromDeclarationEmit = sourceFile.exportedModulesFromDeclarationEmit;
}
@@ -83247,7 +84154,7 @@
}
function collectLinkedAliases(node) {
if (ts.isExportAssignment(node)) {
- if (node.expression.kind === 72 /* Identifier */) {
+ if (node.expression.kind === 73 /* Identifier */) {
resolver.collectLinkedAliases(node.expression, /*setVisibility*/ true);
}
return;
@@ -83259,8 +84166,8 @@
ts.forEachChild(node, collectLinkedAliases);
}
function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, sourceFileOrBundle, printer, mapOptions) {
- var bundle = sourceFileOrBundle.kind === 285 /* Bundle */ ? sourceFileOrBundle : undefined;
- var sourceFile = sourceFileOrBundle.kind === 284 /* SourceFile */ ? sourceFileOrBundle : undefined;
+ var bundle = sourceFileOrBundle.kind === 286 /* Bundle */ ? sourceFileOrBundle : undefined;
+ var sourceFile = sourceFileOrBundle.kind === 285 /* SourceFile */ ? sourceFileOrBundle : undefined;
var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile];
var sourceMapGenerator;
if (shouldEmitSourceMaps(mapOptions, sourceFileOrBundle)) {
@@ -83301,7 +84208,7 @@
}
function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) {
return (mapOptions.sourceMap || mapOptions.inlineSourceMap)
- && (sourceFileOrBundle.kind !== 284 /* SourceFile */ || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Json */));
+ && (sourceFileOrBundle.kind !== 285 /* SourceFile */ || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Json */));
}
function getSourceRoot(mapOptions) {
// Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the
@@ -83411,7 +84318,7 @@
};
function createSourceFilesFromBundleBuildInfo(bundle) {
var sourceFiles = bundle.sourceFiles.map(function (fileName) {
- var sourceFile = ts.createNode(284 /* SourceFile */, 0, 0);
+ var sourceFile = ts.createNode(285 /* SourceFile */, 0, 0);
sourceFile.fileName = fileName;
sourceFile.text = "";
sourceFile.statements = ts.createNodeArray();
@@ -83423,7 +84330,7 @@
sourceFile.text = prologueInfo.text;
sourceFile.end = prologueInfo.text.length;
sourceFile.statements = ts.createNodeArray(prologueInfo.directives.map(function (directive) {
- var statement = ts.createNode(221 /* ExpressionStatement */, directive.pos, directive.end);
+ var statement = ts.createNode(222 /* ExpressionStatement */, directive.pos, directive.end);
statement.expression = ts.createNode(10 /* StringLiteral */, directive.expression.pos, directive.expression.end);
statement.expression.text = directive.expression.text;
return statement;
@@ -83515,7 +84422,7 @@
useCaseSensitiveFileNames: function () { return host.useCaseSensitiveFileNames(); },
getProgramBuildInfo: ts.returnUndefined
};
- emitFiles(ts.notImplementedResolver, emitHost, /*targetSourceFile*/ undefined, /*emitOnlyDtsFiles*/ false, ts.getTransformers(config.options));
+ emitFiles(ts.notImplementedResolver, emitHost, /*targetSourceFile*/ undefined, ts.getTransformers(config.options), /*emitOnlyDtsFiles*/ false);
return outputFiles;
}
ts.emitUsingBuildInfo = emitUsingBuildInfo;
@@ -83592,9 +84499,9 @@
break;
}
switch (node.kind) {
- case 284 /* SourceFile */: return printFile(node);
- case 285 /* Bundle */: return printBundle(node);
- case 286 /* UnparsedSource */: return printUnparsedSource(node);
+ case 285 /* SourceFile */: return printFile(node);
+ case 286 /* Bundle */: return printBundle(node);
+ case 287 /* UnparsedSource */: return printUnparsedSource(node);
}
writeNode(hint, node, sourceFile, beginPrint());
return endPrint();
@@ -83824,12 +84731,12 @@
}
// falls through
case 2 /* Comments */:
- if (!commentsDisabled && node.kind !== 284 /* SourceFile */) {
+ if (!commentsDisabled && node.kind !== 285 /* SourceFile */) {
return pipelineEmitWithComments;
}
// falls through
case 3 /* SourceMaps */:
- if (!sourceMapsDisabled && node.kind !== 284 /* SourceFile */ && !ts.isInJsonFile(node)) {
+ if (!sourceMapsDisabled && node.kind !== 285 /* SourceFile */ && !ts.isInJsonFile(node)) {
return pipelineEmitWithSourceMap;
}
// falls through
@@ -83866,272 +84773,272 @@
case 16 /* TemplateMiddle */:
case 17 /* TemplateTail */:
return emitLiteral(node);
- case 286 /* UnparsedSource */:
- case 280 /* UnparsedPrepend */:
+ case 287 /* UnparsedSource */:
+ case 281 /* UnparsedPrepend */:
return emitUnparsedSourceOrPrepend(node);
- case 279 /* UnparsedPrologue */:
+ case 280 /* UnparsedPrologue */:
return writeUnparsedNode(node);
- case 281 /* UnparsedText */:
- case 282 /* UnparsedInternalText */:
+ case 282 /* UnparsedText */:
+ case 283 /* UnparsedInternalText */:
return emitUnparsedTextLike(node);
- case 283 /* UnparsedSyntheticReference */:
+ case 284 /* UnparsedSyntheticReference */:
return emitUnparsedSyntheticReference(node);
// Identifiers
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return emitIdentifier(node);
// Parse tree nodes
// Names
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
return emitQualifiedName(node);
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
return emitComputedPropertyName(node);
// Signature elements
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
return emitTypeParameter(node);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return emitParameter(node);
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
return emitDecorator(node);
// Type members
- case 153 /* PropertySignature */:
+ case 154 /* PropertySignature */:
return emitPropertySignature(node);
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return emitPropertyDeclaration(node);
- case 155 /* MethodSignature */:
+ case 156 /* MethodSignature */:
return emitMethodSignature(node);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return emitMethodDeclaration(node);
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return emitConstructor(node);
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return emitAccessorDeclaration(node);
- case 160 /* CallSignature */:
+ case 161 /* CallSignature */:
return emitCallSignature(node);
- case 161 /* ConstructSignature */:
+ case 162 /* ConstructSignature */:
return emitConstructSignature(node);
- case 162 /* IndexSignature */:
+ case 163 /* IndexSignature */:
return emitIndexSignature(node);
// Types
- case 163 /* TypePredicate */:
+ case 164 /* TypePredicate */:
return emitTypePredicate(node);
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return emitTypeReference(node);
- case 165 /* FunctionType */:
+ case 166 /* FunctionType */:
return emitFunctionType(node);
- case 294 /* JSDocFunctionType */:
+ case 295 /* JSDocFunctionType */:
return emitJSDocFunctionType(node);
- case 166 /* ConstructorType */:
+ case 167 /* ConstructorType */:
return emitConstructorType(node);
- case 167 /* TypeQuery */:
+ case 168 /* TypeQuery */:
return emitTypeQuery(node);
- case 168 /* TypeLiteral */:
+ case 169 /* TypeLiteral */:
return emitTypeLiteral(node);
- case 169 /* ArrayType */:
+ case 170 /* ArrayType */:
return emitArrayType(node);
- case 170 /* TupleType */:
+ case 171 /* TupleType */:
return emitTupleType(node);
- case 171 /* OptionalType */:
+ case 172 /* OptionalType */:
return emitOptionalType(node);
- case 173 /* UnionType */:
+ case 174 /* UnionType */:
return emitUnionType(node);
- case 174 /* IntersectionType */:
+ case 175 /* IntersectionType */:
return emitIntersectionType(node);
- case 175 /* ConditionalType */:
+ case 176 /* ConditionalType */:
return emitConditionalType(node);
- case 176 /* InferType */:
+ case 177 /* InferType */:
return emitInferType(node);
- case 177 /* ParenthesizedType */:
+ case 178 /* ParenthesizedType */:
return emitParenthesizedType(node);
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return emitExpressionWithTypeArguments(node);
- case 178 /* ThisType */:
+ case 179 /* ThisType */:
return emitThisType();
- case 179 /* TypeOperator */:
+ case 180 /* TypeOperator */:
return emitTypeOperator(node);
- case 180 /* IndexedAccessType */:
+ case 181 /* IndexedAccessType */:
return emitIndexedAccessType(node);
- case 181 /* MappedType */:
+ case 182 /* MappedType */:
return emitMappedType(node);
- case 182 /* LiteralType */:
+ case 183 /* LiteralType */:
return emitLiteralType(node);
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return emitImportTypeNode(node);
- case 289 /* JSDocAllType */:
+ case 290 /* JSDocAllType */:
writePunctuation("*");
return;
- case 290 /* JSDocUnknownType */:
+ case 291 /* JSDocUnknownType */:
writePunctuation("?");
return;
- case 291 /* JSDocNullableType */:
+ case 292 /* JSDocNullableType */:
return emitJSDocNullableType(node);
- case 292 /* JSDocNonNullableType */:
+ case 293 /* JSDocNonNullableType */:
return emitJSDocNonNullableType(node);
- case 293 /* JSDocOptionalType */:
+ case 294 /* JSDocOptionalType */:
return emitJSDocOptionalType(node);
- case 172 /* RestType */:
- case 295 /* JSDocVariadicType */:
+ case 173 /* RestType */:
+ case 296 /* JSDocVariadicType */:
return emitRestOrJSDocVariadicType(node);
// Binding patterns
- case 184 /* ObjectBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
return emitObjectBindingPattern(node);
- case 185 /* ArrayBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
return emitArrayBindingPattern(node);
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return emitBindingElement(node);
// Misc
- case 216 /* TemplateSpan */:
+ case 217 /* TemplateSpan */:
return emitTemplateSpan(node);
- case 217 /* SemicolonClassElement */:
+ case 218 /* SemicolonClassElement */:
return emitSemicolonClassElement();
// Statements
- case 218 /* Block */:
+ case 219 /* Block */:
return emitBlock(node);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return emitVariableStatement(node);
- case 220 /* EmptyStatement */:
+ case 221 /* EmptyStatement */:
return emitEmptyStatement(/*isEmbeddedStatement*/ false);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return emitExpressionStatement(node);
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
return emitIfStatement(node);
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
return emitDoStatement(node);
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
return emitWhileStatement(node);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return emitForStatement(node);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return emitForInStatement(node);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return emitForOfStatement(node);
- case 228 /* ContinueStatement */:
+ case 229 /* ContinueStatement */:
return emitContinueStatement(node);
- case 229 /* BreakStatement */:
+ case 230 /* BreakStatement */:
return emitBreakStatement(node);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return emitReturnStatement(node);
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
return emitWithStatement(node);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return emitSwitchStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return emitLabeledStatement(node);
- case 234 /* ThrowStatement */:
+ case 235 /* ThrowStatement */:
return emitThrowStatement(node);
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
return emitTryStatement(node);
- case 236 /* DebuggerStatement */:
+ case 237 /* DebuggerStatement */:
return emitDebuggerStatement(node);
// Declarations
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return emitVariableDeclaration(node);
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
return emitVariableDeclarationList(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return emitFunctionDeclaration(node);
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return emitClassDeclaration(node);
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
return emitInterfaceDeclaration(node);
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return emitTypeAliasDeclaration(node);
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return emitEnumDeclaration(node);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return emitModuleDeclaration(node);
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
return emitModuleBlock(node);
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
return emitCaseBlock(node);
- case 247 /* NamespaceExportDeclaration */:
+ case 248 /* NamespaceExportDeclaration */:
return emitNamespaceExportDeclaration(node);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return emitImportEqualsDeclaration(node);
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return emitImportDeclaration(node);
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
return emitImportClause(node);
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
return emitNamespaceImport(node);
- case 252 /* NamedImports */:
+ case 253 /* NamedImports */:
return emitNamedImports(node);
- case 253 /* ImportSpecifier */:
+ case 254 /* ImportSpecifier */:
return emitImportSpecifier(node);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return emitExportAssignment(node);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return emitExportDeclaration(node);
- case 256 /* NamedExports */:
+ case 257 /* NamedExports */:
return emitNamedExports(node);
- case 257 /* ExportSpecifier */:
+ case 258 /* ExportSpecifier */:
return emitExportSpecifier(node);
- case 258 /* MissingDeclaration */:
+ case 259 /* MissingDeclaration */:
return;
// Module references
- case 259 /* ExternalModuleReference */:
+ case 260 /* ExternalModuleReference */:
return emitExternalModuleReference(node);
// JSX (non-expression)
case 11 /* JsxText */:
return emitJsxText(node);
- case 262 /* JsxOpeningElement */:
- case 265 /* JsxOpeningFragment */:
+ case 263 /* JsxOpeningElement */:
+ case 266 /* JsxOpeningFragment */:
return emitJsxOpeningElementOrFragment(node);
- case 263 /* JsxClosingElement */:
- case 266 /* JsxClosingFragment */:
+ case 264 /* JsxClosingElement */:
+ case 267 /* JsxClosingFragment */:
return emitJsxClosingElementOrFragment(node);
- case 267 /* JsxAttribute */:
+ case 268 /* JsxAttribute */:
return emitJsxAttribute(node);
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
return emitJsxAttributes(node);
- case 269 /* JsxSpreadAttribute */:
+ case 270 /* JsxSpreadAttribute */:
return emitJsxSpreadAttribute(node);
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return emitJsxExpression(node);
// Clauses
- case 271 /* CaseClause */:
+ case 272 /* CaseClause */:
return emitCaseClause(node);
- case 272 /* DefaultClause */:
+ case 273 /* DefaultClause */:
return emitDefaultClause(node);
- case 273 /* HeritageClause */:
+ case 274 /* HeritageClause */:
return emitHeritageClause(node);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return emitCatchClause(node);
// Property assignments
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return emitPropertyAssignment(node);
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return emitShorthandPropertyAssignment(node);
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
return emitSpreadAssignment(node);
// Enum
- case 278 /* EnumMember */:
+ case 279 /* EnumMember */:
return emitEnumMember(node);
// JSDoc nodes (only used in codefixes currently)
- case 304 /* JSDocParameterTag */:
- case 310 /* JSDocPropertyTag */:
+ case 305 /* JSDocParameterTag */:
+ case 311 /* JSDocPropertyTag */:
return emitJSDocPropertyLikeTag(node);
- case 305 /* JSDocReturnTag */:
- case 307 /* JSDocTypeTag */:
- case 306 /* JSDocThisTag */:
- case 303 /* JSDocEnumTag */:
+ case 306 /* JSDocReturnTag */:
+ case 308 /* JSDocTypeTag */:
+ case 307 /* JSDocThisTag */:
+ case 304 /* JSDocEnumTag */:
return emitJSDocSimpleTypedTag(node);
- case 300 /* JSDocAugmentsTag */:
+ case 301 /* JSDocAugmentsTag */:
return emitJSDocAugmentsTag(node);
- case 308 /* JSDocTemplateTag */:
+ case 309 /* JSDocTemplateTag */:
return emitJSDocTemplateTag(node);
- case 309 /* JSDocTypedefTag */:
+ case 310 /* JSDocTypedefTag */:
return emitJSDocTypedefTag(node);
- case 302 /* JSDocCallbackTag */:
+ case 303 /* JSDocCallbackTag */:
return emitJSDocCallbackTag(node);
- case 298 /* JSDocSignature */:
+ case 299 /* JSDocSignature */:
return emitJSDocSignature(node);
- case 297 /* JSDocTypeLiteral */:
+ case 298 /* JSDocTypeLiteral */:
return emitJSDocTypeLiteral(node);
- case 301 /* JSDocClassTag */:
- case 299 /* JSDocTag */:
+ case 302 /* JSDocClassTag */:
+ case 300 /* JSDocTag */:
return emitJSDocSimpleTag(node);
- case 296 /* JSDocComment */:
+ case 297 /* JSDocComment */:
return emitJSDoc(node);
// Transformation nodes (ignored)
}
@@ -84156,83 +85063,83 @@
case 14 /* NoSubstitutionTemplateLiteral */:
return emitLiteral(node);
// Identifiers
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return emitIdentifier(node);
// Reserved words
- case 87 /* FalseKeyword */:
- case 96 /* NullKeyword */:
- case 98 /* SuperKeyword */:
- case 102 /* TrueKeyword */:
- case 100 /* ThisKeyword */:
- case 92 /* ImportKeyword */:
+ case 88 /* FalseKeyword */:
+ case 97 /* NullKeyword */:
+ case 99 /* SuperKeyword */:
+ case 103 /* TrueKeyword */:
+ case 101 /* ThisKeyword */:
+ case 93 /* ImportKeyword */:
writeTokenNode(node, writeKeyword);
return;
// Expressions
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return emitArrayLiteralExpression(node);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return emitObjectLiteralExpression(node);
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return emitPropertyAccessExpression(node);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return emitElementAccessExpression(node);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return emitCallExpression(node);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return emitNewExpression(node);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return emitTaggedTemplateExpression(node);
- case 194 /* TypeAssertionExpression */:
+ case 195 /* TypeAssertionExpression */:
return emitTypeAssertionExpression(node);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return emitParenthesizedExpression(node);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return emitFunctionExpression(node);
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return emitArrowFunction(node);
- case 198 /* DeleteExpression */:
+ case 199 /* DeleteExpression */:
return emitDeleteExpression(node);
- case 199 /* TypeOfExpression */:
+ case 200 /* TypeOfExpression */:
return emitTypeOfExpression(node);
- case 200 /* VoidExpression */:
+ case 201 /* VoidExpression */:
return emitVoidExpression(node);
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
return emitAwaitExpression(node);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return emitPrefixUnaryExpression(node);
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return emitPostfixUnaryExpression(node);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return emitBinaryExpression(node);
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return emitConditionalExpression(node);
- case 206 /* TemplateExpression */:
+ case 207 /* TemplateExpression */:
return emitTemplateExpression(node);
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return emitYieldExpression(node);
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
return emitSpreadExpression(node);
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
return emitClassExpression(node);
- case 210 /* OmittedExpression */:
+ case 211 /* OmittedExpression */:
return;
- case 212 /* AsExpression */:
+ case 213 /* AsExpression */:
return emitAsExpression(node);
- case 213 /* NonNullExpression */:
+ case 214 /* NonNullExpression */:
return emitNonNullExpression(node);
- case 214 /* MetaProperty */:
+ case 215 /* MetaProperty */:
return emitMetaProperty(node);
// JSX
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
return emitJsxElement(node);
- case 261 /* JsxSelfClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
return emitJsxSelfClosingElement(node);
- case 264 /* JsxFragment */:
+ case 265 /* JsxFragment */:
return emitJsxFragment(node);
// Transformation nodes
- case 313 /* PartiallyEmittedExpression */:
+ case 314 /* PartiallyEmittedExpression */:
return emitPartiallyEmittedExpression(node);
- case 314 /* CommaListExpression */:
+ case 315 /* CommaListExpression */:
return emitCommaList(node);
}
}
@@ -84272,7 +85179,7 @@
}
function emitHelpers(node) {
var helpersEmitted = false;
- var bundle = node.kind === 285 /* Bundle */ ? node : undefined;
+ var bundle = node.kind === 286 /* Bundle */ ? node : undefined;
if (bundle && moduleKind === ts.ModuleKind.None) {
return;
}
@@ -84372,7 +85279,7 @@
var pos = getTextPosWithWriteLine();
writeUnparsedNode(unparsed);
if (bundleFileInfo) {
- updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 281 /* UnparsedText */ ?
+ updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 282 /* UnparsedText */ ?
"text" /* Text */ :
"internal" /* Internal */);
}
@@ -84405,7 +85312,7 @@
emit(node.right);
}
function emitEntityName(node) {
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
emitExpression(node);
}
else {
@@ -84441,7 +85348,7 @@
emit(node.dotDotDotToken);
emitNodeWithWriter(node.name, writeParameter);
emit(node.questionToken);
- if (node.parent && node.parent.kind === 294 /* JSDocFunctionType */ && !node.name) {
+ if (node.parent && node.parent.kind === 295 /* JSDocFunctionType */ && !node.name) {
emit(node.type);
}
else {
@@ -84503,7 +85410,7 @@
function emitAccessorDeclaration(node) {
emitDecorators(node, node.decorators);
emitModifiers(node, node.modifiers);
- writeKeyword(node.kind === 158 /* GetAccessor */ ? "get" : "set");
+ writeKeyword(node.kind === 159 /* GetAccessor */ ? "get" : "set");
writeSpace();
emit(node.name);
emitSignatureAndBody(node, emitSignatureHead);
@@ -84680,7 +85587,7 @@
}
if (node.readonlyToken) {
emit(node.readonlyToken);
- if (node.readonlyToken.kind !== 133 /* ReadonlyKeyword */) {
+ if (node.readonlyToken.kind !== 134 /* ReadonlyKeyword */) {
writeKeyword("readonly");
}
writeSpace();
@@ -84830,7 +85737,7 @@
emitExpressionList(node, node.arguments, 2576 /* CallExpressionArguments */);
}
function emitNewExpression(node) {
- emitTokenWithComment(95 /* NewKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(96 /* NewKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
emitTypeArguments(node, node.typeArguments);
@@ -84870,22 +85777,22 @@
emit(node.equalsGreaterThanToken);
}
function emitDeleteExpression(node) {
- emitTokenWithComment(81 /* DeleteKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(82 /* DeleteKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
}
function emitTypeOfExpression(node) {
- emitTokenWithComment(104 /* TypeOfKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(105 /* TypeOfKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
}
function emitVoidExpression(node) {
- emitTokenWithComment(106 /* VoidKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(107 /* VoidKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
}
function emitAwaitExpression(node) {
- emitTokenWithComment(122 /* AwaitKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(123 /* AwaitKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
}
@@ -84910,7 +85817,7 @@
// expression a prefix increment whose operand is a plus expression - (++(+x))
// The same is true of minus of course.
var operand = node.operand;
- return operand.kind === 202 /* PrefixUnaryExpression */
+ return operand.kind === 203 /* PrefixUnaryExpression */
&& ((node.operator === 38 /* PlusToken */ && (operand.operator === 38 /* PlusToken */ || operand.operator === 44 /* PlusPlusToken */))
|| (node.operator === 39 /* MinusToken */ && (operand.operator === 39 /* MinusToken */ || operand.operator === 45 /* MinusMinusToken */)));
}
@@ -84925,7 +85832,7 @@
emitExpression(node.left);
increaseIndentIf(indentBeforeOperator, isCommaOperator);
emitLeadingCommentsOfPosition(node.operatorToken.pos);
- writeTokenNode(node.operatorToken, node.operatorToken.kind === 93 /* InKeyword */ ? writeKeyword : writeOperator);
+ writeTokenNode(node.operatorToken, node.operatorToken.kind === 94 /* InKeyword */ ? writeKeyword : writeOperator);
emitTrailingCommentsOfPosition(node.operatorToken.end, /*prefixSpace*/ true); // Binary operators should have a space before the comment starts
increaseIndentIf(indentAfterOperator, /*writeSpaceIfNotIndenting*/ true);
emitExpression(node.right);
@@ -84953,7 +85860,7 @@
emitList(node, node.templateSpans, 262144 /* TemplateExpressionSpans */);
}
function emitYieldExpression(node) {
- emitTokenWithComment(117 /* YieldKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(118 /* YieldKeyword */, node.pos, writeKeyword, node);
emit(node.asteriskToken);
emitExpressionWithLeadingSpace(node.expression);
}
@@ -85030,7 +85937,7 @@
}
}
function emitIfStatement(node) {
- var openParenPos = emitTokenWithComment(91 /* IfKeyword */, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(92 /* IfKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
emitExpression(node.expression);
@@ -85038,8 +85945,8 @@
emitEmbeddedStatement(node, node.thenStatement);
if (node.elseStatement) {
writeLineOrSpace(node);
- emitTokenWithComment(83 /* ElseKeyword */, node.thenStatement.end, writeKeyword, node);
- if (node.elseStatement.kind === 222 /* IfStatement */) {
+ emitTokenWithComment(84 /* ElseKeyword */, node.thenStatement.end, writeKeyword, node);
+ if (node.elseStatement.kind === 223 /* IfStatement */) {
writeSpace();
emit(node.elseStatement);
}
@@ -85049,14 +85956,14 @@
}
}
function emitWhileClause(node, startPos) {
- var openParenPos = emitTokenWithComment(107 /* WhileKeyword */, startPos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(108 /* WhileKeyword */, startPos, writeKeyword, node);
writeSpace();
emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
emitExpression(node.expression);
emitTokenWithComment(21 /* CloseParenToken */, node.expression.end, writePunctuation, node);
}
function emitDoStatement(node) {
- emitTokenWithComment(82 /* DoKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(83 /* DoKeyword */, node.pos, writeKeyword, node);
emitEmbeddedStatement(node, node.statement);
if (ts.isBlock(node.statement)) {
writeSpace();
@@ -85072,7 +85979,7 @@
emitEmbeddedStatement(node, node.statement);
}
function emitForStatement(node) {
- var openParenPos = emitTokenWithComment(89 /* ForKeyword */, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(90 /* ForKeyword */, node.pos, writeKeyword, node);
writeSpace();
var pos = emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, /*contextNode*/ node);
emitForBinding(node.initializer);
@@ -85084,25 +85991,25 @@
emitEmbeddedStatement(node, node.statement);
}
function emitForInStatement(node) {
- var openParenPos = emitTokenWithComment(89 /* ForKeyword */, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(90 /* ForKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
emitForBinding(node.initializer);
writeSpace();
- emitTokenWithComment(93 /* InKeyword */, node.initializer.end, writeKeyword, node);
+ emitTokenWithComment(94 /* InKeyword */, node.initializer.end, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
emitTokenWithComment(21 /* CloseParenToken */, node.expression.end, writePunctuation, node);
emitEmbeddedStatement(node, node.statement);
}
function emitForOfStatement(node) {
- var openParenPos = emitTokenWithComment(89 /* ForKeyword */, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(90 /* ForKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitWithTrailingSpace(node.awaitModifier);
emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
emitForBinding(node.initializer);
writeSpace();
- emitTokenWithComment(147 /* OfKeyword */, node.initializer.end, writeKeyword, node);
+ emitTokenWithComment(148 /* OfKeyword */, node.initializer.end, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
emitTokenWithComment(21 /* CloseParenToken */, node.expression.end, writePunctuation, node);
@@ -85110,7 +86017,7 @@
}
function emitForBinding(node) {
if (node !== undefined) {
- if (node.kind === 238 /* VariableDeclarationList */) {
+ if (node.kind === 239 /* VariableDeclarationList */) {
emit(node);
}
else {
@@ -85119,12 +86026,12 @@
}
}
function emitContinueStatement(node) {
- emitTokenWithComment(78 /* ContinueKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(79 /* ContinueKeyword */, node.pos, writeKeyword, node);
emitWithLeadingSpace(node.label);
writeTrailingSemicolon();
}
function emitBreakStatement(node) {
- emitTokenWithComment(73 /* BreakKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(74 /* BreakKeyword */, node.pos, writeKeyword, node);
emitWithLeadingSpace(node.label);
writeTrailingSemicolon();
}
@@ -85152,12 +86059,12 @@
return pos;
}
function emitReturnStatement(node) {
- emitTokenWithComment(97 /* ReturnKeyword */, node.pos, writeKeyword, /*contextNode*/ node);
+ emitTokenWithComment(98 /* ReturnKeyword */, node.pos, writeKeyword, /*contextNode*/ node);
emitExpressionWithLeadingSpace(node.expression);
writeTrailingSemicolon();
}
function emitWithStatement(node) {
- var openParenPos = emitTokenWithComment(108 /* WithKeyword */, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(109 /* WithKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
emitExpression(node.expression);
@@ -85165,7 +86072,7 @@
emitEmbeddedStatement(node, node.statement);
}
function emitSwitchStatement(node) {
- var openParenPos = emitTokenWithComment(99 /* SwitchKeyword */, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(100 /* SwitchKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
emitExpression(node.expression);
@@ -85180,12 +86087,12 @@
emit(node.statement);
}
function emitThrowStatement(node) {
- emitTokenWithComment(101 /* ThrowKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(102 /* ThrowKeyword */, node.pos, writeKeyword, node);
emitExpressionWithLeadingSpace(node.expression);
writeTrailingSemicolon();
}
function emitTryStatement(node) {
- emitTokenWithComment(103 /* TryKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(104 /* TryKeyword */, node.pos, writeKeyword, node);
writeSpace();
emit(node.tryBlock);
if (node.catchClause) {
@@ -85194,13 +86101,13 @@
}
if (node.finallyBlock) {
writeLineOrSpace(node);
- emitTokenWithComment(88 /* FinallyKeyword */, (node.catchClause || node.tryBlock).end, writeKeyword, node);
+ emitTokenWithComment(89 /* FinallyKeyword */, (node.catchClause || node.tryBlock).end, writeKeyword, node);
writeSpace();
emit(node.finallyBlock);
}
}
function emitDebuggerStatement(node) {
- writeToken(79 /* DebuggerKeyword */, node.pos, writeKeyword);
+ writeToken(80 /* DebuggerKeyword */, node.pos, writeKeyword);
writeTrailingSemicolon();
}
//
@@ -85405,7 +86312,7 @@
var body = node.body;
if (!body)
return writeTrailingSemicolon();
- while (body.kind === 244 /* ModuleDeclaration */) {
+ while (body.kind === 245 /* ModuleDeclaration */) {
writePunctuation(".");
emit(body.name);
body = body.body;
@@ -85426,17 +86333,17 @@
}
function emitImportEqualsDeclaration(node) {
emitModifiers(node, node.modifiers);
- emitTokenWithComment(92 /* ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node);
+ emitTokenWithComment(93 /* ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node);
writeSpace();
emit(node.name);
writeSpace();
- emitTokenWithComment(59 /* EqualsToken */, node.name.end, writePunctuation, node);
+ emitTokenWithComment(60 /* EqualsToken */, node.name.end, writePunctuation, node);
writeSpace();
emitModuleReference(node.moduleReference);
writeTrailingSemicolon();
}
function emitModuleReference(node) {
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
emitExpression(node);
}
else {
@@ -85445,12 +86352,12 @@
}
function emitImportDeclaration(node) {
emitModifiers(node, node.modifiers);
- emitTokenWithComment(92 /* ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node);
+ emitTokenWithComment(93 /* ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node);
writeSpace();
if (node.importClause) {
emit(node.importClause);
writeSpace();
- emitTokenWithComment(144 /* FromKeyword */, node.importClause.end, writeKeyword, node);
+ emitTokenWithComment(145 /* FromKeyword */, node.importClause.end, writeKeyword, node);
writeSpace();
}
emitExpression(node.moduleSpecifier);
@@ -85467,7 +86374,7 @@
function emitNamespaceImport(node) {
var asPos = emitTokenWithComment(40 /* AsteriskToken */, node.pos, writePunctuation, node);
writeSpace();
- emitTokenWithComment(119 /* AsKeyword */, asPos, writeKeyword, node);
+ emitTokenWithComment(120 /* AsKeyword */, asPos, writeKeyword, node);
writeSpace();
emit(node.name);
}
@@ -85478,20 +86385,20 @@
emitImportOrExportSpecifier(node);
}
function emitExportAssignment(node) {
- var nextPos = emitTokenWithComment(85 /* ExportKeyword */, node.pos, writeKeyword, node);
+ var nextPos = emitTokenWithComment(86 /* ExportKeyword */, node.pos, writeKeyword, node);
writeSpace();
if (node.isExportEquals) {
- emitTokenWithComment(59 /* EqualsToken */, nextPos, writeOperator, node);
+ emitTokenWithComment(60 /* EqualsToken */, nextPos, writeOperator, node);
}
else {
- emitTokenWithComment(80 /* DefaultKeyword */, nextPos, writeKeyword, node);
+ emitTokenWithComment(81 /* DefaultKeyword */, nextPos, writeKeyword, node);
}
writeSpace();
emitExpression(node.expression);
writeTrailingSemicolon();
}
function emitExportDeclaration(node) {
- var nextPos = emitTokenWithComment(85 /* ExportKeyword */, node.pos, writeKeyword, node);
+ var nextPos = emitTokenWithComment(86 /* ExportKeyword */, node.pos, writeKeyword, node);
writeSpace();
if (node.exportClause) {
emit(node.exportClause);
@@ -85502,18 +86409,18 @@
if (node.moduleSpecifier) {
writeSpace();
var fromPos = node.exportClause ? node.exportClause.end : nextPos;
- emitTokenWithComment(144 /* FromKeyword */, fromPos, writeKeyword, node);
+ emitTokenWithComment(145 /* FromKeyword */, fromPos, writeKeyword, node);
writeSpace();
emitExpression(node.moduleSpecifier);
}
writeTrailingSemicolon();
}
function emitNamespaceExportDeclaration(node) {
- var nextPos = emitTokenWithComment(85 /* ExportKeyword */, node.pos, writeKeyword, node);
+ var nextPos = emitTokenWithComment(86 /* ExportKeyword */, node.pos, writeKeyword, node);
writeSpace();
- nextPos = emitTokenWithComment(119 /* AsKeyword */, nextPos, writeKeyword, node);
+ nextPos = emitTokenWithComment(120 /* AsKeyword */, nextPos, writeKeyword, node);
writeSpace();
- nextPos = emitTokenWithComment(131 /* NamespaceKeyword */, nextPos, writeKeyword, node);
+ nextPos = emitTokenWithComment(132 /* NamespaceKeyword */, nextPos, writeKeyword, node);
writeSpace();
emit(node.name);
writeTrailingSemicolon();
@@ -85533,7 +86440,7 @@
if (node.propertyName) {
emit(node.propertyName);
writeSpace();
- emitTokenWithComment(119 /* AsKeyword */, node.propertyName.end, writeKeyword, node);
+ emitTokenWithComment(120 /* AsKeyword */, node.propertyName.end, writeKeyword, node);
writeSpace();
}
emit(node.name);
@@ -85611,7 +86518,7 @@
}
}
function emitJsxTagName(node) {
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
emitExpression(node);
}
else {
@@ -85622,13 +86529,13 @@
// Clauses
//
function emitCaseClause(node) {
- emitTokenWithComment(74 /* CaseKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(75 /* CaseKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
emitCaseOrDefaultClauseRest(node, node.statements, node.expression.end);
}
function emitDefaultClause(node) {
- var pos = emitTokenWithComment(80 /* DefaultKeyword */, node.pos, writeKeyword, node);
+ var pos = emitTokenWithComment(81 /* DefaultKeyword */, node.pos, writeKeyword, node);
emitCaseOrDefaultClauseRest(node, node.statements, pos);
}
function emitCaseOrDefaultClauseRest(parentNode, statements, colonPos) {
@@ -85656,7 +86563,7 @@
emitList(node, node.types, 528 /* HeritageClauseTypes */);
}
function emitCatchClause(node) {
- var openParenPos = emitTokenWithComment(75 /* CatchKeyword */, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(76 /* CatchKeyword */, node.pos, writeKeyword, node);
writeSpace();
if (node.variableDeclaration) {
emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
@@ -85726,7 +86633,7 @@
}
}
if (node.tags) {
- if (node.tags.length === 1 && node.tags[0].kind === 307 /* JSDocTypeTag */ && !node.comment) {
+ if (node.tags.length === 1 && node.tags[0].kind === 308 /* JSDocTypeTag */ && !node.comment) {
writeSpace();
emit(node.tags[0]);
}
@@ -85760,7 +86667,7 @@
function emitJSDocTypedefTag(tag) {
emitJSDocTagName(tag.tagName);
if (tag.typeExpression) {
- if (tag.typeExpression.kind === 288 /* JSDocTypeExpression */) {
+ if (tag.typeExpression.kind === 289 /* JSDocTypeExpression */) {
emitJSDocTypeExpression(tag.typeExpression);
}
else {
@@ -85779,7 +86686,7 @@
emit(tag.fullName);
}
emitJSDocComment(tag.comment);
- if (tag.typeExpression && tag.typeExpression.kind === 297 /* JSDocTypeLiteral */) {
+ if (tag.typeExpression && tag.typeExpression.kind === 298 /* JSDocTypeLiteral */) {
emitJSDocTypeLiteral(tag.typeExpression);
}
}
@@ -85913,8 +86820,8 @@
bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "reference" /* Reference */, data: directive.fileName });
writeLine();
}
- for (var _d = 0, types_19 = types; _d < types_19.length; _d++) {
- var directive = types_19[_d];
+ for (var _d = 0, types_18 = types; _d < types_18.length; _d++) {
+ var directive = types_18[_d];
var pos = writer.getTextPos();
writeComment("/// <reference types=\"" + directive.fileName + "\" />");
if (bundleFileInfo)
@@ -86094,7 +87001,7 @@
function emitInitializer(node, equalCommentStartPos, container) {
if (node) {
writeSpace();
- emitTokenWithComment(59 /* EqualsToken */, equalCommentStartPos, writeOperator, container);
+ emitTokenWithComment(60 /* EqualsToken */, equalCommentStartPos, writeOperator, container);
writeSpace();
emitExpression(node);
}
@@ -86557,7 +87464,7 @@
&& ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile);
}
function skipSynthesizedParentheses(node) {
- while (node.kind === 195 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) {
+ while (node.kind === 196 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) {
node = node.expression;
}
return node;
@@ -86622,81 +87529,81 @@
if (!node)
return;
switch (node.kind) {
- case 218 /* Block */:
+ case 219 /* Block */:
ts.forEach(node.statements, generateNames);
break;
- case 233 /* LabeledStatement */:
- case 231 /* WithStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
+ case 234 /* LabeledStatement */:
+ case 232 /* WithStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
generateNames(node.statement);
break;
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
generateNames(node.thenStatement);
generateNames(node.elseStatement);
break;
- case 225 /* ForStatement */:
- case 227 /* ForOfStatement */:
- case 226 /* ForInStatement */:
+ case 226 /* ForStatement */:
+ case 228 /* ForOfStatement */:
+ case 227 /* ForInStatement */:
generateNames(node.initializer);
generateNames(node.statement);
break;
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
generateNames(node.caseBlock);
break;
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
ts.forEach(node.clauses, generateNames);
break;
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
ts.forEach(node.statements, generateNames);
break;
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
generateNames(node.tryBlock);
generateNames(node.catchClause);
generateNames(node.finallyBlock);
break;
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
generateNames(node.variableDeclaration);
generateNames(node.block);
break;
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
generateNames(node.declarationList);
break;
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
ts.forEach(node.declarations, generateNames);
break;
- case 237 /* VariableDeclaration */:
- case 151 /* Parameter */:
- case 186 /* BindingElement */:
- case 240 /* ClassDeclaration */:
+ case 238 /* VariableDeclaration */:
+ case 152 /* Parameter */:
+ case 187 /* BindingElement */:
+ case 241 /* ClassDeclaration */:
generateNameIfNeeded(node.name);
break;
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
generateNameIfNeeded(node.name);
if (ts.getEmitFlags(node) & 524288 /* ReuseTempVariableScope */) {
ts.forEach(node.parameters, generateNames);
generateNames(node.body);
}
break;
- case 184 /* ObjectBindingPattern */:
- case 185 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
ts.forEach(node.elements, generateNames);
break;
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
generateNames(node.importClause);
break;
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
generateNameIfNeeded(node.name);
generateNames(node.namedBindings);
break;
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
generateNameIfNeeded(node.name);
break;
- case 252 /* NamedImports */:
+ case 253 /* NamedImports */:
ts.forEach(node.elements, generateNames);
break;
- case 253 /* ImportSpecifier */:
+ case 254 /* ImportSpecifier */:
generateNameIfNeeded(node.propertyName || node.name);
break;
}
@@ -86705,12 +87612,12 @@
if (!node)
return;
switch (node.kind) {
- case 275 /* PropertyAssignment */:
- case 276 /* ShorthandPropertyAssignment */:
- case 154 /* PropertyDeclaration */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 276 /* PropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
+ case 155 /* PropertyDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
generateNameIfNeeded(node.name);
break;
}
@@ -86890,24 +87797,26 @@
*/
function generateNameForNode(node, flags) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return makeUniqueName(getTextOfNode(node), isUniqueName, !!(flags & 16 /* Optimistic */), !!(flags & 8 /* ReservedInNestedScopes */));
- case 244 /* ModuleDeclaration */:
- case 243 /* EnumDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 244 /* EnumDeclaration */:
return generateNameForModuleOrEnum(node);
- case 249 /* ImportDeclaration */:
- case 255 /* ExportDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 256 /* ExportDeclaration */:
return generateNameForImportOrExportDeclaration(node);
- case 239 /* FunctionDeclaration */:
- case 240 /* ClassDeclaration */:
- case 254 /* ExportAssignment */:
+ case 240 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 255 /* ExportAssignment */:
return generateNameForExportDefault();
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
return generateNameForClassExpression();
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return generateNameForMethodOrAccessor(node);
+ case 150 /* ComputedPropertyName */:
+ return makeTempVariableName(0 /* Auto */, /*reserveInNestedScopes*/ true);
default:
return makeTempVariableName(0 /* Auto */);
}
@@ -86953,7 +87862,7 @@
hasWrittenComment = false;
var emitFlags = ts.getEmitFlags(node);
var _a = ts.getCommentRange(node), pos = _a.pos, end = _a.end;
- var isEmittedNode = node.kind !== 312 /* NotEmittedStatement */;
+ var isEmittedNode = node.kind !== 313 /* NotEmittedStatement */;
// We have to explicitly check that the node is JsxText because if the compilerOptions.jsx is "preserve" we will not do any transformation.
// It is expensive to walk entire tree just to set one kind of node to have no comments.
var skipLeadingComments = pos < 0 || (emitFlags & 512 /* NoLeadingComments */) !== 0 || node.kind === 11 /* JsxText */;
@@ -86977,7 +87886,7 @@
containerEnd = end;
// To avoid invalid comment emit in a down-level binding pattern, we
// keep track of the last declaration list container's end
- if (node.kind === 238 /* VariableDeclarationList */) {
+ if (node.kind === 239 /* VariableDeclarationList */) {
declarationListContainerEnd = end;
}
}
@@ -87234,7 +88143,7 @@
else {
var _a = ts.getSourceMapRange(node), pos = _a.pos, end = _a.end, _b = _a.source, source = _b === void 0 ? sourceMapSource : _b;
var emitFlags = ts.getEmitFlags(node);
- if (node.kind !== 312 /* NotEmittedStatement */
+ if (node.kind !== 313 /* NotEmittedStatement */
&& (emitFlags & 16 /* NoLeadingSourceMap */) === 0
&& pos >= 0) {
emitSourcePos(source, skipSourceTrivia(source, pos));
@@ -87247,7 +88156,7 @@
else {
pipelinePhase(hint, node);
}
- if (node.kind !== 312 /* NotEmittedStatement */
+ if (node.kind !== 313 /* NotEmittedStatement */
&& (emitFlags & 32 /* NoTrailingSourceMap */) === 0
&& end >= 0) {
emitSourcePos(source, end);
@@ -87862,7 +88771,8 @@
getDirectories: function (path) { return system.getDirectories(path); },
realpath: realpath,
readDirectory: function (path, extensions, include, exclude, depth) { return system.readDirectory(path, extensions, include, exclude, depth); },
- createDirectory: function (d) { return system.createDirectory(d); }
+ createDirectory: function (d) { return system.createDirectory(d); },
+ createHash: ts.maybeBind(system, system.createHash)
};
return compilerHost;
}
@@ -88148,6 +89058,7 @@
}
}
ts.flattenDiagnosticMessageText = flattenDiagnosticMessageText;
+ /* @internal */
function loadWithLocalCache(names, containingFile, redirectedReference, loader) {
if (names.length === 0) {
return [];
@@ -88167,6 +89078,7 @@
}
return resolutions;
}
+ ts.loadWithLocalCache = loadWithLocalCache;
/**
* Determines if program structure is upto date or needs to be recreated
*/
@@ -88326,7 +89238,7 @@
}); };
}
else {
- moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, function (x) { return host.getCanonicalFileName(x); });
+ moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, function (x) { return host.getCanonicalFileName(x); }, options);
var loader_1 = function (moduleName, containingFile, redirectedReference) { return ts.resolveModuleName(moduleName, containingFile, options, host, moduleResolutionCache, redirectedReference).resolvedModule; }; // TODO: GH#18217
resolveModuleNamesWorker = function (moduleNames, containingFile, _reusedNames, redirectedReference) { return loadWithLocalCache(ts.Debug.assertEachDefined(moduleNames), containingFile, redirectedReference, loader_1); };
}
@@ -88472,6 +89384,7 @@
getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); },
getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); },
getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); },
+ getRelationCacheSizes: function () { return getDiagnosticsProducingTypeChecker().getRelationCacheSizes(); },
getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; },
getResolvedTypeReferenceDirectives: function () { return resolvedTypeReferenceDirectives; },
isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary,
@@ -88569,13 +89482,13 @@
// which per above occurred during the current program creation.
// Since we assume the filesystem does not change during program creation,
// it is safe to reuse resolutions from the earlier call.
- var result_6 = [];
+ var result_8 = [];
for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) {
var moduleName = moduleNames_1[_i];
var resolvedModule = file.resolvedModules.get(moduleName);
- result_6.push(resolvedModule);
+ result_8.push(resolvedModule);
}
- return result_6;
+ return result_8;
}
// At this point, we know at least one of the following hold:
// - file has local declarations for ambient modules
@@ -88662,7 +89575,7 @@
function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName) {
var resolutionToFile = ts.getResolvedModule(oldSourceFile, moduleName);
var resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
- if (resolutionToFile && resolvedFile && !resolvedFile.externalModuleIndicator) {
+ if (resolutionToFile && resolvedFile) {
// In the old program, we resolved to an ambient module that was in the same
// place as we expected to find an actual module file.
// We actually need to return 'false' here even though this seems like a 'true' case
@@ -88925,9 +89838,8 @@
ts.performance.mark("beforeEmit");
var emitResult = ts.emitFiles(ts.notImplementedResolver, getEmitHost(writeFileCallback),
/*targetSourceFile*/ undefined,
+ /*transformers*/ ts.noTransformers,
/*emitOnlyDtsFiles*/ false,
- /*transformers*/ undefined,
- /*declaraitonTransformers*/ undefined,
/*onlyBuildInfo*/ true);
ts.performance.mark("afterEmit");
ts.performance.measure("Emit", "beforeEmit", "afterEmit");
@@ -89015,8 +89927,7 @@
// checked is to not pass the file to getEmitResolver.
var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver((options.outFile || options.out) ? undefined : sourceFile, cancellationToken);
ts.performance.mark("beforeEmit");
- var transformers = emitOnlyDtsFiles ? [] : ts.getTransformers(options, customTransformers);
- var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile, emitOnlyDtsFiles, transformers, customTransformers && customTransformers.afterDeclarations);
+ var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile, ts.getTransformers(options, customTransformers, emitOnlyDtsFiles), emitOnlyDtsFiles);
ts.performance.mark("afterEmit");
ts.performance.measure("Emit", "beforeEmit", "afterEmit");
return emitResult;
@@ -89158,22 +90069,22 @@
// Return directly from the case if the given node doesnt want to visit each child
// Otherwise break to visit each child
switch (parent.kind) {
- case 151 /* Parameter */:
- case 154 /* PropertyDeclaration */:
+ case 152 /* Parameter */:
+ case 155 /* PropertyDeclaration */:
if (parent.questionToken === node) {
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, "?"));
return;
}
// falls through
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 196 /* FunctionExpression */:
- case 239 /* FunctionDeclaration */:
- case 197 /* ArrowFunction */:
- case 237 /* VariableDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 197 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
+ case 198 /* ArrowFunction */:
+ case 238 /* VariableDeclaration */:
// type annotation
if (parent.type === node) {
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.types_can_only_be_used_in_a_ts_file));
@@ -89181,41 +90092,41 @@
}
}
switch (node.kind) {
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file));
return;
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
if (node.isExportEquals) {
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file));
return;
}
break;
- case 273 /* HeritageClause */:
+ case 274 /* HeritageClause */:
var heritageClause = node;
- if (heritageClause.token === 109 /* ImplementsKeyword */) {
+ if (heritageClause.token === 110 /* ImplementsKeyword */) {
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file));
return;
}
break;
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file));
return;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file));
return;
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file));
return;
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file));
return;
- case 213 /* NonNullExpression */:
+ case 214 /* NonNullExpression */:
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.non_null_assertions_can_only_be_used_in_a_ts_file));
return;
- case 212 /* AsExpression */:
+ case 213 /* AsExpression */:
diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file));
return;
- case 194 /* TypeAssertionExpression */:
+ case 195 /* TypeAssertionExpression */:
ts.Debug.fail(); // Won't parse these in a JS file anyway, as they are interpreted as JSX.
}
var prevParent = parent;
@@ -89225,54 +90136,54 @@
}
function walkArray(nodes) {
if (parent.decorators === nodes && !options.experimentalDecorators) {
- diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning));
+ diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning));
}
switch (parent.kind) {
- case 240 /* ClassDeclaration */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 196 /* FunctionExpression */:
- case 239 /* FunctionDeclaration */:
- case 197 /* ArrowFunction */:
+ case 241 /* ClassDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 197 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
+ case 198 /* ArrowFunction */:
// Check type parameters
if (nodes === parent.typeParameters) {
diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file));
return;
}
// falls through
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
// Check modifiers
if (nodes === parent.modifiers) {
- return checkModifiers(nodes, parent.kind === 219 /* VariableStatement */);
+ return checkModifiers(nodes, parent.kind === 220 /* VariableStatement */);
}
break;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
// Check modifiers of property declaration
if (nodes === parent.modifiers) {
for (var _i = 0, _a = nodes; _i < _a.length; _i++) {
var modifier = _a[_i];
- if (modifier.kind !== 116 /* StaticKeyword */) {
+ if (modifier.kind !== 117 /* StaticKeyword */) {
diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind)));
}
}
return;
}
break;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
// Check modifiers of parameter declaration
if (nodes === parent.modifiers) {
diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file));
return;
}
break;
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
- case 211 /* ExpressionWithTypeArguments */:
- case 261 /* JsxSelfClosingElement */:
- case 262 /* JsxOpeningElement */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
+ case 212 /* ExpressionWithTypeArguments */:
+ case 262 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
// Check type arguments
if (nodes === parent.typeArguments) {
diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file));
@@ -89289,24 +90200,24 @@
for (var _i = 0, modifiers_1 = modifiers; _i < modifiers_1.length; _i++) {
var modifier = modifiers_1[_i];
switch (modifier.kind) {
- case 77 /* ConstKeyword */:
+ case 78 /* ConstKeyword */:
if (isConstValid) {
continue;
}
// to report error,
// falls through
- case 115 /* PublicKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 133 /* ReadonlyKeyword */:
- case 125 /* DeclareKeyword */:
- case 118 /* AbstractKeyword */:
+ case 116 /* PublicKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 134 /* ReadonlyKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 119 /* AbstractKeyword */:
diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind)));
break;
// These are all legal modifiers.
- case 116 /* StaticKeyword */:
- case 85 /* ExportKeyword */:
- case 80 /* DefaultKeyword */:
+ case 117 /* StaticKeyword */:
+ case 86 /* ExportKeyword */:
+ case 81 /* DefaultKeyword */:
}
}
}
@@ -89381,8 +90292,8 @@
return a.fileName === b.fileName;
}
function moduleNameIsEqualTo(a, b) {
- return a.kind === 72 /* Identifier */
- ? b.kind === 72 /* Identifier */ && a.escapedText === b.escapedText
+ return a.kind === 73 /* Identifier */
+ ? b.kind === 73 /* Identifier */ && a.escapedText === b.escapedText
: b.kind === 10 /* StringLiteral */ && a.text === b.text;
}
function collectExternalModuleReferences(file) {
@@ -89597,7 +90508,10 @@
if (isRedirect) {
inputName = getProjectReferenceRedirect(fileName) || fileName;
}
- if (ts.getNormalizedAbsolutePath(checkedName, currentDirectory) !== ts.getNormalizedAbsolutePath(inputName, currentDirectory)) {
+ // Check if it differs only in drive letters its ok to ignore that error:
+ var checkedAbsolutePath = ts.getNormalizedAbsolutePathWithoutRoot(checkedName, currentDirectory);
+ var inputAbsolutePath = ts.getNormalizedAbsolutePathWithoutRoot(inputName, currentDirectory);
+ if (checkedAbsolutePath !== inputAbsolutePath) {
reportFileNamesDifferOnlyInCasingError(inputName, checkedName, refFile, refPos, refEnd);
}
}
@@ -89626,8 +90540,13 @@
}
var redirectedPath;
if (refFile) {
- var redirect = getProjectReferenceRedirect(fileName);
- if (redirect) {
+ var redirectProject = getProjectReferenceRedirectProject(fileName);
+ if (redirectProject) {
+ if (redirectProject.commandLine.options.outFile || redirectProject.commandLine.options.out) {
+ // Shouldnt create many to 1 mapping file in --out scenario
+ return undefined;
+ }
+ var redirect = getProjectReferenceOutputName(redirectProject, fileName);
fileName = redirect;
// Once we start redirecting to a file, we can potentially come back to it
// via a back-reference from another file in the .d.ts folder. If that happens we'll
@@ -89711,16 +90630,19 @@
}
}
function getProjectReferenceRedirect(fileName) {
+ var referencedProject = getProjectReferenceRedirectProject(fileName);
+ return referencedProject && getProjectReferenceOutputName(referencedProject, fileName);
+ }
+ function getProjectReferenceRedirectProject(fileName) {
// Ignore dts or any of the non ts files
if (!resolvedProjectReferences || !resolvedProjectReferences.length || ts.fileExtensionIs(fileName, ".d.ts" /* Dts */) || !ts.fileExtensionIsOneOf(fileName, ts.supportedTSExtensions)) {
return undefined;
}
// If this file is produced by a referenced project, we need to rewrite it to
// look in the output folder of the referenced project rather than the input
- var referencedProject = getResolvedProjectReferenceToRedirect(fileName);
- if (!referencedProject) {
- return undefined;
+ return getResolvedProjectReferenceToRedirect(fileName);
}
+ function getProjectReferenceOutputName(referencedProject, fileName) {
var out = referencedProject.commandLine.options.outFile || referencedProject.commandLine.options.out;
return out ?
ts.changeExtension(out, ".d.ts" /* Dts */) :
@@ -89965,18 +90887,33 @@
if (fromCache !== undefined) {
return fromCache || undefined;
}
+ var commandLine;
+ var sourceFile;
+ if (host.getParsedCommandLine) {
+ commandLine = host.getParsedCommandLine(refPath);
+ if (!commandLine) {
+ addFileToFilesByName(/*sourceFile*/ undefined, sourceFilePath, /*redirectedPath*/ undefined);
+ projectReferenceRedirects.set(sourceFilePath, false);
+ return undefined;
+ }
+ sourceFile = ts.Debug.assertDefined(commandLine.options.configFile);
+ ts.Debug.assert(!sourceFile.path || sourceFile.path === sourceFilePath);
+ addFileToFilesByName(sourceFile, sourceFilePath, /*redirectedPath*/ undefined);
+ }
+ else {
// An absolute path pointing to the containing directory of the config file
var basePath = ts.getNormalizedAbsolutePath(ts.getDirectoryPath(refPath), host.getCurrentDirectory());
- var sourceFile = host.getSourceFile(refPath, 100 /* JSON */);
+ sourceFile = host.getSourceFile(refPath, 100 /* JSON */);
addFileToFilesByName(sourceFile, sourceFilePath, /*redirectedPath*/ undefined);
if (sourceFile === undefined) {
projectReferenceRedirects.set(sourceFilePath, false);
return undefined;
}
+ commandLine = ts.parseJsonSourceFileConfigFileContent(sourceFile, configParsingHost, basePath, /*existingOptions*/ undefined, refPath);
+ }
sourceFile.path = sourceFilePath;
sourceFile.resolvedPath = sourceFilePath;
sourceFile.originalFileName = refPath;
- var commandLine = ts.parseJsonSourceFileConfigFileContent(sourceFile, configParsingHost, basePath, /*existingOptions*/ undefined, refPath);
var resolvedRef = { commandLine: commandLine, sourceFile: sourceFile };
projectReferenceRedirects.set(sourceFilePath, resolvedRef);
if (commandLine.projectReferences) {
@@ -89992,9 +90929,6 @@
if (ts.getEmitDeclarations(options)) {
createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, getEmitDeclarationOptionName(options), "isolatedModules");
}
- if (options.noEmitOnError) {
- createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules");
- }
if (options.out) {
createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules");
}
@@ -90026,17 +90960,17 @@
createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "tsBuildInfoFile", "incremental", "composite");
}
}
+ else if (options.incremental && !options.outFile && !options.out && !options.configFilePath) {
+ programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified));
+ }
verifyProjectReferences();
// List of collected files is complete; validate exhautiveness if this is a project with a file list
if (options.composite) {
var rootPaths = rootNames.map(toPath);
for (var _i = 0, files_3 = files; _i < files_3.length; _i++) {
var file = files_3[_i];
- // Ignore declaration files
- if (file.isDeclarationFile)
- continue;
- // Ignore json file thats from project reference
- if (ts.isJsonSourceFile(file) && getResolvedProjectReferenceToRedirect(file.fileName))
+ // Ignore file that is not emitted
+ if (!ts.sourceFileMayBeEmitted(file, options, isSourceFileFromExternalLibrary, getResolvedProjectReferenceToRedirect))
continue;
if (rootPaths.indexOf(file.path) === -1) {
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_is_not_in_project_file_list_Projects_must_list_all_files_or_use_an_include_pattern, file.fileName));
@@ -90113,10 +91047,10 @@
if (options.module === ts.ModuleKind.None && languageVersion < 2 /* ES2015 */) {
createDiagnosticForOptionName(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher, "isolatedModules", "target");
}
- var firstNonExternalModuleSourceFile = ts.find(files, function (f) { return !ts.isExternalModule(f) && !f.isDeclarationFile && f.scriptKind !== 6 /* JSON */; });
+ var firstNonExternalModuleSourceFile = ts.find(files, function (f) { return !ts.isExternalModule(f) && !ts.isSourceFileJS(f) && !f.isDeclarationFile && f.scriptKind !== 6 /* JSON */; });
if (firstNonExternalModuleSourceFile) {
var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile);
- programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided));
+ programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.All_files_must_be_modules_when_the_isolatedModules_flag_is_provided));
}
}
else if (firstNonAmbientExternalModuleSourceFile && languageVersion < 2 /* ES2015 */ && options.module === ts.ModuleKind.None) {
@@ -90201,13 +91135,13 @@
var emitFilePath = toPath(emitFileName);
// Report error if the output overwrites input file
if (filesByName.has(emitFilePath)) {
- var chain_2;
+ var chain = void 0;
if (!options.configFilePath) {
// The program is from either an inferred project or an external project
- chain_2 = ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig);
+ chain = ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig);
}
- chain_2 = ts.chainDiagnosticMessages(chain_2, ts.Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file, emitFileName);
- blockEmittingOfFile(emitFileName, ts.createCompilerDiagnosticFromMessageChain(chain_2));
+ chain = ts.chainDiagnosticMessages(chain, ts.Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file, emitFileName);
+ blockEmittingOfFile(emitFileName, ts.createCompilerDiagnosticFromMessageChain(chain));
}
var emitFileKey = !host.useCaseSensitiveFileNames() ? emitFilePath.toLocaleLowerCase() : emitFilePath;
// Report error if multiple files write into same file
@@ -90742,6 +91676,7 @@
cacheToUpdateSignature.set(sourceFile.path, latestSignature);
return !prevSignature || latestSignature !== prevSignature;
}
+ BuilderState.updateShapeSignature = updateShapeSignature;
/**
* Coverts the declaration emit result into exported modules map
*/
@@ -91019,15 +91954,9 @@
}
}
});
- if (oldCompilerOptions &&
- (oldCompilerOptions.outDir !== compilerOptions.outDir ||
- oldCompilerOptions.declarationDir !== compilerOptions.declarationDir ||
- (oldCompilerOptions.outFile || oldCompilerOptions.out) !== (compilerOptions.outFile || compilerOptions.out))) {
+ if (oldCompilerOptions && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
// Add all files to affectedFilesPendingEmit since emit changed
- state.affectedFilesPendingEmit = ts.concatenate(state.affectedFilesPendingEmit, newProgram.getSourceFiles().map(function (f) { return f.path; }));
- if (state.affectedFilesPendingEmitIndex === undefined) {
- state.affectedFilesPendingEmitIndex = 0;
- }
+ addToAffectedFilesPendingEmit(state, newProgram.getSourceFiles().map(function (f) { return f.path; }));
ts.Debug.assert(state.seenAffectedFiles === undefined);
state.seenAffectedFiles = ts.createMap();
}
@@ -91111,7 +92040,7 @@
if (!seenAffectedFiles.has(affectedFile.path)) {
// Set the next affected file as seen and remove the cached semantic diagnostics
state.affectedFilesIndex = affectedFilesIndex;
- cleanSemanticDiagnosticsOfAffectedFile(state, affectedFile);
+ handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash);
return affectedFile;
}
seenAffectedFiles.set(affectedFile.path, true);
@@ -91172,28 +92101,68 @@
return undefined;
}
/**
- * Remove the semantic diagnostics cached from old state for affected File and the files that are referencing modules that export entities from affected file
+ * Handles semantic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file
+ * This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
*/
- function cleanSemanticDiagnosticsOfAffectedFile(state, affectedFile) {
- if (removeSemanticDiagnosticsOf(state, affectedFile.path)) {
- // If there are no more diagnostics from old cache, done
- return;
- }
- // Clean lib file diagnostics if its all files excluding default files to emit
- if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles && !state.cleanedDiagnosticsOfLibFiles) {
+ function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash) {
+ removeSemanticDiagnosticsOf(state, affectedFile.path);
+ // If affected files is everything except default library, then nothing more to do
+ if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
+ if (!state.cleanedDiagnosticsOfLibFiles) {
state.cleanedDiagnosticsOfLibFiles = true;
var program_1 = ts.Debug.assertDefined(state.program);
var options_2 = program_1.getCompilerOptions();
- if (ts.forEach(program_1.getSourceFiles(), function (f) {
+ ts.forEach(program_1.getSourceFiles(), function (f) {
return program_1.isSourceFileDefaultLibrary(f) &&
!ts.skipTypeChecking(f, options_2) &&
removeSemanticDiagnosticsOf(state, f.path);
- })) {
+ });
+ }
return;
}
+ forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, function (state, path) { return handleDtsMayChangeOf(state, path, cancellationToken, computeHash); });
}
- // If there was change in signature for the changed file,
- // then delete the semantic diagnostics for files that are affected by using exports of this module
+ /**
+ * Handle the dts may change, so they need to be added to pending emit if dts emit is enabled,
+ * Also we need to make sure signature is updated for these files
+ */
+ function handleDtsMayChangeOf(state, path, cancellationToken, computeHash) {
+ removeSemanticDiagnosticsOf(state, path);
+ if (!state.changedFilesSet.has(path)) {
+ var program = ts.Debug.assertDefined(state.program);
+ var sourceFile = program.getSourceFileByPath(path);
+ if (sourceFile) {
+ // Even though the js emit doesnt change and we are already handling dts emit and semantic diagnostics
+ // we need to update the signature to reflect correctness of the signature(which is output d.ts emit) of this file
+ // This ensures that we dont later during incremental builds considering wrong signature.
+ // Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
+ ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.assertDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
+ // If not dts emit, nothing more to do
+ if (ts.getEmitDeclarations(state.compilerOptions)) {
+ addToAffectedFilesPendingEmit(state, [path]);
+ }
+ }
+ }
+ return false;
+ }
+ /**
+ * Removes semantic diagnostics for path and
+ * returns true if there are no more semantic diagnostics from the old state
+ */
+ function removeSemanticDiagnosticsOf(state, path) {
+ if (!state.semanticDiagnosticsFromOldState) {
+ return true;
+ }
+ state.semanticDiagnosticsFromOldState.delete(path);
+ state.semanticDiagnosticsPerFile.delete(path);
+ return !state.semanticDiagnosticsFromOldState.size;
+ }
+ /**
+ * Iterate on referencing modules that export entities from affected file
+ */
+ function forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, fn) {
+ // If there was change in signature (dts output) for the changed file,
+ // then only we need to handle pending file emit
if (!state.exportedModulesMap || state.affectedFiles.length === 1 || !state.changedFilesSet.has(affectedFile.path)) {
return;
}
@@ -91204,7 +92173,7 @@
if (ts.forEachEntry(state.currentAffectedFilesExportedModulesMap, function (exportedModules, exportedFromPath) {
return exportedModules &&
exportedModules.has(affectedFile.path) &&
- removeSemanticDiagnosticsOfFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile);
+ forEachFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile, fn);
})) {
return;
}
@@ -91212,26 +92181,25 @@
ts.forEachEntry(state.exportedModulesMap, function (exportedModules, exportedFromPath) {
return !state.currentAffectedFilesExportedModulesMap.has(exportedFromPath) && // If we already iterated this through cache, ignore it
exportedModules.has(affectedFile.path) &&
- removeSemanticDiagnosticsOfFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile);
+ forEachFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile, fn);
});
}
/**
- * removes the semantic diagnostics of files referencing referencedPath and
- * returns true if there are no more semantic diagnostics from old state
+ * Iterate on files referencing referencedPath
*/
- function removeSemanticDiagnosticsOfFilesReferencingPath(state, referencedPath, seenFileAndExportsOfFile) {
+ function forEachFilesReferencingPath(state, referencedPath, seenFileAndExportsOfFile, fn) {
return ts.forEachEntry(state.referencedMap, function (referencesInFile, filePath) {
- return referencesInFile.has(referencedPath) && removeSemanticDiagnosticsOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile);
+ return referencesInFile.has(referencedPath) && forEachFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, fn);
});
}
/**
- * Removes semantic diagnostics of file and anything that exports this file
+ * fn on file and iterate on anything that exports this file
*/
- function removeSemanticDiagnosticsOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile) {
+ function forEachFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, fn) {
if (!ts.addToSeen(seenFileAndExportsOfFile, filePath)) {
return false;
}
- if (removeSemanticDiagnosticsOf(state, filePath)) {
+ if (fn(state, filePath)) {
// If there are no more diagnostics from old cache, done
return true;
}
@@ -91241,7 +92209,7 @@
if (ts.forEachEntry(state.currentAffectedFilesExportedModulesMap, function (exportedModules, exportedFromPath) {
return exportedModules &&
exportedModules.has(filePath) &&
- removeSemanticDiagnosticsOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile);
+ forEachFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, fn);
})) {
return true;
}
@@ -91249,7 +92217,7 @@
if (ts.forEachEntry(state.exportedModulesMap, function (exportedModules, exportedFromPath) {
return !state.currentAffectedFilesExportedModulesMap.has(exportedFromPath) && // If we already iterated this through cache, ignore it
exportedModules.has(filePath) &&
- removeSemanticDiagnosticsOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile);
+ forEachFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, fn);
})) {
return true;
}
@@ -91257,23 +92225,11 @@
return !!ts.forEachEntry(state.referencedMap, function (referencesInFile, referencingFilePath) {
return referencesInFile.has(filePath) &&
!seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
- removeSemanticDiagnosticsOf(state, referencingFilePath);
+ fn(state, referencingFilePath);
} // Dont add to seen since this is not yet done with the export removal
);
}
/**
- * Removes semantic diagnostics for path and
- * returns true if there are no more semantic diagnostics from the old state
- */
- function removeSemanticDiagnosticsOf(state, path) {
- if (!state.semanticDiagnosticsFromOldState) {
- return true;
- }
- state.semanticDiagnosticsFromOldState.delete(path);
- state.semanticDiagnosticsPerFile.delete(path);
- return !state.semanticDiagnosticsFromOldState.size;
- }
- /**
* This is called after completing operation on the next affected file.
* The operations here are postponed to ensure that cancellation during the iteration is handled correctly
*/
@@ -91500,7 +92456,7 @@
return toAffectedFileResult(state,
// When whole program is affected, do emit only once (eg when --out or --outFile is specified)
// Otherwise just affected file
- affected_1.emitBuildInfo(writeFile || host.writeFile, cancellationToken), affected_1,
+ affected_1.emitBuildInfo(writeFile || ts.maybeBind(host, host.writeFile), cancellationToken), affected_1,
/*isPendingEmitFile*/ false,
/*isBuildInfoEmit*/ true);
}
@@ -91516,14 +92472,10 @@
affected = program;
}
}
- // Mark seen emitted files if there are pending files to be emitted
- if (state.affectedFilesPendingEmit && state.program !== affected) {
- (state.seenEmittedFiles || (state.seenEmittedFiles = ts.createMap())).set(affected.path, true);
- }
return toAffectedFileResult(state,
// When whole program is affected, do emit only once (eg when --out or --outFile is specified)
// Otherwise just affected file
- ts.Debug.assertDefined(state.program).emit(affected === state.program ? undefined : affected, writeFile || host.writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers), affected, isPendingEmitFile);
+ ts.Debug.assertDefined(state.program).emit(affected === state.program ? undefined : affected, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers), affected, isPendingEmitFile);
}
/**
* Emits the JavaScript and declaration files.
@@ -91560,7 +92512,7 @@
};
}
}
- return ts.Debug.assertDefined(state.program).emit(targetSourceFile, writeFile || host.writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers);
+ return ts.Debug.assertDefined(state.program).emit(targetSourceFile, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
}
/**
* Return the semantic diagnostics for the next affected file or undefined if iteration is complete
@@ -91617,14 +92569,7 @@
}
// In case of emit builder, cache the files to be emitted
if (affectedFilesPendingEmit) {
- state.affectedFilesPendingEmit = ts.concatenate(state.affectedFilesPendingEmit, affectedFilesPendingEmit);
- // affectedFilesPendingEmitIndex === undefined
- // - means the emit state.affectedFilesPendingEmit was undefined before adding current affected files
- // so start from 0 as array would be affectedFilesPendingEmit
- // else, continue to iterate from existing index, the current set is appended to existing files
- if (state.affectedFilesPendingEmitIndex === undefined) {
- state.affectedFilesPendingEmitIndex = 0;
- }
+ addToAffectedFilesPendingEmit(state, affectedFilesPendingEmit);
}
var diagnostics;
for (var _i = 0, _a = ts.Debug.assertDefined(state.program).getSourceFiles(); _i < _a.length; _i++) {
@@ -91635,6 +92580,16 @@
}
}
ts.createBuilderProgram = createBuilderProgram;
+ function addToAffectedFilesPendingEmit(state, affectedFilesPendingEmit) {
+ state.affectedFilesPendingEmit = ts.concatenate(state.affectedFilesPendingEmit, affectedFilesPendingEmit);
+ // affectedFilesPendingEmitIndex === undefined
+ // - means the emit state.affectedFilesPendingEmit was undefined before adding current affected files
+ // so start from 0 as array would be affectedFilesPendingEmit
+ // else, continue to iterate from existing index, the current set is appended to existing files
+ if (state.affectedFilesPendingEmitIndex === undefined) {
+ state.affectedFilesPendingEmitIndex = 0;
+ }
+ }
function getMapOfReferencedSet(mapLike) {
if (!mapLike)
return undefined;
@@ -92496,11 +93451,11 @@
}
function discoverProbableSymlinks(files, getCanonicalFileName, cwd) {
var result = ts.createMap();
- var symlinks = ts.mapDefined(files, function (sf) {
- return sf.resolvedModules && ts.firstDefinedIterator(sf.resolvedModules.values(), function (res) {
+ var symlinks = ts.flatten(ts.mapDefined(files, function (sf) {
+ return sf.resolvedModules && ts.compact(ts.arrayFrom(ts.mapIterator(sf.resolvedModules.values(), function (res) {
return res && res.originalPath && res.resolvedFileName !== res.originalPath ? [res.resolvedFileName, res.originalPath] : undefined;
- });
- });
+ })));
+ }));
for (var _i = 0, symlinks_1 = symlinks; _i < symlinks_1.length; _i++) {
var _a = symlinks_1[_i], resolvedPath = _a[0], originalPath = _a[1];
var _b = guessDirectorySymlink(resolvedPath, originalPath, cwd, getCanonicalFileName), commonResolved = _b[0], commonOriginal = _b[1];
@@ -92843,6 +93798,14 @@
return "" + newLine + ts.flattenDiagnosticMessageText(d.messageText, newLine) + newLine + newLine;
}
ts.getErrorSummaryText = getErrorSummaryText;
+ function listFiles(program, writeFileName) {
+ if (program.getCompilerOptions().listFiles) {
+ ts.forEach(program.getSourceFiles(), function (file) {
+ writeFileName(file.fileName);
+ });
+ }
+ }
+ ts.listFiles = listFiles;
/**
* Helper that emit files, report diagnostics and lists emitted and/or source files depending on compiler options
*/
@@ -92870,11 +93833,7 @@
var filepath = ts.getNormalizedAbsolutePath(file, currentDir_1);
writeFileName("TSFILE: " + filepath);
});
- if (program.getCompilerOptions().listFiles) {
- ts.forEach(program.getSourceFiles(), function (file) {
- writeFileName(file.fileName);
- });
- }
+ listFiles(program, writeFileName);
}
if (reportSummary) {
reportSummary(getErrorCountForSummary(diagnostics));
@@ -93687,6 +94646,7 @@
function getCompilerOptionsOfBuildOptions(buildOptions) {
var result = {};
ts.commonOptionsWithBuild.forEach(function (option) {
+ if (ts.hasProperty(buildOptions, option.name))
result[option.name] = buildOptions[option.name];
});
return result;
@@ -93706,12 +94666,18 @@
var projectStatus = createFileMap(toPath);
var missingRoots = ts.createMap();
var globalDependencyGraph;
- var writeFileName = function (s) { return host.trace && host.trace(s); };
+ var writeFileName = host.trace ? function (s) { return host.trace(s); } : undefined;
var readFileWithCache = function (f) { return host.readFile(f); };
var projectCompilerOptions = baseCompilerOptions;
var compilerHost = ts.createCompilerHostFromProgramHost(host, function () { return projectCompilerOptions; });
ts.setGetSourceFileAsHashVersioned(compilerHost, host);
+ compilerHost.getParsedCommandLine = parseConfigFile;
+ compilerHost.resolveModuleNames = ts.maybeBind(host, host.resolveModuleNames);
+ compilerHost.resolveTypeReferenceDirectives = ts.maybeBind(host, host.resolveTypeReferenceDirectives);
+ var moduleResolutionCache = !compilerHost.resolveModuleNames ? ts.createModuleResolutionCache(currentDirectory, getCanonicalFileName) : undefined;
+ var cacheState;
var buildInfoChecked = createFileMap(toPath);
+ var extendedConfigCache = ts.createMap();
// Watch state
var builderPrograms = createFileMap(toPath);
var diagnostics = createFileMap(toPath);
@@ -93775,7 +94741,7 @@
}
var diagnostic;
parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = function (d) { return diagnostic = d; };
- var parsed = ts.getParsedCommandLineOfConfigFile(configFilePath, baseCompilerOptions, parseConfigFileHost);
+ var parsed = ts.getParsedCommandLineOfConfigFile(configFilePath, baseCompilerOptions, parseConfigFileHost, extendedConfigCache);
parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = ts.noop;
configFileCache.setValue(configFilePath, parsed || diagnostic);
return parsed;
@@ -94097,6 +95063,7 @@
projectStatus.removeKey(resolved);
diagnostics.removeKey(resolved);
addProjToQueue(resolved, reloadLevel);
+ enableCache();
}
/**
* return true if new addition
@@ -94152,6 +95119,7 @@
}
}
else {
+ disableCache();
reportErrorSummary();
}
}
@@ -94314,6 +95282,28 @@
}
// TODO: handle resolve module name to cache result in project reference redirect
projectCompilerOptions = configFile.options;
+ // Update module resolution cache if needed
+ if (moduleResolutionCache) {
+ var projPath = toPath(proj);
+ if (moduleResolutionCache.directoryToModuleNameMap.redirectsMap.size === 0) {
+ // The own map will be for projectCompilerOptions
+ ts.Debug.assert(moduleResolutionCache.moduleNameToDirectoryMap.redirectsMap.size === 0);
+ moduleResolutionCache.directoryToModuleNameMap.redirectsMap.set(projPath, moduleResolutionCache.directoryToModuleNameMap.ownMap);
+ moduleResolutionCache.moduleNameToDirectoryMap.redirectsMap.set(projPath, moduleResolutionCache.moduleNameToDirectoryMap.ownMap);
+ }
+ else {
+ // Set correct own map
+ ts.Debug.assert(moduleResolutionCache.moduleNameToDirectoryMap.redirectsMap.size > 0);
+ var ref = {
+ sourceFile: projectCompilerOptions.configFile,
+ commandLine: configFile
+ };
+ moduleResolutionCache.directoryToModuleNameMap.setOwnMap(moduleResolutionCache.directoryToModuleNameMap.getOrCreateMapOfCacheRedirects(ref));
+ moduleResolutionCache.moduleNameToDirectoryMap.setOwnMap(moduleResolutionCache.moduleNameToDirectoryMap.getOrCreateMapOfCacheRedirects(ref));
+ }
+ moduleResolutionCache.directoryToModuleNameMap.setOwnOptions(projectCompilerOptions);
+ moduleResolutionCache.moduleNameToDirectoryMap.setOwnOptions(projectCompilerOptions);
+ }
var program = host.createProgram(configFile.fileNames, configFile.options, compilerHost, getOldProgram(proj, configFile), configFile.errors, configFile.projectReferences);
// Don't emit anything in the presence of syntactic errors or options diagnostics
var syntaxDiagnostics = program.getConfigFileParsingDiagnostics().concat(program.getOptionsDiagnostics(), program.getGlobalDiagnostics(), program.getSyntacticDiagnostics());
@@ -94332,7 +95322,7 @@
var declDiagnostics;
var reportDeclarationDiagnostics = function (d) { return (declDiagnostics || (declDiagnostics = [])).push(d); };
var outputFiles = [];
- ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics, writeFileName, /*reportSummary*/ undefined, function (name, text, writeByteOrderMark) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); });
+ ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics, /*writeFileName*/ undefined, /*reportSummary*/ undefined, function (name, text, writeByteOrderMark) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); });
// Don't emit .d.ts if there are decl file errors
if (declDiagnostics) {
program.restoreState();
@@ -94354,7 +95344,7 @@
anyDtsChanged = true;
}
}
- emittedOutputs.setValue(name, true);
+ emittedOutputs.setValue(name, name);
ts.writeFile(compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
if (priorChangeTime !== undefined) {
newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime);
@@ -94365,6 +95355,10 @@
if (emitDiagnostics.length) {
return buildErrors(emitDiagnostics, BuildResultFlags.EmitErrors, "Emit");
}
+ if (writeFileName) {
+ emittedOutputs.forEach(function (name) { return listEmittedFile(configFile, name); });
+ ts.listFiles(program, writeFileName);
+ }
// Update time stamps for rest of the outputs
newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(configFile, newestDeclarationFileContentChangedTime, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
var status = {
@@ -94380,12 +95374,20 @@
function buildErrors(diagnostics, errorFlags, errorType) {
resultFlags |= errorFlags;
reportAndStoreErrors(proj, diagnostics);
+ // List files if any other build error using program (emit errors already report files)
+ if (writeFileName)
+ ts.listFiles(program, writeFileName);
projectStatus.setValue(proj, { type: UpToDateStatusType.Unbuildable, reason: errorType + " errors" });
afterProgramCreate(proj, program);
projectCompilerOptions = baseCompilerOptions;
return resultFlags;
}
}
+ function listEmittedFile(proj, file) {
+ if (writeFileName && proj.options.listEmittedFiles) {
+ writeFileName("TSFILE: " + file);
+ }
+ }
function afterProgramCreate(proj, program) {
if (host.afterProgramEmitAndDiagnostics) {
host.afterProgramEmitAndDiagnostics(program);
@@ -94424,7 +95426,7 @@
var emittedOutputs = createFileMap(toPath);
outputFiles.forEach(function (_a) {
var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
- emittedOutputs.setValue(name, true);
+ emittedOutputs.setValue(name, name);
ts.writeFile(compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
});
var emitDiagnostics = emitterDiagnostics.getDiagnostics();
@@ -94434,6 +95436,9 @@
projectCompilerOptions = baseCompilerOptions;
return BuildResultFlags.DeclarationOutputUnchanged | BuildResultFlags.EmitErrors;
}
+ if (writeFileName) {
+ emittedOutputs.forEach(function (name) { return listEmittedFile(config, name); });
+ }
// Update timestamps for dts
var newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(config, minimumDate, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
var status = {
@@ -94474,9 +95479,7 @@
priorNewestUpdateTime = newer(priorNewestUpdateTime, host.getModifiedTime(file) || ts.missingFileModifiedTime);
}
host.setModifiedTime(file, now);
- if (proj.options.listEmittedFiles) {
- writeFileName("TSFILE: " + file);
- }
+ listEmittedFile(proj, file);
}
}
return priorNewestUpdateTime;
@@ -94521,28 +95524,67 @@
function resolveProjectNames(configFileNames) {
return configFileNames.map(resolveProjectName);
}
- function buildAllProjects() {
- if (options.watch) {
- reportWatchStatus(ts.Diagnostics.Starting_compilation_in_watch_mode);
+ function enableCache() {
+ if (cacheState) {
+ disableCache();
}
- // TODO:: In watch mode as well to use caches for incremental build once we can invalidate caches correctly and have right api
- // Override readFile for json files and output .d.ts to cache the text
- var savedReadFileWithCache = readFileWithCache;
- var savedGetSourceFile = compilerHost.getSourceFile;
+ var originalReadFileWithCache = readFileWithCache;
+ var originalGetSourceFile = compilerHost.getSourceFile;
var _a = ts.changeCompilerHostLikeToUseCache(host, toPath, function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
- return savedGetSourceFile.call.apply(savedGetSourceFile, [compilerHost].concat(args));
+ return originalGetSourceFile.call.apply(originalGetSourceFile, [compilerHost].concat(args));
}), originalReadFile = _a.originalReadFile, originalFileExists = _a.originalFileExists, originalDirectoryExists = _a.originalDirectoryExists, originalCreateDirectory = _a.originalCreateDirectory, originalWriteFile = _a.originalWriteFile, getSourceFileWithCache = _a.getSourceFileWithCache, newReadFileWithCache = _a.readFileWithCache;
readFileWithCache = newReadFileWithCache;
compilerHost.getSourceFile = getSourceFileWithCache;
+ var originalResolveModuleNames = compilerHost.resolveModuleNames;
+ if (!compilerHost.resolveModuleNames) {
+ var loader_3 = function (moduleName, containingFile, redirectedReference) { return ts.resolveModuleName(moduleName, containingFile, projectCompilerOptions, compilerHost, moduleResolutionCache, redirectedReference).resolvedModule; };
+ compilerHost.resolveModuleNames = function (moduleNames, containingFile, _reusedNames, redirectedReference) {
+ return ts.loadWithLocalCache(ts.Debug.assertEachDefined(moduleNames), containingFile, redirectedReference, loader_3);
+ };
+ }
+ cacheState = {
+ originalReadFile: originalReadFile,
+ originalFileExists: originalFileExists,
+ originalDirectoryExists: originalDirectoryExists,
+ originalCreateDirectory: originalCreateDirectory,
+ originalWriteFile: originalWriteFile,
+ originalReadFileWithCache: originalReadFileWithCache,
+ originalGetSourceFile: originalGetSourceFile,
+ originalResolveModuleNames: originalResolveModuleNames
+ };
+ }
+ function disableCache() {
+ if (!cacheState)
+ return;
+ host.readFile = cacheState.originalReadFile;
+ host.fileExists = cacheState.originalFileExists;
+ host.directoryExists = cacheState.originalDirectoryExists;
+ host.createDirectory = cacheState.originalCreateDirectory;
+ host.writeFile = cacheState.originalWriteFile;
+ compilerHost.getSourceFile = cacheState.originalGetSourceFile;
+ readFileWithCache = cacheState.originalReadFileWithCache;
+ compilerHost.resolveModuleNames = cacheState.originalResolveModuleNames;
+ extendedConfigCache.clear();
+ if (moduleResolutionCache) {
+ moduleResolutionCache.directoryToModuleNameMap.clear();
+ moduleResolutionCache.moduleNameToDirectoryMap.clear();
+ }
+ cacheState = undefined;
+ }
+ function buildAllProjects() {
+ if (options.watch) {
+ reportWatchStatus(ts.Diagnostics.Starting_compilation_in_watch_mode);
+ }
+ enableCache();
var graph = getGlobalDependencyGraph();
reportBuildQueue(graph);
var anyFailed = false;
- for (var _i = 0, _b = graph.buildQueue; _i < _b.length; _i++) {
- var next = _b[_i];
+ for (var _i = 0, _a = graph.buildQueue; _i < _a.length; _i++) {
+ var next = _a[_i];
var proj = parseConfigFile(next);
if (proj === undefined) {
reportParseConfigFileDiagnostic(next);
@@ -94586,13 +95628,7 @@
anyFailed = anyFailed || !!(buildResult & BuildResultFlags.AnyErrors);
}
reportErrorSummary();
- host.readFile = originalReadFile;
- host.fileExists = originalFileExists;
- host.directoryExists = originalDirectoryExists;
- host.createDirectory = originalCreateDirectory;
- host.writeFile = originalWriteFile;
- compilerHost.getSourceFile = savedGetSourceFile;
- readFileWithCache = savedReadFileWithCache;
+ disableCache();
return anyFailed ? ts.ExitStatus.DiagnosticsPresent_OutputsSkipped : ts.ExitStatus.Success;
}
function needsBuild(status, configFile) {
@@ -94683,151 +95719,12 @@
/* @internal */
var ts;
(function (ts) {
- var ValueKind;
- (function (ValueKind) {
- ValueKind[ValueKind["Const"] = 0] = "Const";
- ValueKind[ValueKind["Array"] = 1] = "Array";
- ValueKind[ValueKind["FunctionOrClass"] = 2] = "FunctionOrClass";
- ValueKind[ValueKind["Object"] = 3] = "Object";
- })(ValueKind = ts.ValueKind || (ts.ValueKind = {}));
- function inspectModule(fileNameToRequire) {
- return inspectValue(ts.removeFileExtension(ts.getBaseFileName(fileNameToRequire)), tryRequire(fileNameToRequire));
- }
- ts.inspectModule = inspectModule;
- function inspectValue(name, value) {
- return getValueInfo(name, value, getRecurser());
- }
- ts.inspectValue = inspectValue;
- function getRecurser() {
- var seen = [];
- var nameStack = [];
- return function (obj, name, cbOk, cbFail) {
- if (seen.indexOf(obj) !== -1 || nameStack.length > 4) {
- return cbFail(seen.indexOf(obj) !== -1, nameStack);
- }
- seen.push(obj);
- nameStack.push(name);
- var res = cbOk();
- nameStack.pop();
- seen.pop();
- return res;
- };
- }
- function getValueInfo(name, value, recurser) {
- return recurser(value, name, function () {
- if (typeof value === "function")
- return getFunctionOrClassInfo(value, name, recurser);
- if (typeof value === "object") {
- var builtin = getBuiltinType(name, value, recurser);
- if (builtin !== undefined)
- return builtin;
- var entries = getEntriesOfObject(value);
- var hasNontrivialPrototype = Object.getPrototypeOf(value) !== Object.prototype;
- var members = ts.flatMap(entries, function (_a) {
- var key = _a.key, value = _a.value;
- return getValueInfo(key, value, recurser);
- });
- return { kind: 3 /* Object */, name: name, hasNontrivialPrototype: hasNontrivialPrototype, members: members };
- }
- return { kind: 0 /* Const */, name: name, typeName: isNullOrUndefined(value) ? "any" : typeof value };
- }, function (isCircularReference, keyStack) { return anyValue(name, " " + (isCircularReference ? "Circular reference" : "Too-deep object hierarchy") + " from " + keyStack.join(".")); });
- }
- function getFunctionOrClassInfo(fn, name, recurser) {
- var prototypeMembers = getPrototypeMembers(fn, recurser);
- var namespaceMembers = ts.flatMap(getEntriesOfObject(fn), function (_a) {
- var key = _a.key, value = _a.value;
- return getValueInfo(key, value, recurser);
- });
- var toString = ts.cast(Function.prototype.toString.call(fn), ts.isString);
- var source = ts.stringContains(toString, "{ [native code] }") ? getFunctionLength(fn) : toString;
- return { kind: 2 /* FunctionOrClass */, name: name, source: source, namespaceMembers: namespaceMembers, prototypeMembers: prototypeMembers };
- }
- var builtins = ts.memoize(function () {
- var map = ts.createMap();
- for (var _i = 0, _a = getEntriesOfObject(global); _i < _a.length; _i++) {
- var _b = _a[_i], key = _b.key, value = _b.value;
- if (typeof value === "function" && typeof value.prototype === "object" && value !== Object) {
- map.set(key, value);
- }
- }
- return map;
- });
- function getBuiltinType(name, value, recurser) {
- return ts.isArray(value)
- ? { name: name, kind: 1 /* Array */, inner: value.length && getValueInfo("element", ts.first(value), recurser) || anyValue(name) }
- : ts.forEachEntry(builtins(), function (builtin, builtinName) {
- return value instanceof builtin ? { kind: 0 /* Const */, name: name, typeName: builtinName } : undefined;
- });
- }
- function getPrototypeMembers(fn, recurser) {
- var prototype = fn.prototype;
- // tslint:disable-next-line no-unnecessary-type-assertion (TODO: update LKG and it will really be unnecessary)
- return typeof prototype !== "object" || prototype === null ? ts.emptyArray : ts.mapDefined(getEntriesOfObject(prototype), function (_a) {
- var key = _a.key, value = _a.value;
- return key === "constructor" ? undefined : getValueInfo(key, value, recurser);
- });
- }
- var ignoredProperties = ["arguments", "caller", "constructor", "eval", "super_"];
- var reservedFunctionProperties = Object.getOwnPropertyNames(ts.noop);
- function getEntriesOfObject(obj) {
- var seen = ts.createMap();
- var entries = [];
- var chain = obj;
- while (!isNullOrUndefined(chain) && chain !== Object.prototype && chain !== Function.prototype) {
- for (var _i = 0, _a = Object.getOwnPropertyNames(chain); _i < _a.length; _i++) {
- var key = _a[_i];
- if (!isJsPrivate(key) &&
- ignoredProperties.indexOf(key) === -1 &&
- (typeof obj !== "function" || reservedFunctionProperties.indexOf(key) === -1) &&
- // Don't add property from a higher prototype if it already exists in a lower one
- ts.addToSeen(seen, key)) {
- var value = safeGetPropertyOfObject(chain, key);
- // Don't repeat "toString" that matches signature from Object.prototype
- if (!(key === "toString" && typeof value === "function" && value.length === 0)) {
- entries.push({ key: key, value: value });
- }
- }
- }
- chain = Object.getPrototypeOf(chain);
- }
- return entries.sort(function (e1, e2) { return ts.compareStringsCaseSensitive(e1.key, e2.key); });
- }
- function getFunctionLength(fn) {
- return ts.tryCast(safeGetPropertyOfObject(fn, "length"), ts.isNumber) || 0;
- }
- function safeGetPropertyOfObject(obj, key) {
- var desc = Object.getOwnPropertyDescriptor(obj, key);
- return desc && desc.value;
- }
- function isNullOrUndefined(value) {
- return value == null; // tslint:disable-line
- }
- function anyValue(name, comment) {
- return { kind: 0 /* Const */, name: name, typeName: "any", comment: comment };
- }
- function isJsPrivate(name) {
- return ts.startsWith(name, "_");
- }
- ts.isJsPrivate = isJsPrivate;
- function tryRequire(fileNameToRequire) {
- try {
- return require(fileNameToRequire);
- }
- catch (_a) {
- return undefined;
- }
- }
-})(ts || (ts = {}));
-/* @internal */
-var ts;
-(function (ts) {
var server;
(function (server) {
// tslint:disable variable-name
server.ActionSet = "action::set";
server.ActionInvalidate = "action::invalidate";
server.ActionPackageInstalled = "action::packageInstalled";
- server.ActionValueInspected = "action::valueInspected";
server.EventTypesRegistry = "event::typesRegistry";
server.EventBeginInstallTypes = "event::beginInstallTypes";
server.EventEndInstallTypes = "event::endInstallTypes";
@@ -95445,7 +96342,7 @@
/* @internal */
var ts;
(function (ts) {
- ts.scanner = ts.createScanner(7 /* Latest */, /*skipTrivia*/ true);
+ ts.scanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ true);
var SemanticMeaning;
(function (SemanticMeaning) {
SemanticMeaning[SemanticMeaning["None"] = 0] = "None";
@@ -95456,37 +96353,37 @@
})(SemanticMeaning = ts.SemanticMeaning || (ts.SemanticMeaning = {}));
function getMeaningFromDeclaration(node) {
switch (node.kind) {
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return ts.isInJSFile(node) && ts.getJSDocEnumTag(node) ? 7 /* All */ : 1 /* Value */;
- case 151 /* Parameter */:
- case 186 /* BindingElement */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 275 /* PropertyAssignment */:
- case 276 /* ShorthandPropertyAssignment */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 274 /* CatchClause */:
- case 267 /* JsxAttribute */:
+ case 152 /* Parameter */:
+ case 187 /* BindingElement */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 276 /* PropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 275 /* CatchClause */:
+ case 268 /* JsxAttribute */:
return 1 /* Value */;
- case 150 /* TypeParameter */:
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 168 /* TypeLiteral */:
+ case 151 /* TypeParameter */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 169 /* TypeLiteral */:
return 2 /* Type */;
- case 309 /* JSDocTypedefTag */:
+ case 310 /* JSDocTypedefTag */:
// If it has no name node, it shares the name with the value declaration below it.
return node.name === undefined ? 1 /* Value */ | 2 /* Type */ : 2 /* Type */;
- case 278 /* EnumMember */:
- case 240 /* ClassDeclaration */:
+ case 279 /* EnumMember */:
+ case 241 /* ClassDeclaration */:
return 1 /* Value */ | 2 /* Type */;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
if (ts.isAmbientModule(node)) {
return 4 /* Namespace */ | 1 /* Value */;
}
@@ -95496,26 +96393,26 @@
else {
return 4 /* Namespace */;
}
- case 243 /* EnumDeclaration */:
- case 252 /* NamedImports */:
- case 253 /* ImportSpecifier */:
- case 248 /* ImportEqualsDeclaration */:
- case 249 /* ImportDeclaration */:
- case 254 /* ExportAssignment */:
- case 255 /* ExportDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 253 /* NamedImports */:
+ case 254 /* ImportSpecifier */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 255 /* ExportAssignment */:
+ case 256 /* ExportDeclaration */:
return 7 /* All */;
// An external module can be a Value
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return 4 /* Namespace */ | 1 /* Value */;
}
return 7 /* All */;
}
ts.getMeaningFromDeclaration = getMeaningFromDeclaration;
function getMeaningFromLocation(node) {
- if (node.kind === 284 /* SourceFile */) {
+ if (node.kind === 285 /* SourceFile */) {
return 1 /* Value */;
}
- else if (node.parent.kind === 254 /* ExportAssignment */ || node.parent.kind === 259 /* ExternalModuleReference */) {
+ else if (node.parent.kind === 255 /* ExportAssignment */ || node.parent.kind === 260 /* ExternalModuleReference */) {
return 7 /* All */;
}
else if (isInRightSideOfInternalImportEqualsDeclaration(node)) {
@@ -95547,11 +96444,11 @@
// import a = |b|; // Namespace
// import a = |b.c|; // Value, type, namespace
// import a = |b.c|.d; // Namespace
- var name = node.kind === 148 /* QualifiedName */ ? node : ts.isQualifiedName(node.parent) && node.parent.right === node ? node.parent : undefined;
- return name && name.parent.kind === 248 /* ImportEqualsDeclaration */ ? 7 /* All */ : 4 /* Namespace */;
+ var name = node.kind === 149 /* QualifiedName */ ? node : ts.isQualifiedName(node.parent) && node.parent.right === node ? node.parent : undefined;
+ return name && name.parent.kind === 249 /* ImportEqualsDeclaration */ ? 7 /* All */ : 4 /* Namespace */;
}
function isInRightSideOfInternalImportEqualsDeclaration(node) {
- while (node.parent.kind === 148 /* QualifiedName */) {
+ while (node.parent.kind === 149 /* QualifiedName */) {
node = node.parent;
}
return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node;
@@ -95563,27 +96460,27 @@
function isQualifiedNameNamespaceReference(node) {
var root = node;
var isLastClause = true;
- if (root.parent.kind === 148 /* QualifiedName */) {
- while (root.parent && root.parent.kind === 148 /* QualifiedName */) {
+ if (root.parent.kind === 149 /* QualifiedName */) {
+ while (root.parent && root.parent.kind === 149 /* QualifiedName */) {
root = root.parent;
}
isLastClause = root.right === node;
}
- return root.parent.kind === 164 /* TypeReference */ && !isLastClause;
+ return root.parent.kind === 165 /* TypeReference */ && !isLastClause;
}
function isPropertyAccessNamespaceReference(node) {
var root = node;
var isLastClause = true;
- if (root.parent.kind === 189 /* PropertyAccessExpression */) {
- while (root.parent && root.parent.kind === 189 /* PropertyAccessExpression */) {
+ if (root.parent.kind === 190 /* PropertyAccessExpression */) {
+ while (root.parent && root.parent.kind === 190 /* PropertyAccessExpression */) {
root = root.parent;
}
isLastClause = root.name === node;
}
- if (!isLastClause && root.parent.kind === 211 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 273 /* HeritageClause */) {
+ if (!isLastClause && root.parent.kind === 212 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 274 /* HeritageClause */) {
var decl = root.parent.parent.parent;
- return (decl.kind === 240 /* ClassDeclaration */ && root.parent.parent.token === 109 /* ImplementsKeyword */) ||
- (decl.kind === 241 /* InterfaceDeclaration */ && root.parent.parent.token === 86 /* ExtendsKeyword */);
+ return (decl.kind === 241 /* ClassDeclaration */ && root.parent.parent.token === 110 /* ImplementsKeyword */) ||
+ (decl.kind === 242 /* InterfaceDeclaration */ && root.parent.parent.token === 87 /* ExtendsKeyword */);
}
return false;
}
@@ -95592,17 +96489,17 @@
node = node.parent;
}
switch (node.kind) {
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
return !ts.isExpressionNode(node);
- case 178 /* ThisType */:
+ case 179 /* ThisType */:
return true;
}
switch (node.parent.kind) {
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return true;
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return !node.parent.isTypeOf;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent);
}
return false;
@@ -95629,7 +96526,7 @@
ts.climbPastPropertyAccess = climbPastPropertyAccess;
function getTargetLabel(referenceNode, labelName) {
while (referenceNode) {
- if (referenceNode.kind === 233 /* LabeledStatement */ && referenceNode.label.escapedText === labelName) {
+ if (referenceNode.kind === 234 /* LabeledStatement */ && referenceNode.label.escapedText === labelName) {
return referenceNode.label;
}
referenceNode = referenceNode.parent;
@@ -95645,11 +96542,11 @@
}
ts.hasPropertyAccessExpressionWithName = hasPropertyAccessExpressionWithName;
function isJumpStatementTarget(node) {
- return node.kind === 72 /* Identifier */ && ts.isBreakOrContinueStatement(node.parent) && node.parent.label === node;
+ return node.kind === 73 /* Identifier */ && ts.isBreakOrContinueStatement(node.parent) && node.parent.label === node;
}
ts.isJumpStatementTarget = isJumpStatementTarget;
function isLabelOfLabeledStatement(node) {
- return node.kind === 72 /* Identifier */ && ts.isLabeledStatement(node.parent) && node.parent.label === node;
+ return node.kind === 73 /* Identifier */ && ts.isLabeledStatement(node.parent) && node.parent.label === node;
}
ts.isLabelOfLabeledStatement = isLabelOfLabeledStatement;
function isLabelName(node) {
@@ -95661,40 +96558,40 @@
}
ts.isTagName = isTagName;
function isRightSideOfQualifiedName(node) {
- return node.parent.kind === 148 /* QualifiedName */ && node.parent.right === node;
+ return node.parent.kind === 149 /* QualifiedName */ && node.parent.right === node;
}
ts.isRightSideOfQualifiedName = isRightSideOfQualifiedName;
function isRightSideOfPropertyAccess(node) {
- return node && node.parent && node.parent.kind === 189 /* PropertyAccessExpression */ && node.parent.name === node;
+ return node && node.parent && node.parent.kind === 190 /* PropertyAccessExpression */ && node.parent.name === node;
}
ts.isRightSideOfPropertyAccess = isRightSideOfPropertyAccess;
function isNameOfModuleDeclaration(node) {
- return node.parent.kind === 244 /* ModuleDeclaration */ && node.parent.name === node;
+ return node.parent.kind === 245 /* ModuleDeclaration */ && node.parent.name === node;
}
ts.isNameOfModuleDeclaration = isNameOfModuleDeclaration;
function isNameOfFunctionDeclaration(node) {
- return node.kind === 72 /* Identifier */ &&
+ return node.kind === 73 /* Identifier */ &&
ts.isFunctionLike(node.parent) && node.parent.name === node;
}
ts.isNameOfFunctionDeclaration = isNameOfFunctionDeclaration;
function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) {
switch (node.parent.kind) {
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 275 /* PropertyAssignment */:
- case 278 /* EnumMember */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 244 /* ModuleDeclaration */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 276 /* PropertyAssignment */:
+ case 279 /* EnumMember */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 245 /* ModuleDeclaration */:
return ts.getNameOfDeclaration(node.parent) === node;
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return node.parent.argumentExpression === node;
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
return true;
- case 182 /* LiteralType */:
- return node.parent.parent.kind === 180 /* IndexedAccessType */;
+ case 183 /* LiteralType */:
+ return node.parent.parent.kind === 181 /* IndexedAccessType */;
default:
return false;
}
@@ -95718,17 +96615,17 @@
return undefined;
}
switch (node.kind) {
- case 284 /* SourceFile */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
- case 244 /* ModuleDeclaration */:
+ case 285 /* SourceFile */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 245 /* ModuleDeclaration */:
return node;
}
}
@@ -95736,48 +96633,48 @@
ts.getContainerNode = getContainerNode;
function getNodeKind(node) {
switch (node.kind) {
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return ts.isExternalModule(node) ? "module" /* moduleElement */ : "script" /* scriptElement */;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return "module" /* moduleElement */;
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
return "class" /* classElement */;
- case 241 /* InterfaceDeclaration */: return "interface" /* interfaceElement */;
- case 242 /* TypeAliasDeclaration */:
- case 302 /* JSDocCallbackTag */:
- case 309 /* JSDocTypedefTag */:
+ case 242 /* InterfaceDeclaration */: return "interface" /* interfaceElement */;
+ case 243 /* TypeAliasDeclaration */:
+ case 303 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
return "type" /* typeElement */;
- case 243 /* EnumDeclaration */: return "enum" /* enumElement */;
- case 237 /* VariableDeclaration */:
+ case 244 /* EnumDeclaration */: return "enum" /* enumElement */;
+ case 238 /* VariableDeclaration */:
return getKindOfVariableDeclaration(node);
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return getKindOfVariableDeclaration(ts.getRootDeclaration(node));
- case 197 /* ArrowFunction */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
return "function" /* functionElement */;
- case 158 /* GetAccessor */: return "getter" /* memberGetAccessorElement */;
- case 159 /* SetAccessor */: return "setter" /* memberSetAccessorElement */;
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 159 /* GetAccessor */: return "getter" /* memberGetAccessorElement */;
+ case 160 /* SetAccessor */: return "setter" /* memberSetAccessorElement */;
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
return "method" /* memberFunctionElement */;
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
return "property" /* memberVariableElement */;
- case 162 /* IndexSignature */: return "index" /* indexSignatureElement */;
- case 161 /* ConstructSignature */: return "construct" /* constructSignatureElement */;
- case 160 /* CallSignature */: return "call" /* callSignatureElement */;
- case 157 /* Constructor */: return "constructor" /* constructorImplementationElement */;
- case 150 /* TypeParameter */: return "type parameter" /* typeParameterElement */;
- case 278 /* EnumMember */: return "enum member" /* enumMemberElement */;
- case 151 /* Parameter */: return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) ? "property" /* memberVariableElement */ : "parameter" /* parameterElement */;
- case 248 /* ImportEqualsDeclaration */:
- case 253 /* ImportSpecifier */:
- case 257 /* ExportSpecifier */:
- case 251 /* NamespaceImport */:
+ case 163 /* IndexSignature */: return "index" /* indexSignatureElement */;
+ case 162 /* ConstructSignature */: return "construct" /* constructSignatureElement */;
+ case 161 /* CallSignature */: return "call" /* callSignatureElement */;
+ case 158 /* Constructor */: return "constructor" /* constructorImplementationElement */;
+ case 151 /* TypeParameter */: return "type parameter" /* typeParameterElement */;
+ case 279 /* EnumMember */: return "enum member" /* enumMemberElement */;
+ case 152 /* Parameter */: return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) ? "property" /* memberVariableElement */ : "parameter" /* parameterElement */;
+ case 249 /* ImportEqualsDeclaration */:
+ case 254 /* ImportSpecifier */:
+ case 258 /* ExportSpecifier */:
+ case 252 /* NamespaceImport */:
return "alias" /* alias */;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
var kind = ts.getAssignmentDeclarationKind(node);
var right = node.right;
switch (kind) {
@@ -95804,7 +96701,7 @@
return "" /* unknown */;
}
}
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return ts.isImportClause(node.parent) ? "alias" /* alias */ : "" /* unknown */;
default:
return "" /* unknown */;
@@ -95820,12 +96717,12 @@
ts.getNodeKind = getNodeKind;
function isThis(node) {
switch (node.kind) {
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
// case SyntaxKind.ThisType: TODO: GH#9267
return true;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
// 'this' as a parameter
- return ts.identifierIsThisKeyword(node) && node.parent.kind === 151 /* Parameter */;
+ return ts.identifierIsThisKeyword(node) && node.parent.kind === 152 /* Parameter */;
default:
return false;
}
@@ -95890,42 +96787,42 @@
return false;
}
switch (n.kind) {
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
- case 188 /* ObjectLiteralExpression */:
- case 184 /* ObjectBindingPattern */:
- case 168 /* TypeLiteral */:
- case 218 /* Block */:
- case 245 /* ModuleBlock */:
- case 246 /* CaseBlock */:
- case 252 /* NamedImports */:
- case 256 /* NamedExports */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 189 /* ObjectLiteralExpression */:
+ case 185 /* ObjectBindingPattern */:
+ case 169 /* TypeLiteral */:
+ case 219 /* Block */:
+ case 246 /* ModuleBlock */:
+ case 247 /* CaseBlock */:
+ case 253 /* NamedImports */:
+ case 257 /* NamedExports */:
return nodeEndsWith(n, 19 /* CloseBraceToken */, sourceFile);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return isCompletedNode(n.block, sourceFile);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
if (!n.arguments) {
return true;
}
// falls through
- case 191 /* CallExpression */:
- case 195 /* ParenthesizedExpression */:
- case 177 /* ParenthesizedType */:
+ case 192 /* CallExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 178 /* ParenthesizedType */:
return nodeEndsWith(n, 21 /* CloseParenToken */, sourceFile);
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
return isCompletedNode(n.type, sourceFile);
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 161 /* ConstructSignature */:
- case 160 /* CallSignature */:
- case 197 /* ArrowFunction */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 162 /* ConstructSignature */:
+ case 161 /* CallSignature */:
+ case 198 /* ArrowFunction */:
if (n.body) {
return isCompletedNode(n.body, sourceFile);
}
@@ -95935,65 +96832,65 @@
// Even though type parameters can be unclosed, we can get away with
// having at least a closing paren.
return hasChildOfKind(n, 21 /* CloseParenToken */, sourceFile);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return !!n.body && isCompletedNode(n.body, sourceFile);
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
if (n.elseStatement) {
return isCompletedNode(n.elseStatement, sourceFile);
}
return isCompletedNode(n.thenStatement, sourceFile);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return isCompletedNode(n.expression, sourceFile) ||
hasChildOfKind(n, 26 /* SemicolonToken */, sourceFile);
- case 187 /* ArrayLiteralExpression */:
- case 185 /* ArrayBindingPattern */:
- case 190 /* ElementAccessExpression */:
- case 149 /* ComputedPropertyName */:
- case 170 /* TupleType */:
+ case 188 /* ArrayLiteralExpression */:
+ case 186 /* ArrayBindingPattern */:
+ case 191 /* ElementAccessExpression */:
+ case 150 /* ComputedPropertyName */:
+ case 171 /* TupleType */:
return nodeEndsWith(n, 23 /* CloseBracketToken */, sourceFile);
- case 162 /* IndexSignature */:
+ case 163 /* IndexSignature */:
if (n.type) {
return isCompletedNode(n.type, sourceFile);
}
return hasChildOfKind(n, 23 /* CloseBracketToken */, sourceFile);
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
// there is no such thing as terminator token for CaseClause/DefaultClause so for simplicity always consider them non-completed
return false;
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 224 /* WhileStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 225 /* WhileStatement */:
return isCompletedNode(n.statement, sourceFile);
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
// rough approximation: if DoStatement has While keyword - then if node is completed is checking the presence of ')';
- return hasChildOfKind(n, 107 /* WhileKeyword */, sourceFile)
+ return hasChildOfKind(n, 108 /* WhileKeyword */, sourceFile)
? nodeEndsWith(n, 21 /* CloseParenToken */, sourceFile)
: isCompletedNode(n.statement, sourceFile);
- case 167 /* TypeQuery */:
+ case 168 /* TypeQuery */:
return isCompletedNode(n.exprName, sourceFile);
- case 199 /* TypeOfExpression */:
- case 198 /* DeleteExpression */:
- case 200 /* VoidExpression */:
- case 207 /* YieldExpression */:
- case 208 /* SpreadElement */:
+ case 200 /* TypeOfExpression */:
+ case 199 /* DeleteExpression */:
+ case 201 /* VoidExpression */:
+ case 208 /* YieldExpression */:
+ case 209 /* SpreadElement */:
var unaryWordExpression = n;
return isCompletedNode(unaryWordExpression.expression, sourceFile);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return isCompletedNode(n.template, sourceFile);
- case 206 /* TemplateExpression */:
+ case 207 /* TemplateExpression */:
var lastSpan = ts.lastOrUndefined(n.templateSpans);
return isCompletedNode(lastSpan, sourceFile);
- case 216 /* TemplateSpan */:
+ case 217 /* TemplateSpan */:
return ts.nodeIsPresent(n.literal);
- case 255 /* ExportDeclaration */:
- case 249 /* ImportDeclaration */:
+ case 256 /* ExportDeclaration */:
+ case 250 /* ImportDeclaration */:
return ts.nodeIsPresent(n.moduleSpecifier);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return isCompletedNode(n.operand, sourceFile);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return isCompletedNode(n.right, sourceFile);
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return isCompletedNode(n.whenFalse, sourceFile);
default:
return true;
@@ -96172,7 +97069,7 @@
}
}
}
- ts.Debug.assert(startNode !== undefined || n.kind === 284 /* SourceFile */ || n.kind === 1 /* EndOfFileToken */ || ts.isJSDocCommentContainingNode(n));
+ ts.Debug.assert(startNode !== undefined || n.kind === 285 /* SourceFile */ || n.kind === 1 /* EndOfFileToken */ || ts.isJSDocCommentContainingNode(n));
// Here we know that none of child token nodes embrace the position,
// the only known case is when position is at the end of the file.
// Try to find the rightmost token in the file without filtering.
@@ -96242,17 +97139,17 @@
return true;
}
// <div> { | </div> or <div a={| </div>
- if (token.kind === 28 /* LessThanToken */ && token.parent.kind === 270 /* JsxExpression */) {
+ if (token.kind === 28 /* LessThanToken */ && token.parent.kind === 271 /* JsxExpression */) {
return true;
}
// <div> {
// |
// } < /div>
- if (token && token.kind === 19 /* CloseBraceToken */ && token.parent.kind === 270 /* JsxExpression */) {
+ if (token && token.kind === 19 /* CloseBraceToken */ && token.parent.kind === 271 /* JsxExpression */) {
return true;
}
// <div>|</div>
- if (token.kind === 28 /* LessThanToken */ && token.parent.kind === 263 /* JsxClosingElement */) {
+ if (token.kind === 28 /* LessThanToken */ && token.parent.kind === 264 /* JsxClosingElement */) {
return true;
}
return false;
@@ -96371,15 +97268,15 @@
nTypeArguments++;
break;
case 37 /* EqualsGreaterThanToken */:
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
case 10 /* StringLiteral */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
- case 104 /* TypeOfKeyword */:
- case 86 /* ExtendsKeyword */:
- case 129 /* KeyOfKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
+ case 105 /* TypeOfKeyword */:
+ case 87 /* ExtendsKeyword */:
+ case 130 /* KeyOfKeyword */:
case 24 /* DotToken */:
case 50 /* BarToken */:
case 56 /* QuestionToken */:
@@ -96438,10 +97335,10 @@
}
ts.getNodeModifiers = getNodeModifiers;
function getTypeArgumentOrTypeParameterList(node) {
- if (node.kind === 164 /* TypeReference */ || node.kind === 191 /* CallExpression */) {
+ if (node.kind === 165 /* TypeReference */ || node.kind === 192 /* CallExpression */) {
return node.typeArguments;
}
- if (ts.isFunctionLike(node) || node.kind === 240 /* ClassDeclaration */ || node.kind === 241 /* InterfaceDeclaration */) {
+ if (ts.isFunctionLike(node) || node.kind === 241 /* ClassDeclaration */ || node.kind === 242 /* InterfaceDeclaration */) {
return node.typeParameters;
}
return undefined;
@@ -96461,7 +97358,7 @@
}
ts.isStringOrRegularExpressionOrTemplateLiteral = isStringOrRegularExpressionOrTemplateLiteral;
function isPunctuation(kind) {
- return 18 /* FirstPunctuation */ <= kind && kind <= 71 /* LastPunctuation */;
+ return 18 /* FirstPunctuation */ <= kind && kind <= 72 /* LastPunctuation */;
}
ts.isPunctuation = isPunctuation;
function isInsideTemplateLiteral(node, position, sourceFile) {
@@ -96471,9 +97368,9 @@
ts.isInsideTemplateLiteral = isInsideTemplateLiteral;
function isAccessibilityModifier(kind) {
switch (kind) {
- case 115 /* PublicKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
+ case 116 /* PublicKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
return true;
}
return false;
@@ -96486,18 +97383,18 @@
}
ts.cloneCompilerOptions = cloneCompilerOptions;
function isArrayLiteralOrObjectLiteralDestructuringPattern(node) {
- if (node.kind === 187 /* ArrayLiteralExpression */ ||
- node.kind === 188 /* ObjectLiteralExpression */) {
+ if (node.kind === 188 /* ArrayLiteralExpression */ ||
+ node.kind === 189 /* ObjectLiteralExpression */) {
// [a,b,c] from:
// [a, b, c] = someExpression;
- if (node.parent.kind === 204 /* BinaryExpression */ &&
+ if (node.parent.kind === 205 /* BinaryExpression */ &&
node.parent.left === node &&
- node.parent.operatorToken.kind === 59 /* EqualsToken */) {
+ node.parent.operatorToken.kind === 60 /* EqualsToken */) {
return true;
}
// [a, b, c] from:
// for([a, b, c] of expression)
- if (node.parent.kind === 227 /* ForOfStatement */ &&
+ if (node.parent.kind === 228 /* ForOfStatement */ &&
node.parent.initializer === node) {
return true;
}
@@ -96505,7 +97402,7 @@
// [x, [a, b, c] ] = someExpression
// or
// {x, a: {a, b, c} } = someExpression
- if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 275 /* PropertyAssignment */ ? node.parent.parent : node.parent)) {
+ if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 276 /* PropertyAssignment */ ? node.parent.parent : node.parent)) {
return true;
}
}
@@ -96549,22 +97446,22 @@
}
ts.createTextChange = createTextChange;
ts.typeKeywords = [
- 120 /* AnyKeyword */,
- 146 /* BigIntKeyword */,
- 123 /* BooleanKeyword */,
- 87 /* FalseKeyword */,
- 129 /* KeyOfKeyword */,
- 132 /* NeverKeyword */,
- 96 /* NullKeyword */,
- 135 /* NumberKeyword */,
- 136 /* ObjectKeyword */,
- 138 /* StringKeyword */,
- 139 /* SymbolKeyword */,
- 102 /* TrueKeyword */,
- 106 /* VoidKeyword */,
- 141 /* UndefinedKeyword */,
- 142 /* UniqueKeyword */,
- 143 /* UnknownKeyword */,
+ 121 /* AnyKeyword */,
+ 147 /* BigIntKeyword */,
+ 124 /* BooleanKeyword */,
+ 88 /* FalseKeyword */,
+ 130 /* KeyOfKeyword */,
+ 133 /* NeverKeyword */,
+ 97 /* NullKeyword */,
+ 136 /* NumberKeyword */,
+ 137 /* ObjectKeyword */,
+ 139 /* StringKeyword */,
+ 140 /* SymbolKeyword */,
+ 103 /* TrueKeyword */,
+ 107 /* VoidKeyword */,
+ 142 /* UndefinedKeyword */,
+ 143 /* UniqueKeyword */,
+ 144 /* UnknownKeyword */,
];
function isTypeKeyword(kind) {
return ts.contains(ts.typeKeywords, kind);
@@ -96600,7 +97497,7 @@
}
ts.skipConstraint = skipConstraint;
function getNameFromPropertyName(name) {
- return name.kind === 149 /* ComputedPropertyName */
+ return name.kind === 150 /* ComputedPropertyName */
// treat computed property names where expression is string/numeric literal as just string/numeric literal
? ts.isStringOrNumericLiteralLike(name.expression) ? name.expression.text : undefined
: ts.getTextOfIdentifierOrLiteral(name);
@@ -96676,7 +97573,7 @@
}
return ts.firstDefined(symbol.declarations, function (decl) {
var name = ts.getNameOfDeclaration(decl);
- return name && name.kind === 72 /* Identifier */ ? name.escapedText : undefined;
+ return name && name.kind === 73 /* Identifier */ ? name.escapedText : undefined;
});
}
ts.symbolEscapedNameNoDefault = symbolEscapedNameNoDefault;
@@ -96765,7 +97662,7 @@
/* @internal */
(function (ts) {
function isFirstDeclarationOfSymbolParameter(symbol) {
- return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 151 /* Parameter */;
+ return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 152 /* Parameter */;
}
ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter;
var displayPartWriter = getDisplayPartWriter();
@@ -97019,17 +97916,25 @@
return ts.ensureScriptKind(fileName, host && host.getScriptKind && host.getScriptKind(fileName));
}
ts.getScriptKind = getScriptKind;
- function getSymbolTarget(symbol) {
+ function getSymbolTarget(symbol, checker) {
var next = symbol;
- while (isTransientSymbol(next) && next.target) {
+ while (isAliasSymbol(next) || (isTransientSymbol(next) && next.target)) {
+ if (isTransientSymbol(next) && next.target) {
next = next.target;
}
+ else {
+ next = ts.skipAlias(next, checker);
+ }
+ }
return next;
}
ts.getSymbolTarget = getSymbolTarget;
function isTransientSymbol(symbol) {
return (symbol.flags & 33554432 /* Transient */) !== 0;
}
+ function isAliasSymbol(symbol) {
+ return (symbol.flags & 2097152 /* Alias */) !== 0;
+ }
function getUniqueSymbolId(symbol, checker) {
return ts.getSymbolId(ts.skipAlias(symbol, checker));
}
@@ -97065,7 +97970,14 @@
function getSynthesizedDeepCloneWithRenames(node, includeTrivia, renameMap, checker, callback) {
if (includeTrivia === void 0) { includeTrivia = true; }
var clone;
- if (ts.isIdentifier(node) && renameMap && checker) {
+ if (renameMap && checker && ts.isBindingElement(node) && ts.isIdentifier(node.name) && ts.isObjectBindingPattern(node.parent)) {
+ var symbol = checker.getSymbolAtLocation(node.name);
+ var renameInfo = symbol && renameMap.get(String(ts.getSymbolId(symbol)));
+ if (renameInfo && renameInfo.text !== (node.name || node.propertyName).getText()) {
+ clone = ts.createBindingElement(node.dotDotDotToken, node.propertyName || node.name, renameInfo, node.initializer);
+ }
+ }
+ else if (renameMap && checker && ts.isIdentifier(node)) {
var symbol = checker.getSymbolAtLocation(node);
var renameInfo = symbol && renameMap.get(String(ts.getSymbolId(symbol)));
if (renameInfo) {
@@ -97229,15 +98141,15 @@
function getContextualTypeFromParent(node, checker) {
var parent = node.parent;
switch (parent.kind) {
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return checker.getContextualType(parent);
- case 204 /* BinaryExpression */: {
+ case 205 /* BinaryExpression */: {
var _a = parent, left = _a.left, operatorToken = _a.operatorToken, right = _a.right;
return isEqualityOperatorKind(operatorToken.kind)
? checker.getTypeAtLocation(node === right ? left : right)
: checker.getContextualType(node);
}
- case 271 /* CaseClause */:
+ case 272 /* CaseClause */:
return parent.expression === node ? getSwitchedType(parent, checker) : undefined;
default:
return checker.getContextualType(node);
@@ -97279,8 +98191,8 @@
switch (node.kind) {
case 10 /* StringLiteral */:
case 14 /* NoSubstitutionTemplateLiteral */:
- case 206 /* TemplateExpression */:
- case 193 /* TaggedTemplateExpression */:
+ case 207 /* TemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return true;
default:
return false;
@@ -97323,7 +98235,7 @@
var ts;
(function (ts) {
function createClassifier() {
- var scanner = ts.createScanner(7 /* Latest */, /*skipTrivia*/ false);
+ var scanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false);
function getClassificationsForLine(text, lexState, syntacticClassifierAbsent) {
return convertClassificationsToResult(getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent), text);
}
@@ -97400,13 +98312,13 @@
function handleToken() {
switch (token) {
case 42 /* SlashToken */:
- case 64 /* SlashEqualsToken */:
+ case 65 /* SlashEqualsToken */:
if (!noRegexTable[lastNonTriviaToken] && scanner.reScanSlashToken() === 13 /* RegularExpressionLiteral */) {
token = 13 /* RegularExpressionLiteral */;
}
break;
case 28 /* LessThanToken */:
- if (lastNonTriviaToken === 72 /* Identifier */) {
+ if (lastNonTriviaToken === 73 /* Identifier */) {
// Could be the start of something generic. Keep track of that by bumping
// up the current count of generic contexts we may be in.
angleBracketStack++;
@@ -97419,16 +98331,16 @@
angleBracketStack--;
}
break;
- case 120 /* AnyKeyword */:
- case 138 /* StringKeyword */:
- case 135 /* NumberKeyword */:
- case 123 /* BooleanKeyword */:
- case 139 /* SymbolKeyword */:
+ case 121 /* AnyKeyword */:
+ case 139 /* StringKeyword */:
+ case 136 /* NumberKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 140 /* SymbolKeyword */:
if (angleBracketStack > 0 && !syntacticClassifierAbsent) {
// If it looks like we're could be in something generic, don't classify this
// as a keyword. We may just get overwritten by the syntactic classifier,
// causing a noisy experience for the user.
- token = 72 /* Identifier */;
+ token = 73 /* Identifier */;
}
break;
case 15 /* TemplateHead */:
@@ -97467,14 +98379,14 @@
break;
}
if (lastNonTriviaToken === 24 /* DotToken */) {
- token = 72 /* Identifier */;
+ token = 73 /* Identifier */;
}
else if (ts.isKeyword(lastNonTriviaToken) && ts.isKeyword(token) && !canFollow(lastNonTriviaToken, token)) {
// We have two keywords in a row. Only treat the second as a keyword if
// it's a sequence that could legally occur in the language. Otherwise
// treat it as an identifier. This way, if someone writes "private var"
// we recognize that 'var' is actually an identifier here.
- token = 72 /* Identifier */;
+ token = 73 /* Identifier */;
}
}
}
@@ -97488,19 +98400,19 @@
/// we have a series of divide operator. this list allows us to be more accurate by ruling out
/// locations where a regexp cannot exist.
var noRegexTable = ts.arrayToNumericMap([
- 72 /* Identifier */,
+ 73 /* Identifier */,
10 /* StringLiteral */,
8 /* NumericLiteral */,
9 /* BigIntLiteral */,
13 /* RegularExpressionLiteral */,
- 100 /* ThisKeyword */,
+ 101 /* ThisKeyword */,
44 /* PlusPlusToken */,
45 /* MinusMinusToken */,
21 /* CloseParenToken */,
23 /* CloseBracketToken */,
19 /* CloseBraceToken */,
- 102 /* TrueKeyword */,
- 87 /* FalseKeyword */,
+ 103 /* TrueKeyword */,
+ 88 /* FalseKeyword */,
], function (token) { return token; }, function () { return true; });
function getNewEndOfLineState(scanner, token, lastOnTemplateStack) {
switch (token) {
@@ -97612,10 +98524,10 @@
return true;
}
switch (keyword2) {
- case 126 /* GetKeyword */:
- case 137 /* SetKeyword */:
- case 124 /* ConstructorKeyword */:
- case 116 /* StaticKeyword */:
+ case 127 /* GetKeyword */:
+ case 138 /* SetKeyword */:
+ case 125 /* ConstructorKeyword */:
+ case 117 /* StaticKeyword */:
return true; // Allow things like "public get", "public constructor" and "public static".
default:
return false; // Any other keyword following "public" is actually an identifier, not a real keyword.
@@ -97660,9 +98572,9 @@
case 30 /* GreaterThanToken */:
case 31 /* LessThanEqualsToken */:
case 32 /* GreaterThanEqualsToken */:
- case 94 /* InstanceOfKeyword */:
- case 93 /* InKeyword */:
- case 119 /* AsKeyword */:
+ case 95 /* InstanceOfKeyword */:
+ case 94 /* InKeyword */:
+ case 120 /* AsKeyword */:
case 33 /* EqualsEqualsToken */:
case 34 /* ExclamationEqualsToken */:
case 35 /* EqualsEqualsEqualsToken */:
@@ -97672,18 +98584,18 @@
case 50 /* BarToken */:
case 54 /* AmpersandAmpersandToken */:
case 55 /* BarBarToken */:
- case 70 /* BarEqualsToken */:
- case 69 /* AmpersandEqualsToken */:
- case 71 /* CaretEqualsToken */:
- case 66 /* LessThanLessThanEqualsToken */:
- case 67 /* GreaterThanGreaterThanEqualsToken */:
- case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
- case 60 /* PlusEqualsToken */:
- case 61 /* MinusEqualsToken */:
- case 62 /* AsteriskEqualsToken */:
- case 64 /* SlashEqualsToken */:
- case 65 /* PercentEqualsToken */:
- case 59 /* EqualsToken */:
+ case 71 /* BarEqualsToken */:
+ case 70 /* AmpersandEqualsToken */:
+ case 72 /* CaretEqualsToken */:
+ case 67 /* LessThanLessThanEqualsToken */:
+ case 68 /* GreaterThanGreaterThanEqualsToken */:
+ case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
+ case 61 /* PlusEqualsToken */:
+ case 62 /* MinusEqualsToken */:
+ case 63 /* AsteriskEqualsToken */:
+ case 65 /* SlashEqualsToken */:
+ case 66 /* PercentEqualsToken */:
+ case 60 /* EqualsToken */:
case 27 /* CommaToken */:
return true;
default:
@@ -97710,7 +98622,7 @@
else if (isBinaryExpressionOperatorToken(token) || isPrefixUnaryExpressionOperatorToken(token)) {
return 5 /* operator */;
}
- else if (token >= 18 /* FirstPunctuation */ && token <= 71 /* LastPunctuation */) {
+ else if (token >= 18 /* FirstPunctuation */ && token <= 72 /* LastPunctuation */) {
return 10 /* punctuation */;
}
switch (token) {
@@ -97729,7 +98641,7 @@
case 5 /* WhitespaceTrivia */:
case 4 /* NewLineTrivia */:
return 8 /* whiteSpace */;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
default:
if (ts.isTemplateLiteralKind(token)) {
return 6 /* stringLiteral */;
@@ -97754,10 +98666,10 @@
// That means we're calling back into the host around every 1.2k of the file we process.
// Lib.d.ts has similar numbers.
switch (kind) {
- case 244 /* ModuleDeclaration */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 239 /* FunctionDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 240 /* FunctionDeclaration */:
cancellationToken.throwIfCancellationRequested();
}
}
@@ -97877,8 +98789,8 @@
var spanStart = span.start;
var spanLength = span.length;
// Make a scanner we can get trivia from.
- var triviaScanner = ts.createScanner(7 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
- var mergeConflictScanner = ts.createScanner(7 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
+ var triviaScanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
+ var mergeConflictScanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
var result = [];
processElement(sourceFile);
return { spans: result, endOfLineState: 0 /* None */ };
@@ -97970,18 +98882,18 @@
pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18 /* docCommentTagName */); // e.g. "param"
pos = tag.tagName.end;
switch (tag.kind) {
- case 304 /* JSDocParameterTag */:
+ case 305 /* JSDocParameterTag */:
processJSDocParameterTag(tag);
break;
- case 308 /* JSDocTemplateTag */:
+ case 309 /* JSDocTemplateTag */:
processJSDocTemplateTag(tag);
pos = tag.end;
break;
- case 307 /* JSDocTypeTag */:
+ case 308 /* JSDocTypeTag */:
processElement(tag.typeExpression);
pos = tag.end;
break;
- case 305 /* JSDocReturnTag */:
+ case 306 /* JSDocReturnTag */:
processElement(tag.typeExpression);
pos = tag.end;
break;
@@ -98068,22 +98980,22 @@
}
function tryClassifyJsxElementName(token) {
switch (token.parent && token.parent.kind) {
- case 262 /* JsxOpeningElement */:
+ case 263 /* JsxOpeningElement */:
if (token.parent.tagName === token) {
return 19 /* jsxOpenTagName */;
}
break;
- case 263 /* JsxClosingElement */:
+ case 264 /* JsxClosingElement */:
if (token.parent.tagName === token) {
return 20 /* jsxCloseTagName */;
}
break;
- case 261 /* JsxSelfClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
if (token.parent.tagName === token) {
return 21 /* jsxSelfClosingTagName */;
}
break;
- case 267 /* JsxAttribute */:
+ case 268 /* JsxAttribute */:
if (token.parent.name === token) {
return 22 /* jsxAttribute */;
}
@@ -98110,19 +99022,19 @@
if (ts.isPunctuation(tokenKind)) {
if (token) {
var parent = token.parent;
- if (tokenKind === 59 /* EqualsToken */) {
+ if (tokenKind === 60 /* EqualsToken */) {
// the '=' in a variable declaration is special cased here.
- if (parent.kind === 237 /* VariableDeclaration */ ||
- parent.kind === 154 /* PropertyDeclaration */ ||
- parent.kind === 151 /* Parameter */ ||
- parent.kind === 267 /* JsxAttribute */) {
+ if (parent.kind === 238 /* VariableDeclaration */ ||
+ parent.kind === 155 /* PropertyDeclaration */ ||
+ parent.kind === 152 /* Parameter */ ||
+ parent.kind === 268 /* JsxAttribute */) {
return 5 /* operator */;
}
}
- if (parent.kind === 204 /* BinaryExpression */ ||
- parent.kind === 202 /* PrefixUnaryExpression */ ||
- parent.kind === 203 /* PostfixUnaryExpression */ ||
- parent.kind === 205 /* ConditionalExpression */) {
+ if (parent.kind === 205 /* BinaryExpression */ ||
+ parent.kind === 203 /* PrefixUnaryExpression */ ||
+ parent.kind === 204 /* PostfixUnaryExpression */ ||
+ parent.kind === 206 /* ConditionalExpression */) {
return 5 /* operator */;
}
}
@@ -98136,7 +99048,7 @@
}
else if (tokenKind === 10 /* StringLiteral */) {
// TODO: GH#18217
- return token.parent.kind === 267 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */;
+ return token.parent.kind === 268 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */;
}
else if (tokenKind === 13 /* RegularExpressionLiteral */) {
// TODO: we should get another classification type for these literals.
@@ -98149,35 +99061,35 @@
else if (tokenKind === 11 /* JsxText */) {
return 23 /* jsxText */;
}
- else if (tokenKind === 72 /* Identifier */) {
+ else if (tokenKind === 73 /* Identifier */) {
if (token) {
switch (token.parent.kind) {
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
if (token.parent.name === token) {
return 11 /* className */;
}
return;
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
if (token.parent.name === token) {
return 15 /* typeParameterName */;
}
return;
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
if (token.parent.name === token) {
return 13 /* interfaceName */;
}
return;
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
if (token.parent.name === token) {
return 12 /* enumName */;
}
return;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
if (token.parent.name === token) {
return 14 /* moduleName */;
}
return;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
if (token.parent.name === token) {
return ts.isThisIdentifier(token) ? 3 /* keyword */ : 17 /* parameterName */;
}
@@ -98234,7 +99146,7 @@
return convertPathCompletions(completion.paths);
case 1 /* Properties */: {
var entries = [];
- Completions.getCompletionEntriesFromSymbols(completion.symbols, entries, sourceFile, sourceFile, checker, 7 /* ESNext */, log, 4 /* String */, preferences); // Target will not be used, so arbitrary
+ Completions.getCompletionEntriesFromSymbols(completion.symbols, entries, sourceFile, sourceFile, checker, 8 /* ESNext */, log, 4 /* String */, preferences); // Target will not be used, so arbitrary
return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: completion.hasIndexSignature, entries: entries };
}
case 2 /* Types */: {
@@ -98273,7 +99185,7 @@
var isNewIdentifierLocation = true; // The user may type in a path that doesn't yet exist, creating a "new identifier" with respect to the collection of identifiers the server is aware of.
var entries = pathCompletions.map(function (_a) {
var name = _a.name, kind = _a.kind, span = _a.span, extension = _a.extension;
- return ({ name: name, kind: kind, kindModifiers: kindModifiersFromExtension(extension), sortText: "0", replacementSpan: span });
+ return ({ name: name, kind: kind, kindModifiers: kindModifiersFromExtension(extension), sortText: Completions.SortText.LocationPriority, replacementSpan: span });
});
return { isGlobalCompletion: isGlobalCompletion, isMemberCompletion: false, isNewIdentifierLocation: isNewIdentifierLocation, entries: entries };
}
@@ -98300,11 +99212,11 @@
function getStringLiteralCompletionEntries(sourceFile, node, position, typeChecker, compilerOptions, host) {
var parent = node.parent;
switch (parent.kind) {
- case 182 /* LiteralType */:
+ case 183 /* LiteralType */:
switch (parent.parent.kind) {
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return { kind: 2 /* Types */, types: getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(parent)), isNewIdentifier: false };
- case 180 /* IndexedAccessType */:
+ case 181 /* IndexedAccessType */:
// Get all apparent property names
// i.e. interface Foo {
// foo: string;
@@ -98312,9 +99224,9 @@
// }
// let x: Foo["/*completion position*/"]
return stringLiteralCompletionsFromProperties(typeChecker.getTypeFromTypeNode(parent.parent.objectType));
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker) };
- case 173 /* UnionType */: {
+ case 174 /* UnionType */: {
if (!ts.isTypeReferenceNode(parent.parent.parent))
return undefined;
var alreadyUsedTypes_1 = getAlreadyUsedTypesInStringLiteralUnion(parent.parent, parent);
@@ -98324,7 +99236,7 @@
default:
return undefined;
}
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
if (ts.isObjectLiteralExpression(parent.parent) && parent.name === node) {
// Get quoted name of properties of the object literal expression
// i.e. interface ConfigFiles {
@@ -98341,7 +99253,7 @@
return stringLiteralCompletionsFromProperties(typeChecker.getContextualType(parent.parent));
}
return fromContextualType();
- case 190 /* ElementAccessExpression */: {
+ case 191 /* ElementAccessExpression */: {
var _a = parent, expression = _a.expression, argumentExpression = _a.argumentExpression;
if (node === argumentExpression) {
// Get all names of properties on the expression
@@ -98354,8 +99266,8 @@
}
return undefined;
}
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
if (!ts.isRequireCall(parent, /*checkArgumentIsStringLiteralLike*/ false) && !ts.isImportCall(parent)) {
var argumentInfo = ts.SignatureHelp.getArgumentInfoForCompletions(node, position, sourceFile);
// Get string literal completions from specialized signatures of the target
@@ -98364,9 +99276,9 @@
return argumentInfo ? getStringLiteralCompletionsFromSignature(argumentInfo, typeChecker) : fromContextualType();
}
// falls through (is `require("")` or `import("")`)
- case 249 /* ImportDeclaration */:
- case 255 /* ExportDeclaration */:
- case 259 /* ExternalModuleReference */:
+ case 250 /* ImportDeclaration */:
+ case 256 /* ExportDeclaration */:
+ case 260 /* ExternalModuleReference */:
// Get all known external module names or complete a path to a module
// i.e. import * as ns from "/*completion position*/";
// var y = import("/*completion position*/");
@@ -98813,7 +99725,7 @@
var offset = index !== -1 ? index + 1 : 0;
// If the range is an identifier, span is unnecessary.
var length = text.length - offset;
- return length === 0 || ts.isIdentifierText(text.substr(offset, length), 7 /* ESNext */) ? undefined : ts.createTextSpan(textStart + offset, length);
+ return length === 0 || ts.isIdentifierText(text.substr(offset, length), 8 /* ESNext */) ? undefined : ts.createTextSpan(textStart + offset, length);
}
// Returns true if the path is explicitly relative to the script (i.e. relative to . or ..)
function isPathRelativeToScript(path) {
@@ -98876,6 +99788,14 @@
(function (ts) {
var Completions;
(function (Completions) {
+ var SortText;
+ (function (SortText) {
+ SortText["LocationPriority"] = "0";
+ SortText["SuggestedClassMembers"] = "1";
+ SortText["GlobalsOrKeywords"] = "2";
+ SortText["AutoImportSuggestions"] = "3";
+ SortText["JavascriptIdentifiers"] = "4";
+ })(SortText = Completions.SortText || (Completions.SortText = {}));
var SymbolOriginInfoKind;
(function (SymbolOriginInfoKind) {
SymbolOriginInfoKind[SymbolOriginInfoKind["ThisType"] = 0] = "ThisType";
@@ -98910,14 +99830,15 @@
var typeChecker = program.getTypeChecker();
var compilerOptions = program.getCompilerOptions();
var contextToken = ts.findPrecedingToken(position, sourceFile);
- if (triggerCharacter && !isValidTrigger(sourceFile, triggerCharacter, contextToken, position))
+ if (triggerCharacter && !ts.isInString(sourceFile, position, contextToken) && !isValidTrigger(sourceFile, triggerCharacter, contextToken, position)) {
return undefined;
+ }
var stringCompletions = Completions.StringCompletions.getStringLiteralCompletions(sourceFile, position, contextToken, typeChecker, compilerOptions, host, log, preferences);
if (stringCompletions) {
return stringCompletions;
}
if (contextToken && ts.isBreakOrContinueStatement(contextToken.parent)
- && (contextToken.kind === 73 /* BreakKeyword */ || contextToken.kind === 78 /* ContinueKeyword */ || contextToken.kind === 72 /* Identifier */)) {
+ && (contextToken.kind === 74 /* BreakKeyword */ || contextToken.kind === 79 /* ContinueKeyword */ || contextToken.kind === 73 /* Identifier */)) {
return getLabelCompletionAtPosition(contextToken.parent);
}
var completionData = getCompletionData(program, log, sourceFile, isUncheckedFile(sourceFile, compilerOptions), position, preferences, /*detailsEntryId*/ undefined);
@@ -98944,7 +99865,7 @@
return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: entries };
}
function completionInfoFromData(sourceFile, typeChecker, compilerOptions, log, completionData, preferences) {
- var symbols = completionData.symbols, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, insideJsDocTagTypeExpression = completionData.insideJsDocTagTypeExpression;
+ var symbols = completionData.symbols, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, insideJsDocTagTypeExpression = completionData.insideJsDocTagTypeExpression, symbolToSortTextMap = completionData.symbolToSortTextMap;
if (location && location.parent && ts.isJsxClosingElement(location.parent)) {
// In the TypeScript JSX element, if such element is not defined. When users query for completion at closing tag,
// instead of simply giving unknown value, the completion will return the tag-name of an associated opening-element.
@@ -98958,20 +99879,20 @@
name: tagName.getFullText(sourceFile) + (hasClosingAngleBracket ? "" : ">"),
kind: "class" /* classElement */,
kindModifiers: undefined,
- sortText: "0",
+ sortText: SortText.LocationPriority,
};
return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: false, entries: [entry] };
}
var entries = [];
if (isUncheckedFile(sourceFile, compilerOptions)) {
- var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, sourceFile, typeChecker, compilerOptions.target, log, completionKind, preferences, propertyAccessToConvert, isJsxInitializer, recommendedCompletion, symbolToOriginInfoMap);
+ var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, sourceFile, typeChecker, compilerOptions.target, log, completionKind, preferences, propertyAccessToConvert, isJsxInitializer, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap);
getJSCompletionEntries(sourceFile, location.pos, uniqueNames, compilerOptions.target, entries); // TODO: GH#18217
}
else {
if (!isNewIdentifierLocation && (!symbols || symbols.length === 0) && keywordFilters === 0 /* None */) {
return undefined;
}
- getCompletionEntriesFromSymbols(symbols, entries, location, sourceFile, typeChecker, compilerOptions.target, log, completionKind, preferences, propertyAccessToConvert, isJsxInitializer, recommendedCompletion, symbolToOriginInfoMap);
+ getCompletionEntriesFromSymbols(symbols, entries, location, sourceFile, typeChecker, compilerOptions.target, log, completionKind, preferences, propertyAccessToConvert, isJsxInitializer, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap);
}
if (keywordFilters !== 0 /* None */) {
var entryNames = ts.arrayToSet(entries, function (e) { return e.name; });
@@ -99013,7 +99934,7 @@
name: realName,
kind: "warning" /* warning */,
kindModifiers: "",
- sortText: "1"
+ sortText: SortText.JavascriptIdentifiers
});
}
});
@@ -99022,14 +99943,9 @@
return typeof literal === "object" ? ts.pseudoBigIntToString(literal) + "n" : JSON.stringify(literal);
};
function createCompletionEntryForLiteral(literal) {
- return { name: completionNameForLiteral(literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: "0" };
+ return { name: completionNameForLiteral(literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority };
}
- function createCompletionEntry(symbol, location, sourceFile, typeChecker, target, kind, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, preferences) {
- var info = getCompletionEntryDisplayNameForSymbol(symbol, target, origin, kind);
- if (!info) {
- return undefined;
- }
- var name = info.name, needsConvertPropertyAccess = info.needsConvertPropertyAccess;
+ function createCompletionEntry(symbol, sortText, location, sourceFile, typeChecker, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, preferences) {
var insertText;
var replacementSpan;
if (origin && origin.kind === 0 /* ThisType */) {
@@ -99066,7 +99982,7 @@
name: name,
kind: ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, location),
kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol),
- sortText: "0",
+ sortText: sortText,
source: getSourceFromOrigin(origin),
hasAction: trueOrUndefined(!!origin && originIsExport(origin)),
isRecommended: trueOrUndefined(isRecommendedCompletionMatch(symbol, recommendedCompletion, typeChecker)),
@@ -99084,7 +100000,7 @@
function getSourceFromOrigin(origin) {
return origin && originIsExport(origin) ? ts.stripQuotes(origin.moduleSymbol.name) : undefined;
}
- function getCompletionEntriesFromSymbols(symbols, entries, location, sourceFile, typeChecker, target, log, kind, preferences, propertyAccessToConvert, isJsxInitializer, recommendedCompletion, symbolToOriginInfoMap) {
+ function getCompletionEntriesFromSymbols(symbols, entries, location, sourceFile, typeChecker, target, log, kind, preferences, propertyAccessToConvert, isJsxInitializer, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap) {
var start = ts.timestamp();
// Tracks unique names.
// We don't set this for global variables or completions from external module exports, because we can have multiple of those.
@@ -99094,14 +100010,18 @@
for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) {
var symbol = symbols_1[_i];
var origin = symbolToOriginInfoMap ? symbolToOriginInfoMap[ts.getSymbolId(symbol)] : undefined;
- var entry = createCompletionEntry(symbol, location, sourceFile, typeChecker, target, kind, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, preferences);
- if (!entry) {
+ var info = getCompletionEntryDisplayNameForSymbol(symbol, target, origin, kind);
+ if (!info) {
continue;
}
- var name = entry.name;
+ var name = info.name, needsConvertPropertyAccess = info.needsConvertPropertyAccess;
if (uniques.has(name)) {
continue;
}
+ var entry = createCompletionEntry(symbol, symbolToSortTextMap && symbolToSortTextMap[ts.getSymbolId(symbol)] || SortText.LocationPriority, location, sourceFile, typeChecker, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, preferences);
+ if (!entry) {
+ continue;
+ }
// Latter case tests whether this is a global variable.
if (!origin && !(symbol.parent === undefined && !ts.some(symbol.declarations, function (d) { return d.getSourceFile() === location.getSourceFile(); }))) { // TODO: GH#18217
uniques.set(name, true);
@@ -99134,7 +100054,7 @@
name: name,
kindModifiers: "" /* none */,
kind: "label" /* label */,
- sortText: "0"
+ sortText: SortText.LocationPriority
});
}
}
@@ -99274,25 +100194,25 @@
function getContextualType(previousToken, position, sourceFile, checker) {
var parent = previousToken.parent;
switch (previousToken.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return ts.getContextualTypeFromParent(previousToken, checker);
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
switch (parent.kind) {
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return checker.getContextualType(parent.initializer); // TODO: GH#18217
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return checker.getTypeAtLocation(parent.left);
- case 267 /* JsxAttribute */:
+ case 268 /* JsxAttribute */:
return checker.getContextualTypeForJsxAttribute(parent);
default:
return undefined;
}
- case 95 /* NewKeyword */:
+ case 96 /* NewKeyword */:
return checker.getContextualType(parent);
- case 74 /* CaseKeyword */:
+ case 75 /* CaseKeyword */:
return ts.getSwitchedType(ts.cast(parent, ts.isCaseClause), checker);
case 18 /* OpenBraceToken */:
- return ts.isJsxExpression(parent) && parent.parent.kind !== 260 /* JsxElement */ ? checker.getContextualTypeForJsxAttribute(parent.parent) : undefined;
+ return ts.isJsxExpression(parent) && parent.parent.kind !== 261 /* JsxElement */ ? checker.getContextualTypeForJsxAttribute(parent.parent) : undefined;
default:
var argInfo = ts.SignatureHelp.getArgumentInfoForCompletions(previousToken, position, sourceFile);
return argInfo
@@ -99311,7 +100231,7 @@
return symbol.parent && (isModuleSymbol(symbol.parent) ? symbol : getFirstSymbolInChain(symbol.parent, enclosingDeclaration, checker));
}
function isModuleSymbol(symbol) {
- return symbol.declarations.some(function (d) { return d.kind === 284 /* SourceFile */; });
+ return symbol.declarations.some(function (d) { return d.kind === 285 /* SourceFile */; });
}
function getCompletionData(program, log, sourceFile, isUncheckedFile, position, preferences, detailsEntryId) {
var typeChecker = program.getTypeChecker();
@@ -99362,11 +100282,11 @@
if (tag.tagName.pos <= position && position <= tag.tagName.end) {
return { kind: 1 /* JsDocTagName */ };
}
- if (isTagWithTypeExpression(tag) && tag.typeExpression && tag.typeExpression.kind === 288 /* JSDocTypeExpression */) {
+ if (isTagWithTypeExpression(tag) && tag.typeExpression && tag.typeExpression.kind === 289 /* JSDocTypeExpression */) {
currentToken = ts.getTokenAtPosition(sourceFile, position);
if (!currentToken ||
(!ts.isDeclarationName(currentToken) &&
- (currentToken.parent.kind !== 310 /* JSDocPropertyTag */ ||
+ (currentToken.parent.kind !== 311 /* JSDocPropertyTag */ ||
currentToken.parent.name !== currentToken))) {
// Use as type location if inside tag's type expression
insideJsDocTagTypeExpression = isCurrentlyEditingNode(tag.typeExpression);
@@ -99416,7 +100336,7 @@
if (contextToken.kind === 24 /* DotToken */) {
isRightOfDot = true;
switch (parent.kind) {
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
propertyAccessToConvert = parent;
node = propertyAccessToConvert.expression;
if (node.end === contextToken.pos &&
@@ -99428,14 +100348,14 @@
return undefined;
}
break;
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
node = parent.left;
break;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
node = parent.name;
break;
- case 183 /* ImportType */:
- case 214 /* MetaProperty */:
+ case 184 /* ImportType */:
+ case 215 /* MetaProperty */:
node = parent;
break;
default:
@@ -99448,7 +100368,7 @@
// <UI.Test /* completion position */ />
// If the tagname is a property access expression, we will then walk up to the top most of property access expression.
// Then, try to get a JSX container and its associated attributes type.
- if (parent && parent.kind === 189 /* PropertyAccessExpression */) {
+ if (parent && parent.kind === 190 /* PropertyAccessExpression */) {
contextToken = parent;
parent = parent.parent;
}
@@ -99456,48 +100376,48 @@
if (currentToken.parent === location) {
switch (currentToken.kind) {
case 30 /* GreaterThanToken */:
- if (currentToken.parent.kind === 260 /* JsxElement */ || currentToken.parent.kind === 262 /* JsxOpeningElement */) {
+ if (currentToken.parent.kind === 261 /* JsxElement */ || currentToken.parent.kind === 263 /* JsxOpeningElement */) {
location = currentToken;
}
break;
case 42 /* SlashToken */:
- if (currentToken.parent.kind === 261 /* JsxSelfClosingElement */) {
+ if (currentToken.parent.kind === 262 /* JsxSelfClosingElement */) {
location = currentToken;
}
break;
}
}
switch (parent.kind) {
- case 263 /* JsxClosingElement */:
+ case 264 /* JsxClosingElement */:
if (contextToken.kind === 42 /* SlashToken */) {
isStartingCloseTag = true;
location = contextToken;
}
break;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
if (!binaryExpressionMayBeOpenTag(parent)) {
break;
}
// falls through
- case 261 /* JsxSelfClosingElement */:
- case 260 /* JsxElement */:
- case 262 /* JsxOpeningElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 261 /* JsxElement */:
+ case 263 /* JsxOpeningElement */:
if (contextToken.kind === 28 /* LessThanToken */) {
isRightOfOpenTag = true;
location = contextToken;
}
break;
- case 267 /* JsxAttribute */:
+ case 268 /* JsxAttribute */:
switch (previousToken.kind) {
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
isJsxInitializer = true;
break;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
// For `<div x=[|f/**/|]`, `parent` will be `x` and `previousToken.parent` will be `f` (which is its own JsxAttribute)
// Note for `<div someBool f>` we don't want to treat this as a jsx inializer, instead it's the attribute name.
if (parent !== previousToken.parent &&
!parent.initializer &&
- ts.findChildOfKind(parent, 59 /* EqualsToken */, sourceFile)) {
+ ts.findChildOfKind(parent, 60 /* EqualsToken */, sourceFile)) {
isJsxInitializer = previousToken;
}
}
@@ -99511,6 +100431,7 @@
var keywordFilters = 0 /* None */;
var symbols = [];
var symbolToOriginInfoMap = [];
+ var symbolToSortTextMap = [];
if (isRightOfDot) {
getTypeScriptMemberSymbols();
}
@@ -99556,15 +100477,16 @@
recommendedCompletion: recommendedCompletion,
previousToken: previousToken,
isJsxInitializer: isJsxInitializer,
- insideJsDocTagTypeExpression: insideJsDocTagTypeExpression
+ insideJsDocTagTypeExpression: insideJsDocTagTypeExpression,
+ symbolToSortTextMap: symbolToSortTextMap
};
function isTagWithTypeExpression(tag) {
switch (tag.kind) {
- case 304 /* JSDocParameterTag */:
- case 310 /* JSDocPropertyTag */:
- case 305 /* JSDocReturnTag */:
- case 307 /* JSDocTypeTag */:
- case 309 /* JSDocTypedefTag */:
+ case 305 /* JSDocParameterTag */:
+ case 311 /* JSDocPropertyTag */:
+ case 306 /* JSDocReturnTag */:
+ case 308 /* JSDocTypeTag */:
+ case 310 /* JSDocTypedefTag */:
return true;
default:
return false;
@@ -99606,15 +100528,15 @@
// If the module is merged with a value, we must get the type of the class and add its propertes (for inherited static methods).
if (!isTypeLocation &&
symbol.declarations &&
- symbol.declarations.some(function (d) { return d.kind !== 284 /* SourceFile */ && d.kind !== 244 /* ModuleDeclaration */ && d.kind !== 243 /* EnumDeclaration */; })) {
+ symbol.declarations.some(function (d) { return d.kind !== 285 /* SourceFile */ && d.kind !== 245 /* ModuleDeclaration */ && d.kind !== 244 /* EnumDeclaration */; })) {
addTypeProperties(typeChecker.getTypeOfSymbolAtLocation(symbol, node));
}
return;
}
}
}
- if (ts.isMetaProperty(node) && (node.keywordToken === 95 /* NewKeyword */ || node.keywordToken === 92 /* ImportKeyword */)) {
- var completion = (node.keywordToken === 95 /* NewKeyword */) ? "target" : "meta";
+ if (ts.isMetaProperty(node) && (node.keywordToken === 96 /* NewKeyword */ || node.keywordToken === 93 /* ImportKeyword */)) {
+ var completion = (node.keywordToken === 96 /* NewKeyword */) ? "target" : "meta";
symbols.push(typeChecker.createSymbol(4 /* Property */, ts.escapeLeadingUnderscores(completion)));
return;
}
@@ -99635,7 +100557,7 @@
else {
for (var _i = 0, _a = type.getApparentProperties(); _i < _a.length; _i++) {
var symbol = _a[_i];
- if (typeChecker.isValidPropertyAccessForCompletions(node.kind === 183 /* ImportType */ ? node : node.parent, type, symbol)) {
+ if (typeChecker.isValidPropertyAccessForCompletions(node.kind === 184 /* ImportType */ ? node : node.parent, type, symbol)) {
addPropertySymbol(symbol);
}
}
@@ -99738,14 +100660,22 @@
var isTypeOnly = isTypeOnlyCompletion();
var symbolMeanings = (isTypeOnly ? 0 /* None */ : 67220415 /* Value */) | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */;
symbols = ts.Debug.assertEachDefined(typeChecker.getSymbolsInScope(scopeNode, symbolMeanings), "getSymbolsInScope() should all be defined");
+ for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) {
+ var symbol = symbols_2[_i];
+ if (!typeChecker.isArgumentsSymbol(symbol) &&
+ !ts.some(symbol.declarations, function (d) { return d.getSourceFile() === sourceFile; })) {
+ symbolToSortTextMap[ts.getSymbolId(symbol)] = SortText.GlobalsOrKeywords;
+ }
+ }
// Need to insert 'this.' before properties of `this` type, so only do that if `includeInsertTextCompletions`
- if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 284 /* SourceFile */) {
+ if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 285 /* SourceFile */) {
var thisType = typeChecker.tryGetThisTypeAt(scopeNode, /*includeGlobalThis*/ false);
if (thisType) {
- for (var _i = 0, _a = getPropertiesForCompletion(thisType, typeChecker); _i < _a.length; _i++) {
- var symbol = _a[_i];
+ for (var _a = 0, _b = getPropertiesForCompletion(thisType, typeChecker); _a < _b.length; _a++) {
+ var symbol = _b[_a];
symbolToOriginInfoMap[ts.getSymbolId(symbol)] = { kind: 0 /* ThisType */ };
symbols.push(symbol);
+ symbolToSortTextMap[ts.getSymbolId(symbol)] = SortText.SuggestedClassMembers;
}
}
}
@@ -99772,10 +100702,10 @@
}
function isSnippetScope(scopeNode) {
switch (scopeNode.kind) {
- case 284 /* SourceFile */:
- case 206 /* TemplateExpression */:
- case 270 /* JsxExpression */:
- case 218 /* Block */:
+ case 285 /* SourceFile */:
+ case 207 /* TemplateExpression */:
+ case 271 /* JsxExpression */:
+ case 219 /* Block */:
return true;
default:
return ts.isStatement(scopeNode);
@@ -99814,25 +100744,25 @@
}
function isContextTokenValueLocation(contextToken) {
return contextToken &&
- contextToken.kind === 104 /* TypeOfKeyword */ &&
- (contextToken.parent.kind === 167 /* TypeQuery */ || ts.isTypeOfExpression(contextToken.parent));
+ contextToken.kind === 105 /* TypeOfKeyword */ &&
+ (contextToken.parent.kind === 168 /* TypeQuery */ || ts.isTypeOfExpression(contextToken.parent));
}
function isContextTokenTypeLocation(contextToken) {
if (contextToken) {
var parentKind = contextToken.parent.kind;
switch (contextToken.kind) {
case 57 /* ColonToken */:
- return parentKind === 154 /* PropertyDeclaration */ ||
- parentKind === 153 /* PropertySignature */ ||
- parentKind === 151 /* Parameter */ ||
- parentKind === 237 /* VariableDeclaration */ ||
+ return parentKind === 155 /* PropertyDeclaration */ ||
+ parentKind === 154 /* PropertySignature */ ||
+ parentKind === 152 /* Parameter */ ||
+ parentKind === 238 /* VariableDeclaration */ ||
ts.isFunctionLikeKind(parentKind);
- case 59 /* EqualsToken */:
- return parentKind === 242 /* TypeAliasDeclaration */;
- case 119 /* AsKeyword */:
- return parentKind === 212 /* AsExpression */;
- case 86 /* ExtendsKeyword */:
- return parentKind === 150 /* TypeParameter */;
+ case 60 /* EqualsToken */:
+ return parentKind === 243 /* TypeAliasDeclaration */;
+ case 120 /* AsKeyword */:
+ return parentKind === 213 /* AsExpression */;
+ case 87 /* ExtendsKeyword */:
+ return parentKind === 151 /* TypeParameter */;
}
}
return false;
@@ -99864,6 +100794,7 @@
// So in `declare namespace foo {} declare module "foo" { export = foo; }`, there will just be the global completion for `foo`.
ts.some(resolvedModuleSymbol.declarations, function (d) { return !!d.getSourceFile().externalModuleIndicator; })) {
symbols.push(resolvedModuleSymbol);
+ symbolToSortTextMap[ts.getSymbolId(resolvedModuleSymbol)] = SortText.AutoImportSuggestions;
symbolToOriginInfoMap[ts.getSymbolId(resolvedModuleSymbol)] = { kind: 3 /* Export */, moduleSymbol: moduleSymbol, isDefaultExport: false };
}
for (var _i = 0, _a = typeChecker.getExportsOfModule(moduleSymbol); _i < _a.length; _i++) {
@@ -99888,6 +100819,7 @@
var origin = { kind: 3 /* Export */, moduleSymbol: moduleSymbol, isDefaultExport: isDefaultExport };
if (detailsEntryId || stringContainsCharactersInOrder(getSymbolName(symbol, origin, target).toLowerCase(), tokenTextLowerCase)) {
symbols.push(symbol);
+ symbolToSortTextMap[ts.getSymbolId(symbol)] = SortText.AutoImportSuggestions;
symbolToOriginInfoMap[ts.getSymbolId(symbol)] = origin;
}
}
@@ -99939,11 +100871,11 @@
return true;
}
if (contextToken.kind === 30 /* GreaterThanToken */ && contextToken.parent) {
- if (contextToken.parent.kind === 262 /* JsxOpeningElement */) {
+ if (contextToken.parent.kind === 263 /* JsxOpeningElement */) {
return true;
}
- if (contextToken.parent.kind === 263 /* JsxClosingElement */ || contextToken.parent.kind === 261 /* JsxSelfClosingElement */) {
- return !!contextToken.parent.parent && contextToken.parent.parent.kind === 260 /* JsxElement */;
+ if (contextToken.parent.kind === 264 /* JsxClosingElement */ || contextToken.parent.kind === 262 /* JsxSelfClosingElement */) {
+ return !!contextToken.parent.parent && contextToken.parent.parent.kind === 261 /* JsxElement */;
}
}
return false;
@@ -99954,40 +100886,40 @@
// Previous token may have been a keyword that was converted to an identifier.
switch (keywordForNode(previousToken)) {
case 27 /* CommaToken */:
- return containingNodeKind === 191 /* CallExpression */ // func( a, |
- || containingNodeKind === 157 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */
- || containingNodeKind === 192 /* NewExpression */ // new C(a, |
- || containingNodeKind === 187 /* ArrayLiteralExpression */ // [a, |
- || containingNodeKind === 204 /* BinaryExpression */ // const x = (a, |
- || containingNodeKind === 165 /* FunctionType */; // var x: (s: string, list|
+ return containingNodeKind === 192 /* CallExpression */ // func( a, |
+ || containingNodeKind === 158 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */
+ || containingNodeKind === 193 /* NewExpression */ // new C(a, |
+ || containingNodeKind === 188 /* ArrayLiteralExpression */ // [a, |
+ || containingNodeKind === 205 /* BinaryExpression */ // const x = (a, |
+ || containingNodeKind === 166 /* FunctionType */; // var x: (s: string, list|
case 20 /* OpenParenToken */:
- return containingNodeKind === 191 /* CallExpression */ // func( |
- || containingNodeKind === 157 /* Constructor */ // constructor( |
- || containingNodeKind === 192 /* NewExpression */ // new C(a|
- || containingNodeKind === 195 /* ParenthesizedExpression */ // const x = (a|
- || containingNodeKind === 177 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */
+ return containingNodeKind === 192 /* CallExpression */ // func( |
+ || containingNodeKind === 158 /* Constructor */ // constructor( |
+ || containingNodeKind === 193 /* NewExpression */ // new C(a|
+ || containingNodeKind === 196 /* ParenthesizedExpression */ // const x = (a|
+ || containingNodeKind === 178 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */
case 22 /* OpenBracketToken */:
- return containingNodeKind === 187 /* ArrayLiteralExpression */ // [ |
- || containingNodeKind === 162 /* IndexSignature */ // [ | : string ]
- || containingNodeKind === 149 /* ComputedPropertyName */; // [ | /* this can become an index signature */
- case 130 /* ModuleKeyword */: // module |
- case 131 /* NamespaceKeyword */: // namespace |
+ return containingNodeKind === 188 /* ArrayLiteralExpression */ // [ |
+ || containingNodeKind === 163 /* IndexSignature */ // [ | : string ]
+ || containingNodeKind === 150 /* ComputedPropertyName */; // [ | /* this can become an index signature */
+ case 131 /* ModuleKeyword */: // module |
+ case 132 /* NamespaceKeyword */: // namespace |
return true;
case 24 /* DotToken */:
- return containingNodeKind === 244 /* ModuleDeclaration */; // module A.|
+ return containingNodeKind === 245 /* ModuleDeclaration */; // module A.|
case 18 /* OpenBraceToken */:
- return containingNodeKind === 240 /* ClassDeclaration */; // class A{ |
- case 59 /* EqualsToken */:
- return containingNodeKind === 237 /* VariableDeclaration */ // const x = a|
- || containingNodeKind === 204 /* BinaryExpression */; // x = a|
+ return containingNodeKind === 241 /* ClassDeclaration */; // class A{ |
+ case 60 /* EqualsToken */:
+ return containingNodeKind === 238 /* VariableDeclaration */ // const x = a|
+ || containingNodeKind === 205 /* BinaryExpression */; // x = a|
case 15 /* TemplateHead */:
- return containingNodeKind === 206 /* TemplateExpression */; // `aa ${|
+ return containingNodeKind === 207 /* TemplateExpression */; // `aa ${|
case 16 /* TemplateMiddle */:
- return containingNodeKind === 216 /* TemplateSpan */; // `aa ${10} dd ${|
- case 115 /* PublicKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- return containingNodeKind === 154 /* PropertyDeclaration */; // class A{ public |
+ return containingNodeKind === 217 /* TemplateSpan */; // `aa ${10} dd ${|
+ case 116 /* PublicKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ return containingNodeKind === 155 /* PropertyDeclaration */; // class A{ public |
}
}
return false;
@@ -100014,7 +100946,7 @@
completionKind = 0 /* ObjectPropertyDeclaration */;
var typeMembers;
var existingMembers;
- if (objectLikeContainer.kind === 188 /* ObjectLiteralExpression */) {
+ if (objectLikeContainer.kind === 189 /* ObjectLiteralExpression */) {
var typeForObject = typeChecker.getContextualType(objectLikeContainer);
if (!typeForObject)
return 2 /* Fail */;
@@ -100023,7 +100955,7 @@
existingMembers = objectLikeContainer.properties;
}
else {
- ts.Debug.assert(objectLikeContainer.kind === 184 /* ObjectBindingPattern */);
+ ts.Debug.assert(objectLikeContainer.kind === 185 /* ObjectBindingPattern */);
// We are *only* completing on properties from the type being destructured.
isNewIdentifierLocation = false;
var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent);
@@ -100034,12 +100966,12 @@
// through type declaration or inference.
// Also proceed if rootDeclaration is a parameter and if its containing function expression/arrow function is contextually typed -
// type of parameter will flow in from the contextual type of the function
- var canGetType = ts.hasInitializer(rootDeclaration) || ts.hasType(rootDeclaration) || rootDeclaration.parent.parent.kind === 227 /* ForOfStatement */;
- if (!canGetType && rootDeclaration.kind === 151 /* Parameter */) {
+ var canGetType = ts.hasInitializer(rootDeclaration) || ts.hasType(rootDeclaration) || rootDeclaration.parent.parent.kind === 228 /* ForOfStatement */;
+ if (!canGetType && rootDeclaration.kind === 152 /* Parameter */) {
if (ts.isExpression(rootDeclaration.parent)) {
canGetType = !!typeChecker.getContextualType(rootDeclaration.parent);
}
- else if (rootDeclaration.parent.kind === 156 /* MethodDeclaration */ || rootDeclaration.parent.kind === 159 /* SetAccessor */) {
+ else if (rootDeclaration.parent.kind === 157 /* MethodDeclaration */ || rootDeclaration.parent.kind === 160 /* SetAccessor */) {
canGetType = ts.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent);
}
}
@@ -100081,7 +101013,7 @@
return 0 /* Continue */;
// cursor is in an import clause
// try to show exported member for imported module
- var moduleSpecifier = (namedImportsOrExports.kind === 252 /* NamedImports */ ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent).moduleSpecifier;
+ var moduleSpecifier = (namedImportsOrExports.kind === 253 /* NamedImports */ ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent).moduleSpecifier;
var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(moduleSpecifier); // TODO: GH#18217
if (!moduleSpecifierSymbol)
return 2 /* Fail */;
@@ -100112,7 +101044,7 @@
var classElement = contextToken.parent;
var classElementModifierFlags = ts.isClassElement(classElement) ? ts.getModifierFlags(classElement) : 0 /* None */;
// If this is context token is not something we are editing now, consider if this would lead to be modifier
- if (contextToken.kind === 72 /* Identifier */ && !isCurrentlyEditingNode(contextToken)) {
+ if (contextToken.kind === 73 /* Identifier */ && !isCurrentlyEditingNode(contextToken)) {
switch (contextToken.getText()) {
case "private":
classElementModifierFlags = classElementModifierFlags | 8 /* Private */;
@@ -100149,7 +101081,7 @@
break;
case 40 /* AsteriskToken */:
return ts.isMethodDeclaration(parent) ? ts.tryCast(parent.parent, ts.isObjectLiteralExpression) : undefined;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return contextToken.text === "async" && ts.isShorthandPropertyAssignment(contextToken.parent)
? contextToken.parent.parent : undefined;
}
@@ -100202,12 +101134,12 @@
case 30 /* GreaterThanToken */: // End of a type argument list
case 29 /* LessThanSlashToken */:
case 42 /* SlashToken */:
- case 72 /* Identifier */:
- case 189 /* PropertyAccessExpression */:
- case 268 /* JsxAttributes */:
- case 267 /* JsxAttribute */:
- case 269 /* JsxSpreadAttribute */:
- if (parent && (parent.kind === 261 /* JsxSelfClosingElement */ || parent.kind === 262 /* JsxOpeningElement */)) {
+ case 73 /* Identifier */:
+ case 190 /* PropertyAccessExpression */:
+ case 269 /* JsxAttributes */:
+ case 268 /* JsxAttribute */:
+ case 270 /* JsxSpreadAttribute */:
+ if (parent && (parent.kind === 262 /* JsxSelfClosingElement */ || parent.kind === 263 /* JsxOpeningElement */)) {
if (contextToken.kind === 30 /* GreaterThanToken */) {
var precedingToken = ts.findPrecedingToken(contextToken.pos, sourceFile, /*startNode*/ undefined);
if (!parent.typeArguments || (precedingToken && precedingToken.kind === 42 /* SlashToken */))
@@ -100215,7 +101147,7 @@
}
return parent;
}
- else if (parent.kind === 267 /* JsxAttribute */) {
+ else if (parent.kind === 268 /* JsxAttribute */) {
// Currently we parse JsxOpeningLikeElement as:
// JsxOpeningLikeElement
// attributes: JsxAttributes
@@ -100227,7 +101159,7 @@
// its parent is a JsxExpression, whose parent is a JsxAttribute,
// whose parent is a JsxOpeningLikeElement
case 10 /* StringLiteral */:
- if (parent && ((parent.kind === 267 /* JsxAttribute */) || (parent.kind === 269 /* JsxSpreadAttribute */))) {
+ if (parent && ((parent.kind === 268 /* JsxAttribute */) || (parent.kind === 270 /* JsxSpreadAttribute */))) {
// Currently we parse JsxOpeningLikeElement as:
// JsxOpeningLikeElement
// attributes: JsxAttributes
@@ -100237,8 +101169,8 @@
break;
case 19 /* CloseBraceToken */:
if (parent &&
- parent.kind === 270 /* JsxExpression */ &&
- parent.parent && parent.parent.kind === 267 /* JsxAttribute */) {
+ parent.kind === 271 /* JsxExpression */ &&
+ parent.parent && parent.parent.kind === 268 /* JsxAttribute */) {
// Currently we parse JsxOpeningLikeElement as:
// JsxOpeningLikeElement
// attributes: JsxAttributes
@@ -100246,7 +101178,7 @@
// each JsxAttribute can have initializer as JsxExpression
return parent.parent.parent.parent;
}
- if (parent && parent.kind === 269 /* JsxSpreadAttribute */) {
+ if (parent && parent.kind === 270 /* JsxSpreadAttribute */) {
// Currently we parse JsxOpeningLikeElement as:
// JsxOpeningLikeElement
// attributes: JsxAttributes
@@ -100266,62 +101198,62 @@
var containingNodeKind = parent.kind;
switch (contextToken.kind) {
case 27 /* CommaToken */:
- return containingNodeKind === 237 /* VariableDeclaration */ ||
- containingNodeKind === 238 /* VariableDeclarationList */ ||
- containingNodeKind === 219 /* VariableStatement */ ||
- containingNodeKind === 243 /* EnumDeclaration */ || // enum a { foo, |
+ return containingNodeKind === 238 /* VariableDeclaration */ ||
+ containingNodeKind === 239 /* VariableDeclarationList */ ||
+ containingNodeKind === 220 /* VariableStatement */ ||
+ containingNodeKind === 244 /* EnumDeclaration */ || // enum a { foo, |
isFunctionLikeButNotConstructor(containingNodeKind) ||
- containingNodeKind === 241 /* InterfaceDeclaration */ || // interface A<T, |
- containingNodeKind === 185 /* ArrayBindingPattern */ || // var [x, y|
- containingNodeKind === 242 /* TypeAliasDeclaration */ || // type Map, K, |
+ containingNodeKind === 242 /* InterfaceDeclaration */ || // interface A<T, |
+ containingNodeKind === 186 /* ArrayBindingPattern */ || // var [x, y|
+ containingNodeKind === 243 /* TypeAliasDeclaration */ || // type Map, K, |
// class A<T, |
// var C = class D<T, |
(ts.isClassLike(parent) &&
!!parent.typeParameters &&
parent.typeParameters.end >= contextToken.pos);
case 24 /* DotToken */:
- return containingNodeKind === 185 /* ArrayBindingPattern */; // var [.|
+ return containingNodeKind === 186 /* ArrayBindingPattern */; // var [.|
case 57 /* ColonToken */:
- return containingNodeKind === 186 /* BindingElement */; // var {x :html|
+ return containingNodeKind === 187 /* BindingElement */; // var {x :html|
case 22 /* OpenBracketToken */:
- return containingNodeKind === 185 /* ArrayBindingPattern */; // var [x|
+ return containingNodeKind === 186 /* ArrayBindingPattern */; // var [x|
case 20 /* OpenParenToken */:
- return containingNodeKind === 274 /* CatchClause */ ||
+ return containingNodeKind === 275 /* CatchClause */ ||
isFunctionLikeButNotConstructor(containingNodeKind);
case 18 /* OpenBraceToken */:
- return containingNodeKind === 243 /* EnumDeclaration */; // enum a { |
+ return containingNodeKind === 244 /* EnumDeclaration */; // enum a { |
case 28 /* LessThanToken */:
- return containingNodeKind === 240 /* ClassDeclaration */ || // class A< |
- containingNodeKind === 209 /* ClassExpression */ || // var C = class D< |
- containingNodeKind === 241 /* InterfaceDeclaration */ || // interface A< |
- containingNodeKind === 242 /* TypeAliasDeclaration */ || // type List< |
+ return containingNodeKind === 241 /* ClassDeclaration */ || // class A< |
+ containingNodeKind === 210 /* ClassExpression */ || // var C = class D< |
+ containingNodeKind === 242 /* InterfaceDeclaration */ || // interface A< |
+ containingNodeKind === 243 /* TypeAliasDeclaration */ || // type List< |
ts.isFunctionLikeKind(containingNodeKind);
- case 116 /* StaticKeyword */:
- return containingNodeKind === 154 /* PropertyDeclaration */ && !ts.isClassLike(parent.parent);
+ case 117 /* StaticKeyword */:
+ return containingNodeKind === 155 /* PropertyDeclaration */ && !ts.isClassLike(parent.parent);
case 25 /* DotDotDotToken */:
- return containingNodeKind === 151 /* Parameter */ ||
- (!!parent.parent && parent.parent.kind === 185 /* ArrayBindingPattern */); // var [...z|
- case 115 /* PublicKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- return containingNodeKind === 151 /* Parameter */ && !ts.isConstructorDeclaration(parent.parent);
- case 119 /* AsKeyword */:
- return containingNodeKind === 253 /* ImportSpecifier */ ||
- containingNodeKind === 257 /* ExportSpecifier */ ||
- containingNodeKind === 251 /* NamespaceImport */;
- case 126 /* GetKeyword */:
- case 137 /* SetKeyword */:
+ return containingNodeKind === 152 /* Parameter */ ||
+ (!!parent.parent && parent.parent.kind === 186 /* ArrayBindingPattern */); // var [...z|
+ case 116 /* PublicKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ return containingNodeKind === 152 /* Parameter */ && !ts.isConstructorDeclaration(parent.parent);
+ case 120 /* AsKeyword */:
+ return containingNodeKind === 254 /* ImportSpecifier */ ||
+ containingNodeKind === 258 /* ExportSpecifier */ ||
+ containingNodeKind === 252 /* NamespaceImport */;
+ case 127 /* GetKeyword */:
+ case 138 /* SetKeyword */:
return !isFromObjectTypeDeclaration(contextToken);
- case 76 /* ClassKeyword */:
- case 84 /* EnumKeyword */:
- case 110 /* InterfaceKeyword */:
- case 90 /* FunctionKeyword */:
- case 105 /* VarKeyword */:
- case 92 /* ImportKeyword */:
- case 111 /* LetKeyword */:
- case 77 /* ConstKeyword */:
- case 117 /* YieldKeyword */:
- case 140 /* TypeKeyword */: // type htm|
+ case 77 /* ClassKeyword */:
+ case 85 /* EnumKeyword */:
+ case 111 /* InterfaceKeyword */:
+ case 91 /* FunctionKeyword */:
+ case 106 /* VarKeyword */:
+ case 93 /* ImportKeyword */:
+ case 112 /* LetKeyword */:
+ case 78 /* ConstKeyword */:
+ case 118 /* YieldKeyword */:
+ case 141 /* TypeKeyword */: // type htm|
return true;
case 40 /* AsteriskToken */:
return ts.isFunctionLike(contextToken.parent) && !ts.isMethodDeclaration(contextToken.parent);
@@ -100344,22 +101276,22 @@
}
// Previous token may have been a keyword that was converted to an identifier.
switch (keywordForNode(contextToken)) {
- case 118 /* AbstractKeyword */:
- case 76 /* ClassKeyword */:
- case 77 /* ConstKeyword */:
- case 125 /* DeclareKeyword */:
- case 84 /* EnumKeyword */:
- case 90 /* FunctionKeyword */:
- case 110 /* InterfaceKeyword */:
- case 111 /* LetKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 115 /* PublicKeyword */:
- case 116 /* StaticKeyword */:
- case 105 /* VarKeyword */:
- case 117 /* YieldKeyword */:
+ case 119 /* AbstractKeyword */:
+ case 77 /* ClassKeyword */:
+ case 78 /* ConstKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 85 /* EnumKeyword */:
+ case 91 /* FunctionKeyword */:
+ case 111 /* InterfaceKeyword */:
+ case 112 /* LetKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 116 /* PublicKeyword */:
+ case 117 /* StaticKeyword */:
+ case 106 /* VarKeyword */:
+ case 118 /* YieldKeyword */:
return true;
- case 121 /* AsyncKeyword */:
+ case 122 /* AsyncKeyword */:
return ts.isPropertyDeclaration(contextToken.parent);
}
return ts.isDeclarationName(contextToken)
@@ -100369,7 +101301,7 @@
&& !(ts.isClassLike(contextToken.parent) && (contextToken !== previousToken || position > previousToken.end));
}
function isFunctionLikeButNotConstructor(kind) {
- return ts.isFunctionLikeKind(kind) && kind !== 157 /* Constructor */;
+ return ts.isFunctionLikeKind(kind) && kind !== 158 /* Constructor */;
}
function isDotOfNumericLiteral(contextToken) {
if (contextToken.kind === 8 /* NumericLiteral */) {
@@ -100392,12 +101324,12 @@
for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) {
var m = existingMembers_1[_i];
// Ignore omitted expressions for missing members
- if (m.kind !== 275 /* PropertyAssignment */ &&
- m.kind !== 276 /* ShorthandPropertyAssignment */ &&
- m.kind !== 186 /* BindingElement */ &&
- m.kind !== 156 /* MethodDeclaration */ &&
- m.kind !== 158 /* GetAccessor */ &&
- m.kind !== 159 /* SetAccessor */) {
+ if (m.kind !== 276 /* PropertyAssignment */ &&
+ m.kind !== 277 /* ShorthandPropertyAssignment */ &&
+ m.kind !== 187 /* BindingElement */ &&
+ m.kind !== 157 /* MethodDeclaration */ &&
+ m.kind !== 159 /* GetAccessor */ &&
+ m.kind !== 160 /* SetAccessor */) {
continue;
}
// If this is the current item we are editing right now, do not filter it out
@@ -100407,7 +101339,7 @@
var existingName = void 0;
if (ts.isBindingElement(m) && m.propertyName) {
// include only identifiers in completion list
- if (m.propertyName.kind === 72 /* Identifier */) {
+ if (m.propertyName.kind === 73 /* Identifier */) {
existingName = m.propertyName.escapedText;
}
}
@@ -100432,10 +101364,10 @@
for (var _i = 0, existingMembers_2 = existingMembers; _i < existingMembers_2.length; _i++) {
var m = existingMembers_2[_i];
// Ignore omitted expressions for missing members
- if (m.kind !== 154 /* PropertyDeclaration */ &&
- m.kind !== 156 /* MethodDeclaration */ &&
- m.kind !== 158 /* GetAccessor */ &&
- m.kind !== 159 /* SetAccessor */) {
+ if (m.kind !== 155 /* PropertyDeclaration */ &&
+ m.kind !== 157 /* MethodDeclaration */ &&
+ m.kind !== 159 /* GetAccessor */ &&
+ m.kind !== 160 /* SetAccessor */) {
continue;
}
// If this is the current item we are editing right now, do not filter it out
@@ -100475,7 +101407,7 @@
if (isCurrentlyEditingNode(attr)) {
continue;
}
- if (attr.kind === 267 /* JsxAttribute */) {
+ if (attr.kind === 268 /* JsxAttribute */) {
seenNames.set(attr.name.escapedText, true);
}
}
@@ -100495,9 +101427,9 @@
|| ts.isKnownSymbol(symbol)) {
return undefined;
}
- var validIdentiferResult = { name: name, needsConvertPropertyAccess: false };
+ var validIdentifierResult = { name: name, needsConvertPropertyAccess: false };
if (ts.isIdentifierText(name, target))
- return validIdentiferResult;
+ return validIdentifierResult;
switch (kind) {
case 3 /* MemberLike */:
return undefined;
@@ -100510,7 +101442,7 @@
return name.charCodeAt(0) === 32 /* space */ ? undefined : { name: name, needsConvertPropertyAccess: true };
case 5 /* None */:
case 4 /* String */:
- return validIdentiferResult;
+ return validIdentifierResult;
default:
ts.Debug.assertNever(kind);
}
@@ -100519,12 +101451,12 @@
var _keywordCompletions = [];
var allKeywordsCompletions = ts.memoize(function () {
var res = [];
- for (var i = 73 /* FirstKeyword */; i <= 147 /* LastKeyword */; i++) {
+ for (var i = 74 /* FirstKeyword */; i <= 148 /* LastKeyword */; i++) {
res.push({
name: ts.tokenToString(i),
kind: "keyword" /* keyword */,
kindModifiers: "" /* none */,
- sortText: "0"
+ sortText: SortText.GlobalsOrKeywords
});
}
return res;
@@ -100544,8 +101476,8 @@
case 0 /* None */:
return false;
case 1 /* All */:
- return kind === 121 /* AsyncKeyword */ || 122 /* AwaitKeyword */ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind) || kind === 125 /* DeclareKeyword */ || kind === 130 /* ModuleKeyword */
- || ts.isTypeKeyword(kind) && kind !== 141 /* UndefinedKeyword */;
+ return kind === 122 /* AsyncKeyword */ || 123 /* AwaitKeyword */ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind) || kind === 126 /* DeclareKeyword */ || kind === 131 /* ModuleKeyword */
+ || ts.isTypeKeyword(kind) && kind !== 142 /* UndefinedKeyword */;
case 2 /* ClassElementKeywords */:
return isClassMemberCompletionKeyword(kind);
case 3 /* InterfaceElementKeywords */:
@@ -100563,54 +101495,54 @@
}
function isTypeScriptOnlyKeyword(kind) {
switch (kind) {
- case 118 /* AbstractKeyword */:
- case 120 /* AnyKeyword */:
- case 146 /* BigIntKeyword */:
- case 123 /* BooleanKeyword */:
- case 125 /* DeclareKeyword */:
- case 84 /* EnumKeyword */:
- case 145 /* GlobalKeyword */:
- case 109 /* ImplementsKeyword */:
- case 127 /* InferKeyword */:
- case 110 /* InterfaceKeyword */:
- case 128 /* IsKeyword */:
- case 129 /* KeyOfKeyword */:
- case 130 /* ModuleKeyword */:
- case 131 /* NamespaceKeyword */:
- case 132 /* NeverKeyword */:
- case 135 /* NumberKeyword */:
- case 136 /* ObjectKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 115 /* PublicKeyword */:
- case 133 /* ReadonlyKeyword */:
- case 138 /* StringKeyword */:
- case 139 /* SymbolKeyword */:
- case 140 /* TypeKeyword */:
- case 142 /* UniqueKeyword */:
- case 143 /* UnknownKeyword */:
+ case 119 /* AbstractKeyword */:
+ case 121 /* AnyKeyword */:
+ case 147 /* BigIntKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 85 /* EnumKeyword */:
+ case 146 /* GlobalKeyword */:
+ case 110 /* ImplementsKeyword */:
+ case 128 /* InferKeyword */:
+ case 111 /* InterfaceKeyword */:
+ case 129 /* IsKeyword */:
+ case 130 /* KeyOfKeyword */:
+ case 131 /* ModuleKeyword */:
+ case 132 /* NamespaceKeyword */:
+ case 133 /* NeverKeyword */:
+ case 136 /* NumberKeyword */:
+ case 137 /* ObjectKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 116 /* PublicKeyword */:
+ case 134 /* ReadonlyKeyword */:
+ case 139 /* StringKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 141 /* TypeKeyword */:
+ case 143 /* UniqueKeyword */:
+ case 144 /* UnknownKeyword */:
return true;
default:
return false;
}
}
function isInterfaceOrTypeLiteralCompletionKeyword(kind) {
- return kind === 133 /* ReadonlyKeyword */;
+ return kind === 134 /* ReadonlyKeyword */;
}
function isClassMemberCompletionKeyword(kind) {
switch (kind) {
- case 118 /* AbstractKeyword */:
- case 124 /* ConstructorKeyword */:
- case 126 /* GetKeyword */:
- case 137 /* SetKeyword */:
- case 121 /* AsyncKeyword */:
+ case 119 /* AbstractKeyword */:
+ case 125 /* ConstructorKeyword */:
+ case 127 /* GetKeyword */:
+ case 138 /* SetKeyword */:
+ case 122 /* AsyncKeyword */:
return true;
default:
return ts.isClassMemberModifier(kind);
}
}
function isFunctionLikeBodyKeyword(kind) {
- return kind === 121 /* AsyncKeyword */ || kind === 122 /* AwaitKeyword */ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind);
+ return kind === 122 /* AsyncKeyword */ || kind === 123 /* AwaitKeyword */ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind);
}
function keywordForNode(node) {
return ts.isIdentifier(node) ? node.originalKeywordKind || 0 /* Unknown */ : node.kind;
@@ -100647,7 +101579,7 @@
function tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken, location) {
// class c { method() { } | method2() { } }
switch (location.kind) {
- case 311 /* SyntaxList */:
+ case 312 /* SyntaxList */:
return ts.tryCast(location.parent, ts.isObjectTypeDeclaration);
case 1 /* EndOfFileToken */:
var cls = ts.tryCast(ts.lastOrUndefined(ts.cast(location.parent, ts.isSourceFile).statements), ts.isObjectTypeDeclaration);
@@ -100756,40 +101688,40 @@
}
function getHighlightSpans(node, sourceFile) {
switch (node.kind) {
- case 91 /* IfKeyword */:
- case 83 /* ElseKeyword */:
+ case 92 /* IfKeyword */:
+ case 84 /* ElseKeyword */:
return ts.isIfStatement(node.parent) ? getIfElseOccurrences(node.parent, sourceFile) : undefined;
- case 97 /* ReturnKeyword */:
+ case 98 /* ReturnKeyword */:
return useParent(node.parent, ts.isReturnStatement, getReturnOccurrences);
- case 101 /* ThrowKeyword */:
+ case 102 /* ThrowKeyword */:
return useParent(node.parent, ts.isThrowStatement, getThrowOccurrences);
- case 103 /* TryKeyword */:
- case 75 /* CatchKeyword */:
- case 88 /* FinallyKeyword */:
- var tryStatement = node.kind === 75 /* CatchKeyword */ ? node.parent.parent : node.parent;
+ case 104 /* TryKeyword */:
+ case 76 /* CatchKeyword */:
+ case 89 /* FinallyKeyword */:
+ var tryStatement = node.kind === 76 /* CatchKeyword */ ? node.parent.parent : node.parent;
return useParent(tryStatement, ts.isTryStatement, getTryCatchFinallyOccurrences);
- case 99 /* SwitchKeyword */:
+ case 100 /* SwitchKeyword */:
return useParent(node.parent, ts.isSwitchStatement, getSwitchCaseDefaultOccurrences);
- case 74 /* CaseKeyword */:
- case 80 /* DefaultKeyword */:
+ case 75 /* CaseKeyword */:
+ case 81 /* DefaultKeyword */:
return useParent(node.parent.parent.parent, ts.isSwitchStatement, getSwitchCaseDefaultOccurrences);
- case 73 /* BreakKeyword */:
- case 78 /* ContinueKeyword */:
+ case 74 /* BreakKeyword */:
+ case 79 /* ContinueKeyword */:
return useParent(node.parent, ts.isBreakOrContinueStatement, getBreakOrContinueStatementOccurrences);
- case 89 /* ForKeyword */:
- case 107 /* WhileKeyword */:
- case 82 /* DoKeyword */:
+ case 90 /* ForKeyword */:
+ case 108 /* WhileKeyword */:
+ case 83 /* DoKeyword */:
return useParent(node.parent, function (n) { return ts.isIterationStatement(n, /*lookInLabeledStatements*/ true); }, getLoopBreakContinueOccurrences);
- case 124 /* ConstructorKeyword */:
- return getFromAllDeclarations(ts.isConstructorDeclaration, [124 /* ConstructorKeyword */]);
- case 126 /* GetKeyword */:
- case 137 /* SetKeyword */:
- return getFromAllDeclarations(ts.isAccessor, [126 /* GetKeyword */, 137 /* SetKeyword */]);
- case 122 /* AwaitKeyword */:
+ case 125 /* ConstructorKeyword */:
+ return getFromAllDeclarations(ts.isConstructorDeclaration, [125 /* ConstructorKeyword */]);
+ case 127 /* GetKeyword */:
+ case 138 /* SetKeyword */:
+ return getFromAllDeclarations(ts.isAccessor, [127 /* GetKeyword */, 138 /* SetKeyword */]);
+ case 123 /* AwaitKeyword */:
return useParent(node.parent, ts.isAwaitExpression, getAsyncAndAwaitOccurrences);
- case 121 /* AsyncKeyword */:
+ case 122 /* AsyncKeyword */:
return highlightSpans(getAsyncAndAwaitOccurrences(node));
- case 117 /* YieldKeyword */:
+ case 118 /* YieldKeyword */:
return highlightSpans(getYieldOccurrences(node));
default:
return ts.isModifierKind(node.kind) && (ts.isDeclaration(node.parent) || ts.isVariableStatement(node.parent))
@@ -100832,7 +101764,7 @@
var child = throwStatement;
while (child.parent) {
var parent = child.parent;
- if (ts.isFunctionBlock(parent) || parent.kind === 284 /* SourceFile */) {
+ if (ts.isFunctionBlock(parent) || parent.kind === 285 /* SourceFile */) {
return parent;
}
// A throw-statement is only owned by a try-statement if the try-statement has
@@ -100864,16 +101796,16 @@
function getBreakOrContinueOwner(statement) {
return ts.findAncestor(statement, function (node) {
switch (node.kind) {
- case 232 /* SwitchStatement */:
- if (statement.kind === 228 /* ContinueStatement */) {
+ case 233 /* SwitchStatement */:
+ if (statement.kind === 229 /* ContinueStatement */) {
return false;
}
// falls through
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 224 /* WhileStatement */:
- case 223 /* DoStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 225 /* WhileStatement */:
+ case 224 /* DoStatement */:
return !statement.label || isLabeledBy(node, statement.label.escapedText);
default:
// Don't cross function boundaries.
@@ -100889,11 +101821,11 @@
// Types of node whose children might have modifiers.
var container = declaration.parent;
switch (container.kind) {
- case 245 /* ModuleBlock */:
- case 284 /* SourceFile */:
- case 218 /* Block */:
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
+ case 246 /* ModuleBlock */:
+ case 285 /* SourceFile */:
+ case 219 /* Block */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
// Container is either a class declaration or the declaration is a classDeclaration
if (modifierFlag & 128 /* Abstract */ && ts.isClassDeclaration(declaration)) {
return declaration.members.concat([declaration]);
@@ -100901,12 +101833,12 @@
else {
return container.statements;
}
- case 157 /* Constructor */:
- case 156 /* MethodDeclaration */:
- case 239 /* FunctionDeclaration */:
+ case 158 /* Constructor */:
+ case 157 /* MethodDeclaration */:
+ case 240 /* FunctionDeclaration */:
return container.parameters.concat((ts.isClassLike(container.parent) ? container.parent.members : []));
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
var nodes = container.members;
// If we're an accessibility modifier, we're in an instance member and should search
// the constructor's parameter list for instance members as well.
@@ -100937,12 +101869,12 @@
}
function getLoopBreakContinueOccurrences(loopNode) {
var keywords = [];
- if (pushKeywordIf(keywords, loopNode.getFirstToken(), 89 /* ForKeyword */, 107 /* WhileKeyword */, 82 /* DoKeyword */)) {
+ if (pushKeywordIf(keywords, loopNode.getFirstToken(), 90 /* ForKeyword */, 108 /* WhileKeyword */, 83 /* DoKeyword */)) {
// If we succeeded and got a do-while loop, then start looking for a 'while' keyword.
- if (loopNode.kind === 223 /* DoStatement */) {
+ if (loopNode.kind === 224 /* DoStatement */) {
var loopTokens = loopNode.getChildren();
for (var i = loopTokens.length - 1; i >= 0; i--) {
- if (pushKeywordIf(keywords, loopTokens[i], 107 /* WhileKeyword */)) {
+ if (pushKeywordIf(keywords, loopTokens[i], 108 /* WhileKeyword */)) {
break;
}
}
@@ -100950,7 +101882,7 @@
}
ts.forEach(aggregateAllBreakAndContinueStatements(loopNode.statement), function (statement) {
if (ownsBreakOrContinueStatement(loopNode, statement)) {
- pushKeywordIf(keywords, statement.getFirstToken(), 73 /* BreakKeyword */, 78 /* ContinueKeyword */);
+ pushKeywordIf(keywords, statement.getFirstToken(), 74 /* BreakKeyword */, 79 /* ContinueKeyword */);
}
});
return keywords;
@@ -100959,13 +101891,13 @@
var owner = getBreakOrContinueOwner(breakOrContinueStatement);
if (owner) {
switch (owner.kind) {
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
return getLoopBreakContinueOccurrences(owner);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return getSwitchCaseDefaultOccurrences(owner);
}
}
@@ -100973,13 +101905,13 @@
}
function getSwitchCaseDefaultOccurrences(switchStatement) {
var keywords = [];
- pushKeywordIf(keywords, switchStatement.getFirstToken(), 99 /* SwitchKeyword */);
+ pushKeywordIf(keywords, switchStatement.getFirstToken(), 100 /* SwitchKeyword */);
// Go through each clause in the switch statement, collecting the 'case'/'default' keywords.
ts.forEach(switchStatement.caseBlock.clauses, function (clause) {
- pushKeywordIf(keywords, clause.getFirstToken(), 74 /* CaseKeyword */, 80 /* DefaultKeyword */);
+ pushKeywordIf(keywords, clause.getFirstToken(), 75 /* CaseKeyword */, 81 /* DefaultKeyword */);
ts.forEach(aggregateAllBreakAndContinueStatements(clause), function (statement) {
if (ownsBreakOrContinueStatement(switchStatement, statement)) {
- pushKeywordIf(keywords, statement.getFirstToken(), 73 /* BreakKeyword */);
+ pushKeywordIf(keywords, statement.getFirstToken(), 74 /* BreakKeyword */);
}
});
});
@@ -100987,13 +101919,13 @@
}
function getTryCatchFinallyOccurrences(tryStatement, sourceFile) {
var keywords = [];
- pushKeywordIf(keywords, tryStatement.getFirstToken(), 103 /* TryKeyword */);
+ pushKeywordIf(keywords, tryStatement.getFirstToken(), 104 /* TryKeyword */);
if (tryStatement.catchClause) {
- pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 75 /* CatchKeyword */);
+ pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 76 /* CatchKeyword */);
}
if (tryStatement.finallyBlock) {
- var finallyKeyword = ts.findChildOfKind(tryStatement, 88 /* FinallyKeyword */, sourceFile);
- pushKeywordIf(keywords, finallyKeyword, 88 /* FinallyKeyword */);
+ var finallyKeyword = ts.findChildOfKind(tryStatement, 89 /* FinallyKeyword */, sourceFile);
+ pushKeywordIf(keywords, finallyKeyword, 89 /* FinallyKeyword */);
}
return keywords;
}
@@ -101004,13 +101936,13 @@
}
var keywords = [];
ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) {
- keywords.push(ts.findChildOfKind(throwStatement, 101 /* ThrowKeyword */, sourceFile));
+ keywords.push(ts.findChildOfKind(throwStatement, 102 /* ThrowKeyword */, sourceFile));
});
// If the "owner" is a function, then we equate 'return' and 'throw' statements in their
// ability to "jump out" of the function, and include occurrences for both.
if (ts.isFunctionBlock(owner)) {
ts.forEachReturnStatement(owner, function (returnStatement) {
- keywords.push(ts.findChildOfKind(returnStatement, 97 /* ReturnKeyword */, sourceFile));
+ keywords.push(ts.findChildOfKind(returnStatement, 98 /* ReturnKeyword */, sourceFile));
});
}
return keywords;
@@ -101022,11 +101954,11 @@
}
var keywords = [];
ts.forEachReturnStatement(ts.cast(func.body, ts.isBlock), function (returnStatement) {
- keywords.push(ts.findChildOfKind(returnStatement, 97 /* ReturnKeyword */, sourceFile));
+ keywords.push(ts.findChildOfKind(returnStatement, 98 /* ReturnKeyword */, sourceFile));
});
// Include 'throw' statements that do not occur within a try block.
ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) {
- keywords.push(ts.findChildOfKind(throwStatement, 101 /* ThrowKeyword */, sourceFile));
+ keywords.push(ts.findChildOfKind(throwStatement, 102 /* ThrowKeyword */, sourceFile));
});
return keywords;
}
@@ -101038,13 +101970,13 @@
var keywords = [];
if (func.modifiers) {
func.modifiers.forEach(function (modifier) {
- pushKeywordIf(keywords, modifier, 121 /* AsyncKeyword */);
+ pushKeywordIf(keywords, modifier, 122 /* AsyncKeyword */);
});
}
ts.forEachChild(func, function (child) {
traverseWithoutCrossingFunction(child, function (node) {
if (ts.isAwaitExpression(node)) {
- pushKeywordIf(keywords, node.getFirstToken(), 122 /* AwaitKeyword */);
+ pushKeywordIf(keywords, node.getFirstToken(), 123 /* AwaitKeyword */);
}
});
});
@@ -101059,7 +101991,7 @@
ts.forEachChild(func, function (child) {
traverseWithoutCrossingFunction(child, function (node) {
if (ts.isYieldExpression(node)) {
- pushKeywordIf(keywords, node.getFirstToken(), 117 /* YieldKeyword */);
+ pushKeywordIf(keywords, node.getFirstToken(), 118 /* YieldKeyword */);
}
});
});
@@ -101078,7 +102010,7 @@
// We'd like to highlight else/ifs together if they are only separated by whitespace
// (i.e. the keywords are separated by no comments, no newlines).
for (var i = 0; i < keywords.length; i++) {
- if (keywords[i].kind === 83 /* ElseKeyword */ && i < keywords.length - 1) {
+ if (keywords[i].kind === 84 /* ElseKeyword */ && i < keywords.length - 1) {
var elseKeyword = keywords[i];
var ifKeyword = keywords[i + 1]; // this *should* always be an 'if' keyword.
var shouldCombineElseAndIf = true;
@@ -101113,10 +102045,10 @@
// Now traverse back down through the else branches, aggregating if/else keywords of if-statements.
while (true) {
var children = ifStatement.getChildren(sourceFile);
- pushKeywordIf(keywords, children[0], 91 /* IfKeyword */);
+ pushKeywordIf(keywords, children[0], 92 /* IfKeyword */);
// Generally the 'else' keyword is second-to-last, so we traverse backwards.
for (var i = children.length - 1; i >= 0; i--) {
- if (pushKeywordIf(keywords, children[i], 83 /* ElseKeyword */)) {
+ if (pushKeywordIf(keywords, children[i], 84 /* ElseKeyword */)) {
break;
}
}
@@ -101332,12 +102264,12 @@
if (cancellationToken)
cancellationToken.throwIfCancellationRequested();
switch (direct.kind) {
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
if (!isAvailableThroughGlobal) {
var parent = direct.parent;
- if (exportKind === 2 /* ExportEquals */ && parent.kind === 237 /* VariableDeclaration */) {
+ if (exportKind === 2 /* ExportEquals */ && parent.kind === 238 /* VariableDeclaration */) {
var name = parent.name;
- if (name.kind === 72 /* Identifier */) {
+ if (name.kind === 73 /* Identifier */) {
directImports.push(name);
break;
}
@@ -101346,22 +102278,22 @@
addIndirectUser(direct.getSourceFile());
}
break;
- case 72 /* Identifier */: // for 'const x = require("y");
+ case 73 /* Identifier */: // for 'const x = require("y");
break; // TODO: GH#23879
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
handleNamespaceImport(direct, direct.name, ts.hasModifier(direct, 1 /* Export */), /*alreadyAddedDirect*/ false);
break;
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
directImports.push(direct);
var namedBindings = direct.importClause && direct.importClause.namedBindings;
- if (namedBindings && namedBindings.kind === 251 /* NamespaceImport */) {
+ if (namedBindings && namedBindings.kind === 252 /* NamespaceImport */) {
handleNamespaceImport(direct, namedBindings.name, /*isReExport*/ false, /*alreadyAddedDirect*/ true);
}
else if (!isAvailableThroughGlobal && ts.isDefaultImport(direct)) {
addIndirectUser(getSourceFileLikeForImportDeclaration(direct)); // Add a check for indirect uses to handle synthetic default imports
}
break;
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
if (!direct.exportClause) {
// This is `export * from "foo"`, so imports of this module may import the export too.
handleDirectImports(getContainingModuleSymbol(direct, checker));
@@ -101371,11 +102303,11 @@
directImports.push(direct);
}
break;
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
directImports.push(direct);
break;
default:
- ts.Debug.assertNever(direct, "Unexpected import kind: " + ts.Debug.showSyntaxKind(direct));
+ ts.Debug.failBadSyntaxKind(direct, "Unexpected import kind.");
}
}
}
@@ -101388,7 +102320,7 @@
}
else if (!isAvailableThroughGlobal) {
var sourceFileLike = getSourceFileLikeForImportDeclaration(importDeclaration);
- ts.Debug.assert(sourceFileLike.kind === 284 /* SourceFile */ || sourceFileLike.kind === 244 /* ModuleDeclaration */);
+ ts.Debug.assert(sourceFileLike.kind === 285 /* SourceFile */ || sourceFileLike.kind === 245 /* ModuleDeclaration */);
if (isReExport || findNamespaceReExports(sourceFileLike, name, checker)) {
addIndirectUsers(sourceFileLike);
}
@@ -101443,17 +102375,17 @@
}
return { importSearches: importSearches, singleReferences: singleReferences };
function handleImport(decl) {
- if (decl.kind === 248 /* ImportEqualsDeclaration */) {
+ if (decl.kind === 249 /* ImportEqualsDeclaration */) {
if (isExternalModuleImportEquals(decl)) {
handleNamespaceImportLike(decl.name);
}
return;
}
- if (decl.kind === 72 /* Identifier */) {
+ if (decl.kind === 73 /* Identifier */) {
handleNamespaceImportLike(decl);
return;
}
- if (decl.kind === 183 /* ImportType */) {
+ if (decl.kind === 184 /* ImportType */) {
if (decl.qualifier) {
if (ts.isIdentifier(decl.qualifier) && decl.qualifier.escapedText === ts.symbolName(exportSymbol)) {
singleReferences.push(decl.qualifier);
@@ -101468,17 +102400,17 @@
if (decl.moduleSpecifier.kind !== 10 /* StringLiteral */) {
return;
}
- if (decl.kind === 255 /* ExportDeclaration */) {
+ if (decl.kind === 256 /* ExportDeclaration */) {
searchForNamedImport(decl.exportClause);
return;
}
var _a = decl.importClause || { name: undefined, namedBindings: undefined }, name = _a.name, namedBindings = _a.namedBindings;
if (namedBindings) {
switch (namedBindings.kind) {
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
handleNamespaceImportLike(namedBindings.name);
break;
- case 252 /* NamedImports */:
+ case 253 /* NamedImports */:
// 'default' might be accessed as a named import `{ default as foo }`.
if (exportKind === 0 /* Named */ || exportKind === 1 /* Default */) {
searchForNamedImport(namedBindings);
@@ -101528,7 +102460,7 @@
}
}
else {
- var localSymbol = element.kind === 257 /* ExportSpecifier */ && element.propertyName
+ var localSymbol = element.kind === 258 /* ExportSpecifier */ && element.propertyName
? checker.getExportSpecifierLocalTargetSymbol(element) // For re-exporting under a different name, we want to get the re-exported symbol.
: checker.getSymbolAtLocation(name);
addSearch(name, localSymbol);
@@ -101557,7 +102489,7 @@
for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) {
var referencingFile = sourceFiles_1[_i];
var searchSourceFile = searchModuleSymbol.valueDeclaration;
- if (searchSourceFile.kind === 284 /* SourceFile */) {
+ if (searchSourceFile.kind === 285 /* SourceFile */) {
for (var _a = 0, _b = referencingFile.referencedFiles; _a < _b.length; _a++) {
var ref = _b[_a];
if (program.getSourceFileFromReference(referencingFile, ref) === searchSourceFile) {
@@ -101605,7 +102537,7 @@
}
/** Iterates over all statements at the top level or in module declarations. Returns the first truthy result. */
function forEachPossibleImportOrExportStatement(sourceFileLike, action) {
- return ts.forEach(sourceFileLike.kind === 284 /* SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) {
+ return ts.forEach(sourceFileLike.kind === 285 /* SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) {
return action(statement) || (isAmbientModuleDeclaration(statement) && ts.forEach(statement.body && statement.body.statements, action));
});
}
@@ -101620,15 +102552,15 @@
else {
forEachPossibleImportOrExportStatement(sourceFile, function (statement) {
switch (statement.kind) {
- case 255 /* ExportDeclaration */:
- case 249 /* ImportDeclaration */: {
+ case 256 /* ExportDeclaration */:
+ case 250 /* ImportDeclaration */: {
var decl = statement;
if (decl.moduleSpecifier && ts.isStringLiteral(decl.moduleSpecifier)) {
action(decl, decl.moduleSpecifier);
}
break;
}
- case 248 /* ImportEqualsDeclaration */: {
+ case 249 /* ImportEqualsDeclaration */: {
var decl = statement;
if (isExternalModuleImportEquals(decl)) {
action(decl, decl.moduleReference.expression);
@@ -101652,7 +102584,7 @@
var parent = node.parent;
var grandParent = parent.parent;
if (symbol.exportSymbol) {
- if (parent.kind === 189 /* PropertyAccessExpression */) {
+ if (parent.kind === 190 /* PropertyAccessExpression */) {
// When accessing an export of a JS module, there's no alias. The symbol will still be flagged as an export even though we're at the use.
// So check that we are at the declaration.
return symbol.declarations.some(function (d) { return d === parent; }) && ts.isBinaryExpression(grandParent)
@@ -101718,7 +102650,7 @@
var sym = useLhsSymbol ? checker.getSymbolAtLocation(ts.cast(node.left, ts.isPropertyAccessExpression).name) : symbol;
// Better detection for GH#20803
if (sym && !(checker.getMergedSymbol(sym.parent).flags & 1536 /* Module */)) {
- ts.Debug.fail("Special property assignment kind does not have a module as its parent. Assignment is " + ts.Debug.showSymbol(sym) + ", parent is " + ts.Debug.showSymbol(sym.parent));
+ ts.Debug.fail("Special property assignment kind does not have a module as its parent. Assignment is " + ts.Debug.formatSymbol(sym) + ", parent is " + ts.Debug.formatSymbol(sym.parent));
}
return sym && exportInfo(sym, kind);
}
@@ -101774,10 +102706,10 @@
// If a reference is a class expression, the exported node would be its parent.
// If a reference is a variable declaration, the exported node would be the variable statement.
function getExportNode(parent, node) {
- if (parent.kind === 237 /* VariableDeclaration */) {
+ if (parent.kind === 238 /* VariableDeclaration */) {
var p = parent;
return p.name !== node ? undefined :
- p.parent.kind === 274 /* CatchClause */ ? undefined : p.parent.parent.kind === 219 /* VariableStatement */ ? p.parent.parent : undefined;
+ p.parent.kind === 275 /* CatchClause */ ? undefined : p.parent.parent.kind === 220 /* VariableStatement */ ? p.parent.parent : undefined;
}
else {
return parent;
@@ -101786,13 +102718,13 @@
function isNodeImport(node) {
var parent = node.parent;
switch (parent.kind) {
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return parent.name === node && isExternalModuleImportEquals(parent);
- case 253 /* ImportSpecifier */:
+ case 254 /* ImportSpecifier */:
// For a rename import `{ foo as bar }`, don't search for the imported symbol. Just find local uses of `bar`.
return !parent.propertyName;
- case 250 /* ImportClause */:
- case 251 /* NamespaceImport */:
+ case 251 /* ImportClause */:
+ case 252 /* NamespaceImport */:
ts.Debug.assert(parent.name === node);
return true;
default:
@@ -101825,21 +102757,21 @@
return checker.getMergedSymbol(getSourceFileLikeForImportDeclaration(importer).symbol);
}
function getSourceFileLikeForImportDeclaration(node) {
- if (node.kind === 191 /* CallExpression */) {
+ if (node.kind === 192 /* CallExpression */) {
return node.getSourceFile();
}
var parent = node.parent;
- if (parent.kind === 284 /* SourceFile */) {
+ if (parent.kind === 285 /* SourceFile */) {
return parent;
}
- ts.Debug.assert(parent.kind === 245 /* ModuleBlock */);
+ ts.Debug.assert(parent.kind === 246 /* ModuleBlock */);
return ts.cast(parent.parent, isAmbientModuleDeclaration);
}
function isAmbientModuleDeclaration(node) {
- return node.kind === 244 /* ModuleDeclaration */ && node.name.kind === 10 /* StringLiteral */;
+ return node.kind === 245 /* ModuleDeclaration */ && node.name.kind === 10 /* StringLiteral */;
}
function isExternalModuleImportEquals(eq) {
- return eq.moduleReference.kind === 259 /* ExternalModuleReference */ && eq.moduleReference.expression.kind === 10 /* StringLiteral */;
+ return eq.moduleReference.kind === 260 /* ExternalModuleReference */ && eq.moduleReference.expression.kind === 10 /* StringLiteral */;
}
})(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {}));
})(ts || (ts = {}));
@@ -101891,18 +102823,18 @@
}
FindAllReferences.getImplementationsAtPosition = getImplementationsAtPosition;
function getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node, position) {
- if (node.kind === 284 /* SourceFile */) {
+ if (node.kind === 285 /* SourceFile */) {
return undefined;
}
var checker = program.getTypeChecker();
// If invoked directly on a shorthand property assignment, then return
// the declaration of the symbol being assigned (not the symbol being assigned to).
- if (node.parent.kind === 276 /* ShorthandPropertyAssignment */) {
+ if (node.parent.kind === 277 /* ShorthandPropertyAssignment */) {
var result_1 = [];
FindAllReferences.Core.getReferenceEntriesForShorthandPropertyAssignment(node, checker, function (node) { return result_1.push(nodeEntry(node)); });
return result_1;
}
- else if (node.kind === 98 /* SuperKeyword */ || ts.isSuperProperty(node.parent)) {
+ else if (node.kind === 99 /* SuperKeyword */ || ts.isSuperProperty(node.parent)) {
// References to and accesses on the super keyword only have one possible implementation, so no
// need to "Find all References"
var symbol = checker.getSymbolAtLocation(node);
@@ -101982,7 +102914,7 @@
textSpan: textSpan,
fileName: fileName,
isWriteAccess: isWriteAccessForReference(node),
- isDefinition: node.kind === 80 /* DefaultKeyword */
+ isDefinition: node.kind === 81 /* DefaultKeyword */
|| !!ts.getDeclarationFromName(node)
|| ts.isLiteralComputedPropertyDeclarationName(node),
isInString: kind === 2 /* StringLiteral */ ? true : undefined,
@@ -102039,13 +102971,13 @@
if (symbol) {
return getDefinitionKindAndDisplayParts(symbol, checker, node);
}
- else if (node.kind === 188 /* ObjectLiteralExpression */) {
+ else if (node.kind === 189 /* ObjectLiteralExpression */) {
return {
kind: "interface" /* interfaceElement */,
displayParts: [ts.punctuationPart(20 /* OpenParenToken */), ts.textPart("object literal"), ts.punctuationPart(21 /* CloseParenToken */)]
};
}
- else if (node.kind === 209 /* ClassExpression */) {
+ else if (node.kind === 210 /* ClassExpression */) {
return {
kind: "local class" /* localClassElement */,
displayParts: [ts.punctuationPart(20 /* OpenParenToken */), ts.textPart("anonymous local class"), ts.punctuationPart(21 /* CloseParenToken */)]
@@ -102088,7 +103020,7 @@
/** A node is considered a writeAccess iff it is a name of a declaration or a target of an assignment */
function isWriteAccessForReference(node) {
var decl = ts.getDeclarationFromName(node);
- return !!decl && declarationIsWriteAccess(decl) || node.kind === 80 /* DefaultKeyword */ || ts.isWriteAccess(node);
+ return !!decl && declarationIsWriteAccess(decl) || node.kind === 81 /* DefaultKeyword */ || ts.isWriteAccess(node);
}
/**
* True if 'decl' provides a value, as in `function f() {}`;
@@ -102099,46 +103031,46 @@
if (!!(decl.flags & 4194304 /* Ambient */))
return true;
switch (decl.kind) {
- case 204 /* BinaryExpression */:
- case 186 /* BindingElement */:
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 80 /* DefaultKeyword */:
- case 243 /* EnumDeclaration */:
- case 278 /* EnumMember */:
- case 257 /* ExportSpecifier */:
- case 250 /* ImportClause */: // default import
- case 248 /* ImportEqualsDeclaration */:
- case 253 /* ImportSpecifier */:
- case 241 /* InterfaceDeclaration */:
- case 302 /* JSDocCallbackTag */:
- case 309 /* JSDocTypedefTag */:
- case 267 /* JsxAttribute */:
- case 244 /* ModuleDeclaration */:
- case 247 /* NamespaceExportDeclaration */:
- case 251 /* NamespaceImport */:
- case 151 /* Parameter */:
- case 276 /* ShorthandPropertyAssignment */:
- case 242 /* TypeAliasDeclaration */:
- case 150 /* TypeParameter */:
+ case 205 /* BinaryExpression */:
+ case 187 /* BindingElement */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 81 /* DefaultKeyword */:
+ case 244 /* EnumDeclaration */:
+ case 279 /* EnumMember */:
+ case 258 /* ExportSpecifier */:
+ case 251 /* ImportClause */: // default import
+ case 249 /* ImportEqualsDeclaration */:
+ case 254 /* ImportSpecifier */:
+ case 242 /* InterfaceDeclaration */:
+ case 303 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 268 /* JsxAttribute */:
+ case 245 /* ModuleDeclaration */:
+ case 248 /* NamespaceExportDeclaration */:
+ case 252 /* NamespaceImport */:
+ case 152 /* Parameter */:
+ case 277 /* ShorthandPropertyAssignment */:
+ case 243 /* TypeAliasDeclaration */:
+ case 151 /* TypeParameter */:
return true;
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
// In `({ x: y } = 0);`, `x` is not a write access. (Won't call this function for `y`.)
return !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(decl.parent);
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 157 /* Constructor */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 158 /* Constructor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return !!decl.body;
- case 237 /* VariableDeclaration */:
- case 154 /* PropertyDeclaration */:
+ case 238 /* VariableDeclaration */:
+ case 155 /* PropertyDeclaration */:
return !!decl.initializer || ts.isCatchClause(decl.parent);
- case 155 /* MethodSignature */:
- case 153 /* PropertySignature */:
- case 310 /* JSDocPropertyTag */:
- case 304 /* JSDocParameterTag */:
+ case 156 /* MethodSignature */:
+ case 154 /* PropertySignature */:
+ case 311 /* JSDocPropertyTag */:
+ case 305 /* JSDocParameterTag */:
return false;
default:
return ts.Debug.failBadSyntaxKind(decl);
@@ -102298,10 +103230,10 @@
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var decl = _a[_i];
switch (decl.kind) {
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
// Don't include the source file itself. (This may not be ideal behavior, but awkward to include an entire file as a reference.)
break;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
if (sourceFilesSet.has(decl.getSourceFile().fileName)) {
references.push(FindAllReferences.nodeEntry(decl.name));
}
@@ -102321,7 +103253,7 @@
var node = ts.isBinaryExpression(decl) && ts.isPropertyAccessExpression(decl.left)
? decl.left.expression
: ts.isExportAssignment(decl)
- ? ts.Debug.assertDefined(ts.findChildOfKind(decl, 85 /* ExportKeyword */, sourceFile))
+ ? ts.Debug.assertDefined(ts.findChildOfKind(decl, 86 /* ExportKeyword */, sourceFile))
: ts.getNameOfDeclaration(decl) || decl;
references.push(FindAllReferences.nodeEntry(node));
}
@@ -102348,7 +103280,7 @@
if (ts.isThis(node)) {
return getReferencesForThisKeyword(node, sourceFiles, cancellationToken);
}
- if (node.kind === 98 /* SuperKeyword */) {
+ if (node.kind === 99 /* SuperKeyword */) {
return getReferencesForSuperKeyword(node);
}
return undefined;
@@ -102365,7 +103297,7 @@
// When renaming at an export specifier, rename the export and not the thing being exported.
getReferencesAtExportSpecifier(exportSpecifier.name, symbol, exportSpecifier, state.createSearch(node, originalSymbol, /*comingFrom*/ undefined), state, /*addReferencesHere*/ true, /*alwaysGetReferences*/ true);
}
- else if (node && node.kind === 80 /* DefaultKeyword */) {
+ else if (node && node.kind === 81 /* DefaultKeyword */) {
addReference(node, symbol, state);
searchForImportsOfExport(node, symbol, { exportingModuleSymbol: ts.Debug.assertDefined(symbol.parent, "Expected export symbol to have a parent"), exportKind: 1 /* Default */ }, state);
}
@@ -102393,9 +103325,9 @@
}
function getSpecialSearchKind(node) {
switch (node.kind) {
- case 124 /* ConstructorKeyword */:
+ case 125 /* ConstructorKeyword */:
return 1 /* Constructor */;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
if (ts.isClassLike(node.parent)) {
ts.Debug.assert(node.parent.name === node);
return 2 /* Class */;
@@ -102418,7 +103350,7 @@
if (symbol.flags & 33554432 /* Transient */)
return undefined;
// Assertions for GH#21814. We should be handling SourceFile symbols in `getReferencedSymbolsForModule` instead of getting here.
- ts.Debug.fail("Unexpected symbol at " + ts.Debug.showSyntaxKind(node) + ": " + ts.Debug.showSymbol(symbol));
+ ts.Debug.fail("Unexpected symbol at " + ts.Debug.formatSyntaxKind(node.kind) + ": " + ts.Debug.formatSymbol(symbol));
}
return ts.isTypeLiteralNode(decl.parent) && ts.isUnionTypeNode(decl.parent.parent)
? checker.getPropertyOfType(checker.getTypeFromTypeNode(decl.parent.parent), symbol.name)
@@ -102523,8 +103455,8 @@
var sourceId = ts.getNodeId(sourceFile);
var seenSymbols = this.sourceFileToSeenSymbols[sourceId] || (this.sourceFileToSeenSymbols[sourceId] = ts.createMap());
var anyNewSymbols = false;
- for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) {
- var sym = symbols_2[_i];
+ for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) {
+ var sym = symbols_3[_i];
anyNewSymbols = ts.addToSeen(seenSymbols, ts.getSymbolId(sym)) || anyNewSymbols;
}
return anyNewSymbols;
@@ -102631,7 +103563,7 @@
// If this is the symbol of a named function expression or named class expression,
// then named references are limited to its own scope.
var declarations = symbol.declarations, flags = symbol.flags, parent = symbol.parent, valueDeclaration = symbol.valueDeclaration;
- if (valueDeclaration && (valueDeclaration.kind === 196 /* FunctionExpression */ || valueDeclaration.kind === 209 /* ClassExpression */)) {
+ if (valueDeclaration && (valueDeclaration.kind === 197 /* FunctionExpression */ || valueDeclaration.kind === 210 /* ClassExpression */)) {
return valueDeclaration;
}
if (!declarations) {
@@ -102641,7 +103573,7 @@
if (flags & (4 /* Property */ | 8192 /* Method */)) {
var privateDeclaration = ts.find(declarations, function (d) { return ts.hasModifier(d, 8 /* Private */); });
if (privateDeclaration) {
- return ts.getAncestor(privateDeclaration, 240 /* ClassDeclaration */);
+ return ts.getAncestor(privateDeclaration, 241 /* ClassDeclaration */);
}
// Else this is a public property and could be accessed from anywhere.
return undefined;
@@ -102670,7 +103602,7 @@
// Different declarations have different containers, bail out
return undefined;
}
- if (!container || container.kind === 284 /* SourceFile */ && !ts.isExternalOrCommonJsModule(container)) {
+ if (!container || container.kind === 285 /* SourceFile */ && !ts.isExternalOrCommonJsModule(container)) {
// This is a global variable and not an external module, any declaration defined
// within this scope is visible outside the file
return undefined;
@@ -102757,8 +103689,8 @@
// We found a match. Make sure it's not part of a larger word (i.e. the char
// before and after it have to be a non-identifier char).
var endPosition = position + symbolNameLength;
- if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 7 /* Latest */)) &&
- (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 7 /* Latest */))) {
+ if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 8 /* Latest */)) &&
+ (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 8 /* Latest */))) {
// Found a real match. Keep searching.
positions.push(position);
}
@@ -102778,7 +103710,7 @@
function isValidReferencePosition(node, searchSymbolName) {
// Compare the length so we filter out strict superstrings of the symbol we are looking for
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return node.text.length === searchSymbolName.length;
case 10 /* StringLiteral */: {
var str = node;
@@ -102787,7 +103719,7 @@
}
case 8 /* NumericLiteral */:
return ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && node.text.length === searchSymbolName.length;
- case 80 /* DefaultKeyword */:
+ case 81 /* DefaultKeyword */:
return "default".length === searchSymbolName.length;
default:
return false;
@@ -102851,7 +103783,7 @@
return;
}
if (ts.isExportSpecifier(parent)) {
- ts.Debug.assert(referenceLocation.kind === 72 /* Identifier */);
+ ts.Debug.assert(referenceLocation.kind === 73 /* Identifier */);
getReferencesAtExportSpecifier(referenceLocation, referenceSymbol, parent, search, state, addReferencesHere);
return;
}
@@ -102907,8 +103839,8 @@
}
// For `export { foo as bar }`, rename `foo`, but not `bar`.
if (!isForRenameWithPrefixAndSuffixText(state.options) || alwaysGetReferences) {
- var isDefaultExport = referenceLocation.originalKeywordKind === 80 /* DefaultKeyword */
- || exportSpecifier.name.originalKeywordKind === 80 /* DefaultKeyword */;
+ var isDefaultExport = referenceLocation.originalKeywordKind === 81 /* DefaultKeyword */
+ || exportSpecifier.name.originalKeywordKind === 81 /* DefaultKeyword */;
var exportKind = isDefaultExport ? 1 /* Default */ : 0 /* Named */;
var exportSymbol = ts.Debug.assertDefined(exportSpecifier.symbol);
var exportInfo = ts.Debug.assertDefined(FindAllReferences.getExportInfo(exportSymbol, exportKind, state.checker));
@@ -102987,7 +103919,7 @@
}
var pusher = function () { return state.referenceAdder(search.symbol); };
if (ts.isClassLike(referenceLocation.parent)) {
- ts.Debug.assert(referenceLocation.kind === 80 /* DefaultKeyword */ || referenceLocation.parent.name === referenceLocation);
+ ts.Debug.assert(referenceLocation.kind === 81 /* DefaultKeyword */ || referenceLocation.parent.name === referenceLocation);
// This is the class declaration containing the constructor.
findOwnConstructorReferences(search.symbol, sourceFile, pusher());
}
@@ -103014,7 +103946,7 @@
}
if (member.body) {
member.body.forEachChild(function cb(node) {
- if (node.kind === 100 /* ThisKeyword */) {
+ if (node.kind === 101 /* ThisKeyword */) {
addRef(node);
}
else if (!ts.isFunctionLike(node) && !ts.isClassLike(node)) {
@@ -103033,18 +103965,18 @@
if (constructorSymbol) {
for (var _i = 0, _a = constructorSymbol.declarations; _i < _a.length; _i++) {
var decl = _a[_i];
- var ctrKeyword = ts.findChildOfKind(decl, 124 /* ConstructorKeyword */, sourceFile);
- ts.Debug.assert(decl.kind === 157 /* Constructor */ && !!ctrKeyword);
+ var ctrKeyword = ts.findChildOfKind(decl, 125 /* ConstructorKeyword */, sourceFile);
+ ts.Debug.assert(decl.kind === 158 /* Constructor */ && !!ctrKeyword);
addNode(ctrKeyword);
}
}
if (classSymbol.exports) {
classSymbol.exports.forEach(function (member) {
var decl = member.valueDeclaration;
- if (decl && decl.kind === 156 /* MethodDeclaration */) {
+ if (decl && decl.kind === 157 /* MethodDeclaration */) {
var body = decl.body;
if (body) {
- forEachDescendantOfKind(body, 100 /* ThisKeyword */, function (thisKeyword) {
+ forEachDescendantOfKind(body, 101 /* ThisKeyword */, function (thisKeyword) {
if (ts.isNewExpressionTarget(thisKeyword)) {
addNode(thisKeyword);
}
@@ -103065,10 +103997,10 @@
}
for (var _i = 0, _a = constructor.declarations; _i < _a.length; _i++) {
var decl = _a[_i];
- ts.Debug.assert(decl.kind === 157 /* Constructor */);
+ ts.Debug.assert(decl.kind === 158 /* Constructor */);
var body = decl.body;
if (body) {
- forEachDescendantOfKind(body, 98 /* SuperKeyword */, function (node) {
+ forEachDescendantOfKind(body, 99 /* SuperKeyword */, function (node) {
if (ts.isCallExpressionTarget(node)) {
addNode(node);
}
@@ -103092,10 +104024,10 @@
addReference(refNode);
return;
}
- if (refNode.kind !== 72 /* Identifier */) {
+ if (refNode.kind !== 73 /* Identifier */) {
return;
}
- if (refNode.parent.kind === 276 /* ShorthandPropertyAssignment */) {
+ if (refNode.parent.kind === 277 /* ShorthandPropertyAssignment */) {
// Go ahead and dereference the shorthand assignment by going to its definition
getReferenceEntriesForShorthandPropertyAssignment(refNode, state.checker, addReference);
}
@@ -103115,7 +104047,7 @@
}
else if (ts.isFunctionLike(typeHavingNode) && typeHavingNode.body) {
var body = typeHavingNode.body;
- if (body.kind === 218 /* Block */) {
+ if (body.kind === 219 /* Block */) {
ts.forEachReturnStatement(body, function (returnStatement) {
if (returnStatement.expression)
addIfImplementation(returnStatement.expression);
@@ -103143,13 +104075,13 @@
*/
function isImplementationExpression(node) {
switch (node.kind) {
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return isImplementationExpression(node.expression);
- case 197 /* ArrowFunction */:
- case 196 /* FunctionExpression */:
- case 188 /* ObjectLiteralExpression */:
- case 209 /* ClassExpression */:
- case 187 /* ArrayLiteralExpression */:
+ case 198 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
+ case 189 /* ObjectLiteralExpression */:
+ case 210 /* ClassExpression */:
+ case 188 /* ArrayLiteralExpression */:
return true;
default:
return false;
@@ -103202,13 +104134,13 @@
// Whether 'super' occurs in a static context within a class.
var staticFlag = 32 /* Static */;
switch (searchSpaceNode.kind) {
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
staticFlag &= ts.getModifierFlags(searchSpaceNode);
searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class
break;
@@ -103217,7 +104149,7 @@
}
var sourceFile = searchSpaceNode.getSourceFile();
var references = ts.mapDefined(getPossibleSymbolReferenceNodes(sourceFile, "super", searchSpaceNode), function (node) {
- if (node.kind !== 98 /* SuperKeyword */) {
+ if (node.kind !== 99 /* SuperKeyword */) {
return;
}
var container = ts.getSuperContainer(node, /*stopOnFunctions*/ false);
@@ -103229,41 +104161,41 @@
return [{ definition: { type: 0 /* Symbol */, symbol: searchSpaceNode.symbol }, references: references }];
}
function isParameterName(node) {
- return node.kind === 72 /* Identifier */ && node.parent.kind === 151 /* Parameter */ && node.parent.name === node;
+ return node.kind === 73 /* Identifier */ && node.parent.kind === 152 /* Parameter */ && node.parent.name === node;
}
function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles, cancellationToken) {
var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, /* includeArrowFunctions */ false);
// Whether 'this' occurs in a static context within a class.
var staticFlag = 32 /* Static */;
switch (searchSpaceNode.kind) {
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
if (ts.isObjectLiteralMethod(searchSpaceNode)) {
break;
}
// falls through
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
staticFlag &= ts.getModifierFlags(searchSpaceNode);
searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class
break;
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
if (ts.isExternalModule(searchSpaceNode) || isParameterName(thisOrSuperKeyword)) {
return undefined;
}
// falls through
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
break;
// Computed properties in classes are not handled here because references to this are illegal,
// so there is no point finding references to them.
default:
return undefined;
}
- var references = ts.flatMap(searchSpaceNode.kind === 284 /* SourceFile */ ? sourceFiles : [searchSpaceNode.getSourceFile()], function (sourceFile) {
+ var references = ts.flatMap(searchSpaceNode.kind === 285 /* SourceFile */ ? sourceFiles : [searchSpaceNode.getSourceFile()], function (sourceFile) {
cancellationToken.throwIfCancellationRequested();
return getPossibleSymbolReferenceNodes(sourceFile, "this", ts.isSourceFile(searchSpaceNode) ? sourceFile : searchSpaceNode).filter(function (node) {
if (!ts.isThis(node)) {
@@ -103271,19 +104203,19 @@
}
var container = ts.getThisContainer(node, /* includeArrowFunctions */ false);
switch (searchSpaceNode.kind) {
- case 196 /* FunctionExpression */:
- case 239 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
return searchSpaceNode.symbol === container.symbol;
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
return ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol;
- case 209 /* ClassExpression */:
- case 240 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
// Make sure the container belongs to the same class
// and has the appropriate static modifier from the original container.
return container.parent && searchSpaceNode.symbol === container.parent.symbol && (ts.getModifierFlags(container) & 32 /* Static */) === staticFlag;
- case 284 /* SourceFile */:
- return container.kind === 284 /* SourceFile */ && !ts.isExternalModule(container) && !isParameterName(node);
+ case 285 /* SourceFile */:
+ return container.kind === 285 /* SourceFile */ && !ts.isExternalModule(container) && !isParameterName(node);
}
});
}).map(function (n) { return FindAllReferences.nodeEntry(n); });
@@ -103402,7 +104334,7 @@
});
}
function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol, checker) {
- var bindingElement = ts.getDeclarationOfKind(symbol, 186 /* BindingElement */);
+ var bindingElement = ts.getDeclarationOfKind(symbol, 187 /* BindingElement */);
if (bindingElement && ts.isObjectBindingElementWithoutPropertyName(bindingElement)) {
return ts.getPropertySymbolFromBindingElement(checker, bindingElement);
}
@@ -103761,7 +104693,7 @@
else {
var defs = getDefinitionFromSymbol(typeChecker, symbol, node) || ts.emptyArray;
// For a 'super()' call, put the signature first, else put the variable first.
- return node.kind === 98 /* SuperKeyword */ ? [sigInfo].concat(defs) : defs.concat([sigInfo]);
+ return node.kind === 99 /* SuperKeyword */ ? [sigInfo].concat(defs) : defs.concat([sigInfo]);
}
}
// Because name in short-hand property assignment has two different meanings: property name and property value,
@@ -103769,7 +104701,7 @@
// go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition
// is performed at the location of property access, we would like to go to definition of the property in the short-hand
// assignment. This case and others are handled by the following code.
- if (node.parent.kind === 276 /* ShorthandPropertyAssignment */) {
+ if (node.parent.kind === 277 /* ShorthandPropertyAssignment */) {
var shorthandSymbol_1 = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration);
return shorthandSymbol_1 ? shorthandSymbol_1.declarations.map(function (decl) { return createDefinitionInfo(decl, typeChecker, shorthandSymbol_1, node); }) : [];
}
@@ -103922,18 +104854,18 @@
// (2) when the aliased symbol is originating from an import.
//
function shouldSkipAlias(node, declaration) {
- if (node.kind !== 72 /* Identifier */) {
+ if (node.kind !== 73 /* Identifier */) {
return false;
}
if (node.parent === declaration) {
return true;
}
switch (declaration.kind) {
- case 250 /* ImportClause */:
- case 248 /* ImportEqualsDeclaration */:
+ case 251 /* ImportClause */:
+ case 249 /* ImportEqualsDeclaration */:
return true;
- case 253 /* ImportSpecifier */:
- return declaration.parent.kind === 252 /* NamedImports */;
+ case 254 /* ImportSpecifier */:
+ return declaration.parent.kind === 253 /* NamedImports */;
default:
return false;
}
@@ -103943,7 +104875,7 @@
function getConstructSignatureDefinition() {
// Applicable only if we are in a new expression, or we are on a constructor declaration
// and in either case the symbol has a construct signature definition, i.e. class
- if (symbol.flags & 32 /* Class */ && (ts.isNewExpressionTarget(node) || node.kind === 124 /* ConstructorKeyword */)) {
+ if (symbol.flags & 32 /* Class */ && (ts.isNewExpressionTarget(node) || node.kind === 125 /* ConstructorKeyword */)) {
var cls = ts.find(symbol.declarations, ts.isClassLike) || ts.Debug.fail("Expected declaration to have at least one class-like declaration");
return getSignatureDefinition(cls.members, /*selectConstructors*/ true);
}
@@ -104017,9 +104949,9 @@
}
function isConstructorLike(node) {
switch (node.kind) {
- case 157 /* Constructor */:
- case 166 /* ConstructorType */:
- case 161 /* ConstructSignature */:
+ case 158 /* Constructor */:
+ case 167 /* ConstructorType */:
+ case 162 /* ConstructSignature */:
return true;
default:
return false;
@@ -104137,11 +105069,11 @@
JsDoc.getJsDocCommentsFromDeclarations = getJsDocCommentsFromDeclarations;
function getCommentHavingNodes(declaration) {
switch (declaration.kind) {
- case 304 /* JSDocParameterTag */:
- case 310 /* JSDocPropertyTag */:
+ case 305 /* JSDocParameterTag */:
+ case 311 /* JSDocPropertyTag */:
return [declaration];
- case 302 /* JSDocCallbackTag */:
- case 309 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
return [declaration, declaration.parent];
default:
return ts.getJSDocCommentsAndTags(declaration);
@@ -104162,16 +105094,16 @@
function getCommentText(tag) {
var comment = tag.comment;
switch (tag.kind) {
- case 300 /* JSDocAugmentsTag */:
+ case 301 /* JSDocAugmentsTag */:
return withNode(tag.class);
- case 308 /* JSDocTemplateTag */:
+ case 309 /* JSDocTemplateTag */:
return withList(tag.typeParameters);
- case 307 /* JSDocTypeTag */:
+ case 308 /* JSDocTypeTag */:
return withNode(tag.typeExpression);
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
- case 310 /* JSDocPropertyTag */:
- case 304 /* JSDocParameterTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
+ case 311 /* JSDocPropertyTag */:
+ case 305 /* JSDocParameterTag */:
var name = tag.name;
return name ? withNode(name) : comment;
default:
@@ -104348,7 +105280,7 @@
function parameterDocComments(parameters, isJavaScriptFile, indentationStr, newLine) {
return parameters.map(function (_a, i) {
var name = _a.name, dotDotDotToken = _a.dotDotDotToken;
- var paramName = name.kind === 72 /* Identifier */ ? name.text : "param" + i;
+ var paramName = name.kind === 73 /* Identifier */ ? name.text : "param" + i;
var type = isJavaScriptFile ? (dotDotDotToken ? "{...any} " : "{any} ") : "";
return indentationStr + " * @param " + type + paramName + newLine;
}).join("");
@@ -104358,23 +105290,23 @@
}
function getCommentOwnerInfoWorker(commentOwner) {
switch (commentOwner.kind) {
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 156 /* MethodDeclaration */:
- case 157 /* Constructor */:
- case 155 /* MethodSignature */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 157 /* MethodDeclaration */:
+ case 158 /* Constructor */:
+ case 156 /* MethodSignature */:
var parameters = commentOwner.parameters;
return { commentOwner: commentOwner, parameters: parameters };
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return getCommentOwnerInfoWorker(commentOwner.initializer);
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 153 /* PropertySignature */:
- case 243 /* EnumDeclaration */:
- case 278 /* EnumMember */:
- case 242 /* TypeAliasDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 154 /* PropertySignature */:
+ case 244 /* EnumDeclaration */:
+ case 279 /* EnumMember */:
+ case 243 /* TypeAliasDeclaration */:
return { commentOwner: commentOwner };
- case 219 /* VariableStatement */: {
+ case 220 /* VariableStatement */: {
var varStatement = commentOwner;
var varDeclarations = varStatement.declarationList.declarations;
var parameters_1 = varDeclarations.length === 1 && varDeclarations[0].initializer
@@ -104382,14 +105314,14 @@
: undefined;
return { commentOwner: commentOwner, parameters: parameters_1 };
}
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return "quit";
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
// If in walking up the tree, we hit a a nested namespace declaration,
// then we must be somewhere within a dotted namespace name; however we don't
// want to give back a JSDoc template for the 'b' or 'c' in 'namespace a.b.c { }'.
- return commentOwner.parent.kind === 244 /* ModuleDeclaration */ ? undefined : { commentOwner: commentOwner };
- case 204 /* BinaryExpression */: {
+ return commentOwner.parent.kind === 245 /* ModuleDeclaration */ ? undefined : { commentOwner: commentOwner };
+ case 205 /* BinaryExpression */: {
var be = commentOwner;
if (ts.getAssignmentDeclarationKind(be) === 0 /* None */) {
return "quit";
@@ -104408,14 +105340,14 @@
* @returns the parameters of a signature found on the RHS if one exists; otherwise 'emptyArray'.
*/
function getParametersFromRightHandSideOfAssignment(rightHandSide) {
- while (rightHandSide.kind === 195 /* ParenthesizedExpression */) {
+ while (rightHandSide.kind === 196 /* ParenthesizedExpression */) {
rightHandSide = rightHandSide.expression;
}
switch (rightHandSide.kind) {
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return rightHandSide.parameters;
- case 209 /* ClassExpression */: {
+ case 210 /* ClassExpression */: {
var ctr = ts.find(rightHandSide.members, ts.isConstructorDeclaration);
return ctr ? ctr.parameters : ts.emptyArray;
}
@@ -104477,9 +105409,9 @@
}
function shouldKeepItem(declaration, checker) {
switch (declaration.kind) {
- case 250 /* ImportClause */:
- case 253 /* ImportSpecifier */:
- case 248 /* ImportEqualsDeclaration */:
+ case 251 /* ImportClause */:
+ case 254 /* ImportSpecifier */:
+ case 249 /* ImportEqualsDeclaration */:
var importer = checker.getSymbolAtLocation(declaration.name); // TODO: GH#18217
var imported = checker.getAliasedSymbol(importer);
return importer.escapedName !== imported.escapedName;
@@ -104489,7 +105421,7 @@
}
function tryAddSingleDeclarationName(declaration, containers) {
var name = ts.getNameOfDeclaration(declaration);
- return !!name && (pushLiteral(name, containers) || name.kind === 149 /* ComputedPropertyName */ && tryAddComputedPropertyName(name.expression, containers));
+ return !!name && (pushLiteral(name, containers) || name.kind === 150 /* ComputedPropertyName */ && tryAddComputedPropertyName(name.expression, containers));
}
// Only added the names of computed properties if they're simple dotted expressions, like:
//
@@ -104506,7 +105438,7 @@
// First, if we started with a computed property name, then add all but the last
// portion into the container array.
var name = ts.getNameOfDeclaration(declaration);
- if (name && name.kind === 149 /* ComputedPropertyName */ && !tryAddComputedPropertyName(name.expression, containers)) {
+ if (name && name.kind === 150 /* ComputedPropertyName */ && !tryAddComputedPropertyName(name.expression, containers)) {
return ts.emptyArray;
}
// Don't include the last portion.
@@ -104675,7 +105607,7 @@
return;
}
switch (node.kind) {
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
// Get parameter properties, and treat them as being on the *same* level as the constructor, not under it.
var ctr = node;
addNodeWithRecursiveChild(ctr, ctr.body);
@@ -104687,21 +105619,21 @@
}
}
break;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 155 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 156 /* MethodSignature */:
if (!ts.hasDynamicName(node)) {
addNodeWithRecursiveChild(node, node.body);
}
break;
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
if (!ts.hasDynamicName(node)) {
addLeafNode(node);
}
break;
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
var importClause = node;
// Handle default import case e.g.:
// import d from "mod";
@@ -104713,7 +105645,7 @@
// import {a, b as B} from "mod";
var namedBindings = importClause.namedBindings;
if (namedBindings) {
- if (namedBindings.kind === 251 /* NamespaceImport */) {
+ if (namedBindings.kind === 252 /* NamespaceImport */) {
addLeafNode(namedBindings);
}
else {
@@ -104724,8 +105656,8 @@
}
}
break;
- case 186 /* BindingElement */:
- case 237 /* VariableDeclaration */:
+ case 187 /* BindingElement */:
+ case 238 /* VariableDeclaration */:
var _d = node, name = _d.name, initializer = _d.initializer;
if (ts.isBindingPattern(name)) {
addChildrenRecursively(name);
@@ -104746,12 +105678,12 @@
addNodeWithRecursiveChild(node, initializer);
}
break;
- case 197 /* ArrowFunction */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
addNodeWithRecursiveChild(node, node.body);
break;
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
startNode(node);
for (var _e = 0, _f = node.members; _e < _f.length; _e++) {
var member = _f[_e];
@@ -104761,9 +105693,9 @@
}
endNode();
break;
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
startNode(node);
for (var _g = 0, _h = node.members; _g < _h.length; _g++) {
var member = _h[_g];
@@ -104771,18 +105703,18 @@
}
endNode();
break;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
addNodeWithRecursiveChild(node, getInteriorModule(node).body);
break;
- case 257 /* ExportSpecifier */:
- case 248 /* ImportEqualsDeclaration */:
- case 162 /* IndexSignature */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 242 /* TypeAliasDeclaration */:
+ case 258 /* ExportSpecifier */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 163 /* IndexSignature */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 243 /* TypeAliasDeclaration */:
addLeafNode(node);
break;
- case 204 /* BinaryExpression */: {
+ case 205 /* BinaryExpression */: {
var special = ts.getAssignmentDeclarationKind(node);
switch (special) {
case 1 /* ExportsProperty */:
@@ -104864,12 +105796,12 @@
return false;
}
switch (a.kind) {
- case 154 /* PropertyDeclaration */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 155 /* PropertyDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return ts.hasModifier(a, 32 /* Static */) === ts.hasModifier(b, 32 /* Static */);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return areSameModule(a, b);
default:
return true;
@@ -104885,7 +105817,7 @@
// Only merge module nodes that have the same chain. Don't merge 'A.B.C' with 'A'!
function areSameModule(a, b) {
// TODO: GH#18217
- return a.body.kind === b.body.kind && (a.body.kind !== 244 /* ModuleDeclaration */ || areSameModule(a.body, b.body));
+ return a.body.kind === b.body.kind && (a.body.kind !== 245 /* ModuleDeclaration */ || areSameModule(a.body, b.body));
}
/** Merge source into target. Source should be thrown away after this is called. */
function merge(target, source) {
@@ -104915,7 +105847,7 @@
* So `new()` can still come before an `aardvark` method.
*/
function tryGetName(node) {
- if (node.kind === 244 /* ModuleDeclaration */) {
+ if (node.kind === 245 /* ModuleDeclaration */) {
return getModuleName(node);
}
var declName = ts.getNameOfDeclaration(node);
@@ -104923,16 +105855,16 @@
return ts.unescapeLeadingUnderscores(ts.getPropertyNameForPropertyNameNode(declName)); // TODO: GH#18217
}
switch (node.kind) {
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 209 /* ClassExpression */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 210 /* ClassExpression */:
return getFunctionOrClassName(node);
default:
return undefined;
}
}
function getItemName(node, name) {
- if (node.kind === 244 /* ModuleDeclaration */) {
+ if (node.kind === 245 /* ModuleDeclaration */) {
return getModuleName(node);
}
if (name) {
@@ -104942,16 +105874,16 @@
}
}
switch (node.kind) {
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
var sourceFile = node;
return ts.isExternalModule(sourceFile)
? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\""
: "<global>";
- case 197 /* ArrowFunction */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 198 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
if (ts.getModifierFlags(node) & 512 /* Default */) {
return "default";
}
@@ -104959,13 +105891,13 @@
// (eg: "app\n.onactivated"), so we should remove the whitespace for readabiltiy in the
// navigation bar.
return getFunctionOrClassName(node);
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return "constructor";
- case 161 /* ConstructSignature */:
+ case 162 /* ConstructSignature */:
return "new()";
- case 160 /* CallSignature */:
+ case 161 /* CallSignature */:
return "()";
- case 162 /* IndexSignature */:
+ case 163 /* IndexSignature */:
return "[]";
default:
return "<unknown>";
@@ -104989,25 +105921,25 @@
return topLevel;
function isTopLevel(item) {
switch (navigationBarNodeKind(item)) {
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 243 /* EnumDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 284 /* SourceFile */:
- case 242 /* TypeAliasDeclaration */:
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
- return true;
- case 157 /* Constructor */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 237 /* VariableDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 244 /* EnumDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 285 /* SourceFile */:
+ case 243 /* TypeAliasDeclaration */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
+ return true;
+ case 158 /* Constructor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 238 /* VariableDeclaration */:
return hasSomeImportantChild(item);
- case 197 /* ArrowFunction */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
return isTopLevelFunctionDeclaration(item);
default:
return false;
@@ -105017,10 +105949,10 @@
return false;
}
switch (navigationBarNodeKind(item.parent)) {
- case 245 /* ModuleBlock */:
- case 284 /* SourceFile */:
- case 156 /* MethodDeclaration */:
- case 157 /* Constructor */:
+ case 246 /* ModuleBlock */:
+ case 285 /* SourceFile */:
+ case 157 /* MethodDeclaration */:
+ case 158 /* Constructor */:
return true;
default:
return hasSomeImportantChild(item);
@@ -105029,7 +105961,7 @@
function hasSomeImportantChild(item) {
return ts.some(item.children, function (child) {
var childKind = navigationBarNodeKind(child);
- return childKind !== 237 /* VariableDeclaration */ && childKind !== 186 /* BindingElement */;
+ return childKind !== 238 /* VariableDeclaration */ && childKind !== 187 /* BindingElement */;
});
}
}
@@ -105086,7 +106018,7 @@
// Otherwise, we need to aggregate each identifier to build up the qualified name.
var result = [];
result.push(ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name));
- while (moduleDeclaration.body && moduleDeclaration.body.kind === 244 /* ModuleDeclaration */) {
+ while (moduleDeclaration.body && moduleDeclaration.body.kind === 245 /* ModuleDeclaration */) {
moduleDeclaration = moduleDeclaration.body;
result.push(ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name));
}
@@ -105100,13 +106032,13 @@
return decl.body && ts.isModuleDeclaration(decl.body) ? getInteriorModule(decl.body) : decl;
}
function isComputedProperty(member) {
- return !member.name || member.name.kind === 149 /* ComputedPropertyName */;
+ return !member.name || member.name.kind === 150 /* ComputedPropertyName */;
}
function getNodeSpan(node) {
- return node.kind === 284 /* SourceFile */ ? ts.createTextSpanFromRange(node) : ts.createTextSpanFromNode(node, curSourceFile);
+ return node.kind === 285 /* SourceFile */ ? ts.createTextSpanFromRange(node) : ts.createTextSpanFromNode(node, curSourceFile);
}
function getModifiers(node) {
- if (node.parent && node.parent.kind === 237 /* VariableDeclaration */) {
+ if (node.parent && node.parent.kind === 238 /* VariableDeclaration */) {
node = node.parent;
}
return ts.getNodeModifiers(node);
@@ -105121,7 +106053,7 @@
return ts.declarationNameToString(parent.name);
}
// See if it is of the form "<expr> = function(){...}". If so, use the text from the left-hand side.
- else if (ts.isBinaryExpression(parent) && parent.operatorToken.kind === 59 /* EqualsToken */) {
+ else if (ts.isBinaryExpression(parent) && parent.operatorToken.kind === 60 /* EqualsToken */) {
return nodeText(parent.left).replace(whiteSpaceRegex, "");
}
// See if it is a property assignment, and if so use the property name
@@ -105159,9 +106091,9 @@
}
function isFunctionOrClassExpression(node) {
switch (node.kind) {
- case 197 /* ArrowFunction */:
- case 196 /* FunctionExpression */:
- case 209 /* ClassExpression */:
+ case 198 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
+ case 210 /* ClassExpression */:
return true;
default:
return false;
@@ -105488,7 +106420,7 @@
}
var lastImport = current - 1;
if (lastImport !== firstImport) {
- out.push(createOutliningSpanFromBounds(ts.findChildOfKind(statements[firstImport], 92 /* ImportKeyword */, sourceFile).getStart(sourceFile), statements[lastImport].getEnd(), "imports" /* Imports */));
+ out.push(createOutliningSpanFromBounds(ts.findChildOfKind(statements[firstImport], 93 /* ImportKeyword */, sourceFile).getStart(sourceFile), statements[lastImport].getEnd(), "imports" /* Imports */));
}
}
function visitNonImportNode(n) {
@@ -105605,31 +106537,31 @@
}
function getOutliningSpanForNode(n, sourceFile) {
switch (n.kind) {
- case 218 /* Block */:
- if (ts.isFunctionBlock(n)) {
- return spanForNode(n.parent, /*autoCollapse*/ n.parent.kind !== 197 /* ArrowFunction */);
+ case 219 /* Block */:
+ if (ts.isFunctionLike(n.parent)) {
+ return functionSpan(n.parent, n, sourceFile);
}
// Check if the block is standalone, or 'attached' to some parent statement.
// If the latter, we want to collapse the block, but consider its hint span
// to be the entire span of the parent.
switch (n.parent.kind) {
- case 223 /* DoStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 225 /* ForStatement */:
- case 222 /* IfStatement */:
- case 224 /* WhileStatement */:
- case 231 /* WithStatement */:
- case 274 /* CatchClause */:
+ case 224 /* DoStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 226 /* ForStatement */:
+ case 223 /* IfStatement */:
+ case 225 /* WhileStatement */:
+ case 232 /* WithStatement */:
+ case 275 /* CatchClause */:
return spanForNode(n.parent);
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
// Could be the try-block, or the finally-block.
var tryStatement = n.parent;
if (tryStatement.tryBlock === n) {
return spanForNode(n.parent);
}
else if (tryStatement.finallyBlock === n) {
- return spanForNode(ts.findChildOfKind(tryStatement, 88 /* FinallyKeyword */, sourceFile));
+ return spanForNode(ts.findChildOfKind(tryStatement, 89 /* FinallyKeyword */, sourceFile));
}
// falls through
default:
@@ -105637,22 +106569,22 @@
// the span of the block, independent of any parent span.
return createOutliningSpan(ts.createTextSpanFromNode(n, sourceFile), "code" /* Code */);
}
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
return spanForNode(n.parent);
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
- case 246 /* CaseBlock */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 247 /* CaseBlock */:
return spanForNode(n);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return spanForObjectOrArrayLiteral(n);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return spanForObjectOrArrayLiteral(n, 22 /* OpenBracketToken */);
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
return spanForJSXElement(n);
- case 261 /* JsxSelfClosingElement */:
- case 262 /* JsxOpeningElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
return spanForJSXAttributes(n.attributes);
}
function spanForJSXElement(node) {
@@ -105674,20 +106606,29 @@
// Otherwise, the collapsed section will include the end of the previous line.
return spanForNode(node, /*autoCollapse*/ false, /*useFullStart*/ !ts.isArrayLiteralExpression(node.parent) && !ts.isCallExpression(node.parent), open);
}
- function spanForNode(hintSpanNode, autoCollapse, useFullStart, open) {
+ function spanForNode(hintSpanNode, autoCollapse, useFullStart, open, close) {
if (autoCollapse === void 0) { autoCollapse = false; }
if (useFullStart === void 0) { useFullStart = true; }
if (open === void 0) { open = 18 /* OpenBraceToken */; }
+ if (close === void 0) { close = open === 18 /* OpenBraceToken */ ? 19 /* CloseBraceToken */ : 23 /* CloseBracketToken */; }
var openToken = ts.findChildOfKind(n, open, sourceFile);
- var close = open === 18 /* OpenBraceToken */ ? 19 /* CloseBraceToken */ : 23 /* CloseBracketToken */;
var closeToken = ts.findChildOfKind(n, close, sourceFile);
- if (!openToken || !closeToken) {
- return undefined;
+ return openToken && closeToken && spanBetweenTokens(openToken, closeToken, hintSpanNode, sourceFile, autoCollapse, useFullStart);
+ }
}
+ function functionSpan(node, body, sourceFile) {
+ var openToken = ts.isNodeArrayMultiLine(node.parameters, sourceFile)
+ ? ts.findChildOfKind(node, 20 /* OpenParenToken */, sourceFile)
+ : ts.findChildOfKind(body, 18 /* OpenBraceToken */, sourceFile);
+ var closeToken = ts.findChildOfKind(body, 19 /* CloseBraceToken */, sourceFile);
+ return openToken && closeToken && spanBetweenTokens(openToken, closeToken, node.parent, sourceFile, /*autoCollapse*/ node.parent.kind !== 198 /* ArrowFunction */);
+ }
+ function spanBetweenTokens(openToken, closeToken, hintSpanNode, sourceFile, autoCollapse, useFullStart) {
+ if (autoCollapse === void 0) { autoCollapse = false; }
+ if (useFullStart === void 0) { useFullStart = true; }
var textSpan = ts.createTextSpanFromBounds(useFullStart ? openToken.getFullStart() : openToken.getStart(sourceFile), closeToken.getEnd());
return createOutliningSpan(textSpan, "code" /* Code */, ts.createTextSpanFromNode(hintSpanNode, sourceFile), autoCollapse);
}
- }
function createOutliningSpan(textSpan, kind, hintSpan, autoCollapse, bannerText) {
if (hintSpan === void 0) { hintSpan = textSpan; }
if (autoCollapse === void 0) { autoCollapse = false; }
@@ -105950,7 +106891,7 @@
if (ch >= 65 /* A */ && ch <= 90 /* Z */) {
return true;
}
- if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 7 /* Latest */)) {
+ if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 8 /* Latest */)) {
return false;
}
// TODO: find a way to determine this for any unicode characters in a
@@ -105963,7 +106904,7 @@
if (ch >= 97 /* a */ && ch <= 122 /* z */) {
return true;
}
- if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 7 /* Latest */)) {
+ if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 8 /* Latest */)) {
return false;
}
// TODO: find a way to determine this for any unicode characters in a
@@ -106215,10 +107156,10 @@
*/
function tryConsumeDeclare() {
var token = ts.scanner.getToken();
- if (token === 125 /* DeclareKeyword */) {
+ if (token === 126 /* DeclareKeyword */) {
// declare module "mod"
token = nextToken();
- if (token === 130 /* ModuleKeyword */) {
+ if (token === 131 /* ModuleKeyword */) {
token = nextToken();
if (token === 10 /* StringLiteral */) {
recordAmbientExternalModule();
@@ -106236,7 +107177,7 @@
return false;
}
var token = ts.scanner.getToken();
- if (token === 92 /* ImportKeyword */) {
+ if (token === 93 /* ImportKeyword */) {
token = nextToken();
if (token === 20 /* OpenParenToken */) {
token = nextToken();
@@ -106252,9 +107193,9 @@
return true;
}
else {
- if (token === 72 /* Identifier */ || ts.isKeyword(token)) {
+ if (token === 73 /* Identifier */ || ts.isKeyword(token)) {
token = nextToken();
- if (token === 144 /* FromKeyword */) {
+ if (token === 145 /* FromKeyword */) {
token = nextToken();
if (token === 10 /* StringLiteral */) {
// import d from "mod";
@@ -106262,7 +107203,7 @@
return true;
}
}
- else if (token === 59 /* EqualsToken */) {
+ else if (token === 60 /* EqualsToken */) {
if (tryConsumeRequireCall(/*skipCurrentToken*/ true)) {
return true;
}
@@ -106285,7 +107226,7 @@
}
if (token === 19 /* CloseBraceToken */) {
token = nextToken();
- if (token === 144 /* FromKeyword */) {
+ if (token === 145 /* FromKeyword */) {
token = nextToken();
if (token === 10 /* StringLiteral */) {
// import {a as A} from "mod";
@@ -106297,11 +107238,11 @@
}
else if (token === 40 /* AsteriskToken */) {
token = nextToken();
- if (token === 119 /* AsKeyword */) {
+ if (token === 120 /* AsKeyword */) {
token = nextToken();
- if (token === 72 /* Identifier */ || ts.isKeyword(token)) {
+ if (token === 73 /* Identifier */ || ts.isKeyword(token)) {
token = nextToken();
- if (token === 144 /* FromKeyword */) {
+ if (token === 145 /* FromKeyword */) {
token = nextToken();
if (token === 10 /* StringLiteral */) {
// import * as NS from "mod"
@@ -106319,7 +107260,7 @@
}
function tryConsumeExport() {
var token = ts.scanner.getToken();
- if (token === 85 /* ExportKeyword */) {
+ if (token === 86 /* ExportKeyword */) {
markAsExternalModuleIfTopLevel();
token = nextToken();
if (token === 18 /* OpenBraceToken */) {
@@ -106331,7 +107272,7 @@
}
if (token === 19 /* CloseBraceToken */) {
token = nextToken();
- if (token === 144 /* FromKeyword */) {
+ if (token === 145 /* FromKeyword */) {
token = nextToken();
if (token === 10 /* StringLiteral */) {
// export {a as A} from "mod";
@@ -106343,7 +107284,7 @@
}
else if (token === 40 /* AsteriskToken */) {
token = nextToken();
- if (token === 144 /* FromKeyword */) {
+ if (token === 145 /* FromKeyword */) {
token = nextToken();
if (token === 10 /* StringLiteral */) {
// export * from "mod"
@@ -106351,11 +107292,11 @@
}
}
}
- else if (token === 92 /* ImportKeyword */) {
+ else if (token === 93 /* ImportKeyword */) {
token = nextToken();
- if (token === 72 /* Identifier */ || ts.isKeyword(token)) {
+ if (token === 73 /* Identifier */ || ts.isKeyword(token)) {
token = nextToken();
- if (token === 59 /* EqualsToken */) {
+ if (token === 60 /* EqualsToken */) {
if (tryConsumeRequireCall(/*skipCurrentToken*/ true)) {
return true;
}
@@ -106368,7 +107309,7 @@
}
function tryConsumeRequireCall(skipCurrentToken) {
var token = skipCurrentToken ? nextToken() : ts.scanner.getToken();
- if (token === 134 /* RequireKeyword */) {
+ if (token === 135 /* RequireKeyword */) {
token = nextToken();
if (token === 20 /* OpenParenToken */) {
token = nextToken();
@@ -106383,7 +107324,7 @@
}
function tryConsumeDefine() {
var token = ts.scanner.getToken();
- if (token === 72 /* Identifier */ && ts.scanner.getTokenValue() === "define") {
+ if (token === 73 /* Identifier */ && ts.scanner.getTokenValue() === "define") {
token = nextToken();
if (token !== 20 /* OpenParenToken */) {
return true;
@@ -106517,14 +107458,14 @@
return getRenameInfoError(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library);
}
// Cannot rename `default` as in `import { default as foo } from "./someModule";
- if (ts.isIdentifier(node) && node.originalKeywordKind === 80 /* DefaultKeyword */ && symbol.parent.flags & 1536 /* Module */) {
+ if (ts.isIdentifier(node) && node.originalKeywordKind === 81 /* DefaultKeyword */ && symbol.parent.flags & 1536 /* Module */) {
return undefined;
}
if (ts.isStringLiteralLike(node) && ts.tryGetImportFromModuleSpecifier(node)) {
return options && options.allowRenameOfImportPath ? getRenameInfoForModule(node, sourceFile, symbol) : undefined;
}
var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node);
- var specifierName = (ts.isImportOrExportSpecifierName(node) || ts.isStringOrNumericLiteralLike(node) && node.parent.kind === 149 /* ComputedPropertyName */)
+ var specifierName = (ts.isImportOrExportSpecifierName(node) || ts.isStringOrNumericLiteralLike(node) && node.parent.kind === 150 /* ComputedPropertyName */)
? ts.stripQuotes(ts.getTextOfIdentifierOrLiteral(node))
: undefined;
var displayName = specifierName || typeChecker.symbolToString(symbol);
@@ -106580,9 +107521,9 @@
}
function nodeIsEligibleForRename(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
case 10 /* StringLiteral */:
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
return true;
case 8 /* NumericLiteral */:
return ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node);
@@ -106595,6 +107536,275 @@
/* @internal */
var ts;
(function (ts) {
+ var SmartSelectionRange;
+ (function (SmartSelectionRange) {
+ function getSmartSelectionRange(pos, sourceFile) {
+ var selectionRange = {
+ textSpan: ts.createTextSpanFromBounds(sourceFile.getFullStart(), sourceFile.getEnd())
+ };
+ var parentNode = sourceFile;
+ outer: while (true) {
+ var children = getSelectionChildren(parentNode);
+ if (!children.length)
+ break;
+ for (var i = 0; i < children.length; i++) {
+ var prevNode = children[i - 1];
+ var node = children[i];
+ var nextNode = children[i + 1];
+ if (node.getStart(sourceFile) > pos) {
+ break outer;
+ }
+ if (positionShouldSnapToNode(pos, node, nextNode)) {
+ // 1. Blocks are effectively redundant with SyntaxLists.
+ // 2. TemplateSpans, along with the SyntaxLists containing them, are a somewhat unintuitive grouping
+ // of things that should be considered independently.
+ // 3. A VariableStatement’s children are just a VaraiableDeclarationList and a semicolon.
+ // 4. A lone VariableDeclaration in a VaraibleDeclaration feels redundant with the VariableStatement.
+ //
+ // Dive in without pushing a selection range.
+ if (ts.isBlock(node)
+ || ts.isTemplateSpan(node) || ts.isTemplateHead(node)
+ || prevNode && ts.isTemplateHead(prevNode)
+ || ts.isVariableDeclarationList(node) && ts.isVariableStatement(parentNode)
+ || ts.isSyntaxList(node) && ts.isVariableDeclarationList(parentNode)
+ || ts.isVariableDeclaration(node) && ts.isSyntaxList(parentNode) && children.length === 1) {
+ parentNode = node;
+ break;
+ }
+ // Synthesize a stop for '${ ... }' since '${' and '}' actually belong to siblings.
+ if (ts.isTemplateSpan(parentNode) && nextNode && ts.isTemplateMiddleOrTemplateTail(nextNode)) {
+ var start_2 = node.getFullStart() - "${".length;
+ var end_2 = nextNode.getStart() + "}".length;
+ pushSelectionRange(start_2, end_2);
+ }
+ // Blocks with braces, brackets, parens, or JSX tags on separate lines should be
+ // selected from open to close, including whitespace but not including the braces/etc. themselves.
+ var isBetweenMultiLineBookends = ts.isSyntaxList(node)
+ && isListOpener(prevNode)
+ && isListCloser(nextNode)
+ && !ts.positionsAreOnSameLine(prevNode.getStart(), nextNode.getStart(), sourceFile);
+ var jsDocCommentStart = ts.hasJSDocNodes(node) && node.jsDoc[0].getStart();
+ var start = isBetweenMultiLineBookends ? prevNode.getEnd() : node.getStart();
+ var end = isBetweenMultiLineBookends ? nextNode.getStart() : node.getEnd();
+ if (ts.isNumber(jsDocCommentStart)) {
+ pushSelectionRange(jsDocCommentStart, end);
+ }
+ pushSelectionRange(start, end);
+ // String literals should have a stop both inside and outside their quotes.
+ if (ts.isStringLiteral(node) || ts.isTemplateLiteral(node)) {
+ pushSelectionRange(start + 1, end - 1);
+ }
+ parentNode = node;
+ break;
+ }
+ }
+ }
+ return selectionRange;
+ function pushSelectionRange(start, end) {
+ // Skip empty ranges
+ if (start !== end) {
+ // Skip ranges that are identical to the parent
+ var textSpan = ts.createTextSpanFromBounds(start, end);
+ if (!selectionRange || !ts.textSpansEqual(textSpan, selectionRange.textSpan)) {
+ selectionRange = __assign({ textSpan: textSpan }, selectionRange && { parent: selectionRange });
+ }
+ }
+ }
+ }
+ SmartSelectionRange.getSmartSelectionRange = getSmartSelectionRange;
+ /**
+ * Like `ts.positionBelongsToNode`, except positions immediately after nodes
+ * count too, unless that position belongs to the next node. In effect, makes
+ * selections able to snap to preceding tokens when the cursor is on the tail
+ * end of them with only whitespace ahead.
+ * @param pos The position to check.
+ * @param node The candidate node to snap to.
+ * @param nextNode The next sibling node in the tree.
+ * @param sourceFile The source file containing the nodes.
+ */
+ function positionShouldSnapToNode(pos, node, nextNode) {
+ // Can’t use 'ts.positionBelongsToNode()' here because it cleverly accounts
+ // for missing nodes, which can’t really be considered when deciding what
+ // to select.
+ ts.Debug.assert(node.pos <= pos);
+ if (pos < node.end) {
+ return true;
+ }
+ var nodeEnd = node.getEnd();
+ var nextNodeStart = nextNode && nextNode.getStart();
+ if (nodeEnd === pos) {
+ return pos !== nextNodeStart;
+ }
+ return false;
+ }
+ var isImport = ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration);
+ /**
+ * Gets the children of a node to be considered for selection ranging,
+ * transforming them into an artificial tree according to their intuitive
+ * grouping where no grouping actually exists in the parse tree. For example,
+ * top-level imports are grouped into their own SyntaxList so they can be
+ * selected all together, even though in the AST they’re just siblings of each
+ * other as well as of other top-level statements and declarations.
+ */
+ function getSelectionChildren(node) {
+ // Group top-level imports
+ if (ts.isSourceFile(node)) {
+ return groupChildren(node.getChildAt(0).getChildren(), isImport);
+ }
+ // Mapped types _look_ like ObjectTypes with a single member,
+ // but in fact don’t contain a SyntaxList or a node containing
+ // the “key/value” pair like ObjectTypes do, but it seems intuitive
+ // that the selection would snap to those points. The philosophy
+ // of choosing a selection range is not so much about what the
+ // syntax currently _is_ as what the syntax might easily become
+ // if the user is making a selection; e.g., we synthesize a selection
+ // around the “key/value” pair not because there’s a node there, but
+ // because it allows the mapped type to become an object type with a
+ // few keystrokes.
+ if (ts.isMappedTypeNode(node)) {
+ var _a = node.getChildren(), openBraceToken = _a[0], children = _a.slice(1);
+ var closeBraceToken = ts.Debug.assertDefined(children.pop());
+ ts.Debug.assertEqual(openBraceToken.kind, 18 /* OpenBraceToken */);
+ ts.Debug.assertEqual(closeBraceToken.kind, 19 /* CloseBraceToken */);
+ // Group `-/+readonly` and `-/+?`
+ var groupedWithPlusMinusTokens = groupChildren(children, function (child) {
+ return child === node.readonlyToken || child.kind === 134 /* ReadonlyKeyword */ ||
+ child === node.questionToken || child.kind === 56 /* QuestionToken */;
+ });
+ // Group type parameter with surrounding brackets
+ var groupedWithBrackets = groupChildren(groupedWithPlusMinusTokens, function (_a) {
+ var kind = _a.kind;
+ return kind === 22 /* OpenBracketToken */ ||
+ kind === 151 /* TypeParameter */ ||
+ kind === 23 /* CloseBracketToken */;
+ });
+ return [
+ openBraceToken,
+ // Pivot on `:`
+ createSyntaxList(splitChildren(groupedWithBrackets, function (_a) {
+ var kind = _a.kind;
+ return kind === 57 /* ColonToken */;
+ })),
+ closeBraceToken,
+ ];
+ }
+ // Group modifiers and property name, then pivot on `:`.
+ if (ts.isPropertySignature(node)) {
+ var children = groupChildren(node.getChildren(), function (child) {
+ return child === node.name || ts.contains(node.modifiers, child);
+ });
+ return splitChildren(children, function (_a) {
+ var kind = _a.kind;
+ return kind === 57 /* ColonToken */;
+ });
+ }
+ // Group the parameter name with its `...`, then that group with its `?`, then pivot on `=`.
+ if (ts.isParameter(node)) {
+ var groupedDotDotDotAndName_1 = groupChildren(node.getChildren(), function (child) {
+ return child === node.dotDotDotToken || child === node.name;
+ });
+ var groupedWithQuestionToken = groupChildren(groupedDotDotDotAndName_1, function (child) {
+ return child === groupedDotDotDotAndName_1[0] || child === node.questionToken;
+ });
+ return splitChildren(groupedWithQuestionToken, function (_a) {
+ var kind = _a.kind;
+ return kind === 60 /* EqualsToken */;
+ });
+ }
+ // Pivot on '='
+ if (ts.isBindingElement(node)) {
+ return splitChildren(node.getChildren(), function (_a) {
+ var kind = _a.kind;
+ return kind === 60 /* EqualsToken */;
+ });
+ }
+ return node.getChildren();
+ }
+ /**
+ * Groups sibling nodes together into their own SyntaxList if they
+ * a) are adjacent, AND b) match a predicate function.
+ */
+ function groupChildren(children, groupOn) {
+ var result = [];
+ var group;
+ for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {
+ var child = children_1[_i];
+ if (groupOn(child)) {
+ group = group || [];
+ group.push(child);
+ }
+ else {
+ if (group) {
+ result.push(createSyntaxList(group));
+ group = undefined;
+ }
+ result.push(child);
+ }
+ }
+ if (group) {
+ result.push(createSyntaxList(group));
+ }
+ return result;
+ }
+ /**
+ * Splits sibling nodes into up to four partitions:
+ * 1) everything left of the first node matched by `pivotOn`,
+ * 2) the first node matched by `pivotOn`,
+ * 3) everything right of the first node matched by `pivotOn`,
+ * 4) a trailing semicolon, if `separateTrailingSemicolon` is enabled.
+ * The left and right groups, if not empty, will each be grouped into their own containing SyntaxList.
+ * @param children The sibling nodes to split.
+ * @param pivotOn The predicate function to match the node to be the pivot. The first node that matches
+ * the predicate will be used; any others that may match will be included into the right-hand group.
+ * @param separateTrailingSemicolon If the last token is a semicolon, it will be returned as a separate
+ * child rather than be included in the right-hand group.
+ */
+ function splitChildren(children, pivotOn, separateTrailingSemicolon) {
+ if (separateTrailingSemicolon === void 0) { separateTrailingSemicolon = true; }
+ if (children.length < 2) {
+ return children;
+ }
+ var splitTokenIndex = ts.findIndex(children, pivotOn);
+ if (splitTokenIndex === -1) {
+ return children;
+ }
+ var leftChildren = children.slice(0, splitTokenIndex);
+ var splitToken = children[splitTokenIndex];
+ var lastToken = ts.last(children);
+ var separateLastToken = separateTrailingSemicolon && lastToken.kind === 26 /* SemicolonToken */;
+ var rightChildren = children.slice(splitTokenIndex + 1, separateLastToken ? children.length - 1 : undefined);
+ var result = ts.compact([
+ leftChildren.length ? createSyntaxList(leftChildren) : undefined,
+ splitToken,
+ rightChildren.length ? createSyntaxList(rightChildren) : undefined,
+ ]);
+ return separateLastToken ? result.concat(lastToken) : result;
+ }
+ function createSyntaxList(children) {
+ ts.Debug.assertGreaterThanOrEqual(children.length, 1);
+ var syntaxList = ts.createNode(312 /* SyntaxList */, children[0].pos, ts.last(children).end);
+ syntaxList._children = children;
+ return syntaxList;
+ }
+ function isListOpener(token) {
+ var kind = token && token.kind;
+ return kind === 18 /* OpenBraceToken */
+ || kind === 22 /* OpenBracketToken */
+ || kind === 20 /* OpenParenToken */
+ || kind === 263 /* JsxOpeningElement */;
+ }
+ function isListCloser(token) {
+ var kind = token && token.kind;
+ return kind === 19 /* CloseBraceToken */
+ || kind === 23 /* CloseBracketToken */
+ || kind === 21 /* CloseParenToken */
+ || kind === 264 /* JsxClosingElement */;
+ }
+ })(SmartSelectionRange = ts.SmartSelectionRange || (ts.SmartSelectionRange = {}));
+})(ts || (ts = {}));
+/* @internal */
+var ts;
+(function (ts) {
var SignatureHelp;
(function (SignatureHelp) {
var InvocationKind;
@@ -106705,9 +107915,22 @@
});
}
function containsPrecedingToken(startingToken, sourceFile, container) {
- var precedingToken = ts.Debug.assertDefined(ts.findPrecedingToken(startingToken.getFullStart(), sourceFile, startingToken.parent, /*excludeJsdoc*/ true));
+ var pos = startingToken.getFullStart();
+ // There’s a possibility that `startingToken.parent` contains only `startingToken` and
+ // missing nodes, none of which are valid to be returned by `findPrecedingToken`. In that
+ // case, the preceding token we want is actually higher up the tree—almost definitely the
+ // next parent, but theoretically the situation with missing nodes might be happening on
+ // multiple nested levels.
+ var currentParent = startingToken.parent;
+ while (currentParent) {
+ var precedingToken = ts.findPrecedingToken(pos, sourceFile, currentParent, /*excludeJsdoc*/ true);
+ if (precedingToken) {
return ts.rangeContainsRange(container, precedingToken);
}
+ currentParent = currentParent.parent;
+ }
+ return ts.Debug.fail("Could not find preceding token");
+ }
function getArgumentInfoForCompletions(node, position, sourceFile) {
var info = getImmediatelyContainingArgumentInfo(node, position, sourceFile);
return !info || info.isTypeParameterList || info.invocation.kind !== 0 /* Call */ ? undefined
@@ -106780,10 +108003,10 @@
}
return undefined;
}
- else if (ts.isTemplateHead(node) && parent.parent.kind === 193 /* TaggedTemplateExpression */) {
+ else if (ts.isTemplateHead(node) && parent.parent.kind === 194 /* TaggedTemplateExpression */) {
var templateExpression = parent;
var tagExpression = templateExpression.parent;
- ts.Debug.assert(templateExpression.kind === 206 /* TemplateExpression */);
+ ts.Debug.assert(templateExpression.kind === 207 /* TemplateExpression */);
var argumentIndex = ts.isInsideTemplateLiteral(node, position, sourceFile) ? 0 : 1;
return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile);
}
@@ -106850,17 +108073,17 @@
return undefined;
var parent = startingToken.parent;
switch (parent.kind) {
- case 195 /* ParenthesizedExpression */:
- case 156 /* MethodDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 196 /* ParenthesizedExpression */:
+ case 157 /* MethodDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
var info = getArgumentOrParameterListInfo(startingToken, sourceFile);
if (!info)
return undefined;
var argumentIndex = info.argumentIndex, argumentCount = info.argumentCount, argumentsSpan = info.argumentsSpan;
var contextualType = ts.isMethodDeclaration(parent) ? checker.getContextualTypeForObjectLiteralElement(parent) : checker.getContextualType(parent);
return contextualType && { contextualType: contextualType, argumentIndex: argumentIndex, argumentCount: argumentCount, argumentsSpan: argumentsSpan };
- case 204 /* BinaryExpression */: {
+ case 205 /* BinaryExpression */: {
var highestBinary = getHighestBinary(parent);
var contextualType_1 = checker.getContextualType(highestBinary);
var argumentIndex_1 = startingToken.kind === 20 /* OpenParenToken */ ? 0 : countBinaryExpressionParameters(parent) - 1;
@@ -106984,7 +108207,7 @@
// | |
// This is because a Missing node has no width. However, what we actually want is to include trivia
// leading up to the next token in case the user is about to type in a TemplateMiddle or TemplateTail.
- if (template.kind === 206 /* TemplateExpression */) {
+ if (template.kind === 207 /* TemplateExpression */) {
var lastSpan = ts.last(template.templateSpans);
if (lastSpan.literal.getFullWidth() === 0) {
applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, /*stopAfterLineBreak*/ false);
@@ -106996,7 +108219,7 @@
var _loop_7 = function (n) {
// If the node is not a subspan of its parent, this is a big problem.
// There have been crashes that might be caused by this violation.
- ts.Debug.assert(ts.rangeContainsRange(n.parent, n), "Not a subspan", function () { return "Child: " + ts.Debug.showSyntaxKind(n) + ", parent: " + ts.Debug.showSyntaxKind(n.parent); });
+ ts.Debug.assert(ts.rangeContainsRange(n.parent, n), "Not a subspan", function () { return "Child: " + ts.Debug.formatSyntaxKind(n.kind) + ", parent: " + ts.Debug.formatSyntaxKind(n.parent.kind); });
var argumentInfo = getImmediatelyContainingArgumentOrContextualParameterInfo(n, position, sourceFile, checker);
if (argumentInfo) {
return { value: argumentInfo };
@@ -107296,7 +108519,7 @@
function check(node) {
if (isJsFile) {
switch (node.kind) {
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
var decl = ts.getDeclarationOfExpando(node);
if (decl) {
var symbol_1 = decl.symbol;
@@ -107306,7 +108529,7 @@
}
}
// falls through if no diagnostic was created
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
var symbol = node.symbol;
if (symbol.members && (symbol.members.size > 0)) {
diags.push(ts.createDiagnosticForNode(ts.isVariableDeclaration(node.parent) ? node.parent.name : node, ts.Diagnostics.This_constructor_function_may_be_converted_to_a_class_declaration));
@@ -107339,11 +108562,11 @@
function containsTopLevelCommonjs(sourceFile) {
return sourceFile.statements.some(function (statement) {
switch (statement.kind) {
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return statement.declarationList.declarations.some(function (decl) {
return !!decl.initializer && ts.isRequireCall(propertyAccessLeftHandSide(decl.initializer), /*checkArgumentIsStringLiteralLike*/ true);
});
- case 221 /* ExpressionStatement */: {
+ case 222 /* ExpressionStatement */: {
var expression = statement.expression;
if (!ts.isBinaryExpression(expression))
return ts.isRequireCall(expression, /*checkArgumentIsStringLiteralLike*/ true);
@@ -107360,12 +108583,12 @@
}
function importNameForConvertToDefaultImport(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
var importClause = node.importClause, moduleSpecifier = node.moduleSpecifier;
- return importClause && !importClause.name && importClause.namedBindings && importClause.namedBindings.kind === 251 /* NamespaceImport */ && ts.isStringLiteral(moduleSpecifier)
+ return importClause && !importClause.name && importClause.namedBindings && importClause.namedBindings.kind === 252 /* NamespaceImport */ && ts.isStringLiteral(moduleSpecifier)
? importClause.namedBindings.name
: undefined;
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return node.name;
default:
return undefined;
@@ -107423,13 +108646,13 @@
// should be kept up to date with getTransformationBody in convertToAsyncFunction.ts
function isFixablePromiseArgument(arg) {
switch (arg.kind) {
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
visitedNestedConvertibleFunctions.set(getKeyFromNode(arg), true);
/* falls through */
- case 96 /* NullKeyword */:
- case 72 /* Identifier */: // identifier includes undefined
+ case 97 /* NullKeyword */:
+ case 73 /* Identifier */: // identifier includes undefined
return true;
default:
return false;
@@ -107452,7 +108675,7 @@
}
var flags = ts.getCombinedLocalAndExportSymbolFlags(symbol);
if (flags & 32 /* Class */) {
- return ts.getDeclarationOfKind(symbol, 209 /* ClassExpression */) ?
+ return ts.getDeclarationOfKind(symbol, 210 /* ClassExpression */) ?
"local class" /* localClassElement */ : "class" /* classElement */;
}
if (flags & 384 /* Enum */)
@@ -107489,7 +108712,7 @@
if (typeChecker.isArgumentsSymbol(symbol)) {
return "local var" /* localVariableElement */;
}
- if (location.kind === 100 /* ThisKeyword */ && ts.isExpression(location)) {
+ if (location.kind === 101 /* ThisKeyword */ && ts.isExpression(location)) {
return "parameter" /* parameterElement */;
}
var flags = ts.getCombinedLocalAndExportSymbolFlags(symbol);
@@ -107540,11 +108763,11 @@
// If we requested completions after `x.` at the top-level, we may be at a source file location.
switch (location.parent && location.parent.kind) {
// If we've typed a character of the attribute name, will be 'JsxAttribute', else will be 'JsxOpeningElement'.
- case 262 /* JsxOpeningElement */:
- case 260 /* JsxElement */:
- case 261 /* JsxSelfClosingElement */:
- return location.kind === 72 /* Identifier */ ? "property" /* memberVariableElement */ : "JSX attribute" /* jsxAttribute */;
- case 267 /* JsxAttribute */:
+ case 263 /* JsxOpeningElement */:
+ case 261 /* JsxElement */:
+ case 262 /* JsxSelfClosingElement */:
+ return location.kind === 73 /* Identifier */ ? "property" /* memberVariableElement */ : "JSX attribute" /* jsxAttribute */;
+ case 268 /* JsxAttribute */:
return "JSX attribute" /* jsxAttribute */;
default:
return "property" /* memberVariableElement */;
@@ -107571,13 +108794,13 @@
var symbolFlags = ts.getCombinedLocalAndExportSymbolFlags(symbol);
var symbolKind = semanticMeaning & 1 /* Value */ ? getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location) : "" /* unknown */;
var hasAddedSymbolInfo = false;
- var isThisExpression = location.kind === 100 /* ThisKeyword */ && ts.isInExpressionContext(location);
+ var isThisExpression = location.kind === 101 /* ThisKeyword */ && ts.isInExpressionContext(location);
var type;
var printer;
var documentationFromAlias;
var tagsFromAlias;
- if (location.kind === 100 /* ThisKeyword */ && !isThisExpression) {
- return { displayParts: [ts.keywordPart(100 /* ThisKeyword */)], documentation: [], symbolKind: "primitive type" /* primitiveType */, tags: undefined };
+ if (location.kind === 101 /* ThisKeyword */ && !isThisExpression) {
+ return { displayParts: [ts.keywordPart(101 /* ThisKeyword */)], documentation: [], symbolKind: "primitive type" /* primitiveType */, tags: undefined };
}
// Class at constructor site need to be shown as constructor apart from property,method, vars
if (symbolKind !== "" /* unknown */ || symbolFlags & 32 /* Class */ || symbolFlags & 2097152 /* Alias */) {
@@ -107587,7 +108810,7 @@
}
var signature = void 0;
type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol.exportSymbol || symbol, location);
- if (location.parent && location.parent.kind === 189 /* PropertyAccessExpression */) {
+ if (location.parent && location.parent.kind === 190 /* PropertyAccessExpression */) {
var right = location.parent.name;
// Either the location is on the right of a property access, or on the left and the right is missing
if (right === location || (right && right.getFullWidth() === 0)) {
@@ -107606,9 +108829,8 @@
callExpressionLike = location.parent;
}
if (callExpressionLike) {
- var candidateSignatures = [];
- signature = typeChecker.getResolvedSignature(callExpressionLike, candidateSignatures); // TODO: GH#18217
- var useConstructSignatures = callExpressionLike.kind === 192 /* NewExpression */ || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 98 /* SuperKeyword */);
+ signature = typeChecker.getResolvedSignature(callExpressionLike); // TODO: GH#18217
+ var useConstructSignatures = callExpressionLike.kind === 193 /* NewExpression */ || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 99 /* SuperKeyword */);
var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures();
if (!ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) {
// Get the first signature if there is one -- allSignatures may contain
@@ -107626,7 +108848,7 @@
pushSymbolKind(symbolKind);
displayParts.push(ts.spacePart());
if (useConstructSignatures) {
- displayParts.push(ts.keywordPart(95 /* NewKeyword */));
+ displayParts.push(ts.keywordPart(96 /* NewKeyword */));
displayParts.push(ts.spacePart());
}
addFullSymbolName(symbol);
@@ -107650,7 +108872,7 @@
displayParts.push(ts.lineBreakPart());
}
if (useConstructSignatures) {
- displayParts.push(ts.keywordPart(95 /* NewKeyword */));
+ displayParts.push(ts.keywordPart(96 /* NewKeyword */));
displayParts.push(ts.spacePart());
}
addSignatureDisplayParts(signature, allSignatures, 262144 /* WriteArrowStyleSignature */);
@@ -107663,29 +108885,29 @@
}
}
else if ((ts.isNameOfFunctionDeclaration(location) && !(symbolFlags & 98304 /* Accessor */)) || // name of function declaration
- (location.kind === 124 /* ConstructorKeyword */ && location.parent.kind === 157 /* Constructor */)) { // At constructor keyword of constructor declaration
+ (location.kind === 125 /* ConstructorKeyword */ && location.parent.kind === 158 /* Constructor */)) { // At constructor keyword of constructor declaration
// get the signature from the declaration and write it
var functionDeclaration_1 = location.parent;
// Use function declaration to write the signatures only if the symbol corresponding to this declaration
var locationIsSymbolDeclaration = ts.find(symbol.declarations, function (declaration) {
- return declaration === (location.kind === 124 /* ConstructorKeyword */ ? functionDeclaration_1.parent : functionDeclaration_1);
+ return declaration === (location.kind === 125 /* ConstructorKeyword */ ? functionDeclaration_1.parent : functionDeclaration_1);
});
if (locationIsSymbolDeclaration) {
- var allSignatures = functionDeclaration_1.kind === 157 /* Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures();
+ var allSignatures = functionDeclaration_1.kind === 158 /* Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures();
if (!typeChecker.isImplementationOfOverload(functionDeclaration_1)) {
signature = typeChecker.getSignatureFromDeclaration(functionDeclaration_1); // TODO: GH#18217
}
else {
signature = allSignatures[0];
}
- if (functionDeclaration_1.kind === 157 /* Constructor */) {
+ if (functionDeclaration_1.kind === 158 /* Constructor */) {
// show (constructor) Type(...) signature
symbolKind = "constructor" /* constructorImplementationElement */;
addPrefixForAnyFunctionOrVar(type.symbol, symbolKind);
}
else {
// (function/method) symbol(..signature)
- addPrefixForAnyFunctionOrVar(functionDeclaration_1.kind === 160 /* CallSignature */ &&
+ addPrefixForAnyFunctionOrVar(functionDeclaration_1.kind === 161 /* CallSignature */ &&
!(type.symbol.flags & 2048 /* TypeLiteral */ || type.symbol.flags & 4096 /* ObjectLiteral */) ? type.symbol : symbol, symbolKind);
}
addSignatureDisplayParts(signature, allSignatures);
@@ -107695,7 +108917,7 @@
}
if (symbolFlags & 32 /* Class */ && !hasAddedSymbolInfo && !isThisExpression) {
addAliasPrefixIfNecessary();
- if (ts.getDeclarationOfKind(symbol, 209 /* ClassExpression */)) {
+ if (ts.getDeclarationOfKind(symbol, 210 /* ClassExpression */)) {
// Special case for class expressions because we would like to indicate that
// the class name is local to the class body (similar to function expression)
// (local class) class <className>
@@ -107703,7 +108925,7 @@
}
else {
// Class declaration has name which is not local.
- displayParts.push(ts.keywordPart(76 /* ClassKeyword */));
+ displayParts.push(ts.keywordPart(77 /* ClassKeyword */));
}
displayParts.push(ts.spacePart());
addFullSymbolName(symbol);
@@ -107711,37 +108933,37 @@
}
if ((symbolFlags & 64 /* Interface */) && (semanticMeaning & 2 /* Type */)) {
prefixNextMeaning();
- displayParts.push(ts.keywordPart(110 /* InterfaceKeyword */));
+ displayParts.push(ts.keywordPart(111 /* InterfaceKeyword */));
displayParts.push(ts.spacePart());
addFullSymbolName(symbol);
writeTypeParametersOfSymbol(symbol, sourceFile);
}
if ((symbolFlags & 524288 /* TypeAlias */) && (semanticMeaning & 2 /* Type */)) {
prefixNextMeaning();
- displayParts.push(ts.keywordPart(140 /* TypeKeyword */));
+ displayParts.push(ts.keywordPart(141 /* TypeKeyword */));
displayParts.push(ts.spacePart());
addFullSymbolName(symbol);
writeTypeParametersOfSymbol(symbol, sourceFile);
displayParts.push(ts.spacePart());
- displayParts.push(ts.operatorPart(59 /* EqualsToken */));
+ displayParts.push(ts.operatorPart(60 /* EqualsToken */));
displayParts.push(ts.spacePart());
ts.addRange(displayParts, ts.typeToDisplayParts(typeChecker, typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration, 8388608 /* InTypeAlias */));
}
if (symbolFlags & 384 /* Enum */) {
prefixNextMeaning();
if (ts.some(symbol.declarations, function (d) { return ts.isEnumDeclaration(d) && ts.isEnumConst(d); })) {
- displayParts.push(ts.keywordPart(77 /* ConstKeyword */));
+ displayParts.push(ts.keywordPart(78 /* ConstKeyword */));
displayParts.push(ts.spacePart());
}
- displayParts.push(ts.keywordPart(84 /* EnumKeyword */));
+ displayParts.push(ts.keywordPart(85 /* EnumKeyword */));
displayParts.push(ts.spacePart());
addFullSymbolName(symbol);
}
if (symbolFlags & 1536 /* Module */ && !isThisExpression) {
prefixNextMeaning();
- var declaration = ts.getDeclarationOfKind(symbol, 244 /* ModuleDeclaration */);
- var isNamespace = declaration && declaration.name && declaration.name.kind === 72 /* Identifier */;
- displayParts.push(ts.keywordPart(isNamespace ? 131 /* NamespaceKeyword */ : 130 /* ModuleKeyword */));
+ var declaration = ts.getDeclarationOfKind(symbol, 245 /* ModuleDeclaration */);
+ var isNamespace = declaration && declaration.name && declaration.name.kind === 73 /* Identifier */;
+ displayParts.push(ts.keywordPart(isNamespace ? 132 /* NamespaceKeyword */ : 131 /* ModuleKeyword */));
displayParts.push(ts.spacePart());
addFullSymbolName(symbol);
}
@@ -107760,7 +108982,7 @@
}
else {
// Method/function type parameter
- var decl = ts.getDeclarationOfKind(symbol, 150 /* TypeParameter */);
+ var decl = ts.getDeclarationOfKind(symbol, 151 /* TypeParameter */);
if (decl === undefined)
return ts.Debug.fail();
var declaration = decl.parent;
@@ -107768,21 +108990,21 @@
if (ts.isFunctionLikeKind(declaration.kind)) {
addInPrefix();
var signature = typeChecker.getSignatureFromDeclaration(declaration); // TODO: GH#18217
- if (declaration.kind === 161 /* ConstructSignature */) {
- displayParts.push(ts.keywordPart(95 /* NewKeyword */));
+ if (declaration.kind === 162 /* ConstructSignature */) {
+ displayParts.push(ts.keywordPart(96 /* NewKeyword */));
displayParts.push(ts.spacePart());
}
- else if (declaration.kind !== 160 /* CallSignature */ && declaration.name) {
+ else if (declaration.kind !== 161 /* CallSignature */ && declaration.name) {
addFullSymbolName(declaration.symbol);
}
ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* WriteTypeArgumentsOfSignature */));
}
- else if (declaration.kind === 242 /* TypeAliasDeclaration */) {
+ else if (declaration.kind === 243 /* TypeAliasDeclaration */) {
// Type alias type parameter
// For example
// type list<T> = T[]; // Both T will go through same code path
addInPrefix();
- displayParts.push(ts.keywordPart(140 /* TypeKeyword */));
+ displayParts.push(ts.keywordPart(141 /* TypeKeyword */));
displayParts.push(ts.spacePart());
addFullSymbolName(declaration.symbol);
writeTypeParametersOfSymbol(declaration.symbol, sourceFile);
@@ -107794,11 +109016,11 @@
symbolKind = "enum member" /* enumMemberElement */;
addPrefixForAnyFunctionOrVar(symbol, "enum member");
var declaration = symbol.declarations[0];
- if (declaration.kind === 278 /* EnumMember */) {
+ if (declaration.kind === 279 /* EnumMember */) {
var constantValue = typeChecker.getConstantValue(declaration);
if (constantValue !== undefined) {
displayParts.push(ts.spacePart());
- displayParts.push(ts.operatorPart(59 /* EqualsToken */));
+ displayParts.push(ts.operatorPart(60 /* EqualsToken */));
displayParts.push(ts.spacePart());
displayParts.push(ts.displayPart(ts.getTextOfConstantValue(constantValue), typeof constantValue === "number" ? ts.SymbolDisplayPartKind.numericLiteral : ts.SymbolDisplayPartKind.stringLiteral));
}
@@ -107824,32 +109046,32 @@
}
}
switch (symbol.declarations[0].kind) {
- case 247 /* NamespaceExportDeclaration */:
- displayParts.push(ts.keywordPart(85 /* ExportKeyword */));
+ case 248 /* NamespaceExportDeclaration */:
+ displayParts.push(ts.keywordPart(86 /* ExportKeyword */));
displayParts.push(ts.spacePart());
- displayParts.push(ts.keywordPart(131 /* NamespaceKeyword */));
+ displayParts.push(ts.keywordPart(132 /* NamespaceKeyword */));
break;
- case 254 /* ExportAssignment */:
- displayParts.push(ts.keywordPart(85 /* ExportKeyword */));
+ case 255 /* ExportAssignment */:
+ displayParts.push(ts.keywordPart(86 /* ExportKeyword */));
displayParts.push(ts.spacePart());
- displayParts.push(ts.keywordPart(symbol.declarations[0].isExportEquals ? 59 /* EqualsToken */ : 80 /* DefaultKeyword */));
+ displayParts.push(ts.keywordPart(symbol.declarations[0].isExportEquals ? 60 /* EqualsToken */ : 81 /* DefaultKeyword */));
break;
- case 257 /* ExportSpecifier */:
- displayParts.push(ts.keywordPart(85 /* ExportKeyword */));
+ case 258 /* ExportSpecifier */:
+ displayParts.push(ts.keywordPart(86 /* ExportKeyword */));
break;
default:
- displayParts.push(ts.keywordPart(92 /* ImportKeyword */));
+ displayParts.push(ts.keywordPart(93 /* ImportKeyword */));
}
displayParts.push(ts.spacePart());
addFullSymbolName(symbol);
ts.forEach(symbol.declarations, function (declaration) {
- if (declaration.kind === 248 /* ImportEqualsDeclaration */) {
+ if (declaration.kind === 249 /* ImportEqualsDeclaration */) {
var importEqualsDeclaration = declaration;
if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) {
displayParts.push(ts.spacePart());
- displayParts.push(ts.operatorPart(59 /* EqualsToken */));
+ displayParts.push(ts.operatorPart(60 /* EqualsToken */));
displayParts.push(ts.spacePart());
- displayParts.push(ts.keywordPart(134 /* RequireKeyword */));
+ displayParts.push(ts.keywordPart(135 /* RequireKeyword */));
displayParts.push(ts.punctuationPart(20 /* OpenParenToken */));
displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), ts.SymbolDisplayPartKind.stringLiteral));
displayParts.push(ts.punctuationPart(21 /* CloseParenToken */));
@@ -107858,7 +109080,7 @@
var internalAliasSymbol = typeChecker.getSymbolAtLocation(importEqualsDeclaration.moduleReference);
if (internalAliasSymbol) {
displayParts.push(ts.spacePart());
- displayParts.push(ts.operatorPart(59 /* EqualsToken */));
+ displayParts.push(ts.operatorPart(60 /* EqualsToken */));
displayParts.push(ts.spacePart());
addFullSymbolName(internalAliasSymbol, enclosingDeclaration);
}
@@ -107872,7 +109094,7 @@
if (type) {
if (isThisExpression) {
prefixNextMeaning();
- displayParts.push(ts.keywordPart(100 /* ThisKeyword */));
+ displayParts.push(ts.keywordPart(101 /* ThisKeyword */));
}
else {
addPrefixForAnyFunctionOrVar(symbol, symbolKind);
@@ -107921,10 +109143,10 @@
// For some special property access expressions like `exports.foo = foo` or `module.exports.foo = foo`
// there documentation comments might be attached to the right hand side symbol of their declarations.
// The pattern of such special property access is that the parent symbol is the symbol of the file.
- if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 284 /* SourceFile */; })) {
+ if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 285 /* SourceFile */; })) {
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (!declaration.parent || declaration.parent.kind !== 204 /* BinaryExpression */) {
+ if (!declaration.parent || declaration.parent.kind !== 205 /* BinaryExpression */) {
continue;
}
var rhsSymbol = typeChecker.getSymbolAtLocation(declaration.parent.right);
@@ -107967,7 +109189,7 @@
}
function addInPrefix() {
displayParts.push(ts.spacePart());
- displayParts.push(ts.keywordPart(93 /* InKeyword */));
+ displayParts.push(ts.keywordPart(94 /* InKeyword */));
displayParts.push(ts.spacePart());
}
function addFullSymbolName(symbolToDisplay, enclosingDeclaration) {
@@ -108037,16 +109259,16 @@
}
return ts.forEach(symbol.declarations, function (declaration) {
// Function expressions are local
- if (declaration.kind === 196 /* FunctionExpression */) {
+ if (declaration.kind === 197 /* FunctionExpression */) {
return true;
}
- if (declaration.kind !== 237 /* VariableDeclaration */ && declaration.kind !== 239 /* FunctionDeclaration */) {
+ if (declaration.kind !== 238 /* VariableDeclaration */ && declaration.kind !== 240 /* FunctionDeclaration */) {
return false;
}
// If the parent is not sourceFile or module block it is local variable
for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent) {
// Reached source file or module block
- if (parent.kind === 284 /* SourceFile */ || parent.kind === 245 /* ModuleBlock */) {
+ if (parent.kind === 285 /* SourceFile */ || parent.kind === 246 /* ModuleBlock */) {
return false;
}
}
@@ -108275,8 +109497,8 @@
(function (ts) {
var formatting;
(function (formatting) {
- var standardScanner = ts.createScanner(7 /* Latest */, /*skipTrivia*/ false, 0 /* Standard */);
- var jsxScanner = ts.createScanner(7 /* Latest */, /*skipTrivia*/ false, 1 /* JSX */);
+ var standardScanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false, 0 /* Standard */);
+ var jsxScanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false, 1 /* JSX */);
var ScanAction;
(function (ScanAction) {
ScanAction[ScanAction["Scan"] = 0] = "Scan";
@@ -108340,8 +109562,8 @@
function shouldRescanGreaterThanToken(node) {
switch (node.kind) {
case 32 /* GreaterThanEqualsToken */:
- case 67 /* GreaterThanGreaterThanEqualsToken */:
- case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
+ case 68 /* GreaterThanGreaterThanEqualsToken */:
+ case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
case 48 /* GreaterThanGreaterThanGreaterThanToken */:
case 47 /* GreaterThanGreaterThanToken */:
return true;
@@ -108351,12 +109573,12 @@
function shouldRescanJsxIdentifier(node) {
if (node.parent) {
switch (node.parent.kind) {
- case 267 /* JsxAttribute */:
- case 262 /* JsxOpeningElement */:
- case 263 /* JsxClosingElement */:
- case 261 /* JsxSelfClosingElement */:
+ case 268 /* JsxAttribute */:
+ case 263 /* JsxOpeningElement */:
+ case 264 /* JsxClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
// May parse an identifier like `module-layout`; that will be scanned as a keyword at first, but we should parse the whole thing to get an identifier.
- return ts.isKeyword(node.kind) || node.kind === 72 /* Identifier */;
+ return ts.isKeyword(node.kind) || node.kind === 73 /* Identifier */;
}
}
return false;
@@ -108372,7 +109594,7 @@
container.kind === 17 /* TemplateTail */;
}
function startsWithSlashToken(t) {
- return t === 42 /* SlashToken */ || t === 64 /* SlashEqualsToken */;
+ return t === 42 /* SlashToken */ || t === 65 /* SlashEqualsToken */;
}
function readTokenInfo(n) {
ts.Debug.assert(isOnToken());
@@ -108531,7 +109753,7 @@
(function (formatting) {
function getAllRules() {
var allTokens = [];
- for (var token = 0 /* FirstToken */; token <= 147 /* LastToken */; token++) {
+ for (var token = 0 /* FirstToken */; token <= 148 /* LastToken */; token++) {
allTokens.push(token);
}
function anyTokenExcept() {
@@ -108543,27 +109765,27 @@
}
var anyToken = { tokens: allTokens, isSpecific: false };
var anyTokenIncludingMultilineComments = tokenRangeFrom(allTokens.concat([3 /* MultiLineCommentTrivia */]));
- var keywords = tokenRangeFromRange(73 /* FirstKeyword */, 147 /* LastKeyword */);
- var binaryOperators = tokenRangeFromRange(28 /* FirstBinaryOperator */, 71 /* LastBinaryOperator */);
- var binaryKeywordOperators = [93 /* InKeyword */, 94 /* InstanceOfKeyword */, 147 /* OfKeyword */, 119 /* AsKeyword */, 128 /* IsKeyword */];
+ var keywords = tokenRangeFromRange(74 /* FirstKeyword */, 148 /* LastKeyword */);
+ var binaryOperators = tokenRangeFromRange(28 /* FirstBinaryOperator */, 72 /* LastBinaryOperator */);
+ var binaryKeywordOperators = [94 /* InKeyword */, 95 /* InstanceOfKeyword */, 148 /* OfKeyword */, 120 /* AsKeyword */, 129 /* IsKeyword */];
var unaryPrefixOperators = [44 /* PlusPlusToken */, 45 /* MinusMinusToken */, 53 /* TildeToken */, 52 /* ExclamationToken */];
var unaryPrefixExpressions = [
- 8 /* NumericLiteral */, 9 /* BigIntLiteral */, 72 /* Identifier */, 20 /* OpenParenToken */,
- 22 /* OpenBracketToken */, 18 /* OpenBraceToken */, 100 /* ThisKeyword */, 95 /* NewKeyword */
+ 8 /* NumericLiteral */, 9 /* BigIntLiteral */, 73 /* Identifier */, 20 /* OpenParenToken */,
+ 22 /* OpenBracketToken */, 18 /* OpenBraceToken */, 101 /* ThisKeyword */, 96 /* NewKeyword */
];
- var unaryPreincrementExpressions = [72 /* Identifier */, 20 /* OpenParenToken */, 100 /* ThisKeyword */, 95 /* NewKeyword */];
- var unaryPostincrementExpressions = [72 /* Identifier */, 21 /* CloseParenToken */, 23 /* CloseBracketToken */, 95 /* NewKeyword */];
- var unaryPredecrementExpressions = [72 /* Identifier */, 20 /* OpenParenToken */, 100 /* ThisKeyword */, 95 /* NewKeyword */];
- var unaryPostdecrementExpressions = [72 /* Identifier */, 21 /* CloseParenToken */, 23 /* CloseBracketToken */, 95 /* NewKeyword */];
+ var unaryPreincrementExpressions = [73 /* Identifier */, 20 /* OpenParenToken */, 101 /* ThisKeyword */, 96 /* NewKeyword */];
+ var unaryPostincrementExpressions = [73 /* Identifier */, 21 /* CloseParenToken */, 23 /* CloseBracketToken */, 96 /* NewKeyword */];
+ var unaryPredecrementExpressions = [73 /* Identifier */, 20 /* OpenParenToken */, 101 /* ThisKeyword */, 96 /* NewKeyword */];
+ var unaryPostdecrementExpressions = [73 /* Identifier */, 21 /* CloseParenToken */, 23 /* CloseBracketToken */, 96 /* NewKeyword */];
var comments = [2 /* SingleLineCommentTrivia */, 3 /* MultiLineCommentTrivia */];
- var typeNames = [72 /* Identifier */].concat(ts.typeKeywords);
+ var typeNames = [73 /* Identifier */].concat(ts.typeKeywords);
// Place a space before open brace in a function declaration
// TypeScript: Function can have return types, which can be made of tons of different token kinds
var functionOpenBraceLeftTokenRange = anyTokenIncludingMultilineComments;
// Place a space before open brace in a TypeScript declaration that has braces as children (class, module, enum, etc)
- var typeScriptOpenBraceLeftTokenRange = tokenRangeFrom([72 /* Identifier */, 3 /* MultiLineCommentTrivia */, 76 /* ClassKeyword */, 85 /* ExportKeyword */, 92 /* ImportKeyword */]);
+ var typeScriptOpenBraceLeftTokenRange = tokenRangeFrom([73 /* Identifier */, 3 /* MultiLineCommentTrivia */, 77 /* ClassKeyword */, 86 /* ExportKeyword */, 93 /* ImportKeyword */]);
// Place a space before open brace in a control flow construct
- var controlOpenBraceLeftTokenRange = tokenRangeFrom([21 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 82 /* DoKeyword */, 103 /* TryKeyword */, 88 /* FinallyKeyword */, 83 /* ElseKeyword */]);
+ var controlOpenBraceLeftTokenRange = tokenRangeFrom([21 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 83 /* DoKeyword */, 104 /* TryKeyword */, 89 /* FinallyKeyword */, 84 /* ElseKeyword */]);
// These rules are higher in priority than user-configurable
var highPriorityCommonRules = [
// Leave comments alone
@@ -108578,7 +109800,7 @@
rule("NoSpaceAfterQuestionMark", 56 /* QuestionToken */, anyToken, [isNonJsxSameLineTokenContext], 8 /* Delete */),
rule("NoSpaceBeforeDot", anyToken, 24 /* DotToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
rule("NoSpaceAfterDot", 24 /* DotToken */, anyToken, [isNonJsxSameLineTokenContext], 8 /* Delete */),
- rule("NoSpaceBetweenImportParenInImportType", 92 /* ImportKeyword */, 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext, isImportTypeContext], 8 /* Delete */),
+ rule("NoSpaceBetweenImportParenInImportType", 93 /* ImportKeyword */, 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext, isImportTypeContext], 8 /* Delete */),
// Special handling of unary operators.
// Prefix operators generally shouldn't have a space between
// them and their target unary expression.
@@ -108605,79 +109827,79 @@
rule("SpaceAfterCloseBrace", 19 /* CloseBraceToken */, anyTokenExcept(21 /* CloseParenToken */), [isNonJsxSameLineTokenContext, isAfterCodeBlockContext], 2 /* Space */),
// Special case for (}, else) and (}, while) since else & while tokens are not part of the tree which makes SpaceAfterCloseBrace rule not applied
// Also should not apply to })
- rule("SpaceBetweenCloseBraceAndElse", 19 /* CloseBraceToken */, 83 /* ElseKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */),
- rule("SpaceBetweenCloseBraceAndWhile", 19 /* CloseBraceToken */, 107 /* WhileKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceBetweenCloseBraceAndElse", 19 /* CloseBraceToken */, 84 /* ElseKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceBetweenCloseBraceAndWhile", 19 /* CloseBraceToken */, 108 /* WhileKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */),
rule("NoSpaceBetweenEmptyBraceBrackets", 18 /* OpenBraceToken */, 19 /* CloseBraceToken */, [isNonJsxSameLineTokenContext, isObjectContext], 8 /* Delete */),
// Add a space after control dec context if the next character is an open bracket ex: 'if (false)[a, b] = [1, 2];' -> 'if (false) [a, b] = [1, 2];'
rule("SpaceAfterConditionalClosingParen", 21 /* CloseParenToken */, 22 /* OpenBracketToken */, [isControlDeclContext], 2 /* Space */),
- rule("NoSpaceBetweenFunctionKeywordAndStar", 90 /* FunctionKeyword */, 40 /* AsteriskToken */, [isFunctionDeclarationOrFunctionExpressionContext], 8 /* Delete */),
- rule("SpaceAfterStarInGeneratorDeclaration", 40 /* AsteriskToken */, [72 /* Identifier */, 20 /* OpenParenToken */], [isFunctionDeclarationOrFunctionExpressionContext], 2 /* Space */),
- rule("SpaceAfterFunctionInFuncDecl", 90 /* FunctionKeyword */, anyToken, [isFunctionDeclContext], 2 /* Space */),
+ rule("NoSpaceBetweenFunctionKeywordAndStar", 91 /* FunctionKeyword */, 40 /* AsteriskToken */, [isFunctionDeclarationOrFunctionExpressionContext], 8 /* Delete */),
+ rule("SpaceAfterStarInGeneratorDeclaration", 40 /* AsteriskToken */, 73 /* Identifier */, [isFunctionDeclarationOrFunctionExpressionContext], 2 /* Space */),
+ rule("SpaceAfterFunctionInFuncDecl", 91 /* FunctionKeyword */, anyToken, [isFunctionDeclContext], 2 /* Space */),
// Insert new line after { and before } in multi-line contexts.
rule("NewLineAfterOpenBraceInBlockContext", 18 /* OpenBraceToken */, anyToken, [isMultilineBlockContext], 4 /* NewLine */),
// For get/set members, we check for (identifier,identifier) since get/set don't have tokens and they are represented as just an identifier token.
// Though, we do extra check on the context to make sure we are dealing with get/set node. Example:
// get x() {}
// set x(val) {}
- rule("SpaceAfterGetSetInMember", [126 /* GetKeyword */, 137 /* SetKeyword */], 72 /* Identifier */, [isFunctionDeclContext], 2 /* Space */),
- rule("NoSpaceBetweenYieldKeywordAndStar", 117 /* YieldKeyword */, 40 /* AsteriskToken */, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 8 /* Delete */),
- rule("SpaceBetweenYieldOrYieldStarAndOperand", [117 /* YieldKeyword */, 40 /* AsteriskToken */], anyToken, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 2 /* Space */),
- rule("NoSpaceBetweenReturnAndSemicolon", 97 /* ReturnKeyword */, 26 /* SemicolonToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
- rule("SpaceAfterCertainKeywords", [105 /* VarKeyword */, 101 /* ThrowKeyword */, 95 /* NewKeyword */, 81 /* DeleteKeyword */, 97 /* ReturnKeyword */, 104 /* TypeOfKeyword */, 122 /* AwaitKeyword */], anyToken, [isNonJsxSameLineTokenContext], 2 /* Space */),
- rule("SpaceAfterLetConstInVariableDeclaration", [111 /* LetKeyword */, 77 /* ConstKeyword */], anyToken, [isNonJsxSameLineTokenContext, isStartOfVariableDeclarationList], 2 /* Space */),
+ rule("SpaceAfterGetSetInMember", [127 /* GetKeyword */, 138 /* SetKeyword */], 73 /* Identifier */, [isFunctionDeclContext], 2 /* Space */),
+ rule("NoSpaceBetweenYieldKeywordAndStar", 118 /* YieldKeyword */, 40 /* AsteriskToken */, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 8 /* Delete */),
+ rule("SpaceBetweenYieldOrYieldStarAndOperand", [118 /* YieldKeyword */, 40 /* AsteriskToken */], anyToken, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 2 /* Space */),
+ rule("NoSpaceBetweenReturnAndSemicolon", 98 /* ReturnKeyword */, 26 /* SemicolonToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
+ rule("SpaceAfterCertainKeywords", [106 /* VarKeyword */, 102 /* ThrowKeyword */, 96 /* NewKeyword */, 82 /* DeleteKeyword */, 98 /* ReturnKeyword */, 105 /* TypeOfKeyword */, 123 /* AwaitKeyword */], anyToken, [isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceAfterLetConstInVariableDeclaration", [112 /* LetKeyword */, 78 /* ConstKeyword */], anyToken, [isNonJsxSameLineTokenContext, isStartOfVariableDeclarationList], 2 /* Space */),
rule("NoSpaceBeforeOpenParenInFuncCall", anyToken, 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext, isFunctionCallOrNewContext, isPreviousTokenNotComma], 8 /* Delete */),
// Special case for binary operators (that are keywords). For these we have to add a space and shouldn't follow any user options.
rule("SpaceBeforeBinaryKeywordOperator", anyToken, binaryKeywordOperators, [isNonJsxSameLineTokenContext, isBinaryOpContext], 2 /* Space */),
rule("SpaceAfterBinaryKeywordOperator", binaryKeywordOperators, anyToken, [isNonJsxSameLineTokenContext, isBinaryOpContext], 2 /* Space */),
- rule("SpaceAfterVoidOperator", 106 /* VoidKeyword */, anyToken, [isNonJsxSameLineTokenContext, isVoidOpContext], 2 /* Space */),
+ rule("SpaceAfterVoidOperator", 107 /* VoidKeyword */, anyToken, [isNonJsxSameLineTokenContext, isVoidOpContext], 2 /* Space */),
// Async-await
- rule("SpaceBetweenAsyncAndOpenParen", 121 /* AsyncKeyword */, 20 /* OpenParenToken */, [isArrowFunctionContext, isNonJsxSameLineTokenContext], 2 /* Space */),
- rule("SpaceBetweenAsyncAndFunctionKeyword", 121 /* AsyncKeyword */, 90 /* FunctionKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceBetweenAsyncAndOpenParen", 122 /* AsyncKeyword */, 20 /* OpenParenToken */, [isArrowFunctionContext, isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceBetweenAsyncAndFunctionKeyword", 122 /* AsyncKeyword */, 91 /* FunctionKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */),
// Template string
- rule("NoSpaceBetweenTagAndTemplateString", [72 /* Identifier */, 21 /* CloseParenToken */], [14 /* NoSubstitutionTemplateLiteral */, 15 /* TemplateHead */], [isNonJsxSameLineTokenContext], 8 /* Delete */),
+ rule("NoSpaceBetweenTagAndTemplateString", [73 /* Identifier */, 21 /* CloseParenToken */], [14 /* NoSubstitutionTemplateLiteral */, 15 /* TemplateHead */], [isNonJsxSameLineTokenContext], 8 /* Delete */),
// JSX opening elements
- rule("SpaceBeforeJsxAttribute", anyToken, 72 /* Identifier */, [isNextTokenParentJsxAttribute, isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceBeforeJsxAttribute", anyToken, 73 /* Identifier */, [isNextTokenParentJsxAttribute, isNonJsxSameLineTokenContext], 2 /* Space */),
rule("SpaceBeforeSlashInJsxOpeningElement", anyToken, 42 /* SlashToken */, [isJsxSelfClosingElementContext, isNonJsxSameLineTokenContext], 2 /* Space */),
rule("NoSpaceBeforeGreaterThanTokenInJsxOpeningElement", 42 /* SlashToken */, 30 /* GreaterThanToken */, [isJsxSelfClosingElementContext, isNonJsxSameLineTokenContext], 8 /* Delete */),
- rule("NoSpaceBeforeEqualInJsxAttribute", anyToken, 59 /* EqualsToken */, [isJsxAttributeContext, isNonJsxSameLineTokenContext], 8 /* Delete */),
- rule("NoSpaceAfterEqualInJsxAttribute", 59 /* EqualsToken */, anyToken, [isJsxAttributeContext, isNonJsxSameLineTokenContext], 8 /* Delete */),
+ rule("NoSpaceBeforeEqualInJsxAttribute", anyToken, 60 /* EqualsToken */, [isJsxAttributeContext, isNonJsxSameLineTokenContext], 8 /* Delete */),
+ rule("NoSpaceAfterEqualInJsxAttribute", 60 /* EqualsToken */, anyToken, [isJsxAttributeContext, isNonJsxSameLineTokenContext], 8 /* Delete */),
// TypeScript-specific rules
// Use of module as a function call. e.g.: import m2 = module("m2");
- rule("NoSpaceAfterModuleImport", [130 /* ModuleKeyword */, 134 /* RequireKeyword */], 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
+ rule("NoSpaceAfterModuleImport", [131 /* ModuleKeyword */, 135 /* RequireKeyword */], 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
// Add a space around certain TypeScript keywords
rule("SpaceAfterCertainTypeScriptKeywords", [
- 118 /* AbstractKeyword */,
- 76 /* ClassKeyword */,
- 125 /* DeclareKeyword */,
- 80 /* DefaultKeyword */,
- 84 /* EnumKeyword */,
- 85 /* ExportKeyword */,
- 86 /* ExtendsKeyword */,
- 126 /* GetKeyword */,
- 109 /* ImplementsKeyword */,
- 92 /* ImportKeyword */,
- 110 /* InterfaceKeyword */,
- 130 /* ModuleKeyword */,
- 131 /* NamespaceKeyword */,
- 113 /* PrivateKeyword */,
- 115 /* PublicKeyword */,
- 114 /* ProtectedKeyword */,
- 133 /* ReadonlyKeyword */,
- 137 /* SetKeyword */,
- 116 /* StaticKeyword */,
- 140 /* TypeKeyword */,
- 144 /* FromKeyword */,
- 129 /* KeyOfKeyword */,
- 127 /* InferKeyword */,
+ 119 /* AbstractKeyword */,
+ 77 /* ClassKeyword */,
+ 126 /* DeclareKeyword */,
+ 81 /* DefaultKeyword */,
+ 85 /* EnumKeyword */,
+ 86 /* ExportKeyword */,
+ 87 /* ExtendsKeyword */,
+ 127 /* GetKeyword */,
+ 110 /* ImplementsKeyword */,
+ 93 /* ImportKeyword */,
+ 111 /* InterfaceKeyword */,
+ 131 /* ModuleKeyword */,
+ 132 /* NamespaceKeyword */,
+ 114 /* PrivateKeyword */,
+ 116 /* PublicKeyword */,
+ 115 /* ProtectedKeyword */,
+ 134 /* ReadonlyKeyword */,
+ 138 /* SetKeyword */,
+ 117 /* StaticKeyword */,
+ 141 /* TypeKeyword */,
+ 145 /* FromKeyword */,
+ 130 /* KeyOfKeyword */,
+ 128 /* InferKeyword */,
], anyToken, [isNonJsxSameLineTokenContext], 2 /* Space */),
- rule("SpaceBeforeCertainTypeScriptKeywords", anyToken, [86 /* ExtendsKeyword */, 109 /* ImplementsKeyword */, 144 /* FromKeyword */], [isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceBeforeCertainTypeScriptKeywords", anyToken, [87 /* ExtendsKeyword */, 110 /* ImplementsKeyword */, 145 /* FromKeyword */], [isNonJsxSameLineTokenContext], 2 /* Space */),
// Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" {
rule("SpaceAfterModuleName", 10 /* StringLiteral */, 18 /* OpenBraceToken */, [isModuleDeclContext], 2 /* Space */),
// Lambda expressions
rule("SpaceBeforeArrow", anyToken, 37 /* EqualsGreaterThanToken */, [isNonJsxSameLineTokenContext], 2 /* Space */),
rule("SpaceAfterArrow", 37 /* EqualsGreaterThanToken */, anyToken, [isNonJsxSameLineTokenContext], 2 /* Space */),
// Optional parameters and let args
- rule("NoSpaceAfterEllipsis", 25 /* DotDotDotToken */, 72 /* Identifier */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
+ rule("NoSpaceAfterEllipsis", 25 /* DotDotDotToken */, 73 /* Identifier */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
rule("NoSpaceAfterOptionalParameters", 56 /* QuestionToken */, [21 /* CloseParenToken */, 27 /* CommaToken */], [isNonJsxSameLineTokenContext, isNotBinaryOpContext], 8 /* Delete */),
// Remove spaces in empty interface literals. e.g.: x: {}
rule("NoSpaceBetweenEmptyInterfaceBraceBrackets", 18 /* OpenBraceToken */, 19 /* CloseBraceToken */, [isNonJsxSameLineTokenContext, isObjectTypeContext], 8 /* Delete */),
@@ -108688,37 +109910,37 @@
rule("NoSpaceBeforeCloseAngularBracket", anyToken, 30 /* GreaterThanToken */, [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 8 /* Delete */),
rule("NoSpaceAfterCloseAngularBracket", 30 /* GreaterThanToken */, [20 /* OpenParenToken */, 22 /* OpenBracketToken */, 30 /* GreaterThanToken */, 27 /* CommaToken */], [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext, isNotFunctionDeclContext /*To prevent an interference with the SpaceBeforeOpenParenInFuncDecl rule*/], 8 /* Delete */),
// decorators
- rule("SpaceBeforeAt", [21 /* CloseParenToken */, 72 /* Identifier */], 58 /* AtToken */, [isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceBeforeAt", [21 /* CloseParenToken */, 73 /* Identifier */], 58 /* AtToken */, [isNonJsxSameLineTokenContext], 2 /* Space */),
rule("NoSpaceAfterAt", 58 /* AtToken */, anyToken, [isNonJsxSameLineTokenContext], 8 /* Delete */),
// Insert space after @ in decorator
rule("SpaceAfterDecorator", anyToken, [
- 118 /* AbstractKeyword */,
- 72 /* Identifier */,
- 85 /* ExportKeyword */,
- 80 /* DefaultKeyword */,
- 76 /* ClassKeyword */,
- 116 /* StaticKeyword */,
- 115 /* PublicKeyword */,
- 113 /* PrivateKeyword */,
- 114 /* ProtectedKeyword */,
- 126 /* GetKeyword */,
- 137 /* SetKeyword */,
+ 119 /* AbstractKeyword */,
+ 73 /* Identifier */,
+ 86 /* ExportKeyword */,
+ 81 /* DefaultKeyword */,
+ 77 /* ClassKeyword */,
+ 117 /* StaticKeyword */,
+ 116 /* PublicKeyword */,
+ 114 /* PrivateKeyword */,
+ 115 /* ProtectedKeyword */,
+ 127 /* GetKeyword */,
+ 138 /* SetKeyword */,
22 /* OpenBracketToken */,
40 /* AsteriskToken */,
], [isEndOfDecoratorContextOnSameLine], 2 /* Space */),
rule("NoSpaceBeforeNonNullAssertionOperator", anyToken, 52 /* ExclamationToken */, [isNonJsxSameLineTokenContext, isNonNullAssertionContext], 8 /* Delete */),
- rule("NoSpaceAfterNewKeywordOnConstructorSignature", 95 /* NewKeyword */, 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext, isConstructorSignatureContext], 8 /* Delete */),
+ rule("NoSpaceAfterNewKeywordOnConstructorSignature", 96 /* NewKeyword */, 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext, isConstructorSignatureContext], 8 /* Delete */),
];
// These rules are applied after high priority
var userConfigurableRules = [
// Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses
- rule("SpaceAfterConstructor", 124 /* ConstructorKeyword */, 20 /* OpenParenToken */, [isOptionEnabled("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 2 /* Space */),
- rule("NoSpaceAfterConstructor", 124 /* ConstructorKeyword */, 20 /* OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 8 /* Delete */),
+ rule("SpaceAfterConstructor", 125 /* ConstructorKeyword */, 20 /* OpenParenToken */, [isOptionEnabled("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("NoSpaceAfterConstructor", 125 /* ConstructorKeyword */, 20 /* OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 8 /* Delete */),
rule("SpaceAfterComma", 27 /* CommaToken */, anyToken, [isOptionEnabled("insertSpaceAfterCommaDelimiter"), isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNextTokenNotCloseBracket], 2 /* Space */),
rule("NoSpaceAfterComma", 27 /* CommaToken */, anyToken, [isOptionDisabledOrUndefined("insertSpaceAfterCommaDelimiter"), isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext], 8 /* Delete */),
// Insert space after function keyword for anonymous functions
- rule("SpaceAfterAnonymousFunctionKeyword", 90 /* FunctionKeyword */, 20 /* OpenParenToken */, [isOptionEnabled("insertSpaceAfterFunctionKeywordForAnonymousFunctions"), isFunctionDeclContext], 2 /* Space */),
- rule("NoSpaceAfterAnonymousFunctionKeyword", 90 /* FunctionKeyword */, 20 /* OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterFunctionKeywordForAnonymousFunctions"), isFunctionDeclContext], 8 /* Delete */),
+ rule("SpaceAfterAnonymousFunctionKeyword", [91 /* FunctionKeyword */, 40 /* AsteriskToken */], 20 /* OpenParenToken */, [isOptionEnabled("insertSpaceAfterFunctionKeywordForAnonymousFunctions"), isFunctionDeclContext], 2 /* Space */),
+ rule("NoSpaceAfterAnonymousFunctionKeyword", [91 /* FunctionKeyword */, 40 /* AsteriskToken */], 20 /* OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterFunctionKeywordForAnonymousFunctions"), isFunctionDeclContext], 8 /* Delete */),
// Insert space after keywords in control flow statements
rule("SpaceAfterKeywordInControl", keywords, 20 /* OpenParenToken */, [isOptionEnabled("insertSpaceAfterKeywordsInControlFlowStatements"), isControlDeclContext], 2 /* Space */),
rule("NoSpaceAfterKeywordInControl", keywords, 20 /* OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterKeywordsInControlFlowStatements"), isControlDeclContext], 8 /* Delete */),
@@ -108782,16 +110004,16 @@
rule("SpaceBeforeOpenBraceInTypeScriptDeclWithBlock", typeScriptOpenBraceLeftTokenRange, 18 /* OpenBraceToken */, [isOptionDisabledOrUndefinedOrTokensOnSameLine("placeOpenBraceOnNewLineForFunctions"), isTypeScriptDeclWithBlockContext, isNotFormatOnEnter, isSameLineTokenOrBeforeBlockContext], 2 /* Space */, 1 /* CanDeleteNewLines */),
rule("NoSpaceBeforeComma", anyToken, 27 /* CommaToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
// No space before and after indexer `x[]`
- rule("NoSpaceBeforeOpenBracket", anyTokenExcept(121 /* AsyncKeyword */, 74 /* CaseKeyword */), 22 /* OpenBracketToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
+ rule("NoSpaceBeforeOpenBracket", anyTokenExcept(122 /* AsyncKeyword */, 75 /* CaseKeyword */), 22 /* OpenBracketToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
rule("NoSpaceAfterCloseBracket", 23 /* CloseBracketToken */, anyToken, [isNonJsxSameLineTokenContext, isNotBeforeBlockInFunctionDeclarationContext], 8 /* Delete */),
rule("SpaceAfterSemicolon", 26 /* SemicolonToken */, anyToken, [isNonJsxSameLineTokenContext], 2 /* Space */),
// Remove extra space between for and await
- rule("SpaceBetweenForAndAwaitKeyword", 89 /* ForKeyword */, 122 /* AwaitKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceBetweenForAndAwaitKeyword", 90 /* ForKeyword */, 123 /* AwaitKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */),
// Add a space between statements. All keywords except (do,else,case) has open/close parens after them.
// So, we have a rule to add a space for [),Any], [do,Any], [else,Any], and [case,Any]
- rule("SpaceBetweenStatements", [21 /* CloseParenToken */, 82 /* DoKeyword */, 83 /* ElseKeyword */, 74 /* CaseKeyword */], anyToken, [isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNotForContext], 2 /* Space */),
+ rule("SpaceBetweenStatements", [21 /* CloseParenToken */, 83 /* DoKeyword */, 84 /* ElseKeyword */, 75 /* CaseKeyword */], anyToken, [isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNotForContext], 2 /* Space */),
// This low-pri rule takes care of "try {" and "finally {" in case the rule SpaceBeforeOpenBraceInControl didn't execute on FormatOnEnter.
- rule("SpaceAfterTryFinally", [103 /* TryKeyword */, 88 /* FinallyKeyword */], 18 /* OpenBraceToken */, [isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceAfterTryFinally", [104 /* TryKeyword */, 89 /* FinallyKeyword */], 18 /* OpenBraceToken */, [isNonJsxSameLineTokenContext], 2 /* Space */),
];
return highPriorityCommonRules.concat(userConfigurableRules, lowPriorityCommonRules);
}
@@ -108835,45 +110057,45 @@
return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !!context.options[optionName]; };
}
function isForContext(context) {
- return context.contextNode.kind === 225 /* ForStatement */;
+ return context.contextNode.kind === 226 /* ForStatement */;
}
function isNotForContext(context) {
return !isForContext(context);
}
function isBinaryOpContext(context) {
switch (context.contextNode.kind) {
- case 204 /* BinaryExpression */:
- case 205 /* ConditionalExpression */:
- case 175 /* ConditionalType */:
- case 212 /* AsExpression */:
- case 257 /* ExportSpecifier */:
- case 253 /* ImportSpecifier */:
- case 163 /* TypePredicate */:
- case 173 /* UnionType */:
- case 174 /* IntersectionType */:
+ case 205 /* BinaryExpression */:
+ case 206 /* ConditionalExpression */:
+ case 176 /* ConditionalType */:
+ case 213 /* AsExpression */:
+ case 258 /* ExportSpecifier */:
+ case 254 /* ImportSpecifier */:
+ case 164 /* TypePredicate */:
+ case 174 /* UnionType */:
+ case 175 /* IntersectionType */:
return true;
// equals in binding elements: function foo([[x, y] = [1, 2]])
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
// equals in type X = ...
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
// equal in import a = module('a');
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
// equal in let a = 0;
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
// equal in p = 0;
- case 151 /* Parameter */:
- case 278 /* EnumMember */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- return context.currentTokenSpan.kind === 59 /* EqualsToken */ || context.nextTokenSpan.kind === 59 /* EqualsToken */;
+ case 152 /* Parameter */:
+ case 279 /* EnumMember */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ return context.currentTokenSpan.kind === 60 /* EqualsToken */ || context.nextTokenSpan.kind === 60 /* EqualsToken */;
// "in" keyword in for (let x in []) { }
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
// "in" keyword in [P in keyof T]: T[P]
- case 150 /* TypeParameter */:
- return context.currentTokenSpan.kind === 93 /* InKeyword */ || context.nextTokenSpan.kind === 93 /* InKeyword */ || context.currentTokenSpan.kind === 59 /* EqualsToken */ || context.nextTokenSpan.kind === 59 /* EqualsToken */;
+ case 151 /* TypeParameter */:
+ return context.currentTokenSpan.kind === 94 /* InKeyword */ || context.nextTokenSpan.kind === 94 /* InKeyword */ || context.currentTokenSpan.kind === 60 /* EqualsToken */ || context.nextTokenSpan.kind === 60 /* EqualsToken */;
// Technically, "of" is not a binary operator, but format it the same way as "in"
- case 227 /* ForOfStatement */:
- return context.currentTokenSpan.kind === 147 /* OfKeyword */ || context.nextTokenSpan.kind === 147 /* OfKeyword */;
+ case 228 /* ForOfStatement */:
+ return context.currentTokenSpan.kind === 148 /* OfKeyword */ || context.nextTokenSpan.kind === 148 /* OfKeyword */;
}
return false;
}
@@ -108885,22 +110107,22 @@
}
function isTypeAnnotationContext(context) {
var contextKind = context.contextNode.kind;
- return contextKind === 154 /* PropertyDeclaration */ ||
- contextKind === 153 /* PropertySignature */ ||
- contextKind === 151 /* Parameter */ ||
- contextKind === 237 /* VariableDeclaration */ ||
+ return contextKind === 155 /* PropertyDeclaration */ ||
+ contextKind === 154 /* PropertySignature */ ||
+ contextKind === 152 /* Parameter */ ||
+ contextKind === 238 /* VariableDeclaration */ ||
ts.isFunctionLikeKind(contextKind);
}
function isConditionalOperatorContext(context) {
- return context.contextNode.kind === 205 /* ConditionalExpression */ ||
- context.contextNode.kind === 175 /* ConditionalType */;
+ return context.contextNode.kind === 206 /* ConditionalExpression */ ||
+ context.contextNode.kind === 176 /* ConditionalType */;
}
function isSameLineTokenOrBeforeBlockContext(context) {
return context.TokensAreOnSameLine() || isBeforeBlockContext(context);
}
function isBraceWrappedContext(context) {
- return context.contextNode.kind === 184 /* ObjectBindingPattern */ ||
- context.contextNode.kind === 181 /* MappedType */ ||
+ return context.contextNode.kind === 185 /* ObjectBindingPattern */ ||
+ context.contextNode.kind === 182 /* MappedType */ ||
isSingleLineBlockContext(context);
}
// This check is done before an open brace in a control construct, a function, or a typescript block declaration
@@ -108926,31 +110148,31 @@
return true;
}
switch (node.kind) {
- case 218 /* Block */:
- case 246 /* CaseBlock */:
- case 188 /* ObjectLiteralExpression */:
- case 245 /* ModuleBlock */:
+ case 219 /* Block */:
+ case 247 /* CaseBlock */:
+ case 189 /* ObjectLiteralExpression */:
+ case 246 /* ModuleBlock */:
return true;
}
return false;
}
function isFunctionDeclContext(context) {
switch (context.contextNode.kind) {
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 240 /* FunctionDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
// case SyntaxKind.MemberFunctionDeclaration:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
// case SyntaxKind.MethodSignature:
- case 160 /* CallSignature */:
- case 196 /* FunctionExpression */:
- case 157 /* Constructor */:
- case 197 /* ArrowFunction */:
+ case 161 /* CallSignature */:
+ case 197 /* FunctionExpression */:
+ case 158 /* Constructor */:
+ case 198 /* ArrowFunction */:
// case SyntaxKind.ConstructorDeclaration:
// case SyntaxKind.SimpleArrowFunctionExpression:
// case SyntaxKind.ParenthesizedArrowFunctionExpression:
- case 241 /* InterfaceDeclaration */: // This one is not truly a function, but for formatting purposes, it acts just like one
+ case 242 /* InterfaceDeclaration */: // This one is not truly a function, but for formatting purposes, it acts just like one
return true;
}
return false;
@@ -108959,40 +110181,40 @@
return !isFunctionDeclContext(context);
}
function isFunctionDeclarationOrFunctionExpressionContext(context) {
- return context.contextNode.kind === 239 /* FunctionDeclaration */ || context.contextNode.kind === 196 /* FunctionExpression */;
+ return context.contextNode.kind === 240 /* FunctionDeclaration */ || context.contextNode.kind === 197 /* FunctionExpression */;
}
function isTypeScriptDeclWithBlockContext(context) {
return nodeIsTypeScriptDeclWithBlockContext(context.contextNode);
}
function nodeIsTypeScriptDeclWithBlockContext(node) {
switch (node.kind) {
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
- case 168 /* TypeLiteral */:
- case 244 /* ModuleDeclaration */:
- case 255 /* ExportDeclaration */:
- case 256 /* NamedExports */:
- case 249 /* ImportDeclaration */:
- case 252 /* NamedImports */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 169 /* TypeLiteral */:
+ case 245 /* ModuleDeclaration */:
+ case 256 /* ExportDeclaration */:
+ case 257 /* NamedExports */:
+ case 250 /* ImportDeclaration */:
+ case 253 /* NamedImports */:
return true;
}
return false;
}
function isAfterCodeBlockContext(context) {
switch (context.currentTokenParent.kind) {
- case 240 /* ClassDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 243 /* EnumDeclaration */:
- case 274 /* CatchClause */:
- case 245 /* ModuleBlock */:
- case 232 /* SwitchStatement */:
+ case 241 /* ClassDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 275 /* CatchClause */:
+ case 246 /* ModuleBlock */:
+ case 233 /* SwitchStatement */:
return true;
- case 218 /* Block */: {
+ case 219 /* Block */: {
var blockParent = context.currentTokenParent.parent;
// In a codefix scenario, we can't rely on parents being set. So just always return true.
- if (!blockParent || blockParent.kind !== 197 /* ArrowFunction */ && blockParent.kind !== 196 /* FunctionExpression */) {
+ if (!blockParent || blockParent.kind !== 198 /* ArrowFunction */ && blockParent.kind !== 197 /* FunctionExpression */) {
return true;
}
}
@@ -109001,31 +110223,31 @@
}
function isControlDeclContext(context) {
switch (context.contextNode.kind) {
- case 222 /* IfStatement */:
- case 232 /* SwitchStatement */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 224 /* WhileStatement */:
- case 235 /* TryStatement */:
- case 223 /* DoStatement */:
- case 231 /* WithStatement */:
+ case 223 /* IfStatement */:
+ case 233 /* SwitchStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 225 /* WhileStatement */:
+ case 236 /* TryStatement */:
+ case 224 /* DoStatement */:
+ case 232 /* WithStatement */:
// TODO
// case SyntaxKind.ElseClause:
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return true;
default:
return false;
}
}
function isObjectContext(context) {
- return context.contextNode.kind === 188 /* ObjectLiteralExpression */;
+ return context.contextNode.kind === 189 /* ObjectLiteralExpression */;
}
function isFunctionCallContext(context) {
- return context.contextNode.kind === 191 /* CallExpression */;
+ return context.contextNode.kind === 192 /* CallExpression */;
}
function isNewContext(context) {
- return context.contextNode.kind === 192 /* NewExpression */;
+ return context.contextNode.kind === 193 /* NewExpression */;
}
function isFunctionCallOrNewContext(context) {
return isFunctionCallContext(context) || isNewContext(context);
@@ -109037,28 +110259,28 @@
return context.nextTokenSpan.kind !== 23 /* CloseBracketToken */;
}
function isArrowFunctionContext(context) {
- return context.contextNode.kind === 197 /* ArrowFunction */;
+ return context.contextNode.kind === 198 /* ArrowFunction */;
}
function isImportTypeContext(context) {
- return context.contextNode.kind === 183 /* ImportType */;
+ return context.contextNode.kind === 184 /* ImportType */;
}
function isNonJsxSameLineTokenContext(context) {
return context.TokensAreOnSameLine() && context.contextNode.kind !== 11 /* JsxText */;
}
function isNonJsxElementOrFragmentContext(context) {
- return context.contextNode.kind !== 260 /* JsxElement */ && context.contextNode.kind !== 264 /* JsxFragment */;
+ return context.contextNode.kind !== 261 /* JsxElement */ && context.contextNode.kind !== 265 /* JsxFragment */;
}
function isJsxExpressionContext(context) {
- return context.contextNode.kind === 270 /* JsxExpression */ || context.contextNode.kind === 269 /* JsxSpreadAttribute */;
+ return context.contextNode.kind === 271 /* JsxExpression */ || context.contextNode.kind === 270 /* JsxSpreadAttribute */;
}
function isNextTokenParentJsxAttribute(context) {
- return context.nextTokenParent.kind === 267 /* JsxAttribute */;
+ return context.nextTokenParent.kind === 268 /* JsxAttribute */;
}
function isJsxAttributeContext(context) {
- return context.contextNode.kind === 267 /* JsxAttribute */;
+ return context.contextNode.kind === 268 /* JsxAttribute */;
}
function isJsxSelfClosingElementContext(context) {
- return context.contextNode.kind === 261 /* JsxSelfClosingElement */;
+ return context.contextNode.kind === 262 /* JsxSelfClosingElement */;
}
function isNotBeforeBlockInFunctionDeclarationContext(context) {
return !isFunctionDeclContext(context) && !isBeforeBlockContext(context);
@@ -109073,45 +110295,45 @@
while (ts.isExpressionNode(node)) {
node = node.parent;
}
- return node.kind === 152 /* Decorator */;
+ return node.kind === 153 /* Decorator */;
}
function isStartOfVariableDeclarationList(context) {
- return context.currentTokenParent.kind === 238 /* VariableDeclarationList */ &&
+ return context.currentTokenParent.kind === 239 /* VariableDeclarationList */ &&
context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos;
}
function isNotFormatOnEnter(context) {
return context.formattingRequestKind !== 2 /* FormatOnEnter */;
}
function isModuleDeclContext(context) {
- return context.contextNode.kind === 244 /* ModuleDeclaration */;
+ return context.contextNode.kind === 245 /* ModuleDeclaration */;
}
function isObjectTypeContext(context) {
- return context.contextNode.kind === 168 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration;
+ return context.contextNode.kind === 169 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration;
}
function isConstructorSignatureContext(context) {
- return context.contextNode.kind === 161 /* ConstructSignature */;
+ return context.contextNode.kind === 162 /* ConstructSignature */;
}
function isTypeArgumentOrParameterOrAssertion(token, parent) {
if (token.kind !== 28 /* LessThanToken */ && token.kind !== 30 /* GreaterThanToken */) {
return false;
}
switch (parent.kind) {
- case 164 /* TypeReference */:
- case 194 /* TypeAssertionExpression */:
- case 242 /* TypeAliasDeclaration */:
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
- case 211 /* ExpressionWithTypeArguments */:
+ case 165 /* TypeReference */:
+ case 195 /* TypeAssertionExpression */:
+ case 243 /* TypeAliasDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
+ case 212 /* ExpressionWithTypeArguments */:
return true;
default:
return false;
@@ -109122,16 +110344,16 @@
isTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent);
}
function isTypeAssertionContext(context) {
- return context.contextNode.kind === 194 /* TypeAssertionExpression */;
+ return context.contextNode.kind === 195 /* TypeAssertionExpression */;
}
function isVoidOpContext(context) {
- return context.currentTokenSpan.kind === 106 /* VoidKeyword */ && context.currentTokenParent.kind === 200 /* VoidExpression */;
+ return context.currentTokenSpan.kind === 107 /* VoidKeyword */ && context.currentTokenParent.kind === 201 /* VoidExpression */;
}
function isYieldOrYieldStarWithOperand(context) {
- return context.contextNode.kind === 207 /* YieldExpression */ && context.contextNode.expression !== undefined;
+ return context.contextNode.kind === 208 /* YieldExpression */ && context.contextNode.expression !== undefined;
}
function isNonNullAssertionContext(context) {
- return context.contextNode.kind === 213 /* NonNullExpression */;
+ return context.contextNode.kind === 214 /* NonNullExpression */;
}
})(formatting = ts.formatting || (ts.formatting = {}));
})(ts || (ts = {}));
@@ -109182,12 +110404,12 @@
return map;
}
function getRuleBucketIndex(row, column) {
- ts.Debug.assert(row <= 147 /* LastKeyword */ && column <= 147 /* LastKeyword */, "Must compute formatting context from tokens");
+ ts.Debug.assert(row <= 148 /* LastKeyword */ && column <= 148 /* LastKeyword */, "Must compute formatting context from tokens");
return (row * mapRowLength) + column;
}
var maskBitSize = 5;
var mask = 31; // MaskBitSize bits
- var mapRowLength = 147 /* LastToken */ + 1;
+ var mapRowLength = 148 /* LastToken */ + 1;
var RulesPosition;
(function (RulesPosition) {
RulesPosition[RulesPosition["IgnoreRulesSpecific"] = 0] = "IgnoreRulesSpecific";
@@ -109365,17 +110587,17 @@
// i.e. parent is class declaration with the list of members and node is one of members.
function isListElement(parent, node) {
switch (parent.kind) {
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
return ts.rangeContainsRange(parent.members, node);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
var body = parent.body;
- return !!body && body.kind === 245 /* ModuleBlock */ && ts.rangeContainsRange(body.statements, node);
- case 284 /* SourceFile */:
- case 218 /* Block */:
- case 245 /* ModuleBlock */:
+ return !!body && body.kind === 246 /* ModuleBlock */ && ts.rangeContainsRange(body.statements, node);
+ case 285 /* SourceFile */:
+ case 219 /* Block */:
+ case 246 /* ModuleBlock */:
return ts.rangeContainsRange(parent.statements, node);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return ts.rangeContainsRange(parent.block.statements, node);
}
return false;
@@ -109597,19 +110819,19 @@
return node.modifiers[0].kind;
}
switch (node.kind) {
- case 240 /* ClassDeclaration */: return 76 /* ClassKeyword */;
- case 241 /* InterfaceDeclaration */: return 110 /* InterfaceKeyword */;
- case 239 /* FunctionDeclaration */: return 90 /* FunctionKeyword */;
- case 243 /* EnumDeclaration */: return 243 /* EnumDeclaration */;
- case 158 /* GetAccessor */: return 126 /* GetKeyword */;
- case 159 /* SetAccessor */: return 137 /* SetKeyword */;
- case 156 /* MethodDeclaration */:
+ case 241 /* ClassDeclaration */: return 77 /* ClassKeyword */;
+ case 242 /* InterfaceDeclaration */: return 111 /* InterfaceKeyword */;
+ case 240 /* FunctionDeclaration */: return 91 /* FunctionKeyword */;
+ case 244 /* EnumDeclaration */: return 244 /* EnumDeclaration */;
+ case 159 /* GetAccessor */: return 127 /* GetKeyword */;
+ case 160 /* SetAccessor */: return 138 /* SetKeyword */;
+ case 157 /* MethodDeclaration */:
if (node.asteriskToken) {
return 40 /* AsteriskToken */;
}
// falls through
- case 154 /* PropertyDeclaration */:
- case 151 /* Parameter */:
+ case 155 /* PropertyDeclaration */:
+ case 152 /* Parameter */:
var name = ts.getNameOfDeclaration(node);
if (name) {
return name.kind;
@@ -109659,22 +110881,22 @@
case 18 /* OpenBraceToken */:
case 19 /* CloseBraceToken */:
case 21 /* CloseParenToken */:
- case 83 /* ElseKeyword */:
- case 107 /* WhileKeyword */:
+ case 84 /* ElseKeyword */:
+ case 108 /* WhileKeyword */:
case 58 /* AtToken */:
return false;
case 42 /* SlashToken */:
case 30 /* GreaterThanToken */:
switch (container.kind) {
- case 262 /* JsxOpeningElement */:
- case 263 /* JsxClosingElement */:
- case 261 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
+ case 264 /* JsxClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
return false;
}
break;
case 22 /* OpenBracketToken */:
case 23 /* CloseBracketToken */:
- if (container.kind !== 181 /* MappedType */) {
+ if (container.kind !== 182 /* MappedType */) {
return false;
}
break;
@@ -109766,7 +110988,7 @@
consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, child);
return inheritedIndentation;
}
- var effectiveParentStartLine = child.kind === 152 /* Decorator */ ? childStartLine : undecoratedParentStartLine;
+ var effectiveParentStartLine = child.kind === 153 /* Decorator */ ? childStartLine : undecoratedParentStartLine;
var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine);
processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta);
if (child.kind === 11 /* JsxText */) {
@@ -109774,7 +110996,7 @@
indentMultilineCommentOrJsxText(range, childIndentation.indentation, /*firstLineIsIndented*/ true, /*indentFinalLine*/ false);
}
childContextNode = node;
- if (isFirstListItem && parent.kind === 187 /* ArrayLiteralExpression */ && inheritedIndentation === -1 /* Unknown */) {
+ if (isFirstListItem && parent.kind === 188 /* ArrayLiteralExpression */ && inheritedIndentation === -1 /* Unknown */) {
inheritedIndentation = childIndentation.indentation;
}
return inheritedIndentation;
@@ -110192,12 +111414,12 @@
formatting.getRangeOfEnclosingComment = getRangeOfEnclosingComment;
function getOpenTokenForList(node, list) {
switch (node.kind) {
- case 157 /* Constructor */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 197 /* ArrowFunction */:
+ case 158 /* Constructor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 198 /* ArrowFunction */:
if (node.typeParameters === list) {
return 28 /* LessThanToken */;
}
@@ -110205,8 +111427,8 @@
return 20 /* OpenParenToken */;
}
break;
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
if (node.typeArguments === list) {
return 28 /* LessThanToken */;
}
@@ -110214,12 +111436,12 @@
return 20 /* OpenParenToken */;
}
break;
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
if (node.typeArguments === list) {
return 28 /* LessThanToken */;
}
break;
- case 168 /* TypeLiteral */:
+ case 169 /* TypeLiteral */:
return 18 /* OpenBraceToken */;
}
return 0 /* Unknown */;
@@ -110336,7 +111558,7 @@
if (options.indentStyle === ts.IndentStyle.Block) {
return getBlockIndent(sourceFile, position, options);
}
- if (precedingToken.kind === 27 /* CommaToken */ && precedingToken.parent.kind !== 204 /* BinaryExpression */) {
+ if (precedingToken.kind === 27 /* CommaToken */ && precedingToken.parent.kind !== 205 /* BinaryExpression */) {
// previous token is comma that separates items in list - find the previous item and try to derive indentation from it
var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options);
if (actualIndentation !== -1 /* Unknown */) {
@@ -110490,7 +111712,7 @@
// - parent is SourceFile - by default immediate children of SourceFile are not indented except when user indents them manually
// - parent and child are not on the same line
var useActualIndentation = (ts.isDeclaration(current) || ts.isStatementButNotDeclaration(current)) &&
- (parent.kind === 284 /* SourceFile */ || !parentAndChildShareLine);
+ (parent.kind === 285 /* SourceFile */ || !parentAndChildShareLine);
if (!useActualIndentation) {
return -1 /* Unknown */;
}
@@ -110538,8 +111760,8 @@
}
SmartIndenter.isArgumentAndStartLineOverlapsExpressionBeingCalled = isArgumentAndStartLineOverlapsExpressionBeingCalled;
function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) {
- if (parent.kind === 222 /* IfStatement */ && parent.elseStatement === child) {
- var elseKeyword = ts.findChildOfKind(parent, 83 /* ElseKeyword */, sourceFile);
+ if (parent.kind === 223 /* IfStatement */ && parent.elseStatement === child) {
+ var elseKeyword = ts.findChildOfKind(parent, 84 /* ElseKeyword */, sourceFile);
ts.Debug.assert(elseKeyword !== undefined);
var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line;
return elseKeywordStartLine === childStartLine;
@@ -110556,40 +111778,40 @@
}
function getListByRange(start, end, node, sourceFile) {
switch (node.kind) {
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return getList(node.typeArguments);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return getList(node.properties);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return getList(node.elements);
- case 168 /* TypeLiteral */:
+ case 169 /* TypeLiteral */:
return getList(node.members);
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 160 /* CallSignature */:
- case 157 /* Constructor */:
- case 166 /* ConstructorType */:
- case 161 /* ConstructSignature */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 161 /* CallSignature */:
+ case 158 /* Constructor */:
+ case 167 /* ConstructorType */:
+ case 162 /* ConstructSignature */:
return getList(node.typeParameters) || getList(node.parameters);
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 308 /* JSDocTemplateTag */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 309 /* JSDocTemplateTag */:
return getList(node.typeParameters);
- case 192 /* NewExpression */:
- case 191 /* CallExpression */:
+ case 193 /* NewExpression */:
+ case 192 /* CallExpression */:
return getList(node.typeArguments) || getList(node.arguments);
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
return getList(node.declarations);
- case 252 /* NamedImports */:
- case 256 /* NamedExports */:
+ case 253 /* NamedImports */:
+ case 257 /* NamedExports */:
return getList(node.elements);
- case 184 /* ObjectBindingPattern */:
- case 185 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
return getList(node.elements);
}
function getList(list) {
@@ -110612,7 +111834,7 @@
return findColumnForFirstNonWhitespaceCharacterInLine(sourceFile.getLineAndCharacterOfPosition(list.pos), sourceFile, options);
}
function getActualIndentationForListItem(node, sourceFile, options, listIndentsChild) {
- if (node.parent && node.parent.kind === 238 /* VariableDeclarationList */) {
+ if (node.parent && node.parent.kind === 239 /* VariableDeclarationList */) {
// VariableDeclarationList has no wrapping tokens
return -1 /* Unknown */;
}
@@ -110685,83 +111907,83 @@
function nodeWillIndentChild(settings, parent, child, sourceFile, indentByDefault) {
var childKind = child ? child.kind : 0 /* Unknown */;
switch (parent.kind) {
- case 221 /* ExpressionStatement */:
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 187 /* ArrayLiteralExpression */:
- case 218 /* Block */:
- case 245 /* ModuleBlock */:
- case 188 /* ObjectLiteralExpression */:
- case 168 /* TypeLiteral */:
- case 181 /* MappedType */:
- case 170 /* TupleType */:
- case 246 /* CaseBlock */:
- case 272 /* DefaultClause */:
- case 271 /* CaseClause */:
- case 195 /* ParenthesizedExpression */:
- case 189 /* PropertyAccessExpression */:
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
- case 219 /* VariableStatement */:
- case 254 /* ExportAssignment */:
- case 230 /* ReturnStatement */:
- case 205 /* ConditionalExpression */:
- case 185 /* ArrayBindingPattern */:
- case 184 /* ObjectBindingPattern */:
- case 262 /* JsxOpeningElement */:
- case 265 /* JsxOpeningFragment */:
- case 261 /* JsxSelfClosingElement */:
- case 270 /* JsxExpression */:
- case 155 /* MethodSignature */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 151 /* Parameter */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 177 /* ParenthesizedType */:
- case 193 /* TaggedTemplateExpression */:
- case 201 /* AwaitExpression */:
- case 256 /* NamedExports */:
- case 252 /* NamedImports */:
- case 257 /* ExportSpecifier */:
- case 253 /* ImportSpecifier */:
- case 154 /* PropertyDeclaration */:
- return true;
- case 237 /* VariableDeclaration */:
- case 275 /* PropertyAssignment */:
- if (!settings.indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === 188 /* ObjectLiteralExpression */) { // TODO: GH#18217
+ case 222 /* ExpressionStatement */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 188 /* ArrayLiteralExpression */:
+ case 219 /* Block */:
+ case 246 /* ModuleBlock */:
+ case 189 /* ObjectLiteralExpression */:
+ case 169 /* TypeLiteral */:
+ case 182 /* MappedType */:
+ case 171 /* TupleType */:
+ case 247 /* CaseBlock */:
+ case 273 /* DefaultClause */:
+ case 272 /* CaseClause */:
+ case 196 /* ParenthesizedExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
+ case 220 /* VariableStatement */:
+ case 255 /* ExportAssignment */:
+ case 231 /* ReturnStatement */:
+ case 206 /* ConditionalExpression */:
+ case 186 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
+ case 263 /* JsxOpeningElement */:
+ case 266 /* JsxOpeningFragment */:
+ case 262 /* JsxSelfClosingElement */:
+ case 271 /* JsxExpression */:
+ case 156 /* MethodSignature */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 152 /* Parameter */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 178 /* ParenthesizedType */:
+ case 194 /* TaggedTemplateExpression */:
+ case 202 /* AwaitExpression */:
+ case 257 /* NamedExports */:
+ case 253 /* NamedImports */:
+ case 258 /* ExportSpecifier */:
+ case 254 /* ImportSpecifier */:
+ case 155 /* PropertyDeclaration */:
+ return true;
+ case 238 /* VariableDeclaration */:
+ case 276 /* PropertyAssignment */:
+ if (!settings.indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === 189 /* ObjectLiteralExpression */) { // TODO: GH#18217
return rangeIsOnOneLine(sourceFile, child);
}
return true;
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 225 /* ForStatement */:
- case 222 /* IfStatement */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 156 /* MethodDeclaration */:
- case 197 /* ArrowFunction */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- return childKind !== 218 /* Block */;
- case 255 /* ExportDeclaration */:
- return childKind !== 256 /* NamedExports */;
- case 249 /* ImportDeclaration */:
- return childKind !== 250 /* ImportClause */ ||
- (!!child.namedBindings && child.namedBindings.kind !== 252 /* NamedImports */);
- case 260 /* JsxElement */:
- return childKind !== 263 /* JsxClosingElement */;
- case 264 /* JsxFragment */:
- return childKind !== 266 /* JsxClosingFragment */;
- case 174 /* IntersectionType */:
- case 173 /* UnionType */:
- if (childKind === 168 /* TypeLiteral */) {
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 226 /* ForStatement */:
+ case 223 /* IfStatement */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 157 /* MethodDeclaration */:
+ case 198 /* ArrowFunction */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ return childKind !== 219 /* Block */;
+ case 256 /* ExportDeclaration */:
+ return childKind !== 257 /* NamedExports */;
+ case 250 /* ImportDeclaration */:
+ return childKind !== 251 /* ImportClause */ ||
+ (!!child.namedBindings && child.namedBindings.kind !== 253 /* NamedImports */);
+ case 261 /* JsxElement */:
+ return childKind !== 264 /* JsxClosingElement */;
+ case 265 /* JsxFragment */:
+ return childKind !== 267 /* JsxClosingFragment */;
+ case 175 /* IntersectionType */:
+ case 174 /* UnionType */:
+ if (childKind === 169 /* TypeLiteral */) {
return false;
}
// falls through
@@ -110772,11 +111994,11 @@
SmartIndenter.nodeWillIndentChild = nodeWillIndentChild;
function isControlFlowEndingStatement(kind, parent) {
switch (kind) {
- case 230 /* ReturnStatement */:
- case 234 /* ThrowStatement */:
- case 228 /* ContinueStatement */:
- case 229 /* BreakStatement */:
- return parent.kind !== 218 /* Block */;
+ case 231 /* ReturnStatement */:
+ case 235 /* ThrowStatement */:
+ case 229 /* ContinueStatement */:
+ case 230 /* BreakStatement */:
+ return parent.kind !== 219 /* Block */;
default:
return false;
}
@@ -110918,7 +112140,7 @@
* Checks if 'candidate' argument is a legal separator in the list that contains 'node' as an element
*/
function isSeparator(node, candidate) {
- return !!candidate && !!node.parent && (candidate.kind === 27 /* CommaToken */ || (candidate.kind === 26 /* SemicolonToken */ && node.parent.kind === 188 /* ObjectLiteralExpression */));
+ return !!candidate && !!node.parent && (candidate.kind === 27 /* CommaToken */ || (candidate.kind === 26 /* SemicolonToken */ && node.parent.kind === 189 /* ObjectLiteralExpression */));
}
function spaces(count) {
var s = "";
@@ -111079,7 +112301,7 @@
}
}
else {
- endNode = node.kind !== 237 /* VariableDeclaration */ && node.questionToken ? node.questionToken : node.name;
+ endNode = node.kind !== 238 /* VariableDeclaration */ && node.questionToken ? node.questionToken : node.name;
}
this.insertNodeAt(sourceFile, endNode.end, type, { prefix: ": " });
};
@@ -111191,18 +112413,18 @@
};
ChangeTracker.prototype.getInsertNodeAfterOptionsWorker = function (node) {
switch (node.kind) {
- case 240 /* ClassDeclaration */:
- case 244 /* ModuleDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 245 /* ModuleDeclaration */:
return { prefix: this.newLineCharacter, suffix: this.newLineCharacter };
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
case 10 /* StringLiteral */:
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return { prefix: ", " };
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return { suffix: "," + this.newLineCharacter };
- case 85 /* ExportKeyword */:
+ case 86 /* ExportKeyword */:
return { prefix: " " };
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return {};
default:
ts.Debug.assert(ts.isStatement(node) || ts.isClassOrTypeElement(node)); // Else we haven't handled this kind of node yet -- add it
@@ -111211,12 +112433,12 @@
};
ChangeTracker.prototype.insertName = function (sourceFile, node, name) {
ts.Debug.assert(!node.name);
- if (node.kind === 197 /* ArrowFunction */) {
+ if (node.kind === 198 /* ArrowFunction */) {
var arrow = ts.findChildOfKind(node, 37 /* EqualsGreaterThanToken */, sourceFile);
var lparen = ts.findChildOfKind(node, 20 /* OpenParenToken */, sourceFile);
if (lparen) {
// `() => {}` --> `function f() {}`
- this.insertNodesAt(sourceFile, lparen.getStart(sourceFile), [ts.createToken(90 /* FunctionKeyword */), ts.createIdentifier(name)], { joiner: " " });
+ this.insertNodesAt(sourceFile, lparen.getStart(sourceFile), [ts.createToken(91 /* FunctionKeyword */), ts.createIdentifier(name)], { joiner: " " });
deleteNode(this, sourceFile, arrow);
}
else {
@@ -111225,14 +112447,14 @@
// Replacing full range of arrow to get rid of the leading space -- replace ` =>` with `)`
this.replaceRange(sourceFile, arrow, ts.createToken(21 /* CloseParenToken */));
}
- if (node.body.kind !== 218 /* Block */) {
+ if (node.body.kind !== 219 /* Block */) {
// `() => 0` => `function f() { return 0; }`
- this.insertNodesAt(sourceFile, node.body.getStart(sourceFile), [ts.createToken(18 /* OpenBraceToken */), ts.createToken(97 /* ReturnKeyword */)], { joiner: " ", suffix: " " });
+ this.insertNodesAt(sourceFile, node.body.getStart(sourceFile), [ts.createToken(18 /* OpenBraceToken */), ts.createToken(98 /* ReturnKeyword */)], { joiner: " ", suffix: " " });
this.insertNodesAt(sourceFile, node.body.end, [ts.createToken(26 /* SemicolonToken */), ts.createToken(19 /* CloseBraceToken */)], { joiner: " " });
}
}
else {
- var pos = ts.findChildOfKind(node, node.kind === 196 /* FunctionExpression */ ? 90 /* FunctionKeyword */ : 76 /* ClassKeyword */, sourceFile).end;
+ var pos = ts.findChildOfKind(node, node.kind === 197 /* FunctionExpression */ ? 91 /* FunctionKeyword */ : 77 /* ClassKeyword */, sourceFile).end;
this.insertNodeAt(sourceFile, pos, ts.createIdentifier(name), { prefix: " " });
}
};
@@ -111459,7 +112681,7 @@
function newFileChangesWorker(oldFile, scriptKind, statements, newLineCharacter, formatContext) {
// TODO: this emits the file, parses it back, then formats it that -- may be a less roundabout way to do this
var nonFormattedText = statements.map(function (s) { return getNonformattedText(s, oldFile, newLineCharacter).text; }).join(newLineCharacter);
- var sourceFile = ts.createSourceFile("any file name", nonFormattedText, 7 /* ESNext */, /*setParentNodes*/ true, scriptKind);
+ var sourceFile = ts.createSourceFile("any file name", nonFormattedText, 8 /* ESNext */, /*setParentNodes*/ true, scriptKind);
var changes = ts.formatting.formatDocument(sourceFile, formatContext);
return applyChanges(nonFormattedText, changes) + newLineCharacter;
}
@@ -111727,14 +112949,14 @@
}
textChanges_3.isValidLocationToAddComment = isValidLocationToAddComment;
function needSemicolonBetween(a, b) {
- return (ts.isPropertySignature(a) || ts.isPropertyDeclaration(a)) && ts.isClassOrTypeElement(b) && b.name.kind === 149 /* ComputedPropertyName */
+ return (ts.isPropertySignature(a) || ts.isPropertyDeclaration(a)) && ts.isClassOrTypeElement(b) && b.name.kind === 150 /* ComputedPropertyName */
|| ts.isStatementButNotDeclaration(a) && ts.isStatementButNotDeclaration(b); // TODO: only if b would start with a `(` or `[`
}
var deleteDeclaration;
(function (deleteDeclaration_1) {
function deleteDeclaration(changes, deletedNodesInLists, sourceFile, node) {
switch (node.kind) {
- case 151 /* Parameter */: {
+ case 152 /* Parameter */: {
var oldFunction = node.parent;
if (ts.isArrowFunction(oldFunction) &&
oldFunction.parameters.length === 1 &&
@@ -111749,14 +112971,14 @@
}
break;
}
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
deleteNode(changes, sourceFile, node,
// For first import, leave header comment in place
node === sourceFile.imports[0].parent ? { leadingTriviaOption: LeadingTriviaOption.Exclude } : undefined);
break;
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
var pattern = node.parent;
- var preserveComma = pattern.kind === 185 /* ArrayBindingPattern */ && node !== ts.last(pattern.elements);
+ var preserveComma = pattern.kind === 186 /* ArrayBindingPattern */ && node !== ts.last(pattern.elements);
if (preserveComma) {
deleteNode(changes, sourceFile, node);
}
@@ -111764,13 +112986,13 @@
deleteNodeInList(changes, deletedNodesInLists, sourceFile, node);
}
break;
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
deleteVariableDeclaration(changes, deletedNodesInLists, sourceFile, node);
break;
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
deleteNodeInList(changes, deletedNodesInLists, sourceFile, node);
break;
- case 253 /* ImportSpecifier */:
+ case 254 /* ImportSpecifier */:
var namedImports = node.parent;
if (namedImports.elements.length === 1) {
deleteImportBinding(changes, sourceFile, namedImports);
@@ -111779,7 +113001,7 @@
deleteNodeInList(changes, deletedNodesInLists, sourceFile, node);
}
break;
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
deleteImportBinding(changes, sourceFile, node);
break;
default:
@@ -111826,13 +113048,13 @@
// Delete the entire import declaration
// |import * as ns from './file'|
// |import { a } from './file'|
- var importDecl = ts.getAncestor(node, 249 /* ImportDeclaration */);
+ var importDecl = ts.getAncestor(node, 250 /* ImportDeclaration */);
deleteNode(changes, sourceFile, importDecl);
}
}
function deleteVariableDeclaration(changes, deletedNodesInLists, sourceFile, node) {
var parent = node.parent;
- if (parent.kind === 274 /* CatchClause */) {
+ if (parent.kind === 275 /* CatchClause */) {
// TODO: There's currently no unused diagnostic for this, could be a suggestion
changes.deleteNodeRange(sourceFile, ts.findChildOfKind(parent, 20 /* OpenParenToken */, sourceFile), ts.findChildOfKind(parent, 21 /* CloseParenToken */, sourceFile));
return;
@@ -111843,14 +113065,14 @@
}
var gp = parent.parent;
switch (gp.kind) {
- case 227 /* ForOfStatement */:
- case 226 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 227 /* ForInStatement */:
changes.replaceNode(sourceFile, node, ts.createObjectLiteral());
break;
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
deleteNode(changes, sourceFile, parent);
break;
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
deleteNode(changes, sourceFile, gp);
break;
default:
@@ -112013,8 +113235,8 @@
var token = ts.getTokenAtPosition(sourceFile, pos);
var assertion = ts.Debug.assertDefined(ts.findAncestor(token, function (n) { return ts.isAsExpression(n) || ts.isTypeAssertion(n); }));
var replacement = ts.isAsExpression(assertion)
- ? ts.createAsExpression(assertion.expression, ts.createKeywordTypeNode(143 /* UnknownKeyword */))
- : ts.createTypeAssertion(ts.createKeywordTypeNode(143 /* UnknownKeyword */), assertion.expression);
+ ? ts.createAsExpression(assertion.expression, ts.createKeywordTypeNode(144 /* UnknownKeyword */))
+ : ts.createTypeAssertion(ts.createKeywordTypeNode(144 /* UnknownKeyword */), assertion.expression);
changeTracker.replaceNode(sourceFile, assertion.expression, replacement);
}
})(codefix = ts.codefix || (ts.codefix = {}));
@@ -112063,11 +113285,11 @@
function makeChange(changeTracker, sourceFile, pos) {
var token = ts.getTokenAtPosition(sourceFile, pos);
if (!ts.isIdentifier(token)) {
- return ts.Debug.fail("add-name-to-nameless-parameter operates on identifiers, but got a " + ts.formatSyntaxKind(token.kind));
+ return ts.Debug.fail("add-name-to-nameless-parameter operates on identifiers, but got a " + ts.Debug.formatSyntaxKind(token.kind));
}
var param = token.parent;
if (!ts.isParameter(param)) {
- return ts.Debug.fail("Tried to add a parameter name to a non-parameter: " + ts.formatSyntaxKind(token.kind));
+ return ts.Debug.fail("Tried to add a parameter name to a non-parameter: " + ts.Debug.formatSyntaxKind(token.kind));
}
var i = param.parent.parameters.indexOf(param);
ts.Debug.assert(!param.type, "Tried to add a parameter name to a parameter that already had one.");
@@ -112149,26 +113371,26 @@
}
function isDeclarationWithType(node) {
return ts.isFunctionLikeDeclaration(node) ||
- node.kind === 237 /* VariableDeclaration */ ||
- node.kind === 153 /* PropertySignature */ ||
- node.kind === 154 /* PropertyDeclaration */;
+ node.kind === 238 /* VariableDeclaration */ ||
+ node.kind === 154 /* PropertySignature */ ||
+ node.kind === 155 /* PropertyDeclaration */;
}
function transformJSDocType(node) {
switch (node.kind) {
- case 289 /* JSDocAllType */:
- case 290 /* JSDocUnknownType */:
+ case 290 /* JSDocAllType */:
+ case 291 /* JSDocUnknownType */:
return ts.createTypeReferenceNode("any", ts.emptyArray);
- case 293 /* JSDocOptionalType */:
+ case 294 /* JSDocOptionalType */:
return transformJSDocOptionalType(node);
- case 292 /* JSDocNonNullableType */:
+ case 293 /* JSDocNonNullableType */:
return transformJSDocType(node.type);
- case 291 /* JSDocNullableType */:
+ case 292 /* JSDocNullableType */:
return transformJSDocNullableType(node);
- case 295 /* JSDocVariadicType */:
+ case 296 /* JSDocVariadicType */:
return transformJSDocVariadicType(node);
- case 294 /* JSDocFunctionType */:
+ case 295 /* JSDocFunctionType */:
return transformJSDocFunctionType(node);
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return transformJSDocTypeReference(node);
default:
var visited = ts.visitEachChild(node, transformJSDocType, /*context*/ undefined); // TODO: GH#18217
@@ -112190,7 +113412,7 @@
}
function transformJSDocParameter(node) {
var index = node.parent.parameters.indexOf(node);
- var isRest = node.type.kind === 295 /* JSDocVariadicType */ && index === node.parent.parameters.length - 1; // TODO: GH#18217
+ var isRest = node.type.kind === 296 /* JSDocVariadicType */ && index === node.parent.parameters.length - 1; // TODO: GH#18217
var name = node.name || (isRest ? "rest" : "arg" + index);
var dotdotdot = isRest ? ts.createToken(25 /* DotDotDotToken */) : node.dotDotDotToken;
return ts.createParameter(node.decorators, node.modifiers, dotdotdot, name, node.questionToken, ts.visitNode(node.type, transformJSDocType), node.initializer);
@@ -112230,8 +113452,8 @@
var index = ts.createParameter(
/*decorators*/ undefined,
/*modifiers*/ undefined,
- /*dotDotDotToken*/ undefined, node.typeArguments[0].kind === 135 /* NumberKeyword */ ? "n" : "s",
- /*questionToken*/ undefined, ts.createTypeReferenceNode(node.typeArguments[0].kind === 135 /* NumberKeyword */ ? "number" : "string", []),
+ /*dotDotDotToken*/ undefined, node.typeArguments[0].kind === 136 /* NumberKeyword */ ? "n" : "s",
+ /*questionToken*/ undefined, ts.createTypeReferenceNode(node.typeArguments[0].kind === 136 /* NumberKeyword */ ? "number" : "string", []),
/*initializer*/ undefined);
var indexSignature = ts.createTypeLiteralNode([ts.createIndexSignature(/*decorators*/ undefined, /*modifiers*/ undefined, [index], node.typeArguments[1])]);
ts.setEmitFlags(indexSignature, 1 /* SingleLine */);
@@ -112331,7 +113553,7 @@
return errorCode;
}
function doChange(changes, sourceFile, token, errorCode, program, cancellationToken, markSeen, host) {
- if (!ts.isParameterPropertyModifier(token.kind) && token.kind !== 72 /* Identifier */ && token.kind !== 25 /* DotDotDotToken */ && token.kind !== 100 /* ThisKeyword */) {
+ if (!ts.isParameterPropertyModifier(token.kind) && token.kind !== 73 /* Identifier */ && token.kind !== 25 /* DotDotDotToken */ && token.kind !== 101 /* ThisKeyword */) {
return undefined;
}
var parent = token.parent;
@@ -112452,7 +113674,7 @@
function annotate(changes, sourceFile, declaration, type, program, host) {
var typeNode = ts.getTypeNodeIfAccessible(type, declaration, program, host);
if (typeNode) {
- if (ts.isInJSFile(sourceFile) && declaration.kind !== 153 /* PropertySignature */) {
+ if (ts.isInJSFile(sourceFile) && declaration.kind !== 154 /* PropertySignature */) {
var parent = ts.isVariableDeclaration(declaration) ? ts.tryCast(declaration.parent.parent, ts.isVariableStatement) : declaration;
if (!parent) {
return;
@@ -112493,13 +113715,13 @@
return !!merged;
}); });
var tag = ts.createJSDocComment(comments.join("\n"), ts.createNodeArray((oldTags || ts.emptyArray).concat(unmergedNewTags)));
- var jsDocNode = parent.kind === 197 /* ArrowFunction */ ? getJsDocNodeForArrowFunction(parent) : parent;
+ var jsDocNode = parent.kind === 198 /* ArrowFunction */ ? getJsDocNodeForArrowFunction(parent) : parent;
jsDocNode.jsDoc = parent.jsDoc;
jsDocNode.jsDocCache = parent.jsDocCache;
changes.insertJsdocCommentBefore(sourceFile, jsDocNode, tag);
}
function getJsDocNodeForArrowFunction(signature) {
- if (signature.parent.kind === 154 /* PropertyDeclaration */) {
+ if (signature.parent.kind === 155 /* PropertyDeclaration */) {
return signature.parent;
}
return signature.parent.parent;
@@ -112509,14 +113731,14 @@
return undefined;
}
switch (oldTag.kind) {
- case 304 /* JSDocParameterTag */: {
+ case 305 /* JSDocParameterTag */: {
var oldParam = oldTag;
var newParam = newTag;
return ts.isIdentifier(oldParam.name) && ts.isIdentifier(newParam.name) && oldParam.name.escapedText === newParam.name.escapedText
? ts.createJSDocParamTag(newParam.name, newParam.isBracketed, newParam.typeExpression, oldParam.comment)
: undefined;
}
- case 305 /* JSDocReturnTag */:
+ case 306 /* JSDocReturnTag */:
return ts.createJSDocReturnTag(newTag.typeExpression, oldTag.comment);
}
}
@@ -112535,18 +113757,18 @@
function inferTypeForParametersFromUsage(containingFunction, sourceFile, program, cancellationToken) {
var searchToken;
switch (containingFunction.kind) {
- case 157 /* Constructor */:
- searchToken = ts.findChildOfKind(containingFunction, 124 /* ConstructorKeyword */, sourceFile);
+ case 158 /* Constructor */:
+ searchToken = ts.findChildOfKind(containingFunction, 125 /* ConstructorKeyword */, sourceFile);
break;
- case 197 /* ArrowFunction */:
- case 196 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
var parent = containingFunction.parent;
searchToken = ts.isVariableDeclaration(parent) && ts.isIdentifier(parent.name) ?
parent.name :
containingFunction.name;
break;
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 157 /* MethodDeclaration */:
searchToken = containingFunction.name;
break;
}
@@ -112618,21 +113840,21 @@
node = node.parent;
}
switch (node.parent.kind) {
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
usageContext.isNumber = true;
break;
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
inferTypeFromPrefixUnaryExpressionContext(node.parent, usageContext);
break;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
inferTypeFromBinaryExpressionContext(node, node.parent, checker, usageContext);
break;
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
inferTypeFromSwitchStatementLabelContext(node.parent, checker, usageContext);
break;
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
if (node.parent.expression === node) {
inferTypeFromCallExpressionContext(node.parent, checker, usageContext);
}
@@ -112640,13 +113862,13 @@
inferTypeFromContextualType(node, checker, usageContext);
}
break;
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
inferTypeFromPropertyAccessExpressionContext(node.parent, checker, usageContext);
break;
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
inferTypeFromPropertyElementExpressionContext(node.parent, node, checker, usageContext);
break;
- case 237 /* VariableDeclaration */: {
+ case 238 /* VariableDeclaration */: {
var _a = node.parent, name = _a.name, initializer = _a.initializer;
if (node === name) {
if (initializer) { // This can happen for `let x = null;` which still has an implicit-any error.
@@ -112697,17 +113919,17 @@
case 50 /* BarToken */:
case 51 /* CaretToken */:
// CompoundAssignmentOperator
- case 61 /* MinusEqualsToken */:
- case 63 /* AsteriskAsteriskEqualsToken */:
- case 62 /* AsteriskEqualsToken */:
- case 64 /* SlashEqualsToken */:
- case 65 /* PercentEqualsToken */:
- case 69 /* AmpersandEqualsToken */:
- case 70 /* BarEqualsToken */:
- case 71 /* CaretEqualsToken */:
- case 66 /* LessThanLessThanEqualsToken */:
- case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
- case 67 /* GreaterThanGreaterThanEqualsToken */:
+ case 62 /* MinusEqualsToken */:
+ case 64 /* AsteriskAsteriskEqualsToken */:
+ case 63 /* AsteriskEqualsToken */:
+ case 65 /* SlashEqualsToken */:
+ case 66 /* PercentEqualsToken */:
+ case 70 /* AmpersandEqualsToken */:
+ case 71 /* BarEqualsToken */:
+ case 72 /* CaretEqualsToken */:
+ case 67 /* LessThanLessThanEqualsToken */:
+ case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
+ case 68 /* GreaterThanGreaterThanEqualsToken */:
// AdditiveOperator
case 39 /* MinusToken */:
// RelationalOperator
@@ -112723,7 +113945,7 @@
usageContext.isNumber = true;
}
break;
- case 60 /* PlusEqualsToken */:
+ case 61 /* PlusEqualsToken */:
case 38 /* PlusToken */:
var otherOperandType = checker.getTypeAtLocation(parent.left === node ? parent.right : parent.left);
if (otherOperandType.flags & 1056 /* EnumLike */) {
@@ -112740,14 +113962,14 @@
}
break;
// AssignmentOperators
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
case 33 /* EqualsEqualsToken */:
case 35 /* EqualsEqualsEqualsToken */:
case 36 /* ExclamationEqualsEqualsToken */:
case 34 /* ExclamationEqualsToken */:
addCandidateType(usageContext, checker.getTypeAtLocation(parent.left === node ? parent.right : parent.left));
break;
- case 93 /* InKeyword */:
+ case 94 /* InKeyword */:
if (node === parent.left) {
usageContext.isString = true;
}
@@ -112755,7 +113977,7 @@
// LogicalOperator
case 55 /* BarBarToken */:
if (node === parent.left &&
- (node.parent.parent.kind === 237 /* VariableDeclaration */ || ts.isAssignmentExpression(node.parent.parent, /*excludeCompoundAssignment*/ true))) {
+ (node.parent.parent.kind === 238 /* VariableDeclaration */ || ts.isAssignmentExpression(node.parent.parent, /*excludeCompoundAssignment*/ true))) {
// var x = x || {};
// TODO: use getFalsyflagsOfType
addCandidateType(usageContext, checker.getTypeAtLocation(parent.right));
@@ -112763,7 +113985,7 @@
break;
case 54 /* AmpersandAmpersandToken */:
case 27 /* CommaToken */:
- case 94 /* InstanceOfKeyword */:
+ case 95 /* InstanceOfKeyword */:
// nothing to infer here
break;
}
@@ -112783,7 +114005,7 @@
}
}
inferTypeFromContext(parent, checker, callContext.returnType);
- if (parent.kind === 191 /* CallExpression */) {
+ if (parent.kind === 192 /* CallExpression */) {
(usageContext.callContexts || (usageContext.callContexts = [])).push(callContext);
}
else {
@@ -113023,12 +114245,12 @@
var precedingNode;
var newClassDeclaration;
switch (ctorDeclaration.kind) {
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
precedingNode = ctorDeclaration;
changes.delete(sourceFile, ctorDeclaration);
newClassDeclaration = createClassFromFunctionDeclaration(ctorDeclaration);
break;
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
precedingNode = ctorDeclaration.parent.parent;
newClassDeclaration = createClassFromVariableDeclaration(ctorDeclaration);
if (ctorDeclaration.parent.declarations.length === 1) {
@@ -113060,7 +114282,7 @@
// all static members are stored in the "exports" array of symbol
if (symbol.exports) {
symbol.exports.forEach(function (member) {
- var memberElement = createClassElement(member, [ts.createToken(116 /* StaticKeyword */)]);
+ var memberElement = createClassElement(member, [ts.createToken(117 /* StaticKeyword */)]);
if (memberElement) {
memberElements.push(memberElement);
}
@@ -113083,7 +114305,7 @@
return;
}
// delete the entire statement if this expression is the sole expression to take care of the semicolon at the end
- var nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 221 /* ExpressionStatement */
+ var nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 222 /* ExpressionStatement */
? assignmentBinaryExpression.parent : assignmentBinaryExpression;
changes.delete(sourceFile, nodeToDelete);
if (!assignmentBinaryExpression.right) {
@@ -113091,27 +114313,27 @@
/*type*/ undefined, /*initializer*/ undefined);
}
switch (assignmentBinaryExpression.right.kind) {
- case 196 /* FunctionExpression */: {
+ case 197 /* FunctionExpression */: {
var functionExpression = assignmentBinaryExpression.right;
- var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(functionExpression, 121 /* AsyncKeyword */));
+ var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(functionExpression, 122 /* AsyncKeyword */));
var method = ts.createMethod(/*decorators*/ undefined, fullModifiers, /*asteriskToken*/ undefined, memberDeclaration.name, /*questionToken*/ undefined,
/*typeParameters*/ undefined, functionExpression.parameters, /*type*/ undefined, functionExpression.body);
ts.copyLeadingComments(assignmentBinaryExpression, method, sourceFile);
return method;
}
- case 197 /* ArrowFunction */: {
+ case 198 /* ArrowFunction */: {
var arrowFunction = assignmentBinaryExpression.right;
var arrowFunctionBody = arrowFunction.body;
var bodyBlock = void 0;
// case 1: () => { return [1,2,3] }
- if (arrowFunctionBody.kind === 218 /* Block */) {
+ if (arrowFunctionBody.kind === 219 /* Block */) {
bodyBlock = arrowFunctionBody;
}
// case 2: () => [1,2,3]
else {
bodyBlock = ts.createBlock([ts.createReturn(arrowFunctionBody)]);
}
- var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(arrowFunction, 121 /* AsyncKeyword */));
+ var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(arrowFunction, 122 /* AsyncKeyword */));
var method = ts.createMethod(/*decorators*/ undefined, fullModifiers, /*asteriskToken*/ undefined, memberDeclaration.name, /*questionToken*/ undefined,
/*typeParameters*/ undefined, arrowFunction.parameters, /*type*/ undefined, bodyBlock);
ts.copyLeadingComments(assignmentBinaryExpression, method, sourceFile);
@@ -113132,17 +114354,17 @@
}
function createClassFromVariableDeclaration(node) {
var initializer = node.initializer;
- if (!initializer || initializer.kind !== 196 /* FunctionExpression */) {
+ if (!initializer || initializer.kind !== 197 /* FunctionExpression */) {
return undefined;
}
- if (node.name.kind !== 72 /* Identifier */) {
+ if (node.name.kind !== 73 /* Identifier */) {
return undefined;
}
var memberElements = createClassElementsFromSymbol(node.symbol);
if (initializer.body) {
memberElements.unshift(ts.createConstructor(/*decorators*/ undefined, /*modifiers*/ undefined, initializer.parameters, initializer.body));
}
- var modifiers = getModifierKindFromSource(precedingNode, 85 /* ExportKeyword */);
+ var modifiers = getModifierKindFromSource(precedingNode, 86 /* ExportKeyword */);
var cls = ts.createClassDeclaration(/*decorators*/ undefined, modifiers, node.name,
/*typeParameters*/ undefined, /*heritageClauses*/ undefined, memberElements);
// Don't call copyComments here because we'll already leave them in place
@@ -113153,7 +114375,7 @@
if (node.body) {
memberElements.unshift(ts.createConstructor(/*decorators*/ undefined, /*modifiers*/ undefined, node.parameters, node.body));
}
- var modifiers = getModifierKindFromSource(node, 85 /* ExportKeyword */);
+ var modifiers = getModifierKindFromSource(node, 86 /* ExportKeyword */);
var cls = ts.createClassDeclaration(/*decorators*/ undefined, modifiers, node.name,
/*typeParameters*/ undefined, /*heritageClauses*/ undefined, memberElements);
// Don't call copyComments here because we'll already leave them in place
@@ -113183,6 +114405,11 @@
fixIds: [fixId],
getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, err) { return convertToAsyncFunction(changes, err.file, err.start, context.program.getTypeChecker(), context); }); },
});
+ var SynthBindingNameKind;
+ (function (SynthBindingNameKind) {
+ SynthBindingNameKind[SynthBindingNameKind["Identifier"] = 0] = "Identifier";
+ SynthBindingNameKind[SynthBindingNameKind["BindingPattern"] = 1] = "BindingPattern";
+ })(SynthBindingNameKind || (SynthBindingNameKind = {}));
function convertToAsyncFunction(changes, sourceFile, position, checker, context) {
// get the function declaration - returns a promise
var tokenAtPosition = ts.getTokenAtPosition(sourceFile, position);
@@ -113211,7 +114438,7 @@
return;
}
// add the async keyword
- changes.insertLastModifierBefore(sourceFile, 121 /* AsyncKeyword */, functionToConvert);
+ changes.insertLastModifierBefore(sourceFile, 122 /* AsyncKeyword */, functionToConvert);
function startTransformation(node, nodeToReplace) {
var newNodes = transformExpression(node, transformer, node);
changes.replaceNodeWithNodes(sourceFile, nodeToReplace, newNodes);
@@ -113319,8 +114546,8 @@
allVarNames.push({ identifier: synthName.identifier, symbol: symbol });
addNameToFrequencyMap(collidingSymbolMap, ident.text, symbol);
}
- // we only care about identifiers that are parameters and declarations (don't care about other uses)
- else if (node.parent && (ts.isParameter(node.parent) || ts.isVariableDeclaration(node.parent))) {
+ // we only care about identifiers that are parameters, declarations, or binding elements (don't care about other uses)
+ else if (node.parent && (ts.isParameter(node.parent) || ts.isVariableDeclaration(node.parent) || ts.isBindingElement(node.parent))) {
var originalName = node.text;
var collidingSymbols = collidingSymbolMap.get(originalName);
// if the identifier name conflicts with a different identifier that we've already seen
@@ -113334,7 +114561,7 @@
else {
var identifier = ts.getSynthesizedDeepClone(node);
identsToRenameMap.set(symbolIdString, identifier);
- synthNamesMap.set(symbolIdString, { identifier: identifier, types: [], numberOfAssignmentsOriginal: allVarNames.filter(function (elem) { return elem.identifier.text === node.text; }).length /*, numberOfAssignmentsSynthesized: 0*/ });
+ synthNamesMap.set(symbolIdString, createSynthIdentifier(identifier, [], allVarNames.filter(function (elem) { return elem.identifier.text === node.text; }).length /*, numberOfAssignmentsSynthesized: 0*/));
if ((ts.isParameter(node.parent) && isExpressionOrCallOnTypePromise(node.parent.parent)) || ts.isVariableDeclaration(node.parent)) {
allVarNames.push({ identifier: identifier, symbol: symbol });
addNameToFrequencyMap(collidingSymbolMap, originalName, symbol);
@@ -113382,7 +114609,7 @@
var numVarsSameName = (originalNames.get(name.text) || ts.emptyArray).length;
var numberOfAssignmentsOriginal = 0;
var identifier = numVarsSameName === 0 ? name : ts.createIdentifier(name.text + "_" + numVarsSameName);
- return { identifier: identifier, types: [], numberOfAssignmentsOriginal: numberOfAssignmentsOriginal };
+ return createSynthIdentifier(identifier, [], numberOfAssignmentsOriginal);
}
// dispatch function to recursively build the refactoring
// should be kept up to date with isFixablePromiseHandler in suggestionDiagnostics.ts
@@ -113409,68 +114636,90 @@
}
function transformCatch(node, transformer, prevArgName) {
var func = node.arguments[0];
- var argName = getArgName(func, transformer);
+ var argName = getArgBindingName(func, transformer);
var shouldReturn = transformer.setOfExpressionsToReturn.get(ts.getNodeId(node).toString());
+ var possibleNameForVarDecl;
/*
If there is another call in the chain after the .catch() we are transforming, we will need to save the result of both paths (try block and catch block)
To do this, we will need to synthesize a variable that we were not aware of while we were adding identifiers to the synthNamesMap
We will use the prevArgName and then update the synthNamesMap with a new variable name for the next transformation step
*/
if (prevArgName && !shouldReturn) {
- prevArgName.numberOfAssignmentsOriginal = 2; // Try block and catch block
+ if (isSynthIdentifier(prevArgName)) {
+ possibleNameForVarDecl = prevArgName;
transformer.synthNamesMap.forEach(function (val, key) {
if (val.identifier.text === prevArgName.identifier.text) {
var newSynthName = createUniqueSynthName(prevArgName);
transformer.synthNamesMap.set(key, newSynthName);
}
});
+ }
+ else {
+ possibleNameForVarDecl = createSynthIdentifier(ts.createOptimisticUniqueName("result"), prevArgName.types);
+ }
+ possibleNameForVarDecl.numberOfAssignmentsOriginal = 2; // Try block and catch block
// update the constIdentifiers list
- if (transformer.constIdentifiers.some(function (elem) { return elem.text === prevArgName.identifier.text; })) {
- transformer.constIdentifiers.push(createUniqueSynthName(prevArgName).identifier);
+ if (transformer.constIdentifiers.some(function (elem) { return elem.text === possibleNameForVarDecl.identifier.text; })) {
+ transformer.constIdentifiers.push(createUniqueSynthName(possibleNameForVarDecl).identifier);
}
}
- var tryBlock = ts.createBlock(transformExpression(node.expression, transformer, node, prevArgName));
- var transformationBody = getTransformationBody(func, prevArgName, argName, node, transformer);
- var catchArg = argName ? argName.identifier.text : "e";
- var catchClause = ts.createCatchClause(catchArg, ts.createBlock(transformationBody));
+ var tryBlock = ts.createBlock(transformExpression(node.expression, transformer, node, possibleNameForVarDecl));
+ var transformationBody = getTransformationBody(func, possibleNameForVarDecl, argName, node, transformer);
+ var catchArg = argName ? isSynthIdentifier(argName) ? argName.identifier.text : argName.bindingPattern : "e";
+ var catchVariableDeclaration = ts.createVariableDeclaration(catchArg);
+ var catchClause = ts.createCatchClause(catchVariableDeclaration, ts.createBlock(transformationBody));
/*
In order to avoid an implicit any, we will synthesize a type for the declaration using the unions of the types of both paths (try block and catch block)
*/
var varDeclList;
- if (prevArgName && !shouldReturn) {
- var typeArray = prevArgName.types;
+ var varDeclIdentifier;
+ if (possibleNameForVarDecl && !shouldReturn) {
+ varDeclIdentifier = ts.getSynthesizedDeepClone(possibleNameForVarDecl.identifier);
+ var typeArray = possibleNameForVarDecl.types;
var unionType = transformer.checker.getUnionType(typeArray, 2 /* Subtype */);
var unionTypeNode = transformer.isInJSFile ? undefined : transformer.checker.typeToTypeNode(unionType);
- var varDecl = [ts.createVariableDeclaration(ts.getSynthesizedDeepClone(prevArgName.identifier), unionTypeNode)];
+ var varDecl = [ts.createVariableDeclaration(varDeclIdentifier, unionTypeNode)];
varDeclList = ts.createVariableStatement(/*modifiers*/ undefined, ts.createVariableDeclarationList(varDecl, 1 /* Let */));
}
var tryStatement = ts.createTry(tryBlock, catchClause, /*finallyBlock*/ undefined);
- return varDeclList ? [varDeclList, tryStatement] : [tryStatement];
+ var destructuredResult = prevArgName && varDeclIdentifier && isSynthBindingPattern(prevArgName)
+ && ts.createVariableStatement(/* modifiers */ undefined, ts.createVariableDeclarationList([ts.createVariableDeclaration(ts.getSynthesizedDeepCloneWithRenames(prevArgName.bindingPattern), /* type */ undefined, varDeclIdentifier)], 2 /* Const */));
+ return ts.compact([varDeclList, tryStatement, destructuredResult]);
+ }
+ function getIdentifierTextsFromBindingName(bindingName) {
+ if (ts.isIdentifier(bindingName))
+ return [bindingName.text];
+ return ts.flatMap(bindingName.elements, function (element) {
+ if (ts.isOmittedExpression(element))
+ return [];
+ return getIdentifierTextsFromBindingName(element.name);
+ });
}
function createUniqueSynthName(prevArgName) {
var renamedPrevArg = ts.createOptimisticUniqueName(prevArgName.identifier.text);
- var newSynthName = { identifier: renamedPrevArg, types: [], numberOfAssignmentsOriginal: 0 };
- return newSynthName;
+ return createSynthIdentifier(renamedPrevArg);
}
function transformThen(node, transformer, outermostParent, prevArgName) {
var _a = node.arguments, res = _a[0], rej = _a[1];
if (!res) {
return transformExpression(node.expression, transformer, outermostParent);
}
- var argNameRes = getArgName(res, transformer);
+ var argNameRes = getArgBindingName(res, transformer);
var transformationBody = getTransformationBody(res, prevArgName, argNameRes, node, transformer);
if (rej) {
- var argNameRej = getArgName(rej, transformer);
+ var argNameRej = getArgBindingName(rej, transformer);
var tryBlock = ts.createBlock(transformExpression(node.expression, transformer, node, argNameRes).concat(transformationBody));
var transformationBody2 = getTransformationBody(rej, prevArgName, argNameRej, node, transformer);
- var catchArg = argNameRej ? argNameRej.identifier.text : "e";
- var catchClause = ts.createCatchClause(catchArg, ts.createBlock(transformationBody2));
+ var catchArg = argNameRej ? isSynthIdentifier(argNameRej) ? argNameRej.identifier.text : argNameRej.bindingPattern : "e";
+ var catchVariableDeclaration = ts.createVariableDeclaration(catchArg);
+ var catchClause = ts.createCatchClause(catchVariableDeclaration, ts.createBlock(transformationBody2));
return [ts.createTry(tryBlock, catchClause, /* finallyBlock */ undefined)];
}
return transformExpression(node.expression, transformer, node, argNameRes).concat(transformationBody);
}
- function getFlagOfIdentifier(node, constIdentifiers) {
- var inArr = constIdentifiers.some(function (elem) { return elem.text === node.text; });
+ function getFlagOfBindingName(bindingName, constIdentifiers) {
+ var identifiers = getIdentifierTextsFromBindingName(getNode(bindingName));
+ var inArr = constIdentifiers.some(function (elem) { return ts.contains(identifiers, elem.text); });
return inArr ? 2 /* Const */ : 1 /* Let */;
}
function transformPromiseCall(node, transformer, prevArgName) {
@@ -113486,29 +114735,29 @@
return [ts.createReturn(ts.getSynthesizedDeepClone(node))];
}
function createTransformedStatement(prevArgName, rightHandSide, transformer) {
- if (!prevArgName || prevArgName.identifier.text.length === 0) {
+ if (!prevArgName || isEmpty(prevArgName)) {
// if there's no argName to assign to, there still might be side effects
return [ts.createStatement(rightHandSide)];
}
- if (prevArgName.types.length < prevArgName.numberOfAssignmentsOriginal) {
+ if (isSynthIdentifier(prevArgName) && prevArgName.types.length < prevArgName.numberOfAssignmentsOriginal) {
// if the variable has already been declared, we don't need "let" or "const"
return [ts.createStatement(ts.createAssignment(ts.getSynthesizedDeepClone(prevArgName.identifier), rightHandSide))];
}
- return [ts.createVariableStatement(/*modifiers*/ undefined, (ts.createVariableDeclarationList([ts.createVariableDeclaration(ts.getSynthesizedDeepClone(prevArgName.identifier), /*type*/ undefined, rightHandSide)], getFlagOfIdentifier(prevArgName.identifier, transformer.constIdentifiers))))];
+ return [ts.createVariableStatement(/*modifiers*/ undefined, (ts.createVariableDeclarationList([ts.createVariableDeclaration(ts.getSynthesizedDeepClone(getNode(prevArgName)), /*type*/ undefined, rightHandSide)], getFlagOfBindingName(prevArgName, transformer.constIdentifiers))))];
}
// should be kept up to date with isFixablePromiseArgument in suggestionDiagnostics.ts
function getTransformationBody(func, prevArgName, argName, parent, transformer) {
var shouldReturn = transformer.setOfExpressionsToReturn.get(ts.getNodeId(parent).toString());
switch (func.kind) {
- case 96 /* NullKeyword */:
+ case 97 /* NullKeyword */:
// do not produce a transformed statement for a null argument
break;
- case 72 /* Identifier */: // identifier includes undefined
+ case 73 /* Identifier */: // identifier includes undefined
if (!argName) {
// undefined was argument passed to promise handler
break;
}
- var synthCall = ts.createCall(ts.getSynthesizedDeepClone(func), /*typeArguments*/ undefined, [argName.identifier]);
+ var synthCall = ts.createCall(ts.getSynthesizedDeepClone(func), /*typeArguments*/ undefined, isSynthIdentifier(argName) ? [argName.identifier] : []);
if (shouldReturn) {
return [ts.createReturn(synthCall)];
}
@@ -113525,8 +114774,8 @@
prevArgName.types.push(returnType);
}
return varDeclOrAssignment;
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */: {
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */: {
var funcBody = func.body;
// Arrow functions with block bodies { } will enter this control flow
if (ts.isBlock(funcBody)) {
@@ -113545,7 +114794,7 @@
}
}
return shouldReturn ? refactoredStmts.map(function (s) { return ts.getSynthesizedDeepClone(s); }) :
- removeReturns(refactoredStmts, prevArgName === undefined ? undefined : prevArgName.identifier, transformer, seenReturnStatement);
+ removeReturns(refactoredStmts, prevArgName, transformer, seenReturnStatement);
}
else {
var innerRetStmts = ts.isFixablePromiseHandler(funcBody) ? [ts.createReturn(funcBody)] : ts.emptyArray;
@@ -113591,7 +114840,7 @@
ret.push(ts.createExpressionStatement(possiblyAwaitedExpression));
}
else {
- ret.push(ts.createVariableStatement(/*modifiers*/ undefined, (ts.createVariableDeclarationList([ts.createVariableDeclaration(prevArgName, /*type*/ undefined, possiblyAwaitedExpression)], getFlagOfIdentifier(prevArgName, transformer.constIdentifiers)))));
+ ret.push(ts.createVariableStatement(/*modifiers*/ undefined, (ts.createVariableDeclarationList([ts.createVariableDeclaration(getNode(prevArgName), /*type*/ undefined, possiblyAwaitedExpression)], getFlagOfBindingName(prevArgName, transformer.constIdentifiers)))));
}
}
}
@@ -113601,7 +114850,7 @@
}
// if block has no return statement, need to define prevArgName as undefined to prevent undeclared variables
if (!seenReturnStatement && prevArgName !== undefined) {
- ret.push(ts.createVariableStatement(/*modifiers*/ undefined, (ts.createVariableDeclarationList([ts.createVariableDeclaration(prevArgName, /*type*/ undefined, ts.createIdentifier("undefined"))], getFlagOfIdentifier(prevArgName, transformer.constIdentifiers)))));
+ ret.push(ts.createVariableStatement(/*modifiers*/ undefined, (ts.createVariableDeclarationList([ts.createVariableDeclaration(getNode(prevArgName), /*type*/ undefined, ts.createIdentifier("undefined"))], getFlagOfBindingName(prevArgName, transformer.constIdentifiers)))));
}
return ret;
}
@@ -113624,32 +114873,42 @@
}
return innerCbBody;
}
- function getArgName(funcNode, transformer) {
+ function getArgBindingName(funcNode, transformer) {
var numberOfAssignmentsOriginal = 0;
var types = [];
var name;
if (ts.isFunctionLikeDeclaration(funcNode)) {
if (funcNode.parameters.length > 0) {
var param = funcNode.parameters[0].name;
- name = getMapEntryOrDefault(param);
+ name = getMappedBindingNameOrDefault(param);
}
}
else if (ts.isIdentifier(funcNode)) {
name = getMapEntryOrDefault(funcNode);
}
// return undefined argName when arg is null or undefined
- if (!name || name.identifier.text === "undefined") {
+ if (!name || "identifier" in name && name.identifier.text === "undefined") {
return undefined;
}
return name;
+ function getMappedBindingNameOrDefault(bindingName) {
+ if (ts.isIdentifier(bindingName))
+ return getMapEntryOrDefault(bindingName);
+ var elements = ts.flatMap(bindingName.elements, function (element) {
+ if (ts.isOmittedExpression(element))
+ return [];
+ return [getMappedBindingNameOrDefault(element.name)];
+ });
+ return createSynthBindingPattern(bindingName, elements);
+ }
function getMapEntryOrDefault(identifier) {
var originalNode = getOriginalNode(identifier);
var symbol = getSymbol(originalNode);
if (!symbol) {
- return { identifier: identifier, types: types, numberOfAssignmentsOriginal: numberOfAssignmentsOriginal };
+ return createSynthIdentifier(identifier, types, numberOfAssignmentsOriginal);
}
var mapEntry = transformer.synthNamesMap.get(ts.getSymbolId(symbol).toString());
- return mapEntry || { identifier: identifier, types: types, numberOfAssignmentsOriginal: numberOfAssignmentsOriginal };
+ return mapEntry || createSynthIdentifier(identifier, types, numberOfAssignmentsOriginal);
}
function getSymbol(node) {
return node.symbol ? node.symbol : transformer.checker.getSymbolAtLocation(node);
@@ -113658,6 +114917,34 @@
return node.original ? node.original : node;
}
}
+ function isEmpty(bindingName) {
+ if (!bindingName) {
+ return true;
+ }
+ if (isSynthIdentifier(bindingName)) {
+ return !bindingName.identifier.text;
+ }
+ return ts.every(bindingName.elements, isEmpty);
+ }
+ function getNode(bindingName) {
+ return isSynthIdentifier(bindingName) ? bindingName.identifier : bindingName.bindingPattern;
+ }
+ function createSynthIdentifier(identifier, types, numberOfAssignmentsOriginal) {
+ if (types === void 0) { types = []; }
+ if (numberOfAssignmentsOriginal === void 0) { numberOfAssignmentsOriginal = 0; }
+ return { kind: 0 /* Identifier */, identifier: identifier, types: types, numberOfAssignmentsOriginal: numberOfAssignmentsOriginal };
+ }
+ function createSynthBindingPattern(bindingPattern, elements, types) {
+ if (elements === void 0) { elements = ts.emptyArray; }
+ if (types === void 0) { types = []; }
+ return { kind: 1 /* BindingPattern */, bindingPattern: bindingPattern, elements: elements, types: types };
+ }
+ function isSynthIdentifier(bindingName) {
+ return bindingName.kind === 0 /* Identifier */;
+ }
+ function isSynthBindingPattern(bindingName) {
+ return bindingName.kind === 1 /* BindingPattern */;
+ }
})(codefix = ts.codefix || (ts.codefix = {}));
})(ts || (ts = {}));
/* @internal */
@@ -113691,10 +114978,10 @@
}
var importNode = ts.importFromModuleSpecifier(moduleSpecifier);
switch (importNode.kind) {
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
changes.replaceNode(importingFile, importNode, ts.makeImport(importNode.name, /*namedImports*/ undefined, moduleSpecifier, quotePreference));
break;
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
if (ts.isRequireCall(importNode, /*checkArgumentIsStringLiteralLike*/ false)) {
changes.replaceNode(importingFile, importNode, ts.createPropertyAccess(ts.getSynthesizedDeepClone(importNode), "default"));
}
@@ -113740,29 +115027,29 @@
sourceFile.forEachChild(function recur(node) {
if (ts.isPropertyAccessExpression(node) && ts.isExportsOrModuleExportsOrAlias(sourceFile, node.expression)) {
var parent = node.parent;
- cb(node, ts.isBinaryExpression(parent) && parent.left === node && parent.operatorToken.kind === 59 /* EqualsToken */);
+ cb(node, ts.isBinaryExpression(parent) && parent.left === node && parent.operatorToken.kind === 60 /* EqualsToken */);
}
node.forEachChild(recur);
});
}
function convertStatement(sourceFile, statement, checker, changes, identifiers, target, exports, quotePreference) {
switch (statement.kind) {
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
convertVariableStatement(sourceFile, statement, changes, checker, identifiers, target, quotePreference);
return false;
- case 221 /* ExpressionStatement */: {
+ case 222 /* ExpressionStatement */: {
var expression = statement.expression;
switch (expression.kind) {
- case 191 /* CallExpression */: {
+ case 192 /* CallExpression */: {
if (ts.isRequireCall(expression, /*checkArgumentIsStringLiteralLike*/ true)) {
// For side-effecting require() call, just make a side-effecting import.
changes.replaceNode(sourceFile, statement, ts.makeImport(/*name*/ undefined, /*namedImports*/ undefined, expression.arguments[0], quotePreference));
}
return false;
}
- case 204 /* BinaryExpression */: {
+ case 205 /* BinaryExpression */: {
var operatorToken = expression.operatorToken;
- return operatorToken.kind === 59 /* EqualsToken */ && convertAssignment(sourceFile, checker, expression, changes, exports);
+ return operatorToken.kind === 60 /* EqualsToken */ && convertAssignment(sourceFile, checker, expression, changes, exports);
}
}
}
@@ -113802,8 +115089,8 @@
/** Converts `const name = require("moduleSpecifier").propertyName` */
function convertPropertyAccessImport(name, propertyName, moduleSpecifier, identifiers, quotePreference) {
switch (name.kind) {
- case 184 /* ObjectBindingPattern */:
- case 185 /* ArrayBindingPattern */: {
+ case 185 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */: {
// `const [a, b] = require("c").d` --> `import { d } from "c"; const [a, b] = d;`
var tmp = makeUniqueName(propertyName, identifiers);
return [
@@ -113811,7 +115098,7 @@
makeConst(/*modifiers*/ undefined, name, ts.createIdentifier(tmp)),
];
}
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
// `const a = require("b").c` --> `import { c as a } from "./b";
return [makeSingleImport(name.text, propertyName, moduleSpecifier, quotePreference)];
default:
@@ -113854,16 +115141,16 @@
function tryChangeModuleExportsObject(object) {
var statements = ts.mapAllOrFail(object.properties, function (prop) {
switch (prop.kind) {
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
// TODO: Maybe we should handle this? See fourslash test `refactorConvertToEs6Module_export_object_shorthand.ts`.
- case 276 /* ShorthandPropertyAssignment */:
- case 277 /* SpreadAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
+ case 278 /* SpreadAssignment */:
return undefined;
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return !ts.isIdentifier(prop.name) ? undefined : convertExportsDotXEquals_replaceNode(prop.name.text, prop.initializer);
- case 156 /* MethodDeclaration */:
- return !ts.isIdentifier(prop.name) ? undefined : functionExpressionToDeclaration(prop.name.text, [ts.createToken(85 /* ExportKeyword */)], prop);
+ case 157 /* MethodDeclaration */:
+ return !ts.isIdentifier(prop.name) ? undefined : functionExpressionToDeclaration(prop.name.text, [ts.createToken(86 /* ExportKeyword */)], prop);
default:
ts.Debug.assertNever(prop);
}
@@ -113912,7 +115199,7 @@
var name = left.name.text;
if ((ts.isFunctionExpression(right) || ts.isArrowFunction(right) || ts.isClassExpression(right)) && (!right.name || right.name.text === name)) {
// `exports.f = function() {}` -> `export function f() {}` -- Replace `exports.f = ` with `export `, and insert the name after `function`.
- changes.replaceRange(sourceFile, { pos: left.getStart(sourceFile), end: right.getStart(sourceFile) }, ts.createToken(85 /* ExportKeyword */), { suffix: " " });
+ changes.replaceRange(sourceFile, { pos: left.getStart(sourceFile), end: right.getStart(sourceFile) }, ts.createToken(86 /* ExportKeyword */), { suffix: " " });
if (!right.name)
changes.insertName(sourceFile, right, name);
var semi = ts.findChildOfKind(parent, 26 /* SemicolonToken */, sourceFile);
@@ -113921,14 +115208,14 @@
}
else {
// `exports.f = function g() {}` -> `export const f = function g() {}` -- just replace `exports.` with `export const `
- changes.replaceNodeRangeWithNodes(sourceFile, left.expression, ts.findChildOfKind(left, 24 /* DotToken */, sourceFile), [ts.createToken(85 /* ExportKeyword */), ts.createToken(77 /* ConstKeyword */)], { joiner: " ", suffix: " " });
+ changes.replaceNodeRangeWithNodes(sourceFile, left.expression, ts.findChildOfKind(left, 24 /* DotToken */, sourceFile), [ts.createToken(86 /* ExportKeyword */), ts.createToken(78 /* ConstKeyword */)], { joiner: " ", suffix: " " });
}
}
// TODO: GH#22492 this will cause an error if a change has been made inside the body of the node.
function convertExportsDotXEquals_replaceNode(name, exported) {
- var modifiers = [ts.createToken(85 /* ExportKeyword */)];
+ var modifiers = [ts.createToken(86 /* ExportKeyword */)];
switch (exported.kind) {
- case 196 /* FunctionExpression */: {
+ case 197 /* FunctionExpression */: {
var expressionName = exported.name;
if (expressionName && expressionName.text !== name) {
// `exports.f = function g() {}` -> `export const f = function g() {}`
@@ -113936,10 +115223,10 @@
}
}
// falls through
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
// `exports.f = function() {}` --> `export function f() {}`
return functionExpressionToDeclaration(name, modifiers, exported);
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
// `exports.C = class {}` --> `export class C {}`
return classExpressionToDeclaration(name, modifiers, exported);
default:
@@ -113957,7 +115244,7 @@
*/
function convertSingleImport(file, name, moduleSpecifier, changes, checker, identifiers, target, quotePreference) {
switch (name.kind) {
- case 184 /* ObjectBindingPattern */: {
+ case 185 /* ObjectBindingPattern */: {
var importSpecifiers = ts.mapAllOrFail(name.elements, function (e) {
return e.dotDotDotToken || e.initializer || e.propertyName && !ts.isIdentifier(e.propertyName) || !ts.isIdentifier(e.name)
? undefined
@@ -113968,7 +115255,7 @@
}
}
// falls through -- object destructuring has an interesting pattern and must be a variable declaration
- case 185 /* ArrayBindingPattern */: {
+ case 186 /* ArrayBindingPattern */: {
/*
import x from "x";
const [a, b, c] = x;
@@ -113979,7 +115266,7 @@
makeConst(/*modifiers*/ undefined, ts.getSynthesizedDeepClone(name), ts.createIdentifier(tmp)),
];
}
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return convertSingleIdentifierImport(file, name, moduleSpecifier, changes, checker, identifiers, quotePreference);
default:
return ts.Debug.assertNever(name);
@@ -114051,11 +115338,11 @@
function isFreeIdentifier(node) {
var parent = node.parent;
switch (parent.kind) {
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return parent.name !== node;
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return parent.propertyName !== node;
- case 253 /* ImportSpecifier */:
+ case 254 /* ImportSpecifier */:
return parent.propertyName !== node;
default:
return true;
@@ -114394,21 +115681,21 @@
function tryAddToExistingImport(existingImports) {
return ts.firstDefined(existingImports, function (_a) {
var declaration = _a.declaration, importKind = _a.importKind;
- if (declaration.kind !== 249 /* ImportDeclaration */)
+ if (declaration.kind !== 250 /* ImportDeclaration */)
return undefined;
var importClause = declaration.importClause;
if (!importClause)
return undefined;
var name = importClause.name, namedBindings = importClause.namedBindings;
- return importKind === 1 /* Default */ && !name || importKind === 0 /* Named */ && (!namedBindings || namedBindings.kind === 252 /* NamedImports */)
+ return importKind === 1 /* Default */ && !name || importKind === 0 /* Named */ && (!namedBindings || namedBindings.kind === 253 /* NamedImports */)
? { kind: 2 /* AddToExisting */, importClause: importClause, importKind: importKind }
: undefined;
});
}
function getNamespaceImportName(declaration) {
- if (declaration.kind === 249 /* ImportDeclaration */) {
+ if (declaration.kind === 250 /* ImportDeclaration */) {
var namedBindings = declaration.importClause && ts.isImportClause(declaration.importClause) && declaration.importClause.namedBindings;
- return namedBindings && namedBindings.kind === 251 /* NamespaceImport */ ? namedBindings.name : undefined;
+ return namedBindings && namedBindings.kind === 252 /* NamespaceImport */ ? namedBindings.name : undefined;
}
else {
return declaration.name;
@@ -114419,7 +115706,7 @@
// Can't use an es6 import for a type in JS.
return exportedSymbolIsTypeOnly && ts.isSourceFileJS(sourceFile) ? ts.emptyArray : ts.mapDefined(sourceFile.imports, function (moduleSpecifier) {
var i = ts.importFromModuleSpecifier(moduleSpecifier);
- return (i.kind === 249 /* ImportDeclaration */ || i.kind === 248 /* ImportEqualsDeclaration */)
+ return (i.kind === 250 /* ImportDeclaration */ || i.kind === 249 /* ImportEqualsDeclaration */)
&& checker.getSymbolAtLocation(moduleSpecifier) === moduleSymbol ? { declaration: i, importKind: importKind } : undefined;
});
}
@@ -114442,9 +115729,9 @@
}
function newImportInfoFromExistingSpecifier(_a) {
var declaration = _a.declaration, importKind = _a.importKind;
- var expression = declaration.kind === 249 /* ImportDeclaration */
+ var expression = declaration.kind === 250 /* ImportDeclaration */
? declaration.moduleSpecifier
- : declaration.moduleReference.kind === 259 /* ExternalModuleReference */
+ : declaration.moduleReference.kind === 260 /* ExternalModuleReference */
? declaration.moduleReference.expression
: undefined;
return expression && ts.isStringLiteral(expression) ? { kind: 3 /* AddNew */, moduleSpecifier: expression.text, importKind: importKind } : undefined;
@@ -114772,12 +116059,12 @@
var checker = context.program.getTypeChecker();
var suggestion;
if (ts.isPropertyAccessExpression(node.parent) && node.parent.name === node) {
- ts.Debug.assert(node.kind === 72 /* Identifier */);
+ ts.Debug.assert(node.kind === 73 /* Identifier */);
var containingType = checker.getTypeAtLocation(node.parent.expression);
suggestion = checker.getSuggestionForNonexistentProperty(node, containingType);
}
else if (ts.isImportSpecifier(node.parent) && node.parent.name === node) {
- ts.Debug.assert(node.kind === 72 /* Identifier */);
+ ts.Debug.assert(node.kind === 73 /* Identifier */);
var importDeclaration = ts.findAncestor(node, ts.isImportDeclaration);
var resolvedSourceFile = getResolvedSourceFileFromImportDeclaration(sourceFile, context, importDeclaration);
if (resolvedSourceFile && resolvedSourceFile.symbol) {
@@ -114840,7 +116127,7 @@
codefix.registerCodeFix({
errorCodes: errorCodes,
getCodeActions: function (context) {
- var info = getInfo(context.sourceFile, context.span.start, context.program.getTypeChecker());
+ var info = getInfo(context.sourceFile, context.span.start, context.program.getTypeChecker(), context.program);
if (!info)
return undefined;
if (info.kind === 0 /* Enum */) {
@@ -114863,7 +116150,7 @@
var typeDeclToMembers = new ts.NodeMap();
return codefix.createCombinedCodeActions(ts.textChanges.ChangeTracker.with(context, function (changes) {
codefix.eachDiagnostic(context, errorCodes, function (diag) {
- var info = getInfo(diag.file, diag.start, checker);
+ var info = getInfo(diag.file, diag.start, checker, context.program);
if (!info || !ts.addToSeen(seen, ts.getNodeId(info.parentDeclaration) + "#" + info.token.text)) {
return;
}
@@ -114931,7 +116218,7 @@
InfoKind[InfoKind["Enum"] = 0] = "Enum";
InfoKind[InfoKind["ClassOrInterface"] = 1] = "ClassOrInterface";
})(InfoKind || (InfoKind = {}));
- function getInfo(tokenSourceFile, tokenPos, checker) {
+ function getInfo(tokenSourceFile, tokenPos, checker, program) {
// The identifier of the missing property. eg:
// this.missing = 1;
// ^^^^^^^
@@ -114948,7 +116235,7 @@
return undefined;
// Prefer to change the class instead of the interface if they are merged
var classOrInterface = ts.find(symbol.declarations, ts.isClassLike) || ts.find(symbol.declarations, ts.isInterfaceDeclaration);
- if (classOrInterface) {
+ if (classOrInterface && !program.isSourceFileFromExternalLibrary(classOrInterface.getSourceFile())) {
var makeStatic = (leftExpressionType.target || leftExpressionType) !== checker.getDeclaredTypeOfSymbol(symbol);
var declSourceFile = classOrInterface.getSourceFile();
var inJs = ts.isSourceFileJS(declSourceFile);
@@ -114956,7 +116243,7 @@
return { kind: 1 /* ClassOrInterface */, token: token, parentDeclaration: classOrInterface, makeStatic: makeStatic, declSourceFile: declSourceFile, inJs: inJs, call: call };
}
var enumDeclaration = ts.find(symbol.declarations, ts.isEnumDeclaration);
- if (enumDeclaration) {
+ if (enumDeclaration && !program.isSourceFileFromExternalLibrary(enumDeclaration.getSourceFile())) {
return { kind: 0 /* Enum */, token: token, parentDeclaration: enumDeclaration };
}
return undefined;
@@ -114968,7 +116255,7 @@
}
function addMissingMemberInJs(changeTracker, declSourceFile, classDeclaration, tokenName, makeStatic) {
if (makeStatic) {
- if (classDeclaration.kind === 209 /* ClassExpression */) {
+ if (classDeclaration.kind === 210 /* ClassExpression */) {
return;
}
var className = classDeclaration.name.getText();
@@ -114994,7 +116281,7 @@
}
function getTypeNode(checker, classDeclaration, token) {
var typeNode;
- if (token.parent.parent.kind === 204 /* BinaryExpression */) {
+ if (token.parent.parent.kind === 205 /* BinaryExpression */) {
var binaryExpression = token.parent.parent;
var otherExpression = token.parent === binaryExpression.left ? binaryExpression.right : binaryExpression.left;
var widenedType = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(otherExpression)));
@@ -115004,7 +116291,7 @@
var contextualType = checker.getContextualType(token.parent);
typeNode = contextualType ? checker.typeToTypeNode(contextualType) : undefined;
}
- return typeNode || ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ return typeNode || ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
function createAddPropertyDeclarationAction(context, declSourceFile, classDeclaration, makeStatic, tokenName, typeNode) {
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addPropertyDeclaration(t, declSourceFile, classDeclaration, tokenName, typeNode, makeStatic); });
@@ -115013,7 +116300,7 @@
function addPropertyDeclaration(changeTracker, declSourceFile, classDeclaration, tokenName, typeNode, makeStatic) {
var property = ts.createProperty(
/*decorators*/ undefined,
- /*modifiers*/ makeStatic ? [ts.createToken(116 /* StaticKeyword */)] : undefined, tokenName,
+ /*modifiers*/ makeStatic ? [ts.createToken(117 /* StaticKeyword */)] : undefined, tokenName,
/*questionToken*/ undefined, typeNode,
/*initializer*/ undefined);
var lastProp = getNodeToInsertPropertyAfter(classDeclaration);
@@ -115037,7 +116324,7 @@
}
function createAddIndexSignatureAction(context, declSourceFile, classDeclaration, tokenName, typeNode) {
// Index signatures cannot have the static modifier.
- var stringTypeNode = ts.createKeywordTypeNode(138 /* StringKeyword */);
+ var stringTypeNode = ts.createKeywordTypeNode(139 /* StringKeyword */);
var indexingParameter = ts.createParameter(
/*decorators*/ undefined,
/*modifiers*/ undefined,
@@ -115057,7 +116344,7 @@
}
function addMethodDeclaration(context, changeTracker, declSourceFile, typeDecl, token, callExpression, makeStatic, inJs, preferences) {
var methodDeclaration = codefix.createMethodFromCallExpression(context, callExpression, token.text, inJs, makeStatic, preferences, typeDecl);
- var containingMethodDeclaration = ts.getAncestor(callExpression, 156 /* MethodDeclaration */);
+ var containingMethodDeclaration = ts.getAncestor(callExpression, 157 /* MethodDeclaration */);
if (containingMethodDeclaration && containingMethodDeclaration.parent === typeDecl) {
changeTracker.insertNodeAfter(declSourceFile, containingMethodDeclaration, methodDeclaration);
}
@@ -115121,7 +116408,6 @@
(function (codefix) {
var fixName = "fixCannotFindModule";
var fixIdInstallTypesPackage = "installTypesPackage";
- var fixIdGenerateTypes = "generateTypes";
var errorCodeCannotFindModule = ts.Diagnostics.Cannot_find_module_0.code;
var errorCodes = [
errorCodeCannotFindModule,
@@ -115136,13 +116422,12 @@
return undefined;
var typesPackageName = getTypesPackageNameToInstall(packageName, host, context.errorCode);
return typesPackageName === undefined
- ? ts.singleElementArray(tryGetGenerateTypesAction(context, packageName))
+ ? []
: [codefix.createCodeFixAction(fixName, /*changes*/ [], [ts.Diagnostics.Install_0, typesPackageName], fixIdInstallTypesPackage, ts.Diagnostics.Install_all_missing_types_packages, getInstallCommand(sourceFile.fileName, typesPackageName))];
},
- fixIds: [fixIdInstallTypesPackage, fixIdGenerateTypes],
+ fixIds: [fixIdInstallTypesPackage],
getAllCodeActions: function (context) {
- var savedTypesDir = null; // tslint:disable-line no-null-keyword
- return codefix.codeFixAll(context, errorCodes, function (changes, diag, commands) {
+ return codefix.codeFixAll(context, errorCodes, function (_changes, diag, commands) {
var packageName = tryGetImportedPackageName(diag.file, diag.start);
if (packageName === undefined)
return undefined;
@@ -115154,96 +116439,12 @@
}
break;
}
- case fixIdGenerateTypes: {
- var typesDir = savedTypesDir !== null ? savedTypesDir : savedTypesDir = getOrCreateTypesDirectory(changes, context);
- var command = typesDir === undefined ? undefined : tryGenerateTypes(typesDir, packageName, context);
- if (command)
- commands.push(command);
- break;
- }
default:
ts.Debug.fail("Bad fixId: " + context.fixId);
}
});
},
});
- function tryGetGenerateTypesAction(context, packageName) {
- var command;
- var changes = ts.textChanges.ChangeTracker.with(context, function (t) {
- var typesDir = getOrCreateTypesDirectory(t, context);
- command = typesDir === undefined ? undefined : tryGenerateTypes(typesDir, packageName, context);
- });
- return command && codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Generate_types_for_0, packageName], fixIdGenerateTypes, ts.Diagnostics.Generate_types_for_all_packages_without_types, command);
- }
- function tryGenerateTypes(typesDir, packageName, context) {
- var file = context.sourceFile.fileName;
- var fileToGenerateTypesFor = ts.tryResolveJSModule(packageName, ts.getDirectoryPath(file), context.host); // TODO: GH#18217
- if (fileToGenerateTypesFor === undefined)
- return undefined;
- var outputFileName = ts.resolvePath(ts.getDirectoryPath(context.program.getCompilerOptions().configFile.fileName), typesDir, packageName + ".d.ts");
- if (context.host.fileExists(outputFileName))
- return undefined;
- return { type: "generate types", file: file, fileToGenerateTypesFor: fileToGenerateTypesFor, outputFileName: outputFileName };
- }
- // If no types directory exists yet, adds it to tsconfig.json
- function getOrCreateTypesDirectory(changes, context) {
- var configFile = context.program.getCompilerOptions().configFile;
- if (!configFile)
- return undefined;
- var tsconfigObjectLiteral = ts.getTsConfigObjectLiteralExpression(configFile);
- if (!tsconfigObjectLiteral)
- return undefined;
- var compilerOptionsProperty = codefix.findJsonProperty(tsconfigObjectLiteral, "compilerOptions");
- if (!compilerOptionsProperty) {
- var newCompilerOptions = ts.createObjectLiteral([makeDefaultBaseUrl(), makeDefaultPaths()]);
- changes.insertNodeAtObjectStart(configFile, tsconfigObjectLiteral, codefix.createJsonPropertyAssignment("compilerOptions", newCompilerOptions));
- return defaultTypesDirectoryName;
- }
- var compilerOptions = compilerOptionsProperty.initializer;
- if (!ts.isObjectLiteralExpression(compilerOptions))
- return defaultTypesDirectoryName;
- var baseUrl = getOrAddBaseUrl(changes, configFile, compilerOptions);
- var typesDirectoryFromPathMapping = getOrAddPathMapping(changes, configFile, compilerOptions);
- return ts.combinePaths(baseUrl, typesDirectoryFromPathMapping);
- }
- var defaultBaseUrl = ".";
- function makeDefaultBaseUrl() {
- return codefix.createJsonPropertyAssignment("baseUrl", ts.createStringLiteral(defaultBaseUrl));
- }
- function getOrAddBaseUrl(changes, tsconfig, compilerOptions) {
- var baseUrlProp = codefix.findJsonProperty(compilerOptions, "baseUrl");
- if (baseUrlProp) {
- return ts.isStringLiteral(baseUrlProp.initializer) ? baseUrlProp.initializer.text : defaultBaseUrl;
- }
- else {
- changes.insertNodeAtObjectStart(tsconfig, compilerOptions, makeDefaultBaseUrl());
- return defaultBaseUrl;
- }
- }
- var defaultTypesDirectoryName = "types";
- function makeDefaultPathMapping() {
- return codefix.createJsonPropertyAssignment("*", ts.createArrayLiteral([ts.createStringLiteral(defaultTypesDirectoryName + "/*")]));
- }
- function makeDefaultPaths() {
- return codefix.createJsonPropertyAssignment("paths", ts.createObjectLiteral([makeDefaultPathMapping()]));
- }
- function getOrAddPathMapping(changes, tsconfig, compilerOptions) {
- var paths = codefix.findJsonProperty(compilerOptions, "paths");
- if (!paths || !ts.isObjectLiteralExpression(paths.initializer)) {
- changes.insertNodeAtObjectStart(tsconfig, compilerOptions, makeDefaultPaths());
- return defaultTypesDirectoryName;
- }
- // Look for an existing path mapping. Should look like `"*": "foo/*"`.
- var existing = ts.firstDefined(paths.initializer.properties, function (prop) {
- return ts.isPropertyAssignment(prop) && ts.isStringLiteral(prop.name) && prop.name.text === "*" && ts.isArrayLiteralExpression(prop.initializer)
- ? ts.firstDefined(prop.initializer.elements, function (value) { return ts.isStringLiteral(value) ? ts.tryRemoveSuffix(value.text, "/*") : undefined; })
- : undefined;
- });
- if (existing)
- return existing;
- changes.insertNodeAtObjectStart(tsconfig, paths.initializer, makeDefaultPathMapping());
- return defaultTypesDirectoryName;
- }
function getInstallCommand(fileName, packageName) {
return { type: "install package", file: fileName, packageName: packageName };
}
@@ -115351,7 +116552,7 @@
}
function getNodes(sourceFile, pos) {
var token = ts.getTokenAtPosition(sourceFile, pos);
- if (token.kind !== 100 /* ThisKeyword */)
+ if (token.kind !== 101 /* ThisKeyword */)
return undefined;
var constructor = ts.getContainingFunction(token);
var superCall = findSuperCall(constructor.body);
@@ -115390,7 +116591,7 @@
});
function getNode(sourceFile, pos) {
var token = ts.getTokenAtPosition(sourceFile, pos);
- ts.Debug.assert(token.kind === 124 /* ConstructorKeyword */);
+ ts.Debug.assert(token.kind === 125 /* ConstructorKeyword */);
return token.parent;
}
function doChange(changes, sourceFile, ctr) {
@@ -115406,7 +116607,7 @@
(function (codefix) {
var fixId = "enableExperimentalDecorators";
var errorCodes = [
- ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning.code
+ ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning.code
];
codefix.registerCodeFix({
errorCodes: errorCodes,
@@ -115415,12 +116616,19 @@
if (configFile === undefined) {
return undefined;
}
- var changes = ts.textChanges.ChangeTracker.with(context, function (changeTracker) { return makeChange(changeTracker, configFile); });
+ var changes = ts.textChanges.ChangeTracker.with(context, function (changeTracker) { return doChange(changeTracker, configFile); });
return [codefix.createCodeFixActionNoFixId(fixId, changes, ts.Diagnostics.Enable_the_experimentalDecorators_option_in_your_configuration_file)];
},
fixIds: [fixId],
+ getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes) {
+ var configFile = context.program.getCompilerOptions().configFile;
+ if (configFile === undefined) {
+ return undefined;
+ }
+ doChange(changes, configFile);
+ }); },
});
- function makeChange(changeTracker, configFile) {
+ function doChange(changeTracker, configFile) {
codefix.setJsonCompilerOptionValue(changeTracker, configFile, "experimentalDecorators", ts.createTrue());
}
})(codefix = ts.codefix || (ts.codefix = {}));
@@ -115454,14 +116662,14 @@
var token = ts.getTokenAtPosition(sourceFile, pos);
var heritageClauses = ts.getContainingClass(token).heritageClauses;
var extendsToken = heritageClauses[0].getFirstToken();
- return extendsToken.kind === 86 /* ExtendsKeyword */ ? { extendsToken: extendsToken, heritageClauses: heritageClauses } : undefined;
+ return extendsToken.kind === 87 /* ExtendsKeyword */ ? { extendsToken: extendsToken, heritageClauses: heritageClauses } : undefined;
}
function doChanges(changes, sourceFile, extendsToken, heritageClauses) {
- changes.replaceNode(sourceFile, extendsToken, ts.createToken(109 /* ImplementsKeyword */));
+ changes.replaceNode(sourceFile, extendsToken, ts.createToken(110 /* ImplementsKeyword */));
// If there is already an implements clause, replace the implements keyword with a comma.
if (heritageClauses.length === 2 &&
- heritageClauses[0].token === 86 /* ExtendsKeyword */ &&
- heritageClauses[1].token === 109 /* ImplementsKeyword */) {
+ heritageClauses[0].token === 87 /* ExtendsKeyword */ &&
+ heritageClauses[1].token === 110 /* ImplementsKeyword */) {
var implementsToken = heritageClauses[1].getFirstToken();
var implementsFullStart = implementsToken.getFullStart();
changes.replaceRange(sourceFile, { pos: implementsFullStart, end: implementsFullStart }, ts.createToken(27 /* CommaToken */));
@@ -115568,7 +116776,7 @@
return [createDeleteFix(delVar, ts.Diagnostics.Remove_variable_statement)];
}
var result = [];
- if (token.kind === 127 /* InferKeyword */) {
+ if (token.kind === 128 /* InferKeyword */) {
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return changeInferToUnknown(t, sourceFile, token); });
var name = ts.cast(token.parent, ts.isInferTypeNode).typeParameter.name.text;
result.push(codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Replace_infer_0_with_unknown, name], fixIdInfer, ts.Diagnostics.Replace_all_unused_infer_with_unknown));
@@ -115600,7 +116808,7 @@
tryPrefixDeclaration(changes, diag.code, sourceFile, token);
break;
case fixIdDelete: {
- if (token.kind === 127 /* InferKeyword */)
+ if (token.kind === 128 /* InferKeyword */)
break; // Can't delete
var importDecl = tryGetFullImport(token);
if (importDecl) {
@@ -115619,7 +116827,7 @@
break;
}
case fixIdInfer:
- if (token.kind === 127 /* InferKeyword */) {
+ if (token.kind === 128 /* InferKeyword */) {
changeInferToUnknown(changes, sourceFile, token);
}
break;
@@ -115630,7 +116838,7 @@
},
});
function changeInferToUnknown(changes, sourceFile, token) {
- changes.replaceNode(sourceFile, token.parent, ts.createKeywordTypeNode(143 /* UnknownKeyword */));
+ changes.replaceNode(sourceFile, token.parent, ts.createKeywordTypeNode(144 /* UnknownKeyword */));
}
function createDeleteFix(changes, diag) {
return codefix.createCodeFixAction(fixName, changes, diag, fixIdDelete, ts.Diagnostics.Delete_all_unused_declarations);
@@ -115640,13 +116848,13 @@
}
// Sometimes the diagnostic span is an entire ImportDeclaration, so we should remove the whole thing.
function tryGetFullImport(token) {
- return token.kind === 92 /* ImportKeyword */ ? ts.tryCast(token.parent, ts.isImportDeclaration) : undefined;
+ return token.kind === 93 /* ImportKeyword */ ? ts.tryCast(token.parent, ts.isImportDeclaration) : undefined;
}
function tryDeleteFullDestructure(token, changes, sourceFile, checker, sourceFiles, isFixAll) {
if (token.kind !== 18 /* OpenBraceToken */ || !ts.isObjectBindingPattern(token.parent))
return false;
var decl = token.parent.parent;
- if (decl.kind === 151 /* Parameter */) {
+ if (decl.kind === 152 /* Parameter */) {
tryDeleteParameter(changes, sourceFile, decl, checker, sourceFiles, isFixAll);
}
else {
@@ -115657,7 +116865,7 @@
function tryDeleteFullVariableStatement(sourceFile, token, changes) {
var declarationList = ts.tryCast(token.parent, ts.isVariableDeclarationList);
if (declarationList && declarationList.getChildren(sourceFile)[0] === token) {
- changes.delete(sourceFile, declarationList.parent.kind === 219 /* VariableStatement */ ? declarationList.parent : declarationList);
+ changes.delete(sourceFile, declarationList.parent.kind === 220 /* VariableStatement */ ? declarationList.parent : declarationList);
return true;
}
return false;
@@ -115666,7 +116874,7 @@
// Don't offer to prefix a property.
if (errorCode === ts.Diagnostics.Property_0_is_declared_but_its_value_is_never_read.code)
return;
- if (token.kind === 127 /* InferKeyword */) {
+ if (token.kind === 128 /* InferKeyword */) {
token = ts.cast(token.parent, ts.isInferTypeNode).typeParameter.name;
}
if (ts.isIdentifier(token) && canPrefix(token)) {
@@ -115675,14 +116883,14 @@
}
function canPrefix(token) {
switch (token.parent.kind) {
- case 151 /* Parameter */:
- case 150 /* TypeParameter */:
+ case 152 /* Parameter */:
+ case 151 /* TypeParameter */:
return true;
- case 237 /* VariableDeclaration */: {
+ case 238 /* VariableDeclaration */: {
var varDecl = token.parent;
switch (varDecl.parent.parent.kind) {
- case 227 /* ForOfStatement */:
- case 226 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 227 /* ForInStatement */:
return true;
}
}
@@ -115729,26 +116937,26 @@
function mayDeleteParameter(p, checker, isFixAll) {
var parent = p.parent;
switch (parent.kind) {
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
// Don't remove a parameter if this overrides something.
var symbol = checker.getSymbolAtLocation(parent.name);
if (ts.isMemberSymbolInBaseType(symbol, checker))
return false;
// falls through
- case 157 /* Constructor */:
- case 239 /* FunctionDeclaration */:
+ case 158 /* Constructor */:
+ case 240 /* FunctionDeclaration */:
return true;
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */: {
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */: {
// Can't remove a non-last parameter in a callback. Can remove a parameter in code-fix-all if future parameters are also unused.
var parameters = parent.parameters;
var index = parameters.indexOf(p);
ts.Debug.assert(index !== -1);
return isFixAll
- ? parameters.slice(index + 1).every(function (p) { return p.name.kind === 72 /* Identifier */ && !p.symbol.isReferenced; })
+ ? parameters.slice(index + 1).every(function (p) { return p.name.kind === 73 /* Identifier */ && !p.symbol.isReferenced; })
: index === parameters.length - 1;
}
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
// Setter must have a parameter
return false;
default:
@@ -115788,7 +116996,7 @@
var container = (ts.isBlock(statement.parent) ? statement.parent : statement).parent;
if (!ts.isBlock(statement.parent) || statement === ts.first(statement.parent.statements)) {
switch (container.kind) {
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
if (container.elseStatement) {
if (ts.isBlock(statement.parent)) {
break;
@@ -115799,15 +117007,15 @@
return;
}
// falls through
- case 224 /* WhileStatement */:
- case 225 /* ForStatement */:
+ case 225 /* WhileStatement */:
+ case 226 /* ForStatement */:
changes.delete(sourceFile, container);
return;
}
}
if (ts.isBlock(statement.parent)) {
- var end_2 = start + length;
- var lastStatement = ts.Debug.assertDefined(lastWhere(ts.sliceAfter(statement.parent.statements, statement), function (s) { return s.pos < end_2; }));
+ var end_3 = start + length;
+ var lastStatement = ts.Debug.assertDefined(lastWhere(ts.sliceAfter(statement.parent.statements, statement), function (s) { return s.pos < end_3; }));
changes.deleteNodeRange(sourceFile, statement, lastStatement);
}
else {
@@ -115873,7 +117081,7 @@
var typeNode = info.typeNode, type = info.type;
var original = typeNode.getText(sourceFile);
var actions = [fix(type, fixIdPlain, ts.Diagnostics.Change_all_jsdoc_style_types_to_TypeScript)];
- if (typeNode.kind === 291 /* JSDocNullableType */) {
+ if (typeNode.kind === 292 /* JSDocNullableType */) {
// for nullable types, suggest the flow-compatible `T | null | undefined`
// in addition to the jsdoc/closure-compatible `T | null`
actions.push(fix(checker.getNullableType(type, 32768 /* Undefined */), fixIdNullable, ts.Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types));
@@ -115893,7 +117101,7 @@
if (!info)
return;
var typeNode = info.typeNode, type = info.type;
- var fixedType = typeNode.kind === 291 /* JSDocNullableType */ && fixId === fixIdNullable ? checker.getNullableType(type, 32768 /* Undefined */) : type;
+ var fixedType = typeNode.kind === 292 /* JSDocNullableType */ && fixId === fixIdNullable ? checker.getNullableType(type, 32768 /* Undefined */) : type;
doChange(changes, sourceFile, typeNode, fixedType, checker);
});
}
@@ -115910,22 +117118,22 @@
// NOTE: Some locations are not handled yet:
// MappedTypeNode.typeParameters and SignatureDeclaration.typeParameters, as well as CallExpression.typeArguments
switch (node.kind) {
- case 212 /* AsExpression */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 239 /* FunctionDeclaration */:
- case 158 /* GetAccessor */:
- case 162 /* IndexSignature */:
- case 181 /* MappedType */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 151 /* Parameter */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 159 /* SetAccessor */:
- case 242 /* TypeAliasDeclaration */:
- case 194 /* TypeAssertionExpression */:
- case 237 /* VariableDeclaration */:
+ case 213 /* AsExpression */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 240 /* FunctionDeclaration */:
+ case 159 /* GetAccessor */:
+ case 163 /* IndexSignature */:
+ case 182 /* MappedType */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 152 /* Parameter */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 160 /* SetAccessor */:
+ case 243 /* TypeAliasDeclaration */:
+ case 195 /* TypeAssertionExpression */:
+ case 238 /* VariableDeclaration */:
return true;
default:
return false;
@@ -115979,14 +117187,14 @@
}
var insertBefore;
switch (containingFunction.kind) {
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
insertBefore = containingFunction.name;
break;
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- insertBefore = ts.findChildOfKind(containingFunction, 90 /* FunctionKeyword */, sourceFile);
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ insertBefore = ts.findChildOfKind(containingFunction, 91 /* FunctionKeyword */, sourceFile);
break;
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
insertBefore = ts.findChildOfKind(containingFunction, 20 /* OpenParenToken */, sourceFile) || ts.first(containingFunction.parameters);
break;
default:
@@ -116001,11 +117209,11 @@
var insertBefore = _a.insertBefore, returnType = _a.returnType;
if (returnType) {
var entityName = ts.getEntityNameFromTypeNode(returnType);
- if (!entityName || entityName.kind !== 72 /* Identifier */ || entityName.text !== "Promise") {
+ if (!entityName || entityName.kind !== 73 /* Identifier */ || entityName.text !== "Promise") {
changes.replaceNode(sourceFile, returnType, ts.createTypeReferenceNode("Promise", ts.createNodeArray([returnType])));
}
}
- changes.insertModifierBefore(sourceFile, 121 /* AsyncKeyword */, insertBefore);
+ changes.insertModifierBefore(sourceFile, 122 /* AsyncKeyword */, insertBefore);
}
})(codefix = ts.codefix || (ts.codefix = {}));
})(ts || (ts = {}));
@@ -116114,17 +117322,17 @@
var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration));
var optional = !!(symbol.flags & 16777216 /* Optional */);
switch (declaration.kind) {
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 153 /* PropertySignature */:
- case 154 /* PropertyDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 154 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
var typeNode = checker.typeToTypeNode(type, enclosingDeclaration, /*flags*/ undefined, getNoopSymbolTrackerWithResolver(context));
out(ts.createProperty(
/*decorators*/ undefined, modifiers, name, optional ? ts.createToken(56 /* QuestionToken */) : undefined, typeNode,
/*initializer*/ undefined));
break;
- case 155 /* MethodSignature */:
- case 156 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
// The signature for the implementation appears as an entry in `signatures` iff
// there is only one signature.
// If there are overloads and an implementation signature, it appears as an
@@ -116165,7 +117373,7 @@
}
function signatureToMethodDeclaration(context, signature, enclosingDeclaration, modifiers, name, optional, body) {
var program = context.program;
- var signatureDeclaration = program.getTypeChecker().signatureToSignatureDeclaration(signature, 156 /* MethodDeclaration */, enclosingDeclaration, 1 /* NoTruncation */ | 256 /* SuppressAnyReturnType */, getNoopSymbolTrackerWithResolver(context));
+ var signatureDeclaration = program.getTypeChecker().signatureToSignatureDeclaration(signature, 157 /* MethodDeclaration */, enclosingDeclaration, 1 /* NoTruncation */ | 256 /* SuppressAnyReturnType */, getNoopSymbolTrackerWithResolver(context));
if (!signatureDeclaration) {
return undefined;
}
@@ -116193,7 +117401,7 @@
var returnType = (inJs || !contextualType) ? undefined : checker.typeToTypeNode(contextualType, contextNode, /*flags*/ undefined, tracker);
return ts.createMethod(
/*decorators*/ undefined,
- /*modifiers*/ makeStatic ? [ts.createToken(116 /* StaticKeyword */)] : undefined,
+ /*modifiers*/ makeStatic ? [ts.createToken(117 /* StaticKeyword */)] : undefined,
/*asteriskToken*/ ts.isYieldExpression(parent) ? ts.createToken(40 /* AsteriskToken */) : undefined, methodName,
/*questionToken*/ undefined,
/*typeParameters*/ inJs ? undefined : ts.map(typeArguments, function (_, i) {
@@ -116212,7 +117420,7 @@
/*dotDotDotToken*/ undefined,
/*name*/ names && names[i] || "arg" + i,
/*questionToken*/ minArgumentCount !== undefined && i >= minArgumentCount ? ts.createToken(56 /* QuestionToken */) : undefined,
- /*type*/ inJs ? undefined : types && types[i] || ts.createKeywordTypeNode(120 /* AnyKeyword */),
+ /*type*/ inJs ? undefined : types && types[i] || ts.createKeywordTypeNode(121 /* AnyKeyword */),
/*initializer*/ undefined);
parameters.push(newParameter);
}
@@ -116240,7 +117448,7 @@
var maxArgsParameterSymbolNames = maxArgsSignature.parameters.map(function (symbol) { return symbol.name; });
var parameters = createDummyParameters(maxNonRestArgs, maxArgsParameterSymbolNames, /* types */ undefined, minArgumentCount, /*inJs*/ false);
if (someSigHasRestParameter) {
- var anyArrayType = ts.createArrayTypeNode(ts.createKeywordTypeNode(120 /* AnyKeyword */));
+ var anyArrayType = ts.createArrayTypeNode(ts.createKeywordTypeNode(121 /* AnyKeyword */));
var restParameter = ts.createParameter(
/*decorators*/ undefined,
/*modifiers*/ undefined, ts.createToken(25 /* DotDotDotToken */), maxArgsParameterSymbolNames[maxNonRestArgs] || "rest",
@@ -116266,10 +117474,10 @@
}
function createVisibilityModifier(flags) {
if (flags & 4 /* Public */) {
- return ts.createToken(115 /* PublicKeyword */);
+ return ts.createToken(116 /* PublicKeyword */);
}
else if (flags & 16 /* Protected */) {
- return ts.createToken(114 /* ProtectedKeyword */);
+ return ts.createToken(115 /* ProtectedKeyword */);
}
return undefined;
}
@@ -116341,7 +117549,7 @@
});
function getActionsForUsageOfInvalidImport(context) {
var sourceFile = context.sourceFile;
- var targetKind = ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures.code === context.errorCode ? 191 /* CallExpression */ : 192 /* NewExpression */;
+ var targetKind = ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures.code === context.errorCode ? 192 /* CallExpression */ : 193 /* NewExpression */;
var node = ts.findAncestor(ts.getTokenAtPosition(sourceFile, context.span.start), function (a) { return a.kind === targetKind && a.getStart() === context.span.start && a.getEnd() === (context.span.start + context.span.length); });
if (!node) {
return [];
@@ -116460,7 +117668,7 @@
return codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Add_undefined_type_to_property_0, propertyDeclaration.name.getText()], fixIdAddUndefinedType, ts.Diagnostics.Add_undefined_type_to_all_uninitialized_properties);
}
function addUndefinedType(changeTracker, propertyDeclarationSourceFile, propertyDeclaration) {
- var undefinedTypeNode = ts.createKeywordTypeNode(141 /* UndefinedKeyword */);
+ var undefinedTypeNode = ts.createKeywordTypeNode(142 /* UndefinedKeyword */);
var type = propertyDeclaration.type; // TODO: GH#18217
var types = ts.isUnionTypeNode(type) ? type.types.concat(undefinedTypeNode) : [type, undefinedTypeNode];
changeTracker.replaceNode(propertyDeclarationSourceFile, type, ts.createUnionTypeNode(types));
@@ -116506,235 +117714,6 @@
}
})(codefix = ts.codefix || (ts.codefix = {}));
})(ts || (ts = {}));
-var ts;
-(function (ts) {
- function generateTypesForModule(name, moduleValue, formatSettings) {
- return generateTypesForModuleOrGlobal(name, moduleValue, formatSettings, 0 /* ExportEquals */);
- }
- ts.generateTypesForModule = generateTypesForModule;
- function generateTypesForGlobal(name, globalValue, formatSettings) {
- return generateTypesForModuleOrGlobal(name, globalValue, formatSettings, 3 /* Global */);
- }
- ts.generateTypesForGlobal = generateTypesForGlobal;
- function generateTypesForModuleOrGlobal(name, globalValue, formatSettings, outputKind) {
- return valueInfoToDeclarationFileText(ts.inspectValue(name, globalValue), formatSettings, outputKind);
- }
- /* @internal */
- function valueInfoToDeclarationFileText(valueInfo, formatSettings, outputKind) {
- if (outputKind === void 0) { outputKind = 0 /* ExportEquals */; }
- return ts.textChanges.getNewFileText(toStatements(valueInfo, outputKind), 3 /* TS */, formatSettings.newLineCharacter || "\n", ts.formatting.getFormatContext(formatSettings));
- }
- ts.valueInfoToDeclarationFileText = valueInfoToDeclarationFileText;
- /* @internal */
- var OutputKind;
- (function (OutputKind) {
- OutputKind[OutputKind["ExportEquals"] = 0] = "ExportEquals";
- OutputKind[OutputKind["NamedExport"] = 1] = "NamedExport";
- OutputKind[OutputKind["NamespaceMember"] = 2] = "NamespaceMember";
- OutputKind[OutputKind["Global"] = 3] = "Global";
- })(OutputKind || (OutputKind = {}));
- function toNamespaceMemberStatements(info) {
- return toStatements(info, 2 /* NamespaceMember */);
- }
- function toStatements(info, kind) {
- var isDefault = info.name === "default" /* Default */;
- var name = isDefault ? "_default" : info.name;
- if (!isValidIdentifier(name) || isDefault && kind !== 1 /* NamedExport */)
- return ts.emptyArray;
- var modifiers = isDefault && info.kind === 2 /* FunctionOrClass */ ? [ts.createModifier(85 /* ExportKeyword */), ts.createModifier(80 /* DefaultKeyword */)]
- : kind === 3 /* Global */ || kind === 0 /* ExportEquals */ ? [ts.createModifier(125 /* DeclareKeyword */)]
- : kind === 1 /* NamedExport */ ? [ts.createModifier(85 /* ExportKeyword */)]
- : undefined;
- var exportEquals = function () { return kind === 0 /* ExportEquals */ ? [exportEqualsOrDefault(info.name, /*isExportEquals*/ true)] : ts.emptyArray; };
- var exportDefault = function () { return isDefault ? [exportEqualsOrDefault("_default", /*isExportEquals*/ false)] : ts.emptyArray; };
- switch (info.kind) {
- case 2 /* FunctionOrClass */:
- return exportEquals().concat(functionOrClassToStatements(modifiers, name, info));
- case 3 /* Object */:
- var members = info.members, hasNontrivialPrototype = info.hasNontrivialPrototype;
- if (!hasNontrivialPrototype) {
- if (kind === 0 /* ExportEquals */) {
- return ts.flatMap(members, function (v) { return toStatements(v, 1 /* NamedExport */); });
- }
- if (members.some(function (m) { return m.kind === 2 /* FunctionOrClass */; })) {
- // If some member is a function, use a namespace so it gets a FunctionDeclaration or ClassDeclaration.
- return exportDefault().concat([createNamespace(modifiers, name, ts.flatMap(members, toNamespaceMemberStatements))]);
- }
- }
- // falls through
- case 0 /* Const */:
- case 1 /* Array */: {
- var comment = info.kind === 0 /* Const */ ? info.comment : undefined;
- var constVar = ts.createVariableStatement(modifiers, ts.createVariableDeclarationList([ts.createVariableDeclaration(name, toType(info))], 2 /* Const */));
- return exportEquals().concat(exportDefault(), [addComment(constVar, comment)]);
- }
- default:
- return ts.Debug.assertNever(info);
- }
- }
- function exportEqualsOrDefault(name, isExportEquals) {
- return ts.createExportAssignment(/*decorators*/ undefined, /*modifiers*/ undefined, isExportEquals, ts.createIdentifier(name));
- }
- function functionOrClassToStatements(modifiers, name, _a) {
- var source = _a.source, prototypeMembers = _a.prototypeMembers, namespaceMembers = _a.namespaceMembers;
- var fnAst = parseClassOrFunctionBody(source);
- var _b = fnAst === undefined ? { parameters: ts.emptyArray, returnType: anyType() } : getParametersAndReturnType(fnAst), parameters = _b.parameters, returnType = _b.returnType;
- var protoOrInstanceMembers = ts.createMap();
- if (typeof fnAst === "object")
- getConstructorFunctionInstanceProperties(fnAst, protoOrInstanceMembers);
- for (var _i = 0, prototypeMembers_1 = prototypeMembers; _i < prototypeMembers_1.length; _i++) {
- var p = prototypeMembers_1[_i];
- // ignore non-functions on the prototype
- if (p.kind === 2 /* FunctionOrClass */) {
- var m = tryGetMethod(p);
- if (m) {
- protoOrInstanceMembers.set(p.name, m);
- }
- }
- }
- var classStaticMembers = protoOrInstanceMembers.size !== 0 || fnAst === undefined || typeof fnAst !== "number" && fnAst.kind === 157 /* Constructor */ ? [] : undefined;
- var namespaceStatements = ts.flatMap(namespaceMembers, function (info) {
- if (!isValidIdentifier(info.name))
- return undefined;
- if (classStaticMembers) {
- switch (info.kind) {
- case 3 /* Object */:
- if (info.members.some(function (m) { return m.kind === 2 /* FunctionOrClass */; })) {
- break;
- }
- // falls through
- case 1 /* Array */:
- case 0 /* Const */:
- classStaticMembers.push(addComment(ts.createProperty(/*decorators*/ undefined, [ts.createModifier(116 /* StaticKeyword */)], info.name, /*questionOrExclamationToken*/ undefined, toType(info), /*initializer*/ undefined), info.kind === 0 /* Const */ ? info.comment : undefined));
- return undefined;
- case 2 /* FunctionOrClass */:
- if (!info.namespaceMembers.length) { // Else, can't merge a static method with a namespace. Must make it a function on the namespace.
- var sig = tryGetMethod(info, [ts.createModifier(116 /* StaticKeyword */)]);
- if (sig) {
- classStaticMembers.push(sig);
- return undefined;
- }
- }
- break;
- default:
- ts.Debug.assertNever(info);
- }
- }
- return toStatements(info, 2 /* NamespaceMember */);
- });
- var decl = classStaticMembers
- ? ts.createClassDeclaration(
- /*decorators*/ undefined, modifiers, name,
- /*typeParameters*/ undefined,
- /*heritageClauses*/ undefined, classStaticMembers.concat((parameters.length ? [ts.createConstructor(/*decorators*/ undefined, /*modifiers*/ undefined, parameters, /*body*/ undefined)] : ts.emptyArray), ts.arrayFrom(protoOrInstanceMembers.values())))
- : ts.createFunctionDeclaration(/*decorators*/ undefined, modifiers, /*asteriskToken*/ undefined, name, /*typeParameters*/ undefined, parameters, returnType, /*body*/ undefined);
- return [decl].concat((namespaceStatements.length === 0 ? ts.emptyArray : [createNamespace(modifiers && modifiers.map(function (m) { return ts.getSynthesizedDeepClone(m); }), name, namespaceStatements)]));
- }
- function tryGetMethod(_a, modifiers) {
- var name = _a.name, source = _a.source;
- if (!isValidIdentifier(name))
- return undefined;
- var fnAst = parseClassOrFunctionBody(source);
- if (fnAst === undefined || (typeof fnAst !== "number" && fnAst.kind === 157 /* Constructor */))
- return undefined;
- var sig = getParametersAndReturnType(fnAst);
- return sig && ts.createMethod(
- /*decorators*/ undefined, modifiers,
- /*asteriskToken*/ undefined, name,
- /*questionToken*/ undefined,
- /*typeParameters*/ undefined, sig.parameters, sig.returnType,
- /*body*/ undefined);
- }
- function toType(info) {
- switch (info.kind) {
- case 0 /* Const */:
- return ts.createTypeReferenceNode(info.typeName, /*typeArguments*/ undefined);
- case 1 /* Array */:
- return ts.createArrayTypeNode(toType(info.inner));
- case 2 /* FunctionOrClass */:
- return ts.createTypeReferenceNode("Function", /*typeArguments*/ undefined); // Normally we create a FunctionDeclaration, but this can happen for a function in an array.
- case 3 /* Object */:
- return ts.createTypeLiteralNode(info.members.map(function (m) { return ts.createPropertySignature(/*modifiers*/ undefined, toPropertyName(m.name), /*questionToken*/ undefined, toType(m), /*initializer*/ undefined); }));
- default:
- return ts.Debug.assertNever(info);
- }
- }
- function toPropertyName(name) {
- return ts.isIdentifierText(name, 7 /* ESNext */) ? ts.createIdentifier(name) : ts.createStringLiteral(name);
- }
- // Parses assignments to "this.x" in the constructor into class property declarations
- function getConstructorFunctionInstanceProperties(fnAst, members) {
- forEachOwnNodeOfFunction(fnAst, function (node) {
- if (ts.isAssignmentExpression(node, /*excludeCompoundAssignment*/ true) &&
- ts.isPropertyAccessExpression(node.left) && node.left.expression.kind === 100 /* ThisKeyword */) {
- var name_4 = node.left.name.text;
- if (!ts.isJsPrivate(name_4)) {
- ts.getOrUpdate(members, name_4, function () { return ts.createProperty(/*decorators*/ undefined, /*modifiers*/ undefined, name_4, /*questionOrExclamationToken*/ undefined, anyType(), /*initializer*/ undefined); });
- }
- }
- });
- }
- function getParametersAndReturnType(fnAst) {
- if (typeof fnAst === "number") {
- return { parameters: ts.fill(fnAst, function (i) { return makeParameter("p" + i, anyType()); }), returnType: anyType() };
- }
- var usedArguments = false, hasReturn = false;
- forEachOwnNodeOfFunction(fnAst, function (node) {
- usedArguments = usedArguments || ts.isIdentifier(node) && node.text === "arguments";
- hasReturn = hasReturn || ts.isReturnStatement(node) && !!node.expression && node.expression.kind !== 200 /* VoidExpression */;
- });
- var parameters = fnAst.parameters.map(function (p) { return makeParameter("" + p.name.getText(), inferParameterType(fnAst, p)); }).concat((usedArguments ? [makeRestParameter()] : ts.emptyArray));
- return { parameters: parameters, returnType: hasReturn ? anyType() : ts.createKeywordTypeNode(106 /* VoidKeyword */) };
- }
- function makeParameter(name, type) {
- return ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, name, /*questionToken*/ undefined, type);
- }
- function makeRestParameter() {
- return ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, ts.createToken(25 /* DotDotDotToken */), "args", /*questionToken*/ undefined, ts.createArrayTypeNode(anyType()));
- }
- /** Returns 'undefined' for class with no declared constructor */
- function parseClassOrFunctionBody(source) {
- if (typeof source === "number")
- return source;
- var classOrFunction = ts.tryCast(parseExpression(source), function (node) { return ts.isFunctionExpression(node) || ts.isArrowFunction(node) || ts.isClassExpression(node); });
- return classOrFunction
- ? ts.isClassExpression(classOrFunction) ? ts.find(classOrFunction.members, ts.isConstructorDeclaration) : classOrFunction
- // If that didn't parse, it's a method `m() {}`. Parse again inside of an object literal.
- : ts.cast(ts.first(ts.cast(parseExpression("{ " + source + " }"), ts.isObjectLiteralExpression).properties), ts.isMethodDeclaration);
- }
- function parseExpression(expr) {
- var text = "const _ = " + expr;
- var srcFile = ts.createSourceFile("test.ts", text, 7 /* Latest */, /*setParentNodes*/ true);
- return ts.first(ts.cast(ts.first(srcFile.statements), ts.isVariableStatement).declarationList.declarations).initializer;
- }
- function inferParameterType(_fn, _param) {
- // TODO: Inspect function body for clues (see inferFromUsage.ts)
- return anyType();
- }
- // Descends through all nodes in a function, but not in nested functions.
- function forEachOwnNodeOfFunction(fnAst, cb) {
- fnAst.body.forEachChild(function recur(node) {
- cb(node);
- if (!ts.isFunctionLike(node))
- node.forEachChild(recur);
- });
- }
- function isValidIdentifier(name) {
- var keyword = ts.stringToToken(name);
- return !(keyword && ts.isNonContextualKeyword(keyword)) && ts.isIdentifierText(name, 7 /* ESNext */);
- }
- function addComment(node, comment) {
- if (comment !== undefined)
- ts.addSyntheticLeadingComment(node, 2 /* SingleLineCommentTrivia */, comment);
- return node;
- }
- function anyType() {
- return ts.createKeywordTypeNode(120 /* AnyKeyword */);
- }
- function createNamespace(modifiers, name, statements) {
- return ts.createModuleDeclaration(/*decorators*/ undefined, modifiers, ts.createIdentifier(name), ts.createModuleBlock(statements), 16 /* Namespace */);
- }
-})(ts || (ts = {}));
/* @internal */
var ts;
(function (ts) {
@@ -116831,8 +117810,8 @@
});
function getImportTypeNode(sourceFile, pos) {
var token = ts.getTokenAtPosition(sourceFile, pos);
- ts.Debug.assert(token.kind === 92 /* ImportKeyword */);
- ts.Debug.assert(token.parent.kind === 183 /* ImportType */);
+ ts.Debug.assert(token.kind === 93 /* ImportKeyword */);
+ ts.Debug.assert(token.parent.kind === 184 /* ImportType */);
return token.parent;
}
function doChange(changes, sourceFile, importType) {
@@ -116884,7 +117863,7 @@
var otherMembers = members.filter(function (member) { return !ts.isIndexSignatureDeclaration(member); });
var parameter = ts.first(indexSignature.parameters);
var mappedTypeParameter = ts.createTypeParameterDeclaration(ts.cast(parameter.name, ts.isIdentifier), parameter.type);
- var mappedIntersectionType = ts.createMappedTypeNode(ts.hasReadonlyModifier(indexSignature) ? ts.createModifier(133 /* ReadonlyKeyword */) : undefined, mappedTypeParameter, indexSignature.questionToken, indexSignature.type);
+ var mappedIntersectionType = ts.createMappedTypeNode(ts.hasReadonlyModifier(indexSignature) ? ts.createModifier(134 /* ReadonlyKeyword */) : undefined, mappedTypeParameter, indexSignature.questionToken, indexSignature.type);
var intersectionType = ts.createIntersectionTypeNode(ts.getAllSuperTypeNodes(container).concat([
mappedIntersectionType
], (otherMembers.length ? [ts.createTypeLiteralNode(otherMembers)] : ts.emptyArray)));
@@ -116931,16 +117910,16 @@
return undefined;
}
switch (exportNode.kind) {
- case 239 /* FunctionDeclaration */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 244 /* ModuleDeclaration */: {
+ case 240 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 245 /* ModuleDeclaration */: {
var node = exportNode;
return node.name && ts.isIdentifier(node.name) ? { exportNode: node, exportName: node.name, wasDefault: wasDefault, exportingModuleSymbol: exportingModuleSymbol } : undefined;
}
- case 219 /* VariableStatement */: {
+ case 220 /* VariableStatement */: {
var vs = exportNode;
// Must be `export const x = something;`.
if (!(vs.declarationList.flags & 2 /* Const */) || vs.declarationList.declarations.length !== 1) {
@@ -116963,17 +117942,17 @@
function changeExport(exportingSourceFile, _a, changes, checker) {
var wasDefault = _a.wasDefault, exportNode = _a.exportNode, exportName = _a.exportName;
if (wasDefault) {
- changes.delete(exportingSourceFile, ts.Debug.assertDefined(ts.findModifier(exportNode, 80 /* DefaultKeyword */)));
+ changes.delete(exportingSourceFile, ts.Debug.assertDefined(ts.findModifier(exportNode, 81 /* DefaultKeyword */)));
}
else {
- var exportKeyword = ts.Debug.assertDefined(ts.findModifier(exportNode, 85 /* ExportKeyword */));
+ var exportKeyword = ts.Debug.assertDefined(ts.findModifier(exportNode, 86 /* ExportKeyword */));
switch (exportNode.kind) {
- case 239 /* FunctionDeclaration */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- changes.insertNodeAfter(exportingSourceFile, exportKeyword, ts.createToken(80 /* DefaultKeyword */));
+ case 240 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ changes.insertNodeAfter(exportingSourceFile, exportKeyword, ts.createToken(81 /* DefaultKeyword */));
break;
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
// If 'x' isn't used in this file, `export const x = 0;` --> `export default 0;`
if (!ts.FindAllReferences.Core.isSymbolReferencedInFile(exportName, checker, exportingSourceFile)) {
// We checked in `getInfo` that an initializer exists.
@@ -116981,9 +117960,9 @@
break;
}
// falls through
- case 243 /* EnumDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 244 /* ModuleDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 245 /* ModuleDeclaration */:
// `export type T = number;` -> `type T = number; export default T;`
changes.deleteModifier(exportingSourceFile, exportKeyword);
changes.insertNodeAfter(exportingSourceFile, exportNode, ts.createExportDefault(ts.createIdentifier(exportName.text)));
@@ -117010,18 +117989,18 @@
function changeDefaultToNamedImport(importingSourceFile, ref, changes, exportName) {
var parent = ref.parent;
switch (parent.kind) {
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
// `a.default` --> `a.foo`
changes.replaceNode(importingSourceFile, ref, ts.createIdentifier(exportName));
break;
- case 253 /* ImportSpecifier */:
- case 257 /* ExportSpecifier */: {
+ case 254 /* ImportSpecifier */:
+ case 258 /* ExportSpecifier */: {
var spec = parent;
// `default as foo` --> `foo`, `default as bar` --> `foo as bar`
changes.replaceNode(importingSourceFile, spec, makeImportSpecifier(exportName, spec.name.text));
break;
}
- case 250 /* ImportClause */: {
+ case 251 /* ImportClause */: {
var clause = parent;
ts.Debug.assert(clause.name === ref);
var spec = makeImportSpecifier(exportName, ref.text);
@@ -117030,7 +118009,7 @@
// `import foo from "./a";` --> `import { foo } from "./a";`
changes.replaceNode(importingSourceFile, ref, ts.createNamedImports([spec]));
}
- else if (namedBindings.kind === 251 /* NamespaceImport */) {
+ else if (namedBindings.kind === 252 /* NamespaceImport */) {
// `import foo, * as a from "./a";` --> `import * as a from ".a/"; import { foo } from "./a";`
changes.deleteRange(importingSourceFile, { pos: ref.getStart(importingSourceFile), end: namedBindings.getStart(importingSourceFile) });
var quotePreference = ts.isStringLiteral(clause.parent.moduleSpecifier) ? ts.quotePreferenceFromString(clause.parent.moduleSpecifier, importingSourceFile) : 1 /* Double */;
@@ -117051,11 +118030,11 @@
function changeNamedToDefaultImport(importingSourceFile, ref, changes) {
var parent = ref.parent;
switch (parent.kind) {
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
// `a.foo` --> `a.default`
changes.replaceNode(importingSourceFile, ref, ts.createIdentifier("default"));
break;
- case 253 /* ImportSpecifier */: {
+ case 254 /* ImportSpecifier */: {
// `import { foo } from "./a";` --> `import foo from "./a";`
// `import { foo as bar } from "./a";` --> `import bar from "./a";`
var defaultImport = ts.createIdentifier(parent.name.text);
@@ -117068,7 +118047,7 @@
}
break;
}
- case 257 /* ExportSpecifier */: {
+ case 258 /* ExportSpecifier */: {
// `export { foo } from "./a";` --> `export { default as foo } from "./a";`
// `export { foo as bar } from "./a";` --> `export { default as bar } from "./a";`
// `export { foo as default } from "./a";` --> `export { default } from "./a";`
@@ -117101,8 +118080,8 @@
var i = getImportToConvert(context);
if (!i)
return ts.emptyArray;
- var description = i.kind === 251 /* NamespaceImport */ ? ts.Diagnostics.Convert_namespace_import_to_named_imports.message : ts.Diagnostics.Convert_named_imports_to_namespace_import.message;
- var actionName = i.kind === 251 /* NamespaceImport */ ? actionNameNamespaceToNamed : actionNameNamedToNamespace;
+ var description = i.kind === 252 /* NamespaceImport */ ? ts.Diagnostics.Convert_namespace_import_to_named_imports.message : ts.Diagnostics.Convert_named_imports_to_namespace_import.message;
+ var actionName = i.kind === 252 /* NamespaceImport */ ? actionNameNamespaceToNamed : actionNameNamedToNamespace;
return [{ name: refactorName, description: description, actions: [{ name: actionName, description: description }] }];
},
getEditsForAction: function (context, actionName) {
@@ -117124,7 +118103,7 @@
}
function doChange(sourceFile, program, changes, toConvert) {
var checker = program.getTypeChecker();
- if (toConvert.kind === 251 /* NamespaceImport */) {
+ if (toConvert.kind === 252 /* NamespaceImport */) {
doChangeNamespaceToNamed(sourceFile, checker, changes, toConvert, ts.getAllowSyntheticDefaultImports(program.getCompilerOptions()));
}
else {
@@ -117176,7 +118155,7 @@
function doChangeNamedToNamespace(sourceFile, checker, changes, toConvert) {
var importDecl = toConvert.parent.parent;
var moduleSpecifier = importDecl.moduleSpecifier;
- var preferredName = moduleSpecifier && ts.isStringLiteral(moduleSpecifier) ? ts.codefix.moduleSpecifierToValidIdentifier(moduleSpecifier.text, 7 /* ESNext */) : "module";
+ var preferredName = moduleSpecifier && ts.isStringLiteral(moduleSpecifier) ? ts.codefix.moduleSpecifierToValidIdentifier(moduleSpecifier.text, 8 /* ESNext */) : "module";
var namespaceNameConflicts = toConvert.elements.some(function (element) {
return ts.FindAllReferences.Core.eachSymbolReferenceInFile(element.name, checker, sourceFile, function (id) {
return !!checker.resolveName(preferredName, id, 67108863 /* All */, /*excludeGlobals*/ true);
@@ -117467,20 +118446,20 @@
function checkForStaticContext(nodeToCheck, containingClass) {
var current = nodeToCheck;
while (current !== containingClass) {
- if (current.kind === 154 /* PropertyDeclaration */) {
+ if (current.kind === 155 /* PropertyDeclaration */) {
if (ts.hasModifier(current, 32 /* Static */)) {
rangeFacts |= RangeFacts.InStaticRegion;
}
break;
}
- else if (current.kind === 151 /* Parameter */) {
+ else if (current.kind === 152 /* Parameter */) {
var ctorOrMethod = ts.getContainingFunction(current);
- if (ctorOrMethod.kind === 157 /* Constructor */) {
+ if (ctorOrMethod.kind === 158 /* Constructor */) {
rangeFacts |= RangeFacts.InStaticRegion;
}
break;
}
- else if (current.kind === 156 /* MethodDeclaration */) {
+ else if (current.kind === 157 /* MethodDeclaration */) {
if (ts.hasModifier(current, 32 /* Static */)) {
rangeFacts |= RangeFacts.InStaticRegion;
}
@@ -117523,7 +118502,7 @@
return true;
}
if (ts.isDeclaration(node)) {
- var declaringNode = (node.kind === 237 /* VariableDeclaration */) ? node.parent.parent : node;
+ var declaringNode = (node.kind === 238 /* VariableDeclaration */) ? node.parent.parent : node;
if (ts.hasModifier(declaringNode, 1 /* Export */)) {
// TODO: GH#18217 Silly to use `errors ||` since it's definitely not defined (see top of `visit`)
// Also, if we're only pushing one error, just use `let error: Diagnostic | undefined`!
@@ -117535,13 +118514,13 @@
}
// Some things can't be extracted in certain situations
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
(errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractImport));
return true;
- case 98 /* SuperKeyword */:
+ case 99 /* SuperKeyword */:
// For a super *constructor call*, we have to be extracting the entire class,
// but a super *method call* simply implies a 'this' reference
- if (node.parent.kind === 191 /* CallExpression */) {
+ if (node.parent.kind === 192 /* CallExpression */) {
// Super constructor call
var containingClass_1 = ts.getContainingClass(node); // TODO:GH#18217
if (containingClass_1.pos < span.start || containingClass_1.end >= (span.start + span.length)) {
@@ -117556,8 +118535,8 @@
}
if (ts.isFunctionLikeDeclaration(node) || ts.isClassLike(node)) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 240 /* ClassDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
if (ts.isSourceFile(node.parent) && node.parent.externalModuleIndicator === undefined) {
// You cannot extract global declarations
(errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.functionWillNotBeVisibleInTheNewScope));
@@ -117569,20 +118548,20 @@
}
var savedPermittedJumps = permittedJumps;
switch (node.kind) {
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
permittedJumps = 0 /* None */;
break;
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
// forbid all jumps inside try blocks
permittedJumps = 0 /* None */;
break;
- case 218 /* Block */:
- if (node.parent && node.parent.kind === 235 /* TryStatement */ && node.parent.finallyBlock === node) {
+ case 219 /* Block */:
+ if (node.parent && node.parent.kind === 236 /* TryStatement */ && node.parent.finallyBlock === node) {
// allow unconditional returns from finally blocks
permittedJumps = 4 /* Return */;
}
break;
- case 271 /* CaseClause */:
+ case 272 /* CaseClause */:
// allow unlabeled break inside case clauses
permittedJumps |= 1 /* Break */;
break;
@@ -117594,19 +118573,19 @@
break;
}
switch (node.kind) {
- case 178 /* ThisType */:
- case 100 /* ThisKeyword */:
+ case 179 /* ThisType */:
+ case 101 /* ThisKeyword */:
rangeFacts |= RangeFacts.UsesThis;
break;
- case 233 /* LabeledStatement */: {
+ case 234 /* LabeledStatement */: {
var label = node.label;
(seenLabels || (seenLabels = [])).push(label.escapedText);
ts.forEachChild(node, visit);
seenLabels.pop();
break;
}
- case 229 /* BreakStatement */:
- case 228 /* ContinueStatement */: {
+ case 230 /* BreakStatement */:
+ case 229 /* ContinueStatement */: {
var label = node.label;
if (label) {
if (!ts.contains(seenLabels, label.escapedText)) {
@@ -117615,20 +118594,20 @@
}
}
else {
- if (!(permittedJumps & (node.kind === 229 /* BreakStatement */ ? 1 /* Break */ : 2 /* Continue */))) {
+ if (!(permittedJumps & (node.kind === 230 /* BreakStatement */ ? 1 /* Break */ : 2 /* Continue */))) {
// attempt to break or continue in a forbidden context
(errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractRangeContainingConditionalBreakOrContinueStatements));
}
}
break;
}
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
rangeFacts |= RangeFacts.IsAsyncFunction;
break;
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
rangeFacts |= RangeFacts.IsGenerator;
break;
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
if (permittedJumps & 4 /* Return */) {
rangeFacts |= RangeFacts.HasReturn;
}
@@ -117682,7 +118661,7 @@
while (true) {
current = current.parent;
// A function parameter's initializer is actually in the outer scope, not the function declaration
- if (current.kind === 151 /* Parameter */) {
+ if (current.kind === 152 /* Parameter */) {
// Skip all the way to the outer scope of the function that declared this parameter
current = ts.findAncestor(current, function (parent) { return ts.isFunctionLikeDeclaration(parent); }).parent;
}
@@ -117693,7 +118672,7 @@
// * Module/namespace or source file
if (isScope(current)) {
scopes.push(current);
- if (current.kind === 284 /* SourceFile */) {
+ if (current.kind === 285 /* SourceFile */) {
return scopes;
}
}
@@ -117783,32 +118762,32 @@
}
function getDescriptionForFunctionLikeDeclaration(scope) {
switch (scope.kind) {
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return "constructor";
- case 196 /* FunctionExpression */:
- case 239 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
return scope.name
? "function '" + scope.name.text + "'"
: "anonymous function";
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return "arrow function";
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return "method '" + scope.name.getText() + "'";
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
return "'get " + scope.name.getText() + "'";
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
return "'set " + scope.name.getText() + "'";
default:
throw ts.Debug.assertNever(scope);
}
}
function getDescriptionForClassLikeDeclaration(scope) {
- return scope.kind === 240 /* ClassDeclaration */
+ return scope.kind === 241 /* ClassDeclaration */
? scope.name ? "class '" + scope.name.text + "'" : "anonymous class declaration"
: scope.name ? "class expression '" + scope.name.text + "'" : "anonymous class expression";
}
function getDescriptionForModuleLikeDeclaration(scope) {
- return scope.kind === 245 /* ModuleBlock */
+ return scope.kind === 246 /* ModuleBlock */
? "namespace '" + scope.parent.name.getText() + "'"
: scope.externalModuleIndicator ? 0 /* Module */ : 1 /* Global */;
}
@@ -117874,12 +118853,12 @@
var newFunction;
if (ts.isClassLike(scope)) {
// always create private method in TypeScript files
- var modifiers = isJS ? [] : [ts.createToken(113 /* PrivateKeyword */)];
+ var modifiers = isJS ? [] : [ts.createToken(114 /* PrivateKeyword */)];
if (range.facts & RangeFacts.InStaticRegion) {
- modifiers.push(ts.createToken(116 /* StaticKeyword */));
+ modifiers.push(ts.createToken(117 /* StaticKeyword */));
}
if (range.facts & RangeFacts.IsAsyncFunction) {
- modifiers.push(ts.createToken(121 /* AsyncKeyword */));
+ modifiers.push(ts.createToken(122 /* AsyncKeyword */));
}
newFunction = ts.createMethod(
/*decorators*/ undefined, modifiers.length ? modifiers : undefined, range.facts & RangeFacts.IsGenerator ? ts.createToken(40 /* AsteriskToken */) : undefined, functionName,
@@ -117887,7 +118866,7 @@
}
else {
newFunction = ts.createFunctionDeclaration(
- /*decorators*/ undefined, range.facts & RangeFacts.IsAsyncFunction ? [ts.createToken(121 /* AsyncKeyword */)] : undefined, range.facts & RangeFacts.IsGenerator ? ts.createToken(40 /* AsteriskToken */) : undefined, functionName, typeParameters, parameters, returnType, body);
+ /*decorators*/ undefined, range.facts & RangeFacts.IsAsyncFunction ? [ts.createToken(122 /* AsyncKeyword */)] : undefined, range.facts & RangeFacts.IsGenerator ? ts.createToken(40 /* AsteriskToken */) : undefined, functionName, typeParameters, parameters, returnType, body);
}
var changeTracker = ts.textChanges.ChangeTracker.fromContext(context);
var minInsertionPos = (isReadonlyArray(range.range) ? ts.last(range.range) : range.range).end;
@@ -118028,9 +119007,9 @@
while (ts.isParenthesizedTypeNode(withoutParens)) {
withoutParens = withoutParens.type;
}
- return ts.isUnionTypeNode(withoutParens) && ts.find(withoutParens.types, function (t) { return t.kind === 141 /* UndefinedKeyword */; })
+ return ts.isUnionTypeNode(withoutParens) && ts.find(withoutParens.types, function (t) { return t.kind === 142 /* UndefinedKeyword */; })
? clone
- : ts.createUnionTypeNode([clone, ts.createKeywordTypeNode(141 /* UndefinedKeyword */)]);
+ : ts.createUnionTypeNode([clone, ts.createKeywordTypeNode(142 /* UndefinedKeyword */)]);
}
}
/**
@@ -118053,11 +119032,11 @@
if (ts.isClassLike(scope)) {
ts.Debug.assert(!isJS); // See CannotExtractToJSClass
var modifiers = [];
- modifiers.push(ts.createToken(113 /* PrivateKeyword */));
+ modifiers.push(ts.createToken(114 /* PrivateKeyword */));
if (rangeFacts & RangeFacts.InStaticRegion) {
- modifiers.push(ts.createToken(116 /* StaticKeyword */));
+ modifiers.push(ts.createToken(117 /* StaticKeyword */));
}
- modifiers.push(ts.createToken(133 /* ReadonlyKeyword */));
+ modifiers.push(ts.createToken(134 /* ReadonlyKeyword */));
var newVariable = ts.createProperty(
/*decorators*/ undefined, modifiers, localNameText,
/*questionToken*/ undefined, variableType, initializer);
@@ -118086,7 +119065,7 @@
var localReference = ts.createIdentifier(localNameText);
changeTracker.replaceNode(context.file, node, localReference);
}
- else if (node.parent.kind === 221 /* ExpressionStatement */ && scope === ts.findAncestor(node, isScope)) {
+ else if (node.parent.kind === 222 /* ExpressionStatement */ && scope === ts.findAncestor(node, isScope)) {
// If the parent is an expression statement and the target scope is the immediately enclosing one,
// replace the statement with the declaration.
var newVariableStatement = ts.createVariableStatement(
@@ -118105,7 +119084,7 @@
changeTracker.insertNodeBefore(context.file, nodeToInsertBefore, newVariableStatement, /*blankLineBetween*/ false);
}
// Consume
- if (node.parent.kind === 221 /* ExpressionStatement */) {
+ if (node.parent.kind === 222 /* ExpressionStatement */) {
// If the parent is an expression statement, delete it.
changeTracker.delete(context.file, node.parent);
}
@@ -118192,7 +119171,7 @@
return { body: ts.createBlock(statements, /*multiLine*/ true), returnValueProperty: undefined };
}
function visitor(node) {
- if (!ignoreReturns && node.kind === 230 /* ReturnStatement */ && hasWritesOrVariableDeclarations) {
+ if (!ignoreReturns && node.kind === 231 /* ReturnStatement */ && hasWritesOrVariableDeclarations) {
var assignments = getPropertyAssignmentsForWritesAndVariableDeclarations(exposedVariableDeclarations, writes);
if (node.expression) {
if (!returnValueProperty) {
@@ -118370,7 +119349,7 @@
var scope = scopes_1[_i];
usagesPerScope.push({ usages: ts.createMap(), typeParameterUsages: ts.createMap(), substitutions: ts.createMap() });
substitutionsPerScope.push(ts.createMap());
- functionErrorsPerScope.push(ts.isFunctionLikeDeclaration(scope) && scope.kind !== 239 /* FunctionDeclaration */
+ functionErrorsPerScope.push(ts.isFunctionLikeDeclaration(scope) && scope.kind !== 240 /* FunctionDeclaration */
? [ts.createDiagnosticForNode(scope, Messages.cannotExtractToOtherFunctionLike)]
: []);
var constantErrors = [];
@@ -118686,30 +119665,30 @@
function isExtractableExpression(node) {
var parent = node.parent;
switch (parent.kind) {
- case 278 /* EnumMember */:
+ case 279 /* EnumMember */:
return false;
}
switch (node.kind) {
case 10 /* StringLiteral */:
- return parent.kind !== 249 /* ImportDeclaration */ &&
- parent.kind !== 253 /* ImportSpecifier */;
- case 208 /* SpreadElement */:
- case 184 /* ObjectBindingPattern */:
- case 186 /* BindingElement */:
- return false;
- case 72 /* Identifier */:
- return parent.kind !== 186 /* BindingElement */ &&
- parent.kind !== 253 /* ImportSpecifier */ &&
- parent.kind !== 257 /* ExportSpecifier */;
+ return parent.kind !== 250 /* ImportDeclaration */ &&
+ parent.kind !== 254 /* ImportSpecifier */;
+ case 209 /* SpreadElement */:
+ case 185 /* ObjectBindingPattern */:
+ case 187 /* BindingElement */:
+ return false;
+ case 73 /* Identifier */:
+ return parent.kind !== 187 /* BindingElement */ &&
+ parent.kind !== 254 /* ImportSpecifier */ &&
+ parent.kind !== 258 /* ExportSpecifier */;
}
return true;
}
function isBlockLike(node) {
switch (node.kind) {
- case 218 /* Block */:
- case 284 /* SourceFile */:
- case 245 /* ModuleBlock */:
- case 271 /* CaseClause */:
+ case 219 /* Block */:
+ case 285 /* SourceFile */:
+ case 246 /* ModuleBlock */:
+ case 272 /* CaseClause */:
return true;
default:
return false;
@@ -118723,6 +119702,136 @@
(function (ts) {
var refactor;
(function (refactor) {
+ var refactorName = "Extract type";
+ var extractToTypeAlias = "Extract to type alias";
+ var extractToTypeDef = "Extract to typedef";
+ refactor.registerRefactor(refactorName, {
+ getAvailableActions: function (context) {
+ var info = getRangeToExtract(context);
+ if (!info)
+ return ts.emptyArray;
+ return [{
+ name: refactorName,
+ description: ts.getLocaleSpecificMessage(ts.Diagnostics.Extract_type),
+ actions: [info.isJS ? {
+ name: extractToTypeDef, description: ts.getLocaleSpecificMessage(ts.Diagnostics.Extract_to_typedef)
+ } : {
+ name: extractToTypeAlias, description: ts.getLocaleSpecificMessage(ts.Diagnostics.Extract_to_type_alias)
+ }]
+ }];
+ },
+ getEditsForAction: function (context, actionName) {
+ ts.Debug.assert(actionName === extractToTypeAlias || actionName === extractToTypeDef);
+ var file = context.file;
+ var info = ts.Debug.assertDefined(getRangeToExtract(context));
+ ts.Debug.assert(actionName === extractToTypeAlias && !info.isJS || actionName === extractToTypeDef && info.isJS);
+ var name = ts.getUniqueName("NewType", file);
+ var edits = ts.textChanges.ChangeTracker.with(context, function (changes) { return info.isJS ?
+ doTypedefChange(changes, file, name, info.firstStatement, info.selection, info.typeParameters) :
+ doTypeAliasChange(changes, file, name, info.firstStatement, info.selection, info.typeParameters); });
+ var renameFilename = file.fileName;
+ var renameLocation = ts.getRenameLocation(edits, renameFilename, name, /*preferLastLocation*/ false);
+ return { edits: edits, renameFilename: renameFilename, renameLocation: renameLocation };
+ }
+ });
+ function getRangeToExtract(context) {
+ var file = context.file, startPosition = context.startPosition;
+ var isJS = ts.isSourceFileJS(file);
+ var current = ts.getTokenAtPosition(file, startPosition);
+ var range = ts.createTextRangeFromSpan(ts.getRefactorContextSpan(context));
+ var selection = ts.findAncestor(current, (function (node) { return node.parent && rangeContainsSkipTrivia(range, node, file) && !rangeContainsSkipTrivia(range, node.parent, file); }));
+ if (!selection || !ts.isTypeNode(selection))
+ return undefined;
+ var checker = context.program.getTypeChecker();
+ var firstStatement = ts.Debug.assertDefined(isJS ? ts.findAncestor(selection, isStatementAndHasJSDoc) : ts.findAncestor(selection, ts.isStatement));
+ var typeParameters = collectTypeParameters(checker, selection, firstStatement, file);
+ if (!typeParameters)
+ return undefined;
+ return { isJS: isJS, selection: selection, firstStatement: firstStatement, typeParameters: typeParameters };
+ }
+ function isStatementAndHasJSDoc(n) {
+ return ts.isStatement(n) && ts.hasJSDocNodes(n);
+ }
+ function rangeContainsSkipTrivia(r1, node, file) {
+ return ts.rangeContainsStartEnd(r1, ts.skipTrivia(file.text, node.pos), node.end);
+ }
+ function collectTypeParameters(checker, selection, statement, file) {
+ var result = [];
+ return visitor(selection) ? undefined : result;
+ function visitor(node) {
+ if (ts.isTypeReferenceNode(node)) {
+ if (ts.isIdentifier(node.typeName)) {
+ var symbol = checker.resolveName(node.typeName.text, node.typeName, 262144 /* TypeParameter */, /* excludeGlobals */ true);
+ if (symbol) {
+ var declaration = ts.cast(ts.first(symbol.declarations), ts.isTypeParameterDeclaration);
+ if (rangeContainsSkipTrivia(statement, declaration, file) && !rangeContainsSkipTrivia(selection, declaration, file)) {
+ result.push(declaration);
+ }
+ }
+ }
+ }
+ else if (ts.isInferTypeNode(node)) {
+ var conditionalTypeNode = ts.findAncestor(node, function (n) { return ts.isConditionalTypeNode(n) && rangeContainsSkipTrivia(n.extendsType, node, file); });
+ if (!conditionalTypeNode || !rangeContainsSkipTrivia(selection, conditionalTypeNode, file)) {
+ return true;
+ }
+ }
+ else if ((ts.isTypePredicateNode(node) || ts.isThisTypeNode(node))) {
+ var functionLikeNode = ts.findAncestor(node.parent, ts.isFunctionLike);
+ if (functionLikeNode && functionLikeNode.type && rangeContainsSkipTrivia(functionLikeNode.type, node, file) && !rangeContainsSkipTrivia(selection, functionLikeNode, file)) {
+ return true;
+ }
+ }
+ else if (ts.isTypeQueryNode(node)) {
+ if (ts.isIdentifier(node.exprName)) {
+ var symbol = checker.resolveName(node.exprName.text, node.exprName, 67220415 /* Value */, /* excludeGlobals */ false);
+ if (symbol && rangeContainsSkipTrivia(statement, symbol.valueDeclaration, file) && !rangeContainsSkipTrivia(selection, symbol.valueDeclaration, file)) {
+ return true;
+ }
+ }
+ else {
+ if (ts.isThisIdentifier(node.exprName.left) && !rangeContainsSkipTrivia(selection, node.parent, file)) {
+ return true;
+ }
+ }
+ }
+ return ts.forEachChild(node, visitor);
+ }
+ }
+ function doTypeAliasChange(changes, file, name, firstStatement, selection, typeParameters) {
+ var newTypeNode = ts.createTypeAliasDeclaration(
+ /* decorators */ undefined,
+ /* modifiers */ undefined, name, typeParameters.map(function (id) { return ts.updateTypeParameterDeclaration(id, id.name, id.constraint, /* defaultType */ undefined); }), selection);
+ changes.insertNodeBefore(file, firstStatement, newTypeNode, /* blankLineBetween */ true);
+ changes.replaceNode(file, selection, ts.createTypeReferenceNode(name, typeParameters.map(function (id) { return ts.createTypeReferenceNode(id.name, /* typeArguments */ undefined); })));
+ }
+ function doTypedefChange(changes, file, name, firstStatement, selection, typeParameters) {
+ var node = ts.createNode(310 /* JSDocTypedefTag */);
+ node.tagName = ts.createIdentifier("typedef"); // TODO: jsdoc factory https://github.com/Microsoft/TypeScript/pull/29539
+ node.fullName = ts.createIdentifier(name);
+ node.name = node.fullName;
+ node.typeExpression = ts.createJSDocTypeExpression(selection);
+ var templates = [];
+ ts.forEach(typeParameters, function (typeParameter) {
+ var constraint = ts.getEffectiveConstraintOfTypeParameter(typeParameter);
+ var template = ts.createNode(309 /* JSDocTemplateTag */);
+ template.tagName = ts.createIdentifier("template");
+ template.constraint = constraint && ts.cast(constraint, ts.isJSDocTypeExpression);
+ var parameter = ts.createNode(151 /* TypeParameter */);
+ parameter.name = typeParameter.name;
+ template.typeParameters = ts.createNodeArray([parameter]);
+ templates.push(template);
+ });
+ changes.insertNodeBefore(file, firstStatement, ts.createJSDocComment(/* comment */ undefined, ts.createNodeArray(ts.concatenate(templates, [node]))), /* blankLineBetween */ true);
+ changes.replaceNode(file, selection, ts.createTypeReferenceNode(name, typeParameters.map(function (id) { return ts.createTypeReferenceNode(id.name, /* typeArguments */ undefined); })));
+ }
+ })(refactor = ts.refactor || (ts.refactor = {}));
+})(ts || (ts = {}));
+/* @internal */
+var ts;
+(function (ts) {
+ var refactor;
+ (function (refactor) {
var generateGetAccessorAndSetAccessor;
(function (generateGetAccessorAndSetAccessor) {
var actionName = "Generate 'get' and 'set' accessors";
@@ -118758,10 +119867,10 @@
var modifierFlags = ts.getModifierFlags(declaration) & ~64 /* Readonly */;
var accessorModifiers = isInClassLike
? !modifierFlags || modifierFlags & 8 /* Private */
- ? getModifiers(isJS, isStatic, 115 /* PublicKeyword */)
+ ? getModifiers(isJS, isStatic, 116 /* PublicKeyword */)
: ts.createNodeArray(ts.createModifiersFromModifierFlags(modifierFlags))
: undefined;
- var fieldModifiers = isInClassLike ? getModifiers(isJS, isStatic, 113 /* PrivateKeyword */) : undefined;
+ var fieldModifiers = isInClassLike ? getModifiers(isJS, isStatic, 114 /* PrivateKeyword */) : undefined;
updateFieldDeclaration(changeTracker, file, declaration, fieldName, fieldModifiers);
var getAccessor = generateGetAccessor(fieldName, accessorName, type, accessorModifiers, isStatic, container);
ts.suppressLeadingAndTrailingTrivia(getAccessor);
@@ -118799,7 +119908,7 @@
return ts.isIdentifier(fieldName) ? ts.createPropertyAccess(leftHead, fieldName) : ts.createElementAccess(leftHead, ts.createLiteral(fieldName));
}
function getModifiers(isJS, isStatic, accessModifier) {
- var modifiers = ts.append(!isJS ? [ts.createToken(accessModifier)] : undefined, isStatic ? ts.createToken(116 /* StaticKeyword */) : undefined);
+ var modifiers = ts.append(!isJS ? [ts.createToken(accessModifier)] : undefined, isStatic ? ts.createToken(117 /* StaticKeyword */) : undefined);
return modifiers && ts.createNodeArray(modifiers);
}
function startsWithUnderscore(name) {
@@ -118822,7 +119931,7 @@
isStatic: ts.hasStaticModifier(declaration),
isReadonly: ts.hasReadonlyModifier(declaration),
type: ts.getTypeAnnotationNode(declaration),
- container: declaration.kind === 151 /* Parameter */ ? declaration.parent.parent : declaration.parent,
+ container: declaration.kind === 152 /* Parameter */ ? declaration.parent.parent : declaration.parent,
originalName: declaration.name.text,
declaration: declaration,
fieldName: fieldName,
@@ -118879,13 +119988,13 @@
return;
constructor.body.forEachChild(function recur(node) {
if (ts.isElementAccessExpression(node) &&
- node.expression.kind === 100 /* ThisKeyword */ &&
+ node.expression.kind === 101 /* ThisKeyword */ &&
ts.isStringLiteral(node.argumentExpression) &&
node.argumentExpression.text === originalName &&
ts.isWriteAccess(node)) {
changeTracker.replaceNode(file, node.argumentExpression, ts.createStringLiteral(fieldName));
}
- if (ts.isPropertyAccessExpression(node) && node.expression.kind === 100 /* ThisKeyword */ && node.name.text === originalName && ts.isWriteAccess(node)) {
+ if (ts.isPropertyAccessExpression(node) && node.expression.kind === 101 /* ThisKeyword */ && node.name.text === originalName && ts.isWriteAccess(node)) {
changeTracker.replaceNode(file, node.name, ts.createIdentifier(fieldName));
}
if (!ts.isFunctionLike(node) && !ts.isClassLike(node)) {
@@ -118967,11 +120076,11 @@
}
function isPureImport(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return true;
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return !ts.hasModifier(node, 1 /* Export */);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return node.declarationList.declarations.every(function (d) { return !!d.initializer && ts.isRequireCall(d.initializer, /*checkArgumentIsStringLiteralLike*/ true); });
default:
return false;
@@ -119059,19 +120168,19 @@
}
function getNamespaceLikeImport(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
- return node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 251 /* NamespaceImport */ ?
+ case 250 /* ImportDeclaration */:
+ return node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 252 /* NamespaceImport */ ?
node.importClause.namedBindings.name : undefined;
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return node.name;
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return ts.tryCast(node.name, ts.isIdentifier);
default:
return ts.Debug.assertNever(node);
}
}
function updateNamespaceLikeImport(changes, sourceFile, checker, movedSymbols, newModuleName, newModuleSpecifier, oldImportId, oldImportNode) {
- var preferredNewNamespaceName = ts.codefix.moduleSpecifierToValidIdentifier(newModuleName, 7 /* ESNext */);
+ var preferredNewNamespaceName = ts.codefix.moduleSpecifierToValidIdentifier(newModuleName, 8 /* ESNext */);
var needUniqueName = false;
var toChange = [];
ts.FindAllReferences.Core.eachSymbolReferenceInFile(oldImportId, checker, sourceFile, function (ref) {
@@ -119095,20 +120204,20 @@
var newNamespaceId = ts.createIdentifier(newNamespaceName);
var newModuleString = ts.createLiteral(newModuleSpecifier);
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return ts.createImportDeclaration(
/*decorators*/ undefined, /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(newNamespaceId)), newModuleString);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return ts.createImportEqualsDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, newNamespaceId, ts.createExternalModuleReference(newModuleString));
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return ts.createVariableDeclaration(newNamespaceId, /*type*/ undefined, createRequireCall(newModuleString));
default:
return ts.Debug.assertNever(node);
}
}
function moduleSpecifierFromImport(i) {
- return (i.kind === 249 /* ImportDeclaration */ ? i.moduleSpecifier
- : i.kind === 248 /* ImportEqualsDeclaration */ ? i.moduleReference.expression
+ return (i.kind === 250 /* ImportDeclaration */ ? i.moduleSpecifier
+ : i.kind === 249 /* ImportEqualsDeclaration */ ? i.moduleReference.expression
: i.initializer.arguments[0]);
}
function forEachImportInStatement(statement, cb) {
@@ -119178,15 +120287,15 @@
}
function deleteUnusedImports(sourceFile, importDecl, changes, isUnused) {
switch (importDecl.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
deleteUnusedImportsInDeclaration(sourceFile, importDecl, changes, isUnused);
break;
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
if (isUnused(importDecl.name)) {
changes.delete(sourceFile, importDecl);
}
break;
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
deleteUnusedImportsInVariableDeclaration(sourceFile, importDecl, changes, isUnused);
break;
default:
@@ -119199,7 +120308,7 @@
var _a = importDecl.importClause, name = _a.name, namedBindings = _a.namedBindings;
var defaultUnused = !name || isUnused(name);
var namedBindingsUnused = !namedBindings ||
- (namedBindings.kind === 251 /* NamespaceImport */ ? isUnused(namedBindings.name) : namedBindings.elements.length !== 0 && namedBindings.elements.every(function (e) { return isUnused(e.name); }));
+ (namedBindings.kind === 252 /* NamespaceImport */ ? isUnused(namedBindings.name) : namedBindings.elements.length !== 0 && namedBindings.elements.every(function (e) { return isUnused(e.name); }));
if (defaultUnused && namedBindingsUnused) {
changes.delete(sourceFile, importDecl);
}
@@ -119211,7 +120320,7 @@
if (namedBindingsUnused) {
changes.delete(sourceFile, namedBindings);
}
- else if (namedBindings.kind === 252 /* NamedImports */) {
+ else if (namedBindings.kind === 253 /* NamedImports */) {
for (var _i = 0, _b = namedBindings.elements; _i < _b.length; _i++) {
var element = _b[_i];
if (isUnused(element.name))
@@ -119224,14 +120333,14 @@
function deleteUnusedImportsInVariableDeclaration(sourceFile, varDecl, changes, isUnused) {
var name = varDecl.name;
switch (name.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
if (isUnused(name)) {
changes.delete(sourceFile, name);
}
break;
- case 185 /* ArrayBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
break;
- case 184 /* ObjectBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
if (name.elements.every(function (e) { return ts.isIdentifier(e.name) && isUnused(e.name); })) {
changes.delete(sourceFile, ts.isVariableDeclarationList(varDecl.parent) && varDecl.parent.declarations.length === 1 ? varDecl.parent.parent : varDecl);
}
@@ -119358,13 +120467,13 @@
// Below should all be utilities
function isInImport(decl) {
switch (decl.kind) {
- case 248 /* ImportEqualsDeclaration */:
- case 253 /* ImportSpecifier */:
- case 250 /* ImportClause */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 254 /* ImportSpecifier */:
+ case 251 /* ImportClause */:
return true;
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return isVariableDeclarationInImport(decl);
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return ts.isVariableDeclaration(decl.parent.parent) && isVariableDeclarationInImport(decl.parent.parent);
default:
return false;
@@ -119376,7 +120485,7 @@
}
function filterImport(i, moduleSpecifier, keep) {
switch (i.kind) {
- case 249 /* ImportDeclaration */: {
+ case 250 /* ImportDeclaration */: {
var clause = i.importClause;
if (!clause)
return undefined;
@@ -119386,9 +120495,9 @@
? ts.createImportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, ts.createImportClause(defaultImport, namedBindings), moduleSpecifier)
: undefined;
}
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return keep(i.name) ? i : undefined;
- case 237 /* VariableDeclaration */: {
+ case 238 /* VariableDeclaration */: {
var name = filterBindingName(i.name, keep);
return name ? makeVariableStatement(name, i.type, createRequireCall(moduleSpecifier), i.parent.flags) : undefined;
}
@@ -119397,7 +120506,7 @@
}
}
function filterNamedBindings(namedBindings, keep) {
- if (namedBindings.kind === 251 /* NamespaceImport */) {
+ if (namedBindings.kind === 252 /* NamespaceImport */) {
return keep(namedBindings.name) ? namedBindings : undefined;
}
else {
@@ -119407,11 +120516,11 @@
}
function filterBindingName(name, keep) {
switch (name.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return keep(name) ? name : undefined;
- case 185 /* ArrayBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
return name;
- case 184 /* ObjectBindingPattern */: {
+ case 185 /* ObjectBindingPattern */: {
// We can't handle nested destructurings or property names well here, so just copy them all.
var newElements = name.elements.filter(function (prop) { return prop.propertyName || !ts.isIdentifier(prop.name) || keep(prop.name); });
return newElements.length ? ts.createObjectBindingPattern(newElements) : undefined;
@@ -119468,13 +120577,13 @@
}
function isNonVariableTopLevelDeclaration(node) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 240 /* ClassDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 243 /* EnumDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return true;
default:
return false;
@@ -119482,17 +120591,17 @@
}
function forEachTopLevelDeclaration(statement, cb) {
switch (statement.kind) {
- case 239 /* FunctionDeclaration */:
- case 240 /* ClassDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 243 /* EnumDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return cb(statement);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return ts.firstDefined(statement.declarationList.declarations, function (decl) { return forEachTopLevelDeclarationInBindingName(decl.name, cb); });
- case 221 /* ExpressionStatement */: {
+ case 222 /* ExpressionStatement */: {
var expression = statement.expression;
return ts.isBinaryExpression(expression) && ts.getAssignmentDeclarationKind(expression) === 1 /* ExportsProperty */
? cb(statement)
@@ -119502,10 +120611,10 @@
}
function forEachTopLevelDeclarationInBindingName(name, cb) {
switch (name.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return cb(ts.cast(name.parent, function (x) { return ts.isVariableDeclaration(x) || ts.isBindingElement(x); }));
- case 185 /* ArrayBindingPattern */:
- case 184 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
return ts.firstDefined(name.elements, function (em) { return ts.isOmittedExpression(em) ? undefined : forEachTopLevelDeclarationInBindingName(em.name, cb); });
default:
return ts.Debug.assertNever(name);
@@ -119516,9 +120625,9 @@
}
function getTopLevelDeclarationStatement(d) {
switch (d.kind) {
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return d.parent.parent;
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return getTopLevelDeclarationStatement(ts.cast(d.parent.parent, function (p) { return ts.isVariableDeclaration(p) || ts.isBindingElement(p); }));
default:
return d;
@@ -119549,25 +120658,25 @@
return useEs6Exports ? [addEs6Export(decl)] : addCommonjsExport(decl);
}
function addEs6Export(d) {
- var modifiers = ts.concatenate([ts.createModifier(85 /* ExportKeyword */)], d.modifiers);
+ var modifiers = ts.concatenate([ts.createModifier(86 /* ExportKeyword */)], d.modifiers);
switch (d.kind) {
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return ts.updateFunctionDeclaration(d, d.decorators, modifiers, d.asteriskToken, d.name, d.typeParameters, d.parameters, d.type, d.body);
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return ts.updateClassDeclaration(d, d.decorators, modifiers, d.name, d.typeParameters, d.heritageClauses, d.members);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return ts.updateVariableStatement(d, modifiers, d.declarationList);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return ts.updateModuleDeclaration(d, d.decorators, modifiers, d.name, d.body);
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return ts.updateEnumDeclaration(d, d.decorators, modifiers, d.name, d.members);
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return ts.updateTypeAliasDeclaration(d, d.decorators, modifiers, d.name, d.typeParameters, d.type);
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
return ts.updateInterfaceDeclaration(d, d.decorators, modifiers, d.name, d.typeParameters, d.heritageClauses, d.members);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return ts.updateImportEqualsDeclaration(d, d.decorators, modifiers, d.name, d.moduleReference);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return ts.Debug.fail(); // Shouldn't try to add 'export' keyword to `exports.x = ...`
default:
return ts.Debug.assertNever(d);
@@ -119578,18 +120687,18 @@
}
function getNamesToExportInCommonJS(decl) {
switch (decl.kind) {
- case 239 /* FunctionDeclaration */:
- case 240 /* ClassDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
return [decl.name.text]; // TODO: GH#18217
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return ts.mapDefined(decl.declarationList.declarations, function (d) { return ts.isIdentifier(d.name) ? d.name.text : undefined; });
- case 244 /* ModuleDeclaration */:
- case 243 /* EnumDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return ts.emptyArray;
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return ts.Debug.fail(); // Shouldn't try to add 'export' keyword to `exports.x = ...`
default:
return ts.Debug.assertNever(decl);
@@ -119597,7 +120706,7 @@
}
/** Creates `exports.x = x;` */
function createExportAssignment(name) {
- return ts.createExpressionStatement(ts.createBinary(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.createIdentifier(name)), 59 /* EqualsToken */, ts.createIdentifier(name)));
+ return ts.createExpressionStatement(ts.createBinary(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.createIdentifier(name)), 60 /* EqualsToken */, ts.createIdentifier(name)));
}
})(refactor = ts.refactor || (ts.refactor = {}));
})(ts || (ts = {}));
@@ -119763,8 +120872,8 @@
function groupReferences(referenceEntries) {
var classReferences = { accessExpressions: [], typeUsages: [] };
var groupedReferences = { functionCalls: [], declarations: [], classReferences: classReferences, valid: true };
- var functionSymbols = ts.map(functionNames, checker.getSymbolAtLocation);
- var classSymbols = ts.map(classNames, checker.getSymbolAtLocation);
+ var functionSymbols = ts.map(functionNames, getSymbolTargetAtLocation);
+ var classSymbols = ts.map(classNames, getSymbolTargetAtLocation);
var isConstructor = ts.isConstructorDeclaration(functionDeclaration);
for (var _i = 0, referenceEntries_1 = referenceEntries; _i < referenceEntries_1.length; _i++) {
var entry = referenceEntries_1[_i];
@@ -119783,7 +120892,11 @@
So we need to add a special case for this because when calling a constructor of a class through one of its subclasses,
the symbols are going to be different.
*/
- if (ts.contains(functionSymbols, checker.getSymbolAtLocation(entry.node), symbolComparer) || ts.isNewExpressionTarget(entry.node)) {
+ if (ts.contains(functionSymbols, getSymbolTargetAtLocation(entry.node)) || ts.isNewExpressionTarget(entry.node)) {
+ var importOrExportReference = entryToImportOrExport(entry);
+ if (importOrExportReference) {
+ continue;
+ }
var decl = entryToDeclaration(entry);
if (decl) {
groupedReferences.declarations.push(decl);
@@ -119796,7 +120909,11 @@
}
}
// if the refactored function is a constructor, we must also check if the references to its class are valid
- if (isConstructor && ts.contains(classSymbols, checker.getSymbolAtLocation(entry.node), symbolComparer)) {
+ if (isConstructor && ts.contains(classSymbols, getSymbolTargetAtLocation(entry.node))) {
+ var importOrExportReference = entryToImportOrExport(entry);
+ if (importOrExportReference) {
+ continue;
+ }
var decl = entryToDeclaration(entry);
if (decl) {
groupedReferences.declarations.push(decl);
@@ -119821,9 +120938,23 @@
}
return groupedReferences;
}
+ function getSymbolTargetAtLocation(node) {
+ var symbol = checker.getSymbolAtLocation(node);
+ return symbol && ts.getSymbolTarget(symbol, checker);
+ }
}
- function symbolComparer(a, b) {
- return ts.getSymbolTarget(a) === ts.getSymbolTarget(b);
+ function entryToImportOrExport(entry) {
+ var node = entry.node;
+ if (ts.isImportSpecifier(node.parent)
+ || ts.isImportClause(node.parent)
+ || ts.isImportEqualsDeclaration(node.parent)
+ || ts.isNamespaceImport(node.parent)) {
+ return node;
+ }
+ if (ts.isExportSpecifier(node.parent) || ts.isExportAssignment(node.parent)) {
+ return node;
+ }
+ return undefined;
}
function entryToDeclaration(entry) {
if (ts.isDeclaration(entry.node.parent)) {
@@ -119836,37 +120967,31 @@
var functionReference = entry.node;
var parent = functionReference.parent;
switch (parent.kind) {
- // Function call (foo(...) or super(...))
- case 191 /* CallExpression */:
- var callExpression = ts.tryCast(parent, ts.isCallExpression);
- if (callExpression && callExpression.expression === functionReference) {
- return callExpression;
- }
- break;
- // Constructor call (new Foo(...))
- case 192 /* NewExpression */:
- var newExpression = ts.tryCast(parent, ts.isNewExpression);
- if (newExpression && newExpression.expression === functionReference) {
- return newExpression;
+ // foo(...) or super(...) or new Foo(...)
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
+ var callOrNewExpression = ts.tryCast(parent, ts.isCallOrNewExpression);
+ if (callOrNewExpression && callOrNewExpression.expression === functionReference) {
+ return callOrNewExpression;
}
break;
- // Method call (x.foo(...))
- case 189 /* PropertyAccessExpression */:
+ // x.foo(...)
+ case 190 /* PropertyAccessExpression */:
var propertyAccessExpression = ts.tryCast(parent, ts.isPropertyAccessExpression);
if (propertyAccessExpression && propertyAccessExpression.parent && propertyAccessExpression.name === functionReference) {
- var callExpression_1 = ts.tryCast(propertyAccessExpression.parent, ts.isCallExpression);
- if (callExpression_1 && callExpression_1.expression === propertyAccessExpression) {
- return callExpression_1;
+ var callOrNewExpression_1 = ts.tryCast(propertyAccessExpression.parent, ts.isCallOrNewExpression);
+ if (callOrNewExpression_1 && callOrNewExpression_1.expression === propertyAccessExpression) {
+ return callOrNewExpression_1;
}
}
break;
- // Method call (x["foo"](...))
- case 190 /* ElementAccessExpression */:
+ // x["foo"](...)
+ case 191 /* ElementAccessExpression */:
var elementAccessExpression = ts.tryCast(parent, ts.isElementAccessExpression);
if (elementAccessExpression && elementAccessExpression.parent && elementAccessExpression.argumentExpression === functionReference) {
- var callExpression_2 = ts.tryCast(elementAccessExpression.parent, ts.isCallExpression);
- if (callExpression_2 && callExpression_2.expression === elementAccessExpression) {
- return callExpression_2;
+ var callOrNewExpression_2 = ts.tryCast(elementAccessExpression.parent, ts.isCallOrNewExpression);
+ if (callOrNewExpression_2 && callOrNewExpression_2.expression === elementAccessExpression) {
+ return callOrNewExpression_2;
}
}
break;
@@ -119880,14 +121005,14 @@
var parent = reference.parent;
switch (parent.kind) {
// `C.foo`
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
var propertyAccessExpression = ts.tryCast(parent, ts.isPropertyAccessExpression);
if (propertyAccessExpression && propertyAccessExpression.expression === reference) {
return propertyAccessExpression;
}
break;
// `C["foo"]`
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
var elementAccessExpression = ts.tryCast(parent, ts.isElementAccessExpression);
if (elementAccessExpression && elementAccessExpression.expression === reference) {
return elementAccessExpression;
@@ -119906,7 +121031,7 @@
}
function getFunctionDeclarationAtPosition(file, startPosition, checker) {
var node = ts.getTouchingToken(file, startPosition);
- var functionDeclaration = ts.getContainingFunction(node);
+ var functionDeclaration = ts.getContainingFunctionDeclaration(node);
// don't offer refactor on top-level JSDoc
if (isTopLevelJSDoc(node))
return undefined;
@@ -119929,28 +121054,34 @@
if (!isValidParameterNodeArray(functionDeclaration.parameters, checker))
return false;
switch (functionDeclaration.kind) {
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
- return !!functionDeclaration.name
- && !!functionDeclaration.body
- && !checker.isImplementationOfOverload(functionDeclaration);
- case 157 /* Constructor */:
+ case 240 /* FunctionDeclaration */:
+ return hasNameOrDefault(functionDeclaration) && isSingleImplementation(functionDeclaration, checker);
+ case 157 /* MethodDeclaration */:
+ return isSingleImplementation(functionDeclaration, checker);
+ case 158 /* Constructor */:
if (ts.isClassDeclaration(functionDeclaration.parent)) {
- return !!functionDeclaration.body
- && !!functionDeclaration.parent.name
- && !checker.isImplementationOfOverload(functionDeclaration);
+ return hasNameOrDefault(functionDeclaration.parent) && isSingleImplementation(functionDeclaration, checker);
}
else {
return isValidVariableDeclaration(functionDeclaration.parent.parent)
- && !!functionDeclaration.body
- && !checker.isImplementationOfOverload(functionDeclaration);
+ && isSingleImplementation(functionDeclaration, checker);
}
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return isValidVariableDeclaration(functionDeclaration.parent);
}
return false;
}
+ function isSingleImplementation(functionDeclaration, checker) {
+ return !!functionDeclaration.body && !checker.isImplementationOfOverload(functionDeclaration);
+ }
+ function hasNameOrDefault(functionOrClassDeclaration) {
+ if (!functionOrClassDeclaration.name) {
+ var defaultKeyword = ts.findModifier(functionOrClassDeclaration, 81 /* DefaultKeyword */);
+ return !!defaultKeyword;
+ }
+ return true;
+ }
function isValidParameterNodeArray(parameters, checker) {
return getRefactorableParametersLength(parameters) >= minimumParameterLength
&& ts.every(parameters, /*callback*/ function (/*callback*/ paramDecl) { return isValidParameterDeclaration(paramDecl, checker); });
@@ -120107,10 +121238,15 @@
}
function getClassNames(constructorDeclaration) {
switch (constructorDeclaration.parent.kind) {
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
var classDeclaration = constructorDeclaration.parent;
+ if (classDeclaration.name)
return [classDeclaration.name];
- case 209 /* ClassExpression */:
+ // If the class declaration doesn't have a name, it should have a default modifier.
+ // We validated this in `isValidFunctionDeclaration` through `hasNameOrDefault`
+ var defaultModifier = ts.Debug.assertDefined(ts.findModifier(classDeclaration, 81 /* DefaultKeyword */), "Nameless class declaration should be a default export");
+ return [defaultModifier];
+ case 210 /* ClassExpression */:
var classExpression = constructorDeclaration.parent;
var variableDeclaration = constructorDeclaration.parent.parent;
var className = classExpression.name;
@@ -120121,19 +121257,25 @@
}
function getFunctionNames(functionDeclaration) {
switch (functionDeclaration.kind) {
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ if (functionDeclaration.name)
return [functionDeclaration.name];
- case 157 /* Constructor */:
- var ctrKeyword = ts.findChildOfKind(functionDeclaration, 124 /* ConstructorKeyword */, functionDeclaration.getSourceFile());
- if (functionDeclaration.parent.kind === 209 /* ClassExpression */) {
+ // If the function declaration doesn't have a name, it should have a default modifier.
+ // We validated this in `isValidFunctionDeclaration` through `hasNameOrDefault`
+ var defaultModifier = ts.Debug.assertDefined(ts.findModifier(functionDeclaration, 81 /* DefaultKeyword */), "Nameless function declaration should be a default export");
+ return [defaultModifier];
+ case 157 /* MethodDeclaration */:
+ return [functionDeclaration.name];
+ case 158 /* Constructor */:
+ var ctrKeyword = ts.Debug.assertDefined(ts.findChildOfKind(functionDeclaration, 125 /* ConstructorKeyword */, functionDeclaration.getSourceFile()), "Constructor declaration should have constructor keyword");
+ if (functionDeclaration.parent.kind === 210 /* ClassExpression */) {
var variableDeclaration = functionDeclaration.parent.parent;
return [variableDeclaration.name, ctrKeyword];
}
return [ctrKeyword];
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return [functionDeclaration.parent.name];
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
if (functionDeclaration.name)
return [functionDeclaration.name, functionDeclaration.parent.name];
return [functionDeclaration.parent.name];
@@ -120150,7 +121292,7 @@
ts.servicesVersion = "0.8";
function createNode(kind, pos, end, parent) {
var node = ts.isNodeKind(kind) ? new NodeObject(kind, pos, end) :
- kind === 72 /* Identifier */ ? new IdentifierObject(72 /* Identifier */, pos, end) :
+ kind === 73 /* Identifier */ ? new IdentifierObject(73 /* Identifier */, pos, end) :
new TokenObject(kind, pos, end);
node.parent = parent;
node.flags = parent.flags & 12679168 /* ContextFlags */;
@@ -120224,8 +121366,8 @@
if (!children.length) {
return undefined;
}
- var child = ts.find(children, function (kid) { return kid.kind < 288 /* FirstJSDocNode */ || kid.kind > 310 /* LastJSDocNode */; });
- return child.kind < 148 /* FirstNode */ ?
+ var child = ts.find(children, function (kid) { return kid.kind < 289 /* FirstJSDocNode */ || kid.kind > 311 /* LastJSDocNode */; });
+ return child.kind < 149 /* FirstNode */ ?
child :
child.getFirstToken(sourceFile);
};
@@ -120236,7 +121378,7 @@
if (!child) {
return undefined;
}
- return child.kind < 148 /* FirstNode */ ? child : child.getLastToken(sourceFile);
+ return child.kind < 149 /* FirstNode */ ? child : child.getLastToken(sourceFile);
};
NodeObject.prototype.forEachChild = function (cbNode, cbNodeArray) {
return ts.forEachChild(this, cbNode, cbNodeArray);
@@ -120282,8 +121424,8 @@
var token = ts.scanner.scan();
var textPos = ts.scanner.getTextPos();
if (textPos <= end) {
- if (token === 72 /* Identifier */) {
- ts.Debug.fail("Did not expect " + ts.Debug.showSyntaxKind(parent) + " to have an Identifier in its trivia");
+ if (token === 73 /* Identifier */) {
+ ts.Debug.fail("Did not expect " + ts.Debug.formatSyntaxKind(parent.kind) + " to have an Identifier in its trivia");
}
nodes.push(createNode(token, pos, textPos, parent));
}
@@ -120294,7 +121436,7 @@
}
}
function createSyntaxList(nodes, parent) {
- var list = createNode(311 /* SyntaxList */, nodes.pos, nodes.end, parent);
+ var list = createNode(312 /* SyntaxList */, nodes.pos, nodes.end, parent);
list._children = [];
var pos = nodes.pos;
for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
@@ -120428,7 +121570,7 @@
});
return IdentifierObject;
}(TokenOrIdentifierObject));
- IdentifierObject.prototype.kind = 72 /* Identifier */;
+ IdentifierObject.prototype.kind = 73 /* Identifier */;
var TypeObject = /** @class */ (function () {
function TypeObject(checker, flags) {
this.checker = checker;
@@ -120629,10 +121771,10 @@
}
function visit(node) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
var functionDeclaration = node;
var declarationName = getDeclarationName(functionDeclaration);
if (declarationName) {
@@ -120652,31 +121794,31 @@
}
ts.forEachChild(node, visit);
break;
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 243 /* EnumDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
- case 257 /* ExportSpecifier */:
- case 253 /* ImportSpecifier */:
- case 250 /* ImportClause */:
- case 251 /* NamespaceImport */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 168 /* TypeLiteral */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 258 /* ExportSpecifier */:
+ case 254 /* ImportSpecifier */:
+ case 251 /* ImportClause */:
+ case 252 /* NamespaceImport */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 169 /* TypeLiteral */:
addDeclaration(node);
ts.forEachChild(node, visit);
break;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
// Only consider parameter properties
if (!ts.hasModifier(node, 92 /* ParameterPropertyModifier */)) {
break;
}
// falls through
- case 237 /* VariableDeclaration */:
- case 186 /* BindingElement */: {
+ case 238 /* VariableDeclaration */:
+ case 187 /* BindingElement */: {
var decl = node;
if (ts.isBindingPattern(decl.name)) {
ts.forEachChild(decl.name, visit);
@@ -120687,19 +121829,19 @@
}
}
// falls through
- case 278 /* EnumMember */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 279 /* EnumMember */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
addDeclaration(node);
break;
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
// Handle named exports case e.g.:
// export {a, b as B} from "mod";
if (node.exportClause) {
ts.forEach(node.exportClause.elements, visit);
}
break;
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
var importClause = node.importClause;
if (importClause) {
// Handle default import case e.g.:
@@ -120711,7 +121853,7 @@
// import * as NS from "mod";
// import {a, b as B} from "mod";
if (importClause.namedBindings) {
- if (importClause.namedBindings.kind === 251 /* NamespaceImport */) {
+ if (importClause.namedBindings.kind === 252 /* NamespaceImport */) {
addDeclaration(importClause.namedBindings);
}
else {
@@ -120720,7 +121862,7 @@
}
}
break;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
if (ts.getAssignmentDeclarationKind(node) !== 0 /* None */) {
addDeclaration(node);
}
@@ -120889,7 +122031,7 @@
var sourceFile;
if (this.currentFileName !== fileName) {
// This is a new file, just parse it
- sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 7 /* Latest */, version, /*setNodeParents*/ true, scriptKind);
+ sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 8 /* Latest */, version, /*setNodeParents*/ true, scriptKind);
}
else if (this.currentFileVersion !== version) {
// This is the same file, just a newer version. Incrementally parse the file.
@@ -121293,41 +122435,48 @@
return undefined;
}
var typeChecker = program.getTypeChecker();
- var symbol = getSymbolAtLocationForQuickInfo(node, typeChecker);
+ var nodeForQuickInfo = getNodeForQuickInfo(node);
+ var symbol = getSymbolAtLocationForQuickInfo(nodeForQuickInfo, typeChecker);
if (!symbol || typeChecker.isUnknownSymbol(symbol)) {
- var type_2 = shouldGetType(sourceFile, node, position) ? typeChecker.getTypeAtLocation(node) : undefined;
+ var type_2 = shouldGetType(sourceFile, nodeForQuickInfo, position) ? typeChecker.getTypeAtLocation(nodeForQuickInfo) : undefined;
return type_2 && {
kind: "" /* unknown */,
kindModifiers: "" /* none */,
- textSpan: ts.createTextSpanFromNode(node, sourceFile),
- displayParts: typeChecker.runWithCancellationToken(cancellationToken, function (typeChecker) { return ts.typeToDisplayParts(typeChecker, type_2, ts.getContainerNode(node)); }),
+ textSpan: ts.createTextSpanFromNode(nodeForQuickInfo, sourceFile),
+ displayParts: typeChecker.runWithCancellationToken(cancellationToken, function (typeChecker) { return ts.typeToDisplayParts(typeChecker, type_2, ts.getContainerNode(nodeForQuickInfo)); }),
documentation: type_2.symbol ? type_2.symbol.getDocumentationComment(typeChecker) : undefined,
tags: type_2.symbol ? type_2.symbol.getJsDocTags() : undefined
};
}
var _a = typeChecker.runWithCancellationToken(cancellationToken, function (typeChecker) {
- return ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, ts.getContainerNode(node), node);
+ return ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, ts.getContainerNode(nodeForQuickInfo), nodeForQuickInfo);
}), symbolKind = _a.symbolKind, displayParts = _a.displayParts, documentation = _a.documentation, tags = _a.tags;
return {
kind: symbolKind,
kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol),
- textSpan: ts.createTextSpanFromNode(node, sourceFile),
+ textSpan: ts.createTextSpanFromNode(nodeForQuickInfo, sourceFile),
displayParts: displayParts,
documentation: documentation,
tags: tags,
};
}
+ function getNodeForQuickInfo(node) {
+ if (ts.isNewExpression(node.parent) && node.pos === node.parent.pos) {
+ return node.parent.expression;
+ }
+ return node;
+ }
function shouldGetType(sourceFile, node, position) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return !ts.isLabelName(node) && !ts.isTagName(node);
- case 189 /* PropertyAccessExpression */:
- case 148 /* QualifiedName */:
+ case 190 /* PropertyAccessExpression */:
+ case 149 /* QualifiedName */:
// Don't return quickInfo if inside the comment in `a/**/.b`
return !ts.isInComment(sourceFile, position);
- case 100 /* ThisKeyword */:
- case 178 /* ThisType */:
- case 98 /* SuperKeyword */:
+ case 101 /* ThisKeyword */:
+ case 179 /* ThisType */:
+ case 99 /* SuperKeyword */:
return true;
default:
return false;
@@ -121434,16 +122583,16 @@
return undefined;
}
switch (node.kind) {
- case 189 /* PropertyAccessExpression */:
- case 148 /* QualifiedName */:
+ case 190 /* PropertyAccessExpression */:
+ case 149 /* QualifiedName */:
case 10 /* StringLiteral */:
- case 87 /* FalseKeyword */:
- case 102 /* TrueKeyword */:
- case 96 /* NullKeyword */:
- case 98 /* SuperKeyword */:
- case 100 /* ThisKeyword */:
- case 178 /* ThisType */:
- case 72 /* Identifier */:
+ case 88 /* FalseKeyword */:
+ case 103 /* TrueKeyword */:
+ case 97 /* NullKeyword */:
+ case 99 /* SuperKeyword */:
+ case 101 /* ThisKeyword */:
+ case 179 /* ThisType */:
+ case 73 /* Identifier */:
break;
// Cant create the text span
default:
@@ -121459,7 +122608,7 @@
// If this is name of a module declarations, check if this is right side of dotted module name
// If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of
// Then this name is name from dotted module
- if (nodeForStartPos.parent.parent.kind === 244 /* ModuleDeclaration */ &&
+ if (nodeForStartPos.parent.parent.kind === 245 /* ModuleDeclaration */ &&
nodeForStartPos.parent.parent.body === nodeForStartPos.parent) {
// Use parent module declarations name for start pos
nodeForStartPos = nodeForStartPos.parent.parent.name;
@@ -121602,30 +122751,14 @@
}
function applyCodeActionCommand(fileName, actionOrFormatSettingsOrUndefined) {
var action = typeof fileName === "string" ? actionOrFormatSettingsOrUndefined : fileName;
- var formatSettings = typeof fileName !== "string" ? actionOrFormatSettingsOrUndefined : undefined;
- return ts.isArray(action) ? Promise.all(action.map(function (a) { return applySingleCodeActionCommand(a, formatSettings); })) : applySingleCodeActionCommand(action, formatSettings);
+ return ts.isArray(action) ? Promise.all(action.map(function (a) { return applySingleCodeActionCommand(a); })) : applySingleCodeActionCommand(action);
}
- function applySingleCodeActionCommand(action, formatSettings) {
+ function applySingleCodeActionCommand(action) {
var getPath = function (path) { return ts.toPath(path, currentDirectory, getCanonicalFileName); };
- switch (action.type) {
- case "install package":
+ ts.Debug.assertEqual(action.type, "install package");
return host.installPackage
? host.installPackage({ fileName: getPath(action.file), packageName: action.packageName })
: Promise.reject("Host does not implement `installPackage`");
- case "generate types": {
- var fileToGenerateTypesFor = action.fileToGenerateTypesFor, outputFileName_1 = action.outputFileName;
- if (!host.inspectValue)
- return Promise.reject("Host does not implement `installPackage`");
- var valueInfoPromise = host.inspectValue({ fileNameToRequire: fileToGenerateTypesFor });
- return valueInfoPromise.then(function (valueInfo) {
- var fullOut = getPath(outputFileName_1);
- host.writeFile(fullOut, ts.valueInfoToDeclarationFileText(valueInfo, formatSettings || ts.testFormatSettings)); // TODO: GH#18217
- return { successMessage: "Wrote types to '" + fullOut + "'" };
- });
- }
- default:
- return ts.Debug.assertNever(action);
- }
}
function getDocCommentTemplateAtPosition(fileName, position) {
return ts.JsDoc.getDocCommentTemplateAtPosition(ts.getNewLineOrDefaultFromHost(host), syntaxTreeCache.getCurrentSourceFile(fileName), position);
@@ -121821,6 +122954,9 @@
preferences: preferences,
};
}
+ function getSmartSelectionRange(fileName, position) {
+ return ts.SmartSelectionRange.getSmartSelectionRange(position, syntaxTreeCache.getCurrentSourceFile(fileName));
+ }
function getApplicableRefactors(fileName, positionOrRange, preferences) {
if (preferences === void 0) { preferences = ts.emptyOptions; }
synchronizeHostData();
@@ -121861,6 +122997,7 @@
getBreakpointStatementAtPosition: getBreakpointStatementAtPosition,
getNavigateToItems: getNavigateToItems,
getRenameInfo: getRenameInfo,
+ getSmartSelectionRange: getSmartSelectionRange,
findRenameLocations: findRenameLocations,
getNavigationBarItems: getNavigationBarItems,
getNavigationTree: getNavigationTree,
@@ -121923,7 +123060,7 @@
*/
function literalIsName(node) {
return ts.isDeclarationName(node) ||
- node.parent.kind === 259 /* ExternalModuleReference */ ||
+ node.parent.kind === 260 /* ExternalModuleReference */ ||
isArgumentOfElementAccessExpression(node) ||
ts.isLiteralComputedPropertyDeclarationName(node);
}
@@ -121940,13 +123077,13 @@
switch (node.kind) {
case 10 /* StringLiteral */:
case 8 /* NumericLiteral */:
- if (node.parent.kind === 149 /* ComputedPropertyName */) {
+ if (node.parent.kind === 150 /* ComputedPropertyName */) {
return ts.isObjectLiteralElement(node.parent.parent) ? node.parent.parent : undefined;
}
// falls through
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return ts.isObjectLiteralElement(node.parent) &&
- (node.parent.parent.kind === 188 /* ObjectLiteralExpression */ || node.parent.parent.kind === 268 /* JsxAttributes */) &&
+ (node.parent.parent.kind === 189 /* ObjectLiteralExpression */ || node.parent.parent.kind === 269 /* JsxAttributes */) &&
node.parent.name === node ? node.parent : undefined;
}
return undefined;
@@ -121988,7 +123125,7 @@
function isArgumentOfElementAccessExpression(node) {
return node &&
node.parent &&
- node.parent.kind === 190 /* ElementAccessExpression */ &&
+ node.parent.kind === 191 /* ElementAccessExpression */ &&
node.parent.argumentExpression === node;
}
/**
@@ -122068,114 +123205,114 @@
if (node) {
var parent = node.parent;
switch (node.kind) {
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
// Span on first variable declaration
return spanInVariableDeclaration(node.declarationList.declarations[0]);
- case 237 /* VariableDeclaration */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 238 /* VariableDeclaration */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
return spanInVariableDeclaration(node);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return spanInParameterDeclaration(node);
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 157 /* Constructor */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 158 /* Constructor */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return spanInFunctionDeclaration(node);
- case 218 /* Block */:
+ case 219 /* Block */:
if (ts.isFunctionBlock(node)) {
return spanInFunctionBlock(node);
}
// falls through
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
return spanInBlock(node);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return spanInBlock(node.block);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
// span on the expression
return textSpan(node.expression);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
// span on return keyword and expression if present
return textSpan(node.getChildAt(0), node.expression);
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
// Span on while(...)
return textSpanEndingAtNextToken(node, node.expression);
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
// span in statement of the do statement
return spanInNode(node.statement);
- case 236 /* DebuggerStatement */:
+ case 237 /* DebuggerStatement */:
// span on debugger keyword
return textSpan(node.getChildAt(0));
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
// set on if(..) span
return textSpanEndingAtNextToken(node, node.expression);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
// span in statement
return spanInNode(node.statement);
- case 229 /* BreakStatement */:
- case 228 /* ContinueStatement */:
+ case 230 /* BreakStatement */:
+ case 229 /* ContinueStatement */:
// On break or continue keyword and label if present
return textSpan(node.getChildAt(0), node.label);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return spanInForStatement(node);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
// span of for (a in ...)
return textSpanEndingAtNextToken(node, node.expression);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
// span in initializer
return spanInInitializerOfForLike(node);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
// span on switch(...)
return textSpanEndingAtNextToken(node, node.expression);
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
// span in first statement of the clause
return spanInNode(node.statements[0]);
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
// span in try block
return spanInBlock(node.tryBlock);
- case 234 /* ThrowStatement */:
+ case 235 /* ThrowStatement */:
// span in throw ...
return textSpan(node, node.expression);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
// span on export = id
return textSpan(node, node.expression);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
// import statement without including semicolon
return textSpan(node, node.moduleReference);
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
// import statement without including semicolon
return textSpan(node, node.moduleSpecifier);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
// import statement without including semicolon
return textSpan(node, node.moduleSpecifier);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
// span on complete module if it is instantiated
if (ts.getModuleInstanceState(node) !== 1 /* Instantiated */) {
return undefined;
}
// falls through
- case 240 /* ClassDeclaration */:
- case 243 /* EnumDeclaration */:
- case 278 /* EnumMember */:
- case 186 /* BindingElement */:
+ case 241 /* ClassDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 279 /* EnumMember */:
+ case 187 /* BindingElement */:
// span on complete node
return textSpan(node);
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
// span in statement
return spanInNode(node.statement);
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
return spanInNodeArray(parent.decorators);
- case 184 /* ObjectBindingPattern */:
- case 185 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
return spanInBindingPattern(node);
// No breakpoint in interface, type alias
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return undefined;
// Tokens:
case 26 /* SemicolonToken */:
@@ -122199,13 +123336,13 @@
case 28 /* LessThanToken */:
return spanInGreaterThanOrLessThanToken(node);
// Keywords:
- case 107 /* WhileKeyword */:
+ case 108 /* WhileKeyword */:
return spanInWhileKeyword(node);
- case 83 /* ElseKeyword */:
- case 75 /* CatchKeyword */:
- case 88 /* FinallyKeyword */:
+ case 84 /* ElseKeyword */:
+ case 76 /* CatchKeyword */:
+ case 89 /* FinallyKeyword */:
return spanInNextNode(node);
- case 147 /* OfKeyword */:
+ case 148 /* OfKeyword */:
return spanInOfKeyword(node);
default:
// Destructuring pattern in destructuring assignment
@@ -122217,14 +123354,14 @@
// Set breakpoint on identifier element of destructuring pattern
// `a` or `...c` or `d: x` from
// `[a, b, ...c]` or `{ a, b }` or `{ d: x }` from destructuring pattern
- if ((node.kind === 72 /* Identifier */ ||
- node.kind === 208 /* SpreadElement */ ||
- node.kind === 275 /* PropertyAssignment */ ||
- node.kind === 276 /* ShorthandPropertyAssignment */) &&
+ if ((node.kind === 73 /* Identifier */ ||
+ node.kind === 209 /* SpreadElement */ ||
+ node.kind === 276 /* PropertyAssignment */ ||
+ node.kind === 277 /* ShorthandPropertyAssignment */) &&
ts.isArrayLiteralOrObjectLiteralDestructuringPattern(parent)) {
return textSpan(node);
}
- if (node.kind === 204 /* BinaryExpression */) {
+ if (node.kind === 205 /* BinaryExpression */) {
var _a = node, left = _a.left, operatorToken = _a.operatorToken;
// Set breakpoint in destructuring pattern if its destructuring assignment
// [a, b, c] or {a, b, c} of
@@ -122233,7 +123370,7 @@
if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(left)) {
return spanInArrayLiteralOrObjectLiteralDestructuringPattern(left);
}
- if (operatorToken.kind === 59 /* EqualsToken */ && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) {
+ if (operatorToken.kind === 60 /* EqualsToken */ && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) {
// Set breakpoint on assignment expression element of destructuring pattern
// a = expression of
// [a = expression, b, c] = someExpression or
@@ -122246,22 +123383,22 @@
}
if (ts.isExpressionNode(node)) {
switch (parent.kind) {
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
// Set span as if on while keyword
return spanInPreviousNode(node);
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
// Set breakpoint on the decorator emit
return spanInNode(node.parent);
- case 225 /* ForStatement */:
- case 227 /* ForOfStatement */:
+ case 226 /* ForStatement */:
+ case 228 /* ForOfStatement */:
return textSpan(node);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
if (node.parent.operatorToken.kind === 27 /* CommaToken */) {
// If this is a comma expression, the breakpoint is possible in this expression
return textSpan(node);
}
break;
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
if (node.parent.body === node) {
// If this is body of arrow function, it is allowed to have the breakpoint
return textSpan(node);
@@ -122270,21 +123407,21 @@
}
}
switch (node.parent.kind) {
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
// If this is name of property assignment, set breakpoint in the initializer
if (node.parent.name === node &&
!ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) {
return spanInNode(node.parent.initializer);
}
break;
- case 194 /* TypeAssertionExpression */:
+ case 195 /* TypeAssertionExpression */:
// Breakpoint in type assertion goes to its operand
if (node.parent.type === node) {
return spanInNextNode(node.parent.type);
}
break;
- case 237 /* VariableDeclaration */:
- case 151 /* Parameter */: {
+ case 238 /* VariableDeclaration */:
+ case 152 /* Parameter */: {
// initializer of variable/parameter declaration go to previous node
var _b = node.parent, initializer = _b.initializer, type = _b.type;
if (initializer === node || type === node || ts.isAssignmentOperator(node.kind)) {
@@ -122292,7 +123429,7 @@
}
break;
}
- case 204 /* BinaryExpression */: {
+ case 205 /* BinaryExpression */: {
var left = node.parent.left;
if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(left) && node !== left) {
// If initializer of destructuring assignment move to previous token
@@ -122322,7 +123459,7 @@
}
function spanInVariableDeclaration(variableDeclaration) {
// If declaration of for in statement, just set the span in parent
- if (variableDeclaration.parent.parent.kind === 226 /* ForInStatement */) {
+ if (variableDeclaration.parent.parent.kind === 227 /* ForInStatement */) {
return spanInNode(variableDeclaration.parent.parent);
}
var parent = variableDeclaration.parent;
@@ -122334,7 +123471,7 @@
// or its declaration from 'for of'
if (variableDeclaration.initializer ||
ts.hasModifier(variableDeclaration, 1 /* Export */) ||
- parent.parent.kind === 227 /* ForOfStatement */) {
+ parent.parent.kind === 228 /* ForOfStatement */) {
return textSpanFromVariableDeclaration(variableDeclaration);
}
if (ts.isVariableDeclarationList(variableDeclaration.parent) &&
@@ -122375,7 +123512,7 @@
}
function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) {
return ts.hasModifier(functionDeclaration, 1 /* Export */) ||
- (functionDeclaration.parent.kind === 240 /* ClassDeclaration */ && functionDeclaration.kind !== 157 /* Constructor */);
+ (functionDeclaration.parent.kind === 241 /* ClassDeclaration */ && functionDeclaration.kind !== 158 /* Constructor */);
}
function spanInFunctionDeclaration(functionDeclaration) {
// No breakpoints in the function signature
@@ -122398,26 +123535,26 @@
}
function spanInBlock(block) {
switch (block.parent.kind) {
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
if (ts.getModuleInstanceState(block.parent) !== 1 /* Instantiated */) {
return undefined;
}
// falls through
// Set on parent if on same line otherwise on first statement
- case 224 /* WhileStatement */:
- case 222 /* IfStatement */:
- case 226 /* ForInStatement */:
+ case 225 /* WhileStatement */:
+ case 223 /* IfStatement */:
+ case 227 /* ForInStatement */:
return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]);
// Set span on previous token if it starts on same line otherwise on the first statement of the block
- case 225 /* ForStatement */:
- case 227 /* ForOfStatement */:
+ case 226 /* ForStatement */:
+ case 228 /* ForOfStatement */:
return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]);
}
// Default action is to set on first statement
return spanInNode(block.statements[0]);
}
function spanInInitializerOfForLike(forLikeStatement) {
- if (forLikeStatement.initializer.kind === 238 /* VariableDeclarationList */) {
+ if (forLikeStatement.initializer.kind === 239 /* VariableDeclarationList */) {
// Declaration list - set breakpoint in first declaration
var variableDeclarationList = forLikeStatement.initializer;
if (variableDeclarationList.declarations.length > 0) {
@@ -122442,21 +123579,21 @@
}
function spanInBindingPattern(bindingPattern) {
// Set breakpoint in first binding element
- var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 210 /* OmittedExpression */ ? element : undefined; });
+ var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 211 /* OmittedExpression */ ? element : undefined; });
if (firstBindingElement) {
return spanInNode(firstBindingElement);
}
// Empty binding pattern of binding element, set breakpoint on binding element
- if (bindingPattern.parent.kind === 186 /* BindingElement */) {
+ if (bindingPattern.parent.kind === 187 /* BindingElement */) {
return textSpan(bindingPattern.parent);
}
// Variable declaration is used as the span
return textSpanFromVariableDeclaration(bindingPattern.parent);
}
function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) {
- ts.Debug.assert(node.kind !== 185 /* ArrayBindingPattern */ && node.kind !== 184 /* ObjectBindingPattern */);
- var elements = node.kind === 187 /* ArrayLiteralExpression */ ? node.elements : node.properties;
- var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 210 /* OmittedExpression */ ? element : undefined; });
+ ts.Debug.assert(node.kind !== 186 /* ArrayBindingPattern */ && node.kind !== 185 /* ObjectBindingPattern */);
+ var elements = node.kind === 188 /* ArrayLiteralExpression */ ? node.elements : node.properties;
+ var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 211 /* OmittedExpression */ ? element : undefined; });
if (firstBindingElement) {
return spanInNode(firstBindingElement);
}
@@ -122464,18 +123601,18 @@
// just nested element in another destructuring assignment
// set breakpoint on assignment when parent is destructuring assignment
// Otherwise set breakpoint for this element
- return textSpan(node.parent.kind === 204 /* BinaryExpression */ ? node.parent : node);
+ return textSpan(node.parent.kind === 205 /* BinaryExpression */ ? node.parent : node);
}
// Tokens:
function spanInOpenBraceToken(node) {
switch (node.parent.kind) {
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
var enumDeclaration = node.parent;
return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile));
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
var classDeclaration = node.parent;
return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile));
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]);
}
// Default to parent node
@@ -122483,25 +123620,25 @@
}
function spanInCloseBraceToken(node) {
switch (node.parent.kind) {
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
// If this is not an instantiated module block, no bp span
if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* Instantiated */) {
return undefined;
}
// falls through
- case 243 /* EnumDeclaration */:
- case 240 /* ClassDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 241 /* ClassDeclaration */:
// Span on close brace token
return textSpan(node);
- case 218 /* Block */:
+ case 219 /* Block */:
if (ts.isFunctionBlock(node.parent)) {
// Span on close brace token
return textSpan(node);
}
// falls through
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return spanInNode(ts.lastOrUndefined(node.parent.statements));
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
// breakpoint in last statement of the last clause
var caseBlock = node.parent;
var lastClause = ts.lastOrUndefined(caseBlock.clauses);
@@ -122509,7 +123646,7 @@
return spanInNode(ts.lastOrUndefined(lastClause.statements));
}
return undefined;
- case 184 /* ObjectBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
// Breakpoint in last binding element or binding pattern if it contains no elements
var bindingPattern = node.parent;
return spanInNode(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern);
@@ -122525,7 +123662,7 @@
}
function spanInCloseBracketToken(node) {
switch (node.parent.kind) {
- case 185 /* ArrayBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
// Breakpoint in last binding element or binding pattern if it contains no elements
var bindingPattern = node.parent;
return textSpan(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern);
@@ -122540,12 +123677,12 @@
}
}
function spanInOpenParenToken(node) {
- if (node.parent.kind === 223 /* DoStatement */ || // Go to while keyword and do action instead
- node.parent.kind === 191 /* CallExpression */ ||
- node.parent.kind === 192 /* NewExpression */) {
+ if (node.parent.kind === 224 /* DoStatement */ || // Go to while keyword and do action instead
+ node.parent.kind === 192 /* CallExpression */ ||
+ node.parent.kind === 193 /* NewExpression */) {
return spanInPreviousNode(node);
}
- if (node.parent.kind === 195 /* ParenthesizedExpression */) {
+ if (node.parent.kind === 196 /* ParenthesizedExpression */) {
return spanInNextNode(node);
}
// Default to parent node
@@ -122554,21 +123691,21 @@
function spanInCloseParenToken(node) {
// Is this close paren token of parameter list, set span in previous token
switch (node.parent.kind) {
- case 196 /* FunctionExpression */:
- case 239 /* FunctionDeclaration */:
- case 197 /* ArrowFunction */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 157 /* Constructor */:
- case 224 /* WhileStatement */:
- case 223 /* DoStatement */:
- case 225 /* ForStatement */:
- case 227 /* ForOfStatement */:
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
- case 195 /* ParenthesizedExpression */:
+ case 197 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
+ case 198 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 158 /* Constructor */:
+ case 225 /* WhileStatement */:
+ case 224 /* DoStatement */:
+ case 226 /* ForStatement */:
+ case 228 /* ForOfStatement */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
+ case 196 /* ParenthesizedExpression */:
return spanInPreviousNode(node);
// Default to parent node
default:
@@ -122578,20 +123715,20 @@
function spanInColonToken(node) {
// Is this : specifying return annotation of the function declaration
if (ts.isFunctionLike(node.parent) ||
- node.parent.kind === 275 /* PropertyAssignment */ ||
- node.parent.kind === 151 /* Parameter */) {
+ node.parent.kind === 276 /* PropertyAssignment */ ||
+ node.parent.kind === 152 /* Parameter */) {
return spanInPreviousNode(node);
}
return spanInNode(node.parent);
}
function spanInGreaterThanOrLessThanToken(node) {
- if (node.parent.kind === 194 /* TypeAssertionExpression */) {
+ if (node.parent.kind === 195 /* TypeAssertionExpression */) {
return spanInNextNode(node);
}
return spanInNode(node.parent);
}
function spanInWhileKeyword(node) {
- if (node.parent.kind === 223 /* DoStatement */) {
+ if (node.parent.kind === 224 /* DoStatement */) {
// Set span on while expression
return textSpanEndingAtNextToken(node, node.parent.expression);
}
@@ -122599,7 +123736,7 @@
return spanInNode(node.parent);
}
function spanInOfKeyword(node) {
- if (node.parent.kind === 227 /* ForOfStatement */) {
+ if (node.parent.kind === 228 /* ForOfStatement */) {
// Set using next token
return spanInNextNode(node);
}
@@ -123068,6 +124205,10 @@
var _this = this;
return this.forwardJSONCall("getRenameInfo('" + fileName + "', " + position + ")", function () { return _this.languageService.getRenameInfo(fileName, position, options); });
};
+ LanguageServiceShimObject.prototype.getSmartSelectionRange = function (fileName, position) {
+ var _this = this;
+ return this.forwardJSONCall("getSmartSelectionRange('" + fileName + "', " + position + ")", function () { return _this.languageService.getSmartSelectionRange(fileName, position); });
+ };
LanguageServiceShimObject.prototype.findRenameLocations = function (fileName, position, findInStrings, findInComments, providePrefixAndSuffixTextForRename) {
var _this = this;
return this.forwardJSONCall("findRenameLocations('" + fileName + "', " + position + ", " + findInStrings + ", " + findInComments + ", " + providePrefixAndSuffixTextForRename + ")", function () { return _this.languageService.findRenameLocations(fileName, position, findInStrings, findInComments, providePrefixAndSuffixTextForRename); });

lib/typescriptServices.d.ts

@@ -14,7 +14,7 @@
***************************************************************************** */
declare namespace ts {
- const versionMajorMinor = "3.4";
+ const versionMajorMinor = "3.5";
/** The version of the TypeScript compiler release */
const version: string;
}
@@ -72,7 +72,7 @@
pos: number;
end: number;
}
- type JsDocSyntaxKind = SyntaxKind.EndOfFileToken | SyntaxKind.WhitespaceTrivia | SyntaxKind.AtToken | SyntaxKind.NewLineTrivia | SyntaxKind.AsteriskToken | SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.LessThanToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.EqualsToken | SyntaxKind.CommaToken | SyntaxKind.DotToken | SyntaxKind.Identifier | SyntaxKind.NoSubstitutionTemplateLiteral | SyntaxKind.Unknown | KeywordSyntaxKind;
+ type JSDocSyntaxKind = SyntaxKind.EndOfFileToken | SyntaxKind.WhitespaceTrivia | SyntaxKind.AtToken | SyntaxKind.NewLineTrivia | SyntaxKind.AsteriskToken | SyntaxKind.OpenBraceToken | SyntaxKind.CloseBraceToken | SyntaxKind.LessThanToken | SyntaxKind.OpenBracketToken | SyntaxKind.CloseBracketToken | SyntaxKind.EqualsToken | SyntaxKind.CommaToken | SyntaxKind.DotToken | SyntaxKind.Identifier | SyntaxKind.BacktickToken | SyntaxKind.Unknown | KeywordSyntaxKind;
type KeywordSyntaxKind = SyntaxKind.AbstractKeyword | SyntaxKind.AnyKeyword | SyntaxKind.AsKeyword | SyntaxKind.BigIntKeyword | SyntaxKind.BooleanKeyword | SyntaxKind.BreakKeyword | SyntaxKind.CaseKeyword | SyntaxKind.CatchKeyword | SyntaxKind.ClassKeyword | SyntaxKind.ContinueKeyword | SyntaxKind.ConstKeyword | SyntaxKind.ConstructorKeyword | SyntaxKind.DebuggerKeyword | SyntaxKind.DeclareKeyword | SyntaxKind.DefaultKeyword | SyntaxKind.DeleteKeyword | SyntaxKind.DoKeyword | SyntaxKind.ElseKeyword | SyntaxKind.EnumKeyword | SyntaxKind.ExportKeyword | SyntaxKind.ExtendsKeyword | SyntaxKind.FalseKeyword | SyntaxKind.FinallyKeyword | SyntaxKind.ForKeyword | SyntaxKind.FromKeyword | SyntaxKind.FunctionKeyword | SyntaxKind.GetKeyword | SyntaxKind.IfKeyword | SyntaxKind.ImplementsKeyword | SyntaxKind.ImportKeyword | SyntaxKind.InKeyword | SyntaxKind.InferKeyword | SyntaxKind.InstanceOfKeyword | SyntaxKind.InterfaceKeyword | SyntaxKind.IsKeyword | SyntaxKind.KeyOfKeyword | SyntaxKind.LetKeyword | SyntaxKind.ModuleKeyword | SyntaxKind.NamespaceKeyword | SyntaxKind.NeverKeyword | SyntaxKind.NewKeyword | SyntaxKind.NullKeyword | SyntaxKind.NumberKeyword | SyntaxKind.ObjectKeyword | SyntaxKind.PackageKeyword | SyntaxKind.PrivateKeyword | SyntaxKind.ProtectedKeyword | SyntaxKind.PublicKeyword | SyntaxKind.ReadonlyKeyword | SyntaxKind.RequireKeyword | SyntaxKind.GlobalKeyword | SyntaxKind.ReturnKeyword | SyntaxKind.SetKeyword | SyntaxKind.StaticKeyword | SyntaxKind.StringKeyword | SyntaxKind.SuperKeyword | SyntaxKind.SwitchKeyword | SyntaxKind.SymbolKeyword | SyntaxKind.ThisKeyword | SyntaxKind.ThrowKeyword | SyntaxKind.TrueKeyword | SyntaxKind.TryKeyword | SyntaxKind.TypeKeyword | SyntaxKind.TypeOfKeyword | SyntaxKind.UndefinedKeyword | SyntaxKind.UniqueKeyword | SyntaxKind.UnknownKeyword | SyntaxKind.VarKeyword | SyntaxKind.VoidKeyword | SyntaxKind.WhileKeyword | SyntaxKind.WithKeyword | SyntaxKind.YieldKeyword | SyntaxKind.AsyncKeyword | SyntaxKind.AwaitKeyword | SyntaxKind.OfKeyword;
type JsxTokenSyntaxKind = SyntaxKind.LessThanSlashToken | SyntaxKind.EndOfFileToken | SyntaxKind.ConflictMarkerTrivia | SyntaxKind.JsxText | SyntaxKind.JsxTextAllWhiteSpaces | SyntaxKind.OpenBraceToken | SyntaxKind.LessThanToken;
enum SyntaxKind {
@@ -135,281 +135,283 @@
QuestionToken = 56,
ColonToken = 57,
AtToken = 58,
- EqualsToken = 59,
- PlusEqualsToken = 60,
- MinusEqualsToken = 61,
- AsteriskEqualsToken = 62,
- AsteriskAsteriskEqualsToken = 63,
- SlashEqualsToken = 64,
- PercentEqualsToken = 65,
- LessThanLessThanEqualsToken = 66,
- GreaterThanGreaterThanEqualsToken = 67,
- GreaterThanGreaterThanGreaterThanEqualsToken = 68,
- AmpersandEqualsToken = 69,
- BarEqualsToken = 70,
- CaretEqualsToken = 71,
- Identifier = 72,
- BreakKeyword = 73,
- CaseKeyword = 74,
- CatchKeyword = 75,
- ClassKeyword = 76,
- ConstKeyword = 77,
- ContinueKeyword = 78,
- DebuggerKeyword = 79,
- DefaultKeyword = 80,
- DeleteKeyword = 81,
- DoKeyword = 82,
- ElseKeyword = 83,
- EnumKeyword = 84,
- ExportKeyword = 85,
- ExtendsKeyword = 86,
- FalseKeyword = 87,
- FinallyKeyword = 88,
- ForKeyword = 89,
- FunctionKeyword = 90,
- IfKeyword = 91,
- ImportKeyword = 92,
- InKeyword = 93,
- InstanceOfKeyword = 94,
- NewKeyword = 95,
- NullKeyword = 96,
- ReturnKeyword = 97,
- SuperKeyword = 98,
- SwitchKeyword = 99,
- ThisKeyword = 100,
- ThrowKeyword = 101,
- TrueKeyword = 102,
- TryKeyword = 103,
- TypeOfKeyword = 104,
- VarKeyword = 105,
- VoidKeyword = 106,
- WhileKeyword = 107,
- WithKeyword = 108,
- ImplementsKeyword = 109,
- InterfaceKeyword = 110,
- LetKeyword = 111,
- PackageKeyword = 112,
- PrivateKeyword = 113,
- ProtectedKeyword = 114,
- PublicKeyword = 115,
- StaticKeyword = 116,
- YieldKeyword = 117,
- AbstractKeyword = 118,
- AsKeyword = 119,
- AnyKeyword = 120,
- AsyncKeyword = 121,
- AwaitKeyword = 122,
- BooleanKeyword = 123,
- ConstructorKeyword = 124,
- DeclareKeyword = 125,
- GetKeyword = 126,
- InferKeyword = 127,
- IsKeyword = 128,
- KeyOfKeyword = 129,
- ModuleKeyword = 130,
- NamespaceKeyword = 131,
- NeverKeyword = 132,
- ReadonlyKeyword = 133,
- RequireKeyword = 134,
- NumberKeyword = 135,
- ObjectKeyword = 136,
- SetKeyword = 137,
- StringKeyword = 138,
- SymbolKeyword = 139,
- TypeKeyword = 140,
- UndefinedKeyword = 141,
- UniqueKeyword = 142,
- UnknownKeyword = 143,
- FromKeyword = 144,
- GlobalKeyword = 145,
- BigIntKeyword = 146,
- OfKeyword = 147,
- QualifiedName = 148,
- ComputedPropertyName = 149,
- TypeParameter = 150,
- Parameter = 151,
- Decorator = 152,
- PropertySignature = 153,
- PropertyDeclaration = 154,
- MethodSignature = 155,
- MethodDeclaration = 156,
- Constructor = 157,
- GetAccessor = 158,
- SetAccessor = 159,
- CallSignature = 160,
- ConstructSignature = 161,
- IndexSignature = 162,
- TypePredicate = 163,
- TypeReference = 164,
- FunctionType = 165,
- ConstructorType = 166,
- TypeQuery = 167,
- TypeLiteral = 168,
- ArrayType = 169,
- TupleType = 170,
- OptionalType = 171,
- RestType = 172,
- UnionType = 173,
- IntersectionType = 174,
- ConditionalType = 175,
- InferType = 176,
- ParenthesizedType = 177,
- ThisType = 178,
- TypeOperator = 179,
- IndexedAccessType = 180,
- MappedType = 181,
- LiteralType = 182,
- ImportType = 183,
- ObjectBindingPattern = 184,
- ArrayBindingPattern = 185,
- BindingElement = 186,
- ArrayLiteralExpression = 187,
- ObjectLiteralExpression = 188,
- PropertyAccessExpression = 189,
- ElementAccessExpression = 190,
- CallExpression = 191,
- NewExpression = 192,
- TaggedTemplateExpression = 193,
- TypeAssertionExpression = 194,
- ParenthesizedExpression = 195,
- FunctionExpression = 196,
- ArrowFunction = 197,
- DeleteExpression = 198,
- TypeOfExpression = 199,
- VoidExpression = 200,
- AwaitExpression = 201,
- PrefixUnaryExpression = 202,
- PostfixUnaryExpression = 203,
- BinaryExpression = 204,
- ConditionalExpression = 205,
- TemplateExpression = 206,
- YieldExpression = 207,
- SpreadElement = 208,
- ClassExpression = 209,
- OmittedExpression = 210,
- ExpressionWithTypeArguments = 211,
- AsExpression = 212,
- NonNullExpression = 213,
- MetaProperty = 214,
- SyntheticExpression = 215,
- TemplateSpan = 216,
- SemicolonClassElement = 217,
- Block = 218,
- VariableStatement = 219,
- EmptyStatement = 220,
- ExpressionStatement = 221,
- IfStatement = 222,
- DoStatement = 223,
- WhileStatement = 224,
- ForStatement = 225,
- ForInStatement = 226,
- ForOfStatement = 227,
- ContinueStatement = 228,
- BreakStatement = 229,
- ReturnStatement = 230,
- WithStatement = 231,
- SwitchStatement = 232,
- LabeledStatement = 233,
- ThrowStatement = 234,
- TryStatement = 235,
- DebuggerStatement = 236,
- VariableDeclaration = 237,
- VariableDeclarationList = 238,
- FunctionDeclaration = 239,
- ClassDeclaration = 240,
- InterfaceDeclaration = 241,
- TypeAliasDeclaration = 242,
- EnumDeclaration = 243,
- ModuleDeclaration = 244,
- ModuleBlock = 245,
- CaseBlock = 246,
- NamespaceExportDeclaration = 247,
- ImportEqualsDeclaration = 248,
- ImportDeclaration = 249,
- ImportClause = 250,
- NamespaceImport = 251,
- NamedImports = 252,
- ImportSpecifier = 253,
- ExportAssignment = 254,
- ExportDeclaration = 255,
- NamedExports = 256,
- ExportSpecifier = 257,
- MissingDeclaration = 258,
- ExternalModuleReference = 259,
- JsxElement = 260,
- JsxSelfClosingElement = 261,
- JsxOpeningElement = 262,
- JsxClosingElement = 263,
- JsxFragment = 264,
- JsxOpeningFragment = 265,
- JsxClosingFragment = 266,
- JsxAttribute = 267,
- JsxAttributes = 268,
- JsxSpreadAttribute = 269,
- JsxExpression = 270,
- CaseClause = 271,
- DefaultClause = 272,
- HeritageClause = 273,
- CatchClause = 274,
- PropertyAssignment = 275,
- ShorthandPropertyAssignment = 276,
- SpreadAssignment = 277,
- EnumMember = 278,
- UnparsedPrologue = 279,
- UnparsedPrepend = 280,
- UnparsedText = 281,
- UnparsedInternalText = 282,
- UnparsedSyntheticReference = 283,
- SourceFile = 284,
- Bundle = 285,
- UnparsedSource = 286,
- InputFiles = 287,
- JSDocTypeExpression = 288,
- JSDocAllType = 289,
- JSDocUnknownType = 290,
- JSDocNullableType = 291,
- JSDocNonNullableType = 292,
- JSDocOptionalType = 293,
- JSDocFunctionType = 294,
- JSDocVariadicType = 295,
- JSDocComment = 296,
- JSDocTypeLiteral = 297,
- JSDocSignature = 298,
- JSDocTag = 299,
- JSDocAugmentsTag = 300,
- JSDocClassTag = 301,
- JSDocCallbackTag = 302,
- JSDocEnumTag = 303,
- JSDocParameterTag = 304,
- JSDocReturnTag = 305,
- JSDocThisTag = 306,
- JSDocTypeTag = 307,
- JSDocTemplateTag = 308,
- JSDocTypedefTag = 309,
- JSDocPropertyTag = 310,
- SyntaxList = 311,
- NotEmittedStatement = 312,
- PartiallyEmittedExpression = 313,
- CommaListExpression = 314,
- MergeDeclarationMarker = 315,
- EndOfDeclarationMarker = 316,
- Count = 317,
- FirstAssignment = 59,
- LastAssignment = 71,
- FirstCompoundAssignment = 60,
- LastCompoundAssignment = 71,
- FirstReservedWord = 73,
- LastReservedWord = 108,
- FirstKeyword = 73,
- LastKeyword = 147,
- FirstFutureReservedWord = 109,
- LastFutureReservedWord = 117,
- FirstTypeNode = 163,
- LastTypeNode = 183,
+ /** Only the JSDoc scanner produces BacktickToken. The normal scanner produces NoSubstitutionTemplateLiteral and related kinds. */
+ BacktickToken = 59,
+ EqualsToken = 60,
+ PlusEqualsToken = 61,
+ MinusEqualsToken = 62,
+ AsteriskEqualsToken = 63,
+ AsteriskAsteriskEqualsToken = 64,
+ SlashEqualsToken = 65,
+ PercentEqualsToken = 66,
+ LessThanLessThanEqualsToken = 67,
+ GreaterThanGreaterThanEqualsToken = 68,
+ GreaterThanGreaterThanGreaterThanEqualsToken = 69,
+ AmpersandEqualsToken = 70,
+ BarEqualsToken = 71,
+ CaretEqualsToken = 72,
+ Identifier = 73,
+ BreakKeyword = 74,
+ CaseKeyword = 75,
+ CatchKeyword = 76,
+ ClassKeyword = 77,
+ ConstKeyword = 78,
+ ContinueKeyword = 79,
+ DebuggerKeyword = 80,
+ DefaultKeyword = 81,
+ DeleteKeyword = 82,
+ DoKeyword = 83,
+ ElseKeyword = 84,
+ EnumKeyword = 85,
+ ExportKeyword = 86,
+ ExtendsKeyword = 87,
+ FalseKeyword = 88,
+ FinallyKeyword = 89,
+ ForKeyword = 90,
+ FunctionKeyword = 91,
+ IfKeyword = 92,
+ ImportKeyword = 93,
+ InKeyword = 94,
+ InstanceOfKeyword = 95,
+ NewKeyword = 96,
+ NullKeyword = 97,
+ ReturnKeyword = 98,
+ SuperKeyword = 99,
+ SwitchKeyword = 100,
+ ThisKeyword = 101,
+ ThrowKeyword = 102,
+ TrueKeyword = 103,
+ TryKeyword = 104,
+ TypeOfKeyword = 105,
+ VarKeyword = 106,
+ VoidKeyword = 107,
+ WhileKeyword = 108,
+ WithKeyword = 109,
+ ImplementsKeyword = 110,
+ InterfaceKeyword = 111,
+ LetKeyword = 112,
+ PackageKeyword = 113,
+ PrivateKeyword = 114,
+ ProtectedKeyword = 115,
+ PublicKeyword = 116,
+ StaticKeyword = 117,
+ YieldKeyword = 118,
+ AbstractKeyword = 119,
+ AsKeyword = 120,
+ AnyKeyword = 121,
+ AsyncKeyword = 122,
+ AwaitKeyword = 123,
+ BooleanKeyword = 124,
+ ConstructorKeyword = 125,
+ DeclareKeyword = 126,
+ GetKeyword = 127,
+ InferKeyword = 128,
+ IsKeyword = 129,
+ KeyOfKeyword = 130,
+ ModuleKeyword = 131,
+ NamespaceKeyword = 132,
+ NeverKeyword = 133,
+ ReadonlyKeyword = 134,
+ RequireKeyword = 135,
+ NumberKeyword = 136,
+ ObjectKeyword = 137,
+ SetKeyword = 138,
+ StringKeyword = 139,
+ SymbolKeyword = 140,
+ TypeKeyword = 141,
+ UndefinedKeyword = 142,
+ UniqueKeyword = 143,
+ UnknownKeyword = 144,
+ FromKeyword = 145,
+ GlobalKeyword = 146,
+ BigIntKeyword = 147,
+ OfKeyword = 148,
+ QualifiedName = 149,
+ ComputedPropertyName = 150,
+ TypeParameter = 151,
+ Parameter = 152,
+ Decorator = 153,
+ PropertySignature = 154,
+ PropertyDeclaration = 155,
+ MethodSignature = 156,
+ MethodDeclaration = 157,
+ Constructor = 158,
+ GetAccessor = 159,
+ SetAccessor = 160,
+ CallSignature = 161,
+ ConstructSignature = 162,
+ IndexSignature = 163,
+ TypePredicate = 164,
+ TypeReference = 165,
+ FunctionType = 166,
+ ConstructorType = 167,
+ TypeQuery = 168,
+ TypeLiteral = 169,
+ ArrayType = 170,
+ TupleType = 171,
+ OptionalType = 172,
+ RestType = 173,
+ UnionType = 174,
+ IntersectionType = 175,
+ ConditionalType = 176,
+ InferType = 177,
+ ParenthesizedType = 178,
+ ThisType = 179,
+ TypeOperator = 180,
+ IndexedAccessType = 181,
+ MappedType = 182,
+ LiteralType = 183,
+ ImportType = 184,
+ ObjectBindingPattern = 185,
+ ArrayBindingPattern = 186,
+ BindingElement = 187,
+ ArrayLiteralExpression = 188,
+ ObjectLiteralExpression = 189,
+ PropertyAccessExpression = 190,
+ ElementAccessExpression = 191,
+ CallExpression = 192,
+ NewExpression = 193,
+ TaggedTemplateExpression = 194,
+ TypeAssertionExpression = 195,
+ ParenthesizedExpression = 196,
+ FunctionExpression = 197,
+ ArrowFunction = 198,
+ DeleteExpression = 199,
+ TypeOfExpression = 200,
+ VoidExpression = 201,
+ AwaitExpression = 202,
+ PrefixUnaryExpression = 203,
+ PostfixUnaryExpression = 204,
+ BinaryExpression = 205,
+ ConditionalExpression = 206,
+ TemplateExpression = 207,
+ YieldExpression = 208,
+ SpreadElement = 209,
+ ClassExpression = 210,
+ OmittedExpression = 211,
+ ExpressionWithTypeArguments = 212,
+ AsExpression = 213,
+ NonNullExpression = 214,
+ MetaProperty = 215,
+ SyntheticExpression = 216,
+ TemplateSpan = 217,
+ SemicolonClassElement = 218,
+ Block = 219,
+ VariableStatement = 220,
+ EmptyStatement = 221,
+ ExpressionStatement = 222,
+ IfStatement = 223,
+ DoStatement = 224,
+ WhileStatement = 225,
+ ForStatement = 226,
+ ForInStatement = 227,
+ ForOfStatement = 228,
+ ContinueStatement = 229,
+ BreakStatement = 230,
+ ReturnStatement = 231,
+ WithStatement = 232,
+ SwitchStatement = 233,
+ LabeledStatement = 234,
+ ThrowStatement = 235,
+ TryStatement = 236,
+ DebuggerStatement = 237,
+ VariableDeclaration = 238,
+ VariableDeclarationList = 239,
+ FunctionDeclaration = 240,
+ ClassDeclaration = 241,
+ InterfaceDeclaration = 242,
+ TypeAliasDeclaration = 243,
+ EnumDeclaration = 244,
+ ModuleDeclaration = 245,
+ ModuleBlock = 246,
+ CaseBlock = 247,
+ NamespaceExportDeclaration = 248,
+ ImportEqualsDeclaration = 249,
+ ImportDeclaration = 250,
+ ImportClause = 251,
+ NamespaceImport = 252,
+ NamedImports = 253,
+ ImportSpecifier = 254,
+ ExportAssignment = 255,
+ ExportDeclaration = 256,
+ NamedExports = 257,
+ ExportSpecifier = 258,
+ MissingDeclaration = 259,
+ ExternalModuleReference = 260,
+ JsxElement = 261,
+ JsxSelfClosingElement = 262,
+ JsxOpeningElement = 263,
+ JsxClosingElement = 264,
+ JsxFragment = 265,
+ JsxOpeningFragment = 266,
+ JsxClosingFragment = 267,
+ JsxAttribute = 268,
+ JsxAttributes = 269,
+ JsxSpreadAttribute = 270,
+ JsxExpression = 271,
+ CaseClause = 272,
+ DefaultClause = 273,
+ HeritageClause = 274,
+ CatchClause = 275,
+ PropertyAssignment = 276,
+ ShorthandPropertyAssignment = 277,
+ SpreadAssignment = 278,
+ EnumMember = 279,
+ UnparsedPrologue = 280,
+ UnparsedPrepend = 281,
+ UnparsedText = 282,
+ UnparsedInternalText = 283,
+ UnparsedSyntheticReference = 284,
+ SourceFile = 285,
+ Bundle = 286,
+ UnparsedSource = 287,
+ InputFiles = 288,
+ JSDocTypeExpression = 289,
+ JSDocAllType = 290,
+ JSDocUnknownType = 291,
+ JSDocNullableType = 292,
+ JSDocNonNullableType = 293,
+ JSDocOptionalType = 294,
+ JSDocFunctionType = 295,
+ JSDocVariadicType = 296,
+ JSDocComment = 297,
+ JSDocTypeLiteral = 298,
+ JSDocSignature = 299,
+ JSDocTag = 300,
+ JSDocAugmentsTag = 301,
+ JSDocClassTag = 302,
+ JSDocCallbackTag = 303,
+ JSDocEnumTag = 304,
+ JSDocParameterTag = 305,
+ JSDocReturnTag = 306,
+ JSDocThisTag = 307,
+ JSDocTypeTag = 308,
+ JSDocTemplateTag = 309,
+ JSDocTypedefTag = 310,
+ JSDocPropertyTag = 311,
+ SyntaxList = 312,
+ NotEmittedStatement = 313,
+ PartiallyEmittedExpression = 314,
+ CommaListExpression = 315,
+ MergeDeclarationMarker = 316,
+ EndOfDeclarationMarker = 317,
+ Count = 318,
+ FirstAssignment = 60,
+ LastAssignment = 72,
+ FirstCompoundAssignment = 61,
+ LastCompoundAssignment = 72,
+ FirstReservedWord = 74,
+ LastReservedWord = 109,
+ FirstKeyword = 74,
+ LastKeyword = 148,
+ FirstFutureReservedWord = 110,
+ LastFutureReservedWord = 118,
+ FirstTypeNode = 164,
+ LastTypeNode = 184,
FirstPunctuation = 18,
- LastPunctuation = 71,
+ LastPunctuation = 72,
FirstToken = 0,
- LastToken = 147,
+ LastToken = 148,
FirstTriviaToken = 2,
LastTriviaToken = 7,
FirstLiteralToken = 8,
@@ -417,12 +419,12 @@
FirstTemplateToken = 14,
LastTemplateToken = 17,
FirstBinaryOperator = 28,
- LastBinaryOperator = 71,
- FirstNode = 148,
- FirstJSDocNode = 288,
- LastJSDocNode = 310,
- FirstJSDocTagNode = 299,
- LastJSDocTagNode = 310,
+ LastBinaryOperator = 72,
+ FirstNode = 149,
+ FirstJSDocNode = 289,
+ LastJSDocNode = 311,
+ FirstJSDocTagNode = 300,
+ LastJSDocTagNode = 311,
}
enum NodeFlags {
None = 0,
@@ -626,7 +628,7 @@
initializer?: Expression;
}
interface ObjectLiteralElement extends NamedDeclaration {
- _objectLiteralBrandBrand: any;
+ _objectLiteralBrand: any;
name?: PropertyName;
}
/** Unlike ObjectLiteralElement, excludes JSXAttribute and JSXSpreadAttribute. */
@@ -1601,7 +1603,7 @@
}
interface JSDocTypeTag extends JSDocTag {
kind: SyntaxKind.JSDocTypeTag;
- typeExpression?: JSDocTypeExpression;
+ typeExpression: JSDocTypeExpression;
}
interface JSDocTypedefTag extends JSDocTag, NamedDeclaration {
parent: JSDoc;
@@ -1877,13 +1879,18 @@
sourceFile: SourceFile;
references?: ReadonlyArray<ResolvedProjectReference | undefined>;
}
+ type CustomTransformerFactory = (context: TransformationContext) => CustomTransformer;
+ interface CustomTransformer {
+ transformSourceFile(node: SourceFile): SourceFile;
+ transformBundle(node: Bundle): Bundle;
+ }
interface CustomTransformers {
/** Custom transformers to evaluate before built-in .js transformations. */
- before?: TransformerFactory<SourceFile>[];
+ before?: (TransformerFactory<SourceFile> | CustomTransformerFactory)[];
/** Custom transformers to evaluate after built-in .js transformations. */
- after?: TransformerFactory<SourceFile>[];
+ after?: (TransformerFactory<SourceFile> | CustomTransformerFactory)[];
/** Custom transformers to evaluate after built-in .d.ts transformations. */
- afterDeclarations?: TransformerFactory<Bundle | SourceFile>[];
+ afterDeclarations?: (TransformerFactory<Bundle | SourceFile> | CustomTransformerFactory)[];
}
interface SourceMapSpan {
/** Line number in the .js file. */
@@ -1962,6 +1969,7 @@
*/
getExportSymbolOfSymbol(symbol: Symbol): Symbol;
getPropertySymbolOfDestructuringAssignment(location: Identifier): Symbol | undefined;
+ getTypeOfAssignmentPattern(pattern: AssignmentPattern): Type;
getTypeAtLocation(node: Node): Type;
getTypeFromTypeNode(node: TypeNode): Type;
signatureToString(signature: Signature, enclosingDeclaration?: Node, flags?: TypeFormatFlags, kind?: SignatureKind): string;
@@ -2359,7 +2367,8 @@
objectType: Type;
indexType: Type;
constraint?: Type;
- simplified?: Type;
+ simplifiedForReading?: Type;
+ simplifiedForWriting?: Type;
}
type TypeVariable = TypeParameter | IndexedAccessType;
interface IndexType extends InstantiableType {
@@ -2382,8 +2391,8 @@
root: ConditionalRoot;
checkType: Type;
extendsType: Type;
- trueType: Type;
- falseType: Type;
+ resolvedTrueType: Type;
+ resolvedFalseType: Type;
}
interface SubstitutionType extends InstantiableType {
typeVariable: TypeVariable;
@@ -2410,12 +2419,13 @@
enum InferencePriority {
NakedTypeVariable = 1,
HomomorphicMappedType = 2,
- MappedTypeConstraint = 4,
- ReturnType = 8,
- LiteralKeyof = 16,
- NoConstraints = 32,
- AlwaysStrict = 64,
- PriorityImpliesCombination = 28
+ PartialHomomorphicMappedType = 4,
+ MappedTypeConstraint = 8,
+ ReturnType = 16,
+ LiteralKeyof = 32,
+ NoConstraints = 64,
+ AlwaysStrict = 128,
+ PriorityImpliesCombination = 56
}
/** @deprecated Use FileExtensionInfo instead. */
type JsFileExtensionInfo = FileExtensionInfo;
@@ -2489,6 +2499,7 @@
interface CompilerOptions {
allowJs?: boolean;
allowSyntheticDefaultImports?: boolean;
+ allowUmdGlobalAccess?: boolean;
allowUnreachableCode?: boolean;
allowUnusedLabels?: boolean;
alwaysStrict?: boolean;
@@ -2621,9 +2632,10 @@
ES2017 = 4,
ES2018 = 5,
ES2019 = 6,
- ESNext = 7,
+ ES2020 = 7,
+ ESNext = 8,
JSON = 100,
- Latest = 7
+ Latest = 8
}
enum LanguageVariant {
Standard = 0,
@@ -2756,6 +2768,7 @@
resolveTypeReferenceDirectives?(typeReferenceDirectiveNames: string[], containingFile: string, redirectedReference?: ResolvedProjectReference): (ResolvedTypeReferenceDirective | undefined)[];
getEnvironmentVariable?(name: string): string | undefined;
createHash?(data: string): string;
+ getParsedCommandLine?(fileName: string): ParsedCommandLine | undefined;
}
interface SourceMapRange extends TextRange {
source?: SourceMapSource;
@@ -3159,7 +3172,7 @@
reScanJsxToken(): JsxTokenSyntaxKind;
reScanLessThanToken(): SyntaxKind;
scanJsxToken(): JsxTokenSyntaxKind;
- scanJSDocToken(): JsDocSyntaxKind;
+ scanJsDocToken(): JSDocSyntaxKind;
scan(): SyntaxKind;
getText(): string;
setText(text: string | undefined, start?: number, length?: number): void;
@@ -3627,7 +3640,7 @@
/**
* Reads the config file, reports errors if any and exits if the config file cannot be found
*/
- function getParsedCommandLineOfConfigFile(configFileName: string, optionsToExtend: CompilerOptions, host: ParseConfigFileHost): ParsedCommandLine | undefined;
+ function getParsedCommandLineOfConfigFile(configFileName: string, optionsToExtend: CompilerOptions, host: ParseConfigFileHost, extendedConfigCache?: Map<ExtendedConfigCacheEntry>): ParsedCommandLine | undefined;
/**
* Read tsconfig.json file
* @param fileName The path to the config file
@@ -3661,7 +3674,7 @@
* @param basePath A root directory to resolve relative path entries in the config
* file to. e.g. outDir
*/
- function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: ReadonlyArray<FileExtensionInfo>): ParsedCommandLine;
+ function parseJsonConfigFileContent(json: any, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: ReadonlyArray<FileExtensionInfo>, extendedConfigCache?: Map<ExtendedConfigCacheEntry>): ParsedCommandLine;
/**
* Parse the contents of a config file (tsconfig.json).
* @param jsonNode The contents of the config file to parse
@@ -3669,7 +3682,20 @@
* @param basePath A root directory to resolve relative path entries in the config
* file to. e.g. outDir
*/
- function parseJsonSourceFileConfigFileContent(sourceFile: TsConfigSourceFile, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: ReadonlyArray<FileExtensionInfo>): ParsedCommandLine;
+ function parseJsonSourceFileConfigFileContent(sourceFile: TsConfigSourceFile, host: ParseConfigHost, basePath: string, existingOptions?: CompilerOptions, configFileName?: string, resolutionStack?: Path[], extraFileExtensions?: ReadonlyArray<FileExtensionInfo>, extendedConfigCache?: Map<ExtendedConfigCacheEntry>): ParsedCommandLine;
+ interface ParsedTsconfig {
+ raw: any;
+ options?: CompilerOptions;
+ typeAcquisition?: TypeAcquisition;
+ /**
+ * Note that the case of the config path has not yet been normalized, as no files have been imported into the project yet
+ */
+ extendedConfigPath?: string;
+ }
+ interface ExtendedConfigCacheEntry {
+ extendedResult: TsConfigSourceFile;
+ extendedConfig: ParsedTsconfig | undefined;
+ }
function convertCompilerOptionsFromJson(jsonOptions: any, basePath: string, configFileName?: string): {
options: CompilerOptions;
errors: Diagnostic[];
@@ -3714,7 +3740,7 @@
get(directory: string): ResolvedModuleWithFailedLookupLocations | undefined;
set(directory: string, result: ResolvedModuleWithFailedLookupLocations): void;
}
- function createModuleResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string): ModuleResolutionCache;
+ function createModuleResolutionCache(currentDirectory: string, getCanonicalFileName: (s: string) => string, options?: CompilerOptions): ModuleResolutionCache;
function resolveModuleNameFromCache(moduleName: string, containingFile: string, cache: ModuleResolutionCache): ResolvedModuleWithFailedLookupLocations | undefined;
function resolveModuleName(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations;
function nodeModuleNameResolver(moduleName: string, containingFile: string, compilerOptions: CompilerOptions, host: ModuleResolutionHost, cache?: ModuleResolutionCache, redirectedReference?: ResolvedProjectReference): ResolvedModuleWithFailedLookupLocations;
@@ -3837,7 +3863,7 @@
function updateArrayLiteral(node: ArrayLiteralExpression, elements: ReadonlyArray<Expression>): ArrayLiteralExpression;
function createObjectLiteral(properties?: ReadonlyArray<ObjectLiteralElementLike>, multiLine?: boolean): ObjectLiteralExpression;
function updateObjectLiteral(node: ObjectLiteralExpression, properties: ReadonlyArray<ObjectLiteralElementLike>): ObjectLiteralExpression;
- function createPropertyAccess(expression: Expression, name: string | Identifier | undefined): PropertyAccessExpression;
+ function createPropertyAccess(expression: Expression, name: string | Identifier): PropertyAccessExpression;
function updatePropertyAccess(node: PropertyAccessExpression, expression: Expression, name: Identifier): PropertyAccessExpression;
function createElementAccess(expression: Expression, index: number | Expression): ElementAccessExpression;
function updateElementAccess(node: ElementAccessExpression, expression: Expression, argumentExpression: Expression): ElementAccessExpression;
@@ -4052,7 +4078,7 @@
function createInputFiles(javascriptText: string, declarationText: string): InputFiles;
function createInputFiles(readFileText: (path: string) => string | undefined, javascriptPath: string, javascriptMapPath: string | undefined, declarationPath: string, declarationMapPath: string | undefined, buildInfoPath: string | undefined): InputFiles;
function createInputFiles(javascriptText: string, declarationText: string, javascriptMapPath: string | undefined, javascriptMapText: string | undefined, declarationMapPath: string | undefined, declarationMapText: string | undefined): InputFiles;
- function updateBundle(node: Bundle, sourceFiles: ReadonlyArray<SourceFile>, prepends?: ReadonlyArray<UnparsedSource>): Bundle;
+ function updateBundle(node: Bundle, sourceFiles: ReadonlyArray<SourceFile>, prepends?: ReadonlyArray<UnparsedSource | InputFiles>): Bundle;
function createImmediatelyInvokedFunctionExpression(statements: ReadonlyArray<Statement>): CallExpression;
function createImmediatelyInvokedFunctionExpression(statements: ReadonlyArray<Statement>, param: ParameterDeclaration, paramValue: Expression): CallExpression;
function createImmediatelyInvokedArrowFunction(statements: ReadonlyArray<Statement>): CallExpression;
@@ -4540,13 +4566,12 @@
type ActionSet = "action::set";
type ActionInvalidate = "action::invalidate";
type ActionPackageInstalled = "action::packageInstalled";
- type ActionValueInspected = "action::valueInspected";
type EventTypesRegistry = "event::typesRegistry";
type EventBeginInstallTypes = "event::beginInstallTypes";
type EventEndInstallTypes = "event::endInstallTypes";
type EventInitializationFailed = "event::initializationFailed";
interface TypingInstallerResponse {
- readonly kind: ActionSet | ActionInvalidate | EventTypesRegistry | ActionPackageInstalled | ActionValueInspected | EventBeginInstallTypes | EventEndInstallTypes | EventInitializationFailed;
+ readonly kind: ActionSet | ActionInvalidate | EventTypesRegistry | ActionPackageInstalled | EventBeginInstallTypes | EventEndInstallTypes | EventInitializationFailed;
}
interface TypingInstallerRequestWithProjectName {
readonly projectName: string;
@@ -4785,6 +4810,7 @@
getSignatureHelpItems(fileName: string, position: number, options: SignatureHelpItemsOptions | undefined): SignatureHelpItems | undefined;
getRenameInfo(fileName: string, position: number, options?: RenameInfoOptions): RenameInfo;
findRenameLocations(fileName: string, position: number, findInStrings: boolean, findInComments: boolean, providePrefixAndSuffixTextForRename?: boolean): ReadonlyArray<RenameLocation> | undefined;
+ getSmartSelectionRange(fileName: string, position: number): SelectionRange;
getDefinitionAtPosition(fileName: string, position: number): ReadonlyArray<DefinitionInfo> | undefined;
getDefinitionAndBoundSpan(fileName: string, position: number): DefinitionInfoAndBoundSpan | undefined;
getTypeDefinitionAtPosition(fileName: string, position: number): ReadonlyArray<DefinitionInfo> | undefined;
@@ -4979,16 +5005,9 @@
changes: ReadonlyArray<FileTextChanges>;
commands?: ReadonlyArray<CodeActionCommand>;
}
- type CodeActionCommand = InstallPackageAction | GenerateTypesAction;
+ type CodeActionCommand = InstallPackageAction;
interface InstallPackageAction {
}
- interface GenerateTypesAction extends GenerateTypesOptions {
- }
- interface GenerateTypesOptions {
- readonly file: string;
- readonly fileToGenerateTypesFor: string;
- readonly outputFileName: string;
- }
/**
* A set of one or more available refactoring actions, grouped under a parent refactoring.
*/
@@ -5236,6 +5255,10 @@
displayParts: SymbolDisplayPart[];
isOptional: boolean;
}
+ interface SelectionRange {
+ textSpan: TextSpan;
+ parent?: SelectionRange;
+ }
/**
* Represents a single signature to show in signature help.
* The id is used for subsequent calls into the language service to ask questions about the
@@ -5613,10 +5636,6 @@
function transpile(input: string, compilerOptions?: CompilerOptions, fileName?: string, diagnostics?: Diagnostic[], moduleName?: string): string;
}
declare namespace ts {
- function generateTypesForModule(name: string, moduleValue: unknown, formatSettings: FormatCodeSettings): string;
- function generateTypesForGlobal(name: string, globalValue: unknown, formatSettings: FormatCodeSettings): string;
-}
-declare namespace ts {
/** The version of the language service API */
const servicesVersion = "0.8";
function toEditorSettings(options: EditorOptions | EditorSettings): EditorSettings;

lib/typescriptServices.js

@@ -73,9 +73,9 @@
(function (ts) {
// WARNING: The script `configureNightly.ts` uses a regexp to parse out these values.
// If changing the text in this section, be sure to test `configureNightly` too.
- ts.versionMajorMinor = "3.4";
+ ts.versionMajorMinor = "3.5";
/** The version of the TypeScript compiler release */
- ts.version = ts.versionMajorMinor + ".5";
+ ts.version = ts.versionMajorMinor + ".1";
})(ts || (ts = {}));
(function (ts) {
/* @internal */
@@ -205,7 +205,7 @@
entry.nextEntry.previousEntry = previousEntry;
}
// When the deleted entry was the last one, we need to
- // adust the lastEntry reference.
+ // adjust the lastEntry reference.
if (this.lastEntry === entry) {
this.lastEntry = previousEntry;
}
@@ -315,7 +315,7 @@
ts.firstDefinedIterator = firstDefinedIterator;
function zipWith(arrayA, arrayB, callback) {
var result = [];
- Debug.assertEqual(arrayA.length, arrayB.length);
+ ts.Debug.assertEqual(arrayA.length, arrayB.length);
for (var i = 0; i < arrayA.length; i++) {
result.push(callback(arrayA[i], arrayB[i], i));
}
@@ -323,7 +323,7 @@
}
ts.zipWith = zipWith;
function zipToIterator(arrayA, arrayB) {
- Debug.assertEqual(arrayA.length, arrayB.length);
+ ts.Debug.assertEqual(arrayA.length, arrayB.length);
var i = 0;
return {
next: function () {
@@ -337,7 +337,7 @@
}
ts.zipToIterator = zipToIterator;
function zipToMap(keys, values) {
- Debug.assert(keys.length === values.length);
+ ts.Debug.assert(keys.length === values.length);
var map = createMap();
for (var i = 0; i < keys.length; ++i) {
map.set(keys[i], values[i]);
@@ -411,7 +411,7 @@
return result;
}
}
- return Debug.fail();
+ return ts.Debug.fail();
}
ts.findMap = findMap;
function contains(array, value, equalityComparer) {
@@ -841,7 +841,7 @@
continue;
case -1 /* LessThan */:
// If `array` is sorted, `next` should **never** be less than `last`.
- return Debug.fail("Array is unsorted.");
+ return ts.Debug.fail("Array is unsorted.");
}
deduplicated.push(last = next);
}
@@ -908,13 +908,13 @@
loopB: for (var offsetA = 0, offsetB = 0; offsetB < arrayB.length; offsetB++) {
if (offsetB > 0) {
// Ensure `arrayB` is properly sorted.
- Debug.assertGreaterThanOrEqual(comparer(arrayB[offsetB], arrayB[offsetB - 1]), 0 /* EqualTo */);
+ ts.Debug.assertGreaterThanOrEqual(comparer(arrayB[offsetB], arrayB[offsetB - 1]), 0 /* EqualTo */);
}
loopA: for (var startA = offsetA; offsetA < arrayA.length; offsetA++) {
if (offsetA > startA) {
// Ensure `arrayA` is properly sorted. We only need to perform this check if
// `offsetA` has changed since we entered the loop.
- Debug.assertGreaterThanOrEqual(comparer(arrayA[offsetA], arrayA[offsetA - 1]), 0 /* EqualTo */);
+ ts.Debug.assertGreaterThanOrEqual(comparer(arrayA[offsetA], arrayA[offsetA - 1]), 0 /* EqualTo */);
}
switch (comparer(arrayB[offsetB], arrayA[offsetA])) {
case -1 /* LessThan */:
@@ -1084,7 +1084,7 @@
}
ts.firstOrUndefined = firstOrUndefined;
function first(array) {
- Debug.assert(array.length !== 0);
+ ts.Debug.assert(array.length !== 0);
return array[0];
}
ts.first = first;
@@ -1096,7 +1096,7 @@
}
ts.lastOrUndefined = lastOrUndefined;
function last(array) {
- Debug.assert(array.length !== 0);
+ ts.Debug.assert(array.length !== 0);
return array[array.length - 1];
}
ts.last = last;
@@ -1421,7 +1421,7 @@
function cast(value, test) {
if (value !== undefined && test(value))
return value;
- return Debug.fail("Invalid cast. The supplied value " + value + " did not pass the test '" + Debug.getFunctionName(test) + "'.");
+ return ts.Debug.fail("Invalid cast. The supplied value " + value + " did not pass the test '" + ts.Debug.getFunctionName(test) + "'.");
}
ts.cast = cast;
/** Does nothing. */
@@ -1458,38 +1458,13 @@
};
}
ts.memoize = memoize;
- function chain(a, b, c, d, e) {
+ function compose(a, b, c, d, e) {
if (e) {
var args_2 = [];
for (var i = 0; i < arguments.length; i++) {
args_2[i] = arguments[i];
}
- return function (t) { return compose.apply(void 0, map(args_2, function (f) { return f(t); })); };
- }
- else if (d) {
- return function (t) { return compose(a(t), b(t), c(t), d(t)); };
- }
- else if (c) {
- return function (t) { return compose(a(t), b(t), c(t)); };
- }
- else if (b) {
- return function (t) { return compose(a(t), b(t)); };
- }
- else if (a) {
- return function (t) { return compose(a(t)); };
- }
- else {
- return function (_) { return function (u) { return u; }; };
- }
- }
- ts.chain = chain;
- function compose(a, b, c, d, e) {
- if (e) {
- var args_3 = [];
- for (var i = 0; i < arguments.length; i++) {
- args_3[i] = arguments[i];
- }
- return function (t) { return reduceLeft(args_3, function (u, f) { return f(u); }, t); };
+ return function (t) { return reduceLeft(args_2, function (u, f) { return f(u); }, t); };
}
else if (d) {
return function (t) { return d(c(b(a(t)))); };
@@ -1515,92 +1490,6 @@
AssertionLevel[AssertionLevel["Aggressive"] = 2] = "Aggressive";
AssertionLevel[AssertionLevel["VeryAggressive"] = 3] = "VeryAggressive";
})(AssertionLevel = ts.AssertionLevel || (ts.AssertionLevel = {}));
- var Debug;
- (function (Debug) {
- Debug.currentAssertionLevel = 0 /* None */;
- Debug.isDebugging = false;
- function shouldAssert(level) {
- return Debug.currentAssertionLevel >= level;
- }
- Debug.shouldAssert = shouldAssert;
- function assert(expression, message, verboseDebugInfo, stackCrawlMark) {
- if (!expression) {
- if (verboseDebugInfo) {
- message += "\r\nVerbose Debug Information: " + (typeof verboseDebugInfo === "string" ? verboseDebugInfo : verboseDebugInfo());
- }
- fail(message ? "False expression: " + message : "False expression.", stackCrawlMark || assert);
- }
- }
- Debug.assert = assert;
- function assertEqual(a, b, msg, msg2) {
- if (a !== b) {
- var message = msg ? msg2 ? msg + " " + msg2 : msg : "";
- fail("Expected " + a + " === " + b + ". " + message);
- }
- }
- Debug.assertEqual = assertEqual;
- function assertLessThan(a, b, msg) {
- if (a >= b) {
- fail("Expected " + a + " < " + b + ". " + (msg || ""));
- }
- }
- Debug.assertLessThan = assertLessThan;
- function assertLessThanOrEqual(a, b) {
- if (a > b) {
- fail("Expected " + a + " <= " + b);
- }
- }
- Debug.assertLessThanOrEqual = assertLessThanOrEqual;
- function assertGreaterThanOrEqual(a, b) {
- if (a < b) {
- fail("Expected " + a + " >= " + b);
- }
- }
- Debug.assertGreaterThanOrEqual = assertGreaterThanOrEqual;
- function fail(message, stackCrawlMark) {
- debugger;
- var e = new Error(message ? "Debug Failure. " + message : "Debug Failure.");
- if (Error.captureStackTrace) {
- Error.captureStackTrace(e, stackCrawlMark || fail);
- }
- throw e;
- }
- Debug.fail = fail;
- function assertDefined(value, message) {
- if (value === undefined || value === null)
- return fail(message);
- return value;
- }
- Debug.assertDefined = assertDefined;
- function assertEachDefined(value, message) {
- for (var _i = 0, value_1 = value; _i < value_1.length; _i++) {
- var v = value_1[_i];
- assertDefined(v, message);
- }
- return value;
- }
- Debug.assertEachDefined = assertEachDefined;
- function assertNever(member, message, stackCrawlMark) {
- if (message === void 0) { message = "Illegal value:"; }
- var detail = typeof member === "object" && "kind" in member && "pos" in member ? "SyntaxKind: " + Debug.showSyntaxKind(member) : JSON.stringify(member);
- return fail(message + " " + detail, stackCrawlMark || assertNever);
- }
- Debug.assertNever = assertNever;
- function getFunctionName(func) {
- if (typeof func !== "function") {
- return "";
- }
- else if (func.hasOwnProperty("name")) {
- return func.name;
- }
- else {
- var text = Function.prototype.toString.call(func);
- var match = /^function\s+([\w\$]+)\s*\(/.exec(text);
- return match ? match[1] : "";
- }
- }
- Debug.getFunctionName = getFunctionName;
- })(Debug = ts.Debug || (ts.Debug = {}));
function equateValues(a, b) {
return a === b;
}
@@ -1857,7 +1746,7 @@
bestCandidate = candidate;
}
else {
- Debug.assert(distance < bestDistance); // Else `levenshteinWithMax` should return undefined
+ ts.Debug.assert(distance < bestDistance); // Else `levenshteinWithMax` should return undefined
bestDistance = distance;
bestCandidate = candidate;
}
@@ -2001,7 +1890,7 @@
* E.g.: matchedText(tryParsePattern("foo*baz"), "foobarbaz") === "bar"
*/
function matchedText(pattern, candidate) {
- Debug.assert(isPatternMatch(pattern, candidate));
+ ts.Debug.assert(isPatternMatch(pattern, candidate));
return candidate.substring(pattern.prefix.length, candidate.length - pattern.suffix.length);
}
ts.matchedText = matchedText;
@@ -2094,6 +1983,267 @@
return result;
}
ts.fill = fill;
+ function cartesianProduct(arrays) {
+ var result = [];
+ cartesianProductWorker(arrays, result, /*outer*/ undefined, 0);
+ return result;
+ }
+ ts.cartesianProduct = cartesianProduct;
+ function cartesianProductWorker(arrays, result, outer, index) {
+ for (var _i = 0, _a = arrays[index]; _i < _a.length; _i++) {
+ var element = _a[_i];
+ var inner = void 0;
+ if (outer) {
+ inner = outer.slice();
+ inner.push(element);
+ }
+ else {
+ inner = [element];
+ }
+ if (index === arrays.length - 1) {
+ result.push(inner);
+ }
+ else {
+ cartesianProductWorker(arrays, result, inner, index + 1);
+ }
+ }
+ }
+})(ts || (ts = {}));
+/* @internal */
+var ts;
+(function (ts) {
+ var Debug;
+ (function (Debug) {
+ Debug.currentAssertionLevel = 0 /* None */;
+ Debug.isDebugging = false;
+ function shouldAssert(level) {
+ return Debug.currentAssertionLevel >= level;
+ }
+ Debug.shouldAssert = shouldAssert;
+ function assert(expression, message, verboseDebugInfo, stackCrawlMark) {
+ if (!expression) {
+ if (verboseDebugInfo) {
+ message += "\r\nVerbose Debug Information: " + (typeof verboseDebugInfo === "string" ? verboseDebugInfo : verboseDebugInfo());
+ }
+ fail(message ? "False expression: " + message : "False expression.", stackCrawlMark || assert);
+ }
+ }
+ Debug.assert = assert;
+ function assertEqual(a, b, msg, msg2) {
+ if (a !== b) {
+ var message = msg ? msg2 ? msg + " " + msg2 : msg : "";
+ fail("Expected " + a + " === " + b + ". " + message);
+ }
+ }
+ Debug.assertEqual = assertEqual;
+ function assertLessThan(a, b, msg) {
+ if (a >= b) {
+ fail("Expected " + a + " < " + b + ". " + (msg || ""));
+ }
+ }
+ Debug.assertLessThan = assertLessThan;
+ function assertLessThanOrEqual(a, b) {
+ if (a > b) {
+ fail("Expected " + a + " <= " + b);
+ }
+ }
+ Debug.assertLessThanOrEqual = assertLessThanOrEqual;
+ function assertGreaterThanOrEqual(a, b) {
+ if (a < b) {
+ fail("Expected " + a + " >= " + b);
+ }
+ }
+ Debug.assertGreaterThanOrEqual = assertGreaterThanOrEqual;
+ function fail(message, stackCrawlMark) {
+ debugger;
+ var e = new Error(message ? "Debug Failure. " + message : "Debug Failure.");
+ if (Error.captureStackTrace) {
+ Error.captureStackTrace(e, stackCrawlMark || fail);
+ }
+ throw e;
+ }
+ Debug.fail = fail;
+ function assertDefined(value, message) {
+ if (value === undefined || value === null)
+ return fail(message);
+ return value;
+ }
+ Debug.assertDefined = assertDefined;
+ function assertEachDefined(value, message) {
+ for (var _i = 0, value_1 = value; _i < value_1.length; _i++) {
+ var v = value_1[_i];
+ assertDefined(v, message);
+ }
+ return value;
+ }
+ Debug.assertEachDefined = assertEachDefined;
+ function assertNever(member, message, stackCrawlMark) {
+ if (message === void 0) { message = "Illegal value:"; }
+ var detail = typeof member === "object" && "kind" in member && "pos" in member && formatSyntaxKind ? "SyntaxKind: " + formatSyntaxKind(member.kind) : JSON.stringify(member);
+ return fail(message + " " + detail, stackCrawlMark || assertNever);
+ }
+ Debug.assertNever = assertNever;
+ function getFunctionName(func) {
+ if (typeof func !== "function") {
+ return "";
+ }
+ else if (func.hasOwnProperty("name")) {
+ return func.name;
+ }
+ else {
+ var text = Function.prototype.toString.call(func);
+ var match = /^function\s+([\w\$]+)\s*\(/.exec(text);
+ return match ? match[1] : "";
+ }
+ }
+ Debug.getFunctionName = getFunctionName;
+ function formatSymbol(symbol) {
+ return "{ name: " + ts.unescapeLeadingUnderscores(symbol.escapedName) + "; flags: " + formatSymbolFlags(symbol.flags) + "; declarations: " + ts.map(symbol.declarations, function (node) { return formatSyntaxKind(node.kind); }) + " }";
+ }
+ Debug.formatSymbol = formatSymbol;
+ /**
+ * Formats an enum value as a string for debugging and debug assertions.
+ */
+ function formatEnum(value, enumObject, isFlags) {
+ if (value === void 0) { value = 0; }
+ var members = getEnumMembers(enumObject);
+ if (value === 0) {
+ return members.length > 0 && members[0][0] === 0 ? members[0][1] : "0";
+ }
+ if (isFlags) {
+ var result = "";
+ var remainingFlags = value;
+ for (var i = members.length - 1; i >= 0 && remainingFlags !== 0; i--) {
+ var _a = members[i], enumValue = _a[0], enumName = _a[1];
+ if (enumValue !== 0 && (remainingFlags & enumValue) === enumValue) {
+ remainingFlags &= ~enumValue;
+ result = "" + enumName + (result ? "|" : "") + result;
+ }
+ }
+ if (remainingFlags === 0) {
+ return result;
+ }
+ }
+ else {
+ for (var _i = 0, members_1 = members; _i < members_1.length; _i++) {
+ var _b = members_1[_i], enumValue = _b[0], enumName = _b[1];
+ if (enumValue === value) {
+ return enumName;
+ }
+ }
+ }
+ return value.toString();
+ }
+ Debug.formatEnum = formatEnum;
+ function getEnumMembers(enumObject) {
+ var result = [];
+ for (var name in enumObject) {
+ var value = enumObject[name];
+ if (typeof value === "number") {
+ result.push([value, name]);
+ }
+ }
+ return ts.stableSort(result, function (x, y) { return ts.compareValues(x[0], y[0]); });
+ }
+ function formatSyntaxKind(kind) {
+ return formatEnum(kind, ts.SyntaxKind, /*isFlags*/ false);
+ }
+ Debug.formatSyntaxKind = formatSyntaxKind;
+ function formatNodeFlags(flags) {
+ return formatEnum(flags, ts.NodeFlags, /*isFlags*/ true);
+ }
+ Debug.formatNodeFlags = formatNodeFlags;
+ function formatModifierFlags(flags) {
+ return formatEnum(flags, ts.ModifierFlags, /*isFlags*/ true);
+ }
+ Debug.formatModifierFlags = formatModifierFlags;
+ function formatTransformFlags(flags) {
+ return formatEnum(flags, ts.TransformFlags, /*isFlags*/ true);
+ }
+ Debug.formatTransformFlags = formatTransformFlags;
+ function formatEmitFlags(flags) {
+ return formatEnum(flags, ts.EmitFlags, /*isFlags*/ true);
+ }
+ Debug.formatEmitFlags = formatEmitFlags;
+ function formatSymbolFlags(flags) {
+ return formatEnum(flags, ts.SymbolFlags, /*isFlags*/ true);
+ }
+ Debug.formatSymbolFlags = formatSymbolFlags;
+ function formatTypeFlags(flags) {
+ return formatEnum(flags, ts.TypeFlags, /*isFlags*/ true);
+ }
+ Debug.formatTypeFlags = formatTypeFlags;
+ function formatObjectFlags(flags) {
+ return formatEnum(flags, ts.ObjectFlags, /*isFlags*/ true);
+ }
+ Debug.formatObjectFlags = formatObjectFlags;
+ function failBadSyntaxKind(node, message) {
+ return fail((message || "Unexpected node.") + "\r\nNode " + formatSyntaxKind(node.kind) + " was unexpected.", failBadSyntaxKind);
+ }
+ Debug.failBadSyntaxKind = failBadSyntaxKind;
+ Debug.assertEachNode = shouldAssert(1 /* Normal */)
+ ? function (nodes, test, message) { return assert(test === undefined || ts.every(nodes, test), message || "Unexpected node.", function () { return "Node array did not pass test '" + getFunctionName(test) + "'."; }, Debug.assertEachNode); }
+ : ts.noop;
+ Debug.assertNode = shouldAssert(1 /* Normal */)
+ ? function (node, test, message) { return assert(test === undefined || test(node), message || "Unexpected node.", function () { return "Node " + formatSyntaxKind(node.kind) + " did not pass test '" + getFunctionName(test) + "'."; }, Debug.assertNode); }
+ : ts.noop;
+ Debug.assertOptionalNode = shouldAssert(1 /* Normal */)
+ ? function (node, test, message) { return assert(test === undefined || node === undefined || test(node), message || "Unexpected node.", function () { return "Node " + formatSyntaxKind(node.kind) + " did not pass test '" + getFunctionName(test) + "'."; }, Debug.assertOptionalNode); }
+ : ts.noop;
+ Debug.assertOptionalToken = shouldAssert(1 /* Normal */)
+ ? function (node, kind, message) { return assert(kind === undefined || node === undefined || node.kind === kind, message || "Unexpected node.", function () { return "Node " + formatSyntaxKind(node.kind) + " was not a '" + formatSyntaxKind(kind) + "' token."; }, Debug.assertOptionalToken); }
+ : ts.noop;
+ Debug.assertMissingNode = shouldAssert(1 /* Normal */)
+ ? function (node, message) { return assert(node === undefined, message || "Unexpected node.", function () { return "Node " + formatSyntaxKind(node.kind) + " was unexpected'."; }, Debug.assertMissingNode); }
+ : ts.noop;
+ var isDebugInfoEnabled = false;
+ /**
+ * Injects debug information into frequently used types.
+ */
+ function enableDebugInfo() {
+ if (isDebugInfoEnabled)
+ return;
+ // Add additional properties in debug mode to assist with debugging.
+ Object.defineProperties(ts.objectAllocator.getSymbolConstructor().prototype, {
+ __debugFlags: { get: function () { return formatSymbolFlags(this.flags); } }
+ });
+ Object.defineProperties(ts.objectAllocator.getTypeConstructor().prototype, {
+ __debugFlags: { get: function () { return formatTypeFlags(this.flags); } },
+ __debugObjectFlags: { get: function () { return this.flags & 524288 /* Object */ ? formatObjectFlags(this.objectFlags) : ""; } },
+ __debugTypeToString: { value: function () { return this.checker.typeToString(this); } },
+ });
+ var nodeConstructors = [
+ ts.objectAllocator.getNodeConstructor(),
+ ts.objectAllocator.getIdentifierConstructor(),
+ ts.objectAllocator.getTokenConstructor(),
+ ts.objectAllocator.getSourceFileConstructor()
+ ];
+ for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) {
+ var ctor = nodeConstructors_1[_i];
+ if (!ctor.prototype.hasOwnProperty("__debugKind")) {
+ Object.defineProperties(ctor.prototype, {
+ __debugKind: { get: function () { return formatSyntaxKind(this.kind); } },
+ __debugNodeFlags: { get: function () { return formatNodeFlags(this.flags); } },
+ __debugModifierFlags: { get: function () { return formatModifierFlags(ts.getModifierFlagsNoCache(this)); } },
+ __debugTransformFlags: { get: function () { return formatTransformFlags(this.transformFlags); } },
+ __debugIsParseTreeNode: { get: function () { return ts.isParseTreeNode(this); } },
+ __debugEmitFlags: { get: function () { return formatEmitFlags(ts.getEmitFlags(this)); } },
+ __debugGetText: {
+ value: function (includeTrivia) {
+ if (ts.nodeIsSynthesized(this))
+ return "";
+ var parseNode = ts.getParseTreeNode(this);
+ var sourceFile = parseNode && ts.getSourceFileOfNode(parseNode);
+ return sourceFile ? ts.getSourceTextOfNodeFromSourceFile(sourceFile, parseNode, includeTrivia) : "";
+ }
+ }
+ });
+ }
+ }
+ isDebugInfoEnabled = true;
+ }
+ Debug.enableDebugInfo = enableDebugInfo;
+ })(Debug = ts.Debug || (ts.Debug = {}));
})(ts || (ts = {}));
/*@internal*/
var ts;
@@ -2646,309 +2796,311 @@
SyntaxKind[SyntaxKind["QuestionToken"] = 56] = "QuestionToken";
SyntaxKind[SyntaxKind["ColonToken"] = 57] = "ColonToken";
SyntaxKind[SyntaxKind["AtToken"] = 58] = "AtToken";
+ /** Only the JSDoc scanner produces BacktickToken. The normal scanner produces NoSubstitutionTemplateLiteral and related kinds. */
+ SyntaxKind[SyntaxKind["BacktickToken"] = 59] = "BacktickToken";
// Assignments
- SyntaxKind[SyntaxKind["EqualsToken"] = 59] = "EqualsToken";
- SyntaxKind[SyntaxKind["PlusEqualsToken"] = 60] = "PlusEqualsToken";
- SyntaxKind[SyntaxKind["MinusEqualsToken"] = 61] = "MinusEqualsToken";
- SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 62] = "AsteriskEqualsToken";
- SyntaxKind[SyntaxKind["AsteriskAsteriskEqualsToken"] = 63] = "AsteriskAsteriskEqualsToken";
- SyntaxKind[SyntaxKind["SlashEqualsToken"] = 64] = "SlashEqualsToken";
- SyntaxKind[SyntaxKind["PercentEqualsToken"] = 65] = "PercentEqualsToken";
- SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 66] = "LessThanLessThanEqualsToken";
- SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 67] = "GreaterThanGreaterThanEqualsToken";
- SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 68] = "GreaterThanGreaterThanGreaterThanEqualsToken";
- SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 69] = "AmpersandEqualsToken";
- SyntaxKind[SyntaxKind["BarEqualsToken"] = 70] = "BarEqualsToken";
- SyntaxKind[SyntaxKind["CaretEqualsToken"] = 71] = "CaretEqualsToken";
+ SyntaxKind[SyntaxKind["EqualsToken"] = 60] = "EqualsToken";
+ SyntaxKind[SyntaxKind["PlusEqualsToken"] = 61] = "PlusEqualsToken";
+ SyntaxKind[SyntaxKind["MinusEqualsToken"] = 62] = "MinusEqualsToken";
+ SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 63] = "AsteriskEqualsToken";
+ SyntaxKind[SyntaxKind["AsteriskAsteriskEqualsToken"] = 64] = "AsteriskAsteriskEqualsToken";
+ SyntaxKind[SyntaxKind["SlashEqualsToken"] = 65] = "SlashEqualsToken";
+ SyntaxKind[SyntaxKind["PercentEqualsToken"] = 66] = "PercentEqualsToken";
+ SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 67] = "LessThanLessThanEqualsToken";
+ SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 68] = "GreaterThanGreaterThanEqualsToken";
+ SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 69] = "GreaterThanGreaterThanGreaterThanEqualsToken";
+ SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 70] = "AmpersandEqualsToken";
+ SyntaxKind[SyntaxKind["BarEqualsToken"] = 71] = "BarEqualsToken";
+ SyntaxKind[SyntaxKind["CaretEqualsToken"] = 72] = "CaretEqualsToken";
// Identifiers
- SyntaxKind[SyntaxKind["Identifier"] = 72] = "Identifier";
+ SyntaxKind[SyntaxKind["Identifier"] = 73] = "Identifier";
// Reserved words
- SyntaxKind[SyntaxKind["BreakKeyword"] = 73] = "BreakKeyword";
- SyntaxKind[SyntaxKind["CaseKeyword"] = 74] = "CaseKeyword";
- SyntaxKind[SyntaxKind["CatchKeyword"] = 75] = "CatchKeyword";
- SyntaxKind[SyntaxKind["ClassKeyword"] = 76] = "ClassKeyword";
- SyntaxKind[SyntaxKind["ConstKeyword"] = 77] = "ConstKeyword";
- SyntaxKind[SyntaxKind["ContinueKeyword"] = 78] = "ContinueKeyword";
- SyntaxKind[SyntaxKind["DebuggerKeyword"] = 79] = "DebuggerKeyword";
- SyntaxKind[SyntaxKind["DefaultKeyword"] = 80] = "DefaultKeyword";
- SyntaxKind[SyntaxKind["DeleteKeyword"] = 81] = "DeleteKeyword";
- SyntaxKind[SyntaxKind["DoKeyword"] = 82] = "DoKeyword";
- SyntaxKind[SyntaxKind["ElseKeyword"] = 83] = "ElseKeyword";
- SyntaxKind[SyntaxKind["EnumKeyword"] = 84] = "EnumKeyword";
- SyntaxKind[SyntaxKind["ExportKeyword"] = 85] = "ExportKeyword";
- SyntaxKind[SyntaxKind["ExtendsKeyword"] = 86] = "ExtendsKeyword";
- SyntaxKind[SyntaxKind["FalseKeyword"] = 87] = "FalseKeyword";
- SyntaxKind[SyntaxKind["FinallyKeyword"] = 88] = "FinallyKeyword";
- SyntaxKind[SyntaxKind["ForKeyword"] = 89] = "ForKeyword";
- SyntaxKind[SyntaxKind["FunctionKeyword"] = 90] = "FunctionKeyword";
- SyntaxKind[SyntaxKind["IfKeyword"] = 91] = "IfKeyword";
- SyntaxKind[SyntaxKind["ImportKeyword"] = 92] = "ImportKeyword";
- SyntaxKind[SyntaxKind["InKeyword"] = 93] = "InKeyword";
- SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 94] = "InstanceOfKeyword";
- SyntaxKind[SyntaxKind["NewKeyword"] = 95] = "NewKeyword";
- SyntaxKind[SyntaxKind["NullKeyword"] = 96] = "NullKeyword";
- SyntaxKind[SyntaxKind["ReturnKeyword"] = 97] = "ReturnKeyword";
- SyntaxKind[SyntaxKind["SuperKeyword"] = 98] = "SuperKeyword";
- SyntaxKind[SyntaxKind["SwitchKeyword"] = 99] = "SwitchKeyword";
- SyntaxKind[SyntaxKind["ThisKeyword"] = 100] = "ThisKeyword";
- SyntaxKind[SyntaxKind["ThrowKeyword"] = 101] = "ThrowKeyword";
- SyntaxKind[SyntaxKind["TrueKeyword"] = 102] = "TrueKeyword";
- SyntaxKind[SyntaxKind["TryKeyword"] = 103] = "TryKeyword";
- SyntaxKind[SyntaxKind["TypeOfKeyword"] = 104] = "TypeOfKeyword";
- SyntaxKind[SyntaxKind["VarKeyword"] = 105] = "VarKeyword";
- SyntaxKind[SyntaxKind["VoidKeyword"] = 106] = "VoidKeyword";
- SyntaxKind[SyntaxKind["WhileKeyword"] = 107] = "WhileKeyword";
- SyntaxKind[SyntaxKind["WithKeyword"] = 108] = "WithKeyword";
+ SyntaxKind[SyntaxKind["BreakKeyword"] = 74] = "BreakKeyword";
+ SyntaxKind[SyntaxKind["CaseKeyword"] = 75] = "CaseKeyword";
+ SyntaxKind[SyntaxKind["CatchKeyword"] = 76] = "CatchKeyword";
+ SyntaxKind[SyntaxKind["ClassKeyword"] = 77] = "ClassKeyword";
+ SyntaxKind[SyntaxKind["ConstKeyword"] = 78] = "ConstKeyword";
+ SyntaxKind[SyntaxKind["ContinueKeyword"] = 79] = "ContinueKeyword";
+ SyntaxKind[SyntaxKind["DebuggerKeyword"] = 80] = "DebuggerKeyword";
+ SyntaxKind[SyntaxKind["DefaultKeyword"] = 81] = "DefaultKeyword";
+ SyntaxKind[SyntaxKind["DeleteKeyword"] = 82] = "DeleteKeyword";
+ SyntaxKind[SyntaxKind["DoKeyword"] = 83] = "DoKeyword";
+ SyntaxKind[SyntaxKind["ElseKeyword"] = 84] = "ElseKeyword";
+ SyntaxKind[SyntaxKind["EnumKeyword"] = 85] = "EnumKeyword";
+ SyntaxKind[SyntaxKind["ExportKeyword"] = 86] = "ExportKeyword";
+ SyntaxKind[SyntaxKind["ExtendsKeyword"] = 87] = "ExtendsKeyword";
+ SyntaxKind[SyntaxKind["FalseKeyword"] = 88] = "FalseKeyword";
+ SyntaxKind[SyntaxKind["FinallyKeyword"] = 89] = "FinallyKeyword";
+ SyntaxKind[SyntaxKind["ForKeyword"] = 90] = "ForKeyword";
+ SyntaxKind[SyntaxKind["FunctionKeyword"] = 91] = "FunctionKeyword";
+ SyntaxKind[SyntaxKind["IfKeyword"] = 92] = "IfKeyword";
+ SyntaxKind[SyntaxKind["ImportKeyword"] = 93] = "ImportKeyword";
+ SyntaxKind[SyntaxKind["InKeyword"] = 94] = "InKeyword";
+ SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 95] = "InstanceOfKeyword";
+ SyntaxKind[SyntaxKind["NewKeyword"] = 96] = "NewKeyword";
+ SyntaxKind[SyntaxKind["NullKeyword"] = 97] = "NullKeyword";
+ SyntaxKind[SyntaxKind["ReturnKeyword"] = 98] = "ReturnKeyword";
+ SyntaxKind[SyntaxKind["SuperKeyword"] = 99] = "SuperKeyword";
+ SyntaxKind[SyntaxKind["SwitchKeyword"] = 100] = "SwitchKeyword";
+ SyntaxKind[SyntaxKind["ThisKeyword"] = 101] = "ThisKeyword";
+ SyntaxKind[SyntaxKind["ThrowKeyword"] = 102] = "ThrowKeyword";
+ SyntaxKind[SyntaxKind["TrueKeyword"] = 103] = "TrueKeyword";
+ SyntaxKind[SyntaxKind["TryKeyword"] = 104] = "TryKeyword";
+ SyntaxKind[SyntaxKind["TypeOfKeyword"] = 105] = "TypeOfKeyword";
+ SyntaxKind[SyntaxKind["VarKeyword"] = 106] = "VarKeyword";
+ SyntaxKind[SyntaxKind["VoidKeyword"] = 107] = "VoidKeyword";
+ SyntaxKind[SyntaxKind["WhileKeyword"] = 108] = "WhileKeyword";
+ SyntaxKind[SyntaxKind["WithKeyword"] = 109] = "WithKeyword";
// Strict mode reserved words
- SyntaxKind[SyntaxKind["ImplementsKeyword"] = 109] = "ImplementsKeyword";
- SyntaxKind[SyntaxKind["InterfaceKeyword"] = 110] = "InterfaceKeyword";
- SyntaxKind[SyntaxKind["LetKeyword"] = 111] = "LetKeyword";
- SyntaxKind[SyntaxKind["PackageKeyword"] = 112] = "PackageKeyword";
- SyntaxKind[SyntaxKind["PrivateKeyword"] = 113] = "PrivateKeyword";
- SyntaxKind[SyntaxKind["ProtectedKeyword"] = 114] = "ProtectedKeyword";
- SyntaxKind[SyntaxKind["PublicKeyword"] = 115] = "PublicKeyword";
- SyntaxKind[SyntaxKind["StaticKeyword"] = 116] = "StaticKeyword";
- SyntaxKind[SyntaxKind["YieldKeyword"] = 117] = "YieldKeyword";
+ SyntaxKind[SyntaxKind["ImplementsKeyword"] = 110] = "ImplementsKeyword";
+ SyntaxKind[SyntaxKind["InterfaceKeyword"] = 111] = "InterfaceKeyword";
+ SyntaxKind[SyntaxKind["LetKeyword"] = 112] = "LetKeyword";
+ SyntaxKind[SyntaxKind["PackageKeyword"] = 113] = "PackageKeyword";
+ SyntaxKind[SyntaxKind["PrivateKeyword"] = 114] = "PrivateKeyword";
+ SyntaxKind[SyntaxKind["ProtectedKeyword"] = 115] = "ProtectedKeyword";
+ SyntaxKind[SyntaxKind["PublicKeyword"] = 116] = "PublicKeyword";
+ SyntaxKind[SyntaxKind["StaticKeyword"] = 117] = "StaticKeyword";
+ SyntaxKind[SyntaxKind["YieldKeyword"] = 118] = "YieldKeyword";
// Contextual keywords
- SyntaxKind[SyntaxKind["AbstractKeyword"] = 118] = "AbstractKeyword";
- SyntaxKind[SyntaxKind["AsKeyword"] = 119] = "AsKeyword";
- SyntaxKind[SyntaxKind["AnyKeyword"] = 120] = "AnyKeyword";
- SyntaxKind[SyntaxKind["AsyncKeyword"] = 121] = "AsyncKeyword";
- SyntaxKind[SyntaxKind["AwaitKeyword"] = 122] = "AwaitKeyword";
- SyntaxKind[SyntaxKind["BooleanKeyword"] = 123] = "BooleanKeyword";
- SyntaxKind[SyntaxKind["ConstructorKeyword"] = 124] = "ConstructorKeyword";
- SyntaxKind[SyntaxKind["DeclareKeyword"] = 125] = "DeclareKeyword";
- SyntaxKind[SyntaxKind["GetKeyword"] = 126] = "GetKeyword";
- SyntaxKind[SyntaxKind["InferKeyword"] = 127] = "InferKeyword";
- SyntaxKind[SyntaxKind["IsKeyword"] = 128] = "IsKeyword";
- SyntaxKind[SyntaxKind["KeyOfKeyword"] = 129] = "KeyOfKeyword";
- SyntaxKind[SyntaxKind["ModuleKeyword"] = 130] = "ModuleKeyword";
- SyntaxKind[SyntaxKind["NamespaceKeyword"] = 131] = "NamespaceKeyword";
- SyntaxKind[SyntaxKind["NeverKeyword"] = 132] = "NeverKeyword";
- SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 133] = "ReadonlyKeyword";
- SyntaxKind[SyntaxKind["RequireKeyword"] = 134] = "RequireKeyword";
- SyntaxKind[SyntaxKind["NumberKeyword"] = 135] = "NumberKeyword";
- SyntaxKind[SyntaxKind["ObjectKeyword"] = 136] = "ObjectKeyword";
- SyntaxKind[SyntaxKind["SetKeyword"] = 137] = "SetKeyword";
- SyntaxKind[SyntaxKind["StringKeyword"] = 138] = "StringKeyword";
- SyntaxKind[SyntaxKind["SymbolKeyword"] = 139] = "SymbolKeyword";
- SyntaxKind[SyntaxKind["TypeKeyword"] = 140] = "TypeKeyword";
- SyntaxKind[SyntaxKind["UndefinedKeyword"] = 141] = "UndefinedKeyword";
- SyntaxKind[SyntaxKind["UniqueKeyword"] = 142] = "UniqueKeyword";
- SyntaxKind[SyntaxKind["UnknownKeyword"] = 143] = "UnknownKeyword";
- SyntaxKind[SyntaxKind["FromKeyword"] = 144] = "FromKeyword";
- SyntaxKind[SyntaxKind["GlobalKeyword"] = 145] = "GlobalKeyword";
- SyntaxKind[SyntaxKind["BigIntKeyword"] = 146] = "BigIntKeyword";
- SyntaxKind[SyntaxKind["OfKeyword"] = 147] = "OfKeyword";
+ SyntaxKind[SyntaxKind["AbstractKeyword"] = 119] = "AbstractKeyword";
+ SyntaxKind[SyntaxKind["AsKeyword"] = 120] = "AsKeyword";
+ SyntaxKind[SyntaxKind["AnyKeyword"] = 121] = "AnyKeyword";
+ SyntaxKind[SyntaxKind["AsyncKeyword"] = 122] = "AsyncKeyword";
+ SyntaxKind[SyntaxKind["AwaitKeyword"] = 123] = "AwaitKeyword";
+ SyntaxKind[SyntaxKind["BooleanKeyword"] = 124] = "BooleanKeyword";
+ SyntaxKind[SyntaxKind["ConstructorKeyword"] = 125] = "ConstructorKeyword";
+ SyntaxKind[SyntaxKind["DeclareKeyword"] = 126] = "DeclareKeyword";
+ SyntaxKind[SyntaxKind["GetKeyword"] = 127] = "GetKeyword";
+ SyntaxKind[SyntaxKind["InferKeyword"] = 128] = "InferKeyword";
+ SyntaxKind[SyntaxKind["IsKeyword"] = 129] = "IsKeyword";
+ SyntaxKind[SyntaxKind["KeyOfKeyword"] = 130] = "KeyOfKeyword";
+ SyntaxKind[SyntaxKind["ModuleKeyword"] = 131] = "ModuleKeyword";
+ SyntaxKind[SyntaxKind["NamespaceKeyword"] = 132] = "NamespaceKeyword";
+ SyntaxKind[SyntaxKind["NeverKeyword"] = 133] = "NeverKeyword";
+ SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 134] = "ReadonlyKeyword";
+ SyntaxKind[SyntaxKind["RequireKeyword"] = 135] = "RequireKeyword";
+ SyntaxKind[SyntaxKind["NumberKeyword"] = 136] = "NumberKeyword";
+ SyntaxKind[SyntaxKind["ObjectKeyword"] = 137] = "ObjectKeyword";
+ SyntaxKind[SyntaxKind["SetKeyword"] = 138] = "SetKeyword";
+ SyntaxKind[SyntaxKind["StringKeyword"] = 139] = "StringKeyword";
+ SyntaxKind[SyntaxKind["SymbolKeyword"] = 140] = "SymbolKeyword";
+ SyntaxKind[SyntaxKind["TypeKeyword"] = 141] = "TypeKeyword";
+ SyntaxKind[SyntaxKind["UndefinedKeyword"] = 142] = "UndefinedKeyword";
+ SyntaxKind[SyntaxKind["UniqueKeyword"] = 143] = "UniqueKeyword";
+ SyntaxKind[SyntaxKind["UnknownKeyword"] = 144] = "UnknownKeyword";
+ SyntaxKind[SyntaxKind["FromKeyword"] = 145] = "FromKeyword";
+ SyntaxKind[SyntaxKind["GlobalKeyword"] = 146] = "GlobalKeyword";
+ SyntaxKind[SyntaxKind["BigIntKeyword"] = 147] = "BigIntKeyword";
+ SyntaxKind[SyntaxKind["OfKeyword"] = 148] = "OfKeyword";
// Parse tree nodes
// Names
- SyntaxKind[SyntaxKind["QualifiedName"] = 148] = "QualifiedName";
- SyntaxKind[SyntaxKind["ComputedPropertyName"] = 149] = "ComputedPropertyName";
+ SyntaxKind[SyntaxKind["QualifiedName"] = 149] = "QualifiedName";
+ SyntaxKind[SyntaxKind["ComputedPropertyName"] = 150] = "ComputedPropertyName";
// Signature elements
- SyntaxKind[SyntaxKind["TypeParameter"] = 150] = "TypeParameter";
- SyntaxKind[SyntaxKind["Parameter"] = 151] = "Parameter";
- SyntaxKind[SyntaxKind["Decorator"] = 152] = "Decorator";
+ SyntaxKind[SyntaxKind["TypeParameter"] = 151] = "TypeParameter";
+ SyntaxKind[SyntaxKind["Parameter"] = 152] = "Parameter";
+ SyntaxKind[SyntaxKind["Decorator"] = 153] = "Decorator";
// TypeMember
- SyntaxKind[SyntaxKind["PropertySignature"] = 153] = "PropertySignature";
- SyntaxKind[SyntaxKind["PropertyDeclaration"] = 154] = "PropertyDeclaration";
- SyntaxKind[SyntaxKind["MethodSignature"] = 155] = "MethodSignature";
- SyntaxKind[SyntaxKind["MethodDeclaration"] = 156] = "MethodDeclaration";
- SyntaxKind[SyntaxKind["Constructor"] = 157] = "Constructor";
- SyntaxKind[SyntaxKind["GetAccessor"] = 158] = "GetAccessor";
- SyntaxKind[SyntaxKind["SetAccessor"] = 159] = "SetAccessor";
- SyntaxKind[SyntaxKind["CallSignature"] = 160] = "CallSignature";
- SyntaxKind[SyntaxKind["ConstructSignature"] = 161] = "ConstructSignature";
- SyntaxKind[SyntaxKind["IndexSignature"] = 162] = "IndexSignature";
+ SyntaxKind[SyntaxKind["PropertySignature"] = 154] = "PropertySignature";
+ SyntaxKind[SyntaxKind["PropertyDeclaration"] = 155] = "PropertyDeclaration";
+ SyntaxKind[SyntaxKind["MethodSignature"] = 156] = "MethodSignature";
+ SyntaxKind[SyntaxKind["MethodDeclaration"] = 157] = "MethodDeclaration";
+ SyntaxKind[SyntaxKind["Constructor"] = 158] = "Constructor";
+ SyntaxKind[SyntaxKind["GetAccessor"] = 159] = "GetAccessor";
+ SyntaxKind[SyntaxKind["SetAccessor"] = 160] = "SetAccessor";
+ SyntaxKind[SyntaxKind["CallSignature"] = 161] = "CallSignature";
+ SyntaxKind[SyntaxKind["ConstructSignature"] = 162] = "ConstructSignature";
+ SyntaxKind[SyntaxKind["IndexSignature"] = 163] = "IndexSignature";
// Type
- SyntaxKind[SyntaxKind["TypePredicate"] = 163] = "TypePredicate";
- SyntaxKind[SyntaxKind["TypeReference"] = 164] = "TypeReference";
- SyntaxKind[SyntaxKind["FunctionType"] = 165] = "FunctionType";
- SyntaxKind[SyntaxKind["ConstructorType"] = 166] = "ConstructorType";
- SyntaxKind[SyntaxKind["TypeQuery"] = 167] = "TypeQuery";
- SyntaxKind[SyntaxKind["TypeLiteral"] = 168] = "TypeLiteral";
- SyntaxKind[SyntaxKind["ArrayType"] = 169] = "ArrayType";
- SyntaxKind[SyntaxKind["TupleType"] = 170] = "TupleType";
- SyntaxKind[SyntaxKind["OptionalType"] = 171] = "OptionalType";
- SyntaxKind[SyntaxKind["RestType"] = 172] = "RestType";
- SyntaxKind[SyntaxKind["UnionType"] = 173] = "UnionType";
- SyntaxKind[SyntaxKind["IntersectionType"] = 174] = "IntersectionType";
- SyntaxKind[SyntaxKind["ConditionalType"] = 175] = "ConditionalType";
- SyntaxKind[SyntaxKind["InferType"] = 176] = "InferType";
- SyntaxKind[SyntaxKind["ParenthesizedType"] = 177] = "ParenthesizedType";
- SyntaxKind[SyntaxKind["ThisType"] = 178] = "ThisType";
- SyntaxKind[SyntaxKind["TypeOperator"] = 179] = "TypeOperator";
- SyntaxKind[SyntaxKind["IndexedAccessType"] = 180] = "IndexedAccessType";
- SyntaxKind[SyntaxKind["MappedType"] = 181] = "MappedType";
- SyntaxKind[SyntaxKind["LiteralType"] = 182] = "LiteralType";
- SyntaxKind[SyntaxKind["ImportType"] = 183] = "ImportType";
+ SyntaxKind[SyntaxKind["TypePredicate"] = 164] = "TypePredicate";
+ SyntaxKind[SyntaxKind["TypeReference"] = 165] = "TypeReference";
+ SyntaxKind[SyntaxKind["FunctionType"] = 166] = "FunctionType";
+ SyntaxKind[SyntaxKind["ConstructorType"] = 167] = "ConstructorType";
+ SyntaxKind[SyntaxKind["TypeQuery"] = 168] = "TypeQuery";
+ SyntaxKind[SyntaxKind["TypeLiteral"] = 169] = "TypeLiteral";
+ SyntaxKind[SyntaxKind["ArrayType"] = 170] = "ArrayType";
+ SyntaxKind[SyntaxKind["TupleType"] = 171] = "TupleType";
+ SyntaxKind[SyntaxKind["OptionalType"] = 172] = "OptionalType";
+ SyntaxKind[SyntaxKind["RestType"] = 173] = "RestType";
+ SyntaxKind[SyntaxKind["UnionType"] = 174] = "UnionType";
+ SyntaxKind[SyntaxKind["IntersectionType"] = 175] = "IntersectionType";
+ SyntaxKind[SyntaxKind["ConditionalType"] = 176] = "ConditionalType";
+ SyntaxKind[SyntaxKind["InferType"] = 177] = "InferType";
+ SyntaxKind[SyntaxKind["ParenthesizedType"] = 178] = "ParenthesizedType";
+ SyntaxKind[SyntaxKind["ThisType"] = 179] = "ThisType";
+ SyntaxKind[SyntaxKind["TypeOperator"] = 180] = "TypeOperator";
+ SyntaxKind[SyntaxKind["IndexedAccessType"] = 181] = "IndexedAccessType";
+ SyntaxKind[SyntaxKind["MappedType"] = 182] = "MappedType";
+ SyntaxKind[SyntaxKind["LiteralType"] = 183] = "LiteralType";
+ SyntaxKind[SyntaxKind["ImportType"] = 184] = "ImportType";
// Binding patterns
- SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 184] = "ObjectBindingPattern";
- SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 185] = "ArrayBindingPattern";
- SyntaxKind[SyntaxKind["BindingElement"] = 186] = "BindingElement";
+ SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 185] = "ObjectBindingPattern";
+ SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 186] = "ArrayBindingPattern";
+ SyntaxKind[SyntaxKind["BindingElement"] = 187] = "BindingElement";
// Expression
- SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 187] = "ArrayLiteralExpression";
- SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 188] = "ObjectLiteralExpression";
- SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 189] = "PropertyAccessExpression";
- SyntaxKind[SyntaxKind["ElementAccessExpression"] = 190] = "ElementAccessExpression";
- SyntaxKind[SyntaxKind["CallExpression"] = 191] = "CallExpression";
- SyntaxKind[SyntaxKind["NewExpression"] = 192] = "NewExpression";
- SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 193] = "TaggedTemplateExpression";
- SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 194] = "TypeAssertionExpression";
- SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 195] = "ParenthesizedExpression";
- SyntaxKind[SyntaxKind["FunctionExpression"] = 196] = "FunctionExpression";
- SyntaxKind[SyntaxKind["ArrowFunction"] = 197] = "ArrowFunction";
- SyntaxKind[SyntaxKind["DeleteExpression"] = 198] = "DeleteExpression";
- SyntaxKind[SyntaxKind["TypeOfExpression"] = 199] = "TypeOfExpression";
- SyntaxKind[SyntaxKind["VoidExpression"] = 200] = "VoidExpression";
- SyntaxKind[SyntaxKind["AwaitExpression"] = 201] = "AwaitExpression";
- SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 202] = "PrefixUnaryExpression";
- SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 203] = "PostfixUnaryExpression";
- SyntaxKind[SyntaxKind["BinaryExpression"] = 204] = "BinaryExpression";
- SyntaxKind[SyntaxKind["ConditionalExpression"] = 205] = "ConditionalExpression";
- SyntaxKind[SyntaxKind["TemplateExpression"] = 206] = "TemplateExpression";
- SyntaxKind[SyntaxKind["YieldExpression"] = 207] = "YieldExpression";
- SyntaxKind[SyntaxKind["SpreadElement"] = 208] = "SpreadElement";
- SyntaxKind[SyntaxKind["ClassExpression"] = 209] = "ClassExpression";
- SyntaxKind[SyntaxKind["OmittedExpression"] = 210] = "OmittedExpression";
- SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 211] = "ExpressionWithTypeArguments";
- SyntaxKind[SyntaxKind["AsExpression"] = 212] = "AsExpression";
- SyntaxKind[SyntaxKind["NonNullExpression"] = 213] = "NonNullExpression";
- SyntaxKind[SyntaxKind["MetaProperty"] = 214] = "MetaProperty";
- SyntaxKind[SyntaxKind["SyntheticExpression"] = 215] = "SyntheticExpression";
+ SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 188] = "ArrayLiteralExpression";
+ SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 189] = "ObjectLiteralExpression";
+ SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 190] = "PropertyAccessExpression";
+ SyntaxKind[SyntaxKind["ElementAccessExpression"] = 191] = "ElementAccessExpression";
+ SyntaxKind[SyntaxKind["CallExpression"] = 192] = "CallExpression";
+ SyntaxKind[SyntaxKind["NewExpression"] = 193] = "NewExpression";
+ SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 194] = "TaggedTemplateExpression";
+ SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 195] = "TypeAssertionExpression";
+ SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 196] = "ParenthesizedExpression";
+ SyntaxKind[SyntaxKind["FunctionExpression"] = 197] = "FunctionExpression";
+ SyntaxKind[SyntaxKind["ArrowFunction"] = 198] = "ArrowFunction";
+ SyntaxKind[SyntaxKind["DeleteExpression"] = 199] = "DeleteExpression";
+ SyntaxKind[SyntaxKind["TypeOfExpression"] = 200] = "TypeOfExpression";
+ SyntaxKind[SyntaxKind["VoidExpression"] = 201] = "VoidExpression";
+ SyntaxKind[SyntaxKind["AwaitExpression"] = 202] = "AwaitExpression";
+ SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 203] = "PrefixUnaryExpression";
+ SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 204] = "PostfixUnaryExpression";
+ SyntaxKind[SyntaxKind["BinaryExpression"] = 205] = "BinaryExpression";
+ SyntaxKind[SyntaxKind["ConditionalExpression"] = 206] = "ConditionalExpression";
+ SyntaxKind[SyntaxKind["TemplateExpression"] = 207] = "TemplateExpression";
+ SyntaxKind[SyntaxKind["YieldExpression"] = 208] = "YieldExpression";
+ SyntaxKind[SyntaxKind["SpreadElement"] = 209] = "SpreadElement";
+ SyntaxKind[SyntaxKind["ClassExpression"] = 210] = "ClassExpression";
+ SyntaxKind[SyntaxKind["OmittedExpression"] = 211] = "OmittedExpression";
+ SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 212] = "ExpressionWithTypeArguments";
+ SyntaxKind[SyntaxKind["AsExpression"] = 213] = "AsExpression";
+ SyntaxKind[SyntaxKind["NonNullExpression"] = 214] = "NonNullExpression";
+ SyntaxKind[SyntaxKind["MetaProperty"] = 215] = "MetaProperty";
+ SyntaxKind[SyntaxKind["SyntheticExpression"] = 216] = "SyntheticExpression";
// Misc
- SyntaxKind[SyntaxKind["TemplateSpan"] = 216] = "TemplateSpan";
- SyntaxKind[SyntaxKind["SemicolonClassElement"] = 217] = "SemicolonClassElement";
+ SyntaxKind[SyntaxKind["TemplateSpan"] = 217] = "TemplateSpan";
+ SyntaxKind[SyntaxKind["SemicolonClassElement"] = 218] = "SemicolonClassElement";
// Element
- SyntaxKind[SyntaxKind["Block"] = 218] = "Block";
- SyntaxKind[SyntaxKind["VariableStatement"] = 219] = "VariableStatement";
- SyntaxKind[SyntaxKind["EmptyStatement"] = 220] = "EmptyStatement";
- SyntaxKind[SyntaxKind["ExpressionStatement"] = 221] = "ExpressionStatement";
- SyntaxKind[SyntaxKind["IfStatement"] = 222] = "IfStatement";
- SyntaxKind[SyntaxKind["DoStatement"] = 223] = "DoStatement";
- SyntaxKind[SyntaxKind["WhileStatement"] = 224] = "WhileStatement";
- SyntaxKind[SyntaxKind["ForStatement"] = 225] = "ForStatement";
- SyntaxKind[SyntaxKind["ForInStatement"] = 226] = "ForInStatement";
- SyntaxKind[SyntaxKind["ForOfStatement"] = 227] = "ForOfStatement";
- SyntaxKind[SyntaxKind["ContinueStatement"] = 228] = "ContinueStatement";
- SyntaxKind[SyntaxKind["BreakStatement"] = 229] = "BreakStatement";
- SyntaxKind[SyntaxKind["ReturnStatement"] = 230] = "ReturnStatement";
- SyntaxKind[SyntaxKind["WithStatement"] = 231] = "WithStatement";
- SyntaxKind[SyntaxKind["SwitchStatement"] = 232] = "SwitchStatement";
- SyntaxKind[SyntaxKind["LabeledStatement"] = 233] = "LabeledStatement";
- SyntaxKind[SyntaxKind["ThrowStatement"] = 234] = "ThrowStatement";
- SyntaxKind[SyntaxKind["TryStatement"] = 235] = "TryStatement";
- SyntaxKind[SyntaxKind["DebuggerStatement"] = 236] = "DebuggerStatement";
- SyntaxKind[SyntaxKind["VariableDeclaration"] = 237] = "VariableDeclaration";
- SyntaxKind[SyntaxKind["VariableDeclarationList"] = 238] = "VariableDeclarationList";
- SyntaxKind[SyntaxKind["FunctionDeclaration"] = 239] = "FunctionDeclaration";
- SyntaxKind[SyntaxKind["ClassDeclaration"] = 240] = "ClassDeclaration";
- SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 241] = "InterfaceDeclaration";
- SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 242] = "TypeAliasDeclaration";
- SyntaxKind[SyntaxKind["EnumDeclaration"] = 243] = "EnumDeclaration";
- SyntaxKind[SyntaxKind["ModuleDeclaration"] = 244] = "ModuleDeclaration";
- SyntaxKind[SyntaxKind["ModuleBlock"] = 245] = "ModuleBlock";
- SyntaxKind[SyntaxKind["CaseBlock"] = 246] = "CaseBlock";
- SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 247] = "NamespaceExportDeclaration";
- SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 248] = "ImportEqualsDeclaration";
- SyntaxKind[SyntaxKind["ImportDeclaration"] = 249] = "ImportDeclaration";
- SyntaxKind[SyntaxKind["ImportClause"] = 250] = "ImportClause";
- SyntaxKind[SyntaxKind["NamespaceImport"] = 251] = "NamespaceImport";
- SyntaxKind[SyntaxKind["NamedImports"] = 252] = "NamedImports";
- SyntaxKind[SyntaxKind["ImportSpecifier"] = 253] = "ImportSpecifier";
- SyntaxKind[SyntaxKind["ExportAssignment"] = 254] = "ExportAssignment";
- SyntaxKind[SyntaxKind["ExportDeclaration"] = 255] = "ExportDeclaration";
- SyntaxKind[SyntaxKind["NamedExports"] = 256] = "NamedExports";
- SyntaxKind[SyntaxKind["ExportSpecifier"] = 257] = "ExportSpecifier";
- SyntaxKind[SyntaxKind["MissingDeclaration"] = 258] = "MissingDeclaration";
+ SyntaxKind[SyntaxKind["Block"] = 219] = "Block";
+ SyntaxKind[SyntaxKind["VariableStatement"] = 220] = "VariableStatement";
+ SyntaxKind[SyntaxKind["EmptyStatement"] = 221] = "EmptyStatement";
+ SyntaxKind[SyntaxKind["ExpressionStatement"] = 222] = "ExpressionStatement";
+ SyntaxKind[SyntaxKind["IfStatement"] = 223] = "IfStatement";
+ SyntaxKind[SyntaxKind["DoStatement"] = 224] = "DoStatement";
+ SyntaxKind[SyntaxKind["WhileStatement"] = 225] = "WhileStatement";
+ SyntaxKind[SyntaxKind["ForStatement"] = 226] = "ForStatement";
+ SyntaxKind[SyntaxKind["ForInStatement"] = 227] = "ForInStatement";
+ SyntaxKind[SyntaxKind["ForOfStatement"] = 228] = "ForOfStatement";
+ SyntaxKind[SyntaxKind["ContinueStatement"] = 229] = "ContinueStatement";
+ SyntaxKind[SyntaxKind["BreakStatement"] = 230] = "BreakStatement";
+ SyntaxKind[SyntaxKind["ReturnStatement"] = 231] = "ReturnStatement";
+ SyntaxKind[SyntaxKind["WithStatement"] = 232] = "WithStatement";
+ SyntaxKind[SyntaxKind["SwitchStatement"] = 233] = "SwitchStatement";
+ SyntaxKind[SyntaxKind["LabeledStatement"] = 234] = "LabeledStatement";
+ SyntaxKind[SyntaxKind["ThrowStatement"] = 235] = "ThrowStatement";
+ SyntaxKind[SyntaxKind["TryStatement"] = 236] = "TryStatement";
+ SyntaxKind[SyntaxKind["DebuggerStatement"] = 237] = "DebuggerStatement";
+ SyntaxKind[SyntaxKind["VariableDeclaration"] = 238] = "VariableDeclaration";
+ SyntaxKind[SyntaxKind["VariableDeclarationList"] = 239] = "VariableDeclarationList";
+ SyntaxKind[SyntaxKind["FunctionDeclaration"] = 240] = "FunctionDeclaration";
+ SyntaxKind[SyntaxKind["ClassDeclaration"] = 241] = "ClassDeclaration";
+ SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 242] = "InterfaceDeclaration";
+ SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 243] = "TypeAliasDeclaration";
+ SyntaxKind[SyntaxKind["EnumDeclaration"] = 244] = "EnumDeclaration";
+ SyntaxKind[SyntaxKind["ModuleDeclaration"] = 245] = "ModuleDeclaration";
+ SyntaxKind[SyntaxKind["ModuleBlock"] = 246] = "ModuleBlock";
+ SyntaxKind[SyntaxKind["CaseBlock"] = 247] = "CaseBlock";
+ SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 248] = "NamespaceExportDeclaration";
+ SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 249] = "ImportEqualsDeclaration";
+ SyntaxKind[SyntaxKind["ImportDeclaration"] = 250] = "ImportDeclaration";
+ SyntaxKind[SyntaxKind["ImportClause"] = 251] = "ImportClause";
+ SyntaxKind[SyntaxKind["NamespaceImport"] = 252] = "NamespaceImport";
+ SyntaxKind[SyntaxKind["NamedImports"] = 253] = "NamedImports";
+ SyntaxKind[SyntaxKind["ImportSpecifier"] = 254] = "ImportSpecifier";
+ SyntaxKind[SyntaxKind["ExportAssignment"] = 255] = "ExportAssignment";
+ SyntaxKind[SyntaxKind["ExportDeclaration"] = 256] = "ExportDeclaration";
+ SyntaxKind[SyntaxKind["NamedExports"] = 257] = "NamedExports";
+ SyntaxKind[SyntaxKind["ExportSpecifier"] = 258] = "ExportSpecifier";
+ SyntaxKind[SyntaxKind["MissingDeclaration"] = 259] = "MissingDeclaration";
// Module references
- SyntaxKind[SyntaxKind["ExternalModuleReference"] = 259] = "ExternalModuleReference";
+ SyntaxKind[SyntaxKind["ExternalModuleReference"] = 260] = "ExternalModuleReference";
// JSX
- SyntaxKind[SyntaxKind["JsxElement"] = 260] = "JsxElement";
- SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 261] = "JsxSelfClosingElement";
- SyntaxKind[SyntaxKind["JsxOpeningElement"] = 262] = "JsxOpeningElement";
- SyntaxKind[SyntaxKind["JsxClosingElement"] = 263] = "JsxClosingElement";
- SyntaxKind[SyntaxKind["JsxFragment"] = 264] = "JsxFragment";
- SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 265] = "JsxOpeningFragment";
- SyntaxKind[SyntaxKind["JsxClosingFragment"] = 266] = "JsxClosingFragment";
- SyntaxKind[SyntaxKind["JsxAttribute"] = 267] = "JsxAttribute";
- SyntaxKind[SyntaxKind["JsxAttributes"] = 268] = "JsxAttributes";
- SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 269] = "JsxSpreadAttribute";
- SyntaxKind[SyntaxKind["JsxExpression"] = 270] = "JsxExpression";
+ SyntaxKind[SyntaxKind["JsxElement"] = 261] = "JsxElement";
+ SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 262] = "JsxSelfClosingElement";
+ SyntaxKind[SyntaxKind["JsxOpeningElement"] = 263] = "JsxOpeningElement";
+ SyntaxKind[SyntaxKind["JsxClosingElement"] = 264] = "JsxClosingElement";
+ SyntaxKind[SyntaxKind["JsxFragment"] = 265] = "JsxFragment";
+ SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 266] = "JsxOpeningFragment";
+ SyntaxKind[SyntaxKind["JsxClosingFragment"] = 267] = "JsxClosingFragment";
+ SyntaxKind[SyntaxKind["JsxAttribute"] = 268] = "JsxAttribute";
+ SyntaxKind[SyntaxKind["JsxAttributes"] = 269] = "JsxAttributes";
+ SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 270] = "JsxSpreadAttribute";
+ SyntaxKind[SyntaxKind["JsxExpression"] = 271] = "JsxExpression";
// Clauses
- SyntaxKind[SyntaxKind["CaseClause"] = 271] = "CaseClause";
- SyntaxKind[SyntaxKind["DefaultClause"] = 272] = "DefaultClause";
- SyntaxKind[SyntaxKind["HeritageClause"] = 273] = "HeritageClause";
- SyntaxKind[SyntaxKind["CatchClause"] = 274] = "CatchClause";
+ SyntaxKind[SyntaxKind["CaseClause"] = 272] = "CaseClause";
+ SyntaxKind[SyntaxKind["DefaultClause"] = 273] = "DefaultClause";
+ SyntaxKind[SyntaxKind["HeritageClause"] = 274] = "HeritageClause";
+ SyntaxKind[SyntaxKind["CatchClause"] = 275] = "CatchClause";
// Property assignments
- SyntaxKind[SyntaxKind["PropertyAssignment"] = 275] = "PropertyAssignment";
- SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 276] = "ShorthandPropertyAssignment";
- SyntaxKind[SyntaxKind["SpreadAssignment"] = 277] = "SpreadAssignment";
+ SyntaxKind[SyntaxKind["PropertyAssignment"] = 276] = "PropertyAssignment";
+ SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 277] = "ShorthandPropertyAssignment";
+ SyntaxKind[SyntaxKind["SpreadAssignment"] = 278] = "SpreadAssignment";
// Enum
- SyntaxKind[SyntaxKind["EnumMember"] = 278] = "EnumMember";
+ SyntaxKind[SyntaxKind["EnumMember"] = 279] = "EnumMember";
// Unparsed
- SyntaxKind[SyntaxKind["UnparsedPrologue"] = 279] = "UnparsedPrologue";
- SyntaxKind[SyntaxKind["UnparsedPrepend"] = 280] = "UnparsedPrepend";
- SyntaxKind[SyntaxKind["UnparsedText"] = 281] = "UnparsedText";
- SyntaxKind[SyntaxKind["UnparsedInternalText"] = 282] = "UnparsedInternalText";
- SyntaxKind[SyntaxKind["UnparsedSyntheticReference"] = 283] = "UnparsedSyntheticReference";
+ SyntaxKind[SyntaxKind["UnparsedPrologue"] = 280] = "UnparsedPrologue";
+ SyntaxKind[SyntaxKind["UnparsedPrepend"] = 281] = "UnparsedPrepend";
+ SyntaxKind[SyntaxKind["UnparsedText"] = 282] = "UnparsedText";
+ SyntaxKind[SyntaxKind["UnparsedInternalText"] = 283] = "UnparsedInternalText";
+ SyntaxKind[SyntaxKind["UnparsedSyntheticReference"] = 284] = "UnparsedSyntheticReference";
// Top-level nodes
- SyntaxKind[SyntaxKind["SourceFile"] = 284] = "SourceFile";
- SyntaxKind[SyntaxKind["Bundle"] = 285] = "Bundle";
- SyntaxKind[SyntaxKind["UnparsedSource"] = 286] = "UnparsedSource";
- SyntaxKind[SyntaxKind["InputFiles"] = 287] = "InputFiles";
+ SyntaxKind[SyntaxKind["SourceFile"] = 285] = "SourceFile";
+ SyntaxKind[SyntaxKind["Bundle"] = 286] = "Bundle";
+ SyntaxKind[SyntaxKind["UnparsedSource"] = 287] = "UnparsedSource";
+ SyntaxKind[SyntaxKind["InputFiles"] = 288] = "InputFiles";
// JSDoc nodes
- SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 288] = "JSDocTypeExpression";
+ SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 289] = "JSDocTypeExpression";
// The * type
- SyntaxKind[SyntaxKind["JSDocAllType"] = 289] = "JSDocAllType";
+ SyntaxKind[SyntaxKind["JSDocAllType"] = 290] = "JSDocAllType";
// The ? type
- SyntaxKind[SyntaxKind["JSDocUnknownType"] = 290] = "JSDocUnknownType";
- SyntaxKind[SyntaxKind["JSDocNullableType"] = 291] = "JSDocNullableType";
- SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 292] = "JSDocNonNullableType";
- SyntaxKind[SyntaxKind["JSDocOptionalType"] = 293] = "JSDocOptionalType";
- SyntaxKind[SyntaxKind["JSDocFunctionType"] = 294] = "JSDocFunctionType";
- SyntaxKind[SyntaxKind["JSDocVariadicType"] = 295] = "JSDocVariadicType";
- SyntaxKind[SyntaxKind["JSDocComment"] = 296] = "JSDocComment";
- SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 297] = "JSDocTypeLiteral";
- SyntaxKind[SyntaxKind["JSDocSignature"] = 298] = "JSDocSignature";
- SyntaxKind[SyntaxKind["JSDocTag"] = 299] = "JSDocTag";
- SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 300] = "JSDocAugmentsTag";
- SyntaxKind[SyntaxKind["JSDocClassTag"] = 301] = "JSDocClassTag";
- SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 302] = "JSDocCallbackTag";
- SyntaxKind[SyntaxKind["JSDocEnumTag"] = 303] = "JSDocEnumTag";
- SyntaxKind[SyntaxKind["JSDocParameterTag"] = 304] = "JSDocParameterTag";
- SyntaxKind[SyntaxKind["JSDocReturnTag"] = 305] = "JSDocReturnTag";
- SyntaxKind[SyntaxKind["JSDocThisTag"] = 306] = "JSDocThisTag";
- SyntaxKind[SyntaxKind["JSDocTypeTag"] = 307] = "JSDocTypeTag";
- SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 308] = "JSDocTemplateTag";
- SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 309] = "JSDocTypedefTag";
- SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 310] = "JSDocPropertyTag";
+ SyntaxKind[SyntaxKind["JSDocUnknownType"] = 291] = "JSDocUnknownType";
+ SyntaxKind[SyntaxKind["JSDocNullableType"] = 292] = "JSDocNullableType";
+ SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 293] = "JSDocNonNullableType";
+ SyntaxKind[SyntaxKind["JSDocOptionalType"] = 294] = "JSDocOptionalType";
+ SyntaxKind[SyntaxKind["JSDocFunctionType"] = 295] = "JSDocFunctionType";
+ SyntaxKind[SyntaxKind["JSDocVariadicType"] = 296] = "JSDocVariadicType";
+ SyntaxKind[SyntaxKind["JSDocComment"] = 297] = "JSDocComment";
+ SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 298] = "JSDocTypeLiteral";
+ SyntaxKind[SyntaxKind["JSDocSignature"] = 299] = "JSDocSignature";
+ SyntaxKind[SyntaxKind["JSDocTag"] = 300] = "JSDocTag";
+ SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 301] = "JSDocAugmentsTag";
+ SyntaxKind[SyntaxKind["JSDocClassTag"] = 302] = "JSDocClassTag";
+ SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 303] = "JSDocCallbackTag";
+ SyntaxKind[SyntaxKind["JSDocEnumTag"] = 304] = "JSDocEnumTag";
+ SyntaxKind[SyntaxKind["JSDocParameterTag"] = 305] = "JSDocParameterTag";
+ SyntaxKind[SyntaxKind["JSDocReturnTag"] = 306] = "JSDocReturnTag";
+ SyntaxKind[SyntaxKind["JSDocThisTag"] = 307] = "JSDocThisTag";
+ SyntaxKind[SyntaxKind["JSDocTypeTag"] = 308] = "JSDocTypeTag";
+ SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 309] = "JSDocTemplateTag";
+ SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 310] = "JSDocTypedefTag";
+ SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 311] = "JSDocPropertyTag";
// Synthesized list
- SyntaxKind[SyntaxKind["SyntaxList"] = 311] = "SyntaxList";
+ SyntaxKind[SyntaxKind["SyntaxList"] = 312] = "SyntaxList";
// Transformation nodes
- SyntaxKind[SyntaxKind["NotEmittedStatement"] = 312] = "NotEmittedStatement";
- SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 313] = "PartiallyEmittedExpression";
- SyntaxKind[SyntaxKind["CommaListExpression"] = 314] = "CommaListExpression";
- SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 315] = "MergeDeclarationMarker";
- SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 316] = "EndOfDeclarationMarker";
+ SyntaxKind[SyntaxKind["NotEmittedStatement"] = 313] = "NotEmittedStatement";
+ SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 314] = "PartiallyEmittedExpression";
+ SyntaxKind[SyntaxKind["CommaListExpression"] = 315] = "CommaListExpression";
+ SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 316] = "MergeDeclarationMarker";
+ SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 317] = "EndOfDeclarationMarker";
// Enum value count
- SyntaxKind[SyntaxKind["Count"] = 317] = "Count";
+ SyntaxKind[SyntaxKind["Count"] = 318] = "Count";
// Markers
- SyntaxKind[SyntaxKind["FirstAssignment"] = 59] = "FirstAssignment";
- SyntaxKind[SyntaxKind["LastAssignment"] = 71] = "LastAssignment";
- SyntaxKind[SyntaxKind["FirstCompoundAssignment"] = 60] = "FirstCompoundAssignment";
- SyntaxKind[SyntaxKind["LastCompoundAssignment"] = 71] = "LastCompoundAssignment";
- SyntaxKind[SyntaxKind["FirstReservedWord"] = 73] = "FirstReservedWord";
- SyntaxKind[SyntaxKind["LastReservedWord"] = 108] = "LastReservedWord";
- SyntaxKind[SyntaxKind["FirstKeyword"] = 73] = "FirstKeyword";
- SyntaxKind[SyntaxKind["LastKeyword"] = 147] = "LastKeyword";
- SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 109] = "FirstFutureReservedWord";
- SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 117] = "LastFutureReservedWord";
- SyntaxKind[SyntaxKind["FirstTypeNode"] = 163] = "FirstTypeNode";
- SyntaxKind[SyntaxKind["LastTypeNode"] = 183] = "LastTypeNode";
+ SyntaxKind[SyntaxKind["FirstAssignment"] = 60] = "FirstAssignment";
+ SyntaxKind[SyntaxKind["LastAssignment"] = 72] = "LastAssignment";
+ SyntaxKind[SyntaxKind["FirstCompoundAssignment"] = 61] = "FirstCompoundAssignment";
+ SyntaxKind[SyntaxKind["LastCompoundAssignment"] = 72] = "LastCompoundAssignment";
+ SyntaxKind[SyntaxKind["FirstReservedWord"] = 74] = "FirstReservedWord";
+ SyntaxKind[SyntaxKind["LastReservedWord"] = 109] = "LastReservedWord";
+ SyntaxKind[SyntaxKind["FirstKeyword"] = 74] = "FirstKeyword";
+ SyntaxKind[SyntaxKind["LastKeyword"] = 148] = "LastKeyword";
+ SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 110] = "FirstFutureReservedWord";
+ SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 118] = "LastFutureReservedWord";
+ SyntaxKind[SyntaxKind["FirstTypeNode"] = 164] = "FirstTypeNode";
+ SyntaxKind[SyntaxKind["LastTypeNode"] = 184] = "LastTypeNode";
SyntaxKind[SyntaxKind["FirstPunctuation"] = 18] = "FirstPunctuation";
- SyntaxKind[SyntaxKind["LastPunctuation"] = 71] = "LastPunctuation";
+ SyntaxKind[SyntaxKind["LastPunctuation"] = 72] = "LastPunctuation";
SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken";
- SyntaxKind[SyntaxKind["LastToken"] = 147] = "LastToken";
+ SyntaxKind[SyntaxKind["LastToken"] = 148] = "LastToken";
SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken";
SyntaxKind[SyntaxKind["LastTriviaToken"] = 7] = "LastTriviaToken";
SyntaxKind[SyntaxKind["FirstLiteralToken"] = 8] = "FirstLiteralToken";
@@ -2956,14 +3108,14 @@
SyntaxKind[SyntaxKind["FirstTemplateToken"] = 14] = "FirstTemplateToken";
SyntaxKind[SyntaxKind["LastTemplateToken"] = 17] = "LastTemplateToken";
SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 28] = "FirstBinaryOperator";
- SyntaxKind[SyntaxKind["LastBinaryOperator"] = 71] = "LastBinaryOperator";
- SyntaxKind[SyntaxKind["FirstNode"] = 148] = "FirstNode";
- SyntaxKind[SyntaxKind["FirstJSDocNode"] = 288] = "FirstJSDocNode";
- SyntaxKind[SyntaxKind["LastJSDocNode"] = 310] = "LastJSDocNode";
- SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 299] = "FirstJSDocTagNode";
- SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 310] = "LastJSDocTagNode";
- /* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 118] = "FirstContextualKeyword";
- /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 147] = "LastContextualKeyword";
+ SyntaxKind[SyntaxKind["LastBinaryOperator"] = 72] = "LastBinaryOperator";
+ SyntaxKind[SyntaxKind["FirstNode"] = 149] = "FirstNode";
+ SyntaxKind[SyntaxKind["FirstJSDocNode"] = 289] = "FirstJSDocNode";
+ SyntaxKind[SyntaxKind["LastJSDocNode"] = 311] = "LastJSDocNode";
+ SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 300] = "FirstJSDocTagNode";
+ SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 311] = "LastJSDocTagNode";
+ /* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 119] = "FirstContextualKeyword";
+ /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 148] = "LastContextualKeyword";
})(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {}));
var NodeFlags;
(function (NodeFlags) {
@@ -3106,6 +3258,8 @@
FlowFlags[FlowFlags["Shared"] = 1024] = "Shared";
FlowFlags[FlowFlags["PreFinally"] = 2048] = "PreFinally";
FlowFlags[FlowFlags["AfterFinally"] = 4096] = "AfterFinally";
+ /** @internal */
+ FlowFlags[FlowFlags["Cached"] = 8192] = "Cached";
FlowFlags[FlowFlags["Label"] = 12] = "Label";
FlowFlags[FlowFlags["Condition"] = 96] = "Condition";
})(FlowFlags = ts.FlowFlags || (ts.FlowFlags = {}));
@@ -3358,19 +3512,22 @@
CheckFlags[CheckFlags["SyntheticProperty"] = 2] = "SyntheticProperty";
CheckFlags[CheckFlags["SyntheticMethod"] = 4] = "SyntheticMethod";
CheckFlags[CheckFlags["Readonly"] = 8] = "Readonly";
- CheckFlags[CheckFlags["Partial"] = 16] = "Partial";
- CheckFlags[CheckFlags["HasNonUniformType"] = 32] = "HasNonUniformType";
- CheckFlags[CheckFlags["HasLiteralType"] = 64] = "HasLiteralType";
- CheckFlags[CheckFlags["ContainsPublic"] = 128] = "ContainsPublic";
- CheckFlags[CheckFlags["ContainsProtected"] = 256] = "ContainsProtected";
- CheckFlags[CheckFlags["ContainsPrivate"] = 512] = "ContainsPrivate";
- CheckFlags[CheckFlags["ContainsStatic"] = 1024] = "ContainsStatic";
- CheckFlags[CheckFlags["Late"] = 2048] = "Late";
- CheckFlags[CheckFlags["ReverseMapped"] = 4096] = "ReverseMapped";
- CheckFlags[CheckFlags["OptionalParameter"] = 8192] = "OptionalParameter";
- CheckFlags[CheckFlags["RestParameter"] = 16384] = "RestParameter";
+ CheckFlags[CheckFlags["ReadPartial"] = 16] = "ReadPartial";
+ CheckFlags[CheckFlags["WritePartial"] = 32] = "WritePartial";
+ CheckFlags[CheckFlags["HasNonUniformType"] = 64] = "HasNonUniformType";
+ CheckFlags[CheckFlags["HasLiteralType"] = 128] = "HasLiteralType";
+ CheckFlags[CheckFlags["ContainsPublic"] = 256] = "ContainsPublic";
+ CheckFlags[CheckFlags["ContainsProtected"] = 512] = "ContainsProtected";
+ CheckFlags[CheckFlags["ContainsPrivate"] = 1024] = "ContainsPrivate";
+ CheckFlags[CheckFlags["ContainsStatic"] = 2048] = "ContainsStatic";
+ CheckFlags[CheckFlags["Late"] = 4096] = "Late";
+ CheckFlags[CheckFlags["ReverseMapped"] = 8192] = "ReverseMapped";
+ CheckFlags[CheckFlags["OptionalParameter"] = 16384] = "OptionalParameter";
+ CheckFlags[CheckFlags["RestParameter"] = 32768] = "RestParameter";
+ CheckFlags[CheckFlags["DeferredType"] = 65536] = "DeferredType";
CheckFlags[CheckFlags["Synthetic"] = 6] = "Synthetic";
- CheckFlags[CheckFlags["Discriminant"] = 96] = "Discriminant";
+ CheckFlags[CheckFlags["Discriminant"] = 192] = "Discriminant";
+ CheckFlags[CheckFlags["Partial"] = 48] = "Partial";
})(CheckFlags = ts.CheckFlags || (ts.CheckFlags = {}));
var InternalSymbolName;
(function (InternalSymbolName) {
@@ -3481,6 +3638,8 @@
TypeFlags[TypeFlags["StructuredOrInstantiable"] = 66846720] = "StructuredOrInstantiable";
/* @internal */
TypeFlags[TypeFlags["ObjectFlagsType"] = 3899392] = "ObjectFlagsType";
+ /* @internal */
+ TypeFlags[TypeFlags["Simplifiable"] = 25165824] = "Simplifiable";
// 'Narrowable' types are types where narrowing actually narrows.
// This *should* be every type other than null, undefined, void, and never
TypeFlags[TypeFlags["Narrowable"] = 133970943] = "Narrowable";
@@ -3536,14 +3695,18 @@
ObjectFlags[ObjectFlags["PropagatingFlags"] = 917504] = "PropagatingFlags";
})(ObjectFlags = ts.ObjectFlags || (ts.ObjectFlags = {}));
/* @internal */
- var Variance;
- (function (Variance) {
- Variance[Variance["Invariant"] = 0] = "Invariant";
- Variance[Variance["Covariant"] = 1] = "Covariant";
- Variance[Variance["Contravariant"] = 2] = "Contravariant";
- Variance[Variance["Bivariant"] = 3] = "Bivariant";
- Variance[Variance["Independent"] = 4] = "Independent";
- })(Variance = ts.Variance || (ts.Variance = {}));
+ var VarianceFlags;
+ (function (VarianceFlags) {
+ VarianceFlags[VarianceFlags["Invariant"] = 0] = "Invariant";
+ VarianceFlags[VarianceFlags["Covariant"] = 1] = "Covariant";
+ VarianceFlags[VarianceFlags["Contravariant"] = 2] = "Contravariant";
+ VarianceFlags[VarianceFlags["Bivariant"] = 3] = "Bivariant";
+ VarianceFlags[VarianceFlags["Independent"] = 4] = "Independent";
+ VarianceFlags[VarianceFlags["VarianceMask"] = 7] = "VarianceMask";
+ VarianceFlags[VarianceFlags["Unmeasurable"] = 8] = "Unmeasurable";
+ VarianceFlags[VarianceFlags["Unreliable"] = 16] = "Unreliable";
+ VarianceFlags[VarianceFlags["AllowsStructuralFallback"] = 24] = "AllowsStructuralFallback";
+ })(VarianceFlags = ts.VarianceFlags || (ts.VarianceFlags = {}));
/* @internal */
var JsxReferenceKind;
(function (JsxReferenceKind) {
@@ -3565,12 +3728,13 @@
(function (InferencePriority) {
InferencePriority[InferencePriority["NakedTypeVariable"] = 1] = "NakedTypeVariable";
InferencePriority[InferencePriority["HomomorphicMappedType"] = 2] = "HomomorphicMappedType";
- InferencePriority[InferencePriority["MappedTypeConstraint"] = 4] = "MappedTypeConstraint";
- InferencePriority[InferencePriority["ReturnType"] = 8] = "ReturnType";
- InferencePriority[InferencePriority["LiteralKeyof"] = 16] = "LiteralKeyof";
- InferencePriority[InferencePriority["NoConstraints"] = 32] = "NoConstraints";
- InferencePriority[InferencePriority["AlwaysStrict"] = 64] = "AlwaysStrict";
- InferencePriority[InferencePriority["PriorityImpliesCombination"] = 28] = "PriorityImpliesCombination";
+ InferencePriority[InferencePriority["PartialHomomorphicMappedType"] = 4] = "PartialHomomorphicMappedType";
+ InferencePriority[InferencePriority["MappedTypeConstraint"] = 8] = "MappedTypeConstraint";
+ InferencePriority[InferencePriority["ReturnType"] = 16] = "ReturnType";
+ InferencePriority[InferencePriority["LiteralKeyof"] = 32] = "LiteralKeyof";
+ InferencePriority[InferencePriority["NoConstraints"] = 64] = "NoConstraints";
+ InferencePriority[InferencePriority["AlwaysStrict"] = 128] = "AlwaysStrict";
+ InferencePriority[InferencePriority["PriorityImpliesCombination"] = 56] = "PriorityImpliesCombination";
})(InferencePriority = ts.InferencePriority || (ts.InferencePriority = {}));
/* @internal */
var InferenceFlags;
@@ -3687,9 +3851,10 @@
ScriptTarget[ScriptTarget["ES2017"] = 4] = "ES2017";
ScriptTarget[ScriptTarget["ES2018"] = 5] = "ES2018";
ScriptTarget[ScriptTarget["ES2019"] = 6] = "ES2019";
- ScriptTarget[ScriptTarget["ESNext"] = 7] = "ESNext";
+ ScriptTarget[ScriptTarget["ES2020"] = 7] = "ES2020";
+ ScriptTarget[ScriptTarget["ESNext"] = 8] = "ESNext";
ScriptTarget[ScriptTarget["JSON"] = 100] = "JSON";
- ScriptTarget[ScriptTarget["Latest"] = 7] = "Latest";
+ ScriptTarget[ScriptTarget["Latest"] = 8] = "Latest";
})(ScriptTarget = ts.ScriptTarget || (ts.ScriptTarget = {}));
var LanguageVariant;
(function (LanguageVariant) {
@@ -4102,17 +4267,10 @@
PragmaKindFlags[PragmaKindFlags["All"] = 7] = "All";
PragmaKindFlags[PragmaKindFlags["Default"] = 7] = "Default";
})(PragmaKindFlags = ts.PragmaKindFlags || (ts.PragmaKindFlags = {}));
- /**
- * This function only exists to cause exact types to be inferred for all the literals within `commentPragmas`
- */
- /* @internal */
- function _contextuallyTypePragmas(args) {
- return args;
- }
// While not strictly a type, this is here because `PragmaMap` needs to be here to be used with `SourceFile`, and we don't
// fancy effectively defining it twice, once in value-space and once in type-space
/* @internal */
- ts.commentPragmas = _contextuallyTypePragmas({
+ ts.commentPragmas = {
"reference": {
args: [
{ name: "types", optional: true, captureSpan: true },
@@ -4140,7 +4298,7 @@
args: [{ name: "factory" }],
kind: 4 /* MultiLine */
},
- });
+ };
})(ts || (ts = {}));
var ts;
(function (ts) {
@@ -5187,7 +5345,7 @@
_0_modifier_cannot_appear_on_a_data_property: diag(1043, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_data_property_1043", "'{0}' modifier cannot appear on a data property."),
_0_modifier_cannot_appear_on_a_module_or_namespace_element: diag(1044, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_module_or_namespace_element_1044", "'{0}' modifier cannot appear on a module or namespace element."),
A_0_modifier_cannot_be_used_with_an_interface_declaration: diag(1045, ts.DiagnosticCategory.Error, "A_0_modifier_cannot_be_used_with_an_interface_declaration_1045", "A '{0}' modifier cannot be used with an interface declaration."),
- A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: diag(1046, ts.DiagnosticCategory.Error, "A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file_1046", "A 'declare' modifier is required for a top level declaration in a .d.ts file."),
+ Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier: diag(1046, ts.DiagnosticCategory.Error, "Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier_1046", "Top-level declarations in .d.ts files must start with either a 'declare' or 'export' modifier."),
A_rest_parameter_cannot_be_optional: diag(1047, ts.DiagnosticCategory.Error, "A_rest_parameter_cannot_be_optional_1047", "A rest parameter cannot be optional."),
A_rest_parameter_cannot_have_an_initializer: diag(1048, ts.DiagnosticCategory.Error, "A_rest_parameter_cannot_have_an_initializer_1048", "A rest parameter cannot have an initializer."),
A_set_accessor_must_have_exactly_one_parameter: diag(1049, ts.DiagnosticCategory.Error, "A_set_accessor_must_have_exactly_one_parameter_1049", "A 'set' accessor must have exactly one parameter."),
@@ -5316,7 +5474,7 @@
Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided: diag(1205, ts.DiagnosticCategory.Error, "Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided_1205", "Cannot re-export a type when the '--isolatedModules' flag is provided."),
Decorators_are_not_valid_here: diag(1206, ts.DiagnosticCategory.Error, "Decorators_are_not_valid_here_1206", "Decorators are not valid here."),
Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: diag(1207, ts.DiagnosticCategory.Error, "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207", "Decorators cannot be applied to multiple get/set accessors of the same name."),
- Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided: diag(1208, ts.DiagnosticCategory.Error, "Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided_1208", "Cannot compile namespaces when the '--isolatedModules' flag is provided."),
+ All_files_must_be_modules_when_the_isolatedModules_flag_is_provided: diag(1208, ts.DiagnosticCategory.Error, "All_files_must_be_modules_when_the_isolatedModules_flag_is_provided_1208", "All files must be modules when the '--isolatedModules' flag is provided."),
Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: diag(1210, ts.DiagnosticCategory.Error, "Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode_1210", "Invalid use of '{0}'. Class definitions are automatically in strict mode."),
A_class_declaration_without_the_default_modifier_must_have_a_name: diag(1211, ts.DiagnosticCategory.Error, "A_class_declaration_without_the_default_modifier_must_have_a_name_1211", "A class declaration without the 'default' modifier must have a name."),
Identifier_expected_0_is_a_reserved_word_in_strict_mode: diag(1212, ts.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_in_strict_mode_1212", "Identifier expected. '{0}' is a reserved word in strict mode."),
@@ -5325,7 +5483,7 @@
Invalid_use_of_0_Modules_are_automatically_in_strict_mode: diag(1215, ts.DiagnosticCategory.Error, "Invalid_use_of_0_Modules_are_automatically_in_strict_mode_1215", "Invalid use of '{0}'. Modules are automatically in strict mode."),
Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules: diag(1216, ts.DiagnosticCategory.Error, "Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules_1216", "Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules."),
Export_assignment_is_not_supported_when_module_flag_is_system: diag(1218, ts.DiagnosticCategory.Error, "Export_assignment_is_not_supported_when_module_flag_is_system_1218", "Export assignment is not supported when '--module' flag is 'system'."),
- Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning: diag(1219, ts.DiagnosticCategory.Error, "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219", "Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning."),
+ Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning: diag(1219, ts.DiagnosticCategory.Error, "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219", "Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning."),
Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher: diag(1220, ts.DiagnosticCategory.Error, "Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher_1220", "Generators are only available when targeting ECMAScript 2015 or higher."),
Generators_are_not_allowed_in_an_ambient_context: diag(1221, ts.DiagnosticCategory.Error, "Generators_are_not_allowed_in_an_ambient_context_1221", "Generators are not allowed in an ambient context."),
An_overload_signature_cannot_be_declared_as_a_generator: diag(1222, ts.DiagnosticCategory.Error, "An_overload_signature_cannot_be_declared_as_a_generator_1222", "An overload signature cannot be declared as a generator."),
@@ -5364,6 +5522,8 @@
A_definite_assignment_assertion_is_not_permitted_in_this_context: diag(1255, ts.DiagnosticCategory.Error, "A_definite_assignment_assertion_is_not_permitted_in_this_context_1255", "A definite assignment assertion '!' is not permitted in this context."),
A_rest_element_must_be_last_in_a_tuple_type: diag(1256, ts.DiagnosticCategory.Error, "A_rest_element_must_be_last_in_a_tuple_type_1256", "A rest element must be last in a tuple type."),
A_required_element_cannot_follow_an_optional_element: diag(1257, ts.DiagnosticCategory.Error, "A_required_element_cannot_follow_an_optional_element_1257", "A required element cannot follow an optional element."),
+ Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation: diag(1258, ts.DiagnosticCategory.Error, "Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation_1258", "Definite assignment assertions can only be used along with a type annotation."),
+ Module_0_can_only_be_default_imported_using_the_1_flag: diag(1259, ts.DiagnosticCategory.Error, "Module_0_can_only_be_default_imported_using_the_1_flag_1259", "Module '{0}' can only be default-imported using the '{1}' flag"),
with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
await_expression_is_only_allowed_within_an_async_function: diag(1308, ts.DiagnosticCategory.Error, "await_expression_is_only_allowed_within_an_async_function_1308", "'await' expression is only allowed within an async function."),
can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment: diag(1312, ts.DiagnosticCategory.Error, "can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment_1312", "'=' can only be used in an object literal property inside a destructuring assignment."),
@@ -5408,7 +5568,8 @@
A_bigint_literal_cannot_use_exponential_notation: diag(1352, ts.DiagnosticCategory.Error, "A_bigint_literal_cannot_use_exponential_notation_1352", "A bigint literal cannot use exponential notation."),
A_bigint_literal_must_be_an_integer: diag(1353, ts.DiagnosticCategory.Error, "A_bigint_literal_must_be_an_integer_1353", "A bigint literal must be an integer."),
readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types: diag(1354, ts.DiagnosticCategory.Error, "readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types_1354", "'readonly' type modifier is only permitted on array and tuple literal types."),
- A_const_assertion_can_only_be_applied_to_a_string_number_boolean_array_or_object_literal: diag(1355, ts.DiagnosticCategory.Error, "A_const_assertion_can_only_be_applied_to_a_string_number_boolean_array_or_object_literal_1355", "A 'const' assertion can only be applied to a string, number, boolean, array, or object literal."),
+ A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals: diag(1355, ts.DiagnosticCategory.Error, "A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array__1355", "A 'const' assertions can only be applied to references to enum members, or string, number, boolean, array, or object literals."),
+ Did_you_mean_to_mark_this_function_as_async: diag(1356, ts.DiagnosticCategory.Error, "Did_you_mean_to_mark_this_function_as_async_1356", "Did you mean to mark this function as 'async'?"),
Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2301, ts.DiagnosticCategory.Error, "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
Static_members_cannot_reference_class_type_parameters: diag(2302, ts.DiagnosticCategory.Error, "Static_members_cannot_reference_class_type_parameters_2302", "Static members cannot reference class type parameters."),
@@ -5690,6 +5851,7 @@
Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig: diag(2591, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_types_Slashnode_and_th_2591", "Cannot find name '{0}'. Do you need to install type definitions for node? Try `npm i @types/node` and then add `node` to the types field in your tsconfig."),
Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_types_Slashjquery_and_then_add_jquery_to_the_types_field_in_your_tsconfig: diag(2592, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_types_Slashjquery_an_2592", "Cannot find name '{0}'. Do you need to install type definitions for jQuery? Try `npm i @types/jquery` and then add `jquery` to the types field in your tsconfig."),
Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_types_Slashjest_or_npm_i_types_Slashmocha_and_then_add_jest_or_mocha_to_the_types_field_in_your_tsconfig: diag(2593, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_types_Slashje_2593", "Cannot find name '{0}'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig."),
+ This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag: diag(2594, ts.DiagnosticCategory.Error, "This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594", "This module is declared with using 'export =', and can only be used with a default import when using the '{0}' flag."),
JSX_element_attributes_type_0_may_not_be_a_union_type: diag(2600, ts.DiagnosticCategory.Error, "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", "JSX element attributes type '{0}' may not be a union type."),
The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: diag(2601, ts.DiagnosticCategory.Error, "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", "The return type of a JSX element constructor must return an object type."),
JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: diag(2602, ts.DiagnosticCategory.Error, "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist."),
@@ -5802,6 +5964,7 @@
Circularity_originates_in_type_at_this_location: diag(2751, ts.DiagnosticCategory.Error, "Circularity_originates_in_type_at_this_location_2751", "Circularity originates in type at this location."),
The_first_export_default_is_here: diag(2752, ts.DiagnosticCategory.Error, "The_first_export_default_is_here_2752", "The first export default is here."),
Another_export_default_is_here: diag(2753, ts.DiagnosticCategory.Error, "Another_export_default_is_here_2753", "Another export default is here."),
+ super_may_not_use_type_arguments: diag(2754, ts.DiagnosticCategory.Error, "super_may_not_use_type_arguments_2754", "'super' may not use type arguments."),
Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -5886,6 +6049,7 @@
Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4101, ts.DiagnosticCategory.Error, "Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2_4101", "Method '{0}' of exported interface has or is using name '{1}' from private module '{2}'."),
Method_0_of_exported_interface_has_or_is_using_private_name_1: diag(4102, ts.DiagnosticCategory.Error, "Method_0_of_exported_interface_has_or_is_using_private_name_1_4102", "Method '{0}' of exported interface has or is using private name '{1}'."),
Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1: diag(4103, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1_4103", "Type parameter '{0}' of exported mapped object type is using private name '{1}'."),
+ The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1: diag(4104, ts.DiagnosticCategory.Error, "The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1_4104", "The type '{0}' is 'readonly' and cannot be assigned to the mutable type '{1}'."),
The_current_host_does_not_support_the_0_option: diag(5001, ts.DiagnosticCategory.Error, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, ts.DiagnosticCategory.Error, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, ts.DiagnosticCategory.Error, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
@@ -5919,6 +6083,8 @@
Option_resolveJsonModule_can_only_be_specified_when_module_code_generation_is_commonjs_amd_es2015_or_esNext: diag(5071, ts.DiagnosticCategory.Error, "Option_resolveJsonModule_can_only_be_specified_when_module_code_generation_is_commonjs_amd_es2015_or_5071", "Option '--resolveJsonModule' can only be specified when module code generation is 'commonjs', 'amd', 'es2015' or 'esNext'."),
Unknown_build_option_0: diag(5072, ts.DiagnosticCategory.Error, "Unknown_build_option_0_5072", "Unknown build option '{0}'."),
Build_option_0_requires_a_value_of_type_1: diag(5073, ts.DiagnosticCategory.Error, "Build_option_0_requires_a_value_of_type_1_5073", "Build option '{0}' requires a value of type {1}."),
+ Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified: diag(5074, ts.DiagnosticCategory.Error, "Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBui_5074", "Option '--incremental' can only be specified using tsconfig, emitting to single file or when option `--tsBuildInfoFile` is specified."),
+ _0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_constraint_2: diag(5075, ts.DiagnosticCategory.Error, "_0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_5075", "'{0}' is assignable to the constraint of type '{1}', but '{1}' could be instantiated with a different subtype of constraint '{2}'."),
Generates_a_sourcemap_for_each_corresponding_d_ts_file: diag(6000, ts.DiagnosticCategory.Message, "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000", "Generates a sourcemap for each corresponding '.d.ts' file."),
Concatenate_and_emit_output_to_single_file: diag(6001, ts.DiagnosticCategory.Message, "Concatenate_and_emit_output_to_single_file_6001", "Concatenate and emit output to single file."),
Generates_corresponding_d_ts_file: diag(6002, ts.DiagnosticCategory.Message, "Generates_corresponding_d_ts_file_6002", "Generates corresponding '.d.ts' file."),
@@ -6095,7 +6261,6 @@
Enable_strict_checking_of_property_initialization_in_classes: diag(6187, ts.DiagnosticCategory.Message, "Enable_strict_checking_of_property_initialization_in_classes_6187", "Enable strict checking of property initialization in classes."),
Numeric_separators_are_not_allowed_here: diag(6188, ts.DiagnosticCategory.Error, "Numeric_separators_are_not_allowed_here_6188", "Numeric separators are not allowed here."),
Multiple_consecutive_numeric_separators_are_not_permitted: diag(6189, ts.DiagnosticCategory.Error, "Multiple_consecutive_numeric_separators_are_not_permitted_6189", "Multiple consecutive numeric separators are not permitted."),
- Found_package_json_at_0_Package_ID_is_1: diag(6190, ts.DiagnosticCategory.Message, "Found_package_json_at_0_Package_ID_is_1_6190", "Found 'package.json' at '{0}'. Package ID is '{1}'."),
Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen: diag(6191, ts.DiagnosticCategory.Message, "Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen_6191", "Whether to keep outdated console output in watch mode instead of clearing the screen."),
All_imports_in_import_declaration_are_unused: diag(6192, ts.DiagnosticCategory.Error, "All_imports_in_import_declaration_are_unused_6192", "All imports in import declaration are unused.", /*reportsUnnecessary*/ true),
Found_1_error_Watching_for_file_changes: diag(6193, ts.DiagnosticCategory.Message, "Found_1_error_Watching_for_file_changes_6193", "Found 1 error. Watching for file changes."),
@@ -6122,6 +6287,9 @@
Using_compiler_options_of_project_reference_redirect_0: diag(6215, ts.DiagnosticCategory.Message, "Using_compiler_options_of_project_reference_redirect_0_6215", "Using compiler options of project reference redirect '{0}'."),
Found_1_error: diag(6216, ts.DiagnosticCategory.Message, "Found_1_error_6216", "Found 1 error."),
Found_0_errors: diag(6217, ts.DiagnosticCategory.Message, "Found_0_errors_6217", "Found {0} errors."),
+ Module_name_0_was_successfully_resolved_to_1_with_Package_ID_2: diag(6218, ts.DiagnosticCategory.Message, "Module_name_0_was_successfully_resolved_to_1_with_Package_ID_2_6218", "======== Module name '{0}' was successfully resolved to '{1}' with Package ID '{2}'. ========"),
+ Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3: diag(6219, ts.DiagnosticCategory.Message, "Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3_6219", "======== Type reference directive '{0}' was successfully resolved to '{1}' with Package ID '{2}', primary: {3}. ========"),
+ package_json_had_a_falsy_0_field: diag(6220, ts.DiagnosticCategory.Message, "package_json_had_a_falsy_0_field_6220", "'package.json' had a falsy '{0}' field."),
Projects_to_reference: diag(6300, ts.DiagnosticCategory.Message, "Projects_to_reference_6300", "Projects to reference"),
Enable_project_compilation: diag(6302, ts.DiagnosticCategory.Message, "Enable_project_compilation_6302", "Enable project compilation"),
Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0: diag(6202, ts.DiagnosticCategory.Error, "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202", "Project references may not form a circular graph. Cycle detected: {0}"),
@@ -6210,6 +6378,9 @@
Property_0_implicitly_has_type_any_but_a_better_type_for_its_set_accessor_may_be_inferred_from_usage: diag(7049, ts.DiagnosticCategory.Suggestion, "Property_0_implicitly_has_type_any_but_a_better_type_for_its_set_accessor_may_be_inferred_from_usage_7049", "Property '{0}' implicitly has type 'any', but a better type for its set accessor may be inferred from usage."),
_0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage: diag(7050, ts.DiagnosticCategory.Suggestion, "_0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage_7050", "'{0}' implicitly has an '{1}' return type, but a better type may be inferred from usage."),
Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1: diag(7051, ts.DiagnosticCategory.Error, "Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1_7051", "Parameter has a name but no type. Did you mean '{0}: {1}'?"),
+ Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1: diag(7052, ts.DiagnosticCategory.Error, "Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1_7052", "Element implicitly has an 'any' type because type '{0}' has no index signature. Did you mean to call '{1}' ?"),
+ Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1: diag(7053, ts.DiagnosticCategory.Error, "Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1_7053", "Element implicitly has an 'any' type because expression of type '{0}' can't be used to index type '{1}'."),
+ No_index_signature_with_a_parameter_of_type_0_was_found_on_type_1: diag(7054, ts.DiagnosticCategory.Error, "No_index_signature_with_a_parameter_of_type_0_was_found_on_type_1_7054", "No index signature with a parameter of type '{0}' was found on type '{1}'."),
You_cannot_rename_this_element: diag(8000, ts.DiagnosticCategory.Error, "You_cannot_rename_this_element_8000", "You cannot rename this element."),
You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: diag(8001, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001", "You cannot rename elements that are defined in the standard TypeScript library."),
import_can_only_be_used_in_a_ts_file: diag(8002, ts.DiagnosticCategory.Error, "import_can_only_be_used_in_a_ts_file_8002", "'import ... =' can only be used in a .ts file."),
@@ -6371,8 +6542,6 @@
Add_all_missing_imports: diag(95064, ts.DiagnosticCategory.Message, "Add_all_missing_imports_95064", "Add all missing imports"),
Convert_to_async_function: diag(95065, ts.DiagnosticCategory.Message, "Convert_to_async_function_95065", "Convert to async function"),
Convert_all_to_async_functions: diag(95066, ts.DiagnosticCategory.Message, "Convert_all_to_async_functions_95066", "Convert all to async functions"),
- Generate_types_for_0: diag(95067, ts.DiagnosticCategory.Message, "Generate_types_for_0_95067", "Generate types for '{0}'"),
- Generate_types_for_all_packages_without_types: diag(95068, ts.DiagnosticCategory.Message, "Generate_types_for_all_packages_without_types_95068", "Generate types for all packages without types"),
Add_unknown_conversion_for_non_overlapping_types: diag(95069, ts.DiagnosticCategory.Message, "Add_unknown_conversion_for_non_overlapping_types_95069", "Add 'unknown' conversion for non-overlapping types"),
Add_unknown_to_all_conversions_of_non_overlapping_types: diag(95070, ts.DiagnosticCategory.Message, "Add_unknown_to_all_conversions_of_non_overlapping_types_95070", "Add 'unknown' to all conversions of non-overlapping types"),
Add_missing_new_operator_to_call: diag(95071, ts.DiagnosticCategory.Message, "Add_missing_new_operator_to_call_95071", "Add missing 'new' operator to call"),
@@ -6380,6 +6549,13 @@
Add_names_to_all_parameters_without_names: diag(95073, ts.DiagnosticCategory.Message, "Add_names_to_all_parameters_without_names_95073", "Add names to all parameters without names"),
Enable_the_experimentalDecorators_option_in_your_configuration_file: diag(95074, ts.DiagnosticCategory.Message, "Enable_the_experimentalDecorators_option_in_your_configuration_file_95074", "Enable the 'experimentalDecorators' option in your configuration file"),
Convert_parameters_to_destructured_object: diag(95075, ts.DiagnosticCategory.Message, "Convert_parameters_to_destructured_object_95075", "Convert parameters to destructured object"),
+ Allow_accessing_UMD_globals_from_modules: diag(95076, ts.DiagnosticCategory.Message, "Allow_accessing_UMD_globals_from_modules_95076", "Allow accessing UMD globals from modules."),
+ Extract_type: diag(95077, ts.DiagnosticCategory.Message, "Extract_type_95077", "Extract type"),
+ Extract_to_type_alias: diag(95078, ts.DiagnosticCategory.Message, "Extract_to_type_alias_95078", "Extract to type alias"),
+ Extract_to_typedef: diag(95079, ts.DiagnosticCategory.Message, "Extract_to_typedef_95079", "Extract to typedef"),
+ No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, ts.DiagnosticCategory.Error, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
+ Quoted_constructors_have_previously_been_interpreted_as_methods_which_is_incorrect_In_TypeScript_3_6_they_will_be_correctly_parsed_as_constructors_In_the_meantime_consider_using_constructor_to_write_a_constructor_or_constructor_to_write_a_method: diag(18005, ts.DiagnosticCategory.Error, "Quoted_constructors_have_previously_been_interpreted_as_methods_which_is_incorrect_In_TypeScript_3_6_18005", "Quoted constructors have previously been interpreted as methods, which is incorrect. In TypeScript 3.6, they will be correctly parsed as constructors. In the meantime, consider using 'constructor()' to write a constructor, or '[\"constructor\"]()' to write a method."),
+ Classes_may_not_have_a_field_named_constructor: diag(18006, ts.DiagnosticCategory.Error, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
};
})(ts || (ts = {}));
var ts;
@@ -6387,7 +6563,7 @@
var _a;
/* @internal */
function tokenIsIdentifierOrKeyword(token) {
- return token >= 72 /* Identifier */;
+ return token >= 73 /* Identifier */;
}
ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword;
/* @internal */
@@ -6396,85 +6572,85 @@
}
ts.tokenIsIdentifierOrKeywordOrGreaterThan = tokenIsIdentifierOrKeywordOrGreaterThan;
var textToKeywordObj = (_a = {
- abstract: 118 /* AbstractKeyword */,
- any: 120 /* AnyKeyword */,
- as: 119 /* AsKeyword */,
- bigint: 146 /* BigIntKeyword */,
- boolean: 123 /* BooleanKeyword */,
- break: 73 /* BreakKeyword */,
- case: 74 /* CaseKeyword */,
- catch: 75 /* CatchKeyword */,
- class: 76 /* ClassKeyword */,
- continue: 78 /* ContinueKeyword */,
- const: 77 /* ConstKeyword */
- },
- _a["" + "constructor"] = 124 /* ConstructorKeyword */,
- _a.debugger = 79 /* DebuggerKeyword */,
- _a.declare = 125 /* DeclareKeyword */,
- _a.default = 80 /* DefaultKeyword */,
- _a.delete = 81 /* DeleteKeyword */,
- _a.do = 82 /* DoKeyword */,
- _a.else = 83 /* ElseKeyword */,
- _a.enum = 84 /* EnumKeyword */,
- _a.export = 85 /* ExportKeyword */,
- _a.extends = 86 /* ExtendsKeyword */,
- _a.false = 87 /* FalseKeyword */,
- _a.finally = 88 /* FinallyKeyword */,
- _a.for = 89 /* ForKeyword */,
- _a.from = 144 /* FromKeyword */,
- _a.function = 90 /* FunctionKeyword */,
- _a.get = 126 /* GetKeyword */,
- _a.if = 91 /* IfKeyword */,
- _a.implements = 109 /* ImplementsKeyword */,
- _a.import = 92 /* ImportKeyword */,
- _a.in = 93 /* InKeyword */,
- _a.infer = 127 /* InferKeyword */,
- _a.instanceof = 94 /* InstanceOfKeyword */,
- _a.interface = 110 /* InterfaceKeyword */,
- _a.is = 128 /* IsKeyword */,
- _a.keyof = 129 /* KeyOfKeyword */,
- _a.let = 111 /* LetKeyword */,
- _a.module = 130 /* ModuleKeyword */,
- _a.namespace = 131 /* NamespaceKeyword */,
- _a.never = 132 /* NeverKeyword */,
- _a.new = 95 /* NewKeyword */,
- _a.null = 96 /* NullKeyword */,
- _a.number = 135 /* NumberKeyword */,
- _a.object = 136 /* ObjectKeyword */,
- _a.package = 112 /* PackageKeyword */,
- _a.private = 113 /* PrivateKeyword */,
- _a.protected = 114 /* ProtectedKeyword */,
- _a.public = 115 /* PublicKeyword */,
- _a.readonly = 133 /* ReadonlyKeyword */,
- _a.require = 134 /* RequireKeyword */,
- _a.global = 145 /* GlobalKeyword */,
- _a.return = 97 /* ReturnKeyword */,
- _a.set = 137 /* SetKeyword */,
- _a.static = 116 /* StaticKeyword */,
- _a.string = 138 /* StringKeyword */,
- _a.super = 98 /* SuperKeyword */,
- _a.switch = 99 /* SwitchKeyword */,
- _a.symbol = 139 /* SymbolKeyword */,
- _a.this = 100 /* ThisKeyword */,
- _a.throw = 101 /* ThrowKeyword */,
- _a.true = 102 /* TrueKeyword */,
- _a.try = 103 /* TryKeyword */,
- _a.type = 140 /* TypeKeyword */,
- _a.typeof = 104 /* TypeOfKeyword */,
- _a.undefined = 141 /* UndefinedKeyword */,
- _a.unique = 142 /* UniqueKeyword */,
- _a.unknown = 143 /* UnknownKeyword */,
- _a.var = 105 /* VarKeyword */,
- _a.void = 106 /* VoidKeyword */,
- _a.while = 107 /* WhileKeyword */,
- _a.with = 108 /* WithKeyword */,
- _a.yield = 117 /* YieldKeyword */,
- _a.async = 121 /* AsyncKeyword */,
- _a.await = 122 /* AwaitKeyword */,
- _a.of = 147 /* OfKeyword */,
+ abstract: 119 /* AbstractKeyword */,
+ any: 121 /* AnyKeyword */,
+ as: 120 /* AsKeyword */,
+ bigint: 147 /* BigIntKeyword */,
+ boolean: 124 /* BooleanKeyword */,
+ break: 74 /* BreakKeyword */,
+ case: 75 /* CaseKeyword */,
+ catch: 76 /* CatchKeyword */,
+ class: 77 /* ClassKeyword */,
+ continue: 79 /* ContinueKeyword */,
+ const: 78 /* ConstKeyword */
+ },
+ _a["" + "constructor"] = 125 /* ConstructorKeyword */,
+ _a.debugger = 80 /* DebuggerKeyword */,
+ _a.declare = 126 /* DeclareKeyword */,
+ _a.default = 81 /* DefaultKeyword */,
+ _a.delete = 82 /* DeleteKeyword */,
+ _a.do = 83 /* DoKeyword */,
+ _a.else = 84 /* ElseKeyword */,
+ _a.enum = 85 /* EnumKeyword */,
+ _a.export = 86 /* ExportKeyword */,
+ _a.extends = 87 /* ExtendsKeyword */,
+ _a.false = 88 /* FalseKeyword */,
+ _a.finally = 89 /* FinallyKeyword */,
+ _a.for = 90 /* ForKeyword */,
+ _a.from = 145 /* FromKeyword */,
+ _a.function = 91 /* FunctionKeyword */,
+ _a.get = 127 /* GetKeyword */,
+ _a.if = 92 /* IfKeyword */,
+ _a.implements = 110 /* ImplementsKeyword */,
+ _a.import = 93 /* ImportKeyword */,
+ _a.in = 94 /* InKeyword */,
+ _a.infer = 128 /* InferKeyword */,
+ _a.instanceof = 95 /* InstanceOfKeyword */,
+ _a.interface = 111 /* InterfaceKeyword */,
+ _a.is = 129 /* IsKeyword */,
+ _a.keyof = 130 /* KeyOfKeyword */,
+ _a.let = 112 /* LetKeyword */,
+ _a.module = 131 /* ModuleKeyword */,
+ _a.namespace = 132 /* NamespaceKeyword */,
+ _a.never = 133 /* NeverKeyword */,
+ _a.new = 96 /* NewKeyword */,
+ _a.null = 97 /* NullKeyword */,
+ _a.number = 136 /* NumberKeyword */,
+ _a.object = 137 /* ObjectKeyword */,
+ _a.package = 113 /* PackageKeyword */,
+ _a.private = 114 /* PrivateKeyword */,
+ _a.protected = 115 /* ProtectedKeyword */,
+ _a.public = 116 /* PublicKeyword */,
+ _a.readonly = 134 /* ReadonlyKeyword */,
+ _a.require = 135 /* RequireKeyword */,
+ _a.global = 146 /* GlobalKeyword */,
+ _a.return = 98 /* ReturnKeyword */,
+ _a.set = 138 /* SetKeyword */,
+ _a.static = 117 /* StaticKeyword */,
+ _a.string = 139 /* StringKeyword */,
+ _a.super = 99 /* SuperKeyword */,
+ _a.switch = 100 /* SwitchKeyword */,
+ _a.symbol = 140 /* SymbolKeyword */,
+ _a.this = 101 /* ThisKeyword */,
+ _a.throw = 102 /* ThrowKeyword */,
+ _a.true = 103 /* TrueKeyword */,
+ _a.try = 104 /* TryKeyword */,
+ _a.type = 141 /* TypeKeyword */,
+ _a.typeof = 105 /* TypeOfKeyword */,
+ _a.undefined = 142 /* UndefinedKeyword */,
+ _a.unique = 143 /* UniqueKeyword */,
+ _a.unknown = 144 /* UnknownKeyword */,
+ _a.var = 106 /* VarKeyword */,
+ _a.void = 107 /* VoidKeyword */,
+ _a.while = 108 /* WhileKeyword */,
+ _a.with = 109 /* WithKeyword */,
+ _a.yield = 118 /* YieldKeyword */,
+ _a.async = 122 /* AsyncKeyword */,
+ _a.await = 123 /* AwaitKeyword */,
+ _a.of = 148 /* OfKeyword */,
_a);
var textToKeyword = ts.createMapFromTemplate(textToKeywordObj);
- var textToToken = ts.createMapFromTemplate(__assign({}, textToKeywordObj, { "{": 18 /* OpenBraceToken */, "}": 19 /* CloseBraceToken */, "(": 20 /* OpenParenToken */, ")": 21 /* CloseParenToken */, "[": 22 /* OpenBracketToken */, "]": 23 /* CloseBracketToken */, ".": 24 /* DotToken */, "...": 25 /* DotDotDotToken */, ";": 26 /* SemicolonToken */, ",": 27 /* CommaToken */, "<": 28 /* LessThanToken */, ">": 30 /* GreaterThanToken */, "<=": 31 /* LessThanEqualsToken */, ">=": 32 /* GreaterThanEqualsToken */, "==": 33 /* EqualsEqualsToken */, "!=": 34 /* ExclamationEqualsToken */, "===": 35 /* EqualsEqualsEqualsToken */, "!==": 36 /* ExclamationEqualsEqualsToken */, "=>": 37 /* EqualsGreaterThanToken */, "+": 38 /* PlusToken */, "-": 39 /* MinusToken */, "**": 41 /* AsteriskAsteriskToken */, "*": 40 /* AsteriskToken */, "/": 42 /* SlashToken */, "%": 43 /* PercentToken */, "++": 44 /* PlusPlusToken */, "--": 45 /* MinusMinusToken */, "<<": 46 /* LessThanLessThanToken */, "</": 29 /* LessThanSlashToken */, ">>": 47 /* GreaterThanGreaterThanToken */, ">>>": 48 /* GreaterThanGreaterThanGreaterThanToken */, "&": 49 /* AmpersandToken */, "|": 50 /* BarToken */, "^": 51 /* CaretToken */, "!": 52 /* ExclamationToken */, "~": 53 /* TildeToken */, "&&": 54 /* AmpersandAmpersandToken */, "||": 55 /* BarBarToken */, "?": 56 /* QuestionToken */, ":": 57 /* ColonToken */, "=": 59 /* EqualsToken */, "+=": 60 /* PlusEqualsToken */, "-=": 61 /* MinusEqualsToken */, "*=": 62 /* AsteriskEqualsToken */, "**=": 63 /* AsteriskAsteriskEqualsToken */, "/=": 64 /* SlashEqualsToken */, "%=": 65 /* PercentEqualsToken */, "<<=": 66 /* LessThanLessThanEqualsToken */, ">>=": 67 /* GreaterThanGreaterThanEqualsToken */, ">>>=": 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */, "&=": 69 /* AmpersandEqualsToken */, "|=": 70 /* BarEqualsToken */, "^=": 71 /* CaretEqualsToken */, "@": 58 /* AtToken */ }));
+ var textToToken = ts.createMapFromTemplate(__assign({}, textToKeywordObj, { "{": 18 /* OpenBraceToken */, "}": 19 /* CloseBraceToken */, "(": 20 /* OpenParenToken */, ")": 21 /* CloseParenToken */, "[": 22 /* OpenBracketToken */, "]": 23 /* CloseBracketToken */, ".": 24 /* DotToken */, "...": 25 /* DotDotDotToken */, ";": 26 /* SemicolonToken */, ",": 27 /* CommaToken */, "<": 28 /* LessThanToken */, ">": 30 /* GreaterThanToken */, "<=": 31 /* LessThanEqualsToken */, ">=": 32 /* GreaterThanEqualsToken */, "==": 33 /* EqualsEqualsToken */, "!=": 34 /* ExclamationEqualsToken */, "===": 35 /* EqualsEqualsEqualsToken */, "!==": 36 /* ExclamationEqualsEqualsToken */, "=>": 37 /* EqualsGreaterThanToken */, "+": 38 /* PlusToken */, "-": 39 /* MinusToken */, "**": 41 /* AsteriskAsteriskToken */, "*": 40 /* AsteriskToken */, "/": 42 /* SlashToken */, "%": 43 /* PercentToken */, "++": 44 /* PlusPlusToken */, "--": 45 /* MinusMinusToken */, "<<": 46 /* LessThanLessThanToken */, "</": 29 /* LessThanSlashToken */, ">>": 47 /* GreaterThanGreaterThanToken */, ">>>": 48 /* GreaterThanGreaterThanGreaterThanToken */, "&": 49 /* AmpersandToken */, "|": 50 /* BarToken */, "^": 51 /* CaretToken */, "!": 52 /* ExclamationToken */, "~": 53 /* TildeToken */, "&&": 54 /* AmpersandAmpersandToken */, "||": 55 /* BarBarToken */, "?": 56 /* QuestionToken */, ":": 57 /* ColonToken */, "=": 60 /* EqualsToken */, "+=": 61 /* PlusEqualsToken */, "-=": 62 /* MinusEqualsToken */, "*=": 63 /* AsteriskEqualsToken */, "**=": 64 /* AsteriskAsteriskEqualsToken */, "/=": 65 /* SlashEqualsToken */, "%=": 66 /* PercentEqualsToken */, "<<=": 67 /* LessThanLessThanEqualsToken */, ">>=": 68 /* GreaterThanGreaterThanEqualsToken */, ">>>=": 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */, "&=": 70 /* AmpersandEqualsToken */, "|=": 71 /* BarEqualsToken */, "^=": 72 /* CaretEqualsToken */, "@": 58 /* AtToken */ }));
/*
As per ECMAScript Language Specification 3th Edition, Section 7.6: Identifiers
IdentifierStart ::
@@ -7088,8 +7264,8 @@
getTokenValue: function () { return tokenValue; },
hasExtendedUnicodeEscape: function () { return (tokenFlags & 8 /* ExtendedUnicodeEscape */) !== 0; },
hasPrecedingLineBreak: function () { return (tokenFlags & 1 /* PrecedingLineBreak */) !== 0; },
- isIdentifier: function () { return token === 72 /* Identifier */ || token > 108 /* LastReservedWord */; },
- isReservedWord: function () { return token >= 73 /* FirstReservedWord */ && token <= 108 /* LastReservedWord */; },
+ isIdentifier: function () { return token === 73 /* Identifier */ || token > 109 /* LastReservedWord */; },
+ isReservedWord: function () { return token >= 74 /* FirstReservedWord */ && token <= 109 /* LastReservedWord */; },
isUnterminated: function () { return (tokenFlags & 4 /* Unterminated */) !== 0; },
getTokenFlags: function () { return tokenFlags; },
reScanGreaterToken: reScanGreaterToken,
@@ -7100,7 +7276,7 @@
reScanJsxToken: reScanJsxToken,
reScanLessThanToken: reScanLessThanToken,
scanJsxToken: scanJsxToken,
- scanJSDocToken: scanJSDocToken,
+ scanJsDocToken: scanJsDocToken,
scan: scan,
getText: getText,
setText: setText,
@@ -7540,7 +7716,7 @@
}
}
}
- return token = 72 /* Identifier */;
+ return token = 73 /* Identifier */;
}
function scanBinaryOrOctalDigits(base) {
var value = "";
@@ -7689,7 +7865,7 @@
return token = scanTemplateAndSetTokenValue();
case 37 /* percent */:
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 65 /* PercentEqualsToken */;
+ return pos += 2, token = 66 /* PercentEqualsToken */;
}
pos++;
return token = 43 /* PercentToken */;
@@ -7698,7 +7874,7 @@
return pos += 2, token = 54 /* AmpersandAmpersandToken */;
}
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 69 /* AmpersandEqualsToken */;
+ return pos += 2, token = 70 /* AmpersandEqualsToken */;
}
pos++;
return token = 49 /* AmpersandToken */;
@@ -7710,11 +7886,11 @@
return token = 21 /* CloseParenToken */;
case 42 /* asterisk */:
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 62 /* AsteriskEqualsToken */;
+ return pos += 2, token = 63 /* AsteriskEqualsToken */;
}
if (text.charCodeAt(pos + 1) === 42 /* asterisk */) {
if (text.charCodeAt(pos + 2) === 61 /* equals */) {
- return pos += 3, token = 63 /* AsteriskAsteriskEqualsToken */;
+ return pos += 3, token = 64 /* AsteriskAsteriskEqualsToken */;
}
return pos += 2, token = 41 /* AsteriskAsteriskToken */;
}
@@ -7730,7 +7906,7 @@
return pos += 2, token = 44 /* PlusPlusToken */;
}
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 60 /* PlusEqualsToken */;
+ return pos += 2, token = 61 /* PlusEqualsToken */;
}
pos++;
return token = 38 /* PlusToken */;
@@ -7742,7 +7918,7 @@
return pos += 2, token = 45 /* MinusMinusToken */;
}
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 61 /* MinusEqualsToken */;
+ return pos += 2, token = 62 /* MinusEqualsToken */;
}
pos++;
return token = 39 /* MinusToken */;
@@ -7806,7 +7982,7 @@
}
}
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 64 /* SlashEqualsToken */;
+ return pos += 2, token = 65 /* SlashEqualsToken */;
}
pos++;
return token = 42 /* SlashToken */;
@@ -7883,7 +8059,7 @@
}
if (text.charCodeAt(pos + 1) === 60 /* lessThan */) {
if (text.charCodeAt(pos + 2) === 61 /* equals */) {
- return pos += 3, token = 66 /* LessThanLessThanEqualsToken */;
+ return pos += 3, token = 67 /* LessThanLessThanEqualsToken */;
}
return pos += 2, token = 46 /* LessThanLessThanToken */;
}
@@ -7917,7 +8093,7 @@
return pos += 2, token = 37 /* EqualsGreaterThanToken */;
}
pos++;
- return token = 59 /* EqualsToken */;
+ return token = 60 /* EqualsToken */;
case 62 /* greaterThan */:
if (isConflictMarkerTrivia(text, pos)) {
pos = scanConflictMarkerTrivia(text, pos, error);
@@ -7941,7 +8117,7 @@
return token = 23 /* CloseBracketToken */;
case 94 /* caret */:
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 71 /* CaretEqualsToken */;
+ return pos += 2, token = 72 /* CaretEqualsToken */;
}
pos++;
return token = 51 /* CaretToken */;
@@ -7962,7 +8138,7 @@
return pos += 2, token = 55 /* BarBarToken */;
}
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 70 /* BarEqualsToken */;
+ return pos += 2, token = 71 /* BarEqualsToken */;
}
pos++;
return token = 50 /* BarToken */;
@@ -8016,12 +8192,12 @@
if (text.charCodeAt(pos) === 62 /* greaterThan */) {
if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) {
if (text.charCodeAt(pos + 2) === 61 /* equals */) {
- return pos += 3, token = 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */;
+ return pos += 3, token = 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */;
}
return pos += 2, token = 48 /* GreaterThanGreaterThanGreaterThanToken */;
}
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 67 /* GreaterThanGreaterThanEqualsToken */;
+ return pos += 2, token = 68 /* GreaterThanGreaterThanEqualsToken */;
}
pos++;
return token = 47 /* GreaterThanGreaterThanToken */;
@@ -8034,7 +8210,7 @@
return token;
}
function reScanSlashToken() {
- if (token === 42 /* SlashToken */ || token === 64 /* SlashEqualsToken */) {
+ if (token === 42 /* SlashToken */ || token === 65 /* SlashEqualsToken */) {
var p = tokenPos + 1;
var inEscape = false;
var inCharacterClass = false;
@@ -8183,7 +8359,7 @@
return scan();
}
}
- function scanJSDocToken() {
+ function scanJsDocToken() {
startPos = tokenPos = pos;
tokenFlags = 0;
if (pos >= end) {
@@ -8219,21 +8395,16 @@
case 60 /* lessThan */:
return token = 28 /* LessThanToken */;
case 61 /* equals */:
- return token = 59 /* EqualsToken */;
+ return token = 60 /* EqualsToken */;
case 44 /* comma */:
return token = 27 /* CommaToken */;
case 46 /* dot */:
return token = 24 /* DotToken */;
case 96 /* backtick */:
- while (pos < end && text.charCodeAt(pos) !== 96 /* backtick */) {
- pos++;
- }
- tokenValue = text.substring(tokenPos + 1, pos);
- pos++;
- return token = 14 /* NoSubstitutionTemplateLiteral */;
+ return token = 59 /* BacktickToken */;
}
- if (isIdentifierStart(ch, 7 /* Latest */)) {
- while (isIdentifierPart(text.charCodeAt(pos), 7 /* Latest */) && pos < end) {
+ if (isIdentifierStart(ch, 8 /* Latest */)) {
+ while (isIdentifierPart(text.charCodeAt(pos), 8 /* Latest */) && pos < end) {
pos++;
}
tokenValue = text.substring(tokenPos, pos);
@@ -8418,11 +8589,16 @@
}
ts.toPath = toPath;
function changesAffectModuleResolution(oldOptions, newOptions) {
- return oldOptions.configFilePath !== newOptions.configFilePath || ts.moduleResolutionOptionDeclarations.some(function (o) {
+ return oldOptions.configFilePath !== newOptions.configFilePath ||
+ optionsHaveModuleResolutionChanges(oldOptions, newOptions);
+ }
+ ts.changesAffectModuleResolution = changesAffectModuleResolution;
+ function optionsHaveModuleResolutionChanges(oldOptions, newOptions) {
+ return ts.moduleResolutionOptionDeclarations.some(function (o) {
return !ts.isJsonEqual(ts.getCompilerOptionValue(oldOptions, o), ts.getCompilerOptionValue(newOptions, o));
});
}
- ts.changesAffectModuleResolution = changesAffectModuleResolution;
+ ts.optionsHaveModuleResolutionChanges = optionsHaveModuleResolutionChanges;
function findAncestor(node, callback) {
while (node) {
var result = callback(node);
@@ -8591,7 +8767,7 @@
}
}
function getSourceFileOfNode(node) {
- while (node && node.kind !== 284 /* SourceFile */) {
+ while (node && node.kind !== 285 /* SourceFile */) {
node = node.parent;
}
return node;
@@ -8599,11 +8775,11 @@
ts.getSourceFileOfNode = getSourceFileOfNode;
function isStatementWithLocals(node) {
switch (node.kind) {
- case 218 /* Block */:
- case 246 /* CaseBlock */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 219 /* Block */:
+ case 247 /* CaseBlock */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
return true;
}
return false;
@@ -8771,7 +8947,7 @@
// the syntax list itself considers them as normal trivia. Therefore if we simply skip
// trivia for the list, we may have skipped the JSDocComment as well. So we should process its
// first child to determine the actual position of its first token.
- if (node.kind === 311 /* SyntaxList */ && node._children.length > 0) {
+ if (node.kind === 312 /* SyntaxList */ && node._children.length > 0) {
return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc);
}
return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos);
@@ -8790,7 +8966,7 @@
}
ts.getSourceTextOfNodeFromSourceFile = getSourceTextOfNodeFromSourceFile;
function isJSDocTypeExpressionOrChild(node) {
- return node.kind === 288 /* JSDocTypeExpression */ || (node.parent && isJSDocTypeExpressionOrChild(node.parent));
+ return node.kind === 289 /* JSDocTypeExpression */ || (node.parent && isJSDocTypeExpressionOrChild(node.parent));
}
function getTextOfNodeFromSourceText(sourceText, node, includeTrivia) {
if (includeTrivia === void 0) { includeTrivia = false; }
@@ -8882,7 +9058,7 @@
ts.isBlockOrCatchScoped = isBlockOrCatchScoped;
function isCatchClauseVariableDeclarationOrBindingElement(declaration) {
var node = getRootDeclaration(declaration);
- return node.kind === 237 /* VariableDeclaration */ && node.parent.kind === 274 /* CatchClause */;
+ return node.kind === 238 /* VariableDeclaration */ && node.parent.kind === 275 /* CatchClause */;
}
ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement;
function isAmbientModule(node) {
@@ -8914,11 +9090,11 @@
ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol;
function isShorthandAmbientModule(node) {
// The only kind of module that can be missing a body is a shorthand ambient module.
- return node && node.kind === 244 /* ModuleDeclaration */ && (!node.body);
+ return node && node.kind === 245 /* ModuleDeclaration */ && (!node.body);
}
function isBlockScopedContainerTopLevel(node) {
- return node.kind === 284 /* SourceFile */ ||
- node.kind === 244 /* ModuleDeclaration */ ||
+ return node.kind === 285 /* SourceFile */ ||
+ node.kind === 245 /* ModuleDeclaration */ ||
ts.isFunctionLike(node);
}
ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel;
@@ -8935,9 +9111,9 @@
// - defined in the top level scope and source file is an external module
// - defined inside ambient module declaration located in the top level scope and source file not an external module
switch (node.parent.kind) {
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return ts.isExternalModule(node.parent);
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
return isAmbientModule(node.parent.parent) && ts.isSourceFile(node.parent.parent.parent) && !ts.isExternalModule(node.parent.parent.parent);
}
return false;
@@ -8953,22 +9129,22 @@
ts.isEffectiveExternalModule = isEffectiveExternalModule;
function isBlockScope(node, parentNode) {
switch (node.kind) {
- case 284 /* SourceFile */:
- case 246 /* CaseBlock */:
- case 274 /* CatchClause */:
- case 244 /* ModuleDeclaration */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 157 /* Constructor */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 285 /* SourceFile */:
+ case 247 /* CaseBlock */:
+ case 275 /* CatchClause */:
+ case 245 /* ModuleDeclaration */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 158 /* Constructor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return true;
- case 218 /* Block */:
+ case 219 /* Block */:
// function block is not considered block-scope container
// see comment in binder.ts: bind(...), case for SyntaxKind.Block
return !ts.isFunctionLike(parentNode);
@@ -8978,9 +9154,9 @@
ts.isBlockScope = isBlockScope;
function isDeclarationWithTypeParameters(node) {
switch (node.kind) {
- case 302 /* JSDocCallbackTag */:
- case 309 /* JSDocTypedefTag */:
- case 298 /* JSDocSignature */:
+ case 303 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 299 /* JSDocSignature */:
return true;
default:
ts.assertType(node);
@@ -8990,25 +9166,25 @@
ts.isDeclarationWithTypeParameters = isDeclarationWithTypeParameters;
function isDeclarationWithTypeParameterChildren(node) {
switch (node.kind) {
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 155 /* MethodSignature */:
- case 162 /* IndexSignature */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 294 /* JSDocFunctionType */:
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 308 /* JSDocTemplateTag */:
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 156 /* MethodSignature */:
+ case 163 /* IndexSignature */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 295 /* JSDocFunctionType */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 309 /* JSDocTemplateTag */:
+ case 240 /* FunctionDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return true;
default:
ts.assertType(node);
@@ -9018,8 +9194,8 @@
ts.isDeclarationWithTypeParameterChildren = isDeclarationWithTypeParameterChildren;
function isAnyImportSyntax(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return true;
default:
return false;
@@ -9028,15 +9204,15 @@
ts.isAnyImportSyntax = isAnyImportSyntax;
function isLateVisibilityPaintedStatement(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
- case 219 /* VariableStatement */:
- case 240 /* ClassDeclaration */:
- case 239 /* FunctionDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 220 /* VariableStatement */:
+ case 241 /* ClassDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
return true;
default:
return false;
@@ -9066,13 +9242,13 @@
ts.getNameFromIndexInfo = getNameFromIndexInfo;
function getTextOfPropertyName(name) {
switch (name.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return name.escapedText;
case 10 /* StringLiteral */:
case 8 /* NumericLiteral */:
case 14 /* NoSubstitutionTemplateLiteral */:
return ts.escapeLeadingUnderscores(name.text);
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
if (isStringOrNumericLiteralLike(name.expression))
return ts.escapeLeadingUnderscores(name.expression.text);
return ts.Debug.fail("Text of property name cannot be read from non-literal-valued ComputedPropertyNames");
@@ -9083,11 +9259,11 @@
ts.getTextOfPropertyName = getTextOfPropertyName;
function entityNameToString(name) {
switch (name.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return getFullWidth(name) === 0 ? ts.idText(name) : getTextOfNode(name);
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
return entityNameToString(name.left) + "." + entityNameToString(name.right);
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return entityNameToString(name.expression) + "." + entityNameToString(name.name);
default:
throw ts.Debug.assertNever(name);
@@ -9132,7 +9308,7 @@
ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition;
function getErrorSpanForArrowFunction(sourceFile, node) {
var pos = ts.skipTrivia(sourceFile.text, node.pos);
- if (node.body && node.body.kind === 218 /* Block */) {
+ if (node.body && node.body.kind === 219 /* Block */) {
var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line;
var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line;
if (startLine < endLine) {
@@ -9146,7 +9322,7 @@
function getErrorSpanForNode(sourceFile, node) {
var errorNode = node;
switch (node.kind) {
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
var pos_1 = ts.skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false);
if (pos_1 === sourceFile.text.length) {
// file is empty - return span for the beginning of the file
@@ -9155,25 +9331,25 @@
return getSpanOfTokenAtPosition(sourceFile, pos_1);
// This list is a work in progress. Add missing node kinds to improve their error
// spans.
- case 237 /* VariableDeclaration */:
- case 186 /* BindingElement */:
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 243 /* EnumDeclaration */:
- case 278 /* EnumMember */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 242 /* TypeAliasDeclaration */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 238 /* VariableDeclaration */:
+ case 187 /* BindingElement */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 279 /* EnumMember */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 243 /* TypeAliasDeclaration */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
errorNode = node.name;
break;
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return getErrorSpanForArrowFunction(sourceFile, node);
}
if (errorNode === undefined) {
@@ -9222,11 +9398,11 @@
}
ts.isLet = isLet;
function isSuperCall(n) {
- return n.kind === 191 /* CallExpression */ && n.expression.kind === 98 /* SuperKeyword */;
+ return n.kind === 192 /* CallExpression */ && n.expression.kind === 99 /* SuperKeyword */;
}
ts.isSuperCall = isSuperCall;
function isImportCall(n) {
- return n.kind === 191 /* CallExpression */ && n.expression.kind === 92 /* ImportKeyword */;
+ return n.kind === 192 /* CallExpression */ && n.expression.kind === 93 /* ImportKeyword */;
}
ts.isImportCall = isImportCall;
function isLiteralImportTypeNode(n) {
@@ -9234,7 +9410,7 @@
}
ts.isLiteralImportTypeNode = isLiteralImportTypeNode;
function isPrologueDirective(node) {
- return node.kind === 221 /* ExpressionStatement */
+ return node.kind === 222 /* ExpressionStatement */
&& node.expression.kind === 10 /* StringLiteral */;
}
ts.isPrologueDirective = isPrologueDirective;
@@ -9243,11 +9419,11 @@
}
ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode;
function getJSDocCommentRanges(node, text) {
- var commentRanges = (node.kind === 151 /* Parameter */ ||
- node.kind === 150 /* TypeParameter */ ||
- node.kind === 196 /* FunctionExpression */ ||
- node.kind === 197 /* ArrowFunction */ ||
- node.kind === 195 /* ParenthesizedExpression */) ?
+ var commentRanges = (node.kind === 152 /* Parameter */ ||
+ node.kind === 151 /* TypeParameter */ ||
+ node.kind === 197 /* FunctionExpression */ ||
+ node.kind === 198 /* ArrowFunction */ ||
+ node.kind === 196 /* ParenthesizedExpression */) ?
ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) :
ts.getLeadingCommentRanges(text, node.pos);
// True if the comment starts with '/**' but not if it is '/**/'
@@ -9263,48 +9439,48 @@
ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*<amd-dependency\s+path\s*=\s*)('|")(.+?)\2.*?\/>/;
var defaultLibReferenceRegEx = /^(\/\/\/\s*<reference\s+no-default-lib\s*=\s*)('|")(.+?)\2\s*\/>/;
function isPartOfTypeNode(node) {
- if (163 /* FirstTypeNode */ <= node.kind && node.kind <= 183 /* LastTypeNode */) {
+ if (164 /* FirstTypeNode */ <= node.kind && node.kind <= 184 /* LastTypeNode */) {
return true;
}
switch (node.kind) {
- case 120 /* AnyKeyword */:
- case 143 /* UnknownKeyword */:
- case 135 /* NumberKeyword */:
- case 146 /* BigIntKeyword */:
- case 138 /* StringKeyword */:
- case 123 /* BooleanKeyword */:
- case 139 /* SymbolKeyword */:
- case 136 /* ObjectKeyword */:
- case 141 /* UndefinedKeyword */:
- case 132 /* NeverKeyword */:
- return true;
- case 106 /* VoidKeyword */:
- return node.parent.kind !== 200 /* VoidExpression */;
- case 211 /* ExpressionWithTypeArguments */:
+ case 121 /* AnyKeyword */:
+ case 144 /* UnknownKeyword */:
+ case 136 /* NumberKeyword */:
+ case 147 /* BigIntKeyword */:
+ case 139 /* StringKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 137 /* ObjectKeyword */:
+ case 142 /* UndefinedKeyword */:
+ case 133 /* NeverKeyword */:
+ return true;
+ case 107 /* VoidKeyword */:
+ return node.parent.kind !== 201 /* VoidExpression */;
+ case 212 /* ExpressionWithTypeArguments */:
return !isExpressionWithTypeArgumentsInClassExtendsClause(node);
- case 150 /* TypeParameter */:
- return node.parent.kind === 181 /* MappedType */ || node.parent.kind === 176 /* InferType */;
+ case 151 /* TypeParameter */:
+ return node.parent.kind === 182 /* MappedType */ || node.parent.kind === 177 /* InferType */;
// Identifiers and qualified names may be type nodes, depending on their context. Climb
// above them to find the lowest container
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
// If the identifier is the RHS of a qualified name, then it's a type iff its parent is.
- if (node.parent.kind === 148 /* QualifiedName */ && node.parent.right === node) {
+ if (node.parent.kind === 149 /* QualifiedName */ && node.parent.right === node) {
node = node.parent;
}
- else if (node.parent.kind === 189 /* PropertyAccessExpression */ && node.parent.name === node) {
+ else if (node.parent.kind === 190 /* PropertyAccessExpression */ && node.parent.name === node) {
node = node.parent;
}
// At this point, node is either a qualified name or an identifier
- ts.Debug.assert(node.kind === 72 /* Identifier */ || node.kind === 148 /* QualifiedName */ || node.kind === 189 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'.");
+ ts.Debug.assert(node.kind === 73 /* Identifier */ || node.kind === 149 /* QualifiedName */ || node.kind === 190 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'.");
// falls through
- case 148 /* QualifiedName */:
- case 189 /* PropertyAccessExpression */:
- case 100 /* ThisKeyword */: {
+ case 149 /* QualifiedName */:
+ case 190 /* PropertyAccessExpression */:
+ case 101 /* ThisKeyword */: {
var parent = node.parent;
- if (parent.kind === 167 /* TypeQuery */) {
+ if (parent.kind === 168 /* TypeQuery */) {
return false;
}
- if (parent.kind === 183 /* ImportType */) {
+ if (parent.kind === 184 /* ImportType */) {
return !parent.isTypeOf;
}
// Do not recursively call isPartOfTypeNode on the parent. In the example:
@@ -9313,40 +9489,40 @@
//
// Calling isPartOfTypeNode would consider the qualified name A.B a type node.
// Only C and A.B.C are type nodes.
- if (163 /* FirstTypeNode */ <= parent.kind && parent.kind <= 183 /* LastTypeNode */) {
+ if (164 /* FirstTypeNode */ <= parent.kind && parent.kind <= 184 /* LastTypeNode */) {
return true;
}
switch (parent.kind) {
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return !isExpressionWithTypeArgumentsInClassExtendsClause(parent);
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
return node === parent.constraint;
- case 308 /* JSDocTemplateTag */:
+ case 309 /* JSDocTemplateTag */:
return node === parent.constraint;
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 151 /* Parameter */:
- case 237 /* VariableDeclaration */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 152 /* Parameter */:
+ case 238 /* VariableDeclaration */:
return node === parent.type;
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 157 /* Constructor */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 158 /* Constructor */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return node === parent.type;
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
return node === parent.type;
- case 194 /* TypeAssertionExpression */:
+ case 195 /* TypeAssertionExpression */:
return node === parent.type;
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
return ts.contains(parent.typeArguments, node);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
// TODO (drosen): TaggedTemplateExpressions may eventually support type arguments.
return false;
}
@@ -9371,23 +9547,23 @@
return traverse(body);
function traverse(node) {
switch (node.kind) {
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return visitor(node);
- case 246 /* CaseBlock */:
- case 218 /* Block */:
- case 222 /* IfStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 231 /* WithStatement */:
- case 232 /* SwitchStatement */:
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
- case 233 /* LabeledStatement */:
- case 235 /* TryStatement */:
- case 274 /* CatchClause */:
+ case 247 /* CaseBlock */:
+ case 219 /* Block */:
+ case 223 /* IfStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 232 /* WithStatement */:
+ case 233 /* SwitchStatement */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
+ case 234 /* LabeledStatement */:
+ case 236 /* TryStatement */:
+ case 275 /* CatchClause */:
return ts.forEachChild(node, traverse);
}
}
@@ -9397,26 +9573,26 @@
return traverse(body);
function traverse(node) {
switch (node.kind) {
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
visitor(node);
var operand = node.expression;
if (operand) {
traverse(operand);
}
return;
- case 243 /* EnumDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 244 /* EnumDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
// These are not allowed inside a generator now, but eventually they may be allowed
// as local types. Regardless, any yield statements contained within them should be
// skipped in this traversal.
return;
default:
if (ts.isFunctionLike(node)) {
- if (node.name && node.name.kind === 149 /* ComputedPropertyName */) {
+ if (node.name && node.name.kind === 150 /* ComputedPropertyName */) {
// Note that we will not include methods/accessors of a class because they would require
// first descending into the class. This is by design.
traverse(node.name.expression);
@@ -9439,10 +9615,10 @@
* @param node The type node.
*/
function getRestParameterElementType(node) {
- if (node && node.kind === 169 /* ArrayType */) {
+ if (node && node.kind === 170 /* ArrayType */) {
return node.elementType;
}
- else if (node && node.kind === 164 /* TypeReference */) {
+ else if (node && node.kind === 165 /* TypeReference */) {
return ts.singleOrUndefined(node.typeArguments);
}
else {
@@ -9452,12 +9628,12 @@
ts.getRestParameterElementType = getRestParameterElementType;
function getMembersOfDeclaration(node) {
switch (node.kind) {
- case 241 /* InterfaceDeclaration */:
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 168 /* TypeLiteral */:
+ case 242 /* InterfaceDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 169 /* TypeLiteral */:
return node.members;
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return node.properties;
}
}
@@ -9465,14 +9641,14 @@
function isVariableLike(node) {
if (node) {
switch (node.kind) {
- case 186 /* BindingElement */:
- case 278 /* EnumMember */:
- case 151 /* Parameter */:
- case 275 /* PropertyAssignment */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 276 /* ShorthandPropertyAssignment */:
- case 237 /* VariableDeclaration */:
+ case 187 /* BindingElement */:
+ case 279 /* EnumMember */:
+ case 152 /* Parameter */:
+ case 276 /* PropertyAssignment */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 277 /* ShorthandPropertyAssignment */:
+ case 238 /* VariableDeclaration */:
return true;
}
}
@@ -9484,8 +9660,8 @@
}
ts.isVariableLikeOrAccessor = isVariableLikeOrAccessor;
function isVariableDeclarationInVariableStatement(node) {
- return node.parent.kind === 238 /* VariableDeclarationList */
- && node.parent.parent.kind === 219 /* VariableStatement */;
+ return node.parent.kind === 239 /* VariableDeclarationList */
+ && node.parent.parent.kind === 220 /* VariableStatement */;
}
ts.isVariableDeclarationInVariableStatement = isVariableDeclarationInVariableStatement;
function isValidESSymbolDeclaration(node) {
@@ -9496,13 +9672,13 @@
ts.isValidESSymbolDeclaration = isValidESSymbolDeclaration;
function introducesArgumentsExoticObject(node) {
switch (node.kind) {
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
return true;
}
return false;
@@ -9513,7 +9689,7 @@
if (beforeUnwrapLabelCallback) {
beforeUnwrapLabelCallback(node);
}
- if (node.statement.kind !== 233 /* LabeledStatement */) {
+ if (node.statement.kind !== 234 /* LabeledStatement */) {
return node.statement;
}
node = node.statement;
@@ -9521,17 +9697,17 @@
}
ts.unwrapInnermostStatementOfLabel = unwrapInnermostStatementOfLabel;
function isFunctionBlock(node) {
- return node && node.kind === 218 /* Block */ && ts.isFunctionLike(node.parent);
+ return node && node.kind === 219 /* Block */ && ts.isFunctionLike(node.parent);
}
ts.isFunctionBlock = isFunctionBlock;
function isObjectLiteralMethod(node) {
- return node && node.kind === 156 /* MethodDeclaration */ && node.parent.kind === 188 /* ObjectLiteralExpression */;
+ return node && node.kind === 157 /* MethodDeclaration */ && node.parent.kind === 189 /* ObjectLiteralExpression */;
}
ts.isObjectLiteralMethod = isObjectLiteralMethod;
function isObjectLiteralOrClassExpressionMethod(node) {
- return node.kind === 156 /* MethodDeclaration */ &&
- (node.parent.kind === 188 /* ObjectLiteralExpression */ ||
- node.parent.kind === 209 /* ClassExpression */);
+ return node.kind === 157 /* MethodDeclaration */ &&
+ (node.parent.kind === 189 /* ObjectLiteralExpression */ ||
+ node.parent.kind === 210 /* ClassExpression */);
}
ts.isObjectLiteralOrClassExpressionMethod = isObjectLiteralOrClassExpressionMethod;
function isIdentifierTypePredicate(predicate) {
@@ -9544,7 +9720,7 @@
ts.isThisTypePredicate = isThisTypePredicate;
function getPropertyAssignment(objectLiteral, key, key2) {
return objectLiteral.properties.filter(function (property) {
- if (property.kind === 275 /* PropertyAssignment */) {
+ if (property.kind === 276 /* PropertyAssignment */) {
var propName = getTextOfPropertyName(property.name);
return key === propName || (!!key2 && key2 === propName);
}
@@ -9576,19 +9752,23 @@
return findAncestor(node.parent, ts.isFunctionLike);
}
ts.getContainingFunction = getContainingFunction;
+ function getContainingFunctionDeclaration(node) {
+ return findAncestor(node.parent, ts.isFunctionLikeDeclaration);
+ }
+ ts.getContainingFunctionDeclaration = getContainingFunctionDeclaration;
function getContainingClass(node) {
return findAncestor(node.parent, ts.isClassLike);
}
ts.getContainingClass = getContainingClass;
function getThisContainer(node, includeArrowFunctions) {
- ts.Debug.assert(node.kind !== 284 /* SourceFile */);
+ ts.Debug.assert(node.kind !== 285 /* SourceFile */);
while (true) {
node = node.parent;
if (!node) {
return ts.Debug.fail(); // If we never pass in a SourceFile, this should be unreachable, since we'll stop when we reach that.
}
switch (node.kind) {
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
// If the grandparent node is an object literal (as opposed to a class),
// then the computed property is not a 'this' container.
// A computed property name in a class needs to be a this container
@@ -9603,9 +9783,9 @@
// the *body* of the container.
node = node.parent;
break;
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
// Decorators are always applied outside of the body of a class or method.
- if (node.parent.kind === 151 /* Parameter */ && ts.isClassElement(node.parent.parent)) {
+ if (node.parent.kind === 152 /* Parameter */ && ts.isClassElement(node.parent.parent)) {
// If the decorator's parent is a Parameter, we resolve the this container from
// the grandparent class declaration.
node = node.parent.parent;
@@ -9616,26 +9796,26 @@
node = node.parent;
}
break;
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
if (!includeArrowFunctions) {
continue;
}
// falls through
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 244 /* ModuleDeclaration */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
- case 243 /* EnumDeclaration */:
- case 284 /* SourceFile */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 245 /* ModuleDeclaration */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
+ case 244 /* EnumDeclaration */:
+ case 285 /* SourceFile */:
return node;
}
}
@@ -9645,9 +9825,9 @@
var container = getThisContainer(node, /*includeArrowFunctions*/ false);
if (container) {
switch (container.kind) {
- case 157 /* Constructor */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
+ case 158 /* Constructor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
return container;
}
}
@@ -9669,27 +9849,27 @@
return node;
}
switch (node.kind) {
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
node = node.parent;
break;
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
if (!stopOnFunctions) {
continue;
}
// falls through
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return node;
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
// Decorators are always applied outside of the body of a class or method.
- if (node.parent.kind === 151 /* Parameter */ && ts.isClassElement(node.parent.parent)) {
+ if (node.parent.kind === 152 /* Parameter */ && ts.isClassElement(node.parent.parent)) {
// If the decorator's parent is a Parameter, we resolve the this container from
// the grandparent class declaration.
node = node.parent.parent;
@@ -9705,21 +9885,21 @@
}
ts.getSuperContainer = getSuperContainer;
function getImmediatelyInvokedFunctionExpression(func) {
- if (func.kind === 196 /* FunctionExpression */ || func.kind === 197 /* ArrowFunction */) {
+ if (func.kind === 197 /* FunctionExpression */ || func.kind === 198 /* ArrowFunction */) {
var prev = func;
var parent = func.parent;
- while (parent.kind === 195 /* ParenthesizedExpression */) {
+ while (parent.kind === 196 /* ParenthesizedExpression */) {
prev = parent;
parent = parent.parent;
}
- if (parent.kind === 191 /* CallExpression */ && parent.expression === prev) {
+ if (parent.kind === 192 /* CallExpression */ && parent.expression === prev) {
return parent;
}
}
}
ts.getImmediatelyInvokedFunctionExpression = getImmediatelyInvokedFunctionExpression;
function isSuperOrSuperProperty(node) {
- return node.kind === 98 /* SuperKeyword */
+ return node.kind === 99 /* SuperKeyword */
|| isSuperProperty(node);
}
ts.isSuperOrSuperProperty = isSuperOrSuperProperty;
@@ -9728,8 +9908,8 @@
*/
function isSuperProperty(node) {
var kind = node.kind;
- return (kind === 189 /* PropertyAccessExpression */ || kind === 190 /* ElementAccessExpression */)
- && node.expression.kind === 98 /* SuperKeyword */;
+ return (kind === 190 /* PropertyAccessExpression */ || kind === 191 /* ElementAccessExpression */)
+ && node.expression.kind === 99 /* SuperKeyword */;
}
ts.isSuperProperty = isSuperProperty;
/**
@@ -9737,20 +9917,20 @@
*/
function isThisProperty(node) {
var kind = node.kind;
- return (kind === 189 /* PropertyAccessExpression */ || kind === 190 /* ElementAccessExpression */)
- && node.expression.kind === 100 /* ThisKeyword */;
+ return (kind === 190 /* PropertyAccessExpression */ || kind === 191 /* ElementAccessExpression */)
+ && node.expression.kind === 101 /* ThisKeyword */;
}
ts.isThisProperty = isThisProperty;
function getEntityNameFromTypeNode(node) {
switch (node.kind) {
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return node.typeName;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return isEntityNameExpression(node.expression)
? node.expression
: undefined;
- case 72 /* Identifier */:
- case 148 /* QualifiedName */:
+ case 73 /* Identifier */:
+ case 149 /* QualifiedName */:
return node;
}
return undefined;
@@ -9758,10 +9938,10 @@
ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode;
function getInvokedExpression(node) {
switch (node.kind) {
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return node.tag;
- case 262 /* JsxOpeningElement */:
- case 261 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
+ case 262 /* JsxSelfClosingElement */:
return node.tagName;
default:
return node.expression;
@@ -9770,25 +9950,25 @@
ts.getInvokedExpression = getInvokedExpression;
function nodeCanBeDecorated(node, parent, grandparent) {
switch (node.kind) {
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
// classes are valid targets
return true;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
// property declarations are valid if their parent is a class declaration.
- return parent.kind === 240 /* ClassDeclaration */;
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 156 /* MethodDeclaration */:
+ return parent.kind === 241 /* ClassDeclaration */;
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
// if this method has a body and its parent is a class declaration, this is a valid target.
return node.body !== undefined
- && parent.kind === 240 /* ClassDeclaration */;
- case 151 /* Parameter */:
+ && parent.kind === 241 /* ClassDeclaration */;
+ case 152 /* Parameter */:
// if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target;
return parent.body !== undefined
- && (parent.kind === 157 /* Constructor */
- || parent.kind === 156 /* MethodDeclaration */
- || parent.kind === 159 /* SetAccessor */)
- && grandparent.kind === 240 /* ClassDeclaration */;
+ && (parent.kind === 158 /* Constructor */
+ || parent.kind === 157 /* MethodDeclaration */
+ || parent.kind === 160 /* SetAccessor */)
+ && grandparent.kind === 241 /* ClassDeclaration */;
}
return false;
}
@@ -9804,10 +9984,10 @@
ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated;
function childIsDecorated(node, parent) {
switch (node.kind) {
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return ts.some(node.members, function (m) { return nodeOrChildIsDecorated(m, node, parent); }); // TODO: GH#18217
- case 156 /* MethodDeclaration */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 160 /* SetAccessor */:
return ts.some(node.parameters, function (p) { return nodeIsDecorated(p, node, parent); }); // TODO: GH#18217
default:
return false;
@@ -9816,9 +9996,9 @@
ts.childIsDecorated = childIsDecorated;
function isJSXTagName(node) {
var parent = node.parent;
- if (parent.kind === 262 /* JsxOpeningElement */ ||
- parent.kind === 261 /* JsxSelfClosingElement */ ||
- parent.kind === 263 /* JsxClosingElement */) {
+ if (parent.kind === 263 /* JsxOpeningElement */ ||
+ parent.kind === 262 /* JsxSelfClosingElement */ ||
+ parent.kind === 264 /* JsxClosingElement */) {
return parent.tagName === node;
}
return false;
@@ -9826,57 +10006,57 @@
ts.isJSXTagName = isJSXTagName;
function isExpressionNode(node) {
switch (node.kind) {
- case 98 /* SuperKeyword */:
- case 96 /* NullKeyword */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
+ case 99 /* SuperKeyword */:
+ case 97 /* NullKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
case 13 /* RegularExpressionLiteral */:
- case 187 /* ArrayLiteralExpression */:
- case 188 /* ObjectLiteralExpression */:
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
- case 193 /* TaggedTemplateExpression */:
- case 212 /* AsExpression */:
- case 194 /* TypeAssertionExpression */:
- case 213 /* NonNullExpression */:
- case 195 /* ParenthesizedExpression */:
- case 196 /* FunctionExpression */:
- case 209 /* ClassExpression */:
- case 197 /* ArrowFunction */:
- case 200 /* VoidExpression */:
- case 198 /* DeleteExpression */:
- case 199 /* TypeOfExpression */:
- case 202 /* PrefixUnaryExpression */:
- case 203 /* PostfixUnaryExpression */:
- case 204 /* BinaryExpression */:
- case 205 /* ConditionalExpression */:
- case 208 /* SpreadElement */:
- case 206 /* TemplateExpression */:
+ case 188 /* ArrayLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
+ case 194 /* TaggedTemplateExpression */:
+ case 213 /* AsExpression */:
+ case 195 /* TypeAssertionExpression */:
+ case 214 /* NonNullExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 197 /* FunctionExpression */:
+ case 210 /* ClassExpression */:
+ case 198 /* ArrowFunction */:
+ case 201 /* VoidExpression */:
+ case 199 /* DeleteExpression */:
+ case 200 /* TypeOfExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
+ case 205 /* BinaryExpression */:
+ case 206 /* ConditionalExpression */:
+ case 209 /* SpreadElement */:
+ case 207 /* TemplateExpression */:
case 14 /* NoSubstitutionTemplateLiteral */:
- case 210 /* OmittedExpression */:
- case 260 /* JsxElement */:
- case 261 /* JsxSelfClosingElement */:
- case 264 /* JsxFragment */:
- case 207 /* YieldExpression */:
- case 201 /* AwaitExpression */:
- case 214 /* MetaProperty */:
+ case 211 /* OmittedExpression */:
+ case 261 /* JsxElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 265 /* JsxFragment */:
+ case 208 /* YieldExpression */:
+ case 202 /* AwaitExpression */:
+ case 215 /* MetaProperty */:
return true;
- case 148 /* QualifiedName */:
- while (node.parent.kind === 148 /* QualifiedName */) {
+ case 149 /* QualifiedName */:
+ while (node.parent.kind === 149 /* QualifiedName */) {
node = node.parent;
}
- return node.parent.kind === 167 /* TypeQuery */ || isJSXTagName(node);
- case 72 /* Identifier */:
- if (node.parent.kind === 167 /* TypeQuery */ || isJSXTagName(node)) {
+ return node.parent.kind === 168 /* TypeQuery */ || isJSXTagName(node);
+ case 73 /* Identifier */:
+ if (node.parent.kind === 168 /* TypeQuery */ || isJSXTagName(node)) {
return true;
}
// falls through
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
case 10 /* StringLiteral */:
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
return isInExpressionContext(node);
default:
return false;
@@ -9886,49 +10066,49 @@
function isInExpressionContext(node) {
var parent = node.parent;
switch (parent.kind) {
- case 237 /* VariableDeclaration */:
- case 151 /* Parameter */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 278 /* EnumMember */:
- case 275 /* PropertyAssignment */:
- case 186 /* BindingElement */:
+ case 238 /* VariableDeclaration */:
+ case 152 /* Parameter */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 279 /* EnumMember */:
+ case 276 /* PropertyAssignment */:
+ case 187 /* BindingElement */:
return parent.initializer === node;
- case 221 /* ExpressionStatement */:
- case 222 /* IfStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
- case 230 /* ReturnStatement */:
- case 231 /* WithStatement */:
- case 232 /* SwitchStatement */:
- case 271 /* CaseClause */:
- case 234 /* ThrowStatement */:
+ case 222 /* ExpressionStatement */:
+ case 223 /* IfStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
+ case 231 /* ReturnStatement */:
+ case 232 /* WithStatement */:
+ case 233 /* SwitchStatement */:
+ case 272 /* CaseClause */:
+ case 235 /* ThrowStatement */:
return parent.expression === node;
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
var forStatement = parent;
- return (forStatement.initializer === node && forStatement.initializer.kind !== 238 /* VariableDeclarationList */) ||
+ return (forStatement.initializer === node && forStatement.initializer.kind !== 239 /* VariableDeclarationList */) ||
forStatement.condition === node ||
forStatement.incrementor === node;
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
var forInStatement = parent;
- return (forInStatement.initializer === node && forInStatement.initializer.kind !== 238 /* VariableDeclarationList */) ||
+ return (forInStatement.initializer === node && forInStatement.initializer.kind !== 239 /* VariableDeclarationList */) ||
forInStatement.expression === node;
- case 194 /* TypeAssertionExpression */:
- case 212 /* AsExpression */:
+ case 195 /* TypeAssertionExpression */:
+ case 213 /* AsExpression */:
return node === parent.expression;
- case 216 /* TemplateSpan */:
+ case 217 /* TemplateSpan */:
return node === parent.expression;
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
return node === parent.expression;
- case 152 /* Decorator */:
- case 270 /* JsxExpression */:
- case 269 /* JsxSpreadAttribute */:
- case 277 /* SpreadAssignment */:
+ case 153 /* Decorator */:
+ case 271 /* JsxExpression */:
+ case 270 /* JsxSpreadAttribute */:
+ case 278 /* SpreadAssignment */:
return true;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return parent.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent);
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return parent.objectAssignmentInitializer === node;
default:
return isExpressionNode(parent);
@@ -9936,7 +10116,7 @@
}
ts.isInExpressionContext = isInExpressionContext;
function isExternalModuleImportEqualsDeclaration(node) {
- return node.kind === 248 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 259 /* ExternalModuleReference */;
+ return node.kind === 249 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 260 /* ExternalModuleReference */;
}
ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration;
function getExternalModuleImportEqualsDeclarationExpression(node) {
@@ -9945,7 +10125,7 @@
}
ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression;
function isInternalModuleImportEqualsDeclaration(node) {
- return node.kind === 248 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 259 /* ExternalModuleReference */;
+ return node.kind === 249 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 260 /* ExternalModuleReference */;
}
ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration;
function isSourceFileJS(file) {
@@ -9973,15 +10153,15 @@
ts.isIdentifier(node.typeName) &&
node.typeName.escapedText === "Object" &&
node.typeArguments && node.typeArguments.length === 2 &&
- (node.typeArguments[0].kind === 138 /* StringKeyword */ || node.typeArguments[0].kind === 135 /* NumberKeyword */);
+ (node.typeArguments[0].kind === 139 /* StringKeyword */ || node.typeArguments[0].kind === 136 /* NumberKeyword */);
}
ts.isJSDocIndexSignature = isJSDocIndexSignature;
function isRequireCall(callExpression, checkArgumentIsStringLiteralLike) {
- if (callExpression.kind !== 191 /* CallExpression */) {
+ if (callExpression.kind !== 192 /* CallExpression */) {
return false;
}
var _a = callExpression, expression = _a.expression, args = _a.arguments;
- if (expression.kind !== 72 /* Identifier */ || expression.escapedText !== "require") {
+ if (expression.kind !== 73 /* Identifier */ || expression.escapedText !== "require") {
return false;
}
if (args.length !== 1) {
@@ -10012,7 +10192,7 @@
name = node.parent.name;
decl = node.parent;
}
- else if (ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 59 /* EqualsToken */ && node.parent.right === node) {
+ else if (ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 60 /* EqualsToken */ && node.parent.right === node) {
name = node.parent.left;
decl = name;
}
@@ -10021,7 +10201,7 @@
name = node.parent.parent.name;
decl = node.parent.parent;
}
- else if (ts.isBinaryExpression(node.parent.parent) && node.parent.parent.operatorToken.kind === 59 /* EqualsToken */ && node.parent.parent.right === node.parent) {
+ else if (ts.isBinaryExpression(node.parent.parent) && node.parent.parent.operatorToken.kind === 60 /* EqualsToken */ && node.parent.parent.right === node.parent) {
name = node.parent.parent.left;
decl = name;
}
@@ -10063,7 +10243,7 @@
* We treat the right hand side of assignments with container-like initalizers as declarations.
*/
function getAssignedExpandoInitializer(node) {
- if (node && node.parent && ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 59 /* EqualsToken */) {
+ if (node && node.parent && ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 60 /* EqualsToken */) {
var isPrototypeAssignment = isPrototypeAccess(node.parent.left);
return getExpandoInitializer(node.parent.right, isPrototypeAssignment) ||
getDefaultedExpandoInitializer(node.parent.left, node.parent.right, isPrototypeAssignment);
@@ -10089,11 +10269,11 @@
function getExpandoInitializer(initializer, isPrototypeAssignment) {
if (ts.isCallExpression(initializer)) {
var e = skipParentheses(initializer.expression);
- return e.kind === 196 /* FunctionExpression */ || e.kind === 197 /* ArrowFunction */ ? initializer : undefined;
+ return e.kind === 197 /* FunctionExpression */ || e.kind === 198 /* ArrowFunction */ ? initializer : undefined;
}
- if (initializer.kind === 196 /* FunctionExpression */ ||
- initializer.kind === 209 /* ClassExpression */ ||
- initializer.kind === 197 /* ArrowFunction */) {
+ if (initializer.kind === 197 /* FunctionExpression */ ||
+ initializer.kind === 210 /* ClassExpression */ ||
+ initializer.kind === 198 /* ArrowFunction */) {
return initializer;
}
if (ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || isPrototypeAssignment)) {
@@ -10117,7 +10297,7 @@
}
function isDefaultedExpandoInitializer(node) {
var name = ts.isVariableDeclaration(node.parent) ? node.parent.name :
- ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 59 /* EqualsToken */ ? node.parent.left :
+ ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 60 /* EqualsToken */ ? node.parent.left :
undefined;
return name && getExpandoInitializer(node.right, isPrototypeAccess(name)) && isEntityNameExpression(name) && isSameEntityName(name, node.left);
}
@@ -10126,7 +10306,7 @@
function getNameOfExpando(node) {
if (ts.isBinaryExpression(node.parent)) {
var parent = (node.parent.operatorToken.kind === 55 /* BarBarToken */ && ts.isBinaryExpression(node.parent.parent)) ? node.parent.parent : node.parent;
- if (parent.operatorToken.kind === 59 /* EqualsToken */ && ts.isIdentifier(parent.left)) {
+ if (parent.operatorToken.kind === 60 /* EqualsToken */ && ts.isIdentifier(parent.left)) {
return parent.left;
}
}
@@ -10149,7 +10329,7 @@
return name.escapedText === initializer.escapedText;
}
if (ts.isIdentifier(name) && ts.isPropertyAccessExpression(initializer)) {
- return (initializer.expression.kind === 100 /* ThisKeyword */ ||
+ return (initializer.expression.kind === 101 /* ThisKeyword */ ||
ts.isIdentifier(initializer.expression) &&
(initializer.expression.escapedText === "window" ||
initializer.expression.escapedText === "self" ||
@@ -10207,7 +10387,7 @@
}
return 7 /* ObjectDefinePropertyValue */;
}
- if (expr.operatorToken.kind !== 59 /* EqualsToken */ ||
+ if (expr.operatorToken.kind !== 60 /* EqualsToken */ ||
!ts.isPropertyAccessExpression(expr.left)) {
return 0 /* None */;
}
@@ -10219,7 +10399,7 @@
return getAssignmentDeclarationPropertyAccessKind(lhs);
}
function getAssignmentDeclarationPropertyAccessKind(lhs) {
- if (lhs.expression.kind === 100 /* ThisKeyword */) {
+ if (lhs.expression.kind === 101 /* ThisKeyword */) {
return 4 /* ThisProperty */;
}
else if (isModuleExportsPropertyAccessExpression(lhs)) {
@@ -10261,7 +10441,7 @@
ts.isPrototypePropertyAssignment = isPrototypePropertyAssignment;
function isSpecialPropertyDeclaration(expr) {
return isInJSFile(expr) &&
- expr.parent && expr.parent.kind === 221 /* ExpressionStatement */ &&
+ expr.parent && expr.parent.kind === 222 /* ExpressionStatement */ &&
!!ts.getJSDocTypeTag(expr.parent);
}
ts.isSpecialPropertyDeclaration = isSpecialPropertyDeclaration;
@@ -10270,23 +10450,23 @@
return false;
}
var decl = symbol.valueDeclaration;
- return decl.kind === 239 /* FunctionDeclaration */ || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer);
+ return decl.kind === 240 /* FunctionDeclaration */ || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer);
}
ts.isFunctionSymbol = isFunctionSymbol;
function importFromModuleSpecifier(node) {
- return tryGetImportFromModuleSpecifier(node) || ts.Debug.fail(ts.Debug.showSyntaxKind(node.parent));
+ return tryGetImportFromModuleSpecifier(node) || ts.Debug.failBadSyntaxKind(node.parent);
}
ts.importFromModuleSpecifier = importFromModuleSpecifier;
function tryGetImportFromModuleSpecifier(node) {
switch (node.parent.kind) {
- case 249 /* ImportDeclaration */:
- case 255 /* ExportDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 256 /* ExportDeclaration */:
return node.parent;
- case 259 /* ExternalModuleReference */:
+ case 260 /* ExternalModuleReference */:
return node.parent.parent;
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return isImportCall(node.parent) || isRequireCall(node.parent, /*checkArg*/ false) ? node.parent : undefined;
- case 182 /* LiteralType */:
+ case 183 /* LiteralType */:
ts.Debug.assert(ts.isStringLiteral(node));
return ts.tryCast(node.parent.parent, ts.isImportTypeNode);
default:
@@ -10296,12 +10476,12 @@
ts.tryGetImportFromModuleSpecifier = tryGetImportFromModuleSpecifier;
function getExternalModuleName(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
- case 255 /* ExportDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 256 /* ExportDeclaration */:
return node.moduleSpecifier;
- case 248 /* ImportEqualsDeclaration */:
- return node.moduleReference.kind === 259 /* ExternalModuleReference */ ? node.moduleReference.expression : undefined;
- case 183 /* ImportType */:
+ case 249 /* ImportEqualsDeclaration */:
+ return node.moduleReference.kind === 260 /* ExternalModuleReference */ ? node.moduleReference.expression : undefined;
+ case 184 /* ImportType */:
return isLiteralImportTypeNode(node) ? node.argument.literal : undefined;
default:
return ts.Debug.assertNever(node);
@@ -10310,11 +10490,11 @@
ts.getExternalModuleName = getExternalModuleName;
function getNamespaceDeclarationNode(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return node.importClause && ts.tryCast(node.importClause.namedBindings, ts.isNamespaceImport);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return node;
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return undefined;
default:
return ts.Debug.assertNever(node);
@@ -10322,19 +10502,19 @@
}
ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode;
function isDefaultImport(node) {
- return node.kind === 249 /* ImportDeclaration */ && !!node.importClause && !!node.importClause.name;
+ return node.kind === 250 /* ImportDeclaration */ && !!node.importClause && !!node.importClause.name;
}
ts.isDefaultImport = isDefaultImport;
function hasQuestionToken(node) {
if (node) {
switch (node.kind) {
- case 151 /* Parameter */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 276 /* ShorthandPropertyAssignment */:
- case 275 /* PropertyAssignment */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 152 /* Parameter */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 277 /* ShorthandPropertyAssignment */:
+ case 276 /* PropertyAssignment */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
return node.questionToken !== undefined;
}
}
@@ -10348,7 +10528,7 @@
}
ts.isJSDocConstructSignature = isJSDocConstructSignature;
function isJSDocTypeAlias(node) {
- return node.kind === 309 /* JSDocTypedefTag */ || node.kind === 302 /* JSDocCallbackTag */;
+ return node.kind === 310 /* JSDocTypedefTag */ || node.kind === 303 /* JSDocCallbackTag */;
}
ts.isJSDocTypeAlias = isJSDocTypeAlias;
function isTypeAlias(node) {
@@ -10358,7 +10538,7 @@
function getSourceOfAssignment(node) {
return ts.isExpressionStatement(node) &&
node.expression && ts.isBinaryExpression(node.expression) &&
- node.expression.operatorToken.kind === 59 /* EqualsToken */
+ node.expression.operatorToken.kind === 60 /* EqualsToken */
? node.expression.right
: undefined;
}
@@ -10373,12 +10553,12 @@
}
function getSingleInitializerOfVariableStatementOrPropertyDeclaration(node) {
switch (node.kind) {
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
var v = getSingleVariableOfVariableStatement(node);
return v && v.initializer;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return node.initializer;
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return node.initializer;
}
}
@@ -10389,7 +10569,7 @@
function getNestedModuleDeclaration(node) {
return ts.isModuleDeclaration(node) &&
node.body &&
- node.body.kind === 244 /* ModuleDeclaration */
+ node.body.kind === 245 /* ModuleDeclaration */
? node.body
: undefined;
}
@@ -10404,11 +10584,11 @@
if (ts.hasJSDocNodes(node)) {
result = ts.addRange(result, node.jsDoc);
}
- if (node.kind === 151 /* Parameter */) {
+ if (node.kind === 152 /* Parameter */) {
result = ts.addRange(result, ts.getJSDocParameterTags(node));
break;
}
- if (node.kind === 150 /* TypeParameter */) {
+ if (node.kind === 151 /* TypeParameter */) {
result = ts.addRange(result, ts.getJSDocTypeParameterTags(node));
break;
}
@@ -10419,11 +10599,12 @@
ts.getJSDocCommentsAndTags = getJSDocCommentsAndTags;
function getNextJSDocCommentLocation(node) {
var parent = node.parent;
- if (parent.kind === 275 /* PropertyAssignment */ ||
- parent.kind === 154 /* PropertyDeclaration */ ||
- parent.kind === 221 /* ExpressionStatement */ && node.kind === 189 /* PropertyAccessExpression */ ||
+ if (parent.kind === 276 /* PropertyAssignment */ ||
+ parent.kind === 255 /* ExportAssignment */ ||
+ parent.kind === 155 /* PropertyDeclaration */ ||
+ parent.kind === 222 /* ExpressionStatement */ && node.kind === 190 /* PropertyAccessExpression */ ||
getNestedModuleDeclaration(parent) ||
- ts.isBinaryExpression(node) && node.operatorToken.kind === 59 /* EqualsToken */) {
+ ts.isBinaryExpression(node) && node.operatorToken.kind === 60 /* EqualsToken */) {
return parent;
}
// Try to recognize this pattern when node is initializer of variable declaration and JSDoc comments are on containing variable statement.
@@ -10434,7 +10615,7 @@
// var x = function(name) { return name.length; }
else if (parent.parent &&
(getSingleVariableOfVariableStatement(parent.parent) === node ||
- ts.isBinaryExpression(parent) && parent.operatorToken.kind === 59 /* EqualsToken */)) {
+ ts.isBinaryExpression(parent) && parent.operatorToken.kind === 60 /* EqualsToken */)) {
return parent.parent;
}
else if (parent.parent && parent.parent.parent &&
@@ -10457,7 +10638,7 @@
if (!decl) {
return undefined;
}
- var parameter = ts.find(decl.parameters, function (p) { return p.name.kind === 72 /* Identifier */ && p.name.escapedText === name; });
+ var parameter = ts.find(decl.parameters, function (p) { return p.name.kind === 73 /* Identifier */ && p.name.escapedText === name; });
return parameter && parameter.symbol;
}
ts.getParameterSymbolFromJSDoc = getParameterSymbolFromJSDoc;
@@ -10492,7 +10673,7 @@
ts.hasRestParameter = hasRestParameter;
function isRestParameter(node) {
var type = ts.isJSDocParameterTag(node) ? (node.typeExpression && node.typeExpression.type) : node.type;
- return node.dotDotDotToken !== undefined || !!type && type.kind === 295 /* JSDocVariadicType */;
+ return node.dotDotDotToken !== undefined || !!type && type.kind === 296 /* JSDocVariadicType */;
}
ts.isRestParameter = isRestParameter;
var AssignmentKind;
@@ -10505,31 +10686,31 @@
var parent = node.parent;
while (true) {
switch (parent.kind) {
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
var binaryOperator = parent.operatorToken.kind;
return isAssignmentOperator(binaryOperator) && parent.left === node ?
- binaryOperator === 59 /* EqualsToken */ ? 1 /* Definite */ : 2 /* Compound */ :
+ binaryOperator === 60 /* EqualsToken */ ? 1 /* Definite */ : 2 /* Compound */ :
0 /* None */;
- case 202 /* PrefixUnaryExpression */:
- case 203 /* PostfixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
var unaryOperator = parent.operator;
return unaryOperator === 44 /* PlusPlusToken */ || unaryOperator === 45 /* MinusMinusToken */ ? 2 /* Compound */ : 0 /* None */;
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
return parent.initializer === node ? 1 /* Definite */ : 0 /* None */;
- case 195 /* ParenthesizedExpression */:
- case 187 /* ArrayLiteralExpression */:
- case 208 /* SpreadElement */:
- case 213 /* NonNullExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 188 /* ArrayLiteralExpression */:
+ case 209 /* SpreadElement */:
+ case 214 /* NonNullExpression */:
node = parent;
break;
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
if (parent.name !== node) {
return 0 /* None */;
}
node = parent.parent;
break;
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
if (parent.name === node) {
return 0 /* None */;
}
@@ -10556,22 +10737,22 @@
*/
function isNodeWithPossibleHoistedDeclaration(node) {
switch (node.kind) {
- case 218 /* Block */:
- case 219 /* VariableStatement */:
- case 231 /* WithStatement */:
- case 222 /* IfStatement */:
- case 232 /* SwitchStatement */:
- case 246 /* CaseBlock */:
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
- case 233 /* LabeledStatement */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
- case 235 /* TryStatement */:
- case 274 /* CatchClause */:
+ case 219 /* Block */:
+ case 220 /* VariableStatement */:
+ case 232 /* WithStatement */:
+ case 223 /* IfStatement */:
+ case 233 /* SwitchStatement */:
+ case 247 /* CaseBlock */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
+ case 234 /* LabeledStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
+ case 236 /* TryStatement */:
+ case 275 /* CatchClause */:
return true;
}
return false;
@@ -10588,33 +10769,33 @@
return node;
}
function walkUpParenthesizedTypes(node) {
- return walkUp(node, 177 /* ParenthesizedType */);
+ return walkUp(node, 178 /* ParenthesizedType */);
}
ts.walkUpParenthesizedTypes = walkUpParenthesizedTypes;
function walkUpParenthesizedExpressions(node) {
- return walkUp(node, 195 /* ParenthesizedExpression */);
+ return walkUp(node, 196 /* ParenthesizedExpression */);
}
ts.walkUpParenthesizedExpressions = walkUpParenthesizedExpressions;
function skipParentheses(node) {
- while (node.kind === 195 /* ParenthesizedExpression */) {
+ while (node.kind === 196 /* ParenthesizedExpression */) {
node = node.expression;
}
return node;
}
ts.skipParentheses = skipParentheses;
function skipParenthesesUp(node) {
- while (node.kind === 195 /* ParenthesizedExpression */) {
+ while (node.kind === 196 /* ParenthesizedExpression */) {
node = node.parent;
}
return node;
}
// a node is delete target iff. it is PropertyAccessExpression/ElementAccessExpression with parentheses skipped
function isDeleteTarget(node) {
- if (node.kind !== 189 /* PropertyAccessExpression */ && node.kind !== 190 /* ElementAccessExpression */) {
+ if (node.kind !== 190 /* PropertyAccessExpression */ && node.kind !== 191 /* ElementAccessExpression */) {
return false;
}
node = walkUpParenthesizedExpressions(node.parent);
- return node && node.kind === 198 /* DeleteExpression */;
+ return node && node.kind === 199 /* DeleteExpression */;
}
ts.isDeleteTarget = isDeleteTarget;
function isNodeDescendantOf(node, ancestor) {
@@ -10640,7 +10821,7 @@
if (ts.isComputedPropertyName(parent))
return parent.parent;
// falls through
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
if (ts.isDeclaration(parent)) {
return parent.name === name ? parent : undefined;
}
@@ -10664,7 +10845,7 @@
ts.getDeclarationFromName = getDeclarationFromName;
function isLiteralComputedPropertyDeclarationName(node) {
return (node.kind === 10 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) &&
- node.parent.kind === 149 /* ComputedPropertyName */ &&
+ node.parent.kind === 150 /* ComputedPropertyName */ &&
ts.isDeclaration(node.parent.parent);
}
ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName;
@@ -10672,32 +10853,32 @@
function isIdentifierName(node) {
var parent = node.parent;
switch (parent.kind) {
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 278 /* EnumMember */:
- case 275 /* PropertyAssignment */:
- case 189 /* PropertyAccessExpression */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 279 /* EnumMember */:
+ case 276 /* PropertyAssignment */:
+ case 190 /* PropertyAccessExpression */:
// Name in member declaration or property name in property access
return parent.name === node;
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
// Name on right hand side of dot in a type query or type reference
if (parent.right === node) {
- while (parent.kind === 148 /* QualifiedName */) {
+ while (parent.kind === 149 /* QualifiedName */) {
parent = parent.parent;
}
- return parent.kind === 167 /* TypeQuery */ || parent.kind === 164 /* TypeReference */;
+ return parent.kind === 168 /* TypeQuery */ || parent.kind === 165 /* TypeReference */;
}
return false;
- case 186 /* BindingElement */:
- case 253 /* ImportSpecifier */:
+ case 187 /* BindingElement */:
+ case 254 /* ImportSpecifier */:
// Property name in binding element or import specifier
return parent.propertyName === node;
- case 257 /* ExportSpecifier */:
- case 267 /* JsxAttribute */:
+ case 258 /* ExportSpecifier */:
+ case 268 /* JsxAttribute */:
// Any name in an export specifier or JSX Attribute
return true;
}
@@ -10714,13 +10895,13 @@
// export default <EntityNameExpression>
// module.exports = <EntityNameExpression>
function isAliasSymbolDeclaration(node) {
- return node.kind === 248 /* ImportEqualsDeclaration */ ||
- node.kind === 247 /* NamespaceExportDeclaration */ ||
- node.kind === 250 /* ImportClause */ && !!node.name ||
- node.kind === 251 /* NamespaceImport */ ||
- node.kind === 253 /* ImportSpecifier */ ||
- node.kind === 257 /* ExportSpecifier */ ||
- node.kind === 254 /* ExportAssignment */ && exportAssignmentIsAlias(node) ||
+ return node.kind === 249 /* ImportEqualsDeclaration */ ||
+ node.kind === 248 /* NamespaceExportDeclaration */ ||
+ node.kind === 251 /* ImportClause */ && !!node.name ||
+ node.kind === 252 /* NamespaceImport */ ||
+ node.kind === 254 /* ImportSpecifier */ ||
+ node.kind === 258 /* ExportSpecifier */ ||
+ node.kind === 255 /* ExportAssignment */ && exportAssignmentIsAlias(node) ||
ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* ModuleExports */ && exportAssignmentIsAlias(node);
}
ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration;
@@ -10742,12 +10923,12 @@
}
ts.getEffectiveBaseTypeNode = getEffectiveBaseTypeNode;
function getClassExtendsHeritageElement(node) {
- var heritageClause = getHeritageClause(node.heritageClauses, 86 /* ExtendsKeyword */);
+ var heritageClause = getHeritageClause(node.heritageClauses, 87 /* ExtendsKeyword */);
return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined;
}
ts.getClassExtendsHeritageElement = getClassExtendsHeritageElement;
function getClassImplementsHeritageClauseElements(node) {
- var heritageClause = getHeritageClause(node.heritageClauses, 109 /* ImplementsKeyword */);
+ var heritageClause = getHeritageClause(node.heritageClauses, 110 /* ImplementsKeyword */);
return heritageClause ? heritageClause.types : undefined;
}
ts.getClassImplementsHeritageClauseElements = getClassImplementsHeritageClauseElements;
@@ -10759,7 +10940,7 @@
}
ts.getAllSuperTypeNodes = getAllSuperTypeNodes;
function getInterfaceBaseTypeNodes(node) {
- var heritageClause = getHeritageClause(node.heritageClauses, 86 /* ExtendsKeyword */);
+ var heritageClause = getHeritageClause(node.heritageClauses, 87 /* ExtendsKeyword */);
return heritageClause ? heritageClause.types : undefined;
}
ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes;
@@ -10793,11 +10974,11 @@
}
ts.getAncestor = getAncestor;
function isKeyword(token) {
- return 73 /* FirstKeyword */ <= token && token <= 147 /* LastKeyword */;
+ return 74 /* FirstKeyword */ <= token && token <= 148 /* LastKeyword */;
}
ts.isKeyword = isKeyword;
function isContextualKeyword(token) {
- return 118 /* FirstContextualKeyword */ <= token && token <= 147 /* LastContextualKeyword */;
+ return 119 /* FirstContextualKeyword */ <= token && token <= 148 /* LastContextualKeyword */;
}
ts.isContextualKeyword = isContextualKeyword;
function isNonContextualKeyword(token) {
@@ -10832,14 +11013,14 @@
}
var flags = 0 /* Normal */;
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 156 /* MethodDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 157 /* MethodDeclaration */:
if (node.asteriskToken) {
flags |= 1 /* Generator */;
}
// falls through
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
if (hasModifier(node, 256 /* Async */)) {
flags |= 2 /* Async */;
}
@@ -10853,10 +11034,10 @@
ts.getFunctionFlags = getFunctionFlags;
function isAsyncFunction(node) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 156 /* MethodDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
return node.body !== undefined
&& node.asteriskToken === undefined
&& hasModifier(node, 256 /* Async */);
@@ -10881,7 +11062,7 @@
}
ts.hasDynamicName = hasDynamicName;
function isDynamicName(name) {
- return name.kind === 149 /* ComputedPropertyName */ &&
+ return name.kind === 150 /* ComputedPropertyName */ &&
!isStringOrNumericLiteralLike(name.expression) &&
!isWellKnownSymbolSyntactically(name.expression);
}
@@ -10897,12 +11078,12 @@
ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically;
function getPropertyNameForPropertyNameNode(name) {
switch (name.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return name.escapedText;
case 10 /* StringLiteral */:
case 8 /* NumericLiteral */:
return ts.escapeLeadingUnderscores(name.text);
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
var nameExpression = name.expression;
if (isWellKnownSymbolSyntactically(nameExpression)) {
return getPropertyNameForKnownSymbolName(ts.idText(nameExpression.name));
@@ -10918,7 +11099,7 @@
ts.getPropertyNameForPropertyNameNode = getPropertyNameForPropertyNameNode;
function isPropertyNameLiteral(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
case 10 /* StringLiteral */:
case 14 /* NoSubstitutionTemplateLiteral */:
case 8 /* NumericLiteral */:
@@ -10929,11 +11110,11 @@
}
ts.isPropertyNameLiteral = isPropertyNameLiteral;
function getTextOfIdentifierOrLiteral(node) {
- return node.kind === 72 /* Identifier */ ? ts.idText(node) : node.text;
+ return node.kind === 73 /* Identifier */ ? ts.idText(node) : node.text;
}
ts.getTextOfIdentifierOrLiteral = getTextOfIdentifierOrLiteral;
function getEscapedTextOfIdentifierOrLiteral(node) {
- return node.kind === 72 /* Identifier */ ? node.escapedText : ts.escapeLeadingUnderscores(node.text);
+ return node.kind === 73 /* Identifier */ ? node.escapedText : ts.escapeLeadingUnderscores(node.text);
}
ts.getEscapedTextOfIdentifierOrLiteral = getEscapedTextOfIdentifierOrLiteral;
function getPropertyNameForKnownSymbolName(symbolName) {
@@ -10948,7 +11129,7 @@
* Includes the word "Symbol" with unicode escapes
*/
function isESSymbolIdentifier(node) {
- return node.kind === 72 /* Identifier */ && node.escapedText === "Symbol";
+ return node.kind === 73 /* Identifier */ && node.escapedText === "Symbol";
}
ts.isESSymbolIdentifier = isESSymbolIdentifier;
function isPushOrUnshiftIdentifier(node) {
@@ -10957,11 +11138,11 @@
ts.isPushOrUnshiftIdentifier = isPushOrUnshiftIdentifier;
function isParameterDeclaration(node) {
var root = getRootDeclaration(node);
- return root.kind === 151 /* Parameter */;
+ return root.kind === 152 /* Parameter */;
}
ts.isParameterDeclaration = isParameterDeclaration;
function getRootDeclaration(node) {
- while (node.kind === 186 /* BindingElement */) {
+ while (node.kind === 187 /* BindingElement */) {
node = node.parent.parent;
}
return node;
@@ -10969,15 +11150,15 @@
ts.getRootDeclaration = getRootDeclaration;
function nodeStartsNewLexicalEnvironment(node) {
var kind = node.kind;
- return kind === 157 /* Constructor */
- || kind === 196 /* FunctionExpression */
- || kind === 239 /* FunctionDeclaration */
- || kind === 197 /* ArrowFunction */
- || kind === 156 /* MethodDeclaration */
- || kind === 158 /* GetAccessor */
- || kind === 159 /* SetAccessor */
- || kind === 244 /* ModuleDeclaration */
- || kind === 284 /* SourceFile */;
+ return kind === 158 /* Constructor */
+ || kind === 197 /* FunctionExpression */
+ || kind === 240 /* FunctionDeclaration */
+ || kind === 198 /* ArrowFunction */
+ || kind === 157 /* MethodDeclaration */
+ || kind === 159 /* GetAccessor */
+ || kind === 160 /* SetAccessor */
+ || kind === 245 /* ModuleDeclaration */
+ || kind === 285 /* SourceFile */;
}
ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment;
function nodeIsSynthesized(range) {
@@ -10996,38 +11177,38 @@
})(Associativity = ts.Associativity || (ts.Associativity = {}));
function getExpressionAssociativity(expression) {
var operator = getOperator(expression);
- var hasArguments = expression.kind === 192 /* NewExpression */ && expression.arguments !== undefined;
+ var hasArguments = expression.kind === 193 /* NewExpression */ && expression.arguments !== undefined;
return getOperatorAssociativity(expression.kind, operator, hasArguments);
}
ts.getExpressionAssociativity = getExpressionAssociativity;
function getOperatorAssociativity(kind, operator, hasArguments) {
switch (kind) {
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return hasArguments ? 0 /* Left */ : 1 /* Right */;
- case 202 /* PrefixUnaryExpression */:
- case 199 /* TypeOfExpression */:
- case 200 /* VoidExpression */:
- case 198 /* DeleteExpression */:
- case 201 /* AwaitExpression */:
- case 205 /* ConditionalExpression */:
- case 207 /* YieldExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 200 /* TypeOfExpression */:
+ case 201 /* VoidExpression */:
+ case 199 /* DeleteExpression */:
+ case 202 /* AwaitExpression */:
+ case 206 /* ConditionalExpression */:
+ case 208 /* YieldExpression */:
return 1 /* Right */;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
switch (operator) {
case 41 /* AsteriskAsteriskToken */:
- case 59 /* EqualsToken */:
- case 60 /* PlusEqualsToken */:
- case 61 /* MinusEqualsToken */:
- case 63 /* AsteriskAsteriskEqualsToken */:
- case 62 /* AsteriskEqualsToken */:
- case 64 /* SlashEqualsToken */:
- case 65 /* PercentEqualsToken */:
- case 66 /* LessThanLessThanEqualsToken */:
- case 67 /* GreaterThanGreaterThanEqualsToken */:
- case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
- case 69 /* AmpersandEqualsToken */:
- case 71 /* CaretEqualsToken */:
- case 70 /* BarEqualsToken */:
+ case 60 /* EqualsToken */:
+ case 61 /* PlusEqualsToken */:
+ case 62 /* MinusEqualsToken */:
+ case 64 /* AsteriskAsteriskEqualsToken */:
+ case 63 /* AsteriskEqualsToken */:
+ case 65 /* SlashEqualsToken */:
+ case 66 /* PercentEqualsToken */:
+ case 67 /* LessThanLessThanEqualsToken */:
+ case 68 /* GreaterThanGreaterThanEqualsToken */:
+ case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
+ case 70 /* AmpersandEqualsToken */:
+ case 72 /* CaretEqualsToken */:
+ case 71 /* BarEqualsToken */:
return 1 /* Right */;
}
}
@@ -11036,15 +11217,15 @@
ts.getOperatorAssociativity = getOperatorAssociativity;
function getExpressionPrecedence(expression) {
var operator = getOperator(expression);
- var hasArguments = expression.kind === 192 /* NewExpression */ && expression.arguments !== undefined;
+ var hasArguments = expression.kind === 193 /* NewExpression */ && expression.arguments !== undefined;
return getOperatorPrecedence(expression.kind, operator, hasArguments);
}
ts.getExpressionPrecedence = getExpressionPrecedence;
function getOperator(expression) {
- if (expression.kind === 204 /* BinaryExpression */) {
+ if (expression.kind === 205 /* BinaryExpression */) {
return expression.operatorToken.kind;
}
- else if (expression.kind === 202 /* PrefixUnaryExpression */ || expression.kind === 203 /* PostfixUnaryExpression */) {
+ else if (expression.kind === 203 /* PrefixUnaryExpression */ || expression.kind === 204 /* PostfixUnaryExpression */) {
return expression.operator;
}
else {
@@ -11054,73 +11235,73 @@
ts.getOperator = getOperator;
function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
switch (nodeKind) {
- case 314 /* CommaListExpression */:
+ case 315 /* CommaListExpression */:
return 0;
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
return 1;
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return 2;
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return 4;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
switch (operatorKind) {
case 27 /* CommaToken */:
return 0;
- case 59 /* EqualsToken */:
- case 60 /* PlusEqualsToken */:
- case 61 /* MinusEqualsToken */:
- case 63 /* AsteriskAsteriskEqualsToken */:
- case 62 /* AsteriskEqualsToken */:
- case 64 /* SlashEqualsToken */:
- case 65 /* PercentEqualsToken */:
- case 66 /* LessThanLessThanEqualsToken */:
- case 67 /* GreaterThanGreaterThanEqualsToken */:
- case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
- case 69 /* AmpersandEqualsToken */:
- case 71 /* CaretEqualsToken */:
- case 70 /* BarEqualsToken */:
+ case 60 /* EqualsToken */:
+ case 61 /* PlusEqualsToken */:
+ case 62 /* MinusEqualsToken */:
+ case 64 /* AsteriskAsteriskEqualsToken */:
+ case 63 /* AsteriskEqualsToken */:
+ case 65 /* SlashEqualsToken */:
+ case 66 /* PercentEqualsToken */:
+ case 67 /* LessThanLessThanEqualsToken */:
+ case 68 /* GreaterThanGreaterThanEqualsToken */:
+ case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
+ case 70 /* AmpersandEqualsToken */:
+ case 72 /* CaretEqualsToken */:
+ case 71 /* BarEqualsToken */:
return 3;
default:
return getBinaryOperatorPrecedence(operatorKind);
}
- case 202 /* PrefixUnaryExpression */:
- case 199 /* TypeOfExpression */:
- case 200 /* VoidExpression */:
- case 198 /* DeleteExpression */:
- case 201 /* AwaitExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 200 /* TypeOfExpression */:
+ case 201 /* VoidExpression */:
+ case 199 /* DeleteExpression */:
+ case 202 /* AwaitExpression */:
return 16;
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return 17;
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return 18;
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return hasArguments ? 19 : 18;
- case 193 /* TaggedTemplateExpression */:
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 194 /* TaggedTemplateExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return 19;
- case 100 /* ThisKeyword */:
- case 98 /* SuperKeyword */:
- case 72 /* Identifier */:
- case 96 /* NullKeyword */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
+ case 101 /* ThisKeyword */:
+ case 99 /* SuperKeyword */:
+ case 73 /* Identifier */:
+ case 97 /* NullKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
case 10 /* StringLiteral */:
- case 187 /* ArrayLiteralExpression */:
- case 188 /* ObjectLiteralExpression */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 209 /* ClassExpression */:
- case 260 /* JsxElement */:
- case 261 /* JsxSelfClosingElement */:
- case 264 /* JsxFragment */:
+ case 188 /* ArrayLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 210 /* ClassExpression */:
+ case 261 /* JsxElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 265 /* JsxFragment */:
case 13 /* RegularExpressionLiteral */:
case 14 /* NoSubstitutionTemplateLiteral */:
- case 206 /* TemplateExpression */:
- case 195 /* ParenthesizedExpression */:
- case 210 /* OmittedExpression */:
+ case 207 /* TemplateExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 211 /* OmittedExpression */:
return 20;
default:
return -1;
@@ -11148,9 +11329,9 @@
case 30 /* GreaterThanToken */:
case 31 /* LessThanEqualsToken */:
case 32 /* GreaterThanEqualsToken */:
- case 94 /* InstanceOfKeyword */:
- case 93 /* InKeyword */:
- case 119 /* AsKeyword */:
+ case 95 /* InstanceOfKeyword */:
+ case 94 /* InKeyword */:
+ case 120 /* AsKeyword */:
return 11;
case 46 /* LessThanLessThanToken */:
case 47 /* GreaterThanGreaterThanToken */:
@@ -11612,11 +11793,11 @@
}
ts.parameterIsThisKeyword = parameterIsThisKeyword;
function isThisIdentifier(node) {
- return !!node && node.kind === 72 /* Identifier */ && identifierIsThisKeyword(node);
+ return !!node && node.kind === 73 /* Identifier */ && identifierIsThisKeyword(node);
}
ts.isThisIdentifier = isThisIdentifier;
function identifierIsThisKeyword(id) {
- return id.originalKeywordKind === 100 /* ThisKeyword */;
+ return id.originalKeywordKind === 101 /* ThisKeyword */;
}
ts.identifierIsThisKeyword = identifierIsThisKeyword;
function getAllAccessorDeclarations(declarations, accessor) {
@@ -11627,10 +11808,10 @@
var setAccessor;
if (hasDynamicName(accessor)) {
firstAccessor = accessor;
- if (accessor.kind === 158 /* GetAccessor */) {
+ if (accessor.kind === 159 /* GetAccessor */) {
getAccessor = accessor;
}
- else if (accessor.kind === 159 /* SetAccessor */) {
+ else if (accessor.kind === 160 /* SetAccessor */) {
setAccessor = accessor;
}
else {
@@ -11650,10 +11831,10 @@
else if (!secondAccessor) {
secondAccessor = member;
}
- if (member.kind === 158 /* GetAccessor */ && !getAccessor) {
+ if (member.kind === 159 /* GetAccessor */ && !getAccessor) {
getAccessor = member;
}
- if (member.kind === 159 /* SetAccessor */ && !setAccessor) {
+ if (member.kind === 160 /* SetAccessor */ && !setAccessor) {
setAccessor = member;
}
}
@@ -11699,7 +11880,7 @@
ts.getJSDocTypeParameterDeclarations = getJSDocTypeParameterDeclarations;
/** template tags are only available when a typedef isn't already using them */
function isNonTypeAliasTemplate(tag) {
- return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 296 /* JSDocComment */ && tag.parent.tags.some(isJSDocTypeAlias));
+ return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 297 /* JSDocComment */ && tag.parent.tags.some(isJSDocTypeAlias));
}
/**
* Gets the effective type annotation of the value parameter of a set accessor. If the node
@@ -11939,7 +12120,7 @@
flags |= modifierToFlag(modifier.kind);
}
}
- if (node.flags & 4 /* NestedNamespace */ || (node.kind === 72 /* Identifier */ && node.isInJSDocNamespace)) {
+ if (node.flags & 4 /* NestedNamespace */ || (node.kind === 73 /* Identifier */ && node.isInJSDocNamespace)) {
flags |= 1 /* Export */;
}
return flags;
@@ -11947,17 +12128,17 @@
ts.getModifierFlagsNoCache = getModifierFlagsNoCache;
function modifierToFlag(token) {
switch (token) {
- case 116 /* StaticKeyword */: return 32 /* Static */;
- case 115 /* PublicKeyword */: return 4 /* Public */;
- case 114 /* ProtectedKeyword */: return 16 /* Protected */;
- case 113 /* PrivateKeyword */: return 8 /* Private */;
- case 118 /* AbstractKeyword */: return 128 /* Abstract */;
- case 85 /* ExportKeyword */: return 1 /* Export */;
- case 125 /* DeclareKeyword */: return 2 /* Ambient */;
- case 77 /* ConstKeyword */: return 2048 /* Const */;
- case 80 /* DefaultKeyword */: return 512 /* Default */;
- case 121 /* AsyncKeyword */: return 256 /* Async */;
- case 133 /* ReadonlyKeyword */: return 64 /* Readonly */;
+ case 117 /* StaticKeyword */: return 32 /* Static */;
+ case 116 /* PublicKeyword */: return 4 /* Public */;
+ case 115 /* ProtectedKeyword */: return 16 /* Protected */;
+ case 114 /* PrivateKeyword */: return 8 /* Private */;
+ case 119 /* AbstractKeyword */: return 128 /* Abstract */;
+ case 86 /* ExportKeyword */: return 1 /* Export */;
+ case 126 /* DeclareKeyword */: return 2 /* Ambient */;
+ case 78 /* ConstKeyword */: return 2048 /* Const */;
+ case 81 /* DefaultKeyword */: return 512 /* Default */;
+ case 122 /* AsyncKeyword */: return 256 /* Async */;
+ case 134 /* ReadonlyKeyword */: return 64 /* Readonly */;
}
return 0 /* None */;
}
@@ -11969,7 +12150,7 @@
}
ts.isLogicalOperator = isLogicalOperator;
function isAssignmentOperator(token) {
- return token >= 59 /* FirstAssignment */ && token <= 71 /* LastAssignment */;
+ return token >= 60 /* FirstAssignment */ && token <= 72 /* LastAssignment */;
}
ts.isAssignmentOperator = isAssignmentOperator;
/** Get `C` given `N` if `N` is in the position `class C extends N` where `N` is an ExpressionWithTypeArguments. */
@@ -11982,14 +12163,14 @@
return ts.isExpressionWithTypeArguments(node)
&& ts.isHeritageClause(node.parent)
&& ts.isClassLike(node.parent.parent)
- ? { class: node.parent.parent, isImplements: node.parent.token === 109 /* ImplementsKeyword */ }
+ ? { class: node.parent.parent, isImplements: node.parent.token === 110 /* ImplementsKeyword */ }
: undefined;
}
ts.tryGetClassImplementingOrExtendingExpressionWithTypeArguments = tryGetClassImplementingOrExtendingExpressionWithTypeArguments;
function isAssignmentExpression(node, excludeCompoundAssignment) {
return ts.isBinaryExpression(node)
&& (excludeCompoundAssignment
- ? node.operatorToken.kind === 59 /* EqualsToken */
+ ? node.operatorToken.kind === 60 /* EqualsToken */
: isAssignmentOperator(node.operatorToken.kind))
&& ts.isLeftHandSideExpression(node.left);
}
@@ -11997,8 +12178,8 @@
function isDestructuringAssignment(node) {
if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) {
var kind = node.left.kind;
- return kind === 188 /* ObjectLiteralExpression */
- || kind === 187 /* ArrayLiteralExpression */;
+ return kind === 189 /* ObjectLiteralExpression */
+ || kind === 188 /* ArrayLiteralExpression */;
}
return false;
}
@@ -12008,29 +12189,39 @@
}
ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause;
function isEntityNameExpression(node) {
- return node.kind === 72 /* Identifier */ || isPropertyAccessEntityNameExpression(node);
+ return node.kind === 73 /* Identifier */ || isPropertyAccessEntityNameExpression(node);
}
ts.isEntityNameExpression = isEntityNameExpression;
function isPropertyAccessEntityNameExpression(node) {
return ts.isPropertyAccessExpression(node) && isEntityNameExpression(node.expression);
}
ts.isPropertyAccessEntityNameExpression = isPropertyAccessEntityNameExpression;
+ function tryGetPropertyAccessOrIdentifierToString(expr) {
+ if (ts.isPropertyAccessExpression(expr)) {
+ return tryGetPropertyAccessOrIdentifierToString(expr.expression) + "." + expr.name;
+ }
+ if (ts.isIdentifier(expr)) {
+ return ts.unescapeLeadingUnderscores(expr.escapedText);
+ }
+ return undefined;
+ }
+ ts.tryGetPropertyAccessOrIdentifierToString = tryGetPropertyAccessOrIdentifierToString;
function isPrototypeAccess(node) {
return ts.isPropertyAccessExpression(node) && node.name.escapedText === "prototype";
}
ts.isPrototypeAccess = isPrototypeAccess;
function isRightSideOfQualifiedNameOrPropertyAccess(node) {
- return (node.parent.kind === 148 /* QualifiedName */ && node.parent.right === node) ||
- (node.parent.kind === 189 /* PropertyAccessExpression */ && node.parent.name === node);
+ return (node.parent.kind === 149 /* QualifiedName */ && node.parent.right === node) ||
+ (node.parent.kind === 190 /* PropertyAccessExpression */ && node.parent.name === node);
}
ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess;
function isEmptyObjectLiteral(expression) {
- return expression.kind === 188 /* ObjectLiteralExpression */ &&
+ return expression.kind === 189 /* ObjectLiteralExpression */ &&
expression.properties.length === 0;
}
ts.isEmptyObjectLiteral = isEmptyObjectLiteral;
function isEmptyArrayLiteral(expression) {
- return expression.kind === 187 /* ArrayLiteralExpression */ &&
+ return expression.kind === 188 /* ArrayLiteralExpression */ &&
expression.elements.length === 0;
}
ts.isEmptyArrayLiteral = isEmptyArrayLiteral;
@@ -12219,77 +12410,6 @@
}
ts.getNewLineCharacter = getNewLineCharacter;
/**
- * Formats an enum value as a string for debugging and debug assertions.
- */
- function formatEnum(value, enumObject, isFlags) {
- if (value === void 0) { value = 0; }
- var members = getEnumMembers(enumObject);
- if (value === 0) {
- return members.length > 0 && members[0][0] === 0 ? members[0][1] : "0";
- }
- if (isFlags) {
- var result = "";
- var remainingFlags = value;
- for (var i = members.length - 1; i >= 0 && remainingFlags !== 0; i--) {
- var _a = members[i], enumValue = _a[0], enumName = _a[1];
- if (enumValue !== 0 && (remainingFlags & enumValue) === enumValue) {
- remainingFlags &= ~enumValue;
- result = "" + enumName + (result ? ", " : "") + result;
- }
- }
- if (remainingFlags === 0) {
- return result;
- }
- }
- else {
- for (var _i = 0, members_1 = members; _i < members_1.length; _i++) {
- var _b = members_1[_i], enumValue = _b[0], enumName = _b[1];
- if (enumValue === value) {
- return enumName;
- }
- }
- }
- return value.toString();
- }
- function getEnumMembers(enumObject) {
- var result = [];
- for (var name in enumObject) {
- var value = enumObject[name];
- if (typeof value === "number") {
- result.push([value, name]);
- }
- }
- return ts.stableSort(result, function (x, y) { return ts.compareValues(x[0], y[0]); });
- }
- function formatSyntaxKind(kind) {
- return formatEnum(kind, ts.SyntaxKind, /*isFlags*/ false);
- }
- ts.formatSyntaxKind = formatSyntaxKind;
- function formatModifierFlags(flags) {
- return formatEnum(flags, ts.ModifierFlags, /*isFlags*/ true);
- }
- ts.formatModifierFlags = formatModifierFlags;
- function formatTransformFlags(flags) {
- return formatEnum(flags, ts.TransformFlags, /*isFlags*/ true);
- }
- ts.formatTransformFlags = formatTransformFlags;
- function formatEmitFlags(flags) {
- return formatEnum(flags, ts.EmitFlags, /*isFlags*/ true);
- }
- ts.formatEmitFlags = formatEmitFlags;
- function formatSymbolFlags(flags) {
- return formatEnum(flags, ts.SymbolFlags, /*isFlags*/ true);
- }
- ts.formatSymbolFlags = formatSymbolFlags;
- function formatTypeFlags(flags) {
- return formatEnum(flags, ts.TypeFlags, /*isFlags*/ true);
- }
- ts.formatTypeFlags = formatTypeFlags;
- function formatObjectFlags(flags) {
- return formatEnum(flags, ts.ObjectFlags, /*isFlags*/ true);
- }
- ts.formatObjectFlags = formatObjectFlags;
- /**
* Creates a new TextRange from the provided pos and end.
*
* @param pos The start position.
@@ -12378,6 +12498,10 @@
return positionsAreOnSameLine(range1.end, getStartPositionOfRange(range2, sourceFile), sourceFile);
}
ts.rangeEndIsOnSameLineAsRangeStart = rangeEndIsOnSameLineAsRangeStart;
+ function isNodeArrayMultiLine(list, sourceFile) {
+ return !positionsAreOnSameLine(list.pos, list.end, sourceFile);
+ }
+ ts.isNodeArrayMultiLine = isNodeArrayMultiLine;
function positionsAreOnSameLine(pos1, pos2, sourceFile) {
return pos1 === pos2 ||
getLineOfLocalPosition(sourceFile, pos1) === getLineOfLocalPosition(sourceFile, pos2);
@@ -12395,8 +12519,8 @@
var parseNode = ts.getParseTreeNode(node);
if (parseNode) {
switch (parseNode.parent.kind) {
- case 243 /* EnumDeclaration */:
- case 244 /* ModuleDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 245 /* ModuleDeclaration */:
return parseNode === parseNode.parent.name;
}
}
@@ -12430,10 +12554,10 @@
}
if (getCheckFlags(s) & 6 /* Synthetic */) {
var checkFlags = s.checkFlags;
- var accessModifier = checkFlags & 512 /* ContainsPrivate */ ? 8 /* Private */ :
- checkFlags & 128 /* ContainsPublic */ ? 4 /* Public */ :
+ var accessModifier = checkFlags & 1024 /* ContainsPrivate */ ? 8 /* Private */ :
+ checkFlags & 256 /* ContainsPublic */ ? 4 /* Public */ :
16 /* Protected */;
- var staticModifier = checkFlags & 1024 /* ContainsStatic */ ? 32 /* Static */ : 0;
+ var staticModifier = checkFlags & 2048 /* ContainsStatic */ ? 32 /* Static */ : 0;
return accessModifier | staticModifier;
}
if (s.flags & 4194304 /* Prototype */) {
@@ -12473,35 +12597,35 @@
if (!parent)
return 0 /* Read */;
switch (parent.kind) {
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return accessKind(parent);
- case 203 /* PostfixUnaryExpression */:
- case 202 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
var operator = parent.operator;
return operator === 44 /* PlusPlusToken */ || operator === 45 /* MinusMinusToken */ ? writeOrReadWrite() : 0 /* Read */;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
var _a = parent, left = _a.left, operatorToken = _a.operatorToken;
return left === node && isAssignmentOperator(operatorToken.kind) ?
- operatorToken.kind === 59 /* EqualsToken */ ? 1 /* Write */ : writeOrReadWrite()
+ operatorToken.kind === 60 /* EqualsToken */ ? 1 /* Write */ : writeOrReadWrite()
: 0 /* Read */;
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return parent.name !== node ? 0 /* Read */ : accessKind(parent);
- case 275 /* PropertyAssignment */: {
+ case 276 /* PropertyAssignment */: {
var parentAccess = accessKind(parent.parent);
// In `({ x: varname }) = { x: 1 }`, the left `x` is a read, the right `x` is a write.
return node === parent.name ? reverseAccessKind(parentAccess) : parentAccess;
}
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
// Assume it's the local variable being accessed, since we don't check public properties for --noUnusedLocals.
return node === parent.objectAssignmentInitializer ? 0 /* Read */ : accessKind(parent.parent);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return accessKind(parent);
default:
return 0 /* Read */;
}
function writeOrReadWrite() {
// If grandparent is not an ExpressionStatement, this is used as an expression in addition to having a side effect.
- return parent.parent && skipParenthesesUp(parent.parent).kind === 221 /* ExpressionStatement */ ? 1 /* Write */ : 2 /* ReadWrite */;
+ return parent.parent && skipParenthesesUp(parent.parent).kind === 222 /* ExpressionStatement */ ? 1 /* Write */ : 2 /* ReadWrite */;
}
}
function reverseAccessKind(a) {
@@ -12656,32 +12780,32 @@
}
ts.isObjectTypeDeclaration = isObjectTypeDeclaration;
function isTypeNodeKind(kind) {
- return (kind >= 163 /* FirstTypeNode */ && kind <= 183 /* LastTypeNode */)
- || kind === 120 /* AnyKeyword */
- || kind === 143 /* UnknownKeyword */
- || kind === 135 /* NumberKeyword */
- || kind === 146 /* BigIntKeyword */
- || kind === 136 /* ObjectKeyword */
- || kind === 123 /* BooleanKeyword */
- || kind === 138 /* StringKeyword */
- || kind === 139 /* SymbolKeyword */
- || kind === 100 /* ThisKeyword */
- || kind === 106 /* VoidKeyword */
- || kind === 141 /* UndefinedKeyword */
- || kind === 96 /* NullKeyword */
- || kind === 132 /* NeverKeyword */
- || kind === 211 /* ExpressionWithTypeArguments */
- || kind === 289 /* JSDocAllType */
- || kind === 290 /* JSDocUnknownType */
- || kind === 291 /* JSDocNullableType */
- || kind === 292 /* JSDocNonNullableType */
- || kind === 293 /* JSDocOptionalType */
- || kind === 294 /* JSDocFunctionType */
- || kind === 295 /* JSDocVariadicType */;
+ return (kind >= 164 /* FirstTypeNode */ && kind <= 184 /* LastTypeNode */)
+ || kind === 121 /* AnyKeyword */
+ || kind === 144 /* UnknownKeyword */
+ || kind === 136 /* NumberKeyword */
+ || kind === 147 /* BigIntKeyword */
+ || kind === 137 /* ObjectKeyword */
+ || kind === 124 /* BooleanKeyword */
+ || kind === 139 /* StringKeyword */
+ || kind === 140 /* SymbolKeyword */
+ || kind === 101 /* ThisKeyword */
+ || kind === 107 /* VoidKeyword */
+ || kind === 142 /* UndefinedKeyword */
+ || kind === 97 /* NullKeyword */
+ || kind === 133 /* NeverKeyword */
+ || kind === 212 /* ExpressionWithTypeArguments */
+ || kind === 290 /* JSDocAllType */
+ || kind === 291 /* JSDocUnknownType */
+ || kind === 292 /* JSDocNullableType */
+ || kind === 293 /* JSDocNonNullableType */
+ || kind === 294 /* JSDocOptionalType */
+ || kind === 295 /* JSDocFunctionType */
+ || kind === 296 /* JSDocVariadicType */;
}
ts.isTypeNodeKind = isTypeNodeKind;
function isAccessExpression(node) {
- return node.kind === 189 /* PropertyAccessExpression */ || node.kind === 190 /* ElementAccessExpression */;
+ return node.kind === 190 /* PropertyAccessExpression */ || node.kind === 191 /* ElementAccessExpression */;
}
ts.isAccessExpression = isAccessExpression;
function isBundleFileTextLike(section) {
@@ -12698,8 +12822,10 @@
(function (ts) {
function getDefaultLibFileName(options) {
switch (options.target) {
- case 7 /* ESNext */:
+ case 8 /* ESNext */:
return "lib.esnext.full.d.ts";
+ case 7 /* ES2020 */:
+ return "lib.es2020.full.d.ts";
case 6 /* ES2019 */:
return "lib.es2019.full.d.ts";
case 5 /* ES2018 */:
@@ -12916,9 +13042,9 @@
}
ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions;
function getTypeParameterOwner(d) {
- if (d && d.kind === 150 /* TypeParameter */) {
+ if (d && d.kind === 151 /* TypeParameter */) {
for (var current = d; current; current = current.parent) {
- if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 241 /* InterfaceDeclaration */) {
+ if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 242 /* InterfaceDeclaration */) {
return current;
}
}
@@ -12926,7 +13052,7 @@
}
ts.getTypeParameterOwner = getTypeParameterOwner;
function isParameterPropertyDeclaration(node) {
- return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) && node.parent.kind === 157 /* Constructor */;
+ return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) && node.parent.kind === 158 /* Constructor */;
}
ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration;
function isEmptyBindingPattern(node) {
@@ -12956,14 +13082,14 @@
node = walkUpBindingElementsAndPatterns(node);
}
var flags = getFlags(node);
- if (node.kind === 237 /* VariableDeclaration */) {
+ if (node.kind === 238 /* VariableDeclaration */) {
node = node.parent;
}
- if (node && node.kind === 238 /* VariableDeclarationList */) {
+ if (node && node.kind === 239 /* VariableDeclarationList */) {
flags |= getFlags(node);
node = node.parent;
}
- if (node && node.kind === 219 /* VariableStatement */) {
+ if (node && node.kind === 220 /* VariableStatement */) {
flags |= getFlags(node);
}
return flags;
@@ -13109,27 +13235,27 @@
}
// Covers remaining cases (returning undefined if none match).
switch (hostNode.kind) {
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
if (hostNode.declarationList && hostNode.declarationList.declarations[0]) {
return getDeclarationIdentifier(hostNode.declarationList.declarations[0]);
}
break;
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
var expr = hostNode.expression;
switch (expr.kind) {
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return expr.name;
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
var arg = expr.argumentExpression;
if (ts.isIdentifier(arg)) {
return arg;
}
}
break;
- case 195 /* ParenthesizedExpression */: {
+ case 196 /* ParenthesizedExpression */: {
return getDeclarationIdentifier(hostNode.expression);
}
- case 233 /* LabeledStatement */: {
+ case 234 /* LabeledStatement */: {
if (ts.isDeclaration(hostNode.statement) || ts.isExpression(hostNode.statement)) {
return getDeclarationIdentifier(hostNode.statement);
}
@@ -13153,18 +13279,18 @@
/** @internal */
function getNonAssignedNameOfDeclaration(declaration) {
switch (declaration.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return declaration;
- case 310 /* JSDocPropertyTag */:
- case 304 /* JSDocParameterTag */: {
+ case 311 /* JSDocPropertyTag */:
+ case 305 /* JSDocParameterTag */: {
var name = declaration.name;
- if (name.kind === 148 /* QualifiedName */) {
+ if (name.kind === 149 /* QualifiedName */) {
return name.right;
}
break;
}
- case 191 /* CallExpression */:
- case 204 /* BinaryExpression */: {
+ case 192 /* CallExpression */:
+ case 205 /* BinaryExpression */: {
var expr = declaration;
switch (ts.getAssignmentDeclarationKind(expr)) {
case 1 /* ExportsProperty */:
@@ -13180,9 +13306,9 @@
return undefined;
}
}
- case 309 /* JSDocTypedefTag */:
+ case 310 /* JSDocTypedefTag */:
return getNameOfJSDocTypedef(declaration);
- case 254 /* ExportAssignment */: {
+ case 255 /* ExportAssignment */: {
var expression = declaration.expression;
return ts.isIdentifier(expression) ? expression : undefined;
}
@@ -13384,7 +13510,7 @@
return ts.emptyArray;
}
if (ts.isJSDocTypeAlias(node)) {
- ts.Debug.assert(node.parent.kind === 296 /* JSDocComment */);
+ ts.Debug.assert(node.parent.kind === 297 /* JSDocComment */);
return ts.flatMap(node.parent.tags, function (tag) { return ts.isJSDocTemplateTag(tag) ? tag.typeParameters : undefined; });
}
if (node.typeParameters) {
@@ -13452,198 +13578,198 @@
}
ts.isTemplateTail = isTemplateTail;
function isIdentifier(node) {
- return node.kind === 72 /* Identifier */;
+ return node.kind === 73 /* Identifier */;
}
ts.isIdentifier = isIdentifier;
// Names
function isQualifiedName(node) {
- return node.kind === 148 /* QualifiedName */;
+ return node.kind === 149 /* QualifiedName */;
}
ts.isQualifiedName = isQualifiedName;
function isComputedPropertyName(node) {
- return node.kind === 149 /* ComputedPropertyName */;
+ return node.kind === 150 /* ComputedPropertyName */;
}
ts.isComputedPropertyName = isComputedPropertyName;
// Signature elements
function isTypeParameterDeclaration(node) {
- return node.kind === 150 /* TypeParameter */;
+ return node.kind === 151 /* TypeParameter */;
}
ts.isTypeParameterDeclaration = isTypeParameterDeclaration;
function isParameter(node) {
- return node.kind === 151 /* Parameter */;
+ return node.kind === 152 /* Parameter */;
}
ts.isParameter = isParameter;
function isDecorator(node) {
- return node.kind === 152 /* Decorator */;
+ return node.kind === 153 /* Decorator */;
}
ts.isDecorator = isDecorator;
// TypeMember
function isPropertySignature(node) {
- return node.kind === 153 /* PropertySignature */;
+ return node.kind === 154 /* PropertySignature */;
}
ts.isPropertySignature = isPropertySignature;
function isPropertyDeclaration(node) {
- return node.kind === 154 /* PropertyDeclaration */;
+ return node.kind === 155 /* PropertyDeclaration */;
}
ts.isPropertyDeclaration = isPropertyDeclaration;
function isMethodSignature(node) {
- return node.kind === 155 /* MethodSignature */;
+ return node.kind === 156 /* MethodSignature */;
}
ts.isMethodSignature = isMethodSignature;
function isMethodDeclaration(node) {
- return node.kind === 156 /* MethodDeclaration */;
+ return node.kind === 157 /* MethodDeclaration */;
}
ts.isMethodDeclaration = isMethodDeclaration;
function isConstructorDeclaration(node) {
- return node.kind === 157 /* Constructor */;
+ return node.kind === 158 /* Constructor */;
}
ts.isConstructorDeclaration = isConstructorDeclaration;
function isGetAccessorDeclaration(node) {
- return node.kind === 158 /* GetAccessor */;
+ return node.kind === 159 /* GetAccessor */;
}
ts.isGetAccessorDeclaration = isGetAccessorDeclaration;
function isSetAccessorDeclaration(node) {
- return node.kind === 159 /* SetAccessor */;
+ return node.kind === 160 /* SetAccessor */;
}
ts.isSetAccessorDeclaration = isSetAccessorDeclaration;
function isCallSignatureDeclaration(node) {
- return node.kind === 160 /* CallSignature */;
+ return node.kind === 161 /* CallSignature */;
}
ts.isCallSignatureDeclaration = isCallSignatureDeclaration;
function isConstructSignatureDeclaration(node) {
- return node.kind === 161 /* ConstructSignature */;
+ return node.kind === 162 /* ConstructSignature */;
}
ts.isConstructSignatureDeclaration = isConstructSignatureDeclaration;
function isIndexSignatureDeclaration(node) {
- return node.kind === 162 /* IndexSignature */;
+ return node.kind === 163 /* IndexSignature */;
}
ts.isIndexSignatureDeclaration = isIndexSignatureDeclaration;
/* @internal */
function isGetOrSetAccessorDeclaration(node) {
- return node.kind === 159 /* SetAccessor */ || node.kind === 158 /* GetAccessor */;
+ return node.kind === 160 /* SetAccessor */ || node.kind === 159 /* GetAccessor */;
}
ts.isGetOrSetAccessorDeclaration = isGetOrSetAccessorDeclaration;
// Type
function isTypePredicateNode(node) {
- return node.kind === 163 /* TypePredicate */;
+ return node.kind === 164 /* TypePredicate */;
}
ts.isTypePredicateNode = isTypePredicateNode;
function isTypeReferenceNode(node) {
- return node.kind === 164 /* TypeReference */;
+ return node.kind === 165 /* TypeReference */;
}
ts.isTypeReferenceNode = isTypeReferenceNode;
function isFunctionTypeNode(node) {
- return node.kind === 165 /* FunctionType */;
+ return node.kind === 166 /* FunctionType */;
}
ts.isFunctionTypeNode = isFunctionTypeNode;
function isConstructorTypeNode(node) {
- return node.kind === 166 /* ConstructorType */;
+ return node.kind === 167 /* ConstructorType */;
}
ts.isConstructorTypeNode = isConstructorTypeNode;
function isTypeQueryNode(node) {
- return node.kind === 167 /* TypeQuery */;
+ return node.kind === 168 /* TypeQuery */;
}
ts.isTypeQueryNode = isTypeQueryNode;
function isTypeLiteralNode(node) {
- return node.kind === 168 /* TypeLiteral */;
+ return node.kind === 169 /* TypeLiteral */;
}
ts.isTypeLiteralNode = isTypeLiteralNode;
function isArrayTypeNode(node) {
- return node.kind === 169 /* ArrayType */;
+ return node.kind === 170 /* ArrayType */;
}
ts.isArrayTypeNode = isArrayTypeNode;
function isTupleTypeNode(node) {
- return node.kind === 170 /* TupleType */;
+ return node.kind === 171 /* TupleType */;
}
ts.isTupleTypeNode = isTupleTypeNode;
function isUnionTypeNode(node) {
- return node.kind === 173 /* UnionType */;
+ return node.kind === 174 /* UnionType */;
}
ts.isUnionTypeNode = isUnionTypeNode;
function isIntersectionTypeNode(node) {
- return node.kind === 174 /* IntersectionType */;
+ return node.kind === 175 /* IntersectionType */;
}
ts.isIntersectionTypeNode = isIntersectionTypeNode;
function isConditionalTypeNode(node) {
- return node.kind === 175 /* ConditionalType */;
+ return node.kind === 176 /* ConditionalType */;
}
ts.isConditionalTypeNode = isConditionalTypeNode;
function isInferTypeNode(node) {
- return node.kind === 176 /* InferType */;
+ return node.kind === 177 /* InferType */;
}
ts.isInferTypeNode = isInferTypeNode;
function isParenthesizedTypeNode(node) {
- return node.kind === 177 /* ParenthesizedType */;
+ return node.kind === 178 /* ParenthesizedType */;
}
ts.isParenthesizedTypeNode = isParenthesizedTypeNode;
function isThisTypeNode(node) {
- return node.kind === 178 /* ThisType */;
+ return node.kind === 179 /* ThisType */;
}
ts.isThisTypeNode = isThisTypeNode;
function isTypeOperatorNode(node) {
- return node.kind === 179 /* TypeOperator */;
+ return node.kind === 180 /* TypeOperator */;
}
ts.isTypeOperatorNode = isTypeOperatorNode;
function isIndexedAccessTypeNode(node) {
- return node.kind === 180 /* IndexedAccessType */;
+ return node.kind === 181 /* IndexedAccessType */;
}
ts.isIndexedAccessTypeNode = isIndexedAccessTypeNode;
function isMappedTypeNode(node) {
- return node.kind === 181 /* MappedType */;
+ return node.kind === 182 /* MappedType */;
}
ts.isMappedTypeNode = isMappedTypeNode;
function isLiteralTypeNode(node) {
- return node.kind === 182 /* LiteralType */;
+ return node.kind === 183 /* LiteralType */;
}
ts.isLiteralTypeNode = isLiteralTypeNode;
function isImportTypeNode(node) {
- return node.kind === 183 /* ImportType */;
+ return node.kind === 184 /* ImportType */;
}
ts.isImportTypeNode = isImportTypeNode;
// Binding patterns
function isObjectBindingPattern(node) {
- return node.kind === 184 /* ObjectBindingPattern */;
+ return node.kind === 185 /* ObjectBindingPattern */;
}
ts.isObjectBindingPattern = isObjectBindingPattern;
function isArrayBindingPattern(node) {
- return node.kind === 185 /* ArrayBindingPattern */;
+ return node.kind === 186 /* ArrayBindingPattern */;
}
ts.isArrayBindingPattern = isArrayBindingPattern;
function isBindingElement(node) {
- return node.kind === 186 /* BindingElement */;
+ return node.kind === 187 /* BindingElement */;
}
ts.isBindingElement = isBindingElement;
// Expression
function isArrayLiteralExpression(node) {
- return node.kind === 187 /* ArrayLiteralExpression */;
+ return node.kind === 188 /* ArrayLiteralExpression */;
}
ts.isArrayLiteralExpression = isArrayLiteralExpression;
function isObjectLiteralExpression(node) {
- return node.kind === 188 /* ObjectLiteralExpression */;
+ return node.kind === 189 /* ObjectLiteralExpression */;
}
ts.isObjectLiteralExpression = isObjectLiteralExpression;
function isPropertyAccessExpression(node) {
- return node.kind === 189 /* PropertyAccessExpression */;
+ return node.kind === 190 /* PropertyAccessExpression */;
}
ts.isPropertyAccessExpression = isPropertyAccessExpression;
function isElementAccessExpression(node) {
- return node.kind === 190 /* ElementAccessExpression */;
+ return node.kind === 191 /* ElementAccessExpression */;
}
ts.isElementAccessExpression = isElementAccessExpression;
function isCallExpression(node) {
- return node.kind === 191 /* CallExpression */;
+ return node.kind === 192 /* CallExpression */;
}
ts.isCallExpression = isCallExpression;
function isNewExpression(node) {
- return node.kind === 192 /* NewExpression */;
+ return node.kind === 193 /* NewExpression */;
}
ts.isNewExpression = isNewExpression;
function isTaggedTemplateExpression(node) {
- return node.kind === 193 /* TaggedTemplateExpression */;
+ return node.kind === 194 /* TaggedTemplateExpression */;
}
ts.isTaggedTemplateExpression = isTaggedTemplateExpression;
function isTypeAssertion(node) {
- return node.kind === 194 /* TypeAssertionExpression */;
+ return node.kind === 195 /* TypeAssertionExpression */;
}
ts.isTypeAssertion = isTypeAssertion;
function isConstTypeReference(node) {
@@ -13652,376 +13778,376 @@
}
ts.isConstTypeReference = isConstTypeReference;
function isParenthesizedExpression(node) {
- return node.kind === 195 /* ParenthesizedExpression */;
+ return node.kind === 196 /* ParenthesizedExpression */;
}
ts.isParenthesizedExpression = isParenthesizedExpression;
function skipPartiallyEmittedExpressions(node) {
- while (node.kind === 313 /* PartiallyEmittedExpression */) {
+ while (node.kind === 314 /* PartiallyEmittedExpression */) {
node = node.expression;
}
return node;
}
ts.skipPartiallyEmittedExpressions = skipPartiallyEmittedExpressions;
function isFunctionExpression(node) {
- return node.kind === 196 /* FunctionExpression */;
+ return node.kind === 197 /* FunctionExpression */;
}
ts.isFunctionExpression = isFunctionExpression;
function isArrowFunction(node) {
- return node.kind === 197 /* ArrowFunction */;
+ return node.kind === 198 /* ArrowFunction */;
}
ts.isArrowFunction = isArrowFunction;
function isDeleteExpression(node) {
- return node.kind === 198 /* DeleteExpression */;
+ return node.kind === 199 /* DeleteExpression */;
}
ts.isDeleteExpression = isDeleteExpression;
function isTypeOfExpression(node) {
- return node.kind === 199 /* TypeOfExpression */;
+ return node.kind === 200 /* TypeOfExpression */;
}
ts.isTypeOfExpression = isTypeOfExpression;
function isVoidExpression(node) {
- return node.kind === 200 /* VoidExpression */;
+ return node.kind === 201 /* VoidExpression */;
}
ts.isVoidExpression = isVoidExpression;
function isAwaitExpression(node) {
- return node.kind === 201 /* AwaitExpression */;
+ return node.kind === 202 /* AwaitExpression */;
}
ts.isAwaitExpression = isAwaitExpression;
function isPrefixUnaryExpression(node) {
- return node.kind === 202 /* PrefixUnaryExpression */;
+ return node.kind === 203 /* PrefixUnaryExpression */;
}
ts.isPrefixUnaryExpression = isPrefixUnaryExpression;
function isPostfixUnaryExpression(node) {
- return node.kind === 203 /* PostfixUnaryExpression */;
+ return node.kind === 204 /* PostfixUnaryExpression */;
}
ts.isPostfixUnaryExpression = isPostfixUnaryExpression;
function isBinaryExpression(node) {
- return node.kind === 204 /* BinaryExpression */;
+ return node.kind === 205 /* BinaryExpression */;
}
ts.isBinaryExpression = isBinaryExpression;
function isConditionalExpression(node) {
- return node.kind === 205 /* ConditionalExpression */;
+ return node.kind === 206 /* ConditionalExpression */;
}
ts.isConditionalExpression = isConditionalExpression;
function isTemplateExpression(node) {
- return node.kind === 206 /* TemplateExpression */;
+ return node.kind === 207 /* TemplateExpression */;
}
ts.isTemplateExpression = isTemplateExpression;
function isYieldExpression(node) {
- return node.kind === 207 /* YieldExpression */;
+ return node.kind === 208 /* YieldExpression */;
}
ts.isYieldExpression = isYieldExpression;
function isSpreadElement(node) {
- return node.kind === 208 /* SpreadElement */;
+ return node.kind === 209 /* SpreadElement */;
}
ts.isSpreadElement = isSpreadElement;
function isClassExpression(node) {
- return node.kind === 209 /* ClassExpression */;
+ return node.kind === 210 /* ClassExpression */;
}
ts.isClassExpression = isClassExpression;
function isOmittedExpression(node) {
- return node.kind === 210 /* OmittedExpression */;
+ return node.kind === 211 /* OmittedExpression */;
}
ts.isOmittedExpression = isOmittedExpression;
function isExpressionWithTypeArguments(node) {
- return node.kind === 211 /* ExpressionWithTypeArguments */;
+ return node.kind === 212 /* ExpressionWithTypeArguments */;
}
ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments;
function isAsExpression(node) {
- return node.kind === 212 /* AsExpression */;
+ return node.kind === 213 /* AsExpression */;
}
ts.isAsExpression = isAsExpression;
function isNonNullExpression(node) {
- return node.kind === 213 /* NonNullExpression */;
+ return node.kind === 214 /* NonNullExpression */;
}
ts.isNonNullExpression = isNonNullExpression;
function isMetaProperty(node) {
- return node.kind === 214 /* MetaProperty */;
+ return node.kind === 215 /* MetaProperty */;
}
ts.isMetaProperty = isMetaProperty;
// Misc
function isTemplateSpan(node) {
- return node.kind === 216 /* TemplateSpan */;
+ return node.kind === 217 /* TemplateSpan */;
}
ts.isTemplateSpan = isTemplateSpan;
function isSemicolonClassElement(node) {
- return node.kind === 217 /* SemicolonClassElement */;
+ return node.kind === 218 /* SemicolonClassElement */;
}
ts.isSemicolonClassElement = isSemicolonClassElement;
// Block
function isBlock(node) {
- return node.kind === 218 /* Block */;
+ return node.kind === 219 /* Block */;
}
ts.isBlock = isBlock;
function isVariableStatement(node) {
- return node.kind === 219 /* VariableStatement */;
+ return node.kind === 220 /* VariableStatement */;
}
ts.isVariableStatement = isVariableStatement;
function isEmptyStatement(node) {
- return node.kind === 220 /* EmptyStatement */;
+ return node.kind === 221 /* EmptyStatement */;
}
ts.isEmptyStatement = isEmptyStatement;
function isExpressionStatement(node) {
- return node.kind === 221 /* ExpressionStatement */;
+ return node.kind === 222 /* ExpressionStatement */;
}
ts.isExpressionStatement = isExpressionStatement;
function isIfStatement(node) {
- return node.kind === 222 /* IfStatement */;
+ return node.kind === 223 /* IfStatement */;
}
ts.isIfStatement = isIfStatement;
function isDoStatement(node) {
- return node.kind === 223 /* DoStatement */;
+ return node.kind === 224 /* DoStatement */;
}
ts.isDoStatement = isDoStatement;
function isWhileStatement(node) {
- return node.kind === 224 /* WhileStatement */;
+ return node.kind === 225 /* WhileStatement */;
}
ts.isWhileStatement = isWhileStatement;
function isForStatement(node) {
- return node.kind === 225 /* ForStatement */;
+ return node.kind === 226 /* ForStatement */;
}
ts.isForStatement = isForStatement;
function isForInStatement(node) {
- return node.kind === 226 /* ForInStatement */;
+ return node.kind === 227 /* ForInStatement */;
}
ts.isForInStatement = isForInStatement;
function isForOfStatement(node) {
- return node.kind === 227 /* ForOfStatement */;
+ return node.kind === 228 /* ForOfStatement */;
}
ts.isForOfStatement = isForOfStatement;
function isContinueStatement(node) {
- return node.kind === 228 /* ContinueStatement */;
+ return node.kind === 229 /* ContinueStatement */;
}
ts.isContinueStatement = isContinueStatement;
function isBreakStatement(node) {
- return node.kind === 229 /* BreakStatement */;
+ return node.kind === 230 /* BreakStatement */;
}
ts.isBreakStatement = isBreakStatement;
function isBreakOrContinueStatement(node) {
- return node.kind === 229 /* BreakStatement */ || node.kind === 228 /* ContinueStatement */;
+ return node.kind === 230 /* BreakStatement */ || node.kind === 229 /* ContinueStatement */;
}
ts.isBreakOrContinueStatement = isBreakOrContinueStatement;
function isReturnStatement(node) {
- return node.kind === 230 /* ReturnStatement */;
+ return node.kind === 231 /* ReturnStatement */;
}
ts.isReturnStatement = isReturnStatement;
function isWithStatement(node) {
- return node.kind === 231 /* WithStatement */;
+ return node.kind === 232 /* WithStatement */;
}
ts.isWithStatement = isWithStatement;
function isSwitchStatement(node) {
- return node.kind === 232 /* SwitchStatement */;
+ return node.kind === 233 /* SwitchStatement */;
}
ts.isSwitchStatement = isSwitchStatement;
function isLabeledStatement(node) {
- return node.kind === 233 /* LabeledStatement */;
+ return node.kind === 234 /* LabeledStatement */;
}
ts.isLabeledStatement = isLabeledStatement;
function isThrowStatement(node) {
- return node.kind === 234 /* ThrowStatement */;
+ return node.kind === 235 /* ThrowStatement */;
}
ts.isThrowStatement = isThrowStatement;
function isTryStatement(node) {
- return node.kind === 235 /* TryStatement */;
+ return node.kind === 236 /* TryStatement */;
}
ts.isTryStatement = isTryStatement;
function isDebuggerStatement(node) {
- return node.kind === 236 /* DebuggerStatement */;
+ return node.kind === 237 /* DebuggerStatement */;
}
ts.isDebuggerStatement = isDebuggerStatement;
function isVariableDeclaration(node) {
- return node.kind === 237 /* VariableDeclaration */;
+ return node.kind === 238 /* VariableDeclaration */;
}
ts.isVariableDeclaration = isVariableDeclaration;
function isVariableDeclarationList(node) {
- return node.kind === 238 /* VariableDeclarationList */;
+ return node.kind === 239 /* VariableDeclarationList */;
}
ts.isVariableDeclarationList = isVariableDeclarationList;
function isFunctionDeclaration(node) {
- return node.kind === 239 /* FunctionDeclaration */;
+ return node.kind === 240 /* FunctionDeclaration */;
}
ts.isFunctionDeclaration = isFunctionDeclaration;
function isClassDeclaration(node) {
- return node.kind === 240 /* ClassDeclaration */;
+ return node.kind === 241 /* ClassDeclaration */;
}
ts.isClassDeclaration = isClassDeclaration;
function isInterfaceDeclaration(node) {
- return node.kind === 241 /* InterfaceDeclaration */;
+ return node.kind === 242 /* InterfaceDeclaration */;
}
ts.isInterfaceDeclaration = isInterfaceDeclaration;
function isTypeAliasDeclaration(node) {
- return node.kind === 242 /* TypeAliasDeclaration */;
+ return node.kind === 243 /* TypeAliasDeclaration */;
}
ts.isTypeAliasDeclaration = isTypeAliasDeclaration;
function isEnumDeclaration(node) {
- return node.kind === 243 /* EnumDeclaration */;
+ return node.kind === 244 /* EnumDeclaration */;
}
ts.isEnumDeclaration = isEnumDeclaration;
function isModuleDeclaration(node) {
- return node.kind === 244 /* ModuleDeclaration */;
+ return node.kind === 245 /* ModuleDeclaration */;
}
ts.isModuleDeclaration = isModuleDeclaration;
function isModuleBlock(node) {
- return node.kind === 245 /* ModuleBlock */;
+ return node.kind === 246 /* ModuleBlock */;
}
ts.isModuleBlock = isModuleBlock;
function isCaseBlock(node) {
- return node.kind === 246 /* CaseBlock */;
+ return node.kind === 247 /* CaseBlock */;
}
ts.isCaseBlock = isCaseBlock;
function isNamespaceExportDeclaration(node) {
- return node.kind === 247 /* NamespaceExportDeclaration */;
+ return node.kind === 248 /* NamespaceExportDeclaration */;
}
ts.isNamespaceExportDeclaration = isNamespaceExportDeclaration;
function isImportEqualsDeclaration(node) {
- return node.kind === 248 /* ImportEqualsDeclaration */;
+ return node.kind === 249 /* ImportEqualsDeclaration */;
}
ts.isImportEqualsDeclaration = isImportEqualsDeclaration;
function isImportDeclaration(node) {
- return node.kind === 249 /* ImportDeclaration */;
+ return node.kind === 250 /* ImportDeclaration */;
}
ts.isImportDeclaration = isImportDeclaration;
function isImportClause(node) {
- return node.kind === 250 /* ImportClause */;
+ return node.kind === 251 /* ImportClause */;
}
ts.isImportClause = isImportClause;
function isNamespaceImport(node) {
- return node.kind === 251 /* NamespaceImport */;
+ return node.kind === 252 /* NamespaceImport */;
}
ts.isNamespaceImport = isNamespaceImport;
function isNamedImports(node) {
- return node.kind === 252 /* NamedImports */;
+ return node.kind === 253 /* NamedImports */;
}
ts.isNamedImports = isNamedImports;
function isImportSpecifier(node) {
- return node.kind === 253 /* ImportSpecifier */;
+ return node.kind === 254 /* ImportSpecifier */;
}
ts.isImportSpecifier = isImportSpecifier;
function isExportAssignment(node) {
- return node.kind === 254 /* ExportAssignment */;
+ return node.kind === 255 /* ExportAssignment */;
}
ts.isExportAssignment = isExportAssignment;
function isExportDeclaration(node) {
- return node.kind === 255 /* ExportDeclaration */;
+ return node.kind === 256 /* ExportDeclaration */;
}
ts.isExportDeclaration = isExportDeclaration;
function isNamedExports(node) {
- return node.kind === 256 /* NamedExports */;
+ return node.kind === 257 /* NamedExports */;
}
ts.isNamedExports = isNamedExports;
function isExportSpecifier(node) {
- return node.kind === 257 /* ExportSpecifier */;
+ return node.kind === 258 /* ExportSpecifier */;
}
ts.isExportSpecifier = isExportSpecifier;
function isMissingDeclaration(node) {
- return node.kind === 258 /* MissingDeclaration */;
+ return node.kind === 259 /* MissingDeclaration */;
}
ts.isMissingDeclaration = isMissingDeclaration;
// Module References
function isExternalModuleReference(node) {
- return node.kind === 259 /* ExternalModuleReference */;
+ return node.kind === 260 /* ExternalModuleReference */;
}
ts.isExternalModuleReference = isExternalModuleReference;
// JSX
function isJsxElement(node) {
- return node.kind === 260 /* JsxElement */;
+ return node.kind === 261 /* JsxElement */;
}
ts.isJsxElement = isJsxElement;
function isJsxSelfClosingElement(node) {
- return node.kind === 261 /* JsxSelfClosingElement */;
+ return node.kind === 262 /* JsxSelfClosingElement */;
}
ts.isJsxSelfClosingElement = isJsxSelfClosingElement;
function isJsxOpeningElement(node) {
- return node.kind === 262 /* JsxOpeningElement */;
+ return node.kind === 263 /* JsxOpeningElement */;
}
ts.isJsxOpeningElement = isJsxOpeningElement;
function isJsxClosingElement(node) {
- return node.kind === 263 /* JsxClosingElement */;
+ return node.kind === 264 /* JsxClosingElement */;
}
ts.isJsxClosingElement = isJsxClosingElement;
function isJsxFragment(node) {
- return node.kind === 264 /* JsxFragment */;
+ return node.kind === 265 /* JsxFragment */;
}
ts.isJsxFragment = isJsxFragment;
function isJsxOpeningFragment(node) {
- return node.kind === 265 /* JsxOpeningFragment */;
+ return node.kind === 266 /* JsxOpeningFragment */;
}
ts.isJsxOpeningFragment = isJsxOpeningFragment;
function isJsxClosingFragment(node) {
- return node.kind === 266 /* JsxClosingFragment */;
+ return node.kind === 267 /* JsxClosingFragment */;
}
ts.isJsxClosingFragment = isJsxClosingFragment;
function isJsxAttribute(node) {
- return node.kind === 267 /* JsxAttribute */;
+ return node.kind === 268 /* JsxAttribute */;
}
ts.isJsxAttribute = isJsxAttribute;
function isJsxAttributes(node) {
- return node.kind === 268 /* JsxAttributes */;
+ return node.kind === 269 /* JsxAttributes */;
}
ts.isJsxAttributes = isJsxAttributes;
function isJsxSpreadAttribute(node) {
- return node.kind === 269 /* JsxSpreadAttribute */;
+ return node.kind === 270 /* JsxSpreadAttribute */;
}
ts.isJsxSpreadAttribute = isJsxSpreadAttribute;
function isJsxExpression(node) {
- return node.kind === 270 /* JsxExpression */;
+ return node.kind === 271 /* JsxExpression */;
}
ts.isJsxExpression = isJsxExpression;
// Clauses
function isCaseClause(node) {
- return node.kind === 271 /* CaseClause */;
+ return node.kind === 272 /* CaseClause */;
}
ts.isCaseClause = isCaseClause;
function isDefaultClause(node) {
- return node.kind === 272 /* DefaultClause */;
+ return node.kind === 273 /* DefaultClause */;
}
ts.isDefaultClause = isDefaultClause;
function isHeritageClause(node) {
- return node.kind === 273 /* HeritageClause */;
+ return node.kind === 274 /* HeritageClause */;
}
ts.isHeritageClause = isHeritageClause;
function isCatchClause(node) {
- return node.kind === 274 /* CatchClause */;
+ return node.kind === 275 /* CatchClause */;
}
ts.isCatchClause = isCatchClause;
// Property assignments
function isPropertyAssignment(node) {
- return node.kind === 275 /* PropertyAssignment */;
+ return node.kind === 276 /* PropertyAssignment */;
}
ts.isPropertyAssignment = isPropertyAssignment;
function isShorthandPropertyAssignment(node) {
- return node.kind === 276 /* ShorthandPropertyAssignment */;
+ return node.kind === 277 /* ShorthandPropertyAssignment */;
}
ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment;
function isSpreadAssignment(node) {
- return node.kind === 277 /* SpreadAssignment */;
+ return node.kind === 278 /* SpreadAssignment */;
}
ts.isSpreadAssignment = isSpreadAssignment;
// Enum
function isEnumMember(node) {
- return node.kind === 278 /* EnumMember */;
+ return node.kind === 279 /* EnumMember */;
}
ts.isEnumMember = isEnumMember;
// Top-level nodes
function isSourceFile(node) {
- return node.kind === 284 /* SourceFile */;
+ return node.kind === 285 /* SourceFile */;
}
ts.isSourceFile = isSourceFile;
function isBundle(node) {
- return node.kind === 285 /* Bundle */;
+ return node.kind === 286 /* Bundle */;
}
ts.isBundle = isBundle;
function isUnparsedSource(node) {
- return node.kind === 286 /* UnparsedSource */;
+ return node.kind === 287 /* UnparsedSource */;
}
ts.isUnparsedSource = isUnparsedSource;
function isUnparsedPrepend(node) {
- return node.kind === 280 /* UnparsedPrepend */;
+ return node.kind === 281 /* UnparsedPrepend */;
}
ts.isUnparsedPrepend = isUnparsedPrepend;
function isUnparsedTextLike(node) {
switch (node.kind) {
- case 281 /* UnparsedText */:
- case 282 /* UnparsedInternalText */:
+ case 282 /* UnparsedText */:
+ case 283 /* UnparsedInternalText */:
return true;
default:
return false;
@@ -14030,101 +14156,101 @@
ts.isUnparsedTextLike = isUnparsedTextLike;
function isUnparsedNode(node) {
return isUnparsedTextLike(node) ||
- node.kind === 279 /* UnparsedPrologue */ ||
- node.kind === 283 /* UnparsedSyntheticReference */;
+ node.kind === 280 /* UnparsedPrologue */ ||
+ node.kind === 284 /* UnparsedSyntheticReference */;
}
ts.isUnparsedNode = isUnparsedNode;
// JSDoc
function isJSDocTypeExpression(node) {
- return node.kind === 288 /* JSDocTypeExpression */;
+ return node.kind === 289 /* JSDocTypeExpression */;
}
ts.isJSDocTypeExpression = isJSDocTypeExpression;
function isJSDocAllType(node) {
- return node.kind === 289 /* JSDocAllType */;
+ return node.kind === 290 /* JSDocAllType */;
}
ts.isJSDocAllType = isJSDocAllType;
function isJSDocUnknownType(node) {
- return node.kind === 290 /* JSDocUnknownType */;
+ return node.kind === 291 /* JSDocUnknownType */;
}
ts.isJSDocUnknownType = isJSDocUnknownType;
function isJSDocNullableType(node) {
- return node.kind === 291 /* JSDocNullableType */;
+ return node.kind === 292 /* JSDocNullableType */;
}
ts.isJSDocNullableType = isJSDocNullableType;
function isJSDocNonNullableType(node) {
- return node.kind === 292 /* JSDocNonNullableType */;
+ return node.kind === 293 /* JSDocNonNullableType */;
}
ts.isJSDocNonNullableType = isJSDocNonNullableType;
function isJSDocOptionalType(node) {
- return node.kind === 293 /* JSDocOptionalType */;
+ return node.kind === 294 /* JSDocOptionalType */;
}
ts.isJSDocOptionalType = isJSDocOptionalType;
function isJSDocFunctionType(node) {
- return node.kind === 294 /* JSDocFunctionType */;
+ return node.kind === 295 /* JSDocFunctionType */;
}
ts.isJSDocFunctionType = isJSDocFunctionType;
function isJSDocVariadicType(node) {
- return node.kind === 295 /* JSDocVariadicType */;
+ return node.kind === 296 /* JSDocVariadicType */;
}
ts.isJSDocVariadicType = isJSDocVariadicType;
function isJSDoc(node) {
- return node.kind === 296 /* JSDocComment */;
+ return node.kind === 297 /* JSDocComment */;
}
ts.isJSDoc = isJSDoc;
function isJSDocAugmentsTag(node) {
- return node.kind === 300 /* JSDocAugmentsTag */;
+ return node.kind === 301 /* JSDocAugmentsTag */;
}
ts.isJSDocAugmentsTag = isJSDocAugmentsTag;
function isJSDocClassTag(node) {
- return node.kind === 301 /* JSDocClassTag */;
+ return node.kind === 302 /* JSDocClassTag */;
}
ts.isJSDocClassTag = isJSDocClassTag;
function isJSDocEnumTag(node) {
- return node.kind === 303 /* JSDocEnumTag */;
+ return node.kind === 304 /* JSDocEnumTag */;
}
ts.isJSDocEnumTag = isJSDocEnumTag;
function isJSDocThisTag(node) {
- return node.kind === 306 /* JSDocThisTag */;
+ return node.kind === 307 /* JSDocThisTag */;
}
ts.isJSDocThisTag = isJSDocThisTag;
function isJSDocParameterTag(node) {
- return node.kind === 304 /* JSDocParameterTag */;
+ return node.kind === 305 /* JSDocParameterTag */;
}
ts.isJSDocParameterTag = isJSDocParameterTag;
function isJSDocReturnTag(node) {
- return node.kind === 305 /* JSDocReturnTag */;
+ return node.kind === 306 /* JSDocReturnTag */;
}
ts.isJSDocReturnTag = isJSDocReturnTag;
function isJSDocTypeTag(node) {
- return node.kind === 307 /* JSDocTypeTag */;
+ return node.kind === 308 /* JSDocTypeTag */;
}
ts.isJSDocTypeTag = isJSDocTypeTag;
function isJSDocTemplateTag(node) {
- return node.kind === 308 /* JSDocTemplateTag */;
+ return node.kind === 309 /* JSDocTemplateTag */;
}
ts.isJSDocTemplateTag = isJSDocTemplateTag;
function isJSDocTypedefTag(node) {
- return node.kind === 309 /* JSDocTypedefTag */;
+ return node.kind === 310 /* JSDocTypedefTag */;
}
ts.isJSDocTypedefTag = isJSDocTypedefTag;
function isJSDocPropertyTag(node) {
- return node.kind === 310 /* JSDocPropertyTag */;
+ return node.kind === 311 /* JSDocPropertyTag */;
}
ts.isJSDocPropertyTag = isJSDocPropertyTag;
function isJSDocPropertyLikeTag(node) {
- return node.kind === 310 /* JSDocPropertyTag */ || node.kind === 304 /* JSDocParameterTag */;
+ return node.kind === 311 /* JSDocPropertyTag */ || node.kind === 305 /* JSDocParameterTag */;
}
ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag;
function isJSDocTypeLiteral(node) {
- return node.kind === 297 /* JSDocTypeLiteral */;
+ return node.kind === 298 /* JSDocTypeLiteral */;
}
ts.isJSDocTypeLiteral = isJSDocTypeLiteral;
function isJSDocCallbackTag(node) {
- return node.kind === 302 /* JSDocCallbackTag */;
+ return node.kind === 303 /* JSDocCallbackTag */;
}
ts.isJSDocCallbackTag = isJSDocCallbackTag;
function isJSDocSignature(node) {
- return node.kind === 298 /* JSDocSignature */;
+ return node.kind === 299 /* JSDocSignature */;
}
ts.isJSDocSignature = isJSDocSignature;
})(ts || (ts = {}));
@@ -14135,7 +14261,7 @@
(function (ts) {
/* @internal */
function isSyntaxList(n) {
- return n.kind === 311 /* SyntaxList */;
+ return n.kind === 312 /* SyntaxList */;
}
ts.isSyntaxList = isSyntaxList;
/* @internal */
@@ -14145,7 +14271,7 @@
ts.isNode = isNode;
/* @internal */
function isNodeKind(kind) {
- return kind >= 148 /* FirstNode */;
+ return kind >= 149 /* FirstNode */;
}
ts.isNodeKind = isNodeKind;
/**
@@ -14154,7 +14280,7 @@
* Literals are considered tokens, except TemplateLiteral, but does include TemplateHead/Middle/Tail.
*/
function isToken(n) {
- return n.kind >= 0 /* FirstToken */ && n.kind <= 147 /* LastToken */;
+ return n.kind >= 0 /* FirstToken */ && n.kind <= 148 /* LastToken */;
}
ts.isToken = isToken;
// Node Arrays
@@ -14207,17 +14333,17 @@
/* @internal */
function isModifierKind(token) {
switch (token) {
- case 118 /* AbstractKeyword */:
- case 121 /* AsyncKeyword */:
- case 77 /* ConstKeyword */:
- case 125 /* DeclareKeyword */:
- case 80 /* DefaultKeyword */:
- case 85 /* ExportKeyword */:
- case 115 /* PublicKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 133 /* ReadonlyKeyword */:
- case 116 /* StaticKeyword */:
+ case 119 /* AbstractKeyword */:
+ case 122 /* AsyncKeyword */:
+ case 78 /* ConstKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 81 /* DefaultKeyword */:
+ case 86 /* ExportKeyword */:
+ case 116 /* PublicKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 134 /* ReadonlyKeyword */:
+ case 117 /* StaticKeyword */:
return true;
}
return false;
@@ -14230,7 +14356,7 @@
ts.isParameterPropertyModifier = isParameterPropertyModifier;
/* @internal */
function isClassMemberModifier(idToken) {
- return isParameterPropertyModifier(idToken) || idToken === 116 /* StaticKeyword */;
+ return isParameterPropertyModifier(idToken) || idToken === 117 /* StaticKeyword */;
}
ts.isClassMemberModifier = isClassMemberModifier;
function isModifier(node) {
@@ -14239,23 +14365,23 @@
ts.isModifier = isModifier;
function isEntityName(node) {
var kind = node.kind;
- return kind === 148 /* QualifiedName */
- || kind === 72 /* Identifier */;
+ return kind === 149 /* QualifiedName */
+ || kind === 73 /* Identifier */;
}
ts.isEntityName = isEntityName;
function isPropertyName(node) {
var kind = node.kind;
- return kind === 72 /* Identifier */
+ return kind === 73 /* Identifier */
|| kind === 10 /* StringLiteral */
|| kind === 8 /* NumericLiteral */
- || kind === 149 /* ComputedPropertyName */;
+ || kind === 150 /* ComputedPropertyName */;
}
ts.isPropertyName = isPropertyName;
function isBindingName(node) {
var kind = node.kind;
- return kind === 72 /* Identifier */
- || kind === 184 /* ObjectBindingPattern */
- || kind === 185 /* ArrayBindingPattern */;
+ return kind === 73 /* Identifier */
+ || kind === 185 /* ObjectBindingPattern */
+ || kind === 186 /* ArrayBindingPattern */;
}
ts.isBindingName = isBindingName;
// Functions
@@ -14270,13 +14396,13 @@
ts.isFunctionLikeDeclaration = isFunctionLikeDeclaration;
function isFunctionLikeDeclarationKind(kind) {
switch (kind) {
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return true;
default:
return false;
@@ -14285,14 +14411,14 @@
/* @internal */
function isFunctionLikeKind(kind) {
switch (kind) {
- case 155 /* MethodSignature */:
- case 160 /* CallSignature */:
- case 298 /* JSDocSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
- case 165 /* FunctionType */:
- case 294 /* JSDocFunctionType */:
- case 166 /* ConstructorType */:
+ case 156 /* MethodSignature */:
+ case 161 /* CallSignature */:
+ case 299 /* JSDocSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
+ case 166 /* FunctionType */:
+ case 295 /* JSDocFunctionType */:
+ case 167 /* ConstructorType */:
return true;
default:
return isFunctionLikeDeclarationKind(kind);
@@ -14307,29 +14433,29 @@
// Classes
function isClassElement(node) {
var kind = node.kind;
- return kind === 157 /* Constructor */
- || kind === 154 /* PropertyDeclaration */
- || kind === 156 /* MethodDeclaration */
- || kind === 158 /* GetAccessor */
- || kind === 159 /* SetAccessor */
- || kind === 162 /* IndexSignature */
- || kind === 217 /* SemicolonClassElement */;
+ return kind === 158 /* Constructor */
+ || kind === 155 /* PropertyDeclaration */
+ || kind === 157 /* MethodDeclaration */
+ || kind === 159 /* GetAccessor */
+ || kind === 160 /* SetAccessor */
+ || kind === 163 /* IndexSignature */
+ || kind === 218 /* SemicolonClassElement */;
}
ts.isClassElement = isClassElement;
function isClassLike(node) {
- return node && (node.kind === 240 /* ClassDeclaration */ || node.kind === 209 /* ClassExpression */);
+ return node && (node.kind === 241 /* ClassDeclaration */ || node.kind === 210 /* ClassExpression */);
}
ts.isClassLike = isClassLike;
function isAccessor(node) {
- return node && (node.kind === 158 /* GetAccessor */ || node.kind === 159 /* SetAccessor */);
+ return node && (node.kind === 159 /* GetAccessor */ || node.kind === 160 /* SetAccessor */);
}
ts.isAccessor = isAccessor;
/* @internal */
function isMethodOrAccessor(node) {
switch (node.kind) {
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return true;
default:
return false;
@@ -14339,11 +14465,11 @@
// Type members
function isTypeElement(node) {
var kind = node.kind;
- return kind === 161 /* ConstructSignature */
- || kind === 160 /* CallSignature */
- || kind === 153 /* PropertySignature */
- || kind === 155 /* MethodSignature */
- || kind === 162 /* IndexSignature */;
+ return kind === 162 /* ConstructSignature */
+ || kind === 161 /* CallSignature */
+ || kind === 154 /* PropertySignature */
+ || kind === 156 /* MethodSignature */
+ || kind === 163 /* IndexSignature */;
}
ts.isTypeElement = isTypeElement;
function isClassOrTypeElement(node) {
@@ -14352,12 +14478,12 @@
ts.isClassOrTypeElement = isClassOrTypeElement;
function isObjectLiteralElementLike(node) {
var kind = node.kind;
- return kind === 275 /* PropertyAssignment */
- || kind === 276 /* ShorthandPropertyAssignment */
- || kind === 277 /* SpreadAssignment */
- || kind === 156 /* MethodDeclaration */
- || kind === 158 /* GetAccessor */
- || kind === 159 /* SetAccessor */;
+ return kind === 276 /* PropertyAssignment */
+ || kind === 277 /* ShorthandPropertyAssignment */
+ || kind === 278 /* SpreadAssignment */
+ || kind === 157 /* MethodDeclaration */
+ || kind === 159 /* GetAccessor */
+ || kind === 160 /* SetAccessor */;
}
ts.isObjectLiteralElementLike = isObjectLiteralElementLike;
// Type
@@ -14372,8 +14498,8 @@
ts.isTypeNode = isTypeNode;
function isFunctionOrConstructorTypeNode(node) {
switch (node.kind) {
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
return true;
}
return false;
@@ -14384,8 +14510,8 @@
function isBindingPattern(node) {
if (node) {
var kind = node.kind;
- return kind === 185 /* ArrayBindingPattern */
- || kind === 184 /* ObjectBindingPattern */;
+ return kind === 186 /* ArrayBindingPattern */
+ || kind === 185 /* ObjectBindingPattern */;
}
return false;
}
@@ -14393,15 +14519,15 @@
/* @internal */
function isAssignmentPattern(node) {
var kind = node.kind;
- return kind === 187 /* ArrayLiteralExpression */
- || kind === 188 /* ObjectLiteralExpression */;
+ return kind === 188 /* ArrayLiteralExpression */
+ || kind === 189 /* ObjectLiteralExpression */;
}
ts.isAssignmentPattern = isAssignmentPattern;
/* @internal */
function isArrayBindingElement(node) {
var kind = node.kind;
- return kind === 186 /* BindingElement */
- || kind === 210 /* OmittedExpression */;
+ return kind === 187 /* BindingElement */
+ || kind === 211 /* OmittedExpression */;
}
ts.isArrayBindingElement = isArrayBindingElement;
/**
@@ -14410,9 +14536,9 @@
/* @internal */
function isDeclarationBindingElement(bindingElement) {
switch (bindingElement.kind) {
- case 237 /* VariableDeclaration */:
- case 151 /* Parameter */:
- case 186 /* BindingElement */:
+ case 238 /* VariableDeclaration */:
+ case 152 /* Parameter */:
+ case 187 /* BindingElement */:
return true;
}
return false;
@@ -14433,8 +14559,8 @@
/* @internal */
function isObjectBindingOrAssignmentPattern(node) {
switch (node.kind) {
- case 184 /* ObjectBindingPattern */:
- case 188 /* ObjectLiteralExpression */:
+ case 185 /* ObjectBindingPattern */:
+ case 189 /* ObjectLiteralExpression */:
return true;
}
return false;
@@ -14446,8 +14572,8 @@
/* @internal */
function isArrayBindingOrAssignmentPattern(node) {
switch (node.kind) {
- case 185 /* ArrayBindingPattern */:
- case 187 /* ArrayLiteralExpression */:
+ case 186 /* ArrayBindingPattern */:
+ case 188 /* ArrayLiteralExpression */:
return true;
}
return false;
@@ -14456,26 +14582,26 @@
/* @internal */
function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) {
var kind = node.kind;
- return kind === 189 /* PropertyAccessExpression */
- || kind === 148 /* QualifiedName */
- || kind === 183 /* ImportType */;
+ return kind === 190 /* PropertyAccessExpression */
+ || kind === 149 /* QualifiedName */
+ || kind === 184 /* ImportType */;
}
ts.isPropertyAccessOrQualifiedNameOrImportTypeNode = isPropertyAccessOrQualifiedNameOrImportTypeNode;
// Expression
function isPropertyAccessOrQualifiedName(node) {
var kind = node.kind;
- return kind === 189 /* PropertyAccessExpression */
- || kind === 148 /* QualifiedName */;
+ return kind === 190 /* PropertyAccessExpression */
+ || kind === 149 /* QualifiedName */;
}
ts.isPropertyAccessOrQualifiedName = isPropertyAccessOrQualifiedName;
function isCallLikeExpression(node) {
switch (node.kind) {
- case 262 /* JsxOpeningElement */:
- case 261 /* JsxSelfClosingElement */:
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
- case 193 /* TaggedTemplateExpression */:
- case 152 /* Decorator */:
+ case 263 /* JsxOpeningElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
+ case 194 /* TaggedTemplateExpression */:
+ case 153 /* Decorator */:
return true;
default:
return false;
@@ -14483,12 +14609,12 @@
}
ts.isCallLikeExpression = isCallLikeExpression;
function isCallOrNewExpression(node) {
- return node.kind === 191 /* CallExpression */ || node.kind === 192 /* NewExpression */;
+ return node.kind === 192 /* CallExpression */ || node.kind === 193 /* NewExpression */;
}
ts.isCallOrNewExpression = isCallOrNewExpression;
function isTemplateLiteral(node) {
var kind = node.kind;
- return kind === 206 /* TemplateExpression */
+ return kind === 207 /* TemplateExpression */
|| kind === 14 /* NoSubstitutionTemplateLiteral */;
}
ts.isTemplateLiteral = isTemplateLiteral;
@@ -14499,34 +14625,34 @@
ts.isLeftHandSideExpression = isLeftHandSideExpression;
function isLeftHandSideExpressionKind(kind) {
switch (kind) {
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
- case 192 /* NewExpression */:
- case 191 /* CallExpression */:
- case 260 /* JsxElement */:
- case 261 /* JsxSelfClosingElement */:
- case 264 /* JsxFragment */:
- case 193 /* TaggedTemplateExpression */:
- case 187 /* ArrayLiteralExpression */:
- case 195 /* ParenthesizedExpression */:
- case 188 /* ObjectLiteralExpression */:
- case 209 /* ClassExpression */:
- case 196 /* FunctionExpression */:
- case 72 /* Identifier */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
+ case 193 /* NewExpression */:
+ case 192 /* CallExpression */:
+ case 261 /* JsxElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 265 /* JsxFragment */:
+ case 194 /* TaggedTemplateExpression */:
+ case 188 /* ArrayLiteralExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 189 /* ObjectLiteralExpression */:
+ case 210 /* ClassExpression */:
+ case 197 /* FunctionExpression */:
+ case 73 /* Identifier */:
case 13 /* RegularExpressionLiteral */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
case 10 /* StringLiteral */:
case 14 /* NoSubstitutionTemplateLiteral */:
- case 206 /* TemplateExpression */:
- case 87 /* FalseKeyword */:
- case 96 /* NullKeyword */:
- case 100 /* ThisKeyword */:
- case 102 /* TrueKeyword */:
- case 98 /* SuperKeyword */:
- case 213 /* NonNullExpression */:
- case 214 /* MetaProperty */:
- case 92 /* ImportKeyword */: // technically this is only an Expression if it's in a CallExpression
+ case 207 /* TemplateExpression */:
+ case 88 /* FalseKeyword */:
+ case 97 /* NullKeyword */:
+ case 101 /* ThisKeyword */:
+ case 103 /* TrueKeyword */:
+ case 99 /* SuperKeyword */:
+ case 214 /* NonNullExpression */:
+ case 215 /* MetaProperty */:
+ case 93 /* ImportKeyword */: // technically this is only an Expression if it's in a CallExpression
return true;
default:
return false;
@@ -14539,13 +14665,13 @@
ts.isUnaryExpression = isUnaryExpression;
function isUnaryExpressionKind(kind) {
switch (kind) {
- case 202 /* PrefixUnaryExpression */:
- case 203 /* PostfixUnaryExpression */:
- case 198 /* DeleteExpression */:
- case 199 /* TypeOfExpression */:
- case 200 /* VoidExpression */:
- case 201 /* AwaitExpression */:
- case 194 /* TypeAssertionExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
+ case 199 /* DeleteExpression */:
+ case 200 /* TypeOfExpression */:
+ case 201 /* VoidExpression */:
+ case 202 /* AwaitExpression */:
+ case 195 /* TypeAssertionExpression */:
return true;
default:
return isLeftHandSideExpressionKind(kind);
@@ -14554,9 +14680,9 @@
/* @internal */
function isUnaryExpressionWithWrite(expr) {
switch (expr.kind) {
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return true;
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return expr.operator === 44 /* PlusPlusToken */ ||
expr.operator === 45 /* MinusMinusToken */;
default:
@@ -14575,15 +14701,15 @@
ts.isExpression = isExpression;
function isExpressionKind(kind) {
switch (kind) {
- case 205 /* ConditionalExpression */:
- case 207 /* YieldExpression */:
- case 197 /* ArrowFunction */:
- case 204 /* BinaryExpression */:
- case 208 /* SpreadElement */:
- case 212 /* AsExpression */:
- case 210 /* OmittedExpression */:
- case 314 /* CommaListExpression */:
- case 313 /* PartiallyEmittedExpression */:
+ case 206 /* ConditionalExpression */:
+ case 208 /* YieldExpression */:
+ case 198 /* ArrowFunction */:
+ case 205 /* BinaryExpression */:
+ case 209 /* SpreadElement */:
+ case 213 /* AsExpression */:
+ case 211 /* OmittedExpression */:
+ case 315 /* CommaListExpression */:
+ case 314 /* PartiallyEmittedExpression */:
return true;
default:
return isUnaryExpressionKind(kind);
@@ -14591,18 +14717,18 @@
}
function isAssertionExpression(node) {
var kind = node.kind;
- return kind === 194 /* TypeAssertionExpression */
- || kind === 212 /* AsExpression */;
+ return kind === 195 /* TypeAssertionExpression */
+ || kind === 213 /* AsExpression */;
}
ts.isAssertionExpression = isAssertionExpression;
/* @internal */
function isPartiallyEmittedExpression(node) {
- return node.kind === 313 /* PartiallyEmittedExpression */;
+ return node.kind === 314 /* PartiallyEmittedExpression */;
}
ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression;
/* @internal */
function isNotEmittedStatement(node) {
- return node.kind === 312 /* NotEmittedStatement */;
+ return node.kind === 313 /* NotEmittedStatement */;
}
ts.isNotEmittedStatement = isNotEmittedStatement;
/* @internal */
@@ -14613,13 +14739,13 @@
ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode;
function isIterationStatement(node, lookInLabeledStatements) {
switch (node.kind) {
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
return true;
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements);
}
return false;
@@ -14627,7 +14753,7 @@
ts.isIterationStatement = isIterationStatement;
/* @internal */
function isForInOrOfStatement(node) {
- return node.kind === 226 /* ForInStatement */ || node.kind === 227 /* ForOfStatement */;
+ return node.kind === 227 /* ForInStatement */ || node.kind === 228 /* ForOfStatement */;
}
ts.isForInOrOfStatement = isForInOrOfStatement;
// Element
@@ -14651,113 +14777,113 @@
/* @internal */
function isModuleBody(node) {
var kind = node.kind;
- return kind === 245 /* ModuleBlock */
- || kind === 244 /* ModuleDeclaration */
- || kind === 72 /* Identifier */;
+ return kind === 246 /* ModuleBlock */
+ || kind === 245 /* ModuleDeclaration */
+ || kind === 73 /* Identifier */;
}
ts.isModuleBody = isModuleBody;
/* @internal */
function isNamespaceBody(node) {
var kind = node.kind;
- return kind === 245 /* ModuleBlock */
- || kind === 244 /* ModuleDeclaration */;
+ return kind === 246 /* ModuleBlock */
+ || kind === 245 /* ModuleDeclaration */;
}
ts.isNamespaceBody = isNamespaceBody;
/* @internal */
function isJSDocNamespaceBody(node) {
var kind = node.kind;
- return kind === 72 /* Identifier */
- || kind === 244 /* ModuleDeclaration */;
+ return kind === 73 /* Identifier */
+ || kind === 245 /* ModuleDeclaration */;
}
ts.isJSDocNamespaceBody = isJSDocNamespaceBody;
/* @internal */
function isNamedImportBindings(node) {
var kind = node.kind;
- return kind === 252 /* NamedImports */
- || kind === 251 /* NamespaceImport */;
+ return kind === 253 /* NamedImports */
+ || kind === 252 /* NamespaceImport */;
}
ts.isNamedImportBindings = isNamedImportBindings;
/* @internal */
function isModuleOrEnumDeclaration(node) {
- return node.kind === 244 /* ModuleDeclaration */ || node.kind === 243 /* EnumDeclaration */;
+ return node.kind === 245 /* ModuleDeclaration */ || node.kind === 244 /* EnumDeclaration */;
}
ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration;
function isDeclarationKind(kind) {
- return kind === 197 /* ArrowFunction */
- || kind === 186 /* BindingElement */
- || kind === 240 /* ClassDeclaration */
- || kind === 209 /* ClassExpression */
- || kind === 157 /* Constructor */
- || kind === 243 /* EnumDeclaration */
- || kind === 278 /* EnumMember */
- || kind === 257 /* ExportSpecifier */
- || kind === 239 /* FunctionDeclaration */
- || kind === 196 /* FunctionExpression */
- || kind === 158 /* GetAccessor */
- || kind === 250 /* ImportClause */
- || kind === 248 /* ImportEqualsDeclaration */
- || kind === 253 /* ImportSpecifier */
- || kind === 241 /* InterfaceDeclaration */
- || kind === 267 /* JsxAttribute */
- || kind === 156 /* MethodDeclaration */
- || kind === 155 /* MethodSignature */
- || kind === 244 /* ModuleDeclaration */
- || kind === 247 /* NamespaceExportDeclaration */
- || kind === 251 /* NamespaceImport */
- || kind === 151 /* Parameter */
- || kind === 275 /* PropertyAssignment */
- || kind === 154 /* PropertyDeclaration */
- || kind === 153 /* PropertySignature */
- || kind === 159 /* SetAccessor */
- || kind === 276 /* ShorthandPropertyAssignment */
- || kind === 242 /* TypeAliasDeclaration */
- || kind === 150 /* TypeParameter */
- || kind === 237 /* VariableDeclaration */
- || kind === 309 /* JSDocTypedefTag */
- || kind === 302 /* JSDocCallbackTag */
- || kind === 310 /* JSDocPropertyTag */;
+ return kind === 198 /* ArrowFunction */
+ || kind === 187 /* BindingElement */
+ || kind === 241 /* ClassDeclaration */
+ || kind === 210 /* ClassExpression */
+ || kind === 158 /* Constructor */
+ || kind === 244 /* EnumDeclaration */
+ || kind === 279 /* EnumMember */
+ || kind === 258 /* ExportSpecifier */
+ || kind === 240 /* FunctionDeclaration */
+ || kind === 197 /* FunctionExpression */
+ || kind === 159 /* GetAccessor */
+ || kind === 251 /* ImportClause */
+ || kind === 249 /* ImportEqualsDeclaration */
+ || kind === 254 /* ImportSpecifier */
+ || kind === 242 /* InterfaceDeclaration */
+ || kind === 268 /* JsxAttribute */
+ || kind === 157 /* MethodDeclaration */
+ || kind === 156 /* MethodSignature */
+ || kind === 245 /* ModuleDeclaration */
+ || kind === 248 /* NamespaceExportDeclaration */
+ || kind === 252 /* NamespaceImport */
+ || kind === 152 /* Parameter */
+ || kind === 276 /* PropertyAssignment */
+ || kind === 155 /* PropertyDeclaration */
+ || kind === 154 /* PropertySignature */
+ || kind === 160 /* SetAccessor */
+ || kind === 277 /* ShorthandPropertyAssignment */
+ || kind === 243 /* TypeAliasDeclaration */
+ || kind === 151 /* TypeParameter */
+ || kind === 238 /* VariableDeclaration */
+ || kind === 310 /* JSDocTypedefTag */
+ || kind === 303 /* JSDocCallbackTag */
+ || kind === 311 /* JSDocPropertyTag */;
}
function isDeclarationStatementKind(kind) {
- return kind === 239 /* FunctionDeclaration */
- || kind === 258 /* MissingDeclaration */
- || kind === 240 /* ClassDeclaration */
- || kind === 241 /* InterfaceDeclaration */
- || kind === 242 /* TypeAliasDeclaration */
- || kind === 243 /* EnumDeclaration */
- || kind === 244 /* ModuleDeclaration */
- || kind === 249 /* ImportDeclaration */
- || kind === 248 /* ImportEqualsDeclaration */
- || kind === 255 /* ExportDeclaration */
- || kind === 254 /* ExportAssignment */
- || kind === 247 /* NamespaceExportDeclaration */;
+ return kind === 240 /* FunctionDeclaration */
+ || kind === 259 /* MissingDeclaration */
+ || kind === 241 /* ClassDeclaration */
+ || kind === 242 /* InterfaceDeclaration */
+ || kind === 243 /* TypeAliasDeclaration */
+ || kind === 244 /* EnumDeclaration */
+ || kind === 245 /* ModuleDeclaration */
+ || kind === 250 /* ImportDeclaration */
+ || kind === 249 /* ImportEqualsDeclaration */
+ || kind === 256 /* ExportDeclaration */
+ || kind === 255 /* ExportAssignment */
+ || kind === 248 /* NamespaceExportDeclaration */;
}
function isStatementKindButNotDeclarationKind(kind) {
- return kind === 229 /* BreakStatement */
- || kind === 228 /* ContinueStatement */
- || kind === 236 /* DebuggerStatement */
- || kind === 223 /* DoStatement */
- || kind === 221 /* ExpressionStatement */
- || kind === 220 /* EmptyStatement */
- || kind === 226 /* ForInStatement */
- || kind === 227 /* ForOfStatement */
- || kind === 225 /* ForStatement */
- || kind === 222 /* IfStatement */
- || kind === 233 /* LabeledStatement */
- || kind === 230 /* ReturnStatement */
- || kind === 232 /* SwitchStatement */
- || kind === 234 /* ThrowStatement */
- || kind === 235 /* TryStatement */
- || kind === 219 /* VariableStatement */
- || kind === 224 /* WhileStatement */
- || kind === 231 /* WithStatement */
- || kind === 312 /* NotEmittedStatement */
- || kind === 316 /* EndOfDeclarationMarker */
- || kind === 315 /* MergeDeclarationMarker */;
+ return kind === 230 /* BreakStatement */
+ || kind === 229 /* ContinueStatement */
+ || kind === 237 /* DebuggerStatement */
+ || kind === 224 /* DoStatement */
+ || kind === 222 /* ExpressionStatement */
+ || kind === 221 /* EmptyStatement */
+ || kind === 227 /* ForInStatement */
+ || kind === 228 /* ForOfStatement */
+ || kind === 226 /* ForStatement */
+ || kind === 223 /* IfStatement */
+ || kind === 234 /* LabeledStatement */
+ || kind === 231 /* ReturnStatement */
+ || kind === 233 /* SwitchStatement */
+ || kind === 235 /* ThrowStatement */
+ || kind === 236 /* TryStatement */
+ || kind === 220 /* VariableStatement */
+ || kind === 225 /* WhileStatement */
+ || kind === 232 /* WithStatement */
+ || kind === 313 /* NotEmittedStatement */
+ || kind === 317 /* EndOfDeclarationMarker */
+ || kind === 316 /* MergeDeclarationMarker */;
}
/* @internal */
function isDeclaration(node) {
- if (node.kind === 150 /* TypeParameter */) {
- return (node.parent && node.parent.kind !== 308 /* JSDocTemplateTag */) || ts.isInJSFile(node);
+ if (node.kind === 151 /* TypeParameter */) {
+ return (node.parent && node.parent.kind !== 309 /* JSDocTemplateTag */) || ts.isInJSFile(node);
}
return isDeclarationKind(node.kind);
}
@@ -14784,10 +14910,10 @@
}
ts.isStatement = isStatement;
function isBlockStatement(node) {
- if (node.kind !== 218 /* Block */)
+ if (node.kind !== 219 /* Block */)
return false;
if (node.parent !== undefined) {
- if (node.parent.kind === 235 /* TryStatement */ || node.parent.kind === 274 /* CatchClause */) {
+ if (node.parent.kind === 236 /* TryStatement */ || node.parent.kind === 275 /* CatchClause */) {
return false;
}
}
@@ -14797,81 +14923,81 @@
/* @internal */
function isModuleReference(node) {
var kind = node.kind;
- return kind === 259 /* ExternalModuleReference */
- || kind === 148 /* QualifiedName */
- || kind === 72 /* Identifier */;
+ return kind === 260 /* ExternalModuleReference */
+ || kind === 149 /* QualifiedName */
+ || kind === 73 /* Identifier */;
}
ts.isModuleReference = isModuleReference;
// JSX
/* @internal */
function isJsxTagNameExpression(node) {
var kind = node.kind;
- return kind === 100 /* ThisKeyword */
- || kind === 72 /* Identifier */
- || kind === 189 /* PropertyAccessExpression */;
+ return kind === 101 /* ThisKeyword */
+ || kind === 73 /* Identifier */
+ || kind === 190 /* PropertyAccessExpression */;
}
ts.isJsxTagNameExpression = isJsxTagNameExpression;
/* @internal */
function isJsxChild(node) {
var kind = node.kind;
- return kind === 260 /* JsxElement */
- || kind === 270 /* JsxExpression */
- || kind === 261 /* JsxSelfClosingElement */
+ return kind === 261 /* JsxElement */
+ || kind === 271 /* JsxExpression */
+ || kind === 262 /* JsxSelfClosingElement */
|| kind === 11 /* JsxText */
- || kind === 264 /* JsxFragment */;
+ || kind === 265 /* JsxFragment */;
}
ts.isJsxChild = isJsxChild;
/* @internal */
function isJsxAttributeLike(node) {
var kind = node.kind;
- return kind === 267 /* JsxAttribute */
- || kind === 269 /* JsxSpreadAttribute */;
+ return kind === 268 /* JsxAttribute */
+ || kind === 270 /* JsxSpreadAttribute */;
}
ts.isJsxAttributeLike = isJsxAttributeLike;
/* @internal */
function isStringLiteralOrJsxExpression(node) {
var kind = node.kind;
return kind === 10 /* StringLiteral */
- || kind === 270 /* JsxExpression */;
+ || kind === 271 /* JsxExpression */;
}
ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression;
function isJsxOpeningLikeElement(node) {
var kind = node.kind;
- return kind === 262 /* JsxOpeningElement */
- || kind === 261 /* JsxSelfClosingElement */;
+ return kind === 263 /* JsxOpeningElement */
+ || kind === 262 /* JsxSelfClosingElement */;
}
ts.isJsxOpeningLikeElement = isJsxOpeningLikeElement;
// Clauses
function isCaseOrDefaultClause(node) {
var kind = node.kind;
- return kind === 271 /* CaseClause */
- || kind === 272 /* DefaultClause */;
+ return kind === 272 /* CaseClause */
+ || kind === 273 /* DefaultClause */;
}
ts.isCaseOrDefaultClause = isCaseOrDefaultClause;
// JSDoc
/** True if node is of some JSDoc syntax kind. */
/* @internal */
function isJSDocNode(node) {
- return node.kind >= 288 /* FirstJSDocNode */ && node.kind <= 310 /* LastJSDocNode */;
+ return node.kind >= 289 /* FirstJSDocNode */ && node.kind <= 311 /* LastJSDocNode */;
}
ts.isJSDocNode = isJSDocNode;
/** True if node is of a kind that may contain comment text. */
function isJSDocCommentContainingNode(node) {
- return node.kind === 296 /* JSDocComment */ || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) || ts.isJSDocSignature(node);
+ return node.kind === 297 /* JSDocComment */ || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) || ts.isJSDocSignature(node);
}
ts.isJSDocCommentContainingNode = isJSDocCommentContainingNode;
// TODO: determine what this does before making it public.
/* @internal */
function isJSDocTag(node) {
- return node.kind >= 299 /* FirstJSDocTagNode */ && node.kind <= 310 /* LastJSDocTagNode */;
+ return node.kind >= 300 /* FirstJSDocTagNode */ && node.kind <= 311 /* LastJSDocTagNode */;
}
ts.isJSDocTag = isJSDocTag;
function isSetAccessor(node) {
- return node.kind === 159 /* SetAccessor */;
+ return node.kind === 160 /* SetAccessor */;
}
ts.isSetAccessor = isSetAccessor;
function isGetAccessor(node) {
- return node.kind === 158 /* GetAccessor */;
+ return node.kind === 159 /* GetAccessor */;
}
ts.isGetAccessor = isGetAccessor;
/** True if has jsdoc nodes attached to it. */
@@ -14901,12 +15027,12 @@
}
ts.hasOnlyExpressionInitializer = hasOnlyExpressionInitializer;
function isObjectLiteralElement(node) {
- return node.kind === 267 /* JsxAttribute */ || node.kind === 269 /* JsxSpreadAttribute */ || isObjectLiteralElementLike(node);
+ return node.kind === 268 /* JsxAttribute */ || node.kind === 270 /* JsxSpreadAttribute */ || isObjectLiteralElementLike(node);
}
ts.isObjectLiteralElement = isObjectLiteralElement;
/* @internal */
function isTypeReferenceType(node) {
- return node.kind === 164 /* TypeReference */ || node.kind === 211 /* ExpressionWithTypeArguments */;
+ return node.kind === 165 /* TypeReference */ || node.kind === 212 /* ExpressionWithTypeArguments */;
}
ts.isTypeReferenceType = isTypeReferenceType;
var MAX_SMI_X86 = 1073741823;
@@ -14942,7 +15068,7 @@
/* @internal */
(function (ts) {
function isNamedImportsOrExports(node) {
- return node.kind === 252 /* NamedImports */ || node.kind === 256 /* NamedExports */;
+ return node.kind === 253 /* NamedImports */ || node.kind === 257 /* NamedExports */;
}
ts.isNamedImportsOrExports = isNamedImportsOrExports;
function Symbol(flags, name) {
@@ -15193,6 +15319,11 @@
ts.semanticDiagnosticsOptionDeclarations.some(function (option) { return !ts.isJsonEqual(getCompilerOptionValue(oldOptions, option), getCompilerOptionValue(newOptions, option)); });
}
ts.compilerOptionsAffectSemanticDiagnostics = compilerOptionsAffectSemanticDiagnostics;
+ function compilerOptionsAffectEmit(newOptions, oldOptions) {
+ return oldOptions !== newOptions &&
+ ts.affectsEmitOptionDeclarations.some(function (option) { return !ts.isJsonEqual(getCompilerOptionValue(oldOptions, option), getCompilerOptionValue(newOptions, option)); });
+ }
+ ts.compilerOptionsAffectEmit = compilerOptionsAffectEmit;
function getCompilerOptionValue(options, option) {
return option.strictFlag ? getStrictOptionValue(options, option.name) : options[option.name];
}
@@ -15471,6 +15602,15 @@
return root + pathComponents.slice(1).join(ts.directorySeparator);
}
ts.getPathFromPathComponents = getPathFromPathComponents;
+ function getNormalizedAbsolutePathWithoutRoot(fileName, currentDirectory) {
+ return getPathWithoutRoot(getNormalizedPathComponents(fileName, currentDirectory));
+ }
+ ts.getNormalizedAbsolutePathWithoutRoot = getNormalizedAbsolutePathWithoutRoot;
+ function getPathWithoutRoot(pathComponents) {
+ if (pathComponents.length === 0)
+ return "";
+ return pathComponents.slice(1).join(ts.directorySeparator);
+ }
})(ts || (ts = {}));
/* @internal */
(function (ts) {
@@ -15501,7 +15641,7 @@
}
ts.getRelativePathFromFile = getRelativePathFromFile;
function getRelativePathFromDirectory(fromDirectory, to, getCanonicalFileNameOrIgnoreCase) {
- Debug.assert((ts.getRootLength(fromDirectory) > 0) === (ts.getRootLength(to) > 0), "Paths must either both be absolute or both be relative");
+ ts.Debug.assert((ts.getRootLength(fromDirectory) > 0) === (ts.getRootLength(to) > 0), "Paths must either both be absolute or both be relative");
var getCanonicalFileName = typeof getCanonicalFileNameOrIgnoreCase === "function" ? getCanonicalFileNameOrIgnoreCase : ts.identity;
var ignoreCase = typeof getCanonicalFileNameOrIgnoreCase === "boolean" ? getCanonicalFileNameOrIgnoreCase : false;
var pathComponents = getPathComponentsRelativeTo(fromDirectory, to, ignoreCase ? ts.equateStringsCaseInsensitive : ts.equateStringsCaseSensitive, getCanonicalFileName);
@@ -16145,32 +16285,9 @@
return pathext ? path.slice(0, path.length - pathext.length) + (ts.startsWith(ext, ".") ? ext : "." + ext) : path;
}
ts.changeAnyExtension = changeAnyExtension;
- var Debug;
- (function (Debug) {
- function showSymbol(symbol) {
- var symbolFlags = ts.SymbolFlags;
- return "{ flags: " + (symbolFlags ? showFlags(symbol.flags, symbolFlags) : symbol.flags) + "; declarations: " + ts.map(symbol.declarations, showSyntaxKind) + " }";
- }
- Debug.showSymbol = showSymbol;
- function showFlags(flags, flagsEnum) {
- var out = [];
- for (var pow = 0; pow <= 30; pow++) {
- var n = 1 << pow;
- if (flags & n) {
- out.push(flagsEnum[n]);
- }
- }
- return out.join("|");
- }
- function showSyntaxKind(node) {
- var syntaxKind = ts.SyntaxKind;
- return syntaxKind ? syntaxKind[node.kind] : node.kind.toString();
- }
- Debug.showSyntaxKind = showSyntaxKind;
- })(Debug = ts.Debug || (ts.Debug = {}));
function tryParsePattern(pattern) {
// This should be verified outside of here and a proper error thrown.
- Debug.assert(ts.hasZeroOrOneAsteriskCharacter(pattern));
+ ts.Debug.assert(ts.hasZeroOrOneAsteriskCharacter(pattern));
var indexOfStar = pattern.indexOf("*");
return indexOfStar === -1 ? undefined : {
prefix: pattern.substr(0, indexOfStar),
@@ -16199,7 +16316,7 @@
*/
function extensionFromPath(path) {
var ext = tryGetExtensionFromPath(path);
- return ext !== undefined ? ext : Debug.fail("File " + path + " has unknown extension.");
+ return ext !== undefined ? ext : ts.Debug.fail("File " + path + " has unknown extension.");
}
ts.extensionFromPath = extensionFromPath;
function isAnySupportedFileExtension(path) {
@@ -16271,7 +16388,7 @@
ts.matchPatternOrExact = matchPatternOrExact;
function sliceAfter(arr, value) {
var index = arr.indexOf(value);
- Debug.assert(index !== -1);
+ ts.Debug.assert(index !== -1);
return arr.slice(index);
}
ts.sliceAfter = sliceAfter;
@@ -16289,7 +16406,7 @@
}
ts.addRelatedInfo = addRelatedInfo;
function minAndMax(arr, getValue) {
- Debug.assert(arr.length !== 0);
+ ts.Debug.assert(arr.length !== 0);
var min = getValue(arr[0]);
var max = min;
for (var i = 1; i < arr.length; i++) {
@@ -16487,10 +16604,10 @@
var SourceFileConstructor;
// tslint:enable variable-name
function createNode(kind, pos, end) {
- if (kind === 284 /* SourceFile */) {
+ if (kind === 285 /* SourceFile */) {
return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end);
}
- else if (kind === 72 /* Identifier */) {
+ else if (kind === 73 /* Identifier */) {
return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, pos, end);
}
else if (!ts.isNodeKind(kind)) {
@@ -16539,19 +16656,19 @@
* that they appear in the source code. The language service depends on this property to locate nodes by position.
*/
function forEachChild(node, cbNode, cbNodes) {
- if (!node || node.kind <= 147 /* LastToken */) {
+ if (!node || node.kind <= 148 /* LastToken */) {
return;
}
switch (node.kind) {
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
return visitNode(cbNode, node.left) ||
visitNode(cbNode, node.right);
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.constraint) ||
visitNode(cbNode, node.default) ||
visitNode(cbNode, node.expression);
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
@@ -16559,9 +16676,9 @@
visitNode(cbNode, node.exclamationToken) ||
visitNode(cbNode, node.equalsToken) ||
visitNode(cbNode, node.objectAssignmentInitializer);
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
return visitNode(cbNode, node.expression);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.dotDotDotToken) ||
@@ -16569,7 +16686,7 @@
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.initializer);
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
@@ -16577,51 +16694,51 @@
visitNode(cbNode, node.exclamationToken) ||
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.initializer);
- case 153 /* PropertySignature */:
+ case 154 /* PropertySignature */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.initializer);
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.initializer);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.exclamationToken) ||
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.initializer);
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.dotDotDotToken) ||
visitNode(cbNode, node.propertyName) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.initializer);
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNodes(cbNode, cbNodes, node.typeParameters) ||
visitNodes(cbNode, cbNodes, node.parameters) ||
visitNode(cbNode, node.type);
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 196 /* FunctionExpression */:
- case 239 /* FunctionDeclaration */:
- case 197 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 197 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
+ case 198 /* ArrowFunction */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.asteriskToken) ||
@@ -16633,343 +16750,343 @@
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.equalsGreaterThanToken) ||
visitNode(cbNode, node.body);
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return visitNode(cbNode, node.typeName) ||
visitNodes(cbNode, cbNodes, node.typeArguments);
- case 163 /* TypePredicate */:
+ case 164 /* TypePredicate */:
return visitNode(cbNode, node.parameterName) ||
visitNode(cbNode, node.type);
- case 167 /* TypeQuery */:
+ case 168 /* TypeQuery */:
return visitNode(cbNode, node.exprName);
- case 168 /* TypeLiteral */:
+ case 169 /* TypeLiteral */:
return visitNodes(cbNode, cbNodes, node.members);
- case 169 /* ArrayType */:
+ case 170 /* ArrayType */:
return visitNode(cbNode, node.elementType);
- case 170 /* TupleType */:
+ case 171 /* TupleType */:
return visitNodes(cbNode, cbNodes, node.elementTypes);
- case 173 /* UnionType */:
- case 174 /* IntersectionType */:
+ case 174 /* UnionType */:
+ case 175 /* IntersectionType */:
return visitNodes(cbNode, cbNodes, node.types);
- case 175 /* ConditionalType */:
+ case 176 /* ConditionalType */:
return visitNode(cbNode, node.checkType) ||
visitNode(cbNode, node.extendsType) ||
visitNode(cbNode, node.trueType) ||
visitNode(cbNode, node.falseType);
- case 176 /* InferType */:
+ case 177 /* InferType */:
return visitNode(cbNode, node.typeParameter);
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return visitNode(cbNode, node.argument) ||
visitNode(cbNode, node.qualifier) ||
visitNodes(cbNode, cbNodes, node.typeArguments);
- case 177 /* ParenthesizedType */:
- case 179 /* TypeOperator */:
+ case 178 /* ParenthesizedType */:
+ case 180 /* TypeOperator */:
return visitNode(cbNode, node.type);
- case 180 /* IndexedAccessType */:
+ case 181 /* IndexedAccessType */:
return visitNode(cbNode, node.objectType) ||
visitNode(cbNode, node.indexType);
- case 181 /* MappedType */:
+ case 182 /* MappedType */:
return visitNode(cbNode, node.readonlyToken) ||
visitNode(cbNode, node.typeParameter) ||
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.type);
- case 182 /* LiteralType */:
+ case 183 /* LiteralType */:
return visitNode(cbNode, node.literal);
- case 184 /* ObjectBindingPattern */:
- case 185 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
return visitNodes(cbNode, cbNodes, node.elements);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return visitNodes(cbNode, cbNodes, node.elements);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return visitNodes(cbNode, cbNodes, node.properties);
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.name);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.argumentExpression);
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
return visitNode(cbNode, node.expression) ||
visitNodes(cbNode, cbNodes, node.typeArguments) ||
visitNodes(cbNode, cbNodes, node.arguments);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return visitNode(cbNode, node.tag) ||
visitNodes(cbNode, cbNodes, node.typeArguments) ||
visitNode(cbNode, node.template);
- case 194 /* TypeAssertionExpression */:
+ case 195 /* TypeAssertionExpression */:
return visitNode(cbNode, node.type) ||
visitNode(cbNode, node.expression);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return visitNode(cbNode, node.expression);
- case 198 /* DeleteExpression */:
+ case 199 /* DeleteExpression */:
return visitNode(cbNode, node.expression);
- case 199 /* TypeOfExpression */:
+ case 200 /* TypeOfExpression */:
return visitNode(cbNode, node.expression);
- case 200 /* VoidExpression */:
+ case 201 /* VoidExpression */:
return visitNode(cbNode, node.expression);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return visitNode(cbNode, node.operand);
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return visitNode(cbNode, node.asteriskToken) ||
visitNode(cbNode, node.expression);
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
return visitNode(cbNode, node.expression);
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return visitNode(cbNode, node.operand);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return visitNode(cbNode, node.left) ||
visitNode(cbNode, node.operatorToken) ||
visitNode(cbNode, node.right);
- case 212 /* AsExpression */:
+ case 213 /* AsExpression */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.type);
- case 213 /* NonNullExpression */:
+ case 214 /* NonNullExpression */:
return visitNode(cbNode, node.expression);
- case 214 /* MetaProperty */:
+ case 215 /* MetaProperty */:
return visitNode(cbNode, node.name);
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return visitNode(cbNode, node.condition) ||
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.whenTrue) ||
visitNode(cbNode, node.colonToken) ||
visitNode(cbNode, node.whenFalse);
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
return visitNode(cbNode, node.expression);
- case 218 /* Block */:
- case 245 /* ModuleBlock */:
+ case 219 /* Block */:
+ case 246 /* ModuleBlock */:
return visitNodes(cbNode, cbNodes, node.statements);
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return visitNodes(cbNode, cbNodes, node.statements) ||
visitNode(cbNode, node.endOfFileToken);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.declarationList);
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
return visitNodes(cbNode, cbNodes, node.declarations);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return visitNode(cbNode, node.expression);
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.thenStatement) ||
visitNode(cbNode, node.elseStatement);
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
return visitNode(cbNode, node.statement) ||
visitNode(cbNode, node.expression);
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.statement);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return visitNode(cbNode, node.initializer) ||
visitNode(cbNode, node.condition) ||
visitNode(cbNode, node.incrementor) ||
visitNode(cbNode, node.statement);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return visitNode(cbNode, node.initializer) ||
visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.statement);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return visitNode(cbNode, node.awaitModifier) ||
visitNode(cbNode, node.initializer) ||
visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.statement);
- case 228 /* ContinueStatement */:
- case 229 /* BreakStatement */:
+ case 229 /* ContinueStatement */:
+ case 230 /* BreakStatement */:
return visitNode(cbNode, node.label);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return visitNode(cbNode, node.expression);
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.statement);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.caseBlock);
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
return visitNodes(cbNode, cbNodes, node.clauses);
- case 271 /* CaseClause */:
+ case 272 /* CaseClause */:
return visitNode(cbNode, node.expression) ||
visitNodes(cbNode, cbNodes, node.statements);
- case 272 /* DefaultClause */:
+ case 273 /* DefaultClause */:
return visitNodes(cbNode, cbNodes, node.statements);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return visitNode(cbNode, node.label) ||
visitNode(cbNode, node.statement);
- case 234 /* ThrowStatement */:
+ case 235 /* ThrowStatement */:
return visitNode(cbNode, node.expression);
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
return visitNode(cbNode, node.tryBlock) ||
visitNode(cbNode, node.catchClause) ||
visitNode(cbNode, node.finallyBlock);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return visitNode(cbNode, node.variableDeclaration) ||
visitNode(cbNode, node.block);
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
return visitNode(cbNode, node.expression);
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNodes(cbNode, cbNodes, node.typeParameters) ||
visitNodes(cbNode, cbNodes, node.heritageClauses) ||
visitNodes(cbNode, cbNodes, node.members);
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNodes(cbNode, cbNodes, node.typeParameters) ||
visitNodes(cbNode, cbNodes, node.heritageClauses) ||
visitNodes(cbNode, cbNodes, node.members);
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNodes(cbNode, cbNodes, node.typeParameters) ||
visitNode(cbNode, node.type);
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNodes(cbNode, cbNodes, node.members);
- case 278 /* EnumMember */:
+ case 279 /* EnumMember */:
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.initializer);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.body);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.moduleReference);
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.importClause) ||
visitNode(cbNode, node.moduleSpecifier);
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.namedBindings);
- case 247 /* NamespaceExportDeclaration */:
+ case 248 /* NamespaceExportDeclaration */:
return visitNode(cbNode, node.name);
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
return visitNode(cbNode, node.name);
- case 252 /* NamedImports */:
- case 256 /* NamedExports */:
+ case 253 /* NamedImports */:
+ case 257 /* NamedExports */:
return visitNodes(cbNode, cbNodes, node.elements);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.exportClause) ||
visitNode(cbNode, node.moduleSpecifier);
- case 253 /* ImportSpecifier */:
- case 257 /* ExportSpecifier */:
+ case 254 /* ImportSpecifier */:
+ case 258 /* ExportSpecifier */:
return visitNode(cbNode, node.propertyName) ||
visitNode(cbNode, node.name);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.expression);
- case 206 /* TemplateExpression */:
+ case 207 /* TemplateExpression */:
return visitNode(cbNode, node.head) || visitNodes(cbNode, cbNodes, node.templateSpans);
- case 216 /* TemplateSpan */:
+ case 217 /* TemplateSpan */:
return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal);
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
return visitNode(cbNode, node.expression);
- case 273 /* HeritageClause */:
+ case 274 /* HeritageClause */:
return visitNodes(cbNode, cbNodes, node.types);
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return visitNode(cbNode, node.expression) ||
visitNodes(cbNode, cbNodes, node.typeArguments);
- case 259 /* ExternalModuleReference */:
+ case 260 /* ExternalModuleReference */:
return visitNode(cbNode, node.expression);
- case 258 /* MissingDeclaration */:
+ case 259 /* MissingDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators);
- case 314 /* CommaListExpression */:
+ case 315 /* CommaListExpression */:
return visitNodes(cbNode, cbNodes, node.elements);
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
return visitNode(cbNode, node.openingElement) ||
visitNodes(cbNode, cbNodes, node.children) ||
visitNode(cbNode, node.closingElement);
- case 264 /* JsxFragment */:
+ case 265 /* JsxFragment */:
return visitNode(cbNode, node.openingFragment) ||
visitNodes(cbNode, cbNodes, node.children) ||
visitNode(cbNode, node.closingFragment);
- case 261 /* JsxSelfClosingElement */:
- case 262 /* JsxOpeningElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
return visitNode(cbNode, node.tagName) ||
visitNodes(cbNode, cbNodes, node.typeArguments) ||
visitNode(cbNode, node.attributes);
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
return visitNodes(cbNode, cbNodes, node.properties);
- case 267 /* JsxAttribute */:
+ case 268 /* JsxAttribute */:
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.initializer);
- case 269 /* JsxSpreadAttribute */:
+ case 270 /* JsxSpreadAttribute */:
return visitNode(cbNode, node.expression);
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return visitNode(cbNode, node.dotDotDotToken) ||
visitNode(cbNode, node.expression);
- case 263 /* JsxClosingElement */:
+ case 264 /* JsxClosingElement */:
return visitNode(cbNode, node.tagName);
- case 171 /* OptionalType */:
- case 172 /* RestType */:
- case 288 /* JSDocTypeExpression */:
- case 292 /* JSDocNonNullableType */:
- case 291 /* JSDocNullableType */:
- case 293 /* JSDocOptionalType */:
- case 295 /* JSDocVariadicType */:
+ case 172 /* OptionalType */:
+ case 173 /* RestType */:
+ case 289 /* JSDocTypeExpression */:
+ case 293 /* JSDocNonNullableType */:
+ case 292 /* JSDocNullableType */:
+ case 294 /* JSDocOptionalType */:
+ case 296 /* JSDocVariadicType */:
return visitNode(cbNode, node.type);
- case 294 /* JSDocFunctionType */:
+ case 295 /* JSDocFunctionType */:
return visitNodes(cbNode, cbNodes, node.parameters) ||
visitNode(cbNode, node.type);
- case 296 /* JSDocComment */:
+ case 297 /* JSDocComment */:
return visitNodes(cbNode, cbNodes, node.tags);
- case 304 /* JSDocParameterTag */:
- case 310 /* JSDocPropertyTag */:
+ case 305 /* JSDocParameterTag */:
+ case 311 /* JSDocPropertyTag */:
return visitNode(cbNode, node.tagName) ||
(node.isNameFirst
? visitNode(cbNode, node.name) ||
visitNode(cbNode, node.typeExpression)
: visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.name));
- case 300 /* JSDocAugmentsTag */:
+ case 301 /* JSDocAugmentsTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.class);
- case 308 /* JSDocTemplateTag */:
+ case 309 /* JSDocTemplateTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.constraint) ||
visitNodes(cbNode, cbNodes, node.typeParameters);
- case 309 /* JSDocTypedefTag */:
+ case 310 /* JSDocTypedefTag */:
return visitNode(cbNode, node.tagName) ||
(node.typeExpression &&
- node.typeExpression.kind === 288 /* JSDocTypeExpression */
+ node.typeExpression.kind === 289 /* JSDocTypeExpression */
? visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.fullName)
: visitNode(cbNode, node.fullName) ||
visitNode(cbNode, node.typeExpression));
- case 302 /* JSDocCallbackTag */:
+ case 303 /* JSDocCallbackTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.fullName) ||
visitNode(cbNode, node.typeExpression);
- case 305 /* JSDocReturnTag */:
- case 307 /* JSDocTypeTag */:
- case 306 /* JSDocThisTag */:
- case 303 /* JSDocEnumTag */:
+ case 306 /* JSDocReturnTag */:
+ case 308 /* JSDocTypeTag */:
+ case 307 /* JSDocThisTag */:
+ case 304 /* JSDocEnumTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.typeExpression);
- case 298 /* JSDocSignature */:
+ case 299 /* JSDocSignature */:
return ts.forEach(node.typeParameters, cbNode) ||
ts.forEach(node.parameters, cbNode) ||
visitNode(cbNode, node.type);
- case 297 /* JSDocTypeLiteral */:
+ case 298 /* JSDocTypeLiteral */:
return ts.forEach(node.jsDocPropertyTags, cbNode);
- case 299 /* JSDocTag */:
- case 301 /* JSDocClassTag */:
+ case 300 /* JSDocTag */:
+ case 302 /* JSDocClassTag */:
return visitNode(cbNode, node.tagName);
- case 313 /* PartiallyEmittedExpression */:
+ case 314 /* PartiallyEmittedExpression */:
return visitNode(cbNode, node.expression);
}
}
@@ -17049,7 +17166,7 @@
(function (Parser) {
// Share a single scanner across all calls to parse a source file. This helps speed things
// up by avoiding the cost of creating/compiling scanners over and over again.
- var scanner = ts.createScanner(7 /* Latest */, /*skipTrivia*/ true);
+ var scanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ true);
var disallowInAndDecoratorContext = 2048 /* DisallowInContext */ | 8192 /* DecoratorContext */;
// capture constructors in 'initializeState' to avoid null checks
// tslint:disable variable-name
@@ -17187,14 +17304,14 @@
sourceFile.endOfFileToken = parseTokenNode();
}
else {
- var statement = createNode(221 /* ExpressionStatement */);
+ var statement = createNode(222 /* ExpressionStatement */);
switch (token()) {
case 22 /* OpenBracketToken */:
statement.expression = parseArrayLiteralExpression();
break;
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
- case 96 /* NullKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
+ case 97 /* NullKeyword */:
statement.expression = parseTokenNode();
break;
case 39 /* MinusToken */:
@@ -17343,7 +17460,7 @@
function createSourceFile(fileName, languageVersion, scriptKind, isDeclarationFile) {
// code from createNode is inlined here so createNode won't have to deal with special case of creating source files
// this is quite rare comparing to other nodes and createNode should be as fast as possible
- var sourceFile = new SourceFileConstructor(284 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length);
+ var sourceFile = new SourceFileConstructor(285 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length);
nodeCount++;
sourceFile.text = sourceText;
sourceFile.bindDiagnostics = [];
@@ -17486,6 +17603,9 @@
function nextToken() {
return currentToken = scanner.scan();
}
+ function nextTokenJSDoc() {
+ return currentToken = scanner.scanJsDocToken();
+ }
function reScanGreaterToken() {
return currentToken = scanner.reScanGreaterToken();
}
@@ -17551,20 +17671,20 @@
}
// Ignore strict mode flag because we will report an error in type checker instead.
function isIdentifier() {
- if (token() === 72 /* Identifier */) {
+ if (token() === 73 /* Identifier */) {
return true;
}
// If we have a 'yield' keyword, and we're in the [yield] context, then 'yield' is
// considered a keyword and is not an identifier.
- if (token() === 117 /* YieldKeyword */ && inYieldContext()) {
+ if (token() === 118 /* YieldKeyword */ && inYieldContext()) {
return false;
}
// If we have a 'await' keyword, and we're in the [Await] context, then 'await' is
// considered a keyword and is not an identifier.
- if (token() === 122 /* AwaitKeyword */ && inAwaitContext()) {
+ if (token() === 123 /* AwaitKeyword */ && inAwaitContext()) {
return false;
}
- return token() > 108 /* LastReservedWord */;
+ return token() > 109 /* LastReservedWord */;
}
function parseExpected(kind, diagnosticMessage, shouldAdvance) {
if (shouldAdvance === void 0) { shouldAdvance = true; }
@@ -17583,6 +17703,14 @@
}
return false;
}
+ function parseExpectedJSDoc(kind) {
+ if (token() === kind) {
+ nextTokenJSDoc();
+ return true;
+ }
+ parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind));
+ return false;
+ }
function parseOptional(t) {
if (token() === t) {
nextToken();
@@ -17596,15 +17724,30 @@
}
return undefined;
}
+ function parseOptionalTokenJSDoc(t) {
+ if (token() === t) {
+ return parseTokenNodeJSDoc();
+ }
+ return undefined;
+ }
function parseExpectedToken(t, diagnosticMessage, arg0) {
return parseOptionalToken(t) ||
createMissingNode(t, /*reportAtCurrentPosition*/ false, diagnosticMessage || ts.Diagnostics._0_expected, arg0 || ts.tokenToString(t));
}
+ function parseExpectedTokenJSDoc(t) {
+ return parseOptionalTokenJSDoc(t) ||
+ createMissingNode(t, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(t));
+ }
function parseTokenNode() {
var node = createNode(token());
nextToken();
return finishNode(node);
}
+ function parseTokenNodeJSDoc() {
+ var node = createNode(token());
+ nextTokenJSDoc();
+ return finishNode(node);
+ }
function canParseSemicolon() {
// If there's a real semicolon, then we can always parse it out.
if (token() === 26 /* SemicolonToken */) {
@@ -17629,7 +17772,7 @@
nodeCount++;
var p = pos >= 0 ? pos : scanner.getStartPos();
return ts.isNodeKind(kind) || kind === 0 /* Unknown */ ? new NodeConstructor(kind, p, p) :
- kind === 72 /* Identifier */ ? new IdentifierConstructor(kind, p, p) :
+ kind === 73 /* Identifier */ ? new IdentifierConstructor(kind, p, p) :
new TokenConstructor(kind, p, p);
}
function createNodeWithJSDoc(kind, pos) {
@@ -17671,7 +17814,7 @@
parseErrorAtCurrentToken(diagnosticMessage, arg0);
}
var result = createNode(kind);
- if (kind === 72 /* Identifier */) {
+ if (kind === 73 /* Identifier */) {
result.escapedText = "";
}
else if (ts.isLiteralKind(kind) || ts.isTemplateLiteralKind(kind)) {
@@ -17692,9 +17835,9 @@
function createIdentifier(isIdentifier, diagnosticMessage) {
identifierCount++;
if (isIdentifier) {
- var node = createNode(72 /* Identifier */);
+ var node = createNode(73 /* Identifier */);
// Store original token kind if it is not just an Identifier so we can report appropriate error later in type checker
- if (token() !== 72 /* Identifier */) {
+ if (token() !== 73 /* Identifier */) {
node.originalKeywordKind = token();
}
node.escapedText = ts.escapeLeadingUnderscores(internIdentifier(scanner.getTokenValue()));
@@ -17703,7 +17846,7 @@
}
// Only for end of file because the error gets reported incorrectly on embedded script tags.
var reportAtCurrentPosition = token() === 1 /* EndOfFileToken */;
- return createMissingNode(72 /* Identifier */, reportAtCurrentPosition, diagnosticMessage || ts.Diagnostics.Identifier_expected);
+ return createMissingNode(73 /* Identifier */, reportAtCurrentPosition, diagnosticMessage || ts.Diagnostics.Identifier_expected);
}
function parseIdentifier(diagnosticMessage) {
return createIdentifier(isIdentifier(), diagnosticMessage);
@@ -17734,7 +17877,7 @@
// PropertyName [Yield]:
// LiteralPropertyName
// ComputedPropertyName[?Yield]
- var node = createNode(149 /* ComputedPropertyName */);
+ var node = createNode(150 /* ComputedPropertyName */);
parseExpected(22 /* OpenBracketToken */);
// We parse any expression (including a comma expression). But the grammar
// says that only an assignment expression is allowed, so the grammar checker
@@ -17755,20 +17898,20 @@
}
function nextTokenCanFollowModifier() {
switch (token()) {
- case 77 /* ConstKeyword */:
+ case 78 /* ConstKeyword */:
// 'const' is only a modifier if followed by 'enum'.
- return nextToken() === 84 /* EnumKeyword */;
- case 85 /* ExportKeyword */:
+ return nextToken() === 85 /* EnumKeyword */;
+ case 86 /* ExportKeyword */:
nextToken();
- if (token() === 80 /* DefaultKeyword */) {
+ if (token() === 81 /* DefaultKeyword */) {
return lookAhead(nextTokenCanFollowDefaultKeyword);
}
- return token() !== 40 /* AsteriskToken */ && token() !== 119 /* AsKeyword */ && token() !== 18 /* OpenBraceToken */ && canFollowModifier();
- case 80 /* DefaultKeyword */:
+ return token() !== 40 /* AsteriskToken */ && token() !== 120 /* AsKeyword */ && token() !== 18 /* OpenBraceToken */ && canFollowModifier();
+ case 81 /* DefaultKeyword */:
return nextTokenCanFollowDefaultKeyword();
- case 116 /* StaticKeyword */:
- case 126 /* GetKeyword */:
- case 137 /* SetKeyword */:
+ case 117 /* StaticKeyword */:
+ case 127 /* GetKeyword */:
+ case 138 /* SetKeyword */:
nextToken();
return canFollowModifier();
default:
@@ -17787,10 +17930,10 @@
}
function nextTokenCanFollowDefaultKeyword() {
nextToken();
- return token() === 76 /* ClassKeyword */ || token() === 90 /* FunctionKeyword */ ||
- token() === 110 /* InterfaceKeyword */ ||
- (token() === 118 /* AbstractKeyword */ && lookAhead(nextTokenIsClassKeywordOnSameLine)) ||
- (token() === 121 /* AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine));
+ return token() === 77 /* ClassKeyword */ || token() === 91 /* FunctionKeyword */ ||
+ token() === 111 /* InterfaceKeyword */ ||
+ (token() === 119 /* AbstractKeyword */ && lookAhead(nextTokenIsClassKeywordOnSameLine)) ||
+ (token() === 122 /* AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine));
}
// True if positioned at the start of a list element
function isListElement(parsingContext, inErrorRecovery) {
@@ -17810,7 +17953,7 @@
// outer module. We just want to consume and move on.
return !(token() === 26 /* SemicolonToken */ && inErrorRecovery) && isStartOfStatement();
case 2 /* SwitchClauses */:
- return token() === 74 /* CaseKeyword */ || token() === 80 /* DefaultKeyword */;
+ return token() === 75 /* CaseKeyword */ || token() === 81 /* DefaultKeyword */;
case 4 /* TypeMembers */:
return lookAhead(isTypeMemberStart);
case 5 /* ClassMembers */:
@@ -17896,7 +18039,7 @@
// extends {} extends
// extends {} implements
var next = nextToken();
- return next === 27 /* CommaToken */ || next === 18 /* OpenBraceToken */ || next === 86 /* ExtendsKeyword */ || next === 109 /* ImplementsKeyword */;
+ return next === 27 /* CommaToken */ || next === 18 /* OpenBraceToken */ || next === 87 /* ExtendsKeyword */ || next === 110 /* ImplementsKeyword */;
}
return true;
}
@@ -17913,8 +18056,8 @@
return ts.tokenIsIdentifierOrKeywordOrGreaterThan(token());
}
function isHeritageClauseExtendsOrImplementsKeyword() {
- if (token() === 109 /* ImplementsKeyword */ ||
- token() === 86 /* ExtendsKeyword */) {
+ if (token() === 110 /* ImplementsKeyword */ ||
+ token() === 87 /* ExtendsKeyword */) {
return lookAhead(nextTokenIsStartOfExpression);
}
return false;
@@ -17944,14 +18087,14 @@
case 23 /* ImportOrExportSpecifiers */:
return token() === 19 /* CloseBraceToken */;
case 3 /* SwitchClauseStatements */:
- return token() === 19 /* CloseBraceToken */ || token() === 74 /* CaseKeyword */ || token() === 80 /* DefaultKeyword */;
+ return token() === 19 /* CloseBraceToken */ || token() === 75 /* CaseKeyword */ || token() === 81 /* DefaultKeyword */;
case 7 /* HeritageClauseElement */:
- return token() === 18 /* OpenBraceToken */ || token() === 86 /* ExtendsKeyword */ || token() === 109 /* ImplementsKeyword */;
+ return token() === 18 /* OpenBraceToken */ || token() === 87 /* ExtendsKeyword */ || token() === 110 /* ImplementsKeyword */;
case 8 /* VariableDeclarations */:
return isVariableDeclaratorListTerminator();
case 19 /* TypeParameters */:
// Tokens other than '>' are here for better error recovery
- return token() === 30 /* GreaterThanToken */ || token() === 20 /* OpenParenToken */ || token() === 18 /* OpenBraceToken */ || token() === 86 /* ExtendsKeyword */ || token() === 109 /* ImplementsKeyword */;
+ return token() === 30 /* GreaterThanToken */ || token() === 20 /* OpenParenToken */ || token() === 18 /* OpenBraceToken */ || token() === 87 /* ExtendsKeyword */ || token() === 110 /* ImplementsKeyword */;
case 11 /* ArgumentExpressions */:
// Tokens other than ')' are here for better error recovery
return token() === 21 /* CloseParenToken */ || token() === 26 /* SemicolonToken */;
@@ -18168,20 +18311,20 @@
function isReusableClassMember(node) {
if (node) {
switch (node.kind) {
- case 157 /* Constructor */:
- case 162 /* IndexSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 154 /* PropertyDeclaration */:
- case 217 /* SemicolonClassElement */:
+ case 158 /* Constructor */:
+ case 163 /* IndexSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 155 /* PropertyDeclaration */:
+ case 218 /* SemicolonClassElement */:
return true;
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
// Method declarations are not necessarily reusable. An object-literal
// may have a method calls "constructor(...)" and we must reparse that
// into an actual .ConstructorDeclaration.
var methodDeclaration = node;
- var nameIsConstructor = methodDeclaration.name.kind === 72 /* Identifier */ &&
- methodDeclaration.name.originalKeywordKind === 124 /* ConstructorKeyword */;
+ var nameIsConstructor = methodDeclaration.name.kind === 73 /* Identifier */ &&
+ methodDeclaration.name.originalKeywordKind === 125 /* ConstructorKeyword */;
return !nameIsConstructor;
}
}
@@ -18190,8 +18333,8 @@
function isReusableSwitchClause(node) {
if (node) {
switch (node.kind) {
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
return true;
}
}
@@ -18200,58 +18343,58 @@
function isReusableStatement(node) {
if (node) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 219 /* VariableStatement */:
- case 218 /* Block */:
- case 222 /* IfStatement */:
- case 221 /* ExpressionStatement */:
- case 234 /* ThrowStatement */:
- case 230 /* ReturnStatement */:
- case 232 /* SwitchStatement */:
- case 229 /* BreakStatement */:
- case 228 /* ContinueStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 225 /* ForStatement */:
- case 224 /* WhileStatement */:
- case 231 /* WithStatement */:
- case 220 /* EmptyStatement */:
- case 235 /* TryStatement */:
- case 233 /* LabeledStatement */:
- case 223 /* DoStatement */:
- case 236 /* DebuggerStatement */:
- case 249 /* ImportDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
- case 255 /* ExportDeclaration */:
- case 254 /* ExportAssignment */:
- case 244 /* ModuleDeclaration */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
- case 242 /* TypeAliasDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 220 /* VariableStatement */:
+ case 219 /* Block */:
+ case 223 /* IfStatement */:
+ case 222 /* ExpressionStatement */:
+ case 235 /* ThrowStatement */:
+ case 231 /* ReturnStatement */:
+ case 233 /* SwitchStatement */:
+ case 230 /* BreakStatement */:
+ case 229 /* ContinueStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 226 /* ForStatement */:
+ case 225 /* WhileStatement */:
+ case 232 /* WithStatement */:
+ case 221 /* EmptyStatement */:
+ case 236 /* TryStatement */:
+ case 234 /* LabeledStatement */:
+ case 224 /* DoStatement */:
+ case 237 /* DebuggerStatement */:
+ case 250 /* ImportDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 256 /* ExportDeclaration */:
+ case 255 /* ExportAssignment */:
+ case 245 /* ModuleDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return true;
}
}
return false;
}
function isReusableEnumMember(node) {
- return node.kind === 278 /* EnumMember */;
+ return node.kind === 279 /* EnumMember */;
}
function isReusableTypeMember(node) {
if (node) {
switch (node.kind) {
- case 161 /* ConstructSignature */:
- case 155 /* MethodSignature */:
- case 162 /* IndexSignature */:
- case 153 /* PropertySignature */:
- case 160 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 156 /* MethodSignature */:
+ case 163 /* IndexSignature */:
+ case 154 /* PropertySignature */:
+ case 161 /* CallSignature */:
return true;
}
}
return false;
}
function isReusableVariableDeclaration(node) {
- if (node.kind !== 237 /* VariableDeclaration */) {
+ if (node.kind !== 238 /* VariableDeclaration */) {
return false;
}
// Very subtle incremental parsing bug. Consider the following code:
@@ -18272,7 +18415,7 @@
return variableDeclarator.initializer === undefined;
}
function isReusableParameter(node) {
- if (node.kind !== 151 /* Parameter */) {
+ if (node.kind !== 152 /* Parameter */) {
return false;
}
// See the comment in isReusableVariableDeclaration for why we do this.
@@ -18408,7 +18551,7 @@
return entity;
}
function createQualifiedName(entity, name) {
- var node = createNode(148 /* QualifiedName */, entity.pos);
+ var node = createNode(149 /* QualifiedName */, entity.pos);
node.left = entity;
node.right = name;
return finishNode(node);
@@ -18439,13 +18582,13 @@
// Report that we need an identifier. However, report it right after the dot,
// and not on the next token. This is because the next token might actually
// be an identifier and the error would be quite confusing.
- return createMissingNode(72 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Identifier_expected);
+ return createMissingNode(73 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Identifier_expected);
}
}
return allowIdentifierNames ? parseIdentifierName() : parseIdentifier();
}
function parseTemplateExpression() {
- var template = createNode(206 /* TemplateExpression */);
+ var template = createNode(207 /* TemplateExpression */);
template.head = parseTemplateHead();
ts.Debug.assert(template.head.kind === 15 /* TemplateHead */, "Template head has wrong token kind");
var list = [];
@@ -18457,7 +18600,7 @@
return finishNode(template);
}
function parseTemplateSpan() {
- var span = createNode(216 /* TemplateSpan */);
+ var span = createNode(217 /* TemplateSpan */);
span.expression = allowInAnd(parseExpression);
var literal;
if (token() === 19 /* CloseBraceToken */) {
@@ -18507,7 +18650,7 @@
}
// TYPES
function parseTypeReference() {
- var node = createNode(164 /* TypeReference */);
+ var node = createNode(165 /* TypeReference */);
node.typeName = parseEntityName(/*allowReservedWords*/ true, ts.Diagnostics.Type_expected);
if (!scanner.hasPrecedingLineBreak() && reScanLessThanToken() === 28 /* LessThanToken */) {
node.typeArguments = parseBracketedList(20 /* TypeArguments */, parseType, 28 /* LessThanToken */, 30 /* GreaterThanToken */);
@@ -18517,14 +18660,14 @@
// If true, we should abort parsing an error function.
function typeHasArrowFunctionBlockingParseError(node) {
switch (node.kind) {
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return ts.nodeIsMissing(node.typeName);
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */: {
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */: {
var _a = node, parameters = _a.parameters, type = _a.type;
return isMissingList(parameters) || typeHasArrowFunctionBlockingParseError(type);
}
- case 177 /* ParenthesizedType */:
+ case 178 /* ParenthesizedType */:
return typeHasArrowFunctionBlockingParseError(node.type);
default:
return false;
@@ -18532,20 +18675,20 @@
}
function parseThisTypePredicate(lhs) {
nextToken();
- var node = createNode(163 /* TypePredicate */, lhs.pos);
+ var node = createNode(164 /* TypePredicate */, lhs.pos);
node.parameterName = lhs;
node.type = parseType();
return finishNode(node);
}
function parseThisTypeNode() {
- var node = createNode(178 /* ThisType */);
+ var node = createNode(179 /* ThisType */);
nextToken();
return finishNode(node);
}
function parseJSDocAllType(postFixEquals) {
- var result = createNode(289 /* JSDocAllType */);
+ var result = createNode(290 /* JSDocAllType */);
if (postFixEquals) {
- return createPostfixType(293 /* JSDocOptionalType */, result);
+ return createPostfixType(294 /* JSDocOptionalType */, result);
}
else {
nextToken();
@@ -18553,7 +18696,7 @@
return finishNode(result);
}
function parseJSDocNonNullableType() {
- var result = createNode(292 /* JSDocNonNullableType */);
+ var result = createNode(293 /* JSDocNonNullableType */);
nextToken();
result.type = parseNonArrayType();
return finishNode(result);
@@ -18575,31 +18718,31 @@
token() === 19 /* CloseBraceToken */ ||
token() === 21 /* CloseParenToken */ ||
token() === 30 /* GreaterThanToken */ ||
- token() === 59 /* EqualsToken */ ||
+ token() === 60 /* EqualsToken */ ||
token() === 50 /* BarToken */) {
- var result = createNode(290 /* JSDocUnknownType */, pos);
+ var result = createNode(291 /* JSDocUnknownType */, pos);
return finishNode(result);
}
else {
- var result = createNode(291 /* JSDocNullableType */, pos);
+ var result = createNode(292 /* JSDocNullableType */, pos);
result.type = parseType();
return finishNode(result);
}
}
function parseJSDocFunctionType() {
if (lookAhead(nextTokenIsOpenParen)) {
- var result = createNodeWithJSDoc(294 /* JSDocFunctionType */);
+ var result = createNodeWithJSDoc(295 /* JSDocFunctionType */);
nextToken();
fillSignature(57 /* ColonToken */, 4 /* Type */ | 32 /* JSDoc */, result);
return finishNode(result);
}
- var node = createNode(164 /* TypeReference */);
+ var node = createNode(165 /* TypeReference */);
node.typeName = parseIdentifierName();
return finishNode(node);
}
function parseJSDocParameter() {
- var parameter = createNode(151 /* Parameter */);
- if (token() === 100 /* ThisKeyword */ || token() === 95 /* NewKeyword */) {
+ var parameter = createNode(152 /* Parameter */);
+ if (token() === 101 /* ThisKeyword */ || token() === 96 /* NewKeyword */) {
parameter.name = parseIdentifierName();
parseExpected(57 /* ColonToken */);
}
@@ -18612,25 +18755,25 @@
var type = parseTypeOrTypePredicate();
scanner.setInJSDocType(false);
if (dotdotdot) {
- var variadic = createNode(295 /* JSDocVariadicType */, dotdotdot.pos);
+ var variadic = createNode(296 /* JSDocVariadicType */, dotdotdot.pos);
variadic.type = type;
type = finishNode(variadic);
}
- if (token() === 59 /* EqualsToken */) {
- return createPostfixType(293 /* JSDocOptionalType */, type);
+ if (token() === 60 /* EqualsToken */) {
+ return createPostfixType(294 /* JSDocOptionalType */, type);
}
return type;
}
function parseTypeQuery() {
- var node = createNode(167 /* TypeQuery */);
- parseExpected(104 /* TypeOfKeyword */);
+ var node = createNode(168 /* TypeQuery */);
+ parseExpected(105 /* TypeOfKeyword */);
node.exprName = parseEntityName(/*allowReservedWords*/ true);
return finishNode(node);
}
function parseTypeParameter() {
- var node = createNode(150 /* TypeParameter */);
+ var node = createNode(151 /* TypeParameter */);
node.name = parseIdentifier();
- if (parseOptional(86 /* ExtendsKeyword */)) {
+ if (parseOptional(87 /* ExtendsKeyword */)) {
// It's not uncommon for people to write improper constraints to a generic. If the
// user writes a constraint that is an expression and not an actual type, then parse
// it out as an expression (so we can recover well), but report that a type is needed
@@ -18649,7 +18792,7 @@
node.expression = parseUnaryExpressionOrHigher();
}
}
- if (parseOptional(59 /* EqualsToken */)) {
+ if (parseOptional(60 /* EqualsToken */)) {
node.default = parseType();
}
return finishNode(node);
@@ -18673,8 +18816,8 @@
isStartOfType(/*inStartOfParameter*/ !isJSDocParameter);
}
function parseParameter() {
- var node = createNodeWithJSDoc(151 /* Parameter */);
- if (token() === 100 /* ThisKeyword */) {
+ var node = createNodeWithJSDoc(152 /* Parameter */);
+ if (token() === 101 /* ThisKeyword */) {
node.name = createIdentifier(/*isIdentifier*/ true);
node.type = parseParameterType();
return finishNode(node);
@@ -18774,8 +18917,8 @@
}
function parseSignatureMember(kind) {
var node = createNodeWithJSDoc(kind);
- if (kind === 161 /* ConstructSignature */) {
- parseExpected(95 /* NewKeyword */);
+ if (kind === 162 /* ConstructSignature */) {
+ parseExpected(96 /* NewKeyword */);
}
fillSignature(57 /* ColonToken */, 4 /* Type */, node);
parseTypeMemberSemicolon();
@@ -18835,7 +18978,7 @@
return token() === 57 /* ColonToken */ || token() === 27 /* CommaToken */ || token() === 23 /* CloseBracketToken */;
}
function parseIndexSignatureDeclaration(node) {
- node.kind = 162 /* IndexSignature */;
+ node.kind = 163 /* IndexSignature */;
node.parameters = parseBracketedList(16 /* Parameters */, parseParameter, 22 /* OpenBracketToken */, 23 /* CloseBracketToken */);
node.type = parseTypeAnnotation();
parseTypeMemberSemicolon();
@@ -18845,15 +18988,15 @@
node.name = parsePropertyName();
node.questionToken = parseOptionalToken(56 /* QuestionToken */);
if (token() === 20 /* OpenParenToken */ || token() === 28 /* LessThanToken */) {
- node.kind = 155 /* MethodSignature */;
+ node.kind = 156 /* MethodSignature */;
// Method signatures don't exist in expression contexts. So they have neither
// [Yield] nor [Await]
fillSignature(57 /* ColonToken */, 4 /* Type */, node);
}
else {
- node.kind = 153 /* PropertySignature */;
+ node.kind = 154 /* PropertySignature */;
node.type = parseTypeAnnotation();
- if (token() === 59 /* EqualsToken */) {
+ if (token() === 60 /* EqualsToken */) {
// Although type literal properties cannot not have initializers, we attempt
// to parse an initializer so we can report in the checker that an interface
// property or type literal property cannot have an initializer.
@@ -18897,10 +19040,10 @@
}
function parseTypeMember() {
if (token() === 20 /* OpenParenToken */ || token() === 28 /* LessThanToken */) {
- return parseSignatureMember(160 /* CallSignature */);
+ return parseSignatureMember(161 /* CallSignature */);
}
- if (token() === 95 /* NewKeyword */ && lookAhead(nextTokenIsOpenParenOrLessThan)) {
- return parseSignatureMember(161 /* ConstructSignature */);
+ if (token() === 96 /* NewKeyword */ && lookAhead(nextTokenIsOpenParenOrLessThan)) {
+ return parseSignatureMember(162 /* ConstructSignature */);
}
var node = createNodeWithJSDoc(0 /* Unknown */);
node.modifiers = parseModifiers();
@@ -18926,7 +19069,7 @@
return false;
}
function parseTypeLiteral() {
- var node = createNode(168 /* TypeLiteral */);
+ var node = createNode(169 /* TypeLiteral */);
node.members = parseObjectTypeMembers();
return finishNode(node);
}
@@ -18944,27 +19087,27 @@
function isStartOfMappedType() {
nextToken();
if (token() === 38 /* PlusToken */ || token() === 39 /* MinusToken */) {
- return nextToken() === 133 /* ReadonlyKeyword */;
+ return nextToken() === 134 /* ReadonlyKeyword */;
}
- if (token() === 133 /* ReadonlyKeyword */) {
+ if (token() === 134 /* ReadonlyKeyword */) {
nextToken();
}
- return token() === 22 /* OpenBracketToken */ && nextTokenIsIdentifier() && nextToken() === 93 /* InKeyword */;
+ return token() === 22 /* OpenBracketToken */ && nextTokenIsIdentifier() && nextToken() === 94 /* InKeyword */;
}
function parseMappedTypeParameter() {
- var node = createNode(150 /* TypeParameter */);
+ var node = createNode(151 /* TypeParameter */);
node.name = parseIdentifier();
- parseExpected(93 /* InKeyword */);
+ parseExpected(94 /* InKeyword */);
node.constraint = parseType();
return finishNode(node);
}
function parseMappedType() {
- var node = createNode(181 /* MappedType */);
+ var node = createNode(182 /* MappedType */);
parseExpected(18 /* OpenBraceToken */);
- if (token() === 133 /* ReadonlyKeyword */ || token() === 38 /* PlusToken */ || token() === 39 /* MinusToken */) {
+ if (token() === 134 /* ReadonlyKeyword */ || token() === 38 /* PlusToken */ || token() === 39 /* MinusToken */) {
node.readonlyToken = parseTokenNode();
- if (node.readonlyToken.kind !== 133 /* ReadonlyKeyword */) {
- parseExpectedToken(133 /* ReadonlyKeyword */);
+ if (node.readonlyToken.kind !== 134 /* ReadonlyKeyword */) {
+ parseExpectedToken(134 /* ReadonlyKeyword */);
}
}
parseExpected(22 /* OpenBracketToken */);
@@ -18984,23 +19127,23 @@
function parseTupleElementType() {
var pos = getNodePos();
if (parseOptional(25 /* DotDotDotToken */)) {
- var node = createNode(172 /* RestType */, pos);
+ var node = createNode(173 /* RestType */, pos);
node.type = parseType();
return finishNode(node);
}
var type = parseType();
- if (!(contextFlags & 2097152 /* JSDoc */) && type.kind === 291 /* JSDocNullableType */ && type.pos === type.type.pos) {
- type.kind = 171 /* OptionalType */;
+ if (!(contextFlags & 2097152 /* JSDoc */) && type.kind === 292 /* JSDocNullableType */ && type.pos === type.type.pos) {
+ type.kind = 172 /* OptionalType */;
}
return type;
}
function parseTupleType() {
- var node = createNode(170 /* TupleType */);
+ var node = createNode(171 /* TupleType */);
node.elementTypes = parseBracketedList(21 /* TupleElementTypes */, parseTupleElementType, 22 /* OpenBracketToken */, 23 /* CloseBracketToken */);
return finishNode(node);
}
function parseParenthesizedType() {
- var node = createNode(177 /* ParenthesizedType */);
+ var node = createNode(178 /* ParenthesizedType */);
parseExpected(20 /* OpenParenToken */);
node.type = parseType();
parseExpected(21 /* CloseParenToken */);
@@ -19008,7 +19151,7 @@
}
function parseFunctionOrConstructorType() {
var pos = getNodePos();
- var kind = parseOptional(95 /* NewKeyword */) ? 166 /* ConstructorType */ : 165 /* FunctionType */;
+ var kind = parseOptional(96 /* NewKeyword */) ? 167 /* ConstructorType */ : 166 /* FunctionType */;
var node = createNodeWithJSDoc(kind, pos);
fillSignature(37 /* EqualsGreaterThanToken */, 4 /* Type */, node);
return finishNode(node);
@@ -19018,14 +19161,14 @@
return token() === 24 /* DotToken */ ? undefined : node;
}
function parseLiteralTypeNode(negative) {
- var node = createNode(182 /* LiteralType */);
+ var node = createNode(183 /* LiteralType */);
var unaryMinusExpression;
if (negative) {
- unaryMinusExpression = createNode(202 /* PrefixUnaryExpression */);
+ unaryMinusExpression = createNode(203 /* PrefixUnaryExpression */);
unaryMinusExpression.operator = 39 /* MinusToken */;
nextToken();
}
- var expression = token() === 102 /* TrueKeyword */ || token() === 87 /* FalseKeyword */
+ var expression = token() === 103 /* TrueKeyword */ || token() === 88 /* FalseKeyword */
? parseTokenNode()
: parseLiteralLikeNode(token());
if (negative) {
@@ -19038,22 +19181,24 @@
}
function isStartOfTypeOfImportType() {
nextToken();
- return token() === 92 /* ImportKeyword */;
+ return token() === 93 /* ImportKeyword */;
}
function parseImportType() {
sourceFile.flags |= 524288 /* PossiblyContainsDynamicImport */;
- var node = createNode(183 /* ImportType */);
- if (parseOptional(104 /* TypeOfKeyword */)) {
+ var node = createNode(184 /* ImportType */);
+ if (parseOptional(105 /* TypeOfKeyword */)) {
node.isTypeOf = true;
}
- parseExpected(92 /* ImportKeyword */);
+ parseExpected(93 /* ImportKeyword */);
parseExpected(20 /* OpenParenToken */);
node.argument = parseType();
parseExpected(21 /* CloseParenToken */);
if (parseOptional(24 /* DotToken */)) {
node.qualifier = parseEntityName(/*allowReservedWords*/ true, ts.Diagnostics.Type_expected);
}
- node.typeArguments = tryParseTypeArguments();
+ if (!scanner.hasPrecedingLineBreak() && reScanLessThanToken() === 28 /* LessThanToken */) {
+ node.typeArguments = parseBracketedList(20 /* TypeArguments */, parseType, 28 /* LessThanToken */, 30 /* GreaterThanToken */);
+ }
return finishNode(node);
}
function nextTokenIsNumericOrBigIntLiteral() {
@@ -19062,25 +19207,25 @@
}
function parseNonArrayType() {
switch (token()) {
- case 120 /* AnyKeyword */:
- case 143 /* UnknownKeyword */:
- case 138 /* StringKeyword */:
- case 135 /* NumberKeyword */:
- case 146 /* BigIntKeyword */:
- case 139 /* SymbolKeyword */:
- case 123 /* BooleanKeyword */:
- case 141 /* UndefinedKeyword */:
- case 132 /* NeverKeyword */:
- case 136 /* ObjectKeyword */:
+ case 121 /* AnyKeyword */:
+ case 144 /* UnknownKeyword */:
+ case 139 /* StringKeyword */:
+ case 136 /* NumberKeyword */:
+ case 147 /* BigIntKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 142 /* UndefinedKeyword */:
+ case 133 /* NeverKeyword */:
+ case 137 /* ObjectKeyword */:
// If these are followed by a dot, then parse these out as a dotted type reference instead.
return tryParse(parseKeywordAndNoDot) || parseTypeReference();
case 40 /* AsteriskToken */:
return parseJSDocAllType(/*postfixEquals*/ false);
- case 62 /* AsteriskEqualsToken */:
+ case 63 /* AsteriskEqualsToken */:
return parseJSDocAllType(/*postfixEquals*/ true);
case 56 /* QuestionToken */:
return parseJSDocUnknownOrNullableType();
- case 90 /* FunctionKeyword */:
+ case 91 /* FunctionKeyword */:
return parseJSDocFunctionType();
case 52 /* ExclamationToken */:
return parseJSDocNonNullableType();
@@ -19088,24 +19233,24 @@
case 10 /* StringLiteral */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
return parseLiteralTypeNode();
case 39 /* MinusToken */:
return lookAhead(nextTokenIsNumericOrBigIntLiteral) ? parseLiteralTypeNode(/*negative*/ true) : parseTypeReference();
- case 106 /* VoidKeyword */:
- case 96 /* NullKeyword */:
+ case 107 /* VoidKeyword */:
+ case 97 /* NullKeyword */:
return parseTokenNode();
- case 100 /* ThisKeyword */: {
+ case 101 /* ThisKeyword */: {
var thisKeyword = parseThisTypeNode();
- if (token() === 128 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) {
+ if (token() === 129 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) {
return parseThisTypePredicate(thisKeyword);
}
else {
return thisKeyword;
}
}
- case 104 /* TypeOfKeyword */:
+ case 105 /* TypeOfKeyword */:
return lookAhead(isStartOfTypeOfImportType) ? parseImportType() : parseTypeQuery();
case 18 /* OpenBraceToken */:
return lookAhead(isStartOfMappedType) ? parseMappedType() : parseTypeLiteral();
@@ -19113,7 +19258,7 @@
return parseTupleType();
case 20 /* OpenParenToken */:
return parseParenthesizedType();
- case 92 /* ImportKeyword */:
+ case 93 /* ImportKeyword */:
return parseImportType();
default:
return parseTypeReference();
@@ -19121,41 +19266,41 @@
}
function isStartOfType(inStartOfParameter) {
switch (token()) {
- case 120 /* AnyKeyword */:
- case 143 /* UnknownKeyword */:
- case 138 /* StringKeyword */:
- case 135 /* NumberKeyword */:
- case 146 /* BigIntKeyword */:
- case 123 /* BooleanKeyword */:
- case 133 /* ReadonlyKeyword */:
- case 139 /* SymbolKeyword */:
- case 142 /* UniqueKeyword */:
- case 106 /* VoidKeyword */:
- case 141 /* UndefinedKeyword */:
- case 96 /* NullKeyword */:
- case 100 /* ThisKeyword */:
- case 104 /* TypeOfKeyword */:
- case 132 /* NeverKeyword */:
+ case 121 /* AnyKeyword */:
+ case 144 /* UnknownKeyword */:
+ case 139 /* StringKeyword */:
+ case 136 /* NumberKeyword */:
+ case 147 /* BigIntKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 134 /* ReadonlyKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 143 /* UniqueKeyword */:
+ case 107 /* VoidKeyword */:
+ case 142 /* UndefinedKeyword */:
+ case 97 /* NullKeyword */:
+ case 101 /* ThisKeyword */:
+ case 105 /* TypeOfKeyword */:
+ case 133 /* NeverKeyword */:
case 18 /* OpenBraceToken */:
case 22 /* OpenBracketToken */:
case 28 /* LessThanToken */:
case 50 /* BarToken */:
case 49 /* AmpersandToken */:
- case 95 /* NewKeyword */:
+ case 96 /* NewKeyword */:
case 10 /* StringLiteral */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
- case 136 /* ObjectKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
+ case 137 /* ObjectKeyword */:
case 40 /* AsteriskToken */:
case 56 /* QuestionToken */:
case 52 /* ExclamationToken */:
case 25 /* DotDotDotToken */:
- case 127 /* InferKeyword */:
- case 92 /* ImportKeyword */:
+ case 128 /* InferKeyword */:
+ case 93 /* ImportKeyword */:
return true;
- case 90 /* FunctionKeyword */:
+ case 91 /* FunctionKeyword */:
return !inStartOfParameter;
case 39 /* MinusToken */:
return !inStartOfParameter && lookAhead(nextTokenIsNumericOrBigIntLiteral);
@@ -19176,26 +19321,26 @@
while (!scanner.hasPrecedingLineBreak()) {
switch (token()) {
case 52 /* ExclamationToken */:
- type = createPostfixType(292 /* JSDocNonNullableType */, type);
+ type = createPostfixType(293 /* JSDocNonNullableType */, type);
break;
case 56 /* QuestionToken */:
// If not in JSDoc and next token is start of a type we have a conditional type
if (!(contextFlags & 2097152 /* JSDoc */) && lookAhead(nextTokenIsStartOfType)) {
return type;
}
- type = createPostfixType(291 /* JSDocNullableType */, type);
+ type = createPostfixType(292 /* JSDocNullableType */, type);
break;
case 22 /* OpenBracketToken */:
parseExpected(22 /* OpenBracketToken */);
if (isStartOfType()) {
- var node = createNode(180 /* IndexedAccessType */, type.pos);
+ var node = createNode(181 /* IndexedAccessType */, type.pos);
node.objectType = type;
node.indexType = parseType();
parseExpected(23 /* CloseBracketToken */);
type = finishNode(node);
}
else {
- var node = createNode(169 /* ArrayType */, type.pos);
+ var node = createNode(170 /* ArrayType */, type.pos);
node.elementType = type;
parseExpected(23 /* CloseBracketToken */);
type = finishNode(node);
@@ -19214,16 +19359,16 @@
return finishNode(postfix);
}
function parseTypeOperator(operator) {
- var node = createNode(179 /* TypeOperator */);
+ var node = createNode(180 /* TypeOperator */);
parseExpected(operator);
node.operator = operator;
node.type = parseTypeOperatorOrHigher();
return finishNode(node);
}
function parseInferType() {
- var node = createNode(176 /* InferType */);
- parseExpected(127 /* InferKeyword */);
- var typeParameter = createNode(150 /* TypeParameter */);
+ var node = createNode(177 /* InferType */);
+ parseExpected(128 /* InferKeyword */);
+ var typeParameter = createNode(151 /* TypeParameter */);
typeParameter.name = parseIdentifier();
node.typeParameter = finishNode(typeParameter);
return finishNode(node);
@@ -19231,34 +19376,35 @@
function parseTypeOperatorOrHigher() {
var operator = token();
switch (operator) {
- case 129 /* KeyOfKeyword */:
- case 142 /* UniqueKeyword */:
- case 133 /* ReadonlyKeyword */:
+ case 130 /* KeyOfKeyword */:
+ case 143 /* UniqueKeyword */:
+ case 134 /* ReadonlyKeyword */:
return parseTypeOperator(operator);
- case 127 /* InferKeyword */:
+ case 128 /* InferKeyword */:
return parseInferType();
}
return parsePostfixTypeOrHigher();
}
function parseUnionOrIntersectionType(kind, parseConstituentType, operator) {
- parseOptional(operator);
+ var start = scanner.getStartPos();
+ var hasLeadingOperator = parseOptional(operator);
var type = parseConstituentType();
- if (token() === operator) {
+ if (token() === operator || hasLeadingOperator) {
var types = [type];
while (parseOptional(operator)) {
types.push(parseConstituentType());
}
- var node = createNode(kind, type.pos);
- node.types = createNodeArray(types, type.pos);
+ var node = createNode(kind, start);
+ node.types = createNodeArray(types, start);
type = finishNode(node);
}
return type;
}
function parseIntersectionTypeOrHigher() {
- return parseUnionOrIntersectionType(174 /* IntersectionType */, parseTypeOperatorOrHigher, 49 /* AmpersandToken */);
+ return parseUnionOrIntersectionType(175 /* IntersectionType */, parseTypeOperatorOrHigher, 49 /* AmpersandToken */);
}
function parseUnionTypeOrHigher() {
- return parseUnionOrIntersectionType(173 /* UnionType */, parseIntersectionTypeOrHigher, 50 /* BarToken */);
+ return parseUnionOrIntersectionType(174 /* UnionType */, parseIntersectionTypeOrHigher, 50 /* BarToken */);
}
function isStartOfFunctionType() {
if (token() === 28 /* LessThanToken */) {
@@ -19271,7 +19417,7 @@
// Skip modifiers
parseModifiers();
}
- if (isIdentifier() || token() === 100 /* ThisKeyword */) {
+ if (isIdentifier() || token() === 101 /* ThisKeyword */) {
nextToken();
return true;
}
@@ -19294,7 +19440,7 @@
// We successfully skipped modifiers (if any) and an identifier or binding pattern,
// now see if we have something that indicates a parameter declaration
if (token() === 57 /* ColonToken */ || token() === 27 /* CommaToken */ ||
- token() === 56 /* QuestionToken */ || token() === 59 /* EqualsToken */) {
+ token() === 56 /* QuestionToken */ || token() === 60 /* EqualsToken */) {
// ( xxx :
// ( xxx ,
// ( xxx ?
@@ -19315,7 +19461,7 @@
var typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix);
var type = parseType();
if (typePredicateVariable) {
- var node = createNode(163 /* TypePredicate */, typePredicateVariable.pos);
+ var node = createNode(164 /* TypePredicate */, typePredicateVariable.pos);
node.parameterName = typePredicateVariable;
node.type = type;
return finishNode(node);
@@ -19326,7 +19472,7 @@
}
function parseTypePredicatePrefix() {
var id = parseIdentifier();
- if (token() === 128 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) {
+ if (token() === 129 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) {
nextToken();
return id;
}
@@ -19337,12 +19483,12 @@
return doOutsideOfContext(20480 /* TypeExcludesFlags */, parseTypeWorker);
}
function parseTypeWorker(noConditionalTypes) {
- if (isStartOfFunctionType() || token() === 95 /* NewKeyword */) {
+ if (isStartOfFunctionType() || token() === 96 /* NewKeyword */) {
return parseFunctionOrConstructorType();
}
var type = parseUnionTypeOrHigher();
- if (!noConditionalTypes && !scanner.hasPrecedingLineBreak() && parseOptional(86 /* ExtendsKeyword */)) {
- var node = createNode(175 /* ConditionalType */, type.pos);
+ if (!noConditionalTypes && !scanner.hasPrecedingLineBreak() && parseOptional(87 /* ExtendsKeyword */)) {
+ var node = createNode(176 /* ConditionalType */, type.pos);
node.checkType = type;
// The type following 'extends' is not permitted to be another conditional type
node.extendsType = parseTypeWorker(/*noConditionalTypes*/ true);
@@ -19360,11 +19506,11 @@
// EXPRESSIONS
function isStartOfLeftHandSideExpression() {
switch (token()) {
- case 100 /* ThisKeyword */:
- case 98 /* SuperKeyword */:
- case 96 /* NullKeyword */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
+ case 101 /* ThisKeyword */:
+ case 99 /* SuperKeyword */:
+ case 97 /* NullKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
case 10 /* StringLiteral */:
@@ -19373,14 +19519,14 @@
case 20 /* OpenParenToken */:
case 22 /* OpenBracketToken */:
case 18 /* OpenBraceToken */:
- case 90 /* FunctionKeyword */:
- case 76 /* ClassKeyword */:
- case 95 /* NewKeyword */:
+ case 91 /* FunctionKeyword */:
+ case 77 /* ClassKeyword */:
+ case 96 /* NewKeyword */:
case 42 /* SlashToken */:
- case 64 /* SlashEqualsToken */:
- case 72 /* Identifier */:
+ case 65 /* SlashEqualsToken */:
+ case 73 /* Identifier */:
return true;
- case 92 /* ImportKeyword */:
+ case 93 /* ImportKeyword */:
return lookAhead(nextTokenIsOpenParenOrLessThanOrDot);
default:
return isIdentifier();
@@ -19395,14 +19541,14 @@
case 39 /* MinusToken */:
case 53 /* TildeToken */:
case 52 /* ExclamationToken */:
- case 81 /* DeleteKeyword */:
- case 104 /* TypeOfKeyword */:
- case 106 /* VoidKeyword */:
+ case 82 /* DeleteKeyword */:
+ case 105 /* TypeOfKeyword */:
+ case 107 /* VoidKeyword */:
case 44 /* PlusPlusToken */:
case 45 /* MinusMinusToken */:
case 28 /* LessThanToken */:
- case 122 /* AwaitKeyword */:
- case 117 /* YieldKeyword */:
+ case 123 /* AwaitKeyword */:
+ case 118 /* YieldKeyword */:
// Yield/await always starts an expression. Either it is an identifier (in which case
// it is definitely an expression). Or it's a keyword (either because we're in
// a generator or async function, or in strict mode (or both)) and it started a yield or await expression.
@@ -19421,8 +19567,8 @@
function isStartOfExpressionStatement() {
// As per the grammar, none of '{' or 'function' or 'class' can start an expression statement.
return token() !== 18 /* OpenBraceToken */ &&
- token() !== 90 /* FunctionKeyword */ &&
- token() !== 76 /* ClassKeyword */ &&
+ token() !== 91 /* FunctionKeyword */ &&
+ token() !== 77 /* ClassKeyword */ &&
token() !== 58 /* AtToken */ &&
isStartOfExpression();
}
@@ -19446,7 +19592,7 @@
return expr;
}
function parseInitializer() {
- return parseOptional(59 /* EqualsToken */) ? parseAssignmentExpressionOrHigher() : undefined;
+ return parseOptional(60 /* EqualsToken */) ? parseAssignmentExpressionOrHigher() : undefined;
}
function parseAssignmentExpressionOrHigher() {
// AssignmentExpression[in,yield]:
@@ -19491,7 +19637,7 @@
// To avoid a look-ahead, we did not handle the case of an arrow function with a single un-parenthesized
// parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single
// identifier and the current token is an arrow.
- if (expr.kind === 72 /* Identifier */ && token() === 37 /* EqualsGreaterThanToken */) {
+ if (expr.kind === 73 /* Identifier */ && token() === 37 /* EqualsGreaterThanToken */) {
return parseSimpleArrowFunctionExpression(expr);
}
// Now see if we might be in cases '2' or '3'.
@@ -19507,7 +19653,7 @@
return parseConditionalExpressionRest(expr);
}
function isYieldExpression() {
- if (token() === 117 /* YieldKeyword */) {
+ if (token() === 118 /* YieldKeyword */) {
// If we have a 'yield' keyword, and this is a context where yield expressions are
// allowed, then definitely parse out a yield expression.
if (inYieldContext()) {
@@ -19536,7 +19682,7 @@
return !scanner.hasPrecedingLineBreak() && isIdentifier();
}
function parseYieldExpression() {
- var node = createNode(207 /* YieldExpression */);
+ var node = createNode(208 /* YieldExpression */);
// YieldExpression[In] :
// yield
// yield [no LineTerminator here] [Lexical goal InputElementRegExp]AssignmentExpression[?In, Yield]
@@ -19558,13 +19704,13 @@
ts.Debug.assert(token() === 37 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
var node;
if (asyncModifier) {
- node = createNode(197 /* ArrowFunction */, asyncModifier.pos);
+ node = createNode(198 /* ArrowFunction */, asyncModifier.pos);
node.modifiers = asyncModifier;
}
else {
- node = createNode(197 /* ArrowFunction */, identifier.pos);
+ node = createNode(198 /* ArrowFunction */, identifier.pos);
}
- var parameter = createNode(151 /* Parameter */, identifier.pos);
+ var parameter = createNode(152 /* Parameter */, identifier.pos);
parameter.name = identifier;
finishNode(parameter);
node.parameters = createNodeArray([parameter], parameter.pos, parameter.end);
@@ -19604,7 +19750,7 @@
// Unknown -> There *might* be a parenthesized arrow function here.
// Speculatively look ahead to be sure, and rollback if not.
function isParenthesizedArrowFunctionExpression() {
- if (token() === 20 /* OpenParenToken */ || token() === 28 /* LessThanToken */ || token() === 121 /* AsyncKeyword */) {
+ if (token() === 20 /* OpenParenToken */ || token() === 28 /* LessThanToken */ || token() === 122 /* AsyncKeyword */) {
return lookAhead(isParenthesizedArrowFunctionExpressionWorker);
}
if (token() === 37 /* EqualsGreaterThanToken */) {
@@ -19617,7 +19763,7 @@
return 0 /* False */;
}
function isParenthesizedArrowFunctionExpressionWorker() {
- if (token() === 121 /* AsyncKeyword */) {
+ if (token() === 122 /* AsyncKeyword */) {
nextToken();
if (scanner.hasPrecedingLineBreak()) {
return 0 /* False */;
@@ -19661,13 +19807,13 @@
// Check for "(xxx yyy", where xxx is a modifier and yyy is an identifier. This
// isn't actually allowed, but we want to treat it as a lambda so we can provide
// a good error message.
- if (ts.isModifierKind(second) && second !== 121 /* AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) {
+ if (ts.isModifierKind(second) && second !== 122 /* AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) {
return 1 /* True */;
}
// If we had "(" followed by something that's not an identifier,
// then this definitely doesn't look like a lambda. "this" is not
// valid, but we want to parse it and then give a semantic error.
- if (!isIdentifier() && second !== 100 /* ThisKeyword */) {
+ if (!isIdentifier() && second !== 101 /* ThisKeyword */) {
return 0 /* False */;
}
switch (nextToken()) {
@@ -19678,13 +19824,13 @@
case 56 /* QuestionToken */:
nextToken();
// If we have "(a?:" or "(a?," or "(a?=" or "(a?)" then it is definitely a lambda.
- if (token() === 57 /* ColonToken */ || token() === 27 /* CommaToken */ || token() === 59 /* EqualsToken */ || token() === 21 /* CloseParenToken */) {
+ if (token() === 57 /* ColonToken */ || token() === 27 /* CommaToken */ || token() === 60 /* EqualsToken */ || token() === 21 /* CloseParenToken */) {
return 1 /* True */;
}
// Otherwise it is definitely not a lambda.
return 0 /* False */;
case 27 /* CommaToken */:
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
case 21 /* CloseParenToken */:
// If we have "(a," or "(a=" or "(a)" this *could* be an arrow function
return 2 /* Unknown */;
@@ -19703,10 +19849,10 @@
if (sourceFile.languageVariant === 1 /* JSX */) {
var isArrowFunctionInJsx = lookAhead(function () {
var third = nextToken();
- if (third === 86 /* ExtendsKeyword */) {
+ if (third === 87 /* ExtendsKeyword */) {
var fourth = nextToken();
switch (fourth) {
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
case 30 /* GreaterThanToken */:
return false;
default:
@@ -19732,7 +19878,7 @@
}
function tryParseAsyncSimpleArrowFunctionExpression() {
// We do a check here so that we won't be doing unnecessarily call to "lookAhead"
- if (token() === 121 /* AsyncKeyword */) {
+ if (token() === 122 /* AsyncKeyword */) {
if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) {
var asyncModifier = parseModifiersForArrowFunction();
var expr = parseBinaryExpressionOrHigher(/*precedence*/ 0);
@@ -19745,7 +19891,7 @@
// AsyncArrowFunctionExpression:
// 1) async[no LineTerminator here]AsyncArrowBindingIdentifier[?Yield][no LineTerminator here]=>AsyncConciseBody[?In]
// 2) CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await][no LineTerminator here]=>AsyncConciseBody[?In]
- if (token() === 121 /* AsyncKeyword */) {
+ if (token() === 122 /* AsyncKeyword */) {
nextToken();
// If the "async" is followed by "=>" token then it is not a beginning of an async arrow-function
// but instead a simple arrow-function which will be parsed inside "parseAssignmentExpressionOrHigher"
@@ -19754,14 +19900,14 @@
}
// Check for un-parenthesized AsyncArrowFunction
var expr = parseBinaryExpressionOrHigher(/*precedence*/ 0);
- if (!scanner.hasPrecedingLineBreak() && expr.kind === 72 /* Identifier */ && token() === 37 /* EqualsGreaterThanToken */) {
+ if (!scanner.hasPrecedingLineBreak() && expr.kind === 73 /* Identifier */ && token() === 37 /* EqualsGreaterThanToken */) {
return 1 /* True */;
}
}
return 0 /* False */;
}
function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) {
- var node = createNodeWithJSDoc(197 /* ArrowFunction */);
+ var node = createNodeWithJSDoc(198 /* ArrowFunction */);
node.modifiers = parseModifiersForArrowFunction();
var isAsync = ts.hasModifier(node, 256 /* Async */) ? 2 /* Await */ : 0 /* None */;
// Arrow functions are never generators.
@@ -19780,9 +19926,11 @@
// - "(x = 10)" is an assignment expression parsed as a signature with a default parameter value.
// - "(x,y)" is a comma expression parsed as a signature with two parameters.
// - "a ? (b): c" will have "(b):" parsed as a signature with a return type annotation.
+ // - "a ? (b): function() {}" will too, since function() is a valid JSDoc function type.
//
// So we need just a bit of lookahead to ensure that it can only be a signature.
- if (!allowAmbiguity && token() !== 37 /* EqualsGreaterThanToken */ && token() !== 18 /* OpenBraceToken */) {
+ var hasJSDocFunctionType = node.type && ts.isJSDocFunctionType(node.type);
+ if (!allowAmbiguity && token() !== 37 /* EqualsGreaterThanToken */ && (hasJSDocFunctionType || token() !== 18 /* OpenBraceToken */)) {
// Returning undefined here will cause our caller to rewind to where we started from.
return undefined;
}
@@ -19793,8 +19941,8 @@
return parseFunctionBlock(isAsync ? 2 /* Await */ : 0 /* None */);
}
if (token() !== 26 /* SemicolonToken */ &&
- token() !== 90 /* FunctionKeyword */ &&
- token() !== 76 /* ClassKeyword */ &&
+ token() !== 91 /* FunctionKeyword */ &&
+ token() !== 77 /* ClassKeyword */ &&
isStartOfStatement() &&
!isStartOfExpressionStatement()) {
// Check if we got a plain statement (i.e. no expression-statements, no function/class expressions/declarations)
@@ -19825,14 +19973,14 @@
}
// Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and
// we do not that for the 'whenFalse' part.
- var node = createNode(205 /* ConditionalExpression */, leftOperand.pos);
+ var node = createNode(206 /* ConditionalExpression */, leftOperand.pos);
node.condition = leftOperand;
node.questionToken = questionToken;
node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher);
node.colonToken = parseExpectedToken(57 /* ColonToken */);
node.whenFalse = ts.nodeIsPresent(node.colonToken)
? parseAssignmentExpressionOrHigher()
- : createMissingNode(72 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(57 /* ColonToken */));
+ : createMissingNode(73 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(57 /* ColonToken */));
return finishNode(node);
}
function parseBinaryExpressionOrHigher(precedence) {
@@ -19840,7 +19988,7 @@
return parseBinaryExpressionRest(precedence, leftOperand);
}
function isInOrOfKeyword(t) {
- return t === 93 /* InKeyword */ || t === 147 /* OfKeyword */;
+ return t === 94 /* InKeyword */ || t === 148 /* OfKeyword */;
}
function parseBinaryExpressionRest(precedence, leftOperand) {
while (true) {
@@ -19875,10 +20023,10 @@
if (!consumeCurrentOperator) {
break;
}
- if (token() === 93 /* InKeyword */ && inDisallowInContext()) {
+ if (token() === 94 /* InKeyword */ && inDisallowInContext()) {
break;
}
- if (token() === 119 /* AsKeyword */) {
+ if (token() === 120 /* AsKeyword */) {
// Make sure we *do* perform ASI for constructs like this:
// var x = foo
// as (Bar)
@@ -19899,51 +20047,51 @@
return leftOperand;
}
function isBinaryOperator() {
- if (inDisallowInContext() && token() === 93 /* InKeyword */) {
+ if (inDisallowInContext() && token() === 94 /* InKeyword */) {
return false;
}
return ts.getBinaryOperatorPrecedence(token()) > 0;
}
function makeBinaryExpression(left, operatorToken, right) {
- var node = createNode(204 /* BinaryExpression */, left.pos);
+ var node = createNode(205 /* BinaryExpression */, left.pos);
node.left = left;
node.operatorToken = operatorToken;
node.right = right;
return finishNode(node);
}
function makeAsExpression(left, right) {
- var node = createNode(212 /* AsExpression */, left.pos);
+ var node = createNode(213 /* AsExpression */, left.pos);
node.expression = left;
node.type = right;
return finishNode(node);
}
function parsePrefixUnaryExpression() {
- var node = createNode(202 /* PrefixUnaryExpression */);
+ var node = createNode(203 /* PrefixUnaryExpression */);
node.operator = token();
nextToken();
node.operand = parseSimpleUnaryExpression();
return finishNode(node);
}
function parseDeleteExpression() {
- var node = createNode(198 /* DeleteExpression */);
+ var node = createNode(199 /* DeleteExpression */);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
}
function parseTypeOfExpression() {
- var node = createNode(199 /* TypeOfExpression */);
+ var node = createNode(200 /* TypeOfExpression */);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
}
function parseVoidExpression() {
- var node = createNode(200 /* VoidExpression */);
+ var node = createNode(201 /* VoidExpression */);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
}
function isAwaitExpression() {
- if (token() === 122 /* AwaitKeyword */) {
+ if (token() === 123 /* AwaitKeyword */) {
if (inAwaitContext()) {
return true;
}
@@ -19953,7 +20101,7 @@
return false;
}
function parseAwaitExpression() {
- var node = createNode(201 /* AwaitExpression */);
+ var node = createNode(202 /* AwaitExpression */);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
@@ -19997,7 +20145,7 @@
if (token() === 41 /* AsteriskAsteriskToken */) {
var pos = ts.skipTrivia(sourceText, simpleUnaryExpression.pos);
var end = simpleUnaryExpression.end;
- if (simpleUnaryExpression.kind === 194 /* TypeAssertionExpression */) {
+ if (simpleUnaryExpression.kind === 195 /* TypeAssertionExpression */) {
parseErrorAt(pos, end, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses);
}
else {
@@ -20027,18 +20175,18 @@
case 53 /* TildeToken */:
case 52 /* ExclamationToken */:
return parsePrefixUnaryExpression();
- case 81 /* DeleteKeyword */:
+ case 82 /* DeleteKeyword */:
return parseDeleteExpression();
- case 104 /* TypeOfKeyword */:
+ case 105 /* TypeOfKeyword */:
return parseTypeOfExpression();
- case 106 /* VoidKeyword */:
+ case 107 /* VoidKeyword */:
return parseVoidExpression();
case 28 /* LessThanToken */:
// This is modified UnaryExpression grammar in TypeScript
// UnaryExpression (modified):
// < type > UnaryExpression
return parseTypeAssertion();
- case 122 /* AwaitKeyword */:
+ case 123 /* AwaitKeyword */:
if (isAwaitExpression()) {
return parseAwaitExpression();
}
@@ -20065,10 +20213,10 @@
case 39 /* MinusToken */:
case 53 /* TildeToken */:
case 52 /* ExclamationToken */:
- case 81 /* DeleteKeyword */:
- case 104 /* TypeOfKeyword */:
- case 106 /* VoidKeyword */:
- case 122 /* AwaitKeyword */:
+ case 82 /* DeleteKeyword */:
+ case 105 /* TypeOfKeyword */:
+ case 107 /* VoidKeyword */:
+ case 123 /* AwaitKeyword */:
return false;
case 28 /* LessThanToken */:
// If we are not in JSX context, we are parsing TypeAssertion which is an UnaryExpression
@@ -20094,7 +20242,7 @@
*/
function parseUpdateExpression() {
if (token() === 44 /* PlusPlusToken */ || token() === 45 /* MinusMinusToken */) {
- var node = createNode(202 /* PrefixUnaryExpression */);
+ var node = createNode(203 /* PrefixUnaryExpression */);
node.operator = token();
nextToken();
node.operand = parseLeftHandSideExpressionOrHigher();
@@ -20107,7 +20255,7 @@
var expression = parseLeftHandSideExpressionOrHigher();
ts.Debug.assert(ts.isLeftHandSideExpression(expression));
if ((token() === 44 /* PlusPlusToken */ || token() === 45 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) {
- var node = createNode(203 /* PostfixUnaryExpression */, expression.pos);
+ var node = createNode(204 /* PostfixUnaryExpression */, expression.pos);
node.operand = expression;
node.operator = token();
nextToken();
@@ -20148,7 +20296,7 @@
// 3)we have a MemberExpression which either completes the LeftHandSideExpression,
// or starts the beginning of the first four CallExpression productions.
var expression;
- if (token() === 92 /* ImportKeyword */) {
+ if (token() === 93 /* ImportKeyword */) {
if (lookAhead(nextTokenIsOpenParenOrLessThan)) {
// We don't want to eagerly consume all import keyword as import call expression so we look ahead to find "("
// For example:
@@ -20163,8 +20311,8 @@
var fullStart = scanner.getStartPos();
nextToken(); // advance past the 'import'
nextToken(); // advance past the dot
- var node = createNode(214 /* MetaProperty */, fullStart);
- node.keywordToken = 92 /* ImportKeyword */;
+ var node = createNode(215 /* MetaProperty */, fullStart);
+ node.keywordToken = 93 /* ImportKeyword */;
node.name = parseIdentifierName();
expression = finishNode(node);
sourceFile.flags |= 1048576 /* PossiblyContainsImportMeta */;
@@ -20174,7 +20322,7 @@
}
}
else {
- expression = token() === 98 /* SuperKeyword */ ? parseSuperExpression() : parseMemberExpressionOrHigher();
+ expression = token() === 99 /* SuperKeyword */ ? parseSuperExpression() : parseMemberExpressionOrHigher();
}
// Now, we *may* be complete. However, we might have consumed the start of a
// CallExpression. As such, we need to consume the rest of it here to be complete.
@@ -20233,12 +20381,19 @@
}
function parseSuperExpression() {
var expression = parseTokenNode();
+ if (token() === 28 /* LessThanToken */) {
+ var startPos = getNodePos();
+ var typeArguments = tryParse(parseTypeArgumentsInExpression);
+ if (typeArguments !== undefined) {
+ parseErrorAt(startPos, getNodePos(), ts.Diagnostics.super_may_not_use_type_arguments);
+ }
+ }
if (token() === 20 /* OpenParenToken */ || token() === 24 /* DotToken */ || token() === 22 /* OpenBracketToken */) {
return expression;
}
// If we have seen "super" it must be followed by '(' or '.'.
// If it wasn't then just try to parse out a '.' and report an error.
- var node = createNode(189 /* PropertyAccessExpression */, expression.pos);
+ var node = createNode(190 /* PropertyAccessExpression */, expression.pos);
node.expression = expression;
parseExpectedToken(24 /* DotToken */, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access);
node.name = parseRightSideOfDot(/*allowIdentifierNames*/ true);
@@ -20247,8 +20402,8 @@
function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext) {
var opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext);
var result;
- if (opening.kind === 262 /* JsxOpeningElement */) {
- var node = createNode(260 /* JsxElement */, opening.pos);
+ if (opening.kind === 263 /* JsxOpeningElement */) {
+ var node = createNode(261 /* JsxElement */, opening.pos);
node.openingElement = opening;
node.children = parseJsxChildren(node.openingElement);
node.closingElement = parseJsxClosingElement(inExpressionContext);
@@ -20257,15 +20412,15 @@
}
result = finishNode(node);
}
- else if (opening.kind === 265 /* JsxOpeningFragment */) {
- var node = createNode(264 /* JsxFragment */, opening.pos);
+ else if (opening.kind === 266 /* JsxOpeningFragment */) {
+ var node = createNode(265 /* JsxFragment */, opening.pos);
node.openingFragment = opening;
node.children = parseJsxChildren(node.openingFragment);
node.closingFragment = parseJsxClosingFragment(inExpressionContext);
result = finishNode(node);
}
else {
- ts.Debug.assert(opening.kind === 261 /* JsxSelfClosingElement */);
+ ts.Debug.assert(opening.kind === 262 /* JsxSelfClosingElement */);
// Nothing else to do for self-closing elements
result = opening;
}
@@ -20280,11 +20435,11 @@
var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElementOrFragment(/*inExpressionContext*/ true); });
if (invalidElement) {
parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element);
- var badNode = createNode(204 /* BinaryExpression */, result.pos);
+ var badNode = createNode(205 /* BinaryExpression */, result.pos);
badNode.end = invalidElement.end;
badNode.left = result;
badNode.right = invalidElement;
- badNode.operatorToken = createMissingNode(27 /* CommaToken */, /*reportAtCurrentPosition*/ false, /*diagnosticMessage*/ undefined); // TODO: GH#18217
+ badNode.operatorToken = createMissingNode(27 /* CommaToken */, /*reportAtCurrentPosition*/ false);
badNode.operatorToken.pos = badNode.operatorToken.end = badNode.right.pos;
return badNode;
}
@@ -20339,7 +20494,7 @@
return createNodeArray(list, listPos);
}
function parseJsxAttributes() {
- var jsxAttributes = createNode(268 /* JsxAttributes */);
+ var jsxAttributes = createNode(269 /* JsxAttributes */);
jsxAttributes.properties = parseList(13 /* JsxAttributes */, parseJsxAttribute);
return finishNode(jsxAttributes);
}
@@ -20348,7 +20503,7 @@
parseExpected(28 /* LessThanToken */);
if (token() === 30 /* GreaterThanToken */) {
// See below for explanation of scanJsxText
- var node_1 = createNode(265 /* JsxOpeningFragment */, fullStart);
+ var node_1 = createNode(266 /* JsxOpeningFragment */, fullStart);
scanJsxText();
return finishNode(node_1);
}
@@ -20360,7 +20515,7 @@
// Closing tag, so scan the immediately-following text with the JSX scanning instead
// of regular scanning to avoid treating illegal characters (e.g. '#') as immediate
// scanning errors
- node = createNode(262 /* JsxOpeningElement */, fullStart);
+ node = createNode(263 /* JsxOpeningElement */, fullStart);
scanJsxText();
}
else {
@@ -20372,7 +20527,7 @@
parseExpected(30 /* GreaterThanToken */, /*diagnostic*/ undefined, /*shouldAdvance*/ false);
scanJsxText();
}
- node = createNode(261 /* JsxSelfClosingElement */, fullStart);
+ node = createNode(262 /* JsxSelfClosingElement */, fullStart);
}
node.tagName = tagName;
node.typeArguments = typeArguments;
@@ -20386,10 +20541,10 @@
// primaryExpression in the form of an identifier and "this" keyword
// We can't just simply use parseLeftHandSideExpressionOrHigher because then we will start consider class,function etc as a keyword
// We only want to consider "this" as a primaryExpression
- var expression = token() === 100 /* ThisKeyword */ ?
+ var expression = token() === 101 /* ThisKeyword */ ?
parseTokenNode() : parseIdentifierName();
while (parseOptional(24 /* DotToken */)) {
- var propertyAccess = createNode(189 /* PropertyAccessExpression */, expression.pos);
+ var propertyAccess = createNode(190 /* PropertyAccessExpression */, expression.pos);
propertyAccess.expression = expression;
propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true);
expression = finishNode(propertyAccess);
@@ -20397,7 +20552,7 @@
return expression;
}
function parseJsxExpression(inExpressionContext) {
- var node = createNode(270 /* JsxExpression */);
+ var node = createNode(271 /* JsxExpression */);
if (!parseExpected(18 /* OpenBraceToken */)) {
return undefined;
}
@@ -20419,9 +20574,9 @@
return parseJsxSpreadAttribute();
}
scanJsxIdentifier();
- var node = createNode(267 /* JsxAttribute */);
+ var node = createNode(268 /* JsxAttribute */);
node.name = parseIdentifierName();
- if (token() === 59 /* EqualsToken */) {
+ if (token() === 60 /* EqualsToken */) {
switch (scanJsxAttributeValue()) {
case 10 /* StringLiteral */:
node.initializer = parseLiteralNode();
@@ -20434,7 +20589,7 @@
return finishNode(node);
}
function parseJsxSpreadAttribute() {
- var node = createNode(269 /* JsxSpreadAttribute */);
+ var node = createNode(270 /* JsxSpreadAttribute */);
parseExpected(18 /* OpenBraceToken */);
parseExpected(25 /* DotDotDotToken */);
node.expression = parseExpression();
@@ -20442,7 +20597,7 @@
return finishNode(node);
}
function parseJsxClosingElement(inExpressionContext) {
- var node = createNode(263 /* JsxClosingElement */);
+ var node = createNode(264 /* JsxClosingElement */);
parseExpected(29 /* LessThanSlashToken */);
node.tagName = parseJsxElementName();
if (inExpressionContext) {
@@ -20455,7 +20610,7 @@
return finishNode(node);
}
function parseJsxClosingFragment(inExpressionContext) {
- var node = createNode(266 /* JsxClosingFragment */);
+ var node = createNode(267 /* JsxClosingFragment */);
parseExpected(29 /* LessThanSlashToken */);
if (ts.tokenIsIdentifierOrKeyword(token())) {
parseErrorAtRange(parseJsxElementName(), ts.Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment);
@@ -20470,7 +20625,7 @@
return finishNode(node);
}
function parseTypeAssertion() {
- var node = createNode(194 /* TypeAssertionExpression */);
+ var node = createNode(195 /* TypeAssertionExpression */);
parseExpected(28 /* LessThanToken */);
node.type = parseType();
parseExpected(30 /* GreaterThanToken */);
@@ -20481,7 +20636,7 @@
while (true) {
var dotToken = parseOptionalToken(24 /* DotToken */);
if (dotToken) {
- var propertyAccess = createNode(189 /* PropertyAccessExpression */, expression.pos);
+ var propertyAccess = createNode(190 /* PropertyAccessExpression */, expression.pos);
propertyAccess.expression = expression;
propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true);
expression = finishNode(propertyAccess);
@@ -20489,17 +20644,17 @@
}
if (token() === 52 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) {
nextToken();
- var nonNullExpression = createNode(213 /* NonNullExpression */, expression.pos);
+ var nonNullExpression = createNode(214 /* NonNullExpression */, expression.pos);
nonNullExpression.expression = expression;
expression = finishNode(nonNullExpression);
continue;
}
// when in the [Decorator] context, we do not parse ElementAccess as it could be part of a ComputedPropertyName
if (!inDecoratorContext() && parseOptional(22 /* OpenBracketToken */)) {
- var indexedAccess = createNode(190 /* ElementAccessExpression */, expression.pos);
+ var indexedAccess = createNode(191 /* ElementAccessExpression */, expression.pos);
indexedAccess.expression = expression;
if (token() === 23 /* CloseBracketToken */) {
- indexedAccess.argumentExpression = createMissingNode(72 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.An_element_access_expression_should_take_an_argument);
+ indexedAccess.argumentExpression = createMissingNode(73 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.An_element_access_expression_should_take_an_argument);
}
else {
var argument = allowInAnd(parseExpression);
@@ -20523,7 +20678,7 @@
return token() === 14 /* NoSubstitutionTemplateLiteral */ || token() === 15 /* TemplateHead */;
}
function parseTaggedTemplateRest(tag, typeArguments) {
- var tagExpression = createNode(193 /* TaggedTemplateExpression */, tag.pos);
+ var tagExpression = createNode(194 /* TaggedTemplateExpression */, tag.pos);
tagExpression.tag = tag;
tagExpression.typeArguments = typeArguments;
tagExpression.template = token() === 14 /* NoSubstitutionTemplateLiteral */
@@ -20548,7 +20703,7 @@
expression = parseTaggedTemplateRest(expression, typeArguments);
continue;
}
- var callExpr = createNode(191 /* CallExpression */, expression.pos);
+ var callExpr = createNode(192 /* CallExpression */, expression.pos);
callExpr.expression = expression;
callExpr.typeArguments = typeArguments;
callExpr.arguments = parseArgumentList();
@@ -20556,7 +20711,7 @@
continue;
}
else if (token() === 20 /* OpenParenToken */) {
- var callExpr = createNode(191 /* CallExpression */, expression.pos);
+ var callExpr = createNode(192 /* CallExpression */, expression.pos);
callExpr.expression = expression;
callExpr.arguments = parseArgumentList();
expression = finishNode(callExpr);
@@ -20632,11 +20787,11 @@
case 10 /* StringLiteral */:
case 14 /* NoSubstitutionTemplateLiteral */:
return parseLiteralNode();
- case 100 /* ThisKeyword */:
- case 98 /* SuperKeyword */:
- case 96 /* NullKeyword */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
+ case 101 /* ThisKeyword */:
+ case 99 /* SuperKeyword */:
+ case 97 /* NullKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
return parseTokenNode();
case 20 /* OpenParenToken */:
return parseParenthesizedExpression();
@@ -20644,7 +20799,7 @@
return parseArrayLiteralExpression();
case 18 /* OpenBraceToken */:
return parseObjectLiteralExpression();
- case 121 /* AsyncKeyword */:
+ case 122 /* AsyncKeyword */:
// Async arrow functions are parsed earlier in parseAssignmentExpressionOrHigher.
// If we encounter `async [no LineTerminator here] function` then this is an async
// function; otherwise, its an identifier.
@@ -20652,14 +20807,14 @@
break;
}
return parseFunctionExpression();
- case 76 /* ClassKeyword */:
+ case 77 /* ClassKeyword */:
return parseClassExpression();
- case 90 /* FunctionKeyword */:
+ case 91 /* FunctionKeyword */:
return parseFunctionExpression();
- case 95 /* NewKeyword */:
+ case 96 /* NewKeyword */:
return parseNewExpressionOrNewDotTarget();
case 42 /* SlashToken */:
- case 64 /* SlashEqualsToken */:
+ case 65 /* SlashEqualsToken */:
if (reScanSlashToken() === 13 /* RegularExpressionLiteral */) {
return parseLiteralNode();
}
@@ -20670,28 +20825,28 @@
return parseIdentifier(ts.Diagnostics.Expression_expected);
}
function parseParenthesizedExpression() {
- var node = createNodeWithJSDoc(195 /* ParenthesizedExpression */);
+ var node = createNodeWithJSDoc(196 /* ParenthesizedExpression */);
parseExpected(20 /* OpenParenToken */);
node.expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
return finishNode(node);
}
function parseSpreadElement() {
- var node = createNode(208 /* SpreadElement */);
+ var node = createNode(209 /* SpreadElement */);
parseExpected(25 /* DotDotDotToken */);
node.expression = parseAssignmentExpressionOrHigher();
return finishNode(node);
}
function parseArgumentOrArrayLiteralElement() {
return token() === 25 /* DotDotDotToken */ ? parseSpreadElement() :
- token() === 27 /* CommaToken */ ? createNode(210 /* OmittedExpression */) :
+ token() === 27 /* CommaToken */ ? createNode(211 /* OmittedExpression */) :
parseAssignmentExpressionOrHigher();
}
function parseArgumentExpression() {
return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement);
}
function parseArrayLiteralExpression() {
- var node = createNode(187 /* ArrayLiteralExpression */);
+ var node = createNode(188 /* ArrayLiteralExpression */);
parseExpected(22 /* OpenBracketToken */);
if (scanner.hasPrecedingLineBreak()) {
node.multiLine = true;
@@ -20703,17 +20858,17 @@
function parseObjectLiteralElement() {
var node = createNodeWithJSDoc(0 /* Unknown */);
if (parseOptionalToken(25 /* DotDotDotToken */)) {
- node.kind = 277 /* SpreadAssignment */;
+ node.kind = 278 /* SpreadAssignment */;
node.expression = parseAssignmentExpressionOrHigher();
return finishNode(node);
}
node.decorators = parseDecorators();
node.modifiers = parseModifiers();
- if (parseContextualModifier(126 /* GetKeyword */)) {
- return parseAccessorDeclaration(node, 158 /* GetAccessor */);
+ if (parseContextualModifier(127 /* GetKeyword */)) {
+ return parseAccessorDeclaration(node, 159 /* GetAccessor */);
}
- if (parseContextualModifier(137 /* SetKeyword */)) {
- return parseAccessorDeclaration(node, 159 /* SetAccessor */);
+ if (parseContextualModifier(138 /* SetKeyword */)) {
+ return parseAccessorDeclaration(node, 160 /* SetAccessor */);
}
var asteriskToken = parseOptionalToken(40 /* AsteriskToken */);
var tokenIsIdentifier = isIdentifier();
@@ -20731,22 +20886,22 @@
// this is necessary because ObjectLiteral productions are also used to cover grammar for ObjectAssignmentPattern
var isShorthandPropertyAssignment = tokenIsIdentifier && (token() !== 57 /* ColonToken */);
if (isShorthandPropertyAssignment) {
- node.kind = 276 /* ShorthandPropertyAssignment */;
- var equalsToken = parseOptionalToken(59 /* EqualsToken */);
+ node.kind = 277 /* ShorthandPropertyAssignment */;
+ var equalsToken = parseOptionalToken(60 /* EqualsToken */);
if (equalsToken) {
node.equalsToken = equalsToken;
node.objectAssignmentInitializer = allowInAnd(parseAssignmentExpressionOrHigher);
}
}
else {
- node.kind = 275 /* PropertyAssignment */;
+ node.kind = 276 /* PropertyAssignment */;
parseExpected(57 /* ColonToken */);
node.initializer = allowInAnd(parseAssignmentExpressionOrHigher);
}
return finishNode(node);
}
function parseObjectLiteralExpression() {
- var node = createNode(188 /* ObjectLiteralExpression */);
+ var node = createNode(189 /* ObjectLiteralExpression */);
parseExpected(18 /* OpenBraceToken */);
if (scanner.hasPrecedingLineBreak()) {
node.multiLine = true;
@@ -20765,9 +20920,9 @@
if (saveDecoratorContext) {
setDecoratorContext(/*val*/ false);
}
- var node = createNodeWithJSDoc(196 /* FunctionExpression */);
+ var node = createNodeWithJSDoc(197 /* FunctionExpression */);
node.modifiers = parseModifiers();
- parseExpected(90 /* FunctionKeyword */);
+ parseExpected(91 /* FunctionKeyword */);
node.asteriskToken = parseOptionalToken(40 /* AsteriskToken */);
var isGenerator = node.asteriskToken ? 1 /* Yield */ : 0 /* None */;
var isAsync = ts.hasModifier(node, 256 /* Async */) ? 2 /* Await */ : 0 /* None */;
@@ -20788,10 +20943,10 @@
}
function parseNewExpressionOrNewDotTarget() {
var fullStart = scanner.getStartPos();
- parseExpected(95 /* NewKeyword */);
+ parseExpected(96 /* NewKeyword */);
if (parseOptional(24 /* DotToken */)) {
- var node_2 = createNode(214 /* MetaProperty */, fullStart);
- node_2.keywordToken = 95 /* NewKeyword */;
+ var node_2 = createNode(215 /* MetaProperty */, fullStart);
+ node_2.keywordToken = 96 /* NewKeyword */;
node_2.name = parseIdentifierName();
return finishNode(node_2);
}
@@ -20807,7 +20962,7 @@
}
break;
}
- var node = createNode(192 /* NewExpression */, fullStart);
+ var node = createNode(193 /* NewExpression */, fullStart);
node.expression = expression;
node.typeArguments = typeArguments;
if (node.typeArguments || token() === 20 /* OpenParenToken */) {
@@ -20817,7 +20972,7 @@
}
// STATEMENTS
function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) {
- var node = createNode(218 /* Block */);
+ var node = createNode(219 /* Block */);
if (parseExpected(18 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) {
if (scanner.hasPrecedingLineBreak()) {
node.multiLine = true;
@@ -20850,25 +21005,25 @@
return block;
}
function parseEmptyStatement() {
- var node = createNode(220 /* EmptyStatement */);
+ var node = createNode(221 /* EmptyStatement */);
parseExpected(26 /* SemicolonToken */);
return finishNode(node);
}
function parseIfStatement() {
- var node = createNode(222 /* IfStatement */);
- parseExpected(91 /* IfKeyword */);
+ var node = createNode(223 /* IfStatement */);
+ parseExpected(92 /* IfKeyword */);
parseExpected(20 /* OpenParenToken */);
node.expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
node.thenStatement = parseStatement();
- node.elseStatement = parseOptional(83 /* ElseKeyword */) ? parseStatement() : undefined;
+ node.elseStatement = parseOptional(84 /* ElseKeyword */) ? parseStatement() : undefined;
return finishNode(node);
}
function parseDoStatement() {
- var node = createNode(223 /* DoStatement */);
- parseExpected(82 /* DoKeyword */);
+ var node = createNode(224 /* DoStatement */);
+ parseExpected(83 /* DoKeyword */);
node.statement = parseStatement();
- parseExpected(107 /* WhileKeyword */);
+ parseExpected(108 /* WhileKeyword */);
parseExpected(20 /* OpenParenToken */);
node.expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
@@ -20880,8 +21035,8 @@
return finishNode(node);
}
function parseWhileStatement() {
- var node = createNode(224 /* WhileStatement */);
- parseExpected(107 /* WhileKeyword */);
+ var node = createNode(225 /* WhileStatement */);
+ parseExpected(108 /* WhileKeyword */);
parseExpected(20 /* OpenParenToken */);
node.expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
@@ -20890,12 +21045,12 @@
}
function parseForOrForInOrForOfStatement() {
var pos = getNodePos();
- parseExpected(89 /* ForKeyword */);
- var awaitToken = parseOptionalToken(122 /* AwaitKeyword */);
+ parseExpected(90 /* ForKeyword */);
+ var awaitToken = parseOptionalToken(123 /* AwaitKeyword */);
parseExpected(20 /* OpenParenToken */);
var initializer;
if (token() !== 26 /* SemicolonToken */) {
- if (token() === 105 /* VarKeyword */ || token() === 111 /* LetKeyword */ || token() === 77 /* ConstKeyword */) {
+ if (token() === 106 /* VarKeyword */ || token() === 112 /* LetKeyword */ || token() === 78 /* ConstKeyword */) {
initializer = parseVariableDeclarationList(/*inForStatementInitializer*/ true);
}
else {
@@ -20903,23 +21058,23 @@
}
}
var forOrForInOrForOfStatement;
- if (awaitToken ? parseExpected(147 /* OfKeyword */) : parseOptional(147 /* OfKeyword */)) {
- var forOfStatement = createNode(227 /* ForOfStatement */, pos);
+ if (awaitToken ? parseExpected(148 /* OfKeyword */) : parseOptional(148 /* OfKeyword */)) {
+ var forOfStatement = createNode(228 /* ForOfStatement */, pos);
forOfStatement.awaitModifier = awaitToken;
forOfStatement.initializer = initializer;
forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher);
parseExpected(21 /* CloseParenToken */);
forOrForInOrForOfStatement = forOfStatement;
}
- else if (parseOptional(93 /* InKeyword */)) {
- var forInStatement = createNode(226 /* ForInStatement */, pos);
+ else if (parseOptional(94 /* InKeyword */)) {
+ var forInStatement = createNode(227 /* ForInStatement */, pos);
forInStatement.initializer = initializer;
forInStatement.expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
forOrForInOrForOfStatement = forInStatement;
}
else {
- var forStatement = createNode(225 /* ForStatement */, pos);
+ var forStatement = createNode(226 /* ForStatement */, pos);
forStatement.initializer = initializer;
parseExpected(26 /* SemicolonToken */);
if (token() !== 26 /* SemicolonToken */ && token() !== 21 /* CloseParenToken */) {
@@ -20937,7 +21092,7 @@
}
function parseBreakOrContinueStatement(kind) {
var node = createNode(kind);
- parseExpected(kind === 229 /* BreakStatement */ ? 73 /* BreakKeyword */ : 78 /* ContinueKeyword */);
+ parseExpected(kind === 230 /* BreakStatement */ ? 74 /* BreakKeyword */ : 79 /* ContinueKeyword */);
if (!canParseSemicolon()) {
node.label = parseIdentifier();
}
@@ -20945,8 +21100,8 @@
return finishNode(node);
}
function parseReturnStatement() {
- var node = createNode(230 /* ReturnStatement */);
- parseExpected(97 /* ReturnKeyword */);
+ var node = createNode(231 /* ReturnStatement */);
+ parseExpected(98 /* ReturnKeyword */);
if (!canParseSemicolon()) {
node.expression = allowInAnd(parseExpression);
}
@@ -20954,8 +21109,8 @@
return finishNode(node);
}
function parseWithStatement() {
- var node = createNode(231 /* WithStatement */);
- parseExpected(108 /* WithKeyword */);
+ var node = createNode(232 /* WithStatement */);
+ parseExpected(109 /* WithKeyword */);
parseExpected(20 /* OpenParenToken */);
node.expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
@@ -20963,30 +21118,30 @@
return finishNode(node);
}
function parseCaseClause() {
- var node = createNode(271 /* CaseClause */);
- parseExpected(74 /* CaseKeyword */);
+ var node = createNode(272 /* CaseClause */);
+ parseExpected(75 /* CaseKeyword */);
node.expression = allowInAnd(parseExpression);
parseExpected(57 /* ColonToken */);
node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement);
return finishNode(node);
}
function parseDefaultClause() {
- var node = createNode(272 /* DefaultClause */);
- parseExpected(80 /* DefaultKeyword */);
+ var node = createNode(273 /* DefaultClause */);
+ parseExpected(81 /* DefaultKeyword */);
parseExpected(57 /* ColonToken */);
node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement);
return finishNode(node);
}
function parseCaseOrDefaultClause() {
- return token() === 74 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause();
+ return token() === 75 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause();
}
function parseSwitchStatement() {
- var node = createNode(232 /* SwitchStatement */);
- parseExpected(99 /* SwitchKeyword */);
+ var node = createNode(233 /* SwitchStatement */);
+ parseExpected(100 /* SwitchKeyword */);
parseExpected(20 /* OpenParenToken */);
node.expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
- var caseBlock = createNode(246 /* CaseBlock */);
+ var caseBlock = createNode(247 /* CaseBlock */);
parseExpected(18 /* OpenBraceToken */);
caseBlock.clauses = parseList(2 /* SwitchClauses */, parseCaseOrDefaultClause);
parseExpected(19 /* CloseBraceToken */);
@@ -21001,29 +21156,29 @@
// directly as that might consume an expression on the following line.
// We just return 'undefined' in that case. The actual error will be reported in the
// grammar walker.
- var node = createNode(234 /* ThrowStatement */);
- parseExpected(101 /* ThrowKeyword */);
+ var node = createNode(235 /* ThrowStatement */);
+ parseExpected(102 /* ThrowKeyword */);
node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression);
parseSemicolon();
return finishNode(node);
}
// TODO: Review for error recovery
function parseTryStatement() {
- var node = createNode(235 /* TryStatement */);
- parseExpected(103 /* TryKeyword */);
+ var node = createNode(236 /* TryStatement */);
+ parseExpected(104 /* TryKeyword */);
node.tryBlock = parseBlock(/*ignoreMissingOpenBrace*/ false);
- node.catchClause = token() === 75 /* CatchKeyword */ ? parseCatchClause() : undefined;
+ node.catchClause = token() === 76 /* CatchKeyword */ ? parseCatchClause() : undefined;
// If we don't have a catch clause, then we must have a finally clause. Try to parse
// one out no matter what.
- if (!node.catchClause || token() === 88 /* FinallyKeyword */) {
- parseExpected(88 /* FinallyKeyword */);
+ if (!node.catchClause || token() === 89 /* FinallyKeyword */) {
+ parseExpected(89 /* FinallyKeyword */);
node.finallyBlock = parseBlock(/*ignoreMissingOpenBrace*/ false);
}
return finishNode(node);
}
function parseCatchClause() {
- var result = createNode(274 /* CatchClause */);
- parseExpected(75 /* CatchKeyword */);
+ var result = createNode(275 /* CatchClause */);
+ parseExpected(76 /* CatchKeyword */);
if (parseOptional(20 /* OpenParenToken */)) {
result.variableDeclaration = parseVariableDeclaration();
parseExpected(21 /* CloseParenToken */);
@@ -21036,8 +21191,8 @@
return finishNode(result);
}
function parseDebuggerStatement() {
- var node = createNode(236 /* DebuggerStatement */);
- parseExpected(79 /* DebuggerKeyword */);
+ var node = createNode(237 /* DebuggerStatement */);
+ parseExpected(80 /* DebuggerKeyword */);
parseSemicolon();
return finishNode(node);
}
@@ -21047,13 +21202,13 @@
// a colon.
var node = createNodeWithJSDoc(0 /* Unknown */);
var expression = allowInAnd(parseExpression);
- if (expression.kind === 72 /* Identifier */ && parseOptional(57 /* ColonToken */)) {
- node.kind = 233 /* LabeledStatement */;
+ if (expression.kind === 73 /* Identifier */ && parseOptional(57 /* ColonToken */)) {
+ node.kind = 234 /* LabeledStatement */;
node.label = expression;
node.statement = parseStatement();
}
else {
- node.kind = 221 /* ExpressionStatement */;
+ node.kind = 222 /* ExpressionStatement */;
node.expression = expression;
parseSemicolon();
}
@@ -21065,11 +21220,11 @@
}
function nextTokenIsClassKeywordOnSameLine() {
nextToken();
- return token() === 76 /* ClassKeyword */ && !scanner.hasPrecedingLineBreak();
+ return token() === 77 /* ClassKeyword */ && !scanner.hasPrecedingLineBreak();
}
function nextTokenIsFunctionKeywordOnSameLine() {
nextToken();
- return token() === 90 /* FunctionKeyword */ && !scanner.hasPrecedingLineBreak();
+ return token() === 91 /* FunctionKeyword */ && !scanner.hasPrecedingLineBreak();
}
function nextTokenIsIdentifierOrKeywordOrLiteralOnSameLine() {
nextToken();
@@ -21078,12 +21233,12 @@
function isDeclaration() {
while (true) {
switch (token()) {
- case 105 /* VarKeyword */:
- case 111 /* LetKeyword */:
- case 77 /* ConstKeyword */:
- case 90 /* FunctionKeyword */:
- case 76 /* ClassKeyword */:
- case 84 /* EnumKeyword */:
+ case 106 /* VarKeyword */:
+ case 112 /* LetKeyword */:
+ case 78 /* ConstKeyword */:
+ case 91 /* FunctionKeyword */:
+ case 77 /* ClassKeyword */:
+ case 85 /* EnumKeyword */:
return true;
// 'declare', 'module', 'namespace', 'interface'* and 'type' are all legal JavaScript identifiers;
// however, an identifier cannot be followed by another identifier on the same line. This is what we
@@ -21106,41 +21261,41 @@
// I {}
//
// could be legal, it would add complexity for very little gain.
- case 110 /* InterfaceKeyword */:
- case 140 /* TypeKeyword */:
+ case 111 /* InterfaceKeyword */:
+ case 141 /* TypeKeyword */:
return nextTokenIsIdentifierOnSameLine();
- case 130 /* ModuleKeyword */:
- case 131 /* NamespaceKeyword */:
+ case 131 /* ModuleKeyword */:
+ case 132 /* NamespaceKeyword */:
return nextTokenIsIdentifierOrStringLiteralOnSameLine();
- case 118 /* AbstractKeyword */:
- case 121 /* AsyncKeyword */:
- case 125 /* DeclareKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 115 /* PublicKeyword */:
- case 133 /* ReadonlyKeyword */:
+ case 119 /* AbstractKeyword */:
+ case 122 /* AsyncKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 116 /* PublicKeyword */:
+ case 134 /* ReadonlyKeyword */:
nextToken();
// ASI takes effect for this modifier.
if (scanner.hasPrecedingLineBreak()) {
return false;
}
continue;
- case 145 /* GlobalKeyword */:
+ case 146 /* GlobalKeyword */:
nextToken();
- return token() === 18 /* OpenBraceToken */ || token() === 72 /* Identifier */ || token() === 85 /* ExportKeyword */;
- case 92 /* ImportKeyword */:
+ return token() === 18 /* OpenBraceToken */ || token() === 73 /* Identifier */ || token() === 86 /* ExportKeyword */;
+ case 93 /* ImportKeyword */:
nextToken();
return token() === 10 /* StringLiteral */ || token() === 40 /* AsteriskToken */ ||
token() === 18 /* OpenBraceToken */ || ts.tokenIsIdentifierOrKeyword(token());
- case 85 /* ExportKeyword */:
+ case 86 /* ExportKeyword */:
nextToken();
- if (token() === 59 /* EqualsToken */ || token() === 40 /* AsteriskToken */ ||
- token() === 18 /* OpenBraceToken */ || token() === 80 /* DefaultKeyword */ ||
- token() === 119 /* AsKeyword */) {
+ if (token() === 60 /* EqualsToken */ || token() === 40 /* AsteriskToken */ ||
+ token() === 18 /* OpenBraceToken */ || token() === 81 /* DefaultKeyword */ ||
+ token() === 120 /* AsKeyword */) {
return true;
}
continue;
- case 116 /* StaticKeyword */:
+ case 117 /* StaticKeyword */:
nextToken();
continue;
default:
@@ -21156,47 +21311,47 @@
case 58 /* AtToken */:
case 26 /* SemicolonToken */:
case 18 /* OpenBraceToken */:
- case 105 /* VarKeyword */:
- case 111 /* LetKeyword */:
- case 90 /* FunctionKeyword */:
- case 76 /* ClassKeyword */:
- case 84 /* EnumKeyword */:
- case 91 /* IfKeyword */:
- case 82 /* DoKeyword */:
- case 107 /* WhileKeyword */:
- case 89 /* ForKeyword */:
- case 78 /* ContinueKeyword */:
- case 73 /* BreakKeyword */:
- case 97 /* ReturnKeyword */:
- case 108 /* WithKeyword */:
- case 99 /* SwitchKeyword */:
- case 101 /* ThrowKeyword */:
- case 103 /* TryKeyword */:
- case 79 /* DebuggerKeyword */:
+ case 106 /* VarKeyword */:
+ case 112 /* LetKeyword */:
+ case 91 /* FunctionKeyword */:
+ case 77 /* ClassKeyword */:
+ case 85 /* EnumKeyword */:
+ case 92 /* IfKeyword */:
+ case 83 /* DoKeyword */:
+ case 108 /* WhileKeyword */:
+ case 90 /* ForKeyword */:
+ case 79 /* ContinueKeyword */:
+ case 74 /* BreakKeyword */:
+ case 98 /* ReturnKeyword */:
+ case 109 /* WithKeyword */:
+ case 100 /* SwitchKeyword */:
+ case 102 /* ThrowKeyword */:
+ case 104 /* TryKeyword */:
+ case 80 /* DebuggerKeyword */:
// 'catch' and 'finally' do not actually indicate that the code is part of a statement,
// however, we say they are here so that we may gracefully parse them and error later.
- case 75 /* CatchKeyword */:
- case 88 /* FinallyKeyword */:
+ case 76 /* CatchKeyword */:
+ case 89 /* FinallyKeyword */:
return true;
- case 92 /* ImportKeyword */:
+ case 93 /* ImportKeyword */:
return isStartOfDeclaration() || lookAhead(nextTokenIsOpenParenOrLessThanOrDot);
- case 77 /* ConstKeyword */:
- case 85 /* ExportKeyword */:
+ case 78 /* ConstKeyword */:
+ case 86 /* ExportKeyword */:
return isStartOfDeclaration();
- case 121 /* AsyncKeyword */:
- case 125 /* DeclareKeyword */:
- case 110 /* InterfaceKeyword */:
- case 130 /* ModuleKeyword */:
- case 131 /* NamespaceKeyword */:
- case 140 /* TypeKeyword */:
- case 145 /* GlobalKeyword */:
+ case 122 /* AsyncKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 111 /* InterfaceKeyword */:
+ case 131 /* ModuleKeyword */:
+ case 132 /* NamespaceKeyword */:
+ case 141 /* TypeKeyword */:
+ case 146 /* GlobalKeyword */:
// When these don't start a declaration, they're an identifier in an expression statement
return true;
- case 115 /* PublicKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 116 /* StaticKeyword */:
- case 133 /* ReadonlyKeyword */:
+ case 116 /* PublicKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 117 /* StaticKeyword */:
+ case 134 /* ReadonlyKeyword */:
// When these don't start a declaration, they may be the start of a class member if an identifier
// immediately follows. Otherwise they're an identifier in an expression statement.
return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine);
@@ -21219,63 +21374,63 @@
return parseEmptyStatement();
case 18 /* OpenBraceToken */:
return parseBlock(/*ignoreMissingOpenBrace*/ false);
- case 105 /* VarKeyword */:
- return parseVariableStatement(createNodeWithJSDoc(237 /* VariableDeclaration */));
- case 111 /* LetKeyword */:
+ case 106 /* VarKeyword */:
+ return parseVariableStatement(createNodeWithJSDoc(238 /* VariableDeclaration */));
+ case 112 /* LetKeyword */:
if (isLetDeclaration()) {
- return parseVariableStatement(createNodeWithJSDoc(237 /* VariableDeclaration */));
+ return parseVariableStatement(createNodeWithJSDoc(238 /* VariableDeclaration */));
}
break;
- case 90 /* FunctionKeyword */:
- return parseFunctionDeclaration(createNodeWithJSDoc(239 /* FunctionDeclaration */));
- case 76 /* ClassKeyword */:
- return parseClassDeclaration(createNodeWithJSDoc(240 /* ClassDeclaration */));
- case 91 /* IfKeyword */:
+ case 91 /* FunctionKeyword */:
+ return parseFunctionDeclaration(createNodeWithJSDoc(240 /* FunctionDeclaration */));
+ case 77 /* ClassKeyword */:
+ return parseClassDeclaration(createNodeWithJSDoc(241 /* ClassDeclaration */));
+ case 92 /* IfKeyword */:
return parseIfStatement();
- case 82 /* DoKeyword */:
+ case 83 /* DoKeyword */:
return parseDoStatement();
- case 107 /* WhileKeyword */:
+ case 108 /* WhileKeyword */:
return parseWhileStatement();
- case 89 /* ForKeyword */:
+ case 90 /* ForKeyword */:
return parseForOrForInOrForOfStatement();
- case 78 /* ContinueKeyword */:
- return parseBreakOrContinueStatement(228 /* ContinueStatement */);
- case 73 /* BreakKeyword */:
- return parseBreakOrContinueStatement(229 /* BreakStatement */);
- case 97 /* ReturnKeyword */:
+ case 79 /* ContinueKeyword */:
+ return parseBreakOrContinueStatement(229 /* ContinueStatement */);
+ case 74 /* BreakKeyword */:
+ return parseBreakOrContinueStatement(230 /* BreakStatement */);
+ case 98 /* ReturnKeyword */:
return parseReturnStatement();
- case 108 /* WithKeyword */:
+ case 109 /* WithKeyword */:
return parseWithStatement();
- case 99 /* SwitchKeyword */:
+ case 100 /* SwitchKeyword */:
return parseSwitchStatement();
- case 101 /* ThrowKeyword */:
+ case 102 /* ThrowKeyword */:
return parseThrowStatement();
- case 103 /* TryKeyword */:
+ case 104 /* TryKeyword */:
// Include 'catch' and 'finally' for error recovery.
- case 75 /* CatchKeyword */:
- case 88 /* FinallyKeyword */:
+ case 76 /* CatchKeyword */:
+ case 89 /* FinallyKeyword */:
return parseTryStatement();
- case 79 /* DebuggerKeyword */:
+ case 80 /* DebuggerKeyword */:
return parseDebuggerStatement();
case 58 /* AtToken */:
return parseDeclaration();
- case 121 /* AsyncKeyword */:
- case 110 /* InterfaceKeyword */:
- case 140 /* TypeKeyword */:
- case 130 /* ModuleKeyword */:
- case 131 /* NamespaceKeyword */:
- case 125 /* DeclareKeyword */:
- case 77 /* ConstKeyword */:
- case 84 /* EnumKeyword */:
- case 85 /* ExportKeyword */:
- case 92 /* ImportKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 115 /* PublicKeyword */:
- case 118 /* AbstractKeyword */:
- case 116 /* StaticKeyword */:
- case 133 /* ReadonlyKeyword */:
- case 145 /* GlobalKeyword */:
+ case 122 /* AsyncKeyword */:
+ case 111 /* InterfaceKeyword */:
+ case 141 /* TypeKeyword */:
+ case 131 /* ModuleKeyword */:
+ case 132 /* NamespaceKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 78 /* ConstKeyword */:
+ case 85 /* EnumKeyword */:
+ case 86 /* ExportKeyword */:
+ case 93 /* ImportKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 116 /* PublicKeyword */:
+ case 119 /* AbstractKeyword */:
+ case 117 /* StaticKeyword */:
+ case 134 /* ReadonlyKeyword */:
+ case 146 /* GlobalKeyword */:
if (isStartOfDeclaration()) {
return parseDeclaration();
}
@@ -21284,7 +21439,7 @@
return parseExpressionOrLabeledStatement();
}
function isDeclareModifier(modifier) {
- return modifier.kind === 125 /* DeclareKeyword */;
+ return modifier.kind === 126 /* DeclareKeyword */;
}
function parseDeclaration() {
var node = createNodeWithJSDoc(0 /* Unknown */);
@@ -21303,33 +21458,33 @@
}
function parseDeclarationWorker(node) {
switch (token()) {
- case 105 /* VarKeyword */:
- case 111 /* LetKeyword */:
- case 77 /* ConstKeyword */:
+ case 106 /* VarKeyword */:
+ case 112 /* LetKeyword */:
+ case 78 /* ConstKeyword */:
return parseVariableStatement(node);
- case 90 /* FunctionKeyword */:
+ case 91 /* FunctionKeyword */:
return parseFunctionDeclaration(node);
- case 76 /* ClassKeyword */:
+ case 77 /* ClassKeyword */:
return parseClassDeclaration(node);
- case 110 /* InterfaceKeyword */:
+ case 111 /* InterfaceKeyword */:
return parseInterfaceDeclaration(node);
- case 140 /* TypeKeyword */:
+ case 141 /* TypeKeyword */:
return parseTypeAliasDeclaration(node);
- case 84 /* EnumKeyword */:
+ case 85 /* EnumKeyword */:
return parseEnumDeclaration(node);
- case 145 /* GlobalKeyword */:
- case 130 /* ModuleKeyword */:
- case 131 /* NamespaceKeyword */:
+ case 146 /* GlobalKeyword */:
+ case 131 /* ModuleKeyword */:
+ case 132 /* NamespaceKeyword */:
return parseModuleDeclaration(node);
- case 92 /* ImportKeyword */:
+ case 93 /* ImportKeyword */:
return parseImportDeclarationOrImportEqualsDeclaration(node);
- case 85 /* ExportKeyword */:
+ case 86 /* ExportKeyword */:
nextToken();
switch (token()) {
- case 80 /* DefaultKeyword */:
- case 59 /* EqualsToken */:
+ case 81 /* DefaultKeyword */:
+ case 60 /* EqualsToken */:
return parseExportAssignment(node);
- case 119 /* AsKeyword */:
+ case 120 /* AsKeyword */:
return parseNamespaceExportDeclaration(node);
default:
return parseExportDeclaration(node);
@@ -21338,7 +21493,7 @@
if (node.decorators || node.modifiers) {
// We reached this point because we encountered decorators and/or modifiers and assumed a declaration
// would follow. For recovery and error reporting purposes, return an incomplete declaration.
- var missing = createMissingNode(258 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected);
+ var missing = createMissingNode(259 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected);
missing.pos = node.pos;
missing.decorators = node.decorators;
missing.modifiers = node.modifiers;
@@ -21361,16 +21516,16 @@
// DECLARATIONS
function parseArrayBindingElement() {
if (token() === 27 /* CommaToken */) {
- return createNode(210 /* OmittedExpression */);
+ return createNode(211 /* OmittedExpression */);
}
- var node = createNode(186 /* BindingElement */);
+ var node = createNode(187 /* BindingElement */);
node.dotDotDotToken = parseOptionalToken(25 /* DotDotDotToken */);
node.name = parseIdentifierOrPattern();
node.initializer = parseInitializer();
return finishNode(node);
}
function parseObjectBindingElement() {
- var node = createNode(186 /* BindingElement */);
+ var node = createNode(187 /* BindingElement */);
node.dotDotDotToken = parseOptionalToken(25 /* DotDotDotToken */);
var tokenIsIdentifier = isIdentifier();
var propertyName = parsePropertyName();
@@ -21386,14 +21541,14 @@
return finishNode(node);
}
function parseObjectBindingPattern() {
- var node = createNode(184 /* ObjectBindingPattern */);
+ var node = createNode(185 /* ObjectBindingPattern */);
parseExpected(18 /* OpenBraceToken */);
node.elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement);
parseExpected(19 /* CloseBraceToken */);
return finishNode(node);
}
function parseArrayBindingPattern() {
- var node = createNode(185 /* ArrayBindingPattern */);
+ var node = createNode(186 /* ArrayBindingPattern */);
parseExpected(22 /* OpenBracketToken */);
node.elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement);
parseExpected(23 /* CloseBracketToken */);
@@ -21415,9 +21570,9 @@
return parseVariableDeclaration(/*allowExclamation*/ true);
}
function parseVariableDeclaration(allowExclamation) {
- var node = createNode(237 /* VariableDeclaration */);
+ var node = createNode(238 /* VariableDeclaration */);
node.name = parseIdentifierOrPattern();
- if (allowExclamation && node.name.kind === 72 /* Identifier */ &&
+ if (allowExclamation && node.name.kind === 73 /* Identifier */ &&
token() === 52 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) {
node.exclamationToken = parseTokenNode();
}
@@ -21428,14 +21583,14 @@
return finishNode(node);
}
function parseVariableDeclarationList(inForStatementInitializer) {
- var node = createNode(238 /* VariableDeclarationList */);
+ var node = createNode(239 /* VariableDeclarationList */);
switch (token()) {
- case 105 /* VarKeyword */:
+ case 106 /* VarKeyword */:
break;
- case 111 /* LetKeyword */:
+ case 112 /* LetKeyword */:
node.flags |= 1 /* Let */;
break;
- case 77 /* ConstKeyword */:
+ case 78 /* ConstKeyword */:
node.flags |= 2 /* Const */;
break;
default:
@@ -21451,7 +21606,7 @@
// So we need to look ahead to determine if 'of' should be treated as a keyword in
// this context.
// The checker will then give an error that there is an empty declaration list.
- if (token() === 147 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) {
+ if (token() === 148 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) {
node.declarations = createMissingList();
}
else {
@@ -21466,14 +21621,14 @@
return nextTokenIsIdentifier() && nextToken() === 21 /* CloseParenToken */;
}
function parseVariableStatement(node) {
- node.kind = 219 /* VariableStatement */;
+ node.kind = 220 /* VariableStatement */;
node.declarationList = parseVariableDeclarationList(/*inForStatementInitializer*/ false);
parseSemicolon();
return finishNode(node);
}
function parseFunctionDeclaration(node) {
- node.kind = 239 /* FunctionDeclaration */;
- parseExpected(90 /* FunctionKeyword */);
+ node.kind = 240 /* FunctionDeclaration */;
+ parseExpected(91 /* FunctionKeyword */);
node.asteriskToken = parseOptionalToken(40 /* AsteriskToken */);
node.name = ts.hasModifier(node, 512 /* Default */) ? parseOptionalIdentifier() : parseIdentifier();
var isGenerator = node.asteriskToken ? 1 /* Yield */ : 0 /* None */;
@@ -21483,14 +21638,14 @@
return finishNode(node);
}
function parseConstructorDeclaration(node) {
- node.kind = 157 /* Constructor */;
- parseExpected(124 /* ConstructorKeyword */);
+ node.kind = 158 /* Constructor */;
+ parseExpected(125 /* ConstructorKeyword */);
fillSignature(57 /* ColonToken */, 0 /* None */, node);
node.body = parseFunctionBlockOrSemicolon(0 /* None */, ts.Diagnostics.or_expected);
return finishNode(node);
}
function parseMethodDeclaration(node, asteriskToken, diagnosticMessage) {
- node.kind = 156 /* MethodDeclaration */;
+ node.kind = 157 /* MethodDeclaration */;
node.asteriskToken = asteriskToken;
var isGenerator = asteriskToken ? 1 /* Yield */ : 0 /* None */;
var isAsync = ts.hasModifier(node, 256 /* Async */) ? 2 /* Await */ : 0 /* None */;
@@ -21499,7 +21654,7 @@
return finishNode(node);
}
function parsePropertyDeclaration(node) {
- node.kind = 154 /* PropertyDeclaration */;
+ node.kind = 155 /* PropertyDeclaration */;
if (!node.questionToken && token() === 52 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) {
node.exclamationToken = parseTokenNode();
}
@@ -21572,7 +21727,7 @@
// If we were able to get any potential identifier...
if (idToken !== undefined) {
// If we have a non-keyword identifier, or if we have an accessor, then it's safe to parse.
- if (!ts.isKeyword(idToken) || idToken === 137 /* SetKeyword */ || idToken === 126 /* GetKeyword */) {
+ if (!ts.isKeyword(idToken) || idToken === 138 /* SetKeyword */ || idToken === 127 /* GetKeyword */) {
return true;
}
// If it *is* a keyword, but not an accessor, check a little farther along
@@ -21582,7 +21737,7 @@
case 28 /* LessThanToken */: // Generic Method declaration
case 52 /* ExclamationToken */: // Non-null assertion on property name
case 57 /* ColonToken */: // Type Annotation for declaration
- case 59 /* EqualsToken */: // Initializer for declaration
+ case 60 /* EqualsToken */: // Initializer for declaration
case 56 /* QuestionToken */: // Not valid, but permitted so that it gets caught later on.
return true;
default:
@@ -21604,7 +21759,7 @@
if (!parseOptional(58 /* AtToken */)) {
break;
}
- var decorator = createNode(152 /* Decorator */, decoratorStart);
+ var decorator = createNode(153 /* Decorator */, decoratorStart);
decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher);
finishNode(decorator);
(list || (list = [])).push(decorator);
@@ -21624,7 +21779,7 @@
while (true) {
var modifierStart = scanner.getStartPos();
var modifierKind = token();
- if (token() === 77 /* ConstKeyword */ && permitInvalidConstAsModifier) {
+ if (token() === 78 /* ConstKeyword */ && permitInvalidConstAsModifier) {
// We need to ensure that any subsequent modifiers appear on the same line
// so that when 'const' is a standalone declaration, we don't issue an error.
if (!tryParse(nextTokenIsOnSameLineAndCanFollowModifier)) {
@@ -21643,7 +21798,7 @@
}
function parseModifiersForArrowFunction() {
var modifiers;
- if (token() === 121 /* AsyncKeyword */) {
+ if (token() === 122 /* AsyncKeyword */) {
var modifierStart = scanner.getStartPos();
var modifierKind = token();
nextToken();
@@ -21654,20 +21809,20 @@
}
function parseClassElement() {
if (token() === 26 /* SemicolonToken */) {
- var result = createNode(217 /* SemicolonClassElement */);
+ var result = createNode(218 /* SemicolonClassElement */);
nextToken();
return finishNode(result);
}
var node = createNodeWithJSDoc(0 /* Unknown */);
node.decorators = parseDecorators();
node.modifiers = parseModifiers(/*permitInvalidConstAsModifier*/ true);
- if (parseContextualModifier(126 /* GetKeyword */)) {
- return parseAccessorDeclaration(node, 158 /* GetAccessor */);
+ if (parseContextualModifier(127 /* GetKeyword */)) {
+ return parseAccessorDeclaration(node, 159 /* GetAccessor */);
}
- if (parseContextualModifier(137 /* SetKeyword */)) {
- return parseAccessorDeclaration(node, 159 /* SetAccessor */);
+ if (parseContextualModifier(138 /* SetKeyword */)) {
+ return parseAccessorDeclaration(node, 160 /* SetAccessor */);
}
- if (token() === 124 /* ConstructorKeyword */) {
+ if (token() === 125 /* ConstructorKeyword */) {
return parseConstructorDeclaration(node);
}
if (isIndexSignature()) {
@@ -21684,21 +21839,21 @@
}
if (node.decorators || node.modifiers) {
// treat this as a property declaration with a missing name.
- node.name = createMissingNode(72 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected);
+ node.name = createMissingNode(73 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected);
return parsePropertyDeclaration(node);
}
// 'isClassMemberStart' should have hinted not to attempt parsing.
return ts.Debug.fail("Should not have attempted to parse class member declaration.");
}
function parseClassExpression() {
- return parseClassDeclarationOrExpression(createNodeWithJSDoc(0 /* Unknown */), 209 /* ClassExpression */);
+ return parseClassDeclarationOrExpression(createNodeWithJSDoc(0 /* Unknown */), 210 /* ClassExpression */);
}
function parseClassDeclaration(node) {
- return parseClassDeclarationOrExpression(node, 240 /* ClassDeclaration */);
+ return parseClassDeclarationOrExpression(node, 241 /* ClassDeclaration */);
}
function parseClassDeclarationOrExpression(node, kind) {
node.kind = kind;
- parseExpected(76 /* ClassKeyword */);
+ parseExpected(77 /* ClassKeyword */);
node.name = parseNameOfClassDeclarationOrExpression();
node.typeParameters = parseTypeParameters();
node.heritageClauses = parseHeritageClauses();
@@ -21724,7 +21879,7 @@
: undefined;
}
function isImplementsClause() {
- return token() === 109 /* ImplementsKeyword */ && lookAhead(nextTokenIsIdentifierOrKeyword);
+ return token() === 110 /* ImplementsKeyword */ && lookAhead(nextTokenIsIdentifierOrKeyword);
}
function parseHeritageClauses() {
// ClassTail[Yield,Await] : (Modified) See 14.5
@@ -21736,15 +21891,15 @@
}
function parseHeritageClause() {
var tok = token();
- ts.Debug.assert(tok === 86 /* ExtendsKeyword */ || tok === 109 /* ImplementsKeyword */); // isListElement() should ensure this.
- var node = createNode(273 /* HeritageClause */);
+ ts.Debug.assert(tok === 87 /* ExtendsKeyword */ || tok === 110 /* ImplementsKeyword */); // isListElement() should ensure this.
+ var node = createNode(274 /* HeritageClause */);
node.token = tok;
nextToken();
node.types = parseDelimitedList(7 /* HeritageClauseElement */, parseExpressionWithTypeArguments);
return finishNode(node);
}
function parseExpressionWithTypeArguments() {
- var node = createNode(211 /* ExpressionWithTypeArguments */);
+ var node = createNode(212 /* ExpressionWithTypeArguments */);
node.expression = parseLeftHandSideExpressionOrHigher();
node.typeArguments = tryParseTypeArguments();
return finishNode(node);
@@ -21755,14 +21910,14 @@
: undefined;
}
function isHeritageClause() {
- return token() === 86 /* ExtendsKeyword */ || token() === 109 /* ImplementsKeyword */;
+ return token() === 87 /* ExtendsKeyword */ || token() === 110 /* ImplementsKeyword */;
}
function parseClassMembers() {
return parseList(5 /* ClassMembers */, parseClassElement);
}
function parseInterfaceDeclaration(node) {
- node.kind = 241 /* InterfaceDeclaration */;
- parseExpected(110 /* InterfaceKeyword */);
+ node.kind = 242 /* InterfaceDeclaration */;
+ parseExpected(111 /* InterfaceKeyword */);
node.name = parseIdentifier();
node.typeParameters = parseTypeParameters();
node.heritageClauses = parseHeritageClauses();
@@ -21770,11 +21925,11 @@
return finishNode(node);
}
function parseTypeAliasDeclaration(node) {
- node.kind = 242 /* TypeAliasDeclaration */;
- parseExpected(140 /* TypeKeyword */);
+ node.kind = 243 /* TypeAliasDeclaration */;
+ parseExpected(141 /* TypeKeyword */);
node.name = parseIdentifier();
node.typeParameters = parseTypeParameters();
- parseExpected(59 /* EqualsToken */);
+ parseExpected(60 /* EqualsToken */);
node.type = parseType();
parseSemicolon();
return finishNode(node);
@@ -21784,14 +21939,14 @@
// ConstantEnumMemberSection, which starts at the beginning of an enum declaration
// or any time an integer literal initializer is encountered.
function parseEnumMember() {
- var node = createNodeWithJSDoc(278 /* EnumMember */);
+ var node = createNodeWithJSDoc(279 /* EnumMember */);
node.name = parsePropertyName();
node.initializer = allowInAnd(parseInitializer);
return finishNode(node);
}
function parseEnumDeclaration(node) {
- node.kind = 243 /* EnumDeclaration */;
- parseExpected(84 /* EnumKeyword */);
+ node.kind = 244 /* EnumDeclaration */;
+ parseExpected(85 /* EnumKeyword */);
node.name = parseIdentifier();
if (parseExpected(18 /* OpenBraceToken */)) {
node.members = parseDelimitedList(6 /* EnumMembers */, parseEnumMember);
@@ -21803,7 +21958,7 @@
return finishNode(node);
}
function parseModuleBlock() {
- var node = createNode(245 /* ModuleBlock */);
+ var node = createNode(246 /* ModuleBlock */);
if (parseExpected(18 /* OpenBraceToken */)) {
node.statements = parseList(1 /* BlockStatements */, parseStatement);
parseExpected(19 /* CloseBraceToken */);
@@ -21814,7 +21969,7 @@
return finishNode(node);
}
function parseModuleOrNamespaceDeclaration(node, flags) {
- node.kind = 244 /* ModuleDeclaration */;
+ node.kind = 245 /* ModuleDeclaration */;
// If we are parsing a dotted namespace name, we want to
// propagate the 'Namespace' flag across the names if set.
var namespaceFlag = flags & 16 /* Namespace */;
@@ -21826,8 +21981,8 @@
return finishNode(node);
}
function parseAmbientExternalModuleDeclaration(node) {
- node.kind = 244 /* ModuleDeclaration */;
- if (token() === 145 /* GlobalKeyword */) {
+ node.kind = 245 /* ModuleDeclaration */;
+ if (token() === 146 /* GlobalKeyword */) {
// parse 'global' as name of global scope augmentation
node.name = parseIdentifier();
node.flags |= 512 /* GlobalAugmentation */;
@@ -21846,15 +22001,15 @@
}
function parseModuleDeclaration(node) {
var flags = 0;
- if (token() === 145 /* GlobalKeyword */) {
+ if (token() === 146 /* GlobalKeyword */) {
// global augmentation
return parseAmbientExternalModuleDeclaration(node);
}
- else if (parseOptional(131 /* NamespaceKeyword */)) {
+ else if (parseOptional(132 /* NamespaceKeyword */)) {
flags |= 16 /* Namespace */;
}
else {
- parseExpected(130 /* ModuleKeyword */);
+ parseExpected(131 /* ModuleKeyword */);
if (token() === 10 /* StringLiteral */) {
return parseAmbientExternalModuleDeclaration(node);
}
@@ -21862,7 +22017,7 @@
return parseModuleOrNamespaceDeclaration(node, flags);
}
function isExternalModuleReference() {
- return token() === 134 /* RequireKeyword */ &&
+ return token() === 135 /* RequireKeyword */ &&
lookAhead(nextTokenIsOpenParen);
}
function nextTokenIsOpenParen() {
@@ -21872,25 +22027,25 @@
return nextToken() === 42 /* SlashToken */;
}
function parseNamespaceExportDeclaration(node) {
- node.kind = 247 /* NamespaceExportDeclaration */;
- parseExpected(119 /* AsKeyword */);
- parseExpected(131 /* NamespaceKeyword */);
+ node.kind = 248 /* NamespaceExportDeclaration */;
+ parseExpected(120 /* AsKeyword */);
+ parseExpected(132 /* NamespaceKeyword */);
node.name = parseIdentifier();
parseSemicolon();
return finishNode(node);
}
function parseImportDeclarationOrImportEqualsDeclaration(node) {
- parseExpected(92 /* ImportKeyword */);
+ parseExpected(93 /* ImportKeyword */);
var afterImportPos = scanner.getStartPos();
var identifier;
if (isIdentifier()) {
identifier = parseIdentifier();
- if (token() !== 27 /* CommaToken */ && token() !== 144 /* FromKeyword */) {
+ if (token() !== 27 /* CommaToken */ && token() !== 145 /* FromKeyword */) {
return parseImportEqualsDeclaration(node, identifier);
}
}
// Import statement
- node.kind = 249 /* ImportDeclaration */;
+ node.kind = 250 /* ImportDeclaration */;
// ImportDeclaration:
// import ImportClause from ModuleSpecifier ;
// import ModuleSpecifier;
@@ -21898,16 +22053,16 @@
token() === 40 /* AsteriskToken */ || // import *
token() === 18 /* OpenBraceToken */) { // import {
node.importClause = parseImportClause(identifier, afterImportPos);
- parseExpected(144 /* FromKeyword */);
+ parseExpected(145 /* FromKeyword */);
}
node.moduleSpecifier = parseModuleSpecifier();
parseSemicolon();
return finishNode(node);
}
function parseImportEqualsDeclaration(node, identifier) {
- node.kind = 248 /* ImportEqualsDeclaration */;
+ node.kind = 249 /* ImportEqualsDeclaration */;
node.name = identifier;
- parseExpected(59 /* EqualsToken */);
+ parseExpected(60 /* EqualsToken */);
node.moduleReference = parseModuleReference();
parseSemicolon();
return finishNode(node);
@@ -21919,7 +22074,7 @@
// NamedImports
// ImportedDefaultBinding, NameSpaceImport
// ImportedDefaultBinding, NamedImports
- var importClause = createNode(250 /* ImportClause */, fullStart);
+ var importClause = createNode(251 /* ImportClause */, fullStart);
if (identifier) {
// ImportedDefaultBinding:
// ImportedBinding
@@ -21929,7 +22084,7 @@
// parse namespace or named imports
if (!importClause.name ||
parseOptional(27 /* CommaToken */)) {
- importClause.namedBindings = token() === 40 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(252 /* NamedImports */);
+ importClause.namedBindings = token() === 40 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(253 /* NamedImports */);
}
return finishNode(importClause);
}
@@ -21939,8 +22094,8 @@
: parseEntityName(/*allowReservedWords*/ false);
}
function parseExternalModuleReference() {
- var node = createNode(259 /* ExternalModuleReference */);
- parseExpected(134 /* RequireKeyword */);
+ var node = createNode(260 /* ExternalModuleReference */);
+ parseExpected(135 /* RequireKeyword */);
parseExpected(20 /* OpenParenToken */);
node.expression = parseModuleSpecifier();
parseExpected(21 /* CloseParenToken */);
@@ -21962,9 +22117,9 @@
function parseNamespaceImport() {
// NameSpaceImport:
// * as ImportedBinding
- var namespaceImport = createNode(251 /* NamespaceImport */);
+ var namespaceImport = createNode(252 /* NamespaceImport */);
parseExpected(40 /* AsteriskToken */);
- parseExpected(119 /* AsKeyword */);
+ parseExpected(120 /* AsKeyword */);
namespaceImport.name = parseIdentifier();
return finishNode(namespaceImport);
}
@@ -21977,14 +22132,14 @@
// ImportsList:
// ImportSpecifier
// ImportsList, ImportSpecifier
- node.elements = parseBracketedList(23 /* ImportOrExportSpecifiers */, kind === 252 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 18 /* OpenBraceToken */, 19 /* CloseBraceToken */);
+ node.elements = parseBracketedList(23 /* ImportOrExportSpecifiers */, kind === 253 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 18 /* OpenBraceToken */, 19 /* CloseBraceToken */);
return finishNode(node);
}
function parseExportSpecifier() {
- return parseImportOrExportSpecifier(257 /* ExportSpecifier */);
+ return parseImportOrExportSpecifier(258 /* ExportSpecifier */);
}
function parseImportSpecifier() {
- return parseImportOrExportSpecifier(253 /* ImportSpecifier */);
+ return parseImportOrExportSpecifier(254 /* ImportSpecifier */);
}
function parseImportOrExportSpecifier(kind) {
var node = createNode(kind);
@@ -21998,9 +22153,9 @@
var checkIdentifierStart = scanner.getTokenPos();
var checkIdentifierEnd = scanner.getTextPos();
var identifierName = parseIdentifierName();
- if (token() === 119 /* AsKeyword */) {
+ if (token() === 120 /* AsKeyword */) {
node.propertyName = identifierName;
- parseExpected(119 /* AsKeyword */);
+ parseExpected(120 /* AsKeyword */);
checkIdentifierIsKeyword = ts.isKeyword(token()) && !isIdentifier();
checkIdentifierStart = scanner.getTokenPos();
checkIdentifierEnd = scanner.getTextPos();
@@ -22009,24 +22164,24 @@
else {
node.name = identifierName;
}
- if (kind === 253 /* ImportSpecifier */ && checkIdentifierIsKeyword) {
+ if (kind === 254 /* ImportSpecifier */ && checkIdentifierIsKeyword) {
parseErrorAt(checkIdentifierStart, checkIdentifierEnd, ts.Diagnostics.Identifier_expected);
}
return finishNode(node);
}
function parseExportDeclaration(node) {
- node.kind = 255 /* ExportDeclaration */;
+ node.kind = 256 /* ExportDeclaration */;
if (parseOptional(40 /* AsteriskToken */)) {
- parseExpected(144 /* FromKeyword */);
+ parseExpected(145 /* FromKeyword */);
node.moduleSpecifier = parseModuleSpecifier();
}
else {
- node.exportClause = parseNamedImportsOrExports(256 /* NamedExports */);
+ node.exportClause = parseNamedImportsOrExports(257 /* NamedExports */);
// It is not uncommon to accidentally omit the 'from' keyword. Additionally, in editing scenarios,
// the 'from' keyword can be parsed as a named export when the export clause is unterminated (i.e. `export { from "moduleName";`)
// If we don't have a 'from' keyword, see if we have a string literal such that ASI won't take effect.
- if (token() === 144 /* FromKeyword */ || (token() === 10 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) {
- parseExpected(144 /* FromKeyword */);
+ if (token() === 145 /* FromKeyword */ || (token() === 10 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) {
+ parseExpected(145 /* FromKeyword */);
node.moduleSpecifier = parseModuleSpecifier();
}
}
@@ -22034,12 +22189,12 @@
return finishNode(node);
}
function parseExportAssignment(node) {
- node.kind = 254 /* ExportAssignment */;
- if (parseOptional(59 /* EqualsToken */)) {
+ node.kind = 255 /* ExportAssignment */;
+ if (parseOptional(60 /* EqualsToken */)) {
node.isExportEquals = true;
}
else {
- parseExpected(80 /* DefaultKeyword */);
+ parseExpected(81 /* DefaultKeyword */);
}
node.expression = parseAssignmentExpressionOrHigher();
parseSemicolon();
@@ -22054,10 +22209,10 @@
}
function isAnExternalModuleIndicatorNode(node) {
return ts.hasModifier(node, 1 /* Export */)
- || node.kind === 248 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 259 /* ExternalModuleReference */
- || node.kind === 249 /* ImportDeclaration */
- || node.kind === 254 /* ExportAssignment */
- || node.kind === 255 /* ExportDeclaration */
+ || node.kind === 249 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 260 /* ExternalModuleReference */
+ || node.kind === 250 /* ImportDeclaration */
+ || node.kind === 255 /* ExportAssignment */
+ || node.kind === 256 /* ExportDeclaration */
? node
: undefined;
}
@@ -22070,7 +22225,7 @@
return isImportMeta(node) ? node : forEachChild(node, walkTreeForExternalModuleIndicators);
}
function isImportMeta(node) {
- return ts.isMetaProperty(node) && node.keywordToken === 92 /* ImportKeyword */ && node.name.escapedText === "meta";
+ return ts.isMetaProperty(node) && node.keywordToken === 93 /* ImportKeyword */ && node.name.escapedText === "meta";
}
var ParsingContext;
(function (ParsingContext) {
@@ -22109,8 +22264,8 @@
var JSDocParser;
(function (JSDocParser) {
function parseJSDocTypeExpressionForTests(content, start, length) {
- initializeState(content, 7 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
- sourceFile = createSourceFile("file.js", 7 /* Latest */, 1 /* JS */, /*isDeclarationFile*/ false);
+ initializeState(content, 8 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
+ sourceFile = createSourceFile("file.js", 8 /* Latest */, 1 /* JS */, /*isDeclarationFile*/ false);
scanner.setText(content, start, length);
currentToken = scanner.scan();
var jsDocTypeExpression = parseJSDocTypeExpression();
@@ -22121,18 +22276,18 @@
JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests;
// Parses out a JSDoc type expression.
function parseJSDocTypeExpression(mayOmitBraces) {
- var result = createNode(288 /* JSDocTypeExpression */);
+ var result = createNode(289 /* JSDocTypeExpression */);
var hasBrace = (mayOmitBraces ? parseOptional : parseExpected)(18 /* OpenBraceToken */);
result.type = doInsideOfContext(2097152 /* JSDoc */, parseJSDocType);
if (!mayOmitBraces || hasBrace) {
- parseExpected(19 /* CloseBraceToken */);
+ parseExpectedJSDoc(19 /* CloseBraceToken */);
}
fixupParentReferences(result);
return finishNode(result);
}
JSDocParser.parseJSDocTypeExpression = parseJSDocTypeExpression;
function parseIsolatedJSDocComment(content, start, length) {
- initializeState(content, 7 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
+ initializeState(content, 8 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
sourceFile = { languageVariant: 0 /* Standard */, text: content }; // tslint:disable-line no-object-literal-type-assertion
var jsDoc = parseJSDocCommentWorker(start, length);
var diagnostics = parseDiagnostics;
@@ -22204,7 +22359,7 @@
comments.push(text);
indent += text.length;
}
- nextJSDocToken();
+ nextTokenJSDoc();
while (parseOptionalJsdoc(5 /* WhitespaceTrivia */))
;
if (parseOptionalJsdoc(4 /* NewLineTrivia */)) {
@@ -22222,7 +22377,6 @@
// for malformed examples like `/** @param {string} x @returns {number} the length */`
state = 0 /* BeginningOfLine */;
margin = undefined;
- indent++;
}
else {
pushComment(scanner.getTokenText());
@@ -22267,7 +22421,7 @@
pushComment(scanner.getTokenText());
break;
}
- nextJSDocToken();
+ nextTokenJSDoc();
}
removeLeadingNewlines(comments);
removeTrailingWhitespace(comments);
@@ -22284,7 +22438,7 @@
}
}
function createJSDocComment() {
- var result = createNode(296 /* JSDocComment */, start);
+ var result = createNode(297 /* JSDocComment */, start);
result.tags = tags && createNodeArray(tags, tagsPos, tagsEnd);
result.comment = comments.length ? comments.join("") : undefined;
return finishNode(result, end);
@@ -22292,7 +22446,7 @@
function isNextNonwhitespaceTokenEndOfFile() {
// We must use infinite lookahead, as there could be any number of newlines :(
while (true) {
- nextJSDocToken();
+ nextTokenJSDoc();
if (token() === 1 /* EndOfFileToken */) {
return true;
}
@@ -22308,32 +22462,38 @@
}
}
while (token() === 5 /* WhitespaceTrivia */ || token() === 4 /* NewLineTrivia */) {
- nextJSDocToken();
+ nextTokenJSDoc();
}
}
function skipWhitespaceOrAsterisk() {
if (token() === 5 /* WhitespaceTrivia */ || token() === 4 /* NewLineTrivia */) {
if (lookAhead(isNextNonwhitespaceTokenEndOfFile)) {
- return; // Don't skip whitespace prior to EoF (or end of comment) - that shouldn't be included in any node's range
+ return ""; // Don't skip whitespace prior to EoF (or end of comment) - that shouldn't be included in any node's range
}
}
var precedingLineBreak = scanner.hasPrecedingLineBreak();
+ var seenLineBreak = false;
+ var indentText = "";
while ((precedingLineBreak && token() === 40 /* AsteriskToken */) || token() === 5 /* WhitespaceTrivia */ || token() === 4 /* NewLineTrivia */) {
+ indentText += scanner.getTokenText();
if (token() === 4 /* NewLineTrivia */) {
precedingLineBreak = true;
+ seenLineBreak = true;
+ indentText = "";
}
else if (token() === 40 /* AsteriskToken */) {
precedingLineBreak = false;
}
- nextJSDocToken();
+ nextTokenJSDoc();
}
+ return seenLineBreak ? indentText : "";
}
- function parseTag(indent) {
+ function parseTag(margin) {
ts.Debug.assert(token() === 58 /* AtToken */);
var start = scanner.getTokenPos();
- nextJSDocToken();
+ nextTokenJSDoc();
var tagName = parseJSDocIdentifierName(/*message*/ undefined);
- skipWhitespaceOrAsterisk();
+ var indentText = skipWhitespaceOrAsterisk();
var tag;
switch (tagName.escapedText) {
case "augments":
@@ -22353,7 +22513,7 @@
case "arg":
case "argument":
case "param":
- return parseParameterOrPropertyTag(start, tagName, 2 /* Parameter */, indent);
+ return parseParameterOrPropertyTag(start, tagName, 2 /* Parameter */, margin);
case "return":
case "returns":
tag = parseReturnTag(start, tagName);
@@ -22365,10 +22525,10 @@
tag = parseTypeTag(start, tagName);
break;
case "typedef":
- tag = parseTypedefTag(start, tagName, indent);
+ tag = parseTypedefTag(start, tagName, margin);
break;
case "callback":
- tag = parseCallbackTag(start, tagName, indent);
+ tag = parseCallbackTag(start, tagName, margin);
break;
default:
tag = parseUnknownTag(start, tagName);
@@ -22376,11 +22536,14 @@
}
if (!tag.comment) {
// some tags, like typedef and callback, have already parsed their comments earlier
- tag.comment = parseTagComments(indent + tag.end - tag.pos);
+ if (!indentText) {
+ margin += tag.end - tag.pos;
+ }
+ tag.comment = parseTagComments(margin, indentText.slice(margin));
}
return tag;
}
- function parseTagComments(indent) {
+ function parseTagComments(indent, initialMargin) {
var comments = [];
var state = 0 /* BeginningOfLine */;
var margin;
@@ -22391,6 +22554,11 @@
comments.push(text);
indent += text.length;
}
+ if (initialMargin) {
+ // jump straight to saving comments if there is some initial indentation
+ pushComment(initialMargin);
+ state = 2 /* SavingComments */;
+ }
var tok = token();
loop: while (true) {
switch (tok) {
@@ -22415,18 +22583,18 @@
var whitespace = scanner.getTokenText();
// if the whitespace crosses the margin, take only the whitespace that passes the margin
if (margin !== undefined && indent + whitespace.length > margin) {
- comments.push(whitespace.slice(margin - indent - 1));
+ comments.push(whitespace.slice(margin - indent));
}
indent += whitespace.length;
}
break;
case 18 /* OpenBraceToken */:
state = 2 /* SavingComments */;
- if (lookAhead(function () { return nextJSDocToken() === 58 /* AtToken */ && ts.tokenIsIdentifierOrKeyword(nextJSDocToken()) && scanner.getTokenText() === "link"; })) {
+ if (lookAhead(function () { return nextTokenJSDoc() === 58 /* AtToken */ && ts.tokenIsIdentifierOrKeyword(nextTokenJSDoc()) && scanner.getTokenText() === "link"; })) {
pushComment(scanner.getTokenText());
- nextJSDocToken();
+ nextTokenJSDoc();
pushComment(scanner.getTokenText());
- nextJSDocToken();
+ nextTokenJSDoc();
}
pushComment(scanner.getTokenText());
break;
@@ -22444,14 +22612,14 @@
pushComment(scanner.getTokenText());
break;
}
- tok = nextJSDocToken();
+ tok = nextTokenJSDoc();
}
removeLeadingNewlines(comments);
removeTrailingWhitespace(comments);
return comments.length === 0 ? undefined : comments.join("");
}
function parseUnknownTag(start, tagName) {
- var result = createNode(299 /* JSDocTag */, start);
+ var result = createNode(300 /* JSDocTag */, start);
result.tagName = tagName;
return finishNode(result);
}
@@ -22473,17 +22641,21 @@
return token() === 18 /* OpenBraceToken */ ? parseJSDocTypeExpression() : undefined;
}
function parseBracketNameInPropertyAndParamTag() {
- if (token() === 14 /* NoSubstitutionTemplateLiteral */) {
- // a markdown-quoted name: `arg` is not legal jsdoc, but occurs in the wild
- return { name: createIdentifier(/*isIdentifier*/ true), isBracketed: false };
- }
// Looking for something like '[foo]', 'foo', '[foo.bar]' or 'foo.bar'
- var isBracketed = parseOptional(22 /* OpenBracketToken */);
+ var isBracketed = parseOptionalJsdoc(22 /* OpenBracketToken */);
+ if (isBracketed) {
+ skipWhitespace();
+ }
+ // a markdown-quoted name: `arg` is not legal jsdoc, but occurs in the wild
+ var isBackquoted = parseOptionalJsdoc(59 /* BacktickToken */);
var name = parseJSDocEntityName();
+ if (isBackquoted) {
+ parseExpectedTokenJSDoc(59 /* BacktickToken */);
+ }
if (isBracketed) {
skipWhitespace();
// May have an optional default, e.g. '[foo = 42]'
- if (parseOptionalToken(59 /* EqualsToken */)) {
+ if (parseOptionalToken(60 /* EqualsToken */)) {
parseExpression();
}
parseExpected(23 /* CloseBracketToken */);
@@ -22492,9 +22664,9 @@
}
function isObjectOrObjectArrayTypeReference(node) {
switch (node.kind) {
- case 136 /* ObjectKeyword */:
+ case 137 /* ObjectKeyword */:
return true;
- case 169 /* ArrayType */:
+ case 170 /* ArrayType */:
return isObjectOrObjectArrayTypeReference(node.elementType);
default:
return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText === "Object";
@@ -22510,8 +22682,8 @@
typeExpression = tryParseTypeExpression();
}
var result = target === 1 /* Property */ ?
- createNode(310 /* JSDocPropertyTag */, start) :
- createNode(304 /* JSDocParameterTag */, start);
+ createNode(311 /* JSDocPropertyTag */, start) :
+ createNode(305 /* JSDocParameterTag */, start);
var comment = parseTagComments(indent + scanner.getStartPos() - start);
var nestedTypeLiteral = target !== 4 /* CallbackParameter */ && parseNestedTypeLiteral(typeExpression, name, target, indent);
if (nestedTypeLiteral) {
@@ -22528,20 +22700,20 @@
}
function parseNestedTypeLiteral(typeExpression, name, target, indent) {
if (typeExpression && isObjectOrObjectArrayTypeReference(typeExpression.type)) {
- var typeLiteralExpression = createNode(288 /* JSDocTypeExpression */, scanner.getTokenPos());
+ var typeLiteralExpression = createNode(289 /* JSDocTypeExpression */, scanner.getTokenPos());
var child = void 0;
var jsdocTypeLiteral = void 0;
var start_2 = scanner.getStartPos();
var children = void 0;
while (child = tryParse(function () { return parseChildParameterOrPropertyTag(target, indent, name); })) {
- if (child.kind === 304 /* JSDocParameterTag */ || child.kind === 310 /* JSDocPropertyTag */) {
+ if (child.kind === 305 /* JSDocParameterTag */ || child.kind === 311 /* JSDocPropertyTag */) {
children = ts.append(children, child);
}
}
if (children) {
- jsdocTypeLiteral = createNode(297 /* JSDocTypeLiteral */, start_2);
+ jsdocTypeLiteral = createNode(298 /* JSDocTypeLiteral */, start_2);
jsdocTypeLiteral.jsDocPropertyTags = children;
- if (typeExpression.type.kind === 169 /* ArrayType */) {
+ if (typeExpression.type.kind === 170 /* ArrayType */) {
jsdocTypeLiteral.isArrayType = true;
}
typeLiteralExpression.type = finishNode(jsdocTypeLiteral);
@@ -22550,32 +22722,32 @@
}
}
function parseReturnTag(start, tagName) {
- if (ts.forEach(tags, function (t) { return t.kind === 305 /* JSDocReturnTag */; })) {
+ if (ts.some(tags, ts.isJSDocReturnTag)) {
parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText);
}
- var result = createNode(305 /* JSDocReturnTag */, start);
+ var result = createNode(306 /* JSDocReturnTag */, start);
result.tagName = tagName;
result.typeExpression = tryParseTypeExpression();
return finishNode(result);
}
function parseTypeTag(start, tagName) {
- if (ts.forEach(tags, function (t) { return t.kind === 307 /* JSDocTypeTag */; })) {
+ if (ts.some(tags, ts.isJSDocTypeTag)) {
parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText);
}
- var result = createNode(307 /* JSDocTypeTag */, start);
+ var result = createNode(308 /* JSDocTypeTag */, start);
result.tagName = tagName;
result.typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true);
return finishNode(result);
}
function parseAugmentsTag(start, tagName) {
- var result = createNode(300 /* JSDocAugmentsTag */, start);
+ var result = createNode(301 /* JSDocAugmentsTag */, start);
result.tagName = tagName;
result.class = parseExpressionWithTypeArgumentsForAugments();
return finishNode(result);
}
function parseExpressionWithTypeArgumentsForAugments() {
var usedBrace = parseOptional(18 /* OpenBraceToken */);
- var node = createNode(211 /* ExpressionWithTypeArguments */);
+ var node = createNode(212 /* ExpressionWithTypeArguments */);
node.expression = parsePropertyAccessEntityNameExpression();
node.typeArguments = tryParseTypeArguments();
var res = finishNode(node);
@@ -22587,7 +22759,7 @@
function parsePropertyAccessEntityNameExpression() {
var node = parseJSDocIdentifierName();
while (parseOptional(24 /* DotToken */)) {
- var prop = createNode(189 /* PropertyAccessExpression */, node.pos);
+ var prop = createNode(190 /* PropertyAccessExpression */, node.pos);
prop.expression = node;
prop.name = parseJSDocIdentifierName();
node = finishNode(prop);
@@ -22595,19 +22767,19 @@
return node;
}
function parseClassTag(start, tagName) {
- var tag = createNode(301 /* JSDocClassTag */, start);
+ var tag = createNode(302 /* JSDocClassTag */, start);
tag.tagName = tagName;
return finishNode(tag);
}
function parseThisTag(start, tagName) {
- var tag = createNode(306 /* JSDocThisTag */, start);
+ var tag = createNode(307 /* JSDocThisTag */, start);
tag.tagName = tagName;
tag.typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true);
skipWhitespace();
return finishNode(tag);
}
function parseEnumTag(start, tagName) {
- var tag = createNode(303 /* JSDocEnumTag */, start);
+ var tag = createNode(304 /* JSDocEnumTag */, start);
tag.tagName = tagName;
tag.typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true);
skipWhitespace();
@@ -22616,7 +22788,7 @@
function parseTypedefTag(start, tagName, indent) {
var typeExpression = tryParseTypeExpression();
skipWhitespaceOrAsterisk();
- var typedefTag = createNode(309 /* JSDocTypedefTag */, start);
+ var typedefTag = createNode(310 /* JSDocTypedefTag */, start);
typedefTag.tagName = tagName;
typedefTag.fullName = parseJSDocTypeNameWithNamespace();
typedefTag.name = getJSDocTypeAliasName(typedefTag.fullName);
@@ -22630,9 +22802,9 @@
var childTypeTag = void 0;
while (child = tryParse(function () { return parseChildPropertyTag(indent); })) {
if (!jsdocTypeLiteral) {
- jsdocTypeLiteral = createNode(297 /* JSDocTypeLiteral */, start);
+ jsdocTypeLiteral = createNode(298 /* JSDocTypeLiteral */, start);
}
- if (child.kind === 307 /* JSDocTypeTag */) {
+ if (child.kind === 308 /* JSDocTypeTag */) {
if (childTypeTag) {
break;
}
@@ -22645,7 +22817,7 @@
}
}
if (jsdocTypeLiteral) {
- if (typeExpression && typeExpression.type.kind === 169 /* ArrayType */) {
+ if (typeExpression && typeExpression.type.kind === 170 /* ArrayType */) {
jsdocTypeLiteral.isArrayType = true;
}
typedefTag.typeExpression = childTypeTag && childTypeTag.typeExpression && !isObjectOrObjectArrayTypeReference(childTypeTag.typeExpression.type) ?
@@ -22664,7 +22836,7 @@
}
var typeNameOrNamespaceName = parseJSDocIdentifierName();
if (parseOptional(24 /* DotToken */)) {
- var jsDocNamespaceNode = createNode(244 /* ModuleDeclaration */, pos);
+ var jsDocNamespaceNode = createNode(245 /* ModuleDeclaration */, pos);
if (nested) {
jsDocNamespaceNode.flags |= 4 /* NestedNamespace */;
}
@@ -22678,14 +22850,14 @@
return typeNameOrNamespaceName;
}
function parseCallbackTag(start, tagName, indent) {
- var callbackTag = createNode(302 /* JSDocCallbackTag */, start);
+ var callbackTag = createNode(303 /* JSDocCallbackTag */, start);
callbackTag.tagName = tagName;
callbackTag.fullName = parseJSDocTypeNameWithNamespace();
callbackTag.name = getJSDocTypeAliasName(callbackTag.fullName);
skipWhitespace();
callbackTag.comment = parseTagComments(indent);
var child;
- var jsdocSignature = createNode(298 /* JSDocSignature */, start);
+ var jsdocSignature = createNode(299 /* JSDocSignature */, start);
jsdocSignature.parameters = [];
while (child = tryParse(function () { return parseChildParameterOrPropertyTag(4 /* CallbackParameter */, indent); })) {
jsdocSignature.parameters = ts.append(jsdocSignature.parameters, child);
@@ -22693,7 +22865,7 @@
var returnTag = tryParse(function () {
if (parseOptionalJsdoc(58 /* AtToken */)) {
var tag = parseTag(indent);
- if (tag && tag.kind === 305 /* JSDocReturnTag */) {
+ if (tag && tag.kind === 306 /* JSDocReturnTag */) {
return tag;
}
}
@@ -22734,11 +22906,11 @@
var canParseTag = true;
var seenAsterisk = false;
while (true) {
- switch (nextJSDocToken()) {
+ switch (nextTokenJSDoc()) {
case 58 /* AtToken */:
if (canParseTag) {
var child = tryParseChildTag(target, indent);
- if (child && (child.kind === 304 /* JSDocParameterTag */ || child.kind === 310 /* JSDocPropertyTag */) &&
+ if (child && (child.kind === 305 /* JSDocParameterTag */ || child.kind === 311 /* JSDocPropertyTag */) &&
target !== 4 /* CallbackParameter */ &&
name && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) {
return false;
@@ -22757,7 +22929,7 @@
}
seenAsterisk = true;
break;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
canParseTag = false;
break;
case 1 /* EndOfFileToken */:
@@ -22768,7 +22940,7 @@
function tryParseChildTag(target, indent) {
ts.Debug.assert(token() === 58 /* AtToken */);
var start = scanner.getStartPos();
- nextJSDocToken();
+ nextTokenJSDoc();
var tagName = parseJSDocIdentifierName();
skipWhitespace();
var t;
@@ -22802,25 +22974,22 @@
var typeParametersPos = getNodePos();
do {
skipWhitespace();
- var typeParameter = createNode(150 /* TypeParameter */);
+ var typeParameter = createNode(151 /* TypeParameter */);
typeParameter.name = parseJSDocIdentifierName(ts.Diagnostics.Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces);
finishNode(typeParameter);
skipWhitespace();
typeParameters.push(typeParameter);
} while (parseOptionalJsdoc(27 /* CommaToken */));
- var result = createNode(308 /* JSDocTemplateTag */, start);
+ var result = createNode(309 /* JSDocTemplateTag */, start);
result.tagName = tagName;
result.constraint = constraint;
result.typeParameters = createNodeArray(typeParameters, typeParametersPos);
finishNode(result);
return result;
}
- function nextJSDocToken() {
- return currentToken = scanner.scanJSDocToken();
- }
function parseOptionalJsdoc(t) {
if (token() === t) {
- nextJSDocToken();
+ nextTokenJSDoc();
return true;
}
return false;
@@ -22844,14 +23013,14 @@
}
function parseJSDocIdentifierName(message) {
if (!ts.tokenIsIdentifierOrKeyword(token())) {
- return createMissingNode(72 /* Identifier */, /*reportAtCurrentPosition*/ !message, message || ts.Diagnostics.Identifier_expected);
+ return createMissingNode(73 /* Identifier */, /*reportAtCurrentPosition*/ !message, message || ts.Diagnostics.Identifier_expected);
}
var pos = scanner.getTokenPos();
var end = scanner.getTextPos();
- var result = createNode(72 /* Identifier */, pos);
+ var result = createNode(73 /* Identifier */, pos);
result.escapedText = ts.escapeLeadingUnderscores(scanner.getTokenText());
finishNode(result, end);
- nextJSDocToken();
+ nextTokenJSDoc();
return result;
}
}
@@ -22976,7 +23145,7 @@
switch (node.kind) {
case 10 /* StringLiteral */:
case 8 /* NumericLiteral */:
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return true;
}
return false;
@@ -23343,28 +23512,16 @@
ts.isDeclarationFileName = isDeclarationFileName;
/*@internal*/
function processCommentPragmas(context, sourceText) {
- var triviaScanner = ts.createScanner(context.languageVersion, /*skipTrivia*/ false, 0 /* Standard */, sourceText);
var pragmas = [];
- // Keep scanning all the leading trivia in the file until we get to something that
- // isn't trivia. Any single line comment will be analyzed to see if it is a
- // reference comment.
- while (true) {
- var kind = triviaScanner.scan();
- if (!ts.isTrivia(kind)) {
- break;
- }
- var range = {
- kind: triviaScanner.getToken(),
- pos: triviaScanner.getTokenPos(),
- end: triviaScanner.getTextPos(),
- };
+ for (var _i = 0, _a = ts.getLeadingCommentRanges(sourceText, 0) || ts.emptyArray; _i < _a.length; _i++) {
+ var range = _a[_i];
var comment = sourceText.substring(range.pos, range.end);
extractPragmas(pragmas, range, comment);
}
context.pragmas = ts.createMap();
- for (var _i = 0, pragmas_1 = pragmas; _i < pragmas_1.length; _i++) {
- var pragma = pragmas_1[_i];
- if (context.pragmas.has(pragma.name)) { // TODO: GH#18217
+ for (var _b = 0, pragmas_1 = pragmas; _b < pragmas_1.length; _b++) {
+ var pragma = pragmas_1[_b];
+ if (context.pragmas.has(pragma.name)) {
var currentValue = context.pragmas.get(pragma.name);
if (currentValue instanceof Array) {
currentValue.push(pragma.args);
@@ -23395,7 +23552,6 @@
var typeReferenceDirectives_1 = context.typeReferenceDirectives;
var libReferenceDirectives_1 = context.libReferenceDirectives;
ts.forEach(ts.toArray(entryOrList), function (arg) {
- // TODO: GH#18217
var _a = arg.arguments, types = _a.types, lib = _a.lib, path = _a.path;
if (arg.arguments["no-default-lib"]) {
context.hasNoDefaultLib = true;
@@ -23416,7 +23572,7 @@
break;
}
case "amd-dependency": {
- context.amdDependencies = ts.map(ts.toArray(entryOrList), function (x) { return ({ name: x.arguments.name, path: x.arguments.path }); }); // TODO: GH#18217
+ context.amdDependencies = ts.map(ts.toArray(entryOrList), function (x) { return ({ name: x.arguments.name, path: x.arguments.path }); });
break;
}
case "amd-module": {
@@ -23439,7 +23595,7 @@
case "ts-check": {
// _last_ of either nocheck or check in a file is the "winner"
ts.forEach(ts.toArray(entryOrList), function (entry) {
- if (!context.checkJsDirective || entry.range.pos > context.checkJsDirective.pos) { // TODO: GH#18217
+ if (!context.checkJsDirective || entry.range.pos > context.checkJsDirective.pos) {
context.checkJsDirective = {
enabled: key === "ts-check",
end: entry.range.end,
@@ -23555,10 +23711,10 @@
if (lhs.kind !== rhs.kind) {
return false;
}
- if (lhs.kind === 72 /* Identifier */) {
+ if (lhs.kind === 73 /* Identifier */) {
return lhs.escapedText === rhs.escapedText;
}
- if (lhs.kind === 100 /* ThisKeyword */) {
+ if (lhs.kind === 101 /* ThisKeyword */) {
return true;
}
// If we are at this statement then we must have PropertyAccessExpression and because tag name in Jsx element can only
@@ -23587,6 +23743,7 @@
["es2017", "lib.es2017.d.ts"],
["es2018", "lib.es2018.d.ts"],
["es2019", "lib.es2019.d.ts"],
+ ["es2020", "lib.es2020.d.ts"],
["esnext", "lib.esnext.d.ts"],
// Host only
["dom", "lib.dom.d.ts"],
@@ -23615,8 +23772,11 @@
["es2018.promise", "lib.es2018.promise.d.ts"],
["es2018.regexp", "lib.es2018.regexp.d.ts"],
["es2019.array", "lib.es2019.array.d.ts"],
+ ["es2019.object", "lib.es2019.object.d.ts"],
["es2019.string", "lib.es2019.string.d.ts"],
["es2019.symbol", "lib.es2019.symbol.d.ts"],
+ ["es2020.string", "lib.es2020.string.d.ts"],
+ ["es2020.symbol.wellknown", "lib.es2020.symbol.wellknown.d.ts"],
["esnext.array", "lib.es2019.array.d.ts"],
["esnext.symbol", "lib.es2019.symbol.d.ts"],
["esnext.asynciterable", "lib.es2018.asynciterable.d.ts"],
@@ -23703,6 +23863,13 @@
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Show_verbose_diagnostic_information
},
+ {
+ name: "incremental",
+ shortName: "i",
+ type: "boolean",
+ category: ts.Diagnostics.Basic_Options,
+ description: ts.Diagnostics.Enable_incremental_compilation,
+ },
];
/* @internal */
ts.optionDeclarations = ts.commonOptionsWithBuild.concat([
@@ -23766,10 +23933,12 @@
es2017: 4 /* ES2017 */,
es2018: 5 /* ES2018 */,
es2019: 6 /* ES2019 */,
- esnext: 7 /* ESNext */,
+ es2020: 7 /* ES2020 */,
+ esnext: 8 /* ESNext */,
}),
affectsSourceFile: true,
affectsModuleResolution: true,
+ affectsEmit: true,
paramType: ts.Diagnostics.VERSION,
showInSimplifiedHelpView: true,
category: ts.Diagnostics.Basic_Options,
@@ -23837,6 +24006,7 @@
name: "declaration",
shortName: "d",
type: "boolean",
+ affectsEmit: true,
showInSimplifiedHelpView: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Generates_corresponding_d_ts_file,
@@ -23844,6 +24014,7 @@
{
name: "declarationMap",
type: "boolean",
+ affectsEmit: true,
showInSimplifiedHelpView: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Generates_a_sourcemap_for_each_corresponding_d_ts_file,
@@ -23851,12 +24022,14 @@
{
name: "emitDeclarationOnly",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Only_emit_d_ts_declaration_files,
},
{
name: "sourceMap",
type: "boolean",
+ affectsEmit: true,
showInSimplifiedHelpView: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Generates_corresponding_map_file,
@@ -23864,6 +24037,7 @@
{
name: "outFile",
type: "string",
+ affectsEmit: true,
isFilePath: true,
paramType: ts.Diagnostics.FILE,
showInSimplifiedHelpView: true,
@@ -23873,6 +24047,7 @@
{
name: "outDir",
type: "string",
+ affectsEmit: true,
isFilePath: true,
paramType: ts.Diagnostics.DIRECTORY,
showInSimplifiedHelpView: true,
@@ -23882,6 +24057,7 @@
{
name: "rootDir",
type: "string",
+ affectsEmit: true,
isFilePath: true,
paramType: ts.Diagnostics.LOCATION,
category: ts.Diagnostics.Basic_Options,
@@ -23890,29 +24066,24 @@
{
name: "composite",
type: "boolean",
+ affectsEmit: true,
isTSConfigOnly: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Enable_project_compilation,
},
{
- name: "incremental",
- type: "boolean",
- isTSConfigOnly: true,
- category: ts.Diagnostics.Basic_Options,
- description: ts.Diagnostics.Enable_incremental_compilation,
- },
- {
name: "tsBuildInfoFile",
type: "string",
+ affectsEmit: true,
isFilePath: true,
paramType: ts.Diagnostics.FILE,
- isTSConfigOnly: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Specify_file_to_store_incremental_compilation_information,
},
{
name: "removeComments",
type: "boolean",
+ affectsEmit: true,
showInSimplifiedHelpView: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Do_not_emit_comments_to_output,
@@ -23920,6 +24091,7 @@
{
name: "noEmit",
type: "boolean",
+ affectsEmit: true,
showInSimplifiedHelpView: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Do_not_emit_outputs,
@@ -23927,12 +24099,14 @@
{
name: "importHelpers",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Import_emit_helpers_from_tslib
},
{
name: "downlevelIteration",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3
},
@@ -24136,10 +24310,18 @@
category: ts.Diagnostics.Module_Resolution_Options,
description: ts.Diagnostics.Do_not_resolve_the_real_path_of_symlinks,
},
+ {
+ name: "allowUmdGlobalAccess",
+ type: "boolean",
+ affectsSemanticDiagnostics: true,
+ category: ts.Diagnostics.Module_Resolution_Options,
+ description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
+ },
// Source Maps
{
name: "sourceRoot",
type: "string",
+ affectsEmit: true,
paramType: ts.Diagnostics.LOCATION,
category: ts.Diagnostics.Source_Map_Options,
description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations,
@@ -24147,6 +24329,7 @@
{
name: "mapRoot",
type: "string",
+ affectsEmit: true,
paramType: ts.Diagnostics.LOCATION,
category: ts.Diagnostics.Source_Map_Options,
description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
@@ -24154,12 +24337,14 @@
{
name: "inlineSourceMap",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Source_Map_Options,
description: ts.Diagnostics.Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file
},
{
name: "inlineSources",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Source_Map_Options,
description: ts.Diagnostics.Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap_to_be_set
},
@@ -24192,6 +24377,7 @@
{
name: "out",
type: "string",
+ affectsEmit: true,
isFilePath: false,
// for correct behaviour, please use outFile
category: ts.Diagnostics.Advanced_Options,
@@ -24201,6 +24387,7 @@
{
name: "reactNamespace",
type: "string",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react_JSX_emit
},
@@ -24219,6 +24406,7 @@
{
name: "emitBOM",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files
},
@@ -24234,6 +24422,7 @@
crlf: 0 /* CarriageReturnLineFeed */,
lf: 1 /* LineFeed */
}),
+ affectsEmit: true,
paramType: ts.Diagnostics.NEWLINE,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix,
@@ -24261,6 +24450,7 @@
{
name: "stripInternal",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation,
},
@@ -24281,24 +24471,28 @@
{
name: "noEmitHelpers",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Do_not_generate_custom_helper_functions_like_extends_in_compiled_output
},
{
name: "noEmitOnError",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported,
},
{
name: "preserveConstEnums",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code
},
{
name: "declarationDir",
type: "string",
+ affectsEmit: true,
isFilePath: true,
paramType: ts.Diagnostics.DIRECTORY,
category: ts.Diagnostics.Advanced_Options,
@@ -24381,6 +24575,8 @@
/* @internal */
ts.semanticDiagnosticsOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsSemanticDiagnostics; });
/* @internal */
+ ts.affectsEmitOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsEmit; });
+ /* @internal */
ts.moduleResolutionOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsModuleResolution; });
/* @internal */
ts.sourceFileAffectingCompilerOptions = ts.optionDeclarations.filter(function (option) {
@@ -24788,7 +24984,7 @@
/**
* Reads the config file, reports errors if any and exits if the config file cannot be found
*/
- function getParsedCommandLineOfConfigFile(configFileName, optionsToExtend, host) {
+ function getParsedCommandLineOfConfigFile(configFileName, optionsToExtend, host, extendedConfigCache) {
var configFileText;
try {
configFileText = host.readFile(configFileName);
@@ -24808,7 +25004,9 @@
result.path = ts.toPath(configFileName, cwd, ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames));
result.resolvedPath = result.path;
result.originalFileName = result.fileName;
- return parseJsonSourceFileConfigFileContent(result, host, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), cwd), optionsToExtend, ts.getNormalizedAbsolutePath(configFileName, cwd));
+ return parseJsonSourceFileConfigFileContent(result, host, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), cwd), optionsToExtend, ts.getNormalizedAbsolutePath(configFileName, cwd),
+ /*resolutionStack*/ undefined,
+ /*extraFileExtension*/ undefined, extendedConfigCache);
}
ts.getParsedCommandLineOfConfigFile = getParsedCommandLineOfConfigFile;
/**
@@ -24947,7 +25145,7 @@
var result = returnValue ? {} : undefined;
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var element = _a[_i];
- if (element.kind !== 275 /* PropertyAssignment */) {
+ if (element.kind !== 276 /* PropertyAssignment */) {
errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected));
continue;
}
@@ -25003,13 +25201,13 @@
}
function convertPropertyValueToJson(valueExpression, option) {
switch (valueExpression.kind) {
- case 102 /* TrueKeyword */:
+ case 103 /* TrueKeyword */:
reportInvalidOptionValue(option && option.type !== "boolean");
return true;
- case 87 /* FalseKeyword */:
+ case 88 /* FalseKeyword */:
reportInvalidOptionValue(option && option.type !== "boolean");
return false;
- case 96 /* NullKeyword */:
+ case 97 /* NullKeyword */:
reportInvalidOptionValue(option && option.name === "extends"); // "extends" is the only option we don't allow null/undefined for
return null; // tslint:disable-line:no-null-keyword
case 10 /* StringLiteral */:
@@ -25029,13 +25227,13 @@
case 8 /* NumericLiteral */:
reportInvalidOptionValue(option && option.type !== "number");
return Number(valueExpression.text);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
if (valueExpression.operator !== 39 /* MinusToken */ || valueExpression.operand.kind !== 8 /* NumericLiteral */) {
break; // not valid JSON syntax
}
reportInvalidOptionValue(option && option.type !== "number");
return -Number(valueExpression.operand.text);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
reportInvalidOptionValue(option && option.type !== "object");
var objectLiteralExpression = valueExpression;
// Currently having element option declaration in the tsconfig with type "object"
@@ -25052,7 +25250,7 @@
return convertObjectLiteralExpressionToJson(objectLiteralExpression, /* knownOptions*/ undefined,
/*extraKeyDiagnosticMessage */ undefined, /*parentOption*/ undefined);
}
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
reportInvalidOptionValue(option && option.type !== "list");
return convertArrayLiteralExpressionToJson(valueExpression.elements, option && option.element);
}
@@ -25308,8 +25506,8 @@
* @param basePath A root directory to resolve relative path entries in the config
* file to. e.g. outDir
*/
- function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) {
- return parseJsonConfigFileContentWorker(json, /*sourceFile*/ undefined, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions);
+ function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache) {
+ return parseJsonConfigFileContentWorker(json, /*sourceFile*/ undefined, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache);
}
ts.parseJsonConfigFileContent = parseJsonConfigFileContent;
/**
@@ -25319,8 +25517,8 @@
* @param basePath A root directory to resolve relative path entries in the config
* file to. e.g. outDir
*/
- function parseJsonSourceFileConfigFileContent(sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) {
- return parseJsonConfigFileContentWorker(/*json*/ undefined, sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions);
+ function parseJsonSourceFileConfigFileContent(sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache) {
+ return parseJsonConfigFileContentWorker(/*json*/ undefined, sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache);
}
ts.parseJsonSourceFileConfigFileContent = parseJsonSourceFileConfigFileContent;
/*@internal*/
@@ -25348,13 +25546,13 @@
* file to. e.g. outDir
* @param resolutionStack Only present for backwards-compatibility. Should be empty.
*/
- function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) {
+ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache) {
if (existingOptions === void 0) { existingOptions = {}; }
if (resolutionStack === void 0) { resolutionStack = []; }
if (extraFileExtensions === void 0) { extraFileExtensions = []; }
ts.Debug.assert((json === undefined && sourceFile !== undefined) || (json !== undefined && sourceFile === undefined));
var errors = [];
- var parsedConfig = parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors);
+ var parsedConfig = parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors, extendedConfigCache);
var raw = parsedConfig.raw;
var options = ts.extend(existingOptions, parsedConfig.options || {});
options.configFilePath = configFileName && ts.normalizeSlashes(configFileName);
@@ -25494,7 +25692,7 @@
* This *just* extracts options/include/exclude/files out of a config file.
* It does *not* resolve the included files.
*/
- function parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors) {
+ function parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors, extendedConfigCache) {
basePath = ts.normalizeSlashes(basePath);
var resolvedPath = ts.getNormalizedAbsolutePath(configFileName || "", basePath);
if (resolutionStack.indexOf(resolvedPath) >= 0) {
@@ -25507,7 +25705,7 @@
if (ownConfig.extendedConfigPath) {
// copy the resolution stack so it is never reused between branches in potential diamond-problem scenarios.
resolutionStack = resolutionStack.concat([resolvedPath]);
- var extendedConfig = getExtendedConfig(sourceFile, ownConfig.extendedConfigPath, host, basePath, resolutionStack, errors);
+ var extendedConfig = getExtendedConfig(sourceFile, ownConfig.extendedConfigPath, host, basePath, resolutionStack, errors, extendedConfigCache);
if (extendedConfig && isSuccessfulParsedTsconfig(extendedConfig)) {
var baseRaw_1 = extendedConfig.raw;
var raw_1 = ownConfig.raw;
@@ -25604,7 +25802,7 @@
if (!host.fileExists(extendedConfigPath) && !ts.endsWith(extendedConfigPath, ".json" /* Json */)) {
extendedConfigPath = extendedConfigPath + ".json";
if (!host.fileExists(extendedConfigPath)) {
- errors.push(createDiagnostic(ts.Diagnostics.File_0_does_not_exist, extendedConfig));
+ errors.push(createDiagnostic(ts.Diagnostics.File_0_not_found, extendedConfig));
return undefined;
}
}
@@ -25615,24 +25813,23 @@
if (resolved.resolvedModule) {
return resolved.resolvedModule.resolvedFileName;
}
- errors.push(createDiagnostic(ts.Diagnostics.File_0_does_not_exist, extendedConfig));
+ errors.push(createDiagnostic(ts.Diagnostics.File_0_not_found, extendedConfig));
return undefined;
}
- function getExtendedConfig(sourceFile, extendedConfigPath, host, basePath, resolutionStack, errors) {
+ function getExtendedConfig(sourceFile, extendedConfigPath, host, basePath, resolutionStack, errors, extendedConfigCache) {
var _a;
- var extendedResult = readJsonConfigFile(extendedConfigPath, function (path) { return host.readFile(path); });
- if (sourceFile) {
- sourceFile.extendedSourceFiles = [extendedResult.fileName];
- }
- if (extendedResult.parseDiagnostics.length) {
- errors.push.apply(errors, extendedResult.parseDiagnostics);
- return undefined;
+ var path = host.useCaseSensitiveFileNames ? extendedConfigPath : ts.toLowerCase(extendedConfigPath);
+ var value;
+ var extendedResult;
+ var extendedConfig;
+ if (extendedConfigCache && (value = extendedConfigCache.get(path))) {
+ (extendedResult = value.extendedResult, extendedConfig = value.extendedConfig);
}
+ else {
+ extendedResult = readJsonConfigFile(extendedConfigPath, function (path) { return host.readFile(path); });
+ if (!extendedResult.parseDiagnostics.length) {
var extendedDirname = ts.getDirectoryPath(extendedConfigPath);
- var extendedConfig = parseConfig(/*json*/ undefined, extendedResult, host, extendedDirname, ts.getBaseFileName(extendedConfigPath), resolutionStack, errors);
- if (sourceFile && extendedResult.extendedSourceFiles) {
- (_a = sourceFile.extendedSourceFiles).push.apply(_a, extendedResult.extendedSourceFiles);
- }
+ extendedConfig = parseConfig(/*json*/ undefined, extendedResult, host, extendedDirname, ts.getBaseFileName(extendedConfigPath), resolutionStack, errors, extendedConfigCache);
if (isSuccessfulParsedTsconfig(extendedConfig)) {
// Update the paths to reflect base path
var relativeDifference_1 = ts.convertToRelativePath(extendedDirname, basePath, ts.identity);
@@ -25647,6 +25844,21 @@
mapPropertiesInRawIfNotUndefined("exclude");
mapPropertiesInRawIfNotUndefined("files");
}
+ }
+ if (extendedConfigCache) {
+ extendedConfigCache.set(path, { extendedResult: extendedResult, extendedConfig: extendedConfig });
+ }
+ }
+ if (sourceFile) {
+ sourceFile.extendedSourceFiles = [extendedResult.fileName];
+ if (extendedResult.extendedSourceFiles) {
+ (_a = sourceFile.extendedSourceFiles).push.apply(_a, extendedResult.extendedSourceFiles);
+ }
+ }
+ if (extendedResult.parseDiagnostics.length) {
+ errors.push.apply(errors, extendedResult.parseDiagnostics);
+ return undefined;
+ }
return extendedConfig;
}
function convertCompileOnSaveOptionFromJson(jsonOption, basePath, errors) {
@@ -26116,11 +26328,22 @@
return !!compilerOptions.traceResolution && host.trace !== undefined;
}
ts.isTraceEnabled = isTraceEnabled;
- function withPackageId(packageId, r) {
+ function withPackageId(packageInfo, r) {
+ var packageId;
+ if (r && packageInfo) {
+ var packageJsonContent = packageInfo.packageJsonContent;
+ if (typeof packageJsonContent.name === "string" && typeof packageJsonContent.version === "string") {
+ packageId = {
+ name: packageJsonContent.name,
+ subModuleName: r.path.slice(packageInfo.packageDirectory.length + ts.directorySeparator.length),
+ version: packageJsonContent.version
+ };
+ }
+ }
return r && { path: r.path, extension: r.ext, packageId: packageId };
}
function noPackageId(r) {
- return withPackageId(/*packageId*/ undefined, r);
+ return withPackageId(/*packageInfo*/ undefined, r);
}
function removeIgnoredPackageId(r) {
if (r) {
@@ -26172,8 +26395,15 @@
}
function readPackageJsonPathField(jsonContent, fieldName, baseDirectory, state) {
var fileName = readPackageJsonField(jsonContent, fieldName, "string", state);
- if (fileName === undefined)
+ if (fileName === undefined) {
return;
+ }
+ if (!fileName) {
+ if (state.traceEnabled) {
+ trace(state.host, ts.Diagnostics.package_json_had_a_falsy_0_field, fieldName);
+ }
+ return;
+ }
var path = ts.normalizePath(ts.combinePaths(baseDirectory, fileName));
if (state.traceEnabled) {
trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, fileName, path);
@@ -26326,8 +26556,13 @@
var fileName = resolved.fileName, packageId = resolved.packageId;
var resolvedFileName = options.preserveSymlinks ? fileName : realPath(fileName, host, traceEnabled);
if (traceEnabled) {
+ if (packageId) {
+ trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3, typeReferenceDirectiveName, resolvedFileName, ts.packageIdToString(packageId), primary);
+ }
+ else {
trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolvedFileName, primary);
}
+ }
resolvedTypeReferenceDirective = { primary: primary, resolvedFileName: resolvedFileName, packageId: packageId, isExternalLibraryImport: pathContainsNodeModules(fileName) };
}
return { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations };
@@ -26428,20 +26663,28 @@
return result;
}
ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames;
- function createModuleResolutionCache(currentDirectory, getCanonicalFileName) {
- return createModuleResolutionCacheWithMaps(createCacheWithRedirects(), createCacheWithRedirects(), currentDirectory, getCanonicalFileName);
+ function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options) {
+ return createModuleResolutionCacheWithMaps(createCacheWithRedirects(options), createCacheWithRedirects(options), currentDirectory, getCanonicalFileName);
}
ts.createModuleResolutionCache = createModuleResolutionCache;
/*@internal*/
- function createCacheWithRedirects() {
+ function createCacheWithRedirects(options) {
var ownMap = ts.createMap();
var redirectsMap = ts.createMap();
return {
ownMap: ownMap,
redirectsMap: redirectsMap,
getOrCreateMapOfCacheRedirects: getOrCreateMapOfCacheRedirects,
- clear: clear
+ clear: clear,
+ setOwnOptions: setOwnOptions,
+ setOwnMap: setOwnMap
};
+ function setOwnOptions(newOptions) {
+ options = newOptions;
+ }
+ function setOwnMap(newOwnMap) {
+ ownMap = newOwnMap;
+ }
function getOrCreateMapOfCacheRedirects(redirectedReference) {
if (!redirectedReference) {
return ownMap;
@@ -26449,7 +26692,8 @@
var path = redirectedReference.sourceFile.path;
var redirects = redirectsMap.get(path);
if (!redirects) {
- redirects = ts.createMap();
+ // Reuse map if redirected reference map uses same resolution
+ redirects = !options || ts.optionsHaveModuleResolutionChanges(options, redirectedReference.commandLine.options) ? ts.createMap() : ownMap;
redirectsMap.set(path, redirects);
}
return redirects;
@@ -26462,7 +26706,7 @@
ts.createCacheWithRedirects = createCacheWithRedirects;
/*@internal*/
function createModuleResolutionCacheWithMaps(directoryToModuleNameMap, moduleNameToDirectoryMap, currentDirectory, getCanonicalFileName) {
- return { getOrCreateCacheForDirectory: getOrCreateCacheForDirectory, getOrCreateCacheForModuleName: getOrCreateCacheForModuleName };
+ return { getOrCreateCacheForDirectory: getOrCreateCacheForDirectory, getOrCreateCacheForModuleName: getOrCreateCacheForModuleName, directoryToModuleNameMap: directoryToModuleNameMap, moduleNameToDirectoryMap: moduleNameToDirectoryMap };
function getOrCreateCacheForDirectory(directoryName, redirectedReference) {
var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName);
return getOrCreateCache(directoryToModuleNameMap, redirectedReference, path, ts.createMap);
@@ -26605,8 +26849,13 @@
}
if (traceEnabled) {
if (result.resolvedModule) {
+ if (result.resolvedModule.packageId) {
+ trace(host, ts.Diagnostics.Module_name_0_was_successfully_resolved_to_1_with_Package_ID_2, moduleName, result.resolvedModule.resolvedFileName, ts.packageIdToString(result.resolvedModule.packageId));
+ }
+ else {
trace(host, ts.Diagnostics.Module_name_0_was_successfully_resolved_to_1, moduleName, result.resolvedModule.resolvedFileName);
}
+ }
else {
trace(host, ts.Diagnostics.Module_name_0_was_not_resolved, moduleName);
}
@@ -26875,10 +27124,9 @@
}
var resolvedFromFile = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state);
if (resolvedFromFile) {
- var nm = considerPackageJson ? parseNodeModuleFromPath(resolvedFromFile) : undefined;
- var packageInfo = nm && getPackageJsonInfo(nm.packageDirectory, nm.subModuleName, /*onlyRecordFailures*/ false, state);
- var packageId = packageInfo && packageInfo.packageId;
- return withPackageId(packageId, resolvedFromFile);
+ var packageDirectory = considerPackageJson ? parseNodeModuleFromPath(resolvedFromFile) : undefined;
+ var packageInfo = packageDirectory ? getPackageJsonInfo(packageDirectory, /*onlyRecordFailures*/ false, state) : undefined;
+ return withPackageId(packageInfo, resolvedFromFile);
}
}
if (!onlyRecordFailures) {
@@ -26904,11 +27152,10 @@
* (Not neeeded for `loadModuleFromNodeModules` as that looks up the `package.json` as part of resolution.)
*
* packageDirectory is the directory of the package itself.
- * subModuleName is the path within the package.
- * For `blah/node_modules/foo/index.d.ts` this is { packageDirectory: "foo", subModuleName: "index.d.ts" }. (Part before "/node_modules/" is ignored.)
- * For `/node_modules/foo/bar.d.ts` this is { packageDirectory: "foo", subModuleName": "bar/index.d.ts" }.
- * For `/node_modules/@types/foo/bar/index.d.ts` this is { packageDirectory: "@types/foo", subModuleName: "bar/index.d.ts" }.
- * For `/node_modules/foo/bar/index.d.ts` this is { packageDirectory: "foo", subModuleName": "bar/index.d.ts" }.
+ * For `blah/node_modules/foo/index.d.ts` this is packageDirectory: "foo"
+ * For `/node_modules/foo/bar.d.ts` this is packageDirectory: "foo"
+ * For `/node_modules/@types/foo/bar/index.d.ts` this is packageDirectory: "@types/foo"
+ * For `/node_modules/foo/bar/index.d.ts` this is packageDirectory: "foo"
*/
function parseNodeModuleFromPath(resolved) {
var path = ts.normalizePath(resolved.path);
@@ -26921,26 +27168,12 @@
if (path.charCodeAt(indexAfterNodeModules) === 64 /* at */) {
indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterPackageName);
}
- var packageDirectory = path.slice(0, indexAfterPackageName);
- var subModuleName = ts.removeExtension(path.slice(indexAfterPackageName + 1), resolved.ext) + ".d.ts" /* Dts */;
- return { packageDirectory: packageDirectory, subModuleName: subModuleName };
+ return path.slice(0, indexAfterPackageName);
}
function moveToNextDirectorySeparatorIfAvailable(path, prevSeparatorIndex) {
var nextSeparatorIndex = path.indexOf(ts.directorySeparator, prevSeparatorIndex + 1);
return nextSeparatorIndex === -1 ? prevSeparatorIndex : nextSeparatorIndex;
}
- function addExtensionAndIndex(path) {
- if (path === "") {
- return "index.d.ts";
- }
- if (ts.endsWith(path, ".d.ts")) {
- return path;
- }
- if (path === "index" || ts.endsWith(path, "/index")) {
- return path + ".d.ts";
- }
- return path + "/index.d.ts";
- }
function loadModuleFromFileNoPackageId(extensions, candidate, onlyRecordFailures, state) {
return noPackageId(loadModuleFromFile(extensions, candidate, onlyRecordFailures, state));
}
@@ -27014,52 +27247,22 @@
}
function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson) {
if (considerPackageJson === void 0) { considerPackageJson = true; }
- var packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, "", onlyRecordFailures, state) : undefined;
- var packageId = packageInfo && packageInfo.packageId;
+ var packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, onlyRecordFailures, state) : undefined;
var packageJsonContent = packageInfo && packageInfo.packageJsonContent;
- var versionPaths = packageJsonContent && readPackageJsonTypesVersionPaths(packageJsonContent, state);
- return withPackageId(packageId, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths));
+ var versionPaths = packageInfo && packageInfo.versionPaths;
+ return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths));
}
- function getPackageJsonInfo(packageDirectory, subModuleName, onlyRecordFailures, state) {
+ function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
var host = state.host, traceEnabled = state.traceEnabled;
var directoryExists = !onlyRecordFailures && ts.directoryProbablyExists(packageDirectory, host);
var packageJsonPath = ts.combinePaths(packageDirectory, "package.json");
if (directoryExists && host.fileExists(packageJsonPath)) {
var packageJsonContent = ts.readJson(packageJsonPath, host);
- if (subModuleName === "") { // looking up the root - need to handle types/typings/main redirects for subModuleName
- var path = readPackageJsonTypesFields(packageJsonContent, packageDirectory, state);
- if (typeof path === "string") {
- subModuleName = addExtensionAndIndex(path.substring(packageDirectory.length + 1));
- }
- else {
- var jsPath = readPackageJsonMainField(packageJsonContent, packageDirectory, state);
- if (typeof jsPath === "string" && jsPath.length > packageDirectory.length) {
- var potentialSubModule_1 = jsPath.substring(packageDirectory.length + 1);
- subModuleName = (ts.forEach(ts.supportedJSExtensions, function (extension) {
- return ts.tryRemoveExtension(potentialSubModule_1, extension);
- }) || potentialSubModule_1) + ".d.ts" /* Dts */;
- }
- else {
- subModuleName = "index.d.ts";
- }
- }
- }
- if (!ts.endsWith(subModuleName, ".d.ts" /* Dts */)) {
- subModuleName = addExtensionAndIndex(subModuleName);
- }
- var versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state);
- var packageId = typeof packageJsonContent.name === "string" && typeof packageJsonContent.version === "string"
- ? { name: packageJsonContent.name, subModuleName: subModuleName, version: packageJsonContent.version }
- : undefined;
if (traceEnabled) {
- if (packageId) {
- trace(host, ts.Diagnostics.Found_package_json_at_0_Package_ID_is_1, packageJsonPath, ts.packageIdToString(packageId));
- }
- else {
trace(host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath);
}
- }
- return { packageJsonContent: packageJsonContent, packageId: packageId, versionPaths: versionPaths };
+ var versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state);
+ return { packageDirectory: packageDirectory, packageJsonContent: packageJsonContent, versionPaths: versionPaths };
}
else {
if (directoryExists && traceEnabled) {
@@ -27198,37 +27401,31 @@
function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state) {
var candidate = ts.normalizePath(ts.combinePaths(nodeModulesDirectory, moduleName));
// First look for a nested package.json, as in `node_modules/foo/bar/package.json`.
- var packageJsonContent;
- var packageId;
- var versionPaths;
- var packageInfo = getPackageJsonInfo(candidate, "", !nodeModulesDirectoryExists, state);
+ var packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state);
if (packageInfo) {
- (packageJsonContent = packageInfo.packageJsonContent, packageId = packageInfo.packageId, versionPaths = packageInfo.versionPaths);
var fromFile = loadModuleFromFile(extensions, candidate, !nodeModulesDirectoryExists, state);
if (fromFile) {
return noPackageId(fromFile);
}
- var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageJsonContent, versionPaths);
- return withPackageId(packageId, fromDirectory);
+ var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageInfo.packageJsonContent, packageInfo.versionPaths);
+ return withPackageId(packageInfo, fromDirectory);
}
var loader = function (extensions, candidate, onlyRecordFailures, state) {
var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) ||
- loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths);
- return withPackageId(packageId, pathAndExtension);
+ loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.packageJsonContent, packageInfo && packageInfo.versionPaths);
+ return withPackageId(packageInfo, pathAndExtension);
};
var _a = parsePackageName(moduleName), packageName = _a.packageName, rest = _a.rest;
if (rest !== "") { // If "rest" is empty, we just did this search above.
var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName);
// Don't use a "types" or "main" from here because we're not loading the root, but a subdirectory -- just here for the packageId and path mappings.
- var packageInfo_1 = getPackageJsonInfo(packageDirectory, rest, !nodeModulesDirectoryExists, state);
- if (packageInfo_1)
- (packageId = packageInfo_1.packageId, versionPaths = packageInfo_1.versionPaths);
- if (versionPaths) {
+ packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state);
+ if (packageInfo && packageInfo.versionPaths) {
if (state.traceEnabled) {
- trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, versionPaths.version, ts.version, rest);
+ trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.versionPaths.version, ts.version, rest);
}
var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host);
- var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, versionPaths.paths, loader, !packageDirectoryExists, state);
+ var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.versionPaths.paths, loader, !packageDirectoryExists, state);
if (fromPaths) {
return fromPaths.value;
}
@@ -27396,24 +27593,24 @@
// A module is uninstantiated if it contains only
switch (node.kind) {
// 1. interface declarations, type alias declarations
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return 0 /* NonInstantiated */;
// 2. const enum declarations
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
if (ts.isEnumConst(node)) {
return 2 /* ConstEnumOnly */;
}
break;
// 3. non-exported import declarations
- case 249 /* ImportDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
if (!(ts.hasModifier(node, 1 /* Export */))) {
return 0 /* NonInstantiated */;
}
break;
// 4. other uninstantiated module declarations.
- case 245 /* ModuleBlock */: {
+ case 246 /* ModuleBlock */: {
var state_1 = 0 /* NonInstantiated */;
ts.forEachChild(node, function (n) {
var childState = getModuleInstanceStateWorker(n);
@@ -27435,9 +27632,9 @@
});
return state_1;
}
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return getModuleInstanceState(node);
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
// Only jsdoc typedef definition can exist in jsdoc namespace, and it should
// be considered the same as type alias
if (node.isInJSDocNamespace) {
@@ -27603,7 +27800,7 @@
// Should not be called on a declaration with a computed property name,
// unless it is a well known Symbol.
function getDeclarationName(node) {
- if (node.kind === 254 /* ExportAssignment */) {
+ if (node.kind === 255 /* ExportAssignment */) {
return node.isExportEquals ? "export=" /* ExportEquals */ : "default" /* Default */;
}
var name = ts.getNameOfDeclaration(node);
@@ -27612,7 +27809,7 @@
var moduleName = ts.getTextOfIdentifierOrLiteral(name);
return (ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + moduleName + "\"");
}
- if (name.kind === 149 /* ComputedPropertyName */) {
+ if (name.kind === 150 /* ComputedPropertyName */) {
var nameExpression = name.expression;
// treat computed property names where expression is string/numeric literal as just string/numeric literal
if (ts.isStringOrNumericLiteralLike(nameExpression)) {
@@ -27624,36 +27821,36 @@
return ts.isPropertyNameLiteral(name) ? ts.getEscapedTextOfIdentifierOrLiteral(name) : undefined;
}
switch (node.kind) {
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return "__constructor" /* Constructor */;
- case 165 /* FunctionType */:
- case 160 /* CallSignature */:
- case 298 /* JSDocSignature */:
+ case 166 /* FunctionType */:
+ case 161 /* CallSignature */:
+ case 299 /* JSDocSignature */:
return "__call" /* Call */;
- case 166 /* ConstructorType */:
- case 161 /* ConstructSignature */:
+ case 167 /* ConstructorType */:
+ case 162 /* ConstructSignature */:
return "__new" /* New */;
- case 162 /* IndexSignature */:
+ case 163 /* IndexSignature */:
return "__index" /* Index */;
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return "__export" /* ExportStar */;
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
// json file should behave as
// module.exports = ...
return "export=" /* ExportEquals */;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
if (ts.getAssignmentDeclarationKind(node) === 2 /* ModuleExports */) {
// module.exports = ...
return "export=" /* ExportEquals */;
}
ts.Debug.fail("Unknown binary declaration kind");
break;
- case 294 /* JSDocFunctionType */:
+ case 295 /* JSDocFunctionType */:
return (ts.isJSDocConstructSignature(node) ? "__new" /* New */ : "__call" /* Call */);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
// Parameters with names are handled at the top of this function. Parameters
// without names can only come from JSDocFunctionTypes.
- ts.Debug.assert(node.parent.kind === 294 /* JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: " + (ts.SyntaxKind ? ts.SyntaxKind[node.parent.kind] : node.parent.kind) + ", expected JSDocFunctionType"; });
+ ts.Debug.assert(node.parent.kind === 295 /* JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: " + (ts.SyntaxKind ? ts.SyntaxKind[node.parent.kind] : node.parent.kind) + ", expected JSDocFunctionType"; });
var functionType = node.parent;
var index = functionType.parameters.indexOf(node);
return "arg" + index;
@@ -27753,7 +27950,7 @@
// 1. multiple export default of class declaration or function declaration by checking NodeFlags.Default
// 2. multiple export default of export assignment. This one doesn't have NodeFlags.Default on (as export default doesn't considered as modifiers)
if (symbol.declarations && symbol.declarations.length &&
- (node.kind === 254 /* ExportAssignment */ && !node.isExportEquals)) {
+ (node.kind === 255 /* ExportAssignment */ && !node.isExportEquals)) {
message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports;
messageNeedsName_1 = false;
multipleDefaultExports_1 = true;
@@ -27788,7 +27985,7 @@
function declareModuleMember(node, symbolFlags, symbolExcludes) {
var hasExportModifier = ts.getCombinedModifierFlags(node) & 1 /* Export */;
if (symbolFlags & 2097152 /* Alias */) {
- if (node.kind === 257 /* ExportSpecifier */ || (node.kind === 248 /* ImportEqualsDeclaration */ && hasExportModifier)) {
+ if (node.kind === 258 /* ExportSpecifier */ || (node.kind === 249 /* ImportEqualsDeclaration */ && hasExportModifier)) {
return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
}
else {
@@ -27855,7 +28052,7 @@
// for it. We must clear this so we don't accidentally move any stale data forward from
// a previous compilation.
if (containerFlags & 1 /* IsContainer */) {
- if (node.kind !== 197 /* ArrowFunction */) {
+ if (node.kind !== 198 /* ArrowFunction */) {
thisParentContainer = container;
}
container = blockScopeContainer = node;
@@ -27888,7 +28085,7 @@
}
// We create a return control flow graph for IIFEs and constructors. For constructors
// we use the return control flow graph in strict property initialization checks.
- currentReturnTarget = isIIFE || node.kind === 157 /* Constructor */ ? createBranchLabel() : undefined;
+ currentReturnTarget = isIIFE || node.kind === 158 /* Constructor */ ? createBranchLabel() : undefined;
currentBreakTarget = undefined;
currentContinueTarget = undefined;
activeLabels = undefined;
@@ -27902,13 +28099,13 @@
if (hasExplicitReturn)
node.flags |= 256 /* HasExplicitReturn */;
}
- if (node.kind === 284 /* SourceFile */) {
+ if (node.kind === 285 /* SourceFile */) {
node.flags |= emitFlags;
}
if (currentReturnTarget) {
addAntecedent(currentReturnTarget, currentFlow);
currentFlow = finishFlowLabel(currentReturnTarget);
- if (node.kind === 157 /* Constructor */) {
+ if (node.kind === 158 /* Constructor */) {
node.returnFlowNode = currentFlow;
}
}
@@ -27952,8 +28149,8 @@
}
}
function bindEachFunctionsFirst(nodes) {
- bindEach(nodes, function (n) { return n.kind === 239 /* FunctionDeclaration */ ? bind(n) : undefined; });
- bindEach(nodes, function (n) { return n.kind !== 239 /* FunctionDeclaration */ ? bind(n) : undefined; });
+ bindEach(nodes, function (n) { return n.kind === 240 /* FunctionDeclaration */ ? bind(n) : undefined; });
+ bindEach(nodes, function (n) { return n.kind !== 240 /* FunctionDeclaration */ ? bind(n) : undefined; });
}
function bindEach(nodes, bindFunction) {
if (bindFunction === void 0) { bindFunction = bind; }
@@ -27986,78 +28183,78 @@
return;
}
switch (node.kind) {
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
bindWhileStatement(node);
break;
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
bindDoStatement(node);
break;
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
bindForStatement(node);
break;
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
bindForInOrForOfStatement(node);
break;
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
bindIfStatement(node);
break;
- case 230 /* ReturnStatement */:
- case 234 /* ThrowStatement */:
+ case 231 /* ReturnStatement */:
+ case 235 /* ThrowStatement */:
bindReturnOrThrow(node);
break;
- case 229 /* BreakStatement */:
- case 228 /* ContinueStatement */:
+ case 230 /* BreakStatement */:
+ case 229 /* ContinueStatement */:
bindBreakOrContinueStatement(node);
break;
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
bindTryStatement(node);
break;
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
bindSwitchStatement(node);
break;
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
bindCaseBlock(node);
break;
- case 271 /* CaseClause */:
+ case 272 /* CaseClause */:
bindCaseClause(node);
break;
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
bindLabeledStatement(node);
break;
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
bindPrefixUnaryExpressionFlow(node);
break;
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
bindPostfixUnaryExpressionFlow(node);
break;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
bindBinaryExpressionFlow(node);
break;
- case 198 /* DeleteExpression */:
+ case 199 /* DeleteExpression */:
bindDeleteExpressionFlow(node);
break;
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
bindConditionalExpressionFlow(node);
break;
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
bindVariableDeclarationFlow(node);
break;
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
bindCallExpressionFlow(node);
break;
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
bindJSDocTypeAlias(node);
break;
// In source files and blocks, bind functions first to match hoisting that occurs at runtime
- case 284 /* SourceFile */: {
+ case 285 /* SourceFile */: {
bindEachFunctionsFirst(node.statements);
bind(node.endOfFileToken);
break;
}
- case 218 /* Block */:
- case 245 /* ModuleBlock */:
+ case 219 /* Block */:
+ case 246 /* ModuleBlock */:
bindEachFunctionsFirst(node.statements);
break;
default:
@@ -28068,26 +28265,26 @@
}
function isNarrowingExpression(expr) {
switch (expr.kind) {
- case 72 /* Identifier */:
- case 100 /* ThisKeyword */:
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 73 /* Identifier */:
+ case 101 /* ThisKeyword */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return isNarrowableReference(expr);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return hasNarrowableArgument(expr);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return isNarrowingExpression(expr.expression);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return isNarrowingBinaryExpression(expr);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return expr.operator === 52 /* ExclamationToken */ && isNarrowingExpression(expr.operand);
- case 199 /* TypeOfExpression */:
+ case 200 /* TypeOfExpression */:
return isNarrowingExpression(expr.expression);
}
return false;
}
function isNarrowableReference(expr) {
- return expr.kind === 72 /* Identifier */ || expr.kind === 100 /* ThisKeyword */ || expr.kind === 98 /* SuperKeyword */ ||
+ return expr.kind === 73 /* Identifier */ || expr.kind === 101 /* ThisKeyword */ || expr.kind === 99 /* SuperKeyword */ ||
(ts.isPropertyAccessExpression(expr) || ts.isNonNullExpression(expr) || ts.isParenthesizedExpression(expr)) && isNarrowableReference(expr.expression) ||
ts.isElementAccessExpression(expr) && expr.argumentExpression &&
(ts.isStringLiteral(expr.argumentExpression) || ts.isNumericLiteral(expr.argumentExpression)) &&
@@ -28102,7 +28299,7 @@
}
}
}
- if (expr.expression.kind === 189 /* PropertyAccessExpression */ &&
+ if (expr.expression.kind === 190 /* PropertyAccessExpression */ &&
isNarrowableReference(expr.expression.expression)) {
return true;
}
@@ -28116,7 +28313,7 @@
}
function isNarrowingBinaryExpression(expr) {
switch (expr.operatorToken.kind) {
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
return isNarrowableReference(expr.left);
case 33 /* EqualsEqualsToken */:
case 34 /* ExclamationEqualsToken */:
@@ -28124,9 +28321,9 @@
case 36 /* ExclamationEqualsEqualsToken */:
return isNarrowableOperand(expr.left) || isNarrowableOperand(expr.right) ||
isNarrowingTypeofOperands(expr.right, expr.left) || isNarrowingTypeofOperands(expr.left, expr.right);
- case 94 /* InstanceOfKeyword */:
+ case 95 /* InstanceOfKeyword */:
return isNarrowableOperand(expr.left);
- case 93 /* InKeyword */:
+ case 94 /* InKeyword */:
return isNarrowableInOperands(expr.left, expr.right);
case 27 /* CommaToken */:
return isNarrowingExpression(expr.right);
@@ -28135,11 +28332,11 @@
}
function isNarrowableOperand(expr) {
switch (expr.kind) {
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return isNarrowableOperand(expr.expression);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
switch (expr.operatorToken.kind) {
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
return isNarrowableOperand(expr.left);
case 27 /* CommaToken */:
return isNarrowableOperand(expr.right);
@@ -28176,8 +28373,8 @@
if (!expression) {
return flags & 32 /* TrueCondition */ ? antecedent : unreachableFlow;
}
- if (expression.kind === 102 /* TrueKeyword */ && flags & 64 /* FalseCondition */ ||
- expression.kind === 87 /* FalseKeyword */ && flags & 32 /* TrueCondition */) {
+ if (expression.kind === 103 /* TrueKeyword */ && flags & 64 /* FalseCondition */ ||
+ expression.kind === 88 /* FalseKeyword */ && flags & 32 /* TrueCondition */) {
return unreachableFlow;
}
if (!isNarrowingExpression(expression)) {
@@ -28215,33 +28412,33 @@
function isStatementCondition(node) {
var parent = node.parent;
switch (parent.kind) {
- case 222 /* IfStatement */:
- case 224 /* WhileStatement */:
- case 223 /* DoStatement */:
+ case 223 /* IfStatement */:
+ case 225 /* WhileStatement */:
+ case 224 /* DoStatement */:
return parent.expression === node;
- case 225 /* ForStatement */:
- case 205 /* ConditionalExpression */:
+ case 226 /* ForStatement */:
+ case 206 /* ConditionalExpression */:
return parent.condition === node;
}
return false;
}
function isLogicalExpression(node) {
while (true) {
- if (node.kind === 195 /* ParenthesizedExpression */) {
+ if (node.kind === 196 /* ParenthesizedExpression */) {
node = node.expression;
}
- else if (node.kind === 202 /* PrefixUnaryExpression */ && node.operator === 52 /* ExclamationToken */) {
+ else if (node.kind === 203 /* PrefixUnaryExpression */ && node.operator === 52 /* ExclamationToken */) {
node = node.operand;
}
else {
- return node.kind === 204 /* BinaryExpression */ && (node.operatorToken.kind === 54 /* AmpersandAmpersandToken */ ||
+ return node.kind === 205 /* BinaryExpression */ && (node.operatorToken.kind === 54 /* AmpersandAmpersandToken */ ||
node.operatorToken.kind === 55 /* BarBarToken */);
}
}
}
function isTopLevelLogicalExpression(node) {
- while (node.parent.kind === 195 /* ParenthesizedExpression */ ||
- node.parent.kind === 202 /* PrefixUnaryExpression */ &&
+ while (node.parent.kind === 196 /* ParenthesizedExpression */ ||
+ node.parent.kind === 203 /* PrefixUnaryExpression */ &&
node.parent.operator === 52 /* ExclamationToken */) {
node = node.parent;
}
@@ -28283,7 +28480,7 @@
}
function bindDoStatement(node) {
var preDoLabel = createLoopLabel();
- var enclosingLabeledStatement = node.parent.kind === 233 /* LabeledStatement */
+ var enclosingLabeledStatement = node.parent.kind === 234 /* LabeledStatement */
? ts.lastOrUndefined(activeLabels)
: undefined;
// if do statement is wrapped in labeled statement then target labels for break/continue with or without
@@ -28317,13 +28514,13 @@
var postLoopLabel = createBranchLabel();
addAntecedent(preLoopLabel, currentFlow);
currentFlow = preLoopLabel;
- if (node.kind === 227 /* ForOfStatement */) {
+ if (node.kind === 228 /* ForOfStatement */) {
bind(node.awaitModifier);
}
bind(node.expression);
addAntecedent(postLoopLabel, currentFlow);
bind(node.initializer);
- if (node.initializer.kind !== 238 /* VariableDeclarationList */) {
+ if (node.initializer.kind !== 239 /* VariableDeclarationList */) {
bindAssignmentTargetFlow(node.initializer);
}
bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel);
@@ -28345,7 +28542,7 @@
}
function bindReturnOrThrow(node) {
bind(node.expression);
- if (node.kind === 230 /* ReturnStatement */) {
+ if (node.kind === 231 /* ReturnStatement */) {
hasExplicitReturn = true;
if (currentReturnTarget) {
addAntecedent(currentReturnTarget, currentFlow);
@@ -28365,7 +28562,7 @@
return undefined;
}
function bindBreakOrContinueFlow(node, breakTarget, continueTarget) {
- var flowLabel = node.kind === 229 /* BreakStatement */ ? breakTarget : continueTarget;
+ var flowLabel = node.kind === 230 /* BreakStatement */ ? breakTarget : continueTarget;
if (flowLabel) {
addAntecedent(flowLabel, currentFlow);
currentFlow = unreachableFlow;
@@ -28493,7 +28690,7 @@
preSwitchCaseFlow = currentFlow;
bind(node.caseBlock);
addAntecedent(postSwitchLabel, currentFlow);
- var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 272 /* DefaultClause */; });
+ var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 273 /* DefaultClause */; });
// We mark a switch statement as possibly exhaustive if it has no default clause and if all
// case clauses have unreachable end points (e.g. they all return).
node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents;
@@ -28560,14 +28757,14 @@
if (!activeLabel.referenced && !options.allowUnusedLabels) {
errorOrSuggestionOnNode(ts.unusedLabelIsError(options), node.label, ts.Diagnostics.Unused_label);
}
- if (!node.statement || node.statement.kind !== 223 /* DoStatement */) {
+ if (!node.statement || node.statement.kind !== 224 /* DoStatement */) {
// do statement sets current flow inside bindDoStatement
addAntecedent(postStatementLabel, currentFlow);
currentFlow = finishFlowLabel(postStatementLabel);
}
}
function bindDestructuringTargetFlow(node) {
- if (node.kind === 204 /* BinaryExpression */ && node.operatorToken.kind === 59 /* EqualsToken */) {
+ if (node.kind === 205 /* BinaryExpression */ && node.operatorToken.kind === 60 /* EqualsToken */) {
bindAssignmentTargetFlow(node.left);
}
else {
@@ -28578,10 +28775,10 @@
if (isNarrowableReference(node)) {
currentFlow = createFlowAssignment(currentFlow, node);
}
- else if (node.kind === 187 /* ArrayLiteralExpression */) {
+ else if (node.kind === 188 /* ArrayLiteralExpression */) {
for (var _i = 0, _a = node.elements; _i < _a.length; _i++) {
var e = _a[_i];
- if (e.kind === 208 /* SpreadElement */) {
+ if (e.kind === 209 /* SpreadElement */) {
bindAssignmentTargetFlow(e.expression);
}
else {
@@ -28589,16 +28786,16 @@
}
}
}
- else if (node.kind === 188 /* ObjectLiteralExpression */) {
+ else if (node.kind === 189 /* ObjectLiteralExpression */) {
for (var _b = 0, _c = node.properties; _b < _c.length; _b++) {
var p = _c[_b];
- if (p.kind === 275 /* PropertyAssignment */) {
+ if (p.kind === 276 /* PropertyAssignment */) {
bindDestructuringTargetFlow(p.initializer);
}
- else if (p.kind === 276 /* ShorthandPropertyAssignment */) {
+ else if (p.kind === 277 /* ShorthandPropertyAssignment */) {
bindAssignmentTargetFlow(p.name);
}
- else if (p.kind === 277 /* SpreadAssignment */) {
+ else if (p.kind === 278 /* SpreadAssignment */) {
bindAssignmentTargetFlow(p.expression);
}
}
@@ -28654,7 +28851,7 @@
bindEachChild(node);
if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) {
bindAssignmentTargetFlow(node.left);
- if (operator === 59 /* EqualsToken */ && node.left.kind === 190 /* ElementAccessExpression */) {
+ if (operator === 60 /* EqualsToken */ && node.left.kind === 191 /* ElementAccessExpression */) {
var elementAccess = node.left;
if (isNarrowableOperand(elementAccess.expression)) {
currentFlow = createFlowArrayMutation(currentFlow, node);
@@ -28665,7 +28862,7 @@
}
function bindDeleteExpressionFlow(node) {
bindEachChild(node);
- if (node.expression.kind === 189 /* PropertyAccessExpression */) {
+ if (node.expression.kind === 190 /* PropertyAccessExpression */) {
bindAssignmentTargetFlow(node.expression);
}
}
@@ -28713,10 +28910,10 @@
// an immediately invoked function expression (IIFE). Initialize the flowNode property to
// the current control flow (which includes evaluation of the IIFE arguments).
var expr = node.expression;
- while (expr.kind === 195 /* ParenthesizedExpression */) {
+ while (expr.kind === 196 /* ParenthesizedExpression */) {
expr = expr.expression;
}
- if (expr.kind === 196 /* FunctionExpression */ || expr.kind === 197 /* ArrowFunction */) {
+ if (expr.kind === 197 /* FunctionExpression */ || expr.kind === 198 /* ArrowFunction */) {
bindEach(node.typeArguments);
bindEach(node.arguments);
bind(node.expression);
@@ -28724,7 +28921,7 @@
else {
bindEachChild(node);
}
- if (node.expression.kind === 189 /* PropertyAccessExpression */) {
+ if (node.expression.kind === 190 /* PropertyAccessExpression */) {
var propertyAccess = node.expression;
if (isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) {
currentFlow = createFlowArrayMutation(currentFlow, node);
@@ -28733,54 +28930,54 @@
}
function getContainerFlags(node) {
switch (node.kind) {
- case 209 /* ClassExpression */:
- case 240 /* ClassDeclaration */:
- case 243 /* EnumDeclaration */:
- case 188 /* ObjectLiteralExpression */:
- case 168 /* TypeLiteral */:
- case 297 /* JSDocTypeLiteral */:
- case 268 /* JsxAttributes */:
+ case 210 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 189 /* ObjectLiteralExpression */:
+ case 169 /* TypeLiteral */:
+ case 298 /* JSDocTypeLiteral */:
+ case 269 /* JsxAttributes */:
return 1 /* IsContainer */;
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
return 1 /* IsContainer */ | 64 /* IsInterface */;
- case 244 /* ModuleDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 181 /* MappedType */:
+ case 245 /* ModuleDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 182 /* MappedType */:
return 1 /* IsContainer */ | 32 /* HasLocals */;
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */;
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
if (ts.isObjectLiteralOrClassExpressionMethod(node)) {
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 128 /* IsObjectLiteralOrClassExpressionMethod */;
}
// falls through
- case 157 /* Constructor */:
- case 239 /* FunctionDeclaration */:
- case 155 /* MethodSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 160 /* CallSignature */:
- case 298 /* JSDocSignature */:
- case 294 /* JSDocFunctionType */:
- case 165 /* FunctionType */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
- case 166 /* ConstructorType */:
+ case 158 /* Constructor */:
+ case 240 /* FunctionDeclaration */:
+ case 156 /* MethodSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 161 /* CallSignature */:
+ case 299 /* JSDocSignature */:
+ case 295 /* JSDocFunctionType */:
+ case 166 /* FunctionType */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
+ case 167 /* ConstructorType */:
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */;
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 16 /* IsFunctionExpression */;
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
return 4 /* IsControlFlowContainer */;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return node.initializer ? 4 /* IsControlFlowContainer */ : 0;
- case 274 /* CatchClause */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 246 /* CaseBlock */:
+ case 275 /* CatchClause */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 247 /* CaseBlock */:
return 2 /* IsBlockScopedContainer */;
- case 218 /* Block */:
+ case 219 /* Block */:
// do not treat blocks directly inside a function as a block-scoped-container.
// Locals that reside in this block should go to the function locals. Otherwise 'x'
// would not appear to be a redeclaration of a block scoped local in the following
@@ -28813,45 +29010,45 @@
// members are declared (for example, a member of a class will go into a specific
// symbol table depending on if it is static or not). We defer to specialized
// handlers to take care of declaring these child members.
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return declareModuleMember(node, symbolFlags, symbolExcludes);
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return declareSourceFileMember(node, symbolFlags, symbolExcludes);
- case 209 /* ClassExpression */:
- case 240 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
return declareClassMember(node, symbolFlags, symbolExcludes);
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
- case 168 /* TypeLiteral */:
- case 297 /* JSDocTypeLiteral */:
- case 188 /* ObjectLiteralExpression */:
- case 241 /* InterfaceDeclaration */:
- case 268 /* JsxAttributes */:
+ case 169 /* TypeLiteral */:
+ case 298 /* JSDocTypeLiteral */:
+ case 189 /* ObjectLiteralExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 269 /* JsxAttributes */:
// Interface/Object-types always have their children added to the 'members' of
// their container. They are only accessible through an instance of their
// container, and are never in scope otherwise (even inside the body of the
// object / type / interface declaring them). An exception is type parameters,
// which are in scope without qualification (similar to 'locals').
return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes);
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 298 /* JSDocSignature */:
- case 162 /* IndexSignature */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 294 /* JSDocFunctionType */:
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
- case 242 /* TypeAliasDeclaration */:
- case 181 /* MappedType */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 299 /* JSDocSignature */:
+ case 163 /* IndexSignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 295 /* JSDocFunctionType */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
+ case 243 /* TypeAliasDeclaration */:
+ case 182 /* MappedType */:
// All the children of these container types are never visible through another
// symbol (i.e. through another symbol's 'exports' or 'members'). Instead,
// they're only accessed 'lexically' (i.e. from code that exists underneath
@@ -28872,16 +29069,8 @@
: declareSymbol(file.locals, /*parent*/ undefined, node, symbolFlags, symbolExcludes);
}
function hasExportDeclarations(node) {
- var body = node.kind === 284 /* SourceFile */ ? node : node.body;
- if (body && (body.kind === 284 /* SourceFile */ || body.kind === 245 /* ModuleBlock */)) {
- for (var _i = 0, _a = body.statements; _i < _a.length; _i++) {
- var stat = _a[_i];
- if (stat.kind === 255 /* ExportDeclaration */ || stat.kind === 254 /* ExportAssignment */) {
- return true;
- }
- }
- }
- return false;
+ var body = ts.isSourceFile(node) ? node : ts.tryCast(node.body, ts.isModuleBlock);
+ return !!body && body.statements.some(function (s) { return ts.isExportDeclaration(s) || ts.isExportAssignment(s); });
}
function setExportContextFlag(node) {
// A declaration source file or ambient module declaration that contains no export declarations (but possibly regular
@@ -28960,7 +29149,7 @@
var seen = ts.createUnderscoreEscapedMap();
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var prop = _a[_i];
- if (prop.kind === 277 /* SpreadAssignment */ || prop.name.kind !== 72 /* Identifier */) {
+ if (prop.kind === 278 /* SpreadAssignment */ || prop.name.kind !== 73 /* Identifier */) {
continue;
}
var identifier = prop.name;
@@ -28972,7 +29161,7 @@
// c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true.
// d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true
// and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields
- var currentKind = prop.kind === 275 /* PropertyAssignment */ || prop.kind === 276 /* ShorthandPropertyAssignment */ || prop.kind === 156 /* MethodDeclaration */
+ var currentKind = prop.kind === 276 /* PropertyAssignment */ || prop.kind === 277 /* ShorthandPropertyAssignment */ || prop.kind === 157 /* MethodDeclaration */
? 1 /* Property */
: 2 /* Accessor */;
var existingKind = seen.get(identifier.escapedText);
@@ -29004,10 +29193,10 @@
}
function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) {
switch (blockScopeContainer.kind) {
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
declareModuleMember(node, symbolFlags, symbolExcludes);
break;
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
if (ts.isExternalOrCommonJsModule(container)) {
declareModuleMember(node, symbolFlags, symbolExcludes);
break;
@@ -29038,7 +29227,7 @@
currentFlow = { flags: 2 /* Start */ };
parent = typeAlias;
bind(typeAlias.typeExpression);
- if (!typeAlias.fullName || typeAlias.fullName.kind === 72 /* Identifier */) {
+ if (!typeAlias.fullName || typeAlias.fullName.kind === 73 /* Identifier */) {
parent = typeAlias.parent;
bindBlockScopedDeclaration(typeAlias, 524288 /* TypeAlias */, 67897832 /* TypeAliasExcludes */);
}
@@ -29056,8 +29245,8 @@
// check for reserved words used as identifiers in strict mode code.
function checkStrictModeIdentifier(node) {
if (inStrictMode &&
- node.originalKeywordKind >= 109 /* FirstFutureReservedWord */ &&
- node.originalKeywordKind <= 117 /* LastFutureReservedWord */ &&
+ node.originalKeywordKind >= 110 /* FirstFutureReservedWord */ &&
+ node.originalKeywordKind <= 118 /* LastFutureReservedWord */ &&
!ts.isIdentifierName(node) &&
!(node.flags & 4194304 /* Ambient */)) {
// Report error only if there are no parse errors in file
@@ -29093,7 +29282,7 @@
}
function checkStrictModeDeleteExpression(node) {
// Grammar checking
- if (inStrictMode && node.expression.kind === 72 /* Identifier */) {
+ if (inStrictMode && node.expression.kind === 73 /* Identifier */) {
// When a delete operator occurs within strict mode code, a SyntaxError is thrown if its
// UnaryExpression is a direct reference to a variable, function argument, or function name
var span = ts.getErrorSpanForNode(file, node.expression);
@@ -29104,7 +29293,7 @@
return ts.isIdentifier(node) && (node.escapedText === "eval" || node.escapedText === "arguments");
}
function checkStrictModeEvalOrArguments(contextNode, name) {
- if (name && name.kind === 72 /* Identifier */) {
+ if (name && name.kind === 73 /* Identifier */) {
var identifier = name;
if (isEvalOrArgumentsIdentifier(identifier)) {
// We check first if the name is inside class declaration or class expression; if so give explicit message
@@ -29145,8 +29334,8 @@
function checkStrictModeFunctionDeclaration(node) {
if (languageVersion < 2 /* ES2015 */) {
// Report error if function is not top level function declaration
- if (blockScopeContainer.kind !== 284 /* SourceFile */ &&
- blockScopeContainer.kind !== 244 /* ModuleDeclaration */ &&
+ if (blockScopeContainer.kind !== 285 /* SourceFile */ &&
+ blockScopeContainer.kind !== 245 /* ModuleDeclaration */ &&
!ts.isFunctionLike(blockScopeContainer)) {
// We check first if the name is inside class declaration or class expression; if so give explicit message
// otherwise report generic error message.
@@ -29241,7 +29430,7 @@
// the current 'container' node when it changes. This helps us know which symbol table
// a local should go into for example. Since terminal nodes are known not to have
// children, as an optimization we don't process those.
- if (node.kind > 147 /* LastToken */) {
+ if (node.kind > 148 /* LastToken */) {
var saveParent = parent;
parent = node;
var containerFlags = getContainerFlags(node);
@@ -29303,7 +29492,7 @@
function bindWorker(node) {
switch (node.kind) {
/* Strict mode checks */
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
// for typedef type names with namespaces, bind the new jsdoc type symbol here
// because it requires all containing namespaces to be in effect, namely the
// current "blockScopeContainer" needs to be set to its immediate namespace parent.
@@ -29316,13 +29505,13 @@
break;
}
// falls through
- case 100 /* ThisKeyword */:
- if (currentFlow && (ts.isExpression(node) || parent.kind === 276 /* ShorthandPropertyAssignment */)) {
+ case 101 /* ThisKeyword */:
+ if (currentFlow && (ts.isExpression(node) || parent.kind === 277 /* ShorthandPropertyAssignment */)) {
node.flowNode = currentFlow;
}
return checkStrictModeIdentifier(node);
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
if (currentFlow && isNarrowableReference(node)) {
node.flowNode = currentFlow;
}
@@ -29336,7 +29525,7 @@
declareSymbol(file.locals, /*parent*/ undefined, node.expression, 1 /* FunctionScopedVariable */ | 134217728 /* ModuleExports */, 67220414 /* FunctionScopedVariableExcludes */);
}
break;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
var specialKind = ts.getAssignmentDeclarationKind(node);
switch (specialKind) {
case 1 /* ExportsProperty */:
@@ -29364,76 +29553,76 @@
ts.Debug.fail("Unknown binary expression special property assignment kind");
}
return checkStrictModeBinaryExpression(node);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return checkStrictModeCatchClause(node);
- case 198 /* DeleteExpression */:
+ case 199 /* DeleteExpression */:
return checkStrictModeDeleteExpression(node);
case 8 /* NumericLiteral */:
return checkStrictModeNumericLiteral(node);
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return checkStrictModePostfixUnaryExpression(node);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return checkStrictModePrefixUnaryExpression(node);
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
return checkStrictModeWithStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return checkStrictModeLabeledStatement(node);
- case 178 /* ThisType */:
+ case 179 /* ThisType */:
seenThisKeyword = true;
return;
- case 163 /* TypePredicate */:
+ case 164 /* TypePredicate */:
break; // Binding the children will handle everything
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
return bindTypeParameter(node);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return bindParameter(node);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return bindVariableDeclarationOrBindingElement(node);
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
node.flowNode = currentFlow;
return bindVariableDeclarationOrBindingElement(node);
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
return bindPropertyWorker(node);
- case 275 /* PropertyAssignment */:
- case 276 /* ShorthandPropertyAssignment */:
+ case 276 /* PropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 0 /* PropertyExcludes */);
- case 278 /* EnumMember */:
+ case 279 /* EnumMember */:
return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 68008959 /* EnumMemberExcludes */);
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
return declareSymbolAndAddToSymbolTable(node, 131072 /* Signature */, 0 /* None */);
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
// If this is an ObjectLiteralExpression method, then it sits in the same space
// as other properties in the object literal. So we use SymbolFlags.PropertyExcludes
// so that it will conflict with any other object literal members with the same
// name.
return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 16777216 /* Optional */ : 0 /* None */), ts.isObjectLiteralMethod(node) ? 0 /* PropertyExcludes */ : 67212223 /* MethodExcludes */);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return bindFunctionDeclaration(node);
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */);
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 67154879 /* GetAccessorExcludes */);
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 67187647 /* SetAccessorExcludes */);
- case 165 /* FunctionType */:
- case 294 /* JSDocFunctionType */:
- case 298 /* JSDocSignature */:
- case 166 /* ConstructorType */:
+ case 166 /* FunctionType */:
+ case 295 /* JSDocFunctionType */:
+ case 299 /* JSDocSignature */:
+ case 167 /* ConstructorType */:
return bindFunctionOrConstructorType(node);
- case 168 /* TypeLiteral */:
- case 297 /* JSDocTypeLiteral */:
- case 181 /* MappedType */:
+ case 169 /* TypeLiteral */:
+ case 298 /* JSDocTypeLiteral */:
+ case 182 /* MappedType */:
return bindAnonymousTypeWorker(node);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return bindObjectLiteralExpression(node);
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return bindFunctionExpression(node);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
var assignmentKind = ts.getAssignmentDeclarationKind(node);
switch (assignmentKind) {
case 7 /* ObjectDefinePropertyValue */:
@@ -29452,64 +29641,64 @@
}
break;
// Members of classes, interfaces, and modules
- case 209 /* ClassExpression */:
- case 240 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
// All classes are automatically in strict mode in ES6.
inStrictMode = true;
return bindClassLikeDeclaration(node);
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
return bindBlockScopedDeclaration(node, 64 /* Interface */, 67897736 /* InterfaceExcludes */);
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 67897832 /* TypeAliasExcludes */);
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return bindEnumDeclaration(node);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return bindModuleDeclaration(node);
// Jsx-attributes
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
return bindJsxAttributes(node);
- case 267 /* JsxAttribute */:
+ case 268 /* JsxAttribute */:
return bindJsxAttribute(node, 4 /* Property */, 0 /* PropertyExcludes */);
// Imports and exports
- case 248 /* ImportEqualsDeclaration */:
- case 251 /* NamespaceImport */:
- case 253 /* ImportSpecifier */:
- case 257 /* ExportSpecifier */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 252 /* NamespaceImport */:
+ case 254 /* ImportSpecifier */:
+ case 258 /* ExportSpecifier */:
return declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */);
- case 247 /* NamespaceExportDeclaration */:
+ case 248 /* NamespaceExportDeclaration */:
return bindNamespaceExportDeclaration(node);
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
return bindImportClause(node);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return bindExportDeclaration(node);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return bindExportAssignment(node);
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
updateStrictModeStatementList(node.statements);
return bindSourceFileIfExternalModule();
- case 218 /* Block */:
+ case 219 /* Block */:
if (!ts.isFunctionLike(node.parent)) {
return;
}
// falls through
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
return updateStrictModeStatementList(node.statements);
- case 304 /* JSDocParameterTag */:
- if (node.parent.kind === 298 /* JSDocSignature */) {
+ case 305 /* JSDocParameterTag */:
+ if (node.parent.kind === 299 /* JSDocSignature */) {
return bindParameter(node);
}
- if (node.parent.kind !== 297 /* JSDocTypeLiteral */) {
+ if (node.parent.kind !== 298 /* JSDocTypeLiteral */) {
break;
}
// falls through
- case 310 /* JSDocPropertyTag */:
+ case 311 /* JSDocPropertyTag */:
var propTag = node;
- var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 293 /* JSDocOptionalType */ ?
+ var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 294 /* JSDocOptionalType */ ?
4 /* Property */ | 16777216 /* Optional */ :
4 /* Property */;
return declareSymbolAndAddToSymbolTable(propTag, flags, 0 /* PropertyExcludes */);
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
return (delayedTypeAliases || (delayedTypeAliases = [])).push(node);
}
}
@@ -29653,11 +29842,11 @@
ts.Debug.assert(ts.isInJSFile(node));
var thisContainer = ts.getThisContainer(node, /*includeArrowFunctions*/ false);
switch (thisContainer.kind) {
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
var constructorSymbol = thisContainer.symbol;
// For `f.prototype.m = function() { this.x = 0; }`, `this.x = 0` should modify `f`'s members, not the function expression.
- if (ts.isBinaryExpression(thisContainer.parent) && thisContainer.parent.operatorToken.kind === 59 /* EqualsToken */) {
+ if (ts.isBinaryExpression(thisContainer.parent) && thisContainer.parent.operatorToken.kind === 60 /* EqualsToken */) {
var l = thisContainer.parent.left;
if (ts.isPropertyAccessEntityNameExpression(l) && ts.isPrototypeAccess(l.expression)) {
constructorSymbol = lookupSymbolForPropertyAccess(l.expression.expression, thisParentContainer);
@@ -29670,18 +29859,18 @@
declareSymbol(constructorSymbol.members, constructorSymbol, node, 4 /* Property */, 0 /* PropertyExcludes */ & ~4 /* Property */);
}
break;
- case 157 /* Constructor */:
- case 154 /* PropertyDeclaration */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 158 /* Constructor */:
+ case 155 /* PropertyDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
// this.foo assignment in a JavaScript class
// Bind this property to the containing class
var containingClass = thisContainer.parent;
var symbolTable = ts.hasModifier(thisContainer, 32 /* Static */) ? containingClass.symbol.exports : containingClass.symbol.members;
declareSymbol(symbolTable, containingClass.symbol, node, 4 /* Property */, 0 /* None */, /*isReplaceableByMethod*/ true);
break;
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
// this.property = assignment in a source file -- declare symbol in exports for a module, in locals for a script
if (thisContainer.commonJsModuleIndicator) {
declareSymbol(thisContainer.symbol.exports, thisContainer.symbol, node, 4 /* Property */ | 1048576 /* ExportValue */, 0 /* None */);
@@ -29691,14 +29880,14 @@
}
break;
default:
- ts.Debug.fail(ts.Debug.showSyntaxKind(thisContainer));
+ ts.Debug.failBadSyntaxKind(thisContainer);
}
}
function bindSpecialPropertyDeclaration(node) {
- if (node.expression.kind === 100 /* ThisKeyword */) {
+ if (node.expression.kind === 101 /* ThisKeyword */) {
bindThisPropertyAssignment(node);
}
- else if (ts.isPropertyAccessEntityNameExpression(node) && node.parent.parent.kind === 284 /* SourceFile */) {
+ else if (ts.isPropertyAccessEntityNameExpression(node) && node.parent.parent.kind === 285 /* SourceFile */) {
if (ts.isPrototypeAccess(node.expression)) {
bindPrototypePropertyAssignment(node, node.parent);
}
@@ -29735,7 +29924,7 @@
}
function bindObjectDefinePropertyAssignment(node) {
var namespaceSymbol = lookupSymbolForPropertyAccess(node.arguments[0]);
- var isToplevel = node.parent.parent.kind === 284 /* SourceFile */;
+ var isToplevel = node.parent.parent.kind === 285 /* SourceFile */;
namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, node.arguments[0], isToplevel, /*isPrototypeProperty*/ false);
bindPotentiallyNewExpandoMemberToNamespace(node, namespaceSymbol, /*isPrototypeProperty*/ false);
}
@@ -29749,7 +29938,7 @@
// Fix up parent pointers since we're going to use these nodes before we bind into them
node.left.parent = node;
node.right.parent = node;
- if (ts.isIdentifier(lhs.expression) && container === file && isNameOfExportsOrModuleExportsAliasDeclaration(file, lhs.expression)) {
+ if (ts.isIdentifier(lhs.expression) && container === file && isExportsOrModuleExportsOrAlias(file, lhs.expression)) {
// This can be an alias for the 'exports' or 'module.exports' names, e.g.
// var util = module.exports;
// util.property = function ...
@@ -29802,8 +29991,8 @@
function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty) {
var namespaceSymbol = lookupSymbolForPropertyAccess(name);
var isToplevel = ts.isBinaryExpression(propertyAccess.parent)
- ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 284 /* SourceFile */
- : propertyAccess.parent.parent.kind === 284 /* SourceFile */;
+ ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 285 /* SourceFile */
+ : propertyAccess.parent.parent.kind === 285 /* SourceFile */;
namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, propertyAccess.expression, isToplevel, isPrototypeProperty);
bindPotentiallyNewExpandoMemberToNamespace(propertyAccess, namespaceSymbol, isPrototypeProperty);
}
@@ -29862,9 +30051,7 @@
}
else {
var s = forEachIdentifierInEntityName(e.expression, parent, action);
- if (!s || !s.exports)
- return ts.Debug.fail();
- return action(e.name, s.exports.get(e.name.escapedText), s);
+ return action(e.name, s && s.exports && s.exports.get(e.name.escapedText), s);
}
}
function bindCallExpression(node) {
@@ -29875,7 +30062,7 @@
}
}
function bindClassLikeDeclaration(node) {
- if (node.kind === 240 /* ClassDeclaration */) {
+ if (node.kind === 241 /* ClassDeclaration */) {
bindBlockScopedDeclaration(node, 32 /* Class */, 68008383 /* ClassExcludes */);
}
else {
@@ -29941,7 +30128,7 @@
}
}
function bindParameter(node) {
- if (node.kind === 304 /* JSDocParameterTag */ && container.kind !== 298 /* JSDocSignature */) {
+ if (node.kind === 305 /* JSDocParameterTag */ && container.kind !== 299 /* JSDocSignature */) {
return;
}
if (inStrictMode && !(node.flags & 4194304 /* Ambient */)) {
@@ -30018,7 +30205,7 @@
declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 67635688 /* TypeParameterExcludes */);
}
}
- else if (node.parent.kind === 176 /* InferType */) {
+ else if (node.parent.kind === 177 /* InferType */) {
var container_2 = getInferTypeContainer(node.parent);
if (container_2) {
if (!container_2.locals) {
@@ -30046,11 +30233,11 @@
if (currentFlow === unreachableFlow) {
var reportError =
// report error on all statements except empty ones
- (ts.isStatementButNotDeclaration(node) && node.kind !== 220 /* EmptyStatement */) ||
+ (ts.isStatementButNotDeclaration(node) && node.kind !== 221 /* EmptyStatement */) ||
// report error on class declarations
- node.kind === 240 /* ClassDeclaration */ ||
+ node.kind === 241 /* ClassDeclaration */ ||
// report error on instantiated modules or const-enums only modules if preserveConstEnums is set
- (node.kind === 244 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node));
+ (node.kind === 245 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node));
if (reportError) {
currentFlow = reportedUnreachableFlow;
if (!options.allowUnreachableCode) {
@@ -30094,32 +30281,41 @@
}
function isPurelyTypeDeclaration(s) {
switch (s.kind) {
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return true;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return getModuleInstanceState(s) !== 1 /* Instantiated */;
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return ts.hasModifier(s, 2048 /* Const */);
default:
return false;
}
}
function isExportsOrModuleExportsOrAlias(sourceFile, node) {
- return ts.isExportsIdentifier(node) ||
- ts.isModuleExportsPropertyAccessExpression(node) ||
- ts.isIdentifier(node) && isNameOfExportsOrModuleExportsAliasDeclaration(sourceFile, node);
+ var i = 0;
+ var q = [node];
+ while (q.length && i < 100) {
+ i++;
+ node = q.shift();
+ if (ts.isExportsIdentifier(node) || ts.isModuleExportsPropertyAccessExpression(node)) {
+ return true;
}
- ts.isExportsOrModuleExportsOrAlias = isExportsOrModuleExportsOrAlias;
- function isNameOfExportsOrModuleExportsAliasDeclaration(sourceFile, node) {
+ else if (ts.isIdentifier(node)) {
var symbol = lookupSymbolForNameWorker(sourceFile, node.escapedText);
- return !!symbol && !!symbol.valueDeclaration && ts.isVariableDeclaration(symbol.valueDeclaration) &&
- !!symbol.valueDeclaration.initializer && isExportsOrModuleExportsOrAliasOrAssignment(sourceFile, symbol.valueDeclaration.initializer);
+ if (!!symbol && !!symbol.valueDeclaration && ts.isVariableDeclaration(symbol.valueDeclaration) && !!symbol.valueDeclaration.initializer) {
+ var init = symbol.valueDeclaration.initializer;
+ q.push(init);
+ if (ts.isAssignmentExpression(init, /*excludeCompoundAssignment*/ true)) {
+ q.push(init.left);
+ q.push(init.right);
+ }
}
- function isExportsOrModuleExportsOrAliasOrAssignment(sourceFile, node) {
- return isExportsOrModuleExportsOrAlias(sourceFile, node) ||
- (ts.isAssignmentExpression(node, /*excludeCompoundAssignment*/ true) && (isExportsOrModuleExportsOrAliasOrAssignment(sourceFile, node.left) || isExportsOrModuleExportsOrAliasOrAssignment(sourceFile, node.right)));
}
+ }
+ return false;
+ }
+ ts.isExportsOrModuleExportsOrAlias = isExportsOrModuleExportsOrAlias;
function lookupSymbolForNameWorker(container, name) {
var local = container.locals && container.locals.get(name);
if (local) {
@@ -30139,58 +30335,58 @@
function computeTransformFlagsForNode(node, subtreeFlags) {
var kind = node.kind;
switch (kind) {
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return computeCallExpression(node, subtreeFlags);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return computeNewExpression(node, subtreeFlags);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return computeModuleDeclaration(node, subtreeFlags);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return computeParenthesizedExpression(node, subtreeFlags);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return computeBinaryExpression(node, subtreeFlags);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return computeExpressionStatement(node, subtreeFlags);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return computeParameter(node, subtreeFlags);
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return computeArrowFunction(node, subtreeFlags);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return computeFunctionExpression(node, subtreeFlags);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return computeFunctionDeclaration(node, subtreeFlags);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return computeVariableDeclaration(node, subtreeFlags);
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
return computeVariableDeclarationList(node, subtreeFlags);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return computeVariableStatement(node, subtreeFlags);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return computeLabeledStatement(node, subtreeFlags);
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return computeClassDeclaration(node, subtreeFlags);
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
return computeClassExpression(node, subtreeFlags);
- case 273 /* HeritageClause */:
+ case 274 /* HeritageClause */:
return computeHeritageClause(node, subtreeFlags);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return computeCatchClause(node, subtreeFlags);
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return computeExpressionWithTypeArguments(node, subtreeFlags);
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return computeConstructor(node, subtreeFlags);
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return computePropertyDeclaration(node, subtreeFlags);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return computeMethod(node, subtreeFlags);
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return computeAccessor(node, subtreeFlags);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return computeImportEquals(node, subtreeFlags);
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return computePropertyAccess(node, subtreeFlags);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return computeElementAccess(node, subtreeFlags);
default:
return computeOther(node, kind, subtreeFlags);
@@ -30212,7 +30408,7 @@
transformFlags |= 2048 /* ContainsLexicalThis */;
}
}
- if (expression.kind === 92 /* ImportKeyword */) {
+ if (expression.kind === 93 /* ImportKeyword */) {
transformFlags |= 524288 /* ContainsDynamicImport */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
@@ -30235,17 +30431,17 @@
var transformFlags = subtreeFlags;
var operatorTokenKind = node.operatorToken.kind;
var leftKind = node.left.kind;
- if (operatorTokenKind === 59 /* EqualsToken */ && leftKind === 188 /* ObjectLiteralExpression */) {
+ if (operatorTokenKind === 60 /* EqualsToken */ && leftKind === 189 /* ObjectLiteralExpression */) {
// Destructuring object assignments with are ES2015 syntax
// and possibly ES2018 if they contain rest
transformFlags |= 16 /* AssertES2018 */ | 128 /* AssertES2015 */ | 512 /* AssertDestructuringAssignment */;
}
- else if (operatorTokenKind === 59 /* EqualsToken */ && leftKind === 187 /* ArrayLiteralExpression */) {
+ else if (operatorTokenKind === 60 /* EqualsToken */ && leftKind === 188 /* ArrayLiteralExpression */) {
// Destructuring assignments are ES2015 syntax.
transformFlags |= 128 /* AssertES2015 */ | 512 /* AssertDestructuringAssignment */;
}
else if (operatorTokenKind === 41 /* AsteriskAsteriskToken */
- || operatorTokenKind === 63 /* AsteriskAsteriskEqualsToken */) {
+ || operatorTokenKind === 64 /* AsteriskAsteriskEqualsToken */) {
// Exponentiation is ES2016 syntax.
transformFlags |= 64 /* AssertES2016 */;
}
@@ -30288,8 +30484,8 @@
// If the node is synthesized, it means the emitter put the parentheses there,
// not the user. If we didn't want them, the emitter would not have put them
// there.
- if (expressionKind === 212 /* AsExpression */
- || expressionKind === 194 /* TypeAssertionExpression */) {
+ if (expressionKind === 213 /* AsExpression */
+ || expressionKind === 195 /* TypeAssertionExpression */) {
transformFlags |= 1 /* AssertTypeScript */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
@@ -30331,11 +30527,11 @@
function computeHeritageClause(node, subtreeFlags) {
var transformFlags = subtreeFlags;
switch (node.token) {
- case 86 /* ExtendsKeyword */:
+ case 87 /* ExtendsKeyword */:
// An `extends` HeritageClause is ES6 syntax.
transformFlags |= 128 /* AssertES2015 */;
break;
- case 109 /* ImplementsKeyword */:
+ case 110 /* ImplementsKeyword */:
// An `implements` HeritageClause is TypeScript syntax.
transformFlags |= 1 /* AssertTypeScript */;
break;
@@ -30528,7 +30724,7 @@
var transformFlags = subtreeFlags;
// If a PropertyAccessExpression starts with a super keyword, then it is
// ES6 syntax, and requires a lexical `this` binding.
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
// super inside of an async function requires hoisting the super access (ES2017).
// same for super inside of an async generator, which is ES2018.
transformFlags |= 32 /* ContainsES2017 */ | 16 /* ContainsES2018 */;
@@ -30540,7 +30736,7 @@
var transformFlags = subtreeFlags;
// If an ElementAccessExpression starts with a super keyword, then it is
// ES6 syntax, and requires a lexical `this` binding.
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
// super inside of an async function requires hoisting the super access (ES2017).
// same for super inside of an async generator, which is ES2018.
transformFlags |= 32 /* ContainsES2017 */ | 16 /* ContainsES2018 */;
@@ -30628,43 +30824,43 @@
var transformFlags = subtreeFlags;
var excludeFlags = 536870912 /* NodeExcludes */;
switch (kind) {
- case 121 /* AsyncKeyword */:
- case 201 /* AwaitExpression */:
+ case 122 /* AsyncKeyword */:
+ case 202 /* AwaitExpression */:
// async/await is ES2017 syntax, but may be ES2018 syntax (for async generators)
transformFlags |= 16 /* AssertES2018 */ | 32 /* AssertES2017 */;
break;
- case 194 /* TypeAssertionExpression */:
- case 212 /* AsExpression */:
- case 313 /* PartiallyEmittedExpression */:
+ case 195 /* TypeAssertionExpression */:
+ case 213 /* AsExpression */:
+ case 314 /* PartiallyEmittedExpression */:
// These nodes are TypeScript syntax.
transformFlags |= 1 /* AssertTypeScript */;
excludeFlags = 536870912 /* OuterExpressionExcludes */;
break;
- case 115 /* PublicKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 118 /* AbstractKeyword */:
- case 125 /* DeclareKeyword */:
- case 77 /* ConstKeyword */:
- case 243 /* EnumDeclaration */:
- case 278 /* EnumMember */:
- case 213 /* NonNullExpression */:
- case 133 /* ReadonlyKeyword */:
+ case 116 /* PublicKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 119 /* AbstractKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 78 /* ConstKeyword */:
+ case 244 /* EnumDeclaration */:
+ case 279 /* EnumMember */:
+ case 214 /* NonNullExpression */:
+ case 134 /* ReadonlyKeyword */:
// These nodes are TypeScript syntax.
transformFlags |= 1 /* AssertTypeScript */;
break;
- case 260 /* JsxElement */:
- case 261 /* JsxSelfClosingElement */:
- case 262 /* JsxOpeningElement */:
+ case 261 /* JsxElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
case 11 /* JsxText */:
- case 263 /* JsxClosingElement */:
- case 264 /* JsxFragment */:
- case 265 /* JsxOpeningFragment */:
- case 266 /* JsxClosingFragment */:
- case 267 /* JsxAttribute */:
- case 268 /* JsxAttributes */:
- case 269 /* JsxSpreadAttribute */:
- case 270 /* JsxExpression */:
+ case 264 /* JsxClosingElement */:
+ case 265 /* JsxFragment */:
+ case 266 /* JsxOpeningFragment */:
+ case 267 /* JsxClosingFragment */:
+ case 268 /* JsxAttribute */:
+ case 269 /* JsxAttributes */:
+ case 270 /* JsxSpreadAttribute */:
+ case 271 /* JsxExpression */:
// These nodes are Jsx syntax.
transformFlags |= 2 /* AssertJsx */;
break;
@@ -30672,11 +30868,11 @@
case 15 /* TemplateHead */:
case 16 /* TemplateMiddle */:
case 17 /* TemplateTail */:
- case 206 /* TemplateExpression */:
- case 193 /* TaggedTemplateExpression */:
- case 276 /* ShorthandPropertyAssignment */:
- case 116 /* StaticKeyword */:
- case 214 /* MetaProperty */:
+ case 207 /* TemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
+ case 277 /* ShorthandPropertyAssignment */:
+ case 117 /* StaticKeyword */:
+ case 215 /* MetaProperty */:
// These nodes are ES6 syntax.
transformFlags |= 128 /* AssertES2015 */;
break;
@@ -30693,103 +30889,103 @@
case 9 /* BigIntLiteral */:
transformFlags |= 4 /* AssertESNext */;
break;
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
// This node is either ES2015 syntax or ES2017 syntax (if it is a for-await-of).
if (node.awaitModifier) {
transformFlags |= 16 /* AssertES2018 */;
}
transformFlags |= 128 /* AssertES2015 */;
break;
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
// This node is either ES2015 syntax (in a generator) or ES2017 syntax (in an async
// generator).
transformFlags |= 16 /* AssertES2018 */ | 128 /* AssertES2015 */ | 131072 /* ContainsYield */;
break;
- case 120 /* AnyKeyword */:
- case 135 /* NumberKeyword */:
- case 146 /* BigIntKeyword */:
- case 132 /* NeverKeyword */:
- case 136 /* ObjectKeyword */:
- case 138 /* StringKeyword */:
- case 123 /* BooleanKeyword */:
- case 139 /* SymbolKeyword */:
- case 106 /* VoidKeyword */:
- case 150 /* TypeParameter */:
- case 153 /* PropertySignature */:
- case 155 /* MethodSignature */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
- case 163 /* TypePredicate */:
- case 164 /* TypeReference */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 167 /* TypeQuery */:
- case 168 /* TypeLiteral */:
- case 169 /* ArrayType */:
- case 170 /* TupleType */:
- case 171 /* OptionalType */:
- case 172 /* RestType */:
- case 173 /* UnionType */:
- case 174 /* IntersectionType */:
- case 175 /* ConditionalType */:
- case 176 /* InferType */:
- case 177 /* ParenthesizedType */:
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 178 /* ThisType */:
- case 179 /* TypeOperator */:
- case 180 /* IndexedAccessType */:
- case 181 /* MappedType */:
- case 182 /* LiteralType */:
- case 247 /* NamespaceExportDeclaration */:
+ case 121 /* AnyKeyword */:
+ case 136 /* NumberKeyword */:
+ case 147 /* BigIntKeyword */:
+ case 133 /* NeverKeyword */:
+ case 137 /* ObjectKeyword */:
+ case 139 /* StringKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 107 /* VoidKeyword */:
+ case 151 /* TypeParameter */:
+ case 154 /* PropertySignature */:
+ case 156 /* MethodSignature */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
+ case 164 /* TypePredicate */:
+ case 165 /* TypeReference */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 168 /* TypeQuery */:
+ case 169 /* TypeLiteral */:
+ case 170 /* ArrayType */:
+ case 171 /* TupleType */:
+ case 172 /* OptionalType */:
+ case 173 /* RestType */:
+ case 174 /* UnionType */:
+ case 175 /* IntersectionType */:
+ case 176 /* ConditionalType */:
+ case 177 /* InferType */:
+ case 178 /* ParenthesizedType */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 179 /* ThisType */:
+ case 180 /* TypeOperator */:
+ case 181 /* IndexedAccessType */:
+ case 182 /* MappedType */:
+ case 183 /* LiteralType */:
+ case 248 /* NamespaceExportDeclaration */:
// Types and signatures are TypeScript syntax, and exclude all other facts.
transformFlags = 1 /* AssertTypeScript */;
excludeFlags = -2 /* TypeExcludes */;
break;
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
// Even though computed property names are ES6, we don't treat them as such.
// This is so that they can flow through PropertyName transforms unaffected.
// Instead, we mark the container as ES6, so that it can properly handle the transform.
transformFlags |= 16384 /* ContainsComputedPropertyName */;
break;
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
transformFlags |= 128 /* AssertES2015 */ | 4096 /* ContainsRestOrSpread */;
break;
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
transformFlags |= 16 /* AssertES2018 */ | 8192 /* ContainsObjectRestOrSpread */;
break;
- case 98 /* SuperKeyword */:
+ case 99 /* SuperKeyword */:
// This node is ES6 syntax.
transformFlags |= 128 /* AssertES2015 */;
excludeFlags = 536870912 /* OuterExpressionExcludes */; // must be set to persist `Super`
break;
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
// Mark this node and its ancestors as containing a lexical `this` keyword.
transformFlags |= 2048 /* ContainsLexicalThis */;
break;
- case 184 /* ObjectBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
transformFlags |= 128 /* AssertES2015 */ | 65536 /* ContainsBindingPattern */;
if (subtreeFlags & 4096 /* ContainsRestOrSpread */) {
transformFlags |= 16 /* AssertES2018 */ | 8192 /* ContainsObjectRestOrSpread */;
}
excludeFlags = 536875008 /* BindingPatternExcludes */;
break;
- case 185 /* ArrayBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
transformFlags |= 128 /* AssertES2015 */ | 65536 /* ContainsBindingPattern */;
excludeFlags = 536875008 /* BindingPatternExcludes */;
break;
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
transformFlags |= 128 /* AssertES2015 */;
if (node.dotDotDotToken) {
transformFlags |= 4096 /* ContainsRestOrSpread */;
}
break;
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
// This node is TypeScript syntax, and marks its container as also being TypeScript syntax.
transformFlags |= 1 /* AssertTypeScript */ | 1024 /* ContainsTypeScriptClassSyntax */;
break;
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
excludeFlags = 536896512 /* ObjectLiteralExcludes */;
if (subtreeFlags & 16384 /* ContainsComputedPropertyName */) {
// If an ObjectLiteralExpression contains a ComputedPropertyName, then it
@@ -30802,26 +30998,26 @@
transformFlags |= 16 /* AssertES2018 */;
}
break;
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
excludeFlags = 536875008 /* ArrayLiteralOrCallOrNewExcludes */;
break;
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
// A loop containing a block scoped binding *may* need to be transformed from ES6.
if (subtreeFlags & 32768 /* ContainsBlockScopedBinding */) {
transformFlags |= 128 /* AssertES2015 */;
}
break;
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
break;
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
// Return statements may require an `await` in ES2018.
transformFlags |= 262144 /* ContainsHoistedDeclarationOrCompletion */ | 16 /* AssertES2018 */;
break;
- case 228 /* ContinueStatement */:
- case 229 /* BreakStatement */:
+ case 229 /* ContinueStatement */:
+ case 230 /* BreakStatement */:
transformFlags |= 262144 /* ContainsHoistedDeclarationOrCompletion */;
break;
}
@@ -30839,67 +31035,67 @@
* than calling this function.
*/
function getTransformFlagsSubtreeExclusions(kind) {
- if (kind >= 163 /* FirstTypeNode */ && kind <= 183 /* LastTypeNode */) {
+ if (kind >= 164 /* FirstTypeNode */ && kind <= 184 /* LastTypeNode */) {
return -2 /* TypeExcludes */;
}
switch (kind) {
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
- case 187 /* ArrayLiteralExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
+ case 188 /* ArrayLiteralExpression */:
return 536875008 /* ArrayLiteralOrCallOrNewExcludes */;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return 537168896 /* ModuleExcludes */;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return 536870912 /* ParameterExcludes */;
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return 537371648 /* ArrowFunctionExcludes */;
- case 196 /* FunctionExpression */:
- case 239 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
return 537373696 /* FunctionExcludes */;
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
return 536944640 /* VariableDeclarationListExcludes */;
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
return 536888320 /* ClassExcludes */;
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return 537372672 /* ConstructorExcludes */;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return 537372672 /* MethodOrAccessorExcludes */;
- case 120 /* AnyKeyword */:
- case 135 /* NumberKeyword */:
- case 146 /* BigIntKeyword */:
- case 132 /* NeverKeyword */:
- case 138 /* StringKeyword */:
- case 136 /* ObjectKeyword */:
- case 123 /* BooleanKeyword */:
- case 139 /* SymbolKeyword */:
- case 106 /* VoidKeyword */:
- case 150 /* TypeParameter */:
- case 153 /* PropertySignature */:
- case 155 /* MethodSignature */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
+ case 121 /* AnyKeyword */:
+ case 136 /* NumberKeyword */:
+ case 147 /* BigIntKeyword */:
+ case 133 /* NeverKeyword */:
+ case 139 /* StringKeyword */:
+ case 137 /* ObjectKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 107 /* VoidKeyword */:
+ case 151 /* TypeParameter */:
+ case 154 /* PropertySignature */:
+ case 156 /* MethodSignature */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return -2 /* TypeExcludes */;
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return 536896512 /* ObjectLiteralExcludes */;
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return 536879104 /* CatchClauseExcludes */;
- case 184 /* ObjectBindingPattern */:
- case 185 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
return 536875008 /* BindingPatternExcludes */;
- case 194 /* TypeAssertionExpression */:
- case 212 /* AsExpression */:
- case 313 /* PartiallyEmittedExpression */:
- case 195 /* ParenthesizedExpression */:
- case 98 /* SuperKeyword */:
+ case 195 /* TypeAssertionExpression */:
+ case 213 /* AsExpression */:
+ case 314 /* PartiallyEmittedExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 99 /* SuperKeyword */:
return 536870912 /* OuterExpressionExcludes */;
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return 536870912 /* PropertyAccessExcludes */;
default:
return 536870912 /* NodeExcludes */;
@@ -31074,7 +31270,7 @@
// (their type resolved directly to the member deeply referenced)
// So to get the intervening symbols, we need to check if there's a type
// query node on any of the symbol's declarations and get symbols there
- if (d.type && d.type.kind === 167 /* TypeQuery */) {
+ if (d.type && d.type.kind === 168 /* TypeQuery */) {
var query = d.type;
var entity = getResolvedSymbol(getFirstIdentifier(query.exprName));
visitSymbol(entity);
@@ -31173,8 +31369,6 @@
undefinedSymbol.declarations = [];
var globalThisSymbol = createSymbol(1536 /* Module */, "globalThis", 8 /* Readonly */);
globalThisSymbol.exports = globals;
- globalThisSymbol.valueDeclaration = ts.createNode(72 /* Identifier */);
- globalThisSymbol.valueDeclaration.escapedText = "globalThis";
globals.set(globalThisSymbol.escapedName, globalThisSymbol);
var argumentsSymbol = createSymbol(4 /* Property */, "arguments");
var requireSymbol = createSymbol(4 /* Property */, "require");
@@ -31190,6 +31384,11 @@
getIdentifierCount: function () { return ts.sum(host.getSourceFiles(), "identifierCount"); },
getSymbolCount: function () { return ts.sum(host.getSourceFiles(), "symbolCount") + symbolCount; },
getTypeCount: function () { return typeCount; },
+ getRelationCacheSizes: function () { return ({
+ assignable: assignableRelation.size,
+ identity: identityRelation.size,
+ subtype: subtypeRelation.size,
+ }); },
isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; },
isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; },
isUnknownSymbol: function (symbol) { return symbol === unknownSymbol; },
@@ -31256,6 +31455,10 @@
node = ts.getParseTreeNode(node);
return node ? getTypeOfNode(node) : errorType;
},
+ getTypeOfAssignmentPattern: function (nodeIn) {
+ var node = ts.getParseTreeNode(nodeIn, ts.isAssignmentPattern);
+ return node && getTypeOfAssignmentPattern(node) || errorType;
+ },
getPropertySymbolOfDestructuringAssignment: function (locationIn) {
var location = ts.getParseTreeNode(locationIn, ts.isIdentifier);
return location ? getPropertySymbolOfDestructuringAssignment(location) : undefined;
@@ -31304,11 +31507,11 @@
},
isContextSensitive: isContextSensitive,
getFullyQualifiedName: getFullyQualifiedName,
- getResolvedSignature: function (node, candidatesOutArray, agumentCount) {
- return getResolvedSignatureWorker(node, candidatesOutArray, agumentCount, 0 /* Normal */);
+ getResolvedSignature: function (node, candidatesOutArray, argumentCount) {
+ return getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0 /* Normal */);
},
- getResolvedSignatureForSignatureHelp: function (node, candidatesOutArray, agumentCount) {
- return getResolvedSignatureWorker(node, candidatesOutArray, agumentCount, 16 /* IsForSignatureHelp */);
+ getResolvedSignatureForSignatureHelp: function (node, candidatesOutArray, argumentCount) {
+ return getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */);
},
getExpandedParameters: getExpandedParameters,
hasEffectiveRestParameter: hasEffectiveRestParameter,
@@ -31451,7 +31654,7 @@
var intersectionTypes = ts.createMap();
var literalTypes = ts.createMap();
var indexedAccessTypes = ts.createMap();
- var conditionalTypes = ts.createMap();
+ var substitutionTypes = ts.createMap();
var evolvingArrayTypes = [];
var undefinedProperties = ts.createMap();
var unknownSymbol = createSymbol(4 /* Property */, "unknown");
@@ -31531,6 +31734,7 @@
* This is only used if there is no exact match.
*/
var patternAmbientModules;
+ var patternAmbientModuleAugmentations;
var globalObjectType;
var globalFunctionType;
var globalCallableFunctionType;
@@ -31565,8 +31769,7 @@
var deferredGlobalTemplateStringsArrayType;
var deferredGlobalImportMetaType;
var deferredGlobalExtractSymbol;
- var deferredGlobalExcludeSymbol;
- var deferredGlobalPickSymbol;
+ var deferredGlobalOmitSymbol;
var deferredGlobalBigIntType;
var allPotentiallyUnusedIdentifiers = ts.createMap(); // key is file name
var flowLoopStart = 0;
@@ -31585,6 +31788,8 @@
var symbolLinks = [];
var nodeLinks = [];
var flowLoopCaches = [];
+ var flowAssignmentKeys = [];
+ var flowAssignmentTypes = [];
var flowLoopNodes = [];
var flowLoopKeys = [];
var flowLoopTypes = [];
@@ -31701,6 +31906,7 @@
var typeofType = createTypeofType();
var _jsxNamespace;
var _jsxFactoryEntity;
+ var outofbandVarianceMarkerHandler;
var subtypeRelation = ts.createMap();
var assignableRelation = ts.createMap();
var comparableRelation = ts.createMap();
@@ -31725,6 +31931,18 @@
CheckMode[CheckMode["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
CheckMode[CheckMode["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
})(CheckMode || (CheckMode = {}));
+ var ContextFlags;
+ (function (ContextFlags) {
+ ContextFlags[ContextFlags["None"] = 0] = "None";
+ ContextFlags[ContextFlags["Signature"] = 1] = "Signature";
+ })(ContextFlags || (ContextFlags = {}));
+ var AccessFlags;
+ (function (AccessFlags) {
+ AccessFlags[AccessFlags["None"] = 0] = "None";
+ AccessFlags[AccessFlags["NoIndexSignatures"] = 1] = "NoIndexSignatures";
+ AccessFlags[AccessFlags["Writing"] = 2] = "Writing";
+ AccessFlags[AccessFlags["CacheSymbol"] = 4] = "CacheSymbol";
+ })(AccessFlags || (AccessFlags = {}));
var CallbackCheck;
(function (CallbackCheck) {
CallbackCheck[CallbackCheck["None"] = 0] = "None";
@@ -31899,7 +32117,8 @@
* Note: if target is transient, then it is mutable, and mergeSymbol with both mutate and return it.
* If target is not transient, mergeSymbol will produce a transient clone, mutate that and return it.
*/
- function mergeSymbol(target, source) {
+ function mergeSymbol(target, source, unidirectional) {
+ if (unidirectional === void 0) { unidirectional = false; }
if (!(target.flags & getExcludedSymbolFlags(source.flags)) ||
(source.flags | target.flags) & 67108864 /* Assignment */) {
ts.Debug.assert(source !== target);
@@ -31927,18 +32146,25 @@
if (source.members) {
if (!target.members)
target.members = ts.createSymbolTable();
- mergeSymbolTable(target.members, source.members);
+ mergeSymbolTable(target.members, source.members, unidirectional);
}
if (source.exports) {
if (!target.exports)
target.exports = ts.createSymbolTable();
- mergeSymbolTable(target.exports, source.exports);
+ mergeSymbolTable(target.exports, source.exports, unidirectional);
}
+ if (!unidirectional) {
recordMergedSymbol(target, source);
}
+ }
else if (target.flags & 1024 /* NamespaceModule */) {
+ // Do not report an error when merging `var globalThis` with the built-in `globalThis`,
+ // as we will already report a "Declaration name conflicts..." error, and this error
+ // won't make much sense.
+ if (target !== globalThisSymbol) {
error(ts.getNameOfDeclaration(source.declarations[0]), ts.Diagnostics.Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity, symbolToString(target));
}
+ }
else { // error
var isEitherEnum = !!(target.flags & 384 /* Enum */ || source.flags & 384 /* Enum */);
var isEitherBlockScoped_1 = !!(target.flags & 2 /* BlockScopedVariable */ || source.flags & 2 /* BlockScopedVariable */);
@@ -32002,10 +32228,11 @@
mergeSymbolTable(combined, second);
return combined;
}
- function mergeSymbolTable(target, source) {
+ function mergeSymbolTable(target, source, unidirectional) {
+ if (unidirectional === void 0) { unidirectional = false; }
source.forEach(function (sourceSymbol, id) {
var targetSymbol = target.get(id);
- target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol) : sourceSymbol);
+ target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : sourceSymbol);
});
}
function mergeModuleAugmentation(moduleName) {
@@ -32026,14 +32253,29 @@
var moduleNotFoundError = !(moduleName.parent.parent.flags & 4194304 /* Ambient */)
? ts.Diagnostics.Invalid_module_name_in_augmentation_module_0_cannot_be_found
: undefined;
- var mainModule = resolveExternalModuleNameWorker(moduleName, moduleName, moduleNotFoundError, /*isForAugmentation*/ true);
- if (!mainModule) {
+ var mainModule_1 = resolveExternalModuleNameWorker(moduleName, moduleName, moduleNotFoundError, /*isForAugmentation*/ true);
+ if (!mainModule_1) {
return;
}
// obtain item referenced by 'export='
- mainModule = resolveExternalModuleSymbol(mainModule);
- if (mainModule.flags & 1920 /* Namespace */) {
- mainModule = mergeSymbol(mainModule, moduleAugmentation.symbol);
+ mainModule_1 = resolveExternalModuleSymbol(mainModule_1);
+ if (mainModule_1.flags & 1920 /* Namespace */) {
+ // If we’re merging an augmentation to a pattern ambient module, we want to
+ // perform the merge unidirectionally from the augmentation ('a.foo') to
+ // the pattern ('*.foo'), so that 'getMergedSymbol()' on a.foo gives you
+ // all the exports both from the pattern and from the augmentation, but
+ // 'getMergedSymbol()' on *.foo only gives you exports from *.foo.
+ if (ts.some(patternAmbientModules, function (module) { return mainModule_1 === module.symbol; })) {
+ var merged = mergeSymbol(moduleAugmentation.symbol, mainModule_1, /*unidirectional*/ true);
+ if (!patternAmbientModuleAugmentations) {
+ patternAmbientModuleAugmentations = ts.createMap();
+ }
+ // moduleName will be a StringLiteral since this is not `declare global`.
+ patternAmbientModuleAugmentations.set(moduleName.text, merged);
+ }
+ else {
+ mergeSymbol(mainModule_1, moduleAugmentation.symbol);
+ }
}
else {
// moduleName will be a StringLiteral since this is not `declare global`.
@@ -32067,7 +32309,7 @@
return nodeLinks[nodeId] || (nodeLinks[nodeId] = { flags: 0 });
}
function isGlobalSourceFile(node) {
- return node.kind === 284 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node);
+ return node.kind === 285 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node);
}
function getSymbol(symbols, name, meaning) {
if (meaning) {
@@ -32125,17 +32367,17 @@
}
if (declaration.pos <= usage.pos) {
// declaration is before usage
- if (declaration.kind === 186 /* BindingElement */) {
+ if (declaration.kind === 187 /* BindingElement */) {
// still might be illegal if declaration and usage are both binding elements (eg var [a = b, b = b] = [1, 2])
- var errorBindingElement = ts.getAncestor(usage, 186 /* BindingElement */);
+ var errorBindingElement = ts.getAncestor(usage, 187 /* BindingElement */);
if (errorBindingElement) {
return ts.findAncestor(errorBindingElement, ts.isBindingElement) !== ts.findAncestor(declaration, ts.isBindingElement) ||
declaration.pos < errorBindingElement.pos;
}
// or it might be illegal if usage happens before parent variable is declared (eg var [a] = a)
- return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 237 /* VariableDeclaration */), usage);
+ return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 238 /* VariableDeclaration */), usage);
}
- else if (declaration.kind === 237 /* VariableDeclaration */) {
+ else if (declaration.kind === 238 /* VariableDeclaration */) {
// still might be illegal if usage is in the initializer of the variable declaration (eg var a = a)
return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage);
}
@@ -32143,6 +32385,10 @@
// still might be illegal if the usage is within a computed property name in the class (eg class A { static p = "a"; [A.p]() {} })
return !ts.findAncestor(usage, function (n) { return ts.isComputedPropertyName(n) && n.parent.parent === declaration; });
}
+ else if (ts.isPropertyDeclaration(declaration)) {
+ // still might be illegal if a self-referencing property initializer (eg private x = this.x)
+ return !isPropertyImmediatelyReferencedWithinDeclaration(declaration, usage);
+ }
return true;
}
// declaration is after usage, but it can still be legal if usage is deferred:
@@ -32154,12 +32400,12 @@
// or if usage is in a type context:
// 1. inside a type query (typeof in type position)
// 2. inside a jsdoc comment
- if (usage.parent.kind === 257 /* ExportSpecifier */ || (usage.parent.kind === 254 /* ExportAssignment */ && usage.parent.isExportEquals)) {
+ if (usage.parent.kind === 258 /* ExportSpecifier */ || (usage.parent.kind === 255 /* ExportAssignment */ && usage.parent.isExportEquals)) {
// export specifiers do not use the variable, they only make it available for use
return true;
}
// When resolving symbols for exports, the `usage` location passed in can be the export site directly
- if (usage.kind === 254 /* ExportAssignment */ && usage.isExportEquals) {
+ if (usage.kind === 255 /* ExportAssignment */ && usage.isExportEquals) {
return true;
}
var container = ts.getEnclosingBlockScopeContainer(declaration);
@@ -32167,9 +32413,9 @@
function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) {
var container = ts.getEnclosingBlockScopeContainer(declaration);
switch (declaration.parent.parent.kind) {
- case 219 /* VariableStatement */:
- case 225 /* ForStatement */:
- case 227 /* ForOfStatement */:
+ case 220 /* VariableStatement */:
+ case 226 /* ForStatement */:
+ case 228 /* ForOfStatement */:
// variable statement/for/for-of statement case,
// use site should not be inside variable declaration (initializer of declaration or binding element)
if (isSameScopeDescendentOf(usage, declaration, container)) {
@@ -32190,16 +32436,16 @@
return true;
}
var initializerOfProperty = current.parent &&
- current.parent.kind === 154 /* PropertyDeclaration */ &&
+ current.parent.kind === 155 /* PropertyDeclaration */ &&
current.parent.initializer === current;
if (initializerOfProperty) {
if (ts.hasModifier(current.parent, 32 /* Static */)) {
- if (declaration.kind === 156 /* MethodDeclaration */) {
+ if (declaration.kind === 157 /* MethodDeclaration */) {
return true;
}
}
else {
- var isDeclarationInstanceProperty = declaration.kind === 154 /* PropertyDeclaration */ && !ts.hasModifier(declaration, 32 /* Static */);
+ var isDeclarationInstanceProperty = declaration.kind === 155 /* PropertyDeclaration */ && !ts.hasModifier(declaration, 32 /* Static */);
if (!isDeclarationInstanceProperty || ts.getContainingClass(usage) !== ts.getContainingClass(declaration)) {
return true;
}
@@ -32208,6 +32454,36 @@
return false;
});
}
+ function isPropertyImmediatelyReferencedWithinDeclaration(declaration, usage) {
+ // always legal if usage is after declaration
+ if (usage.end > declaration.end) {
+ return false;
+ }
+ // still might be legal if usage is deferred (e.g. x: any = () => this.x)
+ // otherwise illegal if immediately referenced within the declaration (e.g. x: any = this.x)
+ var ancestorChangingReferenceScope = ts.findAncestor(usage, function (node) {
+ if (node === declaration) {
+ return "quit";
+ }
+ switch (node.kind) {
+ case 198 /* ArrowFunction */:
+ case 155 /* PropertyDeclaration */:
+ return true;
+ case 219 /* Block */:
+ switch (node.parent.kind) {
+ case 159 /* GetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 160 /* SetAccessor */:
+ return true;
+ default:
+ return false;
+ }
+ default:
+ return false;
+ }
+ });
+ return ancestorChangingReferenceScope === undefined;
+ }
}
/**
* Resolve a given name for a given meaning at a given location. An error is reported if the name was not found and
@@ -32226,6 +32502,8 @@
var lastLocation;
var lastSelfReferenceLocation;
var propertyWithInvalidInitializer;
+ var associatedDeclarationForContainingInitializer;
+ var withinDeferredContext = false;
var errorLocation = location;
var grandparent;
var isInExternalModule = false;
@@ -32241,12 +32519,12 @@
// - parameters are only in the scope of function body
// This restriction does not apply to JSDoc comment types because they are parented
// at a higher level than type parameters would normally be
- if (meaning & result.flags & 67897832 /* Type */ && lastLocation.kind !== 296 /* JSDocComment */) {
+ if (meaning & result.flags & 67897832 /* Type */ && lastLocation.kind !== 297 /* JSDocComment */) {
useResult = result.flags & 262144 /* TypeParameter */
// type parameters are visible in parameter list, return type and type parameter list
? lastLocation === location.type ||
- lastLocation.kind === 151 /* Parameter */ ||
- lastLocation.kind === 150 /* TypeParameter */
+ lastLocation.kind === 152 /* Parameter */ ||
+ lastLocation.kind === 151 /* TypeParameter */
// local types not visible outside the function body
: false;
}
@@ -32263,13 +32541,13 @@
// however it is detected separately when checking initializers of parameters
// to make sure that they reference no variables declared after them.
useResult =
- lastLocation.kind === 151 /* Parameter */ ||
+ lastLocation.kind === 152 /* Parameter */ ||
(lastLocation === location.type &&
!!ts.findAncestor(result.valueDeclaration, ts.isParameter));
}
}
}
- else if (location.kind === 175 /* ConditionalType */) {
+ else if (location.kind === 176 /* ConditionalType */) {
// A type parameter declared using 'infer T' in a conditional type is visible only in
// the true branch of the conditional type.
useResult = lastLocation === location.trueType;
@@ -32282,15 +32560,16 @@
}
}
}
+ withinDeferredContext = withinDeferredContext || getIsDeferredContext(location, lastLocation);
switch (location.kind) {
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
if (!ts.isExternalOrCommonJsModule(location))
break;
isInExternalModule = true;
// falls through
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
var moduleExports = getSymbolOfNode(location).exports;
- if (location.kind === 284 /* SourceFile */ || ts.isAmbientModule(location)) {
+ if (location.kind === 285 /* SourceFile */ || ts.isAmbientModule(location)) {
// It's an external module. First see if the module has an export default and if the local
// name of that export default matches.
if (result = moduleExports.get("default" /* Default */)) {
@@ -32314,7 +32593,7 @@
var moduleExport = moduleExports.get(name);
if (moduleExport &&
moduleExport.flags === 2097152 /* Alias */ &&
- ts.getDeclarationOfKind(moduleExport, 257 /* ExportSpecifier */)) {
+ ts.getDeclarationOfKind(moduleExport, 258 /* ExportSpecifier */)) {
break;
}
}
@@ -32328,20 +32607,19 @@
}
}
break;
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
if (result = lookup(getSymbolOfNode(location).exports, name, meaning & 8 /* EnumMember */)) {
break loop;
}
break;
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
// TypeScript 1.0 spec (April 2014): 8.4.1
// Initializer expressions for instance member variables are evaluated in the scope
// of the class constructor body but are not permitted to reference parameters or
// local variables of the constructor. This effectively means that entities from outer scopes
// by the same name as a constructor parameter or local variable are inaccessible
// in initializer expressions for instance member variables.
- if (ts.isClassLike(location.parent) && !ts.hasModifier(location, 32 /* Static */)) {
+ if (!ts.hasModifier(location, 32 /* Static */)) {
var ctor = findConstructorDeclaration(location.parent);
if (ctor && ctor.locals) {
if (lookup(ctor.locals, name, meaning & 67220415 /* Value */)) {
@@ -32351,9 +32629,9 @@
}
}
break;
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
// The below is used to lookup type parameters within a class or interface, as they are added to the class/interface locals
// These can never be latebound, so the symbol's raw members are sufficient. `getMembersOfNode` cannot be used, as it would
// trigger resolving late-bound names, which we may already be in the process of doing while we're here!
@@ -32372,7 +32650,7 @@
}
break loop;
}
- if (location.kind === 209 /* ClassExpression */ && meaning & 32 /* Class */) {
+ if (location.kind === 210 /* ClassExpression */ && meaning & 32 /* Class */) {
var className = location.name;
if (className && name === className.escapedText) {
result = location.symbol;
@@ -32380,9 +32658,9 @@
}
}
break;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
// The type parameters of a class are not in scope in the base class expression.
- if (lastLocation === location.expression && location.parent.token === 86 /* ExtendsKeyword */) {
+ if (lastLocation === location.expression && location.parent.token === 87 /* ExtendsKeyword */) {
var container = location.parent.parent;
if (ts.isClassLike(container) && (result = lookup(getSymbolOfNode(container).members, name, meaning & 67897832 /* Type */))) {
if (nameNotFoundMessage) {
@@ -32400,9 +32678,9 @@
// [foo<T>()]() { } // <-- Reference to T from class's own computed property
// }
//
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
grandparent = location.parent.parent;
- if (ts.isClassLike(grandparent) || grandparent.kind === 241 /* InterfaceDeclaration */) {
+ if (ts.isClassLike(grandparent) || grandparent.kind === 242 /* InterfaceDeclaration */) {
// A reference to this grandparent's type parameters would be an error
if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 67897832 /* Type */)) {
error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
@@ -32410,24 +32688,24 @@
}
}
break;
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
// when targeting ES6 or higher there is no 'arguments' in an arrow function
// for lower compile targets the resolved symbol is used to emit an error
if (compilerOptions.target >= 2 /* ES2015 */) {
break;
}
// falls through
- case 156 /* MethodDeclaration */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 239 /* FunctionDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 240 /* FunctionDeclaration */:
if (meaning & 3 /* Variable */ && name === "arguments") {
result = argumentsSymbol;
break loop;
}
break;
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
if (meaning & 3 /* Variable */ && name === "arguments") {
result = argumentsSymbol;
break loop;
@@ -32440,7 +32718,7 @@
}
}
break;
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
// Decorators are resolved at the class declaration. Resolving at the parameter
// or member would result in looking up locals in the method.
//
@@ -32449,7 +32727,7 @@
// method(@y x, y) {} // <-- decorator y should be resolved at the class declaration, not the parameter.
// }
//
- if (location.parent && location.parent.kind === 151 /* Parameter */) {
+ if (location.parent && location.parent.kind === 152 /* Parameter */) {
location = location.parent;
}
//
@@ -32464,15 +32742,28 @@
// declare function y(x: T): any;
// @param(1 as T) // <-- T should resolve to the type alias outside of class C
// class C<T> {}
- if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 240 /* ClassDeclaration */)) {
+ if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 241 /* ClassDeclaration */)) {
location = location.parent;
}
break;
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
// js type aliases do not resolve names from their host, so skip past it
location = ts.getJSDocHost(location);
break;
+ case 152 /* Parameter */:
+ if (lastLocation && lastLocation === location.initializer) {
+ associatedDeclarationForContainingInitializer = location;
+ }
+ break;
+ case 187 /* BindingElement */:
+ if (lastLocation && lastLocation === location.initializer) {
+ var root = ts.getRootDeclaration(location);
+ if (root.kind === 152 /* Parameter */) {
+ associatedDeclarationForContainingInitializer = location;
+ }
+ }
+ break;
}
if (isSelfReferenceLocation(location)) {
lastSelfReferenceLocation = location;
@@ -32488,7 +32779,7 @@
}
if (!result) {
if (lastLocation) {
- ts.Debug.assert(lastLocation.kind === 284 /* SourceFile */);
+ ts.Debug.assert(lastLocation.kind === 285 /* SourceFile */);
if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) {
return lastLocation.symbol;
}
@@ -32564,20 +32855,48 @@
if (result && isInExternalModule && (meaning & 67220415 /* Value */) === 67220415 /* Value */ && !(originalLocation.flags & 2097152 /* JSDoc */)) {
var merged = getMergedSymbol(result);
if (ts.length(merged.declarations) && ts.every(merged.declarations, function (d) { return ts.isNamespaceExportDeclaration(d) || ts.isSourceFile(d) && !!d.symbol.globalExports; })) {
- error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, ts.unescapeLeadingUnderscores(name)); // TODO: GH#18217
+ errorOrSuggestion(!compilerOptions.allowUmdGlobalAccess, errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, ts.unescapeLeadingUnderscores(name));
+ }
+ }
+ // If we're in a parameter initializer, we can't reference the values of the parameter whose initializer we're within or parameters to the right
+ if (result && associatedDeclarationForContainingInitializer && !withinDeferredContext && (meaning & 67220415 /* Value */) === 67220415 /* Value */) {
+ var candidate = getMergedSymbol(getLateBoundSymbol(result));
+ var root = ts.getRootDeclaration(associatedDeclarationForContainingInitializer);
+ // A parameter initializer or binding pattern initializer within a parameter cannot refer to itself
+ if (candidate === getSymbolOfNode(associatedDeclarationForContainingInitializer)) {
+ error(errorLocation, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(associatedDeclarationForContainingInitializer.name));
+ }
+ // And it cannot refer to any declarations which come after it
+ else if (candidate.valueDeclaration && candidate.valueDeclaration.pos > associatedDeclarationForContainingInitializer.pos && root.parent.locals && lookup(root.parent.locals, candidate.escapedName, meaning) === candidate) {
+ error(errorLocation, ts.Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(associatedDeclarationForContainingInitializer.name), ts.declarationNameToString(errorLocation));
}
}
}
return result;
}
+ function getIsDeferredContext(location, lastLocation) {
+ if (location.kind !== 198 /* ArrowFunction */ && location.kind !== 197 /* FunctionExpression */) {
+ // initializers in instance property declaration of class like entities are executed in constructor and thus deferred
+ return ts.isTypeQueryNode(location) || ((ts.isFunctionLikeDeclaration(location) ||
+ (location.kind === 155 /* PropertyDeclaration */ && !ts.hasModifier(location, 32 /* Static */))) && (!lastLocation || lastLocation !== location.name)); // A name is evaluated within the enclosing scope - so it shouldn't count as deferred
+ }
+ if (lastLocation && lastLocation === location.name) {
+ return false;
+ }
+ // generator functions and async functions are not inlined in control flow when immediately invoked
+ if (location.asteriskToken || ts.hasModifier(location, 256 /* Async */)) {
+ return true;
+ }
+ return !ts.getImmediatelyInvokedFunctionExpression(location);
+ }
function isSelfReferenceLocation(node) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 244 /* ModuleDeclaration */: // For `namespace N { N; }`
+ case 240 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 245 /* ModuleDeclaration */: // For `namespace N { N; }`
return true;
default:
return false;
@@ -32589,7 +32908,7 @@
function isTypeParameterSymbolDeclaredInContainer(symbol, container) {
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var decl = _a[_i];
- if (decl.kind === 150 /* TypeParameter */) {
+ if (decl.kind === 151 /* TypeParameter */) {
var parent = ts.isJSDocTemplateTag(decl.parent) ? ts.getJSDocHost(decl.parent) : decl.parent;
if (parent === container) {
return !(ts.isJSDocTemplateTag(decl.parent) && ts.find(decl.parent.parent.tags, ts.isJSDocTypeAlias)); // TODO: GH#18217
@@ -32644,10 +32963,10 @@
*/
function getEntityNameForExtendingInterface(node) {
switch (node.kind) {
- case 72 /* Identifier */:
- case 189 /* PropertyAccessExpression */:
+ case 73 /* Identifier */:
+ case 190 /* PropertyAccessExpression */:
return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
if (ts.isEntityNameExpression(node.expression)) {
return node.expression;
}
@@ -32736,7 +33055,7 @@
function checkResolvedBlockScopedVariable(result, errorLocation) {
ts.Debug.assert(!!(result.flags & 2 /* BlockScopedVariable */ || result.flags & 32 /* Class */ || result.flags & 384 /* Enum */));
// Block-scoped variables cannot be used before their definition
- var declaration = ts.find(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 243 /* EnumDeclaration */) || ts.isInJSFile(d) && !!ts.getJSDocEnumTag(d); });
+ var declaration = ts.find(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 244 /* EnumDeclaration */) || ts.isInJSFile(d) && !!ts.getJSDocEnumTag(d); });
if (declaration === undefined)
return ts.Debug.fail("Declaration to checkResolvedBlockScopedVariable is undefined");
if (!(declaration.flags & 4194304 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) {
@@ -32771,13 +33090,13 @@
}
function getAnyImportSyntax(node) {
switch (node.kind) {
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return node;
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
return node.parent;
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
return node.parent.parent;
- case 253 /* ImportSpecifier */:
+ case 254 /* ImportSpecifier */:
return node.parent.parent.parent;
default:
return undefined;
@@ -32787,7 +33106,7 @@
return ts.find(symbol.declarations, ts.isAliasSymbolDeclaration);
}
function getTargetOfImportEqualsDeclaration(node, dontResolveAlias) {
- if (node.moduleReference.kind === 259 /* ExternalModuleReference */) {
+ if (node.moduleReference.kind === 260 /* ExternalModuleReference */) {
return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node)));
}
return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, dontResolveAlias);
@@ -32844,8 +33163,17 @@
var file = ts.find(moduleSymbol.declarations, ts.isSourceFile);
var hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias);
if (!exportDefaultSymbol && !hasSyntheticDefault) {
+ if (hasExportAssignmentSymbol(moduleSymbol)) {
+ var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop";
+ var exportEqualsSymbol = moduleSymbol.exports.get("export=" /* ExportEquals */);
+ var exportAssignment = exportEqualsSymbol.valueDeclaration;
+ var err = error(node.name, ts.Diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag, symbolToString(moduleSymbol), compilerOptionName);
+ ts.addRelatedInfo(err, ts.createDiagnosticForNode(exportAssignment, ts.Diagnostics.This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag, compilerOptionName));
+ }
+ else {
error(node.name, ts.Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol));
}
+ }
else if (hasSyntheticDefault) {
// per emit behavior, a synthetic default overrides a "real" .default member if `__esModule` is not present
return resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
@@ -32979,20 +33307,20 @@
function getTargetOfAliasDeclaration(node, dontRecursivelyResolve) {
if (dontRecursivelyResolve === void 0) { dontRecursivelyResolve = false; }
switch (node.kind) {
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return getTargetOfImportEqualsDeclaration(node, dontRecursivelyResolve);
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
return getTargetOfImportClause(node, dontRecursivelyResolve);
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
return getTargetOfNamespaceImport(node, dontRecursivelyResolve);
- case 253 /* ImportSpecifier */:
+ case 254 /* ImportSpecifier */:
return getTargetOfImportSpecifier(node, dontRecursivelyResolve);
- case 257 /* ExportSpecifier */:
+ case 258 /* ExportSpecifier */:
return getTargetOfExportSpecifier(node, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */, dontRecursivelyResolve);
- case 254 /* ExportAssignment */:
- case 204 /* BinaryExpression */:
+ case 255 /* ExportAssignment */:
+ case 205 /* BinaryExpression */:
return getTargetOfExportAssignment(node, dontRecursivelyResolve);
- case 247 /* NamespaceExportDeclaration */:
+ case 248 /* NamespaceExportDeclaration */:
return getTargetOfNamespaceExportDeclaration(node, dontRecursivelyResolve);
default:
return ts.Debug.fail();
@@ -33053,11 +33381,11 @@
var node = getDeclarationOfAliasSymbol(symbol);
if (!node)
return ts.Debug.fail();
- if (node.kind === 254 /* ExportAssignment */) {
+ if (node.kind === 255 /* ExportAssignment */) {
// export default <symbol>
checkExpressionCached(node.expression);
}
- else if (node.kind === 257 /* ExportSpecifier */) {
+ else if (node.kind === 258 /* ExportSpecifier */) {
// export { <symbol> } or export { <symbol> as foo }
checkExpressionCached(node.propertyName || node.name);
}
@@ -33075,17 +33403,17 @@
// import a = |b|; // Namespace
// import a = |b.c|; // Value, type, namespace
// import a = |b.c|.d; // Namespace
- if (entityName.kind === 72 /* Identifier */ && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {
+ if (entityName.kind === 73 /* Identifier */ && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {
entityName = entityName.parent;
}
// Check for case 1 and 3 in the above example
- if (entityName.kind === 72 /* Identifier */ || entityName.parent.kind === 148 /* QualifiedName */) {
+ if (entityName.kind === 73 /* Identifier */ || entityName.parent.kind === 149 /* QualifiedName */) {
return resolveEntityName(entityName, 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias);
}
else {
// Case 2 in above example
// entityName.kind could be a QualifiedName or a Missing identifier
- ts.Debug.assert(entityName.parent.kind === 248 /* ImportEqualsDeclaration */);
+ ts.Debug.assert(entityName.parent.kind === 249 /* ImportEqualsDeclaration */);
return resolveEntityName(entityName, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias);
}
}
@@ -33101,17 +33429,17 @@
}
var namespaceMeaning = 1920 /* Namespace */ | (ts.isInJSFile(name) ? meaning & 67220415 /* Value */ : 0);
var symbol;
- if (name.kind === 72 /* Identifier */) {
- var message = meaning === namespaceMeaning ? ts.Diagnostics.Cannot_find_namespace_0 : getCannotFindNameDiagnosticForName(getFirstIdentifier(name).escapedText);
+ if (name.kind === 73 /* Identifier */) {
+ var message = meaning === namespaceMeaning ? ts.Diagnostics.Cannot_find_namespace_0 : getCannotFindNameDiagnosticForName(getFirstIdentifier(name));
var symbolFromJSPrototype = ts.isInJSFile(name) ? resolveEntityNameFromAssignmentDeclaration(name, meaning) : undefined;
symbol = resolveName(location || name, name.escapedText, meaning, ignoreErrors || symbolFromJSPrototype ? undefined : message, name, /*isUse*/ true);
if (!symbol) {
return symbolFromJSPrototype;
}
}
- else if (name.kind === 148 /* QualifiedName */ || name.kind === 189 /* PropertyAccessExpression */) {
- var left = name.kind === 148 /* QualifiedName */ ? name.left : name.expression;
- var right = name.kind === 148 /* QualifiedName */ ? name.right : name.name;
+ else if (name.kind === 149 /* QualifiedName */ || name.kind === 190 /* PropertyAccessExpression */) {
+ var left = name.kind === 149 /* QualifiedName */ ? name.left : name.expression;
+ var right = name.kind === 149 /* QualifiedName */ ? name.right : name.name;
var namespace = resolveEntityName(left, namespaceMeaning, ignoreErrors, /*dontResolveAlias*/ false, location);
if (!namespace || ts.nodeIsMissing(right)) {
return undefined;
@@ -33246,6 +33574,14 @@
if (patternAmbientModules) {
var pattern = ts.findBestPatternMatch(patternAmbientModules, function (_) { return _.pattern; }, moduleReference);
if (pattern) {
+ // If the module reference matched a pattern ambient module ('*.foo') but there’s also a
+ // module augmentation by the specific name requested ('a.foo'), we store the merged symbol
+ // by the augmentation name ('a.foo'), because asking for *.foo should not give you exports
+ // from a.foo.
+ var augmentation = patternAmbientModuleAugmentations && patternAmbientModuleAugmentations.get(moduleReference);
+ if (augmentation) {
+ return getMergedSymbol(augmentation);
+ }
return getMergedSymbol(pattern.symbol);
}
}
@@ -33336,7 +33672,7 @@
function resolveESModuleSymbol(moduleSymbol, referencingLocation, dontResolveAlias) {
var symbol = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias);
if (!dontResolveAlias && symbol) {
- if (!(symbol.flags & (1536 /* Module */ | 3 /* Variable */)) && !ts.getDeclarationOfKind(symbol, 284 /* SourceFile */)) {
+ if (!(symbol.flags & (1536 /* Module */ | 3 /* Variable */)) && !ts.getDeclarationOfKind(symbol, 285 /* SourceFile */)) {
var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015
? "allowSyntheticDefaultImports"
: "esModuleInterop";
@@ -33598,7 +33934,7 @@
var members = node.members;
for (var _i = 0, members_2 = members; _i < members_2.length; _i++) {
var member = members_2[_i];
- if (member.kind === 157 /* Constructor */ && ts.nodeIsPresent(member.body)) {
+ if (member.kind === 158 /* Constructor */ && ts.nodeIsPresent(member.body)) {
return member;
}
}
@@ -33644,7 +33980,7 @@
return type;
}
// A reserved member name starts with two underscores, but the third character cannot be an underscore
- // or the @ symbol. A third underscore indicates an escaped form of an identifer that started
+ // or the @ symbol. A third underscore indicates an escaped form of an identifier that started
// with at least two underscores. The @ character indicates that the name is denoted by a well known ES
// Symbol instance.
function isReservedMemberName(name) {
@@ -33684,12 +34020,12 @@
}
}
switch (location.kind) {
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
if (!ts.isExternalOrCommonJsModule(location)) {
break;
}
// falls through
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
if (result = callback(getSymbolOfNode(location).exports)) {
return result;
}
@@ -33753,7 +34089,7 @@
&& (!useOnlyExternalAliasing || ts.some(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration))
// While exports are generally considered to be in scope, export-specifier declared symbols are _not_
// See similar comment in `resolveName` for details
- && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 257 /* ExportSpecifier */))) {
+ && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 258 /* ExportSpecifier */))) {
var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable);
if (isAccessible(symbolFromSymbolTable, resolvedImportedSymbol, ignoreQualification)) {
return [symbolFromSymbolTable];
@@ -33789,7 +34125,7 @@
return true;
}
// Qualify if the symbol from symbol table has same meaning as expected
- symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 257 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable;
+ symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 258 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable;
if (symbolFromSymbolTable.flags & meaning) {
qualify = true;
return true;
@@ -33804,10 +34140,10 @@
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
switch (declaration.kind) {
- case 154 /* PropertyDeclaration */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 155 /* PropertyDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
continue;
default:
return false;
@@ -33863,7 +34199,7 @@
var containers = getContainersOfSymbol(symbol, enclosingDeclaration);
// If we're trying to reference some object literal in, eg `var a = { x: 1 }`, the symbol for the literal, `__object`, is distinct
// from the symbol of the declaration it is being assigned to. Since we can use the declaration to refer to the literal, however,
- // we'd like to make that connection here - potentially causing us to paint the declararation's visibiility, and therefore the literal.
+ // we'd like to make that connection here - potentially causing us to paint the declaration's visibility, and therefore the literal.
var firstDecl = ts.first(symbol.declarations);
if (!ts.length(containers) && meaning & 67220415 /* Value */ && firstDecl && ts.isObjectLiteralExpression(firstDecl)) {
if (firstDecl.parent && ts.isVariableDeclaration(firstDecl.parent) && firstDecl === firstDecl.parent.initializer) {
@@ -33924,10 +34260,10 @@
return node && getSymbolOfNode(node);
}
function hasExternalModuleSymbol(declaration) {
- return ts.isAmbientModule(declaration) || (declaration.kind === 284 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration));
+ return ts.isAmbientModule(declaration) || (declaration.kind === 285 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration));
}
function hasNonGlobalAugmentationExternalModuleSymbol(declaration) {
- return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 284 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration));
+ return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 285 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration));
}
function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) {
var aliasesToMakeVisible;
@@ -33974,14 +34310,14 @@
function isEntityNameVisible(entityName, enclosingDeclaration) {
// get symbol of the first identifier of the entityName
var meaning;
- if (entityName.parent.kind === 167 /* TypeQuery */ ||
+ if (entityName.parent.kind === 168 /* TypeQuery */ ||
ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent) ||
- entityName.parent.kind === 149 /* ComputedPropertyName */) {
+ entityName.parent.kind === 150 /* ComputedPropertyName */) {
// Typeof value
meaning = 67220415 /* Value */ | 1048576 /* ExportValue */;
}
- else if (entityName.kind === 148 /* QualifiedName */ || entityName.kind === 189 /* PropertyAccessExpression */ ||
- entityName.parent.kind === 248 /* ImportEqualsDeclaration */) {
+ else if (entityName.kind === 149 /* QualifiedName */ || entityName.kind === 190 /* PropertyAccessExpression */ ||
+ entityName.parent.kind === 249 /* ImportEqualsDeclaration */) {
// Left identifier from type reference or TypeAlias
// Entity name of the import declaration
meaning = 1920 /* Namespace */;
@@ -34030,10 +34366,10 @@
function signatureToStringWorker(writer) {
var sigOutput;
if (flags & 262144 /* WriteArrowStyleSignature */) {
- sigOutput = kind === 1 /* Construct */ ? 166 /* ConstructorType */ : 165 /* FunctionType */;
+ sigOutput = kind === 1 /* Construct */ ? 167 /* ConstructorType */ : 166 /* FunctionType */;
}
else {
- sigOutput = kind === 1 /* Construct */ ? 161 /* ConstructSignature */ : 160 /* CallSignature */;
+ sigOutput = kind === 1 /* Construct */ ? 162 /* ConstructSignature */ : 161 /* CallSignature */;
}
var sig = nodeBuilder.signatureToSignatureDeclaration(signature, sigOutput, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | 512 /* WriteTypeParametersInQualifiedName */);
var printer = ts.createPrinter({ removeComments: true, omitTrailingSemicolon: true });
@@ -34060,6 +34396,15 @@
}
return result;
}
+ function getTypeNamesForErrorDisplay(left, right) {
+ var leftStr = typeToString(left);
+ var rightStr = typeToString(right);
+ if (leftStr === rightStr) {
+ leftStr = typeToString(left, /*enclosingDeclaration*/ undefined, 64 /* UseFullyQualifiedType */);
+ rightStr = typeToString(right, /*enclosingDeclaration*/ undefined, 64 /* UseFullyQualifiedType */);
+ }
+ return [leftStr, rightStr];
+ }
function toNodeBuilderFlags(flags) {
if (flags === void 0) { flags = 0 /* None */; }
return flags & 9469291 /* NodeBuilderFlagsMask */;
@@ -34128,26 +34473,26 @@
}
if (type.flags & 1 /* Any */) {
context.approximateLength += 3;
- return ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ return ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
if (type.flags & 2 /* Unknown */) {
- return ts.createKeywordTypeNode(143 /* UnknownKeyword */);
+ return ts.createKeywordTypeNode(144 /* UnknownKeyword */);
}
if (type.flags & 4 /* String */) {
context.approximateLength += 6;
- return ts.createKeywordTypeNode(138 /* StringKeyword */);
+ return ts.createKeywordTypeNode(139 /* StringKeyword */);
}
if (type.flags & 8 /* Number */) {
context.approximateLength += 6;
- return ts.createKeywordTypeNode(135 /* NumberKeyword */);
+ return ts.createKeywordTypeNode(136 /* NumberKeyword */);
}
if (type.flags & 64 /* BigInt */) {
context.approximateLength += 6;
- return ts.createKeywordTypeNode(146 /* BigIntKeyword */);
+ return ts.createKeywordTypeNode(147 /* BigIntKeyword */);
}
if (type.flags & 16 /* Boolean */) {
context.approximateLength += 7;
- return ts.createKeywordTypeNode(123 /* BooleanKeyword */);
+ return ts.createKeywordTypeNode(124 /* BooleanKeyword */);
}
if (type.flags & 1024 /* EnumLiteral */ && !(type.flags & 1048576 /* Union */)) {
var parentSymbol = getParentOfSymbol(type.symbol);
@@ -34165,8 +34510,9 @@
return ts.createLiteralTypeNode(ts.setEmitFlags(ts.createLiteral(type.value), 16777216 /* NoAsciiEscaping */));
}
if (type.flags & 256 /* NumberLiteral */) {
- context.approximateLength += (("" + type.value).length);
- return ts.createLiteralTypeNode((ts.createLiteral(type.value)));
+ var value = type.value;
+ context.approximateLength += ("" + value).length;
+ return ts.createLiteralTypeNode(value < 0 ? ts.createPrefix(39 /* MinusToken */, ts.createLiteral(-value)) : ts.createLiteral(value));
}
if (type.flags & 2048 /* BigIntLiteral */) {
context.approximateLength += (ts.pseudoBigIntToString(type.value).length) + 1;
@@ -34187,33 +34533,33 @@
}
}
context.approximateLength += 13;
- return ts.createTypeOperatorNode(142 /* UniqueKeyword */, ts.createKeywordTypeNode(139 /* SymbolKeyword */));
+ return ts.createTypeOperatorNode(143 /* UniqueKeyword */, ts.createKeywordTypeNode(140 /* SymbolKeyword */));
}
if (type.flags & 16384 /* Void */) {
context.approximateLength += 4;
- return ts.createKeywordTypeNode(106 /* VoidKeyword */);
+ return ts.createKeywordTypeNode(107 /* VoidKeyword */);
}
if (type.flags & 32768 /* Undefined */) {
context.approximateLength += 9;
- return ts.createKeywordTypeNode(141 /* UndefinedKeyword */);
+ return ts.createKeywordTypeNode(142 /* UndefinedKeyword */);
}
if (type.flags & 65536 /* Null */) {
context.approximateLength += 4;
- return ts.createKeywordTypeNode(96 /* NullKeyword */);
+ return ts.createKeywordTypeNode(97 /* NullKeyword */);
}
if (type.flags & 131072 /* Never */) {
context.approximateLength += 5;
- return ts.createKeywordTypeNode(132 /* NeverKeyword */);
+ return ts.createKeywordTypeNode(133 /* NeverKeyword */);
}
if (type.flags & 4096 /* ESSymbol */) {
context.approximateLength += 6;
- return ts.createKeywordTypeNode(139 /* SymbolKeyword */);
+ return ts.createKeywordTypeNode(140 /* SymbolKeyword */);
}
if (type.flags & 67108864 /* NonPrimitive */) {
context.approximateLength += 6;
- return ts.createKeywordTypeNode(136 /* ObjectKeyword */);
+ return ts.createKeywordTypeNode(137 /* ObjectKeyword */);
}
- if (type.flags & 262144 /* TypeParameter */ && type.isThisType) {
+ if (isThisTypeParameter(type)) {
if (context.flags & 4194304 /* InObjectTypeLiteral */) {
if (!context.encounteredError && !(context.flags & 32768 /* AllowThisInObjectLiteral */)) {
context.encounteredError = true;
@@ -34263,7 +34609,7 @@
}
var typeNodes = mapToTypeNodes(types, context, /*isBareList*/ true);
if (typeNodes && typeNodes.length > 0) {
- var unionOrIntersectionTypeNode = ts.createUnionOrIntersectionTypeNode(type.flags & 1048576 /* Union */ ? 173 /* UnionType */ : 174 /* IntersectionType */, typeNodes);
+ var unionOrIntersectionTypeNode = ts.createUnionOrIntersectionTypeNode(type.flags & 1048576 /* Union */ ? 174 /* UnionType */ : 175 /* IntersectionType */, typeNodes);
return unionOrIntersectionTypeNode;
}
else {
@@ -34296,8 +34642,8 @@
context.inferTypeParameters = type.root.inferTypeParameters;
var extendsTypeNode = typeToTypeNodeHelper(type.extendsType, context);
context.inferTypeParameters = saveInferTypeParameters;
- var trueTypeNode = typeToTypeNodeHelper(type.trueType, context);
- var falseTypeNode = typeToTypeNodeHelper(type.falseType, context);
+ var trueTypeNode = typeToTypeNodeHelper(getTrueTypeFromConditionalType(type), context);
+ var falseTypeNode = typeToTypeNodeHelper(getFalseTypeFromConditionalType(type), context);
context.approximateLength += 15;
return ts.createConditionalTypeNode(checkTypeNode, extendsTypeNode, trueTypeNode, falseTypeNode);
}
@@ -34337,7 +34683,7 @@
return symbolToTypeNode(symbol, context, isInstanceType);
}
// Always use 'typeof T' for type of class, enum, and module objects
- else if (symbol.flags & 32 /* Class */ && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration.kind === 209 /* ClassExpression */ && context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */) ||
+ else if (symbol.flags & 32 /* Class */ && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration.kind === 210 /* ClassExpression */ && context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */) ||
symbol.flags & (384 /* Enum */ | 512 /* ValueModule */) ||
shouldWriteTypeOfFunctionSymbol()) {
return symbolToTypeNode(symbol, context, 67220415 /* Value */);
@@ -34384,7 +34730,7 @@
var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) &&
(symbol.parent || // is exported function symbol
ts.forEach(symbol.declarations, function (declaration) {
- return declaration.parent.kind === 284 /* SourceFile */ || declaration.parent.kind === 245 /* ModuleBlock */;
+ return declaration.parent.kind === 285 /* SourceFile */ || declaration.parent.kind === 246 /* ModuleBlock */;
}));
if (isStaticMethodSymbol || isNonLocalFunctionSymbol) {
// typeof is allowed only for static/non local functions
@@ -34405,12 +34751,12 @@
}
if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) {
var signature = resolved.callSignatures[0];
- var signatureNode = signatureToSignatureDeclarationHelper(signature, 165 /* FunctionType */, context);
+ var signatureNode = signatureToSignatureDeclarationHelper(signature, 166 /* FunctionType */, context);
return signatureNode;
}
if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) {
var signature = resolved.constructSignatures[0];
- var signatureNode = signatureToSignatureDeclarationHelper(signature, 166 /* ConstructorType */, context);
+ var signatureNode = signatureToSignatureDeclarationHelper(signature, 167 /* ConstructorType */, context);
return signatureNode;
}
}
@@ -34431,7 +34777,7 @@
}
var elementType = typeToTypeNodeHelper(typeArguments[0], context);
var arrayType = ts.createArrayTypeNode(elementType);
- return type.target === globalArrayType ? arrayType : ts.createTypeOperatorNode(133 /* ReadonlyKeyword */, arrayType);
+ return type.target === globalArrayType ? arrayType : ts.createTypeOperatorNode(134 /* ReadonlyKeyword */, arrayType);
}
else if (type.target.objectFlags & 8 /* Tuple */) {
if (typeArguments.length > 0) {
@@ -34445,12 +34791,12 @@
ts.createOptionalTypeNode(tupleConstituentNodes[i]);
}
var tupleTypeNode = ts.createTupleTypeNode(tupleConstituentNodes);
- return type.target.readonly ? ts.createTypeOperatorNode(133 /* ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode;
+ return type.target.readonly ? ts.createTypeOperatorNode(134 /* ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode;
}
}
if (context.encounteredError || (context.flags & 524288 /* AllowEmptyTuple */)) {
var tupleTypeNode = ts.createTupleTypeNode([]);
- return type.target.readonly ? ts.createTypeOperatorNode(133 /* ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode;
+ return type.target.readonly ? ts.createTypeOperatorNode(134 /* ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode;
}
context.encounteredError = true;
return undefined; // TODO: GH#18217
@@ -34545,11 +34891,11 @@
var typeElements = [];
for (var _i = 0, _a = resolvedType.callSignatures; _i < _a.length; _i++) {
var signature = _a[_i];
- typeElements.push(signatureToSignatureDeclarationHelper(signature, 160 /* CallSignature */, context));
+ typeElements.push(signatureToSignatureDeclarationHelper(signature, 161 /* CallSignature */, context));
}
for (var _b = 0, _c = resolvedType.constructSignatures; _b < _c.length; _b++) {
var signature = _c[_b];
- typeElements.push(signatureToSignatureDeclarationHelper(signature, 161 /* ConstructSignature */, context));
+ typeElements.push(signatureToSignatureDeclarationHelper(signature, 162 /* ConstructSignature */, context));
}
if (resolvedType.stringIndexInfo) {
var indexSignature = void 0;
@@ -34596,15 +34942,15 @@
if (!(context.flags & 1 /* NoTruncation */)) {
return ts.createTypeReferenceNode(ts.createIdentifier("..."), /*typeArguments*/ undefined);
}
- return ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ return ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
function addPropertyToElementList(propertySymbol, context, typeElements) {
- var propertyIsReverseMapped = !!(ts.getCheckFlags(propertySymbol) & 4096 /* ReverseMapped */);
+ var propertyIsReverseMapped = !!(ts.getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */);
var propertyType = propertyIsReverseMapped && context.flags & 33554432 /* InReverseMappedType */ ?
anyType : getTypeOfSymbol(propertySymbol);
var saveEnclosingDeclaration = context.enclosingDeclaration;
context.enclosingDeclaration = undefined;
- if (context.tracker.trackSymbol && ts.getCheckFlags(propertySymbol) & 2048 /* Late */) {
+ if (context.tracker.trackSymbol && ts.getCheckFlags(propertySymbol) & 4096 /* Late */) {
var decl = ts.first(propertySymbol.declarations);
if (hasLateBindableName(decl)) {
trackComputedName(decl.name, saveEnclosingDeclaration, context);
@@ -34618,7 +34964,7 @@
var signatures = getSignaturesOfType(propertyType, 0 /* Call */);
for (var _i = 0, signatures_1 = signatures; _i < signatures_1.length; _i++) {
var signature = signatures_1[_i];
- var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 155 /* MethodSignature */, context);
+ var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 156 /* MethodSignature */, context);
methodDeclaration.name = propertyName;
methodDeclaration.questionToken = optionalToken;
if (propertySymbol.valueDeclaration) {
@@ -34636,10 +34982,10 @@
propertyTypeNode = createElidedInformationPlaceholder(context);
}
else {
- propertyTypeNode = propertyType ? typeToTypeNodeHelper(propertyType, context) : ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ propertyTypeNode = propertyType ? typeToTypeNodeHelper(propertyType, context) : ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
context.flags = savedFlags;
- var modifiers = isReadonlySymbol(propertySymbol) ? [ts.createToken(133 /* ReadonlyKeyword */)] : undefined;
+ var modifiers = isReadonlySymbol(propertySymbol) ? [ts.createToken(134 /* ReadonlyKeyword */)] : undefined;
if (modifiers) {
context.approximateLength += 9;
}
@@ -34690,7 +35036,7 @@
}
function indexInfoToIndexSignatureDeclarationHelper(indexInfo, kind, context) {
var name = ts.getNameFromIndexInfo(indexInfo) || "x";
- var indexerTypeNode = ts.createKeywordTypeNode(kind === 0 /* String */ ? 138 /* StringKeyword */ : 135 /* NumberKeyword */);
+ var indexerTypeNode = ts.createKeywordTypeNode(kind === 0 /* String */ ? 139 /* StringKeyword */ : 136 /* NumberKeyword */);
var indexingParameter = ts.createParameter(
/*decorators*/ undefined,
/*modifiers*/ undefined,
@@ -34703,7 +35049,7 @@
}
context.approximateLength += (name.length + 4);
return ts.createIndexSignature(
- /*decorators*/ undefined, indexInfo.isReadonly ? [ts.createToken(133 /* ReadonlyKeyword */)] : undefined, [indexingParameter], typeNode);
+ /*decorators*/ undefined, indexInfo.isReadonly ? [ts.createToken(134 /* ReadonlyKeyword */)] : undefined, [indexingParameter], typeNode);
}
function signatureToSignatureDeclarationHelper(signature, kind, context) {
var typeParameters;
@@ -34714,7 +35060,7 @@
else {
typeParameters = signature.typeParameters && signature.typeParameters.map(function (parameter) { return typeParameterToDeclaration(parameter, context); });
}
- var parameters = getExpandedParameters(signature).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 157 /* Constructor */); });
+ var parameters = getExpandedParameters(signature).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 158 /* Constructor */); });
if (signature.thisParameter) {
var thisParameter = symbolToParameterDeclaration(signature.thisParameter, context);
parameters.unshift(thisParameter);
@@ -34733,12 +35079,12 @@
returnTypeNode = returnType && typeToTypeNodeHelper(returnType, context);
}
if (context.flags & 256 /* SuppressAnyReturnType */) {
- if (returnTypeNode && returnTypeNode.kind === 120 /* AnyKeyword */) {
+ if (returnTypeNode && returnTypeNode.kind === 121 /* AnyKeyword */) {
returnTypeNode = undefined;
}
}
else if (!returnTypeNode) {
- returnTypeNode = ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ returnTypeNode = ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
context.approximateLength += 3; // Usually a signature contributes a few more characters than this, but 3 is the minimum
return ts.createSignatureDeclaration(kind, typeParameters, parameters, returnTypeNode, typeArguments);
@@ -34767,9 +35113,9 @@
return typeParameterToDeclarationWithConstraint(type, context, constraintNode);
}
function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags) {
- var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 151 /* Parameter */);
+ var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 152 /* Parameter */);
if (!parameterDeclaration && !isTransientSymbol(parameterSymbol)) {
- parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 304 /* JSDocParameterTag */);
+ parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 305 /* JSDocParameterTag */);
}
var parameterType = getTypeOfSymbol(parameterSymbol);
if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) {
@@ -34777,16 +35123,16 @@
}
var parameterTypeNode = typeToTypeNodeHelper(parameterType, context);
var modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && preserveModifierFlags && parameterDeclaration && parameterDeclaration.modifiers ? parameterDeclaration.modifiers.map(ts.getSynthesizedClone) : undefined;
- var isRest = parameterDeclaration && ts.isRestParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 16384 /* RestParameter */;
+ var isRest = parameterDeclaration && ts.isRestParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 32768 /* RestParameter */;
var dotDotDotToken = isRest ? ts.createToken(25 /* DotDotDotToken */) : undefined;
var name = parameterDeclaration
? parameterDeclaration.name ?
- parameterDeclaration.name.kind === 72 /* Identifier */ ? ts.setEmitFlags(ts.getSynthesizedClone(parameterDeclaration.name), 16777216 /* NoAsciiEscaping */) :
- parameterDeclaration.name.kind === 148 /* QualifiedName */ ? ts.setEmitFlags(ts.getSynthesizedClone(parameterDeclaration.name.right), 16777216 /* NoAsciiEscaping */) :
+ parameterDeclaration.name.kind === 73 /* Identifier */ ? ts.setEmitFlags(ts.getSynthesizedClone(parameterDeclaration.name), 16777216 /* NoAsciiEscaping */) :
+ parameterDeclaration.name.kind === 149 /* QualifiedName */ ? ts.setEmitFlags(ts.getSynthesizedClone(parameterDeclaration.name.right), 16777216 /* NoAsciiEscaping */) :
cloneBindingName(parameterDeclaration.name) :
ts.symbolName(parameterSymbol)
: ts.symbolName(parameterSymbol);
- var isOptional = parameterDeclaration && isOptionalParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 8192 /* OptionalParameter */;
+ var isOptional = parameterDeclaration && isOptionalParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 16384 /* OptionalParameter */;
var questionToken = isOptional ? ts.createToken(56 /* QuestionToken */) : undefined;
var parameterNode = ts.createParameter(
/*decorators*/ undefined, modifiers, dotDotDotToken, name, questionToken, parameterTypeNode,
@@ -34801,7 +35147,7 @@
}
var visited = ts.visitEachChild(node, elideInitializerAndSetEmitFlags, ts.nullTransformationContext, /*nodesVisitor*/ undefined, elideInitializerAndSetEmitFlags);
var clone = ts.nodeIsSynthesized(visited) ? visited : ts.getSynthesizedClone(visited);
- if (clone.kind === 186 /* BindingElement */) {
+ if (clone.kind === 187 /* BindingElement */) {
clone.initializer = undefined;
}
return ts.setEmitFlags(clone, 1 /* SingleLine */ | 16777216 /* NoAsciiEscaping */);
@@ -34903,6 +35249,11 @@
function lookupTypeParameterNodes(chain, index, context) {
ts.Debug.assert(chain && 0 <= index && index < chain.length);
var symbol = chain[index];
+ var symbolId = "" + getSymbolId(symbol);
+ if (context.typeParameterSymbolList && context.typeParameterSymbolList.get(symbolId)) {
+ return undefined;
+ }
+ (context.typeParameterSymbolList || (context.typeParameterSymbolList = ts.createMap())).set(symbolId, true);
var typeParameterNodes;
if (context.flags & 512 /* WriteTypeParametersInQualifiedName */ && index < (chain.length - 1)) {
var parentSymbol = symbol;
@@ -34927,7 +35278,7 @@
return top;
}
function getSpecifierForModuleSymbol(symbol, context) {
- var file = ts.getDeclarationOfKind(symbol, 284 /* SourceFile */);
+ var file = ts.getDeclarationOfKind(symbol, 285 /* SourceFile */);
if (file && file.moduleName !== undefined) {
// Use the amd name if it is available
return file.moduleName;
@@ -35167,8 +35518,8 @@
}
function getTypeAliasForTypeLiteral(type) {
if (type.symbol && type.symbol.flags & 2048 /* TypeLiteral */) {
- var node = ts.findAncestor(type.symbol.declarations[0].parent, function (n) { return n.kind !== 177 /* ParenthesizedType */; });
- if (node.kind === 242 /* TypeAliasDeclaration */) {
+ var node = ts.findAncestor(type.symbol.declarations[0].parent, function (n) { return n.kind !== 178 /* ParenthesizedType */; });
+ if (node.kind === 243 /* TypeAliasDeclaration */) {
return getSymbolOfNode(node);
}
}
@@ -35176,11 +35527,11 @@
}
function isTopLevelInExternalModuleAugmentation(node) {
return node && node.parent &&
- node.parent.kind === 245 /* ModuleBlock */ &&
+ node.parent.kind === 246 /* ModuleBlock */ &&
ts.isExternalModuleAugmentation(node.parent.parent);
}
function isDefaultBindingContext(location) {
- return location.kind === 284 /* SourceFile */ || ts.isAmbientModule(location);
+ return location.kind === 285 /* SourceFile */ || ts.isAmbientModule(location);
}
function getNameOfSymbolFromNameType(symbol, context) {
var nameType = symbol.nameType;
@@ -35221,7 +35572,7 @@
if (ts.isCallExpression(declaration) && ts.isBindableObjectDefinePropertyCall(declaration)) {
return ts.symbolName(symbol);
}
- if (ts.isComputedPropertyName(name_2) && !(ts.getCheckFlags(symbol) & 2048 /* Late */) && symbol.nameType && symbol.nameType.flags & 384 /* StringOrNumberLiteral */) {
+ if (ts.isComputedPropertyName(name_2) && !(ts.getCheckFlags(symbol) & 4096 /* Late */) && symbol.nameType && symbol.nameType.flags & 384 /* StringOrNumberLiteral */) {
// Computed property name isn't late bound, but has a well-known name type - use name type to generate a symbol name
var result = getNameOfSymbolFromNameType(symbol, context);
if (result !== undefined) {
@@ -35230,17 +35581,17 @@
}
return ts.declarationNameToString(name_2);
}
- if (declaration.parent && declaration.parent.kind === 237 /* VariableDeclaration */) {
+ if (declaration.parent && declaration.parent.kind === 238 /* VariableDeclaration */) {
return ts.declarationNameToString(declaration.parent.name);
}
switch (declaration.kind) {
- case 209 /* ClassExpression */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 210 /* ClassExpression */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
if (context && !context.encounteredError && !(context.flags & 131072 /* AllowAnonymousIdentifier */)) {
context.encounteredError = true;
}
- return declaration.kind === 209 /* ClassExpression */ ? "(Anonymous class)" : "(Anonymous function)";
+ return declaration.kind === 210 /* ClassExpression */ ? "(Anonymous class)" : "(Anonymous function)";
}
}
var name = getNameOfSymbolFromNameType(symbol, context);
@@ -35257,27 +35608,27 @@
return false;
function determineIfDeclarationIsVisible() {
switch (node.kind) {
- case 302 /* JSDocCallbackTag */:
- case 309 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
// Top-level jsdoc type aliases are considered exported
// First parent is comment node, second is hosting declaration or token; we only care about those tokens or declarations whose parent is a source file
return !!(node.parent && node.parent.parent && node.parent.parent.parent && ts.isSourceFile(node.parent.parent.parent));
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return isDeclarationVisible(node.parent.parent);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
if (ts.isBindingPattern(node.name) &&
!node.name.elements.length) {
// If the binding pattern is empty, this variable declaration is not visible
return false;
}
// falls through
- case 244 /* ModuleDeclaration */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 239 /* FunctionDeclaration */:
- case 243 /* EnumDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
// external module augmentation is always visible
if (ts.isExternalModuleAugmentation(node)) {
return true;
@@ -35285,53 +35636,53 @@
var parent = getDeclarationContainer(node);
// If the node is not exported or it is not ambient module element (except import declaration)
if (!(ts.getCombinedModifierFlags(node) & 1 /* Export */) &&
- !(node.kind !== 248 /* ImportEqualsDeclaration */ && parent.kind !== 284 /* SourceFile */ && parent.flags & 4194304 /* Ambient */)) {
+ !(node.kind !== 249 /* ImportEqualsDeclaration */ && parent.kind !== 285 /* SourceFile */ && parent.flags & 4194304 /* Ambient */)) {
return isGlobalSourceFile(parent);
}
// Exported members/ambient module elements (exception import declaration) are visible if parent is visible
return isDeclarationVisible(parent);
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
if (ts.hasModifier(node, 8 /* Private */ | 16 /* Protected */)) {
// Private/protected properties/methods are not visible
return false;
}
// Public properties/methods are visible if its parents are visible, so:
// falls through
- case 157 /* Constructor */:
- case 161 /* ConstructSignature */:
- case 160 /* CallSignature */:
- case 162 /* IndexSignature */:
- case 151 /* Parameter */:
- case 245 /* ModuleBlock */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 168 /* TypeLiteral */:
- case 164 /* TypeReference */:
- case 169 /* ArrayType */:
- case 170 /* TupleType */:
- case 173 /* UnionType */:
- case 174 /* IntersectionType */:
- case 177 /* ParenthesizedType */:
+ case 158 /* Constructor */:
+ case 162 /* ConstructSignature */:
+ case 161 /* CallSignature */:
+ case 163 /* IndexSignature */:
+ case 152 /* Parameter */:
+ case 246 /* ModuleBlock */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 169 /* TypeLiteral */:
+ case 165 /* TypeReference */:
+ case 170 /* ArrayType */:
+ case 171 /* TupleType */:
+ case 174 /* UnionType */:
+ case 175 /* IntersectionType */:
+ case 178 /* ParenthesizedType */:
return isDeclarationVisible(node.parent);
// Default binding, import specifier and namespace import is visible
// only on demand so by default it is not visible
- case 250 /* ImportClause */:
- case 251 /* NamespaceImport */:
- case 253 /* ImportSpecifier */:
+ case 251 /* ImportClause */:
+ case 252 /* NamespaceImport */:
+ case 254 /* ImportSpecifier */:
return false;
// Type parameters are always visible
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
// Source file and namespace export are always visible
- case 284 /* SourceFile */:
- case 247 /* NamespaceExportDeclaration */:
+ case 285 /* SourceFile */:
+ case 248 /* NamespaceExportDeclaration */:
return true;
// Export assignments do not create name bindings outside the module
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return false;
default:
return false;
@@ -35340,10 +35691,10 @@
}
function collectLinkedAliases(node, setVisibility) {
var exportSymbol;
- if (node.parent && node.parent.kind === 254 /* ExportAssignment */) {
+ if (node.parent && node.parent.kind === 255 /* ExportAssignment */) {
exportSymbol = resolveName(node, node.escapedText, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */, /*nameNotFoundMessage*/ undefined, node, /*isUse*/ false);
}
- else if (node.parent.kind === 257 /* ExportSpecifier */) {
+ else if (node.parent.kind === 258 /* ExportSpecifier */) {
exportSymbol = getTargetOfExportSpecifier(node.parent, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */);
}
var result;
@@ -35439,12 +35790,12 @@
function getDeclarationContainer(node) {
return ts.findAncestor(ts.getRootDeclaration(node), function (node) {
switch (node.kind) {
- case 237 /* VariableDeclaration */:
- case 238 /* VariableDeclarationList */:
- case 253 /* ImportSpecifier */:
- case 252 /* NamedImports */:
- case 251 /* NamespaceImport */:
- case 250 /* ImportClause */:
+ case 238 /* VariableDeclaration */:
+ case 239 /* VariableDeclarationList */:
+ case 254 /* ImportSpecifier */:
+ case 253 /* NamedImports */:
+ case 252 /* NamespaceImport */:
+ case 251 /* ImportClause */:
return false;
default:
return true;
@@ -35477,7 +35828,7 @@
return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, /*includeOptionality*/ false);
}
function isComputedNonLiteralName(name) {
- return name.kind === 149 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteralLike(name.expression);
+ return name.kind === 150 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteralLike(name.expression);
}
function getRestType(source, properties, symbol) {
source = filterType(source, function (t) { return !(t.flags & 98304 /* Nullable */); });
@@ -35492,13 +35843,11 @@
if (omitKeyType.flags & 131072 /* Never */) {
return source;
}
- var pickTypeAlias = getGlobalPickSymbol();
- var excludeTypeAlias = getGlobalExcludeSymbol();
- if (!pickTypeAlias || !excludeTypeAlias) {
+ var omitTypeAlias = getGlobalOmitSymbol();
+ if (!omitTypeAlias) {
return errorType;
}
- var pickKeys = getTypeAliasInstantiation(excludeTypeAlias, [getIndexType(source), omitKeyType]);
- return getTypeAliasInstantiation(pickTypeAlias, [source, pickKeys]);
+ return getTypeAliasInstantiation(omitTypeAlias, [source, omitKeyType]);
}
var members = ts.createSymbolTable();
for (var _i = 0, _a = getPropertiesOfType(source); _i < _a.length; _i++) {
@@ -35531,7 +35880,7 @@
if (parentAccess && parentAccess.flowNode) {
var propName = getDestructuringPropertyName(node);
if (propName) {
- var result = ts.createNode(190 /* ElementAccessExpression */, node.pos, node.end);
+ var result = ts.createNode(191 /* ElementAccessExpression */, node.pos, node.end);
result.parent = node;
result.expression = parentAccess;
var literal = ts.createNode(10 /* StringLiteral */, node.pos, node.end);
@@ -35546,23 +35895,23 @@
function getParentElementAccess(node) {
var ancestor = node.parent.parent;
switch (ancestor.kind) {
- case 186 /* BindingElement */:
- case 275 /* PropertyAssignment */:
+ case 187 /* BindingElement */:
+ case 276 /* PropertyAssignment */:
return getSyntheticElementAccess(ancestor);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return getSyntheticElementAccess(node.parent);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return ancestor.initializer;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return ancestor.right;
}
}
function getDestructuringPropertyName(node) {
var parent = node.parent;
- if (node.kind === 186 /* BindingElement */ && parent.kind === 184 /* ObjectBindingPattern */) {
+ if (node.kind === 187 /* BindingElement */ && parent.kind === 185 /* ObjectBindingPattern */) {
return getLiteralPropertyNameText(node.propertyName || node.name);
}
- if (node.kind === 275 /* PropertyAssignment */ || node.kind === 276 /* ShorthandPropertyAssignment */) {
+ if (node.kind === 276 /* PropertyAssignment */ || node.kind === 277 /* ShorthandPropertyAssignment */) {
return getLiteralPropertyNameText(node.name);
}
return "" + parent.elements.indexOf(node);
@@ -35584,7 +35933,7 @@
parentType = getNonNullableType(parentType);
}
var type;
- if (pattern.kind === 184 /* ObjectBindingPattern */) {
+ if (pattern.kind === 185 /* ObjectBindingPattern */) {
if (declaration.dotDotDotToken) {
if (parentType.flags & 2 /* Unknown */ || !isValidSpreadType(parentType)) {
error(declaration, ts.Diagnostics.Rest_types_may_only_be_created_from_object_types);
@@ -35648,30 +35997,30 @@
}
function isNullOrUndefined(node) {
var expr = ts.skipParentheses(node);
- return expr.kind === 96 /* NullKeyword */ || expr.kind === 72 /* Identifier */ && getResolvedSymbol(expr) === undefinedSymbol;
+ return expr.kind === 97 /* NullKeyword */ || expr.kind === 73 /* Identifier */ && getResolvedSymbol(expr) === undefinedSymbol;
}
function isEmptyArrayLiteral(node) {
var expr = ts.skipParentheses(node);
- return expr.kind === 187 /* ArrayLiteralExpression */ && expr.elements.length === 0;
+ return expr.kind === 188 /* ArrayLiteralExpression */ && expr.elements.length === 0;
}
function addOptionality(type, optional) {
if (optional === void 0) { optional = true; }
return strictNullChecks && optional ? getOptionalType(type) : type;
}
function isParameterOfContextuallyTypedFunction(node) {
- return node.kind === 151 /* Parameter */ &&
- (node.parent.kind === 196 /* FunctionExpression */ || node.parent.kind === 197 /* ArrowFunction */) &&
+ return node.kind === 152 /* Parameter */ &&
+ (node.parent.kind === 197 /* FunctionExpression */ || node.parent.kind === 198 /* ArrowFunction */) &&
!!getContextualType(node.parent);
}
// Return the inferred type for a variable, parameter, or property declaration
function getTypeForVariableLikeDeclaration(declaration, includeOptionality) {
// A variable declared in a for..in statement is of type string, or of type keyof T when the
// right hand expression is of a type parameter type.
- if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 226 /* ForInStatement */) {
+ if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 227 /* ForInStatement */) {
var indexType = getIndexType(getNonNullableTypeIfNeeded(checkExpression(declaration.parent.parent.expression)));
return indexType.flags & (262144 /* TypeParameter */ | 4194304 /* Index */) ? getExtractStringType(indexType) : stringType;
}
- if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 227 /* ForOfStatement */) {
+ if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 228 /* ForOfStatement */) {
// checkRightHandSideOfForOf will return undefined if the for-of expression type was
// missing properties/signatures required to get its iteratedType (like
// [Symbol.iterator] or next). This may be because we accessed properties from anyType,
@@ -35690,7 +36039,7 @@
return addOptionality(declaredType, isOptional);
}
if ((noImplicitAny || ts.isInJSFile(declaration)) &&
- declaration.kind === 237 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) &&
+ declaration.kind === 238 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) &&
!(ts.getCombinedModifierFlags(declaration) & 1 /* Export */) && !(declaration.flags & 4194304 /* Ambient */)) {
// If --noImplicitAny is on or the declaration is in a Javascript file,
// use control flow tracked 'any' type for non-ambient, non-exported var or let variables with no
@@ -35704,11 +36053,11 @@
return autoArrayType;
}
}
- if (declaration.kind === 151 /* Parameter */) {
+ if (declaration.kind === 152 /* Parameter */) {
var func = declaration.parent;
// For a parameter of a set accessor, use the type of the get accessor if one is present
- if (func.kind === 159 /* SetAccessor */ && !hasNonBindableDynamicName(func)) {
- var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 158 /* GetAccessor */);
+ if (func.kind === 160 /* SetAccessor */ && !hasNonBindableDynamicName(func)) {
+ var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 159 /* GetAccessor */);
if (getter) {
var getterSignature = getSignatureFromDeclaration(getter);
var thisParameter = getAccessorThisParameter(func);
@@ -35845,7 +36194,7 @@
return type;
}
else if (declaredType !== errorType && type !== errorType && !isTypeIdenticalTo(declaredType, type)) {
- errorNextVariableOrPropertyDeclarationMustHaveSameType(declaredType, declaration, type);
+ errorNextVariableOrPropertyDeclarationMustHaveSameType(/*firstDeclaration*/ undefined, declaredType, declaration, type);
}
}
return declaredType;
@@ -35912,9 +36261,9 @@
var thisContainer = ts.getThisContainer(expression, /*includeArrowFunctions*/ false);
// Properties defined in a constructor (or base constructor, or javascript constructor function) don't get undefined added.
// Function expressions that are assigned to the prototype count as methods.
- return thisContainer.kind === 157 /* Constructor */ ||
- thisContainer.kind === 239 /* FunctionDeclaration */ ||
- (thisContainer.kind === 196 /* FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent));
+ return thisContainer.kind === 158 /* Constructor */ ||
+ thisContainer.kind === 240 /* FunctionDeclaration */ ||
+ (thisContainer.kind === 197 /* FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent));
}
function getConstructorDefinedThisAssignmentTypes(types, declarations) {
ts.Debug.assert(types.length === declarations.length);
@@ -35989,7 +36338,7 @@
function getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors) {
var elements = pattern.elements;
var lastElement = ts.lastOrUndefined(elements);
- var hasRestElement = !!(lastElement && lastElement.kind === 186 /* BindingElement */ && lastElement.dotDotDotToken);
+ var hasRestElement = !!(lastElement && lastElement.kind === 187 /* BindingElement */ && lastElement.dotDotDotToken);
if (elements.length === 0 || elements.length === 1 && hasRestElement) {
return languageVersion >= 2 /* ES2015 */ ? createIterableType(anyType) : anyArrayType;
}
@@ -36012,7 +36361,7 @@
function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) {
if (includePatternInType === void 0) { includePatternInType = false; }
if (reportErrors === void 0) { reportErrors = false; }
- return pattern.kind === 184 /* ObjectBindingPattern */
+ return pattern.kind === 185 /* ObjectBindingPattern */
? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors)
: getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors);
}
@@ -36051,7 +36400,7 @@
}
function declarationBelongsToPrivateAmbientMember(declaration) {
var root = ts.getRootDeclaration(declaration);
- var memberDeclaration = root.kind === 151 /* Parameter */ ? root.parent : root;
+ var memberDeclaration = root.kind === 152 /* Parameter */ ? root.parent : root;
return isPrivateWithinAmbient(memberDeclaration);
}
function tryGetTypeFromEffectiveTypeNode(declaration) {
@@ -36113,7 +36462,7 @@
return reportCircularityError(symbol);
}
var type;
- if (declaration.kind === 254 /* ExportAssignment */) {
+ if (declaration.kind === 255 /* ExportAssignment */) {
type = widenTypeForVariableLikeDeclaration(checkExpressionCached(declaration.expression), declaration);
}
else if (ts.isInJSFile(declaration) &&
@@ -36164,7 +36513,7 @@
type = getTypeOfEnumMember(symbol);
}
else {
- return ts.Debug.fail("Unhandled declaration kind! " + ts.Debug.showSyntaxKind(declaration) + " for " + ts.Debug.showSymbol(symbol));
+ return ts.Debug.fail("Unhandled declaration kind! " + ts.Debug.formatSyntaxKind(declaration.kind) + " for " + ts.Debug.formatSymbol(symbol));
}
if (!popTypeResolution()) {
// Symbol is property of some kind that is merged with something - should use `getTypeOfFuncClassEnumModule` and not `getTypeOfVariableOrParameterOrProperty`
@@ -36177,7 +36526,7 @@
}
function getAnnotatedAccessorTypeNode(accessor) {
if (accessor) {
- if (accessor.kind === 158 /* GetAccessor */) {
+ if (accessor.kind === 159 /* GetAccessor */) {
var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor);
return getterTypeAnnotation;
}
@@ -36204,8 +36553,8 @@
return links.type || (links.type = getTypeOfAccessorsWorker(symbol));
}
function getTypeOfAccessorsWorker(symbol) {
- var getter = ts.getDeclarationOfKind(symbol, 158 /* GetAccessor */);
- var setter = ts.getDeclarationOfKind(symbol, 159 /* SetAccessor */);
+ var getter = ts.getDeclarationOfKind(symbol, 159 /* GetAccessor */);
+ var setter = ts.getDeclarationOfKind(symbol, 160 /* SetAccessor */);
if (getter && ts.isInJSFile(getter)) {
var jsDocType = getTypeForDeclarationFromJSDocComment(getter);
if (jsDocType) {
@@ -36248,7 +36597,7 @@
if (!popTypeResolution()) {
type = anyType;
if (noImplicitAny) {
- var getter_1 = ts.getDeclarationOfKind(symbol, 158 /* GetAccessor */);
+ var getter_1 = ts.getDeclarationOfKind(symbol, 159 /* GetAccessor */);
error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
}
}
@@ -36288,8 +36637,8 @@
if (symbol.flags & 1536 /* Module */ && ts.isShorthandAmbientModuleSymbol(symbol)) {
return anyType;
}
- else if (declaration.kind === 204 /* BinaryExpression */ ||
- declaration.kind === 189 /* PropertyAccessExpression */ && declaration.parent.kind === 204 /* BinaryExpression */) {
+ else if (declaration.kind === 205 /* BinaryExpression */ ||
+ declaration.kind === 190 /* PropertyAccessExpression */ && declaration.parent.kind === 205 /* BinaryExpression */) {
return getWidenedTypeFromAssignmentDeclaration(symbol);
}
else if (symbol.flags & 512 /* ValueModule */ && declaration && ts.isSourceFile(declaration) && declaration.commonJsModuleIndicator) {
@@ -36356,7 +36705,7 @@
return errorType;
}
// Check if variable has initializer that circularly references the variable itself
- if (noImplicitAny && (declaration.kind !== 151 /* Parameter */ || declaration.initializer)) {
+ if (noImplicitAny && (declaration.kind !== 152 /* Parameter */ || declaration.initializer)) {
error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol));
}
// Circularities could also result from parameters in function expressions that end up
@@ -36364,11 +36713,23 @@
// we have already reported an implicit any error so we don't report anything here.
return anyType;
}
+ function getTypeOfSymbolWithDeferredType(symbol) {
+ var links = getSymbolLinks(symbol);
+ if (!links.type) {
+ ts.Debug.assertDefined(links.deferralParent);
+ ts.Debug.assertDefined(links.deferralConstituents);
+ links.type = links.deferralParent.flags & 1048576 /* Union */ ? getUnionType(links.deferralConstituents) : getIntersectionType(links.deferralConstituents);
+ }
+ return links.type;
+ }
function getTypeOfSymbol(symbol) {
+ if (ts.getCheckFlags(symbol) & 65536 /* DeferredType */) {
+ return getTypeOfSymbolWithDeferredType(symbol);
+ }
if (ts.getCheckFlags(symbol) & 1 /* Instantiated */) {
return getTypeOfInstantiatedSymbol(symbol);
}
- if (ts.getCheckFlags(symbol) & 4096 /* ReverseMapped */) {
+ if (ts.getCheckFlags(symbol) & 8192 /* ReverseMapped */) {
return getTypeOfReverseMappedSymbol(symbol);
}
if (symbol.flags & (3 /* Variable */ | 4 /* Property */)) {
@@ -36429,35 +36790,35 @@
return undefined;
}
switch (node.kind) {
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 155 /* MethodSignature */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 294 /* JSDocFunctionType */:
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 242 /* TypeAliasDeclaration */:
- case 308 /* JSDocTemplateTag */:
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
- case 181 /* MappedType */:
- case 175 /* ConditionalType */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 156 /* MethodSignature */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 295 /* JSDocFunctionType */:
+ case 240 /* FunctionDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 243 /* TypeAliasDeclaration */:
+ case 309 /* JSDocTemplateTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
+ case 182 /* MappedType */:
+ case 176 /* ConditionalType */:
var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes);
- if (node.kind === 181 /* MappedType */) {
+ if (node.kind === 182 /* MappedType */) {
return ts.append(outerTypeParameters, getDeclaredTypeOfTypeParameter(getSymbolOfNode(node.typeParameter)));
}
- else if (node.kind === 175 /* ConditionalType */) {
+ else if (node.kind === 176 /* ConditionalType */) {
return ts.concatenate(outerTypeParameters, getInferTypeParameters(node));
}
var outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, ts.getEffectiveTypeParameterDeclarations(node));
var thisType = includeThisTypes &&
- (node.kind === 240 /* ClassDeclaration */ || node.kind === 209 /* ClassExpression */ || node.kind === 241 /* InterfaceDeclaration */) &&
+ (node.kind === 241 /* ClassDeclaration */ || node.kind === 210 /* ClassExpression */ || node.kind === 242 /* InterfaceDeclaration */) &&
getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType;
return thisType ? ts.append(outerAndOwnTypeParameters, thisType) : outerAndOwnTypeParameters;
}
@@ -36465,7 +36826,7 @@
}
// The outer type parameters are those defined by enclosing generic classes, methods, or functions.
function getOuterTypeParametersOfClassOrInterface(symbol) {
- var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 241 /* InterfaceDeclaration */);
+ var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 242 /* InterfaceDeclaration */);
return getOuterTypeParameters(declaration);
}
// The local type parameters are the combined set of type parameters from all declarations of the class,
@@ -36474,9 +36835,9 @@
var result;
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var node = _a[_i];
- if (node.kind === 241 /* InterfaceDeclaration */ ||
- node.kind === 240 /* ClassDeclaration */ ||
- node.kind === 209 /* ClassExpression */ ||
+ if (node.kind === 242 /* InterfaceDeclaration */ ||
+ node.kind === 241 /* ClassDeclaration */ ||
+ node.kind === 210 /* ClassExpression */ ||
ts.isTypeAlias(node)) {
var declaration = node;
result = appendTypeParameters(result, ts.getEffectiveTypeParameterDeclarations(declaration));
@@ -36670,7 +37031,7 @@
type.resolvedBaseTypes = type.resolvedBaseTypes || ts.emptyArray;
for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 241 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) {
+ if (declaration.kind === 242 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) {
for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) {
var node = _c[_b];
var baseType = getTypeFromTypeNode(node);
@@ -36706,7 +37067,7 @@
function isThislessInterface(symbol) {
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 241 /* InterfaceDeclaration */) {
+ if (declaration.kind === 242 /* InterfaceDeclaration */) {
if (declaration.flags & 64 /* ContainsThis */) {
return false;
}
@@ -36763,7 +37124,7 @@
return errorType;
}
var declaration = ts.find(symbol.declarations, function (d) {
- return ts.isJSDocTypeAlias(d) || d.kind === 242 /* TypeAliasDeclaration */;
+ return ts.isJSDocTypeAlias(d) || d.kind === 243 /* TypeAliasDeclaration */;
});
var typeNode = ts.isJSDocTypeAlias(declaration) ? declaration.typeExpression : declaration.type;
// If typeNode is missing, we will error in checkJSDocTypedefTag.
@@ -36790,7 +37151,7 @@
if (expr.kind === 10 /* StringLiteral */) {
return true;
}
- else if (expr.kind === 204 /* BinaryExpression */) {
+ else if (expr.kind === 205 /* BinaryExpression */) {
return isStringConcatExpression(expr.left) && isStringConcatExpression(expr.right);
}
return false;
@@ -36804,12 +37165,12 @@
case 10 /* StringLiteral */:
case 8 /* NumericLiteral */:
return true;
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return expr.operator === 39 /* MinusToken */ &&
expr.operand.kind === 8 /* NumericLiteral */;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return ts.nodeIsMissing(expr) || !!getSymbolOfNode(member.parent).exports.get(expr.escapedText);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return isStringConcatExpression(expr);
default:
return false;
@@ -36823,7 +37184,7 @@
var hasNonLiteralMember = false;
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 243 /* EnumDeclaration */) {
+ if (declaration.kind === 244 /* EnumDeclaration */) {
for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) {
var member = _c[_b];
if (member.initializer && member.initializer.kind === 10 /* StringLiteral */) {
@@ -36850,7 +37211,7 @@
var memberTypeList = [];
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 243 /* EnumDeclaration */) {
+ if (declaration.kind === 244 /* EnumDeclaration */) {
for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) {
var member = _c[_b];
var memberType = getFreshTypeOfLiteralType(getLiteralType(getEnumMemberValue(member), enumCount, getSymbolOfNode(member))); // TODO: GH#18217
@@ -36921,23 +37282,23 @@
*/
function isThislessType(node) {
switch (node.kind) {
- case 120 /* AnyKeyword */:
- case 143 /* UnknownKeyword */:
- case 138 /* StringKeyword */:
- case 135 /* NumberKeyword */:
- case 146 /* BigIntKeyword */:
- case 123 /* BooleanKeyword */:
- case 139 /* SymbolKeyword */:
- case 136 /* ObjectKeyword */:
- case 106 /* VoidKeyword */:
- case 141 /* UndefinedKeyword */:
- case 96 /* NullKeyword */:
- case 132 /* NeverKeyword */:
- case 182 /* LiteralType */:
+ case 121 /* AnyKeyword */:
+ case 144 /* UnknownKeyword */:
+ case 139 /* StringKeyword */:
+ case 136 /* NumberKeyword */:
+ case 147 /* BigIntKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 137 /* ObjectKeyword */:
+ case 107 /* VoidKeyword */:
+ case 142 /* UndefinedKeyword */:
+ case 97 /* NullKeyword */:
+ case 133 /* NeverKeyword */:
+ case 183 /* LiteralType */:
return true;
- case 169 /* ArrayType */:
+ case 170 /* ArrayType */:
return isThislessType(node.elementType);
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return !node.typeArguments || node.typeArguments.every(isThislessType);
}
return false;
@@ -36963,7 +37324,7 @@
function isThislessFunctionLikeDeclaration(node) {
var returnType = ts.getEffectiveReturnTypeNode(node);
var typeParameters = ts.getEffectiveTypeParameterDeclarations(node);
- return (node.kind === 157 /* Constructor */ || (!!returnType && isThislessType(returnType))) &&
+ return (node.kind === 158 /* Constructor */ || (!!returnType && isThislessType(returnType))) &&
node.parameters.every(isThislessVariableLikeDeclaration) &&
typeParameters.every(isThislessTypeParameter);
}
@@ -36979,14 +37340,14 @@
var declaration = symbol.declarations[0];
if (declaration) {
switch (declaration.kind) {
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
return isThislessVariableLikeDeclaration(declaration);
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return isThislessFunctionLikeDeclaration(declaration);
}
}
@@ -37087,7 +37448,7 @@
* members.
*/
function addDeclarationToLateBoundSymbol(symbol, member, symbolFlags) {
- ts.Debug.assert(!!(ts.getCheckFlags(symbol) & 2048 /* Late */), "Expected a late-bound symbol.");
+ ts.Debug.assert(!!(ts.getCheckFlags(symbol) & 4096 /* Late */), "Expected a late-bound symbol.");
symbol.flags |= symbolFlags;
getSymbolLinks(member.symbol).lateSymbol = symbol;
if (!symbol.declarations) {
@@ -37144,7 +37505,7 @@
// Get or add a late-bound symbol for the member. This allows us to merge late-bound accessor declarations.
var lateSymbol = lateSymbols.get(memberName);
if (!lateSymbol)
- lateSymbols.set(memberName, lateSymbol = createSymbol(0 /* None */, memberName, 2048 /* Late */));
+ lateSymbols.set(memberName, lateSymbol = createSymbol(0 /* None */, memberName, 4096 /* Late */));
// Report an error if a late-bound member has the same name as an early-bound member,
// or if we have another early-bound symbol declaration with the same name and
// conflicting flags.
@@ -37156,7 +37517,7 @@
var name_3 = !(type.flags & 8192 /* UniqueESSymbol */) && ts.unescapeLeadingUnderscores(memberName) || ts.declarationNameToString(decl.name);
ts.forEach(declarations, function (declaration) { return error(ts.getNameOfDeclaration(declaration) || declaration, ts.Diagnostics.Property_0_was_also_declared_here, name_3); });
error(decl.name || decl, ts.Diagnostics.Duplicate_property_0, name_3);
- lateSymbol = createSymbol(0 /* None */, memberName, 2048 /* Late */);
+ lateSymbol = createSymbol(0 /* None */, memberName, 4096 /* Late */);
}
lateSymbol.nameType = type;
addDeclarationToLateBoundSymbol(lateSymbol, decl, symbolFlags);
@@ -37221,11 +37582,12 @@
var links = getSymbolLinks(symbol);
if (!links.lateSymbol && ts.some(symbol.declarations, hasLateBindableName)) {
// force late binding of members/exports. This will set the late-bound symbol
+ var parent = getMergedSymbol(symbol.parent);
if (ts.some(symbol.declarations, ts.hasStaticModifier)) {
- getExportsOfSymbol(symbol.parent);
+ getExportsOfSymbol(parent);
}
else {
- getMembersOfSymbol(symbol.parent);
+ getMembersOfSymbol(parent);
}
}
return links.lateSymbol || (links.lateSymbol = symbol);
@@ -37342,8 +37704,8 @@
var tupleRestIndex_1 = restType.target.hasRestElement ? elementTypes.length - 1 : -1;
var restParams = ts.map(elementTypes, function (t, i) {
var name = getParameterNameAtPosition(sig, restIndex_1 + i);
- var checkFlags = i === tupleRestIndex_1 ? 16384 /* RestParameter */ :
- i >= minLength_1 ? 8192 /* OptionalParameter */ : 0;
+ var checkFlags = i === tupleRestIndex_1 ? 32768 /* RestParameter */ :
+ i >= minLength_1 ? 16384 /* OptionalParameter */ : 0;
var symbol = createSymbol(1 /* FunctionScopedVariable */, name, checkFlags);
symbol.type = i === tupleRestIndex_1 ? createArrayType(t) : t;
return symbol;
@@ -37433,10 +37795,10 @@
// Union the result types when more than one signature matches
if (unionSignatures.length > 1) {
var thisParameter = signature.thisParameter;
- if (ts.forEach(unionSignatures, function (sig) { return sig.thisParameter; })) {
- // TODO: GH#18217 We tested that *some* has thisParameter and now act as if *all* do
+ var firstThisParameterOfUnionSignatures = ts.forEach(unionSignatures, function (sig) { return sig.thisParameter; });
+ if (firstThisParameterOfUnionSignatures) {
var thisType = getUnionType(ts.map(unionSignatures, function (sig) { return sig.thisParameter ? getTypeOfSymbol(sig.thisParameter) : anyType; }), 2 /* Subtype */);
- thisParameter = createSymbolWithType(signature.thisParameter, thisType);
+ thisParameter = createSymbolWithType(firstThisParameterOfUnionSignatures, thisType);
}
s = createUnionSignature(signature, unionSignatures);
s.thisParameter = thisParameter;
@@ -37693,7 +38055,7 @@
var members = ts.createSymbolTable();
for (var _i = 0, _a = getPropertiesOfType(type.source); _i < _a.length; _i++) {
var prop = _a[_i];
- var checkFlags = 4096 /* ReverseMapped */ | (readonlyMask && isReadonlySymbol(prop) ? 8 /* Readonly */ : 0);
+ var checkFlags = 8192 /* ReverseMapped */ | (readonlyMask && isReadonlySymbol(prop) ? 8 /* Readonly */ : 0);
var inferredProp = createSymbol(4 /* Property */ | prop.flags & optionalMask, prop.escapedName, checkFlags);
inferredProp.declarations = prop.declarations;
inferredProp.nameType = prop.nameType;
@@ -37715,7 +38077,15 @@
return getIndexType(getApparentType(type.type));
}
if (type.flags & 16777216 /* Conditional */) {
- return getLowerBoundOfConditionalType(type);
+ if (type.root.isDistributive) {
+ var checkType = type.checkType;
+ var constraint = getLowerBoundOfKeyType(checkType);
+ if (constraint !== checkType) {
+ var mapper = makeUnaryTypeMapper(type.root.checkType, constraint);
+ return getConditionalTypeInstantiation(type, combineTypeMappers(mapper, type.mapper));
+ }
+ }
+ return type;
}
if (type.flags & 1048576 /* Union */) {
return getUnionType(ts.sameMap(type.types, getLowerBoundOfKeyType));
@@ -37725,16 +38095,6 @@
}
return neverType;
}
- function getLowerBoundOfConditionalType(type) {
- if (type.root.isDistributive) {
- var constraint = getLowerBoundOfKeyType(type.checkType);
- if (constraint !== type.checkType) {
- var mapper = makeUnaryTypeMapper(type.root.checkType, constraint);
- return getConditionalTypeInstantiation(type, combineTypeMappers(mapper, type.mapper));
- }
- }
- return type;
- }
/** Resolve the members of a mapped type { [P in K]: T } */
function resolveMappedTypeMembers(type) {
var members = ts.createSymbolTable();
@@ -37823,8 +38183,8 @@
}
function isMappedTypeWithKeyofConstraintDeclaration(type) {
var constraintDeclaration = getConstraintDeclarationForMappedType(type); // TODO: GH#18217
- return constraintDeclaration.kind === 179 /* TypeOperator */ &&
- constraintDeclaration.operator === 129 /* KeyOfKeyword */;
+ return constraintDeclaration.kind === 180 /* TypeOperator */ &&
+ constraintDeclaration.operator === 130 /* KeyOfKeyword */;
}
function getModifiersTypeFromMappedType(type) {
if (!type.modifiersType) {
@@ -37841,7 +38201,7 @@
var declaredType = getTypeFromMappedTypeNode(type.declaration);
var constraint = getConstraintTypeFromMappedType(declaredType);
var extendedConstraint = constraint && constraint.flags & 262144 /* TypeParameter */ ? getConstraintOfTypeParameter(constraint) : constraint;
- type.modifiersType = extendedConstraint && extendedConstraint.flags & 4194304 /* Index */ ? instantiateType(extendedConstraint.type, type.mapper || identityMapper) : emptyObjectType;
+ type.modifiersType = extendedConstraint && extendedConstraint.flags & 4194304 /* Index */ ? instantiateType(extendedConstraint.type, type.mapper || identityMapper) : unknownType;
}
}
return type.modifiersType;
@@ -37937,6 +38297,26 @@
}
return type.resolvedProperties;
}
+ function getPossiblePropertiesOfUnionType(type) {
+ if (type.possiblePropertyCache) {
+ return type.possiblePropertyCache.size ? ts.arrayFrom(type.possiblePropertyCache.values()) : ts.emptyArray;
+ }
+ type.possiblePropertyCache = ts.createSymbolTable();
+ for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
+ var t = _a[_i];
+ for (var _b = 0, _c = getPropertiesOfType(t); _b < _c.length; _b++) {
+ var p = _c[_b];
+ if (!type.possiblePropertyCache.has(p.escapedName)) {
+ var prop = getUnionOrIntersectionProperty(type, p.escapedName);
+ if (prop) {
+ type.possiblePropertyCache.set(p.escapedName, prop);
+ }
+ }
+ }
+ }
+ // We can't simply use the normal property cache here, since that will contain cached apparent type members :(
+ return type.possiblePropertyCache.size ? ts.arrayFrom(type.possiblePropertyCache.values()) : ts.emptyArray;
+ }
function getPropertiesOfType(type) {
type = getApparentType(type);
return type.flags & 3145728 /* UnionOrIntersection */ ?
@@ -37984,16 +38364,23 @@
function getConstraintOfIndexedAccess(type) {
return hasNonCircularBaseConstraint(type) ? getConstraintFromIndexedAccess(type) : undefined;
}
+ function getSimplifiedTypeOrConstraint(type) {
+ var simplified = getSimplifiedType(type, /*writing*/ false);
+ return simplified !== type ? simplified : getConstraintOfType(type);
+ }
function getConstraintFromIndexedAccess(type) {
- var objectType = getConstraintOfType(type.objectType) || type.objectType;
- if (objectType !== type.objectType) {
- var constraint = getIndexedAccessType(objectType, type.indexType, /*accessNode*/ undefined, errorType);
- if (constraint && constraint !== errorType) {
- return constraint;
+ var indexConstraint = getSimplifiedTypeOrConstraint(type.indexType);
+ if (indexConstraint && indexConstraint !== type.indexType) {
+ var indexedAccess = getIndexedAccessTypeOrUndefined(type.objectType, indexConstraint);
+ if (indexedAccess) {
+ return indexedAccess;
}
}
- var baseConstraint = getBaseConstraintOfType(type);
- return baseConstraint && baseConstraint !== type ? baseConstraint : undefined;
+ var objectConstraint = getSimplifiedTypeOrConstraint(type.objectType);
+ if (objectConstraint && objectConstraint !== type.objectType) {
+ return getIndexedAccessTypeOrUndefined(objectConstraint, type.indexType);
+ }
+ return undefined;
}
function getDefaultConstraintOfConditionalType(type) {
if (!type.resolvedDefaultConstraint) {
@@ -38002,7 +38389,7 @@
// just `any`. This result is _usually_ unwanted - so instead here we elide an `any` branch from the constraint type,
// in effect treating `any` like `never` rather than `unknown` in this location.
var trueConstraint = getInferredTrueTypeFromConditionalType(type);
- var falseConstraint = type.falseType;
+ var falseConstraint = getFalseTypeFromConditionalType(type);
type.resolvedDefaultConstraint = isTypeAny(trueConstraint) ? falseConstraint : isTypeAny(falseConstraint) ? trueConstraint : getUnionType([trueConstraint, falseConstraint]);
}
return type.resolvedDefaultConstraint;
@@ -38020,7 +38407,7 @@
// a union - once negated types exist and are applied to the conditional false branch, this "constraint"
// likely doesn't need to exist.
if (type.root.isDistributive && type.restrictiveInstantiation !== type) {
- var simplified = getSimplifiedType(type.checkType);
+ var simplified = getSimplifiedType(type.checkType, /*writing*/ false);
var constraint = simplified === type.checkType ? getConstraintOfType(simplified) : simplified;
if (constraint && constraint !== type.checkType) {
var mapper = makeUnaryTypeMapper(type.root.checkType, constraint);
@@ -38051,11 +38438,6 @@
constraint = getConstraintOfType(constraint);
}
if (constraint) {
- // A constraint that isn't a union type implies that the final type would be a non-union
- // type as well. Since non-union constraints are of no interest, we can exit here.
- if (!(constraint.flags & 1048576 /* Union */)) {
- return undefined;
- }
constraints = ts.append(constraints, constraint);
}
}
@@ -38064,10 +38446,10 @@
}
}
// If the target is a union type or if we are intersecting with types belonging to one of the
- // disjoint domans, we may end up producing a constraint that hasn't been examined before.
+ // disjoint domains, we may end up producing a constraint that hasn't been examined before.
if (constraints && (targetIsUnion || hasDisjointDomainType)) {
if (hasDisjointDomainType) {
- // We add any types belong to one of the disjoint domans because they might cause the final
+ // We add any types belong to one of the disjoint domains because they might cause the final
// intersection operation to reduce the union constraints.
for (var _b = 0, _c = type.types; _b < _c.length; _b++) {
var t = _c[_b];
@@ -38113,7 +38495,7 @@
}
if (constraintDepth >= 50) {
// We have reached 50 recursive invocations of getImmediateBaseConstraint and there is a
- // very high likelyhood we're dealing with an infinite generic type that perpetually generates
+ // very high likelihood we're dealing with an infinite generic type that perpetually generates
// new type identities as we descend into it. We stop the recursion here and mark this type
// and the outer types as having circular constraints.
error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
@@ -38121,7 +38503,7 @@
return t.immediateBaseConstraint = noConstraintType;
}
constraintDepth++;
- var result = computeBaseConstraint(getSimplifiedType(t));
+ var result = computeBaseConstraint(getSimplifiedType(t, /*writing*/ false));
constraintDepth--;
if (!popTypeResolution()) {
if (t.flags & 262144 /* TypeParameter */) {
@@ -38173,8 +38555,8 @@
if (t.flags & 8388608 /* IndexedAccess */) {
var baseObjectType = getBaseConstraint(t.objectType);
var baseIndexType = getBaseConstraint(t.indexType);
- var baseIndexedAccess = baseObjectType && baseIndexType ? getIndexedAccessType(baseObjectType, baseIndexType, /*accessNode*/ undefined, errorType) : undefined;
- return baseIndexedAccess && baseIndexedAccess !== errorType ? getBaseConstraint(baseIndexedAccess) : undefined;
+ var baseIndexedAccess = baseObjectType && baseIndexType && getIndexedAccessTypeOrUndefined(baseObjectType, baseIndexType);
+ return baseIndexedAccess && getBaseConstraint(baseIndexedAccess);
}
if (t.flags & 16777216 /* Conditional */) {
var constraint = getConstraintFromConditionalType(t);
@@ -38255,16 +38637,17 @@
* type itself. Note that the apparent type of a union type is the union type itself.
*/
function getApparentType(type) {
- var t = type.flags & 63176704 /* Instantiable */ ? getBaseConstraintOfType(type) || emptyObjectType : type;
+ var t = type.flags & 63176704 /* Instantiable */ ? getBaseConstraintOfType(type) || unknownType : type;
return ts.getObjectFlags(t) & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) :
t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t) :
t.flags & 132 /* StringLike */ ? globalStringType :
t.flags & 296 /* NumberLike */ ? globalNumberType :
- t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType(/*reportErrors*/ languageVersion >= 7 /* ESNext */) :
+ t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType(/*reportErrors*/ languageVersion >= 8 /* ESNext */) :
t.flags & 528 /* BooleanLike */ ? globalBooleanType :
t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType(/*reportErrors*/ languageVersion >= 2 /* ES2015 */) :
t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType :
t.flags & 4194304 /* Index */ ? keyofConstraintType :
+ t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType :
t;
}
function createUnionOrIntersectionProperty(containingType, name) {
@@ -38273,7 +38656,7 @@
var isUnion = containingType.flags & 1048576 /* Union */;
var excludeModifiers = isUnion ? 24 /* NonPublicAccessibilityModifier */ : 0;
// Flags we want to propagate to the result if they exist in all source symbols
- var commonFlags = isUnion ? 0 /* None */ : 16777216 /* Optional */;
+ var optionalFlag = isUnion ? 0 /* None */ : 16777216 /* Optional */;
var syntheticFlag = 4 /* SyntheticMethod */;
var checkFlags = 0;
for (var _i = 0, _a = containingType.types; _i < _a.length; _i++) {
@@ -38283,16 +38666,21 @@
var prop = getPropertyOfType(type, name);
var modifiers = prop ? ts.getDeclarationModifierFlagsFromSymbol(prop) : 0;
if (prop && !(modifiers & excludeModifiers)) {
- commonFlags &= prop.flags;
+ if (isUnion) {
+ optionalFlag |= (prop.flags & 16777216 /* Optional */);
+ }
+ else {
+ optionalFlag &= prop.flags;
+ }
var id = "" + getSymbolId(prop);
if (!propSet.has(id)) {
propSet.set(id, prop);
}
checkFlags |= (isReadonlySymbol(prop) ? 8 /* Readonly */ : 0) |
- (!(modifiers & 24 /* NonPublicAccessibilityModifier */) ? 128 /* ContainsPublic */ : 0) |
- (modifiers & 16 /* Protected */ ? 256 /* ContainsProtected */ : 0) |
- (modifiers & 8 /* Private */ ? 512 /* ContainsPrivate */ : 0) |
- (modifiers & 32 /* Static */ ? 1024 /* ContainsStatic */ : 0);
+ (!(modifiers & 24 /* NonPublicAccessibilityModifier */) ? 256 /* ContainsPublic */ : 0) |
+ (modifiers & 16 /* Protected */ ? 512 /* ContainsProtected */ : 0) |
+ (modifiers & 8 /* Private */ ? 1024 /* ContainsPrivate */ : 0) |
+ (modifiers & 32 /* Static */ ? 2048 /* ContainsStatic */ : 0);
if (!isPrototypeProperty(prop)) {
syntheticFlag = 2 /* SyntheticProperty */;
}
@@ -38301,10 +38689,11 @@
var indexInfo = !isLateBoundName(name) && (isNumericLiteralName(name) && getIndexInfoOfType(type, 1 /* Number */) || getIndexInfoOfType(type, 0 /* String */));
if (indexInfo) {
checkFlags |= indexInfo.isReadonly ? 8 /* Readonly */ : 0;
+ checkFlags |= 32 /* WritePartial */;
indexTypes = ts.append(indexTypes, isTupleType(type) ? getRestTypeOfTupleType(type) || undefinedType : indexInfo.type);
}
else {
- checkFlags |= 16 /* Partial */;
+ checkFlags |= 16 /* ReadPartial */;
}
}
}
@@ -38313,7 +38702,7 @@
return undefined;
}
var props = ts.arrayFrom(propSet.values());
- if (props.length === 1 && !(checkFlags & 16 /* Partial */) && !indexTypes) {
+ if (props.length === 1 && !(checkFlags & 16 /* ReadPartial */) && !indexTypes) {
return props[0];
}
var declarations;
@@ -38337,15 +38726,15 @@
nameType = prop.nameType;
}
else if (type !== firstType) {
- checkFlags |= 32 /* HasNonUniformType */;
+ checkFlags |= 64 /* HasNonUniformType */;
}
if (isLiteralType(type)) {
- checkFlags |= 64 /* HasLiteralType */;
+ checkFlags |= 128 /* HasLiteralType */;
}
propTypes.push(type);
}
ts.addRange(propTypes, indexTypes);
- var result = createSymbol(4 /* Property */ | commonFlags, name, syntheticFlag | checkFlags);
+ var result = createSymbol(4 /* Property */ | optionalFlag, name, syntheticFlag | checkFlags);
result.containingType = containingType;
if (!hasNonUniformValueDeclaration && firstValueDeclaration) {
result.valueDeclaration = firstValueDeclaration;
@@ -38356,7 +38745,15 @@
}
result.declarations = declarations;
result.nameType = nameType;
+ if (propTypes.length > 2) {
+ // When `propTypes` has the potential to explode in size when normalized, defer normalization until absolutely needed
+ result.checkFlags |= 65536 /* DeferredType */;
+ result.deferralParent = containingType;
+ result.deferralConstituents = propTypes;
+ }
+ else {
result.type = isUnion ? getUnionType(propTypes) : getIntersectionType(propTypes);
+ }
return result;
}
// Return the symbol for a given property in a union or intersection type, or undefined if the property
@@ -38378,7 +38775,7 @@
function getPropertyOfUnionOrIntersectionType(type, name) {
var property = getUnionOrIntersectionProperty(type, name);
// We need to filter out partial properties in union types
- return property && !(ts.getCheckFlags(property) & 16 /* Partial */) ? property : undefined;
+ return property && !(ts.getCheckFlags(property) & 16 /* ReadPartial */) ? property : undefined;
}
/**
* Return the symbol for the property with the given name in the given type. Creates synthetic union properties when
@@ -38484,10 +38881,10 @@
function isJSDocOptionalParameter(node) {
return ts.isInJSFile(node) && (
// node.type should only be a JSDocOptionalType when node is a parameter of a JSDocFunctionType
- node.type && node.type.kind === 293 /* JSDocOptionalType */
+ node.type && node.type.kind === 294 /* JSDocOptionalType */
|| ts.getJSDocParameterTags(node).some(function (_a) {
var isBracketed = _a.isBracketed, typeExpression = _a.typeExpression;
- return isBracketed || !!typeExpression && typeExpression.type.kind === 293 /* JSDocOptionalType */;
+ return isBracketed || !!typeExpression && typeExpression.type.kind === 294 /* JSDocOptionalType */;
}));
}
function tryFindAmbientModule(moduleName, withAugmentations) {
@@ -38521,7 +38918,7 @@
return false;
}
var isBracketed = node.isBracketed, typeExpression = node.typeExpression;
- return isBracketed || !!typeExpression && typeExpression.type.kind === 293 /* JSDocOptionalType */;
+ return isBracketed || !!typeExpression && typeExpression.type.kind === 294 /* JSDocOptionalType */;
}
function createIdentifierTypePredicate(parameterName, parameterIndex, type) {
return { kind: 1 /* Identifier */, parameterName: parameterName, parameterIndex: parameterIndex, type: type };
@@ -38559,7 +38956,7 @@
var baseDefaultType = getDefaultTypeArgumentType(isJavaScriptImplicitAny);
for (var i = numTypeArguments; i < numTypeParameters; i++) {
var defaultType = getDefaultFromTypeParameter(typeParameters[i]);
- if (isJavaScriptImplicitAny && defaultType && isTypeIdenticalTo(defaultType, emptyObjectType)) {
+ if (isJavaScriptImplicitAny && defaultType && (isTypeIdenticalTo(defaultType, unknownType) || isTypeIdenticalTo(defaultType, emptyObjectType))) {
defaultType = anyType;
}
result[i] = defaultType ? instantiateType(defaultType, createTypeMapper(typeParameters, result)) : baseDefaultType;
@@ -38603,7 +39000,7 @@
else {
parameters.push(paramSymbol);
}
- if (type && type.kind === 182 /* LiteralType */) {
+ if (type && type.kind === 183 /* LiteralType */) {
hasLiteralTypes = true;
}
// Record a new minimum argument count if this is not an optional parameter
@@ -38617,16 +39014,16 @@
}
}
// If only one accessor includes a this-type annotation, the other behaves as if it had the same type annotation
- if ((declaration.kind === 158 /* GetAccessor */ || declaration.kind === 159 /* SetAccessor */) &&
+ if ((declaration.kind === 159 /* GetAccessor */ || declaration.kind === 160 /* SetAccessor */) &&
!hasNonBindableDynamicName(declaration) &&
(!hasThisParameter || !thisParameter)) {
- var otherKind = declaration.kind === 158 /* GetAccessor */ ? 159 /* SetAccessor */ : 158 /* GetAccessor */;
+ var otherKind = declaration.kind === 159 /* GetAccessor */ ? 160 /* SetAccessor */ : 159 /* GetAccessor */;
var other = ts.getDeclarationOfKind(getSymbolOfNode(declaration), otherKind);
if (other) {
thisParameter = getAnnotatedAccessorThisParameter(other);
}
}
- var classType = declaration.kind === 157 /* Constructor */ ?
+ var classType = declaration.kind === 158 /* Constructor */ ?
getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol))
: undefined;
var typeParameters = classType ? classType.localTypeParameters : getTypeParametersFromDeclaration(declaration);
@@ -38651,7 +39048,7 @@
var lastParamVariadicType = ts.firstDefined(lastParamTags, function (p) {
return p.typeExpression && ts.isJSDocVariadicType(p.typeExpression.type) ? p.typeExpression.type : undefined;
});
- var syntheticArgsSymbol = createSymbol(3 /* Variable */, "args", 16384 /* RestParameter */);
+ var syntheticArgsSymbol = createSymbol(3 /* Variable */, "args", 32768 /* RestParameter */);
syntheticArgsSymbol.type = lastParamVariadicType ? createArrayType(getTypeFromTypeNode(lastParamVariadicType.type)) : anyArrayType;
if (lastParamVariadicType) {
// Replace the last parameter with a rest parameter.
@@ -38684,13 +39081,13 @@
if (!node)
return false;
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return node.escapedText === "arguments" && ts.isExpressionNode(node);
- case 154 /* PropertyDeclaration */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- return node.name.kind === 149 /* ComputedPropertyName */
+ case 155 /* PropertyDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ return node.name.kind === 150 /* ComputedPropertyName */
&& traverse(node.name);
default:
return !ts.nodeStartsNewLexicalEnvironment(node) && !ts.isPartOfTypeNode(node) && !!ts.forEachChild(node, traverse);
@@ -38765,7 +39162,7 @@
function createTypePredicateFromTypePredicateNode(node, signature) {
var parameterName = node.parameterName;
var type = getTypeFromTypeNode(node.type);
- if (parameterName.kind === 72 /* Identifier */) {
+ if (parameterName.kind === 73 /* Identifier */) {
return createIdentifierTypePredicate(parameterName.escapedText, ts.findIndex(signature.parameters, function (p) { return p.escapedName === parameterName.escapedText; }), type);
}
else {
@@ -38806,7 +39203,7 @@
return signature.resolvedReturnType;
}
function getReturnTypeFromAnnotation(declaration) {
- if (declaration.kind === 157 /* Constructor */) {
+ if (declaration.kind === 158 /* Constructor */) {
return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol));
}
if (ts.isJSDocConstructSignature(declaration)) {
@@ -38816,12 +39213,12 @@
if (typeNode) {
return getTypeFromTypeNode(typeNode);
}
- if (declaration.kind === 158 /* GetAccessor */ && !hasNonBindableDynamicName(declaration)) {
+ if (declaration.kind === 159 /* GetAccessor */ && !hasNonBindableDynamicName(declaration)) {
var jsDocType = ts.isInJSFile(declaration) && getTypeForDeclarationFromJSDocComment(declaration);
if (jsDocType) {
return jsDocType;
}
- var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 159 /* SetAccessor */);
+ var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 160 /* SetAccessor */);
var setterType = getAnnotatedAccessorType(setter);
if (setterType) {
return setterType;
@@ -38846,7 +39243,7 @@
function getSignatureInstantiation(signature, typeArguments, isJavascript, inferredTypeParameters) {
var instantiatedSignature = getSignatureInstantiationWithoutFillingInTypeArguments(signature, fillMissingTypeArguments(typeArguments, signature.typeParameters, getMinTypeArgumentCount(signature.typeParameters), isJavascript));
if (inferredTypeParameters) {
- var returnSignature = getSingleCallSignature(getReturnTypeOfSignature(instantiatedSignature));
+ var returnSignature = getSingleCallOrConstructSignature(getReturnTypeOfSignature(instantiatedSignature));
if (returnSignature) {
var newReturnSignature = cloneSignature(returnSignature);
newReturnSignature.typeParameters = inferredTypeParameters;
@@ -38899,7 +39296,7 @@
var typeParameters = signature.typeParameters;
if (typeParameters) {
var typeEraser_1 = createTypeEraser(typeParameters);
- var baseConstraints = ts.map(typeParameters, function (tp) { return instantiateType(getBaseConstraintOfType(tp), typeEraser_1) || emptyObjectType; });
+ var baseConstraints = ts.map(typeParameters, function (tp) { return instantiateType(getBaseConstraintOfType(tp), typeEraser_1) || unknownType; });
return instantiateSignature(signature, createTypeMapper(typeParameters, baseConstraints), /*eraseTypeParameters*/ true);
}
return signature;
@@ -38910,7 +39307,8 @@
// object type literal or interface (using the new keyword). Each way of declaring a constructor
// will result in a different declaration kind.
if (!signature.isolatedSignatureType) {
- var isConstructor = signature.declaration.kind === 157 /* Constructor */ || signature.declaration.kind === 161 /* ConstructSignature */; // TODO: GH#18217
+ var kind = signature.declaration ? signature.declaration.kind : 0 /* Unknown */;
+ var isConstructor = kind === 158 /* Constructor */ || kind === 162 /* ConstructSignature */ || kind === 167 /* ConstructorType */;
var type = createObjectType(16 /* Anonymous */);
type.members = emptySymbols;
type.properties = ts.emptyArray;
@@ -38924,7 +39322,7 @@
return symbol.members.get("__index" /* Index */);
}
function getIndexDeclarationOfSymbol(symbol, kind) {
- var syntaxKind = kind === 1 /* Number */ ? 135 /* NumberKeyword */ : 138 /* StringKeyword */;
+ var syntaxKind = kind === 1 /* Number */ ? 136 /* NumberKeyword */ : 139 /* StringKeyword */;
var indexSymbol = getIndexSymbol(symbol);
if (indexSymbol) {
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
@@ -38951,7 +39349,7 @@
return undefined;
}
function getConstraintDeclaration(type) {
- var decl = type.symbol && ts.getDeclarationOfKind(type.symbol, 150 /* TypeParameter */);
+ var decl = type.symbol && ts.getDeclarationOfKind(type.symbol, 151 /* TypeParameter */);
return decl && ts.getEffectiveConstraintOfTypeParameter(decl);
}
function getInferredTypeParameterConstraint(typeParameter) {
@@ -38959,13 +39357,13 @@
if (typeParameter.symbol) {
for (var _i = 0, _a = typeParameter.symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.parent.kind === 176 /* InferType */) {
+ if (declaration.parent.kind === 177 /* InferType */) {
// When an 'infer T' declaration is immediately contained in a type reference node
// (such as 'Foo<infer T>'), T's constraint is inferred from the constraint of the
// corresponding type parameter in 'Foo'. When multiple 'infer T' declarations are
// present, we form an intersection of the inferred constraint types.
var grandParent = declaration.parent.parent;
- if (grandParent.kind === 164 /* TypeReference */) {
+ if (grandParent.kind === 165 /* TypeReference */) {
var typeReference = grandParent;
var typeParameters = getTypeParametersForTypeReference(typeReference);
if (typeParameters) {
@@ -38990,7 +39388,7 @@
}
// When an 'infer T' declaration is immediately contained in a rest parameter
// declaration, we infer an 'unknown[]' constraint.
- else if (grandParent.kind === 151 /* Parameter */ && grandParent.dotDotDotToken) {
+ else if (grandParent.kind === 152 /* Parameter */ && grandParent.dotDotDotToken) {
inferences = ts.append(inferences, createArrayType(unknownType));
}
}
@@ -39014,7 +39412,7 @@
return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint;
}
function getParentSymbolOfTypeParameter(typeParameter) {
- var tp = ts.getDeclarationOfKind(typeParameter.symbol, 150 /* TypeParameter */);
+ var tp = ts.getDeclarationOfKind(typeParameter.symbol, 151 /* TypeParameter */);
var host = ts.isJSDocTemplateTag(tp.parent) ? ts.getHostSignatureFromJSDoc(tp.parent) : tp.parent;
return host && getSymbolOfNode(host);
}
@@ -39147,9 +39545,9 @@
}
function getTypeReferenceName(node) {
switch (node.kind) {
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return node.typeName;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
// We only support expressions that are simple qualified names. For other
// expressions this produces undefined.
var expr = node.expression;
@@ -39248,16 +39646,22 @@
}
}
function getSubstitutionType(typeVariable, substitute) {
- if (substitute.flags & 3 /* AnyOrUnknown */) {
+ if (substitute.flags & 3 /* AnyOrUnknown */ || substitute === typeVariable) {
return typeVariable;
}
+ var id = getTypeId(typeVariable) + ">" + getTypeId(substitute);
+ var cached = substitutionTypes.get(id);
+ if (cached) {
+ return cached;
+ }
var result = createType(33554432 /* Substitution */);
result.typeVariable = typeVariable;
result.substitute = substitute;
+ substitutionTypes.set(id, result);
return result;
}
function isUnaryTupleTypeNode(node) {
- return node.kind === 170 /* TupleType */ && node.elementTypes.length === 1;
+ return node.kind === 171 /* TupleType */ && node.elementTypes.length === 1;
}
function getImpliedConstraint(typeVariable, checkNode, extendsNode) {
return isUnaryTupleTypeNode(checkNode) && isUnaryTupleTypeNode(extendsNode) ? getImpliedConstraint(typeVariable, checkNode.elementTypes[0], extendsNode.elementTypes[0]) :
@@ -39266,9 +39670,9 @@
}
function getConstrainedTypeVariable(typeVariable, node) {
var constraints;
- while (node && !ts.isStatement(node) && node.kind !== 296 /* JSDocComment */) {
+ while (node && !ts.isStatement(node) && node.kind !== 297 /* JSDocComment */) {
var parent = node.parent;
- if (parent.kind === 175 /* ConditionalType */ && node === parent.trueType) {
+ if (parent.kind === 176 /* ConditionalType */ && node === parent.trueType) {
var constraint = getImpliedConstraint(typeVariable, parent.checkType, parent.extendsType);
if (constraint) {
constraints = ts.append(constraints, constraint);
@@ -39279,7 +39683,7 @@
return constraints ? getSubstitutionType(typeVariable, getIntersectionType(ts.append(constraints, typeVariable))) : typeVariable;
}
function isJSDocTypeReference(node) {
- return !!(node.flags & 2097152 /* JSDoc */) && (node.kind === 164 /* TypeReference */ || node.kind === 183 /* ImportType */);
+ return !!(node.flags & 2097152 /* JSDoc */) && (node.kind === 165 /* TypeReference */ || node.kind === 184 /* ImportType */);
}
function checkNoTypeArguments(node, symbol) {
if (node.typeArguments) {
@@ -39380,9 +39784,9 @@
for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) {
var declaration = declarations_3[_i];
switch (declaration.kind) {
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
return declaration;
}
}
@@ -39468,11 +39872,8 @@
function getGlobalExtractSymbol() {
return deferredGlobalExtractSymbol || (deferredGlobalExtractSymbol = getGlobalSymbol("Extract", 524288 /* TypeAlias */, ts.Diagnostics.Cannot_find_global_type_0)); // TODO: GH#18217
}
- function getGlobalExcludeSymbol() {
- return deferredGlobalExcludeSymbol || (deferredGlobalExcludeSymbol = getGlobalSymbol("Exclude", 524288 /* TypeAlias */, ts.Diagnostics.Cannot_find_global_type_0)); // TODO: GH#18217
- }
- function getGlobalPickSymbol() {
- return deferredGlobalPickSymbol || (deferredGlobalPickSymbol = getGlobalSymbol("Pick", 524288 /* TypeAlias */, ts.Diagnostics.Cannot_find_global_type_0)); // TODO: GH#18217
+ function getGlobalOmitSymbol() {
+ return deferredGlobalOmitSymbol || (deferredGlobalOmitSymbol = getGlobalSymbol("Omit", 524288 /* TypeAlias */, ts.Diagnostics.Cannot_find_global_type_0)); // TODO: GH#18217
}
function getGlobalBigIntType(reportErrors) {
return deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, reportErrors)) || emptyObjectType;
@@ -39509,7 +39910,7 @@
return links.resolvedType;
}
function isReadonlyTypeOperator(node) {
- return ts.isTypeOperatorNode(node) && node.operator === 133 /* ReadonlyKeyword */;
+ return ts.isTypeOperatorNode(node) && node.operator === 134 /* ReadonlyKeyword */;
}
// We represent tuple types as type references to synthesized generic interface types created by
// this function. The types are of the form:
@@ -39584,8 +39985,8 @@
var links = getNodeLinks(node);
if (!links.resolvedType) {
var lastElement = ts.lastOrUndefined(node.elementTypes);
- var restElement_1 = lastElement && lastElement.kind === 172 /* RestType */ ? lastElement : undefined;
- var minLength = ts.findLastIndex(node.elementTypes, function (n) { return n.kind !== 171 /* OptionalType */ && n !== restElement_1; }) + 1;
+ var restElement_1 = lastElement && lastElement.kind === 173 /* RestType */ ? lastElement : undefined;
+ var minLength = ts.findLastIndex(node.elementTypes, function (n) { return n.kind !== 172 /* OptionalType */ && n !== restElement_1; }) + 1;
var elementTypes = ts.map(node.elementTypes, function (n) {
var type = getTypeFromTypeNode(n);
return n === restElement_1 && getIndexTypeOfType(type, 1 /* Number */) || type;
@@ -39972,6 +40373,14 @@
types[index] = getUnionTypeFromSortedList(result, 65536 /* PrimitiveUnion */);
return true;
}
+ function createIntersectionType(types, aliasSymbol, aliasTypeArguments) {
+ var result = createType(2097152 /* Intersection */);
+ result.objectFlags = getPropagatingFlagsOfTypes(types, /*excludeKinds*/ 98304 /* Nullable */);
+ result.types = types;
+ result.aliasSymbol = aliasSymbol; // See comment in `getUnionTypeFromSortedList`.
+ result.aliasTypeArguments = aliasTypeArguments;
+ return result;
+ }
// We normalize combinations of intersection and union types based on the distributive property of the '&'
// operator. Specifically, because X & (A | B) is equivalent to X & A | X & B, we can transform intersection
// types with union type constituents into equivalent union types with intersection type constituents and
@@ -40009,30 +40418,36 @@
if (typeSet.length === 1) {
return typeSet[0];
}
+ var id = getTypeListId(typeSet);
+ var result = intersectionTypes.get(id);
+ if (!result) {
if (includes & 1048576 /* Union */) {
if (intersectUnionsOfPrimitiveTypes(typeSet)) {
// When the intersection creates a reduced set (which might mean that *all* union types have
// disappeared), we restart the operation to get a new set of combined flags. Once we have
// reduced we'll never reduce again, so this occurs at most once.
- return getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
+ result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
}
+ else {
// We are attempting to construct a type of the form X & (A | B) & Y. Transform this into a type of
// the form X & A & Y | X & B & Y and recursively reduce until no union type constituents remain.
+ // If the estimated size of the resulting union type exceeds 100000 constituents, report an error.
+ var size = ts.reduceLeft(typeSet, function (n, t) { return n * (t.flags & 1048576 /* Union */ ? t.types.length : 1); }, 1);
+ if (size >= 100000) {
+ error(currentNode, ts.Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
+ return errorType;
+ }
var unionIndex_1 = ts.findIndex(typeSet, function (t) { return (t.flags & 1048576 /* Union */) !== 0; });
var unionType = typeSet[unionIndex_1];
- return getUnionType(ts.map(unionType.types, function (t) { return getIntersectionType(ts.replaceElement(typeSet, unionIndex_1, t)); }), 1 /* Literal */, aliasSymbol, aliasTypeArguments);
+ result = getUnionType(ts.map(unionType.types, function (t) { return getIntersectionType(ts.replaceElement(typeSet, unionIndex_1, t)); }), 1 /* Literal */, aliasSymbol, aliasTypeArguments);
}
- var id = getTypeListId(typeSet);
- var type = intersectionTypes.get(id);
- if (!type) {
- type = createType(2097152 /* Intersection */);
- intersectionTypes.set(id, type);
- type.objectFlags = getPropagatingFlagsOfTypes(typeSet, /*excludeKinds*/ 98304 /* Nullable */);
- type.types = typeSet;
- type.aliasSymbol = aliasSymbol; // See comment in `getUnionTypeFromSortedList`.
- type.aliasTypeArguments = aliasTypeArguments;
}
- return type;
+ else {
+ result = createIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
+ }
+ intersectionTypes.set(id, result);
+ }
+ return result;
}
function getTypeFromIntersectionTypeNode(node) {
var links = getNodeLinks(node);
@@ -40088,16 +40503,17 @@
var numberIndexInfo = getIndexInfoOfType(type, 1 /* Number */);
return numberIndexInfo !== enumNumberIndexInfo ? numberIndexInfo : undefined;
}
- function getIndexType(type, stringsOnly) {
+ function getIndexType(type, stringsOnly, noIndexSignatures) {
if (stringsOnly === void 0) { stringsOnly = keyofStringsOnly; }
- return type.flags & 1048576 /* Union */ ? getIntersectionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly); })) :
- type.flags & 2097152 /* Intersection */ ? getUnionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly); })) :
+ return type.flags & 1048576 /* Union */ ? getIntersectionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
+ type.flags & 2097152 /* Intersection */ ? getUnionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
maybeTypeOfKind(type, 58982400 /* InstantiableNonPrimitive */) ? getIndexTypeForGenericType(type, stringsOnly) :
- ts.getObjectFlags(type) & 32 /* Mapped */ ? getConstraintTypeFromMappedType(type) :
+ ts.getObjectFlags(type) & 32 /* Mapped */ ? filterType(getConstraintTypeFromMappedType(type), function (t) { return !(noIndexSignatures && t.flags & (1 /* Any */ | 4 /* String */)); }) :
type === wildcardType ? wildcardType :
- type.flags & 1 /* Any */ ? keyofConstraintType :
- stringsOnly ? getIndexInfoOfType(type, 0 /* String */) ? stringType : getLiteralTypeFromProperties(type, 128 /* StringLiteral */) :
- getIndexInfoOfType(type, 0 /* String */) ? getUnionType([stringType, numberType, getLiteralTypeFromProperties(type, 8192 /* UniqueESSymbol */)]) :
+ type.flags & 2 /* Unknown */ ? neverType :
+ type.flags & (1 /* Any */ | 131072 /* Never */) ? keyofConstraintType :
+ stringsOnly ? !noIndexSignatures && getIndexInfoOfType(type, 0 /* String */) ? stringType : getLiteralTypeFromProperties(type, 128 /* StringLiteral */) :
+ !noIndexSignatures && getIndexInfoOfType(type, 0 /* String */) ? getUnionType([stringType, numberType, getLiteralTypeFromProperties(type, 8192 /* UniqueESSymbol */)]) :
getNonEnumNumberIndexInfo(type) ? getUnionType([numberType, getLiteralTypeFromProperties(type, 128 /* StringLiteral */ | 8192 /* UniqueESSymbol */)]) :
getLiteralTypeFromProperties(type, 8576 /* StringOrNumberLiteralOrUnique */);
}
@@ -40116,15 +40532,15 @@
var links = getNodeLinks(node);
if (!links.resolvedType) {
switch (node.operator) {
- case 129 /* KeyOfKeyword */:
+ case 130 /* KeyOfKeyword */:
links.resolvedType = getIndexType(getTypeFromTypeNode(node.type));
break;
- case 142 /* UniqueKeyword */:
- links.resolvedType = node.type.kind === 139 /* SymbolKeyword */
+ case 143 /* UniqueKeyword */:
+ links.resolvedType = node.type.kind === 140 /* SymbolKeyword */
? getESSymbolLikeTypeForNode(ts.walkUpParenthesizedTypes(node.parent))
: errorType;
break;
- case 133 /* ReadonlyKeyword */:
+ case 134 /* ReadonlyKeyword */:
links.resolvedType = getTypeFromTypeNode(node.type);
break;
}
@@ -40164,8 +40580,8 @@
}
return false;
}
- function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol, missingType) {
- var accessExpression = accessNode && accessNode.kind === 190 /* ElementAccessExpression */ ? accessNode : undefined;
+ function getPropertyTypeForIndexType(originalObjectType, objectType, indexType, fullIndexType, suppressNoImplicitAnyError, accessNode, accessFlags) {
+ var accessExpression = accessNode && accessNode.kind === 191 /* ElementAccessExpression */ ? accessNode : undefined;
var propName = isTypeUsableAsPropertyName(indexType) ?
getPropertyNameFromType(indexType) :
accessExpression && checkThatExpressionIsProperSymbolReference(accessExpression.argumentExpression, indexType, /*reportError*/ false) ?
@@ -40178,12 +40594,12 @@
var prop = getPropertyOfType(objectType, propName);
if (prop) {
if (accessExpression) {
- markPropertyAsReferenced(prop, accessExpression, /*isThisAccess*/ accessExpression.expression.kind === 100 /* ThisKeyword */);
+ markPropertyAsReferenced(prop, accessExpression, /*isThisAccess*/ accessExpression.expression.kind === 101 /* ThisKeyword */);
if (ts.isAssignmentTarget(accessExpression) && (isReferenceToReadonlyEntity(accessExpression, prop) || isReferenceThroughNamespaceImport(accessExpression))) {
error(accessExpression.argumentExpression, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, symbolToString(prop));
- return missingType;
+ return undefined;
}
- if (cacheSymbol) {
+ if (accessFlags & 4 /* CacheSymbol */) {
getNodeLinks(accessNode).resolvedSymbol = prop;
}
}
@@ -40202,6 +40618,7 @@
error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.unescapeLeadingUnderscores(propName), typeToString(objectType));
}
}
+ errorIfWritingToReadonlyIndex(getIndexInfoOfType(objectType, 1 /* Number */));
return mapType(objectType, function (t) { return getRestTypeOfTupleType(t) || undefinedType; });
}
}
@@ -40209,17 +40626,21 @@
if (objectType.flags & (1 /* Any */ | 131072 /* Never */)) {
return objectType;
}
- var indexInfo = isTypeAssignableToKind(indexType, 296 /* NumberLike */) && getIndexInfoOfType(objectType, 1 /* Number */) ||
- getIndexInfoOfType(objectType, 0 /* String */) ||
- undefined;
+ var stringIndexInfo = getIndexInfoOfType(objectType, 0 /* String */);
+ var indexInfo = isTypeAssignableToKind(indexType, 296 /* NumberLike */) && getIndexInfoOfType(objectType, 1 /* Number */) || stringIndexInfo;
if (indexInfo) {
+ if (accessFlags & 1 /* NoIndexSignatures */ && indexInfo === stringIndexInfo) {
+ if (accessExpression) {
+ error(accessExpression, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(originalObjectType));
+ }
+ return undefined;
+ }
if (accessNode && !isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
var indexNode = getIndexNodeForAccessExpression(accessNode);
error(indexNode, ts.Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType));
+ return indexInfo.type;
}
- else if (accessExpression && indexInfo.isReadonly && (ts.isAssignmentTarget(accessExpression) || ts.isDeleteTarget(accessExpression))) {
- error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
- }
+ errorIfWritingToReadonlyIndex(indexInfo);
return indexInfo.type;
}
if (indexType.flags & 131072 /* Never */) {
@@ -40232,7 +40653,7 @@
if (objectType.symbol === globalThisSymbol && propName !== undefined && globalThisSymbol.exports.has(propName) && (globalThisSymbol.exports.get(propName).flags & 418 /* BlockScoped */)) {
error(accessExpression, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.unescapeLeadingUnderscores(propName), typeToString(objectType));
}
- else if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors) {
+ else if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors && !suppressNoImplicitAnyError) {
if (propName !== undefined && typeHasStaticProperty(propName, objectType)) {
error(accessExpression, ts.Diagnostics.Property_0_is_a_static_member_of_type_1, propName, typeToString(objectType));
}
@@ -40247,11 +40668,35 @@
}
}
else {
- error(accessExpression, ts.Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature, typeToString(objectType));
+ var suggestion_1 = getSuggestionForNonexistentIndexSignature(objectType, accessExpression);
+ if (suggestion_1 !== undefined) {
+ error(accessExpression, ts.Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1, typeToString(objectType), suggestion_1);
+ }
+ else {
+ var errorInfo = void 0;
+ if (indexType.flags & 1024 /* EnumLiteral */) {
+ errorInfo = ts.chainDiagnosticMessages(/* details */ undefined, ts.Diagnostics.Property_0_does_not_exist_on_type_1, "[" + typeToString(indexType) + "]", typeToString(objectType));
+ }
+ else if (indexType.flags & 8192 /* UniqueESSymbol */) {
+ var symbolName_2 = getFullyQualifiedName(indexType.symbol, accessExpression);
+ errorInfo = ts.chainDiagnosticMessages(/* details */ undefined, ts.Diagnostics.Property_0_does_not_exist_on_type_1, "[" + symbolName_2 + "]", typeToString(objectType));
+ }
+ else if (indexType.flags & 128 /* StringLiteral */) {
+ errorInfo = ts.chainDiagnosticMessages(/* details */ undefined, ts.Diagnostics.Property_0_does_not_exist_on_type_1, indexType.value, typeToString(objectType));
+ }
+ else if (indexType.flags & 256 /* NumberLiteral */) {
+ errorInfo = ts.chainDiagnosticMessages(/* details */ undefined, ts.Diagnostics.Property_0_does_not_exist_on_type_1, indexType.value, typeToString(objectType));
+ }
+ else if (indexType.flags & (8 /* Number */ | 4 /* String */)) {
+ errorInfo = ts.chainDiagnosticMessages(/* details */ undefined, ts.Diagnostics.No_index_signature_with_a_parameter_of_type_0_was_found_on_type_1, typeToString(indexType), typeToString(objectType));
}
+ errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1, typeToString(fullIndexType), typeToString(objectType));
+ diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(accessExpression, errorInfo));
}
}
- return missingType;
+ }
+ }
+ return undefined;
}
}
if (isJSLiteralType(objectType)) {
@@ -40272,14 +40717,19 @@
if (isTypeAny(indexType)) {
return indexType;
}
- return missingType;
+ return undefined;
+ function errorIfWritingToReadonlyIndex(indexInfo) {
+ if (indexInfo && indexInfo.isReadonly && accessExpression && (ts.isAssignmentTarget(accessExpression) || ts.isDeleteTarget(accessExpression))) {
+ error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
+ }
+ }
}
function getIndexNodeForAccessExpression(accessNode) {
- return accessNode.kind === 190 /* ElementAccessExpression */
+ return accessNode.kind === 191 /* ElementAccessExpression */
? accessNode.argumentExpression
- : accessNode.kind === 180 /* IndexedAccessType */
+ : accessNode.kind === 181 /* IndexedAccessType */
? accessNode.indexType
- : accessNode.kind === 149 /* ComputedPropertyName */
+ : accessNode.kind === 150 /* ComputedPropertyName */
? accessNode.expression
: accessNode;
}
@@ -40289,67 +40739,124 @@
function isGenericIndexType(type) {
return maybeTypeOfKind(type, 58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */);
}
- function getSimplifiedType(type) {
- return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type) : type;
+ function isThisTypeParameter(type) {
+ return !!(type.flags & 262144 /* TypeParameter */ && type.isThisType);
}
- function distributeIndexOverObjectType(objectType, indexType) {
- // (T | U)[K] -> T[K] | U[K]
- if (objectType.flags & 1048576 /* Union */) {
- return mapType(objectType, function (t) { return getSimplifiedType(getIndexedAccessType(t, indexType)); });
+ function getSimplifiedType(type, writing) {
+ return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) :
+ type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) :
+ type;
}
+ function distributeIndexOverObjectType(objectType, indexType, writing) {
+ // (T | U)[K] -> T[K] | U[K] (reading)
+ // (T | U)[K] -> T[K] & U[K] (writing)
// (T & U)[K] -> T[K] & U[K]
- if (objectType.flags & 2097152 /* Intersection */) {
- return getIntersectionType(ts.map(objectType.types, function (t) { return getSimplifiedType(getIndexedAccessType(t, indexType)); }));
+ if (objectType.flags & 3145728 /* UnionOrIntersection */) {
+ var types = ts.map(objectType.types, function (t) { return getSimplifiedType(getIndexedAccessType(t, indexType), writing); });
+ return objectType.flags & 2097152 /* Intersection */ || writing ? getIntersectionType(types) : getUnionType(types);
+ }
+ }
+ function distributeObjectOverIndexType(objectType, indexType, writing) {
+ // T[A | B] -> T[A] | T[B] (reading)
+ // T[A | B] -> T[A] & T[B] (writing)
+ if (indexType.flags & 1048576 /* Union */) {
+ var types = ts.map(indexType.types, function (t) { return getSimplifiedType(getIndexedAccessType(objectType, t), writing); });
+ return writing ? getIntersectionType(types) : getUnionType(types);
}
}
// Transform an indexed access to a simpler form, if possible. Return the simpler form, or return
- // the type itself if no transformation is possible.
- function getSimplifiedIndexedAccessType(type) {
- if (type.simplified) {
- return type.simplified === circularConstraintType ? type : type.simplified;
+ // the type itself if no transformation is possible. The writing flag indicates that the type is
+ // the target of an assignment.
+ function getSimplifiedIndexedAccessType(type, writing) {
+ var cache = writing ? "simplifiedForWriting" : "simplifiedForReading";
+ if (type[cache]) {
+ return type[cache] === circularConstraintType ? type : type[cache];
}
- type.simplified = circularConstraintType;
+ type[cache] = circularConstraintType;
// We recursively simplify the object type as it may in turn be an indexed access type. For example, with
// '{ [P in T]: { [Q in U]: number } }[T][U]' we want to first simplify the inner indexed access type.
- var objectType = getSimplifiedType(type.objectType);
- var indexType = getSimplifiedType(type.indexType);
- // T[A | B] -> T[A] | T[B]
- if (indexType.flags & 1048576 /* Union */) {
- return type.simplified = mapType(indexType, function (t) { return getSimplifiedType(getIndexedAccessType(objectType, t)); });
+ var objectType = getSimplifiedType(type.objectType, writing);
+ var indexType = getSimplifiedType(type.indexType, writing);
+ // T[A | B] -> T[A] | T[B] (reading)
+ // T[A | B] -> T[A] & T[B] (writing)
+ var distributedOverIndex = distributeObjectOverIndexType(objectType, indexType, writing);
+ if (distributedOverIndex) {
+ return type[cache] = distributedOverIndex;
}
// Only do the inner distributions if the index can no longer be instantiated to cause index distribution again
if (!(indexType.flags & 63176704 /* Instantiable */)) {
- var simplified = distributeIndexOverObjectType(objectType, indexType);
- if (simplified) {
- return type.simplified = simplified;
+ // (T | U)[K] -> T[K] | U[K] (reading)
+ // (T | U)[K] -> T[K] & U[K] (writing)
+ // (T & U)[K] -> T[K] & U[K]
+ var distributedOverObject = distributeIndexOverObjectType(objectType, indexType, writing);
+ if (distributedOverObject) {
+ return type[cache] = distributedOverObject;
}
}
- // So ultimately:
+ // So ultimately (reading):
// ((A & B) | C)[K1 | K2] -> ((A & B) | C)[K1] | ((A & B) | C)[K2] -> (A & B)[K1] | C[K1] | (A & B)[K2] | C[K2] -> (A[K1] & B[K1]) | C[K1] | (A[K2] & B[K2]) | C[K2]
// If the object type is a mapped type { [P in K]: E }, where K is generic, instantiate E using a mapper
// that substitutes the index type for P. For example, for an index access { [P in K]: Box<T[P]> }[X], we
// construct the type Box<T[X]>.
if (isGenericMappedType(objectType)) {
- return type.simplified = mapType(substituteIndexedMappedType(objectType, type.indexType), getSimplifiedType);
+ return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), function (t) { return getSimplifiedType(t, writing); });
}
- return type.simplified = type;
+ return type[cache] = type;
+ }
+ function getSimplifiedConditionalType(type, writing) {
+ var checkType = type.checkType;
+ var extendsType = type.extendsType;
+ var trueType = getTrueTypeFromConditionalType(type);
+ var falseType = getFalseTypeFromConditionalType(type);
+ // Simplifications for types of the form `T extends U ? T : never` and `T extends U ? never : T`.
+ if (falseType.flags & 131072 /* Never */ && getActualTypeVariable(trueType) === getActualTypeVariable(checkType)) {
+ if (checkType.flags & 1 /* Any */ || isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { // Always true
+ return getSimplifiedType(trueType, writing);
+ }
+ else if (isIntersectionEmpty(checkType, extendsType)) { // Always false
+ return neverType;
+ }
+ }
+ else if (trueType.flags & 131072 /* Never */ && getActualTypeVariable(falseType) === getActualTypeVariable(checkType)) {
+ if (!(checkType.flags & 1 /* Any */) && isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { // Always true
+ return neverType;
+ }
+ else if (checkType.flags & 1 /* Any */ || isIntersectionEmpty(checkType, extendsType)) { // Always false
+ return getSimplifiedType(falseType, writing);
+ }
+ }
+ return type;
+ }
+ /**
+ * Invokes union simplification logic to determine if an intersection is considered empty as a union constituent
+ */
+ function isIntersectionEmpty(type1, type2) {
+ return !!(getUnionType([intersectTypes(type1, type2), neverType]).flags & 131072 /* Never */);
}
function substituteIndexedMappedType(objectType, index) {
var mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [index]);
var templateMapper = combineTypeMappers(objectType.mapper, mapper);
return instantiateType(getTemplateTypeFromMappedType(objectType), templateMapper);
}
- function getIndexedAccessType(objectType, indexType, accessNode, missingType) {
- if (missingType === void 0) { missingType = accessNode ? errorType : unknownType; }
+ function getIndexedAccessType(objectType, indexType, accessNode) {
+ return getIndexedAccessTypeOrUndefined(objectType, indexType, accessNode, 0 /* None */) || (accessNode ? errorType : unknownType);
+ }
+ function getIndexedAccessTypeOrUndefined(objectType, indexType, accessNode, accessFlags) {
+ if (accessFlags === void 0) { accessFlags = 0 /* None */; }
if (objectType === wildcardType || indexType === wildcardType) {
return wildcardType;
}
+ // If the object type has a string index signature and no other members we know that the result will
+ // always be the type of that index signature and we can simplify accordingly.
+ if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
+ indexType = stringType;
+ }
// If the index type is generic, or if the object type is generic and doesn't originate in an expression,
// we are performing a higher-order index access where we cannot meaningfully access the properties of the
// object type. Note that for a generic T and a non-generic K, we eagerly resolve T[K] if it originates in
// an expression. This is to preserve backwards compatibility. For example, an element access 'this["foo"]'
// has always been resolved eagerly using the constraint type of 'this' at the given location.
- if (isGenericIndexType(indexType) || !(accessNode && accessNode.kind !== 180 /* IndexedAccessType */) && isGenericObjectType(objectType)) {
+ if (isGenericIndexType(indexType) || !(accessNode && accessNode.kind !== 181 /* IndexedAccessType */) && isGenericObjectType(objectType)) {
if (objectType.flags & 3 /* AnyOrUnknown */) {
return objectType;
}
@@ -40370,25 +40877,25 @@
var wasMissingProp = false;
for (var _i = 0, _a = indexType.types; _i < _a.length; _i++) {
var t = _a[_i];
- var propType = getPropertyTypeForIndexType(apparentObjectType, t, accessNode, /*cacheSymbol*/ false, missingType);
- if (propType === missingType) {
- if (!accessNode) {
+ var propType = getPropertyTypeForIndexType(objectType, apparentObjectType, t, indexType, wasMissingProp, accessNode, accessFlags);
+ if (propType) {
+ propTypes.push(propType);
+ }
+ else if (!accessNode) {
// If there's no error node, we can immeditely stop, since error reporting is off
- return missingType;
+ return undefined;
}
else {
// Otherwise we set a flag and return at the end of the loop so we still mark all errors
wasMissingProp = true;
}
}
- propTypes.push(propType);
- }
if (wasMissingProp) {
- return missingType;
+ return undefined;
}
- return getUnionType(propTypes);
+ return accessFlags & 2 /* Writing */ ? getIntersectionType(propTypes) : getUnionType(propTypes);
}
- return getPropertyTypeForIndexType(apparentObjectType, indexType, accessNode, /*cacheSymbol*/ true, missingType);
+ return getPropertyTypeForIndexType(objectType, apparentObjectType, indexType, indexType, /* supressNoImplicitAnyError */ false, accessNode, accessFlags | 4 /* CacheSymbol */);
}
function getTypeFromIndexedAccessTypeNode(node) {
var links = getNodeLinks(node);
@@ -40418,13 +40925,14 @@
return links.resolvedType;
}
function getActualTypeVariable(type) {
- return type.flags & 33554432 /* Substitution */ ? type.typeVariable : type;
+ if (type.flags & 33554432 /* Substitution */) {
+ return type.typeVariable;
}
- /**
- * Invokes union simplification logic to determine if an intersection is considered empty as a union constituent
- */
- function isIntersectionEmpty(type1, type2) {
- return !!(getUnionType([intersectTypes(type1, type2), neverType]).flags & 131072 /* Never */);
+ if (type.flags & 8388608 /* IndexedAccess */ && (type.objectType.flags & 33554432 /* Substitution */ ||
+ type.indexType.flags & 33554432 /* Substitution */)) {
+ return getIndexedAccessType(getActualTypeVariable(type.objectType), getActualTypeVariable(type.indexType));
+ }
+ return type;
}
function getConditionalType(root, mapper) {
var checkType = instantiateType(root.checkType, mapper);
@@ -40432,35 +40940,6 @@
if (checkType === wildcardType || extendsType === wildcardType) {
return wildcardType;
}
- var trueType = instantiateType(root.trueType, mapper);
- var falseType = instantiateType(root.falseType, mapper);
- var instantiationId = "" + (root.isDistributive ? "d" : "") + getTypeId(checkType) + ">" + getTypeId(extendsType) + "?" + getTypeId(trueType) + ":" + getTypeId(falseType);
- var result = conditionalTypes.get(instantiationId);
- if (result) {
- return result;
- }
- var newResult = getConditionalTypeWorker(root, mapper, checkType, extendsType, trueType, falseType);
- conditionalTypes.set(instantiationId, newResult);
- return newResult;
- }
- function getConditionalTypeWorker(root, mapper, checkType, extendsType, trueType, falseType) {
- // Simplifications for types of the form `T extends U ? T : never` and `T extends U ? never : T`.
- if (falseType.flags & 131072 /* Never */ && getActualTypeVariable(trueType) === getActualTypeVariable(checkType)) {
- if (checkType.flags & 1 /* Any */ || isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { // Always true
- return trueType;
- }
- else if (isIntersectionEmpty(checkType, extendsType)) { // Always false
- return neverType;
- }
- }
- else if (trueType.flags & 131072 /* Never */ && getActualTypeVariable(falseType) === getActualTypeVariable(checkType)) {
- if (!(checkType.flags & 1 /* Any */) && isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { // Always true
- return neverType;
- }
- else if (checkType.flags & 1 /* Any */ || isIntersectionEmpty(checkType, extendsType)) { // Always false
- return falseType;
- }
- }
var checkTypeInstantiable = maybeTypeOfKind(checkType, 63176704 /* Instantiable */ | 131072 /* GenericMappedType */);
var combinedMapper;
if (root.inferTypeParameters) {
@@ -40469,7 +40948,7 @@
// We don't want inferences from constraints as they may cause us to eagerly resolve the
// conditional type instead of deferring resolution. Also, we always want strict function
// types rules (i.e. proper contravariance) for inferences.
- inferTypes(context.inferences, checkType, extendsType, 32 /* NoConstraints */ | 64 /* AlwaysStrict */);
+ inferTypes(context.inferences, checkType, extendsType, 64 /* NoConstraints */ | 128 /* AlwaysStrict */);
}
combinedMapper = combineTypeMappers(mapper, context.mapper);
}
@@ -40478,18 +40957,18 @@
// We attempt to resolve the conditional type only when the check and extends types are non-generic
if (!checkTypeInstantiable && !maybeTypeOfKind(inferredExtendsType, 63176704 /* Instantiable */ | 131072 /* GenericMappedType */)) {
if (inferredExtendsType.flags & 3 /* AnyOrUnknown */) {
- return trueType;
+ return instantiateType(root.trueType, combinedMapper || mapper);
}
// Return union of trueType and falseType for 'any' since it matches anything
if (checkType.flags & 1 /* Any */) {
- return getUnionType([instantiateType(root.trueType, combinedMapper || mapper), falseType]);
+ return getUnionType([instantiateType(root.trueType, combinedMapper || mapper), instantiateType(root.falseType, mapper)]);
}
// Return falseType for a definitely false extends check. We check an instantiations of the two
// types with type parameters mapped to the wildcard type, the most permissive instantiations
// possible (the wildcard type is assignable to and from all types). If those are not related,
// then no instantiations will be and we can just return the false branch type.
if (!isTypeAssignableTo(getPermissiveInstantiation(checkType), getPermissiveInstantiation(inferredExtendsType))) {
- return falseType;
+ return instantiateType(root.falseType, mapper);
}
// Return trueType for a definitely true extends check. We check instantiations of the two
// types with type parameters mapped to their restrictive form, i.e. a form of the type parameter
@@ -40501,9 +40980,6 @@
}
}
// Return a deferred type for a check that is neither definitely true nor definitely false
- return getDeferredConditionalType(root, mapper, combinedMapper, checkType, extendsType, trueType, falseType);
- }
- function getDeferredConditionalType(root, mapper, combinedMapper, checkType, extendsType, trueType, falseType) {
var erasedCheckType = getActualTypeVariable(checkType);
var result = createType(16777216 /* Conditional */);
result.root = root;
@@ -40511,14 +40987,18 @@
result.extendsType = extendsType;
result.mapper = mapper;
result.combinedMapper = combinedMapper;
- result.trueType = trueType;
- result.falseType = falseType;
result.aliasSymbol = root.aliasSymbol;
result.aliasTypeArguments = instantiateTypes(root.aliasTypeArguments, mapper); // TODO: GH#18217
return result;
}
+ function getTrueTypeFromConditionalType(type) {
+ return type.resolvedTrueType || (type.resolvedTrueType = instantiateType(type.root.trueType, type.mapper));
+ }
+ function getFalseTypeFromConditionalType(type) {
+ return type.resolvedFalseType || (type.resolvedFalseType = instantiateType(type.root.falseType, type.mapper));
+ }
function getInferredTrueTypeFromConditionalType(type) {
- return type.resolvedInferredTrueType || (type.resolvedInferredTrueType = instantiateType(type.root.trueType, type.combinedMapper || type.mapper));
+ return type.resolvedInferredTrueType || (type.resolvedInferredTrueType = type.combinedMapper ? instantiateType(type.root.trueType, type.combinedMapper) : getTrueTypeFromConditionalType(type));
}
function getInferTypeParameters(node) {
var result;
@@ -40531,20 +41011,6 @@
}
return result;
}
- function isPossiblyReferencedInConditionalType(tp, node) {
- if (isTypeParameterPossiblyReferenced(tp, node)) {
- return true;
- }
- while (node) {
- if (node.kind === 175 /* ConditionalType */) {
- if (isTypeParameterPossiblyReferenced(tp, node.extendsType)) {
- return true;
- }
- }
- node = node.parent;
- }
- return false;
- }
function getTypeFromConditionalTypeNode(node) {
var links = getNodeLinks(node);
if (!links.resolvedType) {
@@ -40552,7 +41018,7 @@
var aliasSymbol = getAliasSymbolForTypeNode(node);
var aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol);
var allOuterTypeParameters = getOuterTypeParameters(node, /*includeThisTypes*/ true);
- var outerTypeParameters = aliasTypeArguments ? allOuterTypeParameters : ts.filter(allOuterTypeParameters, function (tp) { return isPossiblyReferencedInConditionalType(tp, node); });
+ var outerTypeParameters = aliasTypeArguments ? allOuterTypeParameters : ts.filter(allOuterTypeParameters, function (tp) { return isTypeParameterPossiblyReferenced(tp, node); });
var root = {
node: node,
checkType: checkType,
@@ -40863,9 +41329,9 @@
function getThisType(node) {
var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false);
var parent = container && container.parent;
- if (parent && (ts.isClassLike(parent) || parent.kind === 241 /* InterfaceDeclaration */)) {
+ if (parent && (ts.isClassLike(parent) || parent.kind === 242 /* InterfaceDeclaration */)) {
if (!ts.hasModifier(container, 32 /* Static */) &&
- (container.kind !== 157 /* Constructor */ || ts.isNodeDescendantOf(node, container.body))) {
+ (container.kind !== 158 /* Constructor */ || ts.isNodeDescendantOf(node, container.body))) {
return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType;
}
}
@@ -40881,89 +41347,89 @@
}
function getTypeFromTypeNode(node) {
switch (node.kind) {
- case 120 /* AnyKeyword */:
- case 289 /* JSDocAllType */:
- case 290 /* JSDocUnknownType */:
+ case 121 /* AnyKeyword */:
+ case 290 /* JSDocAllType */:
+ case 291 /* JSDocUnknownType */:
return anyType;
- case 143 /* UnknownKeyword */:
+ case 144 /* UnknownKeyword */:
return unknownType;
- case 138 /* StringKeyword */:
+ case 139 /* StringKeyword */:
return stringType;
- case 135 /* NumberKeyword */:
+ case 136 /* NumberKeyword */:
return numberType;
- case 146 /* BigIntKeyword */:
+ case 147 /* BigIntKeyword */:
return bigintType;
- case 123 /* BooleanKeyword */:
+ case 124 /* BooleanKeyword */:
return booleanType;
- case 139 /* SymbolKeyword */:
+ case 140 /* SymbolKeyword */:
return esSymbolType;
- case 106 /* VoidKeyword */:
+ case 107 /* VoidKeyword */:
return voidType;
- case 141 /* UndefinedKeyword */:
+ case 142 /* UndefinedKeyword */:
return undefinedType;
- case 96 /* NullKeyword */:
+ case 97 /* NullKeyword */:
return nullType;
- case 132 /* NeverKeyword */:
+ case 133 /* NeverKeyword */:
return neverType;
- case 136 /* ObjectKeyword */:
+ case 137 /* ObjectKeyword */:
return node.flags & 65536 /* JavaScriptFile */ ? anyType : nonPrimitiveType;
- case 178 /* ThisType */:
- case 100 /* ThisKeyword */:
+ case 179 /* ThisType */:
+ case 101 /* ThisKeyword */:
return getTypeFromThisTypeNode(node);
- case 182 /* LiteralType */:
+ case 183 /* LiteralType */:
return getTypeFromLiteralTypeNode(node);
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return getTypeFromTypeReference(node);
- case 163 /* TypePredicate */:
+ case 164 /* TypePredicate */:
return booleanType;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return getTypeFromTypeReference(node);
- case 167 /* TypeQuery */:
+ case 168 /* TypeQuery */:
return getTypeFromTypeQueryNode(node);
- case 169 /* ArrayType */:
+ case 170 /* ArrayType */:
return getTypeFromArrayTypeNode(node);
- case 170 /* TupleType */:
+ case 171 /* TupleType */:
return getTypeFromTupleTypeNode(node);
- case 171 /* OptionalType */:
+ case 172 /* OptionalType */:
return getTypeFromOptionalTypeNode(node);
- case 173 /* UnionType */:
+ case 174 /* UnionType */:
return getTypeFromUnionTypeNode(node);
- case 174 /* IntersectionType */:
+ case 175 /* IntersectionType */:
return getTypeFromIntersectionTypeNode(node);
- case 291 /* JSDocNullableType */:
+ case 292 /* JSDocNullableType */:
return getTypeFromJSDocNullableTypeNode(node);
- case 293 /* JSDocOptionalType */:
+ case 294 /* JSDocOptionalType */:
return addOptionality(getTypeFromTypeNode(node.type));
- case 177 /* ParenthesizedType */:
- case 172 /* RestType */:
- case 292 /* JSDocNonNullableType */:
- case 288 /* JSDocTypeExpression */:
+ case 178 /* ParenthesizedType */:
+ case 173 /* RestType */:
+ case 293 /* JSDocNonNullableType */:
+ case 289 /* JSDocTypeExpression */:
return getTypeFromTypeNode(node.type);
- case 295 /* JSDocVariadicType */:
+ case 296 /* JSDocVariadicType */:
return getTypeFromJSDocVariadicType(node);
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 168 /* TypeLiteral */:
- case 297 /* JSDocTypeLiteral */:
- case 294 /* JSDocFunctionType */:
- case 298 /* JSDocSignature */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 169 /* TypeLiteral */:
+ case 298 /* JSDocTypeLiteral */:
+ case 295 /* JSDocFunctionType */:
+ case 299 /* JSDocSignature */:
return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node);
- case 179 /* TypeOperator */:
+ case 180 /* TypeOperator */:
return getTypeFromTypeOperatorNode(node);
- case 180 /* IndexedAccessType */:
+ case 181 /* IndexedAccessType */:
return getTypeFromIndexedAccessTypeNode(node);
- case 181 /* MappedType */:
+ case 182 /* MappedType */:
return getTypeFromMappedTypeNode(node);
- case 175 /* ConditionalType */:
+ case 176 /* ConditionalType */:
return getTypeFromConditionalTypeNode(node);
- case 176 /* InferType */:
+ case 177 /* InferType */:
return getTypeFromInferTypeNode(node);
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return getTypeFromImportTypeNode(node);
// This function assumes that an identifier or qualified name is a type expression
// Callers should first ensure this by calling isTypeNode
- case 72 /* Identifier */:
- case 148 /* QualifiedName */:
+ case 73 /* Identifier */:
+ case 149 /* QualifiedName */:
var symbol = getSymbolAtLocation(node);
return symbol ? getDeclaredTypeOfSymbol(symbol) : errorType;
default:
@@ -41023,7 +41489,7 @@
* This is used during inference when instantiating type parameter defaults.
*/
function createBackreferenceMapper(context, index) {
- return function (t) { return ts.findIndex(context.inferences, function (info) { return info.typeParameter === t; }) >= index ? emptyObjectType : t; };
+ return function (t) { return ts.findIndex(context.inferences, function (info) { return info.typeParameter === t; }) >= index ? unknownType : t; };
}
function combineTypeMappers(mapper1, mapper2) {
if (!mapper1)
@@ -41106,7 +41572,7 @@
}
// Keep the flags from the symbol we're instantiating. Mark that is instantiated, and
// also transient so that we can just store data on it directly.
- var result = createSymbol(symbol.flags, symbol.escapedName, 1 /* Instantiated */ | ts.getCheckFlags(symbol) & (8 /* Readonly */ | 2048 /* Late */ | 8192 /* OptionalParameter */ | 16384 /* RestParameter */));
+ var result = createSymbol(symbol.flags, symbol.escapedName, 1 /* Instantiated */ | ts.getCheckFlags(symbol) & (8 /* Readonly */ | 4096 /* Late */ | 16384 /* OptionalParameter */ | 32768 /* RestParameter */));
result.declarations = symbol.declarations;
result.parent = symbol.parent;
result.target = symbol;
@@ -41172,28 +41638,31 @@
return type;
}
function maybeTypeParameterReference(node) {
- return !(node.kind === 148 /* QualifiedName */ ||
- node.parent.kind === 164 /* TypeReference */ && node.parent.typeArguments && node === node.parent.typeName);
+ return !(node.kind === 149 /* QualifiedName */ ||
+ node.parent.kind === 165 /* TypeReference */ && node.parent.typeArguments && node === node.parent.typeName);
}
function isTypeParameterPossiblyReferenced(tp, node) {
// If the type parameter doesn't have exactly one declaration, if there are invening statement blocks
// between the node and the type parameter declaration, if the node contains actual references to the
// type parameter, or if the node contains type queries, we consider the type parameter possibly referenced.
if (tp.symbol && tp.symbol.declarations && tp.symbol.declarations.length === 1) {
- var container_3 = tp.symbol.declarations[0].parent;
- if (ts.findAncestor(node, function (n) { return n.kind === 218 /* Block */ ? "quit" : n === container_3; })) {
- return !!ts.forEachChild(node, containsReference);
+ var container = tp.symbol.declarations[0].parent;
+ for (var n = node; n !== container; n = n.parent) {
+ if (!n || n.kind === 219 /* Block */ || n.kind === 176 /* ConditionalType */ && ts.forEachChild(n.extendsType, containsReference)) {
+ return true;
}
}
+ return !!ts.forEachChild(node, containsReference);
+ }
return true;
function containsReference(node) {
switch (node.kind) {
- case 178 /* ThisType */:
+ case 179 /* ThisType */:
return !!tp.isThisType;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return !tp.isThisType && ts.isPartOfTypeNode(node) && maybeTypeParameterReference(node) &&
getTypeFromTypeNode(node) === tp;
- case 167 /* TypeQuery */:
+ case 168 /* TypeQuery */:
return true;
}
return !!ts.forEachChild(node, containsReference);
@@ -41341,7 +41810,7 @@
// If the anonymous type originates in a declaration of a function, method, class, or
// interface, in an object type literal, or in an object literal expression, we may need
// to instantiate the type because it might reference a type parameter.
- return type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations ?
+ return couldContainTypeVariables(type) ?
getAnonymousTypeInstantiation(type, mapper) : type;
}
if (objectFlags & 32 /* Mapped */) {
@@ -41380,7 +41849,7 @@
}
else {
var sub = instantiateType(type.substitute, mapper);
- if (sub.flags & 3 /* AnyOrUnknown */ || isTypeSubtypeOf(getRestrictiveInstantiation(maybeVariable), getRestrictiveInstantiation(sub))) {
+ if (sub.flags & 3 /* AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(maybeVariable), getRestrictiveInstantiation(sub))) {
return maybeVariable;
}
return sub;
@@ -41414,34 +41883,34 @@
// Returns true if the given expression contains (at any level of nesting) a function or arrow expression
// that is subject to contextual typing.
function isContextSensitive(node) {
- ts.Debug.assert(node.kind !== 156 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
+ ts.Debug.assert(node.kind !== 157 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
switch (node.kind) {
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 156 /* MethodDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
return isContextSensitiveFunctionLikeDeclaration(node);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return ts.some(node.properties, isContextSensitive);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return ts.some(node.elements, isContextSensitive);
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return isContextSensitive(node.whenTrue) ||
isContextSensitive(node.whenFalse);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return node.operatorToken.kind === 55 /* BarBarToken */ &&
(isContextSensitive(node.left) || isContextSensitive(node.right));
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return isContextSensitive(node.initializer);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return isContextSensitive(node.expression);
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
return ts.some(node.properties, isContextSensitive) || ts.isJsxOpeningElement(node.parent) && ts.some(node.parent.parent.children, isContextSensitive);
- case 267 /* JsxAttribute */: {
+ case 268 /* JsxAttribute */: {
// If there is no initializer, JSX attribute has a boolean value of true which is not context sensitive.
var initializer = node.initializer;
return !!initializer && isContextSensitive(initializer);
}
- case 270 /* JsxExpression */: {
+ case 271 /* JsxExpression */: {
// It is possible to that node.expression is undefined (e.g <div x={} />)
var expression = node.expression;
return !!expression && isContextSensitive(expression);
@@ -41458,7 +41927,7 @@
if (ts.some(node.parameters, function (p) { return !ts.getEffectiveTypeAnnotationNode(p); })) {
return true;
}
- if (node.kind !== 197 /* ArrowFunction */) {
+ if (node.kind !== 198 /* ArrowFunction */) {
// If the first parameter is not an explicit 'this' parameter, then the function has
// an implicit 'this' parameter which is subject to contextual typing.
var parameter = ts.firstOrUndefined(node.parameters);
@@ -41470,7 +41939,7 @@
}
function hasContextSensitiveReturnExpression(node) {
// TODO(anhans): A block should be context-sensitive if it has a context-sensitive return value.
- return !!node.body && node.body.kind !== 218 /* Block */ && isContextSensitive(node.body);
+ return !!node.body && node.body.kind !== 219 /* Block */ && isContextSensitive(node.body);
}
function isContextSensitiveFunctionOrObjectLiteralMethod(func) {
return (ts.isInJSFile(func) && ts.isFunctionDeclaration(func) || isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) &&
@@ -41523,7 +41992,7 @@
function isTypeDerivedFrom(source, target) {
return source.flags & 1048576 /* Union */ ? ts.every(source.types, function (t) { return isTypeDerivedFrom(t, target); }) :
target.flags & 1048576 /* Union */ ? ts.some(target.types, function (t) { return isTypeDerivedFrom(source, t); }) :
- source.flags & 58982400 /* InstantiableNonPrimitive */ ? isTypeDerivedFrom(getBaseConstraintOfType(source) || emptyObjectType, target) :
+ source.flags & 58982400 /* InstantiableNonPrimitive */ ? isTypeDerivedFrom(getBaseConstraintOfType(source) || unknownType, target) :
target === globalObjectType ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) :
target === globalFunctionType ? !!(source.flags & 524288 /* Object */) && isFunctionObjectType(source) :
hasBaseType(source, getTargetType(target));
@@ -41572,23 +42041,23 @@
return true;
}
switch (node.kind) {
- case 270 /* JsxExpression */:
- case 195 /* ParenthesizedExpression */:
+ case 271 /* JsxExpression */:
+ case 196 /* ParenthesizedExpression */:
return elaborateError(node.expression, source, target, relation, headMessage);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
switch (node.operatorToken.kind) {
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
case 27 /* CommaToken */:
return elaborateError(node.right, source, target, relation, headMessage);
}
break;
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return elaborateObjectLiteral(node, source, target, relation);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return elaborateArrayLiteral(node, source, target, relation);
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
return elaborateJsxComponents(node, source, target, relation);
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return elaborateArrowFunction(node, source, target, relation);
}
return false;
@@ -41657,11 +42126,11 @@
var reportedError = false;
for (var status = iterator.next(); !status.done; status = iterator.next()) {
var _a = status.value, prop = _a.errorNode, next = _a.innerExpression, nameType = _a.nameType, errorMessage = _a.errorMessage;
- var targetPropType = getIndexedAccessType(target, nameType, /*accessNode*/ undefined, errorType);
- if (targetPropType === errorType || targetPropType.flags & 8388608 /* IndexedAccess */)
+ var targetPropType = getIndexedAccessTypeOrUndefined(target, nameType);
+ if (!targetPropType || targetPropType.flags & 8388608 /* IndexedAccess */)
continue; // Don't elaborate on indexes on generic variables
- var sourcePropType = getIndexedAccessType(source, nameType, /*accessNode*/ undefined, errorType);
- if (sourcePropType !== errorType && targetPropType !== errorType && !checkTypeRelatedTo(sourcePropType, targetPropType, relation, /*errorNode*/ undefined)) {
+ var sourcePropType = getIndexedAccessTypeOrUndefined(source, nameType);
+ if (sourcePropType && !checkTypeRelatedTo(sourcePropType, targetPropType, relation, /*errorNode*/ undefined)) {
var elaborated = next && elaborateError(next, sourcePropType, targetPropType, relation, /*headMessage*/ undefined);
if (elaborated) {
reportedError = true;
@@ -41760,7 +42229,7 @@
}
function getElaborationElementForJsxChild(child, nameType, getInvalidTextDiagnostic) {
switch (child.kind) {
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
// child is of the type of the expression
return { errorNode: child, innerExpression: child.expression, nameType: nameType };
case 11 /* JsxText */:
@@ -41769,15 +42238,18 @@
}
// child is a string
return { errorNode: child, innerExpression: undefined, nameType: nameType, errorMessage: getInvalidTextDiagnostic() };
- case 260 /* JsxElement */:
- case 261 /* JsxSelfClosingElement */:
- case 264 /* JsxFragment */:
+ case 261 /* JsxElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 265 /* JsxFragment */:
// child is of type JSX.Element
return { errorNode: child, innerExpression: child, nameType: nameType };
default:
return ts.Debug.assertNever(child, "Found invalid jsx child");
}
}
+ function getSemanticJsxChildren(children) {
+ return ts.filter(children, function (i) { return !ts.isJsxText(i) || !i.containsOnlyTriviaWhiteSpaces; });
+ }
function elaborateJsxComponents(node, source, target, relation) {
var result = elaborateElementwise(generateJsxAttributes(node), source, target, relation);
var invalidTextDiagnostic;
@@ -41787,7 +42259,7 @@
var childrenPropName = childPropName === undefined ? "children" : ts.unescapeLeadingUnderscores(childPropName);
var childrenNameType = getLiteralType(childrenPropName);
var childrenTargetType = getIndexedAccessType(target, childrenNameType);
- var validChildren = ts.filter(containingElement.children, function (i) { return !ts.isJsxText(i) || !i.containsOnlyTriviaWhiteSpaces; });
+ var validChildren = getSemanticJsxChildren(containingElement.children);
if (!ts.length(validChildren)) {
return result;
}
@@ -41871,6 +42343,8 @@
});
}
function elaborateArrayLiteral(node, source, target, relation) {
+ if (target.flags & 131068 /* Primitive */)
+ return false;
if (isTupleLikeType(source)) {
return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation);
}
@@ -41901,11 +42375,11 @@
}
_b = prop.kind;
switch (_b) {
- case 159 /* SetAccessor */: return [3 /*break*/, 2];
- case 158 /* GetAccessor */: return [3 /*break*/, 2];
- case 156 /* MethodDeclaration */: return [3 /*break*/, 2];
- case 276 /* ShorthandPropertyAssignment */: return [3 /*break*/, 2];
- case 275 /* PropertyAssignment */: return [3 /*break*/, 4];
+ case 160 /* SetAccessor */: return [3 /*break*/, 2];
+ case 159 /* GetAccessor */: return [3 /*break*/, 2];
+ case 157 /* MethodDeclaration */: return [3 /*break*/, 2];
+ case 277 /* ShorthandPropertyAssignment */: return [3 /*break*/, 2];
+ case 276 /* PropertyAssignment */: return [3 /*break*/, 4];
}
return [3 /*break*/, 6];
case 2: return [4 /*yield*/, { errorNode: prop.name, innerExpression: undefined, nameType: type }];
@@ -41927,6 +42401,8 @@
});
}
function elaborateObjectLiteral(node, source, target, relation) {
+ if (target.flags & 131068 /* Primitive */)
+ return false;
return elaborateElementwise(generateObjectLiteralElements(node), source, target, relation);
}
/**
@@ -41975,8 +42451,8 @@
return 0 /* False */;
}
var kind = target.declaration ? target.declaration.kind : 0 /* Unknown */;
- var strictVariance = !callbackCheck && strictFunctionTypes && kind !== 156 /* MethodDeclaration */ &&
- kind !== 155 /* MethodSignature */ && kind !== 157 /* Constructor */;
+ var strictVariance = !callbackCheck && strictFunctionTypes && kind !== 157 /* MethodDeclaration */ &&
+ kind !== 156 /* MethodSignature */ && kind !== 158 /* Constructor */;
var result = -1 /* True */;
var sourceThisType = getThisTypeOfSignature(source);
if (sourceThisType && sourceThisType !== voidType) {
@@ -42024,12 +42500,14 @@
result &= related;
}
if (!ignoreReturnTypes) {
- var targetReturnType = (target.declaration && isJSConstructor(target.declaration)) ?
+ // If a signature reolution is already in-flight, skip issuing a circularity error
+ // here and just use the `any` type directly
+ var targetReturnType = isResolvingReturnTypeOfSignature(target) ? anyType : (target.declaration && isJSConstructor(target.declaration)) ?
getJSClassType(target.declaration.symbol) : getReturnTypeOfSignature(target);
if (targetReturnType === voidType) {
return result;
}
- var sourceReturnType = (source.declaration && isJSConstructor(source.declaration)) ?
+ var sourceReturnType = isResolvingReturnTypeOfSignature(source) ? anyType : (source.declaration && isJSConstructor(source.declaration)) ?
getJSClassType(source.declaration.symbol) : getReturnTypeOfSignature(source);
// The following block preserves behavior forbidding boolean returning functions from being assignable to type guard returning functions
var targetTypePredicate = getTypePredicateOfSignature(target);
@@ -42108,6 +42586,11 @@
function isEmptyAnonymousObjectType(type) {
return !!(ts.getObjectFlags(type) & 16 /* Anonymous */) && isEmptyObjectType(type);
}
+ function isStringIndexSignatureOnlyType(type) {
+ return type.flags & 524288 /* Object */ && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfoOfType(type, 0 /* String */) && !getIndexInfoOfType(type, 1 /* Number */) ||
+ type.flags & 3145728 /* UnionOrIntersection */ && ts.every(type.types, isStringIndexSignatureOnlyType) ||
+ false;
+ }
function isEnumTypeRelatedTo(sourceSymbol, targetSymbol, errorReporter) {
if (sourceSymbol === targetSymbol) {
return true;
@@ -42216,8 +42699,8 @@
}
return false;
}
- function isIgnoredJsxProperty(source, sourceProp, targetMemberType) {
- return ts.getObjectFlags(source) & 4096 /* JsxAttributes */ && !(isUnhyphenatedJsxName(sourceProp.escapedName) || targetMemberType);
+ function isIgnoredJsxProperty(source, sourceProp) {
+ return ts.getObjectFlags(source) & 4096 /* JsxAttributes */ && !isUnhyphenatedJsxName(sourceProp.escapedName);
}
/**
* Checks if 'source' is related to 'target' (e.g.: is a assignable to).
@@ -42239,7 +42722,7 @@
var depth = 0;
var expandingFlags = 0 /* None */;
var overflow = false;
- var suppressNextError = false;
+ var overrideNextErrorInfo;
ts.Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
var result = isRelatedTo(source, target, /*reportErrors*/ !!errorNode, headMessage);
if (overflow) {
@@ -42247,9 +42730,9 @@
}
else if (errorInfo) {
if (containingMessageChain) {
- var chain_1 = containingMessageChain();
- if (chain_1) {
- errorInfo = ts.concatenateDiagnosticMessageChains(chain_1, errorInfo);
+ var chain = containingMessageChain();
+ if (chain) {
+ errorInfo = ts.concatenateDiagnosticMessageChains(chain, errorInfo);
}
}
var relatedInformation = void 0;
@@ -42289,11 +42772,9 @@
}
}
function reportRelationError(message, source, target) {
- var sourceType = typeToString(source);
- var targetType = typeToString(target);
- if (sourceType === targetType) {
- sourceType = typeToString(source, /*enclosingDeclaration*/ undefined, 64 /* UseFullyQualifiedType */);
- targetType = typeToString(target, /*enclosingDeclaration*/ undefined, 64 /* UseFullyQualifiedType */);
+ var _a = getTypeNamesForErrorDisplay(source, target), sourceType = _a[0], targetType = _a[1];
+ if (target.flags & 262144 /* TypeParameter */ && target.immediateBaseConstraint !== undefined && isTypeAssignableTo(source, target.immediateBaseConstraint)) {
+ reportError(ts.Diagnostics._0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_constraint_2, sourceType, targetType, typeToString(target.immediateBaseConstraint));
}
if (!message) {
if (relation === comparableRelation) {
@@ -42318,25 +42799,39 @@
reportError(ts.Diagnostics._0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible, targetType, sourceType);
}
}
- function isUnionOrIntersectionTypeWithoutNullableConstituents(type) {
- if (!(type.flags & 3145728 /* UnionOrIntersection */)) {
+ /**
+ * Try and elaborate array and tuple errors. Returns false
+ * if we have found an elaboration, or we should ignore
+ * any other elaborations when relating the `source` and
+ * `target` types.
+ *
+ * @param source
+ * @param target
+ * @param reportErrors
+ */
+ function tryElaborateArrayLikeErrors(source, target, reportErrors) {
+ if (isTupleLikeType(source)) {
+ var sourceTuple = source.target;
+ if (sourceTuple && sourceTuple.readonly && isArrayOrTupleLikeType(target) &&
+ (!isReadonlyArrayType(target) || isTupleType(target) && !target.target.readonly)) {
+ if (reportErrors) {
+ reportError(ts.Diagnostics.The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1, typeToString(source), typeToString(target));
+ }
return false;
}
- // at this point we know that this is union or intersection type possibly with nullable constituents.
- // check if we still will have compound type if we ignore nullable components.
- var seenNonNullable = false;
- for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
- var t = _a[_i];
- if (t.flags & 98304 /* Nullable */) {
- continue;
+ return isArrayLikeType(target);
}
- if (seenNonNullable) {
- return true;
+ if (isTupleLikeType(target)) {
+ return isArrayLikeType(source);
}
- seenNonNullable = true;
+ if (isReadonlyArrayType(source) && isArrayType(target) && !isReadonlyArrayType(target)) {
+ if (reportErrors) {
+ reportError(ts.Diagnostics.The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1, typeToString(source), typeToString(target));
}
return false;
}
+ return true;
+ }
/**
* Compare two types and return
* * Ternary.True if they are related with no assumptions,
@@ -42357,11 +42852,11 @@
if (target.flags & 33554432 /* Substitution */) {
target = target.typeVariable;
}
- if (source.flags & 8388608 /* IndexedAccess */) {
- source = getSimplifiedType(source);
+ if (source.flags & 25165824 /* Simplifiable */) {
+ source = getSimplifiedType(source, /*writing*/ false);
}
- if (target.flags & 8388608 /* IndexedAccess */) {
- target = getSimplifiedType(target);
+ if (target.flags & 25165824 /* Simplifiable */) {
+ target = getSimplifiedType(target, /*writing*/ true);
}
// Try to see if we're relating something like `Foo` -> `Bar | null | undefined`.
// If so, reporting the `null` and `undefined` in the type is hardly useful.
@@ -42389,7 +42884,8 @@
isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : undefined))
return -1 /* True */;
var isComparingJsxAttributes = !!(ts.getObjectFlags(source) & 4096 /* JsxAttributes */);
- if (isObjectLiteralType(source) && ts.getObjectFlags(source) & 32768 /* FreshLiteral */) {
+ var isPerformingExcessPropertyChecks = (isObjectLiteralType(source) && ts.getObjectFlags(source) & 32768 /* FreshLiteral */);
+ if (isPerformingExcessPropertyChecks) {
var discriminantType = target.flags & 1048576 /* Union */ ? findMatchingDiscriminantType(source, target) : undefined;
if (hasExcessProperties(source, target, discriminantType, reportErrors)) {
if (reportErrors) {
@@ -42397,13 +42893,6 @@
}
return 0 /* False */;
}
- // Above we check for excess properties with respect to the entire target type. When union
- // and intersection types are further deconstructed on the target side, we don't want to
- // make the check again (as it might fail for a partial target type). Therefore we obtain
- // the regular source type and proceed with that.
- if (isUnionOrIntersectionTypeWithoutNullableConstituents(target) && !discriminantType) {
- source = getRegularTypeOfObjectLiteral(source);
- }
}
if (relation !== comparableRelation && !isApparentIntersectionConstituent &&
source.flags & (131068 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source !== globalObjectType &&
@@ -42436,11 +42925,24 @@
}
else {
if (target.flags & 1048576 /* Union */) {
- result = typeRelatedToSomeType(source, target, reportErrors && !(source.flags & 131068 /* Primitive */) && !(target.flags & 131068 /* Primitive */));
+ result = typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source), target, reportErrors && !(source.flags & 131068 /* Primitive */) && !(target.flags & 131068 /* Primitive */));
+ if (result && isPerformingExcessPropertyChecks) {
+ // Validate against excess props using the original `source`
+ var discriminantType = target.flags & 1048576 /* Union */ ? findMatchingDiscriminantType(source, target) : undefined;
+ if (!propertiesRelatedTo(source, discriminantType || target, reportErrors, /*excludedProperties*/ undefined)) {
+ return 0 /* False */;
+ }
+ }
}
else if (target.flags & 2097152 /* Intersection */) {
isIntersectionConstituent = true; // set here to affect the following trio of checks
- result = typeRelatedToEachType(source, target, reportErrors);
+ result = typeRelatedToEachType(getRegularTypeOfObjectLiteral(source), target, reportErrors);
+ if (result && isPerformingExcessPropertyChecks) {
+ // Validate against excess props using the original `source`
+ if (!propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined)) {
+ return 0 /* False */;
+ }
+ }
}
else if (source.flags & 2097152 /* Intersection */) {
// Check to see if any constituents of the intersection are immediately related to the target.
@@ -42482,8 +42984,15 @@
}
}
if (!result && reportErrors) {
- var maybeSuppress = suppressNextError;
- suppressNextError = false;
+ var maybeSuppress = overrideNextErrorInfo;
+ overrideNextErrorInfo = undefined;
+ if (source.flags & 524288 /* Object */ && target.flags & 524288 /* Object */) {
+ var currentError = errorInfo;
+ tryElaborateArrayLikeErrors(source, target, reportErrors);
+ if (errorInfo !== currentError) {
+ maybeSuppress = errorInfo;
+ }
+ }
if (source.flags & 524288 /* Object */ && target.flags & 131068 /* Primitive */) {
tryElaborateErrorsForPrimitivesAndObjects(source, target);
}
@@ -42578,7 +43087,7 @@
return { value: true };
}
};
- for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) {
+ for (var _i = 0, _a = getPropertiesOfType(source); _i < _a.length; _i++) {
var prop = _a[_i];
var state_3 = _loop_7(prop);
if (typeof state_3 === "object")
@@ -42685,8 +43194,8 @@
}
// Keep this up-to-date with the same logic within `getApparentTypeOfContextualType`, since they should behave similarly
function findMatchingDiscriminantType(source, target) {
- if (target.flags & 1048576 /* Union */) {
- var sourceProperties = getPropertiesOfObjectType(source);
+ if (target.flags & 1048576 /* Union */ && source.flags & (2097152 /* Intersection */ | 524288 /* Object */)) {
+ var sourceProperties = getPropertiesOfType(source);
if (sourceProperties) {
var sourcePropertiesFiltered = findDiscriminantProperties(sourceProperties, target);
if (sourcePropertiesFiltered) {
@@ -42749,13 +43258,20 @@
// When variance information isn't available we default to covariance. This happens
// in the process of computing variance information for recursive types and when
// comparing 'this' type arguments.
- var variance = i < variances.length ? variances[i] : 1 /* Covariant */;
+ var varianceFlags = i < variances.length ? variances[i] : 1 /* Covariant */;
+ var variance = varianceFlags & 7 /* VarianceMask */;
// We ignore arguments for independent type parameters (because they're never witnessed).
if (variance !== 4 /* Independent */) {
var s = sources[i];
var t = targets[i];
var related = -1 /* True */;
- if (variance === 1 /* Covariant */) {
+ if (varianceFlags & 8 /* Unmeasurable */) {
+ // Even an `Unmeasurable` variance works out without a structural check if the source and target are _identical_.
+ // We can't simply assume invariance, because `Unmeasurable` marks nonlinear relations, for example, a relation tained by
+ // the `-?` modifier in a mapped type (where, no matter how the inputs are related, the outputs still might not be)
+ related = relation === identityRelation ? isRelatedTo(s, t, /*reportErrors*/ false) : compareTypesIdentical(s, t);
+ }
+ else if (variance === 1 /* Covariant */) {
related = isRelatedTo(s, t, reportErrors);
}
else if (variance === 2 /* Contravariant */) {
@@ -42874,8 +43390,8 @@
if (source.root.isDistributive === target.root.isDistributive) {
if (result_3 = isRelatedTo(source.checkType, target.checkType, /*reportErrors*/ false)) {
if (result_3 &= isRelatedTo(source.extendsType, target.extendsType, /*reportErrors*/ false)) {
- if (result_3 &= isRelatedTo(source.trueType, target.trueType, /*reportErrors*/ false)) {
- if (result_3 &= isRelatedTo(source.falseType, target.falseType, /*reportErrors*/ false)) {
+ if (result_3 &= isRelatedTo(getTrueTypeFromConditionalType(source), getTrueTypeFromConditionalType(target), /*reportErrors*/ false)) {
+ if (result_3 &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), /*reportErrors*/ false)) {
return result_3;
}
}
@@ -42925,8 +43441,7 @@
}
// A type S is assignable to keyof T if S is assignable to keyof C, where C is the
// simplified form of T or, if T doesn't simplify, the constraint of T.
- var simplified = getSimplifiedType(target.type);
- var constraint = simplified !== target.type ? simplified : getConstraintOfType(target.type);
+ var constraint = getSimplifiedTypeOrConstraint(target.type);
if (constraint) {
// We require Ternary.True here such that circular constraints don't cause
// false positives. For example, given 'T extends { [K in keyof T]: string }',
@@ -42938,13 +43453,17 @@
}
}
else if (target.flags & 8388608 /* IndexedAccess */) {
- // A type S is related to a type T[K], where T and K aren't both type variables, if S is related to C,
- // where C is the base constraint of T[K]
- if (relation !== identityRelation &&
- !(isGenericObjectType(target.objectType) && isGenericIndexType(target.indexType))) {
- var constraint = getBaseConstraintOfType(target);
- if (constraint && constraint !== target) {
- if (result = isRelatedTo(source, constraint, reportErrors)) {
+ // A type S is related to a type T[K] if S is related to C, where C is the base
+ // constraint of T[K] for writing.
+ if (relation !== identityRelation) {
+ var objectType = target.objectType;
+ var indexType = target.indexType;
+ var baseObjectType = getBaseConstraintOfType(objectType) || objectType;
+ var baseIndexType = getBaseConstraintOfType(indexType) || indexType;
+ if (!isGenericObjectType(baseObjectType) && !isGenericIndexType(baseIndexType)) {
+ var accessFlags = 2 /* Writing */ | (baseObjectType !== objectType ? 1 /* NoIndexSignatures */ : 0);
+ var constraint = getIndexedAccessTypeOrUndefined(baseObjectType, baseIndexType, /*accessNode*/ undefined, accessFlags);
+ if (constraint && (result = isRelatedTo(source, constraint, reportErrors))) {
return result;
}
}
@@ -42961,7 +43480,7 @@
}
if (!isGenericMappedType(source)) {
var targetConstraint = getConstraintTypeFromMappedType(target);
- var sourceKeys_1 = getIndexType(source);
+ var sourceKeys_1 = getIndexType(source, /*stringsOnly*/ undefined, /*noIndexSignatures*/ true);
var hasOptionalUnionKeys = modifiers & 4 /* IncludeOptional */ && targetConstraint.flags & 1048576 /* Union */;
var filteredByApplicability = hasOptionalUnionKeys ? filterType(targetConstraint, function (t) { return !!isRelatedTo(t, sourceKeys_1); }) : undefined;
// A source type T is related to a target type { [P in Q]: X } if Q is related to keyof T and T[Q] is related to X.
@@ -42992,6 +43511,7 @@
return result;
}
}
+ else {
var constraint = getConstraintOfType(source);
if (!constraint || (source.flags & 262144 /* TypeParameter */ && constraint.flags & 1 /* Any */)) {
// A type variable with no constraint is not related to the non-primitive object type.
@@ -43011,6 +43531,7 @@
return result;
}
}
+ }
else if (source.flags & 4194304 /* Index */) {
if (result = isRelatedTo(keyofConstraintType, target, reportErrors)) {
errorInfo = saveErrorInfo;
@@ -43024,8 +43545,8 @@
// and Y1 is related to Y2.
if (isTypeIdenticalTo(source.extendsType, target.extendsType) &&
(isRelatedTo(source.checkType, target.checkType) || isRelatedTo(target.checkType, source.checkType))) {
- if (result = isRelatedTo(source.trueType, target.trueType, reportErrors)) {
- result &= isRelatedTo(source.falseType, target.falseType, reportErrors);
+ if (result = isRelatedTo(getTrueTypeFromConditionalType(source), getTrueTypeFromConditionalType(target), reportErrors)) {
+ result &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), reportErrors);
}
if (result) {
errorInfo = saveErrorInfo;
@@ -43095,7 +43616,7 @@
if (source.flags & (524288 /* Object */ | 2097152 /* Intersection */) && target.flags & 524288 /* Object */) {
// Report structural errors only if we haven't reported any errors yet
var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !sourceIsPrimitive;
- result = propertiesRelatedTo(source, target, reportStructuralErrors);
+ result = propertiesRelatedTo(source, target, reportStructuralErrors, /*excludedProperties*/ undefined);
if (result) {
result &= signaturesRelatedTo(source, target, 0 /* Call */, reportStructuralErrors);
if (result) {
@@ -43115,22 +43636,35 @@
return result;
}
}
+ // If S is an object type and T is a discriminated union, S may be related to T if
+ // there exists a constituent of T for every combination of the discriminants of S
+ // with respect to T. We do not report errors here, as we will use the existing
+ // error result from checking each constituent of the union.
+ if (source.flags & (524288 /* Object */ | 2097152 /* Intersection */) && target.flags & 1048576 /* Union */) {
+ var objectOnlyTarget = extractTypesOfKind(target, 524288 /* Object */);
+ if (objectOnlyTarget.flags & 1048576 /* Union */) {
+ var result_4 = typeRelatedToDiscriminatedType(source, objectOnlyTarget);
+ if (result_4) {
+ return result_4;
+ }
}
- return 0 /* False */;
- function isNonGeneric(type) {
- // If we're already in identity relationship checking, we should use `isRelatedTo`
- // to catch the `Maybe` from an excessively deep type (which we then assume means
- // that the type could possibly contain a generic)
- if (relation === identityRelation) {
- return isRelatedTo(type, getPermissiveInstantiation(type)) === -1 /* True */;
}
- return isTypeIdenticalTo(type, getPermissiveInstantiation(type));
}
+ return 0 /* False */;
function relateVariances(sourceTypeArguments, targetTypeArguments, variances) {
if (result = typeArgumentsRelatedTo(sourceTypeArguments, targetTypeArguments, variances, reportErrors)) {
return result;
}
- var allowStructuralFallback = (targetTypeArguments && hasCovariantVoidArgument(targetTypeArguments, variances)) || isNonGeneric(source) || isNonGeneric(target);
+ if (ts.some(variances, function (v) { return !!(v & 24 /* AllowsStructuralFallback */); })) {
+ // If some type parameter was `Unmeasurable` or `Unreliable`, and we couldn't pass by assuming it was identical, then we
+ // have to allow a structural fallback check
+ // We elide the variance-based error elaborations, since those might not be too helpful, since we'll potentially
+ // be assuming identity of the type parameter.
+ originalErrorInfo = undefined;
+ errorInfo = saveErrorInfo;
+ return undefined;
+ }
+ var allowStructuralFallback = targetTypeArguments && hasCovariantVoidArgument(targetTypeArguments, variances);
varianceCheckFailed = !allowStructuralFallback;
// The type arguments did not relate appropriately, but it may be because we have no variance
// information (in which case typeArgumentsRelatedTo defaulted to covariance for all type
@@ -43148,7 +43682,7 @@
// reveal the reason).
// We can switch on `reportErrors` here, since varianceCheckFailed guarantees we return `False`,
// we can return `False` early here to skip calculating the structural error message we don't need.
- if (varianceCheckFailed && !(reportErrors && ts.some(variances, function (v) { return v === 0 /* Invariant */; }))) {
+ if (varianceCheckFailed && !(reportErrors && ts.some(variances, function (v) { return (v & 7 /* VarianceMask */) === 0 /* Invariant */; }))) {
return 0 /* False */;
}
// We remember the original error information so we can restore it in case the structural
@@ -43159,6 +43693,18 @@
}
}
}
+ function reportUnmeasurableMarkers(p) {
+ if (outofbandVarianceMarkerHandler && (p === markerSuperType || p === markerSubType || p === markerOtherType)) {
+ outofbandVarianceMarkerHandler(/*onlyUnreliable*/ false);
+ }
+ return p;
+ }
+ function reportUnreliableMarkers(p) {
+ if (outofbandVarianceMarkerHandler && (p === markerSuperType || p === markerSubType || p === markerOtherType)) {
+ outofbandVarianceMarkerHandler(/*onlyUnreliable*/ true);
+ }
+ return p;
+ }
// A type [P in S]: X is related to a type [Q in T]: Y if T is related to S and X' is
// related to Y, where X' is an instantiation of X in which P is replaced with Q. Notice
// that S and T are contra-variant whereas X and Y are co-variant.
@@ -43166,99 +43712,185 @@
var modifiersRelated = relation === comparableRelation || (relation === identityRelation ? getMappedTypeModifiers(source) === getMappedTypeModifiers(target) :
getCombinedMappedTypeOptionality(source) <= getCombinedMappedTypeOptionality(target));
if (modifiersRelated) {
- var result_4;
- if (result_4 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) {
+ var result_5;
+ var targetConstraint = getConstraintTypeFromMappedType(target);
+ var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source), getCombinedMappedTypeOptionality(source) < 0 ? reportUnmeasurableMarkers : reportUnreliableMarkers);
+ if (result_5 = isRelatedTo(targetConstraint, sourceConstraint, reportErrors)) {
var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]);
- return result_4 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), reportErrors);
+ return result_5 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), reportErrors);
}
}
return 0 /* False */;
}
- function propertiesRelatedTo(source, target, reportErrors) {
- if (relation === identityRelation) {
- return propertiesIdenticalTo(source, target);
+ function typeRelatedToDiscriminatedType(source, target) {
+ // 1. Generate the combinations of discriminant properties & types 'source' can satisfy.
+ // a. If the number of combinations is above a set limit, the comparison is too complex.
+ // 2. Filter 'target' to the subset of types whose discriminants exist in the matrix.
+ // a. If 'target' does not satisfy all discriminants in the matrix, 'source' is not related.
+ // 3. For each type in the filtered 'target', determine if all non-discriminant properties of
+ // 'target' are related to a property in 'source'.
+ //
+ // NOTE: See ~/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithDiscriminatedUnion.ts
+ // for examples.
+ var sourceProperties = getPropertiesOfObjectType(source);
+ var sourcePropertiesFiltered = findDiscriminantProperties(sourceProperties, target);
+ if (!sourcePropertiesFiltered)
+ return 0 /* False */;
+ // Though we could compute the number of combinations as we generate
+ // the matrix, this would incur additional memory overhead due to
+ // array allocations. To reduce this overhead, we first compute
+ // the number of combinations to ensure we will not surpass our
+ // fixed limit before incurring the cost of any allocations:
+ var numCombinations = 1;
+ for (var _i = 0, sourcePropertiesFiltered_1 = sourcePropertiesFiltered; _i < sourcePropertiesFiltered_1.length; _i++) {
+ var sourceProperty = sourcePropertiesFiltered_1[_i];
+ numCombinations *= countTypes(getTypeOfSymbol(sourceProperty));
+ if (numCombinations > 25) {
+ // We've reached the complexity limit.
+ return 0 /* False */;
}
- var requireOptionalProperties = relation === subtypeRelation && !isObjectLiteralType(source) && !isEmptyArrayLiteralType(source) && !isTupleType(source);
- var unmatchedProperty = getUnmatchedProperty(source, target, requireOptionalProperties, /*matchDiscriminantProperties*/ false);
- if (unmatchedProperty) {
- if (reportErrors) {
- var props = ts.arrayFrom(getUnmatchedProperties(source, target, requireOptionalProperties, /*matchDiscriminantProperties*/ false));
- if (!headMessage || (headMessage.code !== ts.Diagnostics.Class_0_incorrectly_implements_interface_1.code &&
- headMessage.code !== ts.Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass.code)) {
- suppressNextError = true; // Retain top-level error for interface implementing issues, otherwise omit it
}
- if (props.length === 1) {
- var propName = symbolToString(unmatchedProperty);
- reportError(ts.Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2, propName, typeToString(source), typeToString(target));
- if (ts.length(unmatchedProperty.declarations)) {
- associateRelatedInfo(ts.createDiagnosticForNode(unmatchedProperty.declarations[0], ts.Diagnostics._0_is_declared_here, propName));
+ // Compute the set of types for each discriminant property.
+ var sourceDiscriminantTypes = new Array(sourcePropertiesFiltered.length);
+ var excludedProperties = ts.createUnderscoreEscapedMap();
+ for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
+ var sourceProperty = sourcePropertiesFiltered[i];
+ var sourcePropertyType = getTypeOfSymbol(sourceProperty);
+ sourceDiscriminantTypes[i] = sourcePropertyType.flags & 1048576 /* Union */
+ ? sourcePropertyType.types
+ : [sourcePropertyType];
+ excludedProperties.set(sourceProperty.escapedName, true);
+ }
+ // Match each combination of the cartesian product of discriminant properties to one or more
+ // constituents of 'target'. If any combination does not have a match then 'source' is not relatable.
+ var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
+ var matchingTypes = [];
+ var _loop_8 = function (combination) {
+ var hasMatch = false;
+ outer: for (var _i = 0, _a = target.types; _i < _a.length; _i++) {
+ var type = _a[_i];
+ var _loop_9 = function (i) {
+ var sourceProperty = sourcePropertiesFiltered[i];
+ var targetProperty = getPropertyOfObjectType(type, sourceProperty.escapedName);
+ if (!targetProperty)
+ return "continue-outer";
+ if (sourceProperty === targetProperty)
+ return "continue";
+ // We compare the source property to the target in the context of a single discriminant type.
+ var related = propertyRelatedTo(source, target, sourceProperty, targetProperty, function (_) { return combination[i]; }, /*reportErrors*/ false);
+ // If the target property could not be found, or if the properties were not related,
+ // then this constituent is not a match.
+ if (!related) {
+ return "continue-outer";
+ }
+ };
+ for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
+ var state_5 = _loop_9(i);
+ switch (state_5) {
+ case "continue-outer": continue outer;
}
}
- else if (props.length > 5) { // arbitrary cutoff for too-long list form
- reportError(ts.Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2_and_3_more, typeToString(source), typeToString(target), ts.map(props.slice(0, 4), function (p) { return symbolToString(p); }).join(", "), props.length - 4);
+ ts.pushIfUnique(matchingTypes, type, ts.equateValues);
+ hasMatch = true;
}
- else {
- reportError(ts.Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2, typeToString(source), typeToString(target), ts.map(props, function (p) { return symbolToString(p); }).join(", "));
+ if (!hasMatch) {
+ return { value: 0 /* False */ };
}
+ };
+ for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
+ var combination = discriminantCombinations_1[_a];
+ var state_4 = _loop_8(combination);
+ if (typeof state_4 === "object")
+ return state_4.value;
}
- return 0 /* False */;
+ // Compare the remaining non-discriminant properties of each match.
+ var result = -1 /* True */;
+ for (var _b = 0, matchingTypes_1 = matchingTypes; _b < matchingTypes_1.length; _b++) {
+ var type = matchingTypes_1[_b];
+ result &= propertiesRelatedTo(source, type, /*reportErrors*/ false, excludedProperties);
+ if (result) {
+ result &= signaturesRelatedTo(source, type, 0 /* Call */, /*reportStructuralErrors*/ false);
+ if (result) {
+ result &= signaturesRelatedTo(source, type, 1 /* Construct */, /*reportStructuralErrors*/ false);
+ if (result) {
+ result &= indexTypesRelatedTo(source, type, 0 /* String */, /*sourceIsPrimitive*/ false, /*reportStructuralErrors*/ false);
+ if (result) {
+ result &= indexTypesRelatedTo(source, type, 1 /* Number */, /*sourceIsPrimitive*/ false, /*reportStructuralErrors*/ false);
}
- if (isObjectLiteralType(target)) {
- for (var _i = 0, _a = getPropertiesOfType(source); _i < _a.length; _i++) {
- var sourceProp = _a[_i];
- if (!getPropertyOfObjectType(target, sourceProp.escapedName)) {
- var sourceType = getTypeOfSymbol(sourceProp);
- if (!(sourceType === undefinedType || sourceType === undefinedWideningType)) {
- if (reportErrors) {
- reportError(ts.Diagnostics.Property_0_does_not_exist_on_type_1, symbolToString(sourceProp), typeToString(target));
}
- return 0 /* False */;
}
}
+ if (!result) {
+ return result;
}
}
- var result = -1 /* True */;
- if (isTupleType(target)) {
- var targetRestType = getRestTypeOfTupleType(target);
- if (targetRestType) {
- if (!isTupleType(source)) {
- return 0 /* False */;
+ return result;
}
- var sourceRestType = getRestTypeOfTupleType(source);
- if (sourceRestType && !isRelatedTo(sourceRestType, targetRestType, reportErrors)) {
- if (reportErrors) {
- reportError(ts.Diagnostics.Rest_signatures_are_incompatible);
+ function excludeProperties(properties, excludedProperties) {
+ if (!excludedProperties || properties.length === 0)
+ return properties;
+ var result;
+ for (var i = 0; i < properties.length; i++) {
+ if (!excludedProperties.has(properties[i].escapedName)) {
+ if (result) {
+ result.push(properties[i]);
}
- return 0 /* False */;
}
- var targetCount = getTypeReferenceArity(target) - 1;
- var sourceCount = getTypeReferenceArity(source) - (sourceRestType ? 1 : 0);
- for (var i = targetCount; i < sourceCount; i++) {
- var related = isRelatedTo(source.typeArguments[i], targetRestType, reportErrors);
+ else if (!result) {
+ result = properties.slice(0, i);
+ }
+ }
+ return result || properties;
+ }
+ function isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors) {
+ var targetIsOptional = strictNullChecks && !!(ts.getCheckFlags(targetProp) & 48 /* Partial */);
+ var source = getTypeOfSourceProperty(sourceProp);
+ if (ts.getCheckFlags(targetProp) & 65536 /* DeferredType */ && !getSymbolLinks(targetProp).type) {
+ // Rather than resolving (and normalizing) the type, relate constituent-by-constituent without performing normalization or seconadary passes
+ var links = getSymbolLinks(targetProp);
+ ts.Debug.assertDefined(links.deferralParent);
+ ts.Debug.assertDefined(links.deferralConstituents);
+ var unionParent = !!(links.deferralParent.flags & 1048576 /* Union */);
+ var result_6 = unionParent ? 0 /* False */ : -1 /* True */;
+ var targetTypes = links.deferralConstituents;
+ for (var _i = 0, targetTypes_3 = targetTypes; _i < targetTypes_3.length; _i++) {
+ var targetType = targetTypes_3[_i];
+ var related = isRelatedTo(source, targetType, /*reportErrors*/ false, /*headMessage*/ undefined, /*isIntersectionConstituent*/ !unionParent);
+ if (!unionParent) {
if (!related) {
- if (reportErrors) {
- reportError(ts.Diagnostics.Property_0_is_incompatible_with_rest_element_type, "" + i);
+ // Can't assign to a target individually - have to fallback to assigning to the _whole_ intersection (which forces normalization)
+ return isRelatedTo(source, addOptionality(getTypeOfSymbol(targetProp), targetIsOptional), reportErrors);
}
- return 0 /* False */;
+ result_6 &= related;
}
- result &= related;
+ else {
+ if (related) {
+ return related;
}
}
}
- var properties = getPropertiesOfObjectType(target);
- for (var _b = 0, properties_2 = properties; _b < properties_2.length; _b++) {
- var targetProp = properties_2[_b];
- if (!(targetProp.flags & 4194304 /* Prototype */)) {
- var sourceProp = getPropertyOfType(source, targetProp.escapedName);
- if (sourceProp && sourceProp !== targetProp) {
- if (isIgnoredJsxProperty(source, sourceProp, getTypeOfSymbol(targetProp))) {
- continue;
+ if (unionParent && !result_6 && targetIsOptional) {
+ result_6 = isRelatedTo(source, undefinedType);
+ }
+ if (unionParent && !result_6 && reportErrors) {
+ // The easiest way to get the right errors here is to un-defer (which may be costly)
+ // If it turns out this is too costly too often, we can replicate the error handling logic within
+ // typeRelatedToSomeType without the discriminatable type branch (as that requires a manifest union
+ // type on which to hand discriminable properties, which we are expressly trying to avoid here)
+ return isRelatedTo(source, addOptionality(getTypeOfSymbol(targetProp), targetIsOptional), reportErrors);
+ }
+ return result_6;
+ }
+ else {
+ return isRelatedTo(source, addOptionality(getTypeOfSymbol(targetProp), targetIsOptional), reportErrors);
}
+ }
+ function propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSourceProperty, reportErrors) {
var sourcePropFlags = ts.getDeclarationModifierFlagsFromSymbol(sourceProp);
var targetPropFlags = ts.getDeclarationModifierFlagsFromSymbol(targetProp);
if (sourcePropFlags & 8 /* Private */ || targetPropFlags & 8 /* Private */) {
var hasDifferingDeclarations = sourceProp.valueDeclaration !== targetProp.valueDeclaration;
- if (ts.getCheckFlags(sourceProp) & 512 /* ContainsPrivate */ && hasDifferingDeclarations) {
+ if (ts.getCheckFlags(sourceProp) & 1024 /* ContainsPrivate */ && hasDifferingDeclarations) {
if (reportErrors) {
reportError(ts.Diagnostics.Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1, symbolToString(sourceProp), typeToString(source));
}
@@ -43290,14 +43922,14 @@
}
return 0 /* False */;
}
- var related = isRelatedTo(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors);
+ // If the target comes from a partial union prop, allow `undefined` in the target type
+ var related = isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors);
if (!related) {
if (reportErrors) {
reportError(ts.Diagnostics.Types_of_property_0_are_incompatible, symbolToString(targetProp));
}
return 0 /* False */;
}
- result &= related;
// When checking for comparability, be more lenient with optional properties.
if (relation !== comparableRelation && sourceProp.flags & 16777216 /* Optional */ && !(targetProp.flags & 16777216 /* Optional */)) {
// TypeScript 1.0 spec (April 2014): 3.8.3
@@ -43312,17 +43944,113 @@
}
return 0 /* False */;
}
+ return related;
+ }
+ function propertiesRelatedTo(source, target, reportErrors, excludedProperties) {
+ if (relation === identityRelation) {
+ return propertiesIdenticalTo(source, target, excludedProperties);
+ }
+ var requireOptionalProperties = relation === subtypeRelation && !isObjectLiteralType(source) && !isEmptyArrayLiteralType(source) && !isTupleType(source);
+ var unmatchedProperty = getUnmatchedProperty(source, target, requireOptionalProperties, /*matchDiscriminantProperties*/ false);
+ if (unmatchedProperty) {
+ if (reportErrors) {
+ var props = ts.arrayFrom(getUnmatchedProperties(source, target, requireOptionalProperties, /*matchDiscriminantProperties*/ false));
+ var shouldSkipElaboration = false;
+ if (!headMessage || (headMessage.code !== ts.Diagnostics.Class_0_incorrectly_implements_interface_1.code &&
+ headMessage.code !== ts.Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass.code)) {
+ shouldSkipElaboration = true; // Retain top-level error for interface implementing issues, otherwise omit it
+ }
+ if (props.length === 1) {
+ var propName = symbolToString(unmatchedProperty);
+ reportError.apply(void 0, [ts.Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2, propName].concat(getTypeNamesForErrorDisplay(source, target)));
+ if (ts.length(unmatchedProperty.declarations)) {
+ associateRelatedInfo(ts.createDiagnosticForNode(unmatchedProperty.declarations[0], ts.Diagnostics._0_is_declared_here, propName));
+ }
+ if (shouldSkipElaboration) {
+ overrideNextErrorInfo = errorInfo;
+ }
+ }
+ else if (tryElaborateArrayLikeErrors(source, target, /*reportErrors*/ false)) {
+ if (props.length > 5) { // arbitrary cutoff for too-long list form
+ reportError(ts.Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2_and_3_more, typeToString(source), typeToString(target), ts.map(props.slice(0, 4), function (p) { return symbolToString(p); }).join(", "), props.length - 4);
+ }
+ else {
+ reportError(ts.Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2, typeToString(source), typeToString(target), ts.map(props, function (p) { return symbolToString(p); }).join(", "));
+ }
+ if (shouldSkipElaboration) {
+ overrideNextErrorInfo = errorInfo;
+ }
+ }
+ // ELSE: No array like or unmatched property error - just issue top level error (errorInfo = undefined)
+ }
+ return 0 /* False */;
+ }
+ if (isObjectLiteralType(target)) {
+ for (var _i = 0, _a = excludeProperties(getPropertiesOfType(source), excludedProperties); _i < _a.length; _i++) {
+ var sourceProp = _a[_i];
+ if (!getPropertyOfObjectType(target, sourceProp.escapedName)) {
+ var sourceType = getTypeOfSymbol(sourceProp);
+ if (!(sourceType === undefinedType || sourceType === undefinedWideningType)) {
+ if (reportErrors) {
+ reportError(ts.Diagnostics.Property_0_does_not_exist_on_type_1, symbolToString(sourceProp), typeToString(target));
+ }
+ return 0 /* False */;
+ }
+ }
+ }
+ }
+ var result = -1 /* True */;
+ if (isTupleType(target)) {
+ var targetRestType = getRestTypeOfTupleType(target);
+ if (targetRestType) {
+ if (!isTupleType(source)) {
+ return 0 /* False */;
+ }
+ var sourceRestType = getRestTypeOfTupleType(source);
+ if (sourceRestType && !isRelatedTo(sourceRestType, targetRestType, reportErrors)) {
+ if (reportErrors) {
+ reportError(ts.Diagnostics.Rest_signatures_are_incompatible);
+ }
+ return 0 /* False */;
+ }
+ var targetCount = getTypeReferenceArity(target) - 1;
+ var sourceCount = getTypeReferenceArity(source) - (sourceRestType ? 1 : 0);
+ for (var i = targetCount; i < sourceCount; i++) {
+ var related = isRelatedTo(source.typeArguments[i], targetRestType, reportErrors);
+ if (!related) {
+ if (reportErrors) {
+ reportError(ts.Diagnostics.Property_0_is_incompatible_with_rest_element_type, "" + i);
+ }
+ return 0 /* False */;
+ }
+ result &= related;
+ }
+ }
+ }
+ // We only call this for union target types when we're attempting to do excess property checking - in those cases, we want to get _all possible props_
+ // from the target union, across all members
+ var properties = target.flags & 1048576 /* Union */ ? getPossiblePropertiesOfUnionType(target) : getPropertiesOfType(target);
+ for (var _b = 0, _c = excludeProperties(properties, excludedProperties); _b < _c.length; _b++) {
+ var targetProp = _c[_b];
+ if (!(targetProp.flags & 4194304 /* Prototype */)) {
+ var sourceProp = getPropertyOfType(source, targetProp.escapedName);
+ if (sourceProp && sourceProp !== targetProp) {
+ var related = propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSymbol, reportErrors);
+ if (!related) {
+ return 0 /* False */;
+ }
+ result &= related;
}
}
}
return result;
}
- function propertiesIdenticalTo(source, target) {
+ function propertiesIdenticalTo(source, target, excludedProperties) {
if (!(source.flags & 524288 /* Object */ && target.flags & 524288 /* Object */)) {
return 0 /* False */;
}
- var sourceProperties = getPropertiesOfObjectType(source);
- var targetProperties = getPropertiesOfObjectType(target);
+ var sourceProperties = excludeProperties(getPropertiesOfObjectType(source), excludedProperties);
+ var targetProperties = excludeProperties(getPropertiesOfObjectType(target), excludedProperties);
if (sourceProperties.length !== targetProperties.length) {
return 0 /* False */;
}
@@ -43442,7 +44170,7 @@
var result = -1 /* True */;
for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) {
var prop = _a[_i];
- if (isIgnoredJsxProperty(source, prop, /*targetMemberType*/ undefined)) {
+ if (isIgnoredJsxProperty(source, prop)) {
continue;
}
// Skip over symbol-named members
@@ -43474,7 +44202,7 @@
return indexTypesIdenticalTo(source, target, kind);
}
var targetInfo = getIndexInfoOfType(target, kind);
- if (!targetInfo || targetInfo.type.flags & 3 /* AnyOrUnknown */ && !sourceIsPrimitive) {
+ if (!targetInfo || targetInfo.type.flags & 1 /* Any */ && !sourceIsPrimitive) {
// Index signature of type any permits assignment from everything but primitives
return -1 /* True */;
}
@@ -43614,8 +44342,11 @@
// The emptyArray singleton is used to signal a recursive invocation.
cache.variances = ts.emptyArray;
variances = [];
- for (var _i = 0, typeParameters_1 = typeParameters; _i < typeParameters_1.length; _i++) {
- var tp = typeParameters_1[_i];
+ var _loop_10 = function (tp) {
+ var unmeasurable = false;
+ var unreliable = false;
+ var oldHandler = outofbandVarianceMarkerHandler;
+ outofbandVarianceMarkerHandler = function (onlyUnreliable) { return onlyUnreliable ? unreliable = true : unmeasurable = true; };
// We first compare instantiations where the type parameter is replaced with
// marker types that have a known subtype relationship. From this we can infer
// invariance, covariance, contravariance or bivariance.
@@ -43630,7 +44361,26 @@
if (variance === 3 /* Bivariant */ && isTypeAssignableTo(createMarkerType(cache, tp, markerOtherType), typeWithSuper)) {
variance = 4 /* Independent */;
}
+ outofbandVarianceMarkerHandler = oldHandler;
+ if (unmeasurable || unreliable) {
+ if (unmeasurable) {
+ variance |= 8 /* Unmeasurable */;
+ }
+ if (unreliable) {
+ variance |= 16 /* Unreliable */;
+ }
+ var covariantID = getRelationKey(typeWithSub, typeWithSuper, assignableRelation);
+ var contravariantID = getRelationKey(typeWithSuper, typeWithSub, assignableRelation);
+ // We delete the results of these checks, as we want them to actually be run, see the `Unmeasurable` variance we cache,
+ // And then fall back to a structural result.
+ assignableRelation.delete(covariantID);
+ assignableRelation.delete(contravariantID);
+ }
variances.push(variance);
+ };
+ for (var _i = 0, typeParameters_1 = typeParameters; _i < typeParameters_1.length; _i++) {
+ var tp = typeParameters_1[_i];
+ _loop_10(tp);
}
cache.variances = variances;
}
@@ -43647,7 +44397,7 @@
// See comment at call in recursiveTypeRelatedTo for when this case matters.
function hasCovariantVoidArgument(typeArguments, variances) {
for (var i = 0; i < variances.length; i++) {
- if (variances[i] === 1 /* Covariant */ && typeArguments[i].flags & 16384 /* Void */) {
+ if ((variances[i] & 7 /* VarianceMask */) === 1 /* Covariant */ && typeArguments[i].flags & 16384 /* Void */) {
return true;
}
}
@@ -44073,6 +44823,30 @@
return strictNullChecks ? getGlobalNonNullableTypeInstantiation(type) : type;
}
/**
+ * Is source potentially coercible to target type under `==`.
+ * Assumes that `source` is a constituent of a union, hence
+ * the boolean literal flag on the LHS, but not on the RHS.
+ *
+ * This does not fully replicate the semantics of `==`. The
+ * intention is to catch cases that are clearly not right.
+ *
+ * Comparing (string | number) to number should not remove the
+ * string element.
+ *
+ * Comparing (string | number) to 1 will remove the string
+ * element, though this is not sound. This is a pragmatic
+ * choice.
+ *
+ * @see narrowTypeByEquality
+ *
+ * @param source
+ * @param target
+ */
+ function isCoercibleUnderDoubleEquals(source, target) {
+ return ((source.flags & (8 /* Number */ | 4 /* String */ | 512 /* BooleanLiteral */)) !== 0)
+ && ((target.flags & (8 /* Number */ | 4 /* String */ | 16 /* Boolean */)) !== 0);
+ }
+ /**
* Return true if type was inferred from an object literal, written as an object type literal, or is the shape of a module
* with no call or construct signatures.
*/
@@ -44208,26 +44982,34 @@
}
function getWidenedTypeWithContext(type, context) {
if (ts.getObjectFlags(type) & 393216 /* RequiresWidening */) {
+ if (context === undefined && type.widened) {
+ return type.widened;
+ }
+ var result = void 0;
if (type.flags & 98304 /* Nullable */) {
- return anyType;
+ result = anyType;
}
- if (isObjectLiteralType(type)) {
- return getWidenedTypeOfObjectLiteral(type, context);
+ else if (isObjectLiteralType(type)) {
+ result = getWidenedTypeOfObjectLiteral(type, context);
}
- if (type.flags & 1048576 /* Union */) {
+ else if (type.flags & 1048576 /* Union */) {
var unionContext_1 = context || createWideningContext(/*parent*/ undefined, /*propertyName*/ undefined, type.types);
var widenedTypes = ts.sameMap(type.types, function (t) { return t.flags & 98304 /* Nullable */ ? t : getWidenedTypeWithContext(t, unionContext_1); });
// Widening an empty object literal transitions from a highly restrictive type to
// a highly inclusive one. For that reason we perform subtype reduction here if the
// union includes empty object types (e.g. reducing {} | string to just {}).
- return getUnionType(widenedTypes, ts.some(widenedTypes, isEmptyObjectType) ? 2 /* Subtype */ : 1 /* Literal */);
+ result = getUnionType(widenedTypes, ts.some(widenedTypes, isEmptyObjectType) ? 2 /* Subtype */ : 1 /* Literal */);
}
- if (type.flags & 2097152 /* Intersection */) {
- return getIntersectionType(ts.sameMap(type.types, getWidenedType));
+ else if (type.flags & 2097152 /* Intersection */) {
+ result = getIntersectionType(ts.sameMap(type.types, getWidenedType));
}
- if (isArrayType(type) || isTupleType(type)) {
- return createTypeReference(type.target, ts.sameMap(type.typeArguments, getWidenedType));
+ else if (isArrayType(type) || isTupleType(type)) {
+ result = createTypeReference(type.target, ts.sameMap(type.typeArguments, getWidenedType));
}
+ if (result && context === undefined) {
+ type.widened = result;
+ }
+ return result || type;
}
return type;
}
@@ -44289,12 +45071,12 @@
}
var diagnostic;
switch (declaration.kind) {
- case 204 /* BinaryExpression */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 205 /* BinaryExpression */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
diagnostic = noImplicitAny ? ts.Diagnostics.Member_0_implicitly_has_an_1_type : ts.Diagnostics.Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage;
break;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
var param = declaration;
if (ts.isIdentifier(param.name) &&
(ts.isCallSignatureDeclaration(param.parent) || ts.isMethodSignature(param.parent) || ts.isFunctionTypeNode(param.parent)) &&
@@ -44309,30 +45091,30 @@
noImplicitAny ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage :
noImplicitAny ? ts.Diagnostics.Parameter_0_implicitly_has_an_1_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage;
break;
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type;
if (!noImplicitAny) {
// Don't issue a suggestion for binding elements since the codefix doesn't yet support them.
return;
}
break;
- case 294 /* JSDocFunctionType */:
+ case 295 /* JSDocFunctionType */:
error(declaration, ts.Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);
return;
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
if (noImplicitAny && !declaration.name) {
error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);
return;
}
diagnostic = noImplicitAny ? ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type : ts.Diagnostics._0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage;
break;
- case 181 /* MappedType */:
+ case 182 /* MappedType */:
if (noImplicitAny) {
error(declaration, ts.Diagnostics.Mapped_object_type_implicitly_has_an_any_template_type);
}
@@ -44452,7 +45234,7 @@
var objectFlags = ts.getObjectFlags(type);
return !!(type.flags & 63176704 /* Instantiable */ ||
objectFlags & 4 /* Reference */ && ts.forEach(type.typeArguments, couldContainTypeVariables) ||
- objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 2048 /* TypeLiteral */ | 32 /* Class */) ||
+ objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations ||
objectFlags & 32 /* Mapped */ ||
type.flags & 3145728 /* UnionOrIntersection */ && couldUnionOrIntersectionContainTypeVariables(type));
}
@@ -44500,10 +45282,18 @@
reverseMappedCache.set(key, type);
return type;
}
+ // We consider a type to be partially inferable if it isn't marked non-inferable or if it is
+ // an object literal type with at least one property of an inferable type. For example, an object
+ // literal { a: 123, b: x => true } is marked non-inferable because it contains a context sensitive
+ // arrow function, but is considered partially inferable because property 'a' has an inferable type.
+ function isPartiallyInferableType(type) {
+ return !(ts.getObjectFlags(type) & 524288 /* NonInferrableType */) ||
+ isObjectLiteralType(type) && ts.some(getPropertiesOfType(type), function (prop) { return isPartiallyInferableType(getTypeOfSymbol(prop)); });
+ }
function createReverseMappedType(source, target, constraint) {
- // If any property contains context sensitive functions that have been skipped, the source type
- // is incomplete and we can't infer a meaningful input type.
- if (ts.getObjectFlags(source) & 524288 /* NonInferrableType */ || getPropertiesOfType(source).length === 0 && !getIndexInfoOfType(source, 0 /* String */)) {
+ // We consider a source type reverse mappable if it has a string index signature or if
+ // it has one or more properties and is of a partially inferable type.
+ if (!(getIndexInfoOfType(source, 0 /* String */) || getPropertiesOfType(source).length !== 0 && isPartiallyInferableType(source))) {
return undefined;
}
// For arrays and tuples we infer new arrays and tuples where the reverse mapping has been
@@ -44533,20 +45323,20 @@
var templateType = getTemplateTypeFromMappedType(target);
var inference = createInferenceInfo(typeParameter);
inferTypes([inference], sourceType, templateType);
- return getTypeFromInference(inference);
+ return getTypeFromInference(inference) || unknownType;
}
function getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties) {
- var properties, _i, properties_3, targetProp, sourceProp, targetType, sourceType;
+ var properties, _i, properties_2, targetProp, sourceProp, targetType, sourceType;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
- properties = target.flags & 2097152 /* Intersection */ ? getPropertiesOfUnionOrIntersectionType(target) : getPropertiesOfObjectType(target);
- _i = 0, properties_3 = properties;
+ properties = target.flags & 1048576 /* Union */ ? getPossiblePropertiesOfUnionType(target) : getPropertiesOfType(target);
+ _i = 0, properties_2 = properties;
_a.label = 1;
case 1:
- if (!(_i < properties_3.length)) return [3 /*break*/, 6];
- targetProp = properties_3[_i];
- if (!(requireOptionalProperties || !(targetProp.flags & 16777216 /* Optional */))) return [3 /*break*/, 5];
+ if (!(_i < properties_2.length)) return [3 /*break*/, 6];
+ targetProp = properties_2[_i];
+ if (!(requireOptionalProperties || !(targetProp.flags & 16777216 /* Optional */ || ts.getCheckFlags(targetProp) & 48 /* Partial */))) return [3 /*break*/, 5];
sourceProp = getPropertyOfType(source, targetProp.escapedName);
if (!!sourceProp) return [3 /*break*/, 3];
return [4 /*yield*/, targetProp];
@@ -44587,7 +45377,7 @@
function getTypeFromInference(inference) {
return inference.candidates ? getUnionType(inference.candidates, 2 /* Subtype */) :
inference.contraCandidates ? getIntersectionType(inference.contraCandidates) :
- emptyObjectType;
+ undefined;
}
function inferTypes(inferences, originalSource, originalTarget, priority, contravariant) {
if (priority === void 0) { priority = 0; }
@@ -44661,6 +45451,9 @@
target = removeTypesFromUnionOrIntersection(target, matchingTypes);
}
}
+ else if (target.flags & (8388608 /* IndexedAccess */ | 33554432 /* Substitution */)) {
+ target = getActualTypeVariable(target);
+ }
if (target.flags & 8650752 /* TypeVariable */) {
// If target is a type parameter, make an inference, unless the source type contains
// the anyFunctionType (the wildcard type that's used to avoid contextually typing functions).
@@ -44669,7 +45462,7 @@
// not contain anyFunctionType when we come back to this argument for its second round
// of inference. Also, we exclude inferences for silentNeverType (which is used as a wildcard
// when constructing types from type parameters that had no inference candidates).
- if (ts.getObjectFlags(source) & 524288 /* NonInferrableType */ || source === silentNeverType || (priority & 8 /* ReturnType */ && (source === autoType || source === autoArrayType))) {
+ if (ts.getObjectFlags(source) & 524288 /* NonInferrableType */ || source === silentNeverType || (priority & 16 /* ReturnType */ && (source === autoType || source === autoArrayType))) {
return;
}
var inference = getInferenceInfoForType(target);
@@ -44696,7 +45489,7 @@
inference.inferredType = undefined;
}
}
- if (!(priority & 8 /* ReturnType */) && target.flags & 262144 /* TypeParameter */ && inference.topLevel && !isTypeParameterAtTopLevel(originalTarget, target)) {
+ if (!(priority & 16 /* ReturnType */) && target.flags & 262144 /* TypeParameter */ && inference.topLevel && !isTypeParameterAtTopLevel(originalTarget, target)) {
inference.topLevel = false;
inference.inferredType = undefined;
}
@@ -44705,16 +45498,16 @@
}
else {
// Infer to the simplified version of an indexed access, if possible, to (hopefully) expose more bare type parameters to the inference engine
- var simplified = getSimplifiedType(target);
+ var simplified = getSimplifiedType(target, /*writing*/ false);
if (simplified !== target) {
inferFromTypesOnce(source, simplified);
}
else if (target.flags & 8388608 /* IndexedAccess */) {
- var indexType = getSimplifiedType(target.indexType);
+ var indexType = getSimplifiedType(target.indexType, /*writing*/ false);
// Generally simplifications of instantiable indexes are avoided to keep relationship checking correct, however if our target is an access, we can consider
// that key of that access to be "instantiated", since we're looking to find the infernce goal in any way we can.
if (indexType.flags & 63176704 /* Instantiable */) {
- var simplified_1 = distributeIndexOverObjectType(getSimplifiedType(target.objectType), indexType);
+ var simplified_1 = distributeIndexOverObjectType(getSimplifiedType(target.objectType, /*writing*/ false), indexType, /*writing*/ false);
if (simplified_1 && simplified_1 !== target) {
inferFromTypesOnce(source, simplified_1);
}
@@ -44722,9 +45515,6 @@
}
}
}
- else if (target.flags & 33554432 /* Substitution */) {
- inferFromTypes(source, target.typeVariable);
- }
if (ts.getObjectFlags(source) & 4 /* Reference */ && ts.getObjectFlags(target) & 4 /* Reference */ && source.target === target.target) {
// If source and target are references to the same generic type, infer from type arguments
var sourceTypes = source.typeArguments || ts.emptyArray;
@@ -44732,7 +45522,7 @@
var count = sourceTypes.length < targetTypes.length ? sourceTypes.length : targetTypes.length;
var variances = getVariances(source.target);
for (var i = 0; i < count; i++) {
- if (i < variances.length && variances[i] === 2 /* Contravariant */) {
+ if (i < variances.length && (variances[i] & 7 /* VarianceMask */) === 2 /* Contravariant */) {
inferFromContravariantTypes(sourceTypes[i], targetTypes[i]);
}
else {
@@ -44749,7 +45539,7 @@
var empty = createEmptyObjectTypeFromStringLiteral(source);
contravariant = !contravariant;
var savePriority = priority;
- priority |= 16 /* LiteralKeyof */;
+ priority |= 32 /* LiteralKeyof */;
inferFromTypes(empty, target.type);
priority = savePriority;
contravariant = !contravariant;
@@ -44761,12 +45551,12 @@
else if (source.flags & 16777216 /* Conditional */ && target.flags & 16777216 /* Conditional */) {
inferFromTypes(source.checkType, target.checkType);
inferFromTypes(source.extendsType, target.extendsType);
- inferFromTypes(source.trueType, target.trueType);
- inferFromTypes(source.falseType, target.falseType);
+ inferFromTypes(getTrueTypeFromConditionalType(source), getTrueTypeFromConditionalType(target));
+ inferFromTypes(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target));
}
else if (target.flags & 16777216 /* Conditional */ && !contravariant) {
- inferFromTypes(source, target.trueType);
- inferFromTypes(source, target.falseType);
+ inferFromTypes(source, getTrueTypeFromConditionalType(target));
+ inferFromTypes(source, getFalseTypeFromConditionalType(target));
}
else if (target.flags & 3145728 /* UnionOrIntersection */) {
// We infer from types that are not naked type variables first so that inferences we
@@ -44807,7 +45597,7 @@
}
}
else {
- if (!(priority & 32 /* NoConstraints */ && source.flags & (2097152 /* Intersection */ | 63176704 /* Instantiable */))) {
+ if (!(priority & 64 /* NoConstraints */ && source.flags & (2097152 /* Intersection */ | 63176704 /* Instantiable */))) {
var apparentSource = getApparentType(source);
// getApparentType can return _any_ type, since an indexed access or conditional may simplify to any other type.
// If that occurs and it doesn't simplify to an object or intersection, we'll need to restart `inferFromTypes`
@@ -44860,7 +45650,7 @@
}
}
function inferFromContravariantTypes(source, target) {
- if (strictFunctionTypes || priority & 64 /* AlwaysStrict */) {
+ if (strictFunctionTypes || priority & 128 /* AlwaysStrict */) {
contravariant = !contravariant;
inferFromTypes(source, target);
contravariant = !contravariant;
@@ -44899,7 +45689,11 @@
var inferredType = inferTypeForHomomorphicMappedType(source, target, constraintType);
if (inferredType) {
var savePriority = priority;
- priority |= 2 /* HomomorphicMappedType */;
+ // We assign a lower priority to inferences made from types containing non-inferrable
+ // types because we may only have a partial result (i.e. we may have failed to make
+ // reverse inferences for some properties).
+ priority |= ts.getObjectFlags(source) & 524288 /* NonInferrableType */ ?
+ 4 /* PartialHomomorphicMappedType */ : 2 /* HomomorphicMappedType */;
inferFromTypes(inferredType, inference.typeParameter);
priority = savePriority;
}
@@ -44910,7 +45704,7 @@
// We're inferring from some source type S to a mapped type { [P in K]: X }, where K is a type
// parameter. First infer from 'keyof S' to K.
var savePriority = priority;
- priority |= 4 /* MappedTypeConstraint */;
+ priority |= 8 /* MappedTypeConstraint */;
inferFromTypes(getIndexType(source), constraintType);
priority = savePriority;
// If K is constrained to a type C, also infer to C. Thus, for a mapped type { [P in K]: X },
@@ -44923,11 +45717,11 @@
}
// If no inferences can be made to K's constraint, infer from a union of the property types
// in the source to the template type X.
- var valueTypes = ts.compact([
- getIndexTypeOfType(source, 0 /* String */),
- getIndexTypeOfType(source, 1 /* Number */)
- ].concat(ts.map(getPropertiesOfType(source), getTypeOfSymbol)));
- inferFromTypes(getUnionType(valueTypes), getTemplateTypeFromMappedType(target));
+ var propTypes = ts.map(getPropertiesOfType(source), getTypeOfSymbol);
+ var stringIndexType = getIndexTypeOfType(source, 0 /* String */);
+ var numberIndexInfo = getNonEnumNumberIndexInfo(source);
+ var numberIndexType = numberIndexInfo && numberIndexInfo.type;
+ inferFromTypes(getUnionType(ts.append(ts.append(propTypes, stringIndexType), numberIndexType)), getTemplateTypeFromMappedType(target));
return true;
}
return false;
@@ -44981,8 +45775,8 @@
}
}
var properties = getPropertiesOfObjectType(target);
- for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) {
- var targetProp = properties_4[_i];
+ for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) {
+ var targetProp = properties_3[_i];
var sourceProp = getPropertyOfType(source, targetProp.escapedName);
if (sourceProp) {
inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp));
@@ -45005,7 +45799,7 @@
var saveBivariant = bivariant;
var kind = target.declaration ? target.declaration.kind : 0 /* Unknown */;
// Once we descend into a bivariant signature we remain bivariant for all nested inferences
- bivariant = bivariant || kind === 156 /* MethodDeclaration */ || kind === 155 /* MethodSignature */ || kind === 157 /* Constructor */;
+ bivariant = bivariant || kind === 157 /* MethodDeclaration */ || kind === 156 /* MethodSignature */ || kind === 158 /* Constructor */;
applyToParameterTypes(source, target, inferFromContravariantTypes);
bivariant = saveBivariant;
}
@@ -45072,7 +45866,7 @@
return candidates;
}
function getContravariantInference(inference) {
- return inference.priority & 28 /* PriorityImpliesCombination */ ? getIntersectionType(inference.contraCandidates) : getCommonSubtype(inference.contraCandidates);
+ return inference.priority & 56 /* PriorityImpliesCombination */ ? getIntersectionType(inference.contraCandidates) : getCommonSubtype(inference.contraCandidates);
}
function getCovariantInference(inference, signature) {
// Extract all object literal types and replace them with a single widened and normalized type.
@@ -45089,15 +45883,15 @@
candidates;
// If all inferences were made from a position that implies a combined result, infer a union type.
// Otherwise, infer a common supertype.
- var unwidenedType = inference.priority & 28 /* PriorityImpliesCombination */ ?
+ var unwidenedType = inference.priority & 56 /* PriorityImpliesCombination */ ?
getUnionType(baseCandidates, 2 /* Subtype */) :
getCommonSupertype(baseCandidates);
return getWidenedType(unwidenedType);
}
function getInferredType(context, index) {
var inference = context.inferences[index];
- var inferredType = inference.inferredType;
- if (!inferredType) {
+ if (!inference.inferredType) {
+ var inferredType = void 0;
var signature = context.signature;
if (signature) {
var inferredCovariantType = inference.candidates ? getCovariantInference(inference, signature) : undefined;
@@ -45128,27 +45922,24 @@
// parameter should be instantiated to the empty object type.
inferredType = instantiateType(defaultType, combineTypeMappers(createBackreferenceMapper(context, index), context.nonFixingMapper));
}
- else {
- inferredType = getDefaultTypeArgumentType(!!(context.flags & 2 /* AnyDefault */));
- }
}
}
else {
inferredType = getTypeFromInference(inference);
}
- inference.inferredType = inferredType;
+ inference.inferredType = inferredType || getDefaultTypeArgumentType(!!(context.flags & 2 /* AnyDefault */));
var constraint = getConstraintOfTypeParameter(inference.typeParameter);
if (constraint) {
var instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
- if (!context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
+ if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
inference.inferredType = inferredType = instantiatedConstraint;
}
}
}
- return inferredType;
+ return inference.inferredType;
}
function getDefaultTypeArgumentType(isInJavaScriptFile) {
- return isInJavaScriptFile ? anyType : emptyObjectType;
+ return isInJavaScriptFile ? anyType : unknownType;
}
function getInferredTypes(context) {
var result = [];
@@ -45158,8 +45949,8 @@
return result;
}
// EXPRESSION TYPE CHECKING
- function getCannotFindNameDiagnosticForName(name) {
- switch (name) {
+ function getCannotFindNameDiagnosticForName(node) {
+ switch (node.escapedText) {
case "document":
case "console":
return ts.Diagnostics.Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_include_dom;
@@ -45190,14 +45981,20 @@
case "Iterator":
case "AsyncIterator":
return ts.Diagnostics.Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later;
- default: return ts.Diagnostics.Cannot_find_name_0;
+ default:
+ if (node.parent.kind === 277 /* ShorthandPropertyAssignment */) {
+ return ts.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer;
+ }
+ else {
+ return ts.Diagnostics.Cannot_find_name_0;
+ }
}
}
function getResolvedSymbol(node) {
var links = getNodeLinks(node);
if (!links.resolvedSymbol) {
links.resolvedSymbol = !ts.nodeIsMissing(node) &&
- resolveName(node, node.escapedText, 67220415 /* Value */ | 1048576 /* ExportValue */, getCannotFindNameDiagnosticForName(node.escapedText), node, !ts.isWriteOnlyAccess(node),
+ resolveName(node, node.escapedText, 67220415 /* Value */ | 1048576 /* ExportValue */, getCannotFindNameDiagnosticForName(node), node, !ts.isWriteOnlyAccess(node),
/*excludeGlobals*/ false, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_1) || unknownSymbol;
}
return links.resolvedSymbol;
@@ -45206,7 +46003,7 @@
// TypeScript 1.0 spec (April 2014): 3.6.3
// A type query consists of the keyword typeof followed by an expression.
// The expression is restricted to a single identifier or a sequence of identifiers separated by periods
- return !!ts.findAncestor(node, function (n) { return n.kind === 167 /* TypeQuery */ ? true : n.kind === 72 /* Identifier */ || n.kind === 148 /* QualifiedName */ ? false : "quit"; });
+ return !!ts.findAncestor(node, function (n) { return n.kind === 168 /* TypeQuery */ ? true : n.kind === 73 /* Identifier */ || n.kind === 149 /* QualifiedName */ ? false : "quit"; });
}
// Return the flow cache key for a "dotted name" (i.e. a sequence of identifiers
// separated by dots). The key consists of the id of the symbol referenced by the
@@ -45214,21 +46011,21 @@
// The result is undefined if the reference isn't a dotted name. We prefix nodes
// occurring in an apparent type position with '@' because the control flow type
// of such nodes may be based on the apparent type instead of the declared type.
- function getFlowCacheKey(node) {
+ function getFlowCacheKey(node, declaredType, initialType, flowContainer) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
var symbol = getResolvedSymbol(node);
- return symbol !== unknownSymbol ? (isConstraintPosition(node) ? "@" : "") + getSymbolId(symbol) : undefined;
- case 100 /* ThisKeyword */:
+ return symbol !== unknownSymbol ? (flowContainer ? getNodeId(flowContainer) : "-1") + "|" + getTypeId(declaredType) + "|" + getTypeId(initialType) + "|" + (isConstraintPosition(node) ? "@" : "") + getSymbolId(symbol) : undefined;
+ case 101 /* ThisKeyword */:
return "0";
- case 213 /* NonNullExpression */:
- case 195 /* ParenthesizedExpression */:
- return getFlowCacheKey(node.expression);
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 214 /* NonNullExpression */:
+ case 196 /* ParenthesizedExpression */:
+ return getFlowCacheKey(node.expression, declaredType, initialType, flowContainer);
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
var propName = getAccessedPropertyName(node);
if (propName !== undefined) {
- var key = getFlowCacheKey(node.expression);
+ var key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer);
return key && key + "." + propName;
}
}
@@ -45236,24 +46033,24 @@
}
function isMatchingReference(source, target) {
switch (target.kind) {
- case 195 /* ParenthesizedExpression */:
- case 213 /* NonNullExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 214 /* NonNullExpression */:
return isMatchingReference(source, target.expression);
}
switch (source.kind) {
- case 72 /* Identifier */:
- return target.kind === 72 /* Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) ||
- (target.kind === 237 /* VariableDeclaration */ || target.kind === 186 /* BindingElement */) &&
+ case 73 /* Identifier */:
+ return target.kind === 73 /* Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) ||
+ (target.kind === 238 /* VariableDeclaration */ || target.kind === 187 /* BindingElement */) &&
getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target);
- case 100 /* ThisKeyword */:
- return target.kind === 100 /* ThisKeyword */;
- case 98 /* SuperKeyword */:
- return target.kind === 98 /* SuperKeyword */;
- case 213 /* NonNullExpression */:
- case 195 /* ParenthesizedExpression */:
+ case 101 /* ThisKeyword */:
+ return target.kind === 101 /* ThisKeyword */;
+ case 99 /* SuperKeyword */:
+ return target.kind === 99 /* SuperKeyword */;
+ case 214 /* NonNullExpression */:
+ case 196 /* ParenthesizedExpression */:
return isMatchingReference(source.expression, target);
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return ts.isAccessExpression(target) &&
getAccessedPropertyName(source) === getAccessedPropertyName(target) &&
isMatchingReference(source.expression, target.expression);
@@ -45261,7 +46058,7 @@
return false;
}
function getAccessedPropertyName(access) {
- return access.kind === 189 /* PropertyAccessExpression */ ? access.name.escapedText :
+ return access.kind === 190 /* PropertyAccessExpression */ ? access.name.escapedText :
ts.isStringLiteral(access.argumentExpression) || ts.isNumericLiteral(access.argumentExpression) ? ts.escapeLeadingUnderscores(access.argumentExpression.text) :
undefined;
}
@@ -45286,7 +46083,7 @@
isDiscriminantProperty(getDeclaredTypeOfReference(target.expression), name);
}
function getDeclaredTypeOfReference(expr) {
- if (expr.kind === 72 /* Identifier */) {
+ if (expr.kind === 73 /* Identifier */) {
return getTypeOfSymbol(getResolvedSymbol(expr));
}
if (ts.isAccessExpression(expr)) {
@@ -45308,7 +46105,7 @@
if (prop && ts.getCheckFlags(prop) & 2 /* SyntheticProperty */) {
if (prop.isDiscriminantProperty === undefined) {
prop.isDiscriminantProperty =
- (prop.checkFlags & 96 /* Discriminant */) === 96 /* Discriminant */ &&
+ (prop.checkFlags & 192 /* Discriminant */) === 192 /* Discriminant */ &&
isDiscriminantType(getTypeOfSymbol(prop));
}
return !!prop.isDiscriminantProperty;
@@ -45317,7 +46114,7 @@
return false;
}
function isSyntheticThisPropertyAccess(expr) {
- return ts.isAccessExpression(expr) && expr.expression.kind === 100 /* ThisKeyword */ && !!(expr.expression.flags & 8 /* Synthesized */);
+ return ts.isAccessExpression(expr) && expr.expression.kind === 101 /* ThisKeyword */ && !!(expr.expression.flags & 8 /* Synthesized */);
}
function findDiscriminantProperties(sourceProperties, target) {
var result;
@@ -45345,7 +46142,7 @@
}
}
}
- if (callExpression.expression.kind === 189 /* PropertyAccessExpression */ &&
+ if (callExpression.expression.kind === 190 /* PropertyAccessExpression */ &&
isOrContainsMatchingReference(reference, callExpression.expression.expression)) {
return true;
}
@@ -45464,7 +46261,7 @@
return strictNullChecks ? 7888800 /* ObjectStrictFacts */ : 16736160 /* ObjectFacts */;
}
if (flags & 63176704 /* Instantiable */) {
- return getTypeFacts(getBaseConstraintOfType(type) || emptyObjectType);
+ return getTypeFacts(getBaseConstraintOfType(type) || unknownType);
}
if (flags & 3145728 /* UnionOrIntersection */) {
return getTypeFactsOfTypes(type.types);
@@ -45500,15 +46297,15 @@
return createArrayType(checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false, /*allowAsyncIterables*/ false) || errorType);
}
function getAssignedTypeOfBinaryExpression(node) {
- var isDestructuringDefaultAssignment = node.parent.kind === 187 /* ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) ||
- node.parent.kind === 275 /* PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent);
+ var isDestructuringDefaultAssignment = node.parent.kind === 188 /* ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) ||
+ node.parent.kind === 276 /* PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent);
return isDestructuringDefaultAssignment ?
getTypeWithDefault(getAssignedType(node), node.right) :
getTypeOfExpression(node.right);
}
function isDestructuringAssignmentTarget(parent) {
- return parent.parent.kind === 204 /* BinaryExpression */ && parent.parent.left === parent ||
- parent.parent.kind === 227 /* ForOfStatement */ && parent.parent.initializer === parent;
+ return parent.parent.kind === 205 /* BinaryExpression */ && parent.parent.left === parent ||
+ parent.parent.kind === 228 /* ForOfStatement */ && parent.parent.initializer === parent;
}
function getAssignedTypeOfArrayLiteralElement(node, element) {
return getTypeOfDestructuredArrayElement(getAssignedType(node), node.elements.indexOf(element));
@@ -45525,21 +46322,21 @@
function getAssignedType(node) {
var parent = node.parent;
switch (parent.kind) {
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return stringType;
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return checkRightHandSideOfForOf(parent.expression, parent.awaitModifier) || errorType;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return getAssignedTypeOfBinaryExpression(parent);
- case 198 /* DeleteExpression */:
+ case 199 /* DeleteExpression */:
return undefinedType;
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return getAssignedTypeOfArrayLiteralElement(parent, node);
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
return getAssignedTypeOfSpreadExpression(parent);
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return getAssignedTypeOfPropertyAssignment(parent);
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return getAssignedTypeOfShorthandPropertyAssignment(parent);
}
return errorType;
@@ -45547,7 +46344,7 @@
function getInitialTypeOfBindingElement(node) {
var pattern = node.parent;
var parentType = getInitialType(pattern.parent);
- var type = pattern.kind === 184 /* ObjectBindingPattern */ ?
+ var type = pattern.kind === 185 /* ObjectBindingPattern */ ?
getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) :
!node.dotDotDotToken ?
getTypeOfDestructuredArrayElement(parentType, pattern.elements.indexOf(node)) :
@@ -45565,37 +46362,37 @@
if (node.initializer) {
return getTypeOfInitializer(node.initializer);
}
- if (node.parent.parent.kind === 226 /* ForInStatement */) {
+ if (node.parent.parent.kind === 227 /* ForInStatement */) {
return stringType;
}
- if (node.parent.parent.kind === 227 /* ForOfStatement */) {
+ if (node.parent.parent.kind === 228 /* ForOfStatement */) {
return checkRightHandSideOfForOf(node.parent.parent.expression, node.parent.parent.awaitModifier) || errorType;
}
return errorType;
}
function getInitialType(node) {
- return node.kind === 237 /* VariableDeclaration */ ?
+ return node.kind === 238 /* VariableDeclaration */ ?
getInitialTypeOfVariableDeclaration(node) :
getInitialTypeOfBindingElement(node);
}
function getInitialOrAssignedType(node, reference) {
- return getConstraintForLocation(node.kind === 237 /* VariableDeclaration */ || node.kind === 186 /* BindingElement */ ?
+ return getConstraintForLocation(node.kind === 238 /* VariableDeclaration */ || node.kind === 187 /* BindingElement */ ?
getInitialType(node) :
getAssignedType(node), reference);
}
function isEmptyArrayAssignment(node) {
- return node.kind === 237 /* VariableDeclaration */ && node.initializer &&
+ return node.kind === 238 /* VariableDeclaration */ && node.initializer &&
isEmptyArrayLiteral(node.initializer) ||
- node.kind !== 186 /* BindingElement */ && node.parent.kind === 204 /* BinaryExpression */ &&
+ node.kind !== 187 /* BindingElement */ && node.parent.kind === 205 /* BinaryExpression */ &&
isEmptyArrayLiteral(node.parent.right);
}
function getReferenceCandidate(node) {
switch (node.kind) {
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return getReferenceCandidate(node.expression);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
switch (node.operatorToken.kind) {
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
return getReferenceCandidate(node.left);
case 27 /* CommaToken */:
return getReferenceCandidate(node.right);
@@ -45605,13 +46402,13 @@
}
function getReferenceRoot(node) {
var parent = node.parent;
- return parent.kind === 195 /* ParenthesizedExpression */ ||
- parent.kind === 204 /* BinaryExpression */ && parent.operatorToken.kind === 59 /* EqualsToken */ && parent.left === node ||
- parent.kind === 204 /* BinaryExpression */ && parent.operatorToken.kind === 27 /* CommaToken */ && parent.right === node ?
+ return parent.kind === 196 /* ParenthesizedExpression */ ||
+ parent.kind === 205 /* BinaryExpression */ && parent.operatorToken.kind === 60 /* EqualsToken */ && parent.left === node ||
+ parent.kind === 205 /* BinaryExpression */ && parent.operatorToken.kind === 27 /* CommaToken */ && parent.right === node ?
getReferenceRoot(parent) : node;
}
function getTypeOfSwitchClause(clause) {
- if (clause.kind === 271 /* CaseClause */) {
+ if (clause.kind === 272 /* CaseClause */) {
return getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression));
}
return neverType;
@@ -45633,7 +46430,7 @@
var witnesses = [];
for (var _i = 0, _a = switchStatement.caseBlock.clauses; _i < _a.length; _i++) {
var clause = _a[_i];
- if (clause.kind === 271 /* CaseClause */) {
+ if (clause.kind === 272 /* CaseClause */) {
if (clause.expression.kind === 10 /* StringLiteral */) {
witnesses.push(clause.expression.text);
continue;
@@ -45679,6 +46476,9 @@
}
return f(type) ? type : neverType;
}
+ function countTypes(type) {
+ return type.flags & 1048576 /* Union */ ? type.types.length : 1;
+ }
function mapType(type, mapper, noReductions) {
if (type.flags & 131072 /* Never */) {
return type;
@@ -45686,25 +46486,20 @@
if (!(type.flags & 1048576 /* Union */)) {
return mapper(type);
}
- var types = type.types;
- var mappedType;
var mappedTypes;
- for (var _i = 0, types_13 = types; _i < types_13.length; _i++) {
- var current = types_13[_i];
- var t = mapper(current);
- if (t) {
- if (!mappedType) {
- mappedType = t;
- }
- else if (!mappedTypes) {
- mappedTypes = [mappedType, t];
+ for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
+ var t = _a[_i];
+ var mapped = mapper(t);
+ if (mapped) {
+ if (!mappedTypes) {
+ mappedTypes = [mapped];
}
else {
- mappedTypes.push(t);
+ mappedTypes.push(mapped);
}
}
}
- return mappedTypes ? getUnionType(mappedTypes, noReductions ? 0 /* None */ : 1 /* Literal */) : mappedType;
+ return mappedTypes && getUnionType(mappedTypes, noReductions ? 0 /* None */ : 1 /* Literal */);
}
function extractTypesOfKind(type, kind) {
return filterType(type, function (t) { return (t.flags & kind) !== 0; });
@@ -45772,8 +46567,8 @@
}
function isEvolvingArrayTypeList(types) {
var hasEvolvingArrayType = false;
- for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
- var t = types_14[_i];
+ for (var _i = 0, types_13 = types; _i < types_13.length; _i++) {
+ var t = types_13[_i];
if (!(t.flags & 131072 /* Never */)) {
if (!(ts.getObjectFlags(t) & 256 /* EvolvingArray */)) {
return false;
@@ -45796,12 +46591,12 @@
function isEvolvingArrayOperationTarget(node) {
var root = getReferenceRoot(node);
var parent = root.parent;
- var isLengthPushOrUnshift = parent.kind === 189 /* PropertyAccessExpression */ && (parent.name.escapedText === "length" ||
- parent.parent.kind === 191 /* CallExpression */ && ts.isPushOrUnshiftIdentifier(parent.name));
- var isElementAssignment = parent.kind === 190 /* ElementAccessExpression */ &&
+ var isLengthPushOrUnshift = parent.kind === 190 /* PropertyAccessExpression */ && (parent.name.escapedText === "length" ||
+ parent.parent.kind === 192 /* CallExpression */ && ts.isPushOrUnshiftIdentifier(parent.name));
+ var isElementAssignment = parent.kind === 191 /* ElementAccessExpression */ &&
parent.expression === root &&
- parent.parent.kind === 204 /* BinaryExpression */ &&
- parent.parent.operatorToken.kind === 59 /* EqualsToken */ &&
+ parent.parent.kind === 205 /* BinaryExpression */ &&
+ parent.parent.operatorToken.kind === 60 /* EqualsToken */ &&
parent.parent.left === parent &&
!ts.isAssignmentTarget(parent.parent) &&
isTypeAssignableToKind(getTypeOfExpression(parent.argumentExpression), 296 /* NumberLike */);
@@ -45815,7 +46610,7 @@
return links.maybeTypePredicate;
}
function getMaybeTypePredicate(node) {
- if (node.expression.kind !== 98 /* SuperKeyword */) {
+ if (node.expression.kind !== 99 /* SuperKeyword */) {
var funcType = checkNonNullExpression(node.expression);
if (funcType !== silentNeverType) {
var apparentType = getApparentType(funcType);
@@ -45833,6 +46628,7 @@
function getFlowTypeOfReference(reference, declaredType, initialType, flowContainer, couldBeUninitialized) {
if (initialType === void 0) { initialType = declaredType; }
var key;
+ var keySet = false;
var flowDepth = 0;
if (flowAnalysisDisabled) {
return errorType;
@@ -45848,10 +46644,17 @@
// on empty arrays are possible without implicit any errors and new element types can be inferred without
// type mismatch errors.
var resultType = ts.getObjectFlags(evolvedType) & 256 /* EvolvingArray */ && isEvolvingArrayOperationTarget(reference) ? autoArrayType : finalizeEvolvingArrayType(evolvedType);
- if (reference.parent && reference.parent.kind === 213 /* NonNullExpression */ && getTypeWithFacts(resultType, 2097152 /* NEUndefinedOrNull */).flags & 131072 /* Never */) {
+ if (reference.parent && reference.parent.kind === 214 /* NonNullExpression */ && getTypeWithFacts(resultType, 2097152 /* NEUndefinedOrNull */).flags & 131072 /* Never */) {
return declaredType;
}
return resultType;
+ function getOrSetCacheKey() {
+ if (keySet) {
+ return key;
+ }
+ keySet = true;
+ return key = getFlowCacheKey(reference, declaredType, initialType, flowContainer);
+ }
function getTypeAtFlowNode(flow) {
if (flowDepth === 2000) {
// We have made 2000 recursive invocations. To avoid overflowing the call stack we report an error
@@ -45863,6 +46666,15 @@
flowDepth++;
while (true) {
var flags = flow.flags;
+ if (flags & 8192 /* Cached */) {
+ var key_2 = getOrSetCacheKey();
+ if (key_2) {
+ var id = getFlowNodeId(flow);
+ if (flowAssignmentKeys[id] === key_2) {
+ return flowAssignmentTypes[id];
+ }
+ }
+ }
if (flags & 1024 /* Shared */) {
// We cache results of flow type resolution for shared nodes that were previously visited in
// the same getFlowTypeOfReference invocation. A node is considered shared when it is the
@@ -45893,6 +46705,15 @@
flow = flow.antecedent;
continue;
}
+ else if (flowLoopCount === flowLoopStart) { // Only cache assignments when not within loop analysis
+ var key_3 = getOrSetCacheKey();
+ if (key_3 && !isIncomplete(type)) {
+ flow.flags |= 8192 /* Cached */;
+ var id = getFlowNodeId(flow);
+ flowAssignmentKeys[id] = key_3;
+ flowAssignmentTypes[id] = type;
+ }
+ }
}
else if (flags & 96 /* Condition */) {
type = getTypeAtFlowCondition(flow);
@@ -45920,9 +46741,9 @@
// Check if we should continue with the control flow of the containing function.
var container = flow.container;
if (container && container !== flowContainer &&
- reference.kind !== 189 /* PropertyAccessExpression */ &&
- reference.kind !== 190 /* ElementAccessExpression */ &&
- reference.kind !== 100 /* ThisKeyword */) {
+ reference.kind !== 190 /* PropertyAccessExpression */ &&
+ reference.kind !== 191 /* ElementAccessExpression */ &&
+ reference.kind !== 101 /* ThisKeyword */) {
flow = container.flowNode;
continue;
}
@@ -45974,14 +46795,14 @@
// in which case we continue control flow analysis back to the function's declaration
if (ts.isVariableDeclaration(node) && (ts.isInJSFile(node) || ts.isVarConst(node))) {
var init = ts.getDeclaredExpandoInitializer(node);
- if (init && (init.kind === 196 /* FunctionExpression */ || init.kind === 197 /* ArrowFunction */)) {
+ if (init && (init.kind === 197 /* FunctionExpression */ || init.kind === 198 /* ArrowFunction */)) {
return getTypeAtFlowNode(flow.antecedent);
}
}
return declaredType;
}
// for (const _ in ref) acts as a nonnull on ref
- if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 226 /* ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) {
+ if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 227 /* ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) {
return getNonNullableTypeIfNeeded(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent)));
}
// Assignment doesn't affect reference
@@ -45990,7 +46811,7 @@
function getTypeAtFlowArrayMutation(flow) {
if (declaredType === autoType || declaredType === autoArrayType) {
var node = flow.node;
- var expr = node.kind === 191 /* CallExpression */ ?
+ var expr = node.kind === 192 /* CallExpression */ ?
node.expression.expression :
node.left.expression;
if (isMatchingReference(reference, getReferenceCandidate(expr))) {
@@ -45998,7 +46819,7 @@
var type = getTypeFromFlowType(flowType);
if (ts.getObjectFlags(type) & 256 /* EvolvingArray */) {
var evolvedType_1 = type;
- if (node.kind === 191 /* CallExpression */) {
+ if (node.kind === 192 /* CallExpression */) {
for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) {
var arg = _a[_i];
evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg);
@@ -46051,7 +46872,7 @@
else if (isMatchingReferenceDiscriminant(expr, type)) {
type = narrowTypeByDiscriminant(type, expr, function (t) { return narrowTypeBySwitchOnDiscriminant(t, flow.switchStatement, flow.clauseStart, flow.clauseEnd); });
}
- else if (expr.kind === 199 /* TypeOfExpression */ && isMatchingReference(reference, expr.expression)) {
+ else if (expr.kind === 200 /* TypeOfExpression */ && isMatchingReference(reference, expr.expression)) {
type = narrowBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
}
else if (containsMatchingReferenceDiscriminant(reference, expr)) {
@@ -46098,13 +46919,11 @@
// this flow loop junction, return the cached type.
var id = getFlowNodeId(flow);
var cache = flowLoopCaches[id] || (flowLoopCaches[id] = ts.createMap());
+ var key = getOrSetCacheKey();
if (!key) {
- key = getFlowCacheKey(reference);
// No cache key is generated when binding patterns are in unnarrowable situations
- if (!key) {
return declaredType;
}
- }
var cached = cache.get(key);
if (cached) {
return cached;
@@ -46211,7 +47030,7 @@
return !assumeTrue;
}
function narrowByInKeyword(type, literal, assumeTrue) {
- if ((type.flags & (1048576 /* Union */ | 524288 /* Object */)) || (type.flags & 262144 /* TypeParameter */ && type.isThisType)) {
+ if (type.flags & (1048576 /* Union */ | 524288 /* Object */) || isThisTypeParameter(type)) {
var propName_1 = ts.escapeLeadingUnderscores(literal.text);
return filterType(type, function (t) { return isTypePresencePossible(t, propName_1, assumeTrue); });
}
@@ -46219,8 +47038,8 @@
}
function narrowTypeByBinaryExpression(type, expr, assumeTrue) {
switch (expr.operatorToken.kind) {
- case 59 /* EqualsToken */:
- return narrowTypeByTruthiness(type, expr.left, assumeTrue);
+ case 60 /* EqualsToken */:
+ return narrowTypeByTruthiness(narrowType(type, expr.right, assumeTrue), expr.left, assumeTrue);
case 33 /* EqualsEqualsToken */:
case 34 /* ExclamationEqualsToken */:
case 35 /* EqualsEqualsEqualsToken */:
@@ -46228,10 +47047,10 @@
var operator_1 = expr.operatorToken.kind;
var left_1 = getReferenceCandidate(expr.left);
var right_1 = getReferenceCandidate(expr.right);
- if (left_1.kind === 199 /* TypeOfExpression */ && ts.isStringLiteralLike(right_1)) {
+ if (left_1.kind === 200 /* TypeOfExpression */ && ts.isStringLiteralLike(right_1)) {
return narrowTypeByTypeof(type, left_1, operator_1, right_1, assumeTrue);
}
- if (right_1.kind === 199 /* TypeOfExpression */ && ts.isStringLiteralLike(left_1)) {
+ if (right_1.kind === 200 /* TypeOfExpression */ && ts.isStringLiteralLike(left_1)) {
return narrowTypeByTypeof(type, right_1, operator_1, left_1, assumeTrue);
}
if (isMatchingReference(reference, left_1)) {
@@ -46250,9 +47069,9 @@
return declaredType;
}
break;
- case 94 /* InstanceOfKeyword */:
+ case 95 /* InstanceOfKeyword */:
return narrowTypeByInstanceof(type, expr, assumeTrue);
- case 93 /* InKeyword */:
+ case 94 /* InKeyword */:
var target = getReferenceCandidate(expr.right);
if (ts.isStringLiteralLike(expr.left) && isMatchingReference(reference, target)) {
return narrowByInKeyword(type, expr.left, assumeTrue);
@@ -46296,7 +47115,10 @@
return type;
}
if (assumeTrue) {
- var narrowedType = filterType(type, function (t) { return areTypesComparable(t, valueType); });
+ var filterFn = operator === 33 /* EqualsEqualsToken */ ?
+ (function (t) { return areTypesComparable(t, valueType) || isCoercibleUnderDoubleEquals(t, valueType); }) :
+ function (t) { return areTypesComparable(t, valueType); };
+ var narrowedType = filterType(type, filterFn);
return narrowedType.flags & 131072 /* Never */ ? type : replacePrimitivesWithLiterals(narrowedType, valueType);
}
if (isUnitType(valueType)) {
@@ -46585,19 +47407,19 @@
// will be a subtype or the same type as the argument.
function narrowType(type, expr, assumeTrue) {
switch (expr.kind) {
- case 72 /* Identifier */:
- case 100 /* ThisKeyword */:
- case 98 /* SuperKeyword */:
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 73 /* Identifier */:
+ case 101 /* ThisKeyword */:
+ case 99 /* SuperKeyword */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return narrowTypeByTruthiness(type, expr, assumeTrue);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return narrowTypeByTypePredicate(type, expr, assumeTrue);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return narrowType(type, expr.expression, assumeTrue);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return narrowTypeByBinaryExpression(type, expr, assumeTrue);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
if (expr.operator === 52 /* ExclamationToken */) {
return narrowType(type, expr.operand, !assumeTrue);
}
@@ -46612,7 +47434,7 @@
// an dotted name expression, and if the location is not an assignment target, obtain the type
// of the expression (which will reflect control flow analysis). If the expression indeed
// resolved to the given symbol, return the narrowed type.
- if (location.kind === 72 /* Identifier */) {
+ if (location.kind === 73 /* Identifier */) {
if (ts.isRightSideOfQualifiedNameOrPropertyAccess(location)) {
location = location.parent;
}
@@ -46633,9 +47455,9 @@
function getControlFlowContainer(node) {
return ts.findAncestor(node.parent, function (node) {
return ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) ||
- node.kind === 245 /* ModuleBlock */ ||
- node.kind === 284 /* SourceFile */ ||
- node.kind === 154 /* PropertyDeclaration */;
+ node.kind === 246 /* ModuleBlock */ ||
+ node.kind === 285 /* SourceFile */ ||
+ node.kind === 155 /* PropertyDeclaration */;
});
}
// Check if a parameter is assigned anywhere within its declaring function.
@@ -46654,10 +47476,10 @@
return !!ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !!(getNodeLinks(node).flags & 8388608 /* AssignmentsMarked */); });
}
function markParameterAssignments(node) {
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
if (ts.isAssignmentTarget(node)) {
var symbol = getResolvedSymbol(node);
- if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 151 /* Parameter */) {
+ if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 152 /* Parameter */) {
symbol.isAssigned = true;
}
}
@@ -46672,7 +47494,7 @@
/** remove undefined from the annotated type of a parameter when there is an initializer (that doesn't include undefined) */
function removeOptionalityFromDeclaredType(declaredType, declaration) {
var annotationIncludesUndefined = strictNullChecks &&
- declaration.kind === 151 /* Parameter */ &&
+ declaration.kind === 152 /* Parameter */ &&
declaration.initializer &&
getFalsyFlags(declaredType) & 32768 /* Undefined */ &&
!(getFalsyFlags(checkExpression(declaration.initializer)) & 32768 /* Undefined */);
@@ -46680,13 +47502,13 @@
}
function isConstraintPosition(node) {
var parent = node.parent;
- return parent.kind === 189 /* PropertyAccessExpression */ ||
- parent.kind === 191 /* CallExpression */ && parent.expression === node ||
- parent.kind === 190 /* ElementAccessExpression */ && parent.expression === node ||
- parent.kind === 186 /* BindingElement */ && parent.name === node && !!parent.initializer;
+ return parent.kind === 190 /* PropertyAccessExpression */ ||
+ parent.kind === 192 /* CallExpression */ && parent.expression === node ||
+ parent.kind === 191 /* ElementAccessExpression */ && parent.expression === node ||
+ parent.kind === 187 /* BindingElement */ && parent.name === node && !!parent.initializer;
}
function typeHasNullableConstraint(type) {
- return type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || emptyObjectType, 98304 /* Nullable */);
+ return type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 98304 /* Nullable */);
}
function getConstraintForLocation(type, node) {
// When a node is the left hand expression of a property access, element access, or call expression,
@@ -46717,7 +47539,7 @@
if (symbol === argumentsSymbol) {
var container = ts.getContainingFunction(node);
if (languageVersion < 2 /* ES2015 */) {
- if (container.kind === 197 /* ArrowFunction */) {
+ if (container.kind === 198 /* ArrowFunction */) {
error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression);
}
else if (ts.hasModifier(container, 256 /* Async */)) {
@@ -46738,7 +47560,7 @@
// Due to the emit for class decorators, any reference to the class from inside of the class body
// must instead be rewritten to point to a temporary variable to avoid issues with the double-bind
// behavior of class names in ES6.
- if (declaration.kind === 240 /* ClassDeclaration */
+ if (declaration.kind === 241 /* ClassDeclaration */
&& ts.nodeIsDecorated(declaration)) {
var container = ts.getContainingClass(node);
while (container !== undefined) {
@@ -46750,14 +47572,14 @@
container = ts.getContainingClass(container);
}
}
- else if (declaration.kind === 209 /* ClassExpression */) {
+ else if (declaration.kind === 210 /* ClassExpression */) {
// When we emit a class expression with static members that contain a reference
// to the constructor in the initializer, we will need to substitute that
// binding with an alias as the class name is not in scope.
var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false);
- while (container.kind !== 284 /* SourceFile */) {
+ while (container.kind !== 285 /* SourceFile */) {
if (container.parent === declaration) {
- if (container.kind === 154 /* PropertyDeclaration */ && ts.hasModifier(container, 32 /* Static */)) {
+ if (container.kind === 155 /* PropertyDeclaration */ && ts.hasModifier(container, 32 /* Static */)) {
getNodeLinks(declaration).flags |= 16777216 /* ClassWithConstructorReference */;
getNodeLinks(node).flags |= 33554432 /* ConstructorReferenceInClass */;
}
@@ -46806,7 +47628,7 @@
// The declaration container is the innermost function that encloses the declaration of the variable
// or parameter. The flow container is the innermost function starting with which we analyze the control
// flow graph to determine the control flow based type.
- var isParameter = ts.getRootDeclaration(declaration).kind === 151 /* Parameter */;
+ var isParameter = ts.getRootDeclaration(declaration).kind === 152 /* Parameter */;
var declarationContainer = getControlFlowContainer(declaration);
var flowContainer = getControlFlowContainer(node);
var isOuterVariable = flowContainer !== declarationContainer;
@@ -46815,19 +47637,19 @@
// When the control flow originates in a function expression or arrow function and we are referencing
// a const variable or parameter from an outer function, we extend the origin of the control flow
// analysis to include the immediately enclosing function.
- while (flowContainer !== declarationContainer && (flowContainer.kind === 196 /* FunctionExpression */ ||
- flowContainer.kind === 197 /* ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) &&
+ while (flowContainer !== declarationContainer && (flowContainer.kind === 197 /* FunctionExpression */ ||
+ flowContainer.kind === 198 /* ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) &&
(isConstVariable(localOrExportSymbol) || isParameter && !isParameterAssigned(localOrExportSymbol))) {
flowContainer = getControlFlowContainer(flowContainer);
}
// We only look for uninitialized variables in strict null checking mode, and only when we can analyze
// the entire control flow graph from the variable's declaration (i.e. when the flow container and
// declaration container are the same).
- var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports ||
+ var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || ts.isBindingElement(declaration) ||
type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 3 /* AnyOrUnknown */) !== 0 ||
- isInTypeQuery(node) || node.parent.kind === 257 /* ExportSpecifier */) ||
- node.parent.kind === 213 /* NonNullExpression */ ||
- declaration.kind === 237 /* VariableDeclaration */ && declaration.exclamationToken ||
+ isInTypeQuery(node) || node.parent.kind === 258 /* ExportSpecifier */) ||
+ node.parent.kind === 214 /* NonNullExpression */ ||
+ declaration.kind === 238 /* VariableDeclaration */ && declaration.exclamationToken ||
declaration.flags & 4194304 /* Ambient */;
var initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, declaration) : type) :
type === autoType || type === autoArrayType ? undefinedType :
@@ -46862,7 +47684,7 @@
if (languageVersion >= 2 /* ES2015 */ ||
(symbol.flags & (2 /* BlockScopedVariable */ | 32 /* Class */)) === 0 ||
ts.isSourceFile(symbol.valueDeclaration) ||
- symbol.valueDeclaration.parent.kind === 274 /* CatchClause */) {
+ symbol.valueDeclaration.parent.kind === 275 /* CatchClause */) {
return;
}
// 1. walk from the use site up to the declaration and check
@@ -46885,7 +47707,7 @@
// mark iteration statement as containing block-scoped binding captured in some function
var capturesBlockScopeBindingInLoopBody = true;
if (ts.isForStatement(container) &&
- ts.getAncestor(symbol.valueDeclaration, 238 /* VariableDeclarationList */).parent === container) {
+ ts.getAncestor(symbol.valueDeclaration, 239 /* VariableDeclarationList */).parent === container) {
var part = getPartOfForStatementContainingNode(node.parent, container);
if (part) {
var links = getNodeLinks(part);
@@ -46903,8 +47725,8 @@
}
// mark variables that are declared in loop initializer and reassigned inside the body of ForStatement.
// if body of ForStatement will be converted to function then we'll need a extra machinery to propagate reassigned values back.
- if (container.kind === 225 /* ForStatement */ &&
- ts.getAncestor(symbol.valueDeclaration, 238 /* VariableDeclarationList */).parent === container &&
+ if (container.kind === 226 /* ForStatement */ &&
+ ts.getAncestor(symbol.valueDeclaration, 239 /* VariableDeclarationList */).parent === container &&
isAssignedInBodyOfForStatement(node, container)) {
getNodeLinks(symbol.valueDeclaration).flags |= 4194304 /* NeedsLoopOutParameter */;
}
@@ -46922,7 +47744,7 @@
function isAssignedInBodyOfForStatement(node, container) {
// skip parenthesized nodes
var current = node;
- while (current.parent.kind === 195 /* ParenthesizedExpression */) {
+ while (current.parent.kind === 196 /* ParenthesizedExpression */) {
current = current.parent;
}
// check if node is used as LHS in some assignment expression
@@ -46930,7 +47752,7 @@
if (ts.isAssignmentTarget(current)) {
isAssigned = true;
}
- else if ((current.parent.kind === 202 /* PrefixUnaryExpression */ || current.parent.kind === 203 /* PostfixUnaryExpression */)) {
+ else if ((current.parent.kind === 203 /* PrefixUnaryExpression */ || current.parent.kind === 204 /* PostfixUnaryExpression */)) {
var expr = current.parent;
isAssigned = expr.operator === 44 /* PlusPlusToken */ || expr.operator === 45 /* MinusMinusToken */;
}
@@ -46943,7 +47765,7 @@
}
function captureLexicalThis(node, container) {
getNodeLinks(node).flags |= 2 /* LexicalThis */;
- if (container.kind === 154 /* PropertyDeclaration */ || container.kind === 157 /* Constructor */) {
+ if (container.kind === 155 /* PropertyDeclaration */ || container.kind === 158 /* Constructor */) {
var classNode = container.parent;
getNodeLinks(classNode).flags |= 4 /* CaptureThis */;
}
@@ -47011,37 +47833,37 @@
// tell whether 'this' needs to be captured.
var container = ts.getThisContainer(node, /* includeArrowFunctions */ true);
var capturedByArrowFunction = false;
- if (container.kind === 157 /* Constructor */) {
+ if (container.kind === 158 /* Constructor */) {
checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class);
}
// Now skip arrow functions to get the "real" owner of 'this'.
- if (container.kind === 197 /* ArrowFunction */) {
+ if (container.kind === 198 /* ArrowFunction */) {
container = ts.getThisContainer(container, /* includeArrowFunctions */ false);
capturedByArrowFunction = true;
}
switch (container.kind) {
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body);
// do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks
break;
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location);
// do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks
break;
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
if (isInConstructorArgumentInitializer(node, container)) {
error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments);
// do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks
}
break;
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
if (ts.hasModifier(container, 32 /* Static */)) {
error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer);
// do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks
}
break;
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name);
break;
}
@@ -47091,7 +47913,7 @@
// * /** @constructor */ function [name]() { ... }
// * /** @constructor */ var x = function() { ... }
else if (isInJS &&
- (container.kind === 196 /* FunctionExpression */ || container.kind === 239 /* FunctionDeclaration */) &&
+ (container.kind === 197 /* FunctionExpression */ || container.kind === 240 /* FunctionDeclaration */) &&
ts.getJSDocClassTag(container)) {
var classType = getJSClassType(getMergedSymbol(container.symbol));
if (classType) {
@@ -47127,7 +47949,7 @@
}
function getClassNameFromPrototypeMethod(container) {
// Check if it's the RHS of a x.prototype.y = function [name]() { .... }
- if (container.kind === 196 /* FunctionExpression */ &&
+ if (container.kind === 197 /* FunctionExpression */ &&
ts.isBinaryExpression(container.parent) &&
ts.getAssignmentDeclarationKind(container.parent) === 3 /* PrototypeProperty */) {
// Get the 'x' of 'x.prototype.y = container'
@@ -47137,16 +47959,16 @@
.expression; // x
}
// x.prototype = { method() { } }
- else if (container.kind === 156 /* MethodDeclaration */ &&
- container.parent.kind === 188 /* ObjectLiteralExpression */ &&
+ else if (container.kind === 157 /* MethodDeclaration */ &&
+ container.parent.kind === 189 /* ObjectLiteralExpression */ &&
ts.isBinaryExpression(container.parent.parent) &&
ts.getAssignmentDeclarationKind(container.parent.parent) === 6 /* Prototype */) {
return container.parent.parent.left.expression;
}
// x.prototype = { method: function() { } }
- else if (container.kind === 196 /* FunctionExpression */ &&
- container.parent.kind === 275 /* PropertyAssignment */ &&
- container.parent.parent.kind === 188 /* ObjectLiteralExpression */ &&
+ else if (container.kind === 197 /* FunctionExpression */ &&
+ container.parent.kind === 276 /* PropertyAssignment */ &&
+ container.parent.parent.kind === 189 /* ObjectLiteralExpression */ &&
ts.isBinaryExpression(container.parent.parent.parent) &&
ts.getAssignmentDeclarationKind(container.parent.parent.parent) === 6 /* Prototype */) {
return container.parent.parent.parent.left.expression;
@@ -47154,7 +47976,7 @@
// Object.defineProperty(x, "method", { value: function() { } });
// Object.defineProperty(x, "method", { set: (x: () => void) => void });
// Object.defineProperty(x, "method", { get: () => function() { }) });
- else if (container.kind === 196 /* FunctionExpression */ &&
+ else if (container.kind === 197 /* FunctionExpression */ &&
ts.isPropertyAssignment(container.parent) &&
ts.isIdentifier(container.parent.name) &&
(container.parent.name.escapedText === "value" || container.parent.name.escapedText === "get" || container.parent.name.escapedText === "set") &&
@@ -47179,7 +48001,7 @@
}
function getTypeForThisExpressionFromJSDoc(node) {
var jsdocType = ts.getJSDocType(node);
- if (jsdocType && jsdocType.kind === 294 /* JSDocFunctionType */) {
+ if (jsdocType && jsdocType.kind === 295 /* JSDocFunctionType */) {
var jsDocFunctionType = jsdocType;
if (jsDocFunctionType.parameters.length > 0 &&
jsDocFunctionType.parameters[0].name &&
@@ -47193,15 +48015,15 @@
}
}
function isInConstructorArgumentInitializer(node, constructorDecl) {
- return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 151 /* Parameter */ && n.parent === constructorDecl; });
+ return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 152 /* Parameter */ && n.parent === constructorDecl; });
}
function checkSuperExpression(node) {
- var isCallExpression = node.parent.kind === 191 /* CallExpression */ && node.parent.expression === node;
+ var isCallExpression = node.parent.kind === 192 /* CallExpression */ && node.parent.expression === node;
var container = ts.getSuperContainer(node, /*stopOnFunctions*/ true);
var needToCaptureLexicalThis = false;
// adjust the container reference in case if super is used inside arrow functions with arbitrarily deep nesting
if (!isCallExpression) {
- while (container && container.kind === 197 /* ArrowFunction */) {
+ while (container && container.kind === 198 /* ArrowFunction */) {
container = ts.getSuperContainer(container, /*stopOnFunctions*/ true);
needToCaptureLexicalThis = languageVersion < 2 /* ES2015 */;
}
@@ -47214,14 +48036,14 @@
// class B {
// [super.foo()]() {}
// }
- var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 149 /* ComputedPropertyName */; });
- if (current && current.kind === 149 /* ComputedPropertyName */) {
+ var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 150 /* ComputedPropertyName */; });
+ if (current && current.kind === 150 /* ComputedPropertyName */) {
error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name);
}
else if (isCallExpression) {
error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors);
}
- else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 188 /* ObjectLiteralExpression */)) {
+ else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 189 /* ObjectLiteralExpression */)) {
error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions);
}
else {
@@ -47229,7 +48051,7 @@
}
return errorType;
}
- if (!isCallExpression && container.kind === 157 /* Constructor */) {
+ if (!isCallExpression && container.kind === 158 /* Constructor */) {
checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class);
}
if (ts.hasModifier(container, 32 /* Static */) || isCallExpression) {
@@ -47298,7 +48120,7 @@
// as a call expression cannot be used as the target of a destructuring assignment while a property access can.
//
// For element access expressions (`super[x]`), we emit a generic helper that forwards the element access in both situations.
- if (container.kind === 156 /* MethodDeclaration */ && ts.hasModifier(container, 256 /* Async */)) {
+ if (container.kind === 157 /* MethodDeclaration */ && ts.hasModifier(container, 256 /* Async */)) {
if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) {
getNodeLinks(container).flags |= 4096 /* AsyncMethodWithSuperBinding */;
}
@@ -47312,7 +48134,7 @@
// in this case they should also use correct lexical this
captureLexicalThis(node.parent, container);
}
- if (container.parent.kind === 188 /* ObjectLiteralExpression */) {
+ if (container.parent.kind === 189 /* ObjectLiteralExpression */) {
if (languageVersion < 2 /* ES2015 */) {
error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher);
return errorType;
@@ -47333,7 +48155,7 @@
if (!baseClassType) {
return errorType;
}
- if (container.kind === 157 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) {
+ if (container.kind === 158 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) {
// issue custom error message for super property access in constructor arguments (to be aligned with old compiler)
error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments);
return errorType;
@@ -47348,7 +48170,7 @@
if (isCallExpression) {
// TS 1.0 SPEC (April 2014): 4.8.1
// Super calls are only permitted in constructors of derived classes
- return container.kind === 157 /* Constructor */;
+ return container.kind === 158 /* Constructor */;
}
else {
// TS 1.0 SPEC (April 2014)
@@ -47356,21 +48178,21 @@
// - In a constructor, instance member function, instance member accessor, or instance member variable initializer where this references a derived class instance
// - In a static member function or static member accessor
// topmost container must be something that is directly nested in the class declaration\object literal expression
- if (ts.isClassLike(container.parent) || container.parent.kind === 188 /* ObjectLiteralExpression */) {
+ if (ts.isClassLike(container.parent) || container.parent.kind === 189 /* ObjectLiteralExpression */) {
if (ts.hasModifier(container, 32 /* Static */)) {
- return container.kind === 156 /* MethodDeclaration */ ||
- container.kind === 155 /* MethodSignature */ ||
- container.kind === 158 /* GetAccessor */ ||
- container.kind === 159 /* SetAccessor */;
+ return container.kind === 157 /* MethodDeclaration */ ||
+ container.kind === 156 /* MethodSignature */ ||
+ container.kind === 159 /* GetAccessor */ ||
+ container.kind === 160 /* SetAccessor */;
}
else {
- return container.kind === 156 /* MethodDeclaration */ ||
- container.kind === 155 /* MethodSignature */ ||
- container.kind === 158 /* GetAccessor */ ||
- container.kind === 159 /* SetAccessor */ ||
- container.kind === 154 /* PropertyDeclaration */ ||
- container.kind === 153 /* PropertySignature */ ||
- container.kind === 157 /* Constructor */;
+ return container.kind === 157 /* MethodDeclaration */ ||
+ container.kind === 156 /* MethodSignature */ ||
+ container.kind === 159 /* GetAccessor */ ||
+ container.kind === 160 /* SetAccessor */ ||
+ container.kind === 155 /* PropertyDeclaration */ ||
+ container.kind === 154 /* PropertySignature */ ||
+ container.kind === 158 /* Constructor */;
}
}
}
@@ -47378,10 +48200,10 @@
}
}
function getContainingObjectLiteral(func) {
- return (func.kind === 156 /* MethodDeclaration */ ||
- func.kind === 158 /* GetAccessor */ ||
- func.kind === 159 /* SetAccessor */) && func.parent.kind === 188 /* ObjectLiteralExpression */ ? func.parent :
- func.kind === 196 /* FunctionExpression */ && func.parent.kind === 275 /* PropertyAssignment */ ? func.parent.parent :
+ return (func.kind === 157 /* MethodDeclaration */ ||
+ func.kind === 159 /* GetAccessor */ ||
+ func.kind === 160 /* SetAccessor */) && func.parent.kind === 189 /* ObjectLiteralExpression */ ? func.parent :
+ func.kind === 197 /* FunctionExpression */ && func.parent.kind === 276 /* PropertyAssignment */ ? func.parent.parent :
undefined;
}
function getThisTypeArgument(type) {
@@ -47393,7 +48215,7 @@
});
}
function getContextualThisParameterType(func) {
- if (func.kind === 197 /* ArrowFunction */) {
+ if (func.kind === 198 /* ArrowFunction */) {
return undefined;
}
if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) {
@@ -47420,7 +48242,7 @@
if (thisType) {
return instantiateType(thisType, getMapperFromContext(getInferenceContext(containingLiteral)));
}
- if (literal.parent.kind !== 275 /* PropertyAssignment */) {
+ if (literal.parent.kind !== 276 /* PropertyAssignment */) {
break;
}
literal = literal.parent.parent;
@@ -47434,9 +48256,9 @@
// In an assignment of the form 'obj.xxx = function(...)' or 'obj[xxx] = function(...)', the
// contextual type for 'this' is 'obj'.
var parent = func.parent;
- if (parent.kind === 204 /* BinaryExpression */ && parent.operatorToken.kind === 59 /* EqualsToken */) {
+ if (parent.kind === 205 /* BinaryExpression */ && parent.operatorToken.kind === 60 /* EqualsToken */) {
var target = parent.left;
- if (target.kind === 189 /* PropertyAccessExpression */ || target.kind === 190 /* ElementAccessExpression */) {
+ if (target.kind === 190 /* PropertyAccessExpression */ || target.kind === 191 /* ElementAccessExpression */) {
var expression = target.expression;
// Don't contextually type `this` as `exports` in `exports.Point = function(x, y) { this.x = x; this.y = y; }`
if (inJs && ts.isIdentifier(expression)) {
@@ -47487,9 +48309,9 @@
return getTypeFromTypeNode(typeNode);
}
switch (declaration.kind) {
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return getContextuallyTypedParameterType(declaration);
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return getContextualTypeForBindingElement(declaration);
// By default, do nothing and return undefined - only parameters and binding elements have context implied by a parent
}
@@ -47610,16 +48432,16 @@
return getTypeAtPosition(signature, argIndex);
}
function getContextualTypeForSubstitutionExpression(template, substitutionExpression) {
- if (template.parent.kind === 193 /* TaggedTemplateExpression */) {
+ if (template.parent.kind === 194 /* TaggedTemplateExpression */) {
return getContextualTypeForArgument(template.parent, substitutionExpression);
}
return undefined;
}
- function getContextualTypeForBinaryOperand(node) {
+ function getContextualTypeForBinaryOperand(node, contextFlags) {
var binaryExpression = node.parent;
var left = binaryExpression.left, operatorToken = binaryExpression.operatorToken, right = binaryExpression.right;
switch (operatorToken.kind) {
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
if (node !== right) {
return undefined;
}
@@ -47632,12 +48454,12 @@
// When an || expression has a contextual type, the operands are contextually typed by that type. When an ||
// expression has no contextual type, the right operand is contextually typed by the type of the left operand,
// except for the special case of Javascript declarations of the form `namespace.prop = namespace.prop || {}`
- var type = getContextualType(binaryExpression);
+ var type = getContextualType(binaryExpression, contextFlags);
return !type && node === right && !ts.isDefaultedExpandoInitializer(binaryExpression) ?
getTypeOfExpression(left) : type;
case 54 /* AmpersandAmpersandToken */:
case 27 /* CommaToken */:
- return node === right ? getContextualType(binaryExpression) : undefined;
+ return node === right ? getContextualType(binaryExpression, contextFlags) : undefined;
default:
return undefined;
}
@@ -47744,24 +48566,24 @@
// In an object literal contextually typed by a type T, the contextual type of a property assignment is the type of
// the matching property in T, if one exists. Otherwise, it is the type of the numeric index signature in T, if one
// exists. Otherwise, it is the type of the string index signature in T, if one exists.
- function getContextualTypeForObjectLiteralMethod(node) {
+ function getContextualTypeForObjectLiteralMethod(node, contextFlags) {
ts.Debug.assert(ts.isObjectLiteralMethod(node));
if (node.flags & 8388608 /* InWithStatement */) {
// We cannot answer semantic questions within a with block, do not proceed any further
return undefined;
}
- return getContextualTypeForObjectLiteralElement(node);
+ return getContextualTypeForObjectLiteralElement(node, contextFlags);
}
- function getContextualTypeForObjectLiteralElement(element) {
+ function getContextualTypeForObjectLiteralElement(element, contextFlags) {
var objectLiteral = element.parent;
- var type = getApparentTypeOfContextualType(objectLiteral);
+ var type = getApparentTypeOfContextualType(objectLiteral, contextFlags);
if (type) {
if (!hasNonBindableDynamicName(element)) {
// For a (non-symbol) computed property, there is no reason to look up the name
// in the type. It will just be "__computed", which does not appear in any
// SymbolTable.
- var symbolName_2 = getSymbolOfNode(element).escapedName;
- var propertyType = getTypeOfPropertyOfContextualType(type, symbolName_2);
+ var symbolName_3 = getSymbolOfNode(element).escapedName;
+ var propertyType = getTypeOfPropertyOfContextualType(type, symbolName_3);
if (propertyType) {
return propertyType;
}
@@ -47780,9 +48602,9 @@
|| getIteratedTypeOrElementType(arrayContextualType, /*errorNode*/ undefined, /*allowStringInput*/ false, /*allowAsyncIterables*/ false, /*checkAssignability*/ false));
}
// In a contextually typed conditional expression, the true/false expressions are contextually typed by the same type.
- function getContextualTypeForConditionalOperand(node) {
+ function getContextualTypeForConditionalOperand(node, contextFlags) {
var conditional = node.parent;
- return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional) : undefined;
+ return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional, contextFlags) : undefined;
}
function getContextualTypeForChildJsxExpression(node, child) {
var attributesType = getApparentTypeOfContextualType(node.openingElement.tagName);
@@ -47791,16 +48613,17 @@
if (!(attributesType && !isTypeAny(attributesType) && jsxChildrenPropertyName && jsxChildrenPropertyName !== "")) {
return undefined;
}
- var childIndex = node.children.indexOf(child);
+ var realChildren = getSemanticJsxChildren(node.children);
+ var childIndex = realChildren.indexOf(child);
var childFieldType = getTypeOfPropertyOfContextualType(attributesType, jsxChildrenPropertyName);
- return childFieldType && mapType(childFieldType, function (t) {
+ return childFieldType && (realChildren.length === 1 ? childFieldType : mapType(childFieldType, function (t) {
if (isArrayLikeType(t)) {
return getIndexedAccessType(t, getLiteralType(childIndex));
}
else {
return t;
}
- }, /*noReductions*/ true);
+ }, /*noReductions*/ true));
}
function getContextualTypeForJsxExpression(node) {
var exprParent = node.parent;
@@ -47834,30 +48657,30 @@
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
case 14 /* NoSubstitutionTemplateLiteral */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
- case 96 /* NullKeyword */:
- case 72 /* Identifier */:
- case 141 /* UndefinedKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
+ case 97 /* NullKeyword */:
+ case 73 /* Identifier */:
+ case 142 /* UndefinedKeyword */:
return true;
- case 189 /* PropertyAccessExpression */:
- case 195 /* ParenthesizedExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 196 /* ParenthesizedExpression */:
return isPossiblyDiscriminantValue(node.expression);
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return !node.expression || isPossiblyDiscriminantValue(node.expression);
}
return false;
}
function discriminateContextualTypeByObjectMembers(node, contextualType) {
- return discriminateTypeByDiscriminableItems(contextualType, ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 275 /* PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return checkExpression(prop.initializer); }, prop.symbol.escapedName]; }), isTypeAssignableTo, contextualType);
+ return discriminateTypeByDiscriminableItems(contextualType, ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 276 /* PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return checkExpression(prop.initializer); }, prop.symbol.escapedName]; }), isTypeAssignableTo, contextualType);
}
function discriminateContextualTypeByJSXAttributes(node, contextualType) {
- return discriminateTypeByDiscriminableItems(contextualType, ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 267 /* JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return checkExpression(prop.initializer); }), prop.symbol.escapedName]; }), isTypeAssignableTo, contextualType);
+ return discriminateTypeByDiscriminableItems(contextualType, ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 268 /* JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return checkExpression(prop.initializer); }), prop.symbol.escapedName]; }), isTypeAssignableTo, contextualType);
}
// Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily
// be "pushed" onto a node using the contextualType property.
- function getApparentTypeOfContextualType(node) {
- var contextualType = instantiateContextualType(getContextualType(node), node);
+ function getApparentTypeOfContextualType(node, contextFlags) {
+ var contextualType = instantiateContextualType(getContextualType(node, contextFlags), node, contextFlags);
if (contextualType) {
var apparentType = mapType(contextualType, getApparentType, /*noReductions*/ true);
if (apparentType.flags & 1048576 /* Union */) {
@@ -47873,13 +48696,24 @@
}
// If the given contextual type contains instantiable types and if a mapper representing
// return type inferences is available, instantiate those types using that mapper.
- function instantiateContextualType(contextualType, node) {
+ function instantiateContextualType(contextualType, node, contextFlags) {
if (contextualType && maybeTypeOfKind(contextualType, 63176704 /* Instantiable */)) {
var inferenceContext = getInferenceContext(node);
- if (inferenceContext && inferenceContext.returnMapper) {
+ // If no inferences have been made, nothing is gained from instantiating as type parameters
+ // would just be replaced with their defaults similar to the apparent type.
+ if (inferenceContext && ts.some(inferenceContext.inferences, hasInferenceCandidates)) {
+ // For contextual signatures we incorporate all inferences made so far, e.g. from return
+ // types as well as arguments to the left in a function call.
+ if (contextFlags && contextFlags & 1 /* Signature */) {
+ return instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper);
+ }
+ // For other purposes (e.g. determining whether to produce literal types) we only
+ // incorporate inferences made from the return type in a function call.
+ if (inferenceContext.returnMapper) {
return instantiateInstantiableTypes(contextualType, inferenceContext.returnMapper);
}
}
+ }
return contextualType;
}
// This function is similar to instantiateType, except that (a) it only instantiates types that
@@ -47914,7 +48748,7 @@
* @param node the expression whose contextual type will be returned.
* @returns the contextual type of an expression.
*/
- function getContextualType(node) {
+ function getContextualType(node, contextFlags) {
if (node.flags & 8388608 /* InWithStatement */) {
// We cannot answer semantic questions within a with block, do not proceed any further
return undefined;
@@ -47924,54 +48758,54 @@
}
var parent = node.parent;
switch (parent.kind) {
- case 237 /* VariableDeclaration */:
- case 151 /* Parameter */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 186 /* BindingElement */:
+ case 238 /* VariableDeclaration */:
+ case 152 /* Parameter */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 187 /* BindingElement */:
return getContextualTypeForInitializerExpression(node);
- case 197 /* ArrowFunction */:
- case 230 /* ReturnStatement */:
+ case 198 /* ArrowFunction */:
+ case 231 /* ReturnStatement */:
return getContextualTypeForReturnExpression(node);
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return getContextualTypeForYieldOperand(parent);
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
return getContextualTypeForAwaitOperand(parent);
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
return getContextualTypeForArgument(parent, node);
- case 194 /* TypeAssertionExpression */:
- case 212 /* AsExpression */:
+ case 195 /* TypeAssertionExpression */:
+ case 213 /* AsExpression */:
return ts.isConstTypeReference(parent.type) ? undefined : getTypeFromTypeNode(parent.type);
- case 204 /* BinaryExpression */:
- return getContextualTypeForBinaryOperand(node);
- case 275 /* PropertyAssignment */:
- case 276 /* ShorthandPropertyAssignment */:
- return getContextualTypeForObjectLiteralElement(parent);
- case 277 /* SpreadAssignment */:
- return getApparentTypeOfContextualType(parent.parent);
- case 187 /* ArrayLiteralExpression */: {
+ case 205 /* BinaryExpression */:
+ return getContextualTypeForBinaryOperand(node, contextFlags);
+ case 276 /* PropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
+ return getContextualTypeForObjectLiteralElement(parent, contextFlags);
+ case 278 /* SpreadAssignment */:
+ return getApparentTypeOfContextualType(parent.parent, contextFlags);
+ case 188 /* ArrayLiteralExpression */: {
var arrayLiteral = parent;
- var type = getApparentTypeOfContextualType(arrayLiteral);
+ var type = getApparentTypeOfContextualType(arrayLiteral, contextFlags);
return getContextualTypeForElementExpression(type, ts.indexOfNode(arrayLiteral.elements, node));
}
- case 205 /* ConditionalExpression */:
- return getContextualTypeForConditionalOperand(node);
- case 216 /* TemplateSpan */:
- ts.Debug.assert(parent.parent.kind === 206 /* TemplateExpression */);
+ case 206 /* ConditionalExpression */:
+ return getContextualTypeForConditionalOperand(node, contextFlags);
+ case 217 /* TemplateSpan */:
+ ts.Debug.assert(parent.parent.kind === 207 /* TemplateExpression */);
return getContextualTypeForSubstitutionExpression(parent.parent, node);
- case 195 /* ParenthesizedExpression */: {
+ case 196 /* ParenthesizedExpression */: {
// Like in `checkParenthesizedExpression`, an `/** @type {xyz} */` comment before a parenthesized expression acts as a type cast.
var tag = ts.isInJSFile(parent) ? ts.getJSDocTypeTag(parent) : undefined;
- return tag ? getTypeFromTypeNode(tag.typeExpression.type) : getContextualType(parent);
+ return tag ? getTypeFromTypeNode(tag.typeExpression.type) : getContextualType(parent, contextFlags);
}
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return getContextualTypeForJsxExpression(parent);
- case 267 /* JsxAttribute */:
- case 269 /* JsxSpreadAttribute */:
+ case 268 /* JsxAttribute */:
+ case 270 /* JsxSpreadAttribute */:
return getContextualTypeForJsxAttribute(parent);
- case 262 /* JsxOpeningElement */:
- case 261 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
+ case 262 /* JsxSelfClosingElement */:
return getContextualJsxElementAttributesType(parent);
}
return undefined;
@@ -47993,7 +48827,7 @@
return getJsxReferenceKind(node) !== 0 /* Component */ ? getJsxPropsTypeFromCallSignature(signature, node) : getJsxPropsTypeFromClassType(signature, node);
}
function getJsxPropsTypeFromCallSignature(sig, context) {
- var propsType = getTypeOfFirstParameterOfSignatureWithFallback(sig, emptyObjectType);
+ var propsType = getTypeOfFirstParameterOfSignatureWithFallback(sig, unknownType);
propsType = getJsxManagedAttributesFromLocatedAttributes(context, getJsxNamespaceAt(context), propsType);
var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context);
if (intrinsicAttribs !== errorType) {
@@ -48064,7 +48898,7 @@
var forcedLookupLocation = getJsxElementPropertiesName(ns);
var attributesType = forcedLookupLocation === undefined
// If there is no type ElementAttributesProperty, return the type of the first parameter of the signature, which should be the props type
- ? getTypeOfFirstParameterOfSignatureWithFallback(sig, emptyObjectType)
+ ? getTypeOfFirstParameterOfSignatureWithFallback(sig, unknownType)
: forcedLookupLocation === ""
// If there is no e.g. 'props' member in ElementAttributesProperty, use the element class type instead
? getReturnTypeOfSignature(sig)
@@ -48075,7 +48909,7 @@
if (!!forcedLookupLocation && !!ts.length(context.attributes.properties)) {
error(context, ts.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, ts.unescapeLeadingUnderscores(forcedLookupLocation));
}
- return emptyObjectType;
+ return unknownType;
}
attributesType = getJsxManagedAttributesFromLocatedAttributes(context, ns, attributesType);
if (isTypeAny(attributesType)) {
@@ -48126,7 +48960,7 @@
return !hasEffectiveRestParameter(signature) && getParameterCount(signature) < targetParameterCount;
}
function isFunctionExpressionOrArrowFunction(node) {
- return node.kind === 196 /* FunctionExpression */ || node.kind === 197 /* ArrowFunction */;
+ return node.kind === 197 /* FunctionExpression */ || node.kind === 198 /* ArrowFunction */;
}
function getContextualSignatureForFunctionLikeDeclaration(node) {
// Only function expressions, arrow functions, and object literal methods are contextually typed.
@@ -48134,23 +48968,20 @@
? getContextualSignature(node)
: undefined;
}
- function getContextualTypeForFunctionLikeDeclaration(node) {
- return ts.isObjectLiteralMethod(node) ?
- getContextualTypeForObjectLiteralMethod(node) :
- getApparentTypeOfContextualType(node);
- }
// Return the contextual signature for a given expression node. A contextual type provides a
// contextual signature if it has a single call signature and if that call signature is non-generic.
// If the contextual type is a union type, get the signature from each type possible and if they are
// all identical ignoring their return type, the result is same signature but with return type as
// union type of return types from these signatures
function getContextualSignature(node) {
- ts.Debug.assert(node.kind !== 156 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
+ ts.Debug.assert(node.kind !== 157 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
var typeTagSignature = getSignatureOfTypeTag(node);
if (typeTagSignature) {
return typeTagSignature;
}
- var type = getContextualTypeForFunctionLikeDeclaration(node);
+ var type = ts.isObjectLiteralMethod(node) ?
+ getContextualTypeForObjectLiteralMethod(node, 1 /* Signature */) :
+ getApparentTypeOfContextualType(node, 1 /* Signature */);
if (!type) {
return undefined;
}
@@ -48159,8 +48990,8 @@
}
var signatureList;
var types = type.types;
- for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
- var current = types_15[_i];
+ for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
+ var current = types_14[_i];
var signature = getContextualCallSignature(current, node);
if (signature) {
if (!signatureList) {
@@ -48188,8 +49019,8 @@
return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false, /*allowAsyncIterables*/ false);
}
function hasDefaultValue(node) {
- return (node.kind === 186 /* BindingElement */ && !!node.initializer) ||
- (node.kind === 204 /* BinaryExpression */ && node.operatorToken.kind === 59 /* EqualsToken */);
+ return (node.kind === 187 /* BindingElement */ && !!node.initializer) ||
+ (node.kind === 205 /* BinaryExpression */ && node.operatorToken.kind === 60 /* EqualsToken */);
}
function checkArrayLiteral(node, checkMode, forceTuple) {
var elements = node.elements;
@@ -48201,7 +49032,7 @@
var inConstContext = isConstContext(node);
for (var index = 0; index < elementCount; index++) {
var e = elements[index];
- if (inDestructuringPattern && e.kind === 208 /* SpreadElement */) {
+ if (inDestructuringPattern && e.kind === 209 /* SpreadElement */) {
// Given the following situation:
// var c: {};
// [...c] = ["", 0];
@@ -48226,12 +49057,12 @@
var type = checkExpressionForMutableLocation(e, checkMode, elementContextualType, forceTuple);
elementTypes.push(type);
}
- if (index < elementCount - 1 && e.kind === 208 /* SpreadElement */) {
+ if (index < elementCount - 1 && e.kind === 209 /* SpreadElement */) {
hasNonEndingSpreadElement = true;
}
}
if (!hasNonEndingSpreadElement) {
- var hasRestElement = elementCount > 0 && elements[elementCount - 1].kind === 208 /* SpreadElement */;
+ var hasRestElement = elementCount > 0 && elements[elementCount - 1].kind === 209 /* SpreadElement */;
var minLength = elementCount - (hasRestElement ? 1 : 0);
// If array literal is actually a destructuring pattern, mark it as an implied type. We do this such
// that we get the same behavior for "var [x, y] = []" and "[x, y] = []".
@@ -48261,15 +49092,15 @@
var pattern = contextualType && contextualType.pattern;
// If array literal is contextually typed by a binding pattern or an assignment pattern, pad the resulting
// tuple type with the corresponding binding or assignment element types to make the lengths equal.
- if (!hasRestElement && pattern && (pattern.kind === 185 /* ArrayBindingPattern */ || pattern.kind === 187 /* ArrayLiteralExpression */)) {
+ if (!hasRestElement && pattern && (pattern.kind === 186 /* ArrayBindingPattern */ || pattern.kind === 188 /* ArrayLiteralExpression */)) {
var patternElements = pattern.elements;
for (var i = elementCount; i < patternElements.length; i++) {
var e = patternElements[i];
if (hasDefaultValue(e)) {
elementTypes.push(contextualType.typeArguments[i]);
}
- else if (i < patternElements.length - 1 || !(e.kind === 186 /* BindingElement */ && e.dotDotDotToken || e.kind === 208 /* SpreadElement */)) {
- if (e.kind !== 210 /* OmittedExpression */) {
+ else if (i < patternElements.length - 1 || !(e.kind === 187 /* BindingElement */ && e.dotDotDotToken || e.kind === 209 /* SpreadElement */)) {
+ if (e.kind !== 211 /* OmittedExpression */) {
error(e, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value);
}
elementTypes.push(strictNullChecks ? implicitNeverType : undefinedWideningType);
@@ -48281,9 +49112,9 @@
}
function isNumericName(name) {
switch (name.kind) {
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
return isNumericComputedName(name);
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return isNumericLiteralName(name.escapedText);
case 8 /* NumericLiteral */:
case 10 /* StringLiteral */:
@@ -48371,7 +49202,7 @@
var spread = emptyObjectType;
var contextualType = getApparentTypeOfContextualType(node);
var contextualTypeHasPattern = contextualType && contextualType.pattern &&
- (contextualType.pattern.kind === 184 /* ObjectBindingPattern */ || contextualType.pattern.kind === 188 /* ObjectLiteralExpression */);
+ (contextualType.pattern.kind === 185 /* ObjectBindingPattern */ || contextualType.pattern.kind === 189 /* ObjectLiteralExpression */);
var inConstContext = isConstContext(node);
var checkFlags = inConstContext ? 8 /* Readonly */ : 0;
var isInJavascript = ts.isInJSFile(node) && !ts.isInJsonFile(node);
@@ -48386,13 +49217,13 @@
for (var i = 0; i < node.properties.length; i++) {
var memberDecl = node.properties[i];
var member = getSymbolOfNode(memberDecl);
- var computedNameType = memberDecl.name && memberDecl.name.kind === 149 /* ComputedPropertyName */ && !ts.isWellKnownSymbolSyntactically(memberDecl.name.expression) ?
+ var computedNameType = memberDecl.name && memberDecl.name.kind === 150 /* ComputedPropertyName */ && !ts.isWellKnownSymbolSyntactically(memberDecl.name.expression) ?
checkComputedPropertyName(memberDecl.name) : undefined;
- if (memberDecl.kind === 275 /* PropertyAssignment */ ||
- memberDecl.kind === 276 /* ShorthandPropertyAssignment */ ||
+ if (memberDecl.kind === 276 /* PropertyAssignment */ ||
+ memberDecl.kind === 277 /* ShorthandPropertyAssignment */ ||
ts.isObjectLiteralMethod(memberDecl)) {
- var type = memberDecl.kind === 275 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) :
- memberDecl.kind === 276 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(memberDecl.name, checkMode) :
+ var type = memberDecl.kind === 276 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) :
+ memberDecl.kind === 277 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(memberDecl.name, checkMode) :
checkObjectLiteralMethod(memberDecl, checkMode);
if (isInJavascript) {
var jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl);
@@ -48407,7 +49238,7 @@
objectFlags |= ts.getObjectFlags(type) & 917504 /* PropagatingFlags */;
var nameType = computedNameType && isTypeUsableAsPropertyName(computedNameType) ? computedNameType : undefined;
var prop = nameType ?
- createSymbol(4 /* Property */ | member.flags, getPropertyNameFromType(nameType), checkFlags | 2048 /* Late */) :
+ createSymbol(4 /* Property */ | member.flags, getPropertyNameFromType(nameType), checkFlags | 4096 /* Late */) :
createSymbol(4 /* Property */ | member.flags, member.escapedName, checkFlags);
if (nameType) {
prop.nameType = nameType;
@@ -48415,8 +49246,8 @@
if (inDestructuringPattern) {
// If object literal is an assignment pattern and if the assignment pattern specifies a default value
// for the property, make the property optional.
- var isOptional = (memberDecl.kind === 275 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) ||
- (memberDecl.kind === 276 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer);
+ var isOptional = (memberDecl.kind === 276 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) ||
+ (memberDecl.kind === 277 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer);
if (isOptional) {
prop.flags |= 16777216 /* Optional */;
}
@@ -48441,7 +49272,7 @@
prop.target = member;
member = prop;
}
- else if (memberDecl.kind === 277 /* SpreadAssignment */) {
+ else if (memberDecl.kind === 278 /* SpreadAssignment */) {
if (languageVersion < 2 /* ES2015 */) {
checkExternalEmitHelpers(memberDecl, 2 /* Assign */);
}
@@ -48467,7 +49298,7 @@
// an ordinary function declaration(section 6.1) with no parameters.
// A set accessor declaration is processed in the same manner
// as an ordinary function declaration with a single parameter and a Void return type.
- ts.Debug.assert(memberDecl.kind === 158 /* GetAccessor */ || memberDecl.kind === 159 /* SetAccessor */);
+ ts.Debug.assert(memberDecl.kind === 159 /* GetAccessor */ || memberDecl.kind === 160 /* SetAccessor */);
checkNodeDeferred(memberDecl);
}
if (computedNameType && !(computedNameType.flags & 8576 /* StringOrNumberLiteralOrUnique */)) {
@@ -48575,7 +49406,7 @@
* Returns true iff React would emit this tag name as a string rather than an identifier or qualified name
*/
function isJsxIntrinsicIdentifier(tagName) {
- return tagName.kind === 72 /* Identifier */ && ts.isIntrinsicJsxName(tagName.escapedText);
+ return tagName.kind === 73 /* Identifier */ && ts.isIntrinsicJsxName(tagName.escapedText);
}
function checkJsxAttribute(node, checkMode) {
return node.initializer
@@ -48620,7 +49451,7 @@
}
}
else {
- ts.Debug.assert(attributeDecl.kind === 269 /* JsxSpreadAttribute */);
+ ts.Debug.assert(attributeDecl.kind === 270 /* JsxSpreadAttribute */);
if (attributesTable.size > 0) {
spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, objectFlags, /*readonly*/ false);
attributesTable = ts.createSymbolTable();
@@ -48643,7 +49474,7 @@
}
}
// Handle children attribute
- var parent = openingLikeElement.parent.kind === 260 /* JsxElement */ ? openingLikeElement.parent : undefined;
+ var parent = openingLikeElement.parent.kind === 261 /* JsxElement */ ? openingLikeElement.parent : undefined;
// We have to check that openingElement of the parent is the one we are visiting as this may not be true for selfClosingElement
if (parent && parent.openingElement === openingLikeElement && parent.children.length > 0) {
var childrenTypes = checkJsxChildren(parent, checkMode);
@@ -49061,8 +49892,8 @@
*/
function checkPropertyAccessibility(node, isSuper, type, prop) {
var flags = ts.getDeclarationModifierFlagsFromSymbol(prop);
- var errorNode = node.kind === 148 /* QualifiedName */ ? node.right : node.kind === 183 /* ImportType */ ? node : node.name;
- if (ts.getCheckFlags(prop) & 512 /* ContainsPrivate */) {
+ var errorNode = node.kind === 149 /* QualifiedName */ ? node.right : node.kind === 184 /* ImportType */ ? node : node.name;
+ if (ts.getCheckFlags(prop) & 1024 /* ContainsPrivate */) {
// Synthetic property with private constituent property
error(errorNode, ts.Diagnostics.Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1, symbolToString(prop), typeToString(type));
return false;
@@ -49167,7 +49998,7 @@
return type;
}
function checkNonNullType(type, node, nullDiagnostic, undefinedDiagnostic, nullOrUndefinedDiagnostic) {
- if (type.flags & 2 /* Unknown */) {
+ if (strictNullChecks && type.flags & 2 /* Unknown */) {
error(node, ts.Diagnostics.Object_is_of_type_unknown);
return errorType;
}
@@ -49182,6 +50013,13 @@
}
return type;
}
+ function checkNonNullNonVoidType(type, node) {
+ var nonNullType = checkNonNullType(type, node);
+ if (nonNullType !== errorType && nonNullType.flags & 16384 /* Void */) {
+ error(node, ts.Diagnostics.Object_is_possibly_undefined);
+ }
+ return nonNullType;
+ }
function checkPropertyAccessExpression(node) {
return checkPropertyAccessExpressionOrQualifiedName(node, node.expression, node.name);
}
@@ -49205,7 +50043,7 @@
markAliasReferenced(parentSymbol, node);
}
if (!prop) {
- var indexInfo = getIndexInfoOfType(apparentType, 0 /* String */);
+ var indexInfo = assignmentKind === 0 /* None */ || !isGenericObjectType(leftType) ? getIndexInfoOfType(apparentType, 0 /* String */) : undefined;
if (!(indexInfo && indexInfo.type)) {
if (isJSLiteralType(leftType)) {
return anyType;
@@ -49220,7 +50058,7 @@
return anyType;
}
if (right.escapedText && !checkAndReportErrorForExtendingInterface(node)) {
- reportNonexistentProperty(right, leftType.flags & 262144 /* TypeParameter */ && leftType.isThisType ? apparentType : leftType);
+ reportNonexistentProperty(right, isThisTypeParameter(leftType) ? apparentType : leftType);
}
return errorType;
}
@@ -49231,9 +50069,9 @@
}
else {
checkPropertyNotUsedBeforeDeclaration(prop, node, right);
- markPropertyAsReferenced(prop, node, left.kind === 100 /* ThisKeyword */);
+ markPropertyAsReferenced(prop, node, left.kind === 101 /* ThisKeyword */);
getNodeLinks(node).resolvedSymbol = prop;
- checkPropertyAccessibility(node, left.kind === 98 /* SuperKeyword */, apparentType, prop);
+ checkPropertyAccessibility(node, left.kind === 99 /* SuperKeyword */, apparentType, prop);
if (assignmentKind) {
if (isReferenceToReadonlyEntity(node, prop) || isReferenceThroughNamespaceImport(node)) {
error(right, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, ts.idText(right));
@@ -49245,7 +50083,7 @@
// Only compute control flow type if this is a property access expression that isn't an
// assignment target, and the referenced property was declared as a variable, property,
// accessor, or optional method.
- if (node.kind !== 189 /* PropertyAccessExpression */ ||
+ if (node.kind !== 190 /* PropertyAccessExpression */ ||
assignmentKind === 1 /* Definite */ ||
prop && !(prop.flags & (3 /* Variable */ | 4 /* Property */ | 98304 /* Accessor */)) && !(prop.flags & 8192 /* Method */ && propType.flags & 1048576 /* Union */)) {
return propType;
@@ -49255,11 +50093,11 @@
// and if we are in a constructor of the same class as the property declaration, assume that
// the property is uninitialized at the top of the control flow.
var assumeUninitialized = false;
- if (strictNullChecks && strictPropertyInitialization && left.kind === 100 /* ThisKeyword */) {
+ if (strictNullChecks && strictPropertyInitialization && left.kind === 101 /* ThisKeyword */) {
var declaration = prop && prop.valueDeclaration;
if (declaration && isInstancePropertyWithoutInitializer(declaration)) {
var flowContainer = getControlFlowContainer(node);
- if (flowContainer.kind === 157 /* Constructor */ && flowContainer.parent === declaration.parent) {
+ if (flowContainer.kind === 158 /* Constructor */ && flowContainer.parent === declaration.parent) {
assumeUninitialized = true;
}
}
@@ -49290,8 +50128,8 @@
&& !isPropertyDeclaredInAncestorClass(prop)) {
diagnosticMessage = error(right, ts.Diagnostics.Property_0_is_used_before_its_initialization, declarationName);
}
- else if (valueDeclaration.kind === 240 /* ClassDeclaration */ &&
- node.parent.kind !== 164 /* TypeReference */ &&
+ else if (valueDeclaration.kind === 241 /* ClassDeclaration */ &&
+ node.parent.kind !== 165 /* TypeReference */ &&
!(valueDeclaration.flags & 4194304 /* Ambient */) &&
!isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) {
diagnosticMessage = error(right, ts.Diagnostics.Class_0_used_before_its_declaration, declarationName);
@@ -49303,22 +50141,22 @@
function isInPropertyInitializer(node) {
return !!ts.findAncestor(node, function (node) {
switch (node.kind) {
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return true;
- case 275 /* PropertyAssignment */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 277 /* SpreadAssignment */:
- case 149 /* ComputedPropertyName */:
- case 216 /* TemplateSpan */:
- case 270 /* JsxExpression */:
- case 267 /* JsxAttribute */:
- case 268 /* JsxAttributes */:
- case 269 /* JsxSpreadAttribute */:
- case 262 /* JsxOpeningElement */:
- case 211 /* ExpressionWithTypeArguments */:
- case 273 /* HeritageClause */:
+ case 276 /* PropertyAssignment */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 278 /* SpreadAssignment */:
+ case 150 /* ComputedPropertyName */:
+ case 217 /* TemplateSpan */:
+ case 271 /* JsxExpression */:
+ case 268 /* JsxAttribute */:
+ case 269 /* JsxAttributes */:
+ case 270 /* JsxSpreadAttribute */:
+ case 263 /* JsxOpeningElement */:
+ case 212 /* ExpressionWithTypeArguments */:
+ case 274 /* HeritageClause */:
return false;
default:
return ts.isExpressionNode(node) ? false : "quit";
@@ -49424,6 +50262,32 @@
var suggestion = getSuggestedSymbolForNonexistentModule(name, targetModule);
return suggestion && ts.symbolName(suggestion);
}
+ function getSuggestionForNonexistentIndexSignature(objectType, expr) {
+ // check if object type has setter or getter
+ var hasProp = function (name, argCount) {
+ if (argCount === void 0) { argCount = 1; }
+ var prop = getPropertyOfObjectType(objectType, name);
+ if (prop) {
+ var s = getSingleCallSignature(getTypeOfSymbol(prop));
+ if (s && getMinArgumentCount(s) === argCount && typeToString(getTypeAtPosition(s, 0)) === "string") {
+ return true;
+ }
+ }
+ return false;
+ };
+ var suggestedMethod = ts.isAssignmentTarget(expr) ? "set" : "get";
+ if (!hasProp(suggestedMethod)) {
+ return undefined;
+ }
+ var suggestion = ts.tryGetPropertyAccessOrIdentifierToString(expr);
+ if (suggestion === undefined) {
+ suggestion = suggestedMethod;
+ }
+ else {
+ suggestion += "." + suggestedMethod;
+ }
+ return suggestion;
+ }
/**
* Given a name and a list of symbols whose names are *not* equal to the name, return a spelling suggestion if there is one that is close enough.
* Names less than length 3 only check for case-insensitive equality, not levenshtein distance.
@@ -49464,34 +50328,17 @@
}
function isValidPropertyAccess(node, propertyName) {
switch (node.kind) {
- case 189 /* PropertyAccessExpression */:
- return isValidPropertyAccessWithType(node, node.expression.kind === 98 /* SuperKeyword */, propertyName, getWidenedType(checkExpression(node.expression)));
- case 148 /* QualifiedName */:
+ case 190 /* PropertyAccessExpression */:
+ return isValidPropertyAccessWithType(node, node.expression.kind === 99 /* SuperKeyword */, propertyName, getWidenedType(checkExpression(node.expression)));
+ case 149 /* QualifiedName */:
return isValidPropertyAccessWithType(node, /*isSuper*/ false, propertyName, getWidenedType(checkExpression(node.left)));
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return isValidPropertyAccessWithType(node, /*isSuper*/ false, propertyName, getTypeFromTypeNode(node));
}
}
function isValidPropertyAccessForCompletions(node, type, property) {
- return isValidPropertyAccessWithType(node, node.kind === 189 /* PropertyAccessExpression */ && node.expression.kind === 98 /* SuperKeyword */, property.escapedName, type)
- && (!(property.flags & 8192 /* Method */) || isValidMethodAccess(property, type));
- }
- function isValidMethodAccess(method, actualThisType) {
- var propType = getTypeOfPropertyOfType(actualThisType, method.escapedName);
- var signatures = getSignaturesOfType(getNonNullableType(propType), 0 /* Call */);
- ts.Debug.assert(signatures.length !== 0);
- return signatures.some(function (sig) {
- var signatureThisType = getThisTypeOfSignature(sig);
- return !signatureThisType || isTypeAssignableTo(actualThisType, getInstantiatedSignatureThisType(sig, signatureThisType, actualThisType));
- });
- }
- function getInstantiatedSignatureThisType(sig, signatureThisType, actualThisType) {
- if (!sig.typeParameters) {
- return signatureThisType;
- }
- var context = createInferenceContext(sig.typeParameters, sig, 0 /* None */);
- inferTypes(context.inferences, actualThisType, signatureThisType);
- return instantiateType(signatureThisType, createSignatureTypeMapper(sig, getInferredTypes(context)));
+ return isValidPropertyAccessWithType(node, node.kind === 190 /* PropertyAccessExpression */ && node.expression.kind === 99 /* SuperKeyword */, property.escapedName, type);
+ // Previously we validated the 'this' type of methods but this adversely affected performance. See #31377 for more context.
}
function isValidPropertyAccessWithType(node, isSuper, propertyName, type) {
if (type === errorType || isTypeAny(type)) {
@@ -49507,13 +50354,13 @@
*/
function getForInVariableSymbol(node) {
var initializer = node.initializer;
- if (initializer.kind === 238 /* VariableDeclarationList */) {
+ if (initializer.kind === 239 /* VariableDeclarationList */) {
var variable = initializer.declarations[0];
if (variable && !ts.isBindingPattern(variable.name)) {
return getSymbolOfNode(variable);
}
}
- else if (initializer.kind === 72 /* Identifier */) {
+ else if (initializer.kind === 73 /* Identifier */) {
return getResolvedSymbol(initializer);
}
return undefined;
@@ -49530,13 +50377,13 @@
*/
function isForInVariableForNumericPropertyNames(expr) {
var e = ts.skipParentheses(expr);
- if (e.kind === 72 /* Identifier */) {
+ if (e.kind === 73 /* Identifier */) {
var symbol = getResolvedSymbol(e);
if (symbol.flags & 3 /* Variable */) {
var child = expr;
var node = expr.parent;
while (node) {
- if (node.kind === 226 /* ForInStatement */ &&
+ if (node.kind === 227 /* ForInStatement */ &&
child === node.statement &&
getForInVariableSymbol(node) === symbol &&
hasNumericPropertyNames(getTypeOfExpression(node.expression))) {
@@ -49554,7 +50401,7 @@
var indexExpression = node.argumentExpression;
if (!indexExpression) {
var sourceFile = ts.getSourceFileOfNode(node);
- if (node.parent.kind === 192 /* NewExpression */ && node.parent.expression === node) {
+ if (node.parent.kind === 193 /* NewExpression */ && node.parent.expression === node) {
var start = ts.skipTrivia(sourceFile.text, node.expression.end);
var end = node.end;
grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead);
@@ -49574,7 +50421,12 @@
error(indexExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal);
return errorType;
}
- return checkIndexedAccessIndexType(getIndexedAccessType(objectType, isForInVariableForNumericPropertyNames(indexExpression) ? numberType : indexType, node), node);
+ var effectiveIndexType = isForInVariableForNumericPropertyNames(indexExpression) ? numberType : indexType;
+ var accessFlags = ts.isAssignmentTarget(node) ?
+ 2 /* Writing */ | (isGenericObjectType(objectType) && !isThisTypeParameter(objectType) ? 1 /* NoIndexSignatures */ : 0) :
+ 0 /* None */;
+ var indexedAccessType = getIndexedAccessTypeOrUndefined(objectType, effectiveIndexType, node, accessFlags) || errorType;
+ return checkIndexedAccessIndexType(indexedAccessType, node);
}
function checkThatExpressionIsProperSymbolReference(expression, expressionType, reportError) {
if (expressionType === errorType) {
@@ -49620,13 +50472,13 @@
// This gets us diagnostics for the type arguments and marks them as referenced.
ts.forEach(node.typeArguments, checkSourceElement);
}
- if (node.kind === 193 /* TaggedTemplateExpression */) {
+ if (node.kind === 194 /* TaggedTemplateExpression */) {
checkExpression(node.template);
}
else if (ts.isJsxOpeningLikeElement(node)) {
checkExpression(node.attributes);
}
- else if (node.kind !== 152 /* Decorator */) {
+ else if (node.kind !== 153 /* Decorator */) {
ts.forEach(node.arguments, function (argument) {
checkExpression(argument);
});
@@ -49690,7 +50542,7 @@
}
}
function isSpreadArgument(arg) {
- return !!arg && (arg.kind === 208 /* SpreadElement */ || arg.kind === 215 /* SyntheticExpression */ && arg.isSpread);
+ return !!arg && (arg.kind === 209 /* SpreadElement */ || arg.kind === 216 /* SyntheticExpression */ && arg.isSpread);
}
function getSpreadArgumentIndex(args) {
return ts.findIndex(args, isSpreadArgument);
@@ -49704,9 +50556,9 @@
var callIsIncomplete = false; // In incomplete call we want to be lenient when we have too few arguments
var effectiveParameterCount = getParameterCount(signature);
var effectiveMinimumArguments = getMinArgumentCount(signature);
- if (node.kind === 193 /* TaggedTemplateExpression */) {
+ if (node.kind === 194 /* TaggedTemplateExpression */) {
argCount = args.length;
- if (node.template.kind === 206 /* TemplateExpression */) {
+ if (node.template.kind === 207 /* TemplateExpression */) {
// If a tagged template expression lacks a tail literal, the call is incomplete.
// Specifically, a template only can end in a TemplateTail or a Missing literal.
var lastSpan = ts.last(node.template.templateSpans); // we should always have at least one span.
@@ -49721,7 +50573,7 @@
callIsIncomplete = !!templateLiteral.isUnterminated;
}
}
- else if (node.kind === 152 /* Decorator */) {
+ else if (node.kind === 153 /* Decorator */) {
argCount = getDecoratorArgumentCount(node, signature);
}
else if (ts.isJsxOpeningLikeElement(node)) {
@@ -49736,7 +50588,7 @@
else {
if (!node.arguments) {
// This only happens when we have something of the form: 'new C'
- ts.Debug.assert(node.kind === 192 /* NewExpression */);
+ ts.Debug.assert(node.kind === 193 /* NewExpression */);
return getMinArgumentCount(signature) === 0;
}
argCount = signatureHelpTrailingComma ? args.length + 1 : args.length;
@@ -49775,12 +50627,23 @@
}
// If type has a single call signature and no other members, return that signature. Otherwise, return undefined.
function getSingleCallSignature(type) {
+ return getSingleSignature(type, 0 /* Call */, /*allowMembers*/ false);
+ }
+ function getSingleCallOrConstructSignature(type) {
+ return getSingleSignature(type, 0 /* Call */, /*allowMembers*/ false) ||
+ getSingleSignature(type, 1 /* Construct */, /*allowMembers*/ false);
+ }
+ function getSingleSignature(type, kind, allowMembers) {
if (type.flags & 524288 /* Object */) {
var resolved = resolveStructuredTypeMembers(type);
- if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 &&
- resolved.properties.length === 0 && !resolved.stringIndexInfo && !resolved.numberIndexInfo) {
+ if (allowMembers || resolved.properties.length === 0 && !resolved.stringIndexInfo && !resolved.numberIndexInfo) {
+ if (kind === 0 /* Call */ && resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0) {
return resolved.callSignatures[0];
}
+ if (kind === 1 /* Construct */ && resolved.constructSignatures.length === 1 && resolved.callSignatures.length === 0) {
+ return resolved.constructSignatures[0];
+ }
+ }
}
return undefined;
}
@@ -49799,7 +50662,7 @@
});
if (!inferenceContext) {
applyToReturnTypes(contextualSignature, signature, function (source, target) {
- inferTypes(context.inferences, source, target, 8 /* ReturnType */);
+ inferTypes(context.inferences, source, target, 16 /* ReturnType */);
});
}
return getSignatureInstantiation(signature, getInferredTypes(context), ts.isInJSFile(contextualSignature.declaration));
@@ -49818,7 +50681,7 @@
// example, given a 'function wrap<T, U>(cb: (x: T) => U): (x: T) => U' and a call expression
// 'let f: (x: string) => number = wrap(s => s.length)', we infer from the declared type of 'f' to the
// return type of 'wrap'.
- if (node.kind !== 152 /* Decorator */) {
+ if (node.kind !== 153 /* Decorator */) {
var contextualType = getContextualType(node);
if (contextualType) {
// We clone the inference context to avoid disturbing a resolution in progress for an
@@ -49839,7 +50702,7 @@
instantiatedType;
var inferenceTargetType = getReturnTypeOfSignature(signature);
// Inferences made from return types have lower priority than all other inferences.
- inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 8 /* ReturnType */);
+ inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 16 /* ReturnType */);
// Create a type mapper for instantiating generic contextual types using the inferences made
// from the return type.
context.returnMapper = getMapperFromContext(cloneInferredPartOfContext(context));
@@ -49855,7 +50718,7 @@
var argCount = restType ? Math.min(getParameterCount(signature) - 1, args.length) : args.length;
for (var i = 0; i < argCount; i++) {
var arg = args[i];
- if (arg.kind !== 210 /* OmittedExpression */) {
+ if (arg.kind !== 211 /* OmittedExpression */) {
var paramType = getTypeAtPosition(signature, i);
var argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
inferTypes(context.inferences, argType, paramType);
@@ -49869,7 +50732,7 @@
}
function getArrayifiedType(type) {
if (forEachType(type, function (t) { return !(t.flags & (1 /* Any */ | 63176704 /* Instantiable */) || isArrayType(t) || isTupleType(t)); })) {
- return createArrayType(getIndexTypeOfType(type, 1 /* Number */) || errorType);
+ return createArrayType(getIndexedAccessType(type, numberType));
}
return type;
}
@@ -49879,20 +50742,20 @@
if (isSpreadArgument(arg)) {
// We are inferring from a spread expression in the last argument position, i.e. both the parameter
// and the argument are ...x forms.
- return arg.kind === 215 /* SyntheticExpression */ ?
+ return arg.kind === 216 /* SyntheticExpression */ ?
createArrayType(arg.type) :
getArrayifiedType(checkExpressionWithContextualType(arg.expression, restType, context, 0 /* Normal */));
}
}
- var contextualType = getIndexTypeOfType(restType, 1 /* Number */) || anyType;
- var hasPrimitiveContextualType = maybeTypeOfKind(contextualType, 131068 /* Primitive */ | 4194304 /* Index */);
var types = [];
var spreadIndex = -1;
for (var i = index; i < argCount; i++) {
+ var contextualType = getIndexedAccessType(restType, getLiteralType(i - index));
var argType = checkExpressionWithContextualType(args[i], contextualType, context, 0 /* Normal */);
if (spreadIndex < 0 && isSpreadArgument(args[i])) {
spreadIndex = i - index;
}
+ var hasPrimitiveContextualType = maybeTypeOfKind(contextualType, 131068 /* Primitive */ | 4194304 /* Index */);
types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType));
}
return spreadIndex < 0 ?
@@ -49953,7 +50816,7 @@
return checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation, checkMode, reportErrors);
}
var thisType = getThisTypeOfSignature(signature);
- if (thisType && thisType !== voidType && node.kind !== 192 /* NewExpression */) {
+ if (thisType && thisType !== voidType && node.kind !== 193 /* NewExpression */) {
// If the called expression is not of the form `x.f` or `x["f"]`, then sourceType = voidType
// If the signature's 'this' type is voidType, then the check is skipped -- anything is compatible.
// If the expression is a new expression, then the check is skipped.
@@ -49970,7 +50833,7 @@
var argCount = restType ? Math.min(getParameterCount(signature) - 1, args.length) : args.length;
for (var i = 0; i < argCount; i++) {
var arg = args[i];
- if (arg.kind !== 210 /* OmittedExpression */) {
+ if (arg.kind !== 211 /* OmittedExpression */) {
var paramType = getTypeAtPosition(signature, i);
var argType = checkExpressionWithContextualType(arg, paramType, /*inferenceContext*/ undefined, checkMode);
// If one or more arguments are still excluded (as indicated by CheckMode.SkipContextSensitive),
@@ -49993,15 +50856,15 @@
* Returns the this argument in calls like x.f(...) and x[f](...). Undefined otherwise.
*/
function getThisArgumentOfCall(node) {
- if (node.kind === 191 /* CallExpression */) {
+ if (node.kind === 192 /* CallExpression */) {
var callee = ts.skipOuterExpressions(node.expression);
- if (callee.kind === 189 /* PropertyAccessExpression */ || callee.kind === 190 /* ElementAccessExpression */) {
+ if (callee.kind === 190 /* PropertyAccessExpression */ || callee.kind === 191 /* ElementAccessExpression */) {
return callee.expression;
}
}
}
function createSyntheticExpression(parent, type, isSpread) {
- var result = ts.createNode(215 /* SyntheticExpression */, parent.pos, parent.end);
+ var result = ts.createNode(216 /* SyntheticExpression */, parent.pos, parent.end);
result.parent = parent;
result.type = type;
result.isSpread = isSpread || false;
@@ -50011,17 +50874,17 @@
* Returns the effective arguments for an expression that works like a function invocation.
*/
function getEffectiveCallArguments(node) {
- if (node.kind === 193 /* TaggedTemplateExpression */) {
+ if (node.kind === 194 /* TaggedTemplateExpression */) {
var template = node.template;
- var args_4 = [createSyntheticExpression(template, getGlobalTemplateStringsArrayType())];
- if (template.kind === 206 /* TemplateExpression */) {
+ var args_3 = [createSyntheticExpression(template, getGlobalTemplateStringsArrayType())];
+ if (template.kind === 207 /* TemplateExpression */) {
ts.forEach(template.templateSpans, function (span) {
- args_4.push(span.expression);
+ args_3.push(span.expression);
});
}
- return args_4;
+ return args_3;
}
- if (node.kind === 152 /* Decorator */) {
+ if (node.kind === 153 /* Decorator */) {
return getEffectiveDecoratorArguments(node);
}
if (ts.isJsxOpeningLikeElement(node)) {
@@ -50034,7 +50897,7 @@
// of the argument is a tuple type, spread the tuple elements into the argument list. We can
// call checkExpressionCached because spread expressions never have a contextual type.
var spreadArgument_1 = args[length - 1];
- var type = checkExpressionCached(spreadArgument_1.expression);
+ var type = flowLoopCount ? checkExpression(spreadArgument_1.expression) : checkExpressionCached(spreadArgument_1.expression);
if (isTupleType(type)) {
var typeArguments = type.typeArguments || ts.emptyArray;
var restIndex_2 = type.target.hasRestElement ? typeArguments.length - 1 : -1;
@@ -50051,30 +50914,30 @@
var parent = node.parent;
var expr = node.expression;
switch (parent.kind) {
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
// For a class decorator, the `target` is the type of the class (e.g. the
// "static" or "constructor" side of the class).
return [
createSyntheticExpression(expr, getTypeOfSymbol(getSymbolOfNode(parent)))
];
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
// A parameter declaration decorator will have three arguments (see
// `ParameterDecorator` in core.d.ts).
var func = parent.parent;
return [
- createSyntheticExpression(expr, parent.parent.kind === 157 /* Constructor */ ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType),
+ createSyntheticExpression(expr, parent.parent.kind === 158 /* Constructor */ ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType),
createSyntheticExpression(expr, anyType),
createSyntheticExpression(expr, numberType)
];
- case 154 /* PropertyDeclaration */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 155 /* PropertyDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
// A method or accessor declaration decorator will have two or three arguments (see
// `PropertyDecorator` and `MethodDecorator` in core.d.ts). If we are emitting decorators
// for ES3, we will only pass two arguments.
- var hasPropDesc = parent.kind !== 154 /* PropertyDeclaration */ && languageVersion !== 0 /* ES3 */;
+ var hasPropDesc = parent.kind !== 155 /* PropertyDeclaration */ && languageVersion !== 0 /* ES3 */;
return [
createSyntheticExpression(expr, getParentTypeOfClassElement(parent)),
createSyntheticExpression(expr, getClassElementPropertyKeyType(parent)),
@@ -50088,17 +50951,17 @@
*/
function getDecoratorArgumentCount(node, signature) {
switch (node.parent.kind) {
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
return 1;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return 2;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
// For ES3 or decorators with only two parameters we supply only two arguments
return languageVersion === 0 /* ES3 */ || signature.parameters.length <= 2 ? 2 : 3;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return 3;
default:
return ts.Debug.fail();
@@ -50198,15 +51061,15 @@
return ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), typeArguments, ts.Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount);
}
function resolveCall(node, signatures, candidatesOutArray, checkMode, fallbackError) {
- var isTaggedTemplate = node.kind === 193 /* TaggedTemplateExpression */;
- var isDecorator = node.kind === 152 /* Decorator */;
+ var isTaggedTemplate = node.kind === 194 /* TaggedTemplateExpression */;
+ var isDecorator = node.kind === 153 /* Decorator */;
var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node);
var reportErrors = !candidatesOutArray;
var typeArguments;
if (!isDecorator) {
typeArguments = node.typeArguments;
// We already perform checking on the type arguments on the class declaration itself.
- if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 98 /* SuperKeyword */) {
+ if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 99 /* SuperKeyword */) {
ts.forEach(typeArguments, checkSourceElement);
}
}
@@ -50261,7 +51124,7 @@
var result;
// If we are in signature help, a trailing comma indicates that we intend to provide another argument,
// so we will only accept overloads with arity at least 1 higher than the current number of provided arguments.
- var signatureHelpTrailingComma = !!(checkMode & 16 /* IsForSignatureHelp */) && node.kind === 191 /* CallExpression */ && node.arguments.hasTrailingComma;
+ var signatureHelpTrailingComma = !!(checkMode & 16 /* IsForSignatureHelp */) && node.kind === 192 /* CallExpression */ && node.arguments.hasTrailingComma;
// Section 4.12.1:
// if the candidate list contains one or more signatures for which the type of each argument
// expression is a subtype of each corresponding parameter type, the return type of the first
@@ -50412,7 +51275,7 @@
}
var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
var parameters = [];
- var _loop_8 = function (i) {
+ var _loop_11 = function (i) {
var symbols = ts.mapDefined(candidates, function (_a) {
var parameters = _a.parameters, hasRestParameter = _a.hasRestParameter;
return hasRestParameter ?
@@ -50423,7 +51286,7 @@
parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
};
for (var i = 0; i < maxNonRestParam; i++) {
- _loop_8(i);
+ _loop_11(i);
}
var restParameterSymbols = ts.mapDefined(candidates, function (c) { return c.hasRestParameter ? ts.last(c.parameters) : undefined; });
var hasRestParameter = restParameterSymbols.length !== 0;
@@ -50501,7 +51364,7 @@
return maxParamsIndex;
}
function resolveCallExpression(node, candidatesOutArray, checkMode) {
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
var superType = checkSuperExpression(node.expression);
if (isTypeAny(superType)) {
for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) {
@@ -50778,16 +51641,16 @@
*/
function getDiagnosticHeadMessageForDecoratorResolution(node) {
switch (node.parent.kind) {
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression;
default:
return ts.Debug.fail();
@@ -50830,7 +51693,7 @@
// file would probably be preferable.
var typeSymbol = exports && getSymbol(exports, JsxNames.Element, 67897832 /* Type */);
var returnNode = typeSymbol && nodeBuilder.symbolToEntityName(typeSymbol, 67897832 /* Type */, node);
- var declaration = ts.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.createKeywordTypeNode(120 /* AnyKeyword */));
+ var declaration = ts.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.createKeywordTypeNode(121 /* AnyKeyword */));
var parameterSymbol = createSymbol(1 /* FunctionScopedVariable */, "props");
parameterSymbol.type = result;
return createSignature(declaration,
@@ -50877,16 +51740,16 @@
}
function resolveSignature(node, candidatesOutArray, checkMode) {
switch (node.kind) {
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return resolveCallExpression(node, candidatesOutArray, checkMode);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return resolveNewExpression(node, candidatesOutArray, checkMode);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode);
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
return resolveDecorator(node, candidatesOutArray, checkMode);
- case 262 /* JsxOpeningElement */:
- case 261 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
+ case 262 /* JsxSelfClosingElement */:
return resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode);
}
throw ts.Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable.");
@@ -50973,10 +51836,10 @@
return false;
}
var parent = node.parent;
- while (parent && parent.kind === 189 /* PropertyAccessExpression */) {
+ while (parent && parent.kind === 190 /* PropertyAccessExpression */) {
parent = parent.parent;
}
- if (parent && ts.isBinaryExpression(parent) && ts.isPrototypeAccess(parent.left) && parent.operatorToken.kind === 59 /* EqualsToken */) {
+ if (parent && ts.isBinaryExpression(parent) && ts.isPrototypeAccess(parent.left) && parent.operatorToken.kind === 60 /* EqualsToken */) {
var right = ts.getInitializerOfBinaryExpression(parent);
return ts.isObjectLiteralExpression(right) && right;
}
@@ -51002,15 +51865,15 @@
// returns a function type. We defer checking and return nonInferrableType.
return nonInferrableType;
}
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
return voidType;
}
- if (node.kind === 192 /* NewExpression */) {
+ if (node.kind === 193 /* NewExpression */) {
var declaration = signature.declaration;
if (declaration &&
- declaration.kind !== 157 /* Constructor */ &&
- declaration.kind !== 161 /* ConstructSignature */ &&
- declaration.kind !== 166 /* ConstructorType */ &&
+ declaration.kind !== 158 /* Constructor */ &&
+ declaration.kind !== 162 /* ConstructSignature */ &&
+ declaration.kind !== 167 /* ConstructorType */ &&
!ts.isJSDocConstructSignature(declaration) &&
!isJSConstructor(declaration)) {
// When resolved signature is a call signature (and not a construct signature) the result type is any
@@ -51127,9 +51990,9 @@
return false;
}
var targetDeclarationKind = resolvedRequire.flags & 16 /* Function */
- ? 239 /* FunctionDeclaration */
+ ? 240 /* FunctionDeclaration */
: resolvedRequire.flags & 3 /* Variable */
- ? 237 /* VariableDeclaration */
+ ? 238 /* VariableDeclaration */
: 0 /* Unknown */;
if (targetDeclarationKind !== 0 /* Unknown */) {
var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind);
@@ -51154,18 +52017,25 @@
case 14 /* NoSubstitutionTemplateLiteral */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
- case 187 /* ArrayLiteralExpression */:
- case 188 /* ObjectLiteralExpression */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
+ case 188 /* ArrayLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return true;
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return isValidConstAssertionArgument(node.expression);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
var op = node.operator;
var arg = node.operand;
return op === 39 /* MinusToken */ && (arg.kind === 8 /* NumericLiteral */ || arg.kind === 9 /* BigIntLiteral */) ||
op === 38 /* PlusToken */ && arg.kind === 8 /* NumericLiteral */;
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
+ var expr = node.expression;
+ if (ts.isIdentifier(expr)) {
+ var symbol = getSymbolAtLocation(expr);
+ return !!(symbol && (symbol.flags & 384 /* Enum */) && getEnumKind(symbol) === 1 /* Literal */);
+ }
}
return false;
}
@@ -51173,7 +52043,7 @@
var exprType = checkExpression(expression, checkMode);
if (ts.isConstTypeReference(type)) {
if (!isValidConstAssertionArgument(expression)) {
- error(expression, ts.Diagnostics.A_const_assertion_can_only_be_applied_to_a_string_number_boolean_array_or_object_literal);
+ error(expression, ts.Diagnostics.A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals);
}
return getRegularTypeOfLiteralType(exprType);
}
@@ -51193,10 +52063,10 @@
}
function checkMetaProperty(node) {
checkGrammarMetaProperty(node);
- if (node.keywordToken === 95 /* NewKeyword */) {
+ if (node.keywordToken === 96 /* NewKeyword */) {
return checkNewTargetMetaProperty(node);
}
- if (node.keywordToken === 92 /* ImportKeyword */) {
+ if (node.keywordToken === 93 /* ImportKeyword */) {
return checkImportMetaProperty(node);
}
return ts.Debug.assertNever(node.keywordToken);
@@ -51207,7 +52077,7 @@
error(node, ts.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target");
return errorType;
}
- else if (container.kind === 157 /* Constructor */) {
+ else if (container.kind === 158 /* Constructor */) {
var symbol = getSymbolOfNode(container.parent);
return getTypeOfSymbol(symbol);
}
@@ -51217,7 +52087,7 @@
}
}
function checkImportMetaProperty(node) {
- if (languageVersion < 7 /* ESNext */ || moduleKind < ts.ModuleKind.ESNext) {
+ if (languageVersion < 8 /* ESNext */ || moduleKind < ts.ModuleKind.ESNext) {
error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_using_ESNext_for_the_target_and_module_compiler_options);
}
var file = ts.getSourceFileOfNode(node);
@@ -51393,7 +52263,7 @@
for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) {
var element = _a[_i];
if (!ts.isOmittedExpression(element)) {
- if (element.name.kind === 72 /* Identifier */) {
+ if (element.name.kind === 73 /* Identifier */) {
getSymbolLinks(getSymbolOfNode(element)).type = getTypeForBindingElement(element);
}
else {
@@ -51407,9 +52277,9 @@
if (!links.type) {
links.type = contextualType;
var decl = parameter.valueDeclaration;
- if (decl.name.kind !== 72 /* Identifier */) {
+ if (decl.name.kind !== 73 /* Identifier */) {
// if inference didn't come up with anything but {}, fall back to the binding pattern if present.
- if (links.type === emptyObjectType) {
+ if (links.type === unknownType) {
links.type = getTypeFromBindingPattern(decl.name);
}
assignBindingElementTypes(decl.name);
@@ -51421,24 +52291,24 @@
var globalPromiseType = getGlobalPromiseType(/*reportErrors*/ true);
if (globalPromiseType !== emptyGenericType) {
// if the promised type is itself a promise, get the underlying type; otherwise, fallback to the promised type
- promisedType = getAwaitedType(promisedType) || emptyObjectType;
+ promisedType = getAwaitedType(promisedType) || unknownType;
return createTypeReference(globalPromiseType, [promisedType]);
}
- return emptyObjectType;
+ return unknownType;
}
function createPromiseLikeType(promisedType) {
// creates a `PromiseLike<T>` type where `T` is the promisedType argument
var globalPromiseLikeType = getGlobalPromiseLikeType(/*reportErrors*/ true);
if (globalPromiseLikeType !== emptyGenericType) {
// if the promised type is itself a promise, get the underlying type; otherwise, fallback to the promised type
- promisedType = getAwaitedType(promisedType) || emptyObjectType;
+ promisedType = getAwaitedType(promisedType) || unknownType;
return createTypeReference(globalPromiseLikeType, [promisedType]);
}
- return emptyObjectType;
+ return unknownType;
}
function createPromiseReturnType(func, promisedType) {
var promiseType = createPromiseType(promisedType);
- if (promiseType === emptyObjectType) {
+ if (promiseType === unknownType) {
error(func, ts.isImportCall(func) ?
ts.Diagnostics.A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option :
ts.Diagnostics.An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option);
@@ -51457,7 +52327,7 @@
}
var functionFlags = ts.getFunctionFlags(func);
var type;
- if (func.body.kind !== 218 /* Block */) {
+ if (func.body.kind !== 219 /* Block */) {
type = checkExpressionCached(func.body, checkMode && checkMode & ~8 /* SkipGenericFunctions */);
if (functionFlags & 2 /* Async */) {
// From within an async function you can return either a non-promise value or a promise. Any
@@ -51599,7 +52469,7 @@
if (!node.possiblyExhaustive) {
return false;
}
- if (node.expression.kind === 199 /* TypeOfExpression */) {
+ if (node.expression.kind === 200 /* TypeOfExpression */) {
var operandType = getTypeOfExpression(node.expression.expression);
// This cast is safe because the switch is possibly exhaustive and does not contain a default case, so there can be no undefined.
var witnesses = getSwitchClauseTypeOfWitnesses(node);
@@ -51622,7 +52492,7 @@
if (!(func.flags & 128 /* HasImplicitReturn */)) {
return false;
}
- if (ts.some(func.body.statements, function (statement) { return statement.kind === 232 /* SwitchStatement */ && isExhaustiveSwitchStatement(statement); })) {
+ if (ts.some(func.body.statements, function (statement) { return statement.kind === 233 /* SwitchStatement */ && isExhaustiveSwitchStatement(statement); })) {
return false;
}
return true;
@@ -51665,11 +52535,11 @@
}
function mayReturnNever(func) {
switch (func.kind) {
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return true;
- case 156 /* MethodDeclaration */:
- return func.parent.kind === 188 /* ObjectLiteralExpression */;
+ case 157 /* MethodDeclaration */:
+ return func.parent.kind === 189 /* ObjectLiteralExpression */;
default:
return false;
}
@@ -51693,7 +52563,7 @@
}
// If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check.
// also if HasImplicitReturn flag is not set this means that all codepaths in function body end with return or throw
- if (func.kind === 155 /* MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 218 /* Block */ || !functionHasImplicitReturn(func)) {
+ if (func.kind === 156 /* MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 219 /* Block */ || !functionHasImplicitReturn(func)) {
return;
}
var hasExplicitReturn = func.flags & 256 /* HasExplicitReturn */;
@@ -51726,7 +52596,7 @@
}
}
function checkFunctionExpressionOrObjectLiteralMethod(node, checkMode) {
- ts.Debug.assert(node.kind !== 156 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
+ ts.Debug.assert(node.kind !== 157 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
checkNodeDeferred(node);
// The identityMapper object is used to indicate that function expressions are wildcards
if (checkMode && checkMode & 4 /* SkipContextSensitive */ && isContextSensitive(node)) {
@@ -51746,7 +52616,7 @@
}
// Grammar checking
var hasGrammarError = checkGrammarFunctionLikeDeclaration(node);
- if (!hasGrammarError && node.kind === 196 /* FunctionExpression */) {
+ if (!hasGrammarError && node.kind === 197 /* FunctionExpression */) {
checkGrammarForGenerator(node);
}
var links = getNodeLinks(node);
@@ -51791,7 +52661,7 @@
getAwaitedType(type) || errorType : type;
}
function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) {
- ts.Debug.assert(node.kind !== 156 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
+ ts.Debug.assert(node.kind !== 157 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
var functionFlags = ts.getFunctionFlags(node);
var returnOrPromisedType = getReturnOrPromisedType(node, functionFlags);
if ((functionFlags & 1 /* Generator */) === 0) { // Async function or normal function
@@ -51807,7 +52677,7 @@
// checkFunctionExpressionBodies). So it must be done now.
getReturnTypeOfSignature(getSignatureFromDeclaration(node));
}
- if (node.body.kind === 218 /* Block */) {
+ if (node.body.kind === 219 /* Block */) {
checkSourceElement(node.body);
}
else {
@@ -51885,11 +52755,11 @@
if (isReadonlySymbol(symbol)) {
// Allow assignments to readonly properties within constructors of the same class declaration.
if (symbol.flags & 4 /* Property */ &&
- (expr.kind === 189 /* PropertyAccessExpression */ || expr.kind === 190 /* ElementAccessExpression */) &&
- expr.expression.kind === 100 /* ThisKeyword */) {
+ (expr.kind === 190 /* PropertyAccessExpression */ || expr.kind === 191 /* ElementAccessExpression */) &&
+ expr.expression.kind === 101 /* ThisKeyword */) {
// Look for if this is the constructor for the class that `symbol` is a property of.
var func = ts.getContainingFunction(expr);
- if (!(func && func.kind === 157 /* Constructor */)) {
+ if (!(func && func.kind === 158 /* Constructor */)) {
return true;
}
// If func.parent is a class and symbol is a (readonly) property of that class, or
@@ -51902,13 +52772,13 @@
return false;
}
function isReferenceThroughNamespaceImport(expr) {
- if (expr.kind === 189 /* PropertyAccessExpression */ || expr.kind === 190 /* ElementAccessExpression */) {
+ if (expr.kind === 190 /* PropertyAccessExpression */ || expr.kind === 191 /* ElementAccessExpression */) {
var node = ts.skipParentheses(expr.expression);
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
var symbol = getNodeLinks(node).resolvedSymbol;
if (symbol.flags & 2097152 /* Alias */) {
var declaration = getDeclarationOfAliasSymbol(symbol);
- return !!declaration && declaration.kind === 251 /* NamespaceImport */;
+ return !!declaration && declaration.kind === 252 /* NamespaceImport */;
}
}
}
@@ -51917,7 +52787,7 @@
function checkReferenceExpression(expr, invalidReferenceMessage) {
// References are combinations of identifiers, parentheses, and property accesses.
var node = ts.skipOuterExpressions(expr, 2 /* Assertions */ | 1 /* Parentheses */);
- if (node.kind !== 72 /* Identifier */ && node.kind !== 189 /* PropertyAccessExpression */ && node.kind !== 190 /* ElementAccessExpression */) {
+ if (node.kind !== 73 /* Identifier */ && node.kind !== 190 /* PropertyAccessExpression */ && node.kind !== 191 /* ElementAccessExpression */) {
error(expr, invalidReferenceMessage);
return false;
}
@@ -51926,7 +52796,7 @@
function checkDeleteExpression(node) {
checkExpression(node.expression);
var expr = ts.skipParentheses(node.expression);
- if (expr.kind !== 189 /* PropertyAccessExpression */ && expr.kind !== 190 /* ElementAccessExpression */) {
+ if (expr.kind !== 190 /* PropertyAccessExpression */ && expr.kind !== 191 /* ElementAccessExpression */) {
error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference);
return booleanType;
}
@@ -51949,7 +52819,19 @@
// Grammar checking
if (produceDiagnostics) {
if (!(node.flags & 16384 /* AwaitContext */)) {
- grammarErrorOnFirstToken(node, ts.Diagnostics.await_expression_is_only_allowed_within_an_async_function);
+ // use of 'await' in non-async function
+ var sourceFile = ts.getSourceFileOfNode(node);
+ if (!hasParseDiagnostics(sourceFile)) {
+ var span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);
+ var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.await_expression_is_only_allowed_within_an_async_function);
+ var func = ts.getContainingFunction(node);
+ if (func && func.kind !== 158 /* Constructor */) {
+ ts.Debug.assert((ts.getFunctionFlags(func) & 2 /* Async */) === 0, "Enclosing function should never be an async function.");
+ var relatedInfo = ts.createDiagnosticForNode(func, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async);
+ ts.addRelatedInfo(diagnostic, relatedInfo);
+ }
+ diagnostics.add(diagnostic);
+ }
}
if (isInParameterInitializerBeforeContainingFunction(node)) {
error(node, ts.Diagnostics.await_expressions_cannot_be_used_in_a_parameter_initializer);
@@ -52041,8 +52923,8 @@
}
if (type.flags & 3145728 /* UnionOrIntersection */) {
var types = type.types;
- for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
- var t = types_16[_i];
+ for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
+ var t = types_15[_i];
if (maybeTypeOfKind(t, kind)) {
return true;
}
@@ -52121,16 +53003,17 @@
if (strictNullChecks && properties.length === 0) {
return checkNonNullType(sourceType, node);
}
- for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) {
- var p = properties_5[_i];
- checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, properties, rightIsThis);
+ for (var i = 0; i < properties.length; i++) {
+ checkObjectLiteralDestructuringPropertyAssignment(node, sourceType, i, properties, rightIsThis);
}
return sourceType;
}
/** Note: If property cannot be a SpreadAssignment, then allProperties does not need to be provided */
- function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties, rightIsThis) {
+ function checkObjectLiteralDestructuringPropertyAssignment(node, objectLiteralType, propertyIndex, allProperties, rightIsThis) {
if (rightIsThis === void 0) { rightIsThis = false; }
- if (property.kind === 275 /* PropertyAssignment */ || property.kind === 276 /* ShorthandPropertyAssignment */) {
+ var properties = node.properties;
+ var property = properties[propertyIndex];
+ if (property.kind === 276 /* PropertyAssignment */ || property.kind === 277 /* ShorthandPropertyAssignment */) {
var name = property.name;
var exprType = getLiteralTypeFromPropertyName(name);
if (isTypeUsableAsPropertyName(exprType)) {
@@ -52143,22 +53026,30 @@
}
var elementType = getIndexedAccessType(objectLiteralType, exprType, name);
var type = getFlowTypeOfDestructuring(property, elementType);
- return checkDestructuringAssignment(property.kind === 276 /* ShorthandPropertyAssignment */ ? property : property.initializer, type);
+ return checkDestructuringAssignment(property.kind === 277 /* ShorthandPropertyAssignment */ ? property : property.initializer, type);
+ }
+ else if (property.kind === 278 /* SpreadAssignment */) {
+ if (propertyIndex < properties.length - 1) {
+ error(property, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);
}
- else if (property.kind === 277 /* SpreadAssignment */) {
- if (languageVersion < 7 /* ESNext */) {
+ else {
+ if (languageVersion < 8 /* ESNext */) {
checkExternalEmitHelpers(property, 4 /* Rest */);
}
var nonRestNames = [];
if (allProperties) {
- for (var i = 0; i < allProperties.length - 1; i++) {
- nonRestNames.push(allProperties[i].name);
+ for (var _i = 0, allProperties_1 = allProperties; _i < allProperties_1.length; _i++) {
+ var otherProperty = allProperties_1[_i];
+ if (!ts.isSpreadAssignment(otherProperty)) {
+ nonRestNames.push(otherProperty.name);
+ }
}
}
var type = getRestType(objectLiteralType, nonRestNames, objectLiteralType.symbol);
checkGrammarForDisallowedTrailingComma(allProperties, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma);
return checkDestructuringAssignment(property.expression, type);
}
+ }
else {
error(property, ts.Diagnostics.Property_assignment_expected);
}
@@ -52180,8 +53071,8 @@
function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, checkMode) {
var elements = node.elements;
var element = elements[elementIndex];
- if (element.kind !== 210 /* OmittedExpression */) {
- if (element.kind !== 208 /* SpreadElement */) {
+ if (element.kind !== 211 /* OmittedExpression */) {
+ if (element.kind !== 209 /* SpreadElement */) {
var indexType = getLiteralType(elementIndex);
if (isArrayLikeType(sourceType)) {
// We create a synthetic expression so that getIndexedAccessType doesn't get confused
@@ -52197,7 +53088,7 @@
}
else {
var restExpression = element.expression;
- if (restExpression.kind === 204 /* BinaryExpression */ && restExpression.operatorToken.kind === 59 /* EqualsToken */) {
+ if (restExpression.kind === 205 /* BinaryExpression */ && restExpression.operatorToken.kind === 60 /* EqualsToken */) {
error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer);
}
else {
@@ -52213,7 +53104,7 @@
}
function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode, rightIsThis) {
var target;
- if (exprOrAssignment.kind === 276 /* ShorthandPropertyAssignment */) {
+ if (exprOrAssignment.kind === 277 /* ShorthandPropertyAssignment */) {
var prop = exprOrAssignment;
if (prop.objectAssignmentInitializer) {
// In strict null checking mode, if a default value of a non-undefined type is specified, remove
@@ -52229,21 +53120,21 @@
else {
target = exprOrAssignment;
}
- if (target.kind === 204 /* BinaryExpression */ && target.operatorToken.kind === 59 /* EqualsToken */) {
+ if (target.kind === 205 /* BinaryExpression */ && target.operatorToken.kind === 60 /* EqualsToken */) {
checkBinaryExpression(target, checkMode);
target = target.left;
}
- if (target.kind === 188 /* ObjectLiteralExpression */) {
+ if (target.kind === 189 /* ObjectLiteralExpression */) {
return checkObjectLiteralAssignment(target, sourceType, rightIsThis);
}
- if (target.kind === 187 /* ArrayLiteralExpression */) {
+ if (target.kind === 188 /* ArrayLiteralExpression */) {
return checkArrayLiteralAssignment(target, sourceType, checkMode);
}
return checkReferenceAssignment(target, sourceType, checkMode);
}
function checkReferenceAssignment(target, sourceType, checkMode) {
var targetType = checkExpression(target, checkMode);
- var error = target.parent.kind === 277 /* SpreadAssignment */ ?
+ var error = target.parent.kind === 278 /* SpreadAssignment */ ?
ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access :
ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access;
if (checkReferenceExpression(target, error)) {
@@ -52262,39 +53153,39 @@
function isSideEffectFree(node) {
node = ts.skipParentheses(node);
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
case 10 /* StringLiteral */:
case 13 /* RegularExpressionLiteral */:
- case 193 /* TaggedTemplateExpression */:
- case 206 /* TemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
+ case 207 /* TemplateExpression */:
case 14 /* NoSubstitutionTemplateLiteral */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
- case 96 /* NullKeyword */:
- case 141 /* UndefinedKeyword */:
- case 196 /* FunctionExpression */:
- case 209 /* ClassExpression */:
- case 197 /* ArrowFunction */:
- case 187 /* ArrayLiteralExpression */:
- case 188 /* ObjectLiteralExpression */:
- case 199 /* TypeOfExpression */:
- case 213 /* NonNullExpression */:
- case 261 /* JsxSelfClosingElement */:
- case 260 /* JsxElement */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
+ case 97 /* NullKeyword */:
+ case 142 /* UndefinedKeyword */:
+ case 197 /* FunctionExpression */:
+ case 210 /* ClassExpression */:
+ case 198 /* ArrowFunction */:
+ case 188 /* ArrayLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
+ case 200 /* TypeOfExpression */:
+ case 214 /* NonNullExpression */:
+ case 262 /* JsxSelfClosingElement */:
+ case 261 /* JsxElement */:
return true;
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return isSideEffectFree(node.whenTrue) &&
isSideEffectFree(node.whenFalse);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
if (ts.isAssignmentOperator(node.operatorToken.kind)) {
return false;
}
return isSideEffectFree(node.left) &&
isSideEffectFree(node.right);
- case 202 /* PrefixUnaryExpression */:
- case 203 /* PostfixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
// Unary operators ~, !, +, and - have no side effects.
// The rest do.
switch (node.operator) {
@@ -52306,9 +53197,9 @@
}
return false;
// Some forms listed here for clarity
- case 200 /* VoidExpression */: // Explicit opt-out
- case 194 /* TypeAssertionExpression */: // Not SEF, but can produce useful type warnings
- case 212 /* AsExpression */: // Not SEF, but can produce useful type warnings
+ case 201 /* VoidExpression */: // Explicit opt-out
+ case 195 /* TypeAssertionExpression */: // Not SEF, but can produce useful type warnings
+ case 213 /* AsExpression */: // Not SEF, but can produce useful type warnings
default:
return false;
}
@@ -52324,8 +53215,8 @@
}
function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) {
var operator = operatorToken.kind;
- if (operator === 59 /* EqualsToken */ && (left.kind === 188 /* ObjectLiteralExpression */ || left.kind === 187 /* ArrayLiteralExpression */)) {
- return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode, right.kind === 100 /* ThisKeyword */);
+ if (operator === 60 /* EqualsToken */ && (left.kind === 189 /* ObjectLiteralExpression */ || left.kind === 188 /* ArrayLiteralExpression */)) {
+ return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode, right.kind === 101 /* ThisKeyword */);
}
var leftType;
if (operator === 54 /* AmpersandAmpersandToken */ || operator === 55 /* BarBarToken */) {
@@ -52338,26 +53229,26 @@
switch (operator) {
case 40 /* AsteriskToken */:
case 41 /* AsteriskAsteriskToken */:
- case 62 /* AsteriskEqualsToken */:
- case 63 /* AsteriskAsteriskEqualsToken */:
+ case 63 /* AsteriskEqualsToken */:
+ case 64 /* AsteriskAsteriskEqualsToken */:
case 42 /* SlashToken */:
- case 64 /* SlashEqualsToken */:
+ case 65 /* SlashEqualsToken */:
case 43 /* PercentToken */:
- case 65 /* PercentEqualsToken */:
+ case 66 /* PercentEqualsToken */:
case 39 /* MinusToken */:
- case 61 /* MinusEqualsToken */:
+ case 62 /* MinusEqualsToken */:
case 46 /* LessThanLessThanToken */:
- case 66 /* LessThanLessThanEqualsToken */:
+ case 67 /* LessThanLessThanEqualsToken */:
case 47 /* GreaterThanGreaterThanToken */:
- case 67 /* GreaterThanGreaterThanEqualsToken */:
+ case 68 /* GreaterThanGreaterThanEqualsToken */:
case 48 /* GreaterThanGreaterThanGreaterThanToken */:
- case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
+ case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
case 50 /* BarToken */:
- case 70 /* BarEqualsToken */:
+ case 71 /* BarEqualsToken */:
case 51 /* CaretToken */:
- case 71 /* CaretEqualsToken */:
+ case 72 /* CaretEqualsToken */:
case 49 /* AmpersandToken */:
- case 69 /* AmpersandEqualsToken */:
+ case 70 /* AmpersandEqualsToken */:
if (leftType === silentNeverType || rightType === silentNeverType) {
return silentNeverType;
}
@@ -52387,7 +53278,7 @@
else if (isTypeAssignableToKind(leftType, 2112 /* BigIntLike */) && isTypeAssignableToKind(rightType, 2112 /* BigIntLike */)) {
switch (operator) {
case 48 /* GreaterThanGreaterThanGreaterThanToken */:
- case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
+ case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
reportOperatorError();
}
resultType_1 = bigintType;
@@ -52402,7 +53293,7 @@
return resultType_1;
}
case 38 /* PlusToken */:
- case 60 /* PlusEqualsToken */:
+ case 61 /* PlusEqualsToken */:
if (leftType === silentNeverType || rightType === silentNeverType) {
return silentNeverType;
}
@@ -52437,7 +53328,7 @@
reportOperatorError();
return anyType;
}
- if (operator === 60 /* PlusEqualsToken */) {
+ if (operator === 61 /* PlusEqualsToken */) {
checkAssignmentOperator(resultType);
}
return resultType;
@@ -52458,19 +53349,13 @@
case 34 /* ExclamationEqualsToken */:
case 35 /* EqualsEqualsEqualsToken */:
case 36 /* ExclamationEqualsEqualsToken */:
- var leftIsLiteral = isLiteralType(leftType);
- var rightIsLiteral = isLiteralType(rightType);
- if (!leftIsLiteral || !rightIsLiteral) {
- leftType = leftIsLiteral ? getBaseTypeOfLiteralType(leftType) : leftType;
- rightType = rightIsLiteral ? getBaseTypeOfLiteralType(rightType) : rightType;
- }
if (!isTypeEqualityComparableTo(leftType, rightType) && !isTypeEqualityComparableTo(rightType, leftType)) {
reportOperatorError();
}
return booleanType;
- case 94 /* InstanceOfKeyword */:
+ case 95 /* InstanceOfKeyword */:
return checkInstanceOfExpression(left, right, leftType, rightType);
- case 93 /* InKeyword */:
+ case 94 /* InKeyword */:
return checkInExpression(left, right, leftType, rightType);
case 54 /* AmpersandAmpersandToken */:
return getTypeFacts(leftType) & 4194304 /* Truthy */ ?
@@ -52480,7 +53365,7 @@
return getTypeFacts(leftType) & 8388608 /* Falsy */ ?
getUnionType([removeDefinitelyFalsyTypes(leftType), rightType], 2 /* Subtype */) :
leftType;
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
var declKind = ts.isBinaryExpression(left.parent) ? ts.getAssignmentDeclarationKind(left.parent) : 0 /* None */;
checkAssignmentDeclaration(declKind, rightType);
if (isAssignmentDeclaration(declKind)) {
@@ -52524,7 +53409,7 @@
}
}
function isEvalNode(node) {
- return node.kind === 72 /* Identifier */ && node.escapedText === "eval";
+ return node.kind === 73 /* Identifier */ && node.escapedText === "eval";
}
// Return true if there was no error, false if there was an error.
function checkForDisallowedESSymbolOperand(operator) {
@@ -52540,13 +53425,13 @@
function getSuggestedBooleanOperator(operator) {
switch (operator) {
case 50 /* BarToken */:
- case 70 /* BarEqualsToken */:
+ case 71 /* BarEqualsToken */:
return 55 /* BarBarToken */;
case 51 /* CaretToken */:
- case 71 /* CaretEqualsToken */:
+ case 72 /* CaretEqualsToken */:
return 36 /* ExclamationEqualsEqualsToken */;
case 49 /* AmpersandToken */:
- case 69 /* AmpersandEqualsToken */:
+ case 70 /* AmpersandEqualsToken */:
return 54 /* AmpersandAmpersandToken */;
default:
return undefined;
@@ -52585,8 +53470,7 @@
}
}
function reportOperatorError() {
- var leftStr = typeToString(leftType);
- var rightStr = typeToString(rightType);
+ var _a = getTypeNamesForErrorDisplay(leftType, rightType), leftStr = _a[0], rightStr = _a[1];
var errNode = errorNode || operatorToken;
if (!tryGiveBetterPrimaryError(errNode, leftStr, rightStr)) {
error(errNode, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, ts.tokenToString(operatorToken.kind), leftStr, rightStr);
@@ -52641,7 +53525,7 @@
// Async generator functions prior to ESNext require the __await, __asyncDelegator,
// and __asyncValues helpers
if ((functionFlags & 3 /* AsyncGenerator */) === 3 /* AsyncGenerator */ &&
- languageVersion < 7 /* ESNext */) {
+ languageVersion < 8 /* ESNext */) {
checkExternalEmitHelpers(node, 26624 /* AsyncDelegatorIncludes */);
}
// Generator functions prior to ES2015 require the __values helper
@@ -52683,7 +53567,7 @@
return stringType;
}
function getContextNode(node) {
- if (node.kind === 268 /* JsxAttributes */ && !ts.isJsxSelfClosingElement(node.parent)) {
+ if (node.kind === 269 /* JsxAttributes */ && !ts.isJsxSelfClosingElement(node.parent)) {
return node.parent.parent; // Needs to be the root JsxElement, so it encompasses the attributes _and_ the children (which are essentially part of the attributes)
}
return node;
@@ -52722,7 +53606,7 @@
}
function isTypeAssertion(node) {
node = ts.skipParentheses(node);
- return node.kind === 194 /* TypeAssertionExpression */ || node.kind === 212 /* AsExpression */;
+ return node.kind === 195 /* TypeAssertionExpression */ || node.kind === 213 /* AsExpression */;
}
function checkDeclarationInitializer(declaration) {
var initializer = ts.getEffectiveInitializer(declaration);
@@ -52753,7 +53637,7 @@
// If the contextual type is a type variable constrained to a primitive type, consider
// this a literal context for literals of that primitive type. For example, given a
// type parameter 'T extends string', infer string literal types for T.
- var constraint = getBaseConstraintOfType(contextualType) || emptyObjectType;
+ var constraint = getBaseConstraintOfType(contextualType) || unknownType;
return maybeTypeOfKind(constraint, 4 /* String */) && maybeTypeOfKind(candidateType, 128 /* StringLiteral */) ||
maybeTypeOfKind(constraint, 8 /* Number */) && maybeTypeOfKind(candidateType, 256 /* NumberLiteral */) ||
maybeTypeOfKind(constraint, 64 /* BigInt */) && maybeTypeOfKind(candidateType, 2048 /* BigIntLiteral */) ||
@@ -52786,7 +53670,7 @@
// Do not use hasDynamicName here, because that returns false for well known symbols.
// We want to perform checkComputedPropertyName for all computed properties, including
// well known symbols.
- if (node.name.kind === 149 /* ComputedPropertyName */) {
+ if (node.name.kind === 150 /* ComputedPropertyName */) {
checkComputedPropertyName(node.name);
}
return checkExpressionForMutableLocation(node.initializer, checkMode);
@@ -52797,7 +53681,7 @@
// Do not use hasDynamicName here, because that returns false for well known symbols.
// We want to perform checkComputedPropertyName for all computed properties, including
// well known symbols.
- if (node.name.kind === 149 /* ComputedPropertyName */) {
+ if (node.name.kind === 150 /* ComputedPropertyName */) {
checkComputedPropertyName(node.name);
}
var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, checkMode);
@@ -52805,16 +53689,18 @@
}
function instantiateTypeWithSingleGenericCallSignature(node, type, checkMode) {
if (checkMode && checkMode & (2 /* Inferential */ | 8 /* SkipGenericFunctions */)) {
- var signature = getSingleCallSignature(type);
+ var callSignature = getSingleSignature(type, 0 /* Call */, /*allowMembers*/ true);
+ var constructSignature = getSingleSignature(type, 1 /* Construct */, /*allowMembers*/ true);
+ var signature = callSignature || constructSignature;
if (signature && signature.typeParameters) {
+ var contextualType = getApparentTypeOfContextualType(node);
+ if (contextualType && !isMixinConstructorType(contextualType)) {
+ var contextualSignature = getSingleSignature(getNonNullableType(contextualType), callSignature ? 0 /* Call */ : 1 /* Construct */, /*allowMembers*/ false);
+ if (contextualSignature && !contextualSignature.typeParameters) {
if (checkMode & 8 /* SkipGenericFunctions */) {
skippedGenericFunction(node, checkMode);
return anyFunctionType;
}
- var contextualType = getApparentTypeOfContextualType(node);
- if (contextualType) {
- var contextualSignature = getSingleCallSignature(getNonNullableType(contextualType));
- if (contextualSignature && !contextualSignature.typeParameters) {
var context = getInferenceContext(node);
// We have an expression that is an argument of a generic function for which we are performing
// type argument inference. The expression is of a function type with a single generic call
@@ -52822,7 +53708,8 @@
// if the outer function returns a function type with a single non-generic call signature and
// if some of the outer function type parameters have no inferences so far. If so, we can
// potentially add inferred type parameters to the outer function return type.
- var returnSignature = context.signature && getSingleCallSignature(getReturnTypeOfSignature(context.signature));
+ var returnType = context.signature && getReturnTypeOfSignature(context.signature);
+ var returnSignature = returnType && getSingleCallOrConstructSignature(returnType);
if (returnSignature && !returnSignature.typeParameters && !ts.every(context.inferences, hasInferenceCandidates)) {
// Instantiate the signature with its own type parameters as type arguments, possibly
// renaming the type parameters to ensure they have unique names.
@@ -52937,7 +53824,7 @@
var expr = ts.skipParentheses(node);
// Optimize for the common case of a call to a function with a single non-generic call
// signature where we can just fetch the return type without checking the arguments.
- if (expr.kind === 191 /* CallExpression */ && expr.expression.kind !== 98 /* SuperKeyword */ && !ts.isRequireCall(expr, /*checkArgumentIsStringLiteralLike*/ true) && !isSymbolOrSymbolForCall(expr)) {
+ if (expr.kind === 192 /* CallExpression */ && expr.expression.kind !== 99 /* SuperKeyword */ && !ts.isRequireCall(expr, /*checkArgumentIsStringLiteralLike*/ true) && !isSymbolOrSymbolForCall(expr)) {
var funcType = checkNonNullExpression(expr.expression);
var signature = getSingleCallSignature(funcType);
if (signature && !signature.typeParameters) {
@@ -52986,10 +53873,10 @@
// - 'left' in property access
// - 'object' in indexed access
// - target in rhs of import statement
- var ok = (node.parent.kind === 189 /* PropertyAccessExpression */ && node.parent.expression === node) ||
- (node.parent.kind === 190 /* ElementAccessExpression */ && node.parent.expression === node) ||
- ((node.kind === 72 /* Identifier */ || node.kind === 148 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) ||
- (node.parent.kind === 167 /* TypeQuery */ && node.parent.exprName === node));
+ var ok = (node.parent.kind === 190 /* PropertyAccessExpression */ && node.parent.expression === node) ||
+ (node.parent.kind === 191 /* ElementAccessExpression */ && node.parent.expression === node) ||
+ ((node.kind === 73 /* Identifier */ || node.kind === 149 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) ||
+ (node.parent.kind === 168 /* TypeQuery */ && node.parent.exprName === node));
if (!ok) {
error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query);
}
@@ -53010,13 +53897,13 @@
}
function checkExpressionWorker(node, checkMode, forceTuple) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return checkIdentifier(node);
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
return checkThisExpression(node);
- case 98 /* SuperKeyword */:
+ case 99 /* SuperKeyword */:
return checkSuperExpression(node);
- case 96 /* NullKeyword */:
+ case 97 /* NullKeyword */:
return nullWideningType;
case 14 /* NoSubstitutionTemplateLiteral */:
case 10 /* StringLiteral */:
@@ -53027,82 +53914,82 @@
case 9 /* BigIntLiteral */:
checkGrammarBigIntLiteral(node);
return getFreshTypeOfLiteralType(getBigIntLiteralType(node));
- case 102 /* TrueKeyword */:
+ case 103 /* TrueKeyword */:
return trueType;
- case 87 /* FalseKeyword */:
+ case 88 /* FalseKeyword */:
return falseType;
- case 206 /* TemplateExpression */:
+ case 207 /* TemplateExpression */:
return checkTemplateExpression(node);
case 13 /* RegularExpressionLiteral */:
return globalRegExpType;
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return checkArrayLiteral(node, checkMode, forceTuple);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return checkObjectLiteral(node, checkMode);
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return checkPropertyAccessExpression(node);
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
return checkQualifiedName(node);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return checkIndexedAccess(node);
- case 191 /* CallExpression */:
- if (node.expression.kind === 92 /* ImportKeyword */) {
+ case 192 /* CallExpression */:
+ if (node.expression.kind === 93 /* ImportKeyword */) {
return checkImportCallExpression(node);
}
/* falls through */
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return checkCallExpression(node, checkMode);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return checkTaggedTemplateExpression(node);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return checkParenthesizedExpression(node, checkMode);
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
return checkClassExpression(node);
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode);
- case 199 /* TypeOfExpression */:
+ case 200 /* TypeOfExpression */:
return checkTypeOfExpression(node);
- case 194 /* TypeAssertionExpression */:
- case 212 /* AsExpression */:
+ case 195 /* TypeAssertionExpression */:
+ case 213 /* AsExpression */:
return checkAssertion(node);
- case 213 /* NonNullExpression */:
+ case 214 /* NonNullExpression */:
return checkNonNullAssertion(node);
- case 214 /* MetaProperty */:
+ case 215 /* MetaProperty */:
return checkMetaProperty(node);
- case 198 /* DeleteExpression */:
+ case 199 /* DeleteExpression */:
return checkDeleteExpression(node);
- case 200 /* VoidExpression */:
+ case 201 /* VoidExpression */:
return checkVoidExpression(node);
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
return checkAwaitExpression(node);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return checkPrefixUnaryExpression(node);
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return checkPostfixUnaryExpression(node);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return checkBinaryExpression(node, checkMode);
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return checkConditionalExpression(node, checkMode);
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
return checkSpreadExpression(node, checkMode);
- case 210 /* OmittedExpression */:
+ case 211 /* OmittedExpression */:
return undefinedWideningType;
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return checkYieldExpression(node);
- case 215 /* SyntheticExpression */:
+ case 216 /* SyntheticExpression */:
return node.type;
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return checkJsxExpression(node, checkMode);
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
return checkJsxElement(node, checkMode);
- case 261 /* JsxSelfClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
return checkJsxSelfClosingElement(node, checkMode);
- case 264 /* JsxFragment */:
+ case 265 /* JsxFragment */:
return checkJsxFragment(node);
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
return checkJsxAttributes(node, checkMode);
- case 262 /* JsxOpeningElement */:
+ case 263 /* JsxOpeningElement */:
ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement");
}
return errorType;
@@ -53124,7 +54011,7 @@
var constraintType = getConstraintOfTypeParameter(typeParameter);
var defaultType = getDefaultFromTypeParameter(typeParameter);
if (constraintType && defaultType) {
- checkTypeAssignableTo(defaultType, getTypeWithThisArgument(constraintType, defaultType), node.default, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1);
+ checkTypeAssignableTo(defaultType, getTypeWithThisArgument(instantiateType(constraintType, makeUnaryTypeMapper(typeParameter, defaultType)), defaultType), node.default, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1);
}
if (produceDiagnostics) {
checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0);
@@ -53139,7 +54026,7 @@
checkVariableLikeDeclaration(node);
var func = ts.getContainingFunction(node);
if (ts.hasModifier(node, 92 /* ParameterPropertyModifier */)) {
- if (!(func.kind === 157 /* Constructor */ && ts.nodeIsPresent(func.body))) {
+ if (!(func.kind === 158 /* Constructor */ && ts.nodeIsPresent(func.body))) {
error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation);
}
}
@@ -53150,10 +54037,10 @@
if (func.parameters.indexOf(node) !== 0) {
error(node, ts.Diagnostics.A_0_parameter_must_be_the_first_parameter, node.name.escapedText);
}
- if (func.kind === 157 /* Constructor */ || func.kind === 161 /* ConstructSignature */ || func.kind === 166 /* ConstructorType */) {
+ if (func.kind === 158 /* Constructor */ || func.kind === 162 /* ConstructSignature */ || func.kind === 167 /* ConstructorType */) {
error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter);
}
- if (func.kind === 197 /* ArrowFunction */) {
+ if (func.kind === 198 /* ArrowFunction */) {
error(node, ts.Diagnostics.An_arrow_function_cannot_have_a_this_parameter);
}
}
@@ -53209,13 +54096,13 @@
}
function getTypePredicateParent(node) {
switch (node.parent.kind) {
- case 197 /* ArrowFunction */:
- case 160 /* CallSignature */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 165 /* FunctionType */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 198 /* ArrowFunction */:
+ case 161 /* CallSignature */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 166 /* FunctionType */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
var parent = node.parent;
if (node === parent.type) {
return parent;
@@ -53229,11 +54116,11 @@
continue;
}
var name = element.name;
- if (name.kind === 72 /* Identifier */ && name.escapedText === predicateVariableName) {
+ if (name.kind === 73 /* Identifier */ && name.escapedText === predicateVariableName) {
error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName);
return true;
}
- else if (name.kind === 185 /* ArrayBindingPattern */ || name.kind === 184 /* ObjectBindingPattern */) {
+ else if (name.kind === 186 /* ArrayBindingPattern */ || name.kind === 185 /* ObjectBindingPattern */) {
if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) {
return true;
}
@@ -53242,19 +54129,19 @@
}
function checkSignatureDeclaration(node) {
// Grammar checking
- if (node.kind === 162 /* IndexSignature */) {
+ if (node.kind === 163 /* IndexSignature */) {
checkGrammarIndexSignature(node);
}
// TODO (yuisu): Remove this check in else-if when SyntaxKind.Construct is moved and ambient context is handled
- else if (node.kind === 165 /* FunctionType */ || node.kind === 239 /* FunctionDeclaration */ || node.kind === 166 /* ConstructorType */ ||
- node.kind === 160 /* CallSignature */ || node.kind === 157 /* Constructor */ ||
- node.kind === 161 /* ConstructSignature */) {
+ else if (node.kind === 166 /* FunctionType */ || node.kind === 240 /* FunctionDeclaration */ || node.kind === 167 /* ConstructorType */ ||
+ node.kind === 161 /* CallSignature */ || node.kind === 158 /* Constructor */ ||
+ node.kind === 162 /* ConstructSignature */) {
checkGrammarFunctionLikeDeclaration(node);
}
var functionFlags = ts.getFunctionFlags(node);
if (!(functionFlags & 4 /* Invalid */)) {
// Async generators prior to ESNext require the __await and __asyncGenerator helpers
- if ((functionFlags & 3 /* AsyncGenerator */) === 3 /* AsyncGenerator */ && languageVersion < 7 /* ESNext */) {
+ if ((functionFlags & 3 /* AsyncGenerator */) === 3 /* AsyncGenerator */ && languageVersion < 8 /* ESNext */) {
checkExternalEmitHelpers(node, 6144 /* AsyncGeneratorIncludes */);
}
// Async functions prior to ES2017 require the __awaiter helper
@@ -53278,10 +54165,10 @@
var returnTypeNode = ts.getEffectiveReturnTypeNode(node);
if (noImplicitAny && !returnTypeNode) {
switch (node.kind) {
- case 161 /* ConstructSignature */:
+ case 162 /* ConstructSignature */:
error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);
break;
- case 160 /* CallSignature */:
+ case 161 /* CallSignature */:
error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);
break;
}
@@ -53311,7 +54198,7 @@
checkAsyncFunctionReturnType(node, returnTypeNode);
}
}
- if (node.kind !== 162 /* IndexSignature */ && node.kind !== 294 /* JSDocFunctionType */) {
+ if (node.kind !== 163 /* IndexSignature */ && node.kind !== 295 /* JSDocFunctionType */) {
registerForUnusedIdentifiersCheck(node);
}
}
@@ -53328,7 +54215,7 @@
var staticNames = ts.createUnderscoreEscapedMap();
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
- if (member.kind === 157 /* Constructor */) {
+ if (member.kind === 158 /* Constructor */) {
for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) {
var param = _c[_b];
if (ts.isParameterPropertyDeclaration(param) && !ts.isBindingPattern(param.name)) {
@@ -53343,16 +54230,16 @@
var memberName = name && ts.getPropertyNameForPropertyNameNode(name);
if (name && memberName) {
switch (member.kind) {
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
addName(names, name, memberName, 1 /* Getter */);
break;
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
addName(names, name, memberName, 2 /* Setter */);
break;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
addName(names, name, memberName, 3 /* Property */);
break;
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
addName(names, name, memberName, 4 /* Method */);
break;
}
@@ -53415,7 +54302,7 @@
var names = ts.createMap();
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
- if (member.kind === 153 /* PropertySignature */) {
+ if (member.kind === 154 /* PropertySignature */) {
var memberName = void 0;
var name = member.name;
switch (name.kind) {
@@ -53423,7 +54310,7 @@
case 8 /* NumericLiteral */:
memberName = name.text;
break;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
memberName = ts.idText(name);
break;
default:
@@ -53440,7 +54327,7 @@
}
}
function checkTypeForDuplicateIndexSignatures(node) {
- if (node.kind === 241 /* InterfaceDeclaration */) {
+ if (node.kind === 242 /* InterfaceDeclaration */) {
var nodeSymbol = getSymbolOfNode(node);
// in case of merging interface declaration it is possible that we'll enter this check procedure several times for every declaration
// to prevent this run check only for the first declaration of a given kind
@@ -53460,7 +54347,7 @@
var declaration = decl;
if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
switch (declaration.parameters[0].type.kind) {
- case 138 /* StringKeyword */:
+ case 139 /* StringKeyword */:
if (!seenStringIndexer) {
seenStringIndexer = true;
}
@@ -53468,7 +54355,7 @@
error(declaration, ts.Diagnostics.Duplicate_string_index_signature);
}
break;
- case 135 /* NumberKeyword */:
+ case 136 /* NumberKeyword */:
if (!seenNumericIndexer) {
seenNumericIndexer = true;
}
@@ -53495,7 +54382,7 @@
checkFunctionOrMethodDeclaration(node);
// Abstract methods cannot have an implementation.
// Extra checks are to avoid reporting multiple errors relating to the "abstractness" of the node.
- if (ts.hasModifier(node, 128 /* Abstract */) && node.kind === 156 /* MethodDeclaration */ && node.body) {
+ if (ts.hasModifier(node, 128 /* Abstract */) && node.kind === 157 /* MethodDeclaration */ && node.body) {
error(node, ts.Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, ts.declarationNameToString(node.name));
}
}
@@ -53520,7 +54407,7 @@
return;
}
function isInstancePropertyWithInitializer(n) {
- return n.kind === 154 /* PropertyDeclaration */ &&
+ return n.kind === 155 /* PropertyDeclaration */ &&
!ts.hasModifier(n, 32 /* Static */) &&
!!n.initializer;
}
@@ -53550,7 +54437,7 @@
var superCallStatement = void 0;
for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) {
var statement = statements_2[_i];
- if (statement.kind === 221 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) {
+ if (statement.kind === 222 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) {
superCallStatement = statement;
break;
}
@@ -53575,7 +54462,7 @@
checkGrammarComputedPropertyName(node.name);
checkDecorators(node);
checkSignatureDeclaration(node);
- if (node.kind === 158 /* GetAccessor */) {
+ if (node.kind === 159 /* GetAccessor */) {
if (!(node.flags & 4194304 /* Ambient */) && ts.nodeIsPresent(node.body) && (node.flags & 128 /* HasImplicitReturn */)) {
if (!(node.flags & 256 /* HasExplicitReturn */)) {
error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value);
@@ -53585,13 +54472,13 @@
// Do not use hasDynamicName here, because that returns false for well known symbols.
// We want to perform checkComputedPropertyName for all computed properties, including
// well known symbols.
- if (node.name.kind === 149 /* ComputedPropertyName */) {
+ if (node.name.kind === 150 /* ComputedPropertyName */) {
checkComputedPropertyName(node.name);
}
if (!hasNonBindableDynamicName(node)) {
// TypeScript 1.0 spec (April 2014): 8.4.3
// Accessors for the same member name must specify the same accessibility.
- var otherKind = node.kind === 158 /* GetAccessor */ ? 159 /* SetAccessor */ : 158 /* GetAccessor */;
+ var otherKind = node.kind === 159 /* GetAccessor */ ? 160 /* SetAccessor */ : 159 /* GetAccessor */;
var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(node), otherKind);
if (otherAccessor) {
var nodeFlags = ts.getModifierFlags(node);
@@ -53609,7 +54496,7 @@
}
}
var returnType = getTypeOfAccessors(getSymbolOfNode(node));
- if (node.kind === 158 /* GetAccessor */) {
+ if (node.kind === 159 /* GetAccessor */) {
checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType);
}
}
@@ -53657,7 +54544,7 @@
}
function checkTypeReferenceNode(node) {
checkGrammarTypeArguments(node, node.typeArguments);
- if (node.kind === 164 /* TypeReference */ && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) {
+ if (node.kind === 165 /* TypeReference */ && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) {
grammarErrorAtPos(node, node.typeName.jsdocDotPos, 1, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments);
}
var type = getTypeFromTypeReference(node);
@@ -53705,7 +54592,7 @@
var seenOptionalElement = false;
for (var i = 0; i < elementTypes.length; i++) {
var e = elementTypes[i];
- if (e.kind === 172 /* RestType */) {
+ if (e.kind === 173 /* RestType */) {
if (i !== elementTypes.length - 1) {
grammarErrorOnNode(e, ts.Diagnostics.A_rest_element_must_be_last_in_a_tuple_type);
break;
@@ -53714,7 +54601,7 @@
error(e, ts.Diagnostics.A_rest_element_type_must_be_an_array_type);
}
}
- else if (e.kind === 171 /* OptionalType */) {
+ else if (e.kind === 172 /* OptionalType */) {
seenOptionalElement = true;
}
else if (seenOptionalElement) {
@@ -53735,7 +54622,7 @@
var objectType = type.objectType;
var indexType = type.indexType;
if (isTypeAssignableTo(indexType, getIndexType(objectType, /*stringsOnly*/ false))) {
- if (accessNode.kind === 190 /* ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) &&
+ if (accessNode.kind === 191 /* ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) &&
ts.getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) {
error(accessNode, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
}
@@ -53747,7 +54634,7 @@
return type;
}
error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType));
- return type;
+ return errorType;
}
function checkIndexedAccessType(node) {
checkSourceElement(node.objectType);
@@ -53775,7 +54662,7 @@
ts.forEachChild(node, checkSourceElement);
}
function checkInferType(node) {
- if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 175 /* ConditionalType */ && n.parent.extendsType === n; })) {
+ if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 176 /* ConditionalType */ && n.parent.extendsType === n; })) {
grammarErrorOnNode(node, ts.Diagnostics.infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type);
}
checkSourceElement(node.typeParameter);
@@ -53792,9 +54679,9 @@
var flags = ts.getCombinedModifierFlags(n);
// children of classes (even ambient classes) should not be marked as ambient or export
// because those flags have no useful semantics there.
- if (n.parent.kind !== 241 /* InterfaceDeclaration */ &&
- n.parent.kind !== 240 /* ClassDeclaration */ &&
- n.parent.kind !== 209 /* ClassExpression */ &&
+ if (n.parent.kind !== 242 /* InterfaceDeclaration */ &&
+ n.parent.kind !== 241 /* ClassDeclaration */ &&
+ n.parent.kind !== 210 /* ClassExpression */ &&
n.flags & 4194304 /* Ambient */) {
if (!(flags & 2 /* Ambient */) && !(ts.isModuleBlock(n.parent) && ts.isModuleDeclaration(n.parent.parent) && ts.isGlobalScopeAugmentation(n.parent.parent))) {
// It is nested in an ambient context, which means it is automatically exported
@@ -53885,7 +54772,7 @@
if (node.name && subsequentName &&
(ts.isComputedPropertyName(node.name) && ts.isComputedPropertyName(subsequentName) ||
!ts.isComputedPropertyName(node.name) && !ts.isComputedPropertyName(subsequentName) && ts.getEscapedTextOfIdentifierOrLiteral(node.name) === ts.getEscapedTextOfIdentifierOrLiteral(subsequentName))) {
- var reportError = (node.kind === 156 /* MethodDeclaration */ || node.kind === 155 /* MethodSignature */) &&
+ var reportError = (node.kind === 157 /* MethodDeclaration */ || node.kind === 156 /* MethodSignature */) &&
ts.hasModifier(node, 32 /* Static */) !== ts.hasModifier(subsequentNode, 32 /* Static */);
// we can get here in two cases
// 1. mixed static and instance class members
@@ -53924,7 +54811,7 @@
var current = declarations_4[_i];
var node = current;
var inAmbientContext = node.flags & 4194304 /* Ambient */;
- var inAmbientContextOrInterface = node.parent.kind === 241 /* InterfaceDeclaration */ || node.parent.kind === 168 /* TypeLiteral */ || inAmbientContext;
+ var inAmbientContextOrInterface = node.parent.kind === 242 /* InterfaceDeclaration */ || node.parent.kind === 169 /* TypeLiteral */ || inAmbientContext;
if (inAmbientContextOrInterface) {
// check if declarations are consecutive only if they are non-ambient
// 1. ambient declarations can be interleaved
@@ -53935,7 +54822,7 @@
// 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one
previousDeclaration = undefined;
}
- if (node.kind === 239 /* FunctionDeclaration */ || node.kind === 156 /* MethodDeclaration */ || node.kind === 155 /* MethodSignature */ || node.kind === 157 /* Constructor */) {
+ if (node.kind === 240 /* FunctionDeclaration */ || node.kind === 157 /* MethodDeclaration */ || node.kind === 156 /* MethodSignature */ || node.kind === 158 /* Constructor */) {
var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck);
someNodeFlags |= currentNodeFlags;
allNodeFlags &= currentNodeFlags;
@@ -54064,22 +54951,22 @@
function getDeclarationSpaces(decl) {
var d = decl;
switch (d.kind) {
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
// A jsdoc typedef and callback are, by definition, type aliases
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
return 2 /* ExportType */;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */
? 4 /* ExportNamespace */ | 1 /* ExportValue */
: 4 /* ExportNamespace */;
- case 240 /* ClassDeclaration */:
- case 243 /* EnumDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 244 /* EnumDeclaration */:
return 2 /* ExportType */ | 1 /* ExportValue */;
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return 2 /* ExportType */ | 1 /* ExportValue */ | 4 /* ExportNamespace */;
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
// Export assigned entity name expressions act as aliases and should fall through, otherwise they export values
if (!ts.isEntityNameExpression(d.expression)) {
return 1 /* ExportValue */;
@@ -54087,20 +54974,20 @@
d = d.expression;
/* falls through */
// The below options all declare an Alias, which is allowed to merge with other values within the importing module
- case 248 /* ImportEqualsDeclaration */:
- case 251 /* NamespaceImport */:
- case 250 /* ImportClause */:
- var result_5 = 0 /* None */;
+ case 249 /* ImportEqualsDeclaration */:
+ case 252 /* NamespaceImport */:
+ case 251 /* ImportClause */:
+ var result_7 = 0 /* None */;
var target = resolveAlias(getSymbolOfNode(d));
- ts.forEach(target.declarations, function (d) { result_5 |= getDeclarationSpaces(d); });
- return result_5;
- case 237 /* VariableDeclaration */:
- case 186 /* BindingElement */:
- case 239 /* FunctionDeclaration */:
- case 253 /* ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591
+ ts.forEach(target.declarations, function (d) { result_7 |= getDeclarationSpaces(d); });
+ return result_7;
+ case 238 /* VariableDeclaration */:
+ case 187 /* BindingElement */:
+ case 240 /* FunctionDeclaration */:
+ case 254 /* ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591
return 1 /* ExportValue */;
default:
- return ts.Debug.fail(ts.Debug.showSyntaxKind(d));
+ return ts.Debug.failBadSyntaxKind(d);
}
}
}
@@ -54326,7 +55213,7 @@
var promiseConstructorSymbol = resolveEntityName(promiseConstructorName, 67220415 /* Value */, /*ignoreErrors*/ true);
var promiseConstructorType = promiseConstructorSymbol ? getTypeOfSymbol(promiseConstructorSymbol) : errorType;
if (promiseConstructorType === errorType) {
- if (promiseConstructorName.kind === 72 /* Identifier */ && promiseConstructorName.escapedText === "Promise" && getTargetType(returnType) === getGlobalPromiseType(/*reportErrors*/ false)) {
+ if (promiseConstructorName.kind === 73 /* Identifier */ && promiseConstructorName.escapedText === "Promise" && getTargetType(returnType) === getGlobalPromiseType(/*reportErrors*/ false)) {
error(returnTypeNode, ts.Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option);
}
else {
@@ -54365,24 +55252,24 @@
var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node);
var errorInfo;
switch (node.parent.kind) {
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
var classSymbol = getSymbolOfNode(node.parent);
var classConstructorType = getTypeOfSymbol(classSymbol);
expectedReturnType = getUnionType([classConstructorType, voidType]);
break;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
expectedReturnType = voidType;
errorInfo = ts.chainDiagnosticMessages(
/*details*/ undefined, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any);
break;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
expectedReturnType = voidType;
errorInfo = ts.chainDiagnosticMessages(
/*details*/ undefined, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any);
break;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
var methodType = getTypeOfNode(node.parent);
var descriptorType = createTypedPropertyDescriptorType(methodType);
expectedReturnType = getUnionType([descriptorType, voidType]);
@@ -54403,7 +55290,7 @@
if (!typeName)
return;
var rootName = getFirstIdentifier(typeName);
- var meaning = (typeName.kind === 72 /* Identifier */ ? 67897832 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */;
+ var meaning = (typeName.kind === 73 /* Identifier */ ? 67897832 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */;
var rootSymbol = resolveName(rootName, rootName.escapedText, meaning, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isRefernce*/ true);
if (rootSymbol
&& rootSymbol.flags & 2097152 /* Alias */
@@ -54428,29 +55315,29 @@
function getEntityNameForDecoratorMetadata(node) {
if (node) {
switch (node.kind) {
- case 174 /* IntersectionType */:
- case 173 /* UnionType */:
+ case 175 /* IntersectionType */:
+ case 174 /* UnionType */:
return getEntityNameForDecoratorMetadataFromTypeList(node.types);
- case 175 /* ConditionalType */:
+ case 176 /* ConditionalType */:
return getEntityNameForDecoratorMetadataFromTypeList([node.trueType, node.falseType]);
- case 177 /* ParenthesizedType */:
+ case 178 /* ParenthesizedType */:
return getEntityNameForDecoratorMetadata(node.type);
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return node.typeName;
}
}
}
function getEntityNameForDecoratorMetadataFromTypeList(types) {
var commonEntityName;
- for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
- var typeNode = types_17[_i];
- while (typeNode.kind === 177 /* ParenthesizedType */) {
+ for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
+ var typeNode = types_16[_i];
+ while (typeNode.kind === 178 /* ParenthesizedType */) {
typeNode = typeNode.type; // Skip parens if need be
}
- if (typeNode.kind === 132 /* NeverKeyword */) {
+ if (typeNode.kind === 133 /* NeverKeyword */) {
continue; // Always elide `never` from the union/intersection if possible
}
- if (!strictNullChecks && (typeNode.kind === 96 /* NullKeyword */ || typeNode.kind === 141 /* UndefinedKeyword */)) {
+ if (!strictNullChecks && (typeNode.kind === 97 /* NullKeyword */ || typeNode.kind === 142 /* UndefinedKeyword */)) {
continue; // Elide null and undefined from unions for metadata, just like what we did prior to the implementation of strict null checks
}
var individualEntityName = getEntityNameForDecoratorMetadata(typeNode);
@@ -54492,18 +55379,18 @@
return;
}
if (!compilerOptions.experimentalDecorators) {
- error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning);
+ error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning);
}
var firstDecorator = node.decorators[0];
checkExternalEmitHelpers(firstDecorator, 8 /* Decorate */);
- if (node.kind === 151 /* Parameter */) {
+ if (node.kind === 152 /* Parameter */) {
checkExternalEmitHelpers(firstDecorator, 32 /* Param */);
}
if (compilerOptions.emitDecoratorMetadata) {
checkExternalEmitHelpers(firstDecorator, 16 /* Metadata */);
// we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator.
switch (node.kind) {
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
var constructor = ts.getFirstConstructorWithBody(node);
if (constructor) {
for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) {
@@ -54512,23 +55399,23 @@
}
}
break;
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- var otherKind = node.kind === 158 /* GetAccessor */ ? 159 /* SetAccessor */ : 158 /* GetAccessor */;
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ var otherKind = node.kind === 159 /* GetAccessor */ ? 160 /* SetAccessor */ : 159 /* GetAccessor */;
var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(node), otherKind);
markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor));
break;
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) {
var parameter = _c[_b];
markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
}
markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveReturnTypeNode(node));
break;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveTypeAnnotationNode(node));
break;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node));
var containingSignature = node.parent;
for (var _d = 0, _e = containingSignature.parameters; _d < _e.length; _d++) {
@@ -54591,7 +55478,7 @@
else if (ts.findLast(ts.getJSDocTags(decl), ts.isJSDocParameterTag) === node &&
node.typeExpression && node.typeExpression.type &&
!isArrayType(getTypeFromTypeNode(node.typeExpression.type))) {
- error(node.name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_had_an_array_type, ts.idText(node.name.kind === 148 /* QualifiedName */ ? node.name.right : node.name));
+ error(node.name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_had_an_array_type, ts.idText(node.name.kind === 149 /* QualifiedName */ ? node.name.right : node.name));
}
}
}
@@ -54624,9 +55511,9 @@
}
function getIdentifierFromEntityNameExpression(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return node;
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return node.name;
default:
return undefined;
@@ -54639,7 +55526,7 @@
// Do not use hasDynamicName here, because that returns false for well known symbols.
// We want to perform checkComputedPropertyName for all computed properties, including
// well known symbols.
- if (node.name && node.name.kind === 149 /* ComputedPropertyName */) {
+ if (node.name && node.name.kind === 150 /* ComputedPropertyName */) {
// This check will account for methods in class/interface declarations,
// as well as accessors in classes/object literals
checkComputedPropertyName(node.name);
@@ -54668,7 +55555,7 @@
}
}
}
- var body = node.kind === 155 /* MethodSignature */ ? undefined : node.body;
+ var body = node.kind === 156 /* MethodSignature */ ? undefined : node.body;
checkSourceElement(body);
if ((functionFlags & 1 /* Generator */) === 0) { // Async function or normal function
var returnOrPromisedType = getReturnOrPromisedType(node, functionFlags);
@@ -54713,42 +55600,42 @@
for (var _i = 0, potentiallyUnusedIdentifiers_1 = potentiallyUnusedIdentifiers; _i < potentiallyUnusedIdentifiers_1.length; _i++) {
var node = potentiallyUnusedIdentifiers_1[_i];
switch (node.kind) {
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
checkUnusedClassMembers(node, addDiagnostic);
checkUnusedTypeParameters(node, addDiagnostic);
break;
- case 284 /* SourceFile */:
- case 244 /* ModuleDeclaration */:
- case 218 /* Block */:
- case 246 /* CaseBlock */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 285 /* SourceFile */:
+ case 245 /* ModuleDeclaration */:
+ case 219 /* Block */:
+ case 247 /* CaseBlock */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
checkUnusedLocalsAndParameters(node, addDiagnostic);
break;
- case 157 /* Constructor */:
- case 196 /* FunctionExpression */:
- case 239 /* FunctionDeclaration */:
- case 197 /* ArrowFunction */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 158 /* Constructor */:
+ case 197 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
+ case 198 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
if (node.body) { // Don't report unused parameters in overloads
checkUnusedLocalsAndParameters(node, addDiagnostic);
}
checkUnusedTypeParameters(node, addDiagnostic);
break;
- case 155 /* MethodSignature */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 242 /* TypeAliasDeclaration */:
- case 241 /* InterfaceDeclaration */:
+ case 156 /* MethodSignature */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 243 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
checkUnusedTypeParameters(node, addDiagnostic);
break;
- case 176 /* InferType */:
+ case 177 /* InferType */:
checkUnusedInferTypeParameter(node, addDiagnostic);
break;
default:
@@ -54768,11 +55655,11 @@
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
switch (member.kind) {
- case 156 /* MethodDeclaration */:
- case 154 /* PropertyDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- if (member.kind === 159 /* SetAccessor */ && member.symbol.flags & 32768 /* GetAccessor */) {
+ case 157 /* MethodDeclaration */:
+ case 155 /* PropertyDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ if (member.kind === 160 /* SetAccessor */ && member.symbol.flags & 32768 /* GetAccessor */) {
// Already would have reported an error on the getter.
break;
}
@@ -54781,7 +55668,7 @@
addDiagnostic(member, 0 /* Local */, ts.createDiagnosticForNode(member.name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, symbolToString(symbol)));
}
break;
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) {
var parameter = _c[_b];
if (!parameter.symbol.isReferenced && ts.hasModifier(parameter, 8 /* Private */)) {
@@ -54789,8 +55676,8 @@
}
}
break;
- case 162 /* IndexSignature */:
- case 217 /* SemicolonClassElement */:
+ case 163 /* IndexSignature */:
+ case 218 /* SemicolonClassElement */:
// Can't be private
break;
default:
@@ -54817,7 +55704,7 @@
continue;
var name = ts.idText(typeParameter.name);
var parent = typeParameter.parent;
- if (parent.kind !== 176 /* InferType */ && parent.typeParameters.every(isTypeParameterUnused)) {
+ if (parent.kind !== 177 /* InferType */ && parent.typeParameters.every(isTypeParameterUnused)) {
if (seenParentsWithEveryUnused.tryAdd(parent)) {
var range = ts.isJSDocTemplateTag(parent)
// Whole @template tag
@@ -54902,7 +55789,7 @@
var importDecl = importClause.parent;
var nDeclarations = (importClause.name ? 1 : 0) +
(importClause.namedBindings ?
- (importClause.namedBindings.kind === 251 /* NamespaceImport */ ? 1 : importClause.namedBindings.elements.length)
+ (importClause.namedBindings.kind === 252 /* NamespaceImport */ ? 1 : importClause.namedBindings.elements.length)
: 0);
if (nDeclarations === unuseds.length) {
addDiagnostic(importDecl, 0 /* Local */, unuseds.length === 1
@@ -54920,7 +55807,7 @@
var bindingPattern = _a[0], bindingElements = _a[1];
var kind = tryGetRootParameterDeclaration(bindingPattern.parent) ? 1 /* Parameter */ : 0 /* Local */;
if (bindingPattern.elements.length === bindingElements.length) {
- if (bindingElements.length === 1 && bindingPattern.parent.kind === 237 /* VariableDeclaration */ && bindingPattern.parent.parent.kind === 238 /* VariableDeclarationList */) {
+ if (bindingElements.length === 1 && bindingPattern.parent.kind === 238 /* VariableDeclaration */ && bindingPattern.parent.parent.kind === 239 /* VariableDeclarationList */) {
addToGroup(unusedVariables, bindingPattern.parent.parent, bindingPattern.parent, getNodeId);
}
else {
@@ -54941,7 +55828,7 @@
if (declarationList.declarations.length === declarations.length) {
addDiagnostic(declarationList, 0 /* Local */, declarations.length === 1
? ts.createDiagnosticForNode(ts.first(declarations).name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(ts.first(declarations).name))
- : ts.createDiagnosticForNode(declarationList.parent.kind === 219 /* VariableStatement */ ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused));
+ : ts.createDiagnosticForNode(declarationList.parent.kind === 220 /* VariableStatement */ ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused));
}
else {
for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) {
@@ -54953,24 +55840,24 @@
}
function bindingNameText(name) {
switch (name.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return ts.idText(name);
- case 185 /* ArrayBindingPattern */:
- case 184 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
return bindingNameText(ts.cast(ts.first(name.elements), ts.isBindingElement).name);
default:
return ts.Debug.assertNever(name);
}
}
function isImportedDeclaration(node) {
- return node.kind === 250 /* ImportClause */ || node.kind === 253 /* ImportSpecifier */ || node.kind === 251 /* NamespaceImport */;
+ return node.kind === 251 /* ImportClause */ || node.kind === 254 /* ImportSpecifier */ || node.kind === 252 /* NamespaceImport */;
}
function importClauseFromImported(decl) {
- return decl.kind === 250 /* ImportClause */ ? decl : decl.kind === 251 /* NamespaceImport */ ? decl.parent : decl.parent.parent;
+ return decl.kind === 251 /* ImportClause */ ? decl : decl.kind === 252 /* NamespaceImport */ ? decl.parent : decl.parent.parent;
}
function checkBlock(node) {
// Grammar checking for SyntaxKind.Block
- if (node.kind === 218 /* Block */) {
+ if (node.kind === 219 /* Block */) {
checkGrammarStatementInAmbientContext(node);
}
if (ts.isFunctionOrModuleBlock(node)) {
@@ -55000,12 +55887,12 @@
if (!(identifier && identifier.escapedText === name)) {
return false;
}
- if (node.kind === 154 /* PropertyDeclaration */ ||
- node.kind === 153 /* PropertySignature */ ||
- node.kind === 156 /* MethodDeclaration */ ||
- node.kind === 155 /* MethodSignature */ ||
- node.kind === 158 /* GetAccessor */ ||
- node.kind === 159 /* SetAccessor */) {
+ if (node.kind === 155 /* PropertyDeclaration */ ||
+ node.kind === 154 /* PropertySignature */ ||
+ node.kind === 157 /* MethodDeclaration */ ||
+ node.kind === 156 /* MethodSignature */ ||
+ node.kind === 159 /* GetAccessor */ ||
+ node.kind === 160 /* SetAccessor */) {
// it is ok to have member named '_super' or '_this' - member access is always qualified
return false;
}
@@ -55014,7 +55901,7 @@
return false;
}
var root = ts.getRootDeclaration(node);
- if (root.kind === 151 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) {
+ if (root.kind === 152 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) {
// just an overload - no codegen impact
return false;
}
@@ -55024,7 +55911,7 @@
function checkIfThisIsCapturedInEnclosingScope(node) {
ts.findAncestor(node, function (current) {
if (getNodeCheckFlags(current) & 4 /* CaptureThis */) {
- var isDeclaration_1 = node.kind !== 72 /* Identifier */;
+ var isDeclaration_1 = node.kind !== 73 /* Identifier */;
if (isDeclaration_1) {
error(ts.getNameOfDeclaration(node), ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference);
}
@@ -55039,7 +55926,7 @@
function checkIfNewTargetIsCapturedInEnclosingScope(node) {
ts.findAncestor(node, function (current) {
if (getNodeCheckFlags(current) & 8 /* CaptureNewTarget */) {
- var isDeclaration_2 = node.kind !== 72 /* Identifier */;
+ var isDeclaration_2 = node.kind !== 73 /* Identifier */;
if (isDeclaration_2) {
error(ts.getNameOfDeclaration(node), ts.Diagnostics.Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference);
}
@@ -55065,7 +55952,7 @@
}
// In case of variable declaration, node.parent is variable statement so look at the variable statement's parent
var parent = getDeclarationContainer(node);
- if (parent.kind === 284 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) {
+ if (parent.kind === 285 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) {
// If the declaration happens to be in external module, report error that require and exports are reserved keywords
error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name));
}
@@ -55080,7 +55967,7 @@
}
// In case of variable declaration, node.parent is variable statement so look at the variable statement's parent
var parent = getDeclarationContainer(node);
- if (parent.kind === 284 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024 /* HasAsyncFunctions */) {
+ if (parent.kind === 285 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024 /* HasAsyncFunctions */) {
// If the declaration happens to be in external module, report error that Promise is a reserved identifier.
error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name));
}
@@ -55115,7 +56002,7 @@
// skip variable declarations that don't have initializers
// NOTE: in ES6 spec initializer is required in variable declarations where name is binding pattern
// so we'll always treat binding elements as initialized
- if (node.kind === 237 /* VariableDeclaration */ && !node.initializer) {
+ if (node.kind === 238 /* VariableDeclaration */ && !node.initializer) {
return;
}
var symbol = getSymbolOfNode(node);
@@ -55127,17 +56014,17 @@
localDeclarationSymbol !== symbol &&
localDeclarationSymbol.flags & 2 /* BlockScopedVariable */) {
if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3 /* BlockScoped */) {
- var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 238 /* VariableDeclarationList */);
- var container = varDeclList.parent.kind === 219 /* VariableStatement */ && varDeclList.parent.parent
+ var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 239 /* VariableDeclarationList */);
+ var container = varDeclList.parent.kind === 220 /* VariableStatement */ && varDeclList.parent.parent
? varDeclList.parent.parent
: undefined;
// names of block-scoped and function scoped variables can collide only
// if block scoped variable is defined in the function\module\source file scope (because of variable hoisting)
var namesShareScope = container &&
- (container.kind === 218 /* Block */ && ts.isFunctionLike(container.parent) ||
- container.kind === 245 /* ModuleBlock */ ||
- container.kind === 244 /* ModuleDeclaration */ ||
- container.kind === 284 /* SourceFile */);
+ (container.kind === 219 /* Block */ && ts.isFunctionLike(container.parent) ||
+ container.kind === 246 /* ModuleBlock */ ||
+ container.kind === 245 /* ModuleDeclaration */ ||
+ container.kind === 285 /* SourceFile */);
// here we know that function scoped variable is shadowed by block scoped one
// if they are defined in the same scope - binder has already reported redeclaration error
// otherwise if variable has an initializer - show error that initialization will fail
@@ -55150,69 +56037,6 @@
}
}
}
- // Check that a parameter initializer contains no references to parameters declared to the right of itself
- function checkParameterInitializer(node) {
- if (ts.getRootDeclaration(node).kind !== 151 /* Parameter */) {
- return;
- }
- var func = ts.getContainingFunction(node);
- visit(node.initializer);
- function visit(n) {
- if (ts.isTypeNode(n) || ts.isDeclarationName(n)) {
- // do not dive in types
- // skip declaration names (i.e. in object literal expressions)
- return;
- }
- if (n.kind === 189 /* PropertyAccessExpression */) {
- // skip property names in property access expression
- return visit(n.expression);
- }
- else if (n.kind === 72 /* Identifier */) {
- // check FunctionLikeDeclaration.locals (stores parameters\function local variable)
- // if it contains entry with a specified name
- var symbol = resolveName(n, n.escapedText, 67220415 /* Value */ | 2097152 /* Alias */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false);
- if (!symbol || symbol === unknownSymbol || !symbol.valueDeclaration) {
- return;
- }
- if (symbol.valueDeclaration === node) {
- error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name));
- return;
- }
- // locals map for function contain both parameters and function locals
- // so we need to do a bit of extra work to check if reference is legal
- var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration);
- if (enclosingContainer === func) {
- if (symbol.valueDeclaration.kind === 151 /* Parameter */ ||
- symbol.valueDeclaration.kind === 186 /* BindingElement */) {
- // it is ok to reference parameter in initializer if either
- // - parameter is located strictly on the left of current parameter declaration
- if (symbol.valueDeclaration.pos < node.pos) {
- return;
- }
- // - parameter is wrapped in function-like entity
- if (ts.findAncestor(n, function (current) {
- if (current === node.initializer) {
- return "quit";
- }
- return ts.isFunctionLike(current.parent) ||
- // computed property names/initializers in instance property declaration of class like entities
- // are executed in constructor and thus deferred
- (current.parent.kind === 154 /* PropertyDeclaration */ &&
- !(ts.hasModifier(current.parent, 32 /* Static */)) &&
- ts.isClassLike(current.parent.parent));
- })) {
- return;
- }
- // fall through to report error
- }
- error(n, ts.Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(node.name), ts.declarationNameToString(n));
- }
- }
- else {
- return ts.forEachChild(n, visit);
- }
- }
- }
function convertAutoToAny(type) {
return type === autoType ? anyType : type === autoArrayType ? anyArrayType : type;
}
@@ -55230,18 +56054,18 @@
// Do not use hasDynamicName here, because that returns false for well known symbols.
// We want to perform checkComputedPropertyName for all computed properties, including
// well known symbols.
- if (node.name.kind === 149 /* ComputedPropertyName */) {
+ if (node.name.kind === 150 /* ComputedPropertyName */) {
checkComputedPropertyName(node.name);
if (node.initializer) {
checkExpressionCached(node.initializer);
}
}
- if (node.kind === 186 /* BindingElement */) {
- if (node.parent.kind === 184 /* ObjectBindingPattern */ && languageVersion < 7 /* ESNext */) {
+ if (node.kind === 187 /* BindingElement */) {
+ if (node.parent.kind === 185 /* ObjectBindingPattern */ && languageVersion < 8 /* ESNext */) {
checkExternalEmitHelpers(node, 4 /* Rest */);
}
// check computed properties inside property names of binding elements
- if (node.propertyName && node.propertyName.kind === 149 /* ComputedPropertyName */) {
+ if (node.propertyName && node.propertyName.kind === 150 /* ComputedPropertyName */) {
checkComputedPropertyName(node.propertyName);
}
// check private/protected variable access
@@ -55255,35 +56079,48 @@
var property = getPropertyOfType(parentType, nameText);
if (property) {
markPropertyAsReferenced(property, /*nodeForCheckWriteOnly*/ undefined, /*isThisAccess*/ false); // A destructuring is never a write-only reference.
- checkPropertyAccessibility(parent, !!parent.initializer && parent.initializer.kind === 98 /* SuperKeyword */, parentType, property);
+ checkPropertyAccessibility(parent, !!parent.initializer && parent.initializer.kind === 99 /* SuperKeyword */, parentType, property);
}
}
}
}
// For a binding pattern, check contained binding elements
if (ts.isBindingPattern(node.name)) {
- if (node.name.kind === 185 /* ArrayBindingPattern */ && languageVersion < 2 /* ES2015 */ && compilerOptions.downlevelIteration) {
+ if (node.name.kind === 186 /* ArrayBindingPattern */ && languageVersion < 2 /* ES2015 */ && compilerOptions.downlevelIteration) {
checkExternalEmitHelpers(node, 512 /* Read */);
}
ts.forEach(node.name.elements, checkSourceElement);
}
// For a parameter declaration with an initializer, error and exit if the containing function doesn't have a body
- if (node.initializer && ts.getRootDeclaration(node).kind === 151 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) {
+ if (node.initializer && ts.getRootDeclaration(node).kind === 152 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) {
error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation);
return;
}
// For a binding pattern, validate the initializer and exit
if (ts.isBindingPattern(node.name)) {
+ var needCheckInitializer = node.initializer && node.parent.parent.kind !== 227 /* ForInStatement */;
+ var needCheckWidenedType = node.name.elements.length === 0;
+ if (needCheckInitializer || needCheckWidenedType) {
// Don't validate for-in initializer as it is already an error
- if (node.initializer && node.parent.parent.kind !== 226 /* ForInStatement */) {
+ var widenedType = getWidenedTypeForVariableLikeDeclaration(node);
+ if (needCheckInitializer) {
var initializerType = checkExpressionCached(node.initializer);
- if (strictNullChecks && node.name.elements.length === 0) {
- checkNonNullType(initializerType, node);
+ if (strictNullChecks && needCheckWidenedType) {
+ checkNonNullNonVoidType(initializerType, node);
}
else {
checkTypeAssignableToAndOptionallyElaborate(initializerType, getWidenedTypeForVariableLikeDeclaration(node), node, node.initializer);
}
- checkParameterInitializer(node);
+ }
+ // check the binding pattern with empty elements
+ if (needCheckWidenedType) {
+ if (ts.isArrayBindingPattern(node.name)) {
+ checkIteratedTypeOrElementType(widenedType, node, /* allowStringInput */ false, /* allowAsyncIterables */ false);
+ }
+ else if (strictNullChecks) {
+ checkNonNullNonVoidType(widenedType, node);
+ }
+ }
}
return;
}
@@ -55298,9 +56135,8 @@
ts.isObjectLiteralExpression(initializer) &&
(initializer.properties.length === 0 || ts.isPrototypeAccess(node.name)) &&
ts.hasEntries(symbol.exports);
- if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 226 /* ForInStatement */) {
+ if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 227 /* ForInStatement */) {
checkTypeAssignableToAndOptionallyElaborate(checkExpressionCached(initializer), type, node, initializer, /*headMessage*/ undefined);
- checkParameterInitializer(node);
}
}
if (symbol.declarations.length > 1) {
@@ -55316,7 +56152,7 @@
if (type !== errorType && declarationType !== errorType &&
!isTypeIdenticalTo(type, declarationType) &&
!(symbol.flags & 67108864 /* Assignment */)) {
- errorNextVariableOrPropertyDeclarationMustHaveSameType(type, node, declarationType);
+ errorNextVariableOrPropertyDeclarationMustHaveSameType(symbol.valueDeclaration, type, node, declarationType);
}
if (node.initializer) {
checkTypeAssignableToAndOptionallyElaborate(checkExpressionCached(node.initializer), declarationType, node, node.initializer, /*headMessage*/ undefined);
@@ -55325,26 +56161,30 @@
error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name));
}
}
- if (node.kind !== 154 /* PropertyDeclaration */ && node.kind !== 153 /* PropertySignature */) {
+ if (node.kind !== 155 /* PropertyDeclaration */ && node.kind !== 154 /* PropertySignature */) {
// We know we don't have a binding pattern or computed name here
checkExportsOnMergedDeclarations(node);
- if (node.kind === 237 /* VariableDeclaration */ || node.kind === 186 /* BindingElement */) {
+ if (node.kind === 238 /* VariableDeclaration */ || node.kind === 187 /* BindingElement */) {
checkVarDeclaredNamesNotShadowed(node);
}
checkCollisionWithRequireExportsInGeneratedCode(node, node.name);
checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name);
}
}
- function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstType, nextDeclaration, nextType) {
+ function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstDeclaration, firstType, nextDeclaration, nextType) {
var nextDeclarationName = ts.getNameOfDeclaration(nextDeclaration);
- var message = nextDeclaration.kind === 154 /* PropertyDeclaration */ || nextDeclaration.kind === 153 /* PropertySignature */
+ var message = nextDeclaration.kind === 155 /* PropertyDeclaration */ || nextDeclaration.kind === 154 /* PropertySignature */
? ts.Diagnostics.Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2
: ts.Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2;
- error(nextDeclarationName, message, ts.declarationNameToString(nextDeclarationName), typeToString(firstType), typeToString(nextType));
+ var declName = ts.declarationNameToString(nextDeclarationName);
+ var err = error(nextDeclarationName, message, declName, typeToString(firstType), typeToString(nextType));
+ if (firstDeclaration) {
+ ts.addRelatedInfo(err, ts.createDiagnosticForNode(firstDeclaration, ts.Diagnostics._0_was_also_declared_here, declName));
+ }
}
function areDeclarationFlagsIdentical(left, right) {
- if ((left.kind === 151 /* Parameter */ && right.kind === 237 /* VariableDeclaration */) ||
- (left.kind === 237 /* VariableDeclaration */ && right.kind === 151 /* Parameter */)) {
+ if ((left.kind === 152 /* Parameter */ && right.kind === 238 /* VariableDeclaration */) ||
+ (left.kind === 238 /* VariableDeclaration */ && right.kind === 152 /* Parameter */)) {
// Differences in optionality between parameters and variables are allowed.
return true;
}
@@ -55383,7 +56223,7 @@
checkGrammarStatementInAmbientContext(node);
checkTruthinessExpression(node.expression);
checkSourceElement(node.thenStatement);
- if (node.thenStatement.kind === 220 /* EmptyStatement */) {
+ if (node.thenStatement.kind === 221 /* EmptyStatement */) {
error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement);
}
checkSourceElement(node.elseStatement);
@@ -55410,12 +56250,12 @@
function checkForStatement(node) {
// Grammar checking
if (!checkGrammarStatementInAmbientContext(node)) {
- if (node.initializer && node.initializer.kind === 238 /* VariableDeclarationList */) {
+ if (node.initializer && node.initializer.kind === 239 /* VariableDeclarationList */) {
checkGrammarVariableDeclarationList(node.initializer);
}
}
if (node.initializer) {
- if (node.initializer.kind === 238 /* VariableDeclarationList */) {
+ if (node.initializer.kind === 239 /* VariableDeclarationList */) {
ts.forEach(node.initializer.declarations, checkVariableDeclaration);
}
else {
@@ -55435,7 +56275,7 @@
checkGrammarForInOrForOfStatement(node);
if (node.awaitModifier) {
var functionFlags = ts.getFunctionFlags(ts.getContainingFunction(node));
- if ((functionFlags & (4 /* Invalid */ | 2 /* Async */)) === 2 /* Async */ && languageVersion < 7 /* ESNext */) {
+ if ((functionFlags & (4 /* Invalid */ | 2 /* Async */)) === 2 /* Async */ && languageVersion < 8 /* ESNext */) {
// for..await..of in an async function or async generator function prior to ESNext requires the __asyncValues helper
checkExternalEmitHelpers(node, 16384 /* ForAwaitOfIncludes */);
}
@@ -55449,14 +56289,14 @@
// via checkRightHandSideOfForOf.
// If the LHS is an expression, check the LHS, as a destructuring assignment or as a reference.
// Then check that the RHS is assignable to it.
- if (node.initializer.kind === 238 /* VariableDeclarationList */) {
+ if (node.initializer.kind === 239 /* VariableDeclarationList */) {
checkForInOrForOfVariableDeclaration(node);
}
else {
var varExpr = node.initializer;
var iteratedType = checkRightHandSideOfForOf(node.expression, node.awaitModifier);
// There may be a destructuring assignment on the left side
- if (varExpr.kind === 187 /* ArrayLiteralExpression */ || varExpr.kind === 188 /* ObjectLiteralExpression */) {
+ if (varExpr.kind === 188 /* ArrayLiteralExpression */ || varExpr.kind === 189 /* ObjectLiteralExpression */) {
// iteratedType may be undefined. In this case, we still want to check the structure of
// varExpr, in particular making sure it's a valid LeftHandSideExpression. But we'd like
// to short circuit the type relation checking as much as possible, so we pass the unknownType.
@@ -55488,7 +56328,7 @@
// for (let VarDecl in Expr) Statement
// VarDecl must be a variable declaration without a type annotation that declares a variable of type Any,
// and Expr must be an expression of type Any, an object type, or a type parameter type.
- if (node.initializer.kind === 238 /* VariableDeclarationList */) {
+ if (node.initializer.kind === 239 /* VariableDeclarationList */) {
var variable = node.initializer.declarations[0];
if (variable && ts.isBindingPattern(variable.name)) {
error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);
@@ -55502,7 +56342,7 @@
// and Expr must be an expression of type Any, an object type, or a type parameter type.
var varExpr = node.initializer;
var leftType = checkExpression(varExpr);
- if (varExpr.kind === 187 /* ArrayLiteralExpression */ || varExpr.kind === 188 /* ObjectLiteralExpression */) {
+ if (varExpr.kind === 188 /* ArrayLiteralExpression */ || varExpr.kind === 189 /* ObjectLiteralExpression */) {
error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);
}
else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) {
@@ -55862,12 +56702,12 @@
// for generators.
return;
}
- else if (func.kind === 159 /* SetAccessor */) {
+ else if (func.kind === 160 /* SetAccessor */) {
if (node.expression) {
error(node, ts.Diagnostics.Setters_cannot_return_a_value);
}
}
- else if (func.kind === 157 /* Constructor */) {
+ else if (func.kind === 158 /* Constructor */) {
if (node.expression && !checkTypeAssignableToAndOptionallyElaborate(exprType, returnType, node, node.expression)) {
error(node, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class);
}
@@ -55888,7 +56728,7 @@
}
}
}
- else if (func.kind !== 157 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType) && !isGenerator) {
+ else if (func.kind !== 158 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType) && !isGenerator) {
// The function has a return type, but the return statement doesn't have an expression.
error(node, ts.Diagnostics.Not_all_code_paths_return_a_value);
}
@@ -55917,7 +56757,7 @@
var expressionIsLiteral = isLiteralType(expressionType);
ts.forEach(node.caseBlock.clauses, function (clause) {
// Grammar check for duplicate default clauses, skip if we already report duplicate default clause
- if (clause.kind === 272 /* DefaultClause */ && !hasDuplicateDefaultClause) {
+ if (clause.kind === 273 /* DefaultClause */ && !hasDuplicateDefaultClause) {
if (firstDefaultClause === undefined) {
firstDefaultClause = clause;
}
@@ -55929,7 +56769,7 @@
hasDuplicateDefaultClause = true;
}
}
- if (produceDiagnostics && clause.kind === 271 /* CaseClause */) {
+ if (produceDiagnostics && clause.kind === 272 /* CaseClause */) {
// TypeScript 1.0 spec (April 2014): 5.9
// In a 'switch' statement, each 'case' expression must be of a type that is comparable
// to or from the type of the 'switch' expression.
@@ -55958,7 +56798,7 @@
if (ts.isFunctionLike(current)) {
return "quit";
}
- if (current.kind === 233 /* LabeledStatement */ && current.label.escapedText === node.label.escapedText) {
+ if (current.kind === 234 /* LabeledStatement */ && current.label.escapedText === node.label.escapedText) {
grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNode(node.label));
return true;
}
@@ -56065,8 +56905,8 @@
// this allows us to rule out cases when both property and indexer are inherited from the base class
var errorNode;
if (propDeclaration && name &&
- (propDeclaration.kind === 204 /* BinaryExpression */ ||
- name.kind === 149 /* ComputedPropertyName */ ||
+ (propDeclaration.kind === 205 /* BinaryExpression */ ||
+ name.kind === 150 /* ComputedPropertyName */ ||
prop.parent === containingType.symbol)) {
errorNode = propDeclaration;
}
@@ -56143,7 +56983,7 @@
function checkTypeParametersNotReferenced(root, typeParameters, index) {
visit(root);
function visit(node) {
- if (node.kind === 164 /* TypeReference */) {
+ if (node.kind === 165 /* TypeReference */) {
var type = getTypeFromTypeReference(node);
if (type.flags & 262144 /* TypeParameter */) {
for (var i = index; i < typeParameters.length; i++) {
@@ -56265,6 +57105,11 @@
if (languageVersion < 2 /* ES2015 */) {
checkExternalEmitHelpers(baseTypeNode.parent, 1 /* Extends */);
}
+ // check both @extends and extends if both are specified.
+ var extendsNode = ts.getClassExtendsHeritageElement(node);
+ if (extendsNode && extendsNode !== baseTypeNode) {
+ checkExpression(extendsNode.expression);
+ }
var baseTypes = getBaseTypes(type);
if (baseTypes.length && produceDiagnostics) {
var baseType_1 = baseTypes[0];
@@ -56272,10 +57117,6 @@
var staticBaseType = getApparentType(baseConstructorType);
checkBaseTypeAccessibility(staticBaseType, baseTypeNode);
checkSourceElement(baseTypeNode.expression);
- var extendsNode = ts.getClassExtendsHeritageElement(node);
- if (extendsNode && extendsNode !== baseTypeNode) {
- checkExpression(extendsNode.expression);
- }
if (ts.some(baseTypeNode.typeArguments)) {
ts.forEach(baseTypeNode.typeArguments, checkSourceElement);
for (var _i = 0, _a = getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode); _i < _a.length; _i++) {
@@ -56346,7 +57187,7 @@
function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
// iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
var issuedMemberError = false;
- var _loop_9 = function (member) {
+ var _loop_12 = function (member) {
if (ts.hasStaticModifier(member)) {
return "continue";
}
@@ -56365,7 +57206,7 @@
};
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
- _loop_9(member);
+ _loop_12(member);
}
if (!issuedMemberError) {
// check again with diagnostics to generate a less-specific error
@@ -56391,7 +57232,7 @@
}
function getClassOrInterfaceDeclarationsOfSymbol(symbol) {
return ts.filter(symbol.declarations, function (d) {
- return d.kind === 240 /* ClassDeclaration */ || d.kind === 241 /* InterfaceDeclaration */;
+ return d.kind === 241 /* ClassDeclaration */ || d.kind === 242 /* InterfaceDeclaration */;
});
}
function checkKindsOfPropertyMemberOverrides(type, baseType) {
@@ -56430,7 +57271,7 @@
// If there is no declaration for the derived class (as in the case of class expressions),
// then the class cannot be declared abstract.
if (baseDeclarationFlags & 128 /* Abstract */ && (!derivedClassDecl || !ts.hasModifier(derivedClassDecl, 128 /* Abstract */))) {
- if (derivedClassDecl.kind === 209 /* ClassExpression */) {
+ if (derivedClassDecl.kind === 210 /* ClassExpression */) {
error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType));
}
else {
@@ -56480,8 +57321,8 @@
for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) {
var base = baseTypes_2[_i];
var properties = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType));
- for (var _a = 0, properties_6 = properties; _a < properties_6.length; _a++) {
- var prop = properties_6[_a];
+ for (var _a = 0, properties_4 = properties; _a < properties_4.length; _a++) {
+ var prop = properties_4[_a];
var existing = seen.get(prop.escapedName);
if (!existing) {
seen.set(prop.escapedName, { prop: prop, containingType: base });
@@ -56522,7 +57363,7 @@
}
}
function isInstancePropertyWithoutInitializer(node) {
- return node.kind === 154 /* PropertyDeclaration */ &&
+ return node.kind === 155 /* PropertyDeclaration */ &&
!ts.hasModifier(node, 32 /* Static */ | 128 /* Abstract */) &&
!node.exclamationToken &&
!node.initializer;
@@ -56546,7 +57387,7 @@
var symbol = getSymbolOfNode(node);
checkTypeParameterListsIdentical(symbol);
// Only check this symbol once
- var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 241 /* InterfaceDeclaration */);
+ var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 242 /* InterfaceDeclaration */);
if (node === firstInterfaceDecl) {
var type = getDeclaredTypeOfSymbol(symbol);
var typeWithThis = getTypeWithThisArgument(type);
@@ -56651,7 +57492,7 @@
return value;
function evaluate(expr) {
switch (expr.kind) {
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
var value_2 = evaluate(expr.operand);
if (typeof value_2 === "number") {
switch (expr.operator) {
@@ -56661,7 +57502,7 @@
}
}
break;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
var left = evaluate(expr.left);
var right = evaluate(expr.right);
if (typeof left === "number" && typeof right === "number") {
@@ -56689,22 +57530,22 @@
case 8 /* NumericLiteral */:
checkGrammarNumericLiteral(expr);
return +expr.text;
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return evaluate(expr.expression);
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
var identifier = expr;
if (isInfinityOrNaNString(identifier.escapedText)) {
return +(identifier.escapedText);
}
return ts.nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), identifier.escapedText);
- case 190 /* ElementAccessExpression */:
- case 189 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
var ex = expr;
if (isConstantMemberAccess(ex)) {
var type = getTypeOfExpression(ex.expression);
if (type.symbol && type.symbol.flags & 384 /* Enum */) {
var name = void 0;
- if (ex.kind === 189 /* PropertyAccessExpression */) {
+ if (ex.kind === 190 /* PropertyAccessExpression */) {
name = ex.name.escapedText;
}
else {
@@ -56735,9 +57576,9 @@
}
}
function isConstantMemberAccess(node) {
- return node.kind === 72 /* Identifier */ ||
- node.kind === 189 /* PropertyAccessExpression */ && isConstantMemberAccess(node.expression) ||
- node.kind === 190 /* ElementAccessExpression */ && isConstantMemberAccess(node.expression) &&
+ return node.kind === 73 /* Identifier */ ||
+ node.kind === 190 /* PropertyAccessExpression */ && isConstantMemberAccess(node.expression) ||
+ node.kind === 191 /* ElementAccessExpression */ && isConstantMemberAccess(node.expression) &&
node.argumentExpression.kind === 10 /* StringLiteral */;
}
function checkEnumDeclaration(node) {
@@ -56772,7 +57613,7 @@
var seenEnumMissingInitialInitializer_1 = false;
ts.forEach(enumSymbol.declarations, function (declaration) {
// return true if we hit a violation of the rule, false otherwise
- if (declaration.kind !== 243 /* EnumDeclaration */) {
+ if (declaration.kind !== 244 /* EnumDeclaration */) {
return false;
}
var enumDeclaration = declaration;
@@ -56795,8 +57636,8 @@
var declarations = symbol.declarations;
for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) {
var declaration = declarations_8[_i];
- if ((declaration.kind === 240 /* ClassDeclaration */ ||
- (declaration.kind === 239 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) &&
+ if ((declaration.kind === 241 /* ClassDeclaration */ ||
+ (declaration.kind === 240 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) &&
!(declaration.flags & 4194304 /* Ambient */)) {
return declaration;
}
@@ -56859,7 +57700,7 @@
}
// if the module merges with a class declaration in the same lexical scope,
// we need to track this to ensure the correct emit.
- var mergedClass = ts.getDeclarationOfKind(symbol, 240 /* ClassDeclaration */);
+ var mergedClass = ts.getDeclarationOfKind(symbol, 241 /* ClassDeclaration */);
if (mergedClass &&
inSameLexicalScope(node, mergedClass)) {
getNodeLinks(node).flags |= 32768 /* LexicalModuleMergesWithClass */;
@@ -56909,23 +57750,23 @@
}
function checkModuleAugmentationElement(node, isGlobalAugmentation) {
switch (node.kind) {
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
// error each individual name in variable statement instead of marking the entire variable statement
for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {
var decl = _a[_i];
checkModuleAugmentationElement(decl, isGlobalAugmentation);
}
break;
- case 254 /* ExportAssignment */:
- case 255 /* ExportDeclaration */:
+ case 255 /* ExportAssignment */:
+ case 256 /* ExportDeclaration */:
grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations);
break;
- case 248 /* ImportEqualsDeclaration */:
- case 249 /* ImportDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 250 /* ImportDeclaration */:
grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module);
break;
- case 186 /* BindingElement */:
- case 237 /* VariableDeclaration */:
+ case 187 /* BindingElement */:
+ case 238 /* VariableDeclaration */:
var name = node.name;
if (ts.isBindingPattern(name)) {
for (var _b = 0, _c = name.elements; _b < _c.length; _b++) {
@@ -56936,12 +57777,12 @@
break;
}
// falls through
- case 240 /* ClassDeclaration */:
- case 243 /* EnumDeclaration */:
- case 239 /* FunctionDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 242 /* TypeAliasDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
if (isGlobalAugmentation) {
return;
}
@@ -56962,17 +57803,17 @@
}
function getFirstIdentifier(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return node;
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
do {
node = node.left;
- } while (node.kind !== 72 /* Identifier */);
+ } while (node.kind !== 73 /* Identifier */);
return node;
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
do {
node = node.expression;
- } while (node.kind !== 72 /* Identifier */);
+ } while (node.kind !== 73 /* Identifier */);
return node;
}
}
@@ -56986,9 +57827,9 @@
error(moduleName, ts.Diagnostics.String_literal_expected);
return false;
}
- var inAmbientExternalModule = node.parent.kind === 245 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent);
- if (node.parent.kind !== 284 /* SourceFile */ && !inAmbientExternalModule) {
- error(moduleName, node.kind === 255 /* ExportDeclaration */ ?
+ var inAmbientExternalModule = node.parent.kind === 246 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent);
+ if (node.parent.kind !== 285 /* SourceFile */ && !inAmbientExternalModule) {
+ error(moduleName, node.kind === 256 /* ExportDeclaration */ ?
ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace :
ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module);
return false;
@@ -57021,14 +57862,14 @@
(symbol.flags & 67897832 /* Type */ ? 67897832 /* Type */ : 0) |
(symbol.flags & 1920 /* Namespace */ ? 1920 /* Namespace */ : 0);
if (target.flags & excludedMeanings) {
- var message = node.kind === 257 /* ExportSpecifier */ ?
+ var message = node.kind === 258 /* ExportSpecifier */ ?
ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 :
ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0;
error(node, message, symbolToString(symbol));
}
// Don't allow to re-export something with no value side when `--isolatedModules` is set.
if (compilerOptions.isolatedModules
- && node.kind === 257 /* ExportSpecifier */
+ && node.kind === 258 /* ExportSpecifier */
&& !(target.flags & 67220415 /* Value */)
&& !(node.flags & 4194304 /* Ambient */)) {
error(node, ts.Diagnostics.Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided);
@@ -57055,7 +57896,7 @@
checkImportBinding(importClause);
}
if (importClause.namedBindings) {
- if (importClause.namedBindings.kind === 251 /* NamespaceImport */) {
+ if (importClause.namedBindings.kind === 252 /* NamespaceImport */) {
checkImportBinding(importClause.namedBindings);
}
else {
@@ -57079,7 +57920,7 @@
if (ts.hasModifier(node, 1 /* Export */)) {
markExportAsReferenced(node);
}
- if (node.moduleReference.kind !== 259 /* ExternalModuleReference */) {
+ if (node.moduleReference.kind !== 260 /* ExternalModuleReference */) {
var target = resolveAlias(getSymbolOfNode(node));
if (target !== unknownSymbol) {
if (target.flags & 67220415 /* Value */) {
@@ -57115,10 +57956,10 @@
// export { x, y }
// export { x, y } from "foo"
ts.forEach(node.exportClause.elements, checkExportSpecifier);
- var inAmbientExternalModule = node.parent.kind === 245 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent);
- var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 245 /* ModuleBlock */ &&
+ var inAmbientExternalModule = node.parent.kind === 246 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent);
+ var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 246 /* ModuleBlock */ &&
!node.moduleSpecifier && node.flags & 4194304 /* Ambient */;
- if (node.parent.kind !== 284 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) {
+ if (node.parent.kind !== 285 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) {
error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace);
}
}
@@ -57135,7 +57976,7 @@
}
}
function checkGrammarModuleElementContext(node, errorMessage) {
- var isInAppropriateContext = node.parent.kind === 284 /* SourceFile */ || node.parent.kind === 245 /* ModuleBlock */ || node.parent.kind === 244 /* ModuleDeclaration */;
+ var isInAppropriateContext = node.parent.kind === 285 /* SourceFile */ || node.parent.kind === 246 /* ModuleBlock */ || node.parent.kind === 245 /* ModuleDeclaration */;
if (!isInAppropriateContext) {
grammarErrorOnFirstToken(node, errorMessage);
}
@@ -57164,8 +58005,8 @@
// If we hit an export assignment in an illegal context, just bail out to avoid cascading errors.
return;
}
- var container = node.parent.kind === 284 /* SourceFile */ ? node.parent : node.parent.parent;
- if (container.kind === 244 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) {
+ var container = node.parent.kind === 285 /* SourceFile */ ? node.parent : node.parent.parent;
+ if (container.kind === 245 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) {
if (node.isExportEquals) {
error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace);
}
@@ -57178,7 +58019,7 @@
if (!checkGrammarDecoratorsAndModifiers(node) && ts.hasModifiers(node)) {
grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers);
}
- if (node.expression.kind === 72 /* Identifier */) {
+ if (node.expression.kind === 73 /* Identifier */) {
markExportAsReferenced(node);
if (ts.getEmitDeclarations(compilerOptions)) {
collectLinkedAliases(node.expression, /*setVisibility*/ true);
@@ -57253,7 +58094,7 @@
return !ts.isAccessor(declaration);
}
function isNotOverload(declaration) {
- return (declaration.kind !== 239 /* FunctionDeclaration */ && declaration.kind !== 156 /* MethodDeclaration */) ||
+ return (declaration.kind !== 240 /* FunctionDeclaration */ && declaration.kind !== 157 /* MethodDeclaration */) ||
!!declaration.body;
}
function checkSourceElement(node) {
@@ -57276,158 +58117,158 @@
// Only bother checking on a few construct kinds. We don't want to be excessively
// hitting the cancellation token on every node we check.
switch (kind) {
- case 244 /* ModuleDeclaration */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 239 /* FunctionDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 240 /* FunctionDeclaration */:
cancellationToken.throwIfCancellationRequested();
}
}
switch (kind) {
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
return checkTypeParameter(node);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return checkParameter(node);
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
return checkPropertyDeclaration(node);
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
return checkSignatureDeclaration(node);
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
return checkMethodDeclaration(node);
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return checkConstructorDeclaration(node);
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return checkAccessorDeclaration(node);
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return checkTypeReferenceNode(node);
- case 163 /* TypePredicate */:
+ case 164 /* TypePredicate */:
return checkTypePredicate(node);
- case 167 /* TypeQuery */:
+ case 168 /* TypeQuery */:
return checkTypeQuery(node);
- case 168 /* TypeLiteral */:
+ case 169 /* TypeLiteral */:
return checkTypeLiteral(node);
- case 169 /* ArrayType */:
+ case 170 /* ArrayType */:
return checkArrayType(node);
- case 170 /* TupleType */:
+ case 171 /* TupleType */:
return checkTupleType(node);
- case 173 /* UnionType */:
- case 174 /* IntersectionType */:
+ case 174 /* UnionType */:
+ case 175 /* IntersectionType */:
return checkUnionOrIntersectionType(node);
- case 177 /* ParenthesizedType */:
- case 171 /* OptionalType */:
- case 172 /* RestType */:
+ case 178 /* ParenthesizedType */:
+ case 172 /* OptionalType */:
+ case 173 /* RestType */:
return checkSourceElement(node.type);
- case 178 /* ThisType */:
+ case 179 /* ThisType */:
return checkThisType(node);
- case 179 /* TypeOperator */:
+ case 180 /* TypeOperator */:
return checkTypeOperator(node);
- case 175 /* ConditionalType */:
+ case 176 /* ConditionalType */:
return checkConditionalType(node);
- case 176 /* InferType */:
+ case 177 /* InferType */:
return checkInferType(node);
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return checkImportType(node);
- case 300 /* JSDocAugmentsTag */:
+ case 301 /* JSDocAugmentsTag */:
return checkJSDocAugmentsTag(node);
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
return checkJSDocTypeAliasTag(node);
- case 308 /* JSDocTemplateTag */:
+ case 309 /* JSDocTemplateTag */:
return checkJSDocTemplateTag(node);
- case 307 /* JSDocTypeTag */:
+ case 308 /* JSDocTypeTag */:
return checkJSDocTypeTag(node);
- case 304 /* JSDocParameterTag */:
+ case 305 /* JSDocParameterTag */:
return checkJSDocParameterTag(node);
- case 294 /* JSDocFunctionType */:
+ case 295 /* JSDocFunctionType */:
checkJSDocFunctionType(node);
// falls through
- case 292 /* JSDocNonNullableType */:
- case 291 /* JSDocNullableType */:
- case 289 /* JSDocAllType */:
- case 290 /* JSDocUnknownType */:
- case 297 /* JSDocTypeLiteral */:
+ case 293 /* JSDocNonNullableType */:
+ case 292 /* JSDocNullableType */:
+ case 290 /* JSDocAllType */:
+ case 291 /* JSDocUnknownType */:
+ case 298 /* JSDocTypeLiteral */:
checkJSDocTypeIsInJsFile(node);
ts.forEachChild(node, checkSourceElement);
return;
- case 295 /* JSDocVariadicType */:
+ case 296 /* JSDocVariadicType */:
checkJSDocVariadicType(node);
return;
- case 288 /* JSDocTypeExpression */:
+ case 289 /* JSDocTypeExpression */:
return checkSourceElement(node.type);
- case 180 /* IndexedAccessType */:
+ case 181 /* IndexedAccessType */:
return checkIndexedAccessType(node);
- case 181 /* MappedType */:
+ case 182 /* MappedType */:
return checkMappedType(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return checkFunctionDeclaration(node);
- case 218 /* Block */:
- case 245 /* ModuleBlock */:
+ case 219 /* Block */:
+ case 246 /* ModuleBlock */:
return checkBlock(node);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return checkVariableStatement(node);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return checkExpressionStatement(node);
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
return checkIfStatement(node);
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
return checkDoStatement(node);
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
return checkWhileStatement(node);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return checkForStatement(node);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return checkForInStatement(node);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return checkForOfStatement(node);
- case 228 /* ContinueStatement */:
- case 229 /* BreakStatement */:
+ case 229 /* ContinueStatement */:
+ case 230 /* BreakStatement */:
return checkBreakOrContinueStatement(node);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return checkReturnStatement(node);
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
return checkWithStatement(node);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return checkSwitchStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return checkLabeledStatement(node);
- case 234 /* ThrowStatement */:
+ case 235 /* ThrowStatement */:
return checkThrowStatement(node);
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
return checkTryStatement(node);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return checkVariableDeclaration(node);
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return checkBindingElement(node);
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return checkClassDeclaration(node);
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
return checkInterfaceDeclaration(node);
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return checkTypeAliasDeclaration(node);
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return checkEnumDeclaration(node);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return checkModuleDeclaration(node);
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return checkImportDeclaration(node);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return checkImportEqualsDeclaration(node);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return checkExportDeclaration(node);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return checkExportAssignment(node);
- case 220 /* EmptyStatement */:
- case 236 /* DebuggerStatement */:
+ case 221 /* EmptyStatement */:
+ case 237 /* DebuggerStatement */:
checkGrammarStatementInAmbientContext(node);
return;
- case 258 /* MissingDeclaration */:
+ case 259 /* MissingDeclaration */:
return checkMissingDeclaration(node);
}
}
@@ -57521,23 +58362,23 @@
var saveCurrentNode = currentNode;
currentNode = node;
switch (node.kind) {
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
checkFunctionExpressionOrObjectLiteralMethodDeferred(node);
break;
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
checkAccessorDeclaration(node);
break;
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
checkClassExpressionDeferred(node);
break;
- case 261 /* JsxSelfClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
checkJsxSelfClosingElementDeferred(node);
break;
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
checkJsxElementDeferred(node);
break;
}
@@ -57667,17 +58508,17 @@
copySymbols(location.locals, meaning);
}
switch (location.kind) {
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
if (!ts.isExternalOrCommonJsModule(location))
break;
// falls through
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
copySymbols(getSymbolOfNode(location).exports, meaning & 2623475 /* ModuleMember */);
break;
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* EnumMember */);
break;
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
var className = location.name;
if (className) {
copySymbol(location.symbol, meaning);
@@ -57685,8 +58526,8 @@
// falls through
// this fall-through is necessary because we would like to handle
// type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
// If we didn't come from static member of class or interface,
// add the type parameters into the symbol table
// (type parameters of classDeclaration/classExpression and interface are in member property of the symbol.
@@ -57695,7 +58536,7 @@
copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & 67897832 /* Type */);
}
break;
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
var funcName = location.name;
if (funcName) {
copySymbol(location.symbol, meaning);
@@ -57737,17 +58578,17 @@
}
}
function isTypeDeclarationName(name) {
- return name.kind === 72 /* Identifier */ &&
+ return name.kind === 73 /* Identifier */ &&
isTypeDeclaration(name.parent) &&
name.parent.name === name;
}
function isTypeDeclaration(node) {
switch (node.kind) {
- case 150 /* TypeParameter */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 243 /* EnumDeclaration */:
+ case 151 /* TypeParameter */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 244 /* EnumDeclaration */:
return true;
default:
return false;
@@ -57755,16 +58596,16 @@
}
// True if the given identifier is part of a type reference
function isTypeReferenceIdentifier(node) {
- while (node.parent.kind === 148 /* QualifiedName */) {
+ while (node.parent.kind === 149 /* QualifiedName */) {
node = node.parent;
}
- return node.parent.kind === 164 /* TypeReference */;
+ return node.parent.kind === 165 /* TypeReference */;
}
function isHeritageClauseElementIdentifier(node) {
- while (node.parent.kind === 189 /* PropertyAccessExpression */) {
+ while (node.parent.kind === 190 /* PropertyAccessExpression */) {
node = node.parent;
}
- return node.parent.kind === 211 /* ExpressionWithTypeArguments */;
+ return node.parent.kind === 212 /* ExpressionWithTypeArguments */;
}
function forEachEnclosingClass(node, callback) {
var result;
@@ -57792,13 +58633,13 @@
return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; });
}
function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) {
- while (nodeOnRightSide.parent.kind === 148 /* QualifiedName */) {
+ while (nodeOnRightSide.parent.kind === 149 /* QualifiedName */) {
nodeOnRightSide = nodeOnRightSide.parent;
}
- if (nodeOnRightSide.parent.kind === 248 /* ImportEqualsDeclaration */) {
+ if (nodeOnRightSide.parent.kind === 249 /* ImportEqualsDeclaration */) {
return nodeOnRightSide.parent.moduleReference === nodeOnRightSide ? nodeOnRightSide.parent : undefined;
}
- if (nodeOnRightSide.parent.kind === 254 /* ExportAssignment */) {
+ if (nodeOnRightSide.parent.kind === 255 /* ExportAssignment */) {
return nodeOnRightSide.parent.expression === nodeOnRightSide ? nodeOnRightSide.parent : undefined;
}
return undefined;
@@ -57824,7 +58665,7 @@
node = parent;
parent = parent.parent;
}
- if (parent && parent.kind === 183 /* ImportType */ && parent.qualifier === node) {
+ if (parent && parent.kind === 184 /* ImportType */ && parent.qualifier === node) {
return parent;
}
return undefined;
@@ -57834,7 +58675,7 @@
return getSymbolOfNode(entityName.parent);
}
if (ts.isInJSFile(entityName) &&
- entityName.parent.kind === 189 /* PropertyAccessExpression */ &&
+ entityName.parent.kind === 190 /* PropertyAccessExpression */ &&
entityName.parent === entityName.parent.parent.left) {
// Check if this is a special property assignment
var specialPropertyAssignmentSymbol = getSpecialPropertyAssignmentSymbolFromEntityName(entityName);
@@ -57842,7 +58683,7 @@
return specialPropertyAssignmentSymbol;
}
}
- if (entityName.parent.kind === 254 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) {
+ if (entityName.parent.kind === 255 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) {
// Even an entity name expression that doesn't resolve as an entityname may still typecheck as a property access expression
var success = resolveEntityName(entityName,
/*all meanings*/ 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */, /*ignoreErrors*/ true);
@@ -57852,7 +58693,7 @@
}
else if (!ts.isPropertyAccessExpression(entityName) && isInRightSideOfImportOrExportAssignment(entityName)) {
// Since we already checked for ExportAssignment, this really could only be an Import
- var importEqualsDeclaration = ts.getAncestor(entityName, 248 /* ImportEqualsDeclaration */);
+ var importEqualsDeclaration = ts.getAncestor(entityName, 249 /* ImportEqualsDeclaration */);
ts.Debug.assert(importEqualsDeclaration !== undefined);
return getSymbolOfPartOfRightHandSideOfImportEquals(entityName, /*dontResolveAlias*/ true);
}
@@ -57870,7 +58711,7 @@
if (isHeritageClauseElementIdentifier(entityName)) {
var meaning = 0 /* None */;
// In an interface or class, we're definitely interested in a type.
- if (entityName.parent.kind === 211 /* ExpressionWithTypeArguments */) {
+ if (entityName.parent.kind === 212 /* ExpressionWithTypeArguments */) {
meaning = 67897832 /* Type */;
// In a class 'extends' clause we are also looking for a value.
if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) {
@@ -57886,10 +58727,10 @@
return entityNameSymbol;
}
}
- if (entityName.parent.kind === 304 /* JSDocParameterTag */) {
+ if (entityName.parent.kind === 305 /* JSDocParameterTag */) {
return ts.getParameterSymbolFromJSDoc(entityName.parent);
}
- if (entityName.parent.kind === 150 /* TypeParameter */ && entityName.parent.parent.kind === 308 /* JSDocTemplateTag */) {
+ if (entityName.parent.kind === 151 /* TypeParameter */ && entityName.parent.parent.kind === 309 /* JSDocTemplateTag */) {
ts.Debug.assert(!ts.isInJSFile(entityName)); // Otherwise `isDeclarationName` would have been true.
var typeParameter = ts.getTypeParameterFromJsDoc(entityName.parent);
return typeParameter && typeParameter.symbol;
@@ -57899,19 +58740,19 @@
// Missing entity name.
return undefined;
}
- if (entityName.kind === 72 /* Identifier */) {
+ if (entityName.kind === 73 /* Identifier */) {
if (ts.isJSXTagName(entityName) && isJsxIntrinsicIdentifier(entityName)) {
var symbol = getIntrinsicTagSymbol(entityName.parent);
return symbol === unknownSymbol ? undefined : symbol;
}
return resolveEntityName(entityName, 67220415 /* Value */, /*ignoreErrors*/ false, /*dontResolveAlias*/ true);
}
- else if (entityName.kind === 189 /* PropertyAccessExpression */ || entityName.kind === 148 /* QualifiedName */) {
+ else if (entityName.kind === 190 /* PropertyAccessExpression */ || entityName.kind === 149 /* QualifiedName */) {
var links = getNodeLinks(entityName);
if (links.resolvedSymbol) {
return links.resolvedSymbol;
}
- if (entityName.kind === 189 /* PropertyAccessExpression */) {
+ if (entityName.kind === 190 /* PropertyAccessExpression */) {
checkPropertyAccessExpression(entityName);
}
else {
@@ -57921,17 +58762,17 @@
}
}
else if (isTypeReferenceIdentifier(entityName)) {
- var meaning = entityName.parent.kind === 164 /* TypeReference */ ? 67897832 /* Type */ : 1920 /* Namespace */;
+ var meaning = entityName.parent.kind === 165 /* TypeReference */ ? 67897832 /* Type */ : 1920 /* Namespace */;
return resolveEntityName(entityName, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true);
}
- if (entityName.parent.kind === 163 /* TypePredicate */) {
+ if (entityName.parent.kind === 164 /* TypePredicate */) {
return resolveEntityName(entityName, /*meaning*/ 1 /* FunctionScopedVariable */);
}
// Do we want to return undefined here?
return undefined;
}
function getSymbolAtLocation(node) {
- if (node.kind === 284 /* SourceFile */) {
+ if (node.kind === 285 /* SourceFile */) {
return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined;
}
var parent = node.parent;
@@ -57950,12 +58791,12 @@
else if (ts.isLiteralComputedPropertyDeclarationName(node)) {
return getSymbolOfNode(parent.parent);
}
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
if (isInRightSideOfImportOrExportAssignment(node)) {
return getSymbolOfEntityNameOrPropertyAccessExpression(node);
}
- else if (parent.kind === 186 /* BindingElement */ &&
- grandParent.kind === 184 /* ObjectBindingPattern */ &&
+ else if (parent.kind === 187 /* BindingElement */ &&
+ grandParent.kind === 185 /* ObjectBindingPattern */ &&
node === parent.propertyName) {
var typeOfPattern = getTypeOfNode(grandParent);
var propertyDeclaration = getPropertyOfType(typeOfPattern, node.escapedText);
@@ -57965,11 +58806,11 @@
}
}
switch (node.kind) {
- case 72 /* Identifier */:
- case 189 /* PropertyAccessExpression */:
- case 148 /* QualifiedName */:
+ case 73 /* Identifier */:
+ case 190 /* PropertyAccessExpression */:
+ case 149 /* QualifiedName */:
return getSymbolOfEntityNameOrPropertyAccessExpression(node);
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false);
if (ts.isFunctionLike(container)) {
var sig = getSignatureFromDeclaration(container);
@@ -57981,14 +58822,14 @@
return checkExpression(node).symbol;
}
// falls through
- case 178 /* ThisType */:
+ case 179 /* ThisType */:
return getTypeFromThisTypeNode(node).symbol;
- case 98 /* SuperKeyword */:
+ case 99 /* SuperKeyword */:
return checkExpression(node).symbol;
- case 124 /* ConstructorKeyword */:
+ case 125 /* ConstructorKeyword */:
// constructor keyword for an overload, should take us to the definition if it exist
var constructorDeclaration = node.parent;
- if (constructorDeclaration && constructorDeclaration.kind === 157 /* Constructor */) {
+ if (constructorDeclaration && constructorDeclaration.kind === 158 /* Constructor */) {
return constructorDeclaration.parent.symbol;
}
return undefined;
@@ -57999,7 +58840,7 @@
// 3). Dynamic import call or require in javascript
// 4). type A = import("./f/*gotToDefinitionHere*/oo")
if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) ||
- ((node.parent.kind === 249 /* ImportDeclaration */ || node.parent.kind === 255 /* ExportDeclaration */) && node.parent.moduleSpecifier === node) ||
+ ((node.parent.kind === 250 /* ImportDeclaration */ || node.parent.kind === 256 /* ExportDeclaration */) && node.parent.moduleSpecifier === node) ||
((ts.isInJSFile(node) && ts.isRequireCall(node.parent, /*checkArgumentIsStringLiteralLike*/ false)) || ts.isImportCall(node.parent)) ||
(ts.isLiteralTypeNode(node.parent) && ts.isLiteralImportTypeNode(node.parent.parent) && node.parent.parent.argument === node.parent)) {
return resolveExternalModuleName(node, node);
@@ -58016,21 +58857,21 @@
? getTypeFromTypeNode(grandParent.objectType)
: undefined;
return objectType && getPropertyOfType(objectType, ts.escapeLeadingUnderscores(node.text));
- case 80 /* DefaultKeyword */:
- case 90 /* FunctionKeyword */:
+ case 81 /* DefaultKeyword */:
+ case 91 /* FunctionKeyword */:
case 37 /* EqualsGreaterThanToken */:
- case 76 /* ClassKeyword */:
+ case 77 /* ClassKeyword */:
return getSymbolOfNode(node.parent);
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return ts.isLiteralImportTypeNode(node) ? getSymbolAtLocation(node.argument.literal) : undefined;
- case 85 /* ExportKeyword */:
+ case 86 /* ExportKeyword */:
return ts.isExportAssignment(node.parent) ? ts.Debug.assertDefined(node.parent.symbol) : undefined;
default:
return undefined;
}
}
function getShorthandAssignmentValueSymbol(location) {
- if (location && location.kind === 276 /* ShorthandPropertyAssignment */) {
+ if (location && location.kind === 277 /* ShorthandPropertyAssignment */) {
return resolveEntityName(location.name, 67220415 /* Value */ | 2097152 /* Alias */);
}
return undefined;
@@ -58097,33 +58938,35 @@
// }
// [ a ] from
// [a] = [ some array ...]
- function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr) {
- ts.Debug.assert(expr.kind === 188 /* ObjectLiteralExpression */ || expr.kind === 187 /* ArrayLiteralExpression */);
+ function getTypeOfAssignmentPattern(expr) {
+ ts.Debug.assert(expr.kind === 189 /* ObjectLiteralExpression */ || expr.kind === 188 /* ArrayLiteralExpression */);
// If this is from "for of"
// for ( { a } of elems) {
// }
- if (expr.parent.kind === 227 /* ForOfStatement */) {
+ if (expr.parent.kind === 228 /* ForOfStatement */) {
var iteratedType = checkRightHandSideOfForOf(expr.parent.expression, expr.parent.awaitModifier);
return checkDestructuringAssignment(expr, iteratedType || errorType);
}
// If this is from "for" initializer
// for ({a } = elems[0];.....) { }
- if (expr.parent.kind === 204 /* BinaryExpression */) {
+ if (expr.parent.kind === 205 /* BinaryExpression */) {
var iteratedType = getTypeOfExpression(expr.parent.right);
return checkDestructuringAssignment(expr, iteratedType || errorType);
}
// If this is from nested object binding pattern
// for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) {
- if (expr.parent.kind === 275 /* PropertyAssignment */) {
- var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent);
- return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || errorType, expr.parent); // TODO: GH#18217
+ if (expr.parent.kind === 276 /* PropertyAssignment */) {
+ var node_3 = ts.cast(expr.parent.parent, ts.isObjectLiteralExpression);
+ var typeOfParentObjectLiteral = getTypeOfAssignmentPattern(node_3) || errorType;
+ var propertyIndex = ts.indexOfNode(node_3.properties, expr.parent);
+ return checkObjectLiteralDestructuringPropertyAssignment(node_3, typeOfParentObjectLiteral, propertyIndex);
}
// Array literal assignment - array destructuring pattern
- ts.Debug.assert(expr.parent.kind === 187 /* ArrayLiteralExpression */);
+ var node = ts.cast(expr.parent, ts.isArrayLiteralExpression);
// [{ property1: p1, property2 }] = elems;
- var typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent);
- var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || errorType, expr.parent, /*allowStringInput*/ false, /*allowAsyncIterables*/ false) || errorType;
- return checkArrayLiteralDestructuringElementAssignment(expr.parent, typeOfArrayLiteral, expr.parent.elements.indexOf(expr), elementType || errorType); // TODO: GH#18217
+ var typeOfArrayLiteral = getTypeOfAssignmentPattern(node) || errorType;
+ var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral, expr.parent, /*allowStringInput*/ false, /*allowAsyncIterables*/ false) || errorType;
+ return checkArrayLiteralDestructuringElementAssignment(node, typeOfArrayLiteral, node.elements.indexOf(expr), elementType);
}
// Gets the property symbol corresponding to the property in destructuring assignment
// 'property1' from
@@ -58133,7 +58976,7 @@
// [a] = [ property1, property2 ]
function getPropertySymbolOfDestructuringAssignment(location) {
// Get the type of the object or array literal and then look for property of given name in the type
- var typeOfObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(location.parent.parent);
+ var typeOfObjectLiteral = getTypeOfAssignmentPattern(ts.cast(location.parent.parent, ts.isAssignmentPattern));
return typeOfObjectLiteral && getPropertyOfType(typeOfObjectLiteral, location.escapedText);
}
function getRegularTypeOfExpression(expr) {
@@ -58155,12 +58998,12 @@
function getClassElementPropertyKeyType(element) {
var name = element.name;
switch (name.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return getLiteralType(ts.idText(name));
case 8 /* NumericLiteral */:
case 10 /* StringLiteral */:
return getLiteralType(name.text);
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
var nameType = checkComputedPropertyName(name);
return isTypeAssignableToKind(nameType, 12288 /* ESSymbolLike */) ? nameType : stringType;
default:
@@ -58217,7 +59060,7 @@
if (!ts.isGeneratedIdentifier(nodeIn)) {
var node = ts.getParseTreeNode(nodeIn, ts.isIdentifier);
if (node) {
- var isPropertyName_1 = node.parent.kind === 189 /* PropertyAccessExpression */ && node.parent.name === node;
+ var isPropertyName_1 = node.parent.kind === 190 /* PropertyAccessExpression */ && node.parent.name === node;
return !isPropertyName_1 && getReferencedValueSymbol(node) === argumentsSymbol;
}
}
@@ -58273,7 +59116,7 @@
}
var parentSymbol_1 = getParentOfSymbol(symbol);
if (parentSymbol_1) {
- if (parentSymbol_1.flags & 512 /* ValueModule */ && parentSymbol_1.valueDeclaration.kind === 284 /* SourceFile */) {
+ if (parentSymbol_1.flags & 512 /* ValueModule */ && parentSymbol_1.valueDeclaration.kind === 285 /* SourceFile */) {
var symbolFile = parentSymbol_1.valueDeclaration;
var referenceFile = ts.getSourceFileOfNode(node);
// If `node` accesses an export and that export isn't in the same file, then symbol is a namespace export, so return undefined.
@@ -58299,12 +59142,16 @@
}
return undefined;
}
+ function isSymbolOfDestructuredElementOfCatchBinding(symbol) {
+ return ts.isBindingElement(symbol.valueDeclaration)
+ && ts.walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 275 /* CatchClause */;
+ }
function isSymbolOfDeclarationWithCollidingName(symbol) {
if (symbol.flags & 418 /* BlockScoped */ && !ts.isSourceFile(symbol.valueDeclaration)) {
var links = getSymbolLinks(symbol);
if (links.isDeclarationWithCollidingName === undefined) {
var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration);
- if (ts.isStatementWithLocals(container)) {
+ if (ts.isStatementWithLocals(container) || isSymbolOfDestructuredElementOfCatchBinding(symbol)) {
var nodeLinks_1 = getNodeLinks(symbol.valueDeclaration);
if (resolveName(container.parent, symbol.escapedName, 67220415 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)) {
// redeclaration - always should be renamed
@@ -58328,7 +59175,7 @@
// they will not collide with anything
var isDeclaredInLoop = nodeLinks_1.flags & 524288 /* BlockScopedBindingInLoop */;
var inLoopInitializer = ts.isIterationStatement(container, /*lookInLabeledStatements*/ false);
- var inLoopBodyBlock = container.kind === 218 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false);
+ var inLoopBodyBlock = container.kind === 219 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false);
links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock));
}
else {
@@ -58369,18 +59216,18 @@
}
function isValueAliasDeclaration(node) {
switch (node.kind) {
- case 248 /* ImportEqualsDeclaration */:
- case 250 /* ImportClause */:
- case 251 /* NamespaceImport */:
- case 253 /* ImportSpecifier */:
- case 257 /* ExportSpecifier */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 251 /* ImportClause */:
+ case 252 /* NamespaceImport */:
+ case 254 /* ImportSpecifier */:
+ case 258 /* ExportSpecifier */:
return isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
var exportClause = node.exportClause;
return !!exportClause && ts.some(exportClause.elements, isValueAliasDeclaration);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return node.expression
- && node.expression.kind === 72 /* Identifier */
+ && node.expression.kind === 73 /* Identifier */
? isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol)
: true;
}
@@ -58388,7 +59235,7 @@
}
function isTopLevelValueImportEqualsWithEntityName(nodeIn) {
var node = ts.getParseTreeNode(nodeIn, ts.isImportEqualsDeclaration);
- if (node === undefined || node.parent.kind !== 284 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) {
+ if (node === undefined || node.parent.kind !== 285 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) {
// parent is not source file or it is not reference to internal module
return false;
}
@@ -58489,15 +59336,15 @@
}
function canHaveConstantValue(node) {
switch (node.kind) {
- case 278 /* EnumMember */:
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 279 /* EnumMember */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return true;
}
return false;
}
function getConstantValue(node) {
- if (node.kind === 278 /* EnumMember */) {
+ if (node.kind === 279 /* EnumMember */) {
return getEnumMemberValue(node);
}
var symbol = getNodeLinks(node).resolvedSymbol;
@@ -58582,7 +59429,7 @@
function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, tracker, addUndefined) {
var declaration = ts.getParseTreeNode(declarationIn, ts.isVariableLikeOrAccessor);
if (!declaration) {
- return ts.createToken(120 /* AnyKeyword */);
+ return ts.createToken(121 /* AnyKeyword */);
}
// Get type of the symbol if this is the valid symbol otherwise get type at location
var symbol = getSymbolOfNode(declaration);
@@ -58601,7 +59448,7 @@
function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, tracker) {
var signatureDeclaration = ts.getParseTreeNode(signatureDeclarationIn, ts.isFunctionLike);
if (!signatureDeclaration) {
- return ts.createToken(120 /* AnyKeyword */);
+ return ts.createToken(121 /* AnyKeyword */);
}
var signature = getSignatureFromDeclaration(signatureDeclaration);
return nodeBuilder.typeToTypeNode(getReturnTypeOfSignature(signature), enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
@@ -58609,7 +59456,7 @@
function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) {
var expr = ts.getParseTreeNode(exprIn, ts.isExpression);
if (!expr) {
- return ts.createToken(120 /* AnyKeyword */);
+ return ts.createToken(121 /* AnyKeyword */);
}
var type = getWidenedType(getRegularTypeOfExpression(expr));
return nodeBuilder.typeToTypeNode(type, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
@@ -58728,17 +59575,17 @@
isLateBound: function (nodeIn) {
var node = ts.getParseTreeNode(nodeIn, ts.isDeclaration);
var symbol = node && getSymbolOfNode(node);
- return !!(symbol && ts.getCheckFlags(symbol) & 2048 /* Late */);
+ return !!(symbol && ts.getCheckFlags(symbol) & 4096 /* Late */);
},
getJsxFactoryEntity: function (location) { return location ? (getJsxNamespace(location), (ts.getSourceFileOfNode(location).localJsxFactory || _jsxFactoryEntity)) : _jsxFactoryEntity; },
getAllAccessorDeclarations: function (accessor) {
accessor = ts.getParseTreeNode(accessor, ts.isGetOrSetAccessorDeclaration); // TODO: GH#18217
- var otherKind = accessor.kind === 159 /* SetAccessor */ ? 158 /* GetAccessor */ : 159 /* SetAccessor */;
+ var otherKind = accessor.kind === 160 /* SetAccessor */ ? 159 /* GetAccessor */ : 160 /* SetAccessor */;
var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(accessor), otherKind);
var firstAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? otherAccessor : accessor;
var secondAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? accessor : otherAccessor;
- var setAccessor = accessor.kind === 159 /* SetAccessor */ ? accessor : otherAccessor;
- var getAccessor = accessor.kind === 158 /* GetAccessor */ ? accessor : otherAccessor;
+ var setAccessor = accessor.kind === 160 /* SetAccessor */ ? accessor : otherAccessor;
+ var getAccessor = accessor.kind === 159 /* GetAccessor */ ? accessor : otherAccessor;
return {
firstAccessor: firstAccessor,
secondAccessor: secondAccessor,
@@ -58754,7 +59601,7 @@
}
};
function isInHeritageClause(node) {
- return node.parent && node.parent.kind === 211 /* ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 273 /* HeritageClause */;
+ return node.parent && node.parent.kind === 212 /* ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 274 /* HeritageClause */;
}
// defined here to avoid outer scope pollution
function getTypeReferenceDirectivesForEntityName(node) {
@@ -58766,7 +59613,7 @@
// qualified names can only be used as types\namespaces
// identifiers are treated as values only if they appear in type queries
var meaning = 67897832 /* Type */ | 1920 /* Namespace */;
- if ((node.kind === 72 /* Identifier */ && isInTypeQuery(node)) || (node.kind === 189 /* PropertyAccessExpression */ && !isInHeritageClause(node))) {
+ if ((node.kind === 73 /* Identifier */ && isInTypeQuery(node)) || (node.kind === 190 /* PropertyAccessExpression */ && !isInHeritageClause(node))) {
meaning = 67220415 /* Value */ | 1048576 /* ExportValue */;
}
var symbol = resolveEntityName(node, meaning, /*ignoreErrors*/ true);
@@ -58817,7 +59664,7 @@
break;
}
}
- if (current.valueDeclaration && current.valueDeclaration.kind === 284 /* SourceFile */ && current.flags & 512 /* ValueModule */) {
+ if (current.valueDeclaration && current.valueDeclaration.kind === 285 /* SourceFile */ && current.flags & 512 /* ValueModule */) {
return false;
}
// check that at least one declaration of top level symbol originates from type declaration file
@@ -58845,12 +59692,12 @@
}
}
function getExternalModuleFileFromDeclaration(declaration) {
- var specifier = declaration.kind === 244 /* ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration);
+ var specifier = declaration.kind === 245 /* ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration);
var moduleSymbol = resolveExternalModuleNameWorker(specifier, specifier, /*moduleNotFoundError*/ undefined); // TODO: GH#18217
if (!moduleSymbol) {
return undefined;
}
- return ts.getDeclarationOfKind(moduleSymbol, 284 /* SourceFile */);
+ return ts.getDeclarationOfKind(moduleSymbol, 285 /* SourceFile */);
}
function initializeTypeChecker() {
// Bind all source files and propagate errors
@@ -58867,6 +59714,15 @@
continue;
}
if (!ts.isExternalOrCommonJsModule(file)) {
+ // It is an error for a non-external-module (i.e. script) to declare its own `globalThis`.
+ // We can't use `builtinGlobals` for this due to synthetic expando-namespace generation in JS files.
+ var fileGlobalThisSymbol = file.locals.get("globalThis");
+ if (fileGlobalThisSymbol) {
+ for (var _d = 0, _e = fileGlobalThisSymbol.declarations; _d < _e.length; _d++) {
+ var declaration = _e[_d];
+ diagnostics.add(ts.createDiagnosticForNode(declaration, ts.Diagnostics.Declaration_name_conflicts_with_built_in_global_identifier_0, "globalThis"));
+ }
+ }
mergeSymbolTable(globals, file.locals);
}
if (file.jsGlobalAugmentations) {
@@ -58897,10 +59753,10 @@
if (augmentations) {
// merge _global_ module augmentations.
// this needs to be done after global symbol table is initialized to make sure that all ambient modules are indexed
- for (var _d = 0, augmentations_1 = augmentations; _d < augmentations_1.length; _d++) {
- var list = augmentations_1[_d];
- for (var _e = 0, list_1 = list; _e < list_1.length; _e++) {
- var augmentation = list_1[_e];
+ for (var _f = 0, augmentations_1 = augmentations; _f < augmentations_1.length; _f++) {
+ var list = augmentations_1[_f];
+ for (var _g = 0, list_1 = list; _g < list_1.length; _g++) {
+ var augmentation = list_1[_g];
if (!ts.isGlobalScopeAugmentation(augmentation.parent))
continue;
mergeModuleAugmentation(augmentation);
@@ -58912,6 +59768,7 @@
getSymbolLinks(undefinedSymbol).type = undefinedWideningType;
getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments", /*arity*/ 0, /*reportErrors*/ true);
getSymbolLinks(unknownSymbol).type = errorType;
+ getSymbolLinks(globalThisSymbol).type = createObjectType(16 /* Anonymous */, globalThisSymbol);
// Initialize special types
globalArrayType = getGlobalType("Array", /*arity*/ 1, /*reportErrors*/ true);
globalObjectType = getGlobalType("Object", /*arity*/ 0, /*reportErrors*/ true);
@@ -58934,10 +59791,10 @@
if (augmentations) {
// merge _nonglobal_ module augmentations.
// this needs to be done after global symbol table is initialized to make sure that all ambient modules are indexed
- for (var _f = 0, augmentations_2 = augmentations; _f < augmentations_2.length; _f++) {
- var list = augmentations_2[_f];
- for (var _g = 0, list_2 = list; _g < list_2.length; _g++) {
- var augmentation = list_2[_g];
+ for (var _h = 0, augmentations_2 = augmentations; _h < augmentations_2.length; _h++) {
+ var list = augmentations_2[_h];
+ for (var _j = 0, list_2 = list; _j < list_2.length; _j++) {
+ var augmentation = list_2[_j];
if (ts.isGlobalScopeAugmentation(augmentation.parent))
continue;
mergeModuleAugmentation(augmentation);
@@ -59028,14 +59885,14 @@
return false;
}
if (!ts.nodeCanBeDecorated(node, node.parent, node.parent.parent)) {
- if (node.kind === 156 /* MethodDeclaration */ && !ts.nodeIsPresent(node.body)) {
+ if (node.kind === 157 /* MethodDeclaration */ && !ts.nodeIsPresent(node.body)) {
return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload);
}
else {
return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here);
}
}
- else if (node.kind === 158 /* GetAccessor */ || node.kind === 159 /* SetAccessor */) {
+ else if (node.kind === 159 /* GetAccessor */ || node.kind === 160 /* SetAccessor */) {
var accessors = ts.getAllAccessorDeclarations(node.parent.members, node);
if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) {
return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name);
@@ -59052,23 +59909,23 @@
var flags = 0 /* None */;
for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) {
var modifier = _a[_i];
- if (modifier.kind !== 133 /* ReadonlyKeyword */) {
- if (node.kind === 153 /* PropertySignature */ || node.kind === 155 /* MethodSignature */) {
+ if (modifier.kind !== 134 /* ReadonlyKeyword */) {
+ if (node.kind === 154 /* PropertySignature */ || node.kind === 156 /* MethodSignature */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind));
}
- if (node.kind === 162 /* IndexSignature */) {
+ if (node.kind === 163 /* IndexSignature */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind));
}
}
switch (modifier.kind) {
- case 77 /* ConstKeyword */:
- if (node.kind !== 243 /* EnumDeclaration */) {
- return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(77 /* ConstKeyword */));
+ case 78 /* ConstKeyword */:
+ if (node.kind !== 244 /* EnumDeclaration */) {
+ return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(78 /* ConstKeyword */));
}
break;
- case 115 /* PublicKeyword */:
- case 114 /* ProtectedKeyword */:
- case 113 /* PrivateKeyword */:
+ case 116 /* PublicKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 114 /* PrivateKeyword */:
var text = visibilityToString(ts.modifierToFlag(modifier.kind));
if (flags & 28 /* AccessibilityModifier */) {
return grammarErrorOnNode(modifier, ts.Diagnostics.Accessibility_modifier_already_seen);
@@ -59082,11 +59939,11 @@
else if (flags & 256 /* Async */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async");
}
- else if (node.parent.kind === 245 /* ModuleBlock */ || node.parent.kind === 284 /* SourceFile */) {
+ else if (node.parent.kind === 246 /* ModuleBlock */ || node.parent.kind === 285 /* SourceFile */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text);
}
else if (flags & 128 /* Abstract */) {
- if (modifier.kind === 113 /* PrivateKeyword */) {
+ if (modifier.kind === 114 /* PrivateKeyword */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract");
}
else {
@@ -59095,7 +59952,7 @@
}
flags |= ts.modifierToFlag(modifier.kind);
break;
- case 116 /* StaticKeyword */:
+ case 117 /* StaticKeyword */:
if (flags & 32 /* Static */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static");
}
@@ -59105,10 +59962,10 @@
else if (flags & 256 /* Async */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async");
}
- else if (node.parent.kind === 245 /* ModuleBlock */ || node.parent.kind === 284 /* SourceFile */) {
+ else if (node.parent.kind === 246 /* ModuleBlock */ || node.parent.kind === 285 /* SourceFile */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static");
}
- else if (node.kind === 151 /* Parameter */) {
+ else if (node.kind === 152 /* Parameter */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static");
}
else if (flags & 128 /* Abstract */) {
@@ -59117,18 +59974,18 @@
flags |= 32 /* Static */;
lastStatic = modifier;
break;
- case 133 /* ReadonlyKeyword */:
+ case 134 /* ReadonlyKeyword */:
if (flags & 64 /* Readonly */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly");
}
- else if (node.kind !== 154 /* PropertyDeclaration */ && node.kind !== 153 /* PropertySignature */ && node.kind !== 162 /* IndexSignature */ && node.kind !== 151 /* Parameter */) {
+ else if (node.kind !== 155 /* PropertyDeclaration */ && node.kind !== 154 /* PropertySignature */ && node.kind !== 163 /* IndexSignature */ && node.kind !== 152 /* Parameter */) {
// If node.kind === SyntaxKind.Parameter, checkParameter report an error if it's not a parameter property.
return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature);
}
flags |= 64 /* Readonly */;
lastReadonly = modifier;
break;
- case 85 /* ExportKeyword */:
+ case 86 /* ExportKeyword */:
if (flags & 1 /* Export */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "export");
}
@@ -59141,52 +59998,52 @@
else if (flags & 256 /* Async */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async");
}
- else if (node.parent.kind === 240 /* ClassDeclaration */) {
+ else if (node.parent.kind === 241 /* ClassDeclaration */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export");
}
- else if (node.kind === 151 /* Parameter */) {
+ else if (node.kind === 152 /* Parameter */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export");
}
flags |= 1 /* Export */;
break;
- case 80 /* DefaultKeyword */:
- var container = node.parent.kind === 284 /* SourceFile */ ? node.parent : node.parent.parent;
- if (container.kind === 244 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) {
+ case 81 /* DefaultKeyword */:
+ var container = node.parent.kind === 285 /* SourceFile */ ? node.parent : node.parent.parent;
+ if (container.kind === 245 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) {
return grammarErrorOnNode(modifier, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module);
}
flags |= 512 /* Default */;
break;
- case 125 /* DeclareKeyword */:
+ case 126 /* DeclareKeyword */:
if (flags & 2 /* Ambient */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare");
}
else if (flags & 256 /* Async */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async");
}
- else if (node.parent.kind === 240 /* ClassDeclaration */) {
+ else if (node.parent.kind === 241 /* ClassDeclaration */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare");
}
- else if (node.kind === 151 /* Parameter */) {
+ else if (node.kind === 152 /* Parameter */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare");
}
- else if ((node.parent.flags & 4194304 /* Ambient */) && node.parent.kind === 245 /* ModuleBlock */) {
+ else if ((node.parent.flags & 4194304 /* Ambient */) && node.parent.kind === 246 /* ModuleBlock */) {
return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context);
}
flags |= 2 /* Ambient */;
lastDeclare = modifier;
break;
- case 118 /* AbstractKeyword */:
+ case 119 /* AbstractKeyword */:
if (flags & 128 /* Abstract */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract");
}
- if (node.kind !== 240 /* ClassDeclaration */) {
- if (node.kind !== 156 /* MethodDeclaration */ &&
- node.kind !== 154 /* PropertyDeclaration */ &&
- node.kind !== 158 /* GetAccessor */ &&
- node.kind !== 159 /* SetAccessor */) {
+ if (node.kind !== 241 /* ClassDeclaration */) {
+ if (node.kind !== 157 /* MethodDeclaration */ &&
+ node.kind !== 155 /* PropertyDeclaration */ &&
+ node.kind !== 159 /* GetAccessor */ &&
+ node.kind !== 160 /* SetAccessor */) {
return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration);
}
- if (!(node.parent.kind === 240 /* ClassDeclaration */ && ts.hasModifier(node.parent, 128 /* Abstract */))) {
+ if (!(node.parent.kind === 241 /* ClassDeclaration */ && ts.hasModifier(node.parent, 128 /* Abstract */))) {
return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class);
}
if (flags & 32 /* Static */) {
@@ -59198,14 +60055,14 @@
}
flags |= 128 /* Abstract */;
break;
- case 121 /* AsyncKeyword */:
+ case 122 /* AsyncKeyword */:
if (flags & 256 /* Async */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async");
}
else if (flags & 2 /* Ambient */ || node.parent.flags & 4194304 /* Ambient */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async");
}
- else if (node.kind === 151 /* Parameter */) {
+ else if (node.kind === 152 /* Parameter */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async");
}
flags |= 256 /* Async */;
@@ -59213,7 +60070,7 @@
break;
}
}
- if (node.kind === 157 /* Constructor */) {
+ if (node.kind === 158 /* Constructor */) {
if (flags & 32 /* Static */) {
return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static");
}
@@ -59228,13 +60085,13 @@
}
return false;
}
- else if ((node.kind === 249 /* ImportDeclaration */ || node.kind === 248 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) {
+ else if ((node.kind === 250 /* ImportDeclaration */ || node.kind === 249 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) {
return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare");
}
- else if (node.kind === 151 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) {
+ else if (node.kind === 152 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) {
return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern);
}
- else if (node.kind === 151 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && node.dotDotDotToken) {
+ else if (node.kind === 152 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && node.dotDotDotToken) {
return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter);
}
if (flags & 256 /* Async */) {
@@ -59255,38 +60112,38 @@
}
function shouldReportBadModifier(node) {
switch (node.kind) {
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 157 /* Constructor */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 162 /* IndexSignature */:
- case 244 /* ModuleDeclaration */:
- case 249 /* ImportDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
- case 255 /* ExportDeclaration */:
- case 254 /* ExportAssignment */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 151 /* Parameter */:
- return false;
- default:
- if (node.parent.kind === 245 /* ModuleBlock */ || node.parent.kind === 284 /* SourceFile */) {
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 158 /* Constructor */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 163 /* IndexSignature */:
+ case 245 /* ModuleDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 256 /* ExportDeclaration */:
+ case 255 /* ExportAssignment */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 152 /* Parameter */:
+ return false;
+ default:
+ if (node.parent.kind === 246 /* ModuleBlock */ || node.parent.kind === 285 /* SourceFile */) {
return false;
}
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- return nodeHasAnyModifiersExcept(node, 121 /* AsyncKeyword */);
- case 240 /* ClassDeclaration */:
- return nodeHasAnyModifiersExcept(node, 118 /* AbstractKeyword */);
- case 241 /* InterfaceDeclaration */:
- case 219 /* VariableStatement */:
- case 242 /* TypeAliasDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ return nodeHasAnyModifiersExcept(node, 122 /* AsyncKeyword */);
+ case 241 /* ClassDeclaration */:
+ return nodeHasAnyModifiersExcept(node, 119 /* AbstractKeyword */);
+ case 242 /* InterfaceDeclaration */:
+ case 220 /* VariableStatement */:
+ case 243 /* TypeAliasDeclaration */:
return true;
- case 243 /* EnumDeclaration */:
- return nodeHasAnyModifiersExcept(node, 77 /* ConstKeyword */);
+ case 244 /* EnumDeclaration */:
+ return nodeHasAnyModifiersExcept(node, 78 /* ConstKeyword */);
default:
ts.Debug.fail();
return false;
@@ -59298,10 +60155,10 @@
}
function checkGrammarAsyncModifier(node, asyncModifier) {
switch (node.kind) {
- case 156 /* MethodDeclaration */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return false;
}
return grammarErrorOnNode(asyncModifier, ts.Diagnostics._0_modifier_cannot_be_used_here, "async");
@@ -59416,10 +60273,10 @@
if (!parameter.type) {
return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation);
}
- if (parameter.type.kind !== 138 /* StringKeyword */ && parameter.type.kind !== 135 /* NumberKeyword */) {
+ if (parameter.type.kind !== 139 /* StringKeyword */ && parameter.type.kind !== 136 /* NumberKeyword */) {
var type = getTypeFromTypeNode(parameter.type);
if (type.flags & 4 /* String */ || type.flags & 8 /* Number */) {
- return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_cannot_be_a_type_alias_Consider_writing_0_Colon_1_Colon_2_instead, ts.getTextOfNode(parameter.name), typeToString(type), typeToString(getTypeFromTypeNode(node.type)));
+ return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_cannot_be_a_type_alias_Consider_writing_0_Colon_1_Colon_2_instead, ts.getTextOfNode(parameter.name), typeToString(type), typeToString(node.type ? getTypeFromTypeNode(node.type) : anyType));
}
if (type.flags & 1048576 /* Union */ && allTypesAssignableToKind(type, 128 /* StringLiteral */, /*strict*/ true)) {
return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_cannot_be_a_union_type_Consider_using_a_mapped_object_type_instead);
@@ -59450,9 +60307,9 @@
}
function checkGrammarForOmittedArgument(args) {
if (args) {
- for (var _i = 0, args_5 = args; _i < args_5.length; _i++) {
- var arg = args_5[_i];
- if (arg.kind === 210 /* OmittedExpression */) {
+ for (var _i = 0, args_4 = args; _i < args_4.length; _i++) {
+ var arg = args_4[_i];
+ if (arg.kind === 211 /* OmittedExpression */) {
return grammarErrorAtPos(arg, arg.pos, 0, ts.Diagnostics.Argument_expression_expected);
}
}
@@ -59482,7 +60339,7 @@
if (!checkGrammarDecoratorsAndModifiers(node) && node.heritageClauses) {
for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) {
var heritageClause = _a[_i];
- if (heritageClause.token === 86 /* ExtendsKeyword */) {
+ if (heritageClause.token === 87 /* ExtendsKeyword */) {
if (seenExtendsClause) {
return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen);
}
@@ -59495,7 +60352,7 @@
seenExtendsClause = true;
}
else {
- ts.Debug.assert(heritageClause.token === 109 /* ImplementsKeyword */);
+ ts.Debug.assert(heritageClause.token === 110 /* ImplementsKeyword */);
if (seenImplementsClause) {
return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.implements_clause_already_seen);
}
@@ -59511,14 +60368,14 @@
if (node.heritageClauses) {
for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) {
var heritageClause = _a[_i];
- if (heritageClause.token === 86 /* ExtendsKeyword */) {
+ if (heritageClause.token === 87 /* ExtendsKeyword */) {
if (seenExtendsClause) {
return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen);
}
seenExtendsClause = true;
}
else {
- ts.Debug.assert(heritageClause.token === 109 /* ImplementsKeyword */);
+ ts.Debug.assert(heritageClause.token === 110 /* ImplementsKeyword */);
return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.Interface_declaration_cannot_have_implements_clause);
}
// Grammar checking heritageClause inside class declaration
@@ -59529,20 +60386,20 @@
}
function checkGrammarComputedPropertyName(node) {
// If node is not a computedPropertyName, just skip the grammar checking
- if (node.kind !== 149 /* ComputedPropertyName */) {
+ if (node.kind !== 150 /* ComputedPropertyName */) {
return false;
}
var computedPropertyName = node;
- if (computedPropertyName.expression.kind === 204 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 27 /* CommaToken */) {
+ if (computedPropertyName.expression.kind === 205 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 27 /* CommaToken */) {
return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name);
}
return false;
}
function checkGrammarForGenerator(node) {
if (node.asteriskToken) {
- ts.Debug.assert(node.kind === 239 /* FunctionDeclaration */ ||
- node.kind === 196 /* FunctionExpression */ ||
- node.kind === 156 /* MethodDeclaration */);
+ ts.Debug.assert(node.kind === 240 /* FunctionDeclaration */ ||
+ node.kind === 197 /* FunctionExpression */ ||
+ node.kind === 157 /* MethodDeclaration */);
if (node.flags & 4194304 /* Ambient */) {
return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context);
}
@@ -59568,15 +60425,22 @@
var seen = ts.createUnderscoreEscapedMap();
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var prop = _a[_i];
- if (prop.kind === 277 /* SpreadAssignment */) {
+ if (prop.kind === 278 /* SpreadAssignment */) {
+ if (inDestructuring) {
+ // a rest property cannot be destructured any further
+ var expression = ts.skipParentheses(prop.expression);
+ if (ts.isArrayLiteralExpression(expression) || ts.isObjectLiteralExpression(expression)) {
+ return grammarErrorOnNode(prop.expression, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern);
+ }
+ }
continue;
}
var name = prop.name;
- if (name.kind === 149 /* ComputedPropertyName */) {
+ if (name.kind === 150 /* ComputedPropertyName */) {
// If the name is not a ComputedPropertyName, the grammar checking will skip it
checkGrammarComputedPropertyName(name);
}
- if (prop.kind === 276 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) {
+ if (prop.kind === 277 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) {
// having objectAssignmentInitializer is only valid in ObjectAssignmentPattern
// outside of destructuring it is a syntax error
return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment);
@@ -59585,7 +60449,7 @@
if (prop.modifiers) {
for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) { // TODO: GH#19955
var mod = _c[_b];
- if (mod.kind !== 121 /* AsyncKeyword */ || prop.kind !== 156 /* MethodDeclaration */) {
+ if (mod.kind !== 122 /* AsyncKeyword */ || prop.kind !== 157 /* MethodDeclaration */) {
grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod));
}
}
@@ -59600,23 +60464,23 @@
// and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields
var currentKind = void 0;
switch (prop.kind) {
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
checkGrammarForInvalidExclamationToken(prop.exclamationToken, ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context);
/* tslint:disable:no-switch-case-fall-through */
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
// Grammar checking for computedPropertyName and shorthandPropertyAssignment
checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional);
if (name.kind === 8 /* NumericLiteral */) {
checkGrammarNumericLiteral(name);
}
// falls through
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
currentKind = 1 /* Property */;
break;
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
currentKind = 2 /* GetAccessor */;
break;
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
currentKind = 4 /* SetAccessor */;
break;
default:
@@ -59653,7 +60517,7 @@
var seen = ts.createUnderscoreEscapedMap();
for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) {
var attr = _a[_i];
- if (attr.kind === 269 /* JsxSpreadAttribute */) {
+ if (attr.kind === 270 /* JsxSpreadAttribute */) {
continue;
}
var name = attr.name, initializer = attr.initializer;
@@ -59663,7 +60527,7 @@
else {
return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name);
}
- if (initializer && initializer.kind === 270 /* JsxExpression */ && !initializer.expression) {
+ if (initializer && initializer.kind === 271 /* JsxExpression */ && !initializer.expression) {
return grammarErrorOnNode(initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression);
}
}
@@ -59672,12 +60536,25 @@
if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) {
return true;
}
- if (forInOrOfStatement.kind === 227 /* ForOfStatement */ && forInOrOfStatement.awaitModifier) {
+ if (forInOrOfStatement.kind === 228 /* ForOfStatement */ && forInOrOfStatement.awaitModifier) {
if ((forInOrOfStatement.flags & 16384 /* AwaitContext */) === 0 /* None */) {
- return grammarErrorOnNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator);
+ // use of 'for-await-of' in non-async function
+ var sourceFile = ts.getSourceFileOfNode(forInOrOfStatement);
+ if (!hasParseDiagnostics(sourceFile)) {
+ var diagnostic = ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator);
+ var func = ts.getContainingFunction(forInOrOfStatement);
+ if (func && func.kind !== 158 /* Constructor */) {
+ ts.Debug.assert((ts.getFunctionFlags(func) & 2 /* Async */) === 0, "Enclosing function should never be an async function.");
+ var relatedInfo = ts.createDiagnosticForNode(func, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async);
+ ts.addRelatedInfo(diagnostic, relatedInfo);
}
+ diagnostics.add(diagnostic);
+ return true;
}
- if (forInOrOfStatement.initializer.kind === 238 /* VariableDeclarationList */) {
+ return false;
+ }
+ }
+ if (forInOrOfStatement.initializer.kind === 239 /* VariableDeclarationList */) {
var variableList = forInOrOfStatement.initializer;
if (!checkGrammarVariableDeclarationList(variableList)) {
var declarations = variableList.declarations;
@@ -59692,20 +60569,20 @@
return false;
}
if (declarations.length > 1) {
- var diagnostic = forInOrOfStatement.kind === 226 /* ForInStatement */
+ var diagnostic = forInOrOfStatement.kind === 227 /* ForInStatement */
? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement
: ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement;
return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic);
}
var firstDeclaration = declarations[0];
if (firstDeclaration.initializer) {
- var diagnostic = forInOrOfStatement.kind === 226 /* ForInStatement */
+ var diagnostic = forInOrOfStatement.kind === 227 /* ForInStatement */
? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer
: ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer;
return grammarErrorOnNode(firstDeclaration.name, diagnostic);
}
if (firstDeclaration.type) {
- var diagnostic = forInOrOfStatement.kind === 226 /* ForInStatement */
+ var diagnostic = forInOrOfStatement.kind === 227 /* ForInStatement */
? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation
: ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation;
return grammarErrorOnNode(firstDeclaration, diagnostic);
@@ -59732,11 +60609,11 @@
return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters);
}
else if (!doesAccessorHaveCorrectParameterCount(accessor)) {
- return grammarErrorOnNode(accessor.name, kind === 158 /* GetAccessor */ ?
+ return grammarErrorOnNode(accessor.name, kind === 159 /* GetAccessor */ ?
ts.Diagnostics.A_get_accessor_cannot_have_parameters :
ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter);
}
- else if (kind === 159 /* SetAccessor */) {
+ else if (kind === 160 /* SetAccessor */) {
if (accessor.type) {
return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation);
}
@@ -59760,23 +60637,23 @@
* A set accessor has one parameter or a `this` parameter and one more parameter.
*/
function doesAccessorHaveCorrectParameterCount(accessor) {
- return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 158 /* GetAccessor */ ? 0 : 1);
+ return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 159 /* GetAccessor */ ? 0 : 1);
}
function getAccessorThisParameter(accessor) {
- if (accessor.parameters.length === (accessor.kind === 158 /* GetAccessor */ ? 1 : 2)) {
+ if (accessor.parameters.length === (accessor.kind === 159 /* GetAccessor */ ? 1 : 2)) {
return ts.getThisParameter(accessor);
}
}
function checkGrammarTypeOperatorNode(node) {
- if (node.operator === 142 /* UniqueKeyword */) {
- if (node.type.kind !== 139 /* SymbolKeyword */) {
- return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(139 /* SymbolKeyword */));
+ if (node.operator === 143 /* UniqueKeyword */) {
+ if (node.type.kind !== 140 /* SymbolKeyword */) {
+ return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(140 /* SymbolKeyword */));
}
var parent = ts.walkUpParenthesizedTypes(node.parent);
switch (parent.kind) {
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
var decl = parent;
- if (decl.name.kind !== 72 /* Identifier */) {
+ if (decl.name.kind !== 73 /* Identifier */) {
return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name);
}
if (!ts.isVariableDeclarationInVariableStatement(decl)) {
@@ -59786,13 +60663,13 @@
return grammarErrorOnNode(parent.name, ts.Diagnostics.A_variable_whose_type_is_a_unique_symbol_type_must_be_const);
}
break;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
if (!ts.hasModifier(parent, 32 /* Static */) ||
!ts.hasModifier(parent, 64 /* Readonly */)) {
return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly);
}
break;
- case 153 /* PropertySignature */:
+ case 154 /* PropertySignature */:
if (!ts.hasModifier(parent, 64 /* Readonly */)) {
return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly);
}
@@ -59801,9 +60678,9 @@
return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_are_not_allowed_here);
}
}
- else if (node.operator === 133 /* ReadonlyKeyword */) {
- if (node.type.kind !== 169 /* ArrayType */ && node.type.kind !== 170 /* TupleType */) {
- return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(139 /* SymbolKeyword */));
+ else if (node.operator === 134 /* ReadonlyKeyword */) {
+ if (node.type.kind !== 170 /* ArrayType */ && node.type.kind !== 171 /* TupleType */) {
+ return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(140 /* SymbolKeyword */));
}
}
}
@@ -59816,10 +60693,10 @@
if (checkGrammarFunctionLikeDeclaration(node)) {
return true;
}
- if (node.kind === 156 /* MethodDeclaration */) {
- if (node.parent.kind === 188 /* ObjectLiteralExpression */) {
+ if (node.kind === 157 /* MethodDeclaration */) {
+ if (node.parent.kind === 189 /* ObjectLiteralExpression */) {
// We only disallow modifier on a method declaration if it is a property of object-literal-expression
- if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 121 /* AsyncKeyword */)) {
+ if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 122 /* AsyncKeyword */)) {
return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here);
}
else if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) {
@@ -59832,6 +60709,9 @@
return grammarErrorAtPos(node, node.end - 1, ";".length, ts.Diagnostics._0_expected, "{");
}
}
+ else if (ts.isClassLike(node.parent) && ts.isStringLiteral(node.name) && node.name.text === "constructor" && (!compilerOptions.target || compilerOptions.target < 1 /* ES5 */)) {
+ return grammarErrorOnNode(node.name, ts.Diagnostics.Quoted_constructors_have_previously_been_interpreted_as_methods_which_is_incorrect_In_TypeScript_3_6_they_will_be_correctly_parsed_as_constructors_In_the_meantime_consider_using_constructor_to_write_a_constructor_or_constructor_to_write_a_method);
+ }
if (checkGrammarForGenerator(node)) {
return true;
}
@@ -59845,14 +60725,14 @@
if (node.flags & 4194304 /* Ambient */) {
return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type);
}
- else if (node.kind === 156 /* MethodDeclaration */ && !node.body) {
+ else if (node.kind === 157 /* MethodDeclaration */ && !node.body) {
return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type);
}
}
- else if (node.parent.kind === 241 /* InterfaceDeclaration */) {
+ else if (node.parent.kind === 242 /* InterfaceDeclaration */) {
return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type);
}
- else if (node.parent.kind === 168 /* TypeLiteral */) {
+ else if (node.parent.kind === 169 /* TypeLiteral */) {
return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type);
}
}
@@ -59863,11 +60743,11 @@
return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary);
}
switch (current.kind) {
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
if (node.label && current.label.escapedText === node.label.escapedText) {
// found matching label - verify that label usage is correct
// continue can only target labels that are on iteration statements
- var isMisplacedContinueLabel = node.kind === 228 /* ContinueStatement */
+ var isMisplacedContinueLabel = node.kind === 229 /* ContinueStatement */
&& !ts.isIterationStatement(current.statement, /*lookInLabeledStatement*/ true);
if (isMisplacedContinueLabel) {
return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement);
@@ -59875,8 +60755,8 @@
return false;
}
break;
- case 232 /* SwitchStatement */:
- if (node.kind === 229 /* BreakStatement */ && !node.label) {
+ case 233 /* SwitchStatement */:
+ if (node.kind === 230 /* BreakStatement */ && !node.label) {
// unlabeled break within switch statement - ok
return false;
}
@@ -59891,13 +60771,13 @@
current = current.parent;
}
if (node.label) {
- var message = node.kind === 229 /* BreakStatement */
+ var message = node.kind === 230 /* BreakStatement */
? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement
: ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement;
return grammarErrorOnNode(node, message);
}
else {
- var message = node.kind === 229 /* BreakStatement */
+ var message = node.kind === 230 /* BreakStatement */
? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement
: ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement;
return grammarErrorOnNode(node, message);
@@ -59921,12 +60801,12 @@
}
function isStringOrNumberLiteralExpression(expr) {
return expr.kind === 10 /* StringLiteral */ || expr.kind === 8 /* NumericLiteral */ ||
- expr.kind === 202 /* PrefixUnaryExpression */ && expr.operator === 39 /* MinusToken */ &&
+ expr.kind === 203 /* PrefixUnaryExpression */ && expr.operator === 39 /* MinusToken */ &&
expr.operand.kind === 8 /* NumericLiteral */;
}
function isBigIntLiteralExpression(expr) {
return expr.kind === 9 /* BigIntLiteral */ ||
- expr.kind === 202 /* PrefixUnaryExpression */ && expr.operator === 39 /* MinusToken */ &&
+ expr.kind === 203 /* PrefixUnaryExpression */ && expr.operator === 39 /* MinusToken */ &&
expr.operand.kind === 9 /* BigIntLiteral */;
}
function isSimpleLiteralEnumReference(expr) {
@@ -59939,7 +60819,7 @@
if (initializer) {
var isInvalidInitializer = !(isStringOrNumberLiteralExpression(initializer) ||
isSimpleLiteralEnumReference(initializer) ||
- initializer.kind === 102 /* TrueKeyword */ || initializer.kind === 87 /* FalseKeyword */ ||
+ initializer.kind === 103 /* TrueKeyword */ || initializer.kind === 88 /* FalseKeyword */ ||
isBigIntLiteralExpression(initializer));
var isConstOrReadonly = ts.isDeclarationReadonly(node) || ts.isVariableDeclaration(node) && ts.isVarConst(node);
if (isConstOrReadonly && !node.type) {
@@ -59956,7 +60836,7 @@
}
}
function checkGrammarVariableDeclaration(node) {
- if (node.parent.parent.kind !== 226 /* ForInStatement */ && node.parent.parent.kind !== 227 /* ForOfStatement */) {
+ if (node.parent.parent.kind !== 227 /* ForInStatement */ && node.parent.parent.kind !== 228 /* ForOfStatement */) {
if (node.flags & 4194304 /* Ambient */) {
checkAmbientInitializer(node);
}
@@ -59969,8 +60849,8 @@
}
}
}
- if (node.exclamationToken && (node.parent.parent.kind !== 219 /* VariableStatement */ || !node.type || node.initializer || node.flags & 4194304 /* Ambient */)) {
- return grammarErrorOnNode(node.exclamationToken, ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context);
+ if (node.exclamationToken && (node.parent.parent.kind !== 220 /* VariableStatement */ || !node.type || node.initializer || node.flags & 4194304 /* Ambient */)) {
+ return grammarErrorOnNode(node.exclamationToken, ts.Diagnostics.Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation);
}
if (compilerOptions.module !== ts.ModuleKind.ES2015 && compilerOptions.module !== ts.ModuleKind.ESNext && compilerOptions.module !== ts.ModuleKind.System && !compilerOptions.noEmit &&
!(node.parent.parent.flags & 4194304 /* Ambient */) && ts.hasModifier(node.parent.parent, 1 /* Export */)) {
@@ -59986,7 +60866,7 @@
return checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name);
}
function checkESModuleMarker(name) {
- if (name.kind === 72 /* Identifier */) {
+ if (name.kind === 73 /* Identifier */) {
if (ts.idText(name) === "__esModule") {
return grammarErrorOnNode(name, ts.Diagnostics.Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules);
}
@@ -60003,8 +60883,8 @@
return false;
}
function checkGrammarNameInLetOrConstDeclarations(name) {
- if (name.kind === 72 /* Identifier */) {
- if (name.originalKeywordKind === 111 /* LetKeyword */) {
+ if (name.kind === 73 /* Identifier */) {
+ if (name.originalKeywordKind === 112 /* LetKeyword */) {
return grammarErrorOnNode(name, ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations);
}
}
@@ -60031,15 +60911,15 @@
}
function allowLetAndConstDeclarations(parent) {
switch (parent.kind) {
- case 222 /* IfStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
- case 231 /* WithStatement */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 223 /* IfStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
+ case 232 /* WithStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
return false;
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return allowLetAndConstDeclarations(parent.parent);
}
return true;
@@ -60057,12 +60937,12 @@
function checkGrammarMetaProperty(node) {
var escapedText = node.name.escapedText;
switch (node.keywordToken) {
- case 95 /* NewKeyword */:
+ case 96 /* NewKeyword */:
if (escapedText !== "target") {
return grammarErrorOnNode(node.name, ts.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.escapedText, ts.tokenToString(node.keywordToken), "target");
}
break;
- case 92 /* ImportKeyword */:
+ case 93 /* ImportKeyword */:
if (escapedText !== "meta") {
return grammarErrorOnNode(node.name, ts.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.escapedText, ts.tokenToString(node.keywordToken), "meta");
}
@@ -60113,11 +60993,14 @@
}
function checkGrammarProperty(node) {
if (ts.isClassLike(node.parent)) {
+ if (ts.isStringLiteral(node.name) && node.name.text === "constructor") {
+ return grammarErrorOnNode(node.name, ts.Diagnostics.Classes_may_not_have_a_field_named_constructor);
+ }
if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) {
return true;
}
}
- else if (node.parent.kind === 241 /* InterfaceDeclaration */) {
+ else if (node.parent.kind === 242 /* InterfaceDeclaration */) {
if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) {
return true;
}
@@ -60125,7 +61008,7 @@
return grammarErrorOnNode(node.initializer, ts.Diagnostics.An_interface_property_cannot_have_an_initializer);
}
}
- else if (node.parent.kind === 168 /* TypeLiteral */) {
+ else if (node.parent.kind === 169 /* TypeLiteral */) {
if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) {
return true;
}
@@ -60154,22 +61037,22 @@
// export_opt AmbientDeclaration
//
// TODO: The spec needs to be amended to reflect this grammar.
- if (node.kind === 241 /* InterfaceDeclaration */ ||
- node.kind === 242 /* TypeAliasDeclaration */ ||
- node.kind === 249 /* ImportDeclaration */ ||
- node.kind === 248 /* ImportEqualsDeclaration */ ||
- node.kind === 255 /* ExportDeclaration */ ||
- node.kind === 254 /* ExportAssignment */ ||
- node.kind === 247 /* NamespaceExportDeclaration */ ||
+ if (node.kind === 242 /* InterfaceDeclaration */ ||
+ node.kind === 243 /* TypeAliasDeclaration */ ||
+ node.kind === 250 /* ImportDeclaration */ ||
+ node.kind === 249 /* ImportEqualsDeclaration */ ||
+ node.kind === 256 /* ExportDeclaration */ ||
+ node.kind === 255 /* ExportAssignment */ ||
+ node.kind === 248 /* NamespaceExportDeclaration */ ||
ts.hasModifier(node, 2 /* Ambient */ | 1 /* Export */ | 512 /* Default */)) {
return false;
}
- return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file);
+ return grammarErrorOnFirstToken(node, ts.Diagnostics.Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier);
}
function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) {
for (var _i = 0, _a = file.statements; _i < _a.length; _i++) {
var decl = _a[_i];
- if (ts.isDeclaration(decl) || decl.kind === 219 /* VariableStatement */) {
+ if (ts.isDeclaration(decl) || decl.kind === 220 /* VariableStatement */) {
if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) {
return true;
}
@@ -60196,7 +61079,7 @@
// to prevent noisiness. So use a bit on the block to indicate if
// this has already been reported, and don't report if it has.
//
- if (node.parent.kind === 218 /* Block */ || node.parent.kind === 245 /* ModuleBlock */ || node.parent.kind === 284 /* SourceFile */) {
+ if (node.parent.kind === 219 /* Block */ || node.parent.kind === 246 /* ModuleBlock */ || node.parent.kind === 285 /* SourceFile */) {
var links_2 = getNodeLinks(node.parent);
// Check if the containing block ever report this error
if (!links_2.hasReportedStatementInAmbientContext) {
@@ -60218,10 +61101,10 @@
if (languageVersion >= 1 /* ES5 */) {
diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0;
}
- else if (ts.isChildOfNodeWithKind(node, 182 /* LiteralType */)) {
+ else if (ts.isChildOfNodeWithKind(node, 183 /* LiteralType */)) {
diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0;
}
- else if (ts.isChildOfNodeWithKind(node, 278 /* EnumMember */)) {
+ else if (ts.isChildOfNodeWithKind(node, 279 /* EnumMember */)) {
diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0;
}
if (diagnosticMessage) {
@@ -60236,7 +61119,7 @@
var literalType = ts.isLiteralTypeNode(node.parent) ||
ts.isPrefixUnaryExpression(node.parent) && ts.isLiteralTypeNode(node.parent.parent);
if (!literalType) {
- if (languageVersion < 7 /* ESNext */) {
+ if (languageVersion < 8 /* ESNext */) {
if (grammarErrorOnNode(node, ts.Diagnostics.BigInt_literals_are_not_available_when_targeting_lower_than_ESNext)) {
return true;
}
@@ -60289,8 +61172,8 @@
/** Like 'isDeclarationName', but returns true for LHS of `import { x as y }` or `export { x as y }`. */
function isDeclarationNameOrImportPropertyName(name) {
switch (name.parent.kind) {
- case 253 /* ImportSpecifier */:
- case 257 /* ExportSpecifier */:
+ case 254 /* ImportSpecifier */:
+ case 258 /* ExportSpecifier */:
return ts.isIdentifier(name);
default:
return ts.isDeclarationName(name);
@@ -60298,14 +61181,14 @@
}
function isSomeImportDeclaration(decl) {
switch (decl.kind) {
- case 250 /* ImportClause */: // For default import
- case 248 /* ImportEqualsDeclaration */:
- case 251 /* NamespaceImport */:
- case 253 /* ImportSpecifier */: // For rename import `x as y`
+ case 251 /* ImportClause */: // For default import
+ case 249 /* ImportEqualsDeclaration */:
+ case 252 /* NamespaceImport */:
+ case 254 /* ImportSpecifier */: // For rename import `x as y`
return true;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
// For regular import, `decl` is an Identifier under the ImportSpecifier.
- return decl.parent.kind === 253 /* ImportSpecifier */;
+ return decl.parent.kind === 254 /* ImportSpecifier */;
default:
return false;
}
@@ -60433,7 +61316,7 @@
return node;
}
function createIdentifier(text, typeArguments) {
- var node = createSynthesizedNode(72 /* Identifier */);
+ var node = createSynthesizedNode(73 /* Identifier */);
node.escapedText = ts.escapeLeadingUnderscores(text);
node.originalKeywordKind = text ? ts.stringToToken(text) : 0 /* Unknown */;
node.autoGenerateFlags = 0 /* None */;
@@ -60514,23 +61397,23 @@
ts.createToken = createToken;
// Reserved words
function createSuper() {
- return createSynthesizedNode(98 /* SuperKeyword */);
+ return createSynthesizedNode(99 /* SuperKeyword */);
}
ts.createSuper = createSuper;
function createThis() {
- return createSynthesizedNode(100 /* ThisKeyword */);
+ return createSynthesizedNode(101 /* ThisKeyword */);
}
ts.createThis = createThis;
function createNull() {
- return createSynthesizedNode(96 /* NullKeyword */);
+ return createSynthesizedNode(97 /* NullKeyword */);
}
ts.createNull = createNull;
function createTrue() {
- return createSynthesizedNode(102 /* TrueKeyword */);
+ return createSynthesizedNode(103 /* TrueKeyword */);
}
ts.createTrue = createTrue;
function createFalse() {
- return createSynthesizedNode(87 /* FalseKeyword */);
+ return createSynthesizedNode(88 /* FalseKeyword */);
}
ts.createFalse = createFalse;
// Modifiers
@@ -60541,44 +61424,44 @@
function createModifiersFromModifierFlags(flags) {
var result = [];
if (flags & 1 /* Export */) {
- result.push(createModifier(85 /* ExportKeyword */));
+ result.push(createModifier(86 /* ExportKeyword */));
}
if (flags & 2 /* Ambient */) {
- result.push(createModifier(125 /* DeclareKeyword */));
+ result.push(createModifier(126 /* DeclareKeyword */));
}
if (flags & 512 /* Default */) {
- result.push(createModifier(80 /* DefaultKeyword */));
+ result.push(createModifier(81 /* DefaultKeyword */));
}
if (flags & 2048 /* Const */) {
- result.push(createModifier(77 /* ConstKeyword */));
+ result.push(createModifier(78 /* ConstKeyword */));
}
if (flags & 4 /* Public */) {
- result.push(createModifier(115 /* PublicKeyword */));
+ result.push(createModifier(116 /* PublicKeyword */));
}
if (flags & 8 /* Private */) {
- result.push(createModifier(113 /* PrivateKeyword */));
+ result.push(createModifier(114 /* PrivateKeyword */));
}
if (flags & 16 /* Protected */) {
- result.push(createModifier(114 /* ProtectedKeyword */));
+ result.push(createModifier(115 /* ProtectedKeyword */));
}
if (flags & 128 /* Abstract */) {
- result.push(createModifier(118 /* AbstractKeyword */));
+ result.push(createModifier(119 /* AbstractKeyword */));
}
if (flags & 32 /* Static */) {
- result.push(createModifier(116 /* StaticKeyword */));
+ result.push(createModifier(117 /* StaticKeyword */));
}
if (flags & 64 /* Readonly */) {
- result.push(createModifier(133 /* ReadonlyKeyword */));
+ result.push(createModifier(134 /* ReadonlyKeyword */));
}
if (flags & 256 /* Async */) {
- result.push(createModifier(121 /* AsyncKeyword */));
+ result.push(createModifier(122 /* AsyncKeyword */));
}
return result;
}
ts.createModifiersFromModifierFlags = createModifiersFromModifierFlags;
// Names
function createQualifiedName(left, right) {
- var node = createSynthesizedNode(148 /* QualifiedName */);
+ var node = createSynthesizedNode(149 /* QualifiedName */);
node.left = left;
node.right = asName(right);
return node;
@@ -60597,7 +61480,7 @@
: expression;
}
function createComputedPropertyName(expression) {
- var node = createSynthesizedNode(149 /* ComputedPropertyName */);
+ var node = createSynthesizedNode(150 /* ComputedPropertyName */);
node.expression = parenthesizeForComputedName(expression);
return node;
}
@@ -60610,7 +61493,7 @@
ts.updateComputedPropertyName = updateComputedPropertyName;
// Signature elements
function createTypeParameterDeclaration(name, constraint, defaultType) {
- var node = createSynthesizedNode(150 /* TypeParameter */);
+ var node = createSynthesizedNode(151 /* TypeParameter */);
node.name = asName(name);
node.constraint = constraint;
node.default = defaultType;
@@ -60626,7 +61509,7 @@
}
ts.updateTypeParameterDeclaration = updateTypeParameterDeclaration;
function createParameter(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer) {
- var node = createSynthesizedNode(151 /* Parameter */);
+ var node = createSynthesizedNode(152 /* Parameter */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.dotDotDotToken = dotDotDotToken;
@@ -60650,7 +61533,7 @@
}
ts.updateParameter = updateParameter;
function createDecorator(expression) {
- var node = createSynthesizedNode(152 /* Decorator */);
+ var node = createSynthesizedNode(153 /* Decorator */);
node.expression = ts.parenthesizeForAccess(expression);
return node;
}
@@ -60663,7 +61546,7 @@
ts.updateDecorator = updateDecorator;
// Type Elements
function createPropertySignature(modifiers, name, questionToken, type, initializer) {
- var node = createSynthesizedNode(153 /* PropertySignature */);
+ var node = createSynthesizedNode(154 /* PropertySignature */);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
node.questionToken = questionToken;
@@ -60683,7 +61566,7 @@
}
ts.updatePropertySignature = updatePropertySignature;
function createProperty(decorators, modifiers, name, questionOrExclamationToken, type, initializer) {
- var node = createSynthesizedNode(154 /* PropertyDeclaration */);
+ var node = createSynthesizedNode(155 /* PropertyDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -60707,7 +61590,7 @@
}
ts.updateProperty = updateProperty;
function createMethodSignature(typeParameters, parameters, type, name, questionToken) {
- var node = createSignatureDeclaration(155 /* MethodSignature */, typeParameters, parameters, type);
+ var node = createSignatureDeclaration(156 /* MethodSignature */, typeParameters, parameters, type);
node.name = asName(name);
node.questionToken = questionToken;
return node;
@@ -60724,7 +61607,7 @@
}
ts.updateMethodSignature = updateMethodSignature;
function createMethod(decorators, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) {
- var node = createSynthesizedNode(156 /* MethodDeclaration */);
+ var node = createSynthesizedNode(157 /* MethodDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.asteriskToken = asteriskToken;
@@ -60752,7 +61635,7 @@
}
ts.updateMethod = updateMethod;
function createConstructor(decorators, modifiers, parameters, body) {
- var node = createSynthesizedNode(157 /* Constructor */);
+ var node = createSynthesizedNode(158 /* Constructor */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.typeParameters = undefined;
@@ -60772,7 +61655,7 @@
}
ts.updateConstructor = updateConstructor;
function createGetAccessor(decorators, modifiers, name, parameters, type, body) {
- var node = createSynthesizedNode(158 /* GetAccessor */);
+ var node = createSynthesizedNode(159 /* GetAccessor */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -60795,7 +61678,7 @@
}
ts.updateGetAccessor = updateGetAccessor;
function createSetAccessor(decorators, modifiers, name, parameters, body) {
- var node = createSynthesizedNode(159 /* SetAccessor */);
+ var node = createSynthesizedNode(160 /* SetAccessor */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -60816,7 +61699,7 @@
}
ts.updateSetAccessor = updateSetAccessor;
function createCallSignature(typeParameters, parameters, type) {
- return createSignatureDeclaration(160 /* CallSignature */, typeParameters, parameters, type);
+ return createSignatureDeclaration(161 /* CallSignature */, typeParameters, parameters, type);
}
ts.createCallSignature = createCallSignature;
function updateCallSignature(node, typeParameters, parameters, type) {
@@ -60824,7 +61707,7 @@
}
ts.updateCallSignature = updateCallSignature;
function createConstructSignature(typeParameters, parameters, type) {
- return createSignatureDeclaration(161 /* ConstructSignature */, typeParameters, parameters, type);
+ return createSignatureDeclaration(162 /* ConstructSignature */, typeParameters, parameters, type);
}
ts.createConstructSignature = createConstructSignature;
function updateConstructSignature(node, typeParameters, parameters, type) {
@@ -60832,7 +61715,7 @@
}
ts.updateConstructSignature = updateConstructSignature;
function createIndexSignature(decorators, modifiers, parameters, type) {
- var node = createSynthesizedNode(162 /* IndexSignature */);
+ var node = createSynthesizedNode(163 /* IndexSignature */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.parameters = createNodeArray(parameters);
@@ -60872,7 +61755,7 @@
}
ts.createKeywordTypeNode = createKeywordTypeNode;
function createTypePredicateNode(parameterName, type) {
- var node = createSynthesizedNode(163 /* TypePredicate */);
+ var node = createSynthesizedNode(164 /* TypePredicate */);
node.parameterName = asName(parameterName);
node.type = type;
return node;
@@ -60886,7 +61769,7 @@
}
ts.updateTypePredicateNode = updateTypePredicateNode;
function createTypeReferenceNode(typeName, typeArguments) {
- var node = createSynthesizedNode(164 /* TypeReference */);
+ var node = createSynthesizedNode(165 /* TypeReference */);
node.typeName = asName(typeName);
node.typeArguments = typeArguments && ts.parenthesizeTypeParameters(typeArguments);
return node;
@@ -60900,7 +61783,7 @@
}
ts.updateTypeReferenceNode = updateTypeReferenceNode;
function createFunctionTypeNode(typeParameters, parameters, type) {
- return createSignatureDeclaration(165 /* FunctionType */, typeParameters, parameters, type);
+ return createSignatureDeclaration(166 /* FunctionType */, typeParameters, parameters, type);
}
ts.createFunctionTypeNode = createFunctionTypeNode;
function updateFunctionTypeNode(node, typeParameters, parameters, type) {
@@ -60908,7 +61791,7 @@
}
ts.updateFunctionTypeNode = updateFunctionTypeNode;
function createConstructorTypeNode(typeParameters, parameters, type) {
- return createSignatureDeclaration(166 /* ConstructorType */, typeParameters, parameters, type);
+ return createSignatureDeclaration(167 /* ConstructorType */, typeParameters, parameters, type);
}
ts.createConstructorTypeNode = createConstructorTypeNode;
function updateConstructorTypeNode(node, typeParameters, parameters, type) {
@@ -60916,7 +61799,7 @@
}
ts.updateConstructorTypeNode = updateConstructorTypeNode;
function createTypeQueryNode(exprName) {
- var node = createSynthesizedNode(167 /* TypeQuery */);
+ var node = createSynthesizedNode(168 /* TypeQuery */);
node.exprName = exprName;
return node;
}
@@ -60928,7 +61811,7 @@
}
ts.updateTypeQueryNode = updateTypeQueryNode;
function createTypeLiteralNode(members) {
- var node = createSynthesizedNode(168 /* TypeLiteral */);
+ var node = createSynthesizedNode(169 /* TypeLiteral */);
node.members = createNodeArray(members);
return node;
}
@@ -60940,7 +61823,7 @@
}
ts.updateTypeLiteralNode = updateTypeLiteralNode;
function createArrayTypeNode(elementType) {
- var node = createSynthesizedNode(169 /* ArrayType */);
+ var node = createSynthesizedNode(170 /* ArrayType */);
node.elementType = ts.parenthesizeArrayTypeMember(elementType);
return node;
}
@@ -60952,7 +61835,7 @@
}
ts.updateArrayTypeNode = updateArrayTypeNode;
function createTupleTypeNode(elementTypes) {
- var node = createSynthesizedNode(170 /* TupleType */);
+ var node = createSynthesizedNode(171 /* TupleType */);
node.elementTypes = createNodeArray(elementTypes);
return node;
}
@@ -60964,7 +61847,7 @@
}
ts.updateTupleTypeNode = updateTupleTypeNode;
function createOptionalTypeNode(type) {
- var node = createSynthesizedNode(171 /* OptionalType */);
+ var node = createSynthesizedNode(172 /* OptionalType */);
node.type = ts.parenthesizeArrayTypeMember(type);
return node;
}
@@ -60976,7 +61859,7 @@
}
ts.updateOptionalTypeNode = updateOptionalTypeNode;
function createRestTypeNode(type) {
- var node = createSynthesizedNode(172 /* RestType */);
+ var node = createSynthesizedNode(173 /* RestType */);
node.type = type;
return node;
}
@@ -60988,7 +61871,7 @@
}
ts.updateRestTypeNode = updateRestTypeNode;
function createUnionTypeNode(types) {
- return createUnionOrIntersectionTypeNode(173 /* UnionType */, types);
+ return createUnionOrIntersectionTypeNode(174 /* UnionType */, types);
}
ts.createUnionTypeNode = createUnionTypeNode;
function updateUnionTypeNode(node, types) {
@@ -60996,7 +61879,7 @@
}
ts.updateUnionTypeNode = updateUnionTypeNode;
function createIntersectionTypeNode(types) {
- return createUnionOrIntersectionTypeNode(174 /* IntersectionType */, types);
+ return createUnionOrIntersectionTypeNode(175 /* IntersectionType */, types);
}
ts.createIntersectionTypeNode = createIntersectionTypeNode;
function updateIntersectionTypeNode(node, types) {
@@ -61015,7 +61898,7 @@
: node;
}
function createConditionalTypeNode(checkType, extendsType, trueType, falseType) {
- var node = createSynthesizedNode(175 /* ConditionalType */);
+ var node = createSynthesizedNode(176 /* ConditionalType */);
node.checkType = ts.parenthesizeConditionalTypeMember(checkType);
node.extendsType = ts.parenthesizeConditionalTypeMember(extendsType);
node.trueType = trueType;
@@ -61033,7 +61916,7 @@
}
ts.updateConditionalTypeNode = updateConditionalTypeNode;
function createInferTypeNode(typeParameter) {
- var node = createSynthesizedNode(176 /* InferType */);
+ var node = createSynthesizedNode(177 /* InferType */);
node.typeParameter = typeParameter;
return node;
}
@@ -61045,10 +61928,10 @@
}
ts.updateInferTypeNode = updateInferTypeNode;
function createImportTypeNode(argument, qualifier, typeArguments, isTypeOf) {
- var node = createSynthesizedNode(183 /* ImportType */);
+ var node = createSynthesizedNode(184 /* ImportType */);
node.argument = argument;
node.qualifier = qualifier;
- node.typeArguments = asNodeArray(typeArguments);
+ node.typeArguments = ts.parenthesizeTypeParameters(typeArguments);
node.isTypeOf = isTypeOf;
return node;
}
@@ -61063,7 +61946,7 @@
}
ts.updateImportTypeNode = updateImportTypeNode;
function createParenthesizedType(type) {
- var node = createSynthesizedNode(177 /* ParenthesizedType */);
+ var node = createSynthesizedNode(178 /* ParenthesizedType */);
node.type = type;
return node;
}
@@ -61075,12 +61958,12 @@
}
ts.updateParenthesizedType = updateParenthesizedType;
function createThisTypeNode() {
- return createSynthesizedNode(178 /* ThisType */);
+ return createSynthesizedNode(179 /* ThisType */);
}
ts.createThisTypeNode = createThisTypeNode;
function createTypeOperatorNode(operatorOrType, type) {
- var node = createSynthesizedNode(179 /* TypeOperator */);
- node.operator = typeof operatorOrType === "number" ? operatorOrType : 129 /* KeyOfKeyword */;
+ var node = createSynthesizedNode(180 /* TypeOperator */);
+ node.operator = typeof operatorOrType === "number" ? operatorOrType : 130 /* KeyOfKeyword */;
node.type = ts.parenthesizeElementTypeMember(typeof operatorOrType === "number" ? type : operatorOrType);
return node;
}
@@ -61090,7 +61973,7 @@
}
ts.updateTypeOperatorNode = updateTypeOperatorNode;
function createIndexedAccessTypeNode(objectType, indexType) {
- var node = createSynthesizedNode(180 /* IndexedAccessType */);
+ var node = createSynthesizedNode(181 /* IndexedAccessType */);
node.objectType = ts.parenthesizeElementTypeMember(objectType);
node.indexType = indexType;
return node;
@@ -61104,7 +61987,7 @@
}
ts.updateIndexedAccessTypeNode = updateIndexedAccessTypeNode;
function createMappedTypeNode(readonlyToken, typeParameter, questionToken, type) {
- var node = createSynthesizedNode(181 /* MappedType */);
+ var node = createSynthesizedNode(182 /* MappedType */);
node.readonlyToken = readonlyToken;
node.typeParameter = typeParameter;
node.questionToken = questionToken;
@@ -61122,7 +62005,7 @@
}
ts.updateMappedTypeNode = updateMappedTypeNode;
function createLiteralTypeNode(literal) {
- var node = createSynthesizedNode(182 /* LiteralType */);
+ var node = createSynthesizedNode(183 /* LiteralType */);
node.literal = literal;
return node;
}
@@ -61135,7 +62018,7 @@
ts.updateLiteralTypeNode = updateLiteralTypeNode;
// Binding Patterns
function createObjectBindingPattern(elements) {
- var node = createSynthesizedNode(184 /* ObjectBindingPattern */);
+ var node = createSynthesizedNode(185 /* ObjectBindingPattern */);
node.elements = createNodeArray(elements);
return node;
}
@@ -61147,7 +62030,7 @@
}
ts.updateObjectBindingPattern = updateObjectBindingPattern;
function createArrayBindingPattern(elements) {
- var node = createSynthesizedNode(185 /* ArrayBindingPattern */);
+ var node = createSynthesizedNode(186 /* ArrayBindingPattern */);
node.elements = createNodeArray(elements);
return node;
}
@@ -61159,7 +62042,7 @@
}
ts.updateArrayBindingPattern = updateArrayBindingPattern;
function createBindingElement(dotDotDotToken, propertyName, name, initializer) {
- var node = createSynthesizedNode(186 /* BindingElement */);
+ var node = createSynthesizedNode(187 /* BindingElement */);
node.dotDotDotToken = dotDotDotToken;
node.propertyName = asName(propertyName);
node.name = asName(name);
@@ -61178,7 +62061,7 @@
ts.updateBindingElement = updateBindingElement;
// Expression
function createArrayLiteral(elements, multiLine) {
- var node = createSynthesizedNode(187 /* ArrayLiteralExpression */);
+ var node = createSynthesizedNode(188 /* ArrayLiteralExpression */);
node.elements = ts.parenthesizeListElements(createNodeArray(elements));
if (multiLine)
node.multiLine = true;
@@ -61192,7 +62075,7 @@
}
ts.updateArrayLiteral = updateArrayLiteral;
function createObjectLiteral(properties, multiLine) {
- var node = createSynthesizedNode(188 /* ObjectLiteralExpression */);
+ var node = createSynthesizedNode(189 /* ObjectLiteralExpression */);
node.properties = createNodeArray(properties);
if (multiLine)
node.multiLine = true;
@@ -61206,9 +62089,9 @@
}
ts.updateObjectLiteral = updateObjectLiteral;
function createPropertyAccess(expression, name) {
- var node = createSynthesizedNode(189 /* PropertyAccessExpression */);
+ var node = createSynthesizedNode(190 /* PropertyAccessExpression */);
node.expression = ts.parenthesizeForAccess(expression);
- node.name = asName(name); // TODO: GH#18217
+ node.name = asName(name);
setEmitFlags(node, 131072 /* NoIndentation */);
return node;
}
@@ -61223,7 +62106,7 @@
}
ts.updatePropertyAccess = updatePropertyAccess;
function createElementAccess(expression, index) {
- var node = createSynthesizedNode(190 /* ElementAccessExpression */);
+ var node = createSynthesizedNode(191 /* ElementAccessExpression */);
node.expression = ts.parenthesizeForAccess(expression);
node.argumentExpression = asExpression(index);
return node;
@@ -61237,7 +62120,7 @@
}
ts.updateElementAccess = updateElementAccess;
function createCall(expression, typeArguments, argumentsArray) {
- var node = createSynthesizedNode(191 /* CallExpression */);
+ var node = createSynthesizedNode(192 /* CallExpression */);
node.expression = ts.parenthesizeForAccess(expression);
node.typeArguments = asNodeArray(typeArguments);
node.arguments = ts.parenthesizeListElements(createNodeArray(argumentsArray));
@@ -61253,7 +62136,7 @@
}
ts.updateCall = updateCall;
function createNew(expression, typeArguments, argumentsArray) {
- var node = createSynthesizedNode(192 /* NewExpression */);
+ var node = createSynthesizedNode(193 /* NewExpression */);
node.expression = ts.parenthesizeForNew(expression);
node.typeArguments = asNodeArray(typeArguments);
node.arguments = argumentsArray ? ts.parenthesizeListElements(createNodeArray(argumentsArray)) : undefined;
@@ -61269,7 +62152,7 @@
}
ts.updateNew = updateNew;
function createTaggedTemplate(tag, typeArgumentsOrTemplate, template) {
- var node = createSynthesizedNode(193 /* TaggedTemplateExpression */);
+ var node = createSynthesizedNode(194 /* TaggedTemplateExpression */);
node.tag = ts.parenthesizeForAccess(tag);
if (template) {
node.typeArguments = asNodeArray(typeArgumentsOrTemplate);
@@ -61292,7 +62175,7 @@
}
ts.updateTaggedTemplate = updateTaggedTemplate;
function createTypeAssertion(type, expression) {
- var node = createSynthesizedNode(194 /* TypeAssertionExpression */);
+ var node = createSynthesizedNode(195 /* TypeAssertionExpression */);
node.type = type;
node.expression = ts.parenthesizePrefixOperand(expression);
return node;
@@ -61306,7 +62189,7 @@
}
ts.updateTypeAssertion = updateTypeAssertion;
function createParen(expression) {
- var node = createSynthesizedNode(195 /* ParenthesizedExpression */);
+ var node = createSynthesizedNode(196 /* ParenthesizedExpression */);
node.expression = expression;
return node;
}
@@ -61318,7 +62201,7 @@
}
ts.updateParen = updateParen;
function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body) {
- var node = createSynthesizedNode(196 /* FunctionExpression */);
+ var node = createSynthesizedNode(197 /* FunctionExpression */);
node.modifiers = asNodeArray(modifiers);
node.asteriskToken = asteriskToken;
node.name = asName(name);
@@ -61342,7 +62225,7 @@
}
ts.updateFunctionExpression = updateFunctionExpression;
function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) {
- var node = createSynthesizedNode(197 /* ArrowFunction */);
+ var node = createSynthesizedNode(198 /* ArrowFunction */);
node.modifiers = asNodeArray(modifiers);
node.typeParameters = asNodeArray(typeParameters);
node.parameters = createNodeArray(parameters);
@@ -61364,7 +62247,7 @@
}
ts.updateArrowFunction = updateArrowFunction;
function createDelete(expression) {
- var node = createSynthesizedNode(198 /* DeleteExpression */);
+ var node = createSynthesizedNode(199 /* DeleteExpression */);
node.expression = ts.parenthesizePrefixOperand(expression);
return node;
}
@@ -61376,7 +62259,7 @@
}
ts.updateDelete = updateDelete;
function createTypeOf(expression) {
- var node = createSynthesizedNode(199 /* TypeOfExpression */);
+ var node = createSynthesizedNode(200 /* TypeOfExpression */);
node.expression = ts.parenthesizePrefixOperand(expression);
return node;
}
@@ -61388,7 +62271,7 @@
}
ts.updateTypeOf = updateTypeOf;
function createVoid(expression) {
- var node = createSynthesizedNode(200 /* VoidExpression */);
+ var node = createSynthesizedNode(201 /* VoidExpression */);
node.expression = ts.parenthesizePrefixOperand(expression);
return node;
}
@@ -61400,7 +62283,7 @@
}
ts.updateVoid = updateVoid;
function createAwait(expression) {
- var node = createSynthesizedNode(201 /* AwaitExpression */);
+ var node = createSynthesizedNode(202 /* AwaitExpression */);
node.expression = ts.parenthesizePrefixOperand(expression);
return node;
}
@@ -61412,7 +62295,7 @@
}
ts.updateAwait = updateAwait;
function createPrefix(operator, operand) {
- var node = createSynthesizedNode(202 /* PrefixUnaryExpression */);
+ var node = createSynthesizedNode(203 /* PrefixUnaryExpression */);
node.operator = operator;
node.operand = ts.parenthesizePrefixOperand(operand);
return node;
@@ -61425,7 +62308,7 @@
}
ts.updatePrefix = updatePrefix;
function createPostfix(operand, operator) {
- var node = createSynthesizedNode(203 /* PostfixUnaryExpression */);
+ var node = createSynthesizedNode(204 /* PostfixUnaryExpression */);
node.operand = ts.parenthesizePostfixOperand(operand);
node.operator = operator;
return node;
@@ -61438,7 +62321,7 @@
}
ts.updatePostfix = updatePostfix;
function createBinary(left, operator, right) {
- var node = createSynthesizedNode(204 /* BinaryExpression */);
+ var node = createSynthesizedNode(205 /* BinaryExpression */);
var operatorToken = asToken(operator);
var operatorKind = operatorToken.kind;
node.left = ts.parenthesizeBinaryOperand(operatorKind, left, /*isLeftSideOfBinary*/ true, /*leftOperand*/ undefined);
@@ -61455,7 +62338,7 @@
}
ts.updateBinary = updateBinary;
function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonToken, whenFalse) {
- var node = createSynthesizedNode(205 /* ConditionalExpression */);
+ var node = createSynthesizedNode(206 /* ConditionalExpression */);
node.condition = ts.parenthesizeForConditionalHead(condition);
node.questionToken = whenFalse ? questionTokenOrWhenTrue : createToken(56 /* QuestionToken */);
node.whenTrue = ts.parenthesizeSubexpressionOfConditionalExpression(whenFalse ? whenTrueOrWhenFalse : questionTokenOrWhenTrue);
@@ -61475,7 +62358,7 @@
}
ts.updateConditional = updateConditional;
function createTemplateExpression(head, templateSpans) {
- var node = createSynthesizedNode(206 /* TemplateExpression */);
+ var node = createSynthesizedNode(207 /* TemplateExpression */);
node.head = head;
node.templateSpans = createNodeArray(templateSpans);
return node;
@@ -61513,7 +62396,7 @@
}
ts.createNoSubstitutionTemplateLiteral = createNoSubstitutionTemplateLiteral;
function createYield(asteriskTokenOrExpression, expression) {
- var node = createSynthesizedNode(207 /* YieldExpression */);
+ var node = createSynthesizedNode(208 /* YieldExpression */);
node.asteriskToken = asteriskTokenOrExpression && asteriskTokenOrExpression.kind === 40 /* AsteriskToken */ ? asteriskTokenOrExpression : undefined;
node.expression = asteriskTokenOrExpression && asteriskTokenOrExpression.kind !== 40 /* AsteriskToken */ ? asteriskTokenOrExpression : expression;
return node;
@@ -61527,7 +62410,7 @@
}
ts.updateYield = updateYield;
function createSpread(expression) {
- var node = createSynthesizedNode(208 /* SpreadElement */);
+ var node = createSynthesizedNode(209 /* SpreadElement */);
node.expression = ts.parenthesizeExpressionForList(expression);
return node;
}
@@ -61539,7 +62422,7 @@
}
ts.updateSpread = updateSpread;
function createClassExpression(modifiers, name, typeParameters, heritageClauses, members) {
- var node = createSynthesizedNode(209 /* ClassExpression */);
+ var node = createSynthesizedNode(210 /* ClassExpression */);
node.decorators = undefined;
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -61560,11 +62443,11 @@
}
ts.updateClassExpression = updateClassExpression;
function createOmittedExpression() {
- return createSynthesizedNode(210 /* OmittedExpression */);
+ return createSynthesizedNode(211 /* OmittedExpression */);
}
ts.createOmittedExpression = createOmittedExpression;
function createExpressionWithTypeArguments(typeArguments, expression) {
- var node = createSynthesizedNode(211 /* ExpressionWithTypeArguments */);
+ var node = createSynthesizedNode(212 /* ExpressionWithTypeArguments */);
node.expression = ts.parenthesizeForAccess(expression);
node.typeArguments = asNodeArray(typeArguments);
return node;
@@ -61578,7 +62461,7 @@
}
ts.updateExpressionWithTypeArguments = updateExpressionWithTypeArguments;
function createAsExpression(expression, type) {
- var node = createSynthesizedNode(212 /* AsExpression */);
+ var node = createSynthesizedNode(213 /* AsExpression */);
node.expression = expression;
node.type = type;
return node;
@@ -61592,7 +62475,7 @@
}
ts.updateAsExpression = updateAsExpression;
function createNonNullExpression(expression) {
- var node = createSynthesizedNode(213 /* NonNullExpression */);
+ var node = createSynthesizedNode(214 /* NonNullExpression */);
node.expression = ts.parenthesizeForAccess(expression);
return node;
}
@@ -61604,7 +62487,7 @@
}
ts.updateNonNullExpression = updateNonNullExpression;
function createMetaProperty(keywordToken, name) {
- var node = createSynthesizedNode(214 /* MetaProperty */);
+ var node = createSynthesizedNode(215 /* MetaProperty */);
node.keywordToken = keywordToken;
node.name = name;
return node;
@@ -61618,7 +62501,7 @@
ts.updateMetaProperty = updateMetaProperty;
// Misc
function createTemplateSpan(expression, literal) {
- var node = createSynthesizedNode(216 /* TemplateSpan */);
+ var node = createSynthesizedNode(217 /* TemplateSpan */);
node.expression = expression;
node.literal = literal;
return node;
@@ -61632,12 +62515,12 @@
}
ts.updateTemplateSpan = updateTemplateSpan;
function createSemicolonClassElement() {
- return createSynthesizedNode(217 /* SemicolonClassElement */);
+ return createSynthesizedNode(218 /* SemicolonClassElement */);
}
ts.createSemicolonClassElement = createSemicolonClassElement;
// Element
function createBlock(statements, multiLine) {
- var block = createSynthesizedNode(218 /* Block */);
+ var block = createSynthesizedNode(219 /* Block */);
block.statements = createNodeArray(statements);
if (multiLine)
block.multiLine = multiLine;
@@ -61651,7 +62534,7 @@
}
ts.updateBlock = updateBlock;
function createVariableStatement(modifiers, declarationList) {
- var node = createSynthesizedNode(219 /* VariableStatement */);
+ var node = createSynthesizedNode(220 /* VariableStatement */);
node.decorators = undefined;
node.modifiers = asNodeArray(modifiers);
node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList;
@@ -61666,11 +62549,11 @@
}
ts.updateVariableStatement = updateVariableStatement;
function createEmptyStatement() {
- return createSynthesizedNode(220 /* EmptyStatement */);
+ return createSynthesizedNode(221 /* EmptyStatement */);
}
ts.createEmptyStatement = createEmptyStatement;
function createExpressionStatement(expression) {
- var node = createSynthesizedNode(221 /* ExpressionStatement */);
+ var node = createSynthesizedNode(222 /* ExpressionStatement */);
node.expression = ts.parenthesizeExpressionForExpressionStatement(expression);
return node;
}
@@ -61686,7 +62569,7 @@
/** @deprecated Use `updateExpressionStatement` instead. */
ts.updateStatement = updateExpressionStatement;
function createIf(expression, thenStatement, elseStatement) {
- var node = createSynthesizedNode(222 /* IfStatement */);
+ var node = createSynthesizedNode(223 /* IfStatement */);
node.expression = expression;
node.thenStatement = thenStatement;
node.elseStatement = elseStatement;
@@ -61702,7 +62585,7 @@
}
ts.updateIf = updateIf;
function createDo(statement, expression) {
- var node = createSynthesizedNode(223 /* DoStatement */);
+ var node = createSynthesizedNode(224 /* DoStatement */);
node.statement = statement;
node.expression = expression;
return node;
@@ -61716,7 +62599,7 @@
}
ts.updateDo = updateDo;
function createWhile(expression, statement) {
- var node = createSynthesizedNode(224 /* WhileStatement */);
+ var node = createSynthesizedNode(225 /* WhileStatement */);
node.expression = expression;
node.statement = statement;
return node;
@@ -61730,7 +62613,7 @@
}
ts.updateWhile = updateWhile;
function createFor(initializer, condition, incrementor, statement) {
- var node = createSynthesizedNode(225 /* ForStatement */);
+ var node = createSynthesizedNode(226 /* ForStatement */);
node.initializer = initializer;
node.condition = condition;
node.incrementor = incrementor;
@@ -61748,7 +62631,7 @@
}
ts.updateFor = updateFor;
function createForIn(initializer, expression, statement) {
- var node = createSynthesizedNode(226 /* ForInStatement */);
+ var node = createSynthesizedNode(227 /* ForInStatement */);
node.initializer = initializer;
node.expression = expression;
node.statement = statement;
@@ -61764,7 +62647,7 @@
}
ts.updateForIn = updateForIn;
function createForOf(awaitModifier, initializer, expression, statement) {
- var node = createSynthesizedNode(227 /* ForOfStatement */);
+ var node = createSynthesizedNode(228 /* ForOfStatement */);
node.awaitModifier = awaitModifier;
node.initializer = initializer;
node.expression = expression;
@@ -61782,7 +62665,7 @@
}
ts.updateForOf = updateForOf;
function createContinue(label) {
- var node = createSynthesizedNode(228 /* ContinueStatement */);
+ var node = createSynthesizedNode(229 /* ContinueStatement */);
node.label = asName(label);
return node;
}
@@ -61794,7 +62677,7 @@
}
ts.updateContinue = updateContinue;
function createBreak(label) {
- var node = createSynthesizedNode(229 /* BreakStatement */);
+ var node = createSynthesizedNode(230 /* BreakStatement */);
node.label = asName(label);
return node;
}
@@ -61806,7 +62689,7 @@
}
ts.updateBreak = updateBreak;
function createReturn(expression) {
- var node = createSynthesizedNode(230 /* ReturnStatement */);
+ var node = createSynthesizedNode(231 /* ReturnStatement */);
node.expression = expression;
return node;
}
@@ -61818,7 +62701,7 @@
}
ts.updateReturn = updateReturn;
function createWith(expression, statement) {
- var node = createSynthesizedNode(231 /* WithStatement */);
+ var node = createSynthesizedNode(232 /* WithStatement */);
node.expression = expression;
node.statement = statement;
return node;
@@ -61832,7 +62715,7 @@
}
ts.updateWith = updateWith;
function createSwitch(expression, caseBlock) {
- var node = createSynthesizedNode(232 /* SwitchStatement */);
+ var node = createSynthesizedNode(233 /* SwitchStatement */);
node.expression = ts.parenthesizeExpressionForList(expression);
node.caseBlock = caseBlock;
return node;
@@ -61846,7 +62729,7 @@
}
ts.updateSwitch = updateSwitch;
function createLabel(label, statement) {
- var node = createSynthesizedNode(233 /* LabeledStatement */);
+ var node = createSynthesizedNode(234 /* LabeledStatement */);
node.label = asName(label);
node.statement = statement;
return node;
@@ -61860,7 +62743,7 @@
}
ts.updateLabel = updateLabel;
function createThrow(expression) {
- var node = createSynthesizedNode(234 /* ThrowStatement */);
+ var node = createSynthesizedNode(235 /* ThrowStatement */);
node.expression = expression;
return node;
}
@@ -61872,7 +62755,7 @@
}
ts.updateThrow = updateThrow;
function createTry(tryBlock, catchClause, finallyBlock) {
- var node = createSynthesizedNode(235 /* TryStatement */);
+ var node = createSynthesizedNode(236 /* TryStatement */);
node.tryBlock = tryBlock;
node.catchClause = catchClause;
node.finallyBlock = finallyBlock;
@@ -61888,11 +62771,11 @@
}
ts.updateTry = updateTry;
function createDebuggerStatement() {
- return createSynthesizedNode(236 /* DebuggerStatement */);
+ return createSynthesizedNode(237 /* DebuggerStatement */);
}
ts.createDebuggerStatement = createDebuggerStatement;
function createVariableDeclaration(name, type, initializer) {
- var node = createSynthesizedNode(237 /* VariableDeclaration */);
+ var node = createSynthesizedNode(238 /* VariableDeclaration */);
node.name = asName(name);
node.type = type;
node.initializer = initializer !== undefined ? ts.parenthesizeExpressionForList(initializer) : undefined;
@@ -61909,7 +62792,7 @@
ts.updateVariableDeclaration = updateVariableDeclaration;
function createVariableDeclarationList(declarations, flags) {
if (flags === void 0) { flags = 0 /* None */; }
- var node = createSynthesizedNode(238 /* VariableDeclarationList */);
+ var node = createSynthesizedNode(239 /* VariableDeclarationList */);
node.flags |= flags & 3 /* BlockScoped */;
node.declarations = createNodeArray(declarations);
return node;
@@ -61922,7 +62805,7 @@
}
ts.updateVariableDeclarationList = updateVariableDeclarationList;
function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body) {
- var node = createSynthesizedNode(239 /* FunctionDeclaration */);
+ var node = createSynthesizedNode(240 /* FunctionDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.asteriskToken = asteriskToken;
@@ -61948,7 +62831,7 @@
}
ts.updateFunctionDeclaration = updateFunctionDeclaration;
function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members) {
- var node = createSynthesizedNode(240 /* ClassDeclaration */);
+ var node = createSynthesizedNode(241 /* ClassDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -61970,7 +62853,7 @@
}
ts.updateClassDeclaration = updateClassDeclaration;
function createInterfaceDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members) {
- var node = createSynthesizedNode(241 /* InterfaceDeclaration */);
+ var node = createSynthesizedNode(242 /* InterfaceDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -61992,7 +62875,7 @@
}
ts.updateInterfaceDeclaration = updateInterfaceDeclaration;
function createTypeAliasDeclaration(decorators, modifiers, name, typeParameters, type) {
- var node = createSynthesizedNode(242 /* TypeAliasDeclaration */);
+ var node = createSynthesizedNode(243 /* TypeAliasDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -62012,7 +62895,7 @@
}
ts.updateTypeAliasDeclaration = updateTypeAliasDeclaration;
function createEnumDeclaration(decorators, modifiers, name, members) {
- var node = createSynthesizedNode(243 /* EnumDeclaration */);
+ var node = createSynthesizedNode(244 /* EnumDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -62031,7 +62914,7 @@
ts.updateEnumDeclaration = updateEnumDeclaration;
function createModuleDeclaration(decorators, modifiers, name, body, flags) {
if (flags === void 0) { flags = 0 /* None */; }
- var node = createSynthesizedNode(244 /* ModuleDeclaration */);
+ var node = createSynthesizedNode(245 /* ModuleDeclaration */);
node.flags |= flags & (16 /* Namespace */ | 4 /* NestedNamespace */ | 512 /* GlobalAugmentation */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
@@ -62050,7 +62933,7 @@
}
ts.updateModuleDeclaration = updateModuleDeclaration;
function createModuleBlock(statements) {
- var node = createSynthesizedNode(245 /* ModuleBlock */);
+ var node = createSynthesizedNode(246 /* ModuleBlock */);
node.statements = createNodeArray(statements);
return node;
}
@@ -62062,7 +62945,7 @@
}
ts.updateModuleBlock = updateModuleBlock;
function createCaseBlock(clauses) {
- var node = createSynthesizedNode(246 /* CaseBlock */);
+ var node = createSynthesizedNode(247 /* CaseBlock */);
node.clauses = createNodeArray(clauses);
return node;
}
@@ -62074,7 +62957,7 @@
}
ts.updateCaseBlock = updateCaseBlock;
function createNamespaceExportDeclaration(name) {
- var node = createSynthesizedNode(247 /* NamespaceExportDeclaration */);
+ var node = createSynthesizedNode(248 /* NamespaceExportDeclaration */);
node.name = asName(name);
return node;
}
@@ -62086,7 +62969,7 @@
}
ts.updateNamespaceExportDeclaration = updateNamespaceExportDeclaration;
function createImportEqualsDeclaration(decorators, modifiers, name, moduleReference) {
- var node = createSynthesizedNode(248 /* ImportEqualsDeclaration */);
+ var node = createSynthesizedNode(249 /* ImportEqualsDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -62104,7 +62987,7 @@
}
ts.updateImportEqualsDeclaration = updateImportEqualsDeclaration;
function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier) {
- var node = createSynthesizedNode(249 /* ImportDeclaration */);
+ var node = createSynthesizedNode(250 /* ImportDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.importClause = importClause;
@@ -62122,7 +63005,7 @@
}
ts.updateImportDeclaration = updateImportDeclaration;
function createImportClause(name, namedBindings) {
- var node = createSynthesizedNode(250 /* ImportClause */);
+ var node = createSynthesizedNode(251 /* ImportClause */);
node.name = name;
node.namedBindings = namedBindings;
return node;
@@ -62136,7 +63019,7 @@
}
ts.updateImportClause = updateImportClause;
function createNamespaceImport(name) {
- var node = createSynthesizedNode(251 /* NamespaceImport */);
+ var node = createSynthesizedNode(252 /* NamespaceImport */);
node.name = name;
return node;
}
@@ -62148,7 +63031,7 @@
}
ts.updateNamespaceImport = updateNamespaceImport;
function createNamedImports(elements) {
- var node = createSynthesizedNode(252 /* NamedImports */);
+ var node = createSynthesizedNode(253 /* NamedImports */);
node.elements = createNodeArray(elements);
return node;
}
@@ -62160,7 +63043,7 @@
}
ts.updateNamedImports = updateNamedImports;
function createImportSpecifier(propertyName, name) {
- var node = createSynthesizedNode(253 /* ImportSpecifier */);
+ var node = createSynthesizedNode(254 /* ImportSpecifier */);
node.propertyName = propertyName;
node.name = name;
return node;
@@ -62174,11 +63057,11 @@
}
ts.updateImportSpecifier = updateImportSpecifier;
function createExportAssignment(decorators, modifiers, isExportEquals, expression) {
- var node = createSynthesizedNode(254 /* ExportAssignment */);
+ var node = createSynthesizedNode(255 /* ExportAssignment */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.isExportEquals = isExportEquals;
- node.expression = isExportEquals ? ts.parenthesizeBinaryOperand(59 /* EqualsToken */, expression, /*isLeftSideOfBinary*/ false, /*leftOperand*/ undefined) : ts.parenthesizeDefaultExpression(expression);
+ node.expression = isExportEquals ? ts.parenthesizeBinaryOperand(60 /* EqualsToken */, expression, /*isLeftSideOfBinary*/ false, /*leftOperand*/ undefined) : ts.parenthesizeDefaultExpression(expression);
return node;
}
ts.createExportAssignment = createExportAssignment;
@@ -62191,7 +63074,7 @@
}
ts.updateExportAssignment = updateExportAssignment;
function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier) {
- var node = createSynthesizedNode(255 /* ExportDeclaration */);
+ var node = createSynthesizedNode(256 /* ExportDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.exportClause = exportClause;
@@ -62209,7 +63092,7 @@
}
ts.updateExportDeclaration = updateExportDeclaration;
function createNamedExports(elements) {
- var node = createSynthesizedNode(256 /* NamedExports */);
+ var node = createSynthesizedNode(257 /* NamedExports */);
node.elements = createNodeArray(elements);
return node;
}
@@ -62221,7 +63104,7 @@
}
ts.updateNamedExports = updateNamedExports;
function createExportSpecifier(propertyName, name) {
- var node = createSynthesizedNode(257 /* ExportSpecifier */);
+ var node = createSynthesizedNode(258 /* ExportSpecifier */);
node.propertyName = asName(propertyName);
node.name = asName(name);
return node;
@@ -62236,7 +63119,7 @@
ts.updateExportSpecifier = updateExportSpecifier;
// Module references
function createExternalModuleReference(expression) {
- var node = createSynthesizedNode(259 /* ExternalModuleReference */);
+ var node = createSynthesizedNode(260 /* ExternalModuleReference */);
node.expression = expression;
return node;
}
@@ -62250,14 +63133,14 @@
// JSDoc
/* @internal */
function createJSDocTypeExpression(type) {
- var node = createSynthesizedNode(288 /* JSDocTypeExpression */);
+ var node = createSynthesizedNode(289 /* JSDocTypeExpression */);
node.type = type;
return node;
}
ts.createJSDocTypeExpression = createJSDocTypeExpression;
/* @internal */
function createJSDocTypeTag(typeExpression, comment) {
- var tag = createJSDocTag(307 /* JSDocTypeTag */, "type");
+ var tag = createJSDocTag(308 /* JSDocTypeTag */, "type");
tag.typeExpression = typeExpression;
tag.comment = comment;
return tag;
@@ -62265,7 +63148,7 @@
ts.createJSDocTypeTag = createJSDocTypeTag;
/* @internal */
function createJSDocReturnTag(typeExpression, comment) {
- var tag = createJSDocTag(305 /* JSDocReturnTag */, "returns");
+ var tag = createJSDocTag(306 /* JSDocReturnTag */, "returns");
tag.typeExpression = typeExpression;
tag.comment = comment;
return tag;
@@ -62273,7 +63156,7 @@
ts.createJSDocReturnTag = createJSDocReturnTag;
/* @internal */
function createJSDocParamTag(name, isBracketed, typeExpression, comment) {
- var tag = createJSDocTag(304 /* JSDocParameterTag */, "param");
+ var tag = createJSDocTag(305 /* JSDocParameterTag */, "param");
tag.typeExpression = typeExpression;
tag.name = name;
tag.isBracketed = isBracketed;
@@ -62283,7 +63166,7 @@
ts.createJSDocParamTag = createJSDocParamTag;
/* @internal */
function createJSDocComment(comment, tags) {
- var node = createSynthesizedNode(296 /* JSDocComment */);
+ var node = createSynthesizedNode(297 /* JSDocComment */);
node.comment = comment;
node.tags = tags;
return node;
@@ -62297,7 +63180,7 @@
}
// JSX
function createJsxElement(openingElement, children, closingElement) {
- var node = createSynthesizedNode(260 /* JsxElement */);
+ var node = createSynthesizedNode(261 /* JsxElement */);
node.openingElement = openingElement;
node.children = createNodeArray(children);
node.closingElement = closingElement;
@@ -62313,7 +63196,7 @@
}
ts.updateJsxElement = updateJsxElement;
function createJsxSelfClosingElement(tagName, typeArguments, attributes) {
- var node = createSynthesizedNode(261 /* JsxSelfClosingElement */);
+ var node = createSynthesizedNode(262 /* JsxSelfClosingElement */);
node.tagName = tagName;
node.typeArguments = asNodeArray(typeArguments);
node.attributes = attributes;
@@ -62329,7 +63212,7 @@
}
ts.updateJsxSelfClosingElement = updateJsxSelfClosingElement;
function createJsxOpeningElement(tagName, typeArguments, attributes) {
- var node = createSynthesizedNode(262 /* JsxOpeningElement */);
+ var node = createSynthesizedNode(263 /* JsxOpeningElement */);
node.tagName = tagName;
node.typeArguments = asNodeArray(typeArguments);
node.attributes = attributes;
@@ -62345,7 +63228,7 @@
}
ts.updateJsxOpeningElement = updateJsxOpeningElement;
function createJsxClosingElement(tagName) {
- var node = createSynthesizedNode(263 /* JsxClosingElement */);
+ var node = createSynthesizedNode(264 /* JsxClosingElement */);
node.tagName = tagName;
return node;
}
@@ -62357,7 +63240,7 @@
}
ts.updateJsxClosingElement = updateJsxClosingElement;
function createJsxFragment(openingFragment, children, closingFragment) {
- var node = createSynthesizedNode(264 /* JsxFragment */);
+ var node = createSynthesizedNode(265 /* JsxFragment */);
node.openingFragment = openingFragment;
node.children = createNodeArray(children);
node.closingFragment = closingFragment;
@@ -62379,11 +63262,11 @@
}
ts.updateJsxText = updateJsxText;
function createJsxOpeningFragment() {
- return createSynthesizedNode(265 /* JsxOpeningFragment */);
+ return createSynthesizedNode(266 /* JsxOpeningFragment */);
}
ts.createJsxOpeningFragment = createJsxOpeningFragment;
function createJsxJsxClosingFragment() {
- return createSynthesizedNode(266 /* JsxClosingFragment */);
+ return createSynthesizedNode(267 /* JsxClosingFragment */);
}
ts.createJsxJsxClosingFragment = createJsxJsxClosingFragment;
function updateJsxFragment(node, openingFragment, children, closingFragment) {
@@ -62395,7 +63278,7 @@
}
ts.updateJsxFragment = updateJsxFragment;
function createJsxAttribute(name, initializer) {
- var node = createSynthesizedNode(267 /* JsxAttribute */);
+ var node = createSynthesizedNode(268 /* JsxAttribute */);
node.name = name;
node.initializer = initializer;
return node;
@@ -62409,7 +63292,7 @@
}
ts.updateJsxAttribute = updateJsxAttribute;
function createJsxAttributes(properties) {
- var node = createSynthesizedNode(268 /* JsxAttributes */);
+ var node = createSynthesizedNode(269 /* JsxAttributes */);
node.properties = createNodeArray(properties);
return node;
}
@@ -62421,7 +63304,7 @@
}
ts.updateJsxAttributes = updateJsxAttributes;
function createJsxSpreadAttribute(expression) {
- var node = createSynthesizedNode(269 /* JsxSpreadAttribute */);
+ var node = createSynthesizedNode(270 /* JsxSpreadAttribute */);
node.expression = expression;
return node;
}
@@ -62433,7 +63316,7 @@
}
ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute;
function createJsxExpression(dotDotDotToken, expression) {
- var node = createSynthesizedNode(270 /* JsxExpression */);
+ var node = createSynthesizedNode(271 /* JsxExpression */);
node.dotDotDotToken = dotDotDotToken;
node.expression = expression;
return node;
@@ -62447,7 +63330,7 @@
ts.updateJsxExpression = updateJsxExpression;
// Clauses
function createCaseClause(expression, statements) {
- var node = createSynthesizedNode(271 /* CaseClause */);
+ var node = createSynthesizedNode(272 /* CaseClause */);
node.expression = ts.parenthesizeExpressionForList(expression);
node.statements = createNodeArray(statements);
return node;
@@ -62461,7 +63344,7 @@
}
ts.updateCaseClause = updateCaseClause;
function createDefaultClause(statements) {
- var node = createSynthesizedNode(272 /* DefaultClause */);
+ var node = createSynthesizedNode(273 /* DefaultClause */);
node.statements = createNodeArray(statements);
return node;
}
@@ -62473,7 +63356,7 @@
}
ts.updateDefaultClause = updateDefaultClause;
function createHeritageClause(token, types) {
- var node = createSynthesizedNode(273 /* HeritageClause */);
+ var node = createSynthesizedNode(274 /* HeritageClause */);
node.token = token;
node.types = createNodeArray(types);
return node;
@@ -62486,7 +63369,7 @@
}
ts.updateHeritageClause = updateHeritageClause;
function createCatchClause(variableDeclaration, block) {
- var node = createSynthesizedNode(274 /* CatchClause */);
+ var node = createSynthesizedNode(275 /* CatchClause */);
node.variableDeclaration = ts.isString(variableDeclaration) ? createVariableDeclaration(variableDeclaration) : variableDeclaration;
node.block = block;
return node;
@@ -62501,7 +63384,7 @@
ts.updateCatchClause = updateCatchClause;
// Property assignments
function createPropertyAssignment(name, initializer) {
- var node = createSynthesizedNode(275 /* PropertyAssignment */);
+ var node = createSynthesizedNode(276 /* PropertyAssignment */);
node.name = asName(name);
node.questionToken = undefined;
node.initializer = ts.parenthesizeExpressionForList(initializer);
@@ -62516,7 +63399,7 @@
}
ts.updatePropertyAssignment = updatePropertyAssignment;
function createShorthandPropertyAssignment(name, objectAssignmentInitializer) {
- var node = createSynthesizedNode(276 /* ShorthandPropertyAssignment */);
+ var node = createSynthesizedNode(277 /* ShorthandPropertyAssignment */);
node.name = asName(name);
node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? ts.parenthesizeExpressionForList(objectAssignmentInitializer) : undefined;
return node;
@@ -62530,8 +63413,8 @@
}
ts.updateShorthandPropertyAssignment = updateShorthandPropertyAssignment;
function createSpreadAssignment(expression) {
- var node = createSynthesizedNode(277 /* SpreadAssignment */);
- node.expression = expression !== undefined ? ts.parenthesizeExpressionForList(expression) : undefined; // TODO: GH#18217
+ var node = createSynthesizedNode(278 /* SpreadAssignment */);
+ node.expression = ts.parenthesizeExpressionForList(expression);
return node;
}
ts.createSpreadAssignment = createSpreadAssignment;
@@ -62543,7 +63426,7 @@
ts.updateSpreadAssignment = updateSpreadAssignment;
// Enum
function createEnumMember(name, initializer) {
- var node = createSynthesizedNode(278 /* EnumMember */);
+ var node = createSynthesizedNode(279 /* EnumMember */);
node.name = asName(name);
node.initializer = initializer && ts.parenthesizeExpressionForList(initializer);
return node;
@@ -62564,7 +63447,7 @@
(typeReferences !== undefined && node.typeReferenceDirectives !== typeReferences) ||
(libReferences !== undefined && node.libReferenceDirectives !== libReferences) ||
(hasNoDefaultLib !== undefined && node.hasNoDefaultLib !== hasNoDefaultLib)) {
- var updated = createSynthesizedNode(284 /* SourceFile */);
+ var updated = createSynthesizedNode(285 /* SourceFile */);
updated.flags |= node.flags;
updated.statements = createNodeArray(statements);
updated.endOfFileToken = node.endOfFileToken;
@@ -62648,7 +63531,7 @@
* @param original The original statement.
*/
function createNotEmittedStatement(original) {
- var node = createSynthesizedNode(312 /* NotEmittedStatement */);
+ var node = createSynthesizedNode(313 /* NotEmittedStatement */);
node.original = original;
setTextRange(node, original);
return node;
@@ -62660,7 +63543,7 @@
*/
/* @internal */
function createEndOfDeclarationMarker(original) {
- var node = createSynthesizedNode(316 /* EndOfDeclarationMarker */);
+ var node = createSynthesizedNode(317 /* EndOfDeclarationMarker */);
node.emitNode = {};
node.original = original;
return node;
@@ -62672,7 +63555,7 @@
*/
/* @internal */
function createMergeDeclarationMarker(original) {
- var node = createSynthesizedNode(315 /* MergeDeclarationMarker */);
+ var node = createSynthesizedNode(316 /* MergeDeclarationMarker */);
node.emitNode = {};
node.original = original;
return node;
@@ -62687,7 +63570,7 @@
* @param location The location for the expression. Defaults to the positions from "original" if provided.
*/
function createPartiallyEmittedExpression(expression, original) {
- var node = createSynthesizedNode(313 /* PartiallyEmittedExpression */);
+ var node = createSynthesizedNode(314 /* PartiallyEmittedExpression */);
node.expression = expression;
node.original = original;
setTextRange(node, original);
@@ -62703,7 +63586,7 @@
ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression;
function flattenCommaElements(node) {
if (ts.nodeIsSynthesized(node) && !ts.isParseTreeNode(node) && !node.original && !node.emitNode && !node.id) {
- if (node.kind === 314 /* CommaListExpression */) {
+ if (node.kind === 315 /* CommaListExpression */) {
return node.elements;
}
if (ts.isBinaryExpression(node) && node.operatorToken.kind === 27 /* CommaToken */) {
@@ -62713,7 +63596,7 @@
return node;
}
function createCommaList(elements) {
- var node = createSynthesizedNode(314 /* CommaListExpression */);
+ var node = createSynthesizedNode(315 /* CommaListExpression */);
node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements));
return node;
}
@@ -62726,7 +63609,7 @@
ts.updateCommaList = updateCommaList;
function createBundle(sourceFiles, prepends) {
if (prepends === void 0) { prepends = ts.emptyArray; }
- var node = ts.createNode(285 /* Bundle */);
+ var node = ts.createNode(286 /* Bundle */);
node.prepends = prepends;
node.sourceFiles = sourceFiles;
return node;
@@ -62756,7 +63639,7 @@
], function (helper) { return helper.name; }));
}
function createUnparsedSource() {
- var node = ts.createNode(286 /* UnparsedSource */);
+ var node = ts.createNode(287 /* UnparsedSource */);
node.prologues = ts.emptyArray;
node.referencedFiles = ts.emptyArray;
node.libReferenceDirectives = ts.emptyArray;
@@ -62888,10 +63771,10 @@
}
function mapBundleFileSectionKindToSyntaxKind(kind) {
switch (kind) {
- case "prologue" /* Prologue */: return 279 /* UnparsedPrologue */;
- case "prepend" /* Prepend */: return 280 /* UnparsedPrepend */;
- case "internal" /* Internal */: return 282 /* UnparsedInternalText */;
- case "text" /* Text */: return 281 /* UnparsedText */;
+ case "prologue" /* Prologue */: return 280 /* UnparsedPrologue */;
+ case "prepend" /* Prepend */: return 281 /* UnparsedPrepend */;
+ case "internal" /* Internal */: return 283 /* UnparsedInternalText */;
+ case "text" /* Text */: return 282 /* UnparsedText */;
case "emitHelpers" /* EmitHelpers */:
case "no-default-lib" /* NoDefaultLib */:
case "reference" /* Reference */:
@@ -62909,14 +63792,14 @@
return node;
}
function createUnparsedSyntheticReference(section, parent) {
- var node = ts.createNode(283 /* UnparsedSyntheticReference */, section.pos, section.end);
+ var node = ts.createNode(284 /* UnparsedSyntheticReference */, section.pos, section.end);
node.parent = parent;
node.data = section.data;
node.section = section;
return node;
}
function createInputFiles(javascriptTextOrReadFileText, declarationTextOrJavascriptPath, javascriptMapPath, javascriptMapTextOrDeclarationPath, declarationMapPath, declarationMapTextOrBuildInfoPath, javascriptPath, declarationPath, buildInfoPath, buildInfo, oldFileOfCurrentEmit) {
- var node = ts.createNode(287 /* InputFiles */);
+ var node = ts.createNode(288 /* InputFiles */);
if (!ts.isString(javascriptTextOrReadFileText)) {
var cache_1 = ts.createMap();
var textGetter_1 = function (path) {
@@ -63010,7 +63893,7 @@
}
ts.createLessThan = createLessThan;
function createAssignment(left, right) {
- return createBinary(left, 59 /* EqualsToken */, right);
+ return createBinary(left, 60 /* EqualsToken */, right);
}
ts.createAssignment = createAssignment;
function createStrictEquality(left, right) {
@@ -63103,7 +63986,7 @@
// To avoid holding onto transformation artifacts, we keep track of any
// parse tree node we are annotating. This allows us to clean them up after
// all transformations have completed.
- if (node.kind === 284 /* SourceFile */) {
+ if (node.kind === 285 /* SourceFile */) {
return node.emitNode = { annotatedNodes: [node] };
}
var sourceFile = ts.getSourceFileOfNode(ts.getParseTreeNode(ts.getSourceFileOfNode(node)));
@@ -63614,7 +64497,7 @@
if (!outermostLabeledStatement) {
return node;
}
- var updated = ts.updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 233 /* LabeledStatement */
+ var updated = ts.updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 234 /* LabeledStatement */
? restoreEnclosingLabel(node, outermostLabeledStatement.statement)
: node);
if (afterRestoreLabelCallback) {
@@ -63626,20 +64509,20 @@
function shouldBeCapturedInTempVariable(node, cacheIdentifiers) {
var target = ts.skipParentheses(node);
switch (target.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return cacheIdentifiers;
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
case 10 /* StringLiteral */:
return false;
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
var elements = target.elements;
if (elements.length === 0) {
return false;
}
return true;
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return target.properties.length > 0;
default:
return true;
@@ -63654,7 +64537,7 @@
thisArg = ts.createThis();
target = callee;
}
- else if (callee.kind === 98 /* SuperKeyword */) {
+ else if (callee.kind === 99 /* SuperKeyword */) {
thisArg = ts.createThis();
target = languageVersion < 2 /* ES2015 */
? ts.setTextRange(ts.createIdentifier("_super"), callee)
@@ -63666,7 +64549,7 @@
}
else {
switch (callee.kind) {
- case 189 /* PropertyAccessExpression */: {
+ case 190 /* PropertyAccessExpression */: {
if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) {
// for `a.b()` target is `(_a = a).b` and thisArg is `_a`
thisArg = ts.createTempVariable(recordTempVariable);
@@ -63679,7 +64562,7 @@
}
break;
}
- case 190 /* ElementAccessExpression */: {
+ case 191 /* ElementAccessExpression */: {
if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) {
// for `a[b]()` target is `(_a = a)[b]` and thisArg is `_a`
thisArg = ts.createTempVariable(recordTempVariable);
@@ -63736,14 +64619,14 @@
ts.createExpressionForPropertyName = createExpressionForPropertyName;
function createExpressionForObjectLiteralElementLike(node, property, receiver) {
switch (property.kind) {
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return createExpressionForAccessorDeclaration(node.properties, property, receiver, !!node.multiLine);
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return createExpressionForPropertyAssignment(property, receiver);
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return createExpressionForShorthandPropertyAssignment(property, receiver);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return createExpressionForMethodDeclaration(property, receiver);
}
}
@@ -63751,7 +64634,7 @@
function createExpressionForAccessorDeclaration(properties, property, receiver, multiLine) {
var _a = ts.getAllAccessorDeclarations(properties, property), firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor;
if (property === firstAccessor) {
- var properties_7 = [];
+ var properties_5 = [];
if (getAccessor) {
var getterFunction = ts.createFunctionExpression(getAccessor.modifiers,
/*asteriskToken*/ undefined,
@@ -63762,7 +64645,7 @@
ts.setTextRange(getterFunction, getAccessor);
ts.setOriginalNode(getterFunction, getAccessor);
var getter = ts.createPropertyAssignment("get", getterFunction);
- properties_7.push(getter);
+ properties_5.push(getter);
}
if (setAccessor) {
var setterFunction = ts.createFunctionExpression(setAccessor.modifiers,
@@ -63774,15 +64657,15 @@
ts.setTextRange(setterFunction, setAccessor);
ts.setOriginalNode(setterFunction, setAccessor);
var setter = ts.createPropertyAssignment("set", setterFunction);
- properties_7.push(setter);
+ properties_5.push(setter);
}
- properties_7.push(ts.createPropertyAssignment("enumerable", ts.createTrue()));
- properties_7.push(ts.createPropertyAssignment("configurable", ts.createTrue()));
+ properties_5.push(ts.createPropertyAssignment("enumerable", ts.createTrue()));
+ properties_5.push(ts.createPropertyAssignment("configurable", ts.createTrue()));
var expression = ts.setTextRange(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"),
/*typeArguments*/ undefined, [
receiver,
createExpressionForPropertyName(property.name),
- ts.createObjectLiteral(properties_7, multiLine)
+ ts.createObjectLiteral(properties_5, multiLine)
]),
/*location*/ firstAccessor);
return ts.aggregateTransformFlags(expression);
@@ -64069,7 +64952,7 @@
function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) {
var skipped = ts.skipPartiallyEmittedExpressions(operand);
// If the resulting expression is already parenthesized, we do not need to do any further processing.
- if (skipped.kind === 195 /* ParenthesizedExpression */) {
+ if (skipped.kind === 196 /* ParenthesizedExpression */) {
return operand;
}
return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand)
@@ -64103,10 +64986,10 @@
//
// If `a ** d` is on the left of operator `**`, we need to parenthesize to preserve
// the intended order of operations: `(a ** b) ** c`
- var binaryOperatorPrecedence = ts.getOperatorPrecedence(204 /* BinaryExpression */, binaryOperator);
- var binaryOperatorAssociativity = ts.getOperatorAssociativity(204 /* BinaryExpression */, binaryOperator);
+ var binaryOperatorPrecedence = ts.getOperatorPrecedence(205 /* BinaryExpression */, binaryOperator);
+ var binaryOperatorAssociativity = ts.getOperatorAssociativity(205 /* BinaryExpression */, binaryOperator);
var emittedOperand = ts.skipPartiallyEmittedExpressions(operand);
- if (!isLeftSideOfBinary && operand.kind === 197 /* ArrowFunction */ && binaryOperatorPrecedence > 4) {
+ if (!isLeftSideOfBinary && operand.kind === 198 /* ArrowFunction */ && binaryOperatorPrecedence > 4) {
// We need to parenthesize arrow functions on the right side to avoid it being
// parsed as parenthesized expression: `a && (() => {})`
return true;
@@ -64118,7 +65001,7 @@
// and is a yield expression, then we do not need parentheses.
if (!isLeftSideOfBinary
&& binaryOperatorAssociativity === 1 /* Right */
- && operand.kind === 207 /* YieldExpression */) {
+ && operand.kind === 208 /* YieldExpression */) {
return false;
}
return true;
@@ -64206,7 +65089,7 @@
if (ts.isLiteralKind(node.kind)) {
return node.kind;
}
- if (node.kind === 204 /* BinaryExpression */ && node.operatorToken.kind === 38 /* PlusToken */) {
+ if (node.kind === 205 /* BinaryExpression */ && node.operatorToken.kind === 38 /* PlusToken */) {
if (node.cachedLiteralKind !== undefined) {
return node.cachedLiteralKind;
}
@@ -64221,7 +65104,7 @@
return 0 /* Unknown */;
}
function parenthesizeForConditionalHead(condition) {
- var conditionalPrecedence = ts.getOperatorPrecedence(205 /* ConditionalExpression */, 56 /* QuestionToken */);
+ var conditionalPrecedence = ts.getOperatorPrecedence(206 /* ConditionalExpression */, 56 /* QuestionToken */);
var emittedCondition = ts.skipPartiallyEmittedExpressions(condition);
var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition);
if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1 /* LessThan */) {
@@ -64256,8 +65139,8 @@
var needsParens = isCommaSequence(check);
if (!needsParens) {
switch (getLeftmostExpression(check, /*stopAtCallExpression*/ false).kind) {
- case 209 /* ClassExpression */:
- case 196 /* FunctionExpression */:
+ case 210 /* ClassExpression */:
+ case 197 /* FunctionExpression */:
needsParens = true;
}
}
@@ -64273,9 +65156,9 @@
function parenthesizeForNew(expression) {
var leftmostExpr = getLeftmostExpression(expression, /*stopAtCallExpressions*/ true);
switch (leftmostExpr.kind) {
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return ts.createParen(expression);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return !leftmostExpr.arguments
? ts.createParen(expression)
: expression;
@@ -64298,7 +65181,7 @@
//
var emittedExpression = ts.skipPartiallyEmittedExpressions(expression);
if (ts.isLeftHandSideExpression(emittedExpression)
- && (emittedExpression.kind !== 192 /* NewExpression */ || emittedExpression.arguments)) {
+ && (emittedExpression.kind !== 193 /* NewExpression */ || emittedExpression.arguments)) {
return expression;
}
return ts.setTextRange(ts.createParen(expression), expression);
@@ -64336,7 +65219,7 @@
function parenthesizeExpressionForList(expression) {
var emittedExpression = ts.skipPartiallyEmittedExpressions(expression);
var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression);
- var commaPrecedence = ts.getOperatorPrecedence(204 /* BinaryExpression */, 27 /* CommaToken */);
+ var commaPrecedence = ts.getOperatorPrecedence(205 /* BinaryExpression */, 27 /* CommaToken */);
return expressionPrecedence > commaPrecedence
? expression
: ts.setTextRange(ts.createParen(expression), expression);
@@ -64347,29 +65230,29 @@
if (ts.isCallExpression(emittedExpression)) {
var callee = emittedExpression.expression;
var kind = ts.skipPartiallyEmittedExpressions(callee).kind;
- if (kind === 196 /* FunctionExpression */ || kind === 197 /* ArrowFunction */) {
+ if (kind === 197 /* FunctionExpression */ || kind === 198 /* ArrowFunction */) {
var mutableCall = ts.getMutableClone(emittedExpression);
mutableCall.expression = ts.setTextRange(ts.createParen(callee), callee);
return recreateOuterExpressions(expression, mutableCall, 4 /* PartiallyEmittedExpressions */);
}
}
var leftmostExpressionKind = getLeftmostExpression(emittedExpression, /*stopAtCallExpressions*/ false).kind;
- if (leftmostExpressionKind === 188 /* ObjectLiteralExpression */ || leftmostExpressionKind === 196 /* FunctionExpression */) {
+ if (leftmostExpressionKind === 189 /* ObjectLiteralExpression */ || leftmostExpressionKind === 197 /* FunctionExpression */) {
return ts.setTextRange(ts.createParen(expression), expression);
}
return expression;
}
ts.parenthesizeExpressionForExpressionStatement = parenthesizeExpressionForExpressionStatement;
function parenthesizeConditionalTypeMember(member) {
- return member.kind === 175 /* ConditionalType */ ? ts.createParenthesizedType(member) : member;
+ return member.kind === 176 /* ConditionalType */ ? ts.createParenthesizedType(member) : member;
}
ts.parenthesizeConditionalTypeMember = parenthesizeConditionalTypeMember;
function parenthesizeElementTypeMember(member) {
switch (member.kind) {
- case 173 /* UnionType */:
- case 174 /* IntersectionType */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
+ case 174 /* UnionType */:
+ case 175 /* IntersectionType */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
return ts.createParenthesizedType(member);
}
return parenthesizeConditionalTypeMember(member);
@@ -64377,9 +65260,9 @@
ts.parenthesizeElementTypeMember = parenthesizeElementTypeMember;
function parenthesizeArrayTypeMember(member) {
switch (member.kind) {
- case 167 /* TypeQuery */:
- case 179 /* TypeOperator */:
- case 176 /* InferType */:
+ case 168 /* TypeQuery */:
+ case 180 /* TypeOperator */:
+ case 177 /* InferType */:
return ts.createParenthesizedType(member);
}
return parenthesizeElementTypeMember(member);
@@ -64405,28 +65288,28 @@
function getLeftmostExpression(node, stopAtCallExpressions) {
while (true) {
switch (node.kind) {
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
node = node.operand;
continue;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
node = node.left;
continue;
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
node = node.condition;
continue;
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
node = node.tag;
continue;
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
if (stopAtCallExpressions) {
return node;
}
// falls through
- case 212 /* AsExpression */:
- case 190 /* ElementAccessExpression */:
- case 189 /* PropertyAccessExpression */:
- case 213 /* NonNullExpression */:
- case 313 /* PartiallyEmittedExpression */:
+ case 213 /* AsExpression */:
+ case 191 /* ElementAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 214 /* NonNullExpression */:
+ case 314 /* PartiallyEmittedExpression */:
node = node.expression;
continue;
}
@@ -64434,15 +65317,15 @@
}
}
function parenthesizeConciseBody(body) {
- if (!ts.isBlock(body) && (isCommaSequence(body) || getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 188 /* ObjectLiteralExpression */)) {
+ if (!ts.isBlock(body) && (isCommaSequence(body) || getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 189 /* ObjectLiteralExpression */)) {
return ts.setTextRange(ts.createParen(body), body);
}
return body;
}
ts.parenthesizeConciseBody = parenthesizeConciseBody;
function isCommaSequence(node) {
- return node.kind === 204 /* BinaryExpression */ && node.operatorToken.kind === 27 /* CommaToken */ ||
- node.kind === 314 /* CommaListExpression */;
+ return node.kind === 205 /* BinaryExpression */ && node.operatorToken.kind === 27 /* CommaToken */ ||
+ node.kind === 315 /* CommaListExpression */;
}
ts.isCommaSequence = isCommaSequence;
var OuterExpressionKinds;
@@ -64455,13 +65338,13 @@
function isOuterExpression(node, kinds) {
if (kinds === void 0) { kinds = 7 /* All */; }
switch (node.kind) {
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return (kinds & 1 /* Parentheses */) !== 0;
- case 194 /* TypeAssertionExpression */:
- case 212 /* AsExpression */:
- case 213 /* NonNullExpression */:
+ case 195 /* TypeAssertionExpression */:
+ case 213 /* AsExpression */:
+ case 214 /* NonNullExpression */:
return (kinds & 2 /* Assertions */) !== 0;
- case 313 /* PartiallyEmittedExpression */:
+ case 314 /* PartiallyEmittedExpression */:
return (kinds & 4 /* PartiallyEmittedExpressions */) !== 0;
}
return false;
@@ -64486,7 +65369,7 @@
}
ts.skipOuterExpressions = skipOuterExpressions;
function skipAssertions(node) {
- while (ts.isAssertionExpression(node) || node.kind === 213 /* NonNullExpression */) {
+ while (ts.isAssertionExpression(node) || node.kind === 214 /* NonNullExpression */) {
node = node.expression;
}
return node;
@@ -64494,11 +65377,11 @@
ts.skipAssertions = skipAssertions;
function updateOuterExpression(outerExpression, expression) {
switch (outerExpression.kind) {
- case 195 /* ParenthesizedExpression */: return ts.updateParen(outerExpression, expression);
- case 194 /* TypeAssertionExpression */: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression);
- case 212 /* AsExpression */: return ts.updateAsExpression(outerExpression, expression, outerExpression.type);
- case 213 /* NonNullExpression */: return ts.updateNonNullExpression(outerExpression, expression);
- case 313 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(outerExpression, expression);
+ case 196 /* ParenthesizedExpression */: return ts.updateParen(outerExpression, expression);
+ case 195 /* TypeAssertionExpression */: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression);
+ case 213 /* AsExpression */: return ts.updateAsExpression(outerExpression, expression, outerExpression.type);
+ case 214 /* NonNullExpression */: return ts.updateNonNullExpression(outerExpression, expression);
+ case 314 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(outerExpression, expression);
}
}
/**
@@ -64516,7 +65399,7 @@
* the containing expression is created/updated.
*/
function isIgnorableParen(node) {
- return node.kind === 195 /* ParenthesizedExpression */
+ return node.kind === 196 /* ParenthesizedExpression */
&& ts.nodeIsSynthesized(node)
&& ts.nodeIsSynthesized(ts.getSourceMapRange(node))
&& ts.nodeIsSynthesized(ts.getCommentRange(node))
@@ -64581,10 +65464,10 @@
var name = namespaceDeclaration.name;
return ts.isGeneratedIdentifier(name) ? name : ts.createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, name) || ts.idText(name));
}
- if (node.kind === 249 /* ImportDeclaration */ && node.importClause) {
+ if (node.kind === 250 /* ImportDeclaration */ && node.importClause) {
return ts.getGeneratedNameForNode(node);
}
- if (node.kind === 255 /* ExportDeclaration */ && node.moduleSpecifier) {
+ if (node.kind === 256 /* ExportDeclaration */ && node.moduleSpecifier) {
return ts.getGeneratedNameForNode(node);
}
return undefined;
@@ -64703,7 +65586,7 @@
}
if (ts.isObjectLiteralElementLike(bindingElement)) {
switch (bindingElement.kind) {
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
// `b` in `({ a: b } = ...)`
// `b` in `({ a: b = 1 } = ...)`
// `{b}` in `({ a: {b} } = ...)`
@@ -64715,11 +65598,11 @@
// `b[0]` in `({ a: b[0] } = ...)`
// `b[0]` in `({ a: b[0] = 1 } = ...)`
return getTargetOfBindingOrAssignmentElement(bindingElement.initializer);
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
// `a` in `({ a } = ...)`
// `a` in `({ a = 1 } = ...)`
return bindingElement.name;
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
// `a` in `({ ...a } = ...)`
return getTargetOfBindingOrAssignmentElement(bindingElement.expression);
}
@@ -64751,12 +65634,12 @@
*/
function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) {
switch (bindingElement.kind) {
- case 151 /* Parameter */:
- case 186 /* BindingElement */:
+ case 152 /* Parameter */:
+ case 187 /* BindingElement */:
// `...` in `let [...a] = ...`
return bindingElement.dotDotDotToken;
- case 208 /* SpreadElement */:
- case 277 /* SpreadAssignment */:
+ case 209 /* SpreadElement */:
+ case 278 /* SpreadAssignment */:
// `...` in `[...a] = ...`
return bindingElement;
}
@@ -64768,7 +65651,7 @@
*/
function getPropertyNameOfBindingOrAssignmentElement(bindingElement) {
switch (bindingElement.kind) {
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
// `a` in `let { a: b } = ...`
// `[a]` in `let { [a]: b } = ...`
// `"a"` in `let { "a": b } = ...`
@@ -64780,7 +65663,7 @@
: propertyName;
}
break;
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
// `a` in `({ a: b } = ...)`
// `[a]` in `({ [a]: b } = ...)`
// `"a"` in `({ "a": b } = ...)`
@@ -64792,7 +65675,7 @@
: propertyName;
}
break;
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
// `a` in `({ ...a } = ...)`
return bindingElement.name;
}
@@ -64815,13 +65698,13 @@
*/
function getElementsOfBindingOrAssignmentPattern(name) {
switch (name.kind) {
- case 184 /* ObjectBindingPattern */:
- case 185 /* ArrayBindingPattern */:
- case 187 /* ArrayLiteralExpression */:
+ case 185 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
+ case 188 /* ArrayLiteralExpression */:
// `a` in `{a}`
// `a` in `[a]`
return name.elements;
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
// `a` in `{a}`
return name.properties;
}
@@ -64861,11 +65744,11 @@
ts.convertToObjectAssignmentElement = convertToObjectAssignmentElement;
function convertToAssignmentPattern(node) {
switch (node.kind) {
- case 185 /* ArrayBindingPattern */:
- case 187 /* ArrayLiteralExpression */:
+ case 186 /* ArrayBindingPattern */:
+ case 188 /* ArrayLiteralExpression */:
return convertToArrayAssignmentPattern(node);
- case 184 /* ObjectBindingPattern */:
- case 188 /* ObjectLiteralExpression */:
+ case 185 /* ObjectBindingPattern */:
+ case 189 /* ObjectLiteralExpression */:
return convertToObjectAssignmentPattern(node);
}
}
@@ -65026,276 +65909,278 @@
}
var kind = node.kind;
// No need to visit nodes with no children.
- if ((kind > 0 /* FirstToken */ && kind <= 147 /* LastToken */) || kind === 178 /* ThisType */) {
+ if ((kind > 0 /* FirstToken */ && kind <= 148 /* LastToken */) || kind === 179 /* ThisType */) {
return node;
}
switch (kind) {
// Names
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return ts.updateIdentifier(node, nodesVisitor(node.typeArguments, visitor, isTypeNodeOrTypeParameterDeclaration));
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
return ts.updateQualifiedName(node, visitNode(node.left, visitor, ts.isEntityName), visitNode(node.right, visitor, ts.isIdentifier));
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression));
// Signature elements
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
return ts.updateTypeParameterDeclaration(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.constraint, visitor, ts.isTypeNode), visitNode(node.default, visitor, ts.isTypeNode));
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return ts.updateParameter(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.dotDotDotToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression));
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
return ts.updateDecorator(node, visitNode(node.expression, visitor, ts.isExpression));
// Type elements
- case 153 /* PropertySignature */:
+ case 154 /* PropertySignature */:
return ts.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isToken), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression));
- case 154 /* PropertyDeclaration */:
- return ts.updateProperty(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression));
- case 155 /* MethodSignature */:
+ case 155 /* PropertyDeclaration */:
+ return ts.updateProperty(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName),
+ // QuestionToken and ExclamationToken is uniqued in Property Declaration and the signature of 'updateProperty' is that too
+ visitNode(node.questionToken || node.exclamationToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression));
+ case 156 /* MethodSignature */:
return ts.updateMethodSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken));
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return ts.updateMethod(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context));
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return ts.updateConstructor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context));
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
return ts.updateGetAccessor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context));
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
return ts.updateSetAccessor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context));
- case 160 /* CallSignature */:
+ case 161 /* CallSignature */:
return ts.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
- case 161 /* ConstructSignature */:
+ case 162 /* ConstructSignature */:
return ts.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
- case 162 /* IndexSignature */:
+ case 163 /* IndexSignature */:
return ts.updateIndexSignature(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
// Types
- case 163 /* TypePredicate */:
+ case 164 /* TypePredicate */:
return ts.updateTypePredicateNode(node, visitNode(node.parameterName, visitor), visitNode(node.type, visitor, ts.isTypeNode));
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return ts.updateTypeReferenceNode(node, visitNode(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode));
- case 165 /* FunctionType */:
+ case 166 /* FunctionType */:
return ts.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
- case 166 /* ConstructorType */:
+ case 167 /* ConstructorType */:
return ts.updateConstructorTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
- case 167 /* TypeQuery */:
+ case 168 /* TypeQuery */:
return ts.updateTypeQueryNode(node, visitNode(node.exprName, visitor, ts.isEntityName));
- case 168 /* TypeLiteral */:
+ case 169 /* TypeLiteral */:
return ts.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement));
- case 169 /* ArrayType */:
+ case 170 /* ArrayType */:
return ts.updateArrayTypeNode(node, visitNode(node.elementType, visitor, ts.isTypeNode));
- case 170 /* TupleType */:
+ case 171 /* TupleType */:
return ts.updateTupleTypeNode(node, nodesVisitor(node.elementTypes, visitor, ts.isTypeNode));
- case 171 /* OptionalType */:
+ case 172 /* OptionalType */:
return ts.updateOptionalTypeNode(node, visitNode(node.type, visitor, ts.isTypeNode));
- case 172 /* RestType */:
+ case 173 /* RestType */:
return ts.updateRestTypeNode(node, visitNode(node.type, visitor, ts.isTypeNode));
- case 173 /* UnionType */:
+ case 174 /* UnionType */:
return ts.updateUnionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode));
- case 174 /* IntersectionType */:
+ case 175 /* IntersectionType */:
return ts.updateIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode));
- case 175 /* ConditionalType */:
+ case 176 /* ConditionalType */:
return ts.updateConditionalTypeNode(node, visitNode(node.checkType, visitor, ts.isTypeNode), visitNode(node.extendsType, visitor, ts.isTypeNode), visitNode(node.trueType, visitor, ts.isTypeNode), visitNode(node.falseType, visitor, ts.isTypeNode));
- case 176 /* InferType */:
+ case 177 /* InferType */:
return ts.updateInferTypeNode(node, visitNode(node.typeParameter, visitor, ts.isTypeParameterDeclaration));
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return ts.updateImportTypeNode(node, visitNode(node.argument, visitor, ts.isTypeNode), visitNode(node.qualifier, visitor, ts.isEntityName), visitNodes(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf);
- case 177 /* ParenthesizedType */:
+ case 178 /* ParenthesizedType */:
return ts.updateParenthesizedType(node, visitNode(node.type, visitor, ts.isTypeNode));
- case 179 /* TypeOperator */:
+ case 180 /* TypeOperator */:
return ts.updateTypeOperatorNode(node, visitNode(node.type, visitor, ts.isTypeNode));
- case 180 /* IndexedAccessType */:
+ case 181 /* IndexedAccessType */:
return ts.updateIndexedAccessTypeNode(node, visitNode(node.objectType, visitor, ts.isTypeNode), visitNode(node.indexType, visitor, ts.isTypeNode));
- case 181 /* MappedType */:
+ case 182 /* MappedType */:
return ts.updateMappedTypeNode(node, visitNode(node.readonlyToken, tokenVisitor, ts.isToken), visitNode(node.typeParameter, visitor, ts.isTypeParameterDeclaration), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode));
- case 182 /* LiteralType */:
+ case 183 /* LiteralType */:
return ts.updateLiteralTypeNode(node, visitNode(node.literal, visitor, ts.isExpression));
// Binding patterns
- case 184 /* ObjectBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
return ts.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement));
- case 185 /* ArrayBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
return ts.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement));
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return ts.updateBindingElement(node, visitNode(node.dotDotDotToken, tokenVisitor, ts.isToken), visitNode(node.propertyName, visitor, ts.isPropertyName), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression));
// Expression
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return ts.updateArrayLiteral(node, nodesVisitor(node.elements, visitor, ts.isExpression));
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return ts.updateObjectLiteral(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike));
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier));
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression));
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression));
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression));
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return ts.updateTaggedTemplate(node, visitNode(node.tag, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isExpression), visitNode(node.template, visitor, ts.isTemplateLiteral));
- case 194 /* TypeAssertionExpression */:
+ case 195 /* TypeAssertionExpression */:
return ts.updateTypeAssertion(node, visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression));
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression));
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return ts.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context));
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return ts.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.equalsGreaterThanToken, visitor, ts.isToken), visitFunctionBody(node.body, visitor, context));
- case 198 /* DeleteExpression */:
+ case 199 /* DeleteExpression */:
return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression));
- case 199 /* TypeOfExpression */:
+ case 200 /* TypeOfExpression */:
return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression));
- case 200 /* VoidExpression */:
+ case 201 /* VoidExpression */:
return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression));
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
return ts.updateAwait(node, visitNode(node.expression, visitor, ts.isExpression));
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression));
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return ts.updatePostfix(node, visitNode(node.operand, visitor, ts.isExpression));
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return ts.updateBinary(node, visitNode(node.left, visitor, ts.isExpression), visitNode(node.right, visitor, ts.isExpression), visitNode(node.operatorToken, visitor, ts.isToken));
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.questionToken, visitor, ts.isToken), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.colonToken, visitor, ts.isToken), visitNode(node.whenFalse, visitor, ts.isExpression));
- case 206 /* TemplateExpression */:
+ case 207 /* TemplateExpression */:
return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan));
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return ts.updateYield(node, visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.expression, visitor, ts.isExpression));
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression));
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
return ts.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement));
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return ts.updateExpressionWithTypeArguments(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression));
- case 212 /* AsExpression */:
+ case 213 /* AsExpression */:
return ts.updateAsExpression(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.type, visitor, ts.isTypeNode));
- case 213 /* NonNullExpression */:
+ case 214 /* NonNullExpression */:
return ts.updateNonNullExpression(node, visitNode(node.expression, visitor, ts.isExpression));
- case 214 /* MetaProperty */:
+ case 215 /* MetaProperty */:
return ts.updateMetaProperty(node, visitNode(node.name, visitor, ts.isIdentifier));
// Misc
- case 216 /* TemplateSpan */:
+ case 217 /* TemplateSpan */:
return ts.updateTemplateSpan(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail));
// Element
- case 218 /* Block */:
+ case 219 /* Block */:
return ts.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement));
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return ts.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList));
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return ts.updateExpressionStatement(node, visitNode(node.expression, visitor, ts.isExpression));
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, ts.liftToBlock));
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.expression, visitor, ts.isExpression));
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return ts.updateForOf(node, visitNode(node.awaitModifier, visitor, ts.isToken), visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
- case 228 /* ContinueStatement */:
+ case 229 /* ContinueStatement */:
return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier));
- case 229 /* BreakStatement */:
+ case 230 /* BreakStatement */:
return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier));
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression));
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock));
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
- case 234 /* ThrowStatement */:
+ case 235 /* ThrowStatement */:
return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression));
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause), visitNode(node.finallyBlock, visitor, ts.isBlock));
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression));
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
return ts.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration));
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return ts.updateFunctionDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context));
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return ts.updateClassDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement));
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
return ts.updateInterfaceDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement));
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return ts.updateTypeAliasDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return ts.updateEnumDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember));
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return ts.updateModuleDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.body, visitor, ts.isModuleBody));
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
return ts.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement));
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
return ts.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause));
- case 247 /* NamespaceExportDeclaration */:
+ case 248 /* NamespaceExportDeclaration */:
return ts.updateNamespaceExportDeclaration(node, visitNode(node.name, visitor, ts.isIdentifier));
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return ts.updateImportEqualsDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.moduleReference, visitor, ts.isModuleReference));
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return ts.updateImportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause), visitNode(node.moduleSpecifier, visitor, ts.isExpression));
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings));
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier));
- case 252 /* NamedImports */:
+ case 253 /* NamedImports */:
return ts.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier));
- case 253 /* ImportSpecifier */:
+ case 254 /* ImportSpecifier */:
return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier));
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return ts.updateExportAssignment(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression));
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return ts.updateExportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports), visitNode(node.moduleSpecifier, visitor, ts.isExpression));
- case 256 /* NamedExports */:
+ case 257 /* NamedExports */:
return ts.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier));
- case 257 /* ExportSpecifier */:
+ case 258 /* ExportSpecifier */:
return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier));
// Module references
- case 259 /* ExternalModuleReference */:
+ case 260 /* ExternalModuleReference */:
return ts.updateExternalModuleReference(node, visitNode(node.expression, visitor, ts.isExpression));
// JSX
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement));
- case 261 /* JsxSelfClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.attributes, visitor, ts.isJsxAttributes));
- case 262 /* JsxOpeningElement */:
+ case 263 /* JsxOpeningElement */:
return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.attributes, visitor, ts.isJsxAttributes));
- case 263 /* JsxClosingElement */:
+ case 264 /* JsxClosingElement */:
return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression));
- case 264 /* JsxFragment */:
+ case 265 /* JsxFragment */:
return ts.updateJsxFragment(node, visitNode(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingFragment, visitor, ts.isJsxClosingFragment));
- case 267 /* JsxAttribute */:
+ case 268 /* JsxAttribute */:
return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression));
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
return ts.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike));
- case 269 /* JsxSpreadAttribute */:
+ case 270 /* JsxSpreadAttribute */:
return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression));
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression));
// Clauses
- case 271 /* CaseClause */:
+ case 272 /* CaseClause */:
return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement));
- case 272 /* DefaultClause */:
+ case 273 /* DefaultClause */:
return ts.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement));
- case 273 /* HeritageClause */:
+ case 274 /* HeritageClause */:
return ts.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments));
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock));
// Property assignments
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression));
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression));
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression));
// Enum
- case 278 /* EnumMember */:
+ case 279 /* EnumMember */:
return ts.updateEnumMember(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression));
// Top-level nodes
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context));
// Transformation nodes
- case 313 /* PartiallyEmittedExpression */:
+ case 314 /* PartiallyEmittedExpression */:
return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression));
- case 314 /* CommaListExpression */:
+ case 315 /* CommaListExpression */:
return ts.updateCommaList(node, nodesVisitor(node.elements, visitor, ts.isExpression));
default:
// No need to visit nodes with no children.
@@ -65337,58 +66222,58 @@
var cbNodes = cbNodeArray || cbNode;
var kind = node.kind;
// No need to visit nodes with no children.
- if ((kind > 0 /* FirstToken */ && kind <= 147 /* LastToken */)) {
+ if ((kind > 0 /* FirstToken */ && kind <= 148 /* LastToken */)) {
return initial;
}
// We do not yet support types.
- if ((kind >= 163 /* TypePredicate */ && kind <= 182 /* LiteralType */)) {
+ if ((kind >= 164 /* TypePredicate */ && kind <= 183 /* LiteralType */)) {
return initial;
}
var result = initial;
switch (node.kind) {
// Leaf nodes
- case 217 /* SemicolonClassElement */:
- case 220 /* EmptyStatement */:
- case 210 /* OmittedExpression */:
- case 236 /* DebuggerStatement */:
- case 312 /* NotEmittedStatement */:
+ case 218 /* SemicolonClassElement */:
+ case 221 /* EmptyStatement */:
+ case 211 /* OmittedExpression */:
+ case 237 /* DebuggerStatement */:
+ case 313 /* NotEmittedStatement */:
// No need to visit nodes with no children.
break;
// Names
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
result = reduceNode(node.left, cbNode, result);
result = reduceNode(node.right, cbNode, result);
break;
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
result = reduceNode(node.expression, cbNode, result);
break;
// Signature elements
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
result = reduceNode(node.expression, cbNode, result);
break;
// Type member
- case 153 /* PropertySignature */:
+ case 154 /* PropertySignature */:
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.questionToken, cbNode, result);
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
@@ -65397,12 +66282,12 @@
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNodes(node.parameters, cbNodes, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
@@ -65410,7 +66295,7 @@
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
@@ -65418,50 +66303,50 @@
result = reduceNode(node.body, cbNode, result);
break;
// Binding patterns
- case 184 /* ObjectBindingPattern */:
- case 185 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
result = reduceNodes(node.elements, cbNodes, result);
break;
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
result = reduceNode(node.propertyName, cbNode, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
// Expression
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
result = reduceNodes(node.elements, cbNodes, result);
break;
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
result = reduceNodes(node.properties, cbNodes, result);
break;
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.name, cbNode, result);
break;
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.argumentExpression, cbNode, result);
break;
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNodes(node.typeArguments, cbNodes, result);
result = reduceNodes(node.arguments, cbNodes, result);
break;
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNodes(node.typeArguments, cbNodes, result);
result = reduceNodes(node.arguments, cbNodes, result);
break;
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
result = reduceNode(node.tag, cbNode, result);
result = reduceNodes(node.typeArguments, cbNodes, result);
result = reduceNode(node.template, cbNode, result);
break;
- case 194 /* TypeAssertionExpression */:
+ case 195 /* TypeAssertionExpression */:
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.expression, cbNode, result);
break;
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNodes(node.typeParameters, cbNodes, result);
@@ -65469,123 +66354,123 @@
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNodes(node.typeParameters, cbNodes, result);
result = reduceNodes(node.parameters, cbNodes, result);
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 195 /* ParenthesizedExpression */:
- case 198 /* DeleteExpression */:
- case 199 /* TypeOfExpression */:
- case 200 /* VoidExpression */:
- case 201 /* AwaitExpression */:
- case 207 /* YieldExpression */:
- case 208 /* SpreadElement */:
- case 213 /* NonNullExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 199 /* DeleteExpression */:
+ case 200 /* TypeOfExpression */:
+ case 201 /* VoidExpression */:
+ case 202 /* AwaitExpression */:
+ case 208 /* YieldExpression */:
+ case 209 /* SpreadElement */:
+ case 214 /* NonNullExpression */:
result = reduceNode(node.expression, cbNode, result);
break;
- case 202 /* PrefixUnaryExpression */:
- case 203 /* PostfixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
result = reduceNode(node.operand, cbNode, result);
break;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
result = reduceNode(node.left, cbNode, result);
result = reduceNode(node.right, cbNode, result);
break;
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
result = reduceNode(node.condition, cbNode, result);
result = reduceNode(node.whenTrue, cbNode, result);
result = reduceNode(node.whenFalse, cbNode, result);
break;
- case 206 /* TemplateExpression */:
+ case 207 /* TemplateExpression */:
result = reduceNode(node.head, cbNode, result);
result = reduceNodes(node.templateSpans, cbNodes, result);
break;
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNodes(node.typeParameters, cbNodes, result);
result = reduceNodes(node.heritageClauses, cbNodes, result);
result = reduceNodes(node.members, cbNodes, result);
break;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNodes(node.typeArguments, cbNodes, result);
break;
- case 212 /* AsExpression */:
+ case 213 /* AsExpression */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.type, cbNode, result);
break;
// Misc
- case 216 /* TemplateSpan */:
+ case 217 /* TemplateSpan */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.literal, cbNode, result);
break;
// Element
- case 218 /* Block */:
+ case 219 /* Block */:
result = reduceNodes(node.statements, cbNodes, result);
break;
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.declarationList, cbNode, result);
break;
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
result = reduceNode(node.expression, cbNode, result);
break;
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.thenStatement, cbNode, result);
result = reduceNode(node.elseStatement, cbNode, result);
break;
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
result = reduceNode(node.statement, cbNode, result);
result = reduceNode(node.expression, cbNode, result);
break;
- case 224 /* WhileStatement */:
- case 231 /* WithStatement */:
+ case 225 /* WhileStatement */:
+ case 232 /* WithStatement */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.statement, cbNode, result);
break;
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
result = reduceNode(node.initializer, cbNode, result);
result = reduceNode(node.condition, cbNode, result);
result = reduceNode(node.incrementor, cbNode, result);
result = reduceNode(node.statement, cbNode, result);
break;
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
result = reduceNode(node.initializer, cbNode, result);
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.statement, cbNode, result);
break;
- case 230 /* ReturnStatement */:
- case 234 /* ThrowStatement */:
+ case 231 /* ReturnStatement */:
+ case 235 /* ThrowStatement */:
result = reduceNode(node.expression, cbNode, result);
break;
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.caseBlock, cbNode, result);
break;
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
result = reduceNode(node.label, cbNode, result);
result = reduceNode(node.statement, cbNode, result);
break;
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
result = reduceNode(node.tryBlock, cbNode, result);
result = reduceNode(node.catchClause, cbNode, result);
result = reduceNode(node.finallyBlock, cbNode, result);
break;
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
result = reduceNodes(node.declarations, cbNodes, result);
break;
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
@@ -65594,7 +66479,7 @@
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
@@ -65602,140 +66487,140 @@
result = reduceNodes(node.heritageClauses, cbNodes, result);
result = reduceNodes(node.members, cbNodes, result);
break;
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNodes(node.members, cbNodes, result);
break;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
result = reduceNodes(node.statements, cbNodes, result);
break;
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
result = reduceNodes(node.clauses, cbNodes, result);
break;
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.moduleReference, cbNode, result);
break;
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.importClause, cbNode, result);
result = reduceNode(node.moduleSpecifier, cbNode, result);
break;
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.namedBindings, cbNode, result);
break;
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
result = reduceNode(node.name, cbNode, result);
break;
- case 252 /* NamedImports */:
- case 256 /* NamedExports */:
+ case 253 /* NamedImports */:
+ case 257 /* NamedExports */:
result = reduceNodes(node.elements, cbNodes, result);
break;
- case 253 /* ImportSpecifier */:
- case 257 /* ExportSpecifier */:
+ case 254 /* ImportSpecifier */:
+ case 258 /* ExportSpecifier */:
result = reduceNode(node.propertyName, cbNode, result);
result = reduceNode(node.name, cbNode, result);
break;
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
result = ts.reduceLeft(node.decorators, cbNode, result);
result = ts.reduceLeft(node.modifiers, cbNode, result);
result = reduceNode(node.expression, cbNode, result);
break;
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
result = ts.reduceLeft(node.decorators, cbNode, result);
result = ts.reduceLeft(node.modifiers, cbNode, result);
result = reduceNode(node.exportClause, cbNode, result);
result = reduceNode(node.moduleSpecifier, cbNode, result);
break;
// Module references
- case 259 /* ExternalModuleReference */:
+ case 260 /* ExternalModuleReference */:
result = reduceNode(node.expression, cbNode, result);
break;
// JSX
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
result = reduceNode(node.openingElement, cbNode, result);
result = ts.reduceLeft(node.children, cbNode, result);
result = reduceNode(node.closingElement, cbNode, result);
break;
- case 264 /* JsxFragment */:
+ case 265 /* JsxFragment */:
result = reduceNode(node.openingFragment, cbNode, result);
result = ts.reduceLeft(node.children, cbNode, result);
result = reduceNode(node.closingFragment, cbNode, result);
break;
- case 261 /* JsxSelfClosingElement */:
- case 262 /* JsxOpeningElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
result = reduceNode(node.tagName, cbNode, result);
result = reduceNodes(node.typeArguments, cbNode, result);
result = reduceNode(node.attributes, cbNode, result);
break;
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
result = reduceNodes(node.properties, cbNodes, result);
break;
- case 263 /* JsxClosingElement */:
+ case 264 /* JsxClosingElement */:
result = reduceNode(node.tagName, cbNode, result);
break;
- case 267 /* JsxAttribute */:
+ case 268 /* JsxAttribute */:
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
- case 269 /* JsxSpreadAttribute */:
+ case 270 /* JsxSpreadAttribute */:
result = reduceNode(node.expression, cbNode, result);
break;
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
result = reduceNode(node.expression, cbNode, result);
break;
// Clauses
- case 271 /* CaseClause */:
+ case 272 /* CaseClause */:
result = reduceNode(node.expression, cbNode, result);
// falls through
- case 272 /* DefaultClause */:
+ case 273 /* DefaultClause */:
result = reduceNodes(node.statements, cbNodes, result);
break;
- case 273 /* HeritageClause */:
+ case 274 /* HeritageClause */:
result = reduceNodes(node.types, cbNodes, result);
break;
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
result = reduceNode(node.variableDeclaration, cbNode, result);
result = reduceNode(node.block, cbNode, result);
break;
// Property assignments
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.objectAssignmentInitializer, cbNode, result);
break;
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
result = reduceNode(node.expression, cbNode, result);
break;
// Enum
- case 278 /* EnumMember */:
+ case 279 /* EnumMember */:
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
// Top-level nodes
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
result = reduceNodes(node.statements, cbNodes, result);
break;
// Transformation nodes
- case 313 /* PartiallyEmittedExpression */:
+ case 314 /* PartiallyEmittedExpression */:
result = reduceNode(node.expression, cbNode, result);
break;
- case 314 /* CommaListExpression */:
+ case 315 /* CommaListExpression */:
result = reduceNodes(node.elements, cbNodes, result);
break;
default:
@@ -65759,7 +66644,7 @@
* @param nodes The NodeArray.
*/
function liftToBlock(nodes) {
- Debug.assert(ts.every(nodes, ts.isStatement), "Cannot lift nodes to a Block.");
+ ts.Debug.assert(ts.every(nodes, ts.isStatement), "Cannot lift nodes to a Block.");
return ts.singleOrUndefined(nodes) || ts.createBlock(nodes);
}
ts.liftToBlock = liftToBlock;
@@ -65808,7 +66693,7 @@
function aggregateTransformFlagsForSubtree(node) {
// We do not transform ambient declarations or types, so there is no need to
// recursively aggregate transform flags.
- if (ts.hasModifier(node, 2 /* Ambient */) || (ts.isTypeNode(node) && node.kind !== 211 /* ExpressionWithTypeArguments */)) {
+ if (ts.hasModifier(node, 2 /* Ambient */) || (ts.isTypeNode(node) && node.kind !== 212 /* ExpressionWithTypeArguments */)) {
return 0 /* None */;
}
// Aggregate the transform flags of each child.
@@ -65824,73 +66709,6 @@
function aggregateTransformFlagsForChildNodes(transformFlags, nodes) {
return transformFlags | aggregateTransformFlagsForNodeArray(nodes);
}
- var Debug;
- (function (Debug) {
- var isDebugInfoEnabled = false;
- function failBadSyntaxKind(node, message) {
- return Debug.fail((message || "Unexpected node.") + "\r\nNode " + ts.formatSyntaxKind(node.kind) + " was unexpected.", failBadSyntaxKind);
- }
- Debug.failBadSyntaxKind = failBadSyntaxKind;
- Debug.assertEachNode = Debug.shouldAssert(1 /* Normal */)
- ? function (nodes, test, message) { return Debug.assert(test === undefined || ts.every(nodes, test), message || "Unexpected node.", function () { return "Node array did not pass test '" + Debug.getFunctionName(test) + "'."; }, Debug.assertEachNode); }
- : ts.noop;
- Debug.assertNode = Debug.shouldAssert(1 /* Normal */)
- ? function (node, test, message) { return Debug.assert(test === undefined || test(node), message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " did not pass test '" + Debug.getFunctionName(test) + "'."; }, Debug.assertNode); }
- : ts.noop;
- Debug.assertOptionalNode = Debug.shouldAssert(1 /* Normal */)
- ? function (node, test, message) { return Debug.assert(test === undefined || node === undefined || test(node), message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " did not pass test '" + Debug.getFunctionName(test) + "'."; }, Debug.assertOptionalNode); }
- : ts.noop;
- Debug.assertOptionalToken = Debug.shouldAssert(1 /* Normal */)
- ? function (node, kind, message) { return Debug.assert(kind === undefined || node === undefined || node.kind === kind, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was not a '" + ts.formatSyntaxKind(kind) + "' token."; }, Debug.assertOptionalToken); }
- : ts.noop;
- Debug.assertMissingNode = Debug.shouldAssert(1 /* Normal */)
- ? function (node, message) { return Debug.assert(node === undefined, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was unexpected'."; }, Debug.assertMissingNode); }
- : ts.noop;
- /**
- * Injects debug information into frequently used types.
- */
- function enableDebugInfo() {
- if (isDebugInfoEnabled)
- return;
- // Add additional properties in debug mode to assist with debugging.
- Object.defineProperties(ts.objectAllocator.getSymbolConstructor().prototype, {
- __debugFlags: { get: function () { return ts.formatSymbolFlags(this.flags); } }
- });
- Object.defineProperties(ts.objectAllocator.getTypeConstructor().prototype, {
- __debugFlags: { get: function () { return ts.formatTypeFlags(this.flags); } },
- __debugObjectFlags: { get: function () { return this.flags & 524288 /* Object */ ? ts.formatObjectFlags(this.objectFlags) : ""; } },
- __debugTypeToString: { value: function () { return this.checker.typeToString(this); } },
- });
- var nodeConstructors = [
- ts.objectAllocator.getNodeConstructor(),
- ts.objectAllocator.getIdentifierConstructor(),
- ts.objectAllocator.getTokenConstructor(),
- ts.objectAllocator.getSourceFileConstructor()
- ];
- for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) {
- var ctor = nodeConstructors_1[_i];
- if (!ctor.prototype.hasOwnProperty("__debugKind")) {
- Object.defineProperties(ctor.prototype, {
- __debugKind: { get: function () { return ts.formatSyntaxKind(this.kind); } },
- __debugModifierFlags: { get: function () { return ts.formatModifierFlags(ts.getModifierFlagsNoCache(this)); } },
- __debugTransformFlags: { get: function () { return ts.formatTransformFlags(this.transformFlags); } },
- __debugEmitFlags: { get: function () { return ts.formatEmitFlags(ts.getEmitFlags(this)); } },
- __debugGetText: {
- value: function (includeTrivia) {
- if (ts.nodeIsSynthesized(this))
- return "";
- var parseNode = ts.getParseTreeNode(this);
- var sourceFile = parseNode && ts.getSourceFileOfNode(parseNode);
- return sourceFile ? ts.getSourceTextOfNodeFromSourceFile(sourceFile, parseNode, includeTrivia) : "";
- }
- }
- });
- }
- }
- isDebugInfoEnabled = true;
- }
- Debug.enableDebugInfo = enableDebugInfo;
- })(Debug = ts.Debug || (ts.Debug = {}));
})(ts || (ts = {}));
/* @internal */
var ts;
@@ -66548,7 +67366,7 @@
function chainBundle(transformSourceFile) {
return transformSourceFileOrBundle;
function transformSourceFileOrBundle(node) {
- return node.kind === 284 /* SourceFile */ ? transformSourceFile(node) : transformBundle(node);
+ return node.kind === 285 /* SourceFile */ ? transformSourceFile(node) : transformBundle(node);
}
function transformBundle(node) {
return ts.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends);
@@ -66594,7 +67412,7 @@
for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {
var node = _a[_i];
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
// import "mod"
// import x from "mod"
// import * as x from "mod"
@@ -66602,13 +67420,13 @@
externalImports.push(node);
hasImportStarOrImportDefault = hasImportStarOrImportDefault || getImportNeedsImportStarHelper(node) || getImportNeedsImportDefaultHelper(node);
break;
- case 248 /* ImportEqualsDeclaration */:
- if (node.moduleReference.kind === 259 /* ExternalModuleReference */) {
+ case 249 /* ImportEqualsDeclaration */:
+ if (node.moduleReference.kind === 260 /* ExternalModuleReference */) {
// import x = require("mod")
externalImports.push(node);
}
break;
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
if (node.moduleSpecifier) {
if (!node.exportClause) {
// export * from "mod"
@@ -66638,13 +67456,13 @@
}
}
break;
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
if (node.isExportEquals && !exportEquals) {
// export = x
exportEquals = node;
}
break;
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
if (ts.hasModifier(node, 1 /* Export */)) {
for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) {
var decl = _e[_d];
@@ -66652,7 +67470,7 @@
}
}
break;
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
if (ts.hasModifier(node, 1 /* Export */)) {
if (ts.hasModifier(node, 512 /* Default */)) {
// export default function() { }
@@ -66672,7 +67490,7 @@
}
}
break;
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
if (ts.hasModifier(node, 1 /* Export */)) {
if (ts.hasModifier(node, 512 /* Default */)) {
// export default class { }
@@ -67212,7 +68030,7 @@
ts.restHelper = {
name: "typescript:rest",
scoped: false,
- text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\n t[p[i]] = s[p[i]];\n return t;\n };"
+ text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n };"
};
/** Given value: o, propName: p, pattern: { a, b, ...p } from the original statement
* `{ a, b, ...p } = o`, create `p = __rest(o, ["a", "b"]);`
@@ -67288,8 +68106,8 @@
context.onEmitNode = onEmitNode;
context.onSubstituteNode = onSubstituteNode;
// Enable substitution for property/element access to emit const enum values.
- context.enableSubstitution(189 /* PropertyAccessExpression */);
- context.enableSubstitution(190 /* ElementAccessExpression */);
+ context.enableSubstitution(190 /* PropertyAccessExpression */);
+ context.enableSubstitution(191 /* ElementAccessExpression */);
// These variables contain state that changes as we descend into the tree.
var currentSourceFile;
var currentNamespace;
@@ -67319,14 +68137,14 @@
var pendingExpressions;
return transformSourceFileOrBundle;
function transformSourceFileOrBundle(node) {
- if (node.kind === 285 /* Bundle */) {
+ if (node.kind === 286 /* Bundle */) {
return transformBundle(node);
}
return transformSourceFile(node);
}
function transformBundle(node) {
return ts.createBundle(node.sourceFiles.map(transformSourceFile), ts.mapDefined(node.prepends, function (prepend) {
- if (prepend.kind === 287 /* InputFiles */) {
+ if (prepend.kind === 288 /* InputFiles */) {
return ts.createUnparsedSourceFile(prepend, "js");
}
return prepend;
@@ -67375,16 +68193,16 @@
*/
function onBeforeVisitNode(node) {
switch (node.kind) {
- case 284 /* SourceFile */:
- case 246 /* CaseBlock */:
- case 245 /* ModuleBlock */:
- case 218 /* Block */:
+ case 285 /* SourceFile */:
+ case 247 /* CaseBlock */:
+ case 246 /* ModuleBlock */:
+ case 219 /* Block */:
currentLexicalScope = node;
currentNameScope = undefined;
currentScopeFirstDeclarationsOfName = undefined;
break;
- case 240 /* ClassDeclaration */:
- case 239 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 240 /* FunctionDeclaration */:
if (ts.hasModifier(node, 2 /* Ambient */)) {
break;
}
@@ -67396,7 +68214,7 @@
// These nodes should always have names unless they are default-exports;
// however, class declaration parsing allows for undefined names, so syntactically invalid
// programs may also have an undefined name.
- ts.Debug.assert(node.kind === 240 /* ClassDeclaration */ || ts.hasModifier(node, 512 /* Default */));
+ ts.Debug.assert(node.kind === 241 /* ClassDeclaration */ || ts.hasModifier(node, 512 /* Default */));
}
if (ts.isClassDeclaration(node)) {
// XXX: should probably also cover interfaces and type aliases that can have type variables?
@@ -67439,10 +68257,10 @@
*/
function sourceElementVisitorWorker(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
- case 254 /* ExportAssignment */:
- case 255 /* ExportDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 255 /* ExportAssignment */:
+ case 256 /* ExportDeclaration */:
return visitEllidableStatement(node);
default:
return visitorWorker(node);
@@ -67463,13 +68281,13 @@
return node;
}
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return visitImportDeclaration(node);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return visitImportEqualsDeclaration(node);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return visitExportAssignment(node);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return visitExportDeclaration(node);
default:
ts.Debug.fail("Unhandled ellided statement");
@@ -67489,11 +68307,11 @@
* @param node The node to visit.
*/
function namespaceElementVisitorWorker(node) {
- if (node.kind === 255 /* ExportDeclaration */ ||
- node.kind === 249 /* ImportDeclaration */ ||
- node.kind === 250 /* ImportClause */ ||
- (node.kind === 248 /* ImportEqualsDeclaration */ &&
- node.moduleReference.kind === 259 /* ExternalModuleReference */)) {
+ if (node.kind === 256 /* ExportDeclaration */ ||
+ node.kind === 250 /* ImportDeclaration */ ||
+ node.kind === 251 /* ImportClause */ ||
+ (node.kind === 249 /* ImportEqualsDeclaration */ &&
+ node.moduleReference.kind === 260 /* ExternalModuleReference */)) {
// do not emit ES6 imports and exports since they are illegal inside a namespace
return undefined;
}
@@ -67517,19 +68335,19 @@
*/
function classElementVisitorWorker(node) {
switch (node.kind) {
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
// TypeScript constructors are transformed in `visitClassDeclaration`.
// We elide them here as `visitorWorker` checks transform flags, which could
// erronously include an ES6 constructor without TypeScript syntax.
return undefined;
- case 154 /* PropertyDeclaration */:
- case 162 /* IndexSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 156 /* MethodDeclaration */:
+ case 155 /* PropertyDeclaration */:
+ case 163 /* IndexSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
// Fallback to the default visit behavior.
return visitorWorker(node);
- case 217 /* SemicolonClassElement */:
+ case 218 /* SemicolonClassElement */:
return node;
default:
return ts.Debug.failBadSyntaxKind(node);
@@ -67539,7 +68357,7 @@
if (ts.modifierToFlag(node.kind) & 2270 /* TypeScriptModifier */) {
return undefined;
}
- else if (currentNamespace && node.kind === 85 /* ExportKeyword */) {
+ else if (currentNamespace && node.kind === 86 /* ExportKeyword */) {
return undefined;
}
return node;
@@ -67556,67 +68374,67 @@
return ts.createNotEmittedStatement(node);
}
switch (node.kind) {
- case 85 /* ExportKeyword */:
- case 80 /* DefaultKeyword */:
+ case 86 /* ExportKeyword */:
+ case 81 /* DefaultKeyword */:
// ES6 export and default modifiers are elided when inside a namespace.
return currentNamespace ? undefined : node;
- case 115 /* PublicKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 118 /* AbstractKeyword */:
- case 77 /* ConstKeyword */:
- case 125 /* DeclareKeyword */:
- case 133 /* ReadonlyKeyword */:
+ case 116 /* PublicKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 119 /* AbstractKeyword */:
+ case 78 /* ConstKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 134 /* ReadonlyKeyword */:
// TypeScript accessibility and readonly modifiers are elided.
- case 169 /* ArrayType */:
- case 170 /* TupleType */:
- case 171 /* OptionalType */:
- case 172 /* RestType */:
- case 168 /* TypeLiteral */:
- case 163 /* TypePredicate */:
- case 150 /* TypeParameter */:
- case 120 /* AnyKeyword */:
- case 143 /* UnknownKeyword */:
- case 123 /* BooleanKeyword */:
- case 138 /* StringKeyword */:
- case 135 /* NumberKeyword */:
- case 132 /* NeverKeyword */:
- case 106 /* VoidKeyword */:
- case 139 /* SymbolKeyword */:
- case 166 /* ConstructorType */:
- case 165 /* FunctionType */:
- case 167 /* TypeQuery */:
- case 164 /* TypeReference */:
- case 173 /* UnionType */:
- case 174 /* IntersectionType */:
- case 175 /* ConditionalType */:
- case 177 /* ParenthesizedType */:
- case 178 /* ThisType */:
- case 179 /* TypeOperator */:
- case 180 /* IndexedAccessType */:
- case 181 /* MappedType */:
- case 182 /* LiteralType */:
+ case 170 /* ArrayType */:
+ case 171 /* TupleType */:
+ case 172 /* OptionalType */:
+ case 173 /* RestType */:
+ case 169 /* TypeLiteral */:
+ case 164 /* TypePredicate */:
+ case 151 /* TypeParameter */:
+ case 121 /* AnyKeyword */:
+ case 144 /* UnknownKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 139 /* StringKeyword */:
+ case 136 /* NumberKeyword */:
+ case 133 /* NeverKeyword */:
+ case 107 /* VoidKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 167 /* ConstructorType */:
+ case 166 /* FunctionType */:
+ case 168 /* TypeQuery */:
+ case 165 /* TypeReference */:
+ case 174 /* UnionType */:
+ case 175 /* IntersectionType */:
+ case 176 /* ConditionalType */:
+ case 178 /* ParenthesizedType */:
+ case 179 /* ThisType */:
+ case 180 /* TypeOperator */:
+ case 181 /* IndexedAccessType */:
+ case 182 /* MappedType */:
+ case 183 /* LiteralType */:
// TypeScript type nodes are elided.
- case 162 /* IndexSignature */:
+ case 163 /* IndexSignature */:
// TypeScript index signatures are elided.
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
// TypeScript decorators are elided. They will be emitted as part of visitClassDeclaration.
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
// TypeScript type-only declarations are elided.
return undefined;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
// TypeScript property declarations are elided. However their names are still visited, and can potentially be retained if they could have sideeffects
return visitPropertyDeclaration(node);
- case 247 /* NamespaceExportDeclaration */:
+ case 248 /* NamespaceExportDeclaration */:
// TypeScript namespace export declarations are elided.
return undefined;
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return visitConstructor(node);
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
// TypeScript interfaces are elided, but some comments may be preserved.
// See the implementation of `getLeadingComments` in comments.ts for more details.
return ts.createNotEmittedStatement(node);
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
// This may be a class declaration with TypeScript syntax extensions.
//
// TypeScript class syntax extensions include:
@@ -67627,7 +68445,7 @@
// - index signatures
// - method overload signatures
return visitClassDeclaration(node);
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
// This may be a class expression with TypeScript syntax extensions.
//
// TypeScript class syntax extensions include:
@@ -67638,35 +68456,35 @@
// - index signatures
// - method overload signatures
return visitClassExpression(node);
- case 273 /* HeritageClause */:
+ case 274 /* HeritageClause */:
// This may be a heritage clause with TypeScript syntax extensions.
//
// TypeScript heritage clause extensions include:
// - `implements` clause
return visitHeritageClause(node);
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
// TypeScript supports type arguments on an expression in an `extends` heritage clause.
return visitExpressionWithTypeArguments(node);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
// TypeScript method declarations may have decorators, modifiers
// or type annotations.
return visitMethodDeclaration(node);
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
// Get Accessors can have TypeScript modifiers, decorators, and type annotations.
return visitGetAccessor(node);
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
// Set Accessors can have TypeScript modifiers and type annotations.
return visitSetAccessor(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
// Typescript function declarations can have modifiers, decorators, and type annotations.
return visitFunctionDeclaration(node);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
// TypeScript function expressions can have modifiers and type annotations.
return visitFunctionExpression(node);
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
// TypeScript arrow functions can have modifiers and type annotations.
return visitArrowFunction(node);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
// This may be a parameter declaration with TypeScript syntax extensions.
//
// TypeScript parameter declaration syntax extensions include:
@@ -67676,35 +68494,35 @@
// - type annotations
// - this parameters
return visitParameter(node);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
// ParenthesizedExpressions are TypeScript if their expression is a
// TypeAssertion or AsExpression
return visitParenthesizedExpression(node);
- case 194 /* TypeAssertionExpression */:
- case 212 /* AsExpression */:
+ case 195 /* TypeAssertionExpression */:
+ case 213 /* AsExpression */:
// TypeScript type assertions are removed, but their subtrees are preserved.
return visitAssertionExpression(node);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return visitCallExpression(node);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return visitNewExpression(node);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return visitTaggedTemplateExpression(node);
- case 213 /* NonNullExpression */:
+ case 214 /* NonNullExpression */:
// TypeScript non-null expressions are removed, but their subtrees are preserved.
return visitNonNullExpression(node);
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
// TypeScript enum declarations do not exist in ES6 and must be rewritten.
return visitEnumDeclaration(node);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
// TypeScript namespace exports for variable statements must be transformed.
return visitVariableStatement(node);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return visitVariableDeclaration(node);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
// TypeScript namespace declarations must be transformed.
return visitModuleDeclaration(node);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
// TypeScript namespace or external module import.
return visitImportEqualsDeclaration(node);
default:
@@ -67742,7 +68560,7 @@
if (ts.some(staticProperties))
facts |= 1 /* HasStaticInitializedProperties */;
var extendsClauseElement = ts.getEffectiveBaseTypeNode(node);
- if (extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 96 /* NullKeyword */)
+ if (extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 97 /* NullKeyword */)
facts |= 64 /* IsDerivedClass */;
if (shouldEmitDecorateCallForClass(node))
facts |= 2 /* HasConstructorDecorators */;
@@ -68008,7 +68826,7 @@
pendingExpressions = undefined;
var staticProperties = getInitializedProperties(node, /*isStatic*/ true);
var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause);
- var members = transformClassMembers(node, ts.some(heritageClauses, function (c) { return c.token === 86 /* ExtendsKeyword */; }));
+ var members = transformClassMembers(node, ts.some(heritageClauses, function (c) { return c.token === 87 /* ExtendsKeyword */; }));
var classExpression = ts.createClassExpression(
/*modifiers*/ undefined, node.name,
/*typeParameters*/ undefined, heritageClauses, members);
@@ -68184,7 +69002,7 @@
return index;
}
var statement = statements[index];
- if (statement.kind === 221 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) {
+ if (statement.kind === 222 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) {
result.push(ts.visitNode(statement, visitor, ts.isStatement));
return index + 1;
}
@@ -68255,7 +69073,7 @@
* @param isStatic A value indicating whether the member should be a static or instance member.
*/
function isInitializedProperty(member, isStatic) {
- return member.kind === 154 /* PropertyDeclaration */
+ return member.kind === 155 /* PropertyDeclaration */
&& isStatic === ts.hasModifier(member, 32 /* Static */)
&& member.initializer !== undefined;
}
@@ -68266,8 +69084,8 @@
* @param receiver The receiver on which each property should be assigned.
*/
function addInitializedPropertyStatements(statements, properties, receiver) {
- for (var _i = 0, properties_8 = properties; _i < properties_8.length; _i++) {
- var property = properties_8[_i];
+ for (var _i = 0, properties_6 = properties; _i < properties_6.length; _i++) {
+ var property = properties_6[_i];
var statement = ts.createExpressionStatement(transformInitializedProperty(property, receiver));
ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property));
ts.setCommentRange(statement, property);
@@ -68283,8 +69101,8 @@
*/
function generateInitializedPropertyExpressions(properties, receiver) {
var expressions = [];
- for (var _i = 0, properties_9 = properties; _i < properties_9.length; _i++) {
- var property = properties_9[_i];
+ for (var _i = 0, properties_7 = properties; _i < properties_7.length; _i++) {
+ var property = properties_7[_i];
var expression = transformInitializedProperty(property, receiver);
ts.startOnNewLine(expression);
ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property));
@@ -68398,12 +69216,12 @@
*/
function getAllDecoratorsOfClassElement(node, member) {
switch (member.kind) {
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return getAllDecoratorsOfAccessors(node, member);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return getAllDecoratorsOfMethod(member);
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return getAllDecoratorsOfProperty(member);
default:
return undefined;
@@ -68556,7 +69374,7 @@
var prefix = getClassMemberPrefix(node, member);
var memberName = getExpressionForPropertyName(member, /*generateNameForComputedPropertyName*/ true);
var descriptor = languageVersion > 0 /* ES3 */
- ? member.kind === 154 /* PropertyDeclaration */
+ ? member.kind === 155 /* PropertyDeclaration */
// We emit `void 0` here to indicate to `__decorate` that it can invoke `Object.defineProperty` directly, but that it
// should not invoke `Object.getOwnPropertyDescriptor`.
? ts.createVoidZero()
@@ -68679,10 +69497,10 @@
*/
function shouldAddTypeMetadata(node) {
var kind = node.kind;
- return kind === 156 /* MethodDeclaration */
- || kind === 158 /* GetAccessor */
- || kind === 159 /* SetAccessor */
- || kind === 154 /* PropertyDeclaration */;
+ return kind === 157 /* MethodDeclaration */
+ || kind === 159 /* GetAccessor */
+ || kind === 160 /* SetAccessor */
+ || kind === 155 /* PropertyDeclaration */;
}
/**
* Determines whether to emit the "design:returntype" metadata based on the node's kind.
@@ -68692,7 +69510,7 @@
* @param node The node to test.
*/
function shouldAddReturnTypeMetadata(node) {
- return node.kind === 156 /* MethodDeclaration */;
+ return node.kind === 157 /* MethodDeclaration */;
}
/**
* Determines whether to emit the "design:paramtypes" metadata based on the node's kind.
@@ -68703,12 +69521,12 @@
*/
function shouldAddParamTypesMetadata(node) {
switch (node.kind) {
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
return ts.getFirstConstructorWithBody(node) !== undefined;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return true;
}
return false;
@@ -68725,15 +69543,15 @@
*/
function serializeTypeOfNode(node) {
switch (node.kind) {
- case 154 /* PropertyDeclaration */:
- case 151 /* Parameter */:
+ case 155 /* PropertyDeclaration */:
+ case 152 /* Parameter */:
return serializeTypeNode(node.type);
- case 159 /* SetAccessor */:
- case 158 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 159 /* GetAccessor */:
return serializeTypeNode(getAccessorTypeNode(node));
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 156 /* MethodDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 157 /* MethodDeclaration */:
return ts.createIdentifier("Function");
default:
return ts.createVoidZero();
@@ -68770,7 +69588,7 @@
return ts.createArrayLiteral(expressions);
}
function getParametersOfDecoratedDeclaration(node, container) {
- if (container && node.kind === 158 /* GetAccessor */) {
+ if (container && node.kind === 159 /* GetAccessor */) {
var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor;
if (setAccessor) {
return setAccessor.parameters;
@@ -68815,69 +69633,69 @@
return ts.createIdentifier("Object");
}
switch (node.kind) {
- case 106 /* VoidKeyword */:
- case 141 /* UndefinedKeyword */:
- case 96 /* NullKeyword */:
- case 132 /* NeverKeyword */:
+ case 107 /* VoidKeyword */:
+ case 142 /* UndefinedKeyword */:
+ case 97 /* NullKeyword */:
+ case 133 /* NeverKeyword */:
return ts.createVoidZero();
- case 177 /* ParenthesizedType */:
+ case 178 /* ParenthesizedType */:
return serializeTypeNode(node.type);
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
return ts.createIdentifier("Function");
- case 169 /* ArrayType */:
- case 170 /* TupleType */:
+ case 170 /* ArrayType */:
+ case 171 /* TupleType */:
return ts.createIdentifier("Array");
- case 163 /* TypePredicate */:
- case 123 /* BooleanKeyword */:
+ case 164 /* TypePredicate */:
+ case 124 /* BooleanKeyword */:
return ts.createIdentifier("Boolean");
- case 138 /* StringKeyword */:
+ case 139 /* StringKeyword */:
return ts.createIdentifier("String");
- case 136 /* ObjectKeyword */:
+ case 137 /* ObjectKeyword */:
return ts.createIdentifier("Object");
- case 182 /* LiteralType */:
+ case 183 /* LiteralType */:
switch (node.literal.kind) {
case 10 /* StringLiteral */:
return ts.createIdentifier("String");
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
case 8 /* NumericLiteral */:
return ts.createIdentifier("Number");
case 9 /* BigIntLiteral */:
return getGlobalBigIntNameWithFallback();
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
return ts.createIdentifier("Boolean");
default:
return ts.Debug.failBadSyntaxKind(node.literal);
}
- case 135 /* NumberKeyword */:
+ case 136 /* NumberKeyword */:
return ts.createIdentifier("Number");
- case 146 /* BigIntKeyword */:
+ case 147 /* BigIntKeyword */:
return getGlobalBigIntNameWithFallback();
- case 139 /* SymbolKeyword */:
+ case 140 /* SymbolKeyword */:
return languageVersion < 2 /* ES2015 */
? getGlobalSymbolNameWithFallback()
: ts.createIdentifier("Symbol");
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return serializeTypeReferenceNode(node);
- case 174 /* IntersectionType */:
- case 173 /* UnionType */:
+ case 175 /* IntersectionType */:
+ case 174 /* UnionType */:
return serializeTypeList(node.types);
- case 175 /* ConditionalType */:
+ case 176 /* ConditionalType */:
return serializeTypeList([node.trueType, node.falseType]);
- case 179 /* TypeOperator */:
- if (node.operator === 133 /* ReadonlyKeyword */) {
+ case 180 /* TypeOperator */:
+ if (node.operator === 134 /* ReadonlyKeyword */) {
return serializeTypeNode(node.type);
}
break;
- case 167 /* TypeQuery */:
- case 180 /* IndexedAccessType */:
- case 181 /* MappedType */:
- case 168 /* TypeLiteral */:
- case 120 /* AnyKeyword */:
- case 143 /* UnknownKeyword */:
- case 178 /* ThisType */:
- case 183 /* ImportType */:
+ case 168 /* TypeQuery */:
+ case 181 /* IndexedAccessType */:
+ case 182 /* MappedType */:
+ case 169 /* TypeLiteral */:
+ case 121 /* AnyKeyword */:
+ case 144 /* UnknownKeyword */:
+ case 179 /* ThisType */:
+ case 184 /* ImportType */:
break;
default:
return ts.Debug.failBadSyntaxKind(node);
@@ -68888,15 +69706,15 @@
// Note when updating logic here also update getEntityNameForDecoratorMetadata
// so that aliases can be marked as referenced
var serializedUnion;
- for (var _i = 0, types_18 = types; _i < types_18.length; _i++) {
- var typeNode = types_18[_i];
- while (typeNode.kind === 177 /* ParenthesizedType */) {
+ for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
+ var typeNode = types_17[_i];
+ while (typeNode.kind === 178 /* ParenthesizedType */) {
typeNode = typeNode.type; // Skip parens if need be
}
- if (typeNode.kind === 132 /* NeverKeyword */) {
+ if (typeNode.kind === 133 /* NeverKeyword */) {
continue; // Always elide `never` from the union/intersection if possible
}
- if (!strictNullChecks && (typeNode.kind === 96 /* NullKeyword */ || typeNode.kind === 141 /* UndefinedKeyword */)) {
+ if (!strictNullChecks && (typeNode.kind === 97 /* NullKeyword */ || typeNode.kind === 142 /* UndefinedKeyword */)) {
continue; // Elide null and undefined from unions for metadata, just like what we did prior to the implementation of strict null checks
}
var serializedIndividual = serializeTypeNode(typeNode);
@@ -68976,12 +69794,12 @@
* @param node The entity name to serialize.
*/
function serializeEntityNameAsExpressionFallback(node) {
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
// A -> typeof A !== undefined && A
var copied = serializeEntityNameAsExpression(node);
return createCheckedValue(copied, copied);
}
- if (node.left.kind === 72 /* Identifier */) {
+ if (node.left.kind === 73 /* Identifier */) {
// A.B -> typeof A !== undefined && A.B
return createCheckedValue(serializeEntityNameAsExpression(node.left), serializeEntityNameAsExpression(node));
}
@@ -68997,7 +69815,7 @@
*/
function serializeEntityNameAsExpression(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
// Create a clone of the name with a new parent, and treat it as if it were
// a source tree node for the purposes of the checker.
var name = ts.getMutableClone(node);
@@ -69005,7 +69823,7 @@
name.original = undefined;
name.parent = ts.getParseTreeNode(currentLexicalScope); // ensure the parent is set to a parse tree node.
return name;
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
return serializeQualifiedNameAsExpression(node);
}
}
@@ -69031,7 +69849,7 @@
* available.
*/
function getGlobalBigIntNameWithFallback() {
- return languageVersion < 7 /* ESNext */
+ return languageVersion < 8 /* ESNext */
? ts.createConditional(ts.createTypeCheck(ts.createIdentifier("BigInt"), "function"), ts.createIdentifier("BigInt"), ts.createIdentifier("Object"))
: ts.createIdentifier("BigInt");
}
@@ -69115,7 +69933,7 @@
* @param node The HeritageClause to transform.
*/
function visitHeritageClause(node) {
- if (node.token === 109 /* ImplementsKeyword */) {
+ if (node.token === 110 /* ImplementsKeyword */) {
// implements clauses are elided
return undefined;
}
@@ -69354,7 +70172,7 @@
*/
function visitEnumDeclaration(node) {
if (!shouldEmitEnumDeclaration(node)) {
- return undefined;
+ return ts.createNotEmittedStatement(node);
}
var statements = [];
// We request to be advised when the printer is about to print this node. This allows
@@ -69522,12 +70340,12 @@
// enums in any other scope are emitted as a `let` declaration.
var statement = ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([
ts.createVariableDeclaration(ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true))
- ], currentLexicalScope.kind === 284 /* SourceFile */ ? 0 /* None */ : 1 /* Let */));
+ ], currentLexicalScope.kind === 285 /* SourceFile */ ? 0 /* None */ : 1 /* Let */));
ts.setOriginalNode(statement, node);
recordEmittedDeclarationInScope(node);
if (isFirstEmittedDeclarationInScope(node)) {
// Adjust the source map emit to match the old emitter.
- if (node.kind === 243 /* EnumDeclaration */) {
+ if (node.kind === 244 /* EnumDeclaration */) {
ts.setSourceMapRange(statement.declarationList, node);
}
else {
@@ -69652,7 +70470,7 @@
var statementsLocation;
var blockLocation;
var body = node.body;
- if (body.kind === 245 /* ModuleBlock */) {
+ if (body.kind === 246 /* ModuleBlock */) {
saveStateAndInvoke(body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); });
statementsLocation = body.statements;
blockLocation = body;
@@ -69698,13 +70516,13 @@
// })(hi = hello.hi || (hello.hi = {}));
// })(hello || (hello = {}));
// We only want to emit comment on the namespace which contains block body itself, not the containing namespaces.
- if (body.kind !== 245 /* ModuleBlock */) {
+ if (body.kind !== 246 /* ModuleBlock */) {
ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536 /* NoComments */);
}
return block;
}
function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) {
- if (moduleDeclaration.body.kind === 244 /* ModuleDeclaration */) {
+ if (moduleDeclaration.body.kind === 245 /* ModuleDeclaration */) {
var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body);
return recursiveInnerModule || moduleDeclaration.body;
}
@@ -69745,7 +70563,7 @@
* @param node The named import bindings node.
*/
function visitNamedImportBindings(node) {
- if (node.kind === 251 /* NamespaceImport */) {
+ if (node.kind === 252 /* NamespaceImport */) {
// Elide a namespace import if it is not referenced.
return resolver.isReferencedAliasDeclaration(node) ? node : undefined;
}
@@ -69958,7 +70776,7 @@
function enableSubstitutionForNonQualifiedEnumMembers() {
if ((enabledSubstitutions & 8 /* NonQualifiedEnumMembers */) === 0) {
enabledSubstitutions |= 8 /* NonQualifiedEnumMembers */;
- context.enableSubstitution(72 /* Identifier */);
+ context.enableSubstitution(73 /* Identifier */);
}
}
function enableSubstitutionForClassAliases() {
@@ -69966,7 +70784,7 @@
enabledSubstitutions |= 1 /* ClassAliases */;
// We need to enable substitutions for identifiers. This allows us to
// substitute class names inside of a class declaration.
- context.enableSubstitution(72 /* Identifier */);
+ context.enableSubstitution(73 /* Identifier */);
// Keep track of class aliases.
classAliases = [];
}
@@ -69976,17 +70794,17 @@
enabledSubstitutions |= 2 /* NamespaceExports */;
// We need to enable substitutions for identifiers and shorthand property assignments. This allows us to
// substitute the names of exported members of a namespace.
- context.enableSubstitution(72 /* Identifier */);
- context.enableSubstitution(276 /* ShorthandPropertyAssignment */);
+ context.enableSubstitution(73 /* Identifier */);
+ context.enableSubstitution(277 /* ShorthandPropertyAssignment */);
// We need to be notified when entering and exiting namespaces.
- context.enableEmitNotification(244 /* ModuleDeclaration */);
+ context.enableEmitNotification(245 /* ModuleDeclaration */);
}
}
function isTransformedModuleDeclaration(node) {
- return ts.getOriginalNode(node).kind === 244 /* ModuleDeclaration */;
+ return ts.getOriginalNode(node).kind === 245 /* ModuleDeclaration */;
}
function isTransformedEnumDeclaration(node) {
- return ts.getOriginalNode(node).kind === 243 /* EnumDeclaration */;
+ return ts.getOriginalNode(node).kind === 244 /* EnumDeclaration */;
}
/**
* Hook for node emit.
@@ -70045,11 +70863,11 @@
}
function substituteExpression(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return substituteExpressionIdentifier(node);
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return substitutePropertyAccessExpression(node);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return substituteElementAccessExpression(node);
}
return node;
@@ -70087,9 +70905,9 @@
// If we are nested within a namespace declaration, we may need to qualifiy
// an identifier that is exported from a merged namespace.
var container = resolver.getReferencedExportContainer(node, /*prefixLocals*/ false);
- if (container && container.kind !== 284 /* SourceFile */) {
- var substitute = (applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 244 /* ModuleDeclaration */) ||
- (applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 243 /* EnumDeclaration */);
+ if (container && container.kind !== 285 /* SourceFile */) {
+ var substitute = (applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 245 /* ModuleDeclaration */) ||
+ (applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 244 /* EnumDeclaration */);
if (substitute) {
return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node),
/*location*/ node);
@@ -70229,26 +71047,26 @@
return node;
}
switch (node.kind) {
- case 121 /* AsyncKeyword */:
+ case 122 /* AsyncKeyword */:
// ES2017 async modifier should be elided for targets < ES2017
return undefined;
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
return visitAwaitExpression(node);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return visitMethodDeclaration(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return visitFunctionDeclaration(node);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return visitFunctionExpression(node);
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return visitArrowFunction(node);
- case 189 /* PropertyAccessExpression */:
- if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 98 /* SuperKeyword */) {
+ case 190 /* PropertyAccessExpression */:
+ if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 99 /* SuperKeyword */) {
capturedSuperProperties.set(node.name.escapedText, true);
}
return ts.visitEachChild(node, visitor, context);
- case 190 /* ElementAccessExpression */:
- if (capturedSuperProperties && node.expression.kind === 98 /* SuperKeyword */) {
+ case 191 /* ElementAccessExpression */:
+ if (capturedSuperProperties && node.expression.kind === 99 /* SuperKeyword */) {
hasSuperElementAccess = true;
}
return ts.visitEachChild(node, visitor, context);
@@ -70259,27 +71077,27 @@
function asyncBodyVisitor(node) {
if (ts.isNodeWithPossibleHoistedDeclaration(node)) {
switch (node.kind) {
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return visitVariableStatementInAsyncBody(node);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return visitForStatementInAsyncBody(node);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return visitForInStatementInAsyncBody(node);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return visitForOfStatementInAsyncBody(node);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return visitCatchClauseInAsyncBody(node);
- case 218 /* Block */:
- case 232 /* SwitchStatement */:
- case 246 /* CaseBlock */:
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
- case 235 /* TryStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
- case 222 /* IfStatement */:
- case 231 /* WithStatement */:
- case 233 /* LabeledStatement */:
+ case 219 /* Block */:
+ case 233 /* SwitchStatement */:
+ case 247 /* CaseBlock */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
+ case 236 /* TryStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
+ case 223 /* IfStatement */:
+ case 232 /* WithStatement */:
+ case 234 /* LabeledStatement */:
return ts.visitEachChild(node, asyncBodyVisitor, context);
default:
return ts.Debug.assertNever(node, "Unhandled node.");
@@ -70480,7 +71298,7 @@
var original = ts.getOriginalNode(node, ts.isFunctionLike);
var nodeType = original.type;
var promiseConstructor = languageVersion < 2 /* ES2015 */ ? getPromiseConstructor(nodeType) : undefined;
- var isArrowFunction = node.kind === 197 /* ArrowFunction */;
+ var isArrowFunction = node.kind === 198 /* ArrowFunction */;
var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192 /* CaptureArguments */) !== 0;
// An async function is emit as an outer function that calls an inner
// generator function. To preserve lexical bindings, we pass the current
@@ -70571,17 +71389,17 @@
enabledSubstitutions |= 1 /* AsyncMethodsWithSuper */;
// We need to enable substitutions for call, property access, and element access
// if we need to rewrite super calls.
- context.enableSubstitution(191 /* CallExpression */);
- context.enableSubstitution(189 /* PropertyAccessExpression */);
- context.enableSubstitution(190 /* ElementAccessExpression */);
+ context.enableSubstitution(192 /* CallExpression */);
+ context.enableSubstitution(190 /* PropertyAccessExpression */);
+ context.enableSubstitution(191 /* ElementAccessExpression */);
// We need to be notified when entering and exiting declarations that bind super.
- context.enableEmitNotification(240 /* ClassDeclaration */);
- context.enableEmitNotification(156 /* MethodDeclaration */);
- context.enableEmitNotification(158 /* GetAccessor */);
- context.enableEmitNotification(159 /* SetAccessor */);
- context.enableEmitNotification(157 /* Constructor */);
+ context.enableEmitNotification(241 /* ClassDeclaration */);
+ context.enableEmitNotification(157 /* MethodDeclaration */);
+ context.enableEmitNotification(159 /* GetAccessor */);
+ context.enableEmitNotification(160 /* SetAccessor */);
+ context.enableEmitNotification(158 /* Constructor */);
// We need to be notified when entering the generated accessor arrow functions.
- context.enableEmitNotification(219 /* VariableStatement */);
+ context.enableEmitNotification(220 /* VariableStatement */);
}
}
/**
@@ -70629,23 +71447,23 @@
}
function substituteExpression(node) {
switch (node.kind) {
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return substitutePropertyAccessExpression(node);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return substituteElementAccessExpression(node);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return substituteCallExpression(node);
}
return node;
}
function substitutePropertyAccessExpression(node) {
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
return ts.setTextRange(ts.createPropertyAccess(ts.createFileLevelUniqueName("_super"), node.name), node);
}
return node;
}
function substituteElementAccessExpression(node) {
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
return createSuperElementAccessInAsyncMethod(node.argumentExpression, node);
}
return node;
@@ -70665,11 +71483,11 @@
}
function isSuperContainer(node) {
var kind = node.kind;
- return kind === 240 /* ClassDeclaration */
- || kind === 157 /* Constructor */
- || kind === 156 /* MethodDeclaration */
- || kind === 158 /* GetAccessor */
- || kind === 159 /* SetAccessor */;
+ return kind === 241 /* ClassDeclaration */
+ || kind === 158 /* Constructor */
+ || kind === 157 /* MethodDeclaration */
+ || kind === 159 /* GetAccessor */
+ || kind === 160 /* SetAccessor */;
}
function createSuperElementAccessInAsyncMethod(argumentExpression, location) {
if (enclosingSuperContainerFlags & 4096 /* AsyncMethodWithSuperBinding */) {
@@ -70804,7 +71622,7 @@
return visitorWorker(node, /*noDestructuringValue*/ true);
}
function visitorNoAsyncModifier(node) {
- if (node.kind === 121 /* AsyncKeyword */) {
+ if (node.kind === 122 /* AsyncKeyword */) {
return undefined;
}
return node;
@@ -70814,53 +71632,55 @@
return node;
}
switch (node.kind) {
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
return visitAwaitExpression(node);
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return visitYieldExpression(node);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return visitReturnStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return visitLabeledStatement(node);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return visitObjectLiteralExpression(node);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return visitBinaryExpression(node, noDestructuringValue);
- case 237 /* VariableDeclaration */:
+ case 275 /* CatchClause */:
+ return visitCatchClause(node);
+ case 238 /* VariableDeclaration */:
return visitVariableDeclaration(node);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return visitForStatement(node);
- case 200 /* VoidExpression */:
+ case 201 /* VoidExpression */:
return visitVoidExpression(node);
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return visitConstructorDeclaration(node);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return visitMethodDeclaration(node);
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
return visitGetAccessorDeclaration(node);
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
return visitSetAccessorDeclaration(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return visitFunctionDeclaration(node);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return visitFunctionExpression(node);
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return visitArrowFunction(node);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return visitParameter(node);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return visitExpressionStatement(node);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return visitParenthesizedExpression(node, noDestructuringValue);
- case 189 /* PropertyAccessExpression */:
- if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 98 /* SuperKeyword */) {
+ case 190 /* PropertyAccessExpression */:
+ if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 99 /* SuperKeyword */) {
capturedSuperProperties.set(node.name.escapedText, true);
}
return ts.visitEachChild(node, visitor, context);
- case 190 /* ElementAccessExpression */:
- if (capturedSuperProperties && node.expression.kind === 98 /* SuperKeyword */) {
+ case 191 /* ElementAccessExpression */:
+ if (capturedSuperProperties && node.expression.kind === 99 /* SuperKeyword */) {
hasSuperElementAccess = true;
}
return ts.visitEachChild(node, visitor, context);
@@ -70896,7 +71716,7 @@
function visitLabeledStatement(node) {
if (enclosingFunctionFlags & 2 /* Async */) {
var statement = ts.unwrapInnermostStatementOfLabel(node);
- if (statement.kind === 227 /* ForOfStatement */ && statement.awaitModifier) {
+ if (statement.kind === 228 /* ForOfStatement */ && statement.awaitModifier) {
return visitForOfStatement(statement, node);
}
return ts.restoreEnclosingLabel(ts.visitEachChild(statement, visitor, context), node);
@@ -70908,7 +71728,7 @@
var objects = [];
for (var _i = 0, elements_4 = elements; _i < elements_4.length; _i++) {
var e = elements_4[_i];
- if (e.kind === 277 /* SpreadAssignment */) {
+ if (e.kind === 278 /* SpreadAssignment */) {
if (chunkObject) {
objects.push(ts.createObjectLiteral(chunkObject));
chunkObject = undefined;
@@ -70917,7 +71737,7 @@
objects.push(ts.visitNode(target, visitor, ts.isExpression));
}
else {
- chunkObject = ts.append(chunkObject, e.kind === 275 /* PropertyAssignment */
+ chunkObject = ts.append(chunkObject, e.kind === 276 /* PropertyAssignment */
? ts.createPropertyAssignment(e.name, ts.visitNode(e.initializer, visitor, ts.isExpression))
: ts.visitNode(e, visitor, ts.isObjectLiteralElementLike));
}
@@ -70935,7 +71755,7 @@
// If the first element is a spread element, then the first argument to __assign is {}:
// { ...o, a, b, ...o2 } => __assign({}, o, {a, b}, o2)
var objects = chunkObjectLiteralElements(node.properties);
- if (objects.length && objects[0].kind !== 188 /* ObjectLiteralExpression */) {
+ if (objects.length && objects[0].kind !== 189 /* ObjectLiteralExpression */) {
objects.unshift(ts.createObjectLiteral());
}
return createAssignHelper(context, objects);
@@ -70962,6 +71782,23 @@
}
return ts.visitEachChild(node, visitor, context);
}
+ function visitCatchClause(node) {
+ if (node.variableDeclaration &&
+ ts.isBindingPattern(node.variableDeclaration.name) &&
+ node.variableDeclaration.name.transformFlags & 8192 /* ContainsObjectRestOrSpread */) {
+ var name = ts.getGeneratedNameForNode(node.variableDeclaration.name);
+ var updatedDecl = ts.updateVariableDeclaration(node.variableDeclaration, node.variableDeclaration.name, /*type*/ undefined, name);
+ var visitedBindings = ts.flattenDestructuringBinding(updatedDecl, visitor, context, 1 /* ObjectRest */);
+ var block = ts.visitNode(node.block, visitor, ts.isBlock);
+ if (ts.some(visitedBindings)) {
+ block = ts.updateBlock(block, [
+ ts.createVariableStatement(/*modifiers*/ undefined, visitedBindings)
+ ].concat(block.statements));
+ }
+ return ts.updateCatchClause(node, ts.updateVariableDeclaration(node.variableDeclaration, name, /*type*/ undefined, /*initializer*/ undefined), block);
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
/**
* Visits a VariableDeclaration node with a binding pattern.
*
@@ -71254,17 +72091,17 @@
enabledSubstitutions |= 1 /* AsyncMethodsWithSuper */;
// We need to enable substitutions for call, property access, and element access
// if we need to rewrite super calls.
- context.enableSubstitution(191 /* CallExpression */);
- context.enableSubstitution(189 /* PropertyAccessExpression */);
- context.enableSubstitution(190 /* ElementAccessExpression */);
+ context.enableSubstitution(192 /* CallExpression */);
+ context.enableSubstitution(190 /* PropertyAccessExpression */);
+ context.enableSubstitution(191 /* ElementAccessExpression */);
// We need to be notified when entering and exiting declarations that bind super.
- context.enableEmitNotification(240 /* ClassDeclaration */);
- context.enableEmitNotification(156 /* MethodDeclaration */);
- context.enableEmitNotification(158 /* GetAccessor */);
- context.enableEmitNotification(159 /* SetAccessor */);
- context.enableEmitNotification(157 /* Constructor */);
+ context.enableEmitNotification(241 /* ClassDeclaration */);
+ context.enableEmitNotification(157 /* MethodDeclaration */);
+ context.enableEmitNotification(159 /* GetAccessor */);
+ context.enableEmitNotification(160 /* SetAccessor */);
+ context.enableEmitNotification(158 /* Constructor */);
// We need to be notified when entering the generated accessor arrow functions.
- context.enableEmitNotification(219 /* VariableStatement */);
+ context.enableEmitNotification(220 /* VariableStatement */);
}
}
/**
@@ -71312,23 +72149,23 @@
}
function substituteExpression(node) {
switch (node.kind) {
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return substitutePropertyAccessExpression(node);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return substituteElementAccessExpression(node);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return substituteCallExpression(node);
}
return node;
}
function substitutePropertyAccessExpression(node) {
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
return ts.setTextRange(ts.createPropertyAccess(ts.createFileLevelUniqueName("_super"), node.name), node);
}
return node;
}
function substituteElementAccessExpression(node) {
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
return createSuperElementAccessInAsyncMethod(node.argumentExpression, node);
}
return node;
@@ -71348,11 +72185,11 @@
}
function isSuperContainer(node) {
var kind = node.kind;
- return kind === 240 /* ClassDeclaration */
- || kind === 157 /* Constructor */
- || kind === 156 /* MethodDeclaration */
- || kind === 158 /* GetAccessor */
- || kind === 159 /* SetAccessor */;
+ return kind === 241 /* ClassDeclaration */
+ || kind === 158 /* Constructor */
+ || kind === 157 /* MethodDeclaration */
+ || kind === 159 /* GetAccessor */
+ || kind === 160 /* SetAccessor */;
}
function createSuperElementAccessInAsyncMethod(argumentExpression, location) {
if (enclosingSuperContainerFlags & 4096 /* AsyncMethodWithSuperBinding */) {
@@ -71446,7 +72283,7 @@
return node;
}
switch (node.kind) {
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return visitCatchClause(node);
default:
return ts.visitEachChild(node, visitor, context);
@@ -71515,13 +72352,13 @@
}
function visitorWorker(node) {
switch (node.kind) {
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
return visitJsxElement(node, /*isChild*/ false);
- case 261 /* JsxSelfClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
return visitJsxSelfClosingElement(node, /*isChild*/ false);
- case 264 /* JsxFragment */:
+ case 265 /* JsxFragment */:
return visitJsxFragment(node, /*isChild*/ false);
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return visitJsxExpression(node);
default:
return ts.visitEachChild(node, visitor, context);
@@ -71531,13 +72368,13 @@
switch (node.kind) {
case 11 /* JsxText */:
return visitJsxText(node);
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return visitJsxExpression(node);
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
return visitJsxElement(node, /*isChild*/ true);
- case 261 /* JsxSelfClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
return visitJsxSelfClosingElement(node, /*isChild*/ true);
- case 264 /* JsxFragment */:
+ case 265 /* JsxFragment */:
return visitJsxFragment(node, /*isChild*/ true);
default:
return ts.Debug.failBadSyntaxKind(node);
@@ -71612,7 +72449,7 @@
literal.singleQuote = node.singleQuote !== undefined ? node.singleQuote : !ts.isStringDoubleQuoted(node, currentSourceFile);
return ts.setTextRange(literal, node);
}
- else if (node.kind === 270 /* JsxExpression */) {
+ else if (node.kind === 271 /* JsxExpression */) {
if (node.expression === undefined) {
return ts.createTrue();
}
@@ -71706,7 +72543,7 @@
return decoded === text ? undefined : decoded;
}
function getTagName(node) {
- if (node.kind === 260 /* JsxElement */) {
+ if (node.kind === 261 /* JsxElement */) {
return getTagName(node.openingElement);
}
else {
@@ -72012,7 +72849,7 @@
return node;
}
switch (node.kind) {
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return visitBinaryExpression(node);
default:
return ts.visitEachChild(node, visitor, context);
@@ -72020,7 +72857,7 @@
}
function visitBinaryExpression(node) {
switch (node.operatorToken.kind) {
- case 63 /* AsteriskAsteriskEqualsToken */:
+ case 64 /* AsteriskAsteriskEqualsToken */:
return visitExponentiationAssignmentExpression(node);
case 41 /* AsteriskAsteriskToken */:
return visitExponentiationExpression(node);
@@ -72105,62 +72942,63 @@
HierarchyFacts[HierarchyFacts["Block"] = 128] = "Block";
HierarchyFacts[HierarchyFacts["IterationStatement"] = 256] = "IterationStatement";
HierarchyFacts[HierarchyFacts["IterationStatementBlock"] = 512] = "IterationStatementBlock";
- HierarchyFacts[HierarchyFacts["ForStatement"] = 1024] = "ForStatement";
- HierarchyFacts[HierarchyFacts["ForInOrForOfStatement"] = 2048] = "ForInOrForOfStatement";
- HierarchyFacts[HierarchyFacts["ConstructorWithCapturedSuper"] = 4096] = "ConstructorWithCapturedSuper";
+ HierarchyFacts[HierarchyFacts["IterationContainer"] = 1024] = "IterationContainer";
+ HierarchyFacts[HierarchyFacts["ForStatement"] = 2048] = "ForStatement";
+ HierarchyFacts[HierarchyFacts["ForInOrForOfStatement"] = 4096] = "ForInOrForOfStatement";
+ HierarchyFacts[HierarchyFacts["ConstructorWithCapturedSuper"] = 8192] = "ConstructorWithCapturedSuper";
// NOTE: do not add more ancestor flags without also updating AncestorFactsMask below.
// NOTE: when adding a new ancestor flag, be sure to update the subtree flags below.
//
// Ancestor masks
//
- HierarchyFacts[HierarchyFacts["AncestorFactsMask"] = 8191] = "AncestorFactsMask";
+ HierarchyFacts[HierarchyFacts["AncestorFactsMask"] = 16383] = "AncestorFactsMask";
// We are always in *some* kind of block scope, but only specific block-scope containers are
// top-level or Blocks.
HierarchyFacts[HierarchyFacts["BlockScopeIncludes"] = 0] = "BlockScopeIncludes";
- HierarchyFacts[HierarchyFacts["BlockScopeExcludes"] = 4032] = "BlockScopeExcludes";
+ HierarchyFacts[HierarchyFacts["BlockScopeExcludes"] = 7104] = "BlockScopeExcludes";
// A source file is a top-level block scope.
HierarchyFacts[HierarchyFacts["SourceFileIncludes"] = 64] = "SourceFileIncludes";
- HierarchyFacts[HierarchyFacts["SourceFileExcludes"] = 3968] = "SourceFileExcludes";
+ HierarchyFacts[HierarchyFacts["SourceFileExcludes"] = 8064] = "SourceFileExcludes";
// Functions, methods, and accessors are both new lexical scopes and new block scopes.
HierarchyFacts[HierarchyFacts["FunctionIncludes"] = 65] = "FunctionIncludes";
- HierarchyFacts[HierarchyFacts["FunctionExcludes"] = 8094] = "FunctionExcludes";
+ HierarchyFacts[HierarchyFacts["FunctionExcludes"] = 16286] = "FunctionExcludes";
HierarchyFacts[HierarchyFacts["AsyncFunctionBodyIncludes"] = 69] = "AsyncFunctionBodyIncludes";
- HierarchyFacts[HierarchyFacts["AsyncFunctionBodyExcludes"] = 8086] = "AsyncFunctionBodyExcludes";
+ HierarchyFacts[HierarchyFacts["AsyncFunctionBodyExcludes"] = 16278] = "AsyncFunctionBodyExcludes";
// Arrow functions are lexically scoped to their container, but are new block scopes.
HierarchyFacts[HierarchyFacts["ArrowFunctionIncludes"] = 66] = "ArrowFunctionIncludes";
- HierarchyFacts[HierarchyFacts["ArrowFunctionExcludes"] = 8064] = "ArrowFunctionExcludes";
+ HierarchyFacts[HierarchyFacts["ArrowFunctionExcludes"] = 15232] = "ArrowFunctionExcludes";
// Constructors are both new lexical scopes and new block scopes. Constructors are also
// always considered non-static members of a class.
HierarchyFacts[HierarchyFacts["ConstructorIncludes"] = 73] = "ConstructorIncludes";
- HierarchyFacts[HierarchyFacts["ConstructorExcludes"] = 8086] = "ConstructorExcludes";
+ HierarchyFacts[HierarchyFacts["ConstructorExcludes"] = 16278] = "ConstructorExcludes";
// 'do' and 'while' statements are not block scopes. We track that the subtree is contained
// within an IterationStatement to indicate whether the embedded statement is an
// IterationStatementBlock.
- HierarchyFacts[HierarchyFacts["DoOrWhileStatementIncludes"] = 256] = "DoOrWhileStatementIncludes";
+ HierarchyFacts[HierarchyFacts["DoOrWhileStatementIncludes"] = 1280] = "DoOrWhileStatementIncludes";
HierarchyFacts[HierarchyFacts["DoOrWhileStatementExcludes"] = 0] = "DoOrWhileStatementExcludes";
// 'for' statements are new block scopes and have special handling for 'let' declarations.
- HierarchyFacts[HierarchyFacts["ForStatementIncludes"] = 1280] = "ForStatementIncludes";
- HierarchyFacts[HierarchyFacts["ForStatementExcludes"] = 3008] = "ForStatementExcludes";
+ HierarchyFacts[HierarchyFacts["ForStatementIncludes"] = 3328] = "ForStatementIncludes";
+ HierarchyFacts[HierarchyFacts["ForStatementExcludes"] = 5056] = "ForStatementExcludes";
// 'for-in' and 'for-of' statements are new block scopes and have special handling for
// 'let' declarations.
- HierarchyFacts[HierarchyFacts["ForInOrForOfStatementIncludes"] = 2304] = "ForInOrForOfStatementIncludes";
- HierarchyFacts[HierarchyFacts["ForInOrForOfStatementExcludes"] = 1984] = "ForInOrForOfStatementExcludes";
+ HierarchyFacts[HierarchyFacts["ForInOrForOfStatementIncludes"] = 5376] = "ForInOrForOfStatementIncludes";
+ HierarchyFacts[HierarchyFacts["ForInOrForOfStatementExcludes"] = 3008] = "ForInOrForOfStatementExcludes";
// Blocks (other than function bodies) are new block scopes.
HierarchyFacts[HierarchyFacts["BlockIncludes"] = 128] = "BlockIncludes";
- HierarchyFacts[HierarchyFacts["BlockExcludes"] = 3904] = "BlockExcludes";
+ HierarchyFacts[HierarchyFacts["BlockExcludes"] = 6976] = "BlockExcludes";
HierarchyFacts[HierarchyFacts["IterationStatementBlockIncludes"] = 512] = "IterationStatementBlockIncludes";
- HierarchyFacts[HierarchyFacts["IterationStatementBlockExcludes"] = 4032] = "IterationStatementBlockExcludes";
+ HierarchyFacts[HierarchyFacts["IterationStatementBlockExcludes"] = 7104] = "IterationStatementBlockExcludes";
//
// Subtree facts
//
- HierarchyFacts[HierarchyFacts["NewTarget"] = 8192] = "NewTarget";
- HierarchyFacts[HierarchyFacts["CapturedLexicalThis"] = 16384] = "CapturedLexicalThis";
+ HierarchyFacts[HierarchyFacts["NewTarget"] = 16384] = "NewTarget";
+ HierarchyFacts[HierarchyFacts["CapturedLexicalThis"] = 32768] = "CapturedLexicalThis";
//
// Subtree masks
//
- HierarchyFacts[HierarchyFacts["SubtreeFactsMask"] = -8192] = "SubtreeFactsMask";
+ HierarchyFacts[HierarchyFacts["SubtreeFactsMask"] = -16384] = "SubtreeFactsMask";
HierarchyFacts[HierarchyFacts["ArrowFunctionSubtreeExcludes"] = 0] = "ArrowFunctionSubtreeExcludes";
- HierarchyFacts[HierarchyFacts["FunctionSubtreeExcludes"] = 24576] = "FunctionSubtreeExcludes";
+ HierarchyFacts[HierarchyFacts["FunctionSubtreeExcludes"] = 49152] = "FunctionSubtreeExcludes";
})(HierarchyFacts || (HierarchyFacts = {}));
function transformES2015(context) {
var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
@@ -72209,7 +73047,7 @@
*/
function enterSubtree(excludeFacts, includeFacts) {
var ancestorFacts = hierarchyFacts;
- hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & 8191 /* AncestorFactsMask */;
+ hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & 16383 /* AncestorFactsMask */;
return ancestorFacts;
}
/**
@@ -72220,17 +73058,17 @@
* @param includeFacts The new `HierarchyFacts` of the subtree that should be propagated.
*/
function exitSubtree(ancestorFacts, excludeFacts, includeFacts) {
- hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & -8192 /* SubtreeFactsMask */ | ancestorFacts;
+ hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & -16384 /* SubtreeFactsMask */ | ancestorFacts;
}
function isReturnVoidStatementInConstructorWithCapturedSuper(node) {
- return (hierarchyFacts & 4096 /* ConstructorWithCapturedSuper */) !== 0
- && node.kind === 230 /* ReturnStatement */
+ return (hierarchyFacts & 8192 /* ConstructorWithCapturedSuper */) !== 0
+ && node.kind === 231 /* ReturnStatement */
&& !node.expression;
}
function shouldVisitNode(node) {
return (node.transformFlags & 128 /* ContainsES2015 */) !== 0
|| convertedLoopState !== undefined
- || (hierarchyFacts & 4096 /* ConstructorWithCapturedSuper */ && (ts.isStatement(node) || (node.kind === 218 /* Block */)))
+ || (hierarchyFacts & 8192 /* ConstructorWithCapturedSuper */ && (ts.isStatement(node) || (node.kind === 219 /* Block */)))
|| (ts.isIterationStatement(node, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatement(node))
|| (ts.getEmitFlags(node) & 33554432 /* TypeScriptClassWrapper */) !== 0;
}
@@ -72243,72 +73081,72 @@
}
}
function callExpressionVisitor(node) {
- if (node.kind === 98 /* SuperKeyword */) {
+ if (node.kind === 99 /* SuperKeyword */) {
return visitSuperKeyword(/*isExpressionOfCall*/ true);
}
return visitor(node);
}
function visitJavaScript(node) {
switch (node.kind) {
- case 116 /* StaticKeyword */:
+ case 117 /* StaticKeyword */:
return undefined; // elide static keyword
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return visitClassDeclaration(node);
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
return visitClassExpression(node);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return visitParameter(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return visitFunctionDeclaration(node);
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return visitArrowFunction(node);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return visitFunctionExpression(node);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return visitVariableDeclaration(node);
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return visitIdentifier(node);
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
return visitVariableDeclarationList(node);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return visitSwitchStatement(node);
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
return visitCaseBlock(node);
- case 218 /* Block */:
+ case 219 /* Block */:
return visitBlock(node, /*isFunctionBody*/ false);
- case 229 /* BreakStatement */:
- case 228 /* ContinueStatement */:
+ case 230 /* BreakStatement */:
+ case 229 /* ContinueStatement */:
return visitBreakOrContinueStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return visitLabeledStatement(node);
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
return visitDoOrWhileStatement(node, /*outermostLabeledStatement*/ undefined);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return visitForStatement(node, /*outermostLabeledStatement*/ undefined);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return visitForInStatement(node, /*outermostLabeledStatement*/ undefined);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return visitExpressionStatement(node);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return visitObjectLiteralExpression(node);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return visitCatchClause(node);
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return visitShorthandPropertyAssignment(node);
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
return visitComputedPropertyName(node);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return visitArrayLiteralExpression(node);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return visitCallExpression(node);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return visitNewExpression(node);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return visitParenthesizedExpression(node, /*needsDestructuringValue*/ true);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return visitBinaryExpression(node, /*needsDestructuringValue*/ true);
case 14 /* NoSubstitutionTemplateLiteral */:
case 15 /* TemplateHead */:
@@ -72319,35 +73157,35 @@
return visitStringLiteral(node);
case 8 /* NumericLiteral */:
return visitNumericLiteral(node);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return visitTaggedTemplateExpression(node);
- case 206 /* TemplateExpression */:
+ case 207 /* TemplateExpression */:
return visitTemplateExpression(node);
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return visitYieldExpression(node);
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
return visitSpreadElement(node);
- case 98 /* SuperKeyword */:
+ case 99 /* SuperKeyword */:
return visitSuperKeyword(/*isExpressionOfCall*/ false);
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
return visitThisKeyword(node);
- case 214 /* MetaProperty */:
+ case 215 /* MetaProperty */:
return visitMetaProperty(node);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return visitMethodDeclaration(node);
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return visitAccessorDeclaration(node);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return visitVariableStatement(node);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return visitReturnStatement(node);
default:
return ts.visitEachChild(node, visitor, context);
}
}
function visitSourceFile(node) {
- var ancestorFacts = enterSubtree(3968 /* SourceFileExcludes */, 64 /* SourceFileIncludes */);
+ var ancestorFacts = enterSubtree(8064 /* SourceFileExcludes */, 64 /* SourceFileIncludes */);
var prologue = [];
var statements = [];
startLexicalEnvironment();
@@ -72374,7 +73212,7 @@
return ts.visitEachChild(node, visitor, context);
}
function visitCaseBlock(node) {
- var ancestorFacts = enterSubtree(4032 /* BlockScopeExcludes */, 0 /* BlockScopeIncludes */);
+ var ancestorFacts = enterSubtree(7104 /* BlockScopeExcludes */, 0 /* BlockScopeIncludes */);
var updated = ts.visitEachChild(node, visitor, context);
exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */);
return updated;
@@ -72401,7 +73239,7 @@
}
function visitThisKeyword(node) {
if (hierarchyFacts & 2 /* ArrowFunction */) {
- hierarchyFacts |= 16384 /* CapturedLexicalThis */;
+ hierarchyFacts |= 32768 /* CapturedLexicalThis */;
}
if (convertedLoopState) {
if (hierarchyFacts & 2 /* ArrowFunction */) {
@@ -72431,14 +73269,14 @@
// it is possible if either
// - break/continue is labeled and label is located inside the converted loop
// - break/continue is non-labeled and located in non-converted loop/switch statement
- var jump = node.kind === 229 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */;
+ var jump = node.kind === 230 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */;
var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels.get(ts.idText(node.label))) ||
(!node.label && (convertedLoopState.allowedNonLabeledJumps & jump));
if (!canUseBreakOrContinue) {
var labelMarker = void 0;
var label = node.label;
if (!label) {
- if (node.kind === 229 /* BreakStatement */) {
+ if (node.kind === 230 /* BreakStatement */) {
convertedLoopState.nonLocalJumps |= 2 /* Break */;
labelMarker = "break";
}
@@ -72449,7 +73287,7 @@
}
}
else {
- if (node.kind === 229 /* BreakStatement */) {
+ if (node.kind === 230 /* BreakStatement */) {
labelMarker = "break-" + label.escapedText;
setLabeledJump(convertedLoopState, /*isBreak*/ true, ts.idText(label), labelMarker);
}
@@ -72644,7 +73482,7 @@
function addConstructor(statements, node, extendsClauseElement) {
var savedConvertedLoopState = convertedLoopState;
convertedLoopState = undefined;
- var ancestorFacts = enterSubtree(8086 /* ConstructorExcludes */, 73 /* ConstructorIncludes */);
+ var ancestorFacts = enterSubtree(16278 /* ConstructorExcludes */, 73 /* ConstructorIncludes */);
var constructor = ts.getFirstConstructorWithBody(node);
var hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== undefined);
var constructorFunction = ts.createFunctionDeclaration(
@@ -72658,7 +73496,7 @@
ts.setEmitFlags(constructorFunction, 8 /* CapturesThis */);
}
statements.push(constructorFunction);
- exitSubtree(ancestorFacts, 24576 /* FunctionSubtreeExcludes */, 0 /* None */);
+ exitSubtree(ancestorFacts, 49152 /* FunctionSubtreeExcludes */, 0 /* None */);
convertedLoopState = savedConvertedLoopState;
}
/**
@@ -72707,7 +73545,7 @@
function transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper) {
// determine whether the class is known syntactically to be a derived class (e.g. a
// class that extends a value that is not syntactically known to be `null`).
- var isDerivedClass = !!extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 96 /* NullKeyword */;
+ var isDerivedClass = !!extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 97 /* NullKeyword */;
// When the subclass does not have a constructor, we synthesize a *default* constructor using the following
// representation:
//
@@ -72751,7 +73589,7 @@
}
}
if (superCallExpression) {
- hierarchyFacts |= 4096 /* ConstructorWithCapturedSuper */;
+ hierarchyFacts |= 8192 /* ConstructorWithCapturedSuper */;
statementOffset++; // skip this statement, we will add it after visiting the rest of the body.
}
// visit the remaining statements
@@ -72845,11 +73683,11 @@
*/
function isSufficientlyCoveredByReturnStatements(statement) {
// A return statement is considered covered.
- if (statement.kind === 230 /* ReturnStatement */) {
+ if (statement.kind === 231 /* ReturnStatement */) {
return true;
}
// An if-statement with two covered branches is covered.
- else if (statement.kind === 222 /* IfStatement */) {
+ else if (statement.kind === 223 /* IfStatement */) {
var ifStatement = statement;
if (ifStatement.elseStatement) {
return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) &&
@@ -72857,7 +73695,7 @@
}
}
// A block is covered if it has a last statement which is covered.
- else if (statement.kind === 218 /* Block */) {
+ else if (statement.kind === 219 /* Block */) {
var lastStatement = ts.lastOrUndefined(statement.statements);
if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) {
return true;
@@ -73012,10 +73850,10 @@
return false;
}
// `declarationName` is the name of the local declaration for the parameter.
- var declarationName = parameter.name.kind === 72 /* Identifier */ ? ts.getMutableClone(parameter.name) : ts.createTempVariable(/*recordTempVariable*/ undefined);
+ var declarationName = parameter.name.kind === 73 /* Identifier */ ? ts.getMutableClone(parameter.name) : ts.createTempVariable(/*recordTempVariable*/ undefined);
ts.setEmitFlags(declarationName, 48 /* NoSourceMap */);
// `expressionName` is the name of the parameter used in expressions.
- var expressionName = parameter.name.kind === 72 /* Identifier */ ? ts.getSynthesizedClone(parameter.name) : declarationName;
+ var expressionName = parameter.name.kind === 73 /* Identifier */ ? ts.getSynthesizedClone(parameter.name) : declarationName;
var restIndex = node.parameters.length - 1;
var temp = ts.createLoopVariable();
// var param = [];
@@ -73039,7 +73877,7 @@
ts.setEmitFlags(forStatement, 1048576 /* CustomPrologue */);
ts.startOnNewLine(forStatement);
prologueStatements.push(forStatement);
- if (parameter.name.kind !== 72 /* Identifier */) {
+ if (parameter.name.kind !== 73 /* Identifier */) {
// do the actual destructuring of the rest parameter if necessary
prologueStatements.push(ts.setEmitFlags(ts.setTextRange(ts.createVariableStatement(
/*modifiers*/ undefined, ts.createVariableDeclarationList(ts.flattenDestructuringBinding(parameter, visitor, context, 0 /* All */, expressionName))), parameter), 1048576 /* CustomPrologue */));
@@ -73055,7 +73893,7 @@
* @param node A node.
*/
function insertCaptureThisForNodeIfNeeded(statements, node) {
- if (hierarchyFacts & 16384 /* CapturedLexicalThis */ && node.kind !== 197 /* ArrowFunction */) {
+ if (hierarchyFacts & 32768 /* CapturedLexicalThis */ && node.kind !== 198 /* ArrowFunction */) {
insertCaptureThisForNode(statements, node, ts.createThis());
return true;
}
@@ -73073,28 +73911,28 @@
ts.insertStatementAfterCustomPrologue(statements, captureThisStatement);
}
function insertCaptureNewTargetIfNeeded(statements, node, copyOnWrite) {
- if (hierarchyFacts & 8192 /* NewTarget */) {
+ if (hierarchyFacts & 16384 /* NewTarget */) {
var newTarget = void 0;
switch (node.kind) {
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return statements;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
// Methods and accessors cannot be constructors, so 'new.target' will
// always return 'undefined'.
newTarget = ts.createVoidZero();
break;
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
// Class constructors can only be called with `new`, so `this.constructor`
// should be relatively safe to use.
newTarget = ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), "constructor");
break;
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
// Functions can be called or constructed, and may have a `this` due to
// being a member or when calling an imported function via `other_1.f()`.
- newTarget = ts.createConditional(ts.createLogicalAnd(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), ts.createBinary(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), 94 /* InstanceOfKeyword */, ts.getLocalName(node))), ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), "constructor"), ts.createVoidZero());
+ newTarget = ts.createConditional(ts.createLogicalAnd(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), ts.createBinary(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), 95 /* InstanceOfKeyword */, ts.getLocalName(node))), ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), "constructor"), ts.createVoidZero());
break;
default:
return ts.Debug.failBadSyntaxKind(node);
@@ -73123,20 +73961,20 @@
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
switch (member.kind) {
- case 217 /* SemicolonClassElement */:
+ case 218 /* SemicolonClassElement */:
statements.push(transformSemicolonClassElementToStatement(member));
break;
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node));
break;
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
var accessors = ts.getAllAccessorDeclarations(node.members, member);
if (member === accessors.firstAccessor) {
statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node));
}
break;
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
// Constructors are handled in visitClassExpression/visitClassDeclaration
break;
default:
@@ -73203,7 +74041,7 @@
// arguments are both mapped contiguously to the accessor name.
var target = ts.getMutableClone(receiver);
ts.setEmitFlags(target, 1536 /* NoComments */ | 32 /* NoTrailingSourceMap */);
- ts.setSourceMapRange(target, firstAccessor.name); // TODO: GH#18217
+ ts.setSourceMapRange(target, firstAccessor.name);
var propertyName = ts.createExpressionForPropertyName(ts.visitNode(firstAccessor.name, visitor, ts.isPropertyName));
ts.setEmitFlags(propertyName, 1536 /* NoComments */ | 16 /* NoLeadingSourceMap */);
ts.setSourceMapRange(propertyName, firstAccessor.name);
@@ -73243,11 +74081,11 @@
*/
function visitArrowFunction(node) {
if (node.transformFlags & 2048 /* ContainsLexicalThis */) {
- hierarchyFacts |= 16384 /* CapturedLexicalThis */;
+ hierarchyFacts |= 32768 /* CapturedLexicalThis */;
}
var savedConvertedLoopState = convertedLoopState;
convertedLoopState = undefined;
- var ancestorFacts = enterSubtree(8064 /* ArrowFunctionExcludes */, 66 /* ArrowFunctionIncludes */);
+ var ancestorFacts = enterSubtree(15232 /* ArrowFunctionExcludes */, 66 /* ArrowFunctionIncludes */);
var func = ts.createFunctionExpression(
/*modifiers*/ undefined,
/*asteriskToken*/ undefined,
@@ -73257,7 +74095,7 @@
ts.setTextRange(func, node);
ts.setOriginalNode(func, node);
ts.setEmitFlags(func, 8 /* CapturesThis */);
- if (hierarchyFacts & 16384 /* CapturedLexicalThis */) {
+ if (hierarchyFacts & 32768 /* CapturedLexicalThis */) {
enableSubstitutionsForCapturedThis();
}
// If an arrow function contains
@@ -73272,16 +74110,16 @@
*/
function visitFunctionExpression(node) {
var ancestorFacts = ts.getEmitFlags(node) & 262144 /* AsyncFunctionBody */
- ? enterSubtree(8086 /* AsyncFunctionBodyExcludes */, 69 /* AsyncFunctionBodyIncludes */)
- : enterSubtree(8094 /* FunctionExcludes */, 65 /* FunctionIncludes */);
+ ? enterSubtree(16278 /* AsyncFunctionBodyExcludes */, 69 /* AsyncFunctionBodyIncludes */)
+ : enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */);
var savedConvertedLoopState = convertedLoopState;
convertedLoopState = undefined;
var parameters = ts.visitParameterList(node.parameters, visitor, context);
var body = transformFunctionBody(node);
- var name = hierarchyFacts & 8192 /* NewTarget */
+ var name = hierarchyFacts & 16384 /* NewTarget */
? ts.getLocalName(node)
: node.name;
- exitSubtree(ancestorFacts, 24576 /* FunctionSubtreeExcludes */, 0 /* None */);
+ exitSubtree(ancestorFacts, 49152 /* FunctionSubtreeExcludes */, 0 /* None */);
convertedLoopState = savedConvertedLoopState;
return ts.updateFunctionExpression(node,
/*modifiers*/ undefined, node.asteriskToken, name,
@@ -73296,13 +74134,13 @@
function visitFunctionDeclaration(node) {
var savedConvertedLoopState = convertedLoopState;
convertedLoopState = undefined;
- var ancestorFacts = enterSubtree(8094 /* FunctionExcludes */, 65 /* FunctionIncludes */);
+ var ancestorFacts = enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */);
var parameters = ts.visitParameterList(node.parameters, visitor, context);
var body = transformFunctionBody(node);
- var name = hierarchyFacts & 8192 /* NewTarget */
+ var name = hierarchyFacts & 16384 /* NewTarget */
? ts.getLocalName(node)
: node.name;
- exitSubtree(ancestorFacts, 24576 /* FunctionSubtreeExcludes */, 0 /* None */);
+ exitSubtree(ancestorFacts, 49152 /* FunctionSubtreeExcludes */, 0 /* None */);
convertedLoopState = savedConvertedLoopState;
return ts.updateFunctionDeclaration(node,
/*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, name,
@@ -73320,14 +74158,14 @@
var savedConvertedLoopState = convertedLoopState;
convertedLoopState = undefined;
var ancestorFacts = container && ts.isClassLike(container) && !ts.hasModifier(node, 32 /* Static */)
- ? enterSubtree(8094 /* FunctionExcludes */, 65 /* FunctionIncludes */ | 8 /* NonStaticClassElement */)
- : enterSubtree(8094 /* FunctionExcludes */, 65 /* FunctionIncludes */);
+ ? enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */ | 8 /* NonStaticClassElement */)
+ : enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */);
var parameters = ts.visitParameterList(node.parameters, visitor, context);
var body = transformFunctionBody(node);
- if (hierarchyFacts & 8192 /* NewTarget */ && !name && (node.kind === 239 /* FunctionDeclaration */ || node.kind === 196 /* FunctionExpression */)) {
+ if (hierarchyFacts & 16384 /* NewTarget */ && !name && (node.kind === 240 /* FunctionDeclaration */ || node.kind === 197 /* FunctionExpression */)) {
name = ts.getGeneratedNameForNode(node);
}
- exitSubtree(ancestorFacts, 24576 /* FunctionSubtreeExcludes */, 0 /* None */);
+ exitSubtree(ancestorFacts, 49152 /* FunctionSubtreeExcludes */, 0 /* None */);
convertedLoopState = savedConvertedLoopState;
return ts.setOriginalNode(ts.setTextRange(ts.createFunctionExpression(
/*modifiers*/ undefined, node.asteriskToken, name,
@@ -73368,7 +74206,7 @@
}
}
else {
- ts.Debug.assert(node.kind === 197 /* ArrowFunction */);
+ ts.Debug.assert(node.kind === 198 /* ArrowFunction */);
// To align with the old emitter, we use a synthetic end position on the location
// for the statement list we synthesize when we down-level an arrow function with
// an expression function body. This prevents both comments and source maps from
@@ -73422,8 +74260,8 @@
return ts.visitEachChild(node, visitor, context);
}
var ancestorFacts = hierarchyFacts & 256 /* IterationStatement */
- ? enterSubtree(4032 /* IterationStatementBlockExcludes */, 512 /* IterationStatementBlockIncludes */)
- : enterSubtree(3904 /* BlockExcludes */, 128 /* BlockIncludes */);
+ ? enterSubtree(7104 /* IterationStatementBlockExcludes */, 512 /* IterationStatementBlockIncludes */)
+ : enterSubtree(6976 /* BlockExcludes */, 128 /* BlockIncludes */);
var updated = ts.visitEachChild(node, visitor, context);
exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */);
return updated;
@@ -73436,9 +74274,9 @@
function visitExpressionStatement(node) {
// If we are here it is most likely because our expression is a destructuring assignment.
switch (node.expression.kind) {
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return ts.updateExpressionStatement(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false));
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return ts.updateExpressionStatement(node, visitBinaryExpression(node.expression, /*needsDestructuringValue*/ false));
}
return ts.visitEachChild(node, visitor, context);
@@ -73457,9 +74295,9 @@
// expression. If we are in a state where we do not need the destructuring value,
// we pass that information along to the children that care about it.
switch (node.expression.kind) {
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return ts.updateParen(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false));
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return ts.updateParen(node, visitBinaryExpression(node.expression, /*needsDestructuringValue*/ false));
}
}
@@ -73494,7 +74332,7 @@
assignment = ts.flattenDestructuringAssignment(decl, visitor, context, 0 /* All */);
}
else {
- assignment = ts.createBinary(decl.name, 59 /* EqualsToken */, ts.visitNode(decl.initializer, visitor, ts.isExpression));
+ assignment = ts.createBinary(decl.name, 60 /* EqualsToken */, ts.visitNode(decl.initializer, visitor, ts.isExpression));
ts.setTextRange(assignment, decl);
}
assignments = ts.append(assignments, assignment);
@@ -73606,11 +74444,11 @@
&& isDeclaredInLoop
&& (hierarchyFacts & 512 /* IterationStatementBlock */) !== 0);
var emitExplicitInitializer = !emittedAsTopLevel
- && (hierarchyFacts & 2048 /* ForInOrForOfStatement */) === 0
+ && (hierarchyFacts & 4096 /* ForInOrForOfStatement */) === 0
&& (!resolver.isDeclarationWithCollidingName(node)
|| (isDeclaredInLoop
&& !isCapturedInFunction
- && (hierarchyFacts & (1024 /* ForStatement */ | 2048 /* ForInOrForOfStatement */)) === 0));
+ && (hierarchyFacts & (2048 /* ForStatement */ | 4096 /* ForInOrForOfStatement */)) === 0));
return emitExplicitInitializer;
}
/**
@@ -73668,34 +74506,34 @@
}
function visitIterationStatement(node, outermostLabeledStatement) {
switch (node.kind) {
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
return visitDoOrWhileStatement(node, outermostLabeledStatement);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return visitForStatement(node, outermostLabeledStatement);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return visitForInStatement(node, outermostLabeledStatement);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return visitForOfStatement(node, outermostLabeledStatement);
}
}
function visitIterationStatementWithFacts(excludeFacts, includeFacts, node, outermostLabeledStatement, convert) {
var ancestorFacts = enterSubtree(excludeFacts, includeFacts);
- var updated = convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert);
+ var updated = convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, ancestorFacts, convert);
exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */);
return updated;
}
function visitDoOrWhileStatement(node, outermostLabeledStatement) {
- return visitIterationStatementWithFacts(0 /* DoOrWhileStatementExcludes */, 256 /* DoOrWhileStatementIncludes */, node, outermostLabeledStatement);
+ return visitIterationStatementWithFacts(0 /* DoOrWhileStatementExcludes */, 1280 /* DoOrWhileStatementIncludes */, node, outermostLabeledStatement);
}
function visitForStatement(node, outermostLabeledStatement) {
- return visitIterationStatementWithFacts(3008 /* ForStatementExcludes */, 1280 /* ForStatementIncludes */, node, outermostLabeledStatement);
+ return visitIterationStatementWithFacts(5056 /* ForStatementExcludes */, 3328 /* ForStatementIncludes */, node, outermostLabeledStatement);
}
function visitForInStatement(node, outermostLabeledStatement) {
- return visitIterationStatementWithFacts(1984 /* ForInOrForOfStatementExcludes */, 2304 /* ForInOrForOfStatementIncludes */, node, outermostLabeledStatement);
+ return visitIterationStatementWithFacts(3008 /* ForInOrForOfStatementExcludes */, 5376 /* ForInOrForOfStatementIncludes */, node, outermostLabeledStatement);
}
function visitForOfStatement(node, outermostLabeledStatement) {
- return visitIterationStatementWithFacts(1984 /* ForInOrForOfStatementExcludes */, 2304 /* ForInOrForOfStatementIncludes */, node, outermostLabeledStatement, compilerOptions.downlevelIteration ? convertForOfStatementForIterable : convertForOfStatementForArray);
+ return visitIterationStatementWithFacts(3008 /* ForInOrForOfStatementExcludes */, 5376 /* ForInOrForOfStatementIncludes */, node, outermostLabeledStatement, compilerOptions.downlevelIteration ? convertForOfStatementForIterable : convertForOfStatementForArray);
}
function convertForOfStatementHead(node, boundValue, convertedLoopBodyStatements) {
var statements = [];
@@ -73803,7 +74641,7 @@
ts.setTextRange(forStatement, node);
return ts.restoreEnclosingLabel(forStatement, outermostLabeledStatement, convertedLoopState && resetLabel);
}
- function convertForOfStatementForIterable(node, outermostLabeledStatement, convertedLoopBodyStatements) {
+ function convertForOfStatementForIterable(node, outermostLabeledStatement, convertedLoopBodyStatements, ancestorFacts) {
var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
var iterator = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(expression) : ts.createTempVariable(/*recordTempVariable*/ undefined);
var result = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(iterator) : ts.createTempVariable(/*recordTempVariable*/ undefined);
@@ -73814,9 +74652,13 @@
var next = ts.createCall(ts.createPropertyAccess(iterator, "next"), /*typeArguments*/ undefined, []);
hoistVariableDeclaration(errorRecord);
hoistVariableDeclaration(returnMethod);
+ // if we are enclosed in an outer loop ensure we reset 'errorRecord' per each iteration
+ var initializer = ancestorFacts & 1024 /* IterationContainer */
+ ? ts.inlineExpressions([ts.createAssignment(errorRecord, ts.createVoidZero()), values])
+ : values;
var forStatement = ts.setEmitFlags(ts.setTextRange(ts.createFor(
/*initializer*/ ts.setEmitFlags(ts.setTextRange(ts.createVariableDeclarationList([
- ts.setTextRange(ts.createVariableDeclaration(iterator, /*type*/ undefined, values), node.expression),
+ ts.setTextRange(ts.createVariableDeclaration(iterator, /*type*/ undefined, initializer), node.expression),
ts.createVariableDeclaration(result, /*type*/ undefined, next)
]), node.expression), 2097152 /* NoHoisting */),
/*condition*/ ts.createLogicalNot(ts.createPropertyAccess(result, "done")),
@@ -73859,7 +74701,7 @@
&& i < numInitialPropertiesWithoutYield) {
numInitialPropertiesWithoutYield = i;
}
- if (property.name.kind === 149 /* ComputedPropertyName */) {
+ if (property.name.kind === 150 /* ComputedPropertyName */) {
numInitialProperties = i;
break;
}
@@ -73914,7 +74756,7 @@
}
visit(node.name);
function visit(node) {
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
state.hoistedLocalVariables.push(node);
}
else {
@@ -73927,7 +74769,7 @@
}
}
}
- function convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert) {
+ function convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, ancestorFacts, convert) {
if (!shouldConvertIterationStatement(node)) {
var saveAllowedNonLabeledJumps = void 0;
if (convertedLoopState) {
@@ -73937,7 +74779,7 @@
convertedLoopState.allowedNonLabeledJumps = 2 /* Break */ | 4 /* Continue */;
}
var result = convert
- ? convert(node, outermostLabeledStatement, /*convertedLoopBodyStatements*/ undefined)
+ ? convert(node, outermostLabeledStatement, /*convertedLoopBodyStatements*/ undefined, ancestorFacts)
: ts.restoreEnclosingLabel(ts.visitEachChild(node, visitor, context), outermostLabeledStatement, convertedLoopState && resetLabel);
if (convertedLoopState) {
convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps;
@@ -73962,7 +74804,7 @@
var loop;
if (bodyFunction) {
if (convert) {
- loop = convert(node, outermostLabeledStatement, bodyFunction.part);
+ loop = convert(node, outermostLabeledStatement, bodyFunction.part, ancestorFacts);
}
else {
var clone_3 = convertIterationStatementCore(node, initializerFunction, ts.createBlock(bodyFunction.part, /*multiLine*/ true));
@@ -73980,11 +74822,11 @@
}
function convertIterationStatementCore(node, initializerFunction, convertedLoopBody) {
switch (node.kind) {
- case 225 /* ForStatement */: return convertForStatement(node, initializerFunction, convertedLoopBody);
- case 226 /* ForInStatement */: return convertForInStatement(node, convertedLoopBody);
- case 227 /* ForOfStatement */: return convertForOfStatement(node, convertedLoopBody);
- case 223 /* DoStatement */: return convertDoStatement(node, convertedLoopBody);
- case 224 /* WhileStatement */: return convertWhileStatement(node, convertedLoopBody);
+ case 226 /* ForStatement */: return convertForStatement(node, initializerFunction, convertedLoopBody);
+ case 227 /* ForInStatement */: return convertForInStatement(node, convertedLoopBody);
+ case 228 /* ForOfStatement */: return convertForOfStatement(node, convertedLoopBody);
+ case 224 /* DoStatement */: return convertDoStatement(node, convertedLoopBody);
+ case 225 /* WhileStatement */: return convertWhileStatement(node, convertedLoopBody);
default: return ts.Debug.failBadSyntaxKind(node, "IterationStatement expected");
}
}
@@ -74009,11 +74851,11 @@
function createConvertedLoopState(node) {
var loopInitializer;
switch (node.kind) {
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
var initializer = node.initializer;
- if (initializer && initializer.kind === 238 /* VariableDeclarationList */) {
+ if (initializer && initializer.kind === 239 /* VariableDeclarationList */) {
loopInitializer = initializer;
}
break;
@@ -74275,7 +75117,7 @@
function copyOutParameter(outParam, copyDirection) {
var source = copyDirection === 0 /* ToOriginal */ ? outParam.outParamName : outParam.originalName;
var target = copyDirection === 0 /* ToOriginal */ ? outParam.originalName : outParam.outParamName;
- return ts.createBinary(target, 59 /* EqualsToken */, source);
+ return ts.createBinary(target, 60 /* EqualsToken */, source);
}
function copyOutParameters(outParams, partFlags, copyDirection, statements) {
for (var _i = 0, outParams_1 = outParams; _i < outParams_1.length; _i++) {
@@ -74412,20 +75254,20 @@
for (var i = start; i < numProperties; i++) {
var property = properties[i];
switch (property.kind) {
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
var accessors = ts.getAllAccessorDeclarations(node.properties, property);
if (property === accessors.firstAccessor) {
expressions.push(transformAccessorsToExpression(receiver, accessors, node, !!node.multiLine));
}
break;
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine));
break;
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine));
break;
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine));
break;
default:
@@ -74480,7 +75322,7 @@
return expression;
}
function visitCatchClause(node) {
- var ancestorFacts = enterSubtree(4032 /* BlockScopeExcludes */, 0 /* BlockScopeIncludes */);
+ var ancestorFacts = enterSubtree(7104 /* BlockScopeExcludes */, 0 /* BlockScopeIncludes */);
var updated;
ts.Debug.assert(!!node.variableDeclaration, "Catch clause variable should always be present when downleveling ES2015.");
if (ts.isBindingPattern(node.variableDeclaration.name)) {
@@ -74528,17 +75370,17 @@
ts.Debug.assert(!ts.isComputedPropertyName(node.name));
var savedConvertedLoopState = convertedLoopState;
convertedLoopState = undefined;
- var ancestorFacts = enterSubtree(8094 /* FunctionExcludes */, 65 /* FunctionIncludes */);
+ var ancestorFacts = enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */);
var updated;
var parameters = ts.visitParameterList(node.parameters, visitor, context);
var body = transformFunctionBody(node);
- if (node.kind === 158 /* GetAccessor */) {
+ if (node.kind === 159 /* GetAccessor */) {
updated = ts.updateGetAccessor(node, node.decorators, node.modifiers, node.name, parameters, node.type, body);
}
else {
updated = ts.updateSetAccessor(node, node.decorators, node.modifiers, node.name, parameters, body);
}
- exitSubtree(ancestorFacts, 24576 /* FunctionSubtreeExcludes */, 0 /* None */);
+ exitSubtree(ancestorFacts, 49152 /* FunctionSubtreeExcludes */, 0 /* None */);
convertedLoopState = savedConvertedLoopState;
return updated;
}
@@ -74585,7 +75427,7 @@
return visitTypeScriptClassWrapper(node);
}
var expression = ts.skipOuterExpressions(node.expression);
- if (expression.kind === 98 /* SuperKeyword */ ||
+ if (expression.kind === 99 /* SuperKeyword */ ||
ts.isSuperProperty(expression) ||
ts.some(node.arguments, ts.isSpreadElement)) {
return visitCallExpressionWithPotentialCapturedThisAssignment(node, /*assignToCapturedThis*/ true);
@@ -74709,10 +75551,10 @@
// We are here either because SuperKeyword was used somewhere in the expression, or
// because we contain a SpreadElementExpression.
if (node.transformFlags & 4096 /* ContainsRestOrSpread */ ||
- node.expression.kind === 98 /* SuperKeyword */ ||
+ node.expression.kind === 99 /* SuperKeyword */ ||
ts.isSuperProperty(ts.skipOuterExpressions(node.expression))) {
var _a = ts.createCallBinding(node.expression, hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
ts.setEmitFlags(thisArg, 4 /* NoSubstitution */);
}
var resultingCall = void 0;
@@ -74730,7 +75572,7 @@
// _super.apply(this, a.concat([b]))
// _super.m.apply(this, a.concat([b]))
// _super.prototype.m.apply(this, a.concat([b]))
- resultingCall = ts.createFunctionApply(ts.visitNode(target, callExpressionVisitor, ts.isExpression), node.expression.kind === 98 /* SuperKeyword */ ? thisArg : ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false));
+ resultingCall = ts.createFunctionApply(ts.visitNode(target, callExpressionVisitor, ts.isExpression), node.expression.kind === 99 /* SuperKeyword */ ? thisArg : ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false));
}
else {
// [source]
@@ -74742,10 +75584,10 @@
// _super.call(this, a)
// _super.m.call(this, a)
// _super.prototype.m.call(this, a)
- resultingCall = ts.createFunctionCall(ts.visitNode(target, callExpressionVisitor, ts.isExpression), node.expression.kind === 98 /* SuperKeyword */ ? thisArg : ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression),
+ resultingCall = ts.createFunctionCall(ts.visitNode(target, callExpressionVisitor, ts.isExpression), node.expression.kind === 99 /* SuperKeyword */ ? thisArg : ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression),
/*location*/ node);
}
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
var initializer = ts.createLogicalOr(resultingCall, createActualThis());
resultingCall = assignToCapturedThis
? ts.createAssignment(ts.createFileLevelUniqueName("_this"), initializer)
@@ -74808,7 +75650,7 @@
else {
if (segments.length === 1) {
var firstElement = elements[0];
- return needsUniqueCopy && ts.isSpreadElement(firstElement) && firstElement.expression.kind !== 187 /* ArrayLiteralExpression */
+ return needsUniqueCopy && ts.isSpreadElement(firstElement) && firstElement.expression.kind !== 188 /* ArrayLiteralExpression */
? ts.createArraySlice(segments[0])
: segments[0];
}
@@ -75023,8 +75865,8 @@
: ts.createFileLevelUniqueName("_super");
}
function visitMetaProperty(node) {
- if (node.keywordToken === 95 /* NewKeyword */ && node.name.escapedText === "target") {
- hierarchyFacts |= 8192 /* NewTarget */;
+ if (node.keywordToken === 96 /* NewKeyword */ && node.name.escapedText === "target") {
+ hierarchyFacts |= 16384 /* NewTarget */;
return ts.createFileLevelUniqueName("_newTarget");
}
return node;
@@ -75039,7 +75881,7 @@
function onEmitNode(hint, node, emitCallback) {
if (enabledSubstitutions & 1 /* CapturedThis */ && ts.isFunctionLike(node)) {
// If we are tracking a captured `this`, keep track of the enclosing function.
- var ancestorFacts = enterSubtree(8094 /* FunctionExcludes */, ts.getEmitFlags(node) & 8 /* CapturesThis */
+ var ancestorFacts = enterSubtree(16286 /* FunctionExcludes */, ts.getEmitFlags(node) & 8 /* CapturesThis */
? 65 /* FunctionIncludes */ | 16 /* CapturesThis */
: 65 /* FunctionIncludes */);
previousOnEmitNode(hint, node, emitCallback);
@@ -75055,7 +75897,7 @@
function enableSubstitutionsForBlockScopedBindings() {
if ((enabledSubstitutions & 2 /* BlockScopedBindings */) === 0) {
enabledSubstitutions |= 2 /* BlockScopedBindings */;
- context.enableSubstitution(72 /* Identifier */);
+ context.enableSubstitution(73 /* Identifier */);
}
}
/**
@@ -75065,14 +75907,14 @@
function enableSubstitutionsForCapturedThis() {
if ((enabledSubstitutions & 1 /* CapturedThis */) === 0) {
enabledSubstitutions |= 1 /* CapturedThis */;
- context.enableSubstitution(100 /* ThisKeyword */);
- context.enableEmitNotification(157 /* Constructor */);
- context.enableEmitNotification(156 /* MethodDeclaration */);
- context.enableEmitNotification(158 /* GetAccessor */);
- context.enableEmitNotification(159 /* SetAccessor */);
- context.enableEmitNotification(197 /* ArrowFunction */);
- context.enableEmitNotification(196 /* FunctionExpression */);
- context.enableEmitNotification(239 /* FunctionDeclaration */);
+ context.enableSubstitution(101 /* ThisKeyword */);
+ context.enableEmitNotification(158 /* Constructor */);
+ context.enableEmitNotification(157 /* MethodDeclaration */);
+ context.enableEmitNotification(159 /* GetAccessor */);
+ context.enableEmitNotification(160 /* SetAccessor */);
+ context.enableEmitNotification(198 /* ArrowFunction */);
+ context.enableEmitNotification(197 /* FunctionExpression */);
+ context.enableEmitNotification(240 /* FunctionDeclaration */);
}
}
/**
@@ -75113,10 +75955,10 @@
*/
function isNameOfDeclarationWithCollidingName(node) {
switch (node.parent.kind) {
- case 186 /* BindingElement */:
- case 240 /* ClassDeclaration */:
- case 243 /* EnumDeclaration */:
- case 237 /* VariableDeclaration */:
+ case 187 /* BindingElement */:
+ case 241 /* ClassDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 238 /* VariableDeclaration */:
return node.parent.name === node
&& resolver.isDeclarationWithCollidingName(node.parent);
}
@@ -75129,9 +75971,9 @@
*/
function substituteExpression(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return substituteExpressionIdentifier(node);
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
return substituteThisKeyword(node);
}
return node;
@@ -75198,19 +76040,19 @@
return false;
}
var statement = ts.firstOrUndefined(constructor.body.statements);
- if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 221 /* ExpressionStatement */) {
+ if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 222 /* ExpressionStatement */) {
return false;
}
var statementExpression = statement.expression;
- if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 191 /* CallExpression */) {
+ if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 192 /* CallExpression */) {
return false;
}
var callTarget = statementExpression.expression;
- if (!ts.nodeIsSynthesized(callTarget) || callTarget.kind !== 98 /* SuperKeyword */) {
+ if (!ts.nodeIsSynthesized(callTarget) || callTarget.kind !== 99 /* SuperKeyword */) {
return false;
}
var callArgument = ts.singleOrUndefined(statementExpression.arguments);
- if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 208 /* SpreadElement */) {
+ if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 209 /* SpreadElement */) {
return false;
}
var expression = callArgument.expression;
@@ -75263,15 +76105,15 @@
if (compilerOptions.jsx === 1 /* Preserve */ || compilerOptions.jsx === 3 /* ReactNative */) {
previousOnEmitNode = context.onEmitNode;
context.onEmitNode = onEmitNode;
- context.enableEmitNotification(262 /* JsxOpeningElement */);
- context.enableEmitNotification(263 /* JsxClosingElement */);
- context.enableEmitNotification(261 /* JsxSelfClosingElement */);
+ context.enableEmitNotification(263 /* JsxOpeningElement */);
+ context.enableEmitNotification(264 /* JsxClosingElement */);
+ context.enableEmitNotification(262 /* JsxSelfClosingElement */);
noSubstitution = [];
}
var previousOnSubstituteNode = context.onSubstituteNode;
context.onSubstituteNode = onSubstituteNode;
- context.enableSubstitution(189 /* PropertyAccessExpression */);
- context.enableSubstitution(275 /* PropertyAssignment */);
+ context.enableSubstitution(190 /* PropertyAccessExpression */);
+ context.enableSubstitution(276 /* PropertyAssignment */);
return ts.chainBundle(transformSourceFile);
/**
* Transforms an ES5 source file to ES3.
@@ -75290,9 +76132,9 @@
*/
function onEmitNode(hint, node, emitCallback) {
switch (node.kind) {
- case 262 /* JsxOpeningElement */:
- case 263 /* JsxClosingElement */:
- case 261 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
+ case 264 /* JsxClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
var tagName = node.tagName;
noSubstitution[ts.getOriginalNodeId(tagName)] = true;
break;
@@ -75349,7 +76191,7 @@
*/
function trySubstituteReservedName(name) {
var token = name.originalKeywordKind || (ts.nodeIsSynthesized(name) ? ts.stringToToken(ts.idText(name)) : undefined);
- if (token !== undefined && token >= 73 /* FirstReservedWord */ && token <= 108 /* LastReservedWord */) {
+ if (token !== undefined && token >= 74 /* FirstReservedWord */ && token <= 109 /* LastReservedWord */) {
return ts.setTextRange(ts.createLiteral(name), name);
}
return undefined;
@@ -75624,13 +76466,13 @@
*/
function visitJavaScriptInStatementContainingYield(node) {
switch (node.kind) {
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
return visitDoStatement(node);
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
return visitWhileStatement(node);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return visitSwitchStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return visitLabeledStatement(node);
default:
return visitJavaScriptInGeneratorFunctionBody(node);
@@ -75643,24 +76485,24 @@
*/
function visitJavaScriptInGeneratorFunctionBody(node) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return visitFunctionDeclaration(node);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return visitFunctionExpression(node);
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return visitAccessorDeclaration(node);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return visitVariableStatement(node);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return visitForStatement(node);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return visitForInStatement(node);
- case 229 /* BreakStatement */:
+ case 230 /* BreakStatement */:
return visitBreakStatement(node);
- case 228 /* ContinueStatement */:
+ case 229 /* ContinueStatement */:
return visitContinueStatement(node);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return visitReturnStatement(node);
default:
if (node.transformFlags & 131072 /* ContainsYield */) {
@@ -75681,21 +76523,21 @@
*/
function visitJavaScriptContainingYield(node) {
switch (node.kind) {
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return visitBinaryExpression(node);
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return visitConditionalExpression(node);
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return visitYieldExpression(node);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return visitArrayLiteralExpression(node);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return visitObjectLiteralExpression(node);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return visitElementAccessExpression(node);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return visitCallExpression(node);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return visitNewExpression(node);
default:
return ts.visitEachChild(node, visitor, context);
@@ -75708,9 +76550,9 @@
*/
function visitGenerator(node) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return visitFunctionDeclaration(node);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return visitFunctionExpression(node);
default:
return ts.Debug.failBadSyntaxKind(node);
@@ -75909,23 +76751,23 @@
}
}
function isCompoundAssignment(kind) {
- return kind >= 60 /* FirstCompoundAssignment */
- && kind <= 71 /* LastCompoundAssignment */;
+ return kind >= 61 /* FirstCompoundAssignment */
+ && kind <= 72 /* LastCompoundAssignment */;
}
function getOperatorForCompoundAssignment(kind) {
switch (kind) {
- case 60 /* PlusEqualsToken */: return 38 /* PlusToken */;
- case 61 /* MinusEqualsToken */: return 39 /* MinusToken */;
- case 62 /* AsteriskEqualsToken */: return 40 /* AsteriskToken */;
- case 63 /* AsteriskAsteriskEqualsToken */: return 41 /* AsteriskAsteriskToken */;
- case 64 /* SlashEqualsToken */: return 42 /* SlashToken */;
- case 65 /* PercentEqualsToken */: return 43 /* PercentToken */;
- case 66 /* LessThanLessThanEqualsToken */: return 46 /* LessThanLessThanToken */;
- case 67 /* GreaterThanGreaterThanEqualsToken */: return 47 /* GreaterThanGreaterThanToken */;
- case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */: return 48 /* GreaterThanGreaterThanGreaterThanToken */;
- case 69 /* AmpersandEqualsToken */: return 49 /* AmpersandToken */;
- case 70 /* BarEqualsToken */: return 50 /* BarToken */;
- case 71 /* CaretEqualsToken */: return 51 /* CaretToken */;
+ case 61 /* PlusEqualsToken */: return 38 /* PlusToken */;
+ case 62 /* MinusEqualsToken */: return 39 /* MinusToken */;
+ case 63 /* AsteriskEqualsToken */: return 40 /* AsteriskToken */;
+ case 64 /* AsteriskAsteriskEqualsToken */: return 41 /* AsteriskAsteriskToken */;
+ case 65 /* SlashEqualsToken */: return 42 /* SlashToken */;
+ case 66 /* PercentEqualsToken */: return 43 /* PercentToken */;
+ case 67 /* LessThanLessThanEqualsToken */: return 46 /* LessThanLessThanToken */;
+ case 68 /* GreaterThanGreaterThanEqualsToken */: return 47 /* GreaterThanGreaterThanToken */;
+ case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */: return 48 /* GreaterThanGreaterThanGreaterThanToken */;
+ case 70 /* AmpersandEqualsToken */: return 49 /* AmpersandToken */;
+ case 71 /* BarEqualsToken */: return 50 /* BarToken */;
+ case 72 /* CaretEqualsToken */: return 51 /* CaretToken */;
}
}
/**
@@ -75938,7 +76780,7 @@
if (containsYield(right)) {
var target = void 0;
switch (left.kind) {
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
// [source]
// a.b = yield;
//
@@ -75950,7 +76792,7 @@
// _a.b = %sent%;
target = ts.updatePropertyAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name);
break;
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
// [source]
// a[b] = yield;
//
@@ -76326,35 +77168,35 @@
}
function transformAndEmitStatementWorker(node) {
switch (node.kind) {
- case 218 /* Block */:
+ case 219 /* Block */:
return transformAndEmitBlock(node);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return transformAndEmitExpressionStatement(node);
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
return transformAndEmitIfStatement(node);
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
return transformAndEmitDoStatement(node);
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
return transformAndEmitWhileStatement(node);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return transformAndEmitForStatement(node);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return transformAndEmitForInStatement(node);
- case 228 /* ContinueStatement */:
+ case 229 /* ContinueStatement */:
return transformAndEmitContinueStatement(node);
- case 229 /* BreakStatement */:
+ case 230 /* BreakStatement */:
return transformAndEmitBreakStatement(node);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return transformAndEmitReturnStatement(node);
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
return transformAndEmitWithStatement(node);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return transformAndEmitSwitchStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return transformAndEmitLabeledStatement(node);
- case 234 /* ThrowStatement */:
+ case 235 /* ThrowStatement */:
return transformAndEmitThrowStatement(node);
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
return transformAndEmitTryStatement(node);
default:
return emitStatement(ts.visitNode(node, visitor, ts.isStatement));
@@ -76784,7 +77626,7 @@
for (var i = 0; i < numClauses; i++) {
var clause = caseBlock.clauses[i];
clauseLabels.push(defineLabel());
- if (clause.kind === 272 /* DefaultClause */ && defaultClauseIndex === -1) {
+ if (clause.kind === 273 /* DefaultClause */ && defaultClauseIndex === -1) {
defaultClauseIndex = i;
}
}
@@ -76797,7 +77639,7 @@
var defaultClausesSkipped = 0;
for (var i = clausesWritten; i < numClauses; i++) {
var clause = caseBlock.clauses[i];
- if (clause.kind === 271 /* CaseClause */) {
+ if (clause.kind === 272 /* CaseClause */) {
if (containsYield(clause.expression) && pendingClauses.length > 0) {
break;
}
@@ -77109,7 +77951,7 @@
if (!renamedCatchVariables) {
renamedCatchVariables = ts.createMap();
renamedCatchVariableDeclarations = [];
- context.enableSubstitution(72 /* Identifier */);
+ context.enableSubstitution(73 /* Identifier */);
}
renamedCatchVariables.set(text, true);
renamedCatchVariableDeclarations[ts.getOriginalNodeId(variable)] = name;
@@ -78025,12 +78867,12 @@
var previousOnEmitNode = context.onEmitNode;
context.onSubstituteNode = onSubstituteNode;
context.onEmitNode = onEmitNode;
- context.enableSubstitution(72 /* Identifier */); // Substitutes expression identifiers with imported/exported symbols.
- context.enableSubstitution(204 /* BinaryExpression */); // Substitutes assignments to exported symbols.
- context.enableSubstitution(202 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols.
- context.enableSubstitution(203 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols.
- context.enableSubstitution(276 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols.
- context.enableEmitNotification(284 /* SourceFile */); // Restore state when substituting nodes in a file.
+ context.enableSubstitution(73 /* Identifier */); // Substitutes expression identifiers with imported/exported symbols.
+ context.enableSubstitution(205 /* BinaryExpression */); // Substitutes assignments to exported symbols.
+ context.enableSubstitution(203 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols.
+ context.enableSubstitution(204 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols.
+ context.enableSubstitution(277 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols.
+ context.enableEmitNotification(285 /* SourceFile */); // Restore state when substituting nodes in a file.
var moduleInfoMap = []; // The ExternalModuleInfo for each file.
var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found.
var currentSourceFile; // The current file.
@@ -78358,23 +79200,23 @@
*/
function sourceElementVisitor(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return visitImportDeclaration(node);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return visitImportEqualsDeclaration(node);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return visitExportDeclaration(node);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return visitExportAssignment(node);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return visitVariableStatement(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return visitFunctionDeclaration(node);
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return visitClassDeclaration(node);
- case 315 /* MergeDeclarationMarker */:
+ case 316 /* MergeDeclarationMarker */:
return visitMergeDeclarationMarker(node);
- case 316 /* EndOfDeclarationMarker */:
+ case 317 /* EndOfDeclarationMarker */:
return visitEndOfDeclarationMarker(node);
default:
return ts.visitEachChild(node, moduleExpressionElementVisitor, context);
@@ -78401,24 +79243,24 @@
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var elem = _a[_i];
switch (elem.kind) {
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
if (destructuringNeedsFlattening(elem.initializer)) {
return true;
}
break;
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
if (destructuringNeedsFlattening(elem.name)) {
return true;
}
break;
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
if (destructuringNeedsFlattening(elem.expression)) {
return true;
}
break;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return false;
default: ts.Debug.assertNever(elem, "Unhandled object member kind");
}
@@ -78896,7 +79738,7 @@
//
// To balance the declaration, add the exports of the elided variable
// statement.
- if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 219 /* VariableStatement */) {
+ if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 220 /* VariableStatement */) {
var id = ts.getOriginalNodeId(node);
deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original);
}
@@ -78951,10 +79793,10 @@
var namedBindings = importClause.namedBindings;
if (namedBindings) {
switch (namedBindings.kind) {
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
statements = appendExportsOfDeclaration(statements, namedBindings);
break;
- case 252 /* NamedImports */:
+ case 253 /* NamedImports */:
for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) {
var importBinding = _a[_i];
statements = appendExportsOfDeclaration(statements, importBinding);
@@ -79136,8 +79978,8 @@
function modifierVisitor(node) {
// Elide module-specific modifiers.
switch (node.kind) {
- case 85 /* ExportKeyword */:
- case 80 /* DefaultKeyword */:
+ case 86 /* ExportKeyword */:
+ case 81 /* DefaultKeyword */:
return undefined;
}
return node;
@@ -79153,7 +79995,7 @@
* @param emit A callback used to emit the node in the printer.
*/
function onEmitNode(hint, node, emitCallback) {
- if (node.kind === 284 /* SourceFile */) {
+ if (node.kind === 285 /* SourceFile */) {
currentSourceFile = node;
currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)];
noSubstitution = [];
@@ -79215,12 +80057,12 @@
*/
function substituteExpression(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return substituteExpressionIdentifier(node);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return substituteBinaryExpression(node);
- case 203 /* PostfixUnaryExpression */:
- case 202 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return substituteUnaryExpression(node);
}
return node;
@@ -79241,7 +80083,7 @@
}
if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) {
var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node));
- if (exportContainer && exportContainer.kind === 284 /* SourceFile */) {
+ if (exportContainer && exportContainer.kind === 285 /* SourceFile */) {
return ts.setTextRange(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node)),
/*location*/ node);
}
@@ -79316,8 +80158,8 @@
&& !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) {
var exportedNames = getExports(node.operand);
if (exportedNames) {
- var expression = node.kind === 203 /* PostfixUnaryExpression */
- ? ts.setTextRange(ts.createBinary(node.operand, ts.createToken(node.operator === 44 /* PlusPlusToken */ ? 60 /* PlusEqualsToken */ : 61 /* MinusEqualsToken */), ts.createLiteral(1)),
+ var expression = node.kind === 204 /* PostfixUnaryExpression */
+ ? ts.setTextRange(ts.createBinary(node.operand, ts.createToken(node.operator === 44 /* PlusPlusToken */ ? 61 /* PlusEqualsToken */ : 62 /* MinusEqualsToken */), ts.createLiteral(1)),
/*location*/ node)
: node;
for (var _i = 0, exportedNames_3 = exportedNames; _i < exportedNames_3.length; _i++) {
@@ -79391,12 +80233,12 @@
var previousOnEmitNode = context.onEmitNode;
context.onSubstituteNode = onSubstituteNode;
context.onEmitNode = onEmitNode;
- context.enableSubstitution(72 /* Identifier */); // Substitutes expression identifiers for imported symbols.
- context.enableSubstitution(276 /* ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols
- context.enableSubstitution(204 /* BinaryExpression */); // Substitutes assignments to exported symbols.
- context.enableSubstitution(202 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols.
- context.enableSubstitution(203 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols.
- context.enableEmitNotification(284 /* SourceFile */); // Restore state when substituting nodes in a file.
+ context.enableSubstitution(73 /* Identifier */); // Substitutes expression identifiers for imported symbols.
+ context.enableSubstitution(277 /* ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols
+ context.enableSubstitution(205 /* BinaryExpression */); // Substitutes assignments to exported symbols.
+ context.enableSubstitution(203 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols.
+ context.enableSubstitution(204 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols.
+ context.enableEmitNotification(285 /* SourceFile */); // Restore state when substituting nodes in a file.
var moduleInfoMap = []; // The ExternalModuleInfo for each file.
var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found.
var exportFunctionsMap = []; // The export function associated with a source file.
@@ -79617,7 +80459,7 @@
var hasExportDeclarationWithExportClause = false;
for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) {
var externalImport = _a[_i];
- if (externalImport.kind === 255 /* ExportDeclaration */ && externalImport.exportClause) {
+ if (externalImport.kind === 256 /* ExportDeclaration */ && externalImport.exportClause) {
hasExportDeclarationWithExportClause = true;
break;
}
@@ -79642,7 +80484,7 @@
}
for (var _d = 0, _e = moduleInfo.externalImports; _d < _e.length; _d++) {
var externalImport = _e[_d];
- if (externalImport.kind !== 255 /* ExportDeclaration */) {
+ if (externalImport.kind !== 256 /* ExportDeclaration */) {
continue;
}
if (!externalImport.exportClause) {
@@ -79720,19 +80562,19 @@
var entry = _b[_a];
var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile); // TODO: GH#18217
switch (entry.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
if (!entry.importClause) {
// 'import "..."' case
// module is imported only for side-effects, no emit required
break;
}
// falls through
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
ts.Debug.assert(importVariableName !== undefined);
// save import into the local
statements.push(ts.createExpressionStatement(ts.createAssignment(importVariableName, parameterName)));
break;
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
ts.Debug.assert(importVariableName !== undefined);
if (entry.exportClause) {
// export {a, b as c} from 'foo'
@@ -79782,15 +80624,15 @@
*/
function sourceElementVisitor(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return visitImportDeclaration(node);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return visitImportEqualsDeclaration(node);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
// ExportDeclarations are elided as they are handled via
// `appendExportsOfDeclaration`.
return undefined;
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return visitExportAssignment(node);
default:
return nestedElementVisitor(node);
@@ -79966,7 +80808,7 @@
function shouldHoistVariableDeclarationList(node) {
// hoist only non-block scoped declarations or block scoped declarations parented by source file
return (ts.getEmitFlags(node) & 2097152 /* NoHoisting */) === 0
- && (enclosingBlockScopedContainer.kind === 284 /* SourceFile */
+ && (enclosingBlockScopedContainer.kind === 285 /* SourceFile */
|| (ts.getOriginalNode(node).flags & 3 /* BlockScoped */) === 0);
}
/**
@@ -80030,7 +80872,7 @@
//
// To balance the declaration, we defer the exports of the elided variable
// statement until we visit this declaration's `EndOfDeclarationMarker`.
- if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 219 /* VariableStatement */) {
+ if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 220 /* VariableStatement */) {
var id = ts.getOriginalNodeId(node);
var isExportedDeclaration = ts.hasModifier(node.original, 1 /* Export */);
deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration);
@@ -80092,10 +80934,10 @@
var namedBindings = importClause.namedBindings;
if (namedBindings) {
switch (namedBindings.kind) {
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
statements = appendExportsOfDeclaration(statements, namedBindings);
break;
- case 252 /* NamedImports */:
+ case 253 /* NamedImports */:
for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) {
var importBinding = _a[_i];
statements = appendExportsOfDeclaration(statements, importBinding);
@@ -80275,43 +81117,43 @@
*/
function nestedElementVisitor(node) {
switch (node.kind) {
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return visitVariableStatement(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return visitFunctionDeclaration(node);
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return visitClassDeclaration(node);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return visitForStatement(node);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return visitForInStatement(node);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return visitForOfStatement(node);
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
return visitDoStatement(node);
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
return visitWhileStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return visitLabeledStatement(node);
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
return visitWithStatement(node);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return visitSwitchStatement(node);
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
return visitCaseBlock(node);
- case 271 /* CaseClause */:
+ case 272 /* CaseClause */:
return visitCaseClause(node);
- case 272 /* DefaultClause */:
+ case 273 /* DefaultClause */:
return visitDefaultClause(node);
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
return visitTryStatement(node);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return visitCatchClause(node);
- case 218 /* Block */:
+ case 219 /* Block */:
return visitBlock(node);
- case 315 /* MergeDeclarationMarker */:
+ case 316 /* MergeDeclarationMarker */:
return visitMergeDeclarationMarker(node);
- case 316 /* EndOfDeclarationMarker */:
+ case 317 /* EndOfDeclarationMarker */:
return visitEndOfDeclarationMarker(node);
default:
return destructuringAndImportCallVisitor(node);
@@ -80558,7 +81400,7 @@
}
else if (ts.isIdentifier(node)) {
var container = resolver.getReferencedExportContainer(node);
- return container !== undefined && container.kind === 284 /* SourceFile */;
+ return container !== undefined && container.kind === 285 /* SourceFile */;
}
else {
return false;
@@ -80574,8 +81416,8 @@
*/
function modifierVisitor(node) {
switch (node.kind) {
- case 85 /* ExportKeyword */:
- case 80 /* DefaultKeyword */:
+ case 86 /* ExportKeyword */:
+ case 81 /* DefaultKeyword */:
return undefined;
}
return node;
@@ -80591,7 +81433,7 @@
* @param emitCallback A callback used to emit the node in the printer.
*/
function onEmitNode(hint, node, emitCallback) {
- if (node.kind === 284 /* SourceFile */) {
+ if (node.kind === 285 /* SourceFile */) {
var id = ts.getOriginalNodeId(node);
currentSourceFile = node;
moduleInfo = moduleInfoMap[id];
@@ -80639,7 +81481,7 @@
*/
function substituteUnspecified(node) {
switch (node.kind) {
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return substituteShorthandPropertyAssignment(node);
}
return node;
@@ -80673,12 +81515,12 @@
*/
function substituteExpression(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return substituteExpressionIdentifier(node);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return substituteBinaryExpression(node);
- case 202 /* PrefixUnaryExpression */:
- case 203 /* PostfixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return substituteUnaryExpression(node);
}
return node;
@@ -80771,14 +81613,14 @@
&& !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) {
var exportedNames = getExports(node.operand);
if (exportedNames) {
- var expression = node.kind === 203 /* PostfixUnaryExpression */
+ var expression = node.kind === 204 /* PostfixUnaryExpression */
? ts.setTextRange(ts.createPrefix(node.operator, node.operand), node)
: node;
for (var _i = 0, exportedNames_5 = exportedNames; _i < exportedNames_5.length; _i++) {
var exportName = exportedNames_5[_i];
expression = createExportExpression(exportName, preventSubstitution(expression));
}
- if (node.kind === 203 /* PostfixUnaryExpression */) {
+ if (node.kind === 204 /* PostfixUnaryExpression */) {
expression = node.operator === 44 /* PlusPlusToken */
? ts.createSubtract(preventSubstitution(expression), ts.createLiteral(1))
: ts.createAdd(preventSubstitution(expression), ts.createLiteral(1));
@@ -80800,7 +81642,7 @@
|| resolver.getReferencedValueDeclaration(name);
if (valueDeclaration) {
var exportContainer = resolver.getReferencedExportContainer(name, /*prefixLocals*/ false);
- if (exportContainer && exportContainer.kind === 284 /* SourceFile */) {
+ if (exportContainer && exportContainer.kind === 285 /* SourceFile */) {
exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration));
}
exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]);
@@ -80839,8 +81681,8 @@
var previousOnSubstituteNode = context.onSubstituteNode;
context.onEmitNode = onEmitNode;
context.onSubstituteNode = onSubstituteNode;
- context.enableEmitNotification(284 /* SourceFile */);
- context.enableSubstitution(72 /* Identifier */);
+ context.enableEmitNotification(285 /* SourceFile */);
+ context.enableSubstitution(73 /* Identifier */);
var currentSourceFile;
return ts.chainBundle(transformSourceFile);
function transformSourceFile(node) {
@@ -80868,10 +81710,10 @@
}
function visitor(node) {
switch (node.kind) {
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
// Elide `import=` as it is not legal with --module ES6
return undefined;
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return visitExportAssignment(node);
}
return node;
@@ -80979,7 +81821,7 @@
ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1;
}
- else if (node.parent.kind === 240 /* ClassDeclaration */) {
+ else if (node.parent.kind === 241 /* ClassDeclaration */) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -81008,7 +81850,7 @@
ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_private_name_1;
}
- else if (node.parent.kind === 240 /* ClassDeclaration */) {
+ else if (node.parent.kind === 241 /* ClassDeclaration */) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -81055,7 +81897,7 @@
return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: " + ts.SyntaxKind[node.kind]);
}
function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
- if (node.kind === 237 /* VariableDeclaration */ || node.kind === 186 /* BindingElement */) {
+ if (node.kind === 238 /* VariableDeclaration */ || node.kind === 187 /* BindingElement */) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -81064,8 +81906,8 @@
}
// This check is to ensure we don't report error on constructor parameter property as that error would be reported during parameter emit
// The only exception here is if the constructor was marked as private. we are not emitting the constructor parameters at all.
- else if (node.kind === 154 /* PropertyDeclaration */ || node.kind === 189 /* PropertyAccessExpression */ || node.kind === 153 /* PropertySignature */ ||
- (node.kind === 151 /* Parameter */ && ts.hasModifier(node.parent, 8 /* Private */))) {
+ else if (node.kind === 155 /* PropertyDeclaration */ || node.kind === 190 /* PropertyAccessExpression */ || node.kind === 154 /* PropertySignature */ ||
+ (node.kind === 152 /* Parameter */ && ts.hasModifier(node.parent, 8 /* Private */))) {
// TODO(jfreeman): Deal with computed properties in error reporting.
if (ts.hasModifier(node, 32 /* Static */)) {
return symbolAccessibilityResult.errorModuleName ?
@@ -81074,7 +81916,7 @@
ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1;
}
- else if (node.parent.kind === 240 /* ClassDeclaration */ || node.kind === 151 /* Parameter */) {
+ else if (node.parent.kind === 241 /* ClassDeclaration */ || node.kind === 152 /* Parameter */) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -81099,7 +81941,7 @@
}
function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) {
var diagnosticMessage;
- if (node.kind === 159 /* SetAccessor */) {
+ if (node.kind === 160 /* SetAccessor */) {
// Getters can infer the return type from the returned expression, but setters cannot, so the
// "_from_external_module_1_but_cannot_be_named" case cannot occur.
if (ts.hasModifier(node, 32 /* Static */)) {
@@ -81138,26 +81980,26 @@
function getReturnTypeVisibilityError(symbolAccessibilityResult) {
var diagnosticMessage;
switch (node.kind) {
- case 161 /* ConstructSignature */:
+ case 162 /* ConstructSignature */:
// Interfaces cannot have return types that cannot be named
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0;
break;
- case 160 /* CallSignature */:
+ case 161 /* CallSignature */:
// Interfaces cannot have return types that cannot be named
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0;
break;
- case 162 /* IndexSignature */:
+ case 163 /* IndexSignature */:
// Interfaces cannot have return types that cannot be named
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0;
break;
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
if (ts.hasModifier(node, 32 /* Static */)) {
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
@@ -81165,7 +82007,7 @@
ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 :
ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0;
}
- else if (node.parent.kind === 240 /* ClassDeclaration */) {
+ else if (node.parent.kind === 241 /* ClassDeclaration */) {
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
@@ -81179,7 +82021,7 @@
ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0;
}
break;
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
@@ -81204,30 +82046,30 @@
}
function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
switch (node.parent.kind) {
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1;
- case 161 /* ConstructSignature */:
- case 166 /* ConstructorType */:
+ case 162 /* ConstructSignature */:
+ case 167 /* ConstructorType */:
// Interfaces cannot have parameter types that cannot be named
return symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;
- case 160 /* CallSignature */:
+ case 161 /* CallSignature */:
// Interfaces cannot have parameter types that cannot be named
return symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;
- case 162 /* IndexSignature */:
+ case 163 /* IndexSignature */:
// Interfaces cannot have parameter types that cannot be named
return symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1;
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
if (ts.hasModifier(node.parent, 32 /* Static */)) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
@@ -81235,7 +82077,7 @@
ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1;
}
- else if (node.parent.parent.kind === 240 /* ClassDeclaration */) {
+ else if (node.parent.parent.kind === 241 /* ClassDeclaration */) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -81248,8 +82090,8 @@
ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1;
}
- case 239 /* FunctionDeclaration */:
- case 165 /* FunctionType */:
+ case 240 /* FunctionDeclaration */:
+ case 166 /* FunctionType */:
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -81263,39 +82105,39 @@
// Type parameter constraints are named by user so we should always be able to name it
var diagnosticMessage;
switch (node.parent.kind) {
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1;
break;
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1;
break;
- case 181 /* MappedType */:
+ case 182 /* MappedType */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1;
break;
- case 166 /* ConstructorType */:
- case 161 /* ConstructSignature */:
+ case 167 /* ConstructorType */:
+ case 162 /* ConstructSignature */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;
break;
- case 160 /* CallSignature */:
+ case 161 /* CallSignature */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;
break;
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
if (ts.hasModifier(node.parent, 32 /* Static */)) {
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1;
}
- else if (node.parent.parent.kind === 240 /* ClassDeclaration */) {
+ else if (node.parent.parent.kind === 241 /* ClassDeclaration */) {
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1;
}
else {
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1;
}
break;
- case 165 /* FunctionType */:
- case 239 /* FunctionDeclaration */:
+ case 166 /* FunctionType */:
+ case 240 /* FunctionDeclaration */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1;
break;
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1;
break;
default:
@@ -81310,9 +82152,9 @@
function getHeritageClauseVisibilityError() {
var diagnosticMessage;
// Heritage clause is written by user so it can always be named
- if (node.parent.parent.kind === 240 /* ClassDeclaration */) {
+ if (node.parent.parent.kind === 241 /* ClassDeclaration */) {
// Class or Interface implemented/extended is inaccessible
- diagnosticMessage = ts.isHeritageClause(node.parent) && node.parent.token === 109 /* ImplementsKeyword */ ?
+ diagnosticMessage = ts.isHeritageClause(node.parent) && node.parent.token === 110 /* ImplementsKeyword */ ?
ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 :
ts.Diagnostics.extends_clause_of_exported_class_0_has_or_is_using_private_name_1;
}
@@ -81361,7 +82203,7 @@
}
function isInternalDeclaration(node, currentSourceFile) {
var parseTreeNode = ts.getParseTreeNode(node);
- if (parseTreeNode && parseTreeNode.kind === 151 /* Parameter */) {
+ if (parseTreeNode && parseTreeNode.kind === 152 /* Parameter */) {
var paramIdx = parseTreeNode.parent.parameters.indexOf(parseTreeNode);
var previousSibling = paramIdx > 0 ? parseTreeNode.parent.parameters[paramIdx - 1] : undefined;
var text = currentSourceFile.text;
@@ -81508,10 +82350,10 @@
}
}
function transformRoot(node) {
- if (node.kind === 284 /* SourceFile */ && (node.isDeclarationFile || ts.isSourceFileJS(node))) {
+ if (node.kind === 285 /* SourceFile */ && (node.isDeclarationFile || ts.isSourceFileJS(node))) {
return node;
}
- if (node.kind === 285 /* Bundle */) {
+ if (node.kind === 286 /* Bundle */) {
isBundledEmit = true;
refs = ts.createMap();
libs = ts.createMap();
@@ -81534,14 +82376,14 @@
resultHasExternalModuleIndicator = false; // unused in external module bundle emit (all external modules are within module blocks, therefore are known to be modules)
needsDeclare = false;
var statements_4 = ts.visitNodes(sourceFile.statements, visitDeclarationStatements);
- var newFile = ts.updateSourceFileNode(sourceFile, [ts.createModuleDeclaration([], [ts.createModifier(125 /* DeclareKeyword */)], ts.createLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), ts.createModuleBlock(ts.setTextRange(ts.createNodeArray(transformAndReplaceLatePaintedStatements(statements_4)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []);
+ var newFile = ts.updateSourceFileNode(sourceFile, [ts.createModuleDeclaration([], [ts.createModifier(126 /* DeclareKeyword */)], ts.createLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), ts.createModuleBlock(ts.setTextRange(ts.createNodeArray(transformAndReplaceLatePaintedStatements(statements_4)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []);
return newFile;
}
needsDeclare = true;
var updated = ts.visitNodes(sourceFile.statements, visitDeclarationStatements);
return ts.updateSourceFileNode(sourceFile, transformAndReplaceLatePaintedStatements(updated), /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []);
}), ts.mapDefined(node.prepends, function (prepend) {
- if (prepend.kind === 287 /* InputFiles */) {
+ if (prepend.kind === 288 /* InputFiles */) {
var sourceFile = ts.createUnparsedSourceFile(prepend, "dts", stripInternal);
hasNoDefaultLib_1 = hasNoDefaultLib_1 || !!sourceFile.hasNoDefaultLib;
collectReferences(sourceFile, refs);
@@ -81661,11 +82503,11 @@
return ret;
}
function filterBindingPatternInitializers(name) {
- if (name.kind === 72 /* Identifier */) {
+ if (name.kind === 73 /* Identifier */) {
return name;
}
else {
- if (name.kind === 185 /* ArrayBindingPattern */) {
+ if (name.kind === 186 /* ArrayBindingPattern */) {
return ts.updateArrayBindingPattern(name, ts.visitNodes(name.elements, visitBindingElement));
}
else {
@@ -81673,7 +82515,7 @@
}
}
function visitBindingElement(elem) {
- if (elem.kind === 210 /* OmittedExpression */) {
+ if (elem.kind === 211 /* OmittedExpression */) {
return elem;
}
return ts.updateBindingElement(elem, elem.dotDotDotToken, elem.propertyName, filterBindingPatternInitializers(elem.name), shouldPrintWithInitializer(elem) ? elem.initializer : undefined);
@@ -81711,19 +82553,19 @@
// Literal const declarations will have an initializer ensured rather than a type
return;
}
- var shouldUseResolverType = node.kind === 151 /* Parameter */ &&
+ var shouldUseResolverType = node.kind === 152 /* Parameter */ &&
(resolver.isRequiredInitializedParameter(node) ||
resolver.isOptionalUninitializedParameterProperty(node));
if (type && !shouldUseResolverType) {
return ts.visitNode(type, visitDeclarationSubtree);
}
if (!ts.getParseTreeNode(node)) {
- return type ? ts.visitNode(type, visitDeclarationSubtree) : ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ return type ? ts.visitNode(type, visitDeclarationSubtree) : ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
- if (node.kind === 159 /* SetAccessor */) {
+ if (node.kind === 160 /* SetAccessor */) {
// Set accessors with no associated type node (from it's param or get accessor return) are `any` since they are never contextually typed right now
// (The inferred type here will be void, but the old declaration emitter printed `any`, so this replicates that)
- return ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ return ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
errorNameNode = node.name;
var oldDiag;
@@ -81731,12 +82573,12 @@
oldDiag = getSymbolAccessibilityDiagnostic;
getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(node);
}
- if (node.kind === 237 /* VariableDeclaration */ || node.kind === 186 /* BindingElement */) {
+ if (node.kind === 238 /* VariableDeclaration */ || node.kind === 187 /* BindingElement */) {
return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker));
}
- if (node.kind === 151 /* Parameter */
- || node.kind === 154 /* PropertyDeclaration */
- || node.kind === 153 /* PropertySignature */) {
+ if (node.kind === 152 /* Parameter */
+ || node.kind === 155 /* PropertyDeclaration */
+ || node.kind === 154 /* PropertySignature */) {
if (!node.initializer)
return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType));
return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType) || resolver.createTypeOfExpression(node.initializer, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker));
@@ -81747,26 +82589,26 @@
if (!suppressNewDiagnosticContexts) {
getSymbolAccessibilityDiagnostic = oldDiag;
}
- return returnValue || ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ return returnValue || ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
}
function isDeclarationAndNotVisible(node) {
node = ts.getParseTreeNode(node);
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 240 /* ClassDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 243 /* EnumDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 244 /* EnumDeclaration */:
return !resolver.isDeclarationVisible(node);
// The following should be doing their own visibility checks based on filtering their members
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return !getBindingNameVisible(node);
- case 248 /* ImportEqualsDeclaration */:
- case 249 /* ImportDeclaration */:
- case 255 /* ExportDeclaration */:
- case 254 /* ExportAssignment */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 256 /* ExportDeclaration */:
+ case 255 /* ExportAssignment */:
return false;
}
return false;
@@ -81820,7 +82662,7 @@
function rewriteModuleSpecifier(parent, input) {
if (!input)
return undefined; // TODO: GH#18217
- resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 244 /* ModuleDeclaration */ && parent.kind !== 183 /* ImportType */);
+ resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 245 /* ModuleDeclaration */ && parent.kind !== 184 /* ImportType */);
if (ts.isStringLiteralLike(input)) {
if (isBundledEmit) {
var newName = ts.getExternalModuleNameFromDeclaration(context.getEmitHost(), resolver, parent);
@@ -81840,7 +82682,7 @@
function transformImportEqualsDeclaration(decl) {
if (!resolver.isDeclarationVisible(decl))
return;
- if (decl.moduleReference.kind === 259 /* ExternalModuleReference */) {
+ if (decl.moduleReference.kind === 260 /* ExternalModuleReference */) {
// Rewrite external module names if necessary
var specifier = ts.getExternalModuleImportEqualsDeclarationExpression(decl);
return ts.updateImportEqualsDeclaration(decl,
@@ -81867,7 +82709,7 @@
return visibleDefaultBinding && ts.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, ts.updateImportClause(decl.importClause, visibleDefaultBinding,
/*namedBindings*/ undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier));
}
- if (decl.importClause.namedBindings.kind === 251 /* NamespaceImport */) {
+ if (decl.importClause.namedBindings.kind === 252 /* NamespaceImport */) {
// Namespace import (optionally with visible default)
var namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : /*namedBindings*/ undefined;
return visibleDefaultBinding || namedBindings ? ts.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, ts.updateImportClause(decl.importClause, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier)) : undefined;
@@ -81975,68 +82817,68 @@
checkEntityNameVisibility(input.exprName, enclosingDeclaration);
}
var oldWithinObjectLiteralType = suppressNewDiagnosticContexts;
- var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 168 /* TypeLiteral */ || input.kind === 181 /* MappedType */) && input.parent.kind !== 242 /* TypeAliasDeclaration */);
+ var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 169 /* TypeLiteral */ || input.kind === 182 /* MappedType */) && input.parent.kind !== 243 /* TypeAliasDeclaration */);
if (shouldEnterSuppressNewDiagnosticsContextContext) {
// We stop making new diagnostic contexts within object literal types. Unless it's an object type on the RHS of a type alias declaration. Then we do.
suppressNewDiagnosticContexts = true;
}
if (isProcessedComponent(input)) {
switch (input.kind) {
- case 211 /* ExpressionWithTypeArguments */: {
+ case 212 /* ExpressionWithTypeArguments */: {
if ((ts.isEntityName(input.expression) || ts.isEntityNameExpression(input.expression))) {
checkEntityNameVisibility(input.expression, enclosingDeclaration);
}
var node = ts.visitEachChild(input, visitDeclarationSubtree, context);
return cleanup(ts.updateExpressionWithTypeArguments(node, ts.parenthesizeTypeParameters(node.typeArguments), node.expression));
}
- case 164 /* TypeReference */: {
+ case 165 /* TypeReference */: {
checkEntityNameVisibility(input.typeName, enclosingDeclaration);
var node = ts.visitEachChild(input, visitDeclarationSubtree, context);
return cleanup(ts.updateTypeReferenceNode(node, node.typeName, ts.parenthesizeTypeParameters(node.typeArguments)));
}
- case 161 /* ConstructSignature */:
+ case 162 /* ConstructSignature */:
return cleanup(ts.updateConstructSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type)));
- case 157 /* Constructor */: {
+ case 158 /* Constructor */: {
var isPrivate = ts.hasModifier(input, 8 /* Private */);
// A constructor declaration may not have a type annotation
- var ctor = ts.createSignatureDeclaration(157 /* Constructor */, isPrivate ? undefined : ensureTypeParams(input, input.typeParameters),
+ var ctor = ts.createSignatureDeclaration(158 /* Constructor */, isPrivate ? undefined : ensureTypeParams(input, input.typeParameters),
// TODO: GH#18217
isPrivate ? undefined : updateParamsList(input, input.parameters, 0 /* None */),
/*type*/ undefined);
ctor.modifiers = ts.createNodeArray(ensureModifiers(input));
return cleanup(ctor);
}
- case 156 /* MethodDeclaration */: {
- var sig = ts.createSignatureDeclaration(155 /* MethodSignature */, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type));
+ case 157 /* MethodDeclaration */: {
+ var sig = ts.createSignatureDeclaration(156 /* MethodSignature */, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type));
sig.name = input.name;
sig.modifiers = ts.createNodeArray(ensureModifiers(input));
sig.questionToken = input.questionToken;
return cleanup(sig);
}
- case 158 /* GetAccessor */: {
+ case 159 /* GetAccessor */: {
var newNode = ensureAccessor(input);
return cleanup(newNode);
}
- case 159 /* SetAccessor */: {
+ case 160 /* SetAccessor */: {
var newNode = ensureAccessor(input);
return cleanup(newNode);
}
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return cleanup(ts.updateProperty(input,
/*decorators*/ undefined, ensureModifiers(input), input.name, input.questionToken, !ts.hasModifier(input, 8 /* Private */) ? ensureType(input, input.type) : undefined, ensureNoInitializer(input)));
- case 153 /* PropertySignature */:
+ case 154 /* PropertySignature */:
return cleanup(ts.updatePropertySignature(input, ensureModifiers(input), input.name, input.questionToken, !ts.hasModifier(input, 8 /* Private */) ? ensureType(input, input.type) : undefined, ensureNoInitializer(input)));
- case 155 /* MethodSignature */: {
+ case 156 /* MethodSignature */: {
return cleanup(ts.updateMethodSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type), input.name, input.questionToken));
}
- case 160 /* CallSignature */: {
+ case 161 /* CallSignature */: {
return cleanup(ts.updateCallSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type)));
}
- case 162 /* IndexSignature */: {
+ case 163 /* IndexSignature */: {
return cleanup(ts.updateIndexSignature(input,
- /*decorators*/ undefined, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || ts.createKeywordTypeNode(120 /* AnyKeyword */)));
+ /*decorators*/ undefined, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || ts.createKeywordTypeNode(121 /* AnyKeyword */)));
}
- case 237 /* VariableDeclaration */: {
+ case 238 /* VariableDeclaration */: {
if (ts.isBindingPattern(input.name)) {
return recreateBindingPattern(input.name);
}
@@ -82044,13 +82886,13 @@
suppressNewDiagnosticContexts = true; // Variable declaration types also suppress new diagnostic contexts, provided the contexts wouldn't be made for binding pattern types
return cleanup(ts.updateVariableDeclaration(input, input.name, ensureType(input, input.type), ensureNoInitializer(input)));
}
- case 150 /* TypeParameter */: {
+ case 151 /* TypeParameter */: {
if (isPrivateMethodTypeParameter(input) && (input.default || input.constraint)) {
return cleanup(ts.updateTypeParameterDeclaration(input, input.name, /*constraint*/ undefined, /*defaultType*/ undefined));
}
return cleanup(ts.visitEachChild(input, visitDeclarationSubtree, context));
}
- case 175 /* ConditionalType */: {
+ case 176 /* ConditionalType */: {
// We have to process conditional types in a special way because for visibility purposes we need to push a new enclosingDeclaration
// just for the `infer` types in the true branch. It's an implicit declaration scope that only applies to _part_ of the type.
var checkType = ts.visitNode(input.checkType, visitDeclarationSubtree);
@@ -82062,13 +82904,13 @@
var falseType = ts.visitNode(input.falseType, visitDeclarationSubtree);
return cleanup(ts.updateConditionalTypeNode(input, checkType, extendsType, trueType, falseType));
}
- case 165 /* FunctionType */: {
+ case 166 /* FunctionType */: {
return cleanup(ts.updateFunctionTypeNode(input, ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree)));
}
- case 166 /* ConstructorType */: {
+ case 167 /* ConstructorType */: {
return cleanup(ts.updateConstructorTypeNode(input, ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree)));
}
- case 183 /* ImportType */: {
+ case 184 /* ImportType */: {
if (!ts.isLiteralImportTypeNode(input))
return cleanup(input);
return cleanup(ts.updateImportTypeNode(input, ts.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)), input.qualifier, ts.visitNodes(input.typeArguments, visitDeclarationSubtree, ts.isTypeNode), input.isTypeOf));
@@ -82097,7 +82939,7 @@
}
}
function isPrivateMethodTypeParameter(node) {
- return node.parent.kind === 156 /* MethodDeclaration */ && ts.hasModifier(node.parent, 8 /* Private */);
+ return node.parent.kind === 157 /* MethodDeclaration */ && ts.hasModifier(node.parent, 8 /* Private */);
}
function visitDeclarationStatements(input) {
if (!isPreservedDeclarationStatement(input)) {
@@ -82107,7 +82949,7 @@
if (shouldStripInternal(input))
return;
switch (input.kind) {
- case 255 /* ExportDeclaration */: {
+ case 256 /* ExportDeclaration */: {
if (ts.isSourceFile(input.parent)) {
resultHasExternalModuleIndicator = true;
resultHasScopeMarker = true;
@@ -82116,13 +82958,13 @@
// Rewrite external module names if necessary
return ts.updateExportDeclaration(input, /*decorators*/ undefined, input.modifiers, input.exportClause, rewriteModuleSpecifier(input, input.moduleSpecifier));
}
- case 254 /* ExportAssignment */: {
+ case 255 /* ExportAssignment */: {
// Always visible if the parent node isn't dropped for being not visible
if (ts.isSourceFile(input.parent)) {
resultHasExternalModuleIndicator = true;
resultHasScopeMarker = true;
}
- if (input.expression.kind === 72 /* Identifier */) {
+ if (input.expression.kind === 73 /* Identifier */) {
return input;
}
else {
@@ -82132,7 +82974,7 @@
errorNode: input
}); };
var varDecl = ts.createVariableDeclaration(newId, resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined);
- var statement = ts.createVariableStatement(needsDeclare ? [ts.createModifier(125 /* DeclareKeyword */)] : [], ts.createVariableDeclarationList([varDecl], 2 /* Const */));
+ var statement = ts.createVariableStatement(needsDeclare ? [ts.createModifier(126 /* DeclareKeyword */)] : [], ts.createVariableDeclarationList([varDecl], 2 /* Const */));
return [statement, ts.updateExportAssignment(input, input.decorators, input.modifiers, newId)];
}
}
@@ -82146,10 +82988,10 @@
if (shouldStripInternal(input))
return;
switch (input.kind) {
- case 248 /* ImportEqualsDeclaration */: {
+ case 249 /* ImportEqualsDeclaration */: {
return transformImportEqualsDeclaration(input);
}
- case 249 /* ImportDeclaration */: {
+ case 250 /* ImportDeclaration */: {
return transformImportDeclaration(input);
}
}
@@ -82170,14 +83012,14 @@
}
var previousNeedsDeclare = needsDeclare;
switch (input.kind) {
- case 242 /* TypeAliasDeclaration */: // Type aliases get `declare`d if need be (for legacy support), but that's all
+ case 243 /* TypeAliasDeclaration */: // Type aliases get `declare`d if need be (for legacy support), but that's all
return cleanup(ts.updateTypeAliasDeclaration(input,
/*decorators*/ undefined, ensureModifiers(input, isPrivate), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode)));
- case 241 /* InterfaceDeclaration */: {
+ case 242 /* InterfaceDeclaration */: {
return cleanup(ts.updateInterfaceDeclaration(input,
/*decorators*/ undefined, ensureModifiers(input, isPrivate), input.name, ensureTypeParams(input, input.typeParameters), transformHeritageClauses(input.heritageClauses), ts.visitNodes(input.members, visitDeclarationSubtree)));
}
- case 239 /* FunctionDeclaration */: {
+ case 240 /* FunctionDeclaration */: {
// Generators lose their generator-ness, excepting their return type
var clean = cleanup(ts.updateFunctionDeclaration(input,
/*decorators*/ undefined, ensureModifiers(input, isPrivate),
@@ -82195,16 +83037,32 @@
return ts.createVariableStatement(/*modifiers*/ undefined, ts.createVariableDeclarationList([varDecl]));
});
var namespaceDecl = ts.createModuleDeclaration(/*decorators*/ undefined, ensureModifiers(input, isPrivate), input.name, ts.createModuleBlock(declarations), 16 /* Namespace */);
+ if (!ts.hasModifier(clean, 513 /* ExportDefault */)) {
return [clean, namespaceDecl];
}
+ var modifiers = ts.createModifiersFromModifierFlags((ts.getModifierFlags(clean) & ~513 /* ExportDefault */) | 2 /* Ambient */);
+ var cleanDeclaration = ts.updateFunctionDeclaration(clean,
+ /*decorators*/ undefined, modifiers,
+ /*asteriskToken*/ undefined, clean.name, clean.typeParameters, clean.parameters, clean.type,
+ /*body*/ undefined);
+ var namespaceDeclaration = ts.updateModuleDeclaration(namespaceDecl,
+ /*decorators*/ undefined, modifiers, namespaceDecl.name, namespaceDecl.body);
+ var exportDefaultDeclaration = ts.createExportAssignment(
+ /*decorators*/ undefined,
+ /*modifiers*/ undefined,
+ /*isExportEquals*/ false, namespaceDecl.name);
+ resultHasExternalModuleIndicator = true;
+ resultHasScopeMarker = true;
+ return [cleanDeclaration, namespaceDeclaration, exportDefaultDeclaration];
+ }
else {
return clean;
}
}
- case 244 /* ModuleDeclaration */: {
+ case 245 /* ModuleDeclaration */: {
needsDeclare = false;
var inner = input.body;
- if (inner && inner.kind === 245 /* ModuleBlock */) {
+ if (inner && inner.kind === 246 /* ModuleBlock */) {
var statements = ts.visitNodes(inner.statements, visitDeclarationStatements);
var body = ts.updateModuleBlock(inner, transformAndReplaceLatePaintedStatements(statements));
needsDeclare = previousNeedsDeclare;
@@ -82225,7 +83083,7 @@
/*decorators*/ undefined, mods, input.name, body));
}
}
- case 240 /* ClassDeclaration */: {
+ case 241 /* ClassDeclaration */: {
var modifiers = ts.createNodeArray(ensureModifiers(input, isPrivate));
var typeParameters = ensureTypeParams(input, input.typeParameters);
var ctor = ts.getFirstConstructorWithBody(input);
@@ -82236,7 +83094,7 @@
if (!ts.hasModifier(param, 92 /* ParameterPropertyModifier */) || shouldStripInternal(param))
return;
getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(param);
- if (param.name.kind === 72 /* Identifier */) {
+ if (param.name.kind === 73 /* Identifier */) {
return preserveJsDoc(ts.createProperty(
/*decorators*/ undefined, ensureModifiers(param), param.name, param.questionToken, ensureType(param, param.type), ensureNoInitializer(param)), param);
}
@@ -82266,7 +83124,7 @@
}
var members = ts.createNodeArray(ts.concatenate(parameterProperties, ts.visitNodes(input.members, visitDeclarationSubtree)));
var extendsClause_1 = ts.getEffectiveBaseTypeNode(input);
- if (extendsClause_1 && !ts.isEntityNameExpression(extendsClause_1.expression) && extendsClause_1.expression.kind !== 96 /* NullKeyword */) {
+ if (extendsClause_1 && !ts.isEntityNameExpression(extendsClause_1.expression) && extendsClause_1.expression.kind !== 97 /* NullKeyword */) {
// We must add a temporary declaration for the extends clause expression
var oldId = input.name ? ts.unescapeLeadingUnderscores(input.name.escapedText) : "default";
var newId_1 = ts.createOptimisticUniqueName(oldId + "_base");
@@ -82276,16 +83134,16 @@
typeName: input.name
}); };
var varDecl = ts.createVariableDeclaration(newId_1, resolver.createTypeOfExpression(extendsClause_1.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined);
- var statement = ts.createVariableStatement(needsDeclare ? [ts.createModifier(125 /* DeclareKeyword */)] : [], ts.createVariableDeclarationList([varDecl], 2 /* Const */));
+ var statement = ts.createVariableStatement(needsDeclare ? [ts.createModifier(126 /* DeclareKeyword */)] : [], ts.createVariableDeclarationList([varDecl], 2 /* Const */));
var heritageClauses = ts.createNodeArray(ts.map(input.heritageClauses, function (clause) {
- if (clause.token === 86 /* ExtendsKeyword */) {
+ if (clause.token === 87 /* ExtendsKeyword */) {
var oldDiag_2 = getSymbolAccessibilityDiagnostic;
getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(clause.types[0]);
var newClause = ts.updateHeritageClause(clause, ts.map(clause.types, function (t) { return ts.updateExpressionWithTypeArguments(t, ts.visitNodes(t.typeArguments, visitDeclarationSubtree), newId_1); }));
getSymbolAccessibilityDiagnostic = oldDiag_2;
return newClause;
}
- return ts.updateHeritageClause(clause, ts.visitNodes(ts.createNodeArray(ts.filter(clause.types, function (t) { return ts.isEntityNameExpression(t.expression) || t.expression.kind === 96 /* NullKeyword */; })), visitDeclarationSubtree));
+ return ts.updateHeritageClause(clause, ts.visitNodes(ts.createNodeArray(ts.filter(clause.types, function (t) { return ts.isEntityNameExpression(t.expression) || t.expression.kind === 97 /* NullKeyword */; })), visitDeclarationSubtree));
}));
return [statement, cleanup(ts.updateClassDeclaration(input,
/*decorators*/ undefined, modifiers, input.name, typeParameters, heritageClauses, members))]; // TODO: GH#18217
@@ -82296,10 +83154,10 @@
/*decorators*/ undefined, modifiers, input.name, typeParameters, heritageClauses, members));
}
}
- case 219 /* VariableStatement */: {
+ case 220 /* VariableStatement */: {
return cleanup(transformVariableStatement(input, isPrivate));
}
- case 243 /* EnumDeclaration */: {
+ case 244 /* EnumDeclaration */: {
return cleanup(ts.updateEnumDeclaration(input, /*decorators*/ undefined, ts.createNodeArray(ensureModifiers(input, isPrivate)), input.name, ts.createNodeArray(ts.mapDefined(input.members, function (m) {
if (shouldStripInternal(m))
return;
@@ -82318,7 +83176,7 @@
if (canProdiceDiagnostic) {
getSymbolAccessibilityDiagnostic = oldDiag;
}
- if (input.kind === 244 /* ModuleDeclaration */) {
+ if (input.kind === 245 /* ModuleDeclaration */) {
needsDeclare = previousNeedsDeclare;
}
if (node === input) {
@@ -82339,7 +83197,7 @@
return ts.flatten(ts.mapDefined(d.elements, function (e) { return recreateBindingElement(e); }));
}
function recreateBindingElement(e) {
- if (e.kind === 210 /* OmittedExpression */) {
+ if (e.kind === 211 /* OmittedExpression */) {
return;
}
if (e.name) {
@@ -82392,7 +83250,7 @@
function ensureModifierFlags(node, privateDeclaration) {
var mask = 3071 /* All */ ^ (4 /* Public */ | 256 /* Async */); // No async modifiers in declaration files
var additions = (needsDeclare && !isAlwaysType(node)) ? 2 /* Ambient */ : 0 /* None */;
- var parentIsFile = node.parent.kind === 284 /* SourceFile */;
+ var parentIsFile = node.parent.kind === 285 /* SourceFile */;
if (!parentIsFile || (isBundledEmit && parentIsFile && ts.isExternalModule(node.parent))) {
mask ^= ((privateDeclaration || (isBundledEmit && parentIsFile) || hasScopeMarker(node.parent) ? 0 : 1 /* Export */) | 2 /* Ambient */);
additions = 0 /* None */;
@@ -82413,7 +83271,7 @@
var prop = ts.createProperty(/*decorators*/ undefined, maskModifiers(node, /*mask*/ undefined, (!accessors.setAccessor) ? 64 /* Readonly */ : 0 /* None */), node.name, node.questionToken, ensureType(node, accessorType), /*initializer*/ undefined);
var leadingsSyntheticCommentRanges = accessors.secondAccessor && ts.getLeadingCommentRangesOfNode(accessors.secondAccessor, currentSourceFile);
if (leadingsSyntheticCommentRanges) {
- var _loop_10 = function (range) {
+ var _loop_13 = function (range) {
if (range.kind === 3 /* MultiLineCommentTrivia */) {
var text = currentSourceFile.text.slice(range.pos + 2, range.end - 2);
var lines = text.split(/\r\n?|\n/g);
@@ -82427,20 +83285,20 @@
};
for (var _i = 0, leadingsSyntheticCommentRanges_1 = leadingsSyntheticCommentRanges; _i < leadingsSyntheticCommentRanges_1.length; _i++) {
var range = leadingsSyntheticCommentRanges_1[_i];
- _loop_10(range);
+ _loop_13(range);
}
}
return prop;
}
function transformHeritageClauses(nodes) {
return ts.createNodeArray(ts.filter(ts.map(nodes, function (clause) { return ts.updateHeritageClause(clause, ts.visitNodes(ts.createNodeArray(ts.filter(clause.types, function (t) {
- return ts.isEntityNameExpression(t.expression) || (clause.token === 86 /* ExtendsKeyword */ && t.expression.kind === 96 /* NullKeyword */);
+ return ts.isEntityNameExpression(t.expression) || (clause.token === 87 /* ExtendsKeyword */ && t.expression.kind === 97 /* NullKeyword */);
})), visitDeclarationSubtree)); }), function (clause) { return clause.types && !!clause.types.length; }));
}
}
ts.transformDeclarations = transformDeclarations;
function isAlwaysType(node) {
- if (node.kind === 241 /* InterfaceDeclaration */) {
+ if (node.kind === 242 /* InterfaceDeclaration */) {
return true;
}
return false;
@@ -82465,7 +83323,7 @@
}
function getTypeAnnotationFromAccessor(accessor) {
if (accessor) {
- return accessor.kind === 158 /* GetAccessor */
+ return accessor.kind === 159 /* GetAccessor */
? accessor.type // Getter - return type
: accessor.parameters.length > 0
? accessor.parameters[0].type // Setter parameter type
@@ -82474,52 +83332,52 @@
}
function canHaveLiteralInitializer(node) {
switch (node.kind) {
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
return !ts.hasModifier(node, 8 /* Private */);
- case 151 /* Parameter */:
- case 237 /* VariableDeclaration */:
+ case 152 /* Parameter */:
+ case 238 /* VariableDeclaration */:
return true;
}
return false;
}
function isPreservedDeclarationStatement(node) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 240 /* ClassDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 243 /* EnumDeclaration */:
- case 219 /* VariableStatement */:
- case 249 /* ImportDeclaration */:
- case 255 /* ExportDeclaration */:
- case 254 /* ExportAssignment */:
+ case 240 /* FunctionDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 220 /* VariableStatement */:
+ case 250 /* ImportDeclaration */:
+ case 256 /* ExportDeclaration */:
+ case 255 /* ExportAssignment */:
return true;
}
return false;
}
function isProcessedComponent(node) {
switch (node.kind) {
- case 161 /* ConstructSignature */:
- case 157 /* Constructor */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 155 /* MethodSignature */:
- case 160 /* CallSignature */:
- case 162 /* IndexSignature */:
- case 237 /* VariableDeclaration */:
- case 150 /* TypeParameter */:
- case 211 /* ExpressionWithTypeArguments */:
- case 164 /* TypeReference */:
- case 175 /* ConditionalType */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 183 /* ImportType */:
+ case 162 /* ConstructSignature */:
+ case 158 /* Constructor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 156 /* MethodSignature */:
+ case 161 /* CallSignature */:
+ case 163 /* IndexSignature */:
+ case 238 /* VariableDeclaration */:
+ case 151 /* TypeParameter */:
+ case 212 /* ExpressionWithTypeArguments */:
+ case 165 /* TypeReference */:
+ case 176 /* ConditionalType */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 184 /* ImportType */:
return true;
}
return false;
@@ -82551,17 +83409,27 @@
SyntaxKindFeatureFlags[SyntaxKindFeatureFlags["Substitution"] = 1] = "Substitution";
SyntaxKindFeatureFlags[SyntaxKindFeatureFlags["EmitNotifications"] = 2] = "EmitNotifications";
})(SyntaxKindFeatureFlags || (SyntaxKindFeatureFlags = {}));
- function getTransformers(compilerOptions, customTransformers) {
+ ts.noTransformers = { scriptTransformers: ts.emptyArray, declarationTransformers: ts.emptyArray };
+ function getTransformers(compilerOptions, customTransformers, emitOnlyDtsFiles) {
+ return {
+ scriptTransformers: getScriptTransformers(compilerOptions, customTransformers, emitOnlyDtsFiles),
+ declarationTransformers: getDeclarationTransformers(customTransformers),
+ };
+ }
+ ts.getTransformers = getTransformers;
+ function getScriptTransformers(compilerOptions, customTransformers, emitOnlyDtsFiles) {
+ if (emitOnlyDtsFiles)
+ return ts.emptyArray;
var jsx = compilerOptions.jsx;
var languageVersion = ts.getEmitScriptTarget(compilerOptions);
var moduleKind = ts.getEmitModuleKind(compilerOptions);
var transformers = [];
- ts.addRange(transformers, customTransformers && customTransformers.before);
+ ts.addRange(transformers, customTransformers && ts.map(customTransformers.before, wrapScriptTransformerFactory));
transformers.push(ts.transformTypeScript);
if (jsx === 2 /* React */) {
transformers.push(ts.transformJsx);
}
- if (languageVersion < 7 /* ESNext */) {
+ if (languageVersion < 8 /* ESNext */) {
transformers.push(ts.transformESNext);
}
if (languageVersion < 6 /* ES2019 */) {
@@ -82586,10 +83454,38 @@
if (languageVersion < 1 /* ES5 */) {
transformers.push(ts.transformES5);
}
- ts.addRange(transformers, customTransformers && customTransformers.after);
+ ts.addRange(transformers, customTransformers && ts.map(customTransformers.after, wrapScriptTransformerFactory));
return transformers;
}
- ts.getTransformers = getTransformers;
+ function getDeclarationTransformers(customTransformers) {
+ var transformers = [];
+ transformers.push(ts.transformDeclarations);
+ ts.addRange(transformers, customTransformers && ts.map(customTransformers.afterDeclarations, wrapDeclarationTransformerFactory));
+ return transformers;
+ }
+ /**
+ * Wrap a custom script or declaration transformer object in a `Transformer` callback with fallback support for transforming bundles.
+ */
+ function wrapCustomTransformer(transformer) {
+ return function (node) { return ts.isBundle(node) ? transformer.transformBundle(node) : transformer.transformSourceFile(node); };
+ }
+ /**
+ * Wrap a transformer factory that may return a custom script or declaration transformer object.
+ */
+ function wrapCustomTransformerFactory(transformer, handleDefault) {
+ return function (context) {
+ var customTransformer = transformer(context);
+ return typeof customTransformer === "function"
+ ? handleDefault(customTransformer)
+ : wrapCustomTransformer(customTransformer);
+ };
+ }
+ function wrapScriptTransformerFactory(transformer) {
+ return wrapCustomTransformerFactory(transformer, ts.chainBundle);
+ }
+ function wrapDeclarationTransformerFactory(transformer) {
+ return wrapCustomTransformerFactory(transformer, ts.identity);
+ }
function noEmitSubstitution(_hint, node) {
return node;
}
@@ -82609,7 +83505,7 @@
* @param allowDtsFiles A value indicating whether to allow the transformation of .d.ts files.
*/
function transformNodes(resolver, host, options, nodes, transformers, allowDtsFiles) {
- var enabledSyntaxKindFeatures = new Array(317 /* Count */);
+ var enabledSyntaxKindFeatures = new Array(318 /* Count */);
var lexicalEnvironmentVariableDeclarations;
var lexicalEnvironmentFunctionDeclarations;
var lexicalEnvironmentVariableDeclarationsStack = [];
@@ -82662,7 +83558,14 @@
}
ts.performance.mark("beforeTransform");
// Chain together and initialize each transformer.
- var transformation = ts.chain.apply(void 0, transformers)(context);
+ var transformersWithContext = transformers.map(function (t) { return t(context); });
+ var transformation = function (node) {
+ for (var _i = 0, transformersWithContext_1 = transformersWithContext; _i < transformersWithContext_1.length; _i++) {
+ var transform = transformersWithContext_1[_i];
+ node = transform(node);
+ }
+ return node;
+ };
// prevent modification of transformation hooks.
state = 1 /* Initialized */;
// Transform each node.
@@ -82814,6 +83717,7 @@
if (lexicalEnvironmentVariableDeclarations) {
var statement = ts.createVariableStatement(
/*modifiers*/ undefined, ts.createVariableDeclarationList(lexicalEnvironmentVariableDeclarations));
+ ts.setEmitFlags(statement, 1048576 /* CustomPrologue */);
if (!statements) {
statements = [statement];
}
@@ -82921,7 +83825,7 @@
/*@internal*/
function getOutputPathForBuildInfo(options) {
var configFile = options.configFilePath;
- if (!configFile || !ts.isIncrementalCompilation(options))
+ if (!ts.isIncrementalCompilation(options))
return undefined;
if (options.tsBuildInfoFile)
return options.tsBuildInfoFile;
@@ -82931,6 +83835,8 @@
buildInfoExtensionLess = ts.removeFileExtension(outPath);
}
else {
+ if (!configFile)
+ return undefined;
var configFileExtensionLess = ts.removeFileExtension(configFile);
buildInfoExtensionLess = options.outDir ?
options.rootDir ?
@@ -82955,7 +83861,7 @@
/*@internal*/
function getOutputPathsFor(sourceFile, host, forceDtsPaths) {
var options = host.getCompilerOptions();
- if (sourceFile.kind === 285 /* Bundle */) {
+ if (sourceFile.kind === 286 /* Bundle */) {
return getOutputPathsForBundle(options, forceDtsPaths);
}
else {
@@ -83082,14 +83988,15 @@
ts.getFirstProjectOutput = getFirstProjectOutput;
/*@internal*/
// targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature
- function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles, transformers, declarationTransformers, onlyBuildInfo) {
+ function emitFiles(resolver, host, targetSourceFile, _a, emitOnlyDtsFiles, onlyBuildInfo) {
+ var scriptTransformers = _a.scriptTransformers, declarationTransformers = _a.declarationTransformers;
var compilerOptions = host.getCompilerOptions();
var sourceMapDataList = (compilerOptions.sourceMap || compilerOptions.inlineSourceMap || ts.getAreDeclarationMapsEnabled(compilerOptions)) ? [] : undefined;
var emittedFilesList = compilerOptions.listEmittedFiles ? [] : undefined;
var emitterDiagnostics = ts.createDiagnosticCollection();
var newLine = ts.getNewLineCharacter(compilerOptions, function () { return host.getNewLine(); });
var writer = ts.createTextWriter(newLine);
- var _a = ts.performance.createTimer("printTime", "beforePrint", "afterPrint"), enter = _a.enter, exit = _a.exit;
+ var _b = ts.performance.createTimer("printTime", "beforePrint", "afterPrint"), enter = _b.enter, exit = _b.exit;
var bundleBuildInfo;
var emitSkipped = false;
var exportedModulesFromDeclarationEmit;
@@ -83158,7 +84065,7 @@
return;
}
// Transform the source files
- var transform = ts.transformNodes(resolver, host, compilerOptions, [sourceFileOrBundle], transformers, /*allowDtsFiles*/ false);
+ var transform = ts.transformNodes(resolver, host, compilerOptions, [sourceFileOrBundle], scriptTransformers, /*allowDtsFiles*/ false);
var printerOptions = {
removeComments: compilerOptions.removeComments,
newLine: compilerOptions.newLine,
@@ -83199,7 +84106,7 @@
// Do that here when emitting only dts files
nonJsFiles.forEach(collectLinkedAliases);
}
- var declarationTransform = ts.transformNodes(resolver, host, compilerOptions, inputListOrBundle, ts.concatenate([ts.transformDeclarations], declarationTransformers), /*allowDtsFiles*/ false);
+ var declarationTransform = ts.transformNodes(resolver, host, compilerOptions, inputListOrBundle, declarationTransformers, /*allowDtsFiles*/ false);
if (ts.length(declarationTransform.diagnostics)) {
for (var _a = 0, _b = declarationTransform.diagnostics; _a < _b.length; _a++) {
var diagnostic = _b[_a];
@@ -83236,7 +84143,7 @@
mapRoot: compilerOptions.mapRoot,
extendedDiagnostics: compilerOptions.extendedDiagnostics,
});
- if (emitOnlyDtsFiles && declarationTransform.transformed[0].kind === 284 /* SourceFile */) {
+ if (emitOnlyDtsFiles && declarationTransform.transformed[0].kind === 285 /* SourceFile */) {
var sourceFile = declarationTransform.transformed[0];
exportedModulesFromDeclarationEmit = sourceFile.exportedModulesFromDeclarationEmit;
}
@@ -83247,7 +84154,7 @@
}
function collectLinkedAliases(node) {
if (ts.isExportAssignment(node)) {
- if (node.expression.kind === 72 /* Identifier */) {
+ if (node.expression.kind === 73 /* Identifier */) {
resolver.collectLinkedAliases(node.expression, /*setVisibility*/ true);
}
return;
@@ -83259,8 +84166,8 @@
ts.forEachChild(node, collectLinkedAliases);
}
function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, sourceFileOrBundle, printer, mapOptions) {
- var bundle = sourceFileOrBundle.kind === 285 /* Bundle */ ? sourceFileOrBundle : undefined;
- var sourceFile = sourceFileOrBundle.kind === 284 /* SourceFile */ ? sourceFileOrBundle : undefined;
+ var bundle = sourceFileOrBundle.kind === 286 /* Bundle */ ? sourceFileOrBundle : undefined;
+ var sourceFile = sourceFileOrBundle.kind === 285 /* SourceFile */ ? sourceFileOrBundle : undefined;
var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile];
var sourceMapGenerator;
if (shouldEmitSourceMaps(mapOptions, sourceFileOrBundle)) {
@@ -83301,7 +84208,7 @@
}
function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) {
return (mapOptions.sourceMap || mapOptions.inlineSourceMap)
- && (sourceFileOrBundle.kind !== 284 /* SourceFile */ || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Json */));
+ && (sourceFileOrBundle.kind !== 285 /* SourceFile */ || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Json */));
}
function getSourceRoot(mapOptions) {
// Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the
@@ -83411,7 +84318,7 @@
};
function createSourceFilesFromBundleBuildInfo(bundle) {
var sourceFiles = bundle.sourceFiles.map(function (fileName) {
- var sourceFile = ts.createNode(284 /* SourceFile */, 0, 0);
+ var sourceFile = ts.createNode(285 /* SourceFile */, 0, 0);
sourceFile.fileName = fileName;
sourceFile.text = "";
sourceFile.statements = ts.createNodeArray();
@@ -83423,7 +84330,7 @@
sourceFile.text = prologueInfo.text;
sourceFile.end = prologueInfo.text.length;
sourceFile.statements = ts.createNodeArray(prologueInfo.directives.map(function (directive) {
- var statement = ts.createNode(221 /* ExpressionStatement */, directive.pos, directive.end);
+ var statement = ts.createNode(222 /* ExpressionStatement */, directive.pos, directive.end);
statement.expression = ts.createNode(10 /* StringLiteral */, directive.expression.pos, directive.expression.end);
statement.expression.text = directive.expression.text;
return statement;
@@ -83515,7 +84422,7 @@
useCaseSensitiveFileNames: function () { return host.useCaseSensitiveFileNames(); },
getProgramBuildInfo: ts.returnUndefined
};
- emitFiles(ts.notImplementedResolver, emitHost, /*targetSourceFile*/ undefined, /*emitOnlyDtsFiles*/ false, ts.getTransformers(config.options));
+ emitFiles(ts.notImplementedResolver, emitHost, /*targetSourceFile*/ undefined, ts.getTransformers(config.options), /*emitOnlyDtsFiles*/ false);
return outputFiles;
}
ts.emitUsingBuildInfo = emitUsingBuildInfo;
@@ -83592,9 +84499,9 @@
break;
}
switch (node.kind) {
- case 284 /* SourceFile */: return printFile(node);
- case 285 /* Bundle */: return printBundle(node);
- case 286 /* UnparsedSource */: return printUnparsedSource(node);
+ case 285 /* SourceFile */: return printFile(node);
+ case 286 /* Bundle */: return printBundle(node);
+ case 287 /* UnparsedSource */: return printUnparsedSource(node);
}
writeNode(hint, node, sourceFile, beginPrint());
return endPrint();
@@ -83824,12 +84731,12 @@
}
// falls through
case 2 /* Comments */:
- if (!commentsDisabled && node.kind !== 284 /* SourceFile */) {
+ if (!commentsDisabled && node.kind !== 285 /* SourceFile */) {
return pipelineEmitWithComments;
}
// falls through
case 3 /* SourceMaps */:
- if (!sourceMapsDisabled && node.kind !== 284 /* SourceFile */ && !ts.isInJsonFile(node)) {
+ if (!sourceMapsDisabled && node.kind !== 285 /* SourceFile */ && !ts.isInJsonFile(node)) {
return pipelineEmitWithSourceMap;
}
// falls through
@@ -83866,272 +84773,272 @@
case 16 /* TemplateMiddle */:
case 17 /* TemplateTail */:
return emitLiteral(node);
- case 286 /* UnparsedSource */:
- case 280 /* UnparsedPrepend */:
+ case 287 /* UnparsedSource */:
+ case 281 /* UnparsedPrepend */:
return emitUnparsedSourceOrPrepend(node);
- case 279 /* UnparsedPrologue */:
+ case 280 /* UnparsedPrologue */:
return writeUnparsedNode(node);
- case 281 /* UnparsedText */:
- case 282 /* UnparsedInternalText */:
+ case 282 /* UnparsedText */:
+ case 283 /* UnparsedInternalText */:
return emitUnparsedTextLike(node);
- case 283 /* UnparsedSyntheticReference */:
+ case 284 /* UnparsedSyntheticReference */:
return emitUnparsedSyntheticReference(node);
// Identifiers
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return emitIdentifier(node);
// Parse tree nodes
// Names
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
return emitQualifiedName(node);
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
return emitComputedPropertyName(node);
// Signature elements
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
return emitTypeParameter(node);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return emitParameter(node);
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
return emitDecorator(node);
// Type members
- case 153 /* PropertySignature */:
+ case 154 /* PropertySignature */:
return emitPropertySignature(node);
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return emitPropertyDeclaration(node);
- case 155 /* MethodSignature */:
+ case 156 /* MethodSignature */:
return emitMethodSignature(node);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return emitMethodDeclaration(node);
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return emitConstructor(node);
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return emitAccessorDeclaration(node);
- case 160 /* CallSignature */:
+ case 161 /* CallSignature */:
return emitCallSignature(node);
- case 161 /* ConstructSignature */:
+ case 162 /* ConstructSignature */:
return emitConstructSignature(node);
- case 162 /* IndexSignature */:
+ case 163 /* IndexSignature */:
return emitIndexSignature(node);
// Types
- case 163 /* TypePredicate */:
+ case 164 /* TypePredicate */:
return emitTypePredicate(node);
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return emitTypeReference(node);
- case 165 /* FunctionType */:
+ case 166 /* FunctionType */:
return emitFunctionType(node);
- case 294 /* JSDocFunctionType */:
+ case 295 /* JSDocFunctionType */:
return emitJSDocFunctionType(node);
- case 166 /* ConstructorType */:
+ case 167 /* ConstructorType */:
return emitConstructorType(node);
- case 167 /* TypeQuery */:
+ case 168 /* TypeQuery */:
return emitTypeQuery(node);
- case 168 /* TypeLiteral */:
+ case 169 /* TypeLiteral */:
return emitTypeLiteral(node);
- case 169 /* ArrayType */:
+ case 170 /* ArrayType */:
return emitArrayType(node);
- case 170 /* TupleType */:
+ case 171 /* TupleType */:
return emitTupleType(node);
- case 171 /* OptionalType */:
+ case 172 /* OptionalType */:
return emitOptionalType(node);
- case 173 /* UnionType */:
+ case 174 /* UnionType */:
return emitUnionType(node);
- case 174 /* IntersectionType */:
+ case 175 /* IntersectionType */:
return emitIntersectionType(node);
- case 175 /* ConditionalType */:
+ case 176 /* ConditionalType */:
return emitConditionalType(node);
- case 176 /* InferType */:
+ case 177 /* InferType */:
return emitInferType(node);
- case 177 /* ParenthesizedType */:
+ case 178 /* ParenthesizedType */:
return emitParenthesizedType(node);
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return emitExpressionWithTypeArguments(node);
- case 178 /* ThisType */:
+ case 179 /* ThisType */:
return emitThisType();
- case 179 /* TypeOperator */:
+ case 180 /* TypeOperator */:
return emitTypeOperator(node);
- case 180 /* IndexedAccessType */:
+ case 181 /* IndexedAccessType */:
return emitIndexedAccessType(node);
- case 181 /* MappedType */:
+ case 182 /* MappedType */:
return emitMappedType(node);
- case 182 /* LiteralType */:
+ case 183 /* LiteralType */:
return emitLiteralType(node);
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return emitImportTypeNode(node);
- case 289 /* JSDocAllType */:
+ case 290 /* JSDocAllType */:
writePunctuation("*");
return;
- case 290 /* JSDocUnknownType */:
+ case 291 /* JSDocUnknownType */:
writePunctuation("?");
return;
- case 291 /* JSDocNullableType */:
+ case 292 /* JSDocNullableType */:
return emitJSDocNullableType(node);
- case 292 /* JSDocNonNullableType */:
+ case 293 /* JSDocNonNullableType */:
return emitJSDocNonNullableType(node);
- case 293 /* JSDocOptionalType */:
+ case 294 /* JSDocOptionalType */:
return emitJSDocOptionalType(node);
- case 172 /* RestType */:
- case 295 /* JSDocVariadicType */:
+ case 173 /* RestType */:
+ case 296 /* JSDocVariadicType */:
return emitRestOrJSDocVariadicType(node);
// Binding patterns
- case 184 /* ObjectBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
return emitObjectBindingPattern(node);
- case 185 /* ArrayBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
return emitArrayBindingPattern(node);
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return emitBindingElement(node);
// Misc
- case 216 /* TemplateSpan */:
+ case 217 /* TemplateSpan */:
return emitTemplateSpan(node);
- case 217 /* SemicolonClassElement */:
+ case 218 /* SemicolonClassElement */:
return emitSemicolonClassElement();
// Statements
- case 218 /* Block */:
+ case 219 /* Block */:
return emitBlock(node);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return emitVariableStatement(node);
- case 220 /* EmptyStatement */:
+ case 221 /* EmptyStatement */:
return emitEmptyStatement(/*isEmbeddedStatement*/ false);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return emitExpressionStatement(node);
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
return emitIfStatement(node);
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
return emitDoStatement(node);
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
return emitWhileStatement(node);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return emitForStatement(node);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return emitForInStatement(node);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return emitForOfStatement(node);
- case 228 /* ContinueStatement */:
+ case 229 /* ContinueStatement */:
return emitContinueStatement(node);
- case 229 /* BreakStatement */:
+ case 230 /* BreakStatement */:
return emitBreakStatement(node);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return emitReturnStatement(node);
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
return emitWithStatement(node);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return emitSwitchStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return emitLabeledStatement(node);
- case 234 /* ThrowStatement */:
+ case 235 /* ThrowStatement */:
return emitThrowStatement(node);
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
return emitTryStatement(node);
- case 236 /* DebuggerStatement */:
+ case 237 /* DebuggerStatement */:
return emitDebuggerStatement(node);
// Declarations
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return emitVariableDeclaration(node);
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
return emitVariableDeclarationList(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return emitFunctionDeclaration(node);
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return emitClassDeclaration(node);
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
return emitInterfaceDeclaration(node);
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return emitTypeAliasDeclaration(node);
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return emitEnumDeclaration(node);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return emitModuleDeclaration(node);
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
return emitModuleBlock(node);
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
return emitCaseBlock(node);
- case 247 /* NamespaceExportDeclaration */:
+ case 248 /* NamespaceExportDeclaration */:
return emitNamespaceExportDeclaration(node);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return emitImportEqualsDeclaration(node);
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return emitImportDeclaration(node);
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
return emitImportClause(node);
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
return emitNamespaceImport(node);
- case 252 /* NamedImports */:
+ case 253 /* NamedImports */:
return emitNamedImports(node);
- case 253 /* ImportSpecifier */:
+ case 254 /* ImportSpecifier */:
return emitImportSpecifier(node);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return emitExportAssignment(node);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return emitExportDeclaration(node);
- case 256 /* NamedExports */:
+ case 257 /* NamedExports */:
return emitNamedExports(node);
- case 257 /* ExportSpecifier */:
+ case 258 /* ExportSpecifier */:
return emitExportSpecifier(node);
- case 258 /* MissingDeclaration */:
+ case 259 /* MissingDeclaration */:
return;
// Module references
- case 259 /* ExternalModuleReference */:
+ case 260 /* ExternalModuleReference */:
return emitExternalModuleReference(node);
// JSX (non-expression)
case 11 /* JsxText */:
return emitJsxText(node);
- case 262 /* JsxOpeningElement */:
- case 265 /* JsxOpeningFragment */:
+ case 263 /* JsxOpeningElement */:
+ case 266 /* JsxOpeningFragment */:
return emitJsxOpeningElementOrFragment(node);
- case 263 /* JsxClosingElement */:
- case 266 /* JsxClosingFragment */:
+ case 264 /* JsxClosingElement */:
+ case 267 /* JsxClosingFragment */:
return emitJsxClosingElementOrFragment(node);
- case 267 /* JsxAttribute */:
+ case 268 /* JsxAttribute */:
return emitJsxAttribute(node);
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
return emitJsxAttributes(node);
- case 269 /* JsxSpreadAttribute */:
+ case 270 /* JsxSpreadAttribute */:
return emitJsxSpreadAttribute(node);
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return emitJsxExpression(node);
// Clauses
- case 271 /* CaseClause */:
+ case 272 /* CaseClause */:
return emitCaseClause(node);
- case 272 /* DefaultClause */:
+ case 273 /* DefaultClause */:
return emitDefaultClause(node);
- case 273 /* HeritageClause */:
+ case 274 /* HeritageClause */:
return emitHeritageClause(node);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return emitCatchClause(node);
// Property assignments
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return emitPropertyAssignment(node);
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return emitShorthandPropertyAssignment(node);
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
return emitSpreadAssignment(node);
// Enum
- case 278 /* EnumMember */:
+ case 279 /* EnumMember */:
return emitEnumMember(node);
// JSDoc nodes (only used in codefixes currently)
- case 304 /* JSDocParameterTag */:
- case 310 /* JSDocPropertyTag */:
+ case 305 /* JSDocParameterTag */:
+ case 311 /* JSDocPropertyTag */:
return emitJSDocPropertyLikeTag(node);
- case 305 /* JSDocReturnTag */:
- case 307 /* JSDocTypeTag */:
- case 306 /* JSDocThisTag */:
- case 303 /* JSDocEnumTag */:
+ case 306 /* JSDocReturnTag */:
+ case 308 /* JSDocTypeTag */:
+ case 307 /* JSDocThisTag */:
+ case 304 /* JSDocEnumTag */:
return emitJSDocSimpleTypedTag(node);
- case 300 /* JSDocAugmentsTag */:
+ case 301 /* JSDocAugmentsTag */:
return emitJSDocAugmentsTag(node);
- case 308 /* JSDocTemplateTag */:
+ case 309 /* JSDocTemplateTag */:
return emitJSDocTemplateTag(node);
- case 309 /* JSDocTypedefTag */:
+ case 310 /* JSDocTypedefTag */:
return emitJSDocTypedefTag(node);
- case 302 /* JSDocCallbackTag */:
+ case 303 /* JSDocCallbackTag */:
return emitJSDocCallbackTag(node);
- case 298 /* JSDocSignature */:
+ case 299 /* JSDocSignature */:
return emitJSDocSignature(node);
- case 297 /* JSDocTypeLiteral */:
+ case 298 /* JSDocTypeLiteral */:
return emitJSDocTypeLiteral(node);
- case 301 /* JSDocClassTag */:
- case 299 /* JSDocTag */:
+ case 302 /* JSDocClassTag */:
+ case 300 /* JSDocTag */:
return emitJSDocSimpleTag(node);
- case 296 /* JSDocComment */:
+ case 297 /* JSDocComment */:
return emitJSDoc(node);
// Transformation nodes (ignored)
}
@@ -84156,83 +85063,83 @@
case 14 /* NoSubstitutionTemplateLiteral */:
return emitLiteral(node);
// Identifiers
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return emitIdentifier(node);
// Reserved words
- case 87 /* FalseKeyword */:
- case 96 /* NullKeyword */:
- case 98 /* SuperKeyword */:
- case 102 /* TrueKeyword */:
- case 100 /* ThisKeyword */:
- case 92 /* ImportKeyword */:
+ case 88 /* FalseKeyword */:
+ case 97 /* NullKeyword */:
+ case 99 /* SuperKeyword */:
+ case 103 /* TrueKeyword */:
+ case 101 /* ThisKeyword */:
+ case 93 /* ImportKeyword */:
writeTokenNode(node, writeKeyword);
return;
// Expressions
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return emitArrayLiteralExpression(node);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return emitObjectLiteralExpression(node);
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return emitPropertyAccessExpression(node);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return emitElementAccessExpression(node);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return emitCallExpression(node);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return emitNewExpression(node);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return emitTaggedTemplateExpression(node);
- case 194 /* TypeAssertionExpression */:
+ case 195 /* TypeAssertionExpression */:
return emitTypeAssertionExpression(node);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return emitParenthesizedExpression(node);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return emitFunctionExpression(node);
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return emitArrowFunction(node);
- case 198 /* DeleteExpression */:
+ case 199 /* DeleteExpression */:
return emitDeleteExpression(node);
- case 199 /* TypeOfExpression */:
+ case 200 /* TypeOfExpression */:
return emitTypeOfExpression(node);
- case 200 /* VoidExpression */:
+ case 201 /* VoidExpression */:
return emitVoidExpression(node);
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
return emitAwaitExpression(node);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return emitPrefixUnaryExpression(node);
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return emitPostfixUnaryExpression(node);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return emitBinaryExpression(node);
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return emitConditionalExpression(node);
- case 206 /* TemplateExpression */:
+ case 207 /* TemplateExpression */:
return emitTemplateExpression(node);
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return emitYieldExpression(node);
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
return emitSpreadExpression(node);
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
return emitClassExpression(node);
- case 210 /* OmittedExpression */:
+ case 211 /* OmittedExpression */:
return;
- case 212 /* AsExpression */:
+ case 213 /* AsExpression */:
return emitAsExpression(node);
- case 213 /* NonNullExpression */:
+ case 214 /* NonNullExpression */:
return emitNonNullExpression(node);
- case 214 /* MetaProperty */:
+ case 215 /* MetaProperty */:
return emitMetaProperty(node);
// JSX
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
return emitJsxElement(node);
- case 261 /* JsxSelfClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
return emitJsxSelfClosingElement(node);
- case 264 /* JsxFragment */:
+ case 265 /* JsxFragment */:
return emitJsxFragment(node);
// Transformation nodes
- case 313 /* PartiallyEmittedExpression */:
+ case 314 /* PartiallyEmittedExpression */:
return emitPartiallyEmittedExpression(node);
- case 314 /* CommaListExpression */:
+ case 315 /* CommaListExpression */:
return emitCommaList(node);
}
}
@@ -84272,7 +85179,7 @@
}
function emitHelpers(node) {
var helpersEmitted = false;
- var bundle = node.kind === 285 /* Bundle */ ? node : undefined;
+ var bundle = node.kind === 286 /* Bundle */ ? node : undefined;
if (bundle && moduleKind === ts.ModuleKind.None) {
return;
}
@@ -84372,7 +85279,7 @@
var pos = getTextPosWithWriteLine();
writeUnparsedNode(unparsed);
if (bundleFileInfo) {
- updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 281 /* UnparsedText */ ?
+ updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 282 /* UnparsedText */ ?
"text" /* Text */ :
"internal" /* Internal */);
}
@@ -84405,7 +85312,7 @@
emit(node.right);
}
function emitEntityName(node) {
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
emitExpression(node);
}
else {
@@ -84441,7 +85348,7 @@
emit(node.dotDotDotToken);
emitNodeWithWriter(node.name, writeParameter);
emit(node.questionToken);
- if (node.parent && node.parent.kind === 294 /* JSDocFunctionType */ && !node.name) {
+ if (node.parent && node.parent.kind === 295 /* JSDocFunctionType */ && !node.name) {
emit(node.type);
}
else {
@@ -84503,7 +85410,7 @@
function emitAccessorDeclaration(node) {
emitDecorators(node, node.decorators);
emitModifiers(node, node.modifiers);
- writeKeyword(node.kind === 158 /* GetAccessor */ ? "get" : "set");
+ writeKeyword(node.kind === 159 /* GetAccessor */ ? "get" : "set");
writeSpace();
emit(node.name);
emitSignatureAndBody(node, emitSignatureHead);
@@ -84680,7 +85587,7 @@
}
if (node.readonlyToken) {
emit(node.readonlyToken);
- if (node.readonlyToken.kind !== 133 /* ReadonlyKeyword */) {
+ if (node.readonlyToken.kind !== 134 /* ReadonlyKeyword */) {
writeKeyword("readonly");
}
writeSpace();
@@ -84830,7 +85737,7 @@
emitExpressionList(node, node.arguments, 2576 /* CallExpressionArguments */);
}
function emitNewExpression(node) {
- emitTokenWithComment(95 /* NewKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(96 /* NewKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
emitTypeArguments(node, node.typeArguments);
@@ -84870,22 +85777,22 @@
emit(node.equalsGreaterThanToken);
}
function emitDeleteExpression(node) {
- emitTokenWithComment(81 /* DeleteKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(82 /* DeleteKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
}
function emitTypeOfExpression(node) {
- emitTokenWithComment(104 /* TypeOfKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(105 /* TypeOfKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
}
function emitVoidExpression(node) {
- emitTokenWithComment(106 /* VoidKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(107 /* VoidKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
}
function emitAwaitExpression(node) {
- emitTokenWithComment(122 /* AwaitKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(123 /* AwaitKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
}
@@ -84910,7 +85817,7 @@
// expression a prefix increment whose operand is a plus expression - (++(+x))
// The same is true of minus of course.
var operand = node.operand;
- return operand.kind === 202 /* PrefixUnaryExpression */
+ return operand.kind === 203 /* PrefixUnaryExpression */
&& ((node.operator === 38 /* PlusToken */ && (operand.operator === 38 /* PlusToken */ || operand.operator === 44 /* PlusPlusToken */))
|| (node.operator === 39 /* MinusToken */ && (operand.operator === 39 /* MinusToken */ || operand.operator === 45 /* MinusMinusToken */)));
}
@@ -84925,7 +85832,7 @@
emitExpression(node.left);
increaseIndentIf(indentBeforeOperator, isCommaOperator);
emitLeadingCommentsOfPosition(node.operatorToken.pos);
- writeTokenNode(node.operatorToken, node.operatorToken.kind === 93 /* InKeyword */ ? writeKeyword : writeOperator);
+ writeTokenNode(node.operatorToken, node.operatorToken.kind === 94 /* InKeyword */ ? writeKeyword : writeOperator);
emitTrailingCommentsOfPosition(node.operatorToken.end, /*prefixSpace*/ true); // Binary operators should have a space before the comment starts
increaseIndentIf(indentAfterOperator, /*writeSpaceIfNotIndenting*/ true);
emitExpression(node.right);
@@ -84953,7 +85860,7 @@
emitList(node, node.templateSpans, 262144 /* TemplateExpressionSpans */);
}
function emitYieldExpression(node) {
- emitTokenWithComment(117 /* YieldKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(118 /* YieldKeyword */, node.pos, writeKeyword, node);
emit(node.asteriskToken);
emitExpressionWithLeadingSpace(node.expression);
}
@@ -85030,7 +85937,7 @@
}
}
function emitIfStatement(node) {
- var openParenPos = emitTokenWithComment(91 /* IfKeyword */, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(92 /* IfKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
emitExpression(node.expression);
@@ -85038,8 +85945,8 @@
emitEmbeddedStatement(node, node.thenStatement);
if (node.elseStatement) {
writeLineOrSpace(node);
- emitTokenWithComment(83 /* ElseKeyword */, node.thenStatement.end, writeKeyword, node);
- if (node.elseStatement.kind === 222 /* IfStatement */) {
+ emitTokenWithComment(84 /* ElseKeyword */, node.thenStatement.end, writeKeyword, node);
+ if (node.elseStatement.kind === 223 /* IfStatement */) {
writeSpace();
emit(node.elseStatement);
}
@@ -85049,14 +85956,14 @@
}
}
function emitWhileClause(node, startPos) {
- var openParenPos = emitTokenWithComment(107 /* WhileKeyword */, startPos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(108 /* WhileKeyword */, startPos, writeKeyword, node);
writeSpace();
emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
emitExpression(node.expression);
emitTokenWithComment(21 /* CloseParenToken */, node.expression.end, writePunctuation, node);
}
function emitDoStatement(node) {
- emitTokenWithComment(82 /* DoKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(83 /* DoKeyword */, node.pos, writeKeyword, node);
emitEmbeddedStatement(node, node.statement);
if (ts.isBlock(node.statement)) {
writeSpace();
@@ -85072,7 +85979,7 @@
emitEmbeddedStatement(node, node.statement);
}
function emitForStatement(node) {
- var openParenPos = emitTokenWithComment(89 /* ForKeyword */, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(90 /* ForKeyword */, node.pos, writeKeyword, node);
writeSpace();
var pos = emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, /*contextNode*/ node);
emitForBinding(node.initializer);
@@ -85084,25 +85991,25 @@
emitEmbeddedStatement(node, node.statement);
}
function emitForInStatement(node) {
- var openParenPos = emitTokenWithComment(89 /* ForKeyword */, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(90 /* ForKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
emitForBinding(node.initializer);
writeSpace();
- emitTokenWithComment(93 /* InKeyword */, node.initializer.end, writeKeyword, node);
+ emitTokenWithComment(94 /* InKeyword */, node.initializer.end, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
emitTokenWithComment(21 /* CloseParenToken */, node.expression.end, writePunctuation, node);
emitEmbeddedStatement(node, node.statement);
}
function emitForOfStatement(node) {
- var openParenPos = emitTokenWithComment(89 /* ForKeyword */, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(90 /* ForKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitWithTrailingSpace(node.awaitModifier);
emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
emitForBinding(node.initializer);
writeSpace();
- emitTokenWithComment(147 /* OfKeyword */, node.initializer.end, writeKeyword, node);
+ emitTokenWithComment(148 /* OfKeyword */, node.initializer.end, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
emitTokenWithComment(21 /* CloseParenToken */, node.expression.end, writePunctuation, node);
@@ -85110,7 +86017,7 @@
}
function emitForBinding(node) {
if (node !== undefined) {
- if (node.kind === 238 /* VariableDeclarationList */) {
+ if (node.kind === 239 /* VariableDeclarationList */) {
emit(node);
}
else {
@@ -85119,12 +86026,12 @@
}
}
function emitContinueStatement(node) {
- emitTokenWithComment(78 /* ContinueKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(79 /* ContinueKeyword */, node.pos, writeKeyword, node);
emitWithLeadingSpace(node.label);
writeTrailingSemicolon();
}
function emitBreakStatement(node) {
- emitTokenWithComment(73 /* BreakKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(74 /* BreakKeyword */, node.pos, writeKeyword, node);
emitWithLeadingSpace(node.label);
writeTrailingSemicolon();
}
@@ -85152,12 +86059,12 @@
return pos;
}
function emitReturnStatement(node) {
- emitTokenWithComment(97 /* ReturnKeyword */, node.pos, writeKeyword, /*contextNode*/ node);
+ emitTokenWithComment(98 /* ReturnKeyword */, node.pos, writeKeyword, /*contextNode*/ node);
emitExpressionWithLeadingSpace(node.expression);
writeTrailingSemicolon();
}
function emitWithStatement(node) {
- var openParenPos = emitTokenWithComment(108 /* WithKeyword */, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(109 /* WithKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
emitExpression(node.expression);
@@ -85165,7 +86072,7 @@
emitEmbeddedStatement(node, node.statement);
}
function emitSwitchStatement(node) {
- var openParenPos = emitTokenWithComment(99 /* SwitchKeyword */, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(100 /* SwitchKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
emitExpression(node.expression);
@@ -85180,12 +86087,12 @@
emit(node.statement);
}
function emitThrowStatement(node) {
- emitTokenWithComment(101 /* ThrowKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(102 /* ThrowKeyword */, node.pos, writeKeyword, node);
emitExpressionWithLeadingSpace(node.expression);
writeTrailingSemicolon();
}
function emitTryStatement(node) {
- emitTokenWithComment(103 /* TryKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(104 /* TryKeyword */, node.pos, writeKeyword, node);
writeSpace();
emit(node.tryBlock);
if (node.catchClause) {
@@ -85194,13 +86101,13 @@
}
if (node.finallyBlock) {
writeLineOrSpace(node);
- emitTokenWithComment(88 /* FinallyKeyword */, (node.catchClause || node.tryBlock).end, writeKeyword, node);
+ emitTokenWithComment(89 /* FinallyKeyword */, (node.catchClause || node.tryBlock).end, writeKeyword, node);
writeSpace();
emit(node.finallyBlock);
}
}
function emitDebuggerStatement(node) {
- writeToken(79 /* DebuggerKeyword */, node.pos, writeKeyword);
+ writeToken(80 /* DebuggerKeyword */, node.pos, writeKeyword);
writeTrailingSemicolon();
}
//
@@ -85405,7 +86312,7 @@
var body = node.body;
if (!body)
return writeTrailingSemicolon();
- while (body.kind === 244 /* ModuleDeclaration */) {
+ while (body.kind === 245 /* ModuleDeclaration */) {
writePunctuation(".");
emit(body.name);
body = body.body;
@@ -85426,17 +86333,17 @@
}
function emitImportEqualsDeclaration(node) {
emitModifiers(node, node.modifiers);
- emitTokenWithComment(92 /* ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node);
+ emitTokenWithComment(93 /* ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node);
writeSpace();
emit(node.name);
writeSpace();
- emitTokenWithComment(59 /* EqualsToken */, node.name.end, writePunctuation, node);
+ emitTokenWithComment(60 /* EqualsToken */, node.name.end, writePunctuation, node);
writeSpace();
emitModuleReference(node.moduleReference);
writeTrailingSemicolon();
}
function emitModuleReference(node) {
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
emitExpression(node);
}
else {
@@ -85445,12 +86352,12 @@
}
function emitImportDeclaration(node) {
emitModifiers(node, node.modifiers);
- emitTokenWithComment(92 /* ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node);
+ emitTokenWithComment(93 /* ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node);
writeSpace();
if (node.importClause) {
emit(node.importClause);
writeSpace();
- emitTokenWithComment(144 /* FromKeyword */, node.importClause.end, writeKeyword, node);
+ emitTokenWithComment(145 /* FromKeyword */, node.importClause.end, writeKeyword, node);
writeSpace();
}
emitExpression(node.moduleSpecifier);
@@ -85467,7 +86374,7 @@
function emitNamespaceImport(node) {
var asPos = emitTokenWithComment(40 /* AsteriskToken */, node.pos, writePunctuation, node);
writeSpace();
- emitTokenWithComment(119 /* AsKeyword */, asPos, writeKeyword, node);
+ emitTokenWithComment(120 /* AsKeyword */, asPos, writeKeyword, node);
writeSpace();
emit(node.name);
}
@@ -85478,20 +86385,20 @@
emitImportOrExportSpecifier(node);
}
function emitExportAssignment(node) {
- var nextPos = emitTokenWithComment(85 /* ExportKeyword */, node.pos, writeKeyword, node);
+ var nextPos = emitTokenWithComment(86 /* ExportKeyword */, node.pos, writeKeyword, node);
writeSpace();
if (node.isExportEquals) {
- emitTokenWithComment(59 /* EqualsToken */, nextPos, writeOperator, node);
+ emitTokenWithComment(60 /* EqualsToken */, nextPos, writeOperator, node);
}
else {
- emitTokenWithComment(80 /* DefaultKeyword */, nextPos, writeKeyword, node);
+ emitTokenWithComment(81 /* DefaultKeyword */, nextPos, writeKeyword, node);
}
writeSpace();
emitExpression(node.expression);
writeTrailingSemicolon();
}
function emitExportDeclaration(node) {
- var nextPos = emitTokenWithComment(85 /* ExportKeyword */, node.pos, writeKeyword, node);
+ var nextPos = emitTokenWithComment(86 /* ExportKeyword */, node.pos, writeKeyword, node);
writeSpace();
if (node.exportClause) {
emit(node.exportClause);
@@ -85502,18 +86409,18 @@
if (node.moduleSpecifier) {
writeSpace();
var fromPos = node.exportClause ? node.exportClause.end : nextPos;
- emitTokenWithComment(144 /* FromKeyword */, fromPos, writeKeyword, node);
+ emitTokenWithComment(145 /* FromKeyword */, fromPos, writeKeyword, node);
writeSpace();
emitExpression(node.moduleSpecifier);
}
writeTrailingSemicolon();
}
function emitNamespaceExportDeclaration(node) {
- var nextPos = emitTokenWithComment(85 /* ExportKeyword */, node.pos, writeKeyword, node);
+ var nextPos = emitTokenWithComment(86 /* ExportKeyword */, node.pos, writeKeyword, node);
writeSpace();
- nextPos = emitTokenWithComment(119 /* AsKeyword */, nextPos, writeKeyword, node);
+ nextPos = emitTokenWithComment(120 /* AsKeyword */, nextPos, writeKeyword, node);
writeSpace();
- nextPos = emitTokenWithComment(131 /* NamespaceKeyword */, nextPos, writeKeyword, node);
+ nextPos = emitTokenWithComment(132 /* NamespaceKeyword */, nextPos, writeKeyword, node);
writeSpace();
emit(node.name);
writeTrailingSemicolon();
@@ -85533,7 +86440,7 @@
if (node.propertyName) {
emit(node.propertyName);
writeSpace();
- emitTokenWithComment(119 /* AsKeyword */, node.propertyName.end, writeKeyword, node);
+ emitTokenWithComment(120 /* AsKeyword */, node.propertyName.end, writeKeyword, node);
writeSpace();
}
emit(node.name);
@@ -85611,7 +86518,7 @@
}
}
function emitJsxTagName(node) {
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
emitExpression(node);
}
else {
@@ -85622,13 +86529,13 @@
// Clauses
//
function emitCaseClause(node) {
- emitTokenWithComment(74 /* CaseKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(75 /* CaseKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
emitCaseOrDefaultClauseRest(node, node.statements, node.expression.end);
}
function emitDefaultClause(node) {
- var pos = emitTokenWithComment(80 /* DefaultKeyword */, node.pos, writeKeyword, node);
+ var pos = emitTokenWithComment(81 /* DefaultKeyword */, node.pos, writeKeyword, node);
emitCaseOrDefaultClauseRest(node, node.statements, pos);
}
function emitCaseOrDefaultClauseRest(parentNode, statements, colonPos) {
@@ -85656,7 +86563,7 @@
emitList(node, node.types, 528 /* HeritageClauseTypes */);
}
function emitCatchClause(node) {
- var openParenPos = emitTokenWithComment(75 /* CatchKeyword */, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(76 /* CatchKeyword */, node.pos, writeKeyword, node);
writeSpace();
if (node.variableDeclaration) {
emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
@@ -85726,7 +86633,7 @@
}
}
if (node.tags) {
- if (node.tags.length === 1 && node.tags[0].kind === 307 /* JSDocTypeTag */ && !node.comment) {
+ if (node.tags.length === 1 && node.tags[0].kind === 308 /* JSDocTypeTag */ && !node.comment) {
writeSpace();
emit(node.tags[0]);
}
@@ -85760,7 +86667,7 @@
function emitJSDocTypedefTag(tag) {
emitJSDocTagName(tag.tagName);
if (tag.typeExpression) {
- if (tag.typeExpression.kind === 288 /* JSDocTypeExpression */) {
+ if (tag.typeExpression.kind === 289 /* JSDocTypeExpression */) {
emitJSDocTypeExpression(tag.typeExpression);
}
else {
@@ -85779,7 +86686,7 @@
emit(tag.fullName);
}
emitJSDocComment(tag.comment);
- if (tag.typeExpression && tag.typeExpression.kind === 297 /* JSDocTypeLiteral */) {
+ if (tag.typeExpression && tag.typeExpression.kind === 298 /* JSDocTypeLiteral */) {
emitJSDocTypeLiteral(tag.typeExpression);
}
}
@@ -85913,8 +86820,8 @@
bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "reference" /* Reference */, data: directive.fileName });
writeLine();
}
- for (var _d = 0, types_19 = types; _d < types_19.length; _d++) {
- var directive = types_19[_d];
+ for (var _d = 0, types_18 = types; _d < types_18.length; _d++) {
+ var directive = types_18[_d];
var pos = writer.getTextPos();
writeComment("/// <reference types=\"" + directive.fileName + "\" />");
if (bundleFileInfo)
@@ -86094,7 +87001,7 @@
function emitInitializer(node, equalCommentStartPos, container) {
if (node) {
writeSpace();
- emitTokenWithComment(59 /* EqualsToken */, equalCommentStartPos, writeOperator, container);
+ emitTokenWithComment(60 /* EqualsToken */, equalCommentStartPos, writeOperator, container);
writeSpace();
emitExpression(node);
}
@@ -86557,7 +87464,7 @@
&& ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile);
}
function skipSynthesizedParentheses(node) {
- while (node.kind === 195 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) {
+ while (node.kind === 196 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) {
node = node.expression;
}
return node;
@@ -86622,81 +87529,81 @@
if (!node)
return;
switch (node.kind) {
- case 218 /* Block */:
+ case 219 /* Block */:
ts.forEach(node.statements, generateNames);
break;
- case 233 /* LabeledStatement */:
- case 231 /* WithStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
+ case 234 /* LabeledStatement */:
+ case 232 /* WithStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
generateNames(node.statement);
break;
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
generateNames(node.thenStatement);
generateNames(node.elseStatement);
break;
- case 225 /* ForStatement */:
- case 227 /* ForOfStatement */:
- case 226 /* ForInStatement */:
+ case 226 /* ForStatement */:
+ case 228 /* ForOfStatement */:
+ case 227 /* ForInStatement */:
generateNames(node.initializer);
generateNames(node.statement);
break;
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
generateNames(node.caseBlock);
break;
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
ts.forEach(node.clauses, generateNames);
break;
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
ts.forEach(node.statements, generateNames);
break;
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
generateNames(node.tryBlock);
generateNames(node.catchClause);
generateNames(node.finallyBlock);
break;
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
generateNames(node.variableDeclaration);
generateNames(node.block);
break;
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
generateNames(node.declarationList);
break;
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
ts.forEach(node.declarations, generateNames);
break;
- case 237 /* VariableDeclaration */:
- case 151 /* Parameter */:
- case 186 /* BindingElement */:
- case 240 /* ClassDeclaration */:
+ case 238 /* VariableDeclaration */:
+ case 152 /* Parameter */:
+ case 187 /* BindingElement */:
+ case 241 /* ClassDeclaration */:
generateNameIfNeeded(node.name);
break;
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
generateNameIfNeeded(node.name);
if (ts.getEmitFlags(node) & 524288 /* ReuseTempVariableScope */) {
ts.forEach(node.parameters, generateNames);
generateNames(node.body);
}
break;
- case 184 /* ObjectBindingPattern */:
- case 185 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
ts.forEach(node.elements, generateNames);
break;
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
generateNames(node.importClause);
break;
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
generateNameIfNeeded(node.name);
generateNames(node.namedBindings);
break;
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
generateNameIfNeeded(node.name);
break;
- case 252 /* NamedImports */:
+ case 253 /* NamedImports */:
ts.forEach(node.elements, generateNames);
break;
- case 253 /* ImportSpecifier */:
+ case 254 /* ImportSpecifier */:
generateNameIfNeeded(node.propertyName || node.name);
break;
}
@@ -86705,12 +87612,12 @@
if (!node)
return;
switch (node.kind) {
- case 275 /* PropertyAssignment */:
- case 276 /* ShorthandPropertyAssignment */:
- case 154 /* PropertyDeclaration */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 276 /* PropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
+ case 155 /* PropertyDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
generateNameIfNeeded(node.name);
break;
}
@@ -86890,24 +87797,26 @@
*/
function generateNameForNode(node, flags) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return makeUniqueName(getTextOfNode(node), isUniqueName, !!(flags & 16 /* Optimistic */), !!(flags & 8 /* ReservedInNestedScopes */));
- case 244 /* ModuleDeclaration */:
- case 243 /* EnumDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 244 /* EnumDeclaration */:
return generateNameForModuleOrEnum(node);
- case 249 /* ImportDeclaration */:
- case 255 /* ExportDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 256 /* ExportDeclaration */:
return generateNameForImportOrExportDeclaration(node);
- case 239 /* FunctionDeclaration */:
- case 240 /* ClassDeclaration */:
- case 254 /* ExportAssignment */:
+ case 240 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 255 /* ExportAssignment */:
return generateNameForExportDefault();
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
return generateNameForClassExpression();
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return generateNameForMethodOrAccessor(node);
+ case 150 /* ComputedPropertyName */:
+ return makeTempVariableName(0 /* Auto */, /*reserveInNestedScopes*/ true);
default:
return makeTempVariableName(0 /* Auto */);
}
@@ -86953,7 +87862,7 @@
hasWrittenComment = false;
var emitFlags = ts.getEmitFlags(node);
var _a = ts.getCommentRange(node), pos = _a.pos, end = _a.end;
- var isEmittedNode = node.kind !== 312 /* NotEmittedStatement */;
+ var isEmittedNode = node.kind !== 313 /* NotEmittedStatement */;
// We have to explicitly check that the node is JsxText because if the compilerOptions.jsx is "preserve" we will not do any transformation.
// It is expensive to walk entire tree just to set one kind of node to have no comments.
var skipLeadingComments = pos < 0 || (emitFlags & 512 /* NoLeadingComments */) !== 0 || node.kind === 11 /* JsxText */;
@@ -86977,7 +87886,7 @@
containerEnd = end;
// To avoid invalid comment emit in a down-level binding pattern, we
// keep track of the last declaration list container's end
- if (node.kind === 238 /* VariableDeclarationList */) {
+ if (node.kind === 239 /* VariableDeclarationList */) {
declarationListContainerEnd = end;
}
}
@@ -87234,7 +88143,7 @@
else {
var _a = ts.getSourceMapRange(node), pos = _a.pos, end = _a.end, _b = _a.source, source = _b === void 0 ? sourceMapSource : _b;
var emitFlags = ts.getEmitFlags(node);
- if (node.kind !== 312 /* NotEmittedStatement */
+ if (node.kind !== 313 /* NotEmittedStatement */
&& (emitFlags & 16 /* NoLeadingSourceMap */) === 0
&& pos >= 0) {
emitSourcePos(source, skipSourceTrivia(source, pos));
@@ -87247,7 +88156,7 @@
else {
pipelinePhase(hint, node);
}
- if (node.kind !== 312 /* NotEmittedStatement */
+ if (node.kind !== 313 /* NotEmittedStatement */
&& (emitFlags & 32 /* NoTrailingSourceMap */) === 0
&& end >= 0) {
emitSourcePos(source, end);
@@ -87862,7 +88771,8 @@
getDirectories: function (path) { return system.getDirectories(path); },
realpath: realpath,
readDirectory: function (path, extensions, include, exclude, depth) { return system.readDirectory(path, extensions, include, exclude, depth); },
- createDirectory: function (d) { return system.createDirectory(d); }
+ createDirectory: function (d) { return system.createDirectory(d); },
+ createHash: ts.maybeBind(system, system.createHash)
};
return compilerHost;
}
@@ -88148,6 +89058,7 @@
}
}
ts.flattenDiagnosticMessageText = flattenDiagnosticMessageText;
+ /* @internal */
function loadWithLocalCache(names, containingFile, redirectedReference, loader) {
if (names.length === 0) {
return [];
@@ -88167,6 +89078,7 @@
}
return resolutions;
}
+ ts.loadWithLocalCache = loadWithLocalCache;
/**
* Determines if program structure is upto date or needs to be recreated
*/
@@ -88326,7 +89238,7 @@
}); };
}
else {
- moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, function (x) { return host.getCanonicalFileName(x); });
+ moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, function (x) { return host.getCanonicalFileName(x); }, options);
var loader_1 = function (moduleName, containingFile, redirectedReference) { return ts.resolveModuleName(moduleName, containingFile, options, host, moduleResolutionCache, redirectedReference).resolvedModule; }; // TODO: GH#18217
resolveModuleNamesWorker = function (moduleNames, containingFile, _reusedNames, redirectedReference) { return loadWithLocalCache(ts.Debug.assertEachDefined(moduleNames), containingFile, redirectedReference, loader_1); };
}
@@ -88472,6 +89384,7 @@
getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); },
getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); },
getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); },
+ getRelationCacheSizes: function () { return getDiagnosticsProducingTypeChecker().getRelationCacheSizes(); },
getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; },
getResolvedTypeReferenceDirectives: function () { return resolvedTypeReferenceDirectives; },
isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary,
@@ -88569,13 +89482,13 @@
// which per above occurred during the current program creation.
// Since we assume the filesystem does not change during program creation,
// it is safe to reuse resolutions from the earlier call.
- var result_6 = [];
+ var result_8 = [];
for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) {
var moduleName = moduleNames_1[_i];
var resolvedModule = file.resolvedModules.get(moduleName);
- result_6.push(resolvedModule);
+ result_8.push(resolvedModule);
}
- return result_6;
+ return result_8;
}
// At this point, we know at least one of the following hold:
// - file has local declarations for ambient modules
@@ -88662,7 +89575,7 @@
function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName) {
var resolutionToFile = ts.getResolvedModule(oldSourceFile, moduleName);
var resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
- if (resolutionToFile && resolvedFile && !resolvedFile.externalModuleIndicator) {
+ if (resolutionToFile && resolvedFile) {
// In the old program, we resolved to an ambient module that was in the same
// place as we expected to find an actual module file.
// We actually need to return 'false' here even though this seems like a 'true' case
@@ -88925,9 +89838,8 @@
ts.performance.mark("beforeEmit");
var emitResult = ts.emitFiles(ts.notImplementedResolver, getEmitHost(writeFileCallback),
/*targetSourceFile*/ undefined,
+ /*transformers*/ ts.noTransformers,
/*emitOnlyDtsFiles*/ false,
- /*transformers*/ undefined,
- /*declaraitonTransformers*/ undefined,
/*onlyBuildInfo*/ true);
ts.performance.mark("afterEmit");
ts.performance.measure("Emit", "beforeEmit", "afterEmit");
@@ -89015,8 +89927,7 @@
// checked is to not pass the file to getEmitResolver.
var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver((options.outFile || options.out) ? undefined : sourceFile, cancellationToken);
ts.performance.mark("beforeEmit");
- var transformers = emitOnlyDtsFiles ? [] : ts.getTransformers(options, customTransformers);
- var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile, emitOnlyDtsFiles, transformers, customTransformers && customTransformers.afterDeclarations);
+ var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile, ts.getTransformers(options, customTransformers, emitOnlyDtsFiles), emitOnlyDtsFiles);
ts.performance.mark("afterEmit");
ts.performance.measure("Emit", "beforeEmit", "afterEmit");
return emitResult;
@@ -89158,22 +90069,22 @@
// Return directly from the case if the given node doesnt want to visit each child
// Otherwise break to visit each child
switch (parent.kind) {
- case 151 /* Parameter */:
- case 154 /* PropertyDeclaration */:
+ case 152 /* Parameter */:
+ case 155 /* PropertyDeclaration */:
if (parent.questionToken === node) {
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, "?"));
return;
}
// falls through
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 196 /* FunctionExpression */:
- case 239 /* FunctionDeclaration */:
- case 197 /* ArrowFunction */:
- case 237 /* VariableDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 197 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
+ case 198 /* ArrowFunction */:
+ case 238 /* VariableDeclaration */:
// type annotation
if (parent.type === node) {
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.types_can_only_be_used_in_a_ts_file));
@@ -89181,41 +90092,41 @@
}
}
switch (node.kind) {
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file));
return;
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
if (node.isExportEquals) {
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file));
return;
}
break;
- case 273 /* HeritageClause */:
+ case 274 /* HeritageClause */:
var heritageClause = node;
- if (heritageClause.token === 109 /* ImplementsKeyword */) {
+ if (heritageClause.token === 110 /* ImplementsKeyword */) {
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file));
return;
}
break;
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file));
return;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file));
return;
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file));
return;
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file));
return;
- case 213 /* NonNullExpression */:
+ case 214 /* NonNullExpression */:
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.non_null_assertions_can_only_be_used_in_a_ts_file));
return;
- case 212 /* AsExpression */:
+ case 213 /* AsExpression */:
diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file));
return;
- case 194 /* TypeAssertionExpression */:
+ case 195 /* TypeAssertionExpression */:
ts.Debug.fail(); // Won't parse these in a JS file anyway, as they are interpreted as JSX.
}
var prevParent = parent;
@@ -89225,54 +90136,54 @@
}
function walkArray(nodes) {
if (parent.decorators === nodes && !options.experimentalDecorators) {
- diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning));
+ diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning));
}
switch (parent.kind) {
- case 240 /* ClassDeclaration */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 196 /* FunctionExpression */:
- case 239 /* FunctionDeclaration */:
- case 197 /* ArrowFunction */:
+ case 241 /* ClassDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 197 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
+ case 198 /* ArrowFunction */:
// Check type parameters
if (nodes === parent.typeParameters) {
diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file));
return;
}
// falls through
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
// Check modifiers
if (nodes === parent.modifiers) {
- return checkModifiers(nodes, parent.kind === 219 /* VariableStatement */);
+ return checkModifiers(nodes, parent.kind === 220 /* VariableStatement */);
}
break;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
// Check modifiers of property declaration
if (nodes === parent.modifiers) {
for (var _i = 0, _a = nodes; _i < _a.length; _i++) {
var modifier = _a[_i];
- if (modifier.kind !== 116 /* StaticKeyword */) {
+ if (modifier.kind !== 117 /* StaticKeyword */) {
diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind)));
}
}
return;
}
break;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
// Check modifiers of parameter declaration
if (nodes === parent.modifiers) {
diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file));
return;
}
break;
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
- case 211 /* ExpressionWithTypeArguments */:
- case 261 /* JsxSelfClosingElement */:
- case 262 /* JsxOpeningElement */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
+ case 212 /* ExpressionWithTypeArguments */:
+ case 262 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
// Check type arguments
if (nodes === parent.typeArguments) {
diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file));
@@ -89289,24 +90200,24 @@
for (var _i = 0, modifiers_1 = modifiers; _i < modifiers_1.length; _i++) {
var modifier = modifiers_1[_i];
switch (modifier.kind) {
- case 77 /* ConstKeyword */:
+ case 78 /* ConstKeyword */:
if (isConstValid) {
continue;
}
// to report error,
// falls through
- case 115 /* PublicKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 133 /* ReadonlyKeyword */:
- case 125 /* DeclareKeyword */:
- case 118 /* AbstractKeyword */:
+ case 116 /* PublicKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 134 /* ReadonlyKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 119 /* AbstractKeyword */:
diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind)));
break;
// These are all legal modifiers.
- case 116 /* StaticKeyword */:
- case 85 /* ExportKeyword */:
- case 80 /* DefaultKeyword */:
+ case 117 /* StaticKeyword */:
+ case 86 /* ExportKeyword */:
+ case 81 /* DefaultKeyword */:
}
}
}
@@ -89381,8 +90292,8 @@
return a.fileName === b.fileName;
}
function moduleNameIsEqualTo(a, b) {
- return a.kind === 72 /* Identifier */
- ? b.kind === 72 /* Identifier */ && a.escapedText === b.escapedText
+ return a.kind === 73 /* Identifier */
+ ? b.kind === 73 /* Identifier */ && a.escapedText === b.escapedText
: b.kind === 10 /* StringLiteral */ && a.text === b.text;
}
function collectExternalModuleReferences(file) {
@@ -89597,7 +90508,10 @@
if (isRedirect) {
inputName = getProjectReferenceRedirect(fileName) || fileName;
}
- if (ts.getNormalizedAbsolutePath(checkedName, currentDirectory) !== ts.getNormalizedAbsolutePath(inputName, currentDirectory)) {
+ // Check if it differs only in drive letters its ok to ignore that error:
+ var checkedAbsolutePath = ts.getNormalizedAbsolutePathWithoutRoot(checkedName, currentDirectory);
+ var inputAbsolutePath = ts.getNormalizedAbsolutePathWithoutRoot(inputName, currentDirectory);
+ if (checkedAbsolutePath !== inputAbsolutePath) {
reportFileNamesDifferOnlyInCasingError(inputName, checkedName, refFile, refPos, refEnd);
}
}
@@ -89626,8 +90540,13 @@
}
var redirectedPath;
if (refFile) {
- var redirect = getProjectReferenceRedirect(fileName);
- if (redirect) {
+ var redirectProject = getProjectReferenceRedirectProject(fileName);
+ if (redirectProject) {
+ if (redirectProject.commandLine.options.outFile || redirectProject.commandLine.options.out) {
+ // Shouldnt create many to 1 mapping file in --out scenario
+ return undefined;
+ }
+ var redirect = getProjectReferenceOutputName(redirectProject, fileName);
fileName = redirect;
// Once we start redirecting to a file, we can potentially come back to it
// via a back-reference from another file in the .d.ts folder. If that happens we'll
@@ -89711,16 +90630,19 @@
}
}
function getProjectReferenceRedirect(fileName) {
+ var referencedProject = getProjectReferenceRedirectProject(fileName);
+ return referencedProject && getProjectReferenceOutputName(referencedProject, fileName);
+ }
+ function getProjectReferenceRedirectProject(fileName) {
// Ignore dts or any of the non ts files
if (!resolvedProjectReferences || !resolvedProjectReferences.length || ts.fileExtensionIs(fileName, ".d.ts" /* Dts */) || !ts.fileExtensionIsOneOf(fileName, ts.supportedTSExtensions)) {
return undefined;
}
// If this file is produced by a referenced project, we need to rewrite it to
// look in the output folder of the referenced project rather than the input
- var referencedProject = getResolvedProjectReferenceToRedirect(fileName);
- if (!referencedProject) {
- return undefined;
+ return getResolvedProjectReferenceToRedirect(fileName);
}
+ function getProjectReferenceOutputName(referencedProject, fileName) {
var out = referencedProject.commandLine.options.outFile || referencedProject.commandLine.options.out;
return out ?
ts.changeExtension(out, ".d.ts" /* Dts */) :
@@ -89965,18 +90887,33 @@
if (fromCache !== undefined) {
return fromCache || undefined;
}
+ var commandLine;
+ var sourceFile;
+ if (host.getParsedCommandLine) {
+ commandLine = host.getParsedCommandLine(refPath);
+ if (!commandLine) {
+ addFileToFilesByName(/*sourceFile*/ undefined, sourceFilePath, /*redirectedPath*/ undefined);
+ projectReferenceRedirects.set(sourceFilePath, false);
+ return undefined;
+ }
+ sourceFile = ts.Debug.assertDefined(commandLine.options.configFile);
+ ts.Debug.assert(!sourceFile.path || sourceFile.path === sourceFilePath);
+ addFileToFilesByName(sourceFile, sourceFilePath, /*redirectedPath*/ undefined);
+ }
+ else {
// An absolute path pointing to the containing directory of the config file
var basePath = ts.getNormalizedAbsolutePath(ts.getDirectoryPath(refPath), host.getCurrentDirectory());
- var sourceFile = host.getSourceFile(refPath, 100 /* JSON */);
+ sourceFile = host.getSourceFile(refPath, 100 /* JSON */);
addFileToFilesByName(sourceFile, sourceFilePath, /*redirectedPath*/ undefined);
if (sourceFile === undefined) {
projectReferenceRedirects.set(sourceFilePath, false);
return undefined;
}
+ commandLine = ts.parseJsonSourceFileConfigFileContent(sourceFile, configParsingHost, basePath, /*existingOptions*/ undefined, refPath);
+ }
sourceFile.path = sourceFilePath;
sourceFile.resolvedPath = sourceFilePath;
sourceFile.originalFileName = refPath;
- var commandLine = ts.parseJsonSourceFileConfigFileContent(sourceFile, configParsingHost, basePath, /*existingOptions*/ undefined, refPath);
var resolvedRef = { commandLine: commandLine, sourceFile: sourceFile };
projectReferenceRedirects.set(sourceFilePath, resolvedRef);
if (commandLine.projectReferences) {
@@ -89992,9 +90929,6 @@
if (ts.getEmitDeclarations(options)) {
createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, getEmitDeclarationOptionName(options), "isolatedModules");
}
- if (options.noEmitOnError) {
- createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules");
- }
if (options.out) {
createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules");
}
@@ -90026,17 +90960,17 @@
createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "tsBuildInfoFile", "incremental", "composite");
}
}
+ else if (options.incremental && !options.outFile && !options.out && !options.configFilePath) {
+ programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified));
+ }
verifyProjectReferences();
// List of collected files is complete; validate exhautiveness if this is a project with a file list
if (options.composite) {
var rootPaths = rootNames.map(toPath);
for (var _i = 0, files_3 = files; _i < files_3.length; _i++) {
var file = files_3[_i];
- // Ignore declaration files
- if (file.isDeclarationFile)
- continue;
- // Ignore json file thats from project reference
- if (ts.isJsonSourceFile(file) && getResolvedProjectReferenceToRedirect(file.fileName))
+ // Ignore file that is not emitted
+ if (!ts.sourceFileMayBeEmitted(file, options, isSourceFileFromExternalLibrary, getResolvedProjectReferenceToRedirect))
continue;
if (rootPaths.indexOf(file.path) === -1) {
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_is_not_in_project_file_list_Projects_must_list_all_files_or_use_an_include_pattern, file.fileName));
@@ -90113,10 +91047,10 @@
if (options.module === ts.ModuleKind.None && languageVersion < 2 /* ES2015 */) {
createDiagnosticForOptionName(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher, "isolatedModules", "target");
}
- var firstNonExternalModuleSourceFile = ts.find(files, function (f) { return !ts.isExternalModule(f) && !f.isDeclarationFile && f.scriptKind !== 6 /* JSON */; });
+ var firstNonExternalModuleSourceFile = ts.find(files, function (f) { return !ts.isExternalModule(f) && !ts.isSourceFileJS(f) && !f.isDeclarationFile && f.scriptKind !== 6 /* JSON */; });
if (firstNonExternalModuleSourceFile) {
var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile);
- programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided));
+ programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.All_files_must_be_modules_when_the_isolatedModules_flag_is_provided));
}
}
else if (firstNonAmbientExternalModuleSourceFile && languageVersion < 2 /* ES2015 */ && options.module === ts.ModuleKind.None) {
@@ -90201,13 +91135,13 @@
var emitFilePath = toPath(emitFileName);
// Report error if the output overwrites input file
if (filesByName.has(emitFilePath)) {
- var chain_2;
+ var chain = void 0;
if (!options.configFilePath) {
// The program is from either an inferred project or an external project
- chain_2 = ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig);
+ chain = ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig);
}
- chain_2 = ts.chainDiagnosticMessages(chain_2, ts.Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file, emitFileName);
- blockEmittingOfFile(emitFileName, ts.createCompilerDiagnosticFromMessageChain(chain_2));
+ chain = ts.chainDiagnosticMessages(chain, ts.Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file, emitFileName);
+ blockEmittingOfFile(emitFileName, ts.createCompilerDiagnosticFromMessageChain(chain));
}
var emitFileKey = !host.useCaseSensitiveFileNames() ? emitFilePath.toLocaleLowerCase() : emitFilePath;
// Report error if multiple files write into same file
@@ -90742,6 +91676,7 @@
cacheToUpdateSignature.set(sourceFile.path, latestSignature);
return !prevSignature || latestSignature !== prevSignature;
}
+ BuilderState.updateShapeSignature = updateShapeSignature;
/**
* Coverts the declaration emit result into exported modules map
*/
@@ -91019,15 +91954,9 @@
}
}
});
- if (oldCompilerOptions &&
- (oldCompilerOptions.outDir !== compilerOptions.outDir ||
- oldCompilerOptions.declarationDir !== compilerOptions.declarationDir ||
- (oldCompilerOptions.outFile || oldCompilerOptions.out) !== (compilerOptions.outFile || compilerOptions.out))) {
+ if (oldCompilerOptions && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
// Add all files to affectedFilesPendingEmit since emit changed
- state.affectedFilesPendingEmit = ts.concatenate(state.affectedFilesPendingEmit, newProgram.getSourceFiles().map(function (f) { return f.path; }));
- if (state.affectedFilesPendingEmitIndex === undefined) {
- state.affectedFilesPendingEmitIndex = 0;
- }
+ addToAffectedFilesPendingEmit(state, newProgram.getSourceFiles().map(function (f) { return f.path; }));
ts.Debug.assert(state.seenAffectedFiles === undefined);
state.seenAffectedFiles = ts.createMap();
}
@@ -91111,7 +92040,7 @@
if (!seenAffectedFiles.has(affectedFile.path)) {
// Set the next affected file as seen and remove the cached semantic diagnostics
state.affectedFilesIndex = affectedFilesIndex;
- cleanSemanticDiagnosticsOfAffectedFile(state, affectedFile);
+ handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash);
return affectedFile;
}
seenAffectedFiles.set(affectedFile.path, true);
@@ -91172,28 +92101,68 @@
return undefined;
}
/**
- * Remove the semantic diagnostics cached from old state for affected File and the files that are referencing modules that export entities from affected file
+ * Handles semantic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file
+ * This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
*/
- function cleanSemanticDiagnosticsOfAffectedFile(state, affectedFile) {
- if (removeSemanticDiagnosticsOf(state, affectedFile.path)) {
- // If there are no more diagnostics from old cache, done
- return;
- }
- // Clean lib file diagnostics if its all files excluding default files to emit
- if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles && !state.cleanedDiagnosticsOfLibFiles) {
+ function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash) {
+ removeSemanticDiagnosticsOf(state, affectedFile.path);
+ // If affected files is everything except default library, then nothing more to do
+ if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
+ if (!state.cleanedDiagnosticsOfLibFiles) {
state.cleanedDiagnosticsOfLibFiles = true;
var program_1 = ts.Debug.assertDefined(state.program);
var options_2 = program_1.getCompilerOptions();
- if (ts.forEach(program_1.getSourceFiles(), function (f) {
+ ts.forEach(program_1.getSourceFiles(), function (f) {
return program_1.isSourceFileDefaultLibrary(f) &&
!ts.skipTypeChecking(f, options_2) &&
removeSemanticDiagnosticsOf(state, f.path);
- })) {
+ });
+ }
return;
}
+ forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, function (state, path) { return handleDtsMayChangeOf(state, path, cancellationToken, computeHash); });
}
- // If there was change in signature for the changed file,
- // then delete the semantic diagnostics for files that are affected by using exports of this module
+ /**
+ * Handle the dts may change, so they need to be added to pending emit if dts emit is enabled,
+ * Also we need to make sure signature is updated for these files
+ */
+ function handleDtsMayChangeOf(state, path, cancellationToken, computeHash) {
+ removeSemanticDiagnosticsOf(state, path);
+ if (!state.changedFilesSet.has(path)) {
+ var program = ts.Debug.assertDefined(state.program);
+ var sourceFile = program.getSourceFileByPath(path);
+ if (sourceFile) {
+ // Even though the js emit doesnt change and we are already handling dts emit and semantic diagnostics
+ // we need to update the signature to reflect correctness of the signature(which is output d.ts emit) of this file
+ // This ensures that we dont later during incremental builds considering wrong signature.
+ // Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
+ ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.assertDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
+ // If not dts emit, nothing more to do
+ if (ts.getEmitDeclarations(state.compilerOptions)) {
+ addToAffectedFilesPendingEmit(state, [path]);
+ }
+ }
+ }
+ return false;
+ }
+ /**
+ * Removes semantic diagnostics for path and
+ * returns true if there are no more semantic diagnostics from the old state
+ */
+ function removeSemanticDiagnosticsOf(state, path) {
+ if (!state.semanticDiagnosticsFromOldState) {
+ return true;
+ }
+ state.semanticDiagnosticsFromOldState.delete(path);
+ state.semanticDiagnosticsPerFile.delete(path);
+ return !state.semanticDiagnosticsFromOldState.size;
+ }
+ /**
+ * Iterate on referencing modules that export entities from affected file
+ */
+ function forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, fn) {
+ // If there was change in signature (dts output) for the changed file,
+ // then only we need to handle pending file emit
if (!state.exportedModulesMap || state.affectedFiles.length === 1 || !state.changedFilesSet.has(affectedFile.path)) {
return;
}
@@ -91204,7 +92173,7 @@
if (ts.forEachEntry(state.currentAffectedFilesExportedModulesMap, function (exportedModules, exportedFromPath) {
return exportedModules &&
exportedModules.has(affectedFile.path) &&
- removeSemanticDiagnosticsOfFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile);
+ forEachFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile, fn);
})) {
return;
}
@@ -91212,26 +92181,25 @@
ts.forEachEntry(state.exportedModulesMap, function (exportedModules, exportedFromPath) {
return !state.currentAffectedFilesExportedModulesMap.has(exportedFromPath) && // If we already iterated this through cache, ignore it
exportedModules.has(affectedFile.path) &&
- removeSemanticDiagnosticsOfFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile);
+ forEachFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile, fn);
});
}
/**
- * removes the semantic diagnostics of files referencing referencedPath and
- * returns true if there are no more semantic diagnostics from old state
+ * Iterate on files referencing referencedPath
*/
- function removeSemanticDiagnosticsOfFilesReferencingPath(state, referencedPath, seenFileAndExportsOfFile) {
+ function forEachFilesReferencingPath(state, referencedPath, seenFileAndExportsOfFile, fn) {
return ts.forEachEntry(state.referencedMap, function (referencesInFile, filePath) {
- return referencesInFile.has(referencedPath) && removeSemanticDiagnosticsOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile);
+ return referencesInFile.has(referencedPath) && forEachFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, fn);
});
}
/**
- * Removes semantic diagnostics of file and anything that exports this file
+ * fn on file and iterate on anything that exports this file
*/
- function removeSemanticDiagnosticsOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile) {
+ function forEachFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, fn) {
if (!ts.addToSeen(seenFileAndExportsOfFile, filePath)) {
return false;
}
- if (removeSemanticDiagnosticsOf(state, filePath)) {
+ if (fn(state, filePath)) {
// If there are no more diagnostics from old cache, done
return true;
}
@@ -91241,7 +92209,7 @@
if (ts.forEachEntry(state.currentAffectedFilesExportedModulesMap, function (exportedModules, exportedFromPath) {
return exportedModules &&
exportedModules.has(filePath) &&
- removeSemanticDiagnosticsOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile);
+ forEachFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, fn);
})) {
return true;
}
@@ -91249,7 +92217,7 @@
if (ts.forEachEntry(state.exportedModulesMap, function (exportedModules, exportedFromPath) {
return !state.currentAffectedFilesExportedModulesMap.has(exportedFromPath) && // If we already iterated this through cache, ignore it
exportedModules.has(filePath) &&
- removeSemanticDiagnosticsOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile);
+ forEachFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, fn);
})) {
return true;
}
@@ -91257,23 +92225,11 @@
return !!ts.forEachEntry(state.referencedMap, function (referencesInFile, referencingFilePath) {
return referencesInFile.has(filePath) &&
!seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
- removeSemanticDiagnosticsOf(state, referencingFilePath);
+ fn(state, referencingFilePath);
} // Dont add to seen since this is not yet done with the export removal
);
}
/**
- * Removes semantic diagnostics for path and
- * returns true if there are no more semantic diagnostics from the old state
- */
- function removeSemanticDiagnosticsOf(state, path) {
- if (!state.semanticDiagnosticsFromOldState) {
- return true;
- }
- state.semanticDiagnosticsFromOldState.delete(path);
- state.semanticDiagnosticsPerFile.delete(path);
- return !state.semanticDiagnosticsFromOldState.size;
- }
- /**
* This is called after completing operation on the next affected file.
* The operations here are postponed to ensure that cancellation during the iteration is handled correctly
*/
@@ -91500,7 +92456,7 @@
return toAffectedFileResult(state,
// When whole program is affected, do emit only once (eg when --out or --outFile is specified)
// Otherwise just affected file
- affected_1.emitBuildInfo(writeFile || host.writeFile, cancellationToken), affected_1,
+ affected_1.emitBuildInfo(writeFile || ts.maybeBind(host, host.writeFile), cancellationToken), affected_1,
/*isPendingEmitFile*/ false,
/*isBuildInfoEmit*/ true);
}
@@ -91516,14 +92472,10 @@
affected = program;
}
}
- // Mark seen emitted files if there are pending files to be emitted
- if (state.affectedFilesPendingEmit && state.program !== affected) {
- (state.seenEmittedFiles || (state.seenEmittedFiles = ts.createMap())).set(affected.path, true);
- }
return toAffectedFileResult(state,
// When whole program is affected, do emit only once (eg when --out or --outFile is specified)
// Otherwise just affected file
- ts.Debug.assertDefined(state.program).emit(affected === state.program ? undefined : affected, writeFile || host.writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers), affected, isPendingEmitFile);
+ ts.Debug.assertDefined(state.program).emit(affected === state.program ? undefined : affected, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers), affected, isPendingEmitFile);
}
/**
* Emits the JavaScript and declaration files.
@@ -91560,7 +92512,7 @@
};
}
}
- return ts.Debug.assertDefined(state.program).emit(targetSourceFile, writeFile || host.writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers);
+ return ts.Debug.assertDefined(state.program).emit(targetSourceFile, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
}
/**
* Return the semantic diagnostics for the next affected file or undefined if iteration is complete
@@ -91617,14 +92569,7 @@
}
// In case of emit builder, cache the files to be emitted
if (affectedFilesPendingEmit) {
- state.affectedFilesPendingEmit = ts.concatenate(state.affectedFilesPendingEmit, affectedFilesPendingEmit);
- // affectedFilesPendingEmitIndex === undefined
- // - means the emit state.affectedFilesPendingEmit was undefined before adding current affected files
- // so start from 0 as array would be affectedFilesPendingEmit
- // else, continue to iterate from existing index, the current set is appended to existing files
- if (state.affectedFilesPendingEmitIndex === undefined) {
- state.affectedFilesPendingEmitIndex = 0;
- }
+ addToAffectedFilesPendingEmit(state, affectedFilesPendingEmit);
}
var diagnostics;
for (var _i = 0, _a = ts.Debug.assertDefined(state.program).getSourceFiles(); _i < _a.length; _i++) {
@@ -91635,6 +92580,16 @@
}
}
ts.createBuilderProgram = createBuilderProgram;
+ function addToAffectedFilesPendingEmit(state, affectedFilesPendingEmit) {
+ state.affectedFilesPendingEmit = ts.concatenate(state.affectedFilesPendingEmit, affectedFilesPendingEmit);
+ // affectedFilesPendingEmitIndex === undefined
+ // - means the emit state.affectedFilesPendingEmit was undefined before adding current affected files
+ // so start from 0 as array would be affectedFilesPendingEmit
+ // else, continue to iterate from existing index, the current set is appended to existing files
+ if (state.affectedFilesPendingEmitIndex === undefined) {
+ state.affectedFilesPendingEmitIndex = 0;
+ }
+ }
function getMapOfReferencedSet(mapLike) {
if (!mapLike)
return undefined;
@@ -92496,11 +93451,11 @@
}
function discoverProbableSymlinks(files, getCanonicalFileName, cwd) {
var result = ts.createMap();
- var symlinks = ts.mapDefined(files, function (sf) {
- return sf.resolvedModules && ts.firstDefinedIterator(sf.resolvedModules.values(), function (res) {
+ var symlinks = ts.flatten(ts.mapDefined(files, function (sf) {
+ return sf.resolvedModules && ts.compact(ts.arrayFrom(ts.mapIterator(sf.resolvedModules.values(), function (res) {
return res && res.originalPath && res.resolvedFileName !== res.originalPath ? [res.resolvedFileName, res.originalPath] : undefined;
- });
- });
+ })));
+ }));
for (var _i = 0, symlinks_1 = symlinks; _i < symlinks_1.length; _i++) {
var _a = symlinks_1[_i], resolvedPath = _a[0], originalPath = _a[1];
var _b = guessDirectorySymlink(resolvedPath, originalPath, cwd, getCanonicalFileName), commonResolved = _b[0], commonOriginal = _b[1];
@@ -92843,6 +93798,14 @@
return "" + newLine + ts.flattenDiagnosticMessageText(d.messageText, newLine) + newLine + newLine;
}
ts.getErrorSummaryText = getErrorSummaryText;
+ function listFiles(program, writeFileName) {
+ if (program.getCompilerOptions().listFiles) {
+ ts.forEach(program.getSourceFiles(), function (file) {
+ writeFileName(file.fileName);
+ });
+ }
+ }
+ ts.listFiles = listFiles;
/**
* Helper that emit files, report diagnostics and lists emitted and/or source files depending on compiler options
*/
@@ -92870,11 +93833,7 @@
var filepath = ts.getNormalizedAbsolutePath(file, currentDir_1);
writeFileName("TSFILE: " + filepath);
});
- if (program.getCompilerOptions().listFiles) {
- ts.forEach(program.getSourceFiles(), function (file) {
- writeFileName(file.fileName);
- });
- }
+ listFiles(program, writeFileName);
}
if (reportSummary) {
reportSummary(getErrorCountForSummary(diagnostics));
@@ -93687,6 +94646,7 @@
function getCompilerOptionsOfBuildOptions(buildOptions) {
var result = {};
ts.commonOptionsWithBuild.forEach(function (option) {
+ if (ts.hasProperty(buildOptions, option.name))
result[option.name] = buildOptions[option.name];
});
return result;
@@ -93706,12 +94666,18 @@
var projectStatus = createFileMap(toPath);
var missingRoots = ts.createMap();
var globalDependencyGraph;
- var writeFileName = function (s) { return host.trace && host.trace(s); };
+ var writeFileName = host.trace ? function (s) { return host.trace(s); } : undefined;
var readFileWithCache = function (f) { return host.readFile(f); };
var projectCompilerOptions = baseCompilerOptions;
var compilerHost = ts.createCompilerHostFromProgramHost(host, function () { return projectCompilerOptions; });
ts.setGetSourceFileAsHashVersioned(compilerHost, host);
+ compilerHost.getParsedCommandLine = parseConfigFile;
+ compilerHost.resolveModuleNames = ts.maybeBind(host, host.resolveModuleNames);
+ compilerHost.resolveTypeReferenceDirectives = ts.maybeBind(host, host.resolveTypeReferenceDirectives);
+ var moduleResolutionCache = !compilerHost.resolveModuleNames ? ts.createModuleResolutionCache(currentDirectory, getCanonicalFileName) : undefined;
+ var cacheState;
var buildInfoChecked = createFileMap(toPath);
+ var extendedConfigCache = ts.createMap();
// Watch state
var builderPrograms = createFileMap(toPath);
var diagnostics = createFileMap(toPath);
@@ -93775,7 +94741,7 @@
}
var diagnostic;
parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = function (d) { return diagnostic = d; };
- var parsed = ts.getParsedCommandLineOfConfigFile(configFilePath, baseCompilerOptions, parseConfigFileHost);
+ var parsed = ts.getParsedCommandLineOfConfigFile(configFilePath, baseCompilerOptions, parseConfigFileHost, extendedConfigCache);
parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = ts.noop;
configFileCache.setValue(configFilePath, parsed || diagnostic);
return parsed;
@@ -94097,6 +95063,7 @@
projectStatus.removeKey(resolved);
diagnostics.removeKey(resolved);
addProjToQueue(resolved, reloadLevel);
+ enableCache();
}
/**
* return true if new addition
@@ -94152,6 +95119,7 @@
}
}
else {
+ disableCache();
reportErrorSummary();
}
}
@@ -94314,6 +95282,28 @@
}
// TODO: handle resolve module name to cache result in project reference redirect
projectCompilerOptions = configFile.options;
+ // Update module resolution cache if needed
+ if (moduleResolutionCache) {
+ var projPath = toPath(proj);
+ if (moduleResolutionCache.directoryToModuleNameMap.redirectsMap.size === 0) {
+ // The own map will be for projectCompilerOptions
+ ts.Debug.assert(moduleResolutionCache.moduleNameToDirectoryMap.redirectsMap.size === 0);
+ moduleResolutionCache.directoryToModuleNameMap.redirectsMap.set(projPath, moduleResolutionCache.directoryToModuleNameMap.ownMap);
+ moduleResolutionCache.moduleNameToDirectoryMap.redirectsMap.set(projPath, moduleResolutionCache.moduleNameToDirectoryMap.ownMap);
+ }
+ else {
+ // Set correct own map
+ ts.Debug.assert(moduleResolutionCache.moduleNameToDirectoryMap.redirectsMap.size > 0);
+ var ref = {
+ sourceFile: projectCompilerOptions.configFile,
+ commandLine: configFile
+ };
+ moduleResolutionCache.directoryToModuleNameMap.setOwnMap(moduleResolutionCache.directoryToModuleNameMap.getOrCreateMapOfCacheRedirects(ref));
+ moduleResolutionCache.moduleNameToDirectoryMap.setOwnMap(moduleResolutionCache.moduleNameToDirectoryMap.getOrCreateMapOfCacheRedirects(ref));
+ }
+ moduleResolutionCache.directoryToModuleNameMap.setOwnOptions(projectCompilerOptions);
+ moduleResolutionCache.moduleNameToDirectoryMap.setOwnOptions(projectCompilerOptions);
+ }
var program = host.createProgram(configFile.fileNames, configFile.options, compilerHost, getOldProgram(proj, configFile), configFile.errors, configFile.projectReferences);
// Don't emit anything in the presence of syntactic errors or options diagnostics
var syntaxDiagnostics = program.getConfigFileParsingDiagnostics().concat(program.getOptionsDiagnostics(), program.getGlobalDiagnostics(), program.getSyntacticDiagnostics());
@@ -94332,7 +95322,7 @@
var declDiagnostics;
var reportDeclarationDiagnostics = function (d) { return (declDiagnostics || (declDiagnostics = [])).push(d); };
var outputFiles = [];
- ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics, writeFileName, /*reportSummary*/ undefined, function (name, text, writeByteOrderMark) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); });
+ ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics, /*writeFileName*/ undefined, /*reportSummary*/ undefined, function (name, text, writeByteOrderMark) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); });
// Don't emit .d.ts if there are decl file errors
if (declDiagnostics) {
program.restoreState();
@@ -94354,7 +95344,7 @@
anyDtsChanged = true;
}
}
- emittedOutputs.setValue(name, true);
+ emittedOutputs.setValue(name, name);
ts.writeFile(compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
if (priorChangeTime !== undefined) {
newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime);
@@ -94365,6 +95355,10 @@
if (emitDiagnostics.length) {
return buildErrors(emitDiagnostics, BuildResultFlags.EmitErrors, "Emit");
}
+ if (writeFileName) {
+ emittedOutputs.forEach(function (name) { return listEmittedFile(configFile, name); });
+ ts.listFiles(program, writeFileName);
+ }
// Update time stamps for rest of the outputs
newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(configFile, newestDeclarationFileContentChangedTime, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
var status = {
@@ -94380,12 +95374,20 @@
function buildErrors(diagnostics, errorFlags, errorType) {
resultFlags |= errorFlags;
reportAndStoreErrors(proj, diagnostics);
+ // List files if any other build error using program (emit errors already report files)
+ if (writeFileName)
+ ts.listFiles(program, writeFileName);
projectStatus.setValue(proj, { type: UpToDateStatusType.Unbuildable, reason: errorType + " errors" });
afterProgramCreate(proj, program);
projectCompilerOptions = baseCompilerOptions;
return resultFlags;
}
}
+ function listEmittedFile(proj, file) {
+ if (writeFileName && proj.options.listEmittedFiles) {
+ writeFileName("TSFILE: " + file);
+ }
+ }
function afterProgramCreate(proj, program) {
if (host.afterProgramEmitAndDiagnostics) {
host.afterProgramEmitAndDiagnostics(program);
@@ -94424,7 +95426,7 @@
var emittedOutputs = createFileMap(toPath);
outputFiles.forEach(function (_a) {
var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
- emittedOutputs.setValue(name, true);
+ emittedOutputs.setValue(name, name);
ts.writeFile(compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
});
var emitDiagnostics = emitterDiagnostics.getDiagnostics();
@@ -94434,6 +95436,9 @@
projectCompilerOptions = baseCompilerOptions;
return BuildResultFlags.DeclarationOutputUnchanged | BuildResultFlags.EmitErrors;
}
+ if (writeFileName) {
+ emittedOutputs.forEach(function (name) { return listEmittedFile(config, name); });
+ }
// Update timestamps for dts
var newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(config, minimumDate, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
var status = {
@@ -94474,9 +95479,7 @@
priorNewestUpdateTime = newer(priorNewestUpdateTime, host.getModifiedTime(file) || ts.missingFileModifiedTime);
}
host.setModifiedTime(file, now);
- if (proj.options.listEmittedFiles) {
- writeFileName("TSFILE: " + file);
- }
+ listEmittedFile(proj, file);
}
}
return priorNewestUpdateTime;
@@ -94521,28 +95524,67 @@
function resolveProjectNames(configFileNames) {
return configFileNames.map(resolveProjectName);
}
- function buildAllProjects() {
- if (options.watch) {
- reportWatchStatus(ts.Diagnostics.Starting_compilation_in_watch_mode);
+ function enableCache() {
+ if (cacheState) {
+ disableCache();
}
- // TODO:: In watch mode as well to use caches for incremental build once we can invalidate caches correctly and have right api
- // Override readFile for json files and output .d.ts to cache the text
- var savedReadFileWithCache = readFileWithCache;
- var savedGetSourceFile = compilerHost.getSourceFile;
+ var originalReadFileWithCache = readFileWithCache;
+ var originalGetSourceFile = compilerHost.getSourceFile;
var _a = ts.changeCompilerHostLikeToUseCache(host, toPath, function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
- return savedGetSourceFile.call.apply(savedGetSourceFile, [compilerHost].concat(args));
+ return originalGetSourceFile.call.apply(originalGetSourceFile, [compilerHost].concat(args));
}), originalReadFile = _a.originalReadFile, originalFileExists = _a.originalFileExists, originalDirectoryExists = _a.originalDirectoryExists, originalCreateDirectory = _a.originalCreateDirectory, originalWriteFile = _a.originalWriteFile, getSourceFileWithCache = _a.getSourceFileWithCache, newReadFileWithCache = _a.readFileWithCache;
readFileWithCache = newReadFileWithCache;
compilerHost.getSourceFile = getSourceFileWithCache;
+ var originalResolveModuleNames = compilerHost.resolveModuleNames;
+ if (!compilerHost.resolveModuleNames) {
+ var loader_3 = function (moduleName, containingFile, redirectedReference) { return ts.resolveModuleName(moduleName, containingFile, projectCompilerOptions, compilerHost, moduleResolutionCache, redirectedReference).resolvedModule; };
+ compilerHost.resolveModuleNames = function (moduleNames, containingFile, _reusedNames, redirectedReference) {
+ return ts.loadWithLocalCache(ts.Debug.assertEachDefined(moduleNames), containingFile, redirectedReference, loader_3);
+ };
+ }
+ cacheState = {
+ originalReadFile: originalReadFile,
+ originalFileExists: originalFileExists,
+ originalDirectoryExists: originalDirectoryExists,
+ originalCreateDirectory: originalCreateDirectory,
+ originalWriteFile: originalWriteFile,
+ originalReadFileWithCache: originalReadFileWithCache,
+ originalGetSourceFile: originalGetSourceFile,
+ originalResolveModuleNames: originalResolveModuleNames
+ };
+ }
+ function disableCache() {
+ if (!cacheState)
+ return;
+ host.readFile = cacheState.originalReadFile;
+ host.fileExists = cacheState.originalFileExists;
+ host.directoryExists = cacheState.originalDirectoryExists;
+ host.createDirectory = cacheState.originalCreateDirectory;
+ host.writeFile = cacheState.originalWriteFile;
+ compilerHost.getSourceFile = cacheState.originalGetSourceFile;
+ readFileWithCache = cacheState.originalReadFileWithCache;
+ compilerHost.resolveModuleNames = cacheState.originalResolveModuleNames;
+ extendedConfigCache.clear();
+ if (moduleResolutionCache) {
+ moduleResolutionCache.directoryToModuleNameMap.clear();
+ moduleResolutionCache.moduleNameToDirectoryMap.clear();
+ }
+ cacheState = undefined;
+ }
+ function buildAllProjects() {
+ if (options.watch) {
+ reportWatchStatus(ts.Diagnostics.Starting_compilation_in_watch_mode);
+ }
+ enableCache();
var graph = getGlobalDependencyGraph();
reportBuildQueue(graph);
var anyFailed = false;
- for (var _i = 0, _b = graph.buildQueue; _i < _b.length; _i++) {
- var next = _b[_i];
+ for (var _i = 0, _a = graph.buildQueue; _i < _a.length; _i++) {
+ var next = _a[_i];
var proj = parseConfigFile(next);
if (proj === undefined) {
reportParseConfigFileDiagnostic(next);
@@ -94586,13 +95628,7 @@
anyFailed = anyFailed || !!(buildResult & BuildResultFlags.AnyErrors);
}
reportErrorSummary();
- host.readFile = originalReadFile;
- host.fileExists = originalFileExists;
- host.directoryExists = originalDirectoryExists;
- host.createDirectory = originalCreateDirectory;
- host.writeFile = originalWriteFile;
- compilerHost.getSourceFile = savedGetSourceFile;
- readFileWithCache = savedReadFileWithCache;
+ disableCache();
return anyFailed ? ts.ExitStatus.DiagnosticsPresent_OutputsSkipped : ts.ExitStatus.Success;
}
function needsBuild(status, configFile) {
@@ -94683,151 +95719,12 @@
/* @internal */
var ts;
(function (ts) {
- var ValueKind;
- (function (ValueKind) {
- ValueKind[ValueKind["Const"] = 0] = "Const";
- ValueKind[ValueKind["Array"] = 1] = "Array";
- ValueKind[ValueKind["FunctionOrClass"] = 2] = "FunctionOrClass";
- ValueKind[ValueKind["Object"] = 3] = "Object";
- })(ValueKind = ts.ValueKind || (ts.ValueKind = {}));
- function inspectModule(fileNameToRequire) {
- return inspectValue(ts.removeFileExtension(ts.getBaseFileName(fileNameToRequire)), tryRequire(fileNameToRequire));
- }
- ts.inspectModule = inspectModule;
- function inspectValue(name, value) {
- return getValueInfo(name, value, getRecurser());
- }
- ts.inspectValue = inspectValue;
- function getRecurser() {
- var seen = [];
- var nameStack = [];
- return function (obj, name, cbOk, cbFail) {
- if (seen.indexOf(obj) !== -1 || nameStack.length > 4) {
- return cbFail(seen.indexOf(obj) !== -1, nameStack);
- }
- seen.push(obj);
- nameStack.push(name);
- var res = cbOk();
- nameStack.pop();
- seen.pop();
- return res;
- };
- }
- function getValueInfo(name, value, recurser) {
- return recurser(value, name, function () {
- if (typeof value === "function")
- return getFunctionOrClassInfo(value, name, recurser);
- if (typeof value === "object") {
- var builtin = getBuiltinType(name, value, recurser);
- if (builtin !== undefined)
- return builtin;
- var entries = getEntriesOfObject(value);
- var hasNontrivialPrototype = Object.getPrototypeOf(value) !== Object.prototype;
- var members = ts.flatMap(entries, function (_a) {
- var key = _a.key, value = _a.value;
- return getValueInfo(key, value, recurser);
- });
- return { kind: 3 /* Object */, name: name, hasNontrivialPrototype: hasNontrivialPrototype, members: members };
- }
- return { kind: 0 /* Const */, name: name, typeName: isNullOrUndefined(value) ? "any" : typeof value };
- }, function (isCircularReference, keyStack) { return anyValue(name, " " + (isCircularReference ? "Circular reference" : "Too-deep object hierarchy") + " from " + keyStack.join(".")); });
- }
- function getFunctionOrClassInfo(fn, name, recurser) {
- var prototypeMembers = getPrototypeMembers(fn, recurser);
- var namespaceMembers = ts.flatMap(getEntriesOfObject(fn), function (_a) {
- var key = _a.key, value = _a.value;
- return getValueInfo(key, value, recurser);
- });
- var toString = ts.cast(Function.prototype.toString.call(fn), ts.isString);
- var source = ts.stringContains(toString, "{ [native code] }") ? getFunctionLength(fn) : toString;
- return { kind: 2 /* FunctionOrClass */, name: name, source: source, namespaceMembers: namespaceMembers, prototypeMembers: prototypeMembers };
- }
- var builtins = ts.memoize(function () {
- var map = ts.createMap();
- for (var _i = 0, _a = getEntriesOfObject(global); _i < _a.length; _i++) {
- var _b = _a[_i], key = _b.key, value = _b.value;
- if (typeof value === "function" && typeof value.prototype === "object" && value !== Object) {
- map.set(key, value);
- }
- }
- return map;
- });
- function getBuiltinType(name, value, recurser) {
- return ts.isArray(value)
- ? { name: name, kind: 1 /* Array */, inner: value.length && getValueInfo("element", ts.first(value), recurser) || anyValue(name) }
- : ts.forEachEntry(builtins(), function (builtin, builtinName) {
- return value instanceof builtin ? { kind: 0 /* Const */, name: name, typeName: builtinName } : undefined;
- });
- }
- function getPrototypeMembers(fn, recurser) {
- var prototype = fn.prototype;
- // tslint:disable-next-line no-unnecessary-type-assertion (TODO: update LKG and it will really be unnecessary)
- return typeof prototype !== "object" || prototype === null ? ts.emptyArray : ts.mapDefined(getEntriesOfObject(prototype), function (_a) {
- var key = _a.key, value = _a.value;
- return key === "constructor" ? undefined : getValueInfo(key, value, recurser);
- });
- }
- var ignoredProperties = ["arguments", "caller", "constructor", "eval", "super_"];
- var reservedFunctionProperties = Object.getOwnPropertyNames(ts.noop);
- function getEntriesOfObject(obj) {
- var seen = ts.createMap();
- var entries = [];
- var chain = obj;
- while (!isNullOrUndefined(chain) && chain !== Object.prototype && chain !== Function.prototype) {
- for (var _i = 0, _a = Object.getOwnPropertyNames(chain); _i < _a.length; _i++) {
- var key = _a[_i];
- if (!isJsPrivate(key) &&
- ignoredProperties.indexOf(key) === -1 &&
- (typeof obj !== "function" || reservedFunctionProperties.indexOf(key) === -1) &&
- // Don't add property from a higher prototype if it already exists in a lower one
- ts.addToSeen(seen, key)) {
- var value = safeGetPropertyOfObject(chain, key);
- // Don't repeat "toString" that matches signature from Object.prototype
- if (!(key === "toString" && typeof value === "function" && value.length === 0)) {
- entries.push({ key: key, value: value });
- }
- }
- }
- chain = Object.getPrototypeOf(chain);
- }
- return entries.sort(function (e1, e2) { return ts.compareStringsCaseSensitive(e1.key, e2.key); });
- }
- function getFunctionLength(fn) {
- return ts.tryCast(safeGetPropertyOfObject(fn, "length"), ts.isNumber) || 0;
- }
- function safeGetPropertyOfObject(obj, key) {
- var desc = Object.getOwnPropertyDescriptor(obj, key);
- return desc && desc.value;
- }
- function isNullOrUndefined(value) {
- return value == null; // tslint:disable-line
- }
- function anyValue(name, comment) {
- return { kind: 0 /* Const */, name: name, typeName: "any", comment: comment };
- }
- function isJsPrivate(name) {
- return ts.startsWith(name, "_");
- }
- ts.isJsPrivate = isJsPrivate;
- function tryRequire(fileNameToRequire) {
- try {
- return require(fileNameToRequire);
- }
- catch (_a) {
- return undefined;
- }
- }
-})(ts || (ts = {}));
-/* @internal */
-var ts;
-(function (ts) {
var server;
(function (server) {
// tslint:disable variable-name
server.ActionSet = "action::set";
server.ActionInvalidate = "action::invalidate";
server.ActionPackageInstalled = "action::packageInstalled";
- server.ActionValueInspected = "action::valueInspected";
server.EventTypesRegistry = "event::typesRegistry";
server.EventBeginInstallTypes = "event::beginInstallTypes";
server.EventEndInstallTypes = "event::endInstallTypes";
@@ -95445,7 +96342,7 @@
/* @internal */
var ts;
(function (ts) {
- ts.scanner = ts.createScanner(7 /* Latest */, /*skipTrivia*/ true);
+ ts.scanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ true);
var SemanticMeaning;
(function (SemanticMeaning) {
SemanticMeaning[SemanticMeaning["None"] = 0] = "None";
@@ -95456,37 +96353,37 @@
})(SemanticMeaning = ts.SemanticMeaning || (ts.SemanticMeaning = {}));
function getMeaningFromDeclaration(node) {
switch (node.kind) {
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return ts.isInJSFile(node) && ts.getJSDocEnumTag(node) ? 7 /* All */ : 1 /* Value */;
- case 151 /* Parameter */:
- case 186 /* BindingElement */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 275 /* PropertyAssignment */:
- case 276 /* ShorthandPropertyAssignment */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 274 /* CatchClause */:
- case 267 /* JsxAttribute */:
+ case 152 /* Parameter */:
+ case 187 /* BindingElement */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 276 /* PropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 275 /* CatchClause */:
+ case 268 /* JsxAttribute */:
return 1 /* Value */;
- case 150 /* TypeParameter */:
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 168 /* TypeLiteral */:
+ case 151 /* TypeParameter */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 169 /* TypeLiteral */:
return 2 /* Type */;
- case 309 /* JSDocTypedefTag */:
+ case 310 /* JSDocTypedefTag */:
// If it has no name node, it shares the name with the value declaration below it.
return node.name === undefined ? 1 /* Value */ | 2 /* Type */ : 2 /* Type */;
- case 278 /* EnumMember */:
- case 240 /* ClassDeclaration */:
+ case 279 /* EnumMember */:
+ case 241 /* ClassDeclaration */:
return 1 /* Value */ | 2 /* Type */;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
if (ts.isAmbientModule(node)) {
return 4 /* Namespace */ | 1 /* Value */;
}
@@ -95496,26 +96393,26 @@
else {
return 4 /* Namespace */;
}
- case 243 /* EnumDeclaration */:
- case 252 /* NamedImports */:
- case 253 /* ImportSpecifier */:
- case 248 /* ImportEqualsDeclaration */:
- case 249 /* ImportDeclaration */:
- case 254 /* ExportAssignment */:
- case 255 /* ExportDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 253 /* NamedImports */:
+ case 254 /* ImportSpecifier */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 255 /* ExportAssignment */:
+ case 256 /* ExportDeclaration */:
return 7 /* All */;
// An external module can be a Value
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return 4 /* Namespace */ | 1 /* Value */;
}
return 7 /* All */;
}
ts.getMeaningFromDeclaration = getMeaningFromDeclaration;
function getMeaningFromLocation(node) {
- if (node.kind === 284 /* SourceFile */) {
+ if (node.kind === 285 /* SourceFile */) {
return 1 /* Value */;
}
- else if (node.parent.kind === 254 /* ExportAssignment */ || node.parent.kind === 259 /* ExternalModuleReference */) {
+ else if (node.parent.kind === 255 /* ExportAssignment */ || node.parent.kind === 260 /* ExternalModuleReference */) {
return 7 /* All */;
}
else if (isInRightSideOfInternalImportEqualsDeclaration(node)) {
@@ -95547,11 +96444,11 @@
// import a = |b|; // Namespace
// import a = |b.c|; // Value, type, namespace
// import a = |b.c|.d; // Namespace
- var name = node.kind === 148 /* QualifiedName */ ? node : ts.isQualifiedName(node.parent) && node.parent.right === node ? node.parent : undefined;
- return name && name.parent.kind === 248 /* ImportEqualsDeclaration */ ? 7 /* All */ : 4 /* Namespace */;
+ var name = node.kind === 149 /* QualifiedName */ ? node : ts.isQualifiedName(node.parent) && node.parent.right === node ? node.parent : undefined;
+ return name && name.parent.kind === 249 /* ImportEqualsDeclaration */ ? 7 /* All */ : 4 /* Namespace */;
}
function isInRightSideOfInternalImportEqualsDeclaration(node) {
- while (node.parent.kind === 148 /* QualifiedName */) {
+ while (node.parent.kind === 149 /* QualifiedName */) {
node = node.parent;
}
return ts.isInternalModuleImportEqualsDeclaration(node.parent) && node.parent.moduleReference === node;
@@ -95563,27 +96460,27 @@
function isQualifiedNameNamespaceReference(node) {
var root = node;
var isLastClause = true;
- if (root.parent.kind === 148 /* QualifiedName */) {
- while (root.parent && root.parent.kind === 148 /* QualifiedName */) {
+ if (root.parent.kind === 149 /* QualifiedName */) {
+ while (root.parent && root.parent.kind === 149 /* QualifiedName */) {
root = root.parent;
}
isLastClause = root.right === node;
}
- return root.parent.kind === 164 /* TypeReference */ && !isLastClause;
+ return root.parent.kind === 165 /* TypeReference */ && !isLastClause;
}
function isPropertyAccessNamespaceReference(node) {
var root = node;
var isLastClause = true;
- if (root.parent.kind === 189 /* PropertyAccessExpression */) {
- while (root.parent && root.parent.kind === 189 /* PropertyAccessExpression */) {
+ if (root.parent.kind === 190 /* PropertyAccessExpression */) {
+ while (root.parent && root.parent.kind === 190 /* PropertyAccessExpression */) {
root = root.parent;
}
isLastClause = root.name === node;
}
- if (!isLastClause && root.parent.kind === 211 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 273 /* HeritageClause */) {
+ if (!isLastClause && root.parent.kind === 212 /* ExpressionWithTypeArguments */ && root.parent.parent.kind === 274 /* HeritageClause */) {
var decl = root.parent.parent.parent;
- return (decl.kind === 240 /* ClassDeclaration */ && root.parent.parent.token === 109 /* ImplementsKeyword */) ||
- (decl.kind === 241 /* InterfaceDeclaration */ && root.parent.parent.token === 86 /* ExtendsKeyword */);
+ return (decl.kind === 241 /* ClassDeclaration */ && root.parent.parent.token === 110 /* ImplementsKeyword */) ||
+ (decl.kind === 242 /* InterfaceDeclaration */ && root.parent.parent.token === 87 /* ExtendsKeyword */);
}
return false;
}
@@ -95592,17 +96489,17 @@
node = node.parent;
}
switch (node.kind) {
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
return !ts.isExpressionNode(node);
- case 178 /* ThisType */:
+ case 179 /* ThisType */:
return true;
}
switch (node.parent.kind) {
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return true;
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return !node.parent.isTypeOf;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return !ts.isExpressionWithTypeArgumentsInClassExtendsClause(node.parent);
}
return false;
@@ -95629,7 +96526,7 @@
ts.climbPastPropertyAccess = climbPastPropertyAccess;
function getTargetLabel(referenceNode, labelName) {
while (referenceNode) {
- if (referenceNode.kind === 233 /* LabeledStatement */ && referenceNode.label.escapedText === labelName) {
+ if (referenceNode.kind === 234 /* LabeledStatement */ && referenceNode.label.escapedText === labelName) {
return referenceNode.label;
}
referenceNode = referenceNode.parent;
@@ -95645,11 +96542,11 @@
}
ts.hasPropertyAccessExpressionWithName = hasPropertyAccessExpressionWithName;
function isJumpStatementTarget(node) {
- return node.kind === 72 /* Identifier */ && ts.isBreakOrContinueStatement(node.parent) && node.parent.label === node;
+ return node.kind === 73 /* Identifier */ && ts.isBreakOrContinueStatement(node.parent) && node.parent.label === node;
}
ts.isJumpStatementTarget = isJumpStatementTarget;
function isLabelOfLabeledStatement(node) {
- return node.kind === 72 /* Identifier */ && ts.isLabeledStatement(node.parent) && node.parent.label === node;
+ return node.kind === 73 /* Identifier */ && ts.isLabeledStatement(node.parent) && node.parent.label === node;
}
ts.isLabelOfLabeledStatement = isLabelOfLabeledStatement;
function isLabelName(node) {
@@ -95661,40 +96558,40 @@
}
ts.isTagName = isTagName;
function isRightSideOfQualifiedName(node) {
- return node.parent.kind === 148 /* QualifiedName */ && node.parent.right === node;
+ return node.parent.kind === 149 /* QualifiedName */ && node.parent.right === node;
}
ts.isRightSideOfQualifiedName = isRightSideOfQualifiedName;
function isRightSideOfPropertyAccess(node) {
- return node && node.parent && node.parent.kind === 189 /* PropertyAccessExpression */ && node.parent.name === node;
+ return node && node.parent && node.parent.kind === 190 /* PropertyAccessExpression */ && node.parent.name === node;
}
ts.isRightSideOfPropertyAccess = isRightSideOfPropertyAccess;
function isNameOfModuleDeclaration(node) {
- return node.parent.kind === 244 /* ModuleDeclaration */ && node.parent.name === node;
+ return node.parent.kind === 245 /* ModuleDeclaration */ && node.parent.name === node;
}
ts.isNameOfModuleDeclaration = isNameOfModuleDeclaration;
function isNameOfFunctionDeclaration(node) {
- return node.kind === 72 /* Identifier */ &&
+ return node.kind === 73 /* Identifier */ &&
ts.isFunctionLike(node.parent) && node.parent.name === node;
}
ts.isNameOfFunctionDeclaration = isNameOfFunctionDeclaration;
function isLiteralNameOfPropertyDeclarationOrIndexAccess(node) {
switch (node.parent.kind) {
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 275 /* PropertyAssignment */:
- case 278 /* EnumMember */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 244 /* ModuleDeclaration */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 276 /* PropertyAssignment */:
+ case 279 /* EnumMember */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 245 /* ModuleDeclaration */:
return ts.getNameOfDeclaration(node.parent) === node;
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return node.parent.argumentExpression === node;
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
return true;
- case 182 /* LiteralType */:
- return node.parent.parent.kind === 180 /* IndexedAccessType */;
+ case 183 /* LiteralType */:
+ return node.parent.parent.kind === 181 /* IndexedAccessType */;
default:
return false;
}
@@ -95718,17 +96615,17 @@
return undefined;
}
switch (node.kind) {
- case 284 /* SourceFile */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
- case 244 /* ModuleDeclaration */:
+ case 285 /* SourceFile */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 245 /* ModuleDeclaration */:
return node;
}
}
@@ -95736,48 +96633,48 @@
ts.getContainerNode = getContainerNode;
function getNodeKind(node) {
switch (node.kind) {
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return ts.isExternalModule(node) ? "module" /* moduleElement */ : "script" /* scriptElement */;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return "module" /* moduleElement */;
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
return "class" /* classElement */;
- case 241 /* InterfaceDeclaration */: return "interface" /* interfaceElement */;
- case 242 /* TypeAliasDeclaration */:
- case 302 /* JSDocCallbackTag */:
- case 309 /* JSDocTypedefTag */:
+ case 242 /* InterfaceDeclaration */: return "interface" /* interfaceElement */;
+ case 243 /* TypeAliasDeclaration */:
+ case 303 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
return "type" /* typeElement */;
- case 243 /* EnumDeclaration */: return "enum" /* enumElement */;
- case 237 /* VariableDeclaration */:
+ case 244 /* EnumDeclaration */: return "enum" /* enumElement */;
+ case 238 /* VariableDeclaration */:
return getKindOfVariableDeclaration(node);
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return getKindOfVariableDeclaration(ts.getRootDeclaration(node));
- case 197 /* ArrowFunction */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
return "function" /* functionElement */;
- case 158 /* GetAccessor */: return "getter" /* memberGetAccessorElement */;
- case 159 /* SetAccessor */: return "setter" /* memberSetAccessorElement */;
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 159 /* GetAccessor */: return "getter" /* memberGetAccessorElement */;
+ case 160 /* SetAccessor */: return "setter" /* memberSetAccessorElement */;
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
return "method" /* memberFunctionElement */;
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
return "property" /* memberVariableElement */;
- case 162 /* IndexSignature */: return "index" /* indexSignatureElement */;
- case 161 /* ConstructSignature */: return "construct" /* constructSignatureElement */;
- case 160 /* CallSignature */: return "call" /* callSignatureElement */;
- case 157 /* Constructor */: return "constructor" /* constructorImplementationElement */;
- case 150 /* TypeParameter */: return "type parameter" /* typeParameterElement */;
- case 278 /* EnumMember */: return "enum member" /* enumMemberElement */;
- case 151 /* Parameter */: return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) ? "property" /* memberVariableElement */ : "parameter" /* parameterElement */;
- case 248 /* ImportEqualsDeclaration */:
- case 253 /* ImportSpecifier */:
- case 257 /* ExportSpecifier */:
- case 251 /* NamespaceImport */:
+ case 163 /* IndexSignature */: return "index" /* indexSignatureElement */;
+ case 162 /* ConstructSignature */: return "construct" /* constructSignatureElement */;
+ case 161 /* CallSignature */: return "call" /* callSignatureElement */;
+ case 158 /* Constructor */: return "constructor" /* constructorImplementationElement */;
+ case 151 /* TypeParameter */: return "type parameter" /* typeParameterElement */;
+ case 279 /* EnumMember */: return "enum member" /* enumMemberElement */;
+ case 152 /* Parameter */: return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) ? "property" /* memberVariableElement */ : "parameter" /* parameterElement */;
+ case 249 /* ImportEqualsDeclaration */:
+ case 254 /* ImportSpecifier */:
+ case 258 /* ExportSpecifier */:
+ case 252 /* NamespaceImport */:
return "alias" /* alias */;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
var kind = ts.getAssignmentDeclarationKind(node);
var right = node.right;
switch (kind) {
@@ -95804,7 +96701,7 @@
return "" /* unknown */;
}
}
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return ts.isImportClause(node.parent) ? "alias" /* alias */ : "" /* unknown */;
default:
return "" /* unknown */;
@@ -95820,12 +96717,12 @@
ts.getNodeKind = getNodeKind;
function isThis(node) {
switch (node.kind) {
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
// case SyntaxKind.ThisType: TODO: GH#9267
return true;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
// 'this' as a parameter
- return ts.identifierIsThisKeyword(node) && node.parent.kind === 151 /* Parameter */;
+ return ts.identifierIsThisKeyword(node) && node.parent.kind === 152 /* Parameter */;
default:
return false;
}
@@ -95890,42 +96787,42 @@
return false;
}
switch (n.kind) {
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
- case 188 /* ObjectLiteralExpression */:
- case 184 /* ObjectBindingPattern */:
- case 168 /* TypeLiteral */:
- case 218 /* Block */:
- case 245 /* ModuleBlock */:
- case 246 /* CaseBlock */:
- case 252 /* NamedImports */:
- case 256 /* NamedExports */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 189 /* ObjectLiteralExpression */:
+ case 185 /* ObjectBindingPattern */:
+ case 169 /* TypeLiteral */:
+ case 219 /* Block */:
+ case 246 /* ModuleBlock */:
+ case 247 /* CaseBlock */:
+ case 253 /* NamedImports */:
+ case 257 /* NamedExports */:
return nodeEndsWith(n, 19 /* CloseBraceToken */, sourceFile);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return isCompletedNode(n.block, sourceFile);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
if (!n.arguments) {
return true;
}
// falls through
- case 191 /* CallExpression */:
- case 195 /* ParenthesizedExpression */:
- case 177 /* ParenthesizedType */:
+ case 192 /* CallExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 178 /* ParenthesizedType */:
return nodeEndsWith(n, 21 /* CloseParenToken */, sourceFile);
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
return isCompletedNode(n.type, sourceFile);
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 161 /* ConstructSignature */:
- case 160 /* CallSignature */:
- case 197 /* ArrowFunction */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 162 /* ConstructSignature */:
+ case 161 /* CallSignature */:
+ case 198 /* ArrowFunction */:
if (n.body) {
return isCompletedNode(n.body, sourceFile);
}
@@ -95935,65 +96832,65 @@
// Even though type parameters can be unclosed, we can get away with
// having at least a closing paren.
return hasChildOfKind(n, 21 /* CloseParenToken */, sourceFile);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return !!n.body && isCompletedNode(n.body, sourceFile);
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
if (n.elseStatement) {
return isCompletedNode(n.elseStatement, sourceFile);
}
return isCompletedNode(n.thenStatement, sourceFile);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return isCompletedNode(n.expression, sourceFile) ||
hasChildOfKind(n, 26 /* SemicolonToken */, sourceFile);
- case 187 /* ArrayLiteralExpression */:
- case 185 /* ArrayBindingPattern */:
- case 190 /* ElementAccessExpression */:
- case 149 /* ComputedPropertyName */:
- case 170 /* TupleType */:
+ case 188 /* ArrayLiteralExpression */:
+ case 186 /* ArrayBindingPattern */:
+ case 191 /* ElementAccessExpression */:
+ case 150 /* ComputedPropertyName */:
+ case 171 /* TupleType */:
return nodeEndsWith(n, 23 /* CloseBracketToken */, sourceFile);
- case 162 /* IndexSignature */:
+ case 163 /* IndexSignature */:
if (n.type) {
return isCompletedNode(n.type, sourceFile);
}
return hasChildOfKind(n, 23 /* CloseBracketToken */, sourceFile);
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
// there is no such thing as terminator token for CaseClause/DefaultClause so for simplicity always consider them non-completed
return false;
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 224 /* WhileStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 225 /* WhileStatement */:
return isCompletedNode(n.statement, sourceFile);
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
// rough approximation: if DoStatement has While keyword - then if node is completed is checking the presence of ')';
- return hasChildOfKind(n, 107 /* WhileKeyword */, sourceFile)
+ return hasChildOfKind(n, 108 /* WhileKeyword */, sourceFile)
? nodeEndsWith(n, 21 /* CloseParenToken */, sourceFile)
: isCompletedNode(n.statement, sourceFile);
- case 167 /* TypeQuery */:
+ case 168 /* TypeQuery */:
return isCompletedNode(n.exprName, sourceFile);
- case 199 /* TypeOfExpression */:
- case 198 /* DeleteExpression */:
- case 200 /* VoidExpression */:
- case 207 /* YieldExpression */:
- case 208 /* SpreadElement */:
+ case 200 /* TypeOfExpression */:
+ case 199 /* DeleteExpression */:
+ case 201 /* VoidExpression */:
+ case 208 /* YieldExpression */:
+ case 209 /* SpreadElement */:
var unaryWordExpression = n;
return isCompletedNode(unaryWordExpression.expression, sourceFile);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return isCompletedNode(n.template, sourceFile);
- case 206 /* TemplateExpression */:
+ case 207 /* TemplateExpression */:
var lastSpan = ts.lastOrUndefined(n.templateSpans);
return isCompletedNode(lastSpan, sourceFile);
- case 216 /* TemplateSpan */:
+ case 217 /* TemplateSpan */:
return ts.nodeIsPresent(n.literal);
- case 255 /* ExportDeclaration */:
- case 249 /* ImportDeclaration */:
+ case 256 /* ExportDeclaration */:
+ case 250 /* ImportDeclaration */:
return ts.nodeIsPresent(n.moduleSpecifier);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return isCompletedNode(n.operand, sourceFile);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return isCompletedNode(n.right, sourceFile);
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return isCompletedNode(n.whenFalse, sourceFile);
default:
return true;
@@ -96172,7 +97069,7 @@
}
}
}
- ts.Debug.assert(startNode !== undefined || n.kind === 284 /* SourceFile */ || n.kind === 1 /* EndOfFileToken */ || ts.isJSDocCommentContainingNode(n));
+ ts.Debug.assert(startNode !== undefined || n.kind === 285 /* SourceFile */ || n.kind === 1 /* EndOfFileToken */ || ts.isJSDocCommentContainingNode(n));
// Here we know that none of child token nodes embrace the position,
// the only known case is when position is at the end of the file.
// Try to find the rightmost token in the file without filtering.
@@ -96242,17 +97139,17 @@
return true;
}
// <div> { | </div> or <div a={| </div>
- if (token.kind === 28 /* LessThanToken */ && token.parent.kind === 270 /* JsxExpression */) {
+ if (token.kind === 28 /* LessThanToken */ && token.parent.kind === 271 /* JsxExpression */) {
return true;
}
// <div> {
// |
// } < /div>
- if (token && token.kind === 19 /* CloseBraceToken */ && token.parent.kind === 270 /* JsxExpression */) {
+ if (token && token.kind === 19 /* CloseBraceToken */ && token.parent.kind === 271 /* JsxExpression */) {
return true;
}
// <div>|</div>
- if (token.kind === 28 /* LessThanToken */ && token.parent.kind === 263 /* JsxClosingElement */) {
+ if (token.kind === 28 /* LessThanToken */ && token.parent.kind === 264 /* JsxClosingElement */) {
return true;
}
return false;
@@ -96371,15 +97268,15 @@
nTypeArguments++;
break;
case 37 /* EqualsGreaterThanToken */:
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
case 10 /* StringLiteral */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
- case 104 /* TypeOfKeyword */:
- case 86 /* ExtendsKeyword */:
- case 129 /* KeyOfKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
+ case 105 /* TypeOfKeyword */:
+ case 87 /* ExtendsKeyword */:
+ case 130 /* KeyOfKeyword */:
case 24 /* DotToken */:
case 50 /* BarToken */:
case 56 /* QuestionToken */:
@@ -96438,10 +97335,10 @@
}
ts.getNodeModifiers = getNodeModifiers;
function getTypeArgumentOrTypeParameterList(node) {
- if (node.kind === 164 /* TypeReference */ || node.kind === 191 /* CallExpression */) {
+ if (node.kind === 165 /* TypeReference */ || node.kind === 192 /* CallExpression */) {
return node.typeArguments;
}
- if (ts.isFunctionLike(node) || node.kind === 240 /* ClassDeclaration */ || node.kind === 241 /* InterfaceDeclaration */) {
+ if (ts.isFunctionLike(node) || node.kind === 241 /* ClassDeclaration */ || node.kind === 242 /* InterfaceDeclaration */) {
return node.typeParameters;
}
return undefined;
@@ -96461,7 +97358,7 @@
}
ts.isStringOrRegularExpressionOrTemplateLiteral = isStringOrRegularExpressionOrTemplateLiteral;
function isPunctuation(kind) {
- return 18 /* FirstPunctuation */ <= kind && kind <= 71 /* LastPunctuation */;
+ return 18 /* FirstPunctuation */ <= kind && kind <= 72 /* LastPunctuation */;
}
ts.isPunctuation = isPunctuation;
function isInsideTemplateLiteral(node, position, sourceFile) {
@@ -96471,9 +97368,9 @@
ts.isInsideTemplateLiteral = isInsideTemplateLiteral;
function isAccessibilityModifier(kind) {
switch (kind) {
- case 115 /* PublicKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
+ case 116 /* PublicKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
return true;
}
return false;
@@ -96486,18 +97383,18 @@
}
ts.cloneCompilerOptions = cloneCompilerOptions;
function isArrayLiteralOrObjectLiteralDestructuringPattern(node) {
- if (node.kind === 187 /* ArrayLiteralExpression */ ||
- node.kind === 188 /* ObjectLiteralExpression */) {
+ if (node.kind === 188 /* ArrayLiteralExpression */ ||
+ node.kind === 189 /* ObjectLiteralExpression */) {
// [a,b,c] from:
// [a, b, c] = someExpression;
- if (node.parent.kind === 204 /* BinaryExpression */ &&
+ if (node.parent.kind === 205 /* BinaryExpression */ &&
node.parent.left === node &&
- node.parent.operatorToken.kind === 59 /* EqualsToken */) {
+ node.parent.operatorToken.kind === 60 /* EqualsToken */) {
return true;
}
// [a, b, c] from:
// for([a, b, c] of expression)
- if (node.parent.kind === 227 /* ForOfStatement */ &&
+ if (node.parent.kind === 228 /* ForOfStatement */ &&
node.parent.initializer === node) {
return true;
}
@@ -96505,7 +97402,7 @@
// [x, [a, b, c] ] = someExpression
// or
// {x, a: {a, b, c} } = someExpression
- if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 275 /* PropertyAssignment */ ? node.parent.parent : node.parent)) {
+ if (isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.kind === 276 /* PropertyAssignment */ ? node.parent.parent : node.parent)) {
return true;
}
}
@@ -96549,22 +97446,22 @@
}
ts.createTextChange = createTextChange;
ts.typeKeywords = [
- 120 /* AnyKeyword */,
- 146 /* BigIntKeyword */,
- 123 /* BooleanKeyword */,
- 87 /* FalseKeyword */,
- 129 /* KeyOfKeyword */,
- 132 /* NeverKeyword */,
- 96 /* NullKeyword */,
- 135 /* NumberKeyword */,
- 136 /* ObjectKeyword */,
- 138 /* StringKeyword */,
- 139 /* SymbolKeyword */,
- 102 /* TrueKeyword */,
- 106 /* VoidKeyword */,
- 141 /* UndefinedKeyword */,
- 142 /* UniqueKeyword */,
- 143 /* UnknownKeyword */,
+ 121 /* AnyKeyword */,
+ 147 /* BigIntKeyword */,
+ 124 /* BooleanKeyword */,
+ 88 /* FalseKeyword */,
+ 130 /* KeyOfKeyword */,
+ 133 /* NeverKeyword */,
+ 97 /* NullKeyword */,
+ 136 /* NumberKeyword */,
+ 137 /* ObjectKeyword */,
+ 139 /* StringKeyword */,
+ 140 /* SymbolKeyword */,
+ 103 /* TrueKeyword */,
+ 107 /* VoidKeyword */,
+ 142 /* UndefinedKeyword */,
+ 143 /* UniqueKeyword */,
+ 144 /* UnknownKeyword */,
];
function isTypeKeyword(kind) {
return ts.contains(ts.typeKeywords, kind);
@@ -96600,7 +97497,7 @@
}
ts.skipConstraint = skipConstraint;
function getNameFromPropertyName(name) {
- return name.kind === 149 /* ComputedPropertyName */
+ return name.kind === 150 /* ComputedPropertyName */
// treat computed property names where expression is string/numeric literal as just string/numeric literal
? ts.isStringOrNumericLiteralLike(name.expression) ? name.expression.text : undefined
: ts.getTextOfIdentifierOrLiteral(name);
@@ -96676,7 +97573,7 @@
}
return ts.firstDefined(symbol.declarations, function (decl) {
var name = ts.getNameOfDeclaration(decl);
- return name && name.kind === 72 /* Identifier */ ? name.escapedText : undefined;
+ return name && name.kind === 73 /* Identifier */ ? name.escapedText : undefined;
});
}
ts.symbolEscapedNameNoDefault = symbolEscapedNameNoDefault;
@@ -96765,7 +97662,7 @@
/* @internal */
(function (ts) {
function isFirstDeclarationOfSymbolParameter(symbol) {
- return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 151 /* Parameter */;
+ return symbol.declarations && symbol.declarations.length > 0 && symbol.declarations[0].kind === 152 /* Parameter */;
}
ts.isFirstDeclarationOfSymbolParameter = isFirstDeclarationOfSymbolParameter;
var displayPartWriter = getDisplayPartWriter();
@@ -97019,17 +97916,25 @@
return ts.ensureScriptKind(fileName, host && host.getScriptKind && host.getScriptKind(fileName));
}
ts.getScriptKind = getScriptKind;
- function getSymbolTarget(symbol) {
+ function getSymbolTarget(symbol, checker) {
var next = symbol;
- while (isTransientSymbol(next) && next.target) {
+ while (isAliasSymbol(next) || (isTransientSymbol(next) && next.target)) {
+ if (isTransientSymbol(next) && next.target) {
next = next.target;
}
+ else {
+ next = ts.skipAlias(next, checker);
+ }
+ }
return next;
}
ts.getSymbolTarget = getSymbolTarget;
function isTransientSymbol(symbol) {
return (symbol.flags & 33554432 /* Transient */) !== 0;
}
+ function isAliasSymbol(symbol) {
+ return (symbol.flags & 2097152 /* Alias */) !== 0;
+ }
function getUniqueSymbolId(symbol, checker) {
return ts.getSymbolId(ts.skipAlias(symbol, checker));
}
@@ -97065,7 +97970,14 @@
function getSynthesizedDeepCloneWithRenames(node, includeTrivia, renameMap, checker, callback) {
if (includeTrivia === void 0) { includeTrivia = true; }
var clone;
- if (ts.isIdentifier(node) && renameMap && checker) {
+ if (renameMap && checker && ts.isBindingElement(node) && ts.isIdentifier(node.name) && ts.isObjectBindingPattern(node.parent)) {
+ var symbol = checker.getSymbolAtLocation(node.name);
+ var renameInfo = symbol && renameMap.get(String(ts.getSymbolId(symbol)));
+ if (renameInfo && renameInfo.text !== (node.name || node.propertyName).getText()) {
+ clone = ts.createBindingElement(node.dotDotDotToken, node.propertyName || node.name, renameInfo, node.initializer);
+ }
+ }
+ else if (renameMap && checker && ts.isIdentifier(node)) {
var symbol = checker.getSymbolAtLocation(node);
var renameInfo = symbol && renameMap.get(String(ts.getSymbolId(symbol)));
if (renameInfo) {
@@ -97229,15 +98141,15 @@
function getContextualTypeFromParent(node, checker) {
var parent = node.parent;
switch (parent.kind) {
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return checker.getContextualType(parent);
- case 204 /* BinaryExpression */: {
+ case 205 /* BinaryExpression */: {
var _a = parent, left = _a.left, operatorToken = _a.operatorToken, right = _a.right;
return isEqualityOperatorKind(operatorToken.kind)
? checker.getTypeAtLocation(node === right ? left : right)
: checker.getContextualType(node);
}
- case 271 /* CaseClause */:
+ case 272 /* CaseClause */:
return parent.expression === node ? getSwitchedType(parent, checker) : undefined;
default:
return checker.getContextualType(node);
@@ -97279,8 +98191,8 @@
switch (node.kind) {
case 10 /* StringLiteral */:
case 14 /* NoSubstitutionTemplateLiteral */:
- case 206 /* TemplateExpression */:
- case 193 /* TaggedTemplateExpression */:
+ case 207 /* TemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return true;
default:
return false;
@@ -97323,7 +98235,7 @@
var ts;
(function (ts) {
function createClassifier() {
- var scanner = ts.createScanner(7 /* Latest */, /*skipTrivia*/ false);
+ var scanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false);
function getClassificationsForLine(text, lexState, syntacticClassifierAbsent) {
return convertClassificationsToResult(getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent), text);
}
@@ -97400,13 +98312,13 @@
function handleToken() {
switch (token) {
case 42 /* SlashToken */:
- case 64 /* SlashEqualsToken */:
+ case 65 /* SlashEqualsToken */:
if (!noRegexTable[lastNonTriviaToken] && scanner.reScanSlashToken() === 13 /* RegularExpressionLiteral */) {
token = 13 /* RegularExpressionLiteral */;
}
break;
case 28 /* LessThanToken */:
- if (lastNonTriviaToken === 72 /* Identifier */) {
+ if (lastNonTriviaToken === 73 /* Identifier */) {
// Could be the start of something generic. Keep track of that by bumping
// up the current count of generic contexts we may be in.
angleBracketStack++;
@@ -97419,16 +98331,16 @@
angleBracketStack--;
}
break;
- case 120 /* AnyKeyword */:
- case 138 /* StringKeyword */:
- case 135 /* NumberKeyword */:
- case 123 /* BooleanKeyword */:
- case 139 /* SymbolKeyword */:
+ case 121 /* AnyKeyword */:
+ case 139 /* StringKeyword */:
+ case 136 /* NumberKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 140 /* SymbolKeyword */:
if (angleBracketStack > 0 && !syntacticClassifierAbsent) {
// If it looks like we're could be in something generic, don't classify this
// as a keyword. We may just get overwritten by the syntactic classifier,
// causing a noisy experience for the user.
- token = 72 /* Identifier */;
+ token = 73 /* Identifier */;
}
break;
case 15 /* TemplateHead */:
@@ -97467,14 +98379,14 @@
break;
}
if (lastNonTriviaToken === 24 /* DotToken */) {
- token = 72 /* Identifier */;
+ token = 73 /* Identifier */;
}
else if (ts.isKeyword(lastNonTriviaToken) && ts.isKeyword(token) && !canFollow(lastNonTriviaToken, token)) {
// We have two keywords in a row. Only treat the second as a keyword if
// it's a sequence that could legally occur in the language. Otherwise
// treat it as an identifier. This way, if someone writes "private var"
// we recognize that 'var' is actually an identifier here.
- token = 72 /* Identifier */;
+ token = 73 /* Identifier */;
}
}
}
@@ -97488,19 +98400,19 @@
/// we have a series of divide operator. this list allows us to be more accurate by ruling out
/// locations where a regexp cannot exist.
var noRegexTable = ts.arrayToNumericMap([
- 72 /* Identifier */,
+ 73 /* Identifier */,
10 /* StringLiteral */,
8 /* NumericLiteral */,
9 /* BigIntLiteral */,
13 /* RegularExpressionLiteral */,
- 100 /* ThisKeyword */,
+ 101 /* ThisKeyword */,
44 /* PlusPlusToken */,
45 /* MinusMinusToken */,
21 /* CloseParenToken */,
23 /* CloseBracketToken */,
19 /* CloseBraceToken */,
- 102 /* TrueKeyword */,
- 87 /* FalseKeyword */,
+ 103 /* TrueKeyword */,
+ 88 /* FalseKeyword */,
], function (token) { return token; }, function () { return true; });
function getNewEndOfLineState(scanner, token, lastOnTemplateStack) {
switch (token) {
@@ -97612,10 +98524,10 @@
return true;
}
switch (keyword2) {
- case 126 /* GetKeyword */:
- case 137 /* SetKeyword */:
- case 124 /* ConstructorKeyword */:
- case 116 /* StaticKeyword */:
+ case 127 /* GetKeyword */:
+ case 138 /* SetKeyword */:
+ case 125 /* ConstructorKeyword */:
+ case 117 /* StaticKeyword */:
return true; // Allow things like "public get", "public constructor" and "public static".
default:
return false; // Any other keyword following "public" is actually an identifier, not a real keyword.
@@ -97660,9 +98572,9 @@
case 30 /* GreaterThanToken */:
case 31 /* LessThanEqualsToken */:
case 32 /* GreaterThanEqualsToken */:
- case 94 /* InstanceOfKeyword */:
- case 93 /* InKeyword */:
- case 119 /* AsKeyword */:
+ case 95 /* InstanceOfKeyword */:
+ case 94 /* InKeyword */:
+ case 120 /* AsKeyword */:
case 33 /* EqualsEqualsToken */:
case 34 /* ExclamationEqualsToken */:
case 35 /* EqualsEqualsEqualsToken */:
@@ -97672,18 +98584,18 @@
case 50 /* BarToken */:
case 54 /* AmpersandAmpersandToken */:
case 55 /* BarBarToken */:
- case 70 /* BarEqualsToken */:
- case 69 /* AmpersandEqualsToken */:
- case 71 /* CaretEqualsToken */:
- case 66 /* LessThanLessThanEqualsToken */:
- case 67 /* GreaterThanGreaterThanEqualsToken */:
- case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
- case 60 /* PlusEqualsToken */:
- case 61 /* MinusEqualsToken */:
- case 62 /* AsteriskEqualsToken */:
- case 64 /* SlashEqualsToken */:
- case 65 /* PercentEqualsToken */:
- case 59 /* EqualsToken */:
+ case 71 /* BarEqualsToken */:
+ case 70 /* AmpersandEqualsToken */:
+ case 72 /* CaretEqualsToken */:
+ case 67 /* LessThanLessThanEqualsToken */:
+ case 68 /* GreaterThanGreaterThanEqualsToken */:
+ case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
+ case 61 /* PlusEqualsToken */:
+ case 62 /* MinusEqualsToken */:
+ case 63 /* AsteriskEqualsToken */:
+ case 65 /* SlashEqualsToken */:
+ case 66 /* PercentEqualsToken */:
+ case 60 /* EqualsToken */:
case 27 /* CommaToken */:
return true;
default:
@@ -97710,7 +98622,7 @@
else if (isBinaryExpressionOperatorToken(token) || isPrefixUnaryExpressionOperatorToken(token)) {
return 5 /* operator */;
}
- else if (token >= 18 /* FirstPunctuation */ && token <= 71 /* LastPunctuation */) {
+ else if (token >= 18 /* FirstPunctuation */ && token <= 72 /* LastPunctuation */) {
return 10 /* punctuation */;
}
switch (token) {
@@ -97729,7 +98641,7 @@
case 5 /* WhitespaceTrivia */:
case 4 /* NewLineTrivia */:
return 8 /* whiteSpace */;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
default:
if (ts.isTemplateLiteralKind(token)) {
return 6 /* stringLiteral */;
@@ -97754,10 +98666,10 @@
// That means we're calling back into the host around every 1.2k of the file we process.
// Lib.d.ts has similar numbers.
switch (kind) {
- case 244 /* ModuleDeclaration */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 239 /* FunctionDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 240 /* FunctionDeclaration */:
cancellationToken.throwIfCancellationRequested();
}
}
@@ -97877,8 +98789,8 @@
var spanStart = span.start;
var spanLength = span.length;
// Make a scanner we can get trivia from.
- var triviaScanner = ts.createScanner(7 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
- var mergeConflictScanner = ts.createScanner(7 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
+ var triviaScanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
+ var mergeConflictScanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false, sourceFile.languageVariant, sourceFile.text);
var result = [];
processElement(sourceFile);
return { spans: result, endOfLineState: 0 /* None */ };
@@ -97970,18 +98882,18 @@
pushClassification(tag.tagName.pos, tag.tagName.end - tag.tagName.pos, 18 /* docCommentTagName */); // e.g. "param"
pos = tag.tagName.end;
switch (tag.kind) {
- case 304 /* JSDocParameterTag */:
+ case 305 /* JSDocParameterTag */:
processJSDocParameterTag(tag);
break;
- case 308 /* JSDocTemplateTag */:
+ case 309 /* JSDocTemplateTag */:
processJSDocTemplateTag(tag);
pos = tag.end;
break;
- case 307 /* JSDocTypeTag */:
+ case 308 /* JSDocTypeTag */:
processElement(tag.typeExpression);
pos = tag.end;
break;
- case 305 /* JSDocReturnTag */:
+ case 306 /* JSDocReturnTag */:
processElement(tag.typeExpression);
pos = tag.end;
break;
@@ -98068,22 +98980,22 @@
}
function tryClassifyJsxElementName(token) {
switch (token.parent && token.parent.kind) {
- case 262 /* JsxOpeningElement */:
+ case 263 /* JsxOpeningElement */:
if (token.parent.tagName === token) {
return 19 /* jsxOpenTagName */;
}
break;
- case 263 /* JsxClosingElement */:
+ case 264 /* JsxClosingElement */:
if (token.parent.tagName === token) {
return 20 /* jsxCloseTagName */;
}
break;
- case 261 /* JsxSelfClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
if (token.parent.tagName === token) {
return 21 /* jsxSelfClosingTagName */;
}
break;
- case 267 /* JsxAttribute */:
+ case 268 /* JsxAttribute */:
if (token.parent.name === token) {
return 22 /* jsxAttribute */;
}
@@ -98110,19 +99022,19 @@
if (ts.isPunctuation(tokenKind)) {
if (token) {
var parent = token.parent;
- if (tokenKind === 59 /* EqualsToken */) {
+ if (tokenKind === 60 /* EqualsToken */) {
// the '=' in a variable declaration is special cased here.
- if (parent.kind === 237 /* VariableDeclaration */ ||
- parent.kind === 154 /* PropertyDeclaration */ ||
- parent.kind === 151 /* Parameter */ ||
- parent.kind === 267 /* JsxAttribute */) {
+ if (parent.kind === 238 /* VariableDeclaration */ ||
+ parent.kind === 155 /* PropertyDeclaration */ ||
+ parent.kind === 152 /* Parameter */ ||
+ parent.kind === 268 /* JsxAttribute */) {
return 5 /* operator */;
}
}
- if (parent.kind === 204 /* BinaryExpression */ ||
- parent.kind === 202 /* PrefixUnaryExpression */ ||
- parent.kind === 203 /* PostfixUnaryExpression */ ||
- parent.kind === 205 /* ConditionalExpression */) {
+ if (parent.kind === 205 /* BinaryExpression */ ||
+ parent.kind === 203 /* PrefixUnaryExpression */ ||
+ parent.kind === 204 /* PostfixUnaryExpression */ ||
+ parent.kind === 206 /* ConditionalExpression */) {
return 5 /* operator */;
}
}
@@ -98136,7 +99048,7 @@
}
else if (tokenKind === 10 /* StringLiteral */) {
// TODO: GH#18217
- return token.parent.kind === 267 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */;
+ return token.parent.kind === 268 /* JsxAttribute */ ? 24 /* jsxAttributeStringLiteralValue */ : 6 /* stringLiteral */;
}
else if (tokenKind === 13 /* RegularExpressionLiteral */) {
// TODO: we should get another classification type for these literals.
@@ -98149,35 +99061,35 @@
else if (tokenKind === 11 /* JsxText */) {
return 23 /* jsxText */;
}
- else if (tokenKind === 72 /* Identifier */) {
+ else if (tokenKind === 73 /* Identifier */) {
if (token) {
switch (token.parent.kind) {
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
if (token.parent.name === token) {
return 11 /* className */;
}
return;
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
if (token.parent.name === token) {
return 15 /* typeParameterName */;
}
return;
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
if (token.parent.name === token) {
return 13 /* interfaceName */;
}
return;
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
if (token.parent.name === token) {
return 12 /* enumName */;
}
return;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
if (token.parent.name === token) {
return 14 /* moduleName */;
}
return;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
if (token.parent.name === token) {
return ts.isThisIdentifier(token) ? 3 /* keyword */ : 17 /* parameterName */;
}
@@ -98234,7 +99146,7 @@
return convertPathCompletions(completion.paths);
case 1 /* Properties */: {
var entries = [];
- Completions.getCompletionEntriesFromSymbols(completion.symbols, entries, sourceFile, sourceFile, checker, 7 /* ESNext */, log, 4 /* String */, preferences); // Target will not be used, so arbitrary
+ Completions.getCompletionEntriesFromSymbols(completion.symbols, entries, sourceFile, sourceFile, checker, 8 /* ESNext */, log, 4 /* String */, preferences); // Target will not be used, so arbitrary
return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: completion.hasIndexSignature, entries: entries };
}
case 2 /* Types */: {
@@ -98273,7 +99185,7 @@
var isNewIdentifierLocation = true; // The user may type in a path that doesn't yet exist, creating a "new identifier" with respect to the collection of identifiers the server is aware of.
var entries = pathCompletions.map(function (_a) {
var name = _a.name, kind = _a.kind, span = _a.span, extension = _a.extension;
- return ({ name: name, kind: kind, kindModifiers: kindModifiersFromExtension(extension), sortText: "0", replacementSpan: span });
+ return ({ name: name, kind: kind, kindModifiers: kindModifiersFromExtension(extension), sortText: Completions.SortText.LocationPriority, replacementSpan: span });
});
return { isGlobalCompletion: isGlobalCompletion, isMemberCompletion: false, isNewIdentifierLocation: isNewIdentifierLocation, entries: entries };
}
@@ -98300,11 +99212,11 @@
function getStringLiteralCompletionEntries(sourceFile, node, position, typeChecker, compilerOptions, host) {
var parent = node.parent;
switch (parent.kind) {
- case 182 /* LiteralType */:
+ case 183 /* LiteralType */:
switch (parent.parent.kind) {
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return { kind: 2 /* Types */, types: getStringLiteralTypes(typeChecker.getTypeArgumentConstraint(parent)), isNewIdentifier: false };
- case 180 /* IndexedAccessType */:
+ case 181 /* IndexedAccessType */:
// Get all apparent property names
// i.e. interface Foo {
// foo: string;
@@ -98312,9 +99224,9 @@
// }
// let x: Foo["/*completion position*/"]
return stringLiteralCompletionsFromProperties(typeChecker.getTypeFromTypeNode(parent.parent.objectType));
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return { kind: 0 /* Paths */, paths: getStringLiteralCompletionsFromModuleNames(sourceFile, node, compilerOptions, host, typeChecker) };
- case 173 /* UnionType */: {
+ case 174 /* UnionType */: {
if (!ts.isTypeReferenceNode(parent.parent.parent))
return undefined;
var alreadyUsedTypes_1 = getAlreadyUsedTypesInStringLiteralUnion(parent.parent, parent);
@@ -98324,7 +99236,7 @@
default:
return undefined;
}
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
if (ts.isObjectLiteralExpression(parent.parent) && parent.name === node) {
// Get quoted name of properties of the object literal expression
// i.e. interface ConfigFiles {
@@ -98341,7 +99253,7 @@
return stringLiteralCompletionsFromProperties(typeChecker.getContextualType(parent.parent));
}
return fromContextualType();
- case 190 /* ElementAccessExpression */: {
+ case 191 /* ElementAccessExpression */: {
var _a = parent, expression = _a.expression, argumentExpression = _a.argumentExpression;
if (node === argumentExpression) {
// Get all names of properties on the expression
@@ -98354,8 +99266,8 @@
}
return undefined;
}
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
if (!ts.isRequireCall(parent, /*checkArgumentIsStringLiteralLike*/ false) && !ts.isImportCall(parent)) {
var argumentInfo = ts.SignatureHelp.getArgumentInfoForCompletions(node, position, sourceFile);
// Get string literal completions from specialized signatures of the target
@@ -98364,9 +99276,9 @@
return argumentInfo ? getStringLiteralCompletionsFromSignature(argumentInfo, typeChecker) : fromContextualType();
}
// falls through (is `require("")` or `import("")`)
- case 249 /* ImportDeclaration */:
- case 255 /* ExportDeclaration */:
- case 259 /* ExternalModuleReference */:
+ case 250 /* ImportDeclaration */:
+ case 256 /* ExportDeclaration */:
+ case 260 /* ExternalModuleReference */:
// Get all known external module names or complete a path to a module
// i.e. import * as ns from "/*completion position*/";
// var y = import("/*completion position*/");
@@ -98813,7 +99725,7 @@
var offset = index !== -1 ? index + 1 : 0;
// If the range is an identifier, span is unnecessary.
var length = text.length - offset;
- return length === 0 || ts.isIdentifierText(text.substr(offset, length), 7 /* ESNext */) ? undefined : ts.createTextSpan(textStart + offset, length);
+ return length === 0 || ts.isIdentifierText(text.substr(offset, length), 8 /* ESNext */) ? undefined : ts.createTextSpan(textStart + offset, length);
}
// Returns true if the path is explicitly relative to the script (i.e. relative to . or ..)
function isPathRelativeToScript(path) {
@@ -98876,6 +99788,14 @@
(function (ts) {
var Completions;
(function (Completions) {
+ var SortText;
+ (function (SortText) {
+ SortText["LocationPriority"] = "0";
+ SortText["SuggestedClassMembers"] = "1";
+ SortText["GlobalsOrKeywords"] = "2";
+ SortText["AutoImportSuggestions"] = "3";
+ SortText["JavascriptIdentifiers"] = "4";
+ })(SortText = Completions.SortText || (Completions.SortText = {}));
var SymbolOriginInfoKind;
(function (SymbolOriginInfoKind) {
SymbolOriginInfoKind[SymbolOriginInfoKind["ThisType"] = 0] = "ThisType";
@@ -98910,14 +99830,15 @@
var typeChecker = program.getTypeChecker();
var compilerOptions = program.getCompilerOptions();
var contextToken = ts.findPrecedingToken(position, sourceFile);
- if (triggerCharacter && !isValidTrigger(sourceFile, triggerCharacter, contextToken, position))
+ if (triggerCharacter && !ts.isInString(sourceFile, position, contextToken) && !isValidTrigger(sourceFile, triggerCharacter, contextToken, position)) {
return undefined;
+ }
var stringCompletions = Completions.StringCompletions.getStringLiteralCompletions(sourceFile, position, contextToken, typeChecker, compilerOptions, host, log, preferences);
if (stringCompletions) {
return stringCompletions;
}
if (contextToken && ts.isBreakOrContinueStatement(contextToken.parent)
- && (contextToken.kind === 73 /* BreakKeyword */ || contextToken.kind === 78 /* ContinueKeyword */ || contextToken.kind === 72 /* Identifier */)) {
+ && (contextToken.kind === 74 /* BreakKeyword */ || contextToken.kind === 79 /* ContinueKeyword */ || contextToken.kind === 73 /* Identifier */)) {
return getLabelCompletionAtPosition(contextToken.parent);
}
var completionData = getCompletionData(program, log, sourceFile, isUncheckedFile(sourceFile, compilerOptions), position, preferences, /*detailsEntryId*/ undefined);
@@ -98944,7 +99865,7 @@
return { isGlobalCompletion: false, isMemberCompletion: false, isNewIdentifierLocation: false, entries: entries };
}
function completionInfoFromData(sourceFile, typeChecker, compilerOptions, log, completionData, preferences) {
- var symbols = completionData.symbols, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, insideJsDocTagTypeExpression = completionData.insideJsDocTagTypeExpression;
+ var symbols = completionData.symbols, completionKind = completionData.completionKind, isInSnippetScope = completionData.isInSnippetScope, isNewIdentifierLocation = completionData.isNewIdentifierLocation, location = completionData.location, propertyAccessToConvert = completionData.propertyAccessToConvert, keywordFilters = completionData.keywordFilters, literals = completionData.literals, symbolToOriginInfoMap = completionData.symbolToOriginInfoMap, recommendedCompletion = completionData.recommendedCompletion, isJsxInitializer = completionData.isJsxInitializer, insideJsDocTagTypeExpression = completionData.insideJsDocTagTypeExpression, symbolToSortTextMap = completionData.symbolToSortTextMap;
if (location && location.parent && ts.isJsxClosingElement(location.parent)) {
// In the TypeScript JSX element, if such element is not defined. When users query for completion at closing tag,
// instead of simply giving unknown value, the completion will return the tag-name of an associated opening-element.
@@ -98958,20 +99879,20 @@
name: tagName.getFullText(sourceFile) + (hasClosingAngleBracket ? "" : ">"),
kind: "class" /* classElement */,
kindModifiers: undefined,
- sortText: "0",
+ sortText: SortText.LocationPriority,
};
return { isGlobalCompletion: false, isMemberCompletion: true, isNewIdentifierLocation: false, entries: [entry] };
}
var entries = [];
if (isUncheckedFile(sourceFile, compilerOptions)) {
- var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, sourceFile, typeChecker, compilerOptions.target, log, completionKind, preferences, propertyAccessToConvert, isJsxInitializer, recommendedCompletion, symbolToOriginInfoMap);
+ var uniqueNames = getCompletionEntriesFromSymbols(symbols, entries, location, sourceFile, typeChecker, compilerOptions.target, log, completionKind, preferences, propertyAccessToConvert, isJsxInitializer, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap);
getJSCompletionEntries(sourceFile, location.pos, uniqueNames, compilerOptions.target, entries); // TODO: GH#18217
}
else {
if (!isNewIdentifierLocation && (!symbols || symbols.length === 0) && keywordFilters === 0 /* None */) {
return undefined;
}
- getCompletionEntriesFromSymbols(symbols, entries, location, sourceFile, typeChecker, compilerOptions.target, log, completionKind, preferences, propertyAccessToConvert, isJsxInitializer, recommendedCompletion, symbolToOriginInfoMap);
+ getCompletionEntriesFromSymbols(symbols, entries, location, sourceFile, typeChecker, compilerOptions.target, log, completionKind, preferences, propertyAccessToConvert, isJsxInitializer, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap);
}
if (keywordFilters !== 0 /* None */) {
var entryNames = ts.arrayToSet(entries, function (e) { return e.name; });
@@ -99013,7 +99934,7 @@
name: realName,
kind: "warning" /* warning */,
kindModifiers: "",
- sortText: "1"
+ sortText: SortText.JavascriptIdentifiers
});
}
});
@@ -99022,14 +99943,9 @@
return typeof literal === "object" ? ts.pseudoBigIntToString(literal) + "n" : JSON.stringify(literal);
};
function createCompletionEntryForLiteral(literal) {
- return { name: completionNameForLiteral(literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: "0" };
+ return { name: completionNameForLiteral(literal), kind: "string" /* string */, kindModifiers: "" /* none */, sortText: SortText.LocationPriority };
}
- function createCompletionEntry(symbol, location, sourceFile, typeChecker, target, kind, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, preferences) {
- var info = getCompletionEntryDisplayNameForSymbol(symbol, target, origin, kind);
- if (!info) {
- return undefined;
- }
- var name = info.name, needsConvertPropertyAccess = info.needsConvertPropertyAccess;
+ function createCompletionEntry(symbol, sortText, location, sourceFile, typeChecker, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, preferences) {
var insertText;
var replacementSpan;
if (origin && origin.kind === 0 /* ThisType */) {
@@ -99066,7 +99982,7 @@
name: name,
kind: ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, location),
kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol),
- sortText: "0",
+ sortText: sortText,
source: getSourceFromOrigin(origin),
hasAction: trueOrUndefined(!!origin && originIsExport(origin)),
isRecommended: trueOrUndefined(isRecommendedCompletionMatch(symbol, recommendedCompletion, typeChecker)),
@@ -99084,7 +100000,7 @@
function getSourceFromOrigin(origin) {
return origin && originIsExport(origin) ? ts.stripQuotes(origin.moduleSymbol.name) : undefined;
}
- function getCompletionEntriesFromSymbols(symbols, entries, location, sourceFile, typeChecker, target, log, kind, preferences, propertyAccessToConvert, isJsxInitializer, recommendedCompletion, symbolToOriginInfoMap) {
+ function getCompletionEntriesFromSymbols(symbols, entries, location, sourceFile, typeChecker, target, log, kind, preferences, propertyAccessToConvert, isJsxInitializer, recommendedCompletion, symbolToOriginInfoMap, symbolToSortTextMap) {
var start = ts.timestamp();
// Tracks unique names.
// We don't set this for global variables or completions from external module exports, because we can have multiple of those.
@@ -99094,14 +100010,18 @@
for (var _i = 0, symbols_1 = symbols; _i < symbols_1.length; _i++) {
var symbol = symbols_1[_i];
var origin = symbolToOriginInfoMap ? symbolToOriginInfoMap[ts.getSymbolId(symbol)] : undefined;
- var entry = createCompletionEntry(symbol, location, sourceFile, typeChecker, target, kind, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, preferences);
- if (!entry) {
+ var info = getCompletionEntryDisplayNameForSymbol(symbol, target, origin, kind);
+ if (!info) {
continue;
}
- var name = entry.name;
+ var name = info.name, needsConvertPropertyAccess = info.needsConvertPropertyAccess;
if (uniques.has(name)) {
continue;
}
+ var entry = createCompletionEntry(symbol, symbolToSortTextMap && symbolToSortTextMap[ts.getSymbolId(symbol)] || SortText.LocationPriority, location, sourceFile, typeChecker, name, needsConvertPropertyAccess, origin, recommendedCompletion, propertyAccessToConvert, isJsxInitializer, preferences);
+ if (!entry) {
+ continue;
+ }
// Latter case tests whether this is a global variable.
if (!origin && !(symbol.parent === undefined && !ts.some(symbol.declarations, function (d) { return d.getSourceFile() === location.getSourceFile(); }))) { // TODO: GH#18217
uniques.set(name, true);
@@ -99134,7 +100054,7 @@
name: name,
kindModifiers: "" /* none */,
kind: "label" /* label */,
- sortText: "0"
+ sortText: SortText.LocationPriority
});
}
}
@@ -99274,25 +100194,25 @@
function getContextualType(previousToken, position, sourceFile, checker) {
var parent = previousToken.parent;
switch (previousToken.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return ts.getContextualTypeFromParent(previousToken, checker);
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
switch (parent.kind) {
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return checker.getContextualType(parent.initializer); // TODO: GH#18217
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return checker.getTypeAtLocation(parent.left);
- case 267 /* JsxAttribute */:
+ case 268 /* JsxAttribute */:
return checker.getContextualTypeForJsxAttribute(parent);
default:
return undefined;
}
- case 95 /* NewKeyword */:
+ case 96 /* NewKeyword */:
return checker.getContextualType(parent);
- case 74 /* CaseKeyword */:
+ case 75 /* CaseKeyword */:
return ts.getSwitchedType(ts.cast(parent, ts.isCaseClause), checker);
case 18 /* OpenBraceToken */:
- return ts.isJsxExpression(parent) && parent.parent.kind !== 260 /* JsxElement */ ? checker.getContextualTypeForJsxAttribute(parent.parent) : undefined;
+ return ts.isJsxExpression(parent) && parent.parent.kind !== 261 /* JsxElement */ ? checker.getContextualTypeForJsxAttribute(parent.parent) : undefined;
default:
var argInfo = ts.SignatureHelp.getArgumentInfoForCompletions(previousToken, position, sourceFile);
return argInfo
@@ -99311,7 +100231,7 @@
return symbol.parent && (isModuleSymbol(symbol.parent) ? symbol : getFirstSymbolInChain(symbol.parent, enclosingDeclaration, checker));
}
function isModuleSymbol(symbol) {
- return symbol.declarations.some(function (d) { return d.kind === 284 /* SourceFile */; });
+ return symbol.declarations.some(function (d) { return d.kind === 285 /* SourceFile */; });
}
function getCompletionData(program, log, sourceFile, isUncheckedFile, position, preferences, detailsEntryId) {
var typeChecker = program.getTypeChecker();
@@ -99362,11 +100282,11 @@
if (tag.tagName.pos <= position && position <= tag.tagName.end) {
return { kind: 1 /* JsDocTagName */ };
}
- if (isTagWithTypeExpression(tag) && tag.typeExpression && tag.typeExpression.kind === 288 /* JSDocTypeExpression */) {
+ if (isTagWithTypeExpression(tag) && tag.typeExpression && tag.typeExpression.kind === 289 /* JSDocTypeExpression */) {
currentToken = ts.getTokenAtPosition(sourceFile, position);
if (!currentToken ||
(!ts.isDeclarationName(currentToken) &&
- (currentToken.parent.kind !== 310 /* JSDocPropertyTag */ ||
+ (currentToken.parent.kind !== 311 /* JSDocPropertyTag */ ||
currentToken.parent.name !== currentToken))) {
// Use as type location if inside tag's type expression
insideJsDocTagTypeExpression = isCurrentlyEditingNode(tag.typeExpression);
@@ -99416,7 +100336,7 @@
if (contextToken.kind === 24 /* DotToken */) {
isRightOfDot = true;
switch (parent.kind) {
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
propertyAccessToConvert = parent;
node = propertyAccessToConvert.expression;
if (node.end === contextToken.pos &&
@@ -99428,14 +100348,14 @@
return undefined;
}
break;
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
node = parent.left;
break;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
node = parent.name;
break;
- case 183 /* ImportType */:
- case 214 /* MetaProperty */:
+ case 184 /* ImportType */:
+ case 215 /* MetaProperty */:
node = parent;
break;
default:
@@ -99448,7 +100368,7 @@
// <UI.Test /* completion position */ />
// If the tagname is a property access expression, we will then walk up to the top most of property access expression.
// Then, try to get a JSX container and its associated attributes type.
- if (parent && parent.kind === 189 /* PropertyAccessExpression */) {
+ if (parent && parent.kind === 190 /* PropertyAccessExpression */) {
contextToken = parent;
parent = parent.parent;
}
@@ -99456,48 +100376,48 @@
if (currentToken.parent === location) {
switch (currentToken.kind) {
case 30 /* GreaterThanToken */:
- if (currentToken.parent.kind === 260 /* JsxElement */ || currentToken.parent.kind === 262 /* JsxOpeningElement */) {
+ if (currentToken.parent.kind === 261 /* JsxElement */ || currentToken.parent.kind === 263 /* JsxOpeningElement */) {
location = currentToken;
}
break;
case 42 /* SlashToken */:
- if (currentToken.parent.kind === 261 /* JsxSelfClosingElement */) {
+ if (currentToken.parent.kind === 262 /* JsxSelfClosingElement */) {
location = currentToken;
}
break;
}
}
switch (parent.kind) {
- case 263 /* JsxClosingElement */:
+ case 264 /* JsxClosingElement */:
if (contextToken.kind === 42 /* SlashToken */) {
isStartingCloseTag = true;
location = contextToken;
}
break;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
if (!binaryExpressionMayBeOpenTag(parent)) {
break;
}
// falls through
- case 261 /* JsxSelfClosingElement */:
- case 260 /* JsxElement */:
- case 262 /* JsxOpeningElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 261 /* JsxElement */:
+ case 263 /* JsxOpeningElement */:
if (contextToken.kind === 28 /* LessThanToken */) {
isRightOfOpenTag = true;
location = contextToken;
}
break;
- case 267 /* JsxAttribute */:
+ case 268 /* JsxAttribute */:
switch (previousToken.kind) {
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
isJsxInitializer = true;
break;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
// For `<div x=[|f/**/|]`, `parent` will be `x` and `previousToken.parent` will be `f` (which is its own JsxAttribute)
// Note for `<div someBool f>` we don't want to treat this as a jsx inializer, instead it's the attribute name.
if (parent !== previousToken.parent &&
!parent.initializer &&
- ts.findChildOfKind(parent, 59 /* EqualsToken */, sourceFile)) {
+ ts.findChildOfKind(parent, 60 /* EqualsToken */, sourceFile)) {
isJsxInitializer = previousToken;
}
}
@@ -99511,6 +100431,7 @@
var keywordFilters = 0 /* None */;
var symbols = [];
var symbolToOriginInfoMap = [];
+ var symbolToSortTextMap = [];
if (isRightOfDot) {
getTypeScriptMemberSymbols();
}
@@ -99556,15 +100477,16 @@
recommendedCompletion: recommendedCompletion,
previousToken: previousToken,
isJsxInitializer: isJsxInitializer,
- insideJsDocTagTypeExpression: insideJsDocTagTypeExpression
+ insideJsDocTagTypeExpression: insideJsDocTagTypeExpression,
+ symbolToSortTextMap: symbolToSortTextMap
};
function isTagWithTypeExpression(tag) {
switch (tag.kind) {
- case 304 /* JSDocParameterTag */:
- case 310 /* JSDocPropertyTag */:
- case 305 /* JSDocReturnTag */:
- case 307 /* JSDocTypeTag */:
- case 309 /* JSDocTypedefTag */:
+ case 305 /* JSDocParameterTag */:
+ case 311 /* JSDocPropertyTag */:
+ case 306 /* JSDocReturnTag */:
+ case 308 /* JSDocTypeTag */:
+ case 310 /* JSDocTypedefTag */:
return true;
default:
return false;
@@ -99606,15 +100528,15 @@
// If the module is merged with a value, we must get the type of the class and add its propertes (for inherited static methods).
if (!isTypeLocation &&
symbol.declarations &&
- symbol.declarations.some(function (d) { return d.kind !== 284 /* SourceFile */ && d.kind !== 244 /* ModuleDeclaration */ && d.kind !== 243 /* EnumDeclaration */; })) {
+ symbol.declarations.some(function (d) { return d.kind !== 285 /* SourceFile */ && d.kind !== 245 /* ModuleDeclaration */ && d.kind !== 244 /* EnumDeclaration */; })) {
addTypeProperties(typeChecker.getTypeOfSymbolAtLocation(symbol, node));
}
return;
}
}
}
- if (ts.isMetaProperty(node) && (node.keywordToken === 95 /* NewKeyword */ || node.keywordToken === 92 /* ImportKeyword */)) {
- var completion = (node.keywordToken === 95 /* NewKeyword */) ? "target" : "meta";
+ if (ts.isMetaProperty(node) && (node.keywordToken === 96 /* NewKeyword */ || node.keywordToken === 93 /* ImportKeyword */)) {
+ var completion = (node.keywordToken === 96 /* NewKeyword */) ? "target" : "meta";
symbols.push(typeChecker.createSymbol(4 /* Property */, ts.escapeLeadingUnderscores(completion)));
return;
}
@@ -99635,7 +100557,7 @@
else {
for (var _i = 0, _a = type.getApparentProperties(); _i < _a.length; _i++) {
var symbol = _a[_i];
- if (typeChecker.isValidPropertyAccessForCompletions(node.kind === 183 /* ImportType */ ? node : node.parent, type, symbol)) {
+ if (typeChecker.isValidPropertyAccessForCompletions(node.kind === 184 /* ImportType */ ? node : node.parent, type, symbol)) {
addPropertySymbol(symbol);
}
}
@@ -99738,14 +100660,22 @@
var isTypeOnly = isTypeOnlyCompletion();
var symbolMeanings = (isTypeOnly ? 0 /* None */ : 67220415 /* Value */) | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */;
symbols = ts.Debug.assertEachDefined(typeChecker.getSymbolsInScope(scopeNode, symbolMeanings), "getSymbolsInScope() should all be defined");
+ for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) {
+ var symbol = symbols_2[_i];
+ if (!typeChecker.isArgumentsSymbol(symbol) &&
+ !ts.some(symbol.declarations, function (d) { return d.getSourceFile() === sourceFile; })) {
+ symbolToSortTextMap[ts.getSymbolId(symbol)] = SortText.GlobalsOrKeywords;
+ }
+ }
// Need to insert 'this.' before properties of `this` type, so only do that if `includeInsertTextCompletions`
- if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 284 /* SourceFile */) {
+ if (preferences.includeCompletionsWithInsertText && scopeNode.kind !== 285 /* SourceFile */) {
var thisType = typeChecker.tryGetThisTypeAt(scopeNode, /*includeGlobalThis*/ false);
if (thisType) {
- for (var _i = 0, _a = getPropertiesForCompletion(thisType, typeChecker); _i < _a.length; _i++) {
- var symbol = _a[_i];
+ for (var _a = 0, _b = getPropertiesForCompletion(thisType, typeChecker); _a < _b.length; _a++) {
+ var symbol = _b[_a];
symbolToOriginInfoMap[ts.getSymbolId(symbol)] = { kind: 0 /* ThisType */ };
symbols.push(symbol);
+ symbolToSortTextMap[ts.getSymbolId(symbol)] = SortText.SuggestedClassMembers;
}
}
}
@@ -99772,10 +100702,10 @@
}
function isSnippetScope(scopeNode) {
switch (scopeNode.kind) {
- case 284 /* SourceFile */:
- case 206 /* TemplateExpression */:
- case 270 /* JsxExpression */:
- case 218 /* Block */:
+ case 285 /* SourceFile */:
+ case 207 /* TemplateExpression */:
+ case 271 /* JsxExpression */:
+ case 219 /* Block */:
return true;
default:
return ts.isStatement(scopeNode);
@@ -99814,25 +100744,25 @@
}
function isContextTokenValueLocation(contextToken) {
return contextToken &&
- contextToken.kind === 104 /* TypeOfKeyword */ &&
- (contextToken.parent.kind === 167 /* TypeQuery */ || ts.isTypeOfExpression(contextToken.parent));
+ contextToken.kind === 105 /* TypeOfKeyword */ &&
+ (contextToken.parent.kind === 168 /* TypeQuery */ || ts.isTypeOfExpression(contextToken.parent));
}
function isContextTokenTypeLocation(contextToken) {
if (contextToken) {
var parentKind = contextToken.parent.kind;
switch (contextToken.kind) {
case 57 /* ColonToken */:
- return parentKind === 154 /* PropertyDeclaration */ ||
- parentKind === 153 /* PropertySignature */ ||
- parentKind === 151 /* Parameter */ ||
- parentKind === 237 /* VariableDeclaration */ ||
+ return parentKind === 155 /* PropertyDeclaration */ ||
+ parentKind === 154 /* PropertySignature */ ||
+ parentKind === 152 /* Parameter */ ||
+ parentKind === 238 /* VariableDeclaration */ ||
ts.isFunctionLikeKind(parentKind);
- case 59 /* EqualsToken */:
- return parentKind === 242 /* TypeAliasDeclaration */;
- case 119 /* AsKeyword */:
- return parentKind === 212 /* AsExpression */;
- case 86 /* ExtendsKeyword */:
- return parentKind === 150 /* TypeParameter */;
+ case 60 /* EqualsToken */:
+ return parentKind === 243 /* TypeAliasDeclaration */;
+ case 120 /* AsKeyword */:
+ return parentKind === 213 /* AsExpression */;
+ case 87 /* ExtendsKeyword */:
+ return parentKind === 151 /* TypeParameter */;
}
}
return false;
@@ -99864,6 +100794,7 @@
// So in `declare namespace foo {} declare module "foo" { export = foo; }`, there will just be the global completion for `foo`.
ts.some(resolvedModuleSymbol.declarations, function (d) { return !!d.getSourceFile().externalModuleIndicator; })) {
symbols.push(resolvedModuleSymbol);
+ symbolToSortTextMap[ts.getSymbolId(resolvedModuleSymbol)] = SortText.AutoImportSuggestions;
symbolToOriginInfoMap[ts.getSymbolId(resolvedModuleSymbol)] = { kind: 3 /* Export */, moduleSymbol: moduleSymbol, isDefaultExport: false };
}
for (var _i = 0, _a = typeChecker.getExportsOfModule(moduleSymbol); _i < _a.length; _i++) {
@@ -99888,6 +100819,7 @@
var origin = { kind: 3 /* Export */, moduleSymbol: moduleSymbol, isDefaultExport: isDefaultExport };
if (detailsEntryId || stringContainsCharactersInOrder(getSymbolName(symbol, origin, target).toLowerCase(), tokenTextLowerCase)) {
symbols.push(symbol);
+ symbolToSortTextMap[ts.getSymbolId(symbol)] = SortText.AutoImportSuggestions;
symbolToOriginInfoMap[ts.getSymbolId(symbol)] = origin;
}
}
@@ -99939,11 +100871,11 @@
return true;
}
if (contextToken.kind === 30 /* GreaterThanToken */ && contextToken.parent) {
- if (contextToken.parent.kind === 262 /* JsxOpeningElement */) {
+ if (contextToken.parent.kind === 263 /* JsxOpeningElement */) {
return true;
}
- if (contextToken.parent.kind === 263 /* JsxClosingElement */ || contextToken.parent.kind === 261 /* JsxSelfClosingElement */) {
- return !!contextToken.parent.parent && contextToken.parent.parent.kind === 260 /* JsxElement */;
+ if (contextToken.parent.kind === 264 /* JsxClosingElement */ || contextToken.parent.kind === 262 /* JsxSelfClosingElement */) {
+ return !!contextToken.parent.parent && contextToken.parent.parent.kind === 261 /* JsxElement */;
}
}
return false;
@@ -99954,40 +100886,40 @@
// Previous token may have been a keyword that was converted to an identifier.
switch (keywordForNode(previousToken)) {
case 27 /* CommaToken */:
- return containingNodeKind === 191 /* CallExpression */ // func( a, |
- || containingNodeKind === 157 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */
- || containingNodeKind === 192 /* NewExpression */ // new C(a, |
- || containingNodeKind === 187 /* ArrayLiteralExpression */ // [a, |
- || containingNodeKind === 204 /* BinaryExpression */ // const x = (a, |
- || containingNodeKind === 165 /* FunctionType */; // var x: (s: string, list|
+ return containingNodeKind === 192 /* CallExpression */ // func( a, |
+ || containingNodeKind === 158 /* Constructor */ // constructor( a, | /* public, protected, private keywords are allowed here, so show completion */
+ || containingNodeKind === 193 /* NewExpression */ // new C(a, |
+ || containingNodeKind === 188 /* ArrayLiteralExpression */ // [a, |
+ || containingNodeKind === 205 /* BinaryExpression */ // const x = (a, |
+ || containingNodeKind === 166 /* FunctionType */; // var x: (s: string, list|
case 20 /* OpenParenToken */:
- return containingNodeKind === 191 /* CallExpression */ // func( |
- || containingNodeKind === 157 /* Constructor */ // constructor( |
- || containingNodeKind === 192 /* NewExpression */ // new C(a|
- || containingNodeKind === 195 /* ParenthesizedExpression */ // const x = (a|
- || containingNodeKind === 177 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */
+ return containingNodeKind === 192 /* CallExpression */ // func( |
+ || containingNodeKind === 158 /* Constructor */ // constructor( |
+ || containingNodeKind === 193 /* NewExpression */ // new C(a|
+ || containingNodeKind === 196 /* ParenthesizedExpression */ // const x = (a|
+ || containingNodeKind === 178 /* ParenthesizedType */; // function F(pred: (a| /* this can become an arrow function, where 'a' is the argument */
case 22 /* OpenBracketToken */:
- return containingNodeKind === 187 /* ArrayLiteralExpression */ // [ |
- || containingNodeKind === 162 /* IndexSignature */ // [ | : string ]
- || containingNodeKind === 149 /* ComputedPropertyName */; // [ | /* this can become an index signature */
- case 130 /* ModuleKeyword */: // module |
- case 131 /* NamespaceKeyword */: // namespace |
+ return containingNodeKind === 188 /* ArrayLiteralExpression */ // [ |
+ || containingNodeKind === 163 /* IndexSignature */ // [ | : string ]
+ || containingNodeKind === 150 /* ComputedPropertyName */; // [ | /* this can become an index signature */
+ case 131 /* ModuleKeyword */: // module |
+ case 132 /* NamespaceKeyword */: // namespace |
return true;
case 24 /* DotToken */:
- return containingNodeKind === 244 /* ModuleDeclaration */; // module A.|
+ return containingNodeKind === 245 /* ModuleDeclaration */; // module A.|
case 18 /* OpenBraceToken */:
- return containingNodeKind === 240 /* ClassDeclaration */; // class A{ |
- case 59 /* EqualsToken */:
- return containingNodeKind === 237 /* VariableDeclaration */ // const x = a|
- || containingNodeKind === 204 /* BinaryExpression */; // x = a|
+ return containingNodeKind === 241 /* ClassDeclaration */; // class A{ |
+ case 60 /* EqualsToken */:
+ return containingNodeKind === 238 /* VariableDeclaration */ // const x = a|
+ || containingNodeKind === 205 /* BinaryExpression */; // x = a|
case 15 /* TemplateHead */:
- return containingNodeKind === 206 /* TemplateExpression */; // `aa ${|
+ return containingNodeKind === 207 /* TemplateExpression */; // `aa ${|
case 16 /* TemplateMiddle */:
- return containingNodeKind === 216 /* TemplateSpan */; // `aa ${10} dd ${|
- case 115 /* PublicKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- return containingNodeKind === 154 /* PropertyDeclaration */; // class A{ public |
+ return containingNodeKind === 217 /* TemplateSpan */; // `aa ${10} dd ${|
+ case 116 /* PublicKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ return containingNodeKind === 155 /* PropertyDeclaration */; // class A{ public |
}
}
return false;
@@ -100014,7 +100946,7 @@
completionKind = 0 /* ObjectPropertyDeclaration */;
var typeMembers;
var existingMembers;
- if (objectLikeContainer.kind === 188 /* ObjectLiteralExpression */) {
+ if (objectLikeContainer.kind === 189 /* ObjectLiteralExpression */) {
var typeForObject = typeChecker.getContextualType(objectLikeContainer);
if (!typeForObject)
return 2 /* Fail */;
@@ -100023,7 +100955,7 @@
existingMembers = objectLikeContainer.properties;
}
else {
- ts.Debug.assert(objectLikeContainer.kind === 184 /* ObjectBindingPattern */);
+ ts.Debug.assert(objectLikeContainer.kind === 185 /* ObjectBindingPattern */);
// We are *only* completing on properties from the type being destructured.
isNewIdentifierLocation = false;
var rootDeclaration = ts.getRootDeclaration(objectLikeContainer.parent);
@@ -100034,12 +100966,12 @@
// through type declaration or inference.
// Also proceed if rootDeclaration is a parameter and if its containing function expression/arrow function is contextually typed -
// type of parameter will flow in from the contextual type of the function
- var canGetType = ts.hasInitializer(rootDeclaration) || ts.hasType(rootDeclaration) || rootDeclaration.parent.parent.kind === 227 /* ForOfStatement */;
- if (!canGetType && rootDeclaration.kind === 151 /* Parameter */) {
+ var canGetType = ts.hasInitializer(rootDeclaration) || ts.hasType(rootDeclaration) || rootDeclaration.parent.parent.kind === 228 /* ForOfStatement */;
+ if (!canGetType && rootDeclaration.kind === 152 /* Parameter */) {
if (ts.isExpression(rootDeclaration.parent)) {
canGetType = !!typeChecker.getContextualType(rootDeclaration.parent);
}
- else if (rootDeclaration.parent.kind === 156 /* MethodDeclaration */ || rootDeclaration.parent.kind === 159 /* SetAccessor */) {
+ else if (rootDeclaration.parent.kind === 157 /* MethodDeclaration */ || rootDeclaration.parent.kind === 160 /* SetAccessor */) {
canGetType = ts.isExpression(rootDeclaration.parent.parent) && !!typeChecker.getContextualType(rootDeclaration.parent.parent);
}
}
@@ -100081,7 +101013,7 @@
return 0 /* Continue */;
// cursor is in an import clause
// try to show exported member for imported module
- var moduleSpecifier = (namedImportsOrExports.kind === 252 /* NamedImports */ ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent).moduleSpecifier;
+ var moduleSpecifier = (namedImportsOrExports.kind === 253 /* NamedImports */ ? namedImportsOrExports.parent.parent : namedImportsOrExports.parent).moduleSpecifier;
var moduleSpecifierSymbol = typeChecker.getSymbolAtLocation(moduleSpecifier); // TODO: GH#18217
if (!moduleSpecifierSymbol)
return 2 /* Fail */;
@@ -100112,7 +101044,7 @@
var classElement = contextToken.parent;
var classElementModifierFlags = ts.isClassElement(classElement) ? ts.getModifierFlags(classElement) : 0 /* None */;
// If this is context token is not something we are editing now, consider if this would lead to be modifier
- if (contextToken.kind === 72 /* Identifier */ && !isCurrentlyEditingNode(contextToken)) {
+ if (contextToken.kind === 73 /* Identifier */ && !isCurrentlyEditingNode(contextToken)) {
switch (contextToken.getText()) {
case "private":
classElementModifierFlags = classElementModifierFlags | 8 /* Private */;
@@ -100149,7 +101081,7 @@
break;
case 40 /* AsteriskToken */:
return ts.isMethodDeclaration(parent) ? ts.tryCast(parent.parent, ts.isObjectLiteralExpression) : undefined;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return contextToken.text === "async" && ts.isShorthandPropertyAssignment(contextToken.parent)
? contextToken.parent.parent : undefined;
}
@@ -100202,12 +101134,12 @@
case 30 /* GreaterThanToken */: // End of a type argument list
case 29 /* LessThanSlashToken */:
case 42 /* SlashToken */:
- case 72 /* Identifier */:
- case 189 /* PropertyAccessExpression */:
- case 268 /* JsxAttributes */:
- case 267 /* JsxAttribute */:
- case 269 /* JsxSpreadAttribute */:
- if (parent && (parent.kind === 261 /* JsxSelfClosingElement */ || parent.kind === 262 /* JsxOpeningElement */)) {
+ case 73 /* Identifier */:
+ case 190 /* PropertyAccessExpression */:
+ case 269 /* JsxAttributes */:
+ case 268 /* JsxAttribute */:
+ case 270 /* JsxSpreadAttribute */:
+ if (parent && (parent.kind === 262 /* JsxSelfClosingElement */ || parent.kind === 263 /* JsxOpeningElement */)) {
if (contextToken.kind === 30 /* GreaterThanToken */) {
var precedingToken = ts.findPrecedingToken(contextToken.pos, sourceFile, /*startNode*/ undefined);
if (!parent.typeArguments || (precedingToken && precedingToken.kind === 42 /* SlashToken */))
@@ -100215,7 +101147,7 @@
}
return parent;
}
- else if (parent.kind === 267 /* JsxAttribute */) {
+ else if (parent.kind === 268 /* JsxAttribute */) {
// Currently we parse JsxOpeningLikeElement as:
// JsxOpeningLikeElement
// attributes: JsxAttributes
@@ -100227,7 +101159,7 @@
// its parent is a JsxExpression, whose parent is a JsxAttribute,
// whose parent is a JsxOpeningLikeElement
case 10 /* StringLiteral */:
- if (parent && ((parent.kind === 267 /* JsxAttribute */) || (parent.kind === 269 /* JsxSpreadAttribute */))) {
+ if (parent && ((parent.kind === 268 /* JsxAttribute */) || (parent.kind === 270 /* JsxSpreadAttribute */))) {
// Currently we parse JsxOpeningLikeElement as:
// JsxOpeningLikeElement
// attributes: JsxAttributes
@@ -100237,8 +101169,8 @@
break;
case 19 /* CloseBraceToken */:
if (parent &&
- parent.kind === 270 /* JsxExpression */ &&
- parent.parent && parent.parent.kind === 267 /* JsxAttribute */) {
+ parent.kind === 271 /* JsxExpression */ &&
+ parent.parent && parent.parent.kind === 268 /* JsxAttribute */) {
// Currently we parse JsxOpeningLikeElement as:
// JsxOpeningLikeElement
// attributes: JsxAttributes
@@ -100246,7 +101178,7 @@
// each JsxAttribute can have initializer as JsxExpression
return parent.parent.parent.parent;
}
- if (parent && parent.kind === 269 /* JsxSpreadAttribute */) {
+ if (parent && parent.kind === 270 /* JsxSpreadAttribute */) {
// Currently we parse JsxOpeningLikeElement as:
// JsxOpeningLikeElement
// attributes: JsxAttributes
@@ -100266,62 +101198,62 @@
var containingNodeKind = parent.kind;
switch (contextToken.kind) {
case 27 /* CommaToken */:
- return containingNodeKind === 237 /* VariableDeclaration */ ||
- containingNodeKind === 238 /* VariableDeclarationList */ ||
- containingNodeKind === 219 /* VariableStatement */ ||
- containingNodeKind === 243 /* EnumDeclaration */ || // enum a { foo, |
+ return containingNodeKind === 238 /* VariableDeclaration */ ||
+ containingNodeKind === 239 /* VariableDeclarationList */ ||
+ containingNodeKind === 220 /* VariableStatement */ ||
+ containingNodeKind === 244 /* EnumDeclaration */ || // enum a { foo, |
isFunctionLikeButNotConstructor(containingNodeKind) ||
- containingNodeKind === 241 /* InterfaceDeclaration */ || // interface A<T, |
- containingNodeKind === 185 /* ArrayBindingPattern */ || // var [x, y|
- containingNodeKind === 242 /* TypeAliasDeclaration */ || // type Map, K, |
+ containingNodeKind === 242 /* InterfaceDeclaration */ || // interface A<T, |
+ containingNodeKind === 186 /* ArrayBindingPattern */ || // var [x, y|
+ containingNodeKind === 243 /* TypeAliasDeclaration */ || // type Map, K, |
// class A<T, |
// var C = class D<T, |
(ts.isClassLike(parent) &&
!!parent.typeParameters &&
parent.typeParameters.end >= contextToken.pos);
case 24 /* DotToken */:
- return containingNodeKind === 185 /* ArrayBindingPattern */; // var [.|
+ return containingNodeKind === 186 /* ArrayBindingPattern */; // var [.|
case 57 /* ColonToken */:
- return containingNodeKind === 186 /* BindingElement */; // var {x :html|
+ return containingNodeKind === 187 /* BindingElement */; // var {x :html|
case 22 /* OpenBracketToken */:
- return containingNodeKind === 185 /* ArrayBindingPattern */; // var [x|
+ return containingNodeKind === 186 /* ArrayBindingPattern */; // var [x|
case 20 /* OpenParenToken */:
- return containingNodeKind === 274 /* CatchClause */ ||
+ return containingNodeKind === 275 /* CatchClause */ ||
isFunctionLikeButNotConstructor(containingNodeKind);
case 18 /* OpenBraceToken */:
- return containingNodeKind === 243 /* EnumDeclaration */; // enum a { |
+ return containingNodeKind === 244 /* EnumDeclaration */; // enum a { |
case 28 /* LessThanToken */:
- return containingNodeKind === 240 /* ClassDeclaration */ || // class A< |
- containingNodeKind === 209 /* ClassExpression */ || // var C = class D< |
- containingNodeKind === 241 /* InterfaceDeclaration */ || // interface A< |
- containingNodeKind === 242 /* TypeAliasDeclaration */ || // type List< |
+ return containingNodeKind === 241 /* ClassDeclaration */ || // class A< |
+ containingNodeKind === 210 /* ClassExpression */ || // var C = class D< |
+ containingNodeKind === 242 /* InterfaceDeclaration */ || // interface A< |
+ containingNodeKind === 243 /* TypeAliasDeclaration */ || // type List< |
ts.isFunctionLikeKind(containingNodeKind);
- case 116 /* StaticKeyword */:
- return containingNodeKind === 154 /* PropertyDeclaration */ && !ts.isClassLike(parent.parent);
+ case 117 /* StaticKeyword */:
+ return containingNodeKind === 155 /* PropertyDeclaration */ && !ts.isClassLike(parent.parent);
case 25 /* DotDotDotToken */:
- return containingNodeKind === 151 /* Parameter */ ||
- (!!parent.parent && parent.parent.kind === 185 /* ArrayBindingPattern */); // var [...z|
- case 115 /* PublicKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- return containingNodeKind === 151 /* Parameter */ && !ts.isConstructorDeclaration(parent.parent);
- case 119 /* AsKeyword */:
- return containingNodeKind === 253 /* ImportSpecifier */ ||
- containingNodeKind === 257 /* ExportSpecifier */ ||
- containingNodeKind === 251 /* NamespaceImport */;
- case 126 /* GetKeyword */:
- case 137 /* SetKeyword */:
+ return containingNodeKind === 152 /* Parameter */ ||
+ (!!parent.parent && parent.parent.kind === 186 /* ArrayBindingPattern */); // var [...z|
+ case 116 /* PublicKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ return containingNodeKind === 152 /* Parameter */ && !ts.isConstructorDeclaration(parent.parent);
+ case 120 /* AsKeyword */:
+ return containingNodeKind === 254 /* ImportSpecifier */ ||
+ containingNodeKind === 258 /* ExportSpecifier */ ||
+ containingNodeKind === 252 /* NamespaceImport */;
+ case 127 /* GetKeyword */:
+ case 138 /* SetKeyword */:
return !isFromObjectTypeDeclaration(contextToken);
- case 76 /* ClassKeyword */:
- case 84 /* EnumKeyword */:
- case 110 /* InterfaceKeyword */:
- case 90 /* FunctionKeyword */:
- case 105 /* VarKeyword */:
- case 92 /* ImportKeyword */:
- case 111 /* LetKeyword */:
- case 77 /* ConstKeyword */:
- case 117 /* YieldKeyword */:
- case 140 /* TypeKeyword */: // type htm|
+ case 77 /* ClassKeyword */:
+ case 85 /* EnumKeyword */:
+ case 111 /* InterfaceKeyword */:
+ case 91 /* FunctionKeyword */:
+ case 106 /* VarKeyword */:
+ case 93 /* ImportKeyword */:
+ case 112 /* LetKeyword */:
+ case 78 /* ConstKeyword */:
+ case 118 /* YieldKeyword */:
+ case 141 /* TypeKeyword */: // type htm|
return true;
case 40 /* AsteriskToken */:
return ts.isFunctionLike(contextToken.parent) && !ts.isMethodDeclaration(contextToken.parent);
@@ -100344,22 +101276,22 @@
}
// Previous token may have been a keyword that was converted to an identifier.
switch (keywordForNode(contextToken)) {
- case 118 /* AbstractKeyword */:
- case 76 /* ClassKeyword */:
- case 77 /* ConstKeyword */:
- case 125 /* DeclareKeyword */:
- case 84 /* EnumKeyword */:
- case 90 /* FunctionKeyword */:
- case 110 /* InterfaceKeyword */:
- case 111 /* LetKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 115 /* PublicKeyword */:
- case 116 /* StaticKeyword */:
- case 105 /* VarKeyword */:
- case 117 /* YieldKeyword */:
+ case 119 /* AbstractKeyword */:
+ case 77 /* ClassKeyword */:
+ case 78 /* ConstKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 85 /* EnumKeyword */:
+ case 91 /* FunctionKeyword */:
+ case 111 /* InterfaceKeyword */:
+ case 112 /* LetKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 116 /* PublicKeyword */:
+ case 117 /* StaticKeyword */:
+ case 106 /* VarKeyword */:
+ case 118 /* YieldKeyword */:
return true;
- case 121 /* AsyncKeyword */:
+ case 122 /* AsyncKeyword */:
return ts.isPropertyDeclaration(contextToken.parent);
}
return ts.isDeclarationName(contextToken)
@@ -100369,7 +101301,7 @@
&& !(ts.isClassLike(contextToken.parent) && (contextToken !== previousToken || position > previousToken.end));
}
function isFunctionLikeButNotConstructor(kind) {
- return ts.isFunctionLikeKind(kind) && kind !== 157 /* Constructor */;
+ return ts.isFunctionLikeKind(kind) && kind !== 158 /* Constructor */;
}
function isDotOfNumericLiteral(contextToken) {
if (contextToken.kind === 8 /* NumericLiteral */) {
@@ -100392,12 +101324,12 @@
for (var _i = 0, existingMembers_1 = existingMembers; _i < existingMembers_1.length; _i++) {
var m = existingMembers_1[_i];
// Ignore omitted expressions for missing members
- if (m.kind !== 275 /* PropertyAssignment */ &&
- m.kind !== 276 /* ShorthandPropertyAssignment */ &&
- m.kind !== 186 /* BindingElement */ &&
- m.kind !== 156 /* MethodDeclaration */ &&
- m.kind !== 158 /* GetAccessor */ &&
- m.kind !== 159 /* SetAccessor */) {
+ if (m.kind !== 276 /* PropertyAssignment */ &&
+ m.kind !== 277 /* ShorthandPropertyAssignment */ &&
+ m.kind !== 187 /* BindingElement */ &&
+ m.kind !== 157 /* MethodDeclaration */ &&
+ m.kind !== 159 /* GetAccessor */ &&
+ m.kind !== 160 /* SetAccessor */) {
continue;
}
// If this is the current item we are editing right now, do not filter it out
@@ -100407,7 +101339,7 @@
var existingName = void 0;
if (ts.isBindingElement(m) && m.propertyName) {
// include only identifiers in completion list
- if (m.propertyName.kind === 72 /* Identifier */) {
+ if (m.propertyName.kind === 73 /* Identifier */) {
existingName = m.propertyName.escapedText;
}
}
@@ -100432,10 +101364,10 @@
for (var _i = 0, existingMembers_2 = existingMembers; _i < existingMembers_2.length; _i++) {
var m = existingMembers_2[_i];
// Ignore omitted expressions for missing members
- if (m.kind !== 154 /* PropertyDeclaration */ &&
- m.kind !== 156 /* MethodDeclaration */ &&
- m.kind !== 158 /* GetAccessor */ &&
- m.kind !== 159 /* SetAccessor */) {
+ if (m.kind !== 155 /* PropertyDeclaration */ &&
+ m.kind !== 157 /* MethodDeclaration */ &&
+ m.kind !== 159 /* GetAccessor */ &&
+ m.kind !== 160 /* SetAccessor */) {
continue;
}
// If this is the current item we are editing right now, do not filter it out
@@ -100475,7 +101407,7 @@
if (isCurrentlyEditingNode(attr)) {
continue;
}
- if (attr.kind === 267 /* JsxAttribute */) {
+ if (attr.kind === 268 /* JsxAttribute */) {
seenNames.set(attr.name.escapedText, true);
}
}
@@ -100495,9 +101427,9 @@
|| ts.isKnownSymbol(symbol)) {
return undefined;
}
- var validIdentiferResult = { name: name, needsConvertPropertyAccess: false };
+ var validIdentifierResult = { name: name, needsConvertPropertyAccess: false };
if (ts.isIdentifierText(name, target))
- return validIdentiferResult;
+ return validIdentifierResult;
switch (kind) {
case 3 /* MemberLike */:
return undefined;
@@ -100510,7 +101442,7 @@
return name.charCodeAt(0) === 32 /* space */ ? undefined : { name: name, needsConvertPropertyAccess: true };
case 5 /* None */:
case 4 /* String */:
- return validIdentiferResult;
+ return validIdentifierResult;
default:
ts.Debug.assertNever(kind);
}
@@ -100519,12 +101451,12 @@
var _keywordCompletions = [];
var allKeywordsCompletions = ts.memoize(function () {
var res = [];
- for (var i = 73 /* FirstKeyword */; i <= 147 /* LastKeyword */; i++) {
+ for (var i = 74 /* FirstKeyword */; i <= 148 /* LastKeyword */; i++) {
res.push({
name: ts.tokenToString(i),
kind: "keyword" /* keyword */,
kindModifiers: "" /* none */,
- sortText: "0"
+ sortText: SortText.GlobalsOrKeywords
});
}
return res;
@@ -100544,8 +101476,8 @@
case 0 /* None */:
return false;
case 1 /* All */:
- return kind === 121 /* AsyncKeyword */ || 122 /* AwaitKeyword */ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind) || kind === 125 /* DeclareKeyword */ || kind === 130 /* ModuleKeyword */
- || ts.isTypeKeyword(kind) && kind !== 141 /* UndefinedKeyword */;
+ return kind === 122 /* AsyncKeyword */ || 123 /* AwaitKeyword */ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind) || kind === 126 /* DeclareKeyword */ || kind === 131 /* ModuleKeyword */
+ || ts.isTypeKeyword(kind) && kind !== 142 /* UndefinedKeyword */;
case 2 /* ClassElementKeywords */:
return isClassMemberCompletionKeyword(kind);
case 3 /* InterfaceElementKeywords */:
@@ -100563,54 +101495,54 @@
}
function isTypeScriptOnlyKeyword(kind) {
switch (kind) {
- case 118 /* AbstractKeyword */:
- case 120 /* AnyKeyword */:
- case 146 /* BigIntKeyword */:
- case 123 /* BooleanKeyword */:
- case 125 /* DeclareKeyword */:
- case 84 /* EnumKeyword */:
- case 145 /* GlobalKeyword */:
- case 109 /* ImplementsKeyword */:
- case 127 /* InferKeyword */:
- case 110 /* InterfaceKeyword */:
- case 128 /* IsKeyword */:
- case 129 /* KeyOfKeyword */:
- case 130 /* ModuleKeyword */:
- case 131 /* NamespaceKeyword */:
- case 132 /* NeverKeyword */:
- case 135 /* NumberKeyword */:
- case 136 /* ObjectKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 115 /* PublicKeyword */:
- case 133 /* ReadonlyKeyword */:
- case 138 /* StringKeyword */:
- case 139 /* SymbolKeyword */:
- case 140 /* TypeKeyword */:
- case 142 /* UniqueKeyword */:
- case 143 /* UnknownKeyword */:
+ case 119 /* AbstractKeyword */:
+ case 121 /* AnyKeyword */:
+ case 147 /* BigIntKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 85 /* EnumKeyword */:
+ case 146 /* GlobalKeyword */:
+ case 110 /* ImplementsKeyword */:
+ case 128 /* InferKeyword */:
+ case 111 /* InterfaceKeyword */:
+ case 129 /* IsKeyword */:
+ case 130 /* KeyOfKeyword */:
+ case 131 /* ModuleKeyword */:
+ case 132 /* NamespaceKeyword */:
+ case 133 /* NeverKeyword */:
+ case 136 /* NumberKeyword */:
+ case 137 /* ObjectKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 116 /* PublicKeyword */:
+ case 134 /* ReadonlyKeyword */:
+ case 139 /* StringKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 141 /* TypeKeyword */:
+ case 143 /* UniqueKeyword */:
+ case 144 /* UnknownKeyword */:
return true;
default:
return false;
}
}
function isInterfaceOrTypeLiteralCompletionKeyword(kind) {
- return kind === 133 /* ReadonlyKeyword */;
+ return kind === 134 /* ReadonlyKeyword */;
}
function isClassMemberCompletionKeyword(kind) {
switch (kind) {
- case 118 /* AbstractKeyword */:
- case 124 /* ConstructorKeyword */:
- case 126 /* GetKeyword */:
- case 137 /* SetKeyword */:
- case 121 /* AsyncKeyword */:
+ case 119 /* AbstractKeyword */:
+ case 125 /* ConstructorKeyword */:
+ case 127 /* GetKeyword */:
+ case 138 /* SetKeyword */:
+ case 122 /* AsyncKeyword */:
return true;
default:
return ts.isClassMemberModifier(kind);
}
}
function isFunctionLikeBodyKeyword(kind) {
- return kind === 121 /* AsyncKeyword */ || kind === 122 /* AwaitKeyword */ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind);
+ return kind === 122 /* AsyncKeyword */ || kind === 123 /* AwaitKeyword */ || !ts.isContextualKeyword(kind) && !isClassMemberCompletionKeyword(kind);
}
function keywordForNode(node) {
return ts.isIdentifier(node) ? node.originalKeywordKind || 0 /* Unknown */ : node.kind;
@@ -100647,7 +101579,7 @@
function tryGetObjectTypeDeclarationCompletionContainer(sourceFile, contextToken, location) {
// class c { method() { } | method2() { } }
switch (location.kind) {
- case 311 /* SyntaxList */:
+ case 312 /* SyntaxList */:
return ts.tryCast(location.parent, ts.isObjectTypeDeclaration);
case 1 /* EndOfFileToken */:
var cls = ts.tryCast(ts.lastOrUndefined(ts.cast(location.parent, ts.isSourceFile).statements), ts.isObjectTypeDeclaration);
@@ -100756,40 +101688,40 @@
}
function getHighlightSpans(node, sourceFile) {
switch (node.kind) {
- case 91 /* IfKeyword */:
- case 83 /* ElseKeyword */:
+ case 92 /* IfKeyword */:
+ case 84 /* ElseKeyword */:
return ts.isIfStatement(node.parent) ? getIfElseOccurrences(node.parent, sourceFile) : undefined;
- case 97 /* ReturnKeyword */:
+ case 98 /* ReturnKeyword */:
return useParent(node.parent, ts.isReturnStatement, getReturnOccurrences);
- case 101 /* ThrowKeyword */:
+ case 102 /* ThrowKeyword */:
return useParent(node.parent, ts.isThrowStatement, getThrowOccurrences);
- case 103 /* TryKeyword */:
- case 75 /* CatchKeyword */:
- case 88 /* FinallyKeyword */:
- var tryStatement = node.kind === 75 /* CatchKeyword */ ? node.parent.parent : node.parent;
+ case 104 /* TryKeyword */:
+ case 76 /* CatchKeyword */:
+ case 89 /* FinallyKeyword */:
+ var tryStatement = node.kind === 76 /* CatchKeyword */ ? node.parent.parent : node.parent;
return useParent(tryStatement, ts.isTryStatement, getTryCatchFinallyOccurrences);
- case 99 /* SwitchKeyword */:
+ case 100 /* SwitchKeyword */:
return useParent(node.parent, ts.isSwitchStatement, getSwitchCaseDefaultOccurrences);
- case 74 /* CaseKeyword */:
- case 80 /* DefaultKeyword */:
+ case 75 /* CaseKeyword */:
+ case 81 /* DefaultKeyword */:
return useParent(node.parent.parent.parent, ts.isSwitchStatement, getSwitchCaseDefaultOccurrences);
- case 73 /* BreakKeyword */:
- case 78 /* ContinueKeyword */:
+ case 74 /* BreakKeyword */:
+ case 79 /* ContinueKeyword */:
return useParent(node.parent, ts.isBreakOrContinueStatement, getBreakOrContinueStatementOccurrences);
- case 89 /* ForKeyword */:
- case 107 /* WhileKeyword */:
- case 82 /* DoKeyword */:
+ case 90 /* ForKeyword */:
+ case 108 /* WhileKeyword */:
+ case 83 /* DoKeyword */:
return useParent(node.parent, function (n) { return ts.isIterationStatement(n, /*lookInLabeledStatements*/ true); }, getLoopBreakContinueOccurrences);
- case 124 /* ConstructorKeyword */:
- return getFromAllDeclarations(ts.isConstructorDeclaration, [124 /* ConstructorKeyword */]);
- case 126 /* GetKeyword */:
- case 137 /* SetKeyword */:
- return getFromAllDeclarations(ts.isAccessor, [126 /* GetKeyword */, 137 /* SetKeyword */]);
- case 122 /* AwaitKeyword */:
+ case 125 /* ConstructorKeyword */:
+ return getFromAllDeclarations(ts.isConstructorDeclaration, [125 /* ConstructorKeyword */]);
+ case 127 /* GetKeyword */:
+ case 138 /* SetKeyword */:
+ return getFromAllDeclarations(ts.isAccessor, [127 /* GetKeyword */, 138 /* SetKeyword */]);
+ case 123 /* AwaitKeyword */:
return useParent(node.parent, ts.isAwaitExpression, getAsyncAndAwaitOccurrences);
- case 121 /* AsyncKeyword */:
+ case 122 /* AsyncKeyword */:
return highlightSpans(getAsyncAndAwaitOccurrences(node));
- case 117 /* YieldKeyword */:
+ case 118 /* YieldKeyword */:
return highlightSpans(getYieldOccurrences(node));
default:
return ts.isModifierKind(node.kind) && (ts.isDeclaration(node.parent) || ts.isVariableStatement(node.parent))
@@ -100832,7 +101764,7 @@
var child = throwStatement;
while (child.parent) {
var parent = child.parent;
- if (ts.isFunctionBlock(parent) || parent.kind === 284 /* SourceFile */) {
+ if (ts.isFunctionBlock(parent) || parent.kind === 285 /* SourceFile */) {
return parent;
}
// A throw-statement is only owned by a try-statement if the try-statement has
@@ -100864,16 +101796,16 @@
function getBreakOrContinueOwner(statement) {
return ts.findAncestor(statement, function (node) {
switch (node.kind) {
- case 232 /* SwitchStatement */:
- if (statement.kind === 228 /* ContinueStatement */) {
+ case 233 /* SwitchStatement */:
+ if (statement.kind === 229 /* ContinueStatement */) {
return false;
}
// falls through
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 224 /* WhileStatement */:
- case 223 /* DoStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 225 /* WhileStatement */:
+ case 224 /* DoStatement */:
return !statement.label || isLabeledBy(node, statement.label.escapedText);
default:
// Don't cross function boundaries.
@@ -100889,11 +101821,11 @@
// Types of node whose children might have modifiers.
var container = declaration.parent;
switch (container.kind) {
- case 245 /* ModuleBlock */:
- case 284 /* SourceFile */:
- case 218 /* Block */:
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
+ case 246 /* ModuleBlock */:
+ case 285 /* SourceFile */:
+ case 219 /* Block */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
// Container is either a class declaration or the declaration is a classDeclaration
if (modifierFlag & 128 /* Abstract */ && ts.isClassDeclaration(declaration)) {
return declaration.members.concat([declaration]);
@@ -100901,12 +101833,12 @@
else {
return container.statements;
}
- case 157 /* Constructor */:
- case 156 /* MethodDeclaration */:
- case 239 /* FunctionDeclaration */:
+ case 158 /* Constructor */:
+ case 157 /* MethodDeclaration */:
+ case 240 /* FunctionDeclaration */:
return container.parameters.concat((ts.isClassLike(container.parent) ? container.parent.members : []));
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
var nodes = container.members;
// If we're an accessibility modifier, we're in an instance member and should search
// the constructor's parameter list for instance members as well.
@@ -100937,12 +101869,12 @@
}
function getLoopBreakContinueOccurrences(loopNode) {
var keywords = [];
- if (pushKeywordIf(keywords, loopNode.getFirstToken(), 89 /* ForKeyword */, 107 /* WhileKeyword */, 82 /* DoKeyword */)) {
+ if (pushKeywordIf(keywords, loopNode.getFirstToken(), 90 /* ForKeyword */, 108 /* WhileKeyword */, 83 /* DoKeyword */)) {
// If we succeeded and got a do-while loop, then start looking for a 'while' keyword.
- if (loopNode.kind === 223 /* DoStatement */) {
+ if (loopNode.kind === 224 /* DoStatement */) {
var loopTokens = loopNode.getChildren();
for (var i = loopTokens.length - 1; i >= 0; i--) {
- if (pushKeywordIf(keywords, loopTokens[i], 107 /* WhileKeyword */)) {
+ if (pushKeywordIf(keywords, loopTokens[i], 108 /* WhileKeyword */)) {
break;
}
}
@@ -100950,7 +101882,7 @@
}
ts.forEach(aggregateAllBreakAndContinueStatements(loopNode.statement), function (statement) {
if (ownsBreakOrContinueStatement(loopNode, statement)) {
- pushKeywordIf(keywords, statement.getFirstToken(), 73 /* BreakKeyword */, 78 /* ContinueKeyword */);
+ pushKeywordIf(keywords, statement.getFirstToken(), 74 /* BreakKeyword */, 79 /* ContinueKeyword */);
}
});
return keywords;
@@ -100959,13 +101891,13 @@
var owner = getBreakOrContinueOwner(breakOrContinueStatement);
if (owner) {
switch (owner.kind) {
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
return getLoopBreakContinueOccurrences(owner);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return getSwitchCaseDefaultOccurrences(owner);
}
}
@@ -100973,13 +101905,13 @@
}
function getSwitchCaseDefaultOccurrences(switchStatement) {
var keywords = [];
- pushKeywordIf(keywords, switchStatement.getFirstToken(), 99 /* SwitchKeyword */);
+ pushKeywordIf(keywords, switchStatement.getFirstToken(), 100 /* SwitchKeyword */);
// Go through each clause in the switch statement, collecting the 'case'/'default' keywords.
ts.forEach(switchStatement.caseBlock.clauses, function (clause) {
- pushKeywordIf(keywords, clause.getFirstToken(), 74 /* CaseKeyword */, 80 /* DefaultKeyword */);
+ pushKeywordIf(keywords, clause.getFirstToken(), 75 /* CaseKeyword */, 81 /* DefaultKeyword */);
ts.forEach(aggregateAllBreakAndContinueStatements(clause), function (statement) {
if (ownsBreakOrContinueStatement(switchStatement, statement)) {
- pushKeywordIf(keywords, statement.getFirstToken(), 73 /* BreakKeyword */);
+ pushKeywordIf(keywords, statement.getFirstToken(), 74 /* BreakKeyword */);
}
});
});
@@ -100987,13 +101919,13 @@
}
function getTryCatchFinallyOccurrences(tryStatement, sourceFile) {
var keywords = [];
- pushKeywordIf(keywords, tryStatement.getFirstToken(), 103 /* TryKeyword */);
+ pushKeywordIf(keywords, tryStatement.getFirstToken(), 104 /* TryKeyword */);
if (tryStatement.catchClause) {
- pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 75 /* CatchKeyword */);
+ pushKeywordIf(keywords, tryStatement.catchClause.getFirstToken(), 76 /* CatchKeyword */);
}
if (tryStatement.finallyBlock) {
- var finallyKeyword = ts.findChildOfKind(tryStatement, 88 /* FinallyKeyword */, sourceFile);
- pushKeywordIf(keywords, finallyKeyword, 88 /* FinallyKeyword */);
+ var finallyKeyword = ts.findChildOfKind(tryStatement, 89 /* FinallyKeyword */, sourceFile);
+ pushKeywordIf(keywords, finallyKeyword, 89 /* FinallyKeyword */);
}
return keywords;
}
@@ -101004,13 +101936,13 @@
}
var keywords = [];
ts.forEach(aggregateOwnedThrowStatements(owner), function (throwStatement) {
- keywords.push(ts.findChildOfKind(throwStatement, 101 /* ThrowKeyword */, sourceFile));
+ keywords.push(ts.findChildOfKind(throwStatement, 102 /* ThrowKeyword */, sourceFile));
});
// If the "owner" is a function, then we equate 'return' and 'throw' statements in their
// ability to "jump out" of the function, and include occurrences for both.
if (ts.isFunctionBlock(owner)) {
ts.forEachReturnStatement(owner, function (returnStatement) {
- keywords.push(ts.findChildOfKind(returnStatement, 97 /* ReturnKeyword */, sourceFile));
+ keywords.push(ts.findChildOfKind(returnStatement, 98 /* ReturnKeyword */, sourceFile));
});
}
return keywords;
@@ -101022,11 +101954,11 @@
}
var keywords = [];
ts.forEachReturnStatement(ts.cast(func.body, ts.isBlock), function (returnStatement) {
- keywords.push(ts.findChildOfKind(returnStatement, 97 /* ReturnKeyword */, sourceFile));
+ keywords.push(ts.findChildOfKind(returnStatement, 98 /* ReturnKeyword */, sourceFile));
});
// Include 'throw' statements that do not occur within a try block.
ts.forEach(aggregateOwnedThrowStatements(func.body), function (throwStatement) {
- keywords.push(ts.findChildOfKind(throwStatement, 101 /* ThrowKeyword */, sourceFile));
+ keywords.push(ts.findChildOfKind(throwStatement, 102 /* ThrowKeyword */, sourceFile));
});
return keywords;
}
@@ -101038,13 +101970,13 @@
var keywords = [];
if (func.modifiers) {
func.modifiers.forEach(function (modifier) {
- pushKeywordIf(keywords, modifier, 121 /* AsyncKeyword */);
+ pushKeywordIf(keywords, modifier, 122 /* AsyncKeyword */);
});
}
ts.forEachChild(func, function (child) {
traverseWithoutCrossingFunction(child, function (node) {
if (ts.isAwaitExpression(node)) {
- pushKeywordIf(keywords, node.getFirstToken(), 122 /* AwaitKeyword */);
+ pushKeywordIf(keywords, node.getFirstToken(), 123 /* AwaitKeyword */);
}
});
});
@@ -101059,7 +101991,7 @@
ts.forEachChild(func, function (child) {
traverseWithoutCrossingFunction(child, function (node) {
if (ts.isYieldExpression(node)) {
- pushKeywordIf(keywords, node.getFirstToken(), 117 /* YieldKeyword */);
+ pushKeywordIf(keywords, node.getFirstToken(), 118 /* YieldKeyword */);
}
});
});
@@ -101078,7 +102010,7 @@
// We'd like to highlight else/ifs together if they are only separated by whitespace
// (i.e. the keywords are separated by no comments, no newlines).
for (var i = 0; i < keywords.length; i++) {
- if (keywords[i].kind === 83 /* ElseKeyword */ && i < keywords.length - 1) {
+ if (keywords[i].kind === 84 /* ElseKeyword */ && i < keywords.length - 1) {
var elseKeyword = keywords[i];
var ifKeyword = keywords[i + 1]; // this *should* always be an 'if' keyword.
var shouldCombineElseAndIf = true;
@@ -101113,10 +102045,10 @@
// Now traverse back down through the else branches, aggregating if/else keywords of if-statements.
while (true) {
var children = ifStatement.getChildren(sourceFile);
- pushKeywordIf(keywords, children[0], 91 /* IfKeyword */);
+ pushKeywordIf(keywords, children[0], 92 /* IfKeyword */);
// Generally the 'else' keyword is second-to-last, so we traverse backwards.
for (var i = children.length - 1; i >= 0; i--) {
- if (pushKeywordIf(keywords, children[i], 83 /* ElseKeyword */)) {
+ if (pushKeywordIf(keywords, children[i], 84 /* ElseKeyword */)) {
break;
}
}
@@ -101332,12 +102264,12 @@
if (cancellationToken)
cancellationToken.throwIfCancellationRequested();
switch (direct.kind) {
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
if (!isAvailableThroughGlobal) {
var parent = direct.parent;
- if (exportKind === 2 /* ExportEquals */ && parent.kind === 237 /* VariableDeclaration */) {
+ if (exportKind === 2 /* ExportEquals */ && parent.kind === 238 /* VariableDeclaration */) {
var name = parent.name;
- if (name.kind === 72 /* Identifier */) {
+ if (name.kind === 73 /* Identifier */) {
directImports.push(name);
break;
}
@@ -101346,22 +102278,22 @@
addIndirectUser(direct.getSourceFile());
}
break;
- case 72 /* Identifier */: // for 'const x = require("y");
+ case 73 /* Identifier */: // for 'const x = require("y");
break; // TODO: GH#23879
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
handleNamespaceImport(direct, direct.name, ts.hasModifier(direct, 1 /* Export */), /*alreadyAddedDirect*/ false);
break;
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
directImports.push(direct);
var namedBindings = direct.importClause && direct.importClause.namedBindings;
- if (namedBindings && namedBindings.kind === 251 /* NamespaceImport */) {
+ if (namedBindings && namedBindings.kind === 252 /* NamespaceImport */) {
handleNamespaceImport(direct, namedBindings.name, /*isReExport*/ false, /*alreadyAddedDirect*/ true);
}
else if (!isAvailableThroughGlobal && ts.isDefaultImport(direct)) {
addIndirectUser(getSourceFileLikeForImportDeclaration(direct)); // Add a check for indirect uses to handle synthetic default imports
}
break;
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
if (!direct.exportClause) {
// This is `export * from "foo"`, so imports of this module may import the export too.
handleDirectImports(getContainingModuleSymbol(direct, checker));
@@ -101371,11 +102303,11 @@
directImports.push(direct);
}
break;
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
directImports.push(direct);
break;
default:
- ts.Debug.assertNever(direct, "Unexpected import kind: " + ts.Debug.showSyntaxKind(direct));
+ ts.Debug.failBadSyntaxKind(direct, "Unexpected import kind.");
}
}
}
@@ -101388,7 +102320,7 @@
}
else if (!isAvailableThroughGlobal) {
var sourceFileLike = getSourceFileLikeForImportDeclaration(importDeclaration);
- ts.Debug.assert(sourceFileLike.kind === 284 /* SourceFile */ || sourceFileLike.kind === 244 /* ModuleDeclaration */);
+ ts.Debug.assert(sourceFileLike.kind === 285 /* SourceFile */ || sourceFileLike.kind === 245 /* ModuleDeclaration */);
if (isReExport || findNamespaceReExports(sourceFileLike, name, checker)) {
addIndirectUsers(sourceFileLike);
}
@@ -101443,17 +102375,17 @@
}
return { importSearches: importSearches, singleReferences: singleReferences };
function handleImport(decl) {
- if (decl.kind === 248 /* ImportEqualsDeclaration */) {
+ if (decl.kind === 249 /* ImportEqualsDeclaration */) {
if (isExternalModuleImportEquals(decl)) {
handleNamespaceImportLike(decl.name);
}
return;
}
- if (decl.kind === 72 /* Identifier */) {
+ if (decl.kind === 73 /* Identifier */) {
handleNamespaceImportLike(decl);
return;
}
- if (decl.kind === 183 /* ImportType */) {
+ if (decl.kind === 184 /* ImportType */) {
if (decl.qualifier) {
if (ts.isIdentifier(decl.qualifier) && decl.qualifier.escapedText === ts.symbolName(exportSymbol)) {
singleReferences.push(decl.qualifier);
@@ -101468,17 +102400,17 @@
if (decl.moduleSpecifier.kind !== 10 /* StringLiteral */) {
return;
}
- if (decl.kind === 255 /* ExportDeclaration */) {
+ if (decl.kind === 256 /* ExportDeclaration */) {
searchForNamedImport(decl.exportClause);
return;
}
var _a = decl.importClause || { name: undefined, namedBindings: undefined }, name = _a.name, namedBindings = _a.namedBindings;
if (namedBindings) {
switch (namedBindings.kind) {
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
handleNamespaceImportLike(namedBindings.name);
break;
- case 252 /* NamedImports */:
+ case 253 /* NamedImports */:
// 'default' might be accessed as a named import `{ default as foo }`.
if (exportKind === 0 /* Named */ || exportKind === 1 /* Default */) {
searchForNamedImport(namedBindings);
@@ -101528,7 +102460,7 @@
}
}
else {
- var localSymbol = element.kind === 257 /* ExportSpecifier */ && element.propertyName
+ var localSymbol = element.kind === 258 /* ExportSpecifier */ && element.propertyName
? checker.getExportSpecifierLocalTargetSymbol(element) // For re-exporting under a different name, we want to get the re-exported symbol.
: checker.getSymbolAtLocation(name);
addSearch(name, localSymbol);
@@ -101557,7 +102489,7 @@
for (var _i = 0, sourceFiles_1 = sourceFiles; _i < sourceFiles_1.length; _i++) {
var referencingFile = sourceFiles_1[_i];
var searchSourceFile = searchModuleSymbol.valueDeclaration;
- if (searchSourceFile.kind === 284 /* SourceFile */) {
+ if (searchSourceFile.kind === 285 /* SourceFile */) {
for (var _a = 0, _b = referencingFile.referencedFiles; _a < _b.length; _a++) {
var ref = _b[_a];
if (program.getSourceFileFromReference(referencingFile, ref) === searchSourceFile) {
@@ -101605,7 +102537,7 @@
}
/** Iterates over all statements at the top level or in module declarations. Returns the first truthy result. */
function forEachPossibleImportOrExportStatement(sourceFileLike, action) {
- return ts.forEach(sourceFileLike.kind === 284 /* SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) {
+ return ts.forEach(sourceFileLike.kind === 285 /* SourceFile */ ? sourceFileLike.statements : sourceFileLike.body.statements, function (statement) {
return action(statement) || (isAmbientModuleDeclaration(statement) && ts.forEach(statement.body && statement.body.statements, action));
});
}
@@ -101620,15 +102552,15 @@
else {
forEachPossibleImportOrExportStatement(sourceFile, function (statement) {
switch (statement.kind) {
- case 255 /* ExportDeclaration */:
- case 249 /* ImportDeclaration */: {
+ case 256 /* ExportDeclaration */:
+ case 250 /* ImportDeclaration */: {
var decl = statement;
if (decl.moduleSpecifier && ts.isStringLiteral(decl.moduleSpecifier)) {
action(decl, decl.moduleSpecifier);
}
break;
}
- case 248 /* ImportEqualsDeclaration */: {
+ case 249 /* ImportEqualsDeclaration */: {
var decl = statement;
if (isExternalModuleImportEquals(decl)) {
action(decl, decl.moduleReference.expression);
@@ -101652,7 +102584,7 @@
var parent = node.parent;
var grandParent = parent.parent;
if (symbol.exportSymbol) {
- if (parent.kind === 189 /* PropertyAccessExpression */) {
+ if (parent.kind === 190 /* PropertyAccessExpression */) {
// When accessing an export of a JS module, there's no alias. The symbol will still be flagged as an export even though we're at the use.
// So check that we are at the declaration.
return symbol.declarations.some(function (d) { return d === parent; }) && ts.isBinaryExpression(grandParent)
@@ -101718,7 +102650,7 @@
var sym = useLhsSymbol ? checker.getSymbolAtLocation(ts.cast(node.left, ts.isPropertyAccessExpression).name) : symbol;
// Better detection for GH#20803
if (sym && !(checker.getMergedSymbol(sym.parent).flags & 1536 /* Module */)) {
- ts.Debug.fail("Special property assignment kind does not have a module as its parent. Assignment is " + ts.Debug.showSymbol(sym) + ", parent is " + ts.Debug.showSymbol(sym.parent));
+ ts.Debug.fail("Special property assignment kind does not have a module as its parent. Assignment is " + ts.Debug.formatSymbol(sym) + ", parent is " + ts.Debug.formatSymbol(sym.parent));
}
return sym && exportInfo(sym, kind);
}
@@ -101774,10 +102706,10 @@
// If a reference is a class expression, the exported node would be its parent.
// If a reference is a variable declaration, the exported node would be the variable statement.
function getExportNode(parent, node) {
- if (parent.kind === 237 /* VariableDeclaration */) {
+ if (parent.kind === 238 /* VariableDeclaration */) {
var p = parent;
return p.name !== node ? undefined :
- p.parent.kind === 274 /* CatchClause */ ? undefined : p.parent.parent.kind === 219 /* VariableStatement */ ? p.parent.parent : undefined;
+ p.parent.kind === 275 /* CatchClause */ ? undefined : p.parent.parent.kind === 220 /* VariableStatement */ ? p.parent.parent : undefined;
}
else {
return parent;
@@ -101786,13 +102718,13 @@
function isNodeImport(node) {
var parent = node.parent;
switch (parent.kind) {
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return parent.name === node && isExternalModuleImportEquals(parent);
- case 253 /* ImportSpecifier */:
+ case 254 /* ImportSpecifier */:
// For a rename import `{ foo as bar }`, don't search for the imported symbol. Just find local uses of `bar`.
return !parent.propertyName;
- case 250 /* ImportClause */:
- case 251 /* NamespaceImport */:
+ case 251 /* ImportClause */:
+ case 252 /* NamespaceImport */:
ts.Debug.assert(parent.name === node);
return true;
default:
@@ -101825,21 +102757,21 @@
return checker.getMergedSymbol(getSourceFileLikeForImportDeclaration(importer).symbol);
}
function getSourceFileLikeForImportDeclaration(node) {
- if (node.kind === 191 /* CallExpression */) {
+ if (node.kind === 192 /* CallExpression */) {
return node.getSourceFile();
}
var parent = node.parent;
- if (parent.kind === 284 /* SourceFile */) {
+ if (parent.kind === 285 /* SourceFile */) {
return parent;
}
- ts.Debug.assert(parent.kind === 245 /* ModuleBlock */);
+ ts.Debug.assert(parent.kind === 246 /* ModuleBlock */);
return ts.cast(parent.parent, isAmbientModuleDeclaration);
}
function isAmbientModuleDeclaration(node) {
- return node.kind === 244 /* ModuleDeclaration */ && node.name.kind === 10 /* StringLiteral */;
+ return node.kind === 245 /* ModuleDeclaration */ && node.name.kind === 10 /* StringLiteral */;
}
function isExternalModuleImportEquals(eq) {
- return eq.moduleReference.kind === 259 /* ExternalModuleReference */ && eq.moduleReference.expression.kind === 10 /* StringLiteral */;
+ return eq.moduleReference.kind === 260 /* ExternalModuleReference */ && eq.moduleReference.expression.kind === 10 /* StringLiteral */;
}
})(FindAllReferences = ts.FindAllReferences || (ts.FindAllReferences = {}));
})(ts || (ts = {}));
@@ -101891,18 +102823,18 @@
}
FindAllReferences.getImplementationsAtPosition = getImplementationsAtPosition;
function getImplementationReferenceEntries(program, cancellationToken, sourceFiles, node, position) {
- if (node.kind === 284 /* SourceFile */) {
+ if (node.kind === 285 /* SourceFile */) {
return undefined;
}
var checker = program.getTypeChecker();
// If invoked directly on a shorthand property assignment, then return
// the declaration of the symbol being assigned (not the symbol being assigned to).
- if (node.parent.kind === 276 /* ShorthandPropertyAssignment */) {
+ if (node.parent.kind === 277 /* ShorthandPropertyAssignment */) {
var result_1 = [];
FindAllReferences.Core.getReferenceEntriesForShorthandPropertyAssignment(node, checker, function (node) { return result_1.push(nodeEntry(node)); });
return result_1;
}
- else if (node.kind === 98 /* SuperKeyword */ || ts.isSuperProperty(node.parent)) {
+ else if (node.kind === 99 /* SuperKeyword */ || ts.isSuperProperty(node.parent)) {
// References to and accesses on the super keyword only have one possible implementation, so no
// need to "Find all References"
var symbol = checker.getSymbolAtLocation(node);
@@ -101982,7 +102914,7 @@
textSpan: textSpan,
fileName: fileName,
isWriteAccess: isWriteAccessForReference(node),
- isDefinition: node.kind === 80 /* DefaultKeyword */
+ isDefinition: node.kind === 81 /* DefaultKeyword */
|| !!ts.getDeclarationFromName(node)
|| ts.isLiteralComputedPropertyDeclarationName(node),
isInString: kind === 2 /* StringLiteral */ ? true : undefined,
@@ -102039,13 +102971,13 @@
if (symbol) {
return getDefinitionKindAndDisplayParts(symbol, checker, node);
}
- else if (node.kind === 188 /* ObjectLiteralExpression */) {
+ else if (node.kind === 189 /* ObjectLiteralExpression */) {
return {
kind: "interface" /* interfaceElement */,
displayParts: [ts.punctuationPart(20 /* OpenParenToken */), ts.textPart("object literal"), ts.punctuationPart(21 /* CloseParenToken */)]
};
}
- else if (node.kind === 209 /* ClassExpression */) {
+ else if (node.kind === 210 /* ClassExpression */) {
return {
kind: "local class" /* localClassElement */,
displayParts: [ts.punctuationPart(20 /* OpenParenToken */), ts.textPart("anonymous local class"), ts.punctuationPart(21 /* CloseParenToken */)]
@@ -102088,7 +103020,7 @@
/** A node is considered a writeAccess iff it is a name of a declaration or a target of an assignment */
function isWriteAccessForReference(node) {
var decl = ts.getDeclarationFromName(node);
- return !!decl && declarationIsWriteAccess(decl) || node.kind === 80 /* DefaultKeyword */ || ts.isWriteAccess(node);
+ return !!decl && declarationIsWriteAccess(decl) || node.kind === 81 /* DefaultKeyword */ || ts.isWriteAccess(node);
}
/**
* True if 'decl' provides a value, as in `function f() {}`;
@@ -102099,46 +103031,46 @@
if (!!(decl.flags & 4194304 /* Ambient */))
return true;
switch (decl.kind) {
- case 204 /* BinaryExpression */:
- case 186 /* BindingElement */:
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 80 /* DefaultKeyword */:
- case 243 /* EnumDeclaration */:
- case 278 /* EnumMember */:
- case 257 /* ExportSpecifier */:
- case 250 /* ImportClause */: // default import
- case 248 /* ImportEqualsDeclaration */:
- case 253 /* ImportSpecifier */:
- case 241 /* InterfaceDeclaration */:
- case 302 /* JSDocCallbackTag */:
- case 309 /* JSDocTypedefTag */:
- case 267 /* JsxAttribute */:
- case 244 /* ModuleDeclaration */:
- case 247 /* NamespaceExportDeclaration */:
- case 251 /* NamespaceImport */:
- case 151 /* Parameter */:
- case 276 /* ShorthandPropertyAssignment */:
- case 242 /* TypeAliasDeclaration */:
- case 150 /* TypeParameter */:
+ case 205 /* BinaryExpression */:
+ case 187 /* BindingElement */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 81 /* DefaultKeyword */:
+ case 244 /* EnumDeclaration */:
+ case 279 /* EnumMember */:
+ case 258 /* ExportSpecifier */:
+ case 251 /* ImportClause */: // default import
+ case 249 /* ImportEqualsDeclaration */:
+ case 254 /* ImportSpecifier */:
+ case 242 /* InterfaceDeclaration */:
+ case 303 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 268 /* JsxAttribute */:
+ case 245 /* ModuleDeclaration */:
+ case 248 /* NamespaceExportDeclaration */:
+ case 252 /* NamespaceImport */:
+ case 152 /* Parameter */:
+ case 277 /* ShorthandPropertyAssignment */:
+ case 243 /* TypeAliasDeclaration */:
+ case 151 /* TypeParameter */:
return true;
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
// In `({ x: y } = 0);`, `x` is not a write access. (Won't call this function for `y`.)
return !ts.isArrayLiteralOrObjectLiteralDestructuringPattern(decl.parent);
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 157 /* Constructor */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 158 /* Constructor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return !!decl.body;
- case 237 /* VariableDeclaration */:
- case 154 /* PropertyDeclaration */:
+ case 238 /* VariableDeclaration */:
+ case 155 /* PropertyDeclaration */:
return !!decl.initializer || ts.isCatchClause(decl.parent);
- case 155 /* MethodSignature */:
- case 153 /* PropertySignature */:
- case 310 /* JSDocPropertyTag */:
- case 304 /* JSDocParameterTag */:
+ case 156 /* MethodSignature */:
+ case 154 /* PropertySignature */:
+ case 311 /* JSDocPropertyTag */:
+ case 305 /* JSDocParameterTag */:
return false;
default:
return ts.Debug.failBadSyntaxKind(decl);
@@ -102298,10 +103230,10 @@
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var decl = _a[_i];
switch (decl.kind) {
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
// Don't include the source file itself. (This may not be ideal behavior, but awkward to include an entire file as a reference.)
break;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
if (sourceFilesSet.has(decl.getSourceFile().fileName)) {
references.push(FindAllReferences.nodeEntry(decl.name));
}
@@ -102321,7 +103253,7 @@
var node = ts.isBinaryExpression(decl) && ts.isPropertyAccessExpression(decl.left)
? decl.left.expression
: ts.isExportAssignment(decl)
- ? ts.Debug.assertDefined(ts.findChildOfKind(decl, 85 /* ExportKeyword */, sourceFile))
+ ? ts.Debug.assertDefined(ts.findChildOfKind(decl, 86 /* ExportKeyword */, sourceFile))
: ts.getNameOfDeclaration(decl) || decl;
references.push(FindAllReferences.nodeEntry(node));
}
@@ -102348,7 +103280,7 @@
if (ts.isThis(node)) {
return getReferencesForThisKeyword(node, sourceFiles, cancellationToken);
}
- if (node.kind === 98 /* SuperKeyword */) {
+ if (node.kind === 99 /* SuperKeyword */) {
return getReferencesForSuperKeyword(node);
}
return undefined;
@@ -102365,7 +103297,7 @@
// When renaming at an export specifier, rename the export and not the thing being exported.
getReferencesAtExportSpecifier(exportSpecifier.name, symbol, exportSpecifier, state.createSearch(node, originalSymbol, /*comingFrom*/ undefined), state, /*addReferencesHere*/ true, /*alwaysGetReferences*/ true);
}
- else if (node && node.kind === 80 /* DefaultKeyword */) {
+ else if (node && node.kind === 81 /* DefaultKeyword */) {
addReference(node, symbol, state);
searchForImportsOfExport(node, symbol, { exportingModuleSymbol: ts.Debug.assertDefined(symbol.parent, "Expected export symbol to have a parent"), exportKind: 1 /* Default */ }, state);
}
@@ -102393,9 +103325,9 @@
}
function getSpecialSearchKind(node) {
switch (node.kind) {
- case 124 /* ConstructorKeyword */:
+ case 125 /* ConstructorKeyword */:
return 1 /* Constructor */;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
if (ts.isClassLike(node.parent)) {
ts.Debug.assert(node.parent.name === node);
return 2 /* Class */;
@@ -102418,7 +103350,7 @@
if (symbol.flags & 33554432 /* Transient */)
return undefined;
// Assertions for GH#21814. We should be handling SourceFile symbols in `getReferencedSymbolsForModule` instead of getting here.
- ts.Debug.fail("Unexpected symbol at " + ts.Debug.showSyntaxKind(node) + ": " + ts.Debug.showSymbol(symbol));
+ ts.Debug.fail("Unexpected symbol at " + ts.Debug.formatSyntaxKind(node.kind) + ": " + ts.Debug.formatSymbol(symbol));
}
return ts.isTypeLiteralNode(decl.parent) && ts.isUnionTypeNode(decl.parent.parent)
? checker.getPropertyOfType(checker.getTypeFromTypeNode(decl.parent.parent), symbol.name)
@@ -102523,8 +103455,8 @@
var sourceId = ts.getNodeId(sourceFile);
var seenSymbols = this.sourceFileToSeenSymbols[sourceId] || (this.sourceFileToSeenSymbols[sourceId] = ts.createMap());
var anyNewSymbols = false;
- for (var _i = 0, symbols_2 = symbols; _i < symbols_2.length; _i++) {
- var sym = symbols_2[_i];
+ for (var _i = 0, symbols_3 = symbols; _i < symbols_3.length; _i++) {
+ var sym = symbols_3[_i];
anyNewSymbols = ts.addToSeen(seenSymbols, ts.getSymbolId(sym)) || anyNewSymbols;
}
return anyNewSymbols;
@@ -102631,7 +103563,7 @@
// If this is the symbol of a named function expression or named class expression,
// then named references are limited to its own scope.
var declarations = symbol.declarations, flags = symbol.flags, parent = symbol.parent, valueDeclaration = symbol.valueDeclaration;
- if (valueDeclaration && (valueDeclaration.kind === 196 /* FunctionExpression */ || valueDeclaration.kind === 209 /* ClassExpression */)) {
+ if (valueDeclaration && (valueDeclaration.kind === 197 /* FunctionExpression */ || valueDeclaration.kind === 210 /* ClassExpression */)) {
return valueDeclaration;
}
if (!declarations) {
@@ -102641,7 +103573,7 @@
if (flags & (4 /* Property */ | 8192 /* Method */)) {
var privateDeclaration = ts.find(declarations, function (d) { return ts.hasModifier(d, 8 /* Private */); });
if (privateDeclaration) {
- return ts.getAncestor(privateDeclaration, 240 /* ClassDeclaration */);
+ return ts.getAncestor(privateDeclaration, 241 /* ClassDeclaration */);
}
// Else this is a public property and could be accessed from anywhere.
return undefined;
@@ -102670,7 +103602,7 @@
// Different declarations have different containers, bail out
return undefined;
}
- if (!container || container.kind === 284 /* SourceFile */ && !ts.isExternalOrCommonJsModule(container)) {
+ if (!container || container.kind === 285 /* SourceFile */ && !ts.isExternalOrCommonJsModule(container)) {
// This is a global variable and not an external module, any declaration defined
// within this scope is visible outside the file
return undefined;
@@ -102757,8 +103689,8 @@
// We found a match. Make sure it's not part of a larger word (i.e. the char
// before and after it have to be a non-identifier char).
var endPosition = position + symbolNameLength;
- if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 7 /* Latest */)) &&
- (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 7 /* Latest */))) {
+ if ((position === 0 || !ts.isIdentifierPart(text.charCodeAt(position - 1), 8 /* Latest */)) &&
+ (endPosition === sourceLength || !ts.isIdentifierPart(text.charCodeAt(endPosition), 8 /* Latest */))) {
// Found a real match. Keep searching.
positions.push(position);
}
@@ -102778,7 +103710,7 @@
function isValidReferencePosition(node, searchSymbolName) {
// Compare the length so we filter out strict superstrings of the symbol we are looking for
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return node.text.length === searchSymbolName.length;
case 10 /* StringLiteral */: {
var str = node;
@@ -102787,7 +103719,7 @@
}
case 8 /* NumericLiteral */:
return ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node) && node.text.length === searchSymbolName.length;
- case 80 /* DefaultKeyword */:
+ case 81 /* DefaultKeyword */:
return "default".length === searchSymbolName.length;
default:
return false;
@@ -102851,7 +103783,7 @@
return;
}
if (ts.isExportSpecifier(parent)) {
- ts.Debug.assert(referenceLocation.kind === 72 /* Identifier */);
+ ts.Debug.assert(referenceLocation.kind === 73 /* Identifier */);
getReferencesAtExportSpecifier(referenceLocation, referenceSymbol, parent, search, state, addReferencesHere);
return;
}
@@ -102907,8 +103839,8 @@
}
// For `export { foo as bar }`, rename `foo`, but not `bar`.
if (!isForRenameWithPrefixAndSuffixText(state.options) || alwaysGetReferences) {
- var isDefaultExport = referenceLocation.originalKeywordKind === 80 /* DefaultKeyword */
- || exportSpecifier.name.originalKeywordKind === 80 /* DefaultKeyword */;
+ var isDefaultExport = referenceLocation.originalKeywordKind === 81 /* DefaultKeyword */
+ || exportSpecifier.name.originalKeywordKind === 81 /* DefaultKeyword */;
var exportKind = isDefaultExport ? 1 /* Default */ : 0 /* Named */;
var exportSymbol = ts.Debug.assertDefined(exportSpecifier.symbol);
var exportInfo = ts.Debug.assertDefined(FindAllReferences.getExportInfo(exportSymbol, exportKind, state.checker));
@@ -102987,7 +103919,7 @@
}
var pusher = function () { return state.referenceAdder(search.symbol); };
if (ts.isClassLike(referenceLocation.parent)) {
- ts.Debug.assert(referenceLocation.kind === 80 /* DefaultKeyword */ || referenceLocation.parent.name === referenceLocation);
+ ts.Debug.assert(referenceLocation.kind === 81 /* DefaultKeyword */ || referenceLocation.parent.name === referenceLocation);
// This is the class declaration containing the constructor.
findOwnConstructorReferences(search.symbol, sourceFile, pusher());
}
@@ -103014,7 +103946,7 @@
}
if (member.body) {
member.body.forEachChild(function cb(node) {
- if (node.kind === 100 /* ThisKeyword */) {
+ if (node.kind === 101 /* ThisKeyword */) {
addRef(node);
}
else if (!ts.isFunctionLike(node) && !ts.isClassLike(node)) {
@@ -103033,18 +103965,18 @@
if (constructorSymbol) {
for (var _i = 0, _a = constructorSymbol.declarations; _i < _a.length; _i++) {
var decl = _a[_i];
- var ctrKeyword = ts.findChildOfKind(decl, 124 /* ConstructorKeyword */, sourceFile);
- ts.Debug.assert(decl.kind === 157 /* Constructor */ && !!ctrKeyword);
+ var ctrKeyword = ts.findChildOfKind(decl, 125 /* ConstructorKeyword */, sourceFile);
+ ts.Debug.assert(decl.kind === 158 /* Constructor */ && !!ctrKeyword);
addNode(ctrKeyword);
}
}
if (classSymbol.exports) {
classSymbol.exports.forEach(function (member) {
var decl = member.valueDeclaration;
- if (decl && decl.kind === 156 /* MethodDeclaration */) {
+ if (decl && decl.kind === 157 /* MethodDeclaration */) {
var body = decl.body;
if (body) {
- forEachDescendantOfKind(body, 100 /* ThisKeyword */, function (thisKeyword) {
+ forEachDescendantOfKind(body, 101 /* ThisKeyword */, function (thisKeyword) {
if (ts.isNewExpressionTarget(thisKeyword)) {
addNode(thisKeyword);
}
@@ -103065,10 +103997,10 @@
}
for (var _i = 0, _a = constructor.declarations; _i < _a.length; _i++) {
var decl = _a[_i];
- ts.Debug.assert(decl.kind === 157 /* Constructor */);
+ ts.Debug.assert(decl.kind === 158 /* Constructor */);
var body = decl.body;
if (body) {
- forEachDescendantOfKind(body, 98 /* SuperKeyword */, function (node) {
+ forEachDescendantOfKind(body, 99 /* SuperKeyword */, function (node) {
if (ts.isCallExpressionTarget(node)) {
addNode(node);
}
@@ -103092,10 +104024,10 @@
addReference(refNode);
return;
}
- if (refNode.kind !== 72 /* Identifier */) {
+ if (refNode.kind !== 73 /* Identifier */) {
return;
}
- if (refNode.parent.kind === 276 /* ShorthandPropertyAssignment */) {
+ if (refNode.parent.kind === 277 /* ShorthandPropertyAssignment */) {
// Go ahead and dereference the shorthand assignment by going to its definition
getReferenceEntriesForShorthandPropertyAssignment(refNode, state.checker, addReference);
}
@@ -103115,7 +104047,7 @@
}
else if (ts.isFunctionLike(typeHavingNode) && typeHavingNode.body) {
var body = typeHavingNode.body;
- if (body.kind === 218 /* Block */) {
+ if (body.kind === 219 /* Block */) {
ts.forEachReturnStatement(body, function (returnStatement) {
if (returnStatement.expression)
addIfImplementation(returnStatement.expression);
@@ -103143,13 +104075,13 @@
*/
function isImplementationExpression(node) {
switch (node.kind) {
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return isImplementationExpression(node.expression);
- case 197 /* ArrowFunction */:
- case 196 /* FunctionExpression */:
- case 188 /* ObjectLiteralExpression */:
- case 209 /* ClassExpression */:
- case 187 /* ArrayLiteralExpression */:
+ case 198 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
+ case 189 /* ObjectLiteralExpression */:
+ case 210 /* ClassExpression */:
+ case 188 /* ArrayLiteralExpression */:
return true;
default:
return false;
@@ -103202,13 +104134,13 @@
// Whether 'super' occurs in a static context within a class.
var staticFlag = 32 /* Static */;
switch (searchSpaceNode.kind) {
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
staticFlag &= ts.getModifierFlags(searchSpaceNode);
searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class
break;
@@ -103217,7 +104149,7 @@
}
var sourceFile = searchSpaceNode.getSourceFile();
var references = ts.mapDefined(getPossibleSymbolReferenceNodes(sourceFile, "super", searchSpaceNode), function (node) {
- if (node.kind !== 98 /* SuperKeyword */) {
+ if (node.kind !== 99 /* SuperKeyword */) {
return;
}
var container = ts.getSuperContainer(node, /*stopOnFunctions*/ false);
@@ -103229,41 +104161,41 @@
return [{ definition: { type: 0 /* Symbol */, symbol: searchSpaceNode.symbol }, references: references }];
}
function isParameterName(node) {
- return node.kind === 72 /* Identifier */ && node.parent.kind === 151 /* Parameter */ && node.parent.name === node;
+ return node.kind === 73 /* Identifier */ && node.parent.kind === 152 /* Parameter */ && node.parent.name === node;
}
function getReferencesForThisKeyword(thisOrSuperKeyword, sourceFiles, cancellationToken) {
var searchSpaceNode = ts.getThisContainer(thisOrSuperKeyword, /* includeArrowFunctions */ false);
// Whether 'this' occurs in a static context within a class.
var staticFlag = 32 /* Static */;
switch (searchSpaceNode.kind) {
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
if (ts.isObjectLiteralMethod(searchSpaceNode)) {
break;
}
// falls through
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
staticFlag &= ts.getModifierFlags(searchSpaceNode);
searchSpaceNode = searchSpaceNode.parent; // re-assign to be the owning class
break;
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
if (ts.isExternalModule(searchSpaceNode) || isParameterName(thisOrSuperKeyword)) {
return undefined;
}
// falls through
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
break;
// Computed properties in classes are not handled here because references to this are illegal,
// so there is no point finding references to them.
default:
return undefined;
}
- var references = ts.flatMap(searchSpaceNode.kind === 284 /* SourceFile */ ? sourceFiles : [searchSpaceNode.getSourceFile()], function (sourceFile) {
+ var references = ts.flatMap(searchSpaceNode.kind === 285 /* SourceFile */ ? sourceFiles : [searchSpaceNode.getSourceFile()], function (sourceFile) {
cancellationToken.throwIfCancellationRequested();
return getPossibleSymbolReferenceNodes(sourceFile, "this", ts.isSourceFile(searchSpaceNode) ? sourceFile : searchSpaceNode).filter(function (node) {
if (!ts.isThis(node)) {
@@ -103271,19 +104203,19 @@
}
var container = ts.getThisContainer(node, /* includeArrowFunctions */ false);
switch (searchSpaceNode.kind) {
- case 196 /* FunctionExpression */:
- case 239 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
return searchSpaceNode.symbol === container.symbol;
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
return ts.isObjectLiteralMethod(searchSpaceNode) && searchSpaceNode.symbol === container.symbol;
- case 209 /* ClassExpression */:
- case 240 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
// Make sure the container belongs to the same class
// and has the appropriate static modifier from the original container.
return container.parent && searchSpaceNode.symbol === container.parent.symbol && (ts.getModifierFlags(container) & 32 /* Static */) === staticFlag;
- case 284 /* SourceFile */:
- return container.kind === 284 /* SourceFile */ && !ts.isExternalModule(container) && !isParameterName(node);
+ case 285 /* SourceFile */:
+ return container.kind === 285 /* SourceFile */ && !ts.isExternalModule(container) && !isParameterName(node);
}
});
}).map(function (n) { return FindAllReferences.nodeEntry(n); });
@@ -103402,7 +104334,7 @@
});
}
function getPropertySymbolOfObjectBindingPatternWithoutPropertyName(symbol, checker) {
- var bindingElement = ts.getDeclarationOfKind(symbol, 186 /* BindingElement */);
+ var bindingElement = ts.getDeclarationOfKind(symbol, 187 /* BindingElement */);
if (bindingElement && ts.isObjectBindingElementWithoutPropertyName(bindingElement)) {
return ts.getPropertySymbolFromBindingElement(checker, bindingElement);
}
@@ -103761,7 +104693,7 @@
else {
var defs = getDefinitionFromSymbol(typeChecker, symbol, node) || ts.emptyArray;
// For a 'super()' call, put the signature first, else put the variable first.
- return node.kind === 98 /* SuperKeyword */ ? [sigInfo].concat(defs) : defs.concat([sigInfo]);
+ return node.kind === 99 /* SuperKeyword */ ? [sigInfo].concat(defs) : defs.concat([sigInfo]);
}
}
// Because name in short-hand property assignment has two different meanings: property name and property value,
@@ -103769,7 +104701,7 @@
// go to the declaration of the property name (in this case stay at the same position). However, if go-to-definition
// is performed at the location of property access, we would like to go to definition of the property in the short-hand
// assignment. This case and others are handled by the following code.
- if (node.parent.kind === 276 /* ShorthandPropertyAssignment */) {
+ if (node.parent.kind === 277 /* ShorthandPropertyAssignment */) {
var shorthandSymbol_1 = typeChecker.getShorthandAssignmentValueSymbol(symbol.valueDeclaration);
return shorthandSymbol_1 ? shorthandSymbol_1.declarations.map(function (decl) { return createDefinitionInfo(decl, typeChecker, shorthandSymbol_1, node); }) : [];
}
@@ -103922,18 +104854,18 @@
// (2) when the aliased symbol is originating from an import.
//
function shouldSkipAlias(node, declaration) {
- if (node.kind !== 72 /* Identifier */) {
+ if (node.kind !== 73 /* Identifier */) {
return false;
}
if (node.parent === declaration) {
return true;
}
switch (declaration.kind) {
- case 250 /* ImportClause */:
- case 248 /* ImportEqualsDeclaration */:
+ case 251 /* ImportClause */:
+ case 249 /* ImportEqualsDeclaration */:
return true;
- case 253 /* ImportSpecifier */:
- return declaration.parent.kind === 252 /* NamedImports */;
+ case 254 /* ImportSpecifier */:
+ return declaration.parent.kind === 253 /* NamedImports */;
default:
return false;
}
@@ -103943,7 +104875,7 @@
function getConstructSignatureDefinition() {
// Applicable only if we are in a new expression, or we are on a constructor declaration
// and in either case the symbol has a construct signature definition, i.e. class
- if (symbol.flags & 32 /* Class */ && (ts.isNewExpressionTarget(node) || node.kind === 124 /* ConstructorKeyword */)) {
+ if (symbol.flags & 32 /* Class */ && (ts.isNewExpressionTarget(node) || node.kind === 125 /* ConstructorKeyword */)) {
var cls = ts.find(symbol.declarations, ts.isClassLike) || ts.Debug.fail("Expected declaration to have at least one class-like declaration");
return getSignatureDefinition(cls.members, /*selectConstructors*/ true);
}
@@ -104017,9 +104949,9 @@
}
function isConstructorLike(node) {
switch (node.kind) {
- case 157 /* Constructor */:
- case 166 /* ConstructorType */:
- case 161 /* ConstructSignature */:
+ case 158 /* Constructor */:
+ case 167 /* ConstructorType */:
+ case 162 /* ConstructSignature */:
return true;
default:
return false;
@@ -104137,11 +105069,11 @@
JsDoc.getJsDocCommentsFromDeclarations = getJsDocCommentsFromDeclarations;
function getCommentHavingNodes(declaration) {
switch (declaration.kind) {
- case 304 /* JSDocParameterTag */:
- case 310 /* JSDocPropertyTag */:
+ case 305 /* JSDocParameterTag */:
+ case 311 /* JSDocPropertyTag */:
return [declaration];
- case 302 /* JSDocCallbackTag */:
- case 309 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
return [declaration, declaration.parent];
default:
return ts.getJSDocCommentsAndTags(declaration);
@@ -104162,16 +105094,16 @@
function getCommentText(tag) {
var comment = tag.comment;
switch (tag.kind) {
- case 300 /* JSDocAugmentsTag */:
+ case 301 /* JSDocAugmentsTag */:
return withNode(tag.class);
- case 308 /* JSDocTemplateTag */:
+ case 309 /* JSDocTemplateTag */:
return withList(tag.typeParameters);
- case 307 /* JSDocTypeTag */:
+ case 308 /* JSDocTypeTag */:
return withNode(tag.typeExpression);
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
- case 310 /* JSDocPropertyTag */:
- case 304 /* JSDocParameterTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
+ case 311 /* JSDocPropertyTag */:
+ case 305 /* JSDocParameterTag */:
var name = tag.name;
return name ? withNode(name) : comment;
default:
@@ -104348,7 +105280,7 @@
function parameterDocComments(parameters, isJavaScriptFile, indentationStr, newLine) {
return parameters.map(function (_a, i) {
var name = _a.name, dotDotDotToken = _a.dotDotDotToken;
- var paramName = name.kind === 72 /* Identifier */ ? name.text : "param" + i;
+ var paramName = name.kind === 73 /* Identifier */ ? name.text : "param" + i;
var type = isJavaScriptFile ? (dotDotDotToken ? "{...any} " : "{any} ") : "";
return indentationStr + " * @param " + type + paramName + newLine;
}).join("");
@@ -104358,23 +105290,23 @@
}
function getCommentOwnerInfoWorker(commentOwner) {
switch (commentOwner.kind) {
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 156 /* MethodDeclaration */:
- case 157 /* Constructor */:
- case 155 /* MethodSignature */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 157 /* MethodDeclaration */:
+ case 158 /* Constructor */:
+ case 156 /* MethodSignature */:
var parameters = commentOwner.parameters;
return { commentOwner: commentOwner, parameters: parameters };
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return getCommentOwnerInfoWorker(commentOwner.initializer);
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 153 /* PropertySignature */:
- case 243 /* EnumDeclaration */:
- case 278 /* EnumMember */:
- case 242 /* TypeAliasDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 154 /* PropertySignature */:
+ case 244 /* EnumDeclaration */:
+ case 279 /* EnumMember */:
+ case 243 /* TypeAliasDeclaration */:
return { commentOwner: commentOwner };
- case 219 /* VariableStatement */: {
+ case 220 /* VariableStatement */: {
var varStatement = commentOwner;
var varDeclarations = varStatement.declarationList.declarations;
var parameters_1 = varDeclarations.length === 1 && varDeclarations[0].initializer
@@ -104382,14 +105314,14 @@
: undefined;
return { commentOwner: commentOwner, parameters: parameters_1 };
}
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return "quit";
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
// If in walking up the tree, we hit a a nested namespace declaration,
// then we must be somewhere within a dotted namespace name; however we don't
// want to give back a JSDoc template for the 'b' or 'c' in 'namespace a.b.c { }'.
- return commentOwner.parent.kind === 244 /* ModuleDeclaration */ ? undefined : { commentOwner: commentOwner };
- case 204 /* BinaryExpression */: {
+ return commentOwner.parent.kind === 245 /* ModuleDeclaration */ ? undefined : { commentOwner: commentOwner };
+ case 205 /* BinaryExpression */: {
var be = commentOwner;
if (ts.getAssignmentDeclarationKind(be) === 0 /* None */) {
return "quit";
@@ -104408,14 +105340,14 @@
* @returns the parameters of a signature found on the RHS if one exists; otherwise 'emptyArray'.
*/
function getParametersFromRightHandSideOfAssignment(rightHandSide) {
- while (rightHandSide.kind === 195 /* ParenthesizedExpression */) {
+ while (rightHandSide.kind === 196 /* ParenthesizedExpression */) {
rightHandSide = rightHandSide.expression;
}
switch (rightHandSide.kind) {
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return rightHandSide.parameters;
- case 209 /* ClassExpression */: {
+ case 210 /* ClassExpression */: {
var ctr = ts.find(rightHandSide.members, ts.isConstructorDeclaration);
return ctr ? ctr.parameters : ts.emptyArray;
}
@@ -104477,9 +105409,9 @@
}
function shouldKeepItem(declaration, checker) {
switch (declaration.kind) {
- case 250 /* ImportClause */:
- case 253 /* ImportSpecifier */:
- case 248 /* ImportEqualsDeclaration */:
+ case 251 /* ImportClause */:
+ case 254 /* ImportSpecifier */:
+ case 249 /* ImportEqualsDeclaration */:
var importer = checker.getSymbolAtLocation(declaration.name); // TODO: GH#18217
var imported = checker.getAliasedSymbol(importer);
return importer.escapedName !== imported.escapedName;
@@ -104489,7 +105421,7 @@
}
function tryAddSingleDeclarationName(declaration, containers) {
var name = ts.getNameOfDeclaration(declaration);
- return !!name && (pushLiteral(name, containers) || name.kind === 149 /* ComputedPropertyName */ && tryAddComputedPropertyName(name.expression, containers));
+ return !!name && (pushLiteral(name, containers) || name.kind === 150 /* ComputedPropertyName */ && tryAddComputedPropertyName(name.expression, containers));
}
// Only added the names of computed properties if they're simple dotted expressions, like:
//
@@ -104506,7 +105438,7 @@
// First, if we started with a computed property name, then add all but the last
// portion into the container array.
var name = ts.getNameOfDeclaration(declaration);
- if (name && name.kind === 149 /* ComputedPropertyName */ && !tryAddComputedPropertyName(name.expression, containers)) {
+ if (name && name.kind === 150 /* ComputedPropertyName */ && !tryAddComputedPropertyName(name.expression, containers)) {
return ts.emptyArray;
}
// Don't include the last portion.
@@ -104675,7 +105607,7 @@
return;
}
switch (node.kind) {
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
// Get parameter properties, and treat them as being on the *same* level as the constructor, not under it.
var ctr = node;
addNodeWithRecursiveChild(ctr, ctr.body);
@@ -104687,21 +105619,21 @@
}
}
break;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 155 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 156 /* MethodSignature */:
if (!ts.hasDynamicName(node)) {
addNodeWithRecursiveChild(node, node.body);
}
break;
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
if (!ts.hasDynamicName(node)) {
addLeafNode(node);
}
break;
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
var importClause = node;
// Handle default import case e.g.:
// import d from "mod";
@@ -104713,7 +105645,7 @@
// import {a, b as B} from "mod";
var namedBindings = importClause.namedBindings;
if (namedBindings) {
- if (namedBindings.kind === 251 /* NamespaceImport */) {
+ if (namedBindings.kind === 252 /* NamespaceImport */) {
addLeafNode(namedBindings);
}
else {
@@ -104724,8 +105656,8 @@
}
}
break;
- case 186 /* BindingElement */:
- case 237 /* VariableDeclaration */:
+ case 187 /* BindingElement */:
+ case 238 /* VariableDeclaration */:
var _d = node, name = _d.name, initializer = _d.initializer;
if (ts.isBindingPattern(name)) {
addChildrenRecursively(name);
@@ -104746,12 +105678,12 @@
addNodeWithRecursiveChild(node, initializer);
}
break;
- case 197 /* ArrowFunction */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
addNodeWithRecursiveChild(node, node.body);
break;
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
startNode(node);
for (var _e = 0, _f = node.members; _e < _f.length; _e++) {
var member = _f[_e];
@@ -104761,9 +105693,9 @@
}
endNode();
break;
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
startNode(node);
for (var _g = 0, _h = node.members; _g < _h.length; _g++) {
var member = _h[_g];
@@ -104771,18 +105703,18 @@
}
endNode();
break;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
addNodeWithRecursiveChild(node, getInteriorModule(node).body);
break;
- case 257 /* ExportSpecifier */:
- case 248 /* ImportEqualsDeclaration */:
- case 162 /* IndexSignature */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 242 /* TypeAliasDeclaration */:
+ case 258 /* ExportSpecifier */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 163 /* IndexSignature */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 243 /* TypeAliasDeclaration */:
addLeafNode(node);
break;
- case 204 /* BinaryExpression */: {
+ case 205 /* BinaryExpression */: {
var special = ts.getAssignmentDeclarationKind(node);
switch (special) {
case 1 /* ExportsProperty */:
@@ -104864,12 +105796,12 @@
return false;
}
switch (a.kind) {
- case 154 /* PropertyDeclaration */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 155 /* PropertyDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return ts.hasModifier(a, 32 /* Static */) === ts.hasModifier(b, 32 /* Static */);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return areSameModule(a, b);
default:
return true;
@@ -104885,7 +105817,7 @@
// Only merge module nodes that have the same chain. Don't merge 'A.B.C' with 'A'!
function areSameModule(a, b) {
// TODO: GH#18217
- return a.body.kind === b.body.kind && (a.body.kind !== 244 /* ModuleDeclaration */ || areSameModule(a.body, b.body));
+ return a.body.kind === b.body.kind && (a.body.kind !== 245 /* ModuleDeclaration */ || areSameModule(a.body, b.body));
}
/** Merge source into target. Source should be thrown away after this is called. */
function merge(target, source) {
@@ -104915,7 +105847,7 @@
* So `new()` can still come before an `aardvark` method.
*/
function tryGetName(node) {
- if (node.kind === 244 /* ModuleDeclaration */) {
+ if (node.kind === 245 /* ModuleDeclaration */) {
return getModuleName(node);
}
var declName = ts.getNameOfDeclaration(node);
@@ -104923,16 +105855,16 @@
return ts.unescapeLeadingUnderscores(ts.getPropertyNameForPropertyNameNode(declName)); // TODO: GH#18217
}
switch (node.kind) {
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 209 /* ClassExpression */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 210 /* ClassExpression */:
return getFunctionOrClassName(node);
default:
return undefined;
}
}
function getItemName(node, name) {
- if (node.kind === 244 /* ModuleDeclaration */) {
+ if (node.kind === 245 /* ModuleDeclaration */) {
return getModuleName(node);
}
if (name) {
@@ -104942,16 +105874,16 @@
}
}
switch (node.kind) {
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
var sourceFile = node;
return ts.isExternalModule(sourceFile)
? "\"" + ts.escapeString(ts.getBaseFileName(ts.removeFileExtension(ts.normalizePath(sourceFile.fileName)))) + "\""
: "<global>";
- case 197 /* ArrowFunction */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 198 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
if (ts.getModifierFlags(node) & 512 /* Default */) {
return "default";
}
@@ -104959,13 +105891,13 @@
// (eg: "app\n.onactivated"), so we should remove the whitespace for readabiltiy in the
// navigation bar.
return getFunctionOrClassName(node);
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return "constructor";
- case 161 /* ConstructSignature */:
+ case 162 /* ConstructSignature */:
return "new()";
- case 160 /* CallSignature */:
+ case 161 /* CallSignature */:
return "()";
- case 162 /* IndexSignature */:
+ case 163 /* IndexSignature */:
return "[]";
default:
return "<unknown>";
@@ -104989,25 +105921,25 @@
return topLevel;
function isTopLevel(item) {
switch (navigationBarNodeKind(item)) {
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 243 /* EnumDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 284 /* SourceFile */:
- case 242 /* TypeAliasDeclaration */:
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
- return true;
- case 157 /* Constructor */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 237 /* VariableDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 244 /* EnumDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 285 /* SourceFile */:
+ case 243 /* TypeAliasDeclaration */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
+ return true;
+ case 158 /* Constructor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 238 /* VariableDeclaration */:
return hasSomeImportantChild(item);
- case 197 /* ArrowFunction */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
return isTopLevelFunctionDeclaration(item);
default:
return false;
@@ -105017,10 +105949,10 @@
return false;
}
switch (navigationBarNodeKind(item.parent)) {
- case 245 /* ModuleBlock */:
- case 284 /* SourceFile */:
- case 156 /* MethodDeclaration */:
- case 157 /* Constructor */:
+ case 246 /* ModuleBlock */:
+ case 285 /* SourceFile */:
+ case 157 /* MethodDeclaration */:
+ case 158 /* Constructor */:
return true;
default:
return hasSomeImportantChild(item);
@@ -105029,7 +105961,7 @@
function hasSomeImportantChild(item) {
return ts.some(item.children, function (child) {
var childKind = navigationBarNodeKind(child);
- return childKind !== 237 /* VariableDeclaration */ && childKind !== 186 /* BindingElement */;
+ return childKind !== 238 /* VariableDeclaration */ && childKind !== 187 /* BindingElement */;
});
}
}
@@ -105086,7 +106018,7 @@
// Otherwise, we need to aggregate each identifier to build up the qualified name.
var result = [];
result.push(ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name));
- while (moduleDeclaration.body && moduleDeclaration.body.kind === 244 /* ModuleDeclaration */) {
+ while (moduleDeclaration.body && moduleDeclaration.body.kind === 245 /* ModuleDeclaration */) {
moduleDeclaration = moduleDeclaration.body;
result.push(ts.getTextOfIdentifierOrLiteral(moduleDeclaration.name));
}
@@ -105100,13 +106032,13 @@
return decl.body && ts.isModuleDeclaration(decl.body) ? getInteriorModule(decl.body) : decl;
}
function isComputedProperty(member) {
- return !member.name || member.name.kind === 149 /* ComputedPropertyName */;
+ return !member.name || member.name.kind === 150 /* ComputedPropertyName */;
}
function getNodeSpan(node) {
- return node.kind === 284 /* SourceFile */ ? ts.createTextSpanFromRange(node) : ts.createTextSpanFromNode(node, curSourceFile);
+ return node.kind === 285 /* SourceFile */ ? ts.createTextSpanFromRange(node) : ts.createTextSpanFromNode(node, curSourceFile);
}
function getModifiers(node) {
- if (node.parent && node.parent.kind === 237 /* VariableDeclaration */) {
+ if (node.parent && node.parent.kind === 238 /* VariableDeclaration */) {
node = node.parent;
}
return ts.getNodeModifiers(node);
@@ -105121,7 +106053,7 @@
return ts.declarationNameToString(parent.name);
}
// See if it is of the form "<expr> = function(){...}". If so, use the text from the left-hand side.
- else if (ts.isBinaryExpression(parent) && parent.operatorToken.kind === 59 /* EqualsToken */) {
+ else if (ts.isBinaryExpression(parent) && parent.operatorToken.kind === 60 /* EqualsToken */) {
return nodeText(parent.left).replace(whiteSpaceRegex, "");
}
// See if it is a property assignment, and if so use the property name
@@ -105159,9 +106091,9 @@
}
function isFunctionOrClassExpression(node) {
switch (node.kind) {
- case 197 /* ArrowFunction */:
- case 196 /* FunctionExpression */:
- case 209 /* ClassExpression */:
+ case 198 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
+ case 210 /* ClassExpression */:
return true;
default:
return false;
@@ -105488,7 +106420,7 @@
}
var lastImport = current - 1;
if (lastImport !== firstImport) {
- out.push(createOutliningSpanFromBounds(ts.findChildOfKind(statements[firstImport], 92 /* ImportKeyword */, sourceFile).getStart(sourceFile), statements[lastImport].getEnd(), "imports" /* Imports */));
+ out.push(createOutliningSpanFromBounds(ts.findChildOfKind(statements[firstImport], 93 /* ImportKeyword */, sourceFile).getStart(sourceFile), statements[lastImport].getEnd(), "imports" /* Imports */));
}
}
function visitNonImportNode(n) {
@@ -105605,31 +106537,31 @@
}
function getOutliningSpanForNode(n, sourceFile) {
switch (n.kind) {
- case 218 /* Block */:
- if (ts.isFunctionBlock(n)) {
- return spanForNode(n.parent, /*autoCollapse*/ n.parent.kind !== 197 /* ArrowFunction */);
+ case 219 /* Block */:
+ if (ts.isFunctionLike(n.parent)) {
+ return functionSpan(n.parent, n, sourceFile);
}
// Check if the block is standalone, or 'attached' to some parent statement.
// If the latter, we want to collapse the block, but consider its hint span
// to be the entire span of the parent.
switch (n.parent.kind) {
- case 223 /* DoStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 225 /* ForStatement */:
- case 222 /* IfStatement */:
- case 224 /* WhileStatement */:
- case 231 /* WithStatement */:
- case 274 /* CatchClause */:
+ case 224 /* DoStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 226 /* ForStatement */:
+ case 223 /* IfStatement */:
+ case 225 /* WhileStatement */:
+ case 232 /* WithStatement */:
+ case 275 /* CatchClause */:
return spanForNode(n.parent);
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
// Could be the try-block, or the finally-block.
var tryStatement = n.parent;
if (tryStatement.tryBlock === n) {
return spanForNode(n.parent);
}
else if (tryStatement.finallyBlock === n) {
- return spanForNode(ts.findChildOfKind(tryStatement, 88 /* FinallyKeyword */, sourceFile));
+ return spanForNode(ts.findChildOfKind(tryStatement, 89 /* FinallyKeyword */, sourceFile));
}
// falls through
default:
@@ -105637,22 +106569,22 @@
// the span of the block, independent of any parent span.
return createOutliningSpan(ts.createTextSpanFromNode(n, sourceFile), "code" /* Code */);
}
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
return spanForNode(n.parent);
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
- case 246 /* CaseBlock */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 247 /* CaseBlock */:
return spanForNode(n);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return spanForObjectOrArrayLiteral(n);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return spanForObjectOrArrayLiteral(n, 22 /* OpenBracketToken */);
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
return spanForJSXElement(n);
- case 261 /* JsxSelfClosingElement */:
- case 262 /* JsxOpeningElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
return spanForJSXAttributes(n.attributes);
}
function spanForJSXElement(node) {
@@ -105674,20 +106606,29 @@
// Otherwise, the collapsed section will include the end of the previous line.
return spanForNode(node, /*autoCollapse*/ false, /*useFullStart*/ !ts.isArrayLiteralExpression(node.parent) && !ts.isCallExpression(node.parent), open);
}
- function spanForNode(hintSpanNode, autoCollapse, useFullStart, open) {
+ function spanForNode(hintSpanNode, autoCollapse, useFullStart, open, close) {
if (autoCollapse === void 0) { autoCollapse = false; }
if (useFullStart === void 0) { useFullStart = true; }
if (open === void 0) { open = 18 /* OpenBraceToken */; }
+ if (close === void 0) { close = open === 18 /* OpenBraceToken */ ? 19 /* CloseBraceToken */ : 23 /* CloseBracketToken */; }
var openToken = ts.findChildOfKind(n, open, sourceFile);
- var close = open === 18 /* OpenBraceToken */ ? 19 /* CloseBraceToken */ : 23 /* CloseBracketToken */;
var closeToken = ts.findChildOfKind(n, close, sourceFile);
- if (!openToken || !closeToken) {
- return undefined;
+ return openToken && closeToken && spanBetweenTokens(openToken, closeToken, hintSpanNode, sourceFile, autoCollapse, useFullStart);
+ }
}
+ function functionSpan(node, body, sourceFile) {
+ var openToken = ts.isNodeArrayMultiLine(node.parameters, sourceFile)
+ ? ts.findChildOfKind(node, 20 /* OpenParenToken */, sourceFile)
+ : ts.findChildOfKind(body, 18 /* OpenBraceToken */, sourceFile);
+ var closeToken = ts.findChildOfKind(body, 19 /* CloseBraceToken */, sourceFile);
+ return openToken && closeToken && spanBetweenTokens(openToken, closeToken, node.parent, sourceFile, /*autoCollapse*/ node.parent.kind !== 198 /* ArrowFunction */);
+ }
+ function spanBetweenTokens(openToken, closeToken, hintSpanNode, sourceFile, autoCollapse, useFullStart) {
+ if (autoCollapse === void 0) { autoCollapse = false; }
+ if (useFullStart === void 0) { useFullStart = true; }
var textSpan = ts.createTextSpanFromBounds(useFullStart ? openToken.getFullStart() : openToken.getStart(sourceFile), closeToken.getEnd());
return createOutliningSpan(textSpan, "code" /* Code */, ts.createTextSpanFromNode(hintSpanNode, sourceFile), autoCollapse);
}
- }
function createOutliningSpan(textSpan, kind, hintSpan, autoCollapse, bannerText) {
if (hintSpan === void 0) { hintSpan = textSpan; }
if (autoCollapse === void 0) { autoCollapse = false; }
@@ -105950,7 +106891,7 @@
if (ch >= 65 /* A */ && ch <= 90 /* Z */) {
return true;
}
- if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 7 /* Latest */)) {
+ if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 8 /* Latest */)) {
return false;
}
// TODO: find a way to determine this for any unicode characters in a
@@ -105963,7 +106904,7 @@
if (ch >= 97 /* a */ && ch <= 122 /* z */) {
return true;
}
- if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 7 /* Latest */)) {
+ if (ch < 127 /* maxAsciiCharacter */ || !ts.isUnicodeIdentifierStart(ch, 8 /* Latest */)) {
return false;
}
// TODO: find a way to determine this for any unicode characters in a
@@ -106215,10 +107156,10 @@
*/
function tryConsumeDeclare() {
var token = ts.scanner.getToken();
- if (token === 125 /* DeclareKeyword */) {
+ if (token === 126 /* DeclareKeyword */) {
// declare module "mod"
token = nextToken();
- if (token === 130 /* ModuleKeyword */) {
+ if (token === 131 /* ModuleKeyword */) {
token = nextToken();
if (token === 10 /* StringLiteral */) {
recordAmbientExternalModule();
@@ -106236,7 +107177,7 @@
return false;
}
var token = ts.scanner.getToken();
- if (token === 92 /* ImportKeyword */) {
+ if (token === 93 /* ImportKeyword */) {
token = nextToken();
if (token === 20 /* OpenParenToken */) {
token = nextToken();
@@ -106252,9 +107193,9 @@
return true;
}
else {
- if (token === 72 /* Identifier */ || ts.isKeyword(token)) {
+ if (token === 73 /* Identifier */ || ts.isKeyword(token)) {
token = nextToken();
- if (token === 144 /* FromKeyword */) {
+ if (token === 145 /* FromKeyword */) {
token = nextToken();
if (token === 10 /* StringLiteral */) {
// import d from "mod";
@@ -106262,7 +107203,7 @@
return true;
}
}
- else if (token === 59 /* EqualsToken */) {
+ else if (token === 60 /* EqualsToken */) {
if (tryConsumeRequireCall(/*skipCurrentToken*/ true)) {
return true;
}
@@ -106285,7 +107226,7 @@
}
if (token === 19 /* CloseBraceToken */) {
token = nextToken();
- if (token === 144 /* FromKeyword */) {
+ if (token === 145 /* FromKeyword */) {
token = nextToken();
if (token === 10 /* StringLiteral */) {
// import {a as A} from "mod";
@@ -106297,11 +107238,11 @@
}
else if (token === 40 /* AsteriskToken */) {
token = nextToken();
- if (token === 119 /* AsKeyword */) {
+ if (token === 120 /* AsKeyword */) {
token = nextToken();
- if (token === 72 /* Identifier */ || ts.isKeyword(token)) {
+ if (token === 73 /* Identifier */ || ts.isKeyword(token)) {
token = nextToken();
- if (token === 144 /* FromKeyword */) {
+ if (token === 145 /* FromKeyword */) {
token = nextToken();
if (token === 10 /* StringLiteral */) {
// import * as NS from "mod"
@@ -106319,7 +107260,7 @@
}
function tryConsumeExport() {
var token = ts.scanner.getToken();
- if (token === 85 /* ExportKeyword */) {
+ if (token === 86 /* ExportKeyword */) {
markAsExternalModuleIfTopLevel();
token = nextToken();
if (token === 18 /* OpenBraceToken */) {
@@ -106331,7 +107272,7 @@
}
if (token === 19 /* CloseBraceToken */) {
token = nextToken();
- if (token === 144 /* FromKeyword */) {
+ if (token === 145 /* FromKeyword */) {
token = nextToken();
if (token === 10 /* StringLiteral */) {
// export {a as A} from "mod";
@@ -106343,7 +107284,7 @@
}
else if (token === 40 /* AsteriskToken */) {
token = nextToken();
- if (token === 144 /* FromKeyword */) {
+ if (token === 145 /* FromKeyword */) {
token = nextToken();
if (token === 10 /* StringLiteral */) {
// export * from "mod"
@@ -106351,11 +107292,11 @@
}
}
}
- else if (token === 92 /* ImportKeyword */) {
+ else if (token === 93 /* ImportKeyword */) {
token = nextToken();
- if (token === 72 /* Identifier */ || ts.isKeyword(token)) {
+ if (token === 73 /* Identifier */ || ts.isKeyword(token)) {
token = nextToken();
- if (token === 59 /* EqualsToken */) {
+ if (token === 60 /* EqualsToken */) {
if (tryConsumeRequireCall(/*skipCurrentToken*/ true)) {
return true;
}
@@ -106368,7 +107309,7 @@
}
function tryConsumeRequireCall(skipCurrentToken) {
var token = skipCurrentToken ? nextToken() : ts.scanner.getToken();
- if (token === 134 /* RequireKeyword */) {
+ if (token === 135 /* RequireKeyword */) {
token = nextToken();
if (token === 20 /* OpenParenToken */) {
token = nextToken();
@@ -106383,7 +107324,7 @@
}
function tryConsumeDefine() {
var token = ts.scanner.getToken();
- if (token === 72 /* Identifier */ && ts.scanner.getTokenValue() === "define") {
+ if (token === 73 /* Identifier */ && ts.scanner.getTokenValue() === "define") {
token = nextToken();
if (token !== 20 /* OpenParenToken */) {
return true;
@@ -106517,14 +107458,14 @@
return getRenameInfoError(ts.Diagnostics.You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library);
}
// Cannot rename `default` as in `import { default as foo } from "./someModule";
- if (ts.isIdentifier(node) && node.originalKeywordKind === 80 /* DefaultKeyword */ && symbol.parent.flags & 1536 /* Module */) {
+ if (ts.isIdentifier(node) && node.originalKeywordKind === 81 /* DefaultKeyword */ && symbol.parent.flags & 1536 /* Module */) {
return undefined;
}
if (ts.isStringLiteralLike(node) && ts.tryGetImportFromModuleSpecifier(node)) {
return options && options.allowRenameOfImportPath ? getRenameInfoForModule(node, sourceFile, symbol) : undefined;
}
var kind = ts.SymbolDisplay.getSymbolKind(typeChecker, symbol, node);
- var specifierName = (ts.isImportOrExportSpecifierName(node) || ts.isStringOrNumericLiteralLike(node) && node.parent.kind === 149 /* ComputedPropertyName */)
+ var specifierName = (ts.isImportOrExportSpecifierName(node) || ts.isStringOrNumericLiteralLike(node) && node.parent.kind === 150 /* ComputedPropertyName */)
? ts.stripQuotes(ts.getTextOfIdentifierOrLiteral(node))
: undefined;
var displayName = specifierName || typeChecker.symbolToString(symbol);
@@ -106580,9 +107521,9 @@
}
function nodeIsEligibleForRename(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
case 10 /* StringLiteral */:
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
return true;
case 8 /* NumericLiteral */:
return ts.isLiteralNameOfPropertyDeclarationOrIndexAccess(node);
@@ -106595,6 +107536,275 @@
/* @internal */
var ts;
(function (ts) {
+ var SmartSelectionRange;
+ (function (SmartSelectionRange) {
+ function getSmartSelectionRange(pos, sourceFile) {
+ var selectionRange = {
+ textSpan: ts.createTextSpanFromBounds(sourceFile.getFullStart(), sourceFile.getEnd())
+ };
+ var parentNode = sourceFile;
+ outer: while (true) {
+ var children = getSelectionChildren(parentNode);
+ if (!children.length)
+ break;
+ for (var i = 0; i < children.length; i++) {
+ var prevNode = children[i - 1];
+ var node = children[i];
+ var nextNode = children[i + 1];
+ if (node.getStart(sourceFile) > pos) {
+ break outer;
+ }
+ if (positionShouldSnapToNode(pos, node, nextNode)) {
+ // 1. Blocks are effectively redundant with SyntaxLists.
+ // 2. TemplateSpans, along with the SyntaxLists containing them, are a somewhat unintuitive grouping
+ // of things that should be considered independently.
+ // 3. A VariableStatement’s children are just a VaraiableDeclarationList and a semicolon.
+ // 4. A lone VariableDeclaration in a VaraibleDeclaration feels redundant with the VariableStatement.
+ //
+ // Dive in without pushing a selection range.
+ if (ts.isBlock(node)
+ || ts.isTemplateSpan(node) || ts.isTemplateHead(node)
+ || prevNode && ts.isTemplateHead(prevNode)
+ || ts.isVariableDeclarationList(node) && ts.isVariableStatement(parentNode)
+ || ts.isSyntaxList(node) && ts.isVariableDeclarationList(parentNode)
+ || ts.isVariableDeclaration(node) && ts.isSyntaxList(parentNode) && children.length === 1) {
+ parentNode = node;
+ break;
+ }
+ // Synthesize a stop for '${ ... }' since '${' and '}' actually belong to siblings.
+ if (ts.isTemplateSpan(parentNode) && nextNode && ts.isTemplateMiddleOrTemplateTail(nextNode)) {
+ var start_2 = node.getFullStart() - "${".length;
+ var end_2 = nextNode.getStart() + "}".length;
+ pushSelectionRange(start_2, end_2);
+ }
+ // Blocks with braces, brackets, parens, or JSX tags on separate lines should be
+ // selected from open to close, including whitespace but not including the braces/etc. themselves.
+ var isBetweenMultiLineBookends = ts.isSyntaxList(node)
+ && isListOpener(prevNode)
+ && isListCloser(nextNode)
+ && !ts.positionsAreOnSameLine(prevNode.getStart(), nextNode.getStart(), sourceFile);
+ var jsDocCommentStart = ts.hasJSDocNodes(node) && node.jsDoc[0].getStart();
+ var start = isBetweenMultiLineBookends ? prevNode.getEnd() : node.getStart();
+ var end = isBetweenMultiLineBookends ? nextNode.getStart() : node.getEnd();
+ if (ts.isNumber(jsDocCommentStart)) {
+ pushSelectionRange(jsDocCommentStart, end);
+ }
+ pushSelectionRange(start, end);
+ // String literals should have a stop both inside and outside their quotes.
+ if (ts.isStringLiteral(node) || ts.isTemplateLiteral(node)) {
+ pushSelectionRange(start + 1, end - 1);
+ }
+ parentNode = node;
+ break;
+ }
+ }
+ }
+ return selectionRange;
+ function pushSelectionRange(start, end) {
+ // Skip empty ranges
+ if (start !== end) {
+ // Skip ranges that are identical to the parent
+ var textSpan = ts.createTextSpanFromBounds(start, end);
+ if (!selectionRange || !ts.textSpansEqual(textSpan, selectionRange.textSpan)) {
+ selectionRange = __assign({ textSpan: textSpan }, selectionRange && { parent: selectionRange });
+ }
+ }
+ }
+ }
+ SmartSelectionRange.getSmartSelectionRange = getSmartSelectionRange;
+ /**
+ * Like `ts.positionBelongsToNode`, except positions immediately after nodes
+ * count too, unless that position belongs to the next node. In effect, makes
+ * selections able to snap to preceding tokens when the cursor is on the tail
+ * end of them with only whitespace ahead.
+ * @param pos The position to check.
+ * @param node The candidate node to snap to.
+ * @param nextNode The next sibling node in the tree.
+ * @param sourceFile The source file containing the nodes.
+ */
+ function positionShouldSnapToNode(pos, node, nextNode) {
+ // Can’t use 'ts.positionBelongsToNode()' here because it cleverly accounts
+ // for missing nodes, which can’t really be considered when deciding what
+ // to select.
+ ts.Debug.assert(node.pos <= pos);
+ if (pos < node.end) {
+ return true;
+ }
+ var nodeEnd = node.getEnd();
+ var nextNodeStart = nextNode && nextNode.getStart();
+ if (nodeEnd === pos) {
+ return pos !== nextNodeStart;
+ }
+ return false;
+ }
+ var isImport = ts.or(ts.isImportDeclaration, ts.isImportEqualsDeclaration);
+ /**
+ * Gets the children of a node to be considered for selection ranging,
+ * transforming them into an artificial tree according to their intuitive
+ * grouping where no grouping actually exists in the parse tree. For example,
+ * top-level imports are grouped into their own SyntaxList so they can be
+ * selected all together, even though in the AST they’re just siblings of each
+ * other as well as of other top-level statements and declarations.
+ */
+ function getSelectionChildren(node) {
+ // Group top-level imports
+ if (ts.isSourceFile(node)) {
+ return groupChildren(node.getChildAt(0).getChildren(), isImport);
+ }
+ // Mapped types _look_ like ObjectTypes with a single member,
+ // but in fact don’t contain a SyntaxList or a node containing
+ // the “key/value” pair like ObjectTypes do, but it seems intuitive
+ // that the selection would snap to those points. The philosophy
+ // of choosing a selection range is not so much about what the
+ // syntax currently _is_ as what the syntax might easily become
+ // if the user is making a selection; e.g., we synthesize a selection
+ // around the “key/value” pair not because there’s a node there, but
+ // because it allows the mapped type to become an object type with a
+ // few keystrokes.
+ if (ts.isMappedTypeNode(node)) {
+ var _a = node.getChildren(), openBraceToken = _a[0], children = _a.slice(1);
+ var closeBraceToken = ts.Debug.assertDefined(children.pop());
+ ts.Debug.assertEqual(openBraceToken.kind, 18 /* OpenBraceToken */);
+ ts.Debug.assertEqual(closeBraceToken.kind, 19 /* CloseBraceToken */);
+ // Group `-/+readonly` and `-/+?`
+ var groupedWithPlusMinusTokens = groupChildren(children, function (child) {
+ return child === node.readonlyToken || child.kind === 134 /* ReadonlyKeyword */ ||
+ child === node.questionToken || child.kind === 56 /* QuestionToken */;
+ });
+ // Group type parameter with surrounding brackets
+ var groupedWithBrackets = groupChildren(groupedWithPlusMinusTokens, function (_a) {
+ var kind = _a.kind;
+ return kind === 22 /* OpenBracketToken */ ||
+ kind === 151 /* TypeParameter */ ||
+ kind === 23 /* CloseBracketToken */;
+ });
+ return [
+ openBraceToken,
+ // Pivot on `:`
+ createSyntaxList(splitChildren(groupedWithBrackets, function (_a) {
+ var kind = _a.kind;
+ return kind === 57 /* ColonToken */;
+ })),
+ closeBraceToken,
+ ];
+ }
+ // Group modifiers and property name, then pivot on `:`.
+ if (ts.isPropertySignature(node)) {
+ var children = groupChildren(node.getChildren(), function (child) {
+ return child === node.name || ts.contains(node.modifiers, child);
+ });
+ return splitChildren(children, function (_a) {
+ var kind = _a.kind;
+ return kind === 57 /* ColonToken */;
+ });
+ }
+ // Group the parameter name with its `...`, then that group with its `?`, then pivot on `=`.
+ if (ts.isParameter(node)) {
+ var groupedDotDotDotAndName_1 = groupChildren(node.getChildren(), function (child) {
+ return child === node.dotDotDotToken || child === node.name;
+ });
+ var groupedWithQuestionToken = groupChildren(groupedDotDotDotAndName_1, function (child) {
+ return child === groupedDotDotDotAndName_1[0] || child === node.questionToken;
+ });
+ return splitChildren(groupedWithQuestionToken, function (_a) {
+ var kind = _a.kind;
+ return kind === 60 /* EqualsToken */;
+ });
+ }
+ // Pivot on '='
+ if (ts.isBindingElement(node)) {
+ return splitChildren(node.getChildren(), function (_a) {
+ var kind = _a.kind;
+ return kind === 60 /* EqualsToken */;
+ });
+ }
+ return node.getChildren();
+ }
+ /**
+ * Groups sibling nodes together into their own SyntaxList if they
+ * a) are adjacent, AND b) match a predicate function.
+ */
+ function groupChildren(children, groupOn) {
+ var result = [];
+ var group;
+ for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {
+ var child = children_1[_i];
+ if (groupOn(child)) {
+ group = group || [];
+ group.push(child);
+ }
+ else {
+ if (group) {
+ result.push(createSyntaxList(group));
+ group = undefined;
+ }
+ result.push(child);
+ }
+ }
+ if (group) {
+ result.push(createSyntaxList(group));
+ }
+ return result;
+ }
+ /**
+ * Splits sibling nodes into up to four partitions:
+ * 1) everything left of the first node matched by `pivotOn`,
+ * 2) the first node matched by `pivotOn`,
+ * 3) everything right of the first node matched by `pivotOn`,
+ * 4) a trailing semicolon, if `separateTrailingSemicolon` is enabled.
+ * The left and right groups, if not empty, will each be grouped into their own containing SyntaxList.
+ * @param children The sibling nodes to split.
+ * @param pivotOn The predicate function to match the node to be the pivot. The first node that matches
+ * the predicate will be used; any others that may match will be included into the right-hand group.
+ * @param separateTrailingSemicolon If the last token is a semicolon, it will be returned as a separate
+ * child rather than be included in the right-hand group.
+ */
+ function splitChildren(children, pivotOn, separateTrailingSemicolon) {
+ if (separateTrailingSemicolon === void 0) { separateTrailingSemicolon = true; }
+ if (children.length < 2) {
+ return children;
+ }
+ var splitTokenIndex = ts.findIndex(children, pivotOn);
+ if (splitTokenIndex === -1) {
+ return children;
+ }
+ var leftChildren = children.slice(0, splitTokenIndex);
+ var splitToken = children[splitTokenIndex];
+ var lastToken = ts.last(children);
+ var separateLastToken = separateTrailingSemicolon && lastToken.kind === 26 /* SemicolonToken */;
+ var rightChildren = children.slice(splitTokenIndex + 1, separateLastToken ? children.length - 1 : undefined);
+ var result = ts.compact([
+ leftChildren.length ? createSyntaxList(leftChildren) : undefined,
+ splitToken,
+ rightChildren.length ? createSyntaxList(rightChildren) : undefined,
+ ]);
+ return separateLastToken ? result.concat(lastToken) : result;
+ }
+ function createSyntaxList(children) {
+ ts.Debug.assertGreaterThanOrEqual(children.length, 1);
+ var syntaxList = ts.createNode(312 /* SyntaxList */, children[0].pos, ts.last(children).end);
+ syntaxList._children = children;
+ return syntaxList;
+ }
+ function isListOpener(token) {
+ var kind = token && token.kind;
+ return kind === 18 /* OpenBraceToken */
+ || kind === 22 /* OpenBracketToken */
+ || kind === 20 /* OpenParenToken */
+ || kind === 263 /* JsxOpeningElement */;
+ }
+ function isListCloser(token) {
+ var kind = token && token.kind;
+ return kind === 19 /* CloseBraceToken */
+ || kind === 23 /* CloseBracketToken */
+ || kind === 21 /* CloseParenToken */
+ || kind === 264 /* JsxClosingElement */;
+ }
+ })(SmartSelectionRange = ts.SmartSelectionRange || (ts.SmartSelectionRange = {}));
+})(ts || (ts = {}));
+/* @internal */
+var ts;
+(function (ts) {
var SignatureHelp;
(function (SignatureHelp) {
var InvocationKind;
@@ -106705,9 +107915,22 @@
});
}
function containsPrecedingToken(startingToken, sourceFile, container) {
- var precedingToken = ts.Debug.assertDefined(ts.findPrecedingToken(startingToken.getFullStart(), sourceFile, startingToken.parent, /*excludeJsdoc*/ true));
+ var pos = startingToken.getFullStart();
+ // There’s a possibility that `startingToken.parent` contains only `startingToken` and
+ // missing nodes, none of which are valid to be returned by `findPrecedingToken`. In that
+ // case, the preceding token we want is actually higher up the tree—almost definitely the
+ // next parent, but theoretically the situation with missing nodes might be happening on
+ // multiple nested levels.
+ var currentParent = startingToken.parent;
+ while (currentParent) {
+ var precedingToken = ts.findPrecedingToken(pos, sourceFile, currentParent, /*excludeJsdoc*/ true);
+ if (precedingToken) {
return ts.rangeContainsRange(container, precedingToken);
}
+ currentParent = currentParent.parent;
+ }
+ return ts.Debug.fail("Could not find preceding token");
+ }
function getArgumentInfoForCompletions(node, position, sourceFile) {
var info = getImmediatelyContainingArgumentInfo(node, position, sourceFile);
return !info || info.isTypeParameterList || info.invocation.kind !== 0 /* Call */ ? undefined
@@ -106780,10 +108003,10 @@
}
return undefined;
}
- else if (ts.isTemplateHead(node) && parent.parent.kind === 193 /* TaggedTemplateExpression */) {
+ else if (ts.isTemplateHead(node) && parent.parent.kind === 194 /* TaggedTemplateExpression */) {
var templateExpression = parent;
var tagExpression = templateExpression.parent;
- ts.Debug.assert(templateExpression.kind === 206 /* TemplateExpression */);
+ ts.Debug.assert(templateExpression.kind === 207 /* TemplateExpression */);
var argumentIndex = ts.isInsideTemplateLiteral(node, position, sourceFile) ? 0 : 1;
return getArgumentListInfoForTemplate(tagExpression, argumentIndex, sourceFile);
}
@@ -106850,17 +108073,17 @@
return undefined;
var parent = startingToken.parent;
switch (parent.kind) {
- case 195 /* ParenthesizedExpression */:
- case 156 /* MethodDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 196 /* ParenthesizedExpression */:
+ case 157 /* MethodDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
var info = getArgumentOrParameterListInfo(startingToken, sourceFile);
if (!info)
return undefined;
var argumentIndex = info.argumentIndex, argumentCount = info.argumentCount, argumentsSpan = info.argumentsSpan;
var contextualType = ts.isMethodDeclaration(parent) ? checker.getContextualTypeForObjectLiteralElement(parent) : checker.getContextualType(parent);
return contextualType && { contextualType: contextualType, argumentIndex: argumentIndex, argumentCount: argumentCount, argumentsSpan: argumentsSpan };
- case 204 /* BinaryExpression */: {
+ case 205 /* BinaryExpression */: {
var highestBinary = getHighestBinary(parent);
var contextualType_1 = checker.getContextualType(highestBinary);
var argumentIndex_1 = startingToken.kind === 20 /* OpenParenToken */ ? 0 : countBinaryExpressionParameters(parent) - 1;
@@ -106984,7 +108207,7 @@
// | |
// This is because a Missing node has no width. However, what we actually want is to include trivia
// leading up to the next token in case the user is about to type in a TemplateMiddle or TemplateTail.
- if (template.kind === 206 /* TemplateExpression */) {
+ if (template.kind === 207 /* TemplateExpression */) {
var lastSpan = ts.last(template.templateSpans);
if (lastSpan.literal.getFullWidth() === 0) {
applicableSpanEnd = ts.skipTrivia(sourceFile.text, applicableSpanEnd, /*stopAfterLineBreak*/ false);
@@ -106996,7 +108219,7 @@
var _loop_7 = function (n) {
// If the node is not a subspan of its parent, this is a big problem.
// There have been crashes that might be caused by this violation.
- ts.Debug.assert(ts.rangeContainsRange(n.parent, n), "Not a subspan", function () { return "Child: " + ts.Debug.showSyntaxKind(n) + ", parent: " + ts.Debug.showSyntaxKind(n.parent); });
+ ts.Debug.assert(ts.rangeContainsRange(n.parent, n), "Not a subspan", function () { return "Child: " + ts.Debug.formatSyntaxKind(n.kind) + ", parent: " + ts.Debug.formatSyntaxKind(n.parent.kind); });
var argumentInfo = getImmediatelyContainingArgumentOrContextualParameterInfo(n, position, sourceFile, checker);
if (argumentInfo) {
return { value: argumentInfo };
@@ -107296,7 +108519,7 @@
function check(node) {
if (isJsFile) {
switch (node.kind) {
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
var decl = ts.getDeclarationOfExpando(node);
if (decl) {
var symbol_1 = decl.symbol;
@@ -107306,7 +108529,7 @@
}
}
// falls through if no diagnostic was created
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
var symbol = node.symbol;
if (symbol.members && (symbol.members.size > 0)) {
diags.push(ts.createDiagnosticForNode(ts.isVariableDeclaration(node.parent) ? node.parent.name : node, ts.Diagnostics.This_constructor_function_may_be_converted_to_a_class_declaration));
@@ -107339,11 +108562,11 @@
function containsTopLevelCommonjs(sourceFile) {
return sourceFile.statements.some(function (statement) {
switch (statement.kind) {
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return statement.declarationList.declarations.some(function (decl) {
return !!decl.initializer && ts.isRequireCall(propertyAccessLeftHandSide(decl.initializer), /*checkArgumentIsStringLiteralLike*/ true);
});
- case 221 /* ExpressionStatement */: {
+ case 222 /* ExpressionStatement */: {
var expression = statement.expression;
if (!ts.isBinaryExpression(expression))
return ts.isRequireCall(expression, /*checkArgumentIsStringLiteralLike*/ true);
@@ -107360,12 +108583,12 @@
}
function importNameForConvertToDefaultImport(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
var importClause = node.importClause, moduleSpecifier = node.moduleSpecifier;
- return importClause && !importClause.name && importClause.namedBindings && importClause.namedBindings.kind === 251 /* NamespaceImport */ && ts.isStringLiteral(moduleSpecifier)
+ return importClause && !importClause.name && importClause.namedBindings && importClause.namedBindings.kind === 252 /* NamespaceImport */ && ts.isStringLiteral(moduleSpecifier)
? importClause.namedBindings.name
: undefined;
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return node.name;
default:
return undefined;
@@ -107423,13 +108646,13 @@
// should be kept up to date with getTransformationBody in convertToAsyncFunction.ts
function isFixablePromiseArgument(arg) {
switch (arg.kind) {
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
visitedNestedConvertibleFunctions.set(getKeyFromNode(arg), true);
/* falls through */
- case 96 /* NullKeyword */:
- case 72 /* Identifier */: // identifier includes undefined
+ case 97 /* NullKeyword */:
+ case 73 /* Identifier */: // identifier includes undefined
return true;
default:
return false;
@@ -107452,7 +108675,7 @@
}
var flags = ts.getCombinedLocalAndExportSymbolFlags(symbol);
if (flags & 32 /* Class */) {
- return ts.getDeclarationOfKind(symbol, 209 /* ClassExpression */) ?
+ return ts.getDeclarationOfKind(symbol, 210 /* ClassExpression */) ?
"local class" /* localClassElement */ : "class" /* classElement */;
}
if (flags & 384 /* Enum */)
@@ -107489,7 +108712,7 @@
if (typeChecker.isArgumentsSymbol(symbol)) {
return "local var" /* localVariableElement */;
}
- if (location.kind === 100 /* ThisKeyword */ && ts.isExpression(location)) {
+ if (location.kind === 101 /* ThisKeyword */ && ts.isExpression(location)) {
return "parameter" /* parameterElement */;
}
var flags = ts.getCombinedLocalAndExportSymbolFlags(symbol);
@@ -107540,11 +108763,11 @@
// If we requested completions after `x.` at the top-level, we may be at a source file location.
switch (location.parent && location.parent.kind) {
// If we've typed a character of the attribute name, will be 'JsxAttribute', else will be 'JsxOpeningElement'.
- case 262 /* JsxOpeningElement */:
- case 260 /* JsxElement */:
- case 261 /* JsxSelfClosingElement */:
- return location.kind === 72 /* Identifier */ ? "property" /* memberVariableElement */ : "JSX attribute" /* jsxAttribute */;
- case 267 /* JsxAttribute */:
+ case 263 /* JsxOpeningElement */:
+ case 261 /* JsxElement */:
+ case 262 /* JsxSelfClosingElement */:
+ return location.kind === 73 /* Identifier */ ? "property" /* memberVariableElement */ : "JSX attribute" /* jsxAttribute */;
+ case 268 /* JsxAttribute */:
return "JSX attribute" /* jsxAttribute */;
default:
return "property" /* memberVariableElement */;
@@ -107571,13 +108794,13 @@
var symbolFlags = ts.getCombinedLocalAndExportSymbolFlags(symbol);
var symbolKind = semanticMeaning & 1 /* Value */ ? getSymbolKindOfConstructorPropertyMethodAccessorFunctionOrVar(typeChecker, symbol, location) : "" /* unknown */;
var hasAddedSymbolInfo = false;
- var isThisExpression = location.kind === 100 /* ThisKeyword */ && ts.isInExpressionContext(location);
+ var isThisExpression = location.kind === 101 /* ThisKeyword */ && ts.isInExpressionContext(location);
var type;
var printer;
var documentationFromAlias;
var tagsFromAlias;
- if (location.kind === 100 /* ThisKeyword */ && !isThisExpression) {
- return { displayParts: [ts.keywordPart(100 /* ThisKeyword */)], documentation: [], symbolKind: "primitive type" /* primitiveType */, tags: undefined };
+ if (location.kind === 101 /* ThisKeyword */ && !isThisExpression) {
+ return { displayParts: [ts.keywordPart(101 /* ThisKeyword */)], documentation: [], symbolKind: "primitive type" /* primitiveType */, tags: undefined };
}
// Class at constructor site need to be shown as constructor apart from property,method, vars
if (symbolKind !== "" /* unknown */ || symbolFlags & 32 /* Class */ || symbolFlags & 2097152 /* Alias */) {
@@ -107587,7 +108810,7 @@
}
var signature = void 0;
type = isThisExpression ? typeChecker.getTypeAtLocation(location) : typeChecker.getTypeOfSymbolAtLocation(symbol.exportSymbol || symbol, location);
- if (location.parent && location.parent.kind === 189 /* PropertyAccessExpression */) {
+ if (location.parent && location.parent.kind === 190 /* PropertyAccessExpression */) {
var right = location.parent.name;
// Either the location is on the right of a property access, or on the left and the right is missing
if (right === location || (right && right.getFullWidth() === 0)) {
@@ -107606,9 +108829,8 @@
callExpressionLike = location.parent;
}
if (callExpressionLike) {
- var candidateSignatures = [];
- signature = typeChecker.getResolvedSignature(callExpressionLike, candidateSignatures); // TODO: GH#18217
- var useConstructSignatures = callExpressionLike.kind === 192 /* NewExpression */ || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 98 /* SuperKeyword */);
+ signature = typeChecker.getResolvedSignature(callExpressionLike); // TODO: GH#18217
+ var useConstructSignatures = callExpressionLike.kind === 193 /* NewExpression */ || (ts.isCallExpression(callExpressionLike) && callExpressionLike.expression.kind === 99 /* SuperKeyword */);
var allSignatures = useConstructSignatures ? type.getConstructSignatures() : type.getCallSignatures();
if (!ts.contains(allSignatures, signature.target) && !ts.contains(allSignatures, signature)) {
// Get the first signature if there is one -- allSignatures may contain
@@ -107626,7 +108848,7 @@
pushSymbolKind(symbolKind);
displayParts.push(ts.spacePart());
if (useConstructSignatures) {
- displayParts.push(ts.keywordPart(95 /* NewKeyword */));
+ displayParts.push(ts.keywordPart(96 /* NewKeyword */));
displayParts.push(ts.spacePart());
}
addFullSymbolName(symbol);
@@ -107650,7 +108872,7 @@
displayParts.push(ts.lineBreakPart());
}
if (useConstructSignatures) {
- displayParts.push(ts.keywordPart(95 /* NewKeyword */));
+ displayParts.push(ts.keywordPart(96 /* NewKeyword */));
displayParts.push(ts.spacePart());
}
addSignatureDisplayParts(signature, allSignatures, 262144 /* WriteArrowStyleSignature */);
@@ -107663,29 +108885,29 @@
}
}
else if ((ts.isNameOfFunctionDeclaration(location) && !(symbolFlags & 98304 /* Accessor */)) || // name of function declaration
- (location.kind === 124 /* ConstructorKeyword */ && location.parent.kind === 157 /* Constructor */)) { // At constructor keyword of constructor declaration
+ (location.kind === 125 /* ConstructorKeyword */ && location.parent.kind === 158 /* Constructor */)) { // At constructor keyword of constructor declaration
// get the signature from the declaration and write it
var functionDeclaration_1 = location.parent;
// Use function declaration to write the signatures only if the symbol corresponding to this declaration
var locationIsSymbolDeclaration = ts.find(symbol.declarations, function (declaration) {
- return declaration === (location.kind === 124 /* ConstructorKeyword */ ? functionDeclaration_1.parent : functionDeclaration_1);
+ return declaration === (location.kind === 125 /* ConstructorKeyword */ ? functionDeclaration_1.parent : functionDeclaration_1);
});
if (locationIsSymbolDeclaration) {
- var allSignatures = functionDeclaration_1.kind === 157 /* Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures();
+ var allSignatures = functionDeclaration_1.kind === 158 /* Constructor */ ? type.getNonNullableType().getConstructSignatures() : type.getNonNullableType().getCallSignatures();
if (!typeChecker.isImplementationOfOverload(functionDeclaration_1)) {
signature = typeChecker.getSignatureFromDeclaration(functionDeclaration_1); // TODO: GH#18217
}
else {
signature = allSignatures[0];
}
- if (functionDeclaration_1.kind === 157 /* Constructor */) {
+ if (functionDeclaration_1.kind === 158 /* Constructor */) {
// show (constructor) Type(...) signature
symbolKind = "constructor" /* constructorImplementationElement */;
addPrefixForAnyFunctionOrVar(type.symbol, symbolKind);
}
else {
// (function/method) symbol(..signature)
- addPrefixForAnyFunctionOrVar(functionDeclaration_1.kind === 160 /* CallSignature */ &&
+ addPrefixForAnyFunctionOrVar(functionDeclaration_1.kind === 161 /* CallSignature */ &&
!(type.symbol.flags & 2048 /* TypeLiteral */ || type.symbol.flags & 4096 /* ObjectLiteral */) ? type.symbol : symbol, symbolKind);
}
addSignatureDisplayParts(signature, allSignatures);
@@ -107695,7 +108917,7 @@
}
if (symbolFlags & 32 /* Class */ && !hasAddedSymbolInfo && !isThisExpression) {
addAliasPrefixIfNecessary();
- if (ts.getDeclarationOfKind(symbol, 209 /* ClassExpression */)) {
+ if (ts.getDeclarationOfKind(symbol, 210 /* ClassExpression */)) {
// Special case for class expressions because we would like to indicate that
// the class name is local to the class body (similar to function expression)
// (local class) class <className>
@@ -107703,7 +108925,7 @@
}
else {
// Class declaration has name which is not local.
- displayParts.push(ts.keywordPart(76 /* ClassKeyword */));
+ displayParts.push(ts.keywordPart(77 /* ClassKeyword */));
}
displayParts.push(ts.spacePart());
addFullSymbolName(symbol);
@@ -107711,37 +108933,37 @@
}
if ((symbolFlags & 64 /* Interface */) && (semanticMeaning & 2 /* Type */)) {
prefixNextMeaning();
- displayParts.push(ts.keywordPart(110 /* InterfaceKeyword */));
+ displayParts.push(ts.keywordPart(111 /* InterfaceKeyword */));
displayParts.push(ts.spacePart());
addFullSymbolName(symbol);
writeTypeParametersOfSymbol(symbol, sourceFile);
}
if ((symbolFlags & 524288 /* TypeAlias */) && (semanticMeaning & 2 /* Type */)) {
prefixNextMeaning();
- displayParts.push(ts.keywordPart(140 /* TypeKeyword */));
+ displayParts.push(ts.keywordPart(141 /* TypeKeyword */));
displayParts.push(ts.spacePart());
addFullSymbolName(symbol);
writeTypeParametersOfSymbol(symbol, sourceFile);
displayParts.push(ts.spacePart());
- displayParts.push(ts.operatorPart(59 /* EqualsToken */));
+ displayParts.push(ts.operatorPart(60 /* EqualsToken */));
displayParts.push(ts.spacePart());
ts.addRange(displayParts, ts.typeToDisplayParts(typeChecker, typeChecker.getDeclaredTypeOfSymbol(symbol), enclosingDeclaration, 8388608 /* InTypeAlias */));
}
if (symbolFlags & 384 /* Enum */) {
prefixNextMeaning();
if (ts.some(symbol.declarations, function (d) { return ts.isEnumDeclaration(d) && ts.isEnumConst(d); })) {
- displayParts.push(ts.keywordPart(77 /* ConstKeyword */));
+ displayParts.push(ts.keywordPart(78 /* ConstKeyword */));
displayParts.push(ts.spacePart());
}
- displayParts.push(ts.keywordPart(84 /* EnumKeyword */));
+ displayParts.push(ts.keywordPart(85 /* EnumKeyword */));
displayParts.push(ts.spacePart());
addFullSymbolName(symbol);
}
if (symbolFlags & 1536 /* Module */ && !isThisExpression) {
prefixNextMeaning();
- var declaration = ts.getDeclarationOfKind(symbol, 244 /* ModuleDeclaration */);
- var isNamespace = declaration && declaration.name && declaration.name.kind === 72 /* Identifier */;
- displayParts.push(ts.keywordPart(isNamespace ? 131 /* NamespaceKeyword */ : 130 /* ModuleKeyword */));
+ var declaration = ts.getDeclarationOfKind(symbol, 245 /* ModuleDeclaration */);
+ var isNamespace = declaration && declaration.name && declaration.name.kind === 73 /* Identifier */;
+ displayParts.push(ts.keywordPart(isNamespace ? 132 /* NamespaceKeyword */ : 131 /* ModuleKeyword */));
displayParts.push(ts.spacePart());
addFullSymbolName(symbol);
}
@@ -107760,7 +108982,7 @@
}
else {
// Method/function type parameter
- var decl = ts.getDeclarationOfKind(symbol, 150 /* TypeParameter */);
+ var decl = ts.getDeclarationOfKind(symbol, 151 /* TypeParameter */);
if (decl === undefined)
return ts.Debug.fail();
var declaration = decl.parent;
@@ -107768,21 +108990,21 @@
if (ts.isFunctionLikeKind(declaration.kind)) {
addInPrefix();
var signature = typeChecker.getSignatureFromDeclaration(declaration); // TODO: GH#18217
- if (declaration.kind === 161 /* ConstructSignature */) {
- displayParts.push(ts.keywordPart(95 /* NewKeyword */));
+ if (declaration.kind === 162 /* ConstructSignature */) {
+ displayParts.push(ts.keywordPart(96 /* NewKeyword */));
displayParts.push(ts.spacePart());
}
- else if (declaration.kind !== 160 /* CallSignature */ && declaration.name) {
+ else if (declaration.kind !== 161 /* CallSignature */ && declaration.name) {
addFullSymbolName(declaration.symbol);
}
ts.addRange(displayParts, ts.signatureToDisplayParts(typeChecker, signature, sourceFile, 32 /* WriteTypeArgumentsOfSignature */));
}
- else if (declaration.kind === 242 /* TypeAliasDeclaration */) {
+ else if (declaration.kind === 243 /* TypeAliasDeclaration */) {
// Type alias type parameter
// For example
// type list<T> = T[]; // Both T will go through same code path
addInPrefix();
- displayParts.push(ts.keywordPart(140 /* TypeKeyword */));
+ displayParts.push(ts.keywordPart(141 /* TypeKeyword */));
displayParts.push(ts.spacePart());
addFullSymbolName(declaration.symbol);
writeTypeParametersOfSymbol(declaration.symbol, sourceFile);
@@ -107794,11 +109016,11 @@
symbolKind = "enum member" /* enumMemberElement */;
addPrefixForAnyFunctionOrVar(symbol, "enum member");
var declaration = symbol.declarations[0];
- if (declaration.kind === 278 /* EnumMember */) {
+ if (declaration.kind === 279 /* EnumMember */) {
var constantValue = typeChecker.getConstantValue(declaration);
if (constantValue !== undefined) {
displayParts.push(ts.spacePart());
- displayParts.push(ts.operatorPart(59 /* EqualsToken */));
+ displayParts.push(ts.operatorPart(60 /* EqualsToken */));
displayParts.push(ts.spacePart());
displayParts.push(ts.displayPart(ts.getTextOfConstantValue(constantValue), typeof constantValue === "number" ? ts.SymbolDisplayPartKind.numericLiteral : ts.SymbolDisplayPartKind.stringLiteral));
}
@@ -107824,32 +109046,32 @@
}
}
switch (symbol.declarations[0].kind) {
- case 247 /* NamespaceExportDeclaration */:
- displayParts.push(ts.keywordPart(85 /* ExportKeyword */));
+ case 248 /* NamespaceExportDeclaration */:
+ displayParts.push(ts.keywordPart(86 /* ExportKeyword */));
displayParts.push(ts.spacePart());
- displayParts.push(ts.keywordPart(131 /* NamespaceKeyword */));
+ displayParts.push(ts.keywordPart(132 /* NamespaceKeyword */));
break;
- case 254 /* ExportAssignment */:
- displayParts.push(ts.keywordPart(85 /* ExportKeyword */));
+ case 255 /* ExportAssignment */:
+ displayParts.push(ts.keywordPart(86 /* ExportKeyword */));
displayParts.push(ts.spacePart());
- displayParts.push(ts.keywordPart(symbol.declarations[0].isExportEquals ? 59 /* EqualsToken */ : 80 /* DefaultKeyword */));
+ displayParts.push(ts.keywordPart(symbol.declarations[0].isExportEquals ? 60 /* EqualsToken */ : 81 /* DefaultKeyword */));
break;
- case 257 /* ExportSpecifier */:
- displayParts.push(ts.keywordPart(85 /* ExportKeyword */));
+ case 258 /* ExportSpecifier */:
+ displayParts.push(ts.keywordPart(86 /* ExportKeyword */));
break;
default:
- displayParts.push(ts.keywordPart(92 /* ImportKeyword */));
+ displayParts.push(ts.keywordPart(93 /* ImportKeyword */));
}
displayParts.push(ts.spacePart());
addFullSymbolName(symbol);
ts.forEach(symbol.declarations, function (declaration) {
- if (declaration.kind === 248 /* ImportEqualsDeclaration */) {
+ if (declaration.kind === 249 /* ImportEqualsDeclaration */) {
var importEqualsDeclaration = declaration;
if (ts.isExternalModuleImportEqualsDeclaration(importEqualsDeclaration)) {
displayParts.push(ts.spacePart());
- displayParts.push(ts.operatorPart(59 /* EqualsToken */));
+ displayParts.push(ts.operatorPart(60 /* EqualsToken */));
displayParts.push(ts.spacePart());
- displayParts.push(ts.keywordPart(134 /* RequireKeyword */));
+ displayParts.push(ts.keywordPart(135 /* RequireKeyword */));
displayParts.push(ts.punctuationPart(20 /* OpenParenToken */));
displayParts.push(ts.displayPart(ts.getTextOfNode(ts.getExternalModuleImportEqualsDeclarationExpression(importEqualsDeclaration)), ts.SymbolDisplayPartKind.stringLiteral));
displayParts.push(ts.punctuationPart(21 /* CloseParenToken */));
@@ -107858,7 +109080,7 @@
var internalAliasSymbol = typeChecker.getSymbolAtLocation(importEqualsDeclaration.moduleReference);
if (internalAliasSymbol) {
displayParts.push(ts.spacePart());
- displayParts.push(ts.operatorPart(59 /* EqualsToken */));
+ displayParts.push(ts.operatorPart(60 /* EqualsToken */));
displayParts.push(ts.spacePart());
addFullSymbolName(internalAliasSymbol, enclosingDeclaration);
}
@@ -107872,7 +109094,7 @@
if (type) {
if (isThisExpression) {
prefixNextMeaning();
- displayParts.push(ts.keywordPart(100 /* ThisKeyword */));
+ displayParts.push(ts.keywordPart(101 /* ThisKeyword */));
}
else {
addPrefixForAnyFunctionOrVar(symbol, symbolKind);
@@ -107921,10 +109143,10 @@
// For some special property access expressions like `exports.foo = foo` or `module.exports.foo = foo`
// there documentation comments might be attached to the right hand side symbol of their declarations.
// The pattern of such special property access is that the parent symbol is the symbol of the file.
- if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 284 /* SourceFile */; })) {
+ if (symbol.parent && ts.forEach(symbol.parent.declarations, function (declaration) { return declaration.kind === 285 /* SourceFile */; })) {
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (!declaration.parent || declaration.parent.kind !== 204 /* BinaryExpression */) {
+ if (!declaration.parent || declaration.parent.kind !== 205 /* BinaryExpression */) {
continue;
}
var rhsSymbol = typeChecker.getSymbolAtLocation(declaration.parent.right);
@@ -107967,7 +109189,7 @@
}
function addInPrefix() {
displayParts.push(ts.spacePart());
- displayParts.push(ts.keywordPart(93 /* InKeyword */));
+ displayParts.push(ts.keywordPart(94 /* InKeyword */));
displayParts.push(ts.spacePart());
}
function addFullSymbolName(symbolToDisplay, enclosingDeclaration) {
@@ -108037,16 +109259,16 @@
}
return ts.forEach(symbol.declarations, function (declaration) {
// Function expressions are local
- if (declaration.kind === 196 /* FunctionExpression */) {
+ if (declaration.kind === 197 /* FunctionExpression */) {
return true;
}
- if (declaration.kind !== 237 /* VariableDeclaration */ && declaration.kind !== 239 /* FunctionDeclaration */) {
+ if (declaration.kind !== 238 /* VariableDeclaration */ && declaration.kind !== 240 /* FunctionDeclaration */) {
return false;
}
// If the parent is not sourceFile or module block it is local variable
for (var parent = declaration.parent; !ts.isFunctionBlock(parent); parent = parent.parent) {
// Reached source file or module block
- if (parent.kind === 284 /* SourceFile */ || parent.kind === 245 /* ModuleBlock */) {
+ if (parent.kind === 285 /* SourceFile */ || parent.kind === 246 /* ModuleBlock */) {
return false;
}
}
@@ -108275,8 +109497,8 @@
(function (ts) {
var formatting;
(function (formatting) {
- var standardScanner = ts.createScanner(7 /* Latest */, /*skipTrivia*/ false, 0 /* Standard */);
- var jsxScanner = ts.createScanner(7 /* Latest */, /*skipTrivia*/ false, 1 /* JSX */);
+ var standardScanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false, 0 /* Standard */);
+ var jsxScanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ false, 1 /* JSX */);
var ScanAction;
(function (ScanAction) {
ScanAction[ScanAction["Scan"] = 0] = "Scan";
@@ -108340,8 +109562,8 @@
function shouldRescanGreaterThanToken(node) {
switch (node.kind) {
case 32 /* GreaterThanEqualsToken */:
- case 67 /* GreaterThanGreaterThanEqualsToken */:
- case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
+ case 68 /* GreaterThanGreaterThanEqualsToken */:
+ case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
case 48 /* GreaterThanGreaterThanGreaterThanToken */:
case 47 /* GreaterThanGreaterThanToken */:
return true;
@@ -108351,12 +109573,12 @@
function shouldRescanJsxIdentifier(node) {
if (node.parent) {
switch (node.parent.kind) {
- case 267 /* JsxAttribute */:
- case 262 /* JsxOpeningElement */:
- case 263 /* JsxClosingElement */:
- case 261 /* JsxSelfClosingElement */:
+ case 268 /* JsxAttribute */:
+ case 263 /* JsxOpeningElement */:
+ case 264 /* JsxClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
// May parse an identifier like `module-layout`; that will be scanned as a keyword at first, but we should parse the whole thing to get an identifier.
- return ts.isKeyword(node.kind) || node.kind === 72 /* Identifier */;
+ return ts.isKeyword(node.kind) || node.kind === 73 /* Identifier */;
}
}
return false;
@@ -108372,7 +109594,7 @@
container.kind === 17 /* TemplateTail */;
}
function startsWithSlashToken(t) {
- return t === 42 /* SlashToken */ || t === 64 /* SlashEqualsToken */;
+ return t === 42 /* SlashToken */ || t === 65 /* SlashEqualsToken */;
}
function readTokenInfo(n) {
ts.Debug.assert(isOnToken());
@@ -108531,7 +109753,7 @@
(function (formatting) {
function getAllRules() {
var allTokens = [];
- for (var token = 0 /* FirstToken */; token <= 147 /* LastToken */; token++) {
+ for (var token = 0 /* FirstToken */; token <= 148 /* LastToken */; token++) {
allTokens.push(token);
}
function anyTokenExcept() {
@@ -108543,27 +109765,27 @@
}
var anyToken = { tokens: allTokens, isSpecific: false };
var anyTokenIncludingMultilineComments = tokenRangeFrom(allTokens.concat([3 /* MultiLineCommentTrivia */]));
- var keywords = tokenRangeFromRange(73 /* FirstKeyword */, 147 /* LastKeyword */);
- var binaryOperators = tokenRangeFromRange(28 /* FirstBinaryOperator */, 71 /* LastBinaryOperator */);
- var binaryKeywordOperators = [93 /* InKeyword */, 94 /* InstanceOfKeyword */, 147 /* OfKeyword */, 119 /* AsKeyword */, 128 /* IsKeyword */];
+ var keywords = tokenRangeFromRange(74 /* FirstKeyword */, 148 /* LastKeyword */);
+ var binaryOperators = tokenRangeFromRange(28 /* FirstBinaryOperator */, 72 /* LastBinaryOperator */);
+ var binaryKeywordOperators = [94 /* InKeyword */, 95 /* InstanceOfKeyword */, 148 /* OfKeyword */, 120 /* AsKeyword */, 129 /* IsKeyword */];
var unaryPrefixOperators = [44 /* PlusPlusToken */, 45 /* MinusMinusToken */, 53 /* TildeToken */, 52 /* ExclamationToken */];
var unaryPrefixExpressions = [
- 8 /* NumericLiteral */, 9 /* BigIntLiteral */, 72 /* Identifier */, 20 /* OpenParenToken */,
- 22 /* OpenBracketToken */, 18 /* OpenBraceToken */, 100 /* ThisKeyword */, 95 /* NewKeyword */
+ 8 /* NumericLiteral */, 9 /* BigIntLiteral */, 73 /* Identifier */, 20 /* OpenParenToken */,
+ 22 /* OpenBracketToken */, 18 /* OpenBraceToken */, 101 /* ThisKeyword */, 96 /* NewKeyword */
];
- var unaryPreincrementExpressions = [72 /* Identifier */, 20 /* OpenParenToken */, 100 /* ThisKeyword */, 95 /* NewKeyword */];
- var unaryPostincrementExpressions = [72 /* Identifier */, 21 /* CloseParenToken */, 23 /* CloseBracketToken */, 95 /* NewKeyword */];
- var unaryPredecrementExpressions = [72 /* Identifier */, 20 /* OpenParenToken */, 100 /* ThisKeyword */, 95 /* NewKeyword */];
- var unaryPostdecrementExpressions = [72 /* Identifier */, 21 /* CloseParenToken */, 23 /* CloseBracketToken */, 95 /* NewKeyword */];
+ var unaryPreincrementExpressions = [73 /* Identifier */, 20 /* OpenParenToken */, 101 /* ThisKeyword */, 96 /* NewKeyword */];
+ var unaryPostincrementExpressions = [73 /* Identifier */, 21 /* CloseParenToken */, 23 /* CloseBracketToken */, 96 /* NewKeyword */];
+ var unaryPredecrementExpressions = [73 /* Identifier */, 20 /* OpenParenToken */, 101 /* ThisKeyword */, 96 /* NewKeyword */];
+ var unaryPostdecrementExpressions = [73 /* Identifier */, 21 /* CloseParenToken */, 23 /* CloseBracketToken */, 96 /* NewKeyword */];
var comments = [2 /* SingleLineCommentTrivia */, 3 /* MultiLineCommentTrivia */];
- var typeNames = [72 /* Identifier */].concat(ts.typeKeywords);
+ var typeNames = [73 /* Identifier */].concat(ts.typeKeywords);
// Place a space before open brace in a function declaration
// TypeScript: Function can have return types, which can be made of tons of different token kinds
var functionOpenBraceLeftTokenRange = anyTokenIncludingMultilineComments;
// Place a space before open brace in a TypeScript declaration that has braces as children (class, module, enum, etc)
- var typeScriptOpenBraceLeftTokenRange = tokenRangeFrom([72 /* Identifier */, 3 /* MultiLineCommentTrivia */, 76 /* ClassKeyword */, 85 /* ExportKeyword */, 92 /* ImportKeyword */]);
+ var typeScriptOpenBraceLeftTokenRange = tokenRangeFrom([73 /* Identifier */, 3 /* MultiLineCommentTrivia */, 77 /* ClassKeyword */, 86 /* ExportKeyword */, 93 /* ImportKeyword */]);
// Place a space before open brace in a control flow construct
- var controlOpenBraceLeftTokenRange = tokenRangeFrom([21 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 82 /* DoKeyword */, 103 /* TryKeyword */, 88 /* FinallyKeyword */, 83 /* ElseKeyword */]);
+ var controlOpenBraceLeftTokenRange = tokenRangeFrom([21 /* CloseParenToken */, 3 /* MultiLineCommentTrivia */, 83 /* DoKeyword */, 104 /* TryKeyword */, 89 /* FinallyKeyword */, 84 /* ElseKeyword */]);
// These rules are higher in priority than user-configurable
var highPriorityCommonRules = [
// Leave comments alone
@@ -108578,7 +109800,7 @@
rule("NoSpaceAfterQuestionMark", 56 /* QuestionToken */, anyToken, [isNonJsxSameLineTokenContext], 8 /* Delete */),
rule("NoSpaceBeforeDot", anyToken, 24 /* DotToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
rule("NoSpaceAfterDot", 24 /* DotToken */, anyToken, [isNonJsxSameLineTokenContext], 8 /* Delete */),
- rule("NoSpaceBetweenImportParenInImportType", 92 /* ImportKeyword */, 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext, isImportTypeContext], 8 /* Delete */),
+ rule("NoSpaceBetweenImportParenInImportType", 93 /* ImportKeyword */, 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext, isImportTypeContext], 8 /* Delete */),
// Special handling of unary operators.
// Prefix operators generally shouldn't have a space between
// them and their target unary expression.
@@ -108605,79 +109827,79 @@
rule("SpaceAfterCloseBrace", 19 /* CloseBraceToken */, anyTokenExcept(21 /* CloseParenToken */), [isNonJsxSameLineTokenContext, isAfterCodeBlockContext], 2 /* Space */),
// Special case for (}, else) and (}, while) since else & while tokens are not part of the tree which makes SpaceAfterCloseBrace rule not applied
// Also should not apply to })
- rule("SpaceBetweenCloseBraceAndElse", 19 /* CloseBraceToken */, 83 /* ElseKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */),
- rule("SpaceBetweenCloseBraceAndWhile", 19 /* CloseBraceToken */, 107 /* WhileKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceBetweenCloseBraceAndElse", 19 /* CloseBraceToken */, 84 /* ElseKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceBetweenCloseBraceAndWhile", 19 /* CloseBraceToken */, 108 /* WhileKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */),
rule("NoSpaceBetweenEmptyBraceBrackets", 18 /* OpenBraceToken */, 19 /* CloseBraceToken */, [isNonJsxSameLineTokenContext, isObjectContext], 8 /* Delete */),
// Add a space after control dec context if the next character is an open bracket ex: 'if (false)[a, b] = [1, 2];' -> 'if (false) [a, b] = [1, 2];'
rule("SpaceAfterConditionalClosingParen", 21 /* CloseParenToken */, 22 /* OpenBracketToken */, [isControlDeclContext], 2 /* Space */),
- rule("NoSpaceBetweenFunctionKeywordAndStar", 90 /* FunctionKeyword */, 40 /* AsteriskToken */, [isFunctionDeclarationOrFunctionExpressionContext], 8 /* Delete */),
- rule("SpaceAfterStarInGeneratorDeclaration", 40 /* AsteriskToken */, [72 /* Identifier */, 20 /* OpenParenToken */], [isFunctionDeclarationOrFunctionExpressionContext], 2 /* Space */),
- rule("SpaceAfterFunctionInFuncDecl", 90 /* FunctionKeyword */, anyToken, [isFunctionDeclContext], 2 /* Space */),
+ rule("NoSpaceBetweenFunctionKeywordAndStar", 91 /* FunctionKeyword */, 40 /* AsteriskToken */, [isFunctionDeclarationOrFunctionExpressionContext], 8 /* Delete */),
+ rule("SpaceAfterStarInGeneratorDeclaration", 40 /* AsteriskToken */, 73 /* Identifier */, [isFunctionDeclarationOrFunctionExpressionContext], 2 /* Space */),
+ rule("SpaceAfterFunctionInFuncDecl", 91 /* FunctionKeyword */, anyToken, [isFunctionDeclContext], 2 /* Space */),
// Insert new line after { and before } in multi-line contexts.
rule("NewLineAfterOpenBraceInBlockContext", 18 /* OpenBraceToken */, anyToken, [isMultilineBlockContext], 4 /* NewLine */),
// For get/set members, we check for (identifier,identifier) since get/set don't have tokens and they are represented as just an identifier token.
// Though, we do extra check on the context to make sure we are dealing with get/set node. Example:
// get x() {}
// set x(val) {}
- rule("SpaceAfterGetSetInMember", [126 /* GetKeyword */, 137 /* SetKeyword */], 72 /* Identifier */, [isFunctionDeclContext], 2 /* Space */),
- rule("NoSpaceBetweenYieldKeywordAndStar", 117 /* YieldKeyword */, 40 /* AsteriskToken */, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 8 /* Delete */),
- rule("SpaceBetweenYieldOrYieldStarAndOperand", [117 /* YieldKeyword */, 40 /* AsteriskToken */], anyToken, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 2 /* Space */),
- rule("NoSpaceBetweenReturnAndSemicolon", 97 /* ReturnKeyword */, 26 /* SemicolonToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
- rule("SpaceAfterCertainKeywords", [105 /* VarKeyword */, 101 /* ThrowKeyword */, 95 /* NewKeyword */, 81 /* DeleteKeyword */, 97 /* ReturnKeyword */, 104 /* TypeOfKeyword */, 122 /* AwaitKeyword */], anyToken, [isNonJsxSameLineTokenContext], 2 /* Space */),
- rule("SpaceAfterLetConstInVariableDeclaration", [111 /* LetKeyword */, 77 /* ConstKeyword */], anyToken, [isNonJsxSameLineTokenContext, isStartOfVariableDeclarationList], 2 /* Space */),
+ rule("SpaceAfterGetSetInMember", [127 /* GetKeyword */, 138 /* SetKeyword */], 73 /* Identifier */, [isFunctionDeclContext], 2 /* Space */),
+ rule("NoSpaceBetweenYieldKeywordAndStar", 118 /* YieldKeyword */, 40 /* AsteriskToken */, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 8 /* Delete */),
+ rule("SpaceBetweenYieldOrYieldStarAndOperand", [118 /* YieldKeyword */, 40 /* AsteriskToken */], anyToken, [isNonJsxSameLineTokenContext, isYieldOrYieldStarWithOperand], 2 /* Space */),
+ rule("NoSpaceBetweenReturnAndSemicolon", 98 /* ReturnKeyword */, 26 /* SemicolonToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
+ rule("SpaceAfterCertainKeywords", [106 /* VarKeyword */, 102 /* ThrowKeyword */, 96 /* NewKeyword */, 82 /* DeleteKeyword */, 98 /* ReturnKeyword */, 105 /* TypeOfKeyword */, 123 /* AwaitKeyword */], anyToken, [isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceAfterLetConstInVariableDeclaration", [112 /* LetKeyword */, 78 /* ConstKeyword */], anyToken, [isNonJsxSameLineTokenContext, isStartOfVariableDeclarationList], 2 /* Space */),
rule("NoSpaceBeforeOpenParenInFuncCall", anyToken, 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext, isFunctionCallOrNewContext, isPreviousTokenNotComma], 8 /* Delete */),
// Special case for binary operators (that are keywords). For these we have to add a space and shouldn't follow any user options.
rule("SpaceBeforeBinaryKeywordOperator", anyToken, binaryKeywordOperators, [isNonJsxSameLineTokenContext, isBinaryOpContext], 2 /* Space */),
rule("SpaceAfterBinaryKeywordOperator", binaryKeywordOperators, anyToken, [isNonJsxSameLineTokenContext, isBinaryOpContext], 2 /* Space */),
- rule("SpaceAfterVoidOperator", 106 /* VoidKeyword */, anyToken, [isNonJsxSameLineTokenContext, isVoidOpContext], 2 /* Space */),
+ rule("SpaceAfterVoidOperator", 107 /* VoidKeyword */, anyToken, [isNonJsxSameLineTokenContext, isVoidOpContext], 2 /* Space */),
// Async-await
- rule("SpaceBetweenAsyncAndOpenParen", 121 /* AsyncKeyword */, 20 /* OpenParenToken */, [isArrowFunctionContext, isNonJsxSameLineTokenContext], 2 /* Space */),
- rule("SpaceBetweenAsyncAndFunctionKeyword", 121 /* AsyncKeyword */, 90 /* FunctionKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceBetweenAsyncAndOpenParen", 122 /* AsyncKeyword */, 20 /* OpenParenToken */, [isArrowFunctionContext, isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceBetweenAsyncAndFunctionKeyword", 122 /* AsyncKeyword */, 91 /* FunctionKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */),
// Template string
- rule("NoSpaceBetweenTagAndTemplateString", [72 /* Identifier */, 21 /* CloseParenToken */], [14 /* NoSubstitutionTemplateLiteral */, 15 /* TemplateHead */], [isNonJsxSameLineTokenContext], 8 /* Delete */),
+ rule("NoSpaceBetweenTagAndTemplateString", [73 /* Identifier */, 21 /* CloseParenToken */], [14 /* NoSubstitutionTemplateLiteral */, 15 /* TemplateHead */], [isNonJsxSameLineTokenContext], 8 /* Delete */),
// JSX opening elements
- rule("SpaceBeforeJsxAttribute", anyToken, 72 /* Identifier */, [isNextTokenParentJsxAttribute, isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceBeforeJsxAttribute", anyToken, 73 /* Identifier */, [isNextTokenParentJsxAttribute, isNonJsxSameLineTokenContext], 2 /* Space */),
rule("SpaceBeforeSlashInJsxOpeningElement", anyToken, 42 /* SlashToken */, [isJsxSelfClosingElementContext, isNonJsxSameLineTokenContext], 2 /* Space */),
rule("NoSpaceBeforeGreaterThanTokenInJsxOpeningElement", 42 /* SlashToken */, 30 /* GreaterThanToken */, [isJsxSelfClosingElementContext, isNonJsxSameLineTokenContext], 8 /* Delete */),
- rule("NoSpaceBeforeEqualInJsxAttribute", anyToken, 59 /* EqualsToken */, [isJsxAttributeContext, isNonJsxSameLineTokenContext], 8 /* Delete */),
- rule("NoSpaceAfterEqualInJsxAttribute", 59 /* EqualsToken */, anyToken, [isJsxAttributeContext, isNonJsxSameLineTokenContext], 8 /* Delete */),
+ rule("NoSpaceBeforeEqualInJsxAttribute", anyToken, 60 /* EqualsToken */, [isJsxAttributeContext, isNonJsxSameLineTokenContext], 8 /* Delete */),
+ rule("NoSpaceAfterEqualInJsxAttribute", 60 /* EqualsToken */, anyToken, [isJsxAttributeContext, isNonJsxSameLineTokenContext], 8 /* Delete */),
// TypeScript-specific rules
// Use of module as a function call. e.g.: import m2 = module("m2");
- rule("NoSpaceAfterModuleImport", [130 /* ModuleKeyword */, 134 /* RequireKeyword */], 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
+ rule("NoSpaceAfterModuleImport", [131 /* ModuleKeyword */, 135 /* RequireKeyword */], 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
// Add a space around certain TypeScript keywords
rule("SpaceAfterCertainTypeScriptKeywords", [
- 118 /* AbstractKeyword */,
- 76 /* ClassKeyword */,
- 125 /* DeclareKeyword */,
- 80 /* DefaultKeyword */,
- 84 /* EnumKeyword */,
- 85 /* ExportKeyword */,
- 86 /* ExtendsKeyword */,
- 126 /* GetKeyword */,
- 109 /* ImplementsKeyword */,
- 92 /* ImportKeyword */,
- 110 /* InterfaceKeyword */,
- 130 /* ModuleKeyword */,
- 131 /* NamespaceKeyword */,
- 113 /* PrivateKeyword */,
- 115 /* PublicKeyword */,
- 114 /* ProtectedKeyword */,
- 133 /* ReadonlyKeyword */,
- 137 /* SetKeyword */,
- 116 /* StaticKeyword */,
- 140 /* TypeKeyword */,
- 144 /* FromKeyword */,
- 129 /* KeyOfKeyword */,
- 127 /* InferKeyword */,
+ 119 /* AbstractKeyword */,
+ 77 /* ClassKeyword */,
+ 126 /* DeclareKeyword */,
+ 81 /* DefaultKeyword */,
+ 85 /* EnumKeyword */,
+ 86 /* ExportKeyword */,
+ 87 /* ExtendsKeyword */,
+ 127 /* GetKeyword */,
+ 110 /* ImplementsKeyword */,
+ 93 /* ImportKeyword */,
+ 111 /* InterfaceKeyword */,
+ 131 /* ModuleKeyword */,
+ 132 /* NamespaceKeyword */,
+ 114 /* PrivateKeyword */,
+ 116 /* PublicKeyword */,
+ 115 /* ProtectedKeyword */,
+ 134 /* ReadonlyKeyword */,
+ 138 /* SetKeyword */,
+ 117 /* StaticKeyword */,
+ 141 /* TypeKeyword */,
+ 145 /* FromKeyword */,
+ 130 /* KeyOfKeyword */,
+ 128 /* InferKeyword */,
], anyToken, [isNonJsxSameLineTokenContext], 2 /* Space */),
- rule("SpaceBeforeCertainTypeScriptKeywords", anyToken, [86 /* ExtendsKeyword */, 109 /* ImplementsKeyword */, 144 /* FromKeyword */], [isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceBeforeCertainTypeScriptKeywords", anyToken, [87 /* ExtendsKeyword */, 110 /* ImplementsKeyword */, 145 /* FromKeyword */], [isNonJsxSameLineTokenContext], 2 /* Space */),
// Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" {
rule("SpaceAfterModuleName", 10 /* StringLiteral */, 18 /* OpenBraceToken */, [isModuleDeclContext], 2 /* Space */),
// Lambda expressions
rule("SpaceBeforeArrow", anyToken, 37 /* EqualsGreaterThanToken */, [isNonJsxSameLineTokenContext], 2 /* Space */),
rule("SpaceAfterArrow", 37 /* EqualsGreaterThanToken */, anyToken, [isNonJsxSameLineTokenContext], 2 /* Space */),
// Optional parameters and let args
- rule("NoSpaceAfterEllipsis", 25 /* DotDotDotToken */, 72 /* Identifier */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
+ rule("NoSpaceAfterEllipsis", 25 /* DotDotDotToken */, 73 /* Identifier */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
rule("NoSpaceAfterOptionalParameters", 56 /* QuestionToken */, [21 /* CloseParenToken */, 27 /* CommaToken */], [isNonJsxSameLineTokenContext, isNotBinaryOpContext], 8 /* Delete */),
// Remove spaces in empty interface literals. e.g.: x: {}
rule("NoSpaceBetweenEmptyInterfaceBraceBrackets", 18 /* OpenBraceToken */, 19 /* CloseBraceToken */, [isNonJsxSameLineTokenContext, isObjectTypeContext], 8 /* Delete */),
@@ -108688,37 +109910,37 @@
rule("NoSpaceBeforeCloseAngularBracket", anyToken, 30 /* GreaterThanToken */, [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext], 8 /* Delete */),
rule("NoSpaceAfterCloseAngularBracket", 30 /* GreaterThanToken */, [20 /* OpenParenToken */, 22 /* OpenBracketToken */, 30 /* GreaterThanToken */, 27 /* CommaToken */], [isNonJsxSameLineTokenContext, isTypeArgumentOrParameterOrAssertionContext, isNotFunctionDeclContext /*To prevent an interference with the SpaceBeforeOpenParenInFuncDecl rule*/], 8 /* Delete */),
// decorators
- rule("SpaceBeforeAt", [21 /* CloseParenToken */, 72 /* Identifier */], 58 /* AtToken */, [isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceBeforeAt", [21 /* CloseParenToken */, 73 /* Identifier */], 58 /* AtToken */, [isNonJsxSameLineTokenContext], 2 /* Space */),
rule("NoSpaceAfterAt", 58 /* AtToken */, anyToken, [isNonJsxSameLineTokenContext], 8 /* Delete */),
// Insert space after @ in decorator
rule("SpaceAfterDecorator", anyToken, [
- 118 /* AbstractKeyword */,
- 72 /* Identifier */,
- 85 /* ExportKeyword */,
- 80 /* DefaultKeyword */,
- 76 /* ClassKeyword */,
- 116 /* StaticKeyword */,
- 115 /* PublicKeyword */,
- 113 /* PrivateKeyword */,
- 114 /* ProtectedKeyword */,
- 126 /* GetKeyword */,
- 137 /* SetKeyword */,
+ 119 /* AbstractKeyword */,
+ 73 /* Identifier */,
+ 86 /* ExportKeyword */,
+ 81 /* DefaultKeyword */,
+ 77 /* ClassKeyword */,
+ 117 /* StaticKeyword */,
+ 116 /* PublicKeyword */,
+ 114 /* PrivateKeyword */,
+ 115 /* ProtectedKeyword */,
+ 127 /* GetKeyword */,
+ 138 /* SetKeyword */,
22 /* OpenBracketToken */,
40 /* AsteriskToken */,
], [isEndOfDecoratorContextOnSameLine], 2 /* Space */),
rule("NoSpaceBeforeNonNullAssertionOperator", anyToken, 52 /* ExclamationToken */, [isNonJsxSameLineTokenContext, isNonNullAssertionContext], 8 /* Delete */),
- rule("NoSpaceAfterNewKeywordOnConstructorSignature", 95 /* NewKeyword */, 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext, isConstructorSignatureContext], 8 /* Delete */),
+ rule("NoSpaceAfterNewKeywordOnConstructorSignature", 96 /* NewKeyword */, 20 /* OpenParenToken */, [isNonJsxSameLineTokenContext, isConstructorSignatureContext], 8 /* Delete */),
];
// These rules are applied after high priority
var userConfigurableRules = [
// Treat constructor as an identifier in a function declaration, and remove spaces between constructor and following left parentheses
- rule("SpaceAfterConstructor", 124 /* ConstructorKeyword */, 20 /* OpenParenToken */, [isOptionEnabled("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 2 /* Space */),
- rule("NoSpaceAfterConstructor", 124 /* ConstructorKeyword */, 20 /* OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 8 /* Delete */),
+ rule("SpaceAfterConstructor", 125 /* ConstructorKeyword */, 20 /* OpenParenToken */, [isOptionEnabled("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("NoSpaceAfterConstructor", 125 /* ConstructorKeyword */, 20 /* OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterConstructor"), isNonJsxSameLineTokenContext], 8 /* Delete */),
rule("SpaceAfterComma", 27 /* CommaToken */, anyToken, [isOptionEnabled("insertSpaceAfterCommaDelimiter"), isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNextTokenNotCloseBracket], 2 /* Space */),
rule("NoSpaceAfterComma", 27 /* CommaToken */, anyToken, [isOptionDisabledOrUndefined("insertSpaceAfterCommaDelimiter"), isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext], 8 /* Delete */),
// Insert space after function keyword for anonymous functions
- rule("SpaceAfterAnonymousFunctionKeyword", 90 /* FunctionKeyword */, 20 /* OpenParenToken */, [isOptionEnabled("insertSpaceAfterFunctionKeywordForAnonymousFunctions"), isFunctionDeclContext], 2 /* Space */),
- rule("NoSpaceAfterAnonymousFunctionKeyword", 90 /* FunctionKeyword */, 20 /* OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterFunctionKeywordForAnonymousFunctions"), isFunctionDeclContext], 8 /* Delete */),
+ rule("SpaceAfterAnonymousFunctionKeyword", [91 /* FunctionKeyword */, 40 /* AsteriskToken */], 20 /* OpenParenToken */, [isOptionEnabled("insertSpaceAfterFunctionKeywordForAnonymousFunctions"), isFunctionDeclContext], 2 /* Space */),
+ rule("NoSpaceAfterAnonymousFunctionKeyword", [91 /* FunctionKeyword */, 40 /* AsteriskToken */], 20 /* OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterFunctionKeywordForAnonymousFunctions"), isFunctionDeclContext], 8 /* Delete */),
// Insert space after keywords in control flow statements
rule("SpaceAfterKeywordInControl", keywords, 20 /* OpenParenToken */, [isOptionEnabled("insertSpaceAfterKeywordsInControlFlowStatements"), isControlDeclContext], 2 /* Space */),
rule("NoSpaceAfterKeywordInControl", keywords, 20 /* OpenParenToken */, [isOptionDisabledOrUndefined("insertSpaceAfterKeywordsInControlFlowStatements"), isControlDeclContext], 8 /* Delete */),
@@ -108782,16 +110004,16 @@
rule("SpaceBeforeOpenBraceInTypeScriptDeclWithBlock", typeScriptOpenBraceLeftTokenRange, 18 /* OpenBraceToken */, [isOptionDisabledOrUndefinedOrTokensOnSameLine("placeOpenBraceOnNewLineForFunctions"), isTypeScriptDeclWithBlockContext, isNotFormatOnEnter, isSameLineTokenOrBeforeBlockContext], 2 /* Space */, 1 /* CanDeleteNewLines */),
rule("NoSpaceBeforeComma", anyToken, 27 /* CommaToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
// No space before and after indexer `x[]`
- rule("NoSpaceBeforeOpenBracket", anyTokenExcept(121 /* AsyncKeyword */, 74 /* CaseKeyword */), 22 /* OpenBracketToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
+ rule("NoSpaceBeforeOpenBracket", anyTokenExcept(122 /* AsyncKeyword */, 75 /* CaseKeyword */), 22 /* OpenBracketToken */, [isNonJsxSameLineTokenContext], 8 /* Delete */),
rule("NoSpaceAfterCloseBracket", 23 /* CloseBracketToken */, anyToken, [isNonJsxSameLineTokenContext, isNotBeforeBlockInFunctionDeclarationContext], 8 /* Delete */),
rule("SpaceAfterSemicolon", 26 /* SemicolonToken */, anyToken, [isNonJsxSameLineTokenContext], 2 /* Space */),
// Remove extra space between for and await
- rule("SpaceBetweenForAndAwaitKeyword", 89 /* ForKeyword */, 122 /* AwaitKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceBetweenForAndAwaitKeyword", 90 /* ForKeyword */, 123 /* AwaitKeyword */, [isNonJsxSameLineTokenContext], 2 /* Space */),
// Add a space between statements. All keywords except (do,else,case) has open/close parens after them.
// So, we have a rule to add a space for [),Any], [do,Any], [else,Any], and [case,Any]
- rule("SpaceBetweenStatements", [21 /* CloseParenToken */, 82 /* DoKeyword */, 83 /* ElseKeyword */, 74 /* CaseKeyword */], anyToken, [isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNotForContext], 2 /* Space */),
+ rule("SpaceBetweenStatements", [21 /* CloseParenToken */, 83 /* DoKeyword */, 84 /* ElseKeyword */, 75 /* CaseKeyword */], anyToken, [isNonJsxSameLineTokenContext, isNonJsxElementOrFragmentContext, isNotForContext], 2 /* Space */),
// This low-pri rule takes care of "try {" and "finally {" in case the rule SpaceBeforeOpenBraceInControl didn't execute on FormatOnEnter.
- rule("SpaceAfterTryFinally", [103 /* TryKeyword */, 88 /* FinallyKeyword */], 18 /* OpenBraceToken */, [isNonJsxSameLineTokenContext], 2 /* Space */),
+ rule("SpaceAfterTryFinally", [104 /* TryKeyword */, 89 /* FinallyKeyword */], 18 /* OpenBraceToken */, [isNonJsxSameLineTokenContext], 2 /* Space */),
];
return highPriorityCommonRules.concat(userConfigurableRules, lowPriorityCommonRules);
}
@@ -108835,45 +110057,45 @@
return function (context) { return !context.options || !context.options.hasOwnProperty(optionName) || !!context.options[optionName]; };
}
function isForContext(context) {
- return context.contextNode.kind === 225 /* ForStatement */;
+ return context.contextNode.kind === 226 /* ForStatement */;
}
function isNotForContext(context) {
return !isForContext(context);
}
function isBinaryOpContext(context) {
switch (context.contextNode.kind) {
- case 204 /* BinaryExpression */:
- case 205 /* ConditionalExpression */:
- case 175 /* ConditionalType */:
- case 212 /* AsExpression */:
- case 257 /* ExportSpecifier */:
- case 253 /* ImportSpecifier */:
- case 163 /* TypePredicate */:
- case 173 /* UnionType */:
- case 174 /* IntersectionType */:
+ case 205 /* BinaryExpression */:
+ case 206 /* ConditionalExpression */:
+ case 176 /* ConditionalType */:
+ case 213 /* AsExpression */:
+ case 258 /* ExportSpecifier */:
+ case 254 /* ImportSpecifier */:
+ case 164 /* TypePredicate */:
+ case 174 /* UnionType */:
+ case 175 /* IntersectionType */:
return true;
// equals in binding elements: function foo([[x, y] = [1, 2]])
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
// equals in type X = ...
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
// equal in import a = module('a');
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
// equal in let a = 0;
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
// equal in p = 0;
- case 151 /* Parameter */:
- case 278 /* EnumMember */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- return context.currentTokenSpan.kind === 59 /* EqualsToken */ || context.nextTokenSpan.kind === 59 /* EqualsToken */;
+ case 152 /* Parameter */:
+ case 279 /* EnumMember */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ return context.currentTokenSpan.kind === 60 /* EqualsToken */ || context.nextTokenSpan.kind === 60 /* EqualsToken */;
// "in" keyword in for (let x in []) { }
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
// "in" keyword in [P in keyof T]: T[P]
- case 150 /* TypeParameter */:
- return context.currentTokenSpan.kind === 93 /* InKeyword */ || context.nextTokenSpan.kind === 93 /* InKeyword */ || context.currentTokenSpan.kind === 59 /* EqualsToken */ || context.nextTokenSpan.kind === 59 /* EqualsToken */;
+ case 151 /* TypeParameter */:
+ return context.currentTokenSpan.kind === 94 /* InKeyword */ || context.nextTokenSpan.kind === 94 /* InKeyword */ || context.currentTokenSpan.kind === 60 /* EqualsToken */ || context.nextTokenSpan.kind === 60 /* EqualsToken */;
// Technically, "of" is not a binary operator, but format it the same way as "in"
- case 227 /* ForOfStatement */:
- return context.currentTokenSpan.kind === 147 /* OfKeyword */ || context.nextTokenSpan.kind === 147 /* OfKeyword */;
+ case 228 /* ForOfStatement */:
+ return context.currentTokenSpan.kind === 148 /* OfKeyword */ || context.nextTokenSpan.kind === 148 /* OfKeyword */;
}
return false;
}
@@ -108885,22 +110107,22 @@
}
function isTypeAnnotationContext(context) {
var contextKind = context.contextNode.kind;
- return contextKind === 154 /* PropertyDeclaration */ ||
- contextKind === 153 /* PropertySignature */ ||
- contextKind === 151 /* Parameter */ ||
- contextKind === 237 /* VariableDeclaration */ ||
+ return contextKind === 155 /* PropertyDeclaration */ ||
+ contextKind === 154 /* PropertySignature */ ||
+ contextKind === 152 /* Parameter */ ||
+ contextKind === 238 /* VariableDeclaration */ ||
ts.isFunctionLikeKind(contextKind);
}
function isConditionalOperatorContext(context) {
- return context.contextNode.kind === 205 /* ConditionalExpression */ ||
- context.contextNode.kind === 175 /* ConditionalType */;
+ return context.contextNode.kind === 206 /* ConditionalExpression */ ||
+ context.contextNode.kind === 176 /* ConditionalType */;
}
function isSameLineTokenOrBeforeBlockContext(context) {
return context.TokensAreOnSameLine() || isBeforeBlockContext(context);
}
function isBraceWrappedContext(context) {
- return context.contextNode.kind === 184 /* ObjectBindingPattern */ ||
- context.contextNode.kind === 181 /* MappedType */ ||
+ return context.contextNode.kind === 185 /* ObjectBindingPattern */ ||
+ context.contextNode.kind === 182 /* MappedType */ ||
isSingleLineBlockContext(context);
}
// This check is done before an open brace in a control construct, a function, or a typescript block declaration
@@ -108926,31 +110148,31 @@
return true;
}
switch (node.kind) {
- case 218 /* Block */:
- case 246 /* CaseBlock */:
- case 188 /* ObjectLiteralExpression */:
- case 245 /* ModuleBlock */:
+ case 219 /* Block */:
+ case 247 /* CaseBlock */:
+ case 189 /* ObjectLiteralExpression */:
+ case 246 /* ModuleBlock */:
return true;
}
return false;
}
function isFunctionDeclContext(context) {
switch (context.contextNode.kind) {
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 240 /* FunctionDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
// case SyntaxKind.MemberFunctionDeclaration:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
// case SyntaxKind.MethodSignature:
- case 160 /* CallSignature */:
- case 196 /* FunctionExpression */:
- case 157 /* Constructor */:
- case 197 /* ArrowFunction */:
+ case 161 /* CallSignature */:
+ case 197 /* FunctionExpression */:
+ case 158 /* Constructor */:
+ case 198 /* ArrowFunction */:
// case SyntaxKind.ConstructorDeclaration:
// case SyntaxKind.SimpleArrowFunctionExpression:
// case SyntaxKind.ParenthesizedArrowFunctionExpression:
- case 241 /* InterfaceDeclaration */: // This one is not truly a function, but for formatting purposes, it acts just like one
+ case 242 /* InterfaceDeclaration */: // This one is not truly a function, but for formatting purposes, it acts just like one
return true;
}
return false;
@@ -108959,40 +110181,40 @@
return !isFunctionDeclContext(context);
}
function isFunctionDeclarationOrFunctionExpressionContext(context) {
- return context.contextNode.kind === 239 /* FunctionDeclaration */ || context.contextNode.kind === 196 /* FunctionExpression */;
+ return context.contextNode.kind === 240 /* FunctionDeclaration */ || context.contextNode.kind === 197 /* FunctionExpression */;
}
function isTypeScriptDeclWithBlockContext(context) {
return nodeIsTypeScriptDeclWithBlockContext(context.contextNode);
}
function nodeIsTypeScriptDeclWithBlockContext(node) {
switch (node.kind) {
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
- case 168 /* TypeLiteral */:
- case 244 /* ModuleDeclaration */:
- case 255 /* ExportDeclaration */:
- case 256 /* NamedExports */:
- case 249 /* ImportDeclaration */:
- case 252 /* NamedImports */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 169 /* TypeLiteral */:
+ case 245 /* ModuleDeclaration */:
+ case 256 /* ExportDeclaration */:
+ case 257 /* NamedExports */:
+ case 250 /* ImportDeclaration */:
+ case 253 /* NamedImports */:
return true;
}
return false;
}
function isAfterCodeBlockContext(context) {
switch (context.currentTokenParent.kind) {
- case 240 /* ClassDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 243 /* EnumDeclaration */:
- case 274 /* CatchClause */:
- case 245 /* ModuleBlock */:
- case 232 /* SwitchStatement */:
+ case 241 /* ClassDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 275 /* CatchClause */:
+ case 246 /* ModuleBlock */:
+ case 233 /* SwitchStatement */:
return true;
- case 218 /* Block */: {
+ case 219 /* Block */: {
var blockParent = context.currentTokenParent.parent;
// In a codefix scenario, we can't rely on parents being set. So just always return true.
- if (!blockParent || blockParent.kind !== 197 /* ArrowFunction */ && blockParent.kind !== 196 /* FunctionExpression */) {
+ if (!blockParent || blockParent.kind !== 198 /* ArrowFunction */ && blockParent.kind !== 197 /* FunctionExpression */) {
return true;
}
}
@@ -109001,31 +110223,31 @@
}
function isControlDeclContext(context) {
switch (context.contextNode.kind) {
- case 222 /* IfStatement */:
- case 232 /* SwitchStatement */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 224 /* WhileStatement */:
- case 235 /* TryStatement */:
- case 223 /* DoStatement */:
- case 231 /* WithStatement */:
+ case 223 /* IfStatement */:
+ case 233 /* SwitchStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 225 /* WhileStatement */:
+ case 236 /* TryStatement */:
+ case 224 /* DoStatement */:
+ case 232 /* WithStatement */:
// TODO
// case SyntaxKind.ElseClause:
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return true;
default:
return false;
}
}
function isObjectContext(context) {
- return context.contextNode.kind === 188 /* ObjectLiteralExpression */;
+ return context.contextNode.kind === 189 /* ObjectLiteralExpression */;
}
function isFunctionCallContext(context) {
- return context.contextNode.kind === 191 /* CallExpression */;
+ return context.contextNode.kind === 192 /* CallExpression */;
}
function isNewContext(context) {
- return context.contextNode.kind === 192 /* NewExpression */;
+ return context.contextNode.kind === 193 /* NewExpression */;
}
function isFunctionCallOrNewContext(context) {
return isFunctionCallContext(context) || isNewContext(context);
@@ -109037,28 +110259,28 @@
return context.nextTokenSpan.kind !== 23 /* CloseBracketToken */;
}
function isArrowFunctionContext(context) {
- return context.contextNode.kind === 197 /* ArrowFunction */;
+ return context.contextNode.kind === 198 /* ArrowFunction */;
}
function isImportTypeContext(context) {
- return context.contextNode.kind === 183 /* ImportType */;
+ return context.contextNode.kind === 184 /* ImportType */;
}
function isNonJsxSameLineTokenContext(context) {
return context.TokensAreOnSameLine() && context.contextNode.kind !== 11 /* JsxText */;
}
function isNonJsxElementOrFragmentContext(context) {
- return context.contextNode.kind !== 260 /* JsxElement */ && context.contextNode.kind !== 264 /* JsxFragment */;
+ return context.contextNode.kind !== 261 /* JsxElement */ && context.contextNode.kind !== 265 /* JsxFragment */;
}
function isJsxExpressionContext(context) {
- return context.contextNode.kind === 270 /* JsxExpression */ || context.contextNode.kind === 269 /* JsxSpreadAttribute */;
+ return context.contextNode.kind === 271 /* JsxExpression */ || context.contextNode.kind === 270 /* JsxSpreadAttribute */;
}
function isNextTokenParentJsxAttribute(context) {
- return context.nextTokenParent.kind === 267 /* JsxAttribute */;
+ return context.nextTokenParent.kind === 268 /* JsxAttribute */;
}
function isJsxAttributeContext(context) {
- return context.contextNode.kind === 267 /* JsxAttribute */;
+ return context.contextNode.kind === 268 /* JsxAttribute */;
}
function isJsxSelfClosingElementContext(context) {
- return context.contextNode.kind === 261 /* JsxSelfClosingElement */;
+ return context.contextNode.kind === 262 /* JsxSelfClosingElement */;
}
function isNotBeforeBlockInFunctionDeclarationContext(context) {
return !isFunctionDeclContext(context) && !isBeforeBlockContext(context);
@@ -109073,45 +110295,45 @@
while (ts.isExpressionNode(node)) {
node = node.parent;
}
- return node.kind === 152 /* Decorator */;
+ return node.kind === 153 /* Decorator */;
}
function isStartOfVariableDeclarationList(context) {
- return context.currentTokenParent.kind === 238 /* VariableDeclarationList */ &&
+ return context.currentTokenParent.kind === 239 /* VariableDeclarationList */ &&
context.currentTokenParent.getStart(context.sourceFile) === context.currentTokenSpan.pos;
}
function isNotFormatOnEnter(context) {
return context.formattingRequestKind !== 2 /* FormatOnEnter */;
}
function isModuleDeclContext(context) {
- return context.contextNode.kind === 244 /* ModuleDeclaration */;
+ return context.contextNode.kind === 245 /* ModuleDeclaration */;
}
function isObjectTypeContext(context) {
- return context.contextNode.kind === 168 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration;
+ return context.contextNode.kind === 169 /* TypeLiteral */; // && context.contextNode.parent.kind !== SyntaxKind.InterfaceDeclaration;
}
function isConstructorSignatureContext(context) {
- return context.contextNode.kind === 161 /* ConstructSignature */;
+ return context.contextNode.kind === 162 /* ConstructSignature */;
}
function isTypeArgumentOrParameterOrAssertion(token, parent) {
if (token.kind !== 28 /* LessThanToken */ && token.kind !== 30 /* GreaterThanToken */) {
return false;
}
switch (parent.kind) {
- case 164 /* TypeReference */:
- case 194 /* TypeAssertionExpression */:
- case 242 /* TypeAliasDeclaration */:
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
- case 211 /* ExpressionWithTypeArguments */:
+ case 165 /* TypeReference */:
+ case 195 /* TypeAssertionExpression */:
+ case 243 /* TypeAliasDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
+ case 212 /* ExpressionWithTypeArguments */:
return true;
default:
return false;
@@ -109122,16 +110344,16 @@
isTypeArgumentOrParameterOrAssertion(context.nextTokenSpan, context.nextTokenParent);
}
function isTypeAssertionContext(context) {
- return context.contextNode.kind === 194 /* TypeAssertionExpression */;
+ return context.contextNode.kind === 195 /* TypeAssertionExpression */;
}
function isVoidOpContext(context) {
- return context.currentTokenSpan.kind === 106 /* VoidKeyword */ && context.currentTokenParent.kind === 200 /* VoidExpression */;
+ return context.currentTokenSpan.kind === 107 /* VoidKeyword */ && context.currentTokenParent.kind === 201 /* VoidExpression */;
}
function isYieldOrYieldStarWithOperand(context) {
- return context.contextNode.kind === 207 /* YieldExpression */ && context.contextNode.expression !== undefined;
+ return context.contextNode.kind === 208 /* YieldExpression */ && context.contextNode.expression !== undefined;
}
function isNonNullAssertionContext(context) {
- return context.contextNode.kind === 213 /* NonNullExpression */;
+ return context.contextNode.kind === 214 /* NonNullExpression */;
}
})(formatting = ts.formatting || (ts.formatting = {}));
})(ts || (ts = {}));
@@ -109182,12 +110404,12 @@
return map;
}
function getRuleBucketIndex(row, column) {
- ts.Debug.assert(row <= 147 /* LastKeyword */ && column <= 147 /* LastKeyword */, "Must compute formatting context from tokens");
+ ts.Debug.assert(row <= 148 /* LastKeyword */ && column <= 148 /* LastKeyword */, "Must compute formatting context from tokens");
return (row * mapRowLength) + column;
}
var maskBitSize = 5;
var mask = 31; // MaskBitSize bits
- var mapRowLength = 147 /* LastToken */ + 1;
+ var mapRowLength = 148 /* LastToken */ + 1;
var RulesPosition;
(function (RulesPosition) {
RulesPosition[RulesPosition["IgnoreRulesSpecific"] = 0] = "IgnoreRulesSpecific";
@@ -109365,17 +110587,17 @@
// i.e. parent is class declaration with the list of members and node is one of members.
function isListElement(parent, node) {
switch (parent.kind) {
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
return ts.rangeContainsRange(parent.members, node);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
var body = parent.body;
- return !!body && body.kind === 245 /* ModuleBlock */ && ts.rangeContainsRange(body.statements, node);
- case 284 /* SourceFile */:
- case 218 /* Block */:
- case 245 /* ModuleBlock */:
+ return !!body && body.kind === 246 /* ModuleBlock */ && ts.rangeContainsRange(body.statements, node);
+ case 285 /* SourceFile */:
+ case 219 /* Block */:
+ case 246 /* ModuleBlock */:
return ts.rangeContainsRange(parent.statements, node);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return ts.rangeContainsRange(parent.block.statements, node);
}
return false;
@@ -109597,19 +110819,19 @@
return node.modifiers[0].kind;
}
switch (node.kind) {
- case 240 /* ClassDeclaration */: return 76 /* ClassKeyword */;
- case 241 /* InterfaceDeclaration */: return 110 /* InterfaceKeyword */;
- case 239 /* FunctionDeclaration */: return 90 /* FunctionKeyword */;
- case 243 /* EnumDeclaration */: return 243 /* EnumDeclaration */;
- case 158 /* GetAccessor */: return 126 /* GetKeyword */;
- case 159 /* SetAccessor */: return 137 /* SetKeyword */;
- case 156 /* MethodDeclaration */:
+ case 241 /* ClassDeclaration */: return 77 /* ClassKeyword */;
+ case 242 /* InterfaceDeclaration */: return 111 /* InterfaceKeyword */;
+ case 240 /* FunctionDeclaration */: return 91 /* FunctionKeyword */;
+ case 244 /* EnumDeclaration */: return 244 /* EnumDeclaration */;
+ case 159 /* GetAccessor */: return 127 /* GetKeyword */;
+ case 160 /* SetAccessor */: return 138 /* SetKeyword */;
+ case 157 /* MethodDeclaration */:
if (node.asteriskToken) {
return 40 /* AsteriskToken */;
}
// falls through
- case 154 /* PropertyDeclaration */:
- case 151 /* Parameter */:
+ case 155 /* PropertyDeclaration */:
+ case 152 /* Parameter */:
var name = ts.getNameOfDeclaration(node);
if (name) {
return name.kind;
@@ -109659,22 +110881,22 @@
case 18 /* OpenBraceToken */:
case 19 /* CloseBraceToken */:
case 21 /* CloseParenToken */:
- case 83 /* ElseKeyword */:
- case 107 /* WhileKeyword */:
+ case 84 /* ElseKeyword */:
+ case 108 /* WhileKeyword */:
case 58 /* AtToken */:
return false;
case 42 /* SlashToken */:
case 30 /* GreaterThanToken */:
switch (container.kind) {
- case 262 /* JsxOpeningElement */:
- case 263 /* JsxClosingElement */:
- case 261 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
+ case 264 /* JsxClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
return false;
}
break;
case 22 /* OpenBracketToken */:
case 23 /* CloseBracketToken */:
- if (container.kind !== 181 /* MappedType */) {
+ if (container.kind !== 182 /* MappedType */) {
return false;
}
break;
@@ -109766,7 +110988,7 @@
consumeTokenAndAdvanceScanner(tokenInfo, node, parentDynamicIndentation, child);
return inheritedIndentation;
}
- var effectiveParentStartLine = child.kind === 152 /* Decorator */ ? childStartLine : undecoratedParentStartLine;
+ var effectiveParentStartLine = child.kind === 153 /* Decorator */ ? childStartLine : undecoratedParentStartLine;
var childIndentation = computeIndentation(child, childStartLine, childIndentationAmount, node, parentDynamicIndentation, effectiveParentStartLine);
processNode(child, childContextNode, childStartLine, undecoratedChildStartLine, childIndentation.indentation, childIndentation.delta);
if (child.kind === 11 /* JsxText */) {
@@ -109774,7 +110996,7 @@
indentMultilineCommentOrJsxText(range, childIndentation.indentation, /*firstLineIsIndented*/ true, /*indentFinalLine*/ false);
}
childContextNode = node;
- if (isFirstListItem && parent.kind === 187 /* ArrayLiteralExpression */ && inheritedIndentation === -1 /* Unknown */) {
+ if (isFirstListItem && parent.kind === 188 /* ArrayLiteralExpression */ && inheritedIndentation === -1 /* Unknown */) {
inheritedIndentation = childIndentation.indentation;
}
return inheritedIndentation;
@@ -110192,12 +111414,12 @@
formatting.getRangeOfEnclosingComment = getRangeOfEnclosingComment;
function getOpenTokenForList(node, list) {
switch (node.kind) {
- case 157 /* Constructor */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 197 /* ArrowFunction */:
+ case 158 /* Constructor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 198 /* ArrowFunction */:
if (node.typeParameters === list) {
return 28 /* LessThanToken */;
}
@@ -110205,8 +111427,8 @@
return 20 /* OpenParenToken */;
}
break;
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
if (node.typeArguments === list) {
return 28 /* LessThanToken */;
}
@@ -110214,12 +111436,12 @@
return 20 /* OpenParenToken */;
}
break;
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
if (node.typeArguments === list) {
return 28 /* LessThanToken */;
}
break;
- case 168 /* TypeLiteral */:
+ case 169 /* TypeLiteral */:
return 18 /* OpenBraceToken */;
}
return 0 /* Unknown */;
@@ -110336,7 +111558,7 @@
if (options.indentStyle === ts.IndentStyle.Block) {
return getBlockIndent(sourceFile, position, options);
}
- if (precedingToken.kind === 27 /* CommaToken */ && precedingToken.parent.kind !== 204 /* BinaryExpression */) {
+ if (precedingToken.kind === 27 /* CommaToken */ && precedingToken.parent.kind !== 205 /* BinaryExpression */) {
// previous token is comma that separates items in list - find the previous item and try to derive indentation from it
var actualIndentation = getActualIndentationForListItemBeforeComma(precedingToken, sourceFile, options);
if (actualIndentation !== -1 /* Unknown */) {
@@ -110490,7 +111712,7 @@
// - parent is SourceFile - by default immediate children of SourceFile are not indented except when user indents them manually
// - parent and child are not on the same line
var useActualIndentation = (ts.isDeclaration(current) || ts.isStatementButNotDeclaration(current)) &&
- (parent.kind === 284 /* SourceFile */ || !parentAndChildShareLine);
+ (parent.kind === 285 /* SourceFile */ || !parentAndChildShareLine);
if (!useActualIndentation) {
return -1 /* Unknown */;
}
@@ -110538,8 +111760,8 @@
}
SmartIndenter.isArgumentAndStartLineOverlapsExpressionBeingCalled = isArgumentAndStartLineOverlapsExpressionBeingCalled;
function childStartsOnTheSameLineWithElseInIfStatement(parent, child, childStartLine, sourceFile) {
- if (parent.kind === 222 /* IfStatement */ && parent.elseStatement === child) {
- var elseKeyword = ts.findChildOfKind(parent, 83 /* ElseKeyword */, sourceFile);
+ if (parent.kind === 223 /* IfStatement */ && parent.elseStatement === child) {
+ var elseKeyword = ts.findChildOfKind(parent, 84 /* ElseKeyword */, sourceFile);
ts.Debug.assert(elseKeyword !== undefined);
var elseKeywordStartLine = getStartLineAndCharacterForNode(elseKeyword, sourceFile).line;
return elseKeywordStartLine === childStartLine;
@@ -110556,40 +111778,40 @@
}
function getListByRange(start, end, node, sourceFile) {
switch (node.kind) {
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return getList(node.typeArguments);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return getList(node.properties);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return getList(node.elements);
- case 168 /* TypeLiteral */:
+ case 169 /* TypeLiteral */:
return getList(node.members);
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 160 /* CallSignature */:
- case 157 /* Constructor */:
- case 166 /* ConstructorType */:
- case 161 /* ConstructSignature */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 161 /* CallSignature */:
+ case 158 /* Constructor */:
+ case 167 /* ConstructorType */:
+ case 162 /* ConstructSignature */:
return getList(node.typeParameters) || getList(node.parameters);
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 308 /* JSDocTemplateTag */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 309 /* JSDocTemplateTag */:
return getList(node.typeParameters);
- case 192 /* NewExpression */:
- case 191 /* CallExpression */:
+ case 193 /* NewExpression */:
+ case 192 /* CallExpression */:
return getList(node.typeArguments) || getList(node.arguments);
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
return getList(node.declarations);
- case 252 /* NamedImports */:
- case 256 /* NamedExports */:
+ case 253 /* NamedImports */:
+ case 257 /* NamedExports */:
return getList(node.elements);
- case 184 /* ObjectBindingPattern */:
- case 185 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
return getList(node.elements);
}
function getList(list) {
@@ -110612,7 +111834,7 @@
return findColumnForFirstNonWhitespaceCharacterInLine(sourceFile.getLineAndCharacterOfPosition(list.pos), sourceFile, options);
}
function getActualIndentationForListItem(node, sourceFile, options, listIndentsChild) {
- if (node.parent && node.parent.kind === 238 /* VariableDeclarationList */) {
+ if (node.parent && node.parent.kind === 239 /* VariableDeclarationList */) {
// VariableDeclarationList has no wrapping tokens
return -1 /* Unknown */;
}
@@ -110685,83 +111907,83 @@
function nodeWillIndentChild(settings, parent, child, sourceFile, indentByDefault) {
var childKind = child ? child.kind : 0 /* Unknown */;
switch (parent.kind) {
- case 221 /* ExpressionStatement */:
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 187 /* ArrayLiteralExpression */:
- case 218 /* Block */:
- case 245 /* ModuleBlock */:
- case 188 /* ObjectLiteralExpression */:
- case 168 /* TypeLiteral */:
- case 181 /* MappedType */:
- case 170 /* TupleType */:
- case 246 /* CaseBlock */:
- case 272 /* DefaultClause */:
- case 271 /* CaseClause */:
- case 195 /* ParenthesizedExpression */:
- case 189 /* PropertyAccessExpression */:
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
- case 219 /* VariableStatement */:
- case 254 /* ExportAssignment */:
- case 230 /* ReturnStatement */:
- case 205 /* ConditionalExpression */:
- case 185 /* ArrayBindingPattern */:
- case 184 /* ObjectBindingPattern */:
- case 262 /* JsxOpeningElement */:
- case 265 /* JsxOpeningFragment */:
- case 261 /* JsxSelfClosingElement */:
- case 270 /* JsxExpression */:
- case 155 /* MethodSignature */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 151 /* Parameter */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 177 /* ParenthesizedType */:
- case 193 /* TaggedTemplateExpression */:
- case 201 /* AwaitExpression */:
- case 256 /* NamedExports */:
- case 252 /* NamedImports */:
- case 257 /* ExportSpecifier */:
- case 253 /* ImportSpecifier */:
- case 154 /* PropertyDeclaration */:
- return true;
- case 237 /* VariableDeclaration */:
- case 275 /* PropertyAssignment */:
- if (!settings.indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === 188 /* ObjectLiteralExpression */) { // TODO: GH#18217
+ case 222 /* ExpressionStatement */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 188 /* ArrayLiteralExpression */:
+ case 219 /* Block */:
+ case 246 /* ModuleBlock */:
+ case 189 /* ObjectLiteralExpression */:
+ case 169 /* TypeLiteral */:
+ case 182 /* MappedType */:
+ case 171 /* TupleType */:
+ case 247 /* CaseBlock */:
+ case 273 /* DefaultClause */:
+ case 272 /* CaseClause */:
+ case 196 /* ParenthesizedExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
+ case 220 /* VariableStatement */:
+ case 255 /* ExportAssignment */:
+ case 231 /* ReturnStatement */:
+ case 206 /* ConditionalExpression */:
+ case 186 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
+ case 263 /* JsxOpeningElement */:
+ case 266 /* JsxOpeningFragment */:
+ case 262 /* JsxSelfClosingElement */:
+ case 271 /* JsxExpression */:
+ case 156 /* MethodSignature */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 152 /* Parameter */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 178 /* ParenthesizedType */:
+ case 194 /* TaggedTemplateExpression */:
+ case 202 /* AwaitExpression */:
+ case 257 /* NamedExports */:
+ case 253 /* NamedImports */:
+ case 258 /* ExportSpecifier */:
+ case 254 /* ImportSpecifier */:
+ case 155 /* PropertyDeclaration */:
+ return true;
+ case 238 /* VariableDeclaration */:
+ case 276 /* PropertyAssignment */:
+ if (!settings.indentMultiLineObjectLiteralBeginningOnBlankLine && sourceFile && childKind === 189 /* ObjectLiteralExpression */) { // TODO: GH#18217
return rangeIsOnOneLine(sourceFile, child);
}
return true;
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 225 /* ForStatement */:
- case 222 /* IfStatement */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 156 /* MethodDeclaration */:
- case 197 /* ArrowFunction */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- return childKind !== 218 /* Block */;
- case 255 /* ExportDeclaration */:
- return childKind !== 256 /* NamedExports */;
- case 249 /* ImportDeclaration */:
- return childKind !== 250 /* ImportClause */ ||
- (!!child.namedBindings && child.namedBindings.kind !== 252 /* NamedImports */);
- case 260 /* JsxElement */:
- return childKind !== 263 /* JsxClosingElement */;
- case 264 /* JsxFragment */:
- return childKind !== 266 /* JsxClosingFragment */;
- case 174 /* IntersectionType */:
- case 173 /* UnionType */:
- if (childKind === 168 /* TypeLiteral */) {
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 226 /* ForStatement */:
+ case 223 /* IfStatement */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 157 /* MethodDeclaration */:
+ case 198 /* ArrowFunction */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ return childKind !== 219 /* Block */;
+ case 256 /* ExportDeclaration */:
+ return childKind !== 257 /* NamedExports */;
+ case 250 /* ImportDeclaration */:
+ return childKind !== 251 /* ImportClause */ ||
+ (!!child.namedBindings && child.namedBindings.kind !== 253 /* NamedImports */);
+ case 261 /* JsxElement */:
+ return childKind !== 264 /* JsxClosingElement */;
+ case 265 /* JsxFragment */:
+ return childKind !== 267 /* JsxClosingFragment */;
+ case 175 /* IntersectionType */:
+ case 174 /* UnionType */:
+ if (childKind === 169 /* TypeLiteral */) {
return false;
}
// falls through
@@ -110772,11 +111994,11 @@
SmartIndenter.nodeWillIndentChild = nodeWillIndentChild;
function isControlFlowEndingStatement(kind, parent) {
switch (kind) {
- case 230 /* ReturnStatement */:
- case 234 /* ThrowStatement */:
- case 228 /* ContinueStatement */:
- case 229 /* BreakStatement */:
- return parent.kind !== 218 /* Block */;
+ case 231 /* ReturnStatement */:
+ case 235 /* ThrowStatement */:
+ case 229 /* ContinueStatement */:
+ case 230 /* BreakStatement */:
+ return parent.kind !== 219 /* Block */;
default:
return false;
}
@@ -110918,7 +112140,7 @@
* Checks if 'candidate' argument is a legal separator in the list that contains 'node' as an element
*/
function isSeparator(node, candidate) {
- return !!candidate && !!node.parent && (candidate.kind === 27 /* CommaToken */ || (candidate.kind === 26 /* SemicolonToken */ && node.parent.kind === 188 /* ObjectLiteralExpression */));
+ return !!candidate && !!node.parent && (candidate.kind === 27 /* CommaToken */ || (candidate.kind === 26 /* SemicolonToken */ && node.parent.kind === 189 /* ObjectLiteralExpression */));
}
function spaces(count) {
var s = "";
@@ -111079,7 +112301,7 @@
}
}
else {
- endNode = node.kind !== 237 /* VariableDeclaration */ && node.questionToken ? node.questionToken : node.name;
+ endNode = node.kind !== 238 /* VariableDeclaration */ && node.questionToken ? node.questionToken : node.name;
}
this.insertNodeAt(sourceFile, endNode.end, type, { prefix: ": " });
};
@@ -111191,18 +112413,18 @@
};
ChangeTracker.prototype.getInsertNodeAfterOptionsWorker = function (node) {
switch (node.kind) {
- case 240 /* ClassDeclaration */:
- case 244 /* ModuleDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 245 /* ModuleDeclaration */:
return { prefix: this.newLineCharacter, suffix: this.newLineCharacter };
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
case 10 /* StringLiteral */:
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return { prefix: ", " };
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return { suffix: "," + this.newLineCharacter };
- case 85 /* ExportKeyword */:
+ case 86 /* ExportKeyword */:
return { prefix: " " };
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return {};
default:
ts.Debug.assert(ts.isStatement(node) || ts.isClassOrTypeElement(node)); // Else we haven't handled this kind of node yet -- add it
@@ -111211,12 +112433,12 @@
};
ChangeTracker.prototype.insertName = function (sourceFile, node, name) {
ts.Debug.assert(!node.name);
- if (node.kind === 197 /* ArrowFunction */) {
+ if (node.kind === 198 /* ArrowFunction */) {
var arrow = ts.findChildOfKind(node, 37 /* EqualsGreaterThanToken */, sourceFile);
var lparen = ts.findChildOfKind(node, 20 /* OpenParenToken */, sourceFile);
if (lparen) {
// `() => {}` --> `function f() {}`
- this.insertNodesAt(sourceFile, lparen.getStart(sourceFile), [ts.createToken(90 /* FunctionKeyword */), ts.createIdentifier(name)], { joiner: " " });
+ this.insertNodesAt(sourceFile, lparen.getStart(sourceFile), [ts.createToken(91 /* FunctionKeyword */), ts.createIdentifier(name)], { joiner: " " });
deleteNode(this, sourceFile, arrow);
}
else {
@@ -111225,14 +112447,14 @@
// Replacing full range of arrow to get rid of the leading space -- replace ` =>` with `)`
this.replaceRange(sourceFile, arrow, ts.createToken(21 /* CloseParenToken */));
}
- if (node.body.kind !== 218 /* Block */) {
+ if (node.body.kind !== 219 /* Block */) {
// `() => 0` => `function f() { return 0; }`
- this.insertNodesAt(sourceFile, node.body.getStart(sourceFile), [ts.createToken(18 /* OpenBraceToken */), ts.createToken(97 /* ReturnKeyword */)], { joiner: " ", suffix: " " });
+ this.insertNodesAt(sourceFile, node.body.getStart(sourceFile), [ts.createToken(18 /* OpenBraceToken */), ts.createToken(98 /* ReturnKeyword */)], { joiner: " ", suffix: " " });
this.insertNodesAt(sourceFile, node.body.end, [ts.createToken(26 /* SemicolonToken */), ts.createToken(19 /* CloseBraceToken */)], { joiner: " " });
}
}
else {
- var pos = ts.findChildOfKind(node, node.kind === 196 /* FunctionExpression */ ? 90 /* FunctionKeyword */ : 76 /* ClassKeyword */, sourceFile).end;
+ var pos = ts.findChildOfKind(node, node.kind === 197 /* FunctionExpression */ ? 91 /* FunctionKeyword */ : 77 /* ClassKeyword */, sourceFile).end;
this.insertNodeAt(sourceFile, pos, ts.createIdentifier(name), { prefix: " " });
}
};
@@ -111459,7 +112681,7 @@
function newFileChangesWorker(oldFile, scriptKind, statements, newLineCharacter, formatContext) {
// TODO: this emits the file, parses it back, then formats it that -- may be a less roundabout way to do this
var nonFormattedText = statements.map(function (s) { return getNonformattedText(s, oldFile, newLineCharacter).text; }).join(newLineCharacter);
- var sourceFile = ts.createSourceFile("any file name", nonFormattedText, 7 /* ESNext */, /*setParentNodes*/ true, scriptKind);
+ var sourceFile = ts.createSourceFile("any file name", nonFormattedText, 8 /* ESNext */, /*setParentNodes*/ true, scriptKind);
var changes = ts.formatting.formatDocument(sourceFile, formatContext);
return applyChanges(nonFormattedText, changes) + newLineCharacter;
}
@@ -111727,14 +112949,14 @@
}
textChanges_3.isValidLocationToAddComment = isValidLocationToAddComment;
function needSemicolonBetween(a, b) {
- return (ts.isPropertySignature(a) || ts.isPropertyDeclaration(a)) && ts.isClassOrTypeElement(b) && b.name.kind === 149 /* ComputedPropertyName */
+ return (ts.isPropertySignature(a) || ts.isPropertyDeclaration(a)) && ts.isClassOrTypeElement(b) && b.name.kind === 150 /* ComputedPropertyName */
|| ts.isStatementButNotDeclaration(a) && ts.isStatementButNotDeclaration(b); // TODO: only if b would start with a `(` or `[`
}
var deleteDeclaration;
(function (deleteDeclaration_1) {
function deleteDeclaration(changes, deletedNodesInLists, sourceFile, node) {
switch (node.kind) {
- case 151 /* Parameter */: {
+ case 152 /* Parameter */: {
var oldFunction = node.parent;
if (ts.isArrowFunction(oldFunction) &&
oldFunction.parameters.length === 1 &&
@@ -111749,14 +112971,14 @@
}
break;
}
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
deleteNode(changes, sourceFile, node,
// For first import, leave header comment in place
node === sourceFile.imports[0].parent ? { leadingTriviaOption: LeadingTriviaOption.Exclude } : undefined);
break;
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
var pattern = node.parent;
- var preserveComma = pattern.kind === 185 /* ArrayBindingPattern */ && node !== ts.last(pattern.elements);
+ var preserveComma = pattern.kind === 186 /* ArrayBindingPattern */ && node !== ts.last(pattern.elements);
if (preserveComma) {
deleteNode(changes, sourceFile, node);
}
@@ -111764,13 +112986,13 @@
deleteNodeInList(changes, deletedNodesInLists, sourceFile, node);
}
break;
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
deleteVariableDeclaration(changes, deletedNodesInLists, sourceFile, node);
break;
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
deleteNodeInList(changes, deletedNodesInLists, sourceFile, node);
break;
- case 253 /* ImportSpecifier */:
+ case 254 /* ImportSpecifier */:
var namedImports = node.parent;
if (namedImports.elements.length === 1) {
deleteImportBinding(changes, sourceFile, namedImports);
@@ -111779,7 +113001,7 @@
deleteNodeInList(changes, deletedNodesInLists, sourceFile, node);
}
break;
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
deleteImportBinding(changes, sourceFile, node);
break;
default:
@@ -111826,13 +113048,13 @@
// Delete the entire import declaration
// |import * as ns from './file'|
// |import { a } from './file'|
- var importDecl = ts.getAncestor(node, 249 /* ImportDeclaration */);
+ var importDecl = ts.getAncestor(node, 250 /* ImportDeclaration */);
deleteNode(changes, sourceFile, importDecl);
}
}
function deleteVariableDeclaration(changes, deletedNodesInLists, sourceFile, node) {
var parent = node.parent;
- if (parent.kind === 274 /* CatchClause */) {
+ if (parent.kind === 275 /* CatchClause */) {
// TODO: There's currently no unused diagnostic for this, could be a suggestion
changes.deleteNodeRange(sourceFile, ts.findChildOfKind(parent, 20 /* OpenParenToken */, sourceFile), ts.findChildOfKind(parent, 21 /* CloseParenToken */, sourceFile));
return;
@@ -111843,14 +113065,14 @@
}
var gp = parent.parent;
switch (gp.kind) {
- case 227 /* ForOfStatement */:
- case 226 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 227 /* ForInStatement */:
changes.replaceNode(sourceFile, node, ts.createObjectLiteral());
break;
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
deleteNode(changes, sourceFile, parent);
break;
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
deleteNode(changes, sourceFile, gp);
break;
default:
@@ -112013,8 +113235,8 @@
var token = ts.getTokenAtPosition(sourceFile, pos);
var assertion = ts.Debug.assertDefined(ts.findAncestor(token, function (n) { return ts.isAsExpression(n) || ts.isTypeAssertion(n); }));
var replacement = ts.isAsExpression(assertion)
- ? ts.createAsExpression(assertion.expression, ts.createKeywordTypeNode(143 /* UnknownKeyword */))
- : ts.createTypeAssertion(ts.createKeywordTypeNode(143 /* UnknownKeyword */), assertion.expression);
+ ? ts.createAsExpression(assertion.expression, ts.createKeywordTypeNode(144 /* UnknownKeyword */))
+ : ts.createTypeAssertion(ts.createKeywordTypeNode(144 /* UnknownKeyword */), assertion.expression);
changeTracker.replaceNode(sourceFile, assertion.expression, replacement);
}
})(codefix = ts.codefix || (ts.codefix = {}));
@@ -112063,11 +113285,11 @@
function makeChange(changeTracker, sourceFile, pos) {
var token = ts.getTokenAtPosition(sourceFile, pos);
if (!ts.isIdentifier(token)) {
- return ts.Debug.fail("add-name-to-nameless-parameter operates on identifiers, but got a " + ts.formatSyntaxKind(token.kind));
+ return ts.Debug.fail("add-name-to-nameless-parameter operates on identifiers, but got a " + ts.Debug.formatSyntaxKind(token.kind));
}
var param = token.parent;
if (!ts.isParameter(param)) {
- return ts.Debug.fail("Tried to add a parameter name to a non-parameter: " + ts.formatSyntaxKind(token.kind));
+ return ts.Debug.fail("Tried to add a parameter name to a non-parameter: " + ts.Debug.formatSyntaxKind(token.kind));
}
var i = param.parent.parameters.indexOf(param);
ts.Debug.assert(!param.type, "Tried to add a parameter name to a parameter that already had one.");
@@ -112149,26 +113371,26 @@
}
function isDeclarationWithType(node) {
return ts.isFunctionLikeDeclaration(node) ||
- node.kind === 237 /* VariableDeclaration */ ||
- node.kind === 153 /* PropertySignature */ ||
- node.kind === 154 /* PropertyDeclaration */;
+ node.kind === 238 /* VariableDeclaration */ ||
+ node.kind === 154 /* PropertySignature */ ||
+ node.kind === 155 /* PropertyDeclaration */;
}
function transformJSDocType(node) {
switch (node.kind) {
- case 289 /* JSDocAllType */:
- case 290 /* JSDocUnknownType */:
+ case 290 /* JSDocAllType */:
+ case 291 /* JSDocUnknownType */:
return ts.createTypeReferenceNode("any", ts.emptyArray);
- case 293 /* JSDocOptionalType */:
+ case 294 /* JSDocOptionalType */:
return transformJSDocOptionalType(node);
- case 292 /* JSDocNonNullableType */:
+ case 293 /* JSDocNonNullableType */:
return transformJSDocType(node.type);
- case 291 /* JSDocNullableType */:
+ case 292 /* JSDocNullableType */:
return transformJSDocNullableType(node);
- case 295 /* JSDocVariadicType */:
+ case 296 /* JSDocVariadicType */:
return transformJSDocVariadicType(node);
- case 294 /* JSDocFunctionType */:
+ case 295 /* JSDocFunctionType */:
return transformJSDocFunctionType(node);
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return transformJSDocTypeReference(node);
default:
var visited = ts.visitEachChild(node, transformJSDocType, /*context*/ undefined); // TODO: GH#18217
@@ -112190,7 +113412,7 @@
}
function transformJSDocParameter(node) {
var index = node.parent.parameters.indexOf(node);
- var isRest = node.type.kind === 295 /* JSDocVariadicType */ && index === node.parent.parameters.length - 1; // TODO: GH#18217
+ var isRest = node.type.kind === 296 /* JSDocVariadicType */ && index === node.parent.parameters.length - 1; // TODO: GH#18217
var name = node.name || (isRest ? "rest" : "arg" + index);
var dotdotdot = isRest ? ts.createToken(25 /* DotDotDotToken */) : node.dotDotDotToken;
return ts.createParameter(node.decorators, node.modifiers, dotdotdot, name, node.questionToken, ts.visitNode(node.type, transformJSDocType), node.initializer);
@@ -112230,8 +113452,8 @@
var index = ts.createParameter(
/*decorators*/ undefined,
/*modifiers*/ undefined,
- /*dotDotDotToken*/ undefined, node.typeArguments[0].kind === 135 /* NumberKeyword */ ? "n" : "s",
- /*questionToken*/ undefined, ts.createTypeReferenceNode(node.typeArguments[0].kind === 135 /* NumberKeyword */ ? "number" : "string", []),
+ /*dotDotDotToken*/ undefined, node.typeArguments[0].kind === 136 /* NumberKeyword */ ? "n" : "s",
+ /*questionToken*/ undefined, ts.createTypeReferenceNode(node.typeArguments[0].kind === 136 /* NumberKeyword */ ? "number" : "string", []),
/*initializer*/ undefined);
var indexSignature = ts.createTypeLiteralNode([ts.createIndexSignature(/*decorators*/ undefined, /*modifiers*/ undefined, [index], node.typeArguments[1])]);
ts.setEmitFlags(indexSignature, 1 /* SingleLine */);
@@ -112331,7 +113553,7 @@
return errorCode;
}
function doChange(changes, sourceFile, token, errorCode, program, cancellationToken, markSeen, host) {
- if (!ts.isParameterPropertyModifier(token.kind) && token.kind !== 72 /* Identifier */ && token.kind !== 25 /* DotDotDotToken */ && token.kind !== 100 /* ThisKeyword */) {
+ if (!ts.isParameterPropertyModifier(token.kind) && token.kind !== 73 /* Identifier */ && token.kind !== 25 /* DotDotDotToken */ && token.kind !== 101 /* ThisKeyword */) {
return undefined;
}
var parent = token.parent;
@@ -112452,7 +113674,7 @@
function annotate(changes, sourceFile, declaration, type, program, host) {
var typeNode = ts.getTypeNodeIfAccessible(type, declaration, program, host);
if (typeNode) {
- if (ts.isInJSFile(sourceFile) && declaration.kind !== 153 /* PropertySignature */) {
+ if (ts.isInJSFile(sourceFile) && declaration.kind !== 154 /* PropertySignature */) {
var parent = ts.isVariableDeclaration(declaration) ? ts.tryCast(declaration.parent.parent, ts.isVariableStatement) : declaration;
if (!parent) {
return;
@@ -112493,13 +113715,13 @@
return !!merged;
}); });
var tag = ts.createJSDocComment(comments.join("\n"), ts.createNodeArray((oldTags || ts.emptyArray).concat(unmergedNewTags)));
- var jsDocNode = parent.kind === 197 /* ArrowFunction */ ? getJsDocNodeForArrowFunction(parent) : parent;
+ var jsDocNode = parent.kind === 198 /* ArrowFunction */ ? getJsDocNodeForArrowFunction(parent) : parent;
jsDocNode.jsDoc = parent.jsDoc;
jsDocNode.jsDocCache = parent.jsDocCache;
changes.insertJsdocCommentBefore(sourceFile, jsDocNode, tag);
}
function getJsDocNodeForArrowFunction(signature) {
- if (signature.parent.kind === 154 /* PropertyDeclaration */) {
+ if (signature.parent.kind === 155 /* PropertyDeclaration */) {
return signature.parent;
}
return signature.parent.parent;
@@ -112509,14 +113731,14 @@
return undefined;
}
switch (oldTag.kind) {
- case 304 /* JSDocParameterTag */: {
+ case 305 /* JSDocParameterTag */: {
var oldParam = oldTag;
var newParam = newTag;
return ts.isIdentifier(oldParam.name) && ts.isIdentifier(newParam.name) && oldParam.name.escapedText === newParam.name.escapedText
? ts.createJSDocParamTag(newParam.name, newParam.isBracketed, newParam.typeExpression, oldParam.comment)
: undefined;
}
- case 305 /* JSDocReturnTag */:
+ case 306 /* JSDocReturnTag */:
return ts.createJSDocReturnTag(newTag.typeExpression, oldTag.comment);
}
}
@@ -112535,18 +113757,18 @@
function inferTypeForParametersFromUsage(containingFunction, sourceFile, program, cancellationToken) {
var searchToken;
switch (containingFunction.kind) {
- case 157 /* Constructor */:
- searchToken = ts.findChildOfKind(containingFunction, 124 /* ConstructorKeyword */, sourceFile);
+ case 158 /* Constructor */:
+ searchToken = ts.findChildOfKind(containingFunction, 125 /* ConstructorKeyword */, sourceFile);
break;
- case 197 /* ArrowFunction */:
- case 196 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
var parent = containingFunction.parent;
searchToken = ts.isVariableDeclaration(parent) && ts.isIdentifier(parent.name) ?
parent.name :
containingFunction.name;
break;
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 157 /* MethodDeclaration */:
searchToken = containingFunction.name;
break;
}
@@ -112618,21 +113840,21 @@
node = node.parent;
}
switch (node.parent.kind) {
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
usageContext.isNumber = true;
break;
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
inferTypeFromPrefixUnaryExpressionContext(node.parent, usageContext);
break;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
inferTypeFromBinaryExpressionContext(node, node.parent, checker, usageContext);
break;
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
inferTypeFromSwitchStatementLabelContext(node.parent, checker, usageContext);
break;
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
if (node.parent.expression === node) {
inferTypeFromCallExpressionContext(node.parent, checker, usageContext);
}
@@ -112640,13 +113862,13 @@
inferTypeFromContextualType(node, checker, usageContext);
}
break;
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
inferTypeFromPropertyAccessExpressionContext(node.parent, checker, usageContext);
break;
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
inferTypeFromPropertyElementExpressionContext(node.parent, node, checker, usageContext);
break;
- case 237 /* VariableDeclaration */: {
+ case 238 /* VariableDeclaration */: {
var _a = node.parent, name = _a.name, initializer = _a.initializer;
if (node === name) {
if (initializer) { // This can happen for `let x = null;` which still has an implicit-any error.
@@ -112697,17 +113919,17 @@
case 50 /* BarToken */:
case 51 /* CaretToken */:
// CompoundAssignmentOperator
- case 61 /* MinusEqualsToken */:
- case 63 /* AsteriskAsteriskEqualsToken */:
- case 62 /* AsteriskEqualsToken */:
- case 64 /* SlashEqualsToken */:
- case 65 /* PercentEqualsToken */:
- case 69 /* AmpersandEqualsToken */:
- case 70 /* BarEqualsToken */:
- case 71 /* CaretEqualsToken */:
- case 66 /* LessThanLessThanEqualsToken */:
- case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
- case 67 /* GreaterThanGreaterThanEqualsToken */:
+ case 62 /* MinusEqualsToken */:
+ case 64 /* AsteriskAsteriskEqualsToken */:
+ case 63 /* AsteriskEqualsToken */:
+ case 65 /* SlashEqualsToken */:
+ case 66 /* PercentEqualsToken */:
+ case 70 /* AmpersandEqualsToken */:
+ case 71 /* BarEqualsToken */:
+ case 72 /* CaretEqualsToken */:
+ case 67 /* LessThanLessThanEqualsToken */:
+ case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
+ case 68 /* GreaterThanGreaterThanEqualsToken */:
// AdditiveOperator
case 39 /* MinusToken */:
// RelationalOperator
@@ -112723,7 +113945,7 @@
usageContext.isNumber = true;
}
break;
- case 60 /* PlusEqualsToken */:
+ case 61 /* PlusEqualsToken */:
case 38 /* PlusToken */:
var otherOperandType = checker.getTypeAtLocation(parent.left === node ? parent.right : parent.left);
if (otherOperandType.flags & 1056 /* EnumLike */) {
@@ -112740,14 +113962,14 @@
}
break;
// AssignmentOperators
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
case 33 /* EqualsEqualsToken */:
case 35 /* EqualsEqualsEqualsToken */:
case 36 /* ExclamationEqualsEqualsToken */:
case 34 /* ExclamationEqualsToken */:
addCandidateType(usageContext, checker.getTypeAtLocation(parent.left === node ? parent.right : parent.left));
break;
- case 93 /* InKeyword */:
+ case 94 /* InKeyword */:
if (node === parent.left) {
usageContext.isString = true;
}
@@ -112755,7 +113977,7 @@
// LogicalOperator
case 55 /* BarBarToken */:
if (node === parent.left &&
- (node.parent.parent.kind === 237 /* VariableDeclaration */ || ts.isAssignmentExpression(node.parent.parent, /*excludeCompoundAssignment*/ true))) {
+ (node.parent.parent.kind === 238 /* VariableDeclaration */ || ts.isAssignmentExpression(node.parent.parent, /*excludeCompoundAssignment*/ true))) {
// var x = x || {};
// TODO: use getFalsyflagsOfType
addCandidateType(usageContext, checker.getTypeAtLocation(parent.right));
@@ -112763,7 +113985,7 @@
break;
case 54 /* AmpersandAmpersandToken */:
case 27 /* CommaToken */:
- case 94 /* InstanceOfKeyword */:
+ case 95 /* InstanceOfKeyword */:
// nothing to infer here
break;
}
@@ -112783,7 +114005,7 @@
}
}
inferTypeFromContext(parent, checker, callContext.returnType);
- if (parent.kind === 191 /* CallExpression */) {
+ if (parent.kind === 192 /* CallExpression */) {
(usageContext.callContexts || (usageContext.callContexts = [])).push(callContext);
}
else {
@@ -113023,12 +114245,12 @@
var precedingNode;
var newClassDeclaration;
switch (ctorDeclaration.kind) {
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
precedingNode = ctorDeclaration;
changes.delete(sourceFile, ctorDeclaration);
newClassDeclaration = createClassFromFunctionDeclaration(ctorDeclaration);
break;
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
precedingNode = ctorDeclaration.parent.parent;
newClassDeclaration = createClassFromVariableDeclaration(ctorDeclaration);
if (ctorDeclaration.parent.declarations.length === 1) {
@@ -113060,7 +114282,7 @@
// all static members are stored in the "exports" array of symbol
if (symbol.exports) {
symbol.exports.forEach(function (member) {
- var memberElement = createClassElement(member, [ts.createToken(116 /* StaticKeyword */)]);
+ var memberElement = createClassElement(member, [ts.createToken(117 /* StaticKeyword */)]);
if (memberElement) {
memberElements.push(memberElement);
}
@@ -113083,7 +114305,7 @@
return;
}
// delete the entire statement if this expression is the sole expression to take care of the semicolon at the end
- var nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 221 /* ExpressionStatement */
+ var nodeToDelete = assignmentBinaryExpression.parent && assignmentBinaryExpression.parent.kind === 222 /* ExpressionStatement */
? assignmentBinaryExpression.parent : assignmentBinaryExpression;
changes.delete(sourceFile, nodeToDelete);
if (!assignmentBinaryExpression.right) {
@@ -113091,27 +114313,27 @@
/*type*/ undefined, /*initializer*/ undefined);
}
switch (assignmentBinaryExpression.right.kind) {
- case 196 /* FunctionExpression */: {
+ case 197 /* FunctionExpression */: {
var functionExpression = assignmentBinaryExpression.right;
- var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(functionExpression, 121 /* AsyncKeyword */));
+ var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(functionExpression, 122 /* AsyncKeyword */));
var method = ts.createMethod(/*decorators*/ undefined, fullModifiers, /*asteriskToken*/ undefined, memberDeclaration.name, /*questionToken*/ undefined,
/*typeParameters*/ undefined, functionExpression.parameters, /*type*/ undefined, functionExpression.body);
ts.copyLeadingComments(assignmentBinaryExpression, method, sourceFile);
return method;
}
- case 197 /* ArrowFunction */: {
+ case 198 /* ArrowFunction */: {
var arrowFunction = assignmentBinaryExpression.right;
var arrowFunctionBody = arrowFunction.body;
var bodyBlock = void 0;
// case 1: () => { return [1,2,3] }
- if (arrowFunctionBody.kind === 218 /* Block */) {
+ if (arrowFunctionBody.kind === 219 /* Block */) {
bodyBlock = arrowFunctionBody;
}
// case 2: () => [1,2,3]
else {
bodyBlock = ts.createBlock([ts.createReturn(arrowFunctionBody)]);
}
- var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(arrowFunction, 121 /* AsyncKeyword */));
+ var fullModifiers = ts.concatenate(modifiers, getModifierKindFromSource(arrowFunction, 122 /* AsyncKeyword */));
var method = ts.createMethod(/*decorators*/ undefined, fullModifiers, /*asteriskToken*/ undefined, memberDeclaration.name, /*questionToken*/ undefined,
/*typeParameters*/ undefined, arrowFunction.parameters, /*type*/ undefined, bodyBlock);
ts.copyLeadingComments(assignmentBinaryExpression, method, sourceFile);
@@ -113132,17 +114354,17 @@
}
function createClassFromVariableDeclaration(node) {
var initializer = node.initializer;
- if (!initializer || initializer.kind !== 196 /* FunctionExpression */) {
+ if (!initializer || initializer.kind !== 197 /* FunctionExpression */) {
return undefined;
}
- if (node.name.kind !== 72 /* Identifier */) {
+ if (node.name.kind !== 73 /* Identifier */) {
return undefined;
}
var memberElements = createClassElementsFromSymbol(node.symbol);
if (initializer.body) {
memberElements.unshift(ts.createConstructor(/*decorators*/ undefined, /*modifiers*/ undefined, initializer.parameters, initializer.body));
}
- var modifiers = getModifierKindFromSource(precedingNode, 85 /* ExportKeyword */);
+ var modifiers = getModifierKindFromSource(precedingNode, 86 /* ExportKeyword */);
var cls = ts.createClassDeclaration(/*decorators*/ undefined, modifiers, node.name,
/*typeParameters*/ undefined, /*heritageClauses*/ undefined, memberElements);
// Don't call copyComments here because we'll already leave them in place
@@ -113153,7 +114375,7 @@
if (node.body) {
memberElements.unshift(ts.createConstructor(/*decorators*/ undefined, /*modifiers*/ undefined, node.parameters, node.body));
}
- var modifiers = getModifierKindFromSource(node, 85 /* ExportKeyword */);
+ var modifiers = getModifierKindFromSource(node, 86 /* ExportKeyword */);
var cls = ts.createClassDeclaration(/*decorators*/ undefined, modifiers, node.name,
/*typeParameters*/ undefined, /*heritageClauses*/ undefined, memberElements);
// Don't call copyComments here because we'll already leave them in place
@@ -113183,6 +114405,11 @@
fixIds: [fixId],
getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes, err) { return convertToAsyncFunction(changes, err.file, err.start, context.program.getTypeChecker(), context); }); },
});
+ var SynthBindingNameKind;
+ (function (SynthBindingNameKind) {
+ SynthBindingNameKind[SynthBindingNameKind["Identifier"] = 0] = "Identifier";
+ SynthBindingNameKind[SynthBindingNameKind["BindingPattern"] = 1] = "BindingPattern";
+ })(SynthBindingNameKind || (SynthBindingNameKind = {}));
function convertToAsyncFunction(changes, sourceFile, position, checker, context) {
// get the function declaration - returns a promise
var tokenAtPosition = ts.getTokenAtPosition(sourceFile, position);
@@ -113211,7 +114438,7 @@
return;
}
// add the async keyword
- changes.insertLastModifierBefore(sourceFile, 121 /* AsyncKeyword */, functionToConvert);
+ changes.insertLastModifierBefore(sourceFile, 122 /* AsyncKeyword */, functionToConvert);
function startTransformation(node, nodeToReplace) {
var newNodes = transformExpression(node, transformer, node);
changes.replaceNodeWithNodes(sourceFile, nodeToReplace, newNodes);
@@ -113319,8 +114546,8 @@
allVarNames.push({ identifier: synthName.identifier, symbol: symbol });
addNameToFrequencyMap(collidingSymbolMap, ident.text, symbol);
}
- // we only care about identifiers that are parameters and declarations (don't care about other uses)
- else if (node.parent && (ts.isParameter(node.parent) || ts.isVariableDeclaration(node.parent))) {
+ // we only care about identifiers that are parameters, declarations, or binding elements (don't care about other uses)
+ else if (node.parent && (ts.isParameter(node.parent) || ts.isVariableDeclaration(node.parent) || ts.isBindingElement(node.parent))) {
var originalName = node.text;
var collidingSymbols = collidingSymbolMap.get(originalName);
// if the identifier name conflicts with a different identifier that we've already seen
@@ -113334,7 +114561,7 @@
else {
var identifier = ts.getSynthesizedDeepClone(node);
identsToRenameMap.set(symbolIdString, identifier);
- synthNamesMap.set(symbolIdString, { identifier: identifier, types: [], numberOfAssignmentsOriginal: allVarNames.filter(function (elem) { return elem.identifier.text === node.text; }).length /*, numberOfAssignmentsSynthesized: 0*/ });
+ synthNamesMap.set(symbolIdString, createSynthIdentifier(identifier, [], allVarNames.filter(function (elem) { return elem.identifier.text === node.text; }).length /*, numberOfAssignmentsSynthesized: 0*/));
if ((ts.isParameter(node.parent) && isExpressionOrCallOnTypePromise(node.parent.parent)) || ts.isVariableDeclaration(node.parent)) {
allVarNames.push({ identifier: identifier, symbol: symbol });
addNameToFrequencyMap(collidingSymbolMap, originalName, symbol);
@@ -113382,7 +114609,7 @@
var numVarsSameName = (originalNames.get(name.text) || ts.emptyArray).length;
var numberOfAssignmentsOriginal = 0;
var identifier = numVarsSameName === 0 ? name : ts.createIdentifier(name.text + "_" + numVarsSameName);
- return { identifier: identifier, types: [], numberOfAssignmentsOriginal: numberOfAssignmentsOriginal };
+ return createSynthIdentifier(identifier, [], numberOfAssignmentsOriginal);
}
// dispatch function to recursively build the refactoring
// should be kept up to date with isFixablePromiseHandler in suggestionDiagnostics.ts
@@ -113409,68 +114636,90 @@
}
function transformCatch(node, transformer, prevArgName) {
var func = node.arguments[0];
- var argName = getArgName(func, transformer);
+ var argName = getArgBindingName(func, transformer);
var shouldReturn = transformer.setOfExpressionsToReturn.get(ts.getNodeId(node).toString());
+ var possibleNameForVarDecl;
/*
If there is another call in the chain after the .catch() we are transforming, we will need to save the result of both paths (try block and catch block)
To do this, we will need to synthesize a variable that we were not aware of while we were adding identifiers to the synthNamesMap
We will use the prevArgName and then update the synthNamesMap with a new variable name for the next transformation step
*/
if (prevArgName && !shouldReturn) {
- prevArgName.numberOfAssignmentsOriginal = 2; // Try block and catch block
+ if (isSynthIdentifier(prevArgName)) {
+ possibleNameForVarDecl = prevArgName;
transformer.synthNamesMap.forEach(function (val, key) {
if (val.identifier.text === prevArgName.identifier.text) {
var newSynthName = createUniqueSynthName(prevArgName);
transformer.synthNamesMap.set(key, newSynthName);
}
});
+ }
+ else {
+ possibleNameForVarDecl = createSynthIdentifier(ts.createOptimisticUniqueName("result"), prevArgName.types);
+ }
+ possibleNameForVarDecl.numberOfAssignmentsOriginal = 2; // Try block and catch block
// update the constIdentifiers list
- if (transformer.constIdentifiers.some(function (elem) { return elem.text === prevArgName.identifier.text; })) {
- transformer.constIdentifiers.push(createUniqueSynthName(prevArgName).identifier);
+ if (transformer.constIdentifiers.some(function (elem) { return elem.text === possibleNameForVarDecl.identifier.text; })) {
+ transformer.constIdentifiers.push(createUniqueSynthName(possibleNameForVarDecl).identifier);
}
}
- var tryBlock = ts.createBlock(transformExpression(node.expression, transformer, node, prevArgName));
- var transformationBody = getTransformationBody(func, prevArgName, argName, node, transformer);
- var catchArg = argName ? argName.identifier.text : "e";
- var catchClause = ts.createCatchClause(catchArg, ts.createBlock(transformationBody));
+ var tryBlock = ts.createBlock(transformExpression(node.expression, transformer, node, possibleNameForVarDecl));
+ var transformationBody = getTransformationBody(func, possibleNameForVarDecl, argName, node, transformer);
+ var catchArg = argName ? isSynthIdentifier(argName) ? argName.identifier.text : argName.bindingPattern : "e";
+ var catchVariableDeclaration = ts.createVariableDeclaration(catchArg);
+ var catchClause = ts.createCatchClause(catchVariableDeclaration, ts.createBlock(transformationBody));
/*
In order to avoid an implicit any, we will synthesize a type for the declaration using the unions of the types of both paths (try block and catch block)
*/
var varDeclList;
- if (prevArgName && !shouldReturn) {
- var typeArray = prevArgName.types;
+ var varDeclIdentifier;
+ if (possibleNameForVarDecl && !shouldReturn) {
+ varDeclIdentifier = ts.getSynthesizedDeepClone(possibleNameForVarDecl.identifier);
+ var typeArray = possibleNameForVarDecl.types;
var unionType = transformer.checker.getUnionType(typeArray, 2 /* Subtype */);
var unionTypeNode = transformer.isInJSFile ? undefined : transformer.checker.typeToTypeNode(unionType);
- var varDecl = [ts.createVariableDeclaration(ts.getSynthesizedDeepClone(prevArgName.identifier), unionTypeNode)];
+ var varDecl = [ts.createVariableDeclaration(varDeclIdentifier, unionTypeNode)];
varDeclList = ts.createVariableStatement(/*modifiers*/ undefined, ts.createVariableDeclarationList(varDecl, 1 /* Let */));
}
var tryStatement = ts.createTry(tryBlock, catchClause, /*finallyBlock*/ undefined);
- return varDeclList ? [varDeclList, tryStatement] : [tryStatement];
+ var destructuredResult = prevArgName && varDeclIdentifier && isSynthBindingPattern(prevArgName)
+ && ts.createVariableStatement(/* modifiers */ undefined, ts.createVariableDeclarationList([ts.createVariableDeclaration(ts.getSynthesizedDeepCloneWithRenames(prevArgName.bindingPattern), /* type */ undefined, varDeclIdentifier)], 2 /* Const */));
+ return ts.compact([varDeclList, tryStatement, destructuredResult]);
+ }
+ function getIdentifierTextsFromBindingName(bindingName) {
+ if (ts.isIdentifier(bindingName))
+ return [bindingName.text];
+ return ts.flatMap(bindingName.elements, function (element) {
+ if (ts.isOmittedExpression(element))
+ return [];
+ return getIdentifierTextsFromBindingName(element.name);
+ });
}
function createUniqueSynthName(prevArgName) {
var renamedPrevArg = ts.createOptimisticUniqueName(prevArgName.identifier.text);
- var newSynthName = { identifier: renamedPrevArg, types: [], numberOfAssignmentsOriginal: 0 };
- return newSynthName;
+ return createSynthIdentifier(renamedPrevArg);
}
function transformThen(node, transformer, outermostParent, prevArgName) {
var _a = node.arguments, res = _a[0], rej = _a[1];
if (!res) {
return transformExpression(node.expression, transformer, outermostParent);
}
- var argNameRes = getArgName(res, transformer);
+ var argNameRes = getArgBindingName(res, transformer);
var transformationBody = getTransformationBody(res, prevArgName, argNameRes, node, transformer);
if (rej) {
- var argNameRej = getArgName(rej, transformer);
+ var argNameRej = getArgBindingName(rej, transformer);
var tryBlock = ts.createBlock(transformExpression(node.expression, transformer, node, argNameRes).concat(transformationBody));
var transformationBody2 = getTransformationBody(rej, prevArgName, argNameRej, node, transformer);
- var catchArg = argNameRej ? argNameRej.identifier.text : "e";
- var catchClause = ts.createCatchClause(catchArg, ts.createBlock(transformationBody2));
+ var catchArg = argNameRej ? isSynthIdentifier(argNameRej) ? argNameRej.identifier.text : argNameRej.bindingPattern : "e";
+ var catchVariableDeclaration = ts.createVariableDeclaration(catchArg);
+ var catchClause = ts.createCatchClause(catchVariableDeclaration, ts.createBlock(transformationBody2));
return [ts.createTry(tryBlock, catchClause, /* finallyBlock */ undefined)];
}
return transformExpression(node.expression, transformer, node, argNameRes).concat(transformationBody);
}
- function getFlagOfIdentifier(node, constIdentifiers) {
- var inArr = constIdentifiers.some(function (elem) { return elem.text === node.text; });
+ function getFlagOfBindingName(bindingName, constIdentifiers) {
+ var identifiers = getIdentifierTextsFromBindingName(getNode(bindingName));
+ var inArr = constIdentifiers.some(function (elem) { return ts.contains(identifiers, elem.text); });
return inArr ? 2 /* Const */ : 1 /* Let */;
}
function transformPromiseCall(node, transformer, prevArgName) {
@@ -113486,29 +114735,29 @@
return [ts.createReturn(ts.getSynthesizedDeepClone(node))];
}
function createTransformedStatement(prevArgName, rightHandSide, transformer) {
- if (!prevArgName || prevArgName.identifier.text.length === 0) {
+ if (!prevArgName || isEmpty(prevArgName)) {
// if there's no argName to assign to, there still might be side effects
return [ts.createStatement(rightHandSide)];
}
- if (prevArgName.types.length < prevArgName.numberOfAssignmentsOriginal) {
+ if (isSynthIdentifier(prevArgName) && prevArgName.types.length < prevArgName.numberOfAssignmentsOriginal) {
// if the variable has already been declared, we don't need "let" or "const"
return [ts.createStatement(ts.createAssignment(ts.getSynthesizedDeepClone(prevArgName.identifier), rightHandSide))];
}
- return [ts.createVariableStatement(/*modifiers*/ undefined, (ts.createVariableDeclarationList([ts.createVariableDeclaration(ts.getSynthesizedDeepClone(prevArgName.identifier), /*type*/ undefined, rightHandSide)], getFlagOfIdentifier(prevArgName.identifier, transformer.constIdentifiers))))];
+ return [ts.createVariableStatement(/*modifiers*/ undefined, (ts.createVariableDeclarationList([ts.createVariableDeclaration(ts.getSynthesizedDeepClone(getNode(prevArgName)), /*type*/ undefined, rightHandSide)], getFlagOfBindingName(prevArgName, transformer.constIdentifiers))))];
}
// should be kept up to date with isFixablePromiseArgument in suggestionDiagnostics.ts
function getTransformationBody(func, prevArgName, argName, parent, transformer) {
var shouldReturn = transformer.setOfExpressionsToReturn.get(ts.getNodeId(parent).toString());
switch (func.kind) {
- case 96 /* NullKeyword */:
+ case 97 /* NullKeyword */:
// do not produce a transformed statement for a null argument
break;
- case 72 /* Identifier */: // identifier includes undefined
+ case 73 /* Identifier */: // identifier includes undefined
if (!argName) {
// undefined was argument passed to promise handler
break;
}
- var synthCall = ts.createCall(ts.getSynthesizedDeepClone(func), /*typeArguments*/ undefined, [argName.identifier]);
+ var synthCall = ts.createCall(ts.getSynthesizedDeepClone(func), /*typeArguments*/ undefined, isSynthIdentifier(argName) ? [argName.identifier] : []);
if (shouldReturn) {
return [ts.createReturn(synthCall)];
}
@@ -113525,8 +114774,8 @@
prevArgName.types.push(returnType);
}
return varDeclOrAssignment;
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */: {
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */: {
var funcBody = func.body;
// Arrow functions with block bodies { } will enter this control flow
if (ts.isBlock(funcBody)) {
@@ -113545,7 +114794,7 @@
}
}
return shouldReturn ? refactoredStmts.map(function (s) { return ts.getSynthesizedDeepClone(s); }) :
- removeReturns(refactoredStmts, prevArgName === undefined ? undefined : prevArgName.identifier, transformer, seenReturnStatement);
+ removeReturns(refactoredStmts, prevArgName, transformer, seenReturnStatement);
}
else {
var innerRetStmts = ts.isFixablePromiseHandler(funcBody) ? [ts.createReturn(funcBody)] : ts.emptyArray;
@@ -113591,7 +114840,7 @@
ret.push(ts.createExpressionStatement(possiblyAwaitedExpression));
}
else {
- ret.push(ts.createVariableStatement(/*modifiers*/ undefined, (ts.createVariableDeclarationList([ts.createVariableDeclaration(prevArgName, /*type*/ undefined, possiblyAwaitedExpression)], getFlagOfIdentifier(prevArgName, transformer.constIdentifiers)))));
+ ret.push(ts.createVariableStatement(/*modifiers*/ undefined, (ts.createVariableDeclarationList([ts.createVariableDeclaration(getNode(prevArgName), /*type*/ undefined, possiblyAwaitedExpression)], getFlagOfBindingName(prevArgName, transformer.constIdentifiers)))));
}
}
}
@@ -113601,7 +114850,7 @@
}
// if block has no return statement, need to define prevArgName as undefined to prevent undeclared variables
if (!seenReturnStatement && prevArgName !== undefined) {
- ret.push(ts.createVariableStatement(/*modifiers*/ undefined, (ts.createVariableDeclarationList([ts.createVariableDeclaration(prevArgName, /*type*/ undefined, ts.createIdentifier("undefined"))], getFlagOfIdentifier(prevArgName, transformer.constIdentifiers)))));
+ ret.push(ts.createVariableStatement(/*modifiers*/ undefined, (ts.createVariableDeclarationList([ts.createVariableDeclaration(getNode(prevArgName), /*type*/ undefined, ts.createIdentifier("undefined"))], getFlagOfBindingName(prevArgName, transformer.constIdentifiers)))));
}
return ret;
}
@@ -113624,32 +114873,42 @@
}
return innerCbBody;
}
- function getArgName(funcNode, transformer) {
+ function getArgBindingName(funcNode, transformer) {
var numberOfAssignmentsOriginal = 0;
var types = [];
var name;
if (ts.isFunctionLikeDeclaration(funcNode)) {
if (funcNode.parameters.length > 0) {
var param = funcNode.parameters[0].name;
- name = getMapEntryOrDefault(param);
+ name = getMappedBindingNameOrDefault(param);
}
}
else if (ts.isIdentifier(funcNode)) {
name = getMapEntryOrDefault(funcNode);
}
// return undefined argName when arg is null or undefined
- if (!name || name.identifier.text === "undefined") {
+ if (!name || "identifier" in name && name.identifier.text === "undefined") {
return undefined;
}
return name;
+ function getMappedBindingNameOrDefault(bindingName) {
+ if (ts.isIdentifier(bindingName))
+ return getMapEntryOrDefault(bindingName);
+ var elements = ts.flatMap(bindingName.elements, function (element) {
+ if (ts.isOmittedExpression(element))
+ return [];
+ return [getMappedBindingNameOrDefault(element.name)];
+ });
+ return createSynthBindingPattern(bindingName, elements);
+ }
function getMapEntryOrDefault(identifier) {
var originalNode = getOriginalNode(identifier);
var symbol = getSymbol(originalNode);
if (!symbol) {
- return { identifier: identifier, types: types, numberOfAssignmentsOriginal: numberOfAssignmentsOriginal };
+ return createSynthIdentifier(identifier, types, numberOfAssignmentsOriginal);
}
var mapEntry = transformer.synthNamesMap.get(ts.getSymbolId(symbol).toString());
- return mapEntry || { identifier: identifier, types: types, numberOfAssignmentsOriginal: numberOfAssignmentsOriginal };
+ return mapEntry || createSynthIdentifier(identifier, types, numberOfAssignmentsOriginal);
}
function getSymbol(node) {
return node.symbol ? node.symbol : transformer.checker.getSymbolAtLocation(node);
@@ -113658,6 +114917,34 @@
return node.original ? node.original : node;
}
}
+ function isEmpty(bindingName) {
+ if (!bindingName) {
+ return true;
+ }
+ if (isSynthIdentifier(bindingName)) {
+ return !bindingName.identifier.text;
+ }
+ return ts.every(bindingName.elements, isEmpty);
+ }
+ function getNode(bindingName) {
+ return isSynthIdentifier(bindingName) ? bindingName.identifier : bindingName.bindingPattern;
+ }
+ function createSynthIdentifier(identifier, types, numberOfAssignmentsOriginal) {
+ if (types === void 0) { types = []; }
+ if (numberOfAssignmentsOriginal === void 0) { numberOfAssignmentsOriginal = 0; }
+ return { kind: 0 /* Identifier */, identifier: identifier, types: types, numberOfAssignmentsOriginal: numberOfAssignmentsOriginal };
+ }
+ function createSynthBindingPattern(bindingPattern, elements, types) {
+ if (elements === void 0) { elements = ts.emptyArray; }
+ if (types === void 0) { types = []; }
+ return { kind: 1 /* BindingPattern */, bindingPattern: bindingPattern, elements: elements, types: types };
+ }
+ function isSynthIdentifier(bindingName) {
+ return bindingName.kind === 0 /* Identifier */;
+ }
+ function isSynthBindingPattern(bindingName) {
+ return bindingName.kind === 1 /* BindingPattern */;
+ }
})(codefix = ts.codefix || (ts.codefix = {}));
})(ts || (ts = {}));
/* @internal */
@@ -113691,10 +114978,10 @@
}
var importNode = ts.importFromModuleSpecifier(moduleSpecifier);
switch (importNode.kind) {
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
changes.replaceNode(importingFile, importNode, ts.makeImport(importNode.name, /*namedImports*/ undefined, moduleSpecifier, quotePreference));
break;
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
if (ts.isRequireCall(importNode, /*checkArgumentIsStringLiteralLike*/ false)) {
changes.replaceNode(importingFile, importNode, ts.createPropertyAccess(ts.getSynthesizedDeepClone(importNode), "default"));
}
@@ -113740,29 +115027,29 @@
sourceFile.forEachChild(function recur(node) {
if (ts.isPropertyAccessExpression(node) && ts.isExportsOrModuleExportsOrAlias(sourceFile, node.expression)) {
var parent = node.parent;
- cb(node, ts.isBinaryExpression(parent) && parent.left === node && parent.operatorToken.kind === 59 /* EqualsToken */);
+ cb(node, ts.isBinaryExpression(parent) && parent.left === node && parent.operatorToken.kind === 60 /* EqualsToken */);
}
node.forEachChild(recur);
});
}
function convertStatement(sourceFile, statement, checker, changes, identifiers, target, exports, quotePreference) {
switch (statement.kind) {
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
convertVariableStatement(sourceFile, statement, changes, checker, identifiers, target, quotePreference);
return false;
- case 221 /* ExpressionStatement */: {
+ case 222 /* ExpressionStatement */: {
var expression = statement.expression;
switch (expression.kind) {
- case 191 /* CallExpression */: {
+ case 192 /* CallExpression */: {
if (ts.isRequireCall(expression, /*checkArgumentIsStringLiteralLike*/ true)) {
// For side-effecting require() call, just make a side-effecting import.
changes.replaceNode(sourceFile, statement, ts.makeImport(/*name*/ undefined, /*namedImports*/ undefined, expression.arguments[0], quotePreference));
}
return false;
}
- case 204 /* BinaryExpression */: {
+ case 205 /* BinaryExpression */: {
var operatorToken = expression.operatorToken;
- return operatorToken.kind === 59 /* EqualsToken */ && convertAssignment(sourceFile, checker, expression, changes, exports);
+ return operatorToken.kind === 60 /* EqualsToken */ && convertAssignment(sourceFile, checker, expression, changes, exports);
}
}
}
@@ -113802,8 +115089,8 @@
/** Converts `const name = require("moduleSpecifier").propertyName` */
function convertPropertyAccessImport(name, propertyName, moduleSpecifier, identifiers, quotePreference) {
switch (name.kind) {
- case 184 /* ObjectBindingPattern */:
- case 185 /* ArrayBindingPattern */: {
+ case 185 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */: {
// `const [a, b] = require("c").d` --> `import { d } from "c"; const [a, b] = d;`
var tmp = makeUniqueName(propertyName, identifiers);
return [
@@ -113811,7 +115098,7 @@
makeConst(/*modifiers*/ undefined, name, ts.createIdentifier(tmp)),
];
}
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
// `const a = require("b").c` --> `import { c as a } from "./b";
return [makeSingleImport(name.text, propertyName, moduleSpecifier, quotePreference)];
default:
@@ -113854,16 +115141,16 @@
function tryChangeModuleExportsObject(object) {
var statements = ts.mapAllOrFail(object.properties, function (prop) {
switch (prop.kind) {
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
// TODO: Maybe we should handle this? See fourslash test `refactorConvertToEs6Module_export_object_shorthand.ts`.
- case 276 /* ShorthandPropertyAssignment */:
- case 277 /* SpreadAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
+ case 278 /* SpreadAssignment */:
return undefined;
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return !ts.isIdentifier(prop.name) ? undefined : convertExportsDotXEquals_replaceNode(prop.name.text, prop.initializer);
- case 156 /* MethodDeclaration */:
- return !ts.isIdentifier(prop.name) ? undefined : functionExpressionToDeclaration(prop.name.text, [ts.createToken(85 /* ExportKeyword */)], prop);
+ case 157 /* MethodDeclaration */:
+ return !ts.isIdentifier(prop.name) ? undefined : functionExpressionToDeclaration(prop.name.text, [ts.createToken(86 /* ExportKeyword */)], prop);
default:
ts.Debug.assertNever(prop);
}
@@ -113912,7 +115199,7 @@
var name = left.name.text;
if ((ts.isFunctionExpression(right) || ts.isArrowFunction(right) || ts.isClassExpression(right)) && (!right.name || right.name.text === name)) {
// `exports.f = function() {}` -> `export function f() {}` -- Replace `exports.f = ` with `export `, and insert the name after `function`.
- changes.replaceRange(sourceFile, { pos: left.getStart(sourceFile), end: right.getStart(sourceFile) }, ts.createToken(85 /* ExportKeyword */), { suffix: " " });
+ changes.replaceRange(sourceFile, { pos: left.getStart(sourceFile), end: right.getStart(sourceFile) }, ts.createToken(86 /* ExportKeyword */), { suffix: " " });
if (!right.name)
changes.insertName(sourceFile, right, name);
var semi = ts.findChildOfKind(parent, 26 /* SemicolonToken */, sourceFile);
@@ -113921,14 +115208,14 @@
}
else {
// `exports.f = function g() {}` -> `export const f = function g() {}` -- just replace `exports.` with `export const `
- changes.replaceNodeRangeWithNodes(sourceFile, left.expression, ts.findChildOfKind(left, 24 /* DotToken */, sourceFile), [ts.createToken(85 /* ExportKeyword */), ts.createToken(77 /* ConstKeyword */)], { joiner: " ", suffix: " " });
+ changes.replaceNodeRangeWithNodes(sourceFile, left.expression, ts.findChildOfKind(left, 24 /* DotToken */, sourceFile), [ts.createToken(86 /* ExportKeyword */), ts.createToken(78 /* ConstKeyword */)], { joiner: " ", suffix: " " });
}
}
// TODO: GH#22492 this will cause an error if a change has been made inside the body of the node.
function convertExportsDotXEquals_replaceNode(name, exported) {
- var modifiers = [ts.createToken(85 /* ExportKeyword */)];
+ var modifiers = [ts.createToken(86 /* ExportKeyword */)];
switch (exported.kind) {
- case 196 /* FunctionExpression */: {
+ case 197 /* FunctionExpression */: {
var expressionName = exported.name;
if (expressionName && expressionName.text !== name) {
// `exports.f = function g() {}` -> `export const f = function g() {}`
@@ -113936,10 +115223,10 @@
}
}
// falls through
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
// `exports.f = function() {}` --> `export function f() {}`
return functionExpressionToDeclaration(name, modifiers, exported);
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
// `exports.C = class {}` --> `export class C {}`
return classExpressionToDeclaration(name, modifiers, exported);
default:
@@ -113957,7 +115244,7 @@
*/
function convertSingleImport(file, name, moduleSpecifier, changes, checker, identifiers, target, quotePreference) {
switch (name.kind) {
- case 184 /* ObjectBindingPattern */: {
+ case 185 /* ObjectBindingPattern */: {
var importSpecifiers = ts.mapAllOrFail(name.elements, function (e) {
return e.dotDotDotToken || e.initializer || e.propertyName && !ts.isIdentifier(e.propertyName) || !ts.isIdentifier(e.name)
? undefined
@@ -113968,7 +115255,7 @@
}
}
// falls through -- object destructuring has an interesting pattern and must be a variable declaration
- case 185 /* ArrayBindingPattern */: {
+ case 186 /* ArrayBindingPattern */: {
/*
import x from "x";
const [a, b, c] = x;
@@ -113979,7 +115266,7 @@
makeConst(/*modifiers*/ undefined, ts.getSynthesizedDeepClone(name), ts.createIdentifier(tmp)),
];
}
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return convertSingleIdentifierImport(file, name, moduleSpecifier, changes, checker, identifiers, quotePreference);
default:
return ts.Debug.assertNever(name);
@@ -114051,11 +115338,11 @@
function isFreeIdentifier(node) {
var parent = node.parent;
switch (parent.kind) {
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return parent.name !== node;
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return parent.propertyName !== node;
- case 253 /* ImportSpecifier */:
+ case 254 /* ImportSpecifier */:
return parent.propertyName !== node;
default:
return true;
@@ -114394,21 +115681,21 @@
function tryAddToExistingImport(existingImports) {
return ts.firstDefined(existingImports, function (_a) {
var declaration = _a.declaration, importKind = _a.importKind;
- if (declaration.kind !== 249 /* ImportDeclaration */)
+ if (declaration.kind !== 250 /* ImportDeclaration */)
return undefined;
var importClause = declaration.importClause;
if (!importClause)
return undefined;
var name = importClause.name, namedBindings = importClause.namedBindings;
- return importKind === 1 /* Default */ && !name || importKind === 0 /* Named */ && (!namedBindings || namedBindings.kind === 252 /* NamedImports */)
+ return importKind === 1 /* Default */ && !name || importKind === 0 /* Named */ && (!namedBindings || namedBindings.kind === 253 /* NamedImports */)
? { kind: 2 /* AddToExisting */, importClause: importClause, importKind: importKind }
: undefined;
});
}
function getNamespaceImportName(declaration) {
- if (declaration.kind === 249 /* ImportDeclaration */) {
+ if (declaration.kind === 250 /* ImportDeclaration */) {
var namedBindings = declaration.importClause && ts.isImportClause(declaration.importClause) && declaration.importClause.namedBindings;
- return namedBindings && namedBindings.kind === 251 /* NamespaceImport */ ? namedBindings.name : undefined;
+ return namedBindings && namedBindings.kind === 252 /* NamespaceImport */ ? namedBindings.name : undefined;
}
else {
return declaration.name;
@@ -114419,7 +115706,7 @@
// Can't use an es6 import for a type in JS.
return exportedSymbolIsTypeOnly && ts.isSourceFileJS(sourceFile) ? ts.emptyArray : ts.mapDefined(sourceFile.imports, function (moduleSpecifier) {
var i = ts.importFromModuleSpecifier(moduleSpecifier);
- return (i.kind === 249 /* ImportDeclaration */ || i.kind === 248 /* ImportEqualsDeclaration */)
+ return (i.kind === 250 /* ImportDeclaration */ || i.kind === 249 /* ImportEqualsDeclaration */)
&& checker.getSymbolAtLocation(moduleSpecifier) === moduleSymbol ? { declaration: i, importKind: importKind } : undefined;
});
}
@@ -114442,9 +115729,9 @@
}
function newImportInfoFromExistingSpecifier(_a) {
var declaration = _a.declaration, importKind = _a.importKind;
- var expression = declaration.kind === 249 /* ImportDeclaration */
+ var expression = declaration.kind === 250 /* ImportDeclaration */
? declaration.moduleSpecifier
- : declaration.moduleReference.kind === 259 /* ExternalModuleReference */
+ : declaration.moduleReference.kind === 260 /* ExternalModuleReference */
? declaration.moduleReference.expression
: undefined;
return expression && ts.isStringLiteral(expression) ? { kind: 3 /* AddNew */, moduleSpecifier: expression.text, importKind: importKind } : undefined;
@@ -114772,12 +116059,12 @@
var checker = context.program.getTypeChecker();
var suggestion;
if (ts.isPropertyAccessExpression(node.parent) && node.parent.name === node) {
- ts.Debug.assert(node.kind === 72 /* Identifier */);
+ ts.Debug.assert(node.kind === 73 /* Identifier */);
var containingType = checker.getTypeAtLocation(node.parent.expression);
suggestion = checker.getSuggestionForNonexistentProperty(node, containingType);
}
else if (ts.isImportSpecifier(node.parent) && node.parent.name === node) {
- ts.Debug.assert(node.kind === 72 /* Identifier */);
+ ts.Debug.assert(node.kind === 73 /* Identifier */);
var importDeclaration = ts.findAncestor(node, ts.isImportDeclaration);
var resolvedSourceFile = getResolvedSourceFileFromImportDeclaration(sourceFile, context, importDeclaration);
if (resolvedSourceFile && resolvedSourceFile.symbol) {
@@ -114840,7 +116127,7 @@
codefix.registerCodeFix({
errorCodes: errorCodes,
getCodeActions: function (context) {
- var info = getInfo(context.sourceFile, context.span.start, context.program.getTypeChecker());
+ var info = getInfo(context.sourceFile, context.span.start, context.program.getTypeChecker(), context.program);
if (!info)
return undefined;
if (info.kind === 0 /* Enum */) {
@@ -114863,7 +116150,7 @@
var typeDeclToMembers = new ts.NodeMap();
return codefix.createCombinedCodeActions(ts.textChanges.ChangeTracker.with(context, function (changes) {
codefix.eachDiagnostic(context, errorCodes, function (diag) {
- var info = getInfo(diag.file, diag.start, checker);
+ var info = getInfo(diag.file, diag.start, checker, context.program);
if (!info || !ts.addToSeen(seen, ts.getNodeId(info.parentDeclaration) + "#" + info.token.text)) {
return;
}
@@ -114931,7 +116218,7 @@
InfoKind[InfoKind["Enum"] = 0] = "Enum";
InfoKind[InfoKind["ClassOrInterface"] = 1] = "ClassOrInterface";
})(InfoKind || (InfoKind = {}));
- function getInfo(tokenSourceFile, tokenPos, checker) {
+ function getInfo(tokenSourceFile, tokenPos, checker, program) {
// The identifier of the missing property. eg:
// this.missing = 1;
// ^^^^^^^
@@ -114948,7 +116235,7 @@
return undefined;
// Prefer to change the class instead of the interface if they are merged
var classOrInterface = ts.find(symbol.declarations, ts.isClassLike) || ts.find(symbol.declarations, ts.isInterfaceDeclaration);
- if (classOrInterface) {
+ if (classOrInterface && !program.isSourceFileFromExternalLibrary(classOrInterface.getSourceFile())) {
var makeStatic = (leftExpressionType.target || leftExpressionType) !== checker.getDeclaredTypeOfSymbol(symbol);
var declSourceFile = classOrInterface.getSourceFile();
var inJs = ts.isSourceFileJS(declSourceFile);
@@ -114956,7 +116243,7 @@
return { kind: 1 /* ClassOrInterface */, token: token, parentDeclaration: classOrInterface, makeStatic: makeStatic, declSourceFile: declSourceFile, inJs: inJs, call: call };
}
var enumDeclaration = ts.find(symbol.declarations, ts.isEnumDeclaration);
- if (enumDeclaration) {
+ if (enumDeclaration && !program.isSourceFileFromExternalLibrary(enumDeclaration.getSourceFile())) {
return { kind: 0 /* Enum */, token: token, parentDeclaration: enumDeclaration };
}
return undefined;
@@ -114968,7 +116255,7 @@
}
function addMissingMemberInJs(changeTracker, declSourceFile, classDeclaration, tokenName, makeStatic) {
if (makeStatic) {
- if (classDeclaration.kind === 209 /* ClassExpression */) {
+ if (classDeclaration.kind === 210 /* ClassExpression */) {
return;
}
var className = classDeclaration.name.getText();
@@ -114994,7 +116281,7 @@
}
function getTypeNode(checker, classDeclaration, token) {
var typeNode;
- if (token.parent.parent.kind === 204 /* BinaryExpression */) {
+ if (token.parent.parent.kind === 205 /* BinaryExpression */) {
var binaryExpression = token.parent.parent;
var otherExpression = token.parent === binaryExpression.left ? binaryExpression.right : binaryExpression.left;
var widenedType = checker.getWidenedType(checker.getBaseTypeOfLiteralType(checker.getTypeAtLocation(otherExpression)));
@@ -115004,7 +116291,7 @@
var contextualType = checker.getContextualType(token.parent);
typeNode = contextualType ? checker.typeToTypeNode(contextualType) : undefined;
}
- return typeNode || ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ return typeNode || ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
function createAddPropertyDeclarationAction(context, declSourceFile, classDeclaration, makeStatic, tokenName, typeNode) {
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return addPropertyDeclaration(t, declSourceFile, classDeclaration, tokenName, typeNode, makeStatic); });
@@ -115013,7 +116300,7 @@
function addPropertyDeclaration(changeTracker, declSourceFile, classDeclaration, tokenName, typeNode, makeStatic) {
var property = ts.createProperty(
/*decorators*/ undefined,
- /*modifiers*/ makeStatic ? [ts.createToken(116 /* StaticKeyword */)] : undefined, tokenName,
+ /*modifiers*/ makeStatic ? [ts.createToken(117 /* StaticKeyword */)] : undefined, tokenName,
/*questionToken*/ undefined, typeNode,
/*initializer*/ undefined);
var lastProp = getNodeToInsertPropertyAfter(classDeclaration);
@@ -115037,7 +116324,7 @@
}
function createAddIndexSignatureAction(context, declSourceFile, classDeclaration, tokenName, typeNode) {
// Index signatures cannot have the static modifier.
- var stringTypeNode = ts.createKeywordTypeNode(138 /* StringKeyword */);
+ var stringTypeNode = ts.createKeywordTypeNode(139 /* StringKeyword */);
var indexingParameter = ts.createParameter(
/*decorators*/ undefined,
/*modifiers*/ undefined,
@@ -115057,7 +116344,7 @@
}
function addMethodDeclaration(context, changeTracker, declSourceFile, typeDecl, token, callExpression, makeStatic, inJs, preferences) {
var methodDeclaration = codefix.createMethodFromCallExpression(context, callExpression, token.text, inJs, makeStatic, preferences, typeDecl);
- var containingMethodDeclaration = ts.getAncestor(callExpression, 156 /* MethodDeclaration */);
+ var containingMethodDeclaration = ts.getAncestor(callExpression, 157 /* MethodDeclaration */);
if (containingMethodDeclaration && containingMethodDeclaration.parent === typeDecl) {
changeTracker.insertNodeAfter(declSourceFile, containingMethodDeclaration, methodDeclaration);
}
@@ -115121,7 +116408,6 @@
(function (codefix) {
var fixName = "fixCannotFindModule";
var fixIdInstallTypesPackage = "installTypesPackage";
- var fixIdGenerateTypes = "generateTypes";
var errorCodeCannotFindModule = ts.Diagnostics.Cannot_find_module_0.code;
var errorCodes = [
errorCodeCannotFindModule,
@@ -115136,13 +116422,12 @@
return undefined;
var typesPackageName = getTypesPackageNameToInstall(packageName, host, context.errorCode);
return typesPackageName === undefined
- ? ts.singleElementArray(tryGetGenerateTypesAction(context, packageName))
+ ? []
: [codefix.createCodeFixAction(fixName, /*changes*/ [], [ts.Diagnostics.Install_0, typesPackageName], fixIdInstallTypesPackage, ts.Diagnostics.Install_all_missing_types_packages, getInstallCommand(sourceFile.fileName, typesPackageName))];
},
- fixIds: [fixIdInstallTypesPackage, fixIdGenerateTypes],
+ fixIds: [fixIdInstallTypesPackage],
getAllCodeActions: function (context) {
- var savedTypesDir = null; // tslint:disable-line no-null-keyword
- return codefix.codeFixAll(context, errorCodes, function (changes, diag, commands) {
+ return codefix.codeFixAll(context, errorCodes, function (_changes, diag, commands) {
var packageName = tryGetImportedPackageName(diag.file, diag.start);
if (packageName === undefined)
return undefined;
@@ -115154,96 +116439,12 @@
}
break;
}
- case fixIdGenerateTypes: {
- var typesDir = savedTypesDir !== null ? savedTypesDir : savedTypesDir = getOrCreateTypesDirectory(changes, context);
- var command = typesDir === undefined ? undefined : tryGenerateTypes(typesDir, packageName, context);
- if (command)
- commands.push(command);
- break;
- }
default:
ts.Debug.fail("Bad fixId: " + context.fixId);
}
});
},
});
- function tryGetGenerateTypesAction(context, packageName) {
- var command;
- var changes = ts.textChanges.ChangeTracker.with(context, function (t) {
- var typesDir = getOrCreateTypesDirectory(t, context);
- command = typesDir === undefined ? undefined : tryGenerateTypes(typesDir, packageName, context);
- });
- return command && codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Generate_types_for_0, packageName], fixIdGenerateTypes, ts.Diagnostics.Generate_types_for_all_packages_without_types, command);
- }
- function tryGenerateTypes(typesDir, packageName, context) {
- var file = context.sourceFile.fileName;
- var fileToGenerateTypesFor = ts.tryResolveJSModule(packageName, ts.getDirectoryPath(file), context.host); // TODO: GH#18217
- if (fileToGenerateTypesFor === undefined)
- return undefined;
- var outputFileName = ts.resolvePath(ts.getDirectoryPath(context.program.getCompilerOptions().configFile.fileName), typesDir, packageName + ".d.ts");
- if (context.host.fileExists(outputFileName))
- return undefined;
- return { type: "generate types", file: file, fileToGenerateTypesFor: fileToGenerateTypesFor, outputFileName: outputFileName };
- }
- // If no types directory exists yet, adds it to tsconfig.json
- function getOrCreateTypesDirectory(changes, context) {
- var configFile = context.program.getCompilerOptions().configFile;
- if (!configFile)
- return undefined;
- var tsconfigObjectLiteral = ts.getTsConfigObjectLiteralExpression(configFile);
- if (!tsconfigObjectLiteral)
- return undefined;
- var compilerOptionsProperty = codefix.findJsonProperty(tsconfigObjectLiteral, "compilerOptions");
- if (!compilerOptionsProperty) {
- var newCompilerOptions = ts.createObjectLiteral([makeDefaultBaseUrl(), makeDefaultPaths()]);
- changes.insertNodeAtObjectStart(configFile, tsconfigObjectLiteral, codefix.createJsonPropertyAssignment("compilerOptions", newCompilerOptions));
- return defaultTypesDirectoryName;
- }
- var compilerOptions = compilerOptionsProperty.initializer;
- if (!ts.isObjectLiteralExpression(compilerOptions))
- return defaultTypesDirectoryName;
- var baseUrl = getOrAddBaseUrl(changes, configFile, compilerOptions);
- var typesDirectoryFromPathMapping = getOrAddPathMapping(changes, configFile, compilerOptions);
- return ts.combinePaths(baseUrl, typesDirectoryFromPathMapping);
- }
- var defaultBaseUrl = ".";
- function makeDefaultBaseUrl() {
- return codefix.createJsonPropertyAssignment("baseUrl", ts.createStringLiteral(defaultBaseUrl));
- }
- function getOrAddBaseUrl(changes, tsconfig, compilerOptions) {
- var baseUrlProp = codefix.findJsonProperty(compilerOptions, "baseUrl");
- if (baseUrlProp) {
- return ts.isStringLiteral(baseUrlProp.initializer) ? baseUrlProp.initializer.text : defaultBaseUrl;
- }
- else {
- changes.insertNodeAtObjectStart(tsconfig, compilerOptions, makeDefaultBaseUrl());
- return defaultBaseUrl;
- }
- }
- var defaultTypesDirectoryName = "types";
- function makeDefaultPathMapping() {
- return codefix.createJsonPropertyAssignment("*", ts.createArrayLiteral([ts.createStringLiteral(defaultTypesDirectoryName + "/*")]));
- }
- function makeDefaultPaths() {
- return codefix.createJsonPropertyAssignment("paths", ts.createObjectLiteral([makeDefaultPathMapping()]));
- }
- function getOrAddPathMapping(changes, tsconfig, compilerOptions) {
- var paths = codefix.findJsonProperty(compilerOptions, "paths");
- if (!paths || !ts.isObjectLiteralExpression(paths.initializer)) {
- changes.insertNodeAtObjectStart(tsconfig, compilerOptions, makeDefaultPaths());
- return defaultTypesDirectoryName;
- }
- // Look for an existing path mapping. Should look like `"*": "foo/*"`.
- var existing = ts.firstDefined(paths.initializer.properties, function (prop) {
- return ts.isPropertyAssignment(prop) && ts.isStringLiteral(prop.name) && prop.name.text === "*" && ts.isArrayLiteralExpression(prop.initializer)
- ? ts.firstDefined(prop.initializer.elements, function (value) { return ts.isStringLiteral(value) ? ts.tryRemoveSuffix(value.text, "/*") : undefined; })
- : undefined;
- });
- if (existing)
- return existing;
- changes.insertNodeAtObjectStart(tsconfig, paths.initializer, makeDefaultPathMapping());
- return defaultTypesDirectoryName;
- }
function getInstallCommand(fileName, packageName) {
return { type: "install package", file: fileName, packageName: packageName };
}
@@ -115351,7 +116552,7 @@
}
function getNodes(sourceFile, pos) {
var token = ts.getTokenAtPosition(sourceFile, pos);
- if (token.kind !== 100 /* ThisKeyword */)
+ if (token.kind !== 101 /* ThisKeyword */)
return undefined;
var constructor = ts.getContainingFunction(token);
var superCall = findSuperCall(constructor.body);
@@ -115390,7 +116591,7 @@
});
function getNode(sourceFile, pos) {
var token = ts.getTokenAtPosition(sourceFile, pos);
- ts.Debug.assert(token.kind === 124 /* ConstructorKeyword */);
+ ts.Debug.assert(token.kind === 125 /* ConstructorKeyword */);
return token.parent;
}
function doChange(changes, sourceFile, ctr) {
@@ -115406,7 +116607,7 @@
(function (codefix) {
var fixId = "enableExperimentalDecorators";
var errorCodes = [
- ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning.code
+ ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning.code
];
codefix.registerCodeFix({
errorCodes: errorCodes,
@@ -115415,12 +116616,19 @@
if (configFile === undefined) {
return undefined;
}
- var changes = ts.textChanges.ChangeTracker.with(context, function (changeTracker) { return makeChange(changeTracker, configFile); });
+ var changes = ts.textChanges.ChangeTracker.with(context, function (changeTracker) { return doChange(changeTracker, configFile); });
return [codefix.createCodeFixActionNoFixId(fixId, changes, ts.Diagnostics.Enable_the_experimentalDecorators_option_in_your_configuration_file)];
},
fixIds: [fixId],
+ getAllCodeActions: function (context) { return codefix.codeFixAll(context, errorCodes, function (changes) {
+ var configFile = context.program.getCompilerOptions().configFile;
+ if (configFile === undefined) {
+ return undefined;
+ }
+ doChange(changes, configFile);
+ }); },
});
- function makeChange(changeTracker, configFile) {
+ function doChange(changeTracker, configFile) {
codefix.setJsonCompilerOptionValue(changeTracker, configFile, "experimentalDecorators", ts.createTrue());
}
})(codefix = ts.codefix || (ts.codefix = {}));
@@ -115454,14 +116662,14 @@
var token = ts.getTokenAtPosition(sourceFile, pos);
var heritageClauses = ts.getContainingClass(token).heritageClauses;
var extendsToken = heritageClauses[0].getFirstToken();
- return extendsToken.kind === 86 /* ExtendsKeyword */ ? { extendsToken: extendsToken, heritageClauses: heritageClauses } : undefined;
+ return extendsToken.kind === 87 /* ExtendsKeyword */ ? { extendsToken: extendsToken, heritageClauses: heritageClauses } : undefined;
}
function doChanges(changes, sourceFile, extendsToken, heritageClauses) {
- changes.replaceNode(sourceFile, extendsToken, ts.createToken(109 /* ImplementsKeyword */));
+ changes.replaceNode(sourceFile, extendsToken, ts.createToken(110 /* ImplementsKeyword */));
// If there is already an implements clause, replace the implements keyword with a comma.
if (heritageClauses.length === 2 &&
- heritageClauses[0].token === 86 /* ExtendsKeyword */ &&
- heritageClauses[1].token === 109 /* ImplementsKeyword */) {
+ heritageClauses[0].token === 87 /* ExtendsKeyword */ &&
+ heritageClauses[1].token === 110 /* ImplementsKeyword */) {
var implementsToken = heritageClauses[1].getFirstToken();
var implementsFullStart = implementsToken.getFullStart();
changes.replaceRange(sourceFile, { pos: implementsFullStart, end: implementsFullStart }, ts.createToken(27 /* CommaToken */));
@@ -115568,7 +116776,7 @@
return [createDeleteFix(delVar, ts.Diagnostics.Remove_variable_statement)];
}
var result = [];
- if (token.kind === 127 /* InferKeyword */) {
+ if (token.kind === 128 /* InferKeyword */) {
var changes = ts.textChanges.ChangeTracker.with(context, function (t) { return changeInferToUnknown(t, sourceFile, token); });
var name = ts.cast(token.parent, ts.isInferTypeNode).typeParameter.name.text;
result.push(codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Replace_infer_0_with_unknown, name], fixIdInfer, ts.Diagnostics.Replace_all_unused_infer_with_unknown));
@@ -115600,7 +116808,7 @@
tryPrefixDeclaration(changes, diag.code, sourceFile, token);
break;
case fixIdDelete: {
- if (token.kind === 127 /* InferKeyword */)
+ if (token.kind === 128 /* InferKeyword */)
break; // Can't delete
var importDecl = tryGetFullImport(token);
if (importDecl) {
@@ -115619,7 +116827,7 @@
break;
}
case fixIdInfer:
- if (token.kind === 127 /* InferKeyword */) {
+ if (token.kind === 128 /* InferKeyword */) {
changeInferToUnknown(changes, sourceFile, token);
}
break;
@@ -115630,7 +116838,7 @@
},
});
function changeInferToUnknown(changes, sourceFile, token) {
- changes.replaceNode(sourceFile, token.parent, ts.createKeywordTypeNode(143 /* UnknownKeyword */));
+ changes.replaceNode(sourceFile, token.parent, ts.createKeywordTypeNode(144 /* UnknownKeyword */));
}
function createDeleteFix(changes, diag) {
return codefix.createCodeFixAction(fixName, changes, diag, fixIdDelete, ts.Diagnostics.Delete_all_unused_declarations);
@@ -115640,13 +116848,13 @@
}
// Sometimes the diagnostic span is an entire ImportDeclaration, so we should remove the whole thing.
function tryGetFullImport(token) {
- return token.kind === 92 /* ImportKeyword */ ? ts.tryCast(token.parent, ts.isImportDeclaration) : undefined;
+ return token.kind === 93 /* ImportKeyword */ ? ts.tryCast(token.parent, ts.isImportDeclaration) : undefined;
}
function tryDeleteFullDestructure(token, changes, sourceFile, checker, sourceFiles, isFixAll) {
if (token.kind !== 18 /* OpenBraceToken */ || !ts.isObjectBindingPattern(token.parent))
return false;
var decl = token.parent.parent;
- if (decl.kind === 151 /* Parameter */) {
+ if (decl.kind === 152 /* Parameter */) {
tryDeleteParameter(changes, sourceFile, decl, checker, sourceFiles, isFixAll);
}
else {
@@ -115657,7 +116865,7 @@
function tryDeleteFullVariableStatement(sourceFile, token, changes) {
var declarationList = ts.tryCast(token.parent, ts.isVariableDeclarationList);
if (declarationList && declarationList.getChildren(sourceFile)[0] === token) {
- changes.delete(sourceFile, declarationList.parent.kind === 219 /* VariableStatement */ ? declarationList.parent : declarationList);
+ changes.delete(sourceFile, declarationList.parent.kind === 220 /* VariableStatement */ ? declarationList.parent : declarationList);
return true;
}
return false;
@@ -115666,7 +116874,7 @@
// Don't offer to prefix a property.
if (errorCode === ts.Diagnostics.Property_0_is_declared_but_its_value_is_never_read.code)
return;
- if (token.kind === 127 /* InferKeyword */) {
+ if (token.kind === 128 /* InferKeyword */) {
token = ts.cast(token.parent, ts.isInferTypeNode).typeParameter.name;
}
if (ts.isIdentifier(token) && canPrefix(token)) {
@@ -115675,14 +116883,14 @@
}
function canPrefix(token) {
switch (token.parent.kind) {
- case 151 /* Parameter */:
- case 150 /* TypeParameter */:
+ case 152 /* Parameter */:
+ case 151 /* TypeParameter */:
return true;
- case 237 /* VariableDeclaration */: {
+ case 238 /* VariableDeclaration */: {
var varDecl = token.parent;
switch (varDecl.parent.parent.kind) {
- case 227 /* ForOfStatement */:
- case 226 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 227 /* ForInStatement */:
return true;
}
}
@@ -115729,26 +116937,26 @@
function mayDeleteParameter(p, checker, isFixAll) {
var parent = p.parent;
switch (parent.kind) {
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
// Don't remove a parameter if this overrides something.
var symbol = checker.getSymbolAtLocation(parent.name);
if (ts.isMemberSymbolInBaseType(symbol, checker))
return false;
// falls through
- case 157 /* Constructor */:
- case 239 /* FunctionDeclaration */:
+ case 158 /* Constructor */:
+ case 240 /* FunctionDeclaration */:
return true;
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */: {
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */: {
// Can't remove a non-last parameter in a callback. Can remove a parameter in code-fix-all if future parameters are also unused.
var parameters = parent.parameters;
var index = parameters.indexOf(p);
ts.Debug.assert(index !== -1);
return isFixAll
- ? parameters.slice(index + 1).every(function (p) { return p.name.kind === 72 /* Identifier */ && !p.symbol.isReferenced; })
+ ? parameters.slice(index + 1).every(function (p) { return p.name.kind === 73 /* Identifier */ && !p.symbol.isReferenced; })
: index === parameters.length - 1;
}
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
// Setter must have a parameter
return false;
default:
@@ -115788,7 +116996,7 @@
var container = (ts.isBlock(statement.parent) ? statement.parent : statement).parent;
if (!ts.isBlock(statement.parent) || statement === ts.first(statement.parent.statements)) {
switch (container.kind) {
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
if (container.elseStatement) {
if (ts.isBlock(statement.parent)) {
break;
@@ -115799,15 +117007,15 @@
return;
}
// falls through
- case 224 /* WhileStatement */:
- case 225 /* ForStatement */:
+ case 225 /* WhileStatement */:
+ case 226 /* ForStatement */:
changes.delete(sourceFile, container);
return;
}
}
if (ts.isBlock(statement.parent)) {
- var end_2 = start + length;
- var lastStatement = ts.Debug.assertDefined(lastWhere(ts.sliceAfter(statement.parent.statements, statement), function (s) { return s.pos < end_2; }));
+ var end_3 = start + length;
+ var lastStatement = ts.Debug.assertDefined(lastWhere(ts.sliceAfter(statement.parent.statements, statement), function (s) { return s.pos < end_3; }));
changes.deleteNodeRange(sourceFile, statement, lastStatement);
}
else {
@@ -115873,7 +117081,7 @@
var typeNode = info.typeNode, type = info.type;
var original = typeNode.getText(sourceFile);
var actions = [fix(type, fixIdPlain, ts.Diagnostics.Change_all_jsdoc_style_types_to_TypeScript)];
- if (typeNode.kind === 291 /* JSDocNullableType */) {
+ if (typeNode.kind === 292 /* JSDocNullableType */) {
// for nullable types, suggest the flow-compatible `T | null | undefined`
// in addition to the jsdoc/closure-compatible `T | null`
actions.push(fix(checker.getNullableType(type, 32768 /* Undefined */), fixIdNullable, ts.Diagnostics.Change_all_jsdoc_style_types_to_TypeScript_and_add_undefined_to_nullable_types));
@@ -115893,7 +117101,7 @@
if (!info)
return;
var typeNode = info.typeNode, type = info.type;
- var fixedType = typeNode.kind === 291 /* JSDocNullableType */ && fixId === fixIdNullable ? checker.getNullableType(type, 32768 /* Undefined */) : type;
+ var fixedType = typeNode.kind === 292 /* JSDocNullableType */ && fixId === fixIdNullable ? checker.getNullableType(type, 32768 /* Undefined */) : type;
doChange(changes, sourceFile, typeNode, fixedType, checker);
});
}
@@ -115910,22 +117118,22 @@
// NOTE: Some locations are not handled yet:
// MappedTypeNode.typeParameters and SignatureDeclaration.typeParameters, as well as CallExpression.typeArguments
switch (node.kind) {
- case 212 /* AsExpression */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 239 /* FunctionDeclaration */:
- case 158 /* GetAccessor */:
- case 162 /* IndexSignature */:
- case 181 /* MappedType */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 151 /* Parameter */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 159 /* SetAccessor */:
- case 242 /* TypeAliasDeclaration */:
- case 194 /* TypeAssertionExpression */:
- case 237 /* VariableDeclaration */:
+ case 213 /* AsExpression */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 240 /* FunctionDeclaration */:
+ case 159 /* GetAccessor */:
+ case 163 /* IndexSignature */:
+ case 182 /* MappedType */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 152 /* Parameter */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 160 /* SetAccessor */:
+ case 243 /* TypeAliasDeclaration */:
+ case 195 /* TypeAssertionExpression */:
+ case 238 /* VariableDeclaration */:
return true;
default:
return false;
@@ -115979,14 +117187,14 @@
}
var insertBefore;
switch (containingFunction.kind) {
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
insertBefore = containingFunction.name;
break;
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- insertBefore = ts.findChildOfKind(containingFunction, 90 /* FunctionKeyword */, sourceFile);
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ insertBefore = ts.findChildOfKind(containingFunction, 91 /* FunctionKeyword */, sourceFile);
break;
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
insertBefore = ts.findChildOfKind(containingFunction, 20 /* OpenParenToken */, sourceFile) || ts.first(containingFunction.parameters);
break;
default:
@@ -116001,11 +117209,11 @@
var insertBefore = _a.insertBefore, returnType = _a.returnType;
if (returnType) {
var entityName = ts.getEntityNameFromTypeNode(returnType);
- if (!entityName || entityName.kind !== 72 /* Identifier */ || entityName.text !== "Promise") {
+ if (!entityName || entityName.kind !== 73 /* Identifier */ || entityName.text !== "Promise") {
changes.replaceNode(sourceFile, returnType, ts.createTypeReferenceNode("Promise", ts.createNodeArray([returnType])));
}
}
- changes.insertModifierBefore(sourceFile, 121 /* AsyncKeyword */, insertBefore);
+ changes.insertModifierBefore(sourceFile, 122 /* AsyncKeyword */, insertBefore);
}
})(codefix = ts.codefix || (ts.codefix = {}));
})(ts || (ts = {}));
@@ -116114,17 +117322,17 @@
var type = checker.getWidenedType(checker.getTypeOfSymbolAtLocation(symbol, enclosingDeclaration));
var optional = !!(symbol.flags & 16777216 /* Optional */);
switch (declaration.kind) {
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 153 /* PropertySignature */:
- case 154 /* PropertyDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 154 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
var typeNode = checker.typeToTypeNode(type, enclosingDeclaration, /*flags*/ undefined, getNoopSymbolTrackerWithResolver(context));
out(ts.createProperty(
/*decorators*/ undefined, modifiers, name, optional ? ts.createToken(56 /* QuestionToken */) : undefined, typeNode,
/*initializer*/ undefined));
break;
- case 155 /* MethodSignature */:
- case 156 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
// The signature for the implementation appears as an entry in `signatures` iff
// there is only one signature.
// If there are overloads and an implementation signature, it appears as an
@@ -116165,7 +117373,7 @@
}
function signatureToMethodDeclaration(context, signature, enclosingDeclaration, modifiers, name, optional, body) {
var program = context.program;
- var signatureDeclaration = program.getTypeChecker().signatureToSignatureDeclaration(signature, 156 /* MethodDeclaration */, enclosingDeclaration, 1 /* NoTruncation */ | 256 /* SuppressAnyReturnType */, getNoopSymbolTrackerWithResolver(context));
+ var signatureDeclaration = program.getTypeChecker().signatureToSignatureDeclaration(signature, 157 /* MethodDeclaration */, enclosingDeclaration, 1 /* NoTruncation */ | 256 /* SuppressAnyReturnType */, getNoopSymbolTrackerWithResolver(context));
if (!signatureDeclaration) {
return undefined;
}
@@ -116193,7 +117401,7 @@
var returnType = (inJs || !contextualType) ? undefined : checker.typeToTypeNode(contextualType, contextNode, /*flags*/ undefined, tracker);
return ts.createMethod(
/*decorators*/ undefined,
- /*modifiers*/ makeStatic ? [ts.createToken(116 /* StaticKeyword */)] : undefined,
+ /*modifiers*/ makeStatic ? [ts.createToken(117 /* StaticKeyword */)] : undefined,
/*asteriskToken*/ ts.isYieldExpression(parent) ? ts.createToken(40 /* AsteriskToken */) : undefined, methodName,
/*questionToken*/ undefined,
/*typeParameters*/ inJs ? undefined : ts.map(typeArguments, function (_, i) {
@@ -116212,7 +117420,7 @@
/*dotDotDotToken*/ undefined,
/*name*/ names && names[i] || "arg" + i,
/*questionToken*/ minArgumentCount !== undefined && i >= minArgumentCount ? ts.createToken(56 /* QuestionToken */) : undefined,
- /*type*/ inJs ? undefined : types && types[i] || ts.createKeywordTypeNode(120 /* AnyKeyword */),
+ /*type*/ inJs ? undefined : types && types[i] || ts.createKeywordTypeNode(121 /* AnyKeyword */),
/*initializer*/ undefined);
parameters.push(newParameter);
}
@@ -116240,7 +117448,7 @@
var maxArgsParameterSymbolNames = maxArgsSignature.parameters.map(function (symbol) { return symbol.name; });
var parameters = createDummyParameters(maxNonRestArgs, maxArgsParameterSymbolNames, /* types */ undefined, minArgumentCount, /*inJs*/ false);
if (someSigHasRestParameter) {
- var anyArrayType = ts.createArrayTypeNode(ts.createKeywordTypeNode(120 /* AnyKeyword */));
+ var anyArrayType = ts.createArrayTypeNode(ts.createKeywordTypeNode(121 /* AnyKeyword */));
var restParameter = ts.createParameter(
/*decorators*/ undefined,
/*modifiers*/ undefined, ts.createToken(25 /* DotDotDotToken */), maxArgsParameterSymbolNames[maxNonRestArgs] || "rest",
@@ -116266,10 +117474,10 @@
}
function createVisibilityModifier(flags) {
if (flags & 4 /* Public */) {
- return ts.createToken(115 /* PublicKeyword */);
+ return ts.createToken(116 /* PublicKeyword */);
}
else if (flags & 16 /* Protected */) {
- return ts.createToken(114 /* ProtectedKeyword */);
+ return ts.createToken(115 /* ProtectedKeyword */);
}
return undefined;
}
@@ -116341,7 +117549,7 @@
});
function getActionsForUsageOfInvalidImport(context) {
var sourceFile = context.sourceFile;
- var targetKind = ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures.code === context.errorCode ? 191 /* CallExpression */ : 192 /* NewExpression */;
+ var targetKind = ts.Diagnostics.Cannot_invoke_an_expression_whose_type_lacks_a_call_signature_Type_0_has_no_compatible_call_signatures.code === context.errorCode ? 192 /* CallExpression */ : 193 /* NewExpression */;
var node = ts.findAncestor(ts.getTokenAtPosition(sourceFile, context.span.start), function (a) { return a.kind === targetKind && a.getStart() === context.span.start && a.getEnd() === (context.span.start + context.span.length); });
if (!node) {
return [];
@@ -116460,7 +117668,7 @@
return codefix.createCodeFixAction(fixName, changes, [ts.Diagnostics.Add_undefined_type_to_property_0, propertyDeclaration.name.getText()], fixIdAddUndefinedType, ts.Diagnostics.Add_undefined_type_to_all_uninitialized_properties);
}
function addUndefinedType(changeTracker, propertyDeclarationSourceFile, propertyDeclaration) {
- var undefinedTypeNode = ts.createKeywordTypeNode(141 /* UndefinedKeyword */);
+ var undefinedTypeNode = ts.createKeywordTypeNode(142 /* UndefinedKeyword */);
var type = propertyDeclaration.type; // TODO: GH#18217
var types = ts.isUnionTypeNode(type) ? type.types.concat(undefinedTypeNode) : [type, undefinedTypeNode];
changeTracker.replaceNode(propertyDeclarationSourceFile, type, ts.createUnionTypeNode(types));
@@ -116506,235 +117714,6 @@
}
})(codefix = ts.codefix || (ts.codefix = {}));
})(ts || (ts = {}));
-var ts;
-(function (ts) {
- function generateTypesForModule(name, moduleValue, formatSettings) {
- return generateTypesForModuleOrGlobal(name, moduleValue, formatSettings, 0 /* ExportEquals */);
- }
- ts.generateTypesForModule = generateTypesForModule;
- function generateTypesForGlobal(name, globalValue, formatSettings) {
- return generateTypesForModuleOrGlobal(name, globalValue, formatSettings, 3 /* Global */);
- }
- ts.generateTypesForGlobal = generateTypesForGlobal;
- function generateTypesForModuleOrGlobal(name, globalValue, formatSettings, outputKind) {
- return valueInfoToDeclarationFileText(ts.inspectValue(name, globalValue), formatSettings, outputKind);
- }
- /* @internal */
- function valueInfoToDeclarationFileText(valueInfo, formatSettings, outputKind) {
- if (outputKind === void 0) { outputKind = 0 /* ExportEquals */; }
- return ts.textChanges.getNewFileText(toStatements(valueInfo, outputKind), 3 /* TS */, formatSettings.newLineCharacter || "\n", ts.formatting.getFormatContext(formatSettings));
- }
- ts.valueInfoToDeclarationFileText = valueInfoToDeclarationFileText;
- /* @internal */
- var OutputKind;
- (function (OutputKind) {
- OutputKind[OutputKind["ExportEquals"] = 0] = "ExportEquals";
- OutputKind[OutputKind["NamedExport"] = 1] = "NamedExport";
- OutputKind[OutputKind["NamespaceMember"] = 2] = "NamespaceMember";
- OutputKind[OutputKind["Global"] = 3] = "Global";
- })(OutputKind || (OutputKind = {}));
- function toNamespaceMemberStatements(info) {
- return toStatements(info, 2 /* NamespaceMember */);
- }
- function toStatements(info, kind) {
- var isDefault = info.name === "default" /* Default */;
- var name = isDefault ? "_default" : info.name;
- if (!isValidIdentifier(name) || isDefault && kind !== 1 /* NamedExport */)
- return ts.emptyArray;
- var modifiers = isDefault && info.kind === 2 /* FunctionOrClass */ ? [ts.createModifier(85 /* ExportKeyword */), ts.createModifier(80 /* DefaultKeyword */)]
- : kind === 3 /* Global */ || kind === 0 /* ExportEquals */ ? [ts.createModifier(125 /* DeclareKeyword */)]
- : kind === 1 /* NamedExport */ ? [ts.createModifier(85 /* ExportKeyword */)]
- : undefined;
- var exportEquals = function () { return kind === 0 /* ExportEquals */ ? [exportEqualsOrDefault(info.name, /*isExportEquals*/ true)] : ts.emptyArray; };
- var exportDefault = function () { return isDefault ? [exportEqualsOrDefault("_default", /*isExportEquals*/ false)] : ts.emptyArray; };
- switch (info.kind) {
- case 2 /* FunctionOrClass */:
- return exportEquals().concat(functionOrClassToStatements(modifiers, name, info));
- case 3 /* Object */:
- var members = info.members, hasNontrivialPrototype = info.hasNontrivialPrototype;
- if (!hasNontrivialPrototype) {
- if (kind === 0 /* ExportEquals */) {
- return ts.flatMap(members, function (v) { return toStatements(v, 1 /* NamedExport */); });
- }
- if (members.some(function (m) { return m.kind === 2 /* FunctionOrClass */; })) {
- // If some member is a function, use a namespace so it gets a FunctionDeclaration or ClassDeclaration.
- return exportDefault().concat([createNamespace(modifiers, name, ts.flatMap(members, toNamespaceMemberStatements))]);
- }
- }
- // falls through
- case 0 /* Const */:
- case 1 /* Array */: {
- var comment = info.kind === 0 /* Const */ ? info.comment : undefined;
- var constVar = ts.createVariableStatement(modifiers, ts.createVariableDeclarationList([ts.createVariableDeclaration(name, toType(info))], 2 /* Const */));
- return exportEquals().concat(exportDefault(), [addComment(constVar, comment)]);
- }
- default:
- return ts.Debug.assertNever(info);
- }
- }
- function exportEqualsOrDefault(name, isExportEquals) {
- return ts.createExportAssignment(/*decorators*/ undefined, /*modifiers*/ undefined, isExportEquals, ts.createIdentifier(name));
- }
- function functionOrClassToStatements(modifiers, name, _a) {
- var source = _a.source, prototypeMembers = _a.prototypeMembers, namespaceMembers = _a.namespaceMembers;
- var fnAst = parseClassOrFunctionBody(source);
- var _b = fnAst === undefined ? { parameters: ts.emptyArray, returnType: anyType() } : getParametersAndReturnType(fnAst), parameters = _b.parameters, returnType = _b.returnType;
- var protoOrInstanceMembers = ts.createMap();
- if (typeof fnAst === "object")
- getConstructorFunctionInstanceProperties(fnAst, protoOrInstanceMembers);
- for (var _i = 0, prototypeMembers_1 = prototypeMembers; _i < prototypeMembers_1.length; _i++) {
- var p = prototypeMembers_1[_i];
- // ignore non-functions on the prototype
- if (p.kind === 2 /* FunctionOrClass */) {
- var m = tryGetMethod(p);
- if (m) {
- protoOrInstanceMembers.set(p.name, m);
- }
- }
- }
- var classStaticMembers = protoOrInstanceMembers.size !== 0 || fnAst === undefined || typeof fnAst !== "number" && fnAst.kind === 157 /* Constructor */ ? [] : undefined;
- var namespaceStatements = ts.flatMap(namespaceMembers, function (info) {
- if (!isValidIdentifier(info.name))
- return undefined;
- if (classStaticMembers) {
- switch (info.kind) {
- case 3 /* Object */:
- if (info.members.some(function (m) { return m.kind === 2 /* FunctionOrClass */; })) {
- break;
- }
- // falls through
- case 1 /* Array */:
- case 0 /* Const */:
- classStaticMembers.push(addComment(ts.createProperty(/*decorators*/ undefined, [ts.createModifier(116 /* StaticKeyword */)], info.name, /*questionOrExclamationToken*/ undefined, toType(info), /*initializer*/ undefined), info.kind === 0 /* Const */ ? info.comment : undefined));
- return undefined;
- case 2 /* FunctionOrClass */:
- if (!info.namespaceMembers.length) { // Else, can't merge a static method with a namespace. Must make it a function on the namespace.
- var sig = tryGetMethod(info, [ts.createModifier(116 /* StaticKeyword */)]);
- if (sig) {
- classStaticMembers.push(sig);
- return undefined;
- }
- }
- break;
- default:
- ts.Debug.assertNever(info);
- }
- }
- return toStatements(info, 2 /* NamespaceMember */);
- });
- var decl = classStaticMembers
- ? ts.createClassDeclaration(
- /*decorators*/ undefined, modifiers, name,
- /*typeParameters*/ undefined,
- /*heritageClauses*/ undefined, classStaticMembers.concat((parameters.length ? [ts.createConstructor(/*decorators*/ undefined, /*modifiers*/ undefined, parameters, /*body*/ undefined)] : ts.emptyArray), ts.arrayFrom(protoOrInstanceMembers.values())))
- : ts.createFunctionDeclaration(/*decorators*/ undefined, modifiers, /*asteriskToken*/ undefined, name, /*typeParameters*/ undefined, parameters, returnType, /*body*/ undefined);
- return [decl].concat((namespaceStatements.length === 0 ? ts.emptyArray : [createNamespace(modifiers && modifiers.map(function (m) { return ts.getSynthesizedDeepClone(m); }), name, namespaceStatements)]));
- }
- function tryGetMethod(_a, modifiers) {
- var name = _a.name, source = _a.source;
- if (!isValidIdentifier(name))
- return undefined;
- var fnAst = parseClassOrFunctionBody(source);
- if (fnAst === undefined || (typeof fnAst !== "number" && fnAst.kind === 157 /* Constructor */))
- return undefined;
- var sig = getParametersAndReturnType(fnAst);
- return sig && ts.createMethod(
- /*decorators*/ undefined, modifiers,
- /*asteriskToken*/ undefined, name,
- /*questionToken*/ undefined,
- /*typeParameters*/ undefined, sig.parameters, sig.returnType,
- /*body*/ undefined);
- }
- function toType(info) {
- switch (info.kind) {
- case 0 /* Const */:
- return ts.createTypeReferenceNode(info.typeName, /*typeArguments*/ undefined);
- case 1 /* Array */:
- return ts.createArrayTypeNode(toType(info.inner));
- case 2 /* FunctionOrClass */:
- return ts.createTypeReferenceNode("Function", /*typeArguments*/ undefined); // Normally we create a FunctionDeclaration, but this can happen for a function in an array.
- case 3 /* Object */:
- return ts.createTypeLiteralNode(info.members.map(function (m) { return ts.createPropertySignature(/*modifiers*/ undefined, toPropertyName(m.name), /*questionToken*/ undefined, toType(m), /*initializer*/ undefined); }));
- default:
- return ts.Debug.assertNever(info);
- }
- }
- function toPropertyName(name) {
- return ts.isIdentifierText(name, 7 /* ESNext */) ? ts.createIdentifier(name) : ts.createStringLiteral(name);
- }
- // Parses assignments to "this.x" in the constructor into class property declarations
- function getConstructorFunctionInstanceProperties(fnAst, members) {
- forEachOwnNodeOfFunction(fnAst, function (node) {
- if (ts.isAssignmentExpression(node, /*excludeCompoundAssignment*/ true) &&
- ts.isPropertyAccessExpression(node.left) && node.left.expression.kind === 100 /* ThisKeyword */) {
- var name_4 = node.left.name.text;
- if (!ts.isJsPrivate(name_4)) {
- ts.getOrUpdate(members, name_4, function () { return ts.createProperty(/*decorators*/ undefined, /*modifiers*/ undefined, name_4, /*questionOrExclamationToken*/ undefined, anyType(), /*initializer*/ undefined); });
- }
- }
- });
- }
- function getParametersAndReturnType(fnAst) {
- if (typeof fnAst === "number") {
- return { parameters: ts.fill(fnAst, function (i) { return makeParameter("p" + i, anyType()); }), returnType: anyType() };
- }
- var usedArguments = false, hasReturn = false;
- forEachOwnNodeOfFunction(fnAst, function (node) {
- usedArguments = usedArguments || ts.isIdentifier(node) && node.text === "arguments";
- hasReturn = hasReturn || ts.isReturnStatement(node) && !!node.expression && node.expression.kind !== 200 /* VoidExpression */;
- });
- var parameters = fnAst.parameters.map(function (p) { return makeParameter("" + p.name.getText(), inferParameterType(fnAst, p)); }).concat((usedArguments ? [makeRestParameter()] : ts.emptyArray));
- return { parameters: parameters, returnType: hasReturn ? anyType() : ts.createKeywordTypeNode(106 /* VoidKeyword */) };
- }
- function makeParameter(name, type) {
- return ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotDotDotToken*/ undefined, name, /*questionToken*/ undefined, type);
- }
- function makeRestParameter() {
- return ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, ts.createToken(25 /* DotDotDotToken */), "args", /*questionToken*/ undefined, ts.createArrayTypeNode(anyType()));
- }
- /** Returns 'undefined' for class with no declared constructor */
- function parseClassOrFunctionBody(source) {
- if (typeof source === "number")
- return source;
- var classOrFunction = ts.tryCast(parseExpression(source), function (node) { return ts.isFunctionExpression(node) || ts.isArrowFunction(node) || ts.isClassExpression(node); });
- return classOrFunction
- ? ts.isClassExpression(classOrFunction) ? ts.find(classOrFunction.members, ts.isConstructorDeclaration) : classOrFunction
- // If that didn't parse, it's a method `m() {}`. Parse again inside of an object literal.
- : ts.cast(ts.first(ts.cast(parseExpression("{ " + source + " }"), ts.isObjectLiteralExpression).properties), ts.isMethodDeclaration);
- }
- function parseExpression(expr) {
- var text = "const _ = " + expr;
- var srcFile = ts.createSourceFile("test.ts", text, 7 /* Latest */, /*setParentNodes*/ true);
- return ts.first(ts.cast(ts.first(srcFile.statements), ts.isVariableStatement).declarationList.declarations).initializer;
- }
- function inferParameterType(_fn, _param) {
- // TODO: Inspect function body for clues (see inferFromUsage.ts)
- return anyType();
- }
- // Descends through all nodes in a function, but not in nested functions.
- function forEachOwnNodeOfFunction(fnAst, cb) {
- fnAst.body.forEachChild(function recur(node) {
- cb(node);
- if (!ts.isFunctionLike(node))
- node.forEachChild(recur);
- });
- }
- function isValidIdentifier(name) {
- var keyword = ts.stringToToken(name);
- return !(keyword && ts.isNonContextualKeyword(keyword)) && ts.isIdentifierText(name, 7 /* ESNext */);
- }
- function addComment(node, comment) {
- if (comment !== undefined)
- ts.addSyntheticLeadingComment(node, 2 /* SingleLineCommentTrivia */, comment);
- return node;
- }
- function anyType() {
- return ts.createKeywordTypeNode(120 /* AnyKeyword */);
- }
- function createNamespace(modifiers, name, statements) {
- return ts.createModuleDeclaration(/*decorators*/ undefined, modifiers, ts.createIdentifier(name), ts.createModuleBlock(statements), 16 /* Namespace */);
- }
-})(ts || (ts = {}));
/* @internal */
var ts;
(function (ts) {
@@ -116831,8 +117810,8 @@
});
function getImportTypeNode(sourceFile, pos) {
var token = ts.getTokenAtPosition(sourceFile, pos);
- ts.Debug.assert(token.kind === 92 /* ImportKeyword */);
- ts.Debug.assert(token.parent.kind === 183 /* ImportType */);
+ ts.Debug.assert(token.kind === 93 /* ImportKeyword */);
+ ts.Debug.assert(token.parent.kind === 184 /* ImportType */);
return token.parent;
}
function doChange(changes, sourceFile, importType) {
@@ -116884,7 +117863,7 @@
var otherMembers = members.filter(function (member) { return !ts.isIndexSignatureDeclaration(member); });
var parameter = ts.first(indexSignature.parameters);
var mappedTypeParameter = ts.createTypeParameterDeclaration(ts.cast(parameter.name, ts.isIdentifier), parameter.type);
- var mappedIntersectionType = ts.createMappedTypeNode(ts.hasReadonlyModifier(indexSignature) ? ts.createModifier(133 /* ReadonlyKeyword */) : undefined, mappedTypeParameter, indexSignature.questionToken, indexSignature.type);
+ var mappedIntersectionType = ts.createMappedTypeNode(ts.hasReadonlyModifier(indexSignature) ? ts.createModifier(134 /* ReadonlyKeyword */) : undefined, mappedTypeParameter, indexSignature.questionToken, indexSignature.type);
var intersectionType = ts.createIntersectionTypeNode(ts.getAllSuperTypeNodes(container).concat([
mappedIntersectionType
], (otherMembers.length ? [ts.createTypeLiteralNode(otherMembers)] : ts.emptyArray)));
@@ -116931,16 +117910,16 @@
return undefined;
}
switch (exportNode.kind) {
- case 239 /* FunctionDeclaration */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 244 /* ModuleDeclaration */: {
+ case 240 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 245 /* ModuleDeclaration */: {
var node = exportNode;
return node.name && ts.isIdentifier(node.name) ? { exportNode: node, exportName: node.name, wasDefault: wasDefault, exportingModuleSymbol: exportingModuleSymbol } : undefined;
}
- case 219 /* VariableStatement */: {
+ case 220 /* VariableStatement */: {
var vs = exportNode;
// Must be `export const x = something;`.
if (!(vs.declarationList.flags & 2 /* Const */) || vs.declarationList.declarations.length !== 1) {
@@ -116963,17 +117942,17 @@
function changeExport(exportingSourceFile, _a, changes, checker) {
var wasDefault = _a.wasDefault, exportNode = _a.exportNode, exportName = _a.exportName;
if (wasDefault) {
- changes.delete(exportingSourceFile, ts.Debug.assertDefined(ts.findModifier(exportNode, 80 /* DefaultKeyword */)));
+ changes.delete(exportingSourceFile, ts.Debug.assertDefined(ts.findModifier(exportNode, 81 /* DefaultKeyword */)));
}
else {
- var exportKeyword = ts.Debug.assertDefined(ts.findModifier(exportNode, 85 /* ExportKeyword */));
+ var exportKeyword = ts.Debug.assertDefined(ts.findModifier(exportNode, 86 /* ExportKeyword */));
switch (exportNode.kind) {
- case 239 /* FunctionDeclaration */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- changes.insertNodeAfter(exportingSourceFile, exportKeyword, ts.createToken(80 /* DefaultKeyword */));
+ case 240 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ changes.insertNodeAfter(exportingSourceFile, exportKeyword, ts.createToken(81 /* DefaultKeyword */));
break;
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
// If 'x' isn't used in this file, `export const x = 0;` --> `export default 0;`
if (!ts.FindAllReferences.Core.isSymbolReferencedInFile(exportName, checker, exportingSourceFile)) {
// We checked in `getInfo` that an initializer exists.
@@ -116981,9 +117960,9 @@
break;
}
// falls through
- case 243 /* EnumDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 244 /* ModuleDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 245 /* ModuleDeclaration */:
// `export type T = number;` -> `type T = number; export default T;`
changes.deleteModifier(exportingSourceFile, exportKeyword);
changes.insertNodeAfter(exportingSourceFile, exportNode, ts.createExportDefault(ts.createIdentifier(exportName.text)));
@@ -117010,18 +117989,18 @@
function changeDefaultToNamedImport(importingSourceFile, ref, changes, exportName) {
var parent = ref.parent;
switch (parent.kind) {
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
// `a.default` --> `a.foo`
changes.replaceNode(importingSourceFile, ref, ts.createIdentifier(exportName));
break;
- case 253 /* ImportSpecifier */:
- case 257 /* ExportSpecifier */: {
+ case 254 /* ImportSpecifier */:
+ case 258 /* ExportSpecifier */: {
var spec = parent;
// `default as foo` --> `foo`, `default as bar` --> `foo as bar`
changes.replaceNode(importingSourceFile, spec, makeImportSpecifier(exportName, spec.name.text));
break;
}
- case 250 /* ImportClause */: {
+ case 251 /* ImportClause */: {
var clause = parent;
ts.Debug.assert(clause.name === ref);
var spec = makeImportSpecifier(exportName, ref.text);
@@ -117030,7 +118009,7 @@
// `import foo from "./a";` --> `import { foo } from "./a";`
changes.replaceNode(importingSourceFile, ref, ts.createNamedImports([spec]));
}
- else if (namedBindings.kind === 251 /* NamespaceImport */) {
+ else if (namedBindings.kind === 252 /* NamespaceImport */) {
// `import foo, * as a from "./a";` --> `import * as a from ".a/"; import { foo } from "./a";`
changes.deleteRange(importingSourceFile, { pos: ref.getStart(importingSourceFile), end: namedBindings.getStart(importingSourceFile) });
var quotePreference = ts.isStringLiteral(clause.parent.moduleSpecifier) ? ts.quotePreferenceFromString(clause.parent.moduleSpecifier, importingSourceFile) : 1 /* Double */;
@@ -117051,11 +118030,11 @@
function changeNamedToDefaultImport(importingSourceFile, ref, changes) {
var parent = ref.parent;
switch (parent.kind) {
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
// `a.foo` --> `a.default`
changes.replaceNode(importingSourceFile, ref, ts.createIdentifier("default"));
break;
- case 253 /* ImportSpecifier */: {
+ case 254 /* ImportSpecifier */: {
// `import { foo } from "./a";` --> `import foo from "./a";`
// `import { foo as bar } from "./a";` --> `import bar from "./a";`
var defaultImport = ts.createIdentifier(parent.name.text);
@@ -117068,7 +118047,7 @@
}
break;
}
- case 257 /* ExportSpecifier */: {
+ case 258 /* ExportSpecifier */: {
// `export { foo } from "./a";` --> `export { default as foo } from "./a";`
// `export { foo as bar } from "./a";` --> `export { default as bar } from "./a";`
// `export { foo as default } from "./a";` --> `export { default } from "./a";`
@@ -117101,8 +118080,8 @@
var i = getImportToConvert(context);
if (!i)
return ts.emptyArray;
- var description = i.kind === 251 /* NamespaceImport */ ? ts.Diagnostics.Convert_namespace_import_to_named_imports.message : ts.Diagnostics.Convert_named_imports_to_namespace_import.message;
- var actionName = i.kind === 251 /* NamespaceImport */ ? actionNameNamespaceToNamed : actionNameNamedToNamespace;
+ var description = i.kind === 252 /* NamespaceImport */ ? ts.Diagnostics.Convert_namespace_import_to_named_imports.message : ts.Diagnostics.Convert_named_imports_to_namespace_import.message;
+ var actionName = i.kind === 252 /* NamespaceImport */ ? actionNameNamespaceToNamed : actionNameNamedToNamespace;
return [{ name: refactorName, description: description, actions: [{ name: actionName, description: description }] }];
},
getEditsForAction: function (context, actionName) {
@@ -117124,7 +118103,7 @@
}
function doChange(sourceFile, program, changes, toConvert) {
var checker = program.getTypeChecker();
- if (toConvert.kind === 251 /* NamespaceImport */) {
+ if (toConvert.kind === 252 /* NamespaceImport */) {
doChangeNamespaceToNamed(sourceFile, checker, changes, toConvert, ts.getAllowSyntheticDefaultImports(program.getCompilerOptions()));
}
else {
@@ -117176,7 +118155,7 @@
function doChangeNamedToNamespace(sourceFile, checker, changes, toConvert) {
var importDecl = toConvert.parent.parent;
var moduleSpecifier = importDecl.moduleSpecifier;
- var preferredName = moduleSpecifier && ts.isStringLiteral(moduleSpecifier) ? ts.codefix.moduleSpecifierToValidIdentifier(moduleSpecifier.text, 7 /* ESNext */) : "module";
+ var preferredName = moduleSpecifier && ts.isStringLiteral(moduleSpecifier) ? ts.codefix.moduleSpecifierToValidIdentifier(moduleSpecifier.text, 8 /* ESNext */) : "module";
var namespaceNameConflicts = toConvert.elements.some(function (element) {
return ts.FindAllReferences.Core.eachSymbolReferenceInFile(element.name, checker, sourceFile, function (id) {
return !!checker.resolveName(preferredName, id, 67108863 /* All */, /*excludeGlobals*/ true);
@@ -117467,20 +118446,20 @@
function checkForStaticContext(nodeToCheck, containingClass) {
var current = nodeToCheck;
while (current !== containingClass) {
- if (current.kind === 154 /* PropertyDeclaration */) {
+ if (current.kind === 155 /* PropertyDeclaration */) {
if (ts.hasModifier(current, 32 /* Static */)) {
rangeFacts |= RangeFacts.InStaticRegion;
}
break;
}
- else if (current.kind === 151 /* Parameter */) {
+ else if (current.kind === 152 /* Parameter */) {
var ctorOrMethod = ts.getContainingFunction(current);
- if (ctorOrMethod.kind === 157 /* Constructor */) {
+ if (ctorOrMethod.kind === 158 /* Constructor */) {
rangeFacts |= RangeFacts.InStaticRegion;
}
break;
}
- else if (current.kind === 156 /* MethodDeclaration */) {
+ else if (current.kind === 157 /* MethodDeclaration */) {
if (ts.hasModifier(current, 32 /* Static */)) {
rangeFacts |= RangeFacts.InStaticRegion;
}
@@ -117523,7 +118502,7 @@
return true;
}
if (ts.isDeclaration(node)) {
- var declaringNode = (node.kind === 237 /* VariableDeclaration */) ? node.parent.parent : node;
+ var declaringNode = (node.kind === 238 /* VariableDeclaration */) ? node.parent.parent : node;
if (ts.hasModifier(declaringNode, 1 /* Export */)) {
// TODO: GH#18217 Silly to use `errors ||` since it's definitely not defined (see top of `visit`)
// Also, if we're only pushing one error, just use `let error: Diagnostic | undefined`!
@@ -117535,13 +118514,13 @@
}
// Some things can't be extracted in certain situations
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
(errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractImport));
return true;
- case 98 /* SuperKeyword */:
+ case 99 /* SuperKeyword */:
// For a super *constructor call*, we have to be extracting the entire class,
// but a super *method call* simply implies a 'this' reference
- if (node.parent.kind === 191 /* CallExpression */) {
+ if (node.parent.kind === 192 /* CallExpression */) {
// Super constructor call
var containingClass_1 = ts.getContainingClass(node); // TODO:GH#18217
if (containingClass_1.pos < span.start || containingClass_1.end >= (span.start + span.length)) {
@@ -117556,8 +118535,8 @@
}
if (ts.isFunctionLikeDeclaration(node) || ts.isClassLike(node)) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 240 /* ClassDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
if (ts.isSourceFile(node.parent) && node.parent.externalModuleIndicator === undefined) {
// You cannot extract global declarations
(errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.functionWillNotBeVisibleInTheNewScope));
@@ -117569,20 +118548,20 @@
}
var savedPermittedJumps = permittedJumps;
switch (node.kind) {
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
permittedJumps = 0 /* None */;
break;
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
// forbid all jumps inside try blocks
permittedJumps = 0 /* None */;
break;
- case 218 /* Block */:
- if (node.parent && node.parent.kind === 235 /* TryStatement */ && node.parent.finallyBlock === node) {
+ case 219 /* Block */:
+ if (node.parent && node.parent.kind === 236 /* TryStatement */ && node.parent.finallyBlock === node) {
// allow unconditional returns from finally blocks
permittedJumps = 4 /* Return */;
}
break;
- case 271 /* CaseClause */:
+ case 272 /* CaseClause */:
// allow unlabeled break inside case clauses
permittedJumps |= 1 /* Break */;
break;
@@ -117594,19 +118573,19 @@
break;
}
switch (node.kind) {
- case 178 /* ThisType */:
- case 100 /* ThisKeyword */:
+ case 179 /* ThisType */:
+ case 101 /* ThisKeyword */:
rangeFacts |= RangeFacts.UsesThis;
break;
- case 233 /* LabeledStatement */: {
+ case 234 /* LabeledStatement */: {
var label = node.label;
(seenLabels || (seenLabels = [])).push(label.escapedText);
ts.forEachChild(node, visit);
seenLabels.pop();
break;
}
- case 229 /* BreakStatement */:
- case 228 /* ContinueStatement */: {
+ case 230 /* BreakStatement */:
+ case 229 /* ContinueStatement */: {
var label = node.label;
if (label) {
if (!ts.contains(seenLabels, label.escapedText)) {
@@ -117615,20 +118594,20 @@
}
}
else {
- if (!(permittedJumps & (node.kind === 229 /* BreakStatement */ ? 1 /* Break */ : 2 /* Continue */))) {
+ if (!(permittedJumps & (node.kind === 230 /* BreakStatement */ ? 1 /* Break */ : 2 /* Continue */))) {
// attempt to break or continue in a forbidden context
(errors || (errors = [])).push(ts.createDiagnosticForNode(node, Messages.cannotExtractRangeContainingConditionalBreakOrContinueStatements));
}
}
break;
}
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
rangeFacts |= RangeFacts.IsAsyncFunction;
break;
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
rangeFacts |= RangeFacts.IsGenerator;
break;
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
if (permittedJumps & 4 /* Return */) {
rangeFacts |= RangeFacts.HasReturn;
}
@@ -117682,7 +118661,7 @@
while (true) {
current = current.parent;
// A function parameter's initializer is actually in the outer scope, not the function declaration
- if (current.kind === 151 /* Parameter */) {
+ if (current.kind === 152 /* Parameter */) {
// Skip all the way to the outer scope of the function that declared this parameter
current = ts.findAncestor(current, function (parent) { return ts.isFunctionLikeDeclaration(parent); }).parent;
}
@@ -117693,7 +118672,7 @@
// * Module/namespace or source file
if (isScope(current)) {
scopes.push(current);
- if (current.kind === 284 /* SourceFile */) {
+ if (current.kind === 285 /* SourceFile */) {
return scopes;
}
}
@@ -117783,32 +118762,32 @@
}
function getDescriptionForFunctionLikeDeclaration(scope) {
switch (scope.kind) {
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return "constructor";
- case 196 /* FunctionExpression */:
- case 239 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
return scope.name
? "function '" + scope.name.text + "'"
: "anonymous function";
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return "arrow function";
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return "method '" + scope.name.getText() + "'";
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
return "'get " + scope.name.getText() + "'";
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
return "'set " + scope.name.getText() + "'";
default:
throw ts.Debug.assertNever(scope);
}
}
function getDescriptionForClassLikeDeclaration(scope) {
- return scope.kind === 240 /* ClassDeclaration */
+ return scope.kind === 241 /* ClassDeclaration */
? scope.name ? "class '" + scope.name.text + "'" : "anonymous class declaration"
: scope.name ? "class expression '" + scope.name.text + "'" : "anonymous class expression";
}
function getDescriptionForModuleLikeDeclaration(scope) {
- return scope.kind === 245 /* ModuleBlock */
+ return scope.kind === 246 /* ModuleBlock */
? "namespace '" + scope.parent.name.getText() + "'"
: scope.externalModuleIndicator ? 0 /* Module */ : 1 /* Global */;
}
@@ -117874,12 +118853,12 @@
var newFunction;
if (ts.isClassLike(scope)) {
// always create private method in TypeScript files
- var modifiers = isJS ? [] : [ts.createToken(113 /* PrivateKeyword */)];
+ var modifiers = isJS ? [] : [ts.createToken(114 /* PrivateKeyword */)];
if (range.facts & RangeFacts.InStaticRegion) {
- modifiers.push(ts.createToken(116 /* StaticKeyword */));
+ modifiers.push(ts.createToken(117 /* StaticKeyword */));
}
if (range.facts & RangeFacts.IsAsyncFunction) {
- modifiers.push(ts.createToken(121 /* AsyncKeyword */));
+ modifiers.push(ts.createToken(122 /* AsyncKeyword */));
}
newFunction = ts.createMethod(
/*decorators*/ undefined, modifiers.length ? modifiers : undefined, range.facts & RangeFacts.IsGenerator ? ts.createToken(40 /* AsteriskToken */) : undefined, functionName,
@@ -117887,7 +118866,7 @@
}
else {
newFunction = ts.createFunctionDeclaration(
- /*decorators*/ undefined, range.facts & RangeFacts.IsAsyncFunction ? [ts.createToken(121 /* AsyncKeyword */)] : undefined, range.facts & RangeFacts.IsGenerator ? ts.createToken(40 /* AsteriskToken */) : undefined, functionName, typeParameters, parameters, returnType, body);
+ /*decorators*/ undefined, range.facts & RangeFacts.IsAsyncFunction ? [ts.createToken(122 /* AsyncKeyword */)] : undefined, range.facts & RangeFacts.IsGenerator ? ts.createToken(40 /* AsteriskToken */) : undefined, functionName, typeParameters, parameters, returnType, body);
}
var changeTracker = ts.textChanges.ChangeTracker.fromContext(context);
var minInsertionPos = (isReadonlyArray(range.range) ? ts.last(range.range) : range.range).end;
@@ -118028,9 +119007,9 @@
while (ts.isParenthesizedTypeNode(withoutParens)) {
withoutParens = withoutParens.type;
}
- return ts.isUnionTypeNode(withoutParens) && ts.find(withoutParens.types, function (t) { return t.kind === 141 /* UndefinedKeyword */; })
+ return ts.isUnionTypeNode(withoutParens) && ts.find(withoutParens.types, function (t) { return t.kind === 142 /* UndefinedKeyword */; })
? clone
- : ts.createUnionTypeNode([clone, ts.createKeywordTypeNode(141 /* UndefinedKeyword */)]);
+ : ts.createUnionTypeNode([clone, ts.createKeywordTypeNode(142 /* UndefinedKeyword */)]);
}
}
/**
@@ -118053,11 +119032,11 @@
if (ts.isClassLike(scope)) {
ts.Debug.assert(!isJS); // See CannotExtractToJSClass
var modifiers = [];
- modifiers.push(ts.createToken(113 /* PrivateKeyword */));
+ modifiers.push(ts.createToken(114 /* PrivateKeyword */));
if (rangeFacts & RangeFacts.InStaticRegion) {
- modifiers.push(ts.createToken(116 /* StaticKeyword */));
+ modifiers.push(ts.createToken(117 /* StaticKeyword */));
}
- modifiers.push(ts.createToken(133 /* ReadonlyKeyword */));
+ modifiers.push(ts.createToken(134 /* ReadonlyKeyword */));
var newVariable = ts.createProperty(
/*decorators*/ undefined, modifiers, localNameText,
/*questionToken*/ undefined, variableType, initializer);
@@ -118086,7 +119065,7 @@
var localReference = ts.createIdentifier(localNameText);
changeTracker.replaceNode(context.file, node, localReference);
}
- else if (node.parent.kind === 221 /* ExpressionStatement */ && scope === ts.findAncestor(node, isScope)) {
+ else if (node.parent.kind === 222 /* ExpressionStatement */ && scope === ts.findAncestor(node, isScope)) {
// If the parent is an expression statement and the target scope is the immediately enclosing one,
// replace the statement with the declaration.
var newVariableStatement = ts.createVariableStatement(
@@ -118105,7 +119084,7 @@
changeTracker.insertNodeBefore(context.file, nodeToInsertBefore, newVariableStatement, /*blankLineBetween*/ false);
}
// Consume
- if (node.parent.kind === 221 /* ExpressionStatement */) {
+ if (node.parent.kind === 222 /* ExpressionStatement */) {
// If the parent is an expression statement, delete it.
changeTracker.delete(context.file, node.parent);
}
@@ -118192,7 +119171,7 @@
return { body: ts.createBlock(statements, /*multiLine*/ true), returnValueProperty: undefined };
}
function visitor(node) {
- if (!ignoreReturns && node.kind === 230 /* ReturnStatement */ && hasWritesOrVariableDeclarations) {
+ if (!ignoreReturns && node.kind === 231 /* ReturnStatement */ && hasWritesOrVariableDeclarations) {
var assignments = getPropertyAssignmentsForWritesAndVariableDeclarations(exposedVariableDeclarations, writes);
if (node.expression) {
if (!returnValueProperty) {
@@ -118370,7 +119349,7 @@
var scope = scopes_1[_i];
usagesPerScope.push({ usages: ts.createMap(), typeParameterUsages: ts.createMap(), substitutions: ts.createMap() });
substitutionsPerScope.push(ts.createMap());
- functionErrorsPerScope.push(ts.isFunctionLikeDeclaration(scope) && scope.kind !== 239 /* FunctionDeclaration */
+ functionErrorsPerScope.push(ts.isFunctionLikeDeclaration(scope) && scope.kind !== 240 /* FunctionDeclaration */
? [ts.createDiagnosticForNode(scope, Messages.cannotExtractToOtherFunctionLike)]
: []);
var constantErrors = [];
@@ -118686,30 +119665,30 @@
function isExtractableExpression(node) {
var parent = node.parent;
switch (parent.kind) {
- case 278 /* EnumMember */:
+ case 279 /* EnumMember */:
return false;
}
switch (node.kind) {
case 10 /* StringLiteral */:
- return parent.kind !== 249 /* ImportDeclaration */ &&
- parent.kind !== 253 /* ImportSpecifier */;
- case 208 /* SpreadElement */:
- case 184 /* ObjectBindingPattern */:
- case 186 /* BindingElement */:
- return false;
- case 72 /* Identifier */:
- return parent.kind !== 186 /* BindingElement */ &&
- parent.kind !== 253 /* ImportSpecifier */ &&
- parent.kind !== 257 /* ExportSpecifier */;
+ return parent.kind !== 250 /* ImportDeclaration */ &&
+ parent.kind !== 254 /* ImportSpecifier */;
+ case 209 /* SpreadElement */:
+ case 185 /* ObjectBindingPattern */:
+ case 187 /* BindingElement */:
+ return false;
+ case 73 /* Identifier */:
+ return parent.kind !== 187 /* BindingElement */ &&
+ parent.kind !== 254 /* ImportSpecifier */ &&
+ parent.kind !== 258 /* ExportSpecifier */;
}
return true;
}
function isBlockLike(node) {
switch (node.kind) {
- case 218 /* Block */:
- case 284 /* SourceFile */:
- case 245 /* ModuleBlock */:
- case 271 /* CaseClause */:
+ case 219 /* Block */:
+ case 285 /* SourceFile */:
+ case 246 /* ModuleBlock */:
+ case 272 /* CaseClause */:
return true;
default:
return false;
@@ -118723,6 +119702,136 @@
(function (ts) {
var refactor;
(function (refactor) {
+ var refactorName = "Extract type";
+ var extractToTypeAlias = "Extract to type alias";
+ var extractToTypeDef = "Extract to typedef";
+ refactor.registerRefactor(refactorName, {
+ getAvailableActions: function (context) {
+ var info = getRangeToExtract(context);
+ if (!info)
+ return ts.emptyArray;
+ return [{
+ name: refactorName,
+ description: ts.getLocaleSpecificMessage(ts.Diagnostics.Extract_type),
+ actions: [info.isJS ? {
+ name: extractToTypeDef, description: ts.getLocaleSpecificMessage(ts.Diagnostics.Extract_to_typedef)
+ } : {
+ name: extractToTypeAlias, description: ts.getLocaleSpecificMessage(ts.Diagnostics.Extract_to_type_alias)
+ }]
+ }];
+ },
+ getEditsForAction: function (context, actionName) {
+ ts.Debug.assert(actionName === extractToTypeAlias || actionName === extractToTypeDef);
+ var file = context.file;
+ var info = ts.Debug.assertDefined(getRangeToExtract(context));
+ ts.Debug.assert(actionName === extractToTypeAlias && !info.isJS || actionName === extractToTypeDef && info.isJS);
+ var name = ts.getUniqueName("NewType", file);
+ var edits = ts.textChanges.ChangeTracker.with(context, function (changes) { return info.isJS ?
+ doTypedefChange(changes, file, name, info.firstStatement, info.selection, info.typeParameters) :
+ doTypeAliasChange(changes, file, name, info.firstStatement, info.selection, info.typeParameters); });
+ var renameFilename = file.fileName;
+ var renameLocation = ts.getRenameLocation(edits, renameFilename, name, /*preferLastLocation*/ false);
+ return { edits: edits, renameFilename: renameFilename, renameLocation: renameLocation };
+ }
+ });
+ function getRangeToExtract(context) {
+ var file = context.file, startPosition = context.startPosition;
+ var isJS = ts.isSourceFileJS(file);
+ var current = ts.getTokenAtPosition(file, startPosition);
+ var range = ts.createTextRangeFromSpan(ts.getRefactorContextSpan(context));
+ var selection = ts.findAncestor(current, (function (node) { return node.parent && rangeContainsSkipTrivia(range, node, file) && !rangeContainsSkipTrivia(range, node.parent, file); }));
+ if (!selection || !ts.isTypeNode(selection))
+ return undefined;
+ var checker = context.program.getTypeChecker();
+ var firstStatement = ts.Debug.assertDefined(isJS ? ts.findAncestor(selection, isStatementAndHasJSDoc) : ts.findAncestor(selection, ts.isStatement));
+ var typeParameters = collectTypeParameters(checker, selection, firstStatement, file);
+ if (!typeParameters)
+ return undefined;
+ return { isJS: isJS, selection: selection, firstStatement: firstStatement, typeParameters: typeParameters };
+ }
+ function isStatementAndHasJSDoc(n) {
+ return ts.isStatement(n) && ts.hasJSDocNodes(n);
+ }
+ function rangeContainsSkipTrivia(r1, node, file) {
+ return ts.rangeContainsStartEnd(r1, ts.skipTrivia(file.text, node.pos), node.end);
+ }
+ function collectTypeParameters(checker, selection, statement, file) {
+ var result = [];
+ return visitor(selection) ? undefined : result;
+ function visitor(node) {
+ if (ts.isTypeReferenceNode(node)) {
+ if (ts.isIdentifier(node.typeName)) {
+ var symbol = checker.resolveName(node.typeName.text, node.typeName, 262144 /* TypeParameter */, /* excludeGlobals */ true);
+ if (symbol) {
+ var declaration = ts.cast(ts.first(symbol.declarations), ts.isTypeParameterDeclaration);
+ if (rangeContainsSkipTrivia(statement, declaration, file) && !rangeContainsSkipTrivia(selection, declaration, file)) {
+ result.push(declaration);
+ }
+ }
+ }
+ }
+ else if (ts.isInferTypeNode(node)) {
+ var conditionalTypeNode = ts.findAncestor(node, function (n) { return ts.isConditionalTypeNode(n) && rangeContainsSkipTrivia(n.extendsType, node, file); });
+ if (!conditionalTypeNode || !rangeContainsSkipTrivia(selection, conditionalTypeNode, file)) {
+ return true;
+ }
+ }
+ else if ((ts.isTypePredicateNode(node) || ts.isThisTypeNode(node))) {
+ var functionLikeNode = ts.findAncestor(node.parent, ts.isFunctionLike);
+ if (functionLikeNode && functionLikeNode.type && rangeContainsSkipTrivia(functionLikeNode.type, node, file) && !rangeContainsSkipTrivia(selection, functionLikeNode, file)) {
+ return true;
+ }
+ }
+ else if (ts.isTypeQueryNode(node)) {
+ if (ts.isIdentifier(node.exprName)) {
+ var symbol = checker.resolveName(node.exprName.text, node.exprName, 67220415 /* Value */, /* excludeGlobals */ false);
+ if (symbol && rangeContainsSkipTrivia(statement, symbol.valueDeclaration, file) && !rangeContainsSkipTrivia(selection, symbol.valueDeclaration, file)) {
+ return true;
+ }
+ }
+ else {
+ if (ts.isThisIdentifier(node.exprName.left) && !rangeContainsSkipTrivia(selection, node.parent, file)) {
+ return true;
+ }
+ }
+ }
+ return ts.forEachChild(node, visitor);
+ }
+ }
+ function doTypeAliasChange(changes, file, name, firstStatement, selection, typeParameters) {
+ var newTypeNode = ts.createTypeAliasDeclaration(
+ /* decorators */ undefined,
+ /* modifiers */ undefined, name, typeParameters.map(function (id) { return ts.updateTypeParameterDeclaration(id, id.name, id.constraint, /* defaultType */ undefined); }), selection);
+ changes.insertNodeBefore(file, firstStatement, newTypeNode, /* blankLineBetween */ true);
+ changes.replaceNode(file, selection, ts.createTypeReferenceNode(name, typeParameters.map(function (id) { return ts.createTypeReferenceNode(id.name, /* typeArguments */ undefined); })));
+ }
+ function doTypedefChange(changes, file, name, firstStatement, selection, typeParameters) {
+ var node = ts.createNode(310 /* JSDocTypedefTag */);
+ node.tagName = ts.createIdentifier("typedef"); // TODO: jsdoc factory https://github.com/Microsoft/TypeScript/pull/29539
+ node.fullName = ts.createIdentifier(name);
+ node.name = node.fullName;
+ node.typeExpression = ts.createJSDocTypeExpression(selection);
+ var templates = [];
+ ts.forEach(typeParameters, function (typeParameter) {
+ var constraint = ts.getEffectiveConstraintOfTypeParameter(typeParameter);
+ var template = ts.createNode(309 /* JSDocTemplateTag */);
+ template.tagName = ts.createIdentifier("template");
+ template.constraint = constraint && ts.cast(constraint, ts.isJSDocTypeExpression);
+ var parameter = ts.createNode(151 /* TypeParameter */);
+ parameter.name = typeParameter.name;
+ template.typeParameters = ts.createNodeArray([parameter]);
+ templates.push(template);
+ });
+ changes.insertNodeBefore(file, firstStatement, ts.createJSDocComment(/* comment */ undefined, ts.createNodeArray(ts.concatenate(templates, [node]))), /* blankLineBetween */ true);
+ changes.replaceNode(file, selection, ts.createTypeReferenceNode(name, typeParameters.map(function (id) { return ts.createTypeReferenceNode(id.name, /* typeArguments */ undefined); })));
+ }
+ })(refactor = ts.refactor || (ts.refactor = {}));
+})(ts || (ts = {}));
+/* @internal */
+var ts;
+(function (ts) {
+ var refactor;
+ (function (refactor) {
var generateGetAccessorAndSetAccessor;
(function (generateGetAccessorAndSetAccessor) {
var actionName = "Generate 'get' and 'set' accessors";
@@ -118758,10 +119867,10 @@
var modifierFlags = ts.getModifierFlags(declaration) & ~64 /* Readonly */;
var accessorModifiers = isInClassLike
? !modifierFlags || modifierFlags & 8 /* Private */
- ? getModifiers(isJS, isStatic, 115 /* PublicKeyword */)
+ ? getModifiers(isJS, isStatic, 116 /* PublicKeyword */)
: ts.createNodeArray(ts.createModifiersFromModifierFlags(modifierFlags))
: undefined;
- var fieldModifiers = isInClassLike ? getModifiers(isJS, isStatic, 113 /* PrivateKeyword */) : undefined;
+ var fieldModifiers = isInClassLike ? getModifiers(isJS, isStatic, 114 /* PrivateKeyword */) : undefined;
updateFieldDeclaration(changeTracker, file, declaration, fieldName, fieldModifiers);
var getAccessor = generateGetAccessor(fieldName, accessorName, type, accessorModifiers, isStatic, container);
ts.suppressLeadingAndTrailingTrivia(getAccessor);
@@ -118799,7 +119908,7 @@
return ts.isIdentifier(fieldName) ? ts.createPropertyAccess(leftHead, fieldName) : ts.createElementAccess(leftHead, ts.createLiteral(fieldName));
}
function getModifiers(isJS, isStatic, accessModifier) {
- var modifiers = ts.append(!isJS ? [ts.createToken(accessModifier)] : undefined, isStatic ? ts.createToken(116 /* StaticKeyword */) : undefined);
+ var modifiers = ts.append(!isJS ? [ts.createToken(accessModifier)] : undefined, isStatic ? ts.createToken(117 /* StaticKeyword */) : undefined);
return modifiers && ts.createNodeArray(modifiers);
}
function startsWithUnderscore(name) {
@@ -118822,7 +119931,7 @@
isStatic: ts.hasStaticModifier(declaration),
isReadonly: ts.hasReadonlyModifier(declaration),
type: ts.getTypeAnnotationNode(declaration),
- container: declaration.kind === 151 /* Parameter */ ? declaration.parent.parent : declaration.parent,
+ container: declaration.kind === 152 /* Parameter */ ? declaration.parent.parent : declaration.parent,
originalName: declaration.name.text,
declaration: declaration,
fieldName: fieldName,
@@ -118879,13 +119988,13 @@
return;
constructor.body.forEachChild(function recur(node) {
if (ts.isElementAccessExpression(node) &&
- node.expression.kind === 100 /* ThisKeyword */ &&
+ node.expression.kind === 101 /* ThisKeyword */ &&
ts.isStringLiteral(node.argumentExpression) &&
node.argumentExpression.text === originalName &&
ts.isWriteAccess(node)) {
changeTracker.replaceNode(file, node.argumentExpression, ts.createStringLiteral(fieldName));
}
- if (ts.isPropertyAccessExpression(node) && node.expression.kind === 100 /* ThisKeyword */ && node.name.text === originalName && ts.isWriteAccess(node)) {
+ if (ts.isPropertyAccessExpression(node) && node.expression.kind === 101 /* ThisKeyword */ && node.name.text === originalName && ts.isWriteAccess(node)) {
changeTracker.replaceNode(file, node.name, ts.createIdentifier(fieldName));
}
if (!ts.isFunctionLike(node) && !ts.isClassLike(node)) {
@@ -118967,11 +120076,11 @@
}
function isPureImport(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return true;
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return !ts.hasModifier(node, 1 /* Export */);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return node.declarationList.declarations.every(function (d) { return !!d.initializer && ts.isRequireCall(d.initializer, /*checkArgumentIsStringLiteralLike*/ true); });
default:
return false;
@@ -119059,19 +120168,19 @@
}
function getNamespaceLikeImport(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
- return node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 251 /* NamespaceImport */ ?
+ case 250 /* ImportDeclaration */:
+ return node.importClause && node.importClause.namedBindings && node.importClause.namedBindings.kind === 252 /* NamespaceImport */ ?
node.importClause.namedBindings.name : undefined;
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return node.name;
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return ts.tryCast(node.name, ts.isIdentifier);
default:
return ts.Debug.assertNever(node);
}
}
function updateNamespaceLikeImport(changes, sourceFile, checker, movedSymbols, newModuleName, newModuleSpecifier, oldImportId, oldImportNode) {
- var preferredNewNamespaceName = ts.codefix.moduleSpecifierToValidIdentifier(newModuleName, 7 /* ESNext */);
+ var preferredNewNamespaceName = ts.codefix.moduleSpecifierToValidIdentifier(newModuleName, 8 /* ESNext */);
var needUniqueName = false;
var toChange = [];
ts.FindAllReferences.Core.eachSymbolReferenceInFile(oldImportId, checker, sourceFile, function (ref) {
@@ -119095,20 +120204,20 @@
var newNamespaceId = ts.createIdentifier(newNamespaceName);
var newModuleString = ts.createLiteral(newModuleSpecifier);
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return ts.createImportDeclaration(
/*decorators*/ undefined, /*modifiers*/ undefined, ts.createImportClause(/*name*/ undefined, ts.createNamespaceImport(newNamespaceId)), newModuleString);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return ts.createImportEqualsDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, newNamespaceId, ts.createExternalModuleReference(newModuleString));
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return ts.createVariableDeclaration(newNamespaceId, /*type*/ undefined, createRequireCall(newModuleString));
default:
return ts.Debug.assertNever(node);
}
}
function moduleSpecifierFromImport(i) {
- return (i.kind === 249 /* ImportDeclaration */ ? i.moduleSpecifier
- : i.kind === 248 /* ImportEqualsDeclaration */ ? i.moduleReference.expression
+ return (i.kind === 250 /* ImportDeclaration */ ? i.moduleSpecifier
+ : i.kind === 249 /* ImportEqualsDeclaration */ ? i.moduleReference.expression
: i.initializer.arguments[0]);
}
function forEachImportInStatement(statement, cb) {
@@ -119178,15 +120287,15 @@
}
function deleteUnusedImports(sourceFile, importDecl, changes, isUnused) {
switch (importDecl.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
deleteUnusedImportsInDeclaration(sourceFile, importDecl, changes, isUnused);
break;
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
if (isUnused(importDecl.name)) {
changes.delete(sourceFile, importDecl);
}
break;
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
deleteUnusedImportsInVariableDeclaration(sourceFile, importDecl, changes, isUnused);
break;
default:
@@ -119199,7 +120308,7 @@
var _a = importDecl.importClause, name = _a.name, namedBindings = _a.namedBindings;
var defaultUnused = !name || isUnused(name);
var namedBindingsUnused = !namedBindings ||
- (namedBindings.kind === 251 /* NamespaceImport */ ? isUnused(namedBindings.name) : namedBindings.elements.length !== 0 && namedBindings.elements.every(function (e) { return isUnused(e.name); }));
+ (namedBindings.kind === 252 /* NamespaceImport */ ? isUnused(namedBindings.name) : namedBindings.elements.length !== 0 && namedBindings.elements.every(function (e) { return isUnused(e.name); }));
if (defaultUnused && namedBindingsUnused) {
changes.delete(sourceFile, importDecl);
}
@@ -119211,7 +120320,7 @@
if (namedBindingsUnused) {
changes.delete(sourceFile, namedBindings);
}
- else if (namedBindings.kind === 252 /* NamedImports */) {
+ else if (namedBindings.kind === 253 /* NamedImports */) {
for (var _i = 0, _b = namedBindings.elements; _i < _b.length; _i++) {
var element = _b[_i];
if (isUnused(element.name))
@@ -119224,14 +120333,14 @@
function deleteUnusedImportsInVariableDeclaration(sourceFile, varDecl, changes, isUnused) {
var name = varDecl.name;
switch (name.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
if (isUnused(name)) {
changes.delete(sourceFile, name);
}
break;
- case 185 /* ArrayBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
break;
- case 184 /* ObjectBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
if (name.elements.every(function (e) { return ts.isIdentifier(e.name) && isUnused(e.name); })) {
changes.delete(sourceFile, ts.isVariableDeclarationList(varDecl.parent) && varDecl.parent.declarations.length === 1 ? varDecl.parent.parent : varDecl);
}
@@ -119358,13 +120467,13 @@
// Below should all be utilities
function isInImport(decl) {
switch (decl.kind) {
- case 248 /* ImportEqualsDeclaration */:
- case 253 /* ImportSpecifier */:
- case 250 /* ImportClause */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 254 /* ImportSpecifier */:
+ case 251 /* ImportClause */:
return true;
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return isVariableDeclarationInImport(decl);
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return ts.isVariableDeclaration(decl.parent.parent) && isVariableDeclarationInImport(decl.parent.parent);
default:
return false;
@@ -119376,7 +120485,7 @@
}
function filterImport(i, moduleSpecifier, keep) {
switch (i.kind) {
- case 249 /* ImportDeclaration */: {
+ case 250 /* ImportDeclaration */: {
var clause = i.importClause;
if (!clause)
return undefined;
@@ -119386,9 +120495,9 @@
? ts.createImportDeclaration(/*decorators*/ undefined, /*modifiers*/ undefined, ts.createImportClause(defaultImport, namedBindings), moduleSpecifier)
: undefined;
}
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return keep(i.name) ? i : undefined;
- case 237 /* VariableDeclaration */: {
+ case 238 /* VariableDeclaration */: {
var name = filterBindingName(i.name, keep);
return name ? makeVariableStatement(name, i.type, createRequireCall(moduleSpecifier), i.parent.flags) : undefined;
}
@@ -119397,7 +120506,7 @@
}
}
function filterNamedBindings(namedBindings, keep) {
- if (namedBindings.kind === 251 /* NamespaceImport */) {
+ if (namedBindings.kind === 252 /* NamespaceImport */) {
return keep(namedBindings.name) ? namedBindings : undefined;
}
else {
@@ -119407,11 +120516,11 @@
}
function filterBindingName(name, keep) {
switch (name.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return keep(name) ? name : undefined;
- case 185 /* ArrayBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
return name;
- case 184 /* ObjectBindingPattern */: {
+ case 185 /* ObjectBindingPattern */: {
// We can't handle nested destructurings or property names well here, so just copy them all.
var newElements = name.elements.filter(function (prop) { return prop.propertyName || !ts.isIdentifier(prop.name) || keep(prop.name); });
return newElements.length ? ts.createObjectBindingPattern(newElements) : undefined;
@@ -119468,13 +120577,13 @@
}
function isNonVariableTopLevelDeclaration(node) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 240 /* ClassDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 243 /* EnumDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return true;
default:
return false;
@@ -119482,17 +120591,17 @@
}
function forEachTopLevelDeclaration(statement, cb) {
switch (statement.kind) {
- case 239 /* FunctionDeclaration */:
- case 240 /* ClassDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 243 /* EnumDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return cb(statement);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return ts.firstDefined(statement.declarationList.declarations, function (decl) { return forEachTopLevelDeclarationInBindingName(decl.name, cb); });
- case 221 /* ExpressionStatement */: {
+ case 222 /* ExpressionStatement */: {
var expression = statement.expression;
return ts.isBinaryExpression(expression) && ts.getAssignmentDeclarationKind(expression) === 1 /* ExportsProperty */
? cb(statement)
@@ -119502,10 +120611,10 @@
}
function forEachTopLevelDeclarationInBindingName(name, cb) {
switch (name.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return cb(ts.cast(name.parent, function (x) { return ts.isVariableDeclaration(x) || ts.isBindingElement(x); }));
- case 185 /* ArrayBindingPattern */:
- case 184 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
return ts.firstDefined(name.elements, function (em) { return ts.isOmittedExpression(em) ? undefined : forEachTopLevelDeclarationInBindingName(em.name, cb); });
default:
return ts.Debug.assertNever(name);
@@ -119516,9 +120625,9 @@
}
function getTopLevelDeclarationStatement(d) {
switch (d.kind) {
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return d.parent.parent;
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return getTopLevelDeclarationStatement(ts.cast(d.parent.parent, function (p) { return ts.isVariableDeclaration(p) || ts.isBindingElement(p); }));
default:
return d;
@@ -119549,25 +120658,25 @@
return useEs6Exports ? [addEs6Export(decl)] : addCommonjsExport(decl);
}
function addEs6Export(d) {
- var modifiers = ts.concatenate([ts.createModifier(85 /* ExportKeyword */)], d.modifiers);
+ var modifiers = ts.concatenate([ts.createModifier(86 /* ExportKeyword */)], d.modifiers);
switch (d.kind) {
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return ts.updateFunctionDeclaration(d, d.decorators, modifiers, d.asteriskToken, d.name, d.typeParameters, d.parameters, d.type, d.body);
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return ts.updateClassDeclaration(d, d.decorators, modifiers, d.name, d.typeParameters, d.heritageClauses, d.members);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return ts.updateVariableStatement(d, modifiers, d.declarationList);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return ts.updateModuleDeclaration(d, d.decorators, modifiers, d.name, d.body);
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return ts.updateEnumDeclaration(d, d.decorators, modifiers, d.name, d.members);
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return ts.updateTypeAliasDeclaration(d, d.decorators, modifiers, d.name, d.typeParameters, d.type);
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
return ts.updateInterfaceDeclaration(d, d.decorators, modifiers, d.name, d.typeParameters, d.heritageClauses, d.members);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return ts.updateImportEqualsDeclaration(d, d.decorators, modifiers, d.name, d.moduleReference);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return ts.Debug.fail(); // Shouldn't try to add 'export' keyword to `exports.x = ...`
default:
return ts.Debug.assertNever(d);
@@ -119578,18 +120687,18 @@
}
function getNamesToExportInCommonJS(decl) {
switch (decl.kind) {
- case 239 /* FunctionDeclaration */:
- case 240 /* ClassDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
return [decl.name.text]; // TODO: GH#18217
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return ts.mapDefined(decl.declarationList.declarations, function (d) { return ts.isIdentifier(d.name) ? d.name.text : undefined; });
- case 244 /* ModuleDeclaration */:
- case 243 /* EnumDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return ts.emptyArray;
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return ts.Debug.fail(); // Shouldn't try to add 'export' keyword to `exports.x = ...`
default:
return ts.Debug.assertNever(decl);
@@ -119597,7 +120706,7 @@
}
/** Creates `exports.x = x;` */
function createExportAssignment(name) {
- return ts.createExpressionStatement(ts.createBinary(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.createIdentifier(name)), 59 /* EqualsToken */, ts.createIdentifier(name)));
+ return ts.createExpressionStatement(ts.createBinary(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.createIdentifier(name)), 60 /* EqualsToken */, ts.createIdentifier(name)));
}
})(refactor = ts.refactor || (ts.refactor = {}));
})(ts || (ts = {}));
@@ -119763,8 +120872,8 @@
function groupReferences(referenceEntries) {
var classReferences = { accessExpressions: [], typeUsages: [] };
var groupedReferences = { functionCalls: [], declarations: [], classReferences: classReferences, valid: true };
- var functionSymbols = ts.map(functionNames, checker.getSymbolAtLocation);
- var classSymbols = ts.map(classNames, checker.getSymbolAtLocation);
+ var functionSymbols = ts.map(functionNames, getSymbolTargetAtLocation);
+ var classSymbols = ts.map(classNames, getSymbolTargetAtLocation);
var isConstructor = ts.isConstructorDeclaration(functionDeclaration);
for (var _i = 0, referenceEntries_1 = referenceEntries; _i < referenceEntries_1.length; _i++) {
var entry = referenceEntries_1[_i];
@@ -119783,7 +120892,11 @@
So we need to add a special case for this because when calling a constructor of a class through one of its subclasses,
the symbols are going to be different.
*/
- if (ts.contains(functionSymbols, checker.getSymbolAtLocation(entry.node), symbolComparer) || ts.isNewExpressionTarget(entry.node)) {
+ if (ts.contains(functionSymbols, getSymbolTargetAtLocation(entry.node)) || ts.isNewExpressionTarget(entry.node)) {
+ var importOrExportReference = entryToImportOrExport(entry);
+ if (importOrExportReference) {
+ continue;
+ }
var decl = entryToDeclaration(entry);
if (decl) {
groupedReferences.declarations.push(decl);
@@ -119796,7 +120909,11 @@
}
}
// if the refactored function is a constructor, we must also check if the references to its class are valid
- if (isConstructor && ts.contains(classSymbols, checker.getSymbolAtLocation(entry.node), symbolComparer)) {
+ if (isConstructor && ts.contains(classSymbols, getSymbolTargetAtLocation(entry.node))) {
+ var importOrExportReference = entryToImportOrExport(entry);
+ if (importOrExportReference) {
+ continue;
+ }
var decl = entryToDeclaration(entry);
if (decl) {
groupedReferences.declarations.push(decl);
@@ -119821,9 +120938,23 @@
}
return groupedReferences;
}
+ function getSymbolTargetAtLocation(node) {
+ var symbol = checker.getSymbolAtLocation(node);
+ return symbol && ts.getSymbolTarget(symbol, checker);
+ }
}
- function symbolComparer(a, b) {
- return ts.getSymbolTarget(a) === ts.getSymbolTarget(b);
+ function entryToImportOrExport(entry) {
+ var node = entry.node;
+ if (ts.isImportSpecifier(node.parent)
+ || ts.isImportClause(node.parent)
+ || ts.isImportEqualsDeclaration(node.parent)
+ || ts.isNamespaceImport(node.parent)) {
+ return node;
+ }
+ if (ts.isExportSpecifier(node.parent) || ts.isExportAssignment(node.parent)) {
+ return node;
+ }
+ return undefined;
}
function entryToDeclaration(entry) {
if (ts.isDeclaration(entry.node.parent)) {
@@ -119836,37 +120967,31 @@
var functionReference = entry.node;
var parent = functionReference.parent;
switch (parent.kind) {
- // Function call (foo(...) or super(...))
- case 191 /* CallExpression */:
- var callExpression = ts.tryCast(parent, ts.isCallExpression);
- if (callExpression && callExpression.expression === functionReference) {
- return callExpression;
- }
- break;
- // Constructor call (new Foo(...))
- case 192 /* NewExpression */:
- var newExpression = ts.tryCast(parent, ts.isNewExpression);
- if (newExpression && newExpression.expression === functionReference) {
- return newExpression;
+ // foo(...) or super(...) or new Foo(...)
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
+ var callOrNewExpression = ts.tryCast(parent, ts.isCallOrNewExpression);
+ if (callOrNewExpression && callOrNewExpression.expression === functionReference) {
+ return callOrNewExpression;
}
break;
- // Method call (x.foo(...))
- case 189 /* PropertyAccessExpression */:
+ // x.foo(...)
+ case 190 /* PropertyAccessExpression */:
var propertyAccessExpression = ts.tryCast(parent, ts.isPropertyAccessExpression);
if (propertyAccessExpression && propertyAccessExpression.parent && propertyAccessExpression.name === functionReference) {
- var callExpression_1 = ts.tryCast(propertyAccessExpression.parent, ts.isCallExpression);
- if (callExpression_1 && callExpression_1.expression === propertyAccessExpression) {
- return callExpression_1;
+ var callOrNewExpression_1 = ts.tryCast(propertyAccessExpression.parent, ts.isCallOrNewExpression);
+ if (callOrNewExpression_1 && callOrNewExpression_1.expression === propertyAccessExpression) {
+ return callOrNewExpression_1;
}
}
break;
- // Method call (x["foo"](...))
- case 190 /* ElementAccessExpression */:
+ // x["foo"](...)
+ case 191 /* ElementAccessExpression */:
var elementAccessExpression = ts.tryCast(parent, ts.isElementAccessExpression);
if (elementAccessExpression && elementAccessExpression.parent && elementAccessExpression.argumentExpression === functionReference) {
- var callExpression_2 = ts.tryCast(elementAccessExpression.parent, ts.isCallExpression);
- if (callExpression_2 && callExpression_2.expression === elementAccessExpression) {
- return callExpression_2;
+ var callOrNewExpression_2 = ts.tryCast(elementAccessExpression.parent, ts.isCallOrNewExpression);
+ if (callOrNewExpression_2 && callOrNewExpression_2.expression === elementAccessExpression) {
+ return callOrNewExpression_2;
}
}
break;
@@ -119880,14 +121005,14 @@
var parent = reference.parent;
switch (parent.kind) {
// `C.foo`
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
var propertyAccessExpression = ts.tryCast(parent, ts.isPropertyAccessExpression);
if (propertyAccessExpression && propertyAccessExpression.expression === reference) {
return propertyAccessExpression;
}
break;
// `C["foo"]`
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
var elementAccessExpression = ts.tryCast(parent, ts.isElementAccessExpression);
if (elementAccessExpression && elementAccessExpression.expression === reference) {
return elementAccessExpression;
@@ -119906,7 +121031,7 @@
}
function getFunctionDeclarationAtPosition(file, startPosition, checker) {
var node = ts.getTouchingToken(file, startPosition);
- var functionDeclaration = ts.getContainingFunction(node);
+ var functionDeclaration = ts.getContainingFunctionDeclaration(node);
// don't offer refactor on top-level JSDoc
if (isTopLevelJSDoc(node))
return undefined;
@@ -119929,28 +121054,34 @@
if (!isValidParameterNodeArray(functionDeclaration.parameters, checker))
return false;
switch (functionDeclaration.kind) {
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
- return !!functionDeclaration.name
- && !!functionDeclaration.body
- && !checker.isImplementationOfOverload(functionDeclaration);
- case 157 /* Constructor */:
+ case 240 /* FunctionDeclaration */:
+ return hasNameOrDefault(functionDeclaration) && isSingleImplementation(functionDeclaration, checker);
+ case 157 /* MethodDeclaration */:
+ return isSingleImplementation(functionDeclaration, checker);
+ case 158 /* Constructor */:
if (ts.isClassDeclaration(functionDeclaration.parent)) {
- return !!functionDeclaration.body
- && !!functionDeclaration.parent.name
- && !checker.isImplementationOfOverload(functionDeclaration);
+ return hasNameOrDefault(functionDeclaration.parent) && isSingleImplementation(functionDeclaration, checker);
}
else {
return isValidVariableDeclaration(functionDeclaration.parent.parent)
- && !!functionDeclaration.body
- && !checker.isImplementationOfOverload(functionDeclaration);
+ && isSingleImplementation(functionDeclaration, checker);
}
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return isValidVariableDeclaration(functionDeclaration.parent);
}
return false;
}
+ function isSingleImplementation(functionDeclaration, checker) {
+ return !!functionDeclaration.body && !checker.isImplementationOfOverload(functionDeclaration);
+ }
+ function hasNameOrDefault(functionOrClassDeclaration) {
+ if (!functionOrClassDeclaration.name) {
+ var defaultKeyword = ts.findModifier(functionOrClassDeclaration, 81 /* DefaultKeyword */);
+ return !!defaultKeyword;
+ }
+ return true;
+ }
function isValidParameterNodeArray(parameters, checker) {
return getRefactorableParametersLength(parameters) >= minimumParameterLength
&& ts.every(parameters, /*callback*/ function (/*callback*/ paramDecl) { return isValidParameterDeclaration(paramDecl, checker); });
@@ -120107,10 +121238,15 @@
}
function getClassNames(constructorDeclaration) {
switch (constructorDeclaration.parent.kind) {
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
var classDeclaration = constructorDeclaration.parent;
+ if (classDeclaration.name)
return [classDeclaration.name];
- case 209 /* ClassExpression */:
+ // If the class declaration doesn't have a name, it should have a default modifier.
+ // We validated this in `isValidFunctionDeclaration` through `hasNameOrDefault`
+ var defaultModifier = ts.Debug.assertDefined(ts.findModifier(classDeclaration, 81 /* DefaultKeyword */), "Nameless class declaration should be a default export");
+ return [defaultModifier];
+ case 210 /* ClassExpression */:
var classExpression = constructorDeclaration.parent;
var variableDeclaration = constructorDeclaration.parent.parent;
var className = classExpression.name;
@@ -120121,19 +121257,25 @@
}
function getFunctionNames(functionDeclaration) {
switch (functionDeclaration.kind) {
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ if (functionDeclaration.name)
return [functionDeclaration.name];
- case 157 /* Constructor */:
- var ctrKeyword = ts.findChildOfKind(functionDeclaration, 124 /* ConstructorKeyword */, functionDeclaration.getSourceFile());
- if (functionDeclaration.parent.kind === 209 /* ClassExpression */) {
+ // If the function declaration doesn't have a name, it should have a default modifier.
+ // We validated this in `isValidFunctionDeclaration` through `hasNameOrDefault`
+ var defaultModifier = ts.Debug.assertDefined(ts.findModifier(functionDeclaration, 81 /* DefaultKeyword */), "Nameless function declaration should be a default export");
+ return [defaultModifier];
+ case 157 /* MethodDeclaration */:
+ return [functionDeclaration.name];
+ case 158 /* Constructor */:
+ var ctrKeyword = ts.Debug.assertDefined(ts.findChildOfKind(functionDeclaration, 125 /* ConstructorKeyword */, functionDeclaration.getSourceFile()), "Constructor declaration should have constructor keyword");
+ if (functionDeclaration.parent.kind === 210 /* ClassExpression */) {
var variableDeclaration = functionDeclaration.parent.parent;
return [variableDeclaration.name, ctrKeyword];
}
return [ctrKeyword];
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return [functionDeclaration.parent.name];
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
if (functionDeclaration.name)
return [functionDeclaration.name, functionDeclaration.parent.name];
return [functionDeclaration.parent.name];
@@ -120150,7 +121292,7 @@
ts.servicesVersion = "0.8";
function createNode(kind, pos, end, parent) {
var node = ts.isNodeKind(kind) ? new NodeObject(kind, pos, end) :
- kind === 72 /* Identifier */ ? new IdentifierObject(72 /* Identifier */, pos, end) :
+ kind === 73 /* Identifier */ ? new IdentifierObject(73 /* Identifier */, pos, end) :
new TokenObject(kind, pos, end);
node.parent = parent;
node.flags = parent.flags & 12679168 /* ContextFlags */;
@@ -120224,8 +121366,8 @@
if (!children.length) {
return undefined;
}
- var child = ts.find(children, function (kid) { return kid.kind < 288 /* FirstJSDocNode */ || kid.kind > 310 /* LastJSDocNode */; });
- return child.kind < 148 /* FirstNode */ ?
+ var child = ts.find(children, function (kid) { return kid.kind < 289 /* FirstJSDocNode */ || kid.kind > 311 /* LastJSDocNode */; });
+ return child.kind < 149 /* FirstNode */ ?
child :
child.getFirstToken(sourceFile);
};
@@ -120236,7 +121378,7 @@
if (!child) {
return undefined;
}
- return child.kind < 148 /* FirstNode */ ? child : child.getLastToken(sourceFile);
+ return child.kind < 149 /* FirstNode */ ? child : child.getLastToken(sourceFile);
};
NodeObject.prototype.forEachChild = function (cbNode, cbNodeArray) {
return ts.forEachChild(this, cbNode, cbNodeArray);
@@ -120282,8 +121424,8 @@
var token = ts.scanner.scan();
var textPos = ts.scanner.getTextPos();
if (textPos <= end) {
- if (token === 72 /* Identifier */) {
- ts.Debug.fail("Did not expect " + ts.Debug.showSyntaxKind(parent) + " to have an Identifier in its trivia");
+ if (token === 73 /* Identifier */) {
+ ts.Debug.fail("Did not expect " + ts.Debug.formatSyntaxKind(parent.kind) + " to have an Identifier in its trivia");
}
nodes.push(createNode(token, pos, textPos, parent));
}
@@ -120294,7 +121436,7 @@
}
}
function createSyntaxList(nodes, parent) {
- var list = createNode(311 /* SyntaxList */, nodes.pos, nodes.end, parent);
+ var list = createNode(312 /* SyntaxList */, nodes.pos, nodes.end, parent);
list._children = [];
var pos = nodes.pos;
for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
@@ -120428,7 +121570,7 @@
});
return IdentifierObject;
}(TokenOrIdentifierObject));
- IdentifierObject.prototype.kind = 72 /* Identifier */;
+ IdentifierObject.prototype.kind = 73 /* Identifier */;
var TypeObject = /** @class */ (function () {
function TypeObject(checker, flags) {
this.checker = checker;
@@ -120629,10 +121771,10 @@
}
function visit(node) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
var functionDeclaration = node;
var declarationName = getDeclarationName(functionDeclaration);
if (declarationName) {
@@ -120652,31 +121794,31 @@
}
ts.forEachChild(node, visit);
break;
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 243 /* EnumDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
- case 257 /* ExportSpecifier */:
- case 253 /* ImportSpecifier */:
- case 250 /* ImportClause */:
- case 251 /* NamespaceImport */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 168 /* TypeLiteral */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 258 /* ExportSpecifier */:
+ case 254 /* ImportSpecifier */:
+ case 251 /* ImportClause */:
+ case 252 /* NamespaceImport */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 169 /* TypeLiteral */:
addDeclaration(node);
ts.forEachChild(node, visit);
break;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
// Only consider parameter properties
if (!ts.hasModifier(node, 92 /* ParameterPropertyModifier */)) {
break;
}
// falls through
- case 237 /* VariableDeclaration */:
- case 186 /* BindingElement */: {
+ case 238 /* VariableDeclaration */:
+ case 187 /* BindingElement */: {
var decl = node;
if (ts.isBindingPattern(decl.name)) {
ts.forEachChild(decl.name, visit);
@@ -120687,19 +121829,19 @@
}
}
// falls through
- case 278 /* EnumMember */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 279 /* EnumMember */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
addDeclaration(node);
break;
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
// Handle named exports case e.g.:
// export {a, b as B} from "mod";
if (node.exportClause) {
ts.forEach(node.exportClause.elements, visit);
}
break;
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
var importClause = node.importClause;
if (importClause) {
// Handle default import case e.g.:
@@ -120711,7 +121853,7 @@
// import * as NS from "mod";
// import {a, b as B} from "mod";
if (importClause.namedBindings) {
- if (importClause.namedBindings.kind === 251 /* NamespaceImport */) {
+ if (importClause.namedBindings.kind === 252 /* NamespaceImport */) {
addDeclaration(importClause.namedBindings);
}
else {
@@ -120720,7 +121862,7 @@
}
}
break;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
if (ts.getAssignmentDeclarationKind(node) !== 0 /* None */) {
addDeclaration(node);
}
@@ -120889,7 +122031,7 @@
var sourceFile;
if (this.currentFileName !== fileName) {
// This is a new file, just parse it
- sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 7 /* Latest */, version, /*setNodeParents*/ true, scriptKind);
+ sourceFile = createLanguageServiceSourceFile(fileName, scriptSnapshot, 8 /* Latest */, version, /*setNodeParents*/ true, scriptKind);
}
else if (this.currentFileVersion !== version) {
// This is the same file, just a newer version. Incrementally parse the file.
@@ -121293,41 +122435,48 @@
return undefined;
}
var typeChecker = program.getTypeChecker();
- var symbol = getSymbolAtLocationForQuickInfo(node, typeChecker);
+ var nodeForQuickInfo = getNodeForQuickInfo(node);
+ var symbol = getSymbolAtLocationForQuickInfo(nodeForQuickInfo, typeChecker);
if (!symbol || typeChecker.isUnknownSymbol(symbol)) {
- var type_2 = shouldGetType(sourceFile, node, position) ? typeChecker.getTypeAtLocation(node) : undefined;
+ var type_2 = shouldGetType(sourceFile, nodeForQuickInfo, position) ? typeChecker.getTypeAtLocation(nodeForQuickInfo) : undefined;
return type_2 && {
kind: "" /* unknown */,
kindModifiers: "" /* none */,
- textSpan: ts.createTextSpanFromNode(node, sourceFile),
- displayParts: typeChecker.runWithCancellationToken(cancellationToken, function (typeChecker) { return ts.typeToDisplayParts(typeChecker, type_2, ts.getContainerNode(node)); }),
+ textSpan: ts.createTextSpanFromNode(nodeForQuickInfo, sourceFile),
+ displayParts: typeChecker.runWithCancellationToken(cancellationToken, function (typeChecker) { return ts.typeToDisplayParts(typeChecker, type_2, ts.getContainerNode(nodeForQuickInfo)); }),
documentation: type_2.symbol ? type_2.symbol.getDocumentationComment(typeChecker) : undefined,
tags: type_2.symbol ? type_2.symbol.getJsDocTags() : undefined
};
}
var _a = typeChecker.runWithCancellationToken(cancellationToken, function (typeChecker) {
- return ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, ts.getContainerNode(node), node);
+ return ts.SymbolDisplay.getSymbolDisplayPartsDocumentationAndSymbolKind(typeChecker, symbol, sourceFile, ts.getContainerNode(nodeForQuickInfo), nodeForQuickInfo);
}), symbolKind = _a.symbolKind, displayParts = _a.displayParts, documentation = _a.documentation, tags = _a.tags;
return {
kind: symbolKind,
kindModifiers: ts.SymbolDisplay.getSymbolModifiers(symbol),
- textSpan: ts.createTextSpanFromNode(node, sourceFile),
+ textSpan: ts.createTextSpanFromNode(nodeForQuickInfo, sourceFile),
displayParts: displayParts,
documentation: documentation,
tags: tags,
};
}
+ function getNodeForQuickInfo(node) {
+ if (ts.isNewExpression(node.parent) && node.pos === node.parent.pos) {
+ return node.parent.expression;
+ }
+ return node;
+ }
function shouldGetType(sourceFile, node, position) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return !ts.isLabelName(node) && !ts.isTagName(node);
- case 189 /* PropertyAccessExpression */:
- case 148 /* QualifiedName */:
+ case 190 /* PropertyAccessExpression */:
+ case 149 /* QualifiedName */:
// Don't return quickInfo if inside the comment in `a/**/.b`
return !ts.isInComment(sourceFile, position);
- case 100 /* ThisKeyword */:
- case 178 /* ThisType */:
- case 98 /* SuperKeyword */:
+ case 101 /* ThisKeyword */:
+ case 179 /* ThisType */:
+ case 99 /* SuperKeyword */:
return true;
default:
return false;
@@ -121434,16 +122583,16 @@
return undefined;
}
switch (node.kind) {
- case 189 /* PropertyAccessExpression */:
- case 148 /* QualifiedName */:
+ case 190 /* PropertyAccessExpression */:
+ case 149 /* QualifiedName */:
case 10 /* StringLiteral */:
- case 87 /* FalseKeyword */:
- case 102 /* TrueKeyword */:
- case 96 /* NullKeyword */:
- case 98 /* SuperKeyword */:
- case 100 /* ThisKeyword */:
- case 178 /* ThisType */:
- case 72 /* Identifier */:
+ case 88 /* FalseKeyword */:
+ case 103 /* TrueKeyword */:
+ case 97 /* NullKeyword */:
+ case 99 /* SuperKeyword */:
+ case 101 /* ThisKeyword */:
+ case 179 /* ThisType */:
+ case 73 /* Identifier */:
break;
// Cant create the text span
default:
@@ -121459,7 +122608,7 @@
// If this is name of a module declarations, check if this is right side of dotted module name
// If parent of the module declaration which is parent of this node is module declaration and its body is the module declaration that this node is name of
// Then this name is name from dotted module
- if (nodeForStartPos.parent.parent.kind === 244 /* ModuleDeclaration */ &&
+ if (nodeForStartPos.parent.parent.kind === 245 /* ModuleDeclaration */ &&
nodeForStartPos.parent.parent.body === nodeForStartPos.parent) {
// Use parent module declarations name for start pos
nodeForStartPos = nodeForStartPos.parent.parent.name;
@@ -121602,30 +122751,14 @@
}
function applyCodeActionCommand(fileName, actionOrFormatSettingsOrUndefined) {
var action = typeof fileName === "string" ? actionOrFormatSettingsOrUndefined : fileName;
- var formatSettings = typeof fileName !== "string" ? actionOrFormatSettingsOrUndefined : undefined;
- return ts.isArray(action) ? Promise.all(action.map(function (a) { return applySingleCodeActionCommand(a, formatSettings); })) : applySingleCodeActionCommand(action, formatSettings);
+ return ts.isArray(action) ? Promise.all(action.map(function (a) { return applySingleCodeActionCommand(a); })) : applySingleCodeActionCommand(action);
}
- function applySingleCodeActionCommand(action, formatSettings) {
+ function applySingleCodeActionCommand(action) {
var getPath = function (path) { return ts.toPath(path, currentDirectory, getCanonicalFileName); };
- switch (action.type) {
- case "install package":
+ ts.Debug.assertEqual(action.type, "install package");
return host.installPackage
? host.installPackage({ fileName: getPath(action.file), packageName: action.packageName })
: Promise.reject("Host does not implement `installPackage`");
- case "generate types": {
- var fileToGenerateTypesFor = action.fileToGenerateTypesFor, outputFileName_1 = action.outputFileName;
- if (!host.inspectValue)
- return Promise.reject("Host does not implement `installPackage`");
- var valueInfoPromise = host.inspectValue({ fileNameToRequire: fileToGenerateTypesFor });
- return valueInfoPromise.then(function (valueInfo) {
- var fullOut = getPath(outputFileName_1);
- host.writeFile(fullOut, ts.valueInfoToDeclarationFileText(valueInfo, formatSettings || ts.testFormatSettings)); // TODO: GH#18217
- return { successMessage: "Wrote types to '" + fullOut + "'" };
- });
- }
- default:
- return ts.Debug.assertNever(action);
- }
}
function getDocCommentTemplateAtPosition(fileName, position) {
return ts.JsDoc.getDocCommentTemplateAtPosition(ts.getNewLineOrDefaultFromHost(host), syntaxTreeCache.getCurrentSourceFile(fileName), position);
@@ -121821,6 +122954,9 @@
preferences: preferences,
};
}
+ function getSmartSelectionRange(fileName, position) {
+ return ts.SmartSelectionRange.getSmartSelectionRange(position, syntaxTreeCache.getCurrentSourceFile(fileName));
+ }
function getApplicableRefactors(fileName, positionOrRange, preferences) {
if (preferences === void 0) { preferences = ts.emptyOptions; }
synchronizeHostData();
@@ -121861,6 +122997,7 @@
getBreakpointStatementAtPosition: getBreakpointStatementAtPosition,
getNavigateToItems: getNavigateToItems,
getRenameInfo: getRenameInfo,
+ getSmartSelectionRange: getSmartSelectionRange,
findRenameLocations: findRenameLocations,
getNavigationBarItems: getNavigationBarItems,
getNavigationTree: getNavigationTree,
@@ -121923,7 +123060,7 @@
*/
function literalIsName(node) {
return ts.isDeclarationName(node) ||
- node.parent.kind === 259 /* ExternalModuleReference */ ||
+ node.parent.kind === 260 /* ExternalModuleReference */ ||
isArgumentOfElementAccessExpression(node) ||
ts.isLiteralComputedPropertyDeclarationName(node);
}
@@ -121940,13 +123077,13 @@
switch (node.kind) {
case 10 /* StringLiteral */:
case 8 /* NumericLiteral */:
- if (node.parent.kind === 149 /* ComputedPropertyName */) {
+ if (node.parent.kind === 150 /* ComputedPropertyName */) {
return ts.isObjectLiteralElement(node.parent.parent) ? node.parent.parent : undefined;
}
// falls through
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return ts.isObjectLiteralElement(node.parent) &&
- (node.parent.parent.kind === 188 /* ObjectLiteralExpression */ || node.parent.parent.kind === 268 /* JsxAttributes */) &&
+ (node.parent.parent.kind === 189 /* ObjectLiteralExpression */ || node.parent.parent.kind === 269 /* JsxAttributes */) &&
node.parent.name === node ? node.parent : undefined;
}
return undefined;
@@ -121988,7 +123125,7 @@
function isArgumentOfElementAccessExpression(node) {
return node &&
node.parent &&
- node.parent.kind === 190 /* ElementAccessExpression */ &&
+ node.parent.kind === 191 /* ElementAccessExpression */ &&
node.parent.argumentExpression === node;
}
/**
@@ -122068,114 +123205,114 @@
if (node) {
var parent = node.parent;
switch (node.kind) {
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
// Span on first variable declaration
return spanInVariableDeclaration(node.declarationList.declarations[0]);
- case 237 /* VariableDeclaration */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 238 /* VariableDeclaration */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
return spanInVariableDeclaration(node);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return spanInParameterDeclaration(node);
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 157 /* Constructor */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 158 /* Constructor */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return spanInFunctionDeclaration(node);
- case 218 /* Block */:
+ case 219 /* Block */:
if (ts.isFunctionBlock(node)) {
return spanInFunctionBlock(node);
}
// falls through
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
return spanInBlock(node);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return spanInBlock(node.block);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
// span on the expression
return textSpan(node.expression);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
// span on return keyword and expression if present
return textSpan(node.getChildAt(0), node.expression);
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
// Span on while(...)
return textSpanEndingAtNextToken(node, node.expression);
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
// span in statement of the do statement
return spanInNode(node.statement);
- case 236 /* DebuggerStatement */:
+ case 237 /* DebuggerStatement */:
// span on debugger keyword
return textSpan(node.getChildAt(0));
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
// set on if(..) span
return textSpanEndingAtNextToken(node, node.expression);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
// span in statement
return spanInNode(node.statement);
- case 229 /* BreakStatement */:
- case 228 /* ContinueStatement */:
+ case 230 /* BreakStatement */:
+ case 229 /* ContinueStatement */:
// On break or continue keyword and label if present
return textSpan(node.getChildAt(0), node.label);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return spanInForStatement(node);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
// span of for (a in ...)
return textSpanEndingAtNextToken(node, node.expression);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
// span in initializer
return spanInInitializerOfForLike(node);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
// span on switch(...)
return textSpanEndingAtNextToken(node, node.expression);
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
// span in first statement of the clause
return spanInNode(node.statements[0]);
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
// span in try block
return spanInBlock(node.tryBlock);
- case 234 /* ThrowStatement */:
+ case 235 /* ThrowStatement */:
// span in throw ...
return textSpan(node, node.expression);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
// span on export = id
return textSpan(node, node.expression);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
// import statement without including semicolon
return textSpan(node, node.moduleReference);
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
// import statement without including semicolon
return textSpan(node, node.moduleSpecifier);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
// import statement without including semicolon
return textSpan(node, node.moduleSpecifier);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
// span on complete module if it is instantiated
if (ts.getModuleInstanceState(node) !== 1 /* Instantiated */) {
return undefined;
}
// falls through
- case 240 /* ClassDeclaration */:
- case 243 /* EnumDeclaration */:
- case 278 /* EnumMember */:
- case 186 /* BindingElement */:
+ case 241 /* ClassDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 279 /* EnumMember */:
+ case 187 /* BindingElement */:
// span on complete node
return textSpan(node);
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
// span in statement
return spanInNode(node.statement);
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
return spanInNodeArray(parent.decorators);
- case 184 /* ObjectBindingPattern */:
- case 185 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
return spanInBindingPattern(node);
// No breakpoint in interface, type alias
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return undefined;
// Tokens:
case 26 /* SemicolonToken */:
@@ -122199,13 +123336,13 @@
case 28 /* LessThanToken */:
return spanInGreaterThanOrLessThanToken(node);
// Keywords:
- case 107 /* WhileKeyword */:
+ case 108 /* WhileKeyword */:
return spanInWhileKeyword(node);
- case 83 /* ElseKeyword */:
- case 75 /* CatchKeyword */:
- case 88 /* FinallyKeyword */:
+ case 84 /* ElseKeyword */:
+ case 76 /* CatchKeyword */:
+ case 89 /* FinallyKeyword */:
return spanInNextNode(node);
- case 147 /* OfKeyword */:
+ case 148 /* OfKeyword */:
return spanInOfKeyword(node);
default:
// Destructuring pattern in destructuring assignment
@@ -122217,14 +123354,14 @@
// Set breakpoint on identifier element of destructuring pattern
// `a` or `...c` or `d: x` from
// `[a, b, ...c]` or `{ a, b }` or `{ d: x }` from destructuring pattern
- if ((node.kind === 72 /* Identifier */ ||
- node.kind === 208 /* SpreadElement */ ||
- node.kind === 275 /* PropertyAssignment */ ||
- node.kind === 276 /* ShorthandPropertyAssignment */) &&
+ if ((node.kind === 73 /* Identifier */ ||
+ node.kind === 209 /* SpreadElement */ ||
+ node.kind === 276 /* PropertyAssignment */ ||
+ node.kind === 277 /* ShorthandPropertyAssignment */) &&
ts.isArrayLiteralOrObjectLiteralDestructuringPattern(parent)) {
return textSpan(node);
}
- if (node.kind === 204 /* BinaryExpression */) {
+ if (node.kind === 205 /* BinaryExpression */) {
var _a = node, left = _a.left, operatorToken = _a.operatorToken;
// Set breakpoint in destructuring pattern if its destructuring assignment
// [a, b, c] or {a, b, c} of
@@ -122233,7 +123370,7 @@
if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(left)) {
return spanInArrayLiteralOrObjectLiteralDestructuringPattern(left);
}
- if (operatorToken.kind === 59 /* EqualsToken */ && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) {
+ if (operatorToken.kind === 60 /* EqualsToken */ && ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent)) {
// Set breakpoint on assignment expression element of destructuring pattern
// a = expression of
// [a = expression, b, c] = someExpression or
@@ -122246,22 +123383,22 @@
}
if (ts.isExpressionNode(node)) {
switch (parent.kind) {
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
// Set span as if on while keyword
return spanInPreviousNode(node);
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
// Set breakpoint on the decorator emit
return spanInNode(node.parent);
- case 225 /* ForStatement */:
- case 227 /* ForOfStatement */:
+ case 226 /* ForStatement */:
+ case 228 /* ForOfStatement */:
return textSpan(node);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
if (node.parent.operatorToken.kind === 27 /* CommaToken */) {
// If this is a comma expression, the breakpoint is possible in this expression
return textSpan(node);
}
break;
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
if (node.parent.body === node) {
// If this is body of arrow function, it is allowed to have the breakpoint
return textSpan(node);
@@ -122270,21 +123407,21 @@
}
}
switch (node.parent.kind) {
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
// If this is name of property assignment, set breakpoint in the initializer
if (node.parent.name === node &&
!ts.isArrayLiteralOrObjectLiteralDestructuringPattern(node.parent.parent)) {
return spanInNode(node.parent.initializer);
}
break;
- case 194 /* TypeAssertionExpression */:
+ case 195 /* TypeAssertionExpression */:
// Breakpoint in type assertion goes to its operand
if (node.parent.type === node) {
return spanInNextNode(node.parent.type);
}
break;
- case 237 /* VariableDeclaration */:
- case 151 /* Parameter */: {
+ case 238 /* VariableDeclaration */:
+ case 152 /* Parameter */: {
// initializer of variable/parameter declaration go to previous node
var _b = node.parent, initializer = _b.initializer, type = _b.type;
if (initializer === node || type === node || ts.isAssignmentOperator(node.kind)) {
@@ -122292,7 +123429,7 @@
}
break;
}
- case 204 /* BinaryExpression */: {
+ case 205 /* BinaryExpression */: {
var left = node.parent.left;
if (ts.isArrayLiteralOrObjectLiteralDestructuringPattern(left) && node !== left) {
// If initializer of destructuring assignment move to previous token
@@ -122322,7 +123459,7 @@
}
function spanInVariableDeclaration(variableDeclaration) {
// If declaration of for in statement, just set the span in parent
- if (variableDeclaration.parent.parent.kind === 226 /* ForInStatement */) {
+ if (variableDeclaration.parent.parent.kind === 227 /* ForInStatement */) {
return spanInNode(variableDeclaration.parent.parent);
}
var parent = variableDeclaration.parent;
@@ -122334,7 +123471,7 @@
// or its declaration from 'for of'
if (variableDeclaration.initializer ||
ts.hasModifier(variableDeclaration, 1 /* Export */) ||
- parent.parent.kind === 227 /* ForOfStatement */) {
+ parent.parent.kind === 228 /* ForOfStatement */) {
return textSpanFromVariableDeclaration(variableDeclaration);
}
if (ts.isVariableDeclarationList(variableDeclaration.parent) &&
@@ -122375,7 +123512,7 @@
}
function canFunctionHaveSpanInWholeDeclaration(functionDeclaration) {
return ts.hasModifier(functionDeclaration, 1 /* Export */) ||
- (functionDeclaration.parent.kind === 240 /* ClassDeclaration */ && functionDeclaration.kind !== 157 /* Constructor */);
+ (functionDeclaration.parent.kind === 241 /* ClassDeclaration */ && functionDeclaration.kind !== 158 /* Constructor */);
}
function spanInFunctionDeclaration(functionDeclaration) {
// No breakpoints in the function signature
@@ -122398,26 +123535,26 @@
}
function spanInBlock(block) {
switch (block.parent.kind) {
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
if (ts.getModuleInstanceState(block.parent) !== 1 /* Instantiated */) {
return undefined;
}
// falls through
// Set on parent if on same line otherwise on first statement
- case 224 /* WhileStatement */:
- case 222 /* IfStatement */:
- case 226 /* ForInStatement */:
+ case 225 /* WhileStatement */:
+ case 223 /* IfStatement */:
+ case 227 /* ForInStatement */:
return spanInNodeIfStartsOnSameLine(block.parent, block.statements[0]);
// Set span on previous token if it starts on same line otherwise on the first statement of the block
- case 225 /* ForStatement */:
- case 227 /* ForOfStatement */:
+ case 226 /* ForStatement */:
+ case 228 /* ForOfStatement */:
return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(block.pos, sourceFile, block.parent), block.statements[0]);
}
// Default action is to set on first statement
return spanInNode(block.statements[0]);
}
function spanInInitializerOfForLike(forLikeStatement) {
- if (forLikeStatement.initializer.kind === 238 /* VariableDeclarationList */) {
+ if (forLikeStatement.initializer.kind === 239 /* VariableDeclarationList */) {
// Declaration list - set breakpoint in first declaration
var variableDeclarationList = forLikeStatement.initializer;
if (variableDeclarationList.declarations.length > 0) {
@@ -122442,21 +123579,21 @@
}
function spanInBindingPattern(bindingPattern) {
// Set breakpoint in first binding element
- var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 210 /* OmittedExpression */ ? element : undefined; });
+ var firstBindingElement = ts.forEach(bindingPattern.elements, function (element) { return element.kind !== 211 /* OmittedExpression */ ? element : undefined; });
if (firstBindingElement) {
return spanInNode(firstBindingElement);
}
// Empty binding pattern of binding element, set breakpoint on binding element
- if (bindingPattern.parent.kind === 186 /* BindingElement */) {
+ if (bindingPattern.parent.kind === 187 /* BindingElement */) {
return textSpan(bindingPattern.parent);
}
// Variable declaration is used as the span
return textSpanFromVariableDeclaration(bindingPattern.parent);
}
function spanInArrayLiteralOrObjectLiteralDestructuringPattern(node) {
- ts.Debug.assert(node.kind !== 185 /* ArrayBindingPattern */ && node.kind !== 184 /* ObjectBindingPattern */);
- var elements = node.kind === 187 /* ArrayLiteralExpression */ ? node.elements : node.properties;
- var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 210 /* OmittedExpression */ ? element : undefined; });
+ ts.Debug.assert(node.kind !== 186 /* ArrayBindingPattern */ && node.kind !== 185 /* ObjectBindingPattern */);
+ var elements = node.kind === 188 /* ArrayLiteralExpression */ ? node.elements : node.properties;
+ var firstBindingElement = ts.forEach(elements, function (element) { return element.kind !== 211 /* OmittedExpression */ ? element : undefined; });
if (firstBindingElement) {
return spanInNode(firstBindingElement);
}
@@ -122464,18 +123601,18 @@
// just nested element in another destructuring assignment
// set breakpoint on assignment when parent is destructuring assignment
// Otherwise set breakpoint for this element
- return textSpan(node.parent.kind === 204 /* BinaryExpression */ ? node.parent : node);
+ return textSpan(node.parent.kind === 205 /* BinaryExpression */ ? node.parent : node);
}
// Tokens:
function spanInOpenBraceToken(node) {
switch (node.parent.kind) {
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
var enumDeclaration = node.parent;
return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), enumDeclaration.members.length ? enumDeclaration.members[0] : enumDeclaration.getLastToken(sourceFile));
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
var classDeclaration = node.parent;
return spanInNodeIfStartsOnSameLine(ts.findPrecedingToken(node.pos, sourceFile, node.parent), classDeclaration.members.length ? classDeclaration.members[0] : classDeclaration.getLastToken(sourceFile));
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
return spanInNodeIfStartsOnSameLine(node.parent.parent, node.parent.clauses[0]);
}
// Default to parent node
@@ -122483,25 +123620,25 @@
}
function spanInCloseBraceToken(node) {
switch (node.parent.kind) {
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
// If this is not an instantiated module block, no bp span
if (ts.getModuleInstanceState(node.parent.parent) !== 1 /* Instantiated */) {
return undefined;
}
// falls through
- case 243 /* EnumDeclaration */:
- case 240 /* ClassDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 241 /* ClassDeclaration */:
// Span on close brace token
return textSpan(node);
- case 218 /* Block */:
+ case 219 /* Block */:
if (ts.isFunctionBlock(node.parent)) {
// Span on close brace token
return textSpan(node);
}
// falls through
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return spanInNode(ts.lastOrUndefined(node.parent.statements));
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
// breakpoint in last statement of the last clause
var caseBlock = node.parent;
var lastClause = ts.lastOrUndefined(caseBlock.clauses);
@@ -122509,7 +123646,7 @@
return spanInNode(ts.lastOrUndefined(lastClause.statements));
}
return undefined;
- case 184 /* ObjectBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
// Breakpoint in last binding element or binding pattern if it contains no elements
var bindingPattern = node.parent;
return spanInNode(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern);
@@ -122525,7 +123662,7 @@
}
function spanInCloseBracketToken(node) {
switch (node.parent.kind) {
- case 185 /* ArrayBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
// Breakpoint in last binding element or binding pattern if it contains no elements
var bindingPattern = node.parent;
return textSpan(ts.lastOrUndefined(bindingPattern.elements) || bindingPattern);
@@ -122540,12 +123677,12 @@
}
}
function spanInOpenParenToken(node) {
- if (node.parent.kind === 223 /* DoStatement */ || // Go to while keyword and do action instead
- node.parent.kind === 191 /* CallExpression */ ||
- node.parent.kind === 192 /* NewExpression */) {
+ if (node.parent.kind === 224 /* DoStatement */ || // Go to while keyword and do action instead
+ node.parent.kind === 192 /* CallExpression */ ||
+ node.parent.kind === 193 /* NewExpression */) {
return spanInPreviousNode(node);
}
- if (node.parent.kind === 195 /* ParenthesizedExpression */) {
+ if (node.parent.kind === 196 /* ParenthesizedExpression */) {
return spanInNextNode(node);
}
// Default to parent node
@@ -122554,21 +123691,21 @@
function spanInCloseParenToken(node) {
// Is this close paren token of parameter list, set span in previous token
switch (node.parent.kind) {
- case 196 /* FunctionExpression */:
- case 239 /* FunctionDeclaration */:
- case 197 /* ArrowFunction */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 157 /* Constructor */:
- case 224 /* WhileStatement */:
- case 223 /* DoStatement */:
- case 225 /* ForStatement */:
- case 227 /* ForOfStatement */:
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
- case 195 /* ParenthesizedExpression */:
+ case 197 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
+ case 198 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 158 /* Constructor */:
+ case 225 /* WhileStatement */:
+ case 224 /* DoStatement */:
+ case 226 /* ForStatement */:
+ case 228 /* ForOfStatement */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
+ case 196 /* ParenthesizedExpression */:
return spanInPreviousNode(node);
// Default to parent node
default:
@@ -122578,20 +123715,20 @@
function spanInColonToken(node) {
// Is this : specifying return annotation of the function declaration
if (ts.isFunctionLike(node.parent) ||
- node.parent.kind === 275 /* PropertyAssignment */ ||
- node.parent.kind === 151 /* Parameter */) {
+ node.parent.kind === 276 /* PropertyAssignment */ ||
+ node.parent.kind === 152 /* Parameter */) {
return spanInPreviousNode(node);
}
return spanInNode(node.parent);
}
function spanInGreaterThanOrLessThanToken(node) {
- if (node.parent.kind === 194 /* TypeAssertionExpression */) {
+ if (node.parent.kind === 195 /* TypeAssertionExpression */) {
return spanInNextNode(node);
}
return spanInNode(node.parent);
}
function spanInWhileKeyword(node) {
- if (node.parent.kind === 223 /* DoStatement */) {
+ if (node.parent.kind === 224 /* DoStatement */) {
// Set span on while expression
return textSpanEndingAtNextToken(node, node.parent.expression);
}
@@ -122599,7 +123736,7 @@
return spanInNode(node.parent);
}
function spanInOfKeyword(node) {
- if (node.parent.kind === 227 /* ForOfStatement */) {
+ if (node.parent.kind === 228 /* ForOfStatement */) {
// Set using next token
return spanInNextNode(node);
}
@@ -123068,6 +124205,10 @@
var _this = this;
return this.forwardJSONCall("getRenameInfo('" + fileName + "', " + position + ")", function () { return _this.languageService.getRenameInfo(fileName, position, options); });
};
+ LanguageServiceShimObject.prototype.getSmartSelectionRange = function (fileName, position) {
+ var _this = this;
+ return this.forwardJSONCall("getSmartSelectionRange('" + fileName + "', " + position + ")", function () { return _this.languageService.getSmartSelectionRange(fileName, position); });
+ };
LanguageServiceShimObject.prototype.findRenameLocations = function (fileName, position, findInStrings, findInComments, providePrefixAndSuffixTextForRename) {
var _this = this;
return this.forwardJSONCall("findRenameLocations('" + fileName + "', " + position + ", " + findInStrings + ", " + findInComments + ", " + providePrefixAndSuffixTextForRename + ")", function () { return _this.languageService.findRenameLocations(fileName, position, findInStrings, findInComments, providePrefixAndSuffixTextForRename); });

lib/typingsInstaller.js

@@ -74,9 +74,9 @@
(function (ts) {
// WARNING: The script `configureNightly.ts` uses a regexp to parse out these values.
// If changing the text in this section, be sure to test `configureNightly` too.
- ts.versionMajorMinor = "3.4";
+ ts.versionMajorMinor = "3.5";
/** The version of the TypeScript compiler release */
- ts.version = ts.versionMajorMinor + ".5";
+ ts.version = ts.versionMajorMinor + ".1";
})(ts || (ts = {}));
(function (ts) {
/* @internal */
@@ -206,7 +206,7 @@
entry.nextEntry.previousEntry = previousEntry;
}
// When the deleted entry was the last one, we need to
- // adust the lastEntry reference.
+ // adjust the lastEntry reference.
if (this.lastEntry === entry) {
this.lastEntry = previousEntry;
}
@@ -316,7 +316,7 @@
ts.firstDefinedIterator = firstDefinedIterator;
function zipWith(arrayA, arrayB, callback) {
var result = [];
- Debug.assertEqual(arrayA.length, arrayB.length);
+ ts.Debug.assertEqual(arrayA.length, arrayB.length);
for (var i = 0; i < arrayA.length; i++) {
result.push(callback(arrayA[i], arrayB[i], i));
}
@@ -324,7 +324,7 @@
}
ts.zipWith = zipWith;
function zipToIterator(arrayA, arrayB) {
- Debug.assertEqual(arrayA.length, arrayB.length);
+ ts.Debug.assertEqual(arrayA.length, arrayB.length);
var i = 0;
return {
next: function () {
@@ -338,7 +338,7 @@
}
ts.zipToIterator = zipToIterator;
function zipToMap(keys, values) {
- Debug.assert(keys.length === values.length);
+ ts.Debug.assert(keys.length === values.length);
var map = createMap();
for (var i = 0; i < keys.length; ++i) {
map.set(keys[i], values[i]);
@@ -412,7 +412,7 @@
return result;
}
}
- return Debug.fail();
+ return ts.Debug.fail();
}
ts.findMap = findMap;
function contains(array, value, equalityComparer) {
@@ -842,7 +842,7 @@
continue;
case -1 /* LessThan */:
// If `array` is sorted, `next` should **never** be less than `last`.
- return Debug.fail("Array is unsorted.");
+ return ts.Debug.fail("Array is unsorted.");
}
deduplicated.push(last = next);
}
@@ -909,13 +909,13 @@
loopB: for (var offsetA = 0, offsetB = 0; offsetB < arrayB.length; offsetB++) {
if (offsetB > 0) {
// Ensure `arrayB` is properly sorted.
- Debug.assertGreaterThanOrEqual(comparer(arrayB[offsetB], arrayB[offsetB - 1]), 0 /* EqualTo */);
+ ts.Debug.assertGreaterThanOrEqual(comparer(arrayB[offsetB], arrayB[offsetB - 1]), 0 /* EqualTo */);
}
loopA: for (var startA = offsetA; offsetA < arrayA.length; offsetA++) {
if (offsetA > startA) {
// Ensure `arrayA` is properly sorted. We only need to perform this check if
// `offsetA` has changed since we entered the loop.
- Debug.assertGreaterThanOrEqual(comparer(arrayA[offsetA], arrayA[offsetA - 1]), 0 /* EqualTo */);
+ ts.Debug.assertGreaterThanOrEqual(comparer(arrayA[offsetA], arrayA[offsetA - 1]), 0 /* EqualTo */);
}
switch (comparer(arrayB[offsetB], arrayA[offsetA])) {
case -1 /* LessThan */:
@@ -1085,7 +1085,7 @@
}
ts.firstOrUndefined = firstOrUndefined;
function first(array) {
- Debug.assert(array.length !== 0);
+ ts.Debug.assert(array.length !== 0);
return array[0];
}
ts.first = first;
@@ -1097,7 +1097,7 @@
}
ts.lastOrUndefined = lastOrUndefined;
function last(array) {
- Debug.assert(array.length !== 0);
+ ts.Debug.assert(array.length !== 0);
return array[array.length - 1];
}
ts.last = last;
@@ -1422,7 +1422,7 @@
function cast(value, test) {
if (value !== undefined && test(value))
return value;
- return Debug.fail("Invalid cast. The supplied value " + value + " did not pass the test '" + Debug.getFunctionName(test) + "'.");
+ return ts.Debug.fail("Invalid cast. The supplied value " + value + " did not pass the test '" + ts.Debug.getFunctionName(test) + "'.");
}
ts.cast = cast;
/** Does nothing. */
@@ -1459,38 +1459,13 @@
};
}
ts.memoize = memoize;
- function chain(a, b, c, d, e) {
+ function compose(a, b, c, d, e) {
if (e) {
var args_2 = [];
for (var i = 0; i < arguments.length; i++) {
args_2[i] = arguments[i];
}
- return function (t) { return compose.apply(void 0, map(args_2, function (f) { return f(t); })); };
- }
- else if (d) {
- return function (t) { return compose(a(t), b(t), c(t), d(t)); };
- }
- else if (c) {
- return function (t) { return compose(a(t), b(t), c(t)); };
- }
- else if (b) {
- return function (t) { return compose(a(t), b(t)); };
- }
- else if (a) {
- return function (t) { return compose(a(t)); };
- }
- else {
- return function (_) { return function (u) { return u; }; };
- }
- }
- ts.chain = chain;
- function compose(a, b, c, d, e) {
- if (e) {
- var args_3 = [];
- for (var i = 0; i < arguments.length; i++) {
- args_3[i] = arguments[i];
- }
- return function (t) { return reduceLeft(args_3, function (u, f) { return f(u); }, t); };
+ return function (t) { return reduceLeft(args_2, function (u, f) { return f(u); }, t); };
}
else if (d) {
return function (t) { return d(c(b(a(t)))); };
@@ -1516,92 +1491,6 @@
AssertionLevel[AssertionLevel["Aggressive"] = 2] = "Aggressive";
AssertionLevel[AssertionLevel["VeryAggressive"] = 3] = "VeryAggressive";
})(AssertionLevel = ts.AssertionLevel || (ts.AssertionLevel = {}));
- var Debug;
- (function (Debug) {
- Debug.currentAssertionLevel = 0 /* None */;
- Debug.isDebugging = false;
- function shouldAssert(level) {
- return Debug.currentAssertionLevel >= level;
- }
- Debug.shouldAssert = shouldAssert;
- function assert(expression, message, verboseDebugInfo, stackCrawlMark) {
- if (!expression) {
- if (verboseDebugInfo) {
- message += "\r\nVerbose Debug Information: " + (typeof verboseDebugInfo === "string" ? verboseDebugInfo : verboseDebugInfo());
- }
- fail(message ? "False expression: " + message : "False expression.", stackCrawlMark || assert);
- }
- }
- Debug.assert = assert;
- function assertEqual(a, b, msg, msg2) {
- if (a !== b) {
- var message = msg ? msg2 ? msg + " " + msg2 : msg : "";
- fail("Expected " + a + " === " + b + ". " + message);
- }
- }
- Debug.assertEqual = assertEqual;
- function assertLessThan(a, b, msg) {
- if (a >= b) {
- fail("Expected " + a + " < " + b + ". " + (msg || ""));
- }
- }
- Debug.assertLessThan = assertLessThan;
- function assertLessThanOrEqual(a, b) {
- if (a > b) {
- fail("Expected " + a + " <= " + b);
- }
- }
- Debug.assertLessThanOrEqual = assertLessThanOrEqual;
- function assertGreaterThanOrEqual(a, b) {
- if (a < b) {
- fail("Expected " + a + " >= " + b);
- }
- }
- Debug.assertGreaterThanOrEqual = assertGreaterThanOrEqual;
- function fail(message, stackCrawlMark) {
- debugger;
- var e = new Error(message ? "Debug Failure. " + message : "Debug Failure.");
- if (Error.captureStackTrace) {
- Error.captureStackTrace(e, stackCrawlMark || fail);
- }
- throw e;
- }
- Debug.fail = fail;
- function assertDefined(value, message) {
- if (value === undefined || value === null)
- return fail(message);
- return value;
- }
- Debug.assertDefined = assertDefined;
- function assertEachDefined(value, message) {
- for (var _i = 0, value_1 = value; _i < value_1.length; _i++) {
- var v = value_1[_i];
- assertDefined(v, message);
- }
- return value;
- }
- Debug.assertEachDefined = assertEachDefined;
- function assertNever(member, message, stackCrawlMark) {
- if (message === void 0) { message = "Illegal value:"; }
- var detail = typeof member === "object" && "kind" in member && "pos" in member ? "SyntaxKind: " + Debug.showSyntaxKind(member) : JSON.stringify(member);
- return fail(message + " " + detail, stackCrawlMark || assertNever);
- }
- Debug.assertNever = assertNever;
- function getFunctionName(func) {
- if (typeof func !== "function") {
- return "";
- }
- else if (func.hasOwnProperty("name")) {
- return func.name;
- }
- else {
- var text = Function.prototype.toString.call(func);
- var match = /^function\s+([\w\$]+)\s*\(/.exec(text);
- return match ? match[1] : "";
- }
- }
- Debug.getFunctionName = getFunctionName;
- })(Debug = ts.Debug || (ts.Debug = {}));
function equateValues(a, b) {
return a === b;
}
@@ -1858,7 +1747,7 @@
bestCandidate = candidate;
}
else {
- Debug.assert(distance < bestDistance); // Else `levenshteinWithMax` should return undefined
+ ts.Debug.assert(distance < bestDistance); // Else `levenshteinWithMax` should return undefined
bestDistance = distance;
bestCandidate = candidate;
}
@@ -2002,7 +1891,7 @@
* E.g.: matchedText(tryParsePattern("foo*baz"), "foobarbaz") === "bar"
*/
function matchedText(pattern, candidate) {
- Debug.assert(isPatternMatch(pattern, candidate));
+ ts.Debug.assert(isPatternMatch(pattern, candidate));
return candidate.substring(pattern.prefix.length, candidate.length - pattern.suffix.length);
}
ts.matchedText = matchedText;
@@ -2095,6 +1984,267 @@
return result;
}
ts.fill = fill;
+ function cartesianProduct(arrays) {
+ var result = [];
+ cartesianProductWorker(arrays, result, /*outer*/ undefined, 0);
+ return result;
+ }
+ ts.cartesianProduct = cartesianProduct;
+ function cartesianProductWorker(arrays, result, outer, index) {
+ for (var _i = 0, _a = arrays[index]; _i < _a.length; _i++) {
+ var element = _a[_i];
+ var inner = void 0;
+ if (outer) {
+ inner = outer.slice();
+ inner.push(element);
+ }
+ else {
+ inner = [element];
+ }
+ if (index === arrays.length - 1) {
+ result.push(inner);
+ }
+ else {
+ cartesianProductWorker(arrays, result, inner, index + 1);
+ }
+ }
+ }
+})(ts || (ts = {}));
+/* @internal */
+var ts;
+(function (ts) {
+ var Debug;
+ (function (Debug) {
+ Debug.currentAssertionLevel = 0 /* None */;
+ Debug.isDebugging = false;
+ function shouldAssert(level) {
+ return Debug.currentAssertionLevel >= level;
+ }
+ Debug.shouldAssert = shouldAssert;
+ function assert(expression, message, verboseDebugInfo, stackCrawlMark) {
+ if (!expression) {
+ if (verboseDebugInfo) {
+ message += "\r\nVerbose Debug Information: " + (typeof verboseDebugInfo === "string" ? verboseDebugInfo : verboseDebugInfo());
+ }
+ fail(message ? "False expression: " + message : "False expression.", stackCrawlMark || assert);
+ }
+ }
+ Debug.assert = assert;
+ function assertEqual(a, b, msg, msg2) {
+ if (a !== b) {
+ var message = msg ? msg2 ? msg + " " + msg2 : msg : "";
+ fail("Expected " + a + " === " + b + ". " + message);
+ }
+ }
+ Debug.assertEqual = assertEqual;
+ function assertLessThan(a, b, msg) {
+ if (a >= b) {
+ fail("Expected " + a + " < " + b + ". " + (msg || ""));
+ }
+ }
+ Debug.assertLessThan = assertLessThan;
+ function assertLessThanOrEqual(a, b) {
+ if (a > b) {
+ fail("Expected " + a + " <= " + b);
+ }
+ }
+ Debug.assertLessThanOrEqual = assertLessThanOrEqual;
+ function assertGreaterThanOrEqual(a, b) {
+ if (a < b) {
+ fail("Expected " + a + " >= " + b);
+ }
+ }
+ Debug.assertGreaterThanOrEqual = assertGreaterThanOrEqual;
+ function fail(message, stackCrawlMark) {
+ debugger;
+ var e = new Error(message ? "Debug Failure. " + message : "Debug Failure.");
+ if (Error.captureStackTrace) {
+ Error.captureStackTrace(e, stackCrawlMark || fail);
+ }
+ throw e;
+ }
+ Debug.fail = fail;
+ function assertDefined(value, message) {
+ if (value === undefined || value === null)
+ return fail(message);
+ return value;
+ }
+ Debug.assertDefined = assertDefined;
+ function assertEachDefined(value, message) {
+ for (var _i = 0, value_1 = value; _i < value_1.length; _i++) {
+ var v = value_1[_i];
+ assertDefined(v, message);
+ }
+ return value;
+ }
+ Debug.assertEachDefined = assertEachDefined;
+ function assertNever(member, message, stackCrawlMark) {
+ if (message === void 0) { message = "Illegal value:"; }
+ var detail = typeof member === "object" && "kind" in member && "pos" in member && formatSyntaxKind ? "SyntaxKind: " + formatSyntaxKind(member.kind) : JSON.stringify(member);
+ return fail(message + " " + detail, stackCrawlMark || assertNever);
+ }
+ Debug.assertNever = assertNever;
+ function getFunctionName(func) {
+ if (typeof func !== "function") {
+ return "";
+ }
+ else if (func.hasOwnProperty("name")) {
+ return func.name;
+ }
+ else {
+ var text = Function.prototype.toString.call(func);
+ var match = /^function\s+([\w\$]+)\s*\(/.exec(text);
+ return match ? match[1] : "";
+ }
+ }
+ Debug.getFunctionName = getFunctionName;
+ function formatSymbol(symbol) {
+ return "{ name: " + ts.unescapeLeadingUnderscores(symbol.escapedName) + "; flags: " + formatSymbolFlags(symbol.flags) + "; declarations: " + ts.map(symbol.declarations, function (node) { return formatSyntaxKind(node.kind); }) + " }";
+ }
+ Debug.formatSymbol = formatSymbol;
+ /**
+ * Formats an enum value as a string for debugging and debug assertions.
+ */
+ function formatEnum(value, enumObject, isFlags) {
+ if (value === void 0) { value = 0; }
+ var members = getEnumMembers(enumObject);
+ if (value === 0) {
+ return members.length > 0 && members[0][0] === 0 ? members[0][1] : "0";
+ }
+ if (isFlags) {
+ var result = "";
+ var remainingFlags = value;
+ for (var i = members.length - 1; i >= 0 && remainingFlags !== 0; i--) {
+ var _a = members[i], enumValue = _a[0], enumName = _a[1];
+ if (enumValue !== 0 && (remainingFlags & enumValue) === enumValue) {
+ remainingFlags &= ~enumValue;
+ result = "" + enumName + (result ? "|" : "") + result;
+ }
+ }
+ if (remainingFlags === 0) {
+ return result;
+ }
+ }
+ else {
+ for (var _i = 0, members_1 = members; _i < members_1.length; _i++) {
+ var _b = members_1[_i], enumValue = _b[0], enumName = _b[1];
+ if (enumValue === value) {
+ return enumName;
+ }
+ }
+ }
+ return value.toString();
+ }
+ Debug.formatEnum = formatEnum;
+ function getEnumMembers(enumObject) {
+ var result = [];
+ for (var name in enumObject) {
+ var value = enumObject[name];
+ if (typeof value === "number") {
+ result.push([value, name]);
+ }
+ }
+ return ts.stableSort(result, function (x, y) { return ts.compareValues(x[0], y[0]); });
+ }
+ function formatSyntaxKind(kind) {
+ return formatEnum(kind, ts.SyntaxKind, /*isFlags*/ false);
+ }
+ Debug.formatSyntaxKind = formatSyntaxKind;
+ function formatNodeFlags(flags) {
+ return formatEnum(flags, ts.NodeFlags, /*isFlags*/ true);
+ }
+ Debug.formatNodeFlags = formatNodeFlags;
+ function formatModifierFlags(flags) {
+ return formatEnum(flags, ts.ModifierFlags, /*isFlags*/ true);
+ }
+ Debug.formatModifierFlags = formatModifierFlags;
+ function formatTransformFlags(flags) {
+ return formatEnum(flags, ts.TransformFlags, /*isFlags*/ true);
+ }
+ Debug.formatTransformFlags = formatTransformFlags;
+ function formatEmitFlags(flags) {
+ return formatEnum(flags, ts.EmitFlags, /*isFlags*/ true);
+ }
+ Debug.formatEmitFlags = formatEmitFlags;
+ function formatSymbolFlags(flags) {
+ return formatEnum(flags, ts.SymbolFlags, /*isFlags*/ true);
+ }
+ Debug.formatSymbolFlags = formatSymbolFlags;
+ function formatTypeFlags(flags) {
+ return formatEnum(flags, ts.TypeFlags, /*isFlags*/ true);
+ }
+ Debug.formatTypeFlags = formatTypeFlags;
+ function formatObjectFlags(flags) {
+ return formatEnum(flags, ts.ObjectFlags, /*isFlags*/ true);
+ }
+ Debug.formatObjectFlags = formatObjectFlags;
+ function failBadSyntaxKind(node, message) {
+ return fail((message || "Unexpected node.") + "\r\nNode " + formatSyntaxKind(node.kind) + " was unexpected.", failBadSyntaxKind);
+ }
+ Debug.failBadSyntaxKind = failBadSyntaxKind;
+ Debug.assertEachNode = shouldAssert(1 /* Normal */)
+ ? function (nodes, test, message) { return assert(test === undefined || ts.every(nodes, test), message || "Unexpected node.", function () { return "Node array did not pass test '" + getFunctionName(test) + "'."; }, Debug.assertEachNode); }
+ : ts.noop;
+ Debug.assertNode = shouldAssert(1 /* Normal */)
+ ? function (node, test, message) { return assert(test === undefined || test(node), message || "Unexpected node.", function () { return "Node " + formatSyntaxKind(node.kind) + " did not pass test '" + getFunctionName(test) + "'."; }, Debug.assertNode); }
+ : ts.noop;
+ Debug.assertOptionalNode = shouldAssert(1 /* Normal */)
+ ? function (node, test, message) { return assert(test === undefined || node === undefined || test(node), message || "Unexpected node.", function () { return "Node " + formatSyntaxKind(node.kind) + " did not pass test '" + getFunctionName(test) + "'."; }, Debug.assertOptionalNode); }
+ : ts.noop;
+ Debug.assertOptionalToken = shouldAssert(1 /* Normal */)
+ ? function (node, kind, message) { return assert(kind === undefined || node === undefined || node.kind === kind, message || "Unexpected node.", function () { return "Node " + formatSyntaxKind(node.kind) + " was not a '" + formatSyntaxKind(kind) + "' token."; }, Debug.assertOptionalToken); }
+ : ts.noop;
+ Debug.assertMissingNode = shouldAssert(1 /* Normal */)
+ ? function (node, message) { return assert(node === undefined, message || "Unexpected node.", function () { return "Node " + formatSyntaxKind(node.kind) + " was unexpected'."; }, Debug.assertMissingNode); }
+ : ts.noop;
+ var isDebugInfoEnabled = false;
+ /**
+ * Injects debug information into frequently used types.
+ */
+ function enableDebugInfo() {
+ if (isDebugInfoEnabled)
+ return;
+ // Add additional properties in debug mode to assist with debugging.
+ Object.defineProperties(ts.objectAllocator.getSymbolConstructor().prototype, {
+ __debugFlags: { get: function () { return formatSymbolFlags(this.flags); } }
+ });
+ Object.defineProperties(ts.objectAllocator.getTypeConstructor().prototype, {
+ __debugFlags: { get: function () { return formatTypeFlags(this.flags); } },
+ __debugObjectFlags: { get: function () { return this.flags & 524288 /* Object */ ? formatObjectFlags(this.objectFlags) : ""; } },
+ __debugTypeToString: { value: function () { return this.checker.typeToString(this); } },
+ });
+ var nodeConstructors = [
+ ts.objectAllocator.getNodeConstructor(),
+ ts.objectAllocator.getIdentifierConstructor(),
+ ts.objectAllocator.getTokenConstructor(),
+ ts.objectAllocator.getSourceFileConstructor()
+ ];
+ for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) {
+ var ctor = nodeConstructors_1[_i];
+ if (!ctor.prototype.hasOwnProperty("__debugKind")) {
+ Object.defineProperties(ctor.prototype, {
+ __debugKind: { get: function () { return formatSyntaxKind(this.kind); } },
+ __debugNodeFlags: { get: function () { return formatNodeFlags(this.flags); } },
+ __debugModifierFlags: { get: function () { return formatModifierFlags(ts.getModifierFlagsNoCache(this)); } },
+ __debugTransformFlags: { get: function () { return formatTransformFlags(this.transformFlags); } },
+ __debugIsParseTreeNode: { get: function () { return ts.isParseTreeNode(this); } },
+ __debugEmitFlags: { get: function () { return formatEmitFlags(ts.getEmitFlags(this)); } },
+ __debugGetText: {
+ value: function (includeTrivia) {
+ if (ts.nodeIsSynthesized(this))
+ return "";
+ var parseNode = ts.getParseTreeNode(this);
+ var sourceFile = parseNode && ts.getSourceFileOfNode(parseNode);
+ return sourceFile ? ts.getSourceTextOfNodeFromSourceFile(sourceFile, parseNode, includeTrivia) : "";
+ }
+ }
+ });
+ }
+ }
+ isDebugInfoEnabled = true;
+ }
+ Debug.enableDebugInfo = enableDebugInfo;
+ })(Debug = ts.Debug || (ts.Debug = {}));
})(ts || (ts = {}));
/*@internal*/
var ts;
@@ -2647,309 +2797,311 @@
SyntaxKind[SyntaxKind["QuestionToken"] = 56] = "QuestionToken";
SyntaxKind[SyntaxKind["ColonToken"] = 57] = "ColonToken";
SyntaxKind[SyntaxKind["AtToken"] = 58] = "AtToken";
+ /** Only the JSDoc scanner produces BacktickToken. The normal scanner produces NoSubstitutionTemplateLiteral and related kinds. */
+ SyntaxKind[SyntaxKind["BacktickToken"] = 59] = "BacktickToken";
// Assignments
- SyntaxKind[SyntaxKind["EqualsToken"] = 59] = "EqualsToken";
- SyntaxKind[SyntaxKind["PlusEqualsToken"] = 60] = "PlusEqualsToken";
- SyntaxKind[SyntaxKind["MinusEqualsToken"] = 61] = "MinusEqualsToken";
- SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 62] = "AsteriskEqualsToken";
- SyntaxKind[SyntaxKind["AsteriskAsteriskEqualsToken"] = 63] = "AsteriskAsteriskEqualsToken";
- SyntaxKind[SyntaxKind["SlashEqualsToken"] = 64] = "SlashEqualsToken";
- SyntaxKind[SyntaxKind["PercentEqualsToken"] = 65] = "PercentEqualsToken";
- SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 66] = "LessThanLessThanEqualsToken";
- SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 67] = "GreaterThanGreaterThanEqualsToken";
- SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 68] = "GreaterThanGreaterThanGreaterThanEqualsToken";
- SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 69] = "AmpersandEqualsToken";
- SyntaxKind[SyntaxKind["BarEqualsToken"] = 70] = "BarEqualsToken";
- SyntaxKind[SyntaxKind["CaretEqualsToken"] = 71] = "CaretEqualsToken";
+ SyntaxKind[SyntaxKind["EqualsToken"] = 60] = "EqualsToken";
+ SyntaxKind[SyntaxKind["PlusEqualsToken"] = 61] = "PlusEqualsToken";
+ SyntaxKind[SyntaxKind["MinusEqualsToken"] = 62] = "MinusEqualsToken";
+ SyntaxKind[SyntaxKind["AsteriskEqualsToken"] = 63] = "AsteriskEqualsToken";
+ SyntaxKind[SyntaxKind["AsteriskAsteriskEqualsToken"] = 64] = "AsteriskAsteriskEqualsToken";
+ SyntaxKind[SyntaxKind["SlashEqualsToken"] = 65] = "SlashEqualsToken";
+ SyntaxKind[SyntaxKind["PercentEqualsToken"] = 66] = "PercentEqualsToken";
+ SyntaxKind[SyntaxKind["LessThanLessThanEqualsToken"] = 67] = "LessThanLessThanEqualsToken";
+ SyntaxKind[SyntaxKind["GreaterThanGreaterThanEqualsToken"] = 68] = "GreaterThanGreaterThanEqualsToken";
+ SyntaxKind[SyntaxKind["GreaterThanGreaterThanGreaterThanEqualsToken"] = 69] = "GreaterThanGreaterThanGreaterThanEqualsToken";
+ SyntaxKind[SyntaxKind["AmpersandEqualsToken"] = 70] = "AmpersandEqualsToken";
+ SyntaxKind[SyntaxKind["BarEqualsToken"] = 71] = "BarEqualsToken";
+ SyntaxKind[SyntaxKind["CaretEqualsToken"] = 72] = "CaretEqualsToken";
// Identifiers
- SyntaxKind[SyntaxKind["Identifier"] = 72] = "Identifier";
+ SyntaxKind[SyntaxKind["Identifier"] = 73] = "Identifier";
// Reserved words
- SyntaxKind[SyntaxKind["BreakKeyword"] = 73] = "BreakKeyword";
- SyntaxKind[SyntaxKind["CaseKeyword"] = 74] = "CaseKeyword";
- SyntaxKind[SyntaxKind["CatchKeyword"] = 75] = "CatchKeyword";
- SyntaxKind[SyntaxKind["ClassKeyword"] = 76] = "ClassKeyword";
- SyntaxKind[SyntaxKind["ConstKeyword"] = 77] = "ConstKeyword";
- SyntaxKind[SyntaxKind["ContinueKeyword"] = 78] = "ContinueKeyword";
- SyntaxKind[SyntaxKind["DebuggerKeyword"] = 79] = "DebuggerKeyword";
- SyntaxKind[SyntaxKind["DefaultKeyword"] = 80] = "DefaultKeyword";
- SyntaxKind[SyntaxKind["DeleteKeyword"] = 81] = "DeleteKeyword";
- SyntaxKind[SyntaxKind["DoKeyword"] = 82] = "DoKeyword";
- SyntaxKind[SyntaxKind["ElseKeyword"] = 83] = "ElseKeyword";
- SyntaxKind[SyntaxKind["EnumKeyword"] = 84] = "EnumKeyword";
- SyntaxKind[SyntaxKind["ExportKeyword"] = 85] = "ExportKeyword";
- SyntaxKind[SyntaxKind["ExtendsKeyword"] = 86] = "ExtendsKeyword";
- SyntaxKind[SyntaxKind["FalseKeyword"] = 87] = "FalseKeyword";
- SyntaxKind[SyntaxKind["FinallyKeyword"] = 88] = "FinallyKeyword";
- SyntaxKind[SyntaxKind["ForKeyword"] = 89] = "ForKeyword";
- SyntaxKind[SyntaxKind["FunctionKeyword"] = 90] = "FunctionKeyword";
- SyntaxKind[SyntaxKind["IfKeyword"] = 91] = "IfKeyword";
- SyntaxKind[SyntaxKind["ImportKeyword"] = 92] = "ImportKeyword";
- SyntaxKind[SyntaxKind["InKeyword"] = 93] = "InKeyword";
- SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 94] = "InstanceOfKeyword";
- SyntaxKind[SyntaxKind["NewKeyword"] = 95] = "NewKeyword";
- SyntaxKind[SyntaxKind["NullKeyword"] = 96] = "NullKeyword";
- SyntaxKind[SyntaxKind["ReturnKeyword"] = 97] = "ReturnKeyword";
- SyntaxKind[SyntaxKind["SuperKeyword"] = 98] = "SuperKeyword";
- SyntaxKind[SyntaxKind["SwitchKeyword"] = 99] = "SwitchKeyword";
- SyntaxKind[SyntaxKind["ThisKeyword"] = 100] = "ThisKeyword";
- SyntaxKind[SyntaxKind["ThrowKeyword"] = 101] = "ThrowKeyword";
- SyntaxKind[SyntaxKind["TrueKeyword"] = 102] = "TrueKeyword";
- SyntaxKind[SyntaxKind["TryKeyword"] = 103] = "TryKeyword";
- SyntaxKind[SyntaxKind["TypeOfKeyword"] = 104] = "TypeOfKeyword";
- SyntaxKind[SyntaxKind["VarKeyword"] = 105] = "VarKeyword";
- SyntaxKind[SyntaxKind["VoidKeyword"] = 106] = "VoidKeyword";
- SyntaxKind[SyntaxKind["WhileKeyword"] = 107] = "WhileKeyword";
- SyntaxKind[SyntaxKind["WithKeyword"] = 108] = "WithKeyword";
+ SyntaxKind[SyntaxKind["BreakKeyword"] = 74] = "BreakKeyword";
+ SyntaxKind[SyntaxKind["CaseKeyword"] = 75] = "CaseKeyword";
+ SyntaxKind[SyntaxKind["CatchKeyword"] = 76] = "CatchKeyword";
+ SyntaxKind[SyntaxKind["ClassKeyword"] = 77] = "ClassKeyword";
+ SyntaxKind[SyntaxKind["ConstKeyword"] = 78] = "ConstKeyword";
+ SyntaxKind[SyntaxKind["ContinueKeyword"] = 79] = "ContinueKeyword";
+ SyntaxKind[SyntaxKind["DebuggerKeyword"] = 80] = "DebuggerKeyword";
+ SyntaxKind[SyntaxKind["DefaultKeyword"] = 81] = "DefaultKeyword";
+ SyntaxKind[SyntaxKind["DeleteKeyword"] = 82] = "DeleteKeyword";
+ SyntaxKind[SyntaxKind["DoKeyword"] = 83] = "DoKeyword";
+ SyntaxKind[SyntaxKind["ElseKeyword"] = 84] = "ElseKeyword";
+ SyntaxKind[SyntaxKind["EnumKeyword"] = 85] = "EnumKeyword";
+ SyntaxKind[SyntaxKind["ExportKeyword"] = 86] = "ExportKeyword";
+ SyntaxKind[SyntaxKind["ExtendsKeyword"] = 87] = "ExtendsKeyword";
+ SyntaxKind[SyntaxKind["FalseKeyword"] = 88] = "FalseKeyword";
+ SyntaxKind[SyntaxKind["FinallyKeyword"] = 89] = "FinallyKeyword";
+ SyntaxKind[SyntaxKind["ForKeyword"] = 90] = "ForKeyword";
+ SyntaxKind[SyntaxKind["FunctionKeyword"] = 91] = "FunctionKeyword";
+ SyntaxKind[SyntaxKind["IfKeyword"] = 92] = "IfKeyword";
+ SyntaxKind[SyntaxKind["ImportKeyword"] = 93] = "ImportKeyword";
+ SyntaxKind[SyntaxKind["InKeyword"] = 94] = "InKeyword";
+ SyntaxKind[SyntaxKind["InstanceOfKeyword"] = 95] = "InstanceOfKeyword";
+ SyntaxKind[SyntaxKind["NewKeyword"] = 96] = "NewKeyword";
+ SyntaxKind[SyntaxKind["NullKeyword"] = 97] = "NullKeyword";
+ SyntaxKind[SyntaxKind["ReturnKeyword"] = 98] = "ReturnKeyword";
+ SyntaxKind[SyntaxKind["SuperKeyword"] = 99] = "SuperKeyword";
+ SyntaxKind[SyntaxKind["SwitchKeyword"] = 100] = "SwitchKeyword";
+ SyntaxKind[SyntaxKind["ThisKeyword"] = 101] = "ThisKeyword";
+ SyntaxKind[SyntaxKind["ThrowKeyword"] = 102] = "ThrowKeyword";
+ SyntaxKind[SyntaxKind["TrueKeyword"] = 103] = "TrueKeyword";
+ SyntaxKind[SyntaxKind["TryKeyword"] = 104] = "TryKeyword";
+ SyntaxKind[SyntaxKind["TypeOfKeyword"] = 105] = "TypeOfKeyword";
+ SyntaxKind[SyntaxKind["VarKeyword"] = 106] = "VarKeyword";
+ SyntaxKind[SyntaxKind["VoidKeyword"] = 107] = "VoidKeyword";
+ SyntaxKind[SyntaxKind["WhileKeyword"] = 108] = "WhileKeyword";
+ SyntaxKind[SyntaxKind["WithKeyword"] = 109] = "WithKeyword";
// Strict mode reserved words
- SyntaxKind[SyntaxKind["ImplementsKeyword"] = 109] = "ImplementsKeyword";
- SyntaxKind[SyntaxKind["InterfaceKeyword"] = 110] = "InterfaceKeyword";
- SyntaxKind[SyntaxKind["LetKeyword"] = 111] = "LetKeyword";
- SyntaxKind[SyntaxKind["PackageKeyword"] = 112] = "PackageKeyword";
- SyntaxKind[SyntaxKind["PrivateKeyword"] = 113] = "PrivateKeyword";
- SyntaxKind[SyntaxKind["ProtectedKeyword"] = 114] = "ProtectedKeyword";
- SyntaxKind[SyntaxKind["PublicKeyword"] = 115] = "PublicKeyword";
- SyntaxKind[SyntaxKind["StaticKeyword"] = 116] = "StaticKeyword";
- SyntaxKind[SyntaxKind["YieldKeyword"] = 117] = "YieldKeyword";
+ SyntaxKind[SyntaxKind["ImplementsKeyword"] = 110] = "ImplementsKeyword";
+ SyntaxKind[SyntaxKind["InterfaceKeyword"] = 111] = "InterfaceKeyword";
+ SyntaxKind[SyntaxKind["LetKeyword"] = 112] = "LetKeyword";
+ SyntaxKind[SyntaxKind["PackageKeyword"] = 113] = "PackageKeyword";
+ SyntaxKind[SyntaxKind["PrivateKeyword"] = 114] = "PrivateKeyword";
+ SyntaxKind[SyntaxKind["ProtectedKeyword"] = 115] = "ProtectedKeyword";
+ SyntaxKind[SyntaxKind["PublicKeyword"] = 116] = "PublicKeyword";
+ SyntaxKind[SyntaxKind["StaticKeyword"] = 117] = "StaticKeyword";
+ SyntaxKind[SyntaxKind["YieldKeyword"] = 118] = "YieldKeyword";
// Contextual keywords
- SyntaxKind[SyntaxKind["AbstractKeyword"] = 118] = "AbstractKeyword";
- SyntaxKind[SyntaxKind["AsKeyword"] = 119] = "AsKeyword";
- SyntaxKind[SyntaxKind["AnyKeyword"] = 120] = "AnyKeyword";
- SyntaxKind[SyntaxKind["AsyncKeyword"] = 121] = "AsyncKeyword";
- SyntaxKind[SyntaxKind["AwaitKeyword"] = 122] = "AwaitKeyword";
- SyntaxKind[SyntaxKind["BooleanKeyword"] = 123] = "BooleanKeyword";
- SyntaxKind[SyntaxKind["ConstructorKeyword"] = 124] = "ConstructorKeyword";
- SyntaxKind[SyntaxKind["DeclareKeyword"] = 125] = "DeclareKeyword";
- SyntaxKind[SyntaxKind["GetKeyword"] = 126] = "GetKeyword";
- SyntaxKind[SyntaxKind["InferKeyword"] = 127] = "InferKeyword";
- SyntaxKind[SyntaxKind["IsKeyword"] = 128] = "IsKeyword";
- SyntaxKind[SyntaxKind["KeyOfKeyword"] = 129] = "KeyOfKeyword";
- SyntaxKind[SyntaxKind["ModuleKeyword"] = 130] = "ModuleKeyword";
- SyntaxKind[SyntaxKind["NamespaceKeyword"] = 131] = "NamespaceKeyword";
- SyntaxKind[SyntaxKind["NeverKeyword"] = 132] = "NeverKeyword";
- SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 133] = "ReadonlyKeyword";
- SyntaxKind[SyntaxKind["RequireKeyword"] = 134] = "RequireKeyword";
- SyntaxKind[SyntaxKind["NumberKeyword"] = 135] = "NumberKeyword";
- SyntaxKind[SyntaxKind["ObjectKeyword"] = 136] = "ObjectKeyword";
- SyntaxKind[SyntaxKind["SetKeyword"] = 137] = "SetKeyword";
- SyntaxKind[SyntaxKind["StringKeyword"] = 138] = "StringKeyword";
- SyntaxKind[SyntaxKind["SymbolKeyword"] = 139] = "SymbolKeyword";
- SyntaxKind[SyntaxKind["TypeKeyword"] = 140] = "TypeKeyword";
- SyntaxKind[SyntaxKind["UndefinedKeyword"] = 141] = "UndefinedKeyword";
- SyntaxKind[SyntaxKind["UniqueKeyword"] = 142] = "UniqueKeyword";
- SyntaxKind[SyntaxKind["UnknownKeyword"] = 143] = "UnknownKeyword";
- SyntaxKind[SyntaxKind["FromKeyword"] = 144] = "FromKeyword";
- SyntaxKind[SyntaxKind["GlobalKeyword"] = 145] = "GlobalKeyword";
- SyntaxKind[SyntaxKind["BigIntKeyword"] = 146] = "BigIntKeyword";
- SyntaxKind[SyntaxKind["OfKeyword"] = 147] = "OfKeyword";
+ SyntaxKind[SyntaxKind["AbstractKeyword"] = 119] = "AbstractKeyword";
+ SyntaxKind[SyntaxKind["AsKeyword"] = 120] = "AsKeyword";
+ SyntaxKind[SyntaxKind["AnyKeyword"] = 121] = "AnyKeyword";
+ SyntaxKind[SyntaxKind["AsyncKeyword"] = 122] = "AsyncKeyword";
+ SyntaxKind[SyntaxKind["AwaitKeyword"] = 123] = "AwaitKeyword";
+ SyntaxKind[SyntaxKind["BooleanKeyword"] = 124] = "BooleanKeyword";
+ SyntaxKind[SyntaxKind["ConstructorKeyword"] = 125] = "ConstructorKeyword";
+ SyntaxKind[SyntaxKind["DeclareKeyword"] = 126] = "DeclareKeyword";
+ SyntaxKind[SyntaxKind["GetKeyword"] = 127] = "GetKeyword";
+ SyntaxKind[SyntaxKind["InferKeyword"] = 128] = "InferKeyword";
+ SyntaxKind[SyntaxKind["IsKeyword"] = 129] = "IsKeyword";
+ SyntaxKind[SyntaxKind["KeyOfKeyword"] = 130] = "KeyOfKeyword";
+ SyntaxKind[SyntaxKind["ModuleKeyword"] = 131] = "ModuleKeyword";
+ SyntaxKind[SyntaxKind["NamespaceKeyword"] = 132] = "NamespaceKeyword";
+ SyntaxKind[SyntaxKind["NeverKeyword"] = 133] = "NeverKeyword";
+ SyntaxKind[SyntaxKind["ReadonlyKeyword"] = 134] = "ReadonlyKeyword";
+ SyntaxKind[SyntaxKind["RequireKeyword"] = 135] = "RequireKeyword";
+ SyntaxKind[SyntaxKind["NumberKeyword"] = 136] = "NumberKeyword";
+ SyntaxKind[SyntaxKind["ObjectKeyword"] = 137] = "ObjectKeyword";
+ SyntaxKind[SyntaxKind["SetKeyword"] = 138] = "SetKeyword";
+ SyntaxKind[SyntaxKind["StringKeyword"] = 139] = "StringKeyword";
+ SyntaxKind[SyntaxKind["SymbolKeyword"] = 140] = "SymbolKeyword";
+ SyntaxKind[SyntaxKind["TypeKeyword"] = 141] = "TypeKeyword";
+ SyntaxKind[SyntaxKind["UndefinedKeyword"] = 142] = "UndefinedKeyword";
+ SyntaxKind[SyntaxKind["UniqueKeyword"] = 143] = "UniqueKeyword";
+ SyntaxKind[SyntaxKind["UnknownKeyword"] = 144] = "UnknownKeyword";
+ SyntaxKind[SyntaxKind["FromKeyword"] = 145] = "FromKeyword";
+ SyntaxKind[SyntaxKind["GlobalKeyword"] = 146] = "GlobalKeyword";
+ SyntaxKind[SyntaxKind["BigIntKeyword"] = 147] = "BigIntKeyword";
+ SyntaxKind[SyntaxKind["OfKeyword"] = 148] = "OfKeyword";
// Parse tree nodes
// Names
- SyntaxKind[SyntaxKind["QualifiedName"] = 148] = "QualifiedName";
- SyntaxKind[SyntaxKind["ComputedPropertyName"] = 149] = "ComputedPropertyName";
+ SyntaxKind[SyntaxKind["QualifiedName"] = 149] = "QualifiedName";
+ SyntaxKind[SyntaxKind["ComputedPropertyName"] = 150] = "ComputedPropertyName";
// Signature elements
- SyntaxKind[SyntaxKind["TypeParameter"] = 150] = "TypeParameter";
- SyntaxKind[SyntaxKind["Parameter"] = 151] = "Parameter";
- SyntaxKind[SyntaxKind["Decorator"] = 152] = "Decorator";
+ SyntaxKind[SyntaxKind["TypeParameter"] = 151] = "TypeParameter";
+ SyntaxKind[SyntaxKind["Parameter"] = 152] = "Parameter";
+ SyntaxKind[SyntaxKind["Decorator"] = 153] = "Decorator";
// TypeMember
- SyntaxKind[SyntaxKind["PropertySignature"] = 153] = "PropertySignature";
- SyntaxKind[SyntaxKind["PropertyDeclaration"] = 154] = "PropertyDeclaration";
- SyntaxKind[SyntaxKind["MethodSignature"] = 155] = "MethodSignature";
- SyntaxKind[SyntaxKind["MethodDeclaration"] = 156] = "MethodDeclaration";
- SyntaxKind[SyntaxKind["Constructor"] = 157] = "Constructor";
- SyntaxKind[SyntaxKind["GetAccessor"] = 158] = "GetAccessor";
- SyntaxKind[SyntaxKind["SetAccessor"] = 159] = "SetAccessor";
- SyntaxKind[SyntaxKind["CallSignature"] = 160] = "CallSignature";
- SyntaxKind[SyntaxKind["ConstructSignature"] = 161] = "ConstructSignature";
- SyntaxKind[SyntaxKind["IndexSignature"] = 162] = "IndexSignature";
+ SyntaxKind[SyntaxKind["PropertySignature"] = 154] = "PropertySignature";
+ SyntaxKind[SyntaxKind["PropertyDeclaration"] = 155] = "PropertyDeclaration";
+ SyntaxKind[SyntaxKind["MethodSignature"] = 156] = "MethodSignature";
+ SyntaxKind[SyntaxKind["MethodDeclaration"] = 157] = "MethodDeclaration";
+ SyntaxKind[SyntaxKind["Constructor"] = 158] = "Constructor";
+ SyntaxKind[SyntaxKind["GetAccessor"] = 159] = "GetAccessor";
+ SyntaxKind[SyntaxKind["SetAccessor"] = 160] = "SetAccessor";
+ SyntaxKind[SyntaxKind["CallSignature"] = 161] = "CallSignature";
+ SyntaxKind[SyntaxKind["ConstructSignature"] = 162] = "ConstructSignature";
+ SyntaxKind[SyntaxKind["IndexSignature"] = 163] = "IndexSignature";
// Type
- SyntaxKind[SyntaxKind["TypePredicate"] = 163] = "TypePredicate";
- SyntaxKind[SyntaxKind["TypeReference"] = 164] = "TypeReference";
- SyntaxKind[SyntaxKind["FunctionType"] = 165] = "FunctionType";
- SyntaxKind[SyntaxKind["ConstructorType"] = 166] = "ConstructorType";
- SyntaxKind[SyntaxKind["TypeQuery"] = 167] = "TypeQuery";
- SyntaxKind[SyntaxKind["TypeLiteral"] = 168] = "TypeLiteral";
- SyntaxKind[SyntaxKind["ArrayType"] = 169] = "ArrayType";
- SyntaxKind[SyntaxKind["TupleType"] = 170] = "TupleType";
- SyntaxKind[SyntaxKind["OptionalType"] = 171] = "OptionalType";
- SyntaxKind[SyntaxKind["RestType"] = 172] = "RestType";
- SyntaxKind[SyntaxKind["UnionType"] = 173] = "UnionType";
- SyntaxKind[SyntaxKind["IntersectionType"] = 174] = "IntersectionType";
- SyntaxKind[SyntaxKind["ConditionalType"] = 175] = "ConditionalType";
- SyntaxKind[SyntaxKind["InferType"] = 176] = "InferType";
- SyntaxKind[SyntaxKind["ParenthesizedType"] = 177] = "ParenthesizedType";
- SyntaxKind[SyntaxKind["ThisType"] = 178] = "ThisType";
- SyntaxKind[SyntaxKind["TypeOperator"] = 179] = "TypeOperator";
- SyntaxKind[SyntaxKind["IndexedAccessType"] = 180] = "IndexedAccessType";
- SyntaxKind[SyntaxKind["MappedType"] = 181] = "MappedType";
- SyntaxKind[SyntaxKind["LiteralType"] = 182] = "LiteralType";
- SyntaxKind[SyntaxKind["ImportType"] = 183] = "ImportType";
+ SyntaxKind[SyntaxKind["TypePredicate"] = 164] = "TypePredicate";
+ SyntaxKind[SyntaxKind["TypeReference"] = 165] = "TypeReference";
+ SyntaxKind[SyntaxKind["FunctionType"] = 166] = "FunctionType";
+ SyntaxKind[SyntaxKind["ConstructorType"] = 167] = "ConstructorType";
+ SyntaxKind[SyntaxKind["TypeQuery"] = 168] = "TypeQuery";
+ SyntaxKind[SyntaxKind["TypeLiteral"] = 169] = "TypeLiteral";
+ SyntaxKind[SyntaxKind["ArrayType"] = 170] = "ArrayType";
+ SyntaxKind[SyntaxKind["TupleType"] = 171] = "TupleType";
+ SyntaxKind[SyntaxKind["OptionalType"] = 172] = "OptionalType";
+ SyntaxKind[SyntaxKind["RestType"] = 173] = "RestType";
+ SyntaxKind[SyntaxKind["UnionType"] = 174] = "UnionType";
+ SyntaxKind[SyntaxKind["IntersectionType"] = 175] = "IntersectionType";
+ SyntaxKind[SyntaxKind["ConditionalType"] = 176] = "ConditionalType";
+ SyntaxKind[SyntaxKind["InferType"] = 177] = "InferType";
+ SyntaxKind[SyntaxKind["ParenthesizedType"] = 178] = "ParenthesizedType";
+ SyntaxKind[SyntaxKind["ThisType"] = 179] = "ThisType";
+ SyntaxKind[SyntaxKind["TypeOperator"] = 180] = "TypeOperator";
+ SyntaxKind[SyntaxKind["IndexedAccessType"] = 181] = "IndexedAccessType";
+ SyntaxKind[SyntaxKind["MappedType"] = 182] = "MappedType";
+ SyntaxKind[SyntaxKind["LiteralType"] = 183] = "LiteralType";
+ SyntaxKind[SyntaxKind["ImportType"] = 184] = "ImportType";
// Binding patterns
- SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 184] = "ObjectBindingPattern";
- SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 185] = "ArrayBindingPattern";
- SyntaxKind[SyntaxKind["BindingElement"] = 186] = "BindingElement";
+ SyntaxKind[SyntaxKind["ObjectBindingPattern"] = 185] = "ObjectBindingPattern";
+ SyntaxKind[SyntaxKind["ArrayBindingPattern"] = 186] = "ArrayBindingPattern";
+ SyntaxKind[SyntaxKind["BindingElement"] = 187] = "BindingElement";
// Expression
- SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 187] = "ArrayLiteralExpression";
- SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 188] = "ObjectLiteralExpression";
- SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 189] = "PropertyAccessExpression";
- SyntaxKind[SyntaxKind["ElementAccessExpression"] = 190] = "ElementAccessExpression";
- SyntaxKind[SyntaxKind["CallExpression"] = 191] = "CallExpression";
- SyntaxKind[SyntaxKind["NewExpression"] = 192] = "NewExpression";
- SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 193] = "TaggedTemplateExpression";
- SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 194] = "TypeAssertionExpression";
- SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 195] = "ParenthesizedExpression";
- SyntaxKind[SyntaxKind["FunctionExpression"] = 196] = "FunctionExpression";
- SyntaxKind[SyntaxKind["ArrowFunction"] = 197] = "ArrowFunction";
- SyntaxKind[SyntaxKind["DeleteExpression"] = 198] = "DeleteExpression";
- SyntaxKind[SyntaxKind["TypeOfExpression"] = 199] = "TypeOfExpression";
- SyntaxKind[SyntaxKind["VoidExpression"] = 200] = "VoidExpression";
- SyntaxKind[SyntaxKind["AwaitExpression"] = 201] = "AwaitExpression";
- SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 202] = "PrefixUnaryExpression";
- SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 203] = "PostfixUnaryExpression";
- SyntaxKind[SyntaxKind["BinaryExpression"] = 204] = "BinaryExpression";
- SyntaxKind[SyntaxKind["ConditionalExpression"] = 205] = "ConditionalExpression";
- SyntaxKind[SyntaxKind["TemplateExpression"] = 206] = "TemplateExpression";
- SyntaxKind[SyntaxKind["YieldExpression"] = 207] = "YieldExpression";
- SyntaxKind[SyntaxKind["SpreadElement"] = 208] = "SpreadElement";
- SyntaxKind[SyntaxKind["ClassExpression"] = 209] = "ClassExpression";
- SyntaxKind[SyntaxKind["OmittedExpression"] = 210] = "OmittedExpression";
- SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 211] = "ExpressionWithTypeArguments";
- SyntaxKind[SyntaxKind["AsExpression"] = 212] = "AsExpression";
- SyntaxKind[SyntaxKind["NonNullExpression"] = 213] = "NonNullExpression";
- SyntaxKind[SyntaxKind["MetaProperty"] = 214] = "MetaProperty";
- SyntaxKind[SyntaxKind["SyntheticExpression"] = 215] = "SyntheticExpression";
+ SyntaxKind[SyntaxKind["ArrayLiteralExpression"] = 188] = "ArrayLiteralExpression";
+ SyntaxKind[SyntaxKind["ObjectLiteralExpression"] = 189] = "ObjectLiteralExpression";
+ SyntaxKind[SyntaxKind["PropertyAccessExpression"] = 190] = "PropertyAccessExpression";
+ SyntaxKind[SyntaxKind["ElementAccessExpression"] = 191] = "ElementAccessExpression";
+ SyntaxKind[SyntaxKind["CallExpression"] = 192] = "CallExpression";
+ SyntaxKind[SyntaxKind["NewExpression"] = 193] = "NewExpression";
+ SyntaxKind[SyntaxKind["TaggedTemplateExpression"] = 194] = "TaggedTemplateExpression";
+ SyntaxKind[SyntaxKind["TypeAssertionExpression"] = 195] = "TypeAssertionExpression";
+ SyntaxKind[SyntaxKind["ParenthesizedExpression"] = 196] = "ParenthesizedExpression";
+ SyntaxKind[SyntaxKind["FunctionExpression"] = 197] = "FunctionExpression";
+ SyntaxKind[SyntaxKind["ArrowFunction"] = 198] = "ArrowFunction";
+ SyntaxKind[SyntaxKind["DeleteExpression"] = 199] = "DeleteExpression";
+ SyntaxKind[SyntaxKind["TypeOfExpression"] = 200] = "TypeOfExpression";
+ SyntaxKind[SyntaxKind["VoidExpression"] = 201] = "VoidExpression";
+ SyntaxKind[SyntaxKind["AwaitExpression"] = 202] = "AwaitExpression";
+ SyntaxKind[SyntaxKind["PrefixUnaryExpression"] = 203] = "PrefixUnaryExpression";
+ SyntaxKind[SyntaxKind["PostfixUnaryExpression"] = 204] = "PostfixUnaryExpression";
+ SyntaxKind[SyntaxKind["BinaryExpression"] = 205] = "BinaryExpression";
+ SyntaxKind[SyntaxKind["ConditionalExpression"] = 206] = "ConditionalExpression";
+ SyntaxKind[SyntaxKind["TemplateExpression"] = 207] = "TemplateExpression";
+ SyntaxKind[SyntaxKind["YieldExpression"] = 208] = "YieldExpression";
+ SyntaxKind[SyntaxKind["SpreadElement"] = 209] = "SpreadElement";
+ SyntaxKind[SyntaxKind["ClassExpression"] = 210] = "ClassExpression";
+ SyntaxKind[SyntaxKind["OmittedExpression"] = 211] = "OmittedExpression";
+ SyntaxKind[SyntaxKind["ExpressionWithTypeArguments"] = 212] = "ExpressionWithTypeArguments";
+ SyntaxKind[SyntaxKind["AsExpression"] = 213] = "AsExpression";
+ SyntaxKind[SyntaxKind["NonNullExpression"] = 214] = "NonNullExpression";
+ SyntaxKind[SyntaxKind["MetaProperty"] = 215] = "MetaProperty";
+ SyntaxKind[SyntaxKind["SyntheticExpression"] = 216] = "SyntheticExpression";
// Misc
- SyntaxKind[SyntaxKind["TemplateSpan"] = 216] = "TemplateSpan";
- SyntaxKind[SyntaxKind["SemicolonClassElement"] = 217] = "SemicolonClassElement";
+ SyntaxKind[SyntaxKind["TemplateSpan"] = 217] = "TemplateSpan";
+ SyntaxKind[SyntaxKind["SemicolonClassElement"] = 218] = "SemicolonClassElement";
// Element
- SyntaxKind[SyntaxKind["Block"] = 218] = "Block";
- SyntaxKind[SyntaxKind["VariableStatement"] = 219] = "VariableStatement";
- SyntaxKind[SyntaxKind["EmptyStatement"] = 220] = "EmptyStatement";
- SyntaxKind[SyntaxKind["ExpressionStatement"] = 221] = "ExpressionStatement";
- SyntaxKind[SyntaxKind["IfStatement"] = 222] = "IfStatement";
- SyntaxKind[SyntaxKind["DoStatement"] = 223] = "DoStatement";
- SyntaxKind[SyntaxKind["WhileStatement"] = 224] = "WhileStatement";
- SyntaxKind[SyntaxKind["ForStatement"] = 225] = "ForStatement";
- SyntaxKind[SyntaxKind["ForInStatement"] = 226] = "ForInStatement";
- SyntaxKind[SyntaxKind["ForOfStatement"] = 227] = "ForOfStatement";
- SyntaxKind[SyntaxKind["ContinueStatement"] = 228] = "ContinueStatement";
- SyntaxKind[SyntaxKind["BreakStatement"] = 229] = "BreakStatement";
- SyntaxKind[SyntaxKind["ReturnStatement"] = 230] = "ReturnStatement";
- SyntaxKind[SyntaxKind["WithStatement"] = 231] = "WithStatement";
- SyntaxKind[SyntaxKind["SwitchStatement"] = 232] = "SwitchStatement";
- SyntaxKind[SyntaxKind["LabeledStatement"] = 233] = "LabeledStatement";
- SyntaxKind[SyntaxKind["ThrowStatement"] = 234] = "ThrowStatement";
- SyntaxKind[SyntaxKind["TryStatement"] = 235] = "TryStatement";
- SyntaxKind[SyntaxKind["DebuggerStatement"] = 236] = "DebuggerStatement";
- SyntaxKind[SyntaxKind["VariableDeclaration"] = 237] = "VariableDeclaration";
- SyntaxKind[SyntaxKind["VariableDeclarationList"] = 238] = "VariableDeclarationList";
- SyntaxKind[SyntaxKind["FunctionDeclaration"] = 239] = "FunctionDeclaration";
- SyntaxKind[SyntaxKind["ClassDeclaration"] = 240] = "ClassDeclaration";
- SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 241] = "InterfaceDeclaration";
- SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 242] = "TypeAliasDeclaration";
- SyntaxKind[SyntaxKind["EnumDeclaration"] = 243] = "EnumDeclaration";
- SyntaxKind[SyntaxKind["ModuleDeclaration"] = 244] = "ModuleDeclaration";
- SyntaxKind[SyntaxKind["ModuleBlock"] = 245] = "ModuleBlock";
- SyntaxKind[SyntaxKind["CaseBlock"] = 246] = "CaseBlock";
- SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 247] = "NamespaceExportDeclaration";
- SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 248] = "ImportEqualsDeclaration";
- SyntaxKind[SyntaxKind["ImportDeclaration"] = 249] = "ImportDeclaration";
- SyntaxKind[SyntaxKind["ImportClause"] = 250] = "ImportClause";
- SyntaxKind[SyntaxKind["NamespaceImport"] = 251] = "NamespaceImport";
- SyntaxKind[SyntaxKind["NamedImports"] = 252] = "NamedImports";
- SyntaxKind[SyntaxKind["ImportSpecifier"] = 253] = "ImportSpecifier";
- SyntaxKind[SyntaxKind["ExportAssignment"] = 254] = "ExportAssignment";
- SyntaxKind[SyntaxKind["ExportDeclaration"] = 255] = "ExportDeclaration";
- SyntaxKind[SyntaxKind["NamedExports"] = 256] = "NamedExports";
- SyntaxKind[SyntaxKind["ExportSpecifier"] = 257] = "ExportSpecifier";
- SyntaxKind[SyntaxKind["MissingDeclaration"] = 258] = "MissingDeclaration";
+ SyntaxKind[SyntaxKind["Block"] = 219] = "Block";
+ SyntaxKind[SyntaxKind["VariableStatement"] = 220] = "VariableStatement";
+ SyntaxKind[SyntaxKind["EmptyStatement"] = 221] = "EmptyStatement";
+ SyntaxKind[SyntaxKind["ExpressionStatement"] = 222] = "ExpressionStatement";
+ SyntaxKind[SyntaxKind["IfStatement"] = 223] = "IfStatement";
+ SyntaxKind[SyntaxKind["DoStatement"] = 224] = "DoStatement";
+ SyntaxKind[SyntaxKind["WhileStatement"] = 225] = "WhileStatement";
+ SyntaxKind[SyntaxKind["ForStatement"] = 226] = "ForStatement";
+ SyntaxKind[SyntaxKind["ForInStatement"] = 227] = "ForInStatement";
+ SyntaxKind[SyntaxKind["ForOfStatement"] = 228] = "ForOfStatement";
+ SyntaxKind[SyntaxKind["ContinueStatement"] = 229] = "ContinueStatement";
+ SyntaxKind[SyntaxKind["BreakStatement"] = 230] = "BreakStatement";
+ SyntaxKind[SyntaxKind["ReturnStatement"] = 231] = "ReturnStatement";
+ SyntaxKind[SyntaxKind["WithStatement"] = 232] = "WithStatement";
+ SyntaxKind[SyntaxKind["SwitchStatement"] = 233] = "SwitchStatement";
+ SyntaxKind[SyntaxKind["LabeledStatement"] = 234] = "LabeledStatement";
+ SyntaxKind[SyntaxKind["ThrowStatement"] = 235] = "ThrowStatement";
+ SyntaxKind[SyntaxKind["TryStatement"] = 236] = "TryStatement";
+ SyntaxKind[SyntaxKind["DebuggerStatement"] = 237] = "DebuggerStatement";
+ SyntaxKind[SyntaxKind["VariableDeclaration"] = 238] = "VariableDeclaration";
+ SyntaxKind[SyntaxKind["VariableDeclarationList"] = 239] = "VariableDeclarationList";
+ SyntaxKind[SyntaxKind["FunctionDeclaration"] = 240] = "FunctionDeclaration";
+ SyntaxKind[SyntaxKind["ClassDeclaration"] = 241] = "ClassDeclaration";
+ SyntaxKind[SyntaxKind["InterfaceDeclaration"] = 242] = "InterfaceDeclaration";
+ SyntaxKind[SyntaxKind["TypeAliasDeclaration"] = 243] = "TypeAliasDeclaration";
+ SyntaxKind[SyntaxKind["EnumDeclaration"] = 244] = "EnumDeclaration";
+ SyntaxKind[SyntaxKind["ModuleDeclaration"] = 245] = "ModuleDeclaration";
+ SyntaxKind[SyntaxKind["ModuleBlock"] = 246] = "ModuleBlock";
+ SyntaxKind[SyntaxKind["CaseBlock"] = 247] = "CaseBlock";
+ SyntaxKind[SyntaxKind["NamespaceExportDeclaration"] = 248] = "NamespaceExportDeclaration";
+ SyntaxKind[SyntaxKind["ImportEqualsDeclaration"] = 249] = "ImportEqualsDeclaration";
+ SyntaxKind[SyntaxKind["ImportDeclaration"] = 250] = "ImportDeclaration";
+ SyntaxKind[SyntaxKind["ImportClause"] = 251] = "ImportClause";
+ SyntaxKind[SyntaxKind["NamespaceImport"] = 252] = "NamespaceImport";
+ SyntaxKind[SyntaxKind["NamedImports"] = 253] = "NamedImports";
+ SyntaxKind[SyntaxKind["ImportSpecifier"] = 254] = "ImportSpecifier";
+ SyntaxKind[SyntaxKind["ExportAssignment"] = 255] = "ExportAssignment";
+ SyntaxKind[SyntaxKind["ExportDeclaration"] = 256] = "ExportDeclaration";
+ SyntaxKind[SyntaxKind["NamedExports"] = 257] = "NamedExports";
+ SyntaxKind[SyntaxKind["ExportSpecifier"] = 258] = "ExportSpecifier";
+ SyntaxKind[SyntaxKind["MissingDeclaration"] = 259] = "MissingDeclaration";
// Module references
- SyntaxKind[SyntaxKind["ExternalModuleReference"] = 259] = "ExternalModuleReference";
+ SyntaxKind[SyntaxKind["ExternalModuleReference"] = 260] = "ExternalModuleReference";
// JSX
- SyntaxKind[SyntaxKind["JsxElement"] = 260] = "JsxElement";
- SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 261] = "JsxSelfClosingElement";
- SyntaxKind[SyntaxKind["JsxOpeningElement"] = 262] = "JsxOpeningElement";
- SyntaxKind[SyntaxKind["JsxClosingElement"] = 263] = "JsxClosingElement";
- SyntaxKind[SyntaxKind["JsxFragment"] = 264] = "JsxFragment";
- SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 265] = "JsxOpeningFragment";
- SyntaxKind[SyntaxKind["JsxClosingFragment"] = 266] = "JsxClosingFragment";
- SyntaxKind[SyntaxKind["JsxAttribute"] = 267] = "JsxAttribute";
- SyntaxKind[SyntaxKind["JsxAttributes"] = 268] = "JsxAttributes";
- SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 269] = "JsxSpreadAttribute";
- SyntaxKind[SyntaxKind["JsxExpression"] = 270] = "JsxExpression";
+ SyntaxKind[SyntaxKind["JsxElement"] = 261] = "JsxElement";
+ SyntaxKind[SyntaxKind["JsxSelfClosingElement"] = 262] = "JsxSelfClosingElement";
+ SyntaxKind[SyntaxKind["JsxOpeningElement"] = 263] = "JsxOpeningElement";
+ SyntaxKind[SyntaxKind["JsxClosingElement"] = 264] = "JsxClosingElement";
+ SyntaxKind[SyntaxKind["JsxFragment"] = 265] = "JsxFragment";
+ SyntaxKind[SyntaxKind["JsxOpeningFragment"] = 266] = "JsxOpeningFragment";
+ SyntaxKind[SyntaxKind["JsxClosingFragment"] = 267] = "JsxClosingFragment";
+ SyntaxKind[SyntaxKind["JsxAttribute"] = 268] = "JsxAttribute";
+ SyntaxKind[SyntaxKind["JsxAttributes"] = 269] = "JsxAttributes";
+ SyntaxKind[SyntaxKind["JsxSpreadAttribute"] = 270] = "JsxSpreadAttribute";
+ SyntaxKind[SyntaxKind["JsxExpression"] = 271] = "JsxExpression";
// Clauses
- SyntaxKind[SyntaxKind["CaseClause"] = 271] = "CaseClause";
- SyntaxKind[SyntaxKind["DefaultClause"] = 272] = "DefaultClause";
- SyntaxKind[SyntaxKind["HeritageClause"] = 273] = "HeritageClause";
- SyntaxKind[SyntaxKind["CatchClause"] = 274] = "CatchClause";
+ SyntaxKind[SyntaxKind["CaseClause"] = 272] = "CaseClause";
+ SyntaxKind[SyntaxKind["DefaultClause"] = 273] = "DefaultClause";
+ SyntaxKind[SyntaxKind["HeritageClause"] = 274] = "HeritageClause";
+ SyntaxKind[SyntaxKind["CatchClause"] = 275] = "CatchClause";
// Property assignments
- SyntaxKind[SyntaxKind["PropertyAssignment"] = 275] = "PropertyAssignment";
- SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 276] = "ShorthandPropertyAssignment";
- SyntaxKind[SyntaxKind["SpreadAssignment"] = 277] = "SpreadAssignment";
+ SyntaxKind[SyntaxKind["PropertyAssignment"] = 276] = "PropertyAssignment";
+ SyntaxKind[SyntaxKind["ShorthandPropertyAssignment"] = 277] = "ShorthandPropertyAssignment";
+ SyntaxKind[SyntaxKind["SpreadAssignment"] = 278] = "SpreadAssignment";
// Enum
- SyntaxKind[SyntaxKind["EnumMember"] = 278] = "EnumMember";
+ SyntaxKind[SyntaxKind["EnumMember"] = 279] = "EnumMember";
// Unparsed
- SyntaxKind[SyntaxKind["UnparsedPrologue"] = 279] = "UnparsedPrologue";
- SyntaxKind[SyntaxKind["UnparsedPrepend"] = 280] = "UnparsedPrepend";
- SyntaxKind[SyntaxKind["UnparsedText"] = 281] = "UnparsedText";
- SyntaxKind[SyntaxKind["UnparsedInternalText"] = 282] = "UnparsedInternalText";
- SyntaxKind[SyntaxKind["UnparsedSyntheticReference"] = 283] = "UnparsedSyntheticReference";
+ SyntaxKind[SyntaxKind["UnparsedPrologue"] = 280] = "UnparsedPrologue";
+ SyntaxKind[SyntaxKind["UnparsedPrepend"] = 281] = "UnparsedPrepend";
+ SyntaxKind[SyntaxKind["UnparsedText"] = 282] = "UnparsedText";
+ SyntaxKind[SyntaxKind["UnparsedInternalText"] = 283] = "UnparsedInternalText";
+ SyntaxKind[SyntaxKind["UnparsedSyntheticReference"] = 284] = "UnparsedSyntheticReference";
// Top-level nodes
- SyntaxKind[SyntaxKind["SourceFile"] = 284] = "SourceFile";
- SyntaxKind[SyntaxKind["Bundle"] = 285] = "Bundle";
- SyntaxKind[SyntaxKind["UnparsedSource"] = 286] = "UnparsedSource";
- SyntaxKind[SyntaxKind["InputFiles"] = 287] = "InputFiles";
+ SyntaxKind[SyntaxKind["SourceFile"] = 285] = "SourceFile";
+ SyntaxKind[SyntaxKind["Bundle"] = 286] = "Bundle";
+ SyntaxKind[SyntaxKind["UnparsedSource"] = 287] = "UnparsedSource";
+ SyntaxKind[SyntaxKind["InputFiles"] = 288] = "InputFiles";
// JSDoc nodes
- SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 288] = "JSDocTypeExpression";
+ SyntaxKind[SyntaxKind["JSDocTypeExpression"] = 289] = "JSDocTypeExpression";
// The * type
- SyntaxKind[SyntaxKind["JSDocAllType"] = 289] = "JSDocAllType";
+ SyntaxKind[SyntaxKind["JSDocAllType"] = 290] = "JSDocAllType";
// The ? type
- SyntaxKind[SyntaxKind["JSDocUnknownType"] = 290] = "JSDocUnknownType";
- SyntaxKind[SyntaxKind["JSDocNullableType"] = 291] = "JSDocNullableType";
- SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 292] = "JSDocNonNullableType";
- SyntaxKind[SyntaxKind["JSDocOptionalType"] = 293] = "JSDocOptionalType";
- SyntaxKind[SyntaxKind["JSDocFunctionType"] = 294] = "JSDocFunctionType";
- SyntaxKind[SyntaxKind["JSDocVariadicType"] = 295] = "JSDocVariadicType";
- SyntaxKind[SyntaxKind["JSDocComment"] = 296] = "JSDocComment";
- SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 297] = "JSDocTypeLiteral";
- SyntaxKind[SyntaxKind["JSDocSignature"] = 298] = "JSDocSignature";
- SyntaxKind[SyntaxKind["JSDocTag"] = 299] = "JSDocTag";
- SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 300] = "JSDocAugmentsTag";
- SyntaxKind[SyntaxKind["JSDocClassTag"] = 301] = "JSDocClassTag";
- SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 302] = "JSDocCallbackTag";
- SyntaxKind[SyntaxKind["JSDocEnumTag"] = 303] = "JSDocEnumTag";
- SyntaxKind[SyntaxKind["JSDocParameterTag"] = 304] = "JSDocParameterTag";
- SyntaxKind[SyntaxKind["JSDocReturnTag"] = 305] = "JSDocReturnTag";
- SyntaxKind[SyntaxKind["JSDocThisTag"] = 306] = "JSDocThisTag";
- SyntaxKind[SyntaxKind["JSDocTypeTag"] = 307] = "JSDocTypeTag";
- SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 308] = "JSDocTemplateTag";
- SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 309] = "JSDocTypedefTag";
- SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 310] = "JSDocPropertyTag";
+ SyntaxKind[SyntaxKind["JSDocUnknownType"] = 291] = "JSDocUnknownType";
+ SyntaxKind[SyntaxKind["JSDocNullableType"] = 292] = "JSDocNullableType";
+ SyntaxKind[SyntaxKind["JSDocNonNullableType"] = 293] = "JSDocNonNullableType";
+ SyntaxKind[SyntaxKind["JSDocOptionalType"] = 294] = "JSDocOptionalType";
+ SyntaxKind[SyntaxKind["JSDocFunctionType"] = 295] = "JSDocFunctionType";
+ SyntaxKind[SyntaxKind["JSDocVariadicType"] = 296] = "JSDocVariadicType";
+ SyntaxKind[SyntaxKind["JSDocComment"] = 297] = "JSDocComment";
+ SyntaxKind[SyntaxKind["JSDocTypeLiteral"] = 298] = "JSDocTypeLiteral";
+ SyntaxKind[SyntaxKind["JSDocSignature"] = 299] = "JSDocSignature";
+ SyntaxKind[SyntaxKind["JSDocTag"] = 300] = "JSDocTag";
+ SyntaxKind[SyntaxKind["JSDocAugmentsTag"] = 301] = "JSDocAugmentsTag";
+ SyntaxKind[SyntaxKind["JSDocClassTag"] = 302] = "JSDocClassTag";
+ SyntaxKind[SyntaxKind["JSDocCallbackTag"] = 303] = "JSDocCallbackTag";
+ SyntaxKind[SyntaxKind["JSDocEnumTag"] = 304] = "JSDocEnumTag";
+ SyntaxKind[SyntaxKind["JSDocParameterTag"] = 305] = "JSDocParameterTag";
+ SyntaxKind[SyntaxKind["JSDocReturnTag"] = 306] = "JSDocReturnTag";
+ SyntaxKind[SyntaxKind["JSDocThisTag"] = 307] = "JSDocThisTag";
+ SyntaxKind[SyntaxKind["JSDocTypeTag"] = 308] = "JSDocTypeTag";
+ SyntaxKind[SyntaxKind["JSDocTemplateTag"] = 309] = "JSDocTemplateTag";
+ SyntaxKind[SyntaxKind["JSDocTypedefTag"] = 310] = "JSDocTypedefTag";
+ SyntaxKind[SyntaxKind["JSDocPropertyTag"] = 311] = "JSDocPropertyTag";
// Synthesized list
- SyntaxKind[SyntaxKind["SyntaxList"] = 311] = "SyntaxList";
+ SyntaxKind[SyntaxKind["SyntaxList"] = 312] = "SyntaxList";
// Transformation nodes
- SyntaxKind[SyntaxKind["NotEmittedStatement"] = 312] = "NotEmittedStatement";
- SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 313] = "PartiallyEmittedExpression";
- SyntaxKind[SyntaxKind["CommaListExpression"] = 314] = "CommaListExpression";
- SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 315] = "MergeDeclarationMarker";
- SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 316] = "EndOfDeclarationMarker";
+ SyntaxKind[SyntaxKind["NotEmittedStatement"] = 313] = "NotEmittedStatement";
+ SyntaxKind[SyntaxKind["PartiallyEmittedExpression"] = 314] = "PartiallyEmittedExpression";
+ SyntaxKind[SyntaxKind["CommaListExpression"] = 315] = "CommaListExpression";
+ SyntaxKind[SyntaxKind["MergeDeclarationMarker"] = 316] = "MergeDeclarationMarker";
+ SyntaxKind[SyntaxKind["EndOfDeclarationMarker"] = 317] = "EndOfDeclarationMarker";
// Enum value count
- SyntaxKind[SyntaxKind["Count"] = 317] = "Count";
+ SyntaxKind[SyntaxKind["Count"] = 318] = "Count";
// Markers
- SyntaxKind[SyntaxKind["FirstAssignment"] = 59] = "FirstAssignment";
- SyntaxKind[SyntaxKind["LastAssignment"] = 71] = "LastAssignment";
- SyntaxKind[SyntaxKind["FirstCompoundAssignment"] = 60] = "FirstCompoundAssignment";
- SyntaxKind[SyntaxKind["LastCompoundAssignment"] = 71] = "LastCompoundAssignment";
- SyntaxKind[SyntaxKind["FirstReservedWord"] = 73] = "FirstReservedWord";
- SyntaxKind[SyntaxKind["LastReservedWord"] = 108] = "LastReservedWord";
- SyntaxKind[SyntaxKind["FirstKeyword"] = 73] = "FirstKeyword";
- SyntaxKind[SyntaxKind["LastKeyword"] = 147] = "LastKeyword";
- SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 109] = "FirstFutureReservedWord";
- SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 117] = "LastFutureReservedWord";
- SyntaxKind[SyntaxKind["FirstTypeNode"] = 163] = "FirstTypeNode";
- SyntaxKind[SyntaxKind["LastTypeNode"] = 183] = "LastTypeNode";
+ SyntaxKind[SyntaxKind["FirstAssignment"] = 60] = "FirstAssignment";
+ SyntaxKind[SyntaxKind["LastAssignment"] = 72] = "LastAssignment";
+ SyntaxKind[SyntaxKind["FirstCompoundAssignment"] = 61] = "FirstCompoundAssignment";
+ SyntaxKind[SyntaxKind["LastCompoundAssignment"] = 72] = "LastCompoundAssignment";
+ SyntaxKind[SyntaxKind["FirstReservedWord"] = 74] = "FirstReservedWord";
+ SyntaxKind[SyntaxKind["LastReservedWord"] = 109] = "LastReservedWord";
+ SyntaxKind[SyntaxKind["FirstKeyword"] = 74] = "FirstKeyword";
+ SyntaxKind[SyntaxKind["LastKeyword"] = 148] = "LastKeyword";
+ SyntaxKind[SyntaxKind["FirstFutureReservedWord"] = 110] = "FirstFutureReservedWord";
+ SyntaxKind[SyntaxKind["LastFutureReservedWord"] = 118] = "LastFutureReservedWord";
+ SyntaxKind[SyntaxKind["FirstTypeNode"] = 164] = "FirstTypeNode";
+ SyntaxKind[SyntaxKind["LastTypeNode"] = 184] = "LastTypeNode";
SyntaxKind[SyntaxKind["FirstPunctuation"] = 18] = "FirstPunctuation";
- SyntaxKind[SyntaxKind["LastPunctuation"] = 71] = "LastPunctuation";
+ SyntaxKind[SyntaxKind["LastPunctuation"] = 72] = "LastPunctuation";
SyntaxKind[SyntaxKind["FirstToken"] = 0] = "FirstToken";
- SyntaxKind[SyntaxKind["LastToken"] = 147] = "LastToken";
+ SyntaxKind[SyntaxKind["LastToken"] = 148] = "LastToken";
SyntaxKind[SyntaxKind["FirstTriviaToken"] = 2] = "FirstTriviaToken";
SyntaxKind[SyntaxKind["LastTriviaToken"] = 7] = "LastTriviaToken";
SyntaxKind[SyntaxKind["FirstLiteralToken"] = 8] = "FirstLiteralToken";
@@ -2957,14 +3109,14 @@
SyntaxKind[SyntaxKind["FirstTemplateToken"] = 14] = "FirstTemplateToken";
SyntaxKind[SyntaxKind["LastTemplateToken"] = 17] = "LastTemplateToken";
SyntaxKind[SyntaxKind["FirstBinaryOperator"] = 28] = "FirstBinaryOperator";
- SyntaxKind[SyntaxKind["LastBinaryOperator"] = 71] = "LastBinaryOperator";
- SyntaxKind[SyntaxKind["FirstNode"] = 148] = "FirstNode";
- SyntaxKind[SyntaxKind["FirstJSDocNode"] = 288] = "FirstJSDocNode";
- SyntaxKind[SyntaxKind["LastJSDocNode"] = 310] = "LastJSDocNode";
- SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 299] = "FirstJSDocTagNode";
- SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 310] = "LastJSDocTagNode";
- /* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 118] = "FirstContextualKeyword";
- /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 147] = "LastContextualKeyword";
+ SyntaxKind[SyntaxKind["LastBinaryOperator"] = 72] = "LastBinaryOperator";
+ SyntaxKind[SyntaxKind["FirstNode"] = 149] = "FirstNode";
+ SyntaxKind[SyntaxKind["FirstJSDocNode"] = 289] = "FirstJSDocNode";
+ SyntaxKind[SyntaxKind["LastJSDocNode"] = 311] = "LastJSDocNode";
+ SyntaxKind[SyntaxKind["FirstJSDocTagNode"] = 300] = "FirstJSDocTagNode";
+ SyntaxKind[SyntaxKind["LastJSDocTagNode"] = 311] = "LastJSDocTagNode";
+ /* @internal */ SyntaxKind[SyntaxKind["FirstContextualKeyword"] = 119] = "FirstContextualKeyword";
+ /* @internal */ SyntaxKind[SyntaxKind["LastContextualKeyword"] = 148] = "LastContextualKeyword";
})(SyntaxKind = ts.SyntaxKind || (ts.SyntaxKind = {}));
var NodeFlags;
(function (NodeFlags) {
@@ -3107,6 +3259,8 @@
FlowFlags[FlowFlags["Shared"] = 1024] = "Shared";
FlowFlags[FlowFlags["PreFinally"] = 2048] = "PreFinally";
FlowFlags[FlowFlags["AfterFinally"] = 4096] = "AfterFinally";
+ /** @internal */
+ FlowFlags[FlowFlags["Cached"] = 8192] = "Cached";
FlowFlags[FlowFlags["Label"] = 12] = "Label";
FlowFlags[FlowFlags["Condition"] = 96] = "Condition";
})(FlowFlags = ts.FlowFlags || (ts.FlowFlags = {}));
@@ -3359,19 +3513,22 @@
CheckFlags[CheckFlags["SyntheticProperty"] = 2] = "SyntheticProperty";
CheckFlags[CheckFlags["SyntheticMethod"] = 4] = "SyntheticMethod";
CheckFlags[CheckFlags["Readonly"] = 8] = "Readonly";
- CheckFlags[CheckFlags["Partial"] = 16] = "Partial";
- CheckFlags[CheckFlags["HasNonUniformType"] = 32] = "HasNonUniformType";
- CheckFlags[CheckFlags["HasLiteralType"] = 64] = "HasLiteralType";
- CheckFlags[CheckFlags["ContainsPublic"] = 128] = "ContainsPublic";
- CheckFlags[CheckFlags["ContainsProtected"] = 256] = "ContainsProtected";
- CheckFlags[CheckFlags["ContainsPrivate"] = 512] = "ContainsPrivate";
- CheckFlags[CheckFlags["ContainsStatic"] = 1024] = "ContainsStatic";
- CheckFlags[CheckFlags["Late"] = 2048] = "Late";
- CheckFlags[CheckFlags["ReverseMapped"] = 4096] = "ReverseMapped";
- CheckFlags[CheckFlags["OptionalParameter"] = 8192] = "OptionalParameter";
- CheckFlags[CheckFlags["RestParameter"] = 16384] = "RestParameter";
+ CheckFlags[CheckFlags["ReadPartial"] = 16] = "ReadPartial";
+ CheckFlags[CheckFlags["WritePartial"] = 32] = "WritePartial";
+ CheckFlags[CheckFlags["HasNonUniformType"] = 64] = "HasNonUniformType";
+ CheckFlags[CheckFlags["HasLiteralType"] = 128] = "HasLiteralType";
+ CheckFlags[CheckFlags["ContainsPublic"] = 256] = "ContainsPublic";
+ CheckFlags[CheckFlags["ContainsProtected"] = 512] = "ContainsProtected";
+ CheckFlags[CheckFlags["ContainsPrivate"] = 1024] = "ContainsPrivate";
+ CheckFlags[CheckFlags["ContainsStatic"] = 2048] = "ContainsStatic";
+ CheckFlags[CheckFlags["Late"] = 4096] = "Late";
+ CheckFlags[CheckFlags["ReverseMapped"] = 8192] = "ReverseMapped";
+ CheckFlags[CheckFlags["OptionalParameter"] = 16384] = "OptionalParameter";
+ CheckFlags[CheckFlags["RestParameter"] = 32768] = "RestParameter";
+ CheckFlags[CheckFlags["DeferredType"] = 65536] = "DeferredType";
CheckFlags[CheckFlags["Synthetic"] = 6] = "Synthetic";
- CheckFlags[CheckFlags["Discriminant"] = 96] = "Discriminant";
+ CheckFlags[CheckFlags["Discriminant"] = 192] = "Discriminant";
+ CheckFlags[CheckFlags["Partial"] = 48] = "Partial";
})(CheckFlags = ts.CheckFlags || (ts.CheckFlags = {}));
var InternalSymbolName;
(function (InternalSymbolName) {
@@ -3482,6 +3639,8 @@
TypeFlags[TypeFlags["StructuredOrInstantiable"] = 66846720] = "StructuredOrInstantiable";
/* @internal */
TypeFlags[TypeFlags["ObjectFlagsType"] = 3899392] = "ObjectFlagsType";
+ /* @internal */
+ TypeFlags[TypeFlags["Simplifiable"] = 25165824] = "Simplifiable";
// 'Narrowable' types are types where narrowing actually narrows.
// This *should* be every type other than null, undefined, void, and never
TypeFlags[TypeFlags["Narrowable"] = 133970943] = "Narrowable";
@@ -3537,14 +3696,18 @@
ObjectFlags[ObjectFlags["PropagatingFlags"] = 917504] = "PropagatingFlags";
})(ObjectFlags = ts.ObjectFlags || (ts.ObjectFlags = {}));
/* @internal */
- var Variance;
- (function (Variance) {
- Variance[Variance["Invariant"] = 0] = "Invariant";
- Variance[Variance["Covariant"] = 1] = "Covariant";
- Variance[Variance["Contravariant"] = 2] = "Contravariant";
- Variance[Variance["Bivariant"] = 3] = "Bivariant";
- Variance[Variance["Independent"] = 4] = "Independent";
- })(Variance = ts.Variance || (ts.Variance = {}));
+ var VarianceFlags;
+ (function (VarianceFlags) {
+ VarianceFlags[VarianceFlags["Invariant"] = 0] = "Invariant";
+ VarianceFlags[VarianceFlags["Covariant"] = 1] = "Covariant";
+ VarianceFlags[VarianceFlags["Contravariant"] = 2] = "Contravariant";
+ VarianceFlags[VarianceFlags["Bivariant"] = 3] = "Bivariant";
+ VarianceFlags[VarianceFlags["Independent"] = 4] = "Independent";
+ VarianceFlags[VarianceFlags["VarianceMask"] = 7] = "VarianceMask";
+ VarianceFlags[VarianceFlags["Unmeasurable"] = 8] = "Unmeasurable";
+ VarianceFlags[VarianceFlags["Unreliable"] = 16] = "Unreliable";
+ VarianceFlags[VarianceFlags["AllowsStructuralFallback"] = 24] = "AllowsStructuralFallback";
+ })(VarianceFlags = ts.VarianceFlags || (ts.VarianceFlags = {}));
/* @internal */
var JsxReferenceKind;
(function (JsxReferenceKind) {
@@ -3566,12 +3729,13 @@
(function (InferencePriority) {
InferencePriority[InferencePriority["NakedTypeVariable"] = 1] = "NakedTypeVariable";
InferencePriority[InferencePriority["HomomorphicMappedType"] = 2] = "HomomorphicMappedType";
- InferencePriority[InferencePriority["MappedTypeConstraint"] = 4] = "MappedTypeConstraint";
- InferencePriority[InferencePriority["ReturnType"] = 8] = "ReturnType";
- InferencePriority[InferencePriority["LiteralKeyof"] = 16] = "LiteralKeyof";
- InferencePriority[InferencePriority["NoConstraints"] = 32] = "NoConstraints";
- InferencePriority[InferencePriority["AlwaysStrict"] = 64] = "AlwaysStrict";
- InferencePriority[InferencePriority["PriorityImpliesCombination"] = 28] = "PriorityImpliesCombination";
+ InferencePriority[InferencePriority["PartialHomomorphicMappedType"] = 4] = "PartialHomomorphicMappedType";
+ InferencePriority[InferencePriority["MappedTypeConstraint"] = 8] = "MappedTypeConstraint";
+ InferencePriority[InferencePriority["ReturnType"] = 16] = "ReturnType";
+ InferencePriority[InferencePriority["LiteralKeyof"] = 32] = "LiteralKeyof";
+ InferencePriority[InferencePriority["NoConstraints"] = 64] = "NoConstraints";
+ InferencePriority[InferencePriority["AlwaysStrict"] = 128] = "AlwaysStrict";
+ InferencePriority[InferencePriority["PriorityImpliesCombination"] = 56] = "PriorityImpliesCombination";
})(InferencePriority = ts.InferencePriority || (ts.InferencePriority = {}));
/* @internal */
var InferenceFlags;
@@ -3688,9 +3852,10 @@
ScriptTarget[ScriptTarget["ES2017"] = 4] = "ES2017";
ScriptTarget[ScriptTarget["ES2018"] = 5] = "ES2018";
ScriptTarget[ScriptTarget["ES2019"] = 6] = "ES2019";
- ScriptTarget[ScriptTarget["ESNext"] = 7] = "ESNext";
+ ScriptTarget[ScriptTarget["ES2020"] = 7] = "ES2020";
+ ScriptTarget[ScriptTarget["ESNext"] = 8] = "ESNext";
ScriptTarget[ScriptTarget["JSON"] = 100] = "JSON";
- ScriptTarget[ScriptTarget["Latest"] = 7] = "Latest";
+ ScriptTarget[ScriptTarget["Latest"] = 8] = "Latest";
})(ScriptTarget = ts.ScriptTarget || (ts.ScriptTarget = {}));
var LanguageVariant;
(function (LanguageVariant) {
@@ -4103,17 +4268,10 @@
PragmaKindFlags[PragmaKindFlags["All"] = 7] = "All";
PragmaKindFlags[PragmaKindFlags["Default"] = 7] = "Default";
})(PragmaKindFlags = ts.PragmaKindFlags || (ts.PragmaKindFlags = {}));
- /**
- * This function only exists to cause exact types to be inferred for all the literals within `commentPragmas`
- */
- /* @internal */
- function _contextuallyTypePragmas(args) {
- return args;
- }
// While not strictly a type, this is here because `PragmaMap` needs to be here to be used with `SourceFile`, and we don't
// fancy effectively defining it twice, once in value-space and once in type-space
/* @internal */
- ts.commentPragmas = _contextuallyTypePragmas({
+ ts.commentPragmas = {
"reference": {
args: [
{ name: "types", optional: true, captureSpan: true },
@@ -4141,7 +4299,7 @@
args: [{ name: "factory" }],
kind: 4 /* MultiLine */
},
- });
+ };
})(ts || (ts = {}));
var ts;
(function (ts) {
@@ -5188,7 +5346,7 @@
_0_modifier_cannot_appear_on_a_data_property: diag(1043, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_data_property_1043", "'{0}' modifier cannot appear on a data property."),
_0_modifier_cannot_appear_on_a_module_or_namespace_element: diag(1044, ts.DiagnosticCategory.Error, "_0_modifier_cannot_appear_on_a_module_or_namespace_element_1044", "'{0}' modifier cannot appear on a module or namespace element."),
A_0_modifier_cannot_be_used_with_an_interface_declaration: diag(1045, ts.DiagnosticCategory.Error, "A_0_modifier_cannot_be_used_with_an_interface_declaration_1045", "A '{0}' modifier cannot be used with an interface declaration."),
- A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file: diag(1046, ts.DiagnosticCategory.Error, "A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file_1046", "A 'declare' modifier is required for a top level declaration in a .d.ts file."),
+ Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier: diag(1046, ts.DiagnosticCategory.Error, "Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier_1046", "Top-level declarations in .d.ts files must start with either a 'declare' or 'export' modifier."),
A_rest_parameter_cannot_be_optional: diag(1047, ts.DiagnosticCategory.Error, "A_rest_parameter_cannot_be_optional_1047", "A rest parameter cannot be optional."),
A_rest_parameter_cannot_have_an_initializer: diag(1048, ts.DiagnosticCategory.Error, "A_rest_parameter_cannot_have_an_initializer_1048", "A rest parameter cannot have an initializer."),
A_set_accessor_must_have_exactly_one_parameter: diag(1049, ts.DiagnosticCategory.Error, "A_set_accessor_must_have_exactly_one_parameter_1049", "A 'set' accessor must have exactly one parameter."),
@@ -5317,7 +5475,7 @@
Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided: diag(1205, ts.DiagnosticCategory.Error, "Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided_1205", "Cannot re-export a type when the '--isolatedModules' flag is provided."),
Decorators_are_not_valid_here: diag(1206, ts.DiagnosticCategory.Error, "Decorators_are_not_valid_here_1206", "Decorators are not valid here."),
Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: diag(1207, ts.DiagnosticCategory.Error, "Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name_1207", "Decorators cannot be applied to multiple get/set accessors of the same name."),
- Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided: diag(1208, ts.DiagnosticCategory.Error, "Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided_1208", "Cannot compile namespaces when the '--isolatedModules' flag is provided."),
+ All_files_must_be_modules_when_the_isolatedModules_flag_is_provided: diag(1208, ts.DiagnosticCategory.Error, "All_files_must_be_modules_when_the_isolatedModules_flag_is_provided_1208", "All files must be modules when the '--isolatedModules' flag is provided."),
Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: diag(1210, ts.DiagnosticCategory.Error, "Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode_1210", "Invalid use of '{0}'. Class definitions are automatically in strict mode."),
A_class_declaration_without_the_default_modifier_must_have_a_name: diag(1211, ts.DiagnosticCategory.Error, "A_class_declaration_without_the_default_modifier_must_have_a_name_1211", "A class declaration without the 'default' modifier must have a name."),
Identifier_expected_0_is_a_reserved_word_in_strict_mode: diag(1212, ts.DiagnosticCategory.Error, "Identifier_expected_0_is_a_reserved_word_in_strict_mode_1212", "Identifier expected. '{0}' is a reserved word in strict mode."),
@@ -5326,7 +5484,7 @@
Invalid_use_of_0_Modules_are_automatically_in_strict_mode: diag(1215, ts.DiagnosticCategory.Error, "Invalid_use_of_0_Modules_are_automatically_in_strict_mode_1215", "Invalid use of '{0}'. Modules are automatically in strict mode."),
Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules: diag(1216, ts.DiagnosticCategory.Error, "Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules_1216", "Identifier expected. '__esModule' is reserved as an exported marker when transforming ECMAScript modules."),
Export_assignment_is_not_supported_when_module_flag_is_system: diag(1218, ts.DiagnosticCategory.Error, "Export_assignment_is_not_supported_when_module_flag_is_system_1218", "Export assignment is not supported when '--module' flag is 'system'."),
- Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning: diag(1219, ts.DiagnosticCategory.Error, "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219", "Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning."),
+ Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning: diag(1219, ts.DiagnosticCategory.Error, "Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_t_1219", "Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning."),
Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher: diag(1220, ts.DiagnosticCategory.Error, "Generators_are_only_available_when_targeting_ECMAScript_2015_or_higher_1220", "Generators are only available when targeting ECMAScript 2015 or higher."),
Generators_are_not_allowed_in_an_ambient_context: diag(1221, ts.DiagnosticCategory.Error, "Generators_are_not_allowed_in_an_ambient_context_1221", "Generators are not allowed in an ambient context."),
An_overload_signature_cannot_be_declared_as_a_generator: diag(1222, ts.DiagnosticCategory.Error, "An_overload_signature_cannot_be_declared_as_a_generator_1222", "An overload signature cannot be declared as a generator."),
@@ -5365,6 +5523,8 @@
A_definite_assignment_assertion_is_not_permitted_in_this_context: diag(1255, ts.DiagnosticCategory.Error, "A_definite_assignment_assertion_is_not_permitted_in_this_context_1255", "A definite assignment assertion '!' is not permitted in this context."),
A_rest_element_must_be_last_in_a_tuple_type: diag(1256, ts.DiagnosticCategory.Error, "A_rest_element_must_be_last_in_a_tuple_type_1256", "A rest element must be last in a tuple type."),
A_required_element_cannot_follow_an_optional_element: diag(1257, ts.DiagnosticCategory.Error, "A_required_element_cannot_follow_an_optional_element_1257", "A required element cannot follow an optional element."),
+ Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation: diag(1258, ts.DiagnosticCategory.Error, "Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation_1258", "Definite assignment assertions can only be used along with a type annotation."),
+ Module_0_can_only_be_default_imported_using_the_1_flag: diag(1259, ts.DiagnosticCategory.Error, "Module_0_can_only_be_default_imported_using_the_1_flag_1259", "Module '{0}' can only be default-imported using the '{1}' flag"),
with_statements_are_not_allowed_in_an_async_function_block: diag(1300, ts.DiagnosticCategory.Error, "with_statements_are_not_allowed_in_an_async_function_block_1300", "'with' statements are not allowed in an async function block."),
await_expression_is_only_allowed_within_an_async_function: diag(1308, ts.DiagnosticCategory.Error, "await_expression_is_only_allowed_within_an_async_function_1308", "'await' expression is only allowed within an async function."),
can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment: diag(1312, ts.DiagnosticCategory.Error, "can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment_1312", "'=' can only be used in an object literal property inside a destructuring assignment."),
@@ -5409,7 +5569,8 @@
A_bigint_literal_cannot_use_exponential_notation: diag(1352, ts.DiagnosticCategory.Error, "A_bigint_literal_cannot_use_exponential_notation_1352", "A bigint literal cannot use exponential notation."),
A_bigint_literal_must_be_an_integer: diag(1353, ts.DiagnosticCategory.Error, "A_bigint_literal_must_be_an_integer_1353", "A bigint literal must be an integer."),
readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types: diag(1354, ts.DiagnosticCategory.Error, "readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types_1354", "'readonly' type modifier is only permitted on array and tuple literal types."),
- A_const_assertion_can_only_be_applied_to_a_string_number_boolean_array_or_object_literal: diag(1355, ts.DiagnosticCategory.Error, "A_const_assertion_can_only_be_applied_to_a_string_number_boolean_array_or_object_literal_1355", "A 'const' assertion can only be applied to a string, number, boolean, array, or object literal."),
+ A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals: diag(1355, ts.DiagnosticCategory.Error, "A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array__1355", "A 'const' assertions can only be applied to references to enum members, or string, number, boolean, array, or object literals."),
+ Did_you_mean_to_mark_this_function_as_async: diag(1356, ts.DiagnosticCategory.Error, "Did_you_mean_to_mark_this_function_as_async_1356", "Did you mean to mark this function as 'async'?"),
Duplicate_identifier_0: diag(2300, ts.DiagnosticCategory.Error, "Duplicate_identifier_0_2300", "Duplicate identifier '{0}'."),
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: diag(2301, ts.DiagnosticCategory.Error, "Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor_2301", "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor."),
Static_members_cannot_reference_class_type_parameters: diag(2302, ts.DiagnosticCategory.Error, "Static_members_cannot_reference_class_type_parameters_2302", "Static members cannot reference class type parameters."),
@@ -5691,6 +5852,7 @@
Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_types_Slashnode_and_then_add_node_to_the_types_field_in_your_tsconfig: diag(2591, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_node_Try_npm_i_types_Slashnode_and_th_2591", "Cannot find name '{0}'. Do you need to install type definitions for node? Try `npm i @types/node` and then add `node` to the types field in your tsconfig."),
Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_types_Slashjquery_and_then_add_jquery_to_the_types_field_in_your_tsconfig: diag(2592, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_jQuery_Try_npm_i_types_Slashjquery_an_2592", "Cannot find name '{0}'. Do you need to install type definitions for jQuery? Try `npm i @types/jquery` and then add `jquery` to the types field in your tsconfig."),
Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_types_Slashjest_or_npm_i_types_Slashmocha_and_then_add_jest_or_mocha_to_the_types_field_in_your_tsconfig: diag(2593, ts.DiagnosticCategory.Error, "Cannot_find_name_0_Do_you_need_to_install_type_definitions_for_a_test_runner_Try_npm_i_types_Slashje_2593", "Cannot find name '{0}'. Do you need to install type definitions for a test runner? Try `npm i @types/jest` or `npm i @types/mocha` and then add `jest` or `mocha` to the types field in your tsconfig."),
+ This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag: diag(2594, ts.DiagnosticCategory.Error, "This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the__2594", "This module is declared with using 'export =', and can only be used with a default import when using the '{0}' flag."),
JSX_element_attributes_type_0_may_not_be_a_union_type: diag(2600, ts.DiagnosticCategory.Error, "JSX_element_attributes_type_0_may_not_be_a_union_type_2600", "JSX element attributes type '{0}' may not be a union type."),
The_return_type_of_a_JSX_element_constructor_must_return_an_object_type: diag(2601, ts.DiagnosticCategory.Error, "The_return_type_of_a_JSX_element_constructor_must_return_an_object_type_2601", "The return type of a JSX element constructor must return an object type."),
JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist: diag(2602, ts.DiagnosticCategory.Error, "JSX_element_implicitly_has_type_any_because_the_global_type_JSX_Element_does_not_exist_2602", "JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist."),
@@ -5803,6 +5965,7 @@
Circularity_originates_in_type_at_this_location: diag(2751, ts.DiagnosticCategory.Error, "Circularity_originates_in_type_at_this_location_2751", "Circularity originates in type at this location."),
The_first_export_default_is_here: diag(2752, ts.DiagnosticCategory.Error, "The_first_export_default_is_here_2752", "The first export default is here."),
Another_export_default_is_here: diag(2753, ts.DiagnosticCategory.Error, "Another_export_default_is_here_2753", "Another export default is here."),
+ super_may_not_use_type_arguments: diag(2754, ts.DiagnosticCategory.Error, "super_may_not_use_type_arguments_2754", "'super' may not use type arguments."),
Import_declaration_0_is_using_private_name_1: diag(4000, ts.DiagnosticCategory.Error, "Import_declaration_0_is_using_private_name_1_4000", "Import declaration '{0}' is using private name '{1}'."),
Type_parameter_0_of_exported_class_has_or_is_using_private_name_1: diag(4002, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_class_has_or_is_using_private_name_1_4002", "Type parameter '{0}' of exported class has or is using private name '{1}'."),
Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1: diag(4004, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1_4004", "Type parameter '{0}' of exported interface has or is using private name '{1}'."),
@@ -5887,6 +6050,7 @@
Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2: diag(4101, ts.DiagnosticCategory.Error, "Method_0_of_exported_interface_has_or_is_using_name_1_from_private_module_2_4101", "Method '{0}' of exported interface has or is using name '{1}' from private module '{2}'."),
Method_0_of_exported_interface_has_or_is_using_private_name_1: diag(4102, ts.DiagnosticCategory.Error, "Method_0_of_exported_interface_has_or_is_using_private_name_1_4102", "Method '{0}' of exported interface has or is using private name '{1}'."),
Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1: diag(4103, ts.DiagnosticCategory.Error, "Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1_4103", "Type parameter '{0}' of exported mapped object type is using private name '{1}'."),
+ The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1: diag(4104, ts.DiagnosticCategory.Error, "The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1_4104", "The type '{0}' is 'readonly' and cannot be assigned to the mutable type '{1}'."),
The_current_host_does_not_support_the_0_option: diag(5001, ts.DiagnosticCategory.Error, "The_current_host_does_not_support_the_0_option_5001", "The current host does not support the '{0}' option."),
Cannot_find_the_common_subdirectory_path_for_the_input_files: diag(5009, ts.DiagnosticCategory.Error, "Cannot_find_the_common_subdirectory_path_for_the_input_files_5009", "Cannot find the common subdirectory path for the input files."),
File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0: diag(5010, ts.DiagnosticCategory.Error, "File_specification_cannot_end_in_a_recursive_directory_wildcard_Asterisk_Asterisk_Colon_0_5010", "File specification cannot end in a recursive directory wildcard ('**'): '{0}'."),
@@ -5920,6 +6084,8 @@
Option_resolveJsonModule_can_only_be_specified_when_module_code_generation_is_commonjs_amd_es2015_or_esNext: diag(5071, ts.DiagnosticCategory.Error, "Option_resolveJsonModule_can_only_be_specified_when_module_code_generation_is_commonjs_amd_es2015_or_5071", "Option '--resolveJsonModule' can only be specified when module code generation is 'commonjs', 'amd', 'es2015' or 'esNext'."),
Unknown_build_option_0: diag(5072, ts.DiagnosticCategory.Error, "Unknown_build_option_0_5072", "Unknown build option '{0}'."),
Build_option_0_requires_a_value_of_type_1: diag(5073, ts.DiagnosticCategory.Error, "Build_option_0_requires_a_value_of_type_1_5073", "Build option '{0}' requires a value of type {1}."),
+ Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified: diag(5074, ts.DiagnosticCategory.Error, "Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBui_5074", "Option '--incremental' can only be specified using tsconfig, emitting to single file or when option `--tsBuildInfoFile` is specified."),
+ _0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_constraint_2: diag(5075, ts.DiagnosticCategory.Error, "_0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_5075", "'{0}' is assignable to the constraint of type '{1}', but '{1}' could be instantiated with a different subtype of constraint '{2}'."),
Generates_a_sourcemap_for_each_corresponding_d_ts_file: diag(6000, ts.DiagnosticCategory.Message, "Generates_a_sourcemap_for_each_corresponding_d_ts_file_6000", "Generates a sourcemap for each corresponding '.d.ts' file."),
Concatenate_and_emit_output_to_single_file: diag(6001, ts.DiagnosticCategory.Message, "Concatenate_and_emit_output_to_single_file_6001", "Concatenate and emit output to single file."),
Generates_corresponding_d_ts_file: diag(6002, ts.DiagnosticCategory.Message, "Generates_corresponding_d_ts_file_6002", "Generates corresponding '.d.ts' file."),
@@ -6096,7 +6262,6 @@
Enable_strict_checking_of_property_initialization_in_classes: diag(6187, ts.DiagnosticCategory.Message, "Enable_strict_checking_of_property_initialization_in_classes_6187", "Enable strict checking of property initialization in classes."),
Numeric_separators_are_not_allowed_here: diag(6188, ts.DiagnosticCategory.Error, "Numeric_separators_are_not_allowed_here_6188", "Numeric separators are not allowed here."),
Multiple_consecutive_numeric_separators_are_not_permitted: diag(6189, ts.DiagnosticCategory.Error, "Multiple_consecutive_numeric_separators_are_not_permitted_6189", "Multiple consecutive numeric separators are not permitted."),
- Found_package_json_at_0_Package_ID_is_1: diag(6190, ts.DiagnosticCategory.Message, "Found_package_json_at_0_Package_ID_is_1_6190", "Found 'package.json' at '{0}'. Package ID is '{1}'."),
Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen: diag(6191, ts.DiagnosticCategory.Message, "Whether_to_keep_outdated_console_output_in_watch_mode_instead_of_clearing_the_screen_6191", "Whether to keep outdated console output in watch mode instead of clearing the screen."),
All_imports_in_import_declaration_are_unused: diag(6192, ts.DiagnosticCategory.Error, "All_imports_in_import_declaration_are_unused_6192", "All imports in import declaration are unused.", /*reportsUnnecessary*/ true),
Found_1_error_Watching_for_file_changes: diag(6193, ts.DiagnosticCategory.Message, "Found_1_error_Watching_for_file_changes_6193", "Found 1 error. Watching for file changes."),
@@ -6123,6 +6288,9 @@
Using_compiler_options_of_project_reference_redirect_0: diag(6215, ts.DiagnosticCategory.Message, "Using_compiler_options_of_project_reference_redirect_0_6215", "Using compiler options of project reference redirect '{0}'."),
Found_1_error: diag(6216, ts.DiagnosticCategory.Message, "Found_1_error_6216", "Found 1 error."),
Found_0_errors: diag(6217, ts.DiagnosticCategory.Message, "Found_0_errors_6217", "Found {0} errors."),
+ Module_name_0_was_successfully_resolved_to_1_with_Package_ID_2: diag(6218, ts.DiagnosticCategory.Message, "Module_name_0_was_successfully_resolved_to_1_with_Package_ID_2_6218", "======== Module name '{0}' was successfully resolved to '{1}' with Package ID '{2}'. ========"),
+ Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3: diag(6219, ts.DiagnosticCategory.Message, "Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3_6219", "======== Type reference directive '{0}' was successfully resolved to '{1}' with Package ID '{2}', primary: {3}. ========"),
+ package_json_had_a_falsy_0_field: diag(6220, ts.DiagnosticCategory.Message, "package_json_had_a_falsy_0_field_6220", "'package.json' had a falsy '{0}' field."),
Projects_to_reference: diag(6300, ts.DiagnosticCategory.Message, "Projects_to_reference_6300", "Projects to reference"),
Enable_project_compilation: diag(6302, ts.DiagnosticCategory.Message, "Enable_project_compilation_6302", "Enable project compilation"),
Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0: diag(6202, ts.DiagnosticCategory.Error, "Project_references_may_not_form_a_circular_graph_Cycle_detected_Colon_0_6202", "Project references may not form a circular graph. Cycle detected: {0}"),
@@ -6211,6 +6379,9 @@
Property_0_implicitly_has_type_any_but_a_better_type_for_its_set_accessor_may_be_inferred_from_usage: diag(7049, ts.DiagnosticCategory.Suggestion, "Property_0_implicitly_has_type_any_but_a_better_type_for_its_set_accessor_may_be_inferred_from_usage_7049", "Property '{0}' implicitly has type 'any', but a better type for its set accessor may be inferred from usage."),
_0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage: diag(7050, ts.DiagnosticCategory.Suggestion, "_0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage_7050", "'{0}' implicitly has an '{1}' return type, but a better type may be inferred from usage."),
Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1: diag(7051, ts.DiagnosticCategory.Error, "Parameter_has_a_name_but_no_type_Did_you_mean_0_Colon_1_7051", "Parameter has a name but no type. Did you mean '{0}: {1}'?"),
+ Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1: diag(7052, ts.DiagnosticCategory.Error, "Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1_7052", "Element implicitly has an 'any' type because type '{0}' has no index signature. Did you mean to call '{1}' ?"),
+ Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1: diag(7053, ts.DiagnosticCategory.Error, "Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1_7053", "Element implicitly has an 'any' type because expression of type '{0}' can't be used to index type '{1}'."),
+ No_index_signature_with_a_parameter_of_type_0_was_found_on_type_1: diag(7054, ts.DiagnosticCategory.Error, "No_index_signature_with_a_parameter_of_type_0_was_found_on_type_1_7054", "No index signature with a parameter of type '{0}' was found on type '{1}'."),
You_cannot_rename_this_element: diag(8000, ts.DiagnosticCategory.Error, "You_cannot_rename_this_element_8000", "You cannot rename this element."),
You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library: diag(8001, ts.DiagnosticCategory.Error, "You_cannot_rename_elements_that_are_defined_in_the_standard_TypeScript_library_8001", "You cannot rename elements that are defined in the standard TypeScript library."),
import_can_only_be_used_in_a_ts_file: diag(8002, ts.DiagnosticCategory.Error, "import_can_only_be_used_in_a_ts_file_8002", "'import ... =' can only be used in a .ts file."),
@@ -6372,8 +6543,6 @@
Add_all_missing_imports: diag(95064, ts.DiagnosticCategory.Message, "Add_all_missing_imports_95064", "Add all missing imports"),
Convert_to_async_function: diag(95065, ts.DiagnosticCategory.Message, "Convert_to_async_function_95065", "Convert to async function"),
Convert_all_to_async_functions: diag(95066, ts.DiagnosticCategory.Message, "Convert_all_to_async_functions_95066", "Convert all to async functions"),
- Generate_types_for_0: diag(95067, ts.DiagnosticCategory.Message, "Generate_types_for_0_95067", "Generate types for '{0}'"),
- Generate_types_for_all_packages_without_types: diag(95068, ts.DiagnosticCategory.Message, "Generate_types_for_all_packages_without_types_95068", "Generate types for all packages without types"),
Add_unknown_conversion_for_non_overlapping_types: diag(95069, ts.DiagnosticCategory.Message, "Add_unknown_conversion_for_non_overlapping_types_95069", "Add 'unknown' conversion for non-overlapping types"),
Add_unknown_to_all_conversions_of_non_overlapping_types: diag(95070, ts.DiagnosticCategory.Message, "Add_unknown_to_all_conversions_of_non_overlapping_types_95070", "Add 'unknown' to all conversions of non-overlapping types"),
Add_missing_new_operator_to_call: diag(95071, ts.DiagnosticCategory.Message, "Add_missing_new_operator_to_call_95071", "Add missing 'new' operator to call"),
@@ -6381,6 +6550,13 @@
Add_names_to_all_parameters_without_names: diag(95073, ts.DiagnosticCategory.Message, "Add_names_to_all_parameters_without_names_95073", "Add names to all parameters without names"),
Enable_the_experimentalDecorators_option_in_your_configuration_file: diag(95074, ts.DiagnosticCategory.Message, "Enable_the_experimentalDecorators_option_in_your_configuration_file_95074", "Enable the 'experimentalDecorators' option in your configuration file"),
Convert_parameters_to_destructured_object: diag(95075, ts.DiagnosticCategory.Message, "Convert_parameters_to_destructured_object_95075", "Convert parameters to destructured object"),
+ Allow_accessing_UMD_globals_from_modules: diag(95076, ts.DiagnosticCategory.Message, "Allow_accessing_UMD_globals_from_modules_95076", "Allow accessing UMD globals from modules."),
+ Extract_type: diag(95077, ts.DiagnosticCategory.Message, "Extract_type_95077", "Extract type"),
+ Extract_to_type_alias: diag(95078, ts.DiagnosticCategory.Message, "Extract_to_type_alias_95078", "Extract to type alias"),
+ Extract_to_typedef: diag(95079, ts.DiagnosticCategory.Message, "Extract_to_typedef_95079", "Extract to typedef"),
+ No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer: diag(18004, ts.DiagnosticCategory.Error, "No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer_18004", "No value exists in scope for the shorthand property '{0}'. Either declare one or provide an initializer."),
+ Quoted_constructors_have_previously_been_interpreted_as_methods_which_is_incorrect_In_TypeScript_3_6_they_will_be_correctly_parsed_as_constructors_In_the_meantime_consider_using_constructor_to_write_a_constructor_or_constructor_to_write_a_method: diag(18005, ts.DiagnosticCategory.Error, "Quoted_constructors_have_previously_been_interpreted_as_methods_which_is_incorrect_In_TypeScript_3_6_18005", "Quoted constructors have previously been interpreted as methods, which is incorrect. In TypeScript 3.6, they will be correctly parsed as constructors. In the meantime, consider using 'constructor()' to write a constructor, or '[\"constructor\"]()' to write a method."),
+ Classes_may_not_have_a_field_named_constructor: diag(18006, ts.DiagnosticCategory.Error, "Classes_may_not_have_a_field_named_constructor_18006", "Classes may not have a field named 'constructor'."),
};
})(ts || (ts = {}));
var ts;
@@ -6388,7 +6564,7 @@
var _a;
/* @internal */
function tokenIsIdentifierOrKeyword(token) {
- return token >= 72 /* Identifier */;
+ return token >= 73 /* Identifier */;
}
ts.tokenIsIdentifierOrKeyword = tokenIsIdentifierOrKeyword;
/* @internal */
@@ -6397,85 +6573,85 @@
}
ts.tokenIsIdentifierOrKeywordOrGreaterThan = tokenIsIdentifierOrKeywordOrGreaterThan;
var textToKeywordObj = (_a = {
- abstract: 118 /* AbstractKeyword */,
- any: 120 /* AnyKeyword */,
- as: 119 /* AsKeyword */,
- bigint: 146 /* BigIntKeyword */,
- boolean: 123 /* BooleanKeyword */,
- break: 73 /* BreakKeyword */,
- case: 74 /* CaseKeyword */,
- catch: 75 /* CatchKeyword */,
- class: 76 /* ClassKeyword */,
- continue: 78 /* ContinueKeyword */,
- const: 77 /* ConstKeyword */
- },
- _a["" + "constructor"] = 124 /* ConstructorKeyword */,
- _a.debugger = 79 /* DebuggerKeyword */,
- _a.declare = 125 /* DeclareKeyword */,
- _a.default = 80 /* DefaultKeyword */,
- _a.delete = 81 /* DeleteKeyword */,
- _a.do = 82 /* DoKeyword */,
- _a.else = 83 /* ElseKeyword */,
- _a.enum = 84 /* EnumKeyword */,
- _a.export = 85 /* ExportKeyword */,
- _a.extends = 86 /* ExtendsKeyword */,
- _a.false = 87 /* FalseKeyword */,
- _a.finally = 88 /* FinallyKeyword */,
- _a.for = 89 /* ForKeyword */,
- _a.from = 144 /* FromKeyword */,
- _a.function = 90 /* FunctionKeyword */,
- _a.get = 126 /* GetKeyword */,
- _a.if = 91 /* IfKeyword */,
- _a.implements = 109 /* ImplementsKeyword */,
- _a.import = 92 /* ImportKeyword */,
- _a.in = 93 /* InKeyword */,
- _a.infer = 127 /* InferKeyword */,
- _a.instanceof = 94 /* InstanceOfKeyword */,
- _a.interface = 110 /* InterfaceKeyword */,
- _a.is = 128 /* IsKeyword */,
- _a.keyof = 129 /* KeyOfKeyword */,
- _a.let = 111 /* LetKeyword */,
- _a.module = 130 /* ModuleKeyword */,
- _a.namespace = 131 /* NamespaceKeyword */,
- _a.never = 132 /* NeverKeyword */,
- _a.new = 95 /* NewKeyword */,
- _a.null = 96 /* NullKeyword */,
- _a.number = 135 /* NumberKeyword */,
- _a.object = 136 /* ObjectKeyword */,
- _a.package = 112 /* PackageKeyword */,
- _a.private = 113 /* PrivateKeyword */,
- _a.protected = 114 /* ProtectedKeyword */,
- _a.public = 115 /* PublicKeyword */,
- _a.readonly = 133 /* ReadonlyKeyword */,
- _a.require = 134 /* RequireKeyword */,
- _a.global = 145 /* GlobalKeyword */,
- _a.return = 97 /* ReturnKeyword */,
- _a.set = 137 /* SetKeyword */,
- _a.static = 116 /* StaticKeyword */,
- _a.string = 138 /* StringKeyword */,
- _a.super = 98 /* SuperKeyword */,
- _a.switch = 99 /* SwitchKeyword */,
- _a.symbol = 139 /* SymbolKeyword */,
- _a.this = 100 /* ThisKeyword */,
- _a.throw = 101 /* ThrowKeyword */,
- _a.true = 102 /* TrueKeyword */,
- _a.try = 103 /* TryKeyword */,
- _a.type = 140 /* TypeKeyword */,
- _a.typeof = 104 /* TypeOfKeyword */,
- _a.undefined = 141 /* UndefinedKeyword */,
- _a.unique = 142 /* UniqueKeyword */,
- _a.unknown = 143 /* UnknownKeyword */,
- _a.var = 105 /* VarKeyword */,
- _a.void = 106 /* VoidKeyword */,
- _a.while = 107 /* WhileKeyword */,
- _a.with = 108 /* WithKeyword */,
- _a.yield = 117 /* YieldKeyword */,
- _a.async = 121 /* AsyncKeyword */,
- _a.await = 122 /* AwaitKeyword */,
- _a.of = 147 /* OfKeyword */,
+ abstract: 119 /* AbstractKeyword */,
+ any: 121 /* AnyKeyword */,
+ as: 120 /* AsKeyword */,
+ bigint: 147 /* BigIntKeyword */,
+ boolean: 124 /* BooleanKeyword */,
+ break: 74 /* BreakKeyword */,
+ case: 75 /* CaseKeyword */,
+ catch: 76 /* CatchKeyword */,
+ class: 77 /* ClassKeyword */,
+ continue: 79 /* ContinueKeyword */,
+ const: 78 /* ConstKeyword */
+ },
+ _a["" + "constructor"] = 125 /* ConstructorKeyword */,
+ _a.debugger = 80 /* DebuggerKeyword */,
+ _a.declare = 126 /* DeclareKeyword */,
+ _a.default = 81 /* DefaultKeyword */,
+ _a.delete = 82 /* DeleteKeyword */,
+ _a.do = 83 /* DoKeyword */,
+ _a.else = 84 /* ElseKeyword */,
+ _a.enum = 85 /* EnumKeyword */,
+ _a.export = 86 /* ExportKeyword */,
+ _a.extends = 87 /* ExtendsKeyword */,
+ _a.false = 88 /* FalseKeyword */,
+ _a.finally = 89 /* FinallyKeyword */,
+ _a.for = 90 /* ForKeyword */,
+ _a.from = 145 /* FromKeyword */,
+ _a.function = 91 /* FunctionKeyword */,
+ _a.get = 127 /* GetKeyword */,
+ _a.if = 92 /* IfKeyword */,
+ _a.implements = 110 /* ImplementsKeyword */,
+ _a.import = 93 /* ImportKeyword */,
+ _a.in = 94 /* InKeyword */,
+ _a.infer = 128 /* InferKeyword */,
+ _a.instanceof = 95 /* InstanceOfKeyword */,
+ _a.interface = 111 /* InterfaceKeyword */,
+ _a.is = 129 /* IsKeyword */,
+ _a.keyof = 130 /* KeyOfKeyword */,
+ _a.let = 112 /* LetKeyword */,
+ _a.module = 131 /* ModuleKeyword */,
+ _a.namespace = 132 /* NamespaceKeyword */,
+ _a.never = 133 /* NeverKeyword */,
+ _a.new = 96 /* NewKeyword */,
+ _a.null = 97 /* NullKeyword */,
+ _a.number = 136 /* NumberKeyword */,
+ _a.object = 137 /* ObjectKeyword */,
+ _a.package = 113 /* PackageKeyword */,
+ _a.private = 114 /* PrivateKeyword */,
+ _a.protected = 115 /* ProtectedKeyword */,
+ _a.public = 116 /* PublicKeyword */,
+ _a.readonly = 134 /* ReadonlyKeyword */,
+ _a.require = 135 /* RequireKeyword */,
+ _a.global = 146 /* GlobalKeyword */,
+ _a.return = 98 /* ReturnKeyword */,
+ _a.set = 138 /* SetKeyword */,
+ _a.static = 117 /* StaticKeyword */,
+ _a.string = 139 /* StringKeyword */,
+ _a.super = 99 /* SuperKeyword */,
+ _a.switch = 100 /* SwitchKeyword */,
+ _a.symbol = 140 /* SymbolKeyword */,
+ _a.this = 101 /* ThisKeyword */,
+ _a.throw = 102 /* ThrowKeyword */,
+ _a.true = 103 /* TrueKeyword */,
+ _a.try = 104 /* TryKeyword */,
+ _a.type = 141 /* TypeKeyword */,
+ _a.typeof = 105 /* TypeOfKeyword */,
+ _a.undefined = 142 /* UndefinedKeyword */,
+ _a.unique = 143 /* UniqueKeyword */,
+ _a.unknown = 144 /* UnknownKeyword */,
+ _a.var = 106 /* VarKeyword */,
+ _a.void = 107 /* VoidKeyword */,
+ _a.while = 108 /* WhileKeyword */,
+ _a.with = 109 /* WithKeyword */,
+ _a.yield = 118 /* YieldKeyword */,
+ _a.async = 122 /* AsyncKeyword */,
+ _a.await = 123 /* AwaitKeyword */,
+ _a.of = 148 /* OfKeyword */,
_a);
var textToKeyword = ts.createMapFromTemplate(textToKeywordObj);
- var textToToken = ts.createMapFromTemplate(__assign({}, textToKeywordObj, { "{": 18 /* OpenBraceToken */, "}": 19 /* CloseBraceToken */, "(": 20 /* OpenParenToken */, ")": 21 /* CloseParenToken */, "[": 22 /* OpenBracketToken */, "]": 23 /* CloseBracketToken */, ".": 24 /* DotToken */, "...": 25 /* DotDotDotToken */, ";": 26 /* SemicolonToken */, ",": 27 /* CommaToken */, "<": 28 /* LessThanToken */, ">": 30 /* GreaterThanToken */, "<=": 31 /* LessThanEqualsToken */, ">=": 32 /* GreaterThanEqualsToken */, "==": 33 /* EqualsEqualsToken */, "!=": 34 /* ExclamationEqualsToken */, "===": 35 /* EqualsEqualsEqualsToken */, "!==": 36 /* ExclamationEqualsEqualsToken */, "=>": 37 /* EqualsGreaterThanToken */, "+": 38 /* PlusToken */, "-": 39 /* MinusToken */, "**": 41 /* AsteriskAsteriskToken */, "*": 40 /* AsteriskToken */, "/": 42 /* SlashToken */, "%": 43 /* PercentToken */, "++": 44 /* PlusPlusToken */, "--": 45 /* MinusMinusToken */, "<<": 46 /* LessThanLessThanToken */, "</": 29 /* LessThanSlashToken */, ">>": 47 /* GreaterThanGreaterThanToken */, ">>>": 48 /* GreaterThanGreaterThanGreaterThanToken */, "&": 49 /* AmpersandToken */, "|": 50 /* BarToken */, "^": 51 /* CaretToken */, "!": 52 /* ExclamationToken */, "~": 53 /* TildeToken */, "&&": 54 /* AmpersandAmpersandToken */, "||": 55 /* BarBarToken */, "?": 56 /* QuestionToken */, ":": 57 /* ColonToken */, "=": 59 /* EqualsToken */, "+=": 60 /* PlusEqualsToken */, "-=": 61 /* MinusEqualsToken */, "*=": 62 /* AsteriskEqualsToken */, "**=": 63 /* AsteriskAsteriskEqualsToken */, "/=": 64 /* SlashEqualsToken */, "%=": 65 /* PercentEqualsToken */, "<<=": 66 /* LessThanLessThanEqualsToken */, ">>=": 67 /* GreaterThanGreaterThanEqualsToken */, ">>>=": 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */, "&=": 69 /* AmpersandEqualsToken */, "|=": 70 /* BarEqualsToken */, "^=": 71 /* CaretEqualsToken */, "@": 58 /* AtToken */ }));
+ var textToToken = ts.createMapFromTemplate(__assign({}, textToKeywordObj, { "{": 18 /* OpenBraceToken */, "}": 19 /* CloseBraceToken */, "(": 20 /* OpenParenToken */, ")": 21 /* CloseParenToken */, "[": 22 /* OpenBracketToken */, "]": 23 /* CloseBracketToken */, ".": 24 /* DotToken */, "...": 25 /* DotDotDotToken */, ";": 26 /* SemicolonToken */, ",": 27 /* CommaToken */, "<": 28 /* LessThanToken */, ">": 30 /* GreaterThanToken */, "<=": 31 /* LessThanEqualsToken */, ">=": 32 /* GreaterThanEqualsToken */, "==": 33 /* EqualsEqualsToken */, "!=": 34 /* ExclamationEqualsToken */, "===": 35 /* EqualsEqualsEqualsToken */, "!==": 36 /* ExclamationEqualsEqualsToken */, "=>": 37 /* EqualsGreaterThanToken */, "+": 38 /* PlusToken */, "-": 39 /* MinusToken */, "**": 41 /* AsteriskAsteriskToken */, "*": 40 /* AsteriskToken */, "/": 42 /* SlashToken */, "%": 43 /* PercentToken */, "++": 44 /* PlusPlusToken */, "--": 45 /* MinusMinusToken */, "<<": 46 /* LessThanLessThanToken */, "</": 29 /* LessThanSlashToken */, ">>": 47 /* GreaterThanGreaterThanToken */, ">>>": 48 /* GreaterThanGreaterThanGreaterThanToken */, "&": 49 /* AmpersandToken */, "|": 50 /* BarToken */, "^": 51 /* CaretToken */, "!": 52 /* ExclamationToken */, "~": 53 /* TildeToken */, "&&": 54 /* AmpersandAmpersandToken */, "||": 55 /* BarBarToken */, "?": 56 /* QuestionToken */, ":": 57 /* ColonToken */, "=": 60 /* EqualsToken */, "+=": 61 /* PlusEqualsToken */, "-=": 62 /* MinusEqualsToken */, "*=": 63 /* AsteriskEqualsToken */, "**=": 64 /* AsteriskAsteriskEqualsToken */, "/=": 65 /* SlashEqualsToken */, "%=": 66 /* PercentEqualsToken */, "<<=": 67 /* LessThanLessThanEqualsToken */, ">>=": 68 /* GreaterThanGreaterThanEqualsToken */, ">>>=": 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */, "&=": 70 /* AmpersandEqualsToken */, "|=": 71 /* BarEqualsToken */, "^=": 72 /* CaretEqualsToken */, "@": 58 /* AtToken */ }));
/*
As per ECMAScript Language Specification 3th Edition, Section 7.6: Identifiers
IdentifierStart ::
@@ -7089,8 +7265,8 @@
getTokenValue: function () { return tokenValue; },
hasExtendedUnicodeEscape: function () { return (tokenFlags & 8 /* ExtendedUnicodeEscape */) !== 0; },
hasPrecedingLineBreak: function () { return (tokenFlags & 1 /* PrecedingLineBreak */) !== 0; },
- isIdentifier: function () { return token === 72 /* Identifier */ || token > 108 /* LastReservedWord */; },
- isReservedWord: function () { return token >= 73 /* FirstReservedWord */ && token <= 108 /* LastReservedWord */; },
+ isIdentifier: function () { return token === 73 /* Identifier */ || token > 109 /* LastReservedWord */; },
+ isReservedWord: function () { return token >= 74 /* FirstReservedWord */ && token <= 109 /* LastReservedWord */; },
isUnterminated: function () { return (tokenFlags & 4 /* Unterminated */) !== 0; },
getTokenFlags: function () { return tokenFlags; },
reScanGreaterToken: reScanGreaterToken,
@@ -7101,7 +7277,7 @@
reScanJsxToken: reScanJsxToken,
reScanLessThanToken: reScanLessThanToken,
scanJsxToken: scanJsxToken,
- scanJSDocToken: scanJSDocToken,
+ scanJsDocToken: scanJsDocToken,
scan: scan,
getText: getText,
setText: setText,
@@ -7541,7 +7717,7 @@
}
}
}
- return token = 72 /* Identifier */;
+ return token = 73 /* Identifier */;
}
function scanBinaryOrOctalDigits(base) {
var value = "";
@@ -7690,7 +7866,7 @@
return token = scanTemplateAndSetTokenValue();
case 37 /* percent */:
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 65 /* PercentEqualsToken */;
+ return pos += 2, token = 66 /* PercentEqualsToken */;
}
pos++;
return token = 43 /* PercentToken */;
@@ -7699,7 +7875,7 @@
return pos += 2, token = 54 /* AmpersandAmpersandToken */;
}
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 69 /* AmpersandEqualsToken */;
+ return pos += 2, token = 70 /* AmpersandEqualsToken */;
}
pos++;
return token = 49 /* AmpersandToken */;
@@ -7711,11 +7887,11 @@
return token = 21 /* CloseParenToken */;
case 42 /* asterisk */:
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 62 /* AsteriskEqualsToken */;
+ return pos += 2, token = 63 /* AsteriskEqualsToken */;
}
if (text.charCodeAt(pos + 1) === 42 /* asterisk */) {
if (text.charCodeAt(pos + 2) === 61 /* equals */) {
- return pos += 3, token = 63 /* AsteriskAsteriskEqualsToken */;
+ return pos += 3, token = 64 /* AsteriskAsteriskEqualsToken */;
}
return pos += 2, token = 41 /* AsteriskAsteriskToken */;
}
@@ -7731,7 +7907,7 @@
return pos += 2, token = 44 /* PlusPlusToken */;
}
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 60 /* PlusEqualsToken */;
+ return pos += 2, token = 61 /* PlusEqualsToken */;
}
pos++;
return token = 38 /* PlusToken */;
@@ -7743,7 +7919,7 @@
return pos += 2, token = 45 /* MinusMinusToken */;
}
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 61 /* MinusEqualsToken */;
+ return pos += 2, token = 62 /* MinusEqualsToken */;
}
pos++;
return token = 39 /* MinusToken */;
@@ -7807,7 +7983,7 @@
}
}
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 64 /* SlashEqualsToken */;
+ return pos += 2, token = 65 /* SlashEqualsToken */;
}
pos++;
return token = 42 /* SlashToken */;
@@ -7884,7 +8060,7 @@
}
if (text.charCodeAt(pos + 1) === 60 /* lessThan */) {
if (text.charCodeAt(pos + 2) === 61 /* equals */) {
- return pos += 3, token = 66 /* LessThanLessThanEqualsToken */;
+ return pos += 3, token = 67 /* LessThanLessThanEqualsToken */;
}
return pos += 2, token = 46 /* LessThanLessThanToken */;
}
@@ -7918,7 +8094,7 @@
return pos += 2, token = 37 /* EqualsGreaterThanToken */;
}
pos++;
- return token = 59 /* EqualsToken */;
+ return token = 60 /* EqualsToken */;
case 62 /* greaterThan */:
if (isConflictMarkerTrivia(text, pos)) {
pos = scanConflictMarkerTrivia(text, pos, error);
@@ -7942,7 +8118,7 @@
return token = 23 /* CloseBracketToken */;
case 94 /* caret */:
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 71 /* CaretEqualsToken */;
+ return pos += 2, token = 72 /* CaretEqualsToken */;
}
pos++;
return token = 51 /* CaretToken */;
@@ -7963,7 +8139,7 @@
return pos += 2, token = 55 /* BarBarToken */;
}
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 70 /* BarEqualsToken */;
+ return pos += 2, token = 71 /* BarEqualsToken */;
}
pos++;
return token = 50 /* BarToken */;
@@ -8017,12 +8193,12 @@
if (text.charCodeAt(pos) === 62 /* greaterThan */) {
if (text.charCodeAt(pos + 1) === 62 /* greaterThan */) {
if (text.charCodeAt(pos + 2) === 61 /* equals */) {
- return pos += 3, token = 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */;
+ return pos += 3, token = 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */;
}
return pos += 2, token = 48 /* GreaterThanGreaterThanGreaterThanToken */;
}
if (text.charCodeAt(pos + 1) === 61 /* equals */) {
- return pos += 2, token = 67 /* GreaterThanGreaterThanEqualsToken */;
+ return pos += 2, token = 68 /* GreaterThanGreaterThanEqualsToken */;
}
pos++;
return token = 47 /* GreaterThanGreaterThanToken */;
@@ -8035,7 +8211,7 @@
return token;
}
function reScanSlashToken() {
- if (token === 42 /* SlashToken */ || token === 64 /* SlashEqualsToken */) {
+ if (token === 42 /* SlashToken */ || token === 65 /* SlashEqualsToken */) {
var p = tokenPos + 1;
var inEscape = false;
var inCharacterClass = false;
@@ -8184,7 +8360,7 @@
return scan();
}
}
- function scanJSDocToken() {
+ function scanJsDocToken() {
startPos = tokenPos = pos;
tokenFlags = 0;
if (pos >= end) {
@@ -8220,21 +8396,16 @@
case 60 /* lessThan */:
return token = 28 /* LessThanToken */;
case 61 /* equals */:
- return token = 59 /* EqualsToken */;
+ return token = 60 /* EqualsToken */;
case 44 /* comma */:
return token = 27 /* CommaToken */;
case 46 /* dot */:
return token = 24 /* DotToken */;
case 96 /* backtick */:
- while (pos < end && text.charCodeAt(pos) !== 96 /* backtick */) {
- pos++;
+ return token = 59 /* BacktickToken */;
}
- tokenValue = text.substring(tokenPos + 1, pos);
- pos++;
- return token = 14 /* NoSubstitutionTemplateLiteral */;
- }
- if (isIdentifierStart(ch, 7 /* Latest */)) {
- while (isIdentifierPart(text.charCodeAt(pos), 7 /* Latest */) && pos < end) {
+ if (isIdentifierStart(ch, 8 /* Latest */)) {
+ while (isIdentifierPart(text.charCodeAt(pos), 8 /* Latest */) && pos < end) {
pos++;
}
tokenValue = text.substring(tokenPos, pos);
@@ -8419,11 +8590,16 @@
}
ts.toPath = toPath;
function changesAffectModuleResolution(oldOptions, newOptions) {
- return oldOptions.configFilePath !== newOptions.configFilePath || ts.moduleResolutionOptionDeclarations.some(function (o) {
+ return oldOptions.configFilePath !== newOptions.configFilePath ||
+ optionsHaveModuleResolutionChanges(oldOptions, newOptions);
+ }
+ ts.changesAffectModuleResolution = changesAffectModuleResolution;
+ function optionsHaveModuleResolutionChanges(oldOptions, newOptions) {
+ return ts.moduleResolutionOptionDeclarations.some(function (o) {
return !ts.isJsonEqual(ts.getCompilerOptionValue(oldOptions, o), ts.getCompilerOptionValue(newOptions, o));
});
}
- ts.changesAffectModuleResolution = changesAffectModuleResolution;
+ ts.optionsHaveModuleResolutionChanges = optionsHaveModuleResolutionChanges;
function findAncestor(node, callback) {
while (node) {
var result = callback(node);
@@ -8592,7 +8768,7 @@
}
}
function getSourceFileOfNode(node) {
- while (node && node.kind !== 284 /* SourceFile */) {
+ while (node && node.kind !== 285 /* SourceFile */) {
node = node.parent;
}
return node;
@@ -8600,11 +8776,11 @@
ts.getSourceFileOfNode = getSourceFileOfNode;
function isStatementWithLocals(node) {
switch (node.kind) {
- case 218 /* Block */:
- case 246 /* CaseBlock */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 219 /* Block */:
+ case 247 /* CaseBlock */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
return true;
}
return false;
@@ -8772,7 +8948,7 @@
// the syntax list itself considers them as normal trivia. Therefore if we simply skip
// trivia for the list, we may have skipped the JSDocComment as well. So we should process its
// first child to determine the actual position of its first token.
- if (node.kind === 311 /* SyntaxList */ && node._children.length > 0) {
+ if (node.kind === 312 /* SyntaxList */ && node._children.length > 0) {
return getTokenPosOfNode(node._children[0], sourceFile, includeJsDoc);
}
return ts.skipTrivia((sourceFile || getSourceFileOfNode(node)).text, node.pos);
@@ -8791,7 +8967,7 @@
}
ts.getSourceTextOfNodeFromSourceFile = getSourceTextOfNodeFromSourceFile;
function isJSDocTypeExpressionOrChild(node) {
- return node.kind === 288 /* JSDocTypeExpression */ || (node.parent && isJSDocTypeExpressionOrChild(node.parent));
+ return node.kind === 289 /* JSDocTypeExpression */ || (node.parent && isJSDocTypeExpressionOrChild(node.parent));
}
function getTextOfNodeFromSourceText(sourceText, node, includeTrivia) {
if (includeTrivia === void 0) { includeTrivia = false; }
@@ -8883,7 +9059,7 @@
ts.isBlockOrCatchScoped = isBlockOrCatchScoped;
function isCatchClauseVariableDeclarationOrBindingElement(declaration) {
var node = getRootDeclaration(declaration);
- return node.kind === 237 /* VariableDeclaration */ && node.parent.kind === 274 /* CatchClause */;
+ return node.kind === 238 /* VariableDeclaration */ && node.parent.kind === 275 /* CatchClause */;
}
ts.isCatchClauseVariableDeclarationOrBindingElement = isCatchClauseVariableDeclarationOrBindingElement;
function isAmbientModule(node) {
@@ -8915,11 +9091,11 @@
ts.isShorthandAmbientModuleSymbol = isShorthandAmbientModuleSymbol;
function isShorthandAmbientModule(node) {
// The only kind of module that can be missing a body is a shorthand ambient module.
- return node && node.kind === 244 /* ModuleDeclaration */ && (!node.body);
+ return node && node.kind === 245 /* ModuleDeclaration */ && (!node.body);
}
function isBlockScopedContainerTopLevel(node) {
- return node.kind === 284 /* SourceFile */ ||
- node.kind === 244 /* ModuleDeclaration */ ||
+ return node.kind === 285 /* SourceFile */ ||
+ node.kind === 245 /* ModuleDeclaration */ ||
ts.isFunctionLike(node);
}
ts.isBlockScopedContainerTopLevel = isBlockScopedContainerTopLevel;
@@ -8936,9 +9112,9 @@
// - defined in the top level scope and source file is an external module
// - defined inside ambient module declaration located in the top level scope and source file not an external module
switch (node.parent.kind) {
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return ts.isExternalModule(node.parent);
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
return isAmbientModule(node.parent.parent) && ts.isSourceFile(node.parent.parent.parent) && !ts.isExternalModule(node.parent.parent.parent);
}
return false;
@@ -8954,22 +9130,22 @@
ts.isEffectiveExternalModule = isEffectiveExternalModule;
function isBlockScope(node, parentNode) {
switch (node.kind) {
- case 284 /* SourceFile */:
- case 246 /* CaseBlock */:
- case 274 /* CatchClause */:
- case 244 /* ModuleDeclaration */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 157 /* Constructor */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 285 /* SourceFile */:
+ case 247 /* CaseBlock */:
+ case 275 /* CatchClause */:
+ case 245 /* ModuleDeclaration */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 158 /* Constructor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return true;
- case 218 /* Block */:
+ case 219 /* Block */:
// function block is not considered block-scope container
// see comment in binder.ts: bind(...), case for SyntaxKind.Block
return !ts.isFunctionLike(parentNode);
@@ -8979,9 +9155,9 @@
ts.isBlockScope = isBlockScope;
function isDeclarationWithTypeParameters(node) {
switch (node.kind) {
- case 302 /* JSDocCallbackTag */:
- case 309 /* JSDocTypedefTag */:
- case 298 /* JSDocSignature */:
+ case 303 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 299 /* JSDocSignature */:
return true;
default:
ts.assertType(node);
@@ -8991,25 +9167,25 @@
ts.isDeclarationWithTypeParameters = isDeclarationWithTypeParameters;
function isDeclarationWithTypeParameterChildren(node) {
switch (node.kind) {
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 155 /* MethodSignature */:
- case 162 /* IndexSignature */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 294 /* JSDocFunctionType */:
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 308 /* JSDocTemplateTag */:
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 156 /* MethodSignature */:
+ case 163 /* IndexSignature */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 295 /* JSDocFunctionType */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 309 /* JSDocTemplateTag */:
+ case 240 /* FunctionDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return true;
default:
ts.assertType(node);
@@ -9019,8 +9195,8 @@
ts.isDeclarationWithTypeParameterChildren = isDeclarationWithTypeParameterChildren;
function isAnyImportSyntax(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return true;
default:
return false;
@@ -9029,15 +9205,15 @@
ts.isAnyImportSyntax = isAnyImportSyntax;
function isLateVisibilityPaintedStatement(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
- case 219 /* VariableStatement */:
- case 240 /* ClassDeclaration */:
- case 239 /* FunctionDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 220 /* VariableStatement */:
+ case 241 /* ClassDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
return true;
default:
return false;
@@ -9067,13 +9243,13 @@
ts.getNameFromIndexInfo = getNameFromIndexInfo;
function getTextOfPropertyName(name) {
switch (name.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return name.escapedText;
case 10 /* StringLiteral */:
case 8 /* NumericLiteral */:
case 14 /* NoSubstitutionTemplateLiteral */:
return ts.escapeLeadingUnderscores(name.text);
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
if (isStringOrNumericLiteralLike(name.expression))
return ts.escapeLeadingUnderscores(name.expression.text);
return ts.Debug.fail("Text of property name cannot be read from non-literal-valued ComputedPropertyNames");
@@ -9084,11 +9260,11 @@
ts.getTextOfPropertyName = getTextOfPropertyName;
function entityNameToString(name) {
switch (name.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return getFullWidth(name) === 0 ? ts.idText(name) : getTextOfNode(name);
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
return entityNameToString(name.left) + "." + entityNameToString(name.right);
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return entityNameToString(name.expression) + "." + entityNameToString(name.name);
default:
throw ts.Debug.assertNever(name);
@@ -9133,7 +9309,7 @@
ts.getSpanOfTokenAtPosition = getSpanOfTokenAtPosition;
function getErrorSpanForArrowFunction(sourceFile, node) {
var pos = ts.skipTrivia(sourceFile.text, node.pos);
- if (node.body && node.body.kind === 218 /* Block */) {
+ if (node.body && node.body.kind === 219 /* Block */) {
var startLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.pos).line;
var endLine = ts.getLineAndCharacterOfPosition(sourceFile, node.body.end).line;
if (startLine < endLine) {
@@ -9147,7 +9323,7 @@
function getErrorSpanForNode(sourceFile, node) {
var errorNode = node;
switch (node.kind) {
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
var pos_1 = ts.skipTrivia(sourceFile.text, 0, /*stopAfterLineBreak*/ false);
if (pos_1 === sourceFile.text.length) {
// file is empty - return span for the beginning of the file
@@ -9156,25 +9332,25 @@
return getSpanOfTokenAtPosition(sourceFile, pos_1);
// This list is a work in progress. Add missing node kinds to improve their error
// spans.
- case 237 /* VariableDeclaration */:
- case 186 /* BindingElement */:
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 243 /* EnumDeclaration */:
- case 278 /* EnumMember */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 242 /* TypeAliasDeclaration */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 238 /* VariableDeclaration */:
+ case 187 /* BindingElement */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 279 /* EnumMember */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 243 /* TypeAliasDeclaration */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
errorNode = node.name;
break;
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return getErrorSpanForArrowFunction(sourceFile, node);
}
if (errorNode === undefined) {
@@ -9223,11 +9399,11 @@
}
ts.isLet = isLet;
function isSuperCall(n) {
- return n.kind === 191 /* CallExpression */ && n.expression.kind === 98 /* SuperKeyword */;
+ return n.kind === 192 /* CallExpression */ && n.expression.kind === 99 /* SuperKeyword */;
}
ts.isSuperCall = isSuperCall;
function isImportCall(n) {
- return n.kind === 191 /* CallExpression */ && n.expression.kind === 92 /* ImportKeyword */;
+ return n.kind === 192 /* CallExpression */ && n.expression.kind === 93 /* ImportKeyword */;
}
ts.isImportCall = isImportCall;
function isLiteralImportTypeNode(n) {
@@ -9235,7 +9411,7 @@
}
ts.isLiteralImportTypeNode = isLiteralImportTypeNode;
function isPrologueDirective(node) {
- return node.kind === 221 /* ExpressionStatement */
+ return node.kind === 222 /* ExpressionStatement */
&& node.expression.kind === 10 /* StringLiteral */;
}
ts.isPrologueDirective = isPrologueDirective;
@@ -9244,11 +9420,11 @@
}
ts.getLeadingCommentRangesOfNode = getLeadingCommentRangesOfNode;
function getJSDocCommentRanges(node, text) {
- var commentRanges = (node.kind === 151 /* Parameter */ ||
- node.kind === 150 /* TypeParameter */ ||
- node.kind === 196 /* FunctionExpression */ ||
- node.kind === 197 /* ArrowFunction */ ||
- node.kind === 195 /* ParenthesizedExpression */) ?
+ var commentRanges = (node.kind === 152 /* Parameter */ ||
+ node.kind === 151 /* TypeParameter */ ||
+ node.kind === 197 /* FunctionExpression */ ||
+ node.kind === 198 /* ArrowFunction */ ||
+ node.kind === 196 /* ParenthesizedExpression */) ?
ts.concatenate(ts.getTrailingCommentRanges(text, node.pos), ts.getLeadingCommentRanges(text, node.pos)) :
ts.getLeadingCommentRanges(text, node.pos);
// True if the comment starts with '/**' but not if it is '/**/'
@@ -9264,48 +9440,48 @@
ts.fullTripleSlashAMDReferencePathRegEx = /^(\/\/\/\s*<amd-dependency\s+path\s*=\s*)('|")(.+?)\2.*?\/>/;
var defaultLibReferenceRegEx = /^(\/\/\/\s*<reference\s+no-default-lib\s*=\s*)('|")(.+?)\2\s*\/>/;
function isPartOfTypeNode(node) {
- if (163 /* FirstTypeNode */ <= node.kind && node.kind <= 183 /* LastTypeNode */) {
+ if (164 /* FirstTypeNode */ <= node.kind && node.kind <= 184 /* LastTypeNode */) {
return true;
}
switch (node.kind) {
- case 120 /* AnyKeyword */:
- case 143 /* UnknownKeyword */:
- case 135 /* NumberKeyword */:
- case 146 /* BigIntKeyword */:
- case 138 /* StringKeyword */:
- case 123 /* BooleanKeyword */:
- case 139 /* SymbolKeyword */:
- case 136 /* ObjectKeyword */:
- case 141 /* UndefinedKeyword */:
- case 132 /* NeverKeyword */:
- return true;
- case 106 /* VoidKeyword */:
- return node.parent.kind !== 200 /* VoidExpression */;
- case 211 /* ExpressionWithTypeArguments */:
+ case 121 /* AnyKeyword */:
+ case 144 /* UnknownKeyword */:
+ case 136 /* NumberKeyword */:
+ case 147 /* BigIntKeyword */:
+ case 139 /* StringKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 137 /* ObjectKeyword */:
+ case 142 /* UndefinedKeyword */:
+ case 133 /* NeverKeyword */:
+ return true;
+ case 107 /* VoidKeyword */:
+ return node.parent.kind !== 201 /* VoidExpression */;
+ case 212 /* ExpressionWithTypeArguments */:
return !isExpressionWithTypeArgumentsInClassExtendsClause(node);
- case 150 /* TypeParameter */:
- return node.parent.kind === 181 /* MappedType */ || node.parent.kind === 176 /* InferType */;
+ case 151 /* TypeParameter */:
+ return node.parent.kind === 182 /* MappedType */ || node.parent.kind === 177 /* InferType */;
// Identifiers and qualified names may be type nodes, depending on their context. Climb
// above them to find the lowest container
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
// If the identifier is the RHS of a qualified name, then it's a type iff its parent is.
- if (node.parent.kind === 148 /* QualifiedName */ && node.parent.right === node) {
+ if (node.parent.kind === 149 /* QualifiedName */ && node.parent.right === node) {
node = node.parent;
}
- else if (node.parent.kind === 189 /* PropertyAccessExpression */ && node.parent.name === node) {
+ else if (node.parent.kind === 190 /* PropertyAccessExpression */ && node.parent.name === node) {
node = node.parent;
}
// At this point, node is either a qualified name or an identifier
- ts.Debug.assert(node.kind === 72 /* Identifier */ || node.kind === 148 /* QualifiedName */ || node.kind === 189 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'.");
+ ts.Debug.assert(node.kind === 73 /* Identifier */ || node.kind === 149 /* QualifiedName */ || node.kind === 190 /* PropertyAccessExpression */, "'node' was expected to be a qualified name, identifier or property access in 'isPartOfTypeNode'.");
// falls through
- case 148 /* QualifiedName */:
- case 189 /* PropertyAccessExpression */:
- case 100 /* ThisKeyword */: {
+ case 149 /* QualifiedName */:
+ case 190 /* PropertyAccessExpression */:
+ case 101 /* ThisKeyword */: {
var parent = node.parent;
- if (parent.kind === 167 /* TypeQuery */) {
+ if (parent.kind === 168 /* TypeQuery */) {
return false;
}
- if (parent.kind === 183 /* ImportType */) {
+ if (parent.kind === 184 /* ImportType */) {
return !parent.isTypeOf;
}
// Do not recursively call isPartOfTypeNode on the parent. In the example:
@@ -9314,40 +9490,40 @@
//
// Calling isPartOfTypeNode would consider the qualified name A.B a type node.
// Only C and A.B.C are type nodes.
- if (163 /* FirstTypeNode */ <= parent.kind && parent.kind <= 183 /* LastTypeNode */) {
+ if (164 /* FirstTypeNode */ <= parent.kind && parent.kind <= 184 /* LastTypeNode */) {
return true;
}
switch (parent.kind) {
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return !isExpressionWithTypeArgumentsInClassExtendsClause(parent);
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
return node === parent.constraint;
- case 308 /* JSDocTemplateTag */:
+ case 309 /* JSDocTemplateTag */:
return node === parent.constraint;
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 151 /* Parameter */:
- case 237 /* VariableDeclaration */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 152 /* Parameter */:
+ case 238 /* VariableDeclaration */:
return node === parent.type;
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 157 /* Constructor */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 158 /* Constructor */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return node === parent.type;
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
return node === parent.type;
- case 194 /* TypeAssertionExpression */:
+ case 195 /* TypeAssertionExpression */:
return node === parent.type;
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
return ts.contains(parent.typeArguments, node);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
// TODO (drosen): TaggedTemplateExpressions may eventually support type arguments.
return false;
}
@@ -9372,23 +9548,23 @@
return traverse(body);
function traverse(node) {
switch (node.kind) {
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return visitor(node);
- case 246 /* CaseBlock */:
- case 218 /* Block */:
- case 222 /* IfStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 231 /* WithStatement */:
- case 232 /* SwitchStatement */:
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
- case 233 /* LabeledStatement */:
- case 235 /* TryStatement */:
- case 274 /* CatchClause */:
+ case 247 /* CaseBlock */:
+ case 219 /* Block */:
+ case 223 /* IfStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 232 /* WithStatement */:
+ case 233 /* SwitchStatement */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
+ case 234 /* LabeledStatement */:
+ case 236 /* TryStatement */:
+ case 275 /* CatchClause */:
return ts.forEachChild(node, traverse);
}
}
@@ -9398,26 +9574,26 @@
return traverse(body);
function traverse(node) {
switch (node.kind) {
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
visitor(node);
var operand = node.expression;
if (operand) {
traverse(operand);
}
return;
- case 243 /* EnumDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 244 /* EnumDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
// These are not allowed inside a generator now, but eventually they may be allowed
// as local types. Regardless, any yield statements contained within them should be
// skipped in this traversal.
return;
default:
if (ts.isFunctionLike(node)) {
- if (node.name && node.name.kind === 149 /* ComputedPropertyName */) {
+ if (node.name && node.name.kind === 150 /* ComputedPropertyName */) {
// Note that we will not include methods/accessors of a class because they would require
// first descending into the class. This is by design.
traverse(node.name.expression);
@@ -9440,10 +9616,10 @@
* @param node The type node.
*/
function getRestParameterElementType(node) {
- if (node && node.kind === 169 /* ArrayType */) {
+ if (node && node.kind === 170 /* ArrayType */) {
return node.elementType;
}
- else if (node && node.kind === 164 /* TypeReference */) {
+ else if (node && node.kind === 165 /* TypeReference */) {
return ts.singleOrUndefined(node.typeArguments);
}
else {
@@ -9453,12 +9629,12 @@
ts.getRestParameterElementType = getRestParameterElementType;
function getMembersOfDeclaration(node) {
switch (node.kind) {
- case 241 /* InterfaceDeclaration */:
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 168 /* TypeLiteral */:
+ case 242 /* InterfaceDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 169 /* TypeLiteral */:
return node.members;
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return node.properties;
}
}
@@ -9466,14 +9642,14 @@
function isVariableLike(node) {
if (node) {
switch (node.kind) {
- case 186 /* BindingElement */:
- case 278 /* EnumMember */:
- case 151 /* Parameter */:
- case 275 /* PropertyAssignment */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 276 /* ShorthandPropertyAssignment */:
- case 237 /* VariableDeclaration */:
+ case 187 /* BindingElement */:
+ case 279 /* EnumMember */:
+ case 152 /* Parameter */:
+ case 276 /* PropertyAssignment */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 277 /* ShorthandPropertyAssignment */:
+ case 238 /* VariableDeclaration */:
return true;
}
}
@@ -9485,8 +9661,8 @@
}
ts.isVariableLikeOrAccessor = isVariableLikeOrAccessor;
function isVariableDeclarationInVariableStatement(node) {
- return node.parent.kind === 238 /* VariableDeclarationList */
- && node.parent.parent.kind === 219 /* VariableStatement */;
+ return node.parent.kind === 239 /* VariableDeclarationList */
+ && node.parent.parent.kind === 220 /* VariableStatement */;
}
ts.isVariableDeclarationInVariableStatement = isVariableDeclarationInVariableStatement;
function isValidESSymbolDeclaration(node) {
@@ -9497,13 +9673,13 @@
ts.isValidESSymbolDeclaration = isValidESSymbolDeclaration;
function introducesArgumentsExoticObject(node) {
switch (node.kind) {
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
return true;
}
return false;
@@ -9514,7 +9690,7 @@
if (beforeUnwrapLabelCallback) {
beforeUnwrapLabelCallback(node);
}
- if (node.statement.kind !== 233 /* LabeledStatement */) {
+ if (node.statement.kind !== 234 /* LabeledStatement */) {
return node.statement;
}
node = node.statement;
@@ -9522,17 +9698,17 @@
}
ts.unwrapInnermostStatementOfLabel = unwrapInnermostStatementOfLabel;
function isFunctionBlock(node) {
- return node && node.kind === 218 /* Block */ && ts.isFunctionLike(node.parent);
+ return node && node.kind === 219 /* Block */ && ts.isFunctionLike(node.parent);
}
ts.isFunctionBlock = isFunctionBlock;
function isObjectLiteralMethod(node) {
- return node && node.kind === 156 /* MethodDeclaration */ && node.parent.kind === 188 /* ObjectLiteralExpression */;
+ return node && node.kind === 157 /* MethodDeclaration */ && node.parent.kind === 189 /* ObjectLiteralExpression */;
}
ts.isObjectLiteralMethod = isObjectLiteralMethod;
function isObjectLiteralOrClassExpressionMethod(node) {
- return node.kind === 156 /* MethodDeclaration */ &&
- (node.parent.kind === 188 /* ObjectLiteralExpression */ ||
- node.parent.kind === 209 /* ClassExpression */);
+ return node.kind === 157 /* MethodDeclaration */ &&
+ (node.parent.kind === 189 /* ObjectLiteralExpression */ ||
+ node.parent.kind === 210 /* ClassExpression */);
}
ts.isObjectLiteralOrClassExpressionMethod = isObjectLiteralOrClassExpressionMethod;
function isIdentifierTypePredicate(predicate) {
@@ -9545,7 +9721,7 @@
ts.isThisTypePredicate = isThisTypePredicate;
function getPropertyAssignment(objectLiteral, key, key2) {
return objectLiteral.properties.filter(function (property) {
- if (property.kind === 275 /* PropertyAssignment */) {
+ if (property.kind === 276 /* PropertyAssignment */) {
var propName = getTextOfPropertyName(property.name);
return key === propName || (!!key2 && key2 === propName);
}
@@ -9577,19 +9753,23 @@
return findAncestor(node.parent, ts.isFunctionLike);
}
ts.getContainingFunction = getContainingFunction;
+ function getContainingFunctionDeclaration(node) {
+ return findAncestor(node.parent, ts.isFunctionLikeDeclaration);
+ }
+ ts.getContainingFunctionDeclaration = getContainingFunctionDeclaration;
function getContainingClass(node) {
return findAncestor(node.parent, ts.isClassLike);
}
ts.getContainingClass = getContainingClass;
function getThisContainer(node, includeArrowFunctions) {
- ts.Debug.assert(node.kind !== 284 /* SourceFile */);
+ ts.Debug.assert(node.kind !== 285 /* SourceFile */);
while (true) {
node = node.parent;
if (!node) {
return ts.Debug.fail(); // If we never pass in a SourceFile, this should be unreachable, since we'll stop when we reach that.
}
switch (node.kind) {
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
// If the grandparent node is an object literal (as opposed to a class),
// then the computed property is not a 'this' container.
// A computed property name in a class needs to be a this container
@@ -9604,9 +9784,9 @@
// the *body* of the container.
node = node.parent;
break;
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
// Decorators are always applied outside of the body of a class or method.
- if (node.parent.kind === 151 /* Parameter */ && ts.isClassElement(node.parent.parent)) {
+ if (node.parent.kind === 152 /* Parameter */ && ts.isClassElement(node.parent.parent)) {
// If the decorator's parent is a Parameter, we resolve the this container from
// the grandparent class declaration.
node = node.parent.parent;
@@ -9617,26 +9797,26 @@
node = node.parent;
}
break;
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
if (!includeArrowFunctions) {
continue;
}
// falls through
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 244 /* ModuleDeclaration */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
- case 243 /* EnumDeclaration */:
- case 284 /* SourceFile */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 245 /* ModuleDeclaration */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
+ case 244 /* EnumDeclaration */:
+ case 285 /* SourceFile */:
return node;
}
}
@@ -9646,9 +9826,9 @@
var container = getThisContainer(node, /*includeArrowFunctions*/ false);
if (container) {
switch (container.kind) {
- case 157 /* Constructor */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
+ case 158 /* Constructor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
return container;
}
}
@@ -9670,27 +9850,27 @@
return node;
}
switch (node.kind) {
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
node = node.parent;
break;
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
if (!stopOnFunctions) {
continue;
}
// falls through
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return node;
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
// Decorators are always applied outside of the body of a class or method.
- if (node.parent.kind === 151 /* Parameter */ && ts.isClassElement(node.parent.parent)) {
+ if (node.parent.kind === 152 /* Parameter */ && ts.isClassElement(node.parent.parent)) {
// If the decorator's parent is a Parameter, we resolve the this container from
// the grandparent class declaration.
node = node.parent.parent;
@@ -9706,21 +9886,21 @@
}
ts.getSuperContainer = getSuperContainer;
function getImmediatelyInvokedFunctionExpression(func) {
- if (func.kind === 196 /* FunctionExpression */ || func.kind === 197 /* ArrowFunction */) {
+ if (func.kind === 197 /* FunctionExpression */ || func.kind === 198 /* ArrowFunction */) {
var prev = func;
var parent = func.parent;
- while (parent.kind === 195 /* ParenthesizedExpression */) {
+ while (parent.kind === 196 /* ParenthesizedExpression */) {
prev = parent;
parent = parent.parent;
}
- if (parent.kind === 191 /* CallExpression */ && parent.expression === prev) {
+ if (parent.kind === 192 /* CallExpression */ && parent.expression === prev) {
return parent;
}
}
}
ts.getImmediatelyInvokedFunctionExpression = getImmediatelyInvokedFunctionExpression;
function isSuperOrSuperProperty(node) {
- return node.kind === 98 /* SuperKeyword */
+ return node.kind === 99 /* SuperKeyword */
|| isSuperProperty(node);
}
ts.isSuperOrSuperProperty = isSuperOrSuperProperty;
@@ -9729,8 +9909,8 @@
*/
function isSuperProperty(node) {
var kind = node.kind;
- return (kind === 189 /* PropertyAccessExpression */ || kind === 190 /* ElementAccessExpression */)
- && node.expression.kind === 98 /* SuperKeyword */;
+ return (kind === 190 /* PropertyAccessExpression */ || kind === 191 /* ElementAccessExpression */)
+ && node.expression.kind === 99 /* SuperKeyword */;
}
ts.isSuperProperty = isSuperProperty;
/**
@@ -9738,20 +9918,20 @@
*/
function isThisProperty(node) {
var kind = node.kind;
- return (kind === 189 /* PropertyAccessExpression */ || kind === 190 /* ElementAccessExpression */)
- && node.expression.kind === 100 /* ThisKeyword */;
+ return (kind === 190 /* PropertyAccessExpression */ || kind === 191 /* ElementAccessExpression */)
+ && node.expression.kind === 101 /* ThisKeyword */;
}
ts.isThisProperty = isThisProperty;
function getEntityNameFromTypeNode(node) {
switch (node.kind) {
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return node.typeName;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return isEntityNameExpression(node.expression)
? node.expression
: undefined;
- case 72 /* Identifier */:
- case 148 /* QualifiedName */:
+ case 73 /* Identifier */:
+ case 149 /* QualifiedName */:
return node;
}
return undefined;
@@ -9759,10 +9939,10 @@
ts.getEntityNameFromTypeNode = getEntityNameFromTypeNode;
function getInvokedExpression(node) {
switch (node.kind) {
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return node.tag;
- case 262 /* JsxOpeningElement */:
- case 261 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
+ case 262 /* JsxSelfClosingElement */:
return node.tagName;
default:
return node.expression;
@@ -9771,25 +9951,25 @@
ts.getInvokedExpression = getInvokedExpression;
function nodeCanBeDecorated(node, parent, grandparent) {
switch (node.kind) {
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
// classes are valid targets
return true;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
// property declarations are valid if their parent is a class declaration.
- return parent.kind === 240 /* ClassDeclaration */;
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 156 /* MethodDeclaration */:
+ return parent.kind === 241 /* ClassDeclaration */;
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
// if this method has a body and its parent is a class declaration, this is a valid target.
return node.body !== undefined
- && parent.kind === 240 /* ClassDeclaration */;
- case 151 /* Parameter */:
+ && parent.kind === 241 /* ClassDeclaration */;
+ case 152 /* Parameter */:
// if the parameter's parent has a body and its grandparent is a class declaration, this is a valid target;
return parent.body !== undefined
- && (parent.kind === 157 /* Constructor */
- || parent.kind === 156 /* MethodDeclaration */
- || parent.kind === 159 /* SetAccessor */)
- && grandparent.kind === 240 /* ClassDeclaration */;
+ && (parent.kind === 158 /* Constructor */
+ || parent.kind === 157 /* MethodDeclaration */
+ || parent.kind === 160 /* SetAccessor */)
+ && grandparent.kind === 241 /* ClassDeclaration */;
}
return false;
}
@@ -9805,10 +9985,10 @@
ts.nodeOrChildIsDecorated = nodeOrChildIsDecorated;
function childIsDecorated(node, parent) {
switch (node.kind) {
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return ts.some(node.members, function (m) { return nodeOrChildIsDecorated(m, node, parent); }); // TODO: GH#18217
- case 156 /* MethodDeclaration */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 160 /* SetAccessor */:
return ts.some(node.parameters, function (p) { return nodeIsDecorated(p, node, parent); }); // TODO: GH#18217
default:
return false;
@@ -9817,9 +9997,9 @@
ts.childIsDecorated = childIsDecorated;
function isJSXTagName(node) {
var parent = node.parent;
- if (parent.kind === 262 /* JsxOpeningElement */ ||
- parent.kind === 261 /* JsxSelfClosingElement */ ||
- parent.kind === 263 /* JsxClosingElement */) {
+ if (parent.kind === 263 /* JsxOpeningElement */ ||
+ parent.kind === 262 /* JsxSelfClosingElement */ ||
+ parent.kind === 264 /* JsxClosingElement */) {
return parent.tagName === node;
}
return false;
@@ -9827,57 +10007,57 @@
ts.isJSXTagName = isJSXTagName;
function isExpressionNode(node) {
switch (node.kind) {
- case 98 /* SuperKeyword */:
- case 96 /* NullKeyword */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
+ case 99 /* SuperKeyword */:
+ case 97 /* NullKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
case 13 /* RegularExpressionLiteral */:
- case 187 /* ArrayLiteralExpression */:
- case 188 /* ObjectLiteralExpression */:
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
- case 193 /* TaggedTemplateExpression */:
- case 212 /* AsExpression */:
- case 194 /* TypeAssertionExpression */:
- case 213 /* NonNullExpression */:
- case 195 /* ParenthesizedExpression */:
- case 196 /* FunctionExpression */:
- case 209 /* ClassExpression */:
- case 197 /* ArrowFunction */:
- case 200 /* VoidExpression */:
- case 198 /* DeleteExpression */:
- case 199 /* TypeOfExpression */:
- case 202 /* PrefixUnaryExpression */:
- case 203 /* PostfixUnaryExpression */:
- case 204 /* BinaryExpression */:
- case 205 /* ConditionalExpression */:
- case 208 /* SpreadElement */:
- case 206 /* TemplateExpression */:
+ case 188 /* ArrayLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
+ case 194 /* TaggedTemplateExpression */:
+ case 213 /* AsExpression */:
+ case 195 /* TypeAssertionExpression */:
+ case 214 /* NonNullExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 197 /* FunctionExpression */:
+ case 210 /* ClassExpression */:
+ case 198 /* ArrowFunction */:
+ case 201 /* VoidExpression */:
+ case 199 /* DeleteExpression */:
+ case 200 /* TypeOfExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
+ case 205 /* BinaryExpression */:
+ case 206 /* ConditionalExpression */:
+ case 209 /* SpreadElement */:
+ case 207 /* TemplateExpression */:
case 14 /* NoSubstitutionTemplateLiteral */:
- case 210 /* OmittedExpression */:
- case 260 /* JsxElement */:
- case 261 /* JsxSelfClosingElement */:
- case 264 /* JsxFragment */:
- case 207 /* YieldExpression */:
- case 201 /* AwaitExpression */:
- case 214 /* MetaProperty */:
+ case 211 /* OmittedExpression */:
+ case 261 /* JsxElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 265 /* JsxFragment */:
+ case 208 /* YieldExpression */:
+ case 202 /* AwaitExpression */:
+ case 215 /* MetaProperty */:
return true;
- case 148 /* QualifiedName */:
- while (node.parent.kind === 148 /* QualifiedName */) {
+ case 149 /* QualifiedName */:
+ while (node.parent.kind === 149 /* QualifiedName */) {
node = node.parent;
}
- return node.parent.kind === 167 /* TypeQuery */ || isJSXTagName(node);
- case 72 /* Identifier */:
- if (node.parent.kind === 167 /* TypeQuery */ || isJSXTagName(node)) {
+ return node.parent.kind === 168 /* TypeQuery */ || isJSXTagName(node);
+ case 73 /* Identifier */:
+ if (node.parent.kind === 168 /* TypeQuery */ || isJSXTagName(node)) {
return true;
}
// falls through
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
case 10 /* StringLiteral */:
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
return isInExpressionContext(node);
default:
return false;
@@ -9887,49 +10067,49 @@
function isInExpressionContext(node) {
var parent = node.parent;
switch (parent.kind) {
- case 237 /* VariableDeclaration */:
- case 151 /* Parameter */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 278 /* EnumMember */:
- case 275 /* PropertyAssignment */:
- case 186 /* BindingElement */:
+ case 238 /* VariableDeclaration */:
+ case 152 /* Parameter */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 279 /* EnumMember */:
+ case 276 /* PropertyAssignment */:
+ case 187 /* BindingElement */:
return parent.initializer === node;
- case 221 /* ExpressionStatement */:
- case 222 /* IfStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
- case 230 /* ReturnStatement */:
- case 231 /* WithStatement */:
- case 232 /* SwitchStatement */:
- case 271 /* CaseClause */:
- case 234 /* ThrowStatement */:
+ case 222 /* ExpressionStatement */:
+ case 223 /* IfStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
+ case 231 /* ReturnStatement */:
+ case 232 /* WithStatement */:
+ case 233 /* SwitchStatement */:
+ case 272 /* CaseClause */:
+ case 235 /* ThrowStatement */:
return parent.expression === node;
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
var forStatement = parent;
- return (forStatement.initializer === node && forStatement.initializer.kind !== 238 /* VariableDeclarationList */) ||
+ return (forStatement.initializer === node && forStatement.initializer.kind !== 239 /* VariableDeclarationList */) ||
forStatement.condition === node ||
forStatement.incrementor === node;
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
var forInStatement = parent;
- return (forInStatement.initializer === node && forInStatement.initializer.kind !== 238 /* VariableDeclarationList */) ||
+ return (forInStatement.initializer === node && forInStatement.initializer.kind !== 239 /* VariableDeclarationList */) ||
forInStatement.expression === node;
- case 194 /* TypeAssertionExpression */:
- case 212 /* AsExpression */:
+ case 195 /* TypeAssertionExpression */:
+ case 213 /* AsExpression */:
return node === parent.expression;
- case 216 /* TemplateSpan */:
+ case 217 /* TemplateSpan */:
return node === parent.expression;
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
return node === parent.expression;
- case 152 /* Decorator */:
- case 270 /* JsxExpression */:
- case 269 /* JsxSpreadAttribute */:
- case 277 /* SpreadAssignment */:
+ case 153 /* Decorator */:
+ case 271 /* JsxExpression */:
+ case 270 /* JsxSpreadAttribute */:
+ case 278 /* SpreadAssignment */:
return true;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return parent.expression === node && isExpressionWithTypeArgumentsInClassExtendsClause(parent);
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return parent.objectAssignmentInitializer === node;
default:
return isExpressionNode(parent);
@@ -9937,7 +10117,7 @@
}
ts.isInExpressionContext = isInExpressionContext;
function isExternalModuleImportEqualsDeclaration(node) {
- return node.kind === 248 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 259 /* ExternalModuleReference */;
+ return node.kind === 249 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 260 /* ExternalModuleReference */;
}
ts.isExternalModuleImportEqualsDeclaration = isExternalModuleImportEqualsDeclaration;
function getExternalModuleImportEqualsDeclarationExpression(node) {
@@ -9946,7 +10126,7 @@
}
ts.getExternalModuleImportEqualsDeclarationExpression = getExternalModuleImportEqualsDeclarationExpression;
function isInternalModuleImportEqualsDeclaration(node) {
- return node.kind === 248 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 259 /* ExternalModuleReference */;
+ return node.kind === 249 /* ImportEqualsDeclaration */ && node.moduleReference.kind !== 260 /* ExternalModuleReference */;
}
ts.isInternalModuleImportEqualsDeclaration = isInternalModuleImportEqualsDeclaration;
function isSourceFileJS(file) {
@@ -9974,15 +10154,15 @@
ts.isIdentifier(node.typeName) &&
node.typeName.escapedText === "Object" &&
node.typeArguments && node.typeArguments.length === 2 &&
- (node.typeArguments[0].kind === 138 /* StringKeyword */ || node.typeArguments[0].kind === 135 /* NumberKeyword */);
+ (node.typeArguments[0].kind === 139 /* StringKeyword */ || node.typeArguments[0].kind === 136 /* NumberKeyword */);
}
ts.isJSDocIndexSignature = isJSDocIndexSignature;
function isRequireCall(callExpression, checkArgumentIsStringLiteralLike) {
- if (callExpression.kind !== 191 /* CallExpression */) {
+ if (callExpression.kind !== 192 /* CallExpression */) {
return false;
}
var _a = callExpression, expression = _a.expression, args = _a.arguments;
- if (expression.kind !== 72 /* Identifier */ || expression.escapedText !== "require") {
+ if (expression.kind !== 73 /* Identifier */ || expression.escapedText !== "require") {
return false;
}
if (args.length !== 1) {
@@ -10013,7 +10193,7 @@
name = node.parent.name;
decl = node.parent;
}
- else if (ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 59 /* EqualsToken */ && node.parent.right === node) {
+ else if (ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 60 /* EqualsToken */ && node.parent.right === node) {
name = node.parent.left;
decl = name;
}
@@ -10022,7 +10202,7 @@
name = node.parent.parent.name;
decl = node.parent.parent;
}
- else if (ts.isBinaryExpression(node.parent.parent) && node.parent.parent.operatorToken.kind === 59 /* EqualsToken */ && node.parent.parent.right === node.parent) {
+ else if (ts.isBinaryExpression(node.parent.parent) && node.parent.parent.operatorToken.kind === 60 /* EqualsToken */ && node.parent.parent.right === node.parent) {
name = node.parent.parent.left;
decl = name;
}
@@ -10064,7 +10244,7 @@
* We treat the right hand side of assignments with container-like initalizers as declarations.
*/
function getAssignedExpandoInitializer(node) {
- if (node && node.parent && ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 59 /* EqualsToken */) {
+ if (node && node.parent && ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 60 /* EqualsToken */) {
var isPrototypeAssignment = isPrototypeAccess(node.parent.left);
return getExpandoInitializer(node.parent.right, isPrototypeAssignment) ||
getDefaultedExpandoInitializer(node.parent.left, node.parent.right, isPrototypeAssignment);
@@ -10090,11 +10270,11 @@
function getExpandoInitializer(initializer, isPrototypeAssignment) {
if (ts.isCallExpression(initializer)) {
var e = skipParentheses(initializer.expression);
- return e.kind === 196 /* FunctionExpression */ || e.kind === 197 /* ArrowFunction */ ? initializer : undefined;
+ return e.kind === 197 /* FunctionExpression */ || e.kind === 198 /* ArrowFunction */ ? initializer : undefined;
}
- if (initializer.kind === 196 /* FunctionExpression */ ||
- initializer.kind === 209 /* ClassExpression */ ||
- initializer.kind === 197 /* ArrowFunction */) {
+ if (initializer.kind === 197 /* FunctionExpression */ ||
+ initializer.kind === 210 /* ClassExpression */ ||
+ initializer.kind === 198 /* ArrowFunction */) {
return initializer;
}
if (ts.isObjectLiteralExpression(initializer) && (initializer.properties.length === 0 || isPrototypeAssignment)) {
@@ -10118,7 +10298,7 @@
}
function isDefaultedExpandoInitializer(node) {
var name = ts.isVariableDeclaration(node.parent) ? node.parent.name :
- ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 59 /* EqualsToken */ ? node.parent.left :
+ ts.isBinaryExpression(node.parent) && node.parent.operatorToken.kind === 60 /* EqualsToken */ ? node.parent.left :
undefined;
return name && getExpandoInitializer(node.right, isPrototypeAccess(name)) && isEntityNameExpression(name) && isSameEntityName(name, node.left);
}
@@ -10127,7 +10307,7 @@
function getNameOfExpando(node) {
if (ts.isBinaryExpression(node.parent)) {
var parent = (node.parent.operatorToken.kind === 55 /* BarBarToken */ && ts.isBinaryExpression(node.parent.parent)) ? node.parent.parent : node.parent;
- if (parent.operatorToken.kind === 59 /* EqualsToken */ && ts.isIdentifier(parent.left)) {
+ if (parent.operatorToken.kind === 60 /* EqualsToken */ && ts.isIdentifier(parent.left)) {
return parent.left;
}
}
@@ -10150,7 +10330,7 @@
return name.escapedText === initializer.escapedText;
}
if (ts.isIdentifier(name) && ts.isPropertyAccessExpression(initializer)) {
- return (initializer.expression.kind === 100 /* ThisKeyword */ ||
+ return (initializer.expression.kind === 101 /* ThisKeyword */ ||
ts.isIdentifier(initializer.expression) &&
(initializer.expression.escapedText === "window" ||
initializer.expression.escapedText === "self" ||
@@ -10208,7 +10388,7 @@
}
return 7 /* ObjectDefinePropertyValue */;
}
- if (expr.operatorToken.kind !== 59 /* EqualsToken */ ||
+ if (expr.operatorToken.kind !== 60 /* EqualsToken */ ||
!ts.isPropertyAccessExpression(expr.left)) {
return 0 /* None */;
}
@@ -10220,7 +10400,7 @@
return getAssignmentDeclarationPropertyAccessKind(lhs);
}
function getAssignmentDeclarationPropertyAccessKind(lhs) {
- if (lhs.expression.kind === 100 /* ThisKeyword */) {
+ if (lhs.expression.kind === 101 /* ThisKeyword */) {
return 4 /* ThisProperty */;
}
else if (isModuleExportsPropertyAccessExpression(lhs)) {
@@ -10262,7 +10442,7 @@
ts.isPrototypePropertyAssignment = isPrototypePropertyAssignment;
function isSpecialPropertyDeclaration(expr) {
return isInJSFile(expr) &&
- expr.parent && expr.parent.kind === 221 /* ExpressionStatement */ &&
+ expr.parent && expr.parent.kind === 222 /* ExpressionStatement */ &&
!!ts.getJSDocTypeTag(expr.parent);
}
ts.isSpecialPropertyDeclaration = isSpecialPropertyDeclaration;
@@ -10271,23 +10451,23 @@
return false;
}
var decl = symbol.valueDeclaration;
- return decl.kind === 239 /* FunctionDeclaration */ || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer);
+ return decl.kind === 240 /* FunctionDeclaration */ || ts.isVariableDeclaration(decl) && decl.initializer && ts.isFunctionLike(decl.initializer);
}
ts.isFunctionSymbol = isFunctionSymbol;
function importFromModuleSpecifier(node) {
- return tryGetImportFromModuleSpecifier(node) || ts.Debug.fail(ts.Debug.showSyntaxKind(node.parent));
+ return tryGetImportFromModuleSpecifier(node) || ts.Debug.failBadSyntaxKind(node.parent);
}
ts.importFromModuleSpecifier = importFromModuleSpecifier;
function tryGetImportFromModuleSpecifier(node) {
switch (node.parent.kind) {
- case 249 /* ImportDeclaration */:
- case 255 /* ExportDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 256 /* ExportDeclaration */:
return node.parent;
- case 259 /* ExternalModuleReference */:
+ case 260 /* ExternalModuleReference */:
return node.parent.parent;
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return isImportCall(node.parent) || isRequireCall(node.parent, /*checkArg*/ false) ? node.parent : undefined;
- case 182 /* LiteralType */:
+ case 183 /* LiteralType */:
ts.Debug.assert(ts.isStringLiteral(node));
return ts.tryCast(node.parent.parent, ts.isImportTypeNode);
default:
@@ -10297,12 +10477,12 @@
ts.tryGetImportFromModuleSpecifier = tryGetImportFromModuleSpecifier;
function getExternalModuleName(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
- case 255 /* ExportDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 256 /* ExportDeclaration */:
return node.moduleSpecifier;
- case 248 /* ImportEqualsDeclaration */:
- return node.moduleReference.kind === 259 /* ExternalModuleReference */ ? node.moduleReference.expression : undefined;
- case 183 /* ImportType */:
+ case 249 /* ImportEqualsDeclaration */:
+ return node.moduleReference.kind === 260 /* ExternalModuleReference */ ? node.moduleReference.expression : undefined;
+ case 184 /* ImportType */:
return isLiteralImportTypeNode(node) ? node.argument.literal : undefined;
default:
return ts.Debug.assertNever(node);
@@ -10311,11 +10491,11 @@
ts.getExternalModuleName = getExternalModuleName;
function getNamespaceDeclarationNode(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return node.importClause && ts.tryCast(node.importClause.namedBindings, ts.isNamespaceImport);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return node;
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return undefined;
default:
return ts.Debug.assertNever(node);
@@ -10323,19 +10503,19 @@
}
ts.getNamespaceDeclarationNode = getNamespaceDeclarationNode;
function isDefaultImport(node) {
- return node.kind === 249 /* ImportDeclaration */ && !!node.importClause && !!node.importClause.name;
+ return node.kind === 250 /* ImportDeclaration */ && !!node.importClause && !!node.importClause.name;
}
ts.isDefaultImport = isDefaultImport;
function hasQuestionToken(node) {
if (node) {
switch (node.kind) {
- case 151 /* Parameter */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 276 /* ShorthandPropertyAssignment */:
- case 275 /* PropertyAssignment */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 152 /* Parameter */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 277 /* ShorthandPropertyAssignment */:
+ case 276 /* PropertyAssignment */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
return node.questionToken !== undefined;
}
}
@@ -10349,7 +10529,7 @@
}
ts.isJSDocConstructSignature = isJSDocConstructSignature;
function isJSDocTypeAlias(node) {
- return node.kind === 309 /* JSDocTypedefTag */ || node.kind === 302 /* JSDocCallbackTag */;
+ return node.kind === 310 /* JSDocTypedefTag */ || node.kind === 303 /* JSDocCallbackTag */;
}
ts.isJSDocTypeAlias = isJSDocTypeAlias;
function isTypeAlias(node) {
@@ -10359,7 +10539,7 @@
function getSourceOfAssignment(node) {
return ts.isExpressionStatement(node) &&
node.expression && ts.isBinaryExpression(node.expression) &&
- node.expression.operatorToken.kind === 59 /* EqualsToken */
+ node.expression.operatorToken.kind === 60 /* EqualsToken */
? node.expression.right
: undefined;
}
@@ -10374,12 +10554,12 @@
}
function getSingleInitializerOfVariableStatementOrPropertyDeclaration(node) {
switch (node.kind) {
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
var v = getSingleVariableOfVariableStatement(node);
return v && v.initializer;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return node.initializer;
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return node.initializer;
}
}
@@ -10390,7 +10570,7 @@
function getNestedModuleDeclaration(node) {
return ts.isModuleDeclaration(node) &&
node.body &&
- node.body.kind === 244 /* ModuleDeclaration */
+ node.body.kind === 245 /* ModuleDeclaration */
? node.body
: undefined;
}
@@ -10405,11 +10585,11 @@
if (ts.hasJSDocNodes(node)) {
result = ts.addRange(result, node.jsDoc);
}
- if (node.kind === 151 /* Parameter */) {
+ if (node.kind === 152 /* Parameter */) {
result = ts.addRange(result, ts.getJSDocParameterTags(node));
break;
}
- if (node.kind === 150 /* TypeParameter */) {
+ if (node.kind === 151 /* TypeParameter */) {
result = ts.addRange(result, ts.getJSDocTypeParameterTags(node));
break;
}
@@ -10420,11 +10600,12 @@
ts.getJSDocCommentsAndTags = getJSDocCommentsAndTags;
function getNextJSDocCommentLocation(node) {
var parent = node.parent;
- if (parent.kind === 275 /* PropertyAssignment */ ||
- parent.kind === 154 /* PropertyDeclaration */ ||
- parent.kind === 221 /* ExpressionStatement */ && node.kind === 189 /* PropertyAccessExpression */ ||
+ if (parent.kind === 276 /* PropertyAssignment */ ||
+ parent.kind === 255 /* ExportAssignment */ ||
+ parent.kind === 155 /* PropertyDeclaration */ ||
+ parent.kind === 222 /* ExpressionStatement */ && node.kind === 190 /* PropertyAccessExpression */ ||
getNestedModuleDeclaration(parent) ||
- ts.isBinaryExpression(node) && node.operatorToken.kind === 59 /* EqualsToken */) {
+ ts.isBinaryExpression(node) && node.operatorToken.kind === 60 /* EqualsToken */) {
return parent;
}
// Try to recognize this pattern when node is initializer of variable declaration and JSDoc comments are on containing variable statement.
@@ -10435,7 +10616,7 @@
// var x = function(name) { return name.length; }
else if (parent.parent &&
(getSingleVariableOfVariableStatement(parent.parent) === node ||
- ts.isBinaryExpression(parent) && parent.operatorToken.kind === 59 /* EqualsToken */)) {
+ ts.isBinaryExpression(parent) && parent.operatorToken.kind === 60 /* EqualsToken */)) {
return parent.parent;
}
else if (parent.parent && parent.parent.parent &&
@@ -10458,7 +10639,7 @@
if (!decl) {
return undefined;
}
- var parameter = ts.find(decl.parameters, function (p) { return p.name.kind === 72 /* Identifier */ && p.name.escapedText === name; });
+ var parameter = ts.find(decl.parameters, function (p) { return p.name.kind === 73 /* Identifier */ && p.name.escapedText === name; });
return parameter && parameter.symbol;
}
ts.getParameterSymbolFromJSDoc = getParameterSymbolFromJSDoc;
@@ -10493,7 +10674,7 @@
ts.hasRestParameter = hasRestParameter;
function isRestParameter(node) {
var type = ts.isJSDocParameterTag(node) ? (node.typeExpression && node.typeExpression.type) : node.type;
- return node.dotDotDotToken !== undefined || !!type && type.kind === 295 /* JSDocVariadicType */;
+ return node.dotDotDotToken !== undefined || !!type && type.kind === 296 /* JSDocVariadicType */;
}
ts.isRestParameter = isRestParameter;
var AssignmentKind;
@@ -10506,31 +10687,31 @@
var parent = node.parent;
while (true) {
switch (parent.kind) {
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
var binaryOperator = parent.operatorToken.kind;
return isAssignmentOperator(binaryOperator) && parent.left === node ?
- binaryOperator === 59 /* EqualsToken */ ? 1 /* Definite */ : 2 /* Compound */ :
+ binaryOperator === 60 /* EqualsToken */ ? 1 /* Definite */ : 2 /* Compound */ :
0 /* None */;
- case 202 /* PrefixUnaryExpression */:
- case 203 /* PostfixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
var unaryOperator = parent.operator;
return unaryOperator === 44 /* PlusPlusToken */ || unaryOperator === 45 /* MinusMinusToken */ ? 2 /* Compound */ : 0 /* None */;
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
return parent.initializer === node ? 1 /* Definite */ : 0 /* None */;
- case 195 /* ParenthesizedExpression */:
- case 187 /* ArrayLiteralExpression */:
- case 208 /* SpreadElement */:
- case 213 /* NonNullExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 188 /* ArrayLiteralExpression */:
+ case 209 /* SpreadElement */:
+ case 214 /* NonNullExpression */:
node = parent;
break;
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
if (parent.name !== node) {
return 0 /* None */;
}
node = parent.parent;
break;
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
if (parent.name === node) {
return 0 /* None */;
}
@@ -10557,22 +10738,22 @@
*/
function isNodeWithPossibleHoistedDeclaration(node) {
switch (node.kind) {
- case 218 /* Block */:
- case 219 /* VariableStatement */:
- case 231 /* WithStatement */:
- case 222 /* IfStatement */:
- case 232 /* SwitchStatement */:
- case 246 /* CaseBlock */:
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
- case 233 /* LabeledStatement */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
- case 235 /* TryStatement */:
- case 274 /* CatchClause */:
+ case 219 /* Block */:
+ case 220 /* VariableStatement */:
+ case 232 /* WithStatement */:
+ case 223 /* IfStatement */:
+ case 233 /* SwitchStatement */:
+ case 247 /* CaseBlock */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
+ case 234 /* LabeledStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
+ case 236 /* TryStatement */:
+ case 275 /* CatchClause */:
return true;
}
return false;
@@ -10589,33 +10770,33 @@
return node;
}
function walkUpParenthesizedTypes(node) {
- return walkUp(node, 177 /* ParenthesizedType */);
+ return walkUp(node, 178 /* ParenthesizedType */);
}
ts.walkUpParenthesizedTypes = walkUpParenthesizedTypes;
function walkUpParenthesizedExpressions(node) {
- return walkUp(node, 195 /* ParenthesizedExpression */);
+ return walkUp(node, 196 /* ParenthesizedExpression */);
}
ts.walkUpParenthesizedExpressions = walkUpParenthesizedExpressions;
function skipParentheses(node) {
- while (node.kind === 195 /* ParenthesizedExpression */) {
+ while (node.kind === 196 /* ParenthesizedExpression */) {
node = node.expression;
}
return node;
}
ts.skipParentheses = skipParentheses;
function skipParenthesesUp(node) {
- while (node.kind === 195 /* ParenthesizedExpression */) {
+ while (node.kind === 196 /* ParenthesizedExpression */) {
node = node.parent;
}
return node;
}
// a node is delete target iff. it is PropertyAccessExpression/ElementAccessExpression with parentheses skipped
function isDeleteTarget(node) {
- if (node.kind !== 189 /* PropertyAccessExpression */ && node.kind !== 190 /* ElementAccessExpression */) {
+ if (node.kind !== 190 /* PropertyAccessExpression */ && node.kind !== 191 /* ElementAccessExpression */) {
return false;
}
node = walkUpParenthesizedExpressions(node.parent);
- return node && node.kind === 198 /* DeleteExpression */;
+ return node && node.kind === 199 /* DeleteExpression */;
}
ts.isDeleteTarget = isDeleteTarget;
function isNodeDescendantOf(node, ancestor) {
@@ -10641,7 +10822,7 @@
if (ts.isComputedPropertyName(parent))
return parent.parent;
// falls through
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
if (ts.isDeclaration(parent)) {
return parent.name === name ? parent : undefined;
}
@@ -10665,7 +10846,7 @@
ts.getDeclarationFromName = getDeclarationFromName;
function isLiteralComputedPropertyDeclarationName(node) {
return (node.kind === 10 /* StringLiteral */ || node.kind === 8 /* NumericLiteral */) &&
- node.parent.kind === 149 /* ComputedPropertyName */ &&
+ node.parent.kind === 150 /* ComputedPropertyName */ &&
ts.isDeclaration(node.parent.parent);
}
ts.isLiteralComputedPropertyDeclarationName = isLiteralComputedPropertyDeclarationName;
@@ -10673,32 +10854,32 @@
function isIdentifierName(node) {
var parent = node.parent;
switch (parent.kind) {
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 278 /* EnumMember */:
- case 275 /* PropertyAssignment */:
- case 189 /* PropertyAccessExpression */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 279 /* EnumMember */:
+ case 276 /* PropertyAssignment */:
+ case 190 /* PropertyAccessExpression */:
// Name in member declaration or property name in property access
return parent.name === node;
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
// Name on right hand side of dot in a type query or type reference
if (parent.right === node) {
- while (parent.kind === 148 /* QualifiedName */) {
+ while (parent.kind === 149 /* QualifiedName */) {
parent = parent.parent;
}
- return parent.kind === 167 /* TypeQuery */ || parent.kind === 164 /* TypeReference */;
+ return parent.kind === 168 /* TypeQuery */ || parent.kind === 165 /* TypeReference */;
}
return false;
- case 186 /* BindingElement */:
- case 253 /* ImportSpecifier */:
+ case 187 /* BindingElement */:
+ case 254 /* ImportSpecifier */:
// Property name in binding element or import specifier
return parent.propertyName === node;
- case 257 /* ExportSpecifier */:
- case 267 /* JsxAttribute */:
+ case 258 /* ExportSpecifier */:
+ case 268 /* JsxAttribute */:
// Any name in an export specifier or JSX Attribute
return true;
}
@@ -10715,13 +10896,13 @@
// export default <EntityNameExpression>
// module.exports = <EntityNameExpression>
function isAliasSymbolDeclaration(node) {
- return node.kind === 248 /* ImportEqualsDeclaration */ ||
- node.kind === 247 /* NamespaceExportDeclaration */ ||
- node.kind === 250 /* ImportClause */ && !!node.name ||
- node.kind === 251 /* NamespaceImport */ ||
- node.kind === 253 /* ImportSpecifier */ ||
- node.kind === 257 /* ExportSpecifier */ ||
- node.kind === 254 /* ExportAssignment */ && exportAssignmentIsAlias(node) ||
+ return node.kind === 249 /* ImportEqualsDeclaration */ ||
+ node.kind === 248 /* NamespaceExportDeclaration */ ||
+ node.kind === 251 /* ImportClause */ && !!node.name ||
+ node.kind === 252 /* NamespaceImport */ ||
+ node.kind === 254 /* ImportSpecifier */ ||
+ node.kind === 258 /* ExportSpecifier */ ||
+ node.kind === 255 /* ExportAssignment */ && exportAssignmentIsAlias(node) ||
ts.isBinaryExpression(node) && getAssignmentDeclarationKind(node) === 2 /* ModuleExports */ && exportAssignmentIsAlias(node);
}
ts.isAliasSymbolDeclaration = isAliasSymbolDeclaration;
@@ -10743,12 +10924,12 @@
}
ts.getEffectiveBaseTypeNode = getEffectiveBaseTypeNode;
function getClassExtendsHeritageElement(node) {
- var heritageClause = getHeritageClause(node.heritageClauses, 86 /* ExtendsKeyword */);
+ var heritageClause = getHeritageClause(node.heritageClauses, 87 /* ExtendsKeyword */);
return heritageClause && heritageClause.types.length > 0 ? heritageClause.types[0] : undefined;
}
ts.getClassExtendsHeritageElement = getClassExtendsHeritageElement;
function getClassImplementsHeritageClauseElements(node) {
- var heritageClause = getHeritageClause(node.heritageClauses, 109 /* ImplementsKeyword */);
+ var heritageClause = getHeritageClause(node.heritageClauses, 110 /* ImplementsKeyword */);
return heritageClause ? heritageClause.types : undefined;
}
ts.getClassImplementsHeritageClauseElements = getClassImplementsHeritageClauseElements;
@@ -10760,7 +10941,7 @@
}
ts.getAllSuperTypeNodes = getAllSuperTypeNodes;
function getInterfaceBaseTypeNodes(node) {
- var heritageClause = getHeritageClause(node.heritageClauses, 86 /* ExtendsKeyword */);
+ var heritageClause = getHeritageClause(node.heritageClauses, 87 /* ExtendsKeyword */);
return heritageClause ? heritageClause.types : undefined;
}
ts.getInterfaceBaseTypeNodes = getInterfaceBaseTypeNodes;
@@ -10794,11 +10975,11 @@
}
ts.getAncestor = getAncestor;
function isKeyword(token) {
- return 73 /* FirstKeyword */ <= token && token <= 147 /* LastKeyword */;
+ return 74 /* FirstKeyword */ <= token && token <= 148 /* LastKeyword */;
}
ts.isKeyword = isKeyword;
function isContextualKeyword(token) {
- return 118 /* FirstContextualKeyword */ <= token && token <= 147 /* LastContextualKeyword */;
+ return 119 /* FirstContextualKeyword */ <= token && token <= 148 /* LastContextualKeyword */;
}
ts.isContextualKeyword = isContextualKeyword;
function isNonContextualKeyword(token) {
@@ -10833,14 +11014,14 @@
}
var flags = 0 /* Normal */;
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 156 /* MethodDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 157 /* MethodDeclaration */:
if (node.asteriskToken) {
flags |= 1 /* Generator */;
}
// falls through
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
if (hasModifier(node, 256 /* Async */)) {
flags |= 2 /* Async */;
}
@@ -10854,10 +11035,10 @@
ts.getFunctionFlags = getFunctionFlags;
function isAsyncFunction(node) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 156 /* MethodDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
return node.body !== undefined
&& node.asteriskToken === undefined
&& hasModifier(node, 256 /* Async */);
@@ -10882,7 +11063,7 @@
}
ts.hasDynamicName = hasDynamicName;
function isDynamicName(name) {
- return name.kind === 149 /* ComputedPropertyName */ &&
+ return name.kind === 150 /* ComputedPropertyName */ &&
!isStringOrNumericLiteralLike(name.expression) &&
!isWellKnownSymbolSyntactically(name.expression);
}
@@ -10898,12 +11079,12 @@
ts.isWellKnownSymbolSyntactically = isWellKnownSymbolSyntactically;
function getPropertyNameForPropertyNameNode(name) {
switch (name.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return name.escapedText;
case 10 /* StringLiteral */:
case 8 /* NumericLiteral */:
return ts.escapeLeadingUnderscores(name.text);
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
var nameExpression = name.expression;
if (isWellKnownSymbolSyntactically(nameExpression)) {
return getPropertyNameForKnownSymbolName(ts.idText(nameExpression.name));
@@ -10919,7 +11100,7 @@
ts.getPropertyNameForPropertyNameNode = getPropertyNameForPropertyNameNode;
function isPropertyNameLiteral(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
case 10 /* StringLiteral */:
case 14 /* NoSubstitutionTemplateLiteral */:
case 8 /* NumericLiteral */:
@@ -10930,11 +11111,11 @@
}
ts.isPropertyNameLiteral = isPropertyNameLiteral;
function getTextOfIdentifierOrLiteral(node) {
- return node.kind === 72 /* Identifier */ ? ts.idText(node) : node.text;
+ return node.kind === 73 /* Identifier */ ? ts.idText(node) : node.text;
}
ts.getTextOfIdentifierOrLiteral = getTextOfIdentifierOrLiteral;
function getEscapedTextOfIdentifierOrLiteral(node) {
- return node.kind === 72 /* Identifier */ ? node.escapedText : ts.escapeLeadingUnderscores(node.text);
+ return node.kind === 73 /* Identifier */ ? node.escapedText : ts.escapeLeadingUnderscores(node.text);
}
ts.getEscapedTextOfIdentifierOrLiteral = getEscapedTextOfIdentifierOrLiteral;
function getPropertyNameForKnownSymbolName(symbolName) {
@@ -10949,7 +11130,7 @@
* Includes the word "Symbol" with unicode escapes
*/
function isESSymbolIdentifier(node) {
- return node.kind === 72 /* Identifier */ && node.escapedText === "Symbol";
+ return node.kind === 73 /* Identifier */ && node.escapedText === "Symbol";
}
ts.isESSymbolIdentifier = isESSymbolIdentifier;
function isPushOrUnshiftIdentifier(node) {
@@ -10958,11 +11139,11 @@
ts.isPushOrUnshiftIdentifier = isPushOrUnshiftIdentifier;
function isParameterDeclaration(node) {
var root = getRootDeclaration(node);
- return root.kind === 151 /* Parameter */;
+ return root.kind === 152 /* Parameter */;
}
ts.isParameterDeclaration = isParameterDeclaration;
function getRootDeclaration(node) {
- while (node.kind === 186 /* BindingElement */) {
+ while (node.kind === 187 /* BindingElement */) {
node = node.parent.parent;
}
return node;
@@ -10970,15 +11151,15 @@
ts.getRootDeclaration = getRootDeclaration;
function nodeStartsNewLexicalEnvironment(node) {
var kind = node.kind;
- return kind === 157 /* Constructor */
- || kind === 196 /* FunctionExpression */
- || kind === 239 /* FunctionDeclaration */
- || kind === 197 /* ArrowFunction */
- || kind === 156 /* MethodDeclaration */
- || kind === 158 /* GetAccessor */
- || kind === 159 /* SetAccessor */
- || kind === 244 /* ModuleDeclaration */
- || kind === 284 /* SourceFile */;
+ return kind === 158 /* Constructor */
+ || kind === 197 /* FunctionExpression */
+ || kind === 240 /* FunctionDeclaration */
+ || kind === 198 /* ArrowFunction */
+ || kind === 157 /* MethodDeclaration */
+ || kind === 159 /* GetAccessor */
+ || kind === 160 /* SetAccessor */
+ || kind === 245 /* ModuleDeclaration */
+ || kind === 285 /* SourceFile */;
}
ts.nodeStartsNewLexicalEnvironment = nodeStartsNewLexicalEnvironment;
function nodeIsSynthesized(range) {
@@ -10997,38 +11178,38 @@
})(Associativity = ts.Associativity || (ts.Associativity = {}));
function getExpressionAssociativity(expression) {
var operator = getOperator(expression);
- var hasArguments = expression.kind === 192 /* NewExpression */ && expression.arguments !== undefined;
+ var hasArguments = expression.kind === 193 /* NewExpression */ && expression.arguments !== undefined;
return getOperatorAssociativity(expression.kind, operator, hasArguments);
}
ts.getExpressionAssociativity = getExpressionAssociativity;
function getOperatorAssociativity(kind, operator, hasArguments) {
switch (kind) {
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return hasArguments ? 0 /* Left */ : 1 /* Right */;
- case 202 /* PrefixUnaryExpression */:
- case 199 /* TypeOfExpression */:
- case 200 /* VoidExpression */:
- case 198 /* DeleteExpression */:
- case 201 /* AwaitExpression */:
- case 205 /* ConditionalExpression */:
- case 207 /* YieldExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 200 /* TypeOfExpression */:
+ case 201 /* VoidExpression */:
+ case 199 /* DeleteExpression */:
+ case 202 /* AwaitExpression */:
+ case 206 /* ConditionalExpression */:
+ case 208 /* YieldExpression */:
return 1 /* Right */;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
switch (operator) {
case 41 /* AsteriskAsteriskToken */:
- case 59 /* EqualsToken */:
- case 60 /* PlusEqualsToken */:
- case 61 /* MinusEqualsToken */:
- case 63 /* AsteriskAsteriskEqualsToken */:
- case 62 /* AsteriskEqualsToken */:
- case 64 /* SlashEqualsToken */:
- case 65 /* PercentEqualsToken */:
- case 66 /* LessThanLessThanEqualsToken */:
- case 67 /* GreaterThanGreaterThanEqualsToken */:
- case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
- case 69 /* AmpersandEqualsToken */:
- case 71 /* CaretEqualsToken */:
- case 70 /* BarEqualsToken */:
+ case 60 /* EqualsToken */:
+ case 61 /* PlusEqualsToken */:
+ case 62 /* MinusEqualsToken */:
+ case 64 /* AsteriskAsteriskEqualsToken */:
+ case 63 /* AsteriskEqualsToken */:
+ case 65 /* SlashEqualsToken */:
+ case 66 /* PercentEqualsToken */:
+ case 67 /* LessThanLessThanEqualsToken */:
+ case 68 /* GreaterThanGreaterThanEqualsToken */:
+ case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
+ case 70 /* AmpersandEqualsToken */:
+ case 72 /* CaretEqualsToken */:
+ case 71 /* BarEqualsToken */:
return 1 /* Right */;
}
}
@@ -11037,15 +11218,15 @@
ts.getOperatorAssociativity = getOperatorAssociativity;
function getExpressionPrecedence(expression) {
var operator = getOperator(expression);
- var hasArguments = expression.kind === 192 /* NewExpression */ && expression.arguments !== undefined;
+ var hasArguments = expression.kind === 193 /* NewExpression */ && expression.arguments !== undefined;
return getOperatorPrecedence(expression.kind, operator, hasArguments);
}
ts.getExpressionPrecedence = getExpressionPrecedence;
function getOperator(expression) {
- if (expression.kind === 204 /* BinaryExpression */) {
+ if (expression.kind === 205 /* BinaryExpression */) {
return expression.operatorToken.kind;
}
- else if (expression.kind === 202 /* PrefixUnaryExpression */ || expression.kind === 203 /* PostfixUnaryExpression */) {
+ else if (expression.kind === 203 /* PrefixUnaryExpression */ || expression.kind === 204 /* PostfixUnaryExpression */) {
return expression.operator;
}
else {
@@ -11055,73 +11236,73 @@
ts.getOperator = getOperator;
function getOperatorPrecedence(nodeKind, operatorKind, hasArguments) {
switch (nodeKind) {
- case 314 /* CommaListExpression */:
+ case 315 /* CommaListExpression */:
return 0;
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
return 1;
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return 2;
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return 4;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
switch (operatorKind) {
case 27 /* CommaToken */:
return 0;
- case 59 /* EqualsToken */:
- case 60 /* PlusEqualsToken */:
- case 61 /* MinusEqualsToken */:
- case 63 /* AsteriskAsteriskEqualsToken */:
- case 62 /* AsteriskEqualsToken */:
- case 64 /* SlashEqualsToken */:
- case 65 /* PercentEqualsToken */:
- case 66 /* LessThanLessThanEqualsToken */:
- case 67 /* GreaterThanGreaterThanEqualsToken */:
- case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
- case 69 /* AmpersandEqualsToken */:
- case 71 /* CaretEqualsToken */:
- case 70 /* BarEqualsToken */:
+ case 60 /* EqualsToken */:
+ case 61 /* PlusEqualsToken */:
+ case 62 /* MinusEqualsToken */:
+ case 64 /* AsteriskAsteriskEqualsToken */:
+ case 63 /* AsteriskEqualsToken */:
+ case 65 /* SlashEqualsToken */:
+ case 66 /* PercentEqualsToken */:
+ case 67 /* LessThanLessThanEqualsToken */:
+ case 68 /* GreaterThanGreaterThanEqualsToken */:
+ case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
+ case 70 /* AmpersandEqualsToken */:
+ case 72 /* CaretEqualsToken */:
+ case 71 /* BarEqualsToken */:
return 3;
default:
return getBinaryOperatorPrecedence(operatorKind);
}
- case 202 /* PrefixUnaryExpression */:
- case 199 /* TypeOfExpression */:
- case 200 /* VoidExpression */:
- case 198 /* DeleteExpression */:
- case 201 /* AwaitExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 200 /* TypeOfExpression */:
+ case 201 /* VoidExpression */:
+ case 199 /* DeleteExpression */:
+ case 202 /* AwaitExpression */:
return 16;
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return 17;
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return 18;
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return hasArguments ? 19 : 18;
- case 193 /* TaggedTemplateExpression */:
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 194 /* TaggedTemplateExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return 19;
- case 100 /* ThisKeyword */:
- case 98 /* SuperKeyword */:
- case 72 /* Identifier */:
- case 96 /* NullKeyword */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
+ case 101 /* ThisKeyword */:
+ case 99 /* SuperKeyword */:
+ case 73 /* Identifier */:
+ case 97 /* NullKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
case 10 /* StringLiteral */:
- case 187 /* ArrayLiteralExpression */:
- case 188 /* ObjectLiteralExpression */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 209 /* ClassExpression */:
- case 260 /* JsxElement */:
- case 261 /* JsxSelfClosingElement */:
- case 264 /* JsxFragment */:
+ case 188 /* ArrayLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 210 /* ClassExpression */:
+ case 261 /* JsxElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 265 /* JsxFragment */:
case 13 /* RegularExpressionLiteral */:
case 14 /* NoSubstitutionTemplateLiteral */:
- case 206 /* TemplateExpression */:
- case 195 /* ParenthesizedExpression */:
- case 210 /* OmittedExpression */:
+ case 207 /* TemplateExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 211 /* OmittedExpression */:
return 20;
default:
return -1;
@@ -11149,9 +11330,9 @@
case 30 /* GreaterThanToken */:
case 31 /* LessThanEqualsToken */:
case 32 /* GreaterThanEqualsToken */:
- case 94 /* InstanceOfKeyword */:
- case 93 /* InKeyword */:
- case 119 /* AsKeyword */:
+ case 95 /* InstanceOfKeyword */:
+ case 94 /* InKeyword */:
+ case 120 /* AsKeyword */:
return 11;
case 46 /* LessThanLessThanToken */:
case 47 /* GreaterThanGreaterThanToken */:
@@ -11613,11 +11794,11 @@
}
ts.parameterIsThisKeyword = parameterIsThisKeyword;
function isThisIdentifier(node) {
- return !!node && node.kind === 72 /* Identifier */ && identifierIsThisKeyword(node);
+ return !!node && node.kind === 73 /* Identifier */ && identifierIsThisKeyword(node);
}
ts.isThisIdentifier = isThisIdentifier;
function identifierIsThisKeyword(id) {
- return id.originalKeywordKind === 100 /* ThisKeyword */;
+ return id.originalKeywordKind === 101 /* ThisKeyword */;
}
ts.identifierIsThisKeyword = identifierIsThisKeyword;
function getAllAccessorDeclarations(declarations, accessor) {
@@ -11628,10 +11809,10 @@
var setAccessor;
if (hasDynamicName(accessor)) {
firstAccessor = accessor;
- if (accessor.kind === 158 /* GetAccessor */) {
+ if (accessor.kind === 159 /* GetAccessor */) {
getAccessor = accessor;
}
- else if (accessor.kind === 159 /* SetAccessor */) {
+ else if (accessor.kind === 160 /* SetAccessor */) {
setAccessor = accessor;
}
else {
@@ -11651,10 +11832,10 @@
else if (!secondAccessor) {
secondAccessor = member;
}
- if (member.kind === 158 /* GetAccessor */ && !getAccessor) {
+ if (member.kind === 159 /* GetAccessor */ && !getAccessor) {
getAccessor = member;
}
- if (member.kind === 159 /* SetAccessor */ && !setAccessor) {
+ if (member.kind === 160 /* SetAccessor */ && !setAccessor) {
setAccessor = member;
}
}
@@ -11700,7 +11881,7 @@
ts.getJSDocTypeParameterDeclarations = getJSDocTypeParameterDeclarations;
/** template tags are only available when a typedef isn't already using them */
function isNonTypeAliasTemplate(tag) {
- return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 296 /* JSDocComment */ && tag.parent.tags.some(isJSDocTypeAlias));
+ return ts.isJSDocTemplateTag(tag) && !(tag.parent.kind === 297 /* JSDocComment */ && tag.parent.tags.some(isJSDocTypeAlias));
}
/**
* Gets the effective type annotation of the value parameter of a set accessor. If the node
@@ -11940,7 +12121,7 @@
flags |= modifierToFlag(modifier.kind);
}
}
- if (node.flags & 4 /* NestedNamespace */ || (node.kind === 72 /* Identifier */ && node.isInJSDocNamespace)) {
+ if (node.flags & 4 /* NestedNamespace */ || (node.kind === 73 /* Identifier */ && node.isInJSDocNamespace)) {
flags |= 1 /* Export */;
}
return flags;
@@ -11948,17 +12129,17 @@
ts.getModifierFlagsNoCache = getModifierFlagsNoCache;
function modifierToFlag(token) {
switch (token) {
- case 116 /* StaticKeyword */: return 32 /* Static */;
- case 115 /* PublicKeyword */: return 4 /* Public */;
- case 114 /* ProtectedKeyword */: return 16 /* Protected */;
- case 113 /* PrivateKeyword */: return 8 /* Private */;
- case 118 /* AbstractKeyword */: return 128 /* Abstract */;
- case 85 /* ExportKeyword */: return 1 /* Export */;
- case 125 /* DeclareKeyword */: return 2 /* Ambient */;
- case 77 /* ConstKeyword */: return 2048 /* Const */;
- case 80 /* DefaultKeyword */: return 512 /* Default */;
- case 121 /* AsyncKeyword */: return 256 /* Async */;
- case 133 /* ReadonlyKeyword */: return 64 /* Readonly */;
+ case 117 /* StaticKeyword */: return 32 /* Static */;
+ case 116 /* PublicKeyword */: return 4 /* Public */;
+ case 115 /* ProtectedKeyword */: return 16 /* Protected */;
+ case 114 /* PrivateKeyword */: return 8 /* Private */;
+ case 119 /* AbstractKeyword */: return 128 /* Abstract */;
+ case 86 /* ExportKeyword */: return 1 /* Export */;
+ case 126 /* DeclareKeyword */: return 2 /* Ambient */;
+ case 78 /* ConstKeyword */: return 2048 /* Const */;
+ case 81 /* DefaultKeyword */: return 512 /* Default */;
+ case 122 /* AsyncKeyword */: return 256 /* Async */;
+ case 134 /* ReadonlyKeyword */: return 64 /* Readonly */;
}
return 0 /* None */;
}
@@ -11970,7 +12151,7 @@
}
ts.isLogicalOperator = isLogicalOperator;
function isAssignmentOperator(token) {
- return token >= 59 /* FirstAssignment */ && token <= 71 /* LastAssignment */;
+ return token >= 60 /* FirstAssignment */ && token <= 72 /* LastAssignment */;
}
ts.isAssignmentOperator = isAssignmentOperator;
/** Get `C` given `N` if `N` is in the position `class C extends N` where `N` is an ExpressionWithTypeArguments. */
@@ -11983,14 +12164,14 @@
return ts.isExpressionWithTypeArguments(node)
&& ts.isHeritageClause(node.parent)
&& ts.isClassLike(node.parent.parent)
- ? { class: node.parent.parent, isImplements: node.parent.token === 109 /* ImplementsKeyword */ }
+ ? { class: node.parent.parent, isImplements: node.parent.token === 110 /* ImplementsKeyword */ }
: undefined;
}
ts.tryGetClassImplementingOrExtendingExpressionWithTypeArguments = tryGetClassImplementingOrExtendingExpressionWithTypeArguments;
function isAssignmentExpression(node, excludeCompoundAssignment) {
return ts.isBinaryExpression(node)
&& (excludeCompoundAssignment
- ? node.operatorToken.kind === 59 /* EqualsToken */
+ ? node.operatorToken.kind === 60 /* EqualsToken */
: isAssignmentOperator(node.operatorToken.kind))
&& ts.isLeftHandSideExpression(node.left);
}
@@ -11998,8 +12179,8 @@
function isDestructuringAssignment(node) {
if (isAssignmentExpression(node, /*excludeCompoundAssignment*/ true)) {
var kind = node.left.kind;
- return kind === 188 /* ObjectLiteralExpression */
- || kind === 187 /* ArrayLiteralExpression */;
+ return kind === 189 /* ObjectLiteralExpression */
+ || kind === 188 /* ArrayLiteralExpression */;
}
return false;
}
@@ -12009,29 +12190,39 @@
}
ts.isExpressionWithTypeArgumentsInClassExtendsClause = isExpressionWithTypeArgumentsInClassExtendsClause;
function isEntityNameExpression(node) {
- return node.kind === 72 /* Identifier */ || isPropertyAccessEntityNameExpression(node);
+ return node.kind === 73 /* Identifier */ || isPropertyAccessEntityNameExpression(node);
}
ts.isEntityNameExpression = isEntityNameExpression;
function isPropertyAccessEntityNameExpression(node) {
return ts.isPropertyAccessExpression(node) && isEntityNameExpression(node.expression);
}
ts.isPropertyAccessEntityNameExpression = isPropertyAccessEntityNameExpression;
+ function tryGetPropertyAccessOrIdentifierToString(expr) {
+ if (ts.isPropertyAccessExpression(expr)) {
+ return tryGetPropertyAccessOrIdentifierToString(expr.expression) + "." + expr.name;
+ }
+ if (ts.isIdentifier(expr)) {
+ return ts.unescapeLeadingUnderscores(expr.escapedText);
+ }
+ return undefined;
+ }
+ ts.tryGetPropertyAccessOrIdentifierToString = tryGetPropertyAccessOrIdentifierToString;
function isPrototypeAccess(node) {
return ts.isPropertyAccessExpression(node) && node.name.escapedText === "prototype";
}
ts.isPrototypeAccess = isPrototypeAccess;
function isRightSideOfQualifiedNameOrPropertyAccess(node) {
- return (node.parent.kind === 148 /* QualifiedName */ && node.parent.right === node) ||
- (node.parent.kind === 189 /* PropertyAccessExpression */ && node.parent.name === node);
+ return (node.parent.kind === 149 /* QualifiedName */ && node.parent.right === node) ||
+ (node.parent.kind === 190 /* PropertyAccessExpression */ && node.parent.name === node);
}
ts.isRightSideOfQualifiedNameOrPropertyAccess = isRightSideOfQualifiedNameOrPropertyAccess;
function isEmptyObjectLiteral(expression) {
- return expression.kind === 188 /* ObjectLiteralExpression */ &&
+ return expression.kind === 189 /* ObjectLiteralExpression */ &&
expression.properties.length === 0;
}
ts.isEmptyObjectLiteral = isEmptyObjectLiteral;
function isEmptyArrayLiteral(expression) {
- return expression.kind === 187 /* ArrayLiteralExpression */ &&
+ return expression.kind === 188 /* ArrayLiteralExpression */ &&
expression.elements.length === 0;
}
ts.isEmptyArrayLiteral = isEmptyArrayLiteral;
@@ -12220,77 +12411,6 @@
}
ts.getNewLineCharacter = getNewLineCharacter;
/**
- * Formats an enum value as a string for debugging and debug assertions.
- */
- function formatEnum(value, enumObject, isFlags) {
- if (value === void 0) { value = 0; }
- var members = getEnumMembers(enumObject);
- if (value === 0) {
- return members.length > 0 && members[0][0] === 0 ? members[0][1] : "0";
- }
- if (isFlags) {
- var result = "";
- var remainingFlags = value;
- for (var i = members.length - 1; i >= 0 && remainingFlags !== 0; i--) {
- var _a = members[i], enumValue = _a[0], enumName = _a[1];
- if (enumValue !== 0 && (remainingFlags & enumValue) === enumValue) {
- remainingFlags &= ~enumValue;
- result = "" + enumName + (result ? ", " : "") + result;
- }
- }
- if (remainingFlags === 0) {
- return result;
- }
- }
- else {
- for (var _i = 0, members_1 = members; _i < members_1.length; _i++) {
- var _b = members_1[_i], enumValue = _b[0], enumName = _b[1];
- if (enumValue === value) {
- return enumName;
- }
- }
- }
- return value.toString();
- }
- function getEnumMembers(enumObject) {
- var result = [];
- for (var name in enumObject) {
- var value = enumObject[name];
- if (typeof value === "number") {
- result.push([value, name]);
- }
- }
- return ts.stableSort(result, function (x, y) { return ts.compareValues(x[0], y[0]); });
- }
- function formatSyntaxKind(kind) {
- return formatEnum(kind, ts.SyntaxKind, /*isFlags*/ false);
- }
- ts.formatSyntaxKind = formatSyntaxKind;
- function formatModifierFlags(flags) {
- return formatEnum(flags, ts.ModifierFlags, /*isFlags*/ true);
- }
- ts.formatModifierFlags = formatModifierFlags;
- function formatTransformFlags(flags) {
- return formatEnum(flags, ts.TransformFlags, /*isFlags*/ true);
- }
- ts.formatTransformFlags = formatTransformFlags;
- function formatEmitFlags(flags) {
- return formatEnum(flags, ts.EmitFlags, /*isFlags*/ true);
- }
- ts.formatEmitFlags = formatEmitFlags;
- function formatSymbolFlags(flags) {
- return formatEnum(flags, ts.SymbolFlags, /*isFlags*/ true);
- }
- ts.formatSymbolFlags = formatSymbolFlags;
- function formatTypeFlags(flags) {
- return formatEnum(flags, ts.TypeFlags, /*isFlags*/ true);
- }
- ts.formatTypeFlags = formatTypeFlags;
- function formatObjectFlags(flags) {
- return formatEnum(flags, ts.ObjectFlags, /*isFlags*/ true);
- }
- ts.formatObjectFlags = formatObjectFlags;
- /**
* Creates a new TextRange from the provided pos and end.
*
* @param pos The start position.
@@ -12379,6 +12499,10 @@
return positionsAreOnSameLine(range1.end, getStartPositionOfRange(range2, sourceFile), sourceFile);
}
ts.rangeEndIsOnSameLineAsRangeStart = rangeEndIsOnSameLineAsRangeStart;
+ function isNodeArrayMultiLine(list, sourceFile) {
+ return !positionsAreOnSameLine(list.pos, list.end, sourceFile);
+ }
+ ts.isNodeArrayMultiLine = isNodeArrayMultiLine;
function positionsAreOnSameLine(pos1, pos2, sourceFile) {
return pos1 === pos2 ||
getLineOfLocalPosition(sourceFile, pos1) === getLineOfLocalPosition(sourceFile, pos2);
@@ -12396,8 +12520,8 @@
var parseNode = ts.getParseTreeNode(node);
if (parseNode) {
switch (parseNode.parent.kind) {
- case 243 /* EnumDeclaration */:
- case 244 /* ModuleDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 245 /* ModuleDeclaration */:
return parseNode === parseNode.parent.name;
}
}
@@ -12431,10 +12555,10 @@
}
if (getCheckFlags(s) & 6 /* Synthetic */) {
var checkFlags = s.checkFlags;
- var accessModifier = checkFlags & 512 /* ContainsPrivate */ ? 8 /* Private */ :
- checkFlags & 128 /* ContainsPublic */ ? 4 /* Public */ :
+ var accessModifier = checkFlags & 1024 /* ContainsPrivate */ ? 8 /* Private */ :
+ checkFlags & 256 /* ContainsPublic */ ? 4 /* Public */ :
16 /* Protected */;
- var staticModifier = checkFlags & 1024 /* ContainsStatic */ ? 32 /* Static */ : 0;
+ var staticModifier = checkFlags & 2048 /* ContainsStatic */ ? 32 /* Static */ : 0;
return accessModifier | staticModifier;
}
if (s.flags & 4194304 /* Prototype */) {
@@ -12474,35 +12598,35 @@
if (!parent)
return 0 /* Read */;
switch (parent.kind) {
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return accessKind(parent);
- case 203 /* PostfixUnaryExpression */:
- case 202 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
var operator = parent.operator;
return operator === 44 /* PlusPlusToken */ || operator === 45 /* MinusMinusToken */ ? writeOrReadWrite() : 0 /* Read */;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
var _a = parent, left = _a.left, operatorToken = _a.operatorToken;
return left === node && isAssignmentOperator(operatorToken.kind) ?
- operatorToken.kind === 59 /* EqualsToken */ ? 1 /* Write */ : writeOrReadWrite()
+ operatorToken.kind === 60 /* EqualsToken */ ? 1 /* Write */ : writeOrReadWrite()
: 0 /* Read */;
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return parent.name !== node ? 0 /* Read */ : accessKind(parent);
- case 275 /* PropertyAssignment */: {
+ case 276 /* PropertyAssignment */: {
var parentAccess = accessKind(parent.parent);
// In `({ x: varname }) = { x: 1 }`, the left `x` is a read, the right `x` is a write.
return node === parent.name ? reverseAccessKind(parentAccess) : parentAccess;
}
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
// Assume it's the local variable being accessed, since we don't check public properties for --noUnusedLocals.
return node === parent.objectAssignmentInitializer ? 0 /* Read */ : accessKind(parent.parent);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return accessKind(parent);
default:
return 0 /* Read */;
}
function writeOrReadWrite() {
// If grandparent is not an ExpressionStatement, this is used as an expression in addition to having a side effect.
- return parent.parent && skipParenthesesUp(parent.parent).kind === 221 /* ExpressionStatement */ ? 1 /* Write */ : 2 /* ReadWrite */;
+ return parent.parent && skipParenthesesUp(parent.parent).kind === 222 /* ExpressionStatement */ ? 1 /* Write */ : 2 /* ReadWrite */;
}
}
function reverseAccessKind(a) {
@@ -12657,32 +12781,32 @@
}
ts.isObjectTypeDeclaration = isObjectTypeDeclaration;
function isTypeNodeKind(kind) {
- return (kind >= 163 /* FirstTypeNode */ && kind <= 183 /* LastTypeNode */)
- || kind === 120 /* AnyKeyword */
- || kind === 143 /* UnknownKeyword */
- || kind === 135 /* NumberKeyword */
- || kind === 146 /* BigIntKeyword */
- || kind === 136 /* ObjectKeyword */
- || kind === 123 /* BooleanKeyword */
- || kind === 138 /* StringKeyword */
- || kind === 139 /* SymbolKeyword */
- || kind === 100 /* ThisKeyword */
- || kind === 106 /* VoidKeyword */
- || kind === 141 /* UndefinedKeyword */
- || kind === 96 /* NullKeyword */
- || kind === 132 /* NeverKeyword */
- || kind === 211 /* ExpressionWithTypeArguments */
- || kind === 289 /* JSDocAllType */
- || kind === 290 /* JSDocUnknownType */
- || kind === 291 /* JSDocNullableType */
- || kind === 292 /* JSDocNonNullableType */
- || kind === 293 /* JSDocOptionalType */
- || kind === 294 /* JSDocFunctionType */
- || kind === 295 /* JSDocVariadicType */;
+ return (kind >= 164 /* FirstTypeNode */ && kind <= 184 /* LastTypeNode */)
+ || kind === 121 /* AnyKeyword */
+ || kind === 144 /* UnknownKeyword */
+ || kind === 136 /* NumberKeyword */
+ || kind === 147 /* BigIntKeyword */
+ || kind === 137 /* ObjectKeyword */
+ || kind === 124 /* BooleanKeyword */
+ || kind === 139 /* StringKeyword */
+ || kind === 140 /* SymbolKeyword */
+ || kind === 101 /* ThisKeyword */
+ || kind === 107 /* VoidKeyword */
+ || kind === 142 /* UndefinedKeyword */
+ || kind === 97 /* NullKeyword */
+ || kind === 133 /* NeverKeyword */
+ || kind === 212 /* ExpressionWithTypeArguments */
+ || kind === 290 /* JSDocAllType */
+ || kind === 291 /* JSDocUnknownType */
+ || kind === 292 /* JSDocNullableType */
+ || kind === 293 /* JSDocNonNullableType */
+ || kind === 294 /* JSDocOptionalType */
+ || kind === 295 /* JSDocFunctionType */
+ || kind === 296 /* JSDocVariadicType */;
}
ts.isTypeNodeKind = isTypeNodeKind;
function isAccessExpression(node) {
- return node.kind === 189 /* PropertyAccessExpression */ || node.kind === 190 /* ElementAccessExpression */;
+ return node.kind === 190 /* PropertyAccessExpression */ || node.kind === 191 /* ElementAccessExpression */;
}
ts.isAccessExpression = isAccessExpression;
function isBundleFileTextLike(section) {
@@ -12699,8 +12823,10 @@
(function (ts) {
function getDefaultLibFileName(options) {
switch (options.target) {
- case 7 /* ESNext */:
+ case 8 /* ESNext */:
return "lib.esnext.full.d.ts";
+ case 7 /* ES2020 */:
+ return "lib.es2020.full.d.ts";
case 6 /* ES2019 */:
return "lib.es2019.full.d.ts";
case 5 /* ES2018 */:
@@ -12917,9 +13043,9 @@
}
ts.collapseTextChangeRangesAcrossMultipleVersions = collapseTextChangeRangesAcrossMultipleVersions;
function getTypeParameterOwner(d) {
- if (d && d.kind === 150 /* TypeParameter */) {
+ if (d && d.kind === 151 /* TypeParameter */) {
for (var current = d; current; current = current.parent) {
- if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 241 /* InterfaceDeclaration */) {
+ if (ts.isFunctionLike(current) || ts.isClassLike(current) || current.kind === 242 /* InterfaceDeclaration */) {
return current;
}
}
@@ -12927,7 +13053,7 @@
}
ts.getTypeParameterOwner = getTypeParameterOwner;
function isParameterPropertyDeclaration(node) {
- return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) && node.parent.kind === 157 /* Constructor */;
+ return ts.hasModifier(node, 92 /* ParameterPropertyModifier */) && node.parent.kind === 158 /* Constructor */;
}
ts.isParameterPropertyDeclaration = isParameterPropertyDeclaration;
function isEmptyBindingPattern(node) {
@@ -12957,14 +13083,14 @@
node = walkUpBindingElementsAndPatterns(node);
}
var flags = getFlags(node);
- if (node.kind === 237 /* VariableDeclaration */) {
+ if (node.kind === 238 /* VariableDeclaration */) {
node = node.parent;
}
- if (node && node.kind === 238 /* VariableDeclarationList */) {
+ if (node && node.kind === 239 /* VariableDeclarationList */) {
flags |= getFlags(node);
node = node.parent;
}
- if (node && node.kind === 219 /* VariableStatement */) {
+ if (node && node.kind === 220 /* VariableStatement */) {
flags |= getFlags(node);
}
return flags;
@@ -13110,27 +13236,27 @@
}
// Covers remaining cases (returning undefined if none match).
switch (hostNode.kind) {
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
if (hostNode.declarationList && hostNode.declarationList.declarations[0]) {
return getDeclarationIdentifier(hostNode.declarationList.declarations[0]);
}
break;
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
var expr = hostNode.expression;
switch (expr.kind) {
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return expr.name;
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
var arg = expr.argumentExpression;
if (ts.isIdentifier(arg)) {
return arg;
}
}
break;
- case 195 /* ParenthesizedExpression */: {
+ case 196 /* ParenthesizedExpression */: {
return getDeclarationIdentifier(hostNode.expression);
}
- case 233 /* LabeledStatement */: {
+ case 234 /* LabeledStatement */: {
if (ts.isDeclaration(hostNode.statement) || ts.isExpression(hostNode.statement)) {
return getDeclarationIdentifier(hostNode.statement);
}
@@ -13154,18 +13280,18 @@
/** @internal */
function getNonAssignedNameOfDeclaration(declaration) {
switch (declaration.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return declaration;
- case 310 /* JSDocPropertyTag */:
- case 304 /* JSDocParameterTag */: {
+ case 311 /* JSDocPropertyTag */:
+ case 305 /* JSDocParameterTag */: {
var name = declaration.name;
- if (name.kind === 148 /* QualifiedName */) {
+ if (name.kind === 149 /* QualifiedName */) {
return name.right;
}
break;
}
- case 191 /* CallExpression */:
- case 204 /* BinaryExpression */: {
+ case 192 /* CallExpression */:
+ case 205 /* BinaryExpression */: {
var expr = declaration;
switch (ts.getAssignmentDeclarationKind(expr)) {
case 1 /* ExportsProperty */:
@@ -13181,9 +13307,9 @@
return undefined;
}
}
- case 309 /* JSDocTypedefTag */:
+ case 310 /* JSDocTypedefTag */:
return getNameOfJSDocTypedef(declaration);
- case 254 /* ExportAssignment */: {
+ case 255 /* ExportAssignment */: {
var expression = declaration.expression;
return ts.isIdentifier(expression) ? expression : undefined;
}
@@ -13385,7 +13511,7 @@
return ts.emptyArray;
}
if (ts.isJSDocTypeAlias(node)) {
- ts.Debug.assert(node.parent.kind === 296 /* JSDocComment */);
+ ts.Debug.assert(node.parent.kind === 297 /* JSDocComment */);
return ts.flatMap(node.parent.tags, function (tag) { return ts.isJSDocTemplateTag(tag) ? tag.typeParameters : undefined; });
}
if (node.typeParameters) {
@@ -13453,198 +13579,198 @@
}
ts.isTemplateTail = isTemplateTail;
function isIdentifier(node) {
- return node.kind === 72 /* Identifier */;
+ return node.kind === 73 /* Identifier */;
}
ts.isIdentifier = isIdentifier;
// Names
function isQualifiedName(node) {
- return node.kind === 148 /* QualifiedName */;
+ return node.kind === 149 /* QualifiedName */;
}
ts.isQualifiedName = isQualifiedName;
function isComputedPropertyName(node) {
- return node.kind === 149 /* ComputedPropertyName */;
+ return node.kind === 150 /* ComputedPropertyName */;
}
ts.isComputedPropertyName = isComputedPropertyName;
// Signature elements
function isTypeParameterDeclaration(node) {
- return node.kind === 150 /* TypeParameter */;
+ return node.kind === 151 /* TypeParameter */;
}
ts.isTypeParameterDeclaration = isTypeParameterDeclaration;
function isParameter(node) {
- return node.kind === 151 /* Parameter */;
+ return node.kind === 152 /* Parameter */;
}
ts.isParameter = isParameter;
function isDecorator(node) {
- return node.kind === 152 /* Decorator */;
+ return node.kind === 153 /* Decorator */;
}
ts.isDecorator = isDecorator;
// TypeMember
function isPropertySignature(node) {
- return node.kind === 153 /* PropertySignature */;
+ return node.kind === 154 /* PropertySignature */;
}
ts.isPropertySignature = isPropertySignature;
function isPropertyDeclaration(node) {
- return node.kind === 154 /* PropertyDeclaration */;
+ return node.kind === 155 /* PropertyDeclaration */;
}
ts.isPropertyDeclaration = isPropertyDeclaration;
function isMethodSignature(node) {
- return node.kind === 155 /* MethodSignature */;
+ return node.kind === 156 /* MethodSignature */;
}
ts.isMethodSignature = isMethodSignature;
function isMethodDeclaration(node) {
- return node.kind === 156 /* MethodDeclaration */;
+ return node.kind === 157 /* MethodDeclaration */;
}
ts.isMethodDeclaration = isMethodDeclaration;
function isConstructorDeclaration(node) {
- return node.kind === 157 /* Constructor */;
+ return node.kind === 158 /* Constructor */;
}
ts.isConstructorDeclaration = isConstructorDeclaration;
function isGetAccessorDeclaration(node) {
- return node.kind === 158 /* GetAccessor */;
+ return node.kind === 159 /* GetAccessor */;
}
ts.isGetAccessorDeclaration = isGetAccessorDeclaration;
function isSetAccessorDeclaration(node) {
- return node.kind === 159 /* SetAccessor */;
+ return node.kind === 160 /* SetAccessor */;
}
ts.isSetAccessorDeclaration = isSetAccessorDeclaration;
function isCallSignatureDeclaration(node) {
- return node.kind === 160 /* CallSignature */;
+ return node.kind === 161 /* CallSignature */;
}
ts.isCallSignatureDeclaration = isCallSignatureDeclaration;
function isConstructSignatureDeclaration(node) {
- return node.kind === 161 /* ConstructSignature */;
+ return node.kind === 162 /* ConstructSignature */;
}
ts.isConstructSignatureDeclaration = isConstructSignatureDeclaration;
function isIndexSignatureDeclaration(node) {
- return node.kind === 162 /* IndexSignature */;
+ return node.kind === 163 /* IndexSignature */;
}
ts.isIndexSignatureDeclaration = isIndexSignatureDeclaration;
/* @internal */
function isGetOrSetAccessorDeclaration(node) {
- return node.kind === 159 /* SetAccessor */ || node.kind === 158 /* GetAccessor */;
+ return node.kind === 160 /* SetAccessor */ || node.kind === 159 /* GetAccessor */;
}
ts.isGetOrSetAccessorDeclaration = isGetOrSetAccessorDeclaration;
// Type
function isTypePredicateNode(node) {
- return node.kind === 163 /* TypePredicate */;
+ return node.kind === 164 /* TypePredicate */;
}
ts.isTypePredicateNode = isTypePredicateNode;
function isTypeReferenceNode(node) {
- return node.kind === 164 /* TypeReference */;
+ return node.kind === 165 /* TypeReference */;
}
ts.isTypeReferenceNode = isTypeReferenceNode;
function isFunctionTypeNode(node) {
- return node.kind === 165 /* FunctionType */;
+ return node.kind === 166 /* FunctionType */;
}
ts.isFunctionTypeNode = isFunctionTypeNode;
function isConstructorTypeNode(node) {
- return node.kind === 166 /* ConstructorType */;
+ return node.kind === 167 /* ConstructorType */;
}
ts.isConstructorTypeNode = isConstructorTypeNode;
function isTypeQueryNode(node) {
- return node.kind === 167 /* TypeQuery */;
+ return node.kind === 168 /* TypeQuery */;
}
ts.isTypeQueryNode = isTypeQueryNode;
function isTypeLiteralNode(node) {
- return node.kind === 168 /* TypeLiteral */;
+ return node.kind === 169 /* TypeLiteral */;
}
ts.isTypeLiteralNode = isTypeLiteralNode;
function isArrayTypeNode(node) {
- return node.kind === 169 /* ArrayType */;
+ return node.kind === 170 /* ArrayType */;
}
ts.isArrayTypeNode = isArrayTypeNode;
function isTupleTypeNode(node) {
- return node.kind === 170 /* TupleType */;
+ return node.kind === 171 /* TupleType */;
}
ts.isTupleTypeNode = isTupleTypeNode;
function isUnionTypeNode(node) {
- return node.kind === 173 /* UnionType */;
+ return node.kind === 174 /* UnionType */;
}
ts.isUnionTypeNode = isUnionTypeNode;
function isIntersectionTypeNode(node) {
- return node.kind === 174 /* IntersectionType */;
+ return node.kind === 175 /* IntersectionType */;
}
ts.isIntersectionTypeNode = isIntersectionTypeNode;
function isConditionalTypeNode(node) {
- return node.kind === 175 /* ConditionalType */;
+ return node.kind === 176 /* ConditionalType */;
}
ts.isConditionalTypeNode = isConditionalTypeNode;
function isInferTypeNode(node) {
- return node.kind === 176 /* InferType */;
+ return node.kind === 177 /* InferType */;
}
ts.isInferTypeNode = isInferTypeNode;
function isParenthesizedTypeNode(node) {
- return node.kind === 177 /* ParenthesizedType */;
+ return node.kind === 178 /* ParenthesizedType */;
}
ts.isParenthesizedTypeNode = isParenthesizedTypeNode;
function isThisTypeNode(node) {
- return node.kind === 178 /* ThisType */;
+ return node.kind === 179 /* ThisType */;
}
ts.isThisTypeNode = isThisTypeNode;
function isTypeOperatorNode(node) {
- return node.kind === 179 /* TypeOperator */;
+ return node.kind === 180 /* TypeOperator */;
}
ts.isTypeOperatorNode = isTypeOperatorNode;
function isIndexedAccessTypeNode(node) {
- return node.kind === 180 /* IndexedAccessType */;
+ return node.kind === 181 /* IndexedAccessType */;
}
ts.isIndexedAccessTypeNode = isIndexedAccessTypeNode;
function isMappedTypeNode(node) {
- return node.kind === 181 /* MappedType */;
+ return node.kind === 182 /* MappedType */;
}
ts.isMappedTypeNode = isMappedTypeNode;
function isLiteralTypeNode(node) {
- return node.kind === 182 /* LiteralType */;
+ return node.kind === 183 /* LiteralType */;
}
ts.isLiteralTypeNode = isLiteralTypeNode;
function isImportTypeNode(node) {
- return node.kind === 183 /* ImportType */;
+ return node.kind === 184 /* ImportType */;
}
ts.isImportTypeNode = isImportTypeNode;
// Binding patterns
function isObjectBindingPattern(node) {
- return node.kind === 184 /* ObjectBindingPattern */;
+ return node.kind === 185 /* ObjectBindingPattern */;
}
ts.isObjectBindingPattern = isObjectBindingPattern;
function isArrayBindingPattern(node) {
- return node.kind === 185 /* ArrayBindingPattern */;
+ return node.kind === 186 /* ArrayBindingPattern */;
}
ts.isArrayBindingPattern = isArrayBindingPattern;
function isBindingElement(node) {
- return node.kind === 186 /* BindingElement */;
+ return node.kind === 187 /* BindingElement */;
}
ts.isBindingElement = isBindingElement;
// Expression
function isArrayLiteralExpression(node) {
- return node.kind === 187 /* ArrayLiteralExpression */;
+ return node.kind === 188 /* ArrayLiteralExpression */;
}
ts.isArrayLiteralExpression = isArrayLiteralExpression;
function isObjectLiteralExpression(node) {
- return node.kind === 188 /* ObjectLiteralExpression */;
+ return node.kind === 189 /* ObjectLiteralExpression */;
}
ts.isObjectLiteralExpression = isObjectLiteralExpression;
function isPropertyAccessExpression(node) {
- return node.kind === 189 /* PropertyAccessExpression */;
+ return node.kind === 190 /* PropertyAccessExpression */;
}
ts.isPropertyAccessExpression = isPropertyAccessExpression;
function isElementAccessExpression(node) {
- return node.kind === 190 /* ElementAccessExpression */;
+ return node.kind === 191 /* ElementAccessExpression */;
}
ts.isElementAccessExpression = isElementAccessExpression;
function isCallExpression(node) {
- return node.kind === 191 /* CallExpression */;
+ return node.kind === 192 /* CallExpression */;
}
ts.isCallExpression = isCallExpression;
function isNewExpression(node) {
- return node.kind === 192 /* NewExpression */;
+ return node.kind === 193 /* NewExpression */;
}
ts.isNewExpression = isNewExpression;
function isTaggedTemplateExpression(node) {
- return node.kind === 193 /* TaggedTemplateExpression */;
+ return node.kind === 194 /* TaggedTemplateExpression */;
}
ts.isTaggedTemplateExpression = isTaggedTemplateExpression;
function isTypeAssertion(node) {
- return node.kind === 194 /* TypeAssertionExpression */;
+ return node.kind === 195 /* TypeAssertionExpression */;
}
ts.isTypeAssertion = isTypeAssertion;
function isConstTypeReference(node) {
@@ -13653,376 +13779,376 @@
}
ts.isConstTypeReference = isConstTypeReference;
function isParenthesizedExpression(node) {
- return node.kind === 195 /* ParenthesizedExpression */;
+ return node.kind === 196 /* ParenthesizedExpression */;
}
ts.isParenthesizedExpression = isParenthesizedExpression;
function skipPartiallyEmittedExpressions(node) {
- while (node.kind === 313 /* PartiallyEmittedExpression */) {
+ while (node.kind === 314 /* PartiallyEmittedExpression */) {
node = node.expression;
}
return node;
}
ts.skipPartiallyEmittedExpressions = skipPartiallyEmittedExpressions;
function isFunctionExpression(node) {
- return node.kind === 196 /* FunctionExpression */;
+ return node.kind === 197 /* FunctionExpression */;
}
ts.isFunctionExpression = isFunctionExpression;
function isArrowFunction(node) {
- return node.kind === 197 /* ArrowFunction */;
+ return node.kind === 198 /* ArrowFunction */;
}
ts.isArrowFunction = isArrowFunction;
function isDeleteExpression(node) {
- return node.kind === 198 /* DeleteExpression */;
+ return node.kind === 199 /* DeleteExpression */;
}
ts.isDeleteExpression = isDeleteExpression;
function isTypeOfExpression(node) {
- return node.kind === 199 /* TypeOfExpression */;
+ return node.kind === 200 /* TypeOfExpression */;
}
ts.isTypeOfExpression = isTypeOfExpression;
function isVoidExpression(node) {
- return node.kind === 200 /* VoidExpression */;
+ return node.kind === 201 /* VoidExpression */;
}
ts.isVoidExpression = isVoidExpression;
function isAwaitExpression(node) {
- return node.kind === 201 /* AwaitExpression */;
+ return node.kind === 202 /* AwaitExpression */;
}
ts.isAwaitExpression = isAwaitExpression;
function isPrefixUnaryExpression(node) {
- return node.kind === 202 /* PrefixUnaryExpression */;
+ return node.kind === 203 /* PrefixUnaryExpression */;
}
ts.isPrefixUnaryExpression = isPrefixUnaryExpression;
function isPostfixUnaryExpression(node) {
- return node.kind === 203 /* PostfixUnaryExpression */;
+ return node.kind === 204 /* PostfixUnaryExpression */;
}
ts.isPostfixUnaryExpression = isPostfixUnaryExpression;
function isBinaryExpression(node) {
- return node.kind === 204 /* BinaryExpression */;
+ return node.kind === 205 /* BinaryExpression */;
}
ts.isBinaryExpression = isBinaryExpression;
function isConditionalExpression(node) {
- return node.kind === 205 /* ConditionalExpression */;
+ return node.kind === 206 /* ConditionalExpression */;
}
ts.isConditionalExpression = isConditionalExpression;
function isTemplateExpression(node) {
- return node.kind === 206 /* TemplateExpression */;
+ return node.kind === 207 /* TemplateExpression */;
}
ts.isTemplateExpression = isTemplateExpression;
function isYieldExpression(node) {
- return node.kind === 207 /* YieldExpression */;
+ return node.kind === 208 /* YieldExpression */;
}
ts.isYieldExpression = isYieldExpression;
function isSpreadElement(node) {
- return node.kind === 208 /* SpreadElement */;
+ return node.kind === 209 /* SpreadElement */;
}
ts.isSpreadElement = isSpreadElement;
function isClassExpression(node) {
- return node.kind === 209 /* ClassExpression */;
+ return node.kind === 210 /* ClassExpression */;
}
ts.isClassExpression = isClassExpression;
function isOmittedExpression(node) {
- return node.kind === 210 /* OmittedExpression */;
+ return node.kind === 211 /* OmittedExpression */;
}
ts.isOmittedExpression = isOmittedExpression;
function isExpressionWithTypeArguments(node) {
- return node.kind === 211 /* ExpressionWithTypeArguments */;
+ return node.kind === 212 /* ExpressionWithTypeArguments */;
}
ts.isExpressionWithTypeArguments = isExpressionWithTypeArguments;
function isAsExpression(node) {
- return node.kind === 212 /* AsExpression */;
+ return node.kind === 213 /* AsExpression */;
}
ts.isAsExpression = isAsExpression;
function isNonNullExpression(node) {
- return node.kind === 213 /* NonNullExpression */;
+ return node.kind === 214 /* NonNullExpression */;
}
ts.isNonNullExpression = isNonNullExpression;
function isMetaProperty(node) {
- return node.kind === 214 /* MetaProperty */;
+ return node.kind === 215 /* MetaProperty */;
}
ts.isMetaProperty = isMetaProperty;
// Misc
function isTemplateSpan(node) {
- return node.kind === 216 /* TemplateSpan */;
+ return node.kind === 217 /* TemplateSpan */;
}
ts.isTemplateSpan = isTemplateSpan;
function isSemicolonClassElement(node) {
- return node.kind === 217 /* SemicolonClassElement */;
+ return node.kind === 218 /* SemicolonClassElement */;
}
ts.isSemicolonClassElement = isSemicolonClassElement;
// Block
function isBlock(node) {
- return node.kind === 218 /* Block */;
+ return node.kind === 219 /* Block */;
}
ts.isBlock = isBlock;
function isVariableStatement(node) {
- return node.kind === 219 /* VariableStatement */;
+ return node.kind === 220 /* VariableStatement */;
}
ts.isVariableStatement = isVariableStatement;
function isEmptyStatement(node) {
- return node.kind === 220 /* EmptyStatement */;
+ return node.kind === 221 /* EmptyStatement */;
}
ts.isEmptyStatement = isEmptyStatement;
function isExpressionStatement(node) {
- return node.kind === 221 /* ExpressionStatement */;
+ return node.kind === 222 /* ExpressionStatement */;
}
ts.isExpressionStatement = isExpressionStatement;
function isIfStatement(node) {
- return node.kind === 222 /* IfStatement */;
+ return node.kind === 223 /* IfStatement */;
}
ts.isIfStatement = isIfStatement;
function isDoStatement(node) {
- return node.kind === 223 /* DoStatement */;
+ return node.kind === 224 /* DoStatement */;
}
ts.isDoStatement = isDoStatement;
function isWhileStatement(node) {
- return node.kind === 224 /* WhileStatement */;
+ return node.kind === 225 /* WhileStatement */;
}
ts.isWhileStatement = isWhileStatement;
function isForStatement(node) {
- return node.kind === 225 /* ForStatement */;
+ return node.kind === 226 /* ForStatement */;
}
ts.isForStatement = isForStatement;
function isForInStatement(node) {
- return node.kind === 226 /* ForInStatement */;
+ return node.kind === 227 /* ForInStatement */;
}
ts.isForInStatement = isForInStatement;
function isForOfStatement(node) {
- return node.kind === 227 /* ForOfStatement */;
+ return node.kind === 228 /* ForOfStatement */;
}
ts.isForOfStatement = isForOfStatement;
function isContinueStatement(node) {
- return node.kind === 228 /* ContinueStatement */;
+ return node.kind === 229 /* ContinueStatement */;
}
ts.isContinueStatement = isContinueStatement;
function isBreakStatement(node) {
- return node.kind === 229 /* BreakStatement */;
+ return node.kind === 230 /* BreakStatement */;
}
ts.isBreakStatement = isBreakStatement;
function isBreakOrContinueStatement(node) {
- return node.kind === 229 /* BreakStatement */ || node.kind === 228 /* ContinueStatement */;
+ return node.kind === 230 /* BreakStatement */ || node.kind === 229 /* ContinueStatement */;
}
ts.isBreakOrContinueStatement = isBreakOrContinueStatement;
function isReturnStatement(node) {
- return node.kind === 230 /* ReturnStatement */;
+ return node.kind === 231 /* ReturnStatement */;
}
ts.isReturnStatement = isReturnStatement;
function isWithStatement(node) {
- return node.kind === 231 /* WithStatement */;
+ return node.kind === 232 /* WithStatement */;
}
ts.isWithStatement = isWithStatement;
function isSwitchStatement(node) {
- return node.kind === 232 /* SwitchStatement */;
+ return node.kind === 233 /* SwitchStatement */;
}
ts.isSwitchStatement = isSwitchStatement;
function isLabeledStatement(node) {
- return node.kind === 233 /* LabeledStatement */;
+ return node.kind === 234 /* LabeledStatement */;
}
ts.isLabeledStatement = isLabeledStatement;
function isThrowStatement(node) {
- return node.kind === 234 /* ThrowStatement */;
+ return node.kind === 235 /* ThrowStatement */;
}
ts.isThrowStatement = isThrowStatement;
function isTryStatement(node) {
- return node.kind === 235 /* TryStatement */;
+ return node.kind === 236 /* TryStatement */;
}
ts.isTryStatement = isTryStatement;
function isDebuggerStatement(node) {
- return node.kind === 236 /* DebuggerStatement */;
+ return node.kind === 237 /* DebuggerStatement */;
}
ts.isDebuggerStatement = isDebuggerStatement;
function isVariableDeclaration(node) {
- return node.kind === 237 /* VariableDeclaration */;
+ return node.kind === 238 /* VariableDeclaration */;
}
ts.isVariableDeclaration = isVariableDeclaration;
function isVariableDeclarationList(node) {
- return node.kind === 238 /* VariableDeclarationList */;
+ return node.kind === 239 /* VariableDeclarationList */;
}
ts.isVariableDeclarationList = isVariableDeclarationList;
function isFunctionDeclaration(node) {
- return node.kind === 239 /* FunctionDeclaration */;
+ return node.kind === 240 /* FunctionDeclaration */;
}
ts.isFunctionDeclaration = isFunctionDeclaration;
function isClassDeclaration(node) {
- return node.kind === 240 /* ClassDeclaration */;
+ return node.kind === 241 /* ClassDeclaration */;
}
ts.isClassDeclaration = isClassDeclaration;
function isInterfaceDeclaration(node) {
- return node.kind === 241 /* InterfaceDeclaration */;
+ return node.kind === 242 /* InterfaceDeclaration */;
}
ts.isInterfaceDeclaration = isInterfaceDeclaration;
function isTypeAliasDeclaration(node) {
- return node.kind === 242 /* TypeAliasDeclaration */;
+ return node.kind === 243 /* TypeAliasDeclaration */;
}
ts.isTypeAliasDeclaration = isTypeAliasDeclaration;
function isEnumDeclaration(node) {
- return node.kind === 243 /* EnumDeclaration */;
+ return node.kind === 244 /* EnumDeclaration */;
}
ts.isEnumDeclaration = isEnumDeclaration;
function isModuleDeclaration(node) {
- return node.kind === 244 /* ModuleDeclaration */;
+ return node.kind === 245 /* ModuleDeclaration */;
}
ts.isModuleDeclaration = isModuleDeclaration;
function isModuleBlock(node) {
- return node.kind === 245 /* ModuleBlock */;
+ return node.kind === 246 /* ModuleBlock */;
}
ts.isModuleBlock = isModuleBlock;
function isCaseBlock(node) {
- return node.kind === 246 /* CaseBlock */;
+ return node.kind === 247 /* CaseBlock */;
}
ts.isCaseBlock = isCaseBlock;
function isNamespaceExportDeclaration(node) {
- return node.kind === 247 /* NamespaceExportDeclaration */;
+ return node.kind === 248 /* NamespaceExportDeclaration */;
}
ts.isNamespaceExportDeclaration = isNamespaceExportDeclaration;
function isImportEqualsDeclaration(node) {
- return node.kind === 248 /* ImportEqualsDeclaration */;
+ return node.kind === 249 /* ImportEqualsDeclaration */;
}
ts.isImportEqualsDeclaration = isImportEqualsDeclaration;
function isImportDeclaration(node) {
- return node.kind === 249 /* ImportDeclaration */;
+ return node.kind === 250 /* ImportDeclaration */;
}
ts.isImportDeclaration = isImportDeclaration;
function isImportClause(node) {
- return node.kind === 250 /* ImportClause */;
+ return node.kind === 251 /* ImportClause */;
}
ts.isImportClause = isImportClause;
function isNamespaceImport(node) {
- return node.kind === 251 /* NamespaceImport */;
+ return node.kind === 252 /* NamespaceImport */;
}
ts.isNamespaceImport = isNamespaceImport;
function isNamedImports(node) {
- return node.kind === 252 /* NamedImports */;
+ return node.kind === 253 /* NamedImports */;
}
ts.isNamedImports = isNamedImports;
function isImportSpecifier(node) {
- return node.kind === 253 /* ImportSpecifier */;
+ return node.kind === 254 /* ImportSpecifier */;
}
ts.isImportSpecifier = isImportSpecifier;
function isExportAssignment(node) {
- return node.kind === 254 /* ExportAssignment */;
+ return node.kind === 255 /* ExportAssignment */;
}
ts.isExportAssignment = isExportAssignment;
function isExportDeclaration(node) {
- return node.kind === 255 /* ExportDeclaration */;
+ return node.kind === 256 /* ExportDeclaration */;
}
ts.isExportDeclaration = isExportDeclaration;
function isNamedExports(node) {
- return node.kind === 256 /* NamedExports */;
+ return node.kind === 257 /* NamedExports */;
}
ts.isNamedExports = isNamedExports;
function isExportSpecifier(node) {
- return node.kind === 257 /* ExportSpecifier */;
+ return node.kind === 258 /* ExportSpecifier */;
}
ts.isExportSpecifier = isExportSpecifier;
function isMissingDeclaration(node) {
- return node.kind === 258 /* MissingDeclaration */;
+ return node.kind === 259 /* MissingDeclaration */;
}
ts.isMissingDeclaration = isMissingDeclaration;
// Module References
function isExternalModuleReference(node) {
- return node.kind === 259 /* ExternalModuleReference */;
+ return node.kind === 260 /* ExternalModuleReference */;
}
ts.isExternalModuleReference = isExternalModuleReference;
// JSX
function isJsxElement(node) {
- return node.kind === 260 /* JsxElement */;
+ return node.kind === 261 /* JsxElement */;
}
ts.isJsxElement = isJsxElement;
function isJsxSelfClosingElement(node) {
- return node.kind === 261 /* JsxSelfClosingElement */;
+ return node.kind === 262 /* JsxSelfClosingElement */;
}
ts.isJsxSelfClosingElement = isJsxSelfClosingElement;
function isJsxOpeningElement(node) {
- return node.kind === 262 /* JsxOpeningElement */;
+ return node.kind === 263 /* JsxOpeningElement */;
}
ts.isJsxOpeningElement = isJsxOpeningElement;
function isJsxClosingElement(node) {
- return node.kind === 263 /* JsxClosingElement */;
+ return node.kind === 264 /* JsxClosingElement */;
}
ts.isJsxClosingElement = isJsxClosingElement;
function isJsxFragment(node) {
- return node.kind === 264 /* JsxFragment */;
+ return node.kind === 265 /* JsxFragment */;
}
ts.isJsxFragment = isJsxFragment;
function isJsxOpeningFragment(node) {
- return node.kind === 265 /* JsxOpeningFragment */;
+ return node.kind === 266 /* JsxOpeningFragment */;
}
ts.isJsxOpeningFragment = isJsxOpeningFragment;
function isJsxClosingFragment(node) {
- return node.kind === 266 /* JsxClosingFragment */;
+ return node.kind === 267 /* JsxClosingFragment */;
}
ts.isJsxClosingFragment = isJsxClosingFragment;
function isJsxAttribute(node) {
- return node.kind === 267 /* JsxAttribute */;
+ return node.kind === 268 /* JsxAttribute */;
}
ts.isJsxAttribute = isJsxAttribute;
function isJsxAttributes(node) {
- return node.kind === 268 /* JsxAttributes */;
+ return node.kind === 269 /* JsxAttributes */;
}
ts.isJsxAttributes = isJsxAttributes;
function isJsxSpreadAttribute(node) {
- return node.kind === 269 /* JsxSpreadAttribute */;
+ return node.kind === 270 /* JsxSpreadAttribute */;
}
ts.isJsxSpreadAttribute = isJsxSpreadAttribute;
function isJsxExpression(node) {
- return node.kind === 270 /* JsxExpression */;
+ return node.kind === 271 /* JsxExpression */;
}
ts.isJsxExpression = isJsxExpression;
// Clauses
function isCaseClause(node) {
- return node.kind === 271 /* CaseClause */;
+ return node.kind === 272 /* CaseClause */;
}
ts.isCaseClause = isCaseClause;
function isDefaultClause(node) {
- return node.kind === 272 /* DefaultClause */;
+ return node.kind === 273 /* DefaultClause */;
}
ts.isDefaultClause = isDefaultClause;
function isHeritageClause(node) {
- return node.kind === 273 /* HeritageClause */;
+ return node.kind === 274 /* HeritageClause */;
}
ts.isHeritageClause = isHeritageClause;
function isCatchClause(node) {
- return node.kind === 274 /* CatchClause */;
+ return node.kind === 275 /* CatchClause */;
}
ts.isCatchClause = isCatchClause;
// Property assignments
function isPropertyAssignment(node) {
- return node.kind === 275 /* PropertyAssignment */;
+ return node.kind === 276 /* PropertyAssignment */;
}
ts.isPropertyAssignment = isPropertyAssignment;
function isShorthandPropertyAssignment(node) {
- return node.kind === 276 /* ShorthandPropertyAssignment */;
+ return node.kind === 277 /* ShorthandPropertyAssignment */;
}
ts.isShorthandPropertyAssignment = isShorthandPropertyAssignment;
function isSpreadAssignment(node) {
- return node.kind === 277 /* SpreadAssignment */;
+ return node.kind === 278 /* SpreadAssignment */;
}
ts.isSpreadAssignment = isSpreadAssignment;
// Enum
function isEnumMember(node) {
- return node.kind === 278 /* EnumMember */;
+ return node.kind === 279 /* EnumMember */;
}
ts.isEnumMember = isEnumMember;
// Top-level nodes
function isSourceFile(node) {
- return node.kind === 284 /* SourceFile */;
+ return node.kind === 285 /* SourceFile */;
}
ts.isSourceFile = isSourceFile;
function isBundle(node) {
- return node.kind === 285 /* Bundle */;
+ return node.kind === 286 /* Bundle */;
}
ts.isBundle = isBundle;
function isUnparsedSource(node) {
- return node.kind === 286 /* UnparsedSource */;
+ return node.kind === 287 /* UnparsedSource */;
}
ts.isUnparsedSource = isUnparsedSource;
function isUnparsedPrepend(node) {
- return node.kind === 280 /* UnparsedPrepend */;
+ return node.kind === 281 /* UnparsedPrepend */;
}
ts.isUnparsedPrepend = isUnparsedPrepend;
function isUnparsedTextLike(node) {
switch (node.kind) {
- case 281 /* UnparsedText */:
- case 282 /* UnparsedInternalText */:
+ case 282 /* UnparsedText */:
+ case 283 /* UnparsedInternalText */:
return true;
default:
return false;
@@ -14031,101 +14157,101 @@
ts.isUnparsedTextLike = isUnparsedTextLike;
function isUnparsedNode(node) {
return isUnparsedTextLike(node) ||
- node.kind === 279 /* UnparsedPrologue */ ||
- node.kind === 283 /* UnparsedSyntheticReference */;
+ node.kind === 280 /* UnparsedPrologue */ ||
+ node.kind === 284 /* UnparsedSyntheticReference */;
}
ts.isUnparsedNode = isUnparsedNode;
// JSDoc
function isJSDocTypeExpression(node) {
- return node.kind === 288 /* JSDocTypeExpression */;
+ return node.kind === 289 /* JSDocTypeExpression */;
}
ts.isJSDocTypeExpression = isJSDocTypeExpression;
function isJSDocAllType(node) {
- return node.kind === 289 /* JSDocAllType */;
+ return node.kind === 290 /* JSDocAllType */;
}
ts.isJSDocAllType = isJSDocAllType;
function isJSDocUnknownType(node) {
- return node.kind === 290 /* JSDocUnknownType */;
+ return node.kind === 291 /* JSDocUnknownType */;
}
ts.isJSDocUnknownType = isJSDocUnknownType;
function isJSDocNullableType(node) {
- return node.kind === 291 /* JSDocNullableType */;
+ return node.kind === 292 /* JSDocNullableType */;
}
ts.isJSDocNullableType = isJSDocNullableType;
function isJSDocNonNullableType(node) {
- return node.kind === 292 /* JSDocNonNullableType */;
+ return node.kind === 293 /* JSDocNonNullableType */;
}
ts.isJSDocNonNullableType = isJSDocNonNullableType;
function isJSDocOptionalType(node) {
- return node.kind === 293 /* JSDocOptionalType */;
+ return node.kind === 294 /* JSDocOptionalType */;
}
ts.isJSDocOptionalType = isJSDocOptionalType;
function isJSDocFunctionType(node) {
- return node.kind === 294 /* JSDocFunctionType */;
+ return node.kind === 295 /* JSDocFunctionType */;
}
ts.isJSDocFunctionType = isJSDocFunctionType;
function isJSDocVariadicType(node) {
- return node.kind === 295 /* JSDocVariadicType */;
+ return node.kind === 296 /* JSDocVariadicType */;
}
ts.isJSDocVariadicType = isJSDocVariadicType;
function isJSDoc(node) {
- return node.kind === 296 /* JSDocComment */;
+ return node.kind === 297 /* JSDocComment */;
}
ts.isJSDoc = isJSDoc;
function isJSDocAugmentsTag(node) {
- return node.kind === 300 /* JSDocAugmentsTag */;
+ return node.kind === 301 /* JSDocAugmentsTag */;
}
ts.isJSDocAugmentsTag = isJSDocAugmentsTag;
function isJSDocClassTag(node) {
- return node.kind === 301 /* JSDocClassTag */;
+ return node.kind === 302 /* JSDocClassTag */;
}
ts.isJSDocClassTag = isJSDocClassTag;
function isJSDocEnumTag(node) {
- return node.kind === 303 /* JSDocEnumTag */;
+ return node.kind === 304 /* JSDocEnumTag */;
}
ts.isJSDocEnumTag = isJSDocEnumTag;
function isJSDocThisTag(node) {
- return node.kind === 306 /* JSDocThisTag */;
+ return node.kind === 307 /* JSDocThisTag */;
}
ts.isJSDocThisTag = isJSDocThisTag;
function isJSDocParameterTag(node) {
- return node.kind === 304 /* JSDocParameterTag */;
+ return node.kind === 305 /* JSDocParameterTag */;
}
ts.isJSDocParameterTag = isJSDocParameterTag;
function isJSDocReturnTag(node) {
- return node.kind === 305 /* JSDocReturnTag */;
+ return node.kind === 306 /* JSDocReturnTag */;
}
ts.isJSDocReturnTag = isJSDocReturnTag;
function isJSDocTypeTag(node) {
- return node.kind === 307 /* JSDocTypeTag */;
+ return node.kind === 308 /* JSDocTypeTag */;
}
ts.isJSDocTypeTag = isJSDocTypeTag;
function isJSDocTemplateTag(node) {
- return node.kind === 308 /* JSDocTemplateTag */;
+ return node.kind === 309 /* JSDocTemplateTag */;
}
ts.isJSDocTemplateTag = isJSDocTemplateTag;
function isJSDocTypedefTag(node) {
- return node.kind === 309 /* JSDocTypedefTag */;
+ return node.kind === 310 /* JSDocTypedefTag */;
}
ts.isJSDocTypedefTag = isJSDocTypedefTag;
function isJSDocPropertyTag(node) {
- return node.kind === 310 /* JSDocPropertyTag */;
+ return node.kind === 311 /* JSDocPropertyTag */;
}
ts.isJSDocPropertyTag = isJSDocPropertyTag;
function isJSDocPropertyLikeTag(node) {
- return node.kind === 310 /* JSDocPropertyTag */ || node.kind === 304 /* JSDocParameterTag */;
+ return node.kind === 311 /* JSDocPropertyTag */ || node.kind === 305 /* JSDocParameterTag */;
}
ts.isJSDocPropertyLikeTag = isJSDocPropertyLikeTag;
function isJSDocTypeLiteral(node) {
- return node.kind === 297 /* JSDocTypeLiteral */;
+ return node.kind === 298 /* JSDocTypeLiteral */;
}
ts.isJSDocTypeLiteral = isJSDocTypeLiteral;
function isJSDocCallbackTag(node) {
- return node.kind === 302 /* JSDocCallbackTag */;
+ return node.kind === 303 /* JSDocCallbackTag */;
}
ts.isJSDocCallbackTag = isJSDocCallbackTag;
function isJSDocSignature(node) {
- return node.kind === 298 /* JSDocSignature */;
+ return node.kind === 299 /* JSDocSignature */;
}
ts.isJSDocSignature = isJSDocSignature;
})(ts || (ts = {}));
@@ -14136,7 +14262,7 @@
(function (ts) {
/* @internal */
function isSyntaxList(n) {
- return n.kind === 311 /* SyntaxList */;
+ return n.kind === 312 /* SyntaxList */;
}
ts.isSyntaxList = isSyntaxList;
/* @internal */
@@ -14146,7 +14272,7 @@
ts.isNode = isNode;
/* @internal */
function isNodeKind(kind) {
- return kind >= 148 /* FirstNode */;
+ return kind >= 149 /* FirstNode */;
}
ts.isNodeKind = isNodeKind;
/**
@@ -14155,7 +14281,7 @@
* Literals are considered tokens, except TemplateLiteral, but does include TemplateHead/Middle/Tail.
*/
function isToken(n) {
- return n.kind >= 0 /* FirstToken */ && n.kind <= 147 /* LastToken */;
+ return n.kind >= 0 /* FirstToken */ && n.kind <= 148 /* LastToken */;
}
ts.isToken = isToken;
// Node Arrays
@@ -14208,17 +14334,17 @@
/* @internal */
function isModifierKind(token) {
switch (token) {
- case 118 /* AbstractKeyword */:
- case 121 /* AsyncKeyword */:
- case 77 /* ConstKeyword */:
- case 125 /* DeclareKeyword */:
- case 80 /* DefaultKeyword */:
- case 85 /* ExportKeyword */:
- case 115 /* PublicKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 133 /* ReadonlyKeyword */:
- case 116 /* StaticKeyword */:
+ case 119 /* AbstractKeyword */:
+ case 122 /* AsyncKeyword */:
+ case 78 /* ConstKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 81 /* DefaultKeyword */:
+ case 86 /* ExportKeyword */:
+ case 116 /* PublicKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 134 /* ReadonlyKeyword */:
+ case 117 /* StaticKeyword */:
return true;
}
return false;
@@ -14231,7 +14357,7 @@
ts.isParameterPropertyModifier = isParameterPropertyModifier;
/* @internal */
function isClassMemberModifier(idToken) {
- return isParameterPropertyModifier(idToken) || idToken === 116 /* StaticKeyword */;
+ return isParameterPropertyModifier(idToken) || idToken === 117 /* StaticKeyword */;
}
ts.isClassMemberModifier = isClassMemberModifier;
function isModifier(node) {
@@ -14240,23 +14366,23 @@
ts.isModifier = isModifier;
function isEntityName(node) {
var kind = node.kind;
- return kind === 148 /* QualifiedName */
- || kind === 72 /* Identifier */;
+ return kind === 149 /* QualifiedName */
+ || kind === 73 /* Identifier */;
}
ts.isEntityName = isEntityName;
function isPropertyName(node) {
var kind = node.kind;
- return kind === 72 /* Identifier */
+ return kind === 73 /* Identifier */
|| kind === 10 /* StringLiteral */
|| kind === 8 /* NumericLiteral */
- || kind === 149 /* ComputedPropertyName */;
+ || kind === 150 /* ComputedPropertyName */;
}
ts.isPropertyName = isPropertyName;
function isBindingName(node) {
var kind = node.kind;
- return kind === 72 /* Identifier */
- || kind === 184 /* ObjectBindingPattern */
- || kind === 185 /* ArrayBindingPattern */;
+ return kind === 73 /* Identifier */
+ || kind === 185 /* ObjectBindingPattern */
+ || kind === 186 /* ArrayBindingPattern */;
}
ts.isBindingName = isBindingName;
// Functions
@@ -14271,13 +14397,13 @@
ts.isFunctionLikeDeclaration = isFunctionLikeDeclaration;
function isFunctionLikeDeclarationKind(kind) {
switch (kind) {
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return true;
default:
return false;
@@ -14286,14 +14412,14 @@
/* @internal */
function isFunctionLikeKind(kind) {
switch (kind) {
- case 155 /* MethodSignature */:
- case 160 /* CallSignature */:
- case 298 /* JSDocSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
- case 165 /* FunctionType */:
- case 294 /* JSDocFunctionType */:
- case 166 /* ConstructorType */:
+ case 156 /* MethodSignature */:
+ case 161 /* CallSignature */:
+ case 299 /* JSDocSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
+ case 166 /* FunctionType */:
+ case 295 /* JSDocFunctionType */:
+ case 167 /* ConstructorType */:
return true;
default:
return isFunctionLikeDeclarationKind(kind);
@@ -14308,29 +14434,29 @@
// Classes
function isClassElement(node) {
var kind = node.kind;
- return kind === 157 /* Constructor */
- || kind === 154 /* PropertyDeclaration */
- || kind === 156 /* MethodDeclaration */
- || kind === 158 /* GetAccessor */
- || kind === 159 /* SetAccessor */
- || kind === 162 /* IndexSignature */
- || kind === 217 /* SemicolonClassElement */;
+ return kind === 158 /* Constructor */
+ || kind === 155 /* PropertyDeclaration */
+ || kind === 157 /* MethodDeclaration */
+ || kind === 159 /* GetAccessor */
+ || kind === 160 /* SetAccessor */
+ || kind === 163 /* IndexSignature */
+ || kind === 218 /* SemicolonClassElement */;
}
ts.isClassElement = isClassElement;
function isClassLike(node) {
- return node && (node.kind === 240 /* ClassDeclaration */ || node.kind === 209 /* ClassExpression */);
+ return node && (node.kind === 241 /* ClassDeclaration */ || node.kind === 210 /* ClassExpression */);
}
ts.isClassLike = isClassLike;
function isAccessor(node) {
- return node && (node.kind === 158 /* GetAccessor */ || node.kind === 159 /* SetAccessor */);
+ return node && (node.kind === 159 /* GetAccessor */ || node.kind === 160 /* SetAccessor */);
}
ts.isAccessor = isAccessor;
/* @internal */
function isMethodOrAccessor(node) {
switch (node.kind) {
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return true;
default:
return false;
@@ -14340,11 +14466,11 @@
// Type members
function isTypeElement(node) {
var kind = node.kind;
- return kind === 161 /* ConstructSignature */
- || kind === 160 /* CallSignature */
- || kind === 153 /* PropertySignature */
- || kind === 155 /* MethodSignature */
- || kind === 162 /* IndexSignature */;
+ return kind === 162 /* ConstructSignature */
+ || kind === 161 /* CallSignature */
+ || kind === 154 /* PropertySignature */
+ || kind === 156 /* MethodSignature */
+ || kind === 163 /* IndexSignature */;
}
ts.isTypeElement = isTypeElement;
function isClassOrTypeElement(node) {
@@ -14353,12 +14479,12 @@
ts.isClassOrTypeElement = isClassOrTypeElement;
function isObjectLiteralElementLike(node) {
var kind = node.kind;
- return kind === 275 /* PropertyAssignment */
- || kind === 276 /* ShorthandPropertyAssignment */
- || kind === 277 /* SpreadAssignment */
- || kind === 156 /* MethodDeclaration */
- || kind === 158 /* GetAccessor */
- || kind === 159 /* SetAccessor */;
+ return kind === 276 /* PropertyAssignment */
+ || kind === 277 /* ShorthandPropertyAssignment */
+ || kind === 278 /* SpreadAssignment */
+ || kind === 157 /* MethodDeclaration */
+ || kind === 159 /* GetAccessor */
+ || kind === 160 /* SetAccessor */;
}
ts.isObjectLiteralElementLike = isObjectLiteralElementLike;
// Type
@@ -14373,8 +14499,8 @@
ts.isTypeNode = isTypeNode;
function isFunctionOrConstructorTypeNode(node) {
switch (node.kind) {
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
return true;
}
return false;
@@ -14385,8 +14511,8 @@
function isBindingPattern(node) {
if (node) {
var kind = node.kind;
- return kind === 185 /* ArrayBindingPattern */
- || kind === 184 /* ObjectBindingPattern */;
+ return kind === 186 /* ArrayBindingPattern */
+ || kind === 185 /* ObjectBindingPattern */;
}
return false;
}
@@ -14394,15 +14520,15 @@
/* @internal */
function isAssignmentPattern(node) {
var kind = node.kind;
- return kind === 187 /* ArrayLiteralExpression */
- || kind === 188 /* ObjectLiteralExpression */;
+ return kind === 188 /* ArrayLiteralExpression */
+ || kind === 189 /* ObjectLiteralExpression */;
}
ts.isAssignmentPattern = isAssignmentPattern;
/* @internal */
function isArrayBindingElement(node) {
var kind = node.kind;
- return kind === 186 /* BindingElement */
- || kind === 210 /* OmittedExpression */;
+ return kind === 187 /* BindingElement */
+ || kind === 211 /* OmittedExpression */;
}
ts.isArrayBindingElement = isArrayBindingElement;
/**
@@ -14411,9 +14537,9 @@
/* @internal */
function isDeclarationBindingElement(bindingElement) {
switch (bindingElement.kind) {
- case 237 /* VariableDeclaration */:
- case 151 /* Parameter */:
- case 186 /* BindingElement */:
+ case 238 /* VariableDeclaration */:
+ case 152 /* Parameter */:
+ case 187 /* BindingElement */:
return true;
}
return false;
@@ -14434,8 +14560,8 @@
/* @internal */
function isObjectBindingOrAssignmentPattern(node) {
switch (node.kind) {
- case 184 /* ObjectBindingPattern */:
- case 188 /* ObjectLiteralExpression */:
+ case 185 /* ObjectBindingPattern */:
+ case 189 /* ObjectLiteralExpression */:
return true;
}
return false;
@@ -14447,8 +14573,8 @@
/* @internal */
function isArrayBindingOrAssignmentPattern(node) {
switch (node.kind) {
- case 185 /* ArrayBindingPattern */:
- case 187 /* ArrayLiteralExpression */:
+ case 186 /* ArrayBindingPattern */:
+ case 188 /* ArrayLiteralExpression */:
return true;
}
return false;
@@ -14457,26 +14583,26 @@
/* @internal */
function isPropertyAccessOrQualifiedNameOrImportTypeNode(node) {
var kind = node.kind;
- return kind === 189 /* PropertyAccessExpression */
- || kind === 148 /* QualifiedName */
- || kind === 183 /* ImportType */;
+ return kind === 190 /* PropertyAccessExpression */
+ || kind === 149 /* QualifiedName */
+ || kind === 184 /* ImportType */;
}
ts.isPropertyAccessOrQualifiedNameOrImportTypeNode = isPropertyAccessOrQualifiedNameOrImportTypeNode;
// Expression
function isPropertyAccessOrQualifiedName(node) {
var kind = node.kind;
- return kind === 189 /* PropertyAccessExpression */
- || kind === 148 /* QualifiedName */;
+ return kind === 190 /* PropertyAccessExpression */
+ || kind === 149 /* QualifiedName */;
}
ts.isPropertyAccessOrQualifiedName = isPropertyAccessOrQualifiedName;
function isCallLikeExpression(node) {
switch (node.kind) {
- case 262 /* JsxOpeningElement */:
- case 261 /* JsxSelfClosingElement */:
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
- case 193 /* TaggedTemplateExpression */:
- case 152 /* Decorator */:
+ case 263 /* JsxOpeningElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
+ case 194 /* TaggedTemplateExpression */:
+ case 153 /* Decorator */:
return true;
default:
return false;
@@ -14484,12 +14610,12 @@
}
ts.isCallLikeExpression = isCallLikeExpression;
function isCallOrNewExpression(node) {
- return node.kind === 191 /* CallExpression */ || node.kind === 192 /* NewExpression */;
+ return node.kind === 192 /* CallExpression */ || node.kind === 193 /* NewExpression */;
}
ts.isCallOrNewExpression = isCallOrNewExpression;
function isTemplateLiteral(node) {
var kind = node.kind;
- return kind === 206 /* TemplateExpression */
+ return kind === 207 /* TemplateExpression */
|| kind === 14 /* NoSubstitutionTemplateLiteral */;
}
ts.isTemplateLiteral = isTemplateLiteral;
@@ -14500,34 +14626,34 @@
ts.isLeftHandSideExpression = isLeftHandSideExpression;
function isLeftHandSideExpressionKind(kind) {
switch (kind) {
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
- case 192 /* NewExpression */:
- case 191 /* CallExpression */:
- case 260 /* JsxElement */:
- case 261 /* JsxSelfClosingElement */:
- case 264 /* JsxFragment */:
- case 193 /* TaggedTemplateExpression */:
- case 187 /* ArrayLiteralExpression */:
- case 195 /* ParenthesizedExpression */:
- case 188 /* ObjectLiteralExpression */:
- case 209 /* ClassExpression */:
- case 196 /* FunctionExpression */:
- case 72 /* Identifier */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
+ case 193 /* NewExpression */:
+ case 192 /* CallExpression */:
+ case 261 /* JsxElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 265 /* JsxFragment */:
+ case 194 /* TaggedTemplateExpression */:
+ case 188 /* ArrayLiteralExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 189 /* ObjectLiteralExpression */:
+ case 210 /* ClassExpression */:
+ case 197 /* FunctionExpression */:
+ case 73 /* Identifier */:
case 13 /* RegularExpressionLiteral */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
case 10 /* StringLiteral */:
case 14 /* NoSubstitutionTemplateLiteral */:
- case 206 /* TemplateExpression */:
- case 87 /* FalseKeyword */:
- case 96 /* NullKeyword */:
- case 100 /* ThisKeyword */:
- case 102 /* TrueKeyword */:
- case 98 /* SuperKeyword */:
- case 213 /* NonNullExpression */:
- case 214 /* MetaProperty */:
- case 92 /* ImportKeyword */: // technically this is only an Expression if it's in a CallExpression
+ case 207 /* TemplateExpression */:
+ case 88 /* FalseKeyword */:
+ case 97 /* NullKeyword */:
+ case 101 /* ThisKeyword */:
+ case 103 /* TrueKeyword */:
+ case 99 /* SuperKeyword */:
+ case 214 /* NonNullExpression */:
+ case 215 /* MetaProperty */:
+ case 93 /* ImportKeyword */: // technically this is only an Expression if it's in a CallExpression
return true;
default:
return false;
@@ -14540,13 +14666,13 @@
ts.isUnaryExpression = isUnaryExpression;
function isUnaryExpressionKind(kind) {
switch (kind) {
- case 202 /* PrefixUnaryExpression */:
- case 203 /* PostfixUnaryExpression */:
- case 198 /* DeleteExpression */:
- case 199 /* TypeOfExpression */:
- case 200 /* VoidExpression */:
- case 201 /* AwaitExpression */:
- case 194 /* TypeAssertionExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
+ case 199 /* DeleteExpression */:
+ case 200 /* TypeOfExpression */:
+ case 201 /* VoidExpression */:
+ case 202 /* AwaitExpression */:
+ case 195 /* TypeAssertionExpression */:
return true;
default:
return isLeftHandSideExpressionKind(kind);
@@ -14555,9 +14681,9 @@
/* @internal */
function isUnaryExpressionWithWrite(expr) {
switch (expr.kind) {
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return true;
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return expr.operator === 44 /* PlusPlusToken */ ||
expr.operator === 45 /* MinusMinusToken */;
default:
@@ -14576,15 +14702,15 @@
ts.isExpression = isExpression;
function isExpressionKind(kind) {
switch (kind) {
- case 205 /* ConditionalExpression */:
- case 207 /* YieldExpression */:
- case 197 /* ArrowFunction */:
- case 204 /* BinaryExpression */:
- case 208 /* SpreadElement */:
- case 212 /* AsExpression */:
- case 210 /* OmittedExpression */:
- case 314 /* CommaListExpression */:
- case 313 /* PartiallyEmittedExpression */:
+ case 206 /* ConditionalExpression */:
+ case 208 /* YieldExpression */:
+ case 198 /* ArrowFunction */:
+ case 205 /* BinaryExpression */:
+ case 209 /* SpreadElement */:
+ case 213 /* AsExpression */:
+ case 211 /* OmittedExpression */:
+ case 315 /* CommaListExpression */:
+ case 314 /* PartiallyEmittedExpression */:
return true;
default:
return isUnaryExpressionKind(kind);
@@ -14592,18 +14718,18 @@
}
function isAssertionExpression(node) {
var kind = node.kind;
- return kind === 194 /* TypeAssertionExpression */
- || kind === 212 /* AsExpression */;
+ return kind === 195 /* TypeAssertionExpression */
+ || kind === 213 /* AsExpression */;
}
ts.isAssertionExpression = isAssertionExpression;
/* @internal */
function isPartiallyEmittedExpression(node) {
- return node.kind === 313 /* PartiallyEmittedExpression */;
+ return node.kind === 314 /* PartiallyEmittedExpression */;
}
ts.isPartiallyEmittedExpression = isPartiallyEmittedExpression;
/* @internal */
function isNotEmittedStatement(node) {
- return node.kind === 312 /* NotEmittedStatement */;
+ return node.kind === 313 /* NotEmittedStatement */;
}
ts.isNotEmittedStatement = isNotEmittedStatement;
/* @internal */
@@ -14614,13 +14740,13 @@
ts.isNotEmittedOrPartiallyEmittedNode = isNotEmittedOrPartiallyEmittedNode;
function isIterationStatement(node, lookInLabeledStatements) {
switch (node.kind) {
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
return true;
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return lookInLabeledStatements && isIterationStatement(node.statement, lookInLabeledStatements);
}
return false;
@@ -14628,7 +14754,7 @@
ts.isIterationStatement = isIterationStatement;
/* @internal */
function isForInOrOfStatement(node) {
- return node.kind === 226 /* ForInStatement */ || node.kind === 227 /* ForOfStatement */;
+ return node.kind === 227 /* ForInStatement */ || node.kind === 228 /* ForOfStatement */;
}
ts.isForInOrOfStatement = isForInOrOfStatement;
// Element
@@ -14652,113 +14778,113 @@
/* @internal */
function isModuleBody(node) {
var kind = node.kind;
- return kind === 245 /* ModuleBlock */
- || kind === 244 /* ModuleDeclaration */
- || kind === 72 /* Identifier */;
+ return kind === 246 /* ModuleBlock */
+ || kind === 245 /* ModuleDeclaration */
+ || kind === 73 /* Identifier */;
}
ts.isModuleBody = isModuleBody;
/* @internal */
function isNamespaceBody(node) {
var kind = node.kind;
- return kind === 245 /* ModuleBlock */
- || kind === 244 /* ModuleDeclaration */;
+ return kind === 246 /* ModuleBlock */
+ || kind === 245 /* ModuleDeclaration */;
}
ts.isNamespaceBody = isNamespaceBody;
/* @internal */
function isJSDocNamespaceBody(node) {
var kind = node.kind;
- return kind === 72 /* Identifier */
- || kind === 244 /* ModuleDeclaration */;
+ return kind === 73 /* Identifier */
+ || kind === 245 /* ModuleDeclaration */;
}
ts.isJSDocNamespaceBody = isJSDocNamespaceBody;
/* @internal */
function isNamedImportBindings(node) {
var kind = node.kind;
- return kind === 252 /* NamedImports */
- || kind === 251 /* NamespaceImport */;
+ return kind === 253 /* NamedImports */
+ || kind === 252 /* NamespaceImport */;
}
ts.isNamedImportBindings = isNamedImportBindings;
/* @internal */
function isModuleOrEnumDeclaration(node) {
- return node.kind === 244 /* ModuleDeclaration */ || node.kind === 243 /* EnumDeclaration */;
+ return node.kind === 245 /* ModuleDeclaration */ || node.kind === 244 /* EnumDeclaration */;
}
ts.isModuleOrEnumDeclaration = isModuleOrEnumDeclaration;
function isDeclarationKind(kind) {
- return kind === 197 /* ArrowFunction */
- || kind === 186 /* BindingElement */
- || kind === 240 /* ClassDeclaration */
- || kind === 209 /* ClassExpression */
- || kind === 157 /* Constructor */
- || kind === 243 /* EnumDeclaration */
- || kind === 278 /* EnumMember */
- || kind === 257 /* ExportSpecifier */
- || kind === 239 /* FunctionDeclaration */
- || kind === 196 /* FunctionExpression */
- || kind === 158 /* GetAccessor */
- || kind === 250 /* ImportClause */
- || kind === 248 /* ImportEqualsDeclaration */
- || kind === 253 /* ImportSpecifier */
- || kind === 241 /* InterfaceDeclaration */
- || kind === 267 /* JsxAttribute */
- || kind === 156 /* MethodDeclaration */
- || kind === 155 /* MethodSignature */
- || kind === 244 /* ModuleDeclaration */
- || kind === 247 /* NamespaceExportDeclaration */
- || kind === 251 /* NamespaceImport */
- || kind === 151 /* Parameter */
- || kind === 275 /* PropertyAssignment */
- || kind === 154 /* PropertyDeclaration */
- || kind === 153 /* PropertySignature */
- || kind === 159 /* SetAccessor */
- || kind === 276 /* ShorthandPropertyAssignment */
- || kind === 242 /* TypeAliasDeclaration */
- || kind === 150 /* TypeParameter */
- || kind === 237 /* VariableDeclaration */
- || kind === 309 /* JSDocTypedefTag */
- || kind === 302 /* JSDocCallbackTag */
- || kind === 310 /* JSDocPropertyTag */;
+ return kind === 198 /* ArrowFunction */
+ || kind === 187 /* BindingElement */
+ || kind === 241 /* ClassDeclaration */
+ || kind === 210 /* ClassExpression */
+ || kind === 158 /* Constructor */
+ || kind === 244 /* EnumDeclaration */
+ || kind === 279 /* EnumMember */
+ || kind === 258 /* ExportSpecifier */
+ || kind === 240 /* FunctionDeclaration */
+ || kind === 197 /* FunctionExpression */
+ || kind === 159 /* GetAccessor */
+ || kind === 251 /* ImportClause */
+ || kind === 249 /* ImportEqualsDeclaration */
+ || kind === 254 /* ImportSpecifier */
+ || kind === 242 /* InterfaceDeclaration */
+ || kind === 268 /* JsxAttribute */
+ || kind === 157 /* MethodDeclaration */
+ || kind === 156 /* MethodSignature */
+ || kind === 245 /* ModuleDeclaration */
+ || kind === 248 /* NamespaceExportDeclaration */
+ || kind === 252 /* NamespaceImport */
+ || kind === 152 /* Parameter */
+ || kind === 276 /* PropertyAssignment */
+ || kind === 155 /* PropertyDeclaration */
+ || kind === 154 /* PropertySignature */
+ || kind === 160 /* SetAccessor */
+ || kind === 277 /* ShorthandPropertyAssignment */
+ || kind === 243 /* TypeAliasDeclaration */
+ || kind === 151 /* TypeParameter */
+ || kind === 238 /* VariableDeclaration */
+ || kind === 310 /* JSDocTypedefTag */
+ || kind === 303 /* JSDocCallbackTag */
+ || kind === 311 /* JSDocPropertyTag */;
}
function isDeclarationStatementKind(kind) {
- return kind === 239 /* FunctionDeclaration */
- || kind === 258 /* MissingDeclaration */
- || kind === 240 /* ClassDeclaration */
- || kind === 241 /* InterfaceDeclaration */
- || kind === 242 /* TypeAliasDeclaration */
- || kind === 243 /* EnumDeclaration */
- || kind === 244 /* ModuleDeclaration */
- || kind === 249 /* ImportDeclaration */
- || kind === 248 /* ImportEqualsDeclaration */
- || kind === 255 /* ExportDeclaration */
- || kind === 254 /* ExportAssignment */
- || kind === 247 /* NamespaceExportDeclaration */;
+ return kind === 240 /* FunctionDeclaration */
+ || kind === 259 /* MissingDeclaration */
+ || kind === 241 /* ClassDeclaration */
+ || kind === 242 /* InterfaceDeclaration */
+ || kind === 243 /* TypeAliasDeclaration */
+ || kind === 244 /* EnumDeclaration */
+ || kind === 245 /* ModuleDeclaration */
+ || kind === 250 /* ImportDeclaration */
+ || kind === 249 /* ImportEqualsDeclaration */
+ || kind === 256 /* ExportDeclaration */
+ || kind === 255 /* ExportAssignment */
+ || kind === 248 /* NamespaceExportDeclaration */;
}
function isStatementKindButNotDeclarationKind(kind) {
- return kind === 229 /* BreakStatement */
- || kind === 228 /* ContinueStatement */
- || kind === 236 /* DebuggerStatement */
- || kind === 223 /* DoStatement */
- || kind === 221 /* ExpressionStatement */
- || kind === 220 /* EmptyStatement */
- || kind === 226 /* ForInStatement */
- || kind === 227 /* ForOfStatement */
- || kind === 225 /* ForStatement */
- || kind === 222 /* IfStatement */
- || kind === 233 /* LabeledStatement */
- || kind === 230 /* ReturnStatement */
- || kind === 232 /* SwitchStatement */
- || kind === 234 /* ThrowStatement */
- || kind === 235 /* TryStatement */
- || kind === 219 /* VariableStatement */
- || kind === 224 /* WhileStatement */
- || kind === 231 /* WithStatement */
- || kind === 312 /* NotEmittedStatement */
- || kind === 316 /* EndOfDeclarationMarker */
- || kind === 315 /* MergeDeclarationMarker */;
+ return kind === 230 /* BreakStatement */
+ || kind === 229 /* ContinueStatement */
+ || kind === 237 /* DebuggerStatement */
+ || kind === 224 /* DoStatement */
+ || kind === 222 /* ExpressionStatement */
+ || kind === 221 /* EmptyStatement */
+ || kind === 227 /* ForInStatement */
+ || kind === 228 /* ForOfStatement */
+ || kind === 226 /* ForStatement */
+ || kind === 223 /* IfStatement */
+ || kind === 234 /* LabeledStatement */
+ || kind === 231 /* ReturnStatement */
+ || kind === 233 /* SwitchStatement */
+ || kind === 235 /* ThrowStatement */
+ || kind === 236 /* TryStatement */
+ || kind === 220 /* VariableStatement */
+ || kind === 225 /* WhileStatement */
+ || kind === 232 /* WithStatement */
+ || kind === 313 /* NotEmittedStatement */
+ || kind === 317 /* EndOfDeclarationMarker */
+ || kind === 316 /* MergeDeclarationMarker */;
}
/* @internal */
function isDeclaration(node) {
- if (node.kind === 150 /* TypeParameter */) {
- return (node.parent && node.parent.kind !== 308 /* JSDocTemplateTag */) || ts.isInJSFile(node);
+ if (node.kind === 151 /* TypeParameter */) {
+ return (node.parent && node.parent.kind !== 309 /* JSDocTemplateTag */) || ts.isInJSFile(node);
}
return isDeclarationKind(node.kind);
}
@@ -14785,10 +14911,10 @@
}
ts.isStatement = isStatement;
function isBlockStatement(node) {
- if (node.kind !== 218 /* Block */)
+ if (node.kind !== 219 /* Block */)
return false;
if (node.parent !== undefined) {
- if (node.parent.kind === 235 /* TryStatement */ || node.parent.kind === 274 /* CatchClause */) {
+ if (node.parent.kind === 236 /* TryStatement */ || node.parent.kind === 275 /* CatchClause */) {
return false;
}
}
@@ -14798,81 +14924,81 @@
/* @internal */
function isModuleReference(node) {
var kind = node.kind;
- return kind === 259 /* ExternalModuleReference */
- || kind === 148 /* QualifiedName */
- || kind === 72 /* Identifier */;
+ return kind === 260 /* ExternalModuleReference */
+ || kind === 149 /* QualifiedName */
+ || kind === 73 /* Identifier */;
}
ts.isModuleReference = isModuleReference;
// JSX
/* @internal */
function isJsxTagNameExpression(node) {
var kind = node.kind;
- return kind === 100 /* ThisKeyword */
- || kind === 72 /* Identifier */
- || kind === 189 /* PropertyAccessExpression */;
+ return kind === 101 /* ThisKeyword */
+ || kind === 73 /* Identifier */
+ || kind === 190 /* PropertyAccessExpression */;
}
ts.isJsxTagNameExpression = isJsxTagNameExpression;
/* @internal */
function isJsxChild(node) {
var kind = node.kind;
- return kind === 260 /* JsxElement */
- || kind === 270 /* JsxExpression */
- || kind === 261 /* JsxSelfClosingElement */
+ return kind === 261 /* JsxElement */
+ || kind === 271 /* JsxExpression */
+ || kind === 262 /* JsxSelfClosingElement */
|| kind === 11 /* JsxText */
- || kind === 264 /* JsxFragment */;
+ || kind === 265 /* JsxFragment */;
}
ts.isJsxChild = isJsxChild;
/* @internal */
function isJsxAttributeLike(node) {
var kind = node.kind;
- return kind === 267 /* JsxAttribute */
- || kind === 269 /* JsxSpreadAttribute */;
+ return kind === 268 /* JsxAttribute */
+ || kind === 270 /* JsxSpreadAttribute */;
}
ts.isJsxAttributeLike = isJsxAttributeLike;
/* @internal */
function isStringLiteralOrJsxExpression(node) {
var kind = node.kind;
return kind === 10 /* StringLiteral */
- || kind === 270 /* JsxExpression */;
+ || kind === 271 /* JsxExpression */;
}
ts.isStringLiteralOrJsxExpression = isStringLiteralOrJsxExpression;
function isJsxOpeningLikeElement(node) {
var kind = node.kind;
- return kind === 262 /* JsxOpeningElement */
- || kind === 261 /* JsxSelfClosingElement */;
+ return kind === 263 /* JsxOpeningElement */
+ || kind === 262 /* JsxSelfClosingElement */;
}
ts.isJsxOpeningLikeElement = isJsxOpeningLikeElement;
// Clauses
function isCaseOrDefaultClause(node) {
var kind = node.kind;
- return kind === 271 /* CaseClause */
- || kind === 272 /* DefaultClause */;
+ return kind === 272 /* CaseClause */
+ || kind === 273 /* DefaultClause */;
}
ts.isCaseOrDefaultClause = isCaseOrDefaultClause;
// JSDoc
/** True if node is of some JSDoc syntax kind. */
/* @internal */
function isJSDocNode(node) {
- return node.kind >= 288 /* FirstJSDocNode */ && node.kind <= 310 /* LastJSDocNode */;
+ return node.kind >= 289 /* FirstJSDocNode */ && node.kind <= 311 /* LastJSDocNode */;
}
ts.isJSDocNode = isJSDocNode;
/** True if node is of a kind that may contain comment text. */
function isJSDocCommentContainingNode(node) {
- return node.kind === 296 /* JSDocComment */ || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) || ts.isJSDocSignature(node);
+ return node.kind === 297 /* JSDocComment */ || isJSDocTag(node) || ts.isJSDocTypeLiteral(node) || ts.isJSDocSignature(node);
}
ts.isJSDocCommentContainingNode = isJSDocCommentContainingNode;
// TODO: determine what this does before making it public.
/* @internal */
function isJSDocTag(node) {
- return node.kind >= 299 /* FirstJSDocTagNode */ && node.kind <= 310 /* LastJSDocTagNode */;
+ return node.kind >= 300 /* FirstJSDocTagNode */ && node.kind <= 311 /* LastJSDocTagNode */;
}
ts.isJSDocTag = isJSDocTag;
function isSetAccessor(node) {
- return node.kind === 159 /* SetAccessor */;
+ return node.kind === 160 /* SetAccessor */;
}
ts.isSetAccessor = isSetAccessor;
function isGetAccessor(node) {
- return node.kind === 158 /* GetAccessor */;
+ return node.kind === 159 /* GetAccessor */;
}
ts.isGetAccessor = isGetAccessor;
/** True if has jsdoc nodes attached to it. */
@@ -14902,12 +15028,12 @@
}
ts.hasOnlyExpressionInitializer = hasOnlyExpressionInitializer;
function isObjectLiteralElement(node) {
- return node.kind === 267 /* JsxAttribute */ || node.kind === 269 /* JsxSpreadAttribute */ || isObjectLiteralElementLike(node);
+ return node.kind === 268 /* JsxAttribute */ || node.kind === 270 /* JsxSpreadAttribute */ || isObjectLiteralElementLike(node);
}
ts.isObjectLiteralElement = isObjectLiteralElement;
/* @internal */
function isTypeReferenceType(node) {
- return node.kind === 164 /* TypeReference */ || node.kind === 211 /* ExpressionWithTypeArguments */;
+ return node.kind === 165 /* TypeReference */ || node.kind === 212 /* ExpressionWithTypeArguments */;
}
ts.isTypeReferenceType = isTypeReferenceType;
var MAX_SMI_X86 = 1073741823;
@@ -14943,7 +15069,7 @@
/* @internal */
(function (ts) {
function isNamedImportsOrExports(node) {
- return node.kind === 252 /* NamedImports */ || node.kind === 256 /* NamedExports */;
+ return node.kind === 253 /* NamedImports */ || node.kind === 257 /* NamedExports */;
}
ts.isNamedImportsOrExports = isNamedImportsOrExports;
function Symbol(flags, name) {
@@ -15194,6 +15320,11 @@
ts.semanticDiagnosticsOptionDeclarations.some(function (option) { return !ts.isJsonEqual(getCompilerOptionValue(oldOptions, option), getCompilerOptionValue(newOptions, option)); });
}
ts.compilerOptionsAffectSemanticDiagnostics = compilerOptionsAffectSemanticDiagnostics;
+ function compilerOptionsAffectEmit(newOptions, oldOptions) {
+ return oldOptions !== newOptions &&
+ ts.affectsEmitOptionDeclarations.some(function (option) { return !ts.isJsonEqual(getCompilerOptionValue(oldOptions, option), getCompilerOptionValue(newOptions, option)); });
+ }
+ ts.compilerOptionsAffectEmit = compilerOptionsAffectEmit;
function getCompilerOptionValue(options, option) {
return option.strictFlag ? getStrictOptionValue(options, option.name) : options[option.name];
}
@@ -15472,6 +15603,15 @@
return root + pathComponents.slice(1).join(ts.directorySeparator);
}
ts.getPathFromPathComponents = getPathFromPathComponents;
+ function getNormalizedAbsolutePathWithoutRoot(fileName, currentDirectory) {
+ return getPathWithoutRoot(getNormalizedPathComponents(fileName, currentDirectory));
+ }
+ ts.getNormalizedAbsolutePathWithoutRoot = getNormalizedAbsolutePathWithoutRoot;
+ function getPathWithoutRoot(pathComponents) {
+ if (pathComponents.length === 0)
+ return "";
+ return pathComponents.slice(1).join(ts.directorySeparator);
+ }
})(ts || (ts = {}));
/* @internal */
(function (ts) {
@@ -15502,7 +15642,7 @@
}
ts.getRelativePathFromFile = getRelativePathFromFile;
function getRelativePathFromDirectory(fromDirectory, to, getCanonicalFileNameOrIgnoreCase) {
- Debug.assert((ts.getRootLength(fromDirectory) > 0) === (ts.getRootLength(to) > 0), "Paths must either both be absolute or both be relative");
+ ts.Debug.assert((ts.getRootLength(fromDirectory) > 0) === (ts.getRootLength(to) > 0), "Paths must either both be absolute or both be relative");
var getCanonicalFileName = typeof getCanonicalFileNameOrIgnoreCase === "function" ? getCanonicalFileNameOrIgnoreCase : ts.identity;
var ignoreCase = typeof getCanonicalFileNameOrIgnoreCase === "boolean" ? getCanonicalFileNameOrIgnoreCase : false;
var pathComponents = getPathComponentsRelativeTo(fromDirectory, to, ignoreCase ? ts.equateStringsCaseInsensitive : ts.equateStringsCaseSensitive, getCanonicalFileName);
@@ -16146,32 +16286,9 @@
return pathext ? path.slice(0, path.length - pathext.length) + (ts.startsWith(ext, ".") ? ext : "." + ext) : path;
}
ts.changeAnyExtension = changeAnyExtension;
- var Debug;
- (function (Debug) {
- function showSymbol(symbol) {
- var symbolFlags = ts.SymbolFlags;
- return "{ flags: " + (symbolFlags ? showFlags(symbol.flags, symbolFlags) : symbol.flags) + "; declarations: " + ts.map(symbol.declarations, showSyntaxKind) + " }";
- }
- Debug.showSymbol = showSymbol;
- function showFlags(flags, flagsEnum) {
- var out = [];
- for (var pow = 0; pow <= 30; pow++) {
- var n = 1 << pow;
- if (flags & n) {
- out.push(flagsEnum[n]);
- }
- }
- return out.join("|");
- }
- function showSyntaxKind(node) {
- var syntaxKind = ts.SyntaxKind;
- return syntaxKind ? syntaxKind[node.kind] : node.kind.toString();
- }
- Debug.showSyntaxKind = showSyntaxKind;
- })(Debug = ts.Debug || (ts.Debug = {}));
function tryParsePattern(pattern) {
// This should be verified outside of here and a proper error thrown.
- Debug.assert(ts.hasZeroOrOneAsteriskCharacter(pattern));
+ ts.Debug.assert(ts.hasZeroOrOneAsteriskCharacter(pattern));
var indexOfStar = pattern.indexOf("*");
return indexOfStar === -1 ? undefined : {
prefix: pattern.substr(0, indexOfStar),
@@ -16200,7 +16317,7 @@
*/
function extensionFromPath(path) {
var ext = tryGetExtensionFromPath(path);
- return ext !== undefined ? ext : Debug.fail("File " + path + " has unknown extension.");
+ return ext !== undefined ? ext : ts.Debug.fail("File " + path + " has unknown extension.");
}
ts.extensionFromPath = extensionFromPath;
function isAnySupportedFileExtension(path) {
@@ -16272,7 +16389,7 @@
ts.matchPatternOrExact = matchPatternOrExact;
function sliceAfter(arr, value) {
var index = arr.indexOf(value);
- Debug.assert(index !== -1);
+ ts.Debug.assert(index !== -1);
return arr.slice(index);
}
ts.sliceAfter = sliceAfter;
@@ -16290,7 +16407,7 @@
}
ts.addRelatedInfo = addRelatedInfo;
function minAndMax(arr, getValue) {
- Debug.assert(arr.length !== 0);
+ ts.Debug.assert(arr.length !== 0);
var min = getValue(arr[0]);
var max = min;
for (var i = 1; i < arr.length; i++) {
@@ -16488,10 +16605,10 @@
var SourceFileConstructor;
// tslint:enable variable-name
function createNode(kind, pos, end) {
- if (kind === 284 /* SourceFile */) {
+ if (kind === 285 /* SourceFile */) {
return new (SourceFileConstructor || (SourceFileConstructor = ts.objectAllocator.getSourceFileConstructor()))(kind, pos, end);
}
- else if (kind === 72 /* Identifier */) {
+ else if (kind === 73 /* Identifier */) {
return new (IdentifierConstructor || (IdentifierConstructor = ts.objectAllocator.getIdentifierConstructor()))(kind, pos, end);
}
else if (!ts.isNodeKind(kind)) {
@@ -16540,19 +16657,19 @@
* that they appear in the source code. The language service depends on this property to locate nodes by position.
*/
function forEachChild(node, cbNode, cbNodes) {
- if (!node || node.kind <= 147 /* LastToken */) {
+ if (!node || node.kind <= 148 /* LastToken */) {
return;
}
switch (node.kind) {
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
return visitNode(cbNode, node.left) ||
visitNode(cbNode, node.right);
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.constraint) ||
visitNode(cbNode, node.default) ||
visitNode(cbNode, node.expression);
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
@@ -16560,9 +16677,9 @@
visitNode(cbNode, node.exclamationToken) ||
visitNode(cbNode, node.equalsToken) ||
visitNode(cbNode, node.objectAssignmentInitializer);
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
return visitNode(cbNode, node.expression);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.dotDotDotToken) ||
@@ -16570,7 +16687,7 @@
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.initializer);
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
@@ -16578,51 +16695,51 @@
visitNode(cbNode, node.exclamationToken) ||
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.initializer);
- case 153 /* PropertySignature */:
+ case 154 /* PropertySignature */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.initializer);
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.initializer);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.exclamationToken) ||
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.initializer);
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.dotDotDotToken) ||
visitNode(cbNode, node.propertyName) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.initializer);
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNodes(cbNode, cbNodes, node.typeParameters) ||
visitNodes(cbNode, cbNodes, node.parameters) ||
visitNode(cbNode, node.type);
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 196 /* FunctionExpression */:
- case 239 /* FunctionDeclaration */:
- case 197 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 197 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
+ case 198 /* ArrowFunction */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.asteriskToken) ||
@@ -16634,343 +16751,343 @@
visitNode(cbNode, node.type) ||
visitNode(cbNode, node.equalsGreaterThanToken) ||
visitNode(cbNode, node.body);
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return visitNode(cbNode, node.typeName) ||
visitNodes(cbNode, cbNodes, node.typeArguments);
- case 163 /* TypePredicate */:
+ case 164 /* TypePredicate */:
return visitNode(cbNode, node.parameterName) ||
visitNode(cbNode, node.type);
- case 167 /* TypeQuery */:
+ case 168 /* TypeQuery */:
return visitNode(cbNode, node.exprName);
- case 168 /* TypeLiteral */:
+ case 169 /* TypeLiteral */:
return visitNodes(cbNode, cbNodes, node.members);
- case 169 /* ArrayType */:
+ case 170 /* ArrayType */:
return visitNode(cbNode, node.elementType);
- case 170 /* TupleType */:
+ case 171 /* TupleType */:
return visitNodes(cbNode, cbNodes, node.elementTypes);
- case 173 /* UnionType */:
- case 174 /* IntersectionType */:
+ case 174 /* UnionType */:
+ case 175 /* IntersectionType */:
return visitNodes(cbNode, cbNodes, node.types);
- case 175 /* ConditionalType */:
+ case 176 /* ConditionalType */:
return visitNode(cbNode, node.checkType) ||
visitNode(cbNode, node.extendsType) ||
visitNode(cbNode, node.trueType) ||
visitNode(cbNode, node.falseType);
- case 176 /* InferType */:
+ case 177 /* InferType */:
return visitNode(cbNode, node.typeParameter);
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return visitNode(cbNode, node.argument) ||
visitNode(cbNode, node.qualifier) ||
visitNodes(cbNode, cbNodes, node.typeArguments);
- case 177 /* ParenthesizedType */:
- case 179 /* TypeOperator */:
+ case 178 /* ParenthesizedType */:
+ case 180 /* TypeOperator */:
return visitNode(cbNode, node.type);
- case 180 /* IndexedAccessType */:
+ case 181 /* IndexedAccessType */:
return visitNode(cbNode, node.objectType) ||
visitNode(cbNode, node.indexType);
- case 181 /* MappedType */:
+ case 182 /* MappedType */:
return visitNode(cbNode, node.readonlyToken) ||
visitNode(cbNode, node.typeParameter) ||
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.type);
- case 182 /* LiteralType */:
+ case 183 /* LiteralType */:
return visitNode(cbNode, node.literal);
- case 184 /* ObjectBindingPattern */:
- case 185 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
return visitNodes(cbNode, cbNodes, node.elements);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return visitNodes(cbNode, cbNodes, node.elements);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return visitNodes(cbNode, cbNodes, node.properties);
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.name);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.argumentExpression);
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
return visitNode(cbNode, node.expression) ||
visitNodes(cbNode, cbNodes, node.typeArguments) ||
visitNodes(cbNode, cbNodes, node.arguments);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return visitNode(cbNode, node.tag) ||
visitNodes(cbNode, cbNodes, node.typeArguments) ||
visitNode(cbNode, node.template);
- case 194 /* TypeAssertionExpression */:
+ case 195 /* TypeAssertionExpression */:
return visitNode(cbNode, node.type) ||
visitNode(cbNode, node.expression);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return visitNode(cbNode, node.expression);
- case 198 /* DeleteExpression */:
+ case 199 /* DeleteExpression */:
return visitNode(cbNode, node.expression);
- case 199 /* TypeOfExpression */:
+ case 200 /* TypeOfExpression */:
return visitNode(cbNode, node.expression);
- case 200 /* VoidExpression */:
+ case 201 /* VoidExpression */:
return visitNode(cbNode, node.expression);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return visitNode(cbNode, node.operand);
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return visitNode(cbNode, node.asteriskToken) ||
visitNode(cbNode, node.expression);
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
return visitNode(cbNode, node.expression);
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return visitNode(cbNode, node.operand);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return visitNode(cbNode, node.left) ||
visitNode(cbNode, node.operatorToken) ||
visitNode(cbNode, node.right);
- case 212 /* AsExpression */:
+ case 213 /* AsExpression */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.type);
- case 213 /* NonNullExpression */:
+ case 214 /* NonNullExpression */:
return visitNode(cbNode, node.expression);
- case 214 /* MetaProperty */:
+ case 215 /* MetaProperty */:
return visitNode(cbNode, node.name);
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return visitNode(cbNode, node.condition) ||
visitNode(cbNode, node.questionToken) ||
visitNode(cbNode, node.whenTrue) ||
visitNode(cbNode, node.colonToken) ||
visitNode(cbNode, node.whenFalse);
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
return visitNode(cbNode, node.expression);
- case 218 /* Block */:
- case 245 /* ModuleBlock */:
+ case 219 /* Block */:
+ case 246 /* ModuleBlock */:
return visitNodes(cbNode, cbNodes, node.statements);
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return visitNodes(cbNode, cbNodes, node.statements) ||
visitNode(cbNode, node.endOfFileToken);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.declarationList);
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
return visitNodes(cbNode, cbNodes, node.declarations);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return visitNode(cbNode, node.expression);
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.thenStatement) ||
visitNode(cbNode, node.elseStatement);
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
return visitNode(cbNode, node.statement) ||
visitNode(cbNode, node.expression);
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.statement);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return visitNode(cbNode, node.initializer) ||
visitNode(cbNode, node.condition) ||
visitNode(cbNode, node.incrementor) ||
visitNode(cbNode, node.statement);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return visitNode(cbNode, node.initializer) ||
visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.statement);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return visitNode(cbNode, node.awaitModifier) ||
visitNode(cbNode, node.initializer) ||
visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.statement);
- case 228 /* ContinueStatement */:
- case 229 /* BreakStatement */:
+ case 229 /* ContinueStatement */:
+ case 230 /* BreakStatement */:
return visitNode(cbNode, node.label);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return visitNode(cbNode, node.expression);
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.statement);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return visitNode(cbNode, node.expression) ||
visitNode(cbNode, node.caseBlock);
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
return visitNodes(cbNode, cbNodes, node.clauses);
- case 271 /* CaseClause */:
+ case 272 /* CaseClause */:
return visitNode(cbNode, node.expression) ||
visitNodes(cbNode, cbNodes, node.statements);
- case 272 /* DefaultClause */:
+ case 273 /* DefaultClause */:
return visitNodes(cbNode, cbNodes, node.statements);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return visitNode(cbNode, node.label) ||
visitNode(cbNode, node.statement);
- case 234 /* ThrowStatement */:
+ case 235 /* ThrowStatement */:
return visitNode(cbNode, node.expression);
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
return visitNode(cbNode, node.tryBlock) ||
visitNode(cbNode, node.catchClause) ||
visitNode(cbNode, node.finallyBlock);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return visitNode(cbNode, node.variableDeclaration) ||
visitNode(cbNode, node.block);
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
return visitNode(cbNode, node.expression);
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNodes(cbNode, cbNodes, node.typeParameters) ||
visitNodes(cbNode, cbNodes, node.heritageClauses) ||
visitNodes(cbNode, cbNodes, node.members);
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNodes(cbNode, cbNodes, node.typeParameters) ||
visitNodes(cbNode, cbNodes, node.heritageClauses) ||
visitNodes(cbNode, cbNodes, node.members);
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNodes(cbNode, cbNodes, node.typeParameters) ||
visitNode(cbNode, node.type);
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNodes(cbNode, cbNodes, node.members);
- case 278 /* EnumMember */:
+ case 279 /* EnumMember */:
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.initializer);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.body);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.name) ||
visitNode(cbNode, node.moduleReference);
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.importClause) ||
visitNode(cbNode, node.moduleSpecifier);
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.namedBindings);
- case 247 /* NamespaceExportDeclaration */:
+ case 248 /* NamespaceExportDeclaration */:
return visitNode(cbNode, node.name);
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
return visitNode(cbNode, node.name);
- case 252 /* NamedImports */:
- case 256 /* NamedExports */:
+ case 253 /* NamedImports */:
+ case 257 /* NamedExports */:
return visitNodes(cbNode, cbNodes, node.elements);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.exportClause) ||
visitNode(cbNode, node.moduleSpecifier);
- case 253 /* ImportSpecifier */:
- case 257 /* ExportSpecifier */:
+ case 254 /* ImportSpecifier */:
+ case 258 /* ExportSpecifier */:
return visitNode(cbNode, node.propertyName) ||
visitNode(cbNode, node.name);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return visitNodes(cbNode, cbNodes, node.decorators) ||
visitNodes(cbNode, cbNodes, node.modifiers) ||
visitNode(cbNode, node.expression);
- case 206 /* TemplateExpression */:
+ case 207 /* TemplateExpression */:
return visitNode(cbNode, node.head) || visitNodes(cbNode, cbNodes, node.templateSpans);
- case 216 /* TemplateSpan */:
+ case 217 /* TemplateSpan */:
return visitNode(cbNode, node.expression) || visitNode(cbNode, node.literal);
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
return visitNode(cbNode, node.expression);
- case 273 /* HeritageClause */:
+ case 274 /* HeritageClause */:
return visitNodes(cbNode, cbNodes, node.types);
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return visitNode(cbNode, node.expression) ||
visitNodes(cbNode, cbNodes, node.typeArguments);
- case 259 /* ExternalModuleReference */:
+ case 260 /* ExternalModuleReference */:
return visitNode(cbNode, node.expression);
- case 258 /* MissingDeclaration */:
+ case 259 /* MissingDeclaration */:
return visitNodes(cbNode, cbNodes, node.decorators);
- case 314 /* CommaListExpression */:
+ case 315 /* CommaListExpression */:
return visitNodes(cbNode, cbNodes, node.elements);
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
return visitNode(cbNode, node.openingElement) ||
visitNodes(cbNode, cbNodes, node.children) ||
visitNode(cbNode, node.closingElement);
- case 264 /* JsxFragment */:
+ case 265 /* JsxFragment */:
return visitNode(cbNode, node.openingFragment) ||
visitNodes(cbNode, cbNodes, node.children) ||
visitNode(cbNode, node.closingFragment);
- case 261 /* JsxSelfClosingElement */:
- case 262 /* JsxOpeningElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
return visitNode(cbNode, node.tagName) ||
visitNodes(cbNode, cbNodes, node.typeArguments) ||
visitNode(cbNode, node.attributes);
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
return visitNodes(cbNode, cbNodes, node.properties);
- case 267 /* JsxAttribute */:
+ case 268 /* JsxAttribute */:
return visitNode(cbNode, node.name) ||
visitNode(cbNode, node.initializer);
- case 269 /* JsxSpreadAttribute */:
+ case 270 /* JsxSpreadAttribute */:
return visitNode(cbNode, node.expression);
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return visitNode(cbNode, node.dotDotDotToken) ||
visitNode(cbNode, node.expression);
- case 263 /* JsxClosingElement */:
+ case 264 /* JsxClosingElement */:
return visitNode(cbNode, node.tagName);
- case 171 /* OptionalType */:
- case 172 /* RestType */:
- case 288 /* JSDocTypeExpression */:
- case 292 /* JSDocNonNullableType */:
- case 291 /* JSDocNullableType */:
- case 293 /* JSDocOptionalType */:
- case 295 /* JSDocVariadicType */:
+ case 172 /* OptionalType */:
+ case 173 /* RestType */:
+ case 289 /* JSDocTypeExpression */:
+ case 293 /* JSDocNonNullableType */:
+ case 292 /* JSDocNullableType */:
+ case 294 /* JSDocOptionalType */:
+ case 296 /* JSDocVariadicType */:
return visitNode(cbNode, node.type);
- case 294 /* JSDocFunctionType */:
+ case 295 /* JSDocFunctionType */:
return visitNodes(cbNode, cbNodes, node.parameters) ||
visitNode(cbNode, node.type);
- case 296 /* JSDocComment */:
+ case 297 /* JSDocComment */:
return visitNodes(cbNode, cbNodes, node.tags);
- case 304 /* JSDocParameterTag */:
- case 310 /* JSDocPropertyTag */:
+ case 305 /* JSDocParameterTag */:
+ case 311 /* JSDocPropertyTag */:
return visitNode(cbNode, node.tagName) ||
(node.isNameFirst
? visitNode(cbNode, node.name) ||
visitNode(cbNode, node.typeExpression)
: visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.name));
- case 300 /* JSDocAugmentsTag */:
+ case 301 /* JSDocAugmentsTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.class);
- case 308 /* JSDocTemplateTag */:
+ case 309 /* JSDocTemplateTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.constraint) ||
visitNodes(cbNode, cbNodes, node.typeParameters);
- case 309 /* JSDocTypedefTag */:
+ case 310 /* JSDocTypedefTag */:
return visitNode(cbNode, node.tagName) ||
(node.typeExpression &&
- node.typeExpression.kind === 288 /* JSDocTypeExpression */
+ node.typeExpression.kind === 289 /* JSDocTypeExpression */
? visitNode(cbNode, node.typeExpression) ||
visitNode(cbNode, node.fullName)
: visitNode(cbNode, node.fullName) ||
visitNode(cbNode, node.typeExpression));
- case 302 /* JSDocCallbackTag */:
+ case 303 /* JSDocCallbackTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.fullName) ||
visitNode(cbNode, node.typeExpression);
- case 305 /* JSDocReturnTag */:
- case 307 /* JSDocTypeTag */:
- case 306 /* JSDocThisTag */:
- case 303 /* JSDocEnumTag */:
+ case 306 /* JSDocReturnTag */:
+ case 308 /* JSDocTypeTag */:
+ case 307 /* JSDocThisTag */:
+ case 304 /* JSDocEnumTag */:
return visitNode(cbNode, node.tagName) ||
visitNode(cbNode, node.typeExpression);
- case 298 /* JSDocSignature */:
+ case 299 /* JSDocSignature */:
return ts.forEach(node.typeParameters, cbNode) ||
ts.forEach(node.parameters, cbNode) ||
visitNode(cbNode, node.type);
- case 297 /* JSDocTypeLiteral */:
+ case 298 /* JSDocTypeLiteral */:
return ts.forEach(node.jsDocPropertyTags, cbNode);
- case 299 /* JSDocTag */:
- case 301 /* JSDocClassTag */:
+ case 300 /* JSDocTag */:
+ case 302 /* JSDocClassTag */:
return visitNode(cbNode, node.tagName);
- case 313 /* PartiallyEmittedExpression */:
+ case 314 /* PartiallyEmittedExpression */:
return visitNode(cbNode, node.expression);
}
}
@@ -17050,7 +17167,7 @@
(function (Parser) {
// Share a single scanner across all calls to parse a source file. This helps speed things
// up by avoiding the cost of creating/compiling scanners over and over again.
- var scanner = ts.createScanner(7 /* Latest */, /*skipTrivia*/ true);
+ var scanner = ts.createScanner(8 /* Latest */, /*skipTrivia*/ true);
var disallowInAndDecoratorContext = 2048 /* DisallowInContext */ | 8192 /* DecoratorContext */;
// capture constructors in 'initializeState' to avoid null checks
// tslint:disable variable-name
@@ -17188,14 +17305,14 @@
sourceFile.endOfFileToken = parseTokenNode();
}
else {
- var statement = createNode(221 /* ExpressionStatement */);
+ var statement = createNode(222 /* ExpressionStatement */);
switch (token()) {
case 22 /* OpenBracketToken */:
statement.expression = parseArrayLiteralExpression();
break;
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
- case 96 /* NullKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
+ case 97 /* NullKeyword */:
statement.expression = parseTokenNode();
break;
case 39 /* MinusToken */:
@@ -17344,7 +17461,7 @@
function createSourceFile(fileName, languageVersion, scriptKind, isDeclarationFile) {
// code from createNode is inlined here so createNode won't have to deal with special case of creating source files
// this is quite rare comparing to other nodes and createNode should be as fast as possible
- var sourceFile = new SourceFileConstructor(284 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length);
+ var sourceFile = new SourceFileConstructor(285 /* SourceFile */, /*pos*/ 0, /* end */ sourceText.length);
nodeCount++;
sourceFile.text = sourceText;
sourceFile.bindDiagnostics = [];
@@ -17487,6 +17604,9 @@
function nextToken() {
return currentToken = scanner.scan();
}
+ function nextTokenJSDoc() {
+ return currentToken = scanner.scanJsDocToken();
+ }
function reScanGreaterToken() {
return currentToken = scanner.reScanGreaterToken();
}
@@ -17552,20 +17672,20 @@
}
// Ignore strict mode flag because we will report an error in type checker instead.
function isIdentifier() {
- if (token() === 72 /* Identifier */) {
+ if (token() === 73 /* Identifier */) {
return true;
}
// If we have a 'yield' keyword, and we're in the [yield] context, then 'yield' is
// considered a keyword and is not an identifier.
- if (token() === 117 /* YieldKeyword */ && inYieldContext()) {
+ if (token() === 118 /* YieldKeyword */ && inYieldContext()) {
return false;
}
// If we have a 'await' keyword, and we're in the [Await] context, then 'await' is
// considered a keyword and is not an identifier.
- if (token() === 122 /* AwaitKeyword */ && inAwaitContext()) {
+ if (token() === 123 /* AwaitKeyword */ && inAwaitContext()) {
return false;
}
- return token() > 108 /* LastReservedWord */;
+ return token() > 109 /* LastReservedWord */;
}
function parseExpected(kind, diagnosticMessage, shouldAdvance) {
if (shouldAdvance === void 0) { shouldAdvance = true; }
@@ -17584,6 +17704,14 @@
}
return false;
}
+ function parseExpectedJSDoc(kind) {
+ if (token() === kind) {
+ nextTokenJSDoc();
+ return true;
+ }
+ parseErrorAtCurrentToken(ts.Diagnostics._0_expected, ts.tokenToString(kind));
+ return false;
+ }
function parseOptional(t) {
if (token() === t) {
nextToken();
@@ -17597,15 +17725,30 @@
}
return undefined;
}
+ function parseOptionalTokenJSDoc(t) {
+ if (token() === t) {
+ return parseTokenNodeJSDoc();
+ }
+ return undefined;
+ }
function parseExpectedToken(t, diagnosticMessage, arg0) {
return parseOptionalToken(t) ||
createMissingNode(t, /*reportAtCurrentPosition*/ false, diagnosticMessage || ts.Diagnostics._0_expected, arg0 || ts.tokenToString(t));
}
+ function parseExpectedTokenJSDoc(t) {
+ return parseOptionalTokenJSDoc(t) ||
+ createMissingNode(t, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(t));
+ }
function parseTokenNode() {
var node = createNode(token());
nextToken();
return finishNode(node);
}
+ function parseTokenNodeJSDoc() {
+ var node = createNode(token());
+ nextTokenJSDoc();
+ return finishNode(node);
+ }
function canParseSemicolon() {
// If there's a real semicolon, then we can always parse it out.
if (token() === 26 /* SemicolonToken */) {
@@ -17630,7 +17773,7 @@
nodeCount++;
var p = pos >= 0 ? pos : scanner.getStartPos();
return ts.isNodeKind(kind) || kind === 0 /* Unknown */ ? new NodeConstructor(kind, p, p) :
- kind === 72 /* Identifier */ ? new IdentifierConstructor(kind, p, p) :
+ kind === 73 /* Identifier */ ? new IdentifierConstructor(kind, p, p) :
new TokenConstructor(kind, p, p);
}
function createNodeWithJSDoc(kind, pos) {
@@ -17672,7 +17815,7 @@
parseErrorAtCurrentToken(diagnosticMessage, arg0);
}
var result = createNode(kind);
- if (kind === 72 /* Identifier */) {
+ if (kind === 73 /* Identifier */) {
result.escapedText = "";
}
else if (ts.isLiteralKind(kind) || ts.isTemplateLiteralKind(kind)) {
@@ -17693,9 +17836,9 @@
function createIdentifier(isIdentifier, diagnosticMessage) {
identifierCount++;
if (isIdentifier) {
- var node = createNode(72 /* Identifier */);
+ var node = createNode(73 /* Identifier */);
// Store original token kind if it is not just an Identifier so we can report appropriate error later in type checker
- if (token() !== 72 /* Identifier */) {
+ if (token() !== 73 /* Identifier */) {
node.originalKeywordKind = token();
}
node.escapedText = ts.escapeLeadingUnderscores(internIdentifier(scanner.getTokenValue()));
@@ -17704,7 +17847,7 @@
}
// Only for end of file because the error gets reported incorrectly on embedded script tags.
var reportAtCurrentPosition = token() === 1 /* EndOfFileToken */;
- return createMissingNode(72 /* Identifier */, reportAtCurrentPosition, diagnosticMessage || ts.Diagnostics.Identifier_expected);
+ return createMissingNode(73 /* Identifier */, reportAtCurrentPosition, diagnosticMessage || ts.Diagnostics.Identifier_expected);
}
function parseIdentifier(diagnosticMessage) {
return createIdentifier(isIdentifier(), diagnosticMessage);
@@ -17735,7 +17878,7 @@
// PropertyName [Yield]:
// LiteralPropertyName
// ComputedPropertyName[?Yield]
- var node = createNode(149 /* ComputedPropertyName */);
+ var node = createNode(150 /* ComputedPropertyName */);
parseExpected(22 /* OpenBracketToken */);
// We parse any expression (including a comma expression). But the grammar
// says that only an assignment expression is allowed, so the grammar checker
@@ -17756,20 +17899,20 @@
}
function nextTokenCanFollowModifier() {
switch (token()) {
- case 77 /* ConstKeyword */:
+ case 78 /* ConstKeyword */:
// 'const' is only a modifier if followed by 'enum'.
- return nextToken() === 84 /* EnumKeyword */;
- case 85 /* ExportKeyword */:
+ return nextToken() === 85 /* EnumKeyword */;
+ case 86 /* ExportKeyword */:
nextToken();
- if (token() === 80 /* DefaultKeyword */) {
+ if (token() === 81 /* DefaultKeyword */) {
return lookAhead(nextTokenCanFollowDefaultKeyword);
}
- return token() !== 40 /* AsteriskToken */ && token() !== 119 /* AsKeyword */ && token() !== 18 /* OpenBraceToken */ && canFollowModifier();
- case 80 /* DefaultKeyword */:
+ return token() !== 40 /* AsteriskToken */ && token() !== 120 /* AsKeyword */ && token() !== 18 /* OpenBraceToken */ && canFollowModifier();
+ case 81 /* DefaultKeyword */:
return nextTokenCanFollowDefaultKeyword();
- case 116 /* StaticKeyword */:
- case 126 /* GetKeyword */:
- case 137 /* SetKeyword */:
+ case 117 /* StaticKeyword */:
+ case 127 /* GetKeyword */:
+ case 138 /* SetKeyword */:
nextToken();
return canFollowModifier();
default:
@@ -17788,10 +17931,10 @@
}
function nextTokenCanFollowDefaultKeyword() {
nextToken();
- return token() === 76 /* ClassKeyword */ || token() === 90 /* FunctionKeyword */ ||
- token() === 110 /* InterfaceKeyword */ ||
- (token() === 118 /* AbstractKeyword */ && lookAhead(nextTokenIsClassKeywordOnSameLine)) ||
- (token() === 121 /* AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine));
+ return token() === 77 /* ClassKeyword */ || token() === 91 /* FunctionKeyword */ ||
+ token() === 111 /* InterfaceKeyword */ ||
+ (token() === 119 /* AbstractKeyword */ && lookAhead(nextTokenIsClassKeywordOnSameLine)) ||
+ (token() === 122 /* AsyncKeyword */ && lookAhead(nextTokenIsFunctionKeywordOnSameLine));
}
// True if positioned at the start of a list element
function isListElement(parsingContext, inErrorRecovery) {
@@ -17811,7 +17954,7 @@
// outer module. We just want to consume and move on.
return !(token() === 26 /* SemicolonToken */ && inErrorRecovery) && isStartOfStatement();
case 2 /* SwitchClauses */:
- return token() === 74 /* CaseKeyword */ || token() === 80 /* DefaultKeyword */;
+ return token() === 75 /* CaseKeyword */ || token() === 81 /* DefaultKeyword */;
case 4 /* TypeMembers */:
return lookAhead(isTypeMemberStart);
case 5 /* ClassMembers */:
@@ -17897,7 +18040,7 @@
// extends {} extends
// extends {} implements
var next = nextToken();
- return next === 27 /* CommaToken */ || next === 18 /* OpenBraceToken */ || next === 86 /* ExtendsKeyword */ || next === 109 /* ImplementsKeyword */;
+ return next === 27 /* CommaToken */ || next === 18 /* OpenBraceToken */ || next === 87 /* ExtendsKeyword */ || next === 110 /* ImplementsKeyword */;
}
return true;
}
@@ -17914,8 +18057,8 @@
return ts.tokenIsIdentifierOrKeywordOrGreaterThan(token());
}
function isHeritageClauseExtendsOrImplementsKeyword() {
- if (token() === 109 /* ImplementsKeyword */ ||
- token() === 86 /* ExtendsKeyword */) {
+ if (token() === 110 /* ImplementsKeyword */ ||
+ token() === 87 /* ExtendsKeyword */) {
return lookAhead(nextTokenIsStartOfExpression);
}
return false;
@@ -17945,14 +18088,14 @@
case 23 /* ImportOrExportSpecifiers */:
return token() === 19 /* CloseBraceToken */;
case 3 /* SwitchClauseStatements */:
- return token() === 19 /* CloseBraceToken */ || token() === 74 /* CaseKeyword */ || token() === 80 /* DefaultKeyword */;
+ return token() === 19 /* CloseBraceToken */ || token() === 75 /* CaseKeyword */ || token() === 81 /* DefaultKeyword */;
case 7 /* HeritageClauseElement */:
- return token() === 18 /* OpenBraceToken */ || token() === 86 /* ExtendsKeyword */ || token() === 109 /* ImplementsKeyword */;
+ return token() === 18 /* OpenBraceToken */ || token() === 87 /* ExtendsKeyword */ || token() === 110 /* ImplementsKeyword */;
case 8 /* VariableDeclarations */:
return isVariableDeclaratorListTerminator();
case 19 /* TypeParameters */:
// Tokens other than '>' are here for better error recovery
- return token() === 30 /* GreaterThanToken */ || token() === 20 /* OpenParenToken */ || token() === 18 /* OpenBraceToken */ || token() === 86 /* ExtendsKeyword */ || token() === 109 /* ImplementsKeyword */;
+ return token() === 30 /* GreaterThanToken */ || token() === 20 /* OpenParenToken */ || token() === 18 /* OpenBraceToken */ || token() === 87 /* ExtendsKeyword */ || token() === 110 /* ImplementsKeyword */;
case 11 /* ArgumentExpressions */:
// Tokens other than ')' are here for better error recovery
return token() === 21 /* CloseParenToken */ || token() === 26 /* SemicolonToken */;
@@ -18169,20 +18312,20 @@
function isReusableClassMember(node) {
if (node) {
switch (node.kind) {
- case 157 /* Constructor */:
- case 162 /* IndexSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 154 /* PropertyDeclaration */:
- case 217 /* SemicolonClassElement */:
+ case 158 /* Constructor */:
+ case 163 /* IndexSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 155 /* PropertyDeclaration */:
+ case 218 /* SemicolonClassElement */:
return true;
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
// Method declarations are not necessarily reusable. An object-literal
// may have a method calls "constructor(...)" and we must reparse that
// into an actual .ConstructorDeclaration.
var methodDeclaration = node;
- var nameIsConstructor = methodDeclaration.name.kind === 72 /* Identifier */ &&
- methodDeclaration.name.originalKeywordKind === 124 /* ConstructorKeyword */;
+ var nameIsConstructor = methodDeclaration.name.kind === 73 /* Identifier */ &&
+ methodDeclaration.name.originalKeywordKind === 125 /* ConstructorKeyword */;
return !nameIsConstructor;
}
}
@@ -18191,8 +18334,8 @@
function isReusableSwitchClause(node) {
if (node) {
switch (node.kind) {
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
return true;
}
}
@@ -18201,58 +18344,58 @@
function isReusableStatement(node) {
if (node) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 219 /* VariableStatement */:
- case 218 /* Block */:
- case 222 /* IfStatement */:
- case 221 /* ExpressionStatement */:
- case 234 /* ThrowStatement */:
- case 230 /* ReturnStatement */:
- case 232 /* SwitchStatement */:
- case 229 /* BreakStatement */:
- case 228 /* ContinueStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 225 /* ForStatement */:
- case 224 /* WhileStatement */:
- case 231 /* WithStatement */:
- case 220 /* EmptyStatement */:
- case 235 /* TryStatement */:
- case 233 /* LabeledStatement */:
- case 223 /* DoStatement */:
- case 236 /* DebuggerStatement */:
- case 249 /* ImportDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
- case 255 /* ExportDeclaration */:
- case 254 /* ExportAssignment */:
- case 244 /* ModuleDeclaration */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
- case 242 /* TypeAliasDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 220 /* VariableStatement */:
+ case 219 /* Block */:
+ case 223 /* IfStatement */:
+ case 222 /* ExpressionStatement */:
+ case 235 /* ThrowStatement */:
+ case 231 /* ReturnStatement */:
+ case 233 /* SwitchStatement */:
+ case 230 /* BreakStatement */:
+ case 229 /* ContinueStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 226 /* ForStatement */:
+ case 225 /* WhileStatement */:
+ case 232 /* WithStatement */:
+ case 221 /* EmptyStatement */:
+ case 236 /* TryStatement */:
+ case 234 /* LabeledStatement */:
+ case 224 /* DoStatement */:
+ case 237 /* DebuggerStatement */:
+ case 250 /* ImportDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 256 /* ExportDeclaration */:
+ case 255 /* ExportAssignment */:
+ case 245 /* ModuleDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return true;
}
}
return false;
}
function isReusableEnumMember(node) {
- return node.kind === 278 /* EnumMember */;
+ return node.kind === 279 /* EnumMember */;
}
function isReusableTypeMember(node) {
if (node) {
switch (node.kind) {
- case 161 /* ConstructSignature */:
- case 155 /* MethodSignature */:
- case 162 /* IndexSignature */:
- case 153 /* PropertySignature */:
- case 160 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 156 /* MethodSignature */:
+ case 163 /* IndexSignature */:
+ case 154 /* PropertySignature */:
+ case 161 /* CallSignature */:
return true;
}
}
return false;
}
function isReusableVariableDeclaration(node) {
- if (node.kind !== 237 /* VariableDeclaration */) {
+ if (node.kind !== 238 /* VariableDeclaration */) {
return false;
}
// Very subtle incremental parsing bug. Consider the following code:
@@ -18273,7 +18416,7 @@
return variableDeclarator.initializer === undefined;
}
function isReusableParameter(node) {
- if (node.kind !== 151 /* Parameter */) {
+ if (node.kind !== 152 /* Parameter */) {
return false;
}
// See the comment in isReusableVariableDeclaration for why we do this.
@@ -18409,7 +18552,7 @@
return entity;
}
function createQualifiedName(entity, name) {
- var node = createNode(148 /* QualifiedName */, entity.pos);
+ var node = createNode(149 /* QualifiedName */, entity.pos);
node.left = entity;
node.right = name;
return finishNode(node);
@@ -18440,13 +18583,13 @@
// Report that we need an identifier. However, report it right after the dot,
// and not on the next token. This is because the next token might actually
// be an identifier and the error would be quite confusing.
- return createMissingNode(72 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Identifier_expected);
+ return createMissingNode(73 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Identifier_expected);
}
}
return allowIdentifierNames ? parseIdentifierName() : parseIdentifier();
}
function parseTemplateExpression() {
- var template = createNode(206 /* TemplateExpression */);
+ var template = createNode(207 /* TemplateExpression */);
template.head = parseTemplateHead();
ts.Debug.assert(template.head.kind === 15 /* TemplateHead */, "Template head has wrong token kind");
var list = [];
@@ -18458,7 +18601,7 @@
return finishNode(template);
}
function parseTemplateSpan() {
- var span = createNode(216 /* TemplateSpan */);
+ var span = createNode(217 /* TemplateSpan */);
span.expression = allowInAnd(parseExpression);
var literal;
if (token() === 19 /* CloseBraceToken */) {
@@ -18508,7 +18651,7 @@
}
// TYPES
function parseTypeReference() {
- var node = createNode(164 /* TypeReference */);
+ var node = createNode(165 /* TypeReference */);
node.typeName = parseEntityName(/*allowReservedWords*/ true, ts.Diagnostics.Type_expected);
if (!scanner.hasPrecedingLineBreak() && reScanLessThanToken() === 28 /* LessThanToken */) {
node.typeArguments = parseBracketedList(20 /* TypeArguments */, parseType, 28 /* LessThanToken */, 30 /* GreaterThanToken */);
@@ -18518,14 +18661,14 @@
// If true, we should abort parsing an error function.
function typeHasArrowFunctionBlockingParseError(node) {
switch (node.kind) {
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return ts.nodeIsMissing(node.typeName);
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */: {
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */: {
var _a = node, parameters = _a.parameters, type = _a.type;
return isMissingList(parameters) || typeHasArrowFunctionBlockingParseError(type);
}
- case 177 /* ParenthesizedType */:
+ case 178 /* ParenthesizedType */:
return typeHasArrowFunctionBlockingParseError(node.type);
default:
return false;
@@ -18533,20 +18676,20 @@
}
function parseThisTypePredicate(lhs) {
nextToken();
- var node = createNode(163 /* TypePredicate */, lhs.pos);
+ var node = createNode(164 /* TypePredicate */, lhs.pos);
node.parameterName = lhs;
node.type = parseType();
return finishNode(node);
}
function parseThisTypeNode() {
- var node = createNode(178 /* ThisType */);
+ var node = createNode(179 /* ThisType */);
nextToken();
return finishNode(node);
}
function parseJSDocAllType(postFixEquals) {
- var result = createNode(289 /* JSDocAllType */);
+ var result = createNode(290 /* JSDocAllType */);
if (postFixEquals) {
- return createPostfixType(293 /* JSDocOptionalType */, result);
+ return createPostfixType(294 /* JSDocOptionalType */, result);
}
else {
nextToken();
@@ -18554,7 +18697,7 @@
return finishNode(result);
}
function parseJSDocNonNullableType() {
- var result = createNode(292 /* JSDocNonNullableType */);
+ var result = createNode(293 /* JSDocNonNullableType */);
nextToken();
result.type = parseNonArrayType();
return finishNode(result);
@@ -18576,31 +18719,31 @@
token() === 19 /* CloseBraceToken */ ||
token() === 21 /* CloseParenToken */ ||
token() === 30 /* GreaterThanToken */ ||
- token() === 59 /* EqualsToken */ ||
+ token() === 60 /* EqualsToken */ ||
token() === 50 /* BarToken */) {
- var result = createNode(290 /* JSDocUnknownType */, pos);
+ var result = createNode(291 /* JSDocUnknownType */, pos);
return finishNode(result);
}
else {
- var result = createNode(291 /* JSDocNullableType */, pos);
+ var result = createNode(292 /* JSDocNullableType */, pos);
result.type = parseType();
return finishNode(result);
}
}
function parseJSDocFunctionType() {
if (lookAhead(nextTokenIsOpenParen)) {
- var result = createNodeWithJSDoc(294 /* JSDocFunctionType */);
+ var result = createNodeWithJSDoc(295 /* JSDocFunctionType */);
nextToken();
fillSignature(57 /* ColonToken */, 4 /* Type */ | 32 /* JSDoc */, result);
return finishNode(result);
}
- var node = createNode(164 /* TypeReference */);
+ var node = createNode(165 /* TypeReference */);
node.typeName = parseIdentifierName();
return finishNode(node);
}
function parseJSDocParameter() {
- var parameter = createNode(151 /* Parameter */);
- if (token() === 100 /* ThisKeyword */ || token() === 95 /* NewKeyword */) {
+ var parameter = createNode(152 /* Parameter */);
+ if (token() === 101 /* ThisKeyword */ || token() === 96 /* NewKeyword */) {
parameter.name = parseIdentifierName();
parseExpected(57 /* ColonToken */);
}
@@ -18613,25 +18756,25 @@
var type = parseTypeOrTypePredicate();
scanner.setInJSDocType(false);
if (dotdotdot) {
- var variadic = createNode(295 /* JSDocVariadicType */, dotdotdot.pos);
+ var variadic = createNode(296 /* JSDocVariadicType */, dotdotdot.pos);
variadic.type = type;
type = finishNode(variadic);
}
- if (token() === 59 /* EqualsToken */) {
- return createPostfixType(293 /* JSDocOptionalType */, type);
+ if (token() === 60 /* EqualsToken */) {
+ return createPostfixType(294 /* JSDocOptionalType */, type);
}
return type;
}
function parseTypeQuery() {
- var node = createNode(167 /* TypeQuery */);
- parseExpected(104 /* TypeOfKeyword */);
+ var node = createNode(168 /* TypeQuery */);
+ parseExpected(105 /* TypeOfKeyword */);
node.exprName = parseEntityName(/*allowReservedWords*/ true);
return finishNode(node);
}
function parseTypeParameter() {
- var node = createNode(150 /* TypeParameter */);
+ var node = createNode(151 /* TypeParameter */);
node.name = parseIdentifier();
- if (parseOptional(86 /* ExtendsKeyword */)) {
+ if (parseOptional(87 /* ExtendsKeyword */)) {
// It's not uncommon for people to write improper constraints to a generic. If the
// user writes a constraint that is an expression and not an actual type, then parse
// it out as an expression (so we can recover well), but report that a type is needed
@@ -18650,7 +18793,7 @@
node.expression = parseUnaryExpressionOrHigher();
}
}
- if (parseOptional(59 /* EqualsToken */)) {
+ if (parseOptional(60 /* EqualsToken */)) {
node.default = parseType();
}
return finishNode(node);
@@ -18674,8 +18817,8 @@
isStartOfType(/*inStartOfParameter*/ !isJSDocParameter);
}
function parseParameter() {
- var node = createNodeWithJSDoc(151 /* Parameter */);
- if (token() === 100 /* ThisKeyword */) {
+ var node = createNodeWithJSDoc(152 /* Parameter */);
+ if (token() === 101 /* ThisKeyword */) {
node.name = createIdentifier(/*isIdentifier*/ true);
node.type = parseParameterType();
return finishNode(node);
@@ -18775,8 +18918,8 @@
}
function parseSignatureMember(kind) {
var node = createNodeWithJSDoc(kind);
- if (kind === 161 /* ConstructSignature */) {
- parseExpected(95 /* NewKeyword */);
+ if (kind === 162 /* ConstructSignature */) {
+ parseExpected(96 /* NewKeyword */);
}
fillSignature(57 /* ColonToken */, 4 /* Type */, node);
parseTypeMemberSemicolon();
@@ -18836,7 +18979,7 @@
return token() === 57 /* ColonToken */ || token() === 27 /* CommaToken */ || token() === 23 /* CloseBracketToken */;
}
function parseIndexSignatureDeclaration(node) {
- node.kind = 162 /* IndexSignature */;
+ node.kind = 163 /* IndexSignature */;
node.parameters = parseBracketedList(16 /* Parameters */, parseParameter, 22 /* OpenBracketToken */, 23 /* CloseBracketToken */);
node.type = parseTypeAnnotation();
parseTypeMemberSemicolon();
@@ -18846,15 +18989,15 @@
node.name = parsePropertyName();
node.questionToken = parseOptionalToken(56 /* QuestionToken */);
if (token() === 20 /* OpenParenToken */ || token() === 28 /* LessThanToken */) {
- node.kind = 155 /* MethodSignature */;
+ node.kind = 156 /* MethodSignature */;
// Method signatures don't exist in expression contexts. So they have neither
// [Yield] nor [Await]
fillSignature(57 /* ColonToken */, 4 /* Type */, node);
}
else {
- node.kind = 153 /* PropertySignature */;
+ node.kind = 154 /* PropertySignature */;
node.type = parseTypeAnnotation();
- if (token() === 59 /* EqualsToken */) {
+ if (token() === 60 /* EqualsToken */) {
// Although type literal properties cannot not have initializers, we attempt
// to parse an initializer so we can report in the checker that an interface
// property or type literal property cannot have an initializer.
@@ -18898,10 +19041,10 @@
}
function parseTypeMember() {
if (token() === 20 /* OpenParenToken */ || token() === 28 /* LessThanToken */) {
- return parseSignatureMember(160 /* CallSignature */);
+ return parseSignatureMember(161 /* CallSignature */);
}
- if (token() === 95 /* NewKeyword */ && lookAhead(nextTokenIsOpenParenOrLessThan)) {
- return parseSignatureMember(161 /* ConstructSignature */);
+ if (token() === 96 /* NewKeyword */ && lookAhead(nextTokenIsOpenParenOrLessThan)) {
+ return parseSignatureMember(162 /* ConstructSignature */);
}
var node = createNodeWithJSDoc(0 /* Unknown */);
node.modifiers = parseModifiers();
@@ -18927,7 +19070,7 @@
return false;
}
function parseTypeLiteral() {
- var node = createNode(168 /* TypeLiteral */);
+ var node = createNode(169 /* TypeLiteral */);
node.members = parseObjectTypeMembers();
return finishNode(node);
}
@@ -18945,27 +19088,27 @@
function isStartOfMappedType() {
nextToken();
if (token() === 38 /* PlusToken */ || token() === 39 /* MinusToken */) {
- return nextToken() === 133 /* ReadonlyKeyword */;
+ return nextToken() === 134 /* ReadonlyKeyword */;
}
- if (token() === 133 /* ReadonlyKeyword */) {
+ if (token() === 134 /* ReadonlyKeyword */) {
nextToken();
}
- return token() === 22 /* OpenBracketToken */ && nextTokenIsIdentifier() && nextToken() === 93 /* InKeyword */;
+ return token() === 22 /* OpenBracketToken */ && nextTokenIsIdentifier() && nextToken() === 94 /* InKeyword */;
}
function parseMappedTypeParameter() {
- var node = createNode(150 /* TypeParameter */);
+ var node = createNode(151 /* TypeParameter */);
node.name = parseIdentifier();
- parseExpected(93 /* InKeyword */);
+ parseExpected(94 /* InKeyword */);
node.constraint = parseType();
return finishNode(node);
}
function parseMappedType() {
- var node = createNode(181 /* MappedType */);
+ var node = createNode(182 /* MappedType */);
parseExpected(18 /* OpenBraceToken */);
- if (token() === 133 /* ReadonlyKeyword */ || token() === 38 /* PlusToken */ || token() === 39 /* MinusToken */) {
+ if (token() === 134 /* ReadonlyKeyword */ || token() === 38 /* PlusToken */ || token() === 39 /* MinusToken */) {
node.readonlyToken = parseTokenNode();
- if (node.readonlyToken.kind !== 133 /* ReadonlyKeyword */) {
- parseExpectedToken(133 /* ReadonlyKeyword */);
+ if (node.readonlyToken.kind !== 134 /* ReadonlyKeyword */) {
+ parseExpectedToken(134 /* ReadonlyKeyword */);
}
}
parseExpected(22 /* OpenBracketToken */);
@@ -18985,23 +19128,23 @@
function parseTupleElementType() {
var pos = getNodePos();
if (parseOptional(25 /* DotDotDotToken */)) {
- var node = createNode(172 /* RestType */, pos);
+ var node = createNode(173 /* RestType */, pos);
node.type = parseType();
return finishNode(node);
}
var type = parseType();
- if (!(contextFlags & 2097152 /* JSDoc */) && type.kind === 291 /* JSDocNullableType */ && type.pos === type.type.pos) {
- type.kind = 171 /* OptionalType */;
+ if (!(contextFlags & 2097152 /* JSDoc */) && type.kind === 292 /* JSDocNullableType */ && type.pos === type.type.pos) {
+ type.kind = 172 /* OptionalType */;
}
return type;
}
function parseTupleType() {
- var node = createNode(170 /* TupleType */);
+ var node = createNode(171 /* TupleType */);
node.elementTypes = parseBracketedList(21 /* TupleElementTypes */, parseTupleElementType, 22 /* OpenBracketToken */, 23 /* CloseBracketToken */);
return finishNode(node);
}
function parseParenthesizedType() {
- var node = createNode(177 /* ParenthesizedType */);
+ var node = createNode(178 /* ParenthesizedType */);
parseExpected(20 /* OpenParenToken */);
node.type = parseType();
parseExpected(21 /* CloseParenToken */);
@@ -19009,7 +19152,7 @@
}
function parseFunctionOrConstructorType() {
var pos = getNodePos();
- var kind = parseOptional(95 /* NewKeyword */) ? 166 /* ConstructorType */ : 165 /* FunctionType */;
+ var kind = parseOptional(96 /* NewKeyword */) ? 167 /* ConstructorType */ : 166 /* FunctionType */;
var node = createNodeWithJSDoc(kind, pos);
fillSignature(37 /* EqualsGreaterThanToken */, 4 /* Type */, node);
return finishNode(node);
@@ -19019,14 +19162,14 @@
return token() === 24 /* DotToken */ ? undefined : node;
}
function parseLiteralTypeNode(negative) {
- var node = createNode(182 /* LiteralType */);
+ var node = createNode(183 /* LiteralType */);
var unaryMinusExpression;
if (negative) {
- unaryMinusExpression = createNode(202 /* PrefixUnaryExpression */);
+ unaryMinusExpression = createNode(203 /* PrefixUnaryExpression */);
unaryMinusExpression.operator = 39 /* MinusToken */;
nextToken();
}
- var expression = token() === 102 /* TrueKeyword */ || token() === 87 /* FalseKeyword */
+ var expression = token() === 103 /* TrueKeyword */ || token() === 88 /* FalseKeyword */
? parseTokenNode()
: parseLiteralLikeNode(token());
if (negative) {
@@ -19039,22 +19182,24 @@
}
function isStartOfTypeOfImportType() {
nextToken();
- return token() === 92 /* ImportKeyword */;
+ return token() === 93 /* ImportKeyword */;
}
function parseImportType() {
sourceFile.flags |= 524288 /* PossiblyContainsDynamicImport */;
- var node = createNode(183 /* ImportType */);
- if (parseOptional(104 /* TypeOfKeyword */)) {
+ var node = createNode(184 /* ImportType */);
+ if (parseOptional(105 /* TypeOfKeyword */)) {
node.isTypeOf = true;
}
- parseExpected(92 /* ImportKeyword */);
+ parseExpected(93 /* ImportKeyword */);
parseExpected(20 /* OpenParenToken */);
node.argument = parseType();
parseExpected(21 /* CloseParenToken */);
if (parseOptional(24 /* DotToken */)) {
node.qualifier = parseEntityName(/*allowReservedWords*/ true, ts.Diagnostics.Type_expected);
}
- node.typeArguments = tryParseTypeArguments();
+ if (!scanner.hasPrecedingLineBreak() && reScanLessThanToken() === 28 /* LessThanToken */) {
+ node.typeArguments = parseBracketedList(20 /* TypeArguments */, parseType, 28 /* LessThanToken */, 30 /* GreaterThanToken */);
+ }
return finishNode(node);
}
function nextTokenIsNumericOrBigIntLiteral() {
@@ -19063,25 +19208,25 @@
}
function parseNonArrayType() {
switch (token()) {
- case 120 /* AnyKeyword */:
- case 143 /* UnknownKeyword */:
- case 138 /* StringKeyword */:
- case 135 /* NumberKeyword */:
- case 146 /* BigIntKeyword */:
- case 139 /* SymbolKeyword */:
- case 123 /* BooleanKeyword */:
- case 141 /* UndefinedKeyword */:
- case 132 /* NeverKeyword */:
- case 136 /* ObjectKeyword */:
+ case 121 /* AnyKeyword */:
+ case 144 /* UnknownKeyword */:
+ case 139 /* StringKeyword */:
+ case 136 /* NumberKeyword */:
+ case 147 /* BigIntKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 142 /* UndefinedKeyword */:
+ case 133 /* NeverKeyword */:
+ case 137 /* ObjectKeyword */:
// If these are followed by a dot, then parse these out as a dotted type reference instead.
return tryParse(parseKeywordAndNoDot) || parseTypeReference();
case 40 /* AsteriskToken */:
return parseJSDocAllType(/*postfixEquals*/ false);
- case 62 /* AsteriskEqualsToken */:
+ case 63 /* AsteriskEqualsToken */:
return parseJSDocAllType(/*postfixEquals*/ true);
case 56 /* QuestionToken */:
return parseJSDocUnknownOrNullableType();
- case 90 /* FunctionKeyword */:
+ case 91 /* FunctionKeyword */:
return parseJSDocFunctionType();
case 52 /* ExclamationToken */:
return parseJSDocNonNullableType();
@@ -19089,24 +19234,24 @@
case 10 /* StringLiteral */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
return parseLiteralTypeNode();
case 39 /* MinusToken */:
return lookAhead(nextTokenIsNumericOrBigIntLiteral) ? parseLiteralTypeNode(/*negative*/ true) : parseTypeReference();
- case 106 /* VoidKeyword */:
- case 96 /* NullKeyword */:
+ case 107 /* VoidKeyword */:
+ case 97 /* NullKeyword */:
return parseTokenNode();
- case 100 /* ThisKeyword */: {
+ case 101 /* ThisKeyword */: {
var thisKeyword = parseThisTypeNode();
- if (token() === 128 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) {
+ if (token() === 129 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) {
return parseThisTypePredicate(thisKeyword);
}
else {
return thisKeyword;
}
}
- case 104 /* TypeOfKeyword */:
+ case 105 /* TypeOfKeyword */:
return lookAhead(isStartOfTypeOfImportType) ? parseImportType() : parseTypeQuery();
case 18 /* OpenBraceToken */:
return lookAhead(isStartOfMappedType) ? parseMappedType() : parseTypeLiteral();
@@ -19114,7 +19259,7 @@
return parseTupleType();
case 20 /* OpenParenToken */:
return parseParenthesizedType();
- case 92 /* ImportKeyword */:
+ case 93 /* ImportKeyword */:
return parseImportType();
default:
return parseTypeReference();
@@ -19122,41 +19267,41 @@
}
function isStartOfType(inStartOfParameter) {
switch (token()) {
- case 120 /* AnyKeyword */:
- case 143 /* UnknownKeyword */:
- case 138 /* StringKeyword */:
- case 135 /* NumberKeyword */:
- case 146 /* BigIntKeyword */:
- case 123 /* BooleanKeyword */:
- case 133 /* ReadonlyKeyword */:
- case 139 /* SymbolKeyword */:
- case 142 /* UniqueKeyword */:
- case 106 /* VoidKeyword */:
- case 141 /* UndefinedKeyword */:
- case 96 /* NullKeyword */:
- case 100 /* ThisKeyword */:
- case 104 /* TypeOfKeyword */:
- case 132 /* NeverKeyword */:
+ case 121 /* AnyKeyword */:
+ case 144 /* UnknownKeyword */:
+ case 139 /* StringKeyword */:
+ case 136 /* NumberKeyword */:
+ case 147 /* BigIntKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 134 /* ReadonlyKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 143 /* UniqueKeyword */:
+ case 107 /* VoidKeyword */:
+ case 142 /* UndefinedKeyword */:
+ case 97 /* NullKeyword */:
+ case 101 /* ThisKeyword */:
+ case 105 /* TypeOfKeyword */:
+ case 133 /* NeverKeyword */:
case 18 /* OpenBraceToken */:
case 22 /* OpenBracketToken */:
case 28 /* LessThanToken */:
case 50 /* BarToken */:
case 49 /* AmpersandToken */:
- case 95 /* NewKeyword */:
+ case 96 /* NewKeyword */:
case 10 /* StringLiteral */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
- case 136 /* ObjectKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
+ case 137 /* ObjectKeyword */:
case 40 /* AsteriskToken */:
case 56 /* QuestionToken */:
case 52 /* ExclamationToken */:
case 25 /* DotDotDotToken */:
- case 127 /* InferKeyword */:
- case 92 /* ImportKeyword */:
+ case 128 /* InferKeyword */:
+ case 93 /* ImportKeyword */:
return true;
- case 90 /* FunctionKeyword */:
+ case 91 /* FunctionKeyword */:
return !inStartOfParameter;
case 39 /* MinusToken */:
return !inStartOfParameter && lookAhead(nextTokenIsNumericOrBigIntLiteral);
@@ -19177,26 +19322,26 @@
while (!scanner.hasPrecedingLineBreak()) {
switch (token()) {
case 52 /* ExclamationToken */:
- type = createPostfixType(292 /* JSDocNonNullableType */, type);
+ type = createPostfixType(293 /* JSDocNonNullableType */, type);
break;
case 56 /* QuestionToken */:
// If not in JSDoc and next token is start of a type we have a conditional type
if (!(contextFlags & 2097152 /* JSDoc */) && lookAhead(nextTokenIsStartOfType)) {
return type;
}
- type = createPostfixType(291 /* JSDocNullableType */, type);
+ type = createPostfixType(292 /* JSDocNullableType */, type);
break;
case 22 /* OpenBracketToken */:
parseExpected(22 /* OpenBracketToken */);
if (isStartOfType()) {
- var node = createNode(180 /* IndexedAccessType */, type.pos);
+ var node = createNode(181 /* IndexedAccessType */, type.pos);
node.objectType = type;
node.indexType = parseType();
parseExpected(23 /* CloseBracketToken */);
type = finishNode(node);
}
else {
- var node = createNode(169 /* ArrayType */, type.pos);
+ var node = createNode(170 /* ArrayType */, type.pos);
node.elementType = type;
parseExpected(23 /* CloseBracketToken */);
type = finishNode(node);
@@ -19215,16 +19360,16 @@
return finishNode(postfix);
}
function parseTypeOperator(operator) {
- var node = createNode(179 /* TypeOperator */);
+ var node = createNode(180 /* TypeOperator */);
parseExpected(operator);
node.operator = operator;
node.type = parseTypeOperatorOrHigher();
return finishNode(node);
}
function parseInferType() {
- var node = createNode(176 /* InferType */);
- parseExpected(127 /* InferKeyword */);
- var typeParameter = createNode(150 /* TypeParameter */);
+ var node = createNode(177 /* InferType */);
+ parseExpected(128 /* InferKeyword */);
+ var typeParameter = createNode(151 /* TypeParameter */);
typeParameter.name = parseIdentifier();
node.typeParameter = finishNode(typeParameter);
return finishNode(node);
@@ -19232,34 +19377,35 @@
function parseTypeOperatorOrHigher() {
var operator = token();
switch (operator) {
- case 129 /* KeyOfKeyword */:
- case 142 /* UniqueKeyword */:
- case 133 /* ReadonlyKeyword */:
+ case 130 /* KeyOfKeyword */:
+ case 143 /* UniqueKeyword */:
+ case 134 /* ReadonlyKeyword */:
return parseTypeOperator(operator);
- case 127 /* InferKeyword */:
+ case 128 /* InferKeyword */:
return parseInferType();
}
return parsePostfixTypeOrHigher();
}
function parseUnionOrIntersectionType(kind, parseConstituentType, operator) {
- parseOptional(operator);
+ var start = scanner.getStartPos();
+ var hasLeadingOperator = parseOptional(operator);
var type = parseConstituentType();
- if (token() === operator) {
+ if (token() === operator || hasLeadingOperator) {
var types = [type];
while (parseOptional(operator)) {
types.push(parseConstituentType());
}
- var node = createNode(kind, type.pos);
- node.types = createNodeArray(types, type.pos);
+ var node = createNode(kind, start);
+ node.types = createNodeArray(types, start);
type = finishNode(node);
}
return type;
}
function parseIntersectionTypeOrHigher() {
- return parseUnionOrIntersectionType(174 /* IntersectionType */, parseTypeOperatorOrHigher, 49 /* AmpersandToken */);
+ return parseUnionOrIntersectionType(175 /* IntersectionType */, parseTypeOperatorOrHigher, 49 /* AmpersandToken */);
}
function parseUnionTypeOrHigher() {
- return parseUnionOrIntersectionType(173 /* UnionType */, parseIntersectionTypeOrHigher, 50 /* BarToken */);
+ return parseUnionOrIntersectionType(174 /* UnionType */, parseIntersectionTypeOrHigher, 50 /* BarToken */);
}
function isStartOfFunctionType() {
if (token() === 28 /* LessThanToken */) {
@@ -19272,7 +19418,7 @@
// Skip modifiers
parseModifiers();
}
- if (isIdentifier() || token() === 100 /* ThisKeyword */) {
+ if (isIdentifier() || token() === 101 /* ThisKeyword */) {
nextToken();
return true;
}
@@ -19295,7 +19441,7 @@
// We successfully skipped modifiers (if any) and an identifier or binding pattern,
// now see if we have something that indicates a parameter declaration
if (token() === 57 /* ColonToken */ || token() === 27 /* CommaToken */ ||
- token() === 56 /* QuestionToken */ || token() === 59 /* EqualsToken */) {
+ token() === 56 /* QuestionToken */ || token() === 60 /* EqualsToken */) {
// ( xxx :
// ( xxx ,
// ( xxx ?
@@ -19316,7 +19462,7 @@
var typePredicateVariable = isIdentifier() && tryParse(parseTypePredicatePrefix);
var type = parseType();
if (typePredicateVariable) {
- var node = createNode(163 /* TypePredicate */, typePredicateVariable.pos);
+ var node = createNode(164 /* TypePredicate */, typePredicateVariable.pos);
node.parameterName = typePredicateVariable;
node.type = type;
return finishNode(node);
@@ -19327,7 +19473,7 @@
}
function parseTypePredicatePrefix() {
var id = parseIdentifier();
- if (token() === 128 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) {
+ if (token() === 129 /* IsKeyword */ && !scanner.hasPrecedingLineBreak()) {
nextToken();
return id;
}
@@ -19338,12 +19484,12 @@
return doOutsideOfContext(20480 /* TypeExcludesFlags */, parseTypeWorker);
}
function parseTypeWorker(noConditionalTypes) {
- if (isStartOfFunctionType() || token() === 95 /* NewKeyword */) {
+ if (isStartOfFunctionType() || token() === 96 /* NewKeyword */) {
return parseFunctionOrConstructorType();
}
var type = parseUnionTypeOrHigher();
- if (!noConditionalTypes && !scanner.hasPrecedingLineBreak() && parseOptional(86 /* ExtendsKeyword */)) {
- var node = createNode(175 /* ConditionalType */, type.pos);
+ if (!noConditionalTypes && !scanner.hasPrecedingLineBreak() && parseOptional(87 /* ExtendsKeyword */)) {
+ var node = createNode(176 /* ConditionalType */, type.pos);
node.checkType = type;
// The type following 'extends' is not permitted to be another conditional type
node.extendsType = parseTypeWorker(/*noConditionalTypes*/ true);
@@ -19361,11 +19507,11 @@
// EXPRESSIONS
function isStartOfLeftHandSideExpression() {
switch (token()) {
- case 100 /* ThisKeyword */:
- case 98 /* SuperKeyword */:
- case 96 /* NullKeyword */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
+ case 101 /* ThisKeyword */:
+ case 99 /* SuperKeyword */:
+ case 97 /* NullKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
case 10 /* StringLiteral */:
@@ -19374,14 +19520,14 @@
case 20 /* OpenParenToken */:
case 22 /* OpenBracketToken */:
case 18 /* OpenBraceToken */:
- case 90 /* FunctionKeyword */:
- case 76 /* ClassKeyword */:
- case 95 /* NewKeyword */:
+ case 91 /* FunctionKeyword */:
+ case 77 /* ClassKeyword */:
+ case 96 /* NewKeyword */:
case 42 /* SlashToken */:
- case 64 /* SlashEqualsToken */:
- case 72 /* Identifier */:
+ case 65 /* SlashEqualsToken */:
+ case 73 /* Identifier */:
return true;
- case 92 /* ImportKeyword */:
+ case 93 /* ImportKeyword */:
return lookAhead(nextTokenIsOpenParenOrLessThanOrDot);
default:
return isIdentifier();
@@ -19396,14 +19542,14 @@
case 39 /* MinusToken */:
case 53 /* TildeToken */:
case 52 /* ExclamationToken */:
- case 81 /* DeleteKeyword */:
- case 104 /* TypeOfKeyword */:
- case 106 /* VoidKeyword */:
+ case 82 /* DeleteKeyword */:
+ case 105 /* TypeOfKeyword */:
+ case 107 /* VoidKeyword */:
case 44 /* PlusPlusToken */:
case 45 /* MinusMinusToken */:
case 28 /* LessThanToken */:
- case 122 /* AwaitKeyword */:
- case 117 /* YieldKeyword */:
+ case 123 /* AwaitKeyword */:
+ case 118 /* YieldKeyword */:
// Yield/await always starts an expression. Either it is an identifier (in which case
// it is definitely an expression). Or it's a keyword (either because we're in
// a generator or async function, or in strict mode (or both)) and it started a yield or await expression.
@@ -19422,8 +19568,8 @@
function isStartOfExpressionStatement() {
// As per the grammar, none of '{' or 'function' or 'class' can start an expression statement.
return token() !== 18 /* OpenBraceToken */ &&
- token() !== 90 /* FunctionKeyword */ &&
- token() !== 76 /* ClassKeyword */ &&
+ token() !== 91 /* FunctionKeyword */ &&
+ token() !== 77 /* ClassKeyword */ &&
token() !== 58 /* AtToken */ &&
isStartOfExpression();
}
@@ -19447,7 +19593,7 @@
return expr;
}
function parseInitializer() {
- return parseOptional(59 /* EqualsToken */) ? parseAssignmentExpressionOrHigher() : undefined;
+ return parseOptional(60 /* EqualsToken */) ? parseAssignmentExpressionOrHigher() : undefined;
}
function parseAssignmentExpressionOrHigher() {
// AssignmentExpression[in,yield]:
@@ -19492,7 +19638,7 @@
// To avoid a look-ahead, we did not handle the case of an arrow function with a single un-parenthesized
// parameter ('x => ...') above. We handle it here by checking if the parsed expression was a single
// identifier and the current token is an arrow.
- if (expr.kind === 72 /* Identifier */ && token() === 37 /* EqualsGreaterThanToken */) {
+ if (expr.kind === 73 /* Identifier */ && token() === 37 /* EqualsGreaterThanToken */) {
return parseSimpleArrowFunctionExpression(expr);
}
// Now see if we might be in cases '2' or '3'.
@@ -19508,7 +19654,7 @@
return parseConditionalExpressionRest(expr);
}
function isYieldExpression() {
- if (token() === 117 /* YieldKeyword */) {
+ if (token() === 118 /* YieldKeyword */) {
// If we have a 'yield' keyword, and this is a context where yield expressions are
// allowed, then definitely parse out a yield expression.
if (inYieldContext()) {
@@ -19537,7 +19683,7 @@
return !scanner.hasPrecedingLineBreak() && isIdentifier();
}
function parseYieldExpression() {
- var node = createNode(207 /* YieldExpression */);
+ var node = createNode(208 /* YieldExpression */);
// YieldExpression[In] :
// yield
// yield [no LineTerminator here] [Lexical goal InputElementRegExp]AssignmentExpression[?In, Yield]
@@ -19559,13 +19705,13 @@
ts.Debug.assert(token() === 37 /* EqualsGreaterThanToken */, "parseSimpleArrowFunctionExpression should only have been called if we had a =>");
var node;
if (asyncModifier) {
- node = createNode(197 /* ArrowFunction */, asyncModifier.pos);
+ node = createNode(198 /* ArrowFunction */, asyncModifier.pos);
node.modifiers = asyncModifier;
}
else {
- node = createNode(197 /* ArrowFunction */, identifier.pos);
+ node = createNode(198 /* ArrowFunction */, identifier.pos);
}
- var parameter = createNode(151 /* Parameter */, identifier.pos);
+ var parameter = createNode(152 /* Parameter */, identifier.pos);
parameter.name = identifier;
finishNode(parameter);
node.parameters = createNodeArray([parameter], parameter.pos, parameter.end);
@@ -19605,7 +19751,7 @@
// Unknown -> There *might* be a parenthesized arrow function here.
// Speculatively look ahead to be sure, and rollback if not.
function isParenthesizedArrowFunctionExpression() {
- if (token() === 20 /* OpenParenToken */ || token() === 28 /* LessThanToken */ || token() === 121 /* AsyncKeyword */) {
+ if (token() === 20 /* OpenParenToken */ || token() === 28 /* LessThanToken */ || token() === 122 /* AsyncKeyword */) {
return lookAhead(isParenthesizedArrowFunctionExpressionWorker);
}
if (token() === 37 /* EqualsGreaterThanToken */) {
@@ -19618,7 +19764,7 @@
return 0 /* False */;
}
function isParenthesizedArrowFunctionExpressionWorker() {
- if (token() === 121 /* AsyncKeyword */) {
+ if (token() === 122 /* AsyncKeyword */) {
nextToken();
if (scanner.hasPrecedingLineBreak()) {
return 0 /* False */;
@@ -19662,13 +19808,13 @@
// Check for "(xxx yyy", where xxx is a modifier and yyy is an identifier. This
// isn't actually allowed, but we want to treat it as a lambda so we can provide
// a good error message.
- if (ts.isModifierKind(second) && second !== 121 /* AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) {
+ if (ts.isModifierKind(second) && second !== 122 /* AsyncKeyword */ && lookAhead(nextTokenIsIdentifier)) {
return 1 /* True */;
}
// If we had "(" followed by something that's not an identifier,
// then this definitely doesn't look like a lambda. "this" is not
// valid, but we want to parse it and then give a semantic error.
- if (!isIdentifier() && second !== 100 /* ThisKeyword */) {
+ if (!isIdentifier() && second !== 101 /* ThisKeyword */) {
return 0 /* False */;
}
switch (nextToken()) {
@@ -19679,13 +19825,13 @@
case 56 /* QuestionToken */:
nextToken();
// If we have "(a?:" or "(a?," or "(a?=" or "(a?)" then it is definitely a lambda.
- if (token() === 57 /* ColonToken */ || token() === 27 /* CommaToken */ || token() === 59 /* EqualsToken */ || token() === 21 /* CloseParenToken */) {
+ if (token() === 57 /* ColonToken */ || token() === 27 /* CommaToken */ || token() === 60 /* EqualsToken */ || token() === 21 /* CloseParenToken */) {
return 1 /* True */;
}
// Otherwise it is definitely not a lambda.
return 0 /* False */;
case 27 /* CommaToken */:
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
case 21 /* CloseParenToken */:
// If we have "(a," or "(a=" or "(a)" this *could* be an arrow function
return 2 /* Unknown */;
@@ -19704,10 +19850,10 @@
if (sourceFile.languageVariant === 1 /* JSX */) {
var isArrowFunctionInJsx = lookAhead(function () {
var third = nextToken();
- if (third === 86 /* ExtendsKeyword */) {
+ if (third === 87 /* ExtendsKeyword */) {
var fourth = nextToken();
switch (fourth) {
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
case 30 /* GreaterThanToken */:
return false;
default:
@@ -19733,7 +19879,7 @@
}
function tryParseAsyncSimpleArrowFunctionExpression() {
// We do a check here so that we won't be doing unnecessarily call to "lookAhead"
- if (token() === 121 /* AsyncKeyword */) {
+ if (token() === 122 /* AsyncKeyword */) {
if (lookAhead(isUnParenthesizedAsyncArrowFunctionWorker) === 1 /* True */) {
var asyncModifier = parseModifiersForArrowFunction();
var expr = parseBinaryExpressionOrHigher(/*precedence*/ 0);
@@ -19746,7 +19892,7 @@
// AsyncArrowFunctionExpression:
// 1) async[no LineTerminator here]AsyncArrowBindingIdentifier[?Yield][no LineTerminator here]=>AsyncConciseBody[?In]
// 2) CoverCallExpressionAndAsyncArrowHead[?Yield, ?Await][no LineTerminator here]=>AsyncConciseBody[?In]
- if (token() === 121 /* AsyncKeyword */) {
+ if (token() === 122 /* AsyncKeyword */) {
nextToken();
// If the "async" is followed by "=>" token then it is not a beginning of an async arrow-function
// but instead a simple arrow-function which will be parsed inside "parseAssignmentExpressionOrHigher"
@@ -19755,14 +19901,14 @@
}
// Check for un-parenthesized AsyncArrowFunction
var expr = parseBinaryExpressionOrHigher(/*precedence*/ 0);
- if (!scanner.hasPrecedingLineBreak() && expr.kind === 72 /* Identifier */ && token() === 37 /* EqualsGreaterThanToken */) {
+ if (!scanner.hasPrecedingLineBreak() && expr.kind === 73 /* Identifier */ && token() === 37 /* EqualsGreaterThanToken */) {
return 1 /* True */;
}
}
return 0 /* False */;
}
function parseParenthesizedArrowFunctionExpressionHead(allowAmbiguity) {
- var node = createNodeWithJSDoc(197 /* ArrowFunction */);
+ var node = createNodeWithJSDoc(198 /* ArrowFunction */);
node.modifiers = parseModifiersForArrowFunction();
var isAsync = ts.hasModifier(node, 256 /* Async */) ? 2 /* Await */ : 0 /* None */;
// Arrow functions are never generators.
@@ -19781,9 +19927,11 @@
// - "(x = 10)" is an assignment expression parsed as a signature with a default parameter value.
// - "(x,y)" is a comma expression parsed as a signature with two parameters.
// - "a ? (b): c" will have "(b):" parsed as a signature with a return type annotation.
+ // - "a ? (b): function() {}" will too, since function() is a valid JSDoc function type.
//
// So we need just a bit of lookahead to ensure that it can only be a signature.
- if (!allowAmbiguity && token() !== 37 /* EqualsGreaterThanToken */ && token() !== 18 /* OpenBraceToken */) {
+ var hasJSDocFunctionType = node.type && ts.isJSDocFunctionType(node.type);
+ if (!allowAmbiguity && token() !== 37 /* EqualsGreaterThanToken */ && (hasJSDocFunctionType || token() !== 18 /* OpenBraceToken */)) {
// Returning undefined here will cause our caller to rewind to where we started from.
return undefined;
}
@@ -19794,8 +19942,8 @@
return parseFunctionBlock(isAsync ? 2 /* Await */ : 0 /* None */);
}
if (token() !== 26 /* SemicolonToken */ &&
- token() !== 90 /* FunctionKeyword */ &&
- token() !== 76 /* ClassKeyword */ &&
+ token() !== 91 /* FunctionKeyword */ &&
+ token() !== 77 /* ClassKeyword */ &&
isStartOfStatement() &&
!isStartOfExpressionStatement()) {
// Check if we got a plain statement (i.e. no expression-statements, no function/class expressions/declarations)
@@ -19826,14 +19974,14 @@
}
// Note: we explicitly 'allowIn' in the whenTrue part of the condition expression, and
// we do not that for the 'whenFalse' part.
- var node = createNode(205 /* ConditionalExpression */, leftOperand.pos);
+ var node = createNode(206 /* ConditionalExpression */, leftOperand.pos);
node.condition = leftOperand;
node.questionToken = questionToken;
node.whenTrue = doOutsideOfContext(disallowInAndDecoratorContext, parseAssignmentExpressionOrHigher);
node.colonToken = parseExpectedToken(57 /* ColonToken */);
node.whenFalse = ts.nodeIsPresent(node.colonToken)
? parseAssignmentExpressionOrHigher()
- : createMissingNode(72 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(57 /* ColonToken */));
+ : createMissingNode(73 /* Identifier */, /*reportAtCurrentPosition*/ false, ts.Diagnostics._0_expected, ts.tokenToString(57 /* ColonToken */));
return finishNode(node);
}
function parseBinaryExpressionOrHigher(precedence) {
@@ -19841,7 +19989,7 @@
return parseBinaryExpressionRest(precedence, leftOperand);
}
function isInOrOfKeyword(t) {
- return t === 93 /* InKeyword */ || t === 147 /* OfKeyword */;
+ return t === 94 /* InKeyword */ || t === 148 /* OfKeyword */;
}
function parseBinaryExpressionRest(precedence, leftOperand) {
while (true) {
@@ -19876,10 +20024,10 @@
if (!consumeCurrentOperator) {
break;
}
- if (token() === 93 /* InKeyword */ && inDisallowInContext()) {
+ if (token() === 94 /* InKeyword */ && inDisallowInContext()) {
break;
}
- if (token() === 119 /* AsKeyword */) {
+ if (token() === 120 /* AsKeyword */) {
// Make sure we *do* perform ASI for constructs like this:
// var x = foo
// as (Bar)
@@ -19900,51 +20048,51 @@
return leftOperand;
}
function isBinaryOperator() {
- if (inDisallowInContext() && token() === 93 /* InKeyword */) {
+ if (inDisallowInContext() && token() === 94 /* InKeyword */) {
return false;
}
return ts.getBinaryOperatorPrecedence(token()) > 0;
}
function makeBinaryExpression(left, operatorToken, right) {
- var node = createNode(204 /* BinaryExpression */, left.pos);
+ var node = createNode(205 /* BinaryExpression */, left.pos);
node.left = left;
node.operatorToken = operatorToken;
node.right = right;
return finishNode(node);
}
function makeAsExpression(left, right) {
- var node = createNode(212 /* AsExpression */, left.pos);
+ var node = createNode(213 /* AsExpression */, left.pos);
node.expression = left;
node.type = right;
return finishNode(node);
}
function parsePrefixUnaryExpression() {
- var node = createNode(202 /* PrefixUnaryExpression */);
+ var node = createNode(203 /* PrefixUnaryExpression */);
node.operator = token();
nextToken();
node.operand = parseSimpleUnaryExpression();
return finishNode(node);
}
function parseDeleteExpression() {
- var node = createNode(198 /* DeleteExpression */);
+ var node = createNode(199 /* DeleteExpression */);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
}
function parseTypeOfExpression() {
- var node = createNode(199 /* TypeOfExpression */);
+ var node = createNode(200 /* TypeOfExpression */);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
}
function parseVoidExpression() {
- var node = createNode(200 /* VoidExpression */);
+ var node = createNode(201 /* VoidExpression */);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
}
function isAwaitExpression() {
- if (token() === 122 /* AwaitKeyword */) {
+ if (token() === 123 /* AwaitKeyword */) {
if (inAwaitContext()) {
return true;
}
@@ -19954,7 +20102,7 @@
return false;
}
function parseAwaitExpression() {
- var node = createNode(201 /* AwaitExpression */);
+ var node = createNode(202 /* AwaitExpression */);
nextToken();
node.expression = parseSimpleUnaryExpression();
return finishNode(node);
@@ -19998,7 +20146,7 @@
if (token() === 41 /* AsteriskAsteriskToken */) {
var pos = ts.skipTrivia(sourceText, simpleUnaryExpression.pos);
var end = simpleUnaryExpression.end;
- if (simpleUnaryExpression.kind === 194 /* TypeAssertionExpression */) {
+ if (simpleUnaryExpression.kind === 195 /* TypeAssertionExpression */) {
parseErrorAt(pos, end, ts.Diagnostics.A_type_assertion_expression_is_not_allowed_in_the_left_hand_side_of_an_exponentiation_expression_Consider_enclosing_the_expression_in_parentheses);
}
else {
@@ -20028,18 +20176,18 @@
case 53 /* TildeToken */:
case 52 /* ExclamationToken */:
return parsePrefixUnaryExpression();
- case 81 /* DeleteKeyword */:
+ case 82 /* DeleteKeyword */:
return parseDeleteExpression();
- case 104 /* TypeOfKeyword */:
+ case 105 /* TypeOfKeyword */:
return parseTypeOfExpression();
- case 106 /* VoidKeyword */:
+ case 107 /* VoidKeyword */:
return parseVoidExpression();
case 28 /* LessThanToken */:
// This is modified UnaryExpression grammar in TypeScript
// UnaryExpression (modified):
// < type > UnaryExpression
return parseTypeAssertion();
- case 122 /* AwaitKeyword */:
+ case 123 /* AwaitKeyword */:
if (isAwaitExpression()) {
return parseAwaitExpression();
}
@@ -20066,10 +20214,10 @@
case 39 /* MinusToken */:
case 53 /* TildeToken */:
case 52 /* ExclamationToken */:
- case 81 /* DeleteKeyword */:
- case 104 /* TypeOfKeyword */:
- case 106 /* VoidKeyword */:
- case 122 /* AwaitKeyword */:
+ case 82 /* DeleteKeyword */:
+ case 105 /* TypeOfKeyword */:
+ case 107 /* VoidKeyword */:
+ case 123 /* AwaitKeyword */:
return false;
case 28 /* LessThanToken */:
// If we are not in JSX context, we are parsing TypeAssertion which is an UnaryExpression
@@ -20095,7 +20243,7 @@
*/
function parseUpdateExpression() {
if (token() === 44 /* PlusPlusToken */ || token() === 45 /* MinusMinusToken */) {
- var node = createNode(202 /* PrefixUnaryExpression */);
+ var node = createNode(203 /* PrefixUnaryExpression */);
node.operator = token();
nextToken();
node.operand = parseLeftHandSideExpressionOrHigher();
@@ -20108,7 +20256,7 @@
var expression = parseLeftHandSideExpressionOrHigher();
ts.Debug.assert(ts.isLeftHandSideExpression(expression));
if ((token() === 44 /* PlusPlusToken */ || token() === 45 /* MinusMinusToken */) && !scanner.hasPrecedingLineBreak()) {
- var node = createNode(203 /* PostfixUnaryExpression */, expression.pos);
+ var node = createNode(204 /* PostfixUnaryExpression */, expression.pos);
node.operand = expression;
node.operator = token();
nextToken();
@@ -20149,7 +20297,7 @@
// 3)we have a MemberExpression which either completes the LeftHandSideExpression,
// or starts the beginning of the first four CallExpression productions.
var expression;
- if (token() === 92 /* ImportKeyword */) {
+ if (token() === 93 /* ImportKeyword */) {
if (lookAhead(nextTokenIsOpenParenOrLessThan)) {
// We don't want to eagerly consume all import keyword as import call expression so we look ahead to find "("
// For example:
@@ -20164,8 +20312,8 @@
var fullStart = scanner.getStartPos();
nextToken(); // advance past the 'import'
nextToken(); // advance past the dot
- var node = createNode(214 /* MetaProperty */, fullStart);
- node.keywordToken = 92 /* ImportKeyword */;
+ var node = createNode(215 /* MetaProperty */, fullStart);
+ node.keywordToken = 93 /* ImportKeyword */;
node.name = parseIdentifierName();
expression = finishNode(node);
sourceFile.flags |= 1048576 /* PossiblyContainsImportMeta */;
@@ -20175,7 +20323,7 @@
}
}
else {
- expression = token() === 98 /* SuperKeyword */ ? parseSuperExpression() : parseMemberExpressionOrHigher();
+ expression = token() === 99 /* SuperKeyword */ ? parseSuperExpression() : parseMemberExpressionOrHigher();
}
// Now, we *may* be complete. However, we might have consumed the start of a
// CallExpression. As such, we need to consume the rest of it here to be complete.
@@ -20234,12 +20382,19 @@
}
function parseSuperExpression() {
var expression = parseTokenNode();
+ if (token() === 28 /* LessThanToken */) {
+ var startPos = getNodePos();
+ var typeArguments = tryParse(parseTypeArgumentsInExpression);
+ if (typeArguments !== undefined) {
+ parseErrorAt(startPos, getNodePos(), ts.Diagnostics.super_may_not_use_type_arguments);
+ }
+ }
if (token() === 20 /* OpenParenToken */ || token() === 24 /* DotToken */ || token() === 22 /* OpenBracketToken */) {
return expression;
}
// If we have seen "super" it must be followed by '(' or '.'.
// If it wasn't then just try to parse out a '.' and report an error.
- var node = createNode(189 /* PropertyAccessExpression */, expression.pos);
+ var node = createNode(190 /* PropertyAccessExpression */, expression.pos);
node.expression = expression;
parseExpectedToken(24 /* DotToken */, ts.Diagnostics.super_must_be_followed_by_an_argument_list_or_member_access);
node.name = parseRightSideOfDot(/*allowIdentifierNames*/ true);
@@ -20248,8 +20403,8 @@
function parseJsxElementOrSelfClosingElementOrFragment(inExpressionContext) {
var opening = parseJsxOpeningOrSelfClosingElementOrOpeningFragment(inExpressionContext);
var result;
- if (opening.kind === 262 /* JsxOpeningElement */) {
- var node = createNode(260 /* JsxElement */, opening.pos);
+ if (opening.kind === 263 /* JsxOpeningElement */) {
+ var node = createNode(261 /* JsxElement */, opening.pos);
node.openingElement = opening;
node.children = parseJsxChildren(node.openingElement);
node.closingElement = parseJsxClosingElement(inExpressionContext);
@@ -20258,15 +20413,15 @@
}
result = finishNode(node);
}
- else if (opening.kind === 265 /* JsxOpeningFragment */) {
- var node = createNode(264 /* JsxFragment */, opening.pos);
+ else if (opening.kind === 266 /* JsxOpeningFragment */) {
+ var node = createNode(265 /* JsxFragment */, opening.pos);
node.openingFragment = opening;
node.children = parseJsxChildren(node.openingFragment);
node.closingFragment = parseJsxClosingFragment(inExpressionContext);
result = finishNode(node);
}
else {
- ts.Debug.assert(opening.kind === 261 /* JsxSelfClosingElement */);
+ ts.Debug.assert(opening.kind === 262 /* JsxSelfClosingElement */);
// Nothing else to do for self-closing elements
result = opening;
}
@@ -20281,11 +20436,11 @@
var invalidElement = tryParse(function () { return parseJsxElementOrSelfClosingElementOrFragment(/*inExpressionContext*/ true); });
if (invalidElement) {
parseErrorAtCurrentToken(ts.Diagnostics.JSX_expressions_must_have_one_parent_element);
- var badNode = createNode(204 /* BinaryExpression */, result.pos);
+ var badNode = createNode(205 /* BinaryExpression */, result.pos);
badNode.end = invalidElement.end;
badNode.left = result;
badNode.right = invalidElement;
- badNode.operatorToken = createMissingNode(27 /* CommaToken */, /*reportAtCurrentPosition*/ false, /*diagnosticMessage*/ undefined); // TODO: GH#18217
+ badNode.operatorToken = createMissingNode(27 /* CommaToken */, /*reportAtCurrentPosition*/ false);
badNode.operatorToken.pos = badNode.operatorToken.end = badNode.right.pos;
return badNode;
}
@@ -20340,7 +20495,7 @@
return createNodeArray(list, listPos);
}
function parseJsxAttributes() {
- var jsxAttributes = createNode(268 /* JsxAttributes */);
+ var jsxAttributes = createNode(269 /* JsxAttributes */);
jsxAttributes.properties = parseList(13 /* JsxAttributes */, parseJsxAttribute);
return finishNode(jsxAttributes);
}
@@ -20349,7 +20504,7 @@
parseExpected(28 /* LessThanToken */);
if (token() === 30 /* GreaterThanToken */) {
// See below for explanation of scanJsxText
- var node_1 = createNode(265 /* JsxOpeningFragment */, fullStart);
+ var node_1 = createNode(266 /* JsxOpeningFragment */, fullStart);
scanJsxText();
return finishNode(node_1);
}
@@ -20361,7 +20516,7 @@
// Closing tag, so scan the immediately-following text with the JSX scanning instead
// of regular scanning to avoid treating illegal characters (e.g. '#') as immediate
// scanning errors
- node = createNode(262 /* JsxOpeningElement */, fullStart);
+ node = createNode(263 /* JsxOpeningElement */, fullStart);
scanJsxText();
}
else {
@@ -20373,7 +20528,7 @@
parseExpected(30 /* GreaterThanToken */, /*diagnostic*/ undefined, /*shouldAdvance*/ false);
scanJsxText();
}
- node = createNode(261 /* JsxSelfClosingElement */, fullStart);
+ node = createNode(262 /* JsxSelfClosingElement */, fullStart);
}
node.tagName = tagName;
node.typeArguments = typeArguments;
@@ -20387,10 +20542,10 @@
// primaryExpression in the form of an identifier and "this" keyword
// We can't just simply use parseLeftHandSideExpressionOrHigher because then we will start consider class,function etc as a keyword
// We only want to consider "this" as a primaryExpression
- var expression = token() === 100 /* ThisKeyword */ ?
+ var expression = token() === 101 /* ThisKeyword */ ?
parseTokenNode() : parseIdentifierName();
while (parseOptional(24 /* DotToken */)) {
- var propertyAccess = createNode(189 /* PropertyAccessExpression */, expression.pos);
+ var propertyAccess = createNode(190 /* PropertyAccessExpression */, expression.pos);
propertyAccess.expression = expression;
propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true);
expression = finishNode(propertyAccess);
@@ -20398,7 +20553,7 @@
return expression;
}
function parseJsxExpression(inExpressionContext) {
- var node = createNode(270 /* JsxExpression */);
+ var node = createNode(271 /* JsxExpression */);
if (!parseExpected(18 /* OpenBraceToken */)) {
return undefined;
}
@@ -20420,9 +20575,9 @@
return parseJsxSpreadAttribute();
}
scanJsxIdentifier();
- var node = createNode(267 /* JsxAttribute */);
+ var node = createNode(268 /* JsxAttribute */);
node.name = parseIdentifierName();
- if (token() === 59 /* EqualsToken */) {
+ if (token() === 60 /* EqualsToken */) {
switch (scanJsxAttributeValue()) {
case 10 /* StringLiteral */:
node.initializer = parseLiteralNode();
@@ -20435,7 +20590,7 @@
return finishNode(node);
}
function parseJsxSpreadAttribute() {
- var node = createNode(269 /* JsxSpreadAttribute */);
+ var node = createNode(270 /* JsxSpreadAttribute */);
parseExpected(18 /* OpenBraceToken */);
parseExpected(25 /* DotDotDotToken */);
node.expression = parseExpression();
@@ -20443,7 +20598,7 @@
return finishNode(node);
}
function parseJsxClosingElement(inExpressionContext) {
- var node = createNode(263 /* JsxClosingElement */);
+ var node = createNode(264 /* JsxClosingElement */);
parseExpected(29 /* LessThanSlashToken */);
node.tagName = parseJsxElementName();
if (inExpressionContext) {
@@ -20456,7 +20611,7 @@
return finishNode(node);
}
function parseJsxClosingFragment(inExpressionContext) {
- var node = createNode(266 /* JsxClosingFragment */);
+ var node = createNode(267 /* JsxClosingFragment */);
parseExpected(29 /* LessThanSlashToken */);
if (ts.tokenIsIdentifierOrKeyword(token())) {
parseErrorAtRange(parseJsxElementName(), ts.Diagnostics.Expected_corresponding_closing_tag_for_JSX_fragment);
@@ -20471,7 +20626,7 @@
return finishNode(node);
}
function parseTypeAssertion() {
- var node = createNode(194 /* TypeAssertionExpression */);
+ var node = createNode(195 /* TypeAssertionExpression */);
parseExpected(28 /* LessThanToken */);
node.type = parseType();
parseExpected(30 /* GreaterThanToken */);
@@ -20482,7 +20637,7 @@
while (true) {
var dotToken = parseOptionalToken(24 /* DotToken */);
if (dotToken) {
- var propertyAccess = createNode(189 /* PropertyAccessExpression */, expression.pos);
+ var propertyAccess = createNode(190 /* PropertyAccessExpression */, expression.pos);
propertyAccess.expression = expression;
propertyAccess.name = parseRightSideOfDot(/*allowIdentifierNames*/ true);
expression = finishNode(propertyAccess);
@@ -20490,17 +20645,17 @@
}
if (token() === 52 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) {
nextToken();
- var nonNullExpression = createNode(213 /* NonNullExpression */, expression.pos);
+ var nonNullExpression = createNode(214 /* NonNullExpression */, expression.pos);
nonNullExpression.expression = expression;
expression = finishNode(nonNullExpression);
continue;
}
// when in the [Decorator] context, we do not parse ElementAccess as it could be part of a ComputedPropertyName
if (!inDecoratorContext() && parseOptional(22 /* OpenBracketToken */)) {
- var indexedAccess = createNode(190 /* ElementAccessExpression */, expression.pos);
+ var indexedAccess = createNode(191 /* ElementAccessExpression */, expression.pos);
indexedAccess.expression = expression;
if (token() === 23 /* CloseBracketToken */) {
- indexedAccess.argumentExpression = createMissingNode(72 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.An_element_access_expression_should_take_an_argument);
+ indexedAccess.argumentExpression = createMissingNode(73 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.An_element_access_expression_should_take_an_argument);
}
else {
var argument = allowInAnd(parseExpression);
@@ -20524,7 +20679,7 @@
return token() === 14 /* NoSubstitutionTemplateLiteral */ || token() === 15 /* TemplateHead */;
}
function parseTaggedTemplateRest(tag, typeArguments) {
- var tagExpression = createNode(193 /* TaggedTemplateExpression */, tag.pos);
+ var tagExpression = createNode(194 /* TaggedTemplateExpression */, tag.pos);
tagExpression.tag = tag;
tagExpression.typeArguments = typeArguments;
tagExpression.template = token() === 14 /* NoSubstitutionTemplateLiteral */
@@ -20549,7 +20704,7 @@
expression = parseTaggedTemplateRest(expression, typeArguments);
continue;
}
- var callExpr = createNode(191 /* CallExpression */, expression.pos);
+ var callExpr = createNode(192 /* CallExpression */, expression.pos);
callExpr.expression = expression;
callExpr.typeArguments = typeArguments;
callExpr.arguments = parseArgumentList();
@@ -20557,7 +20712,7 @@
continue;
}
else if (token() === 20 /* OpenParenToken */) {
- var callExpr = createNode(191 /* CallExpression */, expression.pos);
+ var callExpr = createNode(192 /* CallExpression */, expression.pos);
callExpr.expression = expression;
callExpr.arguments = parseArgumentList();
expression = finishNode(callExpr);
@@ -20633,11 +20788,11 @@
case 10 /* StringLiteral */:
case 14 /* NoSubstitutionTemplateLiteral */:
return parseLiteralNode();
- case 100 /* ThisKeyword */:
- case 98 /* SuperKeyword */:
- case 96 /* NullKeyword */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
+ case 101 /* ThisKeyword */:
+ case 99 /* SuperKeyword */:
+ case 97 /* NullKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
return parseTokenNode();
case 20 /* OpenParenToken */:
return parseParenthesizedExpression();
@@ -20645,7 +20800,7 @@
return parseArrayLiteralExpression();
case 18 /* OpenBraceToken */:
return parseObjectLiteralExpression();
- case 121 /* AsyncKeyword */:
+ case 122 /* AsyncKeyword */:
// Async arrow functions are parsed earlier in parseAssignmentExpressionOrHigher.
// If we encounter `async [no LineTerminator here] function` then this is an async
// function; otherwise, its an identifier.
@@ -20653,14 +20808,14 @@
break;
}
return parseFunctionExpression();
- case 76 /* ClassKeyword */:
+ case 77 /* ClassKeyword */:
return parseClassExpression();
- case 90 /* FunctionKeyword */:
+ case 91 /* FunctionKeyword */:
return parseFunctionExpression();
- case 95 /* NewKeyword */:
+ case 96 /* NewKeyword */:
return parseNewExpressionOrNewDotTarget();
case 42 /* SlashToken */:
- case 64 /* SlashEqualsToken */:
+ case 65 /* SlashEqualsToken */:
if (reScanSlashToken() === 13 /* RegularExpressionLiteral */) {
return parseLiteralNode();
}
@@ -20671,28 +20826,28 @@
return parseIdentifier(ts.Diagnostics.Expression_expected);
}
function parseParenthesizedExpression() {
- var node = createNodeWithJSDoc(195 /* ParenthesizedExpression */);
+ var node = createNodeWithJSDoc(196 /* ParenthesizedExpression */);
parseExpected(20 /* OpenParenToken */);
node.expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
return finishNode(node);
}
function parseSpreadElement() {
- var node = createNode(208 /* SpreadElement */);
+ var node = createNode(209 /* SpreadElement */);
parseExpected(25 /* DotDotDotToken */);
node.expression = parseAssignmentExpressionOrHigher();
return finishNode(node);
}
function parseArgumentOrArrayLiteralElement() {
return token() === 25 /* DotDotDotToken */ ? parseSpreadElement() :
- token() === 27 /* CommaToken */ ? createNode(210 /* OmittedExpression */) :
+ token() === 27 /* CommaToken */ ? createNode(211 /* OmittedExpression */) :
parseAssignmentExpressionOrHigher();
}
function parseArgumentExpression() {
return doOutsideOfContext(disallowInAndDecoratorContext, parseArgumentOrArrayLiteralElement);
}
function parseArrayLiteralExpression() {
- var node = createNode(187 /* ArrayLiteralExpression */);
+ var node = createNode(188 /* ArrayLiteralExpression */);
parseExpected(22 /* OpenBracketToken */);
if (scanner.hasPrecedingLineBreak()) {
node.multiLine = true;
@@ -20704,17 +20859,17 @@
function parseObjectLiteralElement() {
var node = createNodeWithJSDoc(0 /* Unknown */);
if (parseOptionalToken(25 /* DotDotDotToken */)) {
- node.kind = 277 /* SpreadAssignment */;
+ node.kind = 278 /* SpreadAssignment */;
node.expression = parseAssignmentExpressionOrHigher();
return finishNode(node);
}
node.decorators = parseDecorators();
node.modifiers = parseModifiers();
- if (parseContextualModifier(126 /* GetKeyword */)) {
- return parseAccessorDeclaration(node, 158 /* GetAccessor */);
+ if (parseContextualModifier(127 /* GetKeyword */)) {
+ return parseAccessorDeclaration(node, 159 /* GetAccessor */);
}
- if (parseContextualModifier(137 /* SetKeyword */)) {
- return parseAccessorDeclaration(node, 159 /* SetAccessor */);
+ if (parseContextualModifier(138 /* SetKeyword */)) {
+ return parseAccessorDeclaration(node, 160 /* SetAccessor */);
}
var asteriskToken = parseOptionalToken(40 /* AsteriskToken */);
var tokenIsIdentifier = isIdentifier();
@@ -20732,22 +20887,22 @@
// this is necessary because ObjectLiteral productions are also used to cover grammar for ObjectAssignmentPattern
var isShorthandPropertyAssignment = tokenIsIdentifier && (token() !== 57 /* ColonToken */);
if (isShorthandPropertyAssignment) {
- node.kind = 276 /* ShorthandPropertyAssignment */;
- var equalsToken = parseOptionalToken(59 /* EqualsToken */);
+ node.kind = 277 /* ShorthandPropertyAssignment */;
+ var equalsToken = parseOptionalToken(60 /* EqualsToken */);
if (equalsToken) {
node.equalsToken = equalsToken;
node.objectAssignmentInitializer = allowInAnd(parseAssignmentExpressionOrHigher);
}
}
else {
- node.kind = 275 /* PropertyAssignment */;
+ node.kind = 276 /* PropertyAssignment */;
parseExpected(57 /* ColonToken */);
node.initializer = allowInAnd(parseAssignmentExpressionOrHigher);
}
return finishNode(node);
}
function parseObjectLiteralExpression() {
- var node = createNode(188 /* ObjectLiteralExpression */);
+ var node = createNode(189 /* ObjectLiteralExpression */);
parseExpected(18 /* OpenBraceToken */);
if (scanner.hasPrecedingLineBreak()) {
node.multiLine = true;
@@ -20766,9 +20921,9 @@
if (saveDecoratorContext) {
setDecoratorContext(/*val*/ false);
}
- var node = createNodeWithJSDoc(196 /* FunctionExpression */);
+ var node = createNodeWithJSDoc(197 /* FunctionExpression */);
node.modifiers = parseModifiers();
- parseExpected(90 /* FunctionKeyword */);
+ parseExpected(91 /* FunctionKeyword */);
node.asteriskToken = parseOptionalToken(40 /* AsteriskToken */);
var isGenerator = node.asteriskToken ? 1 /* Yield */ : 0 /* None */;
var isAsync = ts.hasModifier(node, 256 /* Async */) ? 2 /* Await */ : 0 /* None */;
@@ -20789,10 +20944,10 @@
}
function parseNewExpressionOrNewDotTarget() {
var fullStart = scanner.getStartPos();
- parseExpected(95 /* NewKeyword */);
+ parseExpected(96 /* NewKeyword */);
if (parseOptional(24 /* DotToken */)) {
- var node_2 = createNode(214 /* MetaProperty */, fullStart);
- node_2.keywordToken = 95 /* NewKeyword */;
+ var node_2 = createNode(215 /* MetaProperty */, fullStart);
+ node_2.keywordToken = 96 /* NewKeyword */;
node_2.name = parseIdentifierName();
return finishNode(node_2);
}
@@ -20808,7 +20963,7 @@
}
break;
}
- var node = createNode(192 /* NewExpression */, fullStart);
+ var node = createNode(193 /* NewExpression */, fullStart);
node.expression = expression;
node.typeArguments = typeArguments;
if (node.typeArguments || token() === 20 /* OpenParenToken */) {
@@ -20818,7 +20973,7 @@
}
// STATEMENTS
function parseBlock(ignoreMissingOpenBrace, diagnosticMessage) {
- var node = createNode(218 /* Block */);
+ var node = createNode(219 /* Block */);
if (parseExpected(18 /* OpenBraceToken */, diagnosticMessage) || ignoreMissingOpenBrace) {
if (scanner.hasPrecedingLineBreak()) {
node.multiLine = true;
@@ -20851,25 +21006,25 @@
return block;
}
function parseEmptyStatement() {
- var node = createNode(220 /* EmptyStatement */);
+ var node = createNode(221 /* EmptyStatement */);
parseExpected(26 /* SemicolonToken */);
return finishNode(node);
}
function parseIfStatement() {
- var node = createNode(222 /* IfStatement */);
- parseExpected(91 /* IfKeyword */);
+ var node = createNode(223 /* IfStatement */);
+ parseExpected(92 /* IfKeyword */);
parseExpected(20 /* OpenParenToken */);
node.expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
node.thenStatement = parseStatement();
- node.elseStatement = parseOptional(83 /* ElseKeyword */) ? parseStatement() : undefined;
+ node.elseStatement = parseOptional(84 /* ElseKeyword */) ? parseStatement() : undefined;
return finishNode(node);
}
function parseDoStatement() {
- var node = createNode(223 /* DoStatement */);
- parseExpected(82 /* DoKeyword */);
+ var node = createNode(224 /* DoStatement */);
+ parseExpected(83 /* DoKeyword */);
node.statement = parseStatement();
- parseExpected(107 /* WhileKeyword */);
+ parseExpected(108 /* WhileKeyword */);
parseExpected(20 /* OpenParenToken */);
node.expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
@@ -20881,8 +21036,8 @@
return finishNode(node);
}
function parseWhileStatement() {
- var node = createNode(224 /* WhileStatement */);
- parseExpected(107 /* WhileKeyword */);
+ var node = createNode(225 /* WhileStatement */);
+ parseExpected(108 /* WhileKeyword */);
parseExpected(20 /* OpenParenToken */);
node.expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
@@ -20891,12 +21046,12 @@
}
function parseForOrForInOrForOfStatement() {
var pos = getNodePos();
- parseExpected(89 /* ForKeyword */);
- var awaitToken = parseOptionalToken(122 /* AwaitKeyword */);
+ parseExpected(90 /* ForKeyword */);
+ var awaitToken = parseOptionalToken(123 /* AwaitKeyword */);
parseExpected(20 /* OpenParenToken */);
var initializer;
if (token() !== 26 /* SemicolonToken */) {
- if (token() === 105 /* VarKeyword */ || token() === 111 /* LetKeyword */ || token() === 77 /* ConstKeyword */) {
+ if (token() === 106 /* VarKeyword */ || token() === 112 /* LetKeyword */ || token() === 78 /* ConstKeyword */) {
initializer = parseVariableDeclarationList(/*inForStatementInitializer*/ true);
}
else {
@@ -20904,23 +21059,23 @@
}
}
var forOrForInOrForOfStatement;
- if (awaitToken ? parseExpected(147 /* OfKeyword */) : parseOptional(147 /* OfKeyword */)) {
- var forOfStatement = createNode(227 /* ForOfStatement */, pos);
+ if (awaitToken ? parseExpected(148 /* OfKeyword */) : parseOptional(148 /* OfKeyword */)) {
+ var forOfStatement = createNode(228 /* ForOfStatement */, pos);
forOfStatement.awaitModifier = awaitToken;
forOfStatement.initializer = initializer;
forOfStatement.expression = allowInAnd(parseAssignmentExpressionOrHigher);
parseExpected(21 /* CloseParenToken */);
forOrForInOrForOfStatement = forOfStatement;
}
- else if (parseOptional(93 /* InKeyword */)) {
- var forInStatement = createNode(226 /* ForInStatement */, pos);
+ else if (parseOptional(94 /* InKeyword */)) {
+ var forInStatement = createNode(227 /* ForInStatement */, pos);
forInStatement.initializer = initializer;
forInStatement.expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
forOrForInOrForOfStatement = forInStatement;
}
else {
- var forStatement = createNode(225 /* ForStatement */, pos);
+ var forStatement = createNode(226 /* ForStatement */, pos);
forStatement.initializer = initializer;
parseExpected(26 /* SemicolonToken */);
if (token() !== 26 /* SemicolonToken */ && token() !== 21 /* CloseParenToken */) {
@@ -20938,7 +21093,7 @@
}
function parseBreakOrContinueStatement(kind) {
var node = createNode(kind);
- parseExpected(kind === 229 /* BreakStatement */ ? 73 /* BreakKeyword */ : 78 /* ContinueKeyword */);
+ parseExpected(kind === 230 /* BreakStatement */ ? 74 /* BreakKeyword */ : 79 /* ContinueKeyword */);
if (!canParseSemicolon()) {
node.label = parseIdentifier();
}
@@ -20946,8 +21101,8 @@
return finishNode(node);
}
function parseReturnStatement() {
- var node = createNode(230 /* ReturnStatement */);
- parseExpected(97 /* ReturnKeyword */);
+ var node = createNode(231 /* ReturnStatement */);
+ parseExpected(98 /* ReturnKeyword */);
if (!canParseSemicolon()) {
node.expression = allowInAnd(parseExpression);
}
@@ -20955,8 +21110,8 @@
return finishNode(node);
}
function parseWithStatement() {
- var node = createNode(231 /* WithStatement */);
- parseExpected(108 /* WithKeyword */);
+ var node = createNode(232 /* WithStatement */);
+ parseExpected(109 /* WithKeyword */);
parseExpected(20 /* OpenParenToken */);
node.expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
@@ -20964,30 +21119,30 @@
return finishNode(node);
}
function parseCaseClause() {
- var node = createNode(271 /* CaseClause */);
- parseExpected(74 /* CaseKeyword */);
+ var node = createNode(272 /* CaseClause */);
+ parseExpected(75 /* CaseKeyword */);
node.expression = allowInAnd(parseExpression);
parseExpected(57 /* ColonToken */);
node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement);
return finishNode(node);
}
function parseDefaultClause() {
- var node = createNode(272 /* DefaultClause */);
- parseExpected(80 /* DefaultKeyword */);
+ var node = createNode(273 /* DefaultClause */);
+ parseExpected(81 /* DefaultKeyword */);
parseExpected(57 /* ColonToken */);
node.statements = parseList(3 /* SwitchClauseStatements */, parseStatement);
return finishNode(node);
}
function parseCaseOrDefaultClause() {
- return token() === 74 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause();
+ return token() === 75 /* CaseKeyword */ ? parseCaseClause() : parseDefaultClause();
}
function parseSwitchStatement() {
- var node = createNode(232 /* SwitchStatement */);
- parseExpected(99 /* SwitchKeyword */);
+ var node = createNode(233 /* SwitchStatement */);
+ parseExpected(100 /* SwitchKeyword */);
parseExpected(20 /* OpenParenToken */);
node.expression = allowInAnd(parseExpression);
parseExpected(21 /* CloseParenToken */);
- var caseBlock = createNode(246 /* CaseBlock */);
+ var caseBlock = createNode(247 /* CaseBlock */);
parseExpected(18 /* OpenBraceToken */);
caseBlock.clauses = parseList(2 /* SwitchClauses */, parseCaseOrDefaultClause);
parseExpected(19 /* CloseBraceToken */);
@@ -21002,29 +21157,29 @@
// directly as that might consume an expression on the following line.
// We just return 'undefined' in that case. The actual error will be reported in the
// grammar walker.
- var node = createNode(234 /* ThrowStatement */);
- parseExpected(101 /* ThrowKeyword */);
+ var node = createNode(235 /* ThrowStatement */);
+ parseExpected(102 /* ThrowKeyword */);
node.expression = scanner.hasPrecedingLineBreak() ? undefined : allowInAnd(parseExpression);
parseSemicolon();
return finishNode(node);
}
// TODO: Review for error recovery
function parseTryStatement() {
- var node = createNode(235 /* TryStatement */);
- parseExpected(103 /* TryKeyword */);
+ var node = createNode(236 /* TryStatement */);
+ parseExpected(104 /* TryKeyword */);
node.tryBlock = parseBlock(/*ignoreMissingOpenBrace*/ false);
- node.catchClause = token() === 75 /* CatchKeyword */ ? parseCatchClause() : undefined;
+ node.catchClause = token() === 76 /* CatchKeyword */ ? parseCatchClause() : undefined;
// If we don't have a catch clause, then we must have a finally clause. Try to parse
// one out no matter what.
- if (!node.catchClause || token() === 88 /* FinallyKeyword */) {
- parseExpected(88 /* FinallyKeyword */);
+ if (!node.catchClause || token() === 89 /* FinallyKeyword */) {
+ parseExpected(89 /* FinallyKeyword */);
node.finallyBlock = parseBlock(/*ignoreMissingOpenBrace*/ false);
}
return finishNode(node);
}
function parseCatchClause() {
- var result = createNode(274 /* CatchClause */);
- parseExpected(75 /* CatchKeyword */);
+ var result = createNode(275 /* CatchClause */);
+ parseExpected(76 /* CatchKeyword */);
if (parseOptional(20 /* OpenParenToken */)) {
result.variableDeclaration = parseVariableDeclaration();
parseExpected(21 /* CloseParenToken */);
@@ -21037,8 +21192,8 @@
return finishNode(result);
}
function parseDebuggerStatement() {
- var node = createNode(236 /* DebuggerStatement */);
- parseExpected(79 /* DebuggerKeyword */);
+ var node = createNode(237 /* DebuggerStatement */);
+ parseExpected(80 /* DebuggerKeyword */);
parseSemicolon();
return finishNode(node);
}
@@ -21048,13 +21203,13 @@
// a colon.
var node = createNodeWithJSDoc(0 /* Unknown */);
var expression = allowInAnd(parseExpression);
- if (expression.kind === 72 /* Identifier */ && parseOptional(57 /* ColonToken */)) {
- node.kind = 233 /* LabeledStatement */;
+ if (expression.kind === 73 /* Identifier */ && parseOptional(57 /* ColonToken */)) {
+ node.kind = 234 /* LabeledStatement */;
node.label = expression;
node.statement = parseStatement();
}
else {
- node.kind = 221 /* ExpressionStatement */;
+ node.kind = 222 /* ExpressionStatement */;
node.expression = expression;
parseSemicolon();
}
@@ -21066,11 +21221,11 @@
}
function nextTokenIsClassKeywordOnSameLine() {
nextToken();
- return token() === 76 /* ClassKeyword */ && !scanner.hasPrecedingLineBreak();
+ return token() === 77 /* ClassKeyword */ && !scanner.hasPrecedingLineBreak();
}
function nextTokenIsFunctionKeywordOnSameLine() {
nextToken();
- return token() === 90 /* FunctionKeyword */ && !scanner.hasPrecedingLineBreak();
+ return token() === 91 /* FunctionKeyword */ && !scanner.hasPrecedingLineBreak();
}
function nextTokenIsIdentifierOrKeywordOrLiteralOnSameLine() {
nextToken();
@@ -21079,12 +21234,12 @@
function isDeclaration() {
while (true) {
switch (token()) {
- case 105 /* VarKeyword */:
- case 111 /* LetKeyword */:
- case 77 /* ConstKeyword */:
- case 90 /* FunctionKeyword */:
- case 76 /* ClassKeyword */:
- case 84 /* EnumKeyword */:
+ case 106 /* VarKeyword */:
+ case 112 /* LetKeyword */:
+ case 78 /* ConstKeyword */:
+ case 91 /* FunctionKeyword */:
+ case 77 /* ClassKeyword */:
+ case 85 /* EnumKeyword */:
return true;
// 'declare', 'module', 'namespace', 'interface'* and 'type' are all legal JavaScript identifiers;
// however, an identifier cannot be followed by another identifier on the same line. This is what we
@@ -21107,41 +21262,41 @@
// I {}
//
// could be legal, it would add complexity for very little gain.
- case 110 /* InterfaceKeyword */:
- case 140 /* TypeKeyword */:
+ case 111 /* InterfaceKeyword */:
+ case 141 /* TypeKeyword */:
return nextTokenIsIdentifierOnSameLine();
- case 130 /* ModuleKeyword */:
- case 131 /* NamespaceKeyword */:
+ case 131 /* ModuleKeyword */:
+ case 132 /* NamespaceKeyword */:
return nextTokenIsIdentifierOrStringLiteralOnSameLine();
- case 118 /* AbstractKeyword */:
- case 121 /* AsyncKeyword */:
- case 125 /* DeclareKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 115 /* PublicKeyword */:
- case 133 /* ReadonlyKeyword */:
+ case 119 /* AbstractKeyword */:
+ case 122 /* AsyncKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 116 /* PublicKeyword */:
+ case 134 /* ReadonlyKeyword */:
nextToken();
// ASI takes effect for this modifier.
if (scanner.hasPrecedingLineBreak()) {
return false;
}
continue;
- case 145 /* GlobalKeyword */:
+ case 146 /* GlobalKeyword */:
nextToken();
- return token() === 18 /* OpenBraceToken */ || token() === 72 /* Identifier */ || token() === 85 /* ExportKeyword */;
- case 92 /* ImportKeyword */:
+ return token() === 18 /* OpenBraceToken */ || token() === 73 /* Identifier */ || token() === 86 /* ExportKeyword */;
+ case 93 /* ImportKeyword */:
nextToken();
return token() === 10 /* StringLiteral */ || token() === 40 /* AsteriskToken */ ||
token() === 18 /* OpenBraceToken */ || ts.tokenIsIdentifierOrKeyword(token());
- case 85 /* ExportKeyword */:
+ case 86 /* ExportKeyword */:
nextToken();
- if (token() === 59 /* EqualsToken */ || token() === 40 /* AsteriskToken */ ||
- token() === 18 /* OpenBraceToken */ || token() === 80 /* DefaultKeyword */ ||
- token() === 119 /* AsKeyword */) {
+ if (token() === 60 /* EqualsToken */ || token() === 40 /* AsteriskToken */ ||
+ token() === 18 /* OpenBraceToken */ || token() === 81 /* DefaultKeyword */ ||
+ token() === 120 /* AsKeyword */) {
return true;
}
continue;
- case 116 /* StaticKeyword */:
+ case 117 /* StaticKeyword */:
nextToken();
continue;
default:
@@ -21157,47 +21312,47 @@
case 58 /* AtToken */:
case 26 /* SemicolonToken */:
case 18 /* OpenBraceToken */:
- case 105 /* VarKeyword */:
- case 111 /* LetKeyword */:
- case 90 /* FunctionKeyword */:
- case 76 /* ClassKeyword */:
- case 84 /* EnumKeyword */:
- case 91 /* IfKeyword */:
- case 82 /* DoKeyword */:
- case 107 /* WhileKeyword */:
- case 89 /* ForKeyword */:
- case 78 /* ContinueKeyword */:
- case 73 /* BreakKeyword */:
- case 97 /* ReturnKeyword */:
- case 108 /* WithKeyword */:
- case 99 /* SwitchKeyword */:
- case 101 /* ThrowKeyword */:
- case 103 /* TryKeyword */:
- case 79 /* DebuggerKeyword */:
+ case 106 /* VarKeyword */:
+ case 112 /* LetKeyword */:
+ case 91 /* FunctionKeyword */:
+ case 77 /* ClassKeyword */:
+ case 85 /* EnumKeyword */:
+ case 92 /* IfKeyword */:
+ case 83 /* DoKeyword */:
+ case 108 /* WhileKeyword */:
+ case 90 /* ForKeyword */:
+ case 79 /* ContinueKeyword */:
+ case 74 /* BreakKeyword */:
+ case 98 /* ReturnKeyword */:
+ case 109 /* WithKeyword */:
+ case 100 /* SwitchKeyword */:
+ case 102 /* ThrowKeyword */:
+ case 104 /* TryKeyword */:
+ case 80 /* DebuggerKeyword */:
// 'catch' and 'finally' do not actually indicate that the code is part of a statement,
// however, we say they are here so that we may gracefully parse them and error later.
- case 75 /* CatchKeyword */:
- case 88 /* FinallyKeyword */:
+ case 76 /* CatchKeyword */:
+ case 89 /* FinallyKeyword */:
return true;
- case 92 /* ImportKeyword */:
+ case 93 /* ImportKeyword */:
return isStartOfDeclaration() || lookAhead(nextTokenIsOpenParenOrLessThanOrDot);
- case 77 /* ConstKeyword */:
- case 85 /* ExportKeyword */:
+ case 78 /* ConstKeyword */:
+ case 86 /* ExportKeyword */:
return isStartOfDeclaration();
- case 121 /* AsyncKeyword */:
- case 125 /* DeclareKeyword */:
- case 110 /* InterfaceKeyword */:
- case 130 /* ModuleKeyword */:
- case 131 /* NamespaceKeyword */:
- case 140 /* TypeKeyword */:
- case 145 /* GlobalKeyword */:
+ case 122 /* AsyncKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 111 /* InterfaceKeyword */:
+ case 131 /* ModuleKeyword */:
+ case 132 /* NamespaceKeyword */:
+ case 141 /* TypeKeyword */:
+ case 146 /* GlobalKeyword */:
// When these don't start a declaration, they're an identifier in an expression statement
return true;
- case 115 /* PublicKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 116 /* StaticKeyword */:
- case 133 /* ReadonlyKeyword */:
+ case 116 /* PublicKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 117 /* StaticKeyword */:
+ case 134 /* ReadonlyKeyword */:
// When these don't start a declaration, they may be the start of a class member if an identifier
// immediately follows. Otherwise they're an identifier in an expression statement.
return isStartOfDeclaration() || !lookAhead(nextTokenIsIdentifierOrKeywordOnSameLine);
@@ -21220,63 +21375,63 @@
return parseEmptyStatement();
case 18 /* OpenBraceToken */:
return parseBlock(/*ignoreMissingOpenBrace*/ false);
- case 105 /* VarKeyword */:
- return parseVariableStatement(createNodeWithJSDoc(237 /* VariableDeclaration */));
- case 111 /* LetKeyword */:
+ case 106 /* VarKeyword */:
+ return parseVariableStatement(createNodeWithJSDoc(238 /* VariableDeclaration */));
+ case 112 /* LetKeyword */:
if (isLetDeclaration()) {
- return parseVariableStatement(createNodeWithJSDoc(237 /* VariableDeclaration */));
+ return parseVariableStatement(createNodeWithJSDoc(238 /* VariableDeclaration */));
}
break;
- case 90 /* FunctionKeyword */:
- return parseFunctionDeclaration(createNodeWithJSDoc(239 /* FunctionDeclaration */));
- case 76 /* ClassKeyword */:
- return parseClassDeclaration(createNodeWithJSDoc(240 /* ClassDeclaration */));
- case 91 /* IfKeyword */:
+ case 91 /* FunctionKeyword */:
+ return parseFunctionDeclaration(createNodeWithJSDoc(240 /* FunctionDeclaration */));
+ case 77 /* ClassKeyword */:
+ return parseClassDeclaration(createNodeWithJSDoc(241 /* ClassDeclaration */));
+ case 92 /* IfKeyword */:
return parseIfStatement();
- case 82 /* DoKeyword */:
+ case 83 /* DoKeyword */:
return parseDoStatement();
- case 107 /* WhileKeyword */:
+ case 108 /* WhileKeyword */:
return parseWhileStatement();
- case 89 /* ForKeyword */:
+ case 90 /* ForKeyword */:
return parseForOrForInOrForOfStatement();
- case 78 /* ContinueKeyword */:
- return parseBreakOrContinueStatement(228 /* ContinueStatement */);
- case 73 /* BreakKeyword */:
- return parseBreakOrContinueStatement(229 /* BreakStatement */);
- case 97 /* ReturnKeyword */:
+ case 79 /* ContinueKeyword */:
+ return parseBreakOrContinueStatement(229 /* ContinueStatement */);
+ case 74 /* BreakKeyword */:
+ return parseBreakOrContinueStatement(230 /* BreakStatement */);
+ case 98 /* ReturnKeyword */:
return parseReturnStatement();
- case 108 /* WithKeyword */:
+ case 109 /* WithKeyword */:
return parseWithStatement();
- case 99 /* SwitchKeyword */:
+ case 100 /* SwitchKeyword */:
return parseSwitchStatement();
- case 101 /* ThrowKeyword */:
+ case 102 /* ThrowKeyword */:
return parseThrowStatement();
- case 103 /* TryKeyword */:
+ case 104 /* TryKeyword */:
// Include 'catch' and 'finally' for error recovery.
- case 75 /* CatchKeyword */:
- case 88 /* FinallyKeyword */:
+ case 76 /* CatchKeyword */:
+ case 89 /* FinallyKeyword */:
return parseTryStatement();
- case 79 /* DebuggerKeyword */:
+ case 80 /* DebuggerKeyword */:
return parseDebuggerStatement();
case 58 /* AtToken */:
return parseDeclaration();
- case 121 /* AsyncKeyword */:
- case 110 /* InterfaceKeyword */:
- case 140 /* TypeKeyword */:
- case 130 /* ModuleKeyword */:
- case 131 /* NamespaceKeyword */:
- case 125 /* DeclareKeyword */:
- case 77 /* ConstKeyword */:
- case 84 /* EnumKeyword */:
- case 85 /* ExportKeyword */:
- case 92 /* ImportKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 115 /* PublicKeyword */:
- case 118 /* AbstractKeyword */:
- case 116 /* StaticKeyword */:
- case 133 /* ReadonlyKeyword */:
- case 145 /* GlobalKeyword */:
+ case 122 /* AsyncKeyword */:
+ case 111 /* InterfaceKeyword */:
+ case 141 /* TypeKeyword */:
+ case 131 /* ModuleKeyword */:
+ case 132 /* NamespaceKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 78 /* ConstKeyword */:
+ case 85 /* EnumKeyword */:
+ case 86 /* ExportKeyword */:
+ case 93 /* ImportKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 116 /* PublicKeyword */:
+ case 119 /* AbstractKeyword */:
+ case 117 /* StaticKeyword */:
+ case 134 /* ReadonlyKeyword */:
+ case 146 /* GlobalKeyword */:
if (isStartOfDeclaration()) {
return parseDeclaration();
}
@@ -21285,7 +21440,7 @@
return parseExpressionOrLabeledStatement();
}
function isDeclareModifier(modifier) {
- return modifier.kind === 125 /* DeclareKeyword */;
+ return modifier.kind === 126 /* DeclareKeyword */;
}
function parseDeclaration() {
var node = createNodeWithJSDoc(0 /* Unknown */);
@@ -21304,33 +21459,33 @@
}
function parseDeclarationWorker(node) {
switch (token()) {
- case 105 /* VarKeyword */:
- case 111 /* LetKeyword */:
- case 77 /* ConstKeyword */:
+ case 106 /* VarKeyword */:
+ case 112 /* LetKeyword */:
+ case 78 /* ConstKeyword */:
return parseVariableStatement(node);
- case 90 /* FunctionKeyword */:
+ case 91 /* FunctionKeyword */:
return parseFunctionDeclaration(node);
- case 76 /* ClassKeyword */:
+ case 77 /* ClassKeyword */:
return parseClassDeclaration(node);
- case 110 /* InterfaceKeyword */:
+ case 111 /* InterfaceKeyword */:
return parseInterfaceDeclaration(node);
- case 140 /* TypeKeyword */:
+ case 141 /* TypeKeyword */:
return parseTypeAliasDeclaration(node);
- case 84 /* EnumKeyword */:
+ case 85 /* EnumKeyword */:
return parseEnumDeclaration(node);
- case 145 /* GlobalKeyword */:
- case 130 /* ModuleKeyword */:
- case 131 /* NamespaceKeyword */:
+ case 146 /* GlobalKeyword */:
+ case 131 /* ModuleKeyword */:
+ case 132 /* NamespaceKeyword */:
return parseModuleDeclaration(node);
- case 92 /* ImportKeyword */:
+ case 93 /* ImportKeyword */:
return parseImportDeclarationOrImportEqualsDeclaration(node);
- case 85 /* ExportKeyword */:
+ case 86 /* ExportKeyword */:
nextToken();
switch (token()) {
- case 80 /* DefaultKeyword */:
- case 59 /* EqualsToken */:
+ case 81 /* DefaultKeyword */:
+ case 60 /* EqualsToken */:
return parseExportAssignment(node);
- case 119 /* AsKeyword */:
+ case 120 /* AsKeyword */:
return parseNamespaceExportDeclaration(node);
default:
return parseExportDeclaration(node);
@@ -21339,7 +21494,7 @@
if (node.decorators || node.modifiers) {
// We reached this point because we encountered decorators and/or modifiers and assumed a declaration
// would follow. For recovery and error reporting purposes, return an incomplete declaration.
- var missing = createMissingNode(258 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected);
+ var missing = createMissingNode(259 /* MissingDeclaration */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected);
missing.pos = node.pos;
missing.decorators = node.decorators;
missing.modifiers = node.modifiers;
@@ -21362,16 +21517,16 @@
// DECLARATIONS
function parseArrayBindingElement() {
if (token() === 27 /* CommaToken */) {
- return createNode(210 /* OmittedExpression */);
+ return createNode(211 /* OmittedExpression */);
}
- var node = createNode(186 /* BindingElement */);
+ var node = createNode(187 /* BindingElement */);
node.dotDotDotToken = parseOptionalToken(25 /* DotDotDotToken */);
node.name = parseIdentifierOrPattern();
node.initializer = parseInitializer();
return finishNode(node);
}
function parseObjectBindingElement() {
- var node = createNode(186 /* BindingElement */);
+ var node = createNode(187 /* BindingElement */);
node.dotDotDotToken = parseOptionalToken(25 /* DotDotDotToken */);
var tokenIsIdentifier = isIdentifier();
var propertyName = parsePropertyName();
@@ -21387,14 +21542,14 @@
return finishNode(node);
}
function parseObjectBindingPattern() {
- var node = createNode(184 /* ObjectBindingPattern */);
+ var node = createNode(185 /* ObjectBindingPattern */);
parseExpected(18 /* OpenBraceToken */);
node.elements = parseDelimitedList(9 /* ObjectBindingElements */, parseObjectBindingElement);
parseExpected(19 /* CloseBraceToken */);
return finishNode(node);
}
function parseArrayBindingPattern() {
- var node = createNode(185 /* ArrayBindingPattern */);
+ var node = createNode(186 /* ArrayBindingPattern */);
parseExpected(22 /* OpenBracketToken */);
node.elements = parseDelimitedList(10 /* ArrayBindingElements */, parseArrayBindingElement);
parseExpected(23 /* CloseBracketToken */);
@@ -21416,9 +21571,9 @@
return parseVariableDeclaration(/*allowExclamation*/ true);
}
function parseVariableDeclaration(allowExclamation) {
- var node = createNode(237 /* VariableDeclaration */);
+ var node = createNode(238 /* VariableDeclaration */);
node.name = parseIdentifierOrPattern();
- if (allowExclamation && node.name.kind === 72 /* Identifier */ &&
+ if (allowExclamation && node.name.kind === 73 /* Identifier */ &&
token() === 52 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) {
node.exclamationToken = parseTokenNode();
}
@@ -21429,14 +21584,14 @@
return finishNode(node);
}
function parseVariableDeclarationList(inForStatementInitializer) {
- var node = createNode(238 /* VariableDeclarationList */);
+ var node = createNode(239 /* VariableDeclarationList */);
switch (token()) {
- case 105 /* VarKeyword */:
+ case 106 /* VarKeyword */:
break;
- case 111 /* LetKeyword */:
+ case 112 /* LetKeyword */:
node.flags |= 1 /* Let */;
break;
- case 77 /* ConstKeyword */:
+ case 78 /* ConstKeyword */:
node.flags |= 2 /* Const */;
break;
default:
@@ -21452,7 +21607,7 @@
// So we need to look ahead to determine if 'of' should be treated as a keyword in
// this context.
// The checker will then give an error that there is an empty declaration list.
- if (token() === 147 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) {
+ if (token() === 148 /* OfKeyword */ && lookAhead(canFollowContextualOfKeyword)) {
node.declarations = createMissingList();
}
else {
@@ -21467,14 +21622,14 @@
return nextTokenIsIdentifier() && nextToken() === 21 /* CloseParenToken */;
}
function parseVariableStatement(node) {
- node.kind = 219 /* VariableStatement */;
+ node.kind = 220 /* VariableStatement */;
node.declarationList = parseVariableDeclarationList(/*inForStatementInitializer*/ false);
parseSemicolon();
return finishNode(node);
}
function parseFunctionDeclaration(node) {
- node.kind = 239 /* FunctionDeclaration */;
- parseExpected(90 /* FunctionKeyword */);
+ node.kind = 240 /* FunctionDeclaration */;
+ parseExpected(91 /* FunctionKeyword */);
node.asteriskToken = parseOptionalToken(40 /* AsteriskToken */);
node.name = ts.hasModifier(node, 512 /* Default */) ? parseOptionalIdentifier() : parseIdentifier();
var isGenerator = node.asteriskToken ? 1 /* Yield */ : 0 /* None */;
@@ -21484,14 +21639,14 @@
return finishNode(node);
}
function parseConstructorDeclaration(node) {
- node.kind = 157 /* Constructor */;
- parseExpected(124 /* ConstructorKeyword */);
+ node.kind = 158 /* Constructor */;
+ parseExpected(125 /* ConstructorKeyword */);
fillSignature(57 /* ColonToken */, 0 /* None */, node);
node.body = parseFunctionBlockOrSemicolon(0 /* None */, ts.Diagnostics.or_expected);
return finishNode(node);
}
function parseMethodDeclaration(node, asteriskToken, diagnosticMessage) {
- node.kind = 156 /* MethodDeclaration */;
+ node.kind = 157 /* MethodDeclaration */;
node.asteriskToken = asteriskToken;
var isGenerator = asteriskToken ? 1 /* Yield */ : 0 /* None */;
var isAsync = ts.hasModifier(node, 256 /* Async */) ? 2 /* Await */ : 0 /* None */;
@@ -21500,7 +21655,7 @@
return finishNode(node);
}
function parsePropertyDeclaration(node) {
- node.kind = 154 /* PropertyDeclaration */;
+ node.kind = 155 /* PropertyDeclaration */;
if (!node.questionToken && token() === 52 /* ExclamationToken */ && !scanner.hasPrecedingLineBreak()) {
node.exclamationToken = parseTokenNode();
}
@@ -21573,7 +21728,7 @@
// If we were able to get any potential identifier...
if (idToken !== undefined) {
// If we have a non-keyword identifier, or if we have an accessor, then it's safe to parse.
- if (!ts.isKeyword(idToken) || idToken === 137 /* SetKeyword */ || idToken === 126 /* GetKeyword */) {
+ if (!ts.isKeyword(idToken) || idToken === 138 /* SetKeyword */ || idToken === 127 /* GetKeyword */) {
return true;
}
// If it *is* a keyword, but not an accessor, check a little farther along
@@ -21583,7 +21738,7 @@
case 28 /* LessThanToken */: // Generic Method declaration
case 52 /* ExclamationToken */: // Non-null assertion on property name
case 57 /* ColonToken */: // Type Annotation for declaration
- case 59 /* EqualsToken */: // Initializer for declaration
+ case 60 /* EqualsToken */: // Initializer for declaration
case 56 /* QuestionToken */: // Not valid, but permitted so that it gets caught later on.
return true;
default:
@@ -21605,7 +21760,7 @@
if (!parseOptional(58 /* AtToken */)) {
break;
}
- var decorator = createNode(152 /* Decorator */, decoratorStart);
+ var decorator = createNode(153 /* Decorator */, decoratorStart);
decorator.expression = doInDecoratorContext(parseLeftHandSideExpressionOrHigher);
finishNode(decorator);
(list || (list = [])).push(decorator);
@@ -21625,7 +21780,7 @@
while (true) {
var modifierStart = scanner.getStartPos();
var modifierKind = token();
- if (token() === 77 /* ConstKeyword */ && permitInvalidConstAsModifier) {
+ if (token() === 78 /* ConstKeyword */ && permitInvalidConstAsModifier) {
// We need to ensure that any subsequent modifiers appear on the same line
// so that when 'const' is a standalone declaration, we don't issue an error.
if (!tryParse(nextTokenIsOnSameLineAndCanFollowModifier)) {
@@ -21644,7 +21799,7 @@
}
function parseModifiersForArrowFunction() {
var modifiers;
- if (token() === 121 /* AsyncKeyword */) {
+ if (token() === 122 /* AsyncKeyword */) {
var modifierStart = scanner.getStartPos();
var modifierKind = token();
nextToken();
@@ -21655,20 +21810,20 @@
}
function parseClassElement() {
if (token() === 26 /* SemicolonToken */) {
- var result = createNode(217 /* SemicolonClassElement */);
+ var result = createNode(218 /* SemicolonClassElement */);
nextToken();
return finishNode(result);
}
var node = createNodeWithJSDoc(0 /* Unknown */);
node.decorators = parseDecorators();
node.modifiers = parseModifiers(/*permitInvalidConstAsModifier*/ true);
- if (parseContextualModifier(126 /* GetKeyword */)) {
- return parseAccessorDeclaration(node, 158 /* GetAccessor */);
+ if (parseContextualModifier(127 /* GetKeyword */)) {
+ return parseAccessorDeclaration(node, 159 /* GetAccessor */);
}
- if (parseContextualModifier(137 /* SetKeyword */)) {
- return parseAccessorDeclaration(node, 159 /* SetAccessor */);
+ if (parseContextualModifier(138 /* SetKeyword */)) {
+ return parseAccessorDeclaration(node, 160 /* SetAccessor */);
}
- if (token() === 124 /* ConstructorKeyword */) {
+ if (token() === 125 /* ConstructorKeyword */) {
return parseConstructorDeclaration(node);
}
if (isIndexSignature()) {
@@ -21685,21 +21840,21 @@
}
if (node.decorators || node.modifiers) {
// treat this as a property declaration with a missing name.
- node.name = createMissingNode(72 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected);
+ node.name = createMissingNode(73 /* Identifier */, /*reportAtCurrentPosition*/ true, ts.Diagnostics.Declaration_expected);
return parsePropertyDeclaration(node);
}
// 'isClassMemberStart' should have hinted not to attempt parsing.
return ts.Debug.fail("Should not have attempted to parse class member declaration.");
}
function parseClassExpression() {
- return parseClassDeclarationOrExpression(createNodeWithJSDoc(0 /* Unknown */), 209 /* ClassExpression */);
+ return parseClassDeclarationOrExpression(createNodeWithJSDoc(0 /* Unknown */), 210 /* ClassExpression */);
}
function parseClassDeclaration(node) {
- return parseClassDeclarationOrExpression(node, 240 /* ClassDeclaration */);
+ return parseClassDeclarationOrExpression(node, 241 /* ClassDeclaration */);
}
function parseClassDeclarationOrExpression(node, kind) {
node.kind = kind;
- parseExpected(76 /* ClassKeyword */);
+ parseExpected(77 /* ClassKeyword */);
node.name = parseNameOfClassDeclarationOrExpression();
node.typeParameters = parseTypeParameters();
node.heritageClauses = parseHeritageClauses();
@@ -21725,7 +21880,7 @@
: undefined;
}
function isImplementsClause() {
- return token() === 109 /* ImplementsKeyword */ && lookAhead(nextTokenIsIdentifierOrKeyword);
+ return token() === 110 /* ImplementsKeyword */ && lookAhead(nextTokenIsIdentifierOrKeyword);
}
function parseHeritageClauses() {
// ClassTail[Yield,Await] : (Modified) See 14.5
@@ -21737,15 +21892,15 @@
}
function parseHeritageClause() {
var tok = token();
- ts.Debug.assert(tok === 86 /* ExtendsKeyword */ || tok === 109 /* ImplementsKeyword */); // isListElement() should ensure this.
- var node = createNode(273 /* HeritageClause */);
+ ts.Debug.assert(tok === 87 /* ExtendsKeyword */ || tok === 110 /* ImplementsKeyword */); // isListElement() should ensure this.
+ var node = createNode(274 /* HeritageClause */);
node.token = tok;
nextToken();
node.types = parseDelimitedList(7 /* HeritageClauseElement */, parseExpressionWithTypeArguments);
return finishNode(node);
}
function parseExpressionWithTypeArguments() {
- var node = createNode(211 /* ExpressionWithTypeArguments */);
+ var node = createNode(212 /* ExpressionWithTypeArguments */);
node.expression = parseLeftHandSideExpressionOrHigher();
node.typeArguments = tryParseTypeArguments();
return finishNode(node);
@@ -21756,14 +21911,14 @@
: undefined;
}
function isHeritageClause() {
- return token() === 86 /* ExtendsKeyword */ || token() === 109 /* ImplementsKeyword */;
+ return token() === 87 /* ExtendsKeyword */ || token() === 110 /* ImplementsKeyword */;
}
function parseClassMembers() {
return parseList(5 /* ClassMembers */, parseClassElement);
}
function parseInterfaceDeclaration(node) {
- node.kind = 241 /* InterfaceDeclaration */;
- parseExpected(110 /* InterfaceKeyword */);
+ node.kind = 242 /* InterfaceDeclaration */;
+ parseExpected(111 /* InterfaceKeyword */);
node.name = parseIdentifier();
node.typeParameters = parseTypeParameters();
node.heritageClauses = parseHeritageClauses();
@@ -21771,11 +21926,11 @@
return finishNode(node);
}
function parseTypeAliasDeclaration(node) {
- node.kind = 242 /* TypeAliasDeclaration */;
- parseExpected(140 /* TypeKeyword */);
+ node.kind = 243 /* TypeAliasDeclaration */;
+ parseExpected(141 /* TypeKeyword */);
node.name = parseIdentifier();
node.typeParameters = parseTypeParameters();
- parseExpected(59 /* EqualsToken */);
+ parseExpected(60 /* EqualsToken */);
node.type = parseType();
parseSemicolon();
return finishNode(node);
@@ -21785,14 +21940,14 @@
// ConstantEnumMemberSection, which starts at the beginning of an enum declaration
// or any time an integer literal initializer is encountered.
function parseEnumMember() {
- var node = createNodeWithJSDoc(278 /* EnumMember */);
+ var node = createNodeWithJSDoc(279 /* EnumMember */);
node.name = parsePropertyName();
node.initializer = allowInAnd(parseInitializer);
return finishNode(node);
}
function parseEnumDeclaration(node) {
- node.kind = 243 /* EnumDeclaration */;
- parseExpected(84 /* EnumKeyword */);
+ node.kind = 244 /* EnumDeclaration */;
+ parseExpected(85 /* EnumKeyword */);
node.name = parseIdentifier();
if (parseExpected(18 /* OpenBraceToken */)) {
node.members = parseDelimitedList(6 /* EnumMembers */, parseEnumMember);
@@ -21804,7 +21959,7 @@
return finishNode(node);
}
function parseModuleBlock() {
- var node = createNode(245 /* ModuleBlock */);
+ var node = createNode(246 /* ModuleBlock */);
if (parseExpected(18 /* OpenBraceToken */)) {
node.statements = parseList(1 /* BlockStatements */, parseStatement);
parseExpected(19 /* CloseBraceToken */);
@@ -21815,7 +21970,7 @@
return finishNode(node);
}
function parseModuleOrNamespaceDeclaration(node, flags) {
- node.kind = 244 /* ModuleDeclaration */;
+ node.kind = 245 /* ModuleDeclaration */;
// If we are parsing a dotted namespace name, we want to
// propagate the 'Namespace' flag across the names if set.
var namespaceFlag = flags & 16 /* Namespace */;
@@ -21827,8 +21982,8 @@
return finishNode(node);
}
function parseAmbientExternalModuleDeclaration(node) {
- node.kind = 244 /* ModuleDeclaration */;
- if (token() === 145 /* GlobalKeyword */) {
+ node.kind = 245 /* ModuleDeclaration */;
+ if (token() === 146 /* GlobalKeyword */) {
// parse 'global' as name of global scope augmentation
node.name = parseIdentifier();
node.flags |= 512 /* GlobalAugmentation */;
@@ -21847,15 +22002,15 @@
}
function parseModuleDeclaration(node) {
var flags = 0;
- if (token() === 145 /* GlobalKeyword */) {
+ if (token() === 146 /* GlobalKeyword */) {
// global augmentation
return parseAmbientExternalModuleDeclaration(node);
}
- else if (parseOptional(131 /* NamespaceKeyword */)) {
+ else if (parseOptional(132 /* NamespaceKeyword */)) {
flags |= 16 /* Namespace */;
}
else {
- parseExpected(130 /* ModuleKeyword */);
+ parseExpected(131 /* ModuleKeyword */);
if (token() === 10 /* StringLiteral */) {
return parseAmbientExternalModuleDeclaration(node);
}
@@ -21863,7 +22018,7 @@
return parseModuleOrNamespaceDeclaration(node, flags);
}
function isExternalModuleReference() {
- return token() === 134 /* RequireKeyword */ &&
+ return token() === 135 /* RequireKeyword */ &&
lookAhead(nextTokenIsOpenParen);
}
function nextTokenIsOpenParen() {
@@ -21873,25 +22028,25 @@
return nextToken() === 42 /* SlashToken */;
}
function parseNamespaceExportDeclaration(node) {
- node.kind = 247 /* NamespaceExportDeclaration */;
- parseExpected(119 /* AsKeyword */);
- parseExpected(131 /* NamespaceKeyword */);
+ node.kind = 248 /* NamespaceExportDeclaration */;
+ parseExpected(120 /* AsKeyword */);
+ parseExpected(132 /* NamespaceKeyword */);
node.name = parseIdentifier();
parseSemicolon();
return finishNode(node);
}
function parseImportDeclarationOrImportEqualsDeclaration(node) {
- parseExpected(92 /* ImportKeyword */);
+ parseExpected(93 /* ImportKeyword */);
var afterImportPos = scanner.getStartPos();
var identifier;
if (isIdentifier()) {
identifier = parseIdentifier();
- if (token() !== 27 /* CommaToken */ && token() !== 144 /* FromKeyword */) {
+ if (token() !== 27 /* CommaToken */ && token() !== 145 /* FromKeyword */) {
return parseImportEqualsDeclaration(node, identifier);
}
}
// Import statement
- node.kind = 249 /* ImportDeclaration */;
+ node.kind = 250 /* ImportDeclaration */;
// ImportDeclaration:
// import ImportClause from ModuleSpecifier ;
// import ModuleSpecifier;
@@ -21899,16 +22054,16 @@
token() === 40 /* AsteriskToken */ || // import *
token() === 18 /* OpenBraceToken */) { // import {
node.importClause = parseImportClause(identifier, afterImportPos);
- parseExpected(144 /* FromKeyword */);
+ parseExpected(145 /* FromKeyword */);
}
node.moduleSpecifier = parseModuleSpecifier();
parseSemicolon();
return finishNode(node);
}
function parseImportEqualsDeclaration(node, identifier) {
- node.kind = 248 /* ImportEqualsDeclaration */;
+ node.kind = 249 /* ImportEqualsDeclaration */;
node.name = identifier;
- parseExpected(59 /* EqualsToken */);
+ parseExpected(60 /* EqualsToken */);
node.moduleReference = parseModuleReference();
parseSemicolon();
return finishNode(node);
@@ -21920,7 +22075,7 @@
// NamedImports
// ImportedDefaultBinding, NameSpaceImport
// ImportedDefaultBinding, NamedImports
- var importClause = createNode(250 /* ImportClause */, fullStart);
+ var importClause = createNode(251 /* ImportClause */, fullStart);
if (identifier) {
// ImportedDefaultBinding:
// ImportedBinding
@@ -21930,7 +22085,7 @@
// parse namespace or named imports
if (!importClause.name ||
parseOptional(27 /* CommaToken */)) {
- importClause.namedBindings = token() === 40 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(252 /* NamedImports */);
+ importClause.namedBindings = token() === 40 /* AsteriskToken */ ? parseNamespaceImport() : parseNamedImportsOrExports(253 /* NamedImports */);
}
return finishNode(importClause);
}
@@ -21940,8 +22095,8 @@
: parseEntityName(/*allowReservedWords*/ false);
}
function parseExternalModuleReference() {
- var node = createNode(259 /* ExternalModuleReference */);
- parseExpected(134 /* RequireKeyword */);
+ var node = createNode(260 /* ExternalModuleReference */);
+ parseExpected(135 /* RequireKeyword */);
parseExpected(20 /* OpenParenToken */);
node.expression = parseModuleSpecifier();
parseExpected(21 /* CloseParenToken */);
@@ -21963,9 +22118,9 @@
function parseNamespaceImport() {
// NameSpaceImport:
// * as ImportedBinding
- var namespaceImport = createNode(251 /* NamespaceImport */);
+ var namespaceImport = createNode(252 /* NamespaceImport */);
parseExpected(40 /* AsteriskToken */);
- parseExpected(119 /* AsKeyword */);
+ parseExpected(120 /* AsKeyword */);
namespaceImport.name = parseIdentifier();
return finishNode(namespaceImport);
}
@@ -21978,14 +22133,14 @@
// ImportsList:
// ImportSpecifier
// ImportsList, ImportSpecifier
- node.elements = parseBracketedList(23 /* ImportOrExportSpecifiers */, kind === 252 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 18 /* OpenBraceToken */, 19 /* CloseBraceToken */);
+ node.elements = parseBracketedList(23 /* ImportOrExportSpecifiers */, kind === 253 /* NamedImports */ ? parseImportSpecifier : parseExportSpecifier, 18 /* OpenBraceToken */, 19 /* CloseBraceToken */);
return finishNode(node);
}
function parseExportSpecifier() {
- return parseImportOrExportSpecifier(257 /* ExportSpecifier */);
+ return parseImportOrExportSpecifier(258 /* ExportSpecifier */);
}
function parseImportSpecifier() {
- return parseImportOrExportSpecifier(253 /* ImportSpecifier */);
+ return parseImportOrExportSpecifier(254 /* ImportSpecifier */);
}
function parseImportOrExportSpecifier(kind) {
var node = createNode(kind);
@@ -21999,9 +22154,9 @@
var checkIdentifierStart = scanner.getTokenPos();
var checkIdentifierEnd = scanner.getTextPos();
var identifierName = parseIdentifierName();
- if (token() === 119 /* AsKeyword */) {
+ if (token() === 120 /* AsKeyword */) {
node.propertyName = identifierName;
- parseExpected(119 /* AsKeyword */);
+ parseExpected(120 /* AsKeyword */);
checkIdentifierIsKeyword = ts.isKeyword(token()) && !isIdentifier();
checkIdentifierStart = scanner.getTokenPos();
checkIdentifierEnd = scanner.getTextPos();
@@ -22010,24 +22165,24 @@
else {
node.name = identifierName;
}
- if (kind === 253 /* ImportSpecifier */ && checkIdentifierIsKeyword) {
+ if (kind === 254 /* ImportSpecifier */ && checkIdentifierIsKeyword) {
parseErrorAt(checkIdentifierStart, checkIdentifierEnd, ts.Diagnostics.Identifier_expected);
}
return finishNode(node);
}
function parseExportDeclaration(node) {
- node.kind = 255 /* ExportDeclaration */;
+ node.kind = 256 /* ExportDeclaration */;
if (parseOptional(40 /* AsteriskToken */)) {
- parseExpected(144 /* FromKeyword */);
+ parseExpected(145 /* FromKeyword */);
node.moduleSpecifier = parseModuleSpecifier();
}
else {
- node.exportClause = parseNamedImportsOrExports(256 /* NamedExports */);
+ node.exportClause = parseNamedImportsOrExports(257 /* NamedExports */);
// It is not uncommon to accidentally omit the 'from' keyword. Additionally, in editing scenarios,
// the 'from' keyword can be parsed as a named export when the export clause is unterminated (i.e. `export { from "moduleName";`)
// If we don't have a 'from' keyword, see if we have a string literal such that ASI won't take effect.
- if (token() === 144 /* FromKeyword */ || (token() === 10 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) {
- parseExpected(144 /* FromKeyword */);
+ if (token() === 145 /* FromKeyword */ || (token() === 10 /* StringLiteral */ && !scanner.hasPrecedingLineBreak())) {
+ parseExpected(145 /* FromKeyword */);
node.moduleSpecifier = parseModuleSpecifier();
}
}
@@ -22035,12 +22190,12 @@
return finishNode(node);
}
function parseExportAssignment(node) {
- node.kind = 254 /* ExportAssignment */;
- if (parseOptional(59 /* EqualsToken */)) {
+ node.kind = 255 /* ExportAssignment */;
+ if (parseOptional(60 /* EqualsToken */)) {
node.isExportEquals = true;
}
else {
- parseExpected(80 /* DefaultKeyword */);
+ parseExpected(81 /* DefaultKeyword */);
}
node.expression = parseAssignmentExpressionOrHigher();
parseSemicolon();
@@ -22055,10 +22210,10 @@
}
function isAnExternalModuleIndicatorNode(node) {
return ts.hasModifier(node, 1 /* Export */)
- || node.kind === 248 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 259 /* ExternalModuleReference */
- || node.kind === 249 /* ImportDeclaration */
- || node.kind === 254 /* ExportAssignment */
- || node.kind === 255 /* ExportDeclaration */
+ || node.kind === 249 /* ImportEqualsDeclaration */ && node.moduleReference.kind === 260 /* ExternalModuleReference */
+ || node.kind === 250 /* ImportDeclaration */
+ || node.kind === 255 /* ExportAssignment */
+ || node.kind === 256 /* ExportDeclaration */
? node
: undefined;
}
@@ -22071,7 +22226,7 @@
return isImportMeta(node) ? node : forEachChild(node, walkTreeForExternalModuleIndicators);
}
function isImportMeta(node) {
- return ts.isMetaProperty(node) && node.keywordToken === 92 /* ImportKeyword */ && node.name.escapedText === "meta";
+ return ts.isMetaProperty(node) && node.keywordToken === 93 /* ImportKeyword */ && node.name.escapedText === "meta";
}
var ParsingContext;
(function (ParsingContext) {
@@ -22110,8 +22265,8 @@
var JSDocParser;
(function (JSDocParser) {
function parseJSDocTypeExpressionForTests(content, start, length) {
- initializeState(content, 7 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
- sourceFile = createSourceFile("file.js", 7 /* Latest */, 1 /* JS */, /*isDeclarationFile*/ false);
+ initializeState(content, 8 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
+ sourceFile = createSourceFile("file.js", 8 /* Latest */, 1 /* JS */, /*isDeclarationFile*/ false);
scanner.setText(content, start, length);
currentToken = scanner.scan();
var jsDocTypeExpression = parseJSDocTypeExpression();
@@ -22122,18 +22277,18 @@
JSDocParser.parseJSDocTypeExpressionForTests = parseJSDocTypeExpressionForTests;
// Parses out a JSDoc type expression.
function parseJSDocTypeExpression(mayOmitBraces) {
- var result = createNode(288 /* JSDocTypeExpression */);
+ var result = createNode(289 /* JSDocTypeExpression */);
var hasBrace = (mayOmitBraces ? parseOptional : parseExpected)(18 /* OpenBraceToken */);
result.type = doInsideOfContext(2097152 /* JSDoc */, parseJSDocType);
if (!mayOmitBraces || hasBrace) {
- parseExpected(19 /* CloseBraceToken */);
+ parseExpectedJSDoc(19 /* CloseBraceToken */);
}
fixupParentReferences(result);
return finishNode(result);
}
JSDocParser.parseJSDocTypeExpression = parseJSDocTypeExpression;
function parseIsolatedJSDocComment(content, start, length) {
- initializeState(content, 7 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
+ initializeState(content, 8 /* Latest */, /*_syntaxCursor:*/ undefined, 1 /* JS */);
sourceFile = { languageVariant: 0 /* Standard */, text: content }; // tslint:disable-line no-object-literal-type-assertion
var jsDoc = parseJSDocCommentWorker(start, length);
var diagnostics = parseDiagnostics;
@@ -22205,7 +22360,7 @@
comments.push(text);
indent += text.length;
}
- nextJSDocToken();
+ nextTokenJSDoc();
while (parseOptionalJsdoc(5 /* WhitespaceTrivia */))
;
if (parseOptionalJsdoc(4 /* NewLineTrivia */)) {
@@ -22223,7 +22378,6 @@
// for malformed examples like `/** @param {string} x @returns {number} the length */`
state = 0 /* BeginningOfLine */;
margin = undefined;
- indent++;
}
else {
pushComment(scanner.getTokenText());
@@ -22268,7 +22422,7 @@
pushComment(scanner.getTokenText());
break;
}
- nextJSDocToken();
+ nextTokenJSDoc();
}
removeLeadingNewlines(comments);
removeTrailingWhitespace(comments);
@@ -22285,7 +22439,7 @@
}
}
function createJSDocComment() {
- var result = createNode(296 /* JSDocComment */, start);
+ var result = createNode(297 /* JSDocComment */, start);
result.tags = tags && createNodeArray(tags, tagsPos, tagsEnd);
result.comment = comments.length ? comments.join("") : undefined;
return finishNode(result, end);
@@ -22293,7 +22447,7 @@
function isNextNonwhitespaceTokenEndOfFile() {
// We must use infinite lookahead, as there could be any number of newlines :(
while (true) {
- nextJSDocToken();
+ nextTokenJSDoc();
if (token() === 1 /* EndOfFileToken */) {
return true;
}
@@ -22309,32 +22463,38 @@
}
}
while (token() === 5 /* WhitespaceTrivia */ || token() === 4 /* NewLineTrivia */) {
- nextJSDocToken();
+ nextTokenJSDoc();
}
}
function skipWhitespaceOrAsterisk() {
if (token() === 5 /* WhitespaceTrivia */ || token() === 4 /* NewLineTrivia */) {
if (lookAhead(isNextNonwhitespaceTokenEndOfFile)) {
- return; // Don't skip whitespace prior to EoF (or end of comment) - that shouldn't be included in any node's range
+ return ""; // Don't skip whitespace prior to EoF (or end of comment) - that shouldn't be included in any node's range
}
}
var precedingLineBreak = scanner.hasPrecedingLineBreak();
+ var seenLineBreak = false;
+ var indentText = "";
while ((precedingLineBreak && token() === 40 /* AsteriskToken */) || token() === 5 /* WhitespaceTrivia */ || token() === 4 /* NewLineTrivia */) {
+ indentText += scanner.getTokenText();
if (token() === 4 /* NewLineTrivia */) {
precedingLineBreak = true;
+ seenLineBreak = true;
+ indentText = "";
}
else if (token() === 40 /* AsteriskToken */) {
precedingLineBreak = false;
}
- nextJSDocToken();
+ nextTokenJSDoc();
}
+ return seenLineBreak ? indentText : "";
}
- function parseTag(indent) {
+ function parseTag(margin) {
ts.Debug.assert(token() === 58 /* AtToken */);
var start = scanner.getTokenPos();
- nextJSDocToken();
+ nextTokenJSDoc();
var tagName = parseJSDocIdentifierName(/*message*/ undefined);
- skipWhitespaceOrAsterisk();
+ var indentText = skipWhitespaceOrAsterisk();
var tag;
switch (tagName.escapedText) {
case "augments":
@@ -22354,7 +22514,7 @@
case "arg":
case "argument":
case "param":
- return parseParameterOrPropertyTag(start, tagName, 2 /* Parameter */, indent);
+ return parseParameterOrPropertyTag(start, tagName, 2 /* Parameter */, margin);
case "return":
case "returns":
tag = parseReturnTag(start, tagName);
@@ -22366,10 +22526,10 @@
tag = parseTypeTag(start, tagName);
break;
case "typedef":
- tag = parseTypedefTag(start, tagName, indent);
+ tag = parseTypedefTag(start, tagName, margin);
break;
case "callback":
- tag = parseCallbackTag(start, tagName, indent);
+ tag = parseCallbackTag(start, tagName, margin);
break;
default:
tag = parseUnknownTag(start, tagName);
@@ -22377,11 +22537,14 @@
}
if (!tag.comment) {
// some tags, like typedef and callback, have already parsed their comments earlier
- tag.comment = parseTagComments(indent + tag.end - tag.pos);
+ if (!indentText) {
+ margin += tag.end - tag.pos;
+ }
+ tag.comment = parseTagComments(margin, indentText.slice(margin));
}
return tag;
}
- function parseTagComments(indent) {
+ function parseTagComments(indent, initialMargin) {
var comments = [];
var state = 0 /* BeginningOfLine */;
var margin;
@@ -22392,6 +22555,11 @@
comments.push(text);
indent += text.length;
}
+ if (initialMargin) {
+ // jump straight to saving comments if there is some initial indentation
+ pushComment(initialMargin);
+ state = 2 /* SavingComments */;
+ }
var tok = token();
loop: while (true) {
switch (tok) {
@@ -22416,18 +22584,18 @@
var whitespace = scanner.getTokenText();
// if the whitespace crosses the margin, take only the whitespace that passes the margin
if (margin !== undefined && indent + whitespace.length > margin) {
- comments.push(whitespace.slice(margin - indent - 1));
+ comments.push(whitespace.slice(margin - indent));
}
indent += whitespace.length;
}
break;
case 18 /* OpenBraceToken */:
state = 2 /* SavingComments */;
- if (lookAhead(function () { return nextJSDocToken() === 58 /* AtToken */ && ts.tokenIsIdentifierOrKeyword(nextJSDocToken()) && scanner.getTokenText() === "link"; })) {
+ if (lookAhead(function () { return nextTokenJSDoc() === 58 /* AtToken */ && ts.tokenIsIdentifierOrKeyword(nextTokenJSDoc()) && scanner.getTokenText() === "link"; })) {
pushComment(scanner.getTokenText());
- nextJSDocToken();
+ nextTokenJSDoc();
pushComment(scanner.getTokenText());
- nextJSDocToken();
+ nextTokenJSDoc();
}
pushComment(scanner.getTokenText());
break;
@@ -22445,14 +22613,14 @@
pushComment(scanner.getTokenText());
break;
}
- tok = nextJSDocToken();
+ tok = nextTokenJSDoc();
}
removeLeadingNewlines(comments);
removeTrailingWhitespace(comments);
return comments.length === 0 ? undefined : comments.join("");
}
function parseUnknownTag(start, tagName) {
- var result = createNode(299 /* JSDocTag */, start);
+ var result = createNode(300 /* JSDocTag */, start);
result.tagName = tagName;
return finishNode(result);
}
@@ -22474,17 +22642,21 @@
return token() === 18 /* OpenBraceToken */ ? parseJSDocTypeExpression() : undefined;
}
function parseBracketNameInPropertyAndParamTag() {
- if (token() === 14 /* NoSubstitutionTemplateLiteral */) {
- // a markdown-quoted name: `arg` is not legal jsdoc, but occurs in the wild
- return { name: createIdentifier(/*isIdentifier*/ true), isBracketed: false };
- }
// Looking for something like '[foo]', 'foo', '[foo.bar]' or 'foo.bar'
- var isBracketed = parseOptional(22 /* OpenBracketToken */);
+ var isBracketed = parseOptionalJsdoc(22 /* OpenBracketToken */);
+ if (isBracketed) {
+ skipWhitespace();
+ }
+ // a markdown-quoted name: `arg` is not legal jsdoc, but occurs in the wild
+ var isBackquoted = parseOptionalJsdoc(59 /* BacktickToken */);
var name = parseJSDocEntityName();
+ if (isBackquoted) {
+ parseExpectedTokenJSDoc(59 /* BacktickToken */);
+ }
if (isBracketed) {
skipWhitespace();
// May have an optional default, e.g. '[foo = 42]'
- if (parseOptionalToken(59 /* EqualsToken */)) {
+ if (parseOptionalToken(60 /* EqualsToken */)) {
parseExpression();
}
parseExpected(23 /* CloseBracketToken */);
@@ -22493,9 +22665,9 @@
}
function isObjectOrObjectArrayTypeReference(node) {
switch (node.kind) {
- case 136 /* ObjectKeyword */:
+ case 137 /* ObjectKeyword */:
return true;
- case 169 /* ArrayType */:
+ case 170 /* ArrayType */:
return isObjectOrObjectArrayTypeReference(node.elementType);
default:
return ts.isTypeReferenceNode(node) && ts.isIdentifier(node.typeName) && node.typeName.escapedText === "Object";
@@ -22511,8 +22683,8 @@
typeExpression = tryParseTypeExpression();
}
var result = target === 1 /* Property */ ?
- createNode(310 /* JSDocPropertyTag */, start) :
- createNode(304 /* JSDocParameterTag */, start);
+ createNode(311 /* JSDocPropertyTag */, start) :
+ createNode(305 /* JSDocParameterTag */, start);
var comment = parseTagComments(indent + scanner.getStartPos() - start);
var nestedTypeLiteral = target !== 4 /* CallbackParameter */ && parseNestedTypeLiteral(typeExpression, name, target, indent);
if (nestedTypeLiteral) {
@@ -22529,20 +22701,20 @@
}
function parseNestedTypeLiteral(typeExpression, name, target, indent) {
if (typeExpression && isObjectOrObjectArrayTypeReference(typeExpression.type)) {
- var typeLiteralExpression = createNode(288 /* JSDocTypeExpression */, scanner.getTokenPos());
+ var typeLiteralExpression = createNode(289 /* JSDocTypeExpression */, scanner.getTokenPos());
var child = void 0;
var jsdocTypeLiteral = void 0;
var start_2 = scanner.getStartPos();
var children = void 0;
while (child = tryParse(function () { return parseChildParameterOrPropertyTag(target, indent, name); })) {
- if (child.kind === 304 /* JSDocParameterTag */ || child.kind === 310 /* JSDocPropertyTag */) {
+ if (child.kind === 305 /* JSDocParameterTag */ || child.kind === 311 /* JSDocPropertyTag */) {
children = ts.append(children, child);
}
}
if (children) {
- jsdocTypeLiteral = createNode(297 /* JSDocTypeLiteral */, start_2);
+ jsdocTypeLiteral = createNode(298 /* JSDocTypeLiteral */, start_2);
jsdocTypeLiteral.jsDocPropertyTags = children;
- if (typeExpression.type.kind === 169 /* ArrayType */) {
+ if (typeExpression.type.kind === 170 /* ArrayType */) {
jsdocTypeLiteral.isArrayType = true;
}
typeLiteralExpression.type = finishNode(jsdocTypeLiteral);
@@ -22551,32 +22723,32 @@
}
}
function parseReturnTag(start, tagName) {
- if (ts.forEach(tags, function (t) { return t.kind === 305 /* JSDocReturnTag */; })) {
+ if (ts.some(tags, ts.isJSDocReturnTag)) {
parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText);
}
- var result = createNode(305 /* JSDocReturnTag */, start);
+ var result = createNode(306 /* JSDocReturnTag */, start);
result.tagName = tagName;
result.typeExpression = tryParseTypeExpression();
return finishNode(result);
}
function parseTypeTag(start, tagName) {
- if (ts.forEach(tags, function (t) { return t.kind === 307 /* JSDocTypeTag */; })) {
+ if (ts.some(tags, ts.isJSDocTypeTag)) {
parseErrorAt(tagName.pos, scanner.getTokenPos(), ts.Diagnostics._0_tag_already_specified, tagName.escapedText);
}
- var result = createNode(307 /* JSDocTypeTag */, start);
+ var result = createNode(308 /* JSDocTypeTag */, start);
result.tagName = tagName;
result.typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true);
return finishNode(result);
}
function parseAugmentsTag(start, tagName) {
- var result = createNode(300 /* JSDocAugmentsTag */, start);
+ var result = createNode(301 /* JSDocAugmentsTag */, start);
result.tagName = tagName;
result.class = parseExpressionWithTypeArgumentsForAugments();
return finishNode(result);
}
function parseExpressionWithTypeArgumentsForAugments() {
var usedBrace = parseOptional(18 /* OpenBraceToken */);
- var node = createNode(211 /* ExpressionWithTypeArguments */);
+ var node = createNode(212 /* ExpressionWithTypeArguments */);
node.expression = parsePropertyAccessEntityNameExpression();
node.typeArguments = tryParseTypeArguments();
var res = finishNode(node);
@@ -22588,7 +22760,7 @@
function parsePropertyAccessEntityNameExpression() {
var node = parseJSDocIdentifierName();
while (parseOptional(24 /* DotToken */)) {
- var prop = createNode(189 /* PropertyAccessExpression */, node.pos);
+ var prop = createNode(190 /* PropertyAccessExpression */, node.pos);
prop.expression = node;
prop.name = parseJSDocIdentifierName();
node = finishNode(prop);
@@ -22596,19 +22768,19 @@
return node;
}
function parseClassTag(start, tagName) {
- var tag = createNode(301 /* JSDocClassTag */, start);
+ var tag = createNode(302 /* JSDocClassTag */, start);
tag.tagName = tagName;
return finishNode(tag);
}
function parseThisTag(start, tagName) {
- var tag = createNode(306 /* JSDocThisTag */, start);
+ var tag = createNode(307 /* JSDocThisTag */, start);
tag.tagName = tagName;
tag.typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true);
skipWhitespace();
return finishNode(tag);
}
function parseEnumTag(start, tagName) {
- var tag = createNode(303 /* JSDocEnumTag */, start);
+ var tag = createNode(304 /* JSDocEnumTag */, start);
tag.tagName = tagName;
tag.typeExpression = parseJSDocTypeExpression(/*mayOmitBraces*/ true);
skipWhitespace();
@@ -22617,7 +22789,7 @@
function parseTypedefTag(start, tagName, indent) {
var typeExpression = tryParseTypeExpression();
skipWhitespaceOrAsterisk();
- var typedefTag = createNode(309 /* JSDocTypedefTag */, start);
+ var typedefTag = createNode(310 /* JSDocTypedefTag */, start);
typedefTag.tagName = tagName;
typedefTag.fullName = parseJSDocTypeNameWithNamespace();
typedefTag.name = getJSDocTypeAliasName(typedefTag.fullName);
@@ -22631,9 +22803,9 @@
var childTypeTag = void 0;
while (child = tryParse(function () { return parseChildPropertyTag(indent); })) {
if (!jsdocTypeLiteral) {
- jsdocTypeLiteral = createNode(297 /* JSDocTypeLiteral */, start);
+ jsdocTypeLiteral = createNode(298 /* JSDocTypeLiteral */, start);
}
- if (child.kind === 307 /* JSDocTypeTag */) {
+ if (child.kind === 308 /* JSDocTypeTag */) {
if (childTypeTag) {
break;
}
@@ -22646,7 +22818,7 @@
}
}
if (jsdocTypeLiteral) {
- if (typeExpression && typeExpression.type.kind === 169 /* ArrayType */) {
+ if (typeExpression && typeExpression.type.kind === 170 /* ArrayType */) {
jsdocTypeLiteral.isArrayType = true;
}
typedefTag.typeExpression = childTypeTag && childTypeTag.typeExpression && !isObjectOrObjectArrayTypeReference(childTypeTag.typeExpression.type) ?
@@ -22665,7 +22837,7 @@
}
var typeNameOrNamespaceName = parseJSDocIdentifierName();
if (parseOptional(24 /* DotToken */)) {
- var jsDocNamespaceNode = createNode(244 /* ModuleDeclaration */, pos);
+ var jsDocNamespaceNode = createNode(245 /* ModuleDeclaration */, pos);
if (nested) {
jsDocNamespaceNode.flags |= 4 /* NestedNamespace */;
}
@@ -22679,14 +22851,14 @@
return typeNameOrNamespaceName;
}
function parseCallbackTag(start, tagName, indent) {
- var callbackTag = createNode(302 /* JSDocCallbackTag */, start);
+ var callbackTag = createNode(303 /* JSDocCallbackTag */, start);
callbackTag.tagName = tagName;
callbackTag.fullName = parseJSDocTypeNameWithNamespace();
callbackTag.name = getJSDocTypeAliasName(callbackTag.fullName);
skipWhitespace();
callbackTag.comment = parseTagComments(indent);
var child;
- var jsdocSignature = createNode(298 /* JSDocSignature */, start);
+ var jsdocSignature = createNode(299 /* JSDocSignature */, start);
jsdocSignature.parameters = [];
while (child = tryParse(function () { return parseChildParameterOrPropertyTag(4 /* CallbackParameter */, indent); })) {
jsdocSignature.parameters = ts.append(jsdocSignature.parameters, child);
@@ -22694,7 +22866,7 @@
var returnTag = tryParse(function () {
if (parseOptionalJsdoc(58 /* AtToken */)) {
var tag = parseTag(indent);
- if (tag && tag.kind === 305 /* JSDocReturnTag */) {
+ if (tag && tag.kind === 306 /* JSDocReturnTag */) {
return tag;
}
}
@@ -22735,11 +22907,11 @@
var canParseTag = true;
var seenAsterisk = false;
while (true) {
- switch (nextJSDocToken()) {
+ switch (nextTokenJSDoc()) {
case 58 /* AtToken */:
if (canParseTag) {
var child = tryParseChildTag(target, indent);
- if (child && (child.kind === 304 /* JSDocParameterTag */ || child.kind === 310 /* JSDocPropertyTag */) &&
+ if (child && (child.kind === 305 /* JSDocParameterTag */ || child.kind === 311 /* JSDocPropertyTag */) &&
target !== 4 /* CallbackParameter */ &&
name && (ts.isIdentifier(child.name) || !escapedTextsEqual(name, child.name.left))) {
return false;
@@ -22758,7 +22930,7 @@
}
seenAsterisk = true;
break;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
canParseTag = false;
break;
case 1 /* EndOfFileToken */:
@@ -22769,7 +22941,7 @@
function tryParseChildTag(target, indent) {
ts.Debug.assert(token() === 58 /* AtToken */);
var start = scanner.getStartPos();
- nextJSDocToken();
+ nextTokenJSDoc();
var tagName = parseJSDocIdentifierName();
skipWhitespace();
var t;
@@ -22803,25 +22975,22 @@
var typeParametersPos = getNodePos();
do {
skipWhitespace();
- var typeParameter = createNode(150 /* TypeParameter */);
+ var typeParameter = createNode(151 /* TypeParameter */);
typeParameter.name = parseJSDocIdentifierName(ts.Diagnostics.Unexpected_token_A_type_parameter_name_was_expected_without_curly_braces);
finishNode(typeParameter);
skipWhitespace();
typeParameters.push(typeParameter);
} while (parseOptionalJsdoc(27 /* CommaToken */));
- var result = createNode(308 /* JSDocTemplateTag */, start);
+ var result = createNode(309 /* JSDocTemplateTag */, start);
result.tagName = tagName;
result.constraint = constraint;
result.typeParameters = createNodeArray(typeParameters, typeParametersPos);
finishNode(result);
return result;
}
- function nextJSDocToken() {
- return currentToken = scanner.scanJSDocToken();
- }
function parseOptionalJsdoc(t) {
if (token() === t) {
- nextJSDocToken();
+ nextTokenJSDoc();
return true;
}
return false;
@@ -22845,14 +23014,14 @@
}
function parseJSDocIdentifierName(message) {
if (!ts.tokenIsIdentifierOrKeyword(token())) {
- return createMissingNode(72 /* Identifier */, /*reportAtCurrentPosition*/ !message, message || ts.Diagnostics.Identifier_expected);
+ return createMissingNode(73 /* Identifier */, /*reportAtCurrentPosition*/ !message, message || ts.Diagnostics.Identifier_expected);
}
var pos = scanner.getTokenPos();
var end = scanner.getTextPos();
- var result = createNode(72 /* Identifier */, pos);
+ var result = createNode(73 /* Identifier */, pos);
result.escapedText = ts.escapeLeadingUnderscores(scanner.getTokenText());
finishNode(result, end);
- nextJSDocToken();
+ nextTokenJSDoc();
return result;
}
}
@@ -22977,7 +23146,7 @@
switch (node.kind) {
case 10 /* StringLiteral */:
case 8 /* NumericLiteral */:
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return true;
}
return false;
@@ -23344,28 +23513,16 @@
ts.isDeclarationFileName = isDeclarationFileName;
/*@internal*/
function processCommentPragmas(context, sourceText) {
- var triviaScanner = ts.createScanner(context.languageVersion, /*skipTrivia*/ false, 0 /* Standard */, sourceText);
var pragmas = [];
- // Keep scanning all the leading trivia in the file until we get to something that
- // isn't trivia. Any single line comment will be analyzed to see if it is a
- // reference comment.
- while (true) {
- var kind = triviaScanner.scan();
- if (!ts.isTrivia(kind)) {
- break;
- }
- var range = {
- kind: triviaScanner.getToken(),
- pos: triviaScanner.getTokenPos(),
- end: triviaScanner.getTextPos(),
- };
+ for (var _i = 0, _a = ts.getLeadingCommentRanges(sourceText, 0) || ts.emptyArray; _i < _a.length; _i++) {
+ var range = _a[_i];
var comment = sourceText.substring(range.pos, range.end);
extractPragmas(pragmas, range, comment);
}
context.pragmas = ts.createMap();
- for (var _i = 0, pragmas_1 = pragmas; _i < pragmas_1.length; _i++) {
- var pragma = pragmas_1[_i];
- if (context.pragmas.has(pragma.name)) { // TODO: GH#18217
+ for (var _b = 0, pragmas_1 = pragmas; _b < pragmas_1.length; _b++) {
+ var pragma = pragmas_1[_b];
+ if (context.pragmas.has(pragma.name)) {
var currentValue = context.pragmas.get(pragma.name);
if (currentValue instanceof Array) {
currentValue.push(pragma.args);
@@ -23396,7 +23553,6 @@
var typeReferenceDirectives_1 = context.typeReferenceDirectives;
var libReferenceDirectives_1 = context.libReferenceDirectives;
ts.forEach(ts.toArray(entryOrList), function (arg) {
- // TODO: GH#18217
var _a = arg.arguments, types = _a.types, lib = _a.lib, path = _a.path;
if (arg.arguments["no-default-lib"]) {
context.hasNoDefaultLib = true;
@@ -23417,7 +23573,7 @@
break;
}
case "amd-dependency": {
- context.amdDependencies = ts.map(ts.toArray(entryOrList), function (x) { return ({ name: x.arguments.name, path: x.arguments.path }); }); // TODO: GH#18217
+ context.amdDependencies = ts.map(ts.toArray(entryOrList), function (x) { return ({ name: x.arguments.name, path: x.arguments.path }); });
break;
}
case "amd-module": {
@@ -23440,7 +23596,7 @@
case "ts-check": {
// _last_ of either nocheck or check in a file is the "winner"
ts.forEach(ts.toArray(entryOrList), function (entry) {
- if (!context.checkJsDirective || entry.range.pos > context.checkJsDirective.pos) { // TODO: GH#18217
+ if (!context.checkJsDirective || entry.range.pos > context.checkJsDirective.pos) {
context.checkJsDirective = {
enabled: key === "ts-check",
end: entry.range.end,
@@ -23556,10 +23712,10 @@
if (lhs.kind !== rhs.kind) {
return false;
}
- if (lhs.kind === 72 /* Identifier */) {
+ if (lhs.kind === 73 /* Identifier */) {
return lhs.escapedText === rhs.escapedText;
}
- if (lhs.kind === 100 /* ThisKeyword */) {
+ if (lhs.kind === 101 /* ThisKeyword */) {
return true;
}
// If we are at this statement then we must have PropertyAccessExpression and because tag name in Jsx element can only
@@ -23588,6 +23744,7 @@
["es2017", "lib.es2017.d.ts"],
["es2018", "lib.es2018.d.ts"],
["es2019", "lib.es2019.d.ts"],
+ ["es2020", "lib.es2020.d.ts"],
["esnext", "lib.esnext.d.ts"],
// Host only
["dom", "lib.dom.d.ts"],
@@ -23616,8 +23773,11 @@
["es2018.promise", "lib.es2018.promise.d.ts"],
["es2018.regexp", "lib.es2018.regexp.d.ts"],
["es2019.array", "lib.es2019.array.d.ts"],
+ ["es2019.object", "lib.es2019.object.d.ts"],
["es2019.string", "lib.es2019.string.d.ts"],
["es2019.symbol", "lib.es2019.symbol.d.ts"],
+ ["es2020.string", "lib.es2020.string.d.ts"],
+ ["es2020.symbol.wellknown", "lib.es2020.symbol.wellknown.d.ts"],
["esnext.array", "lib.es2019.array.d.ts"],
["esnext.symbol", "lib.es2019.symbol.d.ts"],
["esnext.asynciterable", "lib.es2018.asynciterable.d.ts"],
@@ -23704,6 +23864,13 @@
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Show_verbose_diagnostic_information
},
+ {
+ name: "incremental",
+ shortName: "i",
+ type: "boolean",
+ category: ts.Diagnostics.Basic_Options,
+ description: ts.Diagnostics.Enable_incremental_compilation,
+ },
];
/* @internal */
ts.optionDeclarations = ts.commonOptionsWithBuild.concat([
@@ -23767,10 +23934,12 @@
es2017: 4 /* ES2017 */,
es2018: 5 /* ES2018 */,
es2019: 6 /* ES2019 */,
- esnext: 7 /* ESNext */,
+ es2020: 7 /* ES2020 */,
+ esnext: 8 /* ESNext */,
}),
affectsSourceFile: true,
affectsModuleResolution: true,
+ affectsEmit: true,
paramType: ts.Diagnostics.VERSION,
showInSimplifiedHelpView: true,
category: ts.Diagnostics.Basic_Options,
@@ -23838,6 +24007,7 @@
name: "declaration",
shortName: "d",
type: "boolean",
+ affectsEmit: true,
showInSimplifiedHelpView: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Generates_corresponding_d_ts_file,
@@ -23845,6 +24015,7 @@
{
name: "declarationMap",
type: "boolean",
+ affectsEmit: true,
showInSimplifiedHelpView: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Generates_a_sourcemap_for_each_corresponding_d_ts_file,
@@ -23852,12 +24023,14 @@
{
name: "emitDeclarationOnly",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Only_emit_d_ts_declaration_files,
},
{
name: "sourceMap",
type: "boolean",
+ affectsEmit: true,
showInSimplifiedHelpView: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Generates_corresponding_map_file,
@@ -23865,6 +24038,7 @@
{
name: "outFile",
type: "string",
+ affectsEmit: true,
isFilePath: true,
paramType: ts.Diagnostics.FILE,
showInSimplifiedHelpView: true,
@@ -23874,6 +24048,7 @@
{
name: "outDir",
type: "string",
+ affectsEmit: true,
isFilePath: true,
paramType: ts.Diagnostics.DIRECTORY,
showInSimplifiedHelpView: true,
@@ -23883,6 +24058,7 @@
{
name: "rootDir",
type: "string",
+ affectsEmit: true,
isFilePath: true,
paramType: ts.Diagnostics.LOCATION,
category: ts.Diagnostics.Basic_Options,
@@ -23891,29 +24067,24 @@
{
name: "composite",
type: "boolean",
+ affectsEmit: true,
isTSConfigOnly: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Enable_project_compilation,
},
{
- name: "incremental",
- type: "boolean",
- isTSConfigOnly: true,
- category: ts.Diagnostics.Basic_Options,
- description: ts.Diagnostics.Enable_incremental_compilation,
- },
- {
name: "tsBuildInfoFile",
type: "string",
+ affectsEmit: true,
isFilePath: true,
paramType: ts.Diagnostics.FILE,
- isTSConfigOnly: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Specify_file_to_store_incremental_compilation_information,
},
{
name: "removeComments",
type: "boolean",
+ affectsEmit: true,
showInSimplifiedHelpView: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Do_not_emit_comments_to_output,
@@ -23921,6 +24092,7 @@
{
name: "noEmit",
type: "boolean",
+ affectsEmit: true,
showInSimplifiedHelpView: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Do_not_emit_outputs,
@@ -23928,12 +24100,14 @@
{
name: "importHelpers",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Import_emit_helpers_from_tslib
},
{
name: "downlevelIteration",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Basic_Options,
description: ts.Diagnostics.Provide_full_support_for_iterables_in_for_of_spread_and_destructuring_when_targeting_ES5_or_ES3
},
@@ -24137,10 +24311,18 @@
category: ts.Diagnostics.Module_Resolution_Options,
description: ts.Diagnostics.Do_not_resolve_the_real_path_of_symlinks,
},
+ {
+ name: "allowUmdGlobalAccess",
+ type: "boolean",
+ affectsSemanticDiagnostics: true,
+ category: ts.Diagnostics.Module_Resolution_Options,
+ description: ts.Diagnostics.Allow_accessing_UMD_globals_from_modules,
+ },
// Source Maps
{
name: "sourceRoot",
type: "string",
+ affectsEmit: true,
paramType: ts.Diagnostics.LOCATION,
category: ts.Diagnostics.Source_Map_Options,
description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_TypeScript_files_instead_of_source_locations,
@@ -24148,6 +24330,7 @@
{
name: "mapRoot",
type: "string",
+ affectsEmit: true,
paramType: ts.Diagnostics.LOCATION,
category: ts.Diagnostics.Source_Map_Options,
description: ts.Diagnostics.Specify_the_location_where_debugger_should_locate_map_files_instead_of_generated_locations,
@@ -24155,12 +24338,14 @@
{
name: "inlineSourceMap",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Source_Map_Options,
description: ts.Diagnostics.Emit_a_single_file_with_source_maps_instead_of_having_a_separate_file
},
{
name: "inlineSources",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Source_Map_Options,
description: ts.Diagnostics.Emit_the_source_alongside_the_sourcemaps_within_a_single_file_requires_inlineSourceMap_or_sourceMap_to_be_set
},
@@ -24193,6 +24378,7 @@
{
name: "out",
type: "string",
+ affectsEmit: true,
isFilePath: false,
// for correct behaviour, please use outFile
category: ts.Diagnostics.Advanced_Options,
@@ -24202,6 +24388,7 @@
{
name: "reactNamespace",
type: "string",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Deprecated_Use_jsxFactory_instead_Specify_the_object_invoked_for_createElement_when_targeting_react_JSX_emit
},
@@ -24220,6 +24407,7 @@
{
name: "emitBOM",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Emit_a_UTF_8_Byte_Order_Mark_BOM_in_the_beginning_of_output_files
},
@@ -24235,6 +24423,7 @@
crlf: 0 /* CarriageReturnLineFeed */,
lf: 1 /* LineFeed */
}),
+ affectsEmit: true,
paramType: ts.Diagnostics.NEWLINE,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Specify_the_end_of_line_sequence_to_be_used_when_emitting_files_Colon_CRLF_dos_or_LF_unix,
@@ -24262,6 +24451,7 @@
{
name: "stripInternal",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Do_not_emit_declarations_for_code_that_has_an_internal_annotation,
},
@@ -24282,24 +24472,28 @@
{
name: "noEmitHelpers",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Do_not_generate_custom_helper_functions_like_extends_in_compiled_output
},
{
name: "noEmitOnError",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Do_not_emit_outputs_if_any_errors_were_reported,
},
{
name: "preserveConstEnums",
type: "boolean",
+ affectsEmit: true,
category: ts.Diagnostics.Advanced_Options,
description: ts.Diagnostics.Do_not_erase_const_enum_declarations_in_generated_code
},
{
name: "declarationDir",
type: "string",
+ affectsEmit: true,
isFilePath: true,
paramType: ts.Diagnostics.DIRECTORY,
category: ts.Diagnostics.Advanced_Options,
@@ -24382,6 +24576,8 @@
/* @internal */
ts.semanticDiagnosticsOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsSemanticDiagnostics; });
/* @internal */
+ ts.affectsEmitOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsEmit; });
+ /* @internal */
ts.moduleResolutionOptionDeclarations = ts.optionDeclarations.filter(function (option) { return !!option.affectsModuleResolution; });
/* @internal */
ts.sourceFileAffectingCompilerOptions = ts.optionDeclarations.filter(function (option) {
@@ -24789,7 +24985,7 @@
/**
* Reads the config file, reports errors if any and exits if the config file cannot be found
*/
- function getParsedCommandLineOfConfigFile(configFileName, optionsToExtend, host) {
+ function getParsedCommandLineOfConfigFile(configFileName, optionsToExtend, host, extendedConfigCache) {
var configFileText;
try {
configFileText = host.readFile(configFileName);
@@ -24809,7 +25005,9 @@
result.path = ts.toPath(configFileName, cwd, ts.createGetCanonicalFileName(host.useCaseSensitiveFileNames));
result.resolvedPath = result.path;
result.originalFileName = result.fileName;
- return parseJsonSourceFileConfigFileContent(result, host, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), cwd), optionsToExtend, ts.getNormalizedAbsolutePath(configFileName, cwd));
+ return parseJsonSourceFileConfigFileContent(result, host, ts.getNormalizedAbsolutePath(ts.getDirectoryPath(configFileName), cwd), optionsToExtend, ts.getNormalizedAbsolutePath(configFileName, cwd),
+ /*resolutionStack*/ undefined,
+ /*extraFileExtension*/ undefined, extendedConfigCache);
}
ts.getParsedCommandLineOfConfigFile = getParsedCommandLineOfConfigFile;
/**
@@ -24948,7 +25146,7 @@
var result = returnValue ? {} : undefined;
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var element = _a[_i];
- if (element.kind !== 275 /* PropertyAssignment */) {
+ if (element.kind !== 276 /* PropertyAssignment */) {
errors.push(ts.createDiagnosticForNodeInSourceFile(sourceFile, element, ts.Diagnostics.Property_assignment_expected));
continue;
}
@@ -25004,13 +25202,13 @@
}
function convertPropertyValueToJson(valueExpression, option) {
switch (valueExpression.kind) {
- case 102 /* TrueKeyword */:
+ case 103 /* TrueKeyword */:
reportInvalidOptionValue(option && option.type !== "boolean");
return true;
- case 87 /* FalseKeyword */:
+ case 88 /* FalseKeyword */:
reportInvalidOptionValue(option && option.type !== "boolean");
return false;
- case 96 /* NullKeyword */:
+ case 97 /* NullKeyword */:
reportInvalidOptionValue(option && option.name === "extends"); // "extends" is the only option we don't allow null/undefined for
return null; // tslint:disable-line:no-null-keyword
case 10 /* StringLiteral */:
@@ -25030,13 +25228,13 @@
case 8 /* NumericLiteral */:
reportInvalidOptionValue(option && option.type !== "number");
return Number(valueExpression.text);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
if (valueExpression.operator !== 39 /* MinusToken */ || valueExpression.operand.kind !== 8 /* NumericLiteral */) {
break; // not valid JSON syntax
}
reportInvalidOptionValue(option && option.type !== "number");
return -Number(valueExpression.operand.text);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
reportInvalidOptionValue(option && option.type !== "object");
var objectLiteralExpression = valueExpression;
// Currently having element option declaration in the tsconfig with type "object"
@@ -25053,7 +25251,7 @@
return convertObjectLiteralExpressionToJson(objectLiteralExpression, /* knownOptions*/ undefined,
/*extraKeyDiagnosticMessage */ undefined, /*parentOption*/ undefined);
}
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
reportInvalidOptionValue(option && option.type !== "list");
return convertArrayLiteralExpressionToJson(valueExpression.elements, option && option.element);
}
@@ -25309,8 +25507,8 @@
* @param basePath A root directory to resolve relative path entries in the config
* file to. e.g. outDir
*/
- function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) {
- return parseJsonConfigFileContentWorker(json, /*sourceFile*/ undefined, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions);
+ function parseJsonConfigFileContent(json, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache) {
+ return parseJsonConfigFileContentWorker(json, /*sourceFile*/ undefined, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache);
}
ts.parseJsonConfigFileContent = parseJsonConfigFileContent;
/**
@@ -25320,8 +25518,8 @@
* @param basePath A root directory to resolve relative path entries in the config
* file to. e.g. outDir
*/
- function parseJsonSourceFileConfigFileContent(sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) {
- return parseJsonConfigFileContentWorker(/*json*/ undefined, sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions);
+ function parseJsonSourceFileConfigFileContent(sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache) {
+ return parseJsonConfigFileContentWorker(/*json*/ undefined, sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache);
}
ts.parseJsonSourceFileConfigFileContent = parseJsonSourceFileConfigFileContent;
/*@internal*/
@@ -25349,13 +25547,13 @@
* file to. e.g. outDir
* @param resolutionStack Only present for backwards-compatibility. Should be empty.
*/
- function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions) {
+ function parseJsonConfigFileContentWorker(json, sourceFile, host, basePath, existingOptions, configFileName, resolutionStack, extraFileExtensions, extendedConfigCache) {
if (existingOptions === void 0) { existingOptions = {}; }
if (resolutionStack === void 0) { resolutionStack = []; }
if (extraFileExtensions === void 0) { extraFileExtensions = []; }
ts.Debug.assert((json === undefined && sourceFile !== undefined) || (json !== undefined && sourceFile === undefined));
var errors = [];
- var parsedConfig = parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors);
+ var parsedConfig = parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors, extendedConfigCache);
var raw = parsedConfig.raw;
var options = ts.extend(existingOptions, parsedConfig.options || {});
options.configFilePath = configFileName && ts.normalizeSlashes(configFileName);
@@ -25495,7 +25693,7 @@
* This *just* extracts options/include/exclude/files out of a config file.
* It does *not* resolve the included files.
*/
- function parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors) {
+ function parseConfig(json, sourceFile, host, basePath, configFileName, resolutionStack, errors, extendedConfigCache) {
basePath = ts.normalizeSlashes(basePath);
var resolvedPath = ts.getNormalizedAbsolutePath(configFileName || "", basePath);
if (resolutionStack.indexOf(resolvedPath) >= 0) {
@@ -25508,7 +25706,7 @@
if (ownConfig.extendedConfigPath) {
// copy the resolution stack so it is never reused between branches in potential diamond-problem scenarios.
resolutionStack = resolutionStack.concat([resolvedPath]);
- var extendedConfig = getExtendedConfig(sourceFile, ownConfig.extendedConfigPath, host, basePath, resolutionStack, errors);
+ var extendedConfig = getExtendedConfig(sourceFile, ownConfig.extendedConfigPath, host, basePath, resolutionStack, errors, extendedConfigCache);
if (extendedConfig && isSuccessfulParsedTsconfig(extendedConfig)) {
var baseRaw_1 = extendedConfig.raw;
var raw_1 = ownConfig.raw;
@@ -25605,7 +25803,7 @@
if (!host.fileExists(extendedConfigPath) && !ts.endsWith(extendedConfigPath, ".json" /* Json */)) {
extendedConfigPath = extendedConfigPath + ".json";
if (!host.fileExists(extendedConfigPath)) {
- errors.push(createDiagnostic(ts.Diagnostics.File_0_does_not_exist, extendedConfig));
+ errors.push(createDiagnostic(ts.Diagnostics.File_0_not_found, extendedConfig));
return undefined;
}
}
@@ -25616,24 +25814,23 @@
if (resolved.resolvedModule) {
return resolved.resolvedModule.resolvedFileName;
}
- errors.push(createDiagnostic(ts.Diagnostics.File_0_does_not_exist, extendedConfig));
+ errors.push(createDiagnostic(ts.Diagnostics.File_0_not_found, extendedConfig));
return undefined;
}
- function getExtendedConfig(sourceFile, extendedConfigPath, host, basePath, resolutionStack, errors) {
+ function getExtendedConfig(sourceFile, extendedConfigPath, host, basePath, resolutionStack, errors, extendedConfigCache) {
var _a;
- var extendedResult = readJsonConfigFile(extendedConfigPath, function (path) { return host.readFile(path); });
- if (sourceFile) {
- sourceFile.extendedSourceFiles = [extendedResult.fileName];
- }
- if (extendedResult.parseDiagnostics.length) {
- errors.push.apply(errors, extendedResult.parseDiagnostics);
- return undefined;
+ var path = host.useCaseSensitiveFileNames ? extendedConfigPath : ts.toLowerCase(extendedConfigPath);
+ var value;
+ var extendedResult;
+ var extendedConfig;
+ if (extendedConfigCache && (value = extendedConfigCache.get(path))) {
+ (extendedResult = value.extendedResult, extendedConfig = value.extendedConfig);
}
+ else {
+ extendedResult = readJsonConfigFile(extendedConfigPath, function (path) { return host.readFile(path); });
+ if (!extendedResult.parseDiagnostics.length) {
var extendedDirname = ts.getDirectoryPath(extendedConfigPath);
- var extendedConfig = parseConfig(/*json*/ undefined, extendedResult, host, extendedDirname, ts.getBaseFileName(extendedConfigPath), resolutionStack, errors);
- if (sourceFile && extendedResult.extendedSourceFiles) {
- (_a = sourceFile.extendedSourceFiles).push.apply(_a, extendedResult.extendedSourceFiles);
- }
+ extendedConfig = parseConfig(/*json*/ undefined, extendedResult, host, extendedDirname, ts.getBaseFileName(extendedConfigPath), resolutionStack, errors, extendedConfigCache);
if (isSuccessfulParsedTsconfig(extendedConfig)) {
// Update the paths to reflect base path
var relativeDifference_1 = ts.convertToRelativePath(extendedDirname, basePath, ts.identity);
@@ -25648,6 +25845,21 @@
mapPropertiesInRawIfNotUndefined("exclude");
mapPropertiesInRawIfNotUndefined("files");
}
+ }
+ if (extendedConfigCache) {
+ extendedConfigCache.set(path, { extendedResult: extendedResult, extendedConfig: extendedConfig });
+ }
+ }
+ if (sourceFile) {
+ sourceFile.extendedSourceFiles = [extendedResult.fileName];
+ if (extendedResult.extendedSourceFiles) {
+ (_a = sourceFile.extendedSourceFiles).push.apply(_a, extendedResult.extendedSourceFiles);
+ }
+ }
+ if (extendedResult.parseDiagnostics.length) {
+ errors.push.apply(errors, extendedResult.parseDiagnostics);
+ return undefined;
+ }
return extendedConfig;
}
function convertCompileOnSaveOptionFromJson(jsonOption, basePath, errors) {
@@ -26117,11 +26329,22 @@
return !!compilerOptions.traceResolution && host.trace !== undefined;
}
ts.isTraceEnabled = isTraceEnabled;
- function withPackageId(packageId, r) {
+ function withPackageId(packageInfo, r) {
+ var packageId;
+ if (r && packageInfo) {
+ var packageJsonContent = packageInfo.packageJsonContent;
+ if (typeof packageJsonContent.name === "string" && typeof packageJsonContent.version === "string") {
+ packageId = {
+ name: packageJsonContent.name,
+ subModuleName: r.path.slice(packageInfo.packageDirectory.length + ts.directorySeparator.length),
+ version: packageJsonContent.version
+ };
+ }
+ }
return r && { path: r.path, extension: r.ext, packageId: packageId };
}
function noPackageId(r) {
- return withPackageId(/*packageId*/ undefined, r);
+ return withPackageId(/*packageInfo*/ undefined, r);
}
function removeIgnoredPackageId(r) {
if (r) {
@@ -26173,8 +26396,15 @@
}
function readPackageJsonPathField(jsonContent, fieldName, baseDirectory, state) {
var fileName = readPackageJsonField(jsonContent, fieldName, "string", state);
- if (fileName === undefined)
+ if (fileName === undefined) {
return;
+ }
+ if (!fileName) {
+ if (state.traceEnabled) {
+ trace(state.host, ts.Diagnostics.package_json_had_a_falsy_0_field, fieldName);
+ }
+ return;
+ }
var path = ts.normalizePath(ts.combinePaths(baseDirectory, fileName));
if (state.traceEnabled) {
trace(state.host, ts.Diagnostics.package_json_has_0_field_1_that_references_2, fieldName, fileName, path);
@@ -26327,8 +26557,13 @@
var fileName = resolved.fileName, packageId = resolved.packageId;
var resolvedFileName = options.preserveSymlinks ? fileName : realPath(fileName, host, traceEnabled);
if (traceEnabled) {
+ if (packageId) {
+ trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_with_Package_ID_2_primary_Colon_3, typeReferenceDirectiveName, resolvedFileName, ts.packageIdToString(packageId), primary);
+ }
+ else {
trace(host, ts.Diagnostics.Type_reference_directive_0_was_successfully_resolved_to_1_primary_Colon_2, typeReferenceDirectiveName, resolvedFileName, primary);
}
+ }
resolvedTypeReferenceDirective = { primary: primary, resolvedFileName: resolvedFileName, packageId: packageId, isExternalLibraryImport: pathContainsNodeModules(fileName) };
}
return { resolvedTypeReferenceDirective: resolvedTypeReferenceDirective, failedLookupLocations: failedLookupLocations };
@@ -26429,20 +26664,28 @@
return result;
}
ts.getAutomaticTypeDirectiveNames = getAutomaticTypeDirectiveNames;
- function createModuleResolutionCache(currentDirectory, getCanonicalFileName) {
- return createModuleResolutionCacheWithMaps(createCacheWithRedirects(), createCacheWithRedirects(), currentDirectory, getCanonicalFileName);
+ function createModuleResolutionCache(currentDirectory, getCanonicalFileName, options) {
+ return createModuleResolutionCacheWithMaps(createCacheWithRedirects(options), createCacheWithRedirects(options), currentDirectory, getCanonicalFileName);
}
ts.createModuleResolutionCache = createModuleResolutionCache;
/*@internal*/
- function createCacheWithRedirects() {
+ function createCacheWithRedirects(options) {
var ownMap = ts.createMap();
var redirectsMap = ts.createMap();
return {
ownMap: ownMap,
redirectsMap: redirectsMap,
getOrCreateMapOfCacheRedirects: getOrCreateMapOfCacheRedirects,
- clear: clear
+ clear: clear,
+ setOwnOptions: setOwnOptions,
+ setOwnMap: setOwnMap
};
+ function setOwnOptions(newOptions) {
+ options = newOptions;
+ }
+ function setOwnMap(newOwnMap) {
+ ownMap = newOwnMap;
+ }
function getOrCreateMapOfCacheRedirects(redirectedReference) {
if (!redirectedReference) {
return ownMap;
@@ -26450,7 +26693,8 @@
var path = redirectedReference.sourceFile.path;
var redirects = redirectsMap.get(path);
if (!redirects) {
- redirects = ts.createMap();
+ // Reuse map if redirected reference map uses same resolution
+ redirects = !options || ts.optionsHaveModuleResolutionChanges(options, redirectedReference.commandLine.options) ? ts.createMap() : ownMap;
redirectsMap.set(path, redirects);
}
return redirects;
@@ -26463,7 +26707,7 @@
ts.createCacheWithRedirects = createCacheWithRedirects;
/*@internal*/
function createModuleResolutionCacheWithMaps(directoryToModuleNameMap, moduleNameToDirectoryMap, currentDirectory, getCanonicalFileName) {
- return { getOrCreateCacheForDirectory: getOrCreateCacheForDirectory, getOrCreateCacheForModuleName: getOrCreateCacheForModuleName };
+ return { getOrCreateCacheForDirectory: getOrCreateCacheForDirectory, getOrCreateCacheForModuleName: getOrCreateCacheForModuleName, directoryToModuleNameMap: directoryToModuleNameMap, moduleNameToDirectoryMap: moduleNameToDirectoryMap };
function getOrCreateCacheForDirectory(directoryName, redirectedReference) {
var path = ts.toPath(directoryName, currentDirectory, getCanonicalFileName);
return getOrCreateCache(directoryToModuleNameMap, redirectedReference, path, ts.createMap);
@@ -26606,8 +26850,13 @@
}
if (traceEnabled) {
if (result.resolvedModule) {
+ if (result.resolvedModule.packageId) {
+ trace(host, ts.Diagnostics.Module_name_0_was_successfully_resolved_to_1_with_Package_ID_2, moduleName, result.resolvedModule.resolvedFileName, ts.packageIdToString(result.resolvedModule.packageId));
+ }
+ else {
trace(host, ts.Diagnostics.Module_name_0_was_successfully_resolved_to_1, moduleName, result.resolvedModule.resolvedFileName);
}
+ }
else {
trace(host, ts.Diagnostics.Module_name_0_was_not_resolved, moduleName);
}
@@ -26876,10 +27125,9 @@
}
var resolvedFromFile = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state);
if (resolvedFromFile) {
- var nm = considerPackageJson ? parseNodeModuleFromPath(resolvedFromFile) : undefined;
- var packageInfo = nm && getPackageJsonInfo(nm.packageDirectory, nm.subModuleName, /*onlyRecordFailures*/ false, state);
- var packageId = packageInfo && packageInfo.packageId;
- return withPackageId(packageId, resolvedFromFile);
+ var packageDirectory = considerPackageJson ? parseNodeModuleFromPath(resolvedFromFile) : undefined;
+ var packageInfo = packageDirectory ? getPackageJsonInfo(packageDirectory, /*onlyRecordFailures*/ false, state) : undefined;
+ return withPackageId(packageInfo, resolvedFromFile);
}
}
if (!onlyRecordFailures) {
@@ -26905,11 +27153,10 @@
* (Not neeeded for `loadModuleFromNodeModules` as that looks up the `package.json` as part of resolution.)
*
* packageDirectory is the directory of the package itself.
- * subModuleName is the path within the package.
- * For `blah/node_modules/foo/index.d.ts` this is { packageDirectory: "foo", subModuleName: "index.d.ts" }. (Part before "/node_modules/" is ignored.)
- * For `/node_modules/foo/bar.d.ts` this is { packageDirectory: "foo", subModuleName": "bar/index.d.ts" }.
- * For `/node_modules/@types/foo/bar/index.d.ts` this is { packageDirectory: "@types/foo", subModuleName: "bar/index.d.ts" }.
- * For `/node_modules/foo/bar/index.d.ts` this is { packageDirectory: "foo", subModuleName": "bar/index.d.ts" }.
+ * For `blah/node_modules/foo/index.d.ts` this is packageDirectory: "foo"
+ * For `/node_modules/foo/bar.d.ts` this is packageDirectory: "foo"
+ * For `/node_modules/@types/foo/bar/index.d.ts` this is packageDirectory: "@types/foo"
+ * For `/node_modules/foo/bar/index.d.ts` this is packageDirectory: "foo"
*/
function parseNodeModuleFromPath(resolved) {
var path = ts.normalizePath(resolved.path);
@@ -26922,26 +27169,12 @@
if (path.charCodeAt(indexAfterNodeModules) === 64 /* at */) {
indexAfterPackageName = moveToNextDirectorySeparatorIfAvailable(path, indexAfterPackageName);
}
- var packageDirectory = path.slice(0, indexAfterPackageName);
- var subModuleName = ts.removeExtension(path.slice(indexAfterPackageName + 1), resolved.ext) + ".d.ts" /* Dts */;
- return { packageDirectory: packageDirectory, subModuleName: subModuleName };
+ return path.slice(0, indexAfterPackageName);
}
function moveToNextDirectorySeparatorIfAvailable(path, prevSeparatorIndex) {
var nextSeparatorIndex = path.indexOf(ts.directorySeparator, prevSeparatorIndex + 1);
return nextSeparatorIndex === -1 ? prevSeparatorIndex : nextSeparatorIndex;
}
- function addExtensionAndIndex(path) {
- if (path === "") {
- return "index.d.ts";
- }
- if (ts.endsWith(path, ".d.ts")) {
- return path;
- }
- if (path === "index" || ts.endsWith(path, "/index")) {
- return path + ".d.ts";
- }
- return path + "/index.d.ts";
- }
function loadModuleFromFileNoPackageId(extensions, candidate, onlyRecordFailures, state) {
return noPackageId(loadModuleFromFile(extensions, candidate, onlyRecordFailures, state));
}
@@ -27015,52 +27248,22 @@
}
function loadNodeModuleFromDirectory(extensions, candidate, onlyRecordFailures, state, considerPackageJson) {
if (considerPackageJson === void 0) { considerPackageJson = true; }
- var packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, "", onlyRecordFailures, state) : undefined;
- var packageId = packageInfo && packageInfo.packageId;
+ var packageInfo = considerPackageJson ? getPackageJsonInfo(candidate, onlyRecordFailures, state) : undefined;
var packageJsonContent = packageInfo && packageInfo.packageJsonContent;
- var versionPaths = packageJsonContent && readPackageJsonTypesVersionPaths(packageJsonContent, state);
- return withPackageId(packageId, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths));
+ var versionPaths = packageInfo && packageInfo.versionPaths;
+ return withPackageId(packageInfo, loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths));
}
- function getPackageJsonInfo(packageDirectory, subModuleName, onlyRecordFailures, state) {
+ function getPackageJsonInfo(packageDirectory, onlyRecordFailures, state) {
var host = state.host, traceEnabled = state.traceEnabled;
var directoryExists = !onlyRecordFailures && ts.directoryProbablyExists(packageDirectory, host);
var packageJsonPath = ts.combinePaths(packageDirectory, "package.json");
if (directoryExists && host.fileExists(packageJsonPath)) {
var packageJsonContent = ts.readJson(packageJsonPath, host);
- if (subModuleName === "") { // looking up the root - need to handle types/typings/main redirects for subModuleName
- var path = readPackageJsonTypesFields(packageJsonContent, packageDirectory, state);
- if (typeof path === "string") {
- subModuleName = addExtensionAndIndex(path.substring(packageDirectory.length + 1));
- }
- else {
- var jsPath = readPackageJsonMainField(packageJsonContent, packageDirectory, state);
- if (typeof jsPath === "string" && jsPath.length > packageDirectory.length) {
- var potentialSubModule_1 = jsPath.substring(packageDirectory.length + 1);
- subModuleName = (ts.forEach(ts.supportedJSExtensions, function (extension) {
- return ts.tryRemoveExtension(potentialSubModule_1, extension);
- }) || potentialSubModule_1) + ".d.ts" /* Dts */;
- }
- else {
- subModuleName = "index.d.ts";
- }
- }
- }
- if (!ts.endsWith(subModuleName, ".d.ts" /* Dts */)) {
- subModuleName = addExtensionAndIndex(subModuleName);
- }
- var versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state);
- var packageId = typeof packageJsonContent.name === "string" && typeof packageJsonContent.version === "string"
- ? { name: packageJsonContent.name, subModuleName: subModuleName, version: packageJsonContent.version }
- : undefined;
if (traceEnabled) {
- if (packageId) {
- trace(host, ts.Diagnostics.Found_package_json_at_0_Package_ID_is_1, packageJsonPath, ts.packageIdToString(packageId));
- }
- else {
trace(host, ts.Diagnostics.Found_package_json_at_0, packageJsonPath);
}
- }
- return { packageJsonContent: packageJsonContent, packageId: packageId, versionPaths: versionPaths };
+ var versionPaths = readPackageJsonTypesVersionPaths(packageJsonContent, state);
+ return { packageDirectory: packageDirectory, packageJsonContent: packageJsonContent, versionPaths: versionPaths };
}
else {
if (directoryExists && traceEnabled) {
@@ -27199,37 +27402,31 @@
function loadModuleFromSpecificNodeModulesDirectory(extensions, moduleName, nodeModulesDirectory, nodeModulesDirectoryExists, state) {
var candidate = ts.normalizePath(ts.combinePaths(nodeModulesDirectory, moduleName));
// First look for a nested package.json, as in `node_modules/foo/bar/package.json`.
- var packageJsonContent;
- var packageId;
- var versionPaths;
- var packageInfo = getPackageJsonInfo(candidate, "", !nodeModulesDirectoryExists, state);
+ var packageInfo = getPackageJsonInfo(candidate, !nodeModulesDirectoryExists, state);
if (packageInfo) {
- (packageJsonContent = packageInfo.packageJsonContent, packageId = packageInfo.packageId, versionPaths = packageInfo.versionPaths);
var fromFile = loadModuleFromFile(extensions, candidate, !nodeModulesDirectoryExists, state);
if (fromFile) {
return noPackageId(fromFile);
}
- var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageJsonContent, versionPaths);
- return withPackageId(packageId, fromDirectory);
+ var fromDirectory = loadNodeModuleFromDirectoryWorker(extensions, candidate, !nodeModulesDirectoryExists, state, packageInfo.packageJsonContent, packageInfo.versionPaths);
+ return withPackageId(packageInfo, fromDirectory);
}
var loader = function (extensions, candidate, onlyRecordFailures, state) {
var pathAndExtension = loadModuleFromFile(extensions, candidate, onlyRecordFailures, state) ||
- loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageJsonContent, versionPaths);
- return withPackageId(packageId, pathAndExtension);
+ loadNodeModuleFromDirectoryWorker(extensions, candidate, onlyRecordFailures, state, packageInfo && packageInfo.packageJsonContent, packageInfo && packageInfo.versionPaths);
+ return withPackageId(packageInfo, pathAndExtension);
};
var _a = parsePackageName(moduleName), packageName = _a.packageName, rest = _a.rest;
if (rest !== "") { // If "rest" is empty, we just did this search above.
var packageDirectory = ts.combinePaths(nodeModulesDirectory, packageName);
// Don't use a "types" or "main" from here because we're not loading the root, but a subdirectory -- just here for the packageId and path mappings.
- var packageInfo_1 = getPackageJsonInfo(packageDirectory, rest, !nodeModulesDirectoryExists, state);
- if (packageInfo_1)
- (packageId = packageInfo_1.packageId, versionPaths = packageInfo_1.versionPaths);
- if (versionPaths) {
+ packageInfo = getPackageJsonInfo(packageDirectory, !nodeModulesDirectoryExists, state);
+ if (packageInfo && packageInfo.versionPaths) {
if (state.traceEnabled) {
- trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, versionPaths.version, ts.version, rest);
+ trace(state.host, ts.Diagnostics.package_json_has_a_typesVersions_entry_0_that_matches_compiler_version_1_looking_for_a_pattern_to_match_module_name_2, packageInfo.versionPaths.version, ts.version, rest);
}
var packageDirectoryExists = nodeModulesDirectoryExists && ts.directoryProbablyExists(packageDirectory, state.host);
- var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, versionPaths.paths, loader, !packageDirectoryExists, state);
+ var fromPaths = tryLoadModuleUsingPaths(extensions, rest, packageDirectory, packageInfo.versionPaths.paths, loader, !packageDirectoryExists, state);
if (fromPaths) {
return fromPaths.value;
}
@@ -27397,24 +27594,24 @@
// A module is uninstantiated if it contains only
switch (node.kind) {
// 1. interface declarations, type alias declarations
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return 0 /* NonInstantiated */;
// 2. const enum declarations
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
if (ts.isEnumConst(node)) {
return 2 /* ConstEnumOnly */;
}
break;
// 3. non-exported import declarations
- case 249 /* ImportDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
if (!(ts.hasModifier(node, 1 /* Export */))) {
return 0 /* NonInstantiated */;
}
break;
// 4. other uninstantiated module declarations.
- case 245 /* ModuleBlock */: {
+ case 246 /* ModuleBlock */: {
var state_1 = 0 /* NonInstantiated */;
ts.forEachChild(node, function (n) {
var childState = getModuleInstanceStateWorker(n);
@@ -27436,9 +27633,9 @@
});
return state_1;
}
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return getModuleInstanceState(node);
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
// Only jsdoc typedef definition can exist in jsdoc namespace, and it should
// be considered the same as type alias
if (node.isInJSDocNamespace) {
@@ -27604,7 +27801,7 @@
// Should not be called on a declaration with a computed property name,
// unless it is a well known Symbol.
function getDeclarationName(node) {
- if (node.kind === 254 /* ExportAssignment */) {
+ if (node.kind === 255 /* ExportAssignment */) {
return node.isExportEquals ? "export=" /* ExportEquals */ : "default" /* Default */;
}
var name = ts.getNameOfDeclaration(node);
@@ -27613,7 +27810,7 @@
var moduleName = ts.getTextOfIdentifierOrLiteral(name);
return (ts.isGlobalScopeAugmentation(node) ? "__global" : "\"" + moduleName + "\"");
}
- if (name.kind === 149 /* ComputedPropertyName */) {
+ if (name.kind === 150 /* ComputedPropertyName */) {
var nameExpression = name.expression;
// treat computed property names where expression is string/numeric literal as just string/numeric literal
if (ts.isStringOrNumericLiteralLike(nameExpression)) {
@@ -27625,36 +27822,36 @@
return ts.isPropertyNameLiteral(name) ? ts.getEscapedTextOfIdentifierOrLiteral(name) : undefined;
}
switch (node.kind) {
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return "__constructor" /* Constructor */;
- case 165 /* FunctionType */:
- case 160 /* CallSignature */:
- case 298 /* JSDocSignature */:
+ case 166 /* FunctionType */:
+ case 161 /* CallSignature */:
+ case 299 /* JSDocSignature */:
return "__call" /* Call */;
- case 166 /* ConstructorType */:
- case 161 /* ConstructSignature */:
+ case 167 /* ConstructorType */:
+ case 162 /* ConstructSignature */:
return "__new" /* New */;
- case 162 /* IndexSignature */:
+ case 163 /* IndexSignature */:
return "__index" /* Index */;
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return "__export" /* ExportStar */;
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
// json file should behave as
// module.exports = ...
return "export=" /* ExportEquals */;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
if (ts.getAssignmentDeclarationKind(node) === 2 /* ModuleExports */) {
// module.exports = ...
return "export=" /* ExportEquals */;
}
ts.Debug.fail("Unknown binary declaration kind");
break;
- case 294 /* JSDocFunctionType */:
+ case 295 /* JSDocFunctionType */:
return (ts.isJSDocConstructSignature(node) ? "__new" /* New */ : "__call" /* Call */);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
// Parameters with names are handled at the top of this function. Parameters
// without names can only come from JSDocFunctionTypes.
- ts.Debug.assert(node.parent.kind === 294 /* JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: " + (ts.SyntaxKind ? ts.SyntaxKind[node.parent.kind] : node.parent.kind) + ", expected JSDocFunctionType"; });
+ ts.Debug.assert(node.parent.kind === 295 /* JSDocFunctionType */, "Impossible parameter parent kind", function () { return "parent is: " + (ts.SyntaxKind ? ts.SyntaxKind[node.parent.kind] : node.parent.kind) + ", expected JSDocFunctionType"; });
var functionType = node.parent;
var index = functionType.parameters.indexOf(node);
return "arg" + index;
@@ -27754,7 +27951,7 @@
// 1. multiple export default of class declaration or function declaration by checking NodeFlags.Default
// 2. multiple export default of export assignment. This one doesn't have NodeFlags.Default on (as export default doesn't considered as modifiers)
if (symbol.declarations && symbol.declarations.length &&
- (node.kind === 254 /* ExportAssignment */ && !node.isExportEquals)) {
+ (node.kind === 255 /* ExportAssignment */ && !node.isExportEquals)) {
message_1 = ts.Diagnostics.A_module_cannot_have_multiple_default_exports;
messageNeedsName_1 = false;
multipleDefaultExports_1 = true;
@@ -27789,7 +27986,7 @@
function declareModuleMember(node, symbolFlags, symbolExcludes) {
var hasExportModifier = ts.getCombinedModifierFlags(node) & 1 /* Export */;
if (symbolFlags & 2097152 /* Alias */) {
- if (node.kind === 257 /* ExportSpecifier */ || (node.kind === 248 /* ImportEqualsDeclaration */ && hasExportModifier)) {
+ if (node.kind === 258 /* ExportSpecifier */ || (node.kind === 249 /* ImportEqualsDeclaration */ && hasExportModifier)) {
return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
}
else {
@@ -27856,7 +28053,7 @@
// for it. We must clear this so we don't accidentally move any stale data forward from
// a previous compilation.
if (containerFlags & 1 /* IsContainer */) {
- if (node.kind !== 197 /* ArrowFunction */) {
+ if (node.kind !== 198 /* ArrowFunction */) {
thisParentContainer = container;
}
container = blockScopeContainer = node;
@@ -27889,7 +28086,7 @@
}
// We create a return control flow graph for IIFEs and constructors. For constructors
// we use the return control flow graph in strict property initialization checks.
- currentReturnTarget = isIIFE || node.kind === 157 /* Constructor */ ? createBranchLabel() : undefined;
+ currentReturnTarget = isIIFE || node.kind === 158 /* Constructor */ ? createBranchLabel() : undefined;
currentBreakTarget = undefined;
currentContinueTarget = undefined;
activeLabels = undefined;
@@ -27903,13 +28100,13 @@
if (hasExplicitReturn)
node.flags |= 256 /* HasExplicitReturn */;
}
- if (node.kind === 284 /* SourceFile */) {
+ if (node.kind === 285 /* SourceFile */) {
node.flags |= emitFlags;
}
if (currentReturnTarget) {
addAntecedent(currentReturnTarget, currentFlow);
currentFlow = finishFlowLabel(currentReturnTarget);
- if (node.kind === 157 /* Constructor */) {
+ if (node.kind === 158 /* Constructor */) {
node.returnFlowNode = currentFlow;
}
}
@@ -27953,8 +28150,8 @@
}
}
function bindEachFunctionsFirst(nodes) {
- bindEach(nodes, function (n) { return n.kind === 239 /* FunctionDeclaration */ ? bind(n) : undefined; });
- bindEach(nodes, function (n) { return n.kind !== 239 /* FunctionDeclaration */ ? bind(n) : undefined; });
+ bindEach(nodes, function (n) { return n.kind === 240 /* FunctionDeclaration */ ? bind(n) : undefined; });
+ bindEach(nodes, function (n) { return n.kind !== 240 /* FunctionDeclaration */ ? bind(n) : undefined; });
}
function bindEach(nodes, bindFunction) {
if (bindFunction === void 0) { bindFunction = bind; }
@@ -27987,78 +28184,78 @@
return;
}
switch (node.kind) {
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
bindWhileStatement(node);
break;
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
bindDoStatement(node);
break;
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
bindForStatement(node);
break;
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
bindForInOrForOfStatement(node);
break;
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
bindIfStatement(node);
break;
- case 230 /* ReturnStatement */:
- case 234 /* ThrowStatement */:
+ case 231 /* ReturnStatement */:
+ case 235 /* ThrowStatement */:
bindReturnOrThrow(node);
break;
- case 229 /* BreakStatement */:
- case 228 /* ContinueStatement */:
+ case 230 /* BreakStatement */:
+ case 229 /* ContinueStatement */:
bindBreakOrContinueStatement(node);
break;
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
bindTryStatement(node);
break;
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
bindSwitchStatement(node);
break;
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
bindCaseBlock(node);
break;
- case 271 /* CaseClause */:
+ case 272 /* CaseClause */:
bindCaseClause(node);
break;
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
bindLabeledStatement(node);
break;
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
bindPrefixUnaryExpressionFlow(node);
break;
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
bindPostfixUnaryExpressionFlow(node);
break;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
bindBinaryExpressionFlow(node);
break;
- case 198 /* DeleteExpression */:
+ case 199 /* DeleteExpression */:
bindDeleteExpressionFlow(node);
break;
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
bindConditionalExpressionFlow(node);
break;
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
bindVariableDeclarationFlow(node);
break;
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
bindCallExpressionFlow(node);
break;
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
bindJSDocTypeAlias(node);
break;
// In source files and blocks, bind functions first to match hoisting that occurs at runtime
- case 284 /* SourceFile */: {
+ case 285 /* SourceFile */: {
bindEachFunctionsFirst(node.statements);
bind(node.endOfFileToken);
break;
}
- case 218 /* Block */:
- case 245 /* ModuleBlock */:
+ case 219 /* Block */:
+ case 246 /* ModuleBlock */:
bindEachFunctionsFirst(node.statements);
break;
default:
@@ -28069,26 +28266,26 @@
}
function isNarrowingExpression(expr) {
switch (expr.kind) {
- case 72 /* Identifier */:
- case 100 /* ThisKeyword */:
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 73 /* Identifier */:
+ case 101 /* ThisKeyword */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return isNarrowableReference(expr);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return hasNarrowableArgument(expr);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return isNarrowingExpression(expr.expression);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return isNarrowingBinaryExpression(expr);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return expr.operator === 52 /* ExclamationToken */ && isNarrowingExpression(expr.operand);
- case 199 /* TypeOfExpression */:
+ case 200 /* TypeOfExpression */:
return isNarrowingExpression(expr.expression);
}
return false;
}
function isNarrowableReference(expr) {
- return expr.kind === 72 /* Identifier */ || expr.kind === 100 /* ThisKeyword */ || expr.kind === 98 /* SuperKeyword */ ||
+ return expr.kind === 73 /* Identifier */ || expr.kind === 101 /* ThisKeyword */ || expr.kind === 99 /* SuperKeyword */ ||
(ts.isPropertyAccessExpression(expr) || ts.isNonNullExpression(expr) || ts.isParenthesizedExpression(expr)) && isNarrowableReference(expr.expression) ||
ts.isElementAccessExpression(expr) && expr.argumentExpression &&
(ts.isStringLiteral(expr.argumentExpression) || ts.isNumericLiteral(expr.argumentExpression)) &&
@@ -28103,7 +28300,7 @@
}
}
}
- if (expr.expression.kind === 189 /* PropertyAccessExpression */ &&
+ if (expr.expression.kind === 190 /* PropertyAccessExpression */ &&
isNarrowableReference(expr.expression.expression)) {
return true;
}
@@ -28117,7 +28314,7 @@
}
function isNarrowingBinaryExpression(expr) {
switch (expr.operatorToken.kind) {
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
return isNarrowableReference(expr.left);
case 33 /* EqualsEqualsToken */:
case 34 /* ExclamationEqualsToken */:
@@ -28125,9 +28322,9 @@
case 36 /* ExclamationEqualsEqualsToken */:
return isNarrowableOperand(expr.left) || isNarrowableOperand(expr.right) ||
isNarrowingTypeofOperands(expr.right, expr.left) || isNarrowingTypeofOperands(expr.left, expr.right);
- case 94 /* InstanceOfKeyword */:
+ case 95 /* InstanceOfKeyword */:
return isNarrowableOperand(expr.left);
- case 93 /* InKeyword */:
+ case 94 /* InKeyword */:
return isNarrowableInOperands(expr.left, expr.right);
case 27 /* CommaToken */:
return isNarrowingExpression(expr.right);
@@ -28136,11 +28333,11 @@
}
function isNarrowableOperand(expr) {
switch (expr.kind) {
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return isNarrowableOperand(expr.expression);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
switch (expr.operatorToken.kind) {
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
return isNarrowableOperand(expr.left);
case 27 /* CommaToken */:
return isNarrowableOperand(expr.right);
@@ -28177,8 +28374,8 @@
if (!expression) {
return flags & 32 /* TrueCondition */ ? antecedent : unreachableFlow;
}
- if (expression.kind === 102 /* TrueKeyword */ && flags & 64 /* FalseCondition */ ||
- expression.kind === 87 /* FalseKeyword */ && flags & 32 /* TrueCondition */) {
+ if (expression.kind === 103 /* TrueKeyword */ && flags & 64 /* FalseCondition */ ||
+ expression.kind === 88 /* FalseKeyword */ && flags & 32 /* TrueCondition */) {
return unreachableFlow;
}
if (!isNarrowingExpression(expression)) {
@@ -28216,33 +28413,33 @@
function isStatementCondition(node) {
var parent = node.parent;
switch (parent.kind) {
- case 222 /* IfStatement */:
- case 224 /* WhileStatement */:
- case 223 /* DoStatement */:
+ case 223 /* IfStatement */:
+ case 225 /* WhileStatement */:
+ case 224 /* DoStatement */:
return parent.expression === node;
- case 225 /* ForStatement */:
- case 205 /* ConditionalExpression */:
+ case 226 /* ForStatement */:
+ case 206 /* ConditionalExpression */:
return parent.condition === node;
}
return false;
}
function isLogicalExpression(node) {
while (true) {
- if (node.kind === 195 /* ParenthesizedExpression */) {
+ if (node.kind === 196 /* ParenthesizedExpression */) {
node = node.expression;
}
- else if (node.kind === 202 /* PrefixUnaryExpression */ && node.operator === 52 /* ExclamationToken */) {
+ else if (node.kind === 203 /* PrefixUnaryExpression */ && node.operator === 52 /* ExclamationToken */) {
node = node.operand;
}
else {
- return node.kind === 204 /* BinaryExpression */ && (node.operatorToken.kind === 54 /* AmpersandAmpersandToken */ ||
+ return node.kind === 205 /* BinaryExpression */ && (node.operatorToken.kind === 54 /* AmpersandAmpersandToken */ ||
node.operatorToken.kind === 55 /* BarBarToken */);
}
}
}
function isTopLevelLogicalExpression(node) {
- while (node.parent.kind === 195 /* ParenthesizedExpression */ ||
- node.parent.kind === 202 /* PrefixUnaryExpression */ &&
+ while (node.parent.kind === 196 /* ParenthesizedExpression */ ||
+ node.parent.kind === 203 /* PrefixUnaryExpression */ &&
node.parent.operator === 52 /* ExclamationToken */) {
node = node.parent;
}
@@ -28284,7 +28481,7 @@
}
function bindDoStatement(node) {
var preDoLabel = createLoopLabel();
- var enclosingLabeledStatement = node.parent.kind === 233 /* LabeledStatement */
+ var enclosingLabeledStatement = node.parent.kind === 234 /* LabeledStatement */
? ts.lastOrUndefined(activeLabels)
: undefined;
// if do statement is wrapped in labeled statement then target labels for break/continue with or without
@@ -28318,13 +28515,13 @@
var postLoopLabel = createBranchLabel();
addAntecedent(preLoopLabel, currentFlow);
currentFlow = preLoopLabel;
- if (node.kind === 227 /* ForOfStatement */) {
+ if (node.kind === 228 /* ForOfStatement */) {
bind(node.awaitModifier);
}
bind(node.expression);
addAntecedent(postLoopLabel, currentFlow);
bind(node.initializer);
- if (node.initializer.kind !== 238 /* VariableDeclarationList */) {
+ if (node.initializer.kind !== 239 /* VariableDeclarationList */) {
bindAssignmentTargetFlow(node.initializer);
}
bindIterativeStatement(node.statement, postLoopLabel, preLoopLabel);
@@ -28346,7 +28543,7 @@
}
function bindReturnOrThrow(node) {
bind(node.expression);
- if (node.kind === 230 /* ReturnStatement */) {
+ if (node.kind === 231 /* ReturnStatement */) {
hasExplicitReturn = true;
if (currentReturnTarget) {
addAntecedent(currentReturnTarget, currentFlow);
@@ -28366,7 +28563,7 @@
return undefined;
}
function bindBreakOrContinueFlow(node, breakTarget, continueTarget) {
- var flowLabel = node.kind === 229 /* BreakStatement */ ? breakTarget : continueTarget;
+ var flowLabel = node.kind === 230 /* BreakStatement */ ? breakTarget : continueTarget;
if (flowLabel) {
addAntecedent(flowLabel, currentFlow);
currentFlow = unreachableFlow;
@@ -28494,7 +28691,7 @@
preSwitchCaseFlow = currentFlow;
bind(node.caseBlock);
addAntecedent(postSwitchLabel, currentFlow);
- var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 272 /* DefaultClause */; });
+ var hasDefault = ts.forEach(node.caseBlock.clauses, function (c) { return c.kind === 273 /* DefaultClause */; });
// We mark a switch statement as possibly exhaustive if it has no default clause and if all
// case clauses have unreachable end points (e.g. they all return).
node.possiblyExhaustive = !hasDefault && !postSwitchLabel.antecedents;
@@ -28561,14 +28758,14 @@
if (!activeLabel.referenced && !options.allowUnusedLabels) {
errorOrSuggestionOnNode(ts.unusedLabelIsError(options), node.label, ts.Diagnostics.Unused_label);
}
- if (!node.statement || node.statement.kind !== 223 /* DoStatement */) {
+ if (!node.statement || node.statement.kind !== 224 /* DoStatement */) {
// do statement sets current flow inside bindDoStatement
addAntecedent(postStatementLabel, currentFlow);
currentFlow = finishFlowLabel(postStatementLabel);
}
}
function bindDestructuringTargetFlow(node) {
- if (node.kind === 204 /* BinaryExpression */ && node.operatorToken.kind === 59 /* EqualsToken */) {
+ if (node.kind === 205 /* BinaryExpression */ && node.operatorToken.kind === 60 /* EqualsToken */) {
bindAssignmentTargetFlow(node.left);
}
else {
@@ -28579,10 +28776,10 @@
if (isNarrowableReference(node)) {
currentFlow = createFlowAssignment(currentFlow, node);
}
- else if (node.kind === 187 /* ArrayLiteralExpression */) {
+ else if (node.kind === 188 /* ArrayLiteralExpression */) {
for (var _i = 0, _a = node.elements; _i < _a.length; _i++) {
var e = _a[_i];
- if (e.kind === 208 /* SpreadElement */) {
+ if (e.kind === 209 /* SpreadElement */) {
bindAssignmentTargetFlow(e.expression);
}
else {
@@ -28590,16 +28787,16 @@
}
}
}
- else if (node.kind === 188 /* ObjectLiteralExpression */) {
+ else if (node.kind === 189 /* ObjectLiteralExpression */) {
for (var _b = 0, _c = node.properties; _b < _c.length; _b++) {
var p = _c[_b];
- if (p.kind === 275 /* PropertyAssignment */) {
+ if (p.kind === 276 /* PropertyAssignment */) {
bindDestructuringTargetFlow(p.initializer);
}
- else if (p.kind === 276 /* ShorthandPropertyAssignment */) {
+ else if (p.kind === 277 /* ShorthandPropertyAssignment */) {
bindAssignmentTargetFlow(p.name);
}
- else if (p.kind === 277 /* SpreadAssignment */) {
+ else if (p.kind === 278 /* SpreadAssignment */) {
bindAssignmentTargetFlow(p.expression);
}
}
@@ -28655,7 +28852,7 @@
bindEachChild(node);
if (ts.isAssignmentOperator(operator) && !ts.isAssignmentTarget(node)) {
bindAssignmentTargetFlow(node.left);
- if (operator === 59 /* EqualsToken */ && node.left.kind === 190 /* ElementAccessExpression */) {
+ if (operator === 60 /* EqualsToken */ && node.left.kind === 191 /* ElementAccessExpression */) {
var elementAccess = node.left;
if (isNarrowableOperand(elementAccess.expression)) {
currentFlow = createFlowArrayMutation(currentFlow, node);
@@ -28666,7 +28863,7 @@
}
function bindDeleteExpressionFlow(node) {
bindEachChild(node);
- if (node.expression.kind === 189 /* PropertyAccessExpression */) {
+ if (node.expression.kind === 190 /* PropertyAccessExpression */) {
bindAssignmentTargetFlow(node.expression);
}
}
@@ -28714,10 +28911,10 @@
// an immediately invoked function expression (IIFE). Initialize the flowNode property to
// the current control flow (which includes evaluation of the IIFE arguments).
var expr = node.expression;
- while (expr.kind === 195 /* ParenthesizedExpression */) {
+ while (expr.kind === 196 /* ParenthesizedExpression */) {
expr = expr.expression;
}
- if (expr.kind === 196 /* FunctionExpression */ || expr.kind === 197 /* ArrowFunction */) {
+ if (expr.kind === 197 /* FunctionExpression */ || expr.kind === 198 /* ArrowFunction */) {
bindEach(node.typeArguments);
bindEach(node.arguments);
bind(node.expression);
@@ -28725,7 +28922,7 @@
else {
bindEachChild(node);
}
- if (node.expression.kind === 189 /* PropertyAccessExpression */) {
+ if (node.expression.kind === 190 /* PropertyAccessExpression */) {
var propertyAccess = node.expression;
if (isNarrowableOperand(propertyAccess.expression) && ts.isPushOrUnshiftIdentifier(propertyAccess.name)) {
currentFlow = createFlowArrayMutation(currentFlow, node);
@@ -28734,54 +28931,54 @@
}
function getContainerFlags(node) {
switch (node.kind) {
- case 209 /* ClassExpression */:
- case 240 /* ClassDeclaration */:
- case 243 /* EnumDeclaration */:
- case 188 /* ObjectLiteralExpression */:
- case 168 /* TypeLiteral */:
- case 297 /* JSDocTypeLiteral */:
- case 268 /* JsxAttributes */:
+ case 210 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 189 /* ObjectLiteralExpression */:
+ case 169 /* TypeLiteral */:
+ case 298 /* JSDocTypeLiteral */:
+ case 269 /* JsxAttributes */:
return 1 /* IsContainer */;
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
return 1 /* IsContainer */ | 64 /* IsInterface */;
- case 244 /* ModuleDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 181 /* MappedType */:
+ case 245 /* ModuleDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 182 /* MappedType */:
return 1 /* IsContainer */ | 32 /* HasLocals */;
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */;
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
if (ts.isObjectLiteralOrClassExpressionMethod(node)) {
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 128 /* IsObjectLiteralOrClassExpressionMethod */;
}
// falls through
- case 157 /* Constructor */:
- case 239 /* FunctionDeclaration */:
- case 155 /* MethodSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 160 /* CallSignature */:
- case 298 /* JSDocSignature */:
- case 294 /* JSDocFunctionType */:
- case 165 /* FunctionType */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
- case 166 /* ConstructorType */:
+ case 158 /* Constructor */:
+ case 240 /* FunctionDeclaration */:
+ case 156 /* MethodSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 161 /* CallSignature */:
+ case 299 /* JSDocSignature */:
+ case 295 /* JSDocFunctionType */:
+ case 166 /* FunctionType */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
+ case 167 /* ConstructorType */:
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */;
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return 1 /* IsContainer */ | 4 /* IsControlFlowContainer */ | 32 /* HasLocals */ | 8 /* IsFunctionLike */ | 16 /* IsFunctionExpression */;
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
return 4 /* IsControlFlowContainer */;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return node.initializer ? 4 /* IsControlFlowContainer */ : 0;
- case 274 /* CatchClause */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
- case 246 /* CaseBlock */:
+ case 275 /* CatchClause */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
+ case 247 /* CaseBlock */:
return 2 /* IsBlockScopedContainer */;
- case 218 /* Block */:
+ case 219 /* Block */:
// do not treat blocks directly inside a function as a block-scoped-container.
// Locals that reside in this block should go to the function locals. Otherwise 'x'
// would not appear to be a redeclaration of a block scoped local in the following
@@ -28814,45 +29011,45 @@
// members are declared (for example, a member of a class will go into a specific
// symbol table depending on if it is static or not). We defer to specialized
// handlers to take care of declaring these child members.
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return declareModuleMember(node, symbolFlags, symbolExcludes);
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return declareSourceFileMember(node, symbolFlags, symbolExcludes);
- case 209 /* ClassExpression */:
- case 240 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
return declareClassMember(node, symbolFlags, symbolExcludes);
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return declareSymbol(container.symbol.exports, container.symbol, node, symbolFlags, symbolExcludes);
- case 168 /* TypeLiteral */:
- case 297 /* JSDocTypeLiteral */:
- case 188 /* ObjectLiteralExpression */:
- case 241 /* InterfaceDeclaration */:
- case 268 /* JsxAttributes */:
+ case 169 /* TypeLiteral */:
+ case 298 /* JSDocTypeLiteral */:
+ case 189 /* ObjectLiteralExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 269 /* JsxAttributes */:
// Interface/Object-types always have their children added to the 'members' of
// their container. They are only accessible through an instance of their
// container, and are never in scope otherwise (even inside the body of the
// object / type / interface declaring them). An exception is type parameters,
// which are in scope without qualification (similar to 'locals').
return declareSymbol(container.symbol.members, container.symbol, node, symbolFlags, symbolExcludes);
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 298 /* JSDocSignature */:
- case 162 /* IndexSignature */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 294 /* JSDocFunctionType */:
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
- case 242 /* TypeAliasDeclaration */:
- case 181 /* MappedType */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 299 /* JSDocSignature */:
+ case 163 /* IndexSignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 295 /* JSDocFunctionType */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
+ case 243 /* TypeAliasDeclaration */:
+ case 182 /* MappedType */:
// All the children of these container types are never visible through another
// symbol (i.e. through another symbol's 'exports' or 'members'). Instead,
// they're only accessed 'lexically' (i.e. from code that exists underneath
@@ -28873,16 +29070,8 @@
: declareSymbol(file.locals, /*parent*/ undefined, node, symbolFlags, symbolExcludes);
}
function hasExportDeclarations(node) {
- var body = node.kind === 284 /* SourceFile */ ? node : node.body;
- if (body && (body.kind === 284 /* SourceFile */ || body.kind === 245 /* ModuleBlock */)) {
- for (var _i = 0, _a = body.statements; _i < _a.length; _i++) {
- var stat = _a[_i];
- if (stat.kind === 255 /* ExportDeclaration */ || stat.kind === 254 /* ExportAssignment */) {
- return true;
- }
- }
- }
- return false;
+ var body = ts.isSourceFile(node) ? node : ts.tryCast(node.body, ts.isModuleBlock);
+ return !!body && body.statements.some(function (s) { return ts.isExportDeclaration(s) || ts.isExportAssignment(s); });
}
function setExportContextFlag(node) {
// A declaration source file or ambient module declaration that contains no export declarations (but possibly regular
@@ -28961,7 +29150,7 @@
var seen = ts.createUnderscoreEscapedMap();
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var prop = _a[_i];
- if (prop.kind === 277 /* SpreadAssignment */ || prop.name.kind !== 72 /* Identifier */) {
+ if (prop.kind === 278 /* SpreadAssignment */ || prop.name.kind !== 73 /* Identifier */) {
continue;
}
var identifier = prop.name;
@@ -28973,7 +29162,7 @@
// c.IsAccessorDescriptor(previous) is true and IsDataDescriptor(propId.descriptor) is true.
// d.IsAccessorDescriptor(previous) is true and IsAccessorDescriptor(propId.descriptor) is true
// and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields
- var currentKind = prop.kind === 275 /* PropertyAssignment */ || prop.kind === 276 /* ShorthandPropertyAssignment */ || prop.kind === 156 /* MethodDeclaration */
+ var currentKind = prop.kind === 276 /* PropertyAssignment */ || prop.kind === 277 /* ShorthandPropertyAssignment */ || prop.kind === 157 /* MethodDeclaration */
? 1 /* Property */
: 2 /* Accessor */;
var existingKind = seen.get(identifier.escapedText);
@@ -29005,10 +29194,10 @@
}
function bindBlockScopedDeclaration(node, symbolFlags, symbolExcludes) {
switch (blockScopeContainer.kind) {
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
declareModuleMember(node, symbolFlags, symbolExcludes);
break;
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
if (ts.isExternalOrCommonJsModule(container)) {
declareModuleMember(node, symbolFlags, symbolExcludes);
break;
@@ -29039,7 +29228,7 @@
currentFlow = { flags: 2 /* Start */ };
parent = typeAlias;
bind(typeAlias.typeExpression);
- if (!typeAlias.fullName || typeAlias.fullName.kind === 72 /* Identifier */) {
+ if (!typeAlias.fullName || typeAlias.fullName.kind === 73 /* Identifier */) {
parent = typeAlias.parent;
bindBlockScopedDeclaration(typeAlias, 524288 /* TypeAlias */, 67897832 /* TypeAliasExcludes */);
}
@@ -29057,8 +29246,8 @@
// check for reserved words used as identifiers in strict mode code.
function checkStrictModeIdentifier(node) {
if (inStrictMode &&
- node.originalKeywordKind >= 109 /* FirstFutureReservedWord */ &&
- node.originalKeywordKind <= 117 /* LastFutureReservedWord */ &&
+ node.originalKeywordKind >= 110 /* FirstFutureReservedWord */ &&
+ node.originalKeywordKind <= 118 /* LastFutureReservedWord */ &&
!ts.isIdentifierName(node) &&
!(node.flags & 4194304 /* Ambient */)) {
// Report error only if there are no parse errors in file
@@ -29094,7 +29283,7 @@
}
function checkStrictModeDeleteExpression(node) {
// Grammar checking
- if (inStrictMode && node.expression.kind === 72 /* Identifier */) {
+ if (inStrictMode && node.expression.kind === 73 /* Identifier */) {
// When a delete operator occurs within strict mode code, a SyntaxError is thrown if its
// UnaryExpression is a direct reference to a variable, function argument, or function name
var span = ts.getErrorSpanForNode(file, node.expression);
@@ -29105,7 +29294,7 @@
return ts.isIdentifier(node) && (node.escapedText === "eval" || node.escapedText === "arguments");
}
function checkStrictModeEvalOrArguments(contextNode, name) {
- if (name && name.kind === 72 /* Identifier */) {
+ if (name && name.kind === 73 /* Identifier */) {
var identifier = name;
if (isEvalOrArgumentsIdentifier(identifier)) {
// We check first if the name is inside class declaration or class expression; if so give explicit message
@@ -29146,8 +29335,8 @@
function checkStrictModeFunctionDeclaration(node) {
if (languageVersion < 2 /* ES2015 */) {
// Report error if function is not top level function declaration
- if (blockScopeContainer.kind !== 284 /* SourceFile */ &&
- blockScopeContainer.kind !== 244 /* ModuleDeclaration */ &&
+ if (blockScopeContainer.kind !== 285 /* SourceFile */ &&
+ blockScopeContainer.kind !== 245 /* ModuleDeclaration */ &&
!ts.isFunctionLike(blockScopeContainer)) {
// We check first if the name is inside class declaration or class expression; if so give explicit message
// otherwise report generic error message.
@@ -29242,7 +29431,7 @@
// the current 'container' node when it changes. This helps us know which symbol table
// a local should go into for example. Since terminal nodes are known not to have
// children, as an optimization we don't process those.
- if (node.kind > 147 /* LastToken */) {
+ if (node.kind > 148 /* LastToken */) {
var saveParent = parent;
parent = node;
var containerFlags = getContainerFlags(node);
@@ -29304,7 +29493,7 @@
function bindWorker(node) {
switch (node.kind) {
/* Strict mode checks */
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
// for typedef type names with namespaces, bind the new jsdoc type symbol here
// because it requires all containing namespaces to be in effect, namely the
// current "blockScopeContainer" needs to be set to its immediate namespace parent.
@@ -29317,13 +29506,13 @@
break;
}
// falls through
- case 100 /* ThisKeyword */:
- if (currentFlow && (ts.isExpression(node) || parent.kind === 276 /* ShorthandPropertyAssignment */)) {
+ case 101 /* ThisKeyword */:
+ if (currentFlow && (ts.isExpression(node) || parent.kind === 277 /* ShorthandPropertyAssignment */)) {
node.flowNode = currentFlow;
}
return checkStrictModeIdentifier(node);
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
if (currentFlow && isNarrowableReference(node)) {
node.flowNode = currentFlow;
}
@@ -29337,7 +29526,7 @@
declareSymbol(file.locals, /*parent*/ undefined, node.expression, 1 /* FunctionScopedVariable */ | 134217728 /* ModuleExports */, 67220414 /* FunctionScopedVariableExcludes */);
}
break;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
var specialKind = ts.getAssignmentDeclarationKind(node);
switch (specialKind) {
case 1 /* ExportsProperty */:
@@ -29365,76 +29554,76 @@
ts.Debug.fail("Unknown binary expression special property assignment kind");
}
return checkStrictModeBinaryExpression(node);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return checkStrictModeCatchClause(node);
- case 198 /* DeleteExpression */:
+ case 199 /* DeleteExpression */:
return checkStrictModeDeleteExpression(node);
case 8 /* NumericLiteral */:
return checkStrictModeNumericLiteral(node);
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return checkStrictModePostfixUnaryExpression(node);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return checkStrictModePrefixUnaryExpression(node);
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
return checkStrictModeWithStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return checkStrictModeLabeledStatement(node);
- case 178 /* ThisType */:
+ case 179 /* ThisType */:
seenThisKeyword = true;
return;
- case 163 /* TypePredicate */:
+ case 164 /* TypePredicate */:
break; // Binding the children will handle everything
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
return bindTypeParameter(node);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return bindParameter(node);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return bindVariableDeclarationOrBindingElement(node);
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
node.flowNode = currentFlow;
return bindVariableDeclarationOrBindingElement(node);
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
return bindPropertyWorker(node);
- case 275 /* PropertyAssignment */:
- case 276 /* ShorthandPropertyAssignment */:
+ case 276 /* PropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return bindPropertyOrMethodOrAccessor(node, 4 /* Property */, 0 /* PropertyExcludes */);
- case 278 /* EnumMember */:
+ case 279 /* EnumMember */:
return bindPropertyOrMethodOrAccessor(node, 8 /* EnumMember */, 68008959 /* EnumMemberExcludes */);
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
return declareSymbolAndAddToSymbolTable(node, 131072 /* Signature */, 0 /* None */);
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
// If this is an ObjectLiteralExpression method, then it sits in the same space
// as other properties in the object literal. So we use SymbolFlags.PropertyExcludes
// so that it will conflict with any other object literal members with the same
// name.
return bindPropertyOrMethodOrAccessor(node, 8192 /* Method */ | (node.questionToken ? 16777216 /* Optional */ : 0 /* None */), ts.isObjectLiteralMethod(node) ? 0 /* PropertyExcludes */ : 67212223 /* MethodExcludes */);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return bindFunctionDeclaration(node);
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return declareSymbolAndAddToSymbolTable(node, 16384 /* Constructor */, /*symbolExcludes:*/ 0 /* None */);
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
return bindPropertyOrMethodOrAccessor(node, 32768 /* GetAccessor */, 67154879 /* GetAccessorExcludes */);
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
return bindPropertyOrMethodOrAccessor(node, 65536 /* SetAccessor */, 67187647 /* SetAccessorExcludes */);
- case 165 /* FunctionType */:
- case 294 /* JSDocFunctionType */:
- case 298 /* JSDocSignature */:
- case 166 /* ConstructorType */:
+ case 166 /* FunctionType */:
+ case 295 /* JSDocFunctionType */:
+ case 299 /* JSDocSignature */:
+ case 167 /* ConstructorType */:
return bindFunctionOrConstructorType(node);
- case 168 /* TypeLiteral */:
- case 297 /* JSDocTypeLiteral */:
- case 181 /* MappedType */:
+ case 169 /* TypeLiteral */:
+ case 298 /* JSDocTypeLiteral */:
+ case 182 /* MappedType */:
return bindAnonymousTypeWorker(node);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return bindObjectLiteralExpression(node);
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return bindFunctionExpression(node);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
var assignmentKind = ts.getAssignmentDeclarationKind(node);
switch (assignmentKind) {
case 7 /* ObjectDefinePropertyValue */:
@@ -29453,64 +29642,64 @@
}
break;
// Members of classes, interfaces, and modules
- case 209 /* ClassExpression */:
- case 240 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
// All classes are automatically in strict mode in ES6.
inStrictMode = true;
return bindClassLikeDeclaration(node);
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
return bindBlockScopedDeclaration(node, 64 /* Interface */, 67897736 /* InterfaceExcludes */);
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return bindBlockScopedDeclaration(node, 524288 /* TypeAlias */, 67897832 /* TypeAliasExcludes */);
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return bindEnumDeclaration(node);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return bindModuleDeclaration(node);
// Jsx-attributes
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
return bindJsxAttributes(node);
- case 267 /* JsxAttribute */:
+ case 268 /* JsxAttribute */:
return bindJsxAttribute(node, 4 /* Property */, 0 /* PropertyExcludes */);
// Imports and exports
- case 248 /* ImportEqualsDeclaration */:
- case 251 /* NamespaceImport */:
- case 253 /* ImportSpecifier */:
- case 257 /* ExportSpecifier */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 252 /* NamespaceImport */:
+ case 254 /* ImportSpecifier */:
+ case 258 /* ExportSpecifier */:
return declareSymbolAndAddToSymbolTable(node, 2097152 /* Alias */, 2097152 /* AliasExcludes */);
- case 247 /* NamespaceExportDeclaration */:
+ case 248 /* NamespaceExportDeclaration */:
return bindNamespaceExportDeclaration(node);
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
return bindImportClause(node);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return bindExportDeclaration(node);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return bindExportAssignment(node);
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
updateStrictModeStatementList(node.statements);
return bindSourceFileIfExternalModule();
- case 218 /* Block */:
+ case 219 /* Block */:
if (!ts.isFunctionLike(node.parent)) {
return;
}
// falls through
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
return updateStrictModeStatementList(node.statements);
- case 304 /* JSDocParameterTag */:
- if (node.parent.kind === 298 /* JSDocSignature */) {
+ case 305 /* JSDocParameterTag */:
+ if (node.parent.kind === 299 /* JSDocSignature */) {
return bindParameter(node);
}
- if (node.parent.kind !== 297 /* JSDocTypeLiteral */) {
+ if (node.parent.kind !== 298 /* JSDocTypeLiteral */) {
break;
}
// falls through
- case 310 /* JSDocPropertyTag */:
+ case 311 /* JSDocPropertyTag */:
var propTag = node;
- var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 293 /* JSDocOptionalType */ ?
+ var flags = propTag.isBracketed || propTag.typeExpression && propTag.typeExpression.type.kind === 294 /* JSDocOptionalType */ ?
4 /* Property */ | 16777216 /* Optional */ :
4 /* Property */;
return declareSymbolAndAddToSymbolTable(propTag, flags, 0 /* PropertyExcludes */);
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
return (delayedTypeAliases || (delayedTypeAliases = [])).push(node);
}
}
@@ -29654,11 +29843,11 @@
ts.Debug.assert(ts.isInJSFile(node));
var thisContainer = ts.getThisContainer(node, /*includeArrowFunctions*/ false);
switch (thisContainer.kind) {
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
var constructorSymbol = thisContainer.symbol;
// For `f.prototype.m = function() { this.x = 0; }`, `this.x = 0` should modify `f`'s members, not the function expression.
- if (ts.isBinaryExpression(thisContainer.parent) && thisContainer.parent.operatorToken.kind === 59 /* EqualsToken */) {
+ if (ts.isBinaryExpression(thisContainer.parent) && thisContainer.parent.operatorToken.kind === 60 /* EqualsToken */) {
var l = thisContainer.parent.left;
if (ts.isPropertyAccessEntityNameExpression(l) && ts.isPrototypeAccess(l.expression)) {
constructorSymbol = lookupSymbolForPropertyAccess(l.expression.expression, thisParentContainer);
@@ -29671,18 +29860,18 @@
declareSymbol(constructorSymbol.members, constructorSymbol, node, 4 /* Property */, 0 /* PropertyExcludes */ & ~4 /* Property */);
}
break;
- case 157 /* Constructor */:
- case 154 /* PropertyDeclaration */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 158 /* Constructor */:
+ case 155 /* PropertyDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
// this.foo assignment in a JavaScript class
// Bind this property to the containing class
var containingClass = thisContainer.parent;
var symbolTable = ts.hasModifier(thisContainer, 32 /* Static */) ? containingClass.symbol.exports : containingClass.symbol.members;
declareSymbol(symbolTable, containingClass.symbol, node, 4 /* Property */, 0 /* None */, /*isReplaceableByMethod*/ true);
break;
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
// this.property = assignment in a source file -- declare symbol in exports for a module, in locals for a script
if (thisContainer.commonJsModuleIndicator) {
declareSymbol(thisContainer.symbol.exports, thisContainer.symbol, node, 4 /* Property */ | 1048576 /* ExportValue */, 0 /* None */);
@@ -29692,14 +29881,14 @@
}
break;
default:
- ts.Debug.fail(ts.Debug.showSyntaxKind(thisContainer));
+ ts.Debug.failBadSyntaxKind(thisContainer);
}
}
function bindSpecialPropertyDeclaration(node) {
- if (node.expression.kind === 100 /* ThisKeyword */) {
+ if (node.expression.kind === 101 /* ThisKeyword */) {
bindThisPropertyAssignment(node);
}
- else if (ts.isPropertyAccessEntityNameExpression(node) && node.parent.parent.kind === 284 /* SourceFile */) {
+ else if (ts.isPropertyAccessEntityNameExpression(node) && node.parent.parent.kind === 285 /* SourceFile */) {
if (ts.isPrototypeAccess(node.expression)) {
bindPrototypePropertyAssignment(node, node.parent);
}
@@ -29736,7 +29925,7 @@
}
function bindObjectDefinePropertyAssignment(node) {
var namespaceSymbol = lookupSymbolForPropertyAccess(node.arguments[0]);
- var isToplevel = node.parent.parent.kind === 284 /* SourceFile */;
+ var isToplevel = node.parent.parent.kind === 285 /* SourceFile */;
namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, node.arguments[0], isToplevel, /*isPrototypeProperty*/ false);
bindPotentiallyNewExpandoMemberToNamespace(node, namespaceSymbol, /*isPrototypeProperty*/ false);
}
@@ -29750,7 +29939,7 @@
// Fix up parent pointers since we're going to use these nodes before we bind into them
node.left.parent = node;
node.right.parent = node;
- if (ts.isIdentifier(lhs.expression) && container === file && isNameOfExportsOrModuleExportsAliasDeclaration(file, lhs.expression)) {
+ if (ts.isIdentifier(lhs.expression) && container === file && isExportsOrModuleExportsOrAlias(file, lhs.expression)) {
// This can be an alias for the 'exports' or 'module.exports' names, e.g.
// var util = module.exports;
// util.property = function ...
@@ -29803,8 +29992,8 @@
function bindPropertyAssignment(name, propertyAccess, isPrototypeProperty) {
var namespaceSymbol = lookupSymbolForPropertyAccess(name);
var isToplevel = ts.isBinaryExpression(propertyAccess.parent)
- ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 284 /* SourceFile */
- : propertyAccess.parent.parent.kind === 284 /* SourceFile */;
+ ? getParentOfBinaryExpression(propertyAccess.parent).parent.kind === 285 /* SourceFile */
+ : propertyAccess.parent.parent.kind === 285 /* SourceFile */;
namespaceSymbol = bindPotentiallyMissingNamespaces(namespaceSymbol, propertyAccess.expression, isToplevel, isPrototypeProperty);
bindPotentiallyNewExpandoMemberToNamespace(propertyAccess, namespaceSymbol, isPrototypeProperty);
}
@@ -29863,9 +30052,7 @@
}
else {
var s = forEachIdentifierInEntityName(e.expression, parent, action);
- if (!s || !s.exports)
- return ts.Debug.fail();
- return action(e.name, s.exports.get(e.name.escapedText), s);
+ return action(e.name, s && s.exports && s.exports.get(e.name.escapedText), s);
}
}
function bindCallExpression(node) {
@@ -29876,7 +30063,7 @@
}
}
function bindClassLikeDeclaration(node) {
- if (node.kind === 240 /* ClassDeclaration */) {
+ if (node.kind === 241 /* ClassDeclaration */) {
bindBlockScopedDeclaration(node, 32 /* Class */, 68008383 /* ClassExcludes */);
}
else {
@@ -29942,7 +30129,7 @@
}
}
function bindParameter(node) {
- if (node.kind === 304 /* JSDocParameterTag */ && container.kind !== 298 /* JSDocSignature */) {
+ if (node.kind === 305 /* JSDocParameterTag */ && container.kind !== 299 /* JSDocSignature */) {
return;
}
if (inStrictMode && !(node.flags & 4194304 /* Ambient */)) {
@@ -30019,7 +30206,7 @@
declareSymbolAndAddToSymbolTable(node, 262144 /* TypeParameter */, 67635688 /* TypeParameterExcludes */);
}
}
- else if (node.parent.kind === 176 /* InferType */) {
+ else if (node.parent.kind === 177 /* InferType */) {
var container_2 = getInferTypeContainer(node.parent);
if (container_2) {
if (!container_2.locals) {
@@ -30047,11 +30234,11 @@
if (currentFlow === unreachableFlow) {
var reportError =
// report error on all statements except empty ones
- (ts.isStatementButNotDeclaration(node) && node.kind !== 220 /* EmptyStatement */) ||
+ (ts.isStatementButNotDeclaration(node) && node.kind !== 221 /* EmptyStatement */) ||
// report error on class declarations
- node.kind === 240 /* ClassDeclaration */ ||
+ node.kind === 241 /* ClassDeclaration */ ||
// report error on instantiated modules or const-enums only modules if preserveConstEnums is set
- (node.kind === 244 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node));
+ (node.kind === 245 /* ModuleDeclaration */ && shouldReportErrorOnModuleDeclaration(node));
if (reportError) {
currentFlow = reportedUnreachableFlow;
if (!options.allowUnreachableCode) {
@@ -30095,32 +30282,41 @@
}
function isPurelyTypeDeclaration(s) {
switch (s.kind) {
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return true;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return getModuleInstanceState(s) !== 1 /* Instantiated */;
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return ts.hasModifier(s, 2048 /* Const */);
default:
return false;
}
}
function isExportsOrModuleExportsOrAlias(sourceFile, node) {
- return ts.isExportsIdentifier(node) ||
- ts.isModuleExportsPropertyAccessExpression(node) ||
- ts.isIdentifier(node) && isNameOfExportsOrModuleExportsAliasDeclaration(sourceFile, node);
+ var i = 0;
+ var q = [node];
+ while (q.length && i < 100) {
+ i++;
+ node = q.shift();
+ if (ts.isExportsIdentifier(node) || ts.isModuleExportsPropertyAccessExpression(node)) {
+ return true;
}
- ts.isExportsOrModuleExportsOrAlias = isExportsOrModuleExportsOrAlias;
- function isNameOfExportsOrModuleExportsAliasDeclaration(sourceFile, node) {
+ else if (ts.isIdentifier(node)) {
var symbol = lookupSymbolForNameWorker(sourceFile, node.escapedText);
- return !!symbol && !!symbol.valueDeclaration && ts.isVariableDeclaration(symbol.valueDeclaration) &&
- !!symbol.valueDeclaration.initializer && isExportsOrModuleExportsOrAliasOrAssignment(sourceFile, symbol.valueDeclaration.initializer);
+ if (!!symbol && !!symbol.valueDeclaration && ts.isVariableDeclaration(symbol.valueDeclaration) && !!symbol.valueDeclaration.initializer) {
+ var init = symbol.valueDeclaration.initializer;
+ q.push(init);
+ if (ts.isAssignmentExpression(init, /*excludeCompoundAssignment*/ true)) {
+ q.push(init.left);
+ q.push(init.right);
+ }
+ }
}
- function isExportsOrModuleExportsOrAliasOrAssignment(sourceFile, node) {
- return isExportsOrModuleExportsOrAlias(sourceFile, node) ||
- (ts.isAssignmentExpression(node, /*excludeCompoundAssignment*/ true) && (isExportsOrModuleExportsOrAliasOrAssignment(sourceFile, node.left) || isExportsOrModuleExportsOrAliasOrAssignment(sourceFile, node.right)));
}
+ return false;
+ }
+ ts.isExportsOrModuleExportsOrAlias = isExportsOrModuleExportsOrAlias;
function lookupSymbolForNameWorker(container, name) {
var local = container.locals && container.locals.get(name);
if (local) {
@@ -30140,58 +30336,58 @@
function computeTransformFlagsForNode(node, subtreeFlags) {
var kind = node.kind;
switch (kind) {
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return computeCallExpression(node, subtreeFlags);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return computeNewExpression(node, subtreeFlags);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return computeModuleDeclaration(node, subtreeFlags);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return computeParenthesizedExpression(node, subtreeFlags);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return computeBinaryExpression(node, subtreeFlags);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return computeExpressionStatement(node, subtreeFlags);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return computeParameter(node, subtreeFlags);
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return computeArrowFunction(node, subtreeFlags);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return computeFunctionExpression(node, subtreeFlags);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return computeFunctionDeclaration(node, subtreeFlags);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return computeVariableDeclaration(node, subtreeFlags);
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
return computeVariableDeclarationList(node, subtreeFlags);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return computeVariableStatement(node, subtreeFlags);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return computeLabeledStatement(node, subtreeFlags);
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return computeClassDeclaration(node, subtreeFlags);
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
return computeClassExpression(node, subtreeFlags);
- case 273 /* HeritageClause */:
+ case 274 /* HeritageClause */:
return computeHeritageClause(node, subtreeFlags);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return computeCatchClause(node, subtreeFlags);
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return computeExpressionWithTypeArguments(node, subtreeFlags);
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return computeConstructor(node, subtreeFlags);
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return computePropertyDeclaration(node, subtreeFlags);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return computeMethod(node, subtreeFlags);
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return computeAccessor(node, subtreeFlags);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return computeImportEquals(node, subtreeFlags);
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return computePropertyAccess(node, subtreeFlags);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return computeElementAccess(node, subtreeFlags);
default:
return computeOther(node, kind, subtreeFlags);
@@ -30213,7 +30409,7 @@
transformFlags |= 2048 /* ContainsLexicalThis */;
}
}
- if (expression.kind === 92 /* ImportKeyword */) {
+ if (expression.kind === 93 /* ImportKeyword */) {
transformFlags |= 524288 /* ContainsDynamicImport */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
@@ -30236,17 +30432,17 @@
var transformFlags = subtreeFlags;
var operatorTokenKind = node.operatorToken.kind;
var leftKind = node.left.kind;
- if (operatorTokenKind === 59 /* EqualsToken */ && leftKind === 188 /* ObjectLiteralExpression */) {
+ if (operatorTokenKind === 60 /* EqualsToken */ && leftKind === 189 /* ObjectLiteralExpression */) {
// Destructuring object assignments with are ES2015 syntax
// and possibly ES2018 if they contain rest
transformFlags |= 16 /* AssertES2018 */ | 128 /* AssertES2015 */ | 512 /* AssertDestructuringAssignment */;
}
- else if (operatorTokenKind === 59 /* EqualsToken */ && leftKind === 187 /* ArrayLiteralExpression */) {
+ else if (operatorTokenKind === 60 /* EqualsToken */ && leftKind === 188 /* ArrayLiteralExpression */) {
// Destructuring assignments are ES2015 syntax.
transformFlags |= 128 /* AssertES2015 */ | 512 /* AssertDestructuringAssignment */;
}
else if (operatorTokenKind === 41 /* AsteriskAsteriskToken */
- || operatorTokenKind === 63 /* AsteriskAsteriskEqualsToken */) {
+ || operatorTokenKind === 64 /* AsteriskAsteriskEqualsToken */) {
// Exponentiation is ES2016 syntax.
transformFlags |= 64 /* AssertES2016 */;
}
@@ -30289,8 +30485,8 @@
// If the node is synthesized, it means the emitter put the parentheses there,
// not the user. If we didn't want them, the emitter would not have put them
// there.
- if (expressionKind === 212 /* AsExpression */
- || expressionKind === 194 /* TypeAssertionExpression */) {
+ if (expressionKind === 213 /* AsExpression */
+ || expressionKind === 195 /* TypeAssertionExpression */) {
transformFlags |= 1 /* AssertTypeScript */;
}
node.transformFlags = transformFlags | 536870912 /* HasComputedFlags */;
@@ -30332,11 +30528,11 @@
function computeHeritageClause(node, subtreeFlags) {
var transformFlags = subtreeFlags;
switch (node.token) {
- case 86 /* ExtendsKeyword */:
+ case 87 /* ExtendsKeyword */:
// An `extends` HeritageClause is ES6 syntax.
transformFlags |= 128 /* AssertES2015 */;
break;
- case 109 /* ImplementsKeyword */:
+ case 110 /* ImplementsKeyword */:
// An `implements` HeritageClause is TypeScript syntax.
transformFlags |= 1 /* AssertTypeScript */;
break;
@@ -30529,7 +30725,7 @@
var transformFlags = subtreeFlags;
// If a PropertyAccessExpression starts with a super keyword, then it is
// ES6 syntax, and requires a lexical `this` binding.
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
// super inside of an async function requires hoisting the super access (ES2017).
// same for super inside of an async generator, which is ES2018.
transformFlags |= 32 /* ContainsES2017 */ | 16 /* ContainsES2018 */;
@@ -30541,7 +30737,7 @@
var transformFlags = subtreeFlags;
// If an ElementAccessExpression starts with a super keyword, then it is
// ES6 syntax, and requires a lexical `this` binding.
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
// super inside of an async function requires hoisting the super access (ES2017).
// same for super inside of an async generator, which is ES2018.
transformFlags |= 32 /* ContainsES2017 */ | 16 /* ContainsES2018 */;
@@ -30629,43 +30825,43 @@
var transformFlags = subtreeFlags;
var excludeFlags = 536870912 /* NodeExcludes */;
switch (kind) {
- case 121 /* AsyncKeyword */:
- case 201 /* AwaitExpression */:
+ case 122 /* AsyncKeyword */:
+ case 202 /* AwaitExpression */:
// async/await is ES2017 syntax, but may be ES2018 syntax (for async generators)
transformFlags |= 16 /* AssertES2018 */ | 32 /* AssertES2017 */;
break;
- case 194 /* TypeAssertionExpression */:
- case 212 /* AsExpression */:
- case 313 /* PartiallyEmittedExpression */:
+ case 195 /* TypeAssertionExpression */:
+ case 213 /* AsExpression */:
+ case 314 /* PartiallyEmittedExpression */:
// These nodes are TypeScript syntax.
transformFlags |= 1 /* AssertTypeScript */;
excludeFlags = 536870912 /* OuterExpressionExcludes */;
break;
- case 115 /* PublicKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 118 /* AbstractKeyword */:
- case 125 /* DeclareKeyword */:
- case 77 /* ConstKeyword */:
- case 243 /* EnumDeclaration */:
- case 278 /* EnumMember */:
- case 213 /* NonNullExpression */:
- case 133 /* ReadonlyKeyword */:
+ case 116 /* PublicKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 119 /* AbstractKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 78 /* ConstKeyword */:
+ case 244 /* EnumDeclaration */:
+ case 279 /* EnumMember */:
+ case 214 /* NonNullExpression */:
+ case 134 /* ReadonlyKeyword */:
// These nodes are TypeScript syntax.
transformFlags |= 1 /* AssertTypeScript */;
break;
- case 260 /* JsxElement */:
- case 261 /* JsxSelfClosingElement */:
- case 262 /* JsxOpeningElement */:
+ case 261 /* JsxElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
case 11 /* JsxText */:
- case 263 /* JsxClosingElement */:
- case 264 /* JsxFragment */:
- case 265 /* JsxOpeningFragment */:
- case 266 /* JsxClosingFragment */:
- case 267 /* JsxAttribute */:
- case 268 /* JsxAttributes */:
- case 269 /* JsxSpreadAttribute */:
- case 270 /* JsxExpression */:
+ case 264 /* JsxClosingElement */:
+ case 265 /* JsxFragment */:
+ case 266 /* JsxOpeningFragment */:
+ case 267 /* JsxClosingFragment */:
+ case 268 /* JsxAttribute */:
+ case 269 /* JsxAttributes */:
+ case 270 /* JsxSpreadAttribute */:
+ case 271 /* JsxExpression */:
// These nodes are Jsx syntax.
transformFlags |= 2 /* AssertJsx */;
break;
@@ -30673,11 +30869,11 @@
case 15 /* TemplateHead */:
case 16 /* TemplateMiddle */:
case 17 /* TemplateTail */:
- case 206 /* TemplateExpression */:
- case 193 /* TaggedTemplateExpression */:
- case 276 /* ShorthandPropertyAssignment */:
- case 116 /* StaticKeyword */:
- case 214 /* MetaProperty */:
+ case 207 /* TemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
+ case 277 /* ShorthandPropertyAssignment */:
+ case 117 /* StaticKeyword */:
+ case 215 /* MetaProperty */:
// These nodes are ES6 syntax.
transformFlags |= 128 /* AssertES2015 */;
break;
@@ -30694,103 +30890,103 @@
case 9 /* BigIntLiteral */:
transformFlags |= 4 /* AssertESNext */;
break;
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
// This node is either ES2015 syntax or ES2017 syntax (if it is a for-await-of).
if (node.awaitModifier) {
transformFlags |= 16 /* AssertES2018 */;
}
transformFlags |= 128 /* AssertES2015 */;
break;
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
// This node is either ES2015 syntax (in a generator) or ES2017 syntax (in an async
// generator).
transformFlags |= 16 /* AssertES2018 */ | 128 /* AssertES2015 */ | 131072 /* ContainsYield */;
break;
- case 120 /* AnyKeyword */:
- case 135 /* NumberKeyword */:
- case 146 /* BigIntKeyword */:
- case 132 /* NeverKeyword */:
- case 136 /* ObjectKeyword */:
- case 138 /* StringKeyword */:
- case 123 /* BooleanKeyword */:
- case 139 /* SymbolKeyword */:
- case 106 /* VoidKeyword */:
- case 150 /* TypeParameter */:
- case 153 /* PropertySignature */:
- case 155 /* MethodSignature */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
- case 163 /* TypePredicate */:
- case 164 /* TypeReference */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 167 /* TypeQuery */:
- case 168 /* TypeLiteral */:
- case 169 /* ArrayType */:
- case 170 /* TupleType */:
- case 171 /* OptionalType */:
- case 172 /* RestType */:
- case 173 /* UnionType */:
- case 174 /* IntersectionType */:
- case 175 /* ConditionalType */:
- case 176 /* InferType */:
- case 177 /* ParenthesizedType */:
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 178 /* ThisType */:
- case 179 /* TypeOperator */:
- case 180 /* IndexedAccessType */:
- case 181 /* MappedType */:
- case 182 /* LiteralType */:
- case 247 /* NamespaceExportDeclaration */:
+ case 121 /* AnyKeyword */:
+ case 136 /* NumberKeyword */:
+ case 147 /* BigIntKeyword */:
+ case 133 /* NeverKeyword */:
+ case 137 /* ObjectKeyword */:
+ case 139 /* StringKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 107 /* VoidKeyword */:
+ case 151 /* TypeParameter */:
+ case 154 /* PropertySignature */:
+ case 156 /* MethodSignature */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
+ case 164 /* TypePredicate */:
+ case 165 /* TypeReference */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 168 /* TypeQuery */:
+ case 169 /* TypeLiteral */:
+ case 170 /* ArrayType */:
+ case 171 /* TupleType */:
+ case 172 /* OptionalType */:
+ case 173 /* RestType */:
+ case 174 /* UnionType */:
+ case 175 /* IntersectionType */:
+ case 176 /* ConditionalType */:
+ case 177 /* InferType */:
+ case 178 /* ParenthesizedType */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 179 /* ThisType */:
+ case 180 /* TypeOperator */:
+ case 181 /* IndexedAccessType */:
+ case 182 /* MappedType */:
+ case 183 /* LiteralType */:
+ case 248 /* NamespaceExportDeclaration */:
// Types and signatures are TypeScript syntax, and exclude all other facts.
transformFlags = 1 /* AssertTypeScript */;
excludeFlags = -2 /* TypeExcludes */;
break;
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
// Even though computed property names are ES6, we don't treat them as such.
// This is so that they can flow through PropertyName transforms unaffected.
// Instead, we mark the container as ES6, so that it can properly handle the transform.
transformFlags |= 16384 /* ContainsComputedPropertyName */;
break;
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
transformFlags |= 128 /* AssertES2015 */ | 4096 /* ContainsRestOrSpread */;
break;
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
transformFlags |= 16 /* AssertES2018 */ | 8192 /* ContainsObjectRestOrSpread */;
break;
- case 98 /* SuperKeyword */:
+ case 99 /* SuperKeyword */:
// This node is ES6 syntax.
transformFlags |= 128 /* AssertES2015 */;
excludeFlags = 536870912 /* OuterExpressionExcludes */; // must be set to persist `Super`
break;
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
// Mark this node and its ancestors as containing a lexical `this` keyword.
transformFlags |= 2048 /* ContainsLexicalThis */;
break;
- case 184 /* ObjectBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
transformFlags |= 128 /* AssertES2015 */ | 65536 /* ContainsBindingPattern */;
if (subtreeFlags & 4096 /* ContainsRestOrSpread */) {
transformFlags |= 16 /* AssertES2018 */ | 8192 /* ContainsObjectRestOrSpread */;
}
excludeFlags = 536875008 /* BindingPatternExcludes */;
break;
- case 185 /* ArrayBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
transformFlags |= 128 /* AssertES2015 */ | 65536 /* ContainsBindingPattern */;
excludeFlags = 536875008 /* BindingPatternExcludes */;
break;
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
transformFlags |= 128 /* AssertES2015 */;
if (node.dotDotDotToken) {
transformFlags |= 4096 /* ContainsRestOrSpread */;
}
break;
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
// This node is TypeScript syntax, and marks its container as also being TypeScript syntax.
transformFlags |= 1 /* AssertTypeScript */ | 1024 /* ContainsTypeScriptClassSyntax */;
break;
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
excludeFlags = 536896512 /* ObjectLiteralExcludes */;
if (subtreeFlags & 16384 /* ContainsComputedPropertyName */) {
// If an ObjectLiteralExpression contains a ComputedPropertyName, then it
@@ -30803,26 +30999,26 @@
transformFlags |= 16 /* AssertES2018 */;
}
break;
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
excludeFlags = 536875008 /* ArrayLiteralOrCallOrNewExcludes */;
break;
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
// A loop containing a block scoped binding *may* need to be transformed from ES6.
if (subtreeFlags & 32768 /* ContainsBlockScopedBinding */) {
transformFlags |= 128 /* AssertES2015 */;
}
break;
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
break;
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
// Return statements may require an `await` in ES2018.
transformFlags |= 262144 /* ContainsHoistedDeclarationOrCompletion */ | 16 /* AssertES2018 */;
break;
- case 228 /* ContinueStatement */:
- case 229 /* BreakStatement */:
+ case 229 /* ContinueStatement */:
+ case 230 /* BreakStatement */:
transformFlags |= 262144 /* ContainsHoistedDeclarationOrCompletion */;
break;
}
@@ -30840,67 +31036,67 @@
* than calling this function.
*/
function getTransformFlagsSubtreeExclusions(kind) {
- if (kind >= 163 /* FirstTypeNode */ && kind <= 183 /* LastTypeNode */) {
+ if (kind >= 164 /* FirstTypeNode */ && kind <= 184 /* LastTypeNode */) {
return -2 /* TypeExcludes */;
}
switch (kind) {
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
- case 187 /* ArrayLiteralExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
+ case 188 /* ArrayLiteralExpression */:
return 536875008 /* ArrayLiteralOrCallOrNewExcludes */;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return 537168896 /* ModuleExcludes */;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return 536870912 /* ParameterExcludes */;
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return 537371648 /* ArrowFunctionExcludes */;
- case 196 /* FunctionExpression */:
- case 239 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
return 537373696 /* FunctionExcludes */;
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
return 536944640 /* VariableDeclarationListExcludes */;
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
return 536888320 /* ClassExcludes */;
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return 537372672 /* ConstructorExcludes */;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return 537372672 /* MethodOrAccessorExcludes */;
- case 120 /* AnyKeyword */:
- case 135 /* NumberKeyword */:
- case 146 /* BigIntKeyword */:
- case 132 /* NeverKeyword */:
- case 138 /* StringKeyword */:
- case 136 /* ObjectKeyword */:
- case 123 /* BooleanKeyword */:
- case 139 /* SymbolKeyword */:
- case 106 /* VoidKeyword */:
- case 150 /* TypeParameter */:
- case 153 /* PropertySignature */:
- case 155 /* MethodSignature */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
+ case 121 /* AnyKeyword */:
+ case 136 /* NumberKeyword */:
+ case 147 /* BigIntKeyword */:
+ case 133 /* NeverKeyword */:
+ case 139 /* StringKeyword */:
+ case 137 /* ObjectKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 107 /* VoidKeyword */:
+ case 151 /* TypeParameter */:
+ case 154 /* PropertySignature */:
+ case 156 /* MethodSignature */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return -2 /* TypeExcludes */;
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return 536896512 /* ObjectLiteralExcludes */;
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return 536879104 /* CatchClauseExcludes */;
- case 184 /* ObjectBindingPattern */:
- case 185 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
return 536875008 /* BindingPatternExcludes */;
- case 194 /* TypeAssertionExpression */:
- case 212 /* AsExpression */:
- case 313 /* PartiallyEmittedExpression */:
- case 195 /* ParenthesizedExpression */:
- case 98 /* SuperKeyword */:
+ case 195 /* TypeAssertionExpression */:
+ case 213 /* AsExpression */:
+ case 314 /* PartiallyEmittedExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 99 /* SuperKeyword */:
return 536870912 /* OuterExpressionExcludes */;
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return 536870912 /* PropertyAccessExcludes */;
default:
return 536870912 /* NodeExcludes */;
@@ -31075,7 +31271,7 @@
// (their type resolved directly to the member deeply referenced)
// So to get the intervening symbols, we need to check if there's a type
// query node on any of the symbol's declarations and get symbols there
- if (d.type && d.type.kind === 167 /* TypeQuery */) {
+ if (d.type && d.type.kind === 168 /* TypeQuery */) {
var query = d.type;
var entity = getResolvedSymbol(getFirstIdentifier(query.exprName));
visitSymbol(entity);
@@ -31174,8 +31370,6 @@
undefinedSymbol.declarations = [];
var globalThisSymbol = createSymbol(1536 /* Module */, "globalThis", 8 /* Readonly */);
globalThisSymbol.exports = globals;
- globalThisSymbol.valueDeclaration = ts.createNode(72 /* Identifier */);
- globalThisSymbol.valueDeclaration.escapedText = "globalThis";
globals.set(globalThisSymbol.escapedName, globalThisSymbol);
var argumentsSymbol = createSymbol(4 /* Property */, "arguments");
var requireSymbol = createSymbol(4 /* Property */, "require");
@@ -31191,6 +31385,11 @@
getIdentifierCount: function () { return ts.sum(host.getSourceFiles(), "identifierCount"); },
getSymbolCount: function () { return ts.sum(host.getSourceFiles(), "symbolCount") + symbolCount; },
getTypeCount: function () { return typeCount; },
+ getRelationCacheSizes: function () { return ({
+ assignable: assignableRelation.size,
+ identity: identityRelation.size,
+ subtype: subtypeRelation.size,
+ }); },
isUndefinedSymbol: function (symbol) { return symbol === undefinedSymbol; },
isArgumentsSymbol: function (symbol) { return symbol === argumentsSymbol; },
isUnknownSymbol: function (symbol) { return symbol === unknownSymbol; },
@@ -31257,6 +31456,10 @@
node = ts.getParseTreeNode(node);
return node ? getTypeOfNode(node) : errorType;
},
+ getTypeOfAssignmentPattern: function (nodeIn) {
+ var node = ts.getParseTreeNode(nodeIn, ts.isAssignmentPattern);
+ return node && getTypeOfAssignmentPattern(node) || errorType;
+ },
getPropertySymbolOfDestructuringAssignment: function (locationIn) {
var location = ts.getParseTreeNode(locationIn, ts.isIdentifier);
return location ? getPropertySymbolOfDestructuringAssignment(location) : undefined;
@@ -31305,11 +31508,11 @@
},
isContextSensitive: isContextSensitive,
getFullyQualifiedName: getFullyQualifiedName,
- getResolvedSignature: function (node, candidatesOutArray, agumentCount) {
- return getResolvedSignatureWorker(node, candidatesOutArray, agumentCount, 0 /* Normal */);
+ getResolvedSignature: function (node, candidatesOutArray, argumentCount) {
+ return getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 0 /* Normal */);
},
- getResolvedSignatureForSignatureHelp: function (node, candidatesOutArray, agumentCount) {
- return getResolvedSignatureWorker(node, candidatesOutArray, agumentCount, 16 /* IsForSignatureHelp */);
+ getResolvedSignatureForSignatureHelp: function (node, candidatesOutArray, argumentCount) {
+ return getResolvedSignatureWorker(node, candidatesOutArray, argumentCount, 16 /* IsForSignatureHelp */);
},
getExpandedParameters: getExpandedParameters,
hasEffectiveRestParameter: hasEffectiveRestParameter,
@@ -31452,7 +31655,7 @@
var intersectionTypes = ts.createMap();
var literalTypes = ts.createMap();
var indexedAccessTypes = ts.createMap();
- var conditionalTypes = ts.createMap();
+ var substitutionTypes = ts.createMap();
var evolvingArrayTypes = [];
var undefinedProperties = ts.createMap();
var unknownSymbol = createSymbol(4 /* Property */, "unknown");
@@ -31532,6 +31735,7 @@
* This is only used if there is no exact match.
*/
var patternAmbientModules;
+ var patternAmbientModuleAugmentations;
var globalObjectType;
var globalFunctionType;
var globalCallableFunctionType;
@@ -31566,8 +31770,7 @@
var deferredGlobalTemplateStringsArrayType;
var deferredGlobalImportMetaType;
var deferredGlobalExtractSymbol;
- var deferredGlobalExcludeSymbol;
- var deferredGlobalPickSymbol;
+ var deferredGlobalOmitSymbol;
var deferredGlobalBigIntType;
var allPotentiallyUnusedIdentifiers = ts.createMap(); // key is file name
var flowLoopStart = 0;
@@ -31586,6 +31789,8 @@
var symbolLinks = [];
var nodeLinks = [];
var flowLoopCaches = [];
+ var flowAssignmentKeys = [];
+ var flowAssignmentTypes = [];
var flowLoopNodes = [];
var flowLoopKeys = [];
var flowLoopTypes = [];
@@ -31702,6 +31907,7 @@
var typeofType = createTypeofType();
var _jsxNamespace;
var _jsxFactoryEntity;
+ var outofbandVarianceMarkerHandler;
var subtypeRelation = ts.createMap();
var assignableRelation = ts.createMap();
var comparableRelation = ts.createMap();
@@ -31726,6 +31932,18 @@
CheckMode[CheckMode["SkipGenericFunctions"] = 8] = "SkipGenericFunctions";
CheckMode[CheckMode["IsForSignatureHelp"] = 16] = "IsForSignatureHelp";
})(CheckMode || (CheckMode = {}));
+ var ContextFlags;
+ (function (ContextFlags) {
+ ContextFlags[ContextFlags["None"] = 0] = "None";
+ ContextFlags[ContextFlags["Signature"] = 1] = "Signature";
+ })(ContextFlags || (ContextFlags = {}));
+ var AccessFlags;
+ (function (AccessFlags) {
+ AccessFlags[AccessFlags["None"] = 0] = "None";
+ AccessFlags[AccessFlags["NoIndexSignatures"] = 1] = "NoIndexSignatures";
+ AccessFlags[AccessFlags["Writing"] = 2] = "Writing";
+ AccessFlags[AccessFlags["CacheSymbol"] = 4] = "CacheSymbol";
+ })(AccessFlags || (AccessFlags = {}));
var CallbackCheck;
(function (CallbackCheck) {
CallbackCheck[CallbackCheck["None"] = 0] = "None";
@@ -31900,7 +32118,8 @@
* Note: if target is transient, then it is mutable, and mergeSymbol with both mutate and return it.
* If target is not transient, mergeSymbol will produce a transient clone, mutate that and return it.
*/
- function mergeSymbol(target, source) {
+ function mergeSymbol(target, source, unidirectional) {
+ if (unidirectional === void 0) { unidirectional = false; }
if (!(target.flags & getExcludedSymbolFlags(source.flags)) ||
(source.flags | target.flags) & 67108864 /* Assignment */) {
ts.Debug.assert(source !== target);
@@ -31928,18 +32147,25 @@
if (source.members) {
if (!target.members)
target.members = ts.createSymbolTable();
- mergeSymbolTable(target.members, source.members);
+ mergeSymbolTable(target.members, source.members, unidirectional);
}
if (source.exports) {
if (!target.exports)
target.exports = ts.createSymbolTable();
- mergeSymbolTable(target.exports, source.exports);
+ mergeSymbolTable(target.exports, source.exports, unidirectional);
}
+ if (!unidirectional) {
recordMergedSymbol(target, source);
}
+ }
else if (target.flags & 1024 /* NamespaceModule */) {
+ // Do not report an error when merging `var globalThis` with the built-in `globalThis`,
+ // as we will already report a "Declaration name conflicts..." error, and this error
+ // won't make much sense.
+ if (target !== globalThisSymbol) {
error(ts.getNameOfDeclaration(source.declarations[0]), ts.Diagnostics.Cannot_augment_module_0_with_value_exports_because_it_resolves_to_a_non_module_entity, symbolToString(target));
}
+ }
else { // error
var isEitherEnum = !!(target.flags & 384 /* Enum */ || source.flags & 384 /* Enum */);
var isEitherBlockScoped_1 = !!(target.flags & 2 /* BlockScopedVariable */ || source.flags & 2 /* BlockScopedVariable */);
@@ -32003,10 +32229,11 @@
mergeSymbolTable(combined, second);
return combined;
}
- function mergeSymbolTable(target, source) {
+ function mergeSymbolTable(target, source, unidirectional) {
+ if (unidirectional === void 0) { unidirectional = false; }
source.forEach(function (sourceSymbol, id) {
var targetSymbol = target.get(id);
- target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol) : sourceSymbol);
+ target.set(id, targetSymbol ? mergeSymbol(targetSymbol, sourceSymbol, unidirectional) : sourceSymbol);
});
}
function mergeModuleAugmentation(moduleName) {
@@ -32027,14 +32254,29 @@
var moduleNotFoundError = !(moduleName.parent.parent.flags & 4194304 /* Ambient */)
? ts.Diagnostics.Invalid_module_name_in_augmentation_module_0_cannot_be_found
: undefined;
- var mainModule = resolveExternalModuleNameWorker(moduleName, moduleName, moduleNotFoundError, /*isForAugmentation*/ true);
- if (!mainModule) {
+ var mainModule_1 = resolveExternalModuleNameWorker(moduleName, moduleName, moduleNotFoundError, /*isForAugmentation*/ true);
+ if (!mainModule_1) {
return;
}
// obtain item referenced by 'export='
- mainModule = resolveExternalModuleSymbol(mainModule);
- if (mainModule.flags & 1920 /* Namespace */) {
- mainModule = mergeSymbol(mainModule, moduleAugmentation.symbol);
+ mainModule_1 = resolveExternalModuleSymbol(mainModule_1);
+ if (mainModule_1.flags & 1920 /* Namespace */) {
+ // If we’re merging an augmentation to a pattern ambient module, we want to
+ // perform the merge unidirectionally from the augmentation ('a.foo') to
+ // the pattern ('*.foo'), so that 'getMergedSymbol()' on a.foo gives you
+ // all the exports both from the pattern and from the augmentation, but
+ // 'getMergedSymbol()' on *.foo only gives you exports from *.foo.
+ if (ts.some(patternAmbientModules, function (module) { return mainModule_1 === module.symbol; })) {
+ var merged = mergeSymbol(moduleAugmentation.symbol, mainModule_1, /*unidirectional*/ true);
+ if (!patternAmbientModuleAugmentations) {
+ patternAmbientModuleAugmentations = ts.createMap();
+ }
+ // moduleName will be a StringLiteral since this is not `declare global`.
+ patternAmbientModuleAugmentations.set(moduleName.text, merged);
+ }
+ else {
+ mergeSymbol(mainModule_1, moduleAugmentation.symbol);
+ }
}
else {
// moduleName will be a StringLiteral since this is not `declare global`.
@@ -32068,7 +32310,7 @@
return nodeLinks[nodeId] || (nodeLinks[nodeId] = { flags: 0 });
}
function isGlobalSourceFile(node) {
- return node.kind === 284 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node);
+ return node.kind === 285 /* SourceFile */ && !ts.isExternalOrCommonJsModule(node);
}
function getSymbol(symbols, name, meaning) {
if (meaning) {
@@ -32126,17 +32368,17 @@
}
if (declaration.pos <= usage.pos) {
// declaration is before usage
- if (declaration.kind === 186 /* BindingElement */) {
+ if (declaration.kind === 187 /* BindingElement */) {
// still might be illegal if declaration and usage are both binding elements (eg var [a = b, b = b] = [1, 2])
- var errorBindingElement = ts.getAncestor(usage, 186 /* BindingElement */);
+ var errorBindingElement = ts.getAncestor(usage, 187 /* BindingElement */);
if (errorBindingElement) {
return ts.findAncestor(errorBindingElement, ts.isBindingElement) !== ts.findAncestor(declaration, ts.isBindingElement) ||
declaration.pos < errorBindingElement.pos;
}
// or it might be illegal if usage happens before parent variable is declared (eg var [a] = a)
- return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 237 /* VariableDeclaration */), usage);
+ return isBlockScopedNameDeclaredBeforeUse(ts.getAncestor(declaration, 238 /* VariableDeclaration */), usage);
}
- else if (declaration.kind === 237 /* VariableDeclaration */) {
+ else if (declaration.kind === 238 /* VariableDeclaration */) {
// still might be illegal if usage is in the initializer of the variable declaration (eg var a = a)
return !isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage);
}
@@ -32144,6 +32386,10 @@
// still might be illegal if the usage is within a computed property name in the class (eg class A { static p = "a"; [A.p]() {} })
return !ts.findAncestor(usage, function (n) { return ts.isComputedPropertyName(n) && n.parent.parent === declaration; });
}
+ else if (ts.isPropertyDeclaration(declaration)) {
+ // still might be illegal if a self-referencing property initializer (eg private x = this.x)
+ return !isPropertyImmediatelyReferencedWithinDeclaration(declaration, usage);
+ }
return true;
}
// declaration is after usage, but it can still be legal if usage is deferred:
@@ -32155,12 +32401,12 @@
// or if usage is in a type context:
// 1. inside a type query (typeof in type position)
// 2. inside a jsdoc comment
- if (usage.parent.kind === 257 /* ExportSpecifier */ || (usage.parent.kind === 254 /* ExportAssignment */ && usage.parent.isExportEquals)) {
+ if (usage.parent.kind === 258 /* ExportSpecifier */ || (usage.parent.kind === 255 /* ExportAssignment */ && usage.parent.isExportEquals)) {
// export specifiers do not use the variable, they only make it available for use
return true;
}
// When resolving symbols for exports, the `usage` location passed in can be the export site directly
- if (usage.kind === 254 /* ExportAssignment */ && usage.isExportEquals) {
+ if (usage.kind === 255 /* ExportAssignment */ && usage.isExportEquals) {
return true;
}
var container = ts.getEnclosingBlockScopeContainer(declaration);
@@ -32168,9 +32414,9 @@
function isImmediatelyUsedInInitializerOfBlockScopedVariable(declaration, usage) {
var container = ts.getEnclosingBlockScopeContainer(declaration);
switch (declaration.parent.parent.kind) {
- case 219 /* VariableStatement */:
- case 225 /* ForStatement */:
- case 227 /* ForOfStatement */:
+ case 220 /* VariableStatement */:
+ case 226 /* ForStatement */:
+ case 228 /* ForOfStatement */:
// variable statement/for/for-of statement case,
// use site should not be inside variable declaration (initializer of declaration or binding element)
if (isSameScopeDescendentOf(usage, declaration, container)) {
@@ -32191,16 +32437,16 @@
return true;
}
var initializerOfProperty = current.parent &&
- current.parent.kind === 154 /* PropertyDeclaration */ &&
+ current.parent.kind === 155 /* PropertyDeclaration */ &&
current.parent.initializer === current;
if (initializerOfProperty) {
if (ts.hasModifier(current.parent, 32 /* Static */)) {
- if (declaration.kind === 156 /* MethodDeclaration */) {
+ if (declaration.kind === 157 /* MethodDeclaration */) {
return true;
}
}
else {
- var isDeclarationInstanceProperty = declaration.kind === 154 /* PropertyDeclaration */ && !ts.hasModifier(declaration, 32 /* Static */);
+ var isDeclarationInstanceProperty = declaration.kind === 155 /* PropertyDeclaration */ && !ts.hasModifier(declaration, 32 /* Static */);
if (!isDeclarationInstanceProperty || ts.getContainingClass(usage) !== ts.getContainingClass(declaration)) {
return true;
}
@@ -32209,6 +32455,36 @@
return false;
});
}
+ function isPropertyImmediatelyReferencedWithinDeclaration(declaration, usage) {
+ // always legal if usage is after declaration
+ if (usage.end > declaration.end) {
+ return false;
+ }
+ // still might be legal if usage is deferred (e.g. x: any = () => this.x)
+ // otherwise illegal if immediately referenced within the declaration (e.g. x: any = this.x)
+ var ancestorChangingReferenceScope = ts.findAncestor(usage, function (node) {
+ if (node === declaration) {
+ return "quit";
+ }
+ switch (node.kind) {
+ case 198 /* ArrowFunction */:
+ case 155 /* PropertyDeclaration */:
+ return true;
+ case 219 /* Block */:
+ switch (node.parent.kind) {
+ case 159 /* GetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 160 /* SetAccessor */:
+ return true;
+ default:
+ return false;
+ }
+ default:
+ return false;
+ }
+ });
+ return ancestorChangingReferenceScope === undefined;
+ }
}
/**
* Resolve a given name for a given meaning at a given location. An error is reported if the name was not found and
@@ -32227,6 +32503,8 @@
var lastLocation;
var lastSelfReferenceLocation;
var propertyWithInvalidInitializer;
+ var associatedDeclarationForContainingInitializer;
+ var withinDeferredContext = false;
var errorLocation = location;
var grandparent;
var isInExternalModule = false;
@@ -32242,12 +32520,12 @@
// - parameters are only in the scope of function body
// This restriction does not apply to JSDoc comment types because they are parented
// at a higher level than type parameters would normally be
- if (meaning & result.flags & 67897832 /* Type */ && lastLocation.kind !== 296 /* JSDocComment */) {
+ if (meaning & result.flags & 67897832 /* Type */ && lastLocation.kind !== 297 /* JSDocComment */) {
useResult = result.flags & 262144 /* TypeParameter */
// type parameters are visible in parameter list, return type and type parameter list
? lastLocation === location.type ||
- lastLocation.kind === 151 /* Parameter */ ||
- lastLocation.kind === 150 /* TypeParameter */
+ lastLocation.kind === 152 /* Parameter */ ||
+ lastLocation.kind === 151 /* TypeParameter */
// local types not visible outside the function body
: false;
}
@@ -32264,13 +32542,13 @@
// however it is detected separately when checking initializers of parameters
// to make sure that they reference no variables declared after them.
useResult =
- lastLocation.kind === 151 /* Parameter */ ||
+ lastLocation.kind === 152 /* Parameter */ ||
(lastLocation === location.type &&
!!ts.findAncestor(result.valueDeclaration, ts.isParameter));
}
}
}
- else if (location.kind === 175 /* ConditionalType */) {
+ else if (location.kind === 176 /* ConditionalType */) {
// A type parameter declared using 'infer T' in a conditional type is visible only in
// the true branch of the conditional type.
useResult = lastLocation === location.trueType;
@@ -32283,15 +32561,16 @@
}
}
}
+ withinDeferredContext = withinDeferredContext || getIsDeferredContext(location, lastLocation);
switch (location.kind) {
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
if (!ts.isExternalOrCommonJsModule(location))
break;
isInExternalModule = true;
// falls through
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
var moduleExports = getSymbolOfNode(location).exports;
- if (location.kind === 284 /* SourceFile */ || ts.isAmbientModule(location)) {
+ if (location.kind === 285 /* SourceFile */ || ts.isAmbientModule(location)) {
// It's an external module. First see if the module has an export default and if the local
// name of that export default matches.
if (result = moduleExports.get("default" /* Default */)) {
@@ -32315,7 +32594,7 @@
var moduleExport = moduleExports.get(name);
if (moduleExport &&
moduleExport.flags === 2097152 /* Alias */ &&
- ts.getDeclarationOfKind(moduleExport, 257 /* ExportSpecifier */)) {
+ ts.getDeclarationOfKind(moduleExport, 258 /* ExportSpecifier */)) {
break;
}
}
@@ -32329,20 +32608,19 @@
}
}
break;
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
if (result = lookup(getSymbolOfNode(location).exports, name, meaning & 8 /* EnumMember */)) {
break loop;
}
break;
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
// TypeScript 1.0 spec (April 2014): 8.4.1
// Initializer expressions for instance member variables are evaluated in the scope
// of the class constructor body but are not permitted to reference parameters or
// local variables of the constructor. This effectively means that entities from outer scopes
// by the same name as a constructor parameter or local variable are inaccessible
// in initializer expressions for instance member variables.
- if (ts.isClassLike(location.parent) && !ts.hasModifier(location, 32 /* Static */)) {
+ if (!ts.hasModifier(location, 32 /* Static */)) {
var ctor = findConstructorDeclaration(location.parent);
if (ctor && ctor.locals) {
if (lookup(ctor.locals, name, meaning & 67220415 /* Value */)) {
@@ -32352,9 +32630,9 @@
}
}
break;
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
// The below is used to lookup type parameters within a class or interface, as they are added to the class/interface locals
// These can never be latebound, so the symbol's raw members are sufficient. `getMembersOfNode` cannot be used, as it would
// trigger resolving late-bound names, which we may already be in the process of doing while we're here!
@@ -32373,7 +32651,7 @@
}
break loop;
}
- if (location.kind === 209 /* ClassExpression */ && meaning & 32 /* Class */) {
+ if (location.kind === 210 /* ClassExpression */ && meaning & 32 /* Class */) {
var className = location.name;
if (className && name === className.escapedText) {
result = location.symbol;
@@ -32381,9 +32659,9 @@
}
}
break;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
// The type parameters of a class are not in scope in the base class expression.
- if (lastLocation === location.expression && location.parent.token === 86 /* ExtendsKeyword */) {
+ if (lastLocation === location.expression && location.parent.token === 87 /* ExtendsKeyword */) {
var container = location.parent.parent;
if (ts.isClassLike(container) && (result = lookup(getSymbolOfNode(container).members, name, meaning & 67897832 /* Type */))) {
if (nameNotFoundMessage) {
@@ -32401,9 +32679,9 @@
// [foo<T>()]() { } // <-- Reference to T from class's own computed property
// }
//
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
grandparent = location.parent.parent;
- if (ts.isClassLike(grandparent) || grandparent.kind === 241 /* InterfaceDeclaration */) {
+ if (ts.isClassLike(grandparent) || grandparent.kind === 242 /* InterfaceDeclaration */) {
// A reference to this grandparent's type parameters would be an error
if (result = lookup(getSymbolOfNode(grandparent).members, name, meaning & 67897832 /* Type */)) {
error(errorLocation, ts.Diagnostics.A_computed_property_name_cannot_reference_a_type_parameter_from_its_containing_type);
@@ -32411,24 +32689,24 @@
}
}
break;
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
// when targeting ES6 or higher there is no 'arguments' in an arrow function
// for lower compile targets the resolved symbol is used to emit an error
if (compilerOptions.target >= 2 /* ES2015 */) {
break;
}
// falls through
- case 156 /* MethodDeclaration */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 239 /* FunctionDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 240 /* FunctionDeclaration */:
if (meaning & 3 /* Variable */ && name === "arguments") {
result = argumentsSymbol;
break loop;
}
break;
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
if (meaning & 3 /* Variable */ && name === "arguments") {
result = argumentsSymbol;
break loop;
@@ -32441,7 +32719,7 @@
}
}
break;
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
// Decorators are resolved at the class declaration. Resolving at the parameter
// or member would result in looking up locals in the method.
//
@@ -32450,7 +32728,7 @@
// method(@y x, y) {} // <-- decorator y should be resolved at the class declaration, not the parameter.
// }
//
- if (location.parent && location.parent.kind === 151 /* Parameter */) {
+ if (location.parent && location.parent.kind === 152 /* Parameter */) {
location = location.parent;
}
//
@@ -32465,15 +32743,28 @@
// declare function y(x: T): any;
// @param(1 as T) // <-- T should resolve to the type alias outside of class C
// class C<T> {}
- if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 240 /* ClassDeclaration */)) {
+ if (location.parent && (ts.isClassElement(location.parent) || location.parent.kind === 241 /* ClassDeclaration */)) {
location = location.parent;
}
break;
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
// js type aliases do not resolve names from their host, so skip past it
location = ts.getJSDocHost(location);
break;
+ case 152 /* Parameter */:
+ if (lastLocation && lastLocation === location.initializer) {
+ associatedDeclarationForContainingInitializer = location;
+ }
+ break;
+ case 187 /* BindingElement */:
+ if (lastLocation && lastLocation === location.initializer) {
+ var root = ts.getRootDeclaration(location);
+ if (root.kind === 152 /* Parameter */) {
+ associatedDeclarationForContainingInitializer = location;
+ }
+ }
+ break;
}
if (isSelfReferenceLocation(location)) {
lastSelfReferenceLocation = location;
@@ -32489,7 +32780,7 @@
}
if (!result) {
if (lastLocation) {
- ts.Debug.assert(lastLocation.kind === 284 /* SourceFile */);
+ ts.Debug.assert(lastLocation.kind === 285 /* SourceFile */);
if (lastLocation.commonJsModuleIndicator && name === "exports" && meaning & lastLocation.symbol.flags) {
return lastLocation.symbol;
}
@@ -32565,20 +32856,48 @@
if (result && isInExternalModule && (meaning & 67220415 /* Value */) === 67220415 /* Value */ && !(originalLocation.flags & 2097152 /* JSDoc */)) {
var merged = getMergedSymbol(result);
if (ts.length(merged.declarations) && ts.every(merged.declarations, function (d) { return ts.isNamespaceExportDeclaration(d) || ts.isSourceFile(d) && !!d.symbol.globalExports; })) {
- error(errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, ts.unescapeLeadingUnderscores(name)); // TODO: GH#18217
+ errorOrSuggestion(!compilerOptions.allowUmdGlobalAccess, errorLocation, ts.Diagnostics._0_refers_to_a_UMD_global_but_the_current_file_is_a_module_Consider_adding_an_import_instead, ts.unescapeLeadingUnderscores(name));
+ }
+ }
+ // If we're in a parameter initializer, we can't reference the values of the parameter whose initializer we're within or parameters to the right
+ if (result && associatedDeclarationForContainingInitializer && !withinDeferredContext && (meaning & 67220415 /* Value */) === 67220415 /* Value */) {
+ var candidate = getMergedSymbol(getLateBoundSymbol(result));
+ var root = ts.getRootDeclaration(associatedDeclarationForContainingInitializer);
+ // A parameter initializer or binding pattern initializer within a parameter cannot refer to itself
+ if (candidate === getSymbolOfNode(associatedDeclarationForContainingInitializer)) {
+ error(errorLocation, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(associatedDeclarationForContainingInitializer.name));
+ }
+ // And it cannot refer to any declarations which come after it
+ else if (candidate.valueDeclaration && candidate.valueDeclaration.pos > associatedDeclarationForContainingInitializer.pos && root.parent.locals && lookup(root.parent.locals, candidate.escapedName, meaning) === candidate) {
+ error(errorLocation, ts.Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(associatedDeclarationForContainingInitializer.name), ts.declarationNameToString(errorLocation));
}
}
}
return result;
}
+ function getIsDeferredContext(location, lastLocation) {
+ if (location.kind !== 198 /* ArrowFunction */ && location.kind !== 197 /* FunctionExpression */) {
+ // initializers in instance property declaration of class like entities are executed in constructor and thus deferred
+ return ts.isTypeQueryNode(location) || ((ts.isFunctionLikeDeclaration(location) ||
+ (location.kind === 155 /* PropertyDeclaration */ && !ts.hasModifier(location, 32 /* Static */))) && (!lastLocation || lastLocation !== location.name)); // A name is evaluated within the enclosing scope - so it shouldn't count as deferred
+ }
+ if (lastLocation && lastLocation === location.name) {
+ return false;
+ }
+ // generator functions and async functions are not inlined in control flow when immediately invoked
+ if (location.asteriskToken || ts.hasModifier(location, 256 /* Async */)) {
+ return true;
+ }
+ return !ts.getImmediatelyInvokedFunctionExpression(location);
+ }
function isSelfReferenceLocation(node) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 244 /* ModuleDeclaration */: // For `namespace N { N; }`
+ case 240 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 245 /* ModuleDeclaration */: // For `namespace N { N; }`
return true;
default:
return false;
@@ -32590,7 +32909,7 @@
function isTypeParameterSymbolDeclaredInContainer(symbol, container) {
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var decl = _a[_i];
- if (decl.kind === 150 /* TypeParameter */) {
+ if (decl.kind === 151 /* TypeParameter */) {
var parent = ts.isJSDocTemplateTag(decl.parent) ? ts.getJSDocHost(decl.parent) : decl.parent;
if (parent === container) {
return !(ts.isJSDocTemplateTag(decl.parent) && ts.find(decl.parent.parent.tags, ts.isJSDocTypeAlias)); // TODO: GH#18217
@@ -32645,10 +32964,10 @@
*/
function getEntityNameForExtendingInterface(node) {
switch (node.kind) {
- case 72 /* Identifier */:
- case 189 /* PropertyAccessExpression */:
+ case 73 /* Identifier */:
+ case 190 /* PropertyAccessExpression */:
return node.parent ? getEntityNameForExtendingInterface(node.parent) : undefined;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
if (ts.isEntityNameExpression(node.expression)) {
return node.expression;
}
@@ -32737,7 +33056,7 @@
function checkResolvedBlockScopedVariable(result, errorLocation) {
ts.Debug.assert(!!(result.flags & 2 /* BlockScopedVariable */ || result.flags & 32 /* Class */ || result.flags & 384 /* Enum */));
// Block-scoped variables cannot be used before their definition
- var declaration = ts.find(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 243 /* EnumDeclaration */) || ts.isInJSFile(d) && !!ts.getJSDocEnumTag(d); });
+ var declaration = ts.find(result.declarations, function (d) { return ts.isBlockOrCatchScoped(d) || ts.isClassLike(d) || (d.kind === 244 /* EnumDeclaration */) || ts.isInJSFile(d) && !!ts.getJSDocEnumTag(d); });
if (declaration === undefined)
return ts.Debug.fail("Declaration to checkResolvedBlockScopedVariable is undefined");
if (!(declaration.flags & 4194304 /* Ambient */) && !isBlockScopedNameDeclaredBeforeUse(declaration, errorLocation)) {
@@ -32772,13 +33091,13 @@
}
function getAnyImportSyntax(node) {
switch (node.kind) {
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return node;
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
return node.parent;
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
return node.parent.parent;
- case 253 /* ImportSpecifier */:
+ case 254 /* ImportSpecifier */:
return node.parent.parent.parent;
default:
return undefined;
@@ -32788,7 +33107,7 @@
return ts.find(symbol.declarations, ts.isAliasSymbolDeclaration);
}
function getTargetOfImportEqualsDeclaration(node, dontResolveAlias) {
- if (node.moduleReference.kind === 259 /* ExternalModuleReference */) {
+ if (node.moduleReference.kind === 260 /* ExternalModuleReference */) {
return resolveExternalModuleSymbol(resolveExternalModuleName(node, ts.getExternalModuleImportEqualsDeclarationExpression(node)));
}
return getSymbolOfPartOfRightHandSideOfImportEquals(node.moduleReference, dontResolveAlias);
@@ -32845,8 +33164,17 @@
var file = ts.find(moduleSymbol.declarations, ts.isSourceFile);
var hasSyntheticDefault = canHaveSyntheticDefault(file, moduleSymbol, dontResolveAlias);
if (!exportDefaultSymbol && !hasSyntheticDefault) {
+ if (hasExportAssignmentSymbol(moduleSymbol)) {
+ var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015 ? "allowSyntheticDefaultImports" : "esModuleInterop";
+ var exportEqualsSymbol = moduleSymbol.exports.get("export=" /* ExportEquals */);
+ var exportAssignment = exportEqualsSymbol.valueDeclaration;
+ var err = error(node.name, ts.Diagnostics.Module_0_can_only_be_default_imported_using_the_1_flag, symbolToString(moduleSymbol), compilerOptionName);
+ ts.addRelatedInfo(err, ts.createDiagnosticForNode(exportAssignment, ts.Diagnostics.This_module_is_declared_with_using_export_and_can_only_be_used_with_a_default_import_when_using_the_0_flag, compilerOptionName));
+ }
+ else {
error(node.name, ts.Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol));
}
+ }
else if (hasSyntheticDefault) {
// per emit behavior, a synthetic default overrides a "real" .default member if `__esModule` is not present
return resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias) || resolveSymbol(moduleSymbol, dontResolveAlias);
@@ -32980,20 +33308,20 @@
function getTargetOfAliasDeclaration(node, dontRecursivelyResolve) {
if (dontRecursivelyResolve === void 0) { dontRecursivelyResolve = false; }
switch (node.kind) {
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return getTargetOfImportEqualsDeclaration(node, dontRecursivelyResolve);
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
return getTargetOfImportClause(node, dontRecursivelyResolve);
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
return getTargetOfNamespaceImport(node, dontRecursivelyResolve);
- case 253 /* ImportSpecifier */:
+ case 254 /* ImportSpecifier */:
return getTargetOfImportSpecifier(node, dontRecursivelyResolve);
- case 257 /* ExportSpecifier */:
+ case 258 /* ExportSpecifier */:
return getTargetOfExportSpecifier(node, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */, dontRecursivelyResolve);
- case 254 /* ExportAssignment */:
- case 204 /* BinaryExpression */:
+ case 255 /* ExportAssignment */:
+ case 205 /* BinaryExpression */:
return getTargetOfExportAssignment(node, dontRecursivelyResolve);
- case 247 /* NamespaceExportDeclaration */:
+ case 248 /* NamespaceExportDeclaration */:
return getTargetOfNamespaceExportDeclaration(node, dontRecursivelyResolve);
default:
return ts.Debug.fail();
@@ -33054,11 +33382,11 @@
var node = getDeclarationOfAliasSymbol(symbol);
if (!node)
return ts.Debug.fail();
- if (node.kind === 254 /* ExportAssignment */) {
+ if (node.kind === 255 /* ExportAssignment */) {
// export default <symbol>
checkExpressionCached(node.expression);
}
- else if (node.kind === 257 /* ExportSpecifier */) {
+ else if (node.kind === 258 /* ExportSpecifier */) {
// export { <symbol> } or export { <symbol> as foo }
checkExpressionCached(node.propertyName || node.name);
}
@@ -33076,17 +33404,17 @@
// import a = |b|; // Namespace
// import a = |b.c|; // Value, type, namespace
// import a = |b.c|.d; // Namespace
- if (entityName.kind === 72 /* Identifier */ && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {
+ if (entityName.kind === 73 /* Identifier */ && ts.isRightSideOfQualifiedNameOrPropertyAccess(entityName)) {
entityName = entityName.parent;
}
// Check for case 1 and 3 in the above example
- if (entityName.kind === 72 /* Identifier */ || entityName.parent.kind === 148 /* QualifiedName */) {
+ if (entityName.kind === 73 /* Identifier */ || entityName.parent.kind === 149 /* QualifiedName */) {
return resolveEntityName(entityName, 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias);
}
else {
// Case 2 in above example
// entityName.kind could be a QualifiedName or a Missing identifier
- ts.Debug.assert(entityName.parent.kind === 248 /* ImportEqualsDeclaration */);
+ ts.Debug.assert(entityName.parent.kind === 249 /* ImportEqualsDeclaration */);
return resolveEntityName(entityName, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */, /*ignoreErrors*/ false, dontResolveAlias);
}
}
@@ -33102,17 +33430,17 @@
}
var namespaceMeaning = 1920 /* Namespace */ | (ts.isInJSFile(name) ? meaning & 67220415 /* Value */ : 0);
var symbol;
- if (name.kind === 72 /* Identifier */) {
- var message = meaning === namespaceMeaning ? ts.Diagnostics.Cannot_find_namespace_0 : getCannotFindNameDiagnosticForName(getFirstIdentifier(name).escapedText);
+ if (name.kind === 73 /* Identifier */) {
+ var message = meaning === namespaceMeaning ? ts.Diagnostics.Cannot_find_namespace_0 : getCannotFindNameDiagnosticForName(getFirstIdentifier(name));
var symbolFromJSPrototype = ts.isInJSFile(name) ? resolveEntityNameFromAssignmentDeclaration(name, meaning) : undefined;
symbol = resolveName(location || name, name.escapedText, meaning, ignoreErrors || symbolFromJSPrototype ? undefined : message, name, /*isUse*/ true);
if (!symbol) {
return symbolFromJSPrototype;
}
}
- else if (name.kind === 148 /* QualifiedName */ || name.kind === 189 /* PropertyAccessExpression */) {
- var left = name.kind === 148 /* QualifiedName */ ? name.left : name.expression;
- var right = name.kind === 148 /* QualifiedName */ ? name.right : name.name;
+ else if (name.kind === 149 /* QualifiedName */ || name.kind === 190 /* PropertyAccessExpression */) {
+ var left = name.kind === 149 /* QualifiedName */ ? name.left : name.expression;
+ var right = name.kind === 149 /* QualifiedName */ ? name.right : name.name;
var namespace = resolveEntityName(left, namespaceMeaning, ignoreErrors, /*dontResolveAlias*/ false, location);
if (!namespace || ts.nodeIsMissing(right)) {
return undefined;
@@ -33247,6 +33575,14 @@
if (patternAmbientModules) {
var pattern = ts.findBestPatternMatch(patternAmbientModules, function (_) { return _.pattern; }, moduleReference);
if (pattern) {
+ // If the module reference matched a pattern ambient module ('*.foo') but there’s also a
+ // module augmentation by the specific name requested ('a.foo'), we store the merged symbol
+ // by the augmentation name ('a.foo'), because asking for *.foo should not give you exports
+ // from a.foo.
+ var augmentation = patternAmbientModuleAugmentations && patternAmbientModuleAugmentations.get(moduleReference);
+ if (augmentation) {
+ return getMergedSymbol(augmentation);
+ }
return getMergedSymbol(pattern.symbol);
}
}
@@ -33337,7 +33673,7 @@
function resolveESModuleSymbol(moduleSymbol, referencingLocation, dontResolveAlias) {
var symbol = resolveExternalModuleSymbol(moduleSymbol, dontResolveAlias);
if (!dontResolveAlias && symbol) {
- if (!(symbol.flags & (1536 /* Module */ | 3 /* Variable */)) && !ts.getDeclarationOfKind(symbol, 284 /* SourceFile */)) {
+ if (!(symbol.flags & (1536 /* Module */ | 3 /* Variable */)) && !ts.getDeclarationOfKind(symbol, 285 /* SourceFile */)) {
var compilerOptionName = moduleKind >= ts.ModuleKind.ES2015
? "allowSyntheticDefaultImports"
: "esModuleInterop";
@@ -33599,7 +33935,7 @@
var members = node.members;
for (var _i = 0, members_2 = members; _i < members_2.length; _i++) {
var member = members_2[_i];
- if (member.kind === 157 /* Constructor */ && ts.nodeIsPresent(member.body)) {
+ if (member.kind === 158 /* Constructor */ && ts.nodeIsPresent(member.body)) {
return member;
}
}
@@ -33645,7 +33981,7 @@
return type;
}
// A reserved member name starts with two underscores, but the third character cannot be an underscore
- // or the @ symbol. A third underscore indicates an escaped form of an identifer that started
+ // or the @ symbol. A third underscore indicates an escaped form of an identifier that started
// with at least two underscores. The @ character indicates that the name is denoted by a well known ES
// Symbol instance.
function isReservedMemberName(name) {
@@ -33685,12 +34021,12 @@
}
}
switch (location.kind) {
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
if (!ts.isExternalOrCommonJsModule(location)) {
break;
}
// falls through
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
if (result = callback(getSymbolOfNode(location).exports)) {
return result;
}
@@ -33754,7 +34090,7 @@
&& (!useOnlyExternalAliasing || ts.some(symbolFromSymbolTable.declarations, ts.isExternalModuleImportEqualsDeclaration))
// While exports are generally considered to be in scope, export-specifier declared symbols are _not_
// See similar comment in `resolveName` for details
- && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 257 /* ExportSpecifier */))) {
+ && (ignoreQualification || !ts.getDeclarationOfKind(symbolFromSymbolTable, 258 /* ExportSpecifier */))) {
var resolvedImportedSymbol = resolveAlias(symbolFromSymbolTable);
if (isAccessible(symbolFromSymbolTable, resolvedImportedSymbol, ignoreQualification)) {
return [symbolFromSymbolTable];
@@ -33790,7 +34126,7 @@
return true;
}
// Qualify if the symbol from symbol table has same meaning as expected
- symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 257 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable;
+ symbolFromSymbolTable = (symbolFromSymbolTable.flags & 2097152 /* Alias */ && !ts.getDeclarationOfKind(symbolFromSymbolTable, 258 /* ExportSpecifier */)) ? resolveAlias(symbolFromSymbolTable) : symbolFromSymbolTable;
if (symbolFromSymbolTable.flags & meaning) {
qualify = true;
return true;
@@ -33805,10 +34141,10 @@
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
switch (declaration.kind) {
- case 154 /* PropertyDeclaration */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 155 /* PropertyDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
continue;
default:
return false;
@@ -33864,7 +34200,7 @@
var containers = getContainersOfSymbol(symbol, enclosingDeclaration);
// If we're trying to reference some object literal in, eg `var a = { x: 1 }`, the symbol for the literal, `__object`, is distinct
// from the symbol of the declaration it is being assigned to. Since we can use the declaration to refer to the literal, however,
- // we'd like to make that connection here - potentially causing us to paint the declararation's visibiility, and therefore the literal.
+ // we'd like to make that connection here - potentially causing us to paint the declaration's visibility, and therefore the literal.
var firstDecl = ts.first(symbol.declarations);
if (!ts.length(containers) && meaning & 67220415 /* Value */ && firstDecl && ts.isObjectLiteralExpression(firstDecl)) {
if (firstDecl.parent && ts.isVariableDeclaration(firstDecl.parent) && firstDecl === firstDecl.parent.initializer) {
@@ -33925,10 +34261,10 @@
return node && getSymbolOfNode(node);
}
function hasExternalModuleSymbol(declaration) {
- return ts.isAmbientModule(declaration) || (declaration.kind === 284 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration));
+ return ts.isAmbientModule(declaration) || (declaration.kind === 285 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration));
}
function hasNonGlobalAugmentationExternalModuleSymbol(declaration) {
- return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 284 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration));
+ return ts.isModuleWithStringLiteralName(declaration) || (declaration.kind === 285 /* SourceFile */ && ts.isExternalOrCommonJsModule(declaration));
}
function hasVisibleDeclarations(symbol, shouldComputeAliasToMakeVisible) {
var aliasesToMakeVisible;
@@ -33975,14 +34311,14 @@
function isEntityNameVisible(entityName, enclosingDeclaration) {
// get symbol of the first identifier of the entityName
var meaning;
- if (entityName.parent.kind === 167 /* TypeQuery */ ||
+ if (entityName.parent.kind === 168 /* TypeQuery */ ||
ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent) ||
- entityName.parent.kind === 149 /* ComputedPropertyName */) {
+ entityName.parent.kind === 150 /* ComputedPropertyName */) {
// Typeof value
meaning = 67220415 /* Value */ | 1048576 /* ExportValue */;
}
- else if (entityName.kind === 148 /* QualifiedName */ || entityName.kind === 189 /* PropertyAccessExpression */ ||
- entityName.parent.kind === 248 /* ImportEqualsDeclaration */) {
+ else if (entityName.kind === 149 /* QualifiedName */ || entityName.kind === 190 /* PropertyAccessExpression */ ||
+ entityName.parent.kind === 249 /* ImportEqualsDeclaration */) {
// Left identifier from type reference or TypeAlias
// Entity name of the import declaration
meaning = 1920 /* Namespace */;
@@ -34031,10 +34367,10 @@
function signatureToStringWorker(writer) {
var sigOutput;
if (flags & 262144 /* WriteArrowStyleSignature */) {
- sigOutput = kind === 1 /* Construct */ ? 166 /* ConstructorType */ : 165 /* FunctionType */;
+ sigOutput = kind === 1 /* Construct */ ? 167 /* ConstructorType */ : 166 /* FunctionType */;
}
else {
- sigOutput = kind === 1 /* Construct */ ? 161 /* ConstructSignature */ : 160 /* CallSignature */;
+ sigOutput = kind === 1 /* Construct */ ? 162 /* ConstructSignature */ : 161 /* CallSignature */;
}
var sig = nodeBuilder.signatureToSignatureDeclaration(signature, sigOutput, enclosingDeclaration, toNodeBuilderFlags(flags) | 70221824 /* IgnoreErrors */ | 512 /* WriteTypeParametersInQualifiedName */);
var printer = ts.createPrinter({ removeComments: true, omitTrailingSemicolon: true });
@@ -34061,6 +34397,15 @@
}
return result;
}
+ function getTypeNamesForErrorDisplay(left, right) {
+ var leftStr = typeToString(left);
+ var rightStr = typeToString(right);
+ if (leftStr === rightStr) {
+ leftStr = typeToString(left, /*enclosingDeclaration*/ undefined, 64 /* UseFullyQualifiedType */);
+ rightStr = typeToString(right, /*enclosingDeclaration*/ undefined, 64 /* UseFullyQualifiedType */);
+ }
+ return [leftStr, rightStr];
+ }
function toNodeBuilderFlags(flags) {
if (flags === void 0) { flags = 0 /* None */; }
return flags & 9469291 /* NodeBuilderFlagsMask */;
@@ -34129,26 +34474,26 @@
}
if (type.flags & 1 /* Any */) {
context.approximateLength += 3;
- return ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ return ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
if (type.flags & 2 /* Unknown */) {
- return ts.createKeywordTypeNode(143 /* UnknownKeyword */);
+ return ts.createKeywordTypeNode(144 /* UnknownKeyword */);
}
if (type.flags & 4 /* String */) {
context.approximateLength += 6;
- return ts.createKeywordTypeNode(138 /* StringKeyword */);
+ return ts.createKeywordTypeNode(139 /* StringKeyword */);
}
if (type.flags & 8 /* Number */) {
context.approximateLength += 6;
- return ts.createKeywordTypeNode(135 /* NumberKeyword */);
+ return ts.createKeywordTypeNode(136 /* NumberKeyword */);
}
if (type.flags & 64 /* BigInt */) {
context.approximateLength += 6;
- return ts.createKeywordTypeNode(146 /* BigIntKeyword */);
+ return ts.createKeywordTypeNode(147 /* BigIntKeyword */);
}
if (type.flags & 16 /* Boolean */) {
context.approximateLength += 7;
- return ts.createKeywordTypeNode(123 /* BooleanKeyword */);
+ return ts.createKeywordTypeNode(124 /* BooleanKeyword */);
}
if (type.flags & 1024 /* EnumLiteral */ && !(type.flags & 1048576 /* Union */)) {
var parentSymbol = getParentOfSymbol(type.symbol);
@@ -34166,8 +34511,9 @@
return ts.createLiteralTypeNode(ts.setEmitFlags(ts.createLiteral(type.value), 16777216 /* NoAsciiEscaping */));
}
if (type.flags & 256 /* NumberLiteral */) {
- context.approximateLength += (("" + type.value).length);
- return ts.createLiteralTypeNode((ts.createLiteral(type.value)));
+ var value = type.value;
+ context.approximateLength += ("" + value).length;
+ return ts.createLiteralTypeNode(value < 0 ? ts.createPrefix(39 /* MinusToken */, ts.createLiteral(-value)) : ts.createLiteral(value));
}
if (type.flags & 2048 /* BigIntLiteral */) {
context.approximateLength += (ts.pseudoBigIntToString(type.value).length) + 1;
@@ -34188,33 +34534,33 @@
}
}
context.approximateLength += 13;
- return ts.createTypeOperatorNode(142 /* UniqueKeyword */, ts.createKeywordTypeNode(139 /* SymbolKeyword */));
+ return ts.createTypeOperatorNode(143 /* UniqueKeyword */, ts.createKeywordTypeNode(140 /* SymbolKeyword */));
}
if (type.flags & 16384 /* Void */) {
context.approximateLength += 4;
- return ts.createKeywordTypeNode(106 /* VoidKeyword */);
+ return ts.createKeywordTypeNode(107 /* VoidKeyword */);
}
if (type.flags & 32768 /* Undefined */) {
context.approximateLength += 9;
- return ts.createKeywordTypeNode(141 /* UndefinedKeyword */);
+ return ts.createKeywordTypeNode(142 /* UndefinedKeyword */);
}
if (type.flags & 65536 /* Null */) {
context.approximateLength += 4;
- return ts.createKeywordTypeNode(96 /* NullKeyword */);
+ return ts.createKeywordTypeNode(97 /* NullKeyword */);
}
if (type.flags & 131072 /* Never */) {
context.approximateLength += 5;
- return ts.createKeywordTypeNode(132 /* NeverKeyword */);
+ return ts.createKeywordTypeNode(133 /* NeverKeyword */);
}
if (type.flags & 4096 /* ESSymbol */) {
context.approximateLength += 6;
- return ts.createKeywordTypeNode(139 /* SymbolKeyword */);
+ return ts.createKeywordTypeNode(140 /* SymbolKeyword */);
}
if (type.flags & 67108864 /* NonPrimitive */) {
context.approximateLength += 6;
- return ts.createKeywordTypeNode(136 /* ObjectKeyword */);
+ return ts.createKeywordTypeNode(137 /* ObjectKeyword */);
}
- if (type.flags & 262144 /* TypeParameter */ && type.isThisType) {
+ if (isThisTypeParameter(type)) {
if (context.flags & 4194304 /* InObjectTypeLiteral */) {
if (!context.encounteredError && !(context.flags & 32768 /* AllowThisInObjectLiteral */)) {
context.encounteredError = true;
@@ -34264,7 +34610,7 @@
}
var typeNodes = mapToTypeNodes(types, context, /*isBareList*/ true);
if (typeNodes && typeNodes.length > 0) {
- var unionOrIntersectionTypeNode = ts.createUnionOrIntersectionTypeNode(type.flags & 1048576 /* Union */ ? 173 /* UnionType */ : 174 /* IntersectionType */, typeNodes);
+ var unionOrIntersectionTypeNode = ts.createUnionOrIntersectionTypeNode(type.flags & 1048576 /* Union */ ? 174 /* UnionType */ : 175 /* IntersectionType */, typeNodes);
return unionOrIntersectionTypeNode;
}
else {
@@ -34297,8 +34643,8 @@
context.inferTypeParameters = type.root.inferTypeParameters;
var extendsTypeNode = typeToTypeNodeHelper(type.extendsType, context);
context.inferTypeParameters = saveInferTypeParameters;
- var trueTypeNode = typeToTypeNodeHelper(type.trueType, context);
- var falseTypeNode = typeToTypeNodeHelper(type.falseType, context);
+ var trueTypeNode = typeToTypeNodeHelper(getTrueTypeFromConditionalType(type), context);
+ var falseTypeNode = typeToTypeNodeHelper(getFalseTypeFromConditionalType(type), context);
context.approximateLength += 15;
return ts.createConditionalTypeNode(checkTypeNode, extendsTypeNode, trueTypeNode, falseTypeNode);
}
@@ -34338,7 +34684,7 @@
return symbolToTypeNode(symbol, context, isInstanceType);
}
// Always use 'typeof T' for type of class, enum, and module objects
- else if (symbol.flags & 32 /* Class */ && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration.kind === 209 /* ClassExpression */ && context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */) ||
+ else if (symbol.flags & 32 /* Class */ && !getBaseTypeVariableOfClass(symbol) && !(symbol.valueDeclaration.kind === 210 /* ClassExpression */ && context.flags & 2048 /* WriteClassExpressionAsTypeLiteral */) ||
symbol.flags & (384 /* Enum */ | 512 /* ValueModule */) ||
shouldWriteTypeOfFunctionSymbol()) {
return symbolToTypeNode(symbol, context, 67220415 /* Value */);
@@ -34385,7 +34731,7 @@
var isNonLocalFunctionSymbol = !!(symbol.flags & 16 /* Function */) &&
(symbol.parent || // is exported function symbol
ts.forEach(symbol.declarations, function (declaration) {
- return declaration.parent.kind === 284 /* SourceFile */ || declaration.parent.kind === 245 /* ModuleBlock */;
+ return declaration.parent.kind === 285 /* SourceFile */ || declaration.parent.kind === 246 /* ModuleBlock */;
}));
if (isStaticMethodSymbol || isNonLocalFunctionSymbol) {
// typeof is allowed only for static/non local functions
@@ -34406,12 +34752,12 @@
}
if (resolved.callSignatures.length === 1 && !resolved.constructSignatures.length) {
var signature = resolved.callSignatures[0];
- var signatureNode = signatureToSignatureDeclarationHelper(signature, 165 /* FunctionType */, context);
+ var signatureNode = signatureToSignatureDeclarationHelper(signature, 166 /* FunctionType */, context);
return signatureNode;
}
if (resolved.constructSignatures.length === 1 && !resolved.callSignatures.length) {
var signature = resolved.constructSignatures[0];
- var signatureNode = signatureToSignatureDeclarationHelper(signature, 166 /* ConstructorType */, context);
+ var signatureNode = signatureToSignatureDeclarationHelper(signature, 167 /* ConstructorType */, context);
return signatureNode;
}
}
@@ -34432,7 +34778,7 @@
}
var elementType = typeToTypeNodeHelper(typeArguments[0], context);
var arrayType = ts.createArrayTypeNode(elementType);
- return type.target === globalArrayType ? arrayType : ts.createTypeOperatorNode(133 /* ReadonlyKeyword */, arrayType);
+ return type.target === globalArrayType ? arrayType : ts.createTypeOperatorNode(134 /* ReadonlyKeyword */, arrayType);
}
else if (type.target.objectFlags & 8 /* Tuple */) {
if (typeArguments.length > 0) {
@@ -34446,12 +34792,12 @@
ts.createOptionalTypeNode(tupleConstituentNodes[i]);
}
var tupleTypeNode = ts.createTupleTypeNode(tupleConstituentNodes);
- return type.target.readonly ? ts.createTypeOperatorNode(133 /* ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode;
+ return type.target.readonly ? ts.createTypeOperatorNode(134 /* ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode;
}
}
if (context.encounteredError || (context.flags & 524288 /* AllowEmptyTuple */)) {
var tupleTypeNode = ts.createTupleTypeNode([]);
- return type.target.readonly ? ts.createTypeOperatorNode(133 /* ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode;
+ return type.target.readonly ? ts.createTypeOperatorNode(134 /* ReadonlyKeyword */, tupleTypeNode) : tupleTypeNode;
}
context.encounteredError = true;
return undefined; // TODO: GH#18217
@@ -34546,11 +34892,11 @@
var typeElements = [];
for (var _i = 0, _a = resolvedType.callSignatures; _i < _a.length; _i++) {
var signature = _a[_i];
- typeElements.push(signatureToSignatureDeclarationHelper(signature, 160 /* CallSignature */, context));
+ typeElements.push(signatureToSignatureDeclarationHelper(signature, 161 /* CallSignature */, context));
}
for (var _b = 0, _c = resolvedType.constructSignatures; _b < _c.length; _b++) {
var signature = _c[_b];
- typeElements.push(signatureToSignatureDeclarationHelper(signature, 161 /* ConstructSignature */, context));
+ typeElements.push(signatureToSignatureDeclarationHelper(signature, 162 /* ConstructSignature */, context));
}
if (resolvedType.stringIndexInfo) {
var indexSignature = void 0;
@@ -34597,15 +34943,15 @@
if (!(context.flags & 1 /* NoTruncation */)) {
return ts.createTypeReferenceNode(ts.createIdentifier("..."), /*typeArguments*/ undefined);
}
- return ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ return ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
function addPropertyToElementList(propertySymbol, context, typeElements) {
- var propertyIsReverseMapped = !!(ts.getCheckFlags(propertySymbol) & 4096 /* ReverseMapped */);
+ var propertyIsReverseMapped = !!(ts.getCheckFlags(propertySymbol) & 8192 /* ReverseMapped */);
var propertyType = propertyIsReverseMapped && context.flags & 33554432 /* InReverseMappedType */ ?
anyType : getTypeOfSymbol(propertySymbol);
var saveEnclosingDeclaration = context.enclosingDeclaration;
context.enclosingDeclaration = undefined;
- if (context.tracker.trackSymbol && ts.getCheckFlags(propertySymbol) & 2048 /* Late */) {
+ if (context.tracker.trackSymbol && ts.getCheckFlags(propertySymbol) & 4096 /* Late */) {
var decl = ts.first(propertySymbol.declarations);
if (hasLateBindableName(decl)) {
trackComputedName(decl.name, saveEnclosingDeclaration, context);
@@ -34619,7 +34965,7 @@
var signatures = getSignaturesOfType(propertyType, 0 /* Call */);
for (var _i = 0, signatures_1 = signatures; _i < signatures_1.length; _i++) {
var signature = signatures_1[_i];
- var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 155 /* MethodSignature */, context);
+ var methodDeclaration = signatureToSignatureDeclarationHelper(signature, 156 /* MethodSignature */, context);
methodDeclaration.name = propertyName;
methodDeclaration.questionToken = optionalToken;
if (propertySymbol.valueDeclaration) {
@@ -34637,10 +34983,10 @@
propertyTypeNode = createElidedInformationPlaceholder(context);
}
else {
- propertyTypeNode = propertyType ? typeToTypeNodeHelper(propertyType, context) : ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ propertyTypeNode = propertyType ? typeToTypeNodeHelper(propertyType, context) : ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
context.flags = savedFlags;
- var modifiers = isReadonlySymbol(propertySymbol) ? [ts.createToken(133 /* ReadonlyKeyword */)] : undefined;
+ var modifiers = isReadonlySymbol(propertySymbol) ? [ts.createToken(134 /* ReadonlyKeyword */)] : undefined;
if (modifiers) {
context.approximateLength += 9;
}
@@ -34691,7 +35037,7 @@
}
function indexInfoToIndexSignatureDeclarationHelper(indexInfo, kind, context) {
var name = ts.getNameFromIndexInfo(indexInfo) || "x";
- var indexerTypeNode = ts.createKeywordTypeNode(kind === 0 /* String */ ? 138 /* StringKeyword */ : 135 /* NumberKeyword */);
+ var indexerTypeNode = ts.createKeywordTypeNode(kind === 0 /* String */ ? 139 /* StringKeyword */ : 136 /* NumberKeyword */);
var indexingParameter = ts.createParameter(
/*decorators*/ undefined,
/*modifiers*/ undefined,
@@ -34704,7 +35050,7 @@
}
context.approximateLength += (name.length + 4);
return ts.createIndexSignature(
- /*decorators*/ undefined, indexInfo.isReadonly ? [ts.createToken(133 /* ReadonlyKeyword */)] : undefined, [indexingParameter], typeNode);
+ /*decorators*/ undefined, indexInfo.isReadonly ? [ts.createToken(134 /* ReadonlyKeyword */)] : undefined, [indexingParameter], typeNode);
}
function signatureToSignatureDeclarationHelper(signature, kind, context) {
var typeParameters;
@@ -34715,7 +35061,7 @@
else {
typeParameters = signature.typeParameters && signature.typeParameters.map(function (parameter) { return typeParameterToDeclaration(parameter, context); });
}
- var parameters = getExpandedParameters(signature).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 157 /* Constructor */); });
+ var parameters = getExpandedParameters(signature).map(function (parameter) { return symbolToParameterDeclaration(parameter, context, kind === 158 /* Constructor */); });
if (signature.thisParameter) {
var thisParameter = symbolToParameterDeclaration(signature.thisParameter, context);
parameters.unshift(thisParameter);
@@ -34734,12 +35080,12 @@
returnTypeNode = returnType && typeToTypeNodeHelper(returnType, context);
}
if (context.flags & 256 /* SuppressAnyReturnType */) {
- if (returnTypeNode && returnTypeNode.kind === 120 /* AnyKeyword */) {
+ if (returnTypeNode && returnTypeNode.kind === 121 /* AnyKeyword */) {
returnTypeNode = undefined;
}
}
else if (!returnTypeNode) {
- returnTypeNode = ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ returnTypeNode = ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
context.approximateLength += 3; // Usually a signature contributes a few more characters than this, but 3 is the minimum
return ts.createSignatureDeclaration(kind, typeParameters, parameters, returnTypeNode, typeArguments);
@@ -34768,9 +35114,9 @@
return typeParameterToDeclarationWithConstraint(type, context, constraintNode);
}
function symbolToParameterDeclaration(parameterSymbol, context, preserveModifierFlags) {
- var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 151 /* Parameter */);
+ var parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 152 /* Parameter */);
if (!parameterDeclaration && !isTransientSymbol(parameterSymbol)) {
- parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 304 /* JSDocParameterTag */);
+ parameterDeclaration = ts.getDeclarationOfKind(parameterSymbol, 305 /* JSDocParameterTag */);
}
var parameterType = getTypeOfSymbol(parameterSymbol);
if (parameterDeclaration && isRequiredInitializedParameter(parameterDeclaration)) {
@@ -34778,16 +35124,16 @@
}
var parameterTypeNode = typeToTypeNodeHelper(parameterType, context);
var modifiers = !(context.flags & 8192 /* OmitParameterModifiers */) && preserveModifierFlags && parameterDeclaration && parameterDeclaration.modifiers ? parameterDeclaration.modifiers.map(ts.getSynthesizedClone) : undefined;
- var isRest = parameterDeclaration && ts.isRestParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 16384 /* RestParameter */;
+ var isRest = parameterDeclaration && ts.isRestParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 32768 /* RestParameter */;
var dotDotDotToken = isRest ? ts.createToken(25 /* DotDotDotToken */) : undefined;
var name = parameterDeclaration
? parameterDeclaration.name ?
- parameterDeclaration.name.kind === 72 /* Identifier */ ? ts.setEmitFlags(ts.getSynthesizedClone(parameterDeclaration.name), 16777216 /* NoAsciiEscaping */) :
- parameterDeclaration.name.kind === 148 /* QualifiedName */ ? ts.setEmitFlags(ts.getSynthesizedClone(parameterDeclaration.name.right), 16777216 /* NoAsciiEscaping */) :
+ parameterDeclaration.name.kind === 73 /* Identifier */ ? ts.setEmitFlags(ts.getSynthesizedClone(parameterDeclaration.name), 16777216 /* NoAsciiEscaping */) :
+ parameterDeclaration.name.kind === 149 /* QualifiedName */ ? ts.setEmitFlags(ts.getSynthesizedClone(parameterDeclaration.name.right), 16777216 /* NoAsciiEscaping */) :
cloneBindingName(parameterDeclaration.name) :
ts.symbolName(parameterSymbol)
: ts.symbolName(parameterSymbol);
- var isOptional = parameterDeclaration && isOptionalParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 8192 /* OptionalParameter */;
+ var isOptional = parameterDeclaration && isOptionalParameter(parameterDeclaration) || ts.getCheckFlags(parameterSymbol) & 16384 /* OptionalParameter */;
var questionToken = isOptional ? ts.createToken(56 /* QuestionToken */) : undefined;
var parameterNode = ts.createParameter(
/*decorators*/ undefined, modifiers, dotDotDotToken, name, questionToken, parameterTypeNode,
@@ -34802,7 +35148,7 @@
}
var visited = ts.visitEachChild(node, elideInitializerAndSetEmitFlags, ts.nullTransformationContext, /*nodesVisitor*/ undefined, elideInitializerAndSetEmitFlags);
var clone = ts.nodeIsSynthesized(visited) ? visited : ts.getSynthesizedClone(visited);
- if (clone.kind === 186 /* BindingElement */) {
+ if (clone.kind === 187 /* BindingElement */) {
clone.initializer = undefined;
}
return ts.setEmitFlags(clone, 1 /* SingleLine */ | 16777216 /* NoAsciiEscaping */);
@@ -34904,6 +35250,11 @@
function lookupTypeParameterNodes(chain, index, context) {
ts.Debug.assert(chain && 0 <= index && index < chain.length);
var symbol = chain[index];
+ var symbolId = "" + getSymbolId(symbol);
+ if (context.typeParameterSymbolList && context.typeParameterSymbolList.get(symbolId)) {
+ return undefined;
+ }
+ (context.typeParameterSymbolList || (context.typeParameterSymbolList = ts.createMap())).set(symbolId, true);
var typeParameterNodes;
if (context.flags & 512 /* WriteTypeParametersInQualifiedName */ && index < (chain.length - 1)) {
var parentSymbol = symbol;
@@ -34928,7 +35279,7 @@
return top;
}
function getSpecifierForModuleSymbol(symbol, context) {
- var file = ts.getDeclarationOfKind(symbol, 284 /* SourceFile */);
+ var file = ts.getDeclarationOfKind(symbol, 285 /* SourceFile */);
if (file && file.moduleName !== undefined) {
// Use the amd name if it is available
return file.moduleName;
@@ -35168,8 +35519,8 @@
}
function getTypeAliasForTypeLiteral(type) {
if (type.symbol && type.symbol.flags & 2048 /* TypeLiteral */) {
- var node = ts.findAncestor(type.symbol.declarations[0].parent, function (n) { return n.kind !== 177 /* ParenthesizedType */; });
- if (node.kind === 242 /* TypeAliasDeclaration */) {
+ var node = ts.findAncestor(type.symbol.declarations[0].parent, function (n) { return n.kind !== 178 /* ParenthesizedType */; });
+ if (node.kind === 243 /* TypeAliasDeclaration */) {
return getSymbolOfNode(node);
}
}
@@ -35177,11 +35528,11 @@
}
function isTopLevelInExternalModuleAugmentation(node) {
return node && node.parent &&
- node.parent.kind === 245 /* ModuleBlock */ &&
+ node.parent.kind === 246 /* ModuleBlock */ &&
ts.isExternalModuleAugmentation(node.parent.parent);
}
function isDefaultBindingContext(location) {
- return location.kind === 284 /* SourceFile */ || ts.isAmbientModule(location);
+ return location.kind === 285 /* SourceFile */ || ts.isAmbientModule(location);
}
function getNameOfSymbolFromNameType(symbol, context) {
var nameType = symbol.nameType;
@@ -35222,7 +35573,7 @@
if (ts.isCallExpression(declaration) && ts.isBindableObjectDefinePropertyCall(declaration)) {
return ts.symbolName(symbol);
}
- if (ts.isComputedPropertyName(name_2) && !(ts.getCheckFlags(symbol) & 2048 /* Late */) && symbol.nameType && symbol.nameType.flags & 384 /* StringOrNumberLiteral */) {
+ if (ts.isComputedPropertyName(name_2) && !(ts.getCheckFlags(symbol) & 4096 /* Late */) && symbol.nameType && symbol.nameType.flags & 384 /* StringOrNumberLiteral */) {
// Computed property name isn't late bound, but has a well-known name type - use name type to generate a symbol name
var result = getNameOfSymbolFromNameType(symbol, context);
if (result !== undefined) {
@@ -35231,17 +35582,17 @@
}
return ts.declarationNameToString(name_2);
}
- if (declaration.parent && declaration.parent.kind === 237 /* VariableDeclaration */) {
+ if (declaration.parent && declaration.parent.kind === 238 /* VariableDeclaration */) {
return ts.declarationNameToString(declaration.parent.name);
}
switch (declaration.kind) {
- case 209 /* ClassExpression */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 210 /* ClassExpression */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
if (context && !context.encounteredError && !(context.flags & 131072 /* AllowAnonymousIdentifier */)) {
context.encounteredError = true;
}
- return declaration.kind === 209 /* ClassExpression */ ? "(Anonymous class)" : "(Anonymous function)";
+ return declaration.kind === 210 /* ClassExpression */ ? "(Anonymous class)" : "(Anonymous function)";
}
}
var name = getNameOfSymbolFromNameType(symbol, context);
@@ -35258,27 +35609,27 @@
return false;
function determineIfDeclarationIsVisible() {
switch (node.kind) {
- case 302 /* JSDocCallbackTag */:
- case 309 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
// Top-level jsdoc type aliases are considered exported
// First parent is comment node, second is hosting declaration or token; we only care about those tokens or declarations whose parent is a source file
return !!(node.parent && node.parent.parent && node.parent.parent.parent && ts.isSourceFile(node.parent.parent.parent));
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return isDeclarationVisible(node.parent.parent);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
if (ts.isBindingPattern(node.name) &&
!node.name.elements.length) {
// If the binding pattern is empty, this variable declaration is not visible
return false;
}
// falls through
- case 244 /* ModuleDeclaration */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 239 /* FunctionDeclaration */:
- case 243 /* EnumDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
// external module augmentation is always visible
if (ts.isExternalModuleAugmentation(node)) {
return true;
@@ -35286,53 +35637,53 @@
var parent = getDeclarationContainer(node);
// If the node is not exported or it is not ambient module element (except import declaration)
if (!(ts.getCombinedModifierFlags(node) & 1 /* Export */) &&
- !(node.kind !== 248 /* ImportEqualsDeclaration */ && parent.kind !== 284 /* SourceFile */ && parent.flags & 4194304 /* Ambient */)) {
+ !(node.kind !== 249 /* ImportEqualsDeclaration */ && parent.kind !== 285 /* SourceFile */ && parent.flags & 4194304 /* Ambient */)) {
return isGlobalSourceFile(parent);
}
// Exported members/ambient module elements (exception import declaration) are visible if parent is visible
return isDeclarationVisible(parent);
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
if (ts.hasModifier(node, 8 /* Private */ | 16 /* Protected */)) {
// Private/protected properties/methods are not visible
return false;
}
// Public properties/methods are visible if its parents are visible, so:
// falls through
- case 157 /* Constructor */:
- case 161 /* ConstructSignature */:
- case 160 /* CallSignature */:
- case 162 /* IndexSignature */:
- case 151 /* Parameter */:
- case 245 /* ModuleBlock */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 168 /* TypeLiteral */:
- case 164 /* TypeReference */:
- case 169 /* ArrayType */:
- case 170 /* TupleType */:
- case 173 /* UnionType */:
- case 174 /* IntersectionType */:
- case 177 /* ParenthesizedType */:
+ case 158 /* Constructor */:
+ case 162 /* ConstructSignature */:
+ case 161 /* CallSignature */:
+ case 163 /* IndexSignature */:
+ case 152 /* Parameter */:
+ case 246 /* ModuleBlock */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 169 /* TypeLiteral */:
+ case 165 /* TypeReference */:
+ case 170 /* ArrayType */:
+ case 171 /* TupleType */:
+ case 174 /* UnionType */:
+ case 175 /* IntersectionType */:
+ case 178 /* ParenthesizedType */:
return isDeclarationVisible(node.parent);
// Default binding, import specifier and namespace import is visible
// only on demand so by default it is not visible
- case 250 /* ImportClause */:
- case 251 /* NamespaceImport */:
- case 253 /* ImportSpecifier */:
+ case 251 /* ImportClause */:
+ case 252 /* NamespaceImport */:
+ case 254 /* ImportSpecifier */:
return false;
// Type parameters are always visible
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
// Source file and namespace export are always visible
- case 284 /* SourceFile */:
- case 247 /* NamespaceExportDeclaration */:
+ case 285 /* SourceFile */:
+ case 248 /* NamespaceExportDeclaration */:
return true;
// Export assignments do not create name bindings outside the module
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return false;
default:
return false;
@@ -35341,10 +35692,10 @@
}
function collectLinkedAliases(node, setVisibility) {
var exportSymbol;
- if (node.parent && node.parent.kind === 254 /* ExportAssignment */) {
+ if (node.parent && node.parent.kind === 255 /* ExportAssignment */) {
exportSymbol = resolveName(node, node.escapedText, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */, /*nameNotFoundMessage*/ undefined, node, /*isUse*/ false);
}
- else if (node.parent.kind === 257 /* ExportSpecifier */) {
+ else if (node.parent.kind === 258 /* ExportSpecifier */) {
exportSymbol = getTargetOfExportSpecifier(node.parent, 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */);
}
var result;
@@ -35440,12 +35791,12 @@
function getDeclarationContainer(node) {
return ts.findAncestor(ts.getRootDeclaration(node), function (node) {
switch (node.kind) {
- case 237 /* VariableDeclaration */:
- case 238 /* VariableDeclarationList */:
- case 253 /* ImportSpecifier */:
- case 252 /* NamedImports */:
- case 251 /* NamespaceImport */:
- case 250 /* ImportClause */:
+ case 238 /* VariableDeclaration */:
+ case 239 /* VariableDeclarationList */:
+ case 254 /* ImportSpecifier */:
+ case 253 /* NamedImports */:
+ case 252 /* NamespaceImport */:
+ case 251 /* ImportClause */:
return false;
default:
return true;
@@ -35478,7 +35829,7 @@
return symbol && getSymbolLinks(symbol).type || getTypeForVariableLikeDeclaration(node, /*includeOptionality*/ false);
}
function isComputedNonLiteralName(name) {
- return name.kind === 149 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteralLike(name.expression);
+ return name.kind === 150 /* ComputedPropertyName */ && !ts.isStringOrNumericLiteralLike(name.expression);
}
function getRestType(source, properties, symbol) {
source = filterType(source, function (t) { return !(t.flags & 98304 /* Nullable */); });
@@ -35493,13 +35844,11 @@
if (omitKeyType.flags & 131072 /* Never */) {
return source;
}
- var pickTypeAlias = getGlobalPickSymbol();
- var excludeTypeAlias = getGlobalExcludeSymbol();
- if (!pickTypeAlias || !excludeTypeAlias) {
+ var omitTypeAlias = getGlobalOmitSymbol();
+ if (!omitTypeAlias) {
return errorType;
}
- var pickKeys = getTypeAliasInstantiation(excludeTypeAlias, [getIndexType(source), omitKeyType]);
- return getTypeAliasInstantiation(pickTypeAlias, [source, pickKeys]);
+ return getTypeAliasInstantiation(omitTypeAlias, [source, omitKeyType]);
}
var members = ts.createSymbolTable();
for (var _i = 0, _a = getPropertiesOfType(source); _i < _a.length; _i++) {
@@ -35532,7 +35881,7 @@
if (parentAccess && parentAccess.flowNode) {
var propName = getDestructuringPropertyName(node);
if (propName) {
- var result = ts.createNode(190 /* ElementAccessExpression */, node.pos, node.end);
+ var result = ts.createNode(191 /* ElementAccessExpression */, node.pos, node.end);
result.parent = node;
result.expression = parentAccess;
var literal = ts.createNode(10 /* StringLiteral */, node.pos, node.end);
@@ -35547,23 +35896,23 @@
function getParentElementAccess(node) {
var ancestor = node.parent.parent;
switch (ancestor.kind) {
- case 186 /* BindingElement */:
- case 275 /* PropertyAssignment */:
+ case 187 /* BindingElement */:
+ case 276 /* PropertyAssignment */:
return getSyntheticElementAccess(ancestor);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return getSyntheticElementAccess(node.parent);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return ancestor.initializer;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return ancestor.right;
}
}
function getDestructuringPropertyName(node) {
var parent = node.parent;
- if (node.kind === 186 /* BindingElement */ && parent.kind === 184 /* ObjectBindingPattern */) {
+ if (node.kind === 187 /* BindingElement */ && parent.kind === 185 /* ObjectBindingPattern */) {
return getLiteralPropertyNameText(node.propertyName || node.name);
}
- if (node.kind === 275 /* PropertyAssignment */ || node.kind === 276 /* ShorthandPropertyAssignment */) {
+ if (node.kind === 276 /* PropertyAssignment */ || node.kind === 277 /* ShorthandPropertyAssignment */) {
return getLiteralPropertyNameText(node.name);
}
return "" + parent.elements.indexOf(node);
@@ -35585,7 +35934,7 @@
parentType = getNonNullableType(parentType);
}
var type;
- if (pattern.kind === 184 /* ObjectBindingPattern */) {
+ if (pattern.kind === 185 /* ObjectBindingPattern */) {
if (declaration.dotDotDotToken) {
if (parentType.flags & 2 /* Unknown */ || !isValidSpreadType(parentType)) {
error(declaration, ts.Diagnostics.Rest_types_may_only_be_created_from_object_types);
@@ -35649,30 +35998,30 @@
}
function isNullOrUndefined(node) {
var expr = ts.skipParentheses(node);
- return expr.kind === 96 /* NullKeyword */ || expr.kind === 72 /* Identifier */ && getResolvedSymbol(expr) === undefinedSymbol;
+ return expr.kind === 97 /* NullKeyword */ || expr.kind === 73 /* Identifier */ && getResolvedSymbol(expr) === undefinedSymbol;
}
function isEmptyArrayLiteral(node) {
var expr = ts.skipParentheses(node);
- return expr.kind === 187 /* ArrayLiteralExpression */ && expr.elements.length === 0;
+ return expr.kind === 188 /* ArrayLiteralExpression */ && expr.elements.length === 0;
}
function addOptionality(type, optional) {
if (optional === void 0) { optional = true; }
return strictNullChecks && optional ? getOptionalType(type) : type;
}
function isParameterOfContextuallyTypedFunction(node) {
- return node.kind === 151 /* Parameter */ &&
- (node.parent.kind === 196 /* FunctionExpression */ || node.parent.kind === 197 /* ArrowFunction */) &&
+ return node.kind === 152 /* Parameter */ &&
+ (node.parent.kind === 197 /* FunctionExpression */ || node.parent.kind === 198 /* ArrowFunction */) &&
!!getContextualType(node.parent);
}
// Return the inferred type for a variable, parameter, or property declaration
function getTypeForVariableLikeDeclaration(declaration, includeOptionality) {
// A variable declared in a for..in statement is of type string, or of type keyof T when the
// right hand expression is of a type parameter type.
- if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 226 /* ForInStatement */) {
+ if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 227 /* ForInStatement */) {
var indexType = getIndexType(getNonNullableTypeIfNeeded(checkExpression(declaration.parent.parent.expression)));
return indexType.flags & (262144 /* TypeParameter */ | 4194304 /* Index */) ? getExtractStringType(indexType) : stringType;
}
- if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 227 /* ForOfStatement */) {
+ if (ts.isVariableDeclaration(declaration) && declaration.parent.parent.kind === 228 /* ForOfStatement */) {
// checkRightHandSideOfForOf will return undefined if the for-of expression type was
// missing properties/signatures required to get its iteratedType (like
// [Symbol.iterator] or next). This may be because we accessed properties from anyType,
@@ -35691,7 +36040,7 @@
return addOptionality(declaredType, isOptional);
}
if ((noImplicitAny || ts.isInJSFile(declaration)) &&
- declaration.kind === 237 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) &&
+ declaration.kind === 238 /* VariableDeclaration */ && !ts.isBindingPattern(declaration.name) &&
!(ts.getCombinedModifierFlags(declaration) & 1 /* Export */) && !(declaration.flags & 4194304 /* Ambient */)) {
// If --noImplicitAny is on or the declaration is in a Javascript file,
// use control flow tracked 'any' type for non-ambient, non-exported var or let variables with no
@@ -35705,11 +36054,11 @@
return autoArrayType;
}
}
- if (declaration.kind === 151 /* Parameter */) {
+ if (declaration.kind === 152 /* Parameter */) {
var func = declaration.parent;
// For a parameter of a set accessor, use the type of the get accessor if one is present
- if (func.kind === 159 /* SetAccessor */ && !hasNonBindableDynamicName(func)) {
- var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 158 /* GetAccessor */);
+ if (func.kind === 160 /* SetAccessor */ && !hasNonBindableDynamicName(func)) {
+ var getter = ts.getDeclarationOfKind(getSymbolOfNode(declaration.parent), 159 /* GetAccessor */);
if (getter) {
var getterSignature = getSignatureFromDeclaration(getter);
var thisParameter = getAccessorThisParameter(func);
@@ -35846,7 +36195,7 @@
return type;
}
else if (declaredType !== errorType && type !== errorType && !isTypeIdenticalTo(declaredType, type)) {
- errorNextVariableOrPropertyDeclarationMustHaveSameType(declaredType, declaration, type);
+ errorNextVariableOrPropertyDeclarationMustHaveSameType(/*firstDeclaration*/ undefined, declaredType, declaration, type);
}
}
return declaredType;
@@ -35913,9 +36262,9 @@
var thisContainer = ts.getThisContainer(expression, /*includeArrowFunctions*/ false);
// Properties defined in a constructor (or base constructor, or javascript constructor function) don't get undefined added.
// Function expressions that are assigned to the prototype count as methods.
- return thisContainer.kind === 157 /* Constructor */ ||
- thisContainer.kind === 239 /* FunctionDeclaration */ ||
- (thisContainer.kind === 196 /* FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent));
+ return thisContainer.kind === 158 /* Constructor */ ||
+ thisContainer.kind === 240 /* FunctionDeclaration */ ||
+ (thisContainer.kind === 197 /* FunctionExpression */ && !ts.isPrototypePropertyAssignment(thisContainer.parent));
}
function getConstructorDefinedThisAssignmentTypes(types, declarations) {
ts.Debug.assert(types.length === declarations.length);
@@ -35990,7 +36339,7 @@
function getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors) {
var elements = pattern.elements;
var lastElement = ts.lastOrUndefined(elements);
- var hasRestElement = !!(lastElement && lastElement.kind === 186 /* BindingElement */ && lastElement.dotDotDotToken);
+ var hasRestElement = !!(lastElement && lastElement.kind === 187 /* BindingElement */ && lastElement.dotDotDotToken);
if (elements.length === 0 || elements.length === 1 && hasRestElement) {
return languageVersion >= 2 /* ES2015 */ ? createIterableType(anyType) : anyArrayType;
}
@@ -36013,7 +36362,7 @@
function getTypeFromBindingPattern(pattern, includePatternInType, reportErrors) {
if (includePatternInType === void 0) { includePatternInType = false; }
if (reportErrors === void 0) { reportErrors = false; }
- return pattern.kind === 184 /* ObjectBindingPattern */
+ return pattern.kind === 185 /* ObjectBindingPattern */
? getTypeFromObjectBindingPattern(pattern, includePatternInType, reportErrors)
: getTypeFromArrayBindingPattern(pattern, includePatternInType, reportErrors);
}
@@ -36052,7 +36401,7 @@
}
function declarationBelongsToPrivateAmbientMember(declaration) {
var root = ts.getRootDeclaration(declaration);
- var memberDeclaration = root.kind === 151 /* Parameter */ ? root.parent : root;
+ var memberDeclaration = root.kind === 152 /* Parameter */ ? root.parent : root;
return isPrivateWithinAmbient(memberDeclaration);
}
function tryGetTypeFromEffectiveTypeNode(declaration) {
@@ -36114,7 +36463,7 @@
return reportCircularityError(symbol);
}
var type;
- if (declaration.kind === 254 /* ExportAssignment */) {
+ if (declaration.kind === 255 /* ExportAssignment */) {
type = widenTypeForVariableLikeDeclaration(checkExpressionCached(declaration.expression), declaration);
}
else if (ts.isInJSFile(declaration) &&
@@ -36165,7 +36514,7 @@
type = getTypeOfEnumMember(symbol);
}
else {
- return ts.Debug.fail("Unhandled declaration kind! " + ts.Debug.showSyntaxKind(declaration) + " for " + ts.Debug.showSymbol(symbol));
+ return ts.Debug.fail("Unhandled declaration kind! " + ts.Debug.formatSyntaxKind(declaration.kind) + " for " + ts.Debug.formatSymbol(symbol));
}
if (!popTypeResolution()) {
// Symbol is property of some kind that is merged with something - should use `getTypeOfFuncClassEnumModule` and not `getTypeOfVariableOrParameterOrProperty`
@@ -36178,7 +36527,7 @@
}
function getAnnotatedAccessorTypeNode(accessor) {
if (accessor) {
- if (accessor.kind === 158 /* GetAccessor */) {
+ if (accessor.kind === 159 /* GetAccessor */) {
var getterTypeAnnotation = ts.getEffectiveReturnTypeNode(accessor);
return getterTypeAnnotation;
}
@@ -36205,8 +36554,8 @@
return links.type || (links.type = getTypeOfAccessorsWorker(symbol));
}
function getTypeOfAccessorsWorker(symbol) {
- var getter = ts.getDeclarationOfKind(symbol, 158 /* GetAccessor */);
- var setter = ts.getDeclarationOfKind(symbol, 159 /* SetAccessor */);
+ var getter = ts.getDeclarationOfKind(symbol, 159 /* GetAccessor */);
+ var setter = ts.getDeclarationOfKind(symbol, 160 /* SetAccessor */);
if (getter && ts.isInJSFile(getter)) {
var jsDocType = getTypeForDeclarationFromJSDocComment(getter);
if (jsDocType) {
@@ -36249,7 +36598,7 @@
if (!popTypeResolution()) {
type = anyType;
if (noImplicitAny) {
- var getter_1 = ts.getDeclarationOfKind(symbol, 158 /* GetAccessor */);
+ var getter_1 = ts.getDeclarationOfKind(symbol, 159 /* GetAccessor */);
error(getter_1, ts.Diagnostics._0_implicitly_has_return_type_any_because_it_does_not_have_a_return_type_annotation_and_is_referenced_directly_or_indirectly_in_one_of_its_return_expressions, symbolToString(symbol));
}
}
@@ -36289,8 +36638,8 @@
if (symbol.flags & 1536 /* Module */ && ts.isShorthandAmbientModuleSymbol(symbol)) {
return anyType;
}
- else if (declaration.kind === 204 /* BinaryExpression */ ||
- declaration.kind === 189 /* PropertyAccessExpression */ && declaration.parent.kind === 204 /* BinaryExpression */) {
+ else if (declaration.kind === 205 /* BinaryExpression */ ||
+ declaration.kind === 190 /* PropertyAccessExpression */ && declaration.parent.kind === 205 /* BinaryExpression */) {
return getWidenedTypeFromAssignmentDeclaration(symbol);
}
else if (symbol.flags & 512 /* ValueModule */ && declaration && ts.isSourceFile(declaration) && declaration.commonJsModuleIndicator) {
@@ -36357,7 +36706,7 @@
return errorType;
}
// Check if variable has initializer that circularly references the variable itself
- if (noImplicitAny && (declaration.kind !== 151 /* Parameter */ || declaration.initializer)) {
+ if (noImplicitAny && (declaration.kind !== 152 /* Parameter */ || declaration.initializer)) {
error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol));
}
// Circularities could also result from parameters in function expressions that end up
@@ -36365,11 +36714,23 @@
// we have already reported an implicit any error so we don't report anything here.
return anyType;
}
+ function getTypeOfSymbolWithDeferredType(symbol) {
+ var links = getSymbolLinks(symbol);
+ if (!links.type) {
+ ts.Debug.assertDefined(links.deferralParent);
+ ts.Debug.assertDefined(links.deferralConstituents);
+ links.type = links.deferralParent.flags & 1048576 /* Union */ ? getUnionType(links.deferralConstituents) : getIntersectionType(links.deferralConstituents);
+ }
+ return links.type;
+ }
function getTypeOfSymbol(symbol) {
+ if (ts.getCheckFlags(symbol) & 65536 /* DeferredType */) {
+ return getTypeOfSymbolWithDeferredType(symbol);
+ }
if (ts.getCheckFlags(symbol) & 1 /* Instantiated */) {
return getTypeOfInstantiatedSymbol(symbol);
}
- if (ts.getCheckFlags(symbol) & 4096 /* ReverseMapped */) {
+ if (ts.getCheckFlags(symbol) & 8192 /* ReverseMapped */) {
return getTypeOfReverseMappedSymbol(symbol);
}
if (symbol.flags & (3 /* Variable */ | 4 /* Property */)) {
@@ -36430,35 +36791,35 @@
return undefined;
}
switch (node.kind) {
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 241 /* InterfaceDeclaration */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 155 /* MethodSignature */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 294 /* JSDocFunctionType */:
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 242 /* TypeAliasDeclaration */:
- case 308 /* JSDocTemplateTag */:
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
- case 181 /* MappedType */:
- case 175 /* ConditionalType */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 242 /* InterfaceDeclaration */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 156 /* MethodSignature */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 295 /* JSDocFunctionType */:
+ case 240 /* FunctionDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 243 /* TypeAliasDeclaration */:
+ case 309 /* JSDocTemplateTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
+ case 182 /* MappedType */:
+ case 176 /* ConditionalType */:
var outerTypeParameters = getOuterTypeParameters(node, includeThisTypes);
- if (node.kind === 181 /* MappedType */) {
+ if (node.kind === 182 /* MappedType */) {
return ts.append(outerTypeParameters, getDeclaredTypeOfTypeParameter(getSymbolOfNode(node.typeParameter)));
}
- else if (node.kind === 175 /* ConditionalType */) {
+ else if (node.kind === 176 /* ConditionalType */) {
return ts.concatenate(outerTypeParameters, getInferTypeParameters(node));
}
var outerAndOwnTypeParameters = appendTypeParameters(outerTypeParameters, ts.getEffectiveTypeParameterDeclarations(node));
var thisType = includeThisTypes &&
- (node.kind === 240 /* ClassDeclaration */ || node.kind === 209 /* ClassExpression */ || node.kind === 241 /* InterfaceDeclaration */) &&
+ (node.kind === 241 /* ClassDeclaration */ || node.kind === 210 /* ClassExpression */ || node.kind === 242 /* InterfaceDeclaration */) &&
getDeclaredTypeOfClassOrInterface(getSymbolOfNode(node)).thisType;
return thisType ? ts.append(outerAndOwnTypeParameters, thisType) : outerAndOwnTypeParameters;
}
@@ -36466,7 +36827,7 @@
}
// The outer type parameters are those defined by enclosing generic classes, methods, or functions.
function getOuterTypeParametersOfClassOrInterface(symbol) {
- var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 241 /* InterfaceDeclaration */);
+ var declaration = symbol.flags & 32 /* Class */ ? symbol.valueDeclaration : ts.getDeclarationOfKind(symbol, 242 /* InterfaceDeclaration */);
return getOuterTypeParameters(declaration);
}
// The local type parameters are the combined set of type parameters from all declarations of the class,
@@ -36475,9 +36836,9 @@
var result;
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var node = _a[_i];
- if (node.kind === 241 /* InterfaceDeclaration */ ||
- node.kind === 240 /* ClassDeclaration */ ||
- node.kind === 209 /* ClassExpression */ ||
+ if (node.kind === 242 /* InterfaceDeclaration */ ||
+ node.kind === 241 /* ClassDeclaration */ ||
+ node.kind === 210 /* ClassExpression */ ||
ts.isTypeAlias(node)) {
var declaration = node;
result = appendTypeParameters(result, ts.getEffectiveTypeParameterDeclarations(declaration));
@@ -36671,7 +37032,7 @@
type.resolvedBaseTypes = type.resolvedBaseTypes || ts.emptyArray;
for (var _i = 0, _a = type.symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 241 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) {
+ if (declaration.kind === 242 /* InterfaceDeclaration */ && ts.getInterfaceBaseTypeNodes(declaration)) {
for (var _b = 0, _c = ts.getInterfaceBaseTypeNodes(declaration); _b < _c.length; _b++) {
var node = _c[_b];
var baseType = getTypeFromTypeNode(node);
@@ -36707,7 +37068,7 @@
function isThislessInterface(symbol) {
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 241 /* InterfaceDeclaration */) {
+ if (declaration.kind === 242 /* InterfaceDeclaration */) {
if (declaration.flags & 64 /* ContainsThis */) {
return false;
}
@@ -36764,7 +37125,7 @@
return errorType;
}
var declaration = ts.find(symbol.declarations, function (d) {
- return ts.isJSDocTypeAlias(d) || d.kind === 242 /* TypeAliasDeclaration */;
+ return ts.isJSDocTypeAlias(d) || d.kind === 243 /* TypeAliasDeclaration */;
});
var typeNode = ts.isJSDocTypeAlias(declaration) ? declaration.typeExpression : declaration.type;
// If typeNode is missing, we will error in checkJSDocTypedefTag.
@@ -36791,7 +37152,7 @@
if (expr.kind === 10 /* StringLiteral */) {
return true;
}
- else if (expr.kind === 204 /* BinaryExpression */) {
+ else if (expr.kind === 205 /* BinaryExpression */) {
return isStringConcatExpression(expr.left) && isStringConcatExpression(expr.right);
}
return false;
@@ -36805,12 +37166,12 @@
case 10 /* StringLiteral */:
case 8 /* NumericLiteral */:
return true;
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return expr.operator === 39 /* MinusToken */ &&
expr.operand.kind === 8 /* NumericLiteral */;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return ts.nodeIsMissing(expr) || !!getSymbolOfNode(member.parent).exports.get(expr.escapedText);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return isStringConcatExpression(expr);
default:
return false;
@@ -36824,7 +37185,7 @@
var hasNonLiteralMember = false;
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 243 /* EnumDeclaration */) {
+ if (declaration.kind === 244 /* EnumDeclaration */) {
for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) {
var member = _c[_b];
if (member.initializer && member.initializer.kind === 10 /* StringLiteral */) {
@@ -36851,7 +37212,7 @@
var memberTypeList = [];
for (var _i = 0, _a = symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.kind === 243 /* EnumDeclaration */) {
+ if (declaration.kind === 244 /* EnumDeclaration */) {
for (var _b = 0, _c = declaration.members; _b < _c.length; _b++) {
var member = _c[_b];
var memberType = getFreshTypeOfLiteralType(getLiteralType(getEnumMemberValue(member), enumCount, getSymbolOfNode(member))); // TODO: GH#18217
@@ -36922,23 +37283,23 @@
*/
function isThislessType(node) {
switch (node.kind) {
- case 120 /* AnyKeyword */:
- case 143 /* UnknownKeyword */:
- case 138 /* StringKeyword */:
- case 135 /* NumberKeyword */:
- case 146 /* BigIntKeyword */:
- case 123 /* BooleanKeyword */:
- case 139 /* SymbolKeyword */:
- case 136 /* ObjectKeyword */:
- case 106 /* VoidKeyword */:
- case 141 /* UndefinedKeyword */:
- case 96 /* NullKeyword */:
- case 132 /* NeverKeyword */:
- case 182 /* LiteralType */:
+ case 121 /* AnyKeyword */:
+ case 144 /* UnknownKeyword */:
+ case 139 /* StringKeyword */:
+ case 136 /* NumberKeyword */:
+ case 147 /* BigIntKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 137 /* ObjectKeyword */:
+ case 107 /* VoidKeyword */:
+ case 142 /* UndefinedKeyword */:
+ case 97 /* NullKeyword */:
+ case 133 /* NeverKeyword */:
+ case 183 /* LiteralType */:
return true;
- case 169 /* ArrayType */:
+ case 170 /* ArrayType */:
return isThislessType(node.elementType);
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return !node.typeArguments || node.typeArguments.every(isThislessType);
}
return false;
@@ -36964,7 +37325,7 @@
function isThislessFunctionLikeDeclaration(node) {
var returnType = ts.getEffectiveReturnTypeNode(node);
var typeParameters = ts.getEffectiveTypeParameterDeclarations(node);
- return (node.kind === 157 /* Constructor */ || (!!returnType && isThislessType(returnType))) &&
+ return (node.kind === 158 /* Constructor */ || (!!returnType && isThislessType(returnType))) &&
node.parameters.every(isThislessVariableLikeDeclaration) &&
typeParameters.every(isThislessTypeParameter);
}
@@ -36980,14 +37341,14 @@
var declaration = symbol.declarations[0];
if (declaration) {
switch (declaration.kind) {
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
return isThislessVariableLikeDeclaration(declaration);
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return isThislessFunctionLikeDeclaration(declaration);
}
}
@@ -37088,7 +37449,7 @@
* members.
*/
function addDeclarationToLateBoundSymbol(symbol, member, symbolFlags) {
- ts.Debug.assert(!!(ts.getCheckFlags(symbol) & 2048 /* Late */), "Expected a late-bound symbol.");
+ ts.Debug.assert(!!(ts.getCheckFlags(symbol) & 4096 /* Late */), "Expected a late-bound symbol.");
symbol.flags |= symbolFlags;
getSymbolLinks(member.symbol).lateSymbol = symbol;
if (!symbol.declarations) {
@@ -37145,7 +37506,7 @@
// Get or add a late-bound symbol for the member. This allows us to merge late-bound accessor declarations.
var lateSymbol = lateSymbols.get(memberName);
if (!lateSymbol)
- lateSymbols.set(memberName, lateSymbol = createSymbol(0 /* None */, memberName, 2048 /* Late */));
+ lateSymbols.set(memberName, lateSymbol = createSymbol(0 /* None */, memberName, 4096 /* Late */));
// Report an error if a late-bound member has the same name as an early-bound member,
// or if we have another early-bound symbol declaration with the same name and
// conflicting flags.
@@ -37157,7 +37518,7 @@
var name_3 = !(type.flags & 8192 /* UniqueESSymbol */) && ts.unescapeLeadingUnderscores(memberName) || ts.declarationNameToString(decl.name);
ts.forEach(declarations, function (declaration) { return error(ts.getNameOfDeclaration(declaration) || declaration, ts.Diagnostics.Property_0_was_also_declared_here, name_3); });
error(decl.name || decl, ts.Diagnostics.Duplicate_property_0, name_3);
- lateSymbol = createSymbol(0 /* None */, memberName, 2048 /* Late */);
+ lateSymbol = createSymbol(0 /* None */, memberName, 4096 /* Late */);
}
lateSymbol.nameType = type;
addDeclarationToLateBoundSymbol(lateSymbol, decl, symbolFlags);
@@ -37222,11 +37583,12 @@
var links = getSymbolLinks(symbol);
if (!links.lateSymbol && ts.some(symbol.declarations, hasLateBindableName)) {
// force late binding of members/exports. This will set the late-bound symbol
+ var parent = getMergedSymbol(symbol.parent);
if (ts.some(symbol.declarations, ts.hasStaticModifier)) {
- getExportsOfSymbol(symbol.parent);
+ getExportsOfSymbol(parent);
}
else {
- getMembersOfSymbol(symbol.parent);
+ getMembersOfSymbol(parent);
}
}
return links.lateSymbol || (links.lateSymbol = symbol);
@@ -37343,8 +37705,8 @@
var tupleRestIndex_1 = restType.target.hasRestElement ? elementTypes.length - 1 : -1;
var restParams = ts.map(elementTypes, function (t, i) {
var name = getParameterNameAtPosition(sig, restIndex_1 + i);
- var checkFlags = i === tupleRestIndex_1 ? 16384 /* RestParameter */ :
- i >= minLength_1 ? 8192 /* OptionalParameter */ : 0;
+ var checkFlags = i === tupleRestIndex_1 ? 32768 /* RestParameter */ :
+ i >= minLength_1 ? 16384 /* OptionalParameter */ : 0;
var symbol = createSymbol(1 /* FunctionScopedVariable */, name, checkFlags);
symbol.type = i === tupleRestIndex_1 ? createArrayType(t) : t;
return symbol;
@@ -37434,10 +37796,10 @@
// Union the result types when more than one signature matches
if (unionSignatures.length > 1) {
var thisParameter = signature.thisParameter;
- if (ts.forEach(unionSignatures, function (sig) { return sig.thisParameter; })) {
- // TODO: GH#18217 We tested that *some* has thisParameter and now act as if *all* do
+ var firstThisParameterOfUnionSignatures = ts.forEach(unionSignatures, function (sig) { return sig.thisParameter; });
+ if (firstThisParameterOfUnionSignatures) {
var thisType = getUnionType(ts.map(unionSignatures, function (sig) { return sig.thisParameter ? getTypeOfSymbol(sig.thisParameter) : anyType; }), 2 /* Subtype */);
- thisParameter = createSymbolWithType(signature.thisParameter, thisType);
+ thisParameter = createSymbolWithType(firstThisParameterOfUnionSignatures, thisType);
}
s = createUnionSignature(signature, unionSignatures);
s.thisParameter = thisParameter;
@@ -37694,7 +38056,7 @@
var members = ts.createSymbolTable();
for (var _i = 0, _a = getPropertiesOfType(type.source); _i < _a.length; _i++) {
var prop = _a[_i];
- var checkFlags = 4096 /* ReverseMapped */ | (readonlyMask && isReadonlySymbol(prop) ? 8 /* Readonly */ : 0);
+ var checkFlags = 8192 /* ReverseMapped */ | (readonlyMask && isReadonlySymbol(prop) ? 8 /* Readonly */ : 0);
var inferredProp = createSymbol(4 /* Property */ | prop.flags & optionalMask, prop.escapedName, checkFlags);
inferredProp.declarations = prop.declarations;
inferredProp.nameType = prop.nameType;
@@ -37716,7 +38078,15 @@
return getIndexType(getApparentType(type.type));
}
if (type.flags & 16777216 /* Conditional */) {
- return getLowerBoundOfConditionalType(type);
+ if (type.root.isDistributive) {
+ var checkType = type.checkType;
+ var constraint = getLowerBoundOfKeyType(checkType);
+ if (constraint !== checkType) {
+ var mapper = makeUnaryTypeMapper(type.root.checkType, constraint);
+ return getConditionalTypeInstantiation(type, combineTypeMappers(mapper, type.mapper));
+ }
+ }
+ return type;
}
if (type.flags & 1048576 /* Union */) {
return getUnionType(ts.sameMap(type.types, getLowerBoundOfKeyType));
@@ -37726,16 +38096,6 @@
}
return neverType;
}
- function getLowerBoundOfConditionalType(type) {
- if (type.root.isDistributive) {
- var constraint = getLowerBoundOfKeyType(type.checkType);
- if (constraint !== type.checkType) {
- var mapper = makeUnaryTypeMapper(type.root.checkType, constraint);
- return getConditionalTypeInstantiation(type, combineTypeMappers(mapper, type.mapper));
- }
- }
- return type;
- }
/** Resolve the members of a mapped type { [P in K]: T } */
function resolveMappedTypeMembers(type) {
var members = ts.createSymbolTable();
@@ -37824,8 +38184,8 @@
}
function isMappedTypeWithKeyofConstraintDeclaration(type) {
var constraintDeclaration = getConstraintDeclarationForMappedType(type); // TODO: GH#18217
- return constraintDeclaration.kind === 179 /* TypeOperator */ &&
- constraintDeclaration.operator === 129 /* KeyOfKeyword */;
+ return constraintDeclaration.kind === 180 /* TypeOperator */ &&
+ constraintDeclaration.operator === 130 /* KeyOfKeyword */;
}
function getModifiersTypeFromMappedType(type) {
if (!type.modifiersType) {
@@ -37842,7 +38202,7 @@
var declaredType = getTypeFromMappedTypeNode(type.declaration);
var constraint = getConstraintTypeFromMappedType(declaredType);
var extendedConstraint = constraint && constraint.flags & 262144 /* TypeParameter */ ? getConstraintOfTypeParameter(constraint) : constraint;
- type.modifiersType = extendedConstraint && extendedConstraint.flags & 4194304 /* Index */ ? instantiateType(extendedConstraint.type, type.mapper || identityMapper) : emptyObjectType;
+ type.modifiersType = extendedConstraint && extendedConstraint.flags & 4194304 /* Index */ ? instantiateType(extendedConstraint.type, type.mapper || identityMapper) : unknownType;
}
}
return type.modifiersType;
@@ -37938,6 +38298,26 @@
}
return type.resolvedProperties;
}
+ function getPossiblePropertiesOfUnionType(type) {
+ if (type.possiblePropertyCache) {
+ return type.possiblePropertyCache.size ? ts.arrayFrom(type.possiblePropertyCache.values()) : ts.emptyArray;
+ }
+ type.possiblePropertyCache = ts.createSymbolTable();
+ for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
+ var t = _a[_i];
+ for (var _b = 0, _c = getPropertiesOfType(t); _b < _c.length; _b++) {
+ var p = _c[_b];
+ if (!type.possiblePropertyCache.has(p.escapedName)) {
+ var prop = getUnionOrIntersectionProperty(type, p.escapedName);
+ if (prop) {
+ type.possiblePropertyCache.set(p.escapedName, prop);
+ }
+ }
+ }
+ }
+ // We can't simply use the normal property cache here, since that will contain cached apparent type members :(
+ return type.possiblePropertyCache.size ? ts.arrayFrom(type.possiblePropertyCache.values()) : ts.emptyArray;
+ }
function getPropertiesOfType(type) {
type = getApparentType(type);
return type.flags & 3145728 /* UnionOrIntersection */ ?
@@ -37985,16 +38365,23 @@
function getConstraintOfIndexedAccess(type) {
return hasNonCircularBaseConstraint(type) ? getConstraintFromIndexedAccess(type) : undefined;
}
+ function getSimplifiedTypeOrConstraint(type) {
+ var simplified = getSimplifiedType(type, /*writing*/ false);
+ return simplified !== type ? simplified : getConstraintOfType(type);
+ }
function getConstraintFromIndexedAccess(type) {
- var objectType = getConstraintOfType(type.objectType) || type.objectType;
- if (objectType !== type.objectType) {
- var constraint = getIndexedAccessType(objectType, type.indexType, /*accessNode*/ undefined, errorType);
- if (constraint && constraint !== errorType) {
- return constraint;
+ var indexConstraint = getSimplifiedTypeOrConstraint(type.indexType);
+ if (indexConstraint && indexConstraint !== type.indexType) {
+ var indexedAccess = getIndexedAccessTypeOrUndefined(type.objectType, indexConstraint);
+ if (indexedAccess) {
+ return indexedAccess;
+ }
}
+ var objectConstraint = getSimplifiedTypeOrConstraint(type.objectType);
+ if (objectConstraint && objectConstraint !== type.objectType) {
+ return getIndexedAccessTypeOrUndefined(objectConstraint, type.indexType);
}
- var baseConstraint = getBaseConstraintOfType(type);
- return baseConstraint && baseConstraint !== type ? baseConstraint : undefined;
+ return undefined;
}
function getDefaultConstraintOfConditionalType(type) {
if (!type.resolvedDefaultConstraint) {
@@ -38003,7 +38390,7 @@
// just `any`. This result is _usually_ unwanted - so instead here we elide an `any` branch from the constraint type,
// in effect treating `any` like `never` rather than `unknown` in this location.
var trueConstraint = getInferredTrueTypeFromConditionalType(type);
- var falseConstraint = type.falseType;
+ var falseConstraint = getFalseTypeFromConditionalType(type);
type.resolvedDefaultConstraint = isTypeAny(trueConstraint) ? falseConstraint : isTypeAny(falseConstraint) ? trueConstraint : getUnionType([trueConstraint, falseConstraint]);
}
return type.resolvedDefaultConstraint;
@@ -38021,7 +38408,7 @@
// a union - once negated types exist and are applied to the conditional false branch, this "constraint"
// likely doesn't need to exist.
if (type.root.isDistributive && type.restrictiveInstantiation !== type) {
- var simplified = getSimplifiedType(type.checkType);
+ var simplified = getSimplifiedType(type.checkType, /*writing*/ false);
var constraint = simplified === type.checkType ? getConstraintOfType(simplified) : simplified;
if (constraint && constraint !== type.checkType) {
var mapper = makeUnaryTypeMapper(type.root.checkType, constraint);
@@ -38052,11 +38439,6 @@
constraint = getConstraintOfType(constraint);
}
if (constraint) {
- // A constraint that isn't a union type implies that the final type would be a non-union
- // type as well. Since non-union constraints are of no interest, we can exit here.
- if (!(constraint.flags & 1048576 /* Union */)) {
- return undefined;
- }
constraints = ts.append(constraints, constraint);
}
}
@@ -38065,10 +38447,10 @@
}
}
// If the target is a union type or if we are intersecting with types belonging to one of the
- // disjoint domans, we may end up producing a constraint that hasn't been examined before.
+ // disjoint domains, we may end up producing a constraint that hasn't been examined before.
if (constraints && (targetIsUnion || hasDisjointDomainType)) {
if (hasDisjointDomainType) {
- // We add any types belong to one of the disjoint domans because they might cause the final
+ // We add any types belong to one of the disjoint domains because they might cause the final
// intersection operation to reduce the union constraints.
for (var _b = 0, _c = type.types; _b < _c.length; _b++) {
var t = _c[_b];
@@ -38114,7 +38496,7 @@
}
if (constraintDepth >= 50) {
// We have reached 50 recursive invocations of getImmediateBaseConstraint and there is a
- // very high likelyhood we're dealing with an infinite generic type that perpetually generates
+ // very high likelihood we're dealing with an infinite generic type that perpetually generates
// new type identities as we descend into it. We stop the recursion here and mark this type
// and the outer types as having circular constraints.
error(currentNode, ts.Diagnostics.Type_instantiation_is_excessively_deep_and_possibly_infinite);
@@ -38122,7 +38504,7 @@
return t.immediateBaseConstraint = noConstraintType;
}
constraintDepth++;
- var result = computeBaseConstraint(getSimplifiedType(t));
+ var result = computeBaseConstraint(getSimplifiedType(t, /*writing*/ false));
constraintDepth--;
if (!popTypeResolution()) {
if (t.flags & 262144 /* TypeParameter */) {
@@ -38174,8 +38556,8 @@
if (t.flags & 8388608 /* IndexedAccess */) {
var baseObjectType = getBaseConstraint(t.objectType);
var baseIndexType = getBaseConstraint(t.indexType);
- var baseIndexedAccess = baseObjectType && baseIndexType ? getIndexedAccessType(baseObjectType, baseIndexType, /*accessNode*/ undefined, errorType) : undefined;
- return baseIndexedAccess && baseIndexedAccess !== errorType ? getBaseConstraint(baseIndexedAccess) : undefined;
+ var baseIndexedAccess = baseObjectType && baseIndexType && getIndexedAccessTypeOrUndefined(baseObjectType, baseIndexType);
+ return baseIndexedAccess && getBaseConstraint(baseIndexedAccess);
}
if (t.flags & 16777216 /* Conditional */) {
var constraint = getConstraintFromConditionalType(t);
@@ -38256,16 +38638,17 @@
* type itself. Note that the apparent type of a union type is the union type itself.
*/
function getApparentType(type) {
- var t = type.flags & 63176704 /* Instantiable */ ? getBaseConstraintOfType(type) || emptyObjectType : type;
+ var t = type.flags & 63176704 /* Instantiable */ ? getBaseConstraintOfType(type) || unknownType : type;
return ts.getObjectFlags(t) & 32 /* Mapped */ ? getApparentTypeOfMappedType(t) :
t.flags & 2097152 /* Intersection */ ? getApparentTypeOfIntersectionType(t) :
t.flags & 132 /* StringLike */ ? globalStringType :
t.flags & 296 /* NumberLike */ ? globalNumberType :
- t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType(/*reportErrors*/ languageVersion >= 7 /* ESNext */) :
+ t.flags & 2112 /* BigIntLike */ ? getGlobalBigIntType(/*reportErrors*/ languageVersion >= 8 /* ESNext */) :
t.flags & 528 /* BooleanLike */ ? globalBooleanType :
t.flags & 12288 /* ESSymbolLike */ ? getGlobalESSymbolType(/*reportErrors*/ languageVersion >= 2 /* ES2015 */) :
t.flags & 67108864 /* NonPrimitive */ ? emptyObjectType :
t.flags & 4194304 /* Index */ ? keyofConstraintType :
+ t.flags & 2 /* Unknown */ && !strictNullChecks ? emptyObjectType :
t;
}
function createUnionOrIntersectionProperty(containingType, name) {
@@ -38274,7 +38657,7 @@
var isUnion = containingType.flags & 1048576 /* Union */;
var excludeModifiers = isUnion ? 24 /* NonPublicAccessibilityModifier */ : 0;
// Flags we want to propagate to the result if they exist in all source symbols
- var commonFlags = isUnion ? 0 /* None */ : 16777216 /* Optional */;
+ var optionalFlag = isUnion ? 0 /* None */ : 16777216 /* Optional */;
var syntheticFlag = 4 /* SyntheticMethod */;
var checkFlags = 0;
for (var _i = 0, _a = containingType.types; _i < _a.length; _i++) {
@@ -38284,16 +38667,21 @@
var prop = getPropertyOfType(type, name);
var modifiers = prop ? ts.getDeclarationModifierFlagsFromSymbol(prop) : 0;
if (prop && !(modifiers & excludeModifiers)) {
- commonFlags &= prop.flags;
+ if (isUnion) {
+ optionalFlag |= (prop.flags & 16777216 /* Optional */);
+ }
+ else {
+ optionalFlag &= prop.flags;
+ }
var id = "" + getSymbolId(prop);
if (!propSet.has(id)) {
propSet.set(id, prop);
}
checkFlags |= (isReadonlySymbol(prop) ? 8 /* Readonly */ : 0) |
- (!(modifiers & 24 /* NonPublicAccessibilityModifier */) ? 128 /* ContainsPublic */ : 0) |
- (modifiers & 16 /* Protected */ ? 256 /* ContainsProtected */ : 0) |
- (modifiers & 8 /* Private */ ? 512 /* ContainsPrivate */ : 0) |
- (modifiers & 32 /* Static */ ? 1024 /* ContainsStatic */ : 0);
+ (!(modifiers & 24 /* NonPublicAccessibilityModifier */) ? 256 /* ContainsPublic */ : 0) |
+ (modifiers & 16 /* Protected */ ? 512 /* ContainsProtected */ : 0) |
+ (modifiers & 8 /* Private */ ? 1024 /* ContainsPrivate */ : 0) |
+ (modifiers & 32 /* Static */ ? 2048 /* ContainsStatic */ : 0);
if (!isPrototypeProperty(prop)) {
syntheticFlag = 2 /* SyntheticProperty */;
}
@@ -38302,10 +38690,11 @@
var indexInfo = !isLateBoundName(name) && (isNumericLiteralName(name) && getIndexInfoOfType(type, 1 /* Number */) || getIndexInfoOfType(type, 0 /* String */));
if (indexInfo) {
checkFlags |= indexInfo.isReadonly ? 8 /* Readonly */ : 0;
+ checkFlags |= 32 /* WritePartial */;
indexTypes = ts.append(indexTypes, isTupleType(type) ? getRestTypeOfTupleType(type) || undefinedType : indexInfo.type);
}
else {
- checkFlags |= 16 /* Partial */;
+ checkFlags |= 16 /* ReadPartial */;
}
}
}
@@ -38314,7 +38703,7 @@
return undefined;
}
var props = ts.arrayFrom(propSet.values());
- if (props.length === 1 && !(checkFlags & 16 /* Partial */) && !indexTypes) {
+ if (props.length === 1 && !(checkFlags & 16 /* ReadPartial */) && !indexTypes) {
return props[0];
}
var declarations;
@@ -38338,15 +38727,15 @@
nameType = prop.nameType;
}
else if (type !== firstType) {
- checkFlags |= 32 /* HasNonUniformType */;
+ checkFlags |= 64 /* HasNonUniformType */;
}
if (isLiteralType(type)) {
- checkFlags |= 64 /* HasLiteralType */;
+ checkFlags |= 128 /* HasLiteralType */;
}
propTypes.push(type);
}
ts.addRange(propTypes, indexTypes);
- var result = createSymbol(4 /* Property */ | commonFlags, name, syntheticFlag | checkFlags);
+ var result = createSymbol(4 /* Property */ | optionalFlag, name, syntheticFlag | checkFlags);
result.containingType = containingType;
if (!hasNonUniformValueDeclaration && firstValueDeclaration) {
result.valueDeclaration = firstValueDeclaration;
@@ -38357,7 +38746,15 @@
}
result.declarations = declarations;
result.nameType = nameType;
+ if (propTypes.length > 2) {
+ // When `propTypes` has the potential to explode in size when normalized, defer normalization until absolutely needed
+ result.checkFlags |= 65536 /* DeferredType */;
+ result.deferralParent = containingType;
+ result.deferralConstituents = propTypes;
+ }
+ else {
result.type = isUnion ? getUnionType(propTypes) : getIntersectionType(propTypes);
+ }
return result;
}
// Return the symbol for a given property in a union or intersection type, or undefined if the property
@@ -38379,7 +38776,7 @@
function getPropertyOfUnionOrIntersectionType(type, name) {
var property = getUnionOrIntersectionProperty(type, name);
// We need to filter out partial properties in union types
- return property && !(ts.getCheckFlags(property) & 16 /* Partial */) ? property : undefined;
+ return property && !(ts.getCheckFlags(property) & 16 /* ReadPartial */) ? property : undefined;
}
/**
* Return the symbol for the property with the given name in the given type. Creates synthetic union properties when
@@ -38485,10 +38882,10 @@
function isJSDocOptionalParameter(node) {
return ts.isInJSFile(node) && (
// node.type should only be a JSDocOptionalType when node is a parameter of a JSDocFunctionType
- node.type && node.type.kind === 293 /* JSDocOptionalType */
+ node.type && node.type.kind === 294 /* JSDocOptionalType */
|| ts.getJSDocParameterTags(node).some(function (_a) {
var isBracketed = _a.isBracketed, typeExpression = _a.typeExpression;
- return isBracketed || !!typeExpression && typeExpression.type.kind === 293 /* JSDocOptionalType */;
+ return isBracketed || !!typeExpression && typeExpression.type.kind === 294 /* JSDocOptionalType */;
}));
}
function tryFindAmbientModule(moduleName, withAugmentations) {
@@ -38522,7 +38919,7 @@
return false;
}
var isBracketed = node.isBracketed, typeExpression = node.typeExpression;
- return isBracketed || !!typeExpression && typeExpression.type.kind === 293 /* JSDocOptionalType */;
+ return isBracketed || !!typeExpression && typeExpression.type.kind === 294 /* JSDocOptionalType */;
}
function createIdentifierTypePredicate(parameterName, parameterIndex, type) {
return { kind: 1 /* Identifier */, parameterName: parameterName, parameterIndex: parameterIndex, type: type };
@@ -38560,7 +38957,7 @@
var baseDefaultType = getDefaultTypeArgumentType(isJavaScriptImplicitAny);
for (var i = numTypeArguments; i < numTypeParameters; i++) {
var defaultType = getDefaultFromTypeParameter(typeParameters[i]);
- if (isJavaScriptImplicitAny && defaultType && isTypeIdenticalTo(defaultType, emptyObjectType)) {
+ if (isJavaScriptImplicitAny && defaultType && (isTypeIdenticalTo(defaultType, unknownType) || isTypeIdenticalTo(defaultType, emptyObjectType))) {
defaultType = anyType;
}
result[i] = defaultType ? instantiateType(defaultType, createTypeMapper(typeParameters, result)) : baseDefaultType;
@@ -38604,7 +39001,7 @@
else {
parameters.push(paramSymbol);
}
- if (type && type.kind === 182 /* LiteralType */) {
+ if (type && type.kind === 183 /* LiteralType */) {
hasLiteralTypes = true;
}
// Record a new minimum argument count if this is not an optional parameter
@@ -38618,16 +39015,16 @@
}
}
// If only one accessor includes a this-type annotation, the other behaves as if it had the same type annotation
- if ((declaration.kind === 158 /* GetAccessor */ || declaration.kind === 159 /* SetAccessor */) &&
+ if ((declaration.kind === 159 /* GetAccessor */ || declaration.kind === 160 /* SetAccessor */) &&
!hasNonBindableDynamicName(declaration) &&
(!hasThisParameter || !thisParameter)) {
- var otherKind = declaration.kind === 158 /* GetAccessor */ ? 159 /* SetAccessor */ : 158 /* GetAccessor */;
+ var otherKind = declaration.kind === 159 /* GetAccessor */ ? 160 /* SetAccessor */ : 159 /* GetAccessor */;
var other = ts.getDeclarationOfKind(getSymbolOfNode(declaration), otherKind);
if (other) {
thisParameter = getAnnotatedAccessorThisParameter(other);
}
}
- var classType = declaration.kind === 157 /* Constructor */ ?
+ var classType = declaration.kind === 158 /* Constructor */ ?
getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol))
: undefined;
var typeParameters = classType ? classType.localTypeParameters : getTypeParametersFromDeclaration(declaration);
@@ -38652,7 +39049,7 @@
var lastParamVariadicType = ts.firstDefined(lastParamTags, function (p) {
return p.typeExpression && ts.isJSDocVariadicType(p.typeExpression.type) ? p.typeExpression.type : undefined;
});
- var syntheticArgsSymbol = createSymbol(3 /* Variable */, "args", 16384 /* RestParameter */);
+ var syntheticArgsSymbol = createSymbol(3 /* Variable */, "args", 32768 /* RestParameter */);
syntheticArgsSymbol.type = lastParamVariadicType ? createArrayType(getTypeFromTypeNode(lastParamVariadicType.type)) : anyArrayType;
if (lastParamVariadicType) {
// Replace the last parameter with a rest parameter.
@@ -38685,13 +39082,13 @@
if (!node)
return false;
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return node.escapedText === "arguments" && ts.isExpressionNode(node);
- case 154 /* PropertyDeclaration */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- return node.name.kind === 149 /* ComputedPropertyName */
+ case 155 /* PropertyDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ return node.name.kind === 150 /* ComputedPropertyName */
&& traverse(node.name);
default:
return !ts.nodeStartsNewLexicalEnvironment(node) && !ts.isPartOfTypeNode(node) && !!ts.forEachChild(node, traverse);
@@ -38766,7 +39163,7 @@
function createTypePredicateFromTypePredicateNode(node, signature) {
var parameterName = node.parameterName;
var type = getTypeFromTypeNode(node.type);
- if (parameterName.kind === 72 /* Identifier */) {
+ if (parameterName.kind === 73 /* Identifier */) {
return createIdentifierTypePredicate(parameterName.escapedText, ts.findIndex(signature.parameters, function (p) { return p.escapedName === parameterName.escapedText; }), type);
}
else {
@@ -38807,7 +39204,7 @@
return signature.resolvedReturnType;
}
function getReturnTypeFromAnnotation(declaration) {
- if (declaration.kind === 157 /* Constructor */) {
+ if (declaration.kind === 158 /* Constructor */) {
return getDeclaredTypeOfClassOrInterface(getMergedSymbol(declaration.parent.symbol));
}
if (ts.isJSDocConstructSignature(declaration)) {
@@ -38817,12 +39214,12 @@
if (typeNode) {
return getTypeFromTypeNode(typeNode);
}
- if (declaration.kind === 158 /* GetAccessor */ && !hasNonBindableDynamicName(declaration)) {
+ if (declaration.kind === 159 /* GetAccessor */ && !hasNonBindableDynamicName(declaration)) {
var jsDocType = ts.isInJSFile(declaration) && getTypeForDeclarationFromJSDocComment(declaration);
if (jsDocType) {
return jsDocType;
}
- var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 159 /* SetAccessor */);
+ var setter = ts.getDeclarationOfKind(getSymbolOfNode(declaration), 160 /* SetAccessor */);
var setterType = getAnnotatedAccessorType(setter);
if (setterType) {
return setterType;
@@ -38847,7 +39244,7 @@
function getSignatureInstantiation(signature, typeArguments, isJavascript, inferredTypeParameters) {
var instantiatedSignature = getSignatureInstantiationWithoutFillingInTypeArguments(signature, fillMissingTypeArguments(typeArguments, signature.typeParameters, getMinTypeArgumentCount(signature.typeParameters), isJavascript));
if (inferredTypeParameters) {
- var returnSignature = getSingleCallSignature(getReturnTypeOfSignature(instantiatedSignature));
+ var returnSignature = getSingleCallOrConstructSignature(getReturnTypeOfSignature(instantiatedSignature));
if (returnSignature) {
var newReturnSignature = cloneSignature(returnSignature);
newReturnSignature.typeParameters = inferredTypeParameters;
@@ -38900,7 +39297,7 @@
var typeParameters = signature.typeParameters;
if (typeParameters) {
var typeEraser_1 = createTypeEraser(typeParameters);
- var baseConstraints = ts.map(typeParameters, function (tp) { return instantiateType(getBaseConstraintOfType(tp), typeEraser_1) || emptyObjectType; });
+ var baseConstraints = ts.map(typeParameters, function (tp) { return instantiateType(getBaseConstraintOfType(tp), typeEraser_1) || unknownType; });
return instantiateSignature(signature, createTypeMapper(typeParameters, baseConstraints), /*eraseTypeParameters*/ true);
}
return signature;
@@ -38911,7 +39308,8 @@
// object type literal or interface (using the new keyword). Each way of declaring a constructor
// will result in a different declaration kind.
if (!signature.isolatedSignatureType) {
- var isConstructor = signature.declaration.kind === 157 /* Constructor */ || signature.declaration.kind === 161 /* ConstructSignature */; // TODO: GH#18217
+ var kind = signature.declaration ? signature.declaration.kind : 0 /* Unknown */;
+ var isConstructor = kind === 158 /* Constructor */ || kind === 162 /* ConstructSignature */ || kind === 167 /* ConstructorType */;
var type = createObjectType(16 /* Anonymous */);
type.members = emptySymbols;
type.properties = ts.emptyArray;
@@ -38925,7 +39323,7 @@
return symbol.members.get("__index" /* Index */);
}
function getIndexDeclarationOfSymbol(symbol, kind) {
- var syntaxKind = kind === 1 /* Number */ ? 135 /* NumberKeyword */ : 138 /* StringKeyword */;
+ var syntaxKind = kind === 1 /* Number */ ? 136 /* NumberKeyword */ : 139 /* StringKeyword */;
var indexSymbol = getIndexSymbol(symbol);
if (indexSymbol) {
for (var _i = 0, _a = indexSymbol.declarations; _i < _a.length; _i++) {
@@ -38952,7 +39350,7 @@
return undefined;
}
function getConstraintDeclaration(type) {
- var decl = type.symbol && ts.getDeclarationOfKind(type.symbol, 150 /* TypeParameter */);
+ var decl = type.symbol && ts.getDeclarationOfKind(type.symbol, 151 /* TypeParameter */);
return decl && ts.getEffectiveConstraintOfTypeParameter(decl);
}
function getInferredTypeParameterConstraint(typeParameter) {
@@ -38960,13 +39358,13 @@
if (typeParameter.symbol) {
for (var _i = 0, _a = typeParameter.symbol.declarations; _i < _a.length; _i++) {
var declaration = _a[_i];
- if (declaration.parent.kind === 176 /* InferType */) {
+ if (declaration.parent.kind === 177 /* InferType */) {
// When an 'infer T' declaration is immediately contained in a type reference node
// (such as 'Foo<infer T>'), T's constraint is inferred from the constraint of the
// corresponding type parameter in 'Foo'. When multiple 'infer T' declarations are
// present, we form an intersection of the inferred constraint types.
var grandParent = declaration.parent.parent;
- if (grandParent.kind === 164 /* TypeReference */) {
+ if (grandParent.kind === 165 /* TypeReference */) {
var typeReference = grandParent;
var typeParameters = getTypeParametersForTypeReference(typeReference);
if (typeParameters) {
@@ -38991,7 +39389,7 @@
}
// When an 'infer T' declaration is immediately contained in a rest parameter
// declaration, we infer an 'unknown[]' constraint.
- else if (grandParent.kind === 151 /* Parameter */ && grandParent.dotDotDotToken) {
+ else if (grandParent.kind === 152 /* Parameter */ && grandParent.dotDotDotToken) {
inferences = ts.append(inferences, createArrayType(unknownType));
}
}
@@ -39015,7 +39413,7 @@
return typeParameter.constraint === noConstraintType ? undefined : typeParameter.constraint;
}
function getParentSymbolOfTypeParameter(typeParameter) {
- var tp = ts.getDeclarationOfKind(typeParameter.symbol, 150 /* TypeParameter */);
+ var tp = ts.getDeclarationOfKind(typeParameter.symbol, 151 /* TypeParameter */);
var host = ts.isJSDocTemplateTag(tp.parent) ? ts.getHostSignatureFromJSDoc(tp.parent) : tp.parent;
return host && getSymbolOfNode(host);
}
@@ -39148,9 +39546,9 @@
}
function getTypeReferenceName(node) {
switch (node.kind) {
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return node.typeName;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
// We only support expressions that are simple qualified names. For other
// expressions this produces undefined.
var expr = node.expression;
@@ -39249,16 +39647,22 @@
}
}
function getSubstitutionType(typeVariable, substitute) {
- if (substitute.flags & 3 /* AnyOrUnknown */) {
+ if (substitute.flags & 3 /* AnyOrUnknown */ || substitute === typeVariable) {
return typeVariable;
}
+ var id = getTypeId(typeVariable) + ">" + getTypeId(substitute);
+ var cached = substitutionTypes.get(id);
+ if (cached) {
+ return cached;
+ }
var result = createType(33554432 /* Substitution */);
result.typeVariable = typeVariable;
result.substitute = substitute;
+ substitutionTypes.set(id, result);
return result;
}
function isUnaryTupleTypeNode(node) {
- return node.kind === 170 /* TupleType */ && node.elementTypes.length === 1;
+ return node.kind === 171 /* TupleType */ && node.elementTypes.length === 1;
}
function getImpliedConstraint(typeVariable, checkNode, extendsNode) {
return isUnaryTupleTypeNode(checkNode) && isUnaryTupleTypeNode(extendsNode) ? getImpliedConstraint(typeVariable, checkNode.elementTypes[0], extendsNode.elementTypes[0]) :
@@ -39267,9 +39671,9 @@
}
function getConstrainedTypeVariable(typeVariable, node) {
var constraints;
- while (node && !ts.isStatement(node) && node.kind !== 296 /* JSDocComment */) {
+ while (node && !ts.isStatement(node) && node.kind !== 297 /* JSDocComment */) {
var parent = node.parent;
- if (parent.kind === 175 /* ConditionalType */ && node === parent.trueType) {
+ if (parent.kind === 176 /* ConditionalType */ && node === parent.trueType) {
var constraint = getImpliedConstraint(typeVariable, parent.checkType, parent.extendsType);
if (constraint) {
constraints = ts.append(constraints, constraint);
@@ -39280,7 +39684,7 @@
return constraints ? getSubstitutionType(typeVariable, getIntersectionType(ts.append(constraints, typeVariable))) : typeVariable;
}
function isJSDocTypeReference(node) {
- return !!(node.flags & 2097152 /* JSDoc */) && (node.kind === 164 /* TypeReference */ || node.kind === 183 /* ImportType */);
+ return !!(node.flags & 2097152 /* JSDoc */) && (node.kind === 165 /* TypeReference */ || node.kind === 184 /* ImportType */);
}
function checkNoTypeArguments(node, symbol) {
if (node.typeArguments) {
@@ -39381,9 +39785,9 @@
for (var _i = 0, declarations_3 = declarations; _i < declarations_3.length; _i++) {
var declaration = declarations_3[_i];
switch (declaration.kind) {
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 243 /* EnumDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 244 /* EnumDeclaration */:
return declaration;
}
}
@@ -39469,11 +39873,8 @@
function getGlobalExtractSymbol() {
return deferredGlobalExtractSymbol || (deferredGlobalExtractSymbol = getGlobalSymbol("Extract", 524288 /* TypeAlias */, ts.Diagnostics.Cannot_find_global_type_0)); // TODO: GH#18217
}
- function getGlobalExcludeSymbol() {
- return deferredGlobalExcludeSymbol || (deferredGlobalExcludeSymbol = getGlobalSymbol("Exclude", 524288 /* TypeAlias */, ts.Diagnostics.Cannot_find_global_type_0)); // TODO: GH#18217
- }
- function getGlobalPickSymbol() {
- return deferredGlobalPickSymbol || (deferredGlobalPickSymbol = getGlobalSymbol("Pick", 524288 /* TypeAlias */, ts.Diagnostics.Cannot_find_global_type_0)); // TODO: GH#18217
+ function getGlobalOmitSymbol() {
+ return deferredGlobalOmitSymbol || (deferredGlobalOmitSymbol = getGlobalSymbol("Omit", 524288 /* TypeAlias */, ts.Diagnostics.Cannot_find_global_type_0)); // TODO: GH#18217
}
function getGlobalBigIntType(reportErrors) {
return deferredGlobalBigIntType || (deferredGlobalBigIntType = getGlobalType("BigInt", /*arity*/ 0, reportErrors)) || emptyObjectType;
@@ -39510,7 +39911,7 @@
return links.resolvedType;
}
function isReadonlyTypeOperator(node) {
- return ts.isTypeOperatorNode(node) && node.operator === 133 /* ReadonlyKeyword */;
+ return ts.isTypeOperatorNode(node) && node.operator === 134 /* ReadonlyKeyword */;
}
// We represent tuple types as type references to synthesized generic interface types created by
// this function. The types are of the form:
@@ -39585,8 +39986,8 @@
var links = getNodeLinks(node);
if (!links.resolvedType) {
var lastElement = ts.lastOrUndefined(node.elementTypes);
- var restElement_1 = lastElement && lastElement.kind === 172 /* RestType */ ? lastElement : undefined;
- var minLength = ts.findLastIndex(node.elementTypes, function (n) { return n.kind !== 171 /* OptionalType */ && n !== restElement_1; }) + 1;
+ var restElement_1 = lastElement && lastElement.kind === 173 /* RestType */ ? lastElement : undefined;
+ var minLength = ts.findLastIndex(node.elementTypes, function (n) { return n.kind !== 172 /* OptionalType */ && n !== restElement_1; }) + 1;
var elementTypes = ts.map(node.elementTypes, function (n) {
var type = getTypeFromTypeNode(n);
return n === restElement_1 && getIndexTypeOfType(type, 1 /* Number */) || type;
@@ -39973,6 +40374,14 @@
types[index] = getUnionTypeFromSortedList(result, 65536 /* PrimitiveUnion */);
return true;
}
+ function createIntersectionType(types, aliasSymbol, aliasTypeArguments) {
+ var result = createType(2097152 /* Intersection */);
+ result.objectFlags = getPropagatingFlagsOfTypes(types, /*excludeKinds*/ 98304 /* Nullable */);
+ result.types = types;
+ result.aliasSymbol = aliasSymbol; // See comment in `getUnionTypeFromSortedList`.
+ result.aliasTypeArguments = aliasTypeArguments;
+ return result;
+ }
// We normalize combinations of intersection and union types based on the distributive property of the '&'
// operator. Specifically, because X & (A | B) is equivalent to X & A | X & B, we can transform intersection
// types with union type constituents into equivalent union types with intersection type constituents and
@@ -40010,30 +40419,36 @@
if (typeSet.length === 1) {
return typeSet[0];
}
+ var id = getTypeListId(typeSet);
+ var result = intersectionTypes.get(id);
+ if (!result) {
if (includes & 1048576 /* Union */) {
if (intersectUnionsOfPrimitiveTypes(typeSet)) {
// When the intersection creates a reduced set (which might mean that *all* union types have
// disappeared), we restart the operation to get a new set of combined flags. Once we have
// reduced we'll never reduce again, so this occurs at most once.
- return getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
+ result = getIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
}
+ else {
// We are attempting to construct a type of the form X & (A | B) & Y. Transform this into a type of
// the form X & A & Y | X & B & Y and recursively reduce until no union type constituents remain.
+ // If the estimated size of the resulting union type exceeds 100000 constituents, report an error.
+ var size = ts.reduceLeft(typeSet, function (n, t) { return n * (t.flags & 1048576 /* Union */ ? t.types.length : 1); }, 1);
+ if (size >= 100000) {
+ error(currentNode, ts.Diagnostics.Expression_produces_a_union_type_that_is_too_complex_to_represent);
+ return errorType;
+ }
var unionIndex_1 = ts.findIndex(typeSet, function (t) { return (t.flags & 1048576 /* Union */) !== 0; });
var unionType = typeSet[unionIndex_1];
- return getUnionType(ts.map(unionType.types, function (t) { return getIntersectionType(ts.replaceElement(typeSet, unionIndex_1, t)); }), 1 /* Literal */, aliasSymbol, aliasTypeArguments);
+ result = getUnionType(ts.map(unionType.types, function (t) { return getIntersectionType(ts.replaceElement(typeSet, unionIndex_1, t)); }), 1 /* Literal */, aliasSymbol, aliasTypeArguments);
}
- var id = getTypeListId(typeSet);
- var type = intersectionTypes.get(id);
- if (!type) {
- type = createType(2097152 /* Intersection */);
- intersectionTypes.set(id, type);
- type.objectFlags = getPropagatingFlagsOfTypes(typeSet, /*excludeKinds*/ 98304 /* Nullable */);
- type.types = typeSet;
- type.aliasSymbol = aliasSymbol; // See comment in `getUnionTypeFromSortedList`.
- type.aliasTypeArguments = aliasTypeArguments;
}
- return type;
+ else {
+ result = createIntersectionType(typeSet, aliasSymbol, aliasTypeArguments);
+ }
+ intersectionTypes.set(id, result);
+ }
+ return result;
}
function getTypeFromIntersectionTypeNode(node) {
var links = getNodeLinks(node);
@@ -40089,16 +40504,17 @@
var numberIndexInfo = getIndexInfoOfType(type, 1 /* Number */);
return numberIndexInfo !== enumNumberIndexInfo ? numberIndexInfo : undefined;
}
- function getIndexType(type, stringsOnly) {
+ function getIndexType(type, stringsOnly, noIndexSignatures) {
if (stringsOnly === void 0) { stringsOnly = keyofStringsOnly; }
- return type.flags & 1048576 /* Union */ ? getIntersectionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly); })) :
- type.flags & 2097152 /* Intersection */ ? getUnionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly); })) :
+ return type.flags & 1048576 /* Union */ ? getIntersectionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
+ type.flags & 2097152 /* Intersection */ ? getUnionType(ts.map(type.types, function (t) { return getIndexType(t, stringsOnly, noIndexSignatures); })) :
maybeTypeOfKind(type, 58982400 /* InstantiableNonPrimitive */) ? getIndexTypeForGenericType(type, stringsOnly) :
- ts.getObjectFlags(type) & 32 /* Mapped */ ? getConstraintTypeFromMappedType(type) :
+ ts.getObjectFlags(type) & 32 /* Mapped */ ? filterType(getConstraintTypeFromMappedType(type), function (t) { return !(noIndexSignatures && t.flags & (1 /* Any */ | 4 /* String */)); }) :
type === wildcardType ? wildcardType :
- type.flags & 1 /* Any */ ? keyofConstraintType :
- stringsOnly ? getIndexInfoOfType(type, 0 /* String */) ? stringType : getLiteralTypeFromProperties(type, 128 /* StringLiteral */) :
- getIndexInfoOfType(type, 0 /* String */) ? getUnionType([stringType, numberType, getLiteralTypeFromProperties(type, 8192 /* UniqueESSymbol */)]) :
+ type.flags & 2 /* Unknown */ ? neverType :
+ type.flags & (1 /* Any */ | 131072 /* Never */) ? keyofConstraintType :
+ stringsOnly ? !noIndexSignatures && getIndexInfoOfType(type, 0 /* String */) ? stringType : getLiteralTypeFromProperties(type, 128 /* StringLiteral */) :
+ !noIndexSignatures && getIndexInfoOfType(type, 0 /* String */) ? getUnionType([stringType, numberType, getLiteralTypeFromProperties(type, 8192 /* UniqueESSymbol */)]) :
getNonEnumNumberIndexInfo(type) ? getUnionType([numberType, getLiteralTypeFromProperties(type, 128 /* StringLiteral */ | 8192 /* UniqueESSymbol */)]) :
getLiteralTypeFromProperties(type, 8576 /* StringOrNumberLiteralOrUnique */);
}
@@ -40117,15 +40533,15 @@
var links = getNodeLinks(node);
if (!links.resolvedType) {
switch (node.operator) {
- case 129 /* KeyOfKeyword */:
+ case 130 /* KeyOfKeyword */:
links.resolvedType = getIndexType(getTypeFromTypeNode(node.type));
break;
- case 142 /* UniqueKeyword */:
- links.resolvedType = node.type.kind === 139 /* SymbolKeyword */
+ case 143 /* UniqueKeyword */:
+ links.resolvedType = node.type.kind === 140 /* SymbolKeyword */
? getESSymbolLikeTypeForNode(ts.walkUpParenthesizedTypes(node.parent))
: errorType;
break;
- case 133 /* ReadonlyKeyword */:
+ case 134 /* ReadonlyKeyword */:
links.resolvedType = getTypeFromTypeNode(node.type);
break;
}
@@ -40165,8 +40581,8 @@
}
return false;
}
- function getPropertyTypeForIndexType(objectType, indexType, accessNode, cacheSymbol, missingType) {
- var accessExpression = accessNode && accessNode.kind === 190 /* ElementAccessExpression */ ? accessNode : undefined;
+ function getPropertyTypeForIndexType(originalObjectType, objectType, indexType, fullIndexType, suppressNoImplicitAnyError, accessNode, accessFlags) {
+ var accessExpression = accessNode && accessNode.kind === 191 /* ElementAccessExpression */ ? accessNode : undefined;
var propName = isTypeUsableAsPropertyName(indexType) ?
getPropertyNameFromType(indexType) :
accessExpression && checkThatExpressionIsProperSymbolReference(accessExpression.argumentExpression, indexType, /*reportError*/ false) ?
@@ -40179,12 +40595,12 @@
var prop = getPropertyOfType(objectType, propName);
if (prop) {
if (accessExpression) {
- markPropertyAsReferenced(prop, accessExpression, /*isThisAccess*/ accessExpression.expression.kind === 100 /* ThisKeyword */);
+ markPropertyAsReferenced(prop, accessExpression, /*isThisAccess*/ accessExpression.expression.kind === 101 /* ThisKeyword */);
if (ts.isAssignmentTarget(accessExpression) && (isReferenceToReadonlyEntity(accessExpression, prop) || isReferenceThroughNamespaceImport(accessExpression))) {
error(accessExpression.argumentExpression, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, symbolToString(prop));
- return missingType;
+ return undefined;
}
- if (cacheSymbol) {
+ if (accessFlags & 4 /* CacheSymbol */) {
getNodeLinks(accessNode).resolvedSymbol = prop;
}
}
@@ -40203,6 +40619,7 @@
error(indexNode, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.unescapeLeadingUnderscores(propName), typeToString(objectType));
}
}
+ errorIfWritingToReadonlyIndex(getIndexInfoOfType(objectType, 1 /* Number */));
return mapType(objectType, function (t) { return getRestTypeOfTupleType(t) || undefinedType; });
}
}
@@ -40210,17 +40627,21 @@
if (objectType.flags & (1 /* Any */ | 131072 /* Never */)) {
return objectType;
}
- var indexInfo = isTypeAssignableToKind(indexType, 296 /* NumberLike */) && getIndexInfoOfType(objectType, 1 /* Number */) ||
- getIndexInfoOfType(objectType, 0 /* String */) ||
- undefined;
+ var stringIndexInfo = getIndexInfoOfType(objectType, 0 /* String */);
+ var indexInfo = isTypeAssignableToKind(indexType, 296 /* NumberLike */) && getIndexInfoOfType(objectType, 1 /* Number */) || stringIndexInfo;
if (indexInfo) {
+ if (accessFlags & 1 /* NoIndexSignatures */ && indexInfo === stringIndexInfo) {
+ if (accessExpression) {
+ error(accessExpression, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(originalObjectType));
+ }
+ return undefined;
+ }
if (accessNode && !isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
var indexNode = getIndexNodeForAccessExpression(accessNode);
error(indexNode, ts.Diagnostics.Type_0_cannot_be_used_as_an_index_type, typeToString(indexType));
+ return indexInfo.type;
}
- else if (accessExpression && indexInfo.isReadonly && (ts.isAssignmentTarget(accessExpression) || ts.isDeleteTarget(accessExpression))) {
- error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
- }
+ errorIfWritingToReadonlyIndex(indexInfo);
return indexInfo.type;
}
if (indexType.flags & 131072 /* Never */) {
@@ -40233,7 +40654,7 @@
if (objectType.symbol === globalThisSymbol && propName !== undefined && globalThisSymbol.exports.has(propName) && (globalThisSymbol.exports.get(propName).flags & 418 /* BlockScoped */)) {
error(accessExpression, ts.Diagnostics.Property_0_does_not_exist_on_type_1, ts.unescapeLeadingUnderscores(propName), typeToString(objectType));
}
- else if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors) {
+ else if (noImplicitAny && !compilerOptions.suppressImplicitAnyIndexErrors && !suppressNoImplicitAnyError) {
if (propName !== undefined && typeHasStaticProperty(propName, objectType)) {
error(accessExpression, ts.Diagnostics.Property_0_is_a_static_member_of_type_1, propName, typeToString(objectType));
}
@@ -40248,11 +40669,35 @@
}
}
else {
- error(accessExpression, ts.Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature, typeToString(objectType));
+ var suggestion_1 = getSuggestionForNonexistentIndexSignature(objectType, accessExpression);
+ if (suggestion_1 !== undefined) {
+ error(accessExpression, ts.Diagnostics.Element_implicitly_has_an_any_type_because_type_0_has_no_index_signature_Did_you_mean_to_call_1, typeToString(objectType), suggestion_1);
+ }
+ else {
+ var errorInfo = void 0;
+ if (indexType.flags & 1024 /* EnumLiteral */) {
+ errorInfo = ts.chainDiagnosticMessages(/* details */ undefined, ts.Diagnostics.Property_0_does_not_exist_on_type_1, "[" + typeToString(indexType) + "]", typeToString(objectType));
+ }
+ else if (indexType.flags & 8192 /* UniqueESSymbol */) {
+ var symbolName_2 = getFullyQualifiedName(indexType.symbol, accessExpression);
+ errorInfo = ts.chainDiagnosticMessages(/* details */ undefined, ts.Diagnostics.Property_0_does_not_exist_on_type_1, "[" + symbolName_2 + "]", typeToString(objectType));
+ }
+ else if (indexType.flags & 128 /* StringLiteral */) {
+ errorInfo = ts.chainDiagnosticMessages(/* details */ undefined, ts.Diagnostics.Property_0_does_not_exist_on_type_1, indexType.value, typeToString(objectType));
}
+ else if (indexType.flags & 256 /* NumberLiteral */) {
+ errorInfo = ts.chainDiagnosticMessages(/* details */ undefined, ts.Diagnostics.Property_0_does_not_exist_on_type_1, indexType.value, typeToString(objectType));
}
+ else if (indexType.flags & (8 /* Number */ | 4 /* String */)) {
+ errorInfo = ts.chainDiagnosticMessages(/* details */ undefined, ts.Diagnostics.No_index_signature_with_a_parameter_of_type_0_was_found_on_type_1, typeToString(indexType), typeToString(objectType));
}
- return missingType;
+ errorInfo = ts.chainDiagnosticMessages(errorInfo, ts.Diagnostics.Element_implicitly_has_an_any_type_because_expression_of_type_0_can_t_be_used_to_index_type_1, typeToString(fullIndexType), typeToString(objectType));
+ diagnostics.add(ts.createDiagnosticForNodeFromMessageChain(accessExpression, errorInfo));
+ }
+ }
+ }
+ }
+ return undefined;
}
}
if (isJSLiteralType(objectType)) {
@@ -40273,14 +40718,19 @@
if (isTypeAny(indexType)) {
return indexType;
}
- return missingType;
+ return undefined;
+ function errorIfWritingToReadonlyIndex(indexInfo) {
+ if (indexInfo && indexInfo.isReadonly && accessExpression && (ts.isAssignmentTarget(accessExpression) || ts.isDeleteTarget(accessExpression))) {
+ error(accessExpression, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
+ }
+ }
}
function getIndexNodeForAccessExpression(accessNode) {
- return accessNode.kind === 190 /* ElementAccessExpression */
+ return accessNode.kind === 191 /* ElementAccessExpression */
? accessNode.argumentExpression
- : accessNode.kind === 180 /* IndexedAccessType */
+ : accessNode.kind === 181 /* IndexedAccessType */
? accessNode.indexType
- : accessNode.kind === 149 /* ComputedPropertyName */
+ : accessNode.kind === 150 /* ComputedPropertyName */
? accessNode.expression
: accessNode;
}
@@ -40290,67 +40740,124 @@
function isGenericIndexType(type) {
return maybeTypeOfKind(type, 58982400 /* InstantiableNonPrimitive */ | 4194304 /* Index */);
}
- function getSimplifiedType(type) {
- return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type) : type;
+ function isThisTypeParameter(type) {
+ return !!(type.flags & 262144 /* TypeParameter */ && type.isThisType);
}
- function distributeIndexOverObjectType(objectType, indexType) {
- // (T | U)[K] -> T[K] | U[K]
- if (objectType.flags & 1048576 /* Union */) {
- return mapType(objectType, function (t) { return getSimplifiedType(getIndexedAccessType(t, indexType)); });
+ function getSimplifiedType(type, writing) {
+ return type.flags & 8388608 /* IndexedAccess */ ? getSimplifiedIndexedAccessType(type, writing) :
+ type.flags & 16777216 /* Conditional */ ? getSimplifiedConditionalType(type, writing) :
+ type;
}
+ function distributeIndexOverObjectType(objectType, indexType, writing) {
+ // (T | U)[K] -> T[K] | U[K] (reading)
+ // (T | U)[K] -> T[K] & U[K] (writing)
// (T & U)[K] -> T[K] & U[K]
- if (objectType.flags & 2097152 /* Intersection */) {
- return getIntersectionType(ts.map(objectType.types, function (t) { return getSimplifiedType(getIndexedAccessType(t, indexType)); }));
+ if (objectType.flags & 3145728 /* UnionOrIntersection */) {
+ var types = ts.map(objectType.types, function (t) { return getSimplifiedType(getIndexedAccessType(t, indexType), writing); });
+ return objectType.flags & 2097152 /* Intersection */ || writing ? getIntersectionType(types) : getUnionType(types);
+ }
+ }
+ function distributeObjectOverIndexType(objectType, indexType, writing) {
+ // T[A | B] -> T[A] | T[B] (reading)
+ // T[A | B] -> T[A] & T[B] (writing)
+ if (indexType.flags & 1048576 /* Union */) {
+ var types = ts.map(indexType.types, function (t) { return getSimplifiedType(getIndexedAccessType(objectType, t), writing); });
+ return writing ? getIntersectionType(types) : getUnionType(types);
}
}
// Transform an indexed access to a simpler form, if possible. Return the simpler form, or return
- // the type itself if no transformation is possible.
- function getSimplifiedIndexedAccessType(type) {
- if (type.simplified) {
- return type.simplified === circularConstraintType ? type : type.simplified;
+ // the type itself if no transformation is possible. The writing flag indicates that the type is
+ // the target of an assignment.
+ function getSimplifiedIndexedAccessType(type, writing) {
+ var cache = writing ? "simplifiedForWriting" : "simplifiedForReading";
+ if (type[cache]) {
+ return type[cache] === circularConstraintType ? type : type[cache];
}
- type.simplified = circularConstraintType;
+ type[cache] = circularConstraintType;
// We recursively simplify the object type as it may in turn be an indexed access type. For example, with
// '{ [P in T]: { [Q in U]: number } }[T][U]' we want to first simplify the inner indexed access type.
- var objectType = getSimplifiedType(type.objectType);
- var indexType = getSimplifiedType(type.indexType);
- // T[A | B] -> T[A] | T[B]
- if (indexType.flags & 1048576 /* Union */) {
- return type.simplified = mapType(indexType, function (t) { return getSimplifiedType(getIndexedAccessType(objectType, t)); });
+ var objectType = getSimplifiedType(type.objectType, writing);
+ var indexType = getSimplifiedType(type.indexType, writing);
+ // T[A | B] -> T[A] | T[B] (reading)
+ // T[A | B] -> T[A] & T[B] (writing)
+ var distributedOverIndex = distributeObjectOverIndexType(objectType, indexType, writing);
+ if (distributedOverIndex) {
+ return type[cache] = distributedOverIndex;
}
// Only do the inner distributions if the index can no longer be instantiated to cause index distribution again
if (!(indexType.flags & 63176704 /* Instantiable */)) {
- var simplified = distributeIndexOverObjectType(objectType, indexType);
- if (simplified) {
- return type.simplified = simplified;
+ // (T | U)[K] -> T[K] | U[K] (reading)
+ // (T | U)[K] -> T[K] & U[K] (writing)
+ // (T & U)[K] -> T[K] & U[K]
+ var distributedOverObject = distributeIndexOverObjectType(objectType, indexType, writing);
+ if (distributedOverObject) {
+ return type[cache] = distributedOverObject;
}
}
- // So ultimately:
+ // So ultimately (reading):
// ((A & B) | C)[K1 | K2] -> ((A & B) | C)[K1] | ((A & B) | C)[K2] -> (A & B)[K1] | C[K1] | (A & B)[K2] | C[K2] -> (A[K1] & B[K1]) | C[K1] | (A[K2] & B[K2]) | C[K2]
// If the object type is a mapped type { [P in K]: E }, where K is generic, instantiate E using a mapper
// that substitutes the index type for P. For example, for an index access { [P in K]: Box<T[P]> }[X], we
// construct the type Box<T[X]>.
if (isGenericMappedType(objectType)) {
- return type.simplified = mapType(substituteIndexedMappedType(objectType, type.indexType), getSimplifiedType);
+ return type[cache] = mapType(substituteIndexedMappedType(objectType, type.indexType), function (t) { return getSimplifiedType(t, writing); });
+ }
+ return type[cache] = type;
}
- return type.simplified = type;
+ function getSimplifiedConditionalType(type, writing) {
+ var checkType = type.checkType;
+ var extendsType = type.extendsType;
+ var trueType = getTrueTypeFromConditionalType(type);
+ var falseType = getFalseTypeFromConditionalType(type);
+ // Simplifications for types of the form `T extends U ? T : never` and `T extends U ? never : T`.
+ if (falseType.flags & 131072 /* Never */ && getActualTypeVariable(trueType) === getActualTypeVariable(checkType)) {
+ if (checkType.flags & 1 /* Any */ || isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { // Always true
+ return getSimplifiedType(trueType, writing);
+ }
+ else if (isIntersectionEmpty(checkType, extendsType)) { // Always false
+ return neverType;
+ }
+ }
+ else if (trueType.flags & 131072 /* Never */ && getActualTypeVariable(falseType) === getActualTypeVariable(checkType)) {
+ if (!(checkType.flags & 1 /* Any */) && isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { // Always true
+ return neverType;
+ }
+ else if (checkType.flags & 1 /* Any */ || isIntersectionEmpty(checkType, extendsType)) { // Always false
+ return getSimplifiedType(falseType, writing);
+ }
+ }
+ return type;
+ }
+ /**
+ * Invokes union simplification logic to determine if an intersection is considered empty as a union constituent
+ */
+ function isIntersectionEmpty(type1, type2) {
+ return !!(getUnionType([intersectTypes(type1, type2), neverType]).flags & 131072 /* Never */);
}
function substituteIndexedMappedType(objectType, index) {
var mapper = createTypeMapper([getTypeParameterFromMappedType(objectType)], [index]);
var templateMapper = combineTypeMappers(objectType.mapper, mapper);
return instantiateType(getTemplateTypeFromMappedType(objectType), templateMapper);
}
- function getIndexedAccessType(objectType, indexType, accessNode, missingType) {
- if (missingType === void 0) { missingType = accessNode ? errorType : unknownType; }
+ function getIndexedAccessType(objectType, indexType, accessNode) {
+ return getIndexedAccessTypeOrUndefined(objectType, indexType, accessNode, 0 /* None */) || (accessNode ? errorType : unknownType);
+ }
+ function getIndexedAccessTypeOrUndefined(objectType, indexType, accessNode, accessFlags) {
+ if (accessFlags === void 0) { accessFlags = 0 /* None */; }
if (objectType === wildcardType || indexType === wildcardType) {
return wildcardType;
}
+ // If the object type has a string index signature and no other members we know that the result will
+ // always be the type of that index signature and we can simplify accordingly.
+ if (isStringIndexSignatureOnlyType(objectType) && !(indexType.flags & 98304 /* Nullable */) && isTypeAssignableToKind(indexType, 4 /* String */ | 8 /* Number */)) {
+ indexType = stringType;
+ }
// If the index type is generic, or if the object type is generic and doesn't originate in an expression,
// we are performing a higher-order index access where we cannot meaningfully access the properties of the
// object type. Note that for a generic T and a non-generic K, we eagerly resolve T[K] if it originates in
// an expression. This is to preserve backwards compatibility. For example, an element access 'this["foo"]'
// has always been resolved eagerly using the constraint type of 'this' at the given location.
- if (isGenericIndexType(indexType) || !(accessNode && accessNode.kind !== 180 /* IndexedAccessType */) && isGenericObjectType(objectType)) {
+ if (isGenericIndexType(indexType) || !(accessNode && accessNode.kind !== 181 /* IndexedAccessType */) && isGenericObjectType(objectType)) {
if (objectType.flags & 3 /* AnyOrUnknown */) {
return objectType;
}
@@ -40371,25 +40878,25 @@
var wasMissingProp = false;
for (var _i = 0, _a = indexType.types; _i < _a.length; _i++) {
var t = _a[_i];
- var propType = getPropertyTypeForIndexType(apparentObjectType, t, accessNode, /*cacheSymbol*/ false, missingType);
- if (propType === missingType) {
- if (!accessNode) {
+ var propType = getPropertyTypeForIndexType(objectType, apparentObjectType, t, indexType, wasMissingProp, accessNode, accessFlags);
+ if (propType) {
+ propTypes.push(propType);
+ }
+ else if (!accessNode) {
// If there's no error node, we can immeditely stop, since error reporting is off
- return missingType;
+ return undefined;
}
else {
// Otherwise we set a flag and return at the end of the loop so we still mark all errors
wasMissingProp = true;
}
}
- propTypes.push(propType);
- }
if (wasMissingProp) {
- return missingType;
+ return undefined;
}
- return getUnionType(propTypes);
+ return accessFlags & 2 /* Writing */ ? getIntersectionType(propTypes) : getUnionType(propTypes);
}
- return getPropertyTypeForIndexType(apparentObjectType, indexType, accessNode, /*cacheSymbol*/ true, missingType);
+ return getPropertyTypeForIndexType(objectType, apparentObjectType, indexType, indexType, /* supressNoImplicitAnyError */ false, accessNode, accessFlags | 4 /* CacheSymbol */);
}
function getTypeFromIndexedAccessTypeNode(node) {
var links = getNodeLinks(node);
@@ -40419,13 +40926,14 @@
return links.resolvedType;
}
function getActualTypeVariable(type) {
- return type.flags & 33554432 /* Substitution */ ? type.typeVariable : type;
+ if (type.flags & 33554432 /* Substitution */) {
+ return type.typeVariable;
}
- /**
- * Invokes union simplification logic to determine if an intersection is considered empty as a union constituent
- */
- function isIntersectionEmpty(type1, type2) {
- return !!(getUnionType([intersectTypes(type1, type2), neverType]).flags & 131072 /* Never */);
+ if (type.flags & 8388608 /* IndexedAccess */ && (type.objectType.flags & 33554432 /* Substitution */ ||
+ type.indexType.flags & 33554432 /* Substitution */)) {
+ return getIndexedAccessType(getActualTypeVariable(type.objectType), getActualTypeVariable(type.indexType));
+ }
+ return type;
}
function getConditionalType(root, mapper) {
var checkType = instantiateType(root.checkType, mapper);
@@ -40433,35 +40941,6 @@
if (checkType === wildcardType || extendsType === wildcardType) {
return wildcardType;
}
- var trueType = instantiateType(root.trueType, mapper);
- var falseType = instantiateType(root.falseType, mapper);
- var instantiationId = "" + (root.isDistributive ? "d" : "") + getTypeId(checkType) + ">" + getTypeId(extendsType) + "?" + getTypeId(trueType) + ":" + getTypeId(falseType);
- var result = conditionalTypes.get(instantiationId);
- if (result) {
- return result;
- }
- var newResult = getConditionalTypeWorker(root, mapper, checkType, extendsType, trueType, falseType);
- conditionalTypes.set(instantiationId, newResult);
- return newResult;
- }
- function getConditionalTypeWorker(root, mapper, checkType, extendsType, trueType, falseType) {
- // Simplifications for types of the form `T extends U ? T : never` and `T extends U ? never : T`.
- if (falseType.flags & 131072 /* Never */ && getActualTypeVariable(trueType) === getActualTypeVariable(checkType)) {
- if (checkType.flags & 1 /* Any */ || isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { // Always true
- return trueType;
- }
- else if (isIntersectionEmpty(checkType, extendsType)) { // Always false
- return neverType;
- }
- }
- else if (trueType.flags & 131072 /* Never */ && getActualTypeVariable(falseType) === getActualTypeVariable(checkType)) {
- if (!(checkType.flags & 1 /* Any */) && isTypeAssignableTo(getRestrictiveInstantiation(checkType), getRestrictiveInstantiation(extendsType))) { // Always true
- return neverType;
- }
- else if (checkType.flags & 1 /* Any */ || isIntersectionEmpty(checkType, extendsType)) { // Always false
- return falseType;
- }
- }
var checkTypeInstantiable = maybeTypeOfKind(checkType, 63176704 /* Instantiable */ | 131072 /* GenericMappedType */);
var combinedMapper;
if (root.inferTypeParameters) {
@@ -40470,7 +40949,7 @@
// We don't want inferences from constraints as they may cause us to eagerly resolve the
// conditional type instead of deferring resolution. Also, we always want strict function
// types rules (i.e. proper contravariance) for inferences.
- inferTypes(context.inferences, checkType, extendsType, 32 /* NoConstraints */ | 64 /* AlwaysStrict */);
+ inferTypes(context.inferences, checkType, extendsType, 64 /* NoConstraints */ | 128 /* AlwaysStrict */);
}
combinedMapper = combineTypeMappers(mapper, context.mapper);
}
@@ -40479,18 +40958,18 @@
// We attempt to resolve the conditional type only when the check and extends types are non-generic
if (!checkTypeInstantiable && !maybeTypeOfKind(inferredExtendsType, 63176704 /* Instantiable */ | 131072 /* GenericMappedType */)) {
if (inferredExtendsType.flags & 3 /* AnyOrUnknown */) {
- return trueType;
+ return instantiateType(root.trueType, combinedMapper || mapper);
}
// Return union of trueType and falseType for 'any' since it matches anything
if (checkType.flags & 1 /* Any */) {
- return getUnionType([instantiateType(root.trueType, combinedMapper || mapper), falseType]);
+ return getUnionType([instantiateType(root.trueType, combinedMapper || mapper), instantiateType(root.falseType, mapper)]);
}
// Return falseType for a definitely false extends check. We check an instantiations of the two
// types with type parameters mapped to the wildcard type, the most permissive instantiations
// possible (the wildcard type is assignable to and from all types). If those are not related,
// then no instantiations will be and we can just return the false branch type.
if (!isTypeAssignableTo(getPermissiveInstantiation(checkType), getPermissiveInstantiation(inferredExtendsType))) {
- return falseType;
+ return instantiateType(root.falseType, mapper);
}
// Return trueType for a definitely true extends check. We check instantiations of the two
// types with type parameters mapped to their restrictive form, i.e. a form of the type parameter
@@ -40502,9 +40981,6 @@
}
}
// Return a deferred type for a check that is neither definitely true nor definitely false
- return getDeferredConditionalType(root, mapper, combinedMapper, checkType, extendsType, trueType, falseType);
- }
- function getDeferredConditionalType(root, mapper, combinedMapper, checkType, extendsType, trueType, falseType) {
var erasedCheckType = getActualTypeVariable(checkType);
var result = createType(16777216 /* Conditional */);
result.root = root;
@@ -40512,14 +40988,18 @@
result.extendsType = extendsType;
result.mapper = mapper;
result.combinedMapper = combinedMapper;
- result.trueType = trueType;
- result.falseType = falseType;
result.aliasSymbol = root.aliasSymbol;
result.aliasTypeArguments = instantiateTypes(root.aliasTypeArguments, mapper); // TODO: GH#18217
return result;
}
+ function getTrueTypeFromConditionalType(type) {
+ return type.resolvedTrueType || (type.resolvedTrueType = instantiateType(type.root.trueType, type.mapper));
+ }
+ function getFalseTypeFromConditionalType(type) {
+ return type.resolvedFalseType || (type.resolvedFalseType = instantiateType(type.root.falseType, type.mapper));
+ }
function getInferredTrueTypeFromConditionalType(type) {
- return type.resolvedInferredTrueType || (type.resolvedInferredTrueType = instantiateType(type.root.trueType, type.combinedMapper || type.mapper));
+ return type.resolvedInferredTrueType || (type.resolvedInferredTrueType = type.combinedMapper ? instantiateType(type.root.trueType, type.combinedMapper) : getTrueTypeFromConditionalType(type));
}
function getInferTypeParameters(node) {
var result;
@@ -40532,20 +41012,6 @@
}
return result;
}
- function isPossiblyReferencedInConditionalType(tp, node) {
- if (isTypeParameterPossiblyReferenced(tp, node)) {
- return true;
- }
- while (node) {
- if (node.kind === 175 /* ConditionalType */) {
- if (isTypeParameterPossiblyReferenced(tp, node.extendsType)) {
- return true;
- }
- }
- node = node.parent;
- }
- return false;
- }
function getTypeFromConditionalTypeNode(node) {
var links = getNodeLinks(node);
if (!links.resolvedType) {
@@ -40553,7 +41019,7 @@
var aliasSymbol = getAliasSymbolForTypeNode(node);
var aliasTypeArguments = getTypeArgumentsForAliasSymbol(aliasSymbol);
var allOuterTypeParameters = getOuterTypeParameters(node, /*includeThisTypes*/ true);
- var outerTypeParameters = aliasTypeArguments ? allOuterTypeParameters : ts.filter(allOuterTypeParameters, function (tp) { return isPossiblyReferencedInConditionalType(tp, node); });
+ var outerTypeParameters = aliasTypeArguments ? allOuterTypeParameters : ts.filter(allOuterTypeParameters, function (tp) { return isTypeParameterPossiblyReferenced(tp, node); });
var root = {
node: node,
checkType: checkType,
@@ -40864,9 +41330,9 @@
function getThisType(node) {
var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false);
var parent = container && container.parent;
- if (parent && (ts.isClassLike(parent) || parent.kind === 241 /* InterfaceDeclaration */)) {
+ if (parent && (ts.isClassLike(parent) || parent.kind === 242 /* InterfaceDeclaration */)) {
if (!ts.hasModifier(container, 32 /* Static */) &&
- (container.kind !== 157 /* Constructor */ || ts.isNodeDescendantOf(node, container.body))) {
+ (container.kind !== 158 /* Constructor */ || ts.isNodeDescendantOf(node, container.body))) {
return getDeclaredTypeOfClassOrInterface(getSymbolOfNode(parent)).thisType;
}
}
@@ -40882,89 +41348,89 @@
}
function getTypeFromTypeNode(node) {
switch (node.kind) {
- case 120 /* AnyKeyword */:
- case 289 /* JSDocAllType */:
- case 290 /* JSDocUnknownType */:
+ case 121 /* AnyKeyword */:
+ case 290 /* JSDocAllType */:
+ case 291 /* JSDocUnknownType */:
return anyType;
- case 143 /* UnknownKeyword */:
+ case 144 /* UnknownKeyword */:
return unknownType;
- case 138 /* StringKeyword */:
+ case 139 /* StringKeyword */:
return stringType;
- case 135 /* NumberKeyword */:
+ case 136 /* NumberKeyword */:
return numberType;
- case 146 /* BigIntKeyword */:
+ case 147 /* BigIntKeyword */:
return bigintType;
- case 123 /* BooleanKeyword */:
+ case 124 /* BooleanKeyword */:
return booleanType;
- case 139 /* SymbolKeyword */:
+ case 140 /* SymbolKeyword */:
return esSymbolType;
- case 106 /* VoidKeyword */:
+ case 107 /* VoidKeyword */:
return voidType;
- case 141 /* UndefinedKeyword */:
+ case 142 /* UndefinedKeyword */:
return undefinedType;
- case 96 /* NullKeyword */:
+ case 97 /* NullKeyword */:
return nullType;
- case 132 /* NeverKeyword */:
+ case 133 /* NeverKeyword */:
return neverType;
- case 136 /* ObjectKeyword */:
+ case 137 /* ObjectKeyword */:
return node.flags & 65536 /* JavaScriptFile */ ? anyType : nonPrimitiveType;
- case 178 /* ThisType */:
- case 100 /* ThisKeyword */:
+ case 179 /* ThisType */:
+ case 101 /* ThisKeyword */:
return getTypeFromThisTypeNode(node);
- case 182 /* LiteralType */:
+ case 183 /* LiteralType */:
return getTypeFromLiteralTypeNode(node);
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return getTypeFromTypeReference(node);
- case 163 /* TypePredicate */:
+ case 164 /* TypePredicate */:
return booleanType;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return getTypeFromTypeReference(node);
- case 167 /* TypeQuery */:
+ case 168 /* TypeQuery */:
return getTypeFromTypeQueryNode(node);
- case 169 /* ArrayType */:
+ case 170 /* ArrayType */:
return getTypeFromArrayTypeNode(node);
- case 170 /* TupleType */:
+ case 171 /* TupleType */:
return getTypeFromTupleTypeNode(node);
- case 171 /* OptionalType */:
+ case 172 /* OptionalType */:
return getTypeFromOptionalTypeNode(node);
- case 173 /* UnionType */:
+ case 174 /* UnionType */:
return getTypeFromUnionTypeNode(node);
- case 174 /* IntersectionType */:
+ case 175 /* IntersectionType */:
return getTypeFromIntersectionTypeNode(node);
- case 291 /* JSDocNullableType */:
+ case 292 /* JSDocNullableType */:
return getTypeFromJSDocNullableTypeNode(node);
- case 293 /* JSDocOptionalType */:
+ case 294 /* JSDocOptionalType */:
return addOptionality(getTypeFromTypeNode(node.type));
- case 177 /* ParenthesizedType */:
- case 172 /* RestType */:
- case 292 /* JSDocNonNullableType */:
- case 288 /* JSDocTypeExpression */:
+ case 178 /* ParenthesizedType */:
+ case 173 /* RestType */:
+ case 293 /* JSDocNonNullableType */:
+ case 289 /* JSDocTypeExpression */:
return getTypeFromTypeNode(node.type);
- case 295 /* JSDocVariadicType */:
+ case 296 /* JSDocVariadicType */:
return getTypeFromJSDocVariadicType(node);
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 168 /* TypeLiteral */:
- case 297 /* JSDocTypeLiteral */:
- case 294 /* JSDocFunctionType */:
- case 298 /* JSDocSignature */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 169 /* TypeLiteral */:
+ case 298 /* JSDocTypeLiteral */:
+ case 295 /* JSDocFunctionType */:
+ case 299 /* JSDocSignature */:
return getTypeFromTypeLiteralOrFunctionOrConstructorTypeNode(node);
- case 179 /* TypeOperator */:
+ case 180 /* TypeOperator */:
return getTypeFromTypeOperatorNode(node);
- case 180 /* IndexedAccessType */:
+ case 181 /* IndexedAccessType */:
return getTypeFromIndexedAccessTypeNode(node);
- case 181 /* MappedType */:
+ case 182 /* MappedType */:
return getTypeFromMappedTypeNode(node);
- case 175 /* ConditionalType */:
+ case 176 /* ConditionalType */:
return getTypeFromConditionalTypeNode(node);
- case 176 /* InferType */:
+ case 177 /* InferType */:
return getTypeFromInferTypeNode(node);
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return getTypeFromImportTypeNode(node);
// This function assumes that an identifier or qualified name is a type expression
// Callers should first ensure this by calling isTypeNode
- case 72 /* Identifier */:
- case 148 /* QualifiedName */:
+ case 73 /* Identifier */:
+ case 149 /* QualifiedName */:
var symbol = getSymbolAtLocation(node);
return symbol ? getDeclaredTypeOfSymbol(symbol) : errorType;
default:
@@ -41024,7 +41490,7 @@
* This is used during inference when instantiating type parameter defaults.
*/
function createBackreferenceMapper(context, index) {
- return function (t) { return ts.findIndex(context.inferences, function (info) { return info.typeParameter === t; }) >= index ? emptyObjectType : t; };
+ return function (t) { return ts.findIndex(context.inferences, function (info) { return info.typeParameter === t; }) >= index ? unknownType : t; };
}
function combineTypeMappers(mapper1, mapper2) {
if (!mapper1)
@@ -41107,7 +41573,7 @@
}
// Keep the flags from the symbol we're instantiating. Mark that is instantiated, and
// also transient so that we can just store data on it directly.
- var result = createSymbol(symbol.flags, symbol.escapedName, 1 /* Instantiated */ | ts.getCheckFlags(symbol) & (8 /* Readonly */ | 2048 /* Late */ | 8192 /* OptionalParameter */ | 16384 /* RestParameter */));
+ var result = createSymbol(symbol.flags, symbol.escapedName, 1 /* Instantiated */ | ts.getCheckFlags(symbol) & (8 /* Readonly */ | 4096 /* Late */ | 16384 /* OptionalParameter */ | 32768 /* RestParameter */));
result.declarations = symbol.declarations;
result.parent = symbol.parent;
result.target = symbol;
@@ -41173,28 +41639,31 @@
return type;
}
function maybeTypeParameterReference(node) {
- return !(node.kind === 148 /* QualifiedName */ ||
- node.parent.kind === 164 /* TypeReference */ && node.parent.typeArguments && node === node.parent.typeName);
+ return !(node.kind === 149 /* QualifiedName */ ||
+ node.parent.kind === 165 /* TypeReference */ && node.parent.typeArguments && node === node.parent.typeName);
}
function isTypeParameterPossiblyReferenced(tp, node) {
// If the type parameter doesn't have exactly one declaration, if there are invening statement blocks
// between the node and the type parameter declaration, if the node contains actual references to the
// type parameter, or if the node contains type queries, we consider the type parameter possibly referenced.
if (tp.symbol && tp.symbol.declarations && tp.symbol.declarations.length === 1) {
- var container_3 = tp.symbol.declarations[0].parent;
- if (ts.findAncestor(node, function (n) { return n.kind === 218 /* Block */ ? "quit" : n === container_3; })) {
- return !!ts.forEachChild(node, containsReference);
+ var container = tp.symbol.declarations[0].parent;
+ for (var n = node; n !== container; n = n.parent) {
+ if (!n || n.kind === 219 /* Block */ || n.kind === 176 /* ConditionalType */ && ts.forEachChild(n.extendsType, containsReference)) {
+ return true;
+ }
}
+ return !!ts.forEachChild(node, containsReference);
}
return true;
function containsReference(node) {
switch (node.kind) {
- case 178 /* ThisType */:
+ case 179 /* ThisType */:
return !!tp.isThisType;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return !tp.isThisType && ts.isPartOfTypeNode(node) && maybeTypeParameterReference(node) &&
getTypeFromTypeNode(node) === tp;
- case 167 /* TypeQuery */:
+ case 168 /* TypeQuery */:
return true;
}
return !!ts.forEachChild(node, containsReference);
@@ -41342,7 +41811,7 @@
// If the anonymous type originates in a declaration of a function, method, class, or
// interface, in an object type literal, or in an object literal expression, we may need
// to instantiate the type because it might reference a type parameter.
- return type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations ?
+ return couldContainTypeVariables(type) ?
getAnonymousTypeInstantiation(type, mapper) : type;
}
if (objectFlags & 32 /* Mapped */) {
@@ -41381,7 +41850,7 @@
}
else {
var sub = instantiateType(type.substitute, mapper);
- if (sub.flags & 3 /* AnyOrUnknown */ || isTypeSubtypeOf(getRestrictiveInstantiation(maybeVariable), getRestrictiveInstantiation(sub))) {
+ if (sub.flags & 3 /* AnyOrUnknown */ || isTypeAssignableTo(getRestrictiveInstantiation(maybeVariable), getRestrictiveInstantiation(sub))) {
return maybeVariable;
}
return sub;
@@ -41415,34 +41884,34 @@
// Returns true if the given expression contains (at any level of nesting) a function or arrow expression
// that is subject to contextual typing.
function isContextSensitive(node) {
- ts.Debug.assert(node.kind !== 156 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
+ ts.Debug.assert(node.kind !== 157 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
switch (node.kind) {
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 156 /* MethodDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
return isContextSensitiveFunctionLikeDeclaration(node);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return ts.some(node.properties, isContextSensitive);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return ts.some(node.elements, isContextSensitive);
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return isContextSensitive(node.whenTrue) ||
isContextSensitive(node.whenFalse);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return node.operatorToken.kind === 55 /* BarBarToken */ &&
(isContextSensitive(node.left) || isContextSensitive(node.right));
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return isContextSensitive(node.initializer);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return isContextSensitive(node.expression);
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
return ts.some(node.properties, isContextSensitive) || ts.isJsxOpeningElement(node.parent) && ts.some(node.parent.parent.children, isContextSensitive);
- case 267 /* JsxAttribute */: {
+ case 268 /* JsxAttribute */: {
// If there is no initializer, JSX attribute has a boolean value of true which is not context sensitive.
var initializer = node.initializer;
return !!initializer && isContextSensitive(initializer);
}
- case 270 /* JsxExpression */: {
+ case 271 /* JsxExpression */: {
// It is possible to that node.expression is undefined (e.g <div x={} />)
var expression = node.expression;
return !!expression && isContextSensitive(expression);
@@ -41459,7 +41928,7 @@
if (ts.some(node.parameters, function (p) { return !ts.getEffectiveTypeAnnotationNode(p); })) {
return true;
}
- if (node.kind !== 197 /* ArrowFunction */) {
+ if (node.kind !== 198 /* ArrowFunction */) {
// If the first parameter is not an explicit 'this' parameter, then the function has
// an implicit 'this' parameter which is subject to contextual typing.
var parameter = ts.firstOrUndefined(node.parameters);
@@ -41471,7 +41940,7 @@
}
function hasContextSensitiveReturnExpression(node) {
// TODO(anhans): A block should be context-sensitive if it has a context-sensitive return value.
- return !!node.body && node.body.kind !== 218 /* Block */ && isContextSensitive(node.body);
+ return !!node.body && node.body.kind !== 219 /* Block */ && isContextSensitive(node.body);
}
function isContextSensitiveFunctionOrObjectLiteralMethod(func) {
return (ts.isInJSFile(func) && ts.isFunctionDeclaration(func) || isFunctionExpressionOrArrowFunction(func) || ts.isObjectLiteralMethod(func)) &&
@@ -41524,7 +41993,7 @@
function isTypeDerivedFrom(source, target) {
return source.flags & 1048576 /* Union */ ? ts.every(source.types, function (t) { return isTypeDerivedFrom(t, target); }) :
target.flags & 1048576 /* Union */ ? ts.some(target.types, function (t) { return isTypeDerivedFrom(source, t); }) :
- source.flags & 58982400 /* InstantiableNonPrimitive */ ? isTypeDerivedFrom(getBaseConstraintOfType(source) || emptyObjectType, target) :
+ source.flags & 58982400 /* InstantiableNonPrimitive */ ? isTypeDerivedFrom(getBaseConstraintOfType(source) || unknownType, target) :
target === globalObjectType ? !!(source.flags & (524288 /* Object */ | 67108864 /* NonPrimitive */)) :
target === globalFunctionType ? !!(source.flags & 524288 /* Object */) && isFunctionObjectType(source) :
hasBaseType(source, getTargetType(target));
@@ -41573,23 +42042,23 @@
return true;
}
switch (node.kind) {
- case 270 /* JsxExpression */:
- case 195 /* ParenthesizedExpression */:
+ case 271 /* JsxExpression */:
+ case 196 /* ParenthesizedExpression */:
return elaborateError(node.expression, source, target, relation, headMessage);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
switch (node.operatorToken.kind) {
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
case 27 /* CommaToken */:
return elaborateError(node.right, source, target, relation, headMessage);
}
break;
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return elaborateObjectLiteral(node, source, target, relation);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return elaborateArrayLiteral(node, source, target, relation);
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
return elaborateJsxComponents(node, source, target, relation);
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return elaborateArrowFunction(node, source, target, relation);
}
return false;
@@ -41658,11 +42127,11 @@
var reportedError = false;
for (var status = iterator.next(); !status.done; status = iterator.next()) {
var _a = status.value, prop = _a.errorNode, next = _a.innerExpression, nameType = _a.nameType, errorMessage = _a.errorMessage;
- var targetPropType = getIndexedAccessType(target, nameType, /*accessNode*/ undefined, errorType);
- if (targetPropType === errorType || targetPropType.flags & 8388608 /* IndexedAccess */)
+ var targetPropType = getIndexedAccessTypeOrUndefined(target, nameType);
+ if (!targetPropType || targetPropType.flags & 8388608 /* IndexedAccess */)
continue; // Don't elaborate on indexes on generic variables
- var sourcePropType = getIndexedAccessType(source, nameType, /*accessNode*/ undefined, errorType);
- if (sourcePropType !== errorType && targetPropType !== errorType && !checkTypeRelatedTo(sourcePropType, targetPropType, relation, /*errorNode*/ undefined)) {
+ var sourcePropType = getIndexedAccessTypeOrUndefined(source, nameType);
+ if (sourcePropType && !checkTypeRelatedTo(sourcePropType, targetPropType, relation, /*errorNode*/ undefined)) {
var elaborated = next && elaborateError(next, sourcePropType, targetPropType, relation, /*headMessage*/ undefined);
if (elaborated) {
reportedError = true;
@@ -41761,7 +42230,7 @@
}
function getElaborationElementForJsxChild(child, nameType, getInvalidTextDiagnostic) {
switch (child.kind) {
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
// child is of the type of the expression
return { errorNode: child, innerExpression: child.expression, nameType: nameType };
case 11 /* JsxText */:
@@ -41770,15 +42239,18 @@
}
// child is a string
return { errorNode: child, innerExpression: undefined, nameType: nameType, errorMessage: getInvalidTextDiagnostic() };
- case 260 /* JsxElement */:
- case 261 /* JsxSelfClosingElement */:
- case 264 /* JsxFragment */:
+ case 261 /* JsxElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 265 /* JsxFragment */:
// child is of type JSX.Element
return { errorNode: child, innerExpression: child, nameType: nameType };
default:
return ts.Debug.assertNever(child, "Found invalid jsx child");
}
}
+ function getSemanticJsxChildren(children) {
+ return ts.filter(children, function (i) { return !ts.isJsxText(i) || !i.containsOnlyTriviaWhiteSpaces; });
+ }
function elaborateJsxComponents(node, source, target, relation) {
var result = elaborateElementwise(generateJsxAttributes(node), source, target, relation);
var invalidTextDiagnostic;
@@ -41788,7 +42260,7 @@
var childrenPropName = childPropName === undefined ? "children" : ts.unescapeLeadingUnderscores(childPropName);
var childrenNameType = getLiteralType(childrenPropName);
var childrenTargetType = getIndexedAccessType(target, childrenNameType);
- var validChildren = ts.filter(containingElement.children, function (i) { return !ts.isJsxText(i) || !i.containsOnlyTriviaWhiteSpaces; });
+ var validChildren = getSemanticJsxChildren(containingElement.children);
if (!ts.length(validChildren)) {
return result;
}
@@ -41872,6 +42344,8 @@
});
}
function elaborateArrayLiteral(node, source, target, relation) {
+ if (target.flags & 131068 /* Primitive */)
+ return false;
if (isTupleLikeType(source)) {
return elaborateElementwise(generateLimitedTupleElements(node, target), source, target, relation);
}
@@ -41902,11 +42376,11 @@
}
_b = prop.kind;
switch (_b) {
- case 159 /* SetAccessor */: return [3 /*break*/, 2];
- case 158 /* GetAccessor */: return [3 /*break*/, 2];
- case 156 /* MethodDeclaration */: return [3 /*break*/, 2];
- case 276 /* ShorthandPropertyAssignment */: return [3 /*break*/, 2];
- case 275 /* PropertyAssignment */: return [3 /*break*/, 4];
+ case 160 /* SetAccessor */: return [3 /*break*/, 2];
+ case 159 /* GetAccessor */: return [3 /*break*/, 2];
+ case 157 /* MethodDeclaration */: return [3 /*break*/, 2];
+ case 277 /* ShorthandPropertyAssignment */: return [3 /*break*/, 2];
+ case 276 /* PropertyAssignment */: return [3 /*break*/, 4];
}
return [3 /*break*/, 6];
case 2: return [4 /*yield*/, { errorNode: prop.name, innerExpression: undefined, nameType: type }];
@@ -41928,6 +42402,8 @@
});
}
function elaborateObjectLiteral(node, source, target, relation) {
+ if (target.flags & 131068 /* Primitive */)
+ return false;
return elaborateElementwise(generateObjectLiteralElements(node), source, target, relation);
}
/**
@@ -41976,8 +42452,8 @@
return 0 /* False */;
}
var kind = target.declaration ? target.declaration.kind : 0 /* Unknown */;
- var strictVariance = !callbackCheck && strictFunctionTypes && kind !== 156 /* MethodDeclaration */ &&
- kind !== 155 /* MethodSignature */ && kind !== 157 /* Constructor */;
+ var strictVariance = !callbackCheck && strictFunctionTypes && kind !== 157 /* MethodDeclaration */ &&
+ kind !== 156 /* MethodSignature */ && kind !== 158 /* Constructor */;
var result = -1 /* True */;
var sourceThisType = getThisTypeOfSignature(source);
if (sourceThisType && sourceThisType !== voidType) {
@@ -42025,12 +42501,14 @@
result &= related;
}
if (!ignoreReturnTypes) {
- var targetReturnType = (target.declaration && isJSConstructor(target.declaration)) ?
+ // If a signature reolution is already in-flight, skip issuing a circularity error
+ // here and just use the `any` type directly
+ var targetReturnType = isResolvingReturnTypeOfSignature(target) ? anyType : (target.declaration && isJSConstructor(target.declaration)) ?
getJSClassType(target.declaration.symbol) : getReturnTypeOfSignature(target);
if (targetReturnType === voidType) {
return result;
}
- var sourceReturnType = (source.declaration && isJSConstructor(source.declaration)) ?
+ var sourceReturnType = isResolvingReturnTypeOfSignature(source) ? anyType : (source.declaration && isJSConstructor(source.declaration)) ?
getJSClassType(source.declaration.symbol) : getReturnTypeOfSignature(source);
// The following block preserves behavior forbidding boolean returning functions from being assignable to type guard returning functions
var targetTypePredicate = getTypePredicateOfSignature(target);
@@ -42109,6 +42587,11 @@
function isEmptyAnonymousObjectType(type) {
return !!(ts.getObjectFlags(type) & 16 /* Anonymous */) && isEmptyObjectType(type);
}
+ function isStringIndexSignatureOnlyType(type) {
+ return type.flags & 524288 /* Object */ && !isGenericMappedType(type) && getPropertiesOfType(type).length === 0 && getIndexInfoOfType(type, 0 /* String */) && !getIndexInfoOfType(type, 1 /* Number */) ||
+ type.flags & 3145728 /* UnionOrIntersection */ && ts.every(type.types, isStringIndexSignatureOnlyType) ||
+ false;
+ }
function isEnumTypeRelatedTo(sourceSymbol, targetSymbol, errorReporter) {
if (sourceSymbol === targetSymbol) {
return true;
@@ -42217,8 +42700,8 @@
}
return false;
}
- function isIgnoredJsxProperty(source, sourceProp, targetMemberType) {
- return ts.getObjectFlags(source) & 4096 /* JsxAttributes */ && !(isUnhyphenatedJsxName(sourceProp.escapedName) || targetMemberType);
+ function isIgnoredJsxProperty(source, sourceProp) {
+ return ts.getObjectFlags(source) & 4096 /* JsxAttributes */ && !isUnhyphenatedJsxName(sourceProp.escapedName);
}
/**
* Checks if 'source' is related to 'target' (e.g.: is a assignable to).
@@ -42240,7 +42723,7 @@
var depth = 0;
var expandingFlags = 0 /* None */;
var overflow = false;
- var suppressNextError = false;
+ var overrideNextErrorInfo;
ts.Debug.assert(relation !== identityRelation || !errorNode, "no error reporting in identity checking");
var result = isRelatedTo(source, target, /*reportErrors*/ !!errorNode, headMessage);
if (overflow) {
@@ -42248,9 +42731,9 @@
}
else if (errorInfo) {
if (containingMessageChain) {
- var chain_1 = containingMessageChain();
- if (chain_1) {
- errorInfo = ts.concatenateDiagnosticMessageChains(chain_1, errorInfo);
+ var chain = containingMessageChain();
+ if (chain) {
+ errorInfo = ts.concatenateDiagnosticMessageChains(chain, errorInfo);
}
}
var relatedInformation = void 0;
@@ -42290,11 +42773,9 @@
}
}
function reportRelationError(message, source, target) {
- var sourceType = typeToString(source);
- var targetType = typeToString(target);
- if (sourceType === targetType) {
- sourceType = typeToString(source, /*enclosingDeclaration*/ undefined, 64 /* UseFullyQualifiedType */);
- targetType = typeToString(target, /*enclosingDeclaration*/ undefined, 64 /* UseFullyQualifiedType */);
+ var _a = getTypeNamesForErrorDisplay(source, target), sourceType = _a[0], targetType = _a[1];
+ if (target.flags & 262144 /* TypeParameter */ && target.immediateBaseConstraint !== undefined && isTypeAssignableTo(source, target.immediateBaseConstraint)) {
+ reportError(ts.Diagnostics._0_is_assignable_to_the_constraint_of_type_1_but_1_could_be_instantiated_with_a_different_subtype_of_constraint_2, sourceType, targetType, typeToString(target.immediateBaseConstraint));
}
if (!message) {
if (relation === comparableRelation) {
@@ -42319,25 +42800,39 @@
reportError(ts.Diagnostics._0_is_a_primitive_but_1_is_a_wrapper_object_Prefer_using_0_when_possible, targetType, sourceType);
}
}
- function isUnionOrIntersectionTypeWithoutNullableConstituents(type) {
- if (!(type.flags & 3145728 /* UnionOrIntersection */)) {
+ /**
+ * Try and elaborate array and tuple errors. Returns false
+ * if we have found an elaboration, or we should ignore
+ * any other elaborations when relating the `source` and
+ * `target` types.
+ *
+ * @param source
+ * @param target
+ * @param reportErrors
+ */
+ function tryElaborateArrayLikeErrors(source, target, reportErrors) {
+ if (isTupleLikeType(source)) {
+ var sourceTuple = source.target;
+ if (sourceTuple && sourceTuple.readonly && isArrayOrTupleLikeType(target) &&
+ (!isReadonlyArrayType(target) || isTupleType(target) && !target.target.readonly)) {
+ if (reportErrors) {
+ reportError(ts.Diagnostics.The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1, typeToString(source), typeToString(target));
+ }
return false;
}
- // at this point we know that this is union or intersection type possibly with nullable constituents.
- // check if we still will have compound type if we ignore nullable components.
- var seenNonNullable = false;
- for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
- var t = _a[_i];
- if (t.flags & 98304 /* Nullable */) {
- continue;
+ return isArrayLikeType(target);
}
- if (seenNonNullable) {
- return true;
+ if (isTupleLikeType(target)) {
+ return isArrayLikeType(source);
}
- seenNonNullable = true;
+ if (isReadonlyArrayType(source) && isArrayType(target) && !isReadonlyArrayType(target)) {
+ if (reportErrors) {
+ reportError(ts.Diagnostics.The_type_0_is_readonly_and_cannot_be_assigned_to_the_mutable_type_1, typeToString(source), typeToString(target));
}
return false;
}
+ return true;
+ }
/**
* Compare two types and return
* * Ternary.True if they are related with no assumptions,
@@ -42358,11 +42853,11 @@
if (target.flags & 33554432 /* Substitution */) {
target = target.typeVariable;
}
- if (source.flags & 8388608 /* IndexedAccess */) {
- source = getSimplifiedType(source);
+ if (source.flags & 25165824 /* Simplifiable */) {
+ source = getSimplifiedType(source, /*writing*/ false);
}
- if (target.flags & 8388608 /* IndexedAccess */) {
- target = getSimplifiedType(target);
+ if (target.flags & 25165824 /* Simplifiable */) {
+ target = getSimplifiedType(target, /*writing*/ true);
}
// Try to see if we're relating something like `Foo` -> `Bar | null | undefined`.
// If so, reporting the `null` and `undefined` in the type is hardly useful.
@@ -42390,7 +42885,8 @@
isSimpleTypeRelatedTo(source, target, relation, reportErrors ? reportError : undefined))
return -1 /* True */;
var isComparingJsxAttributes = !!(ts.getObjectFlags(source) & 4096 /* JsxAttributes */);
- if (isObjectLiteralType(source) && ts.getObjectFlags(source) & 32768 /* FreshLiteral */) {
+ var isPerformingExcessPropertyChecks = (isObjectLiteralType(source) && ts.getObjectFlags(source) & 32768 /* FreshLiteral */);
+ if (isPerformingExcessPropertyChecks) {
var discriminantType = target.flags & 1048576 /* Union */ ? findMatchingDiscriminantType(source, target) : undefined;
if (hasExcessProperties(source, target, discriminantType, reportErrors)) {
if (reportErrors) {
@@ -42398,13 +42894,6 @@
}
return 0 /* False */;
}
- // Above we check for excess properties with respect to the entire target type. When union
- // and intersection types are further deconstructed on the target side, we don't want to
- // make the check again (as it might fail for a partial target type). Therefore we obtain
- // the regular source type and proceed with that.
- if (isUnionOrIntersectionTypeWithoutNullableConstituents(target) && !discriminantType) {
- source = getRegularTypeOfObjectLiteral(source);
- }
}
if (relation !== comparableRelation && !isApparentIntersectionConstituent &&
source.flags & (131068 /* Primitive */ | 524288 /* Object */ | 2097152 /* Intersection */) && source !== globalObjectType &&
@@ -42437,11 +42926,24 @@
}
else {
if (target.flags & 1048576 /* Union */) {
- result = typeRelatedToSomeType(source, target, reportErrors && !(source.flags & 131068 /* Primitive */) && !(target.flags & 131068 /* Primitive */));
+ result = typeRelatedToSomeType(getRegularTypeOfObjectLiteral(source), target, reportErrors && !(source.flags & 131068 /* Primitive */) && !(target.flags & 131068 /* Primitive */));
+ if (result && isPerformingExcessPropertyChecks) {
+ // Validate against excess props using the original `source`
+ var discriminantType = target.flags & 1048576 /* Union */ ? findMatchingDiscriminantType(source, target) : undefined;
+ if (!propertiesRelatedTo(source, discriminantType || target, reportErrors, /*excludedProperties*/ undefined)) {
+ return 0 /* False */;
+ }
+ }
}
else if (target.flags & 2097152 /* Intersection */) {
isIntersectionConstituent = true; // set here to affect the following trio of checks
- result = typeRelatedToEachType(source, target, reportErrors);
+ result = typeRelatedToEachType(getRegularTypeOfObjectLiteral(source), target, reportErrors);
+ if (result && isPerformingExcessPropertyChecks) {
+ // Validate against excess props using the original `source`
+ if (!propertiesRelatedTo(source, target, reportErrors, /*excludedProperties*/ undefined)) {
+ return 0 /* False */;
+ }
+ }
}
else if (source.flags & 2097152 /* Intersection */) {
// Check to see if any constituents of the intersection are immediately related to the target.
@@ -42483,8 +42985,15 @@
}
}
if (!result && reportErrors) {
- var maybeSuppress = suppressNextError;
- suppressNextError = false;
+ var maybeSuppress = overrideNextErrorInfo;
+ overrideNextErrorInfo = undefined;
+ if (source.flags & 524288 /* Object */ && target.flags & 524288 /* Object */) {
+ var currentError = errorInfo;
+ tryElaborateArrayLikeErrors(source, target, reportErrors);
+ if (errorInfo !== currentError) {
+ maybeSuppress = errorInfo;
+ }
+ }
if (source.flags & 524288 /* Object */ && target.flags & 131068 /* Primitive */) {
tryElaborateErrorsForPrimitivesAndObjects(source, target);
}
@@ -42579,7 +43088,7 @@
return { value: true };
}
};
- for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) {
+ for (var _i = 0, _a = getPropertiesOfType(source); _i < _a.length; _i++) {
var prop = _a[_i];
var state_3 = _loop_7(prop);
if (typeof state_3 === "object")
@@ -42686,8 +43195,8 @@
}
// Keep this up-to-date with the same logic within `getApparentTypeOfContextualType`, since they should behave similarly
function findMatchingDiscriminantType(source, target) {
- if (target.flags & 1048576 /* Union */) {
- var sourceProperties = getPropertiesOfObjectType(source);
+ if (target.flags & 1048576 /* Union */ && source.flags & (2097152 /* Intersection */ | 524288 /* Object */)) {
+ var sourceProperties = getPropertiesOfType(source);
if (sourceProperties) {
var sourcePropertiesFiltered = findDiscriminantProperties(sourceProperties, target);
if (sourcePropertiesFiltered) {
@@ -42750,13 +43259,20 @@
// When variance information isn't available we default to covariance. This happens
// in the process of computing variance information for recursive types and when
// comparing 'this' type arguments.
- var variance = i < variances.length ? variances[i] : 1 /* Covariant */;
+ var varianceFlags = i < variances.length ? variances[i] : 1 /* Covariant */;
+ var variance = varianceFlags & 7 /* VarianceMask */;
// We ignore arguments for independent type parameters (because they're never witnessed).
if (variance !== 4 /* Independent */) {
var s = sources[i];
var t = targets[i];
var related = -1 /* True */;
- if (variance === 1 /* Covariant */) {
+ if (varianceFlags & 8 /* Unmeasurable */) {
+ // Even an `Unmeasurable` variance works out without a structural check if the source and target are _identical_.
+ // We can't simply assume invariance, because `Unmeasurable` marks nonlinear relations, for example, a relation tained by
+ // the `-?` modifier in a mapped type (where, no matter how the inputs are related, the outputs still might not be)
+ related = relation === identityRelation ? isRelatedTo(s, t, /*reportErrors*/ false) : compareTypesIdentical(s, t);
+ }
+ else if (variance === 1 /* Covariant */) {
related = isRelatedTo(s, t, reportErrors);
}
else if (variance === 2 /* Contravariant */) {
@@ -42875,8 +43391,8 @@
if (source.root.isDistributive === target.root.isDistributive) {
if (result_3 = isRelatedTo(source.checkType, target.checkType, /*reportErrors*/ false)) {
if (result_3 &= isRelatedTo(source.extendsType, target.extendsType, /*reportErrors*/ false)) {
- if (result_3 &= isRelatedTo(source.trueType, target.trueType, /*reportErrors*/ false)) {
- if (result_3 &= isRelatedTo(source.falseType, target.falseType, /*reportErrors*/ false)) {
+ if (result_3 &= isRelatedTo(getTrueTypeFromConditionalType(source), getTrueTypeFromConditionalType(target), /*reportErrors*/ false)) {
+ if (result_3 &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), /*reportErrors*/ false)) {
return result_3;
}
}
@@ -42926,8 +43442,7 @@
}
// A type S is assignable to keyof T if S is assignable to keyof C, where C is the
// simplified form of T or, if T doesn't simplify, the constraint of T.
- var simplified = getSimplifiedType(target.type);
- var constraint = simplified !== target.type ? simplified : getConstraintOfType(target.type);
+ var constraint = getSimplifiedTypeOrConstraint(target.type);
if (constraint) {
// We require Ternary.True here such that circular constraints don't cause
// false positives. For example, given 'T extends { [K in keyof T]: string }',
@@ -42939,13 +43454,17 @@
}
}
else if (target.flags & 8388608 /* IndexedAccess */) {
- // A type S is related to a type T[K], where T and K aren't both type variables, if S is related to C,
- // where C is the base constraint of T[K]
- if (relation !== identityRelation &&
- !(isGenericObjectType(target.objectType) && isGenericIndexType(target.indexType))) {
- var constraint = getBaseConstraintOfType(target);
- if (constraint && constraint !== target) {
- if (result = isRelatedTo(source, constraint, reportErrors)) {
+ // A type S is related to a type T[K] if S is related to C, where C is the base
+ // constraint of T[K] for writing.
+ if (relation !== identityRelation) {
+ var objectType = target.objectType;
+ var indexType = target.indexType;
+ var baseObjectType = getBaseConstraintOfType(objectType) || objectType;
+ var baseIndexType = getBaseConstraintOfType(indexType) || indexType;
+ if (!isGenericObjectType(baseObjectType) && !isGenericIndexType(baseIndexType)) {
+ var accessFlags = 2 /* Writing */ | (baseObjectType !== objectType ? 1 /* NoIndexSignatures */ : 0);
+ var constraint = getIndexedAccessTypeOrUndefined(baseObjectType, baseIndexType, /*accessNode*/ undefined, accessFlags);
+ if (constraint && (result = isRelatedTo(source, constraint, reportErrors))) {
return result;
}
}
@@ -42962,7 +43481,7 @@
}
if (!isGenericMappedType(source)) {
var targetConstraint = getConstraintTypeFromMappedType(target);
- var sourceKeys_1 = getIndexType(source);
+ var sourceKeys_1 = getIndexType(source, /*stringsOnly*/ undefined, /*noIndexSignatures*/ true);
var hasOptionalUnionKeys = modifiers & 4 /* IncludeOptional */ && targetConstraint.flags & 1048576 /* Union */;
var filteredByApplicability = hasOptionalUnionKeys ? filterType(targetConstraint, function (t) { return !!isRelatedTo(t, sourceKeys_1); }) : undefined;
// A source type T is related to a target type { [P in Q]: X } if Q is related to keyof T and T[Q] is related to X.
@@ -42993,6 +43512,7 @@
return result;
}
}
+ else {
var constraint = getConstraintOfType(source);
if (!constraint || (source.flags & 262144 /* TypeParameter */ && constraint.flags & 1 /* Any */)) {
// A type variable with no constraint is not related to the non-primitive object type.
@@ -43012,6 +43532,7 @@
return result;
}
}
+ }
else if (source.flags & 4194304 /* Index */) {
if (result = isRelatedTo(keyofConstraintType, target, reportErrors)) {
errorInfo = saveErrorInfo;
@@ -43025,8 +43546,8 @@
// and Y1 is related to Y2.
if (isTypeIdenticalTo(source.extendsType, target.extendsType) &&
(isRelatedTo(source.checkType, target.checkType) || isRelatedTo(target.checkType, source.checkType))) {
- if (result = isRelatedTo(source.trueType, target.trueType, reportErrors)) {
- result &= isRelatedTo(source.falseType, target.falseType, reportErrors);
+ if (result = isRelatedTo(getTrueTypeFromConditionalType(source), getTrueTypeFromConditionalType(target), reportErrors)) {
+ result &= isRelatedTo(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target), reportErrors);
}
if (result) {
errorInfo = saveErrorInfo;
@@ -43096,7 +43617,7 @@
if (source.flags & (524288 /* Object */ | 2097152 /* Intersection */) && target.flags & 524288 /* Object */) {
// Report structural errors only if we haven't reported any errors yet
var reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo && !sourceIsPrimitive;
- result = propertiesRelatedTo(source, target, reportStructuralErrors);
+ result = propertiesRelatedTo(source, target, reportStructuralErrors, /*excludedProperties*/ undefined);
if (result) {
result &= signaturesRelatedTo(source, target, 0 /* Call */, reportStructuralErrors);
if (result) {
@@ -43116,22 +43637,35 @@
return result;
}
}
+ // If S is an object type and T is a discriminated union, S may be related to T if
+ // there exists a constituent of T for every combination of the discriminants of S
+ // with respect to T. We do not report errors here, as we will use the existing
+ // error result from checking each constituent of the union.
+ if (source.flags & (524288 /* Object */ | 2097152 /* Intersection */) && target.flags & 1048576 /* Union */) {
+ var objectOnlyTarget = extractTypesOfKind(target, 524288 /* Object */);
+ if (objectOnlyTarget.flags & 1048576 /* Union */) {
+ var result_4 = typeRelatedToDiscriminatedType(source, objectOnlyTarget);
+ if (result_4) {
+ return result_4;
+ }
}
- return 0 /* False */;
- function isNonGeneric(type) {
- // If we're already in identity relationship checking, we should use `isRelatedTo`
- // to catch the `Maybe` from an excessively deep type (which we then assume means
- // that the type could possibly contain a generic)
- if (relation === identityRelation) {
- return isRelatedTo(type, getPermissiveInstantiation(type)) === -1 /* True */;
}
- return isTypeIdenticalTo(type, getPermissiveInstantiation(type));
}
+ return 0 /* False */;
function relateVariances(sourceTypeArguments, targetTypeArguments, variances) {
if (result = typeArgumentsRelatedTo(sourceTypeArguments, targetTypeArguments, variances, reportErrors)) {
return result;
}
- var allowStructuralFallback = (targetTypeArguments && hasCovariantVoidArgument(targetTypeArguments, variances)) || isNonGeneric(source) || isNonGeneric(target);
+ if (ts.some(variances, function (v) { return !!(v & 24 /* AllowsStructuralFallback */); })) {
+ // If some type parameter was `Unmeasurable` or `Unreliable`, and we couldn't pass by assuming it was identical, then we
+ // have to allow a structural fallback check
+ // We elide the variance-based error elaborations, since those might not be too helpful, since we'll potentially
+ // be assuming identity of the type parameter.
+ originalErrorInfo = undefined;
+ errorInfo = saveErrorInfo;
+ return undefined;
+ }
+ var allowStructuralFallback = targetTypeArguments && hasCovariantVoidArgument(targetTypeArguments, variances);
varianceCheckFailed = !allowStructuralFallback;
// The type arguments did not relate appropriately, but it may be because we have no variance
// information (in which case typeArgumentsRelatedTo defaulted to covariance for all type
@@ -43149,7 +43683,7 @@
// reveal the reason).
// We can switch on `reportErrors` here, since varianceCheckFailed guarantees we return `False`,
// we can return `False` early here to skip calculating the structural error message we don't need.
- if (varianceCheckFailed && !(reportErrors && ts.some(variances, function (v) { return v === 0 /* Invariant */; }))) {
+ if (varianceCheckFailed && !(reportErrors && ts.some(variances, function (v) { return (v & 7 /* VarianceMask */) === 0 /* Invariant */; }))) {
return 0 /* False */;
}
// We remember the original error information so we can restore it in case the structural
@@ -43160,6 +43694,18 @@
}
}
}
+ function reportUnmeasurableMarkers(p) {
+ if (outofbandVarianceMarkerHandler && (p === markerSuperType || p === markerSubType || p === markerOtherType)) {
+ outofbandVarianceMarkerHandler(/*onlyUnreliable*/ false);
+ }
+ return p;
+ }
+ function reportUnreliableMarkers(p) {
+ if (outofbandVarianceMarkerHandler && (p === markerSuperType || p === markerSubType || p === markerOtherType)) {
+ outofbandVarianceMarkerHandler(/*onlyUnreliable*/ true);
+ }
+ return p;
+ }
// A type [P in S]: X is related to a type [Q in T]: Y if T is related to S and X' is
// related to Y, where X' is an instantiation of X in which P is replaced with Q. Notice
// that S and T are contra-variant whereas X and Y are co-variant.
@@ -43167,99 +43713,185 @@
var modifiersRelated = relation === comparableRelation || (relation === identityRelation ? getMappedTypeModifiers(source) === getMappedTypeModifiers(target) :
getCombinedMappedTypeOptionality(source) <= getCombinedMappedTypeOptionality(target));
if (modifiersRelated) {
- var result_4;
- if (result_4 = isRelatedTo(getConstraintTypeFromMappedType(target), getConstraintTypeFromMappedType(source), reportErrors)) {
+ var result_5;
+ var targetConstraint = getConstraintTypeFromMappedType(target);
+ var sourceConstraint = instantiateType(getConstraintTypeFromMappedType(source), getCombinedMappedTypeOptionality(source) < 0 ? reportUnmeasurableMarkers : reportUnreliableMarkers);
+ if (result_5 = isRelatedTo(targetConstraint, sourceConstraint, reportErrors)) {
var mapper = createTypeMapper([getTypeParameterFromMappedType(source)], [getTypeParameterFromMappedType(target)]);
- return result_4 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), reportErrors);
+ return result_5 & isRelatedTo(instantiateType(getTemplateTypeFromMappedType(source), mapper), getTemplateTypeFromMappedType(target), reportErrors);
}
}
return 0 /* False */;
}
- function propertiesRelatedTo(source, target, reportErrors) {
- if (relation === identityRelation) {
- return propertiesIdenticalTo(source, target);
+ function typeRelatedToDiscriminatedType(source, target) {
+ // 1. Generate the combinations of discriminant properties & types 'source' can satisfy.
+ // a. If the number of combinations is above a set limit, the comparison is too complex.
+ // 2. Filter 'target' to the subset of types whose discriminants exist in the matrix.
+ // a. If 'target' does not satisfy all discriminants in the matrix, 'source' is not related.
+ // 3. For each type in the filtered 'target', determine if all non-discriminant properties of
+ // 'target' are related to a property in 'source'.
+ //
+ // NOTE: See ~/tests/cases/conformance/types/typeRelationships/assignmentCompatibility/assignmentCompatWithDiscriminatedUnion.ts
+ // for examples.
+ var sourceProperties = getPropertiesOfObjectType(source);
+ var sourcePropertiesFiltered = findDiscriminantProperties(sourceProperties, target);
+ if (!sourcePropertiesFiltered)
+ return 0 /* False */;
+ // Though we could compute the number of combinations as we generate
+ // the matrix, this would incur additional memory overhead due to
+ // array allocations. To reduce this overhead, we first compute
+ // the number of combinations to ensure we will not surpass our
+ // fixed limit before incurring the cost of any allocations:
+ var numCombinations = 1;
+ for (var _i = 0, sourcePropertiesFiltered_1 = sourcePropertiesFiltered; _i < sourcePropertiesFiltered_1.length; _i++) {
+ var sourceProperty = sourcePropertiesFiltered_1[_i];
+ numCombinations *= countTypes(getTypeOfSymbol(sourceProperty));
+ if (numCombinations > 25) {
+ // We've reached the complexity limit.
+ return 0 /* False */;
}
- var requireOptionalProperties = relation === subtypeRelation && !isObjectLiteralType(source) && !isEmptyArrayLiteralType(source) && !isTupleType(source);
- var unmatchedProperty = getUnmatchedProperty(source, target, requireOptionalProperties, /*matchDiscriminantProperties*/ false);
- if (unmatchedProperty) {
- if (reportErrors) {
- var props = ts.arrayFrom(getUnmatchedProperties(source, target, requireOptionalProperties, /*matchDiscriminantProperties*/ false));
- if (!headMessage || (headMessage.code !== ts.Diagnostics.Class_0_incorrectly_implements_interface_1.code &&
- headMessage.code !== ts.Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass.code)) {
- suppressNextError = true; // Retain top-level error for interface implementing issues, otherwise omit it
}
- if (props.length === 1) {
- var propName = symbolToString(unmatchedProperty);
- reportError(ts.Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2, propName, typeToString(source), typeToString(target));
- if (ts.length(unmatchedProperty.declarations)) {
- associateRelatedInfo(ts.createDiagnosticForNode(unmatchedProperty.declarations[0], ts.Diagnostics._0_is_declared_here, propName));
+ // Compute the set of types for each discriminant property.
+ var sourceDiscriminantTypes = new Array(sourcePropertiesFiltered.length);
+ var excludedProperties = ts.createUnderscoreEscapedMap();
+ for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
+ var sourceProperty = sourcePropertiesFiltered[i];
+ var sourcePropertyType = getTypeOfSymbol(sourceProperty);
+ sourceDiscriminantTypes[i] = sourcePropertyType.flags & 1048576 /* Union */
+ ? sourcePropertyType.types
+ : [sourcePropertyType];
+ excludedProperties.set(sourceProperty.escapedName, true);
+ }
+ // Match each combination of the cartesian product of discriminant properties to one or more
+ // constituents of 'target'. If any combination does not have a match then 'source' is not relatable.
+ var discriminantCombinations = ts.cartesianProduct(sourceDiscriminantTypes);
+ var matchingTypes = [];
+ var _loop_8 = function (combination) {
+ var hasMatch = false;
+ outer: for (var _i = 0, _a = target.types; _i < _a.length; _i++) {
+ var type = _a[_i];
+ var _loop_9 = function (i) {
+ var sourceProperty = sourcePropertiesFiltered[i];
+ var targetProperty = getPropertyOfObjectType(type, sourceProperty.escapedName);
+ if (!targetProperty)
+ return "continue-outer";
+ if (sourceProperty === targetProperty)
+ return "continue";
+ // We compare the source property to the target in the context of a single discriminant type.
+ var related = propertyRelatedTo(source, target, sourceProperty, targetProperty, function (_) { return combination[i]; }, /*reportErrors*/ false);
+ // If the target property could not be found, or if the properties were not related,
+ // then this constituent is not a match.
+ if (!related) {
+ return "continue-outer";
}
+ };
+ for (var i = 0; i < sourcePropertiesFiltered.length; i++) {
+ var state_5 = _loop_9(i);
+ switch (state_5) {
+ case "continue-outer": continue outer;
}
- else if (props.length > 5) { // arbitrary cutoff for too-long list form
- reportError(ts.Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2_and_3_more, typeToString(source), typeToString(target), ts.map(props.slice(0, 4), function (p) { return symbolToString(p); }).join(", "), props.length - 4);
}
- else {
- reportError(ts.Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2, typeToString(source), typeToString(target), ts.map(props, function (p) { return symbolToString(p); }).join(", "));
+ ts.pushIfUnique(matchingTypes, type, ts.equateValues);
+ hasMatch = true;
}
+ if (!hasMatch) {
+ return { value: 0 /* False */ };
}
- return 0 /* False */;
+ };
+ for (var _a = 0, discriminantCombinations_1 = discriminantCombinations; _a < discriminantCombinations_1.length; _a++) {
+ var combination = discriminantCombinations_1[_a];
+ var state_4 = _loop_8(combination);
+ if (typeof state_4 === "object")
+ return state_4.value;
}
- if (isObjectLiteralType(target)) {
- for (var _i = 0, _a = getPropertiesOfType(source); _i < _a.length; _i++) {
- var sourceProp = _a[_i];
- if (!getPropertyOfObjectType(target, sourceProp.escapedName)) {
- var sourceType = getTypeOfSymbol(sourceProp);
- if (!(sourceType === undefinedType || sourceType === undefinedWideningType)) {
- if (reportErrors) {
- reportError(ts.Diagnostics.Property_0_does_not_exist_on_type_1, symbolToString(sourceProp), typeToString(target));
+ // Compare the remaining non-discriminant properties of each match.
+ var result = -1 /* True */;
+ for (var _b = 0, matchingTypes_1 = matchingTypes; _b < matchingTypes_1.length; _b++) {
+ var type = matchingTypes_1[_b];
+ result &= propertiesRelatedTo(source, type, /*reportErrors*/ false, excludedProperties);
+ if (result) {
+ result &= signaturesRelatedTo(source, type, 0 /* Call */, /*reportStructuralErrors*/ false);
+ if (result) {
+ result &= signaturesRelatedTo(source, type, 1 /* Construct */, /*reportStructuralErrors*/ false);
+ if (result) {
+ result &= indexTypesRelatedTo(source, type, 0 /* String */, /*sourceIsPrimitive*/ false, /*reportStructuralErrors*/ false);
+ if (result) {
+ result &= indexTypesRelatedTo(source, type, 1 /* Number */, /*sourceIsPrimitive*/ false, /*reportStructuralErrors*/ false);
}
- return 0 /* False */;
}
}
}
+ if (!result) {
+ return result;
}
- var result = -1 /* True */;
- if (isTupleType(target)) {
- var targetRestType = getRestTypeOfTupleType(target);
- if (targetRestType) {
- if (!isTupleType(source)) {
- return 0 /* False */;
}
- var sourceRestType = getRestTypeOfTupleType(source);
- if (sourceRestType && !isRelatedTo(sourceRestType, targetRestType, reportErrors)) {
- if (reportErrors) {
- reportError(ts.Diagnostics.Rest_signatures_are_incompatible);
+ return result;
}
- return 0 /* False */;
+ function excludeProperties(properties, excludedProperties) {
+ if (!excludedProperties || properties.length === 0)
+ return properties;
+ var result;
+ for (var i = 0; i < properties.length; i++) {
+ if (!excludedProperties.has(properties[i].escapedName)) {
+ if (result) {
+ result.push(properties[i]);
}
- var targetCount = getTypeReferenceArity(target) - 1;
- var sourceCount = getTypeReferenceArity(source) - (sourceRestType ? 1 : 0);
- for (var i = targetCount; i < sourceCount; i++) {
- var related = isRelatedTo(source.typeArguments[i], targetRestType, reportErrors);
+ }
+ else if (!result) {
+ result = properties.slice(0, i);
+ }
+ }
+ return result || properties;
+ }
+ function isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors) {
+ var targetIsOptional = strictNullChecks && !!(ts.getCheckFlags(targetProp) & 48 /* Partial */);
+ var source = getTypeOfSourceProperty(sourceProp);
+ if (ts.getCheckFlags(targetProp) & 65536 /* DeferredType */ && !getSymbolLinks(targetProp).type) {
+ // Rather than resolving (and normalizing) the type, relate constituent-by-constituent without performing normalization or seconadary passes
+ var links = getSymbolLinks(targetProp);
+ ts.Debug.assertDefined(links.deferralParent);
+ ts.Debug.assertDefined(links.deferralConstituents);
+ var unionParent = !!(links.deferralParent.flags & 1048576 /* Union */);
+ var result_6 = unionParent ? 0 /* False */ : -1 /* True */;
+ var targetTypes = links.deferralConstituents;
+ for (var _i = 0, targetTypes_3 = targetTypes; _i < targetTypes_3.length; _i++) {
+ var targetType = targetTypes_3[_i];
+ var related = isRelatedTo(source, targetType, /*reportErrors*/ false, /*headMessage*/ undefined, /*isIntersectionConstituent*/ !unionParent);
+ if (!unionParent) {
if (!related) {
- if (reportErrors) {
- reportError(ts.Diagnostics.Property_0_is_incompatible_with_rest_element_type, "" + i);
+ // Can't assign to a target individually - have to fallback to assigning to the _whole_ intersection (which forces normalization)
+ return isRelatedTo(source, addOptionality(getTypeOfSymbol(targetProp), targetIsOptional), reportErrors);
}
- return 0 /* False */;
+ result_6 &= related;
}
- result &= related;
+ else {
+ if (related) {
+ return related;
}
}
}
- var properties = getPropertiesOfObjectType(target);
- for (var _b = 0, properties_2 = properties; _b < properties_2.length; _b++) {
- var targetProp = properties_2[_b];
- if (!(targetProp.flags & 4194304 /* Prototype */)) {
- var sourceProp = getPropertyOfType(source, targetProp.escapedName);
- if (sourceProp && sourceProp !== targetProp) {
- if (isIgnoredJsxProperty(source, sourceProp, getTypeOfSymbol(targetProp))) {
- continue;
+ if (unionParent && !result_6 && targetIsOptional) {
+ result_6 = isRelatedTo(source, undefinedType);
+ }
+ if (unionParent && !result_6 && reportErrors) {
+ // The easiest way to get the right errors here is to un-defer (which may be costly)
+ // If it turns out this is too costly too often, we can replicate the error handling logic within
+ // typeRelatedToSomeType without the discriminatable type branch (as that requires a manifest union
+ // type on which to hand discriminable properties, which we are expressly trying to avoid here)
+ return isRelatedTo(source, addOptionality(getTypeOfSymbol(targetProp), targetIsOptional), reportErrors);
+ }
+ return result_6;
+ }
+ else {
+ return isRelatedTo(source, addOptionality(getTypeOfSymbol(targetProp), targetIsOptional), reportErrors);
+ }
}
+ function propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSourceProperty, reportErrors) {
var sourcePropFlags = ts.getDeclarationModifierFlagsFromSymbol(sourceProp);
var targetPropFlags = ts.getDeclarationModifierFlagsFromSymbol(targetProp);
if (sourcePropFlags & 8 /* Private */ || targetPropFlags & 8 /* Private */) {
var hasDifferingDeclarations = sourceProp.valueDeclaration !== targetProp.valueDeclaration;
- if (ts.getCheckFlags(sourceProp) & 512 /* ContainsPrivate */ && hasDifferingDeclarations) {
+ if (ts.getCheckFlags(sourceProp) & 1024 /* ContainsPrivate */ && hasDifferingDeclarations) {
if (reportErrors) {
reportError(ts.Diagnostics.Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1, symbolToString(sourceProp), typeToString(source));
}
@@ -43291,14 +43923,14 @@
}
return 0 /* False */;
}
- var related = isRelatedTo(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp), reportErrors);
+ // If the target comes from a partial union prop, allow `undefined` in the target type
+ var related = isPropertySymbolTypeRelated(sourceProp, targetProp, getTypeOfSourceProperty, reportErrors);
if (!related) {
if (reportErrors) {
reportError(ts.Diagnostics.Types_of_property_0_are_incompatible, symbolToString(targetProp));
}
return 0 /* False */;
}
- result &= related;
// When checking for comparability, be more lenient with optional properties.
if (relation !== comparableRelation && sourceProp.flags & 16777216 /* Optional */ && !(targetProp.flags & 16777216 /* Optional */)) {
// TypeScript 1.0 spec (April 2014): 3.8.3
@@ -43313,17 +43945,113 @@
}
return 0 /* False */;
}
+ return related;
+ }
+ function propertiesRelatedTo(source, target, reportErrors, excludedProperties) {
+ if (relation === identityRelation) {
+ return propertiesIdenticalTo(source, target, excludedProperties);
+ }
+ var requireOptionalProperties = relation === subtypeRelation && !isObjectLiteralType(source) && !isEmptyArrayLiteralType(source) && !isTupleType(source);
+ var unmatchedProperty = getUnmatchedProperty(source, target, requireOptionalProperties, /*matchDiscriminantProperties*/ false);
+ if (unmatchedProperty) {
+ if (reportErrors) {
+ var props = ts.arrayFrom(getUnmatchedProperties(source, target, requireOptionalProperties, /*matchDiscriminantProperties*/ false));
+ var shouldSkipElaboration = false;
+ if (!headMessage || (headMessage.code !== ts.Diagnostics.Class_0_incorrectly_implements_interface_1.code &&
+ headMessage.code !== ts.Diagnostics.Class_0_incorrectly_implements_class_1_Did_you_mean_to_extend_1_and_inherit_its_members_as_a_subclass.code)) {
+ shouldSkipElaboration = true; // Retain top-level error for interface implementing issues, otherwise omit it
+ }
+ if (props.length === 1) {
+ var propName = symbolToString(unmatchedProperty);
+ reportError.apply(void 0, [ts.Diagnostics.Property_0_is_missing_in_type_1_but_required_in_type_2, propName].concat(getTypeNamesForErrorDisplay(source, target)));
+ if (ts.length(unmatchedProperty.declarations)) {
+ associateRelatedInfo(ts.createDiagnosticForNode(unmatchedProperty.declarations[0], ts.Diagnostics._0_is_declared_here, propName));
+ }
+ if (shouldSkipElaboration) {
+ overrideNextErrorInfo = errorInfo;
+ }
+ }
+ else if (tryElaborateArrayLikeErrors(source, target, /*reportErrors*/ false)) {
+ if (props.length > 5) { // arbitrary cutoff for too-long list form
+ reportError(ts.Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2_and_3_more, typeToString(source), typeToString(target), ts.map(props.slice(0, 4), function (p) { return symbolToString(p); }).join(", "), props.length - 4);
+ }
+ else {
+ reportError(ts.Diagnostics.Type_0_is_missing_the_following_properties_from_type_1_Colon_2, typeToString(source), typeToString(target), ts.map(props, function (p) { return symbolToString(p); }).join(", "));
+ }
+ if (shouldSkipElaboration) {
+ overrideNextErrorInfo = errorInfo;
+ }
+ }
+ // ELSE: No array like or unmatched property error - just issue top level error (errorInfo = undefined)
+ }
+ return 0 /* False */;
+ }
+ if (isObjectLiteralType(target)) {
+ for (var _i = 0, _a = excludeProperties(getPropertiesOfType(source), excludedProperties); _i < _a.length; _i++) {
+ var sourceProp = _a[_i];
+ if (!getPropertyOfObjectType(target, sourceProp.escapedName)) {
+ var sourceType = getTypeOfSymbol(sourceProp);
+ if (!(sourceType === undefinedType || sourceType === undefinedWideningType)) {
+ if (reportErrors) {
+ reportError(ts.Diagnostics.Property_0_does_not_exist_on_type_1, symbolToString(sourceProp), typeToString(target));
+ }
+ return 0 /* False */;
+ }
+ }
+ }
+ }
+ var result = -1 /* True */;
+ if (isTupleType(target)) {
+ var targetRestType = getRestTypeOfTupleType(target);
+ if (targetRestType) {
+ if (!isTupleType(source)) {
+ return 0 /* False */;
+ }
+ var sourceRestType = getRestTypeOfTupleType(source);
+ if (sourceRestType && !isRelatedTo(sourceRestType, targetRestType, reportErrors)) {
+ if (reportErrors) {
+ reportError(ts.Diagnostics.Rest_signatures_are_incompatible);
+ }
+ return 0 /* False */;
+ }
+ var targetCount = getTypeReferenceArity(target) - 1;
+ var sourceCount = getTypeReferenceArity(source) - (sourceRestType ? 1 : 0);
+ for (var i = targetCount; i < sourceCount; i++) {
+ var related = isRelatedTo(source.typeArguments[i], targetRestType, reportErrors);
+ if (!related) {
+ if (reportErrors) {
+ reportError(ts.Diagnostics.Property_0_is_incompatible_with_rest_element_type, "" + i);
+ }
+ return 0 /* False */;
+ }
+ result &= related;
+ }
+ }
+ }
+ // We only call this for union target types when we're attempting to do excess property checking - in those cases, we want to get _all possible props_
+ // from the target union, across all members
+ var properties = target.flags & 1048576 /* Union */ ? getPossiblePropertiesOfUnionType(target) : getPropertiesOfType(target);
+ for (var _b = 0, _c = excludeProperties(properties, excludedProperties); _b < _c.length; _b++) {
+ var targetProp = _c[_b];
+ if (!(targetProp.flags & 4194304 /* Prototype */)) {
+ var sourceProp = getPropertyOfType(source, targetProp.escapedName);
+ if (sourceProp && sourceProp !== targetProp) {
+ var related = propertyRelatedTo(source, target, sourceProp, targetProp, getTypeOfSymbol, reportErrors);
+ if (!related) {
+ return 0 /* False */;
+ }
+ result &= related;
}
}
}
return result;
}
- function propertiesIdenticalTo(source, target) {
+ function propertiesIdenticalTo(source, target, excludedProperties) {
if (!(source.flags & 524288 /* Object */ && target.flags & 524288 /* Object */)) {
return 0 /* False */;
}
- var sourceProperties = getPropertiesOfObjectType(source);
- var targetProperties = getPropertiesOfObjectType(target);
+ var sourceProperties = excludeProperties(getPropertiesOfObjectType(source), excludedProperties);
+ var targetProperties = excludeProperties(getPropertiesOfObjectType(target), excludedProperties);
if (sourceProperties.length !== targetProperties.length) {
return 0 /* False */;
}
@@ -43443,7 +44171,7 @@
var result = -1 /* True */;
for (var _i = 0, _a = getPropertiesOfObjectType(source); _i < _a.length; _i++) {
var prop = _a[_i];
- if (isIgnoredJsxProperty(source, prop, /*targetMemberType*/ undefined)) {
+ if (isIgnoredJsxProperty(source, prop)) {
continue;
}
// Skip over symbol-named members
@@ -43475,7 +44203,7 @@
return indexTypesIdenticalTo(source, target, kind);
}
var targetInfo = getIndexInfoOfType(target, kind);
- if (!targetInfo || targetInfo.type.flags & 3 /* AnyOrUnknown */ && !sourceIsPrimitive) {
+ if (!targetInfo || targetInfo.type.flags & 1 /* Any */ && !sourceIsPrimitive) {
// Index signature of type any permits assignment from everything but primitives
return -1 /* True */;
}
@@ -43615,8 +44343,11 @@
// The emptyArray singleton is used to signal a recursive invocation.
cache.variances = ts.emptyArray;
variances = [];
- for (var _i = 0, typeParameters_1 = typeParameters; _i < typeParameters_1.length; _i++) {
- var tp = typeParameters_1[_i];
+ var _loop_10 = function (tp) {
+ var unmeasurable = false;
+ var unreliable = false;
+ var oldHandler = outofbandVarianceMarkerHandler;
+ outofbandVarianceMarkerHandler = function (onlyUnreliable) { return onlyUnreliable ? unreliable = true : unmeasurable = true; };
// We first compare instantiations where the type parameter is replaced with
// marker types that have a known subtype relationship. From this we can infer
// invariance, covariance, contravariance or bivariance.
@@ -43631,7 +44362,26 @@
if (variance === 3 /* Bivariant */ && isTypeAssignableTo(createMarkerType(cache, tp, markerOtherType), typeWithSuper)) {
variance = 4 /* Independent */;
}
+ outofbandVarianceMarkerHandler = oldHandler;
+ if (unmeasurable || unreliable) {
+ if (unmeasurable) {
+ variance |= 8 /* Unmeasurable */;
+ }
+ if (unreliable) {
+ variance |= 16 /* Unreliable */;
+ }
+ var covariantID = getRelationKey(typeWithSub, typeWithSuper, assignableRelation);
+ var contravariantID = getRelationKey(typeWithSuper, typeWithSub, assignableRelation);
+ // We delete the results of these checks, as we want them to actually be run, see the `Unmeasurable` variance we cache,
+ // And then fall back to a structural result.
+ assignableRelation.delete(covariantID);
+ assignableRelation.delete(contravariantID);
+ }
variances.push(variance);
+ };
+ for (var _i = 0, typeParameters_1 = typeParameters; _i < typeParameters_1.length; _i++) {
+ var tp = typeParameters_1[_i];
+ _loop_10(tp);
}
cache.variances = variances;
}
@@ -43648,7 +44398,7 @@
// See comment at call in recursiveTypeRelatedTo for when this case matters.
function hasCovariantVoidArgument(typeArguments, variances) {
for (var i = 0; i < variances.length; i++) {
- if (variances[i] === 1 /* Covariant */ && typeArguments[i].flags & 16384 /* Void */) {
+ if ((variances[i] & 7 /* VarianceMask */) === 1 /* Covariant */ && typeArguments[i].flags & 16384 /* Void */) {
return true;
}
}
@@ -44074,6 +44824,30 @@
return strictNullChecks ? getGlobalNonNullableTypeInstantiation(type) : type;
}
/**
+ * Is source potentially coercible to target type under `==`.
+ * Assumes that `source` is a constituent of a union, hence
+ * the boolean literal flag on the LHS, but not on the RHS.
+ *
+ * This does not fully replicate the semantics of `==`. The
+ * intention is to catch cases that are clearly not right.
+ *
+ * Comparing (string | number) to number should not remove the
+ * string element.
+ *
+ * Comparing (string | number) to 1 will remove the string
+ * element, though this is not sound. This is a pragmatic
+ * choice.
+ *
+ * @see narrowTypeByEquality
+ *
+ * @param source
+ * @param target
+ */
+ function isCoercibleUnderDoubleEquals(source, target) {
+ return ((source.flags & (8 /* Number */ | 4 /* String */ | 512 /* BooleanLiteral */)) !== 0)
+ && ((target.flags & (8 /* Number */ | 4 /* String */ | 16 /* Boolean */)) !== 0);
+ }
+ /**
* Return true if type was inferred from an object literal, written as an object type literal, or is the shape of a module
* with no call or construct signatures.
*/
@@ -44209,26 +44983,34 @@
}
function getWidenedTypeWithContext(type, context) {
if (ts.getObjectFlags(type) & 393216 /* RequiresWidening */) {
+ if (context === undefined && type.widened) {
+ return type.widened;
+ }
+ var result = void 0;
if (type.flags & 98304 /* Nullable */) {
- return anyType;
+ result = anyType;
}
- if (isObjectLiteralType(type)) {
- return getWidenedTypeOfObjectLiteral(type, context);
+ else if (isObjectLiteralType(type)) {
+ result = getWidenedTypeOfObjectLiteral(type, context);
}
- if (type.flags & 1048576 /* Union */) {
+ else if (type.flags & 1048576 /* Union */) {
var unionContext_1 = context || createWideningContext(/*parent*/ undefined, /*propertyName*/ undefined, type.types);
var widenedTypes = ts.sameMap(type.types, function (t) { return t.flags & 98304 /* Nullable */ ? t : getWidenedTypeWithContext(t, unionContext_1); });
// Widening an empty object literal transitions from a highly restrictive type to
// a highly inclusive one. For that reason we perform subtype reduction here if the
// union includes empty object types (e.g. reducing {} | string to just {}).
- return getUnionType(widenedTypes, ts.some(widenedTypes, isEmptyObjectType) ? 2 /* Subtype */ : 1 /* Literal */);
+ result = getUnionType(widenedTypes, ts.some(widenedTypes, isEmptyObjectType) ? 2 /* Subtype */ : 1 /* Literal */);
}
- if (type.flags & 2097152 /* Intersection */) {
- return getIntersectionType(ts.sameMap(type.types, getWidenedType));
+ else if (type.flags & 2097152 /* Intersection */) {
+ result = getIntersectionType(ts.sameMap(type.types, getWidenedType));
}
- if (isArrayType(type) || isTupleType(type)) {
- return createTypeReference(type.target, ts.sameMap(type.typeArguments, getWidenedType));
+ else if (isArrayType(type) || isTupleType(type)) {
+ result = createTypeReference(type.target, ts.sameMap(type.typeArguments, getWidenedType));
+ }
+ if (result && context === undefined) {
+ type.widened = result;
}
+ return result || type;
}
return type;
}
@@ -44290,12 +45072,12 @@
}
var diagnostic;
switch (declaration.kind) {
- case 204 /* BinaryExpression */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 205 /* BinaryExpression */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
diagnostic = noImplicitAny ? ts.Diagnostics.Member_0_implicitly_has_an_1_type : ts.Diagnostics.Member_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage;
break;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
var param = declaration;
if (ts.isIdentifier(param.name) &&
(ts.isCallSignatureDeclaration(param.parent) || ts.isMethodSignature(param.parent) || ts.isFunctionTypeNode(param.parent)) &&
@@ -44310,30 +45092,30 @@
noImplicitAny ? ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type : ts.Diagnostics.Rest_parameter_0_implicitly_has_an_any_type_but_a_better_type_may_be_inferred_from_usage :
noImplicitAny ? ts.Diagnostics.Parameter_0_implicitly_has_an_1_type : ts.Diagnostics.Parameter_0_implicitly_has_an_1_type_but_a_better_type_may_be_inferred_from_usage;
break;
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
diagnostic = ts.Diagnostics.Binding_element_0_implicitly_has_an_1_type;
if (!noImplicitAny) {
// Don't issue a suggestion for binding elements since the codefix doesn't yet support them.
return;
}
break;
- case 294 /* JSDocFunctionType */:
+ case 295 /* JSDocFunctionType */:
error(declaration, ts.Diagnostics.Function_type_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);
return;
- case 239 /* FunctionDeclaration */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 240 /* FunctionDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
if (noImplicitAny && !declaration.name) {
error(declaration, ts.Diagnostics.Function_expression_which_lacks_return_type_annotation_implicitly_has_an_0_return_type, typeAsString);
return;
}
diagnostic = noImplicitAny ? ts.Diagnostics._0_which_lacks_return_type_annotation_implicitly_has_an_1_return_type : ts.Diagnostics._0_implicitly_has_an_1_return_type_but_a_better_type_may_be_inferred_from_usage;
break;
- case 181 /* MappedType */:
+ case 182 /* MappedType */:
if (noImplicitAny) {
error(declaration, ts.Diagnostics.Mapped_object_type_implicitly_has_an_any_template_type);
}
@@ -44453,7 +45235,7 @@
var objectFlags = ts.getObjectFlags(type);
return !!(type.flags & 63176704 /* Instantiable */ ||
objectFlags & 4 /* Reference */ && ts.forEach(type.typeArguments, couldContainTypeVariables) ||
- objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 2048 /* TypeLiteral */ | 32 /* Class */) ||
+ objectFlags & 16 /* Anonymous */ && type.symbol && type.symbol.flags & (16 /* Function */ | 8192 /* Method */ | 32 /* Class */ | 2048 /* TypeLiteral */ | 4096 /* ObjectLiteral */) && type.symbol.declarations ||
objectFlags & 32 /* Mapped */ ||
type.flags & 3145728 /* UnionOrIntersection */ && couldUnionOrIntersectionContainTypeVariables(type));
}
@@ -44501,10 +45283,18 @@
reverseMappedCache.set(key, type);
return type;
}
+ // We consider a type to be partially inferable if it isn't marked non-inferable or if it is
+ // an object literal type with at least one property of an inferable type. For example, an object
+ // literal { a: 123, b: x => true } is marked non-inferable because it contains a context sensitive
+ // arrow function, but is considered partially inferable because property 'a' has an inferable type.
+ function isPartiallyInferableType(type) {
+ return !(ts.getObjectFlags(type) & 524288 /* NonInferrableType */) ||
+ isObjectLiteralType(type) && ts.some(getPropertiesOfType(type), function (prop) { return isPartiallyInferableType(getTypeOfSymbol(prop)); });
+ }
function createReverseMappedType(source, target, constraint) {
- // If any property contains context sensitive functions that have been skipped, the source type
- // is incomplete and we can't infer a meaningful input type.
- if (ts.getObjectFlags(source) & 524288 /* NonInferrableType */ || getPropertiesOfType(source).length === 0 && !getIndexInfoOfType(source, 0 /* String */)) {
+ // We consider a source type reverse mappable if it has a string index signature or if
+ // it has one or more properties and is of a partially inferable type.
+ if (!(getIndexInfoOfType(source, 0 /* String */) || getPropertiesOfType(source).length !== 0 && isPartiallyInferableType(source))) {
return undefined;
}
// For arrays and tuples we infer new arrays and tuples where the reverse mapping has been
@@ -44534,20 +45324,20 @@
var templateType = getTemplateTypeFromMappedType(target);
var inference = createInferenceInfo(typeParameter);
inferTypes([inference], sourceType, templateType);
- return getTypeFromInference(inference);
+ return getTypeFromInference(inference) || unknownType;
}
function getUnmatchedProperties(source, target, requireOptionalProperties, matchDiscriminantProperties) {
- var properties, _i, properties_3, targetProp, sourceProp, targetType, sourceType;
+ var properties, _i, properties_2, targetProp, sourceProp, targetType, sourceType;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
- properties = target.flags & 2097152 /* Intersection */ ? getPropertiesOfUnionOrIntersectionType(target) : getPropertiesOfObjectType(target);
- _i = 0, properties_3 = properties;
+ properties = target.flags & 1048576 /* Union */ ? getPossiblePropertiesOfUnionType(target) : getPropertiesOfType(target);
+ _i = 0, properties_2 = properties;
_a.label = 1;
case 1:
- if (!(_i < properties_3.length)) return [3 /*break*/, 6];
- targetProp = properties_3[_i];
- if (!(requireOptionalProperties || !(targetProp.flags & 16777216 /* Optional */))) return [3 /*break*/, 5];
+ if (!(_i < properties_2.length)) return [3 /*break*/, 6];
+ targetProp = properties_2[_i];
+ if (!(requireOptionalProperties || !(targetProp.flags & 16777216 /* Optional */ || ts.getCheckFlags(targetProp) & 48 /* Partial */))) return [3 /*break*/, 5];
sourceProp = getPropertyOfType(source, targetProp.escapedName);
if (!!sourceProp) return [3 /*break*/, 3];
return [4 /*yield*/, targetProp];
@@ -44588,7 +45378,7 @@
function getTypeFromInference(inference) {
return inference.candidates ? getUnionType(inference.candidates, 2 /* Subtype */) :
inference.contraCandidates ? getIntersectionType(inference.contraCandidates) :
- emptyObjectType;
+ undefined;
}
function inferTypes(inferences, originalSource, originalTarget, priority, contravariant) {
if (priority === void 0) { priority = 0; }
@@ -44662,6 +45452,9 @@
target = removeTypesFromUnionOrIntersection(target, matchingTypes);
}
}
+ else if (target.flags & (8388608 /* IndexedAccess */ | 33554432 /* Substitution */)) {
+ target = getActualTypeVariable(target);
+ }
if (target.flags & 8650752 /* TypeVariable */) {
// If target is a type parameter, make an inference, unless the source type contains
// the anyFunctionType (the wildcard type that's used to avoid contextually typing functions).
@@ -44670,7 +45463,7 @@
// not contain anyFunctionType when we come back to this argument for its second round
// of inference. Also, we exclude inferences for silentNeverType (which is used as a wildcard
// when constructing types from type parameters that had no inference candidates).
- if (ts.getObjectFlags(source) & 524288 /* NonInferrableType */ || source === silentNeverType || (priority & 8 /* ReturnType */ && (source === autoType || source === autoArrayType))) {
+ if (ts.getObjectFlags(source) & 524288 /* NonInferrableType */ || source === silentNeverType || (priority & 16 /* ReturnType */ && (source === autoType || source === autoArrayType))) {
return;
}
var inference = getInferenceInfoForType(target);
@@ -44697,7 +45490,7 @@
inference.inferredType = undefined;
}
}
- if (!(priority & 8 /* ReturnType */) && target.flags & 262144 /* TypeParameter */ && inference.topLevel && !isTypeParameterAtTopLevel(originalTarget, target)) {
+ if (!(priority & 16 /* ReturnType */) && target.flags & 262144 /* TypeParameter */ && inference.topLevel && !isTypeParameterAtTopLevel(originalTarget, target)) {
inference.topLevel = false;
inference.inferredType = undefined;
}
@@ -44706,16 +45499,16 @@
}
else {
// Infer to the simplified version of an indexed access, if possible, to (hopefully) expose more bare type parameters to the inference engine
- var simplified = getSimplifiedType(target);
+ var simplified = getSimplifiedType(target, /*writing*/ false);
if (simplified !== target) {
inferFromTypesOnce(source, simplified);
}
else if (target.flags & 8388608 /* IndexedAccess */) {
- var indexType = getSimplifiedType(target.indexType);
+ var indexType = getSimplifiedType(target.indexType, /*writing*/ false);
// Generally simplifications of instantiable indexes are avoided to keep relationship checking correct, however if our target is an access, we can consider
// that key of that access to be "instantiated", since we're looking to find the infernce goal in any way we can.
if (indexType.flags & 63176704 /* Instantiable */) {
- var simplified_1 = distributeIndexOverObjectType(getSimplifiedType(target.objectType), indexType);
+ var simplified_1 = distributeIndexOverObjectType(getSimplifiedType(target.objectType, /*writing*/ false), indexType, /*writing*/ false);
if (simplified_1 && simplified_1 !== target) {
inferFromTypesOnce(source, simplified_1);
}
@@ -44723,9 +45516,6 @@
}
}
}
- else if (target.flags & 33554432 /* Substitution */) {
- inferFromTypes(source, target.typeVariable);
- }
if (ts.getObjectFlags(source) & 4 /* Reference */ && ts.getObjectFlags(target) & 4 /* Reference */ && source.target === target.target) {
// If source and target are references to the same generic type, infer from type arguments
var sourceTypes = source.typeArguments || ts.emptyArray;
@@ -44733,7 +45523,7 @@
var count = sourceTypes.length < targetTypes.length ? sourceTypes.length : targetTypes.length;
var variances = getVariances(source.target);
for (var i = 0; i < count; i++) {
- if (i < variances.length && variances[i] === 2 /* Contravariant */) {
+ if (i < variances.length && (variances[i] & 7 /* VarianceMask */) === 2 /* Contravariant */) {
inferFromContravariantTypes(sourceTypes[i], targetTypes[i]);
}
else {
@@ -44750,7 +45540,7 @@
var empty = createEmptyObjectTypeFromStringLiteral(source);
contravariant = !contravariant;
var savePriority = priority;
- priority |= 16 /* LiteralKeyof */;
+ priority |= 32 /* LiteralKeyof */;
inferFromTypes(empty, target.type);
priority = savePriority;
contravariant = !contravariant;
@@ -44762,12 +45552,12 @@
else if (source.flags & 16777216 /* Conditional */ && target.flags & 16777216 /* Conditional */) {
inferFromTypes(source.checkType, target.checkType);
inferFromTypes(source.extendsType, target.extendsType);
- inferFromTypes(source.trueType, target.trueType);
- inferFromTypes(source.falseType, target.falseType);
+ inferFromTypes(getTrueTypeFromConditionalType(source), getTrueTypeFromConditionalType(target));
+ inferFromTypes(getFalseTypeFromConditionalType(source), getFalseTypeFromConditionalType(target));
}
else if (target.flags & 16777216 /* Conditional */ && !contravariant) {
- inferFromTypes(source, target.trueType);
- inferFromTypes(source, target.falseType);
+ inferFromTypes(source, getTrueTypeFromConditionalType(target));
+ inferFromTypes(source, getFalseTypeFromConditionalType(target));
}
else if (target.flags & 3145728 /* UnionOrIntersection */) {
// We infer from types that are not naked type variables first so that inferences we
@@ -44808,7 +45598,7 @@
}
}
else {
- if (!(priority & 32 /* NoConstraints */ && source.flags & (2097152 /* Intersection */ | 63176704 /* Instantiable */))) {
+ if (!(priority & 64 /* NoConstraints */ && source.flags & (2097152 /* Intersection */ | 63176704 /* Instantiable */))) {
var apparentSource = getApparentType(source);
// getApparentType can return _any_ type, since an indexed access or conditional may simplify to any other type.
// If that occurs and it doesn't simplify to an object or intersection, we'll need to restart `inferFromTypes`
@@ -44861,7 +45651,7 @@
}
}
function inferFromContravariantTypes(source, target) {
- if (strictFunctionTypes || priority & 64 /* AlwaysStrict */) {
+ if (strictFunctionTypes || priority & 128 /* AlwaysStrict */) {
contravariant = !contravariant;
inferFromTypes(source, target);
contravariant = !contravariant;
@@ -44900,7 +45690,11 @@
var inferredType = inferTypeForHomomorphicMappedType(source, target, constraintType);
if (inferredType) {
var savePriority = priority;
- priority |= 2 /* HomomorphicMappedType */;
+ // We assign a lower priority to inferences made from types containing non-inferrable
+ // types because we may only have a partial result (i.e. we may have failed to make
+ // reverse inferences for some properties).
+ priority |= ts.getObjectFlags(source) & 524288 /* NonInferrableType */ ?
+ 4 /* PartialHomomorphicMappedType */ : 2 /* HomomorphicMappedType */;
inferFromTypes(inferredType, inference.typeParameter);
priority = savePriority;
}
@@ -44911,7 +45705,7 @@
// We're inferring from some source type S to a mapped type { [P in K]: X }, where K is a type
// parameter. First infer from 'keyof S' to K.
var savePriority = priority;
- priority |= 4 /* MappedTypeConstraint */;
+ priority |= 8 /* MappedTypeConstraint */;
inferFromTypes(getIndexType(source), constraintType);
priority = savePriority;
// If K is constrained to a type C, also infer to C. Thus, for a mapped type { [P in K]: X },
@@ -44924,11 +45718,11 @@
}
// If no inferences can be made to K's constraint, infer from a union of the property types
// in the source to the template type X.
- var valueTypes = ts.compact([
- getIndexTypeOfType(source, 0 /* String */),
- getIndexTypeOfType(source, 1 /* Number */)
- ].concat(ts.map(getPropertiesOfType(source), getTypeOfSymbol)));
- inferFromTypes(getUnionType(valueTypes), getTemplateTypeFromMappedType(target));
+ var propTypes = ts.map(getPropertiesOfType(source), getTypeOfSymbol);
+ var stringIndexType = getIndexTypeOfType(source, 0 /* String */);
+ var numberIndexInfo = getNonEnumNumberIndexInfo(source);
+ var numberIndexType = numberIndexInfo && numberIndexInfo.type;
+ inferFromTypes(getUnionType(ts.append(ts.append(propTypes, stringIndexType), numberIndexType)), getTemplateTypeFromMappedType(target));
return true;
}
return false;
@@ -44982,8 +45776,8 @@
}
}
var properties = getPropertiesOfObjectType(target);
- for (var _i = 0, properties_4 = properties; _i < properties_4.length; _i++) {
- var targetProp = properties_4[_i];
+ for (var _i = 0, properties_3 = properties; _i < properties_3.length; _i++) {
+ var targetProp = properties_3[_i];
var sourceProp = getPropertyOfType(source, targetProp.escapedName);
if (sourceProp) {
inferFromTypes(getTypeOfSymbol(sourceProp), getTypeOfSymbol(targetProp));
@@ -45006,7 +45800,7 @@
var saveBivariant = bivariant;
var kind = target.declaration ? target.declaration.kind : 0 /* Unknown */;
// Once we descend into a bivariant signature we remain bivariant for all nested inferences
- bivariant = bivariant || kind === 156 /* MethodDeclaration */ || kind === 155 /* MethodSignature */ || kind === 157 /* Constructor */;
+ bivariant = bivariant || kind === 157 /* MethodDeclaration */ || kind === 156 /* MethodSignature */ || kind === 158 /* Constructor */;
applyToParameterTypes(source, target, inferFromContravariantTypes);
bivariant = saveBivariant;
}
@@ -45073,7 +45867,7 @@
return candidates;
}
function getContravariantInference(inference) {
- return inference.priority & 28 /* PriorityImpliesCombination */ ? getIntersectionType(inference.contraCandidates) : getCommonSubtype(inference.contraCandidates);
+ return inference.priority & 56 /* PriorityImpliesCombination */ ? getIntersectionType(inference.contraCandidates) : getCommonSubtype(inference.contraCandidates);
}
function getCovariantInference(inference, signature) {
// Extract all object literal types and replace them with a single widened and normalized type.
@@ -45090,15 +45884,15 @@
candidates;
// If all inferences were made from a position that implies a combined result, infer a union type.
// Otherwise, infer a common supertype.
- var unwidenedType = inference.priority & 28 /* PriorityImpliesCombination */ ?
+ var unwidenedType = inference.priority & 56 /* PriorityImpliesCombination */ ?
getUnionType(baseCandidates, 2 /* Subtype */) :
getCommonSupertype(baseCandidates);
return getWidenedType(unwidenedType);
}
function getInferredType(context, index) {
var inference = context.inferences[index];
- var inferredType = inference.inferredType;
- if (!inferredType) {
+ if (!inference.inferredType) {
+ var inferredType = void 0;
var signature = context.signature;
if (signature) {
var inferredCovariantType = inference.candidates ? getCovariantInference(inference, signature) : undefined;
@@ -45129,27 +45923,24 @@
// parameter should be instantiated to the empty object type.
inferredType = instantiateType(defaultType, combineTypeMappers(createBackreferenceMapper(context, index), context.nonFixingMapper));
}
- else {
- inferredType = getDefaultTypeArgumentType(!!(context.flags & 2 /* AnyDefault */));
- }
}
}
else {
inferredType = getTypeFromInference(inference);
}
- inference.inferredType = inferredType;
+ inference.inferredType = inferredType || getDefaultTypeArgumentType(!!(context.flags & 2 /* AnyDefault */));
var constraint = getConstraintOfTypeParameter(inference.typeParameter);
if (constraint) {
var instantiatedConstraint = instantiateType(constraint, context.nonFixingMapper);
- if (!context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
+ if (!inferredType || !context.compareTypes(inferredType, getTypeWithThisArgument(instantiatedConstraint, inferredType))) {
inference.inferredType = inferredType = instantiatedConstraint;
}
}
}
- return inferredType;
+ return inference.inferredType;
}
function getDefaultTypeArgumentType(isInJavaScriptFile) {
- return isInJavaScriptFile ? anyType : emptyObjectType;
+ return isInJavaScriptFile ? anyType : unknownType;
}
function getInferredTypes(context) {
var result = [];
@@ -45159,8 +45950,8 @@
return result;
}
// EXPRESSION TYPE CHECKING
- function getCannotFindNameDiagnosticForName(name) {
- switch (name) {
+ function getCannotFindNameDiagnosticForName(node) {
+ switch (node.escapedText) {
case "document":
case "console":
return ts.Diagnostics.Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_include_dom;
@@ -45191,14 +45982,20 @@
case "Iterator":
case "AsyncIterator":
return ts.Diagnostics.Cannot_find_name_0_Do_you_need_to_change_your_target_library_Try_changing_the_lib_compiler_option_to_es2015_or_later;
- default: return ts.Diagnostics.Cannot_find_name_0;
+ default:
+ if (node.parent.kind === 277 /* ShorthandPropertyAssignment */) {
+ return ts.Diagnostics.No_value_exists_in_scope_for_the_shorthand_property_0_Either_declare_one_or_provide_an_initializer;
+ }
+ else {
+ return ts.Diagnostics.Cannot_find_name_0;
+ }
}
}
function getResolvedSymbol(node) {
var links = getNodeLinks(node);
if (!links.resolvedSymbol) {
links.resolvedSymbol = !ts.nodeIsMissing(node) &&
- resolveName(node, node.escapedText, 67220415 /* Value */ | 1048576 /* ExportValue */, getCannotFindNameDiagnosticForName(node.escapedText), node, !ts.isWriteOnlyAccess(node),
+ resolveName(node, node.escapedText, 67220415 /* Value */ | 1048576 /* ExportValue */, getCannotFindNameDiagnosticForName(node), node, !ts.isWriteOnlyAccess(node),
/*excludeGlobals*/ false, ts.Diagnostics.Cannot_find_name_0_Did_you_mean_1) || unknownSymbol;
}
return links.resolvedSymbol;
@@ -45207,7 +46004,7 @@
// TypeScript 1.0 spec (April 2014): 3.6.3
// A type query consists of the keyword typeof followed by an expression.
// The expression is restricted to a single identifier or a sequence of identifiers separated by periods
- return !!ts.findAncestor(node, function (n) { return n.kind === 167 /* TypeQuery */ ? true : n.kind === 72 /* Identifier */ || n.kind === 148 /* QualifiedName */ ? false : "quit"; });
+ return !!ts.findAncestor(node, function (n) { return n.kind === 168 /* TypeQuery */ ? true : n.kind === 73 /* Identifier */ || n.kind === 149 /* QualifiedName */ ? false : "quit"; });
}
// Return the flow cache key for a "dotted name" (i.e. a sequence of identifiers
// separated by dots). The key consists of the id of the symbol referenced by the
@@ -45215,21 +46012,21 @@
// The result is undefined if the reference isn't a dotted name. We prefix nodes
// occurring in an apparent type position with '@' because the control flow type
// of such nodes may be based on the apparent type instead of the declared type.
- function getFlowCacheKey(node) {
+ function getFlowCacheKey(node, declaredType, initialType, flowContainer) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
var symbol = getResolvedSymbol(node);
- return symbol !== unknownSymbol ? (isConstraintPosition(node) ? "@" : "") + getSymbolId(symbol) : undefined;
- case 100 /* ThisKeyword */:
+ return symbol !== unknownSymbol ? (flowContainer ? getNodeId(flowContainer) : "-1") + "|" + getTypeId(declaredType) + "|" + getTypeId(initialType) + "|" + (isConstraintPosition(node) ? "@" : "") + getSymbolId(symbol) : undefined;
+ case 101 /* ThisKeyword */:
return "0";
- case 213 /* NonNullExpression */:
- case 195 /* ParenthesizedExpression */:
- return getFlowCacheKey(node.expression);
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 214 /* NonNullExpression */:
+ case 196 /* ParenthesizedExpression */:
+ return getFlowCacheKey(node.expression, declaredType, initialType, flowContainer);
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
var propName = getAccessedPropertyName(node);
if (propName !== undefined) {
- var key = getFlowCacheKey(node.expression);
+ var key = getFlowCacheKey(node.expression, declaredType, initialType, flowContainer);
return key && key + "." + propName;
}
}
@@ -45237,24 +46034,24 @@
}
function isMatchingReference(source, target) {
switch (target.kind) {
- case 195 /* ParenthesizedExpression */:
- case 213 /* NonNullExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 214 /* NonNullExpression */:
return isMatchingReference(source, target.expression);
}
switch (source.kind) {
- case 72 /* Identifier */:
- return target.kind === 72 /* Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) ||
- (target.kind === 237 /* VariableDeclaration */ || target.kind === 186 /* BindingElement */) &&
+ case 73 /* Identifier */:
+ return target.kind === 73 /* Identifier */ && getResolvedSymbol(source) === getResolvedSymbol(target) ||
+ (target.kind === 238 /* VariableDeclaration */ || target.kind === 187 /* BindingElement */) &&
getExportSymbolOfValueSymbolIfExported(getResolvedSymbol(source)) === getSymbolOfNode(target);
- case 100 /* ThisKeyword */:
- return target.kind === 100 /* ThisKeyword */;
- case 98 /* SuperKeyword */:
- return target.kind === 98 /* SuperKeyword */;
- case 213 /* NonNullExpression */:
- case 195 /* ParenthesizedExpression */:
+ case 101 /* ThisKeyword */:
+ return target.kind === 101 /* ThisKeyword */;
+ case 99 /* SuperKeyword */:
+ return target.kind === 99 /* SuperKeyword */;
+ case 214 /* NonNullExpression */:
+ case 196 /* ParenthesizedExpression */:
return isMatchingReference(source.expression, target);
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return ts.isAccessExpression(target) &&
getAccessedPropertyName(source) === getAccessedPropertyName(target) &&
isMatchingReference(source.expression, target.expression);
@@ -45262,7 +46059,7 @@
return false;
}
function getAccessedPropertyName(access) {
- return access.kind === 189 /* PropertyAccessExpression */ ? access.name.escapedText :
+ return access.kind === 190 /* PropertyAccessExpression */ ? access.name.escapedText :
ts.isStringLiteral(access.argumentExpression) || ts.isNumericLiteral(access.argumentExpression) ? ts.escapeLeadingUnderscores(access.argumentExpression.text) :
undefined;
}
@@ -45287,7 +46084,7 @@
isDiscriminantProperty(getDeclaredTypeOfReference(target.expression), name);
}
function getDeclaredTypeOfReference(expr) {
- if (expr.kind === 72 /* Identifier */) {
+ if (expr.kind === 73 /* Identifier */) {
return getTypeOfSymbol(getResolvedSymbol(expr));
}
if (ts.isAccessExpression(expr)) {
@@ -45309,7 +46106,7 @@
if (prop && ts.getCheckFlags(prop) & 2 /* SyntheticProperty */) {
if (prop.isDiscriminantProperty === undefined) {
prop.isDiscriminantProperty =
- (prop.checkFlags & 96 /* Discriminant */) === 96 /* Discriminant */ &&
+ (prop.checkFlags & 192 /* Discriminant */) === 192 /* Discriminant */ &&
isDiscriminantType(getTypeOfSymbol(prop));
}
return !!prop.isDiscriminantProperty;
@@ -45318,7 +46115,7 @@
return false;
}
function isSyntheticThisPropertyAccess(expr) {
- return ts.isAccessExpression(expr) && expr.expression.kind === 100 /* ThisKeyword */ && !!(expr.expression.flags & 8 /* Synthesized */);
+ return ts.isAccessExpression(expr) && expr.expression.kind === 101 /* ThisKeyword */ && !!(expr.expression.flags & 8 /* Synthesized */);
}
function findDiscriminantProperties(sourceProperties, target) {
var result;
@@ -45346,7 +46143,7 @@
}
}
}
- if (callExpression.expression.kind === 189 /* PropertyAccessExpression */ &&
+ if (callExpression.expression.kind === 190 /* PropertyAccessExpression */ &&
isOrContainsMatchingReference(reference, callExpression.expression.expression)) {
return true;
}
@@ -45465,7 +46262,7 @@
return strictNullChecks ? 7888800 /* ObjectStrictFacts */ : 16736160 /* ObjectFacts */;
}
if (flags & 63176704 /* Instantiable */) {
- return getTypeFacts(getBaseConstraintOfType(type) || emptyObjectType);
+ return getTypeFacts(getBaseConstraintOfType(type) || unknownType);
}
if (flags & 3145728 /* UnionOrIntersection */) {
return getTypeFactsOfTypes(type.types);
@@ -45501,15 +46298,15 @@
return createArrayType(checkIteratedTypeOrElementType(type, /*errorNode*/ undefined, /*allowStringInput*/ false, /*allowAsyncIterables*/ false) || errorType);
}
function getAssignedTypeOfBinaryExpression(node) {
- var isDestructuringDefaultAssignment = node.parent.kind === 187 /* ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) ||
- node.parent.kind === 275 /* PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent);
+ var isDestructuringDefaultAssignment = node.parent.kind === 188 /* ArrayLiteralExpression */ && isDestructuringAssignmentTarget(node.parent) ||
+ node.parent.kind === 276 /* PropertyAssignment */ && isDestructuringAssignmentTarget(node.parent.parent);
return isDestructuringDefaultAssignment ?
getTypeWithDefault(getAssignedType(node), node.right) :
getTypeOfExpression(node.right);
}
function isDestructuringAssignmentTarget(parent) {
- return parent.parent.kind === 204 /* BinaryExpression */ && parent.parent.left === parent ||
- parent.parent.kind === 227 /* ForOfStatement */ && parent.parent.initializer === parent;
+ return parent.parent.kind === 205 /* BinaryExpression */ && parent.parent.left === parent ||
+ parent.parent.kind === 228 /* ForOfStatement */ && parent.parent.initializer === parent;
}
function getAssignedTypeOfArrayLiteralElement(node, element) {
return getTypeOfDestructuredArrayElement(getAssignedType(node), node.elements.indexOf(element));
@@ -45526,21 +46323,21 @@
function getAssignedType(node) {
var parent = node.parent;
switch (parent.kind) {
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return stringType;
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return checkRightHandSideOfForOf(parent.expression, parent.awaitModifier) || errorType;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return getAssignedTypeOfBinaryExpression(parent);
- case 198 /* DeleteExpression */:
+ case 199 /* DeleteExpression */:
return undefinedType;
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return getAssignedTypeOfArrayLiteralElement(parent, node);
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
return getAssignedTypeOfSpreadExpression(parent);
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return getAssignedTypeOfPropertyAssignment(parent);
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return getAssignedTypeOfShorthandPropertyAssignment(parent);
}
return errorType;
@@ -45548,7 +46345,7 @@
function getInitialTypeOfBindingElement(node) {
var pattern = node.parent;
var parentType = getInitialType(pattern.parent);
- var type = pattern.kind === 184 /* ObjectBindingPattern */ ?
+ var type = pattern.kind === 185 /* ObjectBindingPattern */ ?
getTypeOfDestructuredProperty(parentType, node.propertyName || node.name) :
!node.dotDotDotToken ?
getTypeOfDestructuredArrayElement(parentType, pattern.elements.indexOf(node)) :
@@ -45566,37 +46363,37 @@
if (node.initializer) {
return getTypeOfInitializer(node.initializer);
}
- if (node.parent.parent.kind === 226 /* ForInStatement */) {
+ if (node.parent.parent.kind === 227 /* ForInStatement */) {
return stringType;
}
- if (node.parent.parent.kind === 227 /* ForOfStatement */) {
+ if (node.parent.parent.kind === 228 /* ForOfStatement */) {
return checkRightHandSideOfForOf(node.parent.parent.expression, node.parent.parent.awaitModifier) || errorType;
}
return errorType;
}
function getInitialType(node) {
- return node.kind === 237 /* VariableDeclaration */ ?
+ return node.kind === 238 /* VariableDeclaration */ ?
getInitialTypeOfVariableDeclaration(node) :
getInitialTypeOfBindingElement(node);
}
function getInitialOrAssignedType(node, reference) {
- return getConstraintForLocation(node.kind === 237 /* VariableDeclaration */ || node.kind === 186 /* BindingElement */ ?
+ return getConstraintForLocation(node.kind === 238 /* VariableDeclaration */ || node.kind === 187 /* BindingElement */ ?
getInitialType(node) :
getAssignedType(node), reference);
}
function isEmptyArrayAssignment(node) {
- return node.kind === 237 /* VariableDeclaration */ && node.initializer &&
+ return node.kind === 238 /* VariableDeclaration */ && node.initializer &&
isEmptyArrayLiteral(node.initializer) ||
- node.kind !== 186 /* BindingElement */ && node.parent.kind === 204 /* BinaryExpression */ &&
+ node.kind !== 187 /* BindingElement */ && node.parent.kind === 205 /* BinaryExpression */ &&
isEmptyArrayLiteral(node.parent.right);
}
function getReferenceCandidate(node) {
switch (node.kind) {
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return getReferenceCandidate(node.expression);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
switch (node.operatorToken.kind) {
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
return getReferenceCandidate(node.left);
case 27 /* CommaToken */:
return getReferenceCandidate(node.right);
@@ -45606,13 +46403,13 @@
}
function getReferenceRoot(node) {
var parent = node.parent;
- return parent.kind === 195 /* ParenthesizedExpression */ ||
- parent.kind === 204 /* BinaryExpression */ && parent.operatorToken.kind === 59 /* EqualsToken */ && parent.left === node ||
- parent.kind === 204 /* BinaryExpression */ && parent.operatorToken.kind === 27 /* CommaToken */ && parent.right === node ?
+ return parent.kind === 196 /* ParenthesizedExpression */ ||
+ parent.kind === 205 /* BinaryExpression */ && parent.operatorToken.kind === 60 /* EqualsToken */ && parent.left === node ||
+ parent.kind === 205 /* BinaryExpression */ && parent.operatorToken.kind === 27 /* CommaToken */ && parent.right === node ?
getReferenceRoot(parent) : node;
}
function getTypeOfSwitchClause(clause) {
- if (clause.kind === 271 /* CaseClause */) {
+ if (clause.kind === 272 /* CaseClause */) {
return getRegularTypeOfLiteralType(getTypeOfExpression(clause.expression));
}
return neverType;
@@ -45634,7 +46431,7 @@
var witnesses = [];
for (var _i = 0, _a = switchStatement.caseBlock.clauses; _i < _a.length; _i++) {
var clause = _a[_i];
- if (clause.kind === 271 /* CaseClause */) {
+ if (clause.kind === 272 /* CaseClause */) {
if (clause.expression.kind === 10 /* StringLiteral */) {
witnesses.push(clause.expression.text);
continue;
@@ -45680,6 +46477,9 @@
}
return f(type) ? type : neverType;
}
+ function countTypes(type) {
+ return type.flags & 1048576 /* Union */ ? type.types.length : 1;
+ }
function mapType(type, mapper, noReductions) {
if (type.flags & 131072 /* Never */) {
return type;
@@ -45687,25 +46487,20 @@
if (!(type.flags & 1048576 /* Union */)) {
return mapper(type);
}
- var types = type.types;
- var mappedType;
var mappedTypes;
- for (var _i = 0, types_13 = types; _i < types_13.length; _i++) {
- var current = types_13[_i];
- var t = mapper(current);
- if (t) {
- if (!mappedType) {
- mappedType = t;
- }
- else if (!mappedTypes) {
- mappedTypes = [mappedType, t];
+ for (var _i = 0, _a = type.types; _i < _a.length; _i++) {
+ var t = _a[_i];
+ var mapped = mapper(t);
+ if (mapped) {
+ if (!mappedTypes) {
+ mappedTypes = [mapped];
}
else {
- mappedTypes.push(t);
+ mappedTypes.push(mapped);
}
}
}
- return mappedTypes ? getUnionType(mappedTypes, noReductions ? 0 /* None */ : 1 /* Literal */) : mappedType;
+ return mappedTypes && getUnionType(mappedTypes, noReductions ? 0 /* None */ : 1 /* Literal */);
}
function extractTypesOfKind(type, kind) {
return filterType(type, function (t) { return (t.flags & kind) !== 0; });
@@ -45773,8 +46568,8 @@
}
function isEvolvingArrayTypeList(types) {
var hasEvolvingArrayType = false;
- for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
- var t = types_14[_i];
+ for (var _i = 0, types_13 = types; _i < types_13.length; _i++) {
+ var t = types_13[_i];
if (!(t.flags & 131072 /* Never */)) {
if (!(ts.getObjectFlags(t) & 256 /* EvolvingArray */)) {
return false;
@@ -45797,12 +46592,12 @@
function isEvolvingArrayOperationTarget(node) {
var root = getReferenceRoot(node);
var parent = root.parent;
- var isLengthPushOrUnshift = parent.kind === 189 /* PropertyAccessExpression */ && (parent.name.escapedText === "length" ||
- parent.parent.kind === 191 /* CallExpression */ && ts.isPushOrUnshiftIdentifier(parent.name));
- var isElementAssignment = parent.kind === 190 /* ElementAccessExpression */ &&
+ var isLengthPushOrUnshift = parent.kind === 190 /* PropertyAccessExpression */ && (parent.name.escapedText === "length" ||
+ parent.parent.kind === 192 /* CallExpression */ && ts.isPushOrUnshiftIdentifier(parent.name));
+ var isElementAssignment = parent.kind === 191 /* ElementAccessExpression */ &&
parent.expression === root &&
- parent.parent.kind === 204 /* BinaryExpression */ &&
- parent.parent.operatorToken.kind === 59 /* EqualsToken */ &&
+ parent.parent.kind === 205 /* BinaryExpression */ &&
+ parent.parent.operatorToken.kind === 60 /* EqualsToken */ &&
parent.parent.left === parent &&
!ts.isAssignmentTarget(parent.parent) &&
isTypeAssignableToKind(getTypeOfExpression(parent.argumentExpression), 296 /* NumberLike */);
@@ -45816,7 +46611,7 @@
return links.maybeTypePredicate;
}
function getMaybeTypePredicate(node) {
- if (node.expression.kind !== 98 /* SuperKeyword */) {
+ if (node.expression.kind !== 99 /* SuperKeyword */) {
var funcType = checkNonNullExpression(node.expression);
if (funcType !== silentNeverType) {
var apparentType = getApparentType(funcType);
@@ -45834,6 +46629,7 @@
function getFlowTypeOfReference(reference, declaredType, initialType, flowContainer, couldBeUninitialized) {
if (initialType === void 0) { initialType = declaredType; }
var key;
+ var keySet = false;
var flowDepth = 0;
if (flowAnalysisDisabled) {
return errorType;
@@ -45849,10 +46645,17 @@
// on empty arrays are possible without implicit any errors and new element types can be inferred without
// type mismatch errors.
var resultType = ts.getObjectFlags(evolvedType) & 256 /* EvolvingArray */ && isEvolvingArrayOperationTarget(reference) ? autoArrayType : finalizeEvolvingArrayType(evolvedType);
- if (reference.parent && reference.parent.kind === 213 /* NonNullExpression */ && getTypeWithFacts(resultType, 2097152 /* NEUndefinedOrNull */).flags & 131072 /* Never */) {
+ if (reference.parent && reference.parent.kind === 214 /* NonNullExpression */ && getTypeWithFacts(resultType, 2097152 /* NEUndefinedOrNull */).flags & 131072 /* Never */) {
return declaredType;
}
return resultType;
+ function getOrSetCacheKey() {
+ if (keySet) {
+ return key;
+ }
+ keySet = true;
+ return key = getFlowCacheKey(reference, declaredType, initialType, flowContainer);
+ }
function getTypeAtFlowNode(flow) {
if (flowDepth === 2000) {
// We have made 2000 recursive invocations. To avoid overflowing the call stack we report an error
@@ -45864,6 +46667,15 @@
flowDepth++;
while (true) {
var flags = flow.flags;
+ if (flags & 8192 /* Cached */) {
+ var key_2 = getOrSetCacheKey();
+ if (key_2) {
+ var id = getFlowNodeId(flow);
+ if (flowAssignmentKeys[id] === key_2) {
+ return flowAssignmentTypes[id];
+ }
+ }
+ }
if (flags & 1024 /* Shared */) {
// We cache results of flow type resolution for shared nodes that were previously visited in
// the same getFlowTypeOfReference invocation. A node is considered shared when it is the
@@ -45894,6 +46706,15 @@
flow = flow.antecedent;
continue;
}
+ else if (flowLoopCount === flowLoopStart) { // Only cache assignments when not within loop analysis
+ var key_3 = getOrSetCacheKey();
+ if (key_3 && !isIncomplete(type)) {
+ flow.flags |= 8192 /* Cached */;
+ var id = getFlowNodeId(flow);
+ flowAssignmentKeys[id] = key_3;
+ flowAssignmentTypes[id] = type;
+ }
+ }
}
else if (flags & 96 /* Condition */) {
type = getTypeAtFlowCondition(flow);
@@ -45921,9 +46742,9 @@
// Check if we should continue with the control flow of the containing function.
var container = flow.container;
if (container && container !== flowContainer &&
- reference.kind !== 189 /* PropertyAccessExpression */ &&
- reference.kind !== 190 /* ElementAccessExpression */ &&
- reference.kind !== 100 /* ThisKeyword */) {
+ reference.kind !== 190 /* PropertyAccessExpression */ &&
+ reference.kind !== 191 /* ElementAccessExpression */ &&
+ reference.kind !== 101 /* ThisKeyword */) {
flow = container.flowNode;
continue;
}
@@ -45975,14 +46796,14 @@
// in which case we continue control flow analysis back to the function's declaration
if (ts.isVariableDeclaration(node) && (ts.isInJSFile(node) || ts.isVarConst(node))) {
var init = ts.getDeclaredExpandoInitializer(node);
- if (init && (init.kind === 196 /* FunctionExpression */ || init.kind === 197 /* ArrowFunction */)) {
+ if (init && (init.kind === 197 /* FunctionExpression */ || init.kind === 198 /* ArrowFunction */)) {
return getTypeAtFlowNode(flow.antecedent);
}
}
return declaredType;
}
// for (const _ in ref) acts as a nonnull on ref
- if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 226 /* ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) {
+ if (ts.isVariableDeclaration(node) && node.parent.parent.kind === 227 /* ForInStatement */ && isMatchingReference(reference, node.parent.parent.expression)) {
return getNonNullableTypeIfNeeded(getTypeFromFlowType(getTypeAtFlowNode(flow.antecedent)));
}
// Assignment doesn't affect reference
@@ -45991,7 +46812,7 @@
function getTypeAtFlowArrayMutation(flow) {
if (declaredType === autoType || declaredType === autoArrayType) {
var node = flow.node;
- var expr = node.kind === 191 /* CallExpression */ ?
+ var expr = node.kind === 192 /* CallExpression */ ?
node.expression.expression :
node.left.expression;
if (isMatchingReference(reference, getReferenceCandidate(expr))) {
@@ -45999,7 +46820,7 @@
var type = getTypeFromFlowType(flowType);
if (ts.getObjectFlags(type) & 256 /* EvolvingArray */) {
var evolvedType_1 = type;
- if (node.kind === 191 /* CallExpression */) {
+ if (node.kind === 192 /* CallExpression */) {
for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) {
var arg = _a[_i];
evolvedType_1 = addEvolvingArrayElementType(evolvedType_1, arg);
@@ -46052,7 +46873,7 @@
else if (isMatchingReferenceDiscriminant(expr, type)) {
type = narrowTypeByDiscriminant(type, expr, function (t) { return narrowTypeBySwitchOnDiscriminant(t, flow.switchStatement, flow.clauseStart, flow.clauseEnd); });
}
- else if (expr.kind === 199 /* TypeOfExpression */ && isMatchingReference(reference, expr.expression)) {
+ else if (expr.kind === 200 /* TypeOfExpression */ && isMatchingReference(reference, expr.expression)) {
type = narrowBySwitchOnTypeOf(type, flow.switchStatement, flow.clauseStart, flow.clauseEnd);
}
else if (containsMatchingReferenceDiscriminant(reference, expr)) {
@@ -46099,13 +46920,11 @@
// this flow loop junction, return the cached type.
var id = getFlowNodeId(flow);
var cache = flowLoopCaches[id] || (flowLoopCaches[id] = ts.createMap());
+ var key = getOrSetCacheKey();
if (!key) {
- key = getFlowCacheKey(reference);
// No cache key is generated when binding patterns are in unnarrowable situations
- if (!key) {
return declaredType;
}
- }
var cached = cache.get(key);
if (cached) {
return cached;
@@ -46212,7 +47031,7 @@
return !assumeTrue;
}
function narrowByInKeyword(type, literal, assumeTrue) {
- if ((type.flags & (1048576 /* Union */ | 524288 /* Object */)) || (type.flags & 262144 /* TypeParameter */ && type.isThisType)) {
+ if (type.flags & (1048576 /* Union */ | 524288 /* Object */) || isThisTypeParameter(type)) {
var propName_1 = ts.escapeLeadingUnderscores(literal.text);
return filterType(type, function (t) { return isTypePresencePossible(t, propName_1, assumeTrue); });
}
@@ -46220,8 +47039,8 @@
}
function narrowTypeByBinaryExpression(type, expr, assumeTrue) {
switch (expr.operatorToken.kind) {
- case 59 /* EqualsToken */:
- return narrowTypeByTruthiness(type, expr.left, assumeTrue);
+ case 60 /* EqualsToken */:
+ return narrowTypeByTruthiness(narrowType(type, expr.right, assumeTrue), expr.left, assumeTrue);
case 33 /* EqualsEqualsToken */:
case 34 /* ExclamationEqualsToken */:
case 35 /* EqualsEqualsEqualsToken */:
@@ -46229,10 +47048,10 @@
var operator_1 = expr.operatorToken.kind;
var left_1 = getReferenceCandidate(expr.left);
var right_1 = getReferenceCandidate(expr.right);
- if (left_1.kind === 199 /* TypeOfExpression */ && ts.isStringLiteralLike(right_1)) {
+ if (left_1.kind === 200 /* TypeOfExpression */ && ts.isStringLiteralLike(right_1)) {
return narrowTypeByTypeof(type, left_1, operator_1, right_1, assumeTrue);
}
- if (right_1.kind === 199 /* TypeOfExpression */ && ts.isStringLiteralLike(left_1)) {
+ if (right_1.kind === 200 /* TypeOfExpression */ && ts.isStringLiteralLike(left_1)) {
return narrowTypeByTypeof(type, right_1, operator_1, left_1, assumeTrue);
}
if (isMatchingReference(reference, left_1)) {
@@ -46251,9 +47070,9 @@
return declaredType;
}
break;
- case 94 /* InstanceOfKeyword */:
+ case 95 /* InstanceOfKeyword */:
return narrowTypeByInstanceof(type, expr, assumeTrue);
- case 93 /* InKeyword */:
+ case 94 /* InKeyword */:
var target = getReferenceCandidate(expr.right);
if (ts.isStringLiteralLike(expr.left) && isMatchingReference(reference, target)) {
return narrowByInKeyword(type, expr.left, assumeTrue);
@@ -46297,7 +47116,10 @@
return type;
}
if (assumeTrue) {
- var narrowedType = filterType(type, function (t) { return areTypesComparable(t, valueType); });
+ var filterFn = operator === 33 /* EqualsEqualsToken */ ?
+ (function (t) { return areTypesComparable(t, valueType) || isCoercibleUnderDoubleEquals(t, valueType); }) :
+ function (t) { return areTypesComparable(t, valueType); };
+ var narrowedType = filterType(type, filterFn);
return narrowedType.flags & 131072 /* Never */ ? type : replacePrimitivesWithLiterals(narrowedType, valueType);
}
if (isUnitType(valueType)) {
@@ -46586,19 +47408,19 @@
// will be a subtype or the same type as the argument.
function narrowType(type, expr, assumeTrue) {
switch (expr.kind) {
- case 72 /* Identifier */:
- case 100 /* ThisKeyword */:
- case 98 /* SuperKeyword */:
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 73 /* Identifier */:
+ case 101 /* ThisKeyword */:
+ case 99 /* SuperKeyword */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return narrowTypeByTruthiness(type, expr, assumeTrue);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return narrowTypeByTypePredicate(type, expr, assumeTrue);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return narrowType(type, expr.expression, assumeTrue);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return narrowTypeByBinaryExpression(type, expr, assumeTrue);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
if (expr.operator === 52 /* ExclamationToken */) {
return narrowType(type, expr.operand, !assumeTrue);
}
@@ -46613,7 +47435,7 @@
// an dotted name expression, and if the location is not an assignment target, obtain the type
// of the expression (which will reflect control flow analysis). If the expression indeed
// resolved to the given symbol, return the narrowed type.
- if (location.kind === 72 /* Identifier */) {
+ if (location.kind === 73 /* Identifier */) {
if (ts.isRightSideOfQualifiedNameOrPropertyAccess(location)) {
location = location.parent;
}
@@ -46634,9 +47456,9 @@
function getControlFlowContainer(node) {
return ts.findAncestor(node.parent, function (node) {
return ts.isFunctionLike(node) && !ts.getImmediatelyInvokedFunctionExpression(node) ||
- node.kind === 245 /* ModuleBlock */ ||
- node.kind === 284 /* SourceFile */ ||
- node.kind === 154 /* PropertyDeclaration */;
+ node.kind === 246 /* ModuleBlock */ ||
+ node.kind === 285 /* SourceFile */ ||
+ node.kind === 155 /* PropertyDeclaration */;
});
}
// Check if a parameter is assigned anywhere within its declaring function.
@@ -46655,10 +47477,10 @@
return !!ts.findAncestor(node.parent, function (node) { return ts.isFunctionLike(node) && !!(getNodeLinks(node).flags & 8388608 /* AssignmentsMarked */); });
}
function markParameterAssignments(node) {
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
if (ts.isAssignmentTarget(node)) {
var symbol = getResolvedSymbol(node);
- if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 151 /* Parameter */) {
+ if (symbol.valueDeclaration && ts.getRootDeclaration(symbol.valueDeclaration).kind === 152 /* Parameter */) {
symbol.isAssigned = true;
}
}
@@ -46673,7 +47495,7 @@
/** remove undefined from the annotated type of a parameter when there is an initializer (that doesn't include undefined) */
function removeOptionalityFromDeclaredType(declaredType, declaration) {
var annotationIncludesUndefined = strictNullChecks &&
- declaration.kind === 151 /* Parameter */ &&
+ declaration.kind === 152 /* Parameter */ &&
declaration.initializer &&
getFalsyFlags(declaredType) & 32768 /* Undefined */ &&
!(getFalsyFlags(checkExpression(declaration.initializer)) & 32768 /* Undefined */);
@@ -46681,13 +47503,13 @@
}
function isConstraintPosition(node) {
var parent = node.parent;
- return parent.kind === 189 /* PropertyAccessExpression */ ||
- parent.kind === 191 /* CallExpression */ && parent.expression === node ||
- parent.kind === 190 /* ElementAccessExpression */ && parent.expression === node ||
- parent.kind === 186 /* BindingElement */ && parent.name === node && !!parent.initializer;
+ return parent.kind === 190 /* PropertyAccessExpression */ ||
+ parent.kind === 192 /* CallExpression */ && parent.expression === node ||
+ parent.kind === 191 /* ElementAccessExpression */ && parent.expression === node ||
+ parent.kind === 187 /* BindingElement */ && parent.name === node && !!parent.initializer;
}
function typeHasNullableConstraint(type) {
- return type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || emptyObjectType, 98304 /* Nullable */);
+ return type.flags & 58982400 /* InstantiableNonPrimitive */ && maybeTypeOfKind(getBaseConstraintOfType(type) || unknownType, 98304 /* Nullable */);
}
function getConstraintForLocation(type, node) {
// When a node is the left hand expression of a property access, element access, or call expression,
@@ -46718,7 +47540,7 @@
if (symbol === argumentsSymbol) {
var container = ts.getContainingFunction(node);
if (languageVersion < 2 /* ES2015 */) {
- if (container.kind === 197 /* ArrowFunction */) {
+ if (container.kind === 198 /* ArrowFunction */) {
error(node, ts.Diagnostics.The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression);
}
else if (ts.hasModifier(container, 256 /* Async */)) {
@@ -46739,7 +47561,7 @@
// Due to the emit for class decorators, any reference to the class from inside of the class body
// must instead be rewritten to point to a temporary variable to avoid issues with the double-bind
// behavior of class names in ES6.
- if (declaration.kind === 240 /* ClassDeclaration */
+ if (declaration.kind === 241 /* ClassDeclaration */
&& ts.nodeIsDecorated(declaration)) {
var container = ts.getContainingClass(node);
while (container !== undefined) {
@@ -46751,14 +47573,14 @@
container = ts.getContainingClass(container);
}
}
- else if (declaration.kind === 209 /* ClassExpression */) {
+ else if (declaration.kind === 210 /* ClassExpression */) {
// When we emit a class expression with static members that contain a reference
// to the constructor in the initializer, we will need to substitute that
// binding with an alias as the class name is not in scope.
var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false);
- while (container.kind !== 284 /* SourceFile */) {
+ while (container.kind !== 285 /* SourceFile */) {
if (container.parent === declaration) {
- if (container.kind === 154 /* PropertyDeclaration */ && ts.hasModifier(container, 32 /* Static */)) {
+ if (container.kind === 155 /* PropertyDeclaration */ && ts.hasModifier(container, 32 /* Static */)) {
getNodeLinks(declaration).flags |= 16777216 /* ClassWithConstructorReference */;
getNodeLinks(node).flags |= 33554432 /* ConstructorReferenceInClass */;
}
@@ -46807,7 +47629,7 @@
// The declaration container is the innermost function that encloses the declaration of the variable
// or parameter. The flow container is the innermost function starting with which we analyze the control
// flow graph to determine the control flow based type.
- var isParameter = ts.getRootDeclaration(declaration).kind === 151 /* Parameter */;
+ var isParameter = ts.getRootDeclaration(declaration).kind === 152 /* Parameter */;
var declarationContainer = getControlFlowContainer(declaration);
var flowContainer = getControlFlowContainer(node);
var isOuterVariable = flowContainer !== declarationContainer;
@@ -46816,19 +47638,19 @@
// When the control flow originates in a function expression or arrow function and we are referencing
// a const variable or parameter from an outer function, we extend the origin of the control flow
// analysis to include the immediately enclosing function.
- while (flowContainer !== declarationContainer && (flowContainer.kind === 196 /* FunctionExpression */ ||
- flowContainer.kind === 197 /* ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) &&
+ while (flowContainer !== declarationContainer && (flowContainer.kind === 197 /* FunctionExpression */ ||
+ flowContainer.kind === 198 /* ArrowFunction */ || ts.isObjectLiteralOrClassExpressionMethod(flowContainer)) &&
(isConstVariable(localOrExportSymbol) || isParameter && !isParameterAssigned(localOrExportSymbol))) {
flowContainer = getControlFlowContainer(flowContainer);
}
// We only look for uninitialized variables in strict null checking mode, and only when we can analyze
// the entire control flow graph from the variable's declaration (i.e. when the flow container and
// declaration container are the same).
- var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports ||
+ var assumeInitialized = isParameter || isAlias || isOuterVariable || isSpreadDestructuringAssignmentTarget || isModuleExports || ts.isBindingElement(declaration) ||
type !== autoType && type !== autoArrayType && (!strictNullChecks || (type.flags & 3 /* AnyOrUnknown */) !== 0 ||
- isInTypeQuery(node) || node.parent.kind === 257 /* ExportSpecifier */) ||
- node.parent.kind === 213 /* NonNullExpression */ ||
- declaration.kind === 237 /* VariableDeclaration */ && declaration.exclamationToken ||
+ isInTypeQuery(node) || node.parent.kind === 258 /* ExportSpecifier */) ||
+ node.parent.kind === 214 /* NonNullExpression */ ||
+ declaration.kind === 238 /* VariableDeclaration */ && declaration.exclamationToken ||
declaration.flags & 4194304 /* Ambient */;
var initialType = assumeInitialized ? (isParameter ? removeOptionalityFromDeclaredType(type, declaration) : type) :
type === autoType || type === autoArrayType ? undefinedType :
@@ -46863,7 +47685,7 @@
if (languageVersion >= 2 /* ES2015 */ ||
(symbol.flags & (2 /* BlockScopedVariable */ | 32 /* Class */)) === 0 ||
ts.isSourceFile(symbol.valueDeclaration) ||
- symbol.valueDeclaration.parent.kind === 274 /* CatchClause */) {
+ symbol.valueDeclaration.parent.kind === 275 /* CatchClause */) {
return;
}
// 1. walk from the use site up to the declaration and check
@@ -46886,7 +47708,7 @@
// mark iteration statement as containing block-scoped binding captured in some function
var capturesBlockScopeBindingInLoopBody = true;
if (ts.isForStatement(container) &&
- ts.getAncestor(symbol.valueDeclaration, 238 /* VariableDeclarationList */).parent === container) {
+ ts.getAncestor(symbol.valueDeclaration, 239 /* VariableDeclarationList */).parent === container) {
var part = getPartOfForStatementContainingNode(node.parent, container);
if (part) {
var links = getNodeLinks(part);
@@ -46904,8 +47726,8 @@
}
// mark variables that are declared in loop initializer and reassigned inside the body of ForStatement.
// if body of ForStatement will be converted to function then we'll need a extra machinery to propagate reassigned values back.
- if (container.kind === 225 /* ForStatement */ &&
- ts.getAncestor(symbol.valueDeclaration, 238 /* VariableDeclarationList */).parent === container &&
+ if (container.kind === 226 /* ForStatement */ &&
+ ts.getAncestor(symbol.valueDeclaration, 239 /* VariableDeclarationList */).parent === container &&
isAssignedInBodyOfForStatement(node, container)) {
getNodeLinks(symbol.valueDeclaration).flags |= 4194304 /* NeedsLoopOutParameter */;
}
@@ -46923,7 +47745,7 @@
function isAssignedInBodyOfForStatement(node, container) {
// skip parenthesized nodes
var current = node;
- while (current.parent.kind === 195 /* ParenthesizedExpression */) {
+ while (current.parent.kind === 196 /* ParenthesizedExpression */) {
current = current.parent;
}
// check if node is used as LHS in some assignment expression
@@ -46931,7 +47753,7 @@
if (ts.isAssignmentTarget(current)) {
isAssigned = true;
}
- else if ((current.parent.kind === 202 /* PrefixUnaryExpression */ || current.parent.kind === 203 /* PostfixUnaryExpression */)) {
+ else if ((current.parent.kind === 203 /* PrefixUnaryExpression */ || current.parent.kind === 204 /* PostfixUnaryExpression */)) {
var expr = current.parent;
isAssigned = expr.operator === 44 /* PlusPlusToken */ || expr.operator === 45 /* MinusMinusToken */;
}
@@ -46944,7 +47766,7 @@
}
function captureLexicalThis(node, container) {
getNodeLinks(node).flags |= 2 /* LexicalThis */;
- if (container.kind === 154 /* PropertyDeclaration */ || container.kind === 157 /* Constructor */) {
+ if (container.kind === 155 /* PropertyDeclaration */ || container.kind === 158 /* Constructor */) {
var classNode = container.parent;
getNodeLinks(classNode).flags |= 4 /* CaptureThis */;
}
@@ -47012,37 +47834,37 @@
// tell whether 'this' needs to be captured.
var container = ts.getThisContainer(node, /* includeArrowFunctions */ true);
var capturedByArrowFunction = false;
- if (container.kind === 157 /* Constructor */) {
+ if (container.kind === 158 /* Constructor */) {
checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_this_in_the_constructor_of_a_derived_class);
}
// Now skip arrow functions to get the "real" owner of 'this'.
- if (container.kind === 197 /* ArrowFunction */) {
+ if (container.kind === 198 /* ArrowFunction */) {
container = ts.getThisContainer(container, /* includeArrowFunctions */ false);
capturedByArrowFunction = true;
}
switch (container.kind) {
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body);
// do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks
break;
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
error(node, ts.Diagnostics.this_cannot_be_referenced_in_current_location);
// do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks
break;
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
if (isInConstructorArgumentInitializer(node, container)) {
error(node, ts.Diagnostics.this_cannot_be_referenced_in_constructor_arguments);
// do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks
}
break;
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
if (ts.hasModifier(container, 32 /* Static */)) {
error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_static_property_initializer);
// do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks
}
break;
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
error(node, ts.Diagnostics.this_cannot_be_referenced_in_a_computed_property_name);
break;
}
@@ -47092,7 +47914,7 @@
// * /** @constructor */ function [name]() { ... }
// * /** @constructor */ var x = function() { ... }
else if (isInJS &&
- (container.kind === 196 /* FunctionExpression */ || container.kind === 239 /* FunctionDeclaration */) &&
+ (container.kind === 197 /* FunctionExpression */ || container.kind === 240 /* FunctionDeclaration */) &&
ts.getJSDocClassTag(container)) {
var classType = getJSClassType(getMergedSymbol(container.symbol));
if (classType) {
@@ -47128,7 +47950,7 @@
}
function getClassNameFromPrototypeMethod(container) {
// Check if it's the RHS of a x.prototype.y = function [name]() { .... }
- if (container.kind === 196 /* FunctionExpression */ &&
+ if (container.kind === 197 /* FunctionExpression */ &&
ts.isBinaryExpression(container.parent) &&
ts.getAssignmentDeclarationKind(container.parent) === 3 /* PrototypeProperty */) {
// Get the 'x' of 'x.prototype.y = container'
@@ -47138,16 +47960,16 @@
.expression; // x
}
// x.prototype = { method() { } }
- else if (container.kind === 156 /* MethodDeclaration */ &&
- container.parent.kind === 188 /* ObjectLiteralExpression */ &&
+ else if (container.kind === 157 /* MethodDeclaration */ &&
+ container.parent.kind === 189 /* ObjectLiteralExpression */ &&
ts.isBinaryExpression(container.parent.parent) &&
ts.getAssignmentDeclarationKind(container.parent.parent) === 6 /* Prototype */) {
return container.parent.parent.left.expression;
}
// x.prototype = { method: function() { } }
- else if (container.kind === 196 /* FunctionExpression */ &&
- container.parent.kind === 275 /* PropertyAssignment */ &&
- container.parent.parent.kind === 188 /* ObjectLiteralExpression */ &&
+ else if (container.kind === 197 /* FunctionExpression */ &&
+ container.parent.kind === 276 /* PropertyAssignment */ &&
+ container.parent.parent.kind === 189 /* ObjectLiteralExpression */ &&
ts.isBinaryExpression(container.parent.parent.parent) &&
ts.getAssignmentDeclarationKind(container.parent.parent.parent) === 6 /* Prototype */) {
return container.parent.parent.parent.left.expression;
@@ -47155,7 +47977,7 @@
// Object.defineProperty(x, "method", { value: function() { } });
// Object.defineProperty(x, "method", { set: (x: () => void) => void });
// Object.defineProperty(x, "method", { get: () => function() { }) });
- else if (container.kind === 196 /* FunctionExpression */ &&
+ else if (container.kind === 197 /* FunctionExpression */ &&
ts.isPropertyAssignment(container.parent) &&
ts.isIdentifier(container.parent.name) &&
(container.parent.name.escapedText === "value" || container.parent.name.escapedText === "get" || container.parent.name.escapedText === "set") &&
@@ -47180,7 +48002,7 @@
}
function getTypeForThisExpressionFromJSDoc(node) {
var jsdocType = ts.getJSDocType(node);
- if (jsdocType && jsdocType.kind === 294 /* JSDocFunctionType */) {
+ if (jsdocType && jsdocType.kind === 295 /* JSDocFunctionType */) {
var jsDocFunctionType = jsdocType;
if (jsDocFunctionType.parameters.length > 0 &&
jsDocFunctionType.parameters[0].name &&
@@ -47194,15 +48016,15 @@
}
}
function isInConstructorArgumentInitializer(node, constructorDecl) {
- return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 151 /* Parameter */ && n.parent === constructorDecl; });
+ return !!ts.findAncestor(node, function (n) { return ts.isFunctionLikeDeclaration(n) ? "quit" : n.kind === 152 /* Parameter */ && n.parent === constructorDecl; });
}
function checkSuperExpression(node) {
- var isCallExpression = node.parent.kind === 191 /* CallExpression */ && node.parent.expression === node;
+ var isCallExpression = node.parent.kind === 192 /* CallExpression */ && node.parent.expression === node;
var container = ts.getSuperContainer(node, /*stopOnFunctions*/ true);
var needToCaptureLexicalThis = false;
// adjust the container reference in case if super is used inside arrow functions with arbitrarily deep nesting
if (!isCallExpression) {
- while (container && container.kind === 197 /* ArrowFunction */) {
+ while (container && container.kind === 198 /* ArrowFunction */) {
container = ts.getSuperContainer(container, /*stopOnFunctions*/ true);
needToCaptureLexicalThis = languageVersion < 2 /* ES2015 */;
}
@@ -47215,14 +48037,14 @@
// class B {
// [super.foo()]() {}
// }
- var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 149 /* ComputedPropertyName */; });
- if (current && current.kind === 149 /* ComputedPropertyName */) {
+ var current = ts.findAncestor(node, function (n) { return n === container ? "quit" : n.kind === 150 /* ComputedPropertyName */; });
+ if (current && current.kind === 150 /* ComputedPropertyName */) {
error(node, ts.Diagnostics.super_cannot_be_referenced_in_a_computed_property_name);
}
else if (isCallExpression) {
error(node, ts.Diagnostics.Super_calls_are_not_permitted_outside_constructors_or_in_nested_functions_inside_constructors);
}
- else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 188 /* ObjectLiteralExpression */)) {
+ else if (!container || !container.parent || !(ts.isClassLike(container.parent) || container.parent.kind === 189 /* ObjectLiteralExpression */)) {
error(node, ts.Diagnostics.super_can_only_be_referenced_in_members_of_derived_classes_or_object_literal_expressions);
}
else {
@@ -47230,7 +48052,7 @@
}
return errorType;
}
- if (!isCallExpression && container.kind === 157 /* Constructor */) {
+ if (!isCallExpression && container.kind === 158 /* Constructor */) {
checkThisBeforeSuper(node, container, ts.Diagnostics.super_must_be_called_before_accessing_a_property_of_super_in_the_constructor_of_a_derived_class);
}
if (ts.hasModifier(container, 32 /* Static */) || isCallExpression) {
@@ -47299,7 +48121,7 @@
// as a call expression cannot be used as the target of a destructuring assignment while a property access can.
//
// For element access expressions (`super[x]`), we emit a generic helper that forwards the element access in both situations.
- if (container.kind === 156 /* MethodDeclaration */ && ts.hasModifier(container, 256 /* Async */)) {
+ if (container.kind === 157 /* MethodDeclaration */ && ts.hasModifier(container, 256 /* Async */)) {
if (ts.isSuperProperty(node.parent) && ts.isAssignmentTarget(node.parent)) {
getNodeLinks(container).flags |= 4096 /* AsyncMethodWithSuperBinding */;
}
@@ -47313,7 +48135,7 @@
// in this case they should also use correct lexical this
captureLexicalThis(node.parent, container);
}
- if (container.parent.kind === 188 /* ObjectLiteralExpression */) {
+ if (container.parent.kind === 189 /* ObjectLiteralExpression */) {
if (languageVersion < 2 /* ES2015 */) {
error(node, ts.Diagnostics.super_is_only_allowed_in_members_of_object_literal_expressions_when_option_target_is_ES2015_or_higher);
return errorType;
@@ -47334,7 +48156,7 @@
if (!baseClassType) {
return errorType;
}
- if (container.kind === 157 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) {
+ if (container.kind === 158 /* Constructor */ && isInConstructorArgumentInitializer(node, container)) {
// issue custom error message for super property access in constructor arguments (to be aligned with old compiler)
error(node, ts.Diagnostics.super_cannot_be_referenced_in_constructor_arguments);
return errorType;
@@ -47349,7 +48171,7 @@
if (isCallExpression) {
// TS 1.0 SPEC (April 2014): 4.8.1
// Super calls are only permitted in constructors of derived classes
- return container.kind === 157 /* Constructor */;
+ return container.kind === 158 /* Constructor */;
}
else {
// TS 1.0 SPEC (April 2014)
@@ -47357,21 +48179,21 @@
// - In a constructor, instance member function, instance member accessor, or instance member variable initializer where this references a derived class instance
// - In a static member function or static member accessor
// topmost container must be something that is directly nested in the class declaration\object literal expression
- if (ts.isClassLike(container.parent) || container.parent.kind === 188 /* ObjectLiteralExpression */) {
+ if (ts.isClassLike(container.parent) || container.parent.kind === 189 /* ObjectLiteralExpression */) {
if (ts.hasModifier(container, 32 /* Static */)) {
- return container.kind === 156 /* MethodDeclaration */ ||
- container.kind === 155 /* MethodSignature */ ||
- container.kind === 158 /* GetAccessor */ ||
- container.kind === 159 /* SetAccessor */;
+ return container.kind === 157 /* MethodDeclaration */ ||
+ container.kind === 156 /* MethodSignature */ ||
+ container.kind === 159 /* GetAccessor */ ||
+ container.kind === 160 /* SetAccessor */;
}
else {
- return container.kind === 156 /* MethodDeclaration */ ||
- container.kind === 155 /* MethodSignature */ ||
- container.kind === 158 /* GetAccessor */ ||
- container.kind === 159 /* SetAccessor */ ||
- container.kind === 154 /* PropertyDeclaration */ ||
- container.kind === 153 /* PropertySignature */ ||
- container.kind === 157 /* Constructor */;
+ return container.kind === 157 /* MethodDeclaration */ ||
+ container.kind === 156 /* MethodSignature */ ||
+ container.kind === 159 /* GetAccessor */ ||
+ container.kind === 160 /* SetAccessor */ ||
+ container.kind === 155 /* PropertyDeclaration */ ||
+ container.kind === 154 /* PropertySignature */ ||
+ container.kind === 158 /* Constructor */;
}
}
}
@@ -47379,10 +48201,10 @@
}
}
function getContainingObjectLiteral(func) {
- return (func.kind === 156 /* MethodDeclaration */ ||
- func.kind === 158 /* GetAccessor */ ||
- func.kind === 159 /* SetAccessor */) && func.parent.kind === 188 /* ObjectLiteralExpression */ ? func.parent :
- func.kind === 196 /* FunctionExpression */ && func.parent.kind === 275 /* PropertyAssignment */ ? func.parent.parent :
+ return (func.kind === 157 /* MethodDeclaration */ ||
+ func.kind === 159 /* GetAccessor */ ||
+ func.kind === 160 /* SetAccessor */) && func.parent.kind === 189 /* ObjectLiteralExpression */ ? func.parent :
+ func.kind === 197 /* FunctionExpression */ && func.parent.kind === 276 /* PropertyAssignment */ ? func.parent.parent :
undefined;
}
function getThisTypeArgument(type) {
@@ -47394,7 +48216,7 @@
});
}
function getContextualThisParameterType(func) {
- if (func.kind === 197 /* ArrowFunction */) {
+ if (func.kind === 198 /* ArrowFunction */) {
return undefined;
}
if (isContextSensitiveFunctionOrObjectLiteralMethod(func)) {
@@ -47421,7 +48243,7 @@
if (thisType) {
return instantiateType(thisType, getMapperFromContext(getInferenceContext(containingLiteral)));
}
- if (literal.parent.kind !== 275 /* PropertyAssignment */) {
+ if (literal.parent.kind !== 276 /* PropertyAssignment */) {
break;
}
literal = literal.parent.parent;
@@ -47435,9 +48257,9 @@
// In an assignment of the form 'obj.xxx = function(...)' or 'obj[xxx] = function(...)', the
// contextual type for 'this' is 'obj'.
var parent = func.parent;
- if (parent.kind === 204 /* BinaryExpression */ && parent.operatorToken.kind === 59 /* EqualsToken */) {
+ if (parent.kind === 205 /* BinaryExpression */ && parent.operatorToken.kind === 60 /* EqualsToken */) {
var target = parent.left;
- if (target.kind === 189 /* PropertyAccessExpression */ || target.kind === 190 /* ElementAccessExpression */) {
+ if (target.kind === 190 /* PropertyAccessExpression */ || target.kind === 191 /* ElementAccessExpression */) {
var expression = target.expression;
// Don't contextually type `this` as `exports` in `exports.Point = function(x, y) { this.x = x; this.y = y; }`
if (inJs && ts.isIdentifier(expression)) {
@@ -47488,9 +48310,9 @@
return getTypeFromTypeNode(typeNode);
}
switch (declaration.kind) {
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return getContextuallyTypedParameterType(declaration);
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return getContextualTypeForBindingElement(declaration);
// By default, do nothing and return undefined - only parameters and binding elements have context implied by a parent
}
@@ -47611,16 +48433,16 @@
return getTypeAtPosition(signature, argIndex);
}
function getContextualTypeForSubstitutionExpression(template, substitutionExpression) {
- if (template.parent.kind === 193 /* TaggedTemplateExpression */) {
+ if (template.parent.kind === 194 /* TaggedTemplateExpression */) {
return getContextualTypeForArgument(template.parent, substitutionExpression);
}
return undefined;
}
- function getContextualTypeForBinaryOperand(node) {
+ function getContextualTypeForBinaryOperand(node, contextFlags) {
var binaryExpression = node.parent;
var left = binaryExpression.left, operatorToken = binaryExpression.operatorToken, right = binaryExpression.right;
switch (operatorToken.kind) {
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
if (node !== right) {
return undefined;
}
@@ -47633,12 +48455,12 @@
// When an || expression has a contextual type, the operands are contextually typed by that type. When an ||
// expression has no contextual type, the right operand is contextually typed by the type of the left operand,
// except for the special case of Javascript declarations of the form `namespace.prop = namespace.prop || {}`
- var type = getContextualType(binaryExpression);
+ var type = getContextualType(binaryExpression, contextFlags);
return !type && node === right && !ts.isDefaultedExpandoInitializer(binaryExpression) ?
getTypeOfExpression(left) : type;
case 54 /* AmpersandAmpersandToken */:
case 27 /* CommaToken */:
- return node === right ? getContextualType(binaryExpression) : undefined;
+ return node === right ? getContextualType(binaryExpression, contextFlags) : undefined;
default:
return undefined;
}
@@ -47745,24 +48567,24 @@
// In an object literal contextually typed by a type T, the contextual type of a property assignment is the type of
// the matching property in T, if one exists. Otherwise, it is the type of the numeric index signature in T, if one
// exists. Otherwise, it is the type of the string index signature in T, if one exists.
- function getContextualTypeForObjectLiteralMethod(node) {
+ function getContextualTypeForObjectLiteralMethod(node, contextFlags) {
ts.Debug.assert(ts.isObjectLiteralMethod(node));
if (node.flags & 8388608 /* InWithStatement */) {
// We cannot answer semantic questions within a with block, do not proceed any further
return undefined;
}
- return getContextualTypeForObjectLiteralElement(node);
+ return getContextualTypeForObjectLiteralElement(node, contextFlags);
}
- function getContextualTypeForObjectLiteralElement(element) {
+ function getContextualTypeForObjectLiteralElement(element, contextFlags) {
var objectLiteral = element.parent;
- var type = getApparentTypeOfContextualType(objectLiteral);
+ var type = getApparentTypeOfContextualType(objectLiteral, contextFlags);
if (type) {
if (!hasNonBindableDynamicName(element)) {
// For a (non-symbol) computed property, there is no reason to look up the name
// in the type. It will just be "__computed", which does not appear in any
// SymbolTable.
- var symbolName_2 = getSymbolOfNode(element).escapedName;
- var propertyType = getTypeOfPropertyOfContextualType(type, symbolName_2);
+ var symbolName_3 = getSymbolOfNode(element).escapedName;
+ var propertyType = getTypeOfPropertyOfContextualType(type, symbolName_3);
if (propertyType) {
return propertyType;
}
@@ -47781,9 +48603,9 @@
|| getIteratedTypeOrElementType(arrayContextualType, /*errorNode*/ undefined, /*allowStringInput*/ false, /*allowAsyncIterables*/ false, /*checkAssignability*/ false));
}
// In a contextually typed conditional expression, the true/false expressions are contextually typed by the same type.
- function getContextualTypeForConditionalOperand(node) {
+ function getContextualTypeForConditionalOperand(node, contextFlags) {
var conditional = node.parent;
- return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional) : undefined;
+ return node === conditional.whenTrue || node === conditional.whenFalse ? getContextualType(conditional, contextFlags) : undefined;
}
function getContextualTypeForChildJsxExpression(node, child) {
var attributesType = getApparentTypeOfContextualType(node.openingElement.tagName);
@@ -47792,16 +48614,17 @@
if (!(attributesType && !isTypeAny(attributesType) && jsxChildrenPropertyName && jsxChildrenPropertyName !== "")) {
return undefined;
}
- var childIndex = node.children.indexOf(child);
+ var realChildren = getSemanticJsxChildren(node.children);
+ var childIndex = realChildren.indexOf(child);
var childFieldType = getTypeOfPropertyOfContextualType(attributesType, jsxChildrenPropertyName);
- return childFieldType && mapType(childFieldType, function (t) {
+ return childFieldType && (realChildren.length === 1 ? childFieldType : mapType(childFieldType, function (t) {
if (isArrayLikeType(t)) {
return getIndexedAccessType(t, getLiteralType(childIndex));
}
else {
return t;
}
- }, /*noReductions*/ true);
+ }, /*noReductions*/ true));
}
function getContextualTypeForJsxExpression(node) {
var exprParent = node.parent;
@@ -47835,30 +48658,30 @@
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
case 14 /* NoSubstitutionTemplateLiteral */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
- case 96 /* NullKeyword */:
- case 72 /* Identifier */:
- case 141 /* UndefinedKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
+ case 97 /* NullKeyword */:
+ case 73 /* Identifier */:
+ case 142 /* UndefinedKeyword */:
return true;
- case 189 /* PropertyAccessExpression */:
- case 195 /* ParenthesizedExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 196 /* ParenthesizedExpression */:
return isPossiblyDiscriminantValue(node.expression);
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return !node.expression || isPossiblyDiscriminantValue(node.expression);
}
return false;
}
function discriminateContextualTypeByObjectMembers(node, contextualType) {
- return discriminateTypeByDiscriminableItems(contextualType, ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 275 /* PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return checkExpression(prop.initializer); }, prop.symbol.escapedName]; }), isTypeAssignableTo, contextualType);
+ return discriminateTypeByDiscriminableItems(contextualType, ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 276 /* PropertyAssignment */ && isPossiblyDiscriminantValue(p.initializer) && isDiscriminantProperty(contextualType, p.symbol.escapedName); }), function (prop) { return [function () { return checkExpression(prop.initializer); }, prop.symbol.escapedName]; }), isTypeAssignableTo, contextualType);
}
function discriminateContextualTypeByJSXAttributes(node, contextualType) {
- return discriminateTypeByDiscriminableItems(contextualType, ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 267 /* JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return checkExpression(prop.initializer); }), prop.symbol.escapedName]; }), isTypeAssignableTo, contextualType);
+ return discriminateTypeByDiscriminableItems(contextualType, ts.map(ts.filter(node.properties, function (p) { return !!p.symbol && p.kind === 268 /* JsxAttribute */ && isDiscriminantProperty(contextualType, p.symbol.escapedName) && (!p.initializer || isPossiblyDiscriminantValue(p.initializer)); }), function (prop) { return [!prop.initializer ? (function () { return trueType; }) : (function () { return checkExpression(prop.initializer); }), prop.symbol.escapedName]; }), isTypeAssignableTo, contextualType);
}
// Return the contextual type for a given expression node. During overload resolution, a contextual type may temporarily
// be "pushed" onto a node using the contextualType property.
- function getApparentTypeOfContextualType(node) {
- var contextualType = instantiateContextualType(getContextualType(node), node);
+ function getApparentTypeOfContextualType(node, contextFlags) {
+ var contextualType = instantiateContextualType(getContextualType(node, contextFlags), node, contextFlags);
if (contextualType) {
var apparentType = mapType(contextualType, getApparentType, /*noReductions*/ true);
if (apparentType.flags & 1048576 /* Union */) {
@@ -47874,13 +48697,24 @@
}
// If the given contextual type contains instantiable types and if a mapper representing
// return type inferences is available, instantiate those types using that mapper.
- function instantiateContextualType(contextualType, node) {
+ function instantiateContextualType(contextualType, node, contextFlags) {
if (contextualType && maybeTypeOfKind(contextualType, 63176704 /* Instantiable */)) {
var inferenceContext = getInferenceContext(node);
- if (inferenceContext && inferenceContext.returnMapper) {
+ // If no inferences have been made, nothing is gained from instantiating as type parameters
+ // would just be replaced with their defaults similar to the apparent type.
+ if (inferenceContext && ts.some(inferenceContext.inferences, hasInferenceCandidates)) {
+ // For contextual signatures we incorporate all inferences made so far, e.g. from return
+ // types as well as arguments to the left in a function call.
+ if (contextFlags && contextFlags & 1 /* Signature */) {
+ return instantiateInstantiableTypes(contextualType, inferenceContext.nonFixingMapper);
+ }
+ // For other purposes (e.g. determining whether to produce literal types) we only
+ // incorporate inferences made from the return type in a function call.
+ if (inferenceContext.returnMapper) {
return instantiateInstantiableTypes(contextualType, inferenceContext.returnMapper);
}
}
+ }
return contextualType;
}
// This function is similar to instantiateType, except that (a) it only instantiates types that
@@ -47915,7 +48749,7 @@
* @param node the expression whose contextual type will be returned.
* @returns the contextual type of an expression.
*/
- function getContextualType(node) {
+ function getContextualType(node, contextFlags) {
if (node.flags & 8388608 /* InWithStatement */) {
// We cannot answer semantic questions within a with block, do not proceed any further
return undefined;
@@ -47925,54 +48759,54 @@
}
var parent = node.parent;
switch (parent.kind) {
- case 237 /* VariableDeclaration */:
- case 151 /* Parameter */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 186 /* BindingElement */:
+ case 238 /* VariableDeclaration */:
+ case 152 /* Parameter */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 187 /* BindingElement */:
return getContextualTypeForInitializerExpression(node);
- case 197 /* ArrowFunction */:
- case 230 /* ReturnStatement */:
+ case 198 /* ArrowFunction */:
+ case 231 /* ReturnStatement */:
return getContextualTypeForReturnExpression(node);
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return getContextualTypeForYieldOperand(parent);
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
return getContextualTypeForAwaitOperand(parent);
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
return getContextualTypeForArgument(parent, node);
- case 194 /* TypeAssertionExpression */:
- case 212 /* AsExpression */:
+ case 195 /* TypeAssertionExpression */:
+ case 213 /* AsExpression */:
return ts.isConstTypeReference(parent.type) ? undefined : getTypeFromTypeNode(parent.type);
- case 204 /* BinaryExpression */:
- return getContextualTypeForBinaryOperand(node);
- case 275 /* PropertyAssignment */:
- case 276 /* ShorthandPropertyAssignment */:
- return getContextualTypeForObjectLiteralElement(parent);
- case 277 /* SpreadAssignment */:
- return getApparentTypeOfContextualType(parent.parent);
- case 187 /* ArrayLiteralExpression */: {
+ case 205 /* BinaryExpression */:
+ return getContextualTypeForBinaryOperand(node, contextFlags);
+ case 276 /* PropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
+ return getContextualTypeForObjectLiteralElement(parent, contextFlags);
+ case 278 /* SpreadAssignment */:
+ return getApparentTypeOfContextualType(parent.parent, contextFlags);
+ case 188 /* ArrayLiteralExpression */: {
var arrayLiteral = parent;
- var type = getApparentTypeOfContextualType(arrayLiteral);
+ var type = getApparentTypeOfContextualType(arrayLiteral, contextFlags);
return getContextualTypeForElementExpression(type, ts.indexOfNode(arrayLiteral.elements, node));
}
- case 205 /* ConditionalExpression */:
- return getContextualTypeForConditionalOperand(node);
- case 216 /* TemplateSpan */:
- ts.Debug.assert(parent.parent.kind === 206 /* TemplateExpression */);
+ case 206 /* ConditionalExpression */:
+ return getContextualTypeForConditionalOperand(node, contextFlags);
+ case 217 /* TemplateSpan */:
+ ts.Debug.assert(parent.parent.kind === 207 /* TemplateExpression */);
return getContextualTypeForSubstitutionExpression(parent.parent, node);
- case 195 /* ParenthesizedExpression */: {
+ case 196 /* ParenthesizedExpression */: {
// Like in `checkParenthesizedExpression`, an `/** @type {xyz} */` comment before a parenthesized expression acts as a type cast.
var tag = ts.isInJSFile(parent) ? ts.getJSDocTypeTag(parent) : undefined;
- return tag ? getTypeFromTypeNode(tag.typeExpression.type) : getContextualType(parent);
+ return tag ? getTypeFromTypeNode(tag.typeExpression.type) : getContextualType(parent, contextFlags);
}
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return getContextualTypeForJsxExpression(parent);
- case 267 /* JsxAttribute */:
- case 269 /* JsxSpreadAttribute */:
+ case 268 /* JsxAttribute */:
+ case 270 /* JsxSpreadAttribute */:
return getContextualTypeForJsxAttribute(parent);
- case 262 /* JsxOpeningElement */:
- case 261 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
+ case 262 /* JsxSelfClosingElement */:
return getContextualJsxElementAttributesType(parent);
}
return undefined;
@@ -47994,7 +48828,7 @@
return getJsxReferenceKind(node) !== 0 /* Component */ ? getJsxPropsTypeFromCallSignature(signature, node) : getJsxPropsTypeFromClassType(signature, node);
}
function getJsxPropsTypeFromCallSignature(sig, context) {
- var propsType = getTypeOfFirstParameterOfSignatureWithFallback(sig, emptyObjectType);
+ var propsType = getTypeOfFirstParameterOfSignatureWithFallback(sig, unknownType);
propsType = getJsxManagedAttributesFromLocatedAttributes(context, getJsxNamespaceAt(context), propsType);
var intrinsicAttribs = getJsxType(JsxNames.IntrinsicAttributes, context);
if (intrinsicAttribs !== errorType) {
@@ -48065,7 +48899,7 @@
var forcedLookupLocation = getJsxElementPropertiesName(ns);
var attributesType = forcedLookupLocation === undefined
// If there is no type ElementAttributesProperty, return the type of the first parameter of the signature, which should be the props type
- ? getTypeOfFirstParameterOfSignatureWithFallback(sig, emptyObjectType)
+ ? getTypeOfFirstParameterOfSignatureWithFallback(sig, unknownType)
: forcedLookupLocation === ""
// If there is no e.g. 'props' member in ElementAttributesProperty, use the element class type instead
? getReturnTypeOfSignature(sig)
@@ -48076,7 +48910,7 @@
if (!!forcedLookupLocation && !!ts.length(context.attributes.properties)) {
error(context, ts.Diagnostics.JSX_element_class_does_not_support_attributes_because_it_does_not_have_a_0_property, ts.unescapeLeadingUnderscores(forcedLookupLocation));
}
- return emptyObjectType;
+ return unknownType;
}
attributesType = getJsxManagedAttributesFromLocatedAttributes(context, ns, attributesType);
if (isTypeAny(attributesType)) {
@@ -48127,7 +48961,7 @@
return !hasEffectiveRestParameter(signature) && getParameterCount(signature) < targetParameterCount;
}
function isFunctionExpressionOrArrowFunction(node) {
- return node.kind === 196 /* FunctionExpression */ || node.kind === 197 /* ArrowFunction */;
+ return node.kind === 197 /* FunctionExpression */ || node.kind === 198 /* ArrowFunction */;
}
function getContextualSignatureForFunctionLikeDeclaration(node) {
// Only function expressions, arrow functions, and object literal methods are contextually typed.
@@ -48135,23 +48969,20 @@
? getContextualSignature(node)
: undefined;
}
- function getContextualTypeForFunctionLikeDeclaration(node) {
- return ts.isObjectLiteralMethod(node) ?
- getContextualTypeForObjectLiteralMethod(node) :
- getApparentTypeOfContextualType(node);
- }
// Return the contextual signature for a given expression node. A contextual type provides a
// contextual signature if it has a single call signature and if that call signature is non-generic.
// If the contextual type is a union type, get the signature from each type possible and if they are
// all identical ignoring their return type, the result is same signature but with return type as
// union type of return types from these signatures
function getContextualSignature(node) {
- ts.Debug.assert(node.kind !== 156 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
+ ts.Debug.assert(node.kind !== 157 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
var typeTagSignature = getSignatureOfTypeTag(node);
if (typeTagSignature) {
return typeTagSignature;
}
- var type = getContextualTypeForFunctionLikeDeclaration(node);
+ var type = ts.isObjectLiteralMethod(node) ?
+ getContextualTypeForObjectLiteralMethod(node, 1 /* Signature */) :
+ getApparentTypeOfContextualType(node, 1 /* Signature */);
if (!type) {
return undefined;
}
@@ -48160,8 +48991,8 @@
}
var signatureList;
var types = type.types;
- for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
- var current = types_15[_i];
+ for (var _i = 0, types_14 = types; _i < types_14.length; _i++) {
+ var current = types_14[_i];
var signature = getContextualCallSignature(current, node);
if (signature) {
if (!signatureList) {
@@ -48189,8 +49020,8 @@
return checkIteratedTypeOrElementType(arrayOrIterableType, node.expression, /*allowStringInput*/ false, /*allowAsyncIterables*/ false);
}
function hasDefaultValue(node) {
- return (node.kind === 186 /* BindingElement */ && !!node.initializer) ||
- (node.kind === 204 /* BinaryExpression */ && node.operatorToken.kind === 59 /* EqualsToken */);
+ return (node.kind === 187 /* BindingElement */ && !!node.initializer) ||
+ (node.kind === 205 /* BinaryExpression */ && node.operatorToken.kind === 60 /* EqualsToken */);
}
function checkArrayLiteral(node, checkMode, forceTuple) {
var elements = node.elements;
@@ -48202,7 +49033,7 @@
var inConstContext = isConstContext(node);
for (var index = 0; index < elementCount; index++) {
var e = elements[index];
- if (inDestructuringPattern && e.kind === 208 /* SpreadElement */) {
+ if (inDestructuringPattern && e.kind === 209 /* SpreadElement */) {
// Given the following situation:
// var c: {};
// [...c] = ["", 0];
@@ -48227,12 +49058,12 @@
var type = checkExpressionForMutableLocation(e, checkMode, elementContextualType, forceTuple);
elementTypes.push(type);
}
- if (index < elementCount - 1 && e.kind === 208 /* SpreadElement */) {
+ if (index < elementCount - 1 && e.kind === 209 /* SpreadElement */) {
hasNonEndingSpreadElement = true;
}
}
if (!hasNonEndingSpreadElement) {
- var hasRestElement = elementCount > 0 && elements[elementCount - 1].kind === 208 /* SpreadElement */;
+ var hasRestElement = elementCount > 0 && elements[elementCount - 1].kind === 209 /* SpreadElement */;
var minLength = elementCount - (hasRestElement ? 1 : 0);
// If array literal is actually a destructuring pattern, mark it as an implied type. We do this such
// that we get the same behavior for "var [x, y] = []" and "[x, y] = []".
@@ -48262,15 +49093,15 @@
var pattern = contextualType && contextualType.pattern;
// If array literal is contextually typed by a binding pattern or an assignment pattern, pad the resulting
// tuple type with the corresponding binding or assignment element types to make the lengths equal.
- if (!hasRestElement && pattern && (pattern.kind === 185 /* ArrayBindingPattern */ || pattern.kind === 187 /* ArrayLiteralExpression */)) {
+ if (!hasRestElement && pattern && (pattern.kind === 186 /* ArrayBindingPattern */ || pattern.kind === 188 /* ArrayLiteralExpression */)) {
var patternElements = pattern.elements;
for (var i = elementCount; i < patternElements.length; i++) {
var e = patternElements[i];
if (hasDefaultValue(e)) {
elementTypes.push(contextualType.typeArguments[i]);
}
- else if (i < patternElements.length - 1 || !(e.kind === 186 /* BindingElement */ && e.dotDotDotToken || e.kind === 208 /* SpreadElement */)) {
- if (e.kind !== 210 /* OmittedExpression */) {
+ else if (i < patternElements.length - 1 || !(e.kind === 187 /* BindingElement */ && e.dotDotDotToken || e.kind === 209 /* SpreadElement */)) {
+ if (e.kind !== 211 /* OmittedExpression */) {
error(e, ts.Diagnostics.Initializer_provides_no_value_for_this_binding_element_and_the_binding_element_has_no_default_value);
}
elementTypes.push(strictNullChecks ? implicitNeverType : undefinedWideningType);
@@ -48282,9 +49113,9 @@
}
function isNumericName(name) {
switch (name.kind) {
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
return isNumericComputedName(name);
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return isNumericLiteralName(name.escapedText);
case 8 /* NumericLiteral */:
case 10 /* StringLiteral */:
@@ -48372,7 +49203,7 @@
var spread = emptyObjectType;
var contextualType = getApparentTypeOfContextualType(node);
var contextualTypeHasPattern = contextualType && contextualType.pattern &&
- (contextualType.pattern.kind === 184 /* ObjectBindingPattern */ || contextualType.pattern.kind === 188 /* ObjectLiteralExpression */);
+ (contextualType.pattern.kind === 185 /* ObjectBindingPattern */ || contextualType.pattern.kind === 189 /* ObjectLiteralExpression */);
var inConstContext = isConstContext(node);
var checkFlags = inConstContext ? 8 /* Readonly */ : 0;
var isInJavascript = ts.isInJSFile(node) && !ts.isInJsonFile(node);
@@ -48387,13 +49218,13 @@
for (var i = 0; i < node.properties.length; i++) {
var memberDecl = node.properties[i];
var member = getSymbolOfNode(memberDecl);
- var computedNameType = memberDecl.name && memberDecl.name.kind === 149 /* ComputedPropertyName */ && !ts.isWellKnownSymbolSyntactically(memberDecl.name.expression) ?
+ var computedNameType = memberDecl.name && memberDecl.name.kind === 150 /* ComputedPropertyName */ && !ts.isWellKnownSymbolSyntactically(memberDecl.name.expression) ?
checkComputedPropertyName(memberDecl.name) : undefined;
- if (memberDecl.kind === 275 /* PropertyAssignment */ ||
- memberDecl.kind === 276 /* ShorthandPropertyAssignment */ ||
+ if (memberDecl.kind === 276 /* PropertyAssignment */ ||
+ memberDecl.kind === 277 /* ShorthandPropertyAssignment */ ||
ts.isObjectLiteralMethod(memberDecl)) {
- var type = memberDecl.kind === 275 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) :
- memberDecl.kind === 276 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(memberDecl.name, checkMode) :
+ var type = memberDecl.kind === 276 /* PropertyAssignment */ ? checkPropertyAssignment(memberDecl, checkMode) :
+ memberDecl.kind === 277 /* ShorthandPropertyAssignment */ ? checkExpressionForMutableLocation(memberDecl.name, checkMode) :
checkObjectLiteralMethod(memberDecl, checkMode);
if (isInJavascript) {
var jsDocType = getTypeForDeclarationFromJSDocComment(memberDecl);
@@ -48408,7 +49239,7 @@
objectFlags |= ts.getObjectFlags(type) & 917504 /* PropagatingFlags */;
var nameType = computedNameType && isTypeUsableAsPropertyName(computedNameType) ? computedNameType : undefined;
var prop = nameType ?
- createSymbol(4 /* Property */ | member.flags, getPropertyNameFromType(nameType), checkFlags | 2048 /* Late */) :
+ createSymbol(4 /* Property */ | member.flags, getPropertyNameFromType(nameType), checkFlags | 4096 /* Late */) :
createSymbol(4 /* Property */ | member.flags, member.escapedName, checkFlags);
if (nameType) {
prop.nameType = nameType;
@@ -48416,8 +49247,8 @@
if (inDestructuringPattern) {
// If object literal is an assignment pattern and if the assignment pattern specifies a default value
// for the property, make the property optional.
- var isOptional = (memberDecl.kind === 275 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) ||
- (memberDecl.kind === 276 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer);
+ var isOptional = (memberDecl.kind === 276 /* PropertyAssignment */ && hasDefaultValue(memberDecl.initializer)) ||
+ (memberDecl.kind === 277 /* ShorthandPropertyAssignment */ && memberDecl.objectAssignmentInitializer);
if (isOptional) {
prop.flags |= 16777216 /* Optional */;
}
@@ -48442,7 +49273,7 @@
prop.target = member;
member = prop;
}
- else if (memberDecl.kind === 277 /* SpreadAssignment */) {
+ else if (memberDecl.kind === 278 /* SpreadAssignment */) {
if (languageVersion < 2 /* ES2015 */) {
checkExternalEmitHelpers(memberDecl, 2 /* Assign */);
}
@@ -48468,7 +49299,7 @@
// an ordinary function declaration(section 6.1) with no parameters.
// A set accessor declaration is processed in the same manner
// as an ordinary function declaration with a single parameter and a Void return type.
- ts.Debug.assert(memberDecl.kind === 158 /* GetAccessor */ || memberDecl.kind === 159 /* SetAccessor */);
+ ts.Debug.assert(memberDecl.kind === 159 /* GetAccessor */ || memberDecl.kind === 160 /* SetAccessor */);
checkNodeDeferred(memberDecl);
}
if (computedNameType && !(computedNameType.flags & 8576 /* StringOrNumberLiteralOrUnique */)) {
@@ -48576,7 +49407,7 @@
* Returns true iff React would emit this tag name as a string rather than an identifier or qualified name
*/
function isJsxIntrinsicIdentifier(tagName) {
- return tagName.kind === 72 /* Identifier */ && ts.isIntrinsicJsxName(tagName.escapedText);
+ return tagName.kind === 73 /* Identifier */ && ts.isIntrinsicJsxName(tagName.escapedText);
}
function checkJsxAttribute(node, checkMode) {
return node.initializer
@@ -48621,7 +49452,7 @@
}
}
else {
- ts.Debug.assert(attributeDecl.kind === 269 /* JsxSpreadAttribute */);
+ ts.Debug.assert(attributeDecl.kind === 270 /* JsxSpreadAttribute */);
if (attributesTable.size > 0) {
spread = getSpreadType(spread, createJsxAttributesType(), attributes.symbol, objectFlags, /*readonly*/ false);
attributesTable = ts.createSymbolTable();
@@ -48644,7 +49475,7 @@
}
}
// Handle children attribute
- var parent = openingLikeElement.parent.kind === 260 /* JsxElement */ ? openingLikeElement.parent : undefined;
+ var parent = openingLikeElement.parent.kind === 261 /* JsxElement */ ? openingLikeElement.parent : undefined;
// We have to check that openingElement of the parent is the one we are visiting as this may not be true for selfClosingElement
if (parent && parent.openingElement === openingLikeElement && parent.children.length > 0) {
var childrenTypes = checkJsxChildren(parent, checkMode);
@@ -49062,8 +49893,8 @@
*/
function checkPropertyAccessibility(node, isSuper, type, prop) {
var flags = ts.getDeclarationModifierFlagsFromSymbol(prop);
- var errorNode = node.kind === 148 /* QualifiedName */ ? node.right : node.kind === 183 /* ImportType */ ? node : node.name;
- if (ts.getCheckFlags(prop) & 512 /* ContainsPrivate */) {
+ var errorNode = node.kind === 149 /* QualifiedName */ ? node.right : node.kind === 184 /* ImportType */ ? node : node.name;
+ if (ts.getCheckFlags(prop) & 1024 /* ContainsPrivate */) {
// Synthetic property with private constituent property
error(errorNode, ts.Diagnostics.Property_0_has_conflicting_declarations_and_is_inaccessible_in_type_1, symbolToString(prop), typeToString(type));
return false;
@@ -49168,7 +49999,7 @@
return type;
}
function checkNonNullType(type, node, nullDiagnostic, undefinedDiagnostic, nullOrUndefinedDiagnostic) {
- if (type.flags & 2 /* Unknown */) {
+ if (strictNullChecks && type.flags & 2 /* Unknown */) {
error(node, ts.Diagnostics.Object_is_of_type_unknown);
return errorType;
}
@@ -49183,6 +50014,13 @@
}
return type;
}
+ function checkNonNullNonVoidType(type, node) {
+ var nonNullType = checkNonNullType(type, node);
+ if (nonNullType !== errorType && nonNullType.flags & 16384 /* Void */) {
+ error(node, ts.Diagnostics.Object_is_possibly_undefined);
+ }
+ return nonNullType;
+ }
function checkPropertyAccessExpression(node) {
return checkPropertyAccessExpressionOrQualifiedName(node, node.expression, node.name);
}
@@ -49206,7 +50044,7 @@
markAliasReferenced(parentSymbol, node);
}
if (!prop) {
- var indexInfo = getIndexInfoOfType(apparentType, 0 /* String */);
+ var indexInfo = assignmentKind === 0 /* None */ || !isGenericObjectType(leftType) ? getIndexInfoOfType(apparentType, 0 /* String */) : undefined;
if (!(indexInfo && indexInfo.type)) {
if (isJSLiteralType(leftType)) {
return anyType;
@@ -49221,7 +50059,7 @@
return anyType;
}
if (right.escapedText && !checkAndReportErrorForExtendingInterface(node)) {
- reportNonexistentProperty(right, leftType.flags & 262144 /* TypeParameter */ && leftType.isThisType ? apparentType : leftType);
+ reportNonexistentProperty(right, isThisTypeParameter(leftType) ? apparentType : leftType);
}
return errorType;
}
@@ -49232,9 +50070,9 @@
}
else {
checkPropertyNotUsedBeforeDeclaration(prop, node, right);
- markPropertyAsReferenced(prop, node, left.kind === 100 /* ThisKeyword */);
+ markPropertyAsReferenced(prop, node, left.kind === 101 /* ThisKeyword */);
getNodeLinks(node).resolvedSymbol = prop;
- checkPropertyAccessibility(node, left.kind === 98 /* SuperKeyword */, apparentType, prop);
+ checkPropertyAccessibility(node, left.kind === 99 /* SuperKeyword */, apparentType, prop);
if (assignmentKind) {
if (isReferenceToReadonlyEntity(node, prop) || isReferenceThroughNamespaceImport(node)) {
error(right, ts.Diagnostics.Cannot_assign_to_0_because_it_is_a_read_only_property, ts.idText(right));
@@ -49246,7 +50084,7 @@
// Only compute control flow type if this is a property access expression that isn't an
// assignment target, and the referenced property was declared as a variable, property,
// accessor, or optional method.
- if (node.kind !== 189 /* PropertyAccessExpression */ ||
+ if (node.kind !== 190 /* PropertyAccessExpression */ ||
assignmentKind === 1 /* Definite */ ||
prop && !(prop.flags & (3 /* Variable */ | 4 /* Property */ | 98304 /* Accessor */)) && !(prop.flags & 8192 /* Method */ && propType.flags & 1048576 /* Union */)) {
return propType;
@@ -49256,11 +50094,11 @@
// and if we are in a constructor of the same class as the property declaration, assume that
// the property is uninitialized at the top of the control flow.
var assumeUninitialized = false;
- if (strictNullChecks && strictPropertyInitialization && left.kind === 100 /* ThisKeyword */) {
+ if (strictNullChecks && strictPropertyInitialization && left.kind === 101 /* ThisKeyword */) {
var declaration = prop && prop.valueDeclaration;
if (declaration && isInstancePropertyWithoutInitializer(declaration)) {
var flowContainer = getControlFlowContainer(node);
- if (flowContainer.kind === 157 /* Constructor */ && flowContainer.parent === declaration.parent) {
+ if (flowContainer.kind === 158 /* Constructor */ && flowContainer.parent === declaration.parent) {
assumeUninitialized = true;
}
}
@@ -49291,8 +50129,8 @@
&& !isPropertyDeclaredInAncestorClass(prop)) {
diagnosticMessage = error(right, ts.Diagnostics.Property_0_is_used_before_its_initialization, declarationName);
}
- else if (valueDeclaration.kind === 240 /* ClassDeclaration */ &&
- node.parent.kind !== 164 /* TypeReference */ &&
+ else if (valueDeclaration.kind === 241 /* ClassDeclaration */ &&
+ node.parent.kind !== 165 /* TypeReference */ &&
!(valueDeclaration.flags & 4194304 /* Ambient */) &&
!isBlockScopedNameDeclaredBeforeUse(valueDeclaration, right)) {
diagnosticMessage = error(right, ts.Diagnostics.Class_0_used_before_its_declaration, declarationName);
@@ -49304,22 +50142,22 @@
function isInPropertyInitializer(node) {
return !!ts.findAncestor(node, function (node) {
switch (node.kind) {
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return true;
- case 275 /* PropertyAssignment */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 277 /* SpreadAssignment */:
- case 149 /* ComputedPropertyName */:
- case 216 /* TemplateSpan */:
- case 270 /* JsxExpression */:
- case 267 /* JsxAttribute */:
- case 268 /* JsxAttributes */:
- case 269 /* JsxSpreadAttribute */:
- case 262 /* JsxOpeningElement */:
- case 211 /* ExpressionWithTypeArguments */:
- case 273 /* HeritageClause */:
+ case 276 /* PropertyAssignment */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 278 /* SpreadAssignment */:
+ case 150 /* ComputedPropertyName */:
+ case 217 /* TemplateSpan */:
+ case 271 /* JsxExpression */:
+ case 268 /* JsxAttribute */:
+ case 269 /* JsxAttributes */:
+ case 270 /* JsxSpreadAttribute */:
+ case 263 /* JsxOpeningElement */:
+ case 212 /* ExpressionWithTypeArguments */:
+ case 274 /* HeritageClause */:
return false;
default:
return ts.isExpressionNode(node) ? false : "quit";
@@ -49425,6 +50263,32 @@
var suggestion = getSuggestedSymbolForNonexistentModule(name, targetModule);
return suggestion && ts.symbolName(suggestion);
}
+ function getSuggestionForNonexistentIndexSignature(objectType, expr) {
+ // check if object type has setter or getter
+ var hasProp = function (name, argCount) {
+ if (argCount === void 0) { argCount = 1; }
+ var prop = getPropertyOfObjectType(objectType, name);
+ if (prop) {
+ var s = getSingleCallSignature(getTypeOfSymbol(prop));
+ if (s && getMinArgumentCount(s) === argCount && typeToString(getTypeAtPosition(s, 0)) === "string") {
+ return true;
+ }
+ }
+ return false;
+ };
+ var suggestedMethod = ts.isAssignmentTarget(expr) ? "set" : "get";
+ if (!hasProp(suggestedMethod)) {
+ return undefined;
+ }
+ var suggestion = ts.tryGetPropertyAccessOrIdentifierToString(expr);
+ if (suggestion === undefined) {
+ suggestion = suggestedMethod;
+ }
+ else {
+ suggestion += "." + suggestedMethod;
+ }
+ return suggestion;
+ }
/**
* Given a name and a list of symbols whose names are *not* equal to the name, return a spelling suggestion if there is one that is close enough.
* Names less than length 3 only check for case-insensitive equality, not levenshtein distance.
@@ -49465,34 +50329,17 @@
}
function isValidPropertyAccess(node, propertyName) {
switch (node.kind) {
- case 189 /* PropertyAccessExpression */:
- return isValidPropertyAccessWithType(node, node.expression.kind === 98 /* SuperKeyword */, propertyName, getWidenedType(checkExpression(node.expression)));
- case 148 /* QualifiedName */:
+ case 190 /* PropertyAccessExpression */:
+ return isValidPropertyAccessWithType(node, node.expression.kind === 99 /* SuperKeyword */, propertyName, getWidenedType(checkExpression(node.expression)));
+ case 149 /* QualifiedName */:
return isValidPropertyAccessWithType(node, /*isSuper*/ false, propertyName, getWidenedType(checkExpression(node.left)));
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return isValidPropertyAccessWithType(node, /*isSuper*/ false, propertyName, getTypeFromTypeNode(node));
}
}
function isValidPropertyAccessForCompletions(node, type, property) {
- return isValidPropertyAccessWithType(node, node.kind === 189 /* PropertyAccessExpression */ && node.expression.kind === 98 /* SuperKeyword */, property.escapedName, type)
- && (!(property.flags & 8192 /* Method */) || isValidMethodAccess(property, type));
- }
- function isValidMethodAccess(method, actualThisType) {
- var propType = getTypeOfPropertyOfType(actualThisType, method.escapedName);
- var signatures = getSignaturesOfType(getNonNullableType(propType), 0 /* Call */);
- ts.Debug.assert(signatures.length !== 0);
- return signatures.some(function (sig) {
- var signatureThisType = getThisTypeOfSignature(sig);
- return !signatureThisType || isTypeAssignableTo(actualThisType, getInstantiatedSignatureThisType(sig, signatureThisType, actualThisType));
- });
- }
- function getInstantiatedSignatureThisType(sig, signatureThisType, actualThisType) {
- if (!sig.typeParameters) {
- return signatureThisType;
- }
- var context = createInferenceContext(sig.typeParameters, sig, 0 /* None */);
- inferTypes(context.inferences, actualThisType, signatureThisType);
- return instantiateType(signatureThisType, createSignatureTypeMapper(sig, getInferredTypes(context)));
+ return isValidPropertyAccessWithType(node, node.kind === 190 /* PropertyAccessExpression */ && node.expression.kind === 99 /* SuperKeyword */, property.escapedName, type);
+ // Previously we validated the 'this' type of methods but this adversely affected performance. See #31377 for more context.
}
function isValidPropertyAccessWithType(node, isSuper, propertyName, type) {
if (type === errorType || isTypeAny(type)) {
@@ -49508,13 +50355,13 @@
*/
function getForInVariableSymbol(node) {
var initializer = node.initializer;
- if (initializer.kind === 238 /* VariableDeclarationList */) {
+ if (initializer.kind === 239 /* VariableDeclarationList */) {
var variable = initializer.declarations[0];
if (variable && !ts.isBindingPattern(variable.name)) {
return getSymbolOfNode(variable);
}
}
- else if (initializer.kind === 72 /* Identifier */) {
+ else if (initializer.kind === 73 /* Identifier */) {
return getResolvedSymbol(initializer);
}
return undefined;
@@ -49531,13 +50378,13 @@
*/
function isForInVariableForNumericPropertyNames(expr) {
var e = ts.skipParentheses(expr);
- if (e.kind === 72 /* Identifier */) {
+ if (e.kind === 73 /* Identifier */) {
var symbol = getResolvedSymbol(e);
if (symbol.flags & 3 /* Variable */) {
var child = expr;
var node = expr.parent;
while (node) {
- if (node.kind === 226 /* ForInStatement */ &&
+ if (node.kind === 227 /* ForInStatement */ &&
child === node.statement &&
getForInVariableSymbol(node) === symbol &&
hasNumericPropertyNames(getTypeOfExpression(node.expression))) {
@@ -49555,7 +50402,7 @@
var indexExpression = node.argumentExpression;
if (!indexExpression) {
var sourceFile = ts.getSourceFileOfNode(node);
- if (node.parent.kind === 192 /* NewExpression */ && node.parent.expression === node) {
+ if (node.parent.kind === 193 /* NewExpression */ && node.parent.expression === node) {
var start = ts.skipTrivia(sourceFile.text, node.expression.end);
var end = node.end;
grammarErrorAtPos(sourceFile, start, end - start, ts.Diagnostics.new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead);
@@ -49575,7 +50422,12 @@
error(indexExpression, ts.Diagnostics.A_const_enum_member_can_only_be_accessed_using_a_string_literal);
return errorType;
}
- return checkIndexedAccessIndexType(getIndexedAccessType(objectType, isForInVariableForNumericPropertyNames(indexExpression) ? numberType : indexType, node), node);
+ var effectiveIndexType = isForInVariableForNumericPropertyNames(indexExpression) ? numberType : indexType;
+ var accessFlags = ts.isAssignmentTarget(node) ?
+ 2 /* Writing */ | (isGenericObjectType(objectType) && !isThisTypeParameter(objectType) ? 1 /* NoIndexSignatures */ : 0) :
+ 0 /* None */;
+ var indexedAccessType = getIndexedAccessTypeOrUndefined(objectType, effectiveIndexType, node, accessFlags) || errorType;
+ return checkIndexedAccessIndexType(indexedAccessType, node);
}
function checkThatExpressionIsProperSymbolReference(expression, expressionType, reportError) {
if (expressionType === errorType) {
@@ -49621,13 +50473,13 @@
// This gets us diagnostics for the type arguments and marks them as referenced.
ts.forEach(node.typeArguments, checkSourceElement);
}
- if (node.kind === 193 /* TaggedTemplateExpression */) {
+ if (node.kind === 194 /* TaggedTemplateExpression */) {
checkExpression(node.template);
}
else if (ts.isJsxOpeningLikeElement(node)) {
checkExpression(node.attributes);
}
- else if (node.kind !== 152 /* Decorator */) {
+ else if (node.kind !== 153 /* Decorator */) {
ts.forEach(node.arguments, function (argument) {
checkExpression(argument);
});
@@ -49691,7 +50543,7 @@
}
}
function isSpreadArgument(arg) {
- return !!arg && (arg.kind === 208 /* SpreadElement */ || arg.kind === 215 /* SyntheticExpression */ && arg.isSpread);
+ return !!arg && (arg.kind === 209 /* SpreadElement */ || arg.kind === 216 /* SyntheticExpression */ && arg.isSpread);
}
function getSpreadArgumentIndex(args) {
return ts.findIndex(args, isSpreadArgument);
@@ -49705,9 +50557,9 @@
var callIsIncomplete = false; // In incomplete call we want to be lenient when we have too few arguments
var effectiveParameterCount = getParameterCount(signature);
var effectiveMinimumArguments = getMinArgumentCount(signature);
- if (node.kind === 193 /* TaggedTemplateExpression */) {
+ if (node.kind === 194 /* TaggedTemplateExpression */) {
argCount = args.length;
- if (node.template.kind === 206 /* TemplateExpression */) {
+ if (node.template.kind === 207 /* TemplateExpression */) {
// If a tagged template expression lacks a tail literal, the call is incomplete.
// Specifically, a template only can end in a TemplateTail or a Missing literal.
var lastSpan = ts.last(node.template.templateSpans); // we should always have at least one span.
@@ -49722,7 +50574,7 @@
callIsIncomplete = !!templateLiteral.isUnterminated;
}
}
- else if (node.kind === 152 /* Decorator */) {
+ else if (node.kind === 153 /* Decorator */) {
argCount = getDecoratorArgumentCount(node, signature);
}
else if (ts.isJsxOpeningLikeElement(node)) {
@@ -49737,7 +50589,7 @@
else {
if (!node.arguments) {
// This only happens when we have something of the form: 'new C'
- ts.Debug.assert(node.kind === 192 /* NewExpression */);
+ ts.Debug.assert(node.kind === 193 /* NewExpression */);
return getMinArgumentCount(signature) === 0;
}
argCount = signatureHelpTrailingComma ? args.length + 1 : args.length;
@@ -49776,12 +50628,23 @@
}
// If type has a single call signature and no other members, return that signature. Otherwise, return undefined.
function getSingleCallSignature(type) {
+ return getSingleSignature(type, 0 /* Call */, /*allowMembers*/ false);
+ }
+ function getSingleCallOrConstructSignature(type) {
+ return getSingleSignature(type, 0 /* Call */, /*allowMembers*/ false) ||
+ getSingleSignature(type, 1 /* Construct */, /*allowMembers*/ false);
+ }
+ function getSingleSignature(type, kind, allowMembers) {
if (type.flags & 524288 /* Object */) {
var resolved = resolveStructuredTypeMembers(type);
- if (resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0 &&
- resolved.properties.length === 0 && !resolved.stringIndexInfo && !resolved.numberIndexInfo) {
+ if (allowMembers || resolved.properties.length === 0 && !resolved.stringIndexInfo && !resolved.numberIndexInfo) {
+ if (kind === 0 /* Call */ && resolved.callSignatures.length === 1 && resolved.constructSignatures.length === 0) {
return resolved.callSignatures[0];
}
+ if (kind === 1 /* Construct */ && resolved.constructSignatures.length === 1 && resolved.callSignatures.length === 0) {
+ return resolved.constructSignatures[0];
+ }
+ }
}
return undefined;
}
@@ -49800,7 +50663,7 @@
});
if (!inferenceContext) {
applyToReturnTypes(contextualSignature, signature, function (source, target) {
- inferTypes(context.inferences, source, target, 8 /* ReturnType */);
+ inferTypes(context.inferences, source, target, 16 /* ReturnType */);
});
}
return getSignatureInstantiation(signature, getInferredTypes(context), ts.isInJSFile(contextualSignature.declaration));
@@ -49819,7 +50682,7 @@
// example, given a 'function wrap<T, U>(cb: (x: T) => U): (x: T) => U' and a call expression
// 'let f: (x: string) => number = wrap(s => s.length)', we infer from the declared type of 'f' to the
// return type of 'wrap'.
- if (node.kind !== 152 /* Decorator */) {
+ if (node.kind !== 153 /* Decorator */) {
var contextualType = getContextualType(node);
if (contextualType) {
// We clone the inference context to avoid disturbing a resolution in progress for an
@@ -49840,7 +50703,7 @@
instantiatedType;
var inferenceTargetType = getReturnTypeOfSignature(signature);
// Inferences made from return types have lower priority than all other inferences.
- inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 8 /* ReturnType */);
+ inferTypes(context.inferences, inferenceSourceType, inferenceTargetType, 16 /* ReturnType */);
// Create a type mapper for instantiating generic contextual types using the inferences made
// from the return type.
context.returnMapper = getMapperFromContext(cloneInferredPartOfContext(context));
@@ -49856,7 +50719,7 @@
var argCount = restType ? Math.min(getParameterCount(signature) - 1, args.length) : args.length;
for (var i = 0; i < argCount; i++) {
var arg = args[i];
- if (arg.kind !== 210 /* OmittedExpression */) {
+ if (arg.kind !== 211 /* OmittedExpression */) {
var paramType = getTypeAtPosition(signature, i);
var argType = checkExpressionWithContextualType(arg, paramType, context, checkMode);
inferTypes(context.inferences, argType, paramType);
@@ -49870,7 +50733,7 @@
}
function getArrayifiedType(type) {
if (forEachType(type, function (t) { return !(t.flags & (1 /* Any */ | 63176704 /* Instantiable */) || isArrayType(t) || isTupleType(t)); })) {
- return createArrayType(getIndexTypeOfType(type, 1 /* Number */) || errorType);
+ return createArrayType(getIndexedAccessType(type, numberType));
}
return type;
}
@@ -49880,20 +50743,20 @@
if (isSpreadArgument(arg)) {
// We are inferring from a spread expression in the last argument position, i.e. both the parameter
// and the argument are ...x forms.
- return arg.kind === 215 /* SyntheticExpression */ ?
+ return arg.kind === 216 /* SyntheticExpression */ ?
createArrayType(arg.type) :
getArrayifiedType(checkExpressionWithContextualType(arg.expression, restType, context, 0 /* Normal */));
}
}
- var contextualType = getIndexTypeOfType(restType, 1 /* Number */) || anyType;
- var hasPrimitiveContextualType = maybeTypeOfKind(contextualType, 131068 /* Primitive */ | 4194304 /* Index */);
var types = [];
var spreadIndex = -1;
for (var i = index; i < argCount; i++) {
+ var contextualType = getIndexedAccessType(restType, getLiteralType(i - index));
var argType = checkExpressionWithContextualType(args[i], contextualType, context, 0 /* Normal */);
if (spreadIndex < 0 && isSpreadArgument(args[i])) {
spreadIndex = i - index;
}
+ var hasPrimitiveContextualType = maybeTypeOfKind(contextualType, 131068 /* Primitive */ | 4194304 /* Index */);
types.push(hasPrimitiveContextualType ? getRegularTypeOfLiteralType(argType) : getWidenedLiteralType(argType));
}
return spreadIndex < 0 ?
@@ -49954,7 +50817,7 @@
return checkApplicableSignatureForJsxOpeningLikeElement(node, signature, relation, checkMode, reportErrors);
}
var thisType = getThisTypeOfSignature(signature);
- if (thisType && thisType !== voidType && node.kind !== 192 /* NewExpression */) {
+ if (thisType && thisType !== voidType && node.kind !== 193 /* NewExpression */) {
// If the called expression is not of the form `x.f` or `x["f"]`, then sourceType = voidType
// If the signature's 'this' type is voidType, then the check is skipped -- anything is compatible.
// If the expression is a new expression, then the check is skipped.
@@ -49971,7 +50834,7 @@
var argCount = restType ? Math.min(getParameterCount(signature) - 1, args.length) : args.length;
for (var i = 0; i < argCount; i++) {
var arg = args[i];
- if (arg.kind !== 210 /* OmittedExpression */) {
+ if (arg.kind !== 211 /* OmittedExpression */) {
var paramType = getTypeAtPosition(signature, i);
var argType = checkExpressionWithContextualType(arg, paramType, /*inferenceContext*/ undefined, checkMode);
// If one or more arguments are still excluded (as indicated by CheckMode.SkipContextSensitive),
@@ -49994,15 +50857,15 @@
* Returns the this argument in calls like x.f(...) and x[f](...). Undefined otherwise.
*/
function getThisArgumentOfCall(node) {
- if (node.kind === 191 /* CallExpression */) {
+ if (node.kind === 192 /* CallExpression */) {
var callee = ts.skipOuterExpressions(node.expression);
- if (callee.kind === 189 /* PropertyAccessExpression */ || callee.kind === 190 /* ElementAccessExpression */) {
+ if (callee.kind === 190 /* PropertyAccessExpression */ || callee.kind === 191 /* ElementAccessExpression */) {
return callee.expression;
}
}
}
function createSyntheticExpression(parent, type, isSpread) {
- var result = ts.createNode(215 /* SyntheticExpression */, parent.pos, parent.end);
+ var result = ts.createNode(216 /* SyntheticExpression */, parent.pos, parent.end);
result.parent = parent;
result.type = type;
result.isSpread = isSpread || false;
@@ -50012,17 +50875,17 @@
* Returns the effective arguments for an expression that works like a function invocation.
*/
function getEffectiveCallArguments(node) {
- if (node.kind === 193 /* TaggedTemplateExpression */) {
+ if (node.kind === 194 /* TaggedTemplateExpression */) {
var template = node.template;
- var args_4 = [createSyntheticExpression(template, getGlobalTemplateStringsArrayType())];
- if (template.kind === 206 /* TemplateExpression */) {
+ var args_3 = [createSyntheticExpression(template, getGlobalTemplateStringsArrayType())];
+ if (template.kind === 207 /* TemplateExpression */) {
ts.forEach(template.templateSpans, function (span) {
- args_4.push(span.expression);
+ args_3.push(span.expression);
});
}
- return args_4;
+ return args_3;
}
- if (node.kind === 152 /* Decorator */) {
+ if (node.kind === 153 /* Decorator */) {
return getEffectiveDecoratorArguments(node);
}
if (ts.isJsxOpeningLikeElement(node)) {
@@ -50035,7 +50898,7 @@
// of the argument is a tuple type, spread the tuple elements into the argument list. We can
// call checkExpressionCached because spread expressions never have a contextual type.
var spreadArgument_1 = args[length - 1];
- var type = checkExpressionCached(spreadArgument_1.expression);
+ var type = flowLoopCount ? checkExpression(spreadArgument_1.expression) : checkExpressionCached(spreadArgument_1.expression);
if (isTupleType(type)) {
var typeArguments = type.typeArguments || ts.emptyArray;
var restIndex_2 = type.target.hasRestElement ? typeArguments.length - 1 : -1;
@@ -50052,30 +50915,30 @@
var parent = node.parent;
var expr = node.expression;
switch (parent.kind) {
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
// For a class decorator, the `target` is the type of the class (e.g. the
// "static" or "constructor" side of the class).
return [
createSyntheticExpression(expr, getTypeOfSymbol(getSymbolOfNode(parent)))
];
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
// A parameter declaration decorator will have three arguments (see
// `ParameterDecorator` in core.d.ts).
var func = parent.parent;
return [
- createSyntheticExpression(expr, parent.parent.kind === 157 /* Constructor */ ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType),
+ createSyntheticExpression(expr, parent.parent.kind === 158 /* Constructor */ ? getTypeOfSymbol(getSymbolOfNode(func)) : errorType),
createSyntheticExpression(expr, anyType),
createSyntheticExpression(expr, numberType)
];
- case 154 /* PropertyDeclaration */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 155 /* PropertyDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
// A method or accessor declaration decorator will have two or three arguments (see
// `PropertyDecorator` and `MethodDecorator` in core.d.ts). If we are emitting decorators
// for ES3, we will only pass two arguments.
- var hasPropDesc = parent.kind !== 154 /* PropertyDeclaration */ && languageVersion !== 0 /* ES3 */;
+ var hasPropDesc = parent.kind !== 155 /* PropertyDeclaration */ && languageVersion !== 0 /* ES3 */;
return [
createSyntheticExpression(expr, getParentTypeOfClassElement(parent)),
createSyntheticExpression(expr, getClassElementPropertyKeyType(parent)),
@@ -50089,17 +50952,17 @@
*/
function getDecoratorArgumentCount(node, signature) {
switch (node.parent.kind) {
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
return 1;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return 2;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
// For ES3 or decorators with only two parameters we supply only two arguments
return languageVersion === 0 /* ES3 */ || signature.parameters.length <= 2 ? 2 : 3;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return 3;
default:
return ts.Debug.fail();
@@ -50199,15 +51062,15 @@
return ts.createDiagnosticForNodeArray(ts.getSourceFileOfNode(node), typeArguments, ts.Diagnostics.Expected_0_type_arguments_but_got_1, belowArgCount === -Infinity ? aboveArgCount : belowArgCount, argCount);
}
function resolveCall(node, signatures, candidatesOutArray, checkMode, fallbackError) {
- var isTaggedTemplate = node.kind === 193 /* TaggedTemplateExpression */;
- var isDecorator = node.kind === 152 /* Decorator */;
+ var isTaggedTemplate = node.kind === 194 /* TaggedTemplateExpression */;
+ var isDecorator = node.kind === 153 /* Decorator */;
var isJsxOpeningOrSelfClosingElement = ts.isJsxOpeningLikeElement(node);
var reportErrors = !candidatesOutArray;
var typeArguments;
if (!isDecorator) {
typeArguments = node.typeArguments;
// We already perform checking on the type arguments on the class declaration itself.
- if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 98 /* SuperKeyword */) {
+ if (isTaggedTemplate || isJsxOpeningOrSelfClosingElement || node.expression.kind !== 99 /* SuperKeyword */) {
ts.forEach(typeArguments, checkSourceElement);
}
}
@@ -50262,7 +51125,7 @@
var result;
// If we are in signature help, a trailing comma indicates that we intend to provide another argument,
// so we will only accept overloads with arity at least 1 higher than the current number of provided arguments.
- var signatureHelpTrailingComma = !!(checkMode & 16 /* IsForSignatureHelp */) && node.kind === 191 /* CallExpression */ && node.arguments.hasTrailingComma;
+ var signatureHelpTrailingComma = !!(checkMode & 16 /* IsForSignatureHelp */) && node.kind === 192 /* CallExpression */ && node.arguments.hasTrailingComma;
// Section 4.12.1:
// if the candidate list contains one or more signatures for which the type of each argument
// expression is a subtype of each corresponding parameter type, the return type of the first
@@ -50413,7 +51276,7 @@
}
var _a = ts.minAndMax(candidates, getNumNonRestParameters), minArgumentCount = _a.min, maxNonRestParam = _a.max;
var parameters = [];
- var _loop_8 = function (i) {
+ var _loop_11 = function (i) {
var symbols = ts.mapDefined(candidates, function (_a) {
var parameters = _a.parameters, hasRestParameter = _a.hasRestParameter;
return hasRestParameter ?
@@ -50424,7 +51287,7 @@
parameters.push(createCombinedSymbolFromTypes(symbols, ts.mapDefined(candidates, function (candidate) { return tryGetTypeAtPosition(candidate, i); })));
};
for (var i = 0; i < maxNonRestParam; i++) {
- _loop_8(i);
+ _loop_11(i);
}
var restParameterSymbols = ts.mapDefined(candidates, function (c) { return c.hasRestParameter ? ts.last(c.parameters) : undefined; });
var hasRestParameter = restParameterSymbols.length !== 0;
@@ -50502,7 +51365,7 @@
return maxParamsIndex;
}
function resolveCallExpression(node, candidatesOutArray, checkMode) {
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
var superType = checkSuperExpression(node.expression);
if (isTypeAny(superType)) {
for (var _i = 0, _a = node.arguments; _i < _a.length; _i++) {
@@ -50779,16 +51642,16 @@
*/
function getDiagnosticHeadMessageForDecoratorResolution(node) {
switch (node.parent.kind) {
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
return ts.Diagnostics.Unable_to_resolve_signature_of_class_decorator_when_called_as_an_expression;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return ts.Diagnostics.Unable_to_resolve_signature_of_parameter_decorator_when_called_as_an_expression;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return ts.Diagnostics.Unable_to_resolve_signature_of_property_decorator_when_called_as_an_expression;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return ts.Diagnostics.Unable_to_resolve_signature_of_method_decorator_when_called_as_an_expression;
default:
return ts.Debug.fail();
@@ -50831,7 +51694,7 @@
// file would probably be preferable.
var typeSymbol = exports && getSymbol(exports, JsxNames.Element, 67897832 /* Type */);
var returnNode = typeSymbol && nodeBuilder.symbolToEntityName(typeSymbol, 67897832 /* Type */, node);
- var declaration = ts.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.createKeywordTypeNode(120 /* AnyKeyword */));
+ var declaration = ts.createFunctionTypeNode(/*typeParameters*/ undefined, [ts.createParameter(/*decorators*/ undefined, /*modifiers*/ undefined, /*dotdotdot*/ undefined, "props", /*questionMark*/ undefined, nodeBuilder.typeToTypeNode(result, node))], returnNode ? ts.createTypeReferenceNode(returnNode, /*typeArguments*/ undefined) : ts.createKeywordTypeNode(121 /* AnyKeyword */));
var parameterSymbol = createSymbol(1 /* FunctionScopedVariable */, "props");
parameterSymbol.type = result;
return createSignature(declaration,
@@ -50878,16 +51741,16 @@
}
function resolveSignature(node, candidatesOutArray, checkMode) {
switch (node.kind) {
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return resolveCallExpression(node, candidatesOutArray, checkMode);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return resolveNewExpression(node, candidatesOutArray, checkMode);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return resolveTaggedTemplateExpression(node, candidatesOutArray, checkMode);
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
return resolveDecorator(node, candidatesOutArray, checkMode);
- case 262 /* JsxOpeningElement */:
- case 261 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
+ case 262 /* JsxSelfClosingElement */:
return resolveJsxOpeningLikeElement(node, candidatesOutArray, checkMode);
}
throw ts.Debug.assertNever(node, "Branch in 'resolveSignature' should be unreachable.");
@@ -50974,10 +51837,10 @@
return false;
}
var parent = node.parent;
- while (parent && parent.kind === 189 /* PropertyAccessExpression */) {
+ while (parent && parent.kind === 190 /* PropertyAccessExpression */) {
parent = parent.parent;
}
- if (parent && ts.isBinaryExpression(parent) && ts.isPrototypeAccess(parent.left) && parent.operatorToken.kind === 59 /* EqualsToken */) {
+ if (parent && ts.isBinaryExpression(parent) && ts.isPrototypeAccess(parent.left) && parent.operatorToken.kind === 60 /* EqualsToken */) {
var right = ts.getInitializerOfBinaryExpression(parent);
return ts.isObjectLiteralExpression(right) && right;
}
@@ -51003,15 +51866,15 @@
// returns a function type. We defer checking and return nonInferrableType.
return nonInferrableType;
}
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
return voidType;
}
- if (node.kind === 192 /* NewExpression */) {
+ if (node.kind === 193 /* NewExpression */) {
var declaration = signature.declaration;
if (declaration &&
- declaration.kind !== 157 /* Constructor */ &&
- declaration.kind !== 161 /* ConstructSignature */ &&
- declaration.kind !== 166 /* ConstructorType */ &&
+ declaration.kind !== 158 /* Constructor */ &&
+ declaration.kind !== 162 /* ConstructSignature */ &&
+ declaration.kind !== 167 /* ConstructorType */ &&
!ts.isJSDocConstructSignature(declaration) &&
!isJSConstructor(declaration)) {
// When resolved signature is a call signature (and not a construct signature) the result type is any
@@ -51128,9 +51991,9 @@
return false;
}
var targetDeclarationKind = resolvedRequire.flags & 16 /* Function */
- ? 239 /* FunctionDeclaration */
+ ? 240 /* FunctionDeclaration */
: resolvedRequire.flags & 3 /* Variable */
- ? 237 /* VariableDeclaration */
+ ? 238 /* VariableDeclaration */
: 0 /* Unknown */;
if (targetDeclarationKind !== 0 /* Unknown */) {
var decl = ts.getDeclarationOfKind(resolvedRequire, targetDeclarationKind);
@@ -51155,18 +52018,25 @@
case 14 /* NoSubstitutionTemplateLiteral */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
- case 187 /* ArrayLiteralExpression */:
- case 188 /* ObjectLiteralExpression */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
+ case 188 /* ArrayLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return true;
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return isValidConstAssertionArgument(node.expression);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
var op = node.operator;
var arg = node.operand;
return op === 39 /* MinusToken */ && (arg.kind === 8 /* NumericLiteral */ || arg.kind === 9 /* BigIntLiteral */) ||
op === 38 /* PlusToken */ && arg.kind === 8 /* NumericLiteral */;
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
+ var expr = node.expression;
+ if (ts.isIdentifier(expr)) {
+ var symbol = getSymbolAtLocation(expr);
+ return !!(symbol && (symbol.flags & 384 /* Enum */) && getEnumKind(symbol) === 1 /* Literal */);
+ }
}
return false;
}
@@ -51174,7 +52044,7 @@
var exprType = checkExpression(expression, checkMode);
if (ts.isConstTypeReference(type)) {
if (!isValidConstAssertionArgument(expression)) {
- error(expression, ts.Diagnostics.A_const_assertion_can_only_be_applied_to_a_string_number_boolean_array_or_object_literal);
+ error(expression, ts.Diagnostics.A_const_assertions_can_only_be_applied_to_references_to_enum_members_or_string_number_boolean_array_or_object_literals);
}
return getRegularTypeOfLiteralType(exprType);
}
@@ -51194,10 +52064,10 @@
}
function checkMetaProperty(node) {
checkGrammarMetaProperty(node);
- if (node.keywordToken === 95 /* NewKeyword */) {
+ if (node.keywordToken === 96 /* NewKeyword */) {
return checkNewTargetMetaProperty(node);
}
- if (node.keywordToken === 92 /* ImportKeyword */) {
+ if (node.keywordToken === 93 /* ImportKeyword */) {
return checkImportMetaProperty(node);
}
return ts.Debug.assertNever(node.keywordToken);
@@ -51208,7 +52078,7 @@
error(node, ts.Diagnostics.Meta_property_0_is_only_allowed_in_the_body_of_a_function_declaration_function_expression_or_constructor, "new.target");
return errorType;
}
- else if (container.kind === 157 /* Constructor */) {
+ else if (container.kind === 158 /* Constructor */) {
var symbol = getSymbolOfNode(container.parent);
return getTypeOfSymbol(symbol);
}
@@ -51218,7 +52088,7 @@
}
}
function checkImportMetaProperty(node) {
- if (languageVersion < 7 /* ESNext */ || moduleKind < ts.ModuleKind.ESNext) {
+ if (languageVersion < 8 /* ESNext */ || moduleKind < ts.ModuleKind.ESNext) {
error(node, ts.Diagnostics.The_import_meta_meta_property_is_only_allowed_using_ESNext_for_the_target_and_module_compiler_options);
}
var file = ts.getSourceFileOfNode(node);
@@ -51394,7 +52264,7 @@
for (var _i = 0, _a = pattern.elements; _i < _a.length; _i++) {
var element = _a[_i];
if (!ts.isOmittedExpression(element)) {
- if (element.name.kind === 72 /* Identifier */) {
+ if (element.name.kind === 73 /* Identifier */) {
getSymbolLinks(getSymbolOfNode(element)).type = getTypeForBindingElement(element);
}
else {
@@ -51408,9 +52278,9 @@
if (!links.type) {
links.type = contextualType;
var decl = parameter.valueDeclaration;
- if (decl.name.kind !== 72 /* Identifier */) {
+ if (decl.name.kind !== 73 /* Identifier */) {
// if inference didn't come up with anything but {}, fall back to the binding pattern if present.
- if (links.type === emptyObjectType) {
+ if (links.type === unknownType) {
links.type = getTypeFromBindingPattern(decl.name);
}
assignBindingElementTypes(decl.name);
@@ -51422,24 +52292,24 @@
var globalPromiseType = getGlobalPromiseType(/*reportErrors*/ true);
if (globalPromiseType !== emptyGenericType) {
// if the promised type is itself a promise, get the underlying type; otherwise, fallback to the promised type
- promisedType = getAwaitedType(promisedType) || emptyObjectType;
+ promisedType = getAwaitedType(promisedType) || unknownType;
return createTypeReference(globalPromiseType, [promisedType]);
}
- return emptyObjectType;
+ return unknownType;
}
function createPromiseLikeType(promisedType) {
// creates a `PromiseLike<T>` type where `T` is the promisedType argument
var globalPromiseLikeType = getGlobalPromiseLikeType(/*reportErrors*/ true);
if (globalPromiseLikeType !== emptyGenericType) {
// if the promised type is itself a promise, get the underlying type; otherwise, fallback to the promised type
- promisedType = getAwaitedType(promisedType) || emptyObjectType;
+ promisedType = getAwaitedType(promisedType) || unknownType;
return createTypeReference(globalPromiseLikeType, [promisedType]);
}
- return emptyObjectType;
+ return unknownType;
}
function createPromiseReturnType(func, promisedType) {
var promiseType = createPromiseType(promisedType);
- if (promiseType === emptyObjectType) {
+ if (promiseType === unknownType) {
error(func, ts.isImportCall(func) ?
ts.Diagnostics.A_dynamic_import_call_returns_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option :
ts.Diagnostics.An_async_function_or_method_must_return_a_Promise_Make_sure_you_have_a_declaration_for_Promise_or_include_ES2015_in_your_lib_option);
@@ -51458,7 +52328,7 @@
}
var functionFlags = ts.getFunctionFlags(func);
var type;
- if (func.body.kind !== 218 /* Block */) {
+ if (func.body.kind !== 219 /* Block */) {
type = checkExpressionCached(func.body, checkMode && checkMode & ~8 /* SkipGenericFunctions */);
if (functionFlags & 2 /* Async */) {
// From within an async function you can return either a non-promise value or a promise. Any
@@ -51600,7 +52470,7 @@
if (!node.possiblyExhaustive) {
return false;
}
- if (node.expression.kind === 199 /* TypeOfExpression */) {
+ if (node.expression.kind === 200 /* TypeOfExpression */) {
var operandType = getTypeOfExpression(node.expression.expression);
// This cast is safe because the switch is possibly exhaustive and does not contain a default case, so there can be no undefined.
var witnesses = getSwitchClauseTypeOfWitnesses(node);
@@ -51623,7 +52493,7 @@
if (!(func.flags & 128 /* HasImplicitReturn */)) {
return false;
}
- if (ts.some(func.body.statements, function (statement) { return statement.kind === 232 /* SwitchStatement */ && isExhaustiveSwitchStatement(statement); })) {
+ if (ts.some(func.body.statements, function (statement) { return statement.kind === 233 /* SwitchStatement */ && isExhaustiveSwitchStatement(statement); })) {
return false;
}
return true;
@@ -51666,11 +52536,11 @@
}
function mayReturnNever(func) {
switch (func.kind) {
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return true;
- case 156 /* MethodDeclaration */:
- return func.parent.kind === 188 /* ObjectLiteralExpression */;
+ case 157 /* MethodDeclaration */:
+ return func.parent.kind === 189 /* ObjectLiteralExpression */;
default:
return false;
}
@@ -51694,7 +52564,7 @@
}
// If all we have is a function signature, or an arrow function with an expression body, then there is nothing to check.
// also if HasImplicitReturn flag is not set this means that all codepaths in function body end with return or throw
- if (func.kind === 155 /* MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 218 /* Block */ || !functionHasImplicitReturn(func)) {
+ if (func.kind === 156 /* MethodSignature */ || ts.nodeIsMissing(func.body) || func.body.kind !== 219 /* Block */ || !functionHasImplicitReturn(func)) {
return;
}
var hasExplicitReturn = func.flags & 256 /* HasExplicitReturn */;
@@ -51727,7 +52597,7 @@
}
}
function checkFunctionExpressionOrObjectLiteralMethod(node, checkMode) {
- ts.Debug.assert(node.kind !== 156 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
+ ts.Debug.assert(node.kind !== 157 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
checkNodeDeferred(node);
// The identityMapper object is used to indicate that function expressions are wildcards
if (checkMode && checkMode & 4 /* SkipContextSensitive */ && isContextSensitive(node)) {
@@ -51747,7 +52617,7 @@
}
// Grammar checking
var hasGrammarError = checkGrammarFunctionLikeDeclaration(node);
- if (!hasGrammarError && node.kind === 196 /* FunctionExpression */) {
+ if (!hasGrammarError && node.kind === 197 /* FunctionExpression */) {
checkGrammarForGenerator(node);
}
var links = getNodeLinks(node);
@@ -51792,7 +52662,7 @@
getAwaitedType(type) || errorType : type;
}
function checkFunctionExpressionOrObjectLiteralMethodDeferred(node) {
- ts.Debug.assert(node.kind !== 156 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
+ ts.Debug.assert(node.kind !== 157 /* MethodDeclaration */ || ts.isObjectLiteralMethod(node));
var functionFlags = ts.getFunctionFlags(node);
var returnOrPromisedType = getReturnOrPromisedType(node, functionFlags);
if ((functionFlags & 1 /* Generator */) === 0) { // Async function or normal function
@@ -51808,7 +52678,7 @@
// checkFunctionExpressionBodies). So it must be done now.
getReturnTypeOfSignature(getSignatureFromDeclaration(node));
}
- if (node.body.kind === 218 /* Block */) {
+ if (node.body.kind === 219 /* Block */) {
checkSourceElement(node.body);
}
else {
@@ -51886,11 +52756,11 @@
if (isReadonlySymbol(symbol)) {
// Allow assignments to readonly properties within constructors of the same class declaration.
if (symbol.flags & 4 /* Property */ &&
- (expr.kind === 189 /* PropertyAccessExpression */ || expr.kind === 190 /* ElementAccessExpression */) &&
- expr.expression.kind === 100 /* ThisKeyword */) {
+ (expr.kind === 190 /* PropertyAccessExpression */ || expr.kind === 191 /* ElementAccessExpression */) &&
+ expr.expression.kind === 101 /* ThisKeyword */) {
// Look for if this is the constructor for the class that `symbol` is a property of.
var func = ts.getContainingFunction(expr);
- if (!(func && func.kind === 157 /* Constructor */)) {
+ if (!(func && func.kind === 158 /* Constructor */)) {
return true;
}
// If func.parent is a class and symbol is a (readonly) property of that class, or
@@ -51903,13 +52773,13 @@
return false;
}
function isReferenceThroughNamespaceImport(expr) {
- if (expr.kind === 189 /* PropertyAccessExpression */ || expr.kind === 190 /* ElementAccessExpression */) {
+ if (expr.kind === 190 /* PropertyAccessExpression */ || expr.kind === 191 /* ElementAccessExpression */) {
var node = ts.skipParentheses(expr.expression);
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
var symbol = getNodeLinks(node).resolvedSymbol;
if (symbol.flags & 2097152 /* Alias */) {
var declaration = getDeclarationOfAliasSymbol(symbol);
- return !!declaration && declaration.kind === 251 /* NamespaceImport */;
+ return !!declaration && declaration.kind === 252 /* NamespaceImport */;
}
}
}
@@ -51918,7 +52788,7 @@
function checkReferenceExpression(expr, invalidReferenceMessage) {
// References are combinations of identifiers, parentheses, and property accesses.
var node = ts.skipOuterExpressions(expr, 2 /* Assertions */ | 1 /* Parentheses */);
- if (node.kind !== 72 /* Identifier */ && node.kind !== 189 /* PropertyAccessExpression */ && node.kind !== 190 /* ElementAccessExpression */) {
+ if (node.kind !== 73 /* Identifier */ && node.kind !== 190 /* PropertyAccessExpression */ && node.kind !== 191 /* ElementAccessExpression */) {
error(expr, invalidReferenceMessage);
return false;
}
@@ -51927,7 +52797,7 @@
function checkDeleteExpression(node) {
checkExpression(node.expression);
var expr = ts.skipParentheses(node.expression);
- if (expr.kind !== 189 /* PropertyAccessExpression */ && expr.kind !== 190 /* ElementAccessExpression */) {
+ if (expr.kind !== 190 /* PropertyAccessExpression */ && expr.kind !== 191 /* ElementAccessExpression */) {
error(expr, ts.Diagnostics.The_operand_of_a_delete_operator_must_be_a_property_reference);
return booleanType;
}
@@ -51950,7 +52820,19 @@
// Grammar checking
if (produceDiagnostics) {
if (!(node.flags & 16384 /* AwaitContext */)) {
- grammarErrorOnFirstToken(node, ts.Diagnostics.await_expression_is_only_allowed_within_an_async_function);
+ // use of 'await' in non-async function
+ var sourceFile = ts.getSourceFileOfNode(node);
+ if (!hasParseDiagnostics(sourceFile)) {
+ var span = ts.getSpanOfTokenAtPosition(sourceFile, node.pos);
+ var diagnostic = ts.createFileDiagnostic(sourceFile, span.start, span.length, ts.Diagnostics.await_expression_is_only_allowed_within_an_async_function);
+ var func = ts.getContainingFunction(node);
+ if (func && func.kind !== 158 /* Constructor */) {
+ ts.Debug.assert((ts.getFunctionFlags(func) & 2 /* Async */) === 0, "Enclosing function should never be an async function.");
+ var relatedInfo = ts.createDiagnosticForNode(func, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async);
+ ts.addRelatedInfo(diagnostic, relatedInfo);
+ }
+ diagnostics.add(diagnostic);
+ }
}
if (isInParameterInitializerBeforeContainingFunction(node)) {
error(node, ts.Diagnostics.await_expressions_cannot_be_used_in_a_parameter_initializer);
@@ -52042,8 +52924,8 @@
}
if (type.flags & 3145728 /* UnionOrIntersection */) {
var types = type.types;
- for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
- var t = types_16[_i];
+ for (var _i = 0, types_15 = types; _i < types_15.length; _i++) {
+ var t = types_15[_i];
if (maybeTypeOfKind(t, kind)) {
return true;
}
@@ -52122,16 +53004,17 @@
if (strictNullChecks && properties.length === 0) {
return checkNonNullType(sourceType, node);
}
- for (var _i = 0, properties_5 = properties; _i < properties_5.length; _i++) {
- var p = properties_5[_i];
- checkObjectLiteralDestructuringPropertyAssignment(sourceType, p, properties, rightIsThis);
+ for (var i = 0; i < properties.length; i++) {
+ checkObjectLiteralDestructuringPropertyAssignment(node, sourceType, i, properties, rightIsThis);
}
return sourceType;
}
/** Note: If property cannot be a SpreadAssignment, then allProperties does not need to be provided */
- function checkObjectLiteralDestructuringPropertyAssignment(objectLiteralType, property, allProperties, rightIsThis) {
+ function checkObjectLiteralDestructuringPropertyAssignment(node, objectLiteralType, propertyIndex, allProperties, rightIsThis) {
if (rightIsThis === void 0) { rightIsThis = false; }
- if (property.kind === 275 /* PropertyAssignment */ || property.kind === 276 /* ShorthandPropertyAssignment */) {
+ var properties = node.properties;
+ var property = properties[propertyIndex];
+ if (property.kind === 276 /* PropertyAssignment */ || property.kind === 277 /* ShorthandPropertyAssignment */) {
var name = property.name;
var exprType = getLiteralTypeFromPropertyName(name);
if (isTypeUsableAsPropertyName(exprType)) {
@@ -52144,22 +53027,30 @@
}
var elementType = getIndexedAccessType(objectLiteralType, exprType, name);
var type = getFlowTypeOfDestructuring(property, elementType);
- return checkDestructuringAssignment(property.kind === 276 /* ShorthandPropertyAssignment */ ? property : property.initializer, type);
+ return checkDestructuringAssignment(property.kind === 277 /* ShorthandPropertyAssignment */ ? property : property.initializer, type);
+ }
+ else if (property.kind === 278 /* SpreadAssignment */) {
+ if (propertyIndex < properties.length - 1) {
+ error(property, ts.Diagnostics.A_rest_element_must_be_last_in_a_destructuring_pattern);
}
- else if (property.kind === 277 /* SpreadAssignment */) {
- if (languageVersion < 7 /* ESNext */) {
+ else {
+ if (languageVersion < 8 /* ESNext */) {
checkExternalEmitHelpers(property, 4 /* Rest */);
}
var nonRestNames = [];
if (allProperties) {
- for (var i = 0; i < allProperties.length - 1; i++) {
- nonRestNames.push(allProperties[i].name);
+ for (var _i = 0, allProperties_1 = allProperties; _i < allProperties_1.length; _i++) {
+ var otherProperty = allProperties_1[_i];
+ if (!ts.isSpreadAssignment(otherProperty)) {
+ nonRestNames.push(otherProperty.name);
+ }
}
}
var type = getRestType(objectLiteralType, nonRestNames, objectLiteralType.symbol);
checkGrammarForDisallowedTrailingComma(allProperties, ts.Diagnostics.A_rest_parameter_or_binding_pattern_may_not_have_a_trailing_comma);
return checkDestructuringAssignment(property.expression, type);
}
+ }
else {
error(property, ts.Diagnostics.Property_assignment_expected);
}
@@ -52181,8 +53072,8 @@
function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, checkMode) {
var elements = node.elements;
var element = elements[elementIndex];
- if (element.kind !== 210 /* OmittedExpression */) {
- if (element.kind !== 208 /* SpreadElement */) {
+ if (element.kind !== 211 /* OmittedExpression */) {
+ if (element.kind !== 209 /* SpreadElement */) {
var indexType = getLiteralType(elementIndex);
if (isArrayLikeType(sourceType)) {
// We create a synthetic expression so that getIndexedAccessType doesn't get confused
@@ -52198,7 +53089,7 @@
}
else {
var restExpression = element.expression;
- if (restExpression.kind === 204 /* BinaryExpression */ && restExpression.operatorToken.kind === 59 /* EqualsToken */) {
+ if (restExpression.kind === 205 /* BinaryExpression */ && restExpression.operatorToken.kind === 60 /* EqualsToken */) {
error(restExpression.operatorToken, ts.Diagnostics.A_rest_element_cannot_have_an_initializer);
}
else {
@@ -52214,7 +53105,7 @@
}
function checkDestructuringAssignment(exprOrAssignment, sourceType, checkMode, rightIsThis) {
var target;
- if (exprOrAssignment.kind === 276 /* ShorthandPropertyAssignment */) {
+ if (exprOrAssignment.kind === 277 /* ShorthandPropertyAssignment */) {
var prop = exprOrAssignment;
if (prop.objectAssignmentInitializer) {
// In strict null checking mode, if a default value of a non-undefined type is specified, remove
@@ -52230,21 +53121,21 @@
else {
target = exprOrAssignment;
}
- if (target.kind === 204 /* BinaryExpression */ && target.operatorToken.kind === 59 /* EqualsToken */) {
+ if (target.kind === 205 /* BinaryExpression */ && target.operatorToken.kind === 60 /* EqualsToken */) {
checkBinaryExpression(target, checkMode);
target = target.left;
}
- if (target.kind === 188 /* ObjectLiteralExpression */) {
+ if (target.kind === 189 /* ObjectLiteralExpression */) {
return checkObjectLiteralAssignment(target, sourceType, rightIsThis);
}
- if (target.kind === 187 /* ArrayLiteralExpression */) {
+ if (target.kind === 188 /* ArrayLiteralExpression */) {
return checkArrayLiteralAssignment(target, sourceType, checkMode);
}
return checkReferenceAssignment(target, sourceType, checkMode);
}
function checkReferenceAssignment(target, sourceType, checkMode) {
var targetType = checkExpression(target, checkMode);
- var error = target.parent.kind === 277 /* SpreadAssignment */ ?
+ var error = target.parent.kind === 278 /* SpreadAssignment */ ?
ts.Diagnostics.The_target_of_an_object_rest_assignment_must_be_a_variable_or_a_property_access :
ts.Diagnostics.The_left_hand_side_of_an_assignment_expression_must_be_a_variable_or_a_property_access;
if (checkReferenceExpression(target, error)) {
@@ -52263,39 +53154,39 @@
function isSideEffectFree(node) {
node = ts.skipParentheses(node);
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
case 10 /* StringLiteral */:
case 13 /* RegularExpressionLiteral */:
- case 193 /* TaggedTemplateExpression */:
- case 206 /* TemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
+ case 207 /* TemplateExpression */:
case 14 /* NoSubstitutionTemplateLiteral */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
- case 96 /* NullKeyword */:
- case 141 /* UndefinedKeyword */:
- case 196 /* FunctionExpression */:
- case 209 /* ClassExpression */:
- case 197 /* ArrowFunction */:
- case 187 /* ArrayLiteralExpression */:
- case 188 /* ObjectLiteralExpression */:
- case 199 /* TypeOfExpression */:
- case 213 /* NonNullExpression */:
- case 261 /* JsxSelfClosingElement */:
- case 260 /* JsxElement */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
+ case 97 /* NullKeyword */:
+ case 142 /* UndefinedKeyword */:
+ case 197 /* FunctionExpression */:
+ case 210 /* ClassExpression */:
+ case 198 /* ArrowFunction */:
+ case 188 /* ArrayLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
+ case 200 /* TypeOfExpression */:
+ case 214 /* NonNullExpression */:
+ case 262 /* JsxSelfClosingElement */:
+ case 261 /* JsxElement */:
return true;
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return isSideEffectFree(node.whenTrue) &&
isSideEffectFree(node.whenFalse);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
if (ts.isAssignmentOperator(node.operatorToken.kind)) {
return false;
}
return isSideEffectFree(node.left) &&
isSideEffectFree(node.right);
- case 202 /* PrefixUnaryExpression */:
- case 203 /* PostfixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
// Unary operators ~, !, +, and - have no side effects.
// The rest do.
switch (node.operator) {
@@ -52307,9 +53198,9 @@
}
return false;
// Some forms listed here for clarity
- case 200 /* VoidExpression */: // Explicit opt-out
- case 194 /* TypeAssertionExpression */: // Not SEF, but can produce useful type warnings
- case 212 /* AsExpression */: // Not SEF, but can produce useful type warnings
+ case 201 /* VoidExpression */: // Explicit opt-out
+ case 195 /* TypeAssertionExpression */: // Not SEF, but can produce useful type warnings
+ case 213 /* AsExpression */: // Not SEF, but can produce useful type warnings
default:
return false;
}
@@ -52325,8 +53216,8 @@
}
function checkBinaryLikeExpression(left, operatorToken, right, checkMode, errorNode) {
var operator = operatorToken.kind;
- if (operator === 59 /* EqualsToken */ && (left.kind === 188 /* ObjectLiteralExpression */ || left.kind === 187 /* ArrayLiteralExpression */)) {
- return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode, right.kind === 100 /* ThisKeyword */);
+ if (operator === 60 /* EqualsToken */ && (left.kind === 189 /* ObjectLiteralExpression */ || left.kind === 188 /* ArrayLiteralExpression */)) {
+ return checkDestructuringAssignment(left, checkExpression(right, checkMode), checkMode, right.kind === 101 /* ThisKeyword */);
}
var leftType;
if (operator === 54 /* AmpersandAmpersandToken */ || operator === 55 /* BarBarToken */) {
@@ -52339,26 +53230,26 @@
switch (operator) {
case 40 /* AsteriskToken */:
case 41 /* AsteriskAsteriskToken */:
- case 62 /* AsteriskEqualsToken */:
- case 63 /* AsteriskAsteriskEqualsToken */:
+ case 63 /* AsteriskEqualsToken */:
+ case 64 /* AsteriskAsteriskEqualsToken */:
case 42 /* SlashToken */:
- case 64 /* SlashEqualsToken */:
+ case 65 /* SlashEqualsToken */:
case 43 /* PercentToken */:
- case 65 /* PercentEqualsToken */:
+ case 66 /* PercentEqualsToken */:
case 39 /* MinusToken */:
- case 61 /* MinusEqualsToken */:
+ case 62 /* MinusEqualsToken */:
case 46 /* LessThanLessThanToken */:
- case 66 /* LessThanLessThanEqualsToken */:
+ case 67 /* LessThanLessThanEqualsToken */:
case 47 /* GreaterThanGreaterThanToken */:
- case 67 /* GreaterThanGreaterThanEqualsToken */:
+ case 68 /* GreaterThanGreaterThanEqualsToken */:
case 48 /* GreaterThanGreaterThanGreaterThanToken */:
- case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
+ case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
case 50 /* BarToken */:
- case 70 /* BarEqualsToken */:
+ case 71 /* BarEqualsToken */:
case 51 /* CaretToken */:
- case 71 /* CaretEqualsToken */:
+ case 72 /* CaretEqualsToken */:
case 49 /* AmpersandToken */:
- case 69 /* AmpersandEqualsToken */:
+ case 70 /* AmpersandEqualsToken */:
if (leftType === silentNeverType || rightType === silentNeverType) {
return silentNeverType;
}
@@ -52388,7 +53279,7 @@
else if (isTypeAssignableToKind(leftType, 2112 /* BigIntLike */) && isTypeAssignableToKind(rightType, 2112 /* BigIntLike */)) {
switch (operator) {
case 48 /* GreaterThanGreaterThanGreaterThanToken */:
- case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
+ case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */:
reportOperatorError();
}
resultType_1 = bigintType;
@@ -52403,7 +53294,7 @@
return resultType_1;
}
case 38 /* PlusToken */:
- case 60 /* PlusEqualsToken */:
+ case 61 /* PlusEqualsToken */:
if (leftType === silentNeverType || rightType === silentNeverType) {
return silentNeverType;
}
@@ -52438,7 +53329,7 @@
reportOperatorError();
return anyType;
}
- if (operator === 60 /* PlusEqualsToken */) {
+ if (operator === 61 /* PlusEqualsToken */) {
checkAssignmentOperator(resultType);
}
return resultType;
@@ -52459,19 +53350,13 @@
case 34 /* ExclamationEqualsToken */:
case 35 /* EqualsEqualsEqualsToken */:
case 36 /* ExclamationEqualsEqualsToken */:
- var leftIsLiteral = isLiteralType(leftType);
- var rightIsLiteral = isLiteralType(rightType);
- if (!leftIsLiteral || !rightIsLiteral) {
- leftType = leftIsLiteral ? getBaseTypeOfLiteralType(leftType) : leftType;
- rightType = rightIsLiteral ? getBaseTypeOfLiteralType(rightType) : rightType;
- }
if (!isTypeEqualityComparableTo(leftType, rightType) && !isTypeEqualityComparableTo(rightType, leftType)) {
reportOperatorError();
}
return booleanType;
- case 94 /* InstanceOfKeyword */:
+ case 95 /* InstanceOfKeyword */:
return checkInstanceOfExpression(left, right, leftType, rightType);
- case 93 /* InKeyword */:
+ case 94 /* InKeyword */:
return checkInExpression(left, right, leftType, rightType);
case 54 /* AmpersandAmpersandToken */:
return getTypeFacts(leftType) & 4194304 /* Truthy */ ?
@@ -52481,7 +53366,7 @@
return getTypeFacts(leftType) & 8388608 /* Falsy */ ?
getUnionType([removeDefinitelyFalsyTypes(leftType), rightType], 2 /* Subtype */) :
leftType;
- case 59 /* EqualsToken */:
+ case 60 /* EqualsToken */:
var declKind = ts.isBinaryExpression(left.parent) ? ts.getAssignmentDeclarationKind(left.parent) : 0 /* None */;
checkAssignmentDeclaration(declKind, rightType);
if (isAssignmentDeclaration(declKind)) {
@@ -52525,7 +53410,7 @@
}
}
function isEvalNode(node) {
- return node.kind === 72 /* Identifier */ && node.escapedText === "eval";
+ return node.kind === 73 /* Identifier */ && node.escapedText === "eval";
}
// Return true if there was no error, false if there was an error.
function checkForDisallowedESSymbolOperand(operator) {
@@ -52541,13 +53426,13 @@
function getSuggestedBooleanOperator(operator) {
switch (operator) {
case 50 /* BarToken */:
- case 70 /* BarEqualsToken */:
+ case 71 /* BarEqualsToken */:
return 55 /* BarBarToken */;
case 51 /* CaretToken */:
- case 71 /* CaretEqualsToken */:
+ case 72 /* CaretEqualsToken */:
return 36 /* ExclamationEqualsEqualsToken */;
case 49 /* AmpersandToken */:
- case 69 /* AmpersandEqualsToken */:
+ case 70 /* AmpersandEqualsToken */:
return 54 /* AmpersandAmpersandToken */;
default:
return undefined;
@@ -52586,8 +53471,7 @@
}
}
function reportOperatorError() {
- var leftStr = typeToString(leftType);
- var rightStr = typeToString(rightType);
+ var _a = getTypeNamesForErrorDisplay(leftType, rightType), leftStr = _a[0], rightStr = _a[1];
var errNode = errorNode || operatorToken;
if (!tryGiveBetterPrimaryError(errNode, leftStr, rightStr)) {
error(errNode, ts.Diagnostics.Operator_0_cannot_be_applied_to_types_1_and_2, ts.tokenToString(operatorToken.kind), leftStr, rightStr);
@@ -52642,7 +53526,7 @@
// Async generator functions prior to ESNext require the __await, __asyncDelegator,
// and __asyncValues helpers
if ((functionFlags & 3 /* AsyncGenerator */) === 3 /* AsyncGenerator */ &&
- languageVersion < 7 /* ESNext */) {
+ languageVersion < 8 /* ESNext */) {
checkExternalEmitHelpers(node, 26624 /* AsyncDelegatorIncludes */);
}
// Generator functions prior to ES2015 require the __values helper
@@ -52684,7 +53568,7 @@
return stringType;
}
function getContextNode(node) {
- if (node.kind === 268 /* JsxAttributes */ && !ts.isJsxSelfClosingElement(node.parent)) {
+ if (node.kind === 269 /* JsxAttributes */ && !ts.isJsxSelfClosingElement(node.parent)) {
return node.parent.parent; // Needs to be the root JsxElement, so it encompasses the attributes _and_ the children (which are essentially part of the attributes)
}
return node;
@@ -52723,7 +53607,7 @@
}
function isTypeAssertion(node) {
node = ts.skipParentheses(node);
- return node.kind === 194 /* TypeAssertionExpression */ || node.kind === 212 /* AsExpression */;
+ return node.kind === 195 /* TypeAssertionExpression */ || node.kind === 213 /* AsExpression */;
}
function checkDeclarationInitializer(declaration) {
var initializer = ts.getEffectiveInitializer(declaration);
@@ -52754,7 +53638,7 @@
// If the contextual type is a type variable constrained to a primitive type, consider
// this a literal context for literals of that primitive type. For example, given a
// type parameter 'T extends string', infer string literal types for T.
- var constraint = getBaseConstraintOfType(contextualType) || emptyObjectType;
+ var constraint = getBaseConstraintOfType(contextualType) || unknownType;
return maybeTypeOfKind(constraint, 4 /* String */) && maybeTypeOfKind(candidateType, 128 /* StringLiteral */) ||
maybeTypeOfKind(constraint, 8 /* Number */) && maybeTypeOfKind(candidateType, 256 /* NumberLiteral */) ||
maybeTypeOfKind(constraint, 64 /* BigInt */) && maybeTypeOfKind(candidateType, 2048 /* BigIntLiteral */) ||
@@ -52787,7 +53671,7 @@
// Do not use hasDynamicName here, because that returns false for well known symbols.
// We want to perform checkComputedPropertyName for all computed properties, including
// well known symbols.
- if (node.name.kind === 149 /* ComputedPropertyName */) {
+ if (node.name.kind === 150 /* ComputedPropertyName */) {
checkComputedPropertyName(node.name);
}
return checkExpressionForMutableLocation(node.initializer, checkMode);
@@ -52798,7 +53682,7 @@
// Do not use hasDynamicName here, because that returns false for well known symbols.
// We want to perform checkComputedPropertyName for all computed properties, including
// well known symbols.
- if (node.name.kind === 149 /* ComputedPropertyName */) {
+ if (node.name.kind === 150 /* ComputedPropertyName */) {
checkComputedPropertyName(node.name);
}
var uninstantiatedType = checkFunctionExpressionOrObjectLiteralMethod(node, checkMode);
@@ -52806,16 +53690,18 @@
}
function instantiateTypeWithSingleGenericCallSignature(node, type, checkMode) {
if (checkMode && checkMode & (2 /* Inferential */ | 8 /* SkipGenericFunctions */)) {
- var signature = getSingleCallSignature(type);
+ var callSignature = getSingleSignature(type, 0 /* Call */, /*allowMembers*/ true);
+ var constructSignature = getSingleSignature(type, 1 /* Construct */, /*allowMembers*/ true);
+ var signature = callSignature || constructSignature;
if (signature && signature.typeParameters) {
+ var contextualType = getApparentTypeOfContextualType(node);
+ if (contextualType && !isMixinConstructorType(contextualType)) {
+ var contextualSignature = getSingleSignature(getNonNullableType(contextualType), callSignature ? 0 /* Call */ : 1 /* Construct */, /*allowMembers*/ false);
+ if (contextualSignature && !contextualSignature.typeParameters) {
if (checkMode & 8 /* SkipGenericFunctions */) {
skippedGenericFunction(node, checkMode);
return anyFunctionType;
}
- var contextualType = getApparentTypeOfContextualType(node);
- if (contextualType) {
- var contextualSignature = getSingleCallSignature(getNonNullableType(contextualType));
- if (contextualSignature && !contextualSignature.typeParameters) {
var context = getInferenceContext(node);
// We have an expression that is an argument of a generic function for which we are performing
// type argument inference. The expression is of a function type with a single generic call
@@ -52823,7 +53709,8 @@
// if the outer function returns a function type with a single non-generic call signature and
// if some of the outer function type parameters have no inferences so far. If so, we can
// potentially add inferred type parameters to the outer function return type.
- var returnSignature = context.signature && getSingleCallSignature(getReturnTypeOfSignature(context.signature));
+ var returnType = context.signature && getReturnTypeOfSignature(context.signature);
+ var returnSignature = returnType && getSingleCallOrConstructSignature(returnType);
if (returnSignature && !returnSignature.typeParameters && !ts.every(context.inferences, hasInferenceCandidates)) {
// Instantiate the signature with its own type parameters as type arguments, possibly
// renaming the type parameters to ensure they have unique names.
@@ -52938,7 +53825,7 @@
var expr = ts.skipParentheses(node);
// Optimize for the common case of a call to a function with a single non-generic call
// signature where we can just fetch the return type without checking the arguments.
- if (expr.kind === 191 /* CallExpression */ && expr.expression.kind !== 98 /* SuperKeyword */ && !ts.isRequireCall(expr, /*checkArgumentIsStringLiteralLike*/ true) && !isSymbolOrSymbolForCall(expr)) {
+ if (expr.kind === 192 /* CallExpression */ && expr.expression.kind !== 99 /* SuperKeyword */ && !ts.isRequireCall(expr, /*checkArgumentIsStringLiteralLike*/ true) && !isSymbolOrSymbolForCall(expr)) {
var funcType = checkNonNullExpression(expr.expression);
var signature = getSingleCallSignature(funcType);
if (signature && !signature.typeParameters) {
@@ -52987,10 +53874,10 @@
// - 'left' in property access
// - 'object' in indexed access
// - target in rhs of import statement
- var ok = (node.parent.kind === 189 /* PropertyAccessExpression */ && node.parent.expression === node) ||
- (node.parent.kind === 190 /* ElementAccessExpression */ && node.parent.expression === node) ||
- ((node.kind === 72 /* Identifier */ || node.kind === 148 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) ||
- (node.parent.kind === 167 /* TypeQuery */ && node.parent.exprName === node));
+ var ok = (node.parent.kind === 190 /* PropertyAccessExpression */ && node.parent.expression === node) ||
+ (node.parent.kind === 191 /* ElementAccessExpression */ && node.parent.expression === node) ||
+ ((node.kind === 73 /* Identifier */ || node.kind === 149 /* QualifiedName */) && isInRightSideOfImportOrExportAssignment(node) ||
+ (node.parent.kind === 168 /* TypeQuery */ && node.parent.exprName === node));
if (!ok) {
error(node, ts.Diagnostics.const_enums_can_only_be_used_in_property_or_index_access_expressions_or_the_right_hand_side_of_an_import_declaration_or_export_assignment_or_type_query);
}
@@ -53011,13 +53898,13 @@
}
function checkExpressionWorker(node, checkMode, forceTuple) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return checkIdentifier(node);
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
return checkThisExpression(node);
- case 98 /* SuperKeyword */:
+ case 99 /* SuperKeyword */:
return checkSuperExpression(node);
- case 96 /* NullKeyword */:
+ case 97 /* NullKeyword */:
return nullWideningType;
case 14 /* NoSubstitutionTemplateLiteral */:
case 10 /* StringLiteral */:
@@ -53028,82 +53915,82 @@
case 9 /* BigIntLiteral */:
checkGrammarBigIntLiteral(node);
return getFreshTypeOfLiteralType(getBigIntLiteralType(node));
- case 102 /* TrueKeyword */:
+ case 103 /* TrueKeyword */:
return trueType;
- case 87 /* FalseKeyword */:
+ case 88 /* FalseKeyword */:
return falseType;
- case 206 /* TemplateExpression */:
+ case 207 /* TemplateExpression */:
return checkTemplateExpression(node);
case 13 /* RegularExpressionLiteral */:
return globalRegExpType;
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return checkArrayLiteral(node, checkMode, forceTuple);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return checkObjectLiteral(node, checkMode);
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return checkPropertyAccessExpression(node);
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
return checkQualifiedName(node);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return checkIndexedAccess(node);
- case 191 /* CallExpression */:
- if (node.expression.kind === 92 /* ImportKeyword */) {
+ case 192 /* CallExpression */:
+ if (node.expression.kind === 93 /* ImportKeyword */) {
return checkImportCallExpression(node);
}
/* falls through */
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return checkCallExpression(node, checkMode);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return checkTaggedTemplateExpression(node);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return checkParenthesizedExpression(node, checkMode);
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
return checkClassExpression(node);
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return checkFunctionExpressionOrObjectLiteralMethod(node, checkMode);
- case 199 /* TypeOfExpression */:
+ case 200 /* TypeOfExpression */:
return checkTypeOfExpression(node);
- case 194 /* TypeAssertionExpression */:
- case 212 /* AsExpression */:
+ case 195 /* TypeAssertionExpression */:
+ case 213 /* AsExpression */:
return checkAssertion(node);
- case 213 /* NonNullExpression */:
+ case 214 /* NonNullExpression */:
return checkNonNullAssertion(node);
- case 214 /* MetaProperty */:
+ case 215 /* MetaProperty */:
return checkMetaProperty(node);
- case 198 /* DeleteExpression */:
+ case 199 /* DeleteExpression */:
return checkDeleteExpression(node);
- case 200 /* VoidExpression */:
+ case 201 /* VoidExpression */:
return checkVoidExpression(node);
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
return checkAwaitExpression(node);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return checkPrefixUnaryExpression(node);
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return checkPostfixUnaryExpression(node);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return checkBinaryExpression(node, checkMode);
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return checkConditionalExpression(node, checkMode);
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
return checkSpreadExpression(node, checkMode);
- case 210 /* OmittedExpression */:
+ case 211 /* OmittedExpression */:
return undefinedWideningType;
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return checkYieldExpression(node);
- case 215 /* SyntheticExpression */:
+ case 216 /* SyntheticExpression */:
return node.type;
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return checkJsxExpression(node, checkMode);
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
return checkJsxElement(node, checkMode);
- case 261 /* JsxSelfClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
return checkJsxSelfClosingElement(node, checkMode);
- case 264 /* JsxFragment */:
+ case 265 /* JsxFragment */:
return checkJsxFragment(node);
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
return checkJsxAttributes(node, checkMode);
- case 262 /* JsxOpeningElement */:
+ case 263 /* JsxOpeningElement */:
ts.Debug.fail("Shouldn't ever directly check a JsxOpeningElement");
}
return errorType;
@@ -53125,7 +54012,7 @@
var constraintType = getConstraintOfTypeParameter(typeParameter);
var defaultType = getDefaultFromTypeParameter(typeParameter);
if (constraintType && defaultType) {
- checkTypeAssignableTo(defaultType, getTypeWithThisArgument(constraintType, defaultType), node.default, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1);
+ checkTypeAssignableTo(defaultType, getTypeWithThisArgument(instantiateType(constraintType, makeUnaryTypeMapper(typeParameter, defaultType)), defaultType), node.default, ts.Diagnostics.Type_0_does_not_satisfy_the_constraint_1);
}
if (produceDiagnostics) {
checkTypeNameIsReserved(node.name, ts.Diagnostics.Type_parameter_name_cannot_be_0);
@@ -53140,7 +54027,7 @@
checkVariableLikeDeclaration(node);
var func = ts.getContainingFunction(node);
if (ts.hasModifier(node, 92 /* ParameterPropertyModifier */)) {
- if (!(func.kind === 157 /* Constructor */ && ts.nodeIsPresent(func.body))) {
+ if (!(func.kind === 158 /* Constructor */ && ts.nodeIsPresent(func.body))) {
error(node, ts.Diagnostics.A_parameter_property_is_only_allowed_in_a_constructor_implementation);
}
}
@@ -53151,10 +54038,10 @@
if (func.parameters.indexOf(node) !== 0) {
error(node, ts.Diagnostics.A_0_parameter_must_be_the_first_parameter, node.name.escapedText);
}
- if (func.kind === 157 /* Constructor */ || func.kind === 161 /* ConstructSignature */ || func.kind === 166 /* ConstructorType */) {
+ if (func.kind === 158 /* Constructor */ || func.kind === 162 /* ConstructSignature */ || func.kind === 167 /* ConstructorType */) {
error(node, ts.Diagnostics.A_constructor_cannot_have_a_this_parameter);
}
- if (func.kind === 197 /* ArrowFunction */) {
+ if (func.kind === 198 /* ArrowFunction */) {
error(node, ts.Diagnostics.An_arrow_function_cannot_have_a_this_parameter);
}
}
@@ -53210,13 +54097,13 @@
}
function getTypePredicateParent(node) {
switch (node.parent.kind) {
- case 197 /* ArrowFunction */:
- case 160 /* CallSignature */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 165 /* FunctionType */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 198 /* ArrowFunction */:
+ case 161 /* CallSignature */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 166 /* FunctionType */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
var parent = node.parent;
if (node === parent.type) {
return parent;
@@ -53230,11 +54117,11 @@
continue;
}
var name = element.name;
- if (name.kind === 72 /* Identifier */ && name.escapedText === predicateVariableName) {
+ if (name.kind === 73 /* Identifier */ && name.escapedText === predicateVariableName) {
error(predicateVariableNode, ts.Diagnostics.A_type_predicate_cannot_reference_element_0_in_a_binding_pattern, predicateVariableName);
return true;
}
- else if (name.kind === 185 /* ArrayBindingPattern */ || name.kind === 184 /* ObjectBindingPattern */) {
+ else if (name.kind === 186 /* ArrayBindingPattern */ || name.kind === 185 /* ObjectBindingPattern */) {
if (checkIfTypePredicateVariableIsDeclaredInBindingPattern(name, predicateVariableNode, predicateVariableName)) {
return true;
}
@@ -53243,19 +54130,19 @@
}
function checkSignatureDeclaration(node) {
// Grammar checking
- if (node.kind === 162 /* IndexSignature */) {
+ if (node.kind === 163 /* IndexSignature */) {
checkGrammarIndexSignature(node);
}
// TODO (yuisu): Remove this check in else-if when SyntaxKind.Construct is moved and ambient context is handled
- else if (node.kind === 165 /* FunctionType */ || node.kind === 239 /* FunctionDeclaration */ || node.kind === 166 /* ConstructorType */ ||
- node.kind === 160 /* CallSignature */ || node.kind === 157 /* Constructor */ ||
- node.kind === 161 /* ConstructSignature */) {
+ else if (node.kind === 166 /* FunctionType */ || node.kind === 240 /* FunctionDeclaration */ || node.kind === 167 /* ConstructorType */ ||
+ node.kind === 161 /* CallSignature */ || node.kind === 158 /* Constructor */ ||
+ node.kind === 162 /* ConstructSignature */) {
checkGrammarFunctionLikeDeclaration(node);
}
var functionFlags = ts.getFunctionFlags(node);
if (!(functionFlags & 4 /* Invalid */)) {
// Async generators prior to ESNext require the __await and __asyncGenerator helpers
- if ((functionFlags & 3 /* AsyncGenerator */) === 3 /* AsyncGenerator */ && languageVersion < 7 /* ESNext */) {
+ if ((functionFlags & 3 /* AsyncGenerator */) === 3 /* AsyncGenerator */ && languageVersion < 8 /* ESNext */) {
checkExternalEmitHelpers(node, 6144 /* AsyncGeneratorIncludes */);
}
// Async functions prior to ES2017 require the __awaiter helper
@@ -53279,10 +54166,10 @@
var returnTypeNode = ts.getEffectiveReturnTypeNode(node);
if (noImplicitAny && !returnTypeNode) {
switch (node.kind) {
- case 161 /* ConstructSignature */:
+ case 162 /* ConstructSignature */:
error(node, ts.Diagnostics.Construct_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);
break;
- case 160 /* CallSignature */:
+ case 161 /* CallSignature */:
error(node, ts.Diagnostics.Call_signature_which_lacks_return_type_annotation_implicitly_has_an_any_return_type);
break;
}
@@ -53312,7 +54199,7 @@
checkAsyncFunctionReturnType(node, returnTypeNode);
}
}
- if (node.kind !== 162 /* IndexSignature */ && node.kind !== 294 /* JSDocFunctionType */) {
+ if (node.kind !== 163 /* IndexSignature */ && node.kind !== 295 /* JSDocFunctionType */) {
registerForUnusedIdentifiersCheck(node);
}
}
@@ -53329,7 +54216,7 @@
var staticNames = ts.createUnderscoreEscapedMap();
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
- if (member.kind === 157 /* Constructor */) {
+ if (member.kind === 158 /* Constructor */) {
for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) {
var param = _c[_b];
if (ts.isParameterPropertyDeclaration(param) && !ts.isBindingPattern(param.name)) {
@@ -53344,16 +54231,16 @@
var memberName = name && ts.getPropertyNameForPropertyNameNode(name);
if (name && memberName) {
switch (member.kind) {
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
addName(names, name, memberName, 1 /* Getter */);
break;
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
addName(names, name, memberName, 2 /* Setter */);
break;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
addName(names, name, memberName, 3 /* Property */);
break;
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
addName(names, name, memberName, 4 /* Method */);
break;
}
@@ -53416,7 +54303,7 @@
var names = ts.createMap();
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
- if (member.kind === 153 /* PropertySignature */) {
+ if (member.kind === 154 /* PropertySignature */) {
var memberName = void 0;
var name = member.name;
switch (name.kind) {
@@ -53424,7 +54311,7 @@
case 8 /* NumericLiteral */:
memberName = name.text;
break;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
memberName = ts.idText(name);
break;
default:
@@ -53441,7 +54328,7 @@
}
}
function checkTypeForDuplicateIndexSignatures(node) {
- if (node.kind === 241 /* InterfaceDeclaration */) {
+ if (node.kind === 242 /* InterfaceDeclaration */) {
var nodeSymbol = getSymbolOfNode(node);
// in case of merging interface declaration it is possible that we'll enter this check procedure several times for every declaration
// to prevent this run check only for the first declaration of a given kind
@@ -53461,7 +54348,7 @@
var declaration = decl;
if (declaration.parameters.length === 1 && declaration.parameters[0].type) {
switch (declaration.parameters[0].type.kind) {
- case 138 /* StringKeyword */:
+ case 139 /* StringKeyword */:
if (!seenStringIndexer) {
seenStringIndexer = true;
}
@@ -53469,7 +54356,7 @@
error(declaration, ts.Diagnostics.Duplicate_string_index_signature);
}
break;
- case 135 /* NumberKeyword */:
+ case 136 /* NumberKeyword */:
if (!seenNumericIndexer) {
seenNumericIndexer = true;
}
@@ -53496,7 +54383,7 @@
checkFunctionOrMethodDeclaration(node);
// Abstract methods cannot have an implementation.
// Extra checks are to avoid reporting multiple errors relating to the "abstractness" of the node.
- if (ts.hasModifier(node, 128 /* Abstract */) && node.kind === 156 /* MethodDeclaration */ && node.body) {
+ if (ts.hasModifier(node, 128 /* Abstract */) && node.kind === 157 /* MethodDeclaration */ && node.body) {
error(node, ts.Diagnostics.Method_0_cannot_have_an_implementation_because_it_is_marked_abstract, ts.declarationNameToString(node.name));
}
}
@@ -53521,7 +54408,7 @@
return;
}
function isInstancePropertyWithInitializer(n) {
- return n.kind === 154 /* PropertyDeclaration */ &&
+ return n.kind === 155 /* PropertyDeclaration */ &&
!ts.hasModifier(n, 32 /* Static */) &&
!!n.initializer;
}
@@ -53551,7 +54438,7 @@
var superCallStatement = void 0;
for (var _i = 0, statements_2 = statements; _i < statements_2.length; _i++) {
var statement = statements_2[_i];
- if (statement.kind === 221 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) {
+ if (statement.kind === 222 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) {
superCallStatement = statement;
break;
}
@@ -53576,7 +54463,7 @@
checkGrammarComputedPropertyName(node.name);
checkDecorators(node);
checkSignatureDeclaration(node);
- if (node.kind === 158 /* GetAccessor */) {
+ if (node.kind === 159 /* GetAccessor */) {
if (!(node.flags & 4194304 /* Ambient */) && ts.nodeIsPresent(node.body) && (node.flags & 128 /* HasImplicitReturn */)) {
if (!(node.flags & 256 /* HasExplicitReturn */)) {
error(node.name, ts.Diagnostics.A_get_accessor_must_return_a_value);
@@ -53586,13 +54473,13 @@
// Do not use hasDynamicName here, because that returns false for well known symbols.
// We want to perform checkComputedPropertyName for all computed properties, including
// well known symbols.
- if (node.name.kind === 149 /* ComputedPropertyName */) {
+ if (node.name.kind === 150 /* ComputedPropertyName */) {
checkComputedPropertyName(node.name);
}
if (!hasNonBindableDynamicName(node)) {
// TypeScript 1.0 spec (April 2014): 8.4.3
// Accessors for the same member name must specify the same accessibility.
- var otherKind = node.kind === 158 /* GetAccessor */ ? 159 /* SetAccessor */ : 158 /* GetAccessor */;
+ var otherKind = node.kind === 159 /* GetAccessor */ ? 160 /* SetAccessor */ : 159 /* GetAccessor */;
var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(node), otherKind);
if (otherAccessor) {
var nodeFlags = ts.getModifierFlags(node);
@@ -53610,7 +54497,7 @@
}
}
var returnType = getTypeOfAccessors(getSymbolOfNode(node));
- if (node.kind === 158 /* GetAccessor */) {
+ if (node.kind === 159 /* GetAccessor */) {
checkAllCodePathsInNonVoidFunctionReturnOrThrow(node, returnType);
}
}
@@ -53658,7 +54545,7 @@
}
function checkTypeReferenceNode(node) {
checkGrammarTypeArguments(node, node.typeArguments);
- if (node.kind === 164 /* TypeReference */ && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) {
+ if (node.kind === 165 /* TypeReference */ && node.typeName.jsdocDotPos !== undefined && !ts.isInJSFile(node) && !ts.isInJSDoc(node)) {
grammarErrorAtPos(node, node.typeName.jsdocDotPos, 1, ts.Diagnostics.JSDoc_types_can_only_be_used_inside_documentation_comments);
}
var type = getTypeFromTypeReference(node);
@@ -53706,7 +54593,7 @@
var seenOptionalElement = false;
for (var i = 0; i < elementTypes.length; i++) {
var e = elementTypes[i];
- if (e.kind === 172 /* RestType */) {
+ if (e.kind === 173 /* RestType */) {
if (i !== elementTypes.length - 1) {
grammarErrorOnNode(e, ts.Diagnostics.A_rest_element_must_be_last_in_a_tuple_type);
break;
@@ -53715,7 +54602,7 @@
error(e, ts.Diagnostics.A_rest_element_type_must_be_an_array_type);
}
}
- else if (e.kind === 171 /* OptionalType */) {
+ else if (e.kind === 172 /* OptionalType */) {
seenOptionalElement = true;
}
else if (seenOptionalElement) {
@@ -53736,7 +54623,7 @@
var objectType = type.objectType;
var indexType = type.indexType;
if (isTypeAssignableTo(indexType, getIndexType(objectType, /*stringsOnly*/ false))) {
- if (accessNode.kind === 190 /* ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) &&
+ if (accessNode.kind === 191 /* ElementAccessExpression */ && ts.isAssignmentTarget(accessNode) &&
ts.getObjectFlags(objectType) & 32 /* Mapped */ && getMappedTypeModifiers(objectType) & 1 /* IncludeReadonly */) {
error(accessNode, ts.Diagnostics.Index_signature_in_type_0_only_permits_reading, typeToString(objectType));
}
@@ -53748,7 +54635,7 @@
return type;
}
error(accessNode, ts.Diagnostics.Type_0_cannot_be_used_to_index_type_1, typeToString(indexType), typeToString(objectType));
- return type;
+ return errorType;
}
function checkIndexedAccessType(node) {
checkSourceElement(node.objectType);
@@ -53776,7 +54663,7 @@
ts.forEachChild(node, checkSourceElement);
}
function checkInferType(node) {
- if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 175 /* ConditionalType */ && n.parent.extendsType === n; })) {
+ if (!ts.findAncestor(node, function (n) { return n.parent && n.parent.kind === 176 /* ConditionalType */ && n.parent.extendsType === n; })) {
grammarErrorOnNode(node, ts.Diagnostics.infer_declarations_are_only_permitted_in_the_extends_clause_of_a_conditional_type);
}
checkSourceElement(node.typeParameter);
@@ -53793,9 +54680,9 @@
var flags = ts.getCombinedModifierFlags(n);
// children of classes (even ambient classes) should not be marked as ambient or export
// because those flags have no useful semantics there.
- if (n.parent.kind !== 241 /* InterfaceDeclaration */ &&
- n.parent.kind !== 240 /* ClassDeclaration */ &&
- n.parent.kind !== 209 /* ClassExpression */ &&
+ if (n.parent.kind !== 242 /* InterfaceDeclaration */ &&
+ n.parent.kind !== 241 /* ClassDeclaration */ &&
+ n.parent.kind !== 210 /* ClassExpression */ &&
n.flags & 4194304 /* Ambient */) {
if (!(flags & 2 /* Ambient */) && !(ts.isModuleBlock(n.parent) && ts.isModuleDeclaration(n.parent.parent) && ts.isGlobalScopeAugmentation(n.parent.parent))) {
// It is nested in an ambient context, which means it is automatically exported
@@ -53886,7 +54773,7 @@
if (node.name && subsequentName &&
(ts.isComputedPropertyName(node.name) && ts.isComputedPropertyName(subsequentName) ||
!ts.isComputedPropertyName(node.name) && !ts.isComputedPropertyName(subsequentName) && ts.getEscapedTextOfIdentifierOrLiteral(node.name) === ts.getEscapedTextOfIdentifierOrLiteral(subsequentName))) {
- var reportError = (node.kind === 156 /* MethodDeclaration */ || node.kind === 155 /* MethodSignature */) &&
+ var reportError = (node.kind === 157 /* MethodDeclaration */ || node.kind === 156 /* MethodSignature */) &&
ts.hasModifier(node, 32 /* Static */) !== ts.hasModifier(subsequentNode, 32 /* Static */);
// we can get here in two cases
// 1. mixed static and instance class members
@@ -53925,7 +54812,7 @@
var current = declarations_4[_i];
var node = current;
var inAmbientContext = node.flags & 4194304 /* Ambient */;
- var inAmbientContextOrInterface = node.parent.kind === 241 /* InterfaceDeclaration */ || node.parent.kind === 168 /* TypeLiteral */ || inAmbientContext;
+ var inAmbientContextOrInterface = node.parent.kind === 242 /* InterfaceDeclaration */ || node.parent.kind === 169 /* TypeLiteral */ || inAmbientContext;
if (inAmbientContextOrInterface) {
// check if declarations are consecutive only if they are non-ambient
// 1. ambient declarations can be interleaved
@@ -53936,7 +54823,7 @@
// 2. mixing ambient and non-ambient declarations is a separate error that will be reported - do not want to report an extra one
previousDeclaration = undefined;
}
- if (node.kind === 239 /* FunctionDeclaration */ || node.kind === 156 /* MethodDeclaration */ || node.kind === 155 /* MethodSignature */ || node.kind === 157 /* Constructor */) {
+ if (node.kind === 240 /* FunctionDeclaration */ || node.kind === 157 /* MethodDeclaration */ || node.kind === 156 /* MethodSignature */ || node.kind === 158 /* Constructor */) {
var currentNodeFlags = getEffectiveDeclarationFlags(node, flagsToCheck);
someNodeFlags |= currentNodeFlags;
allNodeFlags &= currentNodeFlags;
@@ -54065,22 +54952,22 @@
function getDeclarationSpaces(decl) {
var d = decl;
switch (d.kind) {
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
// A jsdoc typedef and callback are, by definition, type aliases
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
return 2 /* ExportType */;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return ts.isAmbientModule(d) || ts.getModuleInstanceState(d) !== 0 /* NonInstantiated */
? 4 /* ExportNamespace */ | 1 /* ExportValue */
: 4 /* ExportNamespace */;
- case 240 /* ClassDeclaration */:
- case 243 /* EnumDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 244 /* EnumDeclaration */:
return 2 /* ExportType */ | 1 /* ExportValue */;
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return 2 /* ExportType */ | 1 /* ExportValue */ | 4 /* ExportNamespace */;
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
// Export assigned entity name expressions act as aliases and should fall through, otherwise they export values
if (!ts.isEntityNameExpression(d.expression)) {
return 1 /* ExportValue */;
@@ -54088,20 +54975,20 @@
d = d.expression;
/* falls through */
// The below options all declare an Alias, which is allowed to merge with other values within the importing module
- case 248 /* ImportEqualsDeclaration */:
- case 251 /* NamespaceImport */:
- case 250 /* ImportClause */:
- var result_5 = 0 /* None */;
+ case 249 /* ImportEqualsDeclaration */:
+ case 252 /* NamespaceImport */:
+ case 251 /* ImportClause */:
+ var result_7 = 0 /* None */;
var target = resolveAlias(getSymbolOfNode(d));
- ts.forEach(target.declarations, function (d) { result_5 |= getDeclarationSpaces(d); });
- return result_5;
- case 237 /* VariableDeclaration */:
- case 186 /* BindingElement */:
- case 239 /* FunctionDeclaration */:
- case 253 /* ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591
+ ts.forEach(target.declarations, function (d) { result_7 |= getDeclarationSpaces(d); });
+ return result_7;
+ case 238 /* VariableDeclaration */:
+ case 187 /* BindingElement */:
+ case 240 /* FunctionDeclaration */:
+ case 254 /* ImportSpecifier */: // https://github.com/Microsoft/TypeScript/pull/7591
return 1 /* ExportValue */;
default:
- return ts.Debug.fail(ts.Debug.showSyntaxKind(d));
+ return ts.Debug.failBadSyntaxKind(d);
}
}
}
@@ -54327,7 +55214,7 @@
var promiseConstructorSymbol = resolveEntityName(promiseConstructorName, 67220415 /* Value */, /*ignoreErrors*/ true);
var promiseConstructorType = promiseConstructorSymbol ? getTypeOfSymbol(promiseConstructorSymbol) : errorType;
if (promiseConstructorType === errorType) {
- if (promiseConstructorName.kind === 72 /* Identifier */ && promiseConstructorName.escapedText === "Promise" && getTargetType(returnType) === getGlobalPromiseType(/*reportErrors*/ false)) {
+ if (promiseConstructorName.kind === 73 /* Identifier */ && promiseConstructorName.escapedText === "Promise" && getTargetType(returnType) === getGlobalPromiseType(/*reportErrors*/ false)) {
error(returnTypeNode, ts.Diagnostics.An_async_function_or_method_in_ES5_SlashES3_requires_the_Promise_constructor_Make_sure_you_have_a_declaration_for_the_Promise_constructor_or_include_ES2015_in_your_lib_option);
}
else {
@@ -54366,24 +55253,24 @@
var headMessage = getDiagnosticHeadMessageForDecoratorResolution(node);
var errorInfo;
switch (node.parent.kind) {
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
var classSymbol = getSymbolOfNode(node.parent);
var classConstructorType = getTypeOfSymbol(classSymbol);
expectedReturnType = getUnionType([classConstructorType, voidType]);
break;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
expectedReturnType = voidType;
errorInfo = ts.chainDiagnosticMessages(
/*details*/ undefined, ts.Diagnostics.The_return_type_of_a_parameter_decorator_function_must_be_either_void_or_any);
break;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
expectedReturnType = voidType;
errorInfo = ts.chainDiagnosticMessages(
/*details*/ undefined, ts.Diagnostics.The_return_type_of_a_property_decorator_function_must_be_either_void_or_any);
break;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
var methodType = getTypeOfNode(node.parent);
var descriptorType = createTypedPropertyDescriptorType(methodType);
expectedReturnType = getUnionType([descriptorType, voidType]);
@@ -54404,7 +55291,7 @@
if (!typeName)
return;
var rootName = getFirstIdentifier(typeName);
- var meaning = (typeName.kind === 72 /* Identifier */ ? 67897832 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */;
+ var meaning = (typeName.kind === 73 /* Identifier */ ? 67897832 /* Type */ : 1920 /* Namespace */) | 2097152 /* Alias */;
var rootSymbol = resolveName(rootName, rootName.escapedText, meaning, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isRefernce*/ true);
if (rootSymbol
&& rootSymbol.flags & 2097152 /* Alias */
@@ -54429,29 +55316,29 @@
function getEntityNameForDecoratorMetadata(node) {
if (node) {
switch (node.kind) {
- case 174 /* IntersectionType */:
- case 173 /* UnionType */:
+ case 175 /* IntersectionType */:
+ case 174 /* UnionType */:
return getEntityNameForDecoratorMetadataFromTypeList(node.types);
- case 175 /* ConditionalType */:
+ case 176 /* ConditionalType */:
return getEntityNameForDecoratorMetadataFromTypeList([node.trueType, node.falseType]);
- case 177 /* ParenthesizedType */:
+ case 178 /* ParenthesizedType */:
return getEntityNameForDecoratorMetadata(node.type);
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return node.typeName;
}
}
}
function getEntityNameForDecoratorMetadataFromTypeList(types) {
var commonEntityName;
- for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
- var typeNode = types_17[_i];
- while (typeNode.kind === 177 /* ParenthesizedType */) {
+ for (var _i = 0, types_16 = types; _i < types_16.length; _i++) {
+ var typeNode = types_16[_i];
+ while (typeNode.kind === 178 /* ParenthesizedType */) {
typeNode = typeNode.type; // Skip parens if need be
}
- if (typeNode.kind === 132 /* NeverKeyword */) {
+ if (typeNode.kind === 133 /* NeverKeyword */) {
continue; // Always elide `never` from the union/intersection if possible
}
- if (!strictNullChecks && (typeNode.kind === 96 /* NullKeyword */ || typeNode.kind === 141 /* UndefinedKeyword */)) {
+ if (!strictNullChecks && (typeNode.kind === 97 /* NullKeyword */ || typeNode.kind === 142 /* UndefinedKeyword */)) {
continue; // Elide null and undefined from unions for metadata, just like what we did prior to the implementation of strict null checks
}
var individualEntityName = getEntityNameForDecoratorMetadata(typeNode);
@@ -54493,18 +55380,18 @@
return;
}
if (!compilerOptions.experimentalDecorators) {
- error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning);
+ error(node, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning);
}
var firstDecorator = node.decorators[0];
checkExternalEmitHelpers(firstDecorator, 8 /* Decorate */);
- if (node.kind === 151 /* Parameter */) {
+ if (node.kind === 152 /* Parameter */) {
checkExternalEmitHelpers(firstDecorator, 32 /* Param */);
}
if (compilerOptions.emitDecoratorMetadata) {
checkExternalEmitHelpers(firstDecorator, 16 /* Metadata */);
// we only need to perform these checks if we are emitting serialized type metadata for the target of a decorator.
switch (node.kind) {
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
var constructor = ts.getFirstConstructorWithBody(node);
if (constructor) {
for (var _i = 0, _a = constructor.parameters; _i < _a.length; _i++) {
@@ -54513,23 +55400,23 @@
}
}
break;
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- var otherKind = node.kind === 158 /* GetAccessor */ ? 159 /* SetAccessor */ : 158 /* GetAccessor */;
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ var otherKind = node.kind === 159 /* GetAccessor */ ? 160 /* SetAccessor */ : 159 /* GetAccessor */;
var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(node), otherKind);
markDecoratorMedataDataTypeNodeAsReferenced(getAnnotatedAccessorTypeNode(node) || otherAccessor && getAnnotatedAccessorTypeNode(otherAccessor));
break;
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
for (var _b = 0, _c = node.parameters; _b < _c.length; _b++) {
var parameter = _c[_b];
markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(parameter));
}
markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveReturnTypeNode(node));
break;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
markDecoratorMedataDataTypeNodeAsReferenced(ts.getEffectiveTypeAnnotationNode(node));
break;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
markDecoratorMedataDataTypeNodeAsReferenced(getParameterTypeNodeForDecoratorCheck(node));
var containingSignature = node.parent;
for (var _d = 0, _e = containingSignature.parameters; _d < _e.length; _d++) {
@@ -54592,7 +55479,7 @@
else if (ts.findLast(ts.getJSDocTags(decl), ts.isJSDocParameterTag) === node &&
node.typeExpression && node.typeExpression.type &&
!isArrayType(getTypeFromTypeNode(node.typeExpression.type))) {
- error(node.name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_had_an_array_type, ts.idText(node.name.kind === 148 /* QualifiedName */ ? node.name.right : node.name));
+ error(node.name, ts.Diagnostics.JSDoc_param_tag_has_name_0_but_there_is_no_parameter_with_that_name_It_would_match_arguments_if_it_had_an_array_type, ts.idText(node.name.kind === 149 /* QualifiedName */ ? node.name.right : node.name));
}
}
}
@@ -54625,9 +55512,9 @@
}
function getIdentifierFromEntityNameExpression(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return node;
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return node.name;
default:
return undefined;
@@ -54640,7 +55527,7 @@
// Do not use hasDynamicName here, because that returns false for well known symbols.
// We want to perform checkComputedPropertyName for all computed properties, including
// well known symbols.
- if (node.name && node.name.kind === 149 /* ComputedPropertyName */) {
+ if (node.name && node.name.kind === 150 /* ComputedPropertyName */) {
// This check will account for methods in class/interface declarations,
// as well as accessors in classes/object literals
checkComputedPropertyName(node.name);
@@ -54669,7 +55556,7 @@
}
}
}
- var body = node.kind === 155 /* MethodSignature */ ? undefined : node.body;
+ var body = node.kind === 156 /* MethodSignature */ ? undefined : node.body;
checkSourceElement(body);
if ((functionFlags & 1 /* Generator */) === 0) { // Async function or normal function
var returnOrPromisedType = getReturnOrPromisedType(node, functionFlags);
@@ -54714,42 +55601,42 @@
for (var _i = 0, potentiallyUnusedIdentifiers_1 = potentiallyUnusedIdentifiers; _i < potentiallyUnusedIdentifiers_1.length; _i++) {
var node = potentiallyUnusedIdentifiers_1[_i];
switch (node.kind) {
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
checkUnusedClassMembers(node, addDiagnostic);
checkUnusedTypeParameters(node, addDiagnostic);
break;
- case 284 /* SourceFile */:
- case 244 /* ModuleDeclaration */:
- case 218 /* Block */:
- case 246 /* CaseBlock */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 285 /* SourceFile */:
+ case 245 /* ModuleDeclaration */:
+ case 219 /* Block */:
+ case 247 /* CaseBlock */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
checkUnusedLocalsAndParameters(node, addDiagnostic);
break;
- case 157 /* Constructor */:
- case 196 /* FunctionExpression */:
- case 239 /* FunctionDeclaration */:
- case 197 /* ArrowFunction */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 158 /* Constructor */:
+ case 197 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
+ case 198 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
if (node.body) { // Don't report unused parameters in overloads
checkUnusedLocalsAndParameters(node, addDiagnostic);
}
checkUnusedTypeParameters(node, addDiagnostic);
break;
- case 155 /* MethodSignature */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 242 /* TypeAliasDeclaration */:
- case 241 /* InterfaceDeclaration */:
+ case 156 /* MethodSignature */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 243 /* TypeAliasDeclaration */:
+ case 242 /* InterfaceDeclaration */:
checkUnusedTypeParameters(node, addDiagnostic);
break;
- case 176 /* InferType */:
+ case 177 /* InferType */:
checkUnusedInferTypeParameter(node, addDiagnostic);
break;
default:
@@ -54769,11 +55656,11 @@
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
switch (member.kind) {
- case 156 /* MethodDeclaration */:
- case 154 /* PropertyDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- if (member.kind === 159 /* SetAccessor */ && member.symbol.flags & 32768 /* GetAccessor */) {
+ case 157 /* MethodDeclaration */:
+ case 155 /* PropertyDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ if (member.kind === 160 /* SetAccessor */ && member.symbol.flags & 32768 /* GetAccessor */) {
// Already would have reported an error on the getter.
break;
}
@@ -54782,7 +55669,7 @@
addDiagnostic(member, 0 /* Local */, ts.createDiagnosticForNode(member.name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, symbolToString(symbol)));
}
break;
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
for (var _b = 0, _c = member.parameters; _b < _c.length; _b++) {
var parameter = _c[_b];
if (!parameter.symbol.isReferenced && ts.hasModifier(parameter, 8 /* Private */)) {
@@ -54790,8 +55677,8 @@
}
}
break;
- case 162 /* IndexSignature */:
- case 217 /* SemicolonClassElement */:
+ case 163 /* IndexSignature */:
+ case 218 /* SemicolonClassElement */:
// Can't be private
break;
default:
@@ -54818,7 +55705,7 @@
continue;
var name = ts.idText(typeParameter.name);
var parent = typeParameter.parent;
- if (parent.kind !== 176 /* InferType */ && parent.typeParameters.every(isTypeParameterUnused)) {
+ if (parent.kind !== 177 /* InferType */ && parent.typeParameters.every(isTypeParameterUnused)) {
if (seenParentsWithEveryUnused.tryAdd(parent)) {
var range = ts.isJSDocTemplateTag(parent)
// Whole @template tag
@@ -54903,7 +55790,7 @@
var importDecl = importClause.parent;
var nDeclarations = (importClause.name ? 1 : 0) +
(importClause.namedBindings ?
- (importClause.namedBindings.kind === 251 /* NamespaceImport */ ? 1 : importClause.namedBindings.elements.length)
+ (importClause.namedBindings.kind === 252 /* NamespaceImport */ ? 1 : importClause.namedBindings.elements.length)
: 0);
if (nDeclarations === unuseds.length) {
addDiagnostic(importDecl, 0 /* Local */, unuseds.length === 1
@@ -54921,7 +55808,7 @@
var bindingPattern = _a[0], bindingElements = _a[1];
var kind = tryGetRootParameterDeclaration(bindingPattern.parent) ? 1 /* Parameter */ : 0 /* Local */;
if (bindingPattern.elements.length === bindingElements.length) {
- if (bindingElements.length === 1 && bindingPattern.parent.kind === 237 /* VariableDeclaration */ && bindingPattern.parent.parent.kind === 238 /* VariableDeclarationList */) {
+ if (bindingElements.length === 1 && bindingPattern.parent.kind === 238 /* VariableDeclaration */ && bindingPattern.parent.parent.kind === 239 /* VariableDeclarationList */) {
addToGroup(unusedVariables, bindingPattern.parent.parent, bindingPattern.parent, getNodeId);
}
else {
@@ -54942,7 +55829,7 @@
if (declarationList.declarations.length === declarations.length) {
addDiagnostic(declarationList, 0 /* Local */, declarations.length === 1
? ts.createDiagnosticForNode(ts.first(declarations).name, ts.Diagnostics._0_is_declared_but_its_value_is_never_read, bindingNameText(ts.first(declarations).name))
- : ts.createDiagnosticForNode(declarationList.parent.kind === 219 /* VariableStatement */ ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused));
+ : ts.createDiagnosticForNode(declarationList.parent.kind === 220 /* VariableStatement */ ? declarationList.parent : declarationList, ts.Diagnostics.All_variables_are_unused));
}
else {
for (var _i = 0, declarations_5 = declarations; _i < declarations_5.length; _i++) {
@@ -54954,24 +55841,24 @@
}
function bindingNameText(name) {
switch (name.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return ts.idText(name);
- case 185 /* ArrayBindingPattern */:
- case 184 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
return bindingNameText(ts.cast(ts.first(name.elements), ts.isBindingElement).name);
default:
return ts.Debug.assertNever(name);
}
}
function isImportedDeclaration(node) {
- return node.kind === 250 /* ImportClause */ || node.kind === 253 /* ImportSpecifier */ || node.kind === 251 /* NamespaceImport */;
+ return node.kind === 251 /* ImportClause */ || node.kind === 254 /* ImportSpecifier */ || node.kind === 252 /* NamespaceImport */;
}
function importClauseFromImported(decl) {
- return decl.kind === 250 /* ImportClause */ ? decl : decl.kind === 251 /* NamespaceImport */ ? decl.parent : decl.parent.parent;
+ return decl.kind === 251 /* ImportClause */ ? decl : decl.kind === 252 /* NamespaceImport */ ? decl.parent : decl.parent.parent;
}
function checkBlock(node) {
// Grammar checking for SyntaxKind.Block
- if (node.kind === 218 /* Block */) {
+ if (node.kind === 219 /* Block */) {
checkGrammarStatementInAmbientContext(node);
}
if (ts.isFunctionOrModuleBlock(node)) {
@@ -55001,12 +55888,12 @@
if (!(identifier && identifier.escapedText === name)) {
return false;
}
- if (node.kind === 154 /* PropertyDeclaration */ ||
- node.kind === 153 /* PropertySignature */ ||
- node.kind === 156 /* MethodDeclaration */ ||
- node.kind === 155 /* MethodSignature */ ||
- node.kind === 158 /* GetAccessor */ ||
- node.kind === 159 /* SetAccessor */) {
+ if (node.kind === 155 /* PropertyDeclaration */ ||
+ node.kind === 154 /* PropertySignature */ ||
+ node.kind === 157 /* MethodDeclaration */ ||
+ node.kind === 156 /* MethodSignature */ ||
+ node.kind === 159 /* GetAccessor */ ||
+ node.kind === 160 /* SetAccessor */) {
// it is ok to have member named '_super' or '_this' - member access is always qualified
return false;
}
@@ -55015,7 +55902,7 @@
return false;
}
var root = ts.getRootDeclaration(node);
- if (root.kind === 151 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) {
+ if (root.kind === 152 /* Parameter */ && ts.nodeIsMissing(root.parent.body)) {
// just an overload - no codegen impact
return false;
}
@@ -55025,7 +55912,7 @@
function checkIfThisIsCapturedInEnclosingScope(node) {
ts.findAncestor(node, function (current) {
if (getNodeCheckFlags(current) & 4 /* CaptureThis */) {
- var isDeclaration_1 = node.kind !== 72 /* Identifier */;
+ var isDeclaration_1 = node.kind !== 73 /* Identifier */;
if (isDeclaration_1) {
error(ts.getNameOfDeclaration(node), ts.Diagnostics.Duplicate_identifier_this_Compiler_uses_variable_declaration_this_to_capture_this_reference);
}
@@ -55040,7 +55927,7 @@
function checkIfNewTargetIsCapturedInEnclosingScope(node) {
ts.findAncestor(node, function (current) {
if (getNodeCheckFlags(current) & 8 /* CaptureNewTarget */) {
- var isDeclaration_2 = node.kind !== 72 /* Identifier */;
+ var isDeclaration_2 = node.kind !== 73 /* Identifier */;
if (isDeclaration_2) {
error(ts.getNameOfDeclaration(node), ts.Diagnostics.Duplicate_identifier_newTarget_Compiler_uses_variable_declaration_newTarget_to_capture_new_target_meta_property_reference);
}
@@ -55066,7 +55953,7 @@
}
// In case of variable declaration, node.parent is variable statement so look at the variable statement's parent
var parent = getDeclarationContainer(node);
- if (parent.kind === 284 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) {
+ if (parent.kind === 285 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent)) {
// If the declaration happens to be in external module, report error that require and exports are reserved keywords
error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module, ts.declarationNameToString(name), ts.declarationNameToString(name));
}
@@ -55081,7 +55968,7 @@
}
// In case of variable declaration, node.parent is variable statement so look at the variable statement's parent
var parent = getDeclarationContainer(node);
- if (parent.kind === 284 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024 /* HasAsyncFunctions */) {
+ if (parent.kind === 285 /* SourceFile */ && ts.isExternalOrCommonJsModule(parent) && parent.flags & 1024 /* HasAsyncFunctions */) {
// If the declaration happens to be in external module, report error that Promise is a reserved identifier.
error(name, ts.Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module_containing_async_functions, ts.declarationNameToString(name), ts.declarationNameToString(name));
}
@@ -55116,7 +56003,7 @@
// skip variable declarations that don't have initializers
// NOTE: in ES6 spec initializer is required in variable declarations where name is binding pattern
// so we'll always treat binding elements as initialized
- if (node.kind === 237 /* VariableDeclaration */ && !node.initializer) {
+ if (node.kind === 238 /* VariableDeclaration */ && !node.initializer) {
return;
}
var symbol = getSymbolOfNode(node);
@@ -55128,17 +56015,17 @@
localDeclarationSymbol !== symbol &&
localDeclarationSymbol.flags & 2 /* BlockScopedVariable */) {
if (getDeclarationNodeFlagsFromSymbol(localDeclarationSymbol) & 3 /* BlockScoped */) {
- var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 238 /* VariableDeclarationList */);
- var container = varDeclList.parent.kind === 219 /* VariableStatement */ && varDeclList.parent.parent
+ var varDeclList = ts.getAncestor(localDeclarationSymbol.valueDeclaration, 239 /* VariableDeclarationList */);
+ var container = varDeclList.parent.kind === 220 /* VariableStatement */ && varDeclList.parent.parent
? varDeclList.parent.parent
: undefined;
// names of block-scoped and function scoped variables can collide only
// if block scoped variable is defined in the function\module\source file scope (because of variable hoisting)
var namesShareScope = container &&
- (container.kind === 218 /* Block */ && ts.isFunctionLike(container.parent) ||
- container.kind === 245 /* ModuleBlock */ ||
- container.kind === 244 /* ModuleDeclaration */ ||
- container.kind === 284 /* SourceFile */);
+ (container.kind === 219 /* Block */ && ts.isFunctionLike(container.parent) ||
+ container.kind === 246 /* ModuleBlock */ ||
+ container.kind === 245 /* ModuleDeclaration */ ||
+ container.kind === 285 /* SourceFile */);
// here we know that function scoped variable is shadowed by block scoped one
// if they are defined in the same scope - binder has already reported redeclaration error
// otherwise if variable has an initializer - show error that initialization will fail
@@ -55151,69 +56038,6 @@
}
}
}
- // Check that a parameter initializer contains no references to parameters declared to the right of itself
- function checkParameterInitializer(node) {
- if (ts.getRootDeclaration(node).kind !== 151 /* Parameter */) {
- return;
- }
- var func = ts.getContainingFunction(node);
- visit(node.initializer);
- function visit(n) {
- if (ts.isTypeNode(n) || ts.isDeclarationName(n)) {
- // do not dive in types
- // skip declaration names (i.e. in object literal expressions)
- return;
- }
- if (n.kind === 189 /* PropertyAccessExpression */) {
- // skip property names in property access expression
- return visit(n.expression);
- }
- else if (n.kind === 72 /* Identifier */) {
- // check FunctionLikeDeclaration.locals (stores parameters\function local variable)
- // if it contains entry with a specified name
- var symbol = resolveName(n, n.escapedText, 67220415 /* Value */ | 2097152 /* Alias */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false);
- if (!symbol || symbol === unknownSymbol || !symbol.valueDeclaration) {
- return;
- }
- if (symbol.valueDeclaration === node) {
- error(n, ts.Diagnostics.Parameter_0_cannot_be_referenced_in_its_initializer, ts.declarationNameToString(node.name));
- return;
- }
- // locals map for function contain both parameters and function locals
- // so we need to do a bit of extra work to check if reference is legal
- var enclosingContainer = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration);
- if (enclosingContainer === func) {
- if (symbol.valueDeclaration.kind === 151 /* Parameter */ ||
- symbol.valueDeclaration.kind === 186 /* BindingElement */) {
- // it is ok to reference parameter in initializer if either
- // - parameter is located strictly on the left of current parameter declaration
- if (symbol.valueDeclaration.pos < node.pos) {
- return;
- }
- // - parameter is wrapped in function-like entity
- if (ts.findAncestor(n, function (current) {
- if (current === node.initializer) {
- return "quit";
- }
- return ts.isFunctionLike(current.parent) ||
- // computed property names/initializers in instance property declaration of class like entities
- // are executed in constructor and thus deferred
- (current.parent.kind === 154 /* PropertyDeclaration */ &&
- !(ts.hasModifier(current.parent, 32 /* Static */)) &&
- ts.isClassLike(current.parent.parent));
- })) {
- return;
- }
- // fall through to report error
- }
- error(n, ts.Diagnostics.Initializer_of_parameter_0_cannot_reference_identifier_1_declared_after_it, ts.declarationNameToString(node.name), ts.declarationNameToString(n));
- }
- }
- else {
- return ts.forEachChild(n, visit);
- }
- }
- }
function convertAutoToAny(type) {
return type === autoType ? anyType : type === autoArrayType ? anyArrayType : type;
}
@@ -55231,18 +56055,18 @@
// Do not use hasDynamicName here, because that returns false for well known symbols.
// We want to perform checkComputedPropertyName for all computed properties, including
// well known symbols.
- if (node.name.kind === 149 /* ComputedPropertyName */) {
+ if (node.name.kind === 150 /* ComputedPropertyName */) {
checkComputedPropertyName(node.name);
if (node.initializer) {
checkExpressionCached(node.initializer);
}
}
- if (node.kind === 186 /* BindingElement */) {
- if (node.parent.kind === 184 /* ObjectBindingPattern */ && languageVersion < 7 /* ESNext */) {
+ if (node.kind === 187 /* BindingElement */) {
+ if (node.parent.kind === 185 /* ObjectBindingPattern */ && languageVersion < 8 /* ESNext */) {
checkExternalEmitHelpers(node, 4 /* Rest */);
}
// check computed properties inside property names of binding elements
- if (node.propertyName && node.propertyName.kind === 149 /* ComputedPropertyName */) {
+ if (node.propertyName && node.propertyName.kind === 150 /* ComputedPropertyName */) {
checkComputedPropertyName(node.propertyName);
}
// check private/protected variable access
@@ -55256,35 +56080,48 @@
var property = getPropertyOfType(parentType, nameText);
if (property) {
markPropertyAsReferenced(property, /*nodeForCheckWriteOnly*/ undefined, /*isThisAccess*/ false); // A destructuring is never a write-only reference.
- checkPropertyAccessibility(parent, !!parent.initializer && parent.initializer.kind === 98 /* SuperKeyword */, parentType, property);
+ checkPropertyAccessibility(parent, !!parent.initializer && parent.initializer.kind === 99 /* SuperKeyword */, parentType, property);
}
}
}
}
// For a binding pattern, check contained binding elements
if (ts.isBindingPattern(node.name)) {
- if (node.name.kind === 185 /* ArrayBindingPattern */ && languageVersion < 2 /* ES2015 */ && compilerOptions.downlevelIteration) {
+ if (node.name.kind === 186 /* ArrayBindingPattern */ && languageVersion < 2 /* ES2015 */ && compilerOptions.downlevelIteration) {
checkExternalEmitHelpers(node, 512 /* Read */);
}
ts.forEach(node.name.elements, checkSourceElement);
}
// For a parameter declaration with an initializer, error and exit if the containing function doesn't have a body
- if (node.initializer && ts.getRootDeclaration(node).kind === 151 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) {
+ if (node.initializer && ts.getRootDeclaration(node).kind === 152 /* Parameter */ && ts.nodeIsMissing(ts.getContainingFunction(node).body)) {
error(node, ts.Diagnostics.A_parameter_initializer_is_only_allowed_in_a_function_or_constructor_implementation);
return;
}
// For a binding pattern, validate the initializer and exit
if (ts.isBindingPattern(node.name)) {
+ var needCheckInitializer = node.initializer && node.parent.parent.kind !== 227 /* ForInStatement */;
+ var needCheckWidenedType = node.name.elements.length === 0;
+ if (needCheckInitializer || needCheckWidenedType) {
// Don't validate for-in initializer as it is already an error
- if (node.initializer && node.parent.parent.kind !== 226 /* ForInStatement */) {
+ var widenedType = getWidenedTypeForVariableLikeDeclaration(node);
+ if (needCheckInitializer) {
var initializerType = checkExpressionCached(node.initializer);
- if (strictNullChecks && node.name.elements.length === 0) {
- checkNonNullType(initializerType, node);
+ if (strictNullChecks && needCheckWidenedType) {
+ checkNonNullNonVoidType(initializerType, node);
}
else {
checkTypeAssignableToAndOptionallyElaborate(initializerType, getWidenedTypeForVariableLikeDeclaration(node), node, node.initializer);
}
- checkParameterInitializer(node);
+ }
+ // check the binding pattern with empty elements
+ if (needCheckWidenedType) {
+ if (ts.isArrayBindingPattern(node.name)) {
+ checkIteratedTypeOrElementType(widenedType, node, /* allowStringInput */ false, /* allowAsyncIterables */ false);
+ }
+ else if (strictNullChecks) {
+ checkNonNullNonVoidType(widenedType, node);
+ }
+ }
}
return;
}
@@ -55299,9 +56136,8 @@
ts.isObjectLiteralExpression(initializer) &&
(initializer.properties.length === 0 || ts.isPrototypeAccess(node.name)) &&
ts.hasEntries(symbol.exports);
- if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 226 /* ForInStatement */) {
+ if (!isJSObjectLiteralInitializer && node.parent.parent.kind !== 227 /* ForInStatement */) {
checkTypeAssignableToAndOptionallyElaborate(checkExpressionCached(initializer), type, node, initializer, /*headMessage*/ undefined);
- checkParameterInitializer(node);
}
}
if (symbol.declarations.length > 1) {
@@ -55317,7 +56153,7 @@
if (type !== errorType && declarationType !== errorType &&
!isTypeIdenticalTo(type, declarationType) &&
!(symbol.flags & 67108864 /* Assignment */)) {
- errorNextVariableOrPropertyDeclarationMustHaveSameType(type, node, declarationType);
+ errorNextVariableOrPropertyDeclarationMustHaveSameType(symbol.valueDeclaration, type, node, declarationType);
}
if (node.initializer) {
checkTypeAssignableToAndOptionallyElaborate(checkExpressionCached(node.initializer), declarationType, node, node.initializer, /*headMessage*/ undefined);
@@ -55326,26 +56162,30 @@
error(node.name, ts.Diagnostics.All_declarations_of_0_must_have_identical_modifiers, ts.declarationNameToString(node.name));
}
}
- if (node.kind !== 154 /* PropertyDeclaration */ && node.kind !== 153 /* PropertySignature */) {
+ if (node.kind !== 155 /* PropertyDeclaration */ && node.kind !== 154 /* PropertySignature */) {
// We know we don't have a binding pattern or computed name here
checkExportsOnMergedDeclarations(node);
- if (node.kind === 237 /* VariableDeclaration */ || node.kind === 186 /* BindingElement */) {
+ if (node.kind === 238 /* VariableDeclaration */ || node.kind === 187 /* BindingElement */) {
checkVarDeclaredNamesNotShadowed(node);
}
checkCollisionWithRequireExportsInGeneratedCode(node, node.name);
checkCollisionWithGlobalPromiseInGeneratedCode(node, node.name);
}
}
- function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstType, nextDeclaration, nextType) {
+ function errorNextVariableOrPropertyDeclarationMustHaveSameType(firstDeclaration, firstType, nextDeclaration, nextType) {
var nextDeclarationName = ts.getNameOfDeclaration(nextDeclaration);
- var message = nextDeclaration.kind === 154 /* PropertyDeclaration */ || nextDeclaration.kind === 153 /* PropertySignature */
+ var message = nextDeclaration.kind === 155 /* PropertyDeclaration */ || nextDeclaration.kind === 154 /* PropertySignature */
? ts.Diagnostics.Subsequent_property_declarations_must_have_the_same_type_Property_0_must_be_of_type_1_but_here_has_type_2
: ts.Diagnostics.Subsequent_variable_declarations_must_have_the_same_type_Variable_0_must_be_of_type_1_but_here_has_type_2;
- error(nextDeclarationName, message, ts.declarationNameToString(nextDeclarationName), typeToString(firstType), typeToString(nextType));
+ var declName = ts.declarationNameToString(nextDeclarationName);
+ var err = error(nextDeclarationName, message, declName, typeToString(firstType), typeToString(nextType));
+ if (firstDeclaration) {
+ ts.addRelatedInfo(err, ts.createDiagnosticForNode(firstDeclaration, ts.Diagnostics._0_was_also_declared_here, declName));
+ }
}
function areDeclarationFlagsIdentical(left, right) {
- if ((left.kind === 151 /* Parameter */ && right.kind === 237 /* VariableDeclaration */) ||
- (left.kind === 237 /* VariableDeclaration */ && right.kind === 151 /* Parameter */)) {
+ if ((left.kind === 152 /* Parameter */ && right.kind === 238 /* VariableDeclaration */) ||
+ (left.kind === 238 /* VariableDeclaration */ && right.kind === 152 /* Parameter */)) {
// Differences in optionality between parameters and variables are allowed.
return true;
}
@@ -55384,7 +56224,7 @@
checkGrammarStatementInAmbientContext(node);
checkTruthinessExpression(node.expression);
checkSourceElement(node.thenStatement);
- if (node.thenStatement.kind === 220 /* EmptyStatement */) {
+ if (node.thenStatement.kind === 221 /* EmptyStatement */) {
error(node.thenStatement, ts.Diagnostics.The_body_of_an_if_statement_cannot_be_the_empty_statement);
}
checkSourceElement(node.elseStatement);
@@ -55411,12 +56251,12 @@
function checkForStatement(node) {
// Grammar checking
if (!checkGrammarStatementInAmbientContext(node)) {
- if (node.initializer && node.initializer.kind === 238 /* VariableDeclarationList */) {
+ if (node.initializer && node.initializer.kind === 239 /* VariableDeclarationList */) {
checkGrammarVariableDeclarationList(node.initializer);
}
}
if (node.initializer) {
- if (node.initializer.kind === 238 /* VariableDeclarationList */) {
+ if (node.initializer.kind === 239 /* VariableDeclarationList */) {
ts.forEach(node.initializer.declarations, checkVariableDeclaration);
}
else {
@@ -55436,7 +56276,7 @@
checkGrammarForInOrForOfStatement(node);
if (node.awaitModifier) {
var functionFlags = ts.getFunctionFlags(ts.getContainingFunction(node));
- if ((functionFlags & (4 /* Invalid */ | 2 /* Async */)) === 2 /* Async */ && languageVersion < 7 /* ESNext */) {
+ if ((functionFlags & (4 /* Invalid */ | 2 /* Async */)) === 2 /* Async */ && languageVersion < 8 /* ESNext */) {
// for..await..of in an async function or async generator function prior to ESNext requires the __asyncValues helper
checkExternalEmitHelpers(node, 16384 /* ForAwaitOfIncludes */);
}
@@ -55450,14 +56290,14 @@
// via checkRightHandSideOfForOf.
// If the LHS is an expression, check the LHS, as a destructuring assignment or as a reference.
// Then check that the RHS is assignable to it.
- if (node.initializer.kind === 238 /* VariableDeclarationList */) {
+ if (node.initializer.kind === 239 /* VariableDeclarationList */) {
checkForInOrForOfVariableDeclaration(node);
}
else {
var varExpr = node.initializer;
var iteratedType = checkRightHandSideOfForOf(node.expression, node.awaitModifier);
// There may be a destructuring assignment on the left side
- if (varExpr.kind === 187 /* ArrayLiteralExpression */ || varExpr.kind === 188 /* ObjectLiteralExpression */) {
+ if (varExpr.kind === 188 /* ArrayLiteralExpression */ || varExpr.kind === 189 /* ObjectLiteralExpression */) {
// iteratedType may be undefined. In this case, we still want to check the structure of
// varExpr, in particular making sure it's a valid LeftHandSideExpression. But we'd like
// to short circuit the type relation checking as much as possible, so we pass the unknownType.
@@ -55489,7 +56329,7 @@
// for (let VarDecl in Expr) Statement
// VarDecl must be a variable declaration without a type annotation that declares a variable of type Any,
// and Expr must be an expression of type Any, an object type, or a type parameter type.
- if (node.initializer.kind === 238 /* VariableDeclarationList */) {
+ if (node.initializer.kind === 239 /* VariableDeclarationList */) {
var variable = node.initializer.declarations[0];
if (variable && ts.isBindingPattern(variable.name)) {
error(variable.name, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);
@@ -55503,7 +56343,7 @@
// and Expr must be an expression of type Any, an object type, or a type parameter type.
var varExpr = node.initializer;
var leftType = checkExpression(varExpr);
- if (varExpr.kind === 187 /* ArrayLiteralExpression */ || varExpr.kind === 188 /* ObjectLiteralExpression */) {
+ if (varExpr.kind === 188 /* ArrayLiteralExpression */ || varExpr.kind === 189 /* ObjectLiteralExpression */) {
error(varExpr, ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_be_a_destructuring_pattern);
}
else if (!isTypeAssignableTo(getIndexTypeOrString(rightType), leftType)) {
@@ -55863,12 +56703,12 @@
// for generators.
return;
}
- else if (func.kind === 159 /* SetAccessor */) {
+ else if (func.kind === 160 /* SetAccessor */) {
if (node.expression) {
error(node, ts.Diagnostics.Setters_cannot_return_a_value);
}
}
- else if (func.kind === 157 /* Constructor */) {
+ else if (func.kind === 158 /* Constructor */) {
if (node.expression && !checkTypeAssignableToAndOptionallyElaborate(exprType, returnType, node, node.expression)) {
error(node, ts.Diagnostics.Return_type_of_constructor_signature_must_be_assignable_to_the_instance_type_of_the_class);
}
@@ -55889,7 +56729,7 @@
}
}
}
- else if (func.kind !== 157 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType) && !isGenerator) {
+ else if (func.kind !== 158 /* Constructor */ && compilerOptions.noImplicitReturns && !isUnwrappedReturnTypeVoidOrAny(func, returnType) && !isGenerator) {
// The function has a return type, but the return statement doesn't have an expression.
error(node, ts.Diagnostics.Not_all_code_paths_return_a_value);
}
@@ -55918,7 +56758,7 @@
var expressionIsLiteral = isLiteralType(expressionType);
ts.forEach(node.caseBlock.clauses, function (clause) {
// Grammar check for duplicate default clauses, skip if we already report duplicate default clause
- if (clause.kind === 272 /* DefaultClause */ && !hasDuplicateDefaultClause) {
+ if (clause.kind === 273 /* DefaultClause */ && !hasDuplicateDefaultClause) {
if (firstDefaultClause === undefined) {
firstDefaultClause = clause;
}
@@ -55930,7 +56770,7 @@
hasDuplicateDefaultClause = true;
}
}
- if (produceDiagnostics && clause.kind === 271 /* CaseClause */) {
+ if (produceDiagnostics && clause.kind === 272 /* CaseClause */) {
// TypeScript 1.0 spec (April 2014): 5.9
// In a 'switch' statement, each 'case' expression must be of a type that is comparable
// to or from the type of the 'switch' expression.
@@ -55959,7 +56799,7 @@
if (ts.isFunctionLike(current)) {
return "quit";
}
- if (current.kind === 233 /* LabeledStatement */ && current.label.escapedText === node.label.escapedText) {
+ if (current.kind === 234 /* LabeledStatement */ && current.label.escapedText === node.label.escapedText) {
grammarErrorOnNode(node.label, ts.Diagnostics.Duplicate_label_0, ts.getTextOfNode(node.label));
return true;
}
@@ -56066,8 +56906,8 @@
// this allows us to rule out cases when both property and indexer are inherited from the base class
var errorNode;
if (propDeclaration && name &&
- (propDeclaration.kind === 204 /* BinaryExpression */ ||
- name.kind === 149 /* ComputedPropertyName */ ||
+ (propDeclaration.kind === 205 /* BinaryExpression */ ||
+ name.kind === 150 /* ComputedPropertyName */ ||
prop.parent === containingType.symbol)) {
errorNode = propDeclaration;
}
@@ -56144,7 +56984,7 @@
function checkTypeParametersNotReferenced(root, typeParameters, index) {
visit(root);
function visit(node) {
- if (node.kind === 164 /* TypeReference */) {
+ if (node.kind === 165 /* TypeReference */) {
var type = getTypeFromTypeReference(node);
if (type.flags & 262144 /* TypeParameter */) {
for (var i = index; i < typeParameters.length; i++) {
@@ -56266,6 +57106,11 @@
if (languageVersion < 2 /* ES2015 */) {
checkExternalEmitHelpers(baseTypeNode.parent, 1 /* Extends */);
}
+ // check both @extends and extends if both are specified.
+ var extendsNode = ts.getClassExtendsHeritageElement(node);
+ if (extendsNode && extendsNode !== baseTypeNode) {
+ checkExpression(extendsNode.expression);
+ }
var baseTypes = getBaseTypes(type);
if (baseTypes.length && produceDiagnostics) {
var baseType_1 = baseTypes[0];
@@ -56273,10 +57118,6 @@
var staticBaseType = getApparentType(baseConstructorType);
checkBaseTypeAccessibility(staticBaseType, baseTypeNode);
checkSourceElement(baseTypeNode.expression);
- var extendsNode = ts.getClassExtendsHeritageElement(node);
- if (extendsNode && extendsNode !== baseTypeNode) {
- checkExpression(extendsNode.expression);
- }
if (ts.some(baseTypeNode.typeArguments)) {
ts.forEach(baseTypeNode.typeArguments, checkSourceElement);
for (var _i = 0, _a = getConstructorsForTypeArguments(staticBaseType, baseTypeNode.typeArguments, baseTypeNode); _i < _a.length; _i++) {
@@ -56347,7 +57188,7 @@
function issueMemberSpecificError(node, typeWithThis, baseWithThis, broadDiag) {
// iterate over all implemented properties and issue errors on each one which isn't compatible, rather than the class as a whole, if possible
var issuedMemberError = false;
- var _loop_9 = function (member) {
+ var _loop_12 = function (member) {
if (ts.hasStaticModifier(member)) {
return "continue";
}
@@ -56366,7 +57207,7 @@
};
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
- _loop_9(member);
+ _loop_12(member);
}
if (!issuedMemberError) {
// check again with diagnostics to generate a less-specific error
@@ -56392,7 +57233,7 @@
}
function getClassOrInterfaceDeclarationsOfSymbol(symbol) {
return ts.filter(symbol.declarations, function (d) {
- return d.kind === 240 /* ClassDeclaration */ || d.kind === 241 /* InterfaceDeclaration */;
+ return d.kind === 241 /* ClassDeclaration */ || d.kind === 242 /* InterfaceDeclaration */;
});
}
function checkKindsOfPropertyMemberOverrides(type, baseType) {
@@ -56431,7 +57272,7 @@
// If there is no declaration for the derived class (as in the case of class expressions),
// then the class cannot be declared abstract.
if (baseDeclarationFlags & 128 /* Abstract */ && (!derivedClassDecl || !ts.hasModifier(derivedClassDecl, 128 /* Abstract */))) {
- if (derivedClassDecl.kind === 209 /* ClassExpression */) {
+ if (derivedClassDecl.kind === 210 /* ClassExpression */) {
error(derivedClassDecl, ts.Diagnostics.Non_abstract_class_expression_does_not_implement_inherited_abstract_member_0_from_class_1, symbolToString(baseProperty), typeToString(baseType));
}
else {
@@ -56481,8 +57322,8 @@
for (var _i = 0, baseTypes_2 = baseTypes; _i < baseTypes_2.length; _i++) {
var base = baseTypes_2[_i];
var properties = getPropertiesOfType(getTypeWithThisArgument(base, type.thisType));
- for (var _a = 0, properties_6 = properties; _a < properties_6.length; _a++) {
- var prop = properties_6[_a];
+ for (var _a = 0, properties_4 = properties; _a < properties_4.length; _a++) {
+ var prop = properties_4[_a];
var existing = seen.get(prop.escapedName);
if (!existing) {
seen.set(prop.escapedName, { prop: prop, containingType: base });
@@ -56523,7 +57364,7 @@
}
}
function isInstancePropertyWithoutInitializer(node) {
- return node.kind === 154 /* PropertyDeclaration */ &&
+ return node.kind === 155 /* PropertyDeclaration */ &&
!ts.hasModifier(node, 32 /* Static */ | 128 /* Abstract */) &&
!node.exclamationToken &&
!node.initializer;
@@ -56547,7 +57388,7 @@
var symbol = getSymbolOfNode(node);
checkTypeParameterListsIdentical(symbol);
// Only check this symbol once
- var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 241 /* InterfaceDeclaration */);
+ var firstInterfaceDecl = ts.getDeclarationOfKind(symbol, 242 /* InterfaceDeclaration */);
if (node === firstInterfaceDecl) {
var type = getDeclaredTypeOfSymbol(symbol);
var typeWithThis = getTypeWithThisArgument(type);
@@ -56652,7 +57493,7 @@
return value;
function evaluate(expr) {
switch (expr.kind) {
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
var value_2 = evaluate(expr.operand);
if (typeof value_2 === "number") {
switch (expr.operator) {
@@ -56662,7 +57503,7 @@
}
}
break;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
var left = evaluate(expr.left);
var right = evaluate(expr.right);
if (typeof left === "number" && typeof right === "number") {
@@ -56690,22 +57531,22 @@
case 8 /* NumericLiteral */:
checkGrammarNumericLiteral(expr);
return +expr.text;
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return evaluate(expr.expression);
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
var identifier = expr;
if (isInfinityOrNaNString(identifier.escapedText)) {
return +(identifier.escapedText);
}
return ts.nodeIsMissing(expr) ? 0 : evaluateEnumMember(expr, getSymbolOfNode(member.parent), identifier.escapedText);
- case 190 /* ElementAccessExpression */:
- case 189 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
var ex = expr;
if (isConstantMemberAccess(ex)) {
var type = getTypeOfExpression(ex.expression);
if (type.symbol && type.symbol.flags & 384 /* Enum */) {
var name = void 0;
- if (ex.kind === 189 /* PropertyAccessExpression */) {
+ if (ex.kind === 190 /* PropertyAccessExpression */) {
name = ex.name.escapedText;
}
else {
@@ -56736,9 +57577,9 @@
}
}
function isConstantMemberAccess(node) {
- return node.kind === 72 /* Identifier */ ||
- node.kind === 189 /* PropertyAccessExpression */ && isConstantMemberAccess(node.expression) ||
- node.kind === 190 /* ElementAccessExpression */ && isConstantMemberAccess(node.expression) &&
+ return node.kind === 73 /* Identifier */ ||
+ node.kind === 190 /* PropertyAccessExpression */ && isConstantMemberAccess(node.expression) ||
+ node.kind === 191 /* ElementAccessExpression */ && isConstantMemberAccess(node.expression) &&
node.argumentExpression.kind === 10 /* StringLiteral */;
}
function checkEnumDeclaration(node) {
@@ -56773,7 +57614,7 @@
var seenEnumMissingInitialInitializer_1 = false;
ts.forEach(enumSymbol.declarations, function (declaration) {
// return true if we hit a violation of the rule, false otherwise
- if (declaration.kind !== 243 /* EnumDeclaration */) {
+ if (declaration.kind !== 244 /* EnumDeclaration */) {
return false;
}
var enumDeclaration = declaration;
@@ -56796,8 +57637,8 @@
var declarations = symbol.declarations;
for (var _i = 0, declarations_8 = declarations; _i < declarations_8.length; _i++) {
var declaration = declarations_8[_i];
- if ((declaration.kind === 240 /* ClassDeclaration */ ||
- (declaration.kind === 239 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) &&
+ if ((declaration.kind === 241 /* ClassDeclaration */ ||
+ (declaration.kind === 240 /* FunctionDeclaration */ && ts.nodeIsPresent(declaration.body))) &&
!(declaration.flags & 4194304 /* Ambient */)) {
return declaration;
}
@@ -56860,7 +57701,7 @@
}
// if the module merges with a class declaration in the same lexical scope,
// we need to track this to ensure the correct emit.
- var mergedClass = ts.getDeclarationOfKind(symbol, 240 /* ClassDeclaration */);
+ var mergedClass = ts.getDeclarationOfKind(symbol, 241 /* ClassDeclaration */);
if (mergedClass &&
inSameLexicalScope(node, mergedClass)) {
getNodeLinks(node).flags |= 32768 /* LexicalModuleMergesWithClass */;
@@ -56910,23 +57751,23 @@
}
function checkModuleAugmentationElement(node, isGlobalAugmentation) {
switch (node.kind) {
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
// error each individual name in variable statement instead of marking the entire variable statement
for (var _i = 0, _a = node.declarationList.declarations; _i < _a.length; _i++) {
var decl = _a[_i];
checkModuleAugmentationElement(decl, isGlobalAugmentation);
}
break;
- case 254 /* ExportAssignment */:
- case 255 /* ExportDeclaration */:
+ case 255 /* ExportAssignment */:
+ case 256 /* ExportDeclaration */:
grammarErrorOnFirstToken(node, ts.Diagnostics.Exports_and_export_assignments_are_not_permitted_in_module_augmentations);
break;
- case 248 /* ImportEqualsDeclaration */:
- case 249 /* ImportDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 250 /* ImportDeclaration */:
grammarErrorOnFirstToken(node, ts.Diagnostics.Imports_are_not_permitted_in_module_augmentations_Consider_moving_them_to_the_enclosing_external_module);
break;
- case 186 /* BindingElement */:
- case 237 /* VariableDeclaration */:
+ case 187 /* BindingElement */:
+ case 238 /* VariableDeclaration */:
var name = node.name;
if (ts.isBindingPattern(name)) {
for (var _b = 0, _c = name.elements; _b < _c.length; _b++) {
@@ -56937,12 +57778,12 @@
break;
}
// falls through
- case 240 /* ClassDeclaration */:
- case 243 /* EnumDeclaration */:
- case 239 /* FunctionDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 242 /* TypeAliasDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
if (isGlobalAugmentation) {
return;
}
@@ -56963,17 +57804,17 @@
}
function getFirstIdentifier(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return node;
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
do {
node = node.left;
- } while (node.kind !== 72 /* Identifier */);
+ } while (node.kind !== 73 /* Identifier */);
return node;
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
do {
node = node.expression;
- } while (node.kind !== 72 /* Identifier */);
+ } while (node.kind !== 73 /* Identifier */);
return node;
}
}
@@ -56987,9 +57828,9 @@
error(moduleName, ts.Diagnostics.String_literal_expected);
return false;
}
- var inAmbientExternalModule = node.parent.kind === 245 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent);
- if (node.parent.kind !== 284 /* SourceFile */ && !inAmbientExternalModule) {
- error(moduleName, node.kind === 255 /* ExportDeclaration */ ?
+ var inAmbientExternalModule = node.parent.kind === 246 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent);
+ if (node.parent.kind !== 285 /* SourceFile */ && !inAmbientExternalModule) {
+ error(moduleName, node.kind === 256 /* ExportDeclaration */ ?
ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace :
ts.Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module);
return false;
@@ -57022,14 +57863,14 @@
(symbol.flags & 67897832 /* Type */ ? 67897832 /* Type */ : 0) |
(symbol.flags & 1920 /* Namespace */ ? 1920 /* Namespace */ : 0);
if (target.flags & excludedMeanings) {
- var message = node.kind === 257 /* ExportSpecifier */ ?
+ var message = node.kind === 258 /* ExportSpecifier */ ?
ts.Diagnostics.Export_declaration_conflicts_with_exported_declaration_of_0 :
ts.Diagnostics.Import_declaration_conflicts_with_local_declaration_of_0;
error(node, message, symbolToString(symbol));
}
// Don't allow to re-export something with no value side when `--isolatedModules` is set.
if (compilerOptions.isolatedModules
- && node.kind === 257 /* ExportSpecifier */
+ && node.kind === 258 /* ExportSpecifier */
&& !(target.flags & 67220415 /* Value */)
&& !(node.flags & 4194304 /* Ambient */)) {
error(node, ts.Diagnostics.Cannot_re_export_a_type_when_the_isolatedModules_flag_is_provided);
@@ -57056,7 +57897,7 @@
checkImportBinding(importClause);
}
if (importClause.namedBindings) {
- if (importClause.namedBindings.kind === 251 /* NamespaceImport */) {
+ if (importClause.namedBindings.kind === 252 /* NamespaceImport */) {
checkImportBinding(importClause.namedBindings);
}
else {
@@ -57080,7 +57921,7 @@
if (ts.hasModifier(node, 1 /* Export */)) {
markExportAsReferenced(node);
}
- if (node.moduleReference.kind !== 259 /* ExternalModuleReference */) {
+ if (node.moduleReference.kind !== 260 /* ExternalModuleReference */) {
var target = resolveAlias(getSymbolOfNode(node));
if (target !== unknownSymbol) {
if (target.flags & 67220415 /* Value */) {
@@ -57116,10 +57957,10 @@
// export { x, y }
// export { x, y } from "foo"
ts.forEach(node.exportClause.elements, checkExportSpecifier);
- var inAmbientExternalModule = node.parent.kind === 245 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent);
- var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 245 /* ModuleBlock */ &&
+ var inAmbientExternalModule = node.parent.kind === 246 /* ModuleBlock */ && ts.isAmbientModule(node.parent.parent);
+ var inAmbientNamespaceDeclaration = !inAmbientExternalModule && node.parent.kind === 246 /* ModuleBlock */ &&
!node.moduleSpecifier && node.flags & 4194304 /* Ambient */;
- if (node.parent.kind !== 284 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) {
+ if (node.parent.kind !== 285 /* SourceFile */ && !inAmbientExternalModule && !inAmbientNamespaceDeclaration) {
error(node, ts.Diagnostics.Export_declarations_are_not_permitted_in_a_namespace);
}
}
@@ -57136,7 +57977,7 @@
}
}
function checkGrammarModuleElementContext(node, errorMessage) {
- var isInAppropriateContext = node.parent.kind === 284 /* SourceFile */ || node.parent.kind === 245 /* ModuleBlock */ || node.parent.kind === 244 /* ModuleDeclaration */;
+ var isInAppropriateContext = node.parent.kind === 285 /* SourceFile */ || node.parent.kind === 246 /* ModuleBlock */ || node.parent.kind === 245 /* ModuleDeclaration */;
if (!isInAppropriateContext) {
grammarErrorOnFirstToken(node, errorMessage);
}
@@ -57165,8 +58006,8 @@
// If we hit an export assignment in an illegal context, just bail out to avoid cascading errors.
return;
}
- var container = node.parent.kind === 284 /* SourceFile */ ? node.parent : node.parent.parent;
- if (container.kind === 244 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) {
+ var container = node.parent.kind === 285 /* SourceFile */ ? node.parent : node.parent.parent;
+ if (container.kind === 245 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) {
if (node.isExportEquals) {
error(node, ts.Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace);
}
@@ -57179,7 +58020,7 @@
if (!checkGrammarDecoratorsAndModifiers(node) && ts.hasModifiers(node)) {
grammarErrorOnFirstToken(node, ts.Diagnostics.An_export_assignment_cannot_have_modifiers);
}
- if (node.expression.kind === 72 /* Identifier */) {
+ if (node.expression.kind === 73 /* Identifier */) {
markExportAsReferenced(node);
if (ts.getEmitDeclarations(compilerOptions)) {
collectLinkedAliases(node.expression, /*setVisibility*/ true);
@@ -57254,7 +58095,7 @@
return !ts.isAccessor(declaration);
}
function isNotOverload(declaration) {
- return (declaration.kind !== 239 /* FunctionDeclaration */ && declaration.kind !== 156 /* MethodDeclaration */) ||
+ return (declaration.kind !== 240 /* FunctionDeclaration */ && declaration.kind !== 157 /* MethodDeclaration */) ||
!!declaration.body;
}
function checkSourceElement(node) {
@@ -57277,158 +58118,158 @@
// Only bother checking on a few construct kinds. We don't want to be excessively
// hitting the cancellation token on every node we check.
switch (kind) {
- case 244 /* ModuleDeclaration */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 239 /* FunctionDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 240 /* FunctionDeclaration */:
cancellationToken.throwIfCancellationRequested();
}
}
switch (kind) {
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
return checkTypeParameter(node);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return checkParameter(node);
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
return checkPropertyDeclaration(node);
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 160 /* CallSignature */:
- case 161 /* ConstructSignature */:
- case 162 /* IndexSignature */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 161 /* CallSignature */:
+ case 162 /* ConstructSignature */:
+ case 163 /* IndexSignature */:
return checkSignatureDeclaration(node);
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
return checkMethodDeclaration(node);
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return checkConstructorDeclaration(node);
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return checkAccessorDeclaration(node);
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return checkTypeReferenceNode(node);
- case 163 /* TypePredicate */:
+ case 164 /* TypePredicate */:
return checkTypePredicate(node);
- case 167 /* TypeQuery */:
+ case 168 /* TypeQuery */:
return checkTypeQuery(node);
- case 168 /* TypeLiteral */:
+ case 169 /* TypeLiteral */:
return checkTypeLiteral(node);
- case 169 /* ArrayType */:
+ case 170 /* ArrayType */:
return checkArrayType(node);
- case 170 /* TupleType */:
+ case 171 /* TupleType */:
return checkTupleType(node);
- case 173 /* UnionType */:
- case 174 /* IntersectionType */:
+ case 174 /* UnionType */:
+ case 175 /* IntersectionType */:
return checkUnionOrIntersectionType(node);
- case 177 /* ParenthesizedType */:
- case 171 /* OptionalType */:
- case 172 /* RestType */:
+ case 178 /* ParenthesizedType */:
+ case 172 /* OptionalType */:
+ case 173 /* RestType */:
return checkSourceElement(node.type);
- case 178 /* ThisType */:
+ case 179 /* ThisType */:
return checkThisType(node);
- case 179 /* TypeOperator */:
+ case 180 /* TypeOperator */:
return checkTypeOperator(node);
- case 175 /* ConditionalType */:
+ case 176 /* ConditionalType */:
return checkConditionalType(node);
- case 176 /* InferType */:
+ case 177 /* InferType */:
return checkInferType(node);
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return checkImportType(node);
- case 300 /* JSDocAugmentsTag */:
+ case 301 /* JSDocAugmentsTag */:
return checkJSDocAugmentsTag(node);
- case 309 /* JSDocTypedefTag */:
- case 302 /* JSDocCallbackTag */:
+ case 310 /* JSDocTypedefTag */:
+ case 303 /* JSDocCallbackTag */:
return checkJSDocTypeAliasTag(node);
- case 308 /* JSDocTemplateTag */:
+ case 309 /* JSDocTemplateTag */:
return checkJSDocTemplateTag(node);
- case 307 /* JSDocTypeTag */:
+ case 308 /* JSDocTypeTag */:
return checkJSDocTypeTag(node);
- case 304 /* JSDocParameterTag */:
+ case 305 /* JSDocParameterTag */:
return checkJSDocParameterTag(node);
- case 294 /* JSDocFunctionType */:
+ case 295 /* JSDocFunctionType */:
checkJSDocFunctionType(node);
// falls through
- case 292 /* JSDocNonNullableType */:
- case 291 /* JSDocNullableType */:
- case 289 /* JSDocAllType */:
- case 290 /* JSDocUnknownType */:
- case 297 /* JSDocTypeLiteral */:
+ case 293 /* JSDocNonNullableType */:
+ case 292 /* JSDocNullableType */:
+ case 290 /* JSDocAllType */:
+ case 291 /* JSDocUnknownType */:
+ case 298 /* JSDocTypeLiteral */:
checkJSDocTypeIsInJsFile(node);
ts.forEachChild(node, checkSourceElement);
return;
- case 295 /* JSDocVariadicType */:
+ case 296 /* JSDocVariadicType */:
checkJSDocVariadicType(node);
return;
- case 288 /* JSDocTypeExpression */:
+ case 289 /* JSDocTypeExpression */:
return checkSourceElement(node.type);
- case 180 /* IndexedAccessType */:
+ case 181 /* IndexedAccessType */:
return checkIndexedAccessType(node);
- case 181 /* MappedType */:
+ case 182 /* MappedType */:
return checkMappedType(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return checkFunctionDeclaration(node);
- case 218 /* Block */:
- case 245 /* ModuleBlock */:
+ case 219 /* Block */:
+ case 246 /* ModuleBlock */:
return checkBlock(node);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return checkVariableStatement(node);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return checkExpressionStatement(node);
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
return checkIfStatement(node);
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
return checkDoStatement(node);
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
return checkWhileStatement(node);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return checkForStatement(node);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return checkForInStatement(node);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return checkForOfStatement(node);
- case 228 /* ContinueStatement */:
- case 229 /* BreakStatement */:
+ case 229 /* ContinueStatement */:
+ case 230 /* BreakStatement */:
return checkBreakOrContinueStatement(node);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return checkReturnStatement(node);
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
return checkWithStatement(node);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return checkSwitchStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return checkLabeledStatement(node);
- case 234 /* ThrowStatement */:
+ case 235 /* ThrowStatement */:
return checkThrowStatement(node);
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
return checkTryStatement(node);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return checkVariableDeclaration(node);
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return checkBindingElement(node);
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return checkClassDeclaration(node);
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
return checkInterfaceDeclaration(node);
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return checkTypeAliasDeclaration(node);
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return checkEnumDeclaration(node);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return checkModuleDeclaration(node);
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return checkImportDeclaration(node);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return checkImportEqualsDeclaration(node);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return checkExportDeclaration(node);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return checkExportAssignment(node);
- case 220 /* EmptyStatement */:
- case 236 /* DebuggerStatement */:
+ case 221 /* EmptyStatement */:
+ case 237 /* DebuggerStatement */:
checkGrammarStatementInAmbientContext(node);
return;
- case 258 /* MissingDeclaration */:
+ case 259 /* MissingDeclaration */:
return checkMissingDeclaration(node);
}
}
@@ -57522,23 +58363,23 @@
var saveCurrentNode = currentNode;
currentNode = node;
switch (node.kind) {
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
checkFunctionExpressionOrObjectLiteralMethodDeferred(node);
break;
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
checkAccessorDeclaration(node);
break;
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
checkClassExpressionDeferred(node);
break;
- case 261 /* JsxSelfClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
checkJsxSelfClosingElementDeferred(node);
break;
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
checkJsxElementDeferred(node);
break;
}
@@ -57668,17 +58509,17 @@
copySymbols(location.locals, meaning);
}
switch (location.kind) {
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
if (!ts.isExternalOrCommonJsModule(location))
break;
// falls through
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
copySymbols(getSymbolOfNode(location).exports, meaning & 2623475 /* ModuleMember */);
break;
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
copySymbols(getSymbolOfNode(location).exports, meaning & 8 /* EnumMember */);
break;
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
var className = location.name;
if (className) {
copySymbol(location.symbol, meaning);
@@ -57686,8 +58527,8 @@
// falls through
// this fall-through is necessary because we would like to handle
// type parameter inside class expression similar to how we handle it in classDeclaration and interface Declaration
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
// If we didn't come from static member of class or interface,
// add the type parameters into the symbol table
// (type parameters of classDeclaration/classExpression and interface are in member property of the symbol.
@@ -57696,7 +58537,7 @@
copySymbols(getMembersOfSymbol(getSymbolOfNode(location)), meaning & 67897832 /* Type */);
}
break;
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
var funcName = location.name;
if (funcName) {
copySymbol(location.symbol, meaning);
@@ -57738,17 +58579,17 @@
}
}
function isTypeDeclarationName(name) {
- return name.kind === 72 /* Identifier */ &&
+ return name.kind === 73 /* Identifier */ &&
isTypeDeclaration(name.parent) &&
name.parent.name === name;
}
function isTypeDeclaration(node) {
switch (node.kind) {
- case 150 /* TypeParameter */:
- case 240 /* ClassDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 243 /* EnumDeclaration */:
+ case 151 /* TypeParameter */:
+ case 241 /* ClassDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 244 /* EnumDeclaration */:
return true;
default:
return false;
@@ -57756,16 +58597,16 @@
}
// True if the given identifier is part of a type reference
function isTypeReferenceIdentifier(node) {
- while (node.parent.kind === 148 /* QualifiedName */) {
+ while (node.parent.kind === 149 /* QualifiedName */) {
node = node.parent;
}
- return node.parent.kind === 164 /* TypeReference */;
+ return node.parent.kind === 165 /* TypeReference */;
}
function isHeritageClauseElementIdentifier(node) {
- while (node.parent.kind === 189 /* PropertyAccessExpression */) {
+ while (node.parent.kind === 190 /* PropertyAccessExpression */) {
node = node.parent;
}
- return node.parent.kind === 211 /* ExpressionWithTypeArguments */;
+ return node.parent.kind === 212 /* ExpressionWithTypeArguments */;
}
function forEachEnclosingClass(node, callback) {
var result;
@@ -57793,13 +58634,13 @@
return !!forEachEnclosingClass(node, function (n) { return n === classDeclaration; });
}
function getLeftSideOfImportEqualsOrExportAssignment(nodeOnRightSide) {
- while (nodeOnRightSide.parent.kind === 148 /* QualifiedName */) {
+ while (nodeOnRightSide.parent.kind === 149 /* QualifiedName */) {
nodeOnRightSide = nodeOnRightSide.parent;
}
- if (nodeOnRightSide.parent.kind === 248 /* ImportEqualsDeclaration */) {
+ if (nodeOnRightSide.parent.kind === 249 /* ImportEqualsDeclaration */) {
return nodeOnRightSide.parent.moduleReference === nodeOnRightSide ? nodeOnRightSide.parent : undefined;
}
- if (nodeOnRightSide.parent.kind === 254 /* ExportAssignment */) {
+ if (nodeOnRightSide.parent.kind === 255 /* ExportAssignment */) {
return nodeOnRightSide.parent.expression === nodeOnRightSide ? nodeOnRightSide.parent : undefined;
}
return undefined;
@@ -57825,7 +58666,7 @@
node = parent;
parent = parent.parent;
}
- if (parent && parent.kind === 183 /* ImportType */ && parent.qualifier === node) {
+ if (parent && parent.kind === 184 /* ImportType */ && parent.qualifier === node) {
return parent;
}
return undefined;
@@ -57835,7 +58676,7 @@
return getSymbolOfNode(entityName.parent);
}
if (ts.isInJSFile(entityName) &&
- entityName.parent.kind === 189 /* PropertyAccessExpression */ &&
+ entityName.parent.kind === 190 /* PropertyAccessExpression */ &&
entityName.parent === entityName.parent.parent.left) {
// Check if this is a special property assignment
var specialPropertyAssignmentSymbol = getSpecialPropertyAssignmentSymbolFromEntityName(entityName);
@@ -57843,7 +58684,7 @@
return specialPropertyAssignmentSymbol;
}
}
- if (entityName.parent.kind === 254 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) {
+ if (entityName.parent.kind === 255 /* ExportAssignment */ && ts.isEntityNameExpression(entityName)) {
// Even an entity name expression that doesn't resolve as an entityname may still typecheck as a property access expression
var success = resolveEntityName(entityName,
/*all meanings*/ 67220415 /* Value */ | 67897832 /* Type */ | 1920 /* Namespace */ | 2097152 /* Alias */, /*ignoreErrors*/ true);
@@ -57853,7 +58694,7 @@
}
else if (!ts.isPropertyAccessExpression(entityName) && isInRightSideOfImportOrExportAssignment(entityName)) {
// Since we already checked for ExportAssignment, this really could only be an Import
- var importEqualsDeclaration = ts.getAncestor(entityName, 248 /* ImportEqualsDeclaration */);
+ var importEqualsDeclaration = ts.getAncestor(entityName, 249 /* ImportEqualsDeclaration */);
ts.Debug.assert(importEqualsDeclaration !== undefined);
return getSymbolOfPartOfRightHandSideOfImportEquals(entityName, /*dontResolveAlias*/ true);
}
@@ -57871,7 +58712,7 @@
if (isHeritageClauseElementIdentifier(entityName)) {
var meaning = 0 /* None */;
// In an interface or class, we're definitely interested in a type.
- if (entityName.parent.kind === 211 /* ExpressionWithTypeArguments */) {
+ if (entityName.parent.kind === 212 /* ExpressionWithTypeArguments */) {
meaning = 67897832 /* Type */;
// In a class 'extends' clause we are also looking for a value.
if (ts.isExpressionWithTypeArgumentsInClassExtendsClause(entityName.parent)) {
@@ -57887,10 +58728,10 @@
return entityNameSymbol;
}
}
- if (entityName.parent.kind === 304 /* JSDocParameterTag */) {
+ if (entityName.parent.kind === 305 /* JSDocParameterTag */) {
return ts.getParameterSymbolFromJSDoc(entityName.parent);
}
- if (entityName.parent.kind === 150 /* TypeParameter */ && entityName.parent.parent.kind === 308 /* JSDocTemplateTag */) {
+ if (entityName.parent.kind === 151 /* TypeParameter */ && entityName.parent.parent.kind === 309 /* JSDocTemplateTag */) {
ts.Debug.assert(!ts.isInJSFile(entityName)); // Otherwise `isDeclarationName` would have been true.
var typeParameter = ts.getTypeParameterFromJsDoc(entityName.parent);
return typeParameter && typeParameter.symbol;
@@ -57900,19 +58741,19 @@
// Missing entity name.
return undefined;
}
- if (entityName.kind === 72 /* Identifier */) {
+ if (entityName.kind === 73 /* Identifier */) {
if (ts.isJSXTagName(entityName) && isJsxIntrinsicIdentifier(entityName)) {
var symbol = getIntrinsicTagSymbol(entityName.parent);
return symbol === unknownSymbol ? undefined : symbol;
}
return resolveEntityName(entityName, 67220415 /* Value */, /*ignoreErrors*/ false, /*dontResolveAlias*/ true);
}
- else if (entityName.kind === 189 /* PropertyAccessExpression */ || entityName.kind === 148 /* QualifiedName */) {
+ else if (entityName.kind === 190 /* PropertyAccessExpression */ || entityName.kind === 149 /* QualifiedName */) {
var links = getNodeLinks(entityName);
if (links.resolvedSymbol) {
return links.resolvedSymbol;
}
- if (entityName.kind === 189 /* PropertyAccessExpression */) {
+ if (entityName.kind === 190 /* PropertyAccessExpression */) {
checkPropertyAccessExpression(entityName);
}
else {
@@ -57922,17 +58763,17 @@
}
}
else if (isTypeReferenceIdentifier(entityName)) {
- var meaning = entityName.parent.kind === 164 /* TypeReference */ ? 67897832 /* Type */ : 1920 /* Namespace */;
+ var meaning = entityName.parent.kind === 165 /* TypeReference */ ? 67897832 /* Type */ : 1920 /* Namespace */;
return resolveEntityName(entityName, meaning, /*ignoreErrors*/ false, /*dontResolveAlias*/ true);
}
- if (entityName.parent.kind === 163 /* TypePredicate */) {
+ if (entityName.parent.kind === 164 /* TypePredicate */) {
return resolveEntityName(entityName, /*meaning*/ 1 /* FunctionScopedVariable */);
}
// Do we want to return undefined here?
return undefined;
}
function getSymbolAtLocation(node) {
- if (node.kind === 284 /* SourceFile */) {
+ if (node.kind === 285 /* SourceFile */) {
return ts.isExternalModule(node) ? getMergedSymbol(node.symbol) : undefined;
}
var parent = node.parent;
@@ -57951,12 +58792,12 @@
else if (ts.isLiteralComputedPropertyDeclarationName(node)) {
return getSymbolOfNode(parent.parent);
}
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
if (isInRightSideOfImportOrExportAssignment(node)) {
return getSymbolOfEntityNameOrPropertyAccessExpression(node);
}
- else if (parent.kind === 186 /* BindingElement */ &&
- grandParent.kind === 184 /* ObjectBindingPattern */ &&
+ else if (parent.kind === 187 /* BindingElement */ &&
+ grandParent.kind === 185 /* ObjectBindingPattern */ &&
node === parent.propertyName) {
var typeOfPattern = getTypeOfNode(grandParent);
var propertyDeclaration = getPropertyOfType(typeOfPattern, node.escapedText);
@@ -57966,11 +58807,11 @@
}
}
switch (node.kind) {
- case 72 /* Identifier */:
- case 189 /* PropertyAccessExpression */:
- case 148 /* QualifiedName */:
+ case 73 /* Identifier */:
+ case 190 /* PropertyAccessExpression */:
+ case 149 /* QualifiedName */:
return getSymbolOfEntityNameOrPropertyAccessExpression(node);
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
var container = ts.getThisContainer(node, /*includeArrowFunctions*/ false);
if (ts.isFunctionLike(container)) {
var sig = getSignatureFromDeclaration(container);
@@ -57982,14 +58823,14 @@
return checkExpression(node).symbol;
}
// falls through
- case 178 /* ThisType */:
+ case 179 /* ThisType */:
return getTypeFromThisTypeNode(node).symbol;
- case 98 /* SuperKeyword */:
+ case 99 /* SuperKeyword */:
return checkExpression(node).symbol;
- case 124 /* ConstructorKeyword */:
+ case 125 /* ConstructorKeyword */:
// constructor keyword for an overload, should take us to the definition if it exist
var constructorDeclaration = node.parent;
- if (constructorDeclaration && constructorDeclaration.kind === 157 /* Constructor */) {
+ if (constructorDeclaration && constructorDeclaration.kind === 158 /* Constructor */) {
return constructorDeclaration.parent.symbol;
}
return undefined;
@@ -58000,7 +58841,7 @@
// 3). Dynamic import call or require in javascript
// 4). type A = import("./f/*gotToDefinitionHere*/oo")
if ((ts.isExternalModuleImportEqualsDeclaration(node.parent.parent) && ts.getExternalModuleImportEqualsDeclarationExpression(node.parent.parent) === node) ||
- ((node.parent.kind === 249 /* ImportDeclaration */ || node.parent.kind === 255 /* ExportDeclaration */) && node.parent.moduleSpecifier === node) ||
+ ((node.parent.kind === 250 /* ImportDeclaration */ || node.parent.kind === 256 /* ExportDeclaration */) && node.parent.moduleSpecifier === node) ||
((ts.isInJSFile(node) && ts.isRequireCall(node.parent, /*checkArgumentIsStringLiteralLike*/ false)) || ts.isImportCall(node.parent)) ||
(ts.isLiteralTypeNode(node.parent) && ts.isLiteralImportTypeNode(node.parent.parent) && node.parent.parent.argument === node.parent)) {
return resolveExternalModuleName(node, node);
@@ -58017,21 +58858,21 @@
? getTypeFromTypeNode(grandParent.objectType)
: undefined;
return objectType && getPropertyOfType(objectType, ts.escapeLeadingUnderscores(node.text));
- case 80 /* DefaultKeyword */:
- case 90 /* FunctionKeyword */:
+ case 81 /* DefaultKeyword */:
+ case 91 /* FunctionKeyword */:
case 37 /* EqualsGreaterThanToken */:
- case 76 /* ClassKeyword */:
+ case 77 /* ClassKeyword */:
return getSymbolOfNode(node.parent);
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return ts.isLiteralImportTypeNode(node) ? getSymbolAtLocation(node.argument.literal) : undefined;
- case 85 /* ExportKeyword */:
+ case 86 /* ExportKeyword */:
return ts.isExportAssignment(node.parent) ? ts.Debug.assertDefined(node.parent.symbol) : undefined;
default:
return undefined;
}
}
function getShorthandAssignmentValueSymbol(location) {
- if (location && location.kind === 276 /* ShorthandPropertyAssignment */) {
+ if (location && location.kind === 277 /* ShorthandPropertyAssignment */) {
return resolveEntityName(location.name, 67220415 /* Value */ | 2097152 /* Alias */);
}
return undefined;
@@ -58098,33 +58939,35 @@
// }
// [ a ] from
// [a] = [ some array ...]
- function getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr) {
- ts.Debug.assert(expr.kind === 188 /* ObjectLiteralExpression */ || expr.kind === 187 /* ArrayLiteralExpression */);
+ function getTypeOfAssignmentPattern(expr) {
+ ts.Debug.assert(expr.kind === 189 /* ObjectLiteralExpression */ || expr.kind === 188 /* ArrayLiteralExpression */);
// If this is from "for of"
// for ( { a } of elems) {
// }
- if (expr.parent.kind === 227 /* ForOfStatement */) {
+ if (expr.parent.kind === 228 /* ForOfStatement */) {
var iteratedType = checkRightHandSideOfForOf(expr.parent.expression, expr.parent.awaitModifier);
return checkDestructuringAssignment(expr, iteratedType || errorType);
}
// If this is from "for" initializer
// for ({a } = elems[0];.....) { }
- if (expr.parent.kind === 204 /* BinaryExpression */) {
+ if (expr.parent.kind === 205 /* BinaryExpression */) {
var iteratedType = getTypeOfExpression(expr.parent.right);
return checkDestructuringAssignment(expr, iteratedType || errorType);
}
// If this is from nested object binding pattern
// for ({ skills: { primary, secondary } } = multiRobot, i = 0; i < 1; i++) {
- if (expr.parent.kind === 275 /* PropertyAssignment */) {
- var typeOfParentObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent.parent);
- return checkObjectLiteralDestructuringPropertyAssignment(typeOfParentObjectLiteral || errorType, expr.parent); // TODO: GH#18217
+ if (expr.parent.kind === 276 /* PropertyAssignment */) {
+ var node_3 = ts.cast(expr.parent.parent, ts.isObjectLiteralExpression);
+ var typeOfParentObjectLiteral = getTypeOfAssignmentPattern(node_3) || errorType;
+ var propertyIndex = ts.indexOfNode(node_3.properties, expr.parent);
+ return checkObjectLiteralDestructuringPropertyAssignment(node_3, typeOfParentObjectLiteral, propertyIndex);
}
// Array literal assignment - array destructuring pattern
- ts.Debug.assert(expr.parent.kind === 187 /* ArrayLiteralExpression */);
+ var node = ts.cast(expr.parent, ts.isArrayLiteralExpression);
// [{ property1: p1, property2 }] = elems;
- var typeOfArrayLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(expr.parent);
- var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral || errorType, expr.parent, /*allowStringInput*/ false, /*allowAsyncIterables*/ false) || errorType;
- return checkArrayLiteralDestructuringElementAssignment(expr.parent, typeOfArrayLiteral, expr.parent.elements.indexOf(expr), elementType || errorType); // TODO: GH#18217
+ var typeOfArrayLiteral = getTypeOfAssignmentPattern(node) || errorType;
+ var elementType = checkIteratedTypeOrElementType(typeOfArrayLiteral, expr.parent, /*allowStringInput*/ false, /*allowAsyncIterables*/ false) || errorType;
+ return checkArrayLiteralDestructuringElementAssignment(node, typeOfArrayLiteral, node.elements.indexOf(expr), elementType);
}
// Gets the property symbol corresponding to the property in destructuring assignment
// 'property1' from
@@ -58134,7 +58977,7 @@
// [a] = [ property1, property2 ]
function getPropertySymbolOfDestructuringAssignment(location) {
// Get the type of the object or array literal and then look for property of given name in the type
- var typeOfObjectLiteral = getTypeOfArrayLiteralOrObjectLiteralDestructuringAssignment(location.parent.parent);
+ var typeOfObjectLiteral = getTypeOfAssignmentPattern(ts.cast(location.parent.parent, ts.isAssignmentPattern));
return typeOfObjectLiteral && getPropertyOfType(typeOfObjectLiteral, location.escapedText);
}
function getRegularTypeOfExpression(expr) {
@@ -58156,12 +58999,12 @@
function getClassElementPropertyKeyType(element) {
var name = element.name;
switch (name.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return getLiteralType(ts.idText(name));
case 8 /* NumericLiteral */:
case 10 /* StringLiteral */:
return getLiteralType(name.text);
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
var nameType = checkComputedPropertyName(name);
return isTypeAssignableToKind(nameType, 12288 /* ESSymbolLike */) ? nameType : stringType;
default:
@@ -58218,7 +59061,7 @@
if (!ts.isGeneratedIdentifier(nodeIn)) {
var node = ts.getParseTreeNode(nodeIn, ts.isIdentifier);
if (node) {
- var isPropertyName_1 = node.parent.kind === 189 /* PropertyAccessExpression */ && node.parent.name === node;
+ var isPropertyName_1 = node.parent.kind === 190 /* PropertyAccessExpression */ && node.parent.name === node;
return !isPropertyName_1 && getReferencedValueSymbol(node) === argumentsSymbol;
}
}
@@ -58274,7 +59117,7 @@
}
var parentSymbol_1 = getParentOfSymbol(symbol);
if (parentSymbol_1) {
- if (parentSymbol_1.flags & 512 /* ValueModule */ && parentSymbol_1.valueDeclaration.kind === 284 /* SourceFile */) {
+ if (parentSymbol_1.flags & 512 /* ValueModule */ && parentSymbol_1.valueDeclaration.kind === 285 /* SourceFile */) {
var symbolFile = parentSymbol_1.valueDeclaration;
var referenceFile = ts.getSourceFileOfNode(node);
// If `node` accesses an export and that export isn't in the same file, then symbol is a namespace export, so return undefined.
@@ -58300,12 +59143,16 @@
}
return undefined;
}
+ function isSymbolOfDestructuredElementOfCatchBinding(symbol) {
+ return ts.isBindingElement(symbol.valueDeclaration)
+ && ts.walkUpBindingElementsAndPatterns(symbol.valueDeclaration).parent.kind === 275 /* CatchClause */;
+ }
function isSymbolOfDeclarationWithCollidingName(symbol) {
if (symbol.flags & 418 /* BlockScoped */ && !ts.isSourceFile(symbol.valueDeclaration)) {
var links = getSymbolLinks(symbol);
if (links.isDeclarationWithCollidingName === undefined) {
var container = ts.getEnclosingBlockScopeContainer(symbol.valueDeclaration);
- if (ts.isStatementWithLocals(container)) {
+ if (ts.isStatementWithLocals(container) || isSymbolOfDestructuredElementOfCatchBinding(symbol)) {
var nodeLinks_1 = getNodeLinks(symbol.valueDeclaration);
if (resolveName(container.parent, symbol.escapedName, 67220415 /* Value */, /*nameNotFoundMessage*/ undefined, /*nameArg*/ undefined, /*isUse*/ false)) {
// redeclaration - always should be renamed
@@ -58329,7 +59176,7 @@
// they will not collide with anything
var isDeclaredInLoop = nodeLinks_1.flags & 524288 /* BlockScopedBindingInLoop */;
var inLoopInitializer = ts.isIterationStatement(container, /*lookInLabeledStatements*/ false);
- var inLoopBodyBlock = container.kind === 218 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false);
+ var inLoopBodyBlock = container.kind === 219 /* Block */ && ts.isIterationStatement(container.parent, /*lookInLabeledStatements*/ false);
links.isDeclarationWithCollidingName = !ts.isBlockScopedContainerTopLevel(container) && (!isDeclaredInLoop || (!inLoopInitializer && !inLoopBodyBlock));
}
else {
@@ -58370,18 +59217,18 @@
}
function isValueAliasDeclaration(node) {
switch (node.kind) {
- case 248 /* ImportEqualsDeclaration */:
- case 250 /* ImportClause */:
- case 251 /* NamespaceImport */:
- case 253 /* ImportSpecifier */:
- case 257 /* ExportSpecifier */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 251 /* ImportClause */:
+ case 252 /* NamespaceImport */:
+ case 254 /* ImportSpecifier */:
+ case 258 /* ExportSpecifier */:
return isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
var exportClause = node.exportClause;
return !!exportClause && ts.some(exportClause.elements, isValueAliasDeclaration);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return node.expression
- && node.expression.kind === 72 /* Identifier */
+ && node.expression.kind === 73 /* Identifier */
? isAliasResolvedToValue(getSymbolOfNode(node) || unknownSymbol)
: true;
}
@@ -58389,7 +59236,7 @@
}
function isTopLevelValueImportEqualsWithEntityName(nodeIn) {
var node = ts.getParseTreeNode(nodeIn, ts.isImportEqualsDeclaration);
- if (node === undefined || node.parent.kind !== 284 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) {
+ if (node === undefined || node.parent.kind !== 285 /* SourceFile */ || !ts.isInternalModuleImportEqualsDeclaration(node)) {
// parent is not source file or it is not reference to internal module
return false;
}
@@ -58490,15 +59337,15 @@
}
function canHaveConstantValue(node) {
switch (node.kind) {
- case 278 /* EnumMember */:
- case 189 /* PropertyAccessExpression */:
- case 190 /* ElementAccessExpression */:
+ case 279 /* EnumMember */:
+ case 190 /* PropertyAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return true;
}
return false;
}
function getConstantValue(node) {
- if (node.kind === 278 /* EnumMember */) {
+ if (node.kind === 279 /* EnumMember */) {
return getEnumMemberValue(node);
}
var symbol = getNodeLinks(node).resolvedSymbol;
@@ -58583,7 +59430,7 @@
function createTypeOfDeclaration(declarationIn, enclosingDeclaration, flags, tracker, addUndefined) {
var declaration = ts.getParseTreeNode(declarationIn, ts.isVariableLikeOrAccessor);
if (!declaration) {
- return ts.createToken(120 /* AnyKeyword */);
+ return ts.createToken(121 /* AnyKeyword */);
}
// Get type of the symbol if this is the valid symbol otherwise get type at location
var symbol = getSymbolOfNode(declaration);
@@ -58602,7 +59449,7 @@
function createReturnTypeOfSignatureDeclaration(signatureDeclarationIn, enclosingDeclaration, flags, tracker) {
var signatureDeclaration = ts.getParseTreeNode(signatureDeclarationIn, ts.isFunctionLike);
if (!signatureDeclaration) {
- return ts.createToken(120 /* AnyKeyword */);
+ return ts.createToken(121 /* AnyKeyword */);
}
var signature = getSignatureFromDeclaration(signatureDeclaration);
return nodeBuilder.typeToTypeNode(getReturnTypeOfSignature(signature), enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
@@ -58610,7 +59457,7 @@
function createTypeOfExpression(exprIn, enclosingDeclaration, flags, tracker) {
var expr = ts.getParseTreeNode(exprIn, ts.isExpression);
if (!expr) {
- return ts.createToken(120 /* AnyKeyword */);
+ return ts.createToken(121 /* AnyKeyword */);
}
var type = getWidenedType(getRegularTypeOfExpression(expr));
return nodeBuilder.typeToTypeNode(type, enclosingDeclaration, flags | 1024 /* MultilineObjectLiterals */, tracker);
@@ -58729,17 +59576,17 @@
isLateBound: function (nodeIn) {
var node = ts.getParseTreeNode(nodeIn, ts.isDeclaration);
var symbol = node && getSymbolOfNode(node);
- return !!(symbol && ts.getCheckFlags(symbol) & 2048 /* Late */);
+ return !!(symbol && ts.getCheckFlags(symbol) & 4096 /* Late */);
},
getJsxFactoryEntity: function (location) { return location ? (getJsxNamespace(location), (ts.getSourceFileOfNode(location).localJsxFactory || _jsxFactoryEntity)) : _jsxFactoryEntity; },
getAllAccessorDeclarations: function (accessor) {
accessor = ts.getParseTreeNode(accessor, ts.isGetOrSetAccessorDeclaration); // TODO: GH#18217
- var otherKind = accessor.kind === 159 /* SetAccessor */ ? 158 /* GetAccessor */ : 159 /* SetAccessor */;
+ var otherKind = accessor.kind === 160 /* SetAccessor */ ? 159 /* GetAccessor */ : 160 /* SetAccessor */;
var otherAccessor = ts.getDeclarationOfKind(getSymbolOfNode(accessor), otherKind);
var firstAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? otherAccessor : accessor;
var secondAccessor = otherAccessor && (otherAccessor.pos < accessor.pos) ? accessor : otherAccessor;
- var setAccessor = accessor.kind === 159 /* SetAccessor */ ? accessor : otherAccessor;
- var getAccessor = accessor.kind === 158 /* GetAccessor */ ? accessor : otherAccessor;
+ var setAccessor = accessor.kind === 160 /* SetAccessor */ ? accessor : otherAccessor;
+ var getAccessor = accessor.kind === 159 /* GetAccessor */ ? accessor : otherAccessor;
return {
firstAccessor: firstAccessor,
secondAccessor: secondAccessor,
@@ -58755,7 +59602,7 @@
}
};
function isInHeritageClause(node) {
- return node.parent && node.parent.kind === 211 /* ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 273 /* HeritageClause */;
+ return node.parent && node.parent.kind === 212 /* ExpressionWithTypeArguments */ && node.parent.parent && node.parent.parent.kind === 274 /* HeritageClause */;
}
// defined here to avoid outer scope pollution
function getTypeReferenceDirectivesForEntityName(node) {
@@ -58767,7 +59614,7 @@
// qualified names can only be used as types\namespaces
// identifiers are treated as values only if they appear in type queries
var meaning = 67897832 /* Type */ | 1920 /* Namespace */;
- if ((node.kind === 72 /* Identifier */ && isInTypeQuery(node)) || (node.kind === 189 /* PropertyAccessExpression */ && !isInHeritageClause(node))) {
+ if ((node.kind === 73 /* Identifier */ && isInTypeQuery(node)) || (node.kind === 190 /* PropertyAccessExpression */ && !isInHeritageClause(node))) {
meaning = 67220415 /* Value */ | 1048576 /* ExportValue */;
}
var symbol = resolveEntityName(node, meaning, /*ignoreErrors*/ true);
@@ -58818,7 +59665,7 @@
break;
}
}
- if (current.valueDeclaration && current.valueDeclaration.kind === 284 /* SourceFile */ && current.flags & 512 /* ValueModule */) {
+ if (current.valueDeclaration && current.valueDeclaration.kind === 285 /* SourceFile */ && current.flags & 512 /* ValueModule */) {
return false;
}
// check that at least one declaration of top level symbol originates from type declaration file
@@ -58846,12 +59693,12 @@
}
}
function getExternalModuleFileFromDeclaration(declaration) {
- var specifier = declaration.kind === 244 /* ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration);
+ var specifier = declaration.kind === 245 /* ModuleDeclaration */ ? ts.tryCast(declaration.name, ts.isStringLiteral) : ts.getExternalModuleName(declaration);
var moduleSymbol = resolveExternalModuleNameWorker(specifier, specifier, /*moduleNotFoundError*/ undefined); // TODO: GH#18217
if (!moduleSymbol) {
return undefined;
}
- return ts.getDeclarationOfKind(moduleSymbol, 284 /* SourceFile */);
+ return ts.getDeclarationOfKind(moduleSymbol, 285 /* SourceFile */);
}
function initializeTypeChecker() {
// Bind all source files and propagate errors
@@ -58868,6 +59715,15 @@
continue;
}
if (!ts.isExternalOrCommonJsModule(file)) {
+ // It is an error for a non-external-module (i.e. script) to declare its own `globalThis`.
+ // We can't use `builtinGlobals` for this due to synthetic expando-namespace generation in JS files.
+ var fileGlobalThisSymbol = file.locals.get("globalThis");
+ if (fileGlobalThisSymbol) {
+ for (var _d = 0, _e = fileGlobalThisSymbol.declarations; _d < _e.length; _d++) {
+ var declaration = _e[_d];
+ diagnostics.add(ts.createDiagnosticForNode(declaration, ts.Diagnostics.Declaration_name_conflicts_with_built_in_global_identifier_0, "globalThis"));
+ }
+ }
mergeSymbolTable(globals, file.locals);
}
if (file.jsGlobalAugmentations) {
@@ -58898,10 +59754,10 @@
if (augmentations) {
// merge _global_ module augmentations.
// this needs to be done after global symbol table is initialized to make sure that all ambient modules are indexed
- for (var _d = 0, augmentations_1 = augmentations; _d < augmentations_1.length; _d++) {
- var list = augmentations_1[_d];
- for (var _e = 0, list_1 = list; _e < list_1.length; _e++) {
- var augmentation = list_1[_e];
+ for (var _f = 0, augmentations_1 = augmentations; _f < augmentations_1.length; _f++) {
+ var list = augmentations_1[_f];
+ for (var _g = 0, list_1 = list; _g < list_1.length; _g++) {
+ var augmentation = list_1[_g];
if (!ts.isGlobalScopeAugmentation(augmentation.parent))
continue;
mergeModuleAugmentation(augmentation);
@@ -58913,6 +59769,7 @@
getSymbolLinks(undefinedSymbol).type = undefinedWideningType;
getSymbolLinks(argumentsSymbol).type = getGlobalType("IArguments", /*arity*/ 0, /*reportErrors*/ true);
getSymbolLinks(unknownSymbol).type = errorType;
+ getSymbolLinks(globalThisSymbol).type = createObjectType(16 /* Anonymous */, globalThisSymbol);
// Initialize special types
globalArrayType = getGlobalType("Array", /*arity*/ 1, /*reportErrors*/ true);
globalObjectType = getGlobalType("Object", /*arity*/ 0, /*reportErrors*/ true);
@@ -58935,10 +59792,10 @@
if (augmentations) {
// merge _nonglobal_ module augmentations.
// this needs to be done after global symbol table is initialized to make sure that all ambient modules are indexed
- for (var _f = 0, augmentations_2 = augmentations; _f < augmentations_2.length; _f++) {
- var list = augmentations_2[_f];
- for (var _g = 0, list_2 = list; _g < list_2.length; _g++) {
- var augmentation = list_2[_g];
+ for (var _h = 0, augmentations_2 = augmentations; _h < augmentations_2.length; _h++) {
+ var list = augmentations_2[_h];
+ for (var _j = 0, list_2 = list; _j < list_2.length; _j++) {
+ var augmentation = list_2[_j];
if (ts.isGlobalScopeAugmentation(augmentation.parent))
continue;
mergeModuleAugmentation(augmentation);
@@ -59029,14 +59886,14 @@
return false;
}
if (!ts.nodeCanBeDecorated(node, node.parent, node.parent.parent)) {
- if (node.kind === 156 /* MethodDeclaration */ && !ts.nodeIsPresent(node.body)) {
+ if (node.kind === 157 /* MethodDeclaration */ && !ts.nodeIsPresent(node.body)) {
return grammarErrorOnFirstToken(node, ts.Diagnostics.A_decorator_can_only_decorate_a_method_implementation_not_an_overload);
}
else {
return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_are_not_valid_here);
}
}
- else if (node.kind === 158 /* GetAccessor */ || node.kind === 159 /* SetAccessor */) {
+ else if (node.kind === 159 /* GetAccessor */ || node.kind === 160 /* SetAccessor */) {
var accessors = ts.getAllAccessorDeclarations(node.parent.members, node);
if (accessors.firstAccessor.decorators && node === accessors.secondAccessor) {
return grammarErrorOnFirstToken(node, ts.Diagnostics.Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name);
@@ -59053,23 +59910,23 @@
var flags = 0 /* None */;
for (var _i = 0, _a = node.modifiers; _i < _a.length; _i++) {
var modifier = _a[_i];
- if (modifier.kind !== 133 /* ReadonlyKeyword */) {
- if (node.kind === 153 /* PropertySignature */ || node.kind === 155 /* MethodSignature */) {
+ if (modifier.kind !== 134 /* ReadonlyKeyword */) {
+ if (node.kind === 154 /* PropertySignature */ || node.kind === 156 /* MethodSignature */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_type_member, ts.tokenToString(modifier.kind));
}
- if (node.kind === 162 /* IndexSignature */) {
+ if (node.kind === 163 /* IndexSignature */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_an_index_signature, ts.tokenToString(modifier.kind));
}
}
switch (modifier.kind) {
- case 77 /* ConstKeyword */:
- if (node.kind !== 243 /* EnumDeclaration */) {
- return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(77 /* ConstKeyword */));
+ case 78 /* ConstKeyword */:
+ if (node.kind !== 244 /* EnumDeclaration */) {
+ return grammarErrorOnNode(node, ts.Diagnostics.A_class_member_cannot_have_the_0_keyword, ts.tokenToString(78 /* ConstKeyword */));
}
break;
- case 115 /* PublicKeyword */:
- case 114 /* ProtectedKeyword */:
- case 113 /* PrivateKeyword */:
+ case 116 /* PublicKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 114 /* PrivateKeyword */:
var text = visibilityToString(ts.modifierToFlag(modifier.kind));
if (flags & 28 /* AccessibilityModifier */) {
return grammarErrorOnNode(modifier, ts.Diagnostics.Accessibility_modifier_already_seen);
@@ -59083,11 +59940,11 @@
else if (flags & 256 /* Async */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, text, "async");
}
- else if (node.parent.kind === 245 /* ModuleBlock */ || node.parent.kind === 284 /* SourceFile */) {
+ else if (node.parent.kind === 246 /* ModuleBlock */ || node.parent.kind === 285 /* SourceFile */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, text);
}
else if (flags & 128 /* Abstract */) {
- if (modifier.kind === 113 /* PrivateKeyword */) {
+ if (modifier.kind === 114 /* PrivateKeyword */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_with_1_modifier, text, "abstract");
}
else {
@@ -59096,7 +59953,7 @@
}
flags |= ts.modifierToFlag(modifier.kind);
break;
- case 116 /* StaticKeyword */:
+ case 117 /* StaticKeyword */:
if (flags & 32 /* Static */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "static");
}
@@ -59106,10 +59963,10 @@
else if (flags & 256 /* Async */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "static", "async");
}
- else if (node.parent.kind === 245 /* ModuleBlock */ || node.parent.kind === 284 /* SourceFile */) {
+ else if (node.parent.kind === 246 /* ModuleBlock */ || node.parent.kind === 285 /* SourceFile */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_module_or_namespace_element, "static");
}
- else if (node.kind === 151 /* Parameter */) {
+ else if (node.kind === 152 /* Parameter */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "static");
}
else if (flags & 128 /* Abstract */) {
@@ -59118,18 +59975,18 @@
flags |= 32 /* Static */;
lastStatic = modifier;
break;
- case 133 /* ReadonlyKeyword */:
+ case 134 /* ReadonlyKeyword */:
if (flags & 64 /* Readonly */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "readonly");
}
- else if (node.kind !== 154 /* PropertyDeclaration */ && node.kind !== 153 /* PropertySignature */ && node.kind !== 162 /* IndexSignature */ && node.kind !== 151 /* Parameter */) {
+ else if (node.kind !== 155 /* PropertyDeclaration */ && node.kind !== 154 /* PropertySignature */ && node.kind !== 163 /* IndexSignature */ && node.kind !== 152 /* Parameter */) {
// If node.kind === SyntaxKind.Parameter, checkParameter report an error if it's not a parameter property.
return grammarErrorOnNode(modifier, ts.Diagnostics.readonly_modifier_can_only_appear_on_a_property_declaration_or_index_signature);
}
flags |= 64 /* Readonly */;
lastReadonly = modifier;
break;
- case 85 /* ExportKeyword */:
+ case 86 /* ExportKeyword */:
if (flags & 1 /* Export */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "export");
}
@@ -59142,52 +59999,52 @@
else if (flags & 256 /* Async */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_must_precede_1_modifier, "export", "async");
}
- else if (node.parent.kind === 240 /* ClassDeclaration */) {
+ else if (node.parent.kind === 241 /* ClassDeclaration */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "export");
}
- else if (node.kind === 151 /* Parameter */) {
+ else if (node.kind === 152 /* Parameter */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "export");
}
flags |= 1 /* Export */;
break;
- case 80 /* DefaultKeyword */:
- var container = node.parent.kind === 284 /* SourceFile */ ? node.parent : node.parent.parent;
- if (container.kind === 244 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) {
+ case 81 /* DefaultKeyword */:
+ var container = node.parent.kind === 285 /* SourceFile */ ? node.parent : node.parent.parent;
+ if (container.kind === 245 /* ModuleDeclaration */ && !ts.isAmbientModule(container)) {
return grammarErrorOnNode(modifier, ts.Diagnostics.A_default_export_can_only_be_used_in_an_ECMAScript_style_module);
}
flags |= 512 /* Default */;
break;
- case 125 /* DeclareKeyword */:
+ case 126 /* DeclareKeyword */:
if (flags & 2 /* Ambient */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "declare");
}
else if (flags & 256 /* Async */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async");
}
- else if (node.parent.kind === 240 /* ClassDeclaration */) {
+ else if (node.parent.kind === 241 /* ClassDeclaration */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_class_element, "declare");
}
- else if (node.kind === 151 /* Parameter */) {
+ else if (node.kind === 152 /* Parameter */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "declare");
}
- else if ((node.parent.flags & 4194304 /* Ambient */) && node.parent.kind === 245 /* ModuleBlock */) {
+ else if ((node.parent.flags & 4194304 /* Ambient */) && node.parent.kind === 246 /* ModuleBlock */) {
return grammarErrorOnNode(modifier, ts.Diagnostics.A_declare_modifier_cannot_be_used_in_an_already_ambient_context);
}
flags |= 2 /* Ambient */;
lastDeclare = modifier;
break;
- case 118 /* AbstractKeyword */:
+ case 119 /* AbstractKeyword */:
if (flags & 128 /* Abstract */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "abstract");
}
- if (node.kind !== 240 /* ClassDeclaration */) {
- if (node.kind !== 156 /* MethodDeclaration */ &&
- node.kind !== 154 /* PropertyDeclaration */ &&
- node.kind !== 158 /* GetAccessor */ &&
- node.kind !== 159 /* SetAccessor */) {
+ if (node.kind !== 241 /* ClassDeclaration */) {
+ if (node.kind !== 157 /* MethodDeclaration */ &&
+ node.kind !== 155 /* PropertyDeclaration */ &&
+ node.kind !== 159 /* GetAccessor */ &&
+ node.kind !== 160 /* SetAccessor */) {
return grammarErrorOnNode(modifier, ts.Diagnostics.abstract_modifier_can_only_appear_on_a_class_method_or_property_declaration);
}
- if (!(node.parent.kind === 240 /* ClassDeclaration */ && ts.hasModifier(node.parent, 128 /* Abstract */))) {
+ if (!(node.parent.kind === 241 /* ClassDeclaration */ && ts.hasModifier(node.parent, 128 /* Abstract */))) {
return grammarErrorOnNode(modifier, ts.Diagnostics.Abstract_methods_can_only_appear_within_an_abstract_class);
}
if (flags & 32 /* Static */) {
@@ -59199,14 +60056,14 @@
}
flags |= 128 /* Abstract */;
break;
- case 121 /* AsyncKeyword */:
+ case 122 /* AsyncKeyword */:
if (flags & 256 /* Async */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_already_seen, "async");
}
else if (flags & 2 /* Ambient */ || node.parent.flags & 4194304 /* Ambient */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_be_used_in_an_ambient_context, "async");
}
- else if (node.kind === 151 /* Parameter */) {
+ else if (node.kind === 152 /* Parameter */) {
return grammarErrorOnNode(modifier, ts.Diagnostics._0_modifier_cannot_appear_on_a_parameter, "async");
}
flags |= 256 /* Async */;
@@ -59214,7 +60071,7 @@
break;
}
}
- if (node.kind === 157 /* Constructor */) {
+ if (node.kind === 158 /* Constructor */) {
if (flags & 32 /* Static */) {
return grammarErrorOnNode(lastStatic, ts.Diagnostics._0_modifier_cannot_appear_on_a_constructor_declaration, "static");
}
@@ -59229,13 +60086,13 @@
}
return false;
}
- else if ((node.kind === 249 /* ImportDeclaration */ || node.kind === 248 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) {
+ else if ((node.kind === 250 /* ImportDeclaration */ || node.kind === 249 /* ImportEqualsDeclaration */) && flags & 2 /* Ambient */) {
return grammarErrorOnNode(lastDeclare, ts.Diagnostics.A_0_modifier_cannot_be_used_with_an_import_declaration, "declare");
}
- else if (node.kind === 151 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) {
+ else if (node.kind === 152 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && ts.isBindingPattern(node.name)) {
return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_may_not_be_declared_using_a_binding_pattern);
}
- else if (node.kind === 151 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && node.dotDotDotToken) {
+ else if (node.kind === 152 /* Parameter */ && (flags & 92 /* ParameterPropertyModifier */) && node.dotDotDotToken) {
return grammarErrorOnNode(node, ts.Diagnostics.A_parameter_property_cannot_be_declared_using_a_rest_parameter);
}
if (flags & 256 /* Async */) {
@@ -59256,38 +60113,38 @@
}
function shouldReportBadModifier(node) {
switch (node.kind) {
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 157 /* Constructor */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 162 /* IndexSignature */:
- case 244 /* ModuleDeclaration */:
- case 249 /* ImportDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
- case 255 /* ExportDeclaration */:
- case 254 /* ExportAssignment */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
- case 151 /* Parameter */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 158 /* Constructor */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 163 /* IndexSignature */:
+ case 245 /* ModuleDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 256 /* ExportDeclaration */:
+ case 255 /* ExportAssignment */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
+ case 152 /* Parameter */:
return false;
default:
- if (node.parent.kind === 245 /* ModuleBlock */ || node.parent.kind === 284 /* SourceFile */) {
+ if (node.parent.kind === 246 /* ModuleBlock */ || node.parent.kind === 285 /* SourceFile */) {
return false;
}
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- return nodeHasAnyModifiersExcept(node, 121 /* AsyncKeyword */);
- case 240 /* ClassDeclaration */:
- return nodeHasAnyModifiersExcept(node, 118 /* AbstractKeyword */);
- case 241 /* InterfaceDeclaration */:
- case 219 /* VariableStatement */:
- case 242 /* TypeAliasDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ return nodeHasAnyModifiersExcept(node, 122 /* AsyncKeyword */);
+ case 241 /* ClassDeclaration */:
+ return nodeHasAnyModifiersExcept(node, 119 /* AbstractKeyword */);
+ case 242 /* InterfaceDeclaration */:
+ case 220 /* VariableStatement */:
+ case 243 /* TypeAliasDeclaration */:
return true;
- case 243 /* EnumDeclaration */:
- return nodeHasAnyModifiersExcept(node, 77 /* ConstKeyword */);
+ case 244 /* EnumDeclaration */:
+ return nodeHasAnyModifiersExcept(node, 78 /* ConstKeyword */);
default:
ts.Debug.fail();
return false;
@@ -59299,10 +60156,10 @@
}
function checkGrammarAsyncModifier(node, asyncModifier) {
switch (node.kind) {
- case 156 /* MethodDeclaration */:
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
- case 197 /* ArrowFunction */:
+ case 157 /* MethodDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
+ case 198 /* ArrowFunction */:
return false;
}
return grammarErrorOnNode(asyncModifier, ts.Diagnostics._0_modifier_cannot_be_used_here, "async");
@@ -59417,10 +60274,10 @@
if (!parameter.type) {
return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_must_have_a_type_annotation);
}
- if (parameter.type.kind !== 138 /* StringKeyword */ && parameter.type.kind !== 135 /* NumberKeyword */) {
+ if (parameter.type.kind !== 139 /* StringKeyword */ && parameter.type.kind !== 136 /* NumberKeyword */) {
var type = getTypeFromTypeNode(parameter.type);
if (type.flags & 4 /* String */ || type.flags & 8 /* Number */) {
- return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_cannot_be_a_type_alias_Consider_writing_0_Colon_1_Colon_2_instead, ts.getTextOfNode(parameter.name), typeToString(type), typeToString(getTypeFromTypeNode(node.type)));
+ return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_cannot_be_a_type_alias_Consider_writing_0_Colon_1_Colon_2_instead, ts.getTextOfNode(parameter.name), typeToString(type), typeToString(node.type ? getTypeFromTypeNode(node.type) : anyType));
}
if (type.flags & 1048576 /* Union */ && allTypesAssignableToKind(type, 128 /* StringLiteral */, /*strict*/ true)) {
return grammarErrorOnNode(parameter.name, ts.Diagnostics.An_index_signature_parameter_type_cannot_be_a_union_type_Consider_using_a_mapped_object_type_instead);
@@ -59451,9 +60308,9 @@
}
function checkGrammarForOmittedArgument(args) {
if (args) {
- for (var _i = 0, args_5 = args; _i < args_5.length; _i++) {
- var arg = args_5[_i];
- if (arg.kind === 210 /* OmittedExpression */) {
+ for (var _i = 0, args_4 = args; _i < args_4.length; _i++) {
+ var arg = args_4[_i];
+ if (arg.kind === 211 /* OmittedExpression */) {
return grammarErrorAtPos(arg, arg.pos, 0, ts.Diagnostics.Argument_expression_expected);
}
}
@@ -59483,7 +60340,7 @@
if (!checkGrammarDecoratorsAndModifiers(node) && node.heritageClauses) {
for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) {
var heritageClause = _a[_i];
- if (heritageClause.token === 86 /* ExtendsKeyword */) {
+ if (heritageClause.token === 87 /* ExtendsKeyword */) {
if (seenExtendsClause) {
return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen);
}
@@ -59496,7 +60353,7 @@
seenExtendsClause = true;
}
else {
- ts.Debug.assert(heritageClause.token === 109 /* ImplementsKeyword */);
+ ts.Debug.assert(heritageClause.token === 110 /* ImplementsKeyword */);
if (seenImplementsClause) {
return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.implements_clause_already_seen);
}
@@ -59512,14 +60369,14 @@
if (node.heritageClauses) {
for (var _i = 0, _a = node.heritageClauses; _i < _a.length; _i++) {
var heritageClause = _a[_i];
- if (heritageClause.token === 86 /* ExtendsKeyword */) {
+ if (heritageClause.token === 87 /* ExtendsKeyword */) {
if (seenExtendsClause) {
return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.extends_clause_already_seen);
}
seenExtendsClause = true;
}
else {
- ts.Debug.assert(heritageClause.token === 109 /* ImplementsKeyword */);
+ ts.Debug.assert(heritageClause.token === 110 /* ImplementsKeyword */);
return grammarErrorOnFirstToken(heritageClause, ts.Diagnostics.Interface_declaration_cannot_have_implements_clause);
}
// Grammar checking heritageClause inside class declaration
@@ -59530,20 +60387,20 @@
}
function checkGrammarComputedPropertyName(node) {
// If node is not a computedPropertyName, just skip the grammar checking
- if (node.kind !== 149 /* ComputedPropertyName */) {
+ if (node.kind !== 150 /* ComputedPropertyName */) {
return false;
}
var computedPropertyName = node;
- if (computedPropertyName.expression.kind === 204 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 27 /* CommaToken */) {
+ if (computedPropertyName.expression.kind === 205 /* BinaryExpression */ && computedPropertyName.expression.operatorToken.kind === 27 /* CommaToken */) {
return grammarErrorOnNode(computedPropertyName.expression, ts.Diagnostics.A_comma_expression_is_not_allowed_in_a_computed_property_name);
}
return false;
}
function checkGrammarForGenerator(node) {
if (node.asteriskToken) {
- ts.Debug.assert(node.kind === 239 /* FunctionDeclaration */ ||
- node.kind === 196 /* FunctionExpression */ ||
- node.kind === 156 /* MethodDeclaration */);
+ ts.Debug.assert(node.kind === 240 /* FunctionDeclaration */ ||
+ node.kind === 197 /* FunctionExpression */ ||
+ node.kind === 157 /* MethodDeclaration */);
if (node.flags & 4194304 /* Ambient */) {
return grammarErrorOnNode(node.asteriskToken, ts.Diagnostics.Generators_are_not_allowed_in_an_ambient_context);
}
@@ -59569,15 +60426,22 @@
var seen = ts.createUnderscoreEscapedMap();
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var prop = _a[_i];
- if (prop.kind === 277 /* SpreadAssignment */) {
+ if (prop.kind === 278 /* SpreadAssignment */) {
+ if (inDestructuring) {
+ // a rest property cannot be destructured any further
+ var expression = ts.skipParentheses(prop.expression);
+ if (ts.isArrayLiteralExpression(expression) || ts.isObjectLiteralExpression(expression)) {
+ return grammarErrorOnNode(prop.expression, ts.Diagnostics.A_rest_element_cannot_contain_a_binding_pattern);
+ }
+ }
continue;
}
var name = prop.name;
- if (name.kind === 149 /* ComputedPropertyName */) {
+ if (name.kind === 150 /* ComputedPropertyName */) {
// If the name is not a ComputedPropertyName, the grammar checking will skip it
checkGrammarComputedPropertyName(name);
}
- if (prop.kind === 276 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) {
+ if (prop.kind === 277 /* ShorthandPropertyAssignment */ && !inDestructuring && prop.objectAssignmentInitializer) {
// having objectAssignmentInitializer is only valid in ObjectAssignmentPattern
// outside of destructuring it is a syntax error
return grammarErrorOnNode(prop.equalsToken, ts.Diagnostics.can_only_be_used_in_an_object_literal_property_inside_a_destructuring_assignment);
@@ -59586,7 +60450,7 @@
if (prop.modifiers) {
for (var _b = 0, _c = prop.modifiers; _b < _c.length; _b++) { // TODO: GH#19955
var mod = _c[_b];
- if (mod.kind !== 121 /* AsyncKeyword */ || prop.kind !== 156 /* MethodDeclaration */) {
+ if (mod.kind !== 122 /* AsyncKeyword */ || prop.kind !== 157 /* MethodDeclaration */) {
grammarErrorOnNode(mod, ts.Diagnostics._0_modifier_cannot_be_used_here, ts.getTextOfNode(mod));
}
}
@@ -59601,23 +60465,23 @@
// and either both previous and propId.descriptor have[[Get]] fields or both previous and propId.descriptor have[[Set]] fields
var currentKind = void 0;
switch (prop.kind) {
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
checkGrammarForInvalidExclamationToken(prop.exclamationToken, ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context);
/* tslint:disable:no-switch-case-fall-through */
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
// Grammar checking for computedPropertyName and shorthandPropertyAssignment
checkGrammarForInvalidQuestionMark(prop.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional);
if (name.kind === 8 /* NumericLiteral */) {
checkGrammarNumericLiteral(name);
}
// falls through
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
currentKind = 1 /* Property */;
break;
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
currentKind = 2 /* GetAccessor */;
break;
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
currentKind = 4 /* SetAccessor */;
break;
default:
@@ -59654,7 +60518,7 @@
var seen = ts.createUnderscoreEscapedMap();
for (var _i = 0, _a = node.attributes.properties; _i < _a.length; _i++) {
var attr = _a[_i];
- if (attr.kind === 269 /* JsxSpreadAttribute */) {
+ if (attr.kind === 270 /* JsxSpreadAttribute */) {
continue;
}
var name = attr.name, initializer = attr.initializer;
@@ -59664,7 +60528,7 @@
else {
return grammarErrorOnNode(name, ts.Diagnostics.JSX_elements_cannot_have_multiple_attributes_with_the_same_name);
}
- if (initializer && initializer.kind === 270 /* JsxExpression */ && !initializer.expression) {
+ if (initializer && initializer.kind === 271 /* JsxExpression */ && !initializer.expression) {
return grammarErrorOnNode(initializer, ts.Diagnostics.JSX_attributes_must_only_be_assigned_a_non_empty_expression);
}
}
@@ -59673,12 +60537,25 @@
if (checkGrammarStatementInAmbientContext(forInOrOfStatement)) {
return true;
}
- if (forInOrOfStatement.kind === 227 /* ForOfStatement */ && forInOrOfStatement.awaitModifier) {
+ if (forInOrOfStatement.kind === 228 /* ForOfStatement */ && forInOrOfStatement.awaitModifier) {
if ((forInOrOfStatement.flags & 16384 /* AwaitContext */) === 0 /* None */) {
- return grammarErrorOnNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator);
+ // use of 'for-await-of' in non-async function
+ var sourceFile = ts.getSourceFileOfNode(forInOrOfStatement);
+ if (!hasParseDiagnostics(sourceFile)) {
+ var diagnostic = ts.createDiagnosticForNode(forInOrOfStatement.awaitModifier, ts.Diagnostics.A_for_await_of_statement_is_only_allowed_within_an_async_function_or_async_generator);
+ var func = ts.getContainingFunction(forInOrOfStatement);
+ if (func && func.kind !== 158 /* Constructor */) {
+ ts.Debug.assert((ts.getFunctionFlags(func) & 2 /* Async */) === 0, "Enclosing function should never be an async function.");
+ var relatedInfo = ts.createDiagnosticForNode(func, ts.Diagnostics.Did_you_mean_to_mark_this_function_as_async);
+ ts.addRelatedInfo(diagnostic, relatedInfo);
}
+ diagnostics.add(diagnostic);
+ return true;
}
- if (forInOrOfStatement.initializer.kind === 238 /* VariableDeclarationList */) {
+ return false;
+ }
+ }
+ if (forInOrOfStatement.initializer.kind === 239 /* VariableDeclarationList */) {
var variableList = forInOrOfStatement.initializer;
if (!checkGrammarVariableDeclarationList(variableList)) {
var declarations = variableList.declarations;
@@ -59693,20 +60570,20 @@
return false;
}
if (declarations.length > 1) {
- var diagnostic = forInOrOfStatement.kind === 226 /* ForInStatement */
+ var diagnostic = forInOrOfStatement.kind === 227 /* ForInStatement */
? ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_in_statement
: ts.Diagnostics.Only_a_single_variable_declaration_is_allowed_in_a_for_of_statement;
return grammarErrorOnFirstToken(variableList.declarations[1], diagnostic);
}
var firstDeclaration = declarations[0];
if (firstDeclaration.initializer) {
- var diagnostic = forInOrOfStatement.kind === 226 /* ForInStatement */
+ var diagnostic = forInOrOfStatement.kind === 227 /* ForInStatement */
? ts.Diagnostics.The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer
: ts.Diagnostics.The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer;
return grammarErrorOnNode(firstDeclaration.name, diagnostic);
}
if (firstDeclaration.type) {
- var diagnostic = forInOrOfStatement.kind === 226 /* ForInStatement */
+ var diagnostic = forInOrOfStatement.kind === 227 /* ForInStatement */
? ts.Diagnostics.The_left_hand_side_of_a_for_in_statement_cannot_use_a_type_annotation
: ts.Diagnostics.The_left_hand_side_of_a_for_of_statement_cannot_use_a_type_annotation;
return grammarErrorOnNode(firstDeclaration, diagnostic);
@@ -59733,11 +60610,11 @@
return grammarErrorOnNode(accessor.name, ts.Diagnostics.An_accessor_cannot_have_type_parameters);
}
else if (!doesAccessorHaveCorrectParameterCount(accessor)) {
- return grammarErrorOnNode(accessor.name, kind === 158 /* GetAccessor */ ?
+ return grammarErrorOnNode(accessor.name, kind === 159 /* GetAccessor */ ?
ts.Diagnostics.A_get_accessor_cannot_have_parameters :
ts.Diagnostics.A_set_accessor_must_have_exactly_one_parameter);
}
- else if (kind === 159 /* SetAccessor */) {
+ else if (kind === 160 /* SetAccessor */) {
if (accessor.type) {
return grammarErrorOnNode(accessor.name, ts.Diagnostics.A_set_accessor_cannot_have_a_return_type_annotation);
}
@@ -59761,23 +60638,23 @@
* A set accessor has one parameter or a `this` parameter and one more parameter.
*/
function doesAccessorHaveCorrectParameterCount(accessor) {
- return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 158 /* GetAccessor */ ? 0 : 1);
+ return getAccessorThisParameter(accessor) || accessor.parameters.length === (accessor.kind === 159 /* GetAccessor */ ? 0 : 1);
}
function getAccessorThisParameter(accessor) {
- if (accessor.parameters.length === (accessor.kind === 158 /* GetAccessor */ ? 1 : 2)) {
+ if (accessor.parameters.length === (accessor.kind === 159 /* GetAccessor */ ? 1 : 2)) {
return ts.getThisParameter(accessor);
}
}
function checkGrammarTypeOperatorNode(node) {
- if (node.operator === 142 /* UniqueKeyword */) {
- if (node.type.kind !== 139 /* SymbolKeyword */) {
- return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(139 /* SymbolKeyword */));
+ if (node.operator === 143 /* UniqueKeyword */) {
+ if (node.type.kind !== 140 /* SymbolKeyword */) {
+ return grammarErrorOnNode(node.type, ts.Diagnostics._0_expected, ts.tokenToString(140 /* SymbolKeyword */));
}
var parent = ts.walkUpParenthesizedTypes(node.parent);
switch (parent.kind) {
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
var decl = parent;
- if (decl.name.kind !== 72 /* Identifier */) {
+ if (decl.name.kind !== 73 /* Identifier */) {
return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_may_not_be_used_on_a_variable_declaration_with_a_binding_name);
}
if (!ts.isVariableDeclarationInVariableStatement(decl)) {
@@ -59787,13 +60664,13 @@
return grammarErrorOnNode(parent.name, ts.Diagnostics.A_variable_whose_type_is_a_unique_symbol_type_must_be_const);
}
break;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
if (!ts.hasModifier(parent, 32 /* Static */) ||
!ts.hasModifier(parent, 64 /* Readonly */)) {
return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_a_class_whose_type_is_a_unique_symbol_type_must_be_both_static_and_readonly);
}
break;
- case 153 /* PropertySignature */:
+ case 154 /* PropertySignature */:
if (!ts.hasModifier(parent, 64 /* Readonly */)) {
return grammarErrorOnNode(parent.name, ts.Diagnostics.A_property_of_an_interface_or_type_literal_whose_type_is_a_unique_symbol_type_must_be_readonly);
}
@@ -59802,9 +60679,9 @@
return grammarErrorOnNode(node, ts.Diagnostics.unique_symbol_types_are_not_allowed_here);
}
}
- else if (node.operator === 133 /* ReadonlyKeyword */) {
- if (node.type.kind !== 169 /* ArrayType */ && node.type.kind !== 170 /* TupleType */) {
- return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(139 /* SymbolKeyword */));
+ else if (node.operator === 134 /* ReadonlyKeyword */) {
+ if (node.type.kind !== 170 /* ArrayType */ && node.type.kind !== 171 /* TupleType */) {
+ return grammarErrorOnFirstToken(node, ts.Diagnostics.readonly_type_modifier_is_only_permitted_on_array_and_tuple_literal_types, ts.tokenToString(140 /* SymbolKeyword */));
}
}
}
@@ -59817,10 +60694,10 @@
if (checkGrammarFunctionLikeDeclaration(node)) {
return true;
}
- if (node.kind === 156 /* MethodDeclaration */) {
- if (node.parent.kind === 188 /* ObjectLiteralExpression */) {
+ if (node.kind === 157 /* MethodDeclaration */) {
+ if (node.parent.kind === 189 /* ObjectLiteralExpression */) {
// We only disallow modifier on a method declaration if it is a property of object-literal-expression
- if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 121 /* AsyncKeyword */)) {
+ if (node.modifiers && !(node.modifiers.length === 1 && ts.first(node.modifiers).kind === 122 /* AsyncKeyword */)) {
return grammarErrorOnFirstToken(node, ts.Diagnostics.Modifiers_cannot_appear_here);
}
else if (checkGrammarForInvalidQuestionMark(node.questionToken, ts.Diagnostics.An_object_member_cannot_be_declared_optional)) {
@@ -59833,6 +60710,9 @@
return grammarErrorAtPos(node, node.end - 1, ";".length, ts.Diagnostics._0_expected, "{");
}
}
+ else if (ts.isClassLike(node.parent) && ts.isStringLiteral(node.name) && node.name.text === "constructor" && (!compilerOptions.target || compilerOptions.target < 1 /* ES5 */)) {
+ return grammarErrorOnNode(node.name, ts.Diagnostics.Quoted_constructors_have_previously_been_interpreted_as_methods_which_is_incorrect_In_TypeScript_3_6_they_will_be_correctly_parsed_as_constructors_In_the_meantime_consider_using_constructor_to_write_a_constructor_or_constructor_to_write_a_method);
+ }
if (checkGrammarForGenerator(node)) {
return true;
}
@@ -59846,14 +60726,14 @@
if (node.flags & 4194304 /* Ambient */) {
return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_ambient_context_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type);
}
- else if (node.kind === 156 /* MethodDeclaration */ && !node.body) {
+ else if (node.kind === 157 /* MethodDeclaration */ && !node.body) {
return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_method_overload_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type);
}
}
- else if (node.parent.kind === 241 /* InterfaceDeclaration */) {
+ else if (node.parent.kind === 242 /* InterfaceDeclaration */) {
return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type);
}
- else if (node.parent.kind === 168 /* TypeLiteral */) {
+ else if (node.parent.kind === 169 /* TypeLiteral */) {
return checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type);
}
}
@@ -59864,11 +60744,11 @@
return grammarErrorOnNode(node, ts.Diagnostics.Jump_target_cannot_cross_function_boundary);
}
switch (current.kind) {
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
if (node.label && current.label.escapedText === node.label.escapedText) {
// found matching label - verify that label usage is correct
// continue can only target labels that are on iteration statements
- var isMisplacedContinueLabel = node.kind === 228 /* ContinueStatement */
+ var isMisplacedContinueLabel = node.kind === 229 /* ContinueStatement */
&& !ts.isIterationStatement(current.statement, /*lookInLabeledStatement*/ true);
if (isMisplacedContinueLabel) {
return grammarErrorOnNode(node, ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement);
@@ -59876,8 +60756,8 @@
return false;
}
break;
- case 232 /* SwitchStatement */:
- if (node.kind === 229 /* BreakStatement */ && !node.label) {
+ case 233 /* SwitchStatement */:
+ if (node.kind === 230 /* BreakStatement */ && !node.label) {
// unlabeled break within switch statement - ok
return false;
}
@@ -59892,13 +60772,13 @@
current = current.parent;
}
if (node.label) {
- var message = node.kind === 229 /* BreakStatement */
+ var message = node.kind === 230 /* BreakStatement */
? ts.Diagnostics.A_break_statement_can_only_jump_to_a_label_of_an_enclosing_statement
: ts.Diagnostics.A_continue_statement_can_only_jump_to_a_label_of_an_enclosing_iteration_statement;
return grammarErrorOnNode(node, message);
}
else {
- var message = node.kind === 229 /* BreakStatement */
+ var message = node.kind === 230 /* BreakStatement */
? ts.Diagnostics.A_break_statement_can_only_be_used_within_an_enclosing_iteration_or_switch_statement
: ts.Diagnostics.A_continue_statement_can_only_be_used_within_an_enclosing_iteration_statement;
return grammarErrorOnNode(node, message);
@@ -59922,12 +60802,12 @@
}
function isStringOrNumberLiteralExpression(expr) {
return expr.kind === 10 /* StringLiteral */ || expr.kind === 8 /* NumericLiteral */ ||
- expr.kind === 202 /* PrefixUnaryExpression */ && expr.operator === 39 /* MinusToken */ &&
+ expr.kind === 203 /* PrefixUnaryExpression */ && expr.operator === 39 /* MinusToken */ &&
expr.operand.kind === 8 /* NumericLiteral */;
}
function isBigIntLiteralExpression(expr) {
return expr.kind === 9 /* BigIntLiteral */ ||
- expr.kind === 202 /* PrefixUnaryExpression */ && expr.operator === 39 /* MinusToken */ &&
+ expr.kind === 203 /* PrefixUnaryExpression */ && expr.operator === 39 /* MinusToken */ &&
expr.operand.kind === 9 /* BigIntLiteral */;
}
function isSimpleLiteralEnumReference(expr) {
@@ -59940,7 +60820,7 @@
if (initializer) {
var isInvalidInitializer = !(isStringOrNumberLiteralExpression(initializer) ||
isSimpleLiteralEnumReference(initializer) ||
- initializer.kind === 102 /* TrueKeyword */ || initializer.kind === 87 /* FalseKeyword */ ||
+ initializer.kind === 103 /* TrueKeyword */ || initializer.kind === 88 /* FalseKeyword */ ||
isBigIntLiteralExpression(initializer));
var isConstOrReadonly = ts.isDeclarationReadonly(node) || ts.isVariableDeclaration(node) && ts.isVarConst(node);
if (isConstOrReadonly && !node.type) {
@@ -59957,7 +60837,7 @@
}
}
function checkGrammarVariableDeclaration(node) {
- if (node.parent.parent.kind !== 226 /* ForInStatement */ && node.parent.parent.kind !== 227 /* ForOfStatement */) {
+ if (node.parent.parent.kind !== 227 /* ForInStatement */ && node.parent.parent.kind !== 228 /* ForOfStatement */) {
if (node.flags & 4194304 /* Ambient */) {
checkAmbientInitializer(node);
}
@@ -59970,8 +60850,8 @@
}
}
}
- if (node.exclamationToken && (node.parent.parent.kind !== 219 /* VariableStatement */ || !node.type || node.initializer || node.flags & 4194304 /* Ambient */)) {
- return grammarErrorOnNode(node.exclamationToken, ts.Diagnostics.A_definite_assignment_assertion_is_not_permitted_in_this_context);
+ if (node.exclamationToken && (node.parent.parent.kind !== 220 /* VariableStatement */ || !node.type || node.initializer || node.flags & 4194304 /* Ambient */)) {
+ return grammarErrorOnNode(node.exclamationToken, ts.Diagnostics.Definite_assignment_assertions_can_only_be_used_along_with_a_type_annotation);
}
if (compilerOptions.module !== ts.ModuleKind.ES2015 && compilerOptions.module !== ts.ModuleKind.ESNext && compilerOptions.module !== ts.ModuleKind.System && !compilerOptions.noEmit &&
!(node.parent.parent.flags & 4194304 /* Ambient */) && ts.hasModifier(node.parent.parent, 1 /* Export */)) {
@@ -59987,7 +60867,7 @@
return checkLetConstNames && checkGrammarNameInLetOrConstDeclarations(node.name);
}
function checkESModuleMarker(name) {
- if (name.kind === 72 /* Identifier */) {
+ if (name.kind === 73 /* Identifier */) {
if (ts.idText(name) === "__esModule") {
return grammarErrorOnNode(name, ts.Diagnostics.Identifier_expected_esModule_is_reserved_as_an_exported_marker_when_transforming_ECMAScript_modules);
}
@@ -60004,8 +60884,8 @@
return false;
}
function checkGrammarNameInLetOrConstDeclarations(name) {
- if (name.kind === 72 /* Identifier */) {
- if (name.originalKeywordKind === 111 /* LetKeyword */) {
+ if (name.kind === 73 /* Identifier */) {
+ if (name.originalKeywordKind === 112 /* LetKeyword */) {
return grammarErrorOnNode(name, ts.Diagnostics.let_is_not_allowed_to_be_used_as_a_name_in_let_or_const_declarations);
}
}
@@ -60032,15 +60912,15 @@
}
function allowLetAndConstDeclarations(parent) {
switch (parent.kind) {
- case 222 /* IfStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
- case 231 /* WithStatement */:
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 223 /* IfStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
+ case 232 /* WithStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
return false;
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return allowLetAndConstDeclarations(parent.parent);
}
return true;
@@ -60058,12 +60938,12 @@
function checkGrammarMetaProperty(node) {
var escapedText = node.name.escapedText;
switch (node.keywordToken) {
- case 95 /* NewKeyword */:
+ case 96 /* NewKeyword */:
if (escapedText !== "target") {
return grammarErrorOnNode(node.name, ts.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.escapedText, ts.tokenToString(node.keywordToken), "target");
}
break;
- case 92 /* ImportKeyword */:
+ case 93 /* ImportKeyword */:
if (escapedText !== "meta") {
return grammarErrorOnNode(node.name, ts.Diagnostics._0_is_not_a_valid_meta_property_for_keyword_1_Did_you_mean_2, node.name.escapedText, ts.tokenToString(node.keywordToken), "meta");
}
@@ -60114,11 +60994,14 @@
}
function checkGrammarProperty(node) {
if (ts.isClassLike(node.parent)) {
+ if (ts.isStringLiteral(node.name) && node.name.text === "constructor") {
+ return grammarErrorOnNode(node.name, ts.Diagnostics.Classes_may_not_have_a_field_named_constructor);
+ }
if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_class_property_declaration_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) {
return true;
}
}
- else if (node.parent.kind === 241 /* InterfaceDeclaration */) {
+ else if (node.parent.kind === 242 /* InterfaceDeclaration */) {
if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_an_interface_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) {
return true;
}
@@ -60126,7 +61009,7 @@
return grammarErrorOnNode(node.initializer, ts.Diagnostics.An_interface_property_cannot_have_an_initializer);
}
}
- else if (node.parent.kind === 168 /* TypeLiteral */) {
+ else if (node.parent.kind === 169 /* TypeLiteral */) {
if (checkGrammarForInvalidDynamicName(node.name, ts.Diagnostics.A_computed_property_name_in_a_type_literal_must_refer_to_an_expression_whose_type_is_a_literal_type_or_a_unique_symbol_type)) {
return true;
}
@@ -60155,22 +61038,22 @@
// export_opt AmbientDeclaration
//
// TODO: The spec needs to be amended to reflect this grammar.
- if (node.kind === 241 /* InterfaceDeclaration */ ||
- node.kind === 242 /* TypeAliasDeclaration */ ||
- node.kind === 249 /* ImportDeclaration */ ||
- node.kind === 248 /* ImportEqualsDeclaration */ ||
- node.kind === 255 /* ExportDeclaration */ ||
- node.kind === 254 /* ExportAssignment */ ||
- node.kind === 247 /* NamespaceExportDeclaration */ ||
+ if (node.kind === 242 /* InterfaceDeclaration */ ||
+ node.kind === 243 /* TypeAliasDeclaration */ ||
+ node.kind === 250 /* ImportDeclaration */ ||
+ node.kind === 249 /* ImportEqualsDeclaration */ ||
+ node.kind === 256 /* ExportDeclaration */ ||
+ node.kind === 255 /* ExportAssignment */ ||
+ node.kind === 248 /* NamespaceExportDeclaration */ ||
ts.hasModifier(node, 2 /* Ambient */ | 1 /* Export */ | 512 /* Default */)) {
return false;
}
- return grammarErrorOnFirstToken(node, ts.Diagnostics.A_declare_modifier_is_required_for_a_top_level_declaration_in_a_d_ts_file);
+ return grammarErrorOnFirstToken(node, ts.Diagnostics.Top_level_declarations_in_d_ts_files_must_start_with_either_a_declare_or_export_modifier);
}
function checkGrammarTopLevelElementsForRequiredDeclareModifier(file) {
for (var _i = 0, _a = file.statements; _i < _a.length; _i++) {
var decl = _a[_i];
- if (ts.isDeclaration(decl) || decl.kind === 219 /* VariableStatement */) {
+ if (ts.isDeclaration(decl) || decl.kind === 220 /* VariableStatement */) {
if (checkGrammarTopLevelElementForRequiredDeclareModifier(decl)) {
return true;
}
@@ -60197,7 +61080,7 @@
// to prevent noisiness. So use a bit on the block to indicate if
// this has already been reported, and don't report if it has.
//
- if (node.parent.kind === 218 /* Block */ || node.parent.kind === 245 /* ModuleBlock */ || node.parent.kind === 284 /* SourceFile */) {
+ if (node.parent.kind === 219 /* Block */ || node.parent.kind === 246 /* ModuleBlock */ || node.parent.kind === 285 /* SourceFile */) {
var links_2 = getNodeLinks(node.parent);
// Check if the containing block ever report this error
if (!links_2.hasReportedStatementInAmbientContext) {
@@ -60219,10 +61102,10 @@
if (languageVersion >= 1 /* ES5 */) {
diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_available_when_targeting_ECMAScript_5_and_higher_Use_the_syntax_0;
}
- else if (ts.isChildOfNodeWithKind(node, 182 /* LiteralType */)) {
+ else if (ts.isChildOfNodeWithKind(node, 183 /* LiteralType */)) {
diagnosticMessage = ts.Diagnostics.Octal_literal_types_must_use_ES2015_syntax_Use_the_syntax_0;
}
- else if (ts.isChildOfNodeWithKind(node, 278 /* EnumMember */)) {
+ else if (ts.isChildOfNodeWithKind(node, 279 /* EnumMember */)) {
diagnosticMessage = ts.Diagnostics.Octal_literals_are_not_allowed_in_enums_members_initializer_Use_the_syntax_0;
}
if (diagnosticMessage) {
@@ -60237,7 +61120,7 @@
var literalType = ts.isLiteralTypeNode(node.parent) ||
ts.isPrefixUnaryExpression(node.parent) && ts.isLiteralTypeNode(node.parent.parent);
if (!literalType) {
- if (languageVersion < 7 /* ESNext */) {
+ if (languageVersion < 8 /* ESNext */) {
if (grammarErrorOnNode(node, ts.Diagnostics.BigInt_literals_are_not_available_when_targeting_lower_than_ESNext)) {
return true;
}
@@ -60290,8 +61173,8 @@
/** Like 'isDeclarationName', but returns true for LHS of `import { x as y }` or `export { x as y }`. */
function isDeclarationNameOrImportPropertyName(name) {
switch (name.parent.kind) {
- case 253 /* ImportSpecifier */:
- case 257 /* ExportSpecifier */:
+ case 254 /* ImportSpecifier */:
+ case 258 /* ExportSpecifier */:
return ts.isIdentifier(name);
default:
return ts.isDeclarationName(name);
@@ -60299,14 +61182,14 @@
}
function isSomeImportDeclaration(decl) {
switch (decl.kind) {
- case 250 /* ImportClause */: // For default import
- case 248 /* ImportEqualsDeclaration */:
- case 251 /* NamespaceImport */:
- case 253 /* ImportSpecifier */: // For rename import `x as y`
+ case 251 /* ImportClause */: // For default import
+ case 249 /* ImportEqualsDeclaration */:
+ case 252 /* NamespaceImport */:
+ case 254 /* ImportSpecifier */: // For rename import `x as y`
return true;
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
// For regular import, `decl` is an Identifier under the ImportSpecifier.
- return decl.parent.kind === 253 /* ImportSpecifier */;
+ return decl.parent.kind === 254 /* ImportSpecifier */;
default:
return false;
}
@@ -60434,7 +61317,7 @@
return node;
}
function createIdentifier(text, typeArguments) {
- var node = createSynthesizedNode(72 /* Identifier */);
+ var node = createSynthesizedNode(73 /* Identifier */);
node.escapedText = ts.escapeLeadingUnderscores(text);
node.originalKeywordKind = text ? ts.stringToToken(text) : 0 /* Unknown */;
node.autoGenerateFlags = 0 /* None */;
@@ -60515,23 +61398,23 @@
ts.createToken = createToken;
// Reserved words
function createSuper() {
- return createSynthesizedNode(98 /* SuperKeyword */);
+ return createSynthesizedNode(99 /* SuperKeyword */);
}
ts.createSuper = createSuper;
function createThis() {
- return createSynthesizedNode(100 /* ThisKeyword */);
+ return createSynthesizedNode(101 /* ThisKeyword */);
}
ts.createThis = createThis;
function createNull() {
- return createSynthesizedNode(96 /* NullKeyword */);
+ return createSynthesizedNode(97 /* NullKeyword */);
}
ts.createNull = createNull;
function createTrue() {
- return createSynthesizedNode(102 /* TrueKeyword */);
+ return createSynthesizedNode(103 /* TrueKeyword */);
}
ts.createTrue = createTrue;
function createFalse() {
- return createSynthesizedNode(87 /* FalseKeyword */);
+ return createSynthesizedNode(88 /* FalseKeyword */);
}
ts.createFalse = createFalse;
// Modifiers
@@ -60542,44 +61425,44 @@
function createModifiersFromModifierFlags(flags) {
var result = [];
if (flags & 1 /* Export */) {
- result.push(createModifier(85 /* ExportKeyword */));
+ result.push(createModifier(86 /* ExportKeyword */));
}
if (flags & 2 /* Ambient */) {
- result.push(createModifier(125 /* DeclareKeyword */));
+ result.push(createModifier(126 /* DeclareKeyword */));
}
if (flags & 512 /* Default */) {
- result.push(createModifier(80 /* DefaultKeyword */));
+ result.push(createModifier(81 /* DefaultKeyword */));
}
if (flags & 2048 /* Const */) {
- result.push(createModifier(77 /* ConstKeyword */));
+ result.push(createModifier(78 /* ConstKeyword */));
}
if (flags & 4 /* Public */) {
- result.push(createModifier(115 /* PublicKeyword */));
+ result.push(createModifier(116 /* PublicKeyword */));
}
if (flags & 8 /* Private */) {
- result.push(createModifier(113 /* PrivateKeyword */));
+ result.push(createModifier(114 /* PrivateKeyword */));
}
if (flags & 16 /* Protected */) {
- result.push(createModifier(114 /* ProtectedKeyword */));
+ result.push(createModifier(115 /* ProtectedKeyword */));
}
if (flags & 128 /* Abstract */) {
- result.push(createModifier(118 /* AbstractKeyword */));
+ result.push(createModifier(119 /* AbstractKeyword */));
}
if (flags & 32 /* Static */) {
- result.push(createModifier(116 /* StaticKeyword */));
+ result.push(createModifier(117 /* StaticKeyword */));
}
if (flags & 64 /* Readonly */) {
- result.push(createModifier(133 /* ReadonlyKeyword */));
+ result.push(createModifier(134 /* ReadonlyKeyword */));
}
if (flags & 256 /* Async */) {
- result.push(createModifier(121 /* AsyncKeyword */));
+ result.push(createModifier(122 /* AsyncKeyword */));
}
return result;
}
ts.createModifiersFromModifierFlags = createModifiersFromModifierFlags;
// Names
function createQualifiedName(left, right) {
- var node = createSynthesizedNode(148 /* QualifiedName */);
+ var node = createSynthesizedNode(149 /* QualifiedName */);
node.left = left;
node.right = asName(right);
return node;
@@ -60598,7 +61481,7 @@
: expression;
}
function createComputedPropertyName(expression) {
- var node = createSynthesizedNode(149 /* ComputedPropertyName */);
+ var node = createSynthesizedNode(150 /* ComputedPropertyName */);
node.expression = parenthesizeForComputedName(expression);
return node;
}
@@ -60611,7 +61494,7 @@
ts.updateComputedPropertyName = updateComputedPropertyName;
// Signature elements
function createTypeParameterDeclaration(name, constraint, defaultType) {
- var node = createSynthesizedNode(150 /* TypeParameter */);
+ var node = createSynthesizedNode(151 /* TypeParameter */);
node.name = asName(name);
node.constraint = constraint;
node.default = defaultType;
@@ -60627,7 +61510,7 @@
}
ts.updateTypeParameterDeclaration = updateTypeParameterDeclaration;
function createParameter(decorators, modifiers, dotDotDotToken, name, questionToken, type, initializer) {
- var node = createSynthesizedNode(151 /* Parameter */);
+ var node = createSynthesizedNode(152 /* Parameter */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.dotDotDotToken = dotDotDotToken;
@@ -60651,7 +61534,7 @@
}
ts.updateParameter = updateParameter;
function createDecorator(expression) {
- var node = createSynthesizedNode(152 /* Decorator */);
+ var node = createSynthesizedNode(153 /* Decorator */);
node.expression = ts.parenthesizeForAccess(expression);
return node;
}
@@ -60664,7 +61547,7 @@
ts.updateDecorator = updateDecorator;
// Type Elements
function createPropertySignature(modifiers, name, questionToken, type, initializer) {
- var node = createSynthesizedNode(153 /* PropertySignature */);
+ var node = createSynthesizedNode(154 /* PropertySignature */);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
node.questionToken = questionToken;
@@ -60684,7 +61567,7 @@
}
ts.updatePropertySignature = updatePropertySignature;
function createProperty(decorators, modifiers, name, questionOrExclamationToken, type, initializer) {
- var node = createSynthesizedNode(154 /* PropertyDeclaration */);
+ var node = createSynthesizedNode(155 /* PropertyDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -60708,7 +61591,7 @@
}
ts.updateProperty = updateProperty;
function createMethodSignature(typeParameters, parameters, type, name, questionToken) {
- var node = createSignatureDeclaration(155 /* MethodSignature */, typeParameters, parameters, type);
+ var node = createSignatureDeclaration(156 /* MethodSignature */, typeParameters, parameters, type);
node.name = asName(name);
node.questionToken = questionToken;
return node;
@@ -60725,7 +61608,7 @@
}
ts.updateMethodSignature = updateMethodSignature;
function createMethod(decorators, modifiers, asteriskToken, name, questionToken, typeParameters, parameters, type, body) {
- var node = createSynthesizedNode(156 /* MethodDeclaration */);
+ var node = createSynthesizedNode(157 /* MethodDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.asteriskToken = asteriskToken;
@@ -60753,7 +61636,7 @@
}
ts.updateMethod = updateMethod;
function createConstructor(decorators, modifiers, parameters, body) {
- var node = createSynthesizedNode(157 /* Constructor */);
+ var node = createSynthesizedNode(158 /* Constructor */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.typeParameters = undefined;
@@ -60773,7 +61656,7 @@
}
ts.updateConstructor = updateConstructor;
function createGetAccessor(decorators, modifiers, name, parameters, type, body) {
- var node = createSynthesizedNode(158 /* GetAccessor */);
+ var node = createSynthesizedNode(159 /* GetAccessor */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -60796,7 +61679,7 @@
}
ts.updateGetAccessor = updateGetAccessor;
function createSetAccessor(decorators, modifiers, name, parameters, body) {
- var node = createSynthesizedNode(159 /* SetAccessor */);
+ var node = createSynthesizedNode(160 /* SetAccessor */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -60817,7 +61700,7 @@
}
ts.updateSetAccessor = updateSetAccessor;
function createCallSignature(typeParameters, parameters, type) {
- return createSignatureDeclaration(160 /* CallSignature */, typeParameters, parameters, type);
+ return createSignatureDeclaration(161 /* CallSignature */, typeParameters, parameters, type);
}
ts.createCallSignature = createCallSignature;
function updateCallSignature(node, typeParameters, parameters, type) {
@@ -60825,7 +61708,7 @@
}
ts.updateCallSignature = updateCallSignature;
function createConstructSignature(typeParameters, parameters, type) {
- return createSignatureDeclaration(161 /* ConstructSignature */, typeParameters, parameters, type);
+ return createSignatureDeclaration(162 /* ConstructSignature */, typeParameters, parameters, type);
}
ts.createConstructSignature = createConstructSignature;
function updateConstructSignature(node, typeParameters, parameters, type) {
@@ -60833,7 +61716,7 @@
}
ts.updateConstructSignature = updateConstructSignature;
function createIndexSignature(decorators, modifiers, parameters, type) {
- var node = createSynthesizedNode(162 /* IndexSignature */);
+ var node = createSynthesizedNode(163 /* IndexSignature */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.parameters = createNodeArray(parameters);
@@ -60873,7 +61756,7 @@
}
ts.createKeywordTypeNode = createKeywordTypeNode;
function createTypePredicateNode(parameterName, type) {
- var node = createSynthesizedNode(163 /* TypePredicate */);
+ var node = createSynthesizedNode(164 /* TypePredicate */);
node.parameterName = asName(parameterName);
node.type = type;
return node;
@@ -60887,7 +61770,7 @@
}
ts.updateTypePredicateNode = updateTypePredicateNode;
function createTypeReferenceNode(typeName, typeArguments) {
- var node = createSynthesizedNode(164 /* TypeReference */);
+ var node = createSynthesizedNode(165 /* TypeReference */);
node.typeName = asName(typeName);
node.typeArguments = typeArguments && ts.parenthesizeTypeParameters(typeArguments);
return node;
@@ -60901,7 +61784,7 @@
}
ts.updateTypeReferenceNode = updateTypeReferenceNode;
function createFunctionTypeNode(typeParameters, parameters, type) {
- return createSignatureDeclaration(165 /* FunctionType */, typeParameters, parameters, type);
+ return createSignatureDeclaration(166 /* FunctionType */, typeParameters, parameters, type);
}
ts.createFunctionTypeNode = createFunctionTypeNode;
function updateFunctionTypeNode(node, typeParameters, parameters, type) {
@@ -60909,7 +61792,7 @@
}
ts.updateFunctionTypeNode = updateFunctionTypeNode;
function createConstructorTypeNode(typeParameters, parameters, type) {
- return createSignatureDeclaration(166 /* ConstructorType */, typeParameters, parameters, type);
+ return createSignatureDeclaration(167 /* ConstructorType */, typeParameters, parameters, type);
}
ts.createConstructorTypeNode = createConstructorTypeNode;
function updateConstructorTypeNode(node, typeParameters, parameters, type) {
@@ -60917,7 +61800,7 @@
}
ts.updateConstructorTypeNode = updateConstructorTypeNode;
function createTypeQueryNode(exprName) {
- var node = createSynthesizedNode(167 /* TypeQuery */);
+ var node = createSynthesizedNode(168 /* TypeQuery */);
node.exprName = exprName;
return node;
}
@@ -60929,7 +61812,7 @@
}
ts.updateTypeQueryNode = updateTypeQueryNode;
function createTypeLiteralNode(members) {
- var node = createSynthesizedNode(168 /* TypeLiteral */);
+ var node = createSynthesizedNode(169 /* TypeLiteral */);
node.members = createNodeArray(members);
return node;
}
@@ -60941,7 +61824,7 @@
}
ts.updateTypeLiteralNode = updateTypeLiteralNode;
function createArrayTypeNode(elementType) {
- var node = createSynthesizedNode(169 /* ArrayType */);
+ var node = createSynthesizedNode(170 /* ArrayType */);
node.elementType = ts.parenthesizeArrayTypeMember(elementType);
return node;
}
@@ -60953,7 +61836,7 @@
}
ts.updateArrayTypeNode = updateArrayTypeNode;
function createTupleTypeNode(elementTypes) {
- var node = createSynthesizedNode(170 /* TupleType */);
+ var node = createSynthesizedNode(171 /* TupleType */);
node.elementTypes = createNodeArray(elementTypes);
return node;
}
@@ -60965,7 +61848,7 @@
}
ts.updateTupleTypeNode = updateTupleTypeNode;
function createOptionalTypeNode(type) {
- var node = createSynthesizedNode(171 /* OptionalType */);
+ var node = createSynthesizedNode(172 /* OptionalType */);
node.type = ts.parenthesizeArrayTypeMember(type);
return node;
}
@@ -60977,7 +61860,7 @@
}
ts.updateOptionalTypeNode = updateOptionalTypeNode;
function createRestTypeNode(type) {
- var node = createSynthesizedNode(172 /* RestType */);
+ var node = createSynthesizedNode(173 /* RestType */);
node.type = type;
return node;
}
@@ -60989,7 +61872,7 @@
}
ts.updateRestTypeNode = updateRestTypeNode;
function createUnionTypeNode(types) {
- return createUnionOrIntersectionTypeNode(173 /* UnionType */, types);
+ return createUnionOrIntersectionTypeNode(174 /* UnionType */, types);
}
ts.createUnionTypeNode = createUnionTypeNode;
function updateUnionTypeNode(node, types) {
@@ -60997,7 +61880,7 @@
}
ts.updateUnionTypeNode = updateUnionTypeNode;
function createIntersectionTypeNode(types) {
- return createUnionOrIntersectionTypeNode(174 /* IntersectionType */, types);
+ return createUnionOrIntersectionTypeNode(175 /* IntersectionType */, types);
}
ts.createIntersectionTypeNode = createIntersectionTypeNode;
function updateIntersectionTypeNode(node, types) {
@@ -61016,7 +61899,7 @@
: node;
}
function createConditionalTypeNode(checkType, extendsType, trueType, falseType) {
- var node = createSynthesizedNode(175 /* ConditionalType */);
+ var node = createSynthesizedNode(176 /* ConditionalType */);
node.checkType = ts.parenthesizeConditionalTypeMember(checkType);
node.extendsType = ts.parenthesizeConditionalTypeMember(extendsType);
node.trueType = trueType;
@@ -61034,7 +61917,7 @@
}
ts.updateConditionalTypeNode = updateConditionalTypeNode;
function createInferTypeNode(typeParameter) {
- var node = createSynthesizedNode(176 /* InferType */);
+ var node = createSynthesizedNode(177 /* InferType */);
node.typeParameter = typeParameter;
return node;
}
@@ -61046,10 +61929,10 @@
}
ts.updateInferTypeNode = updateInferTypeNode;
function createImportTypeNode(argument, qualifier, typeArguments, isTypeOf) {
- var node = createSynthesizedNode(183 /* ImportType */);
+ var node = createSynthesizedNode(184 /* ImportType */);
node.argument = argument;
node.qualifier = qualifier;
- node.typeArguments = asNodeArray(typeArguments);
+ node.typeArguments = ts.parenthesizeTypeParameters(typeArguments);
node.isTypeOf = isTypeOf;
return node;
}
@@ -61064,7 +61947,7 @@
}
ts.updateImportTypeNode = updateImportTypeNode;
function createParenthesizedType(type) {
- var node = createSynthesizedNode(177 /* ParenthesizedType */);
+ var node = createSynthesizedNode(178 /* ParenthesizedType */);
node.type = type;
return node;
}
@@ -61076,12 +61959,12 @@
}
ts.updateParenthesizedType = updateParenthesizedType;
function createThisTypeNode() {
- return createSynthesizedNode(178 /* ThisType */);
+ return createSynthesizedNode(179 /* ThisType */);
}
ts.createThisTypeNode = createThisTypeNode;
function createTypeOperatorNode(operatorOrType, type) {
- var node = createSynthesizedNode(179 /* TypeOperator */);
- node.operator = typeof operatorOrType === "number" ? operatorOrType : 129 /* KeyOfKeyword */;
+ var node = createSynthesizedNode(180 /* TypeOperator */);
+ node.operator = typeof operatorOrType === "number" ? operatorOrType : 130 /* KeyOfKeyword */;
node.type = ts.parenthesizeElementTypeMember(typeof operatorOrType === "number" ? type : operatorOrType);
return node;
}
@@ -61091,7 +61974,7 @@
}
ts.updateTypeOperatorNode = updateTypeOperatorNode;
function createIndexedAccessTypeNode(objectType, indexType) {
- var node = createSynthesizedNode(180 /* IndexedAccessType */);
+ var node = createSynthesizedNode(181 /* IndexedAccessType */);
node.objectType = ts.parenthesizeElementTypeMember(objectType);
node.indexType = indexType;
return node;
@@ -61105,7 +61988,7 @@
}
ts.updateIndexedAccessTypeNode = updateIndexedAccessTypeNode;
function createMappedTypeNode(readonlyToken, typeParameter, questionToken, type) {
- var node = createSynthesizedNode(181 /* MappedType */);
+ var node = createSynthesizedNode(182 /* MappedType */);
node.readonlyToken = readonlyToken;
node.typeParameter = typeParameter;
node.questionToken = questionToken;
@@ -61123,7 +62006,7 @@
}
ts.updateMappedTypeNode = updateMappedTypeNode;
function createLiteralTypeNode(literal) {
- var node = createSynthesizedNode(182 /* LiteralType */);
+ var node = createSynthesizedNode(183 /* LiteralType */);
node.literal = literal;
return node;
}
@@ -61136,7 +62019,7 @@
ts.updateLiteralTypeNode = updateLiteralTypeNode;
// Binding Patterns
function createObjectBindingPattern(elements) {
- var node = createSynthesizedNode(184 /* ObjectBindingPattern */);
+ var node = createSynthesizedNode(185 /* ObjectBindingPattern */);
node.elements = createNodeArray(elements);
return node;
}
@@ -61148,7 +62031,7 @@
}
ts.updateObjectBindingPattern = updateObjectBindingPattern;
function createArrayBindingPattern(elements) {
- var node = createSynthesizedNode(185 /* ArrayBindingPattern */);
+ var node = createSynthesizedNode(186 /* ArrayBindingPattern */);
node.elements = createNodeArray(elements);
return node;
}
@@ -61160,7 +62043,7 @@
}
ts.updateArrayBindingPattern = updateArrayBindingPattern;
function createBindingElement(dotDotDotToken, propertyName, name, initializer) {
- var node = createSynthesizedNode(186 /* BindingElement */);
+ var node = createSynthesizedNode(187 /* BindingElement */);
node.dotDotDotToken = dotDotDotToken;
node.propertyName = asName(propertyName);
node.name = asName(name);
@@ -61179,7 +62062,7 @@
ts.updateBindingElement = updateBindingElement;
// Expression
function createArrayLiteral(elements, multiLine) {
- var node = createSynthesizedNode(187 /* ArrayLiteralExpression */);
+ var node = createSynthesizedNode(188 /* ArrayLiteralExpression */);
node.elements = ts.parenthesizeListElements(createNodeArray(elements));
if (multiLine)
node.multiLine = true;
@@ -61193,7 +62076,7 @@
}
ts.updateArrayLiteral = updateArrayLiteral;
function createObjectLiteral(properties, multiLine) {
- var node = createSynthesizedNode(188 /* ObjectLiteralExpression */);
+ var node = createSynthesizedNode(189 /* ObjectLiteralExpression */);
node.properties = createNodeArray(properties);
if (multiLine)
node.multiLine = true;
@@ -61207,9 +62090,9 @@
}
ts.updateObjectLiteral = updateObjectLiteral;
function createPropertyAccess(expression, name) {
- var node = createSynthesizedNode(189 /* PropertyAccessExpression */);
+ var node = createSynthesizedNode(190 /* PropertyAccessExpression */);
node.expression = ts.parenthesizeForAccess(expression);
- node.name = asName(name); // TODO: GH#18217
+ node.name = asName(name);
setEmitFlags(node, 131072 /* NoIndentation */);
return node;
}
@@ -61224,7 +62107,7 @@
}
ts.updatePropertyAccess = updatePropertyAccess;
function createElementAccess(expression, index) {
- var node = createSynthesizedNode(190 /* ElementAccessExpression */);
+ var node = createSynthesizedNode(191 /* ElementAccessExpression */);
node.expression = ts.parenthesizeForAccess(expression);
node.argumentExpression = asExpression(index);
return node;
@@ -61238,7 +62121,7 @@
}
ts.updateElementAccess = updateElementAccess;
function createCall(expression, typeArguments, argumentsArray) {
- var node = createSynthesizedNode(191 /* CallExpression */);
+ var node = createSynthesizedNode(192 /* CallExpression */);
node.expression = ts.parenthesizeForAccess(expression);
node.typeArguments = asNodeArray(typeArguments);
node.arguments = ts.parenthesizeListElements(createNodeArray(argumentsArray));
@@ -61254,7 +62137,7 @@
}
ts.updateCall = updateCall;
function createNew(expression, typeArguments, argumentsArray) {
- var node = createSynthesizedNode(192 /* NewExpression */);
+ var node = createSynthesizedNode(193 /* NewExpression */);
node.expression = ts.parenthesizeForNew(expression);
node.typeArguments = asNodeArray(typeArguments);
node.arguments = argumentsArray ? ts.parenthesizeListElements(createNodeArray(argumentsArray)) : undefined;
@@ -61270,7 +62153,7 @@
}
ts.updateNew = updateNew;
function createTaggedTemplate(tag, typeArgumentsOrTemplate, template) {
- var node = createSynthesizedNode(193 /* TaggedTemplateExpression */);
+ var node = createSynthesizedNode(194 /* TaggedTemplateExpression */);
node.tag = ts.parenthesizeForAccess(tag);
if (template) {
node.typeArguments = asNodeArray(typeArgumentsOrTemplate);
@@ -61293,7 +62176,7 @@
}
ts.updateTaggedTemplate = updateTaggedTemplate;
function createTypeAssertion(type, expression) {
- var node = createSynthesizedNode(194 /* TypeAssertionExpression */);
+ var node = createSynthesizedNode(195 /* TypeAssertionExpression */);
node.type = type;
node.expression = ts.parenthesizePrefixOperand(expression);
return node;
@@ -61307,7 +62190,7 @@
}
ts.updateTypeAssertion = updateTypeAssertion;
function createParen(expression) {
- var node = createSynthesizedNode(195 /* ParenthesizedExpression */);
+ var node = createSynthesizedNode(196 /* ParenthesizedExpression */);
node.expression = expression;
return node;
}
@@ -61319,7 +62202,7 @@
}
ts.updateParen = updateParen;
function createFunctionExpression(modifiers, asteriskToken, name, typeParameters, parameters, type, body) {
- var node = createSynthesizedNode(196 /* FunctionExpression */);
+ var node = createSynthesizedNode(197 /* FunctionExpression */);
node.modifiers = asNodeArray(modifiers);
node.asteriskToken = asteriskToken;
node.name = asName(name);
@@ -61343,7 +62226,7 @@
}
ts.updateFunctionExpression = updateFunctionExpression;
function createArrowFunction(modifiers, typeParameters, parameters, type, equalsGreaterThanToken, body) {
- var node = createSynthesizedNode(197 /* ArrowFunction */);
+ var node = createSynthesizedNode(198 /* ArrowFunction */);
node.modifiers = asNodeArray(modifiers);
node.typeParameters = asNodeArray(typeParameters);
node.parameters = createNodeArray(parameters);
@@ -61365,7 +62248,7 @@
}
ts.updateArrowFunction = updateArrowFunction;
function createDelete(expression) {
- var node = createSynthesizedNode(198 /* DeleteExpression */);
+ var node = createSynthesizedNode(199 /* DeleteExpression */);
node.expression = ts.parenthesizePrefixOperand(expression);
return node;
}
@@ -61377,7 +62260,7 @@
}
ts.updateDelete = updateDelete;
function createTypeOf(expression) {
- var node = createSynthesizedNode(199 /* TypeOfExpression */);
+ var node = createSynthesizedNode(200 /* TypeOfExpression */);
node.expression = ts.parenthesizePrefixOperand(expression);
return node;
}
@@ -61389,7 +62272,7 @@
}
ts.updateTypeOf = updateTypeOf;
function createVoid(expression) {
- var node = createSynthesizedNode(200 /* VoidExpression */);
+ var node = createSynthesizedNode(201 /* VoidExpression */);
node.expression = ts.parenthesizePrefixOperand(expression);
return node;
}
@@ -61401,7 +62284,7 @@
}
ts.updateVoid = updateVoid;
function createAwait(expression) {
- var node = createSynthesizedNode(201 /* AwaitExpression */);
+ var node = createSynthesizedNode(202 /* AwaitExpression */);
node.expression = ts.parenthesizePrefixOperand(expression);
return node;
}
@@ -61413,7 +62296,7 @@
}
ts.updateAwait = updateAwait;
function createPrefix(operator, operand) {
- var node = createSynthesizedNode(202 /* PrefixUnaryExpression */);
+ var node = createSynthesizedNode(203 /* PrefixUnaryExpression */);
node.operator = operator;
node.operand = ts.parenthesizePrefixOperand(operand);
return node;
@@ -61426,7 +62309,7 @@
}
ts.updatePrefix = updatePrefix;
function createPostfix(operand, operator) {
- var node = createSynthesizedNode(203 /* PostfixUnaryExpression */);
+ var node = createSynthesizedNode(204 /* PostfixUnaryExpression */);
node.operand = ts.parenthesizePostfixOperand(operand);
node.operator = operator;
return node;
@@ -61439,7 +62322,7 @@
}
ts.updatePostfix = updatePostfix;
function createBinary(left, operator, right) {
- var node = createSynthesizedNode(204 /* BinaryExpression */);
+ var node = createSynthesizedNode(205 /* BinaryExpression */);
var operatorToken = asToken(operator);
var operatorKind = operatorToken.kind;
node.left = ts.parenthesizeBinaryOperand(operatorKind, left, /*isLeftSideOfBinary*/ true, /*leftOperand*/ undefined);
@@ -61456,7 +62339,7 @@
}
ts.updateBinary = updateBinary;
function createConditional(condition, questionTokenOrWhenTrue, whenTrueOrWhenFalse, colonToken, whenFalse) {
- var node = createSynthesizedNode(205 /* ConditionalExpression */);
+ var node = createSynthesizedNode(206 /* ConditionalExpression */);
node.condition = ts.parenthesizeForConditionalHead(condition);
node.questionToken = whenFalse ? questionTokenOrWhenTrue : createToken(56 /* QuestionToken */);
node.whenTrue = ts.parenthesizeSubexpressionOfConditionalExpression(whenFalse ? whenTrueOrWhenFalse : questionTokenOrWhenTrue);
@@ -61476,7 +62359,7 @@
}
ts.updateConditional = updateConditional;
function createTemplateExpression(head, templateSpans) {
- var node = createSynthesizedNode(206 /* TemplateExpression */);
+ var node = createSynthesizedNode(207 /* TemplateExpression */);
node.head = head;
node.templateSpans = createNodeArray(templateSpans);
return node;
@@ -61514,7 +62397,7 @@
}
ts.createNoSubstitutionTemplateLiteral = createNoSubstitutionTemplateLiteral;
function createYield(asteriskTokenOrExpression, expression) {
- var node = createSynthesizedNode(207 /* YieldExpression */);
+ var node = createSynthesizedNode(208 /* YieldExpression */);
node.asteriskToken = asteriskTokenOrExpression && asteriskTokenOrExpression.kind === 40 /* AsteriskToken */ ? asteriskTokenOrExpression : undefined;
node.expression = asteriskTokenOrExpression && asteriskTokenOrExpression.kind !== 40 /* AsteriskToken */ ? asteriskTokenOrExpression : expression;
return node;
@@ -61528,7 +62411,7 @@
}
ts.updateYield = updateYield;
function createSpread(expression) {
- var node = createSynthesizedNode(208 /* SpreadElement */);
+ var node = createSynthesizedNode(209 /* SpreadElement */);
node.expression = ts.parenthesizeExpressionForList(expression);
return node;
}
@@ -61540,7 +62423,7 @@
}
ts.updateSpread = updateSpread;
function createClassExpression(modifiers, name, typeParameters, heritageClauses, members) {
- var node = createSynthesizedNode(209 /* ClassExpression */);
+ var node = createSynthesizedNode(210 /* ClassExpression */);
node.decorators = undefined;
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -61561,11 +62444,11 @@
}
ts.updateClassExpression = updateClassExpression;
function createOmittedExpression() {
- return createSynthesizedNode(210 /* OmittedExpression */);
+ return createSynthesizedNode(211 /* OmittedExpression */);
}
ts.createOmittedExpression = createOmittedExpression;
function createExpressionWithTypeArguments(typeArguments, expression) {
- var node = createSynthesizedNode(211 /* ExpressionWithTypeArguments */);
+ var node = createSynthesizedNode(212 /* ExpressionWithTypeArguments */);
node.expression = ts.parenthesizeForAccess(expression);
node.typeArguments = asNodeArray(typeArguments);
return node;
@@ -61579,7 +62462,7 @@
}
ts.updateExpressionWithTypeArguments = updateExpressionWithTypeArguments;
function createAsExpression(expression, type) {
- var node = createSynthesizedNode(212 /* AsExpression */);
+ var node = createSynthesizedNode(213 /* AsExpression */);
node.expression = expression;
node.type = type;
return node;
@@ -61593,7 +62476,7 @@
}
ts.updateAsExpression = updateAsExpression;
function createNonNullExpression(expression) {
- var node = createSynthesizedNode(213 /* NonNullExpression */);
+ var node = createSynthesizedNode(214 /* NonNullExpression */);
node.expression = ts.parenthesizeForAccess(expression);
return node;
}
@@ -61605,7 +62488,7 @@
}
ts.updateNonNullExpression = updateNonNullExpression;
function createMetaProperty(keywordToken, name) {
- var node = createSynthesizedNode(214 /* MetaProperty */);
+ var node = createSynthesizedNode(215 /* MetaProperty */);
node.keywordToken = keywordToken;
node.name = name;
return node;
@@ -61619,7 +62502,7 @@
ts.updateMetaProperty = updateMetaProperty;
// Misc
function createTemplateSpan(expression, literal) {
- var node = createSynthesizedNode(216 /* TemplateSpan */);
+ var node = createSynthesizedNode(217 /* TemplateSpan */);
node.expression = expression;
node.literal = literal;
return node;
@@ -61633,12 +62516,12 @@
}
ts.updateTemplateSpan = updateTemplateSpan;
function createSemicolonClassElement() {
- return createSynthesizedNode(217 /* SemicolonClassElement */);
+ return createSynthesizedNode(218 /* SemicolonClassElement */);
}
ts.createSemicolonClassElement = createSemicolonClassElement;
// Element
function createBlock(statements, multiLine) {
- var block = createSynthesizedNode(218 /* Block */);
+ var block = createSynthesizedNode(219 /* Block */);
block.statements = createNodeArray(statements);
if (multiLine)
block.multiLine = multiLine;
@@ -61652,7 +62535,7 @@
}
ts.updateBlock = updateBlock;
function createVariableStatement(modifiers, declarationList) {
- var node = createSynthesizedNode(219 /* VariableStatement */);
+ var node = createSynthesizedNode(220 /* VariableStatement */);
node.decorators = undefined;
node.modifiers = asNodeArray(modifiers);
node.declarationList = ts.isArray(declarationList) ? createVariableDeclarationList(declarationList) : declarationList;
@@ -61667,11 +62550,11 @@
}
ts.updateVariableStatement = updateVariableStatement;
function createEmptyStatement() {
- return createSynthesizedNode(220 /* EmptyStatement */);
+ return createSynthesizedNode(221 /* EmptyStatement */);
}
ts.createEmptyStatement = createEmptyStatement;
function createExpressionStatement(expression) {
- var node = createSynthesizedNode(221 /* ExpressionStatement */);
+ var node = createSynthesizedNode(222 /* ExpressionStatement */);
node.expression = ts.parenthesizeExpressionForExpressionStatement(expression);
return node;
}
@@ -61687,7 +62570,7 @@
/** @deprecated Use `updateExpressionStatement` instead. */
ts.updateStatement = updateExpressionStatement;
function createIf(expression, thenStatement, elseStatement) {
- var node = createSynthesizedNode(222 /* IfStatement */);
+ var node = createSynthesizedNode(223 /* IfStatement */);
node.expression = expression;
node.thenStatement = thenStatement;
node.elseStatement = elseStatement;
@@ -61703,7 +62586,7 @@
}
ts.updateIf = updateIf;
function createDo(statement, expression) {
- var node = createSynthesizedNode(223 /* DoStatement */);
+ var node = createSynthesizedNode(224 /* DoStatement */);
node.statement = statement;
node.expression = expression;
return node;
@@ -61717,7 +62600,7 @@
}
ts.updateDo = updateDo;
function createWhile(expression, statement) {
- var node = createSynthesizedNode(224 /* WhileStatement */);
+ var node = createSynthesizedNode(225 /* WhileStatement */);
node.expression = expression;
node.statement = statement;
return node;
@@ -61731,7 +62614,7 @@
}
ts.updateWhile = updateWhile;
function createFor(initializer, condition, incrementor, statement) {
- var node = createSynthesizedNode(225 /* ForStatement */);
+ var node = createSynthesizedNode(226 /* ForStatement */);
node.initializer = initializer;
node.condition = condition;
node.incrementor = incrementor;
@@ -61749,7 +62632,7 @@
}
ts.updateFor = updateFor;
function createForIn(initializer, expression, statement) {
- var node = createSynthesizedNode(226 /* ForInStatement */);
+ var node = createSynthesizedNode(227 /* ForInStatement */);
node.initializer = initializer;
node.expression = expression;
node.statement = statement;
@@ -61765,7 +62648,7 @@
}
ts.updateForIn = updateForIn;
function createForOf(awaitModifier, initializer, expression, statement) {
- var node = createSynthesizedNode(227 /* ForOfStatement */);
+ var node = createSynthesizedNode(228 /* ForOfStatement */);
node.awaitModifier = awaitModifier;
node.initializer = initializer;
node.expression = expression;
@@ -61783,7 +62666,7 @@
}
ts.updateForOf = updateForOf;
function createContinue(label) {
- var node = createSynthesizedNode(228 /* ContinueStatement */);
+ var node = createSynthesizedNode(229 /* ContinueStatement */);
node.label = asName(label);
return node;
}
@@ -61795,7 +62678,7 @@
}
ts.updateContinue = updateContinue;
function createBreak(label) {
- var node = createSynthesizedNode(229 /* BreakStatement */);
+ var node = createSynthesizedNode(230 /* BreakStatement */);
node.label = asName(label);
return node;
}
@@ -61807,7 +62690,7 @@
}
ts.updateBreak = updateBreak;
function createReturn(expression) {
- var node = createSynthesizedNode(230 /* ReturnStatement */);
+ var node = createSynthesizedNode(231 /* ReturnStatement */);
node.expression = expression;
return node;
}
@@ -61819,7 +62702,7 @@
}
ts.updateReturn = updateReturn;
function createWith(expression, statement) {
- var node = createSynthesizedNode(231 /* WithStatement */);
+ var node = createSynthesizedNode(232 /* WithStatement */);
node.expression = expression;
node.statement = statement;
return node;
@@ -61833,7 +62716,7 @@
}
ts.updateWith = updateWith;
function createSwitch(expression, caseBlock) {
- var node = createSynthesizedNode(232 /* SwitchStatement */);
+ var node = createSynthesizedNode(233 /* SwitchStatement */);
node.expression = ts.parenthesizeExpressionForList(expression);
node.caseBlock = caseBlock;
return node;
@@ -61847,7 +62730,7 @@
}
ts.updateSwitch = updateSwitch;
function createLabel(label, statement) {
- var node = createSynthesizedNode(233 /* LabeledStatement */);
+ var node = createSynthesizedNode(234 /* LabeledStatement */);
node.label = asName(label);
node.statement = statement;
return node;
@@ -61861,7 +62744,7 @@
}
ts.updateLabel = updateLabel;
function createThrow(expression) {
- var node = createSynthesizedNode(234 /* ThrowStatement */);
+ var node = createSynthesizedNode(235 /* ThrowStatement */);
node.expression = expression;
return node;
}
@@ -61873,7 +62756,7 @@
}
ts.updateThrow = updateThrow;
function createTry(tryBlock, catchClause, finallyBlock) {
- var node = createSynthesizedNode(235 /* TryStatement */);
+ var node = createSynthesizedNode(236 /* TryStatement */);
node.tryBlock = tryBlock;
node.catchClause = catchClause;
node.finallyBlock = finallyBlock;
@@ -61889,11 +62772,11 @@
}
ts.updateTry = updateTry;
function createDebuggerStatement() {
- return createSynthesizedNode(236 /* DebuggerStatement */);
+ return createSynthesizedNode(237 /* DebuggerStatement */);
}
ts.createDebuggerStatement = createDebuggerStatement;
function createVariableDeclaration(name, type, initializer) {
- var node = createSynthesizedNode(237 /* VariableDeclaration */);
+ var node = createSynthesizedNode(238 /* VariableDeclaration */);
node.name = asName(name);
node.type = type;
node.initializer = initializer !== undefined ? ts.parenthesizeExpressionForList(initializer) : undefined;
@@ -61910,7 +62793,7 @@
ts.updateVariableDeclaration = updateVariableDeclaration;
function createVariableDeclarationList(declarations, flags) {
if (flags === void 0) { flags = 0 /* None */; }
- var node = createSynthesizedNode(238 /* VariableDeclarationList */);
+ var node = createSynthesizedNode(239 /* VariableDeclarationList */);
node.flags |= flags & 3 /* BlockScoped */;
node.declarations = createNodeArray(declarations);
return node;
@@ -61923,7 +62806,7 @@
}
ts.updateVariableDeclarationList = updateVariableDeclarationList;
function createFunctionDeclaration(decorators, modifiers, asteriskToken, name, typeParameters, parameters, type, body) {
- var node = createSynthesizedNode(239 /* FunctionDeclaration */);
+ var node = createSynthesizedNode(240 /* FunctionDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.asteriskToken = asteriskToken;
@@ -61949,7 +62832,7 @@
}
ts.updateFunctionDeclaration = updateFunctionDeclaration;
function createClassDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members) {
- var node = createSynthesizedNode(240 /* ClassDeclaration */);
+ var node = createSynthesizedNode(241 /* ClassDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -61971,7 +62854,7 @@
}
ts.updateClassDeclaration = updateClassDeclaration;
function createInterfaceDeclaration(decorators, modifiers, name, typeParameters, heritageClauses, members) {
- var node = createSynthesizedNode(241 /* InterfaceDeclaration */);
+ var node = createSynthesizedNode(242 /* InterfaceDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -61993,7 +62876,7 @@
}
ts.updateInterfaceDeclaration = updateInterfaceDeclaration;
function createTypeAliasDeclaration(decorators, modifiers, name, typeParameters, type) {
- var node = createSynthesizedNode(242 /* TypeAliasDeclaration */);
+ var node = createSynthesizedNode(243 /* TypeAliasDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -62013,7 +62896,7 @@
}
ts.updateTypeAliasDeclaration = updateTypeAliasDeclaration;
function createEnumDeclaration(decorators, modifiers, name, members) {
- var node = createSynthesizedNode(243 /* EnumDeclaration */);
+ var node = createSynthesizedNode(244 /* EnumDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -62032,7 +62915,7 @@
ts.updateEnumDeclaration = updateEnumDeclaration;
function createModuleDeclaration(decorators, modifiers, name, body, flags) {
if (flags === void 0) { flags = 0 /* None */; }
- var node = createSynthesizedNode(244 /* ModuleDeclaration */);
+ var node = createSynthesizedNode(245 /* ModuleDeclaration */);
node.flags |= flags & (16 /* Namespace */ | 4 /* NestedNamespace */ | 512 /* GlobalAugmentation */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
@@ -62051,7 +62934,7 @@
}
ts.updateModuleDeclaration = updateModuleDeclaration;
function createModuleBlock(statements) {
- var node = createSynthesizedNode(245 /* ModuleBlock */);
+ var node = createSynthesizedNode(246 /* ModuleBlock */);
node.statements = createNodeArray(statements);
return node;
}
@@ -62063,7 +62946,7 @@
}
ts.updateModuleBlock = updateModuleBlock;
function createCaseBlock(clauses) {
- var node = createSynthesizedNode(246 /* CaseBlock */);
+ var node = createSynthesizedNode(247 /* CaseBlock */);
node.clauses = createNodeArray(clauses);
return node;
}
@@ -62075,7 +62958,7 @@
}
ts.updateCaseBlock = updateCaseBlock;
function createNamespaceExportDeclaration(name) {
- var node = createSynthesizedNode(247 /* NamespaceExportDeclaration */);
+ var node = createSynthesizedNode(248 /* NamespaceExportDeclaration */);
node.name = asName(name);
return node;
}
@@ -62087,7 +62970,7 @@
}
ts.updateNamespaceExportDeclaration = updateNamespaceExportDeclaration;
function createImportEqualsDeclaration(decorators, modifiers, name, moduleReference) {
- var node = createSynthesizedNode(248 /* ImportEqualsDeclaration */);
+ var node = createSynthesizedNode(249 /* ImportEqualsDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.name = asName(name);
@@ -62105,7 +62988,7 @@
}
ts.updateImportEqualsDeclaration = updateImportEqualsDeclaration;
function createImportDeclaration(decorators, modifiers, importClause, moduleSpecifier) {
- var node = createSynthesizedNode(249 /* ImportDeclaration */);
+ var node = createSynthesizedNode(250 /* ImportDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.importClause = importClause;
@@ -62123,7 +63006,7 @@
}
ts.updateImportDeclaration = updateImportDeclaration;
function createImportClause(name, namedBindings) {
- var node = createSynthesizedNode(250 /* ImportClause */);
+ var node = createSynthesizedNode(251 /* ImportClause */);
node.name = name;
node.namedBindings = namedBindings;
return node;
@@ -62137,7 +63020,7 @@
}
ts.updateImportClause = updateImportClause;
function createNamespaceImport(name) {
- var node = createSynthesizedNode(251 /* NamespaceImport */);
+ var node = createSynthesizedNode(252 /* NamespaceImport */);
node.name = name;
return node;
}
@@ -62149,7 +63032,7 @@
}
ts.updateNamespaceImport = updateNamespaceImport;
function createNamedImports(elements) {
- var node = createSynthesizedNode(252 /* NamedImports */);
+ var node = createSynthesizedNode(253 /* NamedImports */);
node.elements = createNodeArray(elements);
return node;
}
@@ -62161,7 +63044,7 @@
}
ts.updateNamedImports = updateNamedImports;
function createImportSpecifier(propertyName, name) {
- var node = createSynthesizedNode(253 /* ImportSpecifier */);
+ var node = createSynthesizedNode(254 /* ImportSpecifier */);
node.propertyName = propertyName;
node.name = name;
return node;
@@ -62175,11 +63058,11 @@
}
ts.updateImportSpecifier = updateImportSpecifier;
function createExportAssignment(decorators, modifiers, isExportEquals, expression) {
- var node = createSynthesizedNode(254 /* ExportAssignment */);
+ var node = createSynthesizedNode(255 /* ExportAssignment */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.isExportEquals = isExportEquals;
- node.expression = isExportEquals ? ts.parenthesizeBinaryOperand(59 /* EqualsToken */, expression, /*isLeftSideOfBinary*/ false, /*leftOperand*/ undefined) : ts.parenthesizeDefaultExpression(expression);
+ node.expression = isExportEquals ? ts.parenthesizeBinaryOperand(60 /* EqualsToken */, expression, /*isLeftSideOfBinary*/ false, /*leftOperand*/ undefined) : ts.parenthesizeDefaultExpression(expression);
return node;
}
ts.createExportAssignment = createExportAssignment;
@@ -62192,7 +63075,7 @@
}
ts.updateExportAssignment = updateExportAssignment;
function createExportDeclaration(decorators, modifiers, exportClause, moduleSpecifier) {
- var node = createSynthesizedNode(255 /* ExportDeclaration */);
+ var node = createSynthesizedNode(256 /* ExportDeclaration */);
node.decorators = asNodeArray(decorators);
node.modifiers = asNodeArray(modifiers);
node.exportClause = exportClause;
@@ -62210,7 +63093,7 @@
}
ts.updateExportDeclaration = updateExportDeclaration;
function createNamedExports(elements) {
- var node = createSynthesizedNode(256 /* NamedExports */);
+ var node = createSynthesizedNode(257 /* NamedExports */);
node.elements = createNodeArray(elements);
return node;
}
@@ -62222,7 +63105,7 @@
}
ts.updateNamedExports = updateNamedExports;
function createExportSpecifier(propertyName, name) {
- var node = createSynthesizedNode(257 /* ExportSpecifier */);
+ var node = createSynthesizedNode(258 /* ExportSpecifier */);
node.propertyName = asName(propertyName);
node.name = asName(name);
return node;
@@ -62237,7 +63120,7 @@
ts.updateExportSpecifier = updateExportSpecifier;
// Module references
function createExternalModuleReference(expression) {
- var node = createSynthesizedNode(259 /* ExternalModuleReference */);
+ var node = createSynthesizedNode(260 /* ExternalModuleReference */);
node.expression = expression;
return node;
}
@@ -62251,14 +63134,14 @@
// JSDoc
/* @internal */
function createJSDocTypeExpression(type) {
- var node = createSynthesizedNode(288 /* JSDocTypeExpression */);
+ var node = createSynthesizedNode(289 /* JSDocTypeExpression */);
node.type = type;
return node;
}
ts.createJSDocTypeExpression = createJSDocTypeExpression;
/* @internal */
function createJSDocTypeTag(typeExpression, comment) {
- var tag = createJSDocTag(307 /* JSDocTypeTag */, "type");
+ var tag = createJSDocTag(308 /* JSDocTypeTag */, "type");
tag.typeExpression = typeExpression;
tag.comment = comment;
return tag;
@@ -62266,7 +63149,7 @@
ts.createJSDocTypeTag = createJSDocTypeTag;
/* @internal */
function createJSDocReturnTag(typeExpression, comment) {
- var tag = createJSDocTag(305 /* JSDocReturnTag */, "returns");
+ var tag = createJSDocTag(306 /* JSDocReturnTag */, "returns");
tag.typeExpression = typeExpression;
tag.comment = comment;
return tag;
@@ -62274,7 +63157,7 @@
ts.createJSDocReturnTag = createJSDocReturnTag;
/* @internal */
function createJSDocParamTag(name, isBracketed, typeExpression, comment) {
- var tag = createJSDocTag(304 /* JSDocParameterTag */, "param");
+ var tag = createJSDocTag(305 /* JSDocParameterTag */, "param");
tag.typeExpression = typeExpression;
tag.name = name;
tag.isBracketed = isBracketed;
@@ -62284,7 +63167,7 @@
ts.createJSDocParamTag = createJSDocParamTag;
/* @internal */
function createJSDocComment(comment, tags) {
- var node = createSynthesizedNode(296 /* JSDocComment */);
+ var node = createSynthesizedNode(297 /* JSDocComment */);
node.comment = comment;
node.tags = tags;
return node;
@@ -62298,7 +63181,7 @@
}
// JSX
function createJsxElement(openingElement, children, closingElement) {
- var node = createSynthesizedNode(260 /* JsxElement */);
+ var node = createSynthesizedNode(261 /* JsxElement */);
node.openingElement = openingElement;
node.children = createNodeArray(children);
node.closingElement = closingElement;
@@ -62314,7 +63197,7 @@
}
ts.updateJsxElement = updateJsxElement;
function createJsxSelfClosingElement(tagName, typeArguments, attributes) {
- var node = createSynthesizedNode(261 /* JsxSelfClosingElement */);
+ var node = createSynthesizedNode(262 /* JsxSelfClosingElement */);
node.tagName = tagName;
node.typeArguments = asNodeArray(typeArguments);
node.attributes = attributes;
@@ -62330,7 +63213,7 @@
}
ts.updateJsxSelfClosingElement = updateJsxSelfClosingElement;
function createJsxOpeningElement(tagName, typeArguments, attributes) {
- var node = createSynthesizedNode(262 /* JsxOpeningElement */);
+ var node = createSynthesizedNode(263 /* JsxOpeningElement */);
node.tagName = tagName;
node.typeArguments = asNodeArray(typeArguments);
node.attributes = attributes;
@@ -62346,7 +63229,7 @@
}
ts.updateJsxOpeningElement = updateJsxOpeningElement;
function createJsxClosingElement(tagName) {
- var node = createSynthesizedNode(263 /* JsxClosingElement */);
+ var node = createSynthesizedNode(264 /* JsxClosingElement */);
node.tagName = tagName;
return node;
}
@@ -62358,7 +63241,7 @@
}
ts.updateJsxClosingElement = updateJsxClosingElement;
function createJsxFragment(openingFragment, children, closingFragment) {
- var node = createSynthesizedNode(264 /* JsxFragment */);
+ var node = createSynthesizedNode(265 /* JsxFragment */);
node.openingFragment = openingFragment;
node.children = createNodeArray(children);
node.closingFragment = closingFragment;
@@ -62380,11 +63263,11 @@
}
ts.updateJsxText = updateJsxText;
function createJsxOpeningFragment() {
- return createSynthesizedNode(265 /* JsxOpeningFragment */);
+ return createSynthesizedNode(266 /* JsxOpeningFragment */);
}
ts.createJsxOpeningFragment = createJsxOpeningFragment;
function createJsxJsxClosingFragment() {
- return createSynthesizedNode(266 /* JsxClosingFragment */);
+ return createSynthesizedNode(267 /* JsxClosingFragment */);
}
ts.createJsxJsxClosingFragment = createJsxJsxClosingFragment;
function updateJsxFragment(node, openingFragment, children, closingFragment) {
@@ -62396,7 +63279,7 @@
}
ts.updateJsxFragment = updateJsxFragment;
function createJsxAttribute(name, initializer) {
- var node = createSynthesizedNode(267 /* JsxAttribute */);
+ var node = createSynthesizedNode(268 /* JsxAttribute */);
node.name = name;
node.initializer = initializer;
return node;
@@ -62410,7 +63293,7 @@
}
ts.updateJsxAttribute = updateJsxAttribute;
function createJsxAttributes(properties) {
- var node = createSynthesizedNode(268 /* JsxAttributes */);
+ var node = createSynthesizedNode(269 /* JsxAttributes */);
node.properties = createNodeArray(properties);
return node;
}
@@ -62422,7 +63305,7 @@
}
ts.updateJsxAttributes = updateJsxAttributes;
function createJsxSpreadAttribute(expression) {
- var node = createSynthesizedNode(269 /* JsxSpreadAttribute */);
+ var node = createSynthesizedNode(270 /* JsxSpreadAttribute */);
node.expression = expression;
return node;
}
@@ -62434,7 +63317,7 @@
}
ts.updateJsxSpreadAttribute = updateJsxSpreadAttribute;
function createJsxExpression(dotDotDotToken, expression) {
- var node = createSynthesizedNode(270 /* JsxExpression */);
+ var node = createSynthesizedNode(271 /* JsxExpression */);
node.dotDotDotToken = dotDotDotToken;
node.expression = expression;
return node;
@@ -62448,7 +63331,7 @@
ts.updateJsxExpression = updateJsxExpression;
// Clauses
function createCaseClause(expression, statements) {
- var node = createSynthesizedNode(271 /* CaseClause */);
+ var node = createSynthesizedNode(272 /* CaseClause */);
node.expression = ts.parenthesizeExpressionForList(expression);
node.statements = createNodeArray(statements);
return node;
@@ -62462,7 +63345,7 @@
}
ts.updateCaseClause = updateCaseClause;
function createDefaultClause(statements) {
- var node = createSynthesizedNode(272 /* DefaultClause */);
+ var node = createSynthesizedNode(273 /* DefaultClause */);
node.statements = createNodeArray(statements);
return node;
}
@@ -62474,7 +63357,7 @@
}
ts.updateDefaultClause = updateDefaultClause;
function createHeritageClause(token, types) {
- var node = createSynthesizedNode(273 /* HeritageClause */);
+ var node = createSynthesizedNode(274 /* HeritageClause */);
node.token = token;
node.types = createNodeArray(types);
return node;
@@ -62487,7 +63370,7 @@
}
ts.updateHeritageClause = updateHeritageClause;
function createCatchClause(variableDeclaration, block) {
- var node = createSynthesizedNode(274 /* CatchClause */);
+ var node = createSynthesizedNode(275 /* CatchClause */);
node.variableDeclaration = ts.isString(variableDeclaration) ? createVariableDeclaration(variableDeclaration) : variableDeclaration;
node.block = block;
return node;
@@ -62502,7 +63385,7 @@
ts.updateCatchClause = updateCatchClause;
// Property assignments
function createPropertyAssignment(name, initializer) {
- var node = createSynthesizedNode(275 /* PropertyAssignment */);
+ var node = createSynthesizedNode(276 /* PropertyAssignment */);
node.name = asName(name);
node.questionToken = undefined;
node.initializer = ts.parenthesizeExpressionForList(initializer);
@@ -62517,7 +63400,7 @@
}
ts.updatePropertyAssignment = updatePropertyAssignment;
function createShorthandPropertyAssignment(name, objectAssignmentInitializer) {
- var node = createSynthesizedNode(276 /* ShorthandPropertyAssignment */);
+ var node = createSynthesizedNode(277 /* ShorthandPropertyAssignment */);
node.name = asName(name);
node.objectAssignmentInitializer = objectAssignmentInitializer !== undefined ? ts.parenthesizeExpressionForList(objectAssignmentInitializer) : undefined;
return node;
@@ -62531,8 +63414,8 @@
}
ts.updateShorthandPropertyAssignment = updateShorthandPropertyAssignment;
function createSpreadAssignment(expression) {
- var node = createSynthesizedNode(277 /* SpreadAssignment */);
- node.expression = expression !== undefined ? ts.parenthesizeExpressionForList(expression) : undefined; // TODO: GH#18217
+ var node = createSynthesizedNode(278 /* SpreadAssignment */);
+ node.expression = ts.parenthesizeExpressionForList(expression);
return node;
}
ts.createSpreadAssignment = createSpreadAssignment;
@@ -62544,7 +63427,7 @@
ts.updateSpreadAssignment = updateSpreadAssignment;
// Enum
function createEnumMember(name, initializer) {
- var node = createSynthesizedNode(278 /* EnumMember */);
+ var node = createSynthesizedNode(279 /* EnumMember */);
node.name = asName(name);
node.initializer = initializer && ts.parenthesizeExpressionForList(initializer);
return node;
@@ -62565,7 +63448,7 @@
(typeReferences !== undefined && node.typeReferenceDirectives !== typeReferences) ||
(libReferences !== undefined && node.libReferenceDirectives !== libReferences) ||
(hasNoDefaultLib !== undefined && node.hasNoDefaultLib !== hasNoDefaultLib)) {
- var updated = createSynthesizedNode(284 /* SourceFile */);
+ var updated = createSynthesizedNode(285 /* SourceFile */);
updated.flags |= node.flags;
updated.statements = createNodeArray(statements);
updated.endOfFileToken = node.endOfFileToken;
@@ -62649,7 +63532,7 @@
* @param original The original statement.
*/
function createNotEmittedStatement(original) {
- var node = createSynthesizedNode(312 /* NotEmittedStatement */);
+ var node = createSynthesizedNode(313 /* NotEmittedStatement */);
node.original = original;
setTextRange(node, original);
return node;
@@ -62661,7 +63544,7 @@
*/
/* @internal */
function createEndOfDeclarationMarker(original) {
- var node = createSynthesizedNode(316 /* EndOfDeclarationMarker */);
+ var node = createSynthesizedNode(317 /* EndOfDeclarationMarker */);
node.emitNode = {};
node.original = original;
return node;
@@ -62673,7 +63556,7 @@
*/
/* @internal */
function createMergeDeclarationMarker(original) {
- var node = createSynthesizedNode(315 /* MergeDeclarationMarker */);
+ var node = createSynthesizedNode(316 /* MergeDeclarationMarker */);
node.emitNode = {};
node.original = original;
return node;
@@ -62688,7 +63571,7 @@
* @param location The location for the expression. Defaults to the positions from "original" if provided.
*/
function createPartiallyEmittedExpression(expression, original) {
- var node = createSynthesizedNode(313 /* PartiallyEmittedExpression */);
+ var node = createSynthesizedNode(314 /* PartiallyEmittedExpression */);
node.expression = expression;
node.original = original;
setTextRange(node, original);
@@ -62704,7 +63587,7 @@
ts.updatePartiallyEmittedExpression = updatePartiallyEmittedExpression;
function flattenCommaElements(node) {
if (ts.nodeIsSynthesized(node) && !ts.isParseTreeNode(node) && !node.original && !node.emitNode && !node.id) {
- if (node.kind === 314 /* CommaListExpression */) {
+ if (node.kind === 315 /* CommaListExpression */) {
return node.elements;
}
if (ts.isBinaryExpression(node) && node.operatorToken.kind === 27 /* CommaToken */) {
@@ -62714,7 +63597,7 @@
return node;
}
function createCommaList(elements) {
- var node = createSynthesizedNode(314 /* CommaListExpression */);
+ var node = createSynthesizedNode(315 /* CommaListExpression */);
node.elements = createNodeArray(ts.sameFlatMap(elements, flattenCommaElements));
return node;
}
@@ -62727,7 +63610,7 @@
ts.updateCommaList = updateCommaList;
function createBundle(sourceFiles, prepends) {
if (prepends === void 0) { prepends = ts.emptyArray; }
- var node = ts.createNode(285 /* Bundle */);
+ var node = ts.createNode(286 /* Bundle */);
node.prepends = prepends;
node.sourceFiles = sourceFiles;
return node;
@@ -62757,7 +63640,7 @@
], function (helper) { return helper.name; }));
}
function createUnparsedSource() {
- var node = ts.createNode(286 /* UnparsedSource */);
+ var node = ts.createNode(287 /* UnparsedSource */);
node.prologues = ts.emptyArray;
node.referencedFiles = ts.emptyArray;
node.libReferenceDirectives = ts.emptyArray;
@@ -62889,10 +63772,10 @@
}
function mapBundleFileSectionKindToSyntaxKind(kind) {
switch (kind) {
- case "prologue" /* Prologue */: return 279 /* UnparsedPrologue */;
- case "prepend" /* Prepend */: return 280 /* UnparsedPrepend */;
- case "internal" /* Internal */: return 282 /* UnparsedInternalText */;
- case "text" /* Text */: return 281 /* UnparsedText */;
+ case "prologue" /* Prologue */: return 280 /* UnparsedPrologue */;
+ case "prepend" /* Prepend */: return 281 /* UnparsedPrepend */;
+ case "internal" /* Internal */: return 283 /* UnparsedInternalText */;
+ case "text" /* Text */: return 282 /* UnparsedText */;
case "emitHelpers" /* EmitHelpers */:
case "no-default-lib" /* NoDefaultLib */:
case "reference" /* Reference */:
@@ -62910,14 +63793,14 @@
return node;
}
function createUnparsedSyntheticReference(section, parent) {
- var node = ts.createNode(283 /* UnparsedSyntheticReference */, section.pos, section.end);
+ var node = ts.createNode(284 /* UnparsedSyntheticReference */, section.pos, section.end);
node.parent = parent;
node.data = section.data;
node.section = section;
return node;
}
function createInputFiles(javascriptTextOrReadFileText, declarationTextOrJavascriptPath, javascriptMapPath, javascriptMapTextOrDeclarationPath, declarationMapPath, declarationMapTextOrBuildInfoPath, javascriptPath, declarationPath, buildInfoPath, buildInfo, oldFileOfCurrentEmit) {
- var node = ts.createNode(287 /* InputFiles */);
+ var node = ts.createNode(288 /* InputFiles */);
if (!ts.isString(javascriptTextOrReadFileText)) {
var cache_1 = ts.createMap();
var textGetter_1 = function (path) {
@@ -63011,7 +63894,7 @@
}
ts.createLessThan = createLessThan;
function createAssignment(left, right) {
- return createBinary(left, 59 /* EqualsToken */, right);
+ return createBinary(left, 60 /* EqualsToken */, right);
}
ts.createAssignment = createAssignment;
function createStrictEquality(left, right) {
@@ -63104,7 +63987,7 @@
// To avoid holding onto transformation artifacts, we keep track of any
// parse tree node we are annotating. This allows us to clean them up after
// all transformations have completed.
- if (node.kind === 284 /* SourceFile */) {
+ if (node.kind === 285 /* SourceFile */) {
return node.emitNode = { annotatedNodes: [node] };
}
var sourceFile = ts.getSourceFileOfNode(ts.getParseTreeNode(ts.getSourceFileOfNode(node)));
@@ -63615,7 +64498,7 @@
if (!outermostLabeledStatement) {
return node;
}
- var updated = ts.updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 233 /* LabeledStatement */
+ var updated = ts.updateLabel(outermostLabeledStatement, outermostLabeledStatement.label, outermostLabeledStatement.statement.kind === 234 /* LabeledStatement */
? restoreEnclosingLabel(node, outermostLabeledStatement.statement)
: node);
if (afterRestoreLabelCallback) {
@@ -63627,20 +64510,20 @@
function shouldBeCapturedInTempVariable(node, cacheIdentifiers) {
var target = ts.skipParentheses(node);
switch (target.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return cacheIdentifiers;
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
case 8 /* NumericLiteral */:
case 9 /* BigIntLiteral */:
case 10 /* StringLiteral */:
return false;
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
var elements = target.elements;
if (elements.length === 0) {
return false;
}
return true;
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return target.properties.length > 0;
default:
return true;
@@ -63655,7 +64538,7 @@
thisArg = ts.createThis();
target = callee;
}
- else if (callee.kind === 98 /* SuperKeyword */) {
+ else if (callee.kind === 99 /* SuperKeyword */) {
thisArg = ts.createThis();
target = languageVersion < 2 /* ES2015 */
? ts.setTextRange(ts.createIdentifier("_super"), callee)
@@ -63667,7 +64550,7 @@
}
else {
switch (callee.kind) {
- case 189 /* PropertyAccessExpression */: {
+ case 190 /* PropertyAccessExpression */: {
if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) {
// for `a.b()` target is `(_a = a).b` and thisArg is `_a`
thisArg = ts.createTempVariable(recordTempVariable);
@@ -63680,7 +64563,7 @@
}
break;
}
- case 190 /* ElementAccessExpression */: {
+ case 191 /* ElementAccessExpression */: {
if (shouldBeCapturedInTempVariable(callee.expression, cacheIdentifiers)) {
// for `a[b]()` target is `(_a = a)[b]` and thisArg is `_a`
thisArg = ts.createTempVariable(recordTempVariable);
@@ -63737,14 +64620,14 @@
ts.createExpressionForPropertyName = createExpressionForPropertyName;
function createExpressionForObjectLiteralElementLike(node, property, receiver) {
switch (property.kind) {
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return createExpressionForAccessorDeclaration(node.properties, property, receiver, !!node.multiLine);
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return createExpressionForPropertyAssignment(property, receiver);
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return createExpressionForShorthandPropertyAssignment(property, receiver);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return createExpressionForMethodDeclaration(property, receiver);
}
}
@@ -63752,7 +64635,7 @@
function createExpressionForAccessorDeclaration(properties, property, receiver, multiLine) {
var _a = ts.getAllAccessorDeclarations(properties, property), firstAccessor = _a.firstAccessor, getAccessor = _a.getAccessor, setAccessor = _a.setAccessor;
if (property === firstAccessor) {
- var properties_7 = [];
+ var properties_5 = [];
if (getAccessor) {
var getterFunction = ts.createFunctionExpression(getAccessor.modifiers,
/*asteriskToken*/ undefined,
@@ -63763,7 +64646,7 @@
ts.setTextRange(getterFunction, getAccessor);
ts.setOriginalNode(getterFunction, getAccessor);
var getter = ts.createPropertyAssignment("get", getterFunction);
- properties_7.push(getter);
+ properties_5.push(getter);
}
if (setAccessor) {
var setterFunction = ts.createFunctionExpression(setAccessor.modifiers,
@@ -63775,15 +64658,15 @@
ts.setTextRange(setterFunction, setAccessor);
ts.setOriginalNode(setterFunction, setAccessor);
var setter = ts.createPropertyAssignment("set", setterFunction);
- properties_7.push(setter);
+ properties_5.push(setter);
}
- properties_7.push(ts.createPropertyAssignment("enumerable", ts.createTrue()));
- properties_7.push(ts.createPropertyAssignment("configurable", ts.createTrue()));
+ properties_5.push(ts.createPropertyAssignment("enumerable", ts.createTrue()));
+ properties_5.push(ts.createPropertyAssignment("configurable", ts.createTrue()));
var expression = ts.setTextRange(ts.createCall(ts.createPropertyAccess(ts.createIdentifier("Object"), "defineProperty"),
/*typeArguments*/ undefined, [
receiver,
createExpressionForPropertyName(property.name),
- ts.createObjectLiteral(properties_7, multiLine)
+ ts.createObjectLiteral(properties_5, multiLine)
]),
/*location*/ firstAccessor);
return ts.aggregateTransformFlags(expression);
@@ -64070,7 +64953,7 @@
function parenthesizeBinaryOperand(binaryOperator, operand, isLeftSideOfBinary, leftOperand) {
var skipped = ts.skipPartiallyEmittedExpressions(operand);
// If the resulting expression is already parenthesized, we do not need to do any further processing.
- if (skipped.kind === 195 /* ParenthesizedExpression */) {
+ if (skipped.kind === 196 /* ParenthesizedExpression */) {
return operand;
}
return binaryOperandNeedsParentheses(binaryOperator, operand, isLeftSideOfBinary, leftOperand)
@@ -64104,10 +64987,10 @@
//
// If `a ** d` is on the left of operator `**`, we need to parenthesize to preserve
// the intended order of operations: `(a ** b) ** c`
- var binaryOperatorPrecedence = ts.getOperatorPrecedence(204 /* BinaryExpression */, binaryOperator);
- var binaryOperatorAssociativity = ts.getOperatorAssociativity(204 /* BinaryExpression */, binaryOperator);
+ var binaryOperatorPrecedence = ts.getOperatorPrecedence(205 /* BinaryExpression */, binaryOperator);
+ var binaryOperatorAssociativity = ts.getOperatorAssociativity(205 /* BinaryExpression */, binaryOperator);
var emittedOperand = ts.skipPartiallyEmittedExpressions(operand);
- if (!isLeftSideOfBinary && operand.kind === 197 /* ArrowFunction */ && binaryOperatorPrecedence > 4) {
+ if (!isLeftSideOfBinary && operand.kind === 198 /* ArrowFunction */ && binaryOperatorPrecedence > 4) {
// We need to parenthesize arrow functions on the right side to avoid it being
// parsed as parenthesized expression: `a && (() => {})`
return true;
@@ -64119,7 +65002,7 @@
// and is a yield expression, then we do not need parentheses.
if (!isLeftSideOfBinary
&& binaryOperatorAssociativity === 1 /* Right */
- && operand.kind === 207 /* YieldExpression */) {
+ && operand.kind === 208 /* YieldExpression */) {
return false;
}
return true;
@@ -64207,7 +65090,7 @@
if (ts.isLiteralKind(node.kind)) {
return node.kind;
}
- if (node.kind === 204 /* BinaryExpression */ && node.operatorToken.kind === 38 /* PlusToken */) {
+ if (node.kind === 205 /* BinaryExpression */ && node.operatorToken.kind === 38 /* PlusToken */) {
if (node.cachedLiteralKind !== undefined) {
return node.cachedLiteralKind;
}
@@ -64222,7 +65105,7 @@
return 0 /* Unknown */;
}
function parenthesizeForConditionalHead(condition) {
- var conditionalPrecedence = ts.getOperatorPrecedence(205 /* ConditionalExpression */, 56 /* QuestionToken */);
+ var conditionalPrecedence = ts.getOperatorPrecedence(206 /* ConditionalExpression */, 56 /* QuestionToken */);
var emittedCondition = ts.skipPartiallyEmittedExpressions(condition);
var conditionPrecedence = ts.getExpressionPrecedence(emittedCondition);
if (ts.compareValues(conditionPrecedence, conditionalPrecedence) === -1 /* LessThan */) {
@@ -64257,8 +65140,8 @@
var needsParens = isCommaSequence(check);
if (!needsParens) {
switch (getLeftmostExpression(check, /*stopAtCallExpression*/ false).kind) {
- case 209 /* ClassExpression */:
- case 196 /* FunctionExpression */:
+ case 210 /* ClassExpression */:
+ case 197 /* FunctionExpression */:
needsParens = true;
}
}
@@ -64274,9 +65157,9 @@
function parenthesizeForNew(expression) {
var leftmostExpr = getLeftmostExpression(expression, /*stopAtCallExpressions*/ true);
switch (leftmostExpr.kind) {
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return ts.createParen(expression);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return !leftmostExpr.arguments
? ts.createParen(expression)
: expression;
@@ -64299,7 +65182,7 @@
//
var emittedExpression = ts.skipPartiallyEmittedExpressions(expression);
if (ts.isLeftHandSideExpression(emittedExpression)
- && (emittedExpression.kind !== 192 /* NewExpression */ || emittedExpression.arguments)) {
+ && (emittedExpression.kind !== 193 /* NewExpression */ || emittedExpression.arguments)) {
return expression;
}
return ts.setTextRange(ts.createParen(expression), expression);
@@ -64337,7 +65220,7 @@
function parenthesizeExpressionForList(expression) {
var emittedExpression = ts.skipPartiallyEmittedExpressions(expression);
var expressionPrecedence = ts.getExpressionPrecedence(emittedExpression);
- var commaPrecedence = ts.getOperatorPrecedence(204 /* BinaryExpression */, 27 /* CommaToken */);
+ var commaPrecedence = ts.getOperatorPrecedence(205 /* BinaryExpression */, 27 /* CommaToken */);
return expressionPrecedence > commaPrecedence
? expression
: ts.setTextRange(ts.createParen(expression), expression);
@@ -64348,29 +65231,29 @@
if (ts.isCallExpression(emittedExpression)) {
var callee = emittedExpression.expression;
var kind = ts.skipPartiallyEmittedExpressions(callee).kind;
- if (kind === 196 /* FunctionExpression */ || kind === 197 /* ArrowFunction */) {
+ if (kind === 197 /* FunctionExpression */ || kind === 198 /* ArrowFunction */) {
var mutableCall = ts.getMutableClone(emittedExpression);
mutableCall.expression = ts.setTextRange(ts.createParen(callee), callee);
return recreateOuterExpressions(expression, mutableCall, 4 /* PartiallyEmittedExpressions */);
}
}
var leftmostExpressionKind = getLeftmostExpression(emittedExpression, /*stopAtCallExpressions*/ false).kind;
- if (leftmostExpressionKind === 188 /* ObjectLiteralExpression */ || leftmostExpressionKind === 196 /* FunctionExpression */) {
+ if (leftmostExpressionKind === 189 /* ObjectLiteralExpression */ || leftmostExpressionKind === 197 /* FunctionExpression */) {
return ts.setTextRange(ts.createParen(expression), expression);
}
return expression;
}
ts.parenthesizeExpressionForExpressionStatement = parenthesizeExpressionForExpressionStatement;
function parenthesizeConditionalTypeMember(member) {
- return member.kind === 175 /* ConditionalType */ ? ts.createParenthesizedType(member) : member;
+ return member.kind === 176 /* ConditionalType */ ? ts.createParenthesizedType(member) : member;
}
ts.parenthesizeConditionalTypeMember = parenthesizeConditionalTypeMember;
function parenthesizeElementTypeMember(member) {
switch (member.kind) {
- case 173 /* UnionType */:
- case 174 /* IntersectionType */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
+ case 174 /* UnionType */:
+ case 175 /* IntersectionType */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
return ts.createParenthesizedType(member);
}
return parenthesizeConditionalTypeMember(member);
@@ -64378,9 +65261,9 @@
ts.parenthesizeElementTypeMember = parenthesizeElementTypeMember;
function parenthesizeArrayTypeMember(member) {
switch (member.kind) {
- case 167 /* TypeQuery */:
- case 179 /* TypeOperator */:
- case 176 /* InferType */:
+ case 168 /* TypeQuery */:
+ case 180 /* TypeOperator */:
+ case 177 /* InferType */:
return ts.createParenthesizedType(member);
}
return parenthesizeElementTypeMember(member);
@@ -64406,28 +65289,28 @@
function getLeftmostExpression(node, stopAtCallExpressions) {
while (true) {
switch (node.kind) {
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
node = node.operand;
continue;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
node = node.left;
continue;
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
node = node.condition;
continue;
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
node = node.tag;
continue;
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
if (stopAtCallExpressions) {
return node;
}
// falls through
- case 212 /* AsExpression */:
- case 190 /* ElementAccessExpression */:
- case 189 /* PropertyAccessExpression */:
- case 213 /* NonNullExpression */:
- case 313 /* PartiallyEmittedExpression */:
+ case 213 /* AsExpression */:
+ case 191 /* ElementAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
+ case 214 /* NonNullExpression */:
+ case 314 /* PartiallyEmittedExpression */:
node = node.expression;
continue;
}
@@ -64435,15 +65318,15 @@
}
}
function parenthesizeConciseBody(body) {
- if (!ts.isBlock(body) && (isCommaSequence(body) || getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 188 /* ObjectLiteralExpression */)) {
+ if (!ts.isBlock(body) && (isCommaSequence(body) || getLeftmostExpression(body, /*stopAtCallExpressions*/ false).kind === 189 /* ObjectLiteralExpression */)) {
return ts.setTextRange(ts.createParen(body), body);
}
return body;
}
ts.parenthesizeConciseBody = parenthesizeConciseBody;
function isCommaSequence(node) {
- return node.kind === 204 /* BinaryExpression */ && node.operatorToken.kind === 27 /* CommaToken */ ||
- node.kind === 314 /* CommaListExpression */;
+ return node.kind === 205 /* BinaryExpression */ && node.operatorToken.kind === 27 /* CommaToken */ ||
+ node.kind === 315 /* CommaListExpression */;
}
ts.isCommaSequence = isCommaSequence;
var OuterExpressionKinds;
@@ -64456,13 +65339,13 @@
function isOuterExpression(node, kinds) {
if (kinds === void 0) { kinds = 7 /* All */; }
switch (node.kind) {
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return (kinds & 1 /* Parentheses */) !== 0;
- case 194 /* TypeAssertionExpression */:
- case 212 /* AsExpression */:
- case 213 /* NonNullExpression */:
+ case 195 /* TypeAssertionExpression */:
+ case 213 /* AsExpression */:
+ case 214 /* NonNullExpression */:
return (kinds & 2 /* Assertions */) !== 0;
- case 313 /* PartiallyEmittedExpression */:
+ case 314 /* PartiallyEmittedExpression */:
return (kinds & 4 /* PartiallyEmittedExpressions */) !== 0;
}
return false;
@@ -64487,7 +65370,7 @@
}
ts.skipOuterExpressions = skipOuterExpressions;
function skipAssertions(node) {
- while (ts.isAssertionExpression(node) || node.kind === 213 /* NonNullExpression */) {
+ while (ts.isAssertionExpression(node) || node.kind === 214 /* NonNullExpression */) {
node = node.expression;
}
return node;
@@ -64495,11 +65378,11 @@
ts.skipAssertions = skipAssertions;
function updateOuterExpression(outerExpression, expression) {
switch (outerExpression.kind) {
- case 195 /* ParenthesizedExpression */: return ts.updateParen(outerExpression, expression);
- case 194 /* TypeAssertionExpression */: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression);
- case 212 /* AsExpression */: return ts.updateAsExpression(outerExpression, expression, outerExpression.type);
- case 213 /* NonNullExpression */: return ts.updateNonNullExpression(outerExpression, expression);
- case 313 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(outerExpression, expression);
+ case 196 /* ParenthesizedExpression */: return ts.updateParen(outerExpression, expression);
+ case 195 /* TypeAssertionExpression */: return ts.updateTypeAssertion(outerExpression, outerExpression.type, expression);
+ case 213 /* AsExpression */: return ts.updateAsExpression(outerExpression, expression, outerExpression.type);
+ case 214 /* NonNullExpression */: return ts.updateNonNullExpression(outerExpression, expression);
+ case 314 /* PartiallyEmittedExpression */: return ts.updatePartiallyEmittedExpression(outerExpression, expression);
}
}
/**
@@ -64517,7 +65400,7 @@
* the containing expression is created/updated.
*/
function isIgnorableParen(node) {
- return node.kind === 195 /* ParenthesizedExpression */
+ return node.kind === 196 /* ParenthesizedExpression */
&& ts.nodeIsSynthesized(node)
&& ts.nodeIsSynthesized(ts.getSourceMapRange(node))
&& ts.nodeIsSynthesized(ts.getCommentRange(node))
@@ -64582,10 +65465,10 @@
var name = namespaceDeclaration.name;
return ts.isGeneratedIdentifier(name) ? name : ts.createIdentifier(ts.getSourceTextOfNodeFromSourceFile(sourceFile, name) || ts.idText(name));
}
- if (node.kind === 249 /* ImportDeclaration */ && node.importClause) {
+ if (node.kind === 250 /* ImportDeclaration */ && node.importClause) {
return ts.getGeneratedNameForNode(node);
}
- if (node.kind === 255 /* ExportDeclaration */ && node.moduleSpecifier) {
+ if (node.kind === 256 /* ExportDeclaration */ && node.moduleSpecifier) {
return ts.getGeneratedNameForNode(node);
}
return undefined;
@@ -64704,7 +65587,7 @@
}
if (ts.isObjectLiteralElementLike(bindingElement)) {
switch (bindingElement.kind) {
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
// `b` in `({ a: b } = ...)`
// `b` in `({ a: b = 1 } = ...)`
// `{b}` in `({ a: {b} } = ...)`
@@ -64716,11 +65599,11 @@
// `b[0]` in `({ a: b[0] } = ...)`
// `b[0]` in `({ a: b[0] = 1 } = ...)`
return getTargetOfBindingOrAssignmentElement(bindingElement.initializer);
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
// `a` in `({ a } = ...)`
// `a` in `({ a = 1 } = ...)`
return bindingElement.name;
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
// `a` in `({ ...a } = ...)`
return getTargetOfBindingOrAssignmentElement(bindingElement.expression);
}
@@ -64752,12 +65635,12 @@
*/
function getRestIndicatorOfBindingOrAssignmentElement(bindingElement) {
switch (bindingElement.kind) {
- case 151 /* Parameter */:
- case 186 /* BindingElement */:
+ case 152 /* Parameter */:
+ case 187 /* BindingElement */:
// `...` in `let [...a] = ...`
return bindingElement.dotDotDotToken;
- case 208 /* SpreadElement */:
- case 277 /* SpreadAssignment */:
+ case 209 /* SpreadElement */:
+ case 278 /* SpreadAssignment */:
// `...` in `[...a] = ...`
return bindingElement;
}
@@ -64769,7 +65652,7 @@
*/
function getPropertyNameOfBindingOrAssignmentElement(bindingElement) {
switch (bindingElement.kind) {
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
// `a` in `let { a: b } = ...`
// `[a]` in `let { [a]: b } = ...`
// `"a"` in `let { "a": b } = ...`
@@ -64781,7 +65664,7 @@
: propertyName;
}
break;
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
// `a` in `({ a: b } = ...)`
// `[a]` in `({ [a]: b } = ...)`
// `"a"` in `({ "a": b } = ...)`
@@ -64793,7 +65676,7 @@
: propertyName;
}
break;
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
// `a` in `({ ...a } = ...)`
return bindingElement.name;
}
@@ -64816,13 +65699,13 @@
*/
function getElementsOfBindingOrAssignmentPattern(name) {
switch (name.kind) {
- case 184 /* ObjectBindingPattern */:
- case 185 /* ArrayBindingPattern */:
- case 187 /* ArrayLiteralExpression */:
+ case 185 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
+ case 188 /* ArrayLiteralExpression */:
// `a` in `{a}`
// `a` in `[a]`
return name.elements;
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
// `a` in `{a}`
return name.properties;
}
@@ -64862,11 +65745,11 @@
ts.convertToObjectAssignmentElement = convertToObjectAssignmentElement;
function convertToAssignmentPattern(node) {
switch (node.kind) {
- case 185 /* ArrayBindingPattern */:
- case 187 /* ArrayLiteralExpression */:
+ case 186 /* ArrayBindingPattern */:
+ case 188 /* ArrayLiteralExpression */:
return convertToArrayAssignmentPattern(node);
- case 184 /* ObjectBindingPattern */:
- case 188 /* ObjectLiteralExpression */:
+ case 185 /* ObjectBindingPattern */:
+ case 189 /* ObjectLiteralExpression */:
return convertToObjectAssignmentPattern(node);
}
}
@@ -65027,276 +65910,278 @@
}
var kind = node.kind;
// No need to visit nodes with no children.
- if ((kind > 0 /* FirstToken */ && kind <= 147 /* LastToken */) || kind === 178 /* ThisType */) {
+ if ((kind > 0 /* FirstToken */ && kind <= 148 /* LastToken */) || kind === 179 /* ThisType */) {
return node;
}
switch (kind) {
// Names
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return ts.updateIdentifier(node, nodesVisitor(node.typeArguments, visitor, isTypeNodeOrTypeParameterDeclaration));
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
return ts.updateQualifiedName(node, visitNode(node.left, visitor, ts.isEntityName), visitNode(node.right, visitor, ts.isIdentifier));
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
return ts.updateComputedPropertyName(node, visitNode(node.expression, visitor, ts.isExpression));
// Signature elements
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
return ts.updateTypeParameterDeclaration(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.constraint, visitor, ts.isTypeNode), visitNode(node.default, visitor, ts.isTypeNode));
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return ts.updateParameter(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.dotDotDotToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression));
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
return ts.updateDecorator(node, visitNode(node.expression, visitor, ts.isExpression));
// Type elements
- case 153 /* PropertySignature */:
+ case 154 /* PropertySignature */:
return ts.updatePropertySignature(node, nodesVisitor(node.modifiers, visitor, ts.isToken), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression));
- case 154 /* PropertyDeclaration */:
- return ts.updateProperty(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression));
- case 155 /* MethodSignature */:
+ case 155 /* PropertyDeclaration */:
+ return ts.updateProperty(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName),
+ // QuestionToken and ExclamationToken is uniqued in Property Declaration and the signature of 'updateProperty' is that too
+ visitNode(node.questionToken || node.exclamationToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression));
+ case 156 /* MethodSignature */:
return ts.updateMethodSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken));
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return ts.updateMethod(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.questionToken, tokenVisitor, ts.isToken), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context));
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return ts.updateConstructor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context));
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
return ts.updateGetAccessor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context));
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
return ts.updateSetAccessor(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isPropertyName), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitFunctionBody(node.body, visitor, context));
- case 160 /* CallSignature */:
+ case 161 /* CallSignature */:
return ts.updateCallSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
- case 161 /* ConstructSignature */:
+ case 162 /* ConstructSignature */:
return ts.updateConstructSignature(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
- case 162 /* IndexSignature */:
+ case 163 /* IndexSignature */:
return ts.updateIndexSignature(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
// Types
- case 163 /* TypePredicate */:
+ case 164 /* TypePredicate */:
return ts.updateTypePredicateNode(node, visitNode(node.parameterName, visitor), visitNode(node.type, visitor, ts.isTypeNode));
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return ts.updateTypeReferenceNode(node, visitNode(node.typeName, visitor, ts.isEntityName), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode));
- case 165 /* FunctionType */:
+ case 166 /* FunctionType */:
return ts.updateFunctionTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
- case 166 /* ConstructorType */:
+ case 167 /* ConstructorType */:
return ts.updateConstructorTypeNode(node, nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.parameters, visitor, ts.isParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
- case 167 /* TypeQuery */:
+ case 168 /* TypeQuery */:
return ts.updateTypeQueryNode(node, visitNode(node.exprName, visitor, ts.isEntityName));
- case 168 /* TypeLiteral */:
+ case 169 /* TypeLiteral */:
return ts.updateTypeLiteralNode(node, nodesVisitor(node.members, visitor, ts.isTypeElement));
- case 169 /* ArrayType */:
+ case 170 /* ArrayType */:
return ts.updateArrayTypeNode(node, visitNode(node.elementType, visitor, ts.isTypeNode));
- case 170 /* TupleType */:
+ case 171 /* TupleType */:
return ts.updateTupleTypeNode(node, nodesVisitor(node.elementTypes, visitor, ts.isTypeNode));
- case 171 /* OptionalType */:
+ case 172 /* OptionalType */:
return ts.updateOptionalTypeNode(node, visitNode(node.type, visitor, ts.isTypeNode));
- case 172 /* RestType */:
+ case 173 /* RestType */:
return ts.updateRestTypeNode(node, visitNode(node.type, visitor, ts.isTypeNode));
- case 173 /* UnionType */:
+ case 174 /* UnionType */:
return ts.updateUnionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode));
- case 174 /* IntersectionType */:
+ case 175 /* IntersectionType */:
return ts.updateIntersectionTypeNode(node, nodesVisitor(node.types, visitor, ts.isTypeNode));
- case 175 /* ConditionalType */:
+ case 176 /* ConditionalType */:
return ts.updateConditionalTypeNode(node, visitNode(node.checkType, visitor, ts.isTypeNode), visitNode(node.extendsType, visitor, ts.isTypeNode), visitNode(node.trueType, visitor, ts.isTypeNode), visitNode(node.falseType, visitor, ts.isTypeNode));
- case 176 /* InferType */:
+ case 177 /* InferType */:
return ts.updateInferTypeNode(node, visitNode(node.typeParameter, visitor, ts.isTypeParameterDeclaration));
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return ts.updateImportTypeNode(node, visitNode(node.argument, visitor, ts.isTypeNode), visitNode(node.qualifier, visitor, ts.isEntityName), visitNodes(node.typeArguments, visitor, ts.isTypeNode), node.isTypeOf);
- case 177 /* ParenthesizedType */:
+ case 178 /* ParenthesizedType */:
return ts.updateParenthesizedType(node, visitNode(node.type, visitor, ts.isTypeNode));
- case 179 /* TypeOperator */:
+ case 180 /* TypeOperator */:
return ts.updateTypeOperatorNode(node, visitNode(node.type, visitor, ts.isTypeNode));
- case 180 /* IndexedAccessType */:
+ case 181 /* IndexedAccessType */:
return ts.updateIndexedAccessTypeNode(node, visitNode(node.objectType, visitor, ts.isTypeNode), visitNode(node.indexType, visitor, ts.isTypeNode));
- case 181 /* MappedType */:
+ case 182 /* MappedType */:
return ts.updateMappedTypeNode(node, visitNode(node.readonlyToken, tokenVisitor, ts.isToken), visitNode(node.typeParameter, visitor, ts.isTypeParameterDeclaration), visitNode(node.questionToken, tokenVisitor, ts.isToken), visitNode(node.type, visitor, ts.isTypeNode));
- case 182 /* LiteralType */:
+ case 183 /* LiteralType */:
return ts.updateLiteralTypeNode(node, visitNode(node.literal, visitor, ts.isExpression));
// Binding patterns
- case 184 /* ObjectBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
return ts.updateObjectBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isBindingElement));
- case 185 /* ArrayBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
return ts.updateArrayBindingPattern(node, nodesVisitor(node.elements, visitor, ts.isArrayBindingElement));
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return ts.updateBindingElement(node, visitNode(node.dotDotDotToken, tokenVisitor, ts.isToken), visitNode(node.propertyName, visitor, ts.isPropertyName), visitNode(node.name, visitor, ts.isBindingName), visitNode(node.initializer, visitor, ts.isExpression));
// Expression
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return ts.updateArrayLiteral(node, nodesVisitor(node.elements, visitor, ts.isExpression));
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return ts.updateObjectLiteral(node, nodesVisitor(node.properties, visitor, ts.isObjectLiteralElementLike));
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return ts.updatePropertyAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.name, visitor, ts.isIdentifier));
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return ts.updateElementAccess(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.argumentExpression, visitor, ts.isExpression));
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return ts.updateCall(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression));
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return ts.updateNew(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), nodesVisitor(node.arguments, visitor, ts.isExpression));
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return ts.updateTaggedTemplate(node, visitNode(node.tag, visitor, ts.isExpression), visitNodes(node.typeArguments, visitor, ts.isExpression), visitNode(node.template, visitor, ts.isTemplateLiteral));
- case 194 /* TypeAssertionExpression */:
+ case 195 /* TypeAssertionExpression */:
return ts.updateTypeAssertion(node, visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression));
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return ts.updateParen(node, visitNode(node.expression, visitor, ts.isExpression));
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return ts.updateFunctionExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context));
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return ts.updateArrowFunction(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.equalsGreaterThanToken, visitor, ts.isToken), visitFunctionBody(node.body, visitor, context));
- case 198 /* DeleteExpression */:
+ case 199 /* DeleteExpression */:
return ts.updateDelete(node, visitNode(node.expression, visitor, ts.isExpression));
- case 199 /* TypeOfExpression */:
+ case 200 /* TypeOfExpression */:
return ts.updateTypeOf(node, visitNode(node.expression, visitor, ts.isExpression));
- case 200 /* VoidExpression */:
+ case 201 /* VoidExpression */:
return ts.updateVoid(node, visitNode(node.expression, visitor, ts.isExpression));
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
return ts.updateAwait(node, visitNode(node.expression, visitor, ts.isExpression));
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return ts.updatePrefix(node, visitNode(node.operand, visitor, ts.isExpression));
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return ts.updatePostfix(node, visitNode(node.operand, visitor, ts.isExpression));
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return ts.updateBinary(node, visitNode(node.left, visitor, ts.isExpression), visitNode(node.right, visitor, ts.isExpression), visitNode(node.operatorToken, visitor, ts.isToken));
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return ts.updateConditional(node, visitNode(node.condition, visitor, ts.isExpression), visitNode(node.questionToken, visitor, ts.isToken), visitNode(node.whenTrue, visitor, ts.isExpression), visitNode(node.colonToken, visitor, ts.isToken), visitNode(node.whenFalse, visitor, ts.isExpression));
- case 206 /* TemplateExpression */:
+ case 207 /* TemplateExpression */:
return ts.updateTemplateExpression(node, visitNode(node.head, visitor, ts.isTemplateHead), nodesVisitor(node.templateSpans, visitor, ts.isTemplateSpan));
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return ts.updateYield(node, visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.expression, visitor, ts.isExpression));
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
return ts.updateSpread(node, visitNode(node.expression, visitor, ts.isExpression));
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
return ts.updateClassExpression(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement));
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return ts.updateExpressionWithTypeArguments(node, nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.expression, visitor, ts.isExpression));
- case 212 /* AsExpression */:
+ case 213 /* AsExpression */:
return ts.updateAsExpression(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.type, visitor, ts.isTypeNode));
- case 213 /* NonNullExpression */:
+ case 214 /* NonNullExpression */:
return ts.updateNonNullExpression(node, visitNode(node.expression, visitor, ts.isExpression));
- case 214 /* MetaProperty */:
+ case 215 /* MetaProperty */:
return ts.updateMetaProperty(node, visitNode(node.name, visitor, ts.isIdentifier));
// Misc
- case 216 /* TemplateSpan */:
+ case 217 /* TemplateSpan */:
return ts.updateTemplateSpan(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.literal, visitor, ts.isTemplateMiddleOrTemplateTail));
// Element
- case 218 /* Block */:
+ case 219 /* Block */:
return ts.updateBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement));
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return ts.updateVariableStatement(node, nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.declarationList, visitor, ts.isVariableDeclarationList));
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return ts.updateExpressionStatement(node, visitNode(node.expression, visitor, ts.isExpression));
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
return ts.updateIf(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.thenStatement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.elseStatement, visitor, ts.isStatement, ts.liftToBlock));
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
return ts.updateDo(node, visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock), visitNode(node.expression, visitor, ts.isExpression));
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
return ts.updateWhile(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return ts.updateFor(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.condition, visitor, ts.isExpression), visitNode(node.incrementor, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return ts.updateForIn(node, visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return ts.updateForOf(node, visitNode(node.awaitModifier, visitor, ts.isToken), visitNode(node.initializer, visitor, ts.isForInitializer), visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
- case 228 /* ContinueStatement */:
+ case 229 /* ContinueStatement */:
return ts.updateContinue(node, visitNode(node.label, visitor, ts.isIdentifier));
- case 229 /* BreakStatement */:
+ case 230 /* BreakStatement */:
return ts.updateBreak(node, visitNode(node.label, visitor, ts.isIdentifier));
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return ts.updateReturn(node, visitNode(node.expression, visitor, ts.isExpression));
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
return ts.updateWith(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return ts.updateSwitch(node, visitNode(node.expression, visitor, ts.isExpression), visitNode(node.caseBlock, visitor, ts.isCaseBlock));
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return ts.updateLabel(node, visitNode(node.label, visitor, ts.isIdentifier), visitNode(node.statement, visitor, ts.isStatement, ts.liftToBlock));
- case 234 /* ThrowStatement */:
+ case 235 /* ThrowStatement */:
return ts.updateThrow(node, visitNode(node.expression, visitor, ts.isExpression));
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
return ts.updateTry(node, visitNode(node.tryBlock, visitor, ts.isBlock), visitNode(node.catchClause, visitor, ts.isCatchClause), visitNode(node.finallyBlock, visitor, ts.isBlock));
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return ts.updateVariableDeclaration(node, visitNode(node.name, visitor, ts.isBindingName), visitNode(node.type, visitor, ts.isTypeNode), visitNode(node.initializer, visitor, ts.isExpression));
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
return ts.updateVariableDeclarationList(node, nodesVisitor(node.declarations, visitor, ts.isVariableDeclaration));
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return ts.updateFunctionDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.asteriskToken, tokenVisitor, ts.isToken), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitParameterList(node.parameters, visitor, context, nodesVisitor), visitNode(node.type, visitor, ts.isTypeNode), visitFunctionBody(node.body, visitor, context));
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return ts.updateClassDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isClassElement));
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
return ts.updateInterfaceDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), nodesVisitor(node.heritageClauses, visitor, ts.isHeritageClause), nodesVisitor(node.members, visitor, ts.isTypeElement));
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return ts.updateTypeAliasDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.typeParameters, visitor, ts.isTypeParameterDeclaration), visitNode(node.type, visitor, ts.isTypeNode));
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return ts.updateEnumDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), nodesVisitor(node.members, visitor, ts.isEnumMember));
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return ts.updateModuleDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.body, visitor, ts.isModuleBody));
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
return ts.updateModuleBlock(node, nodesVisitor(node.statements, visitor, ts.isStatement));
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
return ts.updateCaseBlock(node, nodesVisitor(node.clauses, visitor, ts.isCaseOrDefaultClause));
- case 247 /* NamespaceExportDeclaration */:
+ case 248 /* NamespaceExportDeclaration */:
return ts.updateNamespaceExportDeclaration(node, visitNode(node.name, visitor, ts.isIdentifier));
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return ts.updateImportEqualsDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.moduleReference, visitor, ts.isModuleReference));
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return ts.updateImportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.importClause, visitor, ts.isImportClause), visitNode(node.moduleSpecifier, visitor, ts.isExpression));
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
return ts.updateImportClause(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.namedBindings, visitor, ts.isNamedImportBindings));
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
return ts.updateNamespaceImport(node, visitNode(node.name, visitor, ts.isIdentifier));
- case 252 /* NamedImports */:
+ case 253 /* NamedImports */:
return ts.updateNamedImports(node, nodesVisitor(node.elements, visitor, ts.isImportSpecifier));
- case 253 /* ImportSpecifier */:
+ case 254 /* ImportSpecifier */:
return ts.updateImportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier));
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return ts.updateExportAssignment(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.expression, visitor, ts.isExpression));
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return ts.updateExportDeclaration(node, nodesVisitor(node.decorators, visitor, ts.isDecorator), nodesVisitor(node.modifiers, visitor, ts.isModifier), visitNode(node.exportClause, visitor, ts.isNamedExports), visitNode(node.moduleSpecifier, visitor, ts.isExpression));
- case 256 /* NamedExports */:
+ case 257 /* NamedExports */:
return ts.updateNamedExports(node, nodesVisitor(node.elements, visitor, ts.isExportSpecifier));
- case 257 /* ExportSpecifier */:
+ case 258 /* ExportSpecifier */:
return ts.updateExportSpecifier(node, visitNode(node.propertyName, visitor, ts.isIdentifier), visitNode(node.name, visitor, ts.isIdentifier));
// Module references
- case 259 /* ExternalModuleReference */:
+ case 260 /* ExternalModuleReference */:
return ts.updateExternalModuleReference(node, visitNode(node.expression, visitor, ts.isExpression));
// JSX
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
return ts.updateJsxElement(node, visitNode(node.openingElement, visitor, ts.isJsxOpeningElement), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingElement, visitor, ts.isJsxClosingElement));
- case 261 /* JsxSelfClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
return ts.updateJsxSelfClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.attributes, visitor, ts.isJsxAttributes));
- case 262 /* JsxOpeningElement */:
+ case 263 /* JsxOpeningElement */:
return ts.updateJsxOpeningElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression), nodesVisitor(node.typeArguments, visitor, ts.isTypeNode), visitNode(node.attributes, visitor, ts.isJsxAttributes));
- case 263 /* JsxClosingElement */:
+ case 264 /* JsxClosingElement */:
return ts.updateJsxClosingElement(node, visitNode(node.tagName, visitor, ts.isJsxTagNameExpression));
- case 264 /* JsxFragment */:
+ case 265 /* JsxFragment */:
return ts.updateJsxFragment(node, visitNode(node.openingFragment, visitor, ts.isJsxOpeningFragment), nodesVisitor(node.children, visitor, ts.isJsxChild), visitNode(node.closingFragment, visitor, ts.isJsxClosingFragment));
- case 267 /* JsxAttribute */:
+ case 268 /* JsxAttribute */:
return ts.updateJsxAttribute(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.initializer, visitor, ts.isStringLiteralOrJsxExpression));
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
return ts.updateJsxAttributes(node, nodesVisitor(node.properties, visitor, ts.isJsxAttributeLike));
- case 269 /* JsxSpreadAttribute */:
+ case 270 /* JsxSpreadAttribute */:
return ts.updateJsxSpreadAttribute(node, visitNode(node.expression, visitor, ts.isExpression));
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return ts.updateJsxExpression(node, visitNode(node.expression, visitor, ts.isExpression));
// Clauses
- case 271 /* CaseClause */:
+ case 272 /* CaseClause */:
return ts.updateCaseClause(node, visitNode(node.expression, visitor, ts.isExpression), nodesVisitor(node.statements, visitor, ts.isStatement));
- case 272 /* DefaultClause */:
+ case 273 /* DefaultClause */:
return ts.updateDefaultClause(node, nodesVisitor(node.statements, visitor, ts.isStatement));
- case 273 /* HeritageClause */:
+ case 274 /* HeritageClause */:
return ts.updateHeritageClause(node, nodesVisitor(node.types, visitor, ts.isExpressionWithTypeArguments));
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return ts.updateCatchClause(node, visitNode(node.variableDeclaration, visitor, ts.isVariableDeclaration), visitNode(node.block, visitor, ts.isBlock));
// Property assignments
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return ts.updatePropertyAssignment(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression));
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return ts.updateShorthandPropertyAssignment(node, visitNode(node.name, visitor, ts.isIdentifier), visitNode(node.objectAssignmentInitializer, visitor, ts.isExpression));
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
return ts.updateSpreadAssignment(node, visitNode(node.expression, visitor, ts.isExpression));
// Enum
- case 278 /* EnumMember */:
+ case 279 /* EnumMember */:
return ts.updateEnumMember(node, visitNode(node.name, visitor, ts.isPropertyName), visitNode(node.initializer, visitor, ts.isExpression));
// Top-level nodes
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
return ts.updateSourceFileNode(node, visitLexicalEnvironment(node.statements, visitor, context));
// Transformation nodes
- case 313 /* PartiallyEmittedExpression */:
+ case 314 /* PartiallyEmittedExpression */:
return ts.updatePartiallyEmittedExpression(node, visitNode(node.expression, visitor, ts.isExpression));
- case 314 /* CommaListExpression */:
+ case 315 /* CommaListExpression */:
return ts.updateCommaList(node, nodesVisitor(node.elements, visitor, ts.isExpression));
default:
// No need to visit nodes with no children.
@@ -65338,58 +66223,58 @@
var cbNodes = cbNodeArray || cbNode;
var kind = node.kind;
// No need to visit nodes with no children.
- if ((kind > 0 /* FirstToken */ && kind <= 147 /* LastToken */)) {
+ if ((kind > 0 /* FirstToken */ && kind <= 148 /* LastToken */)) {
return initial;
}
// We do not yet support types.
- if ((kind >= 163 /* TypePredicate */ && kind <= 182 /* LiteralType */)) {
+ if ((kind >= 164 /* TypePredicate */ && kind <= 183 /* LiteralType */)) {
return initial;
}
var result = initial;
switch (node.kind) {
// Leaf nodes
- case 217 /* SemicolonClassElement */:
- case 220 /* EmptyStatement */:
- case 210 /* OmittedExpression */:
- case 236 /* DebuggerStatement */:
- case 312 /* NotEmittedStatement */:
+ case 218 /* SemicolonClassElement */:
+ case 221 /* EmptyStatement */:
+ case 211 /* OmittedExpression */:
+ case 237 /* DebuggerStatement */:
+ case 313 /* NotEmittedStatement */:
// No need to visit nodes with no children.
break;
// Names
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
result = reduceNode(node.left, cbNode, result);
result = reduceNode(node.right, cbNode, result);
break;
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
result = reduceNode(node.expression, cbNode, result);
break;
// Signature elements
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
result = reduceNode(node.expression, cbNode, result);
break;
// Type member
- case 153 /* PropertySignature */:
+ case 154 /* PropertySignature */:
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.questionToken, cbNode, result);
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
@@ -65398,12 +66283,12 @@
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNodes(node.parameters, cbNodes, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
@@ -65411,7 +66296,7 @@
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
@@ -65419,50 +66304,50 @@
result = reduceNode(node.body, cbNode, result);
break;
// Binding patterns
- case 184 /* ObjectBindingPattern */:
- case 185 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
result = reduceNodes(node.elements, cbNodes, result);
break;
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
result = reduceNode(node.propertyName, cbNode, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
// Expression
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
result = reduceNodes(node.elements, cbNodes, result);
break;
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
result = reduceNodes(node.properties, cbNodes, result);
break;
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.name, cbNode, result);
break;
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.argumentExpression, cbNode, result);
break;
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNodes(node.typeArguments, cbNodes, result);
result = reduceNodes(node.arguments, cbNodes, result);
break;
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNodes(node.typeArguments, cbNodes, result);
result = reduceNodes(node.arguments, cbNodes, result);
break;
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
result = reduceNode(node.tag, cbNode, result);
result = reduceNodes(node.typeArguments, cbNodes, result);
result = reduceNode(node.template, cbNode, result);
break;
- case 194 /* TypeAssertionExpression */:
+ case 195 /* TypeAssertionExpression */:
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.expression, cbNode, result);
break;
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNodes(node.typeParameters, cbNodes, result);
@@ -65470,123 +66355,123 @@
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNodes(node.typeParameters, cbNodes, result);
result = reduceNodes(node.parameters, cbNodes, result);
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 195 /* ParenthesizedExpression */:
- case 198 /* DeleteExpression */:
- case 199 /* TypeOfExpression */:
- case 200 /* VoidExpression */:
- case 201 /* AwaitExpression */:
- case 207 /* YieldExpression */:
- case 208 /* SpreadElement */:
- case 213 /* NonNullExpression */:
+ case 196 /* ParenthesizedExpression */:
+ case 199 /* DeleteExpression */:
+ case 200 /* TypeOfExpression */:
+ case 201 /* VoidExpression */:
+ case 202 /* AwaitExpression */:
+ case 208 /* YieldExpression */:
+ case 209 /* SpreadElement */:
+ case 214 /* NonNullExpression */:
result = reduceNode(node.expression, cbNode, result);
break;
- case 202 /* PrefixUnaryExpression */:
- case 203 /* PostfixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
result = reduceNode(node.operand, cbNode, result);
break;
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
result = reduceNode(node.left, cbNode, result);
result = reduceNode(node.right, cbNode, result);
break;
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
result = reduceNode(node.condition, cbNode, result);
result = reduceNode(node.whenTrue, cbNode, result);
result = reduceNode(node.whenFalse, cbNode, result);
break;
- case 206 /* TemplateExpression */:
+ case 207 /* TemplateExpression */:
result = reduceNode(node.head, cbNode, result);
result = reduceNodes(node.templateSpans, cbNodes, result);
break;
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNodes(node.typeParameters, cbNodes, result);
result = reduceNodes(node.heritageClauses, cbNodes, result);
result = reduceNodes(node.members, cbNodes, result);
break;
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNodes(node.typeArguments, cbNodes, result);
break;
- case 212 /* AsExpression */:
+ case 213 /* AsExpression */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.type, cbNode, result);
break;
// Misc
- case 216 /* TemplateSpan */:
+ case 217 /* TemplateSpan */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.literal, cbNode, result);
break;
// Element
- case 218 /* Block */:
+ case 219 /* Block */:
result = reduceNodes(node.statements, cbNodes, result);
break;
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.declarationList, cbNode, result);
break;
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
result = reduceNode(node.expression, cbNode, result);
break;
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.thenStatement, cbNode, result);
result = reduceNode(node.elseStatement, cbNode, result);
break;
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
result = reduceNode(node.statement, cbNode, result);
result = reduceNode(node.expression, cbNode, result);
break;
- case 224 /* WhileStatement */:
- case 231 /* WithStatement */:
+ case 225 /* WhileStatement */:
+ case 232 /* WithStatement */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.statement, cbNode, result);
break;
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
result = reduceNode(node.initializer, cbNode, result);
result = reduceNode(node.condition, cbNode, result);
result = reduceNode(node.incrementor, cbNode, result);
result = reduceNode(node.statement, cbNode, result);
break;
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
result = reduceNode(node.initializer, cbNode, result);
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.statement, cbNode, result);
break;
- case 230 /* ReturnStatement */:
- case 234 /* ThrowStatement */:
+ case 231 /* ReturnStatement */:
+ case 235 /* ThrowStatement */:
result = reduceNode(node.expression, cbNode, result);
break;
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
result = reduceNode(node.expression, cbNode, result);
result = reduceNode(node.caseBlock, cbNode, result);
break;
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
result = reduceNode(node.label, cbNode, result);
result = reduceNode(node.statement, cbNode, result);
break;
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
result = reduceNode(node.tryBlock, cbNode, result);
result = reduceNode(node.catchClause, cbNode, result);
result = reduceNode(node.finallyBlock, cbNode, result);
break;
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
result = reduceNodes(node.declarations, cbNodes, result);
break;
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
@@ -65595,7 +66480,7 @@
result = reduceNode(node.type, cbNode, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
@@ -65603,140 +66488,140 @@
result = reduceNodes(node.heritageClauses, cbNodes, result);
result = reduceNodes(node.members, cbNodes, result);
break;
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNodes(node.members, cbNodes, result);
break;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.body, cbNode, result);
break;
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
result = reduceNodes(node.statements, cbNodes, result);
break;
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
result = reduceNodes(node.clauses, cbNodes, result);
break;
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.moduleReference, cbNode, result);
break;
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
result = reduceNodes(node.decorators, cbNodes, result);
result = reduceNodes(node.modifiers, cbNodes, result);
result = reduceNode(node.importClause, cbNode, result);
result = reduceNode(node.moduleSpecifier, cbNode, result);
break;
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.namedBindings, cbNode, result);
break;
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
result = reduceNode(node.name, cbNode, result);
break;
- case 252 /* NamedImports */:
- case 256 /* NamedExports */:
+ case 253 /* NamedImports */:
+ case 257 /* NamedExports */:
result = reduceNodes(node.elements, cbNodes, result);
break;
- case 253 /* ImportSpecifier */:
- case 257 /* ExportSpecifier */:
+ case 254 /* ImportSpecifier */:
+ case 258 /* ExportSpecifier */:
result = reduceNode(node.propertyName, cbNode, result);
result = reduceNode(node.name, cbNode, result);
break;
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
result = ts.reduceLeft(node.decorators, cbNode, result);
result = ts.reduceLeft(node.modifiers, cbNode, result);
result = reduceNode(node.expression, cbNode, result);
break;
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
result = ts.reduceLeft(node.decorators, cbNode, result);
result = ts.reduceLeft(node.modifiers, cbNode, result);
result = reduceNode(node.exportClause, cbNode, result);
result = reduceNode(node.moduleSpecifier, cbNode, result);
break;
// Module references
- case 259 /* ExternalModuleReference */:
+ case 260 /* ExternalModuleReference */:
result = reduceNode(node.expression, cbNode, result);
break;
// JSX
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
result = reduceNode(node.openingElement, cbNode, result);
result = ts.reduceLeft(node.children, cbNode, result);
result = reduceNode(node.closingElement, cbNode, result);
break;
- case 264 /* JsxFragment */:
+ case 265 /* JsxFragment */:
result = reduceNode(node.openingFragment, cbNode, result);
result = ts.reduceLeft(node.children, cbNode, result);
result = reduceNode(node.closingFragment, cbNode, result);
break;
- case 261 /* JsxSelfClosingElement */:
- case 262 /* JsxOpeningElement */:
+ case 262 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
result = reduceNode(node.tagName, cbNode, result);
result = reduceNodes(node.typeArguments, cbNode, result);
result = reduceNode(node.attributes, cbNode, result);
break;
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
result = reduceNodes(node.properties, cbNodes, result);
break;
- case 263 /* JsxClosingElement */:
+ case 264 /* JsxClosingElement */:
result = reduceNode(node.tagName, cbNode, result);
break;
- case 267 /* JsxAttribute */:
+ case 268 /* JsxAttribute */:
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
- case 269 /* JsxSpreadAttribute */:
+ case 270 /* JsxSpreadAttribute */:
result = reduceNode(node.expression, cbNode, result);
break;
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
result = reduceNode(node.expression, cbNode, result);
break;
// Clauses
- case 271 /* CaseClause */:
+ case 272 /* CaseClause */:
result = reduceNode(node.expression, cbNode, result);
// falls through
- case 272 /* DefaultClause */:
+ case 273 /* DefaultClause */:
result = reduceNodes(node.statements, cbNodes, result);
break;
- case 273 /* HeritageClause */:
+ case 274 /* HeritageClause */:
result = reduceNodes(node.types, cbNodes, result);
break;
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
result = reduceNode(node.variableDeclaration, cbNode, result);
result = reduceNode(node.block, cbNode, result);
break;
// Property assignments
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.objectAssignmentInitializer, cbNode, result);
break;
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
result = reduceNode(node.expression, cbNode, result);
break;
// Enum
- case 278 /* EnumMember */:
+ case 279 /* EnumMember */:
result = reduceNode(node.name, cbNode, result);
result = reduceNode(node.initializer, cbNode, result);
break;
// Top-level nodes
- case 284 /* SourceFile */:
+ case 285 /* SourceFile */:
result = reduceNodes(node.statements, cbNodes, result);
break;
// Transformation nodes
- case 313 /* PartiallyEmittedExpression */:
+ case 314 /* PartiallyEmittedExpression */:
result = reduceNode(node.expression, cbNode, result);
break;
- case 314 /* CommaListExpression */:
+ case 315 /* CommaListExpression */:
result = reduceNodes(node.elements, cbNodes, result);
break;
default:
@@ -65760,7 +66645,7 @@
* @param nodes The NodeArray.
*/
function liftToBlock(nodes) {
- Debug.assert(ts.every(nodes, ts.isStatement), "Cannot lift nodes to a Block.");
+ ts.Debug.assert(ts.every(nodes, ts.isStatement), "Cannot lift nodes to a Block.");
return ts.singleOrUndefined(nodes) || ts.createBlock(nodes);
}
ts.liftToBlock = liftToBlock;
@@ -65809,7 +66694,7 @@
function aggregateTransformFlagsForSubtree(node) {
// We do not transform ambient declarations or types, so there is no need to
// recursively aggregate transform flags.
- if (ts.hasModifier(node, 2 /* Ambient */) || (ts.isTypeNode(node) && node.kind !== 211 /* ExpressionWithTypeArguments */)) {
+ if (ts.hasModifier(node, 2 /* Ambient */) || (ts.isTypeNode(node) && node.kind !== 212 /* ExpressionWithTypeArguments */)) {
return 0 /* None */;
}
// Aggregate the transform flags of each child.
@@ -65825,73 +66710,6 @@
function aggregateTransformFlagsForChildNodes(transformFlags, nodes) {
return transformFlags | aggregateTransformFlagsForNodeArray(nodes);
}
- var Debug;
- (function (Debug) {
- var isDebugInfoEnabled = false;
- function failBadSyntaxKind(node, message) {
- return Debug.fail((message || "Unexpected node.") + "\r\nNode " + ts.formatSyntaxKind(node.kind) + " was unexpected.", failBadSyntaxKind);
- }
- Debug.failBadSyntaxKind = failBadSyntaxKind;
- Debug.assertEachNode = Debug.shouldAssert(1 /* Normal */)
- ? function (nodes, test, message) { return Debug.assert(test === undefined || ts.every(nodes, test), message || "Unexpected node.", function () { return "Node array did not pass test '" + Debug.getFunctionName(test) + "'."; }, Debug.assertEachNode); }
- : ts.noop;
- Debug.assertNode = Debug.shouldAssert(1 /* Normal */)
- ? function (node, test, message) { return Debug.assert(test === undefined || test(node), message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " did not pass test '" + Debug.getFunctionName(test) + "'."; }, Debug.assertNode); }
- : ts.noop;
- Debug.assertOptionalNode = Debug.shouldAssert(1 /* Normal */)
- ? function (node, test, message) { return Debug.assert(test === undefined || node === undefined || test(node), message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " did not pass test '" + Debug.getFunctionName(test) + "'."; }, Debug.assertOptionalNode); }
- : ts.noop;
- Debug.assertOptionalToken = Debug.shouldAssert(1 /* Normal */)
- ? function (node, kind, message) { return Debug.assert(kind === undefined || node === undefined || node.kind === kind, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was not a '" + ts.formatSyntaxKind(kind) + "' token."; }, Debug.assertOptionalToken); }
- : ts.noop;
- Debug.assertMissingNode = Debug.shouldAssert(1 /* Normal */)
- ? function (node, message) { return Debug.assert(node === undefined, message || "Unexpected node.", function () { return "Node " + ts.formatSyntaxKind(node.kind) + " was unexpected'."; }, Debug.assertMissingNode); }
- : ts.noop;
- /**
- * Injects debug information into frequently used types.
- */
- function enableDebugInfo() {
- if (isDebugInfoEnabled)
- return;
- // Add additional properties in debug mode to assist with debugging.
- Object.defineProperties(ts.objectAllocator.getSymbolConstructor().prototype, {
- __debugFlags: { get: function () { return ts.formatSymbolFlags(this.flags); } }
- });
- Object.defineProperties(ts.objectAllocator.getTypeConstructor().prototype, {
- __debugFlags: { get: function () { return ts.formatTypeFlags(this.flags); } },
- __debugObjectFlags: { get: function () { return this.flags & 524288 /* Object */ ? ts.formatObjectFlags(this.objectFlags) : ""; } },
- __debugTypeToString: { value: function () { return this.checker.typeToString(this); } },
- });
- var nodeConstructors = [
- ts.objectAllocator.getNodeConstructor(),
- ts.objectAllocator.getIdentifierConstructor(),
- ts.objectAllocator.getTokenConstructor(),
- ts.objectAllocator.getSourceFileConstructor()
- ];
- for (var _i = 0, nodeConstructors_1 = nodeConstructors; _i < nodeConstructors_1.length; _i++) {
- var ctor = nodeConstructors_1[_i];
- if (!ctor.prototype.hasOwnProperty("__debugKind")) {
- Object.defineProperties(ctor.prototype, {
- __debugKind: { get: function () { return ts.formatSyntaxKind(this.kind); } },
- __debugModifierFlags: { get: function () { return ts.formatModifierFlags(ts.getModifierFlagsNoCache(this)); } },
- __debugTransformFlags: { get: function () { return ts.formatTransformFlags(this.transformFlags); } },
- __debugEmitFlags: { get: function () { return ts.formatEmitFlags(ts.getEmitFlags(this)); } },
- __debugGetText: {
- value: function (includeTrivia) {
- if (ts.nodeIsSynthesized(this))
- return "";
- var parseNode = ts.getParseTreeNode(this);
- var sourceFile = parseNode && ts.getSourceFileOfNode(parseNode);
- return sourceFile ? ts.getSourceTextOfNodeFromSourceFile(sourceFile, parseNode, includeTrivia) : "";
- }
- }
- });
- }
- }
- isDebugInfoEnabled = true;
- }
- Debug.enableDebugInfo = enableDebugInfo;
- })(Debug = ts.Debug || (ts.Debug = {}));
})(ts || (ts = {}));
/* @internal */
var ts;
@@ -66549,7 +67367,7 @@
function chainBundle(transformSourceFile) {
return transformSourceFileOrBundle;
function transformSourceFileOrBundle(node) {
- return node.kind === 284 /* SourceFile */ ? transformSourceFile(node) : transformBundle(node);
+ return node.kind === 285 /* SourceFile */ ? transformSourceFile(node) : transformBundle(node);
}
function transformBundle(node) {
return ts.createBundle(ts.map(node.sourceFiles, transformSourceFile), node.prepends);
@@ -66595,7 +67413,7 @@
for (var _i = 0, _a = sourceFile.statements; _i < _a.length; _i++) {
var node = _a[_i];
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
// import "mod"
// import x from "mod"
// import * as x from "mod"
@@ -66603,13 +67421,13 @@
externalImports.push(node);
hasImportStarOrImportDefault = hasImportStarOrImportDefault || getImportNeedsImportStarHelper(node) || getImportNeedsImportDefaultHelper(node);
break;
- case 248 /* ImportEqualsDeclaration */:
- if (node.moduleReference.kind === 259 /* ExternalModuleReference */) {
+ case 249 /* ImportEqualsDeclaration */:
+ if (node.moduleReference.kind === 260 /* ExternalModuleReference */) {
// import x = require("mod")
externalImports.push(node);
}
break;
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
if (node.moduleSpecifier) {
if (!node.exportClause) {
// export * from "mod"
@@ -66639,13 +67457,13 @@
}
}
break;
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
if (node.isExportEquals && !exportEquals) {
// export = x
exportEquals = node;
}
break;
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
if (ts.hasModifier(node, 1 /* Export */)) {
for (var _d = 0, _e = node.declarationList.declarations; _d < _e.length; _d++) {
var decl = _e[_d];
@@ -66653,7 +67471,7 @@
}
}
break;
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
if (ts.hasModifier(node, 1 /* Export */)) {
if (ts.hasModifier(node, 512 /* Default */)) {
// export default function() { }
@@ -66673,7 +67491,7 @@
}
}
break;
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
if (ts.hasModifier(node, 1 /* Export */)) {
if (ts.hasModifier(node, 512 /* Default */)) {
// export default class { }
@@ -67213,7 +68031,7 @@
ts.restHelper = {
name: "typescript:rest",
scoped: false,
- text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)\n t[p[i]] = s[p[i]];\n return t;\n };"
+ text: "\n var __rest = (this && this.__rest) || function (s, e) {\n var t = {};\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\n t[p] = s[p];\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\n t[p[i]] = s[p[i]];\n }\n return t;\n };"
};
/** Given value: o, propName: p, pattern: { a, b, ...p } from the original statement
* `{ a, b, ...p } = o`, create `p = __rest(o, ["a", "b"]);`
@@ -67289,8 +68107,8 @@
context.onEmitNode = onEmitNode;
context.onSubstituteNode = onSubstituteNode;
// Enable substitution for property/element access to emit const enum values.
- context.enableSubstitution(189 /* PropertyAccessExpression */);
- context.enableSubstitution(190 /* ElementAccessExpression */);
+ context.enableSubstitution(190 /* PropertyAccessExpression */);
+ context.enableSubstitution(191 /* ElementAccessExpression */);
// These variables contain state that changes as we descend into the tree.
var currentSourceFile;
var currentNamespace;
@@ -67320,14 +68138,14 @@
var pendingExpressions;
return transformSourceFileOrBundle;
function transformSourceFileOrBundle(node) {
- if (node.kind === 285 /* Bundle */) {
+ if (node.kind === 286 /* Bundle */) {
return transformBundle(node);
}
return transformSourceFile(node);
}
function transformBundle(node) {
return ts.createBundle(node.sourceFiles.map(transformSourceFile), ts.mapDefined(node.prepends, function (prepend) {
- if (prepend.kind === 287 /* InputFiles */) {
+ if (prepend.kind === 288 /* InputFiles */) {
return ts.createUnparsedSourceFile(prepend, "js");
}
return prepend;
@@ -67376,16 +68194,16 @@
*/
function onBeforeVisitNode(node) {
switch (node.kind) {
- case 284 /* SourceFile */:
- case 246 /* CaseBlock */:
- case 245 /* ModuleBlock */:
- case 218 /* Block */:
+ case 285 /* SourceFile */:
+ case 247 /* CaseBlock */:
+ case 246 /* ModuleBlock */:
+ case 219 /* Block */:
currentLexicalScope = node;
currentNameScope = undefined;
currentScopeFirstDeclarationsOfName = undefined;
break;
- case 240 /* ClassDeclaration */:
- case 239 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 240 /* FunctionDeclaration */:
if (ts.hasModifier(node, 2 /* Ambient */)) {
break;
}
@@ -67397,7 +68215,7 @@
// These nodes should always have names unless they are default-exports;
// however, class declaration parsing allows for undefined names, so syntactically invalid
// programs may also have an undefined name.
- ts.Debug.assert(node.kind === 240 /* ClassDeclaration */ || ts.hasModifier(node, 512 /* Default */));
+ ts.Debug.assert(node.kind === 241 /* ClassDeclaration */ || ts.hasModifier(node, 512 /* Default */));
}
if (ts.isClassDeclaration(node)) {
// XXX: should probably also cover interfaces and type aliases that can have type variables?
@@ -67440,10 +68258,10 @@
*/
function sourceElementVisitorWorker(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
- case 254 /* ExportAssignment */:
- case 255 /* ExportDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 255 /* ExportAssignment */:
+ case 256 /* ExportDeclaration */:
return visitEllidableStatement(node);
default:
return visitorWorker(node);
@@ -67464,13 +68282,13 @@
return node;
}
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return visitImportDeclaration(node);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return visitImportEqualsDeclaration(node);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return visitExportAssignment(node);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return visitExportDeclaration(node);
default:
ts.Debug.fail("Unhandled ellided statement");
@@ -67490,11 +68308,11 @@
* @param node The node to visit.
*/
function namespaceElementVisitorWorker(node) {
- if (node.kind === 255 /* ExportDeclaration */ ||
- node.kind === 249 /* ImportDeclaration */ ||
- node.kind === 250 /* ImportClause */ ||
- (node.kind === 248 /* ImportEqualsDeclaration */ &&
- node.moduleReference.kind === 259 /* ExternalModuleReference */)) {
+ if (node.kind === 256 /* ExportDeclaration */ ||
+ node.kind === 250 /* ImportDeclaration */ ||
+ node.kind === 251 /* ImportClause */ ||
+ (node.kind === 249 /* ImportEqualsDeclaration */ &&
+ node.moduleReference.kind === 260 /* ExternalModuleReference */)) {
// do not emit ES6 imports and exports since they are illegal inside a namespace
return undefined;
}
@@ -67518,19 +68336,19 @@
*/
function classElementVisitorWorker(node) {
switch (node.kind) {
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
// TypeScript constructors are transformed in `visitClassDeclaration`.
// We elide them here as `visitorWorker` checks transform flags, which could
// erronously include an ES6 constructor without TypeScript syntax.
return undefined;
- case 154 /* PropertyDeclaration */:
- case 162 /* IndexSignature */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 156 /* MethodDeclaration */:
+ case 155 /* PropertyDeclaration */:
+ case 163 /* IndexSignature */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
// Fallback to the default visit behavior.
return visitorWorker(node);
- case 217 /* SemicolonClassElement */:
+ case 218 /* SemicolonClassElement */:
return node;
default:
return ts.Debug.failBadSyntaxKind(node);
@@ -67540,7 +68358,7 @@
if (ts.modifierToFlag(node.kind) & 2270 /* TypeScriptModifier */) {
return undefined;
}
- else if (currentNamespace && node.kind === 85 /* ExportKeyword */) {
+ else if (currentNamespace && node.kind === 86 /* ExportKeyword */) {
return undefined;
}
return node;
@@ -67557,67 +68375,67 @@
return ts.createNotEmittedStatement(node);
}
switch (node.kind) {
- case 85 /* ExportKeyword */:
- case 80 /* DefaultKeyword */:
+ case 86 /* ExportKeyword */:
+ case 81 /* DefaultKeyword */:
// ES6 export and default modifiers are elided when inside a namespace.
return currentNamespace ? undefined : node;
- case 115 /* PublicKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 118 /* AbstractKeyword */:
- case 77 /* ConstKeyword */:
- case 125 /* DeclareKeyword */:
- case 133 /* ReadonlyKeyword */:
+ case 116 /* PublicKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 119 /* AbstractKeyword */:
+ case 78 /* ConstKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 134 /* ReadonlyKeyword */:
// TypeScript accessibility and readonly modifiers are elided.
- case 169 /* ArrayType */:
- case 170 /* TupleType */:
- case 171 /* OptionalType */:
- case 172 /* RestType */:
- case 168 /* TypeLiteral */:
- case 163 /* TypePredicate */:
- case 150 /* TypeParameter */:
- case 120 /* AnyKeyword */:
- case 143 /* UnknownKeyword */:
- case 123 /* BooleanKeyword */:
- case 138 /* StringKeyword */:
- case 135 /* NumberKeyword */:
- case 132 /* NeverKeyword */:
- case 106 /* VoidKeyword */:
- case 139 /* SymbolKeyword */:
- case 166 /* ConstructorType */:
- case 165 /* FunctionType */:
- case 167 /* TypeQuery */:
- case 164 /* TypeReference */:
- case 173 /* UnionType */:
- case 174 /* IntersectionType */:
- case 175 /* ConditionalType */:
- case 177 /* ParenthesizedType */:
- case 178 /* ThisType */:
- case 179 /* TypeOperator */:
- case 180 /* IndexedAccessType */:
- case 181 /* MappedType */:
- case 182 /* LiteralType */:
+ case 170 /* ArrayType */:
+ case 171 /* TupleType */:
+ case 172 /* OptionalType */:
+ case 173 /* RestType */:
+ case 169 /* TypeLiteral */:
+ case 164 /* TypePredicate */:
+ case 151 /* TypeParameter */:
+ case 121 /* AnyKeyword */:
+ case 144 /* UnknownKeyword */:
+ case 124 /* BooleanKeyword */:
+ case 139 /* StringKeyword */:
+ case 136 /* NumberKeyword */:
+ case 133 /* NeverKeyword */:
+ case 107 /* VoidKeyword */:
+ case 140 /* SymbolKeyword */:
+ case 167 /* ConstructorType */:
+ case 166 /* FunctionType */:
+ case 168 /* TypeQuery */:
+ case 165 /* TypeReference */:
+ case 174 /* UnionType */:
+ case 175 /* IntersectionType */:
+ case 176 /* ConditionalType */:
+ case 178 /* ParenthesizedType */:
+ case 179 /* ThisType */:
+ case 180 /* TypeOperator */:
+ case 181 /* IndexedAccessType */:
+ case 182 /* MappedType */:
+ case 183 /* LiteralType */:
// TypeScript type nodes are elided.
- case 162 /* IndexSignature */:
+ case 163 /* IndexSignature */:
// TypeScript index signatures are elided.
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
// TypeScript decorators are elided. They will be emitted as part of visitClassDeclaration.
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
// TypeScript type-only declarations are elided.
return undefined;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
// TypeScript property declarations are elided. However their names are still visited, and can potentially be retained if they could have sideeffects
return visitPropertyDeclaration(node);
- case 247 /* NamespaceExportDeclaration */:
+ case 248 /* NamespaceExportDeclaration */:
// TypeScript namespace export declarations are elided.
return undefined;
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return visitConstructor(node);
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
// TypeScript interfaces are elided, but some comments may be preserved.
// See the implementation of `getLeadingComments` in comments.ts for more details.
return ts.createNotEmittedStatement(node);
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
// This may be a class declaration with TypeScript syntax extensions.
//
// TypeScript class syntax extensions include:
@@ -67628,7 +68446,7 @@
// - index signatures
// - method overload signatures
return visitClassDeclaration(node);
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
// This may be a class expression with TypeScript syntax extensions.
//
// TypeScript class syntax extensions include:
@@ -67639,35 +68457,35 @@
// - index signatures
// - method overload signatures
return visitClassExpression(node);
- case 273 /* HeritageClause */:
+ case 274 /* HeritageClause */:
// This may be a heritage clause with TypeScript syntax extensions.
//
// TypeScript heritage clause extensions include:
// - `implements` clause
return visitHeritageClause(node);
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
// TypeScript supports type arguments on an expression in an `extends` heritage clause.
return visitExpressionWithTypeArguments(node);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
// TypeScript method declarations may have decorators, modifiers
// or type annotations.
return visitMethodDeclaration(node);
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
// Get Accessors can have TypeScript modifiers, decorators, and type annotations.
return visitGetAccessor(node);
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
// Set Accessors can have TypeScript modifiers and type annotations.
return visitSetAccessor(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
// Typescript function declarations can have modifiers, decorators, and type annotations.
return visitFunctionDeclaration(node);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
// TypeScript function expressions can have modifiers and type annotations.
return visitFunctionExpression(node);
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
// TypeScript arrow functions can have modifiers and type annotations.
return visitArrowFunction(node);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
// This may be a parameter declaration with TypeScript syntax extensions.
//
// TypeScript parameter declaration syntax extensions include:
@@ -67677,35 +68495,35 @@
// - type annotations
// - this parameters
return visitParameter(node);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
// ParenthesizedExpressions are TypeScript if their expression is a
// TypeAssertion or AsExpression
return visitParenthesizedExpression(node);
- case 194 /* TypeAssertionExpression */:
- case 212 /* AsExpression */:
+ case 195 /* TypeAssertionExpression */:
+ case 213 /* AsExpression */:
// TypeScript type assertions are removed, but their subtrees are preserved.
return visitAssertionExpression(node);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return visitCallExpression(node);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return visitNewExpression(node);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return visitTaggedTemplateExpression(node);
- case 213 /* NonNullExpression */:
+ case 214 /* NonNullExpression */:
// TypeScript non-null expressions are removed, but their subtrees are preserved.
return visitNonNullExpression(node);
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
// TypeScript enum declarations do not exist in ES6 and must be rewritten.
return visitEnumDeclaration(node);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
// TypeScript namespace exports for variable statements must be transformed.
return visitVariableStatement(node);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return visitVariableDeclaration(node);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
// TypeScript namespace declarations must be transformed.
return visitModuleDeclaration(node);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
// TypeScript namespace or external module import.
return visitImportEqualsDeclaration(node);
default:
@@ -67743,7 +68561,7 @@
if (ts.some(staticProperties))
facts |= 1 /* HasStaticInitializedProperties */;
var extendsClauseElement = ts.getEffectiveBaseTypeNode(node);
- if (extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 96 /* NullKeyword */)
+ if (extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 97 /* NullKeyword */)
facts |= 64 /* IsDerivedClass */;
if (shouldEmitDecorateCallForClass(node))
facts |= 2 /* HasConstructorDecorators */;
@@ -68009,7 +68827,7 @@
pendingExpressions = undefined;
var staticProperties = getInitializedProperties(node, /*isStatic*/ true);
var heritageClauses = ts.visitNodes(node.heritageClauses, visitor, ts.isHeritageClause);
- var members = transformClassMembers(node, ts.some(heritageClauses, function (c) { return c.token === 86 /* ExtendsKeyword */; }));
+ var members = transformClassMembers(node, ts.some(heritageClauses, function (c) { return c.token === 87 /* ExtendsKeyword */; }));
var classExpression = ts.createClassExpression(
/*modifiers*/ undefined, node.name,
/*typeParameters*/ undefined, heritageClauses, members);
@@ -68185,7 +69003,7 @@
return index;
}
var statement = statements[index];
- if (statement.kind === 221 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) {
+ if (statement.kind === 222 /* ExpressionStatement */ && ts.isSuperCall(statement.expression)) {
result.push(ts.visitNode(statement, visitor, ts.isStatement));
return index + 1;
}
@@ -68256,7 +69074,7 @@
* @param isStatic A value indicating whether the member should be a static or instance member.
*/
function isInitializedProperty(member, isStatic) {
- return member.kind === 154 /* PropertyDeclaration */
+ return member.kind === 155 /* PropertyDeclaration */
&& isStatic === ts.hasModifier(member, 32 /* Static */)
&& member.initializer !== undefined;
}
@@ -68267,8 +69085,8 @@
* @param receiver The receiver on which each property should be assigned.
*/
function addInitializedPropertyStatements(statements, properties, receiver) {
- for (var _i = 0, properties_8 = properties; _i < properties_8.length; _i++) {
- var property = properties_8[_i];
+ for (var _i = 0, properties_6 = properties; _i < properties_6.length; _i++) {
+ var property = properties_6[_i];
var statement = ts.createExpressionStatement(transformInitializedProperty(property, receiver));
ts.setSourceMapRange(statement, ts.moveRangePastModifiers(property));
ts.setCommentRange(statement, property);
@@ -68284,8 +69102,8 @@
*/
function generateInitializedPropertyExpressions(properties, receiver) {
var expressions = [];
- for (var _i = 0, properties_9 = properties; _i < properties_9.length; _i++) {
- var property = properties_9[_i];
+ for (var _i = 0, properties_7 = properties; _i < properties_7.length; _i++) {
+ var property = properties_7[_i];
var expression = transformInitializedProperty(property, receiver);
ts.startOnNewLine(expression);
ts.setSourceMapRange(expression, ts.moveRangePastModifiers(property));
@@ -68399,12 +69217,12 @@
*/
function getAllDecoratorsOfClassElement(node, member) {
switch (member.kind) {
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return getAllDecoratorsOfAccessors(node, member);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return getAllDecoratorsOfMethod(member);
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return getAllDecoratorsOfProperty(member);
default:
return undefined;
@@ -68557,7 +69375,7 @@
var prefix = getClassMemberPrefix(node, member);
var memberName = getExpressionForPropertyName(member, /*generateNameForComputedPropertyName*/ true);
var descriptor = languageVersion > 0 /* ES3 */
- ? member.kind === 154 /* PropertyDeclaration */
+ ? member.kind === 155 /* PropertyDeclaration */
// We emit `void 0` here to indicate to `__decorate` that it can invoke `Object.defineProperty` directly, but that it
// should not invoke `Object.getOwnPropertyDescriptor`.
? ts.createVoidZero()
@@ -68680,10 +69498,10 @@
*/
function shouldAddTypeMetadata(node) {
var kind = node.kind;
- return kind === 156 /* MethodDeclaration */
- || kind === 158 /* GetAccessor */
- || kind === 159 /* SetAccessor */
- || kind === 154 /* PropertyDeclaration */;
+ return kind === 157 /* MethodDeclaration */
+ || kind === 159 /* GetAccessor */
+ || kind === 160 /* SetAccessor */
+ || kind === 155 /* PropertyDeclaration */;
}
/**
* Determines whether to emit the "design:returntype" metadata based on the node's kind.
@@ -68693,7 +69511,7 @@
* @param node The node to test.
*/
function shouldAddReturnTypeMetadata(node) {
- return node.kind === 156 /* MethodDeclaration */;
+ return node.kind === 157 /* MethodDeclaration */;
}
/**
* Determines whether to emit the "design:paramtypes" metadata based on the node's kind.
@@ -68704,12 +69522,12 @@
*/
function shouldAddParamTypesMetadata(node) {
switch (node.kind) {
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
return ts.getFirstConstructorWithBody(node) !== undefined;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return true;
}
return false;
@@ -68726,15 +69544,15 @@
*/
function serializeTypeOfNode(node) {
switch (node.kind) {
- case 154 /* PropertyDeclaration */:
- case 151 /* Parameter */:
+ case 155 /* PropertyDeclaration */:
+ case 152 /* Parameter */:
return serializeTypeNode(node.type);
- case 159 /* SetAccessor */:
- case 158 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 159 /* GetAccessor */:
return serializeTypeNode(getAccessorTypeNode(node));
- case 240 /* ClassDeclaration */:
- case 209 /* ClassExpression */:
- case 156 /* MethodDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 210 /* ClassExpression */:
+ case 157 /* MethodDeclaration */:
return ts.createIdentifier("Function");
default:
return ts.createVoidZero();
@@ -68771,7 +69589,7 @@
return ts.createArrayLiteral(expressions);
}
function getParametersOfDecoratedDeclaration(node, container) {
- if (container && node.kind === 158 /* GetAccessor */) {
+ if (container && node.kind === 159 /* GetAccessor */) {
var setAccessor = ts.getAllAccessorDeclarations(container.members, node).setAccessor;
if (setAccessor) {
return setAccessor.parameters;
@@ -68816,69 +69634,69 @@
return ts.createIdentifier("Object");
}
switch (node.kind) {
- case 106 /* VoidKeyword */:
- case 141 /* UndefinedKeyword */:
- case 96 /* NullKeyword */:
- case 132 /* NeverKeyword */:
+ case 107 /* VoidKeyword */:
+ case 142 /* UndefinedKeyword */:
+ case 97 /* NullKeyword */:
+ case 133 /* NeverKeyword */:
return ts.createVoidZero();
- case 177 /* ParenthesizedType */:
+ case 178 /* ParenthesizedType */:
return serializeTypeNode(node.type);
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
return ts.createIdentifier("Function");
- case 169 /* ArrayType */:
- case 170 /* TupleType */:
+ case 170 /* ArrayType */:
+ case 171 /* TupleType */:
return ts.createIdentifier("Array");
- case 163 /* TypePredicate */:
- case 123 /* BooleanKeyword */:
+ case 164 /* TypePredicate */:
+ case 124 /* BooleanKeyword */:
return ts.createIdentifier("Boolean");
- case 138 /* StringKeyword */:
+ case 139 /* StringKeyword */:
return ts.createIdentifier("String");
- case 136 /* ObjectKeyword */:
+ case 137 /* ObjectKeyword */:
return ts.createIdentifier("Object");
- case 182 /* LiteralType */:
+ case 183 /* LiteralType */:
switch (node.literal.kind) {
case 10 /* StringLiteral */:
return ts.createIdentifier("String");
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
case 8 /* NumericLiteral */:
return ts.createIdentifier("Number");
case 9 /* BigIntLiteral */:
return getGlobalBigIntNameWithFallback();
- case 102 /* TrueKeyword */:
- case 87 /* FalseKeyword */:
+ case 103 /* TrueKeyword */:
+ case 88 /* FalseKeyword */:
return ts.createIdentifier("Boolean");
default:
return ts.Debug.failBadSyntaxKind(node.literal);
}
- case 135 /* NumberKeyword */:
+ case 136 /* NumberKeyword */:
return ts.createIdentifier("Number");
- case 146 /* BigIntKeyword */:
+ case 147 /* BigIntKeyword */:
return getGlobalBigIntNameWithFallback();
- case 139 /* SymbolKeyword */:
+ case 140 /* SymbolKeyword */:
return languageVersion < 2 /* ES2015 */
? getGlobalSymbolNameWithFallback()
: ts.createIdentifier("Symbol");
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return serializeTypeReferenceNode(node);
- case 174 /* IntersectionType */:
- case 173 /* UnionType */:
+ case 175 /* IntersectionType */:
+ case 174 /* UnionType */:
return serializeTypeList(node.types);
- case 175 /* ConditionalType */:
+ case 176 /* ConditionalType */:
return serializeTypeList([node.trueType, node.falseType]);
- case 179 /* TypeOperator */:
- if (node.operator === 133 /* ReadonlyKeyword */) {
+ case 180 /* TypeOperator */:
+ if (node.operator === 134 /* ReadonlyKeyword */) {
return serializeTypeNode(node.type);
}
break;
- case 167 /* TypeQuery */:
- case 180 /* IndexedAccessType */:
- case 181 /* MappedType */:
- case 168 /* TypeLiteral */:
- case 120 /* AnyKeyword */:
- case 143 /* UnknownKeyword */:
- case 178 /* ThisType */:
- case 183 /* ImportType */:
+ case 168 /* TypeQuery */:
+ case 181 /* IndexedAccessType */:
+ case 182 /* MappedType */:
+ case 169 /* TypeLiteral */:
+ case 121 /* AnyKeyword */:
+ case 144 /* UnknownKeyword */:
+ case 179 /* ThisType */:
+ case 184 /* ImportType */:
break;
default:
return ts.Debug.failBadSyntaxKind(node);
@@ -68889,15 +69707,15 @@
// Note when updating logic here also update getEntityNameForDecoratorMetadata
// so that aliases can be marked as referenced
var serializedUnion;
- for (var _i = 0, types_18 = types; _i < types_18.length; _i++) {
- var typeNode = types_18[_i];
- while (typeNode.kind === 177 /* ParenthesizedType */) {
+ for (var _i = 0, types_17 = types; _i < types_17.length; _i++) {
+ var typeNode = types_17[_i];
+ while (typeNode.kind === 178 /* ParenthesizedType */) {
typeNode = typeNode.type; // Skip parens if need be
}
- if (typeNode.kind === 132 /* NeverKeyword */) {
+ if (typeNode.kind === 133 /* NeverKeyword */) {
continue; // Always elide `never` from the union/intersection if possible
}
- if (!strictNullChecks && (typeNode.kind === 96 /* NullKeyword */ || typeNode.kind === 141 /* UndefinedKeyword */)) {
+ if (!strictNullChecks && (typeNode.kind === 97 /* NullKeyword */ || typeNode.kind === 142 /* UndefinedKeyword */)) {
continue; // Elide null and undefined from unions for metadata, just like what we did prior to the implementation of strict null checks
}
var serializedIndividual = serializeTypeNode(typeNode);
@@ -68977,12 +69795,12 @@
* @param node The entity name to serialize.
*/
function serializeEntityNameAsExpressionFallback(node) {
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
// A -> typeof A !== undefined && A
var copied = serializeEntityNameAsExpression(node);
return createCheckedValue(copied, copied);
}
- if (node.left.kind === 72 /* Identifier */) {
+ if (node.left.kind === 73 /* Identifier */) {
// A.B -> typeof A !== undefined && A.B
return createCheckedValue(serializeEntityNameAsExpression(node.left), serializeEntityNameAsExpression(node));
}
@@ -68998,7 +69816,7 @@
*/
function serializeEntityNameAsExpression(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
// Create a clone of the name with a new parent, and treat it as if it were
// a source tree node for the purposes of the checker.
var name = ts.getMutableClone(node);
@@ -69006,7 +69824,7 @@
name.original = undefined;
name.parent = ts.getParseTreeNode(currentLexicalScope); // ensure the parent is set to a parse tree node.
return name;
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
return serializeQualifiedNameAsExpression(node);
}
}
@@ -69032,7 +69850,7 @@
* available.
*/
function getGlobalBigIntNameWithFallback() {
- return languageVersion < 7 /* ESNext */
+ return languageVersion < 8 /* ESNext */
? ts.createConditional(ts.createTypeCheck(ts.createIdentifier("BigInt"), "function"), ts.createIdentifier("BigInt"), ts.createIdentifier("Object"))
: ts.createIdentifier("BigInt");
}
@@ -69116,7 +69934,7 @@
* @param node The HeritageClause to transform.
*/
function visitHeritageClause(node) {
- if (node.token === 109 /* ImplementsKeyword */) {
+ if (node.token === 110 /* ImplementsKeyword */) {
// implements clauses are elided
return undefined;
}
@@ -69355,7 +70173,7 @@
*/
function visitEnumDeclaration(node) {
if (!shouldEmitEnumDeclaration(node)) {
- return undefined;
+ return ts.createNotEmittedStatement(node);
}
var statements = [];
// We request to be advised when the printer is about to print this node. This allows
@@ -69523,12 +70341,12 @@
// enums in any other scope are emitted as a `let` declaration.
var statement = ts.createVariableStatement(ts.visitNodes(node.modifiers, modifierVisitor, ts.isModifier), ts.createVariableDeclarationList([
ts.createVariableDeclaration(ts.getLocalName(node, /*allowComments*/ false, /*allowSourceMaps*/ true))
- ], currentLexicalScope.kind === 284 /* SourceFile */ ? 0 /* None */ : 1 /* Let */));
+ ], currentLexicalScope.kind === 285 /* SourceFile */ ? 0 /* None */ : 1 /* Let */));
ts.setOriginalNode(statement, node);
recordEmittedDeclarationInScope(node);
if (isFirstEmittedDeclarationInScope(node)) {
// Adjust the source map emit to match the old emitter.
- if (node.kind === 243 /* EnumDeclaration */) {
+ if (node.kind === 244 /* EnumDeclaration */) {
ts.setSourceMapRange(statement.declarationList, node);
}
else {
@@ -69653,7 +70471,7 @@
var statementsLocation;
var blockLocation;
var body = node.body;
- if (body.kind === 245 /* ModuleBlock */) {
+ if (body.kind === 246 /* ModuleBlock */) {
saveStateAndInvoke(body, function (body) { return ts.addRange(statements, ts.visitNodes(body.statements, namespaceElementVisitor, ts.isStatement)); });
statementsLocation = body.statements;
blockLocation = body;
@@ -69699,13 +70517,13 @@
// })(hi = hello.hi || (hello.hi = {}));
// })(hello || (hello = {}));
// We only want to emit comment on the namespace which contains block body itself, not the containing namespaces.
- if (body.kind !== 245 /* ModuleBlock */) {
+ if (body.kind !== 246 /* ModuleBlock */) {
ts.setEmitFlags(block, ts.getEmitFlags(block) | 1536 /* NoComments */);
}
return block;
}
function getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration) {
- if (moduleDeclaration.body.kind === 244 /* ModuleDeclaration */) {
+ if (moduleDeclaration.body.kind === 245 /* ModuleDeclaration */) {
var recursiveInnerModule = getInnerMostModuleDeclarationFromDottedModule(moduleDeclaration.body);
return recursiveInnerModule || moduleDeclaration.body;
}
@@ -69746,7 +70564,7 @@
* @param node The named import bindings node.
*/
function visitNamedImportBindings(node) {
- if (node.kind === 251 /* NamespaceImport */) {
+ if (node.kind === 252 /* NamespaceImport */) {
// Elide a namespace import if it is not referenced.
return resolver.isReferencedAliasDeclaration(node) ? node : undefined;
}
@@ -69959,7 +70777,7 @@
function enableSubstitutionForNonQualifiedEnumMembers() {
if ((enabledSubstitutions & 8 /* NonQualifiedEnumMembers */) === 0) {
enabledSubstitutions |= 8 /* NonQualifiedEnumMembers */;
- context.enableSubstitution(72 /* Identifier */);
+ context.enableSubstitution(73 /* Identifier */);
}
}
function enableSubstitutionForClassAliases() {
@@ -69967,7 +70785,7 @@
enabledSubstitutions |= 1 /* ClassAliases */;
// We need to enable substitutions for identifiers. This allows us to
// substitute class names inside of a class declaration.
- context.enableSubstitution(72 /* Identifier */);
+ context.enableSubstitution(73 /* Identifier */);
// Keep track of class aliases.
classAliases = [];
}
@@ -69977,17 +70795,17 @@
enabledSubstitutions |= 2 /* NamespaceExports */;
// We need to enable substitutions for identifiers and shorthand property assignments. This allows us to
// substitute the names of exported members of a namespace.
- context.enableSubstitution(72 /* Identifier */);
- context.enableSubstitution(276 /* ShorthandPropertyAssignment */);
+ context.enableSubstitution(73 /* Identifier */);
+ context.enableSubstitution(277 /* ShorthandPropertyAssignment */);
// We need to be notified when entering and exiting namespaces.
- context.enableEmitNotification(244 /* ModuleDeclaration */);
+ context.enableEmitNotification(245 /* ModuleDeclaration */);
}
}
function isTransformedModuleDeclaration(node) {
- return ts.getOriginalNode(node).kind === 244 /* ModuleDeclaration */;
+ return ts.getOriginalNode(node).kind === 245 /* ModuleDeclaration */;
}
function isTransformedEnumDeclaration(node) {
- return ts.getOriginalNode(node).kind === 243 /* EnumDeclaration */;
+ return ts.getOriginalNode(node).kind === 244 /* EnumDeclaration */;
}
/**
* Hook for node emit.
@@ -70046,11 +70864,11 @@
}
function substituteExpression(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return substituteExpressionIdentifier(node);
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return substitutePropertyAccessExpression(node);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return substituteElementAccessExpression(node);
}
return node;
@@ -70088,9 +70906,9 @@
// If we are nested within a namespace declaration, we may need to qualifiy
// an identifier that is exported from a merged namespace.
var container = resolver.getReferencedExportContainer(node, /*prefixLocals*/ false);
- if (container && container.kind !== 284 /* SourceFile */) {
- var substitute = (applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 244 /* ModuleDeclaration */) ||
- (applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 243 /* EnumDeclaration */);
+ if (container && container.kind !== 285 /* SourceFile */) {
+ var substitute = (applicableSubstitutions & 2 /* NamespaceExports */ && container.kind === 245 /* ModuleDeclaration */) ||
+ (applicableSubstitutions & 8 /* NonQualifiedEnumMembers */ && container.kind === 244 /* EnumDeclaration */);
if (substitute) {
return ts.setTextRange(ts.createPropertyAccess(ts.getGeneratedNameForNode(container), node),
/*location*/ node);
@@ -70230,26 +71048,26 @@
return node;
}
switch (node.kind) {
- case 121 /* AsyncKeyword */:
+ case 122 /* AsyncKeyword */:
// ES2017 async modifier should be elided for targets < ES2017
return undefined;
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
return visitAwaitExpression(node);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return visitMethodDeclaration(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return visitFunctionDeclaration(node);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return visitFunctionExpression(node);
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return visitArrowFunction(node);
- case 189 /* PropertyAccessExpression */:
- if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 98 /* SuperKeyword */) {
+ case 190 /* PropertyAccessExpression */:
+ if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 99 /* SuperKeyword */) {
capturedSuperProperties.set(node.name.escapedText, true);
}
return ts.visitEachChild(node, visitor, context);
- case 190 /* ElementAccessExpression */:
- if (capturedSuperProperties && node.expression.kind === 98 /* SuperKeyword */) {
+ case 191 /* ElementAccessExpression */:
+ if (capturedSuperProperties && node.expression.kind === 99 /* SuperKeyword */) {
hasSuperElementAccess = true;
}
return ts.visitEachChild(node, visitor, context);
@@ -70260,27 +71078,27 @@
function asyncBodyVisitor(node) {
if (ts.isNodeWithPossibleHoistedDeclaration(node)) {
switch (node.kind) {
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return visitVariableStatementInAsyncBody(node);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return visitForStatementInAsyncBody(node);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return visitForInStatementInAsyncBody(node);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return visitForOfStatementInAsyncBody(node);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return visitCatchClauseInAsyncBody(node);
- case 218 /* Block */:
- case 232 /* SwitchStatement */:
- case 246 /* CaseBlock */:
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
- case 235 /* TryStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
- case 222 /* IfStatement */:
- case 231 /* WithStatement */:
- case 233 /* LabeledStatement */:
+ case 219 /* Block */:
+ case 233 /* SwitchStatement */:
+ case 247 /* CaseBlock */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
+ case 236 /* TryStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
+ case 223 /* IfStatement */:
+ case 232 /* WithStatement */:
+ case 234 /* LabeledStatement */:
return ts.visitEachChild(node, asyncBodyVisitor, context);
default:
return ts.Debug.assertNever(node, "Unhandled node.");
@@ -70481,7 +71299,7 @@
var original = ts.getOriginalNode(node, ts.isFunctionLike);
var nodeType = original.type;
var promiseConstructor = languageVersion < 2 /* ES2015 */ ? getPromiseConstructor(nodeType) : undefined;
- var isArrowFunction = node.kind === 197 /* ArrowFunction */;
+ var isArrowFunction = node.kind === 198 /* ArrowFunction */;
var hasLexicalArguments = (resolver.getNodeCheckFlags(node) & 8192 /* CaptureArguments */) !== 0;
// An async function is emit as an outer function that calls an inner
// generator function. To preserve lexical bindings, we pass the current
@@ -70572,17 +71390,17 @@
enabledSubstitutions |= 1 /* AsyncMethodsWithSuper */;
// We need to enable substitutions for call, property access, and element access
// if we need to rewrite super calls.
- context.enableSubstitution(191 /* CallExpression */);
- context.enableSubstitution(189 /* PropertyAccessExpression */);
- context.enableSubstitution(190 /* ElementAccessExpression */);
+ context.enableSubstitution(192 /* CallExpression */);
+ context.enableSubstitution(190 /* PropertyAccessExpression */);
+ context.enableSubstitution(191 /* ElementAccessExpression */);
// We need to be notified when entering and exiting declarations that bind super.
- context.enableEmitNotification(240 /* ClassDeclaration */);
- context.enableEmitNotification(156 /* MethodDeclaration */);
- context.enableEmitNotification(158 /* GetAccessor */);
- context.enableEmitNotification(159 /* SetAccessor */);
- context.enableEmitNotification(157 /* Constructor */);
+ context.enableEmitNotification(241 /* ClassDeclaration */);
+ context.enableEmitNotification(157 /* MethodDeclaration */);
+ context.enableEmitNotification(159 /* GetAccessor */);
+ context.enableEmitNotification(160 /* SetAccessor */);
+ context.enableEmitNotification(158 /* Constructor */);
// We need to be notified when entering the generated accessor arrow functions.
- context.enableEmitNotification(219 /* VariableStatement */);
+ context.enableEmitNotification(220 /* VariableStatement */);
}
}
/**
@@ -70630,23 +71448,23 @@
}
function substituteExpression(node) {
switch (node.kind) {
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return substitutePropertyAccessExpression(node);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return substituteElementAccessExpression(node);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return substituteCallExpression(node);
}
return node;
}
function substitutePropertyAccessExpression(node) {
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
return ts.setTextRange(ts.createPropertyAccess(ts.createFileLevelUniqueName("_super"), node.name), node);
}
return node;
}
function substituteElementAccessExpression(node) {
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
return createSuperElementAccessInAsyncMethod(node.argumentExpression, node);
}
return node;
@@ -70666,11 +71484,11 @@
}
function isSuperContainer(node) {
var kind = node.kind;
- return kind === 240 /* ClassDeclaration */
- || kind === 157 /* Constructor */
- || kind === 156 /* MethodDeclaration */
- || kind === 158 /* GetAccessor */
- || kind === 159 /* SetAccessor */;
+ return kind === 241 /* ClassDeclaration */
+ || kind === 158 /* Constructor */
+ || kind === 157 /* MethodDeclaration */
+ || kind === 159 /* GetAccessor */
+ || kind === 160 /* SetAccessor */;
}
function createSuperElementAccessInAsyncMethod(argumentExpression, location) {
if (enclosingSuperContainerFlags & 4096 /* AsyncMethodWithSuperBinding */) {
@@ -70805,7 +71623,7 @@
return visitorWorker(node, /*noDestructuringValue*/ true);
}
function visitorNoAsyncModifier(node) {
- if (node.kind === 121 /* AsyncKeyword */) {
+ if (node.kind === 122 /* AsyncKeyword */) {
return undefined;
}
return node;
@@ -70815,53 +71633,55 @@
return node;
}
switch (node.kind) {
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
return visitAwaitExpression(node);
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return visitYieldExpression(node);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return visitReturnStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return visitLabeledStatement(node);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return visitObjectLiteralExpression(node);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return visitBinaryExpression(node, noDestructuringValue);
- case 237 /* VariableDeclaration */:
+ case 275 /* CatchClause */:
+ return visitCatchClause(node);
+ case 238 /* VariableDeclaration */:
return visitVariableDeclaration(node);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return visitForStatement(node);
- case 200 /* VoidExpression */:
+ case 201 /* VoidExpression */:
return visitVoidExpression(node);
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return visitConstructorDeclaration(node);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return visitMethodDeclaration(node);
- case 158 /* GetAccessor */:
+ case 159 /* GetAccessor */:
return visitGetAccessorDeclaration(node);
- case 159 /* SetAccessor */:
+ case 160 /* SetAccessor */:
return visitSetAccessorDeclaration(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return visitFunctionDeclaration(node);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return visitFunctionExpression(node);
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return visitArrowFunction(node);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return visitParameter(node);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return visitExpressionStatement(node);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return visitParenthesizedExpression(node, noDestructuringValue);
- case 189 /* PropertyAccessExpression */:
- if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 98 /* SuperKeyword */) {
+ case 190 /* PropertyAccessExpression */:
+ if (capturedSuperProperties && ts.isPropertyAccessExpression(node) && node.expression.kind === 99 /* SuperKeyword */) {
capturedSuperProperties.set(node.name.escapedText, true);
}
return ts.visitEachChild(node, visitor, context);
- case 190 /* ElementAccessExpression */:
- if (capturedSuperProperties && node.expression.kind === 98 /* SuperKeyword */) {
+ case 191 /* ElementAccessExpression */:
+ if (capturedSuperProperties && node.expression.kind === 99 /* SuperKeyword */) {
hasSuperElementAccess = true;
}
return ts.visitEachChild(node, visitor, context);
@@ -70897,7 +71717,7 @@
function visitLabeledStatement(node) {
if (enclosingFunctionFlags & 2 /* Async */) {
var statement = ts.unwrapInnermostStatementOfLabel(node);
- if (statement.kind === 227 /* ForOfStatement */ && statement.awaitModifier) {
+ if (statement.kind === 228 /* ForOfStatement */ && statement.awaitModifier) {
return visitForOfStatement(statement, node);
}
return ts.restoreEnclosingLabel(ts.visitEachChild(statement, visitor, context), node);
@@ -70909,7 +71729,7 @@
var objects = [];
for (var _i = 0, elements_4 = elements; _i < elements_4.length; _i++) {
var e = elements_4[_i];
- if (e.kind === 277 /* SpreadAssignment */) {
+ if (e.kind === 278 /* SpreadAssignment */) {
if (chunkObject) {
objects.push(ts.createObjectLiteral(chunkObject));
chunkObject = undefined;
@@ -70918,7 +71738,7 @@
objects.push(ts.visitNode(target, visitor, ts.isExpression));
}
else {
- chunkObject = ts.append(chunkObject, e.kind === 275 /* PropertyAssignment */
+ chunkObject = ts.append(chunkObject, e.kind === 276 /* PropertyAssignment */
? ts.createPropertyAssignment(e.name, ts.visitNode(e.initializer, visitor, ts.isExpression))
: ts.visitNode(e, visitor, ts.isObjectLiteralElementLike));
}
@@ -70936,7 +71756,7 @@
// If the first element is a spread element, then the first argument to __assign is {}:
// { ...o, a, b, ...o2 } => __assign({}, o, {a, b}, o2)
var objects = chunkObjectLiteralElements(node.properties);
- if (objects.length && objects[0].kind !== 188 /* ObjectLiteralExpression */) {
+ if (objects.length && objects[0].kind !== 189 /* ObjectLiteralExpression */) {
objects.unshift(ts.createObjectLiteral());
}
return createAssignHelper(context, objects);
@@ -70963,6 +71783,23 @@
}
return ts.visitEachChild(node, visitor, context);
}
+ function visitCatchClause(node) {
+ if (node.variableDeclaration &&
+ ts.isBindingPattern(node.variableDeclaration.name) &&
+ node.variableDeclaration.name.transformFlags & 8192 /* ContainsObjectRestOrSpread */) {
+ var name = ts.getGeneratedNameForNode(node.variableDeclaration.name);
+ var updatedDecl = ts.updateVariableDeclaration(node.variableDeclaration, node.variableDeclaration.name, /*type*/ undefined, name);
+ var visitedBindings = ts.flattenDestructuringBinding(updatedDecl, visitor, context, 1 /* ObjectRest */);
+ var block = ts.visitNode(node.block, visitor, ts.isBlock);
+ if (ts.some(visitedBindings)) {
+ block = ts.updateBlock(block, [
+ ts.createVariableStatement(/*modifiers*/ undefined, visitedBindings)
+ ].concat(block.statements));
+ }
+ return ts.updateCatchClause(node, ts.updateVariableDeclaration(node.variableDeclaration, name, /*type*/ undefined, /*initializer*/ undefined), block);
+ }
+ return ts.visitEachChild(node, visitor, context);
+ }
/**
* Visits a VariableDeclaration node with a binding pattern.
*
@@ -71255,17 +72092,17 @@
enabledSubstitutions |= 1 /* AsyncMethodsWithSuper */;
// We need to enable substitutions for call, property access, and element access
// if we need to rewrite super calls.
- context.enableSubstitution(191 /* CallExpression */);
- context.enableSubstitution(189 /* PropertyAccessExpression */);
- context.enableSubstitution(190 /* ElementAccessExpression */);
+ context.enableSubstitution(192 /* CallExpression */);
+ context.enableSubstitution(190 /* PropertyAccessExpression */);
+ context.enableSubstitution(191 /* ElementAccessExpression */);
// We need to be notified when entering and exiting declarations that bind super.
- context.enableEmitNotification(240 /* ClassDeclaration */);
- context.enableEmitNotification(156 /* MethodDeclaration */);
- context.enableEmitNotification(158 /* GetAccessor */);
- context.enableEmitNotification(159 /* SetAccessor */);
- context.enableEmitNotification(157 /* Constructor */);
+ context.enableEmitNotification(241 /* ClassDeclaration */);
+ context.enableEmitNotification(157 /* MethodDeclaration */);
+ context.enableEmitNotification(159 /* GetAccessor */);
+ context.enableEmitNotification(160 /* SetAccessor */);
+ context.enableEmitNotification(158 /* Constructor */);
// We need to be notified when entering the generated accessor arrow functions.
- context.enableEmitNotification(219 /* VariableStatement */);
+ context.enableEmitNotification(220 /* VariableStatement */);
}
}
/**
@@ -71313,23 +72150,23 @@
}
function substituteExpression(node) {
switch (node.kind) {
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return substitutePropertyAccessExpression(node);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return substituteElementAccessExpression(node);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return substituteCallExpression(node);
}
return node;
}
function substitutePropertyAccessExpression(node) {
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
return ts.setTextRange(ts.createPropertyAccess(ts.createFileLevelUniqueName("_super"), node.name), node);
}
return node;
}
function substituteElementAccessExpression(node) {
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
return createSuperElementAccessInAsyncMethod(node.argumentExpression, node);
}
return node;
@@ -71349,11 +72186,11 @@
}
function isSuperContainer(node) {
var kind = node.kind;
- return kind === 240 /* ClassDeclaration */
- || kind === 157 /* Constructor */
- || kind === 156 /* MethodDeclaration */
- || kind === 158 /* GetAccessor */
- || kind === 159 /* SetAccessor */;
+ return kind === 241 /* ClassDeclaration */
+ || kind === 158 /* Constructor */
+ || kind === 157 /* MethodDeclaration */
+ || kind === 159 /* GetAccessor */
+ || kind === 160 /* SetAccessor */;
}
function createSuperElementAccessInAsyncMethod(argumentExpression, location) {
if (enclosingSuperContainerFlags & 4096 /* AsyncMethodWithSuperBinding */) {
@@ -71447,7 +72284,7 @@
return node;
}
switch (node.kind) {
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return visitCatchClause(node);
default:
return ts.visitEachChild(node, visitor, context);
@@ -71516,13 +72353,13 @@
}
function visitorWorker(node) {
switch (node.kind) {
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
return visitJsxElement(node, /*isChild*/ false);
- case 261 /* JsxSelfClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
return visitJsxSelfClosingElement(node, /*isChild*/ false);
- case 264 /* JsxFragment */:
+ case 265 /* JsxFragment */:
return visitJsxFragment(node, /*isChild*/ false);
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return visitJsxExpression(node);
default:
return ts.visitEachChild(node, visitor, context);
@@ -71532,13 +72369,13 @@
switch (node.kind) {
case 11 /* JsxText */:
return visitJsxText(node);
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return visitJsxExpression(node);
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
return visitJsxElement(node, /*isChild*/ true);
- case 261 /* JsxSelfClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
return visitJsxSelfClosingElement(node, /*isChild*/ true);
- case 264 /* JsxFragment */:
+ case 265 /* JsxFragment */:
return visitJsxFragment(node, /*isChild*/ true);
default:
return ts.Debug.failBadSyntaxKind(node);
@@ -71613,7 +72450,7 @@
literal.singleQuote = node.singleQuote !== undefined ? node.singleQuote : !ts.isStringDoubleQuoted(node, currentSourceFile);
return ts.setTextRange(literal, node);
}
- else if (node.kind === 270 /* JsxExpression */) {
+ else if (node.kind === 271 /* JsxExpression */) {
if (node.expression === undefined) {
return ts.createTrue();
}
@@ -71707,7 +72544,7 @@
return decoded === text ? undefined : decoded;
}
function getTagName(node) {
- if (node.kind === 260 /* JsxElement */) {
+ if (node.kind === 261 /* JsxElement */) {
return getTagName(node.openingElement);
}
else {
@@ -72013,7 +72850,7 @@
return node;
}
switch (node.kind) {
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return visitBinaryExpression(node);
default:
return ts.visitEachChild(node, visitor, context);
@@ -72021,7 +72858,7 @@
}
function visitBinaryExpression(node) {
switch (node.operatorToken.kind) {
- case 63 /* AsteriskAsteriskEqualsToken */:
+ case 64 /* AsteriskAsteriskEqualsToken */:
return visitExponentiationAssignmentExpression(node);
case 41 /* AsteriskAsteriskToken */:
return visitExponentiationExpression(node);
@@ -72106,62 +72943,63 @@
HierarchyFacts[HierarchyFacts["Block"] = 128] = "Block";
HierarchyFacts[HierarchyFacts["IterationStatement"] = 256] = "IterationStatement";
HierarchyFacts[HierarchyFacts["IterationStatementBlock"] = 512] = "IterationStatementBlock";
- HierarchyFacts[HierarchyFacts["ForStatement"] = 1024] = "ForStatement";
- HierarchyFacts[HierarchyFacts["ForInOrForOfStatement"] = 2048] = "ForInOrForOfStatement";
- HierarchyFacts[HierarchyFacts["ConstructorWithCapturedSuper"] = 4096] = "ConstructorWithCapturedSuper";
+ HierarchyFacts[HierarchyFacts["IterationContainer"] = 1024] = "IterationContainer";
+ HierarchyFacts[HierarchyFacts["ForStatement"] = 2048] = "ForStatement";
+ HierarchyFacts[HierarchyFacts["ForInOrForOfStatement"] = 4096] = "ForInOrForOfStatement";
+ HierarchyFacts[HierarchyFacts["ConstructorWithCapturedSuper"] = 8192] = "ConstructorWithCapturedSuper";
// NOTE: do not add more ancestor flags without also updating AncestorFactsMask below.
// NOTE: when adding a new ancestor flag, be sure to update the subtree flags below.
//
// Ancestor masks
//
- HierarchyFacts[HierarchyFacts["AncestorFactsMask"] = 8191] = "AncestorFactsMask";
+ HierarchyFacts[HierarchyFacts["AncestorFactsMask"] = 16383] = "AncestorFactsMask";
// We are always in *some* kind of block scope, but only specific block-scope containers are
// top-level or Blocks.
HierarchyFacts[HierarchyFacts["BlockScopeIncludes"] = 0] = "BlockScopeIncludes";
- HierarchyFacts[HierarchyFacts["BlockScopeExcludes"] = 4032] = "BlockScopeExcludes";
+ HierarchyFacts[HierarchyFacts["BlockScopeExcludes"] = 7104] = "BlockScopeExcludes";
// A source file is a top-level block scope.
HierarchyFacts[HierarchyFacts["SourceFileIncludes"] = 64] = "SourceFileIncludes";
- HierarchyFacts[HierarchyFacts["SourceFileExcludes"] = 3968] = "SourceFileExcludes";
+ HierarchyFacts[HierarchyFacts["SourceFileExcludes"] = 8064] = "SourceFileExcludes";
// Functions, methods, and accessors are both new lexical scopes and new block scopes.
HierarchyFacts[HierarchyFacts["FunctionIncludes"] = 65] = "FunctionIncludes";
- HierarchyFacts[HierarchyFacts["FunctionExcludes"] = 8094] = "FunctionExcludes";
+ HierarchyFacts[HierarchyFacts["FunctionExcludes"] = 16286] = "FunctionExcludes";
HierarchyFacts[HierarchyFacts["AsyncFunctionBodyIncludes"] = 69] = "AsyncFunctionBodyIncludes";
- HierarchyFacts[HierarchyFacts["AsyncFunctionBodyExcludes"] = 8086] = "AsyncFunctionBodyExcludes";
+ HierarchyFacts[HierarchyFacts["AsyncFunctionBodyExcludes"] = 16278] = "AsyncFunctionBodyExcludes";
// Arrow functions are lexically scoped to their container, but are new block scopes.
HierarchyFacts[HierarchyFacts["ArrowFunctionIncludes"] = 66] = "ArrowFunctionIncludes";
- HierarchyFacts[HierarchyFacts["ArrowFunctionExcludes"] = 8064] = "ArrowFunctionExcludes";
+ HierarchyFacts[HierarchyFacts["ArrowFunctionExcludes"] = 15232] = "ArrowFunctionExcludes";
// Constructors are both new lexical scopes and new block scopes. Constructors are also
// always considered non-static members of a class.
HierarchyFacts[HierarchyFacts["ConstructorIncludes"] = 73] = "ConstructorIncludes";
- HierarchyFacts[HierarchyFacts["ConstructorExcludes"] = 8086] = "ConstructorExcludes";
+ HierarchyFacts[HierarchyFacts["ConstructorExcludes"] = 16278] = "ConstructorExcludes";
// 'do' and 'while' statements are not block scopes. We track that the subtree is contained
// within an IterationStatement to indicate whether the embedded statement is an
// IterationStatementBlock.
- HierarchyFacts[HierarchyFacts["DoOrWhileStatementIncludes"] = 256] = "DoOrWhileStatementIncludes";
+ HierarchyFacts[HierarchyFacts["DoOrWhileStatementIncludes"] = 1280] = "DoOrWhileStatementIncludes";
HierarchyFacts[HierarchyFacts["DoOrWhileStatementExcludes"] = 0] = "DoOrWhileStatementExcludes";
// 'for' statements are new block scopes and have special handling for 'let' declarations.
- HierarchyFacts[HierarchyFacts["ForStatementIncludes"] = 1280] = "ForStatementIncludes";
- HierarchyFacts[HierarchyFacts["ForStatementExcludes"] = 3008] = "ForStatementExcludes";
+ HierarchyFacts[HierarchyFacts["ForStatementIncludes"] = 3328] = "ForStatementIncludes";
+ HierarchyFacts[HierarchyFacts["ForStatementExcludes"] = 5056] = "ForStatementExcludes";
// 'for-in' and 'for-of' statements are new block scopes and have special handling for
// 'let' declarations.
- HierarchyFacts[HierarchyFacts["ForInOrForOfStatementIncludes"] = 2304] = "ForInOrForOfStatementIncludes";
- HierarchyFacts[HierarchyFacts["ForInOrForOfStatementExcludes"] = 1984] = "ForInOrForOfStatementExcludes";
+ HierarchyFacts[HierarchyFacts["ForInOrForOfStatementIncludes"] = 5376] = "ForInOrForOfStatementIncludes";
+ HierarchyFacts[HierarchyFacts["ForInOrForOfStatementExcludes"] = 3008] = "ForInOrForOfStatementExcludes";
// Blocks (other than function bodies) are new block scopes.
HierarchyFacts[HierarchyFacts["BlockIncludes"] = 128] = "BlockIncludes";
- HierarchyFacts[HierarchyFacts["BlockExcludes"] = 3904] = "BlockExcludes";
+ HierarchyFacts[HierarchyFacts["BlockExcludes"] = 6976] = "BlockExcludes";
HierarchyFacts[HierarchyFacts["IterationStatementBlockIncludes"] = 512] = "IterationStatementBlockIncludes";
- HierarchyFacts[HierarchyFacts["IterationStatementBlockExcludes"] = 4032] = "IterationStatementBlockExcludes";
+ HierarchyFacts[HierarchyFacts["IterationStatementBlockExcludes"] = 7104] = "IterationStatementBlockExcludes";
//
// Subtree facts
//
- HierarchyFacts[HierarchyFacts["NewTarget"] = 8192] = "NewTarget";
- HierarchyFacts[HierarchyFacts["CapturedLexicalThis"] = 16384] = "CapturedLexicalThis";
+ HierarchyFacts[HierarchyFacts["NewTarget"] = 16384] = "NewTarget";
+ HierarchyFacts[HierarchyFacts["CapturedLexicalThis"] = 32768] = "CapturedLexicalThis";
//
// Subtree masks
//
- HierarchyFacts[HierarchyFacts["SubtreeFactsMask"] = -8192] = "SubtreeFactsMask";
+ HierarchyFacts[HierarchyFacts["SubtreeFactsMask"] = -16384] = "SubtreeFactsMask";
HierarchyFacts[HierarchyFacts["ArrowFunctionSubtreeExcludes"] = 0] = "ArrowFunctionSubtreeExcludes";
- HierarchyFacts[HierarchyFacts["FunctionSubtreeExcludes"] = 24576] = "FunctionSubtreeExcludes";
+ HierarchyFacts[HierarchyFacts["FunctionSubtreeExcludes"] = 49152] = "FunctionSubtreeExcludes";
})(HierarchyFacts || (HierarchyFacts = {}));
function transformES2015(context) {
var startLexicalEnvironment = context.startLexicalEnvironment, resumeLexicalEnvironment = context.resumeLexicalEnvironment, endLexicalEnvironment = context.endLexicalEnvironment, hoistVariableDeclaration = context.hoistVariableDeclaration;
@@ -72210,7 +73048,7 @@
*/
function enterSubtree(excludeFacts, includeFacts) {
var ancestorFacts = hierarchyFacts;
- hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & 8191 /* AncestorFactsMask */;
+ hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & 16383 /* AncestorFactsMask */;
return ancestorFacts;
}
/**
@@ -72221,17 +73059,17 @@
* @param includeFacts The new `HierarchyFacts` of the subtree that should be propagated.
*/
function exitSubtree(ancestorFacts, excludeFacts, includeFacts) {
- hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & -8192 /* SubtreeFactsMask */ | ancestorFacts;
+ hierarchyFacts = (hierarchyFacts & ~excludeFacts | includeFacts) & -16384 /* SubtreeFactsMask */ | ancestorFacts;
}
function isReturnVoidStatementInConstructorWithCapturedSuper(node) {
- return (hierarchyFacts & 4096 /* ConstructorWithCapturedSuper */) !== 0
- && node.kind === 230 /* ReturnStatement */
+ return (hierarchyFacts & 8192 /* ConstructorWithCapturedSuper */) !== 0
+ && node.kind === 231 /* ReturnStatement */
&& !node.expression;
}
function shouldVisitNode(node) {
return (node.transformFlags & 128 /* ContainsES2015 */) !== 0
|| convertedLoopState !== undefined
- || (hierarchyFacts & 4096 /* ConstructorWithCapturedSuper */ && (ts.isStatement(node) || (node.kind === 218 /* Block */)))
+ || (hierarchyFacts & 8192 /* ConstructorWithCapturedSuper */ && (ts.isStatement(node) || (node.kind === 219 /* Block */)))
|| (ts.isIterationStatement(node, /*lookInLabeledStatements*/ false) && shouldConvertIterationStatement(node))
|| (ts.getEmitFlags(node) & 33554432 /* TypeScriptClassWrapper */) !== 0;
}
@@ -72244,72 +73082,72 @@
}
}
function callExpressionVisitor(node) {
- if (node.kind === 98 /* SuperKeyword */) {
+ if (node.kind === 99 /* SuperKeyword */) {
return visitSuperKeyword(/*isExpressionOfCall*/ true);
}
return visitor(node);
}
function visitJavaScript(node) {
switch (node.kind) {
- case 116 /* StaticKeyword */:
+ case 117 /* StaticKeyword */:
return undefined; // elide static keyword
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return visitClassDeclaration(node);
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
return visitClassExpression(node);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return visitParameter(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return visitFunctionDeclaration(node);
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return visitArrowFunction(node);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return visitFunctionExpression(node);
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return visitVariableDeclaration(node);
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return visitIdentifier(node);
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
return visitVariableDeclarationList(node);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return visitSwitchStatement(node);
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
return visitCaseBlock(node);
- case 218 /* Block */:
+ case 219 /* Block */:
return visitBlock(node, /*isFunctionBody*/ false);
- case 229 /* BreakStatement */:
- case 228 /* ContinueStatement */:
+ case 230 /* BreakStatement */:
+ case 229 /* ContinueStatement */:
return visitBreakOrContinueStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return visitLabeledStatement(node);
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
return visitDoOrWhileStatement(node, /*outermostLabeledStatement*/ undefined);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return visitForStatement(node, /*outermostLabeledStatement*/ undefined);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return visitForInStatement(node, /*outermostLabeledStatement*/ undefined);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return visitForOfStatement(node, /*outermostLabeledStatement*/ undefined);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return visitExpressionStatement(node);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return visitObjectLiteralExpression(node);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return visitCatchClause(node);
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return visitShorthandPropertyAssignment(node);
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
return visitComputedPropertyName(node);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return visitArrayLiteralExpression(node);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return visitCallExpression(node);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return visitNewExpression(node);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return visitParenthesizedExpression(node, /*needsDestructuringValue*/ true);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return visitBinaryExpression(node, /*needsDestructuringValue*/ true);
case 14 /* NoSubstitutionTemplateLiteral */:
case 15 /* TemplateHead */:
@@ -72320,35 +73158,35 @@
return visitStringLiteral(node);
case 8 /* NumericLiteral */:
return visitNumericLiteral(node);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return visitTaggedTemplateExpression(node);
- case 206 /* TemplateExpression */:
+ case 207 /* TemplateExpression */:
return visitTemplateExpression(node);
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return visitYieldExpression(node);
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
return visitSpreadElement(node);
- case 98 /* SuperKeyword */:
+ case 99 /* SuperKeyword */:
return visitSuperKeyword(/*isExpressionOfCall*/ false);
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
return visitThisKeyword(node);
- case 214 /* MetaProperty */:
+ case 215 /* MetaProperty */:
return visitMetaProperty(node);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return visitMethodDeclaration(node);
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return visitAccessorDeclaration(node);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return visitVariableStatement(node);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return visitReturnStatement(node);
default:
return ts.visitEachChild(node, visitor, context);
}
}
function visitSourceFile(node) {
- var ancestorFacts = enterSubtree(3968 /* SourceFileExcludes */, 64 /* SourceFileIncludes */);
+ var ancestorFacts = enterSubtree(8064 /* SourceFileExcludes */, 64 /* SourceFileIncludes */);
var prologue = [];
var statements = [];
startLexicalEnvironment();
@@ -72375,7 +73213,7 @@
return ts.visitEachChild(node, visitor, context);
}
function visitCaseBlock(node) {
- var ancestorFacts = enterSubtree(4032 /* BlockScopeExcludes */, 0 /* BlockScopeIncludes */);
+ var ancestorFacts = enterSubtree(7104 /* BlockScopeExcludes */, 0 /* BlockScopeIncludes */);
var updated = ts.visitEachChild(node, visitor, context);
exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */);
return updated;
@@ -72402,7 +73240,7 @@
}
function visitThisKeyword(node) {
if (hierarchyFacts & 2 /* ArrowFunction */) {
- hierarchyFacts |= 16384 /* CapturedLexicalThis */;
+ hierarchyFacts |= 32768 /* CapturedLexicalThis */;
}
if (convertedLoopState) {
if (hierarchyFacts & 2 /* ArrowFunction */) {
@@ -72432,14 +73270,14 @@
// it is possible if either
// - break/continue is labeled and label is located inside the converted loop
// - break/continue is non-labeled and located in non-converted loop/switch statement
- var jump = node.kind === 229 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */;
+ var jump = node.kind === 230 /* BreakStatement */ ? 2 /* Break */ : 4 /* Continue */;
var canUseBreakOrContinue = (node.label && convertedLoopState.labels && convertedLoopState.labels.get(ts.idText(node.label))) ||
(!node.label && (convertedLoopState.allowedNonLabeledJumps & jump));
if (!canUseBreakOrContinue) {
var labelMarker = void 0;
var label = node.label;
if (!label) {
- if (node.kind === 229 /* BreakStatement */) {
+ if (node.kind === 230 /* BreakStatement */) {
convertedLoopState.nonLocalJumps |= 2 /* Break */;
labelMarker = "break";
}
@@ -72450,7 +73288,7 @@
}
}
else {
- if (node.kind === 229 /* BreakStatement */) {
+ if (node.kind === 230 /* BreakStatement */) {
labelMarker = "break-" + label.escapedText;
setLabeledJump(convertedLoopState, /*isBreak*/ true, ts.idText(label), labelMarker);
}
@@ -72645,7 +73483,7 @@
function addConstructor(statements, node, extendsClauseElement) {
var savedConvertedLoopState = convertedLoopState;
convertedLoopState = undefined;
- var ancestorFacts = enterSubtree(8086 /* ConstructorExcludes */, 73 /* ConstructorIncludes */);
+ var ancestorFacts = enterSubtree(16278 /* ConstructorExcludes */, 73 /* ConstructorIncludes */);
var constructor = ts.getFirstConstructorWithBody(node);
var hasSynthesizedSuper = hasSynthesizedDefaultSuperCall(constructor, extendsClauseElement !== undefined);
var constructorFunction = ts.createFunctionDeclaration(
@@ -72659,7 +73497,7 @@
ts.setEmitFlags(constructorFunction, 8 /* CapturesThis */);
}
statements.push(constructorFunction);
- exitSubtree(ancestorFacts, 24576 /* FunctionSubtreeExcludes */, 0 /* None */);
+ exitSubtree(ancestorFacts, 49152 /* FunctionSubtreeExcludes */, 0 /* None */);
convertedLoopState = savedConvertedLoopState;
}
/**
@@ -72708,7 +73546,7 @@
function transformConstructorBody(constructor, node, extendsClauseElement, hasSynthesizedSuper) {
// determine whether the class is known syntactically to be a derived class (e.g. a
// class that extends a value that is not syntactically known to be `null`).
- var isDerivedClass = !!extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 96 /* NullKeyword */;
+ var isDerivedClass = !!extendsClauseElement && ts.skipOuterExpressions(extendsClauseElement.expression).kind !== 97 /* NullKeyword */;
// When the subclass does not have a constructor, we synthesize a *default* constructor using the following
// representation:
//
@@ -72752,7 +73590,7 @@
}
}
if (superCallExpression) {
- hierarchyFacts |= 4096 /* ConstructorWithCapturedSuper */;
+ hierarchyFacts |= 8192 /* ConstructorWithCapturedSuper */;
statementOffset++; // skip this statement, we will add it after visiting the rest of the body.
}
// visit the remaining statements
@@ -72846,11 +73684,11 @@
*/
function isSufficientlyCoveredByReturnStatements(statement) {
// A return statement is considered covered.
- if (statement.kind === 230 /* ReturnStatement */) {
+ if (statement.kind === 231 /* ReturnStatement */) {
return true;
}
// An if-statement with two covered branches is covered.
- else if (statement.kind === 222 /* IfStatement */) {
+ else if (statement.kind === 223 /* IfStatement */) {
var ifStatement = statement;
if (ifStatement.elseStatement) {
return isSufficientlyCoveredByReturnStatements(ifStatement.thenStatement) &&
@@ -72858,7 +73696,7 @@
}
}
// A block is covered if it has a last statement which is covered.
- else if (statement.kind === 218 /* Block */) {
+ else if (statement.kind === 219 /* Block */) {
var lastStatement = ts.lastOrUndefined(statement.statements);
if (lastStatement && isSufficientlyCoveredByReturnStatements(lastStatement)) {
return true;
@@ -73013,10 +73851,10 @@
return false;
}
// `declarationName` is the name of the local declaration for the parameter.
- var declarationName = parameter.name.kind === 72 /* Identifier */ ? ts.getMutableClone(parameter.name) : ts.createTempVariable(/*recordTempVariable*/ undefined);
+ var declarationName = parameter.name.kind === 73 /* Identifier */ ? ts.getMutableClone(parameter.name) : ts.createTempVariable(/*recordTempVariable*/ undefined);
ts.setEmitFlags(declarationName, 48 /* NoSourceMap */);
// `expressionName` is the name of the parameter used in expressions.
- var expressionName = parameter.name.kind === 72 /* Identifier */ ? ts.getSynthesizedClone(parameter.name) : declarationName;
+ var expressionName = parameter.name.kind === 73 /* Identifier */ ? ts.getSynthesizedClone(parameter.name) : declarationName;
var restIndex = node.parameters.length - 1;
var temp = ts.createLoopVariable();
// var param = [];
@@ -73040,7 +73878,7 @@
ts.setEmitFlags(forStatement, 1048576 /* CustomPrologue */);
ts.startOnNewLine(forStatement);
prologueStatements.push(forStatement);
- if (parameter.name.kind !== 72 /* Identifier */) {
+ if (parameter.name.kind !== 73 /* Identifier */) {
// do the actual destructuring of the rest parameter if necessary
prologueStatements.push(ts.setEmitFlags(ts.setTextRange(ts.createVariableStatement(
/*modifiers*/ undefined, ts.createVariableDeclarationList(ts.flattenDestructuringBinding(parameter, visitor, context, 0 /* All */, expressionName))), parameter), 1048576 /* CustomPrologue */));
@@ -73056,7 +73894,7 @@
* @param node A node.
*/
function insertCaptureThisForNodeIfNeeded(statements, node) {
- if (hierarchyFacts & 16384 /* CapturedLexicalThis */ && node.kind !== 197 /* ArrowFunction */) {
+ if (hierarchyFacts & 32768 /* CapturedLexicalThis */ && node.kind !== 198 /* ArrowFunction */) {
insertCaptureThisForNode(statements, node, ts.createThis());
return true;
}
@@ -73074,28 +73912,28 @@
ts.insertStatementAfterCustomPrologue(statements, captureThisStatement);
}
function insertCaptureNewTargetIfNeeded(statements, node, copyOnWrite) {
- if (hierarchyFacts & 8192 /* NewTarget */) {
+ if (hierarchyFacts & 16384 /* NewTarget */) {
var newTarget = void 0;
switch (node.kind) {
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return statements;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
// Methods and accessors cannot be constructors, so 'new.target' will
// always return 'undefined'.
newTarget = ts.createVoidZero();
break;
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
// Class constructors can only be called with `new`, so `this.constructor`
// should be relatively safe to use.
newTarget = ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), "constructor");
break;
- case 239 /* FunctionDeclaration */:
- case 196 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
+ case 197 /* FunctionExpression */:
// Functions can be called or constructed, and may have a `this` due to
// being a member or when calling an imported function via `other_1.f()`.
- newTarget = ts.createConditional(ts.createLogicalAnd(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), ts.createBinary(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), 94 /* InstanceOfKeyword */, ts.getLocalName(node))), ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), "constructor"), ts.createVoidZero());
+ newTarget = ts.createConditional(ts.createLogicalAnd(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), ts.createBinary(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), 95 /* InstanceOfKeyword */, ts.getLocalName(node))), ts.createPropertyAccess(ts.setEmitFlags(ts.createThis(), 4 /* NoSubstitution */), "constructor"), ts.createVoidZero());
break;
default:
return ts.Debug.failBadSyntaxKind(node);
@@ -73124,20 +73962,20 @@
for (var _i = 0, _a = node.members; _i < _a.length; _i++) {
var member = _a[_i];
switch (member.kind) {
- case 217 /* SemicolonClassElement */:
+ case 218 /* SemicolonClassElement */:
statements.push(transformSemicolonClassElementToStatement(member));
break;
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
statements.push(transformClassMethodDeclarationToStatement(getClassMemberPrefix(node, member), member, node));
break;
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
var accessors = ts.getAllAccessorDeclarations(node.members, member);
if (member === accessors.firstAccessor) {
statements.push(transformAccessorsToStatement(getClassMemberPrefix(node, member), accessors, node));
}
break;
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
// Constructors are handled in visitClassExpression/visitClassDeclaration
break;
default:
@@ -73204,7 +74042,7 @@
// arguments are both mapped contiguously to the accessor name.
var target = ts.getMutableClone(receiver);
ts.setEmitFlags(target, 1536 /* NoComments */ | 32 /* NoTrailingSourceMap */);
- ts.setSourceMapRange(target, firstAccessor.name); // TODO: GH#18217
+ ts.setSourceMapRange(target, firstAccessor.name);
var propertyName = ts.createExpressionForPropertyName(ts.visitNode(firstAccessor.name, visitor, ts.isPropertyName));
ts.setEmitFlags(propertyName, 1536 /* NoComments */ | 16 /* NoLeadingSourceMap */);
ts.setSourceMapRange(propertyName, firstAccessor.name);
@@ -73244,11 +74082,11 @@
*/
function visitArrowFunction(node) {
if (node.transformFlags & 2048 /* ContainsLexicalThis */) {
- hierarchyFacts |= 16384 /* CapturedLexicalThis */;
+ hierarchyFacts |= 32768 /* CapturedLexicalThis */;
}
var savedConvertedLoopState = convertedLoopState;
convertedLoopState = undefined;
- var ancestorFacts = enterSubtree(8064 /* ArrowFunctionExcludes */, 66 /* ArrowFunctionIncludes */);
+ var ancestorFacts = enterSubtree(15232 /* ArrowFunctionExcludes */, 66 /* ArrowFunctionIncludes */);
var func = ts.createFunctionExpression(
/*modifiers*/ undefined,
/*asteriskToken*/ undefined,
@@ -73258,7 +74096,7 @@
ts.setTextRange(func, node);
ts.setOriginalNode(func, node);
ts.setEmitFlags(func, 8 /* CapturesThis */);
- if (hierarchyFacts & 16384 /* CapturedLexicalThis */) {
+ if (hierarchyFacts & 32768 /* CapturedLexicalThis */) {
enableSubstitutionsForCapturedThis();
}
// If an arrow function contains
@@ -73273,16 +74111,16 @@
*/
function visitFunctionExpression(node) {
var ancestorFacts = ts.getEmitFlags(node) & 262144 /* AsyncFunctionBody */
- ? enterSubtree(8086 /* AsyncFunctionBodyExcludes */, 69 /* AsyncFunctionBodyIncludes */)
- : enterSubtree(8094 /* FunctionExcludes */, 65 /* FunctionIncludes */);
+ ? enterSubtree(16278 /* AsyncFunctionBodyExcludes */, 69 /* AsyncFunctionBodyIncludes */)
+ : enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */);
var savedConvertedLoopState = convertedLoopState;
convertedLoopState = undefined;
var parameters = ts.visitParameterList(node.parameters, visitor, context);
var body = transformFunctionBody(node);
- var name = hierarchyFacts & 8192 /* NewTarget */
+ var name = hierarchyFacts & 16384 /* NewTarget */
? ts.getLocalName(node)
: node.name;
- exitSubtree(ancestorFacts, 24576 /* FunctionSubtreeExcludes */, 0 /* None */);
+ exitSubtree(ancestorFacts, 49152 /* FunctionSubtreeExcludes */, 0 /* None */);
convertedLoopState = savedConvertedLoopState;
return ts.updateFunctionExpression(node,
/*modifiers*/ undefined, node.asteriskToken, name,
@@ -73297,13 +74135,13 @@
function visitFunctionDeclaration(node) {
var savedConvertedLoopState = convertedLoopState;
convertedLoopState = undefined;
- var ancestorFacts = enterSubtree(8094 /* FunctionExcludes */, 65 /* FunctionIncludes */);
+ var ancestorFacts = enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */);
var parameters = ts.visitParameterList(node.parameters, visitor, context);
var body = transformFunctionBody(node);
- var name = hierarchyFacts & 8192 /* NewTarget */
+ var name = hierarchyFacts & 16384 /* NewTarget */
? ts.getLocalName(node)
: node.name;
- exitSubtree(ancestorFacts, 24576 /* FunctionSubtreeExcludes */, 0 /* None */);
+ exitSubtree(ancestorFacts, 49152 /* FunctionSubtreeExcludes */, 0 /* None */);
convertedLoopState = savedConvertedLoopState;
return ts.updateFunctionDeclaration(node,
/*decorators*/ undefined, ts.visitNodes(node.modifiers, visitor, ts.isModifier), node.asteriskToken, name,
@@ -73321,14 +74159,14 @@
var savedConvertedLoopState = convertedLoopState;
convertedLoopState = undefined;
var ancestorFacts = container && ts.isClassLike(container) && !ts.hasModifier(node, 32 /* Static */)
- ? enterSubtree(8094 /* FunctionExcludes */, 65 /* FunctionIncludes */ | 8 /* NonStaticClassElement */)
- : enterSubtree(8094 /* FunctionExcludes */, 65 /* FunctionIncludes */);
+ ? enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */ | 8 /* NonStaticClassElement */)
+ : enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */);
var parameters = ts.visitParameterList(node.parameters, visitor, context);
var body = transformFunctionBody(node);
- if (hierarchyFacts & 8192 /* NewTarget */ && !name && (node.kind === 239 /* FunctionDeclaration */ || node.kind === 196 /* FunctionExpression */)) {
+ if (hierarchyFacts & 16384 /* NewTarget */ && !name && (node.kind === 240 /* FunctionDeclaration */ || node.kind === 197 /* FunctionExpression */)) {
name = ts.getGeneratedNameForNode(node);
}
- exitSubtree(ancestorFacts, 24576 /* FunctionSubtreeExcludes */, 0 /* None */);
+ exitSubtree(ancestorFacts, 49152 /* FunctionSubtreeExcludes */, 0 /* None */);
convertedLoopState = savedConvertedLoopState;
return ts.setOriginalNode(ts.setTextRange(ts.createFunctionExpression(
/*modifiers*/ undefined, node.asteriskToken, name,
@@ -73369,7 +74207,7 @@
}
}
else {
- ts.Debug.assert(node.kind === 197 /* ArrowFunction */);
+ ts.Debug.assert(node.kind === 198 /* ArrowFunction */);
// To align with the old emitter, we use a synthetic end position on the location
// for the statement list we synthesize when we down-level an arrow function with
// an expression function body. This prevents both comments and source maps from
@@ -73423,8 +74261,8 @@
return ts.visitEachChild(node, visitor, context);
}
var ancestorFacts = hierarchyFacts & 256 /* IterationStatement */
- ? enterSubtree(4032 /* IterationStatementBlockExcludes */, 512 /* IterationStatementBlockIncludes */)
- : enterSubtree(3904 /* BlockExcludes */, 128 /* BlockIncludes */);
+ ? enterSubtree(7104 /* IterationStatementBlockExcludes */, 512 /* IterationStatementBlockIncludes */)
+ : enterSubtree(6976 /* BlockExcludes */, 128 /* BlockIncludes */);
var updated = ts.visitEachChild(node, visitor, context);
exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */);
return updated;
@@ -73437,9 +74275,9 @@
function visitExpressionStatement(node) {
// If we are here it is most likely because our expression is a destructuring assignment.
switch (node.expression.kind) {
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return ts.updateExpressionStatement(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false));
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return ts.updateExpressionStatement(node, visitBinaryExpression(node.expression, /*needsDestructuringValue*/ false));
}
return ts.visitEachChild(node, visitor, context);
@@ -73458,9 +74296,9 @@
// expression. If we are in a state where we do not need the destructuring value,
// we pass that information along to the children that care about it.
switch (node.expression.kind) {
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return ts.updateParen(node, visitParenthesizedExpression(node.expression, /*needsDestructuringValue*/ false));
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return ts.updateParen(node, visitBinaryExpression(node.expression, /*needsDestructuringValue*/ false));
}
}
@@ -73495,7 +74333,7 @@
assignment = ts.flattenDestructuringAssignment(decl, visitor, context, 0 /* All */);
}
else {
- assignment = ts.createBinary(decl.name, 59 /* EqualsToken */, ts.visitNode(decl.initializer, visitor, ts.isExpression));
+ assignment = ts.createBinary(decl.name, 60 /* EqualsToken */, ts.visitNode(decl.initializer, visitor, ts.isExpression));
ts.setTextRange(assignment, decl);
}
assignments = ts.append(assignments, assignment);
@@ -73607,11 +74445,11 @@
&& isDeclaredInLoop
&& (hierarchyFacts & 512 /* IterationStatementBlock */) !== 0);
var emitExplicitInitializer = !emittedAsTopLevel
- && (hierarchyFacts & 2048 /* ForInOrForOfStatement */) === 0
+ && (hierarchyFacts & 4096 /* ForInOrForOfStatement */) === 0
&& (!resolver.isDeclarationWithCollidingName(node)
|| (isDeclaredInLoop
&& !isCapturedInFunction
- && (hierarchyFacts & (1024 /* ForStatement */ | 2048 /* ForInOrForOfStatement */)) === 0));
+ && (hierarchyFacts & (2048 /* ForStatement */ | 4096 /* ForInOrForOfStatement */)) === 0));
return emitExplicitInitializer;
}
/**
@@ -73669,34 +74507,34 @@
}
function visitIterationStatement(node, outermostLabeledStatement) {
switch (node.kind) {
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
return visitDoOrWhileStatement(node, outermostLabeledStatement);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return visitForStatement(node, outermostLabeledStatement);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return visitForInStatement(node, outermostLabeledStatement);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return visitForOfStatement(node, outermostLabeledStatement);
}
}
function visitIterationStatementWithFacts(excludeFacts, includeFacts, node, outermostLabeledStatement, convert) {
var ancestorFacts = enterSubtree(excludeFacts, includeFacts);
- var updated = convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert);
+ var updated = convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, ancestorFacts, convert);
exitSubtree(ancestorFacts, 0 /* None */, 0 /* None */);
return updated;
}
function visitDoOrWhileStatement(node, outermostLabeledStatement) {
- return visitIterationStatementWithFacts(0 /* DoOrWhileStatementExcludes */, 256 /* DoOrWhileStatementIncludes */, node, outermostLabeledStatement);
+ return visitIterationStatementWithFacts(0 /* DoOrWhileStatementExcludes */, 1280 /* DoOrWhileStatementIncludes */, node, outermostLabeledStatement);
}
function visitForStatement(node, outermostLabeledStatement) {
- return visitIterationStatementWithFacts(3008 /* ForStatementExcludes */, 1280 /* ForStatementIncludes */, node, outermostLabeledStatement);
+ return visitIterationStatementWithFacts(5056 /* ForStatementExcludes */, 3328 /* ForStatementIncludes */, node, outermostLabeledStatement);
}
function visitForInStatement(node, outermostLabeledStatement) {
- return visitIterationStatementWithFacts(1984 /* ForInOrForOfStatementExcludes */, 2304 /* ForInOrForOfStatementIncludes */, node, outermostLabeledStatement);
+ return visitIterationStatementWithFacts(3008 /* ForInOrForOfStatementExcludes */, 5376 /* ForInOrForOfStatementIncludes */, node, outermostLabeledStatement);
}
function visitForOfStatement(node, outermostLabeledStatement) {
- return visitIterationStatementWithFacts(1984 /* ForInOrForOfStatementExcludes */, 2304 /* ForInOrForOfStatementIncludes */, node, outermostLabeledStatement, compilerOptions.downlevelIteration ? convertForOfStatementForIterable : convertForOfStatementForArray);
+ return visitIterationStatementWithFacts(3008 /* ForInOrForOfStatementExcludes */, 5376 /* ForInOrForOfStatementIncludes */, node, outermostLabeledStatement, compilerOptions.downlevelIteration ? convertForOfStatementForIterable : convertForOfStatementForArray);
}
function convertForOfStatementHead(node, boundValue, convertedLoopBodyStatements) {
var statements = [];
@@ -73804,7 +74642,7 @@
ts.setTextRange(forStatement, node);
return ts.restoreEnclosingLabel(forStatement, outermostLabeledStatement, convertedLoopState && resetLabel);
}
- function convertForOfStatementForIterable(node, outermostLabeledStatement, convertedLoopBodyStatements) {
+ function convertForOfStatementForIterable(node, outermostLabeledStatement, convertedLoopBodyStatements, ancestorFacts) {
var expression = ts.visitNode(node.expression, visitor, ts.isExpression);
var iterator = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(expression) : ts.createTempVariable(/*recordTempVariable*/ undefined);
var result = ts.isIdentifier(expression) ? ts.getGeneratedNameForNode(iterator) : ts.createTempVariable(/*recordTempVariable*/ undefined);
@@ -73815,9 +74653,13 @@
var next = ts.createCall(ts.createPropertyAccess(iterator, "next"), /*typeArguments*/ undefined, []);
hoistVariableDeclaration(errorRecord);
hoistVariableDeclaration(returnMethod);
+ // if we are enclosed in an outer loop ensure we reset 'errorRecord' per each iteration
+ var initializer = ancestorFacts & 1024 /* IterationContainer */
+ ? ts.inlineExpressions([ts.createAssignment(errorRecord, ts.createVoidZero()), values])
+ : values;
var forStatement = ts.setEmitFlags(ts.setTextRange(ts.createFor(
/*initializer*/ ts.setEmitFlags(ts.setTextRange(ts.createVariableDeclarationList([
- ts.setTextRange(ts.createVariableDeclaration(iterator, /*type*/ undefined, values), node.expression),
+ ts.setTextRange(ts.createVariableDeclaration(iterator, /*type*/ undefined, initializer), node.expression),
ts.createVariableDeclaration(result, /*type*/ undefined, next)
]), node.expression), 2097152 /* NoHoisting */),
/*condition*/ ts.createLogicalNot(ts.createPropertyAccess(result, "done")),
@@ -73860,7 +74702,7 @@
&& i < numInitialPropertiesWithoutYield) {
numInitialPropertiesWithoutYield = i;
}
- if (property.name.kind === 149 /* ComputedPropertyName */) {
+ if (property.name.kind === 150 /* ComputedPropertyName */) {
numInitialProperties = i;
break;
}
@@ -73915,7 +74757,7 @@
}
visit(node.name);
function visit(node) {
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
state.hoistedLocalVariables.push(node);
}
else {
@@ -73928,7 +74770,7 @@
}
}
}
- function convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, convert) {
+ function convertIterationStatementBodyIfNecessary(node, outermostLabeledStatement, ancestorFacts, convert) {
if (!shouldConvertIterationStatement(node)) {
var saveAllowedNonLabeledJumps = void 0;
if (convertedLoopState) {
@@ -73938,7 +74780,7 @@
convertedLoopState.allowedNonLabeledJumps = 2 /* Break */ | 4 /* Continue */;
}
var result = convert
- ? convert(node, outermostLabeledStatement, /*convertedLoopBodyStatements*/ undefined)
+ ? convert(node, outermostLabeledStatement, /*convertedLoopBodyStatements*/ undefined, ancestorFacts)
: ts.restoreEnclosingLabel(ts.visitEachChild(node, visitor, context), outermostLabeledStatement, convertedLoopState && resetLabel);
if (convertedLoopState) {
convertedLoopState.allowedNonLabeledJumps = saveAllowedNonLabeledJumps;
@@ -73963,7 +74805,7 @@
var loop;
if (bodyFunction) {
if (convert) {
- loop = convert(node, outermostLabeledStatement, bodyFunction.part);
+ loop = convert(node, outermostLabeledStatement, bodyFunction.part, ancestorFacts);
}
else {
var clone_3 = convertIterationStatementCore(node, initializerFunction, ts.createBlock(bodyFunction.part, /*multiLine*/ true));
@@ -73981,11 +74823,11 @@
}
function convertIterationStatementCore(node, initializerFunction, convertedLoopBody) {
switch (node.kind) {
- case 225 /* ForStatement */: return convertForStatement(node, initializerFunction, convertedLoopBody);
- case 226 /* ForInStatement */: return convertForInStatement(node, convertedLoopBody);
- case 227 /* ForOfStatement */: return convertForOfStatement(node, convertedLoopBody);
- case 223 /* DoStatement */: return convertDoStatement(node, convertedLoopBody);
- case 224 /* WhileStatement */: return convertWhileStatement(node, convertedLoopBody);
+ case 226 /* ForStatement */: return convertForStatement(node, initializerFunction, convertedLoopBody);
+ case 227 /* ForInStatement */: return convertForInStatement(node, convertedLoopBody);
+ case 228 /* ForOfStatement */: return convertForOfStatement(node, convertedLoopBody);
+ case 224 /* DoStatement */: return convertDoStatement(node, convertedLoopBody);
+ case 225 /* WhileStatement */: return convertWhileStatement(node, convertedLoopBody);
default: return ts.Debug.failBadSyntaxKind(node, "IterationStatement expected");
}
}
@@ -74010,11 +74852,11 @@
function createConvertedLoopState(node) {
var loopInitializer;
switch (node.kind) {
- case 225 /* ForStatement */:
- case 226 /* ForInStatement */:
- case 227 /* ForOfStatement */:
+ case 226 /* ForStatement */:
+ case 227 /* ForInStatement */:
+ case 228 /* ForOfStatement */:
var initializer = node.initializer;
- if (initializer && initializer.kind === 238 /* VariableDeclarationList */) {
+ if (initializer && initializer.kind === 239 /* VariableDeclarationList */) {
loopInitializer = initializer;
}
break;
@@ -74276,7 +75118,7 @@
function copyOutParameter(outParam, copyDirection) {
var source = copyDirection === 0 /* ToOriginal */ ? outParam.outParamName : outParam.originalName;
var target = copyDirection === 0 /* ToOriginal */ ? outParam.originalName : outParam.outParamName;
- return ts.createBinary(target, 59 /* EqualsToken */, source);
+ return ts.createBinary(target, 60 /* EqualsToken */, source);
}
function copyOutParameters(outParams, partFlags, copyDirection, statements) {
for (var _i = 0, outParams_1 = outParams; _i < outParams_1.length; _i++) {
@@ -74413,20 +75255,20 @@
for (var i = start; i < numProperties; i++) {
var property = properties[i];
switch (property.kind) {
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
var accessors = ts.getAllAccessorDeclarations(node.properties, property);
if (property === accessors.firstAccessor) {
expressions.push(transformAccessorsToExpression(receiver, accessors, node, !!node.multiLine));
}
break;
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
expressions.push(transformObjectLiteralMethodDeclarationToExpression(property, receiver, node, node.multiLine));
break;
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
expressions.push(transformPropertyAssignmentToExpression(property, receiver, node.multiLine));
break;
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
expressions.push(transformShorthandPropertyAssignmentToExpression(property, receiver, node.multiLine));
break;
default:
@@ -74481,7 +75323,7 @@
return expression;
}
function visitCatchClause(node) {
- var ancestorFacts = enterSubtree(4032 /* BlockScopeExcludes */, 0 /* BlockScopeIncludes */);
+ var ancestorFacts = enterSubtree(7104 /* BlockScopeExcludes */, 0 /* BlockScopeIncludes */);
var updated;
ts.Debug.assert(!!node.variableDeclaration, "Catch clause variable should always be present when downleveling ES2015.");
if (ts.isBindingPattern(node.variableDeclaration.name)) {
@@ -74529,17 +75371,17 @@
ts.Debug.assert(!ts.isComputedPropertyName(node.name));
var savedConvertedLoopState = convertedLoopState;
convertedLoopState = undefined;
- var ancestorFacts = enterSubtree(8094 /* FunctionExcludes */, 65 /* FunctionIncludes */);
+ var ancestorFacts = enterSubtree(16286 /* FunctionExcludes */, 65 /* FunctionIncludes */);
var updated;
var parameters = ts.visitParameterList(node.parameters, visitor, context);
var body = transformFunctionBody(node);
- if (node.kind === 158 /* GetAccessor */) {
+ if (node.kind === 159 /* GetAccessor */) {
updated = ts.updateGetAccessor(node, node.decorators, node.modifiers, node.name, parameters, node.type, body);
}
else {
updated = ts.updateSetAccessor(node, node.decorators, node.modifiers, node.name, parameters, body);
}
- exitSubtree(ancestorFacts, 24576 /* FunctionSubtreeExcludes */, 0 /* None */);
+ exitSubtree(ancestorFacts, 49152 /* FunctionSubtreeExcludes */, 0 /* None */);
convertedLoopState = savedConvertedLoopState;
return updated;
}
@@ -74586,7 +75428,7 @@
return visitTypeScriptClassWrapper(node);
}
var expression = ts.skipOuterExpressions(node.expression);
- if (expression.kind === 98 /* SuperKeyword */ ||
+ if (expression.kind === 99 /* SuperKeyword */ ||
ts.isSuperProperty(expression) ||
ts.some(node.arguments, ts.isSpreadElement)) {
return visitCallExpressionWithPotentialCapturedThisAssignment(node, /*assignToCapturedThis*/ true);
@@ -74710,10 +75552,10 @@
// We are here either because SuperKeyword was used somewhere in the expression, or
// because we contain a SpreadElementExpression.
if (node.transformFlags & 4096 /* ContainsRestOrSpread */ ||
- node.expression.kind === 98 /* SuperKeyword */ ||
+ node.expression.kind === 99 /* SuperKeyword */ ||
ts.isSuperProperty(ts.skipOuterExpressions(node.expression))) {
var _a = ts.createCallBinding(node.expression, hoistVariableDeclaration), target = _a.target, thisArg = _a.thisArg;
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
ts.setEmitFlags(thisArg, 4 /* NoSubstitution */);
}
var resultingCall = void 0;
@@ -74731,7 +75573,7 @@
// _super.apply(this, a.concat([b]))
// _super.m.apply(this, a.concat([b]))
// _super.prototype.m.apply(this, a.concat([b]))
- resultingCall = ts.createFunctionApply(ts.visitNode(target, callExpressionVisitor, ts.isExpression), node.expression.kind === 98 /* SuperKeyword */ ? thisArg : ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false));
+ resultingCall = ts.createFunctionApply(ts.visitNode(target, callExpressionVisitor, ts.isExpression), node.expression.kind === 99 /* SuperKeyword */ ? thisArg : ts.visitNode(thisArg, visitor, ts.isExpression), transformAndSpreadElements(node.arguments, /*needsUniqueCopy*/ false, /*multiLine*/ false, /*hasTrailingComma*/ false));
}
else {
// [source]
@@ -74743,10 +75585,10 @@
// _super.call(this, a)
// _super.m.call(this, a)
// _super.prototype.m.call(this, a)
- resultingCall = ts.createFunctionCall(ts.visitNode(target, callExpressionVisitor, ts.isExpression), node.expression.kind === 98 /* SuperKeyword */ ? thisArg : ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression),
+ resultingCall = ts.createFunctionCall(ts.visitNode(target, callExpressionVisitor, ts.isExpression), node.expression.kind === 99 /* SuperKeyword */ ? thisArg : ts.visitNode(thisArg, visitor, ts.isExpression), ts.visitNodes(node.arguments, visitor, ts.isExpression),
/*location*/ node);
}
- if (node.expression.kind === 98 /* SuperKeyword */) {
+ if (node.expression.kind === 99 /* SuperKeyword */) {
var initializer = ts.createLogicalOr(resultingCall, createActualThis());
resultingCall = assignToCapturedThis
? ts.createAssignment(ts.createFileLevelUniqueName("_this"), initializer)
@@ -74809,7 +75651,7 @@
else {
if (segments.length === 1) {
var firstElement = elements[0];
- return needsUniqueCopy && ts.isSpreadElement(firstElement) && firstElement.expression.kind !== 187 /* ArrayLiteralExpression */
+ return needsUniqueCopy && ts.isSpreadElement(firstElement) && firstElement.expression.kind !== 188 /* ArrayLiteralExpression */
? ts.createArraySlice(segments[0])
: segments[0];
}
@@ -75024,8 +75866,8 @@
: ts.createFileLevelUniqueName("_super");
}
function visitMetaProperty(node) {
- if (node.keywordToken === 95 /* NewKeyword */ && node.name.escapedText === "target") {
- hierarchyFacts |= 8192 /* NewTarget */;
+ if (node.keywordToken === 96 /* NewKeyword */ && node.name.escapedText === "target") {
+ hierarchyFacts |= 16384 /* NewTarget */;
return ts.createFileLevelUniqueName("_newTarget");
}
return node;
@@ -75040,7 +75882,7 @@
function onEmitNode(hint, node, emitCallback) {
if (enabledSubstitutions & 1 /* CapturedThis */ && ts.isFunctionLike(node)) {
// If we are tracking a captured `this`, keep track of the enclosing function.
- var ancestorFacts = enterSubtree(8094 /* FunctionExcludes */, ts.getEmitFlags(node) & 8 /* CapturesThis */
+ var ancestorFacts = enterSubtree(16286 /* FunctionExcludes */, ts.getEmitFlags(node) & 8 /* CapturesThis */
? 65 /* FunctionIncludes */ | 16 /* CapturesThis */
: 65 /* FunctionIncludes */);
previousOnEmitNode(hint, node, emitCallback);
@@ -75056,7 +75898,7 @@
function enableSubstitutionsForBlockScopedBindings() {
if ((enabledSubstitutions & 2 /* BlockScopedBindings */) === 0) {
enabledSubstitutions |= 2 /* BlockScopedBindings */;
- context.enableSubstitution(72 /* Identifier */);
+ context.enableSubstitution(73 /* Identifier */);
}
}
/**
@@ -75066,14 +75908,14 @@
function enableSubstitutionsForCapturedThis() {
if ((enabledSubstitutions & 1 /* CapturedThis */) === 0) {
enabledSubstitutions |= 1 /* CapturedThis */;
- context.enableSubstitution(100 /* ThisKeyword */);
- context.enableEmitNotification(157 /* Constructor */);
- context.enableEmitNotification(156 /* MethodDeclaration */);
- context.enableEmitNotification(158 /* GetAccessor */);
- context.enableEmitNotification(159 /* SetAccessor */);
- context.enableEmitNotification(197 /* ArrowFunction */);
- context.enableEmitNotification(196 /* FunctionExpression */);
- context.enableEmitNotification(239 /* FunctionDeclaration */);
+ context.enableSubstitution(101 /* ThisKeyword */);
+ context.enableEmitNotification(158 /* Constructor */);
+ context.enableEmitNotification(157 /* MethodDeclaration */);
+ context.enableEmitNotification(159 /* GetAccessor */);
+ context.enableEmitNotification(160 /* SetAccessor */);
+ context.enableEmitNotification(198 /* ArrowFunction */);
+ context.enableEmitNotification(197 /* FunctionExpression */);
+ context.enableEmitNotification(240 /* FunctionDeclaration */);
}
}
/**
@@ -75114,10 +75956,10 @@
*/
function isNameOfDeclarationWithCollidingName(node) {
switch (node.parent.kind) {
- case 186 /* BindingElement */:
- case 240 /* ClassDeclaration */:
- case 243 /* EnumDeclaration */:
- case 237 /* VariableDeclaration */:
+ case 187 /* BindingElement */:
+ case 241 /* ClassDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 238 /* VariableDeclaration */:
return node.parent.name === node
&& resolver.isDeclarationWithCollidingName(node.parent);
}
@@ -75130,9 +75972,9 @@
*/
function substituteExpression(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return substituteExpressionIdentifier(node);
- case 100 /* ThisKeyword */:
+ case 101 /* ThisKeyword */:
return substituteThisKeyword(node);
}
return node;
@@ -75199,19 +76041,19 @@
return false;
}
var statement = ts.firstOrUndefined(constructor.body.statements);
- if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 221 /* ExpressionStatement */) {
+ if (!statement || !ts.nodeIsSynthesized(statement) || statement.kind !== 222 /* ExpressionStatement */) {
return false;
}
var statementExpression = statement.expression;
- if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 191 /* CallExpression */) {
+ if (!ts.nodeIsSynthesized(statementExpression) || statementExpression.kind !== 192 /* CallExpression */) {
return false;
}
var callTarget = statementExpression.expression;
- if (!ts.nodeIsSynthesized(callTarget) || callTarget.kind !== 98 /* SuperKeyword */) {
+ if (!ts.nodeIsSynthesized(callTarget) || callTarget.kind !== 99 /* SuperKeyword */) {
return false;
}
var callArgument = ts.singleOrUndefined(statementExpression.arguments);
- if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 208 /* SpreadElement */) {
+ if (!callArgument || !ts.nodeIsSynthesized(callArgument) || callArgument.kind !== 209 /* SpreadElement */) {
return false;
}
var expression = callArgument.expression;
@@ -75264,15 +76106,15 @@
if (compilerOptions.jsx === 1 /* Preserve */ || compilerOptions.jsx === 3 /* ReactNative */) {
previousOnEmitNode = context.onEmitNode;
context.onEmitNode = onEmitNode;
- context.enableEmitNotification(262 /* JsxOpeningElement */);
- context.enableEmitNotification(263 /* JsxClosingElement */);
- context.enableEmitNotification(261 /* JsxSelfClosingElement */);
+ context.enableEmitNotification(263 /* JsxOpeningElement */);
+ context.enableEmitNotification(264 /* JsxClosingElement */);
+ context.enableEmitNotification(262 /* JsxSelfClosingElement */);
noSubstitution = [];
}
var previousOnSubstituteNode = context.onSubstituteNode;
context.onSubstituteNode = onSubstituteNode;
- context.enableSubstitution(189 /* PropertyAccessExpression */);
- context.enableSubstitution(275 /* PropertyAssignment */);
+ context.enableSubstitution(190 /* PropertyAccessExpression */);
+ context.enableSubstitution(276 /* PropertyAssignment */);
return ts.chainBundle(transformSourceFile);
/**
* Transforms an ES5 source file to ES3.
@@ -75291,9 +76133,9 @@
*/
function onEmitNode(hint, node, emitCallback) {
switch (node.kind) {
- case 262 /* JsxOpeningElement */:
- case 263 /* JsxClosingElement */:
- case 261 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
+ case 264 /* JsxClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
var tagName = node.tagName;
noSubstitution[ts.getOriginalNodeId(tagName)] = true;
break;
@@ -75350,7 +76192,7 @@
*/
function trySubstituteReservedName(name) {
var token = name.originalKeywordKind || (ts.nodeIsSynthesized(name) ? ts.stringToToken(ts.idText(name)) : undefined);
- if (token !== undefined && token >= 73 /* FirstReservedWord */ && token <= 108 /* LastReservedWord */) {
+ if (token !== undefined && token >= 74 /* FirstReservedWord */ && token <= 109 /* LastReservedWord */) {
return ts.setTextRange(ts.createLiteral(name), name);
}
return undefined;
@@ -75625,13 +76467,13 @@
*/
function visitJavaScriptInStatementContainingYield(node) {
switch (node.kind) {
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
return visitDoStatement(node);
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
return visitWhileStatement(node);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return visitSwitchStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return visitLabeledStatement(node);
default:
return visitJavaScriptInGeneratorFunctionBody(node);
@@ -75644,24 +76486,24 @@
*/
function visitJavaScriptInGeneratorFunctionBody(node) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return visitFunctionDeclaration(node);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return visitFunctionExpression(node);
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return visitAccessorDeclaration(node);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return visitVariableStatement(node);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return visitForStatement(node);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return visitForInStatement(node);
- case 229 /* BreakStatement */:
+ case 230 /* BreakStatement */:
return visitBreakStatement(node);
- case 228 /* ContinueStatement */:
+ case 229 /* ContinueStatement */:
return visitContinueStatement(node);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return visitReturnStatement(node);
default:
if (node.transformFlags & 131072 /* ContainsYield */) {
@@ -75682,21 +76524,21 @@
*/
function visitJavaScriptContainingYield(node) {
switch (node.kind) {
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return visitBinaryExpression(node);
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return visitConditionalExpression(node);
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return visitYieldExpression(node);
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return visitArrayLiteralExpression(node);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return visitObjectLiteralExpression(node);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return visitElementAccessExpression(node);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return visitCallExpression(node);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return visitNewExpression(node);
default:
return ts.visitEachChild(node, visitor, context);
@@ -75709,9 +76551,9 @@
*/
function visitGenerator(node) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return visitFunctionDeclaration(node);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return visitFunctionExpression(node);
default:
return ts.Debug.failBadSyntaxKind(node);
@@ -75910,23 +76752,23 @@
}
}
function isCompoundAssignment(kind) {
- return kind >= 60 /* FirstCompoundAssignment */
- && kind <= 71 /* LastCompoundAssignment */;
+ return kind >= 61 /* FirstCompoundAssignment */
+ && kind <= 72 /* LastCompoundAssignment */;
}
function getOperatorForCompoundAssignment(kind) {
switch (kind) {
- case 60 /* PlusEqualsToken */: return 38 /* PlusToken */;
- case 61 /* MinusEqualsToken */: return 39 /* MinusToken */;
- case 62 /* AsteriskEqualsToken */: return 40 /* AsteriskToken */;
- case 63 /* AsteriskAsteriskEqualsToken */: return 41 /* AsteriskAsteriskToken */;
- case 64 /* SlashEqualsToken */: return 42 /* SlashToken */;
- case 65 /* PercentEqualsToken */: return 43 /* PercentToken */;
- case 66 /* LessThanLessThanEqualsToken */: return 46 /* LessThanLessThanToken */;
- case 67 /* GreaterThanGreaterThanEqualsToken */: return 47 /* GreaterThanGreaterThanToken */;
- case 68 /* GreaterThanGreaterThanGreaterThanEqualsToken */: return 48 /* GreaterThanGreaterThanGreaterThanToken */;
- case 69 /* AmpersandEqualsToken */: return 49 /* AmpersandToken */;
- case 70 /* BarEqualsToken */: return 50 /* BarToken */;
- case 71 /* CaretEqualsToken */: return 51 /* CaretToken */;
+ case 61 /* PlusEqualsToken */: return 38 /* PlusToken */;
+ case 62 /* MinusEqualsToken */: return 39 /* MinusToken */;
+ case 63 /* AsteriskEqualsToken */: return 40 /* AsteriskToken */;
+ case 64 /* AsteriskAsteriskEqualsToken */: return 41 /* AsteriskAsteriskToken */;
+ case 65 /* SlashEqualsToken */: return 42 /* SlashToken */;
+ case 66 /* PercentEqualsToken */: return 43 /* PercentToken */;
+ case 67 /* LessThanLessThanEqualsToken */: return 46 /* LessThanLessThanToken */;
+ case 68 /* GreaterThanGreaterThanEqualsToken */: return 47 /* GreaterThanGreaterThanToken */;
+ case 69 /* GreaterThanGreaterThanGreaterThanEqualsToken */: return 48 /* GreaterThanGreaterThanGreaterThanToken */;
+ case 70 /* AmpersandEqualsToken */: return 49 /* AmpersandToken */;
+ case 71 /* BarEqualsToken */: return 50 /* BarToken */;
+ case 72 /* CaretEqualsToken */: return 51 /* CaretToken */;
}
}
/**
@@ -75939,7 +76781,7 @@
if (containsYield(right)) {
var target = void 0;
switch (left.kind) {
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
// [source]
// a.b = yield;
//
@@ -75951,7 +76793,7 @@
// _a.b = %sent%;
target = ts.updatePropertyAccess(left, cacheExpression(ts.visitNode(left.expression, visitor, ts.isLeftHandSideExpression)), left.name);
break;
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
// [source]
// a[b] = yield;
//
@@ -76327,35 +77169,35 @@
}
function transformAndEmitStatementWorker(node) {
switch (node.kind) {
- case 218 /* Block */:
+ case 219 /* Block */:
return transformAndEmitBlock(node);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return transformAndEmitExpressionStatement(node);
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
return transformAndEmitIfStatement(node);
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
return transformAndEmitDoStatement(node);
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
return transformAndEmitWhileStatement(node);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return transformAndEmitForStatement(node);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return transformAndEmitForInStatement(node);
- case 228 /* ContinueStatement */:
+ case 229 /* ContinueStatement */:
return transformAndEmitContinueStatement(node);
- case 229 /* BreakStatement */:
+ case 230 /* BreakStatement */:
return transformAndEmitBreakStatement(node);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return transformAndEmitReturnStatement(node);
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
return transformAndEmitWithStatement(node);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return transformAndEmitSwitchStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return transformAndEmitLabeledStatement(node);
- case 234 /* ThrowStatement */:
+ case 235 /* ThrowStatement */:
return transformAndEmitThrowStatement(node);
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
return transformAndEmitTryStatement(node);
default:
return emitStatement(ts.visitNode(node, visitor, ts.isStatement));
@@ -76785,7 +77627,7 @@
for (var i = 0; i < numClauses; i++) {
var clause = caseBlock.clauses[i];
clauseLabels.push(defineLabel());
- if (clause.kind === 272 /* DefaultClause */ && defaultClauseIndex === -1) {
+ if (clause.kind === 273 /* DefaultClause */ && defaultClauseIndex === -1) {
defaultClauseIndex = i;
}
}
@@ -76798,7 +77640,7 @@
var defaultClausesSkipped = 0;
for (var i = clausesWritten; i < numClauses; i++) {
var clause = caseBlock.clauses[i];
- if (clause.kind === 271 /* CaseClause */) {
+ if (clause.kind === 272 /* CaseClause */) {
if (containsYield(clause.expression) && pendingClauses.length > 0) {
break;
}
@@ -77110,7 +77952,7 @@
if (!renamedCatchVariables) {
renamedCatchVariables = ts.createMap();
renamedCatchVariableDeclarations = [];
- context.enableSubstitution(72 /* Identifier */);
+ context.enableSubstitution(73 /* Identifier */);
}
renamedCatchVariables.set(text, true);
renamedCatchVariableDeclarations[ts.getOriginalNodeId(variable)] = name;
@@ -78026,12 +78868,12 @@
var previousOnEmitNode = context.onEmitNode;
context.onSubstituteNode = onSubstituteNode;
context.onEmitNode = onEmitNode;
- context.enableSubstitution(72 /* Identifier */); // Substitutes expression identifiers with imported/exported symbols.
- context.enableSubstitution(204 /* BinaryExpression */); // Substitutes assignments to exported symbols.
- context.enableSubstitution(202 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols.
- context.enableSubstitution(203 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols.
- context.enableSubstitution(276 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols.
- context.enableEmitNotification(284 /* SourceFile */); // Restore state when substituting nodes in a file.
+ context.enableSubstitution(73 /* Identifier */); // Substitutes expression identifiers with imported/exported symbols.
+ context.enableSubstitution(205 /* BinaryExpression */); // Substitutes assignments to exported symbols.
+ context.enableSubstitution(203 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols.
+ context.enableSubstitution(204 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols.
+ context.enableSubstitution(277 /* ShorthandPropertyAssignment */); // Substitutes shorthand property assignments for imported/exported symbols.
+ context.enableEmitNotification(285 /* SourceFile */); // Restore state when substituting nodes in a file.
var moduleInfoMap = []; // The ExternalModuleInfo for each file.
var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found.
var currentSourceFile; // The current file.
@@ -78359,23 +79201,23 @@
*/
function sourceElementVisitor(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return visitImportDeclaration(node);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return visitImportEqualsDeclaration(node);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return visitExportDeclaration(node);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return visitExportAssignment(node);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return visitVariableStatement(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return visitFunctionDeclaration(node);
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return visitClassDeclaration(node);
- case 315 /* MergeDeclarationMarker */:
+ case 316 /* MergeDeclarationMarker */:
return visitMergeDeclarationMarker(node);
- case 316 /* EndOfDeclarationMarker */:
+ case 317 /* EndOfDeclarationMarker */:
return visitEndOfDeclarationMarker(node);
default:
return ts.visitEachChild(node, moduleExpressionElementVisitor, context);
@@ -78402,24 +79244,24 @@
for (var _i = 0, _a = node.properties; _i < _a.length; _i++) {
var elem = _a[_i];
switch (elem.kind) {
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
if (destructuringNeedsFlattening(elem.initializer)) {
return true;
}
break;
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
if (destructuringNeedsFlattening(elem.name)) {
return true;
}
break;
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
if (destructuringNeedsFlattening(elem.expression)) {
return true;
}
break;
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return false;
default: ts.Debug.assertNever(elem, "Unhandled object member kind");
}
@@ -78897,7 +79739,7 @@
//
// To balance the declaration, add the exports of the elided variable
// statement.
- if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 219 /* VariableStatement */) {
+ if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 220 /* VariableStatement */) {
var id = ts.getOriginalNodeId(node);
deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original);
}
@@ -78952,10 +79794,10 @@
var namedBindings = importClause.namedBindings;
if (namedBindings) {
switch (namedBindings.kind) {
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
statements = appendExportsOfDeclaration(statements, namedBindings);
break;
- case 252 /* NamedImports */:
+ case 253 /* NamedImports */:
for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) {
var importBinding = _a[_i];
statements = appendExportsOfDeclaration(statements, importBinding);
@@ -79137,8 +79979,8 @@
function modifierVisitor(node) {
// Elide module-specific modifiers.
switch (node.kind) {
- case 85 /* ExportKeyword */:
- case 80 /* DefaultKeyword */:
+ case 86 /* ExportKeyword */:
+ case 81 /* DefaultKeyword */:
return undefined;
}
return node;
@@ -79154,7 +79996,7 @@
* @param emit A callback used to emit the node in the printer.
*/
function onEmitNode(hint, node, emitCallback) {
- if (node.kind === 284 /* SourceFile */) {
+ if (node.kind === 285 /* SourceFile */) {
currentSourceFile = node;
currentModuleInfo = moduleInfoMap[ts.getOriginalNodeId(currentSourceFile)];
noSubstitution = [];
@@ -79216,12 +80058,12 @@
*/
function substituteExpression(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return substituteExpressionIdentifier(node);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return substituteBinaryExpression(node);
- case 203 /* PostfixUnaryExpression */:
- case 202 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return substituteUnaryExpression(node);
}
return node;
@@ -79242,7 +80084,7 @@
}
if (!ts.isGeneratedIdentifier(node) && !ts.isLocalName(node)) {
var exportContainer = resolver.getReferencedExportContainer(node, ts.isExportName(node));
- if (exportContainer && exportContainer.kind === 284 /* SourceFile */) {
+ if (exportContainer && exportContainer.kind === 285 /* SourceFile */) {
return ts.setTextRange(ts.createPropertyAccess(ts.createIdentifier("exports"), ts.getSynthesizedClone(node)),
/*location*/ node);
}
@@ -79317,8 +80159,8 @@
&& !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) {
var exportedNames = getExports(node.operand);
if (exportedNames) {
- var expression = node.kind === 203 /* PostfixUnaryExpression */
- ? ts.setTextRange(ts.createBinary(node.operand, ts.createToken(node.operator === 44 /* PlusPlusToken */ ? 60 /* PlusEqualsToken */ : 61 /* MinusEqualsToken */), ts.createLiteral(1)),
+ var expression = node.kind === 204 /* PostfixUnaryExpression */
+ ? ts.setTextRange(ts.createBinary(node.operand, ts.createToken(node.operator === 44 /* PlusPlusToken */ ? 61 /* PlusEqualsToken */ : 62 /* MinusEqualsToken */), ts.createLiteral(1)),
/*location*/ node)
: node;
for (var _i = 0, exportedNames_3 = exportedNames; _i < exportedNames_3.length; _i++) {
@@ -79392,12 +80234,12 @@
var previousOnEmitNode = context.onEmitNode;
context.onSubstituteNode = onSubstituteNode;
context.onEmitNode = onEmitNode;
- context.enableSubstitution(72 /* Identifier */); // Substitutes expression identifiers for imported symbols.
- context.enableSubstitution(276 /* ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols
- context.enableSubstitution(204 /* BinaryExpression */); // Substitutes assignments to exported symbols.
- context.enableSubstitution(202 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols.
- context.enableSubstitution(203 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols.
- context.enableEmitNotification(284 /* SourceFile */); // Restore state when substituting nodes in a file.
+ context.enableSubstitution(73 /* Identifier */); // Substitutes expression identifiers for imported symbols.
+ context.enableSubstitution(277 /* ShorthandPropertyAssignment */); // Substitutes expression identifiers for imported symbols
+ context.enableSubstitution(205 /* BinaryExpression */); // Substitutes assignments to exported symbols.
+ context.enableSubstitution(203 /* PrefixUnaryExpression */); // Substitutes updates to exported symbols.
+ context.enableSubstitution(204 /* PostfixUnaryExpression */); // Substitutes updates to exported symbols.
+ context.enableEmitNotification(285 /* SourceFile */); // Restore state when substituting nodes in a file.
var moduleInfoMap = []; // The ExternalModuleInfo for each file.
var deferredExports = []; // Exports to defer until an EndOfDeclarationMarker is found.
var exportFunctionsMap = []; // The export function associated with a source file.
@@ -79618,7 +80460,7 @@
var hasExportDeclarationWithExportClause = false;
for (var _i = 0, _a = moduleInfo.externalImports; _i < _a.length; _i++) {
var externalImport = _a[_i];
- if (externalImport.kind === 255 /* ExportDeclaration */ && externalImport.exportClause) {
+ if (externalImport.kind === 256 /* ExportDeclaration */ && externalImport.exportClause) {
hasExportDeclarationWithExportClause = true;
break;
}
@@ -79643,7 +80485,7 @@
}
for (var _d = 0, _e = moduleInfo.externalImports; _d < _e.length; _d++) {
var externalImport = _e[_d];
- if (externalImport.kind !== 255 /* ExportDeclaration */) {
+ if (externalImport.kind !== 256 /* ExportDeclaration */) {
continue;
}
if (!externalImport.exportClause) {
@@ -79721,19 +80563,19 @@
var entry = _b[_a];
var importVariableName = ts.getLocalNameForExternalImport(entry, currentSourceFile); // TODO: GH#18217
switch (entry.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
if (!entry.importClause) {
// 'import "..."' case
// module is imported only for side-effects, no emit required
break;
}
// falls through
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
ts.Debug.assert(importVariableName !== undefined);
// save import into the local
statements.push(ts.createExpressionStatement(ts.createAssignment(importVariableName, parameterName)));
break;
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
ts.Debug.assert(importVariableName !== undefined);
if (entry.exportClause) {
// export {a, b as c} from 'foo'
@@ -79783,15 +80625,15 @@
*/
function sourceElementVisitor(node) {
switch (node.kind) {
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return visitImportDeclaration(node);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return visitImportEqualsDeclaration(node);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
// ExportDeclarations are elided as they are handled via
// `appendExportsOfDeclaration`.
return undefined;
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return visitExportAssignment(node);
default:
return nestedElementVisitor(node);
@@ -79967,7 +80809,7 @@
function shouldHoistVariableDeclarationList(node) {
// hoist only non-block scoped declarations or block scoped declarations parented by source file
return (ts.getEmitFlags(node) & 2097152 /* NoHoisting */) === 0
- && (enclosingBlockScopedContainer.kind === 284 /* SourceFile */
+ && (enclosingBlockScopedContainer.kind === 285 /* SourceFile */
|| (ts.getOriginalNode(node).flags & 3 /* BlockScoped */) === 0);
}
/**
@@ -80031,7 +80873,7 @@
//
// To balance the declaration, we defer the exports of the elided variable
// statement until we visit this declaration's `EndOfDeclarationMarker`.
- if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 219 /* VariableStatement */) {
+ if (hasAssociatedEndOfDeclarationMarker(node) && node.original.kind === 220 /* VariableStatement */) {
var id = ts.getOriginalNodeId(node);
var isExportedDeclaration = ts.hasModifier(node.original, 1 /* Export */);
deferredExports[id] = appendExportsOfVariableStatement(deferredExports[id], node.original, isExportedDeclaration);
@@ -80093,10 +80935,10 @@
var namedBindings = importClause.namedBindings;
if (namedBindings) {
switch (namedBindings.kind) {
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
statements = appendExportsOfDeclaration(statements, namedBindings);
break;
- case 252 /* NamedImports */:
+ case 253 /* NamedImports */:
for (var _i = 0, _a = namedBindings.elements; _i < _a.length; _i++) {
var importBinding = _a[_i];
statements = appendExportsOfDeclaration(statements, importBinding);
@@ -80276,43 +81118,43 @@
*/
function nestedElementVisitor(node) {
switch (node.kind) {
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return visitVariableStatement(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return visitFunctionDeclaration(node);
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return visitClassDeclaration(node);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return visitForStatement(node);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return visitForInStatement(node);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return visitForOfStatement(node);
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
return visitDoStatement(node);
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
return visitWhileStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return visitLabeledStatement(node);
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
return visitWithStatement(node);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return visitSwitchStatement(node);
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
return visitCaseBlock(node);
- case 271 /* CaseClause */:
+ case 272 /* CaseClause */:
return visitCaseClause(node);
- case 272 /* DefaultClause */:
+ case 273 /* DefaultClause */:
return visitDefaultClause(node);
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
return visitTryStatement(node);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return visitCatchClause(node);
- case 218 /* Block */:
+ case 219 /* Block */:
return visitBlock(node);
- case 315 /* MergeDeclarationMarker */:
+ case 316 /* MergeDeclarationMarker */:
return visitMergeDeclarationMarker(node);
- case 316 /* EndOfDeclarationMarker */:
+ case 317 /* EndOfDeclarationMarker */:
return visitEndOfDeclarationMarker(node);
default:
return destructuringAndImportCallVisitor(node);
@@ -80559,7 +81401,7 @@
}
else if (ts.isIdentifier(node)) {
var container = resolver.getReferencedExportContainer(node);
- return container !== undefined && container.kind === 284 /* SourceFile */;
+ return container !== undefined && container.kind === 285 /* SourceFile */;
}
else {
return false;
@@ -80575,8 +81417,8 @@
*/
function modifierVisitor(node) {
switch (node.kind) {
- case 85 /* ExportKeyword */:
- case 80 /* DefaultKeyword */:
+ case 86 /* ExportKeyword */:
+ case 81 /* DefaultKeyword */:
return undefined;
}
return node;
@@ -80592,7 +81434,7 @@
* @param emitCallback A callback used to emit the node in the printer.
*/
function onEmitNode(hint, node, emitCallback) {
- if (node.kind === 284 /* SourceFile */) {
+ if (node.kind === 285 /* SourceFile */) {
var id = ts.getOriginalNodeId(node);
currentSourceFile = node;
moduleInfo = moduleInfoMap[id];
@@ -80640,7 +81482,7 @@
*/
function substituteUnspecified(node) {
switch (node.kind) {
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return substituteShorthandPropertyAssignment(node);
}
return node;
@@ -80674,12 +81516,12 @@
*/
function substituteExpression(node) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return substituteExpressionIdentifier(node);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return substituteBinaryExpression(node);
- case 202 /* PrefixUnaryExpression */:
- case 203 /* PostfixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return substituteUnaryExpression(node);
}
return node;
@@ -80772,14 +81614,14 @@
&& !ts.isDeclarationNameOfEnumOrNamespace(node.operand)) {
var exportedNames = getExports(node.operand);
if (exportedNames) {
- var expression = node.kind === 203 /* PostfixUnaryExpression */
+ var expression = node.kind === 204 /* PostfixUnaryExpression */
? ts.setTextRange(ts.createPrefix(node.operator, node.operand), node)
: node;
for (var _i = 0, exportedNames_5 = exportedNames; _i < exportedNames_5.length; _i++) {
var exportName = exportedNames_5[_i];
expression = createExportExpression(exportName, preventSubstitution(expression));
}
- if (node.kind === 203 /* PostfixUnaryExpression */) {
+ if (node.kind === 204 /* PostfixUnaryExpression */) {
expression = node.operator === 44 /* PlusPlusToken */
? ts.createSubtract(preventSubstitution(expression), ts.createLiteral(1))
: ts.createAdd(preventSubstitution(expression), ts.createLiteral(1));
@@ -80801,7 +81643,7 @@
|| resolver.getReferencedValueDeclaration(name);
if (valueDeclaration) {
var exportContainer = resolver.getReferencedExportContainer(name, /*prefixLocals*/ false);
- if (exportContainer && exportContainer.kind === 284 /* SourceFile */) {
+ if (exportContainer && exportContainer.kind === 285 /* SourceFile */) {
exportedNames = ts.append(exportedNames, ts.getDeclarationName(valueDeclaration));
}
exportedNames = ts.addRange(exportedNames, moduleInfo && moduleInfo.exportedBindings[ts.getOriginalNodeId(valueDeclaration)]);
@@ -80840,8 +81682,8 @@
var previousOnSubstituteNode = context.onSubstituteNode;
context.onEmitNode = onEmitNode;
context.onSubstituteNode = onSubstituteNode;
- context.enableEmitNotification(284 /* SourceFile */);
- context.enableSubstitution(72 /* Identifier */);
+ context.enableEmitNotification(285 /* SourceFile */);
+ context.enableSubstitution(73 /* Identifier */);
var currentSourceFile;
return ts.chainBundle(transformSourceFile);
function transformSourceFile(node) {
@@ -80869,10 +81711,10 @@
}
function visitor(node) {
switch (node.kind) {
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
// Elide `import=` as it is not legal with --module ES6
return undefined;
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return visitExportAssignment(node);
}
return node;
@@ -80980,7 +81822,7 @@
ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1;
}
- else if (node.parent.kind === 240 /* ClassDeclaration */) {
+ else if (node.parent.kind === 241 /* ClassDeclaration */) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -81009,7 +81851,7 @@
ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Public_static_method_0_of_exported_class_has_or_is_using_private_name_1;
}
- else if (node.parent.kind === 240 /* ClassDeclaration */) {
+ else if (node.parent.kind === 241 /* ClassDeclaration */) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Public_method_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -81056,7 +81898,7 @@
return ts.Debug.assertNever(node, "Attempted to set a declaration diagnostic context for unhandled node kind: " + ts.SyntaxKind[node.kind]);
}
function getVariableDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
- if (node.kind === 237 /* VariableDeclaration */ || node.kind === 186 /* BindingElement */) {
+ if (node.kind === 238 /* VariableDeclaration */ || node.kind === 187 /* BindingElement */) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Exported_variable_0_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -81065,8 +81907,8 @@
}
// This check is to ensure we don't report error on constructor parameter property as that error would be reported during parameter emit
// The only exception here is if the constructor was marked as private. we are not emitting the constructor parameters at all.
- else if (node.kind === 154 /* PropertyDeclaration */ || node.kind === 189 /* PropertyAccessExpression */ || node.kind === 153 /* PropertySignature */ ||
- (node.kind === 151 /* Parameter */ && ts.hasModifier(node.parent, 8 /* Private */))) {
+ else if (node.kind === 155 /* PropertyDeclaration */ || node.kind === 190 /* PropertyAccessExpression */ || node.kind === 154 /* PropertySignature */ ||
+ (node.kind === 152 /* Parameter */ && ts.hasModifier(node.parent, 8 /* Private */))) {
// TODO(jfreeman): Deal with computed properties in error reporting.
if (ts.hasModifier(node, 32 /* Static */)) {
return symbolAccessibilityResult.errorModuleName ?
@@ -81075,7 +81917,7 @@
ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Public_static_property_0_of_exported_class_has_or_is_using_private_name_1;
}
- else if (node.parent.kind === 240 /* ClassDeclaration */ || node.kind === 151 /* Parameter */) {
+ else if (node.parent.kind === 241 /* ClassDeclaration */ || node.kind === 152 /* Parameter */) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Public_property_0_of_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -81100,7 +81942,7 @@
}
function getAccessorDeclarationTypeVisibilityError(symbolAccessibilityResult) {
var diagnosticMessage;
- if (node.kind === 159 /* SetAccessor */) {
+ if (node.kind === 160 /* SetAccessor */) {
// Getters can infer the return type from the returned expression, but setters cannot, so the
// "_from_external_module_1_but_cannot_be_named" case cannot occur.
if (ts.hasModifier(node, 32 /* Static */)) {
@@ -81139,26 +81981,26 @@
function getReturnTypeVisibilityError(symbolAccessibilityResult) {
var diagnosticMessage;
switch (node.kind) {
- case 161 /* ConstructSignature */:
+ case 162 /* ConstructSignature */:
// Interfaces cannot have return types that cannot be named
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
ts.Diagnostics.Return_type_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_0;
break;
- case 160 /* CallSignature */:
+ case 161 /* CallSignature */:
// Interfaces cannot have return types that cannot be named
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
ts.Diagnostics.Return_type_of_call_signature_from_exported_interface_has_or_is_using_private_name_0;
break;
- case 162 /* IndexSignature */:
+ case 163 /* IndexSignature */:
// Interfaces cannot have return types that cannot be named
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_name_0_from_private_module_1 :
ts.Diagnostics.Return_type_of_index_signature_from_exported_interface_has_or_is_using_private_name_0;
break;
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
if (ts.hasModifier(node, 32 /* Static */)) {
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
@@ -81166,7 +82008,7 @@
ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_name_0_from_private_module_1 :
ts.Diagnostics.Return_type_of_public_static_method_from_exported_class_has_or_is_using_private_name_0;
}
- else if (node.parent.kind === 240 /* ClassDeclaration */) {
+ else if (node.parent.kind === 241 /* ClassDeclaration */) {
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Return_type_of_public_method_from_exported_class_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
@@ -81180,7 +82022,7 @@
ts.Diagnostics.Return_type_of_method_from_exported_interface_has_or_is_using_private_name_0;
}
break;
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
diagnosticMessage = symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Return_type_of_exported_function_has_or_is_using_name_0_from_external_module_1_but_cannot_be_named :
@@ -81205,30 +82047,30 @@
}
function getParameterDeclarationTypeVisibilityDiagnosticMessage(symbolAccessibilityResult) {
switch (node.parent.kind) {
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_constructor_from_exported_class_has_or_is_using_private_name_1;
- case 161 /* ConstructSignature */:
- case 166 /* ConstructorType */:
+ case 162 /* ConstructSignature */:
+ case 167 /* ConstructorType */:
// Interfaces cannot have parameter types that cannot be named
return symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;
- case 160 /* CallSignature */:
+ case 161 /* CallSignature */:
// Interfaces cannot have parameter types that cannot be named
return symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;
- case 162 /* IndexSignature */:
+ case 163 /* IndexSignature */:
// Interfaces cannot have parameter types that cannot be named
return symbolAccessibilityResult.errorModuleName ?
ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_index_signature_from_exported_interface_has_or_is_using_private_name_1;
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
if (ts.hasModifier(node.parent, 32 /* Static */)) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
@@ -81236,7 +82078,7 @@
ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1;
}
- else if (node.parent.parent.kind === 240 /* ClassDeclaration */) {
+ else if (node.parent.parent.kind === 241 /* ClassDeclaration */) {
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Parameter_0_of_public_method_from_exported_class_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -81249,8 +82091,8 @@
ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_name_1_from_private_module_2 :
ts.Diagnostics.Parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1;
}
- case 239 /* FunctionDeclaration */:
- case 165 /* FunctionType */:
+ case 240 /* FunctionDeclaration */:
+ case 166 /* FunctionType */:
return symbolAccessibilityResult.errorModuleName ?
symbolAccessibilityResult.accessibility === 2 /* CannotBeNamed */ ?
ts.Diagnostics.Parameter_0_of_exported_function_has_or_is_using_name_1_from_external_module_2_but_cannot_be_named :
@@ -81264,39 +82106,39 @@
// Type parameter constraints are named by user so we should always be able to name it
var diagnosticMessage;
switch (node.parent.kind) {
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_class_has_or_is_using_private_name_1;
break;
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_interface_has_or_is_using_private_name_1;
break;
- case 181 /* MappedType */:
+ case 182 /* MappedType */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_mapped_object_type_is_using_private_name_1;
break;
- case 166 /* ConstructorType */:
- case 161 /* ConstructSignature */:
+ case 167 /* ConstructorType */:
+ case 162 /* ConstructSignature */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_constructor_signature_from_exported_interface_has_or_is_using_private_name_1;
break;
- case 160 /* CallSignature */:
+ case 161 /* CallSignature */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_call_signature_from_exported_interface_has_or_is_using_private_name_1;
break;
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
if (ts.hasModifier(node.parent, 32 /* Static */)) {
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_static_method_from_exported_class_has_or_is_using_private_name_1;
}
- else if (node.parent.parent.kind === 240 /* ClassDeclaration */) {
+ else if (node.parent.parent.kind === 241 /* ClassDeclaration */) {
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_public_method_from_exported_class_has_or_is_using_private_name_1;
}
else {
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_method_from_exported_interface_has_or_is_using_private_name_1;
}
break;
- case 165 /* FunctionType */:
- case 239 /* FunctionDeclaration */:
+ case 166 /* FunctionType */:
+ case 240 /* FunctionDeclaration */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_function_has_or_is_using_private_name_1;
break;
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
diagnosticMessage = ts.Diagnostics.Type_parameter_0_of_exported_type_alias_has_or_is_using_private_name_1;
break;
default:
@@ -81311,9 +82153,9 @@
function getHeritageClauseVisibilityError() {
var diagnosticMessage;
// Heritage clause is written by user so it can always be named
- if (node.parent.parent.kind === 240 /* ClassDeclaration */) {
+ if (node.parent.parent.kind === 241 /* ClassDeclaration */) {
// Class or Interface implemented/extended is inaccessible
- diagnosticMessage = ts.isHeritageClause(node.parent) && node.parent.token === 109 /* ImplementsKeyword */ ?
+ diagnosticMessage = ts.isHeritageClause(node.parent) && node.parent.token === 110 /* ImplementsKeyword */ ?
ts.Diagnostics.Implements_clause_of_exported_class_0_has_or_is_using_private_name_1 :
ts.Diagnostics.extends_clause_of_exported_class_0_has_or_is_using_private_name_1;
}
@@ -81362,7 +82204,7 @@
}
function isInternalDeclaration(node, currentSourceFile) {
var parseTreeNode = ts.getParseTreeNode(node);
- if (parseTreeNode && parseTreeNode.kind === 151 /* Parameter */) {
+ if (parseTreeNode && parseTreeNode.kind === 152 /* Parameter */) {
var paramIdx = parseTreeNode.parent.parameters.indexOf(parseTreeNode);
var previousSibling = paramIdx > 0 ? parseTreeNode.parent.parameters[paramIdx - 1] : undefined;
var text = currentSourceFile.text;
@@ -81509,10 +82351,10 @@
}
}
function transformRoot(node) {
- if (node.kind === 284 /* SourceFile */ && (node.isDeclarationFile || ts.isSourceFileJS(node))) {
+ if (node.kind === 285 /* SourceFile */ && (node.isDeclarationFile || ts.isSourceFileJS(node))) {
return node;
}
- if (node.kind === 285 /* Bundle */) {
+ if (node.kind === 286 /* Bundle */) {
isBundledEmit = true;
refs = ts.createMap();
libs = ts.createMap();
@@ -81535,14 +82377,14 @@
resultHasExternalModuleIndicator = false; // unused in external module bundle emit (all external modules are within module blocks, therefore are known to be modules)
needsDeclare = false;
var statements_4 = ts.visitNodes(sourceFile.statements, visitDeclarationStatements);
- var newFile = ts.updateSourceFileNode(sourceFile, [ts.createModuleDeclaration([], [ts.createModifier(125 /* DeclareKeyword */)], ts.createLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), ts.createModuleBlock(ts.setTextRange(ts.createNodeArray(transformAndReplaceLatePaintedStatements(statements_4)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []);
+ var newFile = ts.updateSourceFileNode(sourceFile, [ts.createModuleDeclaration([], [ts.createModifier(126 /* DeclareKeyword */)], ts.createLiteral(ts.getResolvedExternalModuleName(context.getEmitHost(), sourceFile)), ts.createModuleBlock(ts.setTextRange(ts.createNodeArray(transformAndReplaceLatePaintedStatements(statements_4)), sourceFile.statements)))], /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []);
return newFile;
}
needsDeclare = true;
var updated = ts.visitNodes(sourceFile.statements, visitDeclarationStatements);
return ts.updateSourceFileNode(sourceFile, transformAndReplaceLatePaintedStatements(updated), /*isDeclarationFile*/ true, /*referencedFiles*/ [], /*typeReferences*/ [], /*hasNoDefaultLib*/ false, /*libReferences*/ []);
}), ts.mapDefined(node.prepends, function (prepend) {
- if (prepend.kind === 287 /* InputFiles */) {
+ if (prepend.kind === 288 /* InputFiles */) {
var sourceFile = ts.createUnparsedSourceFile(prepend, "dts", stripInternal);
hasNoDefaultLib_1 = hasNoDefaultLib_1 || !!sourceFile.hasNoDefaultLib;
collectReferences(sourceFile, refs);
@@ -81662,11 +82504,11 @@
return ret;
}
function filterBindingPatternInitializers(name) {
- if (name.kind === 72 /* Identifier */) {
+ if (name.kind === 73 /* Identifier */) {
return name;
}
else {
- if (name.kind === 185 /* ArrayBindingPattern */) {
+ if (name.kind === 186 /* ArrayBindingPattern */) {
return ts.updateArrayBindingPattern(name, ts.visitNodes(name.elements, visitBindingElement));
}
else {
@@ -81674,7 +82516,7 @@
}
}
function visitBindingElement(elem) {
- if (elem.kind === 210 /* OmittedExpression */) {
+ if (elem.kind === 211 /* OmittedExpression */) {
return elem;
}
return ts.updateBindingElement(elem, elem.dotDotDotToken, elem.propertyName, filterBindingPatternInitializers(elem.name), shouldPrintWithInitializer(elem) ? elem.initializer : undefined);
@@ -81712,19 +82554,19 @@
// Literal const declarations will have an initializer ensured rather than a type
return;
}
- var shouldUseResolverType = node.kind === 151 /* Parameter */ &&
+ var shouldUseResolverType = node.kind === 152 /* Parameter */ &&
(resolver.isRequiredInitializedParameter(node) ||
resolver.isOptionalUninitializedParameterProperty(node));
if (type && !shouldUseResolverType) {
return ts.visitNode(type, visitDeclarationSubtree);
}
if (!ts.getParseTreeNode(node)) {
- return type ? ts.visitNode(type, visitDeclarationSubtree) : ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ return type ? ts.visitNode(type, visitDeclarationSubtree) : ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
- if (node.kind === 159 /* SetAccessor */) {
+ if (node.kind === 160 /* SetAccessor */) {
// Set accessors with no associated type node (from it's param or get accessor return) are `any` since they are never contextually typed right now
// (The inferred type here will be void, but the old declaration emitter printed `any`, so this replicates that)
- return ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ return ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
errorNameNode = node.name;
var oldDiag;
@@ -81732,12 +82574,12 @@
oldDiag = getSymbolAccessibilityDiagnostic;
getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(node);
}
- if (node.kind === 237 /* VariableDeclaration */ || node.kind === 186 /* BindingElement */) {
+ if (node.kind === 238 /* VariableDeclaration */ || node.kind === 187 /* BindingElement */) {
return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker));
}
- if (node.kind === 151 /* Parameter */
- || node.kind === 154 /* PropertyDeclaration */
- || node.kind === 153 /* PropertySignature */) {
+ if (node.kind === 152 /* Parameter */
+ || node.kind === 155 /* PropertyDeclaration */
+ || node.kind === 154 /* PropertySignature */) {
if (!node.initializer)
return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType));
return cleanup(resolver.createTypeOfDeclaration(node, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker, shouldUseResolverType) || resolver.createTypeOfExpression(node.initializer, enclosingDeclaration, declarationEmitNodeBuilderFlags, symbolTracker));
@@ -81748,26 +82590,26 @@
if (!suppressNewDiagnosticContexts) {
getSymbolAccessibilityDiagnostic = oldDiag;
}
- return returnValue || ts.createKeywordTypeNode(120 /* AnyKeyword */);
+ return returnValue || ts.createKeywordTypeNode(121 /* AnyKeyword */);
}
}
function isDeclarationAndNotVisible(node) {
node = ts.getParseTreeNode(node);
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 240 /* ClassDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 243 /* EnumDeclaration */:
+ case 240 /* FunctionDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 244 /* EnumDeclaration */:
return !resolver.isDeclarationVisible(node);
// The following should be doing their own visibility checks based on filtering their members
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return !getBindingNameVisible(node);
- case 248 /* ImportEqualsDeclaration */:
- case 249 /* ImportDeclaration */:
- case 255 /* ExportDeclaration */:
- case 254 /* ExportAssignment */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 256 /* ExportDeclaration */:
+ case 255 /* ExportAssignment */:
return false;
}
return false;
@@ -81821,7 +82663,7 @@
function rewriteModuleSpecifier(parent, input) {
if (!input)
return undefined; // TODO: GH#18217
- resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 244 /* ModuleDeclaration */ && parent.kind !== 183 /* ImportType */);
+ resultHasExternalModuleIndicator = resultHasExternalModuleIndicator || (parent.kind !== 245 /* ModuleDeclaration */ && parent.kind !== 184 /* ImportType */);
if (ts.isStringLiteralLike(input)) {
if (isBundledEmit) {
var newName = ts.getExternalModuleNameFromDeclaration(context.getEmitHost(), resolver, parent);
@@ -81841,7 +82683,7 @@
function transformImportEqualsDeclaration(decl) {
if (!resolver.isDeclarationVisible(decl))
return;
- if (decl.moduleReference.kind === 259 /* ExternalModuleReference */) {
+ if (decl.moduleReference.kind === 260 /* ExternalModuleReference */) {
// Rewrite external module names if necessary
var specifier = ts.getExternalModuleImportEqualsDeclarationExpression(decl);
return ts.updateImportEqualsDeclaration(decl,
@@ -81868,7 +82710,7 @@
return visibleDefaultBinding && ts.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, ts.updateImportClause(decl.importClause, visibleDefaultBinding,
/*namedBindings*/ undefined), rewriteModuleSpecifier(decl, decl.moduleSpecifier));
}
- if (decl.importClause.namedBindings.kind === 251 /* NamespaceImport */) {
+ if (decl.importClause.namedBindings.kind === 252 /* NamespaceImport */) {
// Namespace import (optionally with visible default)
var namedBindings = resolver.isDeclarationVisible(decl.importClause.namedBindings) ? decl.importClause.namedBindings : /*namedBindings*/ undefined;
return visibleDefaultBinding || namedBindings ? ts.updateImportDeclaration(decl, /*decorators*/ undefined, decl.modifiers, ts.updateImportClause(decl.importClause, visibleDefaultBinding, namedBindings), rewriteModuleSpecifier(decl, decl.moduleSpecifier)) : undefined;
@@ -81976,68 +82818,68 @@
checkEntityNameVisibility(input.exprName, enclosingDeclaration);
}
var oldWithinObjectLiteralType = suppressNewDiagnosticContexts;
- var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 168 /* TypeLiteral */ || input.kind === 181 /* MappedType */) && input.parent.kind !== 242 /* TypeAliasDeclaration */);
+ var shouldEnterSuppressNewDiagnosticsContextContext = ((input.kind === 169 /* TypeLiteral */ || input.kind === 182 /* MappedType */) && input.parent.kind !== 243 /* TypeAliasDeclaration */);
if (shouldEnterSuppressNewDiagnosticsContextContext) {
// We stop making new diagnostic contexts within object literal types. Unless it's an object type on the RHS of a type alias declaration. Then we do.
suppressNewDiagnosticContexts = true;
}
if (isProcessedComponent(input)) {
switch (input.kind) {
- case 211 /* ExpressionWithTypeArguments */: {
+ case 212 /* ExpressionWithTypeArguments */: {
if ((ts.isEntityName(input.expression) || ts.isEntityNameExpression(input.expression))) {
checkEntityNameVisibility(input.expression, enclosingDeclaration);
}
var node = ts.visitEachChild(input, visitDeclarationSubtree, context);
return cleanup(ts.updateExpressionWithTypeArguments(node, ts.parenthesizeTypeParameters(node.typeArguments), node.expression));
}
- case 164 /* TypeReference */: {
+ case 165 /* TypeReference */: {
checkEntityNameVisibility(input.typeName, enclosingDeclaration);
var node = ts.visitEachChild(input, visitDeclarationSubtree, context);
return cleanup(ts.updateTypeReferenceNode(node, node.typeName, ts.parenthesizeTypeParameters(node.typeArguments)));
}
- case 161 /* ConstructSignature */:
+ case 162 /* ConstructSignature */:
return cleanup(ts.updateConstructSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type)));
- case 157 /* Constructor */: {
+ case 158 /* Constructor */: {
var isPrivate = ts.hasModifier(input, 8 /* Private */);
// A constructor declaration may not have a type annotation
- var ctor = ts.createSignatureDeclaration(157 /* Constructor */, isPrivate ? undefined : ensureTypeParams(input, input.typeParameters),
+ var ctor = ts.createSignatureDeclaration(158 /* Constructor */, isPrivate ? undefined : ensureTypeParams(input, input.typeParameters),
// TODO: GH#18217
isPrivate ? undefined : updateParamsList(input, input.parameters, 0 /* None */),
/*type*/ undefined);
ctor.modifiers = ts.createNodeArray(ensureModifiers(input));
return cleanup(ctor);
}
- case 156 /* MethodDeclaration */: {
- var sig = ts.createSignatureDeclaration(155 /* MethodSignature */, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type));
+ case 157 /* MethodDeclaration */: {
+ var sig = ts.createSignatureDeclaration(156 /* MethodSignature */, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type));
sig.name = input.name;
sig.modifiers = ts.createNodeArray(ensureModifiers(input));
sig.questionToken = input.questionToken;
return cleanup(sig);
}
- case 158 /* GetAccessor */: {
+ case 159 /* GetAccessor */: {
var newNode = ensureAccessor(input);
return cleanup(newNode);
}
- case 159 /* SetAccessor */: {
+ case 160 /* SetAccessor */: {
var newNode = ensureAccessor(input);
return cleanup(newNode);
}
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return cleanup(ts.updateProperty(input,
/*decorators*/ undefined, ensureModifiers(input), input.name, input.questionToken, !ts.hasModifier(input, 8 /* Private */) ? ensureType(input, input.type) : undefined, ensureNoInitializer(input)));
- case 153 /* PropertySignature */:
+ case 154 /* PropertySignature */:
return cleanup(ts.updatePropertySignature(input, ensureModifiers(input), input.name, input.questionToken, !ts.hasModifier(input, 8 /* Private */) ? ensureType(input, input.type) : undefined, ensureNoInitializer(input)));
- case 155 /* MethodSignature */: {
+ case 156 /* MethodSignature */: {
return cleanup(ts.updateMethodSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type), input.name, input.questionToken));
}
- case 160 /* CallSignature */: {
+ case 161 /* CallSignature */: {
return cleanup(ts.updateCallSignature(input, ensureTypeParams(input, input.typeParameters), updateParamsList(input, input.parameters), ensureType(input, input.type)));
}
- case 162 /* IndexSignature */: {
+ case 163 /* IndexSignature */: {
return cleanup(ts.updateIndexSignature(input,
- /*decorators*/ undefined, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || ts.createKeywordTypeNode(120 /* AnyKeyword */)));
+ /*decorators*/ undefined, ensureModifiers(input), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree) || ts.createKeywordTypeNode(121 /* AnyKeyword */)));
}
- case 237 /* VariableDeclaration */: {
+ case 238 /* VariableDeclaration */: {
if (ts.isBindingPattern(input.name)) {
return recreateBindingPattern(input.name);
}
@@ -82045,13 +82887,13 @@
suppressNewDiagnosticContexts = true; // Variable declaration types also suppress new diagnostic contexts, provided the contexts wouldn't be made for binding pattern types
return cleanup(ts.updateVariableDeclaration(input, input.name, ensureType(input, input.type), ensureNoInitializer(input)));
}
- case 150 /* TypeParameter */: {
+ case 151 /* TypeParameter */: {
if (isPrivateMethodTypeParameter(input) && (input.default || input.constraint)) {
return cleanup(ts.updateTypeParameterDeclaration(input, input.name, /*constraint*/ undefined, /*defaultType*/ undefined));
}
return cleanup(ts.visitEachChild(input, visitDeclarationSubtree, context));
}
- case 175 /* ConditionalType */: {
+ case 176 /* ConditionalType */: {
// We have to process conditional types in a special way because for visibility purposes we need to push a new enclosingDeclaration
// just for the `infer` types in the true branch. It's an implicit declaration scope that only applies to _part_ of the type.
var checkType = ts.visitNode(input.checkType, visitDeclarationSubtree);
@@ -82063,13 +82905,13 @@
var falseType = ts.visitNode(input.falseType, visitDeclarationSubtree);
return cleanup(ts.updateConditionalTypeNode(input, checkType, extendsType, trueType, falseType));
}
- case 165 /* FunctionType */: {
+ case 166 /* FunctionType */: {
return cleanup(ts.updateFunctionTypeNode(input, ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree)));
}
- case 166 /* ConstructorType */: {
+ case 167 /* ConstructorType */: {
return cleanup(ts.updateConstructorTypeNode(input, ts.visitNodes(input.typeParameters, visitDeclarationSubtree), updateParamsList(input, input.parameters), ts.visitNode(input.type, visitDeclarationSubtree)));
}
- case 183 /* ImportType */: {
+ case 184 /* ImportType */: {
if (!ts.isLiteralImportTypeNode(input))
return cleanup(input);
return cleanup(ts.updateImportTypeNode(input, ts.updateLiteralTypeNode(input.argument, rewriteModuleSpecifier(input, input.argument.literal)), input.qualifier, ts.visitNodes(input.typeArguments, visitDeclarationSubtree, ts.isTypeNode), input.isTypeOf));
@@ -82098,7 +82940,7 @@
}
}
function isPrivateMethodTypeParameter(node) {
- return node.parent.kind === 156 /* MethodDeclaration */ && ts.hasModifier(node.parent, 8 /* Private */);
+ return node.parent.kind === 157 /* MethodDeclaration */ && ts.hasModifier(node.parent, 8 /* Private */);
}
function visitDeclarationStatements(input) {
if (!isPreservedDeclarationStatement(input)) {
@@ -82108,7 +82950,7 @@
if (shouldStripInternal(input))
return;
switch (input.kind) {
- case 255 /* ExportDeclaration */: {
+ case 256 /* ExportDeclaration */: {
if (ts.isSourceFile(input.parent)) {
resultHasExternalModuleIndicator = true;
resultHasScopeMarker = true;
@@ -82117,13 +82959,13 @@
// Rewrite external module names if necessary
return ts.updateExportDeclaration(input, /*decorators*/ undefined, input.modifiers, input.exportClause, rewriteModuleSpecifier(input, input.moduleSpecifier));
}
- case 254 /* ExportAssignment */: {
+ case 255 /* ExportAssignment */: {
// Always visible if the parent node isn't dropped for being not visible
if (ts.isSourceFile(input.parent)) {
resultHasExternalModuleIndicator = true;
resultHasScopeMarker = true;
}
- if (input.expression.kind === 72 /* Identifier */) {
+ if (input.expression.kind === 73 /* Identifier */) {
return input;
}
else {
@@ -82133,7 +82975,7 @@
errorNode: input
}); };
var varDecl = ts.createVariableDeclaration(newId, resolver.createTypeOfExpression(input.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined);
- var statement = ts.createVariableStatement(needsDeclare ? [ts.createModifier(125 /* DeclareKeyword */)] : [], ts.createVariableDeclarationList([varDecl], 2 /* Const */));
+ var statement = ts.createVariableStatement(needsDeclare ? [ts.createModifier(126 /* DeclareKeyword */)] : [], ts.createVariableDeclarationList([varDecl], 2 /* Const */));
return [statement, ts.updateExportAssignment(input, input.decorators, input.modifiers, newId)];
}
}
@@ -82147,10 +82989,10 @@
if (shouldStripInternal(input))
return;
switch (input.kind) {
- case 248 /* ImportEqualsDeclaration */: {
+ case 249 /* ImportEqualsDeclaration */: {
return transformImportEqualsDeclaration(input);
}
- case 249 /* ImportDeclaration */: {
+ case 250 /* ImportDeclaration */: {
return transformImportDeclaration(input);
}
}
@@ -82171,14 +83013,14 @@
}
var previousNeedsDeclare = needsDeclare;
switch (input.kind) {
- case 242 /* TypeAliasDeclaration */: // Type aliases get `declare`d if need be (for legacy support), but that's all
+ case 243 /* TypeAliasDeclaration */: // Type aliases get `declare`d if need be (for legacy support), but that's all
return cleanup(ts.updateTypeAliasDeclaration(input,
/*decorators*/ undefined, ensureModifiers(input, isPrivate), input.name, ts.visitNodes(input.typeParameters, visitDeclarationSubtree, ts.isTypeParameterDeclaration), ts.visitNode(input.type, visitDeclarationSubtree, ts.isTypeNode)));
- case 241 /* InterfaceDeclaration */: {
+ case 242 /* InterfaceDeclaration */: {
return cleanup(ts.updateInterfaceDeclaration(input,
/*decorators*/ undefined, ensureModifiers(input, isPrivate), input.name, ensureTypeParams(input, input.typeParameters), transformHeritageClauses(input.heritageClauses), ts.visitNodes(input.members, visitDeclarationSubtree)));
}
- case 239 /* FunctionDeclaration */: {
+ case 240 /* FunctionDeclaration */: {
// Generators lose their generator-ness, excepting their return type
var clean = cleanup(ts.updateFunctionDeclaration(input,
/*decorators*/ undefined, ensureModifiers(input, isPrivate),
@@ -82196,16 +83038,32 @@
return ts.createVariableStatement(/*modifiers*/ undefined, ts.createVariableDeclarationList([varDecl]));
});
var namespaceDecl = ts.createModuleDeclaration(/*decorators*/ undefined, ensureModifiers(input, isPrivate), input.name, ts.createModuleBlock(declarations), 16 /* Namespace */);
+ if (!ts.hasModifier(clean, 513 /* ExportDefault */)) {
return [clean, namespaceDecl];
}
+ var modifiers = ts.createModifiersFromModifierFlags((ts.getModifierFlags(clean) & ~513 /* ExportDefault */) | 2 /* Ambient */);
+ var cleanDeclaration = ts.updateFunctionDeclaration(clean,
+ /*decorators*/ undefined, modifiers,
+ /*asteriskToken*/ undefined, clean.name, clean.typeParameters, clean.parameters, clean.type,
+ /*body*/ undefined);
+ var namespaceDeclaration = ts.updateModuleDeclaration(namespaceDecl,
+ /*decorators*/ undefined, modifiers, namespaceDecl.name, namespaceDecl.body);
+ var exportDefaultDeclaration = ts.createExportAssignment(
+ /*decorators*/ undefined,
+ /*modifiers*/ undefined,
+ /*isExportEquals*/ false, namespaceDecl.name);
+ resultHasExternalModuleIndicator = true;
+ resultHasScopeMarker = true;
+ return [cleanDeclaration, namespaceDeclaration, exportDefaultDeclaration];
+ }
else {
return clean;
}
}
- case 244 /* ModuleDeclaration */: {
+ case 245 /* ModuleDeclaration */: {
needsDeclare = false;
var inner = input.body;
- if (inner && inner.kind === 245 /* ModuleBlock */) {
+ if (inner && inner.kind === 246 /* ModuleBlock */) {
var statements = ts.visitNodes(inner.statements, visitDeclarationStatements);
var body = ts.updateModuleBlock(inner, transformAndReplaceLatePaintedStatements(statements));
needsDeclare = previousNeedsDeclare;
@@ -82226,7 +83084,7 @@
/*decorators*/ undefined, mods, input.name, body));
}
}
- case 240 /* ClassDeclaration */: {
+ case 241 /* ClassDeclaration */: {
var modifiers = ts.createNodeArray(ensureModifiers(input, isPrivate));
var typeParameters = ensureTypeParams(input, input.typeParameters);
var ctor = ts.getFirstConstructorWithBody(input);
@@ -82237,7 +83095,7 @@
if (!ts.hasModifier(param, 92 /* ParameterPropertyModifier */) || shouldStripInternal(param))
return;
getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(param);
- if (param.name.kind === 72 /* Identifier */) {
+ if (param.name.kind === 73 /* Identifier */) {
return preserveJsDoc(ts.createProperty(
/*decorators*/ undefined, ensureModifiers(param), param.name, param.questionToken, ensureType(param, param.type), ensureNoInitializer(param)), param);
}
@@ -82267,7 +83125,7 @@
}
var members = ts.createNodeArray(ts.concatenate(parameterProperties, ts.visitNodes(input.members, visitDeclarationSubtree)));
var extendsClause_1 = ts.getEffectiveBaseTypeNode(input);
- if (extendsClause_1 && !ts.isEntityNameExpression(extendsClause_1.expression) && extendsClause_1.expression.kind !== 96 /* NullKeyword */) {
+ if (extendsClause_1 && !ts.isEntityNameExpression(extendsClause_1.expression) && extendsClause_1.expression.kind !== 97 /* NullKeyword */) {
// We must add a temporary declaration for the extends clause expression
var oldId = input.name ? ts.unescapeLeadingUnderscores(input.name.escapedText) : "default";
var newId_1 = ts.createOptimisticUniqueName(oldId + "_base");
@@ -82277,16 +83135,16 @@
typeName: input.name
}); };
var varDecl = ts.createVariableDeclaration(newId_1, resolver.createTypeOfExpression(extendsClause_1.expression, input, declarationEmitNodeBuilderFlags, symbolTracker), /*initializer*/ undefined);
- var statement = ts.createVariableStatement(needsDeclare ? [ts.createModifier(125 /* DeclareKeyword */)] : [], ts.createVariableDeclarationList([varDecl], 2 /* Const */));
+ var statement = ts.createVariableStatement(needsDeclare ? [ts.createModifier(126 /* DeclareKeyword */)] : [], ts.createVariableDeclarationList([varDecl], 2 /* Const */));
var heritageClauses = ts.createNodeArray(ts.map(input.heritageClauses, function (clause) {
- if (clause.token === 86 /* ExtendsKeyword */) {
+ if (clause.token === 87 /* ExtendsKeyword */) {
var oldDiag_2 = getSymbolAccessibilityDiagnostic;
getSymbolAccessibilityDiagnostic = ts.createGetSymbolAccessibilityDiagnosticForNode(clause.types[0]);
var newClause = ts.updateHeritageClause(clause, ts.map(clause.types, function (t) { return ts.updateExpressionWithTypeArguments(t, ts.visitNodes(t.typeArguments, visitDeclarationSubtree), newId_1); }));
getSymbolAccessibilityDiagnostic = oldDiag_2;
return newClause;
}
- return ts.updateHeritageClause(clause, ts.visitNodes(ts.createNodeArray(ts.filter(clause.types, function (t) { return ts.isEntityNameExpression(t.expression) || t.expression.kind === 96 /* NullKeyword */; })), visitDeclarationSubtree));
+ return ts.updateHeritageClause(clause, ts.visitNodes(ts.createNodeArray(ts.filter(clause.types, function (t) { return ts.isEntityNameExpression(t.expression) || t.expression.kind === 97 /* NullKeyword */; })), visitDeclarationSubtree));
}));
return [statement, cleanup(ts.updateClassDeclaration(input,
/*decorators*/ undefined, modifiers, input.name, typeParameters, heritageClauses, members))]; // TODO: GH#18217
@@ -82297,10 +83155,10 @@
/*decorators*/ undefined, modifiers, input.name, typeParameters, heritageClauses, members));
}
}
- case 219 /* VariableStatement */: {
+ case 220 /* VariableStatement */: {
return cleanup(transformVariableStatement(input, isPrivate));
}
- case 243 /* EnumDeclaration */: {
+ case 244 /* EnumDeclaration */: {
return cleanup(ts.updateEnumDeclaration(input, /*decorators*/ undefined, ts.createNodeArray(ensureModifiers(input, isPrivate)), input.name, ts.createNodeArray(ts.mapDefined(input.members, function (m) {
if (shouldStripInternal(m))
return;
@@ -82319,7 +83177,7 @@
if (canProdiceDiagnostic) {
getSymbolAccessibilityDiagnostic = oldDiag;
}
- if (input.kind === 244 /* ModuleDeclaration */) {
+ if (input.kind === 245 /* ModuleDeclaration */) {
needsDeclare = previousNeedsDeclare;
}
if (node === input) {
@@ -82340,7 +83198,7 @@
return ts.flatten(ts.mapDefined(d.elements, function (e) { return recreateBindingElement(e); }));
}
function recreateBindingElement(e) {
- if (e.kind === 210 /* OmittedExpression */) {
+ if (e.kind === 211 /* OmittedExpression */) {
return;
}
if (e.name) {
@@ -82393,7 +83251,7 @@
function ensureModifierFlags(node, privateDeclaration) {
var mask = 3071 /* All */ ^ (4 /* Public */ | 256 /* Async */); // No async modifiers in declaration files
var additions = (needsDeclare && !isAlwaysType(node)) ? 2 /* Ambient */ : 0 /* None */;
- var parentIsFile = node.parent.kind === 284 /* SourceFile */;
+ var parentIsFile = node.parent.kind === 285 /* SourceFile */;
if (!parentIsFile || (isBundledEmit && parentIsFile && ts.isExternalModule(node.parent))) {
mask ^= ((privateDeclaration || (isBundledEmit && parentIsFile) || hasScopeMarker(node.parent) ? 0 : 1 /* Export */) | 2 /* Ambient */);
additions = 0 /* None */;
@@ -82414,7 +83272,7 @@
var prop = ts.createProperty(/*decorators*/ undefined, maskModifiers(node, /*mask*/ undefined, (!accessors.setAccessor) ? 64 /* Readonly */ : 0 /* None */), node.name, node.questionToken, ensureType(node, accessorType), /*initializer*/ undefined);
var leadingsSyntheticCommentRanges = accessors.secondAccessor && ts.getLeadingCommentRangesOfNode(accessors.secondAccessor, currentSourceFile);
if (leadingsSyntheticCommentRanges) {
- var _loop_10 = function (range) {
+ var _loop_13 = function (range) {
if (range.kind === 3 /* MultiLineCommentTrivia */) {
var text = currentSourceFile.text.slice(range.pos + 2, range.end - 2);
var lines = text.split(/\r\n?|\n/g);
@@ -82428,20 +83286,20 @@
};
for (var _i = 0, leadingsSyntheticCommentRanges_1 = leadingsSyntheticCommentRanges; _i < leadingsSyntheticCommentRanges_1.length; _i++) {
var range = leadingsSyntheticCommentRanges_1[_i];
- _loop_10(range);
+ _loop_13(range);
}
}
return prop;
}
function transformHeritageClauses(nodes) {
return ts.createNodeArray(ts.filter(ts.map(nodes, function (clause) { return ts.updateHeritageClause(clause, ts.visitNodes(ts.createNodeArray(ts.filter(clause.types, function (t) {
- return ts.isEntityNameExpression(t.expression) || (clause.token === 86 /* ExtendsKeyword */ && t.expression.kind === 96 /* NullKeyword */);
+ return ts.isEntityNameExpression(t.expression) || (clause.token === 87 /* ExtendsKeyword */ && t.expression.kind === 97 /* NullKeyword */);
})), visitDeclarationSubtree)); }), function (clause) { return clause.types && !!clause.types.length; }));
}
}
ts.transformDeclarations = transformDeclarations;
function isAlwaysType(node) {
- if (node.kind === 241 /* InterfaceDeclaration */) {
+ if (node.kind === 242 /* InterfaceDeclaration */) {
return true;
}
return false;
@@ -82466,7 +83324,7 @@
}
function getTypeAnnotationFromAccessor(accessor) {
if (accessor) {
- return accessor.kind === 158 /* GetAccessor */
+ return accessor.kind === 159 /* GetAccessor */
? accessor.type // Getter - return type
: accessor.parameters.length > 0
? accessor.parameters[0].type // Setter parameter type
@@ -82475,52 +83333,52 @@
}
function canHaveLiteralInitializer(node) {
switch (node.kind) {
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
return !ts.hasModifier(node, 8 /* Private */);
- case 151 /* Parameter */:
- case 237 /* VariableDeclaration */:
+ case 152 /* Parameter */:
+ case 238 /* VariableDeclaration */:
return true;
}
return false;
}
function isPreservedDeclarationStatement(node) {
switch (node.kind) {
- case 239 /* FunctionDeclaration */:
- case 244 /* ModuleDeclaration */:
- case 248 /* ImportEqualsDeclaration */:
- case 241 /* InterfaceDeclaration */:
- case 240 /* ClassDeclaration */:
- case 242 /* TypeAliasDeclaration */:
- case 243 /* EnumDeclaration */:
- case 219 /* VariableStatement */:
- case 249 /* ImportDeclaration */:
- case 255 /* ExportDeclaration */:
- case 254 /* ExportAssignment */:
+ case 240 /* FunctionDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
+ case 242 /* InterfaceDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
+ case 244 /* EnumDeclaration */:
+ case 220 /* VariableStatement */:
+ case 250 /* ImportDeclaration */:
+ case 256 /* ExportDeclaration */:
+ case 255 /* ExportAssignment */:
return true;
}
return false;
}
function isProcessedComponent(node) {
switch (node.kind) {
- case 161 /* ConstructSignature */:
- case 157 /* Constructor */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 154 /* PropertyDeclaration */:
- case 153 /* PropertySignature */:
- case 155 /* MethodSignature */:
- case 160 /* CallSignature */:
- case 162 /* IndexSignature */:
- case 237 /* VariableDeclaration */:
- case 150 /* TypeParameter */:
- case 211 /* ExpressionWithTypeArguments */:
- case 164 /* TypeReference */:
- case 175 /* ConditionalType */:
- case 165 /* FunctionType */:
- case 166 /* ConstructorType */:
- case 183 /* ImportType */:
+ case 162 /* ConstructSignature */:
+ case 158 /* Constructor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 155 /* PropertyDeclaration */:
+ case 154 /* PropertySignature */:
+ case 156 /* MethodSignature */:
+ case 161 /* CallSignature */:
+ case 163 /* IndexSignature */:
+ case 238 /* VariableDeclaration */:
+ case 151 /* TypeParameter */:
+ case 212 /* ExpressionWithTypeArguments */:
+ case 165 /* TypeReference */:
+ case 176 /* ConditionalType */:
+ case 166 /* FunctionType */:
+ case 167 /* ConstructorType */:
+ case 184 /* ImportType */:
return true;
}
return false;
@@ -82552,17 +83410,27 @@
SyntaxKindFeatureFlags[SyntaxKindFeatureFlags["Substitution"] = 1] = "Substitution";
SyntaxKindFeatureFlags[SyntaxKindFeatureFlags["EmitNotifications"] = 2] = "EmitNotifications";
})(SyntaxKindFeatureFlags || (SyntaxKindFeatureFlags = {}));
- function getTransformers(compilerOptions, customTransformers) {
+ ts.noTransformers = { scriptTransformers: ts.emptyArray, declarationTransformers: ts.emptyArray };
+ function getTransformers(compilerOptions, customTransformers, emitOnlyDtsFiles) {
+ return {
+ scriptTransformers: getScriptTransformers(compilerOptions, customTransformers, emitOnlyDtsFiles),
+ declarationTransformers: getDeclarationTransformers(customTransformers),
+ };
+ }
+ ts.getTransformers = getTransformers;
+ function getScriptTransformers(compilerOptions, customTransformers, emitOnlyDtsFiles) {
+ if (emitOnlyDtsFiles)
+ return ts.emptyArray;
var jsx = compilerOptions.jsx;
var languageVersion = ts.getEmitScriptTarget(compilerOptions);
var moduleKind = ts.getEmitModuleKind(compilerOptions);
var transformers = [];
- ts.addRange(transformers, customTransformers && customTransformers.before);
+ ts.addRange(transformers, customTransformers && ts.map(customTransformers.before, wrapScriptTransformerFactory));
transformers.push(ts.transformTypeScript);
if (jsx === 2 /* React */) {
transformers.push(ts.transformJsx);
}
- if (languageVersion < 7 /* ESNext */) {
+ if (languageVersion < 8 /* ESNext */) {
transformers.push(ts.transformESNext);
}
if (languageVersion < 6 /* ES2019 */) {
@@ -82587,10 +83455,38 @@
if (languageVersion < 1 /* ES5 */) {
transformers.push(ts.transformES5);
}
- ts.addRange(transformers, customTransformers && customTransformers.after);
+ ts.addRange(transformers, customTransformers && ts.map(customTransformers.after, wrapScriptTransformerFactory));
return transformers;
}
- ts.getTransformers = getTransformers;
+ function getDeclarationTransformers(customTransformers) {
+ var transformers = [];
+ transformers.push(ts.transformDeclarations);
+ ts.addRange(transformers, customTransformers && ts.map(customTransformers.afterDeclarations, wrapDeclarationTransformerFactory));
+ return transformers;
+ }
+ /**
+ * Wrap a custom script or declaration transformer object in a `Transformer` callback with fallback support for transforming bundles.
+ */
+ function wrapCustomTransformer(transformer) {
+ return function (node) { return ts.isBundle(node) ? transformer.transformBundle(node) : transformer.transformSourceFile(node); };
+ }
+ /**
+ * Wrap a transformer factory that may return a custom script or declaration transformer object.
+ */
+ function wrapCustomTransformerFactory(transformer, handleDefault) {
+ return function (context) {
+ var customTransformer = transformer(context);
+ return typeof customTransformer === "function"
+ ? handleDefault(customTransformer)
+ : wrapCustomTransformer(customTransformer);
+ };
+ }
+ function wrapScriptTransformerFactory(transformer) {
+ return wrapCustomTransformerFactory(transformer, ts.chainBundle);
+ }
+ function wrapDeclarationTransformerFactory(transformer) {
+ return wrapCustomTransformerFactory(transformer, ts.identity);
+ }
function noEmitSubstitution(_hint, node) {
return node;
}
@@ -82610,7 +83506,7 @@
* @param allowDtsFiles A value indicating whether to allow the transformation of .d.ts files.
*/
function transformNodes(resolver, host, options, nodes, transformers, allowDtsFiles) {
- var enabledSyntaxKindFeatures = new Array(317 /* Count */);
+ var enabledSyntaxKindFeatures = new Array(318 /* Count */);
var lexicalEnvironmentVariableDeclarations;
var lexicalEnvironmentFunctionDeclarations;
var lexicalEnvironmentVariableDeclarationsStack = [];
@@ -82663,7 +83559,14 @@
}
ts.performance.mark("beforeTransform");
// Chain together and initialize each transformer.
- var transformation = ts.chain.apply(void 0, transformers)(context);
+ var transformersWithContext = transformers.map(function (t) { return t(context); });
+ var transformation = function (node) {
+ for (var _i = 0, transformersWithContext_1 = transformersWithContext; _i < transformersWithContext_1.length; _i++) {
+ var transform = transformersWithContext_1[_i];
+ node = transform(node);
+ }
+ return node;
+ };
// prevent modification of transformation hooks.
state = 1 /* Initialized */;
// Transform each node.
@@ -82815,6 +83718,7 @@
if (lexicalEnvironmentVariableDeclarations) {
var statement = ts.createVariableStatement(
/*modifiers*/ undefined, ts.createVariableDeclarationList(lexicalEnvironmentVariableDeclarations));
+ ts.setEmitFlags(statement, 1048576 /* CustomPrologue */);
if (!statements) {
statements = [statement];
}
@@ -82922,7 +83826,7 @@
/*@internal*/
function getOutputPathForBuildInfo(options) {
var configFile = options.configFilePath;
- if (!configFile || !ts.isIncrementalCompilation(options))
+ if (!ts.isIncrementalCompilation(options))
return undefined;
if (options.tsBuildInfoFile)
return options.tsBuildInfoFile;
@@ -82932,6 +83836,8 @@
buildInfoExtensionLess = ts.removeFileExtension(outPath);
}
else {
+ if (!configFile)
+ return undefined;
var configFileExtensionLess = ts.removeFileExtension(configFile);
buildInfoExtensionLess = options.outDir ?
options.rootDir ?
@@ -82956,7 +83862,7 @@
/*@internal*/
function getOutputPathsFor(sourceFile, host, forceDtsPaths) {
var options = host.getCompilerOptions();
- if (sourceFile.kind === 285 /* Bundle */) {
+ if (sourceFile.kind === 286 /* Bundle */) {
return getOutputPathsForBundle(options, forceDtsPaths);
}
else {
@@ -83083,14 +83989,15 @@
ts.getFirstProjectOutput = getFirstProjectOutput;
/*@internal*/
// targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature
- function emitFiles(resolver, host, targetSourceFile, emitOnlyDtsFiles, transformers, declarationTransformers, onlyBuildInfo) {
+ function emitFiles(resolver, host, targetSourceFile, _a, emitOnlyDtsFiles, onlyBuildInfo) {
+ var scriptTransformers = _a.scriptTransformers, declarationTransformers = _a.declarationTransformers;
var compilerOptions = host.getCompilerOptions();
var sourceMapDataList = (compilerOptions.sourceMap || compilerOptions.inlineSourceMap || ts.getAreDeclarationMapsEnabled(compilerOptions)) ? [] : undefined;
var emittedFilesList = compilerOptions.listEmittedFiles ? [] : undefined;
var emitterDiagnostics = ts.createDiagnosticCollection();
var newLine = ts.getNewLineCharacter(compilerOptions, function () { return host.getNewLine(); });
var writer = ts.createTextWriter(newLine);
- var _a = ts.performance.createTimer("printTime", "beforePrint", "afterPrint"), enter = _a.enter, exit = _a.exit;
+ var _b = ts.performance.createTimer("printTime", "beforePrint", "afterPrint"), enter = _b.enter, exit = _b.exit;
var bundleBuildInfo;
var emitSkipped = false;
var exportedModulesFromDeclarationEmit;
@@ -83159,7 +84066,7 @@
return;
}
// Transform the source files
- var transform = ts.transformNodes(resolver, host, compilerOptions, [sourceFileOrBundle], transformers, /*allowDtsFiles*/ false);
+ var transform = ts.transformNodes(resolver, host, compilerOptions, [sourceFileOrBundle], scriptTransformers, /*allowDtsFiles*/ false);
var printerOptions = {
removeComments: compilerOptions.removeComments,
newLine: compilerOptions.newLine,
@@ -83200,7 +84107,7 @@
// Do that here when emitting only dts files
nonJsFiles.forEach(collectLinkedAliases);
}
- var declarationTransform = ts.transformNodes(resolver, host, compilerOptions, inputListOrBundle, ts.concatenate([ts.transformDeclarations], declarationTransformers), /*allowDtsFiles*/ false);
+ var declarationTransform = ts.transformNodes(resolver, host, compilerOptions, inputListOrBundle, declarationTransformers, /*allowDtsFiles*/ false);
if (ts.length(declarationTransform.diagnostics)) {
for (var _a = 0, _b = declarationTransform.diagnostics; _a < _b.length; _a++) {
var diagnostic = _b[_a];
@@ -83237,7 +84144,7 @@
mapRoot: compilerOptions.mapRoot,
extendedDiagnostics: compilerOptions.extendedDiagnostics,
});
- if (emitOnlyDtsFiles && declarationTransform.transformed[0].kind === 284 /* SourceFile */) {
+ if (emitOnlyDtsFiles && declarationTransform.transformed[0].kind === 285 /* SourceFile */) {
var sourceFile = declarationTransform.transformed[0];
exportedModulesFromDeclarationEmit = sourceFile.exportedModulesFromDeclarationEmit;
}
@@ -83248,7 +84155,7 @@
}
function collectLinkedAliases(node) {
if (ts.isExportAssignment(node)) {
- if (node.expression.kind === 72 /* Identifier */) {
+ if (node.expression.kind === 73 /* Identifier */) {
resolver.collectLinkedAliases(node.expression, /*setVisibility*/ true);
}
return;
@@ -83260,8 +84167,8 @@
ts.forEachChild(node, collectLinkedAliases);
}
function printSourceFileOrBundle(jsFilePath, sourceMapFilePath, sourceFileOrBundle, printer, mapOptions) {
- var bundle = sourceFileOrBundle.kind === 285 /* Bundle */ ? sourceFileOrBundle : undefined;
- var sourceFile = sourceFileOrBundle.kind === 284 /* SourceFile */ ? sourceFileOrBundle : undefined;
+ var bundle = sourceFileOrBundle.kind === 286 /* Bundle */ ? sourceFileOrBundle : undefined;
+ var sourceFile = sourceFileOrBundle.kind === 285 /* SourceFile */ ? sourceFileOrBundle : undefined;
var sourceFiles = bundle ? bundle.sourceFiles : [sourceFile];
var sourceMapGenerator;
if (shouldEmitSourceMaps(mapOptions, sourceFileOrBundle)) {
@@ -83302,7 +84209,7 @@
}
function shouldEmitSourceMaps(mapOptions, sourceFileOrBundle) {
return (mapOptions.sourceMap || mapOptions.inlineSourceMap)
- && (sourceFileOrBundle.kind !== 284 /* SourceFile */ || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Json */));
+ && (sourceFileOrBundle.kind !== 285 /* SourceFile */ || !ts.fileExtensionIs(sourceFileOrBundle.fileName, ".json" /* Json */));
}
function getSourceRoot(mapOptions) {
// Normalize source root and make sure it has trailing "/" so that it can be used to combine paths with the
@@ -83412,7 +84319,7 @@
};
function createSourceFilesFromBundleBuildInfo(bundle) {
var sourceFiles = bundle.sourceFiles.map(function (fileName) {
- var sourceFile = ts.createNode(284 /* SourceFile */, 0, 0);
+ var sourceFile = ts.createNode(285 /* SourceFile */, 0, 0);
sourceFile.fileName = fileName;
sourceFile.text = "";
sourceFile.statements = ts.createNodeArray();
@@ -83424,7 +84331,7 @@
sourceFile.text = prologueInfo.text;
sourceFile.end = prologueInfo.text.length;
sourceFile.statements = ts.createNodeArray(prologueInfo.directives.map(function (directive) {
- var statement = ts.createNode(221 /* ExpressionStatement */, directive.pos, directive.end);
+ var statement = ts.createNode(222 /* ExpressionStatement */, directive.pos, directive.end);
statement.expression = ts.createNode(10 /* StringLiteral */, directive.expression.pos, directive.expression.end);
statement.expression.text = directive.expression.text;
return statement;
@@ -83516,7 +84423,7 @@
useCaseSensitiveFileNames: function () { return host.useCaseSensitiveFileNames(); },
getProgramBuildInfo: ts.returnUndefined
};
- emitFiles(ts.notImplementedResolver, emitHost, /*targetSourceFile*/ undefined, /*emitOnlyDtsFiles*/ false, ts.getTransformers(config.options));
+ emitFiles(ts.notImplementedResolver, emitHost, /*targetSourceFile*/ undefined, ts.getTransformers(config.options), /*emitOnlyDtsFiles*/ false);
return outputFiles;
}
ts.emitUsingBuildInfo = emitUsingBuildInfo;
@@ -83593,9 +84500,9 @@
break;
}
switch (node.kind) {
- case 284 /* SourceFile */: return printFile(node);
- case 285 /* Bundle */: return printBundle(node);
- case 286 /* UnparsedSource */: return printUnparsedSource(node);
+ case 285 /* SourceFile */: return printFile(node);
+ case 286 /* Bundle */: return printBundle(node);
+ case 287 /* UnparsedSource */: return printUnparsedSource(node);
}
writeNode(hint, node, sourceFile, beginPrint());
return endPrint();
@@ -83825,12 +84732,12 @@
}
// falls through
case 2 /* Comments */:
- if (!commentsDisabled && node.kind !== 284 /* SourceFile */) {
+ if (!commentsDisabled && node.kind !== 285 /* SourceFile */) {
return pipelineEmitWithComments;
}
// falls through
case 3 /* SourceMaps */:
- if (!sourceMapsDisabled && node.kind !== 284 /* SourceFile */ && !ts.isInJsonFile(node)) {
+ if (!sourceMapsDisabled && node.kind !== 285 /* SourceFile */ && !ts.isInJsonFile(node)) {
return pipelineEmitWithSourceMap;
}
// falls through
@@ -83867,272 +84774,272 @@
case 16 /* TemplateMiddle */:
case 17 /* TemplateTail */:
return emitLiteral(node);
- case 286 /* UnparsedSource */:
- case 280 /* UnparsedPrepend */:
+ case 287 /* UnparsedSource */:
+ case 281 /* UnparsedPrepend */:
return emitUnparsedSourceOrPrepend(node);
- case 279 /* UnparsedPrologue */:
+ case 280 /* UnparsedPrologue */:
return writeUnparsedNode(node);
- case 281 /* UnparsedText */:
- case 282 /* UnparsedInternalText */:
+ case 282 /* UnparsedText */:
+ case 283 /* UnparsedInternalText */:
return emitUnparsedTextLike(node);
- case 283 /* UnparsedSyntheticReference */:
+ case 284 /* UnparsedSyntheticReference */:
return emitUnparsedSyntheticReference(node);
// Identifiers
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return emitIdentifier(node);
// Parse tree nodes
// Names
- case 148 /* QualifiedName */:
+ case 149 /* QualifiedName */:
return emitQualifiedName(node);
- case 149 /* ComputedPropertyName */:
+ case 150 /* ComputedPropertyName */:
return emitComputedPropertyName(node);
// Signature elements
- case 150 /* TypeParameter */:
+ case 151 /* TypeParameter */:
return emitTypeParameter(node);
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
return emitParameter(node);
- case 152 /* Decorator */:
+ case 153 /* Decorator */:
return emitDecorator(node);
// Type members
- case 153 /* PropertySignature */:
+ case 154 /* PropertySignature */:
return emitPropertySignature(node);
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
return emitPropertyDeclaration(node);
- case 155 /* MethodSignature */:
+ case 156 /* MethodSignature */:
return emitMethodSignature(node);
- case 156 /* MethodDeclaration */:
+ case 157 /* MethodDeclaration */:
return emitMethodDeclaration(node);
- case 157 /* Constructor */:
+ case 158 /* Constructor */:
return emitConstructor(node);
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return emitAccessorDeclaration(node);
- case 160 /* CallSignature */:
+ case 161 /* CallSignature */:
return emitCallSignature(node);
- case 161 /* ConstructSignature */:
+ case 162 /* ConstructSignature */:
return emitConstructSignature(node);
- case 162 /* IndexSignature */:
+ case 163 /* IndexSignature */:
return emitIndexSignature(node);
// Types
- case 163 /* TypePredicate */:
+ case 164 /* TypePredicate */:
return emitTypePredicate(node);
- case 164 /* TypeReference */:
+ case 165 /* TypeReference */:
return emitTypeReference(node);
- case 165 /* FunctionType */:
+ case 166 /* FunctionType */:
return emitFunctionType(node);
- case 294 /* JSDocFunctionType */:
+ case 295 /* JSDocFunctionType */:
return emitJSDocFunctionType(node);
- case 166 /* ConstructorType */:
+ case 167 /* ConstructorType */:
return emitConstructorType(node);
- case 167 /* TypeQuery */:
+ case 168 /* TypeQuery */:
return emitTypeQuery(node);
- case 168 /* TypeLiteral */:
+ case 169 /* TypeLiteral */:
return emitTypeLiteral(node);
- case 169 /* ArrayType */:
+ case 170 /* ArrayType */:
return emitArrayType(node);
- case 170 /* TupleType */:
+ case 171 /* TupleType */:
return emitTupleType(node);
- case 171 /* OptionalType */:
+ case 172 /* OptionalType */:
return emitOptionalType(node);
- case 173 /* UnionType */:
+ case 174 /* UnionType */:
return emitUnionType(node);
- case 174 /* IntersectionType */:
+ case 175 /* IntersectionType */:
return emitIntersectionType(node);
- case 175 /* ConditionalType */:
+ case 176 /* ConditionalType */:
return emitConditionalType(node);
- case 176 /* InferType */:
+ case 177 /* InferType */:
return emitInferType(node);
- case 177 /* ParenthesizedType */:
+ case 178 /* ParenthesizedType */:
return emitParenthesizedType(node);
- case 211 /* ExpressionWithTypeArguments */:
+ case 212 /* ExpressionWithTypeArguments */:
return emitExpressionWithTypeArguments(node);
- case 178 /* ThisType */:
+ case 179 /* ThisType */:
return emitThisType();
- case 179 /* TypeOperator */:
+ case 180 /* TypeOperator */:
return emitTypeOperator(node);
- case 180 /* IndexedAccessType */:
+ case 181 /* IndexedAccessType */:
return emitIndexedAccessType(node);
- case 181 /* MappedType */:
+ case 182 /* MappedType */:
return emitMappedType(node);
- case 182 /* LiteralType */:
+ case 183 /* LiteralType */:
return emitLiteralType(node);
- case 183 /* ImportType */:
+ case 184 /* ImportType */:
return emitImportTypeNode(node);
- case 289 /* JSDocAllType */:
+ case 290 /* JSDocAllType */:
writePunctuation("*");
return;
- case 290 /* JSDocUnknownType */:
+ case 291 /* JSDocUnknownType */:
writePunctuation("?");
return;
- case 291 /* JSDocNullableType */:
+ case 292 /* JSDocNullableType */:
return emitJSDocNullableType(node);
- case 292 /* JSDocNonNullableType */:
+ case 293 /* JSDocNonNullableType */:
return emitJSDocNonNullableType(node);
- case 293 /* JSDocOptionalType */:
+ case 294 /* JSDocOptionalType */:
return emitJSDocOptionalType(node);
- case 172 /* RestType */:
- case 295 /* JSDocVariadicType */:
+ case 173 /* RestType */:
+ case 296 /* JSDocVariadicType */:
return emitRestOrJSDocVariadicType(node);
// Binding patterns
- case 184 /* ObjectBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
return emitObjectBindingPattern(node);
- case 185 /* ArrayBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
return emitArrayBindingPattern(node);
- case 186 /* BindingElement */:
+ case 187 /* BindingElement */:
return emitBindingElement(node);
// Misc
- case 216 /* TemplateSpan */:
+ case 217 /* TemplateSpan */:
return emitTemplateSpan(node);
- case 217 /* SemicolonClassElement */:
+ case 218 /* SemicolonClassElement */:
return emitSemicolonClassElement();
// Statements
- case 218 /* Block */:
+ case 219 /* Block */:
return emitBlock(node);
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
return emitVariableStatement(node);
- case 220 /* EmptyStatement */:
+ case 221 /* EmptyStatement */:
return emitEmptyStatement(/*isEmbeddedStatement*/ false);
- case 221 /* ExpressionStatement */:
+ case 222 /* ExpressionStatement */:
return emitExpressionStatement(node);
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
return emitIfStatement(node);
- case 223 /* DoStatement */:
+ case 224 /* DoStatement */:
return emitDoStatement(node);
- case 224 /* WhileStatement */:
+ case 225 /* WhileStatement */:
return emitWhileStatement(node);
- case 225 /* ForStatement */:
+ case 226 /* ForStatement */:
return emitForStatement(node);
- case 226 /* ForInStatement */:
+ case 227 /* ForInStatement */:
return emitForInStatement(node);
- case 227 /* ForOfStatement */:
+ case 228 /* ForOfStatement */:
return emitForOfStatement(node);
- case 228 /* ContinueStatement */:
+ case 229 /* ContinueStatement */:
return emitContinueStatement(node);
- case 229 /* BreakStatement */:
+ case 230 /* BreakStatement */:
return emitBreakStatement(node);
- case 230 /* ReturnStatement */:
+ case 231 /* ReturnStatement */:
return emitReturnStatement(node);
- case 231 /* WithStatement */:
+ case 232 /* WithStatement */:
return emitWithStatement(node);
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
return emitSwitchStatement(node);
- case 233 /* LabeledStatement */:
+ case 234 /* LabeledStatement */:
return emitLabeledStatement(node);
- case 234 /* ThrowStatement */:
+ case 235 /* ThrowStatement */:
return emitThrowStatement(node);
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
return emitTryStatement(node);
- case 236 /* DebuggerStatement */:
+ case 237 /* DebuggerStatement */:
return emitDebuggerStatement(node);
// Declarations
- case 237 /* VariableDeclaration */:
+ case 238 /* VariableDeclaration */:
return emitVariableDeclaration(node);
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
return emitVariableDeclarationList(node);
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
return emitFunctionDeclaration(node);
- case 240 /* ClassDeclaration */:
+ case 241 /* ClassDeclaration */:
return emitClassDeclaration(node);
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
return emitInterfaceDeclaration(node);
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
return emitTypeAliasDeclaration(node);
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
return emitEnumDeclaration(node);
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
return emitModuleDeclaration(node);
- case 245 /* ModuleBlock */:
+ case 246 /* ModuleBlock */:
return emitModuleBlock(node);
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
return emitCaseBlock(node);
- case 247 /* NamespaceExportDeclaration */:
+ case 248 /* NamespaceExportDeclaration */:
return emitNamespaceExportDeclaration(node);
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
return emitImportEqualsDeclaration(node);
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
return emitImportDeclaration(node);
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
return emitImportClause(node);
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
return emitNamespaceImport(node);
- case 252 /* NamedImports */:
+ case 253 /* NamedImports */:
return emitNamedImports(node);
- case 253 /* ImportSpecifier */:
+ case 254 /* ImportSpecifier */:
return emitImportSpecifier(node);
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
return emitExportAssignment(node);
- case 255 /* ExportDeclaration */:
+ case 256 /* ExportDeclaration */:
return emitExportDeclaration(node);
- case 256 /* NamedExports */:
+ case 257 /* NamedExports */:
return emitNamedExports(node);
- case 257 /* ExportSpecifier */:
+ case 258 /* ExportSpecifier */:
return emitExportSpecifier(node);
- case 258 /* MissingDeclaration */:
+ case 259 /* MissingDeclaration */:
return;
// Module references
- case 259 /* ExternalModuleReference */:
+ case 260 /* ExternalModuleReference */:
return emitExternalModuleReference(node);
// JSX (non-expression)
case 11 /* JsxText */:
return emitJsxText(node);
- case 262 /* JsxOpeningElement */:
- case 265 /* JsxOpeningFragment */:
+ case 263 /* JsxOpeningElement */:
+ case 266 /* JsxOpeningFragment */:
return emitJsxOpeningElementOrFragment(node);
- case 263 /* JsxClosingElement */:
- case 266 /* JsxClosingFragment */:
+ case 264 /* JsxClosingElement */:
+ case 267 /* JsxClosingFragment */:
return emitJsxClosingElementOrFragment(node);
- case 267 /* JsxAttribute */:
+ case 268 /* JsxAttribute */:
return emitJsxAttribute(node);
- case 268 /* JsxAttributes */:
+ case 269 /* JsxAttributes */:
return emitJsxAttributes(node);
- case 269 /* JsxSpreadAttribute */:
+ case 270 /* JsxSpreadAttribute */:
return emitJsxSpreadAttribute(node);
- case 270 /* JsxExpression */:
+ case 271 /* JsxExpression */:
return emitJsxExpression(node);
// Clauses
- case 271 /* CaseClause */:
+ case 272 /* CaseClause */:
return emitCaseClause(node);
- case 272 /* DefaultClause */:
+ case 273 /* DefaultClause */:
return emitDefaultClause(node);
- case 273 /* HeritageClause */:
+ case 274 /* HeritageClause */:
return emitHeritageClause(node);
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
return emitCatchClause(node);
// Property assignments
- case 275 /* PropertyAssignment */:
+ case 276 /* PropertyAssignment */:
return emitPropertyAssignment(node);
- case 276 /* ShorthandPropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
return emitShorthandPropertyAssignment(node);
- case 277 /* SpreadAssignment */:
+ case 278 /* SpreadAssignment */:
return emitSpreadAssignment(node);
// Enum
- case 278 /* EnumMember */:
+ case 279 /* EnumMember */:
return emitEnumMember(node);
// JSDoc nodes (only used in codefixes currently)
- case 304 /* JSDocParameterTag */:
- case 310 /* JSDocPropertyTag */:
+ case 305 /* JSDocParameterTag */:
+ case 311 /* JSDocPropertyTag */:
return emitJSDocPropertyLikeTag(node);
- case 305 /* JSDocReturnTag */:
- case 307 /* JSDocTypeTag */:
- case 306 /* JSDocThisTag */:
- case 303 /* JSDocEnumTag */:
+ case 306 /* JSDocReturnTag */:
+ case 308 /* JSDocTypeTag */:
+ case 307 /* JSDocThisTag */:
+ case 304 /* JSDocEnumTag */:
return emitJSDocSimpleTypedTag(node);
- case 300 /* JSDocAugmentsTag */:
+ case 301 /* JSDocAugmentsTag */:
return emitJSDocAugmentsTag(node);
- case 308 /* JSDocTemplateTag */:
+ case 309 /* JSDocTemplateTag */:
return emitJSDocTemplateTag(node);
- case 309 /* JSDocTypedefTag */:
+ case 310 /* JSDocTypedefTag */:
return emitJSDocTypedefTag(node);
- case 302 /* JSDocCallbackTag */:
+ case 303 /* JSDocCallbackTag */:
return emitJSDocCallbackTag(node);
- case 298 /* JSDocSignature */:
+ case 299 /* JSDocSignature */:
return emitJSDocSignature(node);
- case 297 /* JSDocTypeLiteral */:
+ case 298 /* JSDocTypeLiteral */:
return emitJSDocTypeLiteral(node);
- case 301 /* JSDocClassTag */:
- case 299 /* JSDocTag */:
+ case 302 /* JSDocClassTag */:
+ case 300 /* JSDocTag */:
return emitJSDocSimpleTag(node);
- case 296 /* JSDocComment */:
+ case 297 /* JSDocComment */:
return emitJSDoc(node);
// Transformation nodes (ignored)
}
@@ -84157,83 +85064,83 @@
case 14 /* NoSubstitutionTemplateLiteral */:
return emitLiteral(node);
// Identifiers
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return emitIdentifier(node);
// Reserved words
- case 87 /* FalseKeyword */:
- case 96 /* NullKeyword */:
- case 98 /* SuperKeyword */:
- case 102 /* TrueKeyword */:
- case 100 /* ThisKeyword */:
- case 92 /* ImportKeyword */:
+ case 88 /* FalseKeyword */:
+ case 97 /* NullKeyword */:
+ case 99 /* SuperKeyword */:
+ case 103 /* TrueKeyword */:
+ case 101 /* ThisKeyword */:
+ case 93 /* ImportKeyword */:
writeTokenNode(node, writeKeyword);
return;
// Expressions
- case 187 /* ArrayLiteralExpression */:
+ case 188 /* ArrayLiteralExpression */:
return emitArrayLiteralExpression(node);
- case 188 /* ObjectLiteralExpression */:
+ case 189 /* ObjectLiteralExpression */:
return emitObjectLiteralExpression(node);
- case 189 /* PropertyAccessExpression */:
+ case 190 /* PropertyAccessExpression */:
return emitPropertyAccessExpression(node);
- case 190 /* ElementAccessExpression */:
+ case 191 /* ElementAccessExpression */:
return emitElementAccessExpression(node);
- case 191 /* CallExpression */:
+ case 192 /* CallExpression */:
return emitCallExpression(node);
- case 192 /* NewExpression */:
+ case 193 /* NewExpression */:
return emitNewExpression(node);
- case 193 /* TaggedTemplateExpression */:
+ case 194 /* TaggedTemplateExpression */:
return emitTaggedTemplateExpression(node);
- case 194 /* TypeAssertionExpression */:
+ case 195 /* TypeAssertionExpression */:
return emitTypeAssertionExpression(node);
- case 195 /* ParenthesizedExpression */:
+ case 196 /* ParenthesizedExpression */:
return emitParenthesizedExpression(node);
- case 196 /* FunctionExpression */:
+ case 197 /* FunctionExpression */:
return emitFunctionExpression(node);
- case 197 /* ArrowFunction */:
+ case 198 /* ArrowFunction */:
return emitArrowFunction(node);
- case 198 /* DeleteExpression */:
+ case 199 /* DeleteExpression */:
return emitDeleteExpression(node);
- case 199 /* TypeOfExpression */:
+ case 200 /* TypeOfExpression */:
return emitTypeOfExpression(node);
- case 200 /* VoidExpression */:
+ case 201 /* VoidExpression */:
return emitVoidExpression(node);
- case 201 /* AwaitExpression */:
+ case 202 /* AwaitExpression */:
return emitAwaitExpression(node);
- case 202 /* PrefixUnaryExpression */:
+ case 203 /* PrefixUnaryExpression */:
return emitPrefixUnaryExpression(node);
- case 203 /* PostfixUnaryExpression */:
+ case 204 /* PostfixUnaryExpression */:
return emitPostfixUnaryExpression(node);
- case 204 /* BinaryExpression */:
+ case 205 /* BinaryExpression */:
return emitBinaryExpression(node);
- case 205 /* ConditionalExpression */:
+ case 206 /* ConditionalExpression */:
return emitConditionalExpression(node);
- case 206 /* TemplateExpression */:
+ case 207 /* TemplateExpression */:
return emitTemplateExpression(node);
- case 207 /* YieldExpression */:
+ case 208 /* YieldExpression */:
return emitYieldExpression(node);
- case 208 /* SpreadElement */:
+ case 209 /* SpreadElement */:
return emitSpreadExpression(node);
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
return emitClassExpression(node);
- case 210 /* OmittedExpression */:
+ case 211 /* OmittedExpression */:
return;
- case 212 /* AsExpression */:
+ case 213 /* AsExpression */:
return emitAsExpression(node);
- case 213 /* NonNullExpression */:
+ case 214 /* NonNullExpression */:
return emitNonNullExpression(node);
- case 214 /* MetaProperty */:
+ case 215 /* MetaProperty */:
return emitMetaProperty(node);
// JSX
- case 260 /* JsxElement */:
+ case 261 /* JsxElement */:
return emitJsxElement(node);
- case 261 /* JsxSelfClosingElement */:
+ case 262 /* JsxSelfClosingElement */:
return emitJsxSelfClosingElement(node);
- case 264 /* JsxFragment */:
+ case 265 /* JsxFragment */:
return emitJsxFragment(node);
// Transformation nodes
- case 313 /* PartiallyEmittedExpression */:
+ case 314 /* PartiallyEmittedExpression */:
return emitPartiallyEmittedExpression(node);
- case 314 /* CommaListExpression */:
+ case 315 /* CommaListExpression */:
return emitCommaList(node);
}
}
@@ -84273,7 +85180,7 @@
}
function emitHelpers(node) {
var helpersEmitted = false;
- var bundle = node.kind === 285 /* Bundle */ ? node : undefined;
+ var bundle = node.kind === 286 /* Bundle */ ? node : undefined;
if (bundle && moduleKind === ts.ModuleKind.None) {
return;
}
@@ -84373,7 +85280,7 @@
var pos = getTextPosWithWriteLine();
writeUnparsedNode(unparsed);
if (bundleFileInfo) {
- updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 281 /* UnparsedText */ ?
+ updateOrPushBundleFileTextLike(pos, writer.getTextPos(), unparsed.kind === 282 /* UnparsedText */ ?
"text" /* Text */ :
"internal" /* Internal */);
}
@@ -84406,7 +85313,7 @@
emit(node.right);
}
function emitEntityName(node) {
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
emitExpression(node);
}
else {
@@ -84442,7 +85349,7 @@
emit(node.dotDotDotToken);
emitNodeWithWriter(node.name, writeParameter);
emit(node.questionToken);
- if (node.parent && node.parent.kind === 294 /* JSDocFunctionType */ && !node.name) {
+ if (node.parent && node.parent.kind === 295 /* JSDocFunctionType */ && !node.name) {
emit(node.type);
}
else {
@@ -84504,7 +85411,7 @@
function emitAccessorDeclaration(node) {
emitDecorators(node, node.decorators);
emitModifiers(node, node.modifiers);
- writeKeyword(node.kind === 158 /* GetAccessor */ ? "get" : "set");
+ writeKeyword(node.kind === 159 /* GetAccessor */ ? "get" : "set");
writeSpace();
emit(node.name);
emitSignatureAndBody(node, emitSignatureHead);
@@ -84681,7 +85588,7 @@
}
if (node.readonlyToken) {
emit(node.readonlyToken);
- if (node.readonlyToken.kind !== 133 /* ReadonlyKeyword */) {
+ if (node.readonlyToken.kind !== 134 /* ReadonlyKeyword */) {
writeKeyword("readonly");
}
writeSpace();
@@ -84831,7 +85738,7 @@
emitExpressionList(node, node.arguments, 2576 /* CallExpressionArguments */);
}
function emitNewExpression(node) {
- emitTokenWithComment(95 /* NewKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(96 /* NewKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
emitTypeArguments(node, node.typeArguments);
@@ -84871,22 +85778,22 @@
emit(node.equalsGreaterThanToken);
}
function emitDeleteExpression(node) {
- emitTokenWithComment(81 /* DeleteKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(82 /* DeleteKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
}
function emitTypeOfExpression(node) {
- emitTokenWithComment(104 /* TypeOfKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(105 /* TypeOfKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
}
function emitVoidExpression(node) {
- emitTokenWithComment(106 /* VoidKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(107 /* VoidKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
}
function emitAwaitExpression(node) {
- emitTokenWithComment(122 /* AwaitKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(123 /* AwaitKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
}
@@ -84911,7 +85818,7 @@
// expression a prefix increment whose operand is a plus expression - (++(+x))
// The same is true of minus of course.
var operand = node.operand;
- return operand.kind === 202 /* PrefixUnaryExpression */
+ return operand.kind === 203 /* PrefixUnaryExpression */
&& ((node.operator === 38 /* PlusToken */ && (operand.operator === 38 /* PlusToken */ || operand.operator === 44 /* PlusPlusToken */))
|| (node.operator === 39 /* MinusToken */ && (operand.operator === 39 /* MinusToken */ || operand.operator === 45 /* MinusMinusToken */)));
}
@@ -84926,7 +85833,7 @@
emitExpression(node.left);
increaseIndentIf(indentBeforeOperator, isCommaOperator);
emitLeadingCommentsOfPosition(node.operatorToken.pos);
- writeTokenNode(node.operatorToken, node.operatorToken.kind === 93 /* InKeyword */ ? writeKeyword : writeOperator);
+ writeTokenNode(node.operatorToken, node.operatorToken.kind === 94 /* InKeyword */ ? writeKeyword : writeOperator);
emitTrailingCommentsOfPosition(node.operatorToken.end, /*prefixSpace*/ true); // Binary operators should have a space before the comment starts
increaseIndentIf(indentAfterOperator, /*writeSpaceIfNotIndenting*/ true);
emitExpression(node.right);
@@ -84954,7 +85861,7 @@
emitList(node, node.templateSpans, 262144 /* TemplateExpressionSpans */);
}
function emitYieldExpression(node) {
- emitTokenWithComment(117 /* YieldKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(118 /* YieldKeyword */, node.pos, writeKeyword, node);
emit(node.asteriskToken);
emitExpressionWithLeadingSpace(node.expression);
}
@@ -85031,7 +85938,7 @@
}
}
function emitIfStatement(node) {
- var openParenPos = emitTokenWithComment(91 /* IfKeyword */, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(92 /* IfKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
emitExpression(node.expression);
@@ -85039,8 +85946,8 @@
emitEmbeddedStatement(node, node.thenStatement);
if (node.elseStatement) {
writeLineOrSpace(node);
- emitTokenWithComment(83 /* ElseKeyword */, node.thenStatement.end, writeKeyword, node);
- if (node.elseStatement.kind === 222 /* IfStatement */) {
+ emitTokenWithComment(84 /* ElseKeyword */, node.thenStatement.end, writeKeyword, node);
+ if (node.elseStatement.kind === 223 /* IfStatement */) {
writeSpace();
emit(node.elseStatement);
}
@@ -85050,14 +85957,14 @@
}
}
function emitWhileClause(node, startPos) {
- var openParenPos = emitTokenWithComment(107 /* WhileKeyword */, startPos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(108 /* WhileKeyword */, startPos, writeKeyword, node);
writeSpace();
emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
emitExpression(node.expression);
emitTokenWithComment(21 /* CloseParenToken */, node.expression.end, writePunctuation, node);
}
function emitDoStatement(node) {
- emitTokenWithComment(82 /* DoKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(83 /* DoKeyword */, node.pos, writeKeyword, node);
emitEmbeddedStatement(node, node.statement);
if (ts.isBlock(node.statement)) {
writeSpace();
@@ -85073,7 +85980,7 @@
emitEmbeddedStatement(node, node.statement);
}
function emitForStatement(node) {
- var openParenPos = emitTokenWithComment(89 /* ForKeyword */, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(90 /* ForKeyword */, node.pos, writeKeyword, node);
writeSpace();
var pos = emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, /*contextNode*/ node);
emitForBinding(node.initializer);
@@ -85085,25 +85992,25 @@
emitEmbeddedStatement(node, node.statement);
}
function emitForInStatement(node) {
- var openParenPos = emitTokenWithComment(89 /* ForKeyword */, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(90 /* ForKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
emitForBinding(node.initializer);
writeSpace();
- emitTokenWithComment(93 /* InKeyword */, node.initializer.end, writeKeyword, node);
+ emitTokenWithComment(94 /* InKeyword */, node.initializer.end, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
emitTokenWithComment(21 /* CloseParenToken */, node.expression.end, writePunctuation, node);
emitEmbeddedStatement(node, node.statement);
}
function emitForOfStatement(node) {
- var openParenPos = emitTokenWithComment(89 /* ForKeyword */, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(90 /* ForKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitWithTrailingSpace(node.awaitModifier);
emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
emitForBinding(node.initializer);
writeSpace();
- emitTokenWithComment(147 /* OfKeyword */, node.initializer.end, writeKeyword, node);
+ emitTokenWithComment(148 /* OfKeyword */, node.initializer.end, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
emitTokenWithComment(21 /* CloseParenToken */, node.expression.end, writePunctuation, node);
@@ -85111,7 +86018,7 @@
}
function emitForBinding(node) {
if (node !== undefined) {
- if (node.kind === 238 /* VariableDeclarationList */) {
+ if (node.kind === 239 /* VariableDeclarationList */) {
emit(node);
}
else {
@@ -85120,12 +86027,12 @@
}
}
function emitContinueStatement(node) {
- emitTokenWithComment(78 /* ContinueKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(79 /* ContinueKeyword */, node.pos, writeKeyword, node);
emitWithLeadingSpace(node.label);
writeTrailingSemicolon();
}
function emitBreakStatement(node) {
- emitTokenWithComment(73 /* BreakKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(74 /* BreakKeyword */, node.pos, writeKeyword, node);
emitWithLeadingSpace(node.label);
writeTrailingSemicolon();
}
@@ -85153,12 +86060,12 @@
return pos;
}
function emitReturnStatement(node) {
- emitTokenWithComment(97 /* ReturnKeyword */, node.pos, writeKeyword, /*contextNode*/ node);
+ emitTokenWithComment(98 /* ReturnKeyword */, node.pos, writeKeyword, /*contextNode*/ node);
emitExpressionWithLeadingSpace(node.expression);
writeTrailingSemicolon();
}
function emitWithStatement(node) {
- var openParenPos = emitTokenWithComment(108 /* WithKeyword */, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(109 /* WithKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
emitExpression(node.expression);
@@ -85166,7 +86073,7 @@
emitEmbeddedStatement(node, node.statement);
}
function emitSwitchStatement(node) {
- var openParenPos = emitTokenWithComment(99 /* SwitchKeyword */, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(100 /* SwitchKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
emitExpression(node.expression);
@@ -85181,12 +86088,12 @@
emit(node.statement);
}
function emitThrowStatement(node) {
- emitTokenWithComment(101 /* ThrowKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(102 /* ThrowKeyword */, node.pos, writeKeyword, node);
emitExpressionWithLeadingSpace(node.expression);
writeTrailingSemicolon();
}
function emitTryStatement(node) {
- emitTokenWithComment(103 /* TryKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(104 /* TryKeyword */, node.pos, writeKeyword, node);
writeSpace();
emit(node.tryBlock);
if (node.catchClause) {
@@ -85195,13 +86102,13 @@
}
if (node.finallyBlock) {
writeLineOrSpace(node);
- emitTokenWithComment(88 /* FinallyKeyword */, (node.catchClause || node.tryBlock).end, writeKeyword, node);
+ emitTokenWithComment(89 /* FinallyKeyword */, (node.catchClause || node.tryBlock).end, writeKeyword, node);
writeSpace();
emit(node.finallyBlock);
}
}
function emitDebuggerStatement(node) {
- writeToken(79 /* DebuggerKeyword */, node.pos, writeKeyword);
+ writeToken(80 /* DebuggerKeyword */, node.pos, writeKeyword);
writeTrailingSemicolon();
}
//
@@ -85406,7 +86313,7 @@
var body = node.body;
if (!body)
return writeTrailingSemicolon();
- while (body.kind === 244 /* ModuleDeclaration */) {
+ while (body.kind === 245 /* ModuleDeclaration */) {
writePunctuation(".");
emit(body.name);
body = body.body;
@@ -85427,17 +86334,17 @@
}
function emitImportEqualsDeclaration(node) {
emitModifiers(node, node.modifiers);
- emitTokenWithComment(92 /* ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node);
+ emitTokenWithComment(93 /* ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node);
writeSpace();
emit(node.name);
writeSpace();
- emitTokenWithComment(59 /* EqualsToken */, node.name.end, writePunctuation, node);
+ emitTokenWithComment(60 /* EqualsToken */, node.name.end, writePunctuation, node);
writeSpace();
emitModuleReference(node.moduleReference);
writeTrailingSemicolon();
}
function emitModuleReference(node) {
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
emitExpression(node);
}
else {
@@ -85446,12 +86353,12 @@
}
function emitImportDeclaration(node) {
emitModifiers(node, node.modifiers);
- emitTokenWithComment(92 /* ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node);
+ emitTokenWithComment(93 /* ImportKeyword */, node.modifiers ? node.modifiers.end : node.pos, writeKeyword, node);
writeSpace();
if (node.importClause) {
emit(node.importClause);
writeSpace();
- emitTokenWithComment(144 /* FromKeyword */, node.importClause.end, writeKeyword, node);
+ emitTokenWithComment(145 /* FromKeyword */, node.importClause.end, writeKeyword, node);
writeSpace();
}
emitExpression(node.moduleSpecifier);
@@ -85468,7 +86375,7 @@
function emitNamespaceImport(node) {
var asPos = emitTokenWithComment(40 /* AsteriskToken */, node.pos, writePunctuation, node);
writeSpace();
- emitTokenWithComment(119 /* AsKeyword */, asPos, writeKeyword, node);
+ emitTokenWithComment(120 /* AsKeyword */, asPos, writeKeyword, node);
writeSpace();
emit(node.name);
}
@@ -85479,20 +86386,20 @@
emitImportOrExportSpecifier(node);
}
function emitExportAssignment(node) {
- var nextPos = emitTokenWithComment(85 /* ExportKeyword */, node.pos, writeKeyword, node);
+ var nextPos = emitTokenWithComment(86 /* ExportKeyword */, node.pos, writeKeyword, node);
writeSpace();
if (node.isExportEquals) {
- emitTokenWithComment(59 /* EqualsToken */, nextPos, writeOperator, node);
+ emitTokenWithComment(60 /* EqualsToken */, nextPos, writeOperator, node);
}
else {
- emitTokenWithComment(80 /* DefaultKeyword */, nextPos, writeKeyword, node);
+ emitTokenWithComment(81 /* DefaultKeyword */, nextPos, writeKeyword, node);
}
writeSpace();
emitExpression(node.expression);
writeTrailingSemicolon();
}
function emitExportDeclaration(node) {
- var nextPos = emitTokenWithComment(85 /* ExportKeyword */, node.pos, writeKeyword, node);
+ var nextPos = emitTokenWithComment(86 /* ExportKeyword */, node.pos, writeKeyword, node);
writeSpace();
if (node.exportClause) {
emit(node.exportClause);
@@ -85503,18 +86410,18 @@
if (node.moduleSpecifier) {
writeSpace();
var fromPos = node.exportClause ? node.exportClause.end : nextPos;
- emitTokenWithComment(144 /* FromKeyword */, fromPos, writeKeyword, node);
+ emitTokenWithComment(145 /* FromKeyword */, fromPos, writeKeyword, node);
writeSpace();
emitExpression(node.moduleSpecifier);
}
writeTrailingSemicolon();
}
function emitNamespaceExportDeclaration(node) {
- var nextPos = emitTokenWithComment(85 /* ExportKeyword */, node.pos, writeKeyword, node);
+ var nextPos = emitTokenWithComment(86 /* ExportKeyword */, node.pos, writeKeyword, node);
writeSpace();
- nextPos = emitTokenWithComment(119 /* AsKeyword */, nextPos, writeKeyword, node);
+ nextPos = emitTokenWithComment(120 /* AsKeyword */, nextPos, writeKeyword, node);
writeSpace();
- nextPos = emitTokenWithComment(131 /* NamespaceKeyword */, nextPos, writeKeyword, node);
+ nextPos = emitTokenWithComment(132 /* NamespaceKeyword */, nextPos, writeKeyword, node);
writeSpace();
emit(node.name);
writeTrailingSemicolon();
@@ -85534,7 +86441,7 @@
if (node.propertyName) {
emit(node.propertyName);
writeSpace();
- emitTokenWithComment(119 /* AsKeyword */, node.propertyName.end, writeKeyword, node);
+ emitTokenWithComment(120 /* AsKeyword */, node.propertyName.end, writeKeyword, node);
writeSpace();
}
emit(node.name);
@@ -85612,7 +86519,7 @@
}
}
function emitJsxTagName(node) {
- if (node.kind === 72 /* Identifier */) {
+ if (node.kind === 73 /* Identifier */) {
emitExpression(node);
}
else {
@@ -85623,13 +86530,13 @@
// Clauses
//
function emitCaseClause(node) {
- emitTokenWithComment(74 /* CaseKeyword */, node.pos, writeKeyword, node);
+ emitTokenWithComment(75 /* CaseKeyword */, node.pos, writeKeyword, node);
writeSpace();
emitExpression(node.expression);
emitCaseOrDefaultClauseRest(node, node.statements, node.expression.end);
}
function emitDefaultClause(node) {
- var pos = emitTokenWithComment(80 /* DefaultKeyword */, node.pos, writeKeyword, node);
+ var pos = emitTokenWithComment(81 /* DefaultKeyword */, node.pos, writeKeyword, node);
emitCaseOrDefaultClauseRest(node, node.statements, pos);
}
function emitCaseOrDefaultClauseRest(parentNode, statements, colonPos) {
@@ -85657,7 +86564,7 @@
emitList(node, node.types, 528 /* HeritageClauseTypes */);
}
function emitCatchClause(node) {
- var openParenPos = emitTokenWithComment(75 /* CatchKeyword */, node.pos, writeKeyword, node);
+ var openParenPos = emitTokenWithComment(76 /* CatchKeyword */, node.pos, writeKeyword, node);
writeSpace();
if (node.variableDeclaration) {
emitTokenWithComment(20 /* OpenParenToken */, openParenPos, writePunctuation, node);
@@ -85727,7 +86634,7 @@
}
}
if (node.tags) {
- if (node.tags.length === 1 && node.tags[0].kind === 307 /* JSDocTypeTag */ && !node.comment) {
+ if (node.tags.length === 1 && node.tags[0].kind === 308 /* JSDocTypeTag */ && !node.comment) {
writeSpace();
emit(node.tags[0]);
}
@@ -85761,7 +86668,7 @@
function emitJSDocTypedefTag(tag) {
emitJSDocTagName(tag.tagName);
if (tag.typeExpression) {
- if (tag.typeExpression.kind === 288 /* JSDocTypeExpression */) {
+ if (tag.typeExpression.kind === 289 /* JSDocTypeExpression */) {
emitJSDocTypeExpression(tag.typeExpression);
}
else {
@@ -85780,7 +86687,7 @@
emit(tag.fullName);
}
emitJSDocComment(tag.comment);
- if (tag.typeExpression && tag.typeExpression.kind === 297 /* JSDocTypeLiteral */) {
+ if (tag.typeExpression && tag.typeExpression.kind === 298 /* JSDocTypeLiteral */) {
emitJSDocTypeLiteral(tag.typeExpression);
}
}
@@ -85914,8 +86821,8 @@
bundleFileInfo.sections.push({ pos: pos, end: writer.getTextPos(), kind: "reference" /* Reference */, data: directive.fileName });
writeLine();
}
- for (var _d = 0, types_19 = types; _d < types_19.length; _d++) {
- var directive = types_19[_d];
+ for (var _d = 0, types_18 = types; _d < types_18.length; _d++) {
+ var directive = types_18[_d];
var pos = writer.getTextPos();
writeComment("/// <reference types=\"" + directive.fileName + "\" />");
if (bundleFileInfo)
@@ -86095,7 +87002,7 @@
function emitInitializer(node, equalCommentStartPos, container) {
if (node) {
writeSpace();
- emitTokenWithComment(59 /* EqualsToken */, equalCommentStartPos, writeOperator, container);
+ emitTokenWithComment(60 /* EqualsToken */, equalCommentStartPos, writeOperator, container);
writeSpace();
emitExpression(node);
}
@@ -86558,7 +87465,7 @@
&& ts.rangeEndIsOnSameLineAsRangeStart(block, block, currentSourceFile);
}
function skipSynthesizedParentheses(node) {
- while (node.kind === 195 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) {
+ while (node.kind === 196 /* ParenthesizedExpression */ && ts.nodeIsSynthesized(node)) {
node = node.expression;
}
return node;
@@ -86623,81 +87530,81 @@
if (!node)
return;
switch (node.kind) {
- case 218 /* Block */:
+ case 219 /* Block */:
ts.forEach(node.statements, generateNames);
break;
- case 233 /* LabeledStatement */:
- case 231 /* WithStatement */:
- case 223 /* DoStatement */:
- case 224 /* WhileStatement */:
+ case 234 /* LabeledStatement */:
+ case 232 /* WithStatement */:
+ case 224 /* DoStatement */:
+ case 225 /* WhileStatement */:
generateNames(node.statement);
break;
- case 222 /* IfStatement */:
+ case 223 /* IfStatement */:
generateNames(node.thenStatement);
generateNames(node.elseStatement);
break;
- case 225 /* ForStatement */:
- case 227 /* ForOfStatement */:
- case 226 /* ForInStatement */:
+ case 226 /* ForStatement */:
+ case 228 /* ForOfStatement */:
+ case 227 /* ForInStatement */:
generateNames(node.initializer);
generateNames(node.statement);
break;
- case 232 /* SwitchStatement */:
+ case 233 /* SwitchStatement */:
generateNames(node.caseBlock);
break;
- case 246 /* CaseBlock */:
+ case 247 /* CaseBlock */:
ts.forEach(node.clauses, generateNames);
break;
- case 271 /* CaseClause */:
- case 272 /* DefaultClause */:
+ case 272 /* CaseClause */:
+ case 273 /* DefaultClause */:
ts.forEach(node.statements, generateNames);
break;
- case 235 /* TryStatement */:
+ case 236 /* TryStatement */:
generateNames(node.tryBlock);
generateNames(node.catchClause);
generateNames(node.finallyBlock);
break;
- case 274 /* CatchClause */:
+ case 275 /* CatchClause */:
generateNames(node.variableDeclaration);
generateNames(node.block);
break;
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
generateNames(node.declarationList);
break;
- case 238 /* VariableDeclarationList */:
+ case 239 /* VariableDeclarationList */:
ts.forEach(node.declarations, generateNames);
break;
- case 237 /* VariableDeclaration */:
- case 151 /* Parameter */:
- case 186 /* BindingElement */:
- case 240 /* ClassDeclaration */:
+ case 238 /* VariableDeclaration */:
+ case 152 /* Parameter */:
+ case 187 /* BindingElement */:
+ case 241 /* ClassDeclaration */:
generateNameIfNeeded(node.name);
break;
- case 239 /* FunctionDeclaration */:
+ case 240 /* FunctionDeclaration */:
generateNameIfNeeded(node.name);
if (ts.getEmitFlags(node) & 524288 /* ReuseTempVariableScope */) {
ts.forEach(node.parameters, generateNames);
generateNames(node.body);
}
break;
- case 184 /* ObjectBindingPattern */:
- case 185 /* ArrayBindingPattern */:
+ case 185 /* ObjectBindingPattern */:
+ case 186 /* ArrayBindingPattern */:
ts.forEach(node.elements, generateNames);
break;
- case 249 /* ImportDeclaration */:
+ case 250 /* ImportDeclaration */:
generateNames(node.importClause);
break;
- case 250 /* ImportClause */:
+ case 251 /* ImportClause */:
generateNameIfNeeded(node.name);
generateNames(node.namedBindings);
break;
- case 251 /* NamespaceImport */:
+ case 252 /* NamespaceImport */:
generateNameIfNeeded(node.name);
break;
- case 252 /* NamedImports */:
+ case 253 /* NamedImports */:
ts.forEach(node.elements, generateNames);
break;
- case 253 /* ImportSpecifier */:
+ case 254 /* ImportSpecifier */:
generateNameIfNeeded(node.propertyName || node.name);
break;
}
@@ -86706,12 +87613,12 @@
if (!node)
return;
switch (node.kind) {
- case 275 /* PropertyAssignment */:
- case 276 /* ShorthandPropertyAssignment */:
- case 154 /* PropertyDeclaration */:
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 276 /* PropertyAssignment */:
+ case 277 /* ShorthandPropertyAssignment */:
+ case 155 /* PropertyDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
generateNameIfNeeded(node.name);
break;
}
@@ -86891,24 +87798,26 @@
*/
function generateNameForNode(node, flags) {
switch (node.kind) {
- case 72 /* Identifier */:
+ case 73 /* Identifier */:
return makeUniqueName(getTextOfNode(node), isUniqueName, !!(flags & 16 /* Optimistic */), !!(flags & 8 /* ReservedInNestedScopes */));
- case 244 /* ModuleDeclaration */:
- case 243 /* EnumDeclaration */:
+ case 245 /* ModuleDeclaration */:
+ case 244 /* EnumDeclaration */:
return generateNameForModuleOrEnum(node);
- case 249 /* ImportDeclaration */:
- case 255 /* ExportDeclaration */:
+ case 250 /* ImportDeclaration */:
+ case 256 /* ExportDeclaration */:
return generateNameForImportOrExportDeclaration(node);
- case 239 /* FunctionDeclaration */:
- case 240 /* ClassDeclaration */:
- case 254 /* ExportAssignment */:
+ case 240 /* FunctionDeclaration */:
+ case 241 /* ClassDeclaration */:
+ case 255 /* ExportAssignment */:
return generateNameForExportDefault();
- case 209 /* ClassExpression */:
+ case 210 /* ClassExpression */:
return generateNameForClassExpression();
- case 156 /* MethodDeclaration */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
+ case 157 /* MethodDeclaration */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
return generateNameForMethodOrAccessor(node);
+ case 150 /* ComputedPropertyName */:
+ return makeTempVariableName(0 /* Auto */, /*reserveInNestedScopes*/ true);
default:
return makeTempVariableName(0 /* Auto */);
}
@@ -86954,7 +87863,7 @@
hasWrittenComment = false;
var emitFlags = ts.getEmitFlags(node);
var _a = ts.getCommentRange(node), pos = _a.pos, end = _a.end;
- var isEmittedNode = node.kind !== 312 /* NotEmittedStatement */;
+ var isEmittedNode = node.kind !== 313 /* NotEmittedStatement */;
// We have to explicitly check that the node is JsxText because if the compilerOptions.jsx is "preserve" we will not do any transformation.
// It is expensive to walk entire tree just to set one kind of node to have no comments.
var skipLeadingComments = pos < 0 || (emitFlags & 512 /* NoLeadingComments */) !== 0 || node.kind === 11 /* JsxText */;
@@ -86978,7 +87887,7 @@
containerEnd = end;
// To avoid invalid comment emit in a down-level binding pattern, we
// keep track of the last declaration list container's end
- if (node.kind === 238 /* VariableDeclarationList */) {
+ if (node.kind === 239 /* VariableDeclarationList */) {
declarationListContainerEnd = end;
}
}
@@ -87235,7 +88144,7 @@
else {
var _a = ts.getSourceMapRange(node), pos = _a.pos, end = _a.end, _b = _a.source, source = _b === void 0 ? sourceMapSource : _b;
var emitFlags = ts.getEmitFlags(node);
- if (node.kind !== 312 /* NotEmittedStatement */
+ if (node.kind !== 313 /* NotEmittedStatement */
&& (emitFlags & 16 /* NoLeadingSourceMap */) === 0
&& pos >= 0) {
emitSourcePos(source, skipSourceTrivia(source, pos));
@@ -87248,7 +88157,7 @@
else {
pipelinePhase(hint, node);
}
- if (node.kind !== 312 /* NotEmittedStatement */
+ if (node.kind !== 313 /* NotEmittedStatement */
&& (emitFlags & 32 /* NoTrailingSourceMap */) === 0
&& end >= 0) {
emitSourcePos(source, end);
@@ -87863,7 +88772,8 @@
getDirectories: function (path) { return system.getDirectories(path); },
realpath: realpath,
readDirectory: function (path, extensions, include, exclude, depth) { return system.readDirectory(path, extensions, include, exclude, depth); },
- createDirectory: function (d) { return system.createDirectory(d); }
+ createDirectory: function (d) { return system.createDirectory(d); },
+ createHash: ts.maybeBind(system, system.createHash)
};
return compilerHost;
}
@@ -88149,6 +89059,7 @@
}
}
ts.flattenDiagnosticMessageText = flattenDiagnosticMessageText;
+ /* @internal */
function loadWithLocalCache(names, containingFile, redirectedReference, loader) {
if (names.length === 0) {
return [];
@@ -88168,6 +89079,7 @@
}
return resolutions;
}
+ ts.loadWithLocalCache = loadWithLocalCache;
/**
* Determines if program structure is upto date or needs to be recreated
*/
@@ -88327,7 +89239,7 @@
}); };
}
else {
- moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, function (x) { return host.getCanonicalFileName(x); });
+ moduleResolutionCache = ts.createModuleResolutionCache(currentDirectory, function (x) { return host.getCanonicalFileName(x); }, options);
var loader_1 = function (moduleName, containingFile, redirectedReference) { return ts.resolveModuleName(moduleName, containingFile, options, host, moduleResolutionCache, redirectedReference).resolvedModule; }; // TODO: GH#18217
resolveModuleNamesWorker = function (moduleNames, containingFile, _reusedNames, redirectedReference) { return loadWithLocalCache(ts.Debug.assertEachDefined(moduleNames), containingFile, redirectedReference, loader_1); };
}
@@ -88473,6 +89385,7 @@
getIdentifierCount: function () { return getDiagnosticsProducingTypeChecker().getIdentifierCount(); },
getSymbolCount: function () { return getDiagnosticsProducingTypeChecker().getSymbolCount(); },
getTypeCount: function () { return getDiagnosticsProducingTypeChecker().getTypeCount(); },
+ getRelationCacheSizes: function () { return getDiagnosticsProducingTypeChecker().getRelationCacheSizes(); },
getFileProcessingDiagnostics: function () { return fileProcessingDiagnostics; },
getResolvedTypeReferenceDirectives: function () { return resolvedTypeReferenceDirectives; },
isSourceFileFromExternalLibrary: isSourceFileFromExternalLibrary,
@@ -88570,13 +89483,13 @@
// which per above occurred during the current program creation.
// Since we assume the filesystem does not change during program creation,
// it is safe to reuse resolutions from the earlier call.
- var result_6 = [];
+ var result_8 = [];
for (var _i = 0, moduleNames_1 = moduleNames; _i < moduleNames_1.length; _i++) {
var moduleName = moduleNames_1[_i];
var resolvedModule = file.resolvedModules.get(moduleName);
- result_6.push(resolvedModule);
+ result_8.push(resolvedModule);
}
- return result_6;
+ return result_8;
}
// At this point, we know at least one of the following hold:
// - file has local declarations for ambient modules
@@ -88663,7 +89576,7 @@
function moduleNameResolvesToAmbientModuleInNonModifiedFile(moduleName) {
var resolutionToFile = ts.getResolvedModule(oldSourceFile, moduleName);
var resolvedFile = resolutionToFile && oldProgram.getSourceFile(resolutionToFile.resolvedFileName);
- if (resolutionToFile && resolvedFile && !resolvedFile.externalModuleIndicator) {
+ if (resolutionToFile && resolvedFile) {
// In the old program, we resolved to an ambient module that was in the same
// place as we expected to find an actual module file.
// We actually need to return 'false' here even though this seems like a 'true' case
@@ -88926,9 +89839,8 @@
ts.performance.mark("beforeEmit");
var emitResult = ts.emitFiles(ts.notImplementedResolver, getEmitHost(writeFileCallback),
/*targetSourceFile*/ undefined,
+ /*transformers*/ ts.noTransformers,
/*emitOnlyDtsFiles*/ false,
- /*transformers*/ undefined,
- /*declaraitonTransformers*/ undefined,
/*onlyBuildInfo*/ true);
ts.performance.mark("afterEmit");
ts.performance.measure("Emit", "beforeEmit", "afterEmit");
@@ -89016,8 +89928,7 @@
// checked is to not pass the file to getEmitResolver.
var emitResolver = getDiagnosticsProducingTypeChecker().getEmitResolver((options.outFile || options.out) ? undefined : sourceFile, cancellationToken);
ts.performance.mark("beforeEmit");
- var transformers = emitOnlyDtsFiles ? [] : ts.getTransformers(options, customTransformers);
- var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile, emitOnlyDtsFiles, transformers, customTransformers && customTransformers.afterDeclarations);
+ var emitResult = ts.emitFiles(emitResolver, getEmitHost(writeFileCallback), sourceFile, ts.getTransformers(options, customTransformers, emitOnlyDtsFiles), emitOnlyDtsFiles);
ts.performance.mark("afterEmit");
ts.performance.measure("Emit", "beforeEmit", "afterEmit");
return emitResult;
@@ -89159,22 +90070,22 @@
// Return directly from the case if the given node doesnt want to visit each child
// Otherwise break to visit each child
switch (parent.kind) {
- case 151 /* Parameter */:
- case 154 /* PropertyDeclaration */:
+ case 152 /* Parameter */:
+ case 155 /* PropertyDeclaration */:
if (parent.questionToken === node) {
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, "?"));
return;
}
// falls through
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 196 /* FunctionExpression */:
- case 239 /* FunctionDeclaration */:
- case 197 /* ArrowFunction */:
- case 237 /* VariableDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 197 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
+ case 198 /* ArrowFunction */:
+ case 238 /* VariableDeclaration */:
// type annotation
if (parent.type === node) {
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.types_can_only_be_used_in_a_ts_file));
@@ -89182,41 +90093,41 @@
}
}
switch (node.kind) {
- case 248 /* ImportEqualsDeclaration */:
+ case 249 /* ImportEqualsDeclaration */:
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.import_can_only_be_used_in_a_ts_file));
return;
- case 254 /* ExportAssignment */:
+ case 255 /* ExportAssignment */:
if (node.isExportEquals) {
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.export_can_only_be_used_in_a_ts_file));
return;
}
break;
- case 273 /* HeritageClause */:
+ case 274 /* HeritageClause */:
var heritageClause = node;
- if (heritageClause.token === 109 /* ImplementsKeyword */) {
+ if (heritageClause.token === 110 /* ImplementsKeyword */) {
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.implements_clauses_can_only_be_used_in_a_ts_file));
return;
}
break;
- case 241 /* InterfaceDeclaration */:
+ case 242 /* InterfaceDeclaration */:
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.interface_declarations_can_only_be_used_in_a_ts_file));
return;
- case 244 /* ModuleDeclaration */:
+ case 245 /* ModuleDeclaration */:
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.module_declarations_can_only_be_used_in_a_ts_file));
return;
- case 242 /* TypeAliasDeclaration */:
+ case 243 /* TypeAliasDeclaration */:
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.type_aliases_can_only_be_used_in_a_ts_file));
return;
- case 243 /* EnumDeclaration */:
+ case 244 /* EnumDeclaration */:
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.enum_declarations_can_only_be_used_in_a_ts_file));
return;
- case 213 /* NonNullExpression */:
+ case 214 /* NonNullExpression */:
diagnostics.push(createDiagnosticForNode(node, ts.Diagnostics.non_null_assertions_can_only_be_used_in_a_ts_file));
return;
- case 212 /* AsExpression */:
+ case 213 /* AsExpression */:
diagnostics.push(createDiagnosticForNode(node.type, ts.Diagnostics.type_assertion_expressions_can_only_be_used_in_a_ts_file));
return;
- case 194 /* TypeAssertionExpression */:
+ case 195 /* TypeAssertionExpression */:
ts.Debug.fail(); // Won't parse these in a JS file anyway, as they are interpreted as JSX.
}
var prevParent = parent;
@@ -89226,54 +90137,54 @@
}
function walkArray(nodes) {
if (parent.decorators === nodes && !options.experimentalDecorators) {
- diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_to_remove_this_warning));
+ diagnostics.push(createDiagnosticForNode(parent, ts.Diagnostics.Experimental_support_for_decorators_is_a_feature_that_is_subject_to_change_in_a_future_release_Set_the_experimentalDecorators_option_in_your_tsconfig_or_jsconfig_to_remove_this_warning));
}
switch (parent.kind) {
- case 240 /* ClassDeclaration */:
- case 156 /* MethodDeclaration */:
- case 155 /* MethodSignature */:
- case 157 /* Constructor */:
- case 158 /* GetAccessor */:
- case 159 /* SetAccessor */:
- case 196 /* FunctionExpression */:
- case 239 /* FunctionDeclaration */:
- case 197 /* ArrowFunction */:
+ case 241 /* ClassDeclaration */:
+ case 157 /* MethodDeclaration */:
+ case 156 /* MethodSignature */:
+ case 158 /* Constructor */:
+ case 159 /* GetAccessor */:
+ case 160 /* SetAccessor */:
+ case 197 /* FunctionExpression */:
+ case 240 /* FunctionDeclaration */:
+ case 198 /* ArrowFunction */:
// Check type parameters
if (nodes === parent.typeParameters) {
diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_parameter_declarations_can_only_be_used_in_a_ts_file));
return;
}
// falls through
- case 219 /* VariableStatement */:
+ case 220 /* VariableStatement */:
// Check modifiers
if (nodes === parent.modifiers) {
- return checkModifiers(nodes, parent.kind === 219 /* VariableStatement */);
+ return checkModifiers(nodes, parent.kind === 220 /* VariableStatement */);
}
break;
- case 154 /* PropertyDeclaration */:
+ case 155 /* PropertyDeclaration */:
// Check modifiers of property declaration
if (nodes === parent.modifiers) {
for (var _i = 0, _a = nodes; _i < _a.length; _i++) {
var modifier = _a[_i];
- if (modifier.kind !== 116 /* StaticKeyword */) {
+ if (modifier.kind !== 117 /* StaticKeyword */) {
diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind)));
}
}
return;
}
break;
- case 151 /* Parameter */:
+ case 152 /* Parameter */:
// Check modifiers of parameter declaration
if (nodes === parent.modifiers) {
diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.parameter_modifiers_can_only_be_used_in_a_ts_file));
return;
}
break;
- case 191 /* CallExpression */:
- case 192 /* NewExpression */:
- case 211 /* ExpressionWithTypeArguments */:
- case 261 /* JsxSelfClosingElement */:
- case 262 /* JsxOpeningElement */:
+ case 192 /* CallExpression */:
+ case 193 /* NewExpression */:
+ case 212 /* ExpressionWithTypeArguments */:
+ case 262 /* JsxSelfClosingElement */:
+ case 263 /* JsxOpeningElement */:
// Check type arguments
if (nodes === parent.typeArguments) {
diagnostics.push(createDiagnosticForNodeArray(nodes, ts.Diagnostics.type_arguments_can_only_be_used_in_a_ts_file));
@@ -89290,24 +90201,24 @@
for (var _i = 0, modifiers_1 = modifiers; _i < modifiers_1.length; _i++) {
var modifier = modifiers_1[_i];
switch (modifier.kind) {
- case 77 /* ConstKeyword */:
+ case 78 /* ConstKeyword */:
if (isConstValid) {
continue;
}
// to report error,
// falls through
- case 115 /* PublicKeyword */:
- case 113 /* PrivateKeyword */:
- case 114 /* ProtectedKeyword */:
- case 133 /* ReadonlyKeyword */:
- case 125 /* DeclareKeyword */:
- case 118 /* AbstractKeyword */:
+ case 116 /* PublicKeyword */:
+ case 114 /* PrivateKeyword */:
+ case 115 /* ProtectedKeyword */:
+ case 134 /* ReadonlyKeyword */:
+ case 126 /* DeclareKeyword */:
+ case 119 /* AbstractKeyword */:
diagnostics.push(createDiagnosticForNode(modifier, ts.Diagnostics._0_can_only_be_used_in_a_ts_file, ts.tokenToString(modifier.kind)));
break;
// These are all legal modifiers.
- case 116 /* StaticKeyword */:
- case 85 /* ExportKeyword */:
- case 80 /* DefaultKeyword */:
+ case 117 /* StaticKeyword */:
+ case 86 /* ExportKeyword */:
+ case 81 /* DefaultKeyword */:
}
}
}
@@ -89382,8 +90293,8 @@
return a.fileName === b.fileName;
}
function moduleNameIsEqualTo(a, b) {
- return a.kind === 72 /* Identifier */
- ? b.kind === 72 /* Identifier */ && a.escapedText === b.escapedText
+ return a.kind === 73 /* Identifier */
+ ? b.kind === 73 /* Identifier */ && a.escapedText === b.escapedText
: b.kind === 10 /* StringLiteral */ && a.text === b.text;
}
function collectExternalModuleReferences(file) {
@@ -89598,7 +90509,10 @@
if (isRedirect) {
inputName = getProjectReferenceRedirect(fileName) || fileName;
}
- if (ts.getNormalizedAbsolutePath(checkedName, currentDirectory) !== ts.getNormalizedAbsolutePath(inputName, currentDirectory)) {
+ // Check if it differs only in drive letters its ok to ignore that error:
+ var checkedAbsolutePath = ts.getNormalizedAbsolutePathWithoutRoot(checkedName, currentDirectory);
+ var inputAbsolutePath = ts.getNormalizedAbsolutePathWithoutRoot(inputName, currentDirectory);
+ if (checkedAbsolutePath !== inputAbsolutePath) {
reportFileNamesDifferOnlyInCasingError(inputName, checkedName, refFile, refPos, refEnd);
}
}
@@ -89627,8 +90541,13 @@
}
var redirectedPath;
if (refFile) {
- var redirect = getProjectReferenceRedirect(fileName);
- if (redirect) {
+ var redirectProject = getProjectReferenceRedirectProject(fileName);
+ if (redirectProject) {
+ if (redirectProject.commandLine.options.outFile || redirectProject.commandLine.options.out) {
+ // Shouldnt create many to 1 mapping file in --out scenario
+ return undefined;
+ }
+ var redirect = getProjectReferenceOutputName(redirectProject, fileName);
fileName = redirect;
// Once we start redirecting to a file, we can potentially come back to it
// via a back-reference from another file in the .d.ts folder. If that happens we'll
@@ -89712,16 +90631,19 @@
}
}
function getProjectReferenceRedirect(fileName) {
+ var referencedProject = getProjectReferenceRedirectProject(fileName);
+ return referencedProject && getProjectReferenceOutputName(referencedProject, fileName);
+ }
+ function getProjectReferenceRedirectProject(fileName) {
// Ignore dts or any of the non ts files
if (!resolvedProjectReferences || !resolvedProjectReferences.length || ts.fileExtensionIs(fileName, ".d.ts" /* Dts */) || !ts.fileExtensionIsOneOf(fileName, ts.supportedTSExtensions)) {
return undefined;
}
// If this file is produced by a referenced project, we need to rewrite it to
// look in the output folder of the referenced project rather than the input
- var referencedProject = getResolvedProjectReferenceToRedirect(fileName);
- if (!referencedProject) {
- return undefined;
+ return getResolvedProjectReferenceToRedirect(fileName);
}
+ function getProjectReferenceOutputName(referencedProject, fileName) {
var out = referencedProject.commandLine.options.outFile || referencedProject.commandLine.options.out;
return out ?
ts.changeExtension(out, ".d.ts" /* Dts */) :
@@ -89966,18 +90888,33 @@
if (fromCache !== undefined) {
return fromCache || undefined;
}
+ var commandLine;
+ var sourceFile;
+ if (host.getParsedCommandLine) {
+ commandLine = host.getParsedCommandLine(refPath);
+ if (!commandLine) {
+ addFileToFilesByName(/*sourceFile*/ undefined, sourceFilePath, /*redirectedPath*/ undefined);
+ projectReferenceRedirects.set(sourceFilePath, false);
+ return undefined;
+ }
+ sourceFile = ts.Debug.assertDefined(commandLine.options.configFile);
+ ts.Debug.assert(!sourceFile.path || sourceFile.path === sourceFilePath);
+ addFileToFilesByName(sourceFile, sourceFilePath, /*redirectedPath*/ undefined);
+ }
+ else {
// An absolute path pointing to the containing directory of the config file
var basePath = ts.getNormalizedAbsolutePath(ts.getDirectoryPath(refPath), host.getCurrentDirectory());
- var sourceFile = host.getSourceFile(refPath, 100 /* JSON */);
+ sourceFile = host.getSourceFile(refPath, 100 /* JSON */);
addFileToFilesByName(sourceFile, sourceFilePath, /*redirectedPath*/ undefined);
if (sourceFile === undefined) {
projectReferenceRedirects.set(sourceFilePath, false);
return undefined;
}
+ commandLine = ts.parseJsonSourceFileConfigFileContent(sourceFile, configParsingHost, basePath, /*existingOptions*/ undefined, refPath);
+ }
sourceFile.path = sourceFilePath;
sourceFile.resolvedPath = sourceFilePath;
sourceFile.originalFileName = refPath;
- var commandLine = ts.parseJsonSourceFileConfigFileContent(sourceFile, configParsingHost, basePath, /*existingOptions*/ undefined, refPath);
var resolvedRef = { commandLine: commandLine, sourceFile: sourceFile };
projectReferenceRedirects.set(sourceFilePath, resolvedRef);
if (commandLine.projectReferences) {
@@ -89993,9 +90930,6 @@
if (ts.getEmitDeclarations(options)) {
createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, getEmitDeclarationOptionName(options), "isolatedModules");
}
- if (options.noEmitOnError) {
- createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmitOnError", "isolatedModules");
- }
if (options.out) {
createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_with_option_1, "out", "isolatedModules");
}
@@ -90027,17 +90961,17 @@
createDiagnosticForOptionName(ts.Diagnostics.Option_0_cannot_be_specified_without_specifying_option_1_or_option_2, "tsBuildInfoFile", "incremental", "composite");
}
}
+ else if (options.incremental && !options.outFile && !options.out && !options.configFilePath) {
+ programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified));
+ }
verifyProjectReferences();
// List of collected files is complete; validate exhautiveness if this is a project with a file list
if (options.composite) {
var rootPaths = rootNames.map(toPath);
for (var _i = 0, files_3 = files; _i < files_3.length; _i++) {
var file = files_3[_i];
- // Ignore declaration files
- if (file.isDeclarationFile)
- continue;
- // Ignore json file thats from project reference
- if (ts.isJsonSourceFile(file) && getResolvedProjectReferenceToRedirect(file.fileName))
+ // Ignore file that is not emitted
+ if (!ts.sourceFileMayBeEmitted(file, options, isSourceFileFromExternalLibrary, getResolvedProjectReferenceToRedirect))
continue;
if (rootPaths.indexOf(file.path) === -1) {
programDiagnostics.add(ts.createCompilerDiagnostic(ts.Diagnostics.File_0_is_not_in_project_file_list_Projects_must_list_all_files_or_use_an_include_pattern, file.fileName));
@@ -90114,10 +91048,10 @@
if (options.module === ts.ModuleKind.None && languageVersion < 2 /* ES2015 */) {
createDiagnosticForOptionName(ts.Diagnostics.Option_isolatedModules_can_only_be_used_when_either_option_module_is_provided_or_option_target_is_ES2015_or_higher, "isolatedModules", "target");
}
- var firstNonExternalModuleSourceFile = ts.find(files, function (f) { return !ts.isExternalModule(f) && !f.isDeclarationFile && f.scriptKind !== 6 /* JSON */; });
+ var firstNonExternalModuleSourceFile = ts.find(files, function (f) { return !ts.isExternalModule(f) && !ts.isSourceFileJS(f) && !f.isDeclarationFile && f.scriptKind !== 6 /* JSON */; });
if (firstNonExternalModuleSourceFile) {
var span = ts.getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile);
- programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.Cannot_compile_namespaces_when_the_isolatedModules_flag_is_provided));
+ programDiagnostics.add(ts.createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, ts.Diagnostics.All_files_must_be_modules_when_the_isolatedModules_flag_is_provided));
}
}
else if (firstNonAmbientExternalModuleSourceFile && languageVersion < 2 /* ES2015 */ && options.module === ts.ModuleKind.None) {
@@ -90202,13 +91136,13 @@
var emitFilePath = toPath(emitFileName);
// Report error if the output overwrites input file
if (filesByName.has(emitFilePath)) {
- var chain_2;
+ var chain = void 0;
if (!options.configFilePath) {
// The program is from either an inferred project or an external project
- chain_2 = ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig);
+ chain = ts.chainDiagnosticMessages(/*details*/ undefined, ts.Diagnostics.Adding_a_tsconfig_json_file_will_help_organize_projects_that_contain_both_TypeScript_and_JavaScript_files_Learn_more_at_https_Colon_Slash_Slashaka_ms_Slashtsconfig);
}
- chain_2 = ts.chainDiagnosticMessages(chain_2, ts.Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file, emitFileName);
- blockEmittingOfFile(emitFileName, ts.createCompilerDiagnosticFromMessageChain(chain_2));
+ chain = ts.chainDiagnosticMessages(chain, ts.Diagnostics.Cannot_write_file_0_because_it_would_overwrite_input_file, emitFileName);
+ blockEmittingOfFile(emitFileName, ts.createCompilerDiagnosticFromMessageChain(chain));
}
var emitFileKey = !host.useCaseSensitiveFileNames() ? emitFilePath.toLocaleLowerCase() : emitFilePath;
// Report error if multiple files write into same file
@@ -90743,6 +91677,7 @@
cacheToUpdateSignature.set(sourceFile.path, latestSignature);
return !prevSignature || latestSignature !== prevSignature;
}
+ BuilderState.updateShapeSignature = updateShapeSignature;
/**
* Coverts the declaration emit result into exported modules map
*/
@@ -91020,15 +91955,9 @@
}
}
});
- if (oldCompilerOptions &&
- (oldCompilerOptions.outDir !== compilerOptions.outDir ||
- oldCompilerOptions.declarationDir !== compilerOptions.declarationDir ||
- (oldCompilerOptions.outFile || oldCompilerOptions.out) !== (compilerOptions.outFile || compilerOptions.out))) {
+ if (oldCompilerOptions && ts.compilerOptionsAffectEmit(compilerOptions, oldCompilerOptions)) {
// Add all files to affectedFilesPendingEmit since emit changed
- state.affectedFilesPendingEmit = ts.concatenate(state.affectedFilesPendingEmit, newProgram.getSourceFiles().map(function (f) { return f.path; }));
- if (state.affectedFilesPendingEmitIndex === undefined) {
- state.affectedFilesPendingEmitIndex = 0;
- }
+ addToAffectedFilesPendingEmit(state, newProgram.getSourceFiles().map(function (f) { return f.path; }));
ts.Debug.assert(state.seenAffectedFiles === undefined);
state.seenAffectedFiles = ts.createMap();
}
@@ -91112,7 +92041,7 @@
if (!seenAffectedFiles.has(affectedFile.path)) {
// Set the next affected file as seen and remove the cached semantic diagnostics
state.affectedFilesIndex = affectedFilesIndex;
- cleanSemanticDiagnosticsOfAffectedFile(state, affectedFile);
+ handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash);
return affectedFile;
}
seenAffectedFiles.set(affectedFile.path, true);
@@ -91173,28 +92102,68 @@
return undefined;
}
/**
- * Remove the semantic diagnostics cached from old state for affected File and the files that are referencing modules that export entities from affected file
+ * Handles semantic diagnostics and dts emit for affectedFile and files, that are referencing modules that export entities from affected file
+ * This is because even though js emit doesnt change, dts emit / type used can change resulting in need for dts emit and js change
*/
- function cleanSemanticDiagnosticsOfAffectedFile(state, affectedFile) {
- if (removeSemanticDiagnosticsOf(state, affectedFile.path)) {
- // If there are no more diagnostics from old cache, done
- return;
- }
- // Clean lib file diagnostics if its all files excluding default files to emit
- if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles && !state.cleanedDiagnosticsOfLibFiles) {
+ function handleDtsMayChangeOfAffectedFile(state, affectedFile, cancellationToken, computeHash) {
+ removeSemanticDiagnosticsOf(state, affectedFile.path);
+ // If affected files is everything except default library, then nothing more to do
+ if (state.allFilesExcludingDefaultLibraryFile === state.affectedFiles) {
+ if (!state.cleanedDiagnosticsOfLibFiles) {
state.cleanedDiagnosticsOfLibFiles = true;
var program_1 = ts.Debug.assertDefined(state.program);
var options_2 = program_1.getCompilerOptions();
- if (ts.forEach(program_1.getSourceFiles(), function (f) {
+ ts.forEach(program_1.getSourceFiles(), function (f) {
return program_1.isSourceFileDefaultLibrary(f) &&
!ts.skipTypeChecking(f, options_2) &&
removeSemanticDiagnosticsOf(state, f.path);
- })) {
+ });
+ }
return;
}
+ forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, function (state, path) { return handleDtsMayChangeOf(state, path, cancellationToken, computeHash); });
}
- // If there was change in signature for the changed file,
- // then delete the semantic diagnostics for files that are affected by using exports of this module
+ /**
+ * Handle the dts may change, so they need to be added to pending emit if dts emit is enabled,
+ * Also we need to make sure signature is updated for these files
+ */
+ function handleDtsMayChangeOf(state, path, cancellationToken, computeHash) {
+ removeSemanticDiagnosticsOf(state, path);
+ if (!state.changedFilesSet.has(path)) {
+ var program = ts.Debug.assertDefined(state.program);
+ var sourceFile = program.getSourceFileByPath(path);
+ if (sourceFile) {
+ // Even though the js emit doesnt change and we are already handling dts emit and semantic diagnostics
+ // we need to update the signature to reflect correctness of the signature(which is output d.ts emit) of this file
+ // This ensures that we dont later during incremental builds considering wrong signature.
+ // Eg where this also is needed to ensure that .tsbuildinfo generated by incremental build should be same as if it was first fresh build
+ ts.BuilderState.updateShapeSignature(state, program, sourceFile, ts.Debug.assertDefined(state.currentAffectedFilesSignatures), cancellationToken, computeHash, state.currentAffectedFilesExportedModulesMap);
+ // If not dts emit, nothing more to do
+ if (ts.getEmitDeclarations(state.compilerOptions)) {
+ addToAffectedFilesPendingEmit(state, [path]);
+ }
+ }
+ }
+ return false;
+ }
+ /**
+ * Removes semantic diagnostics for path and
+ * returns true if there are no more semantic diagnostics from the old state
+ */
+ function removeSemanticDiagnosticsOf(state, path) {
+ if (!state.semanticDiagnosticsFromOldState) {
+ return true;
+ }
+ state.semanticDiagnosticsFromOldState.delete(path);
+ state.semanticDiagnosticsPerFile.delete(path);
+ return !state.semanticDiagnosticsFromOldState.size;
+ }
+ /**
+ * Iterate on referencing modules that export entities from affected file
+ */
+ function forEachReferencingModulesOfExportOfAffectedFile(state, affectedFile, fn) {
+ // If there was change in signature (dts output) for the changed file,
+ // then only we need to handle pending file emit
if (!state.exportedModulesMap || state.affectedFiles.length === 1 || !state.changedFilesSet.has(affectedFile.path)) {
return;
}
@@ -91205,7 +92174,7 @@
if (ts.forEachEntry(state.currentAffectedFilesExportedModulesMap, function (exportedModules, exportedFromPath) {
return exportedModules &&
exportedModules.has(affectedFile.path) &&
- removeSemanticDiagnosticsOfFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile);
+ forEachFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile, fn);
})) {
return;
}
@@ -91213,26 +92182,25 @@
ts.forEachEntry(state.exportedModulesMap, function (exportedModules, exportedFromPath) {
return !state.currentAffectedFilesExportedModulesMap.has(exportedFromPath) && // If we already iterated this through cache, ignore it
exportedModules.has(affectedFile.path) &&
- removeSemanticDiagnosticsOfFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile);
+ forEachFilesReferencingPath(state, exportedFromPath, seenFileAndExportsOfFile, fn);
});
}
/**
- * removes the semantic diagnostics of files referencing referencedPath and
- * returns true if there are no more semantic diagnostics from old state
+ * Iterate on files referencing referencedPath
*/
- function removeSemanticDiagnosticsOfFilesReferencingPath(state, referencedPath, seenFileAndExportsOfFile) {
+ function forEachFilesReferencingPath(state, referencedPath, seenFileAndExportsOfFile, fn) {
return ts.forEachEntry(state.referencedMap, function (referencesInFile, filePath) {
- return referencesInFile.has(referencedPath) && removeSemanticDiagnosticsOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile);
+ return referencesInFile.has(referencedPath) && forEachFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, fn);
});
}
/**
- * Removes semantic diagnostics of file and anything that exports this file
+ * fn on file and iterate on anything that exports this file
*/
- function removeSemanticDiagnosticsOfFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile) {
+ function forEachFileAndExportsOfFile(state, filePath, seenFileAndExportsOfFile, fn) {
if (!ts.addToSeen(seenFileAndExportsOfFile, filePath)) {
return false;
}
- if (removeSemanticDiagnosticsOf(state, filePath)) {
+ if (fn(state, filePath)) {
// If there are no more diagnostics from old cache, done
return true;
}
@@ -91242,7 +92210,7 @@
if (ts.forEachEntry(state.currentAffectedFilesExportedModulesMap, function (exportedModules, exportedFromPath) {
return exportedModules &&
exportedModules.has(filePath) &&
- removeSemanticDiagnosticsOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile);
+ forEachFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, fn);
})) {
return true;
}
@@ -91250,7 +92218,7 @@
if (ts.forEachEntry(state.exportedModulesMap, function (exportedModules, exportedFromPath) {
return !state.currentAffectedFilesExportedModulesMap.has(exportedFromPath) && // If we already iterated this through cache, ignore it
exportedModules.has(filePath) &&
- removeSemanticDiagnosticsOfFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile);
+ forEachFileAndExportsOfFile(state, exportedFromPath, seenFileAndExportsOfFile, fn);
})) {
return true;
}
@@ -91258,23 +92226,11 @@
return !!ts.forEachEntry(state.referencedMap, function (referencesInFile, referencingFilePath) {
return referencesInFile.has(filePath) &&
!seenFileAndExportsOfFile.has(referencingFilePath) && // Not already removed diagnostic file
- removeSemanticDiagnosticsOf(state, referencingFilePath);
+ fn(state, referencingFilePath);
} // Dont add to seen since this is not yet done with the export removal
);
}
/**
- * Removes semantic diagnostics for path and
- * returns true if there are no more semantic diagnostics from the old state
- */
- function removeSemanticDiagnosticsOf(state, path) {
- if (!state.semanticDiagnosticsFromOldState) {
- return true;
- }
- state.semanticDiagnosticsFromOldState.delete(path);
- state.semanticDiagnosticsPerFile.delete(path);
- return !state.semanticDiagnosticsFromOldState.size;
- }
- /**
* This is called after completing operation on the next affected file.
* The operations here are postponed to ensure that cancellation during the iteration is handled correctly
*/
@@ -91501,7 +92457,7 @@
return toAffectedFileResult(state,
// When whole program is affected, do emit only once (eg when --out or --outFile is specified)
// Otherwise just affected file
- affected_1.emitBuildInfo(writeFile || host.writeFile, cancellationToken), affected_1,
+ affected_1.emitBuildInfo(writeFile || ts.maybeBind(host, host.writeFile), cancellationToken), affected_1,
/*isPendingEmitFile*/ false,
/*isBuildInfoEmit*/ true);
}
@@ -91517,14 +92473,10 @@
affected = program;
}
}
- // Mark seen emitted files if there are pending files to be emitted
- if (state.affectedFilesPendingEmit && state.program !== affected) {
- (state.seenEmittedFiles || (state.seenEmittedFiles = ts.createMap())).set(affected.path, true);
- }
return toAffectedFileResult(state,
// When whole program is affected, do emit only once (eg when --out or --outFile is specified)
// Otherwise just affected file
- ts.Debug.assertDefined(state.program).emit(affected === state.program ? undefined : affected, writeFile || host.writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers), affected, isPendingEmitFile);
+ ts.Debug.assertDefined(state.program).emit(affected === state.program ? undefined : affected, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers), affected, isPendingEmitFile);
}
/**
* Emits the JavaScript and declaration files.
@@ -91561,7 +92513,7 @@
};
}
}
- return ts.Debug.assertDefined(state.program).emit(targetSourceFile, writeFile || host.writeFile, cancellationToken, emitOnlyDtsFiles, customTransformers);
+ return ts.Debug.assertDefined(state.program).emit(targetSourceFile, writeFile || ts.maybeBind(host, host.writeFile), cancellationToken, emitOnlyDtsFiles, customTransformers);
}
/**
* Return the semantic diagnostics for the next affected file or undefined if iteration is complete
@@ -91618,14 +92570,7 @@
}
// In case of emit builder, cache the files to be emitted
if (affectedFilesPendingEmit) {
- state.affectedFilesPendingEmit = ts.concatenate(state.affectedFilesPendingEmit, affectedFilesPendingEmit);
- // affectedFilesPendingEmitIndex === undefined
- // - means the emit state.affectedFilesPendingEmit was undefined before adding current affected files
- // so start from 0 as array would be affectedFilesPendingEmit
- // else, continue to iterate from existing index, the current set is appended to existing files
- if (state.affectedFilesPendingEmitIndex === undefined) {
- state.affectedFilesPendingEmitIndex = 0;
- }
+ addToAffectedFilesPendingEmit(state, affectedFilesPendingEmit);
}
var diagnostics;
for (var _i = 0, _a = ts.Debug.assertDefined(state.program).getSourceFiles(); _i < _a.length; _i++) {
@@ -91636,6 +92581,16 @@
}
}
ts.createBuilderProgram = createBuilderProgram;
+ function addToAffectedFilesPendingEmit(state, affectedFilesPendingEmit) {
+ state.affectedFilesPendingEmit = ts.concatenate(state.affectedFilesPendingEmit, affectedFilesPendingEmit);
+ // affectedFilesPendingEmitIndex === undefined
+ // - means the emit state.affectedFilesPendingEmit was undefined before adding current affected files
+ // so start from 0 as array would be affectedFilesPendingEmit
+ // else, continue to iterate from existing index, the current set is appended to existing files
+ if (state.affectedFilesPendingEmitIndex === undefined) {
+ state.affectedFilesPendingEmitIndex = 0;
+ }
+ }
function getMapOfReferencedSet(mapLike) {
if (!mapLike)
return undefined;
@@ -92497,11 +93452,11 @@
}
function discoverProbableSymlinks(files, getCanonicalFileName, cwd) {
var result = ts.createMap();
- var symlinks = ts.mapDefined(files, function (sf) {
- return sf.resolvedModules && ts.firstDefinedIterator(sf.resolvedModules.values(), function (res) {
+ var symlinks = ts.flatten(ts.mapDefined(files, function (sf) {
+ return sf.resolvedModules && ts.compact(ts.arrayFrom(ts.mapIterator(sf.resolvedModules.values(), function (res) {
return res && res.originalPath && res.resolvedFileName !== res.originalPath ? [res.resolvedFileName, res.originalPath] : undefined;
- });
- });
+ })));
+ }));
for (var _i = 0, symlinks_1 = symlinks; _i < symlinks_1.length; _i++) {
var _a = symlinks_1[_i], resolvedPath = _a[0], originalPath = _a[1];
var _b = guessDirectorySymlink(resolvedPath, originalPath, cwd, getCanonicalFileName), commonResolved = _b[0], commonOriginal = _b[1];
@@ -92844,6 +93799,14 @@
return "" + newLine + ts.flattenDiagnosticMessageText(d.messageText, newLine) + newLine + newLine;
}
ts.getErrorSummaryText = getErrorSummaryText;
+ function listFiles(program, writeFileName) {
+ if (program.getCompilerOptions().listFiles) {
+ ts.forEach(program.getSourceFiles(), function (file) {
+ writeFileName(file.fileName);
+ });
+ }
+ }
+ ts.listFiles = listFiles;
/**
* Helper that emit files, report diagnostics and lists emitted and/or source files depending on compiler options
*/
@@ -92871,11 +93834,7 @@
var filepath = ts.getNormalizedAbsolutePath(file, currentDir_1);
writeFileName("TSFILE: " + filepath);
});
- if (program.getCompilerOptions().listFiles) {
- ts.forEach(program.getSourceFiles(), function (file) {
- writeFileName(file.fileName);
- });
- }
+ listFiles(program, writeFileName);
}
if (reportSummary) {
reportSummary(getErrorCountForSummary(diagnostics));
@@ -93688,6 +94647,7 @@
function getCompilerOptionsOfBuildOptions(buildOptions) {
var result = {};
ts.commonOptionsWithBuild.forEach(function (option) {
+ if (ts.hasProperty(buildOptions, option.name))
result[option.name] = buildOptions[option.name];
});
return result;
@@ -93707,12 +94667,18 @@
var projectStatus = createFileMap(toPath);
var missingRoots = ts.createMap();
var globalDependencyGraph;
- var writeFileName = function (s) { return host.trace && host.trace(s); };
+ var writeFileName = host.trace ? function (s) { return host.trace(s); } : undefined;
var readFileWithCache = function (f) { return host.readFile(f); };
var projectCompilerOptions = baseCompilerOptions;
var compilerHost = ts.createCompilerHostFromProgramHost(host, function () { return projectCompilerOptions; });
ts.setGetSourceFileAsHashVersioned(compilerHost, host);
+ compilerHost.getParsedCommandLine = parseConfigFile;
+ compilerHost.resolveModuleNames = ts.maybeBind(host, host.resolveModuleNames);
+ compilerHost.resolveTypeReferenceDirectives = ts.maybeBind(host, host.resolveTypeReferenceDirectives);
+ var moduleResolutionCache = !compilerHost.resolveModuleNames ? ts.createModuleResolutionCache(currentDirectory, getCanonicalFileName) : undefined;
+ var cacheState;
var buildInfoChecked = createFileMap(toPath);
+ var extendedConfigCache = ts.createMap();
// Watch state
var builderPrograms = createFileMap(toPath);
var diagnostics = createFileMap(toPath);
@@ -93776,7 +94742,7 @@
}
var diagnostic;
parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = function (d) { return diagnostic = d; };
- var parsed = ts.getParsedCommandLineOfConfigFile(configFilePath, baseCompilerOptions, parseConfigFileHost);
+ var parsed = ts.getParsedCommandLineOfConfigFile(configFilePath, baseCompilerOptions, parseConfigFileHost, extendedConfigCache);
parseConfigFileHost.onUnRecoverableConfigFileDiagnostic = ts.noop;
configFileCache.setValue(configFilePath, parsed || diagnostic);
return parsed;
@@ -94098,6 +95064,7 @@
projectStatus.removeKey(resolved);
diagnostics.removeKey(resolved);
addProjToQueue(resolved, reloadLevel);
+ enableCache();
}
/**
* return true if new addition
@@ -94153,6 +95120,7 @@
}
}
else {
+ disableCache();
reportErrorSummary();
}
}
@@ -94315,6 +95283,28 @@
}
// TODO: handle resolve module name to cache result in project reference redirect
projectCompilerOptions = configFile.options;
+ // Update module resolution cache if needed
+ if (moduleResolutionCache) {
+ var projPath = toPath(proj);
+ if (moduleResolutionCache.directoryToModuleNameMap.redirectsMap.size === 0) {
+ // The own map will be for projectCompilerOptions
+ ts.Debug.assert(moduleResolutionCache.moduleNameToDirectoryMap.redirectsMap.size === 0);
+ moduleResolutionCache.directoryToModuleNameMap.redirectsMap.set(projPath, moduleResolutionCache.directoryToModuleNameMap.ownMap);
+ moduleResolutionCache.moduleNameToDirectoryMap.redirectsMap.set(projPath, moduleResolutionCache.moduleNameToDirectoryMap.ownMap);
+ }
+ else {
+ // Set correct own map
+ ts.Debug.assert(moduleResolutionCache.moduleNameToDirectoryMap.redirectsMap.size > 0);
+ var ref = {
+ sourceFile: projectCompilerOptions.configFile,
+ commandLine: configFile
+ };
+ moduleResolutionCache.directoryToModuleNameMap.setOwnMap(moduleResolutionCache.directoryToModuleNameMap.getOrCreateMapOfCacheRedirects(ref));
+ moduleResolutionCache.moduleNameToDirectoryMap.setOwnMap(moduleResolutionCache.moduleNameToDirectoryMap.getOrCreateMapOfCacheRedirects(ref));
+ }
+ moduleResolutionCache.directoryToModuleNameMap.setOwnOptions(projectCompilerOptions);
+ moduleResolutionCache.moduleNameToDirectoryMap.setOwnOptions(projectCompilerOptions);
+ }
var program = host.createProgram(configFile.fileNames, configFile.options, compilerHost, getOldProgram(proj, configFile), configFile.errors, configFile.projectReferences);
// Don't emit anything in the presence of syntactic errors or options diagnostics
var syntaxDiagnostics = program.getConfigFileParsingDiagnostics().concat(program.getOptionsDiagnostics(), program.getGlobalDiagnostics(), program.getSyntacticDiagnostics());
@@ -94333,7 +95323,7 @@
var declDiagnostics;
var reportDeclarationDiagnostics = function (d) { return (declDiagnostics || (declDiagnostics = [])).push(d); };
var outputFiles = [];
- ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics, writeFileName, /*reportSummary*/ undefined, function (name, text, writeByteOrderMark) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); });
+ ts.emitFilesAndReportErrors(program, reportDeclarationDiagnostics, /*writeFileName*/ undefined, /*reportSummary*/ undefined, function (name, text, writeByteOrderMark) { return outputFiles.push({ name: name, text: text, writeByteOrderMark: writeByteOrderMark }); });
// Don't emit .d.ts if there are decl file errors
if (declDiagnostics) {
program.restoreState();
@@ -94355,7 +95345,7 @@
anyDtsChanged = true;
}
}
- emittedOutputs.setValue(name, true);
+ emittedOutputs.setValue(name, name);
ts.writeFile(compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
if (priorChangeTime !== undefined) {
newestDeclarationFileContentChangedTime = newer(priorChangeTime, newestDeclarationFileContentChangedTime);
@@ -94366,6 +95356,10 @@
if (emitDiagnostics.length) {
return buildErrors(emitDiagnostics, BuildResultFlags.EmitErrors, "Emit");
}
+ if (writeFileName) {
+ emittedOutputs.forEach(function (name) { return listEmittedFile(configFile, name); });
+ ts.listFiles(program, writeFileName);
+ }
// Update time stamps for rest of the outputs
newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(configFile, newestDeclarationFileContentChangedTime, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
var status = {
@@ -94381,12 +95375,20 @@
function buildErrors(diagnostics, errorFlags, errorType) {
resultFlags |= errorFlags;
reportAndStoreErrors(proj, diagnostics);
+ // List files if any other build error using program (emit errors already report files)
+ if (writeFileName)
+ ts.listFiles(program, writeFileName);
projectStatus.setValue(proj, { type: UpToDateStatusType.Unbuildable, reason: errorType + " errors" });
afterProgramCreate(proj, program);
projectCompilerOptions = baseCompilerOptions;
return resultFlags;
}
}
+ function listEmittedFile(proj, file) {
+ if (writeFileName && proj.options.listEmittedFiles) {
+ writeFileName("TSFILE: " + file);
+ }
+ }
function afterProgramCreate(proj, program) {
if (host.afterProgramEmitAndDiagnostics) {
host.afterProgramEmitAndDiagnostics(program);
@@ -94425,7 +95427,7 @@
var emittedOutputs = createFileMap(toPath);
outputFiles.forEach(function (_a) {
var name = _a.name, text = _a.text, writeByteOrderMark = _a.writeByteOrderMark;
- emittedOutputs.setValue(name, true);
+ emittedOutputs.setValue(name, name);
ts.writeFile(compilerHost, emitterDiagnostics, name, text, writeByteOrderMark);
});
var emitDiagnostics = emitterDiagnostics.getDiagnostics();
@@ -94435,6 +95437,9 @@
projectCompilerOptions = baseCompilerOptions;
return BuildResultFlags.DeclarationOutputUnchanged | BuildResultFlags.EmitErrors;
}
+ if (writeFileName) {
+ emittedOutputs.forEach(function (name) { return listEmittedFile(config, name); });
+ }
// Update timestamps for dts
var newestDeclarationFileContentChangedTime = updateOutputTimestampsWorker(config, minimumDate, ts.Diagnostics.Updating_unchanged_output_timestamps_of_project_0, emittedOutputs);
var status = {
@@ -94475,9 +95480,7 @@
priorNewestUpdateTime = newer(priorNewestUpdateTime, host.getModifiedTime(file) || ts.missingFileModifiedTime);
}
host.setModifiedTime(file, now);
- if (proj.options.listEmittedFiles) {
- writeFileName("TSFILE: " + file);
- }
+ listEmittedFile(proj, file);
}
}
return priorNewestUpdateTime;
@@ -94522,28 +95525,67 @@
function resolveProjectNames(configFileNames) {
return configFileNames.map(resolveProjectName);
}
- function buildAllProjects() {
- if (options.watch) {
- reportWatchStatus(ts.Diagnostics.Starting_compilation_in_watch_mode);
+ function enableCache() {
+ if (cacheState) {
+ disableCache();
}
- // TODO:: In watch mode as well to use caches for incremental build once we can invalidate caches correctly and have right api
- // Override readFile for json files and output .d.ts to cache the text
- var savedReadFileWithCache = readFileWithCache;
- var savedGetSourceFile = compilerHost.getSourceFile;
+ var originalReadFileWithCache = readFileWithCache;
+ var originalGetSourceFile = compilerHost.getSourceFile;
var _a = ts.changeCompilerHostLikeToUseCache(host, toPath, function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
- return savedGetSourceFile.call.apply(savedGetSourceFile, [compilerHost].concat(args));
+ return originalGetSourceFile.call.apply(originalGetSourceFile, [compilerHost].concat(args));
}), originalReadFile = _a.originalReadFile, originalFileExists = _a.originalFileExists, originalDirectoryExists = _a.originalDirectoryExists, originalCreateDirectory = _a.originalCreateDirectory, originalWriteFile = _a.originalWriteFile, getSourceFileWithCache = _a.getSourceFileWithCache, newReadFileWithCache = _a.readFileWithCache;
readFileWithCache = newReadFileWithCache;
compilerHost.getSourceFile = getSourceFileWithCache;
+ var originalResolveModuleNames = compilerHost.resolveModuleNames;
+ if (!compilerHost.resolveModuleNames) {
+ var loader_3 = function (moduleName, containingFile, redirectedReference) { return ts.resolveModuleName(moduleName, containingFile, projectCompilerOptions, compilerHost, moduleResolutionCache, redirectedReference).resolvedModule; };
+ compilerHost.resolveModuleNames = function (moduleNames, containingFile, _reusedNames, redirectedReference) {
+ return ts.loadWithLocalCache(ts.Debug.assertEachDefined(moduleNames), containingFile, redirectedReference, loader_3);
+ };
+ }
+ cacheState = {
+ originalReadFile: originalReadFile,
+ originalFileExists: originalFileExists,
+ originalDirectoryExists: originalDirectoryExists,
+ originalCreateDirectory: originalCreateDirectory,
+ originalWriteFile: originalWriteFile,
+ originalReadFileWithCache: originalReadFileWithCache,
+ originalGetSourceFile: originalGetSourceFile,
+ originalResolveModuleNames: originalResolveModuleNames
+ };
+ }
+ function disableCache() {
+ if (!cacheState)
+ return;
+ host.readFile = cacheState.originalReadFile;
+ host.fileExists = cacheState.originalFileExists;
+ host.directoryExists = cacheState.originalDirectoryExists;
+ host.createDirectory = cacheState.originalCreateDirectory;
+ host.writeFile = cacheState.originalWriteFile;
+ compilerHost.getSourceFile = cacheState.originalGetSourceFile;
+ readFileWithCache = cacheState.originalReadFileWithCache;
+ compilerHost.resolveModuleNames = cacheState.originalResolveModuleNames;
+ extendedConfigCache.clear();
+ if (moduleResolutionCache) {
+ moduleResolutionCache.directoryToModuleNameMap.clear();
+ moduleResolutionCache.moduleNameToDirectoryMap.clear();
+ }
+ cacheState = undefined;
+ }
+ function buildAllProjects() {
+ if (options.watch) {
+ reportWatchStatus(ts.Diagnostics.Starting_compilation_in_watch_mode);
+ }
+ enableCache();
var graph = getGlobalDependencyGraph();
reportBuildQueue(graph);
var anyFailed = false;
- for (var _i = 0, _b = graph.buildQueue; _i < _b.length; _i++) {
- var next = _b[_i];
+ for (var _i = 0, _a = graph.buildQueue; _i < _a.length; _i++) {
+ var next = _a[_i];
var proj = parseConfigFile(next);
if (proj === undefined) {
reportParseConfigFileDiagnostic(next);
@@ -94587,13 +95629,7 @@
anyFailed = anyFailed || !!(buildResult & BuildResultFlags.AnyErrors);
}
reportErrorSummary();
- host.readFile = originalReadFile;
- host.fileExists = originalFileExists;
- host.directoryExists = originalDirectoryExists;
- host.createDirectory = originalCreateDirectory;
- host.writeFile = originalWriteFile;
- compilerHost.getSourceFile = savedGetSourceFile;
- readFileWithCache = savedReadFileWithCache;
+ disableCache();
return anyFailed ? ts.ExitStatus.DiagnosticsPresent_OutputsSkipped : ts.ExitStatus.Success;
}
function needsBuild(status, configFile) {
@@ -94684,151 +95720,12 @@
/* @internal */
var ts;
(function (ts) {
- var ValueKind;
- (function (ValueKind) {
- ValueKind[ValueKind["Const"] = 0] = "Const";
- ValueKind[ValueKind["Array"] = 1] = "Array";
- ValueKind[ValueKind["FunctionOrClass"] = 2] = "FunctionOrClass";
- ValueKind[ValueKind["Object"] = 3] = "Object";
- })(ValueKind = ts.ValueKind || (ts.ValueKind = {}));
- function inspectModule(fileNameToRequire) {
- return inspectValue(ts.removeFileExtension(ts.getBaseFileName(fileNameToRequire)), tryRequire(fileNameToRequire));
- }
- ts.inspectModule = inspectModule;
- function inspectValue(name, value) {
- return getValueInfo(name, value, getRecurser());
- }
- ts.inspectValue = inspectValue;
- function getRecurser() {
- var seen = [];
- var nameStack = [];
- return function (obj, name, cbOk, cbFail) {
- if (seen.indexOf(obj) !== -1 || nameStack.length > 4) {
- return cbFail(seen.indexOf(obj) !== -1, nameStack);
- }
- seen.push(obj);
- nameStack.push(name);
- var res = cbOk();
- nameStack.pop();
- seen.pop();
- return res;
- };
- }
- function getValueInfo(name, value, recurser) {
- return recurser(value, name, function () {
- if (typeof value === "function")
- return getFunctionOrClassInfo(value, name, recurser);
- if (typeof value === "object") {
- var builtin = getBuiltinType(name, value, recurser);
- if (builtin !== undefined)
- return builtin;
- var entries = getEntriesOfObject(value);
- var hasNontrivialPrototype = Object.getPrototypeOf(value) !== Object.prototype;
- var members = ts.flatMap(entries, function (_a) {
- var key = _a.key, value = _a.value;
- return getValueInfo(key, value, recurser);
- });
- return { kind: 3 /* Object */, name: name, hasNontrivialPrototype: hasNontrivialPrototype, members: members };
- }
- return { kind: 0 /* Const */, name: name, typeName: isNullOrUndefined(value) ? "any" : typeof value };
- }, function (isCircularReference, keyStack) { return anyValue(name, " " + (isCircularReference ? "Circular reference" : "Too-deep object hierarchy") + " from " + keyStack.join(".")); });
- }
- function getFunctionOrClassInfo(fn, name, recurser) {
- var prototypeMembers = getPrototypeMembers(fn, recurser);
- var namespaceMembers = ts.flatMap(getEntriesOfObject(fn), function (_a) {
- var key = _a.key, value = _a.value;
- return getValueInfo(key, value, recurser);
- });
- var toString = ts.cast(Function.prototype.toString.call(fn), ts.isString);
- var source = ts.stringContains(toString, "{ [native code] }") ? getFunctionLength(fn) : toString;
- return { kind: 2 /* FunctionOrClass */, name: name, source: source, namespaceMembers: namespaceMembers, prototypeMembers: prototypeMembers };
- }
- var builtins = ts.memoize(function () {
- var map = ts.createMap();
- for (var _i = 0, _a = getEntriesOfObject(global); _i < _a.length; _i++) {
- var _b = _a[_i], key = _b.key, value = _b.value;
- if (typeof value === "function" && typeof value.prototype === "object" && value !== Object) {
- map.set(key, value);
- }
- }
- return map;
- });
- function getBuiltinType(name, value, recurser) {
- return ts.isArray(value)
- ? { name: name, kind: 1 /* Array */, inner: value.length && getValueInfo("element", ts.first(value), recurser) || anyValue(name) }
- : ts.forEachEntry(builtins(), function (builtin, builtinName) {
- return value instanceof builtin ? { kind: 0 /* Const */, name: name, typeName: builtinName } : undefined;
- });
- }
- function getPrototypeMembers(fn, recurser) {
- var prototype = fn.prototype;
- // tslint:disable-next-line no-unnecessary-type-assertion (TODO: update LKG and it will really be unnecessary)
- return typeof prototype !== "object" || prototype === null ? ts.emptyArray : ts.mapDefined(getEntriesOfObject(prototype), function (_a) {
- var key = _a.key, value = _a.value;
- return key === "constructor" ? undefined : getValueInfo(key, value, recurser);
- });
- }
- var ignoredProperties = ["arguments", "caller", "constructor", "eval", "super_"];
- var reservedFunctionProperties = Object.getOwnPropertyNames(ts.noop);
- function getEntriesOfObject(obj) {
- var seen = ts.createMap();
- var entries = [];
- var chain = obj;
- while (!isNullOrUndefined(chain) && chain !== Object.prototype && chain !== Function.prototype) {
- for (var _i = 0, _a = Object.getOwnPropertyNames(chain); _i < _a.length; _i++) {
- var key = _a[_i];
- if (!isJsPrivate(key) &&
- ignoredProperties.indexOf(key) === -1 &&
- (typeof obj !== "function" || reservedFunctionProperties.indexOf(key) === -1) &&
- // Don't add property from a higher prototype if it already exists in a lower one
- ts.addToSeen(seen, key)) {
- var value = safeGetPropertyOfObject(chain, key);
- // Don't repeat "toString" that matches signature from Object.prototype
- if (!(key === "toString" && typeof value === "function" && value.length === 0)) {
- entries.push({ key: key, value: value });
- }
- }
- }
- chain = Object.getPrototypeOf(chain);
- }
- return entries.sort(function (e1, e2) { return ts.compareStringsCaseSensitive(e1.key, e2.key); });
- }
- function getFunctionLength(fn) {
- return ts.tryCast(safeGetPropertyOfObject(fn, "length"), ts.isNumber) || 0;
- }
- function safeGetPropertyOfObject(obj, key) {
- var desc = Object.getOwnPropertyDescriptor(obj, key);
- return desc && desc.value;
- }
- function isNullOrUndefined(value) {
- return value == null; // tslint:disable-line
- }
- function anyValue(name, comment) {
- return { kind: 0 /* Const */, name: name, typeName: "any", comment: comment };
- }
- function isJsPrivate(name) {
- return ts.startsWith(name, "_");
- }
- ts.isJsPrivate = isJsPrivate;
- function tryRequire(fileNameToRequire) {
- try {
- return require(fileNameToRequire);
- }
- catch (_a) {
- return undefined;
- }
- }
-})(ts || (ts = {}));
-/* @internal */
-var ts;
-(function (ts) {
var server;
(function (server) {
// tslint:disable variable-name
server.ActionSet = "action::set";
server.ActionInvalidate = "action::invalidate";
server.ActionPackageInstalled = "action::packageInstalled";
- server.ActionValueInspected = "action::valueInspected";
server.EventTypesRegistry = "event::typesRegistry";
server.EventBeginInstallTypes = "event::beginInstallTypes";
server.EventEndInstallTypes = "event::endInstallTypes";
@@ -95777,11 +96674,6 @@
}
break;
}
- case "inspectValue": {
- var response = { kind: server.ActionValueInspected, result: ts.inspectModule(req.options.fileNameToRequire) };
- _this.sendResponse(response);
- break;
- }
default:
ts.Debug.assertNever(req);
}

package.json

@@ -2,7 +2,7 @@
"name": "typescript",
"author": "Microsoft Corp.",
"homepage": "https://www.typescriptlang.org/",
- "version": "3.4.5",
+ "version": "3.5.1",
"license": "Apache-2.0",
"description": "TypeScript is a language for application scale JavaScript development",
"keywords": [
@@ -68,7 +68,6 @@
"gulp-rename": "latest",
"gulp-sourcemaps": "latest",
"istanbul": "latest",
- "lodash": "^4.17.11",
"merge2": "latest",
"minimist": "latest",
"mkdirp": "latest",

README.md

@@ -1,13 +1,15 @@
-[![Build Status](https://travis-ci.org/Microsoft/TypeScript.svg?branch=master)](https://travis-ci.org/Microsoft/TypeScript)
+
+# TypeScript
+
+[![Join the chat at https://gitter.im/Microsoft/TypeScript](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Microsoft/TypeScript?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
+[![Build Status](https://travis-ci.org/microsoft/TypeScript.svg?branch=master)](https://travis-ci.org/Microsoft/TypeScript)
[![VSTS Build Status](https://dev.azure.com/typescript/TypeScript/_apis/build/status/Typescript/node10)](https://dev.azure.com/typescript/TypeScript/_build/latest?definitionId=4&view=logs)
[![npm version](https://badge.fury.io/js/typescript.svg)](https://www.npmjs.com/package/typescript)
[![Downloads](https://img.shields.io/npm/dm/typescript.svg)](https://www.npmjs.com/package/typescript)
-# TypeScript
-[![Join the chat at https://gitter.im/Microsoft/TypeScript](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Microsoft/TypeScript?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
-[TypeScript](https://www.typescriptlang.org/) is a language for application-scale JavaScript. TypeScript adds optional types to JavaScript that support tools for large-scale JavaScript applications for any browser, for any host, on any OS. TypeScript compiles to readable, standards-based JavaScript. Try it out at the [playground](https://www.typescriptlang.org/play/), and stay up to date via [our blog](https://blogs.msdn.microsoft.com/typescript) and [Twitter account](https://twitter.com/typescriptlang).
+[TypeScript](https://www.typescriptlang.org/) is a language for application-scale JavaScript. TypeScript adds optional types to JavaScript that support tools for large-scale JavaScript applications for any browser, for any host, on any OS. TypeScript compiles to readable, standards-based JavaScript. Try it out at the [playground](https://www.typescriptlang.org/play/), and stay up to date via [our blog](https://blogs.msdn.microsoft.com/typescript) and [Twitter account](https://twitter.com/typescript).
## Installing
@@ -79,8 +81,6 @@
gulp runtests # Run tests using the built compiler and test infrastructure.
# You can override the host or specify a test for this command.
# Use --host=<hostName> or --tests=<testPath>.
-gulp runtests-browser # Runs the tests using the built run.js file. Syntax is gulp runtests. Optional
- parameters '--host=', '--tests=[regex], --reporter=[list|spec|json|<more>]'.
gulp baseline-accept # This replaces the baseline test results with the results obtained from gulp runtests.
gulp lint # Runs tslint on the TypeScript source.
gulp help # List the above commands.